From 723449ceeebec66d2f5782628311dc1ff6393363 Mon Sep 17 00:00:00 2001 From: Fun Coder Date: Fri, 11 Sep 2020 16:29:39 -0400 Subject: [PATCH] Made string column sorting case insensitive and Improved integer column sorting so it can sort values even with thousand separated --- dhtmlx.js | 6360 ++++- dhtmlx_Unminified.js | 58499 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 64851 insertions(+), 8 deletions(-) create mode 100644 dhtmlx_Unminified.js diff --git a/dhtmlx.js b/dhtmlx.js index eea0161..6047b16 100644 --- a/dhtmlx.js +++ b/dhtmlx.js @@ -1,9 +1,6353 @@ -/* -Product Name: dhtmlxSuite -Version: 4.5.1 -Edition: Standard -License: content of this file is covered by GPL. Usage outside GPL terms is prohibited. To obtain Commercial or Enterprise license contact sales@dhtmlx.com -Copyright UAB Dinamenta http://www.dhtmlx.com -*/ -if(typeof(window.dhx4)=="undefined"){window.dhx4={version:"4.5.1",skin:null,skinDetect:function(a){return{10:"dhx_skyblue",20:"dhx_web",30:"dhx_terrace"}[this.readFromCss(a+"_skin_detect")]||null},readFromCss:function(e,g){var c=document.createElement("DIV");c.className=e;if(document.body.firstChild!=null){document.body.insertBefore(c,document.body.firstChild)}else{document.body.appendChild(c)}var a=c[g||"offsetWidth"];c.parentNode.removeChild(c);c=null;return a},lastId:1,newId:function(){return this.lastId++},zim:{data:{},step:5,first:function(){return 100},last:function(){var e=this.first();for(var c in this.data){e=Math.max(e,this.data[c])}return e},reserve:function(a){this.data[a]=this.last()+this.step;return this.data[a]},clear:function(a){if(this.data[a]!=null){this.data[a]=null;delete this.data[a]}}},s2b:function(a){if(typeof(a)=="string"){a=a.toLowerCase()}return(a==true||a==1||a=="true"||a=="1"||a=="yes"||a=="y"||a=="on")},s2j:function(s){var obj=null;dhx4.temp=null;try{eval("dhx4.temp="+s)}catch(e){dhx4.temp=null}obj=dhx4.temp;dhx4.temp=null;return obj},absLeft:function(a){if(typeof(a)=="string"){a=document.getElementById(a)}return this.getOffset(a).left},absTop:function(a){if(typeof(a)=="string"){a=document.getElementById(a)}return this.getOffset(a).top},_aOfs:function(a){var e=0,c=0;while(a){e=e+parseInt(a.offsetTop);c=c+parseInt(a.offsetLeft);a=a.offsetParent}return{top:e,left:c}},_aOfsRect:function(g){var l=g.getBoundingClientRect();var m=document.body;var c=document.documentElement;var a=window.pageYOffset||c.scrollTop||m.scrollTop;var h=window.pageXOffset||c.scrollLeft||m.scrollLeft;var j=c.clientTop||m.clientTop||0;var n=c.clientLeft||m.clientLeft||0;var o=l.top+a-j;var e=l.left+h-n;return{top:Math.round(o),left:Math.round(e)}},getOffset:function(a){if(a.getBoundingClientRect){return this._aOfsRect(a)}else{return this._aOfs(a)}},_isObj:function(a){return(a!=null&&typeof(a)=="object"&&typeof(a.length)=="undefined")},_copyObj:function(g){if(this._isObj(g)){var e={};for(var c in g){if(typeof(g[c])=="object"&&g[c]!=null){e[c]=this._copyObj(g[c])}else{e[c]=g[c]}}}else{var e=[];for(var c=0;c=0);var c={};c.left=document.body.scrollLeft;c.right=c.left+(window.innerWidth||document.body.clientWidth);c.top=Math.max((a?document.documentElement:document.getElementsByTagName("html")[0]).scrollTop,document.body.scrollTop);c.bottom=c.top+(a?Math.max(document.documentElement.clientHeight||0,document.documentElement.offsetHeight||0):window.innerHeight);return c},selectTextRange:function(h,l,c){h=(typeof(h)=="string"?document.getElementById(h):h);var a=h.value.length;l=Math.max(Math.min(l,a),0);c=Math.min(c,a);if(h.setSelectionRange){try{h.setSelectionRange(l,c)}catch(j){}}else{if(h.createTextRange){var g=h.createTextRange();g.moveStart("character",l);g.moveEnd("character",c-a);try{g.select()}catch(j){}}}},transData:null,transDetect:function(){if(this.transData==null){this.transData={transProp:false,transEv:null};var e={MozTransition:"transitionend",WebkitTransition:"webkitTransitionEnd",OTransition:"oTransitionEnd",msTransition:"transitionend",transition:"transitionend"};for(var c in e){if(this.transData.transProp==false&&document.documentElement.style[c]!=null){this.transData.transProp=c;this.transData.transEv=e[c]}}e=null}return this.transData},_xmlNodeValue:function(a){var e="";for(var c=0;c=0||navigator.userAgent.indexOf("Trident")>=0);window.dhx4.isIE6=(window.XMLHttpRequest==null&&navigator.userAgent.indexOf("MSIE")>=0);window.dhx4.isIE7=(navigator.userAgent.indexOf("MSIE 7.0")>=0&&navigator.userAgent.indexOf("Trident")<0);window.dhx4.isIE8=(navigator.userAgent.indexOf("MSIE 8.0")>=0&&navigator.userAgent.indexOf("Trident")>=0);window.dhx4.isIE9=(navigator.userAgent.indexOf("MSIE 9.0")>=0&&navigator.userAgent.indexOf("Trident")>=0);window.dhx4.isIE10=(navigator.userAgent.indexOf("MSIE 10.0")>=0&&navigator.userAgent.indexOf("Trident")>=0&&window.navigator.pointerEnabled!=true);window.dhx4.isIE11=(navigator.userAgent.indexOf("Trident")>=0&&window.navigator.pointerEnabled==true);window.dhx4.isEdge=(navigator.userAgent.indexOf("Edge")>=0);window.dhx4.isOpera=(navigator.userAgent.indexOf("Opera")>=0);window.dhx4.isChrome=(navigator.userAgent.indexOf("Chrome")>=0)&&!window.dhx4.isEdge;window.dhx4.isKHTML=(navigator.userAgent.indexOf("Safari")>=0||navigator.userAgent.indexOf("Konqueror")>=0)&&!window.dhx4.isEdge;window.dhx4.isFF=(navigator.userAgent.indexOf("Firefox")>=0);window.dhx4.isIPad=(navigator.userAgent.search(/iPad/gi)>=0);window.dhx4.dnd={evs:{},p_en:((window.dhx4.isIE||window.dhx4.isEdge)&&(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)),_mTouch:function(a){return(window.dhx4.isIE10&&a.pointerType==a.MSPOINTER_TYPE_MOUSE||window.dhx4.isIE11&&a.pointerType=="mouse"||window.dhx4.isEdge&&a.pointerType=="mouse")},_touchOn:function(a){if(a==null){a=document.body}a.style.touchAction=a.style.msTouchAction="";a=null},_touchOff:function(a){if(a==null){a=document.body}a.style.touchAction=a.style.msTouchAction="none";a=null}};if(window.navigator.pointerEnabled==true){window.dhx4.dnd.evs={start:"pointerdown",move:"pointermove",end:"pointerup"}}else{if(window.navigator.msPointerEnabled==true){window.dhx4.dnd.evs={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"}}else{if(typeof(window.addEventListener)!="undefined"){window.dhx4.dnd.evs={start:"touchstart",move:"touchmove",end:"touchend"}}}}}if(typeof(window.dhx4.template)=="undefined"){window.dhx4.trim=function(a){return String(a).replace(/^\s{1,}/,"").replace(/\s{1,}$/,"")};window.dhx4.template=function(c,e,a){return c.replace(/#([a-z0-9_-]{1,})(\|([^#]*))?#/gi,function(){var l=arguments[1];var j=window.dhx4.trim(arguments[3]);var m=null;var h=[e[l]];if(j.length>0){j=j.split(":");var g=[];for(var n=0;n0&&g[g.length-1].match(/\\$/)!=null){g[g.length-1]=g[g.length-1].replace(/\\$/,"")+":"+j[n]}else{g.push(j[n])}}m=g[0];for(var n=1;n0&&typeof(e[l])!="undefined"){if(a==true){return window.dhx4.trim(e[l])}return String(e[l])}return""})};window.dhx4.template.date=function(a,c){if(a!=null){if(a instanceof Date){return window.dhx4.date2str(a,c)}else{a=a.toString();if(a.match(/^\d*$/)!=null){return window.dhx4.date2str(new Date(parseInt(a)),c)}return a}}return""};window.dhx4.template.maxlength=function(c,a){return String(c).substr(0,a)};window.dhx4.template.number_format=function(g,h,e,a){var c=window.dhx4.template._parseFmt(h,e,a);if(c==false){return g}return window.dhx4.template._getFmtValue(g,c)};window.dhx4.template.lowercase=function(a){if(typeof(a)=="undefined"||a==null){a=""}return String(a).toLowerCase()};window.dhx4.template.uppercase=function(a){if(typeof(a)=="undefined"||a==null){a=""}return String(a).toUpperCase()};window.dhx4.template._parseFmt=function(l,e,a){var g=l.match(/^([^\.\,0-9]*)([0\.\,]*)([^\.\,0-9]*)/);if(g==null||g.length!=4){return false}var c={i_len:false,i_sep:(typeof(e)=="string"?e:","),d_len:false,d_sep:(typeof(a)=="string"?a:"."),s_bef:(typeof(g[1])=="string"?g[1]:""),s_aft:(typeof(g[3])=="string"?g[3]:"")};var j=g[2].split(".");if(j[1]!=null){c.d_len=j[1].length}var h=j[0].split(",");if(h.length>1){c.i_len=h[h.length-1].length}return c};window.dhx4.template._getFmtValue=function(value,fmt){var r=String(value).match(/^(-)?([0-9]{1,})(\.([0-9]{1,}))?$/);if(r!=null&&r.length==5){var v0="";if(r[1]!=null){v0+=r[1]}v0+=fmt.s_bef;if(fmt.i_len!==false){var i=0;var v1="";for(var q=r[2].length-1;q>=0;q--){v1=""+r[2].charAt(q)+v1;if(++i==fmt.i_len&&q>0){v1=fmt.i_sep+v1;i=0}}v0+=v1}else{v0+=r[2]}if(fmt.d_len!==false){if(r[4]==null){r[4]=""}while(r[4].length11?"pm":"am");case"%A":return(j.getHours()>11?"PM":"AM");case"%%":return"%";case"%u":return j.getMilliseconds();case"%P":if(window.dhx4.temp_calendar!=null&&window.dhx4.temp_calendar.tz!=null){return window.dhx4.temp_calendar.tz}var r=j.getTimezoneOffset();var o=Math.abs(Math.floor(r/60));var l=Math.abs(r)-o*60;return(r>0?"-":"+")+h(o)+":"+h(l);default:return n}};var e=String(g||window.dhx4.dateFormat).replace(/%[a-zA-Z]/g,c)}return(e||String(j))};window.dhx4.str2date=function(j,y,D){if(y==null||typeof(y)=="undefnied"){y=window.dhx4.dateFormat[window.dhx4.dateLang]}if(D==null||typeof(D)=="undefnied"){D=window.dhx4.dateStrings[window.dhx4.dateLang]}y=y.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\\:|]/g,"\\$&");var C=[];var n=[];y=y.replace(/%[a-z]/gi,function(e){switch(e){case"%d":case"%m":case"%y":case"%h":case"%H":case"%i":case"%s":n.push(e);return"(\\d{2})";case"%D":case"%l":case"%M":case"%F":n.push(e);return"([a-zéûä\u0430-\u044F\u0451]{1,})";case"%j":case"%n":case"%g":case"%G":n.push(e);return"(\\d{1,2})";case"%Y":n.push(e);return"(\\d{4})";case"%a":n.push(e);return"([a|p]m)";case"%A":n.push(e);return"([A|P]M)";case"%u":n.push(e);return"(\\d{1,6})";case"%P":n.push(e);return"([+-]\\d{1,2}:\\d{1,2})"}return e});var E=new RegExp(y,"i");var o=j.match(E);if(o==null||o.length-1!=n.length){return"Invalid Date"}for(var c=1;c=0){a.setMonth(l)}break;case"%y":if(!isNaN(C[c])){var A=Number(C[c]);a.setFullYear(A+(A>50?1900:2000))}break;case"%g":case"%h":if(!isNaN(C[c])){var A=Number(C[c]);if(A<=12&&A>=0){a.setHours(A+(u("pm",C)>=0?(A==12?0:12):(A==12?-12:0)))}}break;case"%P":if(window.dhx4.temp_calendar!=null){window.dhx4.temp_calendar.tz=C[c]}break}}return a}}if(typeof(window.dhx4.ajax)=="undefined"){window.dhx4.ajax={cache:false,method:"get",parse:function(a){if(typeof a!=="string"){return a}a=a.replace(/^[\s]+/,"");if(window.DOMParser&&!dhx4.isIE){var c=(new window.DOMParser()).parseFromString(a,"text/xml")}else{if(window.ActiveXObject!==window.undefined){var c=new window.ActiveXObject("Microsoft.XMLDOM");c.async="false";c.loadXML(a)}}return c},xmltop:function(a,h,g){if(typeof h.status=="undefined"||h.status<400){xml=(!h.responseXML)?dhx4.ajax.parse(h.responseText||h):(h.responseXML||h);if(xml&&xml.documentElement!==null){try{if(!xml.getElementsByTagName("parsererror").length){return xml.getElementsByTagName(a)[0]}}catch(c){}}}if(g!==-1){dhx4.callEvent("onLoadXMLError",["Incorrect XML",arguments[1],g])}return document.createElement("DIV")},xpath:function(g,a){if(!a.nodeName){a=a.responseXML||a}if(dhx4.isIE){try{return a.selectNodes(g)||[]}catch(j){return[]}}else{var h=[];var l;var c=(a.ownerDocument||a).evaluate(g,a,null,XPathResult.ANY_TYPE,null);while(l=c.iterateNext()){h.push(l)}return h}},query:function(a){dhx4.ajax._call((a.method||"GET"),a.url,a.data||"",(a.async||true),a.callback,null,a.headers)},get:function(a,c){return this._call("GET",a,null,true,c)},getSync:function(a){return this._call("GET",a,null,false)},put:function(c,a,e){return this._call("PUT",c,a,true,e)},del:function(c,a,e){return this._call("DELETE",c,a,true,e)},post:function(c,a,e){if(arguments.length==1){a=""}else{if(arguments.length==2&&(typeof(a)=="function"||typeof(window[a])=="function")){e=a;a=""}else{a=String(a)}}return this._call("POST",c,a,true,e)},postSync:function(c,a){a=(a==null?"":String(a));return this._call("POST",c,a,false)},getLong:function(a,c){this._call("GET",a,null,true,c,{url:a})},postLong:function(c,a,e){if(arguments.length==2&&(typeof(a)=="function"||typeof(window[a]))){e=a;a=""}this._call("POST",c,a,true,e,{url:c,postData:a})},_call:function(a,c,e,h,l,o,g){var n=(window.XMLHttpRequest&&!dhx4.isIE?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"));var j=(navigator.userAgent.match(/AppleWebKit/)!=null&&navigator.userAgent.match(/Qt/)!=null&&navigator.userAgent.match(/Safari/)!=null);if(h==true){n.onreadystatechange=function(){if((n.readyState==4)||(j==true&&n.readyState==3)){if(n.status!=200||n.responseText==""){if(!dhx4.callEvent("onAjaxError",[{xmlDoc:n,filePath:c,async:h}])){return}}window.setTimeout(function(){if(typeof(l)=="function"){l.apply(window,[{xmlDoc:n,filePath:c,async:h}])}if(o!=null){if(typeof(o.postData)!="undefined"){dhx4.ajax.postLong(o.url,o.postData,l)}else{dhx4.ajax.getLong(o.url,l)}}l=null;n=null},1)}}}if(a=="GET"&&this.cache!=true){c+=(c.indexOf("?")>=0?"&":"?")+"dhxr"+new Date().getTime()+"=1"}n.open(a,c,h);if(g!=null){for(var m in g){n.setRequestHeader(m,g[m])}}else{if(a=="POST"||a=="PUT"||a=="DELETE"){n.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}else{if(a=="GET"){e=null}}}n.setRequestHeader("X-Requested-With","XMLHttpRequest");n.send(e);return{xmlDoc:n,filePath:c,async:h}}}}if(typeof(window.dhx4._enableDataLoading)=="undefined"){window.dhx4._enableDataLoading=function(l,e,j,h,m){if(m=="clear"){for(var c in l._dhxdataload){l._dhxdataload[c]=null;delete l._dhxdataload[c]}l._loadData=null;l._dhxdataload=null;l.load=null;l.loadStruct=null;l=null;return}l._dhxdataload={initObj:e,xmlToJson:j,xmlRootTag:h,onBeforeXLS:null};l._loadData=function(u,v,w){if(arguments.length==2){w=v;v=null}var s=null;if(arguments.length==3){w=arguments[2]}if(typeof(u)=="string"){var r=u.replace(/^\s{1,}/,"").replace(/\s{1,}$/,"");var A=new RegExp("^<"+this._dhxdataload.xmlRootTag);if(A.test(r.replace(/^<\?xml[^\?]*\?>\s*/,""))){s=dhx4.ajax.parse(u);if(s!=null){s=this[this._dhxdataload.xmlToJson].apply(this,[s])}}if(s==null&&(r.match(/^[\s\S]*{[.\s\S]*}[\s\S]*$/)!=null||r.match(/^[\s\S]*\[[.\s\S]*\][\s\S]*$/)!=null)){s=dhx4.s2j(r)}if(s==null){this.callEvent("onXLS",[]);var o=[];if(typeof(this._dhxdataload.onBeforeXLS)=="function"){var r=this._dhxdataload.onBeforeXLS.apply(this,[u]);if(r!=null&&typeof(r)=="object"){if(r.url!=null){u=r.url}if(r.params!=null){for(var x in r.params){o.push(x+"="+encodeURIComponent(r.params[x]))}}}}var y=this;var n=function(a){var C=null;if((a.xmlDoc.getResponseHeader("Content-Type")||"").search(/xml/gi)>=0||(a.xmlDoc.responseText.replace(/^\s{1,}/,"")).match(/^0?(u.indexOf("?")>0?"&":"?")+o:""),n)}}return}}else{if(typeof(u.documentElement)=="object"||(typeof(u.tagName)!="undefined"&&typeof(u.getElementsByTagName)!="undefined"&&u.getElementsByTagName(this._dhxdataload.xmlRootTag).length>0)){s=this[this._dhxdataload.xmlToJson].apply(this,[u])}else{s=window.dhx4._copyObj(u)}}if(s!=null){this[this._dhxdataload.initObj].apply(this,[s])}if(w!=null){if(typeof(w)=="function"){w.apply(this,[])}else{if(typeof(window[w])=="function"){window[w].apply(this,[])}}w=null}};if(m!=null){var g={struct:"loadStruct",data:"load"};for(var c in m){if(m[c]==true){l[g[c]]=function(){return this._loadData.apply(this,arguments)}}}}l=null}}if(typeof(window.dhx4._eventable)=="undefined"){window.dhx4._eventable=function(a,c){if(c=="clear"){a.detachAllEvents();a.dhxevs=null;a.attachEvent=null;a.detachEvent=null;a.checkEvent=null;a.callEvent=null;a.detachAllEvents=null;a=null;return}a.dhxevs={data:{}};a.attachEvent=function(e,h){e=String(e).toLowerCase();if(!this.dhxevs.data[e]){this.dhxevs.data[e]={}}var g=window.dhx4.newId();this.dhxevs.data[e][g]=h;return g};a.detachEvent=function(j){for(var g in this.dhxevs.data){var h=0;for(var e in this.dhxevs.data[g]){if(e==j){this.dhxevs.data[g][e]=null;delete this.dhxevs.data[g][e]}else{h++}}if(h==0){this.dhxevs.data[g]=null;delete this.dhxevs.data[g]}}};a.checkEvent=function(e){e=String(e).toLowerCase();return(this.dhxevs.data[e]!=null)};a.callEvent=function(g,j){g=String(g).toLowerCase();if(this.dhxevs.data[g]==null){return true}var h=true;for(var e in this.dhxevs.data[g]){h=this.dhxevs.data[g][e].apply(this,j)&&h}return h};a.detachAllEvents=function(){for(var g in this.dhxevs.data){for(var e in this.dhxevs.data[g]){this.dhxevs.data[g][e]=null;delete this.dhxevs.data[g][e]}this.dhxevs.data[g]=null;delete this.dhxevs.data[g]}};a=null};dhx4._eventable(dhx4)}if(!window.dhtmlxValidation){dhtmlxValidation=function(){};dhtmlxValidation.prototype={isEmpty:function(a){return a==""},isNotEmpty:function(a){return(a instanceof Array?a.length>0:!a=="")},isValidBoolean:function(a){return !!a.toString().match(/^(0|1|true|false)$/)},isValidEmail:function(a){return !!a.toString().match(/(^[a-z0-9]([0-9a-z\-_\.]*)@([0-9a-z_\-\.]*)([.][a-z]{3})$)|(^[a-z]([0-9a-z_\.\-]*)@([0-9a-z_\-\.]*)(\.[a-z]{2,4})$)/i)},isValidInteger:function(a){return !!a.toString().match(/(^-?\d+$)/)},isValidNumeric:function(a){return !!a.toString().match(/(^-?\d\d*[\.|,]\d*$)|(^-?\d\d*$)|(^-?[\.|,]\d\d*$)/)},isValidAplhaNumeric:function(a){return !!a.toString().match(/^[_\-a-z0-9]+$/gi)},isValidDatetime:function(c){var a=c.toString().match(/^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/);return a&&!!(a[1]<=9999&&a[2]<=12&&a[3]<=31&&a[4]<=59&&a[5]<=59&&a[6]<=59)||false},isValidDate:function(a){var c=a.toString().match(/^(\d{4})-(\d{2})-(\d{2})$/);return c&&!!(c[1]<=9999&&c[2]<=12&&c[3]<=31)||false},isValidTime:function(c){var a=c.toString().match(/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/);return a&&!!(a[1]<=24&&a[2]<=59&&a[3]<=59)||false},isValidIPv4:function(a){var c=a.toString().match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);return c&&!!(c[1]<=255&&c[2]<=255&&c[3]<=255&&c[4]<=255)||false},isValidCurrency:function(a){return a.toString().match(/^\$?\s?\d+?([\.,\,]?\d+)?\s?\$?$/)&&true||false},isValidSSN:function(a){return a.toString().match(/^\d{3}\-?\d{2}\-?\d{4}$/)&&true||false},isValidSIN:function(a){return a.toString().match(/^\d{9}$/)&&true||false}};dhtmlxValidation=new dhtmlxValidation()}if(typeof(window.dhtmlx)=="undefined"){window.dhtmlx={extend:function(e,c){for(var g in c){if(!e[g]){e[g]=c[g]}}return e},extend_api:function(a,g,e){var c=window[a];if(!c){return}window[a]=function(l){if(l&&typeof l=="object"&&!l.tagName){var j=c.apply(this,(g._init?g._init(l):arguments));for(var h in dhtmlx){if(g[h]){this[g[h]](dhtmlx[h])}}for(var h in l){if(g[h]){this[g[h]](l[h])}else{if(h.indexOf("on")===0){this.attachEvent(h,l[h])}}}}else{var j=c.apply(this,arguments)}if(g._patch){g._patch(this)}return j||this};window[a].prototype=c.prototype;if(e){dhtmlx.extend(window[a].prototype,e)}},url:function(a){if(a.indexOf("?")!=-1){return"&"}else{return"?"}}}}function dhtmlDragAndDropObject(){if(window.dhtmlDragAndDrop){return window.dhtmlDragAndDrop}this.lastLanding=0;this.dragNode=0;this.dragStartNode=0;this.dragStartObject=0;this.tempDOMU=null;this.tempDOMM=null;this.waitDrag=0;window.dhtmlDragAndDrop=this;return this}dhtmlDragAndDropObject.prototype.removeDraggableItem=function(a){a.onmousedown=null;a.dragStarter=null;a.dragLanding=null};dhtmlDragAndDropObject.prototype.addDraggableItem=function(a,c){a.onmousedown=this.preCreateDragCopy;a.dragStarter=c;this.addDragLanding(a,c)};dhtmlDragAndDropObject.prototype.addDragLanding=function(a,c){a.dragLanding=c};dhtmlDragAndDropObject.prototype.preCreateDragCopy=function(a){if((a||window.event)&&(a||event).button==2){return}if(window.dhtmlDragAndDrop.waitDrag){window.dhtmlDragAndDrop.waitDrag=0;document.body.onmouseup=window.dhtmlDragAndDrop.tempDOMU;document.body.onmousemove=window.dhtmlDragAndDrop.tempDOMM;return false}if(window.dhtmlDragAndDrop.dragNode){window.dhtmlDragAndDrop.stopDrag(a)}window.dhtmlDragAndDrop.waitDrag=1;window.dhtmlDragAndDrop.tempDOMU=document.body.onmouseup;window.dhtmlDragAndDrop.tempDOMM=document.body.onmousemove;window.dhtmlDragAndDrop.dragStartNode=this;window.dhtmlDragAndDrop.dragStartObject=this.dragStarter;document.body.onmouseup=window.dhtmlDragAndDrop.preCreateDragCopy;document.body.onmousemove=window.dhtmlDragAndDrop.callDrag;window.dhtmlDragAndDrop.downtime=new Date().valueOf();if((a)&&(a.preventDefault)){a.preventDefault();return false}return false};dhtmlDragAndDropObject.prototype.callDrag=function(g){if(!g){g=window.event}dragger=window.dhtmlDragAndDrop;if((new Date()).valueOf()-dragger.downtime<100){return}if(!dragger.dragNode){if(dragger.waitDrag){dragger.dragNode=dragger.dragStartObject._createDragNode(dragger.dragStartNode,g);if(!dragger.dragNode){return dragger.stopDrag()}dragger.dragNode.onselectstart=function(){return false};dragger.gldragNode=dragger.dragNode;document.body.appendChild(dragger.dragNode);document.body.onmouseup=dragger.stopDrag;dragger.waitDrag=0;dragger.dragNode.pWindow=window;dragger.initFrameRoute()}else{return dragger.stopDrag(g,true)}}if(dragger.dragNode.parentNode!=window.document.body&&dragger.gldragNode){var a=dragger.gldragNode;if(dragger.gldragNode.old){a=dragger.gldragNode.old}a.parentNode.removeChild(a);var c=dragger.dragNode.pWindow;if(a.pWindow&&a.pWindow.dhtmlDragAndDrop.lastLanding){a.pWindow.dhtmlDragAndDrop.lastLanding.dragLanding._dragOut(a.pWindow.dhtmlDragAndDrop.lastLanding)}if(_isIE){var j=document.createElement("Div");j.innerHTML=dragger.dragNode.outerHTML;dragger.dragNode=j.childNodes[0]}else{dragger.dragNode=dragger.dragNode.cloneNode(true)}dragger.dragNode.pWindow=window;dragger.gldragNode.old=dragger.dragNode;document.body.appendChild(dragger.dragNode);c.dhtmlDragAndDrop.dragNode=dragger.dragNode}dragger.dragNode.style.left=g.clientX+15+(dragger.fx?dragger.fx*(-1):0)+(document.body.scrollLeft||document.documentElement.scrollLeft)+"px";dragger.dragNode.style.top=g.clientY+3+(dragger.fy?dragger.fy*(-1):0)+(document.body.scrollTop||document.documentElement.scrollTop)+"px";if(!g.srcElement){var h=g.target}else{h=g.srcElement}dragger.checkLanding(h,g)};dhtmlDragAndDropObject.prototype.calculateFramePosition=function(h){if(window.name){var e=parent.frames[window.name].frameElement.offsetParent;var g=0;var c=0;while(e){g+=e.offsetLeft;c+=e.offsetTop;e=e.offsetParent}if((parent.dhtmlDragAndDrop)){var a=parent.dhtmlDragAndDrop.calculateFramePosition(1);g+=a.split("_")[0]*1;c+=a.split("_")[1]*1}if(h){return g+"_"+c}else{this.fx=g}this.fy=c}return"0_0"};dhtmlDragAndDropObject.prototype.checkLanding=function(c,a){if((c)&&(c.dragLanding)){if(this.lastLanding){this.lastLanding.dragLanding._dragOut(this.lastLanding)}this.lastLanding=c;this.lastLanding=this.lastLanding.dragLanding._dragIn(this.lastLanding,this.dragStartNode,a.clientX,a.clientY,a);this.lastLanding_scr=(_isIE?a.srcElement:a.target)}else{if((c)&&(c.tagName!="BODY")){this.checkLanding(c.parentNode,a)}else{if(this.lastLanding){this.lastLanding.dragLanding._dragOut(this.lastLanding,a.clientX,a.clientY,a)}this.lastLanding=0;if(this._onNotFound){this._onNotFound()}}}};dhtmlDragAndDropObject.prototype.stopDrag=function(c,g){dragger=window.dhtmlDragAndDrop;if(!g){dragger.stopFrameRoute();var a=dragger.lastLanding;dragger.lastLanding=null;if(a){a.dragLanding._drag(dragger.dragStartNode,dragger.dragStartObject,a,(_isIE?event.srcElement:c.target))}}dragger.lastLanding=null;if((dragger.dragNode)&&(dragger.dragNode.parentNode==document.body)){dragger.dragNode.parentNode.removeChild(dragger.dragNode)}dragger.dragNode=0;dragger.gldragNode=0;dragger.fx=0;dragger.fy=0;dragger.dragStartNode=0;dragger.dragStartObject=0;document.body.onmouseup=dragger.tempDOMU;document.body.onmousemove=dragger.tempDOMM;dragger.tempDOMU=null;dragger.tempDOMM=null;dragger.waitDrag=0};dhtmlDragAndDropObject.prototype.stopFrameRoute=function(g){if(g){window.dhtmlDragAndDrop.stopDrag(1,1)}for(var a=0;a-1){_isChrome=true}if((navigator.userAgent.indexOf("Safari")!=-1)||(navigator.userAgent.indexOf("Konqueror")!=-1)){_KHTMLrv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Safari")+7,5));if(_KHTMLrv>525){_isFF=true;_FFrv=1.9}else{_isKHTML=true}}else{if(navigator.userAgent.indexOf("Opera")!=-1){_isOpera=true;_OperaRv=parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera")+6,3))}else{if(navigator.appName.indexOf("Microsoft")!=-1){_isIE=true;if((navigator.appVersion.indexOf("MSIE 8.0")!=-1||navigator.appVersion.indexOf("MSIE 9.0")!=-1||navigator.appVersion.indexOf("MSIE 10.0")!=-1||document.documentMode>7)&&document.compatMode!="BackCompat"){_isIE=8}}else{if(navigator.appName=="Netscape"&&navigator.userAgent.indexOf("Trident")!=-1){_isIE=8}else{_isFF=true;_FFrv=parseFloat(navigator.userAgent.split("rv:")[1])}}}}if(typeof(window.dhtmlxEvent)=="undefined"){function dhtmlxEvent(c,e,a){if(c.addEventListener){c.addEventListener(e,a,false)}else{if(c.attachEvent){c.attachEvent("on"+e,a)}}}}if(dhtmlxEvent.touchDelay==null){dhtmlxEvent.touchDelay=2000}if(typeof(dhtmlxEvent.initTouch)=="undefined"){dhtmlxEvent.initTouch=function(){var g;var h;var c,a;dhtmlxEvent(document.body,"touchstart",function(j){h=j.touches[0].target;c=j.touches[0].clientX;a=j.touches[0].clientY;g=window.setTimeout(e,dhtmlxEvent.touchDelay)});function e(){if(h){var j=document.createEvent("HTMLEvents");j.initEvent("dblclick",true,true);h.dispatchEvent(j);g=h=null}}dhtmlxEvent(document.body,"touchmove",function(j){if(g){if(Math.abs(j.touches[0].clientX-c)>50||Math.abs(j.touches[0].clientY-a)>50){window.clearTimeout(g);g=h=false}}});dhtmlxEvent(document.body,"touchend",function(j){if(g){window.clearTimeout(g);g=h=false}});dhtmlxEvent.initTouch=function(){}}}if(!window.dhtmlx){dhtmlx={}}dhtmlx.assert=function(c,a){if(!c){dhtmlx.error(a)}};dhtmlx.assert_enabled=function(){return false};dhtmlx.assert_event=function(j,e){if(!j._event_check){j._event_check={};j._event_check_size={}}for(var c in e){j._event_check[c.toLowerCase()]=e[c];var h=-1;for(var g in e[c]){h++}j._event_check_size[c.toLowerCase()]=h}};dhtmlx.assert_method_info=function(h,c,g,j){var a=[];for(var e=0;e=0){return true}return false};dhtmlx.assert_rule_dimension.describe=function(){return"{Integer} value must be a positive number"};dhtmlx.assert_rule_number=function(a){if(typeof a=="number"){return true}return false};dhtmlx.assert_rule_number.describe=function(){return"{Integer} value must be a number"};dhtmlx.assert_rule_function=function(a){if(typeof a=="function"){return true}return false};dhtmlx.assert_rule_function.describe=function(){return"{Function} value must be a custom function"};dhtmlx.assert_rule_any=function(a){return true};dhtmlx.assert_rule_any.describe=function(){return"Any value"};dhtmlx.assert_rule_mix=function(e,c){var g=function(a){if(e(a)||c(a)){return true}return false};g.describe=function(){return e.describe()};return g}}dhtmlx.codebase="./";dhtmlx.copy=function(c){var a=dhtmlx.copy._function;a.prototype=c;return new a()};dhtmlx.copy._function=function(){};dhtmlx.extend=function(c,a){for(var e in a){c[e]=a[e]}if(dhtmlx.assert_enabled()&&a._assert){c._assert();c._assert=null}dhtmlx.assert(c,"Invalid nesting target");dhtmlx.assert(a,"Invalid nesting source");if(a._init){c._init()}return c};dhtmlx.proto_extend=function(){var j=arguments;var e=j[0];var c=[];for(var h=j.length-1;h>0;h--){if(typeof j[h]=="function"){j[h]=j[h].prototype}for(var g in j[h]){if(g=="_init"){c.push(j[h][g])}else{if(!e[g]){e[g]=j[h][g]}}}}if(j[0]._init){c.push(j[0]._init)}e._init=function(){for(var l=0;l=0){this.splice(c,(a||1))}},remove:function(a){this.removeAt(this.find(a))},insertAt:function(c,e){if(!e&&e!==0){this.push(c)}else{var a=this.splice(e,(this.length-e));this[e]=c;this.push.apply(this,a)}},find:function(a){for(i=0;ie){var c=e;e=g;g=c}return this.getIndexRange(g,e)},getIndexRange:function(g,e){e=Math.min((e||Infinity),this.dataCount()-1);var a=dhtmlx.toArray();for(var c=(g||0);c<=e;c++){a.push(this.item(this.order[c]))}return a},dataCount:function(){return this.order.length},exists:function(a){return !!(this.pull[a])},move:function(a,g){if(a<0||g<0){dhtmlx.error("DataStore::move","Incorrect indexes");return}var e=this.idByIndex(a);var c=this.item(e);this.order.removeAt(a);this.order.insertAt(e,Math.min(this.order.length,g));this.callEvent("onStoreUpdated",[e,c,"move"])},scheme:function(a){this._scheme=a},sync:function(h,g,a){if(typeof g!="function"){a=g;g=null}if(dhtmlx.debug_bind){this.debug_sync_master=h;dhtmlx.log("[sync] "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id+" <= "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id)}var e=h;if(h.name!="DataStore"){h=h.data}var c=dhtmlx.bind(function(m,j,l){if(l!="update"||g){m=null}if(!m){this.order=dhtmlx.toArray([].concat(h.order));this._filter_order=null;this.pull=h.pull;if(g){this.silent(g)}if(this._on_sync){this._on_sync()}}if(dhtmlx.debug_bind){dhtmlx.log("[sync:request] "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id+" <= "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id)}if(!a){this.refresh(m)}else{a=false}},this);h.attachEvent("onStoreUpdated",c);this.feed=function(l,j){e.loadNext(j,l)};c()},add:function(h,a){if(this._scheme){h=h||{};for(var c in this._scheme){h[c]=h[c]||this._scheme[c]}if(this._scheme){if(this._scheme.$init){this._scheme.$update(h)}else{if(this._scheme.$update){this._scheme.$update(h)}}}}var j=this.id(h);var g=this.dataCount();if(dhtmlx.isNotDefined(a)||a<0){a=g}if(a>g){dhtmlx.log("Warning","DataStore:add","Index of out of bounds");a=Math.min(this.order.length,a)}if(this.callEvent("onBeforeAdd",[j,h,a])===false){return false}if(this.exists(j)){return dhtmlx.error("Not unique ID")}this.pull[j]=h;this.order.insertAt(j,a);if(this._filter_order){var e=this._filter_order.length;if(!a&&this.order.length){e=0}this._filter_order.insertAt(j,e)}this.callEvent("onafterAdd",[j,a]);this.callEvent("onStoreUpdated",[j,h,"add"]);return j},remove:function(e){if(e instanceof Array){for(var a=0;a=this.order.length||a<0){dhtmlx.log("Warning","DataStore::idByIndex Incorrect index")}return this.order[a]},indexById:function(c){var a=this.order.find(c);return a},next:function(c,a){return this.order[this.indexById(c)+(a||1)]},first:function(){return this.order[0]},last:function(){return this.order[this.order.length-1]},previous:function(c,a){return this.order[this.indexById(c)-(a||1)]},sort:function(j,c,a){var e=j;if(typeof j=="function"){e={as:j,dir:c}}else{if(typeof j=="string"){e={by:j,dir:c,as:a}}}var h=[e.by,e.dir,e.as];if(!this.callEvent("onbeforesort",h)){return}if(this.order.length){var l=dhtmlx.sort.create(e);var g=this.getRange(this.first(),this.last());g.sort(l);this.order=g.map(function(m){return this.id(m)},this)}this.refresh();this.callEvent("onaftersort",h)},filter:function(h,g){if(!this.callEvent("onBeforeFilter",[h,g])){return}if(this._filter_order){this.order=this._filter_order;delete this._filter_order}if(!this.order.length){return}if(h){var c=h;g=g||"";if(typeof h=="string"){h=dhtmlx.Template.fromHTML(h);g=g.toString().toLowerCase();c=function(m,l){return h(m).toLowerCase().indexOf(l)!=-1}}var e=dhtmlx.toArray();for(var a=0;ac?1:(ec?1:(ec?1:(e")!=-1){c=c.split("->");switch(c[0]){case"html":c=dhtmlx.html.getValue(c[1]).replace(/\"/g,'\\"');break;case"http":c=new dhtmlx.ajax().sync().get(c[1],{uid:(new Date()).valueOf()}).responseText;break;default:break}}e[a]=dhtmlx.Template.fromHTML(c)}}};dhtmlx.SingleRender={_init:function(){},_toHTML:function(a){return this.type._item_start(a,this.type)+this.type.template(a,this.type)+this.type._item_end},render:function(){if(!this.callEvent||this.callEvent("onBeforeRender",[this.data])){if(this.data){this._dataobj.innerHTML=this._toHTML(this.data)}if(this.callEvent){this.callEvent("onAfterRender",[])}}}};dhtmlx.ui.Tooltip=function(a){this.name="Tooltip";if(dhtmlx.assert_enabled()){this._assert()}if(typeof a=="string"){a={template:a}}dhtmlx.extend(this,dhtmlx.Settings);dhtmlx.extend(this,dhtmlx.SingleRender);this._parseSettings(a,{type:"default",dy:0,dx:20});this._dataobj=this._obj=document.createElement("DIV");this._obj.className="dhx_tooltip";dhtmlx.html.insertBefore(this._obj,document.body.firstChild)};dhtmlx.ui.Tooltip.prototype={show:function(a,c){if(this._disabled){return}if(this.data!=a){this.data=a;this.render(a)}this._obj.style.top=c.y+this._settings.dy+"px";this._obj.style.left=c.x+this._settings.dx+"px";this._obj.style.display="block"},hide:function(){this.data=null;this._obj.style.display="none"},disable:function(){this._disabled=true},enable:function(){this._disabled=false},types:{"default":dhtmlx.Template.fromHTML("{obj.id}")},template_item_start:dhtmlx.Template.empty,template_item_end:dhtmlx.Template.empty};dhtmlx.AutoTooltip={tooltip_setter:function(c){var a=new dhtmlx.ui.Tooltip(c);this.attachEvent("onMouseMove",function(h,g){a.show(this.get(h),dhtmlx.html.pos(g))});this.attachEvent("onMouseOut",function(h,g){a.hide()});this.attachEvent("onMouseMoving",function(h,g){a.hide()});return a}};dhtmlx.compat=function(a,c){if(dhtmlx.compat[a]){dhtmlx.compat[a](c)}};if(!dhtmlx.attaches){dhtmlx.attaches={}}dhtmlx.attaches.attachAbstract=function(c,a){var h=document.createElement("DIV");h.id="CustomObject_"+dhtmlx.uid();h.style.width="100%";h.style.height="100%";h.cmp="grid";document.body.appendChild(h);this.attachObject(h.id);a.container=h.id;var g=this.vs[this.av];g.grid=new window[c](a);g.gridId=h.id;g.gridObj=h;g.grid.setSizes=function(){if(this.resize){this.resize()}else{this.render()}};var e="_viewRestore";return this.vs[this[e]()].grid};dhtmlx.attaches.attachDataView=function(a){return this.attachAbstract("dhtmlXDataView",a)};dhtmlx.attaches.attachChart=function(a){return this.attachAbstract("dhtmlXChart",a)};dhtmlx.compat.layout=function(){};function dhtmlXCellObject(e,a){this.cell=document.createElement("DIV");this.cell.className="dhx_cell"+(a||"");this._idd=e;this._isCell=true;this.conf={borders:true,idx:{},css:a||"",idx_data:{cont:"dhx_cell_cont",pr1:"dhx_cell_progress_bar",pr2:"dhx_cell_progress_img",menu:"dhx_cell_menu",toolbar:"dhx_cell_toolbar",ribbon:"dhx_cell_ribbon",sb:"dhx_cell_statusbar",cover:"dhx_cell_cover"},ofs_nodes:{t:{},b:{}}};this.dataNodes={};this.views={};var c=document.createElement("DIV");c.className="dhx_cell_cont"+this.conf.css;this.cell.appendChild(c);c=null;this._updateIdx=function(){for(var g in this.conf.idx){this.conf.idx[g]=null;delete this.conf.idx[g]}for(var l=0;l0){this.views[j].cellCont.push(l.firstChild);l.removeChild(l.firstChild)}l=null;this.dataType=null;this.dataObj=null;this.conf.url_data=null;for(var h in this.dataNodes){for(var g in this.conf.ofs_nodes){if(typeof(this.conf.ofs_nodes[g][h])!="undefined"){this.views[j].ofs_nodes[g][h]=this.conf.ofs_nodes[g][h];this.conf.ofs_nodes[g][h]=null;delete this.conf.ofs_nodes[g][h]}}this.views[j].dataNodesCont[h]=this.cell.childNodes[this.conf.idx[h]];this.cell.removeChild(this.cell.childNodes[this.conf.idx[h]]);this.views[j].dataNodes[h]=this.dataNodes[h];this.dataNodes[h]=null;delete this.dataNodes[h];this._updateIdx()}this.callEvent("_onViewSave",[j])};this._viewRestore=function(j){if(this.views[j]==null){return}this.dataObj=this.views[j].dataObj;this.dataType=this.views[j].dataType;this.conf.url_data=this.views[j].url_data;for(var l=0;l"+a.xmlDoc.responseText+"");if(typeof(n._doOnFrameContentLoaded)=="function"){n._doOnFrameContentLoaded()}n.dataType="url-ajax";n=a=null})}else{dhx4.ajax.get(c,function(a){n.attachHTMLString("
"+a.xmlDoc.responseText+"
");if(typeof(n._doOnFrameContentLoaded)=="function"){n._doOnFrameContentLoaded()}n.dataType="url-ajax";n=a=null})}}else{if(this.dataType=="url"){var j=this.getFrame()}else{var j=document.createElement("IFRAME");j.frameBorder=0;j.border=0;j.style.width="100%";j.style.height="100%";j.style.position="relative";this._attachObject(j);this.dataType="url";this._attachURLEvents()}if(g){var l=(typeof(this.conf.url_data.post_ifr)=="undefined");this.conf.url_data.post_ifr=true;if(l){this._attachURLEvents()}j.src="about:blank"}else{j.src=c+(window.dhx4.ajax.cache!=true?(c.indexOf("?")>=0?"&":"?")+"dhxr"+new Date().getTime():"")}j=null}j=null};dhtmlXCellObject.prototype.reloadURL=function(){if(!(this.dataType=="url"||this.dataType=="url-ajax")){return}if(this.conf.url_data==null){return}this.attachURL(this.conf.url_data.url,this.conf.url_data.ajax,this.conf.url_data.post_data)};dhtmlXCellObject.prototype.attachHTMLString=function(str){this._attachObject(null,null,str);var z=str.match(/]*>[^\f]*?<\/script>/g)||[];for(var i=0;i]*>/gi,"");if(s){if(window.execScript){window.execScript(s)}else{window.eval(s)}}}};dhtmlXCellObject.prototype.attachScheduler=function(a,l,c,g){g=g||window.scheduler;var h=false;if(c){var j=document.getElementById(c);if(j){h=true}}if(!h){var e=c||'
';var j=document.createElement("DIV");j.id="dhxSchedObj_"+new Date().getTime();j.style.width="100%";j.style.height="100%";j.style.position="relative";j.style.overflow="hidden";j.className="dhx_cal_container";j.innerHTML='
 
 
'+e+'
'}this._attachObject(j);this.dataType="scheduler";this.dataObj=g;this.dataObj.setSizes=function(){this.update_view()};g.init(j.id,a,l);j=null;this.callEvent("_onContentAttach",[]);return this.dataObj};dhtmlXCellObject.prototype.attachMap=function(a){var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";c.style.overflow="hidden";this._attachObject(c);if(!a){a={center:new google.maps.LatLng(40.719837,-73.992348),zoom:11,mapTypeId:google.maps.MapTypeId.ROADMAP}}this.dataType="maps";this.dataObj=new google.maps.Map(c,a);this.dataObj.setSizes=function(){google.maps.event.trigger(this,"resize")};c=null;this.callEvent("_onContentAttach",[]);return this.dataObj};dhtmlXCellObject.prototype._createNode_sb=function(m,g,l,a,j){if(typeof(j)!="undefined"){m=j}else{var c=g||{};var n=(typeof(c.text)=="string"&&c.text.length>0?c.text:" ");var e=(typeof(c.height)=="number"?c.height:false);var m=document.createElement("DIV");m.className="dhx_cell_statusbar_def";m.innerHTML="
"+n+"
";if(e!=false){m.firstChild.style.height=m.firstChild.style.lineHeight=e+"px"}}if(this.conf.idx.pr1!=null){this.cell.insertBefore(m,this.cell.childNodes[this.conf.idx.pr1])}else{this.cell.appendChild(m)}this.conf.ofs_nodes.b.sb=true;this._updateIdx();this._adjustCont(this._idd);return m};dhtmlXCellObject.prototype.attachStatusBar=function(a){if(this.dataNodes.sb){return}if(a!=null&&window.dhx4.s2b(a.paging)==true){a.height=null}if(this.conf.skin=="dhx_skyblue"&&typeof(window.dhtmlXWindowsCell)!="undefined"&&(this instanceof dhtmlXWindowsCell)){this.cell.childNodes[this.conf.idx.cont].className+=" dhx_cell_statusbar_attached"}this.dataNodes.sb=this._attachObject("sb",a);this.dataNodes.sb.setText=function(c){this.childNodes[0].innerHTML=c};this.dataNodes.sb.getText=function(){return this.childNodes[0].innerHTML};this.dataNodes.sb.onselectstart=function(c){return false};return this.dataNodes.sb};dhtmlXCellObject.prototype.detachStatusBar=function(){if(!this.dataNodes.sb){return}if(this.conf.skin=="dhx_skyblue"&&typeof(window.dhtmlXWindowsCell)!="undefined"&&(this instanceof dhtmlXWindowsCell)){this.cell.childNodes[this.conf.idx.cont].className=this.cell.childNodes[this.conf.idx.cont].className.replace(/\s{0,}dhx_cell_statusbar_attached/,"")}this.dataNodes.sb.setText=this.dataNodes.sb.getText=this.dataNodes.sb.onselectstart=null;this.dataNodes.sb=null;delete this.dataNodes.sb;this._detachObject("sb")};dhtmlXCellObject.prototype.showStatusBar=function(){this._mtbShowHide("sb","")};dhtmlXCellObject.prototype.hideStatusBar=function(){this._mtbShowHide("sb","none")};dhtmlXCellObject.prototype._mtbShowHide=function(c,a){if(!this.dataNodes[c]){return}this.cell.childNodes[this.conf.idx[c]].style.display=a;this._adjustCont()};dhtmlXCellObject.prototype.getFrame=dhtmlXCellObject.prototype._getFrame=function(){if(this.dataType!="url"){return null}return this.cell.childNodes[this.conf.idx.cont].firstChild};dhtmlXCellObject.prototype._attachURLEvents=function(){if(this.dataType!="url"){return}var e=this;var c=this._idd;var a=this.cell.childNodes[this.conf.idx.cont].firstChild;if(typeof(this._doOnFrameMouseDown)!="function"){this._doOnFrameMouseDown=function(g){e.callEvent("_onContentMouseDown",[c,g||event])}}if(typeof(window.addEventListener)=="function"){a.onload=function(){try{if(typeof(e._doOnFrameMouseDown)=="function"){this.contentWindow.document.body.addEventListener("mousedown",e._doOnFrameMouseDown,false)}}catch(g){}try{if(typeof(e._doOnFrameContentLoaded)=="function"){e._doOnFrameContentLoaded()}}catch(g){}}}else{a.onreadystatechange=function(g){if(this.readyState=="complete"){try{if(typeof(e._doOnFrameMouseDown)=="function"){this.contentWindow.document.body.attachEvent("onmousedown",e._doOnFrameMouseDown)}}catch(h){}try{if(typeof(e._doOnFrameContentLoaded)=="function"){e._doOnFrameContentLoaded()}}catch(h){}}}}};dhtmlXCellObject.prototype._doOnFrameContentLoaded=function(){if(this.conf.url_data.post_ifr==true){var j=this.getFrame().contentWindow.document;var h=j.createElement("FORM");h.method="POST";h.action=this.conf.url_data.url;j.body.appendChild(h);var e={};if(window.dhx4.ajax.cache!=true){e["dhxr"+new Date().getTime()]="1"}for(var c in this.conf.url_data.post_data){e[c]=this.conf.url_data.post_data[c]}for(var c in e){var g=j.createElement("INPUT");g.type="hidden";g.name=c;g.value=e[c];h.appendChild(g);g=null}this.conf.url_data.post_ifr=false;h.submit()}else{this.callEvent("_onContentLoaded",[this._idd])}};dhtmlXCellObject.prototype._detachURLEvents=function(a){if(a==null){if(this.dataType!="url"){return}a=this.cell.childNodes[this.conf.idx.cont].firstChild}if(typeof(window.addEventListener)=="function"){a.onload=null;try{a.contentWindow.document.body.removeEventListener("mousedown",this._doOnFrameMouseDown,false)}catch(c){}}else{a.onreadystatechange=null;try{a.contentWindow.document.body.detachEvent("onmousedown",this._doOnFrameMouseDown)}catch(c){}}a=null};dhtmlXCellObject.prototype._attachObject=function(h,c,g,a,e){if(typeof(h)=="string"&&{menu:1,toolbar:1,ribbon:1,sb:1}[h]==1){return this["_createNode_"+h].apply(this,arguments)}if(a!=true){this._detachObject(null,true,null)}if(typeof(g)=="string"){this.cell.childNodes[this.conf.idx.cont].innerHTML=g}else{this.cell.childNodes[this.conf.idx.cont].appendChild(h)}h=null};dhtmlXCellObject.prototype._detachObject=function(h,c,a){this.callEvent("_onBeforeContentDetach",[]);if(h=="menu"||h=="toolbar"||h=="ribbon"||h=="sb"){var g=this.cell.childNodes[this.conf.idx[h]];g.parentNode.removeChild(g);g=null;this.conf.ofs_nodes[h=="sb"?"b":"t"][h]=false;this._updateIdx();if(!this.conf.unloading){this._adjustCont(this._idd)}return}if(c==true){a=false}else{if(typeof(a)=="undefined"){a=document.body}else{if(typeof(a)=="string"){a=document.getElementById(a)}}}if(a===false){if(this.dataType=="url"){this._detachURLEvents()}else{if(this.dataObj!=null){if(typeof(this.dataObj.unload)=="function"){this.dataObj.unload()}else{if(typeof(this.dataObj.destructor)=="function"){this.dataObj.destructor()}}}}}var g=this.cell.childNodes[this.conf.idx.cont];while(g.childNodes.length>0){if(a===false){g.removeChild(g.lastChild)}else{g.firstChild.style.display="none";a.appendChild(g.firstChild)}}if(this.conf.append_mode){g.style.overflow="";this.conf.append_mode=false}var e=(this.dataType=="tabbar");this.dataObj=null;this.dataType=null;a=g=null;if(this.conf.unloading!=true&&e){this.showHeader(true);this._showBorders()}};dhtmlXCellObject.prototype._attachFromCell=function(c){this.detachObject(true);var g="layout";if(typeof(window.dhtmlXWindowsCell)!="undefined"&&this instanceof window.dhtmlXWindowsCell){g="window"}if(typeof(window.dhtmlXWindowsCell)!="undefined"&&c instanceof window.dhtmlXWindowsCell&&c.wins.w[c._idd].conf.parked){c.wins._winCellSetOpacity(c._idd,"open",false)}if(typeof(window.dhtmlXAccordionCell)!="undefined"&&c instanceof window.dhtmlXAccordionCell&&c.conf.opened==false){c._cellSetOpacity("open",false)}for(var e in c.dataNodes){this._attachObject(e,null,null,null,c.cell.childNodes[c.conf.idx[e]]);this.dataNodes[e]=c.dataNodes[e];c.dataNodes[e]=null;c.conf.ofs_nodes[e=="sb"?"b":"t"][e]=false;c._updateIdx()}this._mtbUpdBorder();if(c.dataType!=null&&c.dataObj!=null){this.dataType=c.dataType;this.dataObj=c.dataObj;while(c.cell.childNodes[c.conf.idx.cont].childNodes.length>0){this.cell.childNodes[this.conf.idx.cont].appendChild(c.cell.childNodes[c.conf.idx.cont].firstChild)}c.dataType=null;c.dataObj=null;if(this.dataType=="grid"){if(g=="window"&&this.conf.skin=="dhx_skyblue"){this.dataObj.entBox.style.border="1px solid #a4bed4";this.dataObj._sizeFix=0}else{this.dataObj.entBox.style.border="0px solid white";this.dataObj._sizeFix=2}}}else{while(c.cell.childNodes[c.conf.idx.cont].childNodes.length>0){this.cell.childNodes[this.conf.idx.cont].appendChild(c.cell.childNodes[c.conf.idx.cont].firstChild)}}this.conf.view=c.conf.view;c.conf.view="def";for(var e in c.views){this.views[e]=c.views[e];c.views[e]=null;delete c.views[e]}c._updateIdx();c._adjustCont();this._updateIdx();this._adjustCont();if(c.conf.progress==true){c.progressOff();this.progressOn()}else{this.progressOff()}if(g=="window"&&this.wins.w[this._idd].conf.parked){this.wins._winCellSetOpacity(this._idd,"close",false)}};function dhtmlXCellTop(h,c){if(arguments.length==0||typeof(h)=="undefined"){return}var a=this;this.dataNodes={};this.conf.ofs={t:0,b:0,l:0,r:0};this.conf.ofs_nodes={t:{},b:{}};this.conf.progress=false;this.conf.fs_mode=false;this.conf.fs_tm=null;this.conf.fs_resize=false;if(h==document.body){this.conf.fs_mode=true;this.base=h;if(this.base==document.body){var g={dhx_skyblue:{t:2,b:2,l:2,r:2},dhx_web:{t:8,b:8,l:8,r:8},dhx_terrace:{t:9,b:9,l:8,r:8}};this.conf.ofs=(g[this.conf.skin]!=null?g[this.conf.skin]:g.dhx_skyblue)}}else{this.base=(typeof(h)=="string"?document.getElementById(h):h)}this.base.className+=" "+this.conf.css+"_base_"+this.conf.skin;this.cont=document.createElement("DIV");this.cont.className=this.conf.css+"_cont";this.base.appendChild(this.cont);if(c!=null){this.setOffsets(c,false)}else{if(this.base._ofs!=null){this.setOffsets(this.base._ofs,false);this.base._ofs=null;try{delete this.base._ofs}catch(j){}}}this._adjustCont=function(){var m=this.conf.ofs.t;for(var l in this.conf.ofs_nodes.t){m+=(this.conf.ofs_nodes.t[l]==true?this.dataNodes[l].offsetHeight:0)}var e=this.conf.ofs.b;for(var l in this.conf.ofs_nodes.b){e+=(this.conf.ofs_nodes.b[l]==true?this.dataNodes[l].offsetHeight:0)}this.cont.style.left=this.conf.ofs.l+"px";this.cont.style.width=this.base.clientWidth-this.conf.ofs.l-this.conf.ofs.r+"px";this.cont.style.top=m+"px";this.cont.style.height=this.base.clientHeight-m-e+"px"};this._setBaseSkin=function(e){this.base.className=this.base.className.replace(new RegExp(this.conf.css+"_base_"+this.conf.skin,"gi"),this.conf.css+"_base_"+e)};this._initFSResize=function(){if(this.conf.fs_resize==true){return}this._doOnResizeStart=function(){window.clearTimeout(a.conf.fs_tm);a.conf.fs_tm=window.setTimeout(a._doOnResizeEnd,200)};this._doOnResizeEnd=function(){a.setSizes()};if(typeof(window.addEventListener)=="function"){window.addEventListener("resize",this._doOnResizeStart,false)}else{window.attachEvent("onresize",this._doOnResizeStart)}this.conf.fs_resize=true};if(this.conf.fs_mode==true){this._initFSResize()}this._unloadTop=function(){this._mtbUnload();this.detachHeader();this.detachFooter();if(this.conf.fs_mode==true){if(typeof(window.addEventListener)=="function"){window.removeEventListener("resize",this._doOnResizeStart,false)}else{window.detachEvent("onresize",this._doOnResizeStart)}}this.base.removeChild(this.cont);var e=new RegExp("s{0,}"+this.conf.css+"_base_"+this.conf.skin,"gi");this.base.className=this.base.className.replace(e,"");this.cont=this.base=null;a=null};h=null}dhtmlXCellTop.prototype.setOffsets=function(j,h){var g=false;for(var c in j){var e=c.charAt(0);if(typeof(this.conf.ofs[e])!="undefined"&&!isNaN(j[c])){this.conf.ofs[e]=parseInt(j[c]);g=true}}if(h!==false&&typeof(this.setSizes)=="function"&&g==true){this.setSizes()}};dhtmlXCellTop.prototype.attachMenu=function(a){if(this.dataNodes.menu!=null){return}this.dataNodes.menuObj=document.createElement("DIV");this.dataNodes.menuObj.className="dhxcelltop_menu";this.base.insertBefore(this.dataNodes.menuObj,this.dataNodes.toolbarObj||this.dataNodes.ribbonObj||this.cont);if(typeof(a)!="object"||a==null){a={}}a.skin=this.conf.skin;a.parent=this.dataNodes.menuObj;this.dataNodes.menu=new dhtmlXMenuObject(a);this.dataNodes.menuEv=this.attachEvent("_onSetSizes",function(){if(this.dataNodes.menuObj.style.display=="none"){return}this.dataNodes.menuObj.style.left=this.conf.ofs.l+"px";this.dataNodes.menuObj.style.marginTop=(this.dataNodes.haObj!=null?0:this.conf.ofs.t)+"px";this.dataNodes.menuObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px"});this.conf.ofs_nodes.t.menuObj=true;this.setSizes();a.parnt=null;a=null;return this.dataNodes.menu};dhtmlXCellTop.prototype.detachMenu=function(){if(this.dataNodes.menu==null){return}this.dataNodes.menu.unload();this.dataNodes.menu=null;this.dataNodes.menuObj.parentNode.removeChild(this.dataNodes.menuObj);this.dataNodes.menuObj=null;this.detachEvent(this.dataNodes.menuEv);this.dataNodes.menuEv=null;delete this.dataNodes.menu;delete this.dataNodes.menuObj;delete this.dataNodes.menuEv;this.conf.ofs_nodes.t.menuObj=false;if(!this.conf.unloading){this.setSizes()}};dhtmlXCellTop.prototype.attachToolbar=function(a){if(!(this.dataNodes.ribbon==null&&this.dataNodes.toolbar==null)){return}this.dataNodes.toolbarObj=document.createElement("DIV");this.dataNodes.toolbarObj.className="dhxcelltop_toolbar";this.base.insertBefore(this.dataNodes.toolbarObj,this.cont);this.dataNodes.toolbarObj.appendChild(document.createElement("DIV"));if(typeof(a)!="object"||a==null){a={}}a.skin=this.conf.skin;a.parent=this.dataNodes.toolbarObj.firstChild;this.dataNodes.toolbar=new dhtmlXToolbarObject(a);this.dataNodes.toolbarEv=this.attachEvent("_onSetSizes",function(){if(this.dataNodes.toolbarObj.style.display=="none"){return}this.dataNodes.toolbarObj.style.left=this.conf.ofs.l+"px";this.dataNodes.toolbarObj.style.marginTop=(this.dataNodes.haObj!=null||this.dataNodes.menuObj!=null?0:this.conf.ofs.t)+"px";this.dataNodes.toolbarObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px"});this.dataNodes.toolbar._masterCell=this;this.dataNodes.toolbar.attachEvent("_onIconSizeChange",function(){this._masterCell.setSizes()});this.conf.ofs_nodes.t.toolbarObj=true;this.setSizes();a.parnt=null;a=null;return this.dataNodes.toolbar};dhtmlXCellTop.prototype.detachToolbar=function(){if(this.dataNodes.toolbar==null){return}this.dataNodes.toolbar._masterCell=null;this.dataNodes.toolbar.unload();this.dataNodes.toolbar=null;this.dataNodes.toolbarObj.parentNode.removeChild(this.dataNodes.toolbarObj);this.dataNodes.toolbarObj=null;this.detachEvent(this.dataNodes.toolbarEv);this.dataNodes.toolbarEv=null;this.conf.ofs_nodes.t.toolbarObj=false;delete this.dataNodes.toolbar;delete this.dataNodes.toolbarObj;delete this.dataNodes.toolbarEv;if(!this.conf.unloading){this.setSizes()}};dhtmlXCellTop.prototype.attachRibbon=function(a){if(!(this.dataNodes.ribbon==null&&this.dataNodes.toolbar==null)){return}this.dataNodes.ribbonObj=document.createElement("DIV");this.dataNodes.ribbonObj.className="dhxcelltop_ribbon";this.base.insertBefore(this.dataNodes.ribbonObj,this.cont);this.dataNodes.ribbonObj.appendChild(document.createElement("DIV"));if(typeof(a)!="object"||a==null){a={}}a.skin=this.conf.skin;a.parent=this.dataNodes.ribbonObj.firstChild;this.dataNodes.ribbon=new dhtmlXRibbon(a);this.dataNodes.ribbonEv=this.attachEvent("_onSetSizes",function(){if(this.dataNodes.ribbonObj.style.display=="none"){return}this.dataNodes.ribbonObj.style.left=this.conf.ofs.l+"px";this.dataNodes.ribbonObj.style.marginTop=(this.dataNodes.haObj!=null||this.dataNodes.menuObj!=null?0:this.conf.ofs.t)+"px";this.dataNodes.ribbonObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px";this.dataNodes.ribbon.setSizes()});this.conf.ofs_nodes.t.ribbonObj=true;var c=this;this.dataNodes.ribbon.attachEvent("_onHeightChanged",function(){c.setSizes()});this.setSizes();a.parnt=null;a=null;return this.dataNodes.ribbon};dhtmlXCellTop.prototype.detachRibbon=function(){if(this.dataNodes.ribbon==null){return}this.dataNodes.ribbon.unload();this.dataNodes.ribbon=null;this.dataNodes.ribbonObj.parentNode.removeChild(this.dataNodes.ribbonObj);this.dataNodes.ribbonObj=null;this.detachEvent(this.dataNodes.ribbonEv);this.dataNodes.ribbonEv=null;this.conf.ofs_nodes.t.ribbonObj=false;delete this.dataNodes.ribbon;delete this.dataNodes.ribbonObj;delete this.dataNodes.ribbonEv;if(!this.conf.unloading){this.setSizes()}};dhtmlXCellTop.prototype.attachStatusBar=function(a){if(this.dataNodes.sbObj){return}if(typeof(a)=="undefined"){a={}}this.dataNodes.sbObj=document.createElement("DIV");this.dataNodes.sbObj.className="dhxcelltop_statusbar";if(this.cont.nextSibling!=null){this.base.insertBefore(this.dataNodes.sbObj,this.cont.nextSibling)}else{this.base.appendChild(this.dataNodes.sbObj)}this.dataNodes.sbObj.innerHTML="
"+(typeof(a.text)=="string"&&a.text.length>0?a.text:" ")+"
";if(typeof(a.height)=="number"){this.dataNodes.sbObj.firstChild.style.height=this.dataNodes.sbObj.firstChild.style.lineHeight=a.height+"px"}this.dataNodes.sbObj.setText=function(c){this.childNodes[0].innerHTML=c};this.dataNodes.sbObj.getText=function(){return this.childNodes[0].innerHTML};this.dataNodes.sbObj.onselectstart=function(c){return false};this.dataNodes.sbEv=this.attachEvent("_onSetSizes",function(){if(this.dataNodes.sbObj.style.display=="none"){return}this.dataNodes.sbObj.style.left=this.conf.ofs.l+"px";this.dataNodes.sbObj.style.bottom=(this.dataNodes.faObj!=null?this.dataNodes.faObj.offsetHeight:0)+this.conf.ofs.t+"px";this.dataNodes.sbObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px"});this.conf.ofs_nodes.b.sbObj=true;this.setSizes();return this.dataNodes.sbObj};dhtmlXCellTop.prototype.detachStatusBar=function(){if(!this.dataNodes.sbObj){return}this.dataNodes.sbObj.setText=this.dataNodes.sbObj.getText=this.dataNodes.sbObj.onselectstart=null;this.dataNodes.sbObj.parentNode.removeChild(this.dataNodes.sbObj);this.dataNodes.sbObj=null;this.detachEvent(this.dataNodes.sbEv);this.dataNodes.sbEv=null;this.conf.ofs_nodes.b.sbObj=false;delete this.dataNodes.sb;delete this.dataNodes.sbObj;delete this.dataNodes.sbEv;if(!this.conf.unloading){this.setSizes()}};dhtmlXCellTop.prototype.showMenu=function(){this._mtbShowHide("menuObj","")};dhtmlXCellTop.prototype.hideMenu=function(){this._mtbShowHide("menuObj","none")};dhtmlXCellTop.prototype.showToolbar=function(){this._mtbShowHide("toolbarObj","")};dhtmlXCellTop.prototype.hideToolbar=function(){this._mtbShowHide("toolbarObj","none")};dhtmlXCellTop.prototype.showRibbon=function(){this._mtbShowHide("ribbonObj","")};dhtmlXCellTop.prototype.hideRibbon=function(){this._mtbShowHide("ribbonObj","none")};dhtmlXCellTop.prototype.showStatusBar=function(){this._mtbShowHide("sbObj","")};dhtmlXCellTop.prototype.hideStatusBar=function(){this._mtbShowHide("sbObj","none")};dhtmlXCellTop.prototype._mtbShowHide=function(c,a){if(this.dataNodes[c]==null){return}this.dataNodes[c].style.display=a;this.setSizes()};dhtmlXCellTop.prototype._mtbUnload=function(c,a){this.detachMenu();this.detachToolbar();this.detachStatusBar();this.detachRibbon()};dhtmlXCellTop.prototype.getAttachedMenu=function(){return this.dataNodes.menu};dhtmlXCellTop.prototype.getAttachedToolbar=function(){return this.dataNodes.toolbar};dhtmlXCellTop.prototype.getAttachedRibbon=function(){return this.dataNodes.ribbon};dhtmlXCellTop.prototype.getAttachedStatusBar=function(){return this.dataNodes.sbObj};dhtmlXCellTop.prototype.progressOn=function(){if(this.conf.progress){return}this.conf.progress=true;var c=document.createElement("DIV");c.className="dhxcelltop_progress";this.base.appendChild(c);var a=document.createElement("DIV");a.className="dhxcelltop_progress_img";this.base.appendChild(a);c=a=null};dhtmlXCellTop.prototype.progressOff=function(){if(!this.conf.progress){return}var g={dhxcelltop_progress:true,dhxcelltop_progress_img:true};for(var e=0;e0){this.dataNodes.haObj.lastChild.style.visibility="hidden";document.body.appendChild(this.dataNodes.haObj.lastChild)}this.dataNodes.haObj.parentNode.removeChild(this.dataNodes.haObj);this.dataNodes.haObj=null;this.detachEvent(this.dataNodes.haEv);this.dataNodes.haEv=null;this.conf.ofs_nodes.t.haObj=false;delete this.dataNodes.haEv;delete this.dataNodes.haObj;if(!this.conf.unloading){this.setSizes()}};dhtmlXCellTop.prototype.attachFooter=function(e,a){if(this.dataNodes.faObj!=null){return}if(typeof(e)!="object"){e=document.getElementById(e)}this.dataNodes.faObj=document.createElement("DIV");this.dataNodes.faObj.className="dhxcelltop_ftr";this.dataNodes.faObj.style.height=(a||e.offsetHeight)+"px";var c=(this.dataNodes.sbObj||this.cont);if(this.base.lastChild==c){this.base.appendChild(this.dataNodes.faObj)}else{this.base.insertBefore(this.dataNodes.faObj,c.nextSibling)}this.dataNodes.faEv=this.attachEvent("_onSetSizes",function(){this.dataNodes.faObj.style.left=this.conf.ofs.l+"px";this.dataNodes.faObj.style.bottom=this.conf.ofs.b+"px";this.dataNodes.faObj.style.width=this.base.offsetWidth-this.conf.ofs.l-this.conf.ofs.r+"px"});this.dataNodes.faObj.appendChild(e);e.style.visibility="visible";c=e=null;this.conf.ofs_nodes.b.faObj=true;this.setSizes()};dhtmlXCellTop.prototype.detachFooter=function(){if(!this.dataNodes.faObj){return}while(this.dataNodes.faObj.childNodes.length>0){this.dataNodes.faObj.lastChild.style.visibility="hidden";document.body.appendChild(this.dataNodes.faObj.lastChild)}this.dataNodes.faObj.parentNode.removeChild(this.dataNodes.faObj);this.dataNodes.faObj=null;this.detachEvent(this.dataNodes.faEv);this.dataNodes.faEv=null;this.conf.ofs_nodes.b.faObj=false;delete this.dataNodes.faEv;delete this.dataNodes.faObj;if(!this.conf.unloading){this.setSizes()}};function dhtmlXCalendarObject(j,r){this.i={};var e=null;if(typeof(j)=="string"){var g=document.getElementById(j)}else{var g=j}if(g&&typeof(g)=="object"&&g.tagName&&String(g.tagName).toLowerCase()!="input"){e=g}g=null;if(typeof(j)!="object"||!j.length){j=[j]}for(var c=0;c
";l.appendChild(o);var h=this;o.onclick=function(v){v=v||event;if(v.type=="touchstart"&&v.preventDefault!=null){v.preventDefault()}var s=(v.target||v.srcElement);if(s.className&&s.className.indexOf("dhtmlxcalendar_month_arrow")===0){h._hideSelector();var u=(s.parentNode.firstChild==s?-1:1);var a=new Date(h._activeMonth);h._drawMonth(new Date(h._activeMonth.getFullYear(),h._activeMonth.getMonth()+u,1,0,0,0,0));h._evOnArrowClick([a,new Date(h._activeMonth)]);return}if(s.className&&s.className=="dhtmlxcalendar_month_label_month"){v.cancelBubble=true;h._showSelector("month",Math.round(s.offsetLeft+s.offsetWidth/2),s.offsetTop+s.offsetHeight+2,"selector_month",true);return}if(s.className&&s.className=="dhtmlxcalendar_month_label_year"){v.cancelBubble=true;h._showSelector("year",Math.round(s.offsetLeft+s.offsetWidth/2),s.offsetTop+s.offsetHeight+2,"selector_year",true);return}h._hideSelector()};if(this.conf.touch==true){o.ontouchstart=o.onclick}this.contDays=document.createElement("DIV");this.contDays.className="dhtmlxcalendar_days_cont";this.base.firstChild.appendChild(this.contDays);this.setWeekStartDay=function(a){if(a==0){a=7}this._wStart=Math.min(Math.max((isNaN(a)?1:a),1),7);this._drawDaysOfWeek()};this._drawDaysOfWeek=function(){if(this.contDays.childNodes.length==0){var v=document.createElement("UL");v.className="dhtmlxcalendar_line";this.contDays.appendChild(v)}else{var v=this.contDays.firstChild}var s=this._wStart;var u=this.langData[this.lang].daysSNames;u.push(String(this.langData[this.lang].daysSNames[0]).valueOf());for(var x=0;x<8;x++){if(v.childNodes[x]==null){var a=document.createElement("LI");v.appendChild(a)}else{var a=v.childNodes[x]}if(x==0){a.className="dhtmlxcalendar_cell_wn";a.innerHTML="
"+(this.langData[this.lang].weekname||"w")+"
"}else{a.className="dhtmlxcalendar_cell"+(s>=6?" dhtmlxcalendar_day_weekday_cell":"")+(x==1?"_first":"");a.innerHTML=u[s];if(++s>7){s=1}}}if(this._activeMonth!=null){this._drawMonth(this._activeMonth)}};this._wStart=this.langData[this.lang].weekstart;this.setWeekStartDay(this._wStart);this.contDates=document.createElement("DIV");this.contDates.className="dhtmlxcalendar_dates_cont";this.base.firstChild.appendChild(this.contDates);this.contDates.onclick=function(x){x=x||event;if(x.type=="touchstart"&&x.preventDefault!=null){x.preventDefault()}var s=(x.target||x.srcElement);if(s.parentNode!=null&&s.parentNode._date!=null){s=s.parentNode}if(s._date!=null&&!s._css_dis){var v=h._activeDate.getHours();var u=h._activeDate.getMinutes();var w=s._date;if(h.checkEvent("onBeforeChange")){if(!h.callEvent("onBeforeChange",[new Date(s._date.getFullYear(),s._date.getMonth(),s._date.getDate(),v,u)])){return}}if(h._activeDateCell!=null){h._activeDateCell._css_date=false;h._updateCellStyle(h._activeDateCell._q,h._activeDateCell._w)}var a=(h._activeDate.getFullYear()+"_"+h._activeDate.getMonth()!=w.getFullYear()+"_"+w.getMonth());h._nullDate=false;h._activeDate=new Date(w.getFullYear(),w.getMonth(),w.getDate(),v,u);h._activeDateCell=s;h._activeDateCell._css_date=true;h._activeDateCell._css_hover=false;h._updateCellStyle(h._activeDateCell._q,h._activeDateCell._w);if(a){h._drawMonth(h._activeDate)}if(h._activeInp&&h.i[h._activeInp]&&h.i[h._activeInp].input!=null){h.i[h._activeInp].input.value=h._dateToStr(new Date(h._activeDate.getTime()))}if(!h._hasParent){if(x.type=="touchstart"){window.setTimeout(function(){h._hide()},400)}else{h._hide()}}h._evOnClick([new Date(h._activeDate.getTime())])}};if(this.conf.touch==true){this.contDates.ontouchstart=this.contDates.onclick}this.contDates.onmouseover=function(s){s=s||event;var a=(s.target||s.srcElement);if(a.parentNode!=null&&a.parentNode._date!=null){a=a.parentNode}if(a._date!=null){if(h._lastHover==a||a._css_hover){return}a._css_hover=true;h._updateCellStyle(a._q,a._w);h._lastHover=a;h._evOnMouseOver([new Date(a._date.getFullYear(),a._date.getMonth(),a._date.getDate(),0,0,0,0),s]);a=null}};this.contDates.onmouseout=function(a){h._clearDayHover(a||event)};this._lastHover=null;this._clearDayHover=function(a){if(!this._lastHover){return}this._lastHover._css_hover=false;this._updateCellStyle(this._lastHover._q,this._lastHover._w);if(a!=null){h._evOnMouseOut([new Date(this._lastHover._date.getFullYear(),this._lastHover._date.getMonth(),this._lastHover._date.getDate(),0,0,0,0),a])}this._lastHover=null};for(var c=0;c<6;c++){var l=document.createElement("UL");l.className="dhtmlxcalendar_line";this.contDates.appendChild(l);for(var n=0;n<=7;n++){var o=document.createElement("LI");if(n==0){o.className="dhtmlxcalendar_cell_wn"}else{o.className="dhtmlxcalendar_cell"}l.appendChild(o)}}this.contTime=document.createElement("DIV");this.contTime.className="dhtmlxcalendar_time_cont";this.base.firstChild.appendChild(this.contTime);this.showTime=function(){this.contTime.style.display="";this._ifrSize()};this.hideTime=function(){this.contTime.style.display="none";this._ifrSize()};var l=document.createElement("UL");l.className="dhtmlxcalendar_line";this.contTime.appendChild(l);var o=document.createElement("LI");o.className="dhtmlxcalendar_cell dhtmlxcalendar_time_hdr";o.innerHTML="
: ";l.appendChild(o);o.onclick=function(u){u=u||event;if(u.type=="touchstart"&&u.preventDefault!=null){u.preventDefault()}var a=(u.target||u.srcElement);if(a.tagName!=null&&a.tagName.toLowerCase()=="span"&&a._par==true&&a.parentNode!=null){a=a.parentNode}if(a.className&&a.className=="dhtmlxcalendar_label_hours"){u.cancelBubble=true;var s=h.contMonth.offsetHeight+h.contDays.offsetHeight+h.contDates.offsetHeight+a.offsetTop;h._showSelector("hours",Math.round(a.offsetLeft+a.offsetWidth/2),s-2,"selector_hours",true);return}if(a.className&&a.className=="dhtmlxcalendar_label_minutes"){u.cancelBubble=true;if(h._minutesInterval==1){var v=h.getFormatedDate("%i");a.innerHTML=""+v.charAt(0)+""+v.charAt(1);a.firstChild._par=true;h._selectorMode=1}var s=h.contMonth.offsetHeight+h.contDays.offsetHeight+h.contDates.offsetHeight+a.offsetTop;h._showSelector("minutes",Math.round(a.offsetLeft+a.offsetWidth/2),s-2,"selector_minutes",true);return}h._hideSelector()};if(this.conf.touch==true){o.ontouchstart=o.onclick}this._activeMonth=null;this._activeDate=new Date();this._activeDateCell=null;this.setDate=function(s){window.dhx4.temp_calendar={tz:null};this._nullDate=(typeof(s)=="undefined"||s===""||!s);if(!(s instanceof Date)){s=this._strToDate(String(s||""));if(s=="Invalid Date"){s=new Date()}else{this.conf.tz=window.dhx4.temp_calendar.tz}window.dhx4.temp_calendar=null}if(this.conf.tz==null){this.conf.tz=window.dhx4.date2str(s,"%P")}var a=s.getTime();if(this._isOutOfRange(a)){return}this._activeDate=new Date(a);this._drawMonth(this._nullDate?new Date():this._activeDate);this._updateVisibleHours();this._updateVisibleMinutes()};this.getDate=function(u){if(this._nullDate){return null}var a=new Date(this._activeDate.getTime());if(u){window.dhx4.temp_calendar={tz:this.conf.tz};var s=this._dateToStr(a);window.dhx4.temp_calendar=null;return s}return a};this._drawMonth=function(E){if(!(E instanceof Date)){return}if(isNaN(E.getFullYear())){E=new Date(this._activeMonth.getFullYear(),this._activeMonth.getMonth(),1,0,0,0,0)}this._activeMonth=new Date(E.getFullYear(),E.getMonth(),1,0,0,0,0);this._activeDateCell=null;var C=new Date(this._activeMonth.getTime());var u=C.getDay();var I=u-this._wStart;if(I<0){I=I+7}C.setDate(C.getDate()-I);var L=E.getMonth();var M=new Date(this._activeDate.getFullYear(),this._activeDate.getMonth(),this._activeDate.getDate(),0,0,0,0).getTime();var y=0;for(var s=0;s<6;s++){var D=this._wStart;for(var K=0;K<=7;K++){if(K==0){var J=this.getWeekNumber(new Date(C.getFullYear(),C.getMonth(),C.getDate()+y,0,0,0,0));if(J>=52&&this.conf.ws_first==true&&this._activeMonth.getMonth()==0){var x=this.getWeekNumber(new Date(C.getFullYear(),C.getMonth(),C.getDate()+y+7,0,0,0,0));if(x1){J=1}}this.contDates.childNodes[s].childNodes[K].innerHTML="
"+J+"
"}else{var a=new Date(C.getFullYear(),C.getMonth(),C.getDate()+y,0,0,0,0);if(a.getHours()!=0){var A=(a.getHours()>12?24-a.getHours():a.getHours());a.setTime(a.getTime()+60*60*1000*A)}var H=a.getDay();var v=a.getTime();var F="dhtmlxcalendar_label";if(this._tipData[v]!=null){if(this._tipData[v].usePopup&&typeof(window.dhtmlXPopup)=="function"){this.contDates.childNodes[s].childNodes[K].removeAttribute("title");this._initTooltipPopup()}else{this.contDates.childNodes[s].childNodes[K].setAttribute("title",this._tipData[v].text)}if(this._tipData[v].showIcon){F+=" dhtmlxcalendar_label_title"}}else{this.contDates.childNodes[s].childNodes[K].removeAttribute("title")}this.contDates.childNodes[s].childNodes[K].innerHTML="
"+a.getDate()+"
";this.contDates.childNodes[s].childNodes[K]._date=new Date(v);this.contDates.childNodes[s].childNodes[K]._q=s;this.contDates.childNodes[s].childNodes[K]._w=K;this.contDates.childNodes[s].childNodes[K]._css_month=(a.getMonth()==L);this.contDates.childNodes[s].childNodes[K]._css_date=(!this._nullDate&&v==M);this.contDates.childNodes[s].childNodes[K]._css_weekend=(D>=6);this.contDates.childNodes[s].childNodes[K]._css_dis=this._isOutOfRange(v);this.contDates.childNodes[s].childNodes[K]._css_holiday=(this._holidays[v]==true);this._updateCellStyle(s,K);if(v==M){this._activeDateCell=this.contDates.childNodes[s].childNodes[K]}if(++D>7){D=1}y++}}}this.contMonth.firstChild.firstChild.childNodes[1].innerHTML=this._buildMonthHdr(E)};this._updateCellStyle=function(x,a){var v=this.contDates.childNodes[x].childNodes[a];var u="dhtmlxcalendar_cell dhtmlxcalendar_cell";u+=(v._css_month?"_month":"");u+=(v._css_date?"_date":"");u+=(v._css_weekend?"_weekend":"");u+=(v._css_holiday?"_holiday":"");u+=(v._css_dis?"_dis":"");u+=(v._css_hover&&!v._css_dis?"_hover":"");v.className=u;v=null};this._minutesInterval=5;this._initSelector=function(C,v){if(!this._selCover){this._selCover=document.createElement("DIV");this._selCover.className="dhtmlxcalendar_selector_cover";this.base.firstChild.appendChild(this._selCover)}if(!this._sel){this._sel=document.createElement("DIV");this._sel.className="dhtmlxcalendar_selector_obj";this.base.firstChild.appendChild(this._sel);this._sel.appendChild(document.createElement("TABLE"));this._sel.firstChild.className="dhtmlxcalendar_selector_table";this._sel.firstChild.cellSpacing=0;this._sel.firstChild.cellPadding=0;this._sel.firstChild.border=0;this._sel.firstChild.appendChild(document.createElement("TBODY"));this._sel.firstChild.firstChild.appendChild(document.createElement("TR"));this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));this._sel.firstChild.firstChild.firstChild.childNodes[0].className="dhtmlxcalendar_selector_cell_left";this._sel.firstChild.firstChild.firstChild.childNodes[1].className="dhtmlxcalendar_selector_cell_middle";this._sel.firstChild.firstChild.firstChild.childNodes[2].className="dhtmlxcalendar_selector_cell_right";this._sel.firstChild.firstChild.firstChild.childNodes[0].innerHTML=" ";this._sel.firstChild.firstChild.firstChild.childNodes[2].innerHTML=" ";this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseover=function(){this.className="dhtmlxcalendar_selector_cell_left dhtmlxcalendar_selector_cell_left_hover"};this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseout=function(){this.className="dhtmlxcalendar_selector_cell_left"};this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseover=function(){this.className="dhtmlxcalendar_selector_cell_right dhtmlxcalendar_selector_cell_right_hover"};this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseout=function(){this.className="dhtmlxcalendar_selector_cell_right"};this._sel.onmouseover=function(F){F=F||event;var w=(F.target||F.srcElement);if(w._cell===true){if(h._selHover!=w){h._clearSelHover()}if(String(w.className).match(/^\s{0,}dhtmlxcalendar_selector_cell\s{0,}$/gi)!=null){w.className+=" dhtmlxcalendar_selector_cell_hover";h._selHover=w}}};this._sel.onmouseout=function(){h._clearSelHover()};this._sel.firstChild.firstChild.firstChild.childNodes[0].onclick=function(w){w=w||event;if(w.type=="touchstart"&&w.preventDefault!=null){w.preventDefault()}w.cancelBubble=true;h._scrollYears(-1)};this._sel.firstChild.firstChild.firstChild.childNodes[2].onclick=function(w){w=w||event;if(w.type=="touchstart"&&w.preventDefault!=null){w.preventDefault()}w.cancelBubble=true;h._scrollYears(1)};if(this.conf.touch==true){this._sel.firstChild.firstChild.firstChild.childNodes[0].ontouchstart=this._sel.firstChild.firstChild.firstChild.childNodes[0].onclick;this._sel.firstChild.firstChild.firstChild.childNodes[2].ontouchstart=this._sel.firstChild.firstChild.firstChild.childNodes[2].onclick}this._sel._ta={};this._selHover=null;this._sel.appendChild(document.createElement("DIV"));this._sel.lastChild.className="dhtmlxcalendar_selector_obj_arrow"}if(this._sel._ta[C]==true){return}if(C=="month"){this._msCells={};this.msCont=document.createElement("DIV");this.msCont.className="dhtmlxcalendar_area_"+v;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.msCont);var s=0;for(var a=0;a<4;a++){var A=document.createElement("UL");A.className="dhtmlxcalendar_selector_line";this.msCont.appendChild(A);for(var D=0;D<3;D++){var E=document.createElement("LI");E.innerHTML=this.langData[this.lang].monthesSNames[s];E.className="dhtmlxcalendar_selector_cell";A.appendChild(E);E._month=s;E._cell=true;this._msCells[s++]=E}}this.msCont.onclick=function(F){F=F||event;if(F.type=="touchstart"&&F.preventDefault!=null){F.preventDefault()}F.cancelBubble=true;var w=(F.target||F.srcElement);if(w._month!=null){h._hideSelector();h._updateActiveMonth();h._drawMonth(new Date(h._activeMonth.getFullYear(),w._month,1,0,0,0,0));h._doOnSelectorChange()}};if(this.conf.touch==true){this.msCont.ontouchstart=this.msCont.onclick}}if(C=="year"){this._ysCells={};this.ysCont=document.createElement("DIV");this.ysCont.className="dhtmlxcalendar_area_"+v;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.ysCont);for(var a=0;a<4;a++){var A=document.createElement("UL");A.className="dhtmlxcalendar_selector_line";this.ysCont.appendChild(A);for(var D=0;D<3;D++){var E=document.createElement("LI");E.className="dhtmlxcalendar_selector_cell";E._cell=true;A.appendChild(E)}}this.ysCont.onclick=function(F){F=F||event;if(F.type=="touchstart"&&F.preventDefault!=null){F.preventDefault()}F.cancelBubble=true;var w=(F.target||F.srcElement);if(w._year!=null){h._hideSelector();h._drawMonth(new Date(w._year,h._activeMonth.getMonth(),1,0,0,0,0));h._doOnSelectorChange()}};if(this.conf.touch==true){this.ysCont.ontouchstart=this.ysCont.onclick}}if(C=="hours"){this._hsCells={};this.hsCont=document.createElement("DIV");this.hsCont.className="dhtmlxcalendar_area_"+v;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.hsCont);var s=0;for(var a=0;a<4;a++){var A=document.createElement("UL");A.className="dhtmlxcalendar_selector_line";this.hsCont.appendChild(A);for(var D=0;D<6;D++){var E=document.createElement("LI");E.innerHTML=this._fixLength(s,2);E.className="dhtmlxcalendar_selector_cell";A.appendChild(E);E._hours=s;E._cell=true;this._hsCells[s++]=E}}this.hsCont.onclick=function(F){F=F||event;if(F.type=="touchstart"&&F.preventDefault!=null){F.preventDefault()}F.cancelBubble=true;var w=(F.target||F.srcElement);if(w._hours!=null){h._hideSelector();h._activeDate.setHours(w._hours);h._updateActiveHours();h._updateVisibleHours();h._doOnSelectorChange();h.callEvent("onTimeChange",[new Date(h._activeDate.getTime())])}};if(this.conf.touch==true){this.hsCont.ontouchstart=this.hsCont.onclick}}if(C=="minutes"){var y=4;var u=3;var x=2;if(this._minutesInterval==1){if(this._selectorMode==1){y=2;u=3;x=1}else{y=2;u=5;x=1;v+="5"}}if(this._minutesInterval==10){y=2}if(this._minutesInterval==15){y=1;u=4;v+="4"}this._rsCells={};this.rsCont=document.createElement("DIV");this.rsCont.className="dhtmlxcalendar_area_"+v;this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.rsCont);var s=0;for(var a=0;a1?this._fixLength(s,x):s);E.className="dhtmlxcalendar_selector_cell";A.appendChild(E);E._minutes=s;E._cell=true;this._rsCells[s]=E;s+=this._minutesInterval}}this.rsCont.onclick=function(H){H=H||event;if(H.type=="touchstart"&&H.preventDefault!=null){H.preventDefault()}H.cancelBubble=true;var F=(H.target||H.srcElement);if(F._minutes!=null){if(h._minutesInterval==1){var w=h.getFormatedDate("%i");if(h._selectorMode==1){w=F._minutes.toString()+w.charAt(1)}else{w=w.charAt(0)+F._minutes.toString()}h._activeDate.setMinutes(Number(w));h.callEvent("onTimeChange",[new Date(h._activeDate.getTime())]);h._hideSelector();if(h._selectorMode==1){h._updateVisibleMinutes(true);h._selectorMode=2;h._showSelector("minutes",h._sel._x,h._sel._y,"selector_minutes",true);h._updateActiveMinutes();return}else{h._selectorMode=1}}else{h._hideSelector();h._activeDate.setMinutes(F._minutes);h._updateActiveMinutes();h.callEvent("onTimeChange",[new Date(h._activeDate.getTime())])}h._updateVisibleMinutes();h._doOnSelectorChange()}};if(this.conf.touch==true){this.rsCont.ontouchstart=this.rsCont.onclick}}this._sel._ta[C]=true};this._showSelector=function(w,s,A,v,a){if(a===true&&this._sel!=null&&this._isSelectorVisible()&&w==this._sel._t){this._hideSelector();return}if(this.conf.skin=="dhx_terrace"){s+=12}if(!this._sel||!this._sel._ta[w]){this._initSelector(w,v)}if(w!=this._sel._t&&this._sel._t=="minutes"&&this._minutesInterval==1){this.contTime.firstChild.firstChild.childNodes[3].innerHTML=this.getFormatedDate("%i")}this._sel._x=s;this._sel._y=A;this._sel.style.visibility="hidden";this._sel.style.display="";this._selCover.style.width=this.base.offsetWidth-2+"px";this._selCover.style.top=this.contMonth.offsetHeight+"px";this._selCover.style.height=this.contDates.offsetHeight+this.contDays.offsetHeight-1+"px";this._selCover.style.display="";this._sel._t=w;this._sel.className="dhtmlxcalendar_selector_obj dhtmlxcalendar_"+v;this._sel.childNodes[0].firstChild.firstChild.childNodes[0].style.display=this._sel.childNodes[0].firstChild.firstChild.childNodes[2].style.display=(w=="year"?"":"none");var u=Math.max(0,s-Math.round(this._sel.offsetWidth/2));if(u+this._sel.offsetWidth>this._sel.parentNode.offsetWidth){u=this._sel.parentNode.offsetWidth-this._sel.offsetWidth}this._sel.style.left=u+"px";if(w=="hours"||w=="minutes"){this._sel.style.top=A-this._sel.offsetHeight+"px"}else{this._sel.style.top=A+"px"}this._sel.childNodes[1].style.width=this._sel.childNodes[0].offsetWidth+"px";this._sel.style.visibility="visible";this._doOnSelectorShow(w)};this._doOnSelectorShow=function(a){if(a=="month"){this._updateActiveMonth()}if(a=="year"){this._updateYearsList(this._activeMonth)}if(a=="hours"){this._updateActiveHours()}if(a=="minutes"){this._updateActiveMinutes()}};this._hideSelector=function(a){if(!this._sel){return}this._sel.style.display="none";this._sel.style.visible="hidden";this._selCover.style.display="none";if(this._sel._t=="minutes"&&this._minutesInterval==1){this.contTime.firstChild.firstChild.childNodes[3].innerHTML=this.getFormatedDate("%i");this._unloadSelector("minutes")}};this._isSelectorVisible=function(){if(!this._sel){return false}return(this._sel.style.display!="none")};this._doOnSelectorChange=function(a){this.callEvent("onChange",[new Date(this._activeMonth.getFullYear(),this._activeMonth.getMonth(),this._activeDate.getDate(),this._activeDate.getHours(),this._activeDate.getMinutes(),this._activeDate.getSeconds()),a===true])};this._clearSelHover=function(){if(!this._selHover){return}this._selHover.className=String(this._selHover.className.replace(/dhtmlxcalendar_selector_cell_hover/gi,""));this._selHover=null};this._unloadSelector=function(u){if(!this._sel){return}if(!this._sel._ta[u]){return}if(u=="month"){this.msCont.onclick=this.msCont.ontouchstart=null;this._msActive=null;for(var s in this._msCells){this._msCells[s]._cell=null;this._msCells[s]._month=null;this._msCells[s].parentNode.removeChild(this._msCells[s]);this._msCells[s]=null}this._msCells=null;while(this.msCont.childNodes.length>0){this.msCont.removeChild(this.msCont.lastChild)}this.msCont.parentNode.removeChild(this.msCont);this.msCont=null}if(u=="year"){this.ysCont.onclick=this.ysCont.ontouchstart=null;for(var s in this._ysCells){this._ysCells[s]._cell=null;this._ysCells[s]._year=null;this._ysCells[s].parentNode.removeChild(this._ysCells[s]);this._ysCells[s]=null}this._ysCells=null;while(this.ysCont.childNodes.length>0){this.ysCont.removeChild(this.ysCont.lastChild)}this.ysCont.parentNode.removeChild(this.ysCont);this.ysCont=null}if(u=="hours"){this.hsCont.onclick=this.hsCont.ontouchstart=null;this._hsActive=null;for(var s in this._hsCells){this._hsCells[s]._cell=null;this._hsCells[s]._hours=null;this._hsCells[s].parentNode.removeChild(this._hsCells[s]);this._hsCells[s]=null}this._hsCells=null;while(this.hsCont.childNodes.length>0){this.hsCont.removeChild(this.hsCont.lastChild)}this.hsCont.parentNode.removeChild(this.hsCont);this.hsCont=null}if(u=="minutes"){this.rsCont.onclick=this.rsCont.ontouchstart=null;this._rsActive=null;for(var s in this._rsCells){this._rsCells[s]._cell=null;this._rsCells[s]._minutes=null;this._rsCells[s].parentNode.removeChild(this._rsCells[s]);this._rsCells[s]=null}this._rsCells=null;while(this.rsCont.childNodes.length>0){this.rsCont.removeChild(this.rsCont.lastChild)}this.rsCont.parentNode.removeChild(this.rsCont);this.rsCont=null}this._sel._ta[u]=null};this.setMinutesInterval=function(a){if(!(a==1||a==5||a==10||a==15)){return}this._minutesInterval=a;this._unloadSelector("minutes")};this._updateActiveMonth=function(){if(typeof(this._msActive)!="undefined"&&typeof(this._msCells[this._msActive])!="undefined"){this._msCells[this._msActive].className="dhtmlxcalendar_selector_cell"}this._msActive=this._activeMonth.getMonth();this._msCells[this._msActive].className="dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"};this._updateActiveYear=function(){var a=this._activeMonth.getFullYear();if(this._ysCells[a]){this._ysCells[a].className="dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"}};this._updateYearsList=function(y){for(var u in this._ysCells){this._ysCells[u]=null;delete this._ysCells[u]}var v=12*Math.floor(y.getFullYear()/12);for(var x=0;x<4;x++){for(var s=0;s<3;s++){this.ysCont.childNodes[x].childNodes[s].innerHTML=v;this.ysCont.childNodes[x].childNodes[s]._year=v;this.ysCont.childNodes[x].childNodes[s].className="dhtmlxcalendar_selector_cell";this._ysCells[v++]=this.ysCont.childNodes[x].childNodes[s]}}this._updateActiveYear()};this._scrollYears=function(a){var u=(a<0?this.ysCont.firstChild.firstChild._year:this.ysCont.lastChild.lastChild._year)+a;var s=new Date(u,this._activeMonth.getMonth(),1,0,0,0,0);this._updateYearsList(s)};this._updateActiveHours=function(){if(typeof(this._hsActive)!="undefined"&&typeof(this._hsCells[this._hsActive])!="undefined"){this._hsCells[this._hsActive].className="dhtmlxcalendar_selector_cell"}this._hsActive=this._activeDate.getHours();this._hsCells[this._hsActive].className="dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"};this._updateVisibleHours=function(){this.contTime.firstChild.firstChild.childNodes[1].innerHTML=this._fixLength(this._activeDate.getHours(),2)};this._updateActiveMinutes=function(){if(this._rsActive!=null&&typeof(this._rsActive)!="undefined"&&typeof(this._rsCells[this._rsActive])!="undefined"){this._rsCells[this._rsActive].className="dhtmlxcalendar_selector_cell"}if(this._minutesInterval==1){this._rsActive=(this.getFormatedDate("%i").toString()).charAt(this._selectorMode==1?0:1)}else{this._rsActive=this._activeDate.getMinutes()}if(typeof(this._rsCells[this._rsActive])!="undefined"){this._rsCells[this._rsActive].className="dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"}};this._updateVisibleMinutes=function(s){var a=this._fixLength(this._activeDate.getMinutes(),2).toString();if(s==true){a=a.charAt(0)+""+a.charAt(1)+""}this.contTime.firstChild.firstChild.childNodes[3].innerHTML=a;if(s==true){this.contTime.firstChild.firstChild.childNodes[3].lastChild._par=true}};this._fixLength=function(a,s){while(String(a).length0){var x=this._strToDate(this.i[s].input.value,this._dateFormat||this.langData[this.lang].dateformat||"%Y-%m-%d");if(x instanceof Date){v[s]=x}}}}this._dateFormat=w;var u=String(this._dateFormat).replace(/%[a-zA-Z]+/g,function(a){var y=a.replace(/%/,"");switch(y){case"n":case"h":case"j":case"g":case"G":return"\\d{1,2}";case"m":case"d":case"H":case"i":case"s":case"y":return"\\d{2}";case"Y":return"\\d{4}";case"M":return"("+h.langData[h.lang].monthesSNames.join("|").toLowerCase()+"){1,}";case"F":return"("+h.langData[h.lang].monthesFNames.join("|").toLowerCase()+"){1,}";case"D":return"[a-z]{2}";case"a":case"A":return"AM|PM";case"u":return"\\d{1,6}";case"P":return"[\\+\\-]\\d{1,2}\\:\\d{1,2}"}return a});this._dateFormatRE=new RegExp(u,"i");for(var s in v){this.i[s].input.value=this._dateToStr(v[s])}v=null};this.setDateFormat(this.langData[this.lang].dateformat||"%Y-%m-%d");this._updateDateStr=function(s){if(!this._dateFormatRE||!s.match(this._dateFormatRE)){return}if(s==this.getFormatedDate()){return}var a=this._strToDate(s);if(!(a instanceof Date)){return}if(this.checkEvent("onBeforeChange")){if(!this.callEvent("onBeforeChange",[new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds())])){if(this.i!=null&&this._activeInp!=null&&this.i[this._activeInp]!=null&&this.i[this._activeInp].input!=null){this.i[this._activeInp].input.value=this.getFormatedDate()}return}}this._nullDate=false;this._activeDate=a;this._drawMonth(this._nullDate?new Date():this._activeDate);this._updateVisibleMinutes();this._updateVisibleHours();if(this._sel&&this._isSelectorVisible()){this._doOnSelectorShow(this._sel._t)}this._doOnSelectorChange(true)};this.showMonth=function(a){if(typeof(a)=="string"){a=this._strToDate(a)}if(!(a instanceof Date)){return}this._drawMonth(a)};this.setFormatedDate=function(w,x,s,v){var u=this._strToDate(x,w);if(v){return u}this.setDate(u)};this.getFormatedDate=function(s,a){if(!(a&&a instanceof Date)){if(this._nullDate){return""}a=new Date(this._activeDate)}return this._dateToStr(a,s)};this.getWeekNumber=function(x){if(typeof(x)=="string"){x=this._strToDate(x)}if(!(x instanceof Date)){return"Invalid Date"}if(typeof(this._ftDay)=="undefined"){this._ftDay=4}var F=this._wStart;var w=F+7;var E=4;var u=new Date(x.getFullYear(),0,1,0,0,0,0);var v=u.getDay();if(v==0){v=7}if(E=F&&v<=E){}else{C=1}var A=v-F;var D=new Date(x.getFullYear(),0,1-A+C*7,0,0,0,0);var I=604800000;var s=new Date(x.getFullYear(),x.getMonth(),x.getDate()+1,0,0,0,0);var H=Math.ceil((s.getTime()-D.getTime())/I);if(H==0){var y=new Date(x.getFullYear(),x.getMonth(),x.getDate(),0,0,0,0);var a=y.getDay()-this._wStart;if(a<0){a=a+7}y.setDate(y.getDate()-a);H=this.getWeekNumber(y)}return H};this.showWeekNumbers=function(){this.base.firstChild.className="dhtmlxcalendar_wn"};this.hideWeekNumbers=function(){this.base.firstChild.className=""};this.show=function(u){if(!u&&this._hasParent){this._show();return}if(typeof(u)=="object"&&typeof(u._dhtmlxcalendar_uid)!="undefined"&&this.i[u._dhtmlxcalendar_uid]==u){this._show(u._dhtmlxcalendar_uid);return}if(typeof(u)=="undefined"){for(var s in this.i){if(!u){u=s}}}if(!u){return}this._show(u)};this.hide=function(){if(this._isVisible()){this._hide()}};this.isVisible=function(){return this._isVisible()};this._activeInp=null;this.pos="bottom";this.setPosition=function(a,s){this._px=null;this._py=null;if(a=="right"||a=="bottom"){this.pos=a}else{this.pos="int";if(typeof(a)!="undefined"&&!isNaN(a)){this.base.style.left=a+"px";this._px=a}if(typeof(s)!="undefined"&&!isNaN(s)){this.base.style.top=s+"px";this._py=s}this._ifrSize()}};this._show=function(A,s){if(s===true&&this._activeInp==A&&this._isVisible()){this._hide();return}this.base.style.visibility="hidden";this.base.style.display="";if(!A){if(this._px&&this._py){this.base.style.left=this._px+"px";this.base.style.top=this._py+"px"}else{this.base.style.left="0px";this.base.style.top="0px"}}else{if(this.base.className.indexOf("dhtmlxcalendar_in_input")==-1){this.base.className+=" dhtmlxcalendar_in_input"}var u=(this.i[A].input||this.i[A].button);var C=window.dhx4.screenDim();var y={top:window.dhx4.absTop(u),left:window.dhx4.absLeft(u)};if(this.pos=="right"){this.base.style.left=y.left+u.offsetWidth+"px";this.base.style.top=Math.min(y.top,C.bottom-this.base.offsetHeight)+"px"}else{if(this.pos=="bottom"){var w=y.top+u.offsetHeight+1;if(w+this.base.offsetHeight>C.bottom){var v=y.top-this.base.offsetHeight;if(v>=-20){w=v}}var a=y.left;if(a+this.base.offsetWidth>C.right){a=Math.max(0,y.left+u.offsetWidth-this.base.offsetWidth)}this.base.style.left=a+"px";this.base.style.top=w+"px"}else{this.base.style.left=(this._px||0)+"px";this.base.style.top=(this._py||0)+"px"}}this._activeInp=A;u=null}this._hideSelector();this.base.style.visibility="visible";this.base.style.zIndex=window.dhx4.zim.reserve(this.conf.zi);this._ifrSize();if(this._ifr){this._ifr.style.display=""}this.callEvent("onShow",[])};this._hide=function(){if(this._lastHover!=null){this._clearDayHover()}this._hideSelector();this.base.style.display="none";window.dhx4.zim.clear(this.conf.zi);if(this.base.className.indexOf("dhtmlxcalendar_in_input")>=0){this.base.className=this.base.className.replace(/\s{0,}dhtmlxcalendar_in_input/gi,"")}this._activeInp=null;if(this._ifr){this._ifr.style.display="none"}this.callEvent("onHide",[])};this._isVisible=function(){return(this.base.style.display!="none")};this._rangeActive=false;this._rangeFrom=null;this._rangeTo=null;this._rangeSet={};this.setInsensitiveDays=function(u){var a=this._extractDates(u);for(var s=0;sthis._rangeTo)){return true}if(this._rangeType=="out"&&(s>=this._rangeFrom&&s<=this._rangeTo)){return true}if(this._rangeType=="from"&&sthis._rangeTo){return true}}var a=new Date(s);if(this._rangeWeek){if(this._rangeWeekData[a.getDay()]===true){return true}}if(this._rangeMonth){if(this._rangeMonthData[a.getDate()]===true){return true}}if(this._rangeYear){if(this._rangeYearData[a.getMonth()+"_"+a.getDate()]===true){return true}}return false};this.clearSensitiveRange=function(){this._clearRange();this._drawMonth(this._activeMonth)};this.setSensitiveRange=function(v,u,a){var s=false;if(v!=null&&u!=null){if(!(v instanceof Date)){v=this._strToDate(v)}if(!(u instanceof Date)){u=this._strToDate(u)}if(v.getTime()>u.getTime()){return}this._rangeFrom=new Date(v.getFullYear(),v.getMonth(),v.getDate(),0,0,0,0).getTime();this._rangeTo=new Date(u.getFullYear(),u.getMonth(),u.getDate(),0,0,0,0).getTime();this._rangeActive=true;this._rangeType="in";s=true}if(!s&&v!=null&&u==null){if(!(v instanceof Date)){v=this._strToDate(v)}this._rangeFrom=new Date(v.getFullYear(),v.getMonth(),v.getDate(),0,0,0,0).getTime();this._rangeTo=null;if(a===true){this._rangeFrom++}this._rangeActive=true;this._rangeType="from";s=true}if(!s&&v==null&&u!=null){if(!(u instanceof Date)){u=this._strToDate(u)}this._rangeFrom=null;this._rangeTo=new Date(u.getFullYear(),u.getMonth(),u.getDate(),0,0,0,0).getTime();if(a===true){this._rangeTo--}this._rangeActive=true;this._rangeType="to";s=true}if(s){this._drawMonth(this._activeMonth)}};this.setInsensitiveRange=function(s,a){if(s!=null&&a!=null){if(!(s instanceof Date)){s=this._strToDate(s)}if(!(a instanceof Date)){a=this._strToDate(a)}if(s.getTime()>a.getTime()){return}this._rangeFrom=new Date(s.getFullYear(),s.getMonth(),s.getDate(),0,0,0,0).getTime();this._rangeTo=new Date(a.getFullYear(),a.getMonth(),a.getDate(),0,0,0,0).getTime();this._rangeActive=true;this._rangeType="out";this._drawMonth(this._activeMonth);return}if(s!=null&&a==null){this.setSensitiveRange(null,s,true);return}if(s==null&&a!=null){this.setSensitiveRange(a,null,true);return}};this.disableDays=function(x,w){if(x=="week"){if(typeof(w)!="object"&&typeof(w.length)=="undefined"){w=[w]}if(!this._rangeWeekData){this._rangeWeekData={}}for(var s in this._rangeWeekData){this._rangeWeekData[s]=false;delete this._rangeWeekData[s]}for(var v=0;v0){this.contMonth.firstChild.firstChild.removeChild(this.contMonth.firstChild.firstChild.lastChild)}this.contMonth.firstChild.removeChild(this.contMonth.firstChild.firstChild);this.contMonth.removeChild(this.contMonth.firstChild);this.contMonth.parentNode.removeChild(this.contMonth);this.contMonth=null;while(this.contDays.firstChild.childNodes.length>0){this.contDays.firstChild.removeChild(this.contDays.firstChild.lastChild)}this.contDays.removeChild(this.contDays.firstChild);this.contDays.parentNode.removeChild(this.contDays);this.contDays=null;this.contDates.onclick=null;this.contDates.ontouchstart=null;this.contDates.onmouseover=null;this.contDates.onmouseout=null;while(this.contDates.childNodes.length>0){while(this.contDates.lastChild.childNodes.length>0){this.contDates.lastChild.lastChild._css_date=null;this.contDates.lastChild.lastChild._css_month=null;this.contDates.lastChild.lastChild._css_weekend=null;this.contDates.lastChild.lastChild._css_hover=null;this.contDates.lastChild.lastChild._date=null;this.contDates.lastChild.lastChild._q=null;this.contDates.lastChild.lastChild._w=null;this.contDates.lastChild.removeChild(this.contDates.lastChild.lastChild)}this.contDates.removeChild(this.contDates.lastChild)}this.contDates.parentNode.removeChild(this.contDates);this.contDates=null;this.contTime.firstChild.firstChild.onclick=null;this.contTime.firstChild.firstChild.ontouchstart=null;while(this.contTime.firstChild.firstChild.childNodes.length>0){this.contTime.firstChild.firstChild.removeChild(this.contTime.firstChild.firstChild.lastChild)}this.contTime.firstChild.removeChild(this.contTime.firstChild.firstChild);this.contTime.removeChild(this.contTime.firstChild);this.contTime.parentNode.removeChild(this.contTime);this.contTime=null;this._lastHover=null;this._unloadSelector("month");this._unloadSelector("year");this._unloadSelector("hours");this._unloadSelector("minutes");if(this._selCover){this._selCover.parentNode.removeChild(this._selCover);this._selCover=null}if(this._sel){for(var s in this._sel._ta){this._sel._ta[s]=null}this._sel._ta=null;this._sel._t=null;this._sel.onmouseover=null;this._sel.onmouseout=null;while(this._sel.firstChild.firstChild.firstChild.childNodes.length>0){this._sel.firstChild.firstChild.firstChild.lastChild.onclick=null;this._sel.firstChild.firstChild.firstChild.lastChild.onmouseover=null;this._sel.firstChild.firstChild.firstChild.lastChild.onmouseout=null;this._sel.firstChild.firstChild.firstChild.removeChild(this._sel.firstChild.firstChild.firstChild.lastChild)}this._sel.firstChild.firstChild.removeChild(this._sel.firstChild.firstChild.firstChild);this._sel.firstChild.removeChild(this._sel.firstChild.firstChild);while(this._sel.childNodes.length>0){this._sel.removeChild(this._sel.lastChild)}this._sel.parentNode.removeChild(this._sel);this._sel=null}this.base.onclick=null;this.base.onmousedown=null;this.base.ontouchstart=null;this.base.onmouseout=null;this.base.parentNode.removeChild(this.base);this.base=null;this._clearDayHover=null;this._clearSelHover=null;this._doOnSelectorChange=null;this._doOnSelectorShow=null;this._drawMonth=null;this._fixLength=null;this._ifrSize=null;this._hide=null;this._hideSelector=null;this._initSelector=null;this._isSelectorVisible=null;this._isVisible=null;this._scrollYears=null;this._show=null;this._showSelector=null;this._strToDate=null;this._updateActiveHours=null;this._updateActiveMinutes=null;this._updateActiveMonth=null;this._updateActiveYear=null;this._updateCellStyle=null;this._updateDateStr=null;this._updateVisibleHours=null;this._updateVisibleMinutes=null;this._updateYearsList=null;this.enableIframe=null;this.hide=null;this.hideTime=null;this.setDate=null;this.setDateFormat=null;this.setYearsRange=null;this.show=null;this.showTime=null;this.unload=null;if(this._tipPopup!=null){this._tipPopup.unload();this._tipPopup=null}for(var s in this){delete this[s]}s=h=null};this.setDate(this._activeDate);return this}dhtmlXCalendarObject.prototype.lang="en";dhtmlXCalendarObject.prototype.langData={en:{dateformat:"%Y-%m-%d",hdrformat:"%F %Y",monthesFNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthesSNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],daysFNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysSNames:["Su","Mo","Tu","We","Th","Fr","Sa"],weekstart:1,weekname:"w"}};dhtmlXCalendarObject.prototype._buildMonthHdr=function(h){var c=this;var g=function(j){return(String(j).length==1?"0"+String(j):j)};var a=function(j,l){return""+l+""};var e=String(this.langData[this.lang].hdrformat||("%F %Y")).replace(/%[a-z]/gi,function(j){switch(j){case"%m":return a("month",g(h.getMonth()+1));case"%n":return a("month",h.getMonth()+1);case"%M":return a("month",c.langData[c.lang].monthesSNames[h.getMonth()]);case"%F":return a("month",c.langData[c.lang].monthesFNames[h.getMonth()]);case"%y":return a("year",g(h.getYear()%100));case"%Y":return a("year",h.getFullYear());case"%%":return"%";default:return j}});c=g=a=null;return e};dhtmlXCalendarObject.prototype.enableIframe=function(a){if(a==true){if(!this._ifr){this._ifr=document.createElement("IFRAME");this._ifr.frameBorder=0;this._ifr.border=0;this._ifr.setAttribute("src","javascript:false;");this._ifr.className="dhtmlxcalendar_ifr";this._ifr.onload=function(){this.onload=null;this.contentWindow.document.open("text/html","replace");this.contentWindow.document.write("")};this.base.parentNode.insertBefore(this._ifr,this.base);this._ifrSize()}}else{if(this._ifr){this._ifr.parentNode.removeChild(this._ifr);this._ifr=null}}};dhtmlXCalendarObject.prototype._ifrSize=function(){if(this._ifr){this._ifr.style.left=this.base.style.left;this._ifr.style.top=this.base.style.top;this._ifr.style.width=this.base.offsetWidth+"px";this._ifr.style.height=this.base.offsetHeight+"px"}};dhtmlxCalendarObject=dhtmlXCalendarObject;dhtmlXCalendarObject.prototype._dateStrings=function(){var a=this.langData[this.lang];return{monthFullName:a.monthesFNames,monthShortName:a.monthesSNames,dayFullName:a.daysFNames,dayShortName:a.daysSNames}};dhtmlXCalendarObject.prototype._strToDate=function(c,a){return window.dhx4.str2date(c,a||this._dateFormat,this._dateStrings())};dhtmlXCalendarObject.prototype._dateToStr=function(c,a){return window.dhx4.date2str(c,a||this._dateFormat,this._dateStrings())};window.dhtmlxDblCalendarObject=window.dhtmlXDoubleCalendarObject=window.dhtmlXDoubleCalendar=function(c){var a=this;this.leftCalendar=new dhtmlXCalendarObject(c);this.leftCalendar.hideTime();this.rightCalendar=new dhtmlXCalendarObject(c);this.rightCalendar.hideTime();this.leftCalendar.attachEvent("onClick",function(e){a._updateRange("rightCalendar",e,null);a._evOnClick(["left",e])});this.rightCalendar.attachEvent("onClick",function(e){a._updateRange("leftCalendar",null,e);a._evOnClick(["right",e])});this.leftCalendar.attachEvent("onBeforeChange",function(e){return a._evOnBeforeChange(["left",e])});this.rightCalendar.attachEvent("onBeforeChange",function(e){return a._evOnBeforeChange(["right",e])});this.show=function(){this.leftCalendar.show();this.rightCalendar.base.style.marginLeft=this.leftCalendar.base.offsetWidth-1+"px";this.rightCalendar.show()};this.hide=function(){this.leftCalendar.hide();this.rightCalendar.hide()};this.setDateFormat=function(e){this.leftCalendar.setDateFormat(e);this.rightCalendar.setDateFormat(e)};this.setDates=function(g,e){if(g!=null){this.leftCalendar.setDate(g)}if(e!=null){this.rightCalendar.setDate(e)}this._updateRange()};this._updateRange=function(e,h,g){if(arguments.length==3){(e=="leftCalendar"?this.leftCalendar:this.rightCalendar).setSensitiveRange(h,g)}else{this.leftCalendar.setSensitiveRange(null,this.rightCalendar.getDate());this.rightCalendar.setSensitiveRange(this.leftCalendar.getDate(),null)}};this.getFormatedDate=function(){return this.leftCalendar.getFormatedDate.apply(this.leftCalendar,arguments)};this.unload=function(){window.dhx4._eventable(this,"clear");this.leftCalendar.unload();this.rightCalendar.unload();this.leftCalendar=this.rightCalendar=null;this._updateRange=null;this._evOnClick=null;this._evOnBeforeChange=null;this.show=null;this.hide=null;this.setDateFormat=null;this.setDates=null;this.getFormatedDate=null;this.unload=null;a=null};this._evOnClick=function(e){return this.callEvent("onClick",e)};this._evOnBeforeChange=function(e){return this.callEvent("onBeforeChange",e)};window.dhx4._eventable(this);return this};function dhtmlXCombo(j,o,e,m,h){var l=this;var g=null;var r=null;if(typeof(j)=="object"&&!j.tagName){g=j;j=g.parent;e=g.width;o=g.name;m=g.mode;r=g.skin}this.cont=(typeof(j)=="string"?document.getElementById(j):j);this.conf={skin:null,form_name:o||"dhxcombo",combo_width:(parseInt(e)||this.cont.offsetWidth||120)-(dhx4.isFF||dhx4.isIE||dhx4.isChrome||dhx4.isOpera?2:0),combo_image:false,combo_focus:false,opts_type:(typeof(m)=="string"&&typeof(this.modes[m])!="undefined"?m:"option"),opts_count:8,opts_count_min:3,opts_width:null,item_h:null,list_zi_id:window.dhx4.newId(),allow_free_text:true,allow_empty_value:true,enabled:true,btn_left:((window.dhx4.isIE6||window.dhx4.isIE7||window.dhx4.isIE8)&&typeof(window.addEventListener)=="undefined"?1:0),ro_mode:false,ro_text:"",ro_tm:null,ro_tm_time:750,img_path:"",img_def:"",img_def_dis:true,template:{input:"#text#",option:"#text#"},f_func:null,f_mode:false,f_url:false,f_cache:false,f_cache_data:{},f_dyn:false,f_dyn_end:false,f_mask:"",f_ac:true,f_ac_text:"",f_server_tm:null,f_server_last:"",f_loading:false,s_tm:null,s_time:200,s_mode:"select",last_hover:null,last_selected:null,last_match:null,last_text:"",last_value:"",tm_hover:null,tm_confirm_blur:null,clear_click:false,clear_blur:false,clear_bsp:false,clear_key:false,sp:{dhx_skyblue:{list_ofs:1,hdr_ofs:1,scr_ofs:1},dhx_web:{list_ofs:0,hdr_ofs:1,scr_ofs:0},dhx_terrace:{list_ofs:1,hdr_ofs:1,scr_ofs:1}},col_w:null};this.conf.combo_image=(this.modes[this.conf.opts_type].image==true);this.t={};this.base=document.createElement("DIV");this.base.style.width=this.conf.combo_width+"px";this.base.innerHTML="
"+(this.conf.combo_image?"
"+this.modes[this.conf.opts_type].getTopImage(null,this.conf.enabled)+"
":"");this.cont.appendChild(this.base);this.list=document.createElement("DIV");this.list._listId=window.dhx4.newId();this.list.style.display="none";document.body.insertBefore(this.list,document.body.firstChild);this._doOnListScroll=function(){if(l.conf.s_tm!=null){window.clearTimeout(l.conf.s_tm)}l.conf.s_tm=window.setTimeout(l._doOnListScrollAction,l.conf.s_time)};this._doOnListScrollAction=function(){l.conf.s_tm=null;if(l.conf.s_mode=="scroll"&&l.list.scrollHeight-l.list.scrollTop-100&&l.base.offsetHeight>0);if(H==true&&l.conf.enabled==true&&l.conf.combo_focus==true&&y!==true){if(l.conf.f_ac&&l.conf.f_mode=="start"&&l.conf.clear_bsp==false&&l.list.firstChild!=null){var F=l.list.firstChild._optId;var J=String(l.t[F].obj.getText(l.list.firstChild,true));if(v==l.base.firstChild.value&&String(J).toLowerCase().indexOf(String(v).toLowerCase())===0){l.base.firstChild.value=J;l.conf.f_ac_text=J.substr(v.length);l._selectRange(v.length,J.length)}}l._showList(true);l._checkForMatch()}a=null};if(window.dhx4.ajax.method=="post"){window.dhx4.ajax.post(l.conf.f_url,E,a)}else{if(window.dhx4.ajax.method=="get"){window.dhx4.ajax.get(l.conf.f_url+(String(l.conf.f_url).indexOf("?")>=0?"&":"?")+E,a)}}},200)}}else{this.conf.f_server_last=v.toLowerCase();var s=(v.length==0?true:new RegExp((this.conf.f_mode=="start"?"^":"")+String(v).replace(/[\\\^\$\*\+\?\.\(\)\|\{\}\[\]]/gi,"\\$&"),"i"));var w=null;for(var A in this.t){var D=false;if(s!==true){if(this.conf.f_func!=null){var x=this._getOption(this.t[A].item._optId,u);D=(this.conf.f_func.apply(window,[v,x])==true)}else{var C=this.t[A].obj.getText(this.t[A].item,true);D=(s.test(C)==true)}}if(s===true||D==true){this.t[A].item.style.display="";if(w==null&&v.length>0){w=String(this.t[A].obj.getText(this.t[A].item,true))}}else{this.t[A].item.style.display="none"}}if(this.conf.f_ac&&this.conf.f_mode=="start"&&this.conf.clear_bsp==false&&w!=null){this.conf.f_ac_text=w.replace(new RegExp("^"+v,"i"),"");this.base.firstChild.value=w;this._selectRange(this.conf.f_server_last.length,this.base.firstChild.value.length)}if(this.conf.f_mode=="between"&&this.conf.clear_bsp==true){this._checkForMatch(true)}if(y!==true){this._showList(true);this._checkForMatch()}}};this._searchRO=function(u){if(this.conf.ro_tm){window.clearTimeout(this.conf.ro_tm)}this.conf.ro_text+=u;this._showList();for(var v=0;v0){if(window.dhx4.s2b(I[0].getAttribute("add"))==true){A.add=true}var H=I[0].childNodes;for(var E=0;E=48&&a.keyCode<=57)||(a.keyCode>=65&&a.keyCode<=90))){l._searchRO(String.fromCharCode(a.keyCode).toLowerCase());a.cancelBubble=true}l.conf.clear_key=true;l.callEvent("onKeyPressed",[a.keyCode||a.charCode])};this._doOnInputKeyPress=function(a){if(l.conf.clear_key){l.conf.clear_key=false;return}a=a||event;l.callEvent("onKeyPressed",[a.keyCode||a.charCode])};this._keyOnUpDown=function(a){var s=null;if(this.conf.last_hover){s=this.t[this.conf.last_hover].item}else{if(this.conf.last_selected){s=this.t[this.conf.last_selected].item}}if(!s&&this._getListVisibleCount()==0){return}if(s!=null&&s.style.display!=""){s=null}this._showList();if(s!=null){if(this.t[s._optId].obj.isSelected(s)){s=this._getNearItem(s,a)}}else{s=this.list.firstChild;if(s.style.display!=""){s=this._getNearItem(s,1)}}if(s==null){return}this._setSelected(s._optId,true,true);if(this.conf.f_mode==false){this.base.firstChild.value=this.t[s._optId].obj.getText(s,true)}else{var u=String(this.t[s._optId].obj.getText(s,true));if(this.conf.f_mode=="start"&&this.conf.f_ac==true){if(u.toLowerCase().indexOf(this.conf.f_server_last)===0){this.conf.f_ac_text=u.substring(this.conf.f_server_last.length,u.length);this.base.firstChild.value=u;this._selectRange(this.conf.f_server_last.length,this.base.firstChild.value.length)}else{this.base.firstChild.value=u;this.conf.f_server_last=this.base.firstChild.value.toLowerCase();this._selectRange(0,this.base.firstChild.value.length)}}else{this.base.firstChild.value=u;this.conf.f_server_last=this.base.firstChild.value.toLowerCase()}}s=null};this.conf.evs_nodes=[{node:document.body,evs:{mousedown:"_doOnBodyMouseDown"}},{node:this.base,evs:{mousedown:"_doOnBaseMouseDown"}},{node:this.base.firstChild,evs:{keyup:"_doOnInputKeyUp",keydown:"_doOnInputKeyDown",keypress:"_doOnInputKeyPress",focus:"_doOnInputFocus",blur:"_doOnInputBlur"}},{node:this.list,evs:{mousemove:"_doOnListMouseMove",mousedown:"_doOnListMouseDown",mouseup:"_doOnListMouseUp",mouseout:"_doOnListMouseOut"}}];for(var c=0;c0){h.addOption(a.options)}a=null;e.parentNode.removeChild(e);e=null;return h}dhtmlXCombo.prototype.setName=function(a){this.conf.form_name=a;this.base.childNodes[1].name=a;this.base.childNodes[2].name=a.replace(/(\[.*)?$/,"_new_value$1")};dhtmlXCombo.prototype.readonly=function(a){if(window.dhx4.s2b(a)){this.base.firstChild.setAttribute("readOnly","true");this.conf.ro_mode=true}else{this.base.firstChild.removeAttribute("readOnly");this.conf.ro_mode=false}};dhtmlXCombo.prototype.setPlaceholder=function(a){if(typeof(a)=="undefined"||a==null){a=""}this.base.firstChild.setAttribute("placeholder",String(a))};dhtmlXCombo.prototype.setTemplate=function(e){for(var c in e){if(typeof(this.conf.template[c])!="undefined"){this.conf.template[c]=String(e[c])}}if(e.columns!=null){this._mcMakeTemplate(e.columns)}else{this._mcDetachHeader()}for(var c in this.t){this.t[c].obj.setText(this.t[c].item,this.t[c].item._conf.text)}this._confirmSelect()};dhtmlXCombo.prototype.setSkin=function(a){if(a==this.conf.skin){return}this.conf.skin=a;this.base.className="dhxcombo_"+this.conf.skin+(this.conf.enabled?"":" dhxcombo_disabled");this.list.className="dhxcombolist_"+this.conf.skin+(this.hdr!=null?" dhxcombolist_multicolumn":"");if(this.hdr!=null){this.hdr.className="dhxcombolist_"+this.conf.skin+" dhxcombolist_hdr"}};dhtmlXCombo.prototype.getInput=function(){return this.base.firstChild};dhtmlXCombo.prototype.getButton=function(){return this.base.childNodes[this.base.childNodes.length-(this.conf.combo_image?2:1)]};dhtmlXCombo.prototype.getList=function(){return this.list};dhtmlXCombo.prototype.getBase=function(){return this.base};dhtmlXCombo.prototype.getParent=function(){return this.DOMParent};dhtmlXCombo.prototype.forEachOption=function(a){for(var c=0;c=this.list.childNodes.length){return}var g=this.list.childNodes[c]._optId;this._setSelected(g,this._isListVisible(),true);this._confirmSelect("script")};dhtmlXCombo.prototype.unSelectOption=function(){if(this.conf.last_hover!=null){this.t[this.conf.last_hover].obj.setSelected(this.t[this.conf.last_hover].item,false);this.conf.last_hover=null}this.base.firstChild.value="";if(this.conf.f_mode!=false){this._filterOpts(true)}this._hideList();this._updateTopImage(null);this._confirmSelect("script")};dhtmlXCombo.prototype.confirmValue=function(){this._confirmSelect("script")};dhtmlXCombo.prototype.enable=function(a){a=(typeof(a)=="undefined"?true:window.dhx4.s2b(a));if(this.conf.enabled==a){return}this.conf.enabled=a;if(a){this.base.className="dhxcombo_"+this.conf.skin;this.base.firstChild.removeAttribute("disabled")}else{this._hideList();this.base.className="dhxcombo_"+this.conf.skin+" dhxcombo_disabled";this.base.firstChild.setAttribute("disabled","true")}this._updateTopImage(this.conf.last_selected)};dhtmlXCombo.prototype.disable=function(a){a=(typeof(a)=="undefined"?true:window.dhx4.s2b(a));this.enable(!a)};dhtmlXCombo.prototype.isEnabled=function(){return(this.conf.enabled==true)};dhtmlXCombo.prototype.show=function(a){if(typeof(a)=="undefined"){a=true}else{a=window.dhx4.s2b(a)}this.base.style.display=(a==true?"":"none")};dhtmlXCombo.prototype.hide=function(a){if(typeof(a)=="undefined"){a=true}this.show(!a)};dhtmlXCombo.prototype.isVisible=function(){return(this.base.style.display=="")};dhtmlXCombo.prototype.setFilterHandler=function(a){if(typeof(a)=="function"){this.conf.f_func=a;this.conf.f_mode=true;this.conf.f_dyn=this.conf.f_cache=this.conf.f_url=null}else{if(typeof(a)=="string"&&typeof(window[a])=="function"){this.conf.f_func=window[a];this.conf.f_mode=true;this.conf.f_dyn=this.conf.f_cache=this.conf.f_url=null}else{this.conf.f_func=null}}};dhtmlXCombo.prototype.enableFilteringMode=function(g,c,a,e){if(g==true||g=="between"){this.conf.f_mode=(g==true?"start":"between");if(c!=null){this.conf.f_url=c;this.conf.f_cache=window.dhx4.s2b(a);this.conf.f_dyn=window.dhx4.s2b(e)}else{this.conf.f_url=null;this.conf.f_cache=false;this.conf.f_dyn=false}}else{this.conf.f_mode=false;this.conf.f_url=null;this.conf.f_cache=false;this.conf.f_dyn=false}};dhtmlXCombo.prototype.filter=function(e,a){for(var g=0;gh?l:-1*l)})}else{if(typeof(e)=="function"||typeof(window[e])=="function"){if(typeof(window[e])=="function"){e=window[e]}a.sort(function(j,h){return e.apply(window,[j[1],h[1]])})}}while(this.list.childNodes.length>0){this.list.removeChild(this.list.lastChild)}for(var c=0;cn){n=null}var m=Math.min((n==null?e:n),this.conf.opts_count,u);var g=(ma){this.list.scrollTop=e-this.list.clientHeight+(this.hdr!=null?-this.conf.sp[this.conf.skin].scr_ofs:0)}}};dhtmlXCombo.prototype._setSelected=function(e,c,a){if(a){this._updateTopImage(e)}if(e!=null&&this.conf.last_hover==e){if(c){this._scrollToItem(e)}return}if(this.conf.last_hover!=null){this.t[this.conf.last_hover].obj.setSelected(this.t[this.conf.last_hover].item,false);this.conf.last_hover=null;if(e==null){this.callEvent("onSelectionChange",[])}}if(e!=null){this.t[e].obj.setSelected(this.t[e].item,true);this.conf.last_hover=e;this.callEvent("onSelectionChange",[]);if(this.conf.s_mode=="select"&&this.t[e].item==this.t[e].item.parentNode.lastChild){this._subloadRequest()}if(c){this._scrollToItem(e)}}};dhtmlXCombo.prototype._subloadRequest=function(){if(this.conf.f_url!=null&&this.conf.f_dyn==true&&this.conf.f_dyn_end==false){var e="mask="+encodeURIComponent(this.conf.f_mask)+"&pos="+this.list.childNodes.length;var a=this;var c=function(h){if(a.conf.f_cache){a.conf.f_cache_data[a.conf.f_mask].data.push(h.xmlDoc.responseXML)}var g=a.list.childNodes.length;a.conf.f_loading=true;a.load(h.xmlDoc.responseXML);a.conf.f_loading=false;if(g==a.list.childNodes.length){a.conf.f_dyn_end=true;if(a.conf.f_cache){a.conf.f_cache_data[a.conf.f_mask].dyn_end=true}}c=a=null};if(window.dhx4.ajax.method=="post"){window.dhx4.ajax.post(this.conf.f_url,e,c)}else{if(window.dhx4.ajax.method=="get"){window.dhx4.ajax.get(this.conf.f_url+(String(this.conf.f_url).indexOf("?")>=0?"&":"?")+e,c)}}}};dhtmlXCombo.prototype.addOption=function(j,l,c,a,g){var e=null;if(!(j instanceof Array)){var m=this._renderOption({value:j,text:l,css:c,img:a});if(e==null&&window.dhx4.s2b(g)==true){e=m}}else{for(var h=0;h
"+(n[l].option||" ")+"
";j+="
"+(n[l].header||" ")+"
";this.conf.col_w+=a+1}var a=500;var c=document.createElement("DIV");c.style.position="absolute";c.style.top="10px";c.style.left=-a*2+"px";c.style.width=a+"px";c.style.height="50px";c.style.overflowY="scroll";c.innerHTML="
 
";document.body.appendChild(c);this.conf.col_w+=a-c.firstChild.offsetWidth+10;c.parentNode.removeChild(c);c=null;this.conf.template.option=g;this._mcAttachHeader(j);this.list.className+=" dhxcombolist_multicolumn"};dhtmlXCombo.prototype._mcAttachHeader=function(a){if(this.hdr==null){this.hdr=document.createElement("DIV");this.hdr.className="dhxcombolist_"+this.conf.skin+" dhxcombolist_hdr";this.hdr.style.display="none";this.list.parentNode.insertBefore(this.hdr,this.list);if(typeof(window.addEventListener)=="function"){this.hdr.addEventListener("mousedown",this._doOnListMouseDown,false)}else{this.hdr.attachEvent("onmousedown",this._doOnListMouseDown)}if(this.conf.opts_type=="checkbox"&&this.conf.combo_image==true){this.conf.combo_image=false;if(this.base.lastChild.className.match(/dhxcombo_top_image/)!=null){this.base.removeChild(this.base.lastChild)}this._adjustBase()}}this.hdr.innerHTML="
"+a+"
"};dhtmlXCombo.prototype._mcDetachHeader=function(){if(this.hdr!=null){if(typeof(window.addEventListener)=="function"){this.hdr.removeEventListener("mousedown",this._doOnListMouseDown,false)}else{this.hdr.detachEvent("onmousedown",this._doOnListMouseDown)}this.hdr.parentNode.removeChild(this.hdr);this.hdr=null}this.conf.col_w=null;this.conf.item_h=null};dhtmlXCombo.prototype.modes={};dhtmlXCombo.prototype.doWithItem=function(a,l,h,e){var j=(a>=0&&a ";if(c.css!=null){a.lastChild.style.cssText=c.css;a._conf.css=c.css}this.setText(a,c.text);return this},destruct:function(a){a._conf=null},update:function(a,c){a._conf.value=c.value;a._conf.css=c.css;a.lastChild.style.cssText=c.css;this.setText(a,c.text)},setText:function(c,e){c._conf.text=e;var a=(typeof(e)=="object"?window.dhx4.template(c._tpl.option,this.replaceHtml(c._conf.text),true):window.dhx4.trim(this.replaceHtml(c._conf.text)||""));c.lastChild.innerHTML=(a.length==0?" ":a)},getText:function(e,a,c){if(window.dhx4.s2b(a)&&typeof(e._conf.text)=="object"){return window.dhx4.template(e._tpl.input,e._conf.text,true)}if(window.dhx4.s2b(c)&&typeof(e._conf.text)=="object"){return window.dhx4.template(e._tpl.option,e._conf.text,true)}return e._conf.text},getValue:function(a){return a._conf.value},getCss:function(a){return a._conf.css},setSelected:function(a,c){a.className="dhxcombo_option"+(c?" dhxcombo_option_selected":"")},isSelected:function(a){return String(a.className).indexOf("dhxcombo_option_selected")>=0},getExtraData:function(a){return{type:"option"}},replaceHtml:function(g){if(this.html==true){return g}if(typeof(g)=="object"){var e={};for(var c in g){e[c]=this.replaceHtml(g[c])}}else{var e=g.replace(/[\<\>\&\s]/g,function(a){switch(a){case"<":return"<";case">":return">";case"&":return"&";case" ":return" "}return a})}return e}};dhtmlXCombo.prototype.modes.checkbox={image:true,html:true,image_css:"dhxcombo_checkbox dhxcombo_chbx_#state#",option_css:"dhxcombo_option_text dhxcombo_option_text_chbx",render:function(a,c){if(this.image_css_regexp==null){this.image_css_regexp=new RegExp(this.image_css.replace("#state#","\\d*"))}a._conf={value:c.value,css:"",checked:window.dhx4.s2b(c.checked)};a.className="dhxcombo_option";if(c.multicol==true){c.text.checkbox="
 ";a.innerHTML="
"}else{a.innerHTML="
 
"}if(c.css!=null){a.lastChild.style.cssText+=c.css;a._conf.css=c.css}this.setText(a,c.text);return this},setChecked:function(c,e){c._conf.checked=window.dhx4.s2b(e);var a=String(this.image_css).replace("#state#",(c._conf.checked?"1":"0"));this._changeChbxCss(c.childNodes,a)},_changeChbxCss:function(a,c){for(var e=0;e0){this._changeChbxCss(a[e].childNodes,c)}}}},isChecked:function(a){return(a._conf.checked==true)},getExtraData:function(a){return{type:"checkbox",checked:a._conf.checked}},optionClick:function(h,g,j){var e=true;var c=(g.target||g.srcElement);while(e==true&&c!=null&&c!=h&&c.className!=null){if(c.className.match(this.image_css_regexp)!=null){var a=[h._conf.value,!h._conf.checked];if(j.callEvent("onBeforeCheck",a)===true){this.setChecked(h,!this.isChecked(h));j.callEvent("onCheck",a)}e=false;a=null}else{c=c.parentNode}}c=j=h=null;return e},getTopImage:function(c,a){return""},topImageClick:function(a,c){return true}};dhtmlXComboExtend("checkbox","option");dhtmlXCombo.prototype.setChecked=function(a,c){this.doWithItem(a,"setChecked",c)};dhtmlXCombo.prototype.getChecked=function(a){var c=[];for(var e=0;e
 
";if(c.css!=null){a.lastChild.style.cssText+=c.css;a._conf.css=c.css}this.setText(a,c.text);this.setImage(a,c.img,c.img_dis,c.img_path,c.img_def,c.img_def_dis);return this},update:function(a,c){a._conf.value=c.value;a._conf.css=c.css;a.lastChild.style.cssText=c.css;this.setText(a,c.text);this.setImage(a,c.img,c.img_dis,c.img_path,c.img_def,c.img_def_dis)},setImage:function(e,a,h,j,g,c){if(a!=null&&a.length>0){a=j+a}else{if(g!=null&&g.length>0){a=j+g}else{a=null}}if(h!=null&&h.length>0){h=j+h}else{if(c!=null&&c.length>0){h=j+c}else{if(c==true){h=a}else{h=null}}}e._conf.img=a;e._conf.img_dis=h;e.firstChild.style.backgroundImage=(a!=null?"url("+a+")":"none")},getExtraData:function(a){return{type:"image"}},getTopImage:function(g,e){var c=(e?"img":"img_dis");if(g!=null&&g._conf[c]!=null){return"
"}return""}};dhtmlXComboExtend("image","option");dhtmlXCombo.prototype.setDefaultImage=function(a,c){if(a!=null){this.conf.img_def=a}if(c!=null){this.conf.img_def_dis=c}};dhtmlXCombo.prototype.setImagePath=function(a){this.conf.img_path=a};function dhtmlXColorPicker(m){if(!(this instanceof dhtmlXColorPicker)){return new dhtmlXColorPicker(m)}dhx4._eventable(this);var h=this,g=undefined,j=null,e,a,c;this._nodes=[];this.activeNode=null;this._inputListenerId=null;this.base=null;this._globalNode=null;this.memory=null;this.skin=null;this.conf={cp_id:dhx4.newId(),x:0,y:0,c:0,indent:2,position:"right",customColors:false,selectedColor:null,hide:false,hideOnSelect:false,lang:"en",closeable:true};this.value={red:-1,blue:-1,green:-1,hue:-1,sat:-1,lum:-1};this._initMoveSelection=function(l){l=l||event;if(typeof(window.addEventListener)=="function"){h._controllerNodes.colorArea.addEventListener("mousemove",h._setMoveSelection,false);document.body.addEventListener("mouseup",h._cleanMoveSelection,false)}else{h._controllerNodes.colorArea.attachEvent("onmousemove",h._setMoveSelection);document.body.attachEvent("onmouseup",h._cleanMoveSelection)}h._setMoveSelection(l,h._controllerNodes.colorArea);return false};this._cleanMoveSelection=function(){if(typeof(window.removeEventListener)=="function"){h._controllerNodes.colorArea.removeEventListener("mousemove",h._setMoveSelection,false);document.body.removeEventListener("mouseup",h._cleanMoveSelection,false)}else{h._controllerNodes.colorArea.detachEvent("onmousemove",h._setMoveSelection);document.body.detachEvent("onmouseup",h._cleanMoveSelection)}return false};this._setMoveSelection=function(l){l=l||event;var n=h._getOffsetPosition(l,h._controllerNodes.colorArea);if(h._controllerNodes.fr_cover){setTimeout(function(){h._setColorAreaXY(n.x,n.y);h._setColorByXYC()},0)}else{h._setColorAreaXY(n.x,n.y);h._setColorByXYC()}return false};this._initMoveContrast=function(l){l=l||event;if(typeof(window.addEventListener)=="function"){document.body.addEventListener("mousemove",h._setMoveContrast,false);document.body.addEventListener("mouseup",h._cleanMoveContrast,false)}else{document.body.attachEvent("onmousemove",h._setMoveContrast);document.body.attachEvent("onmouseup",h._cleanMoveContrast)}h._setMoveContrast(l,h._controllerNodes.contrastArea)};this._cleanMoveContrast=function(){if(typeof(window.removeEventListener)=="function"){document.body.removeEventListener("mousemove",h._setMoveContrast,false);document.body.removeEventListener("mouseup",h._cleanMoveContrast,false)}else{document.body.detachEvent("onmousemove",h._setMoveContrast);document.body.detachEvent("onmouseup",h._cleanMoveContrast)}};this._setMoveContrast=function(l){l=l||event;var n=h._getOffsetPosition(l,h._controllerNodes.contrastArea);h._setContrastY(n.y);h._setColorByXYC(true)};this._doOnSelectColor=function(){var l=h.colorAIP.rgb2hex({r:h.value.red,g:h.value.green,b:h.value.blue});if(h.activeNode!=null){if(h.activeNode.valueCont){h.activeNode.valueCont.value=l}if(h.activeNode.valueColor){h.activeNode.valueColor.style.backgroundColor=l}}if(h.base._dhx_remove||h.conf.hideOnSelect){h.hide()}h.callEvent("onSelect",[l,((h.activeNode)?h.activeNode.node:null)])};this._doOnCancel=function(){if(h.callEvent("onCancel",[((h.activeNode)?h.activeNode.node:null)])==true&&h.conf.closeable==true){h.hide()}};this._doOnFocusByInput=function(){var n=(this!=window)?this:event.srcElement;var l=(h.activeNode&&h.activeNode.valueCont&&h.activeNode.valueCont==n)?h.activeNode:h._getNodeByValueCont(n);h.activeNode=l;if(l&&l==h.activeNode){h._initListenerInput()}};this._doOnBlurByInput=function(){var n=(this!=window)?this:event.srcElement;var l=(h.activeNode&&h.activeNode.valueCont&&h.activeNode.valueCont==n)?h.activeNode:h._getNodeByValueCont(n);if(l&&l==h.activeNode){h._removeListenerInput()}};this._doOnClickByNode=function(n){n=n||event;var l=(this!=window)?this:event.srcElement;h.activeNode=(h.activeNode.node!=l)?h._getNodeByElement(l):h.activeNode;if(!h.isVisible()){h.show()}};this.saveColor=function(){h.memory.setValue(h.value)};this._onSelectMemoryEl=function(n){var l;h._refreshCoordinatesByHSL(n.value.hue,n.value.sat,n.value.lum);for(l in n.value){h.value[l]=n.value[l]}h._refreshContrast();h._refreshInputValues();h._refreshColorValue()};this._doOnClickByBody=function(o){o=o||event;var l=true,n=o.target||o.srcElement;if(h._isBaseNode(n)){l=false}if(l&&h.activeNode&&(h.activeNode.node==n||h.activeNode.valueCont==n)){l=false}if(l){h.hide()}};this._doOnChangeHSL=function(){var o=parseInt(h._controllerNodes.hue.value),n=parseInt(h._controllerNodes.sat.value),l=parseInt(h._controllerNodes.lum.value),r;if(isNaN(o)||o>359||o<0){h._controllerNodes.hue.value=h.value.hue}else{h.value.hue=o}if(isNaN(n)||n>100||n<0){h._controllerNodes.sat.value=h.value.sat}else{h.value.sat=n}if(isNaN(l)||l>100||l<0){h._controllerNodes.lum.value=h.value.lum}else{h.value.lum=l}r=h.colorAIP.hsl2rgb(h.value.hue,h.value.sat/100,h.value.lum/100);h.value.red=Math.round(255*r.r);h.value.green=Math.round(255*r.g);h.value.blue=Math.round(255*r.b);h._refreshCoordinatesByHSL(h.value.hue,h.value.sat,h.value.lum);h._refreshContrast();h._refreshInputValues();h._refreshColorValue()};this._doOnChangeRGB=function(){var r=parseInt(h._controllerNodes.red.value),o=parseInt(h._controllerNodes.green.value),l=parseInt(h._controllerNodes.blue.value),n;if(isNaN(r)||r>255||r<0){h._controllerNodes.red.value=h.value.red}else{h.value.red=r}if(isNaN(o)||o>255||o<0){h._controllerNodes.green.value=h.value.green}else{h.value.green=o}if(isNaN(l)||l>255||l<0){h._controllerNodes.blue.value=h.value.blue}else{h.value.blue=l}n=h.colorAIP.rgb2hsl(h.value.red/255,h.value.green/255,h.value.blue/255);h.value.hue=Math.round(n.h);h.value.sat=Math.round(n.s*100);h.value.lum=Math.round(n.l*100);h._refreshCoordinatesByHSL(h.value.hue,h.value.sat,h.value.lum);h._refreshContrast();h._refreshInputValues();h._refreshColorValue()};this._doOnChangeHSV=function(){h._controllerNodes.hsv.value=h.setColor(h._controllerNodes.hsv.value)};this._checkType=function(n){var l;if(n instanceof Array){l=h._checkType(n[0]);switch(l){case"string":return"array_string";break;case"input":case"textarea":return"array_input";break;case"object":return"array_object";break;default:return undefined}}else{if(n==undefined){return null}else{if(typeof(n)=="string"){return"string"}else{if(n.tagName&&n.tagName.toLowerCase()=="input"){return"input"}else{if(n.tagName&&n.tagName.toLowerCase()=="textarea"){return"textarea"}else{if(n.tagName){return"container"}else{if(typeof(n)=="object"){return"object"}else{return undefined}}}}}}}};this._initByObject=function(l){if(l.parent&&l.parent.tagName){h.base=l.parent}else{if(typeof(l.parent)=="string"){h.base=document.getElementById(l.parent)}else{h.base=document.createElement("div");h.base._dhx_remove=true}}if(l.color){h.conf.selectedColor=l.color}if(typeof(l.closeable)!="undefined"){this.conf.closeable=dhx4.s2b(l.closeable)}if(l.custom_colors){this._tempInitCC=function(){var r,o;this.initMemoryColors();this.conf.customColors=true;if(l.custom_colors instanceof Array){o=l.custom_colors.length;for(r=0;r
"+this.i18n[this.conf.lang].labelHue+""+this.i18n[this.conf.lang].labelRed+"
"+this.i18n[this.conf.lang].labelSat+""+this.i18n[this.conf.lang].labelGreen+"
"+this.i18n[this.conf.lang].labelLum+""+this.i18n[this.conf.lang].labelBlue+"
";"";this._globalNode=this.base.firstChild;this._controllerNodes={colorArea:this._globalNode.firstChild.firstChild.firstChild,v_line:this._globalNode.firstChild.firstChild.firstChild.childNodes[0],h_line:this._globalNode.firstChild.firstChild.firstChild.childNodes[1],contrastArea:this._globalNode.firstChild.firstChild.childNodes[1],contrast_line:this._globalNode.firstChild.firstChild.childNodes[1].firstChild,color:this._globalNode.firstChild.childNodes[1].childNodes[0].firstChild,hsv:this._globalNode.firstChild.childNodes[1].childNodes[0].childNodes[1],hue:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[1].firstChild,sat:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[1].firstChild,lum:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[1].firstChild,red:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[3].firstChild,green:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[3].firstChild,blue:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[3].firstChild,memory_block:this._globalNode.firstChild.childNodes[2],button_save:this._globalNode.firstChild.childNodes[3].firstChild,button_cancel:this._globalNode.firstChild.childNodes[3].childNodes[1]};this._labelNodes={labelHue:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].firstChild,labelSat:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].firstChild,labelLum:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].firstChild,labelRed:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[2],labelGreen:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[2],labelBlue:this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[2],btnAddColor:null,btnSelect:this._globalNode.firstChild.childNodes[3].firstChild,btnCancel:this._globalNode.firstChild.childNodes[3].childNodes[1]};if(typeof(this._tempInitCC)=="function"){this._tempInitCC()}if(typeof(window.addEventListener)=="function"){this._controllerNodes.colorArea.addEventListener("mousedown",this._initMoveSelection,false);this._controllerNodes.colorArea.addEventListener("dblclick",this._doOnSelectColor,false);this._controllerNodes.contrastArea.addEventListener("mousedown",this._initMoveContrast,false);this._controllerNodes.button_save.addEventListener("click",this._doOnSelectColor,false);this._controllerNodes.button_cancel.addEventListener("click",this._doOnCancel,false);this._controllerNodes.hue.addEventListener("change",this._doOnChangeHSL,false);this._controllerNodes.sat.addEventListener("change",this._doOnChangeHSL,false);this._controllerNodes.lum.addEventListener("change",this._doOnChangeHSL,false);this._controllerNodes.red.addEventListener("change",this._doOnChangeRGB,false);this._controllerNodes.green.addEventListener("change",this._doOnChangeRGB,false);this._controllerNodes.blue.addEventListener("change",this._doOnChangeRGB,false);this._controllerNodes.hsv.addEventListener("change",this._doOnChangeHSV,false)}else{this._controllerNodes.colorArea.attachEvent("onmousedown",this._initMoveSelection);this._controllerNodes.colorArea.attachEvent("ondblclick",this._doOnSelectColor);this._controllerNodes.contrastArea.attachEvent("onmousedown",this._initMoveContrast);this._controllerNodes.button_save.attachEvent("onclick",this._doOnSelectColor);this._controllerNodes.button_cancel.attachEvent("onclick",this._doOnCancel);this._controllerNodes.hue.attachEvent("onchange",this._doOnChangeHSL);this._controllerNodes.sat.attachEvent("onchange",this._doOnChangeHSL);this._controllerNodes.lum.attachEvent("onchange",this._doOnChangeHSL);this._controllerNodes.red.attachEvent("onchange",this._doOnChangeRGB);this._controllerNodes.green.attachEvent("onchange",this._doOnChangeRGB);this._controllerNodes.blue.attachEvent("onchange",this._doOnChangeRGB);this._controllerNodes.hsv.attachEvent("onchange",this._doOnChangeHSV)}this.setColor(this.conf.selectedColor||"#ffffff");if(this._nodes.length){for(var e=0;e
";this.memory=new this.Memory(this._controllerNodes.memory_block.childNodes[1]);this.memory.onSelect=this._onSelectMemoryEl;this.memory.onSave=function(g){var e=c.colorAIP.rgb2hex({r:g.red,g:g.green,b:g.blue});c.callEvent("onSaveColor",[e])};var a=this._controllerNodes.memory_block.childNodes[0].firstChild;this._labelNodes.btnAddColor=this._controllerNodes.memory_block.childNodes[0].firstChild.firstChild;if(typeof(window.addEventListener)=="function"){a.addEventListener("click",this.saveColor,false)}else{a.attachEvent("onclick",this.saveColor)}};dhtmlXColorPicker.prototype._refreshCoordinatesByHSL=function(m,j,c){var a,g,e;a=Math.round((this.configColorArea.maxX-this.configColorArea.minX)*m/359)+this.configColorArea.minX;g=Math.round((this.configColorArea.maxY-this.configColorArea.minY)*(100-c)/100)+this.configColorArea.minY;e=Math.round((this.configColorArea.maxY-this.configColorArea.minY)*(100-j)/100)+this.configColorArea.minY;this._setColorAreaXY(a,g);this._setContrastY(e)};dhtmlXColorPicker.prototype._parseColor=function(e){if(e instanceof Array){var c={r:parseInt(e[0]),g:parseInt(e[1]),b:parseInt(e[2])}}else{if(typeof(e)=="string"){e=e.replace(/\s/g,"");if(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i.test(e)){var a=e.match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i);var c={r:parseInt(a[1]),g:parseInt(a[2]),b:parseInt(a[3])}}else{var c=this.colorAIP.hex2rgb(e)}}}return c};dhtmlXColorPicker.prototype.setColor=function(j){var c=this.colorAIP.rgb2hex({r:this.value.red,g:this.value.green,b:this.value.blue});var e=this._parseColor(j);var h=(e instanceof Object);h=h&&(0<=e.r&&e.r<=255);h=h&&(0<=e.g&&e.g<=255);h=h&&(0<=e.b&&e.b<=255);if(!h){return c}var g=this.colorAIP.rgb2hex({r:e.r,g:e.g,b:e.b});if(g==c){return c}this.value.red=e.r;this.value.green=e.g;this.value.blue=e.b;var a=this.colorAIP.rgb2hsl(e.r/255,e.g/255,e.b/255);this.value.hue=Math.round(a.h);this.value.sat=Math.round(a.s*100);this.value.lum=Math.round(a.l*100);this._refreshCoordinatesByHSL(this.value.hue,this.value.sat,this.value.lum);this._refreshContrast();this._refreshInputValues();this._refreshColorValue();return g};dhtmlXColorPicker.prototype.getSelectedColor=function(){return[this.colorAIP.rgb2hex({r:this.value.red,g:this.value.green,b:this.value.blue}),[this.value.red,this.value.green,this.value.blue],[this.value.hue,this.value.sat,this.value.lum]]};dhtmlXColorPicker.prototype._attachEventsToNode=function(a){if(typeof(window.addEventListener)=="function"){a.node.addEventListener("click",this._doOnClickByNode,false)}else{a.node.attachEvent("onclick",this._doOnClickByNode)}if(a.valueCont&&a.valueCont.tagName.toLowerCase()=="input"){if(typeof(window.addEventListener)=="function"){a.valueCont.addEventListener("focus",this._doOnFocusByInput,false);a.valueCont.addEventListener("blur",this._doOnBlurByInput,false)}else{a.valueCont.attachEvent("onfocus",this._doOnFocusByInput);a.valueCont.attachEvent("onblur",this._doOnBlurByInput)}}};dhtmlXColorPicker.prototype._detachEventsFromNode=function(a){if(typeof(window.addEventListener)=="function"){a.node.removeEventListener("click",this._doOnClickByNode,false)}else{a.node.detachEvent("onclick",this._doOnClickByNode)}if(a.valueCont&&a.valueCont.tagName.toLowerCase()=="input"){if(typeof(window.addEventListener)=="function"){a.valueCont.removeEventListener("focus",this._doOnFocusByInput,false);a.valueCont.removeEventListener("blur",this._doOnBlurByInput,false)}else{a.valueCont.detachEvent("onfocus",this._doOnFocusByInput);a.valueCont.detachEvent("onblur",this._doOnBlurByInput)}}};dhtmlXColorPicker.prototype.show=function(c){var a=false;if(c!=undefined){this.activeNode=this.getNode(c)||this.activeNode}if(this.activeNode&&this.activeNode.valueCont&&this.activeNode.valueCont.value){this.setColor(this.activeNode.valueCont.value)}if(this.activeNode){a=(this.activeNode.conf.customColors!=null?this.activeNode.conf.customColors:this.conf.customColors);this.setColor(this.activeNode.conf.selectedColor)}else{a=this.conf.customColors}if(a){this.showMemory()}else{this.hideMemory()}if(this.base._dhx_remove){this.base.firstChild.style.zIndex=dhx4.zim.reserve(this.conf.cp_id);this.base.style.visibility="hidden";if(document.body.firstChild){document.body.insertBefore(this.base,document.body.firstChild)}else{document.body.appendChild(this.base)}this._refreshPosition();this.base.style.visibility="visible";if(typeof(window.addEventListener)=="function"){document.body.addEventListener("mousedown",this._doOnClickByBody,false)}else{document.body.attachEvent("onmousedown",this._doOnClickByBody)}}else{this.base.appendChild(this._globalNode)}if(this._controllerNodes.fr_cover){this.base.insertBefore(this._controllerNodes.fr_cover,this._globalNode)}this.callEvent("onShow",[((this.activeNode)?this.activeNode.node:null)])};dhtmlXColorPicker.prototype.setPosition=function(c,h){var g=null;var a=parseInt(c);var e=parseInt(h);if(isNaN(a)){g=({right:"right",bottom:"bottom"}[c.toLowerCase()]?c:null)}if(this.base._dhx_remove){if(g==null){}else{this.conf.position=g;this._refreshPosition(g)}}else{if(isNaN(a)||isNaN(e)){}else{this._globalNode.style.left=a+"px";this._globalNode.style.top=e+"px";if(this._controllerNodes.fr_cover){this._controllerNodes.fr_cover.style.left=this._globalNode.style.left;this._controllerNodes.fr_cover.style.top=this._globalNode.style.top}}}};dhtmlXColorPicker.prototype._initListenerInput=function(){var a=this;this._inputListenerId=this._inputListenerId||setInterval(function(){a._refreshValueByInput()},70)};dhtmlXColorPicker.prototype._removeListenerInput=function(){if(this._inputListenerId){clearInterval(this._inputListenerId);this._inputListenerId=null}};dhtmlXColorPicker.prototype._refreshValueByInput=function(){var c=this.activeNode.valueCont.value,a=this.getSelectedColor()[0];if(this._inputListenerId){if(/^#[\da-f]{6}$/i.test(c)&&c!=a){this.setColor(c);this.callEvent("onSelect",[c,this.activeNode.node])}}};dhtmlXColorPicker.prototype._refreshPosition=function(c){if(this.activeNode==null){return}var m=dhx4.absTop(this.activeNode.node);var a=dhx4.absLeft(this.activeNode.node);var g=dhx4.screenDim();var e=this._globalNode.offsetWidth;var h=this._globalNode.offsetHeight;var l=0;c=c||this.conf.position;switch(c){case"bottom":var l=m+this.activeNode.node.offsetHeight+this.conf.indent;var j=a;if(j+e>g.left+g.right){j=a+this.activeNode.node.offsetWidth-e}if(jg.top+g.bottom){l=m-h-this.conf.indent}if(l-g.top<0){l=g.top+this.conf.indent}this._globalNode.style.top=l+"px";this._globalNode.style.left=j+"px";break;default:var j=a+this.activeNode.node.offsetWidth+this.conf.indent;l=m;if(c=="right"){if(j+e>g.left+g.right){j=a-e-this.conf.indent}if(ja){this.conf.x=c.minX}else{if(a>c.maxX){this.conf.x=c.maxX}else{if(!isNaN(a)){this.conf.x=a}}}e=parseInt(e);if(c.minY>e){this.conf.y=c.minY}else{if(e>c.maxY){this.conf.y=c.maxY}else{if(!isNaN(e)){this.conf.y=e}}}this._refreshLines()};dhtmlXColorPicker.prototype._setColorByXYC=function(c){c=c||false;this.value.hue=Math.round((359*(this.conf.x-this.configColorArea.minX))/(this.configColorArea.maxX-this.configColorArea.minX));this.value.lum=Math.round(100-(100*(this.conf.y-this.configColorArea.minY))/(this.configColorArea.maxY-this.configColorArea.minY));this.value.sat=Math.round(100-(100*(this.conf.c-this.configColorArea.minY))/(this.configColorArea.maxY-this.configColorArea.minY));var a=this.colorAIP.hsl2rgb(this.value.hue,this.value.sat/100,this.value.lum/100);this.value.red=Math.round(255*a.r);this.value.green=Math.round(255*a.g);this.value.blue=Math.round(255*a.b);if(!c){this._refreshContrast()}this._refreshInputValues();this._refreshColorValue()};dhtmlXColorPicker.prototype._setContrastY=function(c){var a=this.configColorArea;c=parseInt(c);if(!isNaN(c)){this.conf.c=Math.min(Math.max(a.minY,c),a.maxY)}this._refreshContrastLine()};dhtmlXColorPicker.prototype._refreshInputValues=function(){this._controllerNodes.hue.value=this.value.hue;this._controllerNodes.sat.value=this.value.sat;this._controllerNodes.lum.value=this.value.lum;this._controllerNodes.red.value=this.value.red;this._controllerNodes.green.value=this.value.green;this._controllerNodes.blue.value=this.value.blue};dhtmlXColorPicker.prototype._refreshColorValue=function(){this._controllerNodes.color.style.backgroundColor="rgb("+[this.value.red,this.value.green,this.value.blue].join(", ")+")";var a=this.colorAIP.rgb2hex({r:this.value.red,g:this.value.green,b:this.value.blue});this._controllerNodes.hsv.value=a;this.callEvent("onChange",[a])};dhtmlXColorPicker.prototype._refreshContrast=function(){var g=this.colorAIP.hsl2rgb(this.value.hue,0,this.value.lum/100);var h=this.colorAIP.hsl2rgb(this.value.hue,1,this.value.lum/100);var e=this._checkIeVersion();if(e&&e<=9){var l=this._controllerNodes.contrastArea.firstChild;if(l==this._controllerNodes.contrast_line){l=document.createElement("div");l.className+="dhxcp_ie_gradient";this._controllerNodes.contrastArea.appendChild(l);this._controllerNodes.contrastArea.appendChild(this._controllerNodes.contrast_line)}var c=this.colorAIP.rgb2hex({r:Math.round(255*g.r),g:Math.round(255*g.g),b:Math.round(255*g.b)});var a=this.colorAIP.rgb2hex({r:Math.round(255*h.r),g:Math.round(255*h.g),b:Math.round(255*h.b)});l.style.filter="progid:DXImageTransform.Microsoft.gradient(startColorstr='"+a+"', endColorstr='"+c+"', GradientType=0)"}else{g=[Math.round(255*g.r),Math.round(255*g.g),Math.round(255*g.b)];h=[Math.round(255*h.r),Math.round(255*h.g),Math.round(255*h.b)];var j="linear-gradient(rgb("+h.join(",")+"), rgb("+g.join(",")+"))";if(window.dhx4.isKHTML==true&&navigator.userAgent.match(/Windows/gi)!=null){j="-webkit-"+j}this._controllerNodes.contrastArea.style.backgroundImage=j}};dhtmlXColorPicker.prototype._refreshLines=function(){this._controllerNodes.v_line.style.left=this.conf.x+"px";this._controllerNodes.h_line.style.top=this.conf.y+"px"};dhtmlXColorPicker.prototype._refreshContrastLine=function(){this._controllerNodes.contrast_line.style.top=this.conf.c+"px"};dhtmlXColorPicker.prototype._getOffsetPosition=function(h,a){var c={x:NaN,y:NaN},g=h.target||h.srcElement;if(g==a){c.x=(h.offsetX!=undefined)?h.offsetX:h.layerX;c.y=(h.offsetY!=undefined)?h.offsetY:h.layerY}else{if(g==this._controllerNodes.v_line){c.y=(h.offsetY!=undefined)?h.offsetY:h.layerY}else{c.x=(h.offsetX!=undefined)?h.offsetX:h.layerX}}return c};dhtmlXColorPicker.prototype.colorAIP={hex2rgb:function(c){var a=c.match(/^(#)([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);if(a!=null){return{r:parseInt("0x"+a[2]),g:parseInt("0x"+a[3]),b:parseInt("0x"+a[4])}}else{return null}},rgb2hex:function(h){var e=parseInt(h.r),c=parseInt(h.g),a=parseInt(h.b);e=e||0,c=c||0,a=a||0;return"#"+((e)?((e<16)?"0"+e.toString(16):e.toString(16)):"00")+((c)?((c<16)?"0"+c.toString(16):c.toString(16)):"00")+((a)?((a<16)?"0"+a.toString(16):a.toString(16)):"00")},rgb2hsl:function(n,m,e){var l,j,c;var a=Math.max(n,m,e),h=Math.min(n,m,e);c=0.5*(a+h);if(a==h){l=0}else{if(a==n){l=60*(m-e)/(a-h);if(m1){c[g]-=1}}if(c[g]<1/6){a.push(j+(h-j)*6*c[g])}else{if(c[g]<0.5){a.push(h)}else{if(c[g]<2/3){a.push(j+(h-j)*(2/3-c[g])*6)}else{a.push(j)}}}}return{r:a[0],g:a[1],b:a[2]}}};dhtmlXColorPicker.prototype._checkIeVersion=function(){var a;var c=navigator.userAgent.match(/(MSIE)\s(\d\.\d)/i);a=(c&&c[2])?parseInt(c[2]):null;return a};dhtmlXColorPicker.prototype.setCustomColors=function(){if(this.memory==null){this.initMemoryColors();this.conf.customColors=true}var g,e,j,c,h,a;e=arguments.length;for(g=0;g=0;e--){if(a[e]==g){h=e;break}}return h};dhtmlXColorPicker.prototype.destructMemory=function(){if(this.memory==null){return}this.hideMemory();var a=this._controllerNodes.memory_block.childNodes[0].firstChild;this._labelNodes.btnAddColor=null;if(typeof(window.addEventListener)=="function"){a.removeEventListener("click",this.saveColor,false)}else{a.detachEvent("onclick",this.saveColor)}this.memory.remove();this._controllerNodes.memory_block.innerHTML="";this.memory=null};dhtmlXColorPicker.prototype.Memory=function(e){var c=this,a=null,g={red:255,blue:255,green:255,hue:0,sat:0,lum:100};this.select=function(){var j=(this!=window)?this:event.srcElement;var h=h||j.dhxpc_memory;if(a!=null){c.unSelect()}a=h;h.domElement.className+=" dhxcp_memory_el_select";if(typeof(c.onSelect)=="function"){c.onSelect(h)}};this.onSelect=null;this.onSave=null;this._createMemoryController=function(h){var j={domElement:h,value:dhx4._copyObj(g)};h.dhxpc_memory=j;if(typeof(window.addEventListener)=="function"){h.addEventListener("click",c.select,false)}else{h.attachEvent("onclick",c.select)}return j};this._findMemoryControllers=function(o){var m=o.getElementsByTagName("a"),j,h,n=[];h=m.length;for(j=0;j1){return new dhtmlXSlider(this._renderArgumets(arguments))}else{if(typeof(c)=="string"||(typeof(c)=="object"&&c.tagName)){return new dhtmlXSlider({parent:c})}}if(typeof(c.parent)=="string"){this.base=document.getElementById(c.parent)}else{this.base=c.parent}this._mergeConfig(this._readAttFormNode(this.base));this._mergeConfig(c);if(this.conf.bg==null){this.conf.bg=(this.conf.range==true)}if(this.conf.range==true){if(!(this.conf.value instanceof Array)){this.conf.value=[this.conf.value]}if(this.conf.value.length<2){this.conf.value.push(this.conf.value[0])}if(!(this.conf.linkTo instanceof Array)){this.conf.linkTo=[this.conf.linkTo]}}this._detectDecimals();if(this.conf.size==null||typeof(this.conf.size)=="undefined"){if(this.conf.vertical){this.conf.size=this.base.offsetHeight}else{this.conf.size=this.base.offsetWidth}}var e=this.conf.skin||window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxslider")||"dhx_skyblue";this.setSkin(e);this.base.innerHTML="
"+(this.conf.bg==true?"
":"")+"
"+(this.conf.range==true?"
":"")+"
";this._nodes={cont:this.base.firstChild,track:this.base.firstChild.firstChild,runner:this.base.firstChild.childNodes[1],runner2:this.base.firstChild.childNodes[2]};this._nodes.cont.onmousedown=this._nodes.track.onmousedown=this._nodes.cont.onselectstart=this._nodes.track.onselectstart=function(g){g=g||event;if(typeof(g.preventDefault)=="function"){g.preventDefault()}else{g.returnValue=false}return false};this._r_actv=null;if(this.conf.range==true){this.conf.value=this._normalizeRange(this.conf.value,this.conf.min,this.conf.max)}else{this.conf.value=this._normalize(this.conf.value,this.conf.min,this.conf.max)}this._setOrient(this.conf.vertical);this.setSize(this.conf.size);this._initMover=function(j,g){if(a.conf.disabled){return}j=j||event;if(typeof(j.preventDefault)=="function"){j.preventDefault()}if(g!=null){a._r_actv=a._nodes[g==0?"runner":"runner2"]}else{a._r_actv=j.target||j.srcElement;if(a._r_actv.className.indexOf("dhxsl_runner")==-1){a._r_actv=a._nodes.runner}}a._r_actv.className="dhxsl_runner dhxsl_runner_actv";var h=(j.type=="mousedown"?"client":"page")+(a.conf.vertical?"Y":"X");a._movingInitialValues={};if(a.conf.range==true){a._movingInitialValues.index=(a._r_actv==a._nodes.runner?0:1);a._movingInitialValues.value=a.conf.value[a._movingInitialValues.index]}else{a._movingInitialValues.value=a.conf.value}a._movingInitialValues.coord=(typeof(j[h])!="undefined"&&j[h]!=0?j[h]:(j.touches!=null&&j.touches[0]!=null?j.touches[0][h]||0:0));if(a.conf.disabled==false){if(typeof(window.addEventListener)=="function"){window.addEventListener("mousemove",a._move,false);window.addEventListener("mouseup",a._cleanMove,false);window.addEventListener("touchmove",a._move,false);window.addEventListener("touchend",a._cleanMove,false)}else{document.body.attachEvent("onmousemove",a._move);document.body.attachEvent("onmouseup",a._cleanMove)}}a.callEvent("onMouseDown",[a._r_actv==a._nodes.runner?0:1]);return false};this._move=function(o){if(a.conf.disabled){return}o=o||event;if(typeof(o.preventDefault)=="function"){o.preventDefault()}var m=(o.type=="mousemove"?"client":"page")+(a.conf.vertical?"Y":"X");var n=(a.conf.vertical)?a._r_actv.offsetHeight:a._r_actv.offsetWidth;var j=a.conf.max-a.conf.min;var h=(typeof(o[m])!="undefined"&&o[m]!=0?o[m]:(o.touches!=null&&o.touches[0]!=null?o.touches[0][m]||0:0));var l=a._movingInitialValues.value+(h-a._movingInitialValues.coord)*j/(a.conf.size-n)*(a.conf.inverse?-1:1);if(a.conf.range==true){var g=[a.conf.value[0],a.conf.value[1]];if(a._movingInitialValues.index==0){g[0]=Math.min(g[1],l)}else{if(a._movingInitialValues.index==1){g[1]=Math.max(g[0],l)}}a.setValue(g,true)}else{a.setValue(l,true)}};this._cleanMove=function(g){if(typeof(window.addEventListener)=="function"){window.removeEventListener("mousemove",a._move,false);window.removeEventListener("mouseup",a._cleanMove,false);window.removeEventListener("touchmove",a._move,false);window.removeEventListener("touchend",a._cleanMove,false)}else{document.body.detachEvent("onmousemove",a._move);document.body.detachEvent("onmouseup",a._cleanMove)}a._movingInitialValues=null;a._r_actv.className=a._r_actv.className.replace(/\s{0,}dhxsl_runner_actv/gi,"");a.callEvent("onSlideEnd",[a.conf.value]);a.callEvent("onMouseUp",[a._r_actv==a._nodes.runner?0:1]);a._r_actv=null};this._doOnSetValue=function(r){if(a.conf.disabled){return}if(a._movingInitialValues!=null){return false}r=r||event;if(typeof(r.preventDefault)=="function"){r.preventDefault()}var o=0;var l=r.target||r.srcElement;if(l.className.match(/dhxsl_track_bg/)!=null){o=parseInt(l.style[a.conf.vertical?"top":"left"])}var n=(a.conf.vertical?(r.offsetY||r.layerY):(r.offsetX||r.layerX))+o;var m=(a.conf.vertical?a._nodes.runner.offsetHeight:a._nodes.runner.offsetWidth)+o;var g=a.conf.max-a.conf.min;var h=null;var j=null;if(a.conf.inverse==true){j=a.conf.max-(n*g/(a.conf.size))}else{j=(n*g/(a.conf.size)+a.conf.min)}if(a.conf.range==true){h=(Math.abs(a.conf.value[0]-j)<=Math.abs(a.conf.value[1]-j)?0:1);j=[h==0?j:a.conf.value[0],h==1?j:a.conf.value[1]]}a.conf.init_index=h;a.setValue(j,true);a.conf.init_index=null;if(a._movingInitialValues==null){a._initMover(r,h)}return false};this._doOnChangeInput=function(h){h=h||event;var g=h.target||h.srcElement;a.setValue(g.value)};this._doOnKeyDown=function(h){h=h||event;var g=h.target||h.srcElement;if(h.keyCode==13){a.setValue(g.value)}};this._attachEvents(this._nodes);this.unload=function(){dhx4._eventable(this,"clear");this._detachNode();this._detachEvents(this._nodes);this.base.removeChild(this._nodes.cont);this._nodes.cont.onmousedown=this._nodes.track.onmousedown=this._nodes.cont.onselectstart=this._nodes.track.onselectstart=null;delete this._nodes.cont;delete this._nodes.track;delete this._nodes.max;delete this._nodes.min;delete this._nodes.runner;if(this._nodes.runner2){delete this._nodes.runner2}if(/\s?dhtmlxslider_\S*/.test(this.base.className)){this.base.className=this.base.className.replace(/\s?dhtmlxslider_\S*/,"")}for(var g in this){this[g]=null}a=null};dhx4._eventable(this);if(this.conf.disabled){this.disable()}if(this.conf.tooltip){this.enableTooltip()}if(!this.conf.visible){this.hide()}if(this.conf.linkTo){this.linkTo(this.conf.linkTo)}return this}dhtmlXSlider.prototype._setOrient=function(a){a=a||false;if(/\s?dhxsl_cont_hr/i.test(this._nodes.cont.className)){this._nodes.cont.className=this._nodes.cont.className.replace(/\s?dhxsl_cont_hr/i,"")}if(/\s?dhxsl_cont_vr/i.test(this._nodes.cont.className)){this._nodes.cont.className=this._nodes.cont.className.replace(/\s?dhxsl_cont_vr/i,"")}if(a){this._nodes.cont.className+=" dhxsl_cont_vr"}else{this._nodes.cont.className+=" dhxsl_cont_hr"}};dhtmlXSlider.prototype._attachEvents=function(a){if(typeof(window.addEventListener)=="function"){a.runner.addEventListener("mousedown",this._initMover,false);a.runner.addEventListener("touchstart",this._initMover,false);a.cont.addEventListener("mousedown",this._doOnSetValue,false);a.cont.addEventListener("touchstart",this._doOnSetValue,false);if(a.runner2){a.runner2.addEventListener("mousedown",this._initMover,false);a.runner2.addEventListener("touchstart",this._initMover,false)}}else{a.runner.attachEvent("onmousedown",this._initMover);a.cont.attachEvent("onmousedown",this._doOnSetValue);if(a.runner2){a.runner2.attachEvent("onmousedown",this._initMover)}}};dhtmlXSlider.prototype._detachEvents=function(a){if(typeof(window.addEventListener)=="function"){a.runner.removeEventListener("mousedown",this._initMover,false);a.runner.removeEventListener("touchstart",this._initMover,false);a.cont.removeEventListener("mousedown",this._doOnSetValue,false);a.cont.removeEventListener("touchstart",this._doOnSetValue,false);if(a.runner2){a.runner2.removeEventListener("mousedown",this._initMover,false);a.runner2.removeEventListener("touchstart",this._initMover,false)}}else{a.runner.detachEvent("onmousedown",this._initMover);a.cont.detachEvent("onmousedown",this._doOnSetValue);if(a.runner2){a.runner2.detachEvent("onmousedown",this._initMover)}}};dhtmlXSlider.prototype._mergeConfig=function(c){for(var a in c){switch(a.toLowerCase()){case"min":case"max":case"size":case"step":case"value":case"inverse":this.conf[a]=c[a];break;case"tooltip":case"visible":case"vertical":case"disabled":case"range":case"bg":this.conf[a]=dhx4.s2b(c[a]);break;case"bg_mode":this.conf[a]=({left:"left",right:"right"}[c[a]])||"left";break;case"parent":continue;break;default:this.conf[a]=c[a]}}};dhtmlXSlider.prototype._readAttFormNode=function(g){var j=g.attributes,a=j.length,e,h={},c;for(e=0;e=0;e--){if(a[e]==g){h=e;break}}return h};dhtmlXSlider.prototype._refreshRunner=function(h){var g=(this.conf.vertical==true?{x:"top",y:"left",ofs_w:"offsetHeight",ofs_h:"offsetWidth"}:{x:"left",y:"top",ofs_w:"offsetWidth",ofs_h:"offsetHeight"});var a=this._nodes.cont[g.ofs_w]-this._nodes.runner[g.ofs_w];var e=this._nodes.runner;var c=this._nodes.runner2;if(h==null||h==0){var j=this._getCoord(a,(this.conf.value instanceof Array?this.conf.value[0]:this.conf.value));e.style[g.x]=j+this.conf.border+"px";e.style[g.y]=Math.round((this._nodes.cont[g.ofs_h]-e[g.ofs_h])/2)+"px"}if(this.conf.range==true&&(h==null||h==1)){var j=this._getCoord(a,this.conf.value[1]);c.style[g.x]=j+this.conf.border+"px";c.style[g.y]=Math.round((this._nodes.cont[g.ofs_h]-e[g.ofs_h])/2)+"px"}if(this.conf.range==true){if(e.style[g.x]==c.style[g.x]&&this.conf.value[1]==this.conf.max){if(e.style.zIndex!=2){e.style.zIndex=2}}else{if(e.style.zIndex==2){e.style.zIndex=1}}}e=c=null;this._refreshBG()};dhtmlXSlider.prototype._setValueByCoord=function(g){var a=dhx4.absLeft(this._nodes.cont),h=dhx4.absTop(this._nodes.cont),e,c;if(this.conf.vertical){c=(g.y-h-this._nodes.runner.offsetHeight/2)/(this._nodes.cont.offsetHeight-this._nodes.runner.offsetHeight)}else{c=(g.x-a-this._nodes.runner.offsetWidth/2)/(this._nodes.cont.offsetWidth-this._nodes.runner.offsetWidth)}e=(this.conf.max-this.conf.min)*c+this.conf.min;this.setValue(e,true)};dhtmlXSlider.prototype._getCoord=function(a,g){var e=(this.conf.inverse?this._inverseValue(g):g);var c=(e-this.conf.min)/(this.conf.max-this.conf.min);return Math.round(a*c)};dhtmlXSlider.prototype._normalize=function(g,e,a){g=Number(g);g=Math.round(g/this.conf.step)*this.conf.step;var c=Math.pow(10,this.conf.decimals);g=Math.round(g*c)/c;g=Math.max(e,Math.min(a,g));return g};dhtmlXSlider.prototype._normalizeRange=function(e,c,a){if(e[1]0){var c=g.match(/\.\d{1,}$/);if(c!=null){a=Math.max(a-c[0].length+1)}g+=(g.indexOf(".")<0?".":"");for(var e=0;ea){this.conf.min=a;this.setValue(this.conf.value)}};dhtmlXSlider.prototype.getMin=function(){return this.conf.min};dhtmlXSlider.prototype.setStep=function(a){var c=this.conf.max-this.conf.min;if(!isNaN(a)&&a
";document.body.appendChild(this.p);this.p.oncontextmenu=function(a){if(g.conf.context==false){a=a||event;a.returnValue=false;return false}};this.skinParams={dhx_terrace:{t0:19,t1:9,t2:19,t3:9},dhx_skyblue:{t0:12,t1:9,t2:12,t3:9},dhx_web:{t0:12,t1:9,t2:12,t3:9}};this.p.ontouchstart=this.p.onclick=function(j){j=j||event;var h=(g.conf.last_p_click!=null&&g.conf.last_p_click!=j.type);g.conf.last_p_click=j.type;if(h==true){return}g._clearClick=true;if(g._nodeObj!=null){g.callEvent("onContentClick",[]);return true}var a=(j.target||j.srcElement);var l=null;while(a!=g.p&&a!=null){if(typeof(a._idd)!="undefined"&&!a._isSeparator){l=a._idd;a=null}else{a=a.parentNode}}a=null;if(l!=null){g.callEvent("onClick",[l]);if(g!=null&&g.isVisible!=null&&g.isVisible()&&g.callEvent("onBeforeHide",["select",j,l])===true){j.cancelBubble=true;g.hide()}}};this.separator="DHXSEP_"+window.dhx4.newId();this.tpl=[];this._setTemplate=function(a){this.tpl=a.split(",")};this.show=function(h){var a=null;if(arguments.length==1){if(!h){h=this.conf.id[0]}else{if(!this._idExists(h)){return}}if(this.conf.toolbar){a=this.conf.toolbar._getItemDim(h)}if(this.conf.ribbon){a=this.conf.ribbon._getItemDim(h)}if(this.conf.form){a=this.conf.form._getItemDim(h)}}else{if(arguments.length==4){this._clearClick=true;a={left:arguments[0],top:arguments[1],width:arguments[2],height:arguments[3]};h=null}}if(!a){return}this.p.style.visibility="hidden";this.p.style.display="";this._setPos(a);this.p.style.zIndex=window.dhx4.zim.reserve(this.conf.zi);this.p.style.visibility="visible";this._lastId=h;this.callEvent("onShow",[h])};this._setPos=function(I,m){var v=I.left;var s=I.top;var C=I.width;var L=I.height;this._posData={left:v,top:s,width:C,height:L};var N=window.dhx4.screenDim();var F=m||this.mode;if(typeof(m)=="undefined"){m=false}var P={top:(s-this.p.offsetHeight)-N.top,bottom:N.bottom-(s+L+this.p.offsetHeight),left:v-this.p.offsetWidth-N.left,right:N.right-(v+C+this.p.offsetWidth)};if(!m&&P[F]<0){var J=this._getAvailPos(F,P);if(J!==false){this._setPos(I,J);return}}if(F=="top"||F=="bottom"){var D=this.skinParams[this.conf.skin].t2;var A=this.skinParams[this.conf.skin].t3;var r=Math.round(this.p.offsetWidth/2);var a=Math.round(this.p.lastChild.offsetWidth/2);if(vN.right){C=N.right-v}var u=Math.round(v+C/2);var l=u-r;var K=u-D-a;var o=u+a+D-this.p.offsetWidth;if(lN.right+A){l=Math.max(o,N.right+A-this.p.offsetWidth)}}this.p.style.left=l+"px";this.p.style.top=(F=="top"?s-this.p.offsetHeight:s+L)+"px";u=u-l-a;this.p.lastChild.className="dhx_popup_arrow dhx_popup_arrow_"+F;this.p.lastChild.style.top=(F=="top"?this.p.offsetHeight-this.p.lastChild.offsetHeight:0)+"px";this.p.lastChild.style.left=u+"px"}if(F=="left"||F=="right"){var D=this.skinParams[this.conf.skin].t0;var A=this.skinParams[this.conf.skin].t1;var n=Math.round(this.p.offsetHeight/2);var S=Math.round(this.p.lastChild.offsetHeight/2);if(sN.bottom){L=N.bottom-s}var u=Math.round(s+L/2);var H=u-n;var Q=u-D-S;var O=u+S+D-this.p.offsetHeight;if(HN.bottom+A){H=Math.max(O,N.bottom+A-this.p.offsetHeight)}}this.p.style.left=(F=="left"?v-this.p.offsetWidth:v+C)+"px";this.p.style.top=H+"px";u=u-H-S;this.p.lastChild.className="dhx_popup_arrow dhx_popup_arrow_"+F;this.p.lastChild.style.left=(F=="left"?this.p.offsetWidth-this.p.lastChild.offsetWidth:0)+"px";this.p.lastChild.style.top=u+"px"}if(this._IEDisp&&this._nodeId!=null){var E=document.getElementById(this._nodeId);if(this.conf.IE6_display_fix==true){E.style.visibility="hidden"}window.setTimeout(function(){E.style.visibility="visible";E=null},1)}};this._getAvailPos=function(o,n){var j={top:["bottom","right","left"],bottom:["top","right","left"],left:["right","bottom","top"],right:["left","bottom","top"]};var l=null;for(var m=0;m0){l=j[o][m]}}if(l==null){l="bottom";for(var h in n){if(n[h]>n[l]){l=h}}}if(l==o){return false}return l};this._repaint=function(){if(this.isVisible()){this._setPos(this._posData)}};this.clear=function(){if(this._nodeObj){if(window.dhx4.isIE&&typeof(window.dhtmlXLayoutObject)!="undefined"&&this._nodeObj instanceof dhtmlXLayoutObject){this.p.onmousedown=null}if(this._nodeObj.unload){this._nodeObj.unload()}else{if(this._nodeObj.destruct){this._nodeObj.destruct()}}this._nodeObj=this._nodeId=null;if(this._nodeObjEv!=null){for(var h=0;h0){a.removeChild(a.lastChild)}a=null;this.itemData={}};this.hide=function(){if(this.p.style.display!="none"){this.p.style.display="none";window.dhx4.zim.clear(this.conf.zi);var a=this._lastId;this._lastId=null;this.callEvent("onHide",[a]);this.conf.last_p_click=this.conf.last_body_click=null}};this.isVisible=function(){return(this.p.style.display=="")};this.itemData={};this.getItemData=function(a){if(!a){return this.itemData}if(this.itemData[a]){return this.itemData[a]}return{}};this.setSkin=function(a){this.conf.skin=a;this.p.className="dhx_popup_"+this.conf.skin;if(this._nodeObj!=null&&typeof(this._nodeObj.setSkin)=="function"){this._nodeObj.setSkin(this.conf.skin)}this._repaint()};this.attachList=function(j,o){this._setTemplate(j);this.clear();var l=this.p.firstChild.firstChild.firstChild;for(var n=0;n ";m.appendChild(s);s=null}else{for(var a=0;a";if(j.width){m.firstChild.style.width=j.width+"px"}if(j.height){m.firstChild.style.height=j.height+"px"}h.appendChild(m);m=h=a=null;if(typeof(this["_attach_init_"+l])=="function"){this["_attach_init_"+l](j);this._enableIEVFix()}this._repaint();return this._nodeObj};this.unload=function(){if(typeof(window.addEventListener)=="function"){window.removeEventListener("touchstart",this._doOnClick,false);window.removeEventListener("click",this._doOnClick,false);window.removeEventListener("keyup",this._doOnKeyUp,false);window.removeEventListener("unload",this._doOnUnload,false)}else{document.body.detachEvent("onclick",this._doOnClick,false);document.body.detachEvent("onkeyup",this._doOnKeyUp,false);document.body.detachEvent("onunload",this._doOnUnload,false)}window.dhx4.detachEvent(this.conf.ev_grid_click);this.clear();if(this.conf.toolbarEvent!=null&&this.conf.toolbar!=null){if(this.conf.toolbar.detachEvent!=null){this.conf.toolbar.detachEvent(this.conf.toolbarEvent)}else{this.conf.toolbar._getItemDim=null}}if(this.conf.ribbonEvent!=null&&this.conf.ribbon!=null){if(this.conf.ribbon.detachEvent!=null){this.conf.ribbon.detachEvent(this.conf.ribbonEvent)}else{this.conf.ribbon._getItemDim=null}}if(this.conf.slider!=null){for(var j=0;j=0){if(s.parentNode!=null&&s.parentNode.parentNode!=null&&s.parentNode.parentNode._idd!=null){j=s.parentNode.parentNode._idd;if(s.parentNode.parentNode._type=="ra"){j=[s.parentNode.parentNode._group,s.parentNode.parentNode._value]}}}else{var m=true;var n=false;while(m&&!n){var l=(s.className||"").toLowerCase();if(l.length>0){n=(l=="dhxform_btn"||l.search(/dhxeditor_inside/gi)>=0||l=="dhxcombo_input"||l.search(/dhxcombolist/gi)>=0)}s=s.parentNode;m=(s!=null)}if(n){return}}s=null;if(j!=null&&g._idExists(j)){return}}if(typeof(window.dhtmlXForm)!="undefined"&&g._nodeObj instanceof window.dhtmlXForm){var u={};var l=0;var h=g._nodeObj;h.forEachItem(function(r){if(h.getItemType(r)=="combo"){u[h.getCombo(r).list._listId]=true;l++}});h=null;if(l>0){var s=(o.target||o.srcElement);var m=true;var n=false;while(m==true&&n!=true){var l=(s.className||"").toLowerCase();if(l.length>0&&l.search(/^dhxcombolist/gi)>=0&&s._listId!=null&&u[s._listId]==true){n=true;s=null}else{s=s.parentNode;m=(s!=null)}}if(n==true){return}}}if(g.isVisible()&&g.callEvent("onBeforeHide",["click",o])===true){g.hide()}};this._doOnKeyUp=function(a){a=a||event;if(a.keyCode==27){if(g.isVisible()&&g.callEvent("onBeforeHide",["esc",a])===true){g.hide()}}};this._doOnUnload=function(){g.unload()};if(typeof(window.addEventListener)=="function"){window.addEventListener("touchstart",this._doOnClick,false);window.addEventListener("click",this._doOnClick,false);window.addEventListener("keyup",this._doOnKeyUp,false);window.addEventListener("unload",this._doOnUnload,false)}else{document.body.attachEvent("onclick",this._doOnClick,false);document.body.attachEvent("onkeyup",this._doOnKeyUp,false);document.body.attachEvent("onunload",this._doOnUnload,false)}this.conf.ev_grid_click=window.dhx4.attachEvent("_onGridClick",function(h,a){if(g._nodeObj!=null&&g._nodeObj==a){return}g._clearClick=false;g._doOnClick(h)});this._idExists=function(j){var a=false;for(var h=0;h=0){this._lastIEHover.className=this._lastIEHover.className.replace(/\s{0,}tr_hover/gi,"");this._lastIEHover=null}}if(a!=null&&a.className.search(/tr_hover/gi)<0){a.className+=" tr_hover";g._lastIEHover=a}};this._IEHoverInited=true};this._IEHoverClear=function(){this.p.onmouseover=null;this.p.onmouseout=null;this._IEHoverInited=false}}this._IEFirstLast=(window.dhx4.isIE6||window.dhx4.isIE7||window.dhx4.isIE8);this._enableIEVFix=function(){if(window.dhx4.isIE6||window.dhx4.isIE7){var h=this.attachEvent("onHide",function(){document.getElementById(this._nodeId).style.visibility="hidden"});var a=this.attachEvent("onShow",function(){document.getElementById(this._nodeId).style.visibility="visible"});if(this._nodeObjEv==null){this._nodeObjEv=[]}this._nodeObjEv.push(h,a)}};if(typeof(window.dhtmlXToolbarObject)!="undefined"&&this.conf.toolbar!=null&&this.conf.toolbar instanceof window.dhtmlXToolbarObject&&this.conf.id!=null){if(!(this.conf.id instanceof Array)){this.conf.id=[this.conf.id]}this.skinParent=this.conf.toolbar.conf.skin;this._doOnToolbarClick=function(h){for(var a=0;a=0&&document.compatMode=="BackCompat"),live_id:window.dhx4.newId(),tags:{root:"menu",item:"item",text_ext:"itemtext",userdata:"userdata",tooltip:"tooltip",hotkey:"hotkey",href:"href"},autoload:{},hide_tm:{},top_mode:true,top_tmtime:200,v_enabled:false,v:{x1:null,x2:null,y1:null,y2:null},dir_toplv:"bottom",dir_sublv:"right",auto_overflow:false,overflow_limit:0,of_utm:null,of_utime:20,of_ustep:3,of_dtm:null,of_dtime:20,of_dstep:3,of_ah:{dhx_skyblue:24,dhx_web:25,dhx_terrace:27},of_ih:{dhx_skyblue:24,dhx_web:24,dhx_terrace:24},tm_sec:400,tm_handler:null,dload:false,dload_url:"",dload_icon:false,dload_params:{action:"loadMenu"},dload_pid:"parentId",tl_botmarg:1,tl_rmarg:0,tl_ofsleft:1,context:false,ctx_zoneid:false,ctx_autoshow:true,ctx_autohide:true,ctx_hideall:true,ctx_zones:{},ctx_baseid:null,selected_sub:[],opened_poly:[]};if(typeof(h)=="object"&&h!=null&&typeof(h.tagName)=="undefined"){if(h.icons_path!=null||h.icon_path!=null){this.conf.icons_path=(h.icons_path||h.icon_path)}if(h.skin!=null){this.conf.skin=h.skin}if(h.visible_area){this.conf.v_enabled=true;this.conf.v={x1:h.visible_area.x1,x2:h.visible_area.x2,y1:h.visible_area.y1,y2:h.visible_area.y2}}for(var e in {json:1,xml:1,items:1,top_text:1,align:1,open_mode:1,overflow:1,dynamic:1,dynamic_icon:1,context:1,onload:1,onclick:1,oncheckboxclick:1,onradioclick:1}){if(h[e]!=null){this.conf.autoload[e]=h[e]}}h=h.parent}if(h==null){this.base=document.body}else{var c=(typeof(h)=="string"?document.getElementById(h):h);if(c!=null){this.base=c;if(!this.base.id){this.base.id="menuBaseId_"+new Date().getTime()}this.base.className+=" dhtmlxMenu_"+this.conf.skin+"_Middle dir_left";this.base._autoSkinUpdate=true;if(this.base.oncontextmenu){this.base._oldContextMenuHandler=this.base.oncontextmenu}this.conf.ctx_baseid=this.base.id;this.base.onselectstart=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false};this.base.oncontextmenu=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false}}else{this.base=document.body}}this.idPrefix="";this.topId="dhxWebMenuTopId";this.idPull={};this.itemPull={};this.userData={};this.radio={};this.setSkin=function(m){var n=this.conf.skin;this.conf.skin=m;switch(this.conf.skin){case"dhx_skyblue":case"dhx_web":this.conf.tl_botmarg=2;this.conf.tl_rmarg=1;this.conf.tl_ofsleft=1;break;case"dhx_terrace":this.conf.tl_botmarg=0;this.conf.tl_rmarg=0;this.conf.tl_ofsleft=0;break}if(this.base._autoSkinUpdate){this.base.className=this.base.className.replace("dhtmlxMenu_"+n+"_Middle","")+" dhtmlxMenu_"+this.conf.skin+"_Middle"}for(var l in this.idPull){this.idPull[l].className=String(this.idPull[l].className).replace(n,this.conf.skin)}};this.setSkin(this.conf.skin);this._addSubItemToSelected=function(m,l){var a=true;for(var n=0;nthis.conf.v.y2-this.conf.v.y1){var C=Math.max(Math.floor((this.conf.v.y2-this.conf.v.y1-this.conf.of_ah[this.conf.skin]*2)/this.conf.of_ih[this.conf.skin]),1);this.conf.overflow_limit=C}else{this.conf.overflow_limit=0;if(this.idPull["arrowup_"+H]!=null){this._removeUpArrow(String(H).replace(this.idPrefix,""))}if(this.idPull["arrowdown_"+H]!=null){this._removeDownArrow(String(H).replace(this.idPrefix,""))}}}if(this.conf.overflow_limit>0&&this.conf.overflow_limit0&&this.conf.overflow_limitF&&!this.conf.rtl){u=a-A+2}if(uE&&this.conf.v.y2!=null){s=Math.max(N+n-K+2,(this.conf.v_enabled?this.conf.v.y1+2:2));if(this.conf.context&&this.idPrefix+this.topId==H&&D!=null){s=s-2}if(this.itemPull[H]!=null&&!this.conf.context){if(this.itemPull[H]["parent"]==this.idPrefix+this.topId){s=s-this.base.offsetHeight}}}this.idPull[I].style.left=u+"px";this.idPull[I].style.top=s+"px";if(typeof(this._menuEffect)!="undefined"&&this._menuEffect!==false){this._showPolygonEffect(I)}else{this.idPull[I].style.visibility="";if(this.conf.overflow_limit>0&&this.conf.overflow_limit0){this.conf.opened_poly.pop()}var a=this._getSubItemToDeselectByPolygon(n);this._removeSubItemFromSelected(-1,-1);for(var l=0;l0){a=l}}}return a};this._getMenuNodes=function(o){var l=new Array;for(var n in this.itemPull){if(this.itemPull[n]["parent"]==o){l[l.length]=n}}return l};this._genStr=function(a){var l="dhxId_";var n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var m=0;m0){g.conf.opened_poly.pop()}for(var a=0;a0)&&(!this.itemPull[c]["complex"])){this._updateItemComplexState(c,true,false)}if((a==0)&&(this.itemPull[c]["complex"])){this._updateItemComplexState(c,false,false)}}};dhtmlXMenuObject.prototype._updateItemComplexState=function(h,e,g){if((!this.conf.context)&&(this._getItemLevelType(h.replace(this.idPrefix,""))=="TopLevel")){this.itemPull[h]["complex"]=e;return}if((this.idPull[h]==null)||(this.itemPull[h]==null)){return}this.itemPull[h]["complex"]=e;if(h==this.idPrefix+this.topId){return}var a=null;var c=this.idPull[h].childNodes[this.conf.rtl?0:2];if(c.childNodes[0]){if(String(c.childNodes[0].className).search("complex_arrow")===0){a=c.childNodes[0]}}if(this.itemPull[h]["complex"]){if(a==null){a=document.createElement("DIV");a.className="complex_arrow";a.id="arrow_"+h;while(c.childNodes.length>0){c.removeChild(c.childNodes[0])}c.appendChild(a)}if(this.conf.dload&&(this.itemPull[h].loaded=="get")&&this.conf.dload_icon){if(a.className!="complex_arrow_loading"){a.className="complex_arrow_loading"}}else{a.className="complex_arrow"}return}if((!this.itemPull[h]["complex"])&&(a!=null)){c.removeChild(a);if(this.itemPull[h]["hotkey_backup"]!=null&&this.setHotKey){this.setHotKey(h.replace(this.idPrefix,""),this.itemPull[h]["hotkey_backup"])}}};dhtmlXMenuObject.prototype._getItemLevelType=function(a){return(this.itemPull[this.idPrefix+a]["parent"]==this.idPrefix+this.topId?"TopLevel":"SubLevelArea")};dhtmlXMenuObject.prototype.setIconsPath=function(a){this.conf.icons_path=a};dhtmlXMenuObject.prototype._updateItemImage=function(g,h){g=this.idPrefix+g;var n=this.itemPull[g]["type"];if(n=="checkbox"||n=="radio"){return}var j=(this.itemPull[g]["parent"]==this.idPrefix+this.topId&&!this.conf.context);var l=null;if(j){for(var a=0;a0){if(l!=null){l.src=this.conf.icons_path+r}else{if(j){var l=document.createElement("IMG");l.className="dhtmlxMenu_TopLevel_Item_Icon";l.src=this.conf.icons_path+r;l.border="0";l.id="image_"+g;if(!this.conf.rtl&&this.idPull[g].childNodes.length>0){this.idPull[g].insertBefore(l,this.idPull[g].childNodes[0])}else{this.idPull[g].appendChild(l)}}else{var l=document.createElement("IMG");l.className="sub_icon";l.src=this.conf.icons_path+r;l.border="0";l.id="image_"+g;var o=this.idPull[g].childNodes[this.conf.rtl?2:0];while(o.childNodes.length>0){o.removeChild(o.childNodes[0])}o.appendChild(l)}}}else{if(l!=null){var c=l.parentNode;c.removeChild(l);c.innerHTML=" ";c=l=null}}};dhtmlXMenuObject.prototype._getAllParents=function(j){var e=new Array();for(var c in this.itemPull){if(this.itemPull[c]["parent"]==j){e[e.length]=this.itemPull[c]["id"];if(this.itemPull[c]["complex"]){var g=this._getAllParents(this.itemPull[c]["id"]);for(var h=0;h0){a.title=this.itemPull[l]["tip"]}if((this.itemPull[l]["imgen"]!="")||(this.itemPull[l]["imgdis"]!="")){var e=this.itemPull[l][(this.itemPull[l]["state"]=="enabled")?"imgen":"imgdis"];if(e){var c=document.createElement("IMG");c.border="0";c.id="image_"+l;c.src=this.conf.icons_path+e;c.className="dhtmlxMenu_TopLevel_Item_Icon";if(a.childNodes.length>0&&!this.conf.rtl){a.insertBefore(c,a.childNodes[0])}else{a.appendChild(c)}}}a.onselectstart=function(m){m=m||event;if(m.preventDefault){m.preventDefault()}else{m.returnValue=false}return false};a.oncontextmenu=function(m){m=m||event;if(m.preventDefault){m.preventDefault()}else{m.returnValue=false}return false};if(!this.cont){this.cont=document.createElement("DIV");this.cont.dir="ltr";this.cont.className=(this.conf.align=="right"?"align_right":"align_left");this.base.appendChild(this.cont)}if(j!=null){j++;if(j<0){j=0}if(j>this.cont.childNodes.length-1){j=null}}if(j!=null){this.cont.insertBefore(a,this.cont.childNodes[j])}else{this.cont.appendChild(a)}this.idPull[a.id]=a;if(this.itemPull[l]["complex"]&&(!this.conf.dload)){this._addSubMenuPolygon(this.itemPull[l]["id"],this.itemPull[l]["id"])}a.onmouseover=function(){if(h.conf.mode=="web"){window.clearTimeout(h.conf.tm_handler)}var m=h._getSubItemToDeselectByPolygon("parent");h._removeSubItemFromSelected(-1,-1);for(var o=0;o
';var e=document.createElement("TABLE");e.className="dhtmlxMebu_SubLevelArea_Tbl";e.cellSpacing=0;e.cellPadding=0;e.border=0;var a=document.createElement("TBODY");e.appendChild(a);c.childNodes[1].appendChild(e);c.tbl=e;c.tbd=a;this.idPull[c.id]=c;if(this.sxDacProc!=null){this.idPull["sxDac_"+g]=new this.sxDacProc(c,c.className);if(window.dhx4.isIE){this.idPull["sxDac_"+g]._setSpeed(this.dacSpeedIE);this.idPull["sxDac_"+g]._setCustomCycle(this.dacCyclesIE)}else{this.idPull["sxDac_"+g]._setSpeed(this.dacSpeed);this.idPull["sxDac_"+g]._setCustomCycle(this.dacCycles)}}return c};dhtmlXMenuObject.prototype._renderSublevelItem=function(a,o){var m=this;var n=document.createElement("TR");n.className=(this.itemPull[a]["state"]=="enabled"?"sub_item":"sub_item_dis");var l=document.createElement("TD");l.className="sub_item_icon";var r=this.itemPull[a][(this.itemPull[a]["state"]=="enabled"?"imgen":"imgdis")];if(r!=""){var v=this.itemPull[a]["type"];if(v=="checkbox"||v=="radio"){var h=document.createElement("DIV");h.id="image_"+this.itemPull[a]["id"];h.className="sub_icon "+r;l.appendChild(h)}if(!(v=="checkbox"||v=="radio")){var h=document.createElement("IMG");h.id="image_"+this.itemPull[a]["id"];h.className="sub_icon";h.src=this.conf.icons_path+r;l.appendChild(h)}}else{l.innerHTML=" "}var j=document.createElement("TD");j.className="sub_item_text";if(this.itemPull[a]["title"]!=""){var u=document.createElement("DIV");u.className="sub_item_text";u.innerHTML=this.itemPull[a]["title"];j.appendChild(u)}else{j.innerHTML=" "}var g=document.createElement("TD");g.className="sub_item_hk";if(this.itemPull[a]["complex"]){var c=document.createElement("DIV");c.className="complex_arrow";c.id="arrow_"+this.itemPull[a]["id"];g.appendChild(c)}else{if(this.itemPull[a]["hotkey"].length>0&&!this.itemPull[a]["complex"]){var e=document.createElement("DIV");e.className="sub_item_hk";e.innerHTML=this.itemPull[a]["hotkey"];g.appendChild(e)}else{g.innerHTML=" "}}n.appendChild(this.conf.rtl?g:l);n.appendChild(j);n.appendChild(this.conf.rtl?l:g);n.id=this.itemPull[a]["id"];n.parent=this.itemPull[a]["parent"];if(this.itemPull[a]["tip"].length>0){n.title=this.itemPull[a]["tip"]}n.onselectstart=function(w){w=w||event;if(w.preventDefault){w.preventDefault()}else{w.returnValue=false}return false};n.onmouseover=function(w){if(m.conf.hide_tm[this.id]){window.clearTimeout(m.conf.hide_tm[this.id])}if(m.conf.mode=="web"){window.clearTimeout(m.conf.tm_handler)}if(!this._visible){m._redistribSubLevelSelection(this.id,this.parent)}this._visible=true};n.onmouseout=function(){if(m.conf.mode=="web"){if(m.conf.tm_handler){window.clearTimeout(m.conf.tm_handler)}m.conf.tm_handler=window.setTimeout(function(){if(m&&m._clearAndHide){m._clearAndHide()}},m.conf.tm_sec,"JavaScript")}var w=this;if(m.conf.hide_tm[this.id]){window.clearTimeout(m.conf.hide_tm[this.id])}m.conf.hide_tm[this.id]=window.setTimeout(function(){w._visible=false},50)};n.onclick=function(x){if(!m.checkEvent("onClick")&&m.itemPull[this.id]["complex"]){return}x=x||event;x.cancelBubble=true;if(x.preventDefault){x.preventDefault()}else{x.returnValue=false}tc=(m.itemPull[this.id]["complex"]?"c":"-");td=(m.itemPull[this.id]["state"]=="enabled"?"-":"d");var w={ctrl:x.ctrlKey,alt:x.altKey,shift:x.shiftKey};switch(m.itemPull[this.id]["type"]){case"checkbox":m._checkboxOnClickHandler(this.id.replace(m.idPrefix,""),tc+td+"n",w);break;case"radio":m._radioOnClickHandler(this.id.replace(m.idPrefix,""),tc+td+"n",w);break;case"item":m._doOnClick(this.id.replace(m.idPrefix,""),tc+td+"n",w);break}return false};var s=this.idPull["polygon_"+this.itemPull[a]["parent"]];if(o!=null){o++;if(o<0){o=0}if(o>s.tbd.childNodes.length-1){o=null}}if(o!=null&&s.tbd.childNodes[o]!=null){s.tbd.insertBefore(n,s.tbd.childNodes[o])}else{s.tbd.appendChild(n)}this.idPull[n.id]=n};dhtmlXMenuObject.prototype._renderSeparator=function(c,l){var a=(this.conf.context?"SubLevelArea":(this.itemPull[c]["parent"]==this.idPrefix+this.topId?"TopLevel":"SubLevelArea"));if(a=="TopLevel"&&this.conf.context){return}var h=this;if(a!="TopLevel"){var j=document.createElement("TR");j.className="sub_sep";var e=document.createElement("TD");e.colSpan="3";j.appendChild(e)}var g=document.createElement("DIV");g.id="separator_"+c;g.className=(a=="TopLevel"?"top_sep":"sub_sep");g.onselectstart=function(o){o=o||event;if(o.preventDefault){o.preventDefault()}else{o.returnValue=false}};g.onclick=function(r){r=r||event;r.cancelBubble=true;var o={ctrl:r.ctrlKey,alt:r.altKey,shift:r.shiftKey};h._doOnClick(this.id.replace("separator_"+h.idPrefix,""),"--s",o)};if(a=="TopLevel"){if(l!=null){l++;if(l<0){l=0}if(this.cont.childNodes[l]!=null){this.cont.insertBefore(g,this.cont.childNodes[l])}else{this.cont.appendChild(g)}}else{var n=this.cont.childNodes[this.cont.childNodes.length-1];if(String(n).search("TopLevel_Text")==-1){this.cont.appendChild(g)}else{this.cont.insertBefore(g,n)}}this.idPull[g.id]=g}else{var m=this.idPull["polygon_"+this.itemPull[c]["parent"]];if(l!=null){l++;if(l<0){l=0}if(l>m.tbd.childNodes.length-1){l=null}}if(l!=null&&m.tbd.childNodes[l]!=null){m.tbd.insertBefore(j,m.tbd.childNodes[l])}else{m.tbd.appendChild(j)}e.appendChild(g);this.idPull[g.id]=j}};dhtmlXMenuObject.prototype.addNewSeparator=function(a,c){c=this.idPrefix+(c!=null?c:this._genStr(24));var e=this.idPrefix+this.getParentId(a);this._addItemIntoGlobalStrorage(c,e,"","separator",false,"","");this._renderSeparator(c,this.getItemPosition(a))};dhtmlXMenuObject.prototype._initObj=function(r,s,l){if(!(r instanceof Array)){l=r.parentId;if(l!=null&&String(l).indexOf(this.idPrefix)!==0){l=this.idPrefix+String(l)}r=r.items}for(var e=0;e0){this.itemPull[r[e].id].complex=true;this._initObj(r[e].items,true,r[e].id)}else{if(this.conf.dload&&r[e].complex==true){this.itemPull[r[e].id].loaded="no"}}this.itemPull[r[e].id].items=null}if(s!==true){if(this.conf.dload==true){if(l==null){this._initTopLevelMenu()}else{this._addSubMenuPolygon(l,l);if(this.conf.selected==l){var o=(this.itemPull[l].parent==this.idPrefix+this.topId);var c=(o&&!this.conf.context?this.conf.dir_toplv:this.conf.dir_sublv);var h=false;if(o&&this.conf.top_mode&&this.conf.mode=="web"&&!this.conf.context){var v=this.idPull[l];if(v._mouseOver==true){var j=this.conf.top_tmtime-(new Date().getTime()-v._dynLoadTM);if(j>1){var n=l;var m=this;v._menuOpenTM=window.setTimeout(function(){m._showPolygon(n,c);m=n=null},j);h=true}}}if(!h){this._showPolygon(l,c)}}this.itemPull[l].loaded="yes";if(this.conf.dload_icon==true){this._updateLoaderIcon(l,false)}}}else{this._init()}}};dhtmlXMenuObject.prototype._xmlToJson=function(h,g){var l=[];if(g==null){var m=h.getElementsByTagName(this.conf.tags.root);if(m==null||(m!=null&&m.length==0)){return{items:[]}}m=m[0]}else{m=h}if(m.getAttribute("parentId")!=null){g=this.idPrefix+m.getAttribute("parentId")}for(var c=0;c0)}for(var n=0;n=0){return}var c=(this.conf.rtl?0:2);if(!this.idPull[g].childNodes[c]){return}if(!this.idPull[g].childNodes[c].childNodes[0]){return}var a=this.idPull[g].childNodes[c].childNodes[0];if(String(a.className).search("complex_arrow")===0){a.className="complex_arrow"+(e?"_loading":"")}};dhtmlXMenuObject.prototype.addNewSibling=function(g,h,a,c,e,m){var l=this.idPrefix+(h!=null?h:this._genStr(24));var j=this.idPrefix+(g!=null?this.getParentId(g):this.topId);this._addItemIntoGlobalStrorage(l,j,a,"item",c,e,m);if((j==this.idPrefix+this.topId)&&(!this.conf.context)){this._renderToplevelItem(l,this.getItemPosition(g))}else{this._renderSublevelItem(l,this.getItemPosition(g))}};dhtmlXMenuObject.prototype.addNewChild=function(l,j,g,a,c,e,h){if(l==null){if(this.conf.context){l=this.topId}else{this.addNewSibling(l,g,a,c,e,h);if(j!=null){this.setItemPosition(g,j)}return}}g=this.idPrefix+(g!=null?g:this._genStr(24));if(this.setHotKey){this.setHotKey(l,"")}l=this.idPrefix+l;this._addItemIntoGlobalStrorage(g,l,a,"item",c,e,h);if(this.idPull["polygon_"+l]==null){this._renderSublevelPolygon(l,l)}this._renderSublevelItem(g,j-1);this._redefineComplexState(l)};dhtmlXMenuObject.prototype.removeItem=function(g,j,h){if(!j){g=this.idPrefix+g}var l=null;if(g!=this.idPrefix+this.topId){if(this.itemPull[g]==null){return}if(this.idPull["polygon_"+g]&&this.idPull["polygon_"+g]._tmShow){window.clearTimeout(this.idPull["polygon_"+g]._tmShow)}var s=this.itemPull[g]["type"];if(s=="separator"){var r=this.idPull["separator_"+g];if(this.itemPull[g]["parent"]==this.idPrefix+this.topId){r.onclick=null;r.onselectstart=null;r.id=null;r.parentNode.removeChild(r)}else{r.childNodes[0].childNodes[0].onclick=null;r.childNodes[0].childNodes[0].onselectstart=null;r.childNodes[0].childNodes[0].id=null;r.childNodes[0].removeChild(r.childNodes[0].childNodes[0]);r.removeChild(r.childNodes[0]);r.parentNode.removeChild(r)}this.idPull["separator_"+g]=null;this.itemPull[g]=null;delete this.idPull["separator_"+g];delete this.itemPull[g];r=null}else{l=this.itemPull[g]["parent"];var r=this.idPull[g];r.onclick=null;r.oncontextmenu=null;r.onmouseover=null;r.onmouseout=null;r.onselectstart=null;r.id=null;while(r.childNodes.length>0){r.removeChild(r.childNodes[0])}r.parentNode.removeChild(r);this.idPull[g]=null;this.itemPull[g]=null;delete this.idPull[g];delete this.itemPull[g];r=null}s=null}for(var n in this.itemPull){if(this.itemPull[n]["parent"]==g){this.removeItem(n,true,true)}}var o=new Array(g);if(l!=null&&!h){if(this.idPull["polygon_"+l]!=null){if(this.idPull["polygon_"+l].tbd.childNodes.length==0){o.push(l);this._updateItemComplexState(l,false,false)}}}for(var c=0;c0){this.idPull[j].insertBefore(g,this.idPull[j].childNodes[0])}else{this.idPull[j].appendChild(g)}}g.innerHTML=this.itemPull[j]["title"]}}else{var g=null;for(var a=0;a0?a:null);this.itemPull[c]["tip"]=a};dhtmlXMenuObject.prototype.getTooltip=function(a){if(this.itemPull[this.idPrefix+a]==null){return null}return this.itemPull[this.idPrefix+a]["tip"]};dhtmlXMenuObject.prototype.setTopText=function(a){if(this.conf.context){return}if(this._topText==null){this._topText=document.createElement("DIV");this._topText.className="dhtmlxMenu_TopLevel_Text_"+(this.conf.rtl?"left":(this.conf.align=="left"?"right":"left"));this.base.appendChild(this._topText)}this._topText.innerHTML=a};dhtmlXMenuObject.prototype.setAlign=function(a){if(this.conf.align==a){return}if(a=="left"||a=="right"){this.conf.align=a;if(this.cont){this.cont.className=(this.conf.align=="right"?"align_right":"align_left")}if(this._topText!=null){this._topText.className="dhtmlxMenu_TopLevel_Text_"+(this.conf.align=="left"?"right":"left")}}};dhtmlXMenuObject.prototype.setHref=function(e,a,c){if(this.itemPull[this.idPrefix+e]==null){return}this.itemPull[this.idPrefix+e]["href_link"]=a;if(c!=null){this.itemPull[this.idPrefix+e]["href_target"]=c}};dhtmlXMenuObject.prototype.clearHref=function(a){if(this.itemPull[this.idPrefix+a]==null){return}delete this.itemPull[this.idPrefix+a]["href_link"];delete this.itemPull[this.idPrefix+a]["href_target"]};dhtmlXMenuObject.prototype.getCircuit=function(c){var a=new Array(c);while(this.getParentId(c)!=this.topId){c=this.getParentId(c);a[a.length]=c}return a.reverse()};dhtmlXMenuObject.prototype._getCheckboxState=function(a){if(this.itemPull[this.idPrefix+a]==null){return null}return this.itemPull[this.idPrefix+a]["checked"]};dhtmlXMenuObject.prototype._setCheckboxState=function(c,a){if(this.itemPull[this.idPrefix+c]==null){return}this.itemPull[this.idPrefix+c]["checked"]=a};dhtmlXMenuObject.prototype._updateCheckboxImage=function(c){if(this.idPull[this.idPrefix+c]==null){return}this.itemPull[this.idPrefix+c]["imgen"]="chbx_"+(this._getCheckboxState(c)?"1":"0");this.itemPull[this.idPrefix+c]["imgdis"]=this.itemPull[this.idPrefix+c]["imgen"];try{this.idPull[this.idPrefix+c].childNodes[(this.conf.rtl?2:0)].childNodes[0].className="sub_icon "+this.itemPull[this.idPrefix+c]["imgen"]}catch(a){}};dhtmlXMenuObject.prototype._checkboxOnClickHandler=function(g,a,c){if(a.charAt(1)=="d"){return}if(this.itemPull[this.idPrefix+g]==null){return}var e=this._getCheckboxState(g);if(this.checkEvent("onCheckboxClick")){if(this.callEvent("onCheckboxClick",[g,e,this.conf.ctx_zoneid,c])){this.setCheckboxState(g,!e)}}else{this.setCheckboxState(g,!e)}if(this.checkEvent("onClick")){this.callEvent("onClick",[g])}};dhtmlXMenuObject.prototype.setCheckboxState=function(c,a){this._setCheckboxState(c,a);this._updateCheckboxImage(c)};dhtmlXMenuObject.prototype.getCheckboxState=function(a){return this._getCheckboxState(a)};dhtmlXMenuObject.prototype.addCheckbox=function(m,g,n,o,r,a,h){if(this.conf.context&&g==this.topId){}else{if(this.itemPull[this.idPrefix+g]==null){return}if(m=="child"&&this.itemPull[this.idPrefix+g]["type"]!="item"){return}}var j="chbx_"+(a?"1":"0");var e=j;if(m=="sibling"){var c=this.idPrefix+(o!=null?o:this._genStr(24));var l=this.idPrefix+this.getParentId(g);this._addItemIntoGlobalStrorage(c,l,r,"checkbox",h,j,e);this.itemPull[c]["checked"]=a;this._renderSublevelItem(c,this.getItemPosition(g))}else{var c=this.idPrefix+(o!=null?o:this._genStr(24));var l=this.idPrefix+g;this._addItemIntoGlobalStrorage(c,l,r,"checkbox",h,j,e);this.itemPull[c]["checked"]=a;if(this.idPull["polygon_"+l]==null){this._renderSublevelPolygon(l,l)}this._renderSublevelItem(c,n-1);this._redefineComplexState(l)}};dhtmlXMenuObject.prototype.setHotKey=function(l,a){l=this.idPrefix+l;if(!(this.itemPull[l]!=null&&this.idPull[l]!=null)){return}if(this.itemPull[l]["parent"]==this.idPrefix+this.topId&&!this.conf.context){return}if(this.itemPull[l]["complex"]){return}var c=this.itemPull[l]["type"];if(!(c=="item"||c=="checkbox"||c=="radio")){return}var j=null;try{if(this.idPull[l].childNodes[this.conf.rtl?0:2].childNodes[0].className=="sub_item_hk"){j=this.idPull[l].childNodes[this.conf.rtl?0:2].childNodes[0]}}catch(h){}if(a.length==0){this.itemPull[l]["hotkey_backup"]=this.itemPull[l]["hotkey"];this.itemPull[l]["hotkey"]="";if(j!=null){j.parentNode.removeChild(j)}}else{this.itemPull[l]["hotkey"]=a;this.itemPull[l]["hotkey_backup"]=null;if(j==null){j=document.createElement("DIV");j.className="sub_item_hk";var g=this.idPull[l].childNodes[this.conf.rtl?0:2];while(g.childNodes.length>0){g.removeChild(g.childNodes[0])}g.appendChild(j)}j.innerHTML=a}};dhtmlXMenuObject.prototype.getHotKey=function(a){if(this.itemPull[this.idPrefix+a]==null){return null}return this.itemPull[this.idPrefix+a]["hotkey"]};dhtmlXMenuObject.prototype._clearAllSelectedSubItemsInPolygon=function(a){var e=this._getSubItemToDeselectByPolygon(a);for(var c=0;c0){var e=false;var h=a.scrollTop-this.conf.of_ustep;if(h<0){e=true;h=0}a.scrollTop=h;if(!e){var c=this;this.conf.of_utm=window.setTimeout(function(){c._doScrollUp(j,false);c=null},this.conf.of_utime)}else{g=true}}else{this._canScrollUp=false;this._checkArrowsState(j)}if(g){this._checkArrowsState(j)}};dhtmlXMenuObject.prototype._doScrollDown=function(j,g){var a=this.idPull["polygon_"+j].childNodes[1];if(this._canScrollDown&&a.scrollTop+a.offsetHeight<=a.scrollHeight){var e=false;var h=a.scrollTop+this.conf.of_dstep;if(h+a.offsetHeight>=a.scrollHeight){e=true;h=a.scrollHeight-a.offsetHeight}a.scrollTop=h;if(!e){var c=this;this.conf.of_dtm=window.setTimeout(function(){c._doScrollDown(j,false);c=null},this.conf.of_dtime)}else{g=true}}else{this._canScrollDown=false;this._checkArrowsState(j)}if(g){this._checkArrowsState(j)}};dhtmlXMenuObject.prototype._countPolygonItems=function(j){var g=0;for(var c in this.itemPull){var e=this.itemPull[c]["parent"];var h=this.itemPull[c]["type"];if(e==this.idPrefix+j&&(h=="item"||h=="radio"||h=="checkbox")){g++}}return g};dhtmlXMenuObject.prototype.setOverflowHeight=function(g){if(g==="auto"){this.conf.overflow_limit=0;this.conf.auto_overflow=true;return}if(this.conf.overflow_limit==0&&g<=0){return}this._clearAndHide();if(this.conf.overflow_limit>=0&&g>0){this.conf.overflow_limit=g;return}if(this.conf.overflow_limit>0&&g<=0){for(var e in this.itemPull){if(this._isArrowExists(e)){var c=String(e).replace(this.idPrefix,"");this._removeUpArrow(c);this._removeDownArrow(c);this.idPull["polygon_"+e].childNodes[1].style.height=""}}this.conf.overflow_limit=0;return}};dhtmlXMenuObject.prototype._getRadioImgObj=function(g){try{var a=this.idPull[this.idPrefix+g].childNodes[(this.conf.rtl?2:0)].childNodes[0]}catch(c){var a=null}return a};dhtmlXMenuObject.prototype._setRadioState=function(g,e){var c=this._getRadioImgObj(g);if(c!=null){var a=this.itemPull[this.idPrefix+g];a.checked=e;a.imgen="rdbt_"+(a.checked?"1":"0");a.imgdis=a.imgen;c.className="sub_icon "+a.imgen}};dhtmlXMenuObject.prototype._radioOnClickHandler=function(g,a,c){if(a.charAt(1)=="d"||this.itemPull[this.idPrefix+g]["group"]==null){return}var e=this.itemPull[this.idPrefix+g]["group"];if(this.checkEvent("onRadioClick")){if(this.callEvent("onRadioClick",[e,this.getRadioChecked(e),g,this.conf.ctx_zoneid,c])){this.setRadioChecked(e,g)}}else{this.setRadioChecked(e,g)}if(this.checkEvent("onClick")){this.callEvent("onClick",[g])}};dhtmlXMenuObject.prototype.getRadioChecked=function(g){var j=null;for(var e=0;e";return a};dhtmlXMenuObject.prototype._readLevel=function(g){var h="";for(var n in this.itemPull){if(this.itemPull[n]["parent"]==g){var c="";var e="";var r="";var m=String(this.itemPull[n]["id"]).replace(this.idPrefix,"");var l="";var o=(this.itemPull[n]["title"]!=""?' text="'+this.itemPull[n]["title"]+'"':"");var j="";if(this.itemPull[n]["type"]=="item"){if(this.itemPull[n]["imgen"]!=""){c=' img="'+this.itemPull[n]["imgen"]+'"'}if(this.itemPull[n]["imgdis"]!=""){e=' imgdis="'+this.itemPull[n]["imgdis"]+'"'}if(this.itemPull[n]["hotkey"]!=""){r=""+this.itemPull[n]["hotkey"]+""}}if(this.itemPull[n]["type"]=="separator"){l=' type="separator"'}else{if(this.itemPull[n]["state"]=="disabled"){j=' enabled="false"'}}if(this.itemPull[n]["type"]=="checkbox"){l=' type="checkbox"'+(this.itemPull[n]["checked"]?' checked="true"':"")}if(this.itemPull[n]["type"]=="radio"){l=' type="radio" group="'+this.itemPull[n]["group"]+'" '+(this.itemPull[n]["checked"]?' checked="true"':"")}h+="";h+=r;if(this.itemPull[n]["complex"]){h+=this._readLevel(n)}h+=""}}return h};dhtmlXMenuObject.prototype.enableEffect=function(e,h,g){this._menuEffect=(e=="opacity"||e=="slide"||e=="slide+"?e:false);this._pOpStyleIE=(navigator.userAgent.search(/MSIE\s[678]\.0/gi)>=0);for(var c in this.idPull){if(c.search(/polygon/)===0){this._pOpacityApply(c,(this._pOpStyleIE?100:1));this.idPull[c].style.height=""}}this._pOpMax=(typeof(h)=="undefined"?100:h)/(this._pOpStyleIE?1:100);this._pOpStyleName=(this._pOpStyleIE?"filter":"opacity");this._pOpStyleValue=(this._pOpStyleIE?"progid:DXImageTransform.Microsoft.Alpha(Opacity=#)":"#");this._pSlSteps=(this._pOpStyleIE?10:20);this._pSlTMTimeMax=g||50};dhtmlXMenuObject.prototype._showPolygonEffect=function(a){this._pShowHide(a,true)};dhtmlXMenuObject.prototype._hidePolygonEffect=function(a){this._pShowHide(a,false)};dhtmlXMenuObject.prototype._pOpacityApply=function(a,c){this.idPull[a].style[this._pOpStyleName]=String(this._pOpStyleValue).replace("#",c||this.idPull[a]._op)};dhtmlXMenuObject.prototype._pShowHide=function(a,c){if(!this.idPull){return}if(this.idPull[a]._tmShow!=null){if((this.idPull[a]._step_h>0&&c==true)||(this.idPull[a]._step_h<0&&c==false)){return}window.clearTimeout(this.idPull[a]._tmShow);this.idPull[a]._tmShow=null;this.idPull[a]._max_h=null}if(c==false&&(this.idPull[a].style.visibility=="hidden"||this.idPull[a].style.display=="none")){return}if(c==true&&this.idPull[a].style.display=="none"){this.idPull[a].style.visibility="hidden";this.idPull[a].style.display=""}if(this.idPull[a]._max_h==null){this.idPull[a]._max_h=parseInt(this.idPull[a].offsetHeight);this.idPull[a]._h=(c==true?0:this.idPull[a]._max_h);this.idPull[a]._step_h=Math.round(this.idPull[a]._max_h/this._pSlSteps)*(c==true?1:-1);if(this.idPull[a]._step_h==0){return}this.idPull[a]._step_tm=Math.round(this._pSlTMTimeMax/this._pSlSteps);if(this._menuEffect=="slide+"||this._menuEffect=="opacity"){this.idPull[a].op_tm=this.idPull[a]._step_tm;this.idPull[a].op_step=(this._pOpMax/this._pSlSteps)*(c==true?1:-1);if(this._pOpStyleIE){this.idPull[a].op_step=Math.round(this.idPull[a].op_step)}this.idPull[a]._op=(c==true?0:this._pOpMax);this._pOpacityApply(a)}else{this.idPull[a]._op=(this._pOpStyleIE?100:1);this._pOpacityApply(a)}if(this._menuEffect.search(/slide/)===0){this.idPull[a].style.height="0px"}this.idPull[a].style.visibility="visible"}this._pEffectSet(a,this.idPull[a]._h+this.idPull[a]._step_h)};dhtmlXMenuObject.prototype._pEffectSet=function(e,c){if(!this.idPull){return}if(this.idPull[e]._tmShow){window.clearTimeout(this.idPull[e]._tmShow)}this.idPull[e]._h=Math.max(0,Math.min(c,this.idPull[e]._max_h));if(this._menuEffect.search(/slide/)===0){this.idPull[e].style.height=this.idPull[e]._h+"px"}c+=this.idPull[e]._step_h;if(this._menuEffect=="slide+"||this._menuEffect=="opacity"){this.idPull[e]._op=Math.max(0,Math.min(this._pOpMax,this.idPull[e]._op+this.idPull[e].op_step));this._pOpacityApply(e)}if((this.idPull[e]._step_h>0&&c<=this.idPull[e]._max_h)||(this.idPull[e]._step_h<0&&c>=0)){var a=this;this.idPull[e]._tmShow=window.setTimeout(function(){a._pEffectSet(e,c)},this.idPull[e]._step_tm)}else{if(this._menuEffect.search(/slide/)===0){this.idPull[e].style.height=""}if(this.idPull[e]._step_h<0){this.idPull[e].style.visibility="hidden"}if(this._menuEffect=="slide+"||this._menuEffect=="opacity"){this.idPull[e]._op=(this.idPull[e]._step_h<0?(this._pOpStyleIE?100:1):this._pOpMax);this._pOpacityApply(e)}this.idPull[e]._tmShow=null;this.idPull[e]._h=null;this.idPull[e]._max_h=null;this.idPull[e]._step_tm=null}};function dhtmlXRibbon(g){var e=this,c,a;this.conf={type:"ribbon",icons_path:(g&&g.icons_path)?g.icons_path:"",arrows_mode:(g&&g.arrows_mode)?g.arrows_mode:null,skin:"dhx_skyblue"};this._eventHandlers={};this._base=null;this._items={};this._tabbar=null;this.childIds=[];if(typeof(g)=="string"){a=g}else{if(g&&g.tagName){a=g}else{if(g&&g.parent){if(g.parent.tagName||typeof(g.parent)=="string"){a=g.parent}}}}this._doOnHighlight0=function(m){m=m||event;var l=m.target||m.srcElement;var h=e._findItemByNode(l);var j=e._items[h._dhx_ribbonId];if(j.conf.disable){return}if(e.items[j.type]&&typeof(e.items[j.type].mouseover)=="function"){if(e.items[j.type].mouseover(j,e,m)!=true){return false}}if(!/dhxrb_highlight0/.test(h.className)){h.className+=" dhxrb_highlight0"}};this._doOffHighlight0=function(m){m=m||event;var l=m.target||m.srcElement;var h=e._findItemByNode(l);var j=e._items[h._dhx_ribbonId];if(j.conf.disable){return}if(e.items[j.type]&&typeof(e.items[j.type].mouseout)=="function"){if(e.items[j.type].mouseout(j,e,m)!=true){return false}}if(/dhxrb_highlight1/.test(h.className)){h.className=h.className.replace(/\s?dhxrb_highlight1/,"")}if(/dhxrb_highlight0/.test(h.className)){h.className=h.className.replace(/\s?dhxrb_highlight0/,"")}};this._doOnHighlight1=function(m){m=m||event;var l=m.target||m.srcElement;var h=e._findItemByNode(l);var j=e._items[h._dhx_ribbonId];if(j.conf.disable){return}e.callEvent("_showPopup",[j.id]);if(e.items[j.type]&&typeof(e.items[j.type].mousedown)=="function"){if(e.items[j.type].mousedown(j,e,m)!=true){return false}}if(!/dhxrb_highlight1/.test(h.className)){h.className+=" dhxrb_highlight1"}};this._doOffHighlight1=function(m){m=m||event;var l=m.target||m.srcElement;var h=e._findItemByNode(l);var j=e._items[h._dhx_ribbonId];if(j.conf.disable){return}if(e.items[j.type]&&typeof(e.items[j.type].mouseup)=="function"){if(e.items[j.type].mouseup(j,e,m)!=true){return false}}if(/dhxrb_highlight1/.test(h.className)){h.className=h.className.replace(/\s?dhxrb_highlight1/,"")}};this._doOnClick=function(m){m=m||event;var l=m.target||m.srcElement;var h=e._findItemByNode(l);var j=e._items[h._dhx_ribbonId];if(j.conf.disable){return}if(e.items[j.type]&&typeof(e.items[j.type].click)=="function"){e.items[j.type].click(j,e,m)}};this._doOnFocus=function(m){m=m||event;var l=m.target||m.srcElement;var h=e._findItemByNode(l);var j=e._items[h._dhx_ribbonId];if(j.conf.disable){return}e.callEvent("_showPopup",[j.id]);if(e.items[j.type]&&typeof(e.items[j.type].focus)=="function"){e.items[j.type].focus(j,e,m)}};this._doOnBlur=function(m){m=m||event;var l=m.target||m.srcElement;var h=e._findItemByNode(l);var j=e._items[h._dhx_ribbonId];if(j.conf.disable){return}if(e.items[j.type]&&typeof(e.items[j.type].blur)=="function"){e.items[j.type].blur(j,e,m)}};this._doOnChange=function(m){m=m||event;var l=m.target||m.srcElement;var h=e._findItemByNode(l);var j=e._items[h._dhx_ribbonId];if(j.conf.disable){return}if(e.items[j.type]&&typeof(e.items[j.type].change)=="function"){e.items[j.type].change(j,e,m)}};this._doOnKeydown=function(m){m=m||event;var l=m.target||m.srcElement;var h=e._findItemByNode(l);var j=e._items[h._dhx_ribbonId];if(j.conf.disable){return}if(e.items[j.type]&&typeof(e.items[j.type].keydown)=="function"){e.items[j.type].keydown(j,e,m)}};this._tabCustomApi={enable:function(m,j){var h=null;j=j||false;if(j!=true){h=e._items[this._idd];for(var l=0;l
"+g.conf.text+"
";if(typeof(this.afterRender)=="function"){this.afterRender(g)}if(g.conf.disable){this.disable(g)}return g},getText:function(a){return a.conf.text},setText:function(c,e){var a=c.base.childNodes[1];c.conf.text=e;a.innerHTML=e},setImage:function(c,a){c.conf.img=a;if(c.conf.disable==false){c.base.childNodes[0].src=c.conf.icons_path+c.conf.img}},setImageDis:function(c,a){c.conf.imgdis=a;if(c.conf.disable==true){c.base.childNodes[0].src=c.conf.icons_path+c.conf.imgdis}},mousedown:function(a,g,c){return true},click:function(a,g,c){if(c.button!=0){return false}g._callHandler(a.id,[a.id]);a.callEvent("onClick",[a.id]);return false},disable:function(c){var e=c.base.childNodes[0],a=c.base.childNodes[1];if(c.conf.imgdis){e.src=c.conf.icons_path+c.conf.imgdis;if(/\s?dhxrb_invisible/i.test(e.className)){e.className=e.className.replace(/\s?dhxrb_invisible/i,"")}}if(!/\s?dhxrb_disable_text_style/i.test(a.className)){a.className+=" dhxrb_disable_text_style"}return true},enable:function(c){var e=c.base.childNodes[0],a=c.base.childNodes[1];if(c.conf.img){e.src=c.conf.icons_path+c.conf.img}else{if(!/\s?dhxrb_invisible/i.test(e.className)){e.className+=" dhxrb_invisible"}}if(/\s?dhxrb_disable_text_style/i.test(a.className)){a.className=a.className.replace(/\s?dhxrb_disable_text_style/i,"")}return true}};dhtmlXRibbon.prototype.items.buttonTwoState={click:function(a,g,c){return false},afterRender:function(a){if(a.conf.state){this.setState(a,a.conf.state)}},mouseover:function(a){if(!/dhxrb_highlight0/.test(a.base.className)){a.base.className+=" dhxrb_highlight0"}return false},mouseout:function(a){if(/dhxrb_highlight0/.test(a.base.className)){a.base.className=a.base.className.replace(/\s?dhxrb_highlight0/,"")}return false},mousedown:function(a,g,c){g._callHandler(a.id,[a.id,!a.conf.state]);this.setState(a,!a.conf.state,true);return false},mouseup:function(a){return false},setState:function(a,c,e){e=e||false;c=dhx4.s2b(c);if(c){if(!/dhxrb_highlight1/.test(a.base.className)){a.base.className+=" dhxrb_highlight1"}}else{if(/dhxrb_highlight1/.test(a.base.className)){a.base.className=a.base.className.replace(/\s?dhxrb_highlight1/,"")}}a.conf.state=c;if(e){a.callEvent("onStateChange",[a.id,a.conf.state])}},getState:function(a){return(a.conf.state==true)}};dhtmlXRibbon.prototype.items.buttonSegment={click:function(a,g,c){return false},mousedown:function(a,g,c){this.setState(a,g,true);return false},callAfterInit:function(a){if(a.conf.state||dhtmlXRibbon.prototype.items.buttonSegment._getSelectedNeighbor(a,this)==null){if(a.conf.state){a.conf.state=false}dhtmlXRibbon.prototype.items.buttonSegment.setState(a,this,false)}},afterRender:function(){},setState:function(a,h,g){g=g||false;var e=null,c=dhx4.s2b(a.conf.state);if(c==false){e=this._getSelectedNeighbor(a,h);if(e!=null){this._unSelect(e)}if(!/dhxrb_highlight1/.test(a.base.className)){a.base.className+=" dhxrb_highlight1"}a.conf.state=true;if(g){h._callHandler(a.id,[a.id,(e?e.id:null)]);h.callEvent("onStateChange",[a.id,(e?e.id:null)])}}},remove:function(e,l){var h=dhx4.s2b(e.conf.state),j=null,a=0,c=l._items[e.parentId],g;if(h){while(c.childIds[a]&&j==null){g=l._items[c.childIds[a]];if(g.type=="buttonSegment"&&g!=e){j=g}a++}if(j){this.setState(j,l)}}},_unSelect:function(a){var c=dhx4.s2b(a.conf.state);if(c){if(/dhxrb_highlight1/.test(a.base.className)){a.base.className=a.base.className.replace(/\s?dhxrb_highlight1/,"")}a.conf.state=false}},_getSelectedNeighbor:function(g,m){var e=m._items[g.parentId],c,a,j,h=null;a=e.childIds.length;for(c=0;c ";c.menu=null;this.itemCollection.push(c);this._attachEventToWindow();a=null},setText:function(a,e){var c=a.base.childNodes[1].lastChild;a.conf.text=e;a.base.childNodes[1].innerHTML=e;a.base.childNodes[1].appendChild(c)},setOptionText:function(a,e,c){if(a.menu!=null){a.menu.setItemText(e,c)}else{this._loopThroughItems(a.conf.items,e,c,false)}},getOptionText:function(a,c){if(a.menu!=null){return a.menu.getItemText(c)}return this._loopThroughItems(a.conf.items,c,null,true)},_loopThroughItems:function(a,j,h,g){for(var e=0;e
"+g.conf.text+"
";if(typeof(this.afterRender)=="function"){this.afterRender(g)}if(g.conf.disable){this.disable(g)}if(g.conf.width){this.setWidth(g,g.conf.width)}if(g.conf.value){this.setValue(g,g.conf.value)}return g},callAfterInit:function(c){var a=c.base.childNodes[0];this._detachEventFromItem(c.base);this._attachEventsToInput(a)},setText:dhtmlXRibbon.prototype.items.button.setText,getText:dhtmlXRibbon.prototype.items.button.getText,change:function(c){var a=c.base.childNodes[0];c.conf.value=a.value},keydown:function(c,h,g){if(g.keyCode==13){var a=c.base.childNodes[0];c.conf.value=a.value;h.callEvent("onEnter",[c.id,c.conf.value])}},remove:function(c,e){var a=c.base.childNodes[0];e._detachEventsFromInput(a)},getValue:function(c){var a=c.base.childNodes[0],e;e=a.value;a=undefined;return e},setValue:function(c,e){var a=c.base.childNodes[0],e;a.value=e;c.conf.value=e},setWidth:function(c,e){var a=c.base.childNodes[0];a.style.width=parseInt(e)+"px"},disable:function(e){var c=e.base.childNodes[0],a=e.base.childNodes[1];c.disabled=true;if(!/\s?dhxrb_disable_text_style/i.test(a.className)){a.className+=" dhxrb_disable_text_style"}return true},enable:function(e){var c=e.base.childNodes[0],a=e.base.childNodes[1];c.disabled=false;if(/\s?dhxrb_disable_text_style/i.test(a.className)){a.className=a.className.replace(/\s?dhxrb_disable_text_style/i,"")}return true},getInput:function(a){return a.base.childNodes[0]}};dhtmlXRibbon.prototype.getInput=function(c){var a=this._items[c];if(a==null||a.type!="input"){return null}return this.items[a.type].getInput(a)};dhtmlXRibbon.prototype.items.checkbox={render:function(c,a){var e,g;g={base:c,id:a.id,type:a.type,conf:{text:"",text_pos:(a.isbig)?"bottom":"right",disable:false,checked:false}};for(e in a){if(e=="id"||e=="onclick"||e=="type"){continue}g.conf[e]=a[e]}c.innerHTML="
"+g.conf.text+"
";if(typeof(this.afterRender)=="function"){this.afterRender(g)}if(g.conf.checked){this.check(g)}return g},callAfterInit:function(a){if(a.conf.disable){this.disable(a.id)}},setText:dhtmlXRibbon.prototype.items.button.setText,getText:dhtmlXRibbon.prototype.items.button.getText,mousedown:function(a){return false},mouseup:function(a){return false},click:function(a,g,c){if(c.button!=0){return false}if(a.type=="checkbox"){if(a.conf.checked){this.uncheck(a,true)}else{this.check(a,true)}}},check:function(a,c){c=c||false;if(a.type!="checkbox"){return}a.conf.checked=true;if(!/\s?dhxrb_checked/i.test(a.base.className)){a.base.className+=" dhxrb_checked"}if(c){a.callEvent("onCheck",[a.id,a.conf.checked])}},uncheck:function(a,c){c=c||false;if(a.type!="checkbox"){return}a.conf.checked=false;if(/\s?dhxrb_checked/i.test(a.base.className)){a.base.className=a.base.className.replace(/\s?dhxrb_checked/i,"")}if(c){a.callEvent("onCheck",[a.id,a.conf.checked])}},isChecked:function(a){if(a.type!="checkbox"){return false}return(a.conf.checked==true)},disable:function(a){return true},enable:function(a){return true}};dhtmlXRibbon.prototype.items.text={render:function(a,g){var e={base:a,id:g.id,type:g.type,conf:{text:""}};for(var c in g){if(c=="id"||c=="type"){continue}e.conf[c]=g[c]}a.innerHTML="
"+e.conf.text+"
";if(typeof(this.afterRender)=="function"){this.afterRender(e)}return e},callAfterInit:function(a){this._detachEventFromItem(a.base)},getText:function(a){return a.conf.text},setText:function(a,c){a.conf.text=c;a.base.firstChild.innerHTML=a.conf.text}};dhtmlXRibbon.prototype.items.buttonCombo={render:function(a,c){var e,g,h={};g={base:a,id:c.id,type:c.type,conf:{text:"",text_pos:"right",width:140,skin:c.skin,callEvent:true}};for(e in c){if(e=="id"||e=="onclick"||e=="type"){continue}g.conf[e]=c[e]}for(e in g.conf){if(e=="text"||e=="text_pos"||e=="disable"||e=="data"){continue}h[e]=g.conf[e]}g.base.className+=" dhxrb_buttoncombo_cont";g.base.innerHTML="
"+g.conf.text+"
";h.parent=g.base.firstChild;g.combo=new dhtmlXCombo(h);g.combo.setSkin(h.skin);g.combo.attachEvent("onChange",function(j,l){g._callHandler(g.id,[j,l]);if(g.conf.callEvent==true){g.callEvent("onSelectOption",[g.id,j,l])}g.conf.callEvent=true});if(g.conf.data){g.combo.load(g.conf.data);delete g.conf.data}if(typeof(this.afterRender)=="function"){this.afterRender(g)}if(g.conf.disable){this.disable(g)}return g},callAfterInit:function(a){this._detachEventFromItem(a.base)},disable:function(c){var a=c.base.lastChild;if(c.combo instanceof dhtmlXCombo){c.combo.disable()}if(!/\s?dhxrb_disable_text_style/i.test(a.className)){a.className+=" dhxrb_disable_text_style"}return true},enable:function(c){var a=c.base.lastChild;if(c.combo instanceof dhtmlXCombo){c.combo.enable()}if(/\s?dhxrb_disable_text_style/i.test(a.className)){a.className=a.className.replace(/\s?dhxrb_disable_text_style/i,"")}return true},remove:function(a){if(a.combo instanceof dhtmlXCombo){a.combo.unload();a.combo=null}},getValue:function(a){var c=null;if(a.combo instanceof dhtmlXCombo){c=a.combo.getSelectedValue()}return c},setValue:function(a,c,e){if(a.combo instanceof dhtmlXCombo){a.conf.callEvent=e;a.combo.setComboValue(c)}},setSkin:function(a,c){if(a.combo instanceof dhtmlXCombo){a.combo.setSkin(c)}}};dhtmlXRibbon.prototype.items.slider={render:function(a,h){var e,g,c={};g={base:a,id:h.id,type:h.type,conf:{text:"",text_pos:"right",size:150,vertical:false,min:0,max:99,value:0,step:1,margin:10,disabled:false,enableTooltip:false}};for(e in h){if(e=="id"||e=="onclick"||e=="type"){continue}g.conf[e]=h[e]}for(e in g.conf){if(e=="text"||e=="text_pos"||e=="isbig"){continue}c[e]=g.conf[e]}g.base.innerHTML="
"+g.conf.text+"
";c.parent=g.base.firstChild.firstChild;g.slider=new dhtmlXSlider(c);if(typeof(this.afterRender)=="function"){this.afterRender(g)}if(g.conf.disable){this.disable(g)}g.slider.attachEvent("onChange",function(j){g._callHandler(g.id,[j]);g.callEvent("onValueChange",[g.id,j])});return g},callAfterInit:function(a){this._detachEventFromItem(a.base)},setSkin:function(a,c){if(a.slider instanceof dhtmlXSlider){a.slider.setSkin(c)}},disable:function(c){var a=c.base.childNodes[1];if(c.slider instanceof dhtmlXSlider){c.slider.disable()}if(!/\s?dhxrb_disable_text_style/i.test(a.className)){a.className+=" dhxrb_disable_text_style"}return true},enable:function(c){var a=c.base.childNodes[1];if(c.slider instanceof dhtmlXSlider){c.slider.enable()}if(/\s?dhxrb_disable_text_style/i.test(a.className)){a.className=a.className.replace(/\s?dhxrb_disable_text_style/i,"")}return true},remove:function(a){if(a.slider instanceof dhtmlXSlider){a.slider.unload();a.slider=null}},getValue:function(a){var c=null;if(a.slider instanceof dhtmlXSlider){c=a.slider.getValue()}return c},setValue:function(a,c){if(a.slider instanceof dhtmlXSlider){a.slider.setValue(c)}}};dhtmlXRibbon.prototype.items._extends=function(e,c){var a;for(a in c){e[a]=e[a]||c[a]}return e};dhtmlXRibbon.prototype._addNewLevel=function(e){var c,a;if(e.conf.mode=="rows"){c=e.contForItems.lastChild;if(c&&/dhxrb_block_rows/i.test(c.className)&&(c.childNodes.length<3)){a=document.createElement("div");a.className="dhxrb_block_row";c.appendChild(a)}else{c=document.createElement("div");c.className="dhxrb_block_rows";e.contForItems.appendChild(c);a=document.createElement("div");a.className="dhxrb_block_row";c.appendChild(a)}}else{var a=document.createElement("div");a.className="dhxrb_3rows_block";e.contForItems.appendChild(a)}};dhtmlXRibbon.prototype._attachEventForItem=function(a){if(typeof(window.addEventListener)=="function"){a.addEventListener("mouseover",this._doOnHighlight0,false);a.addEventListener("mouseout",this._doOffHighlight0,false);a.addEventListener("mousedown",this._doOnHighlight1,false);a.addEventListener("mouseup",this._doOffHighlight1,false);a.addEventListener("click",this._doOnClick,false)}else{a.attachEvent("onmouseover",this._doOnHighlight0);a.attachEvent("onmouseout",this._doOffHighlight0);a.attachEvent("onmousedown",this._doOnHighlight1);a.attachEvent("onmouseup",this._doOffHighlight1);a.attachEvent("onclick",this._doOnClick)}};dhtmlXRibbon.prototype._detachEventFromItem=function(a){if(typeof(window.addEventListener)=="function"){a.removeEventListener("mouseover",this._doOnHighlight0,false);a.removeEventListener("mouseout",this._doOffHighlight0,false);a.removeEventListener("mousedown",this._doOnHighlight1,false);a.removeEventListener("mouseup",this._doOffHighlight1,false);a.removeEventListener("click",this._doOnClick,false)}else{a.detachEvent("onmouseover",this._doOnHighlight0);a.detachEvent("onmouseout",this._doOffHighlight0);a.detachEvent("onmousedown",this._doOnHighlight1);a.detachEvent("onmouseup",this._doOffHighlight1);a.detachEvent("onclick",this._doOnClick)}};dhtmlXRibbon.prototype._attachEventsToInput=function(a){if(typeof(window.addEventListener)=="function"){a.addEventListener("focus",this._doOnFocus,false);a.addEventListener("blur",this._doOnBlur,false);a.addEventListener("change",this._doOnChange,false);a.addEventListener("keydown",this._doOnKeydown,false)}else{a.attachEvent("onfocus",this._doOnFocus);a.attachEvent("onblur",this._doOnBlur);a.attachEvent("onchange",this._doOnChange);a.attachEvent("onkeydown",this._doOnKeydown)}};dhtmlXRibbon.prototype._detachEventsFromInput=function(a){if(typeof(window.addEventListener)=="function"){a.removeEventListener("focus",this._doOnFocus,false);a.removeEventListener("blur",this._doOnBlur,false);a.removeEventListener("change",this._doOnChange,false);a.removeEventListener("keydown",this._doOnKeydown,false)}else{a.detachEvent("onfocus",this._doOnFocus);a.detachEvent("onblur",this._doOnBlur);a.detachEvent("onchange",this._doOnChange);a.detachEvent("onkeydown",this._doOnKeydown)}};dhtmlXRibbon.prototype._getContainerForSmallItem=function(e){var c=e.contForItems.lastChild,a=null;if(e.conf.mode=="rows"){if(c&&/\s?dhxrb_block_rows/i.test(c.className)){a=c.lastChild;if(!a){a=document.createElement("div");a.className="dhxrb_block_row";c.appendChild(a)}}else{c=document.createElement("div");c.className="dhxrb_block_rows";e.contForItems.appendChild(c);a=document.createElement("div");a.className="dhxrb_block_row";c.appendChild(a)}}else{if(c&&/dhxrb_3rows_block/i.test(c.className)&&(c.childNodes.length<3)){a=c}else{a=document.createElement("div");a.className="dhxrb_3rows_block";e.contForItems.appendChild(a)}}return a};dhtmlXRibbon.prototype._findItemByNode=function(a){while(a&&!a._dhx_ribbonId){a=a.parentNode}return a};dhtmlXRibbon.prototype._indexOf=function(a,g){var e,c;c=a.length;for(e=0;e0){this.cont.removeChild(this.cont.childNodes[0])}c=null;this.cont.dir="ltr";this.base=document.createElement("DIV");this.base.className="dhxtoolbar_float_left";this.cont.appendChild(this.base);if(window.dhx4.isIPad){this.cont.ontouchstart=function(g){g=g||event;if((String(g.target.tagName||"").toLowerCase()=="input")){return true}if(g.preventDefault){g.preventDefault()}else{g.returnValue=false}g.cancelBubble=true;return false}}this.setSkin(this.conf.skin);this.objPull={};this.anyUsed="none";this._genStr=function(g){var h="dhxId_";var l="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var j=0;j0){h.insertBefore(g,h.childNodes[0])}else{h.appendChild(g)}return g};this._setItemImage=function(l,h,g){if(g==true){l.imgEn=h}else{l.imgDis=h}if((!l.state&&g==true)||(l.state&&g==false)){return}var j=this._getObj(l.obj,"img");if(j==null){j=this._addImgObj(l.obj)}j.src=this.conf.icons_path+h};this._clearItemImage=function(j,g){if(g==true){j.imgEn=""}else{j.imgDis=""}if((!j.state&&g==true)||(j.state&&g==false)){return}var h=this._getObj(j.obj,"img");if(h!=null){h.parentNode.removeChild(h)}};this._setItemText=function(g,j){var h=this._getObj(g.obj,"div");if(j==null||j.length==0){if(h!=null){h.parentNode.removeChild(h)}return}if(h==null){h=document.createElement("DIV");h.className="dhxtoolbar_text";g.obj.appendChild(h)}h.innerHTML=j};this._getItemText=function(g){var h=this._getObj(g.obj,"div");if(h!=null){return h.innerHTML}return""};this._enableItem=function(h){if(h.state){return}h.state=true;if(this.objPull[h.id]["type"]=="buttonTwoState"&&this.objPull[h.id]["obj"]["pressed"]==true){h.obj.className="dhx_toolbar_btn dhxtoolbar_btn_pres";h.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_over"}else{h.obj.className="dhx_toolbar_btn dhxtoolbar_btn_def";h.obj.renderAs=h.obj.className}if(h.arw){h.arw.className=String(h.obj.className).replace("btn","arw")}var g=this._getObj(h.obj,"img");if(h.imgEn!=""){if(g==null){g=this._addImgObj(h.obj)}g.src=this.conf.icons_path+h.imgEn}else{if(g!=null){g.parentNode.removeChild(g)}}};this._disableItem=function(h){if(!h.state){return}h.state=false;h.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.objPull[h.id]["type"]=="buttonTwoState"&&h.obj.pressed?"pres_":"")+"dis";h.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";if(h.arw){h.arw.className=String(h.obj.className).replace("btn","arw")}var g=this._getObj(h.obj,"img");if(h.imgDis!=""){if(g==null){g=this._addImgObj(h.obj)}g.src=this.conf.icons_path+h.imgDis}else{if(g!=null){g.parentNode.removeChild(g)}}if(h.polygon!=null){if(h.polygon.style.display!="none"){window.dhx4.zim.clear(h.polygon._idd);h.polygon.style.display="none";if(h.polygon._ie6cover){h.polygon._ie6cover.style.display="none"}if(this.conf.skin=="dhx_terrace"){this._improveTerraceButtonSelect(h.id,true)}this.callEvent("onButtonSelectHide",[h.obj.idd])}}this.anyUsed="none"};this.clearAll=function(){for(var g in this.objPull){this._removeItem(String(g).replace(this.idPrefix,""))}};this._doOnClick=function(g){if(a&&a.forEachItem){a.forEachItem(function(j){if(a.objPull[a.idPrefix+j]["type"]=="buttonSelect"){var h=a.objPull[a.idPrefix+j];if(h.arw._skip===true){h.arw._skip=false}else{if(h.polygon.style.display!="none"){h.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";h.obj.className=h.obj.renderAs;h.arw.className=String(h.obj.renderAs).replace("btn","arw");a.anyUsed="none";window.dhx4.zim.clear(h.polygon._idd);h.polygon.style.display="none";if(h.polygon._ie6cover){h.polygon._ie6cover.style.display="none"}if(a.conf.skin=="dhx_terrace"){a._improveTerraceButtonSelect(h.id,true)}a.callEvent("onButtonSelectHide",[h.obj.idd])}}}})}};if(window.dhx4.isIPad){document.addEventListener("touchstart",this._doOnClick,false)}else{if(typeof(window.addEventListener)!="undefined"){window.addEventListener("mousedown",this._doOnClick,false)}else{document.body.attachEvent("onmousedown",this._doOnClick)}}if(this.conf.icons_size_autoload!=null){this.setIconSize(this.conf.icons_size_autoload);this.conf.icons_size_autoload=null}if(this.conf.items_autoload!=null){this.loadStruct(this.conf.items_autoload,this.conf.onload_autoload);this.conf.items_autoload=null}else{if(this.conf.json_autoload!=null){this.loadStruct(this.conf.json_autoload,this.conf.onload_autoload);this.conf.json_autoload=null}else{if(this.conf.xml_autoload!=null){this.loadStruct(this.conf.xml_autoload,this.conf.onload_autoload);this.conf.xml_autoload=null}}}if(this.conf.align_autostart!=this.conf.align){this.setAlign(this.conf.align_autostart);this.conf.align_autostart=null}if(typeof(this.conf.auto_onclick)=="function"){this.attachEvent("onClick",this.conf.auto_onclick)}else{if(typeof(this.conf.auto_onclick)=="string"&&typeof(window[this.conf.auto_onclick])=="function"){this.attachEvent("onClick",window[this.conf.auto_onclick])}}return this}dhtmlXToolbarObject.prototype.addSpacer=function(e){var c=this.idPrefix+e;if(this._spacer!=null){if(this._spacer.idd==e){return}if(this._spacer==this.objPull[c].obj.parentNode){var a=true;while(a){var l=this._spacer.childNodes[0].idd;this.base.appendChild(this._spacer.childNodes[0]);if(l==e||this._spacer.childNodes.length==0){if(this.objPull[c].arw!=null){this.base.appendChild(this.objPull[c].arw)}a=false}}this._spacer.idd=e;this._fixSpacer();return}if(this.base==this.objPull[c].obj.parentNode){var a=true;var j=(this.objPull[c].arw!=null);while(a){var g=this.base.childNodes.length-1;if(j==true){if(this.base.childNodes[g]==this.objPull[c].arw){a=false}}if(this.base.childNodes[g].idd==e){a=false}if(a){if(this._spacer.childNodes.length>0){this._spacer.insertBefore(this.base.childNodes[g],this._spacer.childNodes[0])}else{this._spacer.appendChild(this.base.childNodes[g])}}}this._spacer.idd=e;this._fixSpacer();return}}else{var h=null;for(var g=0;gh+1){this._spacer.appendChild(this.base.childNodes[h+1])}this.cont.appendChild(this._spacer);this._fixSpacer()}}if(this.conf.skin=="dhx_terrace"){this._improveTerraceSkin()}};dhtmlXToolbarObject.prototype.removeSpacer=function(){if(!this._spacer){return}while(this._spacer.childNodes.length>0){this.base.appendChild(this._spacer.childNodes[0])}this._spacer.parentNode.removeChild(this._spacer);this._spacer=null;if(this.conf.skin=="dhx_terrace"){this._improveTerraceSkin()}};dhtmlXToolbarObject.prototype._fixSpacer=function(){if(typeof(window.addEventListener)=="undefined"&&this._spacer!=null){this._spacer.style.borderLeft="1px solid #a4bed4";var a=this._spacer;window.setTimeout(function(){a.style.borderLeft="0px solid #a4bed4";a=null},1)}};dhtmlXToolbarObject.prototype.getType=function(e){var g=this.getParentId(e);if(g!=null){var c=null;var a=this.objPull[this.idPrefix+g]._listOptions[e];if(a!=null){if(a.sep!=null){c="buttonSelectSeparator"}else{c="buttonSelectButton"}}return c}else{if(this.objPull[this.idPrefix+e]==null){return null}return this.objPull[this.idPrefix+e]["type"]}};dhtmlXToolbarObject.prototype.getTypeExt=function(c){var a=this.getType(c);if(a=="buttonSelectButton"||a=="buttonSelectSeparator"){if(a=="buttonSelectButton"){a="button"}else{a="separator"}return a}return null};dhtmlXToolbarObject.prototype.inArray=function(e,c){for(var a=0;a0){g.obj.removeChild(g.obj.childNodes[0])}g.obj.parentNode.removeChild(g.obj);g.obj=null;g.id=null;g.type=null;g.state=null;g.enableItem=null;g.disableItem=null;g.isEnabled=null;g.setItemToolTipTemplate=null;g.getItemToolTipTemplate=null;g.setMaxValue=null;g.setMinValue=null;g.getMaxValue=null;g.getMinValue=null;g.setValue=null;g.getValue=null;g.showItem=null;g.hideItem=null;g.isVisible=null}if(e=="separator"){g.obj.onselectstart=null;g.obj.idd=null;g.obj.parentNode.removeChild(g.obj);g.obj=null;g.id=null;g.type=null;g.showItem=null;g.hideItem=null;g.isVisible=null}if(e=="text"){g.obj.onselectstart=null;g.obj.idd=null;g.obj.parentNode.removeChild(g.obj);g.obj=null;g.id=null;g.type=null;g.showItem=null;g.hideItem=null;g.isVisible=null;g.setWidth=null;g.setItemText=null;g.getItemText=null}e=null;g=null;this.objPull[this.idPrefix+h]=null;delete this.objPull[this.idPrefix+h]};(function(){var g="addListOption,removeListOption,showListOption,hideListOption,isListOptionVisible,enableListOption,disableListOption,isListOptionEnabled,setListOptionPosition,getListOptionPosition,setListOptionText,getListOptionText,setListOptionToolTip,getListOptionToolTip,setListOptionImage,getListOptionImage,clearListOptionImage,forEachListOption,getAllListOptions,setListOptionSelected,getListOptionSelected".split(",");var c=function(h){return function(r,l,j,o,n,m){r=this.idPrefix+r;if(this.objPull[r]==null){return}if(this.objPull[r]["type"]!="buttonSelect"){return}return this.objPull[r][h].call(this.objPull[r],l,j,o,n,m)}};for(var e=0;e":""),(c.text!=null?"
"+c.text+"
":""));var e=this;this.obj.onselectstart=function(h){h=h||event;if(h.preventDefault){h.preventDefault()}else{h.returnValue=false}};this.obj.onmouseover=function(){this._doOnMouseOver()};this.obj.onmouseout=function(){this._doOnMouseOut()};this.obj._doOnMouseOver=function(){this.allowClick=true;if(e.state==false){return}if(a.anyUsed!="none"){return}this.className="dhx_toolbar_btn dhxtoolbar_btn_over";this.renderAs=this.className};this.obj._doOnMouseOut=function(){this.allowClick=false;if(e.state==false){return}if(a.anyUsed!="none"){return}this.className="dhx_toolbar_btn dhxtoolbar_btn_def";this.renderAs=this.renderAs};this.obj.onclick=function(h){if(e.state==false){return}if(this.allowClick==false){return}h=h||event;var j=this.idd.replace(a.idPrefix,"");if(this.extAction){try{window[this.extAction](j)}catch(h){}}if(a&&a.callEvent){a.callEvent("onClick",[j])}};this.obj[window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(h){if(e.state==false){h=h||event;if(h.preventDefault){h.preventDefault()}else{h.returnValue=false}h.cancelBubble=true;return false}if(a.anyUsed!="none"){return}a.anyUsed=this.idd;this.className="dhx_toolbar_btn dhxtoolbar_btn_pres";this.pressed=true;this.onmouseover=function(){this._doOnMouseOver()};this.onmouseout=function(){a.anyUsed="none";this._doOnMouseOut()};return false};this.obj[window.dhx4.isIPad?"ontouchend":"onmouseup"]=function(l){if(e.state==false){return}if(a.anyUsed!="none"){if(a.anyUsed!=this.idd){return}}var j=a.anyUsed;this._doOnMouseUp();if(window.dhx4.isIPad&&j!="none"){if(this.extAction){var h=this;window.setTimeout(function(){try{window[h.extAction](g)}catch(m){}h=null},1)}a.callEvent("onClick",[this.idd.replace(a.idPrefix,"")])}};if(window.dhx4.isIPad){this.obj.ontouchmove=function(h){this._doOnMouseUp()}}this.obj._doOnMouseUp=function(){a.anyUsed="none";this.className=this.renderAs;this.pressed=false};this.obj._doOnMouseUpOnceAnywhere=function(){this._doOnMouseUp();this.onmouseover=function(){this._doOnMouseOver()};this.onmouseout=function(){this._doOnMouseOut()}};a.base.appendChild(this.obj);this.enableItem=function(){a._enableItem(this)};this.disableItem=function(){a._disableItem(this)};this.isEnabled=function(){return this.state};this.showItem=function(){this.obj.style.display=""};this.hideItem=function(){this.obj.style.display="none"};this.isVisible=function(){return(this.obj.style.display=="")};this.setItemText=function(h){a._setItemText(this,h)};this.getItemText=function(){return a._getItemText(this)};this.setItemImage=function(h){a._setItemImage(this,h,true)};this.clearItemImage=function(){a._clearItemImage(this,true)};this.setItemImageDis=function(h){a._setItemImage(this,h,false)};this.clearItemImageDis=function(){a._clearItemImage(this,false)};this.setItemToolTip=function(h){this.obj.title=h};this.getItemToolTip=function(){return this.obj.title};return this};dhtmlXToolbarObject.prototype._buttonSelectObject=function(e,j,h){this.id=e.idPrefix+j;this.state=(h.enabled!=null?(h.enabled=="true"?true:false):true);this.imgEn=(h.img||"");this.imgDis=(h.imgdis||"");this.img=(this.state?(this.imgEn!=""?this.imgEn:""):(this.imgDis!=""?this.imgDis:""));this.mode=(h.mode||"button");if(this.mode=="select"){this.openAll=true;this.renderSelect=false;if(!h.text||h.text.length==0){h.text=" "}}else{this.openAll=(window.dhx4.s2b(h.openAll)==true);this.renderSelect=(h.renderSelect==null?true:window.dhx4.s2b(h.renderSelect))}this.maxOpen=(!isNaN(h.maxOpen?h.maxOpen:"")?h.maxOpen:null);this._maxOpenTest=function(){if(!isNaN(this.maxOpen)){if(!e._sbw){var m=document.createElement("DIV");m.className="dhxtoolbar_maxopen_test";document.body.appendChild(m);var l=document.createElement("DIV");l.className="dhxtoolbar_maxopen_test2";m.appendChild(l);e._sbw=m.offsetWidth-l.offsetWidth;m.removeChild(l);l=null;document.body.removeChild(m);m=null}}};this._maxOpenTest();this.obj=document.createElement("DIV");this.obj.allowClick=false;this.obj.extAction=(h.action||null);this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.state?"def":"dis");this.obj.style.display=(h.hidden!=null?"none":"");this.obj.renderAs=this.obj.className;this.obj.onselectstart=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}};this.obj.idd=String(j);this.obj.title=(h.title||"");this.obj.pressed=false;this.callEvent=false;this.obj.innerHTML=e._rtlParseBtn((this.img!=""?"":""),(h.text!=null?"
"+h.text+"
":""));e.base.appendChild(this.obj);this.arw=document.createElement("DIV");this.arw.className="dhx_toolbar_arw dhxtoolbar_btn_"+(this.state?"def":"dis");this.arw.style.display=this.obj.style.display;this.arw.innerHTML="
 
";this.arw.title=this.obj.title;this.arw.onselectstart=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}};e.base.appendChild(this.arw);var a=this;this.obj.onmouseover=function(l){l=l||event;if(e.anyUsed!="none"){return}if(!a.state){return}a.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_over";a.obj.className=a.obj.renderAs;a.arw.className=String(a.obj.renderAs).replace("btn","arw")};this.obj.onmouseout=function(){a.obj.allowClick=false;if(e.anyUsed!="none"){return}if(!a.state){return}a.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";a.obj.className=a.obj.renderAs;a.arw.className=String(a.obj.renderAs).replace("btn","arw");a.callEvent=false};this.arw.onmouseover=this.obj.onmouseover;this.arw.onmouseout=this.obj.onmouseout;if(this.openAll==true){}else{this.obj.onclick=function(l){l=l||event;if(!a.obj.allowClick){return}if(!a.state){return}if(e.anyUsed!="none"){return}var m=a.obj.idd.replace(e.idPrefix,"");if(a.obj.extAction){try{window[a.obj.extAction](m)}catch(l){}}e.callEvent("onClick",[m])};this.obj[window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(l){l=l||event;if(e.anyUsed!="none"){return}if(!a.state){return}a.obj.allowClick=true;a.obj.className="dhx_toolbar_btn dhxtoolbar_btn_pres";a.arw.className="dhx_toolbar_arw dhxtoolbar_btn_pres";a.callEvent=true};this.obj[window.dhx4.isIPad?"ontouchend":"onmouseup"]=function(m){m=m||event;m.cancelBubble=true;if(e.anyUsed!="none"){return}if(!a.state){return}a.obj.className=a.obj.renderAs;a.arw.className=String(a.obj.renderAs).replace("btn","arw");if(window.dhx4.isIPad){if(this.extAction){var l=this;window.setTimeout(function(){try{window[l.extAction](n)}catch(o){}l=null},1)}if(a.callEvent){var n=a.obj.idd.replace(e.idPrefix,"");e.callEvent("onClick",[n])}}}}if(window.dhx4.isIPad){this.obj.ontouchmove=this.obj.onmouseout}this.arw[window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(n){n=n||event;var w=(this.className.indexOf("dhx_toolbar_arw")===0?this:this.nextSibling);if(w._skip){n=n||event;n.cancelBubble=true}else{w._skip=true}w=null;if(!a.state){return}if(e.anyUsed==a.obj.idd){a.obj.className=a.obj.renderAs;a.arw.className=String(a.obj.renderAs).replace("btn","arw");e.anyUsed="none";window.dhx4.zim.clear(a.polygon._idd);a.polygon.style.display="none";if(a.polygon._ie6cover){a.polygon._ie6cover.style.display="none"}if(e.conf.skin=="dhx_terrace"){e._improveTerraceButtonSelect(a.id,true)}e.callEvent("onButtonSelectHide",[a.obj.idd])}else{if(e.anyUsed!="none"){if(e.objPull[e.idPrefix+e.anyUsed]["type"]=="buttonSelect"){var v=e.objPull[e.idPrefix+e.anyUsed];if(v.polygon.style.display!="none"){v.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";v.obj.className=v.obj.renderAs;v.arw.className=String(a.obj.renderAs).replace("btn","arw");window.dhx4.zim.clear(v.polygon._idd);v.polygon.style.display="none";if(v.polygon._ie6cover){v.polygon._ie6cover.style.display="none"}if(e.conf.skin=="dhx_terrace"){e._improveTerraceButtonSelect(v.id,true)}e.callEvent("onButtonSelectHide",[v.obj.idd])}}}a.obj.className="dhx_toolbar_btn dhxtoolbar_btn_over";a.arw.className="dhx_toolbar_arw dhxtoolbar_btn_pres";e.anyUsed=a.obj.idd;a.polygon.style.top="0px";a.polygon.style.visibility="hidden";a.polygon.style.zIndex=window.dhx4.zim.reserve(a.polygon._idd);a.polygon.style.display="";if(e.conf.skin=="dhx_terrace"){e._improveTerraceButtonSelect(a.id,false)}a._fixMaxOpenHeight(a.maxOpen||null);e._autoDetectVisibleArea();var o=window.dhx4.absTop(a.obj)+a.obj.offsetHeight+e.conf.sel_ofs_y;var s=a.polygon.offsetHeight;if(o+s>e.tY2){var r=(a.maxOpen!=null?Math.floor((e.tY2-o)/22):0);if(r>=1){a._fixMaxOpenHeight(r)}else{o=window.dhx4.absTop(a.obj)-s-e.conf.sel_ofs_y;if(o<0){o=0}}}a.polygon.style.top=o+"px";if(e.rtl){a.polygon.style.left=window.dhx4.absLeft(a.obj)+a.obj.offsetWidth-a.polygon.offsetWidth+e.conf.sel_ofs_x+"px"}else{var m=document.body.scrollLeft;var l=m+(window.innerWidth||document.body.clientWidth);var u=window.dhx4.absLeft(a.obj)+e.conf.sel_ofs_x;if(u+a.polygon.offsetWidth>l){u=window.dhx4.absLeft(a.arw)+a.arw.offsetWidth-a.polygon.offsetWidth}a.polygon.style.left=Math.max(u,5)+"px"}a.polygon.style.visibility="visible";if(a.polygon._ie6cover){a.polygon._ie6cover.style.left=a.polygon.style.left;a.polygon._ie6cover.style.top=a.polygon.style.top;a.polygon._ie6cover.style.width=a.polygon.offsetWidth+"px";a.polygon._ie6cover.style.height=a.polygon.offsetHeight+"px";a.polygon._ie6cover.style.display=""}e.callEvent("onButtonSelectShow",[a.obj.idd])}return false};this.arw.onclick=function(l){l=l||event;l.cancelBubble=true};this.arw[window.dhx4.isIPad?"ontouchend":"onmouseup"]=function(l){l=l||event;l.cancelBubble=true};if(this.openAll===true){this.obj.onclick=this.arw.onclick;this.obj.onmousedown=this.arw.onmousedown;this.obj.onmouseup=this.arw.onmouseup;if(window.dhx4.isIPad){this.obj.ontouchstart=this.arw.ontouchstart;this.obj.ontouchend=this.arw.ontouchend}}this.obj.iddPrefix=e.idPrefix;this._listOptions={};this._fixMaxOpenHeight=function(r){var o="auto";var n=false;if(r!==null){var m=0;for(var l in this._listOptions){m++}if(m>r){this._ph=22*r;o=this._ph+"px"}else{n=true}}this.polygon.style.width="auto";this.polygon.style.height="auto";if(!n&&a.maxOpen!=null){this.polygon.style.width=this.p_tbl.offsetWidth+e._sbw+"px";this.polygon.style.height=o}};this._separatorButtonSelectObject=function(n,l,m){this.obj={};this.obj.tr=document.createElement("TR");this.obj.tr.className="tr_sep";this.obj.tr.onselectstart=function(o){o=o||event;if(o.preventDefault){o.preventDefault()}else{o.returnValue=false}return false};this.obj.td=document.createElement("TD");this.obj.td.colSpan="2";this.obj.td.className="td_btn_sep";this.obj.td.onselectstart=function(o){o=o||event;if(o.preventDefault){o.preventDefault()}else{o.returnValue=false}return false};if(isNaN(m)){m=a.p_tbody.childNodes.length+1}else{if(m<1){m=1}}if(m>a.p_tbody.childNodes.length){a.p_tbody.appendChild(this.obj.tr)}else{a.p_tbody.insertBefore(this.obj.tr,a.p_tbody.childNodes[m-1])}this.obj.tr.appendChild(this.obj.td);this.obj.sep=document.createElement("DIV");this.obj.sep.className="btn_sep";this.obj.sep.onselectstart=function(o){o=o||event;if(o.preventDefault){o.preventDefault()}else{o.returnValue=false}return false};this.obj.td.appendChild(this.obj.sep);a._listOptions[n]=this.obj;return this};this._buttonButtonSelectObject=function(r,n,o){var m=true;if(typeof(n.enabled)!="undefined"){m=window.dhx4.s2b(n.enabled)}else{if(typeof(n.disabled)!="undefined"){m=window.dhx4.s2b(n.disabled)}}this.obj={};this.obj.tr=document.createElement("TR");this.obj.tr.en=m;this.obj.tr.extAction=(n.action||null);this.obj.tr._selected=(n.selected!=null);this.obj.tr.className="tr_btn"+(this.obj.tr.en?(this.obj.tr._selected&&a.renderSelect?" tr_btn_selected":""):" tr_btn_disabled");this.obj.tr.onselectstart=function(s){s=s||event;if(s.preventDefault){s.preventDefault()}else{s.returnValue=false}return false};this.obj.tr.idd=String(r);if(isNaN(o)){o=a.p_tbody.childNodes.length+1}else{if(o<1){o=1}}if(o>a.p_tbody.childNodes.length){a.p_tbody.appendChild(this.obj.tr)}else{a.p_tbody.insertBefore(this.obj.tr,a.p_tbody.childNodes[o-1])}this.obj.td_a=document.createElement("TD");this.obj.td_a.className="td_btn_img";this.obj.td_a.onselectstart=function(s){s=s||event;if(s.preventDefault){s.preventDefault()}else{s.returnValue=false}return false};this.obj.td_b=document.createElement("TD");this.obj.td_b.className="td_btn_txt";this.obj.td_b.onselectstart=function(s){s=s||event;if(s.preventDefault){s.preventDefault()}else{s.returnValue=false}return false};if(e.rtl){this.obj.tr.appendChild(this.obj.td_b);this.obj.tr.appendChild(this.obj.td_a)}else{this.obj.tr.appendChild(this.obj.td_a);this.obj.tr.appendChild(this.obj.td_b)}if(n.img!=null){this.obj.td_a.innerHTML="";this.obj.tr._img=n.img}else{this.obj.td_a.innerHTML=" "}var l=(n.text!=null?n.text:(n.itemText||""));this.obj.td_b.innerHTML="
"+l+"
";this.obj.tr[window.dhx4.isIPad?"ontouchstart":"onmouseover"]=function(){if(!this.en||(this._selected&&a.renderSelect)){return}this.className="tr_btn tr_btn_over"};this.obj.tr.onmouseout=function(){if(!this.en){return}if(this._selected&&a.renderSelect){if(String(this.className).search("tr_btn_selected")==-1){this.className="tr_btn tr_btn_selected"}}else{this.className="tr_btn"}};this.obj.tr[window.dhx4.isIPad?"ontouchend":"onclick"]=function(s){s=s||event;s.cancelBubble=true;if(!this.en){return}a.setListOptionSelected(this.idd.replace(e.idPrefix,""));a.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";a.obj.className=a.obj.renderAs;a.arw.className=String(a.obj.renderAs).replace("btn","arw");window.dhx4.zim.clear(a.polygon._idd);a.polygon.style.display="none";if(a.polygon._ie6cover){a.polygon._ie6cover.style.display="none"}if(e.conf.skin=="dhx_terrace"){e._improveTerraceButtonSelect(a.id,true)}e.anyUsed="none";e.callEvent("onButtonSelectHide",[a.obj.idd]);var u=this.idd.replace(e.idPrefix,"");if(this.extAction){try{window[this.extAction](u)}catch(s){}}e.callEvent("onClick",[u])};a._listOptions[r]=this.obj;return this};this.polygon=document.createElement("DIV");this.polygon.dir="ltr";this.polygon.style.display="none";this.polygon.className="dhx_toolbar_poly_"+e.conf.skin+" dhxtoolbar_icons_"+e.conf.iconSize;this.polygon.onselectstart=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}};this.polygon.onmousedown=function(l){l=l||event;l.cancelBubble=true};this.polygon.style.overflowY="auto";this.polygon._idd=window.dhx4.newId();if(window.dhx4.isIPad){this.polygon.ontouchstart=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}l.cancelBubble=true;return false}}this.p_tbl=document.createElement("TABLE");this.p_tbl.className="buttons_cont";this.p_tbl.cellSpacing="0";this.p_tbl.cellPadding="0";this.p_tbl.border="0";this.polygon.appendChild(this.p_tbl);this.p_tbody=document.createElement("TBODY");this.p_tbl.appendChild(this.p_tbody);if(h.options!=null){for(var g=0;g0){l.td_a.removeChild(l.td_a.childNodes[0])}while(l.td_b.childNodes.length>0){l.td_b.removeChild(l.td_b.childNodes[0])}l.tr.onselectstart=null;l.tr.onmouseover=null;l.tr.onmouseout=null;l.tr.onclick=null;while(l.tr.childNodes.length>0){l.tr.removeChild(l.tr.childNodes[0])}l.tr.parentNode.removeChild(l.tr);l.td_a=null;l.td_b=null;l.tr=null}else{l.sep.onselectstart=null;l.td.onselectstart=null;l.tr.onselectstart=null;while(l.td.childNodes.length>0){l.td.removeChild(l.td.childNodes[0])}while(l.tr.childNodes.length>0){l.tr.removeChild(l.tr.childNodes[0])}l.tr.parentNode.removeChild(l.tr);l.sep=null;l.td=null;l.tr=null}l=null;this._listOptions[n]=null;try{delete this._listOptions[n]}catch(m){}};this.showListOption=function(l){if(!this._isListButton(l,true)){return}this._listOptions[l].tr.style.display=""};this.hideListOption=function(l){if(!this._isListButton(l,true)){return}this._listOptions[l].tr.style.display="none"};this.isListOptionVisible=function(l){if(!this._isListButton(l,true)){return}return(this._listOptions[l].tr.style.display!="none")};this.enableListOption=function(l){if(!this._isListButton(l)){return}this._listOptions[l].tr.en=true;this._listOptions[l].tr.className="tr_btn"+(this._listOptions[l].tr._selected&&e.renderSelect?" tr_btn_selected":"")};this.disableListOption=function(l){if(!this._isListButton(l)){return}this._listOptions[l].tr.en=false;this._listOptions[l].tr.className="tr_btn tr_btn_disabled"};this.isListOptionEnabled=function(l){if(!this._isListButton(l)){return}return this._listOptions[l].tr.en};this.setListOptionPosition=function(n,m){if(!this._listOptions[n]||this.getListOptionPosition(n)==m||isNaN(m)){return}if(m<1){m=1}var l=this._listOptions[n].tr;this.p_tbody.removeChild(l);if(m>this.p_tbody.childNodes.length){this.p_tbody.appendChild(l)}else{this.p_tbody.insertBefore(l,this.p_tbody.childNodes[m-1])}l=null};this.getListOptionPosition=function(n){var m=-1;if(!this._listOptions[n]){return m}for(var l=0;l";m=null};this.getListOptionImage=function(n){if(!this._isListButton(n)){return}var m=this._listOptions[n].tr.childNodes[(e.rtl?1:0)];var l=null;if(m.childNodes.length>0){l=m.childNodes[0].src}m=null;return l};this.clearListOptionImage=function(m){if(!this._isListButton(m)){return}var l=this._listOptions[m].tr.childNodes[(e.rtl?1:0)];while(l.childNodes.length>0){l.removeChild(l.childNodes[0])}l.innerHTML=" ";l=null};this.setListOptionText=function(m,l){if(!this._isListButton(m)){return}this._listOptions[m].tr.childNodes[(e.rtl?0:1)].childNodes[0].innerHTML=l};this.getListOptionText=function(l){if(!this._isListButton(l)){return}return this._listOptions[l].tr.childNodes[(e.rtl?0:1)].childNodes[0].innerHTML};this.setListOptionToolTip=function(m,l){if(!this._isListButton(m)){return}this._listOptions[m].tr.title=l};this.getListOptionToolTip=function(l){if(!this._isListButton(l)){return}return this._listOptions[l].tr.title};this.forEachListOption=function(m){for(var l in this._listOptions){m(l)}};this.getAllListOptions=function(){var m=new Array();for(var l in this._listOptions){m[m.length]=l}return m};this.setListOptionSelected=function(n){for(var l in this._listOptions){var m=this._listOptions[l];if(m.td_a!=null&&m.td_b!=null&&m.tr.en){if(l==n){m.tr._selected=true;m.tr.className="tr_btn"+(this.renderSelect?" tr_btn_selected":"");if(this.mode=="select"){if(m.tr._img){this.setItemImage(m.tr._img)}else{this.clearItemImage()}this.setItemText(this.getListOptionText(n))}}else{m.tr._selected=false;m.tr.className="tr_btn"}}m=null}};this.getListOptionSelected=function(){var m=null;for(var l in this._listOptions){if(this._listOptions[l].tr._selected==true){m=l}}return m};this._isListButton=function(m,l){if(this._listOptions[m]==null){return false}if(!l&&this._listOptions[m].tr.className=="tr_sep"){return false}return true};this.setMaxOpen=function(l){this._ph=null;if(typeof(l)=="number"){this.maxOpen=l;this._maxOpenTest();return}this.maxOpen=null};if(h.width){this.setWidth(h.width)}if(this.mode=="select"&&typeof(h.selected)!="undefined"){this.setListOptionSelected(h.selected)}return this};dhtmlXToolbarObject.prototype._buttonInputObject=function(e,h,g){this.id=e.idPrefix+h;this.obj=document.createElement("DIV");this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_def";this.obj.style.display=(g.hidden!=null?"none":"");this.obj.idd=String(h);this.obj.w=(g.width!=null?g.width:100);this.obj.title=(g.title!=null?g.title:"");this.obj.innerHTML="";var c=e;var a=this;this.obj.childNodes[0].onkeydown=function(j){j=j||event;if(j.keyCode==13){c.callEvent("onEnter",[a.obj.idd,this.value])}};e.base.appendChild(this.obj);this.enableItem=function(){this.obj.childNodes[0].disabled=false};this.disableItem=function(){this.obj.childNodes[0].disabled=true};this.isEnabled=function(){return(!this.obj.childNodes[0].disabled)};this.showItem=function(){this.obj.style.display=""};this.hideItem=function(){this.obj.style.display="none"};this.isVisible=function(){return(this.obj.style.display!="none")};this.setValue=function(j){this.obj.childNodes[0].value=j};this.getValue=function(){return this.obj.childNodes[0].value};this.setWidth=function(j){this.obj.w=j;this.obj.childNodes[0].style.width=this.obj.w+"px"};this.getWidth=function(){return this.obj.w};this.setItemToolTip=function(j){this.obj.title=j};this.getItemToolTip=function(){return this.obj.title};this.getInput=function(){return this.obj.firstChild};if(typeof(g.enabled)!="undefined"&&window.dhx4.s2b(g.enabled)==false){this.disableItem()}return this};dhtmlXToolbarObject.prototype._buttonTwoStateObject=function(a,g,c){this.id=a.idPrefix+g;this.state=(c.enabled!=null?false:true);this.imgEn=(c.img!=null?c.img:"");this.imgDis=(c.imgdis!=null?c.imgdis:"");this.img=(this.state?(this.imgEn!=""?this.imgEn:""):(this.imgDis!=""?this.imgDis:""));this.obj=document.createElement("DIV");this.obj.pressed=(c.selected!=null);this.obj.extAction=(c.action||null);this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.obj.pressed?"pres"+(this.state?"":"_dis"):(this.state?"def":"dis"));this.obj.style.display=(c.hidden!=null?"none":"");this.obj.renderAs=this.obj.className;this.obj.idd=String(g);this.obj.title=(c.title||"");if(this.obj.pressed){this.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_over"}this.obj.innerHTML=a._rtlParseBtn((this.img!=""?"":""),(c.text!=null?"
"+c.text+"
":""));a.base.appendChild(this.obj);var e=this;this.obj.onselectstart=function(h){h=h||event;if(h.preventDefault){h.preventDefault()}else{h.returnValue=false}};this.obj.onmouseover=function(){this._doOnMouseOver()};this.obj.onmouseout=function(){this._doOnMouseOut()};this.obj._doOnMouseOver=function(){if(e.state==false){return}if(a.anyUsed!="none"){return}if(this.pressed){this.renderAs="dhx_toolbar_btn dhxtoolbar_btn_over";return}this.className="dhx_toolbar_btn dhxtoolbar_btn_over";this.renderAs=this.className};this.obj._doOnMouseOut=function(){if(e.state==false){return}if(a.anyUsed!="none"){return}if(this.pressed){this.renderAs="dhx_toolbar_btn dhxtoolbar_btn_def";return}this.className="dhx_toolbar_btn dhxtoolbar_btn_def";this.renderAs=this.className};this.obj[window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(h){if(a.checkEvent("onBeforeStateChange")){if(!a.callEvent("onBeforeStateChange",[this.idd.replace(a.idPrefix,""),this.pressed])){return}}if(e.state==false){return}if(a.anyUsed!="none"){return}this.pressed=!this.pressed;this.className=(this.pressed?"dhx_toolbar_btn dhxtoolbar_btn_pres":this.renderAs);var j=this.idd.replace(a.idPrefix,"");if(this.extAction){try{window[this.extAction](j,this.pressed)}catch(h){}}a.callEvent("onStateChange",[j,this.pressed]);return false};this.setItemState=function(h,l){if(this.obj.pressed!=h){if(h==true){this.obj.pressed=true;this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_pres"+(this.state?"":"_dis");this.obj.renderAs="dhx_toolbar_btn dhxtoolbar_btn_over"}else{this.obj.pressed=false;this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.state?"def":"dis");this.obj.renderAs=this.obj.className}if(l==true){var m=this.obj.idd.replace(a.idPrefix,"");if(this.obj.extAction){try{window[this.obj.extAction](m,this.obj.pressed)}catch(j){}}a.callEvent("onStateChange",[m,this.obj.pressed])}}};this.getItemState=function(){return this.obj.pressed};this.enableItem=function(){a._enableItem(this)};this.disableItem=function(){a._disableItem(this)};this.isEnabled=function(){return this.state};this.showItem=function(){this.obj.style.display=""};this.hideItem=function(){this.obj.style.display="none"};this.isVisible=function(){return(this.obj.style.display=="")};this.setItemText=function(h){a._setItemText(this,h)};this.getItemText=function(){return a._getItemText(this)};this.setItemImage=function(h){a._setItemImage(this,h,true)};this.clearItemImage=function(){a._clearItemImage(this,true)};this.setItemImageDis=function(h){a._setItemImage(this,h,false)};this.clearItemImageDis=function(){a._clearItemImage(this,false)};this.setItemToolTip=function(h){this.obj.title=h};this.getItemToolTip=function(){return this.obj.title};return this};dhtmlXToolbarObject.prototype._sliderObject=function(g,j,h){this.id=g.idPrefix+j;this.state=(h.enabled!=null?(h.enabled=="true"?true:false):true);this.obj=document.createElement("DIV");this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_"+(this.state?"def":"dis");this.obj.style.display=(h.hidden!=null?"none":"");this.obj.onselectstart=function(l){l=l||event;if(l.preventDefault){l.preventDefault()}else{l.returnValue=false}};this.obj.idd=String(j);this.obj.len=(h.length!=null?Number(h.length):50);this.obj.innerHTML="
"+(h.textMin||"")+"
"+(h.textMax||"")+"
";g.base.appendChild(this.obj);var a=this;this.pen=document.createElement("DIV");this.pen.className="dhxtoolbar_sl_pen";this.obj.appendChild(this.pen);var e=this.pen;this.label=document.createElement("DIV");this.label.dir="ltr";this.label.className="dhx_toolbar_slider_label_"+g.conf.skin+(g.rtl?"_rtl":"");this.label.style.display="none";this.label.tip=(h.toolTip||"%v");this.label._zi=window.dhx4.newId();document.body.appendChild(this.label);var c=this.label;this.pen.valueMin=(h.valueMin!=null?Number(h.valueMin):0);this.pen.valueMax=(h.valueMax!=null?Number(h.valueMax):100);if(this.pen.valueMin>this.pen.valueMax){this.pen.valueMin=this.pen.valueMax}this.pen.valueNow=(h.valueNow!=null?Number(h.valueNow):this.pen.valueMax);if(this.pen.valueNow>this.pen.valueMax){this.pen.valueNow=this.pen.valueMax}if(this.pen.valueNowwindow.dhx4.absLeft(e)+Math.round(e.offsetWidth/2)&&e.nowX==e.maxX){return}e.newNowX=e.nowX+n;if(e.newNowXe.maxX){e.newNowX=e.maxX}e.nowX=e.newNowX;e.style.left=e.nowX+"px";e.initXY=l;e.newValueNow=Math.round((e.valueMax-e.valueMin)*(e.newNowX-e.minX)/(e.maxX-e.minX)+e.valueMin);if(c.tip!=""){c.innerHTML=c.tip.replace(/%v/gi,e.newValueNow);c.style.left=Math.round(window.dhx4.absLeft(e)+e.offsetWidth/2-c.offsetWidth/2)+"px";c.style.top=window.dhx4.absTop(e)-c.offsetHeight-3+"px"}m.cancelBubble=true;if(m.preventDefault){m.preventDefault()}else{m.returnValue=false}return false};this.pen._doOnMouseMoveEnd=function(){if(!e.allowMove){return}e.className="dhxtoolbar_sl_pen";e.allowMove=false;e.nowX=e.newNowX;e.valueNow=e.newValueNow;if(c.tip!=""){c.style.display="none";window.dhx4.zim.clear(c._zi)}g.callEvent("onValueChange",[a.obj.idd.replace(g.idPrefix,""),e.valueNow])};if(window.dhx4.isIPad){document.addEventListener("touchmove",e._doOnMouseMoveStart,false);document.addEventListener("touchend",e._doOnMouseMoveEnd,false)}else{if(typeof(window.addEventListener)!="undefined"){window.addEventListener("mousemove",e._doOnMouseMoveStart,false);window.addEventListener("mouseup",e._doOnMouseMoveEnd,false)}else{document.body.attachEvent("onmousemove",e._doOnMouseMoveStart);document.body.attachEvent("onmouseup",e._doOnMouseMoveEnd)}}this.enableItem=function(){if(this.state){return}this.state=true;this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_def"};this.disableItem=function(){if(!this.state){return}this.state=false;this.obj.className="dhx_toolbar_btn dhxtoolbar_btn_dis"};this.isEnabled=function(){return this.state};this.showItem=function(){this.obj.style.display=""};this.hideItem=function(){this.obj.style.display="none"};this.isVisible=function(){return(this.obj.style.display=="")};this.setValue=function(l,m){l=Number(l);if(lthis.pen.valueMax){l=this.pen.valueMax}this.pen.valueNow=l;this.pen._definePos();if(m==true){g.callEvent("onValueChange",[this.obj.idd.replace(g.idPrefix,""),this.pen.valueNow])}};this.getValue=function(){return this.pen.valueNow};this.setMinValue=function(m,l){m=Number(m);if(m>this.pen.valueMax){return}this.obj.childNodes[0].innerHTML=l;this.obj.childNodes[0].style.display=(l.length>0?"":"none");this.pen.valueMin=m;if(this.pen.valueNow0?"":"none");this.pen.valueMax=m;if(this.pen.valueNow>this.pen.valueMax){this.pen.valueNow=this.pen.valueMax}this.pen._detectLimits();this.pen._definePos()};this.getMinValue=function(){var l=this.obj.childNodes[0].innerHTML;var m=this.pen.valueMin;return new Array(m,l)};this.getMaxValue=function(){var l=this.obj.childNodes[4].innerHTML;var m=this.pen.valueMax;return new Array(m,l)};this.setItemToolTipTemplate=function(l){this.label.tip=l};this.getItemToolTipTemplate=function(){return this.label.tip};return this};dhtmlXToolbarObject.prototype.unload=function(){if(this.conf.isIPad){document.removeEventListener("touchstart",this._doOnClick,false)}else{if(typeof(window.addEventListener)=="function"){window.removeEventListener("mousedown",this._doOnClick,false)}else{document.body.detachEvent("onmousedown",this._doOnClick)}}this._doOnClick=null;this.clearAll();this.objPull=null;if(this._xmlLoader){this._xmlLoader.destructor();this._xmlLoader=null}while(this.base.childNodes.length>0){this.base.removeChild(this.base.childNodes[0])}this.cont.removeChild(this.base);this.base=null;while(this.cont.childNodes.length>0){this.cont.removeChild(this.cont.childNodes[0])}this.cont.className="";this.cont=null;window.dhx4._enableDataLoading(this,null,null,null,"clear");window.dhx4._eventable(this,"clear");this.tX1=null;this.tX2=null;this.tY1=null;this.tY2=null;this.anyUsed=null;this.idPrefix=null;this.rootTypes=null;this._rtl=null;this._rtlParseBtn=null;this.setRTL=null;this._sbw=null;this._getObj=null;this._addImgObj=null;this._setItemImage=null;this._clearItemImage=null;this._setItemText=null;this._getItemText=null;this._enableItem=null;this._disableItem=null;this._xmlParser=null;this._addItemToStorage=null;this._genStr=null;this._addItem=null;this._getPosition=null;this._setPosition=null;this._getIdByPosition=null;this._separatorObject=null;this._textObject=null;this._buttonObject=null;this._buttonSelectObject=null;this._buttonInputObject=null;this._buttonTwoStateObject=null;this._sliderObject=null;this._autoDetectVisibleArea=null;this._removeItem=null;this.setAlign=null;this.setSkin=null;this.setIconsPath=null;this.setIconPath=null;this.loadXML=null;this.loadXMLString=null;this.clearAll=null;this.addSpacer=null;this.removeSpacer=null;this.getType=null;this.getTypeExt=null;this.inArray=null;this.getParentId=null;this.addButton=null;this.addText=null;this.addButtonSelect=null;this.addButtonTwoState=null;this.addSeparator=null;this.addSlider=null;this.addInput=null;this.forEachItem=null;this.showItem=null;this.hideItem=null;this.isVisible=null;this.enableItem=null;this.disableItem=null;this.isEnabled=null;this.setItemText=null;this.getItemText=null;this.setItemToolTip=null;this.getItemToolTip=null;this.setItemImage=null;this.setItemImageDis=null;this.clearItemImage=null;this.clearItemImageDis=null;this.setItemState=null;this.getItemState=null;this.setItemToolTipTemplate=null;this.getItemToolTipTemplate=null;this.setValue=null;this.getValue=null;this.setMinValue=null;this.getMinValue=null;this.setMaxValue=null;this.getMaxValue=null;this.setWidth=null;this.getWidth=null;this.getPosition=null;this.setPosition=null;this.removeItem=null;this.addListOption=null;this.removeListOption=null;this.showListOption=null;this.hideListOption=null;this.isListOptionVisible=null;this.enableListOption=null;this.disableListOption=null;this.isListOptionEnabled=null;this.setListOptionPosition=null;this.getListOptionPosition=null;this.setListOptionText=null;this.getListOptionText=null;this.setListOptionToolTip=null;this.getListOptionToolTip=null;this.setListOptionImage=null;this.getListOptionImage=null;this.clearListOptionImage=null;this.forEachListOption=null;this.getAllListOptions=null;this.setListOptionSelected=null;this.getListOptionSelected=null;this.unload=null;this.setUserData=null;this.getUserData=null;this.setMaxOpen=null;this.items=null;this.conf=null};dhtmlXToolbarObject.prototype._autoDetectVisibleArea=function(){var a=window.dhx4.screenDim();this.tX1=a.left;this.tX2=a.right;this.tY1=a.top;this.tY2=a.bottom};dhtmlXToolbarObject.prototype._initObj=function(c){for(var a=0;a=0&&g[n][c-1]!=null&&h[g[n][c-1].type])){j=true}}o.node.style.borderRightWidth=(r?"1px":"0px");o.node.style.borderTopRightRadius=o.node.style.borderBottomRightRadius=(r?this.conf.terrace_radius:"0px");if(o.type=="buttonSelect"){o.node.previousSibling.style.borderTopLeftRadius=o.node.previousSibling.style.borderBottomLeftRadius=(j?this.conf.terrace_radius:"0px");o.node.previousSibling._br=r;o.node.previousSibling._bl=j}else{o.node.style.borderTopLeftRadius=o.node.style.borderBottomLeftRadius=(j?this.conf.terrace_radius:"0px")}o.node._br=r;o.node._bl=j}}for(var n=0;n0){this.base.removeChild(this.base.childNodes[0])}var h=(window.dhx4.isIE?this.base.currentStyle.position:(window.getComputedStyle!=null?window.getComputedStyle(this.base,null).getPropertyValue("position"):""));if(!(h=="relative"||h=="absolute")){this.base.style.position="relative"}this.cell=new dhtmlXEditorCell(window.dhx4.newId(),this);this.base.appendChild(this.cell.cell);this.cBlock=document.createElement("DIV");this.cBlock.className="dhxcont_content_blocker";this.cBlock.style.display="none";this.base.appendChild(this.cBlock);this.editor=document.createElement("IFRAME");this.editor.className="dhxeditor_mainiframe";this.editor.frameBorder=0;if(window.dhx4.isOpera){this.editor.scrolling="yes"}this.setSizes();var a=this.editor;if(typeof(window.addEventListener)!="undefined"){a.onload=function(){for(var j=0;j")}else{if(window.dhx4.isKHTML){j.write("")}else{if(window.dhx4.isIE){j.write("")}else{j.write("")}}}j.close();if(window.dhx4.isIE){j.contentEditable=(o!==true)}else{j.designMode=(o!==true?"On":"Off")}if(window.dhx4.isFF){try{j.execCommand("useCSS",false,true)}catch(n){}}if(m===true&&this.setContent!=null){this.setContent(l)}};this._prepareContent();this._doOnResize=function(){window.clearTimeout(c.conf.resizeTM);c.conf.resizeTM=window.setTimeout(function(){if(c.setSizes){c.setSizes()}},c.conf.resizeTMTime)};this._runCommand=function(m,o){if(this.conf.roMode===true){return}if(arguments.length<2){o=null}if(window.dhx4.isIE){this.edWin.focus()}try{var l=this.editor.contentWindow.document;l.execCommand(m,false,o)}catch(n){}if(window.dhx4.isIE){this.edWin.focus();var j=this;window.setTimeout(function(){j.edWin.focus();j=null},1)}};this.applyBold=function(){this._runCommand("Bold")};this.applyItalic=function(){this._runCommand("Italic")};this.applyUnderscore=function(){this._runCommand("Underline")};this.clearFormatting=function(){this._runCommand("RemoveFormat");var j=this.getContent();j=j.replace(/<\/?h\d>/gi,"");this.setContent(j)};this._doOnClick=function(m){var l=m||window.event;var j=l.target||l.srcElement;c._showInfo(j)};this._doOnMouseDown=function(m){var l=m||window.event;var j=l.target||l.srcElement;c._showInfo(j)};this._doOnKeyUp=function(n){var m=n||window.event;var j=m.keyCode;var l=m.target||m.srcElement;if({37:1,38:1,39:1,40:1,13:1}[j]==1){c._showInfo(l)}};this._getParentByTag=function(j,m){m=m.toLowerCase();var l=j;do{if(m==""||l.nodeName.toLowerCase()==m){return l}}while(l=l.parentNode);return j};this._isStyleProperty=function(l,o,j,m){o=o.toLowerCase();var r=l;do{if((r.nodeName.toLowerCase()==o)&&(r.style[j]==m)){return true}}while(r=r.parentNode);return false};this._setStyleProperty=function(j,m){this.style[m]=false;var l=this._getParentByTag(j,m);if(l&&(l.tagName.toLowerCase()==m)){this.style[m]=true}if(m=="del"&&this._getParentByTag(j,"strike")&&this._getParentByTag(j,"strike").tagName.toLowerCase()=="strike"){this.style.del=true}};this._showInfo=function(l){var l=(this._getSelectionBounds().end)?this._getSelectionBounds().end:l;if(!l||!this._setStyleProperty){return}try{if(this.edWin.getComputedStyle){var j=this.edWin.getComputedStyle(l,null);var m=((j.getPropertyValue("font-weight")==401)?700:j.getPropertyValue("font-weight"));this.style={fontStyle:j.getPropertyValue("font-style"),fontSize:j.getPropertyValue("font-size"),textDecoration:j.getPropertyValue("text-decoration"),fontWeight:m,fontFamily:j.getPropertyValue("font-family"),textAlign:j.getPropertyValue("text-align")};if(window.dhx4.isKHTML){this.style.fontStyle=j.getPropertyValue("font-style");this.style.vAlign=j.getPropertyValue("vertical-align");this.style.del=this._isStyleProperty(l,"span","textDecoration","line-through");this.style.u=this._isStyleProperty(l,"span","textDecoration","underline")}}else{var j=l.currentStyle;this.style={fontStyle:j.fontStyle,fontSize:j.fontSize,textDecoration:j.textDecoration,fontWeight:j.fontWeight,fontFamily:j.fontFamily,textAlign:j.textAlign}}this._setStyleProperty(l,"h1");this._setStyleProperty(l,"h2");this._setStyleProperty(l,"h3");this._setStyleProperty(l,"h4");if(!window.dhx4.isKHTML){this._setStyleProperty(l,"del");this._setStyleProperty(l,"sub");this._setStyleProperty(l,"sup");this._setStyleProperty(l,"u")}this.callEvent("onFocusChanged",[this.style,j])}catch(n){return null}};this._getSelectionBounds=function(){var o,m,s,l;if(this.edWin.getSelection){var r=this.edWin.getSelection();if(window.dhx4.isEdge&&r.rangeCount==0){return{root:null,start:null,end:null}}o=r.getRangeAt(r.rangeCount-1);s=o.startContainer;l=o.endContainer;m=o.commonAncestorContainer;if(s.nodeName=="#text"){m=m.parentNode}if(s.nodeName=="#text"){s=s.parentNode}if(s.nodeName.toLowerCase()=="body"){s=s.firstChild}if(l.nodeName=="#text"){l=l.parentNode}if(l.nodeName.toLowerCase()=="body"){l=l.lastChild}if(s==l){m=s}return{root:m,start:s,end:l}}else{if(this.edWin.document.selection){o=this.edDoc.selection.createRange();if(!o.duplicate){return null}m=o.parentElement();var n=o.duplicate();var j=o.duplicate();n.collapse(true);j.moveToElementText(n.parentElement());j.setEndPoint("EndToStart",n);s=n.parentElement();n=o.duplicate();j=o.duplicate();j.collapse(false);n.moveToElementText(j.parentElement());n.setEndPoint("StartToEnd",j);l=j.parentElement();if(s.nodeName.toLowerCase()=="body"){s=s.firstChild}if(l.nodeName.toLowerCase()=="body"){l=l.lastChild}if(s==l){m=s}return{root:m,start:s,end:l}}}return null};this.getContent=function(){if(!this.edDoc.body){return""}else{if(window.dhx4.isFF){return this.editor.contentWindow.document.body.innerHTML.replace(/<\/{0,}br\/{0,}>\s{0,}$/gi,"")}if(window.dhx4.isIE&&this.edDoc.body.innerText.length==0){return""}return this.edDoc.body.innerHTML}};this.setContent=function(m){m=m||"";if(this.edDoc.body){var l=false;if(window.dhx4.isFF){var j=navigator.userAgent.match(/Firefox\/(\d*)/);l=(j!=null&&j[1]<28)}if(l){if(typeof(this.conf.ffTest)=="undefined"){this.editor.contentWindow.document.body.innerHTML="";this._runCommand("InsertHTML","test");this.conf.ffTest=(this.editor.contentWindow.document.body.innerHTML.length>0)}if(this.conf.ffTest){this.editor.contentWindow.document.body.innerHTML=m}else{this.editor.contentWindow.document.body.innerHTML="";if(m.length==0){m=" "}this._runCommand("InsertHTML",m)}}else{this.editor.contentWindow.document.body.innerHTML=m}this.callEvent("onContentSet",[])}else{if(!this.conf.firstLoadEv){this.conf.firstLoadEv=true;this.conf.firstLoadData=m;this._onFirstLoad=function(){c.setContent(c.conf.firstLoadData);if(typeof(window.addEventListener)=="function"){c.edWin.removeEventListener("load",c._onFirstLoad,false)}else{c.edWin.detachEvent("onload",c._onFirstLoad)}c.conf.firstLoadData=null;c.conf.firstLoadEv=false;c._onFirstLoad=null};if(typeof(window.addEventListener)=="function"){this.edWin.addEventListener("load",this._onFirstLoad,false)}else{this.edWin.attachEvent("onload",this._onFirstLoad)}}}};this.setContentHTML=function(j){window.dhx4.ajax.get(j,function(l){if(l.xmlDoc.responseText!=null){c.setContent(l.xmlDoc.responseText)}})};window.dhx4._eventable(this);this.attachEvent("onFocusChanged",function(j){if(typeof(this._doOnFocusChanged)=="function"){this._doOnFocusChanged(j)}else{if(typeof(this._doOnFocusChanged)=="string"&&typeof(window[this._doOnFocusChanged])=="function"){window[this._doOnFocusChanged](j)}}});if(typeof(window.addEventListener)=="function"){window.addEventListener("resize",this._doOnResize,false);this.edDoc.addEventListener("click",this._doOnClick,false);this.edDoc.addEventListener("keyup",this._doOnKeyUp,false);if(window.dhx4.isOpera){this.edDoc.addEventListener("mousedown",this._doOnMouseDown,false)}}else{window.attachEvent("onresize",this._doOnResize);this.edDoc.attachEvent("onclick",this._doOnClick);this.edDoc.attachEvent("onkeyup",this._doOnKeyUp)}this.unload=function(){if(typeof(window.addEventListener)=="function"){window.removeEventListener("resize",this._doOnResize,false);this.edDoc.removeEventListener("click",this._doOnClick,false);this.edDoc.removeEventListener("keyup",this._doOnKeyUp,false);if(window.dhx4.isOpera){this.edDoc.removeEventListener("mousedown",this._doOnMouseDown,false)}for(var j=0;j0){this.base.removeChild(this.base.childNodes[0])}this.base=null;this._doOnClick=null;this._doOnKeyUp=null;this._doOnMouseDown=null;this._ev=null;this._focus=null;this._prepareContent=null;this._doOnResize=null;this.setIconsPath=null;this.init=null;this.setSizes=null;this._runCommand=null;this.applyBold=null;this.applyItalic=null;this.applyUnderscore=null;this.clearFormatting=null;this._showInfo=null;this._getSelectionBounds=null;this.getContent=null;this.setContent=null;this.setContentHTML=null;this.setReadonly=null;this.isReadonly=null;this.unload=null;c=a=null};if(this.conf.toolbar==true&&typeof(this.attachToolbar)=="function"&&typeof(window.dhtmlXToolbarObject)=="function"){this.attachToolbar(this.conf.iconsPath);if(this.conf.iOSfix==true){this._doOnIOSFix=function(){c.editor.contentWindow.focus()};this.tb.cont.addEventListener("touchend",this._doOnIOSFix,false)}}this.setIconsPath=function(j){this.conf.iconsPath=j};if(this.conf.content.length>0){this.setContent(this.conf.content);this.conf.content=""}else{if(this.conf.contentHTML.length>0){this.setContentHTML(this.conf.contentHTML);this.conf.contentHTML=""}}return this}dhtmlXEditor.prototype.setSizes=function(){this.cell._setSize(0,0,this.base.clientWidth,this.base.clientHeight);if(this.editor!=null){this.editor.style.left="5px";this.editor.style.width=this.base.clientWidth-5+"px"}};dhtmlXEditor.prototype.setReadonly=function(a){this.conf.roMode=(a===true);this._prepareContent(true,this.conf.roMode);this.cBlock.style.display=(this.conf.roMode?"":"none")};dhtmlXEditor.prototype.isReadonly=function(a){return(this.conf.roMode||false)};dhtmlXEditor.prototype.setSkin=function(a){this.base.className=String(this.base.className).replace(new RegExp("dhxeditor_"+this.conf.skin),"dhxeditor_"+a);this.conf.skin=this.cell.conf.skin=a;if(this.tb){this.cell.detachToolbar(a);this.tb=null;this.attachToolbar()}this.setSizes()};window.dhtmlXEditorCell=function(e,a){dhtmlXCellObject.apply(this,[e,"_editor"]);var c=this;this.editor=a;this.conf.skin=this.editor.conf.skin;this.attachEvent("_onCellUnload",function(){this._stbUnload();this.editor=null;c=null});this._stbInit();return this};dhtmlXEditorCell.prototype=new dhtmlXCellObject();dhtmlXEditorCell.prototype._stbInit=function(){var j=this;var h=document.createElement("DIV");h.className="dhx_cell_stb";this.cell.insertBefore(h,this.cell.childNodes[this.conf.idx.cont]);h.onselectstart=function(a){a=a||event;a.cancelBubble=true;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false};var g={bold:"applyBold",italic:"applyItalic",underline:"applyUnderscore",clearformat:"clearFormatting"};for(var e in g){var c=document.createElement("A");c.href="javascript:void(0);";c.tabIndex=-1;h.appendChild(c);c.onmousedown=c.onclick=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false};var l=document.createElement("DIV");l.className="dhx_cell_stb_button btn_"+e;l._actv=e.charAt(0);l._cmd=g[e];c.appendChild(l);l.onclick=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}return false};l.onmousedown=function(a){a=a||event;if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}j.editor[this._cmd]();j.editor.callEvent("onToolbarClick",[this._actv])};l=c=null}h=null;this._stbUnload=function(){var a=this.cell.childNodes[this.conf.idx.stb];a.onselectstart=null;while(a.childNodes.length>0){a.lastChild.onmousedown=a.lastChild.onclick=null;a.lastChild.firstChild.onmousedown=a.lastChild.firstChild.onclick=null;a.lastChild.firstChild._actv=a.lastChild.firstChild._cmd=null;a.lastChild.removeChild(a.lastChild.firstChild);a.removeChild(a.lastChild)}a.parentNode.removeChild(a);a=j=null;this.conf.idx_data.stb=this.conf.ofs_nodes.t._getStbHeight=null;delete this.conf.ofs_nodes.t._getStbHeight;delete this.conf.idx_data.stb;this._updateIdx()};this.conf.ofs_nodes.t._getStbHeight="func";this.conf.idx_data.stb="dhx_cell_stb";this._updateIdx()};dhtmlXEditorCell.prototype._stbHide=function(){this.cell.childNodes[this.conf.idx.stb].style.display="none"};dhtmlXEditorCell.prototype._getStbHeight=function(){return this.cell.childNodes[this.conf.idx.stb].offsetHeight};dhtmlXCellObject.prototype.attachEditor=function(a){this.callEvent("_onBeforeContentAttach",["editor"]);var e=document.createElement("DIV");e.style.width="100%";e.style.height="100%";e.style.position="relative";e.style.overflow="hidden";this._attachObject(e);if(!(typeof(a)=="object"&&a!=null)){a={}}a.parent=e;this.dataType="editor";this.dataObj=new dhtmlXEditor(a);e=null;a.parent=null;a=null;if(typeof(window.dhtmlXPortalCell)!="undefined"&&this instanceof window.dhtmlXPortalCell){if(this.portal.conf.editor_ev==null){var g=this.portal.attachEvent("onBeforeDrag",function(h){if(this.cdata[h].dataType=="editor"){this.cdata[h].conf.editor_cont=this.cdata[h].dataObj.getContent()}return true});var c=this.portal.attachEvent("onDrop",function(h){if(this.cdata[h].dataType=="editor"){this.cdata[h].dataObj.setContent(this.cdata[h].conf.editor_cont);this.cdata[h].dataObj._prepareContent(true);this.cdata[h].conf.editor_cont=null}});this.portal.conf.editor_ev=[g,c]}this.conf.editor_ev=this.attachEvent("_onBeforeContentDetach",function(){this.detachEvent(this.conf.editor_ev);this.conf.editor_ev=null;if(this instanceof window.dhtmlXPortalCell){var j=false;for(var h in this.portal.cdata){if(this.portal.cdata[h]!=this&&this.portal.cdata[h].dataType=="editor"){j=true}}if(j==false){for(var l=0;l]]>'}this._availSizes={"1":"8pt","2":"10pt","3":"12pt","4":"14pt","5":"18pt","6":"24pt","7":"36pt"};this._xmlSizes="";for(var e in this._availSizes){this._xmlSizes+=''}this.tbXML='';this.tb.loadStruct(this.tbXML);this._checkAlign=function(a){this.tb.setItemState("alignCenter",false);this.tb.setItemState("alignRight",false);this.tb.setItemState("alignJustify",false);this.tb.setItemState("alignLeft",false);if(a){this.tb.setItemState(a,true)}};this._checkH=function(a){this.tb.setItemState("applyH1",false);this.tb.setItemState("applyH2",false);this.tb.setItemState("applyH3",false);this.tb.setItemState("applyH4",false);if(a){this.tb.setItemState(a,true)}};this._doOnFocusChanged=function(m){if(!m.h1&&!m.h2&&!m.h3&&!m.h4){var a=(String(m.fontWeight).search(/bold/i)!=-1)||(Number(m.fontWeight)>=700);this.tb.setItemState("applyBold",a)}else{this.tb.setItemState("applyBold",false)}var l="alignLeft";if(String(m.textAlign).search(/center/)!=-1){l="alignCenter"}if(String(m.textAlign).search(/right/)!=-1){l="alignRight"}if(String(m.textAlign).search(/justify/)!=-1){l="alignJustify"}this.tb.setItemState(l,true);this._checkAlign(l);this.tb.setItemState("applyH1",m.h1);this.tb.setItemState("applyH2",m.h2);this.tb.setItemState("applyH3",m.h3);this.tb.setItemState("applyH4",m.h4);if(window._KHTMLrv){m.sub=(m.vAlign=="sub");m.sup=(m.vAlign=="super")}this.tb.setItemState("applyItalic",(m.fontStyle=="italic"));this.tb.setItemState("applyStrikethrough",m.del);this.tb.setItemState("applySub",m.sub);this.tb.setItemState("applySuper",m.sup);this.tb.setItemState("applyUnderscore",m.u)};this._doOnToolbarClick=function(l){var a=String(l).split(":");if(this[a[0]]!=null){if(typeof(this[a[0]])=="function"){this[a[0]](a[1]);this.callEvent("onToolbarClick",[l])}}};this._doOnStateChange=function(l,a){this[l]();switch(l){case"alignLeft":case"alignCenter":case"alignRight":case"alignJustify":this._checkAlign(l);break;case"applyH1":case"applyH2":case"applyH3":case"applyH4":this._checkH(l);break}this.callEvent("onToolbarClick",[l])};this._doOnBeforeStateChange=function(l,a){if((l=="alignLeft"||l=="alignCenter"||l=="alignRight"||l=="alignJustify")&&a==true){return false}return true};var h=this;this.tb.attachEvent("onClick",function(a){h._doOnToolbarClick(a)});this.tb.attachEvent("onStateChange",function(l,a){h._doOnStateChange(l,a)});this.tb.attachEvent("onBeforeStateChange",function(l,a){return h._doOnBeforeStateChange(l,a)});this.applyBold=function(){this._runCommand("Bold")};this.applyItalic=function(){this._runCommand("Italic")};this.applyUnderscore=function(){this._runCommand("Underline")};this.applyStrikethrough=function(){this._runCommand("StrikeThrough")};this.alignLeft=function(){this._runCommand("JustifyLeft")};this.alignRight=function(){this._runCommand("JustifyRight")};this.alignCenter=function(){this._runCommand("JustifyCenter")};this.alignJustify=function(){this._runCommand("JustifyFull")};this.applySub=function(){this._runCommand("Subscript")};this.applySuper=function(){this._runCommand("Superscript")};this.applyH1=function(){this._runCommand("FormatBlock","

")};this.applyH2=function(){this._runCommand("FormatBlock","

")};this.applyH3=function(){this._runCommand("FormatBlock","

")};this.applyH4=function(){this._runCommand("FormatBlock","

")};this.createNumList=function(){this._runCommand("InsertOrderedList")};this.createBulList=function(){this._runCommand("InsertUnorderedList")};this.increaseIndent=function(){this._runCommand("Indent")};this.decreaseIndent=function(){this._runCommand("Outdent")};this.clearFormatting=function(){this._runCommand("RemoveFormat");this.tb.setItemState("applyBold",false);this.tb.setItemState("applyItalic",false);this.tb.setItemState("applyStrikethrough",false);this.tb.setItemState("applySub",false);this.tb.setItemState("applySuper",false);this.tb.setItemState("applyUnderscore",false);var a=this.getContent();a=a.replace(/<\/?h\d>/gi,"");this.setContent(a)}};dhtmlx.Group={_init:function(){dhtmlx.assert(this.data,"DataStore required for grouping");this.data.attachEvent("onStoreLoad",dhtmlx.bind(function(){if(this._settings.group){this.group(this._settings.group,false)}},this));this.attachEvent("onBeforeRender",dhtmlx.bind(function(a){if(this._settings.sort){a.block();a.sort(this._settings.sort);a.unblock()}},this));this.data.attachEvent("onClearAll",dhtmlx.bind(function(){this.data._not_grouped_order=this.data._not_grouped_pull=null},this));this.attachEvent("onBeforeSort",dhtmlx.bind(function(){this._settings.sort=null},this))},_init_group_data_event:function(c,a){c.attachEvent("onClearAll",dhtmlx.bind(function(){this.ungroup(false);this.block();this.clearAll();this.unblock()},a))},sum:function(c,a){c=dhtmlx.Template.setter(c);a=a||this.data;var e=0;a.each(function(g){e+=c(g)*1});return e},min:function(e,c){e=dhtmlx.Template.setter(e);c=c||this.data;var a=Infinity;c.each(function(g){if(e(g)*1a){a=e(g)*1}});return a},_split_data_by:function(j){var m=function(r,o){r=dhtmlx.Template.setter(r);return r(o[0])};var n=dhtmlx.Template.setter(j.by);if(!j.map[n]){j.map[n]=[n,m]}var e={};var l=[];this.data.each(function(o){var r=n(o);if(!e[r]){l.push({id:r});e[r]=dhtmlx.toArray()}e[r].push(o)});for(var a in j.map){var h=(j.map[a][1]||m);if(typeof h!="function"){h=this[h]}for(var g=0;g11?"pm":"am")+"';case"%A":return'"+(date.getHours()>11?"PM":"AM")+"';case"%s":return'"+dhtmlx.Date.to_fixed(date.getSeconds())+"';case"%W":return'"+dhtmlx.Date.to_fixed(dhtmlx.Date.getISOWeek(date))+"';default:return e}});if(a){c=c.replace(/date\.get/g,"date.getUTC")}return new Function("date",'return "'+c+'";')},str_to_date:function(h,e){var j="var temp=date.split(/[^0-9a-zA-Z]+/g);";var a=h.match(/%[a-zA-Z]/g);for(var c=0;c50?1900:2000);";break;case"%g":case"%G":case"%h":case"%H":j+="set[3]=temp["+c+"]||0;";break;case"%i":j+="set[4]=temp["+c+"]||0;";break;case"%Y":j+="set[0]=temp["+c+"]||0;";break;case"%a":case"%A":j+="set[3]=set[3]%12+((temp["+c+"]||'').toLowerCase()=='am'?0:12);";break;case"%s":j+="set[5]=temp["+c+"]||0;";break}}var g="set[0],set[1],set[2],set[3],set[4],set[5]";if(e){g=" Date.UTC("+g+")"}return new Function("date","var set=[0,0,1,0,0,0]; "+j+" return new Date("+g+");")},getISOWeek:function(e){if(!e){return false}var c=e.getDay();if(c===0){c=7}var g=new Date(e.valueOf());g.setDate(e.getDate()+(4-c));var a=g.getFullYear();var j=Math.floor((g.getTime()-new Date(a,0,1).getTime())/86400000);var h=1+Math.floor(j/7);return h},getUTCISOWeek:function(a){return this.getISOWeek(a)}};dhtmlx.math={};dhtmlx.math._toHex=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"];dhtmlx.math.toHex=function(c,a){c=parseInt(c,10);str="";while(c>0){str=this._toHex[c%16]+str;c=Math.floor(c/16)}while(str.length255){h=0}if(e<0||e>255){e=0}if(a<0||a>255){a=0}return[h,e,a]};dhtmlx.math.hsvToRgb=function(l,x,u){var j,n,e,c,w,a,m,o;j=Math.floor((l/60))%6;n=l/60-j;e=u*(1-x);c=u*(1-n*x);w=u*(1-(1-n)*x);a=0;m=0;o=0;switch(j){case 0:a=u;m=w;o=e;break;case 1:a=c;m=u;o=e;break;case 2:a=e;m=u;o=w;break;case 3:a=e;m=c;o=u;break;case 4:a=w;m=e;o=u;break;case 5:a=u;m=e;o=c;break}a=Math.floor(a*255);m=Math.floor(m*255);o=Math.floor(o*255);return[a,m,o]};dhtmlx.math.rgbToHsv=function(c,m,n){var j,e,o,a,u,x,l,w;j=c/255;e=m/255;o=n/255;var a=Math.min(j,e,o);var u=Math.max(j,e,o);l=0;x=u==0?0:(1-a/u);w=u;if(u==a){l=0}else{if(u==j&&e>=o){l=60*(e-o)/(u-a)+0}else{if(u==j&&e")},addSector:function(a,o,n,l,h,e,g,j){var m=[];m.push(l);m.push(Math.floor(h*g));for(var c=o;c"+this._map.join("\n")+"";a._htmlmap=e;this._map=[]}};dhtmlx.chart={};dhtmlx.chart.scatter={pvt_render_scatter:function(o,j,n,m,l,a){if(!this._settings.xValue){return dhtmlx.log("warning","Undefined propery: xValue")}var e=this._getLimits();var h=this._getLimits("h","xValue");if(!l){if(!this.canvases.x){this.canvases.x=new dhtmlx.ui.Canvas(this._obj,"axis_x")}if(!this.canvases.y){this.canvases.y=new dhtmlx.ui.Canvas(this._obj,"axis_y")}this._drawYAxis(this.canvases.y.getCanvas(),j,n,m,e.min,e.max);this._drawHXAxis(this.canvases.x.getCanvas(),j,n,m,h.min,h.max)}e={min:this._settings.yAxis.start,max:this._settings.yAxis.end};h={min:this._settings.xAxis.start,max:this._settings.xAxis.end};var c=this._getScatterParams(o,j,n,m,h,e);this._mapStart=n;for(var g=0;ga.max){j=m[c.toLowerCase()]}if(o=n;M-=r){if(D.fixNum){M=parseFloat((new Number(M)).toFixed(D.fixNum))}J.push(Math.floor(N*e)+0.5);if(A){M=Math.round(M*A)/A}var o=v-m+J[J.length-1];this.canvases.scale.renderTextAt("middle","left",w,o,a.template(M.toString()),"dhx_axis_item_y dhx_radar");if(C.length<2){this._drawScaleSector(I,"arc",w,v,m-J[J.length-1],-Math.PI/2,3*Math.PI/2,M);return}var h=-Math.PI/2;var H=h;var F;for(L=0;LMath.PI){g=-s}if(m>Math.PI/2){h=-e}if(Math.abs(m+Math.PI/2)0;A--){g-=C.cellWidth;e=H[A].$startY;if(e){n.push([g,e])}}}n.push([n[0][0],n[0][1]]);o.globalAlpha=this._settings.alpha.call(this,H[0]);o.fillStyle=this._settings.color.call(this,H[0]);o.beginPath();this._path(o,n);o.fill();for(A=0;Ae.y){D=e.y}var C=this._getSplineYPoint(s+1,w,u,m.a,m.b,m.c,m.d);if(Ce.y){C=e.y}this._drawLine(o,s,D,s+1,C,F.line.color(I[u]),F.line.width)}this._drawLine(o,v-1,this._getSplineYPoint(s,w,u,m.a,m.b,m.c,m.d),v,a,F.line.color(I[u]),F.line.width)}this._drawItem(o,w,c,I[n[u].index],F.label(I[n[u].index]),r,H)}}},_getSplineParameters:function(y){var j,C,A,D,x,w,r,o,l=[],g=[],e=y.length;for(j=0;j=1;j--){D[j]=(A[j]-l[j]*D[j+1])/C[j]}x=[];w=[];r=[];o=[];for(j=0;j2?n*K:0)>F)){v=F/K-e-(K>2?n:0)}s=(F-v*K-n*(K-1))/2;if(this._settings.border){v=parseInt(v,10);s=parseInt(s,10)}m=(typeof this._settings.radius!="undefined"?parseInt(this._settings.radius,10):Math.round(v/5));N=false;a=this._settings.gradient;if(a&&typeof(a)!="function"){N=a;a=false}else{if(a){a=C.createLinearGradient(l.x,l.y,j.x,l.y);this._settings.gradient(a)}}if(!r){this._drawLine(C,l.x-0.5,l.y,l.x-0.5,j.y,"#000000",1)}for(I=0;IM){A=M}A-=w;A*=c;L=l.x;g=l.y+s+(K>2?n*D:0)+parseInt(I*F,10)+v*D;if((A<0&&this._settings.origin=="auto")||(this._settings.xAxis&&A===0&&!(this._settings.origin!="auto"&&this._settings.origin>w))){this.canvases[D].renderTextAt("middle","right",L+10,g+v/2+s,this._settings.label(P[I]));continue}if(A<0&&this._settings.origin!="auto"&&this._settings.origin>w){A=0}if(!r){A+=x/u}E=a||this._settings.color.call(this,P[I]);if(this._settings.border){this._drawBarHBorder(C,L,g,v,w,m,u,A,E)}C.globalAlpha=this._settings.alpha.call(this,P[I]);var H=this._drawBarH(C,j,L,g,v,w,m,u,A,E,a,N);if(N!=false){this._drawBarHGradient(C,L,g,v,w,m,u,A,E,N)}C.globalAlpha=1;if(H[3]==g){this.canvases[D].renderTextAt("middle","left",H[0]-5,H[3]+Math.floor(v/2),this._settings.label(P[I]));O.addRect(P[I].id,[H[0]-l.x,H[3]-l.y,H[2]-l.x,H[3]+v-l.y],D)}else{this.canvases[D].renderTextAt("middle",false,H[2]+5,H[1]+Math.floor(v/2),this._settings.label(P[I]));O.addRect(P[I].id,[H[0]-l.x,g-l.y,H[2]-l.x,H[3]-l.y],D)}}},_setBarHPoints:function(w,g,u,x,l,v,s,j,h){var c=0;if(l>v*s){var r=(l-v*s)/l;c=-Math.asin(r)+Math.PI/2}w.moveTo(g,u+j);var e=g+v*s-l-(l?0:j);if(l0){w.arc(e,o,l-j,-Math.PI/2+c,0,false)}var n=u+x-l-(l?0:j);var a=e+l-(l?j:0);w.lineTo(a,n);if(l&&l>0){w.arc(e,n,l-j,0,Math.PI/2-c,false)}var m=u+x-j;w.lineTo(g,m);if(!h){w.lineTo(g,u+j)}return[a,m]},_drawHScales:function(e,l,j,h,m,c,g){var a=0;if(this._settings.xAxis){if(!this.canvases.x){this.canvases.x=new dhtmlx.ui.Canvas(this._obj)}a=this._drawHXAxis(this.canvases.x.getCanvas(),l,j,h,m,c)}if(this._settings.yAxis){if(!this.canvases.y){this.canvases.y=new dhtmlx.ui.Canvas(this._obj)}this._drawHYAxis(this.canvases.y.getCanvas(),l,j,h,g,a)}},_drawHYAxis:function(s,h,n,l,e,a){if(!this._settings.yAxis){return}var j;var c=parseInt((a?a:n.x),10)-0.5;var o=l.y+0.5;var m=n.y;this._drawLine(s,c,o,c,m,this._settings.yAxis.color,1);for(var g=0;gg)){h+=(this._settings.origin-g)*l;c=h;j=j-(this._settings.origin-g);if(j<0){j*=(-1);m.translate(h,e+n);m.rotate(Math.PI);h=0.5;e=0}h+=0.5}return{value:j,x0:h,y0:e,start:c}},_drawBarH:function(u,h,A,g,n,o,j,m,s,v,a,l){var w;u.save();var r=this._correctBarHParams(u,A,g,s,m,n,o);u.fillStyle=v;u.beginPath();if(m*r.value>0){w=this._setBarHPoints(u,r.x0,r.y0,n,j,m,r.value,(this._settings.border?1:0));if(a&&!l){u.lineTo(h.x,r.y0+(this._settings.border?1:0))}}else{w=[r.x0,r.y0+1]}u.fill();u.restore();var e=r.y0;var c=(r.y0!=g?g:w[1]);var y=(r.y0!=g?(r.start-w[0]):r.start);var x=(r.y0!=g?r.start:w[0]);return[y,e,x,c]},_drawBarHBorder:function(n,c,l,o,h,g,m,j,e){n.save();var a=this._correctBarHParams(n,c,l,j,m,o,h);n.beginPath();this._setBorderStyles(n,e);n.globalAlpha=0.9;if(m*a.value>0){this._setBarHPoints(n,a.x0,a.y0,o,g,m,a.value,n.lineWidth/2,1)}n.stroke();n.restore()},_drawBarHGradient:function(r,e,n,s,l,j,o,m,g,a){r.save();var c=this._correctBarHParams(r,e,n,m,o,s,l);var h=this._setBarGradient(r,c.x0,c.y0+s,c.x0+o*c.value,c.y0,a,g,"x");r.fillStyle=h.gradient;r.beginPath();if(o*c.value>0){this._setBarHPoints(r,c.x0,c.y0+h.offset,s-h.offset*2,j,o,c.value,h.offset)}r.fill();r.globalAlpha=1;r.restore()}};dhtmlx.assert(dhtmlx.chart.barH);dhtmlx.chart.stackedBarH={pvt_render_stackedBarH:function(C,P,h,g,D,O){var N,v;var c;var w;var y=g.x-h.x;var m=!!this._settings.yAxis;var l=this._getStackedLimits(P);N=l.max;v=l.min;var F=Math.floor((g.y-h.y)/P.length);if(!D){this._drawHScales(C,P,h,g,v,N,F)}if(m){N=parseFloat(this._settings.xAxis.end);v=parseFloat(this._settings.xAxis.start)}var K=this._getRelativeValue(v,N);w=K[0];c=K[1];var s=(w?y/w:10);if(!m){var x=10;s=(w?(y-x)/w:10)}var u=parseInt(this._settings.width,10);if((u+4)>F){u=F-4}var n=(F-u)/2;var j=0;var o=false;var a=this._settings.gradient;if(a){o=true}if(!m){this._drawLine(C,h.x-0.5,h.y,h.x-0.5,g.y,"#000000",1)}var M=0;var J=0;for(I=0;IN){A=N}A-=v;A*=c;var L=h.x;var e=h.y+n+I*F;if(!J){P[I].$startX=L}else{L=P[I].$startX}if(A<0||(this._settings.yAxis&&A===0)){this.canvases.y.renderTextAt("middle",true,L+10,e+u/2,this._settings.label(P[I]));continue}if(!m){A+=x/s}var E=this._settings.color.call(this,P[I]);C.globalAlpha=this._settings.alpha.call(this,P[I]);C.fillStyle=this._settings.color.call(this,P[I]);C.beginPath();var H=this._setBarHPoints(C,L,e,u,j,s,A,(this._settings.border?1:0));if(a&&!o){C.lineTo(h.x+y,e+(this._settings.border?1:0))}C.fill();if(o!=false){var r=this._setBarGradient(C,L,e+u,L,e,o,E,"x");C.fillStyle=r.gradient;C.beginPath();H=this._setBarHPoints(C,L,e,u,j,s,A,0);C.fill()}if(this._settings.border){this._drawBarHBorder(C,L,e,u,v,j,s,A,E)}C.globalAlpha=1;this.canvases[D].renderTextAt("middle",true,P[I].$startX+(H[0]-P[I].$startX)/2-1,e+(H[1]-e)/2,this._settings.label(P[I]));O.addRect(P[I].id,[P[I].$startX-h.x,e-h.y,H[0]-h.x,H[1]-h.y],D);P[I].$startX=H[0]}}};dhtmlx.chart.stackedBar={pvt_render_stackedBar:function(x,L,g,e,y,K){var I,s;var a;var u;var v=e.y-g.y;var j=!!this._settings.yAxis;var J=!!this._settings.xAxis;var h=this._getStackedLimits(L);I=h.max;s=h.min;var C=Math.floor((e.x-g.x)/L.length);if(!y){this._drawScales(L,g,e,s,I,C)}if(j){I=parseFloat(this._settings.yAxis.end);s=parseFloat(this._settings.yAxis.start)}var F=this._getRelativeValue(s,I);u=F[0];a=F[1];var o=(u?v/u:10);var r=parseInt(this._settings.width,10);if(r+4>C){r=C-4}var l=Math.floor((C-r)/2);var m=(this._settings.gradient?this._settings.gradient:false);if(!J){this._drawLine(x,g.x,e.y+0.5,e.x,e.y+0.5,"#000000",1)}for(var E=0;E=0;j--){u.globalAlpha=a[j];u.strokeStyle="#d0d0d0";u.beginPath();this._strokeChartItem(u,e,s+2*m/3,m+j+1,g.type);u.stroke()}u.beginPath();u.globalAlpha=0.3;u.fillStyle="#bdbdbd";this._strokeChartItem(u,e,s+2*m/3,m+1,g.type);u.fill()}u.restore();if(g.type=="image"&&g.src){this._drawImage(u,e-m,s-m,g.src,m*2,m*2)}else{u.lineWidth=g.borderWidth;u.fillStyle=g.color.call(this,n);u.strokeStyle=g.borderColor.call(this,n);u.globalAlpha=g.alpha.call(this,n);u.beginPath();this._strokeChartItem(u,e,s,m+1,g.type);u.fill();u.stroke();u.globalAlpha=1}}if(r){this.canvases[o].renderTextAt(false,true,e,s-m-this._settings.labelOffset,this._settings.label.call(this,n))}var h=(this._settings.eventRadius||m+1);c.addRect(n.id,[e-h-l.x,s-h-l.y,e+h-l.x,s+h-l.y],o)},_drawImage:function(e,c,m,j,g,a){var h=document.createElement("img");h.style.display="none";h.style.width=g+"px";h.style.height=a+"px";document.body.appendChild(h);h.src=j;var l=function(){e.drawImage(h,c,m)};if(h.complete){l(h)}else{h.onload=l}},_strokeChartItem:function(a,c,h,g,e){var j=[];c=parseInt(c,10);h=parseInt(h,10);if(e&&(e=="square"||e=="s")){g*=Math.sqrt(2)/2;j=[[c-g-a.lineWidth/2,h-g],[c+g,h-g],[c+g,h+g],[c-g,h+g],[c-g,h-g]]}else{if(e&&(e=="diamond"||e=="d")){var l=(a.lineWidth>1?a.lineWidth*Math.sqrt(2)/4:0);j=[[c,h-g],[c+g,h],[c,h+g],[c-g,h],[c+l,h-g-l]]}else{if(e&&(e=="triangle"||e=="t")){j=[[c,h-g],[c+Math.sqrt(3)*g/2,h+g/2],[c-Math.sqrt(3)*g/2,h+g/2],[c,h-g]]}else{j=[[c,h,g,0,Math.PI*2,true]]}}}this._path(a,j)},_getPointY:function(e,m,j,a){var l=a.minValue;var g=a.maxValue;var o=a.unit;var c=a.valueFactor;var n=this._settings.value(e);var r=(parseFloat(n||0)-l)*c;if(!this._settings.yAxis){r+=a.startValue/o}var h=j.y-o*r;if(this._settings.fixOverflow&&(this._settings.view=="line"||this._settings.view=="area")){if(n>g){h={y:m.y,y0:h,out:"max"}}else{if(r<0||ng){h=m.y}if(r<0||nw){this._drawXAxis(C,S,j,h,F,h.y-u*(this._settings.origin-w))}v=parseInt(this._settings.width,10);var M=0;var I=0;for(J=0;J2?m*M:0)>F)){v=F/M-g-(M>2?m:0)}var r=(F-v*M-m*(M-1))/2;if(this._settings.border){v=parseInt(v,10);r=parseInt(r,10)}var l=(typeof this._settings.radius!="undefined"?parseInt(this._settings.radius,10):Math.round(v/5));var s=false;var a=this._settings.gradient;if(a&&typeof(a)!="function"){s=a;a=false}else{if(a){a=C.createLinearGradient(0,h.y,0,j.y);this._settings.gradient(a)}}if(!N){this._drawLine(C,j.x,h.y+0.5,h.x,h.y+0.5,"#000000",1)}for(J=0;JO){A=O}A-=w;A*=c;var L=j.x+r+(M>2?m*I:0)+J*F+v*I;var e=h.y;if(A<0||(this._settings.yAxis&&A===0&&!(this._settings.origin!="auto"&&this._settings.origin>w))){this.canvases[D].renderTextAt(true,true,L+Math.floor(v/2),e,this._settings.label(S[J]));continue}if(!o&&!(this._settings.origin!="auto"&&N)){A+=y/u}var E=a||this._settings.color.call(this,S[J]);C.globalAlpha=this._settings.alpha.call(this,S[J]);var H=this._drawBar(C,j,L,e,v,w,l,u,A,E,a,s);if(s){this._drawBarGradient(C,L,e,v,w,l,u,A,E,s)}if(this._settings.border){this._drawBarBorder(C,L,e,v,w,l,u,A,E)}C.globalAlpha=1;if(H[0]!=L){this.canvases[D].renderTextAt(false,true,L+Math.floor(v/2),H[1],this._settings.label(S[J]))}else{this.canvases[D].renderTextAt(true,true,L+Math.floor(v/2),H[3],this._settings.label(S[J]))}Q.addRect(S[J].id,[L-j.x,H[3]-j.y,H[2]-j.x,H[1]-j.y],D)}},_correctBarParams:function(m,h,e,j,l,n,g){var a=this._settings.xAxis;var c=e;if(!!a&&this._settings.origin!="auto"&&(this._settings.origin>g)){e-=(this._settings.origin-g)*l;c=e;j=j-(this._settings.origin-g);if(j<0){j*=(-1);m.translate(h+n,e);m.rotate(Math.PI);h=0;e=0}e-=0.5}return{value:j,x0:h,y0:e,start:c}},_drawBar:function(u,h,A,g,n,o,j,m,s,v,a,l){var w;u.save();u.fillStyle=v;var r=this._correctBarParams(u,A,g,s,m,n,o);if(m*r.value>0){w=this._setBarPoints(u,r.x0,r.y0,n,j,m,r.value,(this._settings.border?1:0))}else{w=[r.x0,r.y0]}if(a&&!l){u.lineTo(r.x0+(this._settings.border?1:0),h.y)}u.fill();u.restore();var y=r.x0;var x=(r.x0!=A?A+w[0]:w[0]);var e=(r.x0!=A?(r.start-w[1]-r.y0):r.y0);var c=(r.x0!=A?r.start-r.y0:w[1]);return[y,e,x,c]},_drawBarBorder:function(n,c,l,o,h,g,m,j,e){var a;n.save();a=this._correctBarParams(n,c,l,j,m,o,h);this._setBorderStyles(n,e);if(m*a.value>0){this._setBarPoints(n,a.x0,a.y0,o,g,m,a.value,n.lineWidth/2,1)}n.stroke();n.restore()},_drawBarGradient:function(s,g,o,u,m,l,r,n,h,c){s.save();var e=this._correctBarParams(s,g,o,n,r,u,m);var j=this._setBarGradient(s,e.x0,e.y0,e.x0+u,e.y0-r*e.value+2,c,h,"y");var a=this._settings.border?1:0;s.fillStyle=j.gradient;if(r*e.value>0){this._setBarPoints(s,e.x0+j.offset,e.y0,u-j.offset*2,l,r,e.value,j.offset+a)}s.fill();s.restore()},_setBarPoints:function(w,g,s,x,m,u,r,h,l){w.beginPath();var c=0;if(m>u*r){var j=(m-u*r)/m;if(j<=1&&j>=-1){c=-Math.acos(j)+Math.PI/2}}w.moveTo(g+h,s);var o=s-Math.floor(u*r)+m+(m?0:h);if(m0){w.arc(e,o,m-h,-Math.PI+c,-Math.PI/2,false)}var a=g+x-m-h;var n=o-m+(m?h:0);w.lineTo(a,n);if(m&&m>0){w.arc(a,o,m-h,-Math.PI/2,0-c,false)}var v=g+x-h;w.lineTo(v,s);if(!l){w.lineTo(g+h,s)}return[v,n]}};dhtmlx.chart.pie={pvt_render_pie:function(c,g,a,j,e,h){this._renderPie(c,g,a,j,1,h,e)},_renderPie:function(s,F,h,g,D,E,u){if(!F.length){return}var v=this._getPieParameters(h,g);var l=(this._settings.radius?this._settings.radius:v.radius);if(l<0){return}var a=this._getValues(F);var j=this._getTotalValue(a);var m=this._getRatios(a,j);var C=(this._settings.x?this._settings.x:v.x);var e=(this._settings.y?this._settings.y:v.y);if(D==1&&this._settings.shadow){this._addShadow(s,C,e,l)}e=e/D;var r=-Math.PI/2;var o;var x=[];s.scale(1,D);if(this._settings.gradient){var A=(D!=1?C+l/3:C);var c=(D!=1?e+l/3:e);this._showRadialGradient(s,C,e,l,A,c)}if(this._settings.labelLines){this._labelMargins=this._getLabelMargins(m,l)}for(var y=0;y1){for(y=0;y1?(v[J-1]-(v[J-1]-v[J-2])/2):v[J-1]/2);C=-Math.PI/2+v[J]-(v[J]-v[J-1])/2;var h=Math.cos(C);var y=Math.sin(C);var m=Math.cos(D);var A=Math.sin(D);var E=Math.round((l+8)*Math.abs(Math.sin(C)-Math.sin(D)));var s=(h<0?(y<0?4:3):(y<0?1:2));var u=(m<0?(A<0?4:3):(A<0?1:2));if(!M[s]){M[s]=[]}M[s].push(u==s?E:0)}var F=[];var L=0;for(var x in M){var g=0;var e=M[x].length;var o=0;var n=0;if(x==1||x==3){I=x-1;var K=0;while(I>0){if(M[I]){K+=M[I].length}I--}F[K+M[x].length-1]={y:0,x:0};var I=M[x].length-2;while(I>=0){if((o||I)&&M[x][I+1]-o<18){o+=18-M[x][I+1]}else{o=0}F[K+I]={y:o*(x==1?-1:1)};I--}for(var H=F.length-M[x].length;H=F.length-M[x].length;H--){if(F[H]["y"]!=0){n+=8;F[H]["x"]=n}else{n=0;F[H]["x"]=0}}}}return F},_getValues:function(e){var a=[];for(var c=0;c=0)||(e>=0&&a<=Math.PI)||(Math.abs(e-Math.PI)>0.003&&e<=Math.PI&&a>=Math.PI))){return}if(e<=0&&a>=0){e=0;c=false;this._drawSectorLine(g,h,l,j,e,a)}if(e<=Math.PI&&a>=Math.PI){a=Math.PI;c=false;this._drawSectorLine(g,h,l,j,e,a)}var m=(this._settings.height||Math.floor(j/4))/this._settings.cant;g.beginPath();g.arc(h,l,j,e,a,false);g.lineTo(h+j*Math.cos(a),l+j*Math.sin(a)+m);g.arc(h,l+m,j,a,e,true);g.lineTo(h+j*Math.cos(e),l+j*Math.sin(e));g.fill();if(c){g.stroke()}},_drawSectorLine:function(e,g,j,h,c,a){e.beginPath();e.arc(g,j,h,c,a,false);e.stroke()},_addShadow:function(c,a,j,g){c.globalAlpha=0.5;var h=["#c4c4c4","#c6c6c6","#cacaca","#dcdcdc","#dddddd","#e0e0e0","#eeeeee","#f5f5f5","#f8f8f8"];for(var e=h.length-1;e>-1;e--){c.beginPath();c.fillStyle=h[e];c.arc(a+1,j+1,g+e,0,Math.PI*2,true);c.fill()}c.globalAlpha=1},_getGrayGradient:function(a){a.addColorStop(0,"#ffffff");a.addColorStop(0.7,"#7a7a7a");a.addColorStop(1,"#000000");return a},_showRadialGradient:function(e,c,l,a,g,h){e.beginPath();var j;if(typeof this._settings.gradient!="function"){j=e.createRadialGradient(g,h,a/4,c,l,a);j=this._getGrayGradient(j)}else{j=this._settings.gradient(j)}e.fillStyle=j;e.arc(c,l,a,0,Math.PI*2,true);e.fill();e.globalAlpha=0.7},_drawSectorLabel:function(M,g,l,E,D,N,A,a,C,H){var w=this.canvases[0].renderText(0,0,A,0,1);if(!w){return}var O=w.scrollWidth;w.style.width=O+"px";if(O>M){O=M}var F=(D-E<0.2?4:8);if(a){F=O/1.8}var j=E+(D-E)/2;var h=l;l=(a?5*l/6:l+this._settings.labelOffset);l=l-(F-8)/2;var r=-F;var o=-8;var I="right";if(j>=Math.PI/2&&j=Math.PI){r=-O-r;I="left"}var m=0;if(!a&&N<1&&(j>0&&j=Math.PI/2&&j=Math.PI)){u+=O/3}}}if(this._settings.labelLines&&!a){var J=Math.abs((Math.abs(C||0)+Math.abs(h*Math.sin(j)))/Math.sin(j));if(C.y){s+=C.y}if(I=="left"){u-=C.x}else{u+=C.x}H.beginPath();H.strokeStyle="#555";var L=M+h*Math.cos(j);var e=g+h*Math.sin(j);H.moveTo(L,e);var K=u-(I=="left"?r-8:2);var c=s;if(I=="left"&&K>L){K=L-Math.abs(c-e+16)/Math.tan(j-Math.PI);c=c+16;if(j1){if(a){if(j.className.indexOf("hidden")!=-1){this.showSeries(h)}else{this.hideSeries(h)}}}}}},on_dblclick:{},on_mouse_move:{},bind:function(){dhx.BaseBind.legacyBind.apply(this,arguments)},sync:function(){dhx.BaseBind.legacySync.apply(this,arguments)},resize:function(){for(var a in this.canvases){this.canvases[a]._resizeCanvas()}this.render()},view_setter:function(a){if(!dhtmlx.chart[a]){dhtmlx.error("Chart type extension is not loaded: "+a)}if(typeof this._settings.offset=="undefined"){this._settings.offset=!(a=="area"||a=="stackedArea")}if(a=="radar"&&!this._settings.yAxis){this.define("yAxis",{})}if(a=="scatter"){if(!this._settings.yAxis){this.define("yAxis",{})}if(!this._settings.xAxis){this.define("xAxis",{})}}return a},clearCanvas:function(){if(this.canvases&&typeof this.canvases=="object"){for(var a in this.canvases){this.canvases[a].clearCanvas()}}},render:function(){var e,c,g,h,a;if(!this.callEvent("onBeforeRender",[this.data])){return}if(this.canvases&&typeof this.canvases=="object"){for(c in this.canvases){this.canvases[c].clearCanvas()}}else{this.canvases={}}if(this._settings.legend){if(!this.canvases.legend){this.canvases.legend=new dhtmlx.ui.Canvas(this._obj,"legend")}this._drawLegend(this.data.getRange(),this._obj.offsetWidth)}e=this._getChartBounds(this._obj.offsetWidth,this._obj.offsetHeight);this._map=h=new dhtmlx.ui.Map(this._id);a=this._settings;g=this._getChartData();for(c=0;c5?10:5);h=parseInt(j,10)*a;if(h>Math.abs(o)){g=(o<0?-h:0)}else{var r=Math.abs(o);var n=Math.floor(this._log10(r));var m=r/Math.pow(10,n);g=Math.ceil(m*10)/10*Math.pow(10,n)-h;if(r>1&&h>0.1){g=Math.ceil(g)}while(o<0?g<=o:g>=o){g-=h}if(o<0){g=-g-2*h}}l=g;while(l1){for(var g=1;gm){m=a}if(e=n[0]&&l<=n[3]&&l>=n[1]){if(r){if(c[h].index>r.index){r=c[h]}}else{r=c[h]}}}return r?r.index:0},hideSeries:function(a){this.canvases[a].hideCanvas();if(this._settings.legend.values&&this._settings.legend.values[a]){this._settings.legend.values[a].$hidden=true}this._drawLegend()},showSeries:function(a){this.canvases[a].showCanvas();if(this._settings.legend.values&&this._settings.legend.values[a]){delete this._settings.legend.values[a].$hidden}this._drawLegend()},_changeColorSV:function(c,h,a){var g,e;e=dhtmlx.math.toRgb(c);g=dhtmlx.math.rgbToHsv(e[0],e[1],e[2]);g[1]*=h;g[2]*=a;return"rgb("+dhtmlx.math.hsvToRgb(g[0],g[1],g[2])+")"},_setBorderStyles:function(a,c){var g,e;e=dhtmlx.math.toRgb(c);g=dhtmlx.math.rgbToHsv(e[0],e[1],e[2]);g[2]/=2;c="rgb("+dhtmlx.math.hsvToRgb(g[0],g[1],g[2])+")";a.strokeStyle=c;if(a.globalAlpha==1){a.globalAlpha=0.9}},_drawLegend:function(h,c){var j,r,A,s,l,u,a,n=0,m=0,w,o,g,v;h=h||[];c=c||this._obj.offsetWidth;w=this.canvases.legend.getCanvas();r=this._settings.legend;a=(this._settings.legend.layout!="x"?"width:"+r.width+"px":"");if(this.legendObj){this.legendObj.innerHTML="";this.legendObj.parentNode.removeChild(this.legendObj)}this.canvases.legend.clearCanvas(true);A=dhtmlx.html.create("DIV",{"class":"dhx_chart_legend",style:"left:"+n+"px; top:"+m+"px;"+a},"");if(r.padding){A.style.padding=r.padding+"px"}this.legendObj=A;this._obj.appendChild(A);l=[];if(!r.values){for(j=0;j2){l.setAttribute("series_id",c)}a.appendChild(l);return l},_drawLegendMarker:function(A,s,r,h,w,j,m){var c=[];var l=this._settings.legend.marker;var v=this._settings.legend.values;var o=(v&&v[m].markerType?v[m].markerType:l.type);if(h){A.fillStyle=h;A.strokeStyle=this._getDarkenColor(h,0.75)}A.beginPath();if(o=="round"||!l.radius){A.lineWidth=l.height;A.lineCap=o;s+=A.lineWidth/2+5;r+=w/2;A.moveTo(s,r);var a=s+l.width-l.height+1;A.lineTo(a,r)}else{if(o=="item"){if(this._settings.line&&this._settings.view!="scatter"&&!this._settings.disableLines){A.beginPath();A.lineWidth=this._series[m].line.width;A.strokeStyle=j?h:this._series[m].line.color.call(this,{});var e=s+5;var u=r+w/2;A.moveTo(e,u);var a=e+l.width;A.lineTo(a,u);A.stroke()}var g=this._series[m].item;var n=parseInt(g.radius.call(this,{}),10)||0;if(n){if(g.type=="image"&&g.src){this._drawImage(A,s+5,r+l.height/2-5,g.src,n*2,n*2);return}else{A.beginPath();if(j){A.lineWidth=g.borderWidth;A.strokeStyle=h;A.fillStyle=h}else{A.lineWidth=g.borderWidth;A.fillStyle=g.color.call(this,{});A.strokeStyle=g.borderColor.call(this,{});A.globalAlpha=g.alpha.call(this,{})}A.beginPath();s+=l.width/2+5;r+=w/2;this._strokeChartItem(A,s,r,n+1,g.type);A.fill();A.stroke()}}A.globalAlpha=1}else{A.lineWidth=1;s+=5;r+=parseInt(w/2-l.height/2,10);c=[[s+l.radius,r+l.radius,l.radius,Math.PI,3*Math.PI/2,false],[s+l.width-l.radius,r],[s+l.width-l.radius,r+l.radius,l.radius,-Math.PI/2,0,false],[s+l.width,r+l.height-l.radius],[s+l.width-l.radius,r+l.height-l.radius,l.radius,0,Math.PI/2,false],[s+l.radius,r+l.height],[s+l.radius,r+l.height-l.radius,l.radius,Math.PI/2,Math.PI,false],[s,r+l.radius]];this._path(A,c)}}A.stroke();A.fill()},_getDarkenColor:function(a,g){var e,c;c=dhtmlx.math.toRgb(a);e=dhtmlx.math.rgbToHsv(c[0],c[1],c[2]);e[2]=e[2]*g;return"rgb("+dhtmlx.math.hsvToRgb(e[0],e[1],e[2])+")"},_getChartBounds:function(a,l){var n,e,m,c;n=this._settings.padding.left;e=this._settings.padding.top;m=a-this._settings.padding.right;c=l-this._settings.padding.bottom;if(this._settings.legend){var h=this._settings.legend;var j=this._settings.legend.width;var g=this._settings.legend.height;if(h.layout=="x"){if(h.valign=="center"){if(h.align=="right"){m-=j}else{if(h.align=="left"){n+=j}}}else{if(h.valign=="bottom"){c-=g}else{e+=g}}}else{if(h.align=="right"){m-=j}else{if(h.align=="left"){n+=j}}}}return{start:{x:n,y:e},end:{x:m,y:c}}},_getStackedLimits:function(h){var c,a,l,g,e;if(this._settings.yAxis&&(typeof this._settings.yAxis.end!="undefined")&&(typeof this._settings.yAxis.start!="undefined")&&this._settings.yAxis.step){l=parseFloat(this._settings.yAxis.end);g=parseFloat(this._settings.yAxis.start)}else{for(c=0;cl){l=h[c].$sum}if(h[c].$min0){g=0}}return{max:l,min:g}},_setBarGradient:function(v,c,r,a,n,m,g,e){var o,h,l,j,u,s;if(m=="light"){if(e=="x"){o=v.createLinearGradient(c,r,a,r)}else{o=v.createLinearGradient(c,r,c,n)}s=[[0,"#FFFFFF"],[0.9,g],[1,g]];h=2}else{if(m=="falling"||m=="rising"){if(e=="x"){o=v.createLinearGradient(c,r,a,r)}else{o=v.createLinearGradient(c,r,c,n)}l=dhtmlx.math.toRgb(g);j=dhtmlx.math.rgbToHsv(l[0],l[1],l[2]);j[1]*=1/2;u="rgb("+dhtmlx.math.hsvToRgb(j[0],j[1],j[2])+")";if(m=="falling"){s=[[0,u],[0.7,g],[1,g]]}else{if(m=="rising"){s=[[0,g],[0.3,g],[1,u]]}}h=0}else{v.globalAlpha=0.37;h=0;if(e=="x"){o=v.createLinearGradient(c,n,c,r)}else{o=v.createLinearGradient(c,r,a,r)}s=[[0,"#9d9d9d"],[0.3,"#e8e8e8"],[0.45,"#ffffff"],[0.55,"#ffffff"],[0.7,"#e8e8e8"],[1,"#9d9d9d"]]}}this._gradient(o,s);return{gradient:o,offset:h}},_getPositionByAngle:function(e,c,h,g){e*=(-1);c=c+Math.cos(e)*g;h=h-Math.sin(e)*g;return{x:c,y:h}},_gradient:function(e,c){for(var a=0;a2){g="arc"}a[g].apply(a,e[c])}},_circle:function(c,a,g,e){c.arc(a,g,e,Math.PI*2,true)},_addMapRect:function(g,h,a,e,c){g.addRect(h,[a[0].x-e.x,a[0].y-e.y,a[1].x-e.x,a[1].y-e.y],c)}};dhtmlx.compat("layout");if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype.attachChart=function(a){this.callEvent("_onBeforeContentAttach",["chart"]);var c=document.createElement("DIV");c.id="dhxChartObj_"+window.dhx4.newId();c.style.width="100%";c.style.height="100%";document.body.appendChild(c);this._attachObject(c);a.container=c.id;this.dataType="chart";this.dataObj=new dhtmlXChart(a);if(!this.dataObj.setSizes){this.dataObj.setSizes=function(){if(this.resize){this.resize()}else{this.render()}}}return this.dataObj}}dhtmlx.ui.pager=function(a){this.name="Pager";if(dhtmlx.assert_enabled()){this._assert()}dhtmlx.extend(this,dhtmlx.Settings);this._parseContainer(a,"dhx_pager");dhtmlx.extend(this,dhtmlx.EventSystem);dhtmlx.extend(this,dhtmlx.SingleRender);dhtmlx.extend(this,dhtmlx.MouseEvents);this._parseSettings(a,{size:10,page:-1,group:5,count:0,type:"default"});this.data=this._settings;this.refresh()};dhtmlx.ui.pager.prototype={_id:"dhx_p_id",on_click:{dhx_pager_item:function(a,c){this.select(c)}},select:function(a){switch(a){case"next":a=this._settings.page+1;break;case"prev":a=this._settings.page-1;break;case"first":a=0;break;case"last":a=this._settings.limit-1;break;default:break}if(a<0){a=0}if(a>=this.data.limit){a=this.data.limit-1}if(this.callEvent("onBeforePageChange",[this._settings.page,a])){this.data.page=a*1;this.refresh();this.callEvent("onAfterPageChange",[a])}},types:{"default":{template:dhtmlx.Template.fromHTML("{common.pages()}"),pages:function(e){var c="";if(e.page==-1){return""}e.min=e.page-Math.round((e.group-1)/2);e.max=e.min+e.group-1;if(e.min<0){e.max+=e.min*(-1);e.min=0}if(e.max>=e.limit){e.min-=Math.min(e.min,e.max-e.limit+1);e.max=e.limit-1}for(var a=(e.min||0);a<=e.max;a++){c+=this.button({id:a,index:(a+1),selected:(a==e.page?"_selected":"")})}return c},page:function(a){return a.page+1},first:function(){return this.button({id:"first",index:" << ",selected:""})},last:function(){return this.button({id:"last",index:" >> ",selected:""})},prev:function(){return this.button({id:"prev",index:"<",selected:""})},next:function(){return this.button({id:"next",index:">",selected:""})},button:dhtmlx.Template.fromHTML("
{obj.index}
")}},refresh:function(){var a=this._settings;a.limit=Math.ceil(a.count/a.size);if(a.limit&&a.limit!=a.old_limit){a.page=Math.min(a.limit-1,a.page)}var c=a.page;if(c!=-1&&(c!=a.old_page)||(a.limit!=a.old_limit)){this.render();this.callEvent("onRefresh",[]);a.old_limit=a.limit;a.old_page=a.page}},template_item_start:dhtmlx.Template.fromHTML("
"),template_item_end:dhtmlx.Template.fromHTML("
")};dhtmlx.DataProcessor={_dp_init:function(c){var a="_methods";c[a]=["setItemStyle","","changeId","remove"];this.attachEvent("onAfterAdd",function(e){c.setUpdated(e,true,"inserted")});this.data.attachEvent("onStoreLoad",dhtmlx.bind(function(g,e){if(g.getUserData){g.getUserData(e,this._userdata)}},this));this.attachEvent("onBeforeDelete",function(g){if(c._silent_mode){return true}var e=c.getState(g);if(e=="inserted"){c.setUpdated(g,false);return true}if(e=="deleted"){return false}if(e=="true_deleted"){return true}c.setUpdated(g,true,"deleted");return false});this.attachEvent("onAfterEditStop",function(e){c.setUpdated(e,true,"updated")});this.attachEvent("onBindUpdate",function(e){window.setTimeout(function(){c.setUpdated(e.id,true,"updated")},1)});a="_getRowData";c[a]=function(l,e){var h=this.obj.data.get(l);var j={};for(var g in h){if(g.indexOf("_")===0){continue}j[g]=h[g]}return j};a="_clearUpdateFlag";c[a]=function(){};this._userdata={};c.attachEvent("insertCallback",this._dp_callback);c.attachEvent("updateCallback",this._dp_callback);c.attachEvent("deleteCallback",function(e,g){this.obj.setUserData(g,this.action_param,"true_deleted");this.obj.remove(g)});dhtmlx.compat("dataProcessor",c)},_dp_callback:function(a,c){this.obj.data.set(c,dhtmlx.DataDriver.xml.getDetails(a.firstChild));this.obj.data.refresh(c)},setItemStyle:function(e,a){var c=this._locateHTML(e);if(c){c.style.cssText+=";"+a}},changeId:function(c,a){this.data.changeId(c,a);this.refresh()},setUserData:function(e,a,c){if(e){this.data.get(e)[a]=c}else{this._userdata[a]=c}},getUserData:function(c,a){return c?this.data.get(c)[a]:this._userdata[a]}};(function(){var a="_dp_init";dhtmlx.DataProcessor[a]=dhtmlx.DataProcessor._dp_init})();dhtmlx.compat.dnd=function(){if(window.dhtmlDragAndDropObject){var m="_dragged";var g=dhtmlDragAndDropObject.prototype.checkLanding;dhtmlDragAndDropObject.prototype.checkLanding=function(o,r,n){g.apply(this,arguments);if(!n){var s=dhtmlx.DragControl._drag_context=dhtmlx.DragControl._drag_context||{};if(!s.from){s.from=this.dragStartObject}dhtmlx.DragControl._checkLand(o,r,true)}};var c=dhtmlDragAndDropObject.prototype.stopDrag;dhtmlDragAndDropObject.prototype.stopDrag=function(r,n,o){if(!o){if(dhtmlx.DragControl._last){dhtmlx.DragControl._active=l.dragStartNode;dhtmlx.DragControl._stopDrag(r,true)}}c.apply(this,arguments)};var l=new dhtmlDragAndDropObject();var h=dhtmlx.DragControl._startDrag;dhtmlx.DragControl._startDrag=function(){h.apply(this,arguments);var s=dhtmlx.DragControl._drag_context;if(!s){return}var r=[];var o=[];for(var n=0;n"+c.innerHTML+""}};dhtmlx.DragItem={_init:function(){dhtmlx.assert(this.move,"DragItem :: Component doesn't have DataMove interface");dhtmlx.assert(this.locate,"DragItem :: Component doesn't have RenderStack interface");dhtmlx.assert(dhtmlx.DragControl,"DragItem :: DragControl is not included");if(!this._settings||this._settings.drag){dhtmlx.DragItem._initHandlers(this)}else{if(this._settings){this.drag_setter=function(a){if(a){this._initHandlers(this);delete this.drag_setter}return a}}}if(this.dragMarker){this.attachEvent("onBeforeDragIn",this.dragMarker);this.attachEvent("onDragOut",this.dragMarker)}},_initHandlers:function(a){dhtmlx.DragControl.addDrop(a._obj,a,true);dhtmlx.DragControl.addDrag(a._obj,a)},onDragIn:function(h,g,j){var m=this.locate(j)||null;var c=dhtmlx.DragControl._drag_context;var l=dhtmlx.DragControl.getMaster(h);var a=(this._locateHTML(m)||this._obj);if(a==dhtmlx.DragControl._landing){return a}c.target=m;c.to=l;if(!this.callEvent("onBeforeDragIn",[c,j])){c.id=null;return null}dhtmlx.html.addCss(a,"dhx_drag_over");return a},onDragOut:function(h,g,m,j){var l=this.locate(j)||null;if(m!=this._dataobj){l=null}var c=(this._locateHTML(l)||(m?dhtmlx.DragControl.getMaster(m)._obj:window.undefined));if(c==dhtmlx.DragControl._landing){return null}var a=dhtmlx.DragControl._drag_context;dhtmlx.html.removeCss(dhtmlx.DragControl._landing,"dhx_drag_over");a.target=a.to=null;this.callEvent("onDragOut",[a,j]);return null},onDrop:function(g,c,j,h){var a=dhtmlx.DragControl._drag_context;a.to=this;a.index=a.target?this.indexById(a.target):this.dataCount();a.new_id=dhtmlx.uid();if(!this.callEvent("onBeforeDrop",[a,h])){return}if(a.from==a.to){this.move(a.source,a.index)}else{if(a.from){a.from.move(a.source,a.index,a.to,a.new_id)}else{dhtmlx.error("Unsopported d-n-d combination")}}this.callEvent("onAfterDrop",[a,h])},onDrag:function(g,j){var l=this.locate(j);var h=[l];if(l){if(this.getSelected){var c=this.getSelected();if(dhtmlx.PowerArray.find.call(c,l)!=-1){h=c}}var a=dhtmlx.DragControl._drag_context={source:h,start:l};a.from=this;if(this.callEvent("onBeforeDrag",[a,j])){return a.html||this._toHTML(this.get(l))}}return null}};dhtmlx.EditAbility={_init:function(a){this._edit_id=null;this._edit_bind=null;dhtmlx.assert(this.data,"EditAbility :: Component doesn't have DataStore");dhtmlx.assert(this._locateHTML,"EditAbility :: Component doesn't have RenderStack");this.attachEvent("onEditKeyPress",function(e,g,c){if(e==13&&!c){this.stopEdit()}else{if(e==27){this.stopEdit(true)}}});this.attachEvent("onBeforeRender",function(){this.stopEdit()})},isEdit:function(){return this._edit_id},edit:function(c){if(this.stopEdit(false,c)){if(!this.callEvent("onBeforeEditStart",[c])){return}var a=this.data.get(c);if(a.$template){return}a.$template="edit";this.data.refresh(c);this._edit_id=c;this._save_binding(c);this._edit_bind(true,a);this.callEvent("onAfterEditStart",[c])}},stopEdit:function(e,h){if(!this._edit_id){return true}if(this._edit_id==h){return false}var a={};if(!e){this._edit_bind(false,a)}else{a=null}if(!this.callEvent("onBeforeEditStop",[this._edit_id,a])){return false}var c=this.data.get(this._edit_id);c.$template=null;if(!e){this._edit_bind(false,c)}var g=this._edit_id;this._edit_bind=this._edit_id=null;this.data.refresh(g);this.callEvent("onAfterEditStop",[g,a]);return true},_save_binding:function(m){var a=this._locateHTML(m);var e="";var j="";var h=[];if(a){var g=a.getElementsByTagName("*");var l="";for(var c=0;c=0;c--){if(this._selected[c]==e){this._selected[c]=a}}},_data_filtered:function(){for(var a=this._selected.length-1;a>=0;a--){if(this.data.indexById(this._selected[a])<0){var e=this._selected[a];var c=this.item(e);if(c){delete c.$selected}this._selected.splice(a,1);this.callEvent("onSelectChange",[e])}}},_data_updated:function(e,c,a){if(a=="delete"){this._selected.remove(e)}else{if(!this.data.dataCount()&&!this.data._filter_order){this._selected=dhtmlx.toArray()}}},_data_loaded:function(){if(this._settings.select){this.data.each(function(a){if(a.$selected){this.select(a.id)}},this)}},_select_mark:function(e,c,a){if(!a&&!this.callEvent("onBeforeSelect",[e,c])){return false}this.data.item(e).$selected=c;if(a){a.push(e)}else{if(c){this._selected.push(e)}else{this._selected.remove(e)}this._refresh_selection(e)}return true},select:function(g,e,a){if(!g){return this.selectAll()}if(g instanceof Array){for(var c=0;c100||a.length>this.data.dataCount/2},_refresh_selection:function(c){if(typeof c!="object"){c=[c]}if(!c.length){return}if(this._is_mass_selection(c)){this.data.refresh()}else{for(var a=0;ac){if(!e){this.order[c]=dhtmlx.uid();e={id:this.order[c],$template:"loading"};this._unrendered_area.push(this.order[c])}else{if(e.$template=="loading"){this._unrendered_area.push(this.order[c])}}a.push(e)}}return a},render:function(j,g,e,h){if(j){var a=this._locateHTML(j);switch(e){case"update":if(!a){return}var c=this._htmlmap[j]=this._toHTMLObject(g);dhtmlx.html.insertBefore(c,a);dhtmlx.html.remove(a);break;default:this._render_delayed();break}}else{if(this.callEvent("onBeforeRender",[this.data])){this._htmlmap={};this._render_visible_rows(null,true);this._wait_for_render=false;this.callEvent("onAfterRender",[])}}},_render_delayed:function(){if(this._wait_for_render){return}this._wait_for_render=true;window.setTimeout(dhtmlx.bind(function(){this.render()},this),1)},_create_placeholder:function(a){var c=document.createElement("DIV");c.className="dhxdataview_placeholder";c.style.cssText="height:"+a+"px; width:100%; overflow:hidden;";return c},_render_visible_rows:function(A,E){this.data._unrendered_area=[];var y=this._getVisibleRange();if(!this._dataobj.firstChild||E){this._dataobj.innerHTML="";this._dataobj.appendChild(this._create_placeholder(y._max));this._htmlrows=[this._dataobj.firstChild]}var j=Math.max(y._from,0);var x=(this.data.max||this.data.max===0)?this.data.max:Infinity;while(j<=y._height){while(this._htmlrows[j]&&this._htmlrows[j]._filled&&j<=y._height){j++}if(j>y._height){break}var n=j;while(!this._htmlrows[n]){n--}var a=this._htmlrows[n];var g=j*y._dx+(this.data.min||0);if(g>x){break}var l=Math.min(g+y._dx-1,x);var r=this._create_placeholder(y._y);var m=this.data.getIndexRange(g,l);if(!m.length){break}r.innerHTML=m.map(this._toHTML,this).join("");for(var v=0;v0){a.style.height=u+"px";this._htmlrows[j+1]=a}else{if(D<0){dhtmlx.html.remove(a)}else{a.style.height=D+"px"}if(u>0){var o=this._htmlrows[j+1]=this._create_placeholder(u);dhtmlx.html.insertBefore(o,r.nextSibling,this._dataobj)}}j++}if(this.data._unrendered_area.length){var s=this.indexById(this.data._unrendered_area[0]);var c=this.indexById(this.data._unrendered_area.pop())+1;if(c>s){if(!this.callEvent("onDataRequest",[s,c-s])){return false}dhtmlx.assert(this.data.feed,"Data feed is missed");this.data.feed.call(this,s,c-s)}}if(dhtmlx._isIE){var C=this._getVisibleRange();if(C._from!=y._from){this._render_visible_rows()}}},_getVisibleRange:function(){var c=dhtmlx.$customScroll?0:18;var l=this._dataobj.scrollTop;var a=this._dataobj.scrollWidth;var m=this._dataobj.offsetHeight;var o=this.type;var g=this._getDimension();var r=Math.floor(a/g.x)||1;var e=Math.floor(l/g.y);var n=Math.ceil((m+l)/g.y)-1;var h=this.data.max?(this.data.max-this.data.min):this.data.dataCount();var j=Math.ceil(h/r)*g.y;return{_from:e,_height:n,_top:l,_max:j,_y:g.y,_dx:r}}};dhtmlXDataView=function(a){this.name="DataView";if(dhtmlx.assert_enabled()){this._assert()}dhtmlx.extend(this,dhtmlx.Settings);this._parseContainer(a,"dhx_dataview");dhtmlx.extend(this,dhtmlx.AtomDataLoader);dhtmlx.extend(this,dhtmlx.DataLoader);dhtmlx.extend(this,dhtmlx.EventSystem);dhtmlx.extend(this,dhtmlx.RenderStack);dhtmlx.extend(this,dhtmlx.SelectionModel);dhtmlx.extend(this,dhtmlx.MouseEvents);dhtmlx.extend(this,dhtmlx.KeyEvents);dhtmlx.extend(this,dhtmlx.EditAbility);dhtmlx.extend(this,dhtmlx.DataMove);dhtmlx.extend(this,dhtmlx.DragItem);dhtmlx.extend(this,dhtmlx.DataProcessor);dhtmlx.extend(this,dhtmlx.AutoTooltip);dhtmlx.extend(this,dhtmlx.Destruction);this.data.attachEvent("onStoreUpdated",dhtmlx.bind(function(){this.render.apply(this,arguments)},this));this._parseSettings(a,{drag:false,edit:false,select:"multiselect",type:"default"});if(this._settings.height!="auto"&&!this._settings.renderAll){dhtmlx.extend(this,dhtmlx.VirtualRenderStack)}this.data.provideApi(this,true);if(this.config.autowidth){this.attachEvent("onBeforeRender",function(){this.type.width=Math.floor((this._dataobj.scrollWidth)/(this.config.autowidth*1||1))-this.type.padding*2-this.type.margin*2-this.type.border*2;this.type._item_start=dhtmlx.Template.fromHTML(this.template_item_start(this.type));this.type._item_end=this.template_item_end(this.type)});dhtmlx.event(window,"resize",function(){this.refresh()},this)}if(dhtmlx.$customScroll){dhtmlx.CustomScroll.enable(this)}};dhtmlXDataView.prototype={bind:function(){dhx.BaseBind.legacyBind.apply(this,arguments)},sync:function(){dhx.BaseBind.legacySync.apply(this,arguments)},dragMarker:function(e,h){var g=this._locateHTML(e.target);if(this.type.drag_marker){if(this._drag_marker){this._drag_marker.style.backgroundImage="";this._drag_marker.style.backgroundRepeat=""}if(g){g.style.backgroundImage="url("+(dhtmlx.image_path||"")+this.type.drag_marker+")";g.style.backgroundRepeat="no-repeat";this._drag_marker=g}}if(g&&this._settings.auto_scroll){var a=g.offsetTop;var j=g.offsetHeight;var c=this._obj.scrollTop;var l=this._obj.offsetHeight;if(a-j>=0&&a-j*0.75c+l){c=c+j}}this._obj.scrollTop=c}return true},_id:"dhx_f_id",on_click:{dhx_dataview_item:function(a,c){if(this.stopEdit(false,c)){if(this._settings.select){if(this._settings.select=="multiselect"){this.select(c,a.ctrlKey,a.shiftKey)}else{this.select(c)}}}}},on_dblclick:{dhx_dataview_item:function(a,c){if(this._settings.edit){this.edit(c)}}},on_mouse_move:{},types:{"default":{css:"default",template:dhtmlx.Template.fromHTML("
{obj.text}
"),template_edit:dhtmlx.Template.fromHTML("
"),template_loading:dhtmlx.Template.fromHTML("
Loading...
"),width:210,height:115,margin:0,padding:10,border:1}},template_item_start:dhtmlx.Template.fromHTML("
"),template_item_end:dhtmlx.Template.fromHTML("
")};dhtmlx.compat("layout");if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype.attachDataView=function(a){this.callEvent("_onBeforeContentAttach",["dataview"]);var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";c.style.overflow="hidden";this._attachObject(c);if(typeof(a)=="undefined"){a={}}c.id="DataViewObject_"+new Date().getTime();a.container=c.id;a.skin=this.conf.skin;this.dataType="dataview";this.dataObj=new dhtmlXDataView(a);this.dataObj.setSizes=function(){this.render()};c=null;this.callEvent("_onContentAttach",[]);return this.dataObj}}dhtmlXList=function(a){this.name="List";dhtmlx.extend(this,dhtmlx.Settings);this._parseContainer(a,"dhx_list");dhtmlx.extend(this,dhtmlx.AtomDataLoader);dhtmlx.extend(this,dhtmlx.DataLoader);dhtmlx.extend(this,dhtmlx.EventSystem);dhtmlx.extend(this,dhtmlx.RenderStack);dhtmlx.extend(this,dhtmlx.SelectionModel);dhtmlx.extend(this,dhtmlx.MouseEvents);dhtmlx.extend(this,dhtmlx.KeyEvents);dhtmlx.extend(this,dhtmlx.EditAbility);dhtmlx.extend(this,dhtmlx.DataMove);dhtmlx.extend(this,dhtmlx.DragItem);dhtmlx.extend(this,dhtmlx.DataProcessor);dhtmlx.extend(this,dhtmlx.AutoTooltip);dhtmlx.extend(this,dhtmlx.Destruction);this._getDimension=function(){var c=this.type;var e=(c.margin||0)*2;return{x:c.width+e,y:c.height+e}};this.data.attachEvent("onStoreUpdated",dhtmlx.bind(function(){this.render.apply(this,arguments)},this));this._parseSettings(a,{drag:false,edit:false,select:"multiselect",type:"default"});this.data.provideApi(this,true);if(dhtmlx.$customScroll){dhtmlx.CustomScroll.enable(this)}};dhtmlXList.prototype={bind:function(){dhx.BaseBind.legacyBind.apply(this,arguments)},sync:function(){dhx.BaseBind.legacySync.apply(this,arguments)},dragMarker:function(e,h){var g=this._locateHTML(e.target);if(g&&this._settings.auto_scroll){var a=g.offsetTop;var j=g.offsetHeight;var c=this._obj.scrollTop;var l=this._obj.offsetHeight;if(a-j>=0&&a-j*0.75c+l){c=c+j}}this._obj.scrollTop=c}return true},_id:"dhx_f_id",on_click:{dhx_list_item:function(a,c){if(this.stopEdit(false,c)){if(this._settings.select){if(this._settings.select=="multiselect"){this.select(c,a.ctrlKey,a.shiftKey)}else{this.select(c)}}}}},on_dblclick:{dhx_list_item:function(a,c){if(this._settings.edit){this.edit(c)}}},on_mouse_move:{},types:{"default":{css:"default",template:dhtmlx.Template.fromHTML("
{obj.text}
"),template_edit:dhtmlx.Template.fromHTML("
"),template_loading:dhtmlx.Template.fromHTML("
Loading...
"),height:50,margin:0,padding:10,border:1}},template_item_start:dhtmlx.Template.fromHTML("
"),template_item_end:dhtmlx.Template.fromHTML("
")};dhtmlx.compat("layout");if(typeof(window.dhtmlXCellObject)!="undefined"){dhtmlXCellObject.prototype.attachList=function(a){this.callEvent("_onBeforeContentAttach",["list"]);var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";c.style.overflow="hidden";this._attachObject(c);if(typeof(a)=="undefined"){a={}}c.id="ListObject_"+new Date().getTime();a.container=c.id;a.skin=this.conf.skin;this.dataType="list";this.dataObj=new dhtmlXList(a);this.dataObj.setSizes=function(){this.render()};c=null;this.callEvent("_onContentAttach",[]);return this.dataObj}}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.wholeText||this.d.firstChild.data):""},each:function(g,l,j,h){var e=this.d.childNodes;var m=new xmlPointer();if(e.length){for(h=h||0;h0){u=new Object;u.tr=l.childNodes[0].tr.previousSibling}l._has_top=true;for(h=r;h>0;h--){E[h]=E[h-1]}r=0;break}}}var s;if(!(s=this._idpull[j])||s.span!=-1){s=E[r]=new dhtmlXTreeItemObject(j,g,l,this,m,1);j=E[r].id;l.childsCount++}if(!s.htmlNode){s.label=g;s.htmlNode=this._createItem((this.checkBoxOff?1:0),s);s.htmlNode.objBelong=s}if(D){s.images[0]=D}if(C){s.images[1]=C}if(A){s.images[2]=A}var c=this._drawNewTr(s.htmlNode);if((this.XMLloadingWarning)||(this._hAdI)){s.htmlNode.parentNode.parentNode.style.display="none"}if((u)&&u.tr&&(u.tr.nextSibling)){l.htmlNode.childNodes[0].insertBefore(c,u.tr.nextSibling)}else{if(this.parsingOn==l.id){this.parsedArray[this.parsedArray.length]=c}else{l.htmlNode.childNodes[0].appendChild(c)}}if((u)&&(!u.span)){u=null}if(this.XMLsource){if((e)&&(e!=0)){s.XMLload=0}else{s.XMLload=1}}s.tr=c;c.nodem=s;if(l.itemId==0){c.childNodes[0].className="hiddenRow"}if((l._r_logic)||(this._frbtr)){this._setSrc(s.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0],this.imPath+this.radioArray[0])}if(o){var w=o.split(",");for(var x=0;x=2){this._correctPlus(E[l.childsCount-2]);this._correctLine(E[l.childsCount-2])}if(l.childsCount!=2){this._correctPlus(E[0])}if(this.tscheck){this._correctCheckStates(l)}if(this._onradh){if(this.xmlstate==1){var a=this.onXLE;this.onXLE=function(n){this._onradh(j);if(a){a(n)}}}else{this._onradh(j)}}}return s};dhtmlXTreeObject.prototype.enableContextMenu=function(a){if(a){this.cMenu=a}};dhtmlXTreeObject.prototype.setItemContextMenu=function(h,g){var a=h.toString().split(this.dlmtr);for(var e=0;e=0;h--){if(u.childNodes[h]._dmark){this.deleteItem(u.childNodes[h].id)}}}var o=this._globalIdStorageFind(this.parsingOn);for(var h=0;h1){if(((g[1].style.display!="none")||(h==1))&&(h!=2)){this.allTree.childNodes[0].border="1";this.allTree.childNodes[0].border="0";nodestyle="none"}else{nodestyle=""}for(var e=1;ethis._getNodeLevel(e,0)){if(!this.dropLower){return this._moveNodeTo(a,g.parentObject)}else{if(e.id!=this.rootId){return this._moveNodeTo(a,e.parentObject,e)}else{return this._moveNodeTo(a,this.htmlNode,null)}}}else{return this._moveNodeTo(a,e.parentObject,e)}}else{return this._moveNodeTo(a,c)}};dhtmlXTreeObject.prototype._fixNodesCollection=function(m,j){var c=0;var g=0;var l=m.childNodes;var a=m.childsCount-1;if(j==l[a]){return}for(var h=0;h=2){this._correctPlus(u[v.childsCount-2]);this._correctLine(u[v.childsCount-2])}}this._correctPlus(u[v.childsCount-1]);if(this.tscheck){this._correctCheckStates(v)}if(e.tscheck){e._correctCheckStates(o)}}if(n>1){e._correctPlus(o.childNodes[n-2]);e._correctLine(o.childNodes[n-2])}e._correctPlus(o);e._correctLine(o);this._fixChildCountLabel(v);e._fixChildCountLabel(o);this.callEvent("onDrop",[s.id,v.id,(r?r.id:null),e,v.treeNod]);return s.id};dhtmlXTreeObject.prototype._clearStyles=function(a){if(!a.htmlNode){return}var g=a.htmlNode.childNodes[0].childNodes[0].childNodes[1];var c=g.nextSibling.nextSibling;a.span.innerHTML=a.label;a.i_sel=false;if(a._aimgs){this.dragger.removeDraggableItem(g.nextSibling)}if(this.checkBoxOff){g.childNodes[0].style.display="";g.childNodes[0].onclick=this.onCheckBoxClick;this._setSrc(g.childNodes[0],this.imPath+this.checkArray[a.checkstate])}else{g.style.display="none"}g.childNodes[0].treeNod=this;this.dragger.removeDraggableItem(c);if(this.dragAndDropOff){this.dragger.addDraggableItem(c,this)}if(this._aimgs){this.dragger.addDraggableItem(g.nextSibling,this)}c.childNodes[0].className="standartTreeRow";c.onclick=this.onRowSelect;c.ondblclick=this.onRowClick2;g.previousSibling.onclick=this.onRowClick;this._correctLine(a);this._correctPlus(a);for(var e=0;e0)){if(e.childNodes[c].unParsed){var a=this._getAllScraggyItemsXML(e.childNodes[c].unParsed,1)}else{var a=this._getAllScraggyItems(e.childNodes[c])}if(a){if(g){g+=this.dlmtr+a}else{g=a}}}else{if(!g){g=""+e.childNodes[c].id}else{g+=this.dlmtr+e.childNodes[c].id}}}return g};dhtmlXTreeObject.prototype._getAllFatItems=function(e){var g="";for(var c=0;c0)){if(!g){g=""+e.childNodes[c].id}else{g+=this.dlmtr+e.childNodes[c].id}if(e.childNodes[c].unParsed){var a=this._getAllFatItemsXML(e.childNodes[c].unParsed,1)}else{var a=this._getAllFatItems(e.childNodes[c])}if(a){g+=this.dlmtr+a}}}return g};dhtmlXTreeObject.prototype._getAllSubItems=function(j,h,g){if(g){c=g}else{var c=this._globalIdStorageFind(j)}if(!c){return 0}h="";for(var e=0;e=c.childsCount)){return null}return c.childNodes[a].id};dhtmlXTreeObject.prototype.getChildItemIdByIndex=function(e,a){var c=this._globalIdStorageFind(e);if((!c)||(a>=c.childsCount)){return null}return c.childNodes[a].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.selectionBar.style.display="none";this.allTree.className=this.allTree.className.replace(" selectionBox","")};dhtmlXTreeObject.prototype.enableDragAndDrop=function(c,a){if(c=="temporary_disabled"){this.dADTempOff=false;c=true}else{this.dADTempOff=true}this.dragAndDropOff=dhx4.s2b(c);if(this.dragAndDropOff){this.dragger.addDragLanding(this.allTree,this)}if(arguments.length>1){this._ddronr=(!dhx4.s2b(a))}};dhtmlXTreeObject.prototype._setMove=function(h,e,l){if(h.parentObject.span){var g=dhx4.absTop(h);var c=dhx4.absTop(this.allTree)-this.allTree.scrollTop;this.dadmodec=this.dadmode;this.dadmodefix=0;if(this.dadmode==2){var j=l-g+(document.body.scrollTop||document.documentElement.scrollTop)-2-h.offsetHeight/2;if((Math.abs(j)-h.offsetHeight/6)>0){this.dadmodec=1;if(j<0){this.dadmodefix=0-h.offsetHeight}}else{this.dadmodec=0}}if(this.dadmodec==0){var a=h.parentObject.span;a.className+=" dragAndDropRow";this._lastMark=a}else{this._clearMove();this.selectionBar.style.top=(g-c+((parseInt(h.parentObject.span.parentNode.previousSibling.childNodes[0].style.height)||18)-1)+this.dadmodefix)+"px";this.selectionBar.style.left="5px";if(this.allTree.offsetWidth>20){this.selectionBar.style.width=(this.allTree.offsetWidth-(_isFF?30:25))+"px"}this.selectionBar.style.display=""}this._autoScroll(null,g,c)}};dhtmlXTreeObject.prototype._autoScroll=function(e,c,a){if(this.autoScroll){if(e){c=dhx4.absTop(e);a=dhx4.absTop(this.allTree)-this.allTree.scrollTop}if((c-a-parseInt(this.allTree.scrollTop))>(parseInt(this.allTree.offsetHeight)-50)){this.allTree.scrollTop=parseInt(this.allTree.scrollTop)+20}if((c-a)<(parseInt(this.allTree.scrollTop)+30)){this.allTree.scrollTop=parseInt(this.allTree.scrollTop)-20}}};dhtmlXTreeObject.prototype._createDragNode=function(j,h){if(!this.dADTempOff){return null}var g=j.parentObject;if(!this.callEvent("onBeforeDrag",[g.id,h])){return null}if(!g.i_sel){this._selectItem(g,h)}this._checkMSelectionLogic();var c=document.createElement("div");var l=new Array();if(this._itim_dg){for(var a=0;a"+this._selected[a].span.innerHTML+""}}else{l=this.getSelectedItemText().split(this.dlmtr)}c.innerHTML=l.join("");c.style.position="absolute";c.className="dragSpanDiv";this._dragged=(new Array()).concat(this._selected);return c};dhtmlXTreeObject.prototype._focusNode=function(a){var c=dhx4.absTop(a.htmlNode)-dhx4.absTop(this.allTree);if((c>(this.allTree.offsetHeight-30))||(c<0)){this.allTree.scrollTop=c+this.allTree.scrollTop}};dhtmlXTreeObject.prototype._preventNsDrag=function(a){if((a)&&(a.preventDefault)){a.preventDefault();return false}return false};dhtmlXTreeObject.prototype._drag=function(l,m,a){if(this._autoOpenTimer){clearTimeout(this._autoOpenTimer)}if(!a.parentObject){a=this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];this.dadmodec=0}this._clearMove();var j=l.parentObject.treeNod;if((j)&&(j._clearMove)){j._clearMove("")}if((!this.dragMove)||(this.dragMove())){if((!j)||(!j._clearMove)||(!j._dragged)){var g=new Array(l.parentObject)}else{var g=j._dragged}var c=a.parentObject;for(var h=0;h2)?(a.checkstate-3):a.checkstate);this._setCheck(a);if(a.dscheck<3){a.dscheck=false}};dhtmlXTreeObject.prototype.smartRefreshBranch=function(c,a){this._branchUpdate=1;this.smartRefreshItem(c,a)};dhtmlXTreeObject.prototype.smartRefreshItem=function(g,e){var a=this._globalIdStorageFind(g);for(var c=0;c0)){if(e.childNodes[c].unParsed){var a=this._getAllScraggyItemsXML(e.childNodes[c].unParsed,1)}else{var a=this._getAllScraggyItems(e.childNodes[c])}if(a){if(g){g+=this.dlmtr+a}else{g=a}}}else{if(!g){g=""+e.childNodes[c].id}else{g+=this.dlmtr+e.childNodes[c].id}}}return g};dhtmlXTreeObject.prototype._getAllFatItems=function(e){var g="";for(var c=0;c0)){if(!g){g=""+e.childNodes[c].id}else{g+=this.dlmtr+e.childNodes[c].id}if(e.childNodes[c].unParsed){var a=this._getAllFatItemsXML(e.childNodes[c].unParsed,1)}else{var a=this._getAllFatItems(e.childNodes[c])}if(a){g+=this.dlmtr+a}}}return g};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){if(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)];var c=this._getAllChecked("","",2);if(c){a.push(c)}return a.join(this.dlmtr)};dhtmlXTreeObject.prototype._getAllChecked=function(g,e,h){if(!g){g=this.htmlNode}if(g.checkstate==h){if(!g.nocheckbox){if(e){e+=this.dlmtr+g.id}else{e=""+g.id}}}var a=g.childsCount;for(var c=0;c";e.span.style.paddingRight=e.span.style.paddingLeft="0px";e.span.onclick=e.span.ondblclick=function(j){(j||event).cancelBubble=true};e.span.childNodes[0].value=g;e.span.childNodes[0].onselectstart=function(j){(j||event).cancelBubble=true;return true};e.span.childNodes[0].onmousedown=function(j){(j||event).cancelBubble=true;return true};e.span.childNodes[0].focus();e.span.childNodes[0].focus();e.span.onclick=function(j){(j||event).cancelBubble=true;return false};e.span.className="";e.span.parentNode.className="";var c=this;e.span.childNodes[0].onkeydown=function(j){if(!j){j=window.event}if(j.keyCode==13){j.cancelBubble=true;c._stopEdit(window.undefined)}else{if(j.keyCode==27){c._stopEdit(window.undefined,true)}}(j||event).cancelBubble=true};this.callEvent("onEdit",[1,h,this])}};function jsonPointer(c,a){this.d=c;this.dp=a}jsonPointer.prototype={text:function(){var a=function(h){var g=[];for(var e=0;e"+cont+"")}window[id]=t;var oninit=obj.getAttribute("oninit");if(oninit){eval(oninit)}return t}function dhx_init_trees(){var c=document.getElementsByTagName("div");for(var a=0;a=e;a--){this[a]=this[a-1]}this[e]=c},_dhx_removeAt:function(a){this.splice(a,1)},_dhx_swapItems:function(a,e){var c=this[a];this[a]=this[e];this[e]=c}};function dhtmlXGridObject(id){if(dhtmlxEvent.initTouch){dhtmlxEvent.initTouch()}if(_isIE){try{document.execCommand("BackgroundImageCache",false,true)}catch(e){}}if(id){if(typeof(id)=="object"){this.entBox=id;if(!this.entBox.id){this.entBox.id="cgrid2_"+this.uid()}}else{this.entBox=document.getElementById(id)}}else{this.entBox=document.createElement("DIV");this.entBox.id="cgrid2_"+this.uid()}this.entBox.innerHTML="";dhx4._eventable(this);var self=this;this._wcorr=0;this.fontWidth=7;this.cell=null;this.row=null;this.iconURL="";this.editor=null;this._f2kE=true;this._dclE=true;this.combos=new Array(0);this.defVal=new Array(0);this.rowsAr={};this.rowsBuffer=dhtmlxArray();this.rowsCol=dhtmlxArray();this._data_cache={};this._ecache={};this._ud_enabled=true;this.xmlLoader=this.doLoadDetails;this._maskArr=[];this.selectedRows=dhtmlxArray();this.UserData={};this._sizeFix=this._borderFix=0;this.entBox.className+=" gridbox";this.entBox.style.width=this.entBox.getAttribute("width")||(window.getComputedStyle?(this.entBox.style.width||window.getComputedStyle(this.entBox,null)["width"]):(this.entBox.currentStyle?this.entBox.currentStyle.width:this.entBox.style.width||0))||"100%";this.entBox.style.height=this.entBox.getAttribute("height")||(window.getComputedStyle?(this.entBox.style.height||window.getComputedStyle(this.entBox,null)["height"]):(this.entBox.currentStyle?this.entBox.currentStyle.height:this.entBox.style.height||0))||"100%";this.entBox.style.cursor="default";this.entBox.onselectstart=function(){return false};var t_creator=function(name){var t=document.createElement("TABLE");t.cellSpacing=t.cellPadding=0;t.style.cssText="width:100%;table-layout:fixed;";t.className=name.substr(2);return t};this.obj=t_creator("c_obj");this.hdr=t_creator("c_hdr");this.hdr.style.marginRight="20px";this.hdr.style.paddingRight="20px";this.objBox=document.createElement("DIV");this.objBox.style.width="100%";this.objBox.style.overflow="auto";this.objBox.appendChild(this.obj);this.objBox.className="objbox";if(dhtmlx.$customScroll){dhtmlx.CustomScroll.enable(this)}this.hdrBox=document.createElement("DIV");this.hdrBox.style.width="100%";this.hdrBox.style.height="25px";this.hdrBox.style.overflow="hidden";this.hdrBox.className="xhdr";this.preloadImagesAr=new Array(0);this.sortImg=document.createElement("DIV");this.sortImg.style.display="none";this.hdrBox.appendChild(this.sortImg);this.hdrBox.appendChild(this.hdr);this.hdrBox.style.position="relative";this.entBox.appendChild(this.hdrBox);this.entBox.appendChild(this.objBox);this.entBox.grid=this;this.objBox.grid=this;this.hdrBox.grid=this;this.obj.grid=this;this.hdr.grid=this;this.cellWidthPX=[];this.cellWidthPC=[];this.cellWidthType=this.entBox.cellwidthtype||"px";this.delim=this.entBox.delimiter||",";this._csvDelim=",";this.hdrLabels=[];this.columnIds=[];this.columnColor=[];this._hrrar=[];this.cellType=dhtmlxArray();this.cellAlign=[];this.initCellWidth=[];this.fldSort=[];this._srdh=(_isIE&&(document.compatMode!="BackCompat")?22:20);this.imgURL=window.dhx_globalImgPath||"";this.isActive=false;this.isEditable=true;this.useImagesInHeader=false;this.pagingOn=false;this.rowsBufferOutSize=0;dhtmlxEvent(window,"unload",function(){try{if(self.destructor){self.destructor()}}catch(e){}});this.setSkin=function(name){this._srdh=window.dhx4.readFromCss("dhxgrid_rh_"+name)+4;this.skin_name=name;if(this._imgURL){this.setImagePath(this._imgURL)}var classname=this.entBox.className.split(" gridbox")[0];this.entBox.className=classname+" gridbox gridbox_"+name+(_isIE?" isIE":" isModern");this.skin_h_correction=0;this.enableAlterCss("ev_"+name,"odd_"+name,this.isTreeGrid());this._fixAlterCss();switch(name){case"dhx_terrace":this._srdh=33;this.forceDivInHeader=true;break;case"dhx_web":this.forceDivInHeader=true;this._srdh=31;break;case"dhx_skyblue":this.forceDivInHeader=true;break}if(_isIE&&this.hdr){var d=this.hdr.parentNode;d.removeChild(this.hdr);d.appendChild(this.hdr)}this.setSizes()};if(_isIE){this.preventIECaching(true)}if(window.dhtmlDragAndDropObject){this.dragger=new dhtmlDragAndDropObject()}this._doOnScroll=function(e,mode){this.callEvent("onScroll",[this.objBox.scrollLeft,this.objBox.scrollTop]);this.doOnScroll(e,mode)};this.doOnScroll=function(e,mode){this.hdrBox.scrollLeft=this.objBox.scrollLeft;if(this.ftr){this.ftr.parentNode.scrollLeft=this.objBox.scrollLeft}if(mode){return}if(this._srnd){if(this._dLoadTimer){window.clearTimeout(this._dLoadTimer)}this._dLoadTimer=window.setTimeout(function(){if(self._update_srnd_view){self._update_srnd_view()}},100)}};this.attachToObject=function(obj){obj.appendChild(this.globalBox?this.globalBox:this.entBox);this.setSizes()};this.init=function(fl){if((this.isTreeGrid())&&(!this._h2)){this._h2=this._createHierarchy();if((this._fake)&&(!this._realfake)){this._fake._h2=this._h2}this._tgc={imgURL:null}}if(!this._hstyles){return}if(!this.skin_name){this.setSkin(window.dhx4.skin||(typeof(dhtmlx)!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxgrid")||"dhx_skyblue")}this.editStop();this.lastClicked=null;this.resized=null;this.fldSorted=this.r_fldSorted=null;this.cellWidthPX=[];this.cellWidthPC=[];if(this.hdr.rows.length>0){var temp=this.xmlFileUrl;this.clearAll(true);this.xmlFileUrl=temp}var hdrRow=this.hdr.insertRow(0);for(var i=0;i0.5){cwidth++;fix--}var rwidth=this.cellWidthPX[i]=Math.floor(cwidth);var fix=fix+cwidth-rwidth}else{if(typeof this.cellWidthPX[i]=="undefined"){this.cellWidthPX[i]=this.initCellWidth[i]}}if(!this._hrrar[i]){summ+=this.cellWidthPX[i]*1}}if(fcols.length){var ms=Math.floor((gridWidth-summ)/fcols.length);if(ms<0){ms=1}for(var i=0;isumm){var last=fcols[fcols.length-1];this.cellWidthPX[last]=this.cellWidthPX[last]+(gridWidth-summ);summ=gridWidth}this._setAutoResize()}this.obj.style.width=summ+"px";this.hdr.style.width=summ+"px";if(this.ftr){this.ftr.style.width=summ+"px"}this.chngCellWidth();return summ};this.setSizes=function(){if((!this.hdr.rows[0])){return}var quirks=this.quirks=(_isIE&&document.compatMode=="BackCompat");var outerBorder=(this.entBox.offsetWidth-this.entBox.clientWidth)/2;if(!this.dontSetSizes){if(this.globalBox){if(!this.globalBox.clientWidth){return}var ow=this.globalBox.clientWidth;var splitOuterBorder=(this.globalBox.offsetWidth-ow)/2;if(this._delta_x&&!this._realfake){this.globalBox.style.width=this._delta_x;var owu=this.globalBox.clientWidth;this.entBox.style.width=Math.max(0,(owu+(quirks?splitOuterBorder*2:0))-this._fake.entBox.clientWidth)+"px";if(owu!=this._lastTimeSplitWidth){this._fake._correctSplit(this._fake.entBox.clientWidth);this._lastTimeSplitWidth=owu}}if(this._delta_y&&!this._realfake){this.globalBox.style.height=this._delta_y;this.entBox.style.overflow=this._fake.entBox.style.overflow="hidden";this.entBox.style.height=this._fake.entBox.style.height=this.globalBox.clientHeight+(quirks?splitOuterBorder*2:0)+"px"}}else{if(this._delta_x){if(this.entBox.parentNode&&this.entBox.parentNode.tagName=="TD"){this.entBox.style.width="1px";this.entBox.style.width=parseInt(this._delta_x)*this.entBox.parentNode.clientWidth/100-outerBorder*2+"px"}else{this.entBox.style.width=this._delta_x}}if(this._delta_y){this.entBox.style.height=this._delta_y}}}window.clearTimeout(this._sizeTime);if(!this.entBox.offsetWidth&&(!this.globalBox||!this.globalBox.offsetWidth)){this._sizeTime=window.setTimeout(function(){if(self.setSizes){self.setSizes()}},250);return}var border_x=((!this._wthB)&&((this.entBox.cmp||this._delta_x)&&(this.skin_name||"").indexOf("dhx")==0&&!quirks)?2:0);var border_y=((!this._wthB)&&((this.entBox.cmp||this._delta_y)&&(this.skin_name||"").indexOf("dhx")==0&&!quirks)?2:0);if(this._sizeFix){border_x-=this._sizeFix;border_y-=this._sizeFix}var isVScroll=this.parentGrid?false:(this.objBox.scrollHeight>this.objBox.offsetHeight);var scrfix=dhtmlx.$customScroll?0:18;var gridWidth=this.entBox.clientWidth-(this.skin_h_correction||0)*(quirks?0:1)-border_x;var gridWidthActive=this.entBox.clientWidth-(this.skin_h_correction||0)-border_x;var gridHeight=this.entBox.clientHeight-border_y;var summ=this.setColumnSizes(gridWidthActive-(isVScroll?scrfix:0)-(this._correction_x||0));var isHScroll=this.parentGrid?false:((this.objBox.scrollWidth>this.objBox.offsetWidth)||(this.objBox.style.overflowX=="scroll"));var headerHeight=this.hdr.clientHeight;var footerHeight=this.ftr?this.ftr.clientHeight:0;var newWidth=gridWidth;var newHeight=gridHeight-headerHeight-footerHeight;if(this._awdth&&this._awdth[0]&&this._awdth[1]==99999){isHScroll=0}if(this._ahgr){if(this._ahgrMA){newHeight=this.entBox.parentNode.clientHeight-headerHeight-footerHeight}else{newHeight=this.obj.offsetHeight+(isHScroll?scrfix:0)+(this._correction_y||0)}if(this._ahgrM){if(this._ahgrF){newHeight=Math.min(this._ahgrM,newHeight+headerHeight+footerHeight)-headerHeight-footerHeight}else{newHeight=Math.min(this._ahgrM,newHeight)}}if(isVScroll&&newHeight>=this.obj.scrollHeight+(isHScroll?scrfix:0)){isVScroll=false;this.setColumnSizes(gridWidthActive-(this._correction_x||0))}}if((this._awdth)&&(this._awdth[0])){if(this.cellWidthType=="%"){this.cellWidthType="px"}if(this._fake){summ+=this._fake.entBox.clientWidth}var newWidth=Math.min(Math.max(summ+(isVScroll?scrfix:0),this._awdth[2]),this._awdth[1])+(this._correction_x||0);this.objBox.style.overflowX=(!isVScroll&&this.objBox.scrollWidth<=newWidth)?"hidden":"auto";if(this._fake){newWidth-=this._fake.entBox.clientWidth}}newHeight=Math.max(0,newHeight);this._ff_size_delta=(this._ff_size_delta==0.1)?0.2:0.1;if(!_isFF){this._ff_size_delta=0}if(!this.dontSetSizes){this.entBox.style.width=Math.max(0,newWidth+(quirks?2:0)*outerBorder+this._ff_size_delta)+"px";this.entBox.style.height=newHeight+(quirks?2:0)*outerBorder+headerHeight+footerHeight+"px"}this.objBox.style.height=newHeight+((quirks&&!isVScroll)?2:0)*outerBorder+"px";this.hdrBox.style.height=headerHeight+"px";if(newHeight!=gridHeight){this.doOnScroll(0,!this._srnd)}var ext=this["setSizes_"+this.skin_name];if(ext){ext.call(this)}this.setSortImgPos();if(headerHeight!=this.hdr.clientHeight&&this._ahgr){this.setSizes()}this.callEvent("onSetSizes",[])};this.chngCellWidth=function(){if((_isOpera)&&(this.ftr)){this.ftr.width=this.objBox.scrollWidth+"px"}var l=this._cCount;for(var i=0;i1){var a_sizes=new Array();for(var i=0;i((this._drsclmW&&!this._notresize)?(this._drsclmW[ind]||10):10)){this.obj.rows[0].childNodes[ind].style.width=fcolW+"px";this.hdr.rows[0].childNodes[ind].style.width=fcolW+"px";if(this.ftr){this.ftr.rows[0].childNodes[ind].style.width=fcolW+"px"}if(this.cellWidthType=="px"){this.cellWidthPX[ind]=fcolW}else{var gridWidth=parseInt(this.entBox.offsetWidth);if(this.objBox.scrollHeight>this.objBox.offsetHeight){gridWidth-=17}var pcWidth=Math.round(fcolW/gridWidth*100);this.cellWidthPC[ind]=pcWidth}if(this.sortImg.style.display!="none"){this.setSortImgPos()}}else{return false}};this.setSortImgState=function(state,ind,order,row){order=(order||"asc").toLowerCase();if(!dhx4.s2b(state)){this.sortImg.style.display="none";this.fldSorted=this.r_fldSorted=null;return}if(order=="asc"){this.sortImg.className="dhxgrid_sort_asc"}else{this.sortImg.className="dhxgrid_sort_desc"}this.sortImg.style.display="";this.fldSorted=this.hdr.rows[0].childNodes[ind];var r=this.hdr.rows[row||1];if(!r){return}for(var i=0;ilcRowIndex){var strt=lcRowIndex;var end=elRowIndex}else{var strt=elRowIndex;var end=lcRowIndex}for(var i=0;i=strt&&i<=end)){if(this.rowsCol[i]&&(!this.rowsCol[i]._sRow)){if(!this.rowsCol[i].idd){continue}if(this.rowsCol[i].className.indexOf("rowselected")==-1&&(this.callEvent("onBeforeSelect",[this.rowsCol[i].idd,psid,el._cellIndex]))){this.rowsCol[i].className+=" rowselected";this.selectedRows[this.selectedRows.length]=this.rowsCol[i]}}else{this.clearSelection();return this.doClick(el,fl,0,show)}}}}else{if(selMethod==2){if(el.parentNode.className.indexOf("rowselected")!=-1){el.parentNode.className=el.parentNode.className.replace(/rowselected/g,"");this.selectedRows._dhx_removeAt(this.selectedRows._dhx_find(el.parentNode));var skipRowSelection=true;show=false}}}this.editStop();if(typeof(el.parentNode.idd)=="undefined"){return true}if((!skipRowSelection)&&(!el.parentNode._sRow)){if(this.callEvent("onBeforeSelect",[el.parentNode.idd,psid,el._cellIndex])){if(this.getSelectedRowId()!=el.parentNode.idd){if(selMethod==0){this.clearSelection()}this.cell=el;if((prow==el.parentNode)&&(this._chRRS)){fl=false}this.row=el.parentNode;this.row.className+=" rowselected";if(this.selectedRows._dhx_find(this.row)==-1){this.selectedRows[this.selectedRows.length]=this.row}}else{this.cell=el;this.row=el.parentNode}}else{fl=false}}if(this.cell&&this.cell.parentNode.className.indexOf("rowselected")!=-1){this.cell.className=this.cell.className.replace(/cellselected/g,"")+" cellselected"}if(selMethod!=1){if(!this.row){return}}this.lastClicked=el.parentNode;var rid=this.row.idd;var cid=this.cell;if(fl&&typeof(rid)!="undefined"&&cid&&!skipRowSelection){self.onRowSelectTime=setTimeout(function(){if(self.callEvent){self.callEvent("onRowSelect",[rid,cid._cellIndex])}},100)}else{this.callEvent("onRowSelectRSOnly",[rid])}if(this.checkEvent("onSelectStateChanged")){var afinal=this.getSelectedId();if(initial!=afinal){this.callEvent("onSelectStateChanged",[afinal,initial])}}if(skipRowSelection){return false}}this.isActive=true;if(show!==false&&this.cell&&this.cell.parentNode.idd){this.moveToVisible(this.cell)}};this.selectAll=function(){this.clearSelection();var coll=this.rowsBuffer;if(this.pagingOn){coll=this.rowsCol}for(var i=0;i(this.objBox.offsetWidth+this.objBox.scrollLeft)){if(cell_obj.offsetLeft>this.objBox.scrollLeft){scrollLeft=cell_obj.offsetLeft-(this.objBox.offsetWidth-cell_obj.offsetWidth)+5}}else{if(cell_obj.offsetLeft(this.objBox.offsetHeight+this.objBox.scrollTop)){var scrollTop=distance}else{if(distance(new Date).valueOf()){return}this._Opera_stop=null}}if(this.editor&&this.editor!=null){this.editor.cell.className=this.editor.cell.className.replace("editable","");if(mode){var t=this.editor.val;this.editor.detach();this.editor.setValue(t);this.editor=null;this.callEvent("onEditCancel",[this.row.idd,this.cell._cellIndex,t]);return}if(this.editor.detach()){this.cell.wasChanged=true}var g=this.editor;if(g==null){return}this.editor=null;var z=this.callEvent("onEditCell",[2,this.row.idd,this.cell._cellIndex,g.getValue(),g.val]);if((typeof(z)=="string")||(typeof(z)=="number")){g[g.setImage?"setLabel":"setValue"](z)}else{if(!z){g[g.setImage?"setLabel":"setValue"](g.val)}}if(this._ahgr&&this.multiLine){this.setSizes()}}};this._nextRowCell=function(row,dir,pos){row=this._nextRow((this._groups?this.rowsCol:this.rowsBuffer)._dhx_find(row),dir);if(!row){return null}return row.childNodes[row._childIndexes?row._childIndexes[pos]:pos]};this._getNextCell=function(acell,dir,i){acell=acell||this.cell;var arow=acell.parentNode;if(this._tabOrder){i=this._tabOrder[acell._cellIndex];if(typeof i!="undefined"){if(i<0){acell=this._nextRowCell(arow,dir,Math.abs(i)-1)}else{acell=arow.childNodes[i]}}}else{var i=acell._cellIndex+dir;if(i>=0&&i=this.rowsBuffer.length){new_ind=this.rowsBuffer.length-1}if(this._srnd&&!this.rowsBuffer[new_ind]){this.objBox.scrollTop+=Math.floor((dir)*this.objBox.offsetHeight/(this._srdh||20))*(this._srdh||20);if(this._fake){this._fake.objBox.scrollTop=this.objBox.scrollTop}master._r_select=new_ind}else{this.selectCell(new_ind,this.cell._cellIndex,true,false,false,(this.multiLine||this._srnd));if(!this.multiLine&&!this._srnd&&!this._realfake){this.objBox.scrollTop=this.getRowById(this.getRowId(new_ind)).offsetTop;if(this._fake){this._fake.objBox.scrollTop=this.objBox.scrollTop}}master._r_select=null}};this.doKey=function(ev){if(!ev){return true}if((ev.target||ev.srcElement).value!==window.undefined){var zx=(ev.target||ev.srcElement);if(zx.className!="dhxcombo_input"&&((!zx.parentNode)||(zx.parentNode.className.indexOf("editable")==-1))){return true}}if((globalActiveDHTMLGridObject)&&(this!=globalActiveDHTMLGridObject)){return globalActiveDHTMLGridObject.doKey(ev)}if(this.isActive==false){return true}if(this._htkebl){return true}if(!this.callEvent("onKeyPress",[ev.keyCode,ev.ctrlKey,ev.shiftKey,ev])){return false}var code="k"+ev.keyCode+"_"+(ev.ctrlKey?1:0)+"_"+(ev.shiftKey?1:0);if(this.cell){if(this._key_events[code]){if(false===this._key_events[code].call(this)){return true}if(ev.preventDefault){ev.preventDefault()}ev.cancelBubble=true;return false}if(this._key_events.k_other){this._key_events.k_other.call(this,ev)}}return true};this.selectRow=function(r,fl,preserve,show){if(typeof(r)!="object"){r=this.render_row(r)}this.selectCell(r,0,fl,preserve,false,show)};this.wasDblClicked=function(ev){var el=this.getFirstParentOfType(_isIE?ev.srcElement:ev.target,"TD");if(el){var rowId=el.parentNode.idd;return this.callEvent("onRowDblClicked",[rowId,el._cellIndex,ev])}};this._onHeaderClick=function(e,el){var that=this.grid;el=el||that.getFirstParentOfType(_isIE?event.srcElement:e.target,"TD");if(this.grid.resized==null){if(!(this.grid.callEvent("onHeaderClick",[el._cellIndexS,(e||window.event)]))){return false}that.sortField(el._cellIndexS,false,el)}this.grid.resized=null};this.deleteSelectedRows=function(){var num=this.selectedRows.length;if(num==0){return}var tmpAr=this.selectedRows;this.selectedRows=dhtmlxArray();for(var i=num-1;i>=0;i--){var node=tmpAr[i];if(!this.deleteRow(node.idd,node)){this.selectedRows[this.selectedRows.length]=node}else{if(node==this.row){var ind=i}}}if(ind){try{if(ind+1>this.rowsCol.length){ind--}this.selectCell(ind,0,true)}catch(er){this.row=null;this.cell=null}}};this.getSelectedRowId=function(){var selAr=new Array(0);var uni={};for(var i=0;i]+)\].*/,"$1");label=label.substr(label.indexOf("]")+1,label.length);hdrHTML+=""}hdrHTML+=label;hdrHTML+="";z.cells[col].innerHTML=hdrHTML;if(this._hstyles[col]){z.cells[col].style.cssText=this._hstyles[c]}}else{z.cells[col].style.textAlign="left";z.cells[col].innerHTML="";var a=new Image();a.src=""+label.replace(/(\.[a-z]+)/,".des$1");this.preloadImagesAr[this.preloadImagesAr.length]=a;var b=new Image();b.src=""+label.replace(/(\.[a-z]+)/,".asc$1");this.preloadImagesAr[this.preloadImagesAr.length]=b}if((label||"").indexOf("#")!=-1){var t=label.match(/(^|{)#([^}]+)(}|$)/);if(t){var tn="_in_header_"+t[2];if(this[tn]){this[tn]((this.forceDivInHeader?z.cells[col].firstChild:z.cells[col]),col,label.split(t[0]))}}}};this.setColLabel=function(a,b,ind,c){return this.setColumnLabel(a,b,(ind||0)+1,c)};this.clearAll=function(header){if(!this.obj.rows[0]){return}if(this._h2){this._h2=this._createHierarchy();if(this._fake){if(this._realfake){this._h2=this._fake._h2}else{this._fake._h2=this._h2}}}this.limit=this._limitC=0;this.editStop(true);if(this._dLoadTimer){window.clearTimeout(this._dLoadTimer)}if(this._dload){this.objBox.scrollTop=0;this.limit=this._limitC||0;this._initDrF=true}var len=this.rowsCol.length;len=this.obj.rows.length;for(var i=len-1;i>0;i--){var t_r=this.obj.rows[i];t_r.parentNode.removeChild(t_r)}if(header){this._master_row=null;this.obj.rows[0].parentNode.removeChild(this.obj.rows[0]);for(var i=this.hdr.rows.length-1;i>=0;i--){var t_r=this.hdr.rows[i];t_r.parentNode.removeChild(t_r)}if(this.ftr){this.ftr.parentNode.removeChild(this.ftr);this.ftr=null}this._aHead=this.ftr=this.cellWidth=this._aFoot=null;this.cellType=dhtmlxArray();this._hrrar=[];this.columnIds=[];this.combos=[];this._strangeParams=[];this.defVal=[];this._ivizcol=null}this.row=null;this.cell=null;this.rowsCol=dhtmlxArray();this.rowsAr={};this._RaSeCol=[];this.rowsBuffer=dhtmlxArray();this.UserData=[];this.selectedRows=dhtmlxArray();if(this.pagingOn||this._srnd){this.xmlFileUrl=""}if(this.pagingOn){this.changePage(1)}if(this._contextCallTimer){window.clearTimeout(this._contextCallTimer)}if(this._sst){this.enableStableSorting(true)}this._fillers=this.undefined;this.setSortImgState(false);this.setSizes();this.callEvent("onClearAll",[])};this.sortField=function(ind,repeatFl,r_el){if(this.getRowsNum()==0){return false}var el=this.hdr.rows[0].cells[ind];if(!el){return}if(el.tagName=="TH"&&(this.fldSort.length-1)>=el._cellIndex&&this.fldSort[el._cellIndex]!="na"){var data=this.getSortingState();var sortType=(data[0]==ind&&data[1]=="asc")?"des":"asc";if(!this.callEvent("onBeforeSorting",[ind,this.fldSort[ind],sortType])){return}this.sortImg.className="dhxgrid_sort_"+(sortType=="asc"?"asc":"desc");if(this.useImagesInHeader){var cel=this.hdr.rows[1].cells[el._cellIndex].firstChild;if(this.fldSorted!=null){var celT=this.hdr.rows[1].cells[this.fldSorted._cellIndex].firstChild;celT.src=celT.src.replace(/(\.asc\.)|(\.des\.)/,".")}cel.src=cel.src.replace(/(\.[a-z]+)$/,"."+sortType+"$1")}this.sortRows(el._cellIndex,this.fldSort[el._cellIndex],sortType);this.fldSorted=el;this.r_fldSorted=r_el;var c=this.hdr.rows[1];var c=r_el.parentNode;var real_el=c._childIndexes?c._childIndexes[el._cellIndex]:el._cellIndex;this.setSortImgPos(false,false,false,r_el)}};this.setCustomSorting=function(func,col){if(!this._customSorts){this._customSorts=new Array()}this._customSorts[col]=(typeof(func)=="string")?eval(func):func;this.fldSort[col]="cus"};this.enableHeaderImages=function(fl){this.useImagesInHeader=fl};this.setHeader=function(hdrStr,splitSign,styles){if(typeof(hdrStr)!="object"){var arLab=this._eSplit(hdrStr)}else{arLab=[].concat(hdrStr)}var arWdth=new Array(0);var arTyp=new dhtmlxArray(0);var arAlg=new Array(0);var arVAlg=new Array(0);var arSrt=new Array(0);for(var i=0;i";if(this.isTreeGrid()){this._h2.forEachChildF(0,function(el){var temp=this._serializeRow(this.render_row_tree(-1,el.id));out.push(temp);if(temp){return true}else{return false}},this,function(){out.push(close)})}else{for(var i=0;i");if(this._sUDa&&this.UserData[r.idd]){keysAr=this.UserData[r.idd].getKeys();for(var ii=0;ii"+(this._asCDATA?"":"")+"")}}var changeFl=false;for(var jj=0;jj"}if((this._ecspn)&&(zx.cell.colSpan)&&zx.cell.colSpan>1){out.push(' colspan="'+zx.cell.colSpan+'" ')}if(this._chAttr){if(zx.wasChanged()){out.push(' changed="1"');changeFl=true}}else{if((this._onlChAttr)&&(zx.wasChanged())){changeFl=true}}if(this._sAll&&this.cellType[jj]=="tree"){out.push((this._h2?(" image='"+this._h2.get[r.idd].image+"'"):"")+">"+zxVal+"")}else{out.push(">"+zxVal+"")}if((this._ecspn)&&(zx.cell.colSpan)){for(var u=0;u");jj++}}}}if((this._onlChAttr)&&(!changeFl)&&(!r._added)){return""}return out.join("")};this._serialiseConfig=function(){var out="";for(var i=0;i";if(this._asCDATA){out+=""}else{out+=this.getColumnLabel(i)}var z=this.getCombo(i);if(z){for(var j=0;j"+z.values[j]+""}}out+=""}return out+=""};this.serialize=function(){var out='';if(this._mathSerialization){this._agetm="getMathValue"}else{this._agetm="getValue"}if(this._sUDa&&this.UserData.gridglobaluserdata){var keysAr=this.UserData.gridglobaluserdata.getKeys();for(var i=0;i"+this.UserData.gridglobaluserdata.get(keysAr[i])+""}}if(this._sConfig){out+=this._serialiseConfig()}out+=this._serialise();out+="";return out};this.getPosition=function(oNode,pNode){if(!pNode){var pos=dhx4.getOffset(oNode);return[pos.left,pos.top]}pNode=pNode||document.body;var oCurrentNode=oNode;var iLeft=0;var iTop=0;while((oCurrentNode)&&(oCurrentNode!=pNode)){iLeft+=oCurrentNode.offsetLeft-oCurrentNode.scrollLeft;iTop+=oCurrentNode.offsetTop-oCurrentNode.scrollTop;oCurrentNode=oCurrentNode.offsetParent}if(pNode==document.body){if(_isIE){iTop+=document.body.offsetTop||document.documentElement.offsetTop;iLeft+=document.body.offsetLeft||document.documentElement.offsetLeft}else{if(!_isFF){iLeft+=document.body.offsetLeft;iTop+=document.body.offsetTop}}}return[iLeft,iTop]};this.getFirstParentOfType=function(obj,tag){while(obj&&obj.tagName!=tag&&obj.tagName!="BODY"){obj=obj.parentNode}return obj};this.objBox.onscroll=function(){this.grid._doOnScroll()};this.hdrBox.onscroll=function(){if(this._try_header_sync){return}this._try_header_sync=true;if(Math.abs(this.grid.objBox.scrollLeft-this.scrollLeft)>1){this.grid.objBox.scrollLeft=this.scrollLeft}this._try_header_sync=false};if((!_isOpera)||(_OperaRv>8.5)){this.hdr.onmousemove=function(e){this.grid.changeCursorState(e||window.event)};this.hdr.onmousedown=function(e){return this.grid.startColResize(e||window.event)}}this.obj.onmousemove=this._drawTooltip;this.objBox.onclick=function(e){e=e||event;e.cancelBubble=true;this.firstChild.grid.setActive(true);window.dhx4.callEvent("_onGridClick",[e,this.firstChild.grid])};this.obj.onclick=function(e){if(this.grid._doClick(e||window.event)!==false){if(this.grid._sclE){this.grid.editCell(e||window.event)}else{this.grid.editStop()}}e=e||event;e.cancelBubble=true;window.dhx4.callEvent("_onGridClick",[e,this.grid])};if(_isMacOS){this.entBox.oncontextmenu=function(e){e.cancelBubble=true;if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}var that=this.grid;if(that._realfake){that=that._fake}return that._doContClick(e||window.event)}}else{this.entBox.onmousedown=function(e){return this.grid._doContClick(e||window.event)};this.entBox.oncontextmenu=function(e){if(this.grid._ctmndx){(e||event).cancelBubble=true}return !this.grid._ctmndx}}this.obj.ondblclick=function(e){if(!this.grid.wasDblClicked(e||window.event)){return false}if(this.grid._dclE){var row=this.grid.getFirstParentOfType((_isIE?event.srcElement:e.target),"TR");if(row==this.grid.row){this.grid.editCell(e||window.event)}}(e||event).cancelBubble=true;if(_isOpera){return false}};this.hdr.onclick=this._onHeaderClick;this.sortImg.onclick=function(){self._onHeaderClick.apply({grid:self},[null,self.r_fldSorted])};this.hdr.ondblclick=this._onHeaderDblClick;if(!document.body._dhtmlxgrid_onkeydown){dhtmlxEvent(document,"keydown",function(e){if(globalActiveDHTMLGridObject){return globalActiveDHTMLGridObject.doKey(e||window.event)}});document.body._dhtmlxgrid_onkeydown=true}dhtmlxEvent(document.body,"click",function(){if(self.editStop){self.editStop()}if(self.isActive){self.setActive(false)}});if(this.entBox.style.height.toString().indexOf("%")!=-1){this._delta_y=this.entBox.style.height}if(this.entBox.style.width.toString().indexOf("%")!=-1){this._delta_x=this.entBox.style.width}if(this._delta_x||this._delta_y){this._setAutoResize()}this.setColHidden=this.setColumnsVisibility;this.enableCollSpan=this.enableColSpan;this.setMultiselect=this.enableMultiselect;this.setMultiLine=this.enableMultiline;this.deleteSelectedItem=this.deleteSelectedRows;this.getSelectedId=this.getSelectedRowId;this.getHeaderCol=this.getColumnLabel;this.isItemExists=this.doesRowExist;this.getColumnCount=this.getColumnsNum;this.setSelectedRow=this.selectRowById;this.setHeaderCol=this.setColumnLabel;this.preventIECashing=this.preventIECaching;this.enableAutoHeigth=this.enableAutoHeight;this.getUID=this.uid;if(dhtmlx.image_path){this.setImagePath(dhtmlx.image_path)}if(dhtmlx.skin){this.setSkin(dhtmlx.skin)}return this}dhtmlXGridObject.prototype={getRowAttribute:function(c,a){return this.getRowById(c)._attrs[a]},setRowAttribute:function(e,a,c){this.getRowById(e)._attrs[a]=c},isTreeGrid:function(){return(this.cellType._dhx_find("tree")!=-1)},setRowHidden:function(j,e){var c=dhx4.s2b(e);var h=this.getRowById(j);if(!h){return}if(h.expand===""){this.collapseKids(h)}if((e)&&(h.style.display!="none")){h.style.display="none";var g=this.selectedRows._dhx_find(h);if(g!=-1){h.className=h.className.replace("rowselected","");for(var a=0;a0){var c=this[e];this[e]=this[e+1];this[e+1]=c}}h--}}},enableKeyboardSupport:function(a){this._htkebl=!dhx4.s2b(a)},enableContextMenu:function(a){this._ctmndx=a},setScrollbarWidthCorrection:function(a){},enableTooltips:function(c){this._enbTts=c.split(",");for(var a=0;a-1){a=g.length-a-1}var c=g.indexOf(",");if(c>-1){c=g.length-a-2-c}if(typeof h!="string"){h=this.i18n.decimal_separator}if(typeof l!="string"){l=this.i18n.group_separator}var n=m.split(g)[0];var j=m.split(g)[1];this._maskArr[e]=[a,c,n,j,h,l]},_aplNFb:function(h,g){var c=this._maskArr[g];if(!c){return h}var e=parseFloat(h.toString().replace(/[^0-9]*/g,""));if(h.toString().substr(0,1)=="-"){e=e*-1}if(c[0]>0){e=e/Math.pow(10,c[0])}return e},_aplNF:function(l,h){var e=this._maskArr[h];if(!e){return l}var m=(parseFloat(l)<0?"-":"")+e[2];l=Math.abs(Math.round(parseFloat(l)*Math.pow(10,e[0]>0?e[0]:0))).toString();l=(l.length0){for(var g=(e[0]>0?0:1)+e[0]+e[1];g0){if(this.hdr.rows.length>0){this.clearAll(true)}var a=[[],[],[],[],[],[],[],[],[]];var v=["","width","type","align","sort","color","format","hidden","id"];var u=["",C,"setColTypes","setColAlign","setColSorting","setColumnColor","","","setColumnIds"];for(var A=0;A0){if(!this.UserData.gridglobaluserdata){this.UserData.gridglobaluserdata=new Hashtable()}for(var y=0;y=this.grid._cCount){return}var a=this.grid.cells3(h,l._cellIndex);if(!a||!a.cell||!a.cell._attrs){return}if(g._title){a.cell.title=""}if(!a.cell._attrs.title){g._title=true}if(a){g.title=a.cell._attrs.title||(a.getTitle?a.getTitle():(a.getValue()||"").toString().replace(/<[^>]*>/gi,""))}return true},enableCellWidthCorrection:function(a){if(_isFF){this._wcorr=parseInt(a)}},getAllRowIds:function(e){var a=[];for(var c=0;c1)){if(a._childIndexes){var o=a._childIndexes[x]}else{var o=x;a._childIndexes=new Array();for(var v=0;ve){e=r}}e+=20+(c||0);this._setColumnSizeR(o,e);this._notresize=false;this.setSizes()},detachHeader:function(a,e){e=e||this.hdr;var c=e.rows[a+1];if(c){c.parentNode.removeChild(c)}this.setSizes()},detachFooter:function(a){this.detachHeader(a,this.ftr)},attachHeader:function(a,g,c){if(typeof(a)=="string"){a=this._eSplit(a)}if(typeof(g)=="string"){g=g.split(this.delim)}c=c||"_aHead";if(this.hdr.rows.length){if(a){this._createHRow([a,g],this[(c=="_aHead")?"hdr":"ftr"])}else{if(this[c]){for(var e=0;e1)){var y=r.rows.length-2;var x=false;var n=null;while(!x){var n=r.rows[y];for(var c=0;c"+(e[0][g]||" ")+""}else{o.innerHTML=(e[0][g]||" ")}if((e[0][g]||"").indexOf("#")!=-1){var v=e[0][g].match(/(^|{)#([^}]+)(}|$)/);if(v){var s="_in_header_"+v[2];if(this[s]){this[s]((this.forceDivInHeader?o.firstChild:o),g,e[0][g].split(v[0]))}}}}if(h){o.style.cssText=h[g]}m.appendChild(o)}var u=r;if(_isKHTML){if(r._kTimer){window.clearTimeout(r._kTimer)}r._kTimer=window.setTimeout(function(){r.rows[1].style.display="none";window.setTimeout(function(){r.rows[1].style.display=""},1)},500)}},attachFooter:function(a,c){this.attachHeader(a,c,"_aFoot")},setCellExcellType:function(e,a,c){this.changeCellType(this.getRowById(e),a,c)},changeCellType:function(e,g,c){c=c||this.cellType[g];var h=this.cells3(e,g);var a=h.getValue();h.cell._cellType=c;var h=this.cells3(e,g);h.setValue(a)},setRowExcellType:function(e,c){var g=this.rowsAr[e];for(var a=0;ah.c?1:-1)});for(var e=0;e"];for(var a=0;a")}c.push("");e.innerHTML=c.join("");this._master_row=e.firstChild.rows[0]},_prepareRow:function(a){if(!this._master_row){this._build_master_row()}var e=this._master_row.cloneNode(true);for(var c=0;c=0;h--){var n="";for(var e=0;e0){var m=(_isIE||window._FFrv)?Math.min(c,35000):c;var l=this._add_filler(a,m);if(l){this._fillers.push(l)}c-=m;a+=m}}this.setSizes()},render_row:function(c){if(!this.rowsBuffer[c]){return -1}if(this.rowsBuffer[c]._parser){var a=this.rowsBuffer[c];if(this.rowsAr[a.idd]&&this.rowsAr[a.idd].tagName=="TR"){return this.rowsBuffer[c]=this.rowsAr[a.idd]}var e=this._prepareRow(a.idd);this.rowsBuffer[c]=e;this.rowsAr[a.idd]=e;a._parser.call(this,e,a.data);this._postRowProcessing(e);return e}return this.rowsBuffer[c]},_get_cell_value:function(c,a,e){if(c._locator){if(this._c_order){a=this._c_order[a]}return c._locator.call(this,c.data,a)}return this.cells3(c,a)[e?e:"getValue"]()},sortRows:function(e,j,c){this.editStop();c=(c||"asc").toLowerCase();j=(j||this.fldSort[e]);e=e||0;if(this.isTreeGrid()){this.sortTreeRows(e,j,c)}else{var a={};var h=this.cellType[e];var l="getValue";if(h=="link"){l="getContent"}if(h=="dhxCalendar"||h=="dhxCalendarA"){l="getDate"}for(var g=0;g4){j=window[j]}if(j=="cus"){var l=this._customSorts[e];h[g](function(n,m){return l(a[n.idd],a[m.idd],c,n.idd,m.idd)})}else{if(typeof(j)=="function"){h[g](function(n,m){return j(a[n.idd],a[m.idd],c,n.idd,m.idd)})}else{if(j=="str"){h[g](function(n,m){if(c=="asc"){return a[n.idd]>a[m.idd]?1:(a[n.idd]a[m.idd]?-1:0)}})}else{if(j=="int"){h[g](function(o,n){var m=parseFloat(a[o.idd]);m=isNaN(m)?-99999999999999:m;var r=parseFloat(a[n.idd]);r=isNaN(r)?-99999999999999:r;if(c=="asc"){return m-r}else{return r-m}})}else{if(j=="date"){h[g](function(o,n){var m=Date.parse(a[o.idd])||(Date.parse("01/01/1900"));var r=Date.parse(a[n.idd])||(Date.parse("01/01/1900"));if(c=="asc"){return m-r}else{return r-m}})}}}}}},_sortRows:function(e,g,c,a){this._sortCore(e,g,c,a,this.rowsBuffer);this._reset_view();this.callEvent("onGridReconstructed",[])},_reset_view:function(e){if(!this.obj.rows[0]){return}if(this._lahRw){this._unsetRowHover(0,true)}this.callEvent("onResetView",[]);var a=this.obj.rows[0].parentNode;var g=a.removeChild(a.childNodes[0],true);if(_isKHTML){for(var c=a.parentNode.childNodes.length-1;c>=0;c--){if(a.parentNode.childNodes[c].tagName=="TR"){a.parentNode.removeChild(a.parentNode.childNodes[c],true)}}}else{if(_isIE){for(var c=a.childNodes.length-1;c>=0;c--){a.childNodes[c].removeNode(true)}}else{a.innerHTML=""}}a.appendChild(g);this.rowsCol=dhtmlxArray();if(this._sst){this.enableStableSorting(true)}this._fillers=this.undefined;if(!e){if(_isIE&&this._srnd){this.render_dataset()}else{this.render_dataset()}}},deleteRow:function(c,g){if(!g){g=this.getRowById(c)}if(!g){return}this.editStop();if(!this._realfake){if(this.callEvent("onBeforeRowDeleted",[c])==false){return false}}var a=0;if(this.cellType._dhx_find("tree")!=-1&&!this._realfake){a=this._h2.get[c].parent.id;this._removeTrGrRow(g)}else{if(g.parentNode){g.parentNode.removeChild(g)}var j=this.rowsCol._dhx_find(g);if(j!=-1){this.rowsCol._dhx_removeAt(j)}for(var e=0;e=j){this._update_fillers(e,0,-1)}else{if(h[0]+h[1]>j){this._update_fillers(e,-1,0)}}}this._update_srnd_view()}if(this.pagingOn){this.changePage()}if(!this._realfake){this.callEvent("onAfterRowDeleted",[c,a])}this.callEvent("onGridReconstructed",[]);if(this._ahgr){this.setSizes()}return true},_addRow:function(l,m,c){if(c==-1||typeof c=="undefined"){c=this.rowsBuffer.length}if(typeof m=="string"){m=m.split(this.delim)}var n=this._prepareRow(l);n._attrs={};for(var e=0;e=c){h[1]=h[1]+1;var a=h[2].firstChild.style.height=parseInt(h[2].firstChild.style.height)+this._srdh+"px";o=true;if(this._fake){this._fake._fillers[g][1]++;this._fake._fillers[g][2].firstChild.style.height=a}}if(h&&h[0]>c){h[0]=h[0]+1;if(this._fake){this._fake._fillers[g][0]++}}}if(!o){this._fillers.push(this._add_filler(c,1,(c==0?{parentNode:this.obj.rows[0].parentNode,nextSibling:(this.rowsCol[1])}:this.rowsCol[c-1])))}return n}this.rowsBuffer._dhx_insertAt(c,n);return this._insertRowAt(n,c)},addRow:function(a,g,e){var c=this._addRow(a,g,e);if(!this.dragContext){this.callEvent("onRowAdded",[a])}if(this.pagingOn){this.changePage(this.currentPage)}if(this._srnd){this._update_srnd_view()}c._added=true;if(this._srnd&&!this._fillers){this._fillers=[]}if(this._ahgr){this.setSizes()}this.callEvent("onGridReconstructed",[]);return c},_insertRowAt:function(e,g,c){this.rowsAr[e.idd]=e;if(this._skipInsert){this._skipInsert=false;return e}if((g<0)||((!g)&&(parseInt(g)!==0))){g=this.rowsCol.length}else{if(g>this.rowsCol.length){g=this.rowsCol.length}}if(this._cssEven){var a=e.className.replace(this._cssUnEven,"");if((this._cssSP?this.getLevel(e.idd):g)%2==1){e.className=a+" "+this._cssUnEven+(this._cssSU?(" "+this._cssUnEven+"_"+this.getLevel(e.idd)):"")}else{e.className=a+" "+this._cssEven+(this._cssSU?(" "+this._cssEven+"_"+this.getLevel(e.idd)):"")}}if(!c){if((g==(this.obj.rows.length-1))||(!this.rowsCol[g])){if(_isKHTML){this.obj.appendChild(e)}else{this.obj.firstChild.appendChild(e)}}else{this.rowsCol[g].parentNode.insertBefore(e,this.rowsCol[g])}}this.rowsCol._dhx_insertAt(g,e);this.callEvent("onRowInserted",[e,g]);return e},getRowById:function(e){var c=this.rowsAr[e];if(c){if(c.tagName!="TR"){for(var a=0;a0){this.smartTabOrder=dhx4.s2b(a)}else{this.smartTabOrder=true}},setExternalTabOrder:function(h,a){var c=this;this.tabStart=(typeof(h)=="object")?h:document.getElementById(h);var e=this.tabStart.onkeydown;this.tabStart.onkeydown=function(l){if(e){e.call(this,l)}var j=(l||window.event);if(j.keyCode==9&&!j.shiftKey){j.cancelBubble=true;c.selectCell(0,0,0,0,1);if(c.smartTabOrder&&c.cells2(0,0).isDisabled()){c._key_events.k9_0_0.call(c)}this.blur();return false}};if(_isOpera){this.tabStart.onkeypress=this.tabStart.onkeydown}this.tabEnd=(typeof(a)=="object")?a:document.getElementById(a);var g=this.tabEnd.onkeydown;this.tabEnd.onkeydown=this.tabEnd.onkeypress=function(l){if(g){g.call(this,l)}var j=(l||window.event);if(j.keyCode==9&&j.shiftKey){j.cancelBubble=true;c.selectCell((c.getRowsNum()-1),(c.getColumnCount()-1),0,0,1);if(c.smartTabOrder&&c.cells2((c.getRowsNum()-1),(c.getColumnCount()-1)).isDisabled()){c._key_events.k9_0_1.call(c)}this.blur();return false}};if(_isOpera){this.tabEnd.onkeypress=this.tabEnd.onkeydown}},uid:function(){if(!this._ui_seed){this._ui_seed=(new Date()).valueOf()}return this._ui_seed++},clearAndLoad:function(){if(this._last_load_request){var c=this._last_load_request.xmlDoc;if(c.readyState!=4){try{c.onreadystatechange=function(){};c.abort()}catch(g){}}}var a=this._pgn_skin;this._pgn_skin=null;this.clearAll();this._pgn_skin=a;this._last_load_request=this.load.apply(this,arguments)},getStateOfView:function(){if(this.pagingOn){var a=(this.currentPage-1)*this.rowsBufferOutSize;return[this.currentPage,a,Math.min(a+this.rowsBufferOutSize,this.rowsBuffer.length),this.rowsBuffer.length]}return[Math.floor(this.objBox.scrollTop/this._srdh),Math.ceil(parseInt(this.objBox.offsetHeight)/this._srdh),this.rowsBuffer.length]}};(function(){function g(l,m){this[l]=m}function j(l,m){this[l].call(this,m)}function e(l,m){this[l].call(this,m.join(this.delim))}function a(l,o){for(var n=0;n0?"&dhx_no_header=1":"")};var h=function(j){return a.call(this,j)+(this._connector_sorting||"")+(this._connector_filter||"")};var g=function(l,m,j){this._connector_sorting="&dhx_sort["+m+"]="+j;return h.call(this,l)};var e=function(l,j,n){var o=[];for(var m=0;m1?a:c)])};dhtmlXGridCellObject.prototype.setCTxtValue=function(a){this.cell.innerHTML="";this.cell.appendChild(document.createTextNode(a));this.grid.callEvent("onCellChanged",[this.cell.parentNode.idd,this.cell._cellIndex,a])};dhtmlXGridCellObject.prototype.setLabel=function(a){this.cell.innerHTML=a};dhtmlXGridCellObject.prototype.getMath=function(){if(this._val){return this.val}else{return this.getValue()}};function eXcell(){this.obj=null;this.val=null;this.changeState=function(){return false};this.edit=function(){this.val=this.getValue()};this.detach=function(){return false};this.getPosition=function(g){var a=g;var e=0;var c=0;while(a.tagName!="BODY"){e+=a.offsetLeft;c+=a.offsetTop;a=a.offsetParent}return new Array(e,c)}}eXcell.prototype=new dhtmlXGridCellObject;function eXcell_ed(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.edit=function(){this.cell.atag=(!this.grid.multiLine)?"INPUT":"TEXTAREA";this.val=this.getValue();this.obj=document.createElement(this.cell.atag);this.obj.setAttribute("autocomplete","off");this.obj.style.height=(this.cell.offsetHeight-(_isIE?4:4))+"px";this.obj.className="dhx_combo_edit";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.style.textAlign;this.obj.onclick=function(c){(c||event).cancelBubble=true};this.obj.onmousedown=function(c){(c||event).cancelBubble=true};this.obj.value=this.val;this.cell.innerHTML="";this.cell.appendChild(this.obj);this.obj.onselectstart=function(c){if(!c){c=event}c.cancelBubble=true;return true};if(_isIE){this.obj.focus();this.obj.blur()}this.obj.focus()};this.getValue=function(){if((this.cell.firstChild)&&((this.cell.atag)&&(this.cell.firstChild.tagName==this.cell.atag))){return this.cell.firstChild.value}if(this.cell._clearCell){return""}return this.cell.innerHTML.toString()._dhx_trim()};this.detach=function(){this.setValue(this.obj.value);return this.val!=this.getValue()}}eXcell_ed.prototype=new eXcell;function eXcell_edtxt(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.getValue=function(){if((this.cell.firstChild)&&((this.cell.atag)&&(this.cell.firstChild.tagName==this.cell.atag))){return this.cell.firstChild.value}if(this.cell._clearCell){return""}return(_isIE?this.cell.innerText:this.cell.textContent)};this.setValue=function(c){if(!c||c.toString()._dhx_trim()==""){c=" ";this.cell._clearCell=true}else{this.cell._clearCell=false}this.setCTxtValue(c)}}eXcell_edtxt.prototype=new eXcell_ed;function eXcell_edn(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.getValue=function(){if((this.cell.firstChild)&&(this.cell.firstChild.tagName=="TEXTAREA")){return this.cell.firstChild.value}if(this.cell._clearCell){return""}return this.cell._orig_value||this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(),this.cell._cellIndex)};this.detach=function(){var c=this.obj.value;this.setValue(c);return this.val!=this.getValue()}}eXcell_edn.prototype=new eXcell_ed;eXcell_edn.prototype.setValue=function(a){if(!a||a.toString()._dhx_trim()==""){this.cell._clearCell=true;return this.setCValue(" ",0)}else{this.cell._clearCell=false;this.cell._orig_value=a}this.setCValue(this.grid._aplNF(a,this.cell._cellIndex),a)};function eXcell_ch(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.disabledF=function(c){if((c==true)||(c==1)){this.cell.innerHTML=this.cell.innerHTML.replace("item_chk0.","item_chk0_dis.").replace("item_chk1.","item_chk1_dis.")}else{this.cell.innerHTML=this.cell.innerHTML.replace("item_chk0_dis.","item_chk0.").replace("item_chk1_dis.","item_chk1.")}};this.changeState=function(c){if(c===true&&!this.grid.isActive){if(window.globalActiveDHTMLGridObject!=null&&window.globalActiveDHTMLGridObject!=this.grid&&window.globalActiveDHTMLGridObject.isActive){window.globalActiveDHTMLGridObject.setActive(false)}this.grid.setActive(true)}if((!this.grid.isEditable)||(this.cell.parentNode._locked)||(this.isDisabled())){return}if(this.grid.callEvent("onEditCell",[0,this.cell.parentNode.idd,this.cell._cellIndex])){this.val=this.getValue();if(this.val=="1"){this.setValue("0")}else{this.setValue("1")}this.cell.wasChanged=true;this.grid.callEvent("onEditCell",[1,this.cell.parentNode.idd,this.cell._cellIndex]);this.grid.callEvent("onCheckbox",[this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1")]);this.grid.callEvent("onCheck",[this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1")])}else{this.editor=null}};this.getValue=function(){return this.cell.chstate?this.cell.chstate.toString():"0"};this.isCheckbox=function(){return true};this.isChecked=function(){if(this.getValue()=="1"){return true}else{return false}};this.setChecked=function(c){this.setValue(c.toString())};this.detach=function(){return this.val!=this.getValue()};this.edit=null}eXcell_ch.prototype=new eXcell;eXcell_ch.prototype.setValue=function(c){this.cell.style.verticalAlign="middle";if(c){c=c.toString()._dhx_trim();if((c=="false")||(c=="0")){c=""}}if(c){c="1";this.cell.chstate="1"}else{c="0";this.cell.chstate="0"}var a=this;this.setCValue("",this.cell.chstate)};function eXcell_ra(a){this.base=eXcell_ch;this.base(a);this.grid=a.parentNode.grid;this.disabledF=function(c){if((c==true)||(c==1)){this.cell.innerHTML=this.cell.innerHTML.replace("radio_chk0.","radio_chk0_dis.").replace("radio_chk1.","radio_chk1_dis.")}else{this.cell.innerHTML=this.cell.innerHTML.replace("radio_chk0_dis.","radio_chk0.").replace("radio_chk1_dis.","radio_chk1.")}};this.changeState=function(c){if(c===false&&this.getValue()==1){return}if((!this.grid.isEditable)||(this.cell.parentNode._locked)||(this.isDisabled())){return}if(this.grid.callEvent("onEditCell",[0,this.cell.parentNode.idd,this.cell._cellIndex])!=false){this.val=this.getValue();if(this.val=="1"){this.setValue("0")}else{this.setValue("1")}this.cell.wasChanged=true;this.grid.callEvent("onEditCell",[1,this.cell.parentNode.idd,this.cell._cellIndex]);this.grid.callEvent("onCheckbox",[this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1")]);this.grid.callEvent("onCheck",[this.cell.parentNode.idd,this.cell._cellIndex,(this.val!="1")])}else{this.editor=null}};this.edit=null}eXcell_ra.prototype=new eXcell_ch;eXcell_ra.prototype.setValue=function(c){this.cell.style.verticalAlign="middle";if(c){c=c.toString()._dhx_trim();if((c=="false")||(c=="0")){c=""}}if(c){if(!this.grid._RaSeCol){this.grid._RaSeCol=[]}if(this.grid._RaSeCol[this.cell._cellIndex]){var a=this.grid.cells4(this.grid._RaSeCol[this.cell._cellIndex]);a.setValue("0");if(this.grid.rowsAr[a.cell.parentNode.idd]){this.grid.callEvent("onEditCell",[1,a.cell.parentNode.idd,a.cell._cellIndex])}}this.grid._RaSeCol[this.cell._cellIndex]=this.cell;c="1";this.cell.chstate="1"}else{c="0";this.cell.chstate="0"}this.setCValue("",this.cell.chstate)};function eXcell_txt(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.edit=function(){this.val=this.getValue();this.obj=document.createElement("TEXTAREA");this.obj.className="dhx_textarea";this.obj.onclick=function(g){(g||event).cancelBubble=true};var c=this.grid.getPosition(this.cell);this.obj.value=this.val;this.obj.style.display="";this.obj.style.textAlign=this.cell.style.textAlign;document.body.appendChild(this.obj);if(_isOpera){this.obj.onkeypress=function(g){if(g.keyCode==9||g.keyCode==27){return false}}}this.obj.onkeydown=function(h){var g=(h||event);if(g.keyCode==9||g.keyCode==27){globalActiveDHTMLGridObject.entBox.focus();globalActiveDHTMLGridObject.doKey({keyCode:g.keyCode,shiftKey:g.shiftKey,srcElement:"0"});return false}};this.obj.style.left=c[0]+"px";this.obj.style.top=c[1]+this.cell.offsetHeight+"px";if(this.cell.offsetWidth<200){var e=200}else{var e=this.cell.offsetWidth}this.obj.style.width=e+16+"px";if(_isIE){this.obj.select();this.obj.value=this.obj.value}this.obj.focus()};this.detach=function(){var c="";c=this.obj.value;if(c==""){this.cell._clearCell=true}else{this.cell._clearCell=false}this.setValue(c);document.body.removeChild(this.obj);this.obj=null;return this.val!=this.getValue()};this.getValue=function(){if(this.obj){return this.obj.value}if(this.cell._clearCell){return""}if(typeof this.cell._brval!="undefined"){return this.cell._brval}if((!this.grid.multiLine)){return this.cell._brval||this.cell.innerHTML}else{return this.cell._brval||this.cell.innerHTML.replace(/]*>/gi,"\n")._dhx_trim()}}}eXcell_txt.prototype=new eXcell;function eXcell_txttxt(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.getValue=function(){if((this.cell.firstChild)&&(this.cell.firstChild.tagName=="TEXTAREA")){return this.cell.firstChild.value}if(this.cell._clearCell){return""}if((!this.grid.multiLine)&&this.cell._brval){return this.cell._brval}return(_isIE?this.cell.innerText:this.cell.textContent)};this.setValue=function(c){this.cell._brval=c;if(!c||c.toString()._dhx_trim()==""){c=" ";this.cell._clearCell=true}else{this.cell._clearCell=false}this.setCTxtValue(c)}}eXcell_txttxt.prototype=new eXcell_txt;eXcell_txt.prototype.setValue=function(a){this.cell._brval=a;if(!a||a.toString()._dhx_trim()==""){a=" ";this.cell._clearCell=true}else{this.cell._clearCell=false}if((!this.grid.multiLine)||this.cell._clearCell){this.setCValue(a,this.cell._brval)}else{this.setCValue(a.replace(/\n/g,"
"),a)}};function eXcell_co(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;this.combo=(this.cell._combo||this.grid.getCombo(this.cell._cellIndex));this.editable=true}this.shiftNext=function(){var c=this.list.options[this.list.selectedIndex+1];if(c){c.selected=true}this.obj.value=this.list.options[this.list.selectedIndex].text;return true};this.shiftPrev=function(){if(this.list.selectedIndex!=0){var c=this.list.options[this.list.selectedIndex-1];if(c){c.selected=true}this.obj.value=this.list.options[this.list.selectedIndex].text}return true};this.edit=function(){this.val=this.getValue();this.text=this.getText()._dhx_trim();var g=this.grid.getPosition(this.cell);this.obj=document.createElement("TEXTAREA");this.obj.className="dhx_combo_edit";this.obj.style.height=(this.cell.offsetHeight-(_isIE?4:4))+"px";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.style.textAlign;this.obj.onclick=function(n){(n||event).cancelBubble=true};this.obj.onmousedown=function(n){(n||event).cancelBubble=true};this.obj.value=this.text;this.obj.onselectstart=function(n){if(!n){n=event}n.cancelBubble=true;return true};var j=this;this.obj.onkeyup=function(r){var o=(r||event).keyCode;if(o==38||o==40||o==9){return}var s=this.readonly?String.fromCharCode(o):this.value;var u=j.list.options;for(var n=0;n ",a);this.cell.firstChild._bg=a};function eXcell_img(a){try{this.cell=a;this.grid=this.cell.parentNode.grid}catch(c){}this.getValue=function(){if(this.cell.firstChild.tagName=="IMG"){return this.cell.firstChild.src+(this.cell.titFl!=null?"^"+this.cell._brval:"")}else{if(this.cell.firstChild.tagName=="A"){var e=this.cell.firstChild.firstChild.src+(this.cell.titFl!=null?"^"+this.cell._brval:"");e+="^"+this.cell.lnk;if(this.cell.trg){e+="^"+this.cell.trg}return e}}};this.isDisabled=function(){return true}}eXcell_img.prototype=new eXcell;eXcell_img.prototype.getTitle=function(){return this.cell._brval};eXcell_img.prototype.setValue=function(e){var c=e;if((e||"").indexOf("^")!=-1){var a=e.split("^");e=a[0];c=this.cell._attrs.title||a[1];if(a.length>2){this.cell.lnk=a[2];if(a[3]){this.cell.trg=a[3]}}this.cell.titFl="1"}if(!this.grid.multiLine){this.setCValue("",e)}else{this.setCValue("",e)}if(this.cell.lnk){this.cell.innerHTML=""+this.cell.innerHTML+""}this.cell._brval=c};function eXcell_price(a){this.base=eXcell_ed;this.base(a);this.getValue=function(){if(this.cell.childNodes.length>1){return this.cell.childNodes[1].innerHTML.toString()._dhx_trim()}else{return"0"}}}eXcell_price.prototype=new eXcell_ed;eXcell_price.prototype.setValue=function(c){if(isNaN(parseFloat(c))){c=this.val||0}var a="green";if(c<0){a="red"}this.setCValue("$"+c+"",c)};function eXcell_dyn(a){this.base=eXcell_ed;this.base(a);this.getValue=function(){return this.cell.firstChild.childNodes[1].innerHTML.toString()._dhx_trim()}}eXcell_dyn.prototype=new eXcell_ed;eXcell_dyn.prototype.setValue=function(e){if(!e||isNaN(Number(e))){if(e!==""){e=0}}if(e>0){var c="green";var a="dyn_up.gif"}else{if(e==0){var c="black";var a="dyn_.gif"}else{var c="red";var a="dyn_down.gif"}}this.setCValue("
"+e+"
",e)};function eXcell_ro(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.edit=function(){};this.isDisabled=function(){return true};this.getValue=function(){return this.cell._clearCell?"":this.cell.innerHTML.toString()._dhx_trim()}}eXcell_ro.prototype=new eXcell;window.eXcell_hidden=function(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid}this.edit=function(){};this.isDisabled=function(){return true};this.getValue=function(){return this.cell.val}};eXcell_hidden.prototype=new eXcell;eXcell_hidden.prototype.setValue=function(a){this.cell.val=a};function eXcell_ron(a){this.cell=a;this.grid=this.cell.parentNode.grid;this.edit=function(){};this.isDisabled=function(){return true};this.getValue=function(){return this.cell._clearCell?"":this.cell._orig_value||this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(),this.cell._cellIndex).toString()}}eXcell_ron.prototype=new eXcell;eXcell_ron.prototype.setValue=function(a){if(a===0){}else{if(!a||a.toString()._dhx_trim()==""){this.setCValue(" ");return this.cell._clearCell=true}}this.cell._orig_value=a;this.cell._clearCell=false;this.setCValue(a?this.grid._aplNF(a,this.cell._cellIndex):"0")};function eXcell_rotxt(a){this.cell=a;this.grid=this.cell.parentNode.grid;this.edit=function(){};this.isDisabled=function(){return true};this.setValue=function(c){if(!c){c=" ";this.cell._clearCell=true}else{this.cell._clearCell=false}this.setCTxtValue(c)};this.getValue=function(){if(this.cell._clearCell){return""}return(_isIE?this.cell.innerText:this.cell.textContent)}}eXcell_rotxt.prototype=new eXcell;function dhtmlXGridComboObject(){this.keys=new dhtmlxArray();this.values=new dhtmlxArray();this.put=function(c,e){for(var a=0;a=0;c--){if(this._checkParent(this.rowsAr[j[c]],j)){j.splice(c,1)}}}var o=this;if(j.length&&this._dndorder){j.sort(function(r,e){return(o.rowsAr[r].rowIndex>o.rowsAr[e].rowIndex?1:-1)})}var a=this.getFirstParentOfType(_isIE?h.srcElement:h.target,"TD");if(a){this._dndExtra=a._cellIndex}this._dragged=new Array();for(var c=0;c=0&&this.tobj._h2.get[this.tobj.rowsBuffer[a].idd].state=="minus")?this.tobj._getOpenLenght(this.tobj.rowsBuffer[a].idd,0):0))};dragContext.prototype.img=function(){if((this.target!="grid")&&(this.sobj._h2)){return this.sobj.getItemImage(this.sid)}else{return null}};dragContext.prototype.slist=function(){var c=new Array();for(var a=0;a(parseInt(this.objBox.offsetHeight)-50)){this.objBox.scrollTop=parseInt(this.objBox.scrollTop)+20}if((e-a+parseInt(this.objBox.scrollTop))<(parseInt(this.objBox.scrollTop)+30)){this.objBox.scrollTop=parseInt(this.objBox.scrollTop)-20}if(h){return 0}if(this.dadmode==2){var l=m-e+(document.body.scrollTop||document.documentElement.scrollTop)-2-j.offsetHeight/2;if((Math.abs(l)-j.offsetHeight/6)>0){this.dadmodec=1;if(l<0){this.dadmodefix=-1}else{this.dadmodefix=1}}else{this.dadmodec=0}}else{this.dadmodec=this.dadmode}if(this.dadmodec){if(!this._sdrgc){this._createSdrgc()}this._sdrgc.style.display="block";this._sdrgc.style.top=e-a+parseInt(this.objBox.scrollTop)+((this.dadmodefix>=0)?j.offsetHeight:0)+"px"}else{this._llSelD=j;if(j.parentNode.tagName=="TR"){for(var g=0;g$/,"columns>");for(var K=2;K=a._fake.hdrLabels.length))){D++;continue}var Q=M[K][J];var P=((Q[0]&&Q[0]>1)?' colspan="'+Q[0]+'" ':"");if(Q[1]&&Q[1]>1){P+=' rowspan="'+Q[1]+'" ';D=-1}var E="";var I=S;if(a._fake&&J"}if(D!=a._cCount){L+="\n"+N+""}}L+="\n";L+=n();return L}function e(){var D=[];if(m){for(var E=0;E"];if(!a.ftr){return""}for(var H=1;H");var K=a.ftr.rows[H];for(var E=0;E=a._fake.hdrLabels.length)){continue}for(var D=0;D")}F.push("")}F.push("");return F.join("\n")}function l(E,D){return(window.getComputedStyle?(window.getComputedStyle(E,null)[D]):(E.currentStyle?E.currentStyle[D]:null))||""}function u(H){if(!a.rowsBuffer[H]){return""}var D=a.render_row(H);if(D.style.display=="none"){return""}var E=a.isTreeGrid()?' level="'+a.getLevel(D.idd)+'"':"";var L="";for(var J=0;J"}else{L+=""}L+=""}}return L+""}function r(){var D="";return D}var y=document.createElement("div");y.style.display="none";document.body.appendChild(y);var j="form_"+a.uid();y.innerHTML='
';document.getElementById(j).firstChild.value=encodeURIComponent(A(o).replace("\u2013","-")+e()+r());document.getElementById(j).submit();y.parentNode.removeChild(y);a=null;if(h&&h.row.length){for(var w=0;w/g,">");return j}var c="";for(var e=0;e=this._fake.hdrLabels.length)){continue}var g=this.fldSort[e];if(g=="cus"){g=this._customSorts[e].toString();g=g.replace(/function[\ ]*/,"").replace(/\([^\f]*/,"")}var o=l[1][e];var m=((o[1]&&o[1]>1)?' rowspan="'+o[1]+'" ':"")+((o[0]&&o[0]>1)?' colspan="'+o[0]+'" ':"");c+=""}return c+=""};if(window.eXcell_sub_row_grid){window.eXcell_sub_row_grid.prototype.getContent=function(){return""}}dhtmlXGridObject.prototype.toExcel=function(a,g,l,j,c){if(!document.getElementById("ifr")){var h=document.createElement("iframe");h.style.display="none";h.setAttribute("name","dhx_export_iframe");h.setAttribute("src","");h.setAttribute("id","dhx_export_iframe");document.body.appendChild(h)}var e=' target="dhx_export_iframe"';this.toPDF(a,g,l,j,c,e)};dhtmlXGridObject.prototype.filterBy=function(e,g,c){if(this.isTreeGrid()){return this.filterTreeBy(e,g,c)}if(this._f_rowsBuffer){if(!c){this.rowsBuffer=dhtmlxArray([].concat(this._f_rowsBuffer));if(this._fake){this._fake.rowsBuffer=this.rowsBuffer}}}else{this._f_rowsBuffer=[].concat(this.rowsBuffer)}if(!this.rowsBuffer.length){return}var h=true;this.dma(true);if(typeof(e)=="object"){for(var a=0;a=0;a--){if(g?(this._get_cell_value(this.rowsBuffer[a],c).toString().toLowerCase().indexOf(e)==-1):(!e.call(this,this._get_cell_value(this.rowsBuffer[a],c),this.rowsBuffer[a].idd))){this.rowsBuffer.splice(a,1)}}};dhtmlXGridObject.prototype.getFilterElement=function(a){if(!this.filters){return}for(var c=0;c=this._cCount){continue}c.push(j);var l=this.filters[g][0].old_value=this.filters[g][0].value;if(this.filters[g][0]._filter){l=this.filters[g][0]._filter()}var h;if(typeof l!="function"&&(h=(this.combos[j]||(this._col_combos?this._col_combos[j]:false)))){if(h.values){j=h.values._dhx_find(l);l=(j==-1)?l:h.keys[j]}else{if(h.getOptionByLabel){l=(h.getOptionByLabel(l)?h.getOptionByLabel(l).value:l)}}}e.push(l)}if(!this.callEvent("onFilterStart",[c,e])){return}this.filterBy(c,e);if(this._cssEven){this._fixAlterCss()}this.callEvent("onFilterEnd",[this.filters]);if(this._f_rowsBuffer&&this.rowsBuffer.length==this._f_rowsBuffer.length){this._f_rowsBuffer=null}};dhtmlXGridObject.prototype.makeFilter=function(h,e,c){if(!this.filters){this.filters=[]}if(typeof(h)!="object"){h=document.getElementById(h)}if(!h){return}var a=this;if(!h.style.width){h.style.width="90%"}if(h.tagName=="SELECT"){this.filters.push([h,e]);this._loadSelectOptins(h,e);h.onchange=function(){a.filterByAll()};if(_isIE){h.style.marginTop="1px"}this.attachEvent("onEditCell",function(l,j,m){this._build_m_order();if(l==2&&this.filters&&(this._m_order?(m==this._m_order[e]):(m==e))){this._loadSelectOptins(h,e)}return true})}else{if(h.tagName=="INPUT"){this.filters.push([h,e]);h.old_value=h.value="";h.onkeydown=function(){if(this._timer){window.clearTimeout(this._timer)}this._timer=window.setTimeout(function(){if(h.value!=h.old_value){a.filterByAll();h.old_value=h.value}},500)}}else{if(h.tagName=="DIV"){this.filters.push([h,e]);h.style.padding="0px";h.style.margin="0px";if(!window.dhx_globalImgPath){window.dhx_globalImgPath=this.imgURL}var g=new dhtmlXCombo(h,"_filter","90%");g.filterSelfA=g.filterSelf;g.filterSelf=function(){if(this.getSelectedIndex()==0){this.setComboText("")}this.filterSelfA.apply(this,arguments);this.optionsArr[0].hide(false)};g.enableFilteringMode(true);h.combo=g;h.value="";this._loadComboOptins(h,e);g.attachEvent("onChange",function(){h.value=g.getSelectedValue();if(h.value===null){h.value=""}a.filterByAll()})}}}if(h.parentNode){h.parentNode.className+=" filter"}this._filters_ready()};dhtmlXGridObject.prototype.findCell=function(l,m,g,h){var h=h||(function(n,j){return j.toString().toLowerCase().indexOf(n)!=-1});if(h===true){h=function(n,j){return j.toString().toLowerCase()==n}}var e=new Array();l=l.toString().toLowerCase();if(typeof g!="number"){g=g?1:0}if(!this.rowsBuffer.length){return e}for(var c=(m||0);c";c.onclick=c.onmousedown=function(g){(g||event).cancelBubble=true;return true};c.onselectstart=function(){return(event.cancelBubble=true)};this.makeFilter(c.firstChild,a)};dhtmlXGridObject.prototype._in_header_text_filter_inc=function(c,a){c.innerHTML="";c.onclick=c.onmousedown=function(g){(g||event).cancelBubble=true;return true};c.onselectstart=function(){return(event.cancelBubble=true)};this.makeFilter(c.firstChild,a);c.firstChild._filter=function(){if(c.firstChild.value==""){return""}return function(e){return(e.toString().toLowerCase().indexOf(c.firstChild.value.toLowerCase())==0)}};this._filters_ready()};dhtmlXGridObject.prototype._in_header_select_filter=function(c,a){c.innerHTML="";c.onclick=function(g){(g||event).cancelBubble=true;return false};this.makeFilter(c.firstChild,a)};dhtmlXGridObject.prototype._in_header_select_filter_strict=function(e,c){e.innerHTML="";e.onclick=function(g){(g||event).cancelBubble=true;return false};this.makeFilter(e.firstChild,c);var a=this.combos;e.firstChild._filter=function(){var g=e.firstChild.value;if(!g){return""}if(a[c]){g=a[c].keys[a[c].values._dhx_find(g)]}g=g.toLowerCase();return function(h){return(h.toString().toLowerCase()==g)}};this._filters_ready()};dhtmlXGridObject.prototype._in_header_combo_filter=function(c,a){c.innerHTML="
";c.onselectstart=function(){return(event.cancelBubble=true)};c.onclick=c.onmousedown=function(g){(g||event).cancelBubble=true;return true};this.makeFilter(c.firstChild,a)};dhtmlXGridObject.prototype._search_common=function(c,a){c.innerHTML="";c.onclick=c.onmousedown=function(g){(g||event).cancelBubble=true;return true};c.onselectstart=function(){return(event.cancelBubble=true)}};dhtmlXGridObject.prototype._in_header_text_search=function(e,c,a){this._search_common(e,c);this.makeSearch(e.firstChild,c)};dhtmlXGridObject.prototype._in_header_text_search_strict=function(c,a){this._search_common(c,a);this.makeSearch(c.firstChild,a,true)};dhtmlXGridObject.prototype._in_header_numeric_filter=function(c,a){this._in_header_text_filter.call(this,c,a);c.firstChild._filter=function(){var e=this.value;var h;var l="==";var g=parseFloat(e.replace("=",""));var j=null;if(e){if(e.indexOf("..")!=-1){e=e.split("..");g=parseFloat(e[0]);j=parseFloat(e[1]);return function(m){if(m>=g&&m<=j){return true}return false}}h=e.match(/>=|<=|>|"+h[1];var a=this;g.getElementsByTagName("input")[0].onclick=function(l){a._build_m_order();var c=a._m_order?a._m_order[e]:e;var m=this.checked?1:0;a.forEachRowA(function(n){var j=this.cells(n,c);if(j.isCheckbox()){j.setValue(m);j.cell.wasChanged=true}this.callEvent("onEditCell",[1,n,c,m]);this.callEvent("onCheckbox",[n,c,m])});(l||event).cancelBubble=true}};dhtmlXGridObject.prototype._in_header_stat_total=function(e,a,h){var g=function(){var n=0;this._build_m_order();var m=this._m_order?this._m_order[a]:a;for(var l=0;lg&&e){e--}for(var o=e;g=l){break}}if(g>=l){break}g++;if(j.cell){zxVal=j[this._agetm]()}else{zxVal=""}if((this._chAttr)&&(j.wasChanged())){s=true}m[m.length]=((zxVal===null)?"":zxVal);if(this._ecspn&&h.colSpan&&h.colSpan>1){h=h.colSpan-1;for(var v=0;v0&&!e[o].length){e.splice(o,1)}return e},str:function(e,a,g){for(var c=0;c";if(!this.parentGrid){o+=(s||"")}o+='';var r=Math.max(this.rowsBuffer.length,this.rowsCol.length);var n=this._cCount;var u=this._printWidth();o+='';for(var A=0;A'+this.getHeaderCol(A)+"";A+=a-1}o+="";for(var A=2;A";var g=this.hdr.rows[A].childNodes;for(var y=0;y"}else{o+=""+(this._fake?this._fake.hdr.rows[A].innerHTML:"")+this.hdr.rows[A].innerHTML+""}}for(var A=0;A";if(this.rowsCol[A]&&this.rowsCol[A]._cntr){o+=this.rowsCol[A].innerHTML.replace(/]*>/gi,"")+"";continue}if(this.rowsCol[A]&&this.rowsCol[A].style.display=="none"){continue}var m;if(this.rowsCol[A]){m=this.rowsCol[A].idd}else{if(this.rowsBuffer[A]){m=this.rowsBuffer[A].idd}else{continue}}for(var y=0;y"+(v===""?" ":v)+"";if(D){y+=D-1}}o+="";if(this.rowsCol[A]&&this.rowsCol[A]._expanded){var l=this.cells4(this.rowsCol[A]._expanded.ctrl);if(l.getSubGrid){o+='"}else{o+='"}}}if(this.ftr){for(var A=1;A"+((this._fake)?this._fake.ftr.childNodes[0].rows[A].innerHTML:"")+this.ftr.childNodes[0].rows[A].innerHTML+""}}o+="
'+l.getSubGrid().printView()+"
'+this.rowsCol[A]._expanded.innerHTML+"
";if(this.parentGrid){return o}o+=(e||"");var E=window.open("","_blank");E.document.write(o);E.document.write("");E.document.close();if(this._fake){this._hrrar=C;}};dhtmlXGridObject.prototype._printWidth=function(){var h=[];var g=0;for(var e=0;e=h){this.objBox.scrollLeft=this.objBox.scrollLeft+20;e=true;}else{if(l-20=c&&!this._realfake){this.objBox.scrollTop=this.objBox.scrollTop+20;e=true;}else{if(j-20this._cCount){u=this._cCount;} +var g=0;for(var r=w;r2){if(c&&!this.rowsBuffer[c-1]){this.rowsBuffer[c-1]=0;} +c=a;} +this._srnd=dhx4.s2b(e);this._srdh=this._srdh||20;this._dpref=c||0;};dhtmlXGridObject.prototype.enablePreRendering=function(a){this._srnd_pr=parseInt(a||50);};dhtmlXGridObject.prototype.forceFullLoading=function(a,h){for(var e=0;e0){m-=this.rowsCol[l]?this.rowsCol[l].offsetHeight:this._srdh;l++;} +c=l+this._get_view_size();if(l>0){l--;}} +c+=this._srnd_pr||0;if(c>this.rowsBuffer.length){c=this.rowsBuffer.length;} +for(var g=l;gg){var j=g-e[0];if(j==0){this._insert_before(g,h,e[2]);this._update_fillers(c,-1,1);}else{if(j==e[1]-1){this._insert_after(g,h,e[2]);this._update_fillers(c,-1,0);}else{this._fillers.push(this._add_filler(g+1,e[1]-j-1,e[2],1));this._insert_after(g,h,e[2]);this._update_fillers(c,-e[1]+j,0);}} +return;}}};dhtmlXGridObject.prototype._update_fillers=function(e,a,g){var c=this._fillers[e];c[1]=c[1]+a;c[0]=c[0]+g;if(!c[1]){this.callEvent("onRemoveFiller",[c[2]]);c[2].parentNode.removeChild(c[2]);this._fillers.splice(e,1);}else{c[2].firstChild.style.height=parseFloat(c[2].firstChild.style.height)+a*this._srdh+"px";this.callEvent("onUpdateFiller",[c[2]]);}};dhtmlXGridObject.prototype._insert_before=function(c,e,a){a.parentNode.insertBefore(e,a);this.rowsCol[c]=e;this.callEvent("onRowInserted",[e,null,a,"before"]);};dhtmlXGridObject.prototype._insert_after=function(c,e,a){if(a.nextSibling){a.parentNode.insertBefore(e,a.nextSibling);}else{a.parentNode.appendChild(e);} +this.rowsCol[c]=e;this.callEvent("onRowInserted",[e,null,a,"after"]);};if(typeof window.dhtmlxValidation!="undefined"){dhtmlxValidation.trackInput=function(e,g,c,a){dhtmlxEvent(e,"keyup",function(h){if(dhtmlxValidation._timer){window.clearTimeout(dhtmlxValidation._timer);dhtmlxValidation._timer=null;} +dhtmlxValidation._timer=window.setTimeout(function(){if(!dhtmlxValidation.checkInput(e,g)){if(!c||c(e,e.value,g)){e.className+=" dhtmlx_live_validation_error";}}else{e.className=e.className.replace(/[ ]*dhtmlx_live_validation_error/g,"");if(a){a(e,e.value,g);}}},250);});};dhtmlxValidation.checkInput=function(a,c){return dhtmlxValidation.checkValue(a.value,c);};dhtmlxValidation.checkValue=function(e,g){if(typeof g=="string"){g=g.split(",");} +var a=true;for(var c=0;c1){this._validators._live=a;} +if(!this._validators._event){this._validators._event=this.attachEvent("onEditCell",this.validationEvent);}};dhtmlXGridObject.prototype.setColValidators=function(a){if(!this._validators){this.enableValidation(true);} +if(typeof a=="string"){a=a.split(this.delim);} +this._validators.data=a;};dhtmlXGridObject.prototype.validationEvent=function(j,c,g,e,m){var n=this._validators;if(!n){return true;} +var l=n.data[g]||this.cells(c,g).getAttribute("validate")||"";if(j==1&&l){var h=this.editor||(this._fake||{}).editor;if(!h){return true;} +h.cell.className=h.cell.className.replace(/[ ]*dhtmlx_validation_error/g,"");if(n._live){var a=this;dhtmlxValidation.trackInput(h.getInput(),l,function(o,r,s){return a.callEvent("onLiveValidationError",[c,g,r,o,s]);},function(o,r,s){return a.callEvent("onLiveValidationCorrect",[c,g,r,o,s]);});}} +if(j==2){this.validateCell(c,g,l,e);} +return true;};dhtmlXGridObject.prototype.validateCell=function(l,h,j,g){j=j||this._validators.data[h]||this.cells(l,h).getAttribute("validate");g=g||this.cells(l,h).getValue();if(!j){return;} +var c=this.cells(l,h).cell;var a=true;if(typeof j=="string"){j=j.split(this.delim);} +for(var e=0;e1){c[1]="href='"+c[1]+"'";if(c.length==3){c[1]+=" target='"+c[2]+"'";}else{c[1]+=" target='_blank'";}}} +this.setCValue(""+c[0]+"",c);};} +eXcell_link.prototype=new eXcell();eXcell_link.prototype.getTitle=function(){var a=this.cell.firstChild;return a&&a.tagName?a.getAttribute("href"):"";};eXcell_link.prototype.getContent=function(){var a=this.cell.firstChild;return a&&a.tagName?a.innerHTML:"";};function eXcell_grid(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._sub_grids){return;} +this._sub=this.grid._sub_grids[a._cellIndex];if(!this._sub){return;} +this._sindex=this._sub[1];this._sub=this._sub[0];} +this.getValue=function(){return this.cell.val;};this.setValue=function(c){this.cell.val=c;if(this._sub.getRowById(c)){c=this._sub.cells(c,this._sindex);if(c){c=c.getValue();}else{c="";}} +this.setCValue(c||" ",c);};this.edit=function(){this.val=this.cell.val;this._sub.entBox.style.display="block";var e=this.grid.getPosition(this.cell);this._sub.entBox.style.top=e[1]+"px";this._sub.entBox.style.left=e[0]+"px";this._sub.entBox.style.position="absolute";this._sub.setSizes();var c=this.grid.editStop;this.grid.editStop=function(){};if(this._sub.getRowById(this.cell.val)){this._sub.setSelectedRow(this.cell.val);} +this._sub.setActive(true);this.grid.editStop=c;};this.detach=function(){var c=this.cell.val;this._sub.entBox.style.display="none";if(this._sub.getSelectedId()===null){return false;} +this.setValue(this._sub.getSelectedId());this.grid.setActive(true);return this.cell.val!=c;};} +eXcell_grid.prototype=new eXcell();dhtmlXGridObject.prototype.setSubGrid=function(c,a,g){if(!this._sub_grids){this._sub_grids=[];} +this._sub_grids[a]=[c,g];c.entBox.style.display="none";var e=this;c.entBox.onclick=function(h){(h||window.event).cancelBubble=true;return false;};c.attachEvent("onRowSelect",function(h){e.editStop();return true;});c._chRRS=false;};function eXcell_dhxCalendar(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._grid_calendarA){var e=(this.grid._grid_calendarA=new dhtmlxCalendarObject());this.grid.callEvent("onDhxCalendarCreated",[e]);var c=this.grid;e.attachEvent("onClick",function(){this._last_operation_calendar=true;window.setTimeout(function(){c.editStop();},1);return true;});var g=function(h){(h||event).cancelBubble=true;};dhtmlxEvent(e.base,"click",g);e=null;}}} +eXcell_dhxCalendar.prototype=new eXcell();eXcell_dhxCalendar.prototype.edit=function(){var c=this.grid.getPosition(this.cell);this.grid._grid_calendarA._show(false,false);this.grid._grid_calendarA.setPosition(c[0],c[1]+this.cell.offsetHeight);this.grid._grid_calendarA._last_operation_calendar=false;this.grid.callEvent("onCalendarShow",[this.grid._grid_calendarA,this.cell.parentNode.idd,this.cell._cellIndex]);this.cell._cediton=true;this.val=this.cell.val;this._val=this.cell.innerHTML;var a=this.grid._grid_calendarA.draw;this.grid._grid_calendarA.draw=function(){};this.grid._grid_calendarA.setDateFormat(this.grid._dtmask||"%d/%m/%Y");this.grid._grid_calendarA.setDate(this.val||new Date());this.grid._grid_calendarA.draw=a;};eXcell_dhxCalendar.prototype.getDate=function(){if(this.cell.val){return this.cell.val;} +return null;};eXcell_dhxCalendar.prototype.getValue=function(){if(this.cell._clearCell){return"";} +if(this.grid._dtmask_inc&&this.cell.val){return this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask_inc,this.cell.val).toString();} +return this.cell.innerHTML.toString()._dhx_trim();};eXcell_dhxCalendar.prototype.detach=function(){if(!this.grid._grid_calendarA){return;} +this.grid._grid_calendarA.hide();if(this.cell._cediton){this.cell._cediton=false;}else{return;} +if(this.grid._grid_calendarA._last_operation_calendar){var e=this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask||"%d/%m/%Y");var c=this.grid._grid_calendarA.getDate();this.cell.val=new Date(c);this.setCValue(e,c);this.cell._clearCell=!e;var a=this.val;this.val=this._val;return this.cell.val.valueOf()!=(a||"").valueOf();} +return false;};eXcell_dhxCalendar.prototype.setValue=function(a){if(a&&typeof a=="object"){this.cell.val=a;this.cell._clearCell=false;this.setCValue(this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask||"%d/%m/%Y",a).toString(),this.cell.val);return;} +if(!a||a.toString()._dhx_trim()==""){a=" ";this.cell._clearCell=true;this.cell.val="";}else{this.cell._clearCell=false;this.cell.val=new Date(this.grid._grid_calendarA.setFormatedDate(this.grid._dtmask_inc||this.grid._dtmask||"%d/%m/%Y",a.toString(),null,true));if(this.grid._dtmask_inc){a=this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask||"%d/%m/%Y",this.cell.val);}} +if(this.cell.val=="NaN"||this.cell.val=="Invalid Date"){this.cell._clearCell=true;this.cell.val=new Date();this.setCValue(" ",0);}else{this.setCValue((a||"").toString(),this.cell.val);}};function eXcell_dhxCalendarA(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._grid_calendarA){var e=(this.grid._grid_calendarA=new dhtmlxCalendarObject());this.grid.callEvent("onDhxCalendarCreated",[e]);var c=this.grid;e.attachEvent("onClick",function(){this._last_operation_calendar=true;window.setTimeout(function(){c.editStop();},1);return true;});var g=function(h){(h||event).cancelBubble=true;};dhtmlxEvent(e.base,"click",g);}}} +eXcell_dhxCalendarA.prototype=new eXcell();eXcell_dhxCalendarA.prototype.edit=function(){var c=this.grid.getPosition(this.cell);this.grid._grid_calendarA._show(false,false);this.grid._grid_calendarA.setPosition(c[0]*1+this.cell.offsetWidth,c[1]*1);this.grid.callEvent("onCalendarShow",[this.grid._grid_calendarA,this.cell.parentNode.idd,this.cell._cellIndex]);this.grid._grid_calendarA._last_operation_calendar=false;this.cell._cediton=true;this.val=this.cell.val;this._val=this.cell.innerHTML;var a=this.grid._grid_calendarA.draw;this.grid._grid_calendarA.draw=function(){};this.grid._grid_calendarA.setDateFormat(this.grid._dtmask||"%d/%m/%Y");this.grid._grid_calendarA.setDate(this.val);this.grid._grid_calendarA.draw=a;this.cell.atag=!this.grid.multiLine&&(_isKHTML||_isMacOS||_isFF)?"INPUT":"TEXTAREA";this.obj=document.createElement(this.cell.atag);this.obj.style.height=this.cell.offsetHeight-4+"px";this.obj.className="dhx_combo_edit";this.obj.wrap="soft";this.obj.style.textAlign=this.cell.align;this.obj.onclick=function(g){(g||event).cancelBubble=true;};this.obj.onmousedown=function(g){(g||event).cancelBubble=true;};this.obj.value=this.getValue();this.cell.innerHTML="";this.cell.appendChild(this.obj);if(window.dhx4.isIE){this.obj.style.overflow="visible";if(this.grid.multiLine&&this.obj.offsetHeight>=18&&this.obj.offsetHeight<40){this.obj.style.height="36px";this.obj.style.overflow="scroll";}} +this.obj.onselectstart=function(g){if(!g){g=event;} +g.cancelBubble=true;return true;};this.obj.focus();this.obj.focus();};eXcell_dhxCalendarA.prototype.getDate=function(){if(this.cell.val){return this.cell.val;} +return null;};eXcell_dhxCalendarA.prototype.getValue=function(){if(this.cell._clearCell){return"";} +if(this.grid._dtmask_inc&&this.cell.val){return this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask_inc,this.cell.val).toString();} +return this.cell.innerHTML.toString()._dhx_trim();};eXcell_dhxCalendarA.prototype.detach=function(){if(!this.grid._grid_calendarA){return;} +this.grid._grid_calendarA.hide();if(this.cell._cediton){this.cell._cediton=false;}else{return;} +if(this.grid._grid_calendarA._last_operation_calendar){this.grid._grid_calendarA._last_operation_calendar=false;var e=this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask||"%d/%m/%Y");var c=this.grid._grid_calendarA.getDate();this.cell.val=new Date(c);this.setCValue(e,c);this.cell._clearCell=!e;var a=this.val;this.val=this._val;return this.cell.val.valueOf()!=(a||"").valueOf();} +this.setValue(this.obj.value);var a=this.val;this.val=this._val;return this.cell.val.valueOf()!=(a||"").valueOf();};eXcell_dhxCalendarA.prototype.setValue=function(a){if(a&&typeof a=="object"){this.cell.val=a;this.cell._clearCell=false;this.setCValue(this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask||"%d/%m/%Y",a).toString(),this.cell.val);return;} +if(!a||a.toString()._dhx_trim()==""){a=" ";this.cell._clearCell=true;this.cell.val="";}else{this.cell._clearCell=false;this.cell.val=new Date(this.grid._grid_calendarA.setFormatedDate(this.grid._dtmask_inc||this.grid._dtmask||"%d/%m/%Y",a.toString(),null,true));if(this.grid._dtmask_inc){a=this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask||"%d/%m/%Y",this.cell.val);}} +if(this.cell.val=="NaN"||this.cell.val=="Invalid Date"){this.cell.val=new Date();this.cell._clearCell=true;this.setCValue(" ",0);}else{this.setCValue((a||"").toString(),this.cell.val);}};function eXcell_cntr(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._ex_cntr_ready&&!this._realfake){this.grid._ex_cntr_ready=true;if(this.grid._h2){this.grid.attachEvent("onOpenEn",function(e){this.resetCounter(a._cellIndex);});} +var c=function(){var e=this;window.setTimeout(function(){if(!e.resetCounter){return;} +if(e._fake&&!e._realfake&&a._cellIndex");}else{this.setValue("");} +this.cell.wasChanged=true;this.grid.callEvent("onEditCell",[1,this.cell.parentNode.idd,this.cell._cellIndex]);this.grid.callEvent("onCheck",[this.cell.parentNode.idd,this.cell._cellIndex,this.val!="1"]);this.grid.callEvent("onCheckbox",[this.cell.parentNode.idd,this.cell._cellIndex,this.val!="1"]);}else{this.editor=null;}};this.getValue=function(){try{return this.cell.chstate.toString();}catch(e){return null;}};this.isCheckbox=function(){return true;};this.isChecked=function(){if(this.getValue()=="1"){return true;}else{return false;}};this.setChecked=function(e){this.setValue(e.toString());};this.detach=function(){return this.val!=this.getValue();};this.drawCurrentState=function(){if(this.cell.chstate==1){return"
 Yes
";}else{return"
 No
";}};} +eXcell_acheck.prototype=new eXcell();eXcell_acheck.prototype.setValue=function(c){c=(c||"").toString();if(c.indexOf("1")!=-1||c.indexOf("true")!=-1){c="1";this.cell.chstate="1";}else{c="0";this.cell.chstate="0";} +var a=this;this.setCValue(this.drawCurrentState(),this.cell.chstate);};function eXcell_context(a){if(a){this.cell=a;this.grid=this.cell.parentNode.grid;if(!this.grid._sub_context){return;} +this._sub=this.grid._sub_context[a._cellIndex];if(!this._sub){return;} +this._sindex=this._sub[1];this._sub=this._sub[0];} +this.getValue=function(){return _isIE?this.cell.innerText:this.cell.textContent;};this.setValue=function(e){this.cell._val=e;var c=this._sub.itemPull[this._sub.idPrefix+this.cell._val];e=c?c.title:e;this.setCValue(e||" ",e);};this.edit=function(){var e=this.grid.getPosition(this.cell);this._sub.showContextMenu(e[0]+this.cell.offsetWidth,e[1]);var c=this.grid.editStop;this.grid.editStop=function(){};this.grid.editStop=c;};this.detach=function(){if(this.grid._sub_id!=null){var c=this.cell._val;this.setValue(this.grid._sub_id);this.grid._sub_id=null;return this.cell._val!=c;} +this._sub.hideContextMenu();};} +eXcell_context.prototype=new eXcell();dhtmlXGridObject.prototype.setSubContext=function(a,c,g){var e=this;a.attachEvent("onClick",function(j,h){e._sub_id=j;e.editStop();a.hideContextMenu();return true;});if(!this._sub_context){this._sub_context=[];} +this._sub_context[c]=[a,g];a.hideContextMenu();};function dhtmlXGridFromTable(obj,init){if(typeof obj!="object"){obj=document.getElementById(obj);} +var w=document.createElement("DIV");w.setAttribute("width",obj.getAttribute("gridWidth")||(obj.offsetWidth?obj.offsetWidth+"px":0)||(window.getComputedStyle?window.getComputedStyle(obj,null)["width"]:obj.currentStyle?obj.currentStyle.width:0));w.setAttribute("height",obj.getAttribute("gridHeight")||(obj.offsetHeight?obj.offsetHeight+"px":0)||(window.getComputedStyle?window.getComputedStyle(obj,null)["height"]:obj.currentStyle?obj.currentStyle.height:0));w.className=obj.className;obj.className="";if(obj.id){w.id=obj.id;} +var mr=obj;var drag=obj.getAttribute("dragAndDrop");mr.parentNode.insertBefore(w,mr);var f=mr.getAttribute("name")||"name_"+new Date().valueOf();var windowf=new dhtmlXGridObject(w);window[f]=windowf;var acs=mr.getAttribute("onbeforeinit");var acs2=mr.getAttribute("oninit");if(acs){eval(acs);} +windowf.setImagePath(windowf.imgURL||mr.getAttribute("imgpath")||mr.getAttribute("image_path")||"");var skin=mr.getAttribute("skin");if(skin){windowf.setSkin(skin);} +if(init){init(windowf);} +var hrow=mr.rows[0];var za="";var zb="";var zc="";var zd="";var ze="";for(var i=0;i1){n.childNodes[g]._attrs.colspan=l.colSpan;for(var e=1;e=0?m:r.length]=n;return r;};this._genStr=function(a){var l="dhxId_";var n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";for(var m=0;m0){l=this.itemPull[F]._listBase[this.itemPull[F]._listBase.length-1];}}}}} +var C=document.createElement("DIV");if(y==true&&l!=null){l=l.nextSibling;} +if(l!=null){r.insertBefore(C,l);}else{r.appendChild(C);}}} +C._idd=o;C._rId=this._rId;if(typeof C.style!="undefined"){if(typeof v.offsetLeft=="undefined"&&this.idef.offsetLeft>0){v.offsetLeft=this.idef.offsetLeft;} +if(typeof v.offsetTop=="undefined"&&this.idef.offsetTop>0){v.offsetTop=this.idef.offsetTop;} +var u="";if(typeof v.offsetLeft!="undefined"){u+=" padding-left:"+v.offsetLeft+"px!important;";} +if(typeof v.offsetTop!="undefined"){u+=" padding-top:"+v.offsetTop+"px!important;";} +C.style.cssText+=u;} +if(D=="block"){if(isNaN(v.blockOffset)){v.blockOffset=this.idef.blockOffset;}} +if(D=="list"){if(typeof C._ofsNested=="undefined"){C._ofsNested=this.idef_const.offsetNested;} +if(s!=null){C._sId=s;} +var x=this.items[D].render(C,this.skin);if(!this.itemPull[this.idPrefix+o]._listObj){this.itemPull[this.idPrefix+o]._listObj=[];} +if(!this.itemPull[this.idPrefix+o]._list){this.itemPull[this.idPrefix+o]._list=[];} +if(!this.itemPull[this.idPrefix+o]._listBase){this.itemPull[this.idPrefix+o]._listBase=[];} +this.itemPull[this.idPrefix+o]._listObj.push(x[0]);this.itemPull[this.idPrefix+o]._list.push(x[1]);this.itemPull[this.idPrefix+o]._listBase.push(C);x[1].checkEvent=function(a){return e.checkEvent(a);};x[1].callEvent=function(a,w){return e.callEvent(a,w);};x[1].getForm=function(){return e.getForm();};x[1]._initObj(this._mergeSettings(v));if(C._inBlcok){C.className+=" in_block";} +return x[1];} +if(D=="newcolumn"){this._prepare(v.offset,E);return;} +if(D=="label"&&this._ic++==0){v._isTopmost=true;} +v.position=this.apos_css[!v.position||!this.apos_css[v.position]?this.idef.position:v.position];C.className=v.position+(typeof v.className=="string"?" "+v.className:"");if(!v.labelWidth){v.labelWidth=this.idef.labelWidth;} +if(!v.labelHeight){v.labelHeight=this.idef.labelHeight;} +if(typeof v.wrap!="undefined"){v.wrap=window.dhx4.s2b(v.wrap);} +v.labelAlign=this.align_css[v.labelAlign]?this.align_css[v.labelAlign]:this.align_css[this.idef.labelAlign];v.inputWidth=v.width?v.width:v.inputWidth?v.inputWidth:this.idef.inputWidth;if(!v.inputHeight){v.inputHeight=this.idef.inputHeight;} +if(typeof v.note!="undefined"){if(v.note.length!=null&&v.note[0]!=null){v.note=v.note[0];} +if(typeof v.note.width=="undefined"){v.note.width=this.idef.noteWidth;} +if(v.note.width=="auto"){v.note.width=v.inputWidth;}} +C.checkEvent=function(a){return e.checkEvent(a);};C.callEvent=function(a,w){return e.callEvent(a,w);};C.getForm=function(){return e.getForm();};C._autoCheck=function(a){e._autoCheck(a);};if(typeof v.readonly=="string"){v.readonly=window.dhx4.s2b(v.readonly);} +if(typeof v.autoStart=="string"){v.autoStart=window.dhx4.s2b(v.autoStart);} +if(typeof v.autoRemove=="string"){v.autoRemove=window.dhx4.s2b(v.autoRemove);} +if(typeof v.titleScreen=="string"){v.titleScreen=window.dhx4.s2b(v.titleScreen);} +if(typeof v.info=="string"){v.info=window.dhx4.s2b(v.info);} +if(typeof v.hidden=="string"){v.hidden=window.dhx4.s2b(v.hidden);} +if(typeof v.checked=="string"){v.checked=window.dhx4.s2b(v.checked);} +if(typeof v.userdata!="undefined"){for(var F in v.userdata){this.getForm().setUserData(o,F,v.userdata[F]);}} +if(v.validate){if(typeof(v.validate!="undefined")&&(typeof v.validate=="function"||typeof window[v.validate]=="function")){C._validate=[v.validate];}else{C._validate=String(v.validate).split(this.separator);}} +if(typeof v.required!="undefined"){if(typeof v.required=="string"){v.required=window.dhx4.s2b(v.required);} +C._required=v.required==true;} +if(C._required){if(!C._validate){C._validate=[];} +var n=false;for(m=0;m0){r[0].selected=true;}} +if(this.itemPull[m]._type=="ra"){var o=this.itemPull[m]._group;if(!l[o]){this.checkItem(o,this.doWithItem(n,"_getFirstValue"));l[o]=true;}} +if(this.itemPull[m]._list){for(var s=0;s0){this.base[m].removeChild(this.base[m].childNodes[0]);} +if(this.base[m].parentNode){this.base[m].parentNode.removeChild(this.base[m]);} +this.base[m]=null;} +this.base=null;this.cont.onkeypress=null;this.cont.className="";this.cont=null;for(var l in this){this[l]=null;} +e=null;};for(var c in this.items){this.items[c].t=c;if(typeof this.items[c]._index=="undefined"){this.items[c]._index=true;} +if(!this.items[c].show){this.items[c].show=function(a){a.style.display="";if(a._listObj){for(var l=0;l"+ +e.label+ +(e.info?"[?]":"")+ +(c._required?"*":"")+"";if(!isNaN(e.labelWidth)){a.firstChild.style.width=parseInt(e.labelWidth)+"px";} +if(!isNaN(e.labelHeight)){a.firstChild.style.height=parseInt(e.labelHeight)+"px";} +if(!isNaN(e.labelLeft)){a.style.left=parseInt(e.labelLeft)+"px";} +if(!isNaN(e.labelTop)){a.style.top=parseInt(e.labelTop)+"px";}},doAddInput:function(v,g,c,n,o,h,j){var a=document.createElement("DIV");a.className="dhxform_control";if(v._ll){v.appendChild(a);}else{v.insertBefore(a,v.firstChild);} +var s=document.createElement(c);s.className=j;s.name=v._idd;s._idd=v._idd;s.id=g.uid;if(typeof n=="string"){s.type=n;} +if(c=="INPUT"||c=="TEXTAREA"){s.onkeyup=function(u){u=u||event;v.callEvent("onKeyUp",[this,u,this._idd]);};s.onkeydown=function(u){u=u||event;v.callEvent("onKeyDown",[this,u,this._idd]);};} +a.appendChild(s);if(g.readonly){this.setReadonly(v,true);} +if(g.hidden==true){this.hide(v);} +if(g.disabled==true){this.userDisable(v);} +if(o){if(!isNaN(g.inputLeft)){a.style.left=parseInt(g.inputLeft)+"px";} +if(!isNaN(g.inputTop)){a.style.top=parseInt(g.inputTop)+"px";}} +var r="";var l=false;if(h){if(!isNaN(g.inputWidth)){r+="width:"+parseInt(g.inputWidth)+"px;";l=true;} +if(!isNaN(g.inputHeight)){r+="height:"+parseInt(g.inputHeight)+"px;";}} +if(typeof g.style=="string"){r+=g.style;} +s.style.cssText=r;if(g.maxLength){s.setAttribute("maxLength",g.maxLength);} +if(g.connector){s.setAttribute("connector",g.connector);} +var e=dhtmlXForm.prototype.items[this.t]!=null?dhtmlXForm.prototype.items[this.t]._dimFix==true:false;if(l&&({input:1,password:1,select:1,multiselect:1,calendar:1,colorpicker:1}[this.t]==1||e)){if(dhtmlXForm.prototype.items[this.t]._dim==null){dhtmlXForm.prototype.items[this.t]._dim=v.getForm()._checkDim(a,s);} +s.style.width=parseInt(s.style.width)-dhtmlXForm.prototype.items[this.t]._dim+"px";} +if(typeof g.note=="object"){var m=document.createElement("DIV");m.className="dhxform_note";m.style.width=(isNaN(g.note.width)?s.offsetWidth:parseInt(g.note.width))+"px";m._w=g.note.width;m.innerHTML=g.note.text;a.appendChild(m);m=null;}},doUnloadNestedLists:function(a){if(!a._list){return;} +for(var c=0;c0){a.removeChild(a.childNodes[0]);} +a.parentNode.removeChild(a);a=null;},doAttachEvents:function(c){var a=this;c.childNodes[c._ll?1:0][window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(h){h=h||event;if(h.preventDefault){h.preventDefault();} +var g=h.target||h.srcElement;if(!this.parentNode._enabled||this.parentNode._ro||(typeof g.className!="undefined"&&g.className=="dhxform_note")){h.cancelBubble=true;if(h.preventDefault){h.preventDefault();}else{h.returnValue=false;} +return false;} +a.doClick(this.parentNode);};c.childNodes[c._ll?0:1].childNodes[0][window.dhx4.isIPad?"ontouchstart":"onmousedown"]=function(h){h=h||event;if(h.preventDefault){h.preventDefault();} +if(!this.parentNode.parentNode._enabled){h.cancelBubble=true;if(h.preventDefault){h.preventDefault();}else{h.returnValue=false;} +return false;} +var g=h.target||h.srcElement;if(typeof g.className!="undefined"&&g.className=="dhxform_info"){this.parentNode.parentNode.callEvent("onInfo",[this.parentNode.parentNode._idd,h]);h.cancelBubble=true;if(h.preventDefault){h.preventDefault();}else{h.returnValue=false;} +return false;} +a.doClick(this.parentNode.parentNode);};},doClick:function(a){a.childNodes[a._ll?0:1].childNodes[0].focus();if(!a._enabled||a._ro){return;} +if(a.checkEvent("onBeforeChange")){if(a.callEvent("onBeforeChange",[a._idd,a._value,a._checked])!==true){return;}} +this.setChecked(a,!a._checked);a._autoCheck();a.callEvent("onChange",[a._idd,a._value,a._checked]);},doCheckValue:function(a){if(a._checked&&a._enabled){a.childNodes[a._ll?1:0].firstChild.name=String(a._idd);a.childNodes[a._ll?1:0].firstChild.value=this.getValue(a);}else{a.childNodes[a._ll?1:0].firstChild.name="";a.childNodes[a._ll?1:0].firstChild.value="";}},setChecked:function(a,c){a._checked=c===true?true:false;a.childNodes[a._ll?1:0].lastChild.className=a.childNodes[a._ll?1:0].lastChild.className.replace(/chbx[0-1]{1}/gi,"")+(a._checked?" chbx1":" chbx0");this.doCheckValue(a);},check:function(a){this.setChecked(a,true);},unCheck:function(a){this.setChecked(a,false);},isChecked:function(a){return a._checked;},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"");} +a._enabled=true;a.childNodes[a._ll?0:1].childNodes[0].tabIndex=0;a.childNodes[a._ll?0:1].childNodes[0].removeAttribute("disabled");this.doCheckValue(a);},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled";} +a._enabled=false;if(a._updateImgNode!=null){a._updateImgNode(a,false);} +a.childNodes[a._ll?0:1].childNodes[0].tabIndex=-1;a.childNodes[a._ll?0:1].childNodes[0].setAttribute("disabled","true");this.doCheckValue(a);},isEnabled:function(a){return a._enabled;},setText:function(a,c){a.childNodes[a._ll?0:1].childNodes[0].innerHTML=c+(a._required?"*":"");},getText:function(a){return a.childNodes[a._ll?0:1].childNodes[0].innerHTML.replace(/[^<]*<\/span>/g,"");},setValue:function(a,c){this.setChecked(a,c===true||parseInt(c)==1||c=="true"||a._value===c);},getValue:function(a,c){if(c=="realvalue"){return a._value;} +return typeof a._value=="undefined"||a._value==null?(a._checked?1:0):a._value;},setReadonly:function(a,c){a._ro=c===true;},isReadonly:function(a){return a._ro;},setFocus:function(a){a.childNodes[a._ll?0:1].childNodes[0].focus();},};dhtmlXForm.prototype.items.radio={input:{},r:{},firstValue:{},render:function(e,g,c){e._type="ra";e._enabled=true;e._checked=false;e._group=g.name;e._value=g.value;e._uid=c;e._ro=g.readonly==true;e._rName=e._rId+e._group;this.r[e._idd]=e;g.inputWidth=14;this.doAddLabel(e,g);this.doAddInput(e,g,"INPUT","TEXT",true,true,"dhxform_textarea");e.childNodes[e._ll?1:0].className+=" dhxform_img_node";var h=document.createElement("DIV");h.className="dhxform_img rdbt0";e.appendChild(h);if(!isNaN(g.inputLeft)){e.childNodes[e._ll?1:0].style.left=parseInt(g.inputLeft)+"px";} +if(!isNaN(g.inputTop)){e.childNodes[e._ll?1:0].style.top=parseInt(g.inputTop)+"px";} +e.childNodes[e._ll?1:0].appendChild(h);e.childNodes[e._ll?1:0].firstChild.name="";e.childNodes[e._ll?1:0].firstChild.value="";e._updateImgNode=function(l,m){var j=l.childNodes[l._ll?1:0].lastChild;j.className=(m?"dhxform_actv_r":"dhxform_img")+" "+(l._checked?"rdbt1":"rdbt0");l=j=null;};e._doOnFocus=function(j){j.getForm().callEvent("onFocus",[j._group,j._value]);};e._doOnBlur=function(j){j.getForm().callEvent("onBlur",[j._group,j._value]);};e._doOnKeyUpDown=function(l,j){this.callEvent(l,[this.childNodes[this._ll?0:1].childNodes[0],j,this._group,this._value]);};if(this.input[e._rName]==null){var a=document.createElement("INPUT");a.type="HIDDEN";a.name=g.name;a.firstValue=e._value;e.appendChild(a);this.input[e._rName]=a;} +if(!this.firstValue[e._rName]){this.firstValue[e._rName]=g.value;} +if(g.checked==true){this.check(e);} +if(g.hidden==true){this.hide(e);} +if(g.disabled==true){this.userDisable(e);} +this.doAttachEvents(e);return this;},destruct:function(g,h){if(g.lastChild==this.input[g._rName]){var e=false;for(var c in this.r){if(!e&&this.r[c]._group==g._group&&this.r[c]._idd!=g._idd){this.r[c].appendChild(this.input[g._rName]);e=true;}} +if(!e){this.input[g._rName].parentNode.removeChild(this.input[g._rName]);this.input[g._rName]=null;this.firstValue[g._rName]=null;}} +var j=g._idd;g._doOnFocus=g._doOnBlur=g._updateImgNode=null;this.doUnloadNestedLists(g);this.doDestruct(g);return j;},doClick:function(c){c.childNodes[c._ll?0:1].childNodes[0].focus();if(!(c._enabled&&!c._checked)){return;} +if(c._ro){return;} +var a=[c._group,c._value,true];if(c.checkEvent("onBeforeChange")){if(c.callEvent("onBeforeChange",a)!==true){return;}} +this.setChecked(c,true);c.getForm()._autoCheck();c.callEvent("onChange",a);},doCheckValue:function(e){var g=null;for(var c in this.r){if(this.r[c]._checked&&this.r[c]._group==e._group&&this.r[c]._rId==e._rId){g=this.r[c]._value;}} +if(g!=null&&this.r[c]._enabled){this.input[e._rName].name=String(e._group);this.input[e._rName].value=g;}else{this.input[e._rName].name="";this.input[e._rName].value="";} +this.input[e._rName]._value=g;},setChecked:function(h,j){j=j===true;for(var c in this.r){if(this.r[c]._group==h._group&&this.r[c]._rId==h._rId){var g=false;if(this.r[c]._idd==h._idd){if(this.r[c]._checked!=j){this.r[c]._checked=j;g=true;}}else{if(this.r[c]._checked){this.r[c]._checked=false;g=true;}} +if(g){var e=this.r[c].childNodes[this.r[c]._ll?1:0].childNodes[1];e.className=e.className.replace(/rdbt[0-1]{1}/gi,"")+(this.r[c]._checked?" rdbt1":" rdbt0");e=null;}}} +this.doCheckValue(h);},getChecked:function(a){return this.input[a._rName]._value;},_getFirstValue:function(a){return this.firstValue[a._rName];},_getId:function(a){return a._idd;},setValue:function(a,c){},};(function(){for(var c in{doAddLabel:1,doAddInput:1,doDestruct:1,doUnloadNestedLists:1,doAttachEvents:1,check:1,unCheck:1,isChecked:1,enable:1,disable:1,isEnabled:1,setText:1,getText:1,getValue:1,setReadonly:1,isReadonly:1,setFocus:1,}){dhtmlXForm.prototype.items.radio[c]=dhtmlXForm.prototype.items.checkbox[c];}})();dhtmlXForm.prototype.items.select={render:function(a,c){a._type="se";a._enabled=true;a._value=null;a._newValue=null;this.doAddLabel(a,c);this.doAddInput(a,c,"SELECT",null,true,true,"dhxform_select");this.doAttachEvents(a);this.doLoadOpts(a,c);if(c.connector!=null){this.doLoadOptsConnector(a,c.connector);} +if(typeof c.value!="undefined"&&c.value!=null){this.setValue(a,c.value);} +return this;},destruct:function(a){this.doUnloadNestedLists(a);a.callEvent=null;a.checkEvent=null;a.getForm=null;a._autoCheck=null;a._enabled=null;a._idd=null;a._type=null;a._value=null;a._newValue=null;a.onselectstart=null;a.childNodes[a._ll?1:0].childNodes[0].onclick=null;a.childNodes[a._ll?1:0].childNodes[0].onkeydown=null;a.childNodes[a._ll?1:0].childNodes[0].onchange=null;a.childNodes[a._ll?1:0].childNodes[0].onfocus=null;a.childNodes[a._ll?1:0].childNodes[0].onblur=null;a.childNodes[a._ll?1:0].childNodes[0].onkeyup=null;a.childNodes[a._ll?1:0].removeChild(a.childNodes[a._ll?1:0].childNodes[0]);while(a.childNodes.length>0){a.removeChild(a.childNodes[0]);} +a.parentNode.removeChild(a);a=null;},doAddLabel:function(c,e){var a=document.createElement("DIV");a.className="dhxform_label "+e.labelAlign;a.innerHTML="";if(e.wrap==true){a.style.whiteSpace="normal";} +if(typeof e.tooltip!="undefined"){a.title=e.tooltip;} +c.appendChild(a);if(typeof e.label=="undefined"||e.label==null||e.label.length==0){a.style.display="none";} +if(!isNaN(e.labelWidth)){a.style.width=parseInt(e.labelWidth)+"px";} +if(!isNaN(e.labelHeight)){a.style.height=parseInt(e.labelHeight)+"px";} +if(!isNaN(e.labelLeft)){a.style.left=parseInt(e.labelLeft)+"px";} +if(!isNaN(e.labelTop)){a.style.top=parseInt(e.labelTop)+"px";} +if(e.info){a.onclick=function(h){h=h||event;var g=h.target||h.srcElement;if(typeof g.className!="undefined"&&g.className=="dhxform_info"){this.parentNode.callEvent("onInfo",[this.parentNode._idd,h]);h.cancelBubble=true;if(h.preventDefault){h.preventDefault();}else{h.returnValue=false;} +return false;}};}},doAttachEvents:function(e){var a=e.childNodes[e._ll?1:0].childNodes[0];var c=this;a.onclick=function(){c.doOnChange(this);};a.onkeydown=function(g){g=g||event;c.doOnChange(this);this.parentNode.parentNode.callEvent("onKeyDown",[this,g,this.parentNode.parentNode._idd]);};a.onchange=function(){c.doOnChange(this);};a.onkeyup=function(g){g=g||event;this.parentNode.parentNode.callEvent("onKeyUp",[this,g,this.parentNode.parentNode._idd]);};a=null;this.doAttachChangeLS(e);},doAttachChangeLS:function(c){var a=c.childNodes[c._ll?1:0].childNodes[0];a.onfocus=function(){var e=this.parentNode.parentNode;e.getForm()._ccActivate(e._idd,this,e.getForm().getItemValue(e._idd,true));e.getForm().callEvent("onFocus",[e._idd]);e=null;};a.onblur=function(){var e=this.parentNode.parentNode;e.getForm()._ccDeactivate(e._idd);e.getForm().callEvent("onBlur",[e._idd]);e=null;};a=null;},doValidate:function(a){if(a.getForm().live_validate){this._validate(a);}},doLoadOpts:function(l,h,n){var m=l.childNodes[l._ll?1:0].childNodes[0];var a=h.options;var g=false;for(var c=0;c=0){l._value=m.options[m.selectedIndex].value;} +if(n===true){l.callEvent("onOptionsLoaded",[l._idd]);} +this._checkNoteWidth(l);},doLoadOptsConnector:function(e,a){var c=this;e._connector_working=true;window.dhx4.ajax.get(a,function(l){l=l.xmlDoc.responseXML;if(l==null){return;} +var g=l.getElementsByTagName("data");if(g==null||g[0]==null){return;} +g=g[0];var j=[];for(var m=0;m=0?e.options[e.selectedIndex].value:null;if(a._newValue!=a._value){if(a.checkEvent("onBeforeChange")){if(a.callEvent("onBeforeChange",[a._idd,a._value,a._newValue])!==true){for(var c=0;c*":"");a.childNodes[a._ll?0:1].style.display=c.length==0||c==null?"none":"";},getText:function(a){return a.childNodes[a._ll?0:1].childNodes[0].innerHTML.replace(/[^<]*<\/span>/g,"");},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"");} +a._enabled=true;a.childNodes[a._ll?1:0].childNodes[0].removeAttribute("disabled");},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled";} +a._enabled=false;a.childNodes[a._ll?1:0].childNodes[0].setAttribute("disabled",true);},getOptions:function(a){return a.childNodes[a._ll?1:0].childNodes[0].options;},setValue:function(c,g){if(c._connector_working){c._connector_value=g;return;} +var a=this.getOptions(c);for(var e=0;e0){c.getForm()._autoCheck();} +c.getForm()._ccReload(c._idd,c._value);},getValue:function(e){var a=-1;var c=this.getOptions(e);for(var g=0;g=0&&a._w=="auto"){a.style.width=c.childNodes[c._ll?1:0].childNodes[0].offsetWidth+"px";}} +a=null;},};(function(){for(var c in{doAddInput:1,doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.select[c]=dhtmlXForm.prototype.items.checkbox[c];}})();dhtmlXForm.prototype.items.multiselect={doLoadOpts:function(g,j,l){var c=g.childNodes[g._ll?1:0].childNodes[0];c.multiple=true;if(!isNaN(j.size)){c.size=Number(j.size);} +g._value=[];g._newValue=[];var e=j.options;for(var h=0;h=0){a.className=String(a.className).replace(/disabled/gi,"");} +a._enabled=true;},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled";} +a._enabled=false;},setText:function(a,c){a.firstChild.innerHTML=c;},getText:function(a){return a.firstChild.innerHTML;},};(function(){for(var c in{doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.label[c]=dhtmlXForm.prototype.items.checkbox[c];}})();dhtmlXForm.prototype.items.button={render:function(c,e){c._type="bt";c._enabled=true;c._name=e.name;c.className=String(c.className).replace("item_label_top","item_label_left").replace("item_label_right","item_label_left");c._doOnKeyUpDown=function(h,g){this.callEvent(h,[this.childNodes[0].childNodes[0],g,this._idd]);};c.innerHTML='
'+e.value+'
';if(!isNaN(e.width)){var a=Math.max(e.width,10);if(dhtmlXForm.prototype.items[this.t]._dim==null){c.firstChild.style.width=a+"px";dhtmlXForm.prototype.items[this.t]._dim=c.getForm()._checkDim(c,c.firstChild);} +c.firstChild.style.width=a-dhtmlXForm.prototype.items[this.t]._dim+"px";c.firstChild.firstChild.className+=" dhxform_btn_txt_autowidth";} +if(!isNaN(e.inputLeft)){c.childNodes[0].style.left=parseInt(e.inputLeft)+"px";} +if(!isNaN(e.inputTop)){c.childNodes[0].style.top=parseInt(e.inputTop)+"px";} +if(e.hidden==true){this.hide(c);} +if(e.disabled==true){this.userDisable(c);} +if(typeof e.tooltip!="undefined"){c.firstChild.title=e.tooltip;} +c.onselectstart=function(g){g=g||event;g.cancelBubble=true;if(g.preventDefault){g.preventDefault();}else{g.returnValue=false;} +return false;};c.firstChild.onselectstart=function(g){g=g||event;g.cancelBubble=true;if(g.preventDefault){g.preventDefault();}else{g.returnValue=false;} +return false;};c.firstChild.onkeypress=function(g){g=g||event;if((g.keyCode==32||g.charCode==32||g.keyCode==13||g.charCode==13)&&!this.parentNode._busy){this.parentNode._busy=true;g.cancelBubble=true;if(g.preventDefault){g.preventDefault();}else{g.returnValue=false;} +_dhxForm_doClick(this.childNodes[0],["mousedown","mouseup"]);return false;}};c.firstChild.onfocus=function(){this.parentNode._doOnFocus(this.parentNode);};c.firstChild.onblur=function(){_dhxForm_doClick(this.childNodes[0],"mouseout");this.parentNode._doOnBlur(this.parentNode);};c.firstChild.onkeyup=function(g){this.parentNode._doOnKeyUpDown("onKeyUp",g||event);};c.firstChild.onkeydown=function(g){this.parentNode._doOnKeyUpDown("onKeyDown",g||event);};c.firstChild.onmouseover=function(){var g=this.parentNode;if(!g._enabled){return;} +this._isOver=true;this.className="dhxform_btn dhxform_btn_over";g=null;};c.firstChild.onmouseout=function(){var g=this.parentNode;if(!g._enabled){return;} +this.className="dhxform_btn";this._allowClick=false;this._pressed=false;this._isOver=false;g=null;};c.firstChild.ontouchstart=c.firstChild.onmousedown=function(h){h=h||event;if(h.type=="touchstart"&&h.preventDefault){h.preventDefault();} +if(h.button>=2){return;} +if(this._pressed){return;} +var g=this.parentNode;if(!g._enabled){return;} +this.className="dhxform_btn dhxform_btn_pressed";this._allowClick=true;this._pressed=true;g=null;};c.firstChild.ontouchend=c.firstChild.onmouseup=function(h){h=h||event;if(h.button>=2){return;} +if(!this._pressed){return;} +var g=this.parentNode;if(!g._enabled){return;} +g._busy=false;this.className="dhxform_btn"+(this._isOver?" dhxform_btn_over":"");if(this._pressed&&this._allowClick){g.callEvent("_onButtonClick",[g._name,g._cmd]);} +this._allowClick=false;this._pressed=false;g=null;};c._doOnFocus=function(g){g.getForm().callEvent("onFocus",[g._idd]);};c._doOnBlur=function(g){g.getForm().callEvent("onBlur",[g._idd]);};return this;},destruct:function(a){this.doUnloadNestedLists(a);a.callEvent=null;a.checkEvent=null;a.getForm=null;a._autoCheck=null;a._type=null;a._enabled=null;a._cmd=null;a._name=null;a._doOnFocus=null;a._doOnBlur=null;a._doOnKeyUpDown=null;a.onselectstart=null;a.firstChild.onselectstart=null;a.firstChild.onkeypress=null;a.firstChild.ontouchstart=null;a.firstChild.ontouchend=null;a.firstChild.onfocus=null;a.firstChild.onblur=null;a.firstChild.onkeyup=null;a.firstChild.onkeydown=null;a.firstChild.onmouseover=null;a.firstChild.onmouseout=null;a.firstChild.onmousedown=null;a.firstChild.onmouseup=null;while(a.childNodes.length>0){a.removeChild(a.childNodes[0]);} +a.parentNode.removeChild(a);a=null;},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"");} +a._enabled=true;a.childNodes[0].removeAttribute("disabled");a.childNodes[0].setAttribute("role","link");a.childNodes[0].setAttribute("tabIndex","0");},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled";} +a._enabled=false;a.childNodes[0].setAttribute("disabled","true");a.childNodes[0].removeAttribute("role");a.childNodes[0].removeAttribute("tabIndex");},setText:function(a,c){a.childNodes[0].childNodes[0].innerHTML=c;},getText:function(a){return a.childNodes[0].childNodes[0].innerHTML;},setFocus:function(a){a.childNodes[0].focus();},};(function(){for(var c in{doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.button[c]=dhtmlXForm.prototype.items.checkbox[c];}})();dhtmlXForm.prototype.items.hidden={_index:false,render:function(c,e){c.style.display="none";c._name=e.name;c._type="hd";c._enabled=true;var a=document.createElement("INPUT");a.type="HIDDEN";a.name=e.name;a.value=e.value||"";c.appendChild(a);return this;},destruct:function(a){this.doUnloadNestedLists(a);while(a.childNodes.length>0){a.removeChild(a.childNodes[0]);} +a._autoCheck=null;a._name=null;a._type=null;a._enabled=null;a.onselectstart=null;a.callEvent=null;a.checkEvent=null;a.getForm=null;a.parentNode.removeChild(a);a=null;},enable:function(a){a._enabled=true;a.childNodes[0].setAttribute("name",a._name);},disable:function(a){a._enabled=false;a.childNodes[0].removeAttribute("name");},show:function(){},hide:function(){},isHidden:function(){return true;},setValue:function(a,c){a.childNodes[0].value=c;},getValue:function(a){return a.childNodes[0].value;},getInput:function(a){return a.childNodes[0];},};(function(){for(var c in{doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.hidden[c]=dhtmlXForm.prototype.items.checkbox[c];}})();dhtmlXForm.prototype.items.list={_index:false,render:function(a,c){a._type="list";a._enabled=true;a._isNestedForm=true;a.style.paddingLeft=a._ofsNested+"px";a.className="dhxform_base_nested"+(a._custom_css||"");return[this,new dhtmlXForm(a,null,c)];},destruct:function(a){},};dhtmlXForm.prototype.items.fieldset={_index:false,render:function(c,g){c._type="fs";if(typeof parseInt(g.inputWidth)=="number"){} +c._width=g.width;c._enabled=true;c._checked=true;c.className="fs_"+g.position+(typeof g.className=="string"?" "+g.className:"");var e=document.createElement("FIELDSET");e.className="dhxform_fs";var h=String(g.labelAlign).replace("align_","");e.innerHTML=""+g.label+"";c.appendChild(e);if(!isNaN(g.inputLeft)){e.style.left=parseInt(g.inputLeft)+"px";} +if(!isNaN(g.inputTop)){e.style.top=parseInt(g.inputTop)+"px";} +if(g.inputWidth!="auto"){if(!isNaN(g.inputWidth)){e.style.width=parseInt(g.inputWidth)+"px";var a=parseInt(e.style.width);if(e.offsetWidth>a){e.style.width=a+(a-e.offsetWidth)+"px";}}} +c._addSubListNode=function(){var j=document.createElement("DIV");j._custom_css=" dhxform_fs_nested";this.childNodes[0].appendChild(j);return j;};if(g.hidden==true){this.hide(c);} +if(g.disabled==true){this.userDisable(c);} +return this;},destruct:function(a){this.doUnloadNestedLists(a);a._checked=null;a._enabled=null;a._idd=null;a._type=null;a._width=null;a.onselectstart=null;a._addSubListNode=null;a._autoCheck=null;a.callEvent=null;a.checkEvent=null;a.getForm=null;while(a.childNodes.length>0){a.removeChild(a.childNodes[0]);} +a.parentNode.removeChild(a);a=null;},setText:function(a,c){a.childNodes[0].childNodes[0].innerHTML=c;},getText:function(a){return a.childNodes[0].childNodes[0].innerHTML;},enable:function(a){a._enabled=true;if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"");}},disable:function(a){a._enabled=false;if(String(a.className).search("disabled")<0){a.className+=" disabled";}},setWidth:function(c,a){c.childNodes[0].style.width=a+"px";c._width=a;},getWidth:function(a){return a._width;},};(function(){for(var c in{doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.fieldset[c]=dhtmlXForm.prototype.items.checkbox[c];}})();dhtmlXForm.prototype.items.block={_index:false,render:function(c,e){c._type="bl";c._width=e.width;c._enabled=true;c._checked=true;c.className="block_"+e.position+(typeof e.className=="string"?" "+e.className:"");var a=document.createElement("DIV");a.className="dhxform_obj_"+c.getForm().skin+" dhxform_block";a.style.fontSize=c.getForm().cont.style.fontSize;if(e.style){a.style.cssText=e.style;} +if(typeof e.id!="undefined"){a.id=e.id;} +c.appendChild(a);if(!isNaN(e.inputLeft)){a.style.left=parseInt(e.inputLeft)+"px";} +if(!isNaN(e.inputTop)){a.style.top=parseInt(e.inputTop)+"px";} +if(e.inputWidth!="auto"){if(!isNaN(e.inputWidth)){a.style.width=parseInt(e.inputWidth)+"px";}} +if(!isNaN(e.blockOffset)){c._ofsNested=e.blockOffset;} +c._addSubListNode=function(){var g=document.createElement("DIV");g._inBlcok=true;if(typeof this._ofsNested!="undefined"){g._ofsNested=this._ofsNested;} +this.childNodes[0].appendChild(g);return g;};if(e.hidden==true){this.hide(c);} +if(e.disabled==true){this.userDisable(c);} +return this;},_setCss:function(a,e,c){a.firstChild.className="dhxform_obj_"+e+" dhxform_block";a.firstChild.style.fontSize=c;},};(function(){for(var c in{enable:1,disable:1,isEnabled:1,setWidth:1,getWidth:1,doUnloadNestedLists:1,destruct:1}){dhtmlXForm.prototype.items.block[c]=dhtmlXForm.prototype.items.fieldset[c];}})();dhtmlXForm.prototype.items.newcolumn={_index:false};dhtmlXForm.prototype.items.template={render:function(c,e){var a=!isNaN(e.rows);c._type="tp";c._enabled=true;if(e.format!=null){if(typeof e.format=="function"){c.format=e.format;}else{if(typeof e.format=="string"&&typeof window[e.format]=="function"){c.format=window[e.format];}}} +if(c.format==null){c.format=function(g,h){return h;};} +this.doAddLabel(c,e);this.doAddInput(c,e,"DIV",null,true,true,"dhxform_item_template");this.setValue(c,e.value||"");return this;},destruct:function(a){a.format=null;this.d2(a);a=null;},setValue:function(a,c){a._value=c;a.childNodes[a._ll?1:0].childNodes[0].innerHTML=a.format(a._idd,a._value);},getValue:function(a){return a._value;},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"");} +a._enabled=true;},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled";} +a._enabled=false;},};(function(){dhtmlXForm.prototype.items.template.d2=dhtmlXForm.prototype.items.input.destruct;for(var c in{doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,isEnabled:1,setWidth:1}){dhtmlXForm.prototype.items.template[c]=dhtmlXForm.prototype.items.select[c];}})();dhtmlXForm.prototype._ulToObject=function(j,o){var l=[];for(var c=0;c=0){this.cont.className=String(this.cont.className).replace(/dhxform_rtl/gi,"");}}};_dhxForm_doClick=function(h,c){if(typeof c=="object"){var a=c[1];c=c[0];} +if(document.createEvent){var g=document.createEvent("MouseEvents");g.initEvent(c,true,false);h.dispatchEvent(g);}else{if(document.createEventObject){var g=document.createEventObject();g.button=1;h.fireEvent("on"+c,g);}} +if(a){window.setTimeout(function(){_dhxForm_doClick(h,a);},100);}};dhtmlXForm.prototype.setFormData=function(e){for(var c in e){var g=this.getItemType(c);switch(g){case"checkbox":this[e[c]==true||parseInt(e[c])==1||e[c]=="true"||e[c]==this.getItemValue(c,"realvalue")?"checkItem":"uncheckItem"](c);break;case"radio":this.checkItem(c,e[c]);break;case"input":case"textarea":case"password":case"select":case"multiselect":case"hidden":case"template":case"combo":case"calendar":case"colorpicker":case"editor":this.setItemValue(c,e[c]);break;default:if(this["setFormData_"+g]){this["setFormData_"+g](c,e[c]);}else{if(!this.hId){this.hId=this._genStr(12);} +this.setUserData(this.hId,c,e[c]);} +break;}}};dhtmlXForm.prototype.getFormData=function(u,j){var c={};var n=this;for(var s in this.itemPull){var m=this.itemPull[s]._idd;var v=this.itemPull[s]._type;if(v=="ch"){c[m]=this.isItemChecked(m)?this.getItemValue(m):0;} +if(v=="ra"&&!c[this.itemPull[s]._group]){c[this.itemPull[s]._group]=this.getCheckedValue(this.itemPull[s]._group);} +if(v in{se:1,ta:1,pw:1,hd:1,tp:1,fl:1,calendar:1,combo:1,editor:1,colorpicker:1}){c[m]=this.getItemValue(m,u);} +if(this["getFormData_"+v]){c[m]=this["getFormData_"+v](m);} +if(v=="up"){var h=this.getItemValue(m);for(var g in h){c[g]=h[g];}} +if(this.itemPull[s]._list){for(var e=0;eh){h=this.base[l].offsetHeight;}} +var g=false;try{g=this.cont.parentNode.parentNode.parentNode.parentNode._isCell==true;if(g){var a=this.cont.parentNode.parentNode.parentNode.parentNode;}}catch(m){} +if(g&&typeof a!="undefined"){if(j>0){a.setWidth(j+10);} +if(h>0){a.setHeight(h+a.firstChild.firstChild.offsetHeight+5);} +g=a=null;return;} +var c=false;try{c=this.cont.parentNode.parentNode.parentNode._isWindow==true;if(c){var n=this.cont.parentNode.parentNode;if(typeof n.callEvent=="function"){this.cont.style.display="none";n.callEvent("_setCellSize",[j+15,h+15]);this.cont.style.display="";}}}catch(m){}};dhtmlXForm.prototype.reset=function(){if(this.callEvent("onBeforeReset",[this.formId,this.getFormData()])){if(this._last_load_data){this.setFormData(this._last_load_data);} +this.callEvent("onAfterReset",[this.formId]);}};dhtmlXForm.prototype.send=function(c,l,m,g){if(typeof l=="function"){m=l;l="post";}else{l=l=="get"?"get":"post";} +if(g!==true&&!this.validate()){return;} +var j=this.getFormData(true);var h=[];for(var e in j){h.push(e+"="+encodeURIComponent(j[e]));} +var a=function(n){if(m){m.call(this,n,n.xmlDoc.responseText);}};if(l=="get"){window.dhx4.ajax.get(c+(c.indexOf("?")==-1?"?":"&")+h.join("&"),a);}else{window.dhx4.ajax.post(c,h.join("&"),a);}};dhtmlXForm.prototype.save=function(a,c){};dhtmlXForm.prototype.dummy=function(){};dhtmlXForm.prototype._changeFormId=function(c,a){this.formId=a;};dhtmlXForm.prototype._dp_init=function(a){a._methods=["dummy","dummy","_changeFormId","dummy"];a._getRowData=function(g,c){var e=this.obj.getFormData(true);e[this.action_param]=this.obj.getUserData(g,this.action_param);return e;};a._clearUpdateFlag=function(){};a.attachEvent("onAfterUpdate",function(e,g,h,c){if(g=="inserted"||g=="updated"){this.obj.resetDataProcessor("updated");this.obj._last_load_data=this.obj.getFormData(true);} +this.obj.callEvent("onAfterSave",[this.obj.formId,c]);return true;});a.autoUpdate=false;a.setTransactionMode("POST",true);this.dp=a;this.formId=new Date().valueOf();this.resetDataProcessor("inserted");this.save=function(){if(!this.callEvent("onBeforeSave",[this.formId,this.getFormData()])){return;} +if(!this.validate()){return;} +a.sendData();};};dhtmlXForm.prototype.resetDataProcessor=function(a){if(!this.dp){return;} +this.dp.updatedRows=[];this.dp._in_progress=[];this.dp.setUpdated(this.formId,true,a);};dhtmlXForm.prototype._ccActivate=function(e,a,c){if(!this._formLS){this._formLS={};} +if(!this._formLS[e]){this._formLS[e]={input:a,value:c};} +if(!this._ccActive){this._ccActive=true;this._ccDo();} +a=null;};dhtmlXForm.prototype._ccDeactivate=function(a){if(this._ccTm){window.clearTimeout(this._ccTm);} +this._ccActive=false;if(this._formLS!=null&&this._formLS[a]!=null){this._formLS[a].input=null;this._formLS[a]=null;delete this._formLS[a];}};dhtmlXForm.prototype._ccDo=function(){if(this._ccTm){window.clearTimeout(this._ccTm);} +for(var c in this._formLS){var h=this._formLS[c].input;if(String(h.tagName).toLowerCase()=="select"){var e="";if(h.selectedIndex>=0&&h.selectedIndex=0){this.cont.className=this.cont.className.replace(/\s{0,}combo_in_focus/gi,"");} +h.callEvent("onBlur",[g._idd]);h=g=null;});return this;},destruct:function(a){a.childNodes[a._ll?1:0].childNodes[0].onchange=null;a._combo._currentComboValue=null;a._combo.unload();a._combo=null;a._apiChange=null;this.d2(a);a=null;},doAttachEvents:function(c){var a=this;c.childNodes[c._ll?1:0].childNodes[0].onchange=function(){a.doOnChange(this);a.doValidate(this.DOMParent.parentNode.parentNode);};},doValidate:function(a){if(a.getForm().hot_validate){this._validate(a);}},doOnChange:function(c){var a=c.base.parentNode.parentNode.parentNode;if(a._apiChange){return;} +c._newComboValue=c.getSelectedValue();if(c._newComboValue!=c._currentComboValue){if(a.checkEvent("onBeforeChange")){if(a.callEvent("onBeforeChange",[a._idd,c._currentComboValue,c._newComboValue])!==true){window.setTimeout(function(){c.setComboValue(c._currentComboValue);},1);return false;}} +c._currentComboValue=c._newComboValue;a.callEvent("onChange",[a._idd,c._currentComboValue]);} +a._autoCheck(a._enabled);},doLoadOptsConnector:function(g,a){var e=this;var c=g;g._connector_working=true;g._apiChange=true;g._combo.load(a,function(){c.callEvent("onOptionsLoaded",[c._idd]);c._connector_working=false;if(c._connector_value!=null){e.setValue(c,c._connector_value);c._connector_value=null;} +c._apiChange=false;e=c=null;});},enable:function(a){if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"");} +a._enabled=true;a._combo.enable();},disable:function(a){if(String(a.className).search("disabled")<0){a.className+=" disabled";} +a._enabled=false;a._combo.disable();},getCombo:function(a){return a._combo;},setValue:function(a,c){if(a._connector_working){a._connector_value=c;return;} +a._apiChange=true;a._combo.setComboValue(c);a._combo._currentComboValue=a._combo.getActualValue();a._apiChange=false;},getValue:function(a){return a._combo.getActualValue();},setWidth:function(c,a){c.childNodes[c._ll?1:0].childNodes[0].style.width=a+"px";},setReadonly:function(a,c){if(!a._combo){return;} +a._combo_ro=c;a._combo.readonly(a._combo_ro);},isReadonly:function(a,c){return a._combo_ro||false;},setFocus:function(a){if(a._enabled){a._combo.setFocus();}},_setCss:function(a,e,c){a._combo.setFontSize(c,c);},};(function(){for(var c in{doAddLabel:1,doAddInput:1,doLoadOpts:1,doUnloadNestedLists:1,setText:1,getText:1,isEnabled:1,_checkNoteWidth:1}){dhtmlXForm.prototype.items.combo[c]=dhtmlXForm.prototype.items.select[c];}})();dhtmlXForm.prototype.items.combo.d2=dhtmlXForm.prototype.items.select.destruct;dhtmlXForm.prototype.getCombo=function(a){return this.doWithItem(a,"getCombo");};dhtmlXForm.prototype.items.calendar={render:function(e,h){var c=this;e._type="calendar";e._enabled=true;var j=navigator.userAgent;var a=j.indexOf("MSIE 6.0")>=0||j.indexOf("MSIE 7.0")>=0||j.indexOf("MSIE 8.0")>=0;this.doAddLabel(e,h);this.doAddInput(e,h,"INPUT","TEXT",true,true,"dhxform_textarea calendar");this.doAttachChangeLS(e);if(a){e.childNodes[e._ll?1:0].childNodes[0].onfocus2=e.childNodes[e._ll?1:0].childNodes[0].onfocus;e.childNodes[e._ll?1:0].childNodes[0].onfocus=function(){if(this._skipOnFocus==true){this._skipOnFocus=false;return;} +this.onfocus2.apply(this,arguments);};} +e.childNodes[e._ll?1:0].childNodes[0]._idd=e._idd;e.childNodes[e._ll?1:0].childNodes[0].onblur=function(){var l=this.parentNode.parentNode;if(l._c.base._formMouseDown){l._c.base._formMouseDown=false;this._skipOnFocus=true;this.focus();this.value=this.value;l=null;return true;} +var m=l.getForm();m._ccDeactivate(l._idd);c.checkEnteredValue(this.parentNode.parentNode);if(m.live_validate){c._validate(l);} +m.callEvent("onBlur",[l._idd]);if(!l._c.isVisible()){l._tempValue=null;} +m=l=null;};e._f=h.dateFormat||null;e._f0=h.serverDateFormat||e._f;var g=e.getForm();e._c=new dhtmlXCalendarObject(e.childNodes[e._ll?1:0].childNodes[0],h.skin||g.skin||"dhx_skyblue");e._c._nullInInput=true;e._c.enableListener(e.childNodes[e._ll?1:0].childNodes[0]);if(e._f!=null){e._c.setDateFormat(e._f);} +if(!window.dhx4.s2b(h.enableTime)){e._c.hideTime();} +if(window.dhx4.s2b(h.showWeekNumbers)){e._c.showWeekNumbers();} +if(!isNaN(h.weekStart)){e._c.setWeekStartDay(h.weekStart);} +if(typeof h.calendarPosition!="undefined"){e._c.setPosition(h.calendarPosition);} +if(h.minutesInterval!=null){e._c.setMinutesInterval(h.minutesInterval);} +e._c._itemIdd=e._idd;e._c.attachEvent("onBeforeChange",function(l){if(e._value!=l){if(e.checkEvent("onBeforeChange")){if(e.callEvent("onBeforeChange",[e._idd,e._value,l])!==true){return false;}} +e._tempValue=e._value=l;c.setValue(e,l,false);e.callEvent("onChange",[this._itemIdd,e._value]);} +return true;});e._c.attachEvent("onClick",function(){e._tempValue=null;});e._c.attachEvent("onHide",function(){e._tempValue=null;});if(a){e._c.base.onmousedown=function(){this._formMouseDown=true;return false;};} +this.setValue(e,h.value);g=null;return this;},getCalendar:function(a){return a._c;},setSkin:function(a,c){a._c.setSkin(c);},setValue:function(c,e,a){if(!e||e==null||typeof e=="undefined"||e==""){c._value=null;c.childNodes[c._ll?1:0].childNodes[0].value="";}else{c._value=e instanceof Date?e:c._c._strToDate(e,c._f0||c._c._dateFormat);c.childNodes[c._ll?1:0].childNodes[0].value=c._c._dateToStr(c._value,c._f||c._c._dateFormat);} +if(a!==false){c._c.setDate(c._value);}},getValue:function(c,a){var e=c._tempValue||c._c.getDate();if(a===true&&e==null){return"";} +return a===true?c._c._dateToStr(e,c._f0||c._c._dateFormat):e;},setDateFormat:function(c,a,e){c._f=a;c._f0=e||c._f;c._c.setDateFormat(c._f);this.setValue(c,this.getValue(c));},destruct:function(a){a._c.disableListener(a.childNodes[a._ll?1:0].childNodes[0]);a._c.unload();a._c=null;try{delete a._c;}catch(c){} +a._f=null;try{delete a._f;}catch(c){} +a._f0=null;try{delete a._f0;}catch(c){} +a.childNodes[a._ll?1:0].childNodes[0]._idd=null;a.childNodes[a._ll?1:0].childNodes[0].onblur=null;this.d2(a);a=null;},checkEnteredValue:function(a){this.setValue(a,a._c.getDate());},};(function(){for(var c in{doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,enable:1,disable:1,isEnabled:1,setWidth:1,setReadonly:1,isReadonly:1,setFocus:1,getInput:1}){dhtmlXForm.prototype.items.calendar[c]=dhtmlXForm.prototype.items.input[c];}})();dhtmlXForm.prototype.items.calendar.doAttachChangeLS=dhtmlXForm.prototype.items.select.doAttachChangeLS;dhtmlXForm.prototype.items.calendar.d2=dhtmlXForm.prototype.items.input.destruct;dhtmlXForm.prototype.getCalendar=function(a){return this.doWithItem(a,"getCalendar");};dhtmlXForm.prototype.setCalendarDateFormat=function(c,a,e){this.doWithItem(c,"setDateFormat",a,e);};dhtmlXForm.prototype.items.btn2state={setChecked:function(a,c){a._checked=c===true?true:false;a.childNodes[a._ll?1:0].lastChild.className="dhxform_img "+a._cssName+"_"+(a._checked?"1":"0");this.doCheckValue(a);},};(function(){for(var c in dhtmlXForm.prototype.items.checkbox){if(!dhtmlXForm.prototype.items.btn2state[c]){dhtmlXForm.prototype.items.btn2state[c]=dhtmlXForm.prototype.items.checkbox[c];}}})();dhtmlXForm.prototype.items.btn2state.render2=dhtmlXForm.prototype.items.btn2state.render;dhtmlXForm.prototype.items.btn2state.render=function(a,c){c._autoInputWidth=false;this.render2(a,c);a._type="btn2state";a._cssName=typeof c.cssName=="undefined"?"btn2state":c.cssName;a._updateImgNode=function(){};a._doOnFocus=function(){a.getForm().callEvent("onFocus",[a._idd]);};a._doOnBlur=function(){a.getForm().callEvent("onBlur",[a._idd]);};a._doOnKeyUpDown=function(g,e,h){this.callEvent(g,[this.childNodes[this._ll?0:1].childNodes[0],e,this._idd]);};this.setChecked(a,a._checked);return this;};dhtmlXForm.prototype.setFormData_btn2state=function(a,c){this[c==true||parseInt(c)==1||c=="true"||c==this.getItemValue(a)?"checkItem":"uncheckItem"](a);};dhtmlXForm.prototype.getFormData_btn2state=function(a){return this.isItemChecked(a)?this.getItemValue(a):0;};dhtmlXForm.prototype.items.colorpicker={colorpicker:{},render:function(e,g){var c=this;e._type="colorpicker";e._enabled=true;this.doAddLabel(e,g);this.doAddInput(e,g,"INPUT","TEXT",true,true,"dhxform_textarea");e._value=g.value||"";e.childNodes[e._ll?1:0].childNodes[0].value=e._value;var a={input:e.childNodes[e._ll?1:0].childNodes[0],custom_colors:window.dhx4.s2b(g.enableCustomColors)==true,skin:e.getForm().skin};this.colorpicker[e._idd]=new dhtmlXColorPicker(a);this.colorpicker[e._idd]._nodes[0].valueColor=null;this.colorpicker[e._idd].base.className+=" dhtmlxcp_in_form";if(typeof g.customColors!="undefined"){this.colorpicker[e._idd].setCustomColors(g.customColors);} +if(typeof g.cpPosition=="string"){this.colorpicker[e._idd].setPosition(g.cpPosition);} +this.colorpicker[e._idd].attachEvent("onSelect",function(h){if(e._value!=h){if(e.checkEvent("onBeforeChange")){if(e.callEvent("onBeforeChange",[e._idd,e._value,h])!==true){e.childNodes[e._ll?1:0].childNodes[0].value=e._value;return;}} +e._value=h;c.setValue(e,h);e.callEvent("onChange",[e._idd,e._value]);}});this.colorpicker[e._idd].attachEvent("onHide",function(h){var j=e.childNodes[e._ll?1:0].childNodes[0];if(j.value!=e._value){j.value=e._value;} +j=null;});e.childNodes[e._ll?1:0].childNodes[0]._idd=e._idd;return this;},getColorPicker:function(a){return this.colorpicker[a._idd];},destruct:function(a){if(this.colorpicker[a._idd].unload){this.colorpicker[a._idd].unload();} +this.colorpicker[a._idd]=null;try{delete this.colorpicker[a._idd];}catch(c){} +a.childNodes[a._ll?1:0].childNodes[0]._idd=null;this.d2(a);a=null;},setSkin:function(a,c){this.colorpicker[a._idd].setSkin(c);},};(function(){for(var c in{doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,enable:1,disable:1,isEnabled:1,setWidth:1,setReadonly:1,isReadonly:1,setValue:1,getValue:1,updateValue:1,setFocus:1,getInput:1,}){dhtmlXForm.prototype.items.colorpicker[c]=dhtmlXForm.prototype.items.input[c];}})();dhtmlXForm.prototype.items.colorpicker.d2=dhtmlXForm.prototype.items.input.destruct;dhtmlXForm.prototype.getColorPicker=function(a){return this.doWithItem(a,"getColorPicker");};dhtmlXForm.prototype.items.container={render:function(a,c){a._type="container";a._enabled=true;this.doAddLabel(a,c);this.doAddInput(a,c,"DIV",null,true,true,"dhxform_container");return this;},getContainer:function(a){return a.childNodes[a._ll?1:0].childNodes[0];},enable:function(a){a._enabled=true;if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"");} +a.callEvent("onEnable",[a._idd]);},disable:function(a){a._enabled=false;if(String(a.className).search("disabled")<0){a.className+=" disabled";} +a.callEvent("onDisable",[a._idd]);},doAttachEvents:function(){},setValue:function(){},getValue:function(){return null;},};dhtmlXForm.prototype.getContainer=function(a){return this.doWithItem(a,"getContainer");};(function(){for(var c in dhtmlXForm.prototype.items.input){if(!dhtmlXForm.prototype.items.container[c]){dhtmlXForm.prototype.items.container[c]=dhtmlXForm.prototype.items.input[c];}}})();dhtmlXForm.prototype.items.editor={editor:{},render:function(e,g){var a=!isNaN(g.rows);e._type="editor";e._enabled=true;e._editor_id=e.getForm().idPrefix+e._idd;this.doAddLabel(e,g);this.doAddInput(e,g,"DIV",null,true,true,"dhxform_item_template");e._value=g.value||"";var c=this;this.editor[e._editor_id]=new dhtmlXEditor({parent:e.childNodes[e._ll?1:0].childNodes[0],content:e._value,iconsPath:g.iconsPath,toolbar:g.toolbar});this.editor[e._editor_id].attachEvent("onAccess",function(j,l){e.callEvent("_onBeforeEditorAccess",[]);_dhxForm_doClick(document.body,"click");if(j=="blur"){c.doOnBlur(e,this);e.callEvent("onBlur",[e._idd]);if(e.getForm().skin=="dhx_terrace"){var h=e.childNodes[e._ll?1:0].className;if(h.indexOf("dhxeditor_focus")>=0){e.childNodes[e._ll?1:0].className=h.replace(/\s{0,}dhxeditor_focus/gi,"");}}}else{e.callEvent("onEditorAccess",[e._idd,j,l,this,e.getForm()]);e.callEvent("onFocus",[e._idd]);if(e.getForm().skin=="dhx_terrace"){var h=e.childNodes[e._ll?1:0].className;if(h.indexOf("dhxeditor_focus")==-1){e.childNodes[e._ll?1:0].className+=" dhxeditor_focus";}}}});this.editor[e._editor_id].attachEvent("onToolbarClick",function(h){e.callEvent("onEditorToolbarClick",[e._idd,h,this,e.getForm()]);});if(g.readonly){this.setReadonly(e,true);} +e.childNodes[e._ll?0:1].childNodes[0].removeAttribute("for");e.childNodes[e._ll?0:1].childNodes[0].onclick=function(){c.editor[e._editor_id]._focus();};return this;},doOnBlur:function(e,c){var a=c.getContent();if(e._value!=a){if(e.checkEvent("onBeforeChange")){if(e.callEvent("onBeforeChange",[e._idd,e._value,a])!==true){c.setContent(e._value);return;}} +e._value=a;e.callEvent("onChange",[e._idd,a]);}},setValue:function(a,c){if(a._value==c){return;} +a._value=c;this.editor[a._editor_id].setContent(a._value);},getValue:function(a){a._value=this.editor[a._editor_id].getContent();return a._value;},enable:function(a){if(this.isEnabled(a)!=true){this.editor[a._editor_id].setReadonly(false);this.doEn(a);}},disable:function(a){if(this.isEnabled(a)==true){this.editor[a._editor_id].setReadonly(true);this.doDis(a);}},setReadonly:function(a,c){this.editor[a._editor_id].setReadonly(c);},getEditor:function(a){return this.editor[a._editor_id]||null;},destruct:function(a){a.childNodes[a._ll?0:1].childNodes[0].onclick=null;this.editor[a._editor_id].unload();this.editor[a._editor_id]=null;this.d2(a);a=null;},setFocus:function(a){this.editor[a._editor_id]._focus();},};(function(){for(var c in{doAddLabel:1,doAddInput:1,doUnloadNestedLists:1,setText:1,getText:1,setWidth:1,isEnabled:1}){dhtmlXForm.prototype.items.editor[c]=dhtmlXForm.prototype.items.template[c];}})();dhtmlXForm.prototype.items.editor.d2=dhtmlXForm.prototype.items.select.destruct;dhtmlXForm.prototype.items.editor.doEn=dhtmlXForm.prototype.items.select.enable;dhtmlXForm.prototype.items.editor.doDis=dhtmlXForm.prototype.items.select.disable;dhtmlXForm.prototype.getEditor=function(a){return this.doWithItem(a,"getEditor");};dhtmlXForm.prototype.items.image={_dimFix:true,render:function(j,l){j._type="image";j._enabled=true;j._fr_name="dhxform_image_"+window.dhx4.newId();j._url=l.url;if(l.inputWidth=="auto"){l.inputWidth=120;} +if(l.inputHeight=="auto"){l.inputHeight=l.inputWidth;} +this.doAddLabel(j,l);this.doAddInput(j,l,"DIV",null,true,true,"dhxform_image");var c=j.childNodes[j._ll?1:0].childNodes[0];c.style.height=parseInt(c.style.height)-dhtmlXForm.prototype.items[this.t]._dim+"px";var a=typeof l.imageWidth!="undefined"?parseInt(l.imageWidth):l.inputWidth;var e=typeof l.imageHeight!="undefined"?parseInt(l.imageHeight):l.inputHeight;if(e=="auto"){e=a;} +j._dim={mw:l.inputWidth-this._dim,mh:l.inputHeight-this._dim,w:a,h:e};c.innerHTML="
";("
");this.adjustImage(j);c.childNodes[2].firstChild.lastChild.onchange=function(){j._is_uploading=true;this.parentNode.submit();this.parentNode.parentNode.className="dhxform_image_wrap dhxform_image_in_progress";};var g=this;if(window.navigator.userAgent.indexOf("MSIE")>=0){c.childNodes[1].onreadystatechange=function(){if(this.readyState=="complete"){g.doOnUpload(j);}};}else{c.childNodes[1].onload=function(){g.doOnUpload(j);};} +this._moreClear=function(){g=null;};this.setValue(j,l.value||"");c=null;return this;},destruct:function(c){var a=c.childNodes[c._ll?1:0].childNodes[0];a.childNodes[2].firstChild.lastChild.onchange=null;a.childNodes[1].onreadystatechange=null;a.childNodes[1].onload=null;this._moreClear();this.d2(c);c=null;},doAttachEvents:function(){},setValue:function(e,h){e._value=h==null?"":h;var c=e._url+ +(e._url.indexOf("?")>=0?"&":"?")+"action=loadImage&itemId="+ +encodeURIComponent(e._idd)+"&itemValue="+ +encodeURIComponent(e._value)+ +(window.dhx4.ajax.cache!=true?"&dhxr"+new Date().getTime()+"=1":"");var g=e.childNodes[e._ll?1:0].childNodes[0].firstChild;if(g.nextSibling.tagName.toLowerCase()=="img"){g.nextSibling.src=c;}else{var a=document.createElement("IMG");a.className="dhxform_image_img";a.style.visibility="hidden";a.onload=function(){this.style.visibility="visible";this.parentNode.removeChild(this.nextSibling);this.onload=this.onerror=null;};a.onerror=function(){this.onload.apply(this,arguments);this.style.visibility="hidden";};g.parentNode.insertBefore(a,g);a.src=c;a=null;this.adjustImage(e);} +g=null;},getValue:function(a){return a._value;},doOnUpload:function(e){if(e._is_uploading==true){var a=e.childNodes[e._ll?1:0].childNodes[0].lastChild.previousSibling;var c=dhx4.s2j(a.contentWindow.document.body.innerHTML);if(typeof c=="object"&&c!=null&&c.state==true&&c.itemId==e._idd){this.setValue(e,c.itemValue,true);e.getForm().callEvent("onImageUploadSuccess",[c.itemId,c.itemVaule,c.extra]);}else{e.getForm().callEvent("onImageUploadFail",[e._idd,c?c.extra:null]);} +c=a=null;window.setTimeout(function(){e.childNodes[e._ll?1:0].childNodes[0].lastChild.className="dhxform_image_wrap";e._is_uploading=false;},50);}},adjustImage:function(g){var c=g.childNodes[g._ll?1:0].childNodes[0].firstChild;var a=Math.min(g._dim.mw,g._dim.w);var e=Math.min(g._dim.mh,g._dim.h);c.style.width=a+"px";c.style.height=e+"px";c.style.marginLeft=Math.max(0,Math.round(g._dim.mw/2-a/2))+"px";c.style.marginTop=Math.max(0,Math.round(g._dim.mh/2-e/2))+"px";c=g=null;},};(function(){for(var c in dhtmlXForm.prototype.items.input){if(!dhtmlXForm.prototype.items.image[c]){dhtmlXForm.prototype.items.image[c]=dhtmlXForm.prototype.items.input[c];}}})();dhtmlXForm.prototype.items.image.d2=dhtmlXForm.prototype.items.input.destruct;dhtmlXForm.prototype.setFormData_image=function(a,c){this.setItemValue(a,c);};dhtmlXForm.prototype.getFormData_image=function(a){return this.getItemValue(a);};dhtmlXForm.prototype.items.upload={render:function(c,e){c._type="up";c._enabled=true;c._checked=true;c.className=e.position+(typeof e.className=="string"?" "+e.className:"");var a=document.createElement("DIV");c.appendChild(a);if(!isNaN(e.inputLeft)){c.style.left=parseInt(e.inputLeft)+"px";} +if(!isNaN(e.inputTop)){c.style.top=parseInt(e.inputTop)+"px";} +if(e.inputWidth!="auto"){if(!isNaN(e.inputWidth)){a.style.width=parseInt(e.inputWidth)+"px";}} +c._uploader=new dhtmlXFileUploader(a,e.swfPath||"",e.swfUrl||"",e.mode||null,e.swfLogs,e.slXap||"",e.slUrl||"",e.slLogs||"",e.multiple);c._uploader.setURL(e.url||"");c._uploader.callEvent=c.callEvent;if(typeof e.autoStart!="undefined"){c._uploader.setAutoStart(e.autoStart);} +if(typeof e.autoRemove!="undefined"){c._uploader.setAutoRemove(e.autoRemove);} +if(typeof e.titleScreen!="undefined"){c._uploader.enableTitleScreen(e.titleScreen);} +if(typeof e.titleText!="undefined"){c._uploader.setTitleText(e.titleText);} +if(e.hidden==true){this.hide(c);} +if(e.disabled==true){this.userDisable(c);} +if(!(e.inputHeight=="auto"||parseInt(e.inputHeight)==NaN)){c._uploader.p_files.style.height=parseInt(e.inputHeight)+"px";} +return this;},destruct:function(a){this.doUnloadNestedLists(a);a._uploader.callEvent=function(){return true;};a._uploader.unload();a._uploader.callEvent=null;a._uploader=null;a._checked=null;a._enabled=null;a._idd=null;a._type=null;a.onselectstart=null;a._autoCheck=null;a.callEvent=null;a.checkEvent=null;a.getForm=null;while(a.childNodes.length>0){a.removeChild(a.childNodes[0]);} +a.parentNode.removeChild(a);a=null;},setText:function(a,c){},getText:function(a){},enable:function(a){a._enabled=true;if(String(a.className).search("disabled")>=0){a.className=String(a.className).replace(/disabled/gi,"");} +a._uploader.enable();},disable:function(a){a._enabled=false;if(String(a.className).search("disabled")<0){a.className+=" disabled";} +a._uploader.disable();},setWidth:function(c,a){c.childNodes[0].style.width=a+"px";c._width=a;},getWidth:function(a){return a._width||parseInt(a.childNodes[0].style.width);},setValue:function(a){a._uploader.clear();},getValue:function(j){var g=j._uploader.getData();var h={};var e=0;for(var c in g){h[j._idd+"_r_"+e]=g[c].realName;h[j._idd+"_s_"+e]=g[c].serverName;e++;} +h[j._idd+"_count"]=e;return h;},getUploader:function(a){return a._uploader;},getStatus:function(a){return a._uploader.getStatus();},};(function(){for(var c in{doUnloadNestedLists:1,isEnabled:1}){dhtmlXForm.prototype.items.upload[c]=dhtmlXForm.prototype.items.checkbox[c];}})();dhtmlXForm.prototype.setFormData_upload=function(a){this.doWithItem(a,"setValue");};dhtmlXForm.prototype.getUploader=function(a){return this.doWithItem(a,"getUploader");};dhtmlXForm.prototype.getUploaderStatus=function(a){return this.doWithItem(a,"getStatus");};function dhtmlXFileUploader(c,m,l,n,s,j,v,h,w){var o=this;if(typeof n=="string"&&typeof this[n]=="function"){this.engine=n;}else{this.engine="html4";var g=null;if(typeof window.FormData!="undefined"&&typeof window.XMLHttpRequest!="undefined"){g=new XMLHttpRequest();if(typeof g.upload=="undefined"){g=null;}} +if(g!=null){this.engine="html5";}else{if(typeof window.swfobject!="undefined"||g===false){var g=swfobject.getFlashPlayerVersion();if(g.major>=10){this.engine="flash";}}else{this._sl_v=this.getSLVersion();if(this._sl_v){this.engine="sl";}}} +g=null;} +if(typeof c=="string"){c=document.getElementById(c);} +this._upload_mp=typeof w!="undefined"?w==true:true;this._upload_dnd=true;this._swf_file_url=m||"";this._swf_upolad_url=l||"";this._swf_logs=s;this._sl_xap=j;this._sl_upload_url=v;this._sl_logs=h;this.p=document.createElement("DIV");this.p.className+=" dhx_file_uploader";c.appendChild(this.p);this.p_files=document.createElement("DIV");this.p_files.className="dhx_upload_files";this.p.appendChild(this.p_files);this.p_controls=document.createElement("DIV");this.p_controls.className="dhx_upload_controls";this.p.appendChild(this.p_controls);this._files={};this._items={};this._data={};this._autoStart=false;this._autoRemove=false;this._titleScreen=true;this._enabled=true;this._uploaded_count=0;this._initToolbar=function(){this.b_opts={info:{onclick:null},browse:{onclick:null,tooltip:"Browse"},upload:{onclick:function(){if(!o._enabled){return;} +if(!o._uploading){o._uploadStart();}},tooltip:"Upload",},cancel:{onclick:function(){if(!o._enabled){return;} +o._uploadStop();o._switchButton(false);},tooltip:"Stop",},clear:{onclick:function(){if(!o._enabled){return;} +o.clear();},tooltip:"Clear list",},};this.buttons={};for(var e in this.b_opts){var x=document.createElement("DIV");x.innerHTML=" ";x.className="dhx_file_uploader_button button_"+e;x.onclick=this.b_opts[e].onclick;if(this.b_opts[e].tooltip){x.title=this.b_opts[e].tooltip;} +this.p_controls.appendChild(x);this.buttons[e]=x;x=null;} +this.buttons.cancel.style.display="none";};this._readableSize=function(x){var e=false;var a=["b","Kb","Mb","Gb","Tb","Pb","Eb"];for(var y=0;y1024){x=x/1024;}else{if(e===false){e=y;}}} +if(e===false){e=a.length-1;} +return Math.round(x*100)/100+" "+a[e];};this._beforeAddFileToList=function(a,e){return this.callEvent("onBeforeFileAdd",[a,e])===true;};this._addFileToList=function(C,e,y,A,a){this._checkTitleScreen();var x=document.createElement("DIV");x._idd=C;x.className="dhx_file dhx_file_"+A;x.innerHTML="
 
"+a+"%
 
";this.p_files.appendChild(x);x.childNodes[0].style.width=x.offsetWidth-127+"px";this._items[C]=x;this._updateFileNameSize(C);x.childNodes[2].onclick=function(){if(!o._enabled){return;} +var D=this.parentNode._idd;o._removeFileFromQueue(D);};this.callEvent("onFileAdd",[e]);};this._removeFileFromList=function(a){if(!this._items[a]){return;} +this._items[a].childNodes[2].onclick=null;this._items[a].parentNode.removeChild(this._items[a]);this._items[a]=null;delete this._items[a];if(this._data[a]){this._data[a]=null;delete this._data[a];} +this._checkTitleScreen();};this._updateFileNameSize=function(a){this._items[a].childNodes[0].innerHTML=this._files[a].name+(!isNaN(this._files[a].size)?" ("+this._readableSize(this._files[a].size)+")":" ");this._items[a].childNodes[0].title=this._files[a].name+(!isNaN(this._files[a].size)?" ("+this._readableSize(this._files[a].size)+")":"");};this._updateFileInList=function(x,e,a){if(!this._items[x]){return;} +this._items[x].className="dhx_file dhx_file_"+e;this._updateProgress(x,e,a);this._updateFileNameSize(x);};this._updateProgress=function(x,e,a){if(e=="uploading"&&a<100&&this._progress_type=="loader"){this._items[x].childNodes[1].className="dhx_file_param dhx_file_uploading";this._items[x].childNodes[1].innerHTML=" ";}else{this._items[x].childNodes[1].className="dhx_file_param dhx_file_progress";this._items[x].childNodes[1].innerHTML=a+"%";} +this._updateFileNameSize(x);};this._removeFilesByState=function(x){for(var e in this._files){if(x===true||this._files[e].state==x){this._removeFileFromQueue(e);}}};this._switchButton=function(e){if(e==true){this.buttons.upload.style.display="none";this.buttons.cancel.style.display="";}else{var a=this._uploaded_count;this.buttons.upload.style.display="";this.buttons.cancel.style.display="none";this._uploaded_count=0;if(a>0){this.callEvent("onUploadComplete",[a]);}}};this._uploadStart=function(){this._switchButton(true);if(!this._uploading){for(var e in this._files){if(this._files[e].state=="fail"){this._files[e].state="added";this._updateFileInList(e,"added",0);}}} +this._uploading=true;var x=false;for(var e in this._files){if(!x&&[this._files[e].state]=="added"){x=true;this._files[e].state="uploading";this._updateFileInList(e,"uploading",0);this._doUploadFile(e);}} +if(!x){this._uploading=false;this._switchButton(false);}};this._onUploadSuccess=function(A,y,x,a){if(typeof x!="undefined"&&this.engine=="flash"){var e=dhx4.s2j(x.data);if(e!=null&&e.state==true&&e.name!=null){y=e.name;if(e.extra!=null){a=e.extra;}}else{this._onUploadFail(A,e!=null&&e.extra!=null?e.extra:null);return;}} +this._uploaded_count++;this._data[A]={realName:this._files[A].name,serverName:y};this._files[A].state="uploaded";this._updateFileInList(A,"uploaded",100);this.callEvent("onUploadFile",[this._files[A].name,y,a]);if(this._autoRemove){this._removeFileFromQueue(A);} +if(this._uploading){this._uploadStart();}};this._onUploadFail=function(e,a){this._files[e].state="fail";this._updateFileInList(e,"fail",0);this.callEvent("onUploadFail",[this._files[e].name,a]);if(this._uploading){this._uploadStart();}};this._onUploadAbort=function(a){this._uploading=false;this._files[a].state="added";this._updateFileInList(a,"added",0);this.callEvent("onUploadCancel",[this._files[a].name]);};this._checkTitleScreen=function(){var x=0;for(var e in this._files){x++;} +if(x==0&&this.p.className.search("dhx_file_uploader_title")<0&&this._titleScreen){this.p.className+=" dhx_file_uploader_title";this.buttons.info.innerHTML=this._titleText;this.buttons.info.style.width=Math.max(this.p_controls.offsetWidth-134,0)+"px";} +if((x>0||!this._titleScreen)&&this.p.className.search("dhx_file_uploader_title")>=0){this.p.className=this.p.className.replace(/dhx_file_uploader_title/g,"");this.buttons.info.innerHTML="";}};this.callEvent=function(){};this.upload=function(){if(!this._uploading){this._uploadStart();}};this.setAutoStart=function(a){this._autoStart=a==true;};this.setAutoRemove=function(a){this._autoRemove=a==true;};this.enableTitleScreen=function(a){this._titleScreen=a==true;this._checkTitleScreen();};this.setTitleText=function(a){this._titleText=a;if(this.p.className.search("dhx_file_uploader_title")>=0){this.buttons.info.innerHTML=this._titleText;}};this.setURL=function(a){this._url=a;};this.setSWFURL=function(a){this._swf_upolad_url=a;};this.enable=function(){this._enabled=true;this.p_files.className="dhx_upload_files";this.p_controls.className="dhx_upload_controls";};this.disable=function(){this._enabled=false;this.p_files.className="dhx_upload_files dhx_uploader_dis";this.p_controls.className="dhx_upload_controls dhx_uploader_dis";};this.getStatus=function(){var x=0;for(var e in this._files){if(this._files[e].state!="uploaded"){return-1;} +x=1;} +return x;};this.getData=function(){return this._data;};this.clear=function(){if(this.callEvent("onBeforeClear",[])!==true){return;} +if(this._uploading){o._uploadStop();} +o._switchButton(false);o._removeFilesByState(true);this.callEvent("onClear",[]);};this.unload=function(){this._removeFilesByState(true);this._data=null;this._files=null;this._items=null;this._unloadEngine();for(var e in this.buttons){this.buttons[e].onclick=null;this.buttons[e].parentNode.removeChild(this.buttons[e]);this.buttons[e]=null;delete this.buttons[e];} +this.buttons=null;for(var e in this.b_opts){this.b_opts[e].onclick=null;this.b_opts[e]=null;delete this.b_opts[e];} +this.b_opts=null;this.p_controls.parentNode.removeChild(this.p_controls);this.p_files.parentNode.removeChild(this.p_files);this.p.className=this.p.className.replace(/dhx_file_uploader_title/gi,"").replace(/dhx_file_uploader/gi,"");for(var e in this){this[e]=null;} +o=e=null;};var r=new this[this.engine]();for(var u in r){this[u]=r[u];r[u]=null;} +u=r=c=null;this._initToolbar();this._initEngine();this._checkTitleScreen();return this;} +dhtmlXFileUploader.prototype.html5=function(){};dhtmlXFileUploader.prototype.html5.prototype={_initEngine:function(){var c=this;this.buttons.browse.onclick=function(){if(c._enabled){c.f.click();}};this._progress_type="percentage";var a=window.navigator.userAgent;if(a.match(/Windows/gi)!=null&&a.match(/AppleWebKit/gi)!=null&&a.match(/Safari/gi)!=null){if(a.match(/Version\/5\.1\.5/gi)){this._upload_mp=false;} +if(a.match(/Version\/5\.1[^\.\d{1,}]/gi)){this._upload_dnd=false;} +if(a.match(/Version\/5\.1\.1/gi)){this._upload_mp=false;this._upload_dnd=false;} +if(a.match(/Version\/5\.1\.2/gi)){this._upload_dnd=false;} +if(a.match(/Version\/5\.1\.7/gi)){this._upload_mp=false;}} +this._addFileInput();if(this._upload_dnd){this.p.ondragenter=function(g){if(!g.dataTransfer){return;} +g.stopPropagation();g.preventDefault();};this.p.ondragover=function(g){if(!g.dataTransfer){return;} +g.stopPropagation();g.preventDefault();};this.p.ondrop=function(g){if(!g.dataTransfer){return;} +g.stopPropagation();g.preventDefault();if(c._enabled){c._parseFilesInInput(g.dataTransfer.files);}};this._titleText="Drag-n-Drop files here or
click to select files for upload.";}else{this._titleText="Click to select files for upload.";}},_addFileInput:function(){if(this.f!=null){this.f.onchange=null;this.f.parentNode.removeChild(this.f);this.f=null;} +var a=this;this.f=document.createElement("INPUT");this.f.type="file";if(this._upload_mp){this.f.multiple="1";} +this.f.className="dhx_uploader_input";this.p_controls.appendChild(this.f);this.f.onchange=function(){a._parseFilesInInput(this.files);if(window.dhx4.isOpera){a._addFileInput();}else{this.value="";}};},_doUploadFile:function(e){var c=this;if(!this._loader){this._loader=new XMLHttpRequest();this._loader.upload.onprogress=function(g){if(c._files[this._idd].state=="uploading"){c._updateFileInList(this._idd,"uploading",Math.round((g.loaded*100)/g.total));}};this._loader.onload=function(h){var g=dhx4.s2j(this.responseText);if(typeof g=="object"&&g!=null&&typeof g.state!="undefined"&&g.state==true){c._onUploadSuccess(this.upload._idd,g.name,null,g.extra);g=null;}else{c._onUploadFail(this.upload._idd,g!=null&&g.extra!=null?g.extra:null);}};this._loader.onerror=function(g){c._onUploadFail(this.upload._idd);};this._loader.onabort=function(g){c._onUploadAbort(this.upload._idd);};} +this._loader.upload._idd=e;var a=new FormData();a.append("file",this._files[e].file);this._loader.open("POST",this._url+(String(this._url).indexOf("?")<0?"?":"&")+"mode=html5&dhxr"+new Date().getTime(),true);this._loader.setRequestHeader("X-Requested-With","XMLHttpRequest");this._loader.send(a);},_uploadStop:function(){if(!this._uploading||!this._loader){return;} +this._loader.abort();},_parseFilesInInput:function(c){for(var a=0;ato select files for upload.";},_addForm:function(){var a=this;var e=window.dhx4.newId();if(!this.k){this.k=document.createElement("DIV");this.k.className="dhx_file_form_cont";this.buttons.browse.appendChild(this.k);this.fr_name="dhx_file_"+window.dhx4.newId();this.k.innerHTML='';this.fr=this.k.firstChild;if(window.navigator.userAgent.indexOf("MSIE")>=0){this.fr.onreadystatechange=function(){if(this.readyState=="complete"){a._onLoad();}};}else{this.fr.onload=function(){a._onLoad();};}} +var c=document.createElement("DIV");c.innerHTML="
";this.k.appendChild(c);c.firstChild.lastChild._idd=e;c.firstChild.lastChild.onchange=function(){if(!a._beforeAddFileToList(this.value,null)){return;} +a._addFileToQueue(this);this.onchange=null;this.parentNode.parentNode.style.display="none";a._addForm();};c=null;},_onLoad:function(){if(this._uploading){var a=dhx4.s2j(this.fr.contentWindow.document.body.innerHTML);if(typeof a=="object"&&a!=null){if(typeof a.state!="undefined"){if(a.state=="cancelled"){this._onUploadAbort(this.fr._idd);a=null;return;}else{if(a.state==true){if(typeof a.size!="undefined"&&!isNaN(a.size)){this._files[this.fr._idd].size=a.size;} +this._onUploadSuccess(this.fr._idd,a.name,null,a.extra);a=null;return;}}}} +this._onUploadFail(this.fr._idd,a!=null&&a.extra!=null?a.extra:null);}},_addFileToQueue:function(c){var a=c.value.match(/[^\\\/]*$/g);if(a[0]!=null){a=a[0];}else{a=c.value;} +this._files[c._idd]={name:a,form:c.parentNode,node:c.parentNode.parentNode,input:c,state:"added"};this._addFileToList(c._idd,c.value,false,"added",0);if(this._autoStart&&!this._uploading){this._uploadStart(true);}},_removeFileFromQueue:function(e){var a=this._files[e].name;var c=this._data!=null&&this._data[e]!=null?this._data[e].serverName:null;if(this.callEvent("onBeforeFileRemove",[a,c])!==true){return;} +this._files[e].input.onchange=null;this._files[e].form.removeChild(this._files[e].input);this._files[e].node.removeChild(this._files[e].form);this._files[e].node.parentNode.removeChild(this._files[e].node);this._files[e].input=null;this._files[e].name=null;this._files[e].form=null;this._files[e].node=null;this._files[e].size=null;this._files[e].state=null;this._files[e]=null;delete this._files[e];this._removeFileFromList(e);this.callEvent("onFileRemove",[a,c]);},_doUploadFile:function(a){this.fr._idd=a;this._files[a].form.action=this._url;this._files[a].form.submit();},_uploadStop:function(){if(!this._uploading){return;} +this.fr.contentWindow.location.href=this._url+(this._url.indexOf("?")<0?"?":"&")+"mode=html4&action=cancel&dhxr"+new Date().getTime();},_unloadEngine:function(){if(this.k){this.fr_name=null;this.fr.onreadystatechange=null;this.fr.onload=null;this.fr.parentNode.removeChild(this.fr);this.fr=null;this.k.firstChild.firstChild.lastChild.onchange=null;this.k.parentNode.removeChild(this.k);this.k=null;} +this._initEngine=null;this._addForm=null;this._onLoad=null;this._addFileToQueue=null;this._removeFileFromQueue=null;this._doUploadFile=null;this._uploadStop=null;this._unloadEngine=null;},};dhtmlXFileUploader.prototype.flash=function(){};dhtmlXFileUploader.prototype.flash.prototype={_initEngine:function(){if(!window.dhtmlXSWFObjectsPull){window.dhtmlXSWFObjectsPull={items:{},callEvent:function(h,e,g){return window.dhtmlXSWFObjectsPull.items[h].uploader[e].apply(window.dhtmlXSWFObjectsPull.items[h].uploader,g);},};} +var c=this;this._swf_obj_id="dhtmlXFileUploaderSWFObject_"+window.dhx4.newId();this._swf_file_url=this._swf_file_url+(this._swf_file_url.indexOf("?")>=0?"&":"?")+"dhxr"+new Date().getTime();this.buttons.browse.innerHTML="
";swfobject.embedSWF(this._swf_file_url,this._swf_obj_id,"100%","100%","9",null,{ID:this._swf_obj_id,enableLogs:this._swf_logs},{wmode:"transparent"});var a=swfobject.getFlashPlayerVersion();this._titleText="Engine successfuly inited
Flash Player: "+a.major+"."+a.minor+"."+a.release;this._progress_type="percentage";window.dhtmlXSWFObjectsPull.items[this._swf_obj_id]={id:this._swf_obj_id,uploader:this};},_beforeAddFileToQueue:function(a,c){return this.callEvent("onBeforeFileAdd",[a,c])===true;},_addFileToQueue:function(g,c,e){if(window.dhx4.isIE){var a=document.createElement("INPUT");a.type="TEXT";a.style.position="absolute";a.style.left="0px";a.style.top=window.dhx4.absTop(this.buttons.browse)+"px";a.style.width="10px";document.body.appendChild(a);a.focus();document.body.removeChild(a);a=null;} +this._files[g]={name:c,size:e,state:"added"};this._addFileToList(g,c,e,"added",0);if(this._autoStart&&!this._uploading){this._uploadStart(true);}},_removeFileFromQueue:function(g){if(!this._files[g]){return;} +var c=this._files[g].name;var e=this._data!=null&&this._data[g]!=null?this._data[g].serverName:null;if(this.callEvent("onBeforeFileRemove",[c,e])!==true){return;} +var a=false;if(this._uploading&&this._files[g].state=="uploading"){this._uploadStop();a=true;} +swfobject.getObjectById(this._swf_obj_id).removeFileById(g);this._files[g].name=null;this._files[g].size=null;this._files[g].state=null;this._files[g]=null;delete this._files[g];this._removeFileFromList(g);this.callEvent("onFileRemove",[c,e]);if(a){this._uploadStart();}},_doUploadFile:function(a){swfobject.getObjectById(this._swf_obj_id).upload(a,this._swf_upolad_url);},_uploadStop:function(e){for(var c in this._files){if(this._files[c].state=="uploading"){swfobject.getObjectById(this._swf_obj_id).uploadStop(c);}}},_unloadEngine:function(){if(window.dhtmlXSWFObjectsPull.items[this._swf_obj_id]){window.dhtmlXSWFObjectsPull.items[this._swf_obj_id].id=null;window.dhtmlXSWFObjectsPull.items[this._swf_obj_id].uploader=null;window.dhtmlXSWFObjectsPull.items[this._swf_obj_id]=null;delete window.dhtmlXSWFObjectsPull.items[this._swf_obj_id];} +this._swf_obj_id=null;this._initEngine=null;this._addFileToQueue=null;this._removeFileFromQueue=null;this._doUploadFile=null;this._uploadStop=null;this._unloadEngine=null;},};dhtmlXFileUploader.prototype.sl=function(){};dhtmlXFileUploader.prototype.sl.prototype={_initEngine:function(){if(typeof this._sl_v=="undefined"){this._sl_v=this.getSLVersion();} +if(!window.dhtmlXFileUploaderSLObjects){window.dhtmlXFileUploaderSLObjects={items:{},callEvent:function(e,a,c){window.dhtmlXFileUploaderSLObjects.items[e].uploader[a].apply(window.dhtmlXFileUploaderSLObjects.items[e].uploader,c);},};} +this._sl_obj_id="dhtmlXFileUploaderSLObject_"+window.dhx4.newId();if(this._sl_v!=false){this._titleText="Engine successfuly inited
Silverlight version: "+this._sl_v[0]+"."+this._sl_v[1];this.buttons.browse.innerHTML='
';}else{this._titleText="Silverlight plugin not found
or version less than 4.0";this.buttons.browse.style.cursor="wait";this.buttons.browse.title="";} +this._progress_type="percentage";window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]={id:this._sl_obj_id,uploader:this};},_addFileToQueue:function(e,a,c){this._files[e]={name:a,size:c,state:"added"};this._addFileToList(e,a,c,"added",0);if(this._autoStart&&!this._uploading){this._uploadStart(true);}},_removeFileFromQueue:function(c){if(!this._files[c]){return;} +var a=false;if(this._uploading&&this._files[c].state=="uploading"){this._uploadStop();a=true;} +document.getElementById([this._sl_obj_id]).Content.a.removeFileById(c);this._files[c].name=null;this._files[c].size=null;this._files[c].state=null;this._files[c]=null;delete this._files[c];this._removeFileFromList(c);if(a){this._uploadStart();}},_doUploadFile:function(c){var a=this._sl_upload_url.split("?");a=a[1]!=null?"&"+a[1]:"";document.getElementById(this._sl_obj_id).Content.a.upload(c,this._sl_upload_url,a+"&mode=sl&dhxr"+new Date().getTime());},_uploadStop:function(e){this._uploading=false;for(var c in this._files){if(this._files[c].state=="uploading"){document.getElementById(this._sl_obj_id).Content.a.uploadStop(c);}}},_unloadEngine:function(){if(window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]){window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id].id=null;window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id].uploader=null;window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]=null;delete window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id];} +this._sl_obj_id=null;this._initEngine=null;this._addFileToQueue=null;this._removeFileFromQueue=null;this._doUploadFile=null;this._uploadStop=null;this._unloadEngine=null;},};dhtmlXFileUploader.prototype.setSLURL=function(a){this._sl_upload_url=a;};dhtmlXFileUploader.prototype.getSLVersion=function(){var a=false;if(window.dhx4.isIE){try{var c=new ActiveXObject("AgControl.AgControl");if(c!=null){var j=4,h=0;while(c.isVersionSupported([j,h].join("."))){a=[j,h];if(++h>9){j++;h=0;}}} +c=null;}catch(g){}}else{if(navigator.plugins["Silverlight Plug-In"]!=null){a=navigator.plugins["Silverlight Plug-In"].description.split(".");}} +return a;};dhtmlXForm.prototype.saveBackup=function(){if(!this._backup){this._backup={};this._backupId=new Date().getTime();} +this._backup[++this._backupId]=this.getFormData();return this._backupId;};dhtmlXForm.prototype.restoreBackup=function(a){if(this._backup!=null&&this._backup[a]!=null){this.setFormData(this._backup[a]);}};dhtmlXForm.prototype.clearBackup=function(a){if(this._backup!=null&&this._backup[a]!=null){this._backup[a]=null;delete this._backup[a];}};dhtmlXForm.prototype.addItem=function(e,a,j,g){var c=null;if(e instanceof Array){c=e[1];e=e[0];} +var h=null;if(e!=null){var h=this._getParentForm(e,c);if(h!=null){if(h.item._list==null){if(!a.listParent){a.listParent=h.item._idd;} +h.form._addItem("list",h.item._idd,[a],null,h.item._idd,j,g);}else{h.item._list[0].addItem(null,a,j,g);} +h.form=h.item=null;h=null;this._autoCheck();return;}} +this._prepareItem(a,j,g);this._autoCheck();};dhtmlXForm.prototype.removeItem=function(c,a){this._removeItem(c,a);};dhtmlXForm.prototype.removeColumn=function(l,j,g,e){var n=null;if(l instanceof Array){n=l[1];l=l[0];} +if(l!=null){var h=this._getParentForm(l,n);if(h!=null){if(h.item._list!=null&&h.item._list[0]!=null){h.item._list[0].removeColumn(null,j,g,e);} +h.form=h.item=null;h=null;} +return;} +j=Math.min(Math.max(j,0),this.cont.childNodes.length-1);if(this.cont.childNodes.length==1){if(g==true){this._removeItemsInColumn(this.cont.childNodes[j]);}}else{if(g==true){this._removeItemsInColumn(this.cont.childNodes[j]);}else{if(!e){var a=j-1;if(a<0){a=j+1;}}else{var a=j+1;if(a>this.cont.childNodes.length-1){a=j-1;}} +while(this.cont.childNodes[j].childNodes.length>0){this.cont.childNodes[a].appendChild(this.cont.childNodes[j].childNodes[0]);}} +var m=[];for(var c=0;cthis.cont.childNodes.length-1){return null;} +return this.cont.childNodes[c];};dhtmlXForm.prototype._removeItemsInColumn=function(g){var a=[];for(var e=0;e=0)){var a=document.createElement("SPAN");a.className="dhxform_item_required";a.innerHTML="*";l.appendChild(a);a=l=null;}}else{if(e._validate!=null){var c=e._validate;e._validate=[];for(var g=0;g=0){l.removeChild(l.lastChild);l=null;}} +this._resetValidateCss(e);e=null;};dhtmlXForm.prototype.setNote=function(h,e,a){if(typeof a=="undefined"){a=e;}else{h=[h,e];} +var c=this._getItemNode(h);if(!c){return;} +var g=this._getNoteNode(c);if(!g){if(!a.width){a.width=c.childNodes[c._ll?1:0].childNodes[0].offsetWidth;} +g=document.createElement("DIV");g.className="dhxform_note";if({ch:1,ra:1}[c._type]){c.childNodes[c._ll?1:0].insertBefore(g,c.childNodes[c._ll?1:0].lastChild);}else{c.childNodes[c._ll?1:0].appendChild(g);}} +g.innerHTML=a.text;if(a.width!=null){g.style.width=a.width+"px";g._w=a.width;} +g=null;};dhtmlXForm.prototype.clearNote=function(g,c){if(typeof c!="undefined"){g=[g,c];} +var a=this._getItemNode(g);if(!a){return;} +var e=this._getNoteNode(a);if(e!=null){e.parentNode.removeChild(e);e=null;}};dhtmlXForm.prototype._getNoteNode=function(a){var e=null;for(var c=0;c=0){e=a.childNodes[a._ll?1:0].childNodes[c];}} +a=null;return e;};dhtmlXForm.prototype.setValidation=function(j,g,h){if(typeof note=="undefined"){h=g;}else{j=[j,g];} +var c=this._getItemNode(j);if(!c){return;} +if(c._validate!=null){for(var e=0;e0){g.remove(0);} +g.length=0;g=null;if(typeof j=="string"){this.doWithItem(a,"doLoadOptsConnector",j);}else{if(j instanceof Array){this.doWithItem(a,"doLoadOpts",{options:j});}}} +if(c=="combo"){var l=this.getCombo(a);l.clearAll();l.setComboValue("");if(typeof j=="string"){this.doWithItem(a,"doLoadOptsConnector",j);}else{if(j instanceof Array){var e=null;for(var h=0;h=0){a=c.childNodes[e];}}} +if(a!=null){if(g==null||g.length==0){a.removeAttribute("title");}else{a.title=g;}} +a=null;};function dhtmlXAccordion(h,l){var g=this;var e=window.dhx4.transDetect();this.conf={skin:l||window.dhx4.skin||(typeof dhtmlx!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxacc")||"dhx_skyblue",css:"dhxacc",icons_path:"",multi_mode:false,last_opened:null,on_active_id:null,on_active_click:false,size_changed:true,def_height:90,total_count:0,hiden_count:0,cont_w:null,};this.conf.tr={prop:e.transProp,ev:e.transEv,height_open:"height 0.2s cubic-bezier(0.25,0.1,0.25,1)",height_close:"height 0.18s cubic-bezier(0.25,0.1,0.25,1)",op_open:"opacity 0.16s ease-in",op_close:"opacity 0.2s ease-out",op_v_open:"1",op_v_close:"0.4",dnd_top:"top 0.16s",};this.ofs={m:{},s:{},def:{m:{left:0,right:0,first:0,between:8},s:{left:0,right:0,first:0,between:-1,last:0}},base:{s:{},m:{}},skin:{dhx_web:{s:{between:3},m:{between:3}},dhx_terrace:{m:{between:12,left:0,right:0}}},};if(navigator.userAgent.indexOf("MSIE")>=0||navigator.userAgent.indexOf("Trident")>=0){this.conf.tr.height_open=this.conf.tr.height_close;}else{this.conf.tr.height_open=this.conf.tr.height_close;} +var j=null;if(typeof h=="object"&&!h.tagName){j={};for(var c in h){j[c]=h[c];h[c]=null;} +h=j.parent;j.parent=null;} +window.dhtmlXCellTop.apply(this,[h,h._ofs]);this._adjustCont();if(this.base._ofs!=null){for(var m in this.ofs.base){if(this.base._ofs[m]!=null){for(var c in this.base._ofs[m]){this.ofs.base[m][c]=this.base._ofs[m][c];}}}} +this._applyOffsets=function(){for(var u in this.ofs.def){var r=this.ofs.def[u];var s=this.ofs.skin[this.conf.skin]!=null&&this.ofs.skin[this.conf.skin][u]!=null?this.ofs.skin[this.conf.skin][u]:null;var o=this.base._ofs!=null?this.base._ofs[u]:null;for(var n in r){if(s!=null&&s[n]!=null){this.ofs[u][n]=s[n];}else{if(o!=null&&o[n]!=null){this.ofs[u][n]=o[n];}else{this.ofs[u][n]=r[n];}}}}};this._applyOffsets();this.t={};this.addItem=function(w,v,o,n,u){if(w==null){w="a"+window.dhx4.newId();} +while(this.t[w]!=null){w="a"+window.dhx4.newId();} +var a=new dhtmlXAccordionCell(w,this);a.conf.skin=this.conf.skin;a.setText(v);if(u!=null){a.setIcon(u);} +a.cell._accId=w;a.cell.childNodes[a.conf.idx.hdr].onselectstart=function(x){x=x||event;if(x.preventDefault){x.preventDefault();}else{x.returnValue=false;} +return false;};a.cell.childNodes[a.conf.idx.hdr].onclick=function(y){y=y||event;if(y.preventDefault){y.preventDefault();}else{y.returnValue=false;} +if(g._dnd!=null&&g._dnd.ofs==true){return;} +var x=y.target||y.srcElement;var A=null;while(x._accId!=this&&A==null){if(x._accId!=null){A=x._accId;}else{x=x.parentNode;}} +if(A!=null){g._hdrClick(A);}};this.t[w]={cell:a};this.conf.total_count++;if(this.conf.multi_mode){if(typeof o=="undefined"){o=true;} +this.cont.appendChild(a.cell);a.conf.opened=o==true;if(typeof n=="undefined"||n==null||n=="*"){if(n=="*"){a.conf.h_auto=true;} +n=this.conf.def_height;}else{n=Math.max(parseInt(n),30);} +a._setSize(this.ofs.m.left,0,this.conf.cont_w||this._getAvailItemWidth(),a.conf.opened?n:a._getHdrHeight());a.cell.style.marginTop=(a.cell==this.cont.firstChild?this.ofs.m.first:this.ofs.m.between)+"px";if(o!=true){a.conf.size.h=n;a._adjustCell();a.cell.className+=" dhx_cell_closed";} +this._adjustOpened();if(this._dnd!=null){this._dndAttachEvent(w);}}else{o=this.conf.last_opened==null?true:window.dhx4.s2b(o);var s=this._updateCellsHeight();if(this.conf.last_opened!=null){if(o){this._closeItem(this.conf.last_opened,false);}else{var r=this.t[this.conf.last_opened].cell;r._setSize(r.conf.size.x,r.conf.size.y,r.conf.size.w,s);r=null;}} +this.cont.appendChild(a.cell);a.conf.opened=o;a.cell.style.marginTop=String(a.cell==this.cont.firstChild?this.ofs.s.first:this.ofs.s.between)+"px";a._setSize(this.ofs.s.left,0,this.conf.cont_w||this._getAvailItemWidth(),o?s:a._getHdrHeight());if(o){this.conf.last_opened=w;}else{a.conf.size.h=s;a._adjustCell();a.cell.className+=" dhx_cell_closed";}} +a=null;return this.t[w].cell;};this.removeItem=function(a){if(!this.t[a]){return;} +if(this.conf.last_opened==a){this.conf.last_opened=null;} +if(this.conf.on_active_id==a){this.conf.on_active_id=null;} +if(this._dnd!=null){this._dndClearCell(a);} +this.conf.total_count--;if(!this.conf.multi_mode&&!this.t[a].cell.conf.visible){this.conf.hiden_count--;} +this.t[a].cell._unload();this.t[a].cell=null;this.t[a]=null;delete this.t[a];if(!this.conf.unloading){if(!this.conf.multi_mode){this._updateCellsMargin();} +this.setSizes();}};this.cells=function(a){return this.t[a].cell;};this.enableMultiMode=function(a,n){this.conf.multi_mode=true;if(!isNaN(n)){this.conf.def_height=n;} +if(a=="auto"||a=="scroll"){this.cont.style.overflowX="hidden";this.cont.style.overflowY=a;}else{this.cont.style.overflow="visible";}};this.forEachItem=function(o){for(var n in this.t){if(typeof o=="function"){o.apply(this,[this.t[n].cell]);}else{if(typeof o=="string"&&typeof window[o]=="function"){window[o].apply(this,[this.t[n].cell]);}}}};this._openItem=function(n,a){if(typeof a=="undefined"){a=true;} +if(this.t[n].cell.conf.opened==false){if(this.conf.multi_mode){this.t[n].cell._open(a);}else{if(this.conf.tr.prop==false){if(this.conf.last_opened!=null){this.t[this.conf.last_opened].cell._close(false);} +this.t[n].cell._open(false);this.conf.last_opened=n;}else{this.conf.on_active_id=n;this.t[n].cell._open(a);if(this.conf.last_opened!=null){this.t[this.conf.last_opened].cell._close(a);} +this.conf.last_opened=n;}}}};this._closeItem=function(n,a){if(typeof a=="undefined"){a=true;} +if(this.t[n].cell.conf.opened==true){this.t[n].cell._close(a);this.conf.last_opened=null;}};this._adjustOpened=function(){if(this.conf.multi_mode==true){if(this._openCache==null){var s=this._getDynData();for(var o in s){this.t[o].cell.conf.size.h=s[o];this.t[o].cell.cell.style.height=s[o]+"px";}}else{var u=false;for(var o in this._openCache){u=u||this._openCache[o];} +if(u==true){return;} +this._openCache=this._openId=null;} +var n=this._getAvailItemWidth();for(var o in this.t){var r=true;if(n==this.t[o].cell.conf.size.w&&(this._openMode=="close"||this.t[o].cell.conf.opened==false)){r=false;} +if(r){this.t[o].cell._setWidth(n);}} +this._openMode=null;}else{if(this.conf.last_opened!=null){var v=this.conf.last_opened;this.t[v].cell._setSize(this.t[v].cell.conf.size.x,this.t[v].cell.conf.size.y,this.t[v].cell.conf.size.w,this.t[v].cell.conf.size.h);}}};this._getDynData=function(C,A){if(typeof C=="undefined"||C==null){C={};} +if(typeof A=="undefined"||A==null){A={};} +var v={};var y=0;var u=0;var r=0;for(var n=0;n0){var s=this.cont.offsetHeight-u;var u=Math.floor(s/y);for(var D in v){if(v[D]==true){if(y>1){s-=u;}else{u=s;} +v[D]=u;y--;}}} +return v;};this.setSizes=function(){this._adjustCont();if(this.conf.multi_mode==true){this._adjustOpened();}else{this.conf.cont_w=null;var o=this._updateCellsHeight();for(var n in this.t){if(this.t[n].cell.conf.visible==true){this.t[n].cell._setSize(this.ofs.s.left,0,this.conf.cont_w||this._getAvailItemWidth(),this.t[n].cell.conf.opened?o:this.t[n].cell._getHdrHeight());if(this.t[n].cell.conf.opened!=true){this.t[n].cell.conf.size.h=o;this.t[n].cell._adjustCell();}}} +this.conf.size_changed=true;} +this.callEvent("_onSetSizes",[]);};this.setSkin=function(o){this._setBaseSkin(o);this.conf.skin=o;for(var n in this.t){this.t[n].cell.conf.cells_cont=null;this.t[n].cell.conf.skin=this.conf.skin;} +this._applyOffsets();this._updateCellsMargin();this.setSizes();};this.setIconsPath=function(a){this.conf.icons_path=a;};this._getAvailItemWidth=function(){var n=this.ofs[this.conf.multi_mode?"m":"s"];var a=Math.max(this.cont.clientWidth-n.left-n.right,10);this.conf.cont_w=a;n=null;return a;};this._updateCellsHeight=function(){if(this.conf.multi_mode==true){return;} +var o=this.conf.total_count-this.conf.hiden_count;var r=this.cont.offsetHeight-this.ofs.s.last;if(o==0){return r;} +var u=false;for(var s=0;s
";this.cell.insertBefore(a,this.cell.childNodes[this.conf.idx.cont]);a=null;this.conf.ofs_nodes.t._getHdrHeight="func";this.conf.hdr={visible:true};this.conf.idx_data.hdr="dhx_cell_hdr";this._updateIdx();};dhtmlXAccordionCell.prototype._getHdrHeight=function(){return this.cell.childNodes[this.conf.idx.hdr].offsetHeight;};dhtmlXAccordionCell.prototype.showHeader=function(){if(this.conf.hdr.visible==true){return;} +this.conf.hdr.visible=true;this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_hdr";this._adjustCont(this._idd);};dhtmlXAccordionCell.prototype.hideHeader=function(){if(this.conf.hdr.visible!=true){return;} +this.conf.hdr.visible=false;this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_hdr dhx_cell_hdr_hidden";this._adjustCont(this._idd);};dhtmlXAccordionCell.prototype.isHeaderVisible=function(){return this.conf.hdr.visible==true;};dhtmlXAccordionCell.prototype.setText=function(c){this.conf.text=c;var a=this.cell.childNodes[this.conf.idx.hdr];a.childNodes[a.firstChild.className=="dhx_cell_hdr_icon"?1:0].innerHTML=""+c+"";a=null;};dhtmlXAccordionCell.prototype.getText=function(){return this.conf.text;};dhtmlXAccordionCell.prototype.setIcon=function(e){var c=this.cell.childNodes[this.conf.idx.hdr];if(c.firstChild.className!="dhx_cell_hdr_icon"){c.firstChild.className+=" dhx_cell_hdr_icon";var a=document.createElement("IMG");a.className="dhx_cell_hdr_icon";c.insertBefore(a,c.firstChild);a=null;} +c.firstChild.src=this.acc.conf.icons_path+e;c=null;};dhtmlXAccordionCell.prototype.clearIcon=function(){var a=this.cell.childNodes[this.conf.idx.hdr];if(a.firstChild.className=="dhx_cell_hdr_icon"){a.removeChild(a.firstChild);a.firstChild.className=String(a.firstChild.className).replace(/\s{1,}dhx_cell_hdr_icon/gi,"");} +a=null;};dhtmlXAccordionCell.prototype._open=function(c){var h={};if(this.acc.conf.multi_mode){var g={};g[this._idd]=true;h=this.acc._getDynData(g);this.acc._openId=this._idd;this.acc._openCache={};this.acc._openMode="open";}else{h[this._idd]=this.conf.size.h;} +for(var e in h){if(this.acc._openCache!=null){this.acc._openCache[e]=true;} +var j=this.acc.t[e].cell;j.cell.className=String(j.cell.className).replace(/\s{1,}dhx_cell_closed/gi,"");j.conf.opened=true;j._trInitEv("open",c);j.conf.size.h=h[e];j.cell.style.height=j.conf.size.h+"px";j=null;} +if(this.conf.tr.prop==false){this.acc._openId=this.acc._openCache=this.acc._openMode=null;this._onActiveCall(true);}};dhtmlXAccordionCell.prototype._close=function(c){var g={};if(this.acc.conf.multi_mode){var h={};h[this._idd]=true;g=this.acc._getDynData(null,h);this.acc._openId=this._idd;this.acc._openCache={};this.acc._openMode="close";}else{g[this._idd]=this._getHdrHeight();} +for(var e in g){var j=this.acc.t[e].cell;if(this.acc._openCache!=null){this.acc._openCache[e]=true;} +if(e==this._idd){j.cell.className+=" dhx_cell_closed";j.conf.opened=false;j._trInitEv("close",c);}else{j.conf.size.h=g[e];j._adjustCell();j._trInitEv("open",c);} +j.cell.style.height=g[e]+"px";j=null;} +if(this.conf.tr.prop==false){this.acc._openId=this.acc._openCache=this.acc._openMode=null;this._onActiveCall(false);}};dhtmlXAccordionCell.prototype.isOpened=function(){return this.conf.opened==true;};dhtmlXAccordionCell.prototype._trInitEv=function(c,a){if(this.conf.tr.prop==false){return;} +this._trAttachEv();if(!this.cell._accObj){this.cell._accObj=this.acc;} +if(a){this.cell.style[this.conf.tr.prop]=this.conf.tr["height_"+c];} +this._cellSetOpacity(c,a);};dhtmlXAccordionCell.prototype._trAttachEv=function(){if(!this.conf.tr.ev_attached){this.cell._trProp=this.conf.tr.prop;this.cell.addEventListener(this.conf.tr.ev,this._trOnEnd,false);this.conf.tr.ev_attached=true;}};dhtmlXAccordionCell.prototype._trDetachEv=function(){if(this.conf.tr.ev_attached){this.cell.addEventListener(this.conf.tr.ev,this._trOnEnd,false);this.conf.tr.ev_attached=false;}};dhtmlXAccordionCell.prototype._trOnEnd=function(a){if(a.stopPropagation){a.stopPropagation();} +if(a.propertyName=="height"&&this._accObj!=null){this.style[this._trProp]="";if(this._accObj.conf.multi_mode){if(this._accObj._openCache!=null){this._accObj._openCache[this._accId]=false;} +this._accObj._adjustOpened();} +if(this._accObj.conf.on_active_click==true){if(this._accObj.conf.multi_mode){this._accObj._callMainEvent("onActive",[this._accId,this._accObj.t[this._accId].cell.conf.opened]);this._accObj.conf.on_active_click=false;}else{if(this._accObj.conf.on_active_id!=null){this._accObj._callMainEvent("onActive",[this._accObj.conf.on_active_id,true]);} +this._accObj.conf.on_active_id=null;this._accObj.conf.on_active_click=false;}} +this._accObj=null;}};dhtmlXAccordionCell.prototype._cellSetOpacity=function(g,c){for(var e in this.conf.idx){if({hdr:true,pr1:true,pr2:true,cover:true}[e]!=true){if(c){this.cell.childNodes[this.conf.idx[e]].style[this.conf.tr.prop]=this.conf.tr["op_"+g];} +this.cell.childNodes[this.conf.idx[e]].style.opacity=this.conf.tr["op_v_"+g];}}};dhtmlXAccordionCell.prototype._onActiveCall=function(a){if(this.acc.conf.on_active_click==false){return;} +if(this.acc.conf.multi_mode==true){this.acc._callMainEvent("onActive",[this._idd,this.conf.opened]);this.acc.conf.on_active_click=false;}else{if(a==true){this.acc._callMainEvent("onActive",[this._idd,true]);this.acc.conf.on_active_click=false;}}};dhtmlXAccordionCell.prototype.show=function(){if(this.conf.visible){return;} +if(this.conf.docked==false){this.dock();return;} +this.cell.style.display="";this.conf.visible=true;if(!this.acc.conf.multi_mode){this.acc.conf.hiden_count--;this.acc._updateCellsHeight();this.acc._updateCellsMargin();} +if(this.acc.conf.size_changed){this.acc.setSizes();this.acc.conf.size_changed=false;}else{this.acc._adjustOpened();}};dhtmlXAccordionCell.prototype.hide=function(){if(!this.conf.visible){return;} +if(!this.acc.conf.multi_mode&&this.conf.opened){this._close(false);this.acc.conf.last_opened=null;} +this.cell.style.display="none";this.conf.visible=false;if(!this.acc.conf.multi_mode){this.acc.conf.hiden_count++;this.acc._updateCellsHeight();this.acc._updateCellsMargin();} +this.acc._adjustOpened();};dhtmlXAccordionCell.prototype.isVisible=function(){return this.conf.visible==true;};dhtmlXAccordionCell.prototype.setHeight=function(a){if(!this.acc.conf.multi_mode){return;} +if(a=="*"){this.conf.h_auto=true;}else{this.conf.h_auto=false;this.conf.size.h=a;} +if(this.conf.opened){if(a!="*"){this.cell.style.height=a+"px";} +this.acc._adjustOpened();}};dhtmlXAccordionCell.prototype.moveOnTop=function(){if(this.cell.parentNode.firstChild==this.cell){return;} +this.cell.parentNode.insertBefore(this.cell,this.cell.parentNode.firstChild);this.acc._updateCellsMargin();};dhtmlXAccordionCell.prototype._initDocking=function(){var a=this;this.dock=function(){if(this.acc.dhxWins==null||this.conf.docked==true){return;} +var c=this.acc.dhxWins.window(this._idd);c.close();this._attachFromCell(c);this.conf.docked=true;this.show();if(this.conf.dock_opened){this.open();} +c=null;this.acc._callMainEvent("onDock",[this._idd]);};this.undock=function(c,l,g,j){if(this.acc.dhxWins==null||this.conf.docked==false){return;} +this.conf.dock_opened=this.conf.opened;if(this.acc.dhxWins.window(this._idd)!=null){var e=this.acc.dhxWins.window(this._idd);e.show();}else{if(c==null){c=20;} +if(l==null){l=20;} +if(g==null){g=320;} +if(j==null){j=200;} +var e=this.acc.dhxWins.createWindow(this._idd,c,l,g,j);e.button("close").hide();e.addUserButton("dock",99,"Dock");e.button("dock").show();e.button("dock").attachEvent("onClick",this._doOnDockClick);e.setText(this.getText());e.attachEvent("onClose",this._doOnDockWinClose);} +this.conf.docked=false;this.hide();e._attachFromCell(this);e=null;this.acc._callMainEvent("onUnDock",[this._idd]);};this._doOnDockClick=function(){a.dock();};this._doOnDockWinClose=function(c){c.hide();return false;};this._unloadDocking=function(){a=null;};};dhtmlXCellObject.prototype.attachAccordion=function(a){this.callEvent("_onBeforeContentAttach",["acc"]);var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";this._attachObject(c);if(typeof a=="undefined"){a={};} +if(typeof a.skin=="undefined"){a.skin=this.conf.skin;} +a.parent=c;if(typeof window.dhtmlXAccordionCell!="undefined"&&this instanceof window.dhtmlXAccordionCell){c._ofs={s:{first:-1},m:{first:4}};} +if(typeof window.dhtmlXTabBarCell!="undefined"&&this instanceof window.dhtmlXTabBarCell){if(this.conf.skin=="dhx_skyblue"){c._ofs={t:-1,r:-1,b:-1,l:-1};}} +if(typeof window.dhtmlXSideBarCell!="undefined"&&this instanceof window.dhtmlXSideBarCell){if(this.conf.skin=="dhx_web"){c._ofs={};if(this.sidebar.conf.autohide!=true){c._ofs.l=2;} +if(this.sidebar.conf.header==true){c._ofs.t=3;}}else{c._ofs={l:-1};if(this.conf.skin=="dhx_terrace"){if(this.sidebar.conf.autohide==true){c._ofs.l=0;} +if(this.sidebar.conf.header==true){c._ofs.t=-1;}}}} +if(typeof window.dhtmlXCarouselCell!="undefined"&&this instanceof window.dhtmlXCarouselCell){this._hideBorders();} +this.dataType="acc";this.dataObj=new dhtmlXAccordion(a);a.parent=null;c=a=null;this.callEvent("_onContentAttach",[]);return this.dataObj;};dhtmlXAccordion.prototype.enableDND=function(){if(this.conf.multi_mode==false||this._dnd!=null){return;} +var e=this;this._dnd={tr_count:0,tr_items:{}};this._dndAttachEvent=function(g){var a=this.t[g].cell;if(a.conf.dnd_inited!=true){if(typeof window.addEventListener=="function"){a.cell.childNodes[a.conf.idx.hdr].addEventListener("mousedown",this._dndOnMouseDown,false);}else{a.cell.childNodes[a.conf.idx.hdr].attachEvent("onmousedown",this._dndOnMouseDown);} +a.conf.dnd_inited=true;} +a=null;};this._dndDetachEvent=function(g){var a=this.t[g].cell;if(a.conf.dnd_inited==true){if(typeof window.addEventListener=="function"){a.cell.childNodes[a.conf.idx.hdr].removeEventListener("mousedown",this._dndOnMouseDown,false);}else{a.cell.childNodes[a.conf.idx.hdr].detachEvent("onmousedown",this._dndOnMouseDown);} +a.conf.dnd_inited=false;} +a=null;};this._dndOnMouseDown=function(g){g=g||event;if(g.preventDefault){g.preventDefault();} +var a=g.target||g.srcElement;while(a!=null&&a.parentNode!=e.cont){a=a.parentNode;} +if(a!=null){e._dndDragStart(g,a);} +a=null;};this._dndDragStart=function(l,h){if(this._dnd.tr_waiting==true){return;} +var a=-1;for(var j=0;j0){this._dnd.dragObj._k0+=this.ofs.m.between-this.ofs.m.first;} +g=0;}else{g+=this._dnd.dragObj.parentNode.childNodes[j].offsetHeight+parseInt(this._dnd.dragObj.parentNode.childNodes[j].style.marginTop);}} +this._dnd.dragObj._k1=g;this._dnd.h=this._dnd.dragObj.offsetHeight;this._dnd.ofs=false;};this._dndDoDrag=function(o){if(!this._dnd.dragObj){return;} +if(this._dnd.tr_waiting==true){return;} +var l=o.clientY-this._dnd.dy;if(this._dnd.ofs==false&&Math.abs(l)>5){this._dnd.dragObj.className+=" acc_cell_dragged";this._dnd.ofs=true;} +if(l<0){if(l<-this._dnd.dragObj._k0){l=-this._dnd.dragObj._k0;}}else{if(l>this._dnd.dragObj._k1){l=this._dnd.dragObj._k1;}} +this._dnd.dragObj.style.top=l+"px";var n=o.clientY-this._dnd.dy;var j=0;var g=0;for(var m=this._dnd.dragObj._ind+1;m<=this._dnd.dragObj.parentNode.lastChild._ind;m++){var a=this._dnd.dragObj.parentNode.childNodes[m].offsetHeight;if(n>j+(a*2)/3){g++;} +j+=a;} +var h=this._dnd.dragObj.nextSibling;var m=0;while(h!=null){if(++m<=g&&h!=null){if(!h._ontop){if(h._tm){window.clearTimeout(h._tm);} +this._dndAnim(h,false,parseInt(h.style.top||0),-this._dnd.h-this.ofs.m.between);h._ontop=true;}}else{if(h._ontop){if(h._tm){window.clearTimeout(h._tm);} +this._dndAnim(h,true,parseInt(h.style.top||0),0);h._ontop=false;}} +h=h.nextSibling;} +var n=this._dnd.dy-o.clientY;var j=0;var g=0;for(var m=this._dnd.dragObj._ind-1;m>=this._dnd.dragObj.parentNode.firstChild._ind;m--){var a=this._dnd.dragObj.parentNode.childNodes[m].offsetHeight;if(n>j+(a*2)/3){g++;} +j+=a;} +var h=this._dnd.dragObj.previousSibling;var m=0;while(h!=null){if(++m<=g&&h!=null){if(!h._onbottom){if(h._tm){window.clearTimeout(h._tm);} +this._dndAnim(h,true,parseInt(h.style.top||0),this._dnd.h+this.ofs.m.between);h._onbottom=true;}}else{if(h._onbottom){if(h._tm){window.clearTimeout(h._tm);} +this._dndAnim(h,false,parseInt(h.style.top),0);h._onbottom=false;}} +h=h.previousSibling;}};this._dndDragStop=function(n,l){if(l){}else{if(this._dnd.tr_count>0){this._dnd.tr_waiting=true;return;}} +if(!this._dnd.dragObj){return;} +this._dnd.dragObj.className=String(this._dnd.dragObj.className).replace(/\s{0,}acc_cell_dragged/gi,"");this._dnd.dragObj.style.top="0px";var m=false;for(var j=0;j=h){j=h;g=true;}}else{j-=5;if(j<=h){j=h;g=true;}} +l.style.top=j+"px";if(l._tm){window.clearTimeout(l._tm);} +if(!g){l._tm=window.setTimeout(function(){e._dndAnim(l,a,j,h);},5);}else{l._tm=null;}};this._dndOnTrEnd=function(a){if(a.stopPropagation){a.stopPropagation();} +if(a.propertyName=="top"){if(e._dnd.tr_items[this._accId]==true){e._dnd.tr_count--;e._dnd.tr_items[this._accId]=false;} +this.style[this._dnd_tr_prop]="";if(e._dnd.tr_count==0&&e._dnd.tr_waiting==true){e._dndDragStop(null,true);}}};this._dndOnMouseMove=function(a){e._dndDoDrag(a||event);};this._dndOnMouseUp=function(a){e._dndDragStop(a||event);};this._dndClearCell=function(a){if(this.t[a].cell.cell._dnd_ev){this.t[a].cell.cell.addEventListener(this.conf.tr.ev,this._dndOnTrEnd,false);} +this._dndDetachEvent(a);};this._unloadDND=function(){for(var g in this){if(String(g).indexOf("_dnd")==0&&typeof this[g]=="function"){this[g]=null;}} +this._dnd=null;e=null;};for(var c in this.t){this._dndAttachEvent(c);}};function dhtmlXLayoutObject(e,n,v){var s=null;if(e!=null&&typeof e=="object"&&typeof e.tagName=="undefined"&&e._isCell!=true){s={};if(e.autosize!=null){s.autosize=e.autosize;} +if(e.cells!=null){s.cells=e.cells;} +if(e.pattern!=null){n=e.pattern;} +if(e.skin!=null){v=e.skin;} +if(e.offsets!=null){s.offsets=e.offsets;} +e=e.parent;} +this.cdata={};this.conf={skin:v||window.dhx4.skin||(typeof dhtmlx!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxlayout")||"dhx_skyblue",css:"dhxlayout",hh:20,autosize:"b",nextCell:{a:"b",b:"a"},inited:false,b_size:{w:-1,h:-1},};if(typeof e=="object"&&e._isCell==true){var m=typeof s!="undefined"&&s!=null?s:{};if(m.pattern==null&&n!=null){m.pattern=n;} +if(m.skin==null&&v!=null){m.skin=v;} +var j=e.attachLayout(m);return j;} +window.dhtmlXCellTop.apply(this,[e,s==null?null:s.offsets]);this.conf.sw=this._detectSW();var l=this;this._getLayout=function(){return this;};this.mainInst=e._layoutMainInst!=null?e._layoutMainInst:null;this._getMainInst=function(){if(this.mainInst!=null){return this.mainInst._getMainInst();} +return this;};this._init=function(A){var y=typeof A=="string"?this.tplData[A]:A;this.conf.mode=y.mode;if(this.conf.mode=="c"){this.cdata.a=new dhtmlXLayoutCell("a",this);}else{this.cdata.a=new dhtmlXLayoutCell("a",this);this.cdata.b=new dhtmlXLayoutCell("b",this);} +for(var x in this.cdata){this.cont.appendChild(this.cdata[x].cell);this.cdata[x].conf.init={w:0.5,h:0.5};} +if(this.conf.mode!="c"){var w=this._getMainInst();if(w.conf.sep_idx==null){w.conf.sep_idx=1;}else{w.conf.sep_idx++;} +this.sep=new dhtmlXLayoutSepObject(this.conf.mode,w.conf.sep_idx);this.cont.appendChild(this.sep.sep);this.sep._getLayout=function(){return l._getLayout();};w=null;} +if(y.cells!=null){for(var x in y.cells){if(y.cells[x].width!=null){this.cdata[x].conf.init.w=y.cells[x].width;} +if(y.cells[x].height!=null){this.cdata[x].conf.init.h=y.cells[x].height;} +if(y.cells[x].name!=null){this.cdata[x].conf.name=y.cells[x].name;this.cdata[x].setText(y.cells[x].name);} +if(y.cells[x].fsize!=null){this.cdata[x].conf.fsize=y.cells[x].fsize;}}} +this.setSizes();for(var x in this.cdata){this.cdata[x].conf.init={};} +if(y.cells!=null){for(var x in y.cells){if(y.cells[x].layout!=null){this.cdata[x].dataNested=true;this.cdata[x]._layoutMainInst=this;this.cdata[x].attachLayout({pattern:y.cells[x].layout});this.cdata[x]._layoutMainInst=null;}}}};this.setSizes=function(F,N,J,y){var H=this.conf.inited==true&&this._getMainInst()==this&&this.checkEvent("onResizeFinish")==true?{}:false;this._adjustCont();var M=this.cont.offsetWidth;var D=this.cont.offsetHeight;if(this.conf.mode=="c"){var a=0;var O=0;var x=M;var L=D;this.cdata.a._setSize(a,O,x,L,F,J,y);this.callEvent("_onSetSizes",[]);if(H&&!(this.conf.b_size.w==M&&this.conf.b_size.h==D)){this._callMainEvent("onResizeFinish",[]);} +this.conf.b_size={w:M,h:D};return;} +if(typeof N=="undefined"){var A=this.conf.mode=="v"?"w":"h";N=this.conf.autosize;if(this.cdata.a.conf.collapsed){N="b";}else{if(this.cdata.b.conf.collapsed){N="a";}else{if(F=="a"||F=="b"){N=this.conf.nextCell[F];}}}}else{} +if(this.conf.mode=="v"){if(N=="a"){if(this.cdata.b.conf.init.w!=null){var K=Math.round(M*this.cdata.b.conf.init.w-this.conf.sw/2);}else{var K=this.cdata.b.conf.size.w;} +var I=M-K;var E=0;var C=D;var a=0;var O=E;var x=I-a-this.conf.sw;var L=C;}else{var a=0;var O=0;if(this.cdata.a.conf.init.w!=null){var x=Math.round(M*this.cdata.a.conf.init.w-this.conf.sw/2)-a;}else{var x=this.cdata.a.conf.size.w;} +var L=D-O;var I=a+x+this.conf.sw;var E=O;var K=M-I;var C=L;} +this.cdata.a._setSize(a,O,x,L,F,J,y);this.cdata.b._setSize(I,E,K,C,F,J,y);this.sep._setSize(a+x,O,this.conf.sw,L);}else{if(N=="a"){if(this.cdata.b.conf.init.h!=null){var C=Math.round(D*this.cdata.b.conf.init.h-this.conf.sw/2);}else{var C=this.cdata.b.conf.size.h;} +var I=0;var E=D-C;var K=M-I;var a=I;var O=0;var x=K;var L=E-O-this.conf.sw;}else{var a=0;var O=0;var x=M-a;if(this.cdata.a.conf.init.h!=null){var L=Math.round(D*this.cdata.a.conf.init.h-this.conf.sw/2);}else{var L=this.cdata.a.conf.size.h;} +var I=a;var E=O+L+this.conf.sw;var K=x;var C=D-E;} +this.cdata.a._setSize(a,O,x,L,F,J,y);this.cdata.b._setSize(I,E,K,C,F,J,y);this.sep._setSize(a,O+L,x,this.conf.sw);} +this.callEvent("_onSetSizes",[]);if(H&&!(this.conf.b_size.w==M&&this.conf.b_size.h==D)){this._callMainEvent("onResizeFinish",[]);} +this.conf.b_size={w:M,h:D};};this._getAvailWidth=function(){var A=[];for(var E=0;E0?Math.min.apply(window,A):0;return this.cont.offsetWidth-D;};this._getAvailHeight=function(){var A=[];for(var D=0;D=0&&navigator.userAgent.indexOf("Trident")>=0){this.conf.btn_left=1;} +this.sep=document.createElement("DIV");this.sep.className="dhxlayout_sep";if(window.dhx4.isIE==true){this.sep.onselectstart=function(){return false;};} +this.sep.className="dhxlayout_sep dhxlayout_sep_resize_"+this.conf.mode;this._setSize=function(g,m,j,l){this.sep.style.left=g+"px";this.sep.style.top=m+"px";this.sep.style.width=Math.max(j,0)+"px";this.sep.style.height=Math.max(l,0)+"px";};this._lockSep=function(g){this.conf.locked=g==true;this._blockSep();};this._setWH=function(g){var h=this._getLayout();h.conf.sw=g==null?h._detectSW():Math.max(parseInt(g)||-1,-1);h._getMainInst().setSizes();h=null;};this._blockSep=function(){var g=this._getLayout();var h=g.cdata.a.conf.collapsed||g.cdata.b.conf.collapsed||this.conf.locked;g=null;if(this.conf.blocked==h){return;} +this.sep.className="dhxlayout_sep"+(h?"":" dhxlayout_sep_resize_"+this.conf.mode);this.conf.blocked=h;};this._beforeResize=function(h){if(this.conf.blocked){return;} +if(this.conf.resize!=null&&this.conf.resize.active==true){return;} +if(h.type==window.dhx4.dnd.evs.start){this.sep.className+=" dhxlayout_sep_resize_actv";var l=h.pageX||h.touches[0].pageX;var j=h.pageY||h.touches[0].pageY;}else{if(h.button!==this.conf.btn_left){return;} +var l=h.clientX;var j=h.clientY;} +if(window.dhx4.dnd.p_en==true){window.dhx4.dnd._touchOff();} +var g=this._getLayout();this.conf.resize={sx:l,sy:j,tx:h.layerX,ty:h.layerY,sep_x:parseInt(this.sep.style.left),sep_y:parseInt(this.sep.style.top),min_wa:g.cdata.a._getAvailWidth("a"),min_wb:g.cdata.b._getAvailWidth("b"),min_ha:g.cdata.a._getAvailHeight("a"),min_hb:g.cdata.b._getAvailHeight("b"),};this.conf.resize.nx=this.conf.resize.sep_x;this.conf.resize.ny=this.conf.resize.sep_y;if(typeof window.addEventListener=="function"){window.addEventListener("mousemove",this._doOnMouseMove,false);window.addEventListener("mouseup",this._doOnMouseUp,false);window.addEventListener(window.dhx4.dnd.evs.move,this._doOnMouseMove,false);window.addEventListener(window.dhx4.dnd.evs.end,this._doOnMouseUp,false);}else{document.body.attachEvent("onmousemove",this._doOnMouseMove);document.body.attachEvent("onmouseup",this._doOnMouseUp);} +g=null;};this._onResize=function(j){if(!this.conf.resize.active){this._initResizeArea();this.conf.resize.active=true;} +if(this.conf.mode=="v"){var g=j.type=="mousemove"?j.clientX:j.pageX||j.touches[0].pageX;var h=this.conf.resize.sx-g;this.conf.resize.nx=this.conf.resize.sep_x-h;if(this.conf.resize.nx>this.conf.resize.sep_x+this.conf.resize.min_wb){this.conf.resize.nx=this.conf.resize.sep_x+this.conf.resize.min_wb;}else{if(this.conf.resize.nxthis.conf.resize.sep_y+this.conf.resize.min_hb){this.conf.resize.ny=this.conf.resize.sep_y+this.conf.resize.min_hb;}else{if(this.conf.resize.ny";this.cell.insertBefore(a,this.cell.childNodes[this.conf.idx.cont]);a=null;this.conf.ofs_nodes.t._getHdrHeight="func";this.conf.hdr={visible:true};this.conf.idx_data.hdr="dhx_cell_hdr";this._updateIdx();this.attachEvent("_onSetSize",this._hdrOnSetSize);this.attachEvent("_onBorderChange",this._hdrOnBorderChange);this.attachEvent("_onViewSave",this._hdrOnViewSave);this.attachEvent("_onViewRestore",this._hdrOnViewRestore);};dhtmlXLayoutCell.prototype.showHeader=function(a){if(this.conf.hdr.visible||this.conf.collapsed){return;} +if(this.conf.hdr.w_saved>this._getAvailWidth()||this.conf.hdr.h_saved>this._getAvailHeight()){return;} +this.conf.hdr.w_saved=this.conf.hdr.h_saved=null;this.conf.hdr.visible=true;this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_hdr";if(a!==true){this._adjustCont(this._idd);}};dhtmlXLayoutCell.prototype.hideHeader=function(a){if(!this.conf.hdr.visible||this.conf.collapsed){return;} +this.conf.hdr.w_saved=this._getMinWidth(this._idd);this.conf.hdr.h_saved=this._getMinHeight(this._idd);this.conf.hdr.visible=false;this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_hdr dhx_cell_hdr_hidden";this._hdrUpdBorder();this._mtbUpdBorder();if(a!==true){this._adjustCont(this._idd);}};dhtmlXLayoutCell.prototype.isHeaderVisible=function(){return this.conf.hdr.visible==true;};dhtmlXLayoutCell.prototype.showArrow=function(){this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display="";};dhtmlXLayoutCell.prototype.hideArrow=function(){this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display="none";};dhtmlXLayoutCell.prototype.isArrowVisible=function(){return this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display=="";};dhtmlXLayoutCell.prototype.setText=function(a){this.conf.hdr.text=a;this._hdrUpdText();};dhtmlXLayoutCell.prototype.getText=function(){return this.conf.hdr.text;};dhtmlXLayoutCell.prototype.setCollapsedText=function(a){this.conf.hdr.text_collapsed=a;this._hdrUpdText();};dhtmlXLayoutCell.prototype.getCollapsedText=function(){return this.conf.hdr.text_collapsed!=null?this.conf.hdr.text_collapsed:this.conf.hdr.text;};dhtmlXLayoutCell.prototype._hdrUpdText=function(){var a=this.conf.collapsed==true&&this.conf.hdr.text_collapsed!=null?this.conf.hdr.text_collapsed:this.conf.hdr.text;this.cell.childNodes[this.conf.idx.hdr].firstChild.innerHTML=""+a+"";};dhtmlXLayoutCell.prototype._hdrUpdBorder=function(){if(this.conf.borders==true){this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_hdr"+(this.conf.hdr.visible?"":" dhx_cell_hdr_hidden");}else{if(!this.conf.hdr.visible){this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_hdr dhx_cell_hdr_hidden_no_borders";}}};dhtmlXLayoutCell.prototype._hdrOnSetSize=function(){if(this.conf.collapsed&&this.conf.mode=="v"){this._fitHdr();}};dhtmlXLayoutCell.prototype._hdrOnBorderChange=function(){this.hideHeader(true);this._hdrUpdBorder();};dhtmlXLayoutCell.prototype._hdrOnViewSave=function(a){this.views[a].hdr_vis=this.conf.hdr.visible;};dhtmlXLayoutCell.prototype._hdrOnViewRestore=function(a){if(this.conf.hdr.visible!=this.views[a].hdr_vis){this[this.views[a].hdr_vis?"showHeader":"hideHeader"](true);} +this.views[a].hdr_vis=null;delete this.views[a].hdr_vis;};dhtmlXLayoutCell.prototype._getHdrHeight=function(a){if(this.conf.collapsed&&this.conf.mode=="v"&&a!==true){return 27;} +return this.cell.childNodes[this.conf.idx.hdr].offsetHeight;};dhtmlXLayoutCell.prototype._fitHdr=function(){if(this.conf.collapsed){if(typeof dhtmlXLayoutObject.prototype._confGlob.hdrColH=="undefined"){this.cell.childNodes[this.conf.idx.hdr].style.height=this.cell.offsetHeight+"px";dhtmlXLayoutObject.prototype._confGlob.hdrColH=parseInt(this.cell.childNodes[this.conf.idx.hdr].style.height)-this._getHdrHeight(true);} +this.cell.childNodes[this.conf.idx.hdr].style.height=this.cell.offsetHeight+dhtmlXLayoutObject.prototype._confGlob.hdrColH+"px";}else{this.cell.childNodes[this.conf.idx.hdr].style.height=null;}};dhtmlXLayoutCell.prototype.expand=function(l){if(!this.conf.collapsed){return true;} +var e=this.layout;if(this.conf.mode=="v"){var j=l?e.conf.hh:e.cdata[e.conf.nextCell[this._idd]]._getMinWidth(this._idd);var g=e.cont.offsetWidth-e.conf.sw;if(j+this.conf.size.w_avl>g){e=null;return false;}}else{var h=l?e.conf.hh:e.cdata[e.conf.nextCell[this._idd]]._getMinHeight(this._idd)+e.cdata[e.conf.nextCell[this._idd]]._getHdrHeight();var c=e.cont.offsetHeight-e.conf.sw;if(h+this.conf.size.h_avl>c){e=null;return false;}} +if(this.conf.docked==false){this.dock();return;} +this.cell.className=String(this.cell.className).replace(/\s{0,}dhxlayout_collapsed_[hv]/gi,"");this.conf.collapsed=false;if(this.conf.mode=="v"){this.conf.size.w=Math.min(g-j,this.conf.size.w_saved);this.conf.size.w_saved=this.conf.size.w_avl=null;}else{this.conf.size.h=Math.min(c-h,this.conf.size.h_saved);this.conf.size.h_saved=this.conf.size.h_avl=null;} +if(this.conf.mode=="v"){this._fitHdr();} +e.setSizes(e.conf.nextCell[this._idd],e.conf.nextCell[this._idd],l==true,"expand");e.sep._blockSep();e=null;this._hdrUpdText();var a=this.layout._getMainInst();a._callMainEvent("onExpand",[this.conf.name]);a=null;return true;};dhtmlXLayoutCell.prototype.collapse=function(){if(this.conf.collapsed){return false;} +var c=this.layout;if(c.cdata[c.conf.nextCell[this._idd]].expand(true)==false){return false;} +if(this.conf.mode=="v"){this.conf.size.w_saved=this.conf.size.w;this.conf.size.w_avl=this._getMinWidth(this._idd);}else{this.conf.size.h_saved=this.conf.size.h;this.conf.size.h_avl=this._getMinHeight(this._idd)+this._getHdrHeight();} +this.cell.className+=" dhxlayout_collapsed_"+this.conf.mode;this.conf.collapsed=true;if(this.conf.mode=="v"){this.conf.size.w=c.conf.hh;}else{this.conf.size.h=this._getHdrHeight();} +c.setSizes(c.conf.nextCell[this._idd],c.conf.nextCell[this._idd],false,"collapse");c.sep._blockSep();c=null;this._hdrUpdText();var a=this.layout._getMainInst();a._callMainEvent("onCollapse",[this.conf.name]);a=null;return true;};dhtmlXLayoutCell.prototype.isCollapsed=function(){return this.conf.collapsed==true;};dhtmlXLayoutCell.prototype.setMinWidth=function(a){this.conf.min_width=parseInt(a)||0;};dhtmlXLayoutCell.prototype.setMinHeight=function(a){this.conf.min_height=parseInt(a)||0;};dhtmlXLayoutCell.prototype._getMinWidth=function(c){if(this.dataType=="layout"&&this.dataObj!=null){if(this.layout._getMainInst()!=this.dataObj._getMainInst()){return this.dataObj._getAvailWidth();} +if(this.dataObj.conf.pattern=="1C"){return Math.max(this.conf.min_width,this.dataObj.cdata.a._getMinWidth(c));}else{if(this.dataObj.conf.mode=="v"){var a=c||this._idd;if(this.dataObj.cdata[a].conf.collapsed){a=this.dataObj.conf.nextCell[a];} +return Math.max(this.conf.min_width,this.dataObj.cdata[a]._getMinWidth(c)+this.dataObj.cdata[this.dataObj.conf.nextCell[a]]._getWidth()+this.dataObj.conf.sw);}else{return Math.max(this.conf.min_width,this.dataObj.cdata.a._getMinWidth(c),this.dataObj.cdata.b._getMinWidth(c));}}} +return Math.max(this.conf.min_width,1);};dhtmlXLayoutCell.prototype._getMinHeight=function(e){var c=0;if(this.conf.idx.menu!=null){c+=this.cell.childNodes[this.conf.idx.menu].offsetHeight;} +if(this.dataType=="layout"&&this.dataObj!=null){if(this.layout._getMainInst()!=this.dataObj._getMainInst()){return this.dataObj._getAvailHeight();} +if(this.dataObj.conf.pattern=="1C"){return Math.max(this.conf.min_height,this.dataObj.cdata.a._getMinHeight(e));}else{if(this.dataObj.conf.mode=="h"){var a=e;if(this.dataObj.cdata[a].conf.collapsed){a=this.dataObj.conf.nextCell[a];} +return Math.max(this.conf.min_height,this.dataObj.cdata[a]._getMinHeight(e)+this.dataObj.cdata[a]._getHdrHeight()+this.dataObj.cdata[this.dataObj.conf.nextCell[a]]._getHeight()+this.dataObj.conf.sw);}else{return Math.max(this.conf.min_height,this.dataObj.cdata.a._getMinHeight(e)+this.dataObj.cdata.a._getHdrHeight(),this.dataObj.cdata.b._getMinHeight(e)+this.dataObj.cdata.b._getHdrHeight());}}} +return Math.max(this.conf.min_height,c);};dhtmlXLayoutCell.prototype._getAvailWidth=function(e){if(this.dataType=="layout"&&this.dataObj!=null){if(this.dataObj.conf.pattern=="1C"){return this.dataObj.cdata.a._getAvailWidth(e);}else{if(this.dataObj.conf.mode=="v"){var a=this.dataObj.cdata.a.conf.collapsed==true;var c=this.dataObj.cdata.b.conf.collapsed==true;if(e=="a"){return this.dataObj.cdata[c?"a":"b"]._getAvailWidth(e);}else{return this.dataObj.cdata[a?"b":"a"]._getAvailWidth(e);}}else{return Math.min(this.dataObj.cdata.a._getAvailWidth(e),this.dataObj.cdata.b._getAvailWidth(e));}}} +return this.cell.offsetWidth-this._getMinWidth();};dhtmlXLayoutCell.prototype._getAvailHeight=function(g){if(this.dataType=="layout"&&this.dataObj!=null){if(this.dataObj.conf.pattern=="1C"){return this.dataObj.cdata.a._getAvailHeight(g);}else{if(this.dataObj.conf.mode=="h"){var c=this.dataObj.cdata.a.conf.collapsed==true;var e=this.dataObj.cdata.b.conf.collapsed==true;if(g=="a"){return this.dataObj.cdata[e?"a":"b"]._getAvailHeight(g);}else{return this.dataObj.cdata[c?"b":"a"]._getAvailHeight(g);}}else{return Math.min(this.dataObj.cdata.a._getAvailHeight(g),this.dataObj.cdata.b._getAvailHeight(g));}}} +var a=this._getHdrHeight();if(this.conf.mode=="v"&&this.conf.collapsed){a=this.conf.hh;} +return this.cell.offsetHeight-a-this._getMinHeight();};dhtmlXLayoutCell.prototype.setWidth=function(g){if(this.conf.mode=="v"){if(this.conf.collapsed){return;} +var h=this.layout;var j=h.cdata[h.conf.nextCell[this._idd]];if(j.conf.collapsed){g=g+h.conf.sw+j._getWidth();l=h=j=null;return;} +var e=this._getMinWidth(this._idd);var m=h.cont.offsetWidth-j._getMinWidth(this._idd)-h.conf.sw;g=Math.max(e,Math.min(g,m));this.conf.size.w=g;h.setSizes(j._idd,j._idd);h=j=null;}else{if(this.layout==null||this.layout.parentLayout==null){return;} +var l=this.layout.parentLayout;var h=this.layout;var j=h.cdata[h.conf.nextCell[this._idd]];for(var c in l.cdata){if(l.cdata[c].dataObj==h){l.cdata[c].setWidth(g);}} +l=h=null;}};dhtmlXLayoutCell.prototype.setHeight=function(m){if(this.conf.mode=="h"){if(this.conf.collapsed){return;} +var g=this.layout;var l=g.cdata[g.conf.nextCell[this._idd]];if(l.conf.collapsed){m=m+g.conf.sw+l._getHeight();var n=this.layout!=null&&this.layout.parentLayout!=null?this.layout.parentLayout:null;if(n!=null){for(var c in n.cdata){if(n.cdata[c].dataObj==g){n.cdata[c].setHeight(m);}}} +n=g=l=null;return;} +var j=this._getMinHeight(this._idd)+this._getHdrHeight();var e=g.cont.offsetHeight-l._getMinHeight(this._idd)-l._getHdrHeight()-g.conf.sw;m=Math.max(j,Math.min(m,e));this.conf.size.h=m;g.setSizes(l._idd,l._idd);g=l=null;}else{if(this.layout==null||this.layout.parentLayout==null){return;} +var n=this.layout.parentLayout;var g=this.layout;var l=g.cdata[g.conf.nextCell[this._idd]];for(var c in n.cdata){if(n.cdata[c].dataObj==g){n.cdata[c].setHeight(m);}} +n=g=null;}};dhtmlXLayoutCell.prototype.getWidth=function(){return this.conf.size.w;};dhtmlXLayoutCell.prototype.getHeight=function(){return this.conf.size.h;};dhtmlXLayoutCell.prototype.fixSize=function(c,g){this.conf.fixed.w=window.dhx4.s2b(c);this.conf.fixed.h=window.dhx4.s2b(g);var a=this.layout._getMainInst();var e={};a.forEachItem(function(h){if(h.conf.fsize!=null){var n=h.getId();var m={h:h.conf.fixed.w==true,v:h.conf.fixed.h==true};for(var j in m){if(m[j]==true&&h.conf.fsize[j]!=null){if(!(h.conf.fsize[j]instanceof Array)){h.conf.fsize[j]=[h.conf.fsize[j]];} +for(var l=0;l=0&&(c.indexOf("5.1.7")>=0||(c.match(/7[\.\d]* mobile/gi)!=null&&c.match(/AppleWebKit/gi)!=null))){this.conf.tabsContCss=" safari_517_fix";} +var j;if(g!=null&&typeof g=="object"&&typeof g.tagName=="undefined"){j=g.parent;if(typeof g.skin!="undefined"){this.conf.skin=g.skin;} +if(typeof g.mode!="undefined"){this.conf.tabsMode=g.mode=="bottom"?"bottom":"top";} +if(typeof g.align!="undefined"){this.conf.align=g.align=="right"?"right":"left";} +if(typeof g.close_button!="undefined"){this.conf.closeButton=window.dhx4.s2b(g.close_button);} +if(typeof g.content_zone!="undefined"){this.conf.contZone=window.dhx4.s2b(g.content_zone);} +if(typeof g.xml!="undefined"){this.conf.autoload.xml=g.xml;} +if(typeof g.json!="undefined"){this.conf.autoload.xml=g.json;} +if(typeof g.tabs!="undefined"){this.conf.autoload.tabs=g.tabs;} +if(typeof g.onload!="undefined"){this.conf.autoload.tabs=g.tabs;} +if(typeof g.arrows_mode!="undefined"){this.conf.autoload.arrows_mode=g.arrows_mode;}}else{j=g;} +window.dhtmlXCellTop.apply(this,[j,g.offsets]);if(this.base._ofs!=null&&this.base._ofs.t!=null){this.conf.tabsTop=this.base._ofs.t;} +this.tabsMode=document.createElement("DIV");this.tabsMode.className="dhxtabbar_tabs_"+this.conf.tabsMode;this.cont.appendChild(this.tabsMode);this.tabsArea=document.createElement("DIV");this.tabsArea.className="dhxtabbar_tabs dhxtabbar_tabs_"+this.conf.tabsMode;this.tabsArea.innerHTML="
";this.tabsArea.style.top=this.conf.tabsMode=="top"?this.conf.tabsTop+"px":"auto";this.tabsMode.appendChild(this.tabsArea);this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]="0px";this.tabsArea.childNodes[0].onclick=function(){if(h.conf.align=="left"){h._moveTabs(1);}else{h._moveTabs(-1);}};this.tabsArea.childNodes[2].onclick=function(){if(h.conf.align=="left"){h._moveTabs(-1);}else{h._moveTabs(1);}};this._onTabsAreaClick=function(a){return this._callMainEvent("onTabClose",[a]);};this.tabsArea.onclick=function(m){m=m||event;var a=m.target||m.srcElement;while(a!=null){if(typeof a._tabCloseId!="undefined"){if(h._onTabsAreaClick(a._tabCloseId)!==true){return;} +h.t[a._tabCloseId].conf.remove=true;h._hideTab(a._tabCloseId);a=null;}else{if(typeof a._tabId!="undefined"){h._doOnClick(a._tabId);a=null;}} +if(a!=null){a=a.parentNode;if(a==this){a=null;}}}};this.tabsArea.onselectstart=function(a){a=a||event;if(a.preventDefault){a.preventDefault();}else{a.returnValue=false;}};this._doOnClick=function(a){this.callEvent("onTabClick",[a,this.conf.lastActive]);if(this.t[a].conf.enabled){this._setTabActive(a);}};this.t={};this.addTab=function(a,v,n,s,r,w){if(typeof w!="boolean"){w=this.conf.closeButton==true;} +r=window.dhx4.s2b(r);var o=document.createElement("DIV");o.className="dhxtabbar_tab";o.innerHTML="
"+v+"
"+(w?"
":"");o._tabId=a;if(w){o.childNodes[1]._tabCloseId=a;} +var m=this.tabsArea.childNodes[1].firstChild;if(s!=null&&s+1>0&&s+1s.offsetWidth){n={d:-1,id:u};}}} +a+=m;}} +if(n!=null){this._moveTabs(n.d,n.id);}else{if(s.offsetWidth>a+1){s.childNodes[0].style[this.conf.align]=Math.min(0,parseInt(s.childNodes[0].style[this.conf.align])+(s.offsetWidth-a))+"px";}} +s=n=null;};this._moveTabs=function(w,o){var n=this.tabsArea.childNodes[1].childNodes[0];var u=0;var y=[];var C=null;for(var a=0;a=0&&A+y[a].w>0){v=y[a];} +if(A0){if(v==null){if(y.length>0){D=y[y.length-1];}}else{if(v.ind>0&&y.length>=v.ind){D=y[v.ind-1];}}}else{if(r==null){if(y.length>0){D=y[0];}}else{if(y.length>r.ind){D=y[r.ind+1];}}}} +if(D!=null){if(w>0){if(A=this.t[m].conf.width){this.t[m].tab.style.visibility="visible";}}else{this.t[m].conf.visible=true;this.t[m].tab.style.display="";if(a||this.t[m].conf.active){this.t[m].conf.active=false;this._setTabActive(m);}else{this._adjustTabs();}}};this._hideTab=function(s,a){if(this.t[s]==null){return;} +if(this.t[s].conf.transActv==true){if(this.t[s].conf.transMode=="hide"){return;}}else{if(this.t[s].conf.visible!=true){return;}} +var m=false;if(this.conf.lastActive==s){this.conf.lastActive=null;this.t[s].conf.active=false;this.t[s].tab.className=this._tabCss(s);m=true;} +var o=this._getPrevVisible(s);var n=this._getNextVisible(s);var r=m&&a!==false?(a==true?null:a)||n||o:null;if(this.conf.transProp!==false){this.t[s].conf.transActv=true;this.t[s].conf.transMode="hide";this.t[s].conf.transProp=this.conf.transProp;this.t[s].conf.transActvId=r;this.t[s].conf.visible=false;if(!this.t[s].conf.transEv){this.t[s].tab.addEventListener(this.conf.transEv,this._doOnTrEnd,false);this.t[s].conf.transEv=true;} +this.t[s].tab.style.visibility="hidden";this.t[s].tab.className=h._tabCss(s);this.t[s].tab.style[this.conf.transProp]=this.conf.transValueWidth;this.t[s].tab.style.width="0px";}else{this.t[s].tab.style.display="none";this.t[s].conf.visible=false;if(this.conf.contZone){this.t[s].cell.cell.style.visibility="hidden";this.t[s].cell.cell.style.top="-5000px";} +if(r!=null){this._setTabActive(r);} +this._adjustTabs();if(this.t[s].conf.remove){this._removeTab(s);}}};this._isTabVisible=function(a){return this.t[a].conf.visible==true;};this._doOnTrEnd=function(){var n=this._tabId;if(h.t[n]==null){return;} +var a=h.t[n];var m=a.conf.transActvId;if(a.conf.transMode=="hide"){if(a.conf.remove){h._removeTab(n);}else{a.tab.style[a.conf.transProp]="";if(h.conf.contZone){a.cell.cell.style.visibility="hidden";a.cell.cell.style.top="-5000px";} +a.conf.transActv=false;}}else{if(a.conf.transMode=="show"){a.tab.style[a.conf.transProp]="";a.tab.style.visibility="visible";a.conf.transMode=null;a.conf.transActv=false;}} +if(m!=null){h._setTabActive(m);}else{h._adjustTabs();} +a=null;};this.enableTabCloseButton=function(a){this.conf.closeButton=window.dhx4.s2b(a);};this.unload=function(){this.conf.unloading=true;this.clearAll();this.t=null;if(this.tabsTextTest!=null){if(this.tabsTextTest.parentNode){this.tabsTextTest.parentNode.removeChild(this.tabsTextTest);} +this.tabsTextTest=null;} +window.dhx4._enableDataLoading(this,null,null,null,"clear");this.tabsArea.childNodes[0].onclick=null;this.tabsArea.childNodes[2].onclick=null;this.tabsArea.onclick=null;this.tabsArea.onselectstart=null;this.tabsArea.parentNode.removeChild(this.tabsArea);this.tabsArea=null;this.tabsMode.parentNode.removeChild(this.tabsMode);this.tabsMode=null;this._unloadTop();window.dhx4._eventable(this,"clear");for(var m in this){this[m]=null;} +h=null;};this.enableContentZone=function(a){this.conf.contZone=a==true;};this.setSkin=function(n){this._setBaseSkin(n);this.conf.skin=n;if(this.tabsTextTest!=null){this.tabsTextTest.className="dhxtabbar_tabs_text_test_"+this.conf.skin;} +for(var m in this.t){this.t[m].cell._resetSizeState();if(this.t[m].conf.autowidth==true){this.t[m].conf.width=this._getLabelWidth(this.t[m].conf.text,this.t[m].conf.close);if(this.t[m].conf.visible){this.t[m].tab.style.width=this.t[m].conf.width+"px";}}} +this.conf.tabsAreaOfs=null;this._fixTabsOfs();this.setSizes();};this.setAlign=function(a){a=a=="left"?"left":"right";if(a==this.conf.align){this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]="0px";return;} +if(this.conf.transProp!==false){this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp]="";} +this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]="";this.conf.align=a;this.tabsArea.childNodes[1].childNodes[0].className="dhxtabbar_tabs_cont_"+this.conf.align+this.conf.tabsContCss;this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]="0px";if(this.conf.transProp!==false){this.conf.transValuePos=this.conf.align+" "+this.conf.transSpeed;this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp]=this.conf.transValuePos;}};this._initObj=function(o){this.conf.initSeq=true;this.clearAll();var a=false;if(o.settings!=null){if(o.settings.skin!=null){this.setSkin(o.settings.skin);} +if(o.settings.closeButton!=null){this.enableTabCloseButton(window.dhx4.s2b(o.settings.closeButton));} +if(o.settings.align!=null){this.setAlign(o.settings.align);} +if(o.settings.hrefmode=="ajax"){a=true;} +if(o.settings.hrefmode=="ajax-html"){a=true;this.conf.url_demand=true;}} +if(o.tabs!=null){for(var n=0;n=c.childNodes.length){c.appendChild(this.t[e].tab);}else{c.insertBefore(this.t[e].tab,c.childNodes[a]);}} +c=null;};dhtmlXTabBar.prototype._getIndex=function(g){var a=-1;var e=this.tabsArea.childNodes[1].firstChild;for(var c=1;cthis.cont.offsetWidth){if(c.className.search(/dhxtabbar_tabs_ar_hidden/)>=0){c.className=c.className.replace(/\s{0,}dhxtabbar_tabs_ar_hidden/,"");j.className=j.className.replace(/\s{0,}dhxtabbar_tabs_ar_hidden/,"");h=true;}}else{if(c.className.search(/dhxtabbar_tabs_ar_hidden/)<1){c.className+=" dhxtabbar_tabs_ar_hidden";j.className+=" dhxtabbar_tabs_ar_hidden";h=true;}} +c=j=null;} +return h;};dhtmlXTabBar.prototype._loadURLOnDemand=function(a){if(a!=null&&this.conf.urls[a]!=null){this.cells(a).attachURL(this.conf.urls[a].href,this.conf.urls[a].ajax);this.conf.urls[a]=null;}};window.dhtmlXTabBarCell=function(g,e){dhtmlXCellObject.apply(this,[g,"_tabbar"]);this.tabbar=e;this.conf.skin=this.tabbar.conf.skin;this.conf.tabbar_funcs={show:"_showTab",hide:"_hideTab",isVisible:"_isTabVisible",enable:"_enableTab",disable:"_disableTab",isEnabled:"_isTabEnabled",getIndex:"_getIndex",getText:"_getTabText",setText:"_setTabText",setActive:"_setTabActive",isActive:"_isTabActive",close:"_removeTab",};this._tabbarCall=function(a){return function(){var h=[this._idd];for(var j=0;j0){h=0;} +this.side.firstChild.style.top=h+"px";};if(typeof window.addEventListener=="function"){this.side.addEventListener("wheel",this._doOnSideScroll,false);}else{this.side.attachEvent("onmousewheel",this._doOnSideScroll);} +this.t={};this.s={};this._adjustCell=function(o,m){if(this.conf.single_cell!=true&&o==null){return;} +var g=this.conf.autohide==true?0:this.conf.width;var j=this.cont.offsetWidth-g;var n=0;var l=this.cont.offsetHeight;if(this.conf.single_cell==true){if(m==true){this.conf.cell._setSize(g,n,j,l);}}else{if(o!=this.conf.selected){n=-5000;this.t[o].cell.cell.style.visibility="hidden";this.t[o].cell.cell.style.zIndex=0;} +this.t[o].cell._setSize(g,n,j,l);}};var a=window.dhx4.transDetect();this.conf.transProp=a.transProp;this.conf.transEv=a.transEv;this.conf.transValue="all 0.1s";this._doOnTrEnd=function(h){var l=this._idd;if(e.t[l]==null){return;} +var g=e.t[l];var j=g.conf.transActvId;if(g.conf.transMode=="hide"){if(g.conf.remove==true){e._removeItem(l);}else{g.item.style[g.conf.transProp]="";if(e.conf.single_cell!=true){g.cell.cell.style.visibility="hidden";g.cell.cell.style.top="-5000px";} +g.conf.transActv=false;}}else{if(g.conf.transMode=="show"){g.item.style[g.conf.transProp]="";g.item.style.visibility="visible";g.conf.transMode=null;g.conf.transActv=false;}} +if(j!=null){e._setItemActive(j);}else{e._checkHeight();} +g=null;};this._initObj=function(g){this.clearAll();if(g.items!=null){this.addItem(g.items);}};this._xmlToObj=function(o){var h=[];var m=o.getElementsByTagName("sidebar");if(m!=null&&m[0]!=null){var j=m[0].getElementsByTagName("item");for(var n=0;nthis.side.parentNode.clientHeight-this.conf.side_hfix){if(a==true){this.arw.className="dhxsidebar_arrows";this._adjustSide();}}else{if(a==false){this.arw.className="dhxsidebar_arrows dhxsidebar_arrows_hidden";this.side.firstChild.style.top="0px";this._adjustSide();}}};dhtmlXSideBar.prototype.removeSep=function(c){if(this.s[c]==null){return;} +this.side.firstChild.removeChild(this.s[c].sep);this.s[c].sep=null;this.s[c]=null;try{delete this.s[c];}catch(a){}};dhtmlXSideBar.prototype.showSide=function(){if(this.conf.autohide!=true){return;} +if(this.sideCover==null){this._sideCoverAttach();} +if(this.conf.animate_items==true){var e=function(j,a,l){window.setTimeout(function(){j.style[l]="transform 0.3s";j.style.transform="translate(0px,0px)";j=null;},a);};if(this.conf.transProp!==false){var h=100;for(var c in this.t){this.t[c].item.style[this.conf.transProp]="";this.t[c].item.style.transform="translate(-"+(this.conf.width+20)+"px,0px)";e(this.t[c].item,(h+=50),this.conf.transProp);}}} +var g=this;window.setTimeout(function(){g.arw.style.left=g.side.style.left="0px";g.sideCover.className="dhxsidebar_side_cover dhxsidebar_side_cover_actv";g=null;},50);};dhtmlXSideBar.prototype.hideSide=function(a){if(this.conf.autohide!=true){return;} +this.arw.style.left=this.side.style.left=-this.conf.width-10+"px";if(this.sideCover!=null){if(this.conf.transProp!==false){this.sideCover.className="dhxsidebar_side_cover";}else{this._sideCoverDetach();}}};dhtmlXSideBar.prototype._sideCoverAttach=function(){var a=this;this.sideCover=document.createElement("DIV");this.sideCover.className="dhxsidebar_side_cover";if(this.arw.nextSibling!=null){this.cont.insertBefore(this.sideCover,this.arw.nextSibling);}else{this.cont.appendChild(this.sideCover);} +this._sideCoverOnTrEnd=function(){if(this.className.match(/dhxsidebar_side_cover_actv/)==null){a._sideCoverDetach();}};this._sideCoverDetach=function(){if(this.sideCover==null){return;} +if(this.conf.transProp!==false){this.sideCover.removeEventListener(this.conf.transEv,this._sideCoverOnTrEnd,false);} +this.sideCover.parentNode.removeChild(this.sideCover);this.sideCover=null;a=null;};if(this.conf.transProp!==false){this.sideCover.addEventListener(this.conf.transEv,this._sideCoverOnTrEnd,false);}};dhtmlXSideBar.prototype._setItemActive=function(e,c){if(this.conf.selected==e){if(this.conf.autohide==true){this.hideSide();} +return;} +if(typeof c=="undefined"){c=false;} +if(c==true&&this.callEvent("onBeforeSelect",[e,this.conf.selected])!==true){return;} +var a=null;if(this.conf.selected!=null){a=this.conf.selected;this._setItemInactive(this.conf.selected);} +if(this.t[e]!=null){this.conf.selected=e;this.t[e].selected=true;this.t[e].item.className+=" dhxsidebar_item_selected";if(this.conf.single_cell!=true){this.t[e].cell.cell.style.visibility="visible";this.t[e].cell.cell.style.top="0px";this.t[e].cell.cell.style.zIndex=1;}}else{this.conf.selected=null;} +this._adjustCell(e);if(c==true){this.callEvent("onSelect",[e,a]);} +if(this.conf.autohide==true){this.hideSide();}};dhtmlXSideBar.prototype._setItemInactive=function(a){if(this.t[a]==null){return;} +this.t[a].selected=false;this.t[a].item.className=this.t[a].item.className.replace(/\s{0,}dhxsidebar_item_selected/gi,"");if(this.conf.single_cell!=true){this.t[a].cell.cell.style.visibility="hidden";this.t[a].cell.cell.style.top="-5000px";this.t[a].cell.cell.style.zIndex=0;}};dhtmlXSideBar.prototype._isItemActive=function(a){return this.conf.selected==a;};dhtmlXSideBar.prototype._getNextVisible=function(c,a){return this._getNearVisible(c,a,"next");};dhtmlXSideBar.prototype._getPrevVisible=function(c,a){return this._getNearVisible(c,a,"previous");};dhtmlXSideBar.prototype._getFirstVisible=function(){return this._getNearVisible(null,false,"first");};dhtmlXSideBar.prototype._getNearVisible=function(j,c,h){if(h=="first"){var e=this.side.firstChild.firstChild;h="next";}else{if(j==null||this.t[j]==null){return c?this._getFirstVisible():null;} +var e=this.t[j].item[h+"Sibling"];} +var g=null;while(e!=null&&g==null){var a=e._idd;if(a!=null&&g==null&&this.t[a].conf.visible){g=a;}else{e=e[h+"Sibling"];}} +e=null;return g;};dhtmlXSideBar.prototype.goToNextItem=function(a){var c=this._getNextVisible(this.conf.selected,true);if(c!=null){this._setItemActive(c,a);}};dhtmlXSideBar.prototype.goToPrevItem=function(a){var c=this._getPrevVisible(this.conf.selected,true);if(c!=null){this._setItemActive(c,a);}};dhtmlXSideBar.prototype.getActiveItem=function(){return this.conf.selected;};dhtmlXSideBar.prototype.setTemplate=function(g,c){this.conf.tpl_name=g!=null&&this.templates[g]!=null?g:"details";this.conf.tpl_str=this.templates[this.conf.tpl_name];if(c!=null){this.conf.icons_path=c;} +for(var e in this.t){this.t[e].init.icons_path=this.conf.icons_path;this.t[e].item.innerHTML=window.dhx4.template(this.conf.tpl_str,this.t[e].init);} +if(this.side!=null){this.side.className="dhxsidebar_side dhxsidebar_tpl_"+this.conf.tpl_name;} +if(this._scrollSide!=null){this._scrollSide(0);this._checkHeight();}};dhtmlXSideBar.prototype.templates={details:"
#text#
",tiles:"
#text#
",icons:"",icons_text:"
#text#
",text:"
#text#
",};dhtmlXSideBar.prototype.tpl_bubble="
#value#
";dhtmlXSideBar.prototype.tpl_header="#text#";window.dhtmlXSideBarCell=function(h,g){dhtmlXCellObject.apply(this,[h,"_sidebar"]);var e=this;this.sidebar=g;this.conf.skin=this.sidebar.conf.skin;this.conf.sidebar_funcs={show:"_showItem",hide:"_hideItem",isVisible:"_isItemVisible",setActive:"_setItemActive",isActive:"_isItemActive",setText:"_setItemText",getText:"_getItemText",remove:"_removeItem",setBubble:"_setItemBubble",getBubble:"_getItemBubble",clearBubble:"_clearItemBubble",};this._sidebarCall=function(a){return function(){var j=[this._idd];for(var l=0;l":"")+"
";this.cell.insertBefore(a,this.cell.childNodes[this.conf.idx.cont]);a=null;this.conf.ofs_nodes.t._getHdrHeight="func";this.conf.hdr={visible:true};this.conf.idx_data.hdr="dhx_cell_sidebar_hdr";this._updateIdx();};dhtmlXSideBarCell.prototype._getHdrHeight=function(){return this.cell.childNodes[this.conf.idx.hdr].offsetHeight;};dhtmlXSideBarCell.prototype.showHeader=function(){if(this.conf.hdr.visible==true){return;} +this.conf.hdr.visible=true;this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_sidebar_hdr";this._adjustCont(this._idd);};dhtmlXSideBarCell.prototype.hideHeader=function(){if(this.conf.hdr.visible!=true){return;} +this.conf.hdr.visible=false;this.cell.childNodes[this.conf.idx.hdr].className="dhx_cell_sidebar_hdr dhx_cell_sidebar_hdr_hidden";this._adjustCont(this._idd);};dhtmlXSideBarCell.prototype.isHeaderVisible=function(){return this.conf.hdr.visible==true;};dhtmlXSideBarCell.prototype.setHeaderText=function(c){this.conf.text=c;var a=this.cell.childNodes[this.conf.idx.hdr];a.childNodes[a.firstChild.className=="dhx_cell_sidebar_hdr_icon"?1:0].innerHTML=""+c+"";a=null;};dhtmlXSideBarCell.prototype.getHeaderText=function(){return this.conf.text;};function dhtmlXCarousel(g,j,m){if(typeof g=="string"||(typeof g=="object"&&typeof g.tagName!="undefined")){g={parent:typeof g=="string"?document.getElementById(g):g,effect:j,skin:m,delete_conf:true};}else{if(typeof g=="undefined"||g==null){g={};}} +this.conf={skin:g.skin||window.dhx4.skin||(typeof dhtmlx!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxcarousel")||"dhx_skyblue",css:"dhxcarousel",items_count:0,selected:-1,item_width:Number(g.item_width)||"auto",item_height:Number(g.item_height)||"auto",ofs_item:Number(g.offset_item)||1,ofs_left:Number(g.offset_left)||0,ofs_top:Number(g.offset_top)||0,buttons:typeof g.buttons=="undefined"?true:window.dhx4.s2b(g.buttons),drops:false,keys:typeof g.keys=="undefined"?true:window.dhx4.s2b(g.keys),key_data:{left:37,right:39},touch_scroll:typeof g.touch_scroll!="undefined"?window.dhx4.s2b(g.touch_scroll):true,arw:["◄","►"],};this.conf.autowidth=this.conf.item_width=="auto";this.conf.autoheight=this.conf.item_height=="auto";var e=window.dhx4.transDetect();this.conf.transProp=e.transProp;this.conf.transEv=e.transEv;this.conf.anim_type=g.effect||"slide";if(this.ef[this.conf.anim_type]==true){var h=this["_"+this.conf.anim_type+"_init"]();if(h===false){this.conf.anim_type="slide";h=this["_"+this.conf.anim_type+"_init"]();} +if(typeof h=="object"){for(var c in h){if(typeof this.conf[c]=="undefined"){this.conf[c]=h[c];}}}} +this.conf.anim_f=this["_"+this.conf.anim_type+"_f"]();var l=this;window.dhtmlXCellTop.apply(this,[g.parent,g.offsets]);this.area=document.createElement("DIV");this.area.className="dhxcarousel_area";this.cont.appendChild(this.area);if(typeof window.addEventListener=="function"&&l.conf.touch_scroll==true){this._doOnTouchStart=function(a){if(window.dhx4.dnd._mTouch(a)==true){return;} +if(l.conf.animating==true){return;} +if(a.preventDefault){a.preventDefault();} +l.area.className+=" dhxcarousel_area_dnd";l.conf.touch_conf={t:new Date().getTime(),dx:null,dy:null};if(a.type.match(/^touch/)!=null){l.conf.touch_conf.id=a.touches[0].identifier;l.conf.touch_conf.x=a.touches[0].clientX;l.conf.touch_conf.y=a.touches[0].clientY;}else{l.area.style.touchAction=l.area.style.msTouchAction="none";l.conf.touch_conf.x=a.clientX;l.conf.touch_conf.y=a.clientY;} +window.addEventListener(window.dhx4.dnd.evs.move,l._doOnTouchMove,false);window.addEventListener(window.dhx4.dnd.evs.end,l._doOnTouchEnd,false);};this._doOnTouchMove=function(a){};this._doOnTouchEnd=function(r){if(r.type.match(/^touch/)!=null){var n=0;for(var o=0;o400){return;} +var a=n/Math.abs(n);l._animateStart(a);};this.area.addEventListener(window.dhx4.dnd.evs.start,this._doOnTouchStart,false);} +this.cdata={};this.ind={};this.addCell=function(s,r){this.conf.items_count++;if(this.conf.selected==-1){this.conf.selected=0;} +this.setSizes();this._checkControls();if(typeof r=="undefined"||r==null){r=this.conf.items_count-1;}else{if(r<0){r=0;}else{if(r>this.conf.items_count-1){r=this.conf.items_count-1;}}} +for(var o in this.cdata){if(this.cdata[o].index>=r){this.cdata[o].index++;this.ind[this.cdata[o].index]=o;this._adjustCell(o);}} +if(s==null){s=String(window.dhx4.newId());} +while(this.cdata[s]!=null){s=String(window.dhx4.newId());} +var n=new dhtmlXCarouselCell(s,this);if(this.area.childNodes[r]!=null){this.area.insertBefore(n.cell,this.area.childNodes[r]);}else{this.area.appendChild(n.cell);} +this.cdata[s]={index:r,cell:n};this.ind[r]=s;this._adjustCell(s);this._addBar();this._setBarIndex(this.conf.selected);n=null;this[this.conf.anim_f.cell_added](s);return s;};this._removeCell=function(u){var r=this.cdata[u].index;this.cdata[u].cell._unload();this.cdata[u].index=this.cdata[u].cell=null;this.cdata[u]=null;delete this.cdata[u];delete this.ind[r];this.conf.items_count--;if(this.conf.unloading==true){return;} +this.ind={};var n=0;for(var o in this.cdata){if(this.cdata[o].index>r){this.cdata[o].index--;} +this.ind[this.cdata[o].index]=o;} +var s=false;if(this.conf.selected>r){this.conf.selected--;}else{if(this.conf.selected==r){this.conf.selected=Math.min(this.conf.selected,this.conf.items_count-1);s=true;}else{}} +this._removeBar(false);this._setBarIndex(this.conf.selected);if(s==true){if(this.conf.selected>=0){this[this.conf.anim_f.update_selected](this.ind[this.conf.selected]);}} +this.setSizes();this._checkControls();};this.setSizes=function(){this._adjustCont();var u={};this.area.style.height=this.cont.offsetHeight-this.controls.offsetHeight+"px";this.conf.width=this.conf.autowidth?this.cont.offsetWidth-this.conf.ofs_left*2:this.conf.item_width;this.conf.height=this.conf.autoheight?this.area.offsetHeight-this.conf.ofs_top*2:this.conf.item_height;this.conf.top=Math.max(0,this.conf.autoheight?this.conf.ofs_top:Math.floor((this.area.offsetHeight-this.conf.height)/2));this.area.style.width=this[this.conf.anim_f.detect_aw]()*(this.conf.width+this.conf.ofs_item)+this.conf.ofs_item+"px";this.area.style.left=Math.round(this.cont.offsetWidth/2-this.conf.width/2-this.conf.ofs_item)+"px";for(var o in this.cdata){var r={};for(var n in this.cdata[o].cell.conf.size){r[n]=this.cdata[o].cell.conf.size[n];} +if(this.conf.autowidth==true){r.w=this.conf.width;r.x=this[this.conf.anim_f.detect_x](o);} +if(this.conf.autoheight==true){r.h=this.conf.height;} +u[o]=r;} +this.area.style.left=Math.round(this.cont.offsetWidth/2-this.conf.width/2-this.conf.ofs_item)-(this.conf.width+this.conf.ofs_item)*this.conf.selected+"px";this._adjustControls();if(this.conf.autoheight!=true){this.conf.top=Math.max(0,Math.floor(this.area.offsetHeight-this.conf.height)/2);for(var o in u){u[o].y=this.conf.top;}} +for(var o in u){this.cdata[o].cell._setSize(u[o].x,u[o].y,u[o].w,u[o].h);} +this.callEvent("_onSetSizes",[]);};this._adjustCell=function(a){this.cdata[a].cell._setSize(this[this.conf.anim_f.detect_x](a),this.conf.top,this.conf.width,this.conf.height);};this._animateStart=function(n,a){if((this.conf.selected<=0&&n<0)||(this.conf.selected>=this.conf.items_count-1&&n>0)){return;} +if(this.conf.animating==true){return;} +this.conf.animating=true;this[this.conf.anim_f.prepare](n,a);};this._animateTransEnd=function(a){l[l.conf.anim_f.end](a||event,this);};this._animateEnd=function(a){this.conf.selected=this.conf.selected+a;this._checkControls();this._setBarIndex(this.conf.selected);this.callEvent("onSelect",[this.ind[this.conf.selected]]);this.conf.animating=false;};this._initControls();this.setCellSize=function(a,n){this.conf.item_width=a==null?"auto":a;this.conf.item_height=n==null?"auto":n;this.setSizes();};this.setOffset=function(o,n,a){if(o!=null){this.conf.ofs_left=o;} +if(n!=null){this.conf.ofs_top=n;} +if(a!=null){this.conf.ofs_item=a;} +this.setSizes();};this.enableHotKeys=function(a){this.conf.keys=window.dhx4.s2b(a);};this.goFirst=function(){if(this.conf.selected==0){return;} +this._animateStart(-this.conf.selected);};this.goLast=function(){if(this.conf.selected==this.conf.items_count-1){return;} +this._animateStart(this.conf.items_count-1-this.conf.selected);};this.goNext=function(){this._animateStart(1);};this.goPrev=function(){this._animateStart(-1);};this.getActiveIndex=function(){return this.conf.selected;};this.getActiveId=function(){return this.ind[this.conf.selected];};this.getActiveCell=function(){var a=this.getActiveId();if(a!=null){return this.cdata[a].cell;} +return null;};this.unload=function(){this.conf.unloading=true;if(typeof window.addEventListener=="function"){window.removeEventListener("keydown",this._doOnWinKeyDown,false);if(this._doOnTouchStart!=null){this.area.removeEventListener(window.dhx4.dnd.evs.start,this._doOnTouchStart,false);}}else{document.body.detachEvent("onkeydown",this._doOnWinKeyDown);} +for(var n in this.cdata){this._removeCell(n);} +this.cdata[n]=null;this.area.parentNode.removeChild(this.area);this.area=null;this._unloadControls();this._unloadTop();window.dhx4._eventable(this,"clear");for(var n in this){this[n]=null;} +l=null;};window.dhx4._eventable(this);this._callMainEvent=function(n,a){this.callEvent(n,a);};this.conf.ev_coverclick=this.attachEvent("_cellCoverClick",function(a){var n=a-this.conf.selected;if(Math.abs(n)==1){this._animateStart(n);}});this._doOnWinKeyDown=function(o){o=o||event;if(l.conf.keys==true){if(o.ctrlKey==true&&o.shiftKey!=true&&o.altKey!=true){var n=o.keyCode;var a=l.conf.key_data;if(n==a.left||n==a.right){if(o.preventDefault){o.preventDefault();}else{o.returnValue=false;} +l._animateStart(n==a.left?-1:1);}}}};if(typeof window.addEventListener=="function"){window.addEventListener("keydown",this._doOnWinKeyDown,false);}else{document.body.attachEvent("onkeydown",this._doOnWinKeyDown);} +if(g.delete_conf==true){for(var c in g){g[c]=null;} +g=null;} +return this;} +dhtmlXCarousel.prototype=new dhtmlXCellTop();dhtmlXCarousel.prototype.ef={};dhtmlXCarousel.prototype.cells=function(a){return this.cdata[a].cell;};dhtmlXCarousel.prototype.forEachCell=function(e){for(var c in this.cdata){if(typeof e=="function"){e.apply(window,[this.cdata[c].cell]);}else{if(typeof e=="string"&&typeof window[e]=="function"){window[e].apply(window,[this.cdata[c].cell]);}}}};dhtmlXCarousel.prototype._initControls=function(){var a=this;this.controls=document.createElement("DIV");this.controls.className="dhx_carousel_controls";this.controls.innerHTML="";this.cont.appendChild(this.controls);this._doOnControlClick=function(j){if(a.conf.clear_click==true){a.conf.clear_click=false;return;} +j=j||event;if(window.dhx4.dnd.evs.start!=null&&j.type!="click"&&a.conf.clear_click!=true){if(window.dhx4.dnd._mTouch(j)==true){return;} +a.conf.clear_click=true;} +var c=j.target||j.srcElement;var h=null;if(c.className!=null){if(c.className.match(/btn_prev/)!=null){h=-1;}else{if(c.className.match(/btn_next/)!=null){h=1;}else{if(c.className.match(/dhx_carousel_onebar/)!=null&&c.className.match(/dhx_carousel_baractv/)==null){for(var g=0;g=this.conf.items_count-1||this.conf.items_count==0?"_dis":"");};this._adjustControls=function(){this.controls.firstChild.style.left=Math.round(this.cont.offsetWidth/2-this.controls.firstChild.offsetWidth/2)+"px";};this._addBar=function(){var c=document.createElement("DIV");c.className="dhx_carousel_onebar";c.innerHTML="";this.controls.firstChild.appendChild(c);c=null;this._adjustControls();};this._removeBar=function(e){var c=this.controls.firstChild.lastChild;if(c!=null){c.parentNode.removeChild(c);c=null;if(e!==false){this._adjustControls();}}};this._setBarIndex=function(c){for(var e=0;e0){this._removeBar(false);} +this.cont.removeChild(this.controls);this.controls=null;a=null;};if(this.conf.buttons!=true){this.hideControls();} +this._checkControls();};window.dhtmlXCarouselCell=function(e,c){dhtmlXCellObject.apply(this,[e,"_carousel"]);var a=this;this.carousel=c;this.conf.skin=this.carousel.conf.skin;this.attachEvent("_onCellUnload",function(){this.carousel=null;a=null;});this.attachEvent("_onContentLoaded",function(){this.carousel._callMainEvent("onContentLoaded",[this._idd]);});this._showCover=function(){if(this.conf.cover==true){return;} +this._showCellCover();var g=this.cell.childNodes[this.conf.idx.cover];g.onclick=function(){a.carousel._callMainEvent("_cellCoverClick",[a._idd]);};g=null;};this._hideCover=function(){if(this.conf.cover!=true){return;} +this.cell.childNodes[this.conf.idx.cover].onclick=null;this._hideCellCover();};return this;};dhtmlXCarouselCell.prototype=new dhtmlXCellObject();dhtmlXCarouselCell.prototype.getId=function(){return this._idd;};dhtmlXCarouselCell.prototype.getIndex=function(){return this.carousel.cdata[this._idd].index;};dhtmlXCarouselCell.prototype.setActive=function(){var a=this.getIndex()-this.carousel.conf.selected;if(a!=0){this.carousel._animateStart(a);}};dhtmlXCarouselCell.prototype.remove=function(){this.carousel._removeCell(this._idd);};dhtmlXCellObject.prototype.attachCarousel=function(a){this.callEvent("_onBeforeContentAttach",["carousel"]);var c=document.createElement("DIV");c.style.width="100%";c.style.height="100%";c.style.position="relative";c.style.overflow="hidden";this._attachObject(c);if(typeof window.dhtmlXSideBarCell!="undefined"&&this instanceof window.dhtmlXSideBarCell){if(this.conf.skin=="dhx_terrace"){c._ofs={t:-1,r:-1,b:-1,l:-1};}} +if(typeof a=="undefined"||a==null){a={};} +if(typeof a.skin=="undefined"){a.skin=this.conf.skin;} +a.parent=c;this.dataType="carousel";this.dataObj=new dhtmlXCarousel(a);a.parent=null;c=a=null;this.callEvent("_onContentAttach",[]);return this.dataObj;};dhtmlXCarousel.prototype.ef.slide=true;dhtmlXCarousel.prototype.ef.slide_conf={anim_step:25,anim_timeout:10,anim_slide:"left 0.3s"};dhtmlXCarousel.prototype.ef.slide_f={prepare:"_slide_prepare",start:"_slide_start",end:"_slide_end",update_selected:"_slide_update_selected",detect_x:"_slide_detect_x",detect_aw:"_slide_detect_area_width",cell_added:"_slide_cell_added",};dhtmlXCarousel.prototype._slide_init=function(){return this.ef.slide_conf;};dhtmlXCarousel.prototype._slide_f=function(){return this.ef.slide_f;};dhtmlXCarousel.prototype._slide_prepare=function(c,a){var g=this.conf.anim_step;var h=this.conf.width+this.conf.ofs_item;if(a==false){g=h+1;} +this.area._init=parseInt(this.area.style.left);var e=this.ind[this.conf.selected+c];this._slide_update_selected(e);if(this.conf.transProp!==false&&a!=false){if(this.conf.transEvInit!=true){this.area.addEventListener(this.conf.transEv,this._animateTransEnd,false);this.conf.transEvInit=true;} +this.conf.current_dir=c;this.area.style[this.conf.transProp]=this.conf.anim_slide;this.area.style.left=this.area._init+h*-c+"px";}else{this._slide_start(g,0,h,c);}};dhtmlXCarousel.prototype._slide_start=function(h,a,j,c){var g=false;a+=h;if(a>=j){a=j;g=true;} +this.area.style.left=this.area._init+a*-c+"px";if(g!=true){var e=this;window.setTimeout(function(){e._slide_start(h,a,j,c);e=null;},this.conf.anim_timeout);}else{this.cdata[this.ind[this.conf.selected]].cell._showCover();this._animateEnd(c);}};dhtmlXCarousel.prototype._slide_end=function(c,a){if(c.type==this.conf.transEv&&a==this.area){this.area.style[this.conf.transProp]="";if(this.conf.transEvInit==true){this.area.removeEventListener(this.conf.transEv,this._animateTransEnd,false);this.conf.transEvInit=false;} +this.cdata[this.ind[this.conf.selected]].cell._showCover();this._animateEnd(this.conf.current_dir);}};dhtmlXCarousel.prototype._slide_update_selected=function(a){this.cdata[a].cell._hideCover();};dhtmlXCarousel.prototype._slide_detect_x=function(e){var c=this.cdata[e].index;var a=c*(this.conf.width+this.conf.ofs_item)+this.conf.ofs_item;return a;};dhtmlXCarousel.prototype._slide_cell_added=function(a){if(this.conf.selected!=this.cdata[a].index){this.cdata[a].cell._showCover();} +if(this.cdata[a].index<=this.conf.selected&&this.conf.items_count>1){this._animateStart(1,false);}};dhtmlXCarousel.prototype._slide_detect_area_width=function(){return this.conf.items_count;};dhtmlXCarousel.prototype.ef.flip=true;dhtmlXCarousel.prototype.ef.flip_conf={anim_flip:"transform 0.3s ease-out",anim_flip_ang:-87,anim_flip_trstyle:"transform"};dhtmlXCarousel.prototype.ef.flip_f={prepare:"_flip_prepare",start:"_flip_start",end:"_flip_end",update_selected:"_flip_update_selected",detect_x:"_flip_detect_x",detect_aw:"_flip_detect_area_width",cell_added:"_flip_cell_added",};dhtmlXCarousel.prototype._flip_init=function(){var a=this.conf.transProp==false?false:this.ef.flip_conf;if(a!==false&&window.dhx4.isKHTML==true&&a.anim_flip.match("webkit")==null){a.anim_flip=a.anim_flip.replace(/transform/,"-webkit-transform");a.anim_flip_trstyle="webkitTransform";} +return a;};dhtmlXCarousel.prototype._flip_f=function(){return this.ef.flip_f;};dhtmlXCarousel.prototype._flip_prepare=function(a){this.conf.flip_data={fromIndex:this.conf.selected,toIndex:this.conf.selected+a,mode:0,dir:a};this._flip_start();};dhtmlXCarousel.prototype._flip_start=function(){var a=this.cdata[this.ind[this.conf.flip_data.mode==0?this.conf.flip_data.fromIndex:this.conf.flip_data.toIndex]].cell;if(this.area.className.match(/dhxcarousel_area_flip/)==null){this.area.className+=" dhxcarousel_area_flip";} +if(a.conf.tr_ev!=true){a.cell.addEventListener(this.conf.transEv,this._animateTransEnd,false);a.conf.tr_ev=true;} +if(this.conf.flip_data.mode==0){a.cell.style[this.conf.anim_flip_trstyle]="rotateY("+String(this.conf.flip_data.dir>0?this.conf.anim_flip_ang:-this.conf.anim_flip_ang)+"deg)";}else{a.cell.style.visibility="visible";a.cell.style[this.conf.anim_flip_trstyle]="rotateY(0deg)";} +a.cell.style[this.conf.transProp]=this.conf.anim_flip;a=null;};dhtmlXCarousel.prototype._flip_end=function(m,l){if(m.type==this.conf.transEv){var a=this.cdata[this.ind[this.conf.flip_data.mode==0?this.conf.flip_data.fromIndex:this.conf.flip_data.toIndex]].cell;if(l==a.cell){a.cell.removeEventListener(this.conf.transEv,this._animateTransEnd,false);a.conf.tr_ev=false;if(this.conf.flip_data.mode==0){a.cell.style[this.conf.transProp]="";a.cell.style.visibility="hidden";this.conf.flip_data.mode=1;this._flip_start();}else{var g=this.conf.flip_data.dir;var h=Math.min(this.conf.flip_data.fromIndex,this.conf.flip_data.toIndex)+1;var c=Math.max(this.conf.flip_data.fromIndex,this.conf.flip_data.toIndex)-1;for(var j=h;j<=c;j++){this.cdata[this.ind[j]].cell.cell.style[this.conf.anim_flip_trstyle]="rotateY("+String((this.conf.anim_flip_ang*g)/Math.abs(g))+"deg)";} +if(this.area.className.match(/dhxcarousel_area_flip/)!=null){this.area.className=String(this.area.className).replace(/\s{0,}dhxcarousel_area_flip/gi,"");} +this.conf.flip_data=null;a.cell.style[this.conf.transProp]="";this._animateEnd(g);}} +a=null;}};dhtmlXCarousel.prototype._flip_update_selected=function(a){};dhtmlXCarousel.prototype._flip_detect_x=function(e){var c=0;var a=c*(this.conf.width+this.conf.ofs_item)+this.conf.ofs_item;return a;};dhtmlXCarousel.prototype._flip_cell_added=function(a){if(this.conf.selected!=this.cdata[a].index){this.cdata[a].cell.cell.style[this.conf.anim_flip_trstyle]="rotateY("+String(this.cdata[a].index0){var g=this.ind[this.conf.selected+e];var a=this.cdata[g].cell;this._cards_update_selected(g);if(a.conf.transEvInit!=true){a.cell.addEventListener(this.conf.transEv,this._animateTransEnd,false);a.conf.transEvInit=true;} +this.conf.current_id=g;this.conf.current_dir=e;a.cell.style[this.conf.transProp]=this.conf.anim_cards;a.cell.style.left=this._cards_detect_x(g,0)+"px";a=null;}else{this._cards_adjust_middle(this.conf.selected+e+1,this.conf.selected-1,1);var g=this.ind[this.conf.selected];var a=this.cdata[g].cell;a._hideCover();if(a.conf.transEvInit!=true){a.cell.addEventListener(this.conf.transEv,this._animateTransEnd,false);a.conf.transEvInit=true;} +this.conf.current_id=g;this.conf.current_dir=e;this.cdata[this.ind[this.conf.selected+e]].cell._hideCover();a.cell.style[this.conf.transProp]=this.conf.anim_cards;a.cell.style.left=this._cards_detect_x(g,1)+"px";a=null;}};dhtmlXCarousel.prototype._cards_start=function(e,a,g,c){};dhtmlXCarousel.prototype._cards_end=function(g,c){if(g.type==this.conf.transEv&&this.conf.current_id!=null&&c==this.cdata[this.conf.current_id].cell.cell){var a=this.cdata[this.conf.current_id].cell;a.cell.style[this.conf.transProp]="";if(a.conf.transEvInit!=true){a.cell.removeEventListener(this.conf.transEv,this._animateTransEnd,false);a.conf.transEvInit=false;} +this.conf.current_id=null;if(this.conf.current_dir>0){this._cards_adjust_middle(this.conf.selected+1,this.conf.selected+this.conf.current_dir-1,0);} +this.cdata[this.ind[this.conf.selected]].cell._showCover();this._animateEnd(this.conf.current_dir);}};dhtmlXCarousel.prototype._cards_update_selected=function(a){this.cdata[a].cell._hideCover();};dhtmlXCarousel.prototype._cards_adjust_middle=function(e,h,c){for(var g=e;g<=h;g++){var j=this.ind[g];var a=this.cdata[j].cell;a.conf.size.x=this._cards_detect_x(j,c);a.cell.style.left=a.conf.size.x+"px";a=null;}};dhtmlXCarousel.prototype._cards_detect_x=function(e,c){if(typeof c=="undefined"||c==null){c=this.cdata[e].index<=this.conf.selected?0:1;} +var a=c*(this.conf.width+this.conf.ofs_left+this.conf.ofs_item)+this.conf.ofs_item;return a;};dhtmlXCarousel.prototype._cards_cell_added=function(a){this.cdata[a].cell.conf.size.x=this._cards_detect_x(a);this.cdata[a].cell.cell.style.left=this.cdata[a].cell.conf.size.x+"px";if(this.conf.selected!=this.cdata[a].index){this.cdata[a].cell._showCover();}};dhtmlXCarousel.prototype._cards_detect_area_width=function(){return 2;};function dhtmlXWindows(m){var j=this;var g={};if(typeof m!="undefined"){for(var e in m){g[e]=m[e];}} +m=null;this.conf={skin:window.dhx4.skin||(typeof dhtmlx!="undefined"?dhtmlx.skin:null)||window.dhx4.skinDetect("dhxwins")||"dhx_skyblue",vp_pos_ofs:20,vp_custom:false,vp_of_auto:g.vp_overflow=="auto",vp_of_id:window.dhx4.newId(),ofs_w:null,ofs_h:null,button_last:null,dblclick_tm:300,dblclick_last:null,dblclick_id:null,dblclick_mode:"minmax",dblclick_active:false,dblclick_ev:window.dhx4.isIE6||window.dhx4.isIE7||window.dhx4.isIE8,fr_cover:navigator.userAgent.indexOf("MSIE 6.0")>=0,};var c=window.dhx4.transDetect();this.conf.tr={prop:c.transProp,ev:c.transEv,height_open:"height 0.2s cubic-bezier(0.25,0.1,0.25,1)",height_close:"height 0.18s cubic-bezier(0.25,0.1,0.25,1)",op_open:"opacity 0.16s ease-in",op_close:"opacity 0.2s ease-out",op_v_open:"1",op_v_close:"0.4",};if(!g.viewport){this.attachViewportTo(document.body);}else{if(g.viewport.object!=null){this.attachViewportTo(g.viewport.object);}else{if(g.viewport.left!=null&&g.viewport.top!=null&&g.viewport.width!=null&&g.viewport.height!=null){this.setViewport(g.viewport.left,g.viewport.top,g.viewport.width,g.viewport.height,g.viewport.parent);}else{this.attachViewportTo(document.body);}}} +this.w={};this.createWindow=function(o,F,D,s,I){var n={};if(arguments.length==1&&typeof o=="object"){n=o;}else{n.id=o;n.left=F;n.top=D;n.width=s;n.height=I;if(typeof n.id=="undefined"||n.id==null){n.id=window.dhx4.newId();} +while(this.w[n.id]!=null){n.id=window.dhx4.newId();}} +if(n.left==null){n.left=0;} +if(n.top==null){n.top=0;} +n.move=n.move!=null&&window.dhx4.s2b(n.move)==false?false:n.deny_move!=null&&window.dhx4.s2b(n.deny_move)==true?false:true;n.park=n.park!=null&&window.dhx4.s2b(n.park)==false?false:n.deny_park!=null&&window.dhx4.s2b(n.deny_park)==true?false:true;n.resize=n.resize!=null&&window.dhx4.s2b(n.resize)==false?false:n.deny_resize!=null&&window.dhx4.s2b(n.deny_resize)==true?false:true;n.keep_in_viewport=n.keep_in_viewport!=null&&window.dhx4.s2b(n.keep_in_viewport);n.modal=n.modal!=null&&window.dhx4.s2b(n.modal);n.center=n.center!=null&&window.dhx4.s2b(n.center);n.text=n.text!=null?n.text:n.caption!=null?n.caption:"dhtmlxWindow";n.header=!(n.header!=null&&window.dhx4.s2b(n.header)==false);var J=document.createElement("DIV");J.className="dhxwin_active";this.vp.appendChild(J);J._isWindow=true;J._idd=n.id;var w=document.createElement("DIV");w.className="dhxwin_hdr";w.style.zIndex=0;w.innerHTML="
"+n.text+"
";J.appendChild(w);w.onselectstart=function(a){a=a||event;if(a.preventDefault){a.preventDefault();}else{a.returnValue=false;} +return false;};w.oncontextmenu=function(a){a=a||event;a.cancelBubble=true;return false;};w._isWinHdr=true;w.firstChild._isWinIcon=true;var u=document.createElement("DIV");u.className="dhxwin_brd";J.appendChild(u);var C=document.createElement("DIV");C.className="dhxwin_fr_cover";C.innerHTML="
";J.appendChild(C);this.w[n.id]={win:J,hdr:w,brd:u,fr_cover:C,b:{},conf:{z_id:window.dhx4.newId(),actv:false,modal:false,maxed:false,parked:false,sticked:false,visible:true,header:true,text:n.text,keep_in_vp:n.keep_in_viewport,allow_move:n.move,allow_park:n.park,allow_resize:n.resize,max_w:null,max_h:null,min_w:80,min_h:80,},};var v={help:{title:"Help",visible:false},stick:{title:"Stick",visible:false},park:{title:"Park",visible:true},minmax:{title:"Min/Max",visible:true},close:{title:"Close",visible:true}};for(var E in v){var A=new dhtmlXWindowsButton(this,n.id,E,v[E].title,false);if(v[E].visible==false){A.hide();} +w.lastChild.appendChild(A.button);this.w[n.id].b[E]=A;A=null;} +this._winAdjustTitle(n.id);this.w[n.id].win.style.zIndex=window.dhx4.zim.reserve(this.w[n.id].conf.z_id);var H=new dhtmlXWindowsCell(n.id,this);this.w[n.id].win.insertBefore(H.cell,C);this.w[n.id].cell=H;if(typeof window.addEventListener=="function"){this.w[n.id].win.addEventListener("mousedown",this._winOnMouseDown,false);this.w[n.id].win.addEventListener("mouseup",this._winOnMouseDown,false);if(this.conf.dblclick_ev){this.w[n.id].win.addEventListener("dblclick",this._winOnMouseDown,false);} +if(this.conf.dnd_enabled==true&&window.dhx4.dnd.evs.start!=null){this.w[n.id].win.addEventListener(window.dhx4.dnd.evs.start,this._winOnMouseDown,false);if(window.dhx4.dnd.p_en!=true){this.w[n.id].win.addEventListener(window.dhx4.dnd.evs.start,this._winOnMouseDown,false);this.w[n.id].win.addEventListener(window.dhx4.dnd.evs.end,this._winOnMouseDown,false);}}}else{this.w[n.id].win.attachEvent("onmousedown",this._winOnMouseDown);this.w[n.id].win.attachEvent("onmouseup",this._winOnMouseDown);if(this.conf.dblclick_ev){this.w[n.id].win.attachEvent("ondblclick",this._winOnMouseDown);}} +this._winInitFRM(n.id);this._winSetPosition(n.id,n.left,n.top);this._winSetSize(n.id,n.width,n.height);this._winMakeActive(n.id);if(n.center==true){this.w[n.id].cell.center();} +if(n.modal==true){this.w[n.id].cell.setModal(true);} +if(n.header==false){this.w[n.id].cell.hideHeader();} +f=J=w=u=C=H=null;return this.w[n.id].cell;};this._winOnMouseDown=function(o){o=o||event;var a=o.target||o.srcElement;var n={press_type:o.type};if(o.type=="MSPointerDown"||o.type=="pointerdown"){j.conf.ev_skip=true;}else{if(j.conf.ev_skip==true){j.conf.ev_skip=false;a=null;return;}} +while(a!=null&&a._isWindow!=true){if(typeof a.className!="undefined"&&n.mode==null){if(typeof a._buttonName!="undefined"){n.mode="button";n.button_name=a._buttonName;}else{if(a._isWinHdr==true){n.mode="hdr";}else{if(a._isWinIcon==true){n.mode="icon";}}}} +a=a.parentNode;} +if(n.mode==null){n.mode="win";} +n.id=a!=null&&a._isWindow==true?a._idd:null;a=null;if(n.id!=null&&j.w[n.id]!=null){j.callEvent("_winMouseDown",[o,n]);}};this._winOnParkTrans=function(n){if(n.stopPropagation){n.stopPropagation();} +var a=j.w[this._idd];if(n.propertyName=="opacity"){j._winCellClearOpacity(this._idd);} +if(n.propertyName=="height"&&a.conf.tr_mode=="park"){if(a.conf.tr_mode=="park"){a.win.style[j.conf.tr.prop]="";if(!a.conf.parked){j._winAdjustCell(this._idd);j._callMainEvent("onParkDown",this._idd);if(a.conf.keep_in_vp){j._winAdjustPosition(this._idd,a.conf.x,a.conf.y);}}else{a.hdr.style.zIndex=3;j._callMainEvent("onParkUp",this._idd);}}} +a=null;};this.unload=function(){this.conf.unloading=true;if(this._dndInitModule){this._dndUnloadModule();} +for(var n in this.w){this._winClose(n);} +this.w=null;if(this.cm!=null&&typeof this._unloadContextMenu=="function"){this._unloadContextMenu();} +window.dhx4._eventable(this,"clear");this.attachViewportTo(null);for(var n in this.conf){this.conf[n]=null;delete this.conf[n];} +for(var n in this){this[n]=null;} +j=n=null;};window.dhx4._eventable(this);this.attachEvent("_winMouseDown",this._winMouseDownHandler);if(this._dndInitModule){this._dndInitModule();} +if(g.wins!=null){for(var l=0;l=0){e.push(this.w[c]);}} +return e;};dhtmlXWindows.prototype.setSkin=function(e){if(e==this.conf.skin){return;} +if(this.vp!=null){this.vp.className=String(this.vp.className).replace("dhxwins_vp_"+this.conf.skin," dhxwins_vp_"+e);} +for(var c in this.w){this.w[c].cell._resetSizeState();this._winAdjustCell(c);this._winAdjustTitle(c);} +this.conf.skin=e;};dhtmlXWindows.prototype.getBottommostWindow=function(){return this._getTopBottomWin(false);};dhtmlXWindows.prototype.getTopmostWindow=function(){return this._getTopBottomWin(true);};dhtmlXWindows.prototype._getTopBottomWin=function(h){var g=null;for(var c in this.w){if(this.w[c].conf.visible){var e=false;if(g!=null){e=g.z>this.w[c].win.style.zIndex;if(h){e=!e;}} +if(g==null||e){g={win:this.w[c].cell,z:this.w[c].win.style.zIndex};}}} +return g?g.win:null;};dhtmlXWindows.prototype._winMakeActive=function(e,h){if(e!=null&&h!==true&&this.w[e].conf.actv==true){return;} +var s=[];var m={};for(var c=0;c=0;c--){var o=s[c][0];var r=this.w[o];r.win.style.zIndex=window.dhx4.zim.reserve(r.conf.z_id);if(r.conf.modal&&this.mcover!=null){for(var n in this.mcover){this.mcover[n].style.zIndex=r.win.style.zIndex;}} +this._winAdjustFRMZIndex(o);if(e==null&&c==0){e=o;} +r.conf.actv=e==o;r.win.className=r.conf.actv?"dhxwin_active":"dhxwin_inactive";r=null;} +if(e!=null&&this.conf.last_active!=e){this._callMainEvent("onFocus",e);} +this.conf.last_active=e;};dhtmlXWindows.prototype._zOrder=[{name:"modal",value:true},{name:"sticked",value:true},{name:"sticked",value:false},];dhtmlXWindows.prototype._vpPull={};dhtmlXWindows.prototype._vpOf={};dhtmlXWindows.prototype._vpPullAdd=function(){if(this.vp==null){return;} +var e=null;for(var c in this._vpPull){if(this._vpPull[c].vp==this.vp){this._vpPull[c].count++;e=c;}} +if(e==null){this._vpPull[window.dhx4.newId()]={vp:this.vp,count:1};} +if(this.vp==document.body&&this.conf.vp_of_auto==true){this._vpOfInit();} +this._vpOfUpd();};dhtmlXWindows.prototype._vpPullRemove=function(){if(this.vp==null){return 0;} +var e=0;for(var c in this._vpPull){if(this._vpPull[c].vp==this.vp){e=--this._vpPull[c].count;if(e==0){this._vpPull[c].vp=null;this._vpPull[c].count=null;delete this._vpPull[c];}}} +this._vpOfClear();return e;};dhtmlXWindows.prototype._vpOfInit=function(){this._vpOf[this.conf.vp_of_id]=true;};dhtmlXWindows.prototype._vpOfClear=function(){this._vpOf[this.conf.vp_of_id]=false;delete this._vpOf[this.conf.vp_of_id];this._vpOfUpd();};dhtmlXWindows.prototype._vpOfUpd=function(){var e=false;for(var c in this._vpOf){e=e||this._vpOf[c];} +if(e==true){if(document.body.className.match(/dhxwins_vp_auto/)==null){document.body.className+=" dhxwins_vp_auto";}}else{if(document.body.className.match(/dhxwins_vp_auto/)!=null){document.body.className=String(document.body.className).replace(/\s{0,}dhxwins_vp_auto/gi,"");}}};dhtmlXWindows.prototype.attachViewportTo=function(h){var e=this._vpPullRemove();if(this.conf.vp_custom){while(this.vp.childNodes.length>0){this.vp.removeChild(this.vp.lastChild);} +this.vp.parentNode.removeChild(this.vp);this.vp=null;}else{if(this.vp!=null&&e==0){this.vp.className=String(this.vp.className).replace(new RegExp("\\s{1,}dhxwins_vp_"+this.conf.skin),"");}} +if(h==null){this.vp=null;}else{this.vp=typeof h=="string"?document.getElementById(h):h;var g="dhxwins_vp_"+this.conf.skin;if(this.vp.className.indexOf(g)<0){this.vp.className+=" "+g;} +h=null;for(var c in this.w){this.vp.appendChild(this.w[c].win);} +this.conf.vp_custom=false;} +if(this.vp==document.body){document.body.style.position="static";} +this._vpPullAdd();};dhtmlXWindows.prototype.setViewport=function(c,j,g,a,h){var e=document.createElement("DIV");e.style.position="absolute";e.style.left=c+"px";e.style.top=j+"px";e.style.width=g+"px";e.style.height=a+"px";if(typeof h=="undefined"||h==null){h=document.body;}else{if(typeof h=="string"){h=document.getElementById(h);}} +h.appendChild(e);this.attachViewportTo(e);this.conf.vp_custom=true;h=e=null;};dhtmlXWindows.prototype._winSetPosition=function(g,a,e){var c=this.w[g];if(c.conf.maxed){c.conf.lastMX+=a-c.conf.x;c.conf.lastMY+=e-c.conf.y;} +c.conf.x=a;c.conf.y=e;c.win.style.left=c.conf.x+"px";c.win.style.top=c.conf.y+"px";this._winAdjustFRMPosition(g);c=null;};dhtmlXWindows.prototype._winAdjustPosition=function(l,c,j){var e=this.w[l];if(typeof c=="undefined"){c=e.conf.x;} +if(typeof j=="undefined"){j=e.conf.y;} +var a=e.conf.keep_in_vp?0:-e.conf.w+this.conf.vp_pos_ofs;var h=e.conf.keep_in_vp?this.vp.clientWidth-e.conf.w:this.vp.clientWidth-this.conf.vp_pos_ofs;if(ch){c=h;}} +var g=e.conf.keep_in_vp?this.vp.clientHeight-e.conf.h:this.vp.clientHeight-this.conf.vp_pos_ofs;if(j<0){j=0;}else{if(j>g){j=g;}} +if(c!=e.conf.x||j!=e.conf.y){this._winSetPosition(l,c,j);} +e=null;};dhtmlXWindows.prototype._winSetSize=function(m,j,e,l,c){var g=this.w[m];var a=j!=null?j:g.conf.w;var h=e!=null?e:g.conf.h;if(this.conf.ofs_w==null){g.win.style.width=a+"px";g.win.style.height=h+"px";this.conf.ofs_w=g.win.offsetWidth-a;this.conf.ofs_h=g.win.offsetHeight-h;} +if(g.conf.min_w!=null&&ag.conf.max_w){a=g.conf.max_w;} +if(!g.conf.parked&&g.conf.min_h!=null&&hg.conf.max_h){h=g.conf.max_h;} +if(g.conf.keep_in_vp){if(a>this.vp.clientWidth){a=this.vp.clientWidth;} +if(h>this.vp.clientHeight){h=this.vp.clientHeight;}} +g.win.style.width=a-this.conf.ofs_w+"px";g.win.style.height=h-this.conf.ofs_h+"px";g.conf.w=a;g.conf.h=h;this._winAdjustFRMSize(m);if(c){this._winAdjustPosition(m,g.conf.x,g.conf.y);} +if(!g.conf.parked&&l!=true){this._winAdjustCell(m);} +g=null;};dhtmlXWindows.prototype._winMinmax=function(h,e){if(typeof e!="undefined"&&this.w[h].conf.maxed==e){return;} +if(this.w[h].conf.allow_resize==false){return;} +var c=this.w[h];if(c.conf.parked){this._winPark(h,false);} +if(c.conf.maxed){this._winSetSize(h,c.conf.lastMW,c.conf.lastMH);this._winAdjustPosition(h,c.conf.lastMX,c.conf.lastMY);c.conf.maxed=false;}else{var a=0;var g=0;if(c.conf.max_w!=null){a=c.conf.x+Math.round(c.conf.w-c.conf.max_w)/2;} +if(c.conf.max_h!=null){g=Math.max(c.conf.y+Math.round(c.conf.h-c.conf.max_h)/2,0);} +c.conf.lastMX=c.conf.x;c.conf.lastMY=c.conf.y;c.conf.lastMW=c.conf.w;c.conf.lastMH=c.conf.h;this._winSetSize(h,this.vp.clientWidth,this.vp.clientHeight);this._winAdjustPosition(h,a,g);c.conf.maxed=true;} +c.b.minmax.setCss(c.conf.maxed?"minmaxed":"minmax");if(c.conf.maxed){this._callMainEvent("onMaximize",h);}else{this._callMainEvent("onMinimize",h);} +c=null;};dhtmlXWindows.prototype._winShow=function(c,a){if(this.w[c].conf.visible==true){return;} +this.w[c].win.style.display="";this.w[c].conf.visible=true;if(a==true||this.conf.last_active==null){this._winMakeActive(c,true);} +this._callMainEvent("onShow",c);};dhtmlXWindows.prototype._winHide=function(c,a){if(this.w[c].conf.visible==false){return;} +this.w[c].win.style.display="none";this.w[c].conf.visible=false;if(this.w[c].conf.actv){this.w[c].conf.actv=false;this.w[c].win.className="dhxwin_inactive";this._winMakeActive(null,true);} +this._callMainEvent("onHide",c);};dhtmlXWindows.prototype._winPark=function(e,a){if(this.w[e].conf.allow_park==false){return;} +if(this.w[e].conf.header==false){return;} +var c=this.w[e];if(a==true&&this.conf.tr.prop!==false){c.win.style[this.conf.tr.prop]=this.conf.tr[c.conf.parked?"height_open":"height_close"];if(!c.conf.tr_ev){c.win.addEventListener(this.conf.tr.ev,this._winOnParkTrans,false);c.conf.tr_ev=true;}} +if(c.conf.parked){c.hdr.className=String(c.hdr.className).replace(/\s{1,}dhxwin_hdr_parked/gi,"");c.hdr.style.zIndex=0;c.conf.parked=false;c.conf.tr_mode="park";this._winCellSetOpacity(e,"open",a);this._winSetSize(e,c.conf.w,c.conf.lastPH,a==true&&this.conf.tr.prop!==false);if(!(a==true&&this.conf.tr.prop!==false)){this._callMainEvent("onParkDown",e);if(c.conf.keep_in_vp){this._winAdjustPosition(e,c.conf.x,c.conf.y);}} +if(window.dhx4.isIE8==true&&this.conf.tr.prop==false&&c.cell.cell.className.match(/dhxwin_parked/)!=null){c.cell.cell.className=c.cell.cell.className.replace(/\s{0,}dhxwin_parked/gi,"");}}else{c.conf.lastPH=c.conf.h;c.hdr.className+=" dhxwin_hdr_parked";if(a==false||this.conf.tr.prop==false){c.hdr.style.zIndex=3;} +c.conf.parked=true;c.conf.tr_mode="park";this._winCellSetOpacity(e,"close",a);this._winSetSize(e,c.conf.w,c.hdr.offsetHeight+this.conf.ofs_h,a==true&&this.conf.tr.prop!==false);if(!(a==true&&this.conf.tr.prop!==false)){this._callMainEvent("onParkUp",e);} +if(window.dhx4.isIE8==true&&this.conf.tr.prop==false&&c.cell.cell.className.match(/dhxwin_parked/)==null){c.cell.cell.className+=" dhxwin_parked";}} +c=null;};dhtmlXWindows.prototype._winCellSetOpacity=function(l,j,e,h){var c=this.w[l].cell;for(var g in c.conf.idx){if({pr1:true,pr2:true}[g]!=true){if(e==true&&this.conf.tr.prop!=false){c.cell.childNodes[c.conf.idx[g]].style[this.conf.tr.prop]=this.conf.tr["op_"+j];} +c.cell.childNodes[c.conf.idx[g]].style.opacity=this.conf.tr["op_v_"+j];}} +c=null;};dhtmlXWindows.prototype._winCellClearOpacity=function(g){var c=this.w[g].cell;for(var e in c.conf.idx){if({pr1:true,pr2:true}[e]!=true){if(this.conf.tr.prop!=false){c.cell.childNodes[c.conf.idx[e]].style[this.conf.tr.prop]="";}}} +c=null;};dhtmlXWindows.prototype._winStick=function(c,a){if(typeof a!="undefined"&&this.w[c].conf.sticked==a){return;} +this.w[c].conf.sticked=!this.w[c].conf.sticked;this.w[c].b.stick.setCss(this.w[c].conf.sticked?"sticked":"stick");this._winMakeActive(this.conf.last_active,true);if(this.w[c].conf.sticked){this._callMainEvent("onStick",c);}else{this._callMainEvent("onUnStick",c);}};dhtmlXWindows.prototype._winClose=function(g){if(this._callMainEvent("onClose",g)!==true&&this.conf.unloading!=true){return;} +var e=this.w[g];if(e.conf.fs_mode){e.cell.setToFullScreen(false);} +if(e.conf.modal){this._winSetModal(g,false);} +window.dhx4.zim.clear(e.conf.z_id);if(this.cm!=null&&this.cm.icon[g]!=null){this._detachContextMenu("icon",g,null);} +if(typeof window.addEventListener=="function"){e.win.removeEventListener("mousedown",this._winOnMouseDown,false);e.win.removeEventListener("mouseup",this._winOnMouseDown,false);if(this.conf.dblclick_ev){e.win.removeEventListener("dblclick",this._winOnMouseDown,false);} +if(this.conf.dnd_enabled==true&&window.dhx4.dnd.evs.start!=null){e.win.removeEventListener(window.dhx4.dnd.evs.start,this._winOnMouseDown,false);if(window.dhx4.dnd.p_en!=true){e.win.removeEventListener(window.dhx4.dnd.evs.start,this._winOnMouseDown,false);e.win.removeEventListener(window.dhx4.dnd.evs.end,this._winOnMouseDown,false);}}}else{e.win.detachEvent("onmousedown",this._winOnMouseDown);e.win.detachEvent("onmouseup",this._winOnMouseDown);if(this.conf.dblclick_ev){e.win.attachEvent("ondblclick",this._winOnMouseDown);}} +for(var c in e.b){this._winRemoveButton(g,c,true);} +e.b=null;e.cell._unload();e.cell=null;e.brd.parentNode.removeChild(e.brd);e.brd=null;if(e.fr_cover!=null){e.fr_cover.parentNode.removeChild(e.fr_cover);e.fr_cover=null;} +if(e.fr_m_cover!=null){e.fr_m_cover.parentNode.removeChild(e.fr_m_cover);e.fr_m_cover=null;} +e.hdr._isWinHdr=true;e.hdr.firstChild._isWinIcon=true;e.hdr.onselectstart=null;e.hdr.parentNode.removeChild(e.hdr);e.hdr=null;for(var c in e.conf){e.conf[c]=null;delete e.conf[c];} +e.conf=null;e.win._idd=null;e.win._isWindow=null;e.win.parentNode.removeChild(e.win);e.win=null;e=null;this.w[g]=null;delete this.w[g];if(!this.conf.unloading){this._winMakeActive(null,true);}};dhtmlXWindows.prototype._winSetModal=function(l,g,j){if(this.w[l].conf.modal==g){return;} +if(typeof j=="undefined"){j=true;} +var e=this.w[l];if(g==true&&e.conf.modal==false){if(this.conf.last_modal!=null){this._winSetModal(this.conf.last_modal,false,false);} +if(this.mcover==null){var h=document.createElement("DIV");h.className="dhxwins_mcover";this.vp.insertBefore(h,e.fr_m_cover||e.win);this.mcover={d:h};if(this.conf.fr_cover){this.mcover.f=document.createElement("IFRAME");this.mcover.f.className="dhxwins_mcover";this.mcover.f.border=0;this.mcover.f.frameBorder=0;this.vp.insertBefore(this.mcover.f,h);} +h=null;}else{if(this.mcover.d.nextSibling!=(e.fr_m_cover||e.win)){this.vp.insertBefore(this.mcover.d,e.fr_m_cover||e.win);if(this.mcover.f!=null){this.vp.insertBefore(this.mcover.f,this.mcover.d);}}} +e.conf.modal=true;this.conf.last_modal=l;this._winMakeActive(l,true);}else{if(g==false&&e.conf.modal==true){e.conf.modal=false;this.conf.last_modal=null;if(j&&this.mcover!=null){for(var c in this.mcover){this.vp.removeChild(this.mcover[c]);this.mcover[c]=null;} +this.mcover=null;}}} +e=null;};dhtmlXWindows.prototype._winMouseDownHandler=function(g,c){var a=g.target||g.srcElement;if(g.button>=2){return;} +if(c.mode=="button"){if(c.press_type=="mousedown"){this.conf.button_last=c.button_name;}else{if((c.press_type=="mouseup"&&c.button_name==this.conf.button_last)||c.press_type=="MSPointerDown"||c.press_type=="pointerdown"){this.conf.button_last=null;if(this._winButtonClick(c.id,c.button_name,g)!==true){return;}}}} +if((c.press_type=="pointerdown"||c.press_type=="mousedown"||c.press_type=="dblclick")&&c.mode=="hdr"){this.conf.dblclick_active=false;if(this.conf.dblclick_ev==true){if(c.press_type=="dblclick"){this.conf.dblclick_active=true;}}else{if(this.conf.dblclick_last==null){this.conf.dblclick_last=new Date().getTime();this.dblclick_id=c.id;}else{var a=new Date().getTime();if(this.conf.dblclick_last+this.conf.dblclick_tm>a&&this.dblclick_id==c.id){this.conf.dblclick_active=true;this.conf.dblclick_last=null;this.dblclick_id=null;}else{this.conf.dblclick_last=a;this.dblclick_id=c.id;}}} +if(this.conf.dblclick_active){this._winDoHeaderDblClick(c.id);return;}} +if(c.press_type=="mousedown"||c.press_type==window.dhx4.dnd.evs.start){this._winMakeActive(c.id);} +if(c.press_type=="touchend"){}};dhtmlXWindows.prototype._winDoHeaderDblClick=function(a){if(this.conf.dblclick_mode=="minmax"){this._winMinmax(a);return;} +if(this.conf.dblclick_mode=="park"){this._winPark(a,true);return;} +if(typeof this.conf.dblclick_mode=="function"){this.conf.dblclick_mode.apply(window,[a]);return;} +if(typeof window[this.conf.dblclick_mode]=="function"){window[this.conf.dblclick_mode].apply(window,[a]);return;}};dhtmlXWindows.prototype._winAdjustCell=function(c){var o=this.w[c];var n=1;var m=o.conf.header?o.hdr.offsetHeight:1;var g=o.win.clientWidth-2;var r=o.win.clientHeight-m-1;o.brd.style.left=n+"px";o.brd.style.top=m+"px";if(o.conf.brd==null){o.brd.style.width=g+"px";o.brd.style.height=r+"px";o.conf.brd={w:g-o.brd.offsetWidth,h:r-o.brd.offsetHeight};} +o.brd.style.width=g+o.conf.brd.w+"px";o.brd.style.height=r+o.conf.brd.h+"px";var e=5;var a=1+e;var l=o.conf.header?m:m+e;var h=o.brd.clientWidth;var j=o.brd.clientHeight;o.cell._setSize(a,l,h,j);o.fr_cover.style.left=a+"px";o.fr_cover.style.top=l+"px";o.fr_cover.style.width=h+"px";o.fr_cover.style.height=j+"px";o=null;};dhtmlXWindows.prototype._winAdjustTitle=function(g){var a=this.w[g].hdr.childNodes[0];var e=this.w[g].hdr.childNodes[1];var c=this.w[g].hdr.childNodes[2];e.style.paddingLeft=a.offsetWidth+12+"px";e.style.paddingRight=c.offsetWidth+10+"px";e=c=a=null;};dhtmlXWindows.prototype._callMainEvent=function(c,g){var a=this.w[g];if(a.cell.checkEvent(c)){var e=a.cell._callMainEvent(c,[a.cell]);}else{var e=this.callEvent(c,[a.cell]);} +a=null;return e;};dhtmlXWindows.prototype._winInitFRM=function(e){if(this.conf.fr_cover!=true){return;} +var a=this.w[e];var c=document.createElement("IFRAME");c.className="dhxwin_main_fr_cover";c.border=0;c.frameBorder=0;c.style.zIndex=a.win.style.zIndex;a.win.parentNode.insertBefore(c,a.win);a.fr_m_cover=c;c=null;};dhtmlXWindows.prototype._winAdjustFRMSize=function(c){var a=this.w[c];if(a.fr_m_cover!=null){a.fr_m_cover.style.width=a.conf.w+"px";a.fr_m_cover.style.height=a.conf.h+"px";} +a=null;};dhtmlXWindows.prototype._winAdjustFRMPosition=function(c){var a=this.w[c];if(a.fr_m_cover!=null){a.fr_m_cover.style.left=a.win.style.left;a.fr_m_cover.style.top=a.win.style.top;} +a=null;};dhtmlXWindows.prototype._winAdjustFRMZIndex=function(c){var a=this.w[c];if(a.fr_m_cover!=null){a.fr_m_cover.style.zIndex=a.win.style.zIndex;} +a=null;};function dhtmlXWindowsCell(h,g){dhtmlXCellObject.apply(this,[h,"_wins"]);this.wins=g;this.cell._winId=h;this.conf.skin=this.wins.conf.skin;this.attachEvent("_onCellUnload",function(){if(this._unloadResize){this._unloadResize();} +window.dhx4._eventable(this.cell,"clear");this.cell._winId=null;this.wins=null;this.setText=null;this.getText=null;this.allowMove=null;this.denyMove=null;this.isMovable=null;this.allowResize=null;this.denyResize=null;this.isResizable=null;this.maximize=null;this.minimize=null;this.isMaximized=null;this.setPosition=null;this.getPosition=null;this.adjustPosition=null;this.park=null;this.isParked=null;this.allowPark=null;this.denyPark=null;this.isParkable=null;this.show=null;this.hide=null;this.isHidden=null;this.stick=null;this.unstick=null;this.isSticked=null;this.setDimension=null;this.getDimension=null;this.setMinDimension=null;this.getMinDimension=null;this.setMaxDimension=null;this.getMaxDimension=null;this.keepInViewport=null;this.center=null;this.centerOnScreen=null;this.bringToTop=null;this.bringToBottom=null;this.isOnTop=null;this.isOnBottom=null;this.showHeader=null;this.hideHeader=null;this.setModal=null;this.isModal=null;this.close=null;this._adjustByCont=null;this.button=null;this.addUserButton=null;this.removeUserButton=null;e=null;});this.attachEvent("_onContentLoaded",function(){this.wins._callMainEvent("onContentLoaded",this._idd);});this.attachEvent("_onContentMouseDown",function(j,a){this.wins.callEvent("_winMouseDown",[a,{id:j,mode:"win"}]);});this._callMainEvent=function(j,a){return this.callEvent(j,a);};this.conf.tr={};for(var c in this.wins.conf.tr){this.conf.tr[c]=this.wins.conf.tr[c];} +if(this.conf.tr.prop!=false){} +if(this._initResize){this._initResize();} +window.dhx4._eventable(this.cell);var e=this;this.cell.attachEvent("_setCellSize",function(a,m){var j=e.wins.w[this._winId].conf.w-e.conf.size.w;var l=e.wins.w[this._winId].conf.h-e.conf.size.h;e.setDimension(a+j,m+l);});return this;} +dhtmlXWindowsCell.prototype=new dhtmlXCellObject();dhtmlXWindowsCell.prototype.setText=function(a){this.wins.w[this._idd].conf.text=a;this.wins.w[this._idd].hdr.childNodes[1].firstChild.innerHTML=a;};dhtmlXWindowsCell.prototype.getText=function(){return this.wins.w[this._idd].conf.text;};dhtmlXWindowsCell.prototype.allowMove=function(){this.wins.w[this._idd].conf.allow_move=true;};dhtmlXWindowsCell.prototype.denyMove=function(){this.wins.w[this._idd].conf.allow_move=false;};dhtmlXWindowsCell.prototype.isMovable=function(){return this.wins.w[this._idd].conf.allow_move==true;};dhtmlXWindowsCell.prototype.allowResize=function(){this.wins.w[this._idd].conf.allow_resize=true;this.wins.w[this._idd].b.minmax.enable();};dhtmlXWindowsCell.prototype.denyResize=function(){this.wins.w[this._idd].conf.allow_resize=false;this.wins.w[this._idd].b.minmax.disable();};dhtmlXWindowsCell.prototype.isResizable=function(){return this.wins.w[this._idd].conf.allow_resize==true;};dhtmlXWindowsCell.prototype.maximize=function(){this.wins._winMinmax(this._idd,true);};dhtmlXWindowsCell.prototype.minimize=function(){this.wins._winMinmax(this._idd,false);};dhtmlXWindowsCell.prototype.isMaximized=function(){return this.wins.w[this._idd].conf.maxed==true;};dhtmlXWindowsCell.prototype.setPosition=function(a,c){this.wins._winSetPosition(this._idd,a,c);};dhtmlXWindowsCell.prototype.getPosition=function(){var a=this.wins.w[this._idd];var c=[a.conf.x,a.conf.y];a=null;return c;};dhtmlXWindowsCell.prototype.adjustPosition=function(){this.wins._winAdjustPosition(this._idd);};dhtmlXWindowsCell.prototype.park=function(){this.wins._winPark(this._idd,true);};dhtmlXWindowsCell.prototype.isParked=function(){return this.wins.w[this._idd].conf.parked==true;};dhtmlXWindowsCell.prototype.allowPark=function(){this.wins.w[this._idd].conf.allow_park=true;this.wins.w[this._idd].b.park.enable();};dhtmlXWindowsCell.prototype.denyPark=function(){this.wins.w[this._idd].conf.allow_park=false;this.wins.w[this._idd].b.park.disable();};dhtmlXWindowsCell.prototype.isParkable=function(){return this.wins.w[this._idd].conf.allow_park==true;};dhtmlXWindowsCell.prototype.show=function(a){this.wins._winShow(this._idd,window.dhx4.s2b(a));};dhtmlXWindowsCell.prototype.hide=function(){this.wins._winHide(this._idd);};dhtmlXWindowsCell.prototype.isHidden=function(){return this.wins.w[this._idd].conf.visible!=true;};dhtmlXWindowsCell.prototype.stick=function(){this.wins._winStick(this._idd,true);};dhtmlXWindowsCell.prototype.unstick=function(){this.wins._winStick(this._idd,false);};dhtmlXWindowsCell.prototype.isSticked=function(){return this.wins.w[this._idd].conf.sticked==true;};dhtmlXWindowsCell.prototype.setDimension=function(e,a){var c=this.wins.w[this._idd];if(c.conf.parked){this.wins._winPark(this._idd,false);} +if(c.conf.maxed){if(e!=null){c.conf.lastMW=e;} +if(a!=null){c.conf.lastMH=a;} +this.wins._winMinmax(this._idd);}else{this.wins._winSetSize(this._idd,e,a,false,true);} +c=null;};dhtmlXWindowsCell.prototype.getDimension=function(){var a=this.wins.w[this._idd];var c=[a.conf.w,a.conf.h];a=null;return c;};dhtmlXWindowsCell.prototype.setMinDimension=function(e,a){var c=this.wins.w[this._idd];c.conf.min_w=e;c.conf.min_h=a;this.wins._winSetSize(this._idd,c.conf.w,c.conf.h);c=null;};dhtmlXWindowsCell.prototype.getMinDimension=function(){var a=this.wins.w[this._idd];var c=[a.conf.min_w,a.conf.min_h];a=null;return c;};dhtmlXWindowsCell.prototype.setMaxDimension=function(e,a){var c=this.wins.w[this._idd];c.conf.max_w=e;c.conf.max_h=a;this.wins._winSetSize(this._idd,c.conf.w,c.conf.h);c=null;};dhtmlXWindowsCell.prototype.getMaxDimension=function(){var a=this.wins.w[this._idd];var c=[a.conf.max_w,a.conf.max_h];a=null;return c;};dhtmlXWindowsCell.prototype.keepInViewport=function(a){this.wins.w[this._idd].conf.keep_in_vp=window.dhx4.s2b(a);};dhtmlXWindowsCell.prototype.center=function(){var e=this.wins.vp;var c=this.wins.w[this._idd];var a=Math.round((e.clientWidth-c.conf.w)/2);var g=Math.round((e.clientHeight-c.conf.h)/2);this.wins._winSetPosition(this._idd,a,g);e=c=null;};dhtmlXWindowsCell.prototype.centerOnScreen=function(){var c=this.wins.w[this._idd];var j=window.dhx4.screenDim();var h=window.dhx4.absLeft(this.wins.vp);var g=window.dhx4.absTop(this.wins.vp);var e=this.wins.vp.parentNode;while(e!=null){if(e.scrollLeft){h=h-e.scrollLeft;} +if(e.scrollTop){g=g-e.scrollTop;} +e=e.parentNode;} +var a=Math.round((j.right-j.left-c.conf.w)/2);var l=Math.round((j.bottom-j.top-c.conf.h)/2);this.wins._winAdjustPosition(this._idd,a-h,l-g);d=c=null;};dhtmlXWindowsCell.prototype.bringToTop=function(){this.wins._winMakeActive(this._idd,true);};dhtmlXWindowsCell.prototype.bringToBottom=function(){var a=this.wins.w[this._idd].conf.actv?null:this.wins.conf.last_active;window.dhx4.zim.clear(this.wins.w[this._idd].conf.z_id);this.wins.w[this._idd].win.style.zIndex=0;this.wins._winMakeActive(a,true);};dhtmlXWindowsCell.prototype.isOnTop=function(){return this.wins.w[this._idd].conf.actv==true;};dhtmlXWindowsCell.prototype.isOnBottom=function(){var e={id:null,z:+Infinity};for(var c in this.wins.w){if(this.wins.w[c].conf.visible&&this.wins.w[c].win.style.zIndex20||Math.abs(l)>20)){if(a.conf.dnd_tm!=null){window.clearTimeout(a.conf.dnd_tm);a.conf.dnd_tm=null;} +window.removeEventListener(window.dhx4.dnd.evs.start,a._dndOnMouseMove,false);return;}} +if(h.ready!=true){return;} +var g=a.w[h.id];if(j.preventDefault){j.preventDefault();}else{j.returnValue=false;} +if(h.css!=true){if(h.css_touch==false){g.win.className+=" dhxwin_dnd";} +g.fr_cover.className+=" dhxwin_fr_cover_dnd";h.css=true;} +if(h.css_vp!=true){a.vp.className+=" dhxwins_vp_dnd";h.css_vp=true;} +h.newX=g.conf.x+c;h.newY=g.conf.y+l;if(h.mode=="tr"){h.newX=Math.min(Math.max(h.newX,h.minX),h.maxX);c=h.newX-g.conf.x;h.newY=Math.min(Math.max(h.newY,h.minY),h.maxY);l=h.newY-g.conf.y;g.win.style[h.tr]="translate("+c+"px,"+l+"px)";if(g.fr_m_cover!=null){g.fr_m_cover.style[h.tr]=g.win.style[h.tr];}}else{if(h.newXh.maxX){h.newX=Math.min(Math.max(h.newX,h.minX),h.maxX);}else{h.x=a._dndPos(j,"X");} +if(h.newYh.maxY){h.newY=Math.min(Math.max(h.newY,h.minY),h.maxY);}else{h.y=a._dndPos(j,"Y");} +a._winSetPosition(h.id,h.newX,h.newY);} +h.moved=true;g=h=null;};this._dndOnMouseUp=function(h){h=h||event;if(a.conf.dnd!=null){var g=a.conf.dnd;var c=a.w[g.id];if(g.newX!=null){if(g.mode=="tr"){a._winSetPosition(g.id,g.newX,g.newY);c.win.style[g.tr]="translate(0px,0px)";if(c.fr_m_cover!=null){c.fr_m_cover.style[g.tr]=c.win.style[g.tr];}}} +if(g.css==true){if(g.css_touch==false){c.win.className=String(c.win.className).replace(/\s{0,}dhxwin_dnd/gi,"");} +c.fr_cover.className=String(c.fr_cover.className).replace(/\s{0,}dhxwin_fr_cover_dnd/gi,"");} +if(g.css_touch==true){c.win.className=String(c.win.className).replace(/\s{0,}dhxwin_dnd_touch/gi,"");} +if(g.css_vp==true){a.vp.className=String(a.vp.className).replace(/\s{0,}dhxwins_vp_dnd/gi,"");} +a._dndUnloadEvents();if(g.moved==true){a._callMainEvent("onMoveFinish",g.id);}else{a._callMainEvent("onMoveCancel",g.id);} +c=g=a.conf.dnd=null;} +if(window.dhx4.dnd.p_en==true&&h.type==window.dhx4.dnd.evs.end){window.dhx4.dnd._touchOn();window.removeEventListener(window.dhx4.dnd.evs.end,a._dndOnMouseUp,false);window.removeEventListener(window.dhx4.dnd.evs.move,a._dndOnMouseMove,false);if(a.conf.dnd_tm!=null){window.clearTimeout(a.conf.dnd_tm);} +a.conf.dnd_tm=null;}};this._dndOnSelectStart=function(c){c=c||event;if(c.preventDefault){c.preventDefault();}else{c.returnValue=false;} +return false;};this._dndInitEvents=function(){if(typeof window.addEventListener=="function"){window.addEventListener("mousemove",this._dndOnMouseMove,false);window.addEventListener("mouseup",this._dndOnMouseUp,false);window.addEventListener("selectstart",this._dndOnSelectStart,false);}else{document.body.attachEvent("onmousemove",this._dndOnMouseMove);document.body.attachEvent("onmouseup",this._dndOnMouseUp);document.body.attachEvent("onselectstart",this._dndOnSelectStart);}};this._dndUnloadEvents=function(){if(typeof window.addEventListener=="function"){window.removeEventListener("mousemove",this._dndOnMouseMove,false);window.removeEventListener("mouseup",this._dndOnMouseUp,false);window.removeEventListener("selectstart",this._dndOnSelectStart,false);}else{document.body.detachEvent("onmousemove",this._dndOnMouseMove);document.body.detachEvent("onmouseup",this._dndOnMouseUp);document.body.detachEvent("onselectstart",this._dndOnSelectStart);}};this._dndUnloadModule=function(){this.detachEvent(this.conf.dnd_evid);this.conf.dnd_evid=null;this._dndOnMouseDown=null;this._dndOnMouseMove=null;this._dndOnMouseUp=null;this._dndOnSelectStart=null;this._dndInitEvents=null;this._dndUnloadEvents=null;this._dndInitModule=null;this._dndUnloadModule=null;a=null;};this._dndPos=function(e,c){var g=e[this.conf.dnd_ev_prefix+c];if((g==null||g==0)&&e.touches!=null){g=e.touches[0][this.conf.dnd_ev_prefix+c];} +return g;};this.conf.dnd_evid=this.attachEvent("_winMouseDown",function(g,c){if(this.w[c.id]==null||this.w[c.id].conf.allow_move!=true){return;} +if(typeof g.button!="undefined"&&g.button>=2){return;} +if(g.type==window.dhx4.dnd.evs.start){if(c.mode=="hdr"){if(this.w[c.id].conf.maxed&&this.w[c.id].conf.max_w==null&&this.w[c.id].conf.max_h==null){return;} +this.conf.dnd_ev_prefix="page";this.conf.dnd={x:this._dndPos(g,"X"),y:this._dndPos(g,"Y")};if(this.conf.dnd_time<1){this._dndOnMouseDown(g,c.id);}else{if(this.conf.dnd_tm!=null){window.clearTimeout(this.conf.dnd_tm);} +this.conf.dnd_tm=window.setTimeout(function(){a._dndOnMouseDown(g,c.id);},this.conf.dnd_time);} +if(window.dhx4.dnd.p_en==true){window.dhx4.dnd._touchOff();window.addEventListener(window.dhx4.dnd.evs.end,this._dndOnMouseUp,false);} +window.addEventListener(window.dhx4.dnd.evs.move,this._dndOnMouseMove,false);} +return false;} +if(g.type==window.dhx4.dnd.evs.end){if(this.conf.dnd_tm!=null){window.clearTimeout(this.conf.dnd_tm);this.conf.dnd_tm=null;} +this._dndOnMouseUp(g);window.removeEventListener(window.dhx4.dnd.evs.move,this._dndOnMouseMove,false);return false;} +this.conf.dnd_ev_prefix="client";if(!(c.mode=="hdr"&&g.type=="mousedown")){return;} +if(this.w[c.id].conf.maxed&&this.w[c.id].conf.max_w==null&&this.w[c.id].conf.max_h==null){return;} +if(g.preventDefault){g.preventDefault();}else{g.returnValue=false;} +this._dndOnMouseDown(g,c.id);return false;});};dhtmlXWindowsCell.prototype._initResize=function(){var a=this;var c=navigator.userAgent;this.conf.resize={b_width:6,c_type:c.indexOf("MSIE 10.0")>0||c.indexOf("MSIE 9.0")>0||c.indexOf("MSIE 8.0")>0||c.indexOf("MSIE 7.0")>0||c.indexOf("MSIE 6.0")>0,btn_left:(window.dhx4.isIE6||window.dhx4.isIE7||window.dhx4.isIE8)&&typeof window.addEventListener=="undefined"?1:0,};this._rOnCellMouseMove=function(m){if(a.wins.conf.resize_actv==true||a.wins.w[a._idd].conf.allow_resize==false||a.conf.progress==true||a.wins.w[a._idd].conf.maxed==true||a.wins.w[a._idd].conf.fs_mode==true){var j=a.wins.w[a._idd].brd;if(j.style.cursor!="default"){j.style.cursor="default";} +j=null;return;} +m=m||event;var v=a.wins.w[a._idd].brd;var g=a.conf.resize;var o=a.wins.w[a._idd].conf.header==false;var s=m.clientX;var n=m.clientY;var h=window.dhx4.absLeft(v);var u=window.dhx4.absTop(v);var l="";if(s<=h+g.b_width){l="w";}else{if(s>=h+v.offsetWidth-g.b_width){l="e";}} +if(n>=u+v.offsetHeight-g.b_width){l="s"+l;}else{if(o&&n<=u+g.b_width){l="n"+l;}} +if(l==""){l=false;} +if(g.mode!=l){g.mode=l;if(l==false){v.style.cursor="default";}else{v.style.cursor=l+"-resize";}} +v=g=null;};this._rOnCellMouseDown=function(l){l=l||event;if(typeof l.button!="undefined"&&l.button!=a.conf.resize.btn_left){return;} +if(a.conf.resize.mode==false){return;} +if(a.conf.progress==true){return;} +if(a.wins.w[a._idd].conf.allow_resize==false){return;} +if(a.wins.w[a._idd].conf.fs_mode==true){return;} +if(l.preventDefault){l.preventDefault();}else{l.returnValue=false;} +if(a.wins._callMainEvent("onBeforeResizeStart",a._idd)!==true){return;} +var g=a.wins.w[a._idd];var j=a.conf.resize;a.wins.conf.resize_actv=true;j.min_w=g.conf.min_w;j.min_h=g.conf.min_h;j.max_w=g.conf.max_w||+Infinity;j.max_h=g.conf.max_h||+Infinity;if(g.cell.dataType=="layout"&&g.cell.dataObj!=null&&typeof g.cell.dataObj._getWindowMinDimension=="function"){var h=g.cell.dataObj._getWindowMinDimension(g.cell);j.min_w=Math.max(h.w,j.min_w);j.min_h=Math.max(h.h,j.min_h);} +j.vp_l=a.wins.conf.vp_pos_ofs;j.vp_r=a.wins.vp.clientWidth-a.wins.conf.vp_pos_ofs;j.vp_b=a.wins.vp.clientHeight-a.wins.conf.vp_pos_ofs;j.x=l.clientX;j.y=l.clientY;if(typeof window.addEventListener=="function"){window.addEventListener("mousemove",a._rOnWinMouseMove,false);window.addEventListener("mouseup",a._rOnWinMouseUp,false);window.addEventListener("selectstart",a._rOnSelectStart,false);}else{document.body.attachEvent("onmousemove",a._rOnWinMouseMove);document.body.attachEvent("onmouseup",a._rOnWinMouseUp);document.body.attachEvent("onselectstart",a._rOnSelectStart);} +j.resized=false;j.vp_cursor=a.wins.vp.style.cursor;a.wins.vp.style.cursor=j.mode+"-resize";g=j=null;};this._rOnCellContextMenu=function(g){g=g||event;if(g.preventDefault){g.preventDefault();}else{g.returnValue=false;} +return false;};this._rOnWinMouseMove=function(l){l=l||event;var h=a.wins.w[a._idd];var j=a.conf.resize;if(!j.resized){h.fr_cover.className+=" dhxwin_fr_cover_resize";j.resized=true;} +var g=l.clientX-j.x;var m=l.clientY-j.y;if(j.mode.indexOf("e")>=0){j.rw=Math.min(Math.max(h.conf.w+g,j.min_w),j.max_w);j.rx=null;if(h.conf.x+j.rwa.wins.vp.clientWidth){j.rw=a.wins.vp.clientWidth-h.conf.x;}}}else{if(j.mode.indexOf("w")>=0){j.rw=Math.min(Math.max(h.conf.w-g,j.min_w),j.max_w);j.rx=h.conf.x+h.conf.w-j.rw;if(j.rx<0){j.rw=j.rw+j.rx;j.rx=0;}else{if(j.rx>j.vp_r){j.rw=j.rw-j.vp_r;j.rx=j.vp_r;}}}} +if(j.mode.indexOf("s")>=0){j.rh=Math.min(Math.max(h.conf.h+m,j.min_h),j.max_h);j.ry=null;if(h.conf.y+j.rh>a.wins.vp.clientHeight){j.rh=a.wins.vp.clientHeight-h.conf.y;}}else{if(j.mode.indexOf("n")>=0){j.rh=Math.min(Math.max(h.conf.h-m,j.min_h),j.max_h);j.ry=h.conf.y+h.conf.h-j.rh;if(j.ry<0){j.rh=j.rh+j.ry;j.ry=0;}else{if(j.ry>j.vp_b){j.rh=j.rh-j.vp_b;j.ry=j.vp_b;}}}} +a._rAdjustSizer();h=j=null;};this._rOnWinMouseUp=function(){var g=a.conf.resize;var e=a.wins.w[a._idd];a.wins.conf.resize_actv=false;a.wins.vp.style.cursor=g.vp_cursor;e.fr_cover.className=String(e.fr_cover.className).replace(/\s{0,}dhxwin_fr_cover_resize/gi,"");if(g.resized){a.wins._winSetSize(a._idd,g.rw,g.rh);if(g.rx==null){g.rx=e.conf.x;} +if(g.ry==null){g.ry=e.conf.y;} +if(g.rx!=e.conf.x||g.ry!=e.conf.y){a.wins._winSetPosition(a._idd,g.rx,g.ry);}} +if(g.obj!=null){g.obj.parentNode.removeChild(g.obj);g.obj=null;} +if(g.objFR!=null){g.objFR.parentNode.removeChild(g.objFR);g.objFR=null;} +if(typeof window.addEventListener=="function"){window.removeEventListener("mousemove",a._rOnWinMouseMove,false);window.removeEventListener("mouseup",a._rOnWinMouseUp,false);window.removeEventListener("selectstart",a._rOnSelectStart,false);}else{document.body.detachEvent("onmousemove",a._rOnWinMouseMove);document.body.detachEvent("onmouseup",a._rOnWinMouseUp);document.body.detachEvent("onselectstart",a._rOnSelectStart);} +if(g.resized==true){if(a.dataType=="layout"&&a.dataObj!=null){a.dataObj.callEvent("onResize",[]);} +a.wins._callMainEvent("onResizeFinish",a._idd);}else{a.wins._callMainEvent("onResizeCancel",a._idd);} +g.mode="";e=g=null;};this._rOnSelectStart=function(g){g=g||event;if(g.preventDefault){g.preventDefault();}else{g.returnValue=false;} +return false;};this._rInitSizer=function(){var g=a.conf.resize;var e=a.wins.w[a._idd];g.obj=document.createElement("DIV");g.obj.className="dhxwin_resize";g.obj.style.zIndex=e.win.style.zIndex;g.obj.style.cursor=g.mode+"-resize";a.wins.vp.appendChild(g.obj);if(a.wins.conf.fr_cover==true){g.objFR=document.createElement("IFRAME");g.objFR.className="dhxwin_resize_fr_cover";g.objFR.style.zIndex=g.obj.style.zIndex;a.wins.vp.insertBefore(g.objFR,g.obj);} +g.rx=e.conf.x;g.ry=e.conf.y;g.rw=e.conf.w;g.rh=e.conf.h;g=null;};this._rAdjustSizer=function(){var e=a.conf.resize;if(!e.obj){this._rInitSizer();} +e.obj.style.width=e.rw+"px";e.obj.style.height=e.rh+"px";if(e.rx!=null){e.obj.style.left=e.rx+"px";} +if(e.ry!=null){e.obj.style.top=e.ry+"px";} +if(e.objFR!=null){e.objFR.style.width=e.obj.style.width;e.objFR.style.height=e.obj.style.height;if(e.rx!=null){e.objFR.style.left=e.obj.style.left;} +if(e.ry!=null){e.objFR.style.top=e.obj.style.top;}} +e=null;};if(typeof window.addEventListener=="function"){this.wins.w[this._idd].brd.addEventListener("mousemove",this._rOnCellMouseMove,false);this.wins.w[this._idd].brd.addEventListener("mousedown",this._rOnCellMouseDown,false);this.wins.w[this._idd].brd.addEventListener("contextmenu",this._rOnCellContextMenu,false);}else{this.wins.w[this._idd].brd.attachEvent("onmousemove",this._rOnCellMouseMove);this.wins.w[this._idd].brd.attachEvent("onmousedown",this._rOnCellMouseDown);this.wins.w[this._idd].brd.attachEvent("oncontextmenu",this._rOnCellContextMenu);} +this._unloadResize=function(){if(typeof window.addEventListener=="function"){this.wins.w[this._idd].brd.removeEventListener("mousemove",this._rOnCellMouseMove,false);this.wins.w[this._idd].brd.removeEventListener("mousedown",this._rOnCellMouseDown,false);this.wins.w[this._idd].brd.removeEventListener("contextmenu",this._rOnCellContextMenu,false);}else{this.wins.w[this._idd].brd.detachEvent("onmousemove",this._rOnCellMouseMove);this.wins.w[this._idd].brd.detachEvent("onmousedown",this._rOnCellMouseDown);this.wins.w[this._idd].brd.detachEvent("oncontextmenu",this._rOnCellContextMenu);} +this._initResize=null;this._rOnCellMouseMove=null;this._rOnCellMouseDown=null;this._rOnWinMouseMove=null;this._rOnWinMouseUp=null;this._rOnSelectStart=null;this._rInitSizer=null;this._rAdjustSizer=null;this._unloadResize=null;this.conf.resize=null;a=null;};};dhtmlXWindows.prototype.attachContextMenu=function(a){return this._renderContextMenu("icon",null,null,a);};dhtmlXWindows.prototype.getContextMenu=function(){if(this.cm!=null&&this.cm.global!=null){return this.cm.global;} +return null;};dhtmlXWindows.prototype.detachContextMenu=function(){this._detachContextMenu("icon",null,null);};dhtmlXWindowsCell.prototype.attachContextMenu=function(a){return this.wins._renderContextMenu("icon",this._idd,null,a);};dhtmlXWindowsCell.prototype.getContextMenu=function(){if(this.wins.cm!=null&&this.wins.cm.icon[this._idd]!=null){return this.wins.cm.icon[this._idd];} +return null;};dhtmlXWindowsCell.prototype.detachContextMenu=function(){this.wins._detachContextMenu("icon",this._idd,null);};dhtmlXWindowsButton.prototype.attachContextMenu=function(a){return this.conf.wins._renderContextMenu("button",this.conf.winId,this.conf.name,a);};dhtmlXWindowsButton.prototype.getContextMenu=function(){if(this.conf.wins.cm==null||this.conf.wins.cm.button[this.conf.winId]==null){return null;} +if(this.conf.wins.cm.button[this.conf.winId][this.conf.name]!=null){return this.conf.wins.cm.button[this.conf.winId][this.conf.name];} +return null;};dhtmlXWindowsButton.prototype.detachContextMenu=function(){this.conf.wins._detachContextMenu("button",this.conf.winId,this.conf.name);};dhtmlXWindows.prototype._renderContextMenu=function(l,j,e,c){var g=this;var a=false;if(this.cm==null){this.cm={global:null,icon:{},button:{}};a=true;} +if(j==null){if(this.cm.global!=null){return;}}else{if(l=="icon"){if(this.cm.icon[j]!=null){return;}}else{if(l=="button"){if(this.cm.button[j]!=null&&this.cm.button[j][e]!=null){return;}}}} +if(c==null){c={};} +c.parent=null;c.context=true;var h=new dhtmlXMenuObject(c);h.setAutoHideMode(false);h.attachEvent("onShow",function(){this.conf.wins_menu_open=true;});h.attachEvent("onHide",function(){this.conf.wins_menu_open=false;g.conf.opened_menu=null;});if(j==null){this.cm.global=h;}else{if(l=="icon"){this.cm.icon[j]=h;}else{if(l=="button"){if(this.cm.button[j]==null){this.cm.button[j]={};} +this.cm.button[j][e]=h;}}} +if(a){this._showContextMenu=function(r,o){if(r.button>=2){return;} +if(o.mode=="icon"&&o.id!=null&&o.press_type=="mousedown"){var s=this.cm.icon[o.id]||this.cm.global;if(s==null){return;} +r.cancelBubble=true;var n=this.w[o.id].hdr.firstChild;if(s.conf.wins_menu_open&&this.conf.opened_menu==o.id){s.hideContextMenu();}else{this._hideContextMenu();s.showContextMenu(window.dhx4.absLeft(n),window.dhx4.absTop(n)+n.offsetHeight);this.conf.opened_menu=o.id;} +s=n=null;} +if(o.mode=="button"&&o.id!=null&&o.press_type=="mousedown"){if(this.cm.button[o.id]==null||this.cm.button[o.id][o.button_name]==null){return;} +r.cancelBubble=true;this.conf.button_last=null;var s=this.cm.button[o.id][o.button_name];var m=this.w[o.id].b[o.button_name].button;if(s.conf.wins_menu_open&&this.conf.opened_menu==o.id){s.hideContextMenu();}else{this._hideContextMenu();s.showContextMenu(window.dhx4.absLeft(m),window.dhx4.absTop(m)+m.offsetHeight);this.conf.opened_menu=o.id;} +s=m=null;}};this._hideContextMenu=function(u){if(u!=null){u=u||event;if(u.type=="keydown"&&u.keyCode!=27){return;} +var s=u.target||u.srcElement;var o=true;while(s!=null&&o==true){if(s.className!=null&&s.className.search(/SubLevelArea_Polygon/)>=0){o=false;}else{s=s.parentNode;}}} +if(o||u==null){if(g.cm.global!=null){g.cm.global.hideContextMenu();} +for(var r in g.cm.icon){if(g.cm.icon[r]!=null){g.cm.icon[r].hideContextMenu();}} +for(var r in g.cm.button){for(var n in g.cm.button[r]){if(g.cm.button[r][n]!=null){g.cm.button[r][n].hideContextMenu();}}}}};this._detachContextMenu=function(o,n,m){if(this.cm==null){return;} +if(n==null){if(this.cm.global!=null){this.cm.global.unload();this.cm.global=null;}}else{if(o=="icon"){if(this.cm.icon[n]!=null){this.cm.icon[n].unload();this.cm.icon[n]=null;}}else{if(o=="button"){if(this.cm.button[n]!=null&&this.cm.button[n][m]!=null){this.cm.button[n][m].unload();this.cm.button[n][m]=null;}}}}};this.attachEvent("_winMouseDown",this._showContextMenu);if(typeof window.addEventListener=="function"){window.addEventListener("mousedown",this._hideContextMenu,false);window.addEventListener("keydown",this._hideContextMenu,false);}else{document.body.attachEvent("onmousedown",this._hideContextMenu);document.body.attachEvent("onkeydown",this._hideContextMenu);} +this._unloadContextMenu=function(){this._detachContextMenu("icon",null,null);this.cm=null;if(typeof window.addEventListener=="function"){window.removeEventListener("mousedown",this._hideContextMenu,false);window.removeEventListener("keydown",this._hideContextMenu,false);}else{document.body.detachEvent("onmousedown",this._hideContextMenu);document.body.detachEvent("onkeydown",this._hideContextMenu);} +g=null;};} +return h;};if(!window.dhtmlx){window.dhtmlx={};} +(function(){var o=null;function s(y,w){var x=y.callback;r(false);y.box.parentNode.removeChild(y.box);o=y.box=null;if(x){x(w);}} +function a(x){if(o){x=x||event;var w=x.which||event.keyCode;if(dhtmlx.message.keyboard){if(w==13||w==32){s(o,true);} +if(w==27){s(o,false);}} +if(x.preventDefault){x.preventDefault();} +return!(x.cancelBubble=true);}} +if(document.attachEvent){document.attachEvent("onkeydown",a);}else{document.addEventListener("keydown",a,true);} +function r(x){if(!r.cover){r.cover=document.createElement("DIV");r.cover.onkeydown=a;r.cover.className="dhx_modal_cover";document.body.appendChild(r.cover);} +var w=document.body.scrollHeight;r.cover.style.display=x?"inline-block":"none";} +function j(x,w){return"
"+x+"
";} +function e(x){if(!u.area){u.area=document.createElement("DIV");u.area.className="dhtmlx_message_area";u.area.style[u.position]="5px";document.body.appendChild(u.area);} +u.hide(x.id);var w=document.createElement("DIV");w.innerHTML="
"+x.text+"
";w.className="dhtmlx-info dhtmlx-"+x.type;w.onclick=function(){if(x){u.hide(x.id);} +x=null;};if(u.position=="bottom"&&u.area.firstChild){u.area.insertBefore(w,u.area.firstChild);}else{u.area.appendChild(w);} +if(x.expire>0){u.timers[x.id]=window.setTimeout(function(){u.hide(x.id);},x.expire);} +u.pull[x.id]=w;w=null;return x.id;} +function l(x,A,E){var D=document.createElement("DIV");D.className=" dhtmlx_modal_box dhtmlx-"+x.type;D.setAttribute("dhxbox",1);var w="";if(x.width){D.style.width=x.width;} +if(x.height){D.style.height=x.height;} +if(x.title){w+='
'+x.title+"
";} +w+='
'+(x.content?"":x.text)+'
';if(A){w+=j(x.ok||"OK",true);} +if(E){w+=j(x.cancel||"Cancel",false);} +if(x.buttons){for(var y=0;y1){var c=arguments[0];a=arguments[1];}else{var c=dhx.isArray(a)?[]:{};} +for(var e in a){if(a[e]&&typeof a[e]=="object"&&!dhx.isDate(a[e])){c[e]=dhx.isArray(a[e])?[]:{};dhx.copy(c[e],a[e]);}else{c[e]=a[e];}} +return c;};dhx.single=function(e){var a=null;var c=function(g){if(!a){a=new e({});} +if(a._reinit){a._reinit.apply(a,arguments);} +return a;};return c;};dhx.protoUI=function(){if(dhx.debug_proto){dhx.log("UI registered: "+arguments[0].name);} +var e=arguments;var a=e[0].name;var c=function(h){if(!c){return dhx.ui[a].prototype;} +var l=c._dhx_proto_wait;if(l){var j=[l[0]];for(var g=1;g0;g--){dhx.assert(j[g],"Invalid mixing source");if(typeof j[g]=="function"){j[g]=j[g].prototype;} +if(j[g].$init){m.push(j[g].$init);} +if(j[g].defaults){var e=j[g].defaults;if(!h.defaults){h.defaults={};} +for(var a in e){if(dhx.isUndefined(h.defaults[a])){h.defaults[a]=e[a];}}} +if(j[g].type&&h.type){for(var a in j[g].type){if(!h.type[a]){h.type[a]=j[g].type[a];}}} +for(var l in j[g]){if(!h[l]){h[l]=j[g][l];}}} +if(c){m.push(h.$init);} +h.$init=function(){for(var o=0;o=0){this.splice(c,a||1);}},remove:function(a){this.removeAt(this.find(a));},insertAt:function(c,e){if(!e&&e!==0){this.push(c);}else{var a=this.splice(e,this.length-e);this[e]=c;this.push.apply(this,a);}},find:function(c){for(var a=0;a")!=-1){h=h.split("->");switch(h[0]){case"html":h=dhx.html.getValue(h[1]);break;case"http":h=new dhx.ajax().sync().get(h[1],{uid:dhx.uid()}).responseText;break;default:break;}} +h=(h||"").toString();h=h.replace(c,"\\n");h=h.replace(a,'\\"');h=h.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g,'"+(obj.$1?"$2":"$3")+"');h=h.replace(/\{common\.([^}\(]*)\}/g,"\"+(common.$1||'')+\"");h=h.replace(/\{common\.([^\}\(]*)\(\)\}/g,'"+(common.$1?common.$1.apply(this, arguments):"")+"');h=h.replace(/\{obj\.([^}]*)\}/g,'"+(obj.$1)+"');h=h.replace("{obj}",'"+obj+"');h=h.replace(/#([^#'";, ]+)#/gi,'"+(obj.$1)+"');try{e[h]=Function("obj","common",'return "'+h+'";');}catch(g){dhx.assert_error("Invalid template:"+h);} +return e[h];};dhx.Template.empty=function(){return"";};dhx.Template.bind=function(g){return dhx.bind(dhx.Template(g),this);};dhx.Type=function(m,l){if(m._dhx_proto_wait){if(!m._dhx_type_wait){m._dhx_type_wait=[];} +m._dhx_type_wait.push(l);return;} +if(typeof m=="function"){m=m.prototype;} +if(!m.types){m.types={default:m.type};m.type.name="default";} +var g=l.name;var j=m.type;if(g){j=m.types[g]=dhx.clone(l.baseType?m.types[l.baseType]:m.type);} +for(var h in l){if(h.indexOf("template")===0){j[h]=dhx.Template(l[h]);}else{j[h]=l[h];}} +return g;};})();dhx.Settings={$init:function(){this._settings=this.config={};},define:function(c,a){if(typeof c=="object"){return this._parseSeetingColl(c);} +return this._define(c,a);},_define:function(c,a){var e=this[c+"_setter"];return(this._settings[c]=e?e.call(this,a,c):a);},_parseSeetingColl:function(e){if(e){for(var c in e){this._define(c,e[c]);}}},_parseSettings:function(e,a){var c={};if(a){c=dhx.extend(c,a);} +if(typeof e=="object"&&!e.tagName){dhx.extend(c,e,true);} +this._parseSeetingColl(c);},_mergeSettings:function(a,e){for(var c in e){switch(typeof a[c]){case"object":a[c]=this._mergeSettings(a[c]||{},e[c]);break;case"undefined":a[c]=e[c];break;default:break;}} +return a;},debug_freid_c_id:true,debug_freid_a_name:true,};dhx.ajax=function(a,c,e){if(arguments.length!==0){var g=new dhx.ajax();if(e){g.master=e;} +return g.get(a,null,c);} +if(!this.getXHR){return new dhx.ajax();} +return this;};dhx.ajax.count=0;dhx.ajax.prototype={master:null,getXHR:function(){if(dhx.env.isIE){return new ActiveXObject("Microsoft.xmlHTTP");}else{return new XMLHttpRequest();}},send:function(h,n,l){var c=this.getXHR();if(!dhx.isArray(l)){l=[l];} +if(typeof n=="object"){var j=[];for(var e in n){var m=n[e];if(m===null||m===dhx.undefined){m="";} +j.push(e+"="+encodeURIComponent(m));} +n=j.join("&");} +if(n&&this.request==="GET"){h=h+(h.indexOf("?")!=-1?"&":"?")+n;n=null;} +c.open(this.request,h,!this._sync);if(this.request==="POST"){c.setRequestHeader("Content-type","application/x-www-form-urlencoded");} +var g=this;c.onreadystatechange=function(){if(!c.readyState||c.readyState==4){if(dhx.debug_time){dhx.log_full_time("data_loading");} +dhx.ajax.count++;if(l&&g){for(var a=0;a=400||(!c.status&&!c.responseText)){o=l[a].error;} +if(o){o.call(g.master||g,c.responseText,c.responseXML,c);}}}} +if(g){g.master=null;} +l=g=null;}};c.send(n||null);return c;},get:function(a,e,c){if(arguments.length==2){c=e;e=null;} +this.request="GET";return this.send(a,e,c);},post:function(a,e,c){this.request="POST";return this.send(a,e,c);},put:function(a,e,c){this.request="PUT";return this.send(a,e,c);},del:function(a,e,c){this.request="DELETE";return this.send(a,e,c);},sync:function(){this._sync=true;return this;},bind:function(a){this.master=a;return this;},};dhx.send=function(e,c,l,j){var g=dhx.html.create("FORM",{target:j||"_self",action:e,method:l||"POST"},"");for(var a in c){var h=dhx.html.create("INPUT",{type:"hidden",name:a,value:c[a]},"");g.appendChild(h);} +g.style.display="none";document.body.appendChild(g);g.submit();document.body.removeChild(g);};dhx.AtomDataLoader={$init:function(a){this.data={};if(a){this._settings.datatype=a.datatype||"json";this.$ready.push(this._load_when_ready);}},_load_when_ready:function(){this._ready_for_data=true;if(this._settings.url){this.url_setter(this._settings.url);} +if(this._settings.data){this.data_setter(this._settings.data);}},url_setter:function(a){if(!this._ready_for_data){return a;} +this.load(a,this._settings.datatype);return a;},data_setter:function(a){if(!this._ready_for_data){return a;} +this.parse(a,this._settings.datatype);return true;},debug_freid_c_datatype:true,debug_freid_c_dataFeed:true,load:function(a,c){if(a.$proxy){a.load(this,typeof c=="string"?c:"json");return;} +this.callEvent("onXLS",[]);if(typeof c=="string"){this.data.driver=dhx.DataDriver[c];c=arguments[2];}else{if(!this.data.driver){this.data.driver=dhx.DataDriver.json;}} +var e=[{success:this._onLoad,error:this._onLoadError}];if(c){if(dhx.isArray(c)){e.push.apply(e,c);}else{e.push(c);}} +return dhx.ajax(a,e,this);},parse:function(c,a){this.callEvent("onXLS",[]);this.data.driver=dhx.DataDriver[a||"json"];this._onLoad(c,null);},_onLoad:function(l,c,a,e){var h=this.data.driver;var g=h.toObject(l,c);if(g){var j=h.getRecords(g)[0];this.data=h?h.getDetails(j):l;}else{this._onLoadError(l,c,a);} +this.callEvent("onXLE",[]);},_onLoadError:function(e,a,c){this.callEvent("onXLE",[]);this.callEvent("onLoadError",arguments);dhx4.callEvent("onLoadError",[e,a,c,this]);},_check_data_feed:function(c){if(!this._settings.dataFeed||this._ignore_feed||!c){return true;} +var a=this._settings.dataFeed;if(typeof a=="function"){return a.call(this,c.id||c,c);} +a=a+(a.indexOf("?")==-1?"?":"&")+"action=get&id="+encodeURIComponent(c.id||c);this.callEvent("onXLS",[]);dhx.ajax(a,function(j,g,e){this._ignore_feed=true;var h=dhx.DataDriver.toObject(j,g);if(h){this.setValues(h.getDetails(h.getRecords()[0]));}else{this._onLoadError(j,g,e);} +this._ignore_feed=false;this.callEvent("onXLE",[]);},this);return false;},};dhx.DataDriver={};dhx.DataDriver.json={toObject:function(data){if(!data){data="[]";} +if(typeof data=="string"){try{eval("dhx.temp="+data);}catch(e){dhx.assert_error(e);return null;} +data=dhx.temp;} +if(data.data){var t=(data.data.config={});for(var key in data){if(key!="data"){t[key]=data[key];}} +data=data.data;} +return data;},getRecords:function(a){if(a&&!dhx.isArray(a)){return[a];} +return a;},getDetails:function(a){if(typeof a=="string"){return{id:dhx.uid(),value:a};} +return a;},getInfo:function(c){var a=c.config;if(!a){return{};} +return{_size:a.total_count||0,_from:a.pos||0,_parent:a.parent||0,_config:a.config,_key:a.dhx_security};},child:"data",};dhx.DataDriver.html={toObject:function(c){if(typeof c=="string"){var a=null;if(c.indexOf("<")==-1){a=dhx.toNode(c);} +if(!a){a=document.createElement("DIV");a.innerHTML=c;} +return a.getElementsByTagName(this.tag);} +return c;},getRecords:function(c){var e=[];for(var a=0;a=c+e){return true;}} +return false;},_onLoad:function(g,c,a){this._ajax_queue.remove(a);var e=this.data.driver.toObject(g,c);if(e){this.data._parse(e);}else{return this._onLoadError(g,c,a);} +this._call_onready();this.callEvent("onXLE",[]);},removeMissed_setter:function(a){return(this.data._removeMissed=a);},scheme_setter:function(a){this.data.scheme(a);},dataFeed_setter:function(a){this.data.attachEvent("onBeforeFilter",dhx.bind(function(l,j){if(this._settings.dataFeed){var h={};if(!l&&!j){return;} +if(typeof l=="function"){if(!j){return;} +l(j,h);}else{h={text:j};} +this.clearAll();var c=this._settings.dataFeed;var g=[];if(typeof c=="function"){return c.call(this,j,h);} +for(var e in h){g.push("dhx_filter["+e+"]="+encodeURIComponent(h[e]));} +this.load(c+(c.indexOf("?")<0?"?":"&")+g.join("&"),this._settings.datatype);return false;}},this));return a;},debug_freid_c_ready:true,debug_freid_c_datathrottle:true,_call_onready:function(){if(this._settings.ready&&!this._ready_was_used){var a=dhx.toFunctor(this._settings.ready);if(a){dhx.delay(a,this,arguments);} +this._ready_was_used=true;}},_call_onclearall:function(){for(var a=0;ae){var c=e;e=g;g=c;} +return this.getIndexRange(g,e);},getIndexRange:function(g,e){e=Math.min(e||Infinity,this.dataCount()-1);var a=dhx.toArray();for(var c=g||0;c<=e;c++){a.push(this.item(this.order[c]));} +return a;},dataCount:function(){return this.order.length;},exists:function(a){return!!this.pull[a];},move:function(a,g){dhx.assert(a>=0&&g>=0,"DataStore::move","Incorrect indexes");var e=this.idByIndex(a);var c=this.item(e);this.order.removeAt(a);this.order.insertAt(e,Math.min(this.order.length,g));this.callEvent("onStoreUpdated",[e,c,"move"]);},scheme:function(a){this._scheme={};this._scheme_init=a.$init;this._scheme_update=a.$update;this._scheme_serialize=a.$serialize;this._scheme_group=a.$group;this._scheme_sort=a.$sort;for(var c in a){if(c.substr(0,1)!="$"){this._scheme[c]=a[c];}}},sync:function(g,e,a){if(typeof g=="string"){g=$$("source");} +if(typeof e!="function"){a=e;e=null;} +if(dhx.debug_bind){this.debug_sync_master=g;dhx.log("[sync] "+this.debug_bind_master.name+"@"+this.debug_bind_master._settings.id+" <= "+this.debug_sync_master.name+"@"+this.debug_sync_master._settings.id);} +this._backbone_source=false;if(g.name!="DataStore"){if(g.data&&g.data.name=="DataStore"){g=g.data;}else{this._backbone_source=true;}} +var c=dhx.bind(function(m,h,l){if(this._backbone_source){if(!m){return;} +if(m.indexOf("change")===0){if(m=="change"){this.pull[h.id]=h.attributes;this.refresh(h.id);return;}else{return;}} +if(m=="reset"){l=h;} +this.order=[];this.pull={};this._filter_order=null;for(var j=0;jh){dhx.log("Warning","DataStore:add","Index of out of bounds");c=Math.min(a.length,c);} +if(this.callEvent("onBeforeAdd",[l,j,c])===false){return false;} +dhx.assert(!this.exists(l),"Not unique ID");this.pull[l]=j;a.insertAt(l,c);if(this._filter_order){var g=this._filter_order.length;if(!c&&this.order.length){g=0;} +this._filter_order.insertAt(l,g);} +this.callEvent("onAfterAdd",[l,c]);this.callEvent("onStoreUpdated",[l,j,"add"]);return l;},remove:function(e){if(dhx.isArray(e)){for(var a=0;a=this.order.length||a<0){dhx.log("Warning","DataStore::idByIndex Incorrect index");} +return this.order[a];},indexById:function(c){var a=this.order.find(c);if(!this.pull[c]){dhx.log("Warning","DataStore::indexById Non-existing ID: "+c);} +return a;},next:function(c,a){return this.order[this.indexById(c)+(a||1)];},first:function(){return this.order[0];},last:function(){return this.order[this.order.length-1];},previous:function(c,a){return this.order[this.indexById(c)-(a||1)];},sort:function(h,c,a){var e=h;if(typeof h=="function"){e={as:h,dir:c};}else{if(typeof h=="string"){e={by:h.replace(/#/g,""),dir:c,as:a};}} +var g=[e.by,e.dir,e.as];if(!this.callEvent("onBeforeSort",g)){return;} +this._sort_core(e);this.refresh();this.callEvent("onAfterSort",g);},_sort_core:function(a){if(this.order.length){var e=this._sort._create(a);var c=this.getRange(this.first(),this.last());c.sort(e);this.order=c.map(function(g){dhx.assert(g,"Client sorting can't be used with dynamic loading");return this.id(g);},this);}},_filter_reset:function(a){if(this._filter_order&&!a){this.order=this._filter_order;delete this._filter_order;}},_filter_core:function(e,h,c){var g=dhx.toArray();for(var a=0;ac?1:ec?1:ec?1:ec?1:e "+c.name+"@"+c._settings.id);} +this._bind_update(c,this._bind_hash[a][0],this._bind_hash[a][1]);if(e&&c.filter){c.refresh();}}},addBind:function(a,e,c){this._bind_hash[a]=[e,c];},removeBind:function(a){delete this._bind_hash[a];delete this._bind_updated[a];delete this._ignore_binds[a];},_bind_specific_rules:function(a){if(a.filter){dhx.extend(this,dhx.CollectionBind);}else{if(a.setValue){dhx.extend(this,dhx.ValueBind);}else{dhx.extend(this,dhx.RecordBind);}}},_update_binds:function(){if(!this._do_not_update_binds){for(var a in this._bind_hash){if(this._ignore_binds[a]){continue;} +this._bind_updated[a]=false;this.getBindData(a,true);}}},_bind_update_common:function(e,c,a){if(e.setValue){e.setValue(a?a[c]:a);}else{if(!e.filter){if(!a&&e.clear){e.clear();}else{if(e._check_data_feed(a)){e.setValues(dhx.clone(a));}}}else{e.data.silent(function(){this.filter(c,a);});}} +e.callEvent("onBindApply",[a,c,this]);},};dhx.DataValue=dhx.proto({name:"DataValue",isVisible:function(){return true;},$init:function(a){this.data=""||a;var c=a&&a.id?a.id:dhx.uid();this._settings={id:c};dhx.ui.views[c]=this;},setValue:function(a){this.data=a;this.callEvent("onChange",[a]);},getValue:function(){return this.data;},refresh:function(){this.callEvent("onBindRequest");},},dhx.EventSystem,dhx.BaseBind);dhx.DataRecord=dhx.proto({name:"DataRecord",isVisible:function(){return true;},$init:function(a){this.data=a||{};var c=a&&a.id?a.id:dhx.uid();this._settings={id:c};dhx.ui.views[c]=this;},getValues:function(){return this.data;},setValues:function(a){this.data=a;this.callEvent("onChange",[a]);},refresh:function(){this.callEvent("onBindRequest");},},dhx.EventSystem,dhx.BaseBind,dhx.AtomDataLoader,dhx.Settings);dhx.DataCollection=dhx.proto({name:"DataCollection",isVisible:function(){if(!this.data.order.length&&!this.data._filter_order&&!this._settings.dataFeed){return false;} +return true;},$init:function(a){this.data.provideApi(this,true);var c=a&&a.id?a.id:dhx.uid();this._settings.id=c;dhx.ui.views[c]=this;this.data.attachEvent("onStoreLoad",dhx.bind(function(){this.callEvent("onBindRequest",[]);},this));},refresh:function(){this.callEvent("onBindRequest",[]);},},dhx.DataLoader,dhx.EventSystem,dhx.BaseBind,dhx.Settings);dhx.ValueBind={$init:function(){this.attachEvent("onChange",this._update_binds);},_bind_update:function(h,g,e){var c=this.getValue()||"";if(e){c=e(c);} +if(h.setValue){h.setValue(c);}else{if(!h.filter){var a={};a[g]=c;if(h._check_data_feed(c)){h.setValues(a);}}else{h.data.silent(function(){this.filter(g,c);});}} +h.callEvent("onBindApply",[c,g,this]);},};dhx.RecordBind={$init:function(){this.attachEvent("onChange",this._update_binds);},_bind_update:function(e,c){var a=this.getValues()||null;this._bind_update_common(e,c,a);},};dhx.CollectionBind={$init:function(){this._cursor=null;this.attachEvent("onSelectChange",function(c){var a=this.getSelected();this.setCursor(a?a.id||a:null);});this.attachEvent("onAfterCursorChange",this._update_binds);this.data.attachEvent("onStoreUpdated",dhx.bind(function(e,a,c){if(e&&e==this.getCursor()&&c!="paint"){this._update_binds();}},this));this.data.attachEvent("onClearAll",dhx.bind(function(){this._cursor=null;},this));this.data.attachEvent("onIdChange",dhx.bind(function(c,a){if(this._cursor==c){this._cursor=a;}},this));},setCursor:function(a){if(a==this._cursor||(a!==null&&!this.item(a))){return;} +this.callEvent("onBeforeCursorChange",[this._cursor]);this._cursor=a;this.callEvent("onAfterCursorChange",[a]);},getCursor:function(){return this._cursor;},_bind_update:function(e,c){var a=this.item(this.getCursor())||this._settings.defaultData||null;this._bind_update_common(e,c,a);},};if(!dhx.ui){dhx.ui={};} +if(!dhx.ui.views){dhx.ui.views={};dhx.ui.get=function(a){if(a._settings){return a;} +return dhx.ui.views[a];};} +dhtmlXDataStore=function(c){var e=new dhx.DataCollection(c);var a="_dp_init";e[a]=function(h){var g="_methods";h[g]=["dummy","dummy","changeId","dummy"];this.data._old_names={add:"inserted",update:"updated",delete:"deleted"};this.data.attachEvent("onStoreUpdated",function(m,j,l){if(m&&!h._silent){h.setUpdated(m,true,this._old_names[l]);}});g="_getRowData";h[g]=function(o,j){var m=this.obj.data.item(o);var n={id:o};n[this.action_param]=this.obj.getUserData(o);if(m){for(var l in m){n[l]=m[l];}} +return n;};this.changeId=function(l,j){this.data.changeId(l,j);h._silent=true;this.data.callEvent("onStoreUpdated",[j,this.item(j),"update"]);h._silent=false;};g="_clearUpdateFlag";h[g]=function(){};this._userdata={};};e.dummy=function(){};e.setUserData=function(j,g,h){this._userdata[j]=h;};e.getUserData=function(h,g){return this._userdata[h];};e.dataFeed=function(g){this.define("dataFeed",g);};dhx.extend(e,dhx.BindSource);return e;};if(window.dhtmlXDataView){dhtmlXDataView.prototype._initBindSource=function(){this.isVisible=function(){if(!this.data.order.length&&!this.data._filter_order&&!this._settings.dataFeed){return false;} +return true;};var a="_settings";this._settings=this._settings||this[a];if(!this._settings.id){this._settings.id=dhx.uid();} +this.unbind=dhx.BaseBind.unbind;this.unsync=dhx.BaseBind.unsync;dhx.ui.views[this._settings.id]=this;};} +if(window.dhtmlXChart){dhtmlXChart.prototype._initBindSource=function(){this.isVisible=function(){if(!this.data.order.length&&!this.data._filtered_state&&!this._settings.dataFeed){return false;} +return true;};var a="_settings";this._settings=this._settings||this[a];if(!this._settings.id){this._settings.id=dhx.uid();} +this.unbind=dhx.BaseBind.unbind;this.unsync=dhx.BaseBind.unsync;dhx.ui.views[this._settings.id]=this;};} +dhx.BaseBind.unsync=function(a){return dhx.BaseBind._unbind.call(this,a);};dhx.BaseBind.unbind=function(a){return dhx.BaseBind._unbind.call(this,a);};dhx.BaseBind.legacyBind=function(){return dhx.BaseBind.bind.apply(this,arguments);};dhx.BaseBind.legacySync=function(a,c){if(this._initBindSource){this._initBindSource();} +if(a._initBindSource){a._initBindSource();} +this.attachEvent("onAfterEditStop",function(e){this.save(e);return true;});this.attachEvent("onDataRequest",function(h,g){for(var e=h;e= 0; + var c = {}; + c.left = document.body.scrollLeft; + c.right = c.left + (window.innerWidth || document.body.clientWidth); + c.top = Math.max((a ? document.documentElement : document.getElementsByTagName("html")[0]).scrollTop, document.body.scrollTop); + c.bottom = c.top + (a ? Math.max(document.documentElement.clientHeight || 0, document.documentElement.offsetHeight || 0) : window.innerHeight); + return c; + }, + selectTextRange: function (h, l, c) { + h = typeof h == "string" ? document.getElementById(h) : h; + var a = h.value.length; + l = Math.max(Math.min(l, a), 0); + c = Math.min(c, a); + if (h.setSelectionRange) { + try { + h.setSelectionRange(l, c); + } catch (j) {} + } else { + if (h.createTextRange) { + var g = h.createTextRange(); + g.moveStart("character", l); + g.moveEnd("character", c - a); + try { + g.select(); + } catch (j) {} + } + } + }, + transData: null, + transDetect: function () { + if (this.transData == null) { + this.transData = { transProp: false, transEv: null }; + var e = { MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd", OTransition: "oTransitionEnd", msTransition: "transitionend", transition: "transitionend" }; + for (var c in e) { + if (this.transData.transProp == false && document.documentElement.style[c] != null) { + this.transData.transProp = c; + this.transData.transEv = e[c]; + } + } + e = null; + } + return this.transData; + }, + _xmlNodeValue: function (a) { + var e = ""; + for (var c = 0; c < a.childNodes.length; c++) { + e += + a.childNodes[c].nodeValue != null + ? a.childNodes[c].nodeValue + .toString() + .replace(/^[\n\r\s]{0,}/, "") + .replace(/[\n\r\s]{0,}$/, "") + : ""; + } + return e; + }, + }; + window.dhx4.isIE = navigator.userAgent.indexOf("MSIE") >= 0 || navigator.userAgent.indexOf("Trident") >= 0; + window.dhx4.isIE6 = window.XMLHttpRequest == null && navigator.userAgent.indexOf("MSIE") >= 0; + window.dhx4.isIE7 = navigator.userAgent.indexOf("MSIE 7.0") >= 0 && navigator.userAgent.indexOf("Trident") < 0; + window.dhx4.isIE8 = navigator.userAgent.indexOf("MSIE 8.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0; + window.dhx4.isIE9 = navigator.userAgent.indexOf("MSIE 9.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0; + window.dhx4.isIE10 = navigator.userAgent.indexOf("MSIE 10.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0 && window.navigator.pointerEnabled != true; + window.dhx4.isIE11 = navigator.userAgent.indexOf("Trident") >= 0 && window.navigator.pointerEnabled == true; + window.dhx4.isEdge = navigator.userAgent.indexOf("Edge") >= 0; + window.dhx4.isOpera = navigator.userAgent.indexOf("Opera") >= 0; + window.dhx4.isChrome = navigator.userAgent.indexOf("Chrome") >= 0 && !window.dhx4.isEdge; + window.dhx4.isKHTML = (navigator.userAgent.indexOf("Safari") >= 0 || navigator.userAgent.indexOf("Konqueror") >= 0) && !window.dhx4.isEdge; + window.dhx4.isFF = navigator.userAgent.indexOf("Firefox") >= 0; + window.dhx4.isIPad = navigator.userAgent.search(/iPad/gi) >= 0; + window.dhx4.dnd = { + evs: {}, + p_en: (window.dhx4.isIE || window.dhx4.isEdge) && (window.navigator.pointerEnabled || window.navigator.msPointerEnabled), + _mTouch: function (a) { + return (window.dhx4.isIE10 && a.pointerType == a.MSPOINTER_TYPE_MOUSE) || (window.dhx4.isIE11 && a.pointerType == "mouse") || (window.dhx4.isEdge && a.pointerType == "mouse"); + }, + _touchOn: function (a) { + if (a == null) { + a = document.body; + } + a.style.touchAction = a.style.msTouchAction = ""; + a = null; + }, + _touchOff: function (a) { + if (a == null) { + a = document.body; + } + a.style.touchAction = a.style.msTouchAction = "none"; + a = null; + }, + }; + if (window.navigator.pointerEnabled == true) { + window.dhx4.dnd.evs = { start: "pointerdown", move: "pointermove", end: "pointerup" }; + } else { + if (window.navigator.msPointerEnabled == true) { + window.dhx4.dnd.evs = { start: "MSPointerDown", move: "MSPointerMove", end: "MSPointerUp" }; + } else { + if (typeof window.addEventListener != "undefined") { + window.dhx4.dnd.evs = { start: "touchstart", move: "touchmove", end: "touchend" }; + } + } + } +} +if (typeof window.dhx4.template == "undefined") { + window.dhx4.trim = function (a) { + return String(a) + .replace(/^\s{1,}/, "") + .replace(/\s{1,}$/, ""); + }; + window.dhx4.template = function (c, e, a) { + return c.replace(/#([a-z0-9_-]{1,})(\|([^#]*))?#/gi, function () { + var l = arguments[1]; + var j = window.dhx4.trim(arguments[3]); + var m = null; + var h = [e[l]]; + if (j.length > 0) { + j = j.split(":"); + var g = []; + for (var n = 0; n < j.length; n++) { + if (n > 0 && g[g.length - 1].match(/\\$/) != null) { + g[g.length - 1] = g[g.length - 1].replace(/\\$/, "") + ":" + j[n]; + } else { + g.push(j[n]); + } + } + m = g[0]; + for (var n = 1; n < g.length; n++) { + h.push(g[n]); + } + } + if (typeof m == "string" && typeof window.dhx4.template[m] == "function") { + return window.dhx4.template[m].apply(window.dhx4.template, h); + } + if (l.length > 0 && typeof e[l] != "undefined") { + if (a == true) { + return window.dhx4.trim(e[l]); + } + return String(e[l]); + } + return ""; + }); + }; + window.dhx4.template.date = function (a, c) { + if (a != null) { + if (a instanceof Date) { + return window.dhx4.date2str(a, c); + } else { + a = a.toString(); + if (a.match(/^\d*$/) != null) { + return window.dhx4.date2str(new Date(parseInt(a)), c); + } + return a; + } + } + return ""; + }; + window.dhx4.template.maxlength = function (c, a) { + return String(c).substr(0, a); + }; + window.dhx4.template.number_format = function (g, h, e, a) { + var c = window.dhx4.template._parseFmt(h, e, a); + if (c == false) { + return g; + } + return window.dhx4.template._getFmtValue(g, c); + }; + window.dhx4.template.lowercase = function (a) { + if (typeof a == "undefined" || a == null) { + a = ""; + } + return String(a).toLowerCase(); + }; + window.dhx4.template.uppercase = function (a) { + if (typeof a == "undefined" || a == null) { + a = ""; + } + return String(a).toUpperCase(); + }; + window.dhx4.template._parseFmt = function (l, e, a) { + var g = l.match(/^([^\.\,0-9]*)([0\.\,]*)([^\.\,0-9]*)/); + if (g == null || g.length != 4) { + return false; + } + var c = { i_len: false, i_sep: typeof e == "string" ? e : ",", d_len: false, d_sep: typeof a == "string" ? a : ".", s_bef: typeof g[1] == "string" ? g[1] : "", s_aft: typeof g[3] == "string" ? g[3] : "" }; + var j = g[2].split("."); + if (j[1] != null) { + c.d_len = j[1].length; + } + var h = j[0].split(","); + if (h.length > 1) { + c.i_len = h[h.length - 1].length; + } + return c; + }; + window.dhx4.template._getFmtValue = function (value, fmt) { + var r = String(value).match(/^(-)?([0-9]{1,})(\.([0-9]{1,}))?$/); + if (r != null && r.length == 5) { + var v0 = ""; + if (r[1] != null) { + v0 += r[1]; + } + v0 += fmt.s_bef; + if (fmt.i_len !== false) { + var i = 0; + var v1 = ""; + for (var q = r[2].length - 1; q >= 0; q--) { + v1 = "" + r[2].charAt(q) + v1; + if (++i == fmt.i_len && q > 0) { + v1 = fmt.i_sep + v1; + i = 0; + } + } + v0 += v1; + } else { + v0 += r[2]; + } + if (fmt.d_len !== false) { + if (r[4] == null) { + r[4] = ""; + } + while (r[4].length < fmt.d_len) { + r[4] += "0"; + } + eval("dhx4.temp = new RegExp(/\\d{" + fmt.d_len + "}/);"); + var t1 = r[4].match(dhx4.temp); + if (t1 != null) { + v0 += fmt.d_sep + t1; + } + dhx4.temp = t1 = null; + } + v0 += fmt.s_aft; + return v0; + } + return value; + }; +} +if (typeof window.dhx4.dateLang == "undefined") { + window.dhx4.dateLang = "en"; + window.dhx4.dateStrings = { + en: { + monthFullName: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + monthShortName: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + dayFullName: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + dayShortName: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], + }, + }; + window.dhx4.dateFormat = { en: "%Y-%m-%d" }; + window.dhx4.date2str = function (j, g, a) { + if (g == null || typeof g == "undefnied") { + g = window.dhx4.dateFormat[window.dhx4.dateLang]; + } + if (a == null || typeof a == "undefnied") { + a = window.dhx4.dateStrings[window.dhx4.dateLang]; + } + if (j instanceof Date) { + var h = function (l) { + return String(l).length == 1 ? "0" + String(l) : l; + }; + var c = function (n) { + switch (n) { + case "%d": + return h(j.getDate()); + case "%j": + return j.getDate(); + case "%D": + return a.dayShortName[j.getDay()]; + case "%l": + return a.dayFullName[j.getDay()]; + case "%m": + return h(j.getMonth() + 1); + case "%n": + return j.getMonth() + 1; + case "%M": + return a.monthShortName[j.getMonth()]; + case "%F": + return a.monthFullName[j.getMonth()]; + case "%y": + return h(j.getYear() % 100); + case "%Y": + return j.getFullYear(); + case "%g": + return ((j.getHours() + 11) % 12) + 1; + case "%h": + return h(((j.getHours() + 11) % 12) + 1); + case "%G": + return j.getHours(); + case "%H": + return h(j.getHours()); + case "%i": + return h(j.getMinutes()); + case "%s": + return h(j.getSeconds()); + case "%a": + return j.getHours() > 11 ? "pm" : "am"; + case "%A": + return j.getHours() > 11 ? "PM" : "AM"; + case "%%": + return "%"; + case "%u": + return j.getMilliseconds(); + case "%P": + if (window.dhx4.temp_calendar != null && window.dhx4.temp_calendar.tz != null) { + return window.dhx4.temp_calendar.tz; + } + var r = j.getTimezoneOffset(); + var o = Math.abs(Math.floor(r / 60)); + var l = Math.abs(r) - o * 60; + return (r > 0 ? "-" : "+") + h(o) + ":" + h(l); + default: + return n; + } + }; + var e = String(g || window.dhx4.dateFormat).replace(/%[a-zA-Z]/g, c); + } + return e || String(j); + }; + window.dhx4.str2date = function (j, y, D) { + if (y == null || typeof y == "undefnied") { + y = window.dhx4.dateFormat[window.dhx4.dateLang]; + } + if (D == null || typeof D == "undefnied") { + D = window.dhx4.dateStrings[window.dhx4.dateLang]; + } + y = y.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\\:|]/g, "\\$&"); + var C = []; + var n = []; + y = y.replace(/%[a-z]/gi, function (e) { + switch (e) { + case "%d": + case "%m": + case "%y": + case "%h": + case "%H": + case "%i": + case "%s": + n.push(e); + return "(\\d{2})"; + case "%D": + case "%l": + case "%M": + case "%F": + n.push(e); + return "([a-zéûä\u0430-\u044F\u0451]{1,})"; + case "%j": + case "%n": + case "%g": + case "%G": + n.push(e); + return "(\\d{1,2})"; + case "%Y": + n.push(e); + return "(\\d{4})"; + case "%a": + n.push(e); + return "([a|p]m)"; + case "%A": + n.push(e); + return "([A|P]M)"; + case "%u": + n.push(e); + return "(\\d{1,6})"; + case "%P": + n.push(e); + return "([+-]\\d{1,2}:\\d{1,2})"; + } + return e; + }); + var E = new RegExp(y, "i"); + var o = j.match(E); + if (o == null || o.length - 1 != n.length) { + return "Invalid Date"; + } + for (var c = 1; c < o.length; c++) { + C.push(o[c]); + } + var g = { "%y": 1, "%Y": 1, "%n": 2, "%m": 2, "%M": 2, "%F": 2, "%d": 3, "%j": 3, "%a": 4, "%A": 4, "%H": 5, "%G": 5, "%h": 5, "%g": 5, "%i": 6, "%s": 7, "%u": 7, "%P": 7 }; + var s = {}; + var m = {}; + for (var c = 0; c < n.length; c++) { + if (typeof g[n[c]] != "undefined") { + var h = g[n[c]]; + if (!s[h]) { + s[h] = []; + m[h] = []; + } + s[h].push(C[c]); + m[h].push(n[c]); + } + } + C = []; + n = []; + for (var c = 1; c <= 7; c++) { + if (s[c] != null) { + for (var x = 0; x < s[c].length; x++) { + C.push(s[c][x]); + n.push(m[c][x]); + } + } + } + var a = new Date(); + a.setDate(1); + a.setHours(0); + a.setMinutes(0); + a.setSeconds(0); + a.setMilliseconds(0); + var u = function (v, e) { + for (var r = 0; r < e.length; r++) { + if (e[r].toLowerCase() == v) { + return r; + } + } + return -1; + }; + for (var c = 0; c < C.length; c++) { + switch (n[c]) { + case "%d": + case "%j": + case "%n": + case "%m": + case "%Y": + case "%H": + case "%G": + case "%i": + case "%s": + case "%u": + if (!isNaN(C[c])) { + a[{ "%d": "setDate", "%j": "setDate", "%n": "setMonth", "%m": "setMonth", "%Y": "setFullYear", "%H": "setHours", "%G": "setHours", "%i": "setMinutes", "%s": "setSeconds", "%u": "setMilliseconds" }[n[c]]]( + Number(C[c]) + (n[c] == "%m" || n[c] == "%n" ? -1 : 0) + ); + } + break; + case "%M": + case "%F": + var l = u(C[c].toLowerCase(), D[{ "%M": "monthShortName", "%F": "monthFullName" }[n[c]]]); + if (l >= 0) { + a.setMonth(l); + } + break; + case "%y": + if (!isNaN(C[c])) { + var A = Number(C[c]); + a.setFullYear(A + (A > 50 ? 1900 : 2000)); + } + break; + case "%g": + case "%h": + if (!isNaN(C[c])) { + var A = Number(C[c]); + if (A <= 12 && A >= 0) { + a.setHours(A + (u("pm", C) >= 0 ? (A == 12 ? 0 : 12) : A == 12 ? -12 : 0)); + } + } + break; + case "%P": + if (window.dhx4.temp_calendar != null) { + window.dhx4.temp_calendar.tz = C[c]; + } + break; + } + } + return a; + }; +} +if (typeof window.dhx4.ajax == "undefined") { + window.dhx4.ajax = { + cache: false, + method: "get", + parse: function (a) { + if (typeof a !== "string") { + return a; + } + a = a.replace(/^[\s]+/, ""); + if (window.DOMParser && !dhx4.isIE) { + var c = new window.DOMParser().parseFromString(a, "text/xml"); + } else { + if (window.ActiveXObject !== window.undefined) { + var c = new window.ActiveXObject("Microsoft.XMLDOM"); + c.async = "false"; + c.loadXML(a); + } + } + return c; + }, + xmltop: function (a, h, g) { + if (typeof h.status == "undefined" || h.status < 400) { + xml = !h.responseXML ? dhx4.ajax.parse(h.responseText || h) : h.responseXML || h; + if (xml && xml.documentElement !== null) { + try { + if (!xml.getElementsByTagName("parsererror").length) { + return xml.getElementsByTagName(a)[0]; + } + } catch (c) {} + } + } + if (g !== -1) { + dhx4.callEvent("onLoadXMLError", ["Incorrect XML", arguments[1], g]); + } + return document.createElement("DIV"); + }, + xpath: function (g, a) { + if (!a.nodeName) { + a = a.responseXML || a; + } + if (dhx4.isIE) { + try { + return a.selectNodes(g) || []; + } catch (j) { + return []; + } + } else { + var h = []; + var l; + var c = (a.ownerDocument || a).evaluate(g, a, null, XPathResult.ANY_TYPE, null); + while ((l = c.iterateNext())) { + h.push(l); + } + return h; + } + }, + query: function (a) { + dhx4.ajax._call(a.method || "GET", a.url, a.data || "", a.async || true, a.callback, null, a.headers); + }, + get: function (a, c) { + return this._call("GET", a, null, true, c); + }, + getSync: function (a) { + return this._call("GET", a, null, false); + }, + put: function (c, a, e) { + return this._call("PUT", c, a, true, e); + }, + del: function (c, a, e) { + return this._call("DELETE", c, a, true, e); + }, + post: function (c, a, e) { + if (arguments.length == 1) { + a = ""; + } else { + if (arguments.length == 2 && (typeof a == "function" || typeof window[a] == "function")) { + e = a; + a = ""; + } else { + a = String(a); + } + } + return this._call("POST", c, a, true, e); + }, + postSync: function (c, a) { + a = a == null ? "" : String(a); + return this._call("POST", c, a, false); + }, + getLong: function (a, c) { + this._call("GET", a, null, true, c, { url: a }); + }, + postLong: function (c, a, e) { + if (arguments.length == 2 && (typeof a == "function" || typeof window[a])) { + e = a; + a = ""; + } + this._call("POST", c, a, true, e, { url: c, postData: a }); + }, + _call: function (a, c, e, h, l, o, g) { + var n = window.XMLHttpRequest && !dhx4.isIE ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); + var j = navigator.userAgent.match(/AppleWebKit/) != null && navigator.userAgent.match(/Qt/) != null && navigator.userAgent.match(/Safari/) != null; + if (h == true) { + n.onreadystatechange = function () { + if (n.readyState == 4 || (j == true && n.readyState == 3)) { + if (n.status != 200 || n.responseText == "") { + if (!dhx4.callEvent("onAjaxError", [{ xmlDoc: n, filePath: c, async: h }])) { + return; + } + } + window.setTimeout(function () { + if (typeof l == "function") { + l.apply(window, [{ xmlDoc: n, filePath: c, async: h }]); + } + if (o != null) { + if (typeof o.postData != "undefined") { + dhx4.ajax.postLong(o.url, o.postData, l); + } else { + dhx4.ajax.getLong(o.url, l); + } + } + l = null; + n = null; + }, 1); + } + }; + } + if (a == "GET" && this.cache != true) { + c += (c.indexOf("?") >= 0 ? "&" : "?") + "dhxr" + new Date().getTime() + "=1"; + } + n.open(a, c, h); + if (g != null) { + for (var m in g) { + n.setRequestHeader(m, g[m]); + } + } else { + if (a == "POST" || a == "PUT" || a == "DELETE") { + n.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + } else { + if (a == "GET") { + e = null; + } + } + } + n.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + n.send(e); + return { xmlDoc: n, filePath: c, async: h }; + }, + }; +} +if (typeof window.dhx4._enableDataLoading == "undefined") { + window.dhx4._enableDataLoading = function (l, e, j, h, m) { + if (m == "clear") { + for (var c in l._dhxdataload) { + l._dhxdataload[c] = null; + delete l._dhxdataload[c]; + } + l._loadData = null; + l._dhxdataload = null; + l.load = null; + l.loadStruct = null; + l = null; + return; + } + l._dhxdataload = { initObj: e, xmlToJson: j, xmlRootTag: h, onBeforeXLS: null }; + l._loadData = function (u, v, w) { + if (arguments.length == 2) { + w = v; + v = null; + } + var s = null; + if (arguments.length == 3) { + w = arguments[2]; + } + if (typeof u == "string") { + var r = u.replace(/^\s{1,}/, "").replace(/\s{1,}$/, ""); + var A = new RegExp("^<" + this._dhxdataload.xmlRootTag); + if (A.test(r.replace(/^<\?xml[^\?]*\?>\s*/, ""))) { + s = dhx4.ajax.parse(u); + if (s != null) { + s = this[this._dhxdataload.xmlToJson].apply(this, [s]); + } + } + if (s == null && (r.match(/^[\s\S]*{[.\s\S]*}[\s\S]*$/) != null || r.match(/^[\s\S]*\[[.\s\S]*\][\s\S]*$/) != null)) { + s = dhx4.s2j(r); + } + if (s == null) { + this.callEvent("onXLS", []); + var o = []; + if (typeof this._dhxdataload.onBeforeXLS == "function") { + var r = this._dhxdataload.onBeforeXLS.apply(this, [u]); + if (r != null && typeof r == "object") { + if (r.url != null) { + u = r.url; + } + if (r.params != null) { + for (var x in r.params) { + o.push(x + "=" + encodeURIComponent(r.params[x])); + } + } + } + } + var y = this; + var n = function (a) { + var C = null; + if ((a.xmlDoc.getResponseHeader("Content-Type") || "").search(/xml/gi) >= 0 || a.xmlDoc.responseText.replace(/^\s{1,}/, "").match(/^ 0 ? (u.indexOf("?") > 0 ? "&" : "?") + o : ""), n); + } + } + return; + } + } else { + if (typeof u.documentElement == "object" || (typeof u.tagName != "undefined" && typeof u.getElementsByTagName != "undefined" && u.getElementsByTagName(this._dhxdataload.xmlRootTag).length > 0)) { + s = this[this._dhxdataload.xmlToJson].apply(this, [u]); + } else { + s = window.dhx4._copyObj(u); + } + } + if (s != null) { + this[this._dhxdataload.initObj].apply(this, [s]); + } + if (w != null) { + if (typeof w == "function") { + w.apply(this, []); + } else { + if (typeof window[w] == "function") { + window[w].apply(this, []); + } + } + w = null; + } + }; + if (m != null) { + var g = { struct: "loadStruct", data: "load" }; + for (var c in m) { + if (m[c] == true) { + l[g[c]] = function () { + return this._loadData.apply(this, arguments); + }; + } + } + } + l = null; + }; +} +if (typeof window.dhx4._eventable == "undefined") { + window.dhx4._eventable = function (a, c) { + if (c == "clear") { + a.detachAllEvents(); + a.dhxevs = null; + a.attachEvent = null; + a.detachEvent = null; + a.checkEvent = null; + a.callEvent = null; + a.detachAllEvents = null; + a = null; + return; + } + a.dhxevs = { data: {} }; + a.attachEvent = function (e, h) { + e = String(e).toLowerCase(); + if (!this.dhxevs.data[e]) { + this.dhxevs.data[e] = {}; + } + var g = window.dhx4.newId(); + this.dhxevs.data[e][g] = h; + return g; + }; + a.detachEvent = function (j) { + for (var g in this.dhxevs.data) { + var h = 0; + for (var e in this.dhxevs.data[g]) { + if (e == j) { + this.dhxevs.data[g][e] = null; + delete this.dhxevs.data[g][e]; + } else { + h++; + } + } + if (h == 0) { + this.dhxevs.data[g] = null; + delete this.dhxevs.data[g]; + } + } + }; + a.checkEvent = function (e) { + e = String(e).toLowerCase(); + return this.dhxevs.data[e] != null; + }; + a.callEvent = function (g, j) { + g = String(g).toLowerCase(); + if (this.dhxevs.data[g] == null) { + return true; + } + var h = true; + for (var e in this.dhxevs.data[g]) { + h = this.dhxevs.data[g][e].apply(this, j) && h; + } + return h; + }; + a.detachAllEvents = function () { + for (var g in this.dhxevs.data) { + for (var e in this.dhxevs.data[g]) { + this.dhxevs.data[g][e] = null; + delete this.dhxevs.data[g][e]; + } + this.dhxevs.data[g] = null; + delete this.dhxevs.data[g]; + } + }; + a = null; + }; + dhx4._eventable(dhx4); +} +if (!window.dhtmlxValidation) { + dhtmlxValidation = function () {}; + dhtmlxValidation.prototype = { + isEmpty: function (a) { + return a == ""; + }, + isNotEmpty: function (a) { + return a instanceof Array ? a.length > 0 : !a == ""; + }, + isValidBoolean: function (a) { + return !!a.toString().match(/^(0|1|true|false)$/); + }, + isValidEmail: function (a) { + return !!a.toString().match(/(^[a-z0-9]([0-9a-z\-_\.]*)@([0-9a-z_\-\.]*)([.][a-z]{3})$)|(^[a-z]([0-9a-z_\.\-]*)@([0-9a-z_\-\.]*)(\.[a-z]{2,4})$)/i); + }, + isValidInteger: function (a) { + return !!a.toString().match(/(^-?\d+$)/); + }, + isValidNumeric: function (a) { + return !!a.toString().match(/(^-?\d\d*[\.|,]\d*$)|(^-?\d\d*$)|(^-?[\.|,]\d\d*$)/); + }, + isValidAplhaNumeric: function (a) { + return !!a.toString().match(/^[_\-a-z0-9]+$/gi); + }, + isValidDatetime: function (c) { + var a = c.toString().match(/^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/); + return (a && !!(a[1] <= 9999 && a[2] <= 12 && a[3] <= 31 && a[4] <= 59 && a[5] <= 59 && a[6] <= 59)) || false; + }, + isValidDate: function (a) { + var c = a.toString().match(/^(\d{4})-(\d{2})-(\d{2})$/); + return (c && !!(c[1] <= 9999 && c[2] <= 12 && c[3] <= 31)) || false; + }, + isValidTime: function (c) { + var a = c.toString().match(/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/); + return (a && !!(a[1] <= 24 && a[2] <= 59 && a[3] <= 59)) || false; + }, + isValidIPv4: function (a) { + var c = a.toString().match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/); + return (c && !!(c[1] <= 255 && c[2] <= 255 && c[3] <= 255 && c[4] <= 255)) || false; + }, + isValidCurrency: function (a) { + return (a.toString().match(/^\$?\s?\d+?([\.,\,]?\d+)?\s?\$?$/) && true) || false; + }, + isValidSSN: function (a) { + return (a.toString().match(/^\d{3}\-?\d{2}\-?\d{4}$/) && true) || false; + }, + isValidSIN: function (a) { + return (a.toString().match(/^\d{9}$/) && true) || false; + }, + }; + dhtmlxValidation = new dhtmlxValidation(); +} +if (typeof window.dhtmlx == "undefined") { + window.dhtmlx = { + extend: function (e, c) { + for (var g in c) { + if (!e[g]) { + e[g] = c[g]; + } + } + return e; + }, + extend_api: function (a, g, e) { + var c = window[a]; + if (!c) { + return; + } + window[a] = function (l) { + if (l && typeof l == "object" && !l.tagName) { + var j = c.apply(this, g._init ? g._init(l) : arguments); + for (var h in dhtmlx) { + if (g[h]) { + this[g[h]](dhtmlx[h]); + } + } + for (var h in l) { + if (g[h]) { + this[g[h]](l[h]); + } else { + if (h.indexOf("on") === 0) { + this.attachEvent(h, l[h]); + } + } + } + } else { + var j = c.apply(this, arguments); + } + if (g._patch) { + g._patch(this); + } + return j || this; + }; + window[a].prototype = c.prototype; + if (e) { + dhtmlx.extend(window[a].prototype, e); + } + }, + url: function (a) { + if (a.indexOf("?") != -1) { + return "&"; + } else { + return "?"; + } + }, + }; +} +function dhtmlDragAndDropObject() { + if (window.dhtmlDragAndDrop) { + return window.dhtmlDragAndDrop; + } + this.lastLanding = 0; + this.dragNode = 0; + this.dragStartNode = 0; + this.dragStartObject = 0; + this.tempDOMU = null; + this.tempDOMM = null; + this.waitDrag = 0; + window.dhtmlDragAndDrop = this; + return this; +} +dhtmlDragAndDropObject.prototype.removeDraggableItem = function (a) { + a.onmousedown = null; + a.dragStarter = null; + a.dragLanding = null; +}; +dhtmlDragAndDropObject.prototype.addDraggableItem = function (a, c) { + a.onmousedown = this.preCreateDragCopy; + a.dragStarter = c; + this.addDragLanding(a, c); +}; +dhtmlDragAndDropObject.prototype.addDragLanding = function (a, c) { + a.dragLanding = c; +}; +dhtmlDragAndDropObject.prototype.preCreateDragCopy = function (a) { + if ((a || window.event) && (a || event).button == 2) { + return; + } + if (window.dhtmlDragAndDrop.waitDrag) { + window.dhtmlDragAndDrop.waitDrag = 0; + document.body.onmouseup = window.dhtmlDragAndDrop.tempDOMU; + document.body.onmousemove = window.dhtmlDragAndDrop.tempDOMM; + return false; + } + if (window.dhtmlDragAndDrop.dragNode) { + window.dhtmlDragAndDrop.stopDrag(a); + } + window.dhtmlDragAndDrop.waitDrag = 1; + window.dhtmlDragAndDrop.tempDOMU = document.body.onmouseup; + window.dhtmlDragAndDrop.tempDOMM = document.body.onmousemove; + window.dhtmlDragAndDrop.dragStartNode = this; + window.dhtmlDragAndDrop.dragStartObject = this.dragStarter; + document.body.onmouseup = window.dhtmlDragAndDrop.preCreateDragCopy; + document.body.onmousemove = window.dhtmlDragAndDrop.callDrag; + window.dhtmlDragAndDrop.downtime = new Date().valueOf(); + if (a && a.preventDefault) { + a.preventDefault(); + return false; + } + return false; +}; +dhtmlDragAndDropObject.prototype.callDrag = function (g) { + if (!g) { + g = window.event; + } + dragger = window.dhtmlDragAndDrop; + if (new Date().valueOf() - dragger.downtime < 100) { + return; + } + if (!dragger.dragNode) { + if (dragger.waitDrag) { + dragger.dragNode = dragger.dragStartObject._createDragNode(dragger.dragStartNode, g); + if (!dragger.dragNode) { + return dragger.stopDrag(); + } + dragger.dragNode.onselectstart = function () { + return false; + }; + dragger.gldragNode = dragger.dragNode; + document.body.appendChild(dragger.dragNode); + document.body.onmouseup = dragger.stopDrag; + dragger.waitDrag = 0; + dragger.dragNode.pWindow = window; + dragger.initFrameRoute(); + } else { + return dragger.stopDrag(g, true); + } + } + if (dragger.dragNode.parentNode != window.document.body && dragger.gldragNode) { + var a = dragger.gldragNode; + if (dragger.gldragNode.old) { + a = dragger.gldragNode.old; + } + a.parentNode.removeChild(a); + var c = dragger.dragNode.pWindow; + if (a.pWindow && a.pWindow.dhtmlDragAndDrop.lastLanding) { + a.pWindow.dhtmlDragAndDrop.lastLanding.dragLanding._dragOut(a.pWindow.dhtmlDragAndDrop.lastLanding); + } + if (_isIE) { + var j = document.createElement("Div"); + j.innerHTML = dragger.dragNode.outerHTML; + dragger.dragNode = j.childNodes[0]; + } else { + dragger.dragNode = dragger.dragNode.cloneNode(true); + } + dragger.dragNode.pWindow = window; + dragger.gldragNode.old = dragger.dragNode; + document.body.appendChild(dragger.dragNode); + c.dhtmlDragAndDrop.dragNode = dragger.dragNode; + } + dragger.dragNode.style.left = g.clientX + 15 + (dragger.fx ? dragger.fx * -1 : 0) + (document.body.scrollLeft || document.documentElement.scrollLeft) + "px"; + dragger.dragNode.style.top = g.clientY + 3 + (dragger.fy ? dragger.fy * -1 : 0) + (document.body.scrollTop || document.documentElement.scrollTop) + "px"; + if (!g.srcElement) { + var h = g.target; + } else { + h = g.srcElement; + } + dragger.checkLanding(h, g); +}; +dhtmlDragAndDropObject.prototype.calculateFramePosition = function (h) { + if (window.name) { + var e = parent.frames[window.name].frameElement.offsetParent; + var g = 0; + var c = 0; + while (e) { + g += e.offsetLeft; + c += e.offsetTop; + e = e.offsetParent; + } + if (parent.dhtmlDragAndDrop) { + var a = parent.dhtmlDragAndDrop.calculateFramePosition(1); + g += a.split("_")[0] * 1; + c += a.split("_")[1] * 1; + } + if (h) { + return g + "_" + c; + } else { + this.fx = g; + } + this.fy = c; + } + return "0_0"; +}; +dhtmlDragAndDropObject.prototype.checkLanding = function (c, a) { + if (c && c.dragLanding) { + if (this.lastLanding) { + this.lastLanding.dragLanding._dragOut(this.lastLanding); + } + this.lastLanding = c; + this.lastLanding = this.lastLanding.dragLanding._dragIn(this.lastLanding, this.dragStartNode, a.clientX, a.clientY, a); + this.lastLanding_scr = _isIE ? a.srcElement : a.target; + } else { + if (c && c.tagName != "BODY") { + this.checkLanding(c.parentNode, a); + } else { + if (this.lastLanding) { + this.lastLanding.dragLanding._dragOut(this.lastLanding, a.clientX, a.clientY, a); + } + this.lastLanding = 0; + if (this._onNotFound) { + this._onNotFound(); + } + } + } +}; +dhtmlDragAndDropObject.prototype.stopDrag = function (c, g) { + dragger = window.dhtmlDragAndDrop; + if (!g) { + dragger.stopFrameRoute(); + var a = dragger.lastLanding; + dragger.lastLanding = null; + if (a) { + a.dragLanding._drag(dragger.dragStartNode, dragger.dragStartObject, a, _isIE ? event.srcElement : c.target); + } + } + dragger.lastLanding = null; + if (dragger.dragNode && dragger.dragNode.parentNode == document.body) { + dragger.dragNode.parentNode.removeChild(dragger.dragNode); + } + dragger.dragNode = 0; + dragger.gldragNode = 0; + dragger.fx = 0; + dragger.fy = 0; + dragger.dragStartNode = 0; + dragger.dragStartObject = 0; + document.body.onmouseup = dragger.tempDOMU; + document.body.onmousemove = dragger.tempDOMM; + dragger.tempDOMU = null; + dragger.tempDOMM = null; + dragger.waitDrag = 0; +}; +dhtmlDragAndDropObject.prototype.stopFrameRoute = function (g) { + if (g) { + window.dhtmlDragAndDrop.stopDrag(1, 1); + } + for (var a = 0; a < window.frames.length; a++) { + try { + if (window.frames[a] != g && window.frames[a].dhtmlDragAndDrop) { + window.frames[a].dhtmlDragAndDrop.stopFrameRoute(window); + } + } catch (c) {} + } + try { + if (parent.dhtmlDragAndDrop && parent != window && parent != g) { + parent.dhtmlDragAndDrop.stopFrameRoute(window); + } + } catch (c) {} +}; +dhtmlDragAndDropObject.prototype.initFrameRoute = function (g, h) { + if (g) { + window.dhtmlDragAndDrop.preCreateDragCopy(); + window.dhtmlDragAndDrop.dragStartNode = g.dhtmlDragAndDrop.dragStartNode; + window.dhtmlDragAndDrop.dragStartObject = g.dhtmlDragAndDrop.dragStartObject; + window.dhtmlDragAndDrop.dragNode = g.dhtmlDragAndDrop.dragNode; + window.dhtmlDragAndDrop.gldragNode = g.dhtmlDragAndDrop.dragNode; + window.document.body.onmouseup = window.dhtmlDragAndDrop.stopDrag; + window.waitDrag = 0; + if (!_isIE && h && (!_isFF || _FFrv < 1.8)) { + window.dhtmlDragAndDrop.calculateFramePosition(); + } + } + try { + if (parent.dhtmlDragAndDrop && parent != window && parent != g) { + parent.dhtmlDragAndDrop.initFrameRoute(window); + } + } catch (c) {} + for (var a = 0; a < window.frames.length; a++) { + try { + if (window.frames[a] != g && window.frames[a].dhtmlDragAndDrop) { + window.frames[a].dhtmlDragAndDrop.initFrameRoute(window, !g || h ? 1 : 0); + } + } catch (c) {} + } +}; +_isFF = false; +_isIE = false; +_isOpera = false; +_isKHTML = false; +_isMacOS = false; +_isChrome = false; +_FFrv = false; +_KHTMLrv = false; +_OperaRv = false; +if (navigator.userAgent.indexOf("Macintosh") != -1) { + _isMacOS = true; +} +if (navigator.userAgent.toLowerCase().indexOf("chrome") > -1) { + _isChrome = true; +} +if (navigator.userAgent.indexOf("Safari") != -1 || navigator.userAgent.indexOf("Konqueror") != -1) { + _KHTMLrv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Safari") + 7, 5)); + if (_KHTMLrv > 525) { + _isFF = true; + _FFrv = 1.9; + } else { + _isKHTML = true; + } +} else { + if (navigator.userAgent.indexOf("Opera") != -1) { + _isOpera = true; + _OperaRv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera") + 6, 3)); + } else { + if (navigator.appName.indexOf("Microsoft") != -1) { + _isIE = true; + if ((navigator.appVersion.indexOf("MSIE 8.0") != -1 || navigator.appVersion.indexOf("MSIE 9.0") != -1 || navigator.appVersion.indexOf("MSIE 10.0") != -1 || document.documentMode > 7) && document.compatMode != "BackCompat") { + _isIE = 8; + } + } else { + if (navigator.appName == "Netscape" && navigator.userAgent.indexOf("Trident") != -1) { + _isIE = 8; + } else { + _isFF = true; + _FFrv = parseFloat(navigator.userAgent.split("rv:")[1]); + } + } + } +} +if (typeof window.dhtmlxEvent == "undefined") { + function dhtmlxEvent(c, e, a) { + if (c.addEventListener) { + c.addEventListener(e, a, false); + } else { + if (c.attachEvent) { + c.attachEvent("on" + e, a); + } + } + } +} +if (dhtmlxEvent.touchDelay == null) { + dhtmlxEvent.touchDelay = 2000; +} +if (typeof dhtmlxEvent.initTouch == "undefined") { + dhtmlxEvent.initTouch = function () { + var g; + var h; + var c, a; + dhtmlxEvent(document.body, "touchstart", function (j) { + h = j.touches[0].target; + c = j.touches[0].clientX; + a = j.touches[0].clientY; + g = window.setTimeout(e, dhtmlxEvent.touchDelay); + }); + function e() { + if (h) { + var j = document.createEvent("HTMLEvents"); + j.initEvent("dblclick", true, true); + h.dispatchEvent(j); + g = h = null; + } + } + dhtmlxEvent(document.body, "touchmove", function (j) { + if (g) { + if (Math.abs(j.touches[0].clientX - c) > 50 || Math.abs(j.touches[0].clientY - a) > 50) { + window.clearTimeout(g); + g = h = false; + } + } + }); + dhtmlxEvent(document.body, "touchend", function (j) { + if (g) { + window.clearTimeout(g); + g = h = false; + } + }); + dhtmlxEvent.initTouch = function () {}; + }; +} +if (!window.dhtmlx) { + dhtmlx = {}; +} +dhtmlx.assert = function (c, a) { + if (!c) { + dhtmlx.error(a); + } +}; +dhtmlx.assert_enabled = function () { + return false; +}; +dhtmlx.assert_event = function (j, e) { + if (!j._event_check) { + j._event_check = {}; + j._event_check_size = {}; + } + for (var c in e) { + j._event_check[c.toLowerCase()] = e[c]; + var h = -1; + for (var g in e[c]) { + h++; + } + j._event_check_size[c.toLowerCase()] = h; + } +}; +dhtmlx.assert_method_info = function (h, c, g, j) { + var a = []; + for (var e = 0; e < j.length; e++) { + a.push(j[e][0] + " : " + j[e][1] + "\n " + j[e][2].describe() + (j[e][3] ? "; optional" : "")); + } + return h.name + "." + c + "\n" + g + "\n Arguments:\n - " + a.join("\n - "); +}; +dhtmlx.assert_method = function (e, a) { + for (var c in a) { + dhtmlx.assert_method_process(e, c, a[c].descr, a[c].args, a[c].min || 99, a[c].skip); + } +}; +dhtmlx.assert_method_process = function (j, c, h, l, e, g) { + var a = j[c]; + if (!g) { + j[c] = function () { + if (arguments.length != l.length && arguments.length < e) { + dhtmlx.log("warn", "Incorrect count of parameters\n" + j[c].describe() + "\n\nExpecting " + l.length + " but have only " + arguments.length); + } else { + for (var m = 0; m < l.length; m++) { + if (!l[m][3] && !l[m][2](arguments[m])) { + dhtmlx.log("warn", "Incorrect method call\n" + j[c].describe() + "\n\nActual value of " + (m + 1) + " parameter: {" + typeof arguments[m] + "} " + arguments[m]); + } + } + } + return a.apply(this, arguments); + }; + } + j[c].describe = function () { + return dhtmlx.assert_method_info(j, c, h, l); + }; +}; +dhtmlx.assert_event_call = function (e, c, a) { + if (e._event_check) { + if (!e._event_check[c]) { + dhtmlx.log("warn", "Not expected event call :" + c); + } else { + if (dhtmlx.isNotDefined(a)) { + dhtmlx.log("warn", "Event without parameters :" + c); + } else { + if (e._event_check_size[c] != a.length) { + dhtmlx.log("warn", "Incorrect event call, expected " + e._event_check_size[c] + " parameter(s), but have " + a.length + " parameter(s), for " + c + " event"); + } + } + } + } +}; +dhtmlx.assert_event_attach = function (c, a) { + if (c._event_check && !c._event_check[a]) { + dhtmlx.log("warn", "Unknown event name: " + a); + } +}; +dhtmlx.assert_property = function (c, a) { + if (!c._settings_check) { + c._settings_check = {}; + } + dhtmlx.extend(c._settings_check, a); +}; +dhtmlx.assert_check = function (e, c) { + if (typeof e == "object") { + for (var a in e) { + dhtmlx.assert_settings(a, e[a], c); + } + } +}; +dhtmlx.assert_settings = function (m, h, g) { + g = g || this._settings_check; + if (g) { + if (!g[m]) { + return dhtmlx.log("warn", "Unknown propery: " + m); + } + var l = ""; + var c = ""; + var a = false; + for (var e = 0; e < g[m].length; e++) { + var j = g[m][e]; + if (typeof j == "string") { + continue; + } + if (typeof j == "function") { + a = a || j(h); + } else { + if (typeof j == "object" && typeof j[1] == "function") { + a = a || j[1](h); + if (a && j[2]) { + dhtmlx.assert_check(h, j[2]); + } + } + } + if (a) { + break; + } + } + if (!a) { + dhtmlx.log("warn", "Invalid configuration\n" + dhtmlx.assert_info(m, g) + "\nActual value: {" + typeof h + "} " + h); + } + } +}; +dhtmlx.assert_info = function (c, j) { + var a = j[c]; + var h = ""; + var g = []; + for (var e = 0; e < a.length; e++) { + if (typeof rule == "string") { + h = a[e]; + } else { + if (a[e].describe) { + g.push(a[e].describe()); + } else { + if (a[e][1] && a[e][1].describe) { + g.push(a[e][1].describe()); + } + } + } + } + return "Property: " + c + ", " + h + " \nExpected value: \n - " + g.join("\n - "); +}; +if (dhtmlx.assert_enabled()) { + dhtmlx.assert_rule_color = function (a) { + if (typeof a != "string") { + return false; + } + if (a.indexOf("#") !== 0) { + return false; + } + if (a.substr(1).replace(/[0-9A-F]/gi, "") !== "") { + return false; + } + return true; + }; + dhtmlx.assert_rule_color.describe = function () { + return "{String} Value must start from # and contain hexadecimal code of color"; + }; + dhtmlx.assert_rule_template = function (a) { + if (typeof a == "function") { + return true; + } + if (typeof a == "string") { + return true; + } + return false; + }; + dhtmlx.assert_rule_template.describe = function () { + return "{Function},{String} Value must be a function which accepts data object and return text string, or a sting with optional template markers"; + }; + dhtmlx.assert_rule_boolean = function (a) { + if (typeof a == "boolean") { + return true; + } + return false; + }; + dhtmlx.assert_rule_boolean.describe = function () { + return "{Boolean} true or false"; + }; + dhtmlx.assert_rule_object = function (a, c) { + if (typeof a == "object") { + return true; + } + return false; + }; + dhtmlx.assert_rule_object.describe = function () { + return "{Object} Configuration object"; + }; + dhtmlx.assert_rule_string = function (a) { + if (typeof a == "string") { + return true; + } + return false; + }; + dhtmlx.assert_rule_string.describe = function () { + return "{String} Plain string"; + }; + dhtmlx.assert_rule_htmlpt = function (a) { + return !!dhtmlx.toNode(a); + }; + dhtmlx.assert_rule_htmlpt.describe = function () { + return "{Object},{String} HTML node or ID of HTML Node"; + }; + dhtmlx.assert_rule_notdocumented = function (a) { + return false; + }; + dhtmlx.assert_rule_notdocumented.describe = function () { + return "This options wasn't documented"; + }; + dhtmlx.assert_rule_key = function (c) { + var a = function (e) { + return c[e]; + }; + a.describe = function () { + var g = []; + for (var e in c) { + g.push(e); + } + return "{String} can take one of next values: " + g.join(", "); + }; + return a; + }; + dhtmlx.assert_rule_dimension = function (a) { + if (a * 1 == a && !isNaN(a) && a >= 0) { + return true; + } + return false; + }; + dhtmlx.assert_rule_dimension.describe = function () { + return "{Integer} value must be a positive number"; + }; + dhtmlx.assert_rule_number = function (a) { + if (typeof a == "number") { + return true; + } + return false; + }; + dhtmlx.assert_rule_number.describe = function () { + return "{Integer} value must be a number"; + }; + dhtmlx.assert_rule_function = function (a) { + if (typeof a == "function") { + return true; + } + return false; + }; + dhtmlx.assert_rule_function.describe = function () { + return "{Function} value must be a custom function"; + }; + dhtmlx.assert_rule_any = function (a) { + return true; + }; + dhtmlx.assert_rule_any.describe = function () { + return "Any value"; + }; + dhtmlx.assert_rule_mix = function (e, c) { + var g = function (a) { + if (e(a) || c(a)) { + return true; + } + return false; + }; + g.describe = function () { + return e.describe(); + }; + return g; + }; +} +dhtmlx.codebase = "./"; +dhtmlx.copy = function (c) { + var a = dhtmlx.copy._function; + a.prototype = c; + return new a(); +}; +dhtmlx.copy._function = function () {}; +dhtmlx.extend = function (c, a) { + for (var e in a) { + c[e] = a[e]; + } + if (dhtmlx.assert_enabled() && a._assert) { + c._assert(); + c._assert = null; + } + dhtmlx.assert(c, "Invalid nesting target"); + dhtmlx.assert(a, "Invalid nesting source"); + if (a._init) { + c._init(); + } + return c; +}; +dhtmlx.proto_extend = function () { + var j = arguments; + var e = j[0]; + var c = []; + for (var h = j.length - 1; h > 0; h--) { + if (typeof j[h] == "function") { + j[h] = j[h].prototype; + } + for (var g in j[h]) { + if (g == "_init") { + c.push(j[h][g]); + } else { + if (!e[g]) { + e[g] = j[h][g]; + } + } + } + } + if (j[0]._init) { + c.push(j[0]._init); + } + e._init = function () { + for (var l = 0; l < c.length; l++) { + c[l].apply(this, arguments); + } + }; + e.base = j[1]; + var a = function (l) { + this._init(l); + if (this._parseSettings) { + this._parseSettings(l, this.defaults); + } + }; + a.prototype = e; + e = j = null; + return a; +}; +dhtmlx.bind = function (c, a) { + return function () { + return c.apply(a, arguments); + }; +}; +dhtmlx.require = function (a) { + if (!dhtmlx._modules[a]) { + dhtmlx.assert(dhtmlx.ajax, "load module is required"); + dhtmlx.exec( + dhtmlx + .ajax() + .sync() + .get(dhtmlx.codebase + a).responseText + ); + dhtmlx._modules[a] = true; + } +}; +dhtmlx._modules = {}; +dhtmlx.exec = function (code) { + if (window.execScript) { + window.execScript(code); + } else { + window.eval(code); + } +}; +dhtmlx.methodPush = function (a, e, c) { + return function () { + var g = false; + g = a[e].apply(a, arguments); + return g; + }; +}; +dhtmlx.isNotDefined = function (c) { + return typeof c == "undefined"; +}; +dhtmlx.delay = function (g, c, e, a) { + setTimeout(function () { + var h = g.apply(c, e); + g = c = e = null; + return h; + }, a || 1); +}; +dhtmlx.uid = function () { + if (!this._seed) { + this._seed = new Date().valueOf(); + } + this._seed++; + return this._seed; +}; +dhtmlx.toNode = function (a) { + if (typeof a == "string") { + return document.getElementById(a); + } + return a; +}; +dhtmlx.toArray = function (a) { + return dhtmlx.extend(a || [], dhtmlx.PowerArray); +}; +dhtmlx.toFunctor = function (str) { + return typeof str == "string" ? eval(str) : str; +}; +dhtmlx._events = {}; +dhtmlx.event = function (g, e, a, c) { + g = dhtmlx.toNode(g); + var h = dhtmlx.uid(); + dhtmlx._events[h] = [g, e, a]; + if (c) { + a = dhtmlx.bind(a, c); + } + if (g.addEventListener) { + g.addEventListener(e, a, false); + } else { + if (g.attachEvent) { + g.attachEvent("on" + e, a); + } + } + return h; +}; +dhtmlx.eventRemove = function (c) { + if (!c) { + return; + } + dhtmlx.assert(this._events[c], "Removing non-existing event"); + var a = dhtmlx._events[c]; + if (a[0].removeEventListener) { + a[0].removeEventListener(a[1], a[2], false); + } else { + if (a[0].detachEvent) { + a[0].detachEvent("on" + a[1], a[2]); + } + } + delete this._events[c]; +}; +dhtmlx.log = function (c, e, a) { + if (window.console && console.log) { + c = c.toLowerCase(); + if (window.console[c]) { + window.console[c](e || "unknown error"); + } else { + window.console.log(c + ": " + e); + } + if (a) { + window.console.log(a); + } + } +}; +dhtmlx.log_full_time = function (a) { + dhtmlx._start_time_log = new Date(); + dhtmlx.log("Info", "Timing start [" + a + "]"); + window.setTimeout(function () { + var c = new Date(); + dhtmlx.log("Info", "Timing end [" + a + "]:" + (c.valueOf() - dhtmlx._start_time_log.valueOf()) / 1000 + "s"); + }, 1); +}; +dhtmlx.log_time = function (a) { + var e = "_start_time_log" + a; + if (!dhtmlx[e]) { + dhtmlx[e] = new Date(); + dhtmlx.log("Info", "Timing start [" + a + "]"); + } else { + var c = new Date(); + dhtmlx.log("Info", "Timing end [" + a + "]:" + (c.valueOf() - dhtmlx[e].valueOf()) / 1000 + "s"); + dhtmlx[e] = null; + } +}; +dhtmlx.error = function (c, a) { + dhtmlx.log("error", c, a); +}; +dhtmlx.EventSystem = { + _init: function () { + this._events = {}; + this._handlers = {}; + this._map = {}; + }, + block: function () { + this._events._block = true; + }, + unblock: function () { + this._events._block = false; + }, + mapEvent: function (a) { + dhtmlx.extend(this._map, a); + }, + callEvent: function (e, h) { + if (this._events._block) { + return true; + } + e = e.toLowerCase(); + dhtmlx.assert_event_call(this, e, h); + var g = this._events[e.toLowerCase()]; + var a = true; + if (dhtmlx.debug) { + dhtmlx.log("info", "[" + this.name + "] event:" + e, h); + } + if (g) { + for (var c = 0; c < g.length; c++) { + if (g[c].apply(this, h || []) === false) { + a = false; + } + } + } + if (this._map[e] && !this._map[e].callEvent(e, h)) { + a = false; + } + return a; + }, + attachEvent: function (c, a, g) { + c = c.toLowerCase(); + dhtmlx.assert_event_attach(this, c); + g = g || dhtmlx.uid(); + a = dhtmlx.toFunctor(a); + var e = this._events[c] || dhtmlx.toArray(); + e.push(a); + this._events[c] = e; + this._handlers[g] = { f: a, t: c }; + return g; + }, + detachEvent: function (g) { + if (this._handlers[g]) { + var c = this._handlers[g].t; + var a = this._handlers[g].f; + var e = this._events[c]; + e.remove(a); + delete this._handlers[g]; + } + }, +}; +dhtmlx.PowerArray = { + removeAt: function (c, a) { + if (c >= 0) { + this.splice(c, a || 1); + } + }, + remove: function (a) { + this.removeAt(this.find(a)); + }, + insertAt: function (c, e) { + if (!e && e !== 0) { + this.push(c); + } else { + var a = this.splice(e, this.length - e); + this[e] = c; + this.push.apply(this, a); + } + }, + find: function (a) { + for (i = 0; i < this.length; i++) { + if (a == this[i]) { + return i; + } + } + return -1; + }, + each: function (a, e) { + for (var c = 0; c < this.length; c++) { + a.call(e || this, this[c]); + } + }, + map: function (a, e) { + for (var c = 0; c < this.length; c++) { + this[c] = a.call(e || this, this[c]); + } + return this; + }, +}; +dhtmlx.env = {}; +if (navigator.userAgent.indexOf("Opera") != -1) { + dhtmlx._isOpera = true; +} else { + dhtmlx._isIE = !!document.all; + dhtmlx._isFF = !document.all; + dhtmlx._isWebKit = navigator.userAgent.indexOf("KHTML") != -1; + if (navigator.appVersion.indexOf("MSIE 8.0") != -1 && document.compatMode != "BackCompat") { + dhtmlx._isIE = 8; + } + if (navigator.appVersion.indexOf("MSIE 9.0") != -1 && document.compatMode != "BackCompat") { + dhtmlx._isIE = 9; + } +} +dhtmlx.env = {}; +(function () { + dhtmlx.env.transform = false; + dhtmlx.env.transition = false; + var a = {}; + a.names = ["transform", "transition"]; + a.transform = ["transform", "WebkitTransform", "MozTransform", "oTransform", "msTransform"]; + a.transition = ["transition", "WebkitTransition", "MozTransition", "oTransition"]; + var g = document.createElement("DIV"); + var e; + for (var c = 0; c < a.names.length; c++) { + while ((p = a[a.names[c]].pop())) { + if (typeof g.style[p] != "undefined") { + dhtmlx.env[a.names[c]] = true; + } + } + } +})(); +dhtmlx.env.transform_prefix = (function () { + var a; + if (dhtmlx._isOpera) { + a = "-o-"; + } else { + a = ""; + if (dhtmlx._isFF) { + a = "-moz-"; + } + if (dhtmlx._isWebKit) { + a = "-webkit-"; + } + } + return a; +})(); +dhtmlx.env.svg = (function () { + return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"); +})(); +dhtmlx.zIndex = { drag: 10000 }; +dhtmlx.html = { + create: function (c, a, e) { + a = a || {}; + var g = document.createElement(c); + for (var h in a) { + g.setAttribute(h, a[h]); + } + if (a.style) { + g.style.cssText = a.style; + } + if (a["class"]) { + g.className = a["class"]; + } + if (e) { + g.innerHTML = e; + } + return g; + }, + getValue: function (a) { + a = dhtmlx.toNode(a); + if (!a) { + return ""; + } + return dhtmlx.isNotDefined(a.value) ? a.innerHTML : a.value; + }, + remove: function (c) { + if (c instanceof Array) { + for (var a = 0; a < c.length; a++) { + this.remove(c[a]); + } + } else { + if (c && c.parentNode) { + c.parentNode.removeChild(c); + } + } + }, + insertBefore: function (c, e, a) { + if (!c) { + return; + } + if (e) { + e.parentNode.insertBefore(c, e); + } else { + a.appendChild(c); + } + }, + locate: function (c, h) { + c = c || event; + var a = c.target || c.srcElement; + while (a) { + if (a.getAttribute) { + var g = a.getAttribute(h); + if (g) { + return g; + } + } + a = a.parentNode; + } + return null; + }, + offset: function (g) { + if (g.getBoundingClientRect) { + var l = g.getBoundingClientRect(); + var m = document.body; + var c = document.documentElement; + var a = window.pageYOffset || c.scrollTop || m.scrollTop; + var h = window.pageXOffset || c.scrollLeft || m.scrollLeft; + var j = c.clientTop || m.clientTop || 0; + var n = c.clientLeft || m.clientLeft || 0; + var o = l.top + a - j; + var e = l.left + h - n; + return { y: Math.round(o), x: Math.round(e) }; + } else { + var o = 0, + e = 0; + while (g) { + o = o + parseInt(g.offsetTop, 10); + e = e + parseInt(g.offsetLeft, 10); + g = g.offsetParent; + } + return { y: o, x: e }; + } + }, + pos: function (a) { + a = a || event; + if (a.pageX || a.pageY) { + return { x: a.pageX, y: a.pageY }; + } + var c = dhtmlx._isIE && document.compatMode != "BackCompat" ? document.documentElement : document.body; + return { x: a.clientX + c.scrollLeft - c.clientLeft, y: a.clientY + c.scrollTop - c.clientTop }; + }, + preventEvent: function (a) { + if (a && a.preventDefault) { + a.preventDefault(); + } + dhtmlx.html.stopEvent(a); + }, + stopEvent: function (a) { + (a || event).cancelBubble = true; + return false; + }, + addCss: function (c, a) { + c.className += " " + a; + }, + removeCss: function (c, a) { + c.className = c.className.replace(RegExp(a, "g"), ""); + }, +}; +(function () { + var a = document.getElementsByTagName("SCRIPT"); + dhtmlx.assert(a.length, "Can't locate codebase"); + if (a.length) { + a = (a[a.length - 1].getAttribute("src") || "").split("/"); + a.splice(a.length - 1, 1); + dhtmlx.codebase = a.slice(0, a.length).join("/") + "/"; + } +})(); +if (!dhtmlx.ui) { + dhtmlx.ui = {}; +} +dhtmlx.Destruction = { + _init: function () { + dhtmlx.destructors.push(this); + }, + destructor: function () { + this.destructor = function () {}; + this._htmlmap = null; + this._htmlrows = null; + if (this._html) { + document.body.appendChild(this._html); + } + this._html = null; + if (this._obj) { + this._obj.innerHTML = ""; + this._obj._htmlmap = null; + } + this._obj = this._dataobj = null; + this.data = null; + this._events = this._handlers = {}; + if (this.render) { + this.render = function () {}; + } + }, +}; +dhtmlx.destructors = []; +dhtmlx.event(window, "unload", function () { + if (dhtmlx.destructors) { + for (var e = 0; e < dhtmlx.destructors.length; e++) { + dhtmlx.destructors[e].destructor(); + } + dhtmlx.destructors = []; + } + for (var c in dhtmlx._events) { + var g = dhtmlx._events[c]; + if (g[0].removeEventListener) { + g[0].removeEventListener(g[1], g[2], false); + } else { + if (g[0].detachEvent) { + g[0].detachEvent("on" + g[1], g[2]); + } + } + delete dhtmlx._events[c]; + } +}); +dhtmlx.ajax = function (a, c, e) { + if (arguments.length !== 0) { + var g = new dhtmlx.ajax(); + if (e) { + g.master = e; + } + g.get(a, null, c); + } + if (!this.getXHR) { + return new dhtmlx.ajax(); + } + return this; +}; +dhtmlx.ajax.prototype = { + getXHR: function () { + if (dhtmlx._isIE) { + return new ActiveXObject("Microsoft.xmlHTTP"); + } else { + return new XMLHttpRequest(); + } + }, + send: function (h, n, l) { + var c = this.getXHR(); + if (typeof l == "function") { + l = [l]; + } + if (typeof n == "object") { + var j = []; + for (var e in n) { + var m = n[e]; + if (m === null || m === dhtmlx.undefined) { + m = ""; + } + j.push(e + "=" + encodeURIComponent(m)); + } + n = j.join("&"); + } + if (n && !this.post) { + h = h + (h.indexOf("?") != -1 ? "&" : "?") + n; + n = null; + } + c.open(this.post ? "POST" : "GET", h, !this._sync); + if (this.post) { + c.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + } + var g = this; + c.onreadystatechange = function () { + if (!c.readyState || c.readyState == 4) { + if (l && g) { + for (var a = 0; a < l.length; a++) { + if (l[a]) { + l[a].call(g.master || g, c.responseText, c.responseXML, c); + } + } + } + g.master = null; + l = g = null; + } + }; + c.send(n || null); + return c; + }, + get: function (a, e, c) { + this.post = false; + return this.send(a, e, c); + }, + post: function (a, e, c) { + this.post = true; + return this.send(a, e, c); + }, + sync: function () { + this._sync = true; + return this; + }, +}; +dhtmlx.AtomDataLoader = { + _init: function (a) { + this.data = {}; + if (a) { + this._settings.datatype = a.datatype || "json"; + this._after_init.push(this._load_when_ready); + } + }, + _load_when_ready: function () { + this._ready_for_data = true; + if (this._settings.url) { + this.url_setter(this._settings.url); + } + if (this._settings.data) { + this.data_setter(this._settings.data); + } + }, + url_setter: function (a) { + if (!this._ready_for_data) { + return a; + } + this.load(a, this._settings.datatype); + return a; + }, + data_setter: function (a) { + if (!this._ready_for_data) { + return a; + } + this.parse(a, this._settings.datatype); + return true; + }, + load: function (a, c) { + this.callEvent("onXLS", []); + if (typeof c == "string") { + this.data.driver = dhtmlx.DataDriver[c]; + c = arguments[2]; + } else { + this.data.driver = dhtmlx.DataDriver[this._settings.datatype || "xml"]; + } + dhtmlx.ajax(a, [this._onLoad, c], this); + }, + parse: function (c, a) { + this.callEvent("onXLS", []); + this.data.driver = dhtmlx.DataDriver[a || "xml"]; + this._onLoad(c, null); + }, + _onLoad: function (h, c, a) { + var e = this.data.driver; + var g = e.getRecords(e.toObject(h, c))[0]; + this.data = e ? e.getDetails(g) : h; + this.callEvent("onXLE", []); + }, + _check_data_feed: function (c) { + if (!this._settings.dataFeed || this._ignore_feed || !c) { + return true; + } + var a = this._settings.dataFeed; + if (typeof a == "function") { + return a.call(this, c.id || c, c); + } + a = a + (a.indexOf("?") == -1 ? "?" : "&") + "action=get&id=" + encodeURIComponent(c.id || c); + this.callEvent("onXLS", []); + dhtmlx.ajax( + a, + function (g, e) { + this._ignore_feed = true; + this.setValues(dhtmlx.DataDriver.json.toObject(g)[0]); + this._ignore_feed = false; + this.callEvent("onXLE", []); + }, + this + ); + return false; + }, +}; +dhtmlx.DataDriver = {}; +dhtmlx.DataDriver.json = { + toObject: function (data) { + if (!data) { + data = "[]"; + } + if (typeof data == "string") { + eval("dhtmlx.temp=" + data); + return dhtmlx.temp; + } + return data; + }, + getRecords: function (a) { + if (a && a.data) { + a = a.data; + } + if (a && !(a instanceof Array)) { + return [a]; + } + return a; + }, + getDetails: function (a) { + return a; + }, + getInfo: function (a) { + return { _size: a.total_count || 0, _from: a.pos || 0, _key: a.dhx_security }; + }, +}; +dhtmlx.DataDriver.json_ext = { + toObject: function (data) { + if (!data) { + data = "[]"; + } + if (typeof data == "string") { + var temp; + eval("temp=" + data); + dhtmlx.temp = []; + var header = temp.header; + for (var i = 0; i < temp.data.length; i++) { + var item = {}; + for (var j = 0; j < header.length; j++) { + if (typeof temp.data[i][j] != "undefined") { + item[header[j]] = temp.data[i][j]; + } + } + dhtmlx.temp.push(item); + } + return dhtmlx.temp; + } + return data; + }, + getRecords: function (a) { + if (a && !(a instanceof Array)) { + return [a]; + } + return a; + }, + getDetails: function (a) { + return a; + }, + getInfo: function (a) { + return { _size: a.total_count || 0, _from: a.pos || 0 }; + }, +}; +dhtmlx.DataDriver.html = { + toObject: function (c) { + if (typeof c == "string") { + var a = null; + if (c.indexOf("<") == -1) { + a = dhtmlx.toNode(c); + } + if (!a) { + a = document.createElement("DIV"); + a.innerHTML = c; + } + return a.getElementsByTagName(this.tag); + } + return c; + }, + getRecords: function (a) { + if (a.tagName) { + return a.childNodes; + } + return a; + }, + getDetails: function (a) { + return dhtmlx.DataDriver.xml.tagToObject(a); + }, + getInfo: function (a) { + return { _size: 0, _from: 0 }; + }, + tag: "LI", +}; +dhtmlx.DataDriver.jsarray = { + toObject: function (data) { + if (typeof data == "string") { + eval("dhtmlx.temp=" + data); + return dhtmlx.temp; + } + return data; + }, + getRecords: function (a) { + return a; + }, + getDetails: function (e) { + var a = {}; + for (var c = 0; c < e.length; c++) { + a["data" + c] = e[c]; + } + return a; + }, + getInfo: function (a) { + return { _size: 0, _from: 0 }; + }, +}; +dhtmlx.DataDriver.csv = { + toObject: function (a) { + return a; + }, + getRecords: function (a) { + return a.split(this.row); + }, + getDetails: function (e) { + e = this.stringToArray(e); + var a = {}; + for (var c = 0; c < e.length; c++) { + a["data" + c] = e[c]; + } + return a; + }, + getInfo: function (a) { + return { _size: 0, _from: 0 }; + }, + stringToArray: function (c) { + c = c.split(this.cell); + for (var a = 0; a < c.length; a++) { + c[a] = c[a].replace(/^[ \t\n\r]*(\"|)/g, "").replace(/(\"|)[ \t\n\r]*$/g, ""); + } + return c; + }, + row: "\n", + cell: ",", +}; +dhtmlx.DataDriver.xml = { + toObject: function (c, a) { + if (a && (a = this.checkResponse(c, a))) { + return a; + } + if (typeof c == "string") { + return this.fromString(c); + } + return c; + }, + getRecords: function (a) { + return this.xpath(a, this.records); + }, + records: "/*/item", + getDetails: function (a) { + return this.tagToObject(a, {}); + }, + getInfo: function (a) { + return { _size: a.documentElement.getAttribute("total_count") || 0, _from: a.documentElement.getAttribute("pos") || 0, _key: a.documentElement.getAttribute("dhx_security") }; + }, + xpath: function (h, o) { + if (window.XPathResult) { + var g = h; + if (h.nodeName.indexOf("document") == -1) { + h = h.ownerDocument; + } + var m = []; + var c = h.evaluate(o, g, null, XPathResult.ANY_TYPE, null); + var n = c.iterateNext(); + while (n) { + m.push(n); + n = c.iterateNext(); + } + return m; + } else { + var l = true; + try { + if (typeof h.selectNodes == "undefined") { + l = false; + } + } catch (j) {} + if (l) { + return h.selectNodes(o); + } else { + var a = o.split("/").pop(); + return h.getElementsByTagName(a); + } + } + }, + tagToObject: function (e, n) { + n = n || {}; + var h = false; + var g = e.attributes; + if (g && g.length) { + for (var l = 0; l < g.length; l++) { + n[g[l].name] = g[l].value; + } + h = true; + } + var c = e.childNodes; + var m = {}; + for (var l = 0; l < c.length; l++) { + if (c[l].nodeType == 1) { + var j = c[l].tagName; + if (typeof n[j] != "undefined") { + if (!(n[j] instanceof Array)) { + n[j] = [n[j]]; + } + n[j].push(this.tagToObject(c[l], {})); + } else { + n[c[l].tagName] = this.tagToObject(c[l], {}); + } + h = true; + } + } + if (!h) { + return this.nodeValue(e); + } + n.value = this.nodeValue(e); + return n; + }, + nodeValue: function (a) { + if (a.firstChild) { + return a.firstChild.wholeText || a.firstChild.data; + } + return ""; + }, + fromString: function (c) { + if (window.DOMParser && !dhtmlx._isIE) { + return new DOMParser().parseFromString(c, "text/xml"); + } + if (window.ActiveXObject) { + var a = new ActiveXObject("Microsoft.xmlDOM"); + a.loadXML(c); + return a; + } + dhtmlx.error("Load from xml string is not supported"); + }, + checkResponse: function (g, e) { + if (e && e.firstChild && e.firstChild.tagName != "parsererror") { + return e; + } + var c = this.fromString(g.replace(/^[\s]+/, "")); + if (c) { + return c; + } + dhtmlx.error("xml can't be parsed", g); + }, +}; +dhtmlx.DataLoader = { + _init: function (a) { + a = a || ""; + this.name = "DataStore"; + this.data = a.datastore || new dhtmlx.DataStore(); + this._readyHandler = this.data.attachEvent("onStoreLoad", dhtmlx.bind(this._call_onready, this)); + }, + load: function (a, c) { + dhtmlx.AtomDataLoader.load.apply(this, arguments); + if (!this.data.feed) { + this.data.feed = function (g, e) { + if (this._load_count) { + return (this._load_count = [g, e]); + } else { + this._load_count = true; + } + this.load(a + (a.indexOf("?") == -1 ? "?" : "&") + "posStart=" + g + "&count=" + e, function () { + var h = this._load_count; + this._load_count = false; + if (typeof h == "object") { + this.data.feed.apply(this, h); + } + }); + }; + } + }, + _onLoad: function (e, c, a) { + this.data._parse(this.data.driver.toObject(e, c)); + this.callEvent("onXLE", []); + if (this._readyHandler) { + this.data.detachEvent(this._readyHandler); + this._readyHandler = null; + } + }, + dataFeed_setter: function (a) { + this.data.attachEvent( + "onBeforeFilter", + dhtmlx.bind(function (l, j) { + if (this._settings.dataFeed) { + var h = {}; + if (!l && !h) { + return; + } + if (typeof l == "function") { + if (!j) { + return; + } + l(j, h); + } else { + h = { text: j }; + } + this.clearAll(); + var c = this._settings.dataFeed; + if (typeof c == "function") { + return c.call(this, j, h); + } + var g = []; + for (var e in h) { + g.push("dhx_filter[" + e + "]=" + encodeURIComponent(h[e])); + } + this.load(c + (c.indexOf("?") < 0 ? "?" : "&") + g.join("&"), this._settings.datatype); + return false; + } + }, this) + ); + return a; + }, + _call_onready: function () { + if (this._settings.ready) { + var a = dhtmlx.toFunctor(this._settings.ready); + if (a && a.call) { + a.apply(this, arguments); + } + } + }, +}; +dhtmlx.DataStore = function () { + this.name = "DataStore"; + dhtmlx.extend(this, dhtmlx.EventSystem); + this.setDriver("xml"); + this.pull = {}; + this.order = dhtmlx.toArray(); +}; +dhtmlx.DataStore.prototype = { + setDriver: function (a) { + dhtmlx.assert(dhtmlx.DataDriver[a], "incorrect DataDriver"); + this.driver = dhtmlx.DataDriver[a]; + }, + _parse: function (h) { + this.callEvent("onParse", [this.driver, h]); + if (this._filter_order) { + this.filter(); + } + var l = this.driver.getInfo(h); + if (l._key) { + dhtmlx.security_key = l._key; + } + var g = this.driver.getRecords(h); + var n = (l._from || 0) * 1; + if (n === 0 && this.order[0]) { + n = this.order.length; + } + var c = 0; + for (var e = 0; e < g.length; e++) { + var a = this.driver.getDetails(g[e]); + var m = this.id(a); + if (!this.pull[m]) { + this.order[c + n] = m; + c++; + } + this.pull[m] = a; + if (this.extraParser) { + this.extraParser(a); + } + if (this._scheme) { + if (this._scheme.$init) { + this._scheme.$update(a); + } else { + if (this._scheme.$update) { + this._scheme.$update(a); + } + } + } + } + for (var e = 0; e < l._size; e++) { + if (!this.order[e]) { + var m = dhtmlx.uid(); + var a = { id: m, $template: "loading" }; + this.pull[m] = a; + this.order[e] = m; + } + } + this.callEvent("onStoreLoad", [this.driver, h]); + this.refresh(); + }, + id: function (a) { + return a.id || (a.id = dhtmlx.uid()); + }, + changeId: function (c, a) { + dhtmlx.assert(this.pull[c], "Can't change id, for non existing item: " + c); + this.pull[a] = this.pull[c]; + this.pull[a].id = a; + this.order[this.order.find(c)] = a; + if (this._filter_order) { + this._filter_order[this._filter_order.find(c)] = a; + } + this.callEvent("onIdChange", [c, a]); + if (this._render_change_id) { + this._render_change_id(c, a); + } + }, + get: function (a) { + return this.item(a); + }, + set: function (c, a) { + return this.update(c, a); + }, + item: function (a) { + return this.pull[a]; + }, + update: function (c, a) { + if (this._scheme && this._scheme.$update) { + this._scheme.$update(a); + } + if (this.callEvent("onBeforeUpdate", [c, a]) === false) { + return false; + } + this.pull[c] = a; + this.refresh(c); + }, + refresh: function (a) { + if (this._skip_refresh) { + return; + } + if (a) { + this.callEvent("onStoreUpdated", [a, this.pull[a], "update"]); + } else { + this.callEvent("onStoreUpdated", [null, null, null]); + } + }, + silent: function (a) { + this._skip_refresh = true; + a.call(this); + this._skip_refresh = false; + }, + getRange: function (g, e) { + if (g) { + g = this.indexById(g); + } else { + g = this.startOffset || 0; + } + if (e) { + e = this.indexById(e); + } else { + e = Math.min(this.endOffset || Infinity, this.dataCount() - 1); + if (e < 0) { + e = 0; + } + } + if (g > e) { + var c = e; + e = g; + g = c; + } + return this.getIndexRange(g, e); + }, + getIndexRange: function (g, e) { + e = Math.min(e || Infinity, this.dataCount() - 1); + var a = dhtmlx.toArray(); + for (var c = g || 0; c <= e; c++) { + a.push(this.item(this.order[c])); + } + return a; + }, + dataCount: function () { + return this.order.length; + }, + exists: function (a) { + return !!this.pull[a]; + }, + move: function (a, g) { + if (a < 0 || g < 0) { + dhtmlx.error("DataStore::move", "Incorrect indexes"); + return; + } + var e = this.idByIndex(a); + var c = this.item(e); + this.order.removeAt(a); + this.order.insertAt(e, Math.min(this.order.length, g)); + this.callEvent("onStoreUpdated", [e, c, "move"]); + }, + scheme: function (a) { + this._scheme = a; + }, + sync: function (h, g, a) { + if (typeof g != "function") { + a = g; + g = null; + } + if (dhtmlx.debug_bind) { + this.debug_sync_master = h; + dhtmlx.log("[sync] " + this.debug_bind_master.name + "@" + this.debug_bind_master._settings.id + " <= " + this.debug_sync_master.name + "@" + this.debug_sync_master._settings.id); + } + var e = h; + if (h.name != "DataStore") { + h = h.data; + } + var c = dhtmlx.bind(function (m, j, l) { + if (l != "update" || g) { + m = null; + } + if (!m) { + this.order = dhtmlx.toArray([].concat(h.order)); + this._filter_order = null; + this.pull = h.pull; + if (g) { + this.silent(g); + } + if (this._on_sync) { + this._on_sync(); + } + } + if (dhtmlx.debug_bind) { + dhtmlx.log("[sync:request] " + this.debug_sync_master.name + "@" + this.debug_sync_master._settings.id + " <= " + this.debug_bind_master.name + "@" + this.debug_bind_master._settings.id); + } + if (!a) { + this.refresh(m); + } else { + a = false; + } + }, this); + h.attachEvent("onStoreUpdated", c); + this.feed = function (l, j) { + e.loadNext(j, l); + }; + c(); + }, + add: function (h, a) { + if (this._scheme) { + h = h || {}; + for (var c in this._scheme) { + h[c] = h[c] || this._scheme[c]; + } + if (this._scheme) { + if (this._scheme.$init) { + this._scheme.$update(h); + } else { + if (this._scheme.$update) { + this._scheme.$update(h); + } + } + } + } + var j = this.id(h); + var g = this.dataCount(); + if (dhtmlx.isNotDefined(a) || a < 0) { + a = g; + } + if (a > g) { + dhtmlx.log("Warning", "DataStore:add", "Index of out of bounds"); + a = Math.min(this.order.length, a); + } + if (this.callEvent("onBeforeAdd", [j, h, a]) === false) { + return false; + } + if (this.exists(j)) { + return dhtmlx.error("Not unique ID"); + } + this.pull[j] = h; + this.order.insertAt(j, a); + if (this._filter_order) { + var e = this._filter_order.length; + if (!a && this.order.length) { + e = 0; + } + this._filter_order.insertAt(j, e); + } + this.callEvent("onafterAdd", [j, a]); + this.callEvent("onStoreUpdated", [j, h, "add"]); + return j; + }, + remove: function (e) { + if (e instanceof Array) { + for (var a = 0; a < e.length; a++) { + this.remove(e[a]); + } + return; + } + if (this.callEvent("onBeforeDelete", [e]) === false) { + return false; + } + if (!this.exists(e)) { + return dhtmlx.error("Not existing ID", e); + } + var c = this.item(e); + this.order.remove(e); + if (this._filter_order) { + this._filter_order.remove(e); + } + delete this.pull[e]; + this.callEvent("onafterdelete", [e]); + this.callEvent("onStoreUpdated", [e, c, "delete"]); + }, + clearAll: function () { + this.pull = {}; + this.order = dhtmlx.toArray(); + this.feed = null; + this._filter_order = null; + this.callEvent("onClearAll", []); + this.refresh(); + }, + idByIndex: function (a) { + if (a >= this.order.length || a < 0) { + dhtmlx.log("Warning", "DataStore::idByIndex Incorrect index"); + } + return this.order[a]; + }, + indexById: function (c) { + var a = this.order.find(c); + return a; + }, + next: function (c, a) { + return this.order[this.indexById(c) + (a || 1)]; + }, + first: function () { + return this.order[0]; + }, + last: function () { + return this.order[this.order.length - 1]; + }, + previous: function (c, a) { + return this.order[this.indexById(c) - (a || 1)]; + }, + sort: function (j, c, a) { + var e = j; + if (typeof j == "function") { + e = { as: j, dir: c }; + } else { + if (typeof j == "string") { + e = { by: j, dir: c, as: a }; + } + } + var h = [e.by, e.dir, e.as]; + if (!this.callEvent("onbeforesort", h)) { + return; + } + if (this.order.length) { + var l = dhtmlx.sort.create(e); + var g = this.getRange(this.first(), this.last()); + g.sort(l); + this.order = g.map(function (m) { + return this.id(m); + }, this); + } + this.refresh(); + this.callEvent("onaftersort", h); + }, + filter: function (h, g) { + if (!this.callEvent("onBeforeFilter", [h, g])) { + return; + } + if (this._filter_order) { + this.order = this._filter_order; + delete this._filter_order; + } + if (!this.order.length) { + return; + } + if (h) { + var c = h; + g = g || ""; + if (typeof h == "string") { + h = dhtmlx.Template.fromHTML(h); + g = g.toString().toLowerCase(); + c = function (m, l) { + return h(m).toLowerCase().indexOf(l) != -1; + }; + } + var e = dhtmlx.toArray(); + for (var a = 0; a < this.order.length; a++) { + var j = this.order[a]; + if (c(this.item(j), g)) { + e.push(j); + } + } + this._filter_order = this.order; + this.order = e; + } + this.refresh(); + this.callEvent("onAfterFilter", []); + }, + each: function (e, c) { + for (var a = 0; a < this.order.length; a++) { + e.call(c || this, this.item(this.order[a])); + } + }, + provideApi: function (g, c) { + this.debug_bind_master = g; + if (c) { + this.mapEvent({ onbeforesort: g, onaftersort: g, onbeforeadd: g, onafteradd: g, onbeforedelete: g, onafterdelete: g, onbeforeupdate: g }); + } + var e = ["get", "set", "sort", "add", "remove", "exists", "idByIndex", "indexById", "item", "update", "refresh", "dataCount", "filter", "next", "previous", "clearAll", "first", "last", "serialize"]; + for (var a = 0; a < e.length; a++) { + g[e[a]] = dhtmlx.methodPush(this, e[a]); + } + if (dhtmlx.assert_enabled()) { + this.assert_event(g); + } + }, + serialize: function () { + var e = this.order; + var a = []; + for (var c = 0; c < e.length; c++) { + a.push(this.pull[e[c]]); + } + return a; + }, +}; +dhtmlx.sort = { + create: function (a) { + return dhtmlx.sort.dir(a.dir, dhtmlx.sort.by(a.by, a.as)); + }, + as: { + int: function (e, c) { + e = e * 1; + c = c * 1; + return e > c ? 1 : e < c ? -1 : 0; + }, + string_strict: function (e, c) { + e = e.toString(); + c = c.toString(); + return e > c ? 1 : e < c ? -1 : 0; + }, + string: function (e, c) { + e = e.toString().toLowerCase(); + c = c.toString().toLowerCase(); + return e > c ? 1 : e < c ? -1 : 0; + }, + }, + by: function (c, a) { + if (!c) { + return a; + } + if (typeof a != "function") { + a = dhtmlx.sort.as[a || "string"]; + } + c = dhtmlx.Template.fromHTML(c); + return function (g, e) { + return a(c(g), c(e)); + }; + }, + dir: function (c, a) { + if (c == "asc") { + return a; + } + return function (g, e) { + return a(g, e) * -1; + }; + }, +}; +dhtmlx.KeyEvents = { + _init: function () { + dhtmlx.event(this._obj, "keypress", this._onKeyPress, this); + }, + _onKeyPress: function (c) { + c = c || event; + var a = c.which || c.keyCode; + this.callEvent(this._edit_id ? "onEditKeyPress" : "onKeyPress", [a, c.ctrlKey, c.shiftKey, c]); + }, +}; +dhtmlx.MouseEvents = { + _init: function () { + if (this.on_click) { + dhtmlx.event(this._obj, "click", this._onClick, this); + dhtmlx.event(this._obj, "contextmenu", this._onContext, this); + } + if (this.on_dblclick) { + dhtmlx.event(this._obj, "dblclick", this._onDblClick, this); + } + if (this.on_mouse_move) { + dhtmlx.event(this._obj, "mousemove", this._onMouse, this); + dhtmlx.event(this._obj, dhtmlx._isIE ? "mouseleave" : "mouseout", this._onMouse, this); + } + }, + _onClick: function (a) { + return this._mouseEvent(a, this.on_click, "ItemClick"); + }, + _onDblClick: function (a) { + return this._mouseEvent(a, this.on_dblclick, "ItemDblClick"); + }, + _onContext: function (a) { + var c = dhtmlx.html.locate(a, this._id); + if (c && !this.callEvent("onBeforeContextMenu", [c, a])) { + return dhtmlx.html.preventEvent(a); + } + }, + _onMouse: function (a) { + if (dhtmlx._isIE) { + a = document.createEventObject(event); + } + if (this._mouse_move_timer) { + window.clearTimeout(this._mouse_move_timer); + } + this.callEvent("onMouseMoving", [a]); + this._mouse_move_timer = window.setTimeout( + dhtmlx.bind(function () { + if (a.type == "mousemove") { + this._onMouseMove(a); + } else { + this._onMouseOut(a); + } + }, this), + 500 + ); + }, + _onMouseMove: function (a) { + if (!this._mouseEvent(a, this.on_mouse_move, "MouseMove")) { + this.callEvent("onMouseOut", [a || event]); + } + }, + _onMouseOut: function (a) { + this.callEvent("onMouseOut", [a || event]); + }, + _mouseEvent: function (l, j, c) { + l = l || event; + var a = l.target || l.srcElement; + var g = ""; + var m = null; + var h = false; + while (a && a.parentNode) { + if (!h && a.getAttribute) { + m = a.getAttribute(this._id); + if (m) { + if (a.getAttribute("userdata")) { + this.callEvent("onLocateData", [m, a, l]); + } + if (!this.callEvent("on" + c, [m, l, a])) { + return; + } + h = true; + } + } + g = a.className; + if (g) { + g = g.split(" "); + g = g[0] || g[1]; + if (j[g]) { + return j[g].call(this, l, m || dhtmlx.html.locate(l, this._id), a); + } + } + a = a.parentNode; + } + return h; + }, +}; +dhtmlx.Settings = { + _init: function () { + this._settings = this.config = {}; + }, + define: function (c, a) { + if (typeof c == "object") { + return this._parseSeetingColl(c); + } + return this._define(c, a); + }, + _define: function (c, a) { + dhtmlx.assert_settings.call(this, c, a); + var e = this[c + "_setter"]; + return (this._settings[c] = e ? e.call(this, a) : a); + }, + _parseSeetingColl: function (e) { + if (e) { + for (var c in e) { + this._define(c, e[c]); + } + } + }, + _parseSettings: function (e, a) { + var c = dhtmlx.extend({}, a); + if (typeof e == "object" && !e.tagName) { + dhtmlx.extend(c, e); + } + this._parseSeetingColl(c); + }, + _mergeSettings: function (a, e) { + for (var c in e) { + switch (typeof a[c]) { + case "object": + a[c] = this._mergeSettings(a[c] || {}, e[c]); + break; + case "undefined": + a[c] = e[c]; + break; + default: + break; + } + } + return a; + }, + _parseContainer: function (c, a, e) { + if (typeof c == "object" && !c.tagName) { + c = c.container; + } + this._obj = this.$view = dhtmlx.toNode(c); + if (!this._obj && e) { + this._obj = e(c); + } + dhtmlx.assert(this._obj, "Incorrect html container"); + this._obj.className += " " + a; + this._obj.onselectstart = function () { + return false; + }; + this._dataobj = this._obj; + }, + _set_type: function (a) { + if (typeof a == "object") { + return this.type_setter(a); + } + dhtmlx.assert(this.types, "RenderStack :: Types are not defined"); + dhtmlx.assert(this.types[a], "RenderStack :: Inccorect type name", a); + this.type = dhtmlx.extend({}, this.types[a]); + this.customize(); + }, + customize: function (a) { + if (a) { + dhtmlx.extend(this.type, a); + } + this.type._item_start = dhtmlx.Template.fromHTML(this.template_item_start(this.type)); + this.type._item_end = this.template_item_end(this.type); + this.render(); + }, + type_setter: function (a) { + this._set_type(typeof a == "object" ? dhtmlx.Type.add(this, a) : a); + return a; + }, + template_setter: function (a) { + return this.type_setter({ template: a }); + }, + css_setter: function (a) { + this._obj.className += " " + a; + return a; + }, +}; +dhtmlx.Template = { + _cache: {}, + empty: function () { + return ""; + }, + setter: function (a) { + return dhtmlx.Template.fromHTML(a); + }, + obj_setter: function (c) { + var a = dhtmlx.Template.setter(c); + var e = this; + return function () { + return a.apply(e, arguments); + }; + }, + fromHTML: function (a) { + if (typeof a == "function") { + return a; + } + if (this._cache[a]) { + return this._cache[a]; + } + a = (a || "").toString(); + a = a.replace(/[\r\n]+/g, "\\n"); + a = a.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g, '"+(obj.$1?"$2":"$3")+"'); + a = a.replace(/\{common\.([^}\(]*)\}/g, '"+common.$1+"'); + a = a.replace(/\{common\.([^\}\(]*)\(\)\}/g, '"+(common.$1?common.$1(obj):"")+"'); + a = a.replace(/\{obj\.([^}]*)\}/g, '"+obj.$1+"'); + a = a.replace(/#([a-z0-9_]+)#/gi, '"+obj.$1+"'); + a = a.replace(/\{obj\}/g, '"+obj+"'); + a = a.replace(/\{-obj/g, "{obj"); + a = a.replace(/\{-common/g, "{common"); + a = 'return "' + a + '";'; + return (this._cache[a] = Function("obj", "common", a)); + }, +}; +dhtmlx.Type = { + add: function (e, c) { + if (!e.types && e.prototype.types) { + e = e.prototype; + } + if (dhtmlx.assert_enabled()) { + this.assert_event(c); + } + var a = c.name || "default"; + this._template(c); + this._template(c, "edit"); + this._template(c, "loading"); + e.types[a] = dhtmlx.extend(dhtmlx.extend({}, e.types[a] || this._default), c); + return a; + }, + _default: { + css: "default", + template: function () { + return ""; + }, + template_edit: function () { + return ""; + }, + template_loading: function () { + return "..."; + }, + width: 150, + height: 80, + margin: 5, + padding: 0, + }, + _template: function (e, a) { + a = "template" + (a ? "_" + a : ""); + var c = e[a]; + if (c && typeof c == "string") { + if (c.indexOf("->") != -1) { + c = c.split("->"); + switch (c[0]) { + case "html": + c = dhtmlx.html.getValue(c[1]).replace(/\"/g, '\\"'); + break; + case "http": + c = new dhtmlx.ajax().sync().get(c[1], { uid: new Date().valueOf() }).responseText; + break; + default: + break; + } + } + e[a] = dhtmlx.Template.fromHTML(c); + } + }, +}; +dhtmlx.SingleRender = { + _init: function () {}, + _toHTML: function (a) { + return this.type._item_start(a, this.type) + this.type.template(a, this.type) + this.type._item_end; + }, + render: function () { + if (!this.callEvent || this.callEvent("onBeforeRender", [this.data])) { + if (this.data) { + this._dataobj.innerHTML = this._toHTML(this.data); + } + if (this.callEvent) { + this.callEvent("onAfterRender", []); + } + } + }, +}; +dhtmlx.ui.Tooltip = function (a) { + this.name = "Tooltip"; + if (dhtmlx.assert_enabled()) { + this._assert(); + } + if (typeof a == "string") { + a = { template: a }; + } + dhtmlx.extend(this, dhtmlx.Settings); + dhtmlx.extend(this, dhtmlx.SingleRender); + this._parseSettings(a, { type: "default", dy: 0, dx: 20 }); + this._dataobj = this._obj = document.createElement("DIV"); + this._obj.className = "dhx_tooltip"; + dhtmlx.html.insertBefore(this._obj, document.body.firstChild); +}; +dhtmlx.ui.Tooltip.prototype = { + show: function (a, c) { + if (this._disabled) { + return; + } + if (this.data != a) { + this.data = a; + this.render(a); + } + this._obj.style.top = c.y + this._settings.dy + "px"; + this._obj.style.left = c.x + this._settings.dx + "px"; + this._obj.style.display = "block"; + }, + hide: function () { + this.data = null; + this._obj.style.display = "none"; + }, + disable: function () { + this._disabled = true; + }, + enable: function () { + this._disabled = false; + }, + types: { default: dhtmlx.Template.fromHTML("{obj.id}") }, + template_item_start: dhtmlx.Template.empty, + template_item_end: dhtmlx.Template.empty, +}; +dhtmlx.AutoTooltip = { + tooltip_setter: function (c) { + var a = new dhtmlx.ui.Tooltip(c); + this.attachEvent("onMouseMove", function (h, g) { + a.show(this.get(h), dhtmlx.html.pos(g)); + }); + this.attachEvent("onMouseOut", function (h, g) { + a.hide(); + }); + this.attachEvent("onMouseMoving", function (h, g) { + a.hide(); + }); + return a; + }, +}; +dhtmlx.compat = function (a, c) { + if (dhtmlx.compat[a]) { + dhtmlx.compat[a](c); + } +}; +if (!dhtmlx.attaches) { + dhtmlx.attaches = {}; +} +dhtmlx.attaches.attachAbstract = function (c, a) { + var h = document.createElement("DIV"); + h.id = "CustomObject_" + dhtmlx.uid(); + h.style.width = "100%"; + h.style.height = "100%"; + h.cmp = "grid"; + document.body.appendChild(h); + this.attachObject(h.id); + a.container = h.id; + var g = this.vs[this.av]; + g.grid = new window[c](a); + g.gridId = h.id; + g.gridObj = h; + g.grid.setSizes = function () { + if (this.resize) { + this.resize(); + } else { + this.render(); + } + }; + var e = "_viewRestore"; + return this.vs[this[e]()].grid; +}; +dhtmlx.attaches.attachDataView = function (a) { + return this.attachAbstract("dhtmlXDataView", a); +}; +dhtmlx.attaches.attachChart = function (a) { + return this.attachAbstract("dhtmlXChart", a); +}; +dhtmlx.compat.layout = function () {}; +function dhtmlXCellObject(e, a) { + this.cell = document.createElement("DIV"); + this.cell.className = "dhx_cell" + (a || ""); + this._idd = e; + this._isCell = true; + this.conf = { + borders: true, + idx: {}, + css: a || "", + idx_data: { cont: "dhx_cell_cont", pr1: "dhx_cell_progress_bar", pr2: "dhx_cell_progress_img", menu: "dhx_cell_menu", toolbar: "dhx_cell_toolbar", ribbon: "dhx_cell_ribbon", sb: "dhx_cell_statusbar", cover: "dhx_cell_cover" }, + ofs_nodes: { t: {}, b: {} }, + }; + this.dataNodes = {}; + this.views = {}; + var c = document.createElement("DIV"); + c.className = "dhx_cell_cont" + this.conf.css; + this.cell.appendChild(c); + c = null; + this._updateIdx = function () { + for (var g in this.conf.idx) { + this.conf.idx[g] = null; + delete this.conf.idx[g]; + } + for (var l = 0; l < this.cell.childNodes.length; l++) { + var h = this.cell.childNodes[l].className; + for (var g in this.conf.idx_data) { + var j = new RegExp(this.conf.idx_data[g]); + if (h.match(j) != null) { + this.conf.idx[g] = l; + } + } + } + this.callEvent("_onIdxUpdated", []); + }; + this._adjustAttached = function () { + for (var g in this.dataNodes) { + if (this.dataNodes[g] != null && typeof this.dataNodes[g].setSizes == "function") { + this.dataNodes[g].setSizes(); + } + } + if (this.dataObj != null && typeof this.dataObj.setSizes == "function") { + if (this.dataType == "layout" && typeof window.dhtmlXLayoutCell != "undefined" && this instanceof window.dhtmlXLayoutCell && this.dataObj._getMainInst() != this.layout._getMainInst()) { + this.dataObj.setSizes(); + return; + } + this.dataObj.setSizes.apply(this.dataObj, arguments); + } + }; + this._setSize = function (u, r, v, m, n, o, j, l) { + if (this.conf.size == null) { + this.conf.size = {}; + } + if (l == null) { + l = {}; + } + var A = { left: "x", top: "y", width: "w", height: "h" }; + this.conf.size.x = u; + this.conf.size.y = r; + this.conf.size.w = Math.max(v, 0); + this.conf.size.h = Math.max(m, 0); + for (var s in A) { + var g = l[s] || s; + this.cell.style[g] = this.conf.size[A[s]] + "px"; + } + this.callEvent("_onSetSize", []); + if (o !== true) { + this._adjustCont(n, j); + } else { + this._adjustAttached(n); + } + this._adjustProgress(); + }; + this._adjustCont = function (n, l) { + var m = this.cell.childNodes[this.conf.idx.cont]; + var j = 0; + for (var g in this.conf.ofs_nodes.t) { + var h = this.conf.ofs_nodes.t[g]; + j += h == "func" ? this[g]() : h == true ? this.cell.childNodes[this.conf.idx[g]].offsetHeight : 0; + } + var o = 0; + for (var g in this.conf.ofs_nodes.b) { + var h = this.conf.ofs_nodes.b[g]; + o += h == "func" ? this[g]() : h == true ? this.cell.childNodes[this.conf.idx[g]].offsetHeight : 0; + } + m.style.left = "0px"; + m.style.top = j + "px"; + if (!this.conf.cells_cont) { + this.conf.cells_cont = {}; + m.style.width = this.cell.offsetWidth + "px"; + m.style.height = Math.max(this.cell.offsetHeight - j - o, 0) + "px"; + this.conf.cells_cont.w = parseInt(m.style.width) - m.offsetWidth; + this.conf.cells_cont.h = parseInt(m.style.height) - m.offsetHeight; + } + m.style.left = "0px"; + m.style.top = j + "px"; + m.style.width = Math.max(this.cell.offsetWidth + this.conf.cells_cont.w, 0) + "px"; + m.style.height = Math.max(this.conf.size.h - j - o + this.conf.cells_cont.h, 0) + "px"; + m = null; + this._adjustAttached(n); + if (l == "expand" && this.dataType == "editor" && this.dataObj != null) { + this.dataObj._prepareContent(true); + } + }; + this._mtbUpdBorder = function () { + var h = ["menu", "toolbar", "ribbon"]; + for (var l = 0; l < h.length; l++) { + if (this.conf.idx[h[l]] != null) { + var m = this.cell.childNodes[this.conf.idx[h[l]]]; + var j = "dhx_cell_" + h[l] + "_no_borders"; + var g = "dhx_cell_" + h[l] + "_def"; + m.className = m.className.replace(new RegExp(this.conf.borders ? j : g), this.conf.borders ? g : j); + m = null; + } + } + }; + this._resetSizeState = function () { + this.conf.cells_cont = null; + }; + this.conf.view = "def"; + this.conf.views_loaded = {}; + this.conf.views_loaded[this.conf.view] = true; + this._viewSave = function (j) { + this.views[j] = { borders: this.conf.borders, ofs_nodes: { t: {}, b: {} }, url_data: this.conf.url_data, dataType: this.dataType, dataObj: this.dataObj, cellCont: [], dataNodes: {}, dataNodesCont: {} }; + var l = this.cell.childNodes[this.conf.idx.cont]; + while (l.childNodes.length > 0) { + this.views[j].cellCont.push(l.firstChild); + l.removeChild(l.firstChild); + } + l = null; + this.dataType = null; + this.dataObj = null; + this.conf.url_data = null; + for (var h in this.dataNodes) { + for (var g in this.conf.ofs_nodes) { + if (typeof this.conf.ofs_nodes[g][h] != "undefined") { + this.views[j].ofs_nodes[g][h] = this.conf.ofs_nodes[g][h]; + this.conf.ofs_nodes[g][h] = null; + delete this.conf.ofs_nodes[g][h]; + } + } + this.views[j].dataNodesCont[h] = this.cell.childNodes[this.conf.idx[h]]; + this.cell.removeChild(this.cell.childNodes[this.conf.idx[h]]); + this.views[j].dataNodes[h] = this.dataNodes[h]; + this.dataNodes[h] = null; + delete this.dataNodes[h]; + this._updateIdx(); + } + this.callEvent("_onViewSave", [j]); + }; + this._viewRestore = function (j) { + if (this.views[j] == null) { + return; + } + this.dataObj = this.views[j].dataObj; + this.dataType = this.views[j].dataType; + this.conf.url_data = this.views[j].url_data; + for (var l = 0; l < this.views[j].cellCont.length; l++) { + this.cell.childNodes[this.conf.idx.cont].appendChild(this.views[j].cellCont[l]); + } + for (var h in this.views[j].dataNodes) { + this.dataNodes[h] = this.views[j].dataNodes[h]; + if (h == "menu") { + this.cell.insertBefore(this.views[j].dataNodesCont[h], this.cell.childNodes[this.conf.idx.toolbar || this.conf.idx.cont]); + } + if (h == "toolbar") { + this.cell.insertBefore(this.views[j].dataNodesCont[h], this.cell.childNodes[this.conf.idx.cont]); + } + if (h == "ribbon") { + this.cell.insertBefore(this.views[j].dataNodesCont[h], this.cell.childNodes[this.conf.idx.cont]); + } + if (h == "sb") { + this.cell.appendChild(this.views[j].dataNodesCont[h]); + } + this._updateIdx(); + } + for (var h in this.views[j].ofs_nodes) { + for (var g in this.views[j].ofs_nodes[h]) { + this.conf.ofs_nodes[h][g] = this.views[j].ofs_nodes[h][g]; + } + } + if (this.conf.borders != this.views[j].borders) { + this[this.views[j].borders ? "_showBorders" : "_hideBorders"](true); + } + if (this.dataType == "url" && this.conf.url_data != null && this.conf.url_data.ajax == false && this.conf.url_data.post_data != null) { + this.reloadURL(); + } + this.callEvent("_onViewRestore", [j]); + this._viewDelete(j); + }; + this._viewDelete = function (j) { + if (this.views[j] == null) { + return; + } + this.views[j].borders = null; + for (var h in this.views[j].ofs_nodes) { + for (var g in this.views[j].ofs_nodes[h]) { + this.views[j].ofs_nodes[h][g] = null; + } + this.views[j].ofs_nodes[h] = null; + } + this.views[j].dataType = null; + this.views[j].dataObj = null; + this.views[j].url_data = null; + for (var l = 0; l < this.views[j].cellCont.length; l++) { + this.views[j].cellCont[l] = null; + } + this.views[j].cellCont = null; + for (var h in this.views[j].dataNodes) { + this.views[j].dataNodes[h] = null; + this.views[j].dataNodesCont[h] = null; + } + this.views[j].dataNodes = this.views[j].dataNodesCont = null; + this.views[j] = null; + delete this.views[j]; + }; + window.dhx4._eventable(this); + this._updateIdx(); + return this; +} +dhtmlXCellObject.prototype.showView = function (a) { + if (this.conf.view == a) { + return false; + } + this._viewSave(this.conf.view); + this._viewRestore(a); + this._updateIdx(); + this._adjustCont(); + this.conf.view = a; + var c = typeof this.conf.views_loaded[this.conf.view] == "undefined"; + this.conf.views_loaded[this.conf.view] = true; + return c; +}; +dhtmlXCellObject.prototype.getViewName = function () { + return this.conf.view; +}; +dhtmlXCellObject.prototype.unloadView = function (g) { + if (g == this.conf.view) { + var h = this.conf.unloading; + this.conf.unloading = true; + if (typeof this.detachMenu == "function") { + this.detachMenu(); + } + if (typeof this.detachToolbar == "function") { + this.detachToolbar(); + } + if (typeof this.detachRibbon == "function") { + this.detachRibbon(); + } + this.detachStatusBar(); + this._detachObject(null, true); + this.conf.unloading = h; + if (!this.conf.unloading) { + this._adjustCont(this._idd); + } + return; + } + if (this.views[g] == null) { + return; + } + var e = this.views[g]; + for (var c in e.dataNodes) { + if (typeof e.dataNodes[c].unload == "function") { + e.dataNodes[c].unload(); + } + e.dataNodes[c] = null; + e.dataNodesCont[c] = null; + } + if (e.dataType == "url") { + if (e.cellCont != null && e.cellCont[0] != "null") { + this._detachURLEvents(e.cellCont[0]); + } + } else { + if (e.dataObj != null) { + if (typeof e.dataObj.unload == "function") { + e.dataObj.unload(); + } else { + if (typeof e.dataObj.destructor == "function") { + e.dataObj.destructor(); + } + } + e.dataObj = null; + } + } + e = null; + this._viewDelete(g); + if (typeof this.conf.views_loaded[g] != "undefined") { + delete this.conf.views_loaded[g]; + } +}; +dhtmlXCellObject.prototype.getId = function () { + return this._idd; +}; +dhtmlXCellObject.prototype.progressOn = function () { + if (this.conf.progress == true) { + return; + } + this.conf.progress = true; + var c = document.createElement("DIV"); + c.className = this.conf.idx_data.pr1; + var a = document.createElement("DIV"); + a.className = this.conf.idx_data.pr2; + if (this.conf.idx.cover != null) { + this.cell.insertBefore(a, this.cell.childNodes[this.conf.idx.cover]); + } else { + this.cell.appendChild(a); + } + this.cell.insertBefore(c, a); + c = a = null; + this._updateIdx(); + this._adjustProgress(); +}; +dhtmlXCellObject.prototype.progressOff = function () { + if (this.conf.progress != true) { + return; + } + this.cell.childNodes[this.conf.idx.pr2].parentNode.removeChild(this.cell.childNodes[this.conf.idx.pr2]); + this.cell.childNodes[this.conf.idx.pr1].parentNode.removeChild(this.cell.childNodes[this.conf.idx.pr1]); + this.conf.progress = false; + this._updateIdx(); +}; +dhtmlXCellObject.prototype._adjustProgress = function () { + if (this.conf.idx.pr1 == null) { + return; + } + if (!this.conf.pr) { + this.conf.pr = {}; + } + var c = this.cell.childNodes[this.conf.idx.pr1]; + var a = this.cell.childNodes[this.conf.idx.pr2]; + if (!this.conf.pr.ofs) { + a.style.width = c.offsetWidth + "px"; + a.style.height = c.offsetHeight + "px"; + this.conf.pr.ofs = { w: a.offsetWidth - a.clientWidth, h: a.offsetHeight - a.clientHeight }; + } + a.style.width = c.offsetWidth - this.conf.pr.ofs.w + "px"; + a.style.height = c.offsetHeight - this.conf.pr.ofs.h + "px"; + c = a = null; +}; +dhtmlXCellObject.prototype._showCellCover = function () { + if (this.conf.cover == true) { + return; + } + this.conf.cover = true; + var a = document.createElement("DIV"); + a.className = this.conf.idx_data.cover; + this.cell.appendChild(a); + a = null; + this._updateIdx(); +}; +dhtmlXCellObject.prototype._hideCellCover = function () { + if (this.conf.cover != true) { + return; + } + this.cell.removeChild(this.cell.childNodes[this.conf.idx.cover]); + this._updateIdx(); + this.conf.cover = false; +}; +dhtmlXCellObject.prototype._showBorders = function (a) { + if (this.conf.borders) { + return; + } + this.conf.borders = true; + this.cell.childNodes[this.conf.idx.cont].className = "dhx_cell_cont" + this.conf.css; + this.conf.cells_cont = null; + this._mtbUpdBorder(); + this.callEvent("_onBorderChange", [true]); + if (a !== true) { + this._adjustCont(this._idd); + } +}; +dhtmlXCellObject.prototype._hideBorders = function (a) { + if (!this.conf.borders) { + return; + } + this.conf.borders = false; + this.cell.childNodes[this.conf.idx.cont].className = "dhx_cell_cont" + this.conf.css + " dhx_cell_cont_no_borders"; + this.conf.cells_cont = null; + this._mtbUpdBorder(); + this.callEvent("_onBorderChange", [false]); + if (a !== true) { + this._adjustCont(this._idd); + } +}; +dhtmlXCellObject.prototype._getWidth = function () { + return this.cell.offsetWidth; +}; +dhtmlXCellObject.prototype._getHeight = function () { + return this.cell.offsetHeight; +}; +dhtmlXCellObject.prototype.showInnerScroll = function () { + this.cell.childNodes[this.conf.idx.cont].style.overflow = "auto"; +}; +dhtmlXCellObject.prototype._unload = function () { + this.conf.unloading = true; + this.callEvent("_onCellUnload", []); + this.progressOff(); + this.unloadView(this.conf.view); + this.dataNodes = null; + this.cell.parentNode.removeChild(this.cell); + this.cell = null; + window.dhx4._eventable(this, "clear"); + for (var c in this.views) { + this.unloadView(c); + } + this.conf = null; + for (var c in this) { + this[c] = null; + } +}; +dhtmlXCellObject.prototype.attachObject = function (g, e) { + if (window.dhx4.s2b(e) && !(typeof window.dhtmlXWindowsCell != "undefined" && this instanceof window.dhtmlXWindowsCell)) { + e = false; + } + if (typeof g == "string") { + g = document.getElementById(g); + } + if (g.parentNode == this.cell.childNodes[this.conf.idx.cont]) { + g = null; + return; + } + if (e) { + g.style.display = ""; + var a = g.offsetWidth; + var c = g.offsetHeight; + } + this._attachObject(g); + this.dataType = "obj"; + g.style.display = ""; + g = null; + if (e) { + this._adjustByCont(a, c); + } +}; +dhtmlXCellObject.prototype.appendObject = function (a) { + if (typeof a == "string") { + a = document.getElementById(a); + } + if (a.parentNode == this.cell.childNodes[this.conf.idx.cont]) { + a = null; + return; + } + if (!this.conf.append_mode) { + this.cell.childNodes[this.conf.idx.cont].style.overflow = "auto"; + this.conf.append_mode = true; + } + this._attachObject(a, null, null, true); + this.dataType = "obj"; + a.style.display = ""; + a = null; +}; +dhtmlXCellObject.prototype.detachObject = function (c, a) { + this._detachObject(null, c, a); +}; +dhtmlXCellObject.prototype.getAttachedStatusBar = function () { + return this.dataNodes.sb; +}; +dhtmlXCellObject.prototype.getAttachedObject = function () { + if (this.dataType == "obj" || this.dataType == "url" || this.dataType == "url-ajax") { + return this.cell.childNodes[this.conf.idx.cont].firstChild; + } else { + return this.dataObj; + } +}; +dhtmlXCellObject.prototype.attachURL = function (c, o, e) { + if (e == true) { + e = {}; + } + var g = typeof e != "undefined" && e != false && e != null; + if (!this.conf.url_data) { + this.conf.url_data = {}; + } + this.conf.url_data.url = c; + this.conf.url_data.ajax = o == true; + this.conf.url_data.post_data = e == true ? {} : e || null; + if (o == true) { + var n = this; + if (g) { + var h = ""; + for (var m in e) { + h += "&" + encodeURIComponent(m) + "=" + encodeURIComponent(e[m]); + } + dhx4.ajax.post(c, h, function (a) { + n.attachHTMLString("
" + a.xmlDoc.responseText + "
"); + if (typeof n._doOnFrameContentLoaded == "function") { + n._doOnFrameContentLoaded(); + } + n.dataType = "url-ajax"; + n = a = null; + }); + } else { + dhx4.ajax.get(c, function (a) { + n.attachHTMLString("
" + a.xmlDoc.responseText + "
"); + if (typeof n._doOnFrameContentLoaded == "function") { + n._doOnFrameContentLoaded(); + } + n.dataType = "url-ajax"; + n = a = null; + }); + } + } else { + if (this.dataType == "url") { + var j = this.getFrame(); + } else { + var j = document.createElement("IFRAME"); + j.frameBorder = 0; + j.border = 0; + j.style.width = "100%"; + j.style.height = "100%"; + j.style.position = "relative"; + this._attachObject(j); + this.dataType = "url"; + this._attachURLEvents(); + } + if (g) { + var l = typeof this.conf.url_data.post_ifr == "undefined"; + this.conf.url_data.post_ifr = true; + if (l) { + this._attachURLEvents(); + } + j.src = "about:blank"; + } else { + j.src = c + (window.dhx4.ajax.cache != true ? (c.indexOf("?") >= 0 ? "&" : "?") + "dhxr" + new Date().getTime() : ""); + } + j = null; + } + j = null; +}; +dhtmlXCellObject.prototype.reloadURL = function () { + if (!(this.dataType == "url" || this.dataType == "url-ajax")) { + return; + } + if (this.conf.url_data == null) { + return; + } + this.attachURL(this.conf.url_data.url, this.conf.url_data.ajax, this.conf.url_data.post_data); +}; +dhtmlXCellObject.prototype.attachHTMLString = function (str) { + this._attachObject(null, null, str); + var z = str.match(/]*>[^\f]*?<\/script>/g) || []; + for (var i = 0; i < z.length; i++) { + var s = z[i].replace(/<([\/]{0,1})script[^>]*>/gi, ""); + if (s) { + if (window.execScript) { + window.execScript(s); + } else { + window.eval(s); + } + } + } +}; +dhtmlXCellObject.prototype.attachScheduler = function (a, l, c, g) { + g = g || window.scheduler; + var h = false; + if (c) { + var j = document.getElementById(c); + if (j) { + h = true; + } + } + if (!h) { + var e = c || '
'; + var j = document.createElement("DIV"); + j.id = "dhxSchedObj_" + new Date().getTime(); + j.style.width = "100%"; + j.style.height = "100%"; + j.style.position = "relative"; + j.style.overflow = "hidden"; + j.className = "dhx_cal_container"; + j.innerHTML = + '
 
 
' + + e + + '
'; + } + this._attachObject(j); + this.dataType = "scheduler"; + this.dataObj = g; + this.dataObj.setSizes = function () { + this.update_view(); + }; + g.init(j.id, a, l); + j = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; +}; +dhtmlXCellObject.prototype.attachMap = function (a) { + var c = document.createElement("DIV"); + c.style.width = "100%"; + c.style.height = "100%"; + c.style.position = "relative"; + c.style.overflow = "hidden"; + this._attachObject(c); + if (!a) { + a = { center: new google.maps.LatLng(40.719837, -73.992348), zoom: 11, mapTypeId: google.maps.MapTypeId.ROADMAP }; + } + this.dataType = "maps"; + this.dataObj = new google.maps.Map(c, a); + this.dataObj.setSizes = function () { + google.maps.event.trigger(this, "resize"); + }; + c = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; +}; +dhtmlXCellObject.prototype._createNode_sb = function (m, g, l, a, j) { + if (typeof j != "undefined") { + m = j; + } else { + var c = g || {}; + var n = typeof c.text == "string" && c.text.length > 0 ? c.text : " "; + var e = typeof c.height == "number" ? c.height : false; + var m = document.createElement("DIV"); + m.className = "dhx_cell_statusbar_def"; + m.innerHTML = "
" + n + "
"; + if (e != false) { + m.firstChild.style.height = m.firstChild.style.lineHeight = e + "px"; + } + } + if (this.conf.idx.pr1 != null) { + this.cell.insertBefore(m, this.cell.childNodes[this.conf.idx.pr1]); + } else { + this.cell.appendChild(m); + } + this.conf.ofs_nodes.b.sb = true; + this._updateIdx(); + this._adjustCont(this._idd); + return m; +}; +dhtmlXCellObject.prototype.attachStatusBar = function (a) { + if (this.dataNodes.sb) { + return; + } + if (a != null && window.dhx4.s2b(a.paging) == true) { + a.height = null; + } + if (this.conf.skin == "dhx_skyblue" && typeof window.dhtmlXWindowsCell != "undefined" && this instanceof dhtmlXWindowsCell) { + this.cell.childNodes[this.conf.idx.cont].className += " dhx_cell_statusbar_attached"; + } + this.dataNodes.sb = this._attachObject("sb", a); + this.dataNodes.sb.setText = function (c) { + this.childNodes[0].innerHTML = c; + }; + this.dataNodes.sb.getText = function () { + return this.childNodes[0].innerHTML; + }; + this.dataNodes.sb.onselectstart = function (c) { + return false; + }; + return this.dataNodes.sb; +}; +dhtmlXCellObject.prototype.detachStatusBar = function () { + if (!this.dataNodes.sb) { + return; + } + if (this.conf.skin == "dhx_skyblue" && typeof window.dhtmlXWindowsCell != "undefined" && this instanceof dhtmlXWindowsCell) { + this.cell.childNodes[this.conf.idx.cont].className = this.cell.childNodes[this.conf.idx.cont].className.replace(/\s{0,}dhx_cell_statusbar_attached/, ""); + } + this.dataNodes.sb.setText = this.dataNodes.sb.getText = this.dataNodes.sb.onselectstart = null; + this.dataNodes.sb = null; + delete this.dataNodes.sb; + this._detachObject("sb"); +}; +dhtmlXCellObject.prototype.showStatusBar = function () { + this._mtbShowHide("sb", ""); +}; +dhtmlXCellObject.prototype.hideStatusBar = function () { + this._mtbShowHide("sb", "none"); +}; +dhtmlXCellObject.prototype._mtbShowHide = function (c, a) { + if (!this.dataNodes[c]) { + return; + } + this.cell.childNodes[this.conf.idx[c]].style.display = a; + this._adjustCont(); +}; +dhtmlXCellObject.prototype.getFrame = dhtmlXCellObject.prototype._getFrame = function () { + if (this.dataType != "url") { + return null; + } + return this.cell.childNodes[this.conf.idx.cont].firstChild; +}; +dhtmlXCellObject.prototype._attachURLEvents = function () { + if (this.dataType != "url") { + return; + } + var e = this; + var c = this._idd; + var a = this.cell.childNodes[this.conf.idx.cont].firstChild; + if (typeof this._doOnFrameMouseDown != "function") { + this._doOnFrameMouseDown = function (g) { + e.callEvent("_onContentMouseDown", [c, g || event]); + }; + } + if (typeof window.addEventListener == "function") { + a.onload = function () { + try { + if (typeof e._doOnFrameMouseDown == "function") { + this.contentWindow.document.body.addEventListener("mousedown", e._doOnFrameMouseDown, false); + } + } catch (g) {} + try { + if (typeof e._doOnFrameContentLoaded == "function") { + e._doOnFrameContentLoaded(); + } + } catch (g) {} + }; + } else { + a.onreadystatechange = function (g) { + if (this.readyState == "complete") { + try { + if (typeof e._doOnFrameMouseDown == "function") { + this.contentWindow.document.body.attachEvent("onmousedown", e._doOnFrameMouseDown); + } + } catch (h) {} + try { + if (typeof e._doOnFrameContentLoaded == "function") { + e._doOnFrameContentLoaded(); + } + } catch (h) {} + } + }; + } +}; +dhtmlXCellObject.prototype._doOnFrameContentLoaded = function () { + if (this.conf.url_data.post_ifr == true) { + var j = this.getFrame().contentWindow.document; + var h = j.createElement("FORM"); + h.method = "POST"; + h.action = this.conf.url_data.url; + j.body.appendChild(h); + var e = {}; + if (window.dhx4.ajax.cache != true) { + e["dhxr" + new Date().getTime()] = "1"; + } + for (var c in this.conf.url_data.post_data) { + e[c] = this.conf.url_data.post_data[c]; + } + for (var c in e) { + var g = j.createElement("INPUT"); + g.type = "hidden"; + g.name = c; + g.value = e[c]; + h.appendChild(g); + g = null; + } + this.conf.url_data.post_ifr = false; + h.submit(); + } else { + this.callEvent("_onContentLoaded", [this._idd]); + } +}; +dhtmlXCellObject.prototype._detachURLEvents = function (a) { + if (a == null) { + if (this.dataType != "url") { + return; + } + a = this.cell.childNodes[this.conf.idx.cont].firstChild; + } + if (typeof window.addEventListener == "function") { + a.onload = null; + try { + a.contentWindow.document.body.removeEventListener("mousedown", this._doOnFrameMouseDown, false); + } catch (c) {} + } else { + a.onreadystatechange = null; + try { + a.contentWindow.document.body.detachEvent("onmousedown", this._doOnFrameMouseDown); + } catch (c) {} + } + a = null; +}; +dhtmlXCellObject.prototype._attachObject = function (h, c, g, a, e) { + if (typeof h == "string" && { menu: 1, toolbar: 1, ribbon: 1, sb: 1 }[h] == 1) { + return this["_createNode_" + h].apply(this, arguments); + } + if (a != true) { + this._detachObject(null, true, null); + } + if (typeof g == "string") { + this.cell.childNodes[this.conf.idx.cont].innerHTML = g; + } else { + this.cell.childNodes[this.conf.idx.cont].appendChild(h); + } + h = null; +}; +dhtmlXCellObject.prototype._detachObject = function (h, c, a) { + this.callEvent("_onBeforeContentDetach", []); + if (h == "menu" || h == "toolbar" || h == "ribbon" || h == "sb") { + var g = this.cell.childNodes[this.conf.idx[h]]; + g.parentNode.removeChild(g); + g = null; + this.conf.ofs_nodes[h == "sb" ? "b" : "t"][h] = false; + this._updateIdx(); + if (!this.conf.unloading) { + this._adjustCont(this._idd); + } + return; + } + if (c == true) { + a = false; + } else { + if (typeof a == "undefined") { + a = document.body; + } else { + if (typeof a == "string") { + a = document.getElementById(a); + } + } + } + if (a === false) { + if (this.dataType == "url") { + this._detachURLEvents(); + } else { + if (this.dataObj != null) { + if (typeof this.dataObj.unload == "function") { + this.dataObj.unload(); + } else { + if (typeof this.dataObj.destructor == "function") { + this.dataObj.destructor(); + } + } + } + } + } + var g = this.cell.childNodes[this.conf.idx.cont]; + while (g.childNodes.length > 0) { + if (a === false) { + g.removeChild(g.lastChild); + } else { + g.firstChild.style.display = "none"; + a.appendChild(g.firstChild); + } + } + if (this.conf.append_mode) { + g.style.overflow = ""; + this.conf.append_mode = false; + } + var e = this.dataType == "tabbar"; + this.dataObj = null; + this.dataType = null; + a = g = null; + if (this.conf.unloading != true && e) { + this.showHeader(true); + this._showBorders(); + } +}; +dhtmlXCellObject.prototype._attachFromCell = function (c) { + this.detachObject(true); + var g = "layout"; + if (typeof window.dhtmlXWindowsCell != "undefined" && this instanceof window.dhtmlXWindowsCell) { + g = "window"; + } + if (typeof window.dhtmlXWindowsCell != "undefined" && c instanceof window.dhtmlXWindowsCell && c.wins.w[c._idd].conf.parked) { + c.wins._winCellSetOpacity(c._idd, "open", false); + } + if (typeof window.dhtmlXAccordionCell != "undefined" && c instanceof window.dhtmlXAccordionCell && c.conf.opened == false) { + c._cellSetOpacity("open", false); + } + for (var e in c.dataNodes) { + this._attachObject(e, null, null, null, c.cell.childNodes[c.conf.idx[e]]); + this.dataNodes[e] = c.dataNodes[e]; + c.dataNodes[e] = null; + c.conf.ofs_nodes[e == "sb" ? "b" : "t"][e] = false; + c._updateIdx(); + } + this._mtbUpdBorder(); + if (c.dataType != null && c.dataObj != null) { + this.dataType = c.dataType; + this.dataObj = c.dataObj; + while (c.cell.childNodes[c.conf.idx.cont].childNodes.length > 0) { + this.cell.childNodes[this.conf.idx.cont].appendChild(c.cell.childNodes[c.conf.idx.cont].firstChild); + } + c.dataType = null; + c.dataObj = null; + if (this.dataType == "grid") { + if (g == "window" && this.conf.skin == "dhx_skyblue") { + this.dataObj.entBox.style.border = "1px solid #a4bed4"; + this.dataObj._sizeFix = 0; + } else { + this.dataObj.entBox.style.border = "0px solid white"; + this.dataObj._sizeFix = 2; + } + } + } else { + while (c.cell.childNodes[c.conf.idx.cont].childNodes.length > 0) { + this.cell.childNodes[this.conf.idx.cont].appendChild(c.cell.childNodes[c.conf.idx.cont].firstChild); + } + } + this.conf.view = c.conf.view; + c.conf.view = "def"; + for (var e in c.views) { + this.views[e] = c.views[e]; + c.views[e] = null; + delete c.views[e]; + } + c._updateIdx(); + c._adjustCont(); + this._updateIdx(); + this._adjustCont(); + if (c.conf.progress == true) { + c.progressOff(); + this.progressOn(); + } else { + this.progressOff(); + } + if (g == "window" && this.wins.w[this._idd].conf.parked) { + this.wins._winCellSetOpacity(this._idd, "close", false); + } +}; +function dhtmlXCellTop(h, c) { + if (arguments.length == 0 || typeof h == "undefined") { + return; + } + var a = this; + this.dataNodes = {}; + this.conf.ofs = { t: 0, b: 0, l: 0, r: 0 }; + this.conf.ofs_nodes = { t: {}, b: {} }; + this.conf.progress = false; + this.conf.fs_mode = false; + this.conf.fs_tm = null; + this.conf.fs_resize = false; + if (h == document.body) { + this.conf.fs_mode = true; + this.base = h; + if (this.base == document.body) { + var g = { dhx_skyblue: { t: 2, b: 2, l: 2, r: 2 }, dhx_web: { t: 8, b: 8, l: 8, r: 8 }, dhx_terrace: { t: 9, b: 9, l: 8, r: 8 } }; + this.conf.ofs = g[this.conf.skin] != null ? g[this.conf.skin] : g.dhx_skyblue; + } + } else { + this.base = typeof h == "string" ? document.getElementById(h) : h; + } + this.base.className += " " + this.conf.css + "_base_" + this.conf.skin; + this.cont = document.createElement("DIV"); + this.cont.className = this.conf.css + "_cont"; + this.base.appendChild(this.cont); + if (c != null) { + this.setOffsets(c, false); + } else { + if (this.base._ofs != null) { + this.setOffsets(this.base._ofs, false); + this.base._ofs = null; + try { + delete this.base._ofs; + } catch (j) {} + } + } + this._adjustCont = function () { + var m = this.conf.ofs.t; + for (var l in this.conf.ofs_nodes.t) { + m += this.conf.ofs_nodes.t[l] == true ? this.dataNodes[l].offsetHeight : 0; + } + var e = this.conf.ofs.b; + for (var l in this.conf.ofs_nodes.b) { + e += this.conf.ofs_nodes.b[l] == true ? this.dataNodes[l].offsetHeight : 0; + } + this.cont.style.left = this.conf.ofs.l + "px"; + this.cont.style.width = this.base.clientWidth - this.conf.ofs.l - this.conf.ofs.r + "px"; + this.cont.style.top = m + "px"; + this.cont.style.height = this.base.clientHeight - m - e + "px"; + }; + this._setBaseSkin = function (e) { + this.base.className = this.base.className.replace(new RegExp(this.conf.css + "_base_" + this.conf.skin, "gi"), this.conf.css + "_base_" + e); + }; + this._initFSResize = function () { + if (this.conf.fs_resize == true) { + return; + } + this._doOnResizeStart = function () { + window.clearTimeout(a.conf.fs_tm); + a.conf.fs_tm = window.setTimeout(a._doOnResizeEnd, 200); + }; + this._doOnResizeEnd = function () { + a.setSizes(); + }; + if (typeof window.addEventListener == "function") { + window.addEventListener("resize", this._doOnResizeStart, false); + } else { + window.attachEvent("onresize", this._doOnResizeStart); + } + this.conf.fs_resize = true; + }; + if (this.conf.fs_mode == true) { + this._initFSResize(); + } + this._unloadTop = function () { + this._mtbUnload(); + this.detachHeader(); + this.detachFooter(); + if (this.conf.fs_mode == true) { + if (typeof window.addEventListener == "function") { + window.removeEventListener("resize", this._doOnResizeStart, false); + } else { + window.detachEvent("onresize", this._doOnResizeStart); + } + } + this.base.removeChild(this.cont); + var e = new RegExp("s{0,}" + this.conf.css + "_base_" + this.conf.skin, "gi"); + this.base.className = this.base.className.replace(e, ""); + this.cont = this.base = null; + a = null; + }; + h = null; +} +dhtmlXCellTop.prototype.setOffsets = function (j, h) { + var g = false; + for (var c in j) { + var e = c.charAt(0); + if (typeof this.conf.ofs[e] != "undefined" && !isNaN(j[c])) { + this.conf.ofs[e] = parseInt(j[c]); + g = true; + } + } + if (h !== false && typeof this.setSizes == "function" && g == true) { + this.setSizes(); + } +}; +dhtmlXCellTop.prototype.attachMenu = function (a) { + if (this.dataNodes.menu != null) { + return; + } + this.dataNodes.menuObj = document.createElement("DIV"); + this.dataNodes.menuObj.className = "dhxcelltop_menu"; + this.base.insertBefore(this.dataNodes.menuObj, this.dataNodes.toolbarObj || this.dataNodes.ribbonObj || this.cont); + if (typeof a != "object" || a == null) { + a = {}; + } + a.skin = this.conf.skin; + a.parent = this.dataNodes.menuObj; + this.dataNodes.menu = new dhtmlXMenuObject(a); + this.dataNodes.menuEv = this.attachEvent("_onSetSizes", function () { + if (this.dataNodes.menuObj.style.display == "none") { + return; + } + this.dataNodes.menuObj.style.left = this.conf.ofs.l + "px"; + this.dataNodes.menuObj.style.marginTop = (this.dataNodes.haObj != null ? 0 : this.conf.ofs.t) + "px"; + this.dataNodes.menuObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"; + }); + this.conf.ofs_nodes.t.menuObj = true; + this.setSizes(); + a.parnt = null; + a = null; + return this.dataNodes.menu; +}; +dhtmlXCellTop.prototype.detachMenu = function () { + if (this.dataNodes.menu == null) { + return; + } + this.dataNodes.menu.unload(); + this.dataNodes.menu = null; + this.dataNodes.menuObj.parentNode.removeChild(this.dataNodes.menuObj); + this.dataNodes.menuObj = null; + this.detachEvent(this.dataNodes.menuEv); + this.dataNodes.menuEv = null; + delete this.dataNodes.menu; + delete this.dataNodes.menuObj; + delete this.dataNodes.menuEv; + this.conf.ofs_nodes.t.menuObj = false; + if (!this.conf.unloading) { + this.setSizes(); + } +}; +dhtmlXCellTop.prototype.attachToolbar = function (a) { + if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) { + return; + } + this.dataNodes.toolbarObj = document.createElement("DIV"); + this.dataNodes.toolbarObj.className = "dhxcelltop_toolbar"; + this.base.insertBefore(this.dataNodes.toolbarObj, this.cont); + this.dataNodes.toolbarObj.appendChild(document.createElement("DIV")); + if (typeof a != "object" || a == null) { + a = {}; + } + a.skin = this.conf.skin; + a.parent = this.dataNodes.toolbarObj.firstChild; + this.dataNodes.toolbar = new dhtmlXToolbarObject(a); + this.dataNodes.toolbarEv = this.attachEvent("_onSetSizes", function () { + if (this.dataNodes.toolbarObj.style.display == "none") { + return; + } + this.dataNodes.toolbarObj.style.left = this.conf.ofs.l + "px"; + this.dataNodes.toolbarObj.style.marginTop = (this.dataNodes.haObj != null || this.dataNodes.menuObj != null ? 0 : this.conf.ofs.t) + "px"; + this.dataNodes.toolbarObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"; + }); + this.dataNodes.toolbar._masterCell = this; + this.dataNodes.toolbar.attachEvent("_onIconSizeChange", function () { + this._masterCell.setSizes(); + }); + this.conf.ofs_nodes.t.toolbarObj = true; + this.setSizes(); + a.parnt = null; + a = null; + return this.dataNodes.toolbar; +}; +dhtmlXCellTop.prototype.detachToolbar = function () { + if (this.dataNodes.toolbar == null) { + return; + } + this.dataNodes.toolbar._masterCell = null; + this.dataNodes.toolbar.unload(); + this.dataNodes.toolbar = null; + this.dataNodes.toolbarObj.parentNode.removeChild(this.dataNodes.toolbarObj); + this.dataNodes.toolbarObj = null; + this.detachEvent(this.dataNodes.toolbarEv); + this.dataNodes.toolbarEv = null; + this.conf.ofs_nodes.t.toolbarObj = false; + delete this.dataNodes.toolbar; + delete this.dataNodes.toolbarObj; + delete this.dataNodes.toolbarEv; + if (!this.conf.unloading) { + this.setSizes(); + } +}; +dhtmlXCellTop.prototype.attachRibbon = function (a) { + if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) { + return; + } + this.dataNodes.ribbonObj = document.createElement("DIV"); + this.dataNodes.ribbonObj.className = "dhxcelltop_ribbon"; + this.base.insertBefore(this.dataNodes.ribbonObj, this.cont); + this.dataNodes.ribbonObj.appendChild(document.createElement("DIV")); + if (typeof a != "object" || a == null) { + a = {}; + } + a.skin = this.conf.skin; + a.parent = this.dataNodes.ribbonObj.firstChild; + this.dataNodes.ribbon = new dhtmlXRibbon(a); + this.dataNodes.ribbonEv = this.attachEvent("_onSetSizes", function () { + if (this.dataNodes.ribbonObj.style.display == "none") { + return; + } + this.dataNodes.ribbonObj.style.left = this.conf.ofs.l + "px"; + this.dataNodes.ribbonObj.style.marginTop = (this.dataNodes.haObj != null || this.dataNodes.menuObj != null ? 0 : this.conf.ofs.t) + "px"; + this.dataNodes.ribbonObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"; + this.dataNodes.ribbon.setSizes(); + }); + this.conf.ofs_nodes.t.ribbonObj = true; + var c = this; + this.dataNodes.ribbon.attachEvent("_onHeightChanged", function () { + c.setSizes(); + }); + this.setSizes(); + a.parnt = null; + a = null; + return this.dataNodes.ribbon; +}; +dhtmlXCellTop.prototype.detachRibbon = function () { + if (this.dataNodes.ribbon == null) { + return; + } + this.dataNodes.ribbon.unload(); + this.dataNodes.ribbon = null; + this.dataNodes.ribbonObj.parentNode.removeChild(this.dataNodes.ribbonObj); + this.dataNodes.ribbonObj = null; + this.detachEvent(this.dataNodes.ribbonEv); + this.dataNodes.ribbonEv = null; + this.conf.ofs_nodes.t.ribbonObj = false; + delete this.dataNodes.ribbon; + delete this.dataNodes.ribbonObj; + delete this.dataNodes.ribbonEv; + if (!this.conf.unloading) { + this.setSizes(); + } +}; +dhtmlXCellTop.prototype.attachStatusBar = function (a) { + if (this.dataNodes.sbObj) { + return; + } + if (typeof a == "undefined") { + a = {}; + } + this.dataNodes.sbObj = document.createElement("DIV"); + this.dataNodes.sbObj.className = "dhxcelltop_statusbar"; + if (this.cont.nextSibling != null) { + this.base.insertBefore(this.dataNodes.sbObj, this.cont.nextSibling); + } else { + this.base.appendChild(this.dataNodes.sbObj); + } + this.dataNodes.sbObj.innerHTML = "
" + (typeof a.text == "string" && a.text.length > 0 ? a.text : " ") + "
"; + if (typeof a.height == "number") { + this.dataNodes.sbObj.firstChild.style.height = this.dataNodes.sbObj.firstChild.style.lineHeight = a.height + "px"; + } + this.dataNodes.sbObj.setText = function (c) { + this.childNodes[0].innerHTML = c; + }; + this.dataNodes.sbObj.getText = function () { + return this.childNodes[0].innerHTML; + }; + this.dataNodes.sbObj.onselectstart = function (c) { + return false; + }; + this.dataNodes.sbEv = this.attachEvent("_onSetSizes", function () { + if (this.dataNodes.sbObj.style.display == "none") { + return; + } + this.dataNodes.sbObj.style.left = this.conf.ofs.l + "px"; + this.dataNodes.sbObj.style.bottom = (this.dataNodes.faObj != null ? this.dataNodes.faObj.offsetHeight : 0) + this.conf.ofs.t + "px"; + this.dataNodes.sbObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"; + }); + this.conf.ofs_nodes.b.sbObj = true; + this.setSizes(); + return this.dataNodes.sbObj; +}; +dhtmlXCellTop.prototype.detachStatusBar = function () { + if (!this.dataNodes.sbObj) { + return; + } + this.dataNodes.sbObj.setText = this.dataNodes.sbObj.getText = this.dataNodes.sbObj.onselectstart = null; + this.dataNodes.sbObj.parentNode.removeChild(this.dataNodes.sbObj); + this.dataNodes.sbObj = null; + this.detachEvent(this.dataNodes.sbEv); + this.dataNodes.sbEv = null; + this.conf.ofs_nodes.b.sbObj = false; + delete this.dataNodes.sb; + delete this.dataNodes.sbObj; + delete this.dataNodes.sbEv; + if (!this.conf.unloading) { + this.setSizes(); + } +}; +dhtmlXCellTop.prototype.showMenu = function () { + this._mtbShowHide("menuObj", ""); +}; +dhtmlXCellTop.prototype.hideMenu = function () { + this._mtbShowHide("menuObj", "none"); +}; +dhtmlXCellTop.prototype.showToolbar = function () { + this._mtbShowHide("toolbarObj", ""); +}; +dhtmlXCellTop.prototype.hideToolbar = function () { + this._mtbShowHide("toolbarObj", "none"); +}; +dhtmlXCellTop.prototype.showRibbon = function () { + this._mtbShowHide("ribbonObj", ""); +}; +dhtmlXCellTop.prototype.hideRibbon = function () { + this._mtbShowHide("ribbonObj", "none"); +}; +dhtmlXCellTop.prototype.showStatusBar = function () { + this._mtbShowHide("sbObj", ""); +}; +dhtmlXCellTop.prototype.hideStatusBar = function () { + this._mtbShowHide("sbObj", "none"); +}; +dhtmlXCellTop.prototype._mtbShowHide = function (c, a) { + if (this.dataNodes[c] == null) { + return; + } + this.dataNodes[c].style.display = a; + this.setSizes(); +}; +dhtmlXCellTop.prototype._mtbUnload = function (c, a) { + this.detachMenu(); + this.detachToolbar(); + this.detachStatusBar(); + this.detachRibbon(); +}; +dhtmlXCellTop.prototype.getAttachedMenu = function () { + return this.dataNodes.menu; +}; +dhtmlXCellTop.prototype.getAttachedToolbar = function () { + return this.dataNodes.toolbar; +}; +dhtmlXCellTop.prototype.getAttachedRibbon = function () { + return this.dataNodes.ribbon; +}; +dhtmlXCellTop.prototype.getAttachedStatusBar = function () { + return this.dataNodes.sbObj; +}; +dhtmlXCellTop.prototype.progressOn = function () { + if (this.conf.progress) { + return; + } + this.conf.progress = true; + var c = document.createElement("DIV"); + c.className = "dhxcelltop_progress"; + this.base.appendChild(c); + var a = document.createElement("DIV"); + a.className = "dhxcelltop_progress_img"; + this.base.appendChild(a); + c = a = null; +}; +dhtmlXCellTop.prototype.progressOff = function () { + if (!this.conf.progress) { + return; + } + var g = { dhxcelltop_progress: true, dhxcelltop_progress_img: true }; + for (var e = 0; e < this.base.childNodes.length; e++) { + if (typeof this.base.childNodes[e].className != "undefined" && g[this.base.childNodes[e].className] == true) { + g[this.base.childNodes[e].className] = this.base.childNodes[e]; + } + } + for (var c in g) { + if (g[c] != true) { + this.base.removeChild(g[c]); + } + g[c] = null; + } + this.conf.progress = false; + g = null; +}; +dhtmlXCellTop.prototype.attachHeader = function (c, a) { + if (this.dataNodes.haObj != null) { + return; + } + if (typeof c != "object") { + c = document.getElementById(c); + } + this.dataNodes.haObj = document.createElement("DIV"); + this.dataNodes.haObj.className = "dhxcelltop_hdr"; + this.dataNodes.haObj.style.height = (a || c.offsetHeight) + "px"; + this.base.insertBefore(this.dataNodes.haObj, this.dataNodes.menuObj || this.dataNodes.toolbarObj || this.cont); + this.dataNodes.haObj.appendChild(c); + c.style.visibility = "visible"; + c = null; + this.dataNodes.haEv = this.attachEvent("_onSetSizes", function () { + this.dataNodes.haObj.style.left = this.conf.ofs.l + "px"; + this.dataNodes.haObj.style.marginTop = this.conf.ofs.t + "px"; + this.dataNodes.haObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"; + }); + this.conf.ofs_nodes.t.haObj = true; + this.setSizes(); +}; +dhtmlXCellTop.prototype.detachHeader = function () { + if (!this.dataNodes.haObj) { + return; + } + while (this.dataNodes.haObj.childNodes.length > 0) { + this.dataNodes.haObj.lastChild.style.visibility = "hidden"; + document.body.appendChild(this.dataNodes.haObj.lastChild); + } + this.dataNodes.haObj.parentNode.removeChild(this.dataNodes.haObj); + this.dataNodes.haObj = null; + this.detachEvent(this.dataNodes.haEv); + this.dataNodes.haEv = null; + this.conf.ofs_nodes.t.haObj = false; + delete this.dataNodes.haEv; + delete this.dataNodes.haObj; + if (!this.conf.unloading) { + this.setSizes(); + } +}; +dhtmlXCellTop.prototype.attachFooter = function (e, a) { + if (this.dataNodes.faObj != null) { + return; + } + if (typeof e != "object") { + e = document.getElementById(e); + } + this.dataNodes.faObj = document.createElement("DIV"); + this.dataNodes.faObj.className = "dhxcelltop_ftr"; + this.dataNodes.faObj.style.height = (a || e.offsetHeight) + "px"; + var c = this.dataNodes.sbObj || this.cont; + if (this.base.lastChild == c) { + this.base.appendChild(this.dataNodes.faObj); + } else { + this.base.insertBefore(this.dataNodes.faObj, c.nextSibling); + } + this.dataNodes.faEv = this.attachEvent("_onSetSizes", function () { + this.dataNodes.faObj.style.left = this.conf.ofs.l + "px"; + this.dataNodes.faObj.style.bottom = this.conf.ofs.b + "px"; + this.dataNodes.faObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"; + }); + this.dataNodes.faObj.appendChild(e); + e.style.visibility = "visible"; + c = e = null; + this.conf.ofs_nodes.b.faObj = true; + this.setSizes(); +}; +dhtmlXCellTop.prototype.detachFooter = function () { + if (!this.dataNodes.faObj) { + return; + } + while (this.dataNodes.faObj.childNodes.length > 0) { + this.dataNodes.faObj.lastChild.style.visibility = "hidden"; + document.body.appendChild(this.dataNodes.faObj.lastChild); + } + this.dataNodes.faObj.parentNode.removeChild(this.dataNodes.faObj); + this.dataNodes.faObj = null; + this.detachEvent(this.dataNodes.faEv); + this.dataNodes.faEv = null; + this.conf.ofs_nodes.b.faObj = false; + delete this.dataNodes.faEv; + delete this.dataNodes.faObj; + if (!this.conf.unloading) { + this.setSizes(); + } +}; +function dhtmlXCalendarObject(j, r) { + this.i = {}; + var e = null; + if (typeof j == "string") { + var g = document.getElementById(j); + } else { + var g = j; + } + if (g && typeof g == "object" && g.tagName && String(g.tagName).toLowerCase() != "input") { + e = g; + } + g = null; + if (typeof j != "object" || !j.length) { + j = [j]; + } + for (var c = 0; c < j.length; c++) { + if (typeof j[c] == "string") { + j[c] = document.getElementById(j[c]) || null; + } + if (j[c] != null && j[c].tagName && String(j[c].tagName).toLowerCase() == "input") { + this.i[window.dhx4.newId()] = { input: j[c] }; + } else { + if (!(j[c] instanceof Array) && j[c] instanceof Object && (j[c].input != null || j[c].button != null)) { + if (j[c].input != null && typeof j[c].input == "string") { + j[c].input = document.getElementById(j[c].input); + } + if (j[c].button != null && typeof j[c].button == "string") { + j[c].button = document.getElementById(j[c].button); + } + this.i[window.dhx4.newId()] = j[c]; + } + } + j[c] = null; + } + this.conf = { skin: r || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhtmlxcalendar") || "dhx_skyblue", zi: window.dhx4.newId(), touch: !window.dhx4.isIE, ws_first: true }; + this.setSkin = function (s, a) { + if (this.conf.skin == s && !a) { + return; + } + this.conf.skin = s; + this.base.className = "dhtmlxcalendar_" + this.conf.skin; + this._ifrSize(); + }; + this.base = document.createElement("DIV"); + this.base.style.display = "none"; + this.base.appendChild(document.createElement("DIV")); + if (e != null) { + this._hasParent = true; + e.appendChild(this.base); + e = null; + } else { + document.body.appendChild(this.base); + } + this.setParent = function (a) { + if (this._hasParent) { + if (typeof a == "object") { + a.appendChild(this.base); + } else { + if (typeof a == "string") { + document.getElementById(a).appendChild(this.base); + } + } + } + }; + this.setSkin(this.conf.skin, true); + this.base.onclick = function (a) { + a = a || event; + if (a.preventDefault) { + a.preventDefault(); + } + a.cancelBubble = true; + }; + this.base.onmousedown = function () { + return false; + }; + if (this.conf.touch) { + this.base.ontouchstart = this.base.onclick; + } + this.loadUserLanguage = function (v) { + if (!this.langData[v]) { + return; + } + this.lang = v; + this.setWeekStartDay(this.langData[this.lang].weekstart); + this.setDateFormat(this.langData[this.lang].dateformat || "%Y-%m-%d"); + if (this.msCont) { + var u = 0; + for (var s = 0; s < this.msCont.childNodes.length; s++) { + for (var a = 0; a < this.msCont.childNodes[s].childNodes.length; a++) { + this.msCont.childNodes[s].childNodes[a].innerHTML = this.langData[this.lang].monthesSNames[u++]; + } + } + } + }; + this.contMonth = document.createElement("DIV"); + this.contMonth.className = "dhtmlxcalendar_month_cont"; + this.contMonth.onselectstart = function (a) { + a = a || event; + a.cancelBubble = true; + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + return false; + }; + this.base.firstChild.appendChild(this.contMonth); + var l = document.createElement("UL"); + l.className = "dhtmlxcalendar_line"; + this.contMonth.appendChild(l); + var o = document.createElement("LI"); + o.className = "dhtmlxcalendar_cell dhtmlxcalendar_month_hdr"; + o.innerHTML = + "
"; + l.appendChild(o); + var h = this; + o.onclick = function (v) { + v = v || event; + if (v.type == "touchstart" && v.preventDefault != null) { + v.preventDefault(); + } + var s = v.target || v.srcElement; + if (s.className && s.className.indexOf("dhtmlxcalendar_month_arrow") === 0) { + h._hideSelector(); + var u = s.parentNode.firstChild == s ? -1 : 1; + var a = new Date(h._activeMonth); + h._drawMonth(new Date(h._activeMonth.getFullYear(), h._activeMonth.getMonth() + u, 1, 0, 0, 0, 0)); + h._evOnArrowClick([a, new Date(h._activeMonth)]); + return; + } + if (s.className && s.className == "dhtmlxcalendar_month_label_month") { + v.cancelBubble = true; + h._showSelector("month", Math.round(s.offsetLeft + s.offsetWidth / 2), s.offsetTop + s.offsetHeight + 2, "selector_month", true); + return; + } + if (s.className && s.className == "dhtmlxcalendar_month_label_year") { + v.cancelBubble = true; + h._showSelector("year", Math.round(s.offsetLeft + s.offsetWidth / 2), s.offsetTop + s.offsetHeight + 2, "selector_year", true); + return; + } + h._hideSelector(); + }; + if (this.conf.touch == true) { + o.ontouchstart = o.onclick; + } + this.contDays = document.createElement("DIV"); + this.contDays.className = "dhtmlxcalendar_days_cont"; + this.base.firstChild.appendChild(this.contDays); + this.setWeekStartDay = function (a) { + if (a == 0) { + a = 7; + } + this._wStart = Math.min(Math.max(isNaN(a) ? 1 : a, 1), 7); + this._drawDaysOfWeek(); + }; + this._drawDaysOfWeek = function () { + if (this.contDays.childNodes.length == 0) { + var v = document.createElement("UL"); + v.className = "dhtmlxcalendar_line"; + this.contDays.appendChild(v); + } else { + var v = this.contDays.firstChild; + } + var s = this._wStart; + var u = this.langData[this.lang].daysSNames; + u.push(String(this.langData[this.lang].daysSNames[0]).valueOf()); + for (var x = 0; x < 8; x++) { + if (v.childNodes[x] == null) { + var a = document.createElement("LI"); + v.appendChild(a); + } else { + var a = v.childNodes[x]; + } + if (x == 0) { + a.className = "dhtmlxcalendar_cell_wn"; + a.innerHTML = "
" + (this.langData[this.lang].weekname || "w") + "
"; + } else { + a.className = "dhtmlxcalendar_cell" + (s >= 6 ? " dhtmlxcalendar_day_weekday_cell" : "") + (x == 1 ? "_first" : ""); + a.innerHTML = u[s]; + if (++s > 7) { + s = 1; + } + } + } + if (this._activeMonth != null) { + this._drawMonth(this._activeMonth); + } + }; + this._wStart = this.langData[this.lang].weekstart; + this.setWeekStartDay(this._wStart); + this.contDates = document.createElement("DIV"); + this.contDates.className = "dhtmlxcalendar_dates_cont"; + this.base.firstChild.appendChild(this.contDates); + this.contDates.onclick = function (x) { + x = x || event; + if (x.type == "touchstart" && x.preventDefault != null) { + x.preventDefault(); + } + var s = x.target || x.srcElement; + if (s.parentNode != null && s.parentNode._date != null) { + s = s.parentNode; + } + if (s._date != null && !s._css_dis) { + var v = h._activeDate.getHours(); + var u = h._activeDate.getMinutes(); + var w = s._date; + if (h.checkEvent("onBeforeChange")) { + if (!h.callEvent("onBeforeChange", [new Date(s._date.getFullYear(), s._date.getMonth(), s._date.getDate(), v, u)])) { + return; + } + } + if (h._activeDateCell != null) { + h._activeDateCell._css_date = false; + h._updateCellStyle(h._activeDateCell._q, h._activeDateCell._w); + } + var a = h._activeDate.getFullYear() + "_" + h._activeDate.getMonth() != w.getFullYear() + "_" + w.getMonth(); + h._nullDate = false; + h._activeDate = new Date(w.getFullYear(), w.getMonth(), w.getDate(), v, u); + h._activeDateCell = s; + h._activeDateCell._css_date = true; + h._activeDateCell._css_hover = false; + h._updateCellStyle(h._activeDateCell._q, h._activeDateCell._w); + if (a) { + h._drawMonth(h._activeDate); + } + if (h._activeInp && h.i[h._activeInp] && h.i[h._activeInp].input != null) { + h.i[h._activeInp].input.value = h._dateToStr(new Date(h._activeDate.getTime())); + } + if (!h._hasParent) { + if (x.type == "touchstart") { + window.setTimeout(function () { + h._hide(); + }, 400); + } else { + h._hide(); + } + } + h._evOnClick([new Date(h._activeDate.getTime())]); + } + }; + if (this.conf.touch == true) { + this.contDates.ontouchstart = this.contDates.onclick; + } + this.contDates.onmouseover = function (s) { + s = s || event; + var a = s.target || s.srcElement; + if (a.parentNode != null && a.parentNode._date != null) { + a = a.parentNode; + } + if (a._date != null) { + if (h._lastHover == a || a._css_hover) { + return; + } + a._css_hover = true; + h._updateCellStyle(a._q, a._w); + h._lastHover = a; + h._evOnMouseOver([new Date(a._date.getFullYear(), a._date.getMonth(), a._date.getDate(), 0, 0, 0, 0), s]); + a = null; + } + }; + this.contDates.onmouseout = function (a) { + h._clearDayHover(a || event); + }; + this._lastHover = null; + this._clearDayHover = function (a) { + if (!this._lastHover) { + return; + } + this._lastHover._css_hover = false; + this._updateCellStyle(this._lastHover._q, this._lastHover._w); + if (a != null) { + h._evOnMouseOut([new Date(this._lastHover._date.getFullYear(), this._lastHover._date.getMonth(), this._lastHover._date.getDate(), 0, 0, 0, 0), a]); + } + this._lastHover = null; + }; + for (var c = 0; c < 6; c++) { + var l = document.createElement("UL"); + l.className = "dhtmlxcalendar_line"; + this.contDates.appendChild(l); + for (var n = 0; n <= 7; n++) { + var o = document.createElement("LI"); + if (n == 0) { + o.className = "dhtmlxcalendar_cell_wn"; + } else { + o.className = "dhtmlxcalendar_cell"; + } + l.appendChild(o); + } + } + this.contTime = document.createElement("DIV"); + this.contTime.className = "dhtmlxcalendar_time_cont"; + this.base.firstChild.appendChild(this.contTime); + this.showTime = function () { + this.contTime.style.display = ""; + this._ifrSize(); + }; + this.hideTime = function () { + this.contTime.style.display = "none"; + this._ifrSize(); + }; + var l = document.createElement("UL"); + l.className = "dhtmlxcalendar_line"; + this.contTime.appendChild(l); + var o = document.createElement("LI"); + o.className = "dhtmlxcalendar_cell dhtmlxcalendar_time_hdr"; + o.innerHTML = "
: "; + l.appendChild(o); + o.onclick = function (u) { + u = u || event; + if (u.type == "touchstart" && u.preventDefault != null) { + u.preventDefault(); + } + var a = u.target || u.srcElement; + if (a.tagName != null && a.tagName.toLowerCase() == "span" && a._par == true && a.parentNode != null) { + a = a.parentNode; + } + if (a.className && a.className == "dhtmlxcalendar_label_hours") { + u.cancelBubble = true; + var s = h.contMonth.offsetHeight + h.contDays.offsetHeight + h.contDates.offsetHeight + a.offsetTop; + h._showSelector("hours", Math.round(a.offsetLeft + a.offsetWidth / 2), s - 2, "selector_hours", true); + return; + } + if (a.className && a.className == "dhtmlxcalendar_label_minutes") { + u.cancelBubble = true; + if (h._minutesInterval == 1) { + var v = h.getFormatedDate("%i"); + a.innerHTML = "" + v.charAt(0) + "" + v.charAt(1); + a.firstChild._par = true; + h._selectorMode = 1; + } + var s = h.contMonth.offsetHeight + h.contDays.offsetHeight + h.contDates.offsetHeight + a.offsetTop; + h._showSelector("minutes", Math.round(a.offsetLeft + a.offsetWidth / 2), s - 2, "selector_minutes", true); + return; + } + h._hideSelector(); + }; + if (this.conf.touch == true) { + o.ontouchstart = o.onclick; + } + this._activeMonth = null; + this._activeDate = new Date(); + this._activeDateCell = null; + this.setDate = function (s) { + window.dhx4.temp_calendar = { tz: null }; + this._nullDate = typeof s == "undefined" || s === "" || !s; + if (!(s instanceof Date)) { + s = this._strToDate(String(s || "")); + if (s == "Invalid Date") { + s = new Date(); + } else { + this.conf.tz = window.dhx4.temp_calendar.tz; + } + window.dhx4.temp_calendar = null; + } + if (this.conf.tz == null) { + this.conf.tz = window.dhx4.date2str(s, "%P"); + } + var a = s.getTime(); + if (this._isOutOfRange(a)) { + return; + } + this._activeDate = new Date(a); + this._drawMonth(this._nullDate ? new Date() : this._activeDate); + this._updateVisibleHours(); + this._updateVisibleMinutes(); + }; + this.getDate = function (u) { + if (this._nullDate) { + return null; + } + var a = new Date(this._activeDate.getTime()); + if (u) { + window.dhx4.temp_calendar = { tz: this.conf.tz }; + var s = this._dateToStr(a); + window.dhx4.temp_calendar = null; + return s; + } + return a; + }; + this._drawMonth = function (E) { + if (!(E instanceof Date)) { + return; + } + if (isNaN(E.getFullYear())) { + E = new Date(this._activeMonth.getFullYear(), this._activeMonth.getMonth(), 1, 0, 0, 0, 0); + } + this._activeMonth = new Date(E.getFullYear(), E.getMonth(), 1, 0, 0, 0, 0); + this._activeDateCell = null; + var C = new Date(this._activeMonth.getTime()); + var u = C.getDay(); + var I = u - this._wStart; + if (I < 0) { + I = I + 7; + } + C.setDate(C.getDate() - I); + var L = E.getMonth(); + var M = new Date(this._activeDate.getFullYear(), this._activeDate.getMonth(), this._activeDate.getDate(), 0, 0, 0, 0).getTime(); + var y = 0; + for (var s = 0; s < 6; s++) { + var D = this._wStart; + for (var K = 0; K <= 7; K++) { + if (K == 0) { + var J = this.getWeekNumber(new Date(C.getFullYear(), C.getMonth(), C.getDate() + y, 0, 0, 0, 0)); + if (J >= 52 && this.conf.ws_first == true && this._activeMonth.getMonth() == 0) { + var x = this.getWeekNumber(new Date(C.getFullYear(), C.getMonth(), C.getDate() + y + 7, 0, 0, 0, 0)); + if (x < J && x > 1) { + J = 1; + } + } + this.contDates.childNodes[s].childNodes[K].innerHTML = "
" + J + "
"; + } else { + var a = new Date(C.getFullYear(), C.getMonth(), C.getDate() + y, 0, 0, 0, 0); + if (a.getHours() != 0) { + var A = a.getHours() > 12 ? 24 - a.getHours() : a.getHours(); + a.setTime(a.getTime() + 60 * 60 * 1000 * A); + } + var H = a.getDay(); + var v = a.getTime(); + var F = "dhtmlxcalendar_label"; + if (this._tipData[v] != null) { + if (this._tipData[v].usePopup && typeof window.dhtmlXPopup == "function") { + this.contDates.childNodes[s].childNodes[K].removeAttribute("title"); + this._initTooltipPopup(); + } else { + this.contDates.childNodes[s].childNodes[K].setAttribute("title", this._tipData[v].text); + } + if (this._tipData[v].showIcon) { + F += " dhtmlxcalendar_label_title"; + } + } else { + this.contDates.childNodes[s].childNodes[K].removeAttribute("title"); + } + this.contDates.childNodes[s].childNodes[K].innerHTML = "
" + a.getDate() + "
"; + this.contDates.childNodes[s].childNodes[K]._date = new Date(v); + this.contDates.childNodes[s].childNodes[K]._q = s; + this.contDates.childNodes[s].childNodes[K]._w = K; + this.contDates.childNodes[s].childNodes[K]._css_month = a.getMonth() == L; + this.contDates.childNodes[s].childNodes[K]._css_date = !this._nullDate && v == M; + this.contDates.childNodes[s].childNodes[K]._css_weekend = D >= 6; + this.contDates.childNodes[s].childNodes[K]._css_dis = this._isOutOfRange(v); + this.contDates.childNodes[s].childNodes[K]._css_holiday = this._holidays[v] == true; + this._updateCellStyle(s, K); + if (v == M) { + this._activeDateCell = this.contDates.childNodes[s].childNodes[K]; + } + if (++D > 7) { + D = 1; + } + y++; + } + } + } + this.contMonth.firstChild.firstChild.childNodes[1].innerHTML = this._buildMonthHdr(E); + }; + this._updateCellStyle = function (x, a) { + var v = this.contDates.childNodes[x].childNodes[a]; + var u = "dhtmlxcalendar_cell dhtmlxcalendar_cell"; + u += v._css_month ? "_month" : ""; + u += v._css_date ? "_date" : ""; + u += v._css_weekend ? "_weekend" : ""; + u += v._css_holiday ? "_holiday" : ""; + u += v._css_dis ? "_dis" : ""; + u += v._css_hover && !v._css_dis ? "_hover" : ""; + v.className = u; + v = null; + }; + this._minutesInterval = 5; + this._initSelector = function (C, v) { + if (!this._selCover) { + this._selCover = document.createElement("DIV"); + this._selCover.className = "dhtmlxcalendar_selector_cover"; + this.base.firstChild.appendChild(this._selCover); + } + if (!this._sel) { + this._sel = document.createElement("DIV"); + this._sel.className = "dhtmlxcalendar_selector_obj"; + this.base.firstChild.appendChild(this._sel); + this._sel.appendChild(document.createElement("TABLE")); + this._sel.firstChild.className = "dhtmlxcalendar_selector_table"; + this._sel.firstChild.cellSpacing = 0; + this._sel.firstChild.cellPadding = 0; + this._sel.firstChild.border = 0; + this._sel.firstChild.appendChild(document.createElement("TBODY")); + this._sel.firstChild.firstChild.appendChild(document.createElement("TR")); + this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD")); + this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD")); + this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD")); + this._sel.firstChild.firstChild.firstChild.childNodes[0].className = "dhtmlxcalendar_selector_cell_left"; + this._sel.firstChild.firstChild.firstChild.childNodes[1].className = "dhtmlxcalendar_selector_cell_middle"; + this._sel.firstChild.firstChild.firstChild.childNodes[2].className = "dhtmlxcalendar_selector_cell_right"; + this._sel.firstChild.firstChild.firstChild.childNodes[0].innerHTML = " "; + this._sel.firstChild.firstChild.firstChild.childNodes[2].innerHTML = " "; + this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseover = function () { + this.className = "dhtmlxcalendar_selector_cell_left dhtmlxcalendar_selector_cell_left_hover"; + }; + this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseout = function () { + this.className = "dhtmlxcalendar_selector_cell_left"; + }; + this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseover = function () { + this.className = "dhtmlxcalendar_selector_cell_right dhtmlxcalendar_selector_cell_right_hover"; + }; + this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseout = function () { + this.className = "dhtmlxcalendar_selector_cell_right"; + }; + this._sel.onmouseover = function (F) { + F = F || event; + var w = F.target || F.srcElement; + if (w._cell === true) { + if (h._selHover != w) { + h._clearSelHover(); + } + if (String(w.className).match(/^\s{0,}dhtmlxcalendar_selector_cell\s{0,}$/gi) != null) { + w.className += " dhtmlxcalendar_selector_cell_hover"; + h._selHover = w; + } + } + }; + this._sel.onmouseout = function () { + h._clearSelHover(); + }; + this._sel.firstChild.firstChild.firstChild.childNodes[0].onclick = function (w) { + w = w || event; + if (w.type == "touchstart" && w.preventDefault != null) { + w.preventDefault(); + } + w.cancelBubble = true; + h._scrollYears(-1); + }; + this._sel.firstChild.firstChild.firstChild.childNodes[2].onclick = function (w) { + w = w || event; + if (w.type == "touchstart" && w.preventDefault != null) { + w.preventDefault(); + } + w.cancelBubble = true; + h._scrollYears(1); + }; + if (this.conf.touch == true) { + this._sel.firstChild.firstChild.firstChild.childNodes[0].ontouchstart = this._sel.firstChild.firstChild.firstChild.childNodes[0].onclick; + this._sel.firstChild.firstChild.firstChild.childNodes[2].ontouchstart = this._sel.firstChild.firstChild.firstChild.childNodes[2].onclick; + } + this._sel._ta = {}; + this._selHover = null; + this._sel.appendChild(document.createElement("DIV")); + this._sel.lastChild.className = "dhtmlxcalendar_selector_obj_arrow"; + } + if (this._sel._ta[C] == true) { + return; + } + if (C == "month") { + this._msCells = {}; + this.msCont = document.createElement("DIV"); + this.msCont.className = "dhtmlxcalendar_area_" + v; + this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.msCont); + var s = 0; + for (var a = 0; a < 4; a++) { + var A = document.createElement("UL"); + A.className = "dhtmlxcalendar_selector_line"; + this.msCont.appendChild(A); + for (var D = 0; D < 3; D++) { + var E = document.createElement("LI"); + E.innerHTML = this.langData[this.lang].monthesSNames[s]; + E.className = "dhtmlxcalendar_selector_cell"; + A.appendChild(E); + E._month = s; + E._cell = true; + this._msCells[s++] = E; + } + } + this.msCont.onclick = function (F) { + F = F || event; + if (F.type == "touchstart" && F.preventDefault != null) { + F.preventDefault(); + } + F.cancelBubble = true; + var w = F.target || F.srcElement; + if (w._month != null) { + h._hideSelector(); + h._updateActiveMonth(); + h._drawMonth(new Date(h._activeMonth.getFullYear(), w._month, 1, 0, 0, 0, 0)); + h._doOnSelectorChange(); + } + }; + if (this.conf.touch == true) { + this.msCont.ontouchstart = this.msCont.onclick; + } + } + if (C == "year") { + this._ysCells = {}; + this.ysCont = document.createElement("DIV"); + this.ysCont.className = "dhtmlxcalendar_area_" + v; + this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.ysCont); + for (var a = 0; a < 4; a++) { + var A = document.createElement("UL"); + A.className = "dhtmlxcalendar_selector_line"; + this.ysCont.appendChild(A); + for (var D = 0; D < 3; D++) { + var E = document.createElement("LI"); + E.className = "dhtmlxcalendar_selector_cell"; + E._cell = true; + A.appendChild(E); + } + } + this.ysCont.onclick = function (F) { + F = F || event; + if (F.type == "touchstart" && F.preventDefault != null) { + F.preventDefault(); + } + F.cancelBubble = true; + var w = F.target || F.srcElement; + if (w._year != null) { + h._hideSelector(); + h._drawMonth(new Date(w._year, h._activeMonth.getMonth(), 1, 0, 0, 0, 0)); + h._doOnSelectorChange(); + } + }; + if (this.conf.touch == true) { + this.ysCont.ontouchstart = this.ysCont.onclick; + } + } + if (C == "hours") { + this._hsCells = {}; + this.hsCont = document.createElement("DIV"); + this.hsCont.className = "dhtmlxcalendar_area_" + v; + this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.hsCont); + var s = 0; + for (var a = 0; a < 4; a++) { + var A = document.createElement("UL"); + A.className = "dhtmlxcalendar_selector_line"; + this.hsCont.appendChild(A); + for (var D = 0; D < 6; D++) { + var E = document.createElement("LI"); + E.innerHTML = this._fixLength(s, 2); + E.className = "dhtmlxcalendar_selector_cell"; + A.appendChild(E); + E._hours = s; + E._cell = true; + this._hsCells[s++] = E; + } + } + this.hsCont.onclick = function (F) { + F = F || event; + if (F.type == "touchstart" && F.preventDefault != null) { + F.preventDefault(); + } + F.cancelBubble = true; + var w = F.target || F.srcElement; + if (w._hours != null) { + h._hideSelector(); + h._activeDate.setHours(w._hours); + h._updateActiveHours(); + h._updateVisibleHours(); + h._doOnSelectorChange(); + h.callEvent("onTimeChange", [new Date(h._activeDate.getTime())]); + } + }; + if (this.conf.touch == true) { + this.hsCont.ontouchstart = this.hsCont.onclick; + } + } + if (C == "minutes") { + var y = 4; + var u = 3; + var x = 2; + if (this._minutesInterval == 1) { + if (this._selectorMode == 1) { + y = 2; + u = 3; + x = 1; + } else { + y = 2; + u = 5; + x = 1; + v += "5"; + } + } + if (this._minutesInterval == 10) { + y = 2; + } + if (this._minutesInterval == 15) { + y = 1; + u = 4; + v += "4"; + } + this._rsCells = {}; + this.rsCont = document.createElement("DIV"); + this.rsCont.className = "dhtmlxcalendar_area_" + v; + this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.rsCont); + var s = 0; + for (var a = 0; a < y; a++) { + var A = document.createElement("UL"); + A.className = "dhtmlxcalendar_selector_line"; + this.rsCont.appendChild(A); + for (var D = 0; D < u; D++) { + var E = document.createElement("LI"); + E.innerHTML = x > 1 ? this._fixLength(s, x) : s; + E.className = "dhtmlxcalendar_selector_cell"; + A.appendChild(E); + E._minutes = s; + E._cell = true; + this._rsCells[s] = E; + s += this._minutesInterval; + } + } + this.rsCont.onclick = function (H) { + H = H || event; + if (H.type == "touchstart" && H.preventDefault != null) { + H.preventDefault(); + } + H.cancelBubble = true; + var F = H.target || H.srcElement; + if (F._minutes != null) { + if (h._minutesInterval == 1) { + var w = h.getFormatedDate("%i"); + if (h._selectorMode == 1) { + w = F._minutes.toString() + w.charAt(1); + } else { + w = w.charAt(0) + F._minutes.toString(); + } + h._activeDate.setMinutes(Number(w)); + h.callEvent("onTimeChange", [new Date(h._activeDate.getTime())]); + h._hideSelector(); + if (h._selectorMode == 1) { + h._updateVisibleMinutes(true); + h._selectorMode = 2; + h._showSelector("minutes", h._sel._x, h._sel._y, "selector_minutes", true); + h._updateActiveMinutes(); + return; + } else { + h._selectorMode = 1; + } + } else { + h._hideSelector(); + h._activeDate.setMinutes(F._minutes); + h._updateActiveMinutes(); + h.callEvent("onTimeChange", [new Date(h._activeDate.getTime())]); + } + h._updateVisibleMinutes(); + h._doOnSelectorChange(); + } + }; + if (this.conf.touch == true) { + this.rsCont.ontouchstart = this.rsCont.onclick; + } + } + this._sel._ta[C] = true; + }; + this._showSelector = function (w, s, A, v, a) { + if (a === true && this._sel != null && this._isSelectorVisible() && w == this._sel._t) { + this._hideSelector(); + return; + } + if (this.conf.skin == "dhx_terrace") { + s += 12; + } + if (!this._sel || !this._sel._ta[w]) { + this._initSelector(w, v); + } + if (w != this._sel._t && this._sel._t == "minutes" && this._minutesInterval == 1) { + this.contTime.firstChild.firstChild.childNodes[3].innerHTML = this.getFormatedDate("%i"); + } + this._sel._x = s; + this._sel._y = A; + this._sel.style.visibility = "hidden"; + this._sel.style.display = ""; + this._selCover.style.width = this.base.offsetWidth - 2 + "px"; + this._selCover.style.top = this.contMonth.offsetHeight + "px"; + this._selCover.style.height = this.contDates.offsetHeight + this.contDays.offsetHeight - 1 + "px"; + this._selCover.style.display = ""; + this._sel._t = w; + this._sel.className = "dhtmlxcalendar_selector_obj dhtmlxcalendar_" + v; + this._sel.childNodes[0].firstChild.firstChild.childNodes[0].style.display = this._sel.childNodes[0].firstChild.firstChild.childNodes[2].style.display = w == "year" ? "" : "none"; + var u = Math.max(0, s - Math.round(this._sel.offsetWidth / 2)); + if (u + this._sel.offsetWidth > this._sel.parentNode.offsetWidth) { + u = this._sel.parentNode.offsetWidth - this._sel.offsetWidth; + } + this._sel.style.left = u + "px"; + if (w == "hours" || w == "minutes") { + this._sel.style.top = A - this._sel.offsetHeight + "px"; + } else { + this._sel.style.top = A + "px"; + } + this._sel.childNodes[1].style.width = this._sel.childNodes[0].offsetWidth + "px"; + this._sel.style.visibility = "visible"; + this._doOnSelectorShow(w); + }; + this._doOnSelectorShow = function (a) { + if (a == "month") { + this._updateActiveMonth(); + } + if (a == "year") { + this._updateYearsList(this._activeMonth); + } + if (a == "hours") { + this._updateActiveHours(); + } + if (a == "minutes") { + this._updateActiveMinutes(); + } + }; + this._hideSelector = function (a) { + if (!this._sel) { + return; + } + this._sel.style.display = "none"; + this._sel.style.visible = "hidden"; + this._selCover.style.display = "none"; + if (this._sel._t == "minutes" && this._minutesInterval == 1) { + this.contTime.firstChild.firstChild.childNodes[3].innerHTML = this.getFormatedDate("%i"); + this._unloadSelector("minutes"); + } + }; + this._isSelectorVisible = function () { + if (!this._sel) { + return false; + } + return this._sel.style.display != "none"; + }; + this._doOnSelectorChange = function (a) { + this.callEvent("onChange", [ + new Date(this._activeMonth.getFullYear(), this._activeMonth.getMonth(), this._activeDate.getDate(), this._activeDate.getHours(), this._activeDate.getMinutes(), this._activeDate.getSeconds()), + a === true, + ]); + }; + this._clearSelHover = function () { + if (!this._selHover) { + return; + } + this._selHover.className = String(this._selHover.className.replace(/dhtmlxcalendar_selector_cell_hover/gi, "")); + this._selHover = null; + }; + this._unloadSelector = function (u) { + if (!this._sel) { + return; + } + if (!this._sel._ta[u]) { + return; + } + if (u == "month") { + this.msCont.onclick = this.msCont.ontouchstart = null; + this._msActive = null; + for (var s in this._msCells) { + this._msCells[s]._cell = null; + this._msCells[s]._month = null; + this._msCells[s].parentNode.removeChild(this._msCells[s]); + this._msCells[s] = null; + } + this._msCells = null; + while (this.msCont.childNodes.length > 0) { + this.msCont.removeChild(this.msCont.lastChild); + } + this.msCont.parentNode.removeChild(this.msCont); + this.msCont = null; + } + if (u == "year") { + this.ysCont.onclick = this.ysCont.ontouchstart = null; + for (var s in this._ysCells) { + this._ysCells[s]._cell = null; + this._ysCells[s]._year = null; + this._ysCells[s].parentNode.removeChild(this._ysCells[s]); + this._ysCells[s] = null; + } + this._ysCells = null; + while (this.ysCont.childNodes.length > 0) { + this.ysCont.removeChild(this.ysCont.lastChild); + } + this.ysCont.parentNode.removeChild(this.ysCont); + this.ysCont = null; + } + if (u == "hours") { + this.hsCont.onclick = this.hsCont.ontouchstart = null; + this._hsActive = null; + for (var s in this._hsCells) { + this._hsCells[s]._cell = null; + this._hsCells[s]._hours = null; + this._hsCells[s].parentNode.removeChild(this._hsCells[s]); + this._hsCells[s] = null; + } + this._hsCells = null; + while (this.hsCont.childNodes.length > 0) { + this.hsCont.removeChild(this.hsCont.lastChild); + } + this.hsCont.parentNode.removeChild(this.hsCont); + this.hsCont = null; + } + if (u == "minutes") { + this.rsCont.onclick = this.rsCont.ontouchstart = null; + this._rsActive = null; + for (var s in this._rsCells) { + this._rsCells[s]._cell = null; + this._rsCells[s]._minutes = null; + this._rsCells[s].parentNode.removeChild(this._rsCells[s]); + this._rsCells[s] = null; + } + this._rsCells = null; + while (this.rsCont.childNodes.length > 0) { + this.rsCont.removeChild(this.rsCont.lastChild); + } + this.rsCont.parentNode.removeChild(this.rsCont); + this.rsCont = null; + } + this._sel._ta[u] = null; + }; + this.setMinutesInterval = function (a) { + if (!(a == 1 || a == 5 || a == 10 || a == 15)) { + return; + } + this._minutesInterval = a; + this._unloadSelector("minutes"); + }; + this._updateActiveMonth = function () { + if (typeof this._msActive != "undefined" && typeof this._msCells[this._msActive] != "undefined") { + this._msCells[this._msActive].className = "dhtmlxcalendar_selector_cell"; + } + this._msActive = this._activeMonth.getMonth(); + this._msCells[this._msActive].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"; + }; + this._updateActiveYear = function () { + var a = this._activeMonth.getFullYear(); + if (this._ysCells[a]) { + this._ysCells[a].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"; + } + }; + this._updateYearsList = function (y) { + for (var u in this._ysCells) { + this._ysCells[u] = null; + delete this._ysCells[u]; + } + var v = 12 * Math.floor(y.getFullYear() / 12); + for (var x = 0; x < 4; x++) { + for (var s = 0; s < 3; s++) { + this.ysCont.childNodes[x].childNodes[s].innerHTML = v; + this.ysCont.childNodes[x].childNodes[s]._year = v; + this.ysCont.childNodes[x].childNodes[s].className = "dhtmlxcalendar_selector_cell"; + this._ysCells[v++] = this.ysCont.childNodes[x].childNodes[s]; + } + } + this._updateActiveYear(); + }; + this._scrollYears = function (a) { + var u = (a < 0 ? this.ysCont.firstChild.firstChild._year : this.ysCont.lastChild.lastChild._year) + a; + var s = new Date(u, this._activeMonth.getMonth(), 1, 0, 0, 0, 0); + this._updateYearsList(s); + }; + this._updateActiveHours = function () { + if (typeof this._hsActive != "undefined" && typeof this._hsCells[this._hsActive] != "undefined") { + this._hsCells[this._hsActive].className = "dhtmlxcalendar_selector_cell"; + } + this._hsActive = this._activeDate.getHours(); + this._hsCells[this._hsActive].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"; + }; + this._updateVisibleHours = function () { + this.contTime.firstChild.firstChild.childNodes[1].innerHTML = this._fixLength(this._activeDate.getHours(), 2); + }; + this._updateActiveMinutes = function () { + if (this._rsActive != null && typeof this._rsActive != "undefined" && typeof this._rsCells[this._rsActive] != "undefined") { + this._rsCells[this._rsActive].className = "dhtmlxcalendar_selector_cell"; + } + if (this._minutesInterval == 1) { + this._rsActive = this.getFormatedDate("%i") + .toString() + .charAt(this._selectorMode == 1 ? 0 : 1); + } else { + this._rsActive = this._activeDate.getMinutes(); + } + if (typeof this._rsCells[this._rsActive] != "undefined") { + this._rsCells[this._rsActive].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"; + } + }; + this._updateVisibleMinutes = function (s) { + var a = this._fixLength(this._activeDate.getMinutes(), 2).toString(); + if (s == true) { + a = a.charAt(0) + "" + a.charAt(1) + ""; + } + this.contTime.firstChild.firstChild.childNodes[3].innerHTML = a; + if (s == true) { + this.contTime.firstChild.firstChild.childNodes[3].lastChild._par = true; + } + }; + this._fixLength = function (a, s) { + while (String(a).length < s) { + a = "0" + String(a); + } + return a; + }; + this._dateFormat = ""; + this._dateFormatRE = null; + this.setDateFormat = function (w) { + var v = {}; + if (this._strToDate != null) { + for (var s in this.i) { + if (this.i[s].input != null && this.i[s].input.value.length > 0) { + var x = this._strToDate(this.i[s].input.value, this._dateFormat || this.langData[this.lang].dateformat || "%Y-%m-%d"); + if (x instanceof Date) { + v[s] = x; + } + } + } + } + this._dateFormat = w; + var u = String(this._dateFormat).replace(/%[a-zA-Z]+/g, function (a) { + var y = a.replace(/%/, ""); + switch (y) { + case "n": + case "h": + case "j": + case "g": + case "G": + return "\\d{1,2}"; + case "m": + case "d": + case "H": + case "i": + case "s": + case "y": + return "\\d{2}"; + case "Y": + return "\\d{4}"; + case "M": + return "(" + h.langData[h.lang].monthesSNames.join("|").toLowerCase() + "){1,}"; + case "F": + return "(" + h.langData[h.lang].monthesFNames.join("|").toLowerCase() + "){1,}"; + case "D": + return "[a-z]{2}"; + case "a": + case "A": + return "AM|PM"; + case "u": + return "\\d{1,6}"; + case "P": + return "[\\+\\-]\\d{1,2}\\:\\d{1,2}"; + } + return a; + }); + this._dateFormatRE = new RegExp(u, "i"); + for (var s in v) { + this.i[s].input.value = this._dateToStr(v[s]); + } + v = null; + }; + this.setDateFormat(this.langData[this.lang].dateformat || "%Y-%m-%d"); + this._updateDateStr = function (s) { + if (!this._dateFormatRE || !s.match(this._dateFormatRE)) { + return; + } + if (s == this.getFormatedDate()) { + return; + } + var a = this._strToDate(s); + if (!(a instanceof Date)) { + return; + } + if (this.checkEvent("onBeforeChange")) { + if (!this.callEvent("onBeforeChange", [new Date(a.getFullYear(), a.getMonth(), a.getDate(), a.getHours(), a.getMinutes(), a.getSeconds())])) { + if (this.i != null && this._activeInp != null && this.i[this._activeInp] != null && this.i[this._activeInp].input != null) { + this.i[this._activeInp].input.value = this.getFormatedDate(); + } + return; + } + } + this._nullDate = false; + this._activeDate = a; + this._drawMonth(this._nullDate ? new Date() : this._activeDate); + this._updateVisibleMinutes(); + this._updateVisibleHours(); + if (this._sel && this._isSelectorVisible()) { + this._doOnSelectorShow(this._sel._t); + } + this._doOnSelectorChange(true); + }; + this.showMonth = function (a) { + if (typeof a == "string") { + a = this._strToDate(a); + } + if (!(a instanceof Date)) { + return; + } + this._drawMonth(a); + }; + this.setFormatedDate = function (w, x, s, v) { + var u = this._strToDate(x, w); + if (v) { + return u; + } + this.setDate(u); + }; + this.getFormatedDate = function (s, a) { + if (!(a && a instanceof Date)) { + if (this._nullDate) { + return ""; + } + a = new Date(this._activeDate); + } + return this._dateToStr(a, s); + }; + this.getWeekNumber = function (x) { + if (typeof x == "string") { + x = this._strToDate(x); + } + if (!(x instanceof Date)) { + return "Invalid Date"; + } + if (typeof this._ftDay == "undefined") { + this._ftDay = 4; + } + var F = this._wStart; + var w = F + 7; + var E = 4; + var u = new Date(x.getFullYear(), 0, 1, 0, 0, 0, 0); + var v = u.getDay(); + if (v == 0) { + v = 7; + } + if (E < F) { + E += 7; + v += 7; + } + var C = 0; + if (v >= F && v <= E) { + } else { + C = 1; + } + var A = v - F; + var D = new Date(x.getFullYear(), 0, 1 - A + C * 7, 0, 0, 0, 0); + var I = 604800000; + var s = new Date(x.getFullYear(), x.getMonth(), x.getDate() + 1, 0, 0, 0, 0); + var H = Math.ceil((s.getTime() - D.getTime()) / I); + if (H == 0) { + var y = new Date(x.getFullYear(), x.getMonth(), x.getDate(), 0, 0, 0, 0); + var a = y.getDay() - this._wStart; + if (a < 0) { + a = a + 7; + } + y.setDate(y.getDate() - a); + H = this.getWeekNumber(y); + } + return H; + }; + this.showWeekNumbers = function () { + this.base.firstChild.className = "dhtmlxcalendar_wn"; + }; + this.hideWeekNumbers = function () { + this.base.firstChild.className = ""; + }; + this.show = function (u) { + if (!u && this._hasParent) { + this._show(); + return; + } + if (typeof u == "object" && typeof u._dhtmlxcalendar_uid != "undefined" && this.i[u._dhtmlxcalendar_uid] == u) { + this._show(u._dhtmlxcalendar_uid); + return; + } + if (typeof u == "undefined") { + for (var s in this.i) { + if (!u) { + u = s; + } + } + } + if (!u) { + return; + } + this._show(u); + }; + this.hide = function () { + if (this._isVisible()) { + this._hide(); + } + }; + this.isVisible = function () { + return this._isVisible(); + }; + this._activeInp = null; + this.pos = "bottom"; + this.setPosition = function (a, s) { + this._px = null; + this._py = null; + if (a == "right" || a == "bottom") { + this.pos = a; + } else { + this.pos = "int"; + if (typeof a != "undefined" && !isNaN(a)) { + this.base.style.left = a + "px"; + this._px = a; + } + if (typeof s != "undefined" && !isNaN(s)) { + this.base.style.top = s + "px"; + this._py = s; + } + this._ifrSize(); + } + }; + this._show = function (A, s) { + if (s === true && this._activeInp == A && this._isVisible()) { + this._hide(); + return; + } + this.base.style.visibility = "hidden"; + this.base.style.display = ""; + if (!A) { + if (this._px && this._py) { + this.base.style.left = this._px + "px"; + this.base.style.top = this._py + "px"; + } else { + this.base.style.left = "0px"; + this.base.style.top = "0px"; + } + } else { + if (this.base.className.indexOf("dhtmlxcalendar_in_input") == -1) { + this.base.className += " dhtmlxcalendar_in_input"; + } + var u = this.i[A].input || this.i[A].button; + var C = window.dhx4.screenDim(); + var y = { top: window.dhx4.absTop(u), left: window.dhx4.absLeft(u) }; + if (this.pos == "right") { + this.base.style.left = y.left + u.offsetWidth + "px"; + this.base.style.top = Math.min(y.top, C.bottom - this.base.offsetHeight) + "px"; + } else { + if (this.pos == "bottom") { + var w = y.top + u.offsetHeight + 1; + if (w + this.base.offsetHeight > C.bottom) { + var v = y.top - this.base.offsetHeight; + if (v >= -20) { + w = v; + } + } + var a = y.left; + if (a + this.base.offsetWidth > C.right) { + a = Math.max(0, y.left + u.offsetWidth - this.base.offsetWidth); + } + this.base.style.left = a + "px"; + this.base.style.top = w + "px"; + } else { + this.base.style.left = (this._px || 0) + "px"; + this.base.style.top = (this._py || 0) + "px"; + } + } + this._activeInp = A; + u = null; + } + this._hideSelector(); + this.base.style.visibility = "visible"; + this.base.style.zIndex = window.dhx4.zim.reserve(this.conf.zi); + this._ifrSize(); + if (this._ifr) { + this._ifr.style.display = ""; + } + this.callEvent("onShow", []); + }; + this._hide = function () { + if (this._lastHover != null) { + this._clearDayHover(); + } + this._hideSelector(); + this.base.style.display = "none"; + window.dhx4.zim.clear(this.conf.zi); + if (this.base.className.indexOf("dhtmlxcalendar_in_input") >= 0) { + this.base.className = this.base.className.replace(/\s{0,}dhtmlxcalendar_in_input/gi, ""); + } + this._activeInp = null; + if (this._ifr) { + this._ifr.style.display = "none"; + } + this.callEvent("onHide", []); + }; + this._isVisible = function () { + return this.base.style.display != "none"; + }; + this._rangeActive = false; + this._rangeFrom = null; + this._rangeTo = null; + this._rangeSet = {}; + this.setInsensitiveDays = function (u) { + var a = this._extractDates(u); + for (var s = 0; s < a.length; s++) { + this._rangeSet[new Date(a[s].getFullYear(), a[s].getMonth(), a[s].getDate(), 0, 0, 0, 0).getTime()] = true; + } + this._drawMonth(this._activeMonth); + }; + this.clearInsensitiveDays = function () { + this._clearRangeSet(); + this._drawMonth(this._activeMonth); + }; + this._holidays = {}; + this.setHolidays = function (s) { + if (s == null) { + this._clearHolidays(); + } else { + if (s != null) { + var a = this._extractDates(s); + for (var u = 0; u < a.length; u++) { + this._holidays[new Date(a[u].getFullYear(), a[u].getMonth(), a[u].getDate(), 0, 0, 0, 0).getTime()] = true; + } + } + } + this._drawMonth(this._activeMonth); + }; + this._extractDates = function (u) { + if (typeof u == "string" || u instanceof Date) { + u = [u]; + } + var s = []; + for (var v = 0; v < u.length; v++) { + if (typeof u[v] == "string") { + var x = u[v].split(","); + for (var a = 0; a < x.length; a++) { + s.push(this._strToDate(x[a])); + } + } else { + if (u[v] instanceof Date) { + s.push(u[v]); + } + } + } + return s; + }; + this._clearRange = function () { + this._rangeActive = false; + this._rangeType = null; + this._rangeFrom = null; + this._rangeTo = null; + }; + this._clearRangeSet = function () { + for (var s in this._rangeSet) { + this._rangeSet[s] = null; + delete this._rangeSet[s]; + } + }; + this._clearHolidays = function () { + for (var s in this._holidays) { + this._holidays[s] = null; + delete this._holidays[s]; + } + }; + this._isOutOfRange = function (s) { + if (this._rangeSet[s] == true) { + return true; + } + if (this._rangeActive) { + if (this._rangeType == "in" && (s < this._rangeFrom || s > this._rangeTo)) { + return true; + } + if (this._rangeType == "out" && s >= this._rangeFrom && s <= this._rangeTo) { + return true; + } + if (this._rangeType == "from" && s < this._rangeFrom) { + return true; + } + if (this._rangeType == "to" && s > this._rangeTo) { + return true; + } + } + var a = new Date(s); + if (this._rangeWeek) { + if (this._rangeWeekData[a.getDay()] === true) { + return true; + } + } + if (this._rangeMonth) { + if (this._rangeMonthData[a.getDate()] === true) { + return true; + } + } + if (this._rangeYear) { + if (this._rangeYearData[a.getMonth() + "_" + a.getDate()] === true) { + return true; + } + } + return false; + }; + this.clearSensitiveRange = function () { + this._clearRange(); + this._drawMonth(this._activeMonth); + }; + this.setSensitiveRange = function (v, u, a) { + var s = false; + if (v != null && u != null) { + if (!(v instanceof Date)) { + v = this._strToDate(v); + } + if (!(u instanceof Date)) { + u = this._strToDate(u); + } + if (v.getTime() > u.getTime()) { + return; + } + this._rangeFrom = new Date(v.getFullYear(), v.getMonth(), v.getDate(), 0, 0, 0, 0).getTime(); + this._rangeTo = new Date(u.getFullYear(), u.getMonth(), u.getDate(), 0, 0, 0, 0).getTime(); + this._rangeActive = true; + this._rangeType = "in"; + s = true; + } + if (!s && v != null && u == null) { + if (!(v instanceof Date)) { + v = this._strToDate(v); + } + this._rangeFrom = new Date(v.getFullYear(), v.getMonth(), v.getDate(), 0, 0, 0, 0).getTime(); + this._rangeTo = null; + if (a === true) { + this._rangeFrom++; + } + this._rangeActive = true; + this._rangeType = "from"; + s = true; + } + if (!s && v == null && u != null) { + if (!(u instanceof Date)) { + u = this._strToDate(u); + } + this._rangeFrom = null; + this._rangeTo = new Date(u.getFullYear(), u.getMonth(), u.getDate(), 0, 0, 0, 0).getTime(); + if (a === true) { + this._rangeTo--; + } + this._rangeActive = true; + this._rangeType = "to"; + s = true; + } + if (s) { + this._drawMonth(this._activeMonth); + } + }; + this.setInsensitiveRange = function (s, a) { + if (s != null && a != null) { + if (!(s instanceof Date)) { + s = this._strToDate(s); + } + if (!(a instanceof Date)) { + a = this._strToDate(a); + } + if (s.getTime() > a.getTime()) { + return; + } + this._rangeFrom = new Date(s.getFullYear(), s.getMonth(), s.getDate(), 0, 0, 0, 0).getTime(); + this._rangeTo = new Date(a.getFullYear(), a.getMonth(), a.getDate(), 0, 0, 0, 0).getTime(); + this._rangeActive = true; + this._rangeType = "out"; + this._drawMonth(this._activeMonth); + return; + } + if (s != null && a == null) { + this.setSensitiveRange(null, s, true); + return; + } + if (s == null && a != null) { + this.setSensitiveRange(a, null, true); + return; + } + }; + this.disableDays = function (x, w) { + if (x == "week") { + if (typeof w != "object" && typeof w.length == "undefined") { + w = [w]; + } + if (!this._rangeWeekData) { + this._rangeWeekData = {}; + } + for (var s in this._rangeWeekData) { + this._rangeWeekData[s] = false; + delete this._rangeWeekData[s]; + } + for (var v = 0; v < w.length; v++) { + this._rangeWeekData[w[v]] = true; + if (w[v] == 7) { + this._rangeWeekData[0] = true; + } + } + this._rangeWeek = true; + } + if (x == "month") { + if (typeof w != "object" && typeof w.length == "undefined") { + w = [w]; + } + if (!this._rangeMonthData) { + this._rangeMonthData = {}; + } + for (var s in this._rangeMonthData) { + this._rangeMonthData[s] = false; + delete this._rangeMonthData[s]; + } + for (var v = 0; v < w.length; v++) { + this._rangeMonthData[w[v]] = true; + } + this._rangeMonth = true; + } + if (x == "year") { + var u = this._extractDates(w); + if (!this._rangeYearData) { + this._rangeYearData = {}; + } + for (var s in this._rangeYearData) { + this._rangeYearData[s] = false; + delete this._rangeYearData[s]; + } + for (var v = 0; v < u.length; v++) { + this._rangeYearData[u[v].getMonth() + "_" + u[v].getDate()] = true; + } + this._rangeYear = true; + } + this._drawMonth(this._activeMonth); + }; + this.enableDays = function (a) { + if (a == "week") { + this._rangeWeek = false; + } + if (a == "month") { + this._rangeMonth = false; + } + if (a == "year") { + this._rangeYear = false; + } + this._drawMonth(this._activeMonth); + }; + this._tipData = {}; + this._tipTM = null; + this._tipTMTime = 400; + this._tipEvs = false; + this._tipPopup = null; + this._tipCellDate = null; + this._tipCellDim = null; + this.setTooltip = function (u, x, y, a) { + var v = this._extractDates(u); + for (var w = 0; w < v.length; w++) { + var s = new Date(v[w].getFullYear(), v[w].getMonth(), v[w].getDate(), 0, 0, 0, 0).getTime(); + this._tipData[s] = { text: x, showIcon: y, usePopup: a }; + } + this._drawMonth(this._activeMonth); + }; + this.clearTooltip = function (s) { + var u = this._extractDates(s); + for (var v = 0; v < u.length; v++) { + var a = new Date(u[v].getFullYear(), u[v].getMonth(), u[v].getDate(), 0, 0, 0, 0).getTime(); + this._tipData[a] = null; + delete this._tipData[a]; + } + this._drawMonth(this._activeMonth); + }; + this._initTooltipPopup = function () { + if (this._tipEvs) { + return; + } + this.attachEvent("onMouseOver", function (s) { + var a = new Date(s.getFullYear(), s.getMonth(), s.getDate(), 0, 0, 0, 0).getTime(); + if (this._tipData[a] != null) { + if (this._tipTM) { + window.clearTimeout(this._tipTM); + } + this._tipCellDate = s; + this._tipCellDim = this.getCellDimension(s); + this._tipText = this._tipData[a].text; + this._tipTM = window.setTimeout(this._showTooltipPopup, this._tipTMTime); + } + }); + this.attachEvent("onMouseOut", this._hideTooltipPopup); + this._tipEvs = true; + }; + this._showTooltipPopup = function (v, a, A, s, u) { + if (!h._tipPopup) { + h._tipPopup = new dhtmlXPopup({ mode: "top" }); + } + h._tipPopup.attachHTML(h._tipText); + h._tipPopup.show(h._tipCellDim.x, h._tipCellDim.y, h._tipCellDim.w, h._tipCellDim.h); + h.callEvent("onPopupShow", [h._tipCellDate]); + }; + this._hideTooltipPopup = function () { + if (this._tipTM) { + window.clearTimeout(this._tipTM); + } + if (this._tipPopup != null && this._tipPopup.isVisible()) { + this._tipPopup.hide(); + this.callEvent("onPopupHide", [this._tipCellDate]); + } + }; + this.getPopup = function () { + return this._tipPopup; + }; + this.getCellDimension = function (u) { + if (typeof u == "string") { + u = this._strToDate(u); + } + if (!(u instanceof Date)) { + return null; + } + var v = new Date(u.getFullYear(), u.getMonth(), u.getDate(), 0, 0, 0, 0).getTime(); + var s = null; + for (var x = 0; x < this.contDates.childNodes.length; x++) { + for (var a = 0; a < this.contDates.childNodes[x].childNodes.length; a++) { + var y = this.contDates.childNodes[x].childNodes[a]; + if (y._date != null && y._date.getTime() == v) { + s = { x: window.dhx4.absLeft(y), y: window.dhx4.absTop(y), w: y.offsetWidth, h: y.offsetHeight }; + } + y = null; + } + } + return s; + }; + this._updateFromInput = function (a) { + if (this._nullInInput && a.value.replace(/\s/g, "").length == 0) { + if (this.checkEvent("onBeforeChange")) { + if (!this.callEvent("onBeforeChange", [null])) { + if (this.i != null && this._activeInp != null && this.i[this._activeInp] != null && this.i[this._activeInp].input != null) { + this.i[this._activeInp].input.value = this.getFormatedDate(); + } + return; + } + } + this.setDate(null); + } else { + this._updateDateStr(a.value); + } + a = null; + }; + this._doOnClick = function (s) { + s = s || event; + var a = s.target || s.srcElement; + if (a._dhtmlxcalendar_uid && a._dhtmlxcalendar_uid != h._activeInp && h._isVisible() && h._activeInp) { + h._hide(); + return; + } + if (!a._dhtmlxcalendar_uid || !h.i[a._dhtmlxcalendar_uid]) { + if (h._isSelectorVisible()) { + h._hideSelector(); + } else { + if (!h._hasParent && h._isVisible()) { + h._hide(); + } + } + } + }; + this._doOnKeyDown = function (a) { + a = a || event; + if (a.keyCode == 27 || a.keyCode == 13) { + if (h._isSelectorVisible()) { + h._hideSelector(); + } else { + if (h._isVisible() && !h._hasParent) { + h._hide(); + } + } + } + }; + this._doOnInpClick = function (s) { + s = s || event; + if (s.type == "touchstart" && s.preventDefault != null) { + s.preventDefault(); + } + var a = s.target || s.srcElement; + if (!a._dhtmlxcalendar_uid) { + return; + } + if (!h._listenerEnabled) { + h._updateFromInput(a); + } + h._show(a._dhtmlxcalendar_uid, true); + }; + this._doOnInpKeyUp = function (s) { + s = s || event; + var a = s.target || s.srcElement; + if (s.keyCode == 13 || !a._dhtmlxcalendar_uid) { + return; + } + if (!h._listenerEnabled) { + h._updateFromInput(a); + } + }; + this._doOnBtnClick = function (s) { + s = s || event; + if (s.type == "touchstart" && s.preventDefault != null) { + s.preventDefault(); + } + var a = s.target || s.srcElement; + if (!a._dhtmlxcalendar_uid) { + return; + } + if (h.i[a._dhtmlxcalendar_uid].input != null) { + h._updateFromInput(h.i[a._dhtmlxcalendar_uid].input); + } + h._show(a._dhtmlxcalendar_uid, true); + }; + this._doOnUnload = function () { + if (h && h.unload) { + h.unload(); + } + }; + if (typeof window.addEventListener == "function") { + document.body.addEventListener("click", h._doOnClick, false); + window.addEventListener("keydown", h._doOnKeyDown, false); + window.addEventListener("unload", h._doOnUnload, false); + if (this.conf.touch == true) { + document.body.addEventListener("touchstart", h._doOnClick, false); + } + } else { + document.body.attachEvent("onclick", h._doOnClick); + document.body.attachEvent("onkeydown", h._doOnKeyDown); + window.attachEvent("onunload", h._doOnUnload); + } + this.attachObj = function (u) { + var s = window.dhx4.newId(); + if (typeof u == "string") { + this.i[s] = { input: document.getElementById(u) }; + } else { + if (typeof u.tagName != "undefined") { + this.i[s] = { input: u }; + } else { + if (typeof u == "object" && (u.input != null || u.button != null)) { + this.i[s] = {}; + if (u.input != null) { + this.i[s].input = typeof u.input == "string" ? document.getElementById(u.input) : u.input; + } + if (u.button != null) { + this.i[s].button = typeof u.button == "string" ? document.getElementById(u.button) : u.button; + } + } + } + } + this._attachEventsToObject(s); + return s; + }; + this.detachObj = function (v) { + var u = null; + if (this.i[v] != null) { + u = v; + } else { + if (typeof v == "string") { + v = document.getElementById(v); + u = v._dhtmlxcalendar_uid; + } else { + if (typeof v.tagName != "undefined") { + u = v._dhtmlxcalendar_uid; + } else { + if (typeof v == "object" && (v.input != null || v.button != null)) { + if (u == null && v.input != null) { + u = (typeof v.input == "string" ? document.getElementById(v.input) : v.input)._dhtmlxcalendar_uid; + } + if (u == null && v.button != null) { + u = (typeof v.button == "string" ? document.getElementById(v.button) : v.button)._dhtmlxcalendar_uid; + } + } + } + } + } + if (u != null && this.i[u] != null) { + this._detachEventsFromObject(u); + for (var s in this.i[s]) { + this.i[u][s]._dhtmlxcalendar_uid = null; + this.i[u][s] = null; + delete this.i[u][s]; + } + this.i[u] = null; + delete this.i[u]; + return true; + } + return false; + }; + this._attachEventsToObject = function (s) { + if (this.i[s].button != null) { + this.i[s].button._dhtmlxcalendar_uid = s; + if (typeof window.addEventListener == "function") { + this.i[s].button.addEventListener("click", h._doOnBtnClick, false); + if (this.conf.touch == true) { + this.i[s].button.addEventListener("touchstart", h._doOnBtnClick, false); + } + } else { + this.i[s].button.attachEvent("onclick", h._doOnBtnClick); + } + } else { + if (this.i[s].input != null) { + this.i[s].input._dhtmlxcalendar_uid = s; + if (typeof window.addEventListener == "function") { + this.i[s].input.addEventListener("click", h._doOnInpClick, false); + this.i[s].input.addEventListener("keyup", h._doOnInpKeyUp, false); + if (this.conf.touch == true) { + this.i[s].input.addEventListener("touchstart", h._doOnInpClick, false); + } + } else { + this.i[s].input.attachEvent("onclick", h._doOnInpClick); + this.i[s].input.attachEvent("onkeyup", h._doOnInpKeyUp); + } + } + } + }; + this._detachEventsFromObject = function (s) { + if (this.i[s].button != null) { + if (typeof window.addEventListener == "function") { + this.i[s].button.removeEventListener("click", h._doOnBtnClick, false); + if (this.conf.touch == true) { + this.i[s].button.removeEventListener("touchstart", h._doOnBtnClick, false); + } + } else { + this.i[s].button.detachEvent("onclick", h._doOnBtnClick); + } + } else { + if (this.i[s].input != null) { + if (typeof window.addEventListener == "function") { + this.i[s].input.removeEventListener("click", h._doOnInpClick, false); + this.i[s].input.removeEventListener("keyup", h._doOnInpKeyUp, false); + if (this.conf.touch == true) { + this.i[s].input.removeEventListener("touchstart", h._doOnInpClick, false); + } + } else { + this.i[s].input.detachEvent("onclick", h._doOnInpClick); + this.i[s].input.detachEvent("onkeyup", h._doOnInpKeyUp); + } + } + } + }; + this.enableListener = function (a) { + if (!a) { + return; + } + if (typeof window.addEventListener == "function") { + a.addEventListener("focus", h._listenerEvFocus, false); + a.addEventListener("blur", h._listenerEvBlur, false); + } else { + a.attachEvent("onfocus", h._listenerEvFocus); + a.attachEvent("onblur", h._listenerEvBlur); + } + a = null; + }; + this.disableListener = function (a) { + if (!a) { + return; + } + a._f0 = false; + if (this._tmListener) { + window.clearTimeout(this._tmListener); + } + if (typeof window.addEventListener == "function") { + a.removeEventListener("focus", h._listenerEvFocus, false); + a.removeEventListener("blur", h._listenerEvBlur, false); + } else { + a.detachEvent("onfocus", h._listenerEvFocus); + a.detachEvent("onblur", h._listenerEvBlur); + } + a = null; + }; + this._startListener = function (a) { + if (this._tmListener) { + window.clearTimeout(this._tmListener); + } + if (typeof a._v1 == "undefined") { + a._v1 = a.value; + } + if (a._v1 != a.value) { + this._updateFromInput(a); + a._v1 = a.value; + } + if (a._f0) { + this._tmListener = window.setTimeout(function () { + h._startListener(a); + }, 100); + } + }; + this._listenerEvFocus = function (s) { + s = s || event; + var a = s.target || s.srcElement; + a._f0 = true; + h._startListener(a); + a = null; + }; + this._listenerEvBlur = function (s) { + s = s || event; + var a = s.target || s.srcElement; + a._f0 = false; + a = null; + }; + for (var m in this.i) { + this._attachEventsToObject(m); + } + window.dhx4._eventable(this); + this._evOnArrowClick = function (a) { + return this.callEvent("onArrowClick", a); + }; + this._evOnClick = function (a) { + return this.callEvent("onClick", a); + }; + this._evOnMouseOut = function (a) { + return this.callEvent("onMouseOut", a); + }; + this._evOnMouseOver = function (a) { + return this.callEvent("onMouseOver", a); + }; + this.unload = function () { + this._activeDate = null; + this._activeDateCell = null; + this._activeInp = null; + this._activeMonth = null; + this._dateFormat = null; + this._dateFormatRE = null; + this._lastHover = null; + if (this._tmListener) { + window.clearTimeout(this._tmListener); + } + this._tmListener = null; + if (typeof window.addEventListener == "function") { + document.body.removeEventListener("click", h._doOnClick, false); + window.removeEventListener("keydown", h._doOnKeyDown, false); + window.removeEventListener("unload", h._doOnUnload, false); + if (this.conf.touch == true) { + document.body.removeEventListener("touchstart", h._doOnClick, false); + } + } else { + document.body.detachEvent("onclick", h._doOnClick); + document.body.detachEvent("onkeydown", h._doOnKeyDown); + window.detachEvent("onunload", h._doOnKeyDown); + } + this._doOnClick = null; + this._doOnKeyDown = null; + this._doOnUnload = null; + for (var s in this.i) { + this.i[s]._dhtmlxcalendar_uid = null; + this._detachEventsFromObject(s); + this.disableListener(this.i[s].input); + this.i[s] = null; + delete this.i[s]; + } + this.i = null; + this._doOnInpClick = null; + this._doOnInpKeyUp = null; + window.dhx4._eventable(this, "clear"); + this.contMonth.onselectstart = null; + this.contMonth.firstChild.firstChild.onclick = null; + this.contMonth.firstChild.firstChild.ontouchstart = null; + this.contMonth.firstChild.firstChild.firstChild.onmouseover = null; + this.contMonth.firstChild.firstChild.firstChild.onmouseout = null; + this.contMonth.firstChild.firstChild.lastChild.onmouseover = null; + this.contMonth.firstChild.firstChild.lastChild.onmouseout = null; + while (this.contMonth.firstChild.firstChild.childNodes.length > 0) { + this.contMonth.firstChild.firstChild.removeChild(this.contMonth.firstChild.firstChild.lastChild); + } + this.contMonth.firstChild.removeChild(this.contMonth.firstChild.firstChild); + this.contMonth.removeChild(this.contMonth.firstChild); + this.contMonth.parentNode.removeChild(this.contMonth); + this.contMonth = null; + while (this.contDays.firstChild.childNodes.length > 0) { + this.contDays.firstChild.removeChild(this.contDays.firstChild.lastChild); + } + this.contDays.removeChild(this.contDays.firstChild); + this.contDays.parentNode.removeChild(this.contDays); + this.contDays = null; + this.contDates.onclick = null; + this.contDates.ontouchstart = null; + this.contDates.onmouseover = null; + this.contDates.onmouseout = null; + while (this.contDates.childNodes.length > 0) { + while (this.contDates.lastChild.childNodes.length > 0) { + this.contDates.lastChild.lastChild._css_date = null; + this.contDates.lastChild.lastChild._css_month = null; + this.contDates.lastChild.lastChild._css_weekend = null; + this.contDates.lastChild.lastChild._css_hover = null; + this.contDates.lastChild.lastChild._date = null; + this.contDates.lastChild.lastChild._q = null; + this.contDates.lastChild.lastChild._w = null; + this.contDates.lastChild.removeChild(this.contDates.lastChild.lastChild); + } + this.contDates.removeChild(this.contDates.lastChild); + } + this.contDates.parentNode.removeChild(this.contDates); + this.contDates = null; + this.contTime.firstChild.firstChild.onclick = null; + this.contTime.firstChild.firstChild.ontouchstart = null; + while (this.contTime.firstChild.firstChild.childNodes.length > 0) { + this.contTime.firstChild.firstChild.removeChild(this.contTime.firstChild.firstChild.lastChild); + } + this.contTime.firstChild.removeChild(this.contTime.firstChild.firstChild); + this.contTime.removeChild(this.contTime.firstChild); + this.contTime.parentNode.removeChild(this.contTime); + this.contTime = null; + this._lastHover = null; + this._unloadSelector("month"); + this._unloadSelector("year"); + this._unloadSelector("hours"); + this._unloadSelector("minutes"); + if (this._selCover) { + this._selCover.parentNode.removeChild(this._selCover); + this._selCover = null; + } + if (this._sel) { + for (var s in this._sel._ta) { + this._sel._ta[s] = null; + } + this._sel._ta = null; + this._sel._t = null; + this._sel.onmouseover = null; + this._sel.onmouseout = null; + while (this._sel.firstChild.firstChild.firstChild.childNodes.length > 0) { + this._sel.firstChild.firstChild.firstChild.lastChild.onclick = null; + this._sel.firstChild.firstChild.firstChild.lastChild.onmouseover = null; + this._sel.firstChild.firstChild.firstChild.lastChild.onmouseout = null; + this._sel.firstChild.firstChild.firstChild.removeChild(this._sel.firstChild.firstChild.firstChild.lastChild); + } + this._sel.firstChild.firstChild.removeChild(this._sel.firstChild.firstChild.firstChild); + this._sel.firstChild.removeChild(this._sel.firstChild.firstChild); + while (this._sel.childNodes.length > 0) { + this._sel.removeChild(this._sel.lastChild); + } + this._sel.parentNode.removeChild(this._sel); + this._sel = null; + } + this.base.onclick = null; + this.base.onmousedown = null; + this.base.ontouchstart = null; + this.base.onmouseout = null; + this.base.parentNode.removeChild(this.base); + this.base = null; + this._clearDayHover = null; + this._clearSelHover = null; + this._doOnSelectorChange = null; + this._doOnSelectorShow = null; + this._drawMonth = null; + this._fixLength = null; + this._ifrSize = null; + this._hide = null; + this._hideSelector = null; + this._initSelector = null; + this._isSelectorVisible = null; + this._isVisible = null; + this._scrollYears = null; + this._show = null; + this._showSelector = null; + this._strToDate = null; + this._updateActiveHours = null; + this._updateActiveMinutes = null; + this._updateActiveMonth = null; + this._updateActiveYear = null; + this._updateCellStyle = null; + this._updateDateStr = null; + this._updateVisibleHours = null; + this._updateVisibleMinutes = null; + this._updateYearsList = null; + this.enableIframe = null; + this.hide = null; + this.hideTime = null; + this.setDate = null; + this.setDateFormat = null; + this.setYearsRange = null; + this.show = null; + this.showTime = null; + this.unload = null; + if (this._tipPopup != null) { + this._tipPopup.unload(); + this._tipPopup = null; + } + for (var s in this) { + delete this[s]; + } + s = h = null; + }; + this.setDate(this._activeDate); + return this; +} +dhtmlXCalendarObject.prototype.lang = "en"; +dhtmlXCalendarObject.prototype.langData = { + en: { + dateformat: "%Y-%m-%d", + hdrformat: "%F %Y", + monthesFNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + monthesSNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + daysFNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + daysSNames: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], + weekstart: 1, + weekname: "w", + }, +}; +dhtmlXCalendarObject.prototype._buildMonthHdr = function (h) { + var c = this; + var g = function (j) { + return String(j).length == 1 ? "0" + String(j) : j; + }; + var a = function (j, l) { + return "" + l + ""; + }; + var e = String(this.langData[this.lang].hdrformat || "%F %Y").replace(/%[a-z]/gi, function (j) { + switch (j) { + case "%m": + return a("month", g(h.getMonth() + 1)); + case "%n": + return a("month", h.getMonth() + 1); + case "%M": + return a("month", c.langData[c.lang].monthesSNames[h.getMonth()]); + case "%F": + return a("month", c.langData[c.lang].monthesFNames[h.getMonth()]); + case "%y": + return a("year", g(h.getYear() % 100)); + case "%Y": + return a("year", h.getFullYear()); + case "%%": + return "%"; + default: + return j; + } + }); + c = g = a = null; + return e; +}; +dhtmlXCalendarObject.prototype.enableIframe = function (a) { + if (a == true) { + if (!this._ifr) { + this._ifr = document.createElement("IFRAME"); + this._ifr.frameBorder = 0; + this._ifr.border = 0; + this._ifr.setAttribute("src", "javascript:false;"); + this._ifr.className = "dhtmlxcalendar_ifr"; + this._ifr.onload = function () { + this.onload = null; + this.contentWindow.document.open("text/html", "replace"); + this.contentWindow.document.write(""); + }; + this.base.parentNode.insertBefore(this._ifr, this.base); + this._ifrSize(); + } + } else { + if (this._ifr) { + this._ifr.parentNode.removeChild(this._ifr); + this._ifr = null; + } + } +}; +dhtmlXCalendarObject.prototype._ifrSize = function () { + if (this._ifr) { + this._ifr.style.left = this.base.style.left; + this._ifr.style.top = this.base.style.top; + this._ifr.style.width = this.base.offsetWidth + "px"; + this._ifr.style.height = this.base.offsetHeight + "px"; + } +}; +dhtmlxCalendarObject = dhtmlXCalendarObject; +dhtmlXCalendarObject.prototype._dateStrings = function () { + var a = this.langData[this.lang]; + return { monthFullName: a.monthesFNames, monthShortName: a.monthesSNames, dayFullName: a.daysFNames, dayShortName: a.daysSNames }; +}; +dhtmlXCalendarObject.prototype._strToDate = function (c, a) { + return window.dhx4.str2date(c, a || this._dateFormat, this._dateStrings()); +}; +dhtmlXCalendarObject.prototype._dateToStr = function (c, a) { + return window.dhx4.date2str(c, a || this._dateFormat, this._dateStrings()); +}; +window.dhtmlxDblCalendarObject = window.dhtmlXDoubleCalendarObject = window.dhtmlXDoubleCalendar = function (c) { + var a = this; + this.leftCalendar = new dhtmlXCalendarObject(c); + this.leftCalendar.hideTime(); + this.rightCalendar = new dhtmlXCalendarObject(c); + this.rightCalendar.hideTime(); + this.leftCalendar.attachEvent("onClick", function (e) { + a._updateRange("rightCalendar", e, null); + a._evOnClick(["left", e]); + }); + this.rightCalendar.attachEvent("onClick", function (e) { + a._updateRange("leftCalendar", null, e); + a._evOnClick(["right", e]); + }); + this.leftCalendar.attachEvent("onBeforeChange", function (e) { + return a._evOnBeforeChange(["left", e]); + }); + this.rightCalendar.attachEvent("onBeforeChange", function (e) { + return a._evOnBeforeChange(["right", e]); + }); + this.show = function () { + this.leftCalendar.show(); + this.rightCalendar.base.style.marginLeft = this.leftCalendar.base.offsetWidth - 1 + "px"; + this.rightCalendar.show(); + }; + this.hide = function () { + this.leftCalendar.hide(); + this.rightCalendar.hide(); + }; + this.setDateFormat = function (e) { + this.leftCalendar.setDateFormat(e); + this.rightCalendar.setDateFormat(e); + }; + this.setDates = function (g, e) { + if (g != null) { + this.leftCalendar.setDate(g); + } + if (e != null) { + this.rightCalendar.setDate(e); + } + this._updateRange(); + }; + this._updateRange = function (e, h, g) { + if (arguments.length == 3) { + (e == "leftCalendar" ? this.leftCalendar : this.rightCalendar).setSensitiveRange(h, g); + } else { + this.leftCalendar.setSensitiveRange(null, this.rightCalendar.getDate()); + this.rightCalendar.setSensitiveRange(this.leftCalendar.getDate(), null); + } + }; + this.getFormatedDate = function () { + return this.leftCalendar.getFormatedDate.apply(this.leftCalendar, arguments); + }; + this.unload = function () { + window.dhx4._eventable(this, "clear"); + this.leftCalendar.unload(); + this.rightCalendar.unload(); + this.leftCalendar = this.rightCalendar = null; + this._updateRange = null; + this._evOnClick = null; + this._evOnBeforeChange = null; + this.show = null; + this.hide = null; + this.setDateFormat = null; + this.setDates = null; + this.getFormatedDate = null; + this.unload = null; + a = null; + }; + this._evOnClick = function (e) { + return this.callEvent("onClick", e); + }; + this._evOnBeforeChange = function (e) { + return this.callEvent("onBeforeChange", e); + }; + window.dhx4._eventable(this); + return this; +}; +function dhtmlXCombo(j, o, e, m, h) { + var l = this; + var g = null; + var r = null; + if (typeof j == "object" && !j.tagName) { + g = j; + j = g.parent; + e = g.width; + o = g.name; + m = g.mode; + r = g.skin; + } + this.cont = typeof j == "string" ? document.getElementById(j) : j; + this.conf = { + skin: null, + form_name: o || "dhxcombo", + combo_width: (parseInt(e) || this.cont.offsetWidth || 120) - (dhx4.isFF || dhx4.isIE || dhx4.isChrome || dhx4.isOpera ? 2 : 0), + combo_image: false, + combo_focus: false, + opts_type: typeof m == "string" && typeof this.modes[m] != "undefined" ? m : "option", + opts_count: 8, + opts_count_min: 3, + opts_width: null, + item_h: null, + list_zi_id: window.dhx4.newId(), + allow_free_text: true, + allow_empty_value: true, + enabled: true, + btn_left: (window.dhx4.isIE6 || window.dhx4.isIE7 || window.dhx4.isIE8) && typeof window.addEventListener == "undefined" ? 1 : 0, + ro_mode: false, + ro_text: "", + ro_tm: null, + ro_tm_time: 750, + img_path: "", + img_def: "", + img_def_dis: true, + template: { input: "#text#", option: "#text#" }, + f_func: null, + f_mode: false, + f_url: false, + f_cache: false, + f_cache_data: {}, + f_dyn: false, + f_dyn_end: false, + f_mask: "", + f_ac: true, + f_ac_text: "", + f_server_tm: null, + f_server_last: "", + f_loading: false, + s_tm: null, + s_time: 200, + s_mode: "select", + last_hover: null, + last_selected: null, + last_match: null, + last_text: "", + last_value: "", + tm_hover: null, + tm_confirm_blur: null, + clear_click: false, + clear_blur: false, + clear_bsp: false, + clear_key: false, + sp: { dhx_skyblue: { list_ofs: 1, hdr_ofs: 1, scr_ofs: 1 }, dhx_web: { list_ofs: 0, hdr_ofs: 1, scr_ofs: 0 }, dhx_terrace: { list_ofs: 1, hdr_ofs: 1, scr_ofs: 1 } }, + col_w: null, + }; + this.conf.combo_image = this.modes[this.conf.opts_type].image == true; + this.t = {}; + this.base = document.createElement("DIV"); + this.base.style.width = this.conf.combo_width + "px"; + this.base.innerHTML = + "
" + + (this.conf.combo_image ? "
" + this.modes[this.conf.opts_type].getTopImage(null, this.conf.enabled) + "
" : ""); + this.cont.appendChild(this.base); + this.list = document.createElement("DIV"); + this.list._listId = window.dhx4.newId(); + this.list.style.display = "none"; + document.body.insertBefore(this.list, document.body.firstChild); + this._doOnListScroll = function () { + if (l.conf.s_tm != null) { + window.clearTimeout(l.conf.s_tm); + } + l.conf.s_tm = window.setTimeout(l._doOnListScrollAction, l.conf.s_time); + }; + this._doOnListScrollAction = function () { + l.conf.s_tm = null; + if (l.conf.s_mode == "scroll" && l.list.scrollHeight - l.list.scrollTop - 10 < l.list.clientHeight) { + l._subloadRequest(); + } + }; + if (typeof window.addEventListener == "function") { + this.list.addEventListener("scroll", this._doOnListScroll, false); + } else { + this.list.attachEvent("onscroll", this._doOnListScroll); + } + this.setSkin(r || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxcombo") || "dhx_skyblue"); + this._updateTopImage = function (a) { + if (!this.conf.combo_image) { + return; + } + if (a != null) { + this.base.lastChild.innerHTML = this.t[a].obj.getTopImage(this.t[a].item, this.conf.enabled); + } else { + this.base.lastChild.innerHTML = this.modes[this.conf.opts_type].getTopImage(null, this.conf.enabled); + } + }; + this._filterOpts = function (y) { + if (this.conf.f_server_tm) { + window.clearTimeout(this.conf.f_server_tm); + } + var v = String(this.base.firstChild.value).replace(new RegExp(this.conf.f_ac_text + "$", "i"), ""); + if (this.conf.f_server_last == v.toLowerCase()) { + this._checkForMatch(); + return; + } + if (this.conf.f_url != null && this.checkEvent("onDynXLS")) { + this.conf.f_server_last = v.toLowerCase(); + this.callEvent("onDynXLS", [v]); + return; + } + if (this.conf.f_url != null) { + if (v.length == 0) { + this.conf.f_server_last = v.toLowerCase(); + this.clearAll(); + return; + } + if (this.conf.f_cache == true && this.conf.f_cache_data[v] != null) { + this.clearAll(); + this.conf.f_server_last = v.toLowerCase(); + for (var u = 0; u < this.conf.f_cache_data[v].data.length; u++) { + this.load(this.conf.f_cache_data[v].data[u]); + } + if (this.conf.f_dyn) { + this.conf.f_dyn_end = this.conf.f_cache_data[v].dyn_end; + this.conf.f_mask = this.conf.f_cache_data[v].mask; + } + if (y !== true) { + this._showList(true); + this._checkForMatch(); + } + } else { + this.conf.f_server_tm = window.setTimeout(function () { + l.conf.f_server_last = v.toLowerCase(); + l.conf.f_mask = v; + var E = "mask=" + encodeURIComponent(v); + if (l.conf.f_dyn) { + E += "&pos=0"; + l.conf.f_dyn_end = false; + } + var a = function (I) { + if (l.conf.f_cache) { + if (!l.conf.f_cache_data[v]) { + l.conf.f_cache_data[v] = { data: [], dyn_end: false, mask: v }; + } + l.conf.f_cache_data[v].data.push(I.xmlDoc.responseXML); + } + l.clearAll(); + l.load(I.xmlDoc.responseXML); + var H = l.base.offsetWidth > 0 && l.base.offsetHeight > 0; + if (H == true && l.conf.enabled == true && l.conf.combo_focus == true && y !== true) { + if (l.conf.f_ac && l.conf.f_mode == "start" && l.conf.clear_bsp == false && l.list.firstChild != null) { + var F = l.list.firstChild._optId; + var J = String(l.t[F].obj.getText(l.list.firstChild, true)); + if (v == l.base.firstChild.value && String(J).toLowerCase().indexOf(String(v).toLowerCase()) === 0) { + l.base.firstChild.value = J; + l.conf.f_ac_text = J.substr(v.length); + l._selectRange(v.length, J.length); + } + } + l._showList(true); + l._checkForMatch(); + } + a = null; + }; + if (window.dhx4.ajax.method == "post") { + window.dhx4.ajax.post(l.conf.f_url, E, a); + } else { + if (window.dhx4.ajax.method == "get") { + window.dhx4.ajax.get(l.conf.f_url + (String(l.conf.f_url).indexOf("?") >= 0 ? "&" : "?") + E, a); + } + } + }, 200); + } + } else { + this.conf.f_server_last = v.toLowerCase(); + var s = v.length == 0 ? true : new RegExp((this.conf.f_mode == "start" ? "^" : "") + String(v).replace(/[\\\^\$\*\+\?\.\(\)\|\{\}\[\]]/gi, "\\$&"), "i"); + var w = null; + for (var A in this.t) { + var D = false; + if (s !== true) { + if (this.conf.f_func != null) { + var x = this._getOption(this.t[A].item._optId, u); + D = this.conf.f_func.apply(window, [v, x]) == true; + } else { + var C = this.t[A].obj.getText(this.t[A].item, true); + D = s.test(C) == true; + } + } + if (s === true || D == true) { + this.t[A].item.style.display = ""; + if (w == null && v.length > 0) { + w = String(this.t[A].obj.getText(this.t[A].item, true)); + } + } else { + this.t[A].item.style.display = "none"; + } + } + if (this.conf.f_ac && this.conf.f_mode == "start" && this.conf.clear_bsp == false && w != null) { + this.conf.f_ac_text = w.replace(new RegExp("^" + v, "i"), ""); + this.base.firstChild.value = w; + this._selectRange(this.conf.f_server_last.length, this.base.firstChild.value.length); + } + if (this.conf.f_mode == "between" && this.conf.clear_bsp == true) { + this._checkForMatch(true); + } + if (y !== true) { + this._showList(true); + this._checkForMatch(); + } + } + }; + this._searchRO = function (u) { + if (this.conf.ro_tm) { + window.clearTimeout(this.conf.ro_tm); + } + this.conf.ro_text += u; + this._showList(); + for (var v = 0; v < this.list.childNodes.length; v++) { + var a = this.list.childNodes[v]._optId; + var w = String(this.t[a].obj.getText(this.list.childNodes[v], true)).toLowerCase(); + if (w.indexOf(this.conf.ro_text) === 0) { + this._setSelected(a, true, true); + this._confirmSelect("script", false); + break; + } + } + this.conf.ro_tm = window.setTimeout(function () { + l.conf.ro_text = ""; + }, this.conf.ro_tm_time); + }; + this._initObj = function (a) { + if (typeof a.template != "undefined") { + this.setTemplate(a.template); + } + if (a.add != true && this.conf.f_loading != true) { + this.clearAll(false); + } + this.addOption(a.options); + }; + this._xmlToObj = function (O, v, u) { + var A = { add: false, options: [] }; + var I = v == true ? O : O.getElementsByTagName("complete"); + if (I.length > 0) { + if (window.dhx4.s2b(I[0].getAttribute("add")) == true) { + A.add = true; + } + var H = I[0].childNodes; + for (var E = 0; E < H.length; E++) { + if (typeof H[E].tagName != "undefined") { + if (String(H[E].tagName).toLowerCase() == "template") { + var N = {}; + for (var y = 0; y < H[E].childNodes.length; y++) { + var F = H[E].childNodes[y]; + if (F.tagName != null) { + var J = F.tagName; + if (typeof this.conf.template[J] != "undefined") { + N[J] = window.dhx4._xmlNodeValue(F); + } + if (J == "columns") { + for (var L = 0; L < F.childNodes.length; L++) { + var x = F.childNodes[L]; + if (x.tagName != null && x.tagName == "column") { + var D = {}; + for (var M in { width: 1, css: 1, header: 1, option: 1 }) { + if (x.getAttribute(M) != null) { + D[M] = x.getAttribute(M); + } + } + for (var M in { header: 1, option: 1 }) { + var K = x.getElementsByTagName(M); + if (K[0] != null && K[0].firstChild != null) { + D[M] = window.dhx4._xmlNodeValue(K[0]); + } + } + if (N.columns == null) { + N.columns = []; + } + N.columns.push(D); + } + x = null; + } + } + } + F = null; + } + this.setTemplate(N); + } + if (String(H[E].tagName).toLowerCase() == "option") { + var C = false; + if (v == true) { + C = A.options.length == u; + } else { + C = window.dhx4.s2b(H[E].getAttribute("selected")); + } + var s = { value: H[E].getAttribute("value"), text: window.dhx4._xmlNodeValue(H[E]), selected: C, checked: window.dhx4.s2b(H[E].getAttribute("checked")) }; + for (var M in { img: 1, img_dis: 1, img_src: 1, img_src_dis: 1, css: 1 }) { + if (H[E].getAttribute(M) != null) { + s[M] = H[E].getAttribute(M); + } + } + for (var y = 0; y < H[E].childNodes.length; y++) { + if (H[E].childNodes[y].tagName != null && String(H[E].childNodes[y].tagName).toLowerCase() == "text") { + s.text = {}; + var F = H[E].childNodes[y]; + for (var L = 0; L < F.childNodes.length; L++) { + if (F.childNodes[L].tagName != null) { + s.text[F.childNodes[L].tagName] = window.dhx4._xmlNodeValue(F.childNodes[L]); + } + } + } + } + A.options.push(s); + } + } + } + I = H = null; + } + return A; + }; + window.dhx4._enableDataLoading(this, "_initObj", "_xmlToObj", "complete", { data: true }); + window.dhx4._eventable(this); + this._getNearItem = function (u, s) { + var a = null; + while (u != null) { + u = u[s < 0 ? "previousSibling" : "nextSibling"]; + if (a == null && u != null && u.style.display == "" && u._optId != null) { + a = u; + u = null; + } + } + return a; + }; + this.setName(this.conf.form_name); + this._doOnListMouseMove = function (s) { + s = s || event; + var a = s.target || s.srcElement; + while (a != null && a != this) { + if (typeof a._optId != "undefined") { + if (l.conf.tm_hover) { + window.clearTimeout(l.conf.tm_hover); + } + l._setSelected(a._optId); + } + a = a.parentNode; + } + a = null; + }; + this._doOnListMouseDown = function (a) { + a = a || event; + a.cancelBubble = true; + l.conf.clear_click = true; + window.setTimeout(function () { + l.base.firstChild.focus(); + }, 1); + }; + this._doOnListMouseUp = function (u) { + u = u || event; + if (u.button != l.conf.btn_left) { + return; + } + var a = u.target || u.srcElement; + while (a != null && a != this) { + if (typeof a._optId != "undefined") { + var s = true; + if (typeof l.t[a._optId].obj.optionClick == "function" && l.t[a._optId].obj.optionClick(a, u, l) !== true) { + s = false; + } + if (s) { + l._setSelected(a._optId, null, true); + l._confirmSelect("click"); + } + } + a = a.parentNode; + } + a = null; + }; + this._doOnListMouseOut = function (a) { + if (l.conf.tm_hover) { + window.clearTimeout(l.conf.tm_hover); + } + l.conf.tm_hover = window.setTimeout(function () { + var s = l.conf.last_match || l.conf.last_selected; + if (l.conf.last_match == null && l.t[s] != null) { + if (l.base.firstChild.value != l.t[s].obj.getText(l.t[s].item, true)) { + s = null; + } + } + l._setSelected(s, null, true); + }, 1); + }; + this._doOnBaseMouseDown = function (w) { + if (!l.conf.enabled) { + return; + } + l.conf.clear_click = true; + w = w || event; + if (w.button != l.conf.btn_left) { + return; + } + var s = w.target || w.srcElement; + if (s != this.firstChild) { + window.setTimeout(function () { + l.base.firstChild.focus(); + }, 1); + var v = s; + while (v != this && v != null) { + if (v == this.lastChild) { + if (typeof l.modes[l.conf.opts_type].topImageClick == "function") { + var u = l.conf.last_hover || l.conf.last_selected; + var a = u != null ? l.t[u].item : null; + if (l.modes[l.conf.opts_type].topImageClick(a, l) !== true) { + u = a = null; + return; + } + } + v = null; + } else { + v = v.parentNode; + } + } + } + if (l._isListVisible()) { + l._hideList(); + } else { + if (s != this.firstChild) { + l.conf.clear_blur = true; + } + l._showList(); + l._setSelected(l.conf.last_selected, true, true); + } + s = null; + }; + this._doOnBodyMouseDown = function () { + if (l.conf.clear_click) { + l.conf.clear_click = false; + return; + } + l._confirmSelect("blur"); + }; + this._doOnInputFocus = function () { + l.conf.clear_blur = false; + if (l.conf.tm_confirm_blur) { + window.clearTimeout(l.conf.tm_confirm_blur); + } + if (l.conf.combo_focus == false) { + l.conf.combo_focus = true; + l.callEvent("onFocus", []); + } + }; + this._doOnInputBlur = function () { + if (l.conf.clear_blur == true) { + l.conf.clear_blur = false; + return; + } + if (l.conf.tm_confirm_blur) { + window.clearTimeout(l.conf.tm_confirm_blur); + } + l.conf.tm_confirm_blur = window.setTimeout(function () { + if (l.conf.clear_click == false) { + l._confirmSelect("blur"); + l.conf.combo_focus = false; + l.callEvent("onBlur", []); + } + }, 20); + }; + this._doOnInputKeyUp = function (a) { + a = a || event; + if (l.conf.f_mode != false) { + l.conf.clear_bsp = a.keyCode == 8 || a.keyCode == 46; + l._filterOpts(); + return; + } else { + l._checkForMatch(); + } + }; + this._doOnInputKeyDown = function (a) { + a = a || event; + if ((a.keyCode == 38 || a.keyCode == 40) && !a.ctrlKey && !a.shiftKey && !a.altKey) { + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + a.cancelBubble = true; + l._keyOnUpDown(a.keyCode == 38 ? -1 : 1); + } + if (a.keyCode == 113) { + if (!l._isListVisible()) { + l._showList(); + if (l.base.firstChild.value == l.conf.last_text) { + l._setSelected(l.conf.last_selected, true, true); + l.base.firstChild.value = l.conf.last_text; + l.conf.f_server_last = l.base.firstChild.value.toLowerCase(); + } else { + l.conf.f_server_last = l.base.firstChild.value.toLowerCase(); + if (l.conf.f_mode == false) { + l._checkForMatch(); + } + } + } else { + } + } + if (a.keyCode == 27) { + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + a.cancelBubble = true; + l._cancelSelect(); + } + if (a.keyCode == 13) { + if (a.preventDefault) { + a.preventDefault(); + } + l._confirmSelect("kbd"); + } + if (l.conf.ro_mode == true && ((a.keyCode >= 48 && a.keyCode <= 57) || (a.keyCode >= 65 && a.keyCode <= 90))) { + l._searchRO(String.fromCharCode(a.keyCode).toLowerCase()); + a.cancelBubble = true; + } + l.conf.clear_key = true; + l.callEvent("onKeyPressed", [a.keyCode || a.charCode]); + }; + this._doOnInputKeyPress = function (a) { + if (l.conf.clear_key) { + l.conf.clear_key = false; + return; + } + a = a || event; + l.callEvent("onKeyPressed", [a.keyCode || a.charCode]); + }; + this._keyOnUpDown = function (a) { + var s = null; + if (this.conf.last_hover) { + s = this.t[this.conf.last_hover].item; + } else { + if (this.conf.last_selected) { + s = this.t[this.conf.last_selected].item; + } + } + if (!s && this._getListVisibleCount() == 0) { + return; + } + if (s != null && s.style.display != "") { + s = null; + } + this._showList(); + if (s != null) { + if (this.t[s._optId].obj.isSelected(s)) { + s = this._getNearItem(s, a); + } + } else { + s = this.list.firstChild; + if (s.style.display != "") { + s = this._getNearItem(s, 1); + } + } + if (s == null) { + return; + } + this._setSelected(s._optId, true, true); + if (this.conf.f_mode == false) { + this.base.firstChild.value = this.t[s._optId].obj.getText(s, true); + } else { + var u = String(this.t[s._optId].obj.getText(s, true)); + if (this.conf.f_mode == "start" && this.conf.f_ac == true) { + if (u.toLowerCase().indexOf(this.conf.f_server_last) === 0) { + this.conf.f_ac_text = u.substring(this.conf.f_server_last.length, u.length); + this.base.firstChild.value = u; + this._selectRange(this.conf.f_server_last.length, this.base.firstChild.value.length); + } else { + this.base.firstChild.value = u; + this.conf.f_server_last = this.base.firstChild.value.toLowerCase(); + this._selectRange(0, this.base.firstChild.value.length); + } + } else { + this.base.firstChild.value = u; + this.conf.f_server_last = this.base.firstChild.value.toLowerCase(); + } + } + s = null; + }; + this.conf.evs_nodes = [ + { node: document.body, evs: { mousedown: "_doOnBodyMouseDown" } }, + { node: this.base, evs: { mousedown: "_doOnBaseMouseDown" } }, + { node: this.base.firstChild, evs: { keyup: "_doOnInputKeyUp", keydown: "_doOnInputKeyDown", keypress: "_doOnInputKeyPress", focus: "_doOnInputFocus", blur: "_doOnInputBlur" } }, + { node: this.list, evs: { mousemove: "_doOnListMouseMove", mousedown: "_doOnListMouseDown", mouseup: "_doOnListMouseUp", mouseout: "_doOnListMouseOut" } }, + ]; + for (var c = 0; c < this.conf.evs_nodes.length; c++) { + for (var n in this.conf.evs_nodes[c].evs) { + if (typeof window.addEventListener == "function") { + this.conf.evs_nodes[c].node.addEventListener(n, this[this.conf.evs_nodes[c].evs[n]], false); + } else { + this.conf.evs_nodes[c].node.attachEvent("on" + n, this[this.conf.evs_nodes[c].evs[n]]); + } + } + } + this.unload = function () { + this.clearAll(); + this.t = null; + for (var u = 0; u < this.conf.evs_nodes.length; u++) { + for (var s in this.conf.evs_nodes[u].evs) { + if (typeof window.addEventListener == "function") { + this.conf.evs_nodes[u].node.removeEventListener(s, this[this.conf.evs_nodes[u].evs[s]], false); + } else { + this.conf.evs_nodes[u].node.detachEvent("on" + s, this[this.conf.evs_nodes[u].evs[s]]); + } + this.conf.evs_nodes[u].evs[s] = null; + delete this.conf.evs_nodes[u].evs[s]; + } + this.conf.evs_nodes[u].node = null; + this.conf.evs_nodes[u].evs = null; + delete this.conf.evs_nodes[u].node; + delete this.conf.evs_nodes[u].evs; + this.conf.evs_nodes[u] = null; + } + window.dhx4._eventable(this, "clear"); + window.dhx4._enableDataLoading(this, null, null, null, "clear"); + this._mcDetachHeader(); + this.DOMelem_input = this.DOMelem_button = this.DOMlist = this.DOMelem = this.DOMParent = null; + for (var s in this.conf) { + this.conf[s] = null; + delete this.conf[s]; + } + this.conf = null; + if (typeof window.addEventListener == "function") { + this.list.removeEventListener("scroll", this._doOnListScroll, false); + } else { + this.list.detachEvent("onscroll", this._doOnListScroll); + } + this.base.parentNode.removeChild(this.base); + this.list.parentNode.removeChild(this.list); + this.base = this.list = this.cont = null; + this.modes = null; + for (var s in this) { + if (typeof this[s] == "function") { + this[s] = null; + } + } + l = null; + }; + this.DOMelem_input = this.base.firstChild; + this.DOMelem_button = this.base.childNodes[this.base.childNodes.length - (this.conf.combo_image ? 2 : 1)]; + this.DOMlist = this.list; + this.DOMelem = this.base; + this.DOMParent = j; + j = null; + if (g != null) { + if (g.filter != null) { + if (typeof g.filter == "string") { + this.enableFilteringMode(true, g.filter, window.dhx4.s2b(g.filter_cache), window.dhx4.s2b(g.filter_sub_load)); + } else { + this.enableFilteringMode(true); + } + } + if (g.image_path != null) { + this.setImagePath(g.image_path); + } + if (g.default_image != null || g.default_image_dis != null) { + this.setDefaultImage(g.default_image, g.default_image_dis); + } + if (g.items || g.options) { + this.addOption(g.items || g.options); + } + if (g.xml || g.json) { + this.load(g.xml || g.json); + } + if (typeof g.readonly != "undefined") { + this.readonly(g.readonly); + } + g = null; + } + return this; +} +function dhtmlXComboFromSelect(e) { + if (typeof e == "string") { + e = document.getElementById(e); + } + var c = e.offsetWidth; + var o = e.getAttribute("name") || null; + var g = document.createElement("SPAN"); + e.parentNode.insertBefore(g, e); + var j = e.getAttribute("mode") || e.getAttribute("opt_type") || "option"; + var h = new dhtmlXCombo(g, o, c, j); + g = null; + var m = e.getAttribute("imagePath"); + if (m) { + h.setImagePath(m); + } + var n = e.getAttribute("defaultImage"); + var l = e.getAttribute("defaultImageDis"); + if (window.dhx4.s2b(l) == true) { + l = true; + } + if (n != null || l != null) { + h.setDefaultImage(n, l); + } + var a = h._xmlToObj([e], true, e.selectedIndex); + if (a.options.length > 0) { + h.addOption(a.options); + } + a = null; + e.parentNode.removeChild(e); + e = null; + return h; +} +dhtmlXCombo.prototype.setName = function (a) { + this.conf.form_name = a; + this.base.childNodes[1].name = a; + this.base.childNodes[2].name = a.replace(/(\[.*)?$/, "_new_value$1"); +}; +dhtmlXCombo.prototype.readonly = function (a) { + if (window.dhx4.s2b(a)) { + this.base.firstChild.setAttribute("readOnly", "true"); + this.conf.ro_mode = true; + } else { + this.base.firstChild.removeAttribute("readOnly"); + this.conf.ro_mode = false; + } +}; +dhtmlXCombo.prototype.setPlaceholder = function (a) { + if (typeof a == "undefined" || a == null) { + a = ""; + } + this.base.firstChild.setAttribute("placeholder", String(a)); +}; +dhtmlXCombo.prototype.setTemplate = function (e) { + for (var c in e) { + if (typeof this.conf.template[c] != "undefined") { + this.conf.template[c] = String(e[c]); + } + } + if (e.columns != null) { + this._mcMakeTemplate(e.columns); + } else { + this._mcDetachHeader(); + } + for (var c in this.t) { + this.t[c].obj.setText(this.t[c].item, this.t[c].item._conf.text); + } + this._confirmSelect(); +}; +dhtmlXCombo.prototype.setSkin = function (a) { + if (a == this.conf.skin) { + return; + } + this.conf.skin = a; + this.base.className = "dhxcombo_" + this.conf.skin + (this.conf.enabled ? "" : " dhxcombo_disabled"); + this.list.className = "dhxcombolist_" + this.conf.skin + (this.hdr != null ? " dhxcombolist_multicolumn" : ""); + if (this.hdr != null) { + this.hdr.className = "dhxcombolist_" + this.conf.skin + " dhxcombolist_hdr"; + } +}; +dhtmlXCombo.prototype.getInput = function () { + return this.base.firstChild; +}; +dhtmlXCombo.prototype.getButton = function () { + return this.base.childNodes[this.base.childNodes.length - (this.conf.combo_image ? 2 : 1)]; +}; +dhtmlXCombo.prototype.getList = function () { + return this.list; +}; +dhtmlXCombo.prototype.getBase = function () { + return this.base; +}; +dhtmlXCombo.prototype.getParent = function () { + return this.DOMParent; +}; +dhtmlXCombo.prototype.forEachOption = function (a) { + for (var c = 0; c < this.list.childNodes.length; c++) { + a.apply(window, [this._getOption(this.list.childNodes[c]._optId, c)]); + } +}; +dhtmlXCombo.prototype.setFocus = function () { + if (this.conf.enabled) { + this.base.firstChild.focus(); + } +}; +dhtmlXCombo.prototype.setFontSize = function (a, c) { + if (a != null) { + this.base.firstChild.style.fontSize = a; + } + if (c != null) { + this.list.style.fontSize = c; + } +}; +dhtmlXCombo.prototype.getOption = function (h) { + var j = null; + var e = null; + for (var g = 0; g < this.list.childNodes.length; g++) { + if (j == null) { + var c = this.list.childNodes[g]._optId; + if (this.t[c].obj.getValue(this.t[c].item) == h) { + j = c; + e = g; + } + } + } + return j == null ? null : this._getOption(j, e); +}; +dhtmlXCombo.prototype.getOptionByIndex = function (a) { + if (a < 0) { + return null; + } + if (this.list.childNodes[a] == null) { + return null; + } + return this._getOption(this.list.childNodes[a]._optId, a); +}; +dhtmlXCombo.prototype.getOptionByLabel = function (h) { + var j = null; + var e = null; + for (var g = 0; g < this.list.childNodes.length; g++) { + if (j == null) { + var c = this.list.childNodes[g]._optId; + if (this.t[c].obj.getText(this.t[c].item, true) == h) { + j = c; + e = g; + } + } + } + return j == null ? null : this._getOption(j, e); +}; +dhtmlXCombo.prototype.getSelectedIndex = function () { + return this._getOptionProp(this.conf.last_selected, "index", -1); +}; +dhtmlXCombo.prototype.getSelectedText = function () { + return this._getOptionProp(this.conf.last_selected, "text", ""); +}; +dhtmlXCombo.prototype.getSelectedValue = function () { + return this._getOptionProp(this.conf.last_selected, "value", null); +}; +dhtmlXCombo.prototype.getActualValue = function () { + return this.base.childNodes[1].value; +}; +dhtmlXCombo.prototype.getComboText = function () { + return this.base.childNodes[0].value; +}; +dhtmlXCombo.prototype.getIndexByValue = function (c) { + var a = this.getOption(c); + return a != null ? a.index : -1; +}; +dhtmlXCombo.prototype.setComboText = function (a) { + if (this.conf.allow_free_text != true) { + return; + } + this.unSelectOption(); + this.conf.last_text = this.base.firstChild.value = a; + this.conf.f_server_last = this.base.firstChild.value.toLowerCase(); +}; +dhtmlXCombo.prototype.setComboValue = function (c) { + var a = this.getOption(c); + if (a != null) { + this.selectOption(a.index); + } else { + this.conf.last_value = c; + this.base.childNodes[1].value = this.conf.last_value; + this.base.childNodes[2].value = "true"; + } +}; +dhtmlXCombo.prototype.selectOption = function (c, e, a) { + if (c < 0 || c >= this.list.childNodes.length) { + return; + } + var g = this.list.childNodes[c]._optId; + this._setSelected(g, this._isListVisible(), true); + this._confirmSelect("script"); +}; +dhtmlXCombo.prototype.unSelectOption = function () { + if (this.conf.last_hover != null) { + this.t[this.conf.last_hover].obj.setSelected(this.t[this.conf.last_hover].item, false); + this.conf.last_hover = null; + } + this.base.firstChild.value = ""; + if (this.conf.f_mode != false) { + this._filterOpts(true); + } + this._hideList(); + this._updateTopImage(null); + this._confirmSelect("script"); +}; +dhtmlXCombo.prototype.confirmValue = function () { + this._confirmSelect("script"); +}; +dhtmlXCombo.prototype.enable = function (a) { + a = typeof a == "undefined" ? true : window.dhx4.s2b(a); + if (this.conf.enabled == a) { + return; + } + this.conf.enabled = a; + if (a) { + this.base.className = "dhxcombo_" + this.conf.skin; + this.base.firstChild.removeAttribute("disabled"); + } else { + this._hideList(); + this.base.className = "dhxcombo_" + this.conf.skin + " dhxcombo_disabled"; + this.base.firstChild.setAttribute("disabled", "true"); + } + this._updateTopImage(this.conf.last_selected); +}; +dhtmlXCombo.prototype.disable = function (a) { + a = typeof a == "undefined" ? true : window.dhx4.s2b(a); + this.enable(!a); +}; +dhtmlXCombo.prototype.isEnabled = function () { + return this.conf.enabled == true; +}; +dhtmlXCombo.prototype.show = function (a) { + if (typeof a == "undefined") { + a = true; + } else { + a = window.dhx4.s2b(a); + } + this.base.style.display = a == true ? "" : "none"; +}; +dhtmlXCombo.prototype.hide = function (a) { + if (typeof a == "undefined") { + a = true; + } + this.show(!a); +}; +dhtmlXCombo.prototype.isVisible = function () { + return this.base.style.display == ""; +}; +dhtmlXCombo.prototype.setFilterHandler = function (a) { + if (typeof a == "function") { + this.conf.f_func = a; + this.conf.f_mode = true; + this.conf.f_dyn = this.conf.f_cache = this.conf.f_url = null; + } else { + if (typeof a == "string" && typeof window[a] == "function") { + this.conf.f_func = window[a]; + this.conf.f_mode = true; + this.conf.f_dyn = this.conf.f_cache = this.conf.f_url = null; + } else { + this.conf.f_func = null; + } + } +}; +dhtmlXCombo.prototype.enableFilteringMode = function (g, c, a, e) { + if (g == true || g == "between") { + this.conf.f_mode = g == true ? "start" : "between"; + if (c != null) { + this.conf.f_url = c; + this.conf.f_cache = window.dhx4.s2b(a); + this.conf.f_dyn = window.dhx4.s2b(e); + } else { + this.conf.f_url = null; + this.conf.f_cache = false; + this.conf.f_dyn = false; + } + } else { + this.conf.f_mode = false; + this.conf.f_url = null; + this.conf.f_cache = false; + this.conf.f_dyn = false; + } +}; +dhtmlXCombo.prototype.filter = function (e, a) { + for (var g = 0; g < this.list.childNodes.length; g++) { + var c = e.apply(window, [this._getOption(this.list.childNodes[g]._optId, g)]); + this.list.childNodes[g].style.display = c === true ? "" : "none"; + } + if (typeof a == "undefined" || a == true) { + this._showList(true); + } +}; +dhtmlXCombo.prototype.sort = function (e) { + var a = []; + for (var c = 0; c < this.list.childNodes.length; c++) { + var g = this.list.childNodes[c]._optId; + a.push([g, this._getOption(g, c)]); + } + if (e == "asc" || e == "desc") { + k = true; + a.sort(function (j, h) { + j = j[1].text_option.toLowerCase(); + h = h[1].text_option.toLowerCase(); + var l = e == "asc" ? 1 : -1; + return j > h ? l : -1 * l; + }); + } else { + if (typeof e == "function" || typeof window[e] == "function") { + if (typeof window[e] == "function") { + e = window[e]; + } + a.sort(function (j, h) { + return e.apply(window, [j[1], h[1]]); + }); + } + } + while (this.list.childNodes.length > 0) { + this.list.removeChild(this.list.lastChild); + } + for (var c = 0; c < a.length; c++) { + this.list.appendChild(this.t[a[c][0]].item); + } +}; +dhtmlXCombo.prototype.enableAutocomplete = function (a) { + if (typeof a == "undefined") { + a = true; + } else { + a = window.dhx4.s2b(a); + } + this.conf.f_ac = a; +}; +dhtmlXCombo.prototype.disableAutocomplete = function (a) { + if (typeof a == "undefined") { + a = true; + } else { + a = window.dhx4.s2b(a); + } + this.enableAutocomplete(!a); +}; +dhtmlXCombo.prototype.allowFreeText = function (a) { + this.conf.allow_free_text = typeof a == "undefined" ? true : window.dhx4.s2b(a); +}; +dhtmlXCombo.prototype._checkForMatch = function (g) { + var a = window.dhx4.trim(this.base.firstChild.value).toLowerCase(); + var h = null; + var c = this.list.firstChild; + while (c != null) { + if (c.style.display == "" && c._optId != null) { + var e = window.dhx4.trim(this.t[c._optId].obj.getText(c, true)).toLowerCase(); + if (a == e) { + h = c._optId; + c = null; + } + } + if (c != null) { + c = c.nextSibling; + } + } + if (this.conf.last_match == null) { + if (h != null) { + this._setSelected(h, true, true); + this.conf.last_match = h; + } else { + if (this.conf.f_mode != "between" || g == true) { + this._setSelected(null, true, true); + this.conf.last_match = null; + } + } + } else { + if (h != null) { + if (h != this.conf.last_match) { + this._setSelected(h, true, true); + this.conf.last_match = h; + } + } else { + this._setSelected(null, true, true); + this.conf.last_match = null; + } + } +}; +dhtmlXCombo.prototype._selectRange = function (c, a) { + if (this.conf.combo_focus == true) { + window.dhx4.selectTextRange(this.base.firstChild, c, a); + } +}; +dhtmlXCombo.prototype.openSelect = function () { + if (!this._isListVisible()) { + this._showList(); + } +}; +dhtmlXCombo.prototype.closeAll = function () { + this._hideList(); +}; +dhtmlXCombo.prototype._showList = function (a) { + if (this._getListVisibleCount() == 0) { + if (a && this._isListVisible()) { + this._hideList(); + } + return; + } + if (this._isListVisible()) { + this._checkListHeight(); + return; + } + this.list.style.zIndex = window.dhx4.zim.reserve(this.conf.list_zi_id); + if (this.hdr != null) { + this.hdr.style.zIndex = Number(this.list.style.zIndex) + 1; + } + this.list.style.visibility = "hidden"; + this.list.style.display = ""; + if (this.hdr != null) { + this.hdr.style.visibility = this.list.style.visibility; + this.hdr.style.display = this.list.style.display; + } + var c = this.hdr != null ? this.hdr.offsetHeight : 0; + this.list.style.width = Math.max(this.conf.opts_width || this.conf.col_w || 0, this.conf.combo_width) + "px"; + this.list.style.top = window.dhx4.absTop(this.base) + c + this.base.offsetHeight - 1 + "px"; + this.list.style.left = window.dhx4.absLeft(this.base) + "px"; + if (this.hdr != null) { + this.hdr.style.width = this.list.style.width; + this.hdr.style.left = this.list.style.left; + this.hdr.style.top = parseInt(this.list.style.top) - c + "px"; + } + this._checkListHeight(); + this.list.style.visibility = "visible"; + if (this.hdr != null) { + this.hdr.style.visibility = "visible"; + } + this.callEvent("onOpen", []); +}; +dhtmlXCombo.prototype._hideList = function () { + if (!this._isListVisible()) { + return; + } + window.dhx4.zim.clear(this.conf.list_zi_id); + this.list.style.display = "none"; + if (this.hdr != null) { + this.hdr.style.display = "none"; + } + this.conf.clear_click = false; + this.callEvent("onClose", []); +}; +dhtmlXCombo.prototype._isListVisible = function () { + return this.list.style.display == ""; +}; +dhtmlXCombo.prototype._getListVisibleCount = function () { + var a = 0; + for (var c = 0; c < this.list.childNodes.length; c++) { + a += this.list.childNodes[c].style.display == "" ? 1 : 0; + } + return a; +}; +dhtmlXCombo.prototype._checkListHeight = function () { + if (!this._isListVisible()) { + return; + } + if (this.conf.item_h == null) { + var o = this.list.firstChild; + while (o != null) { + if (o.style.display == "") { + this.conf.item_h = o.offsetHeight + (this.hdr != null ? -1 : 0); + o = null; + } else { + o = o.nextSibling; + } + } + o = null; + } + var r = window.dhx4.screenDim(); + var l = window.dhx4.absTop(this.base); + var c = this.base.offsetHeight; + var a = this.hdr != null ? this.hdr.offsetHeight : 0; + var e = Math.max(0, Math.floor((l + a - r.top) / this.conf.item_h)); + var n = Math.max(0, Math.floor((r.bottom - (l + c + a)) / this.conf.item_h)); + var u = this._getListVisibleCount(); + if (n < Math.min(this.conf.opts_count_min, u) && e > n) { + n = null; + } + var m = Math.min(n == null ? e : n, this.conf.opts_count, u); + var g = m < u ? m * this.conf.item_h + "px" : ""; + var j = this.conf.sp[this.conf.skin][this.hdr != null ? "hdr_ofs" : "list_ofs"]; + this.list.style.height = g; + this.list.style.top = (n == null ? l - this.list.offsetHeight + j : l + c + a - j) + "px"; + if (this.hdr != null) { + this.hdr.style.top = (n == null ? l - a - this.list.offsetHeight + j : l + c - j) + "px"; + } +}; +dhtmlXCombo.prototype._scrollToItem = function (h) { + var g = this.t[h].item.offsetTop; + var e = g + this.t[h].item.offsetHeight; + var c = this.list.scrollTop; + var a = c + this.list.clientHeight; + if (g < c) { + this.list.scrollTop = g + (this.hdr != null ? 1 : 0); + } else { + if (e > a) { + this.list.scrollTop = e - this.list.clientHeight + (this.hdr != null ? -this.conf.sp[this.conf.skin].scr_ofs : 0); + } + } +}; +dhtmlXCombo.prototype._setSelected = function (e, c, a) { + if (a) { + this._updateTopImage(e); + } + if (e != null && this.conf.last_hover == e) { + if (c) { + this._scrollToItem(e); + } + return; + } + if (this.conf.last_hover != null) { + this.t[this.conf.last_hover].obj.setSelected(this.t[this.conf.last_hover].item, false); + this.conf.last_hover = null; + if (e == null) { + this.callEvent("onSelectionChange", []); + } + } + if (e != null) { + this.t[e].obj.setSelected(this.t[e].item, true); + this.conf.last_hover = e; + this.callEvent("onSelectionChange", []); + if (this.conf.s_mode == "select" && this.t[e].item == this.t[e].item.parentNode.lastChild) { + this._subloadRequest(); + } + if (c) { + this._scrollToItem(e); + } + } +}; +dhtmlXCombo.prototype._subloadRequest = function () { + if (this.conf.f_url != null && this.conf.f_dyn == true && this.conf.f_dyn_end == false) { + var e = "mask=" + encodeURIComponent(this.conf.f_mask) + "&pos=" + this.list.childNodes.length; + var a = this; + var c = function (h) { + if (a.conf.f_cache) { + a.conf.f_cache_data[a.conf.f_mask].data.push(h.xmlDoc.responseXML); + } + var g = a.list.childNodes.length; + a.conf.f_loading = true; + a.load(h.xmlDoc.responseXML); + a.conf.f_loading = false; + if (g == a.list.childNodes.length) { + a.conf.f_dyn_end = true; + if (a.conf.f_cache) { + a.conf.f_cache_data[a.conf.f_mask].dyn_end = true; + } + } + c = a = null; + }; + if (window.dhx4.ajax.method == "post") { + window.dhx4.ajax.post(this.conf.f_url, e, c); + } else { + if (window.dhx4.ajax.method == "get") { + window.dhx4.ajax.get(this.conf.f_url + (String(this.conf.f_url).indexOf("?") >= 0 ? "&" : "?") + e, c); + } + } + } +}; +dhtmlXCombo.prototype.addOption = function (j, l, c, a, g) { + var e = null; + if (!(j instanceof Array)) { + var m = this._renderOption({ value: j, text: l, css: c, img: a }); + if (e == null && window.dhx4.s2b(g) == true) { + e = m; + } + } else { + for (var h = 0; h < j.length; h++) { + if (typeof j[h] == "undefined") { + continue; + } + if (j[h] instanceof Array) { + m = this._renderOption({ value: j[h][0], text: j[h][1], css: j[h][2], img: j[h][3] }); + if (e == null && window.dhx4.s2b(j[h][4]) == true) { + e = m; + } + } else { + var m = this._renderOption(j[h]); + if (e == null && window.dhx4.s2b(j[h].selected) == true) { + e = m; + } + } + } + } + if (e != null) { + this._setSelected(e, this._isListVisible(), true); + this._confirmSelect("onInit"); + } +}; +dhtmlXCombo.prototype.updateOption = function (a, e, c, g) { + var h = this._getOptionId(a); + if (h == null) { + return; + } + this.t[h].obj.update(this.t[h].item, { value: e, text: c, css: g }); + if (this.conf.last_selected == h) { + this.conf.last_text = this.base.firstChild.value = this.t[h].obj.getText(this.t[h].item, true); + this.conf.f_server_last = this.base.firstChild.value.toLowerCase(); + } +}; +dhtmlXCombo.prototype.deleteOption = function (g) { + for (var c in this.t) { + var e = this.t[c].obj.getValue(this.t[c].item); + if (e == g) { + this._removeOption(c); + } + } + if (this._isListVisible()) { + this._showList(true); + } +}; +dhtmlXCombo.prototype.clearAll = function (c) { + c = typeof c == "undefined" ? true : window.dhx4.s2b(c); + for (var e in this.t) { + this._removeOption(e); + } + if (this.conf.tm_hover) { + window.clearTimeout(this.conf.tm_hover); + } + this.conf.last_hover = null; + this.conf.last_selected = null; + this.list.scrollTop = 0; + if (c == true) { + this._hideList(); + } +}; +dhtmlXCombo.prototype._renderOption = function (g) { + var h = window.dhx4.newId(); + var e = document.createElement("DIV"); + e._optId = h; + e._tpl = this.conf.template; + if (typeof g.img == "undefined" && typeof g.img_src != "undefined") { + g.img = g.img_src; + delete g.img_src; + } + if (typeof g.img_dis == "undefined" && typeof g.img_src_dis != "undefined") { + g.img_dis = g.img_src_dis; + delete g.img_src_dis; + } + g.img_path = this.conf.img_path; + g.img_def = this.conf.img_def; + g.img_def_dis = this.conf.img_def_dis; + this.list.appendChild(e); + var c = this._isListVisible() && window.dhx4.isFF == true; + if (c == true) { + var a = this.list.scrollTop; + this.list.scrollTop -= 1; + } + if (this.hdr != null) { + g.multicol = true; + } + this.t[e._optId] = { obj: this.modes[this.conf.opts_type].render(e, g), item: e, conf: { type: this.conf.opts_type } }; + e = null; + if (c == true) { + this.list.scrollTop += 1; + } + return h; +}; +dhtmlXCombo.prototype._removeOption = function (a) { + this.t[a].obj.destruct(this.t[a].item); + this.t[a].obj = null; + this.t[a].item.parentNode.removeChild(this.t[a].item); + this.t[a].item = null; + this.t[a].conf = null; + this.t[a] = null; + delete this.t[a]; + if (this.conf.last_hover == a) { + this.conf.last_hover = null; + } + if (this.conf.last_selected == a) { + this.conf.last_selected = null; + this._confirmSelect("onDelete"); + } +}; +dhtmlXCombo.prototype._confirmSelect = function (e, a) { + var c = false; + if (typeof a == "undefined") { + a = true; + } + if (this.conf.f_server_tm) { + window.clearTimeout(this.conf.f_server_tm); + } + if (this.conf.last_hover != null) { + c = c || this.conf.last_value != this._getOptionValue(this.conf.last_hover); + this.conf.last_match = this.conf.last_selected = this.conf.last_hover; + this.conf.last_value = this._getOptionValue(this.conf.last_selected); + this.conf.last_text = this.base.firstChild.value = this.t[this.conf.last_selected].obj.getText(this.t[this.conf.last_selected].item, true); + this.conf.f_server_last = this.base.firstChild.value.toLowerCase(); + this.base.childNodes[1].value = this.conf.last_value; + this.base.childNodes[2].value = "false"; + } else { + if (this.conf.allow_free_text || (this.base.firstChild.value == "" && this.conf.allow_empty_value)) { + c = c || this.conf.last_text != this.base.firstChild.value; + this.conf.last_match = this.conf.last_value = this.conf.last_selected = null; + this.conf.last_text = this.base.firstChild.value; + this.conf.f_server_last = this.base.firstChild.value.toLowerCase(); + this.base.childNodes[1].value = this.conf.last_text; + this.base.childNodes[2].value = "true"; + } else { + this._cancelSelect(); + this._updateTopImage(this.conf.last_selected); + return; + } + } + if (this.conf.f_ac && this.conf.f_mode == "start") { + this.conf.f_ac_text = ""; + if (e != "blur") { + this._selectRange(this.base.firstChild.value.length, this.base.firstChild.value.length); + } + } + if (a) { + this._hideList(); + } + if (c == true && e != "onInit" && e != "onDelete") { + this.callEvent("onChange", [this.conf.last_value, this.conf.last_text]); + } +}; +dhtmlXCombo.prototype._cancelSelect = function () { + this._hideList(); + this.base.firstChild.value = this.conf.last_text; + if (this.conf.f_mode != false) { + this._filterOpts(true); + } +}; +dhtmlXCombo.prototype._getOption = function (l, g) { + if (!this.t[l]) { + return null; + } + if (typeof g == "undefined") { + g = -1; + } + if (g < 0) { + for (var j = 0; j < this.list.childNodes.length; j++) { + if (g < 0 && this.list.childNodes[j]._optId == l) { + g = j; + } + } + } + var h = { + value: this.t[l].obj.getValue(this.t[l].item), + text: this.t[l].obj.getText(this.t[l].item), + text_input: this.t[l].obj.getText(this.t[l].item, true), + text_option: this.t[l].obj.getText(this.t[l].item, null, true), + css: this.t[l].obj.getCss(this.t[l].item), + selected: l == this.conf.last_selected, + index: g, + }; + if (typeof this.t[l].obj.getExtraData == "function") { + var e = this.t[l].obj.getExtraData(this.t[l].item); + for (var c in e) { + if (typeof h[c] == "undefined") { + h[c] = e[c]; + } + } + } + return h; +}; +dhtmlXCombo.prototype._getOptionProp = function (g, e, c) { + if (g != null) { + var a = this._getOption(g); + if (a != null) { + return a[e]; + } + } + return c; +}; +dhtmlXCombo.prototype._getOptionId = function (c) { + var g = null; + for (var a = 0; a < this.list.childNodes.length; a++) { + if (g == null) { + var e = this.list.childNodes[a]._optId; + if (c == this.t[e].obj.getValue(this.t[e].item)) { + g = e; + } + } + } + return g; +}; +dhtmlXCombo.prototype._getOptionValue = function (a) { + return this._getOptionProp(a, "value", null); +}; +dhtmlXCombo.prototype.setSize = function (a) { + this.conf.combo_width = parseInt(a) - (dhx4.isFF || dhx4.isIE || dhx4.isChrome || dhx4.isOpera ? 2 : 0); + this.base.style.width = Math.max(0, this.conf.combo_width) + "px"; + this._adjustBase(); +}; +dhtmlXCombo.prototype._adjustBase = function () { + this.base.firstChild.style.width = Math.max(0, this.conf.combo_width - 24 - (this.conf.combo_image ? 23 : 0)) + "px"; + this.base.firstChild.style.marginLeft = this.conf.combo_image ? "23px" : "0px"; +}; +dhtmlXCombo.prototype.setOptionWidth = function (a) { + this.conf.opts_width = parseInt(a) || null; +}; +dhtmlXCombo.prototype.setOptionIndex = function (e, a) { + if (isNaN(a) || a < 0) { + return; + } + var g = this.getOption(e); + if (g == null) { + return; + } + if (a == g.index) { + return; + } + var c = this.list.childNodes[g.index]; + c.parentNode.removeChild(c); + if (this.list.childNodes[a] != null) { + this.list.insertBefore(c, this.list.childNodes[a]); + } else { + this.list.appendChild(c); + } + c = null; +}; +dhtmlXCombo.prototype.getOptionsCount = function () { + return this.list.childNodes.length; +}; +dhtmlXCombo.prototype._mcMakeTemplate = function (n) { + var j = ""; + var g = ""; + this.conf.col_w = 0; + for (var l = 0; l < n.length; l++) { + var a = Number(parseInt(n[l].width) || 50); + var e = n[l].css || ""; + var m = l == 0 && window.dhx4.isIE6 == true ? "_first" : ""; + g += "
" + (n[l].option || " ") + "
"; + j += "
" + (n[l].header || " ") + "
"; + this.conf.col_w += a + 1; + } + var a = 500; + var c = document.createElement("DIV"); + c.style.position = "absolute"; + c.style.top = "10px"; + c.style.left = -a * 2 + "px"; + c.style.width = a + "px"; + c.style.height = "50px"; + c.style.overflowY = "scroll"; + c.innerHTML = "
 
"; + document.body.appendChild(c); + this.conf.col_w += a - c.firstChild.offsetWidth + 10; + c.parentNode.removeChild(c); + c = null; + this.conf.template.option = g; + this._mcAttachHeader(j); + this.list.className += " dhxcombolist_multicolumn"; +}; +dhtmlXCombo.prototype._mcAttachHeader = function (a) { + if (this.hdr == null) { + this.hdr = document.createElement("DIV"); + this.hdr.className = "dhxcombolist_" + this.conf.skin + " dhxcombolist_hdr"; + this.hdr.style.display = "none"; + this.list.parentNode.insertBefore(this.hdr, this.list); + if (typeof window.addEventListener == "function") { + this.hdr.addEventListener("mousedown", this._doOnListMouseDown, false); + } else { + this.hdr.attachEvent("onmousedown", this._doOnListMouseDown); + } + if (this.conf.opts_type == "checkbox" && this.conf.combo_image == true) { + this.conf.combo_image = false; + if (this.base.lastChild.className.match(/dhxcombo_top_image/) != null) { + this.base.removeChild(this.base.lastChild); + } + this._adjustBase(); + } + } + this.hdr.innerHTML = "
" + a + "
"; +}; +dhtmlXCombo.prototype._mcDetachHeader = function () { + if (this.hdr != null) { + if (typeof window.addEventListener == "function") { + this.hdr.removeEventListener("mousedown", this._doOnListMouseDown, false); + } else { + this.hdr.detachEvent("onmousedown", this._doOnListMouseDown); + } + this.hdr.parentNode.removeChild(this.hdr); + this.hdr = null; + } + this.conf.col_w = null; + this.conf.item_h = null; +}; +dhtmlXCombo.prototype.modes = {}; +dhtmlXCombo.prototype.doWithItem = function (a, l, h, e) { + var j = a >= 0 && a < this.list.childNodes.length ? this.list.childNodes[a]._optId : null; + if (j == null) { + return null; + } + if (typeof this.t[j].obj[l] != "function") { + return null; + } + var g = [this.t[j].item]; + for (var c = 2; c < arguments.length; c++) { + g.push(arguments[c]); + } + return this.t[j].obj[l].apply(this.t[j].obj, g); +}; +function dhtmlXComboExtend(g, e) { + for (var c in dhtmlXCombo.prototype.modes[e]) { + if (typeof dhtmlXCombo.prototype.modes[g][c] == "undefined") { + dhtmlXCombo.prototype.modes[g][c] = dhtmlXCombo.prototype.modes[e][c]; + } + } +} +dhtmlXCombo.prototype.modes.option = { + image: false, + html: false, + option_css: "dhxcombo_option_text", + render: function (a, c) { + a._conf = { value: c.value, css: "" }; + a.className = "dhxcombo_option"; + a.innerHTML = "
 
"; + if (c.css != null) { + a.lastChild.style.cssText = c.css; + a._conf.css = c.css; + } + this.setText(a, c.text); + return this; + }, + destruct: function (a) { + a._conf = null; + }, + update: function (a, c) { + a._conf.value = c.value; + a._conf.css = c.css; + a.lastChild.style.cssText = c.css; + this.setText(a, c.text); + }, + setText: function (c, e) { + c._conf.text = e; + var a = typeof e == "object" ? window.dhx4.template(c._tpl.option, this.replaceHtml(c._conf.text), true) : window.dhx4.trim(this.replaceHtml(c._conf.text) || ""); + c.lastChild.innerHTML = a.length == 0 ? " " : a; + }, + getText: function (e, a, c) { + if (window.dhx4.s2b(a) && typeof e._conf.text == "object") { + return window.dhx4.template(e._tpl.input, e._conf.text, true); + } + if (window.dhx4.s2b(c) && typeof e._conf.text == "object") { + return window.dhx4.template(e._tpl.option, e._conf.text, true); + } + return e._conf.text; + }, + getValue: function (a) { + return a._conf.value; + }, + getCss: function (a) { + return a._conf.css; + }, + setSelected: function (a, c) { + a.className = "dhxcombo_option" + (c ? " dhxcombo_option_selected" : ""); + }, + isSelected: function (a) { + return String(a.className).indexOf("dhxcombo_option_selected") >= 0; + }, + getExtraData: function (a) { + return { type: "option" }; + }, + replaceHtml: function (g) { + if (this.html == true) { + return g; + } + if (typeof g == "object") { + var e = {}; + for (var c in g) { + e[c] = this.replaceHtml(g[c]); + } + } else { + var e = g.replace(/[\<\>\&\s]/g, function (a) { + switch (a) { + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + case " ": + return " "; + } + return a; + }); + } + return e; + }, +}; +dhtmlXCombo.prototype.modes.checkbox = { + image: true, + html: true, + image_css: "dhxcombo_checkbox dhxcombo_chbx_#state#", + option_css: "dhxcombo_option_text dhxcombo_option_text_chbx", + render: function (a, c) { + if (this.image_css_regexp == null) { + this.image_css_regexp = new RegExp(this.image_css.replace("#state#", "\\d*")); + } + a._conf = { value: c.value, css: "", checked: window.dhx4.s2b(c.checked) }; + a.className = "dhxcombo_option"; + if (c.multicol == true) { + c.text.checkbox = "
 "; + a.innerHTML = "
"; + } else { + a.innerHTML = "
 
"; + } + if (c.css != null) { + a.lastChild.style.cssText += c.css; + a._conf.css = c.css; + } + this.setText(a, c.text); + return this; + }, + setChecked: function (c, e) { + c._conf.checked = window.dhx4.s2b(e); + var a = String(this.image_css).replace("#state#", c._conf.checked ? "1" : "0"); + this._changeChbxCss(c.childNodes, a); + }, + _changeChbxCss: function (a, c) { + for (var e = 0; e < a.length; e++) { + if (a[e].tagName != null && a[e].className != null && a[e].className.match(this.image_css_regexp) != null) { + a[e].className = c; + } else { + if (a[e].childNodes.length > 0) { + this._changeChbxCss(a[e].childNodes, c); + } + } + } + }, + isChecked: function (a) { + return a._conf.checked == true; + }, + getExtraData: function (a) { + return { type: "checkbox", checked: a._conf.checked }; + }, + optionClick: function (h, g, j) { + var e = true; + var c = g.target || g.srcElement; + while (e == true && c != null && c != h && c.className != null) { + if (c.className.match(this.image_css_regexp) != null) { + var a = [h._conf.value, !h._conf.checked]; + if (j.callEvent("onBeforeCheck", a) === true) { + this.setChecked(h, !this.isChecked(h)); + j.callEvent("onCheck", a); + } + e = false; + a = null; + } else { + c = c.parentNode; + } + } + c = j = h = null; + return e; + }, + getTopImage: function (c, a) { + return ""; + }, + topImageClick: function (a, c) { + return true; + }, +}; +dhtmlXComboExtend("checkbox", "option"); +dhtmlXCombo.prototype.setChecked = function (a, c) { + this.doWithItem(a, "setChecked", c); +}; +dhtmlXCombo.prototype.getChecked = function (a) { + var c = []; + for (var e = 0; e < this.list.childNodes.length; e++) { + if (this.isChecked(e)) { + c.push(this._getOptionProp(this.list.childNodes[e]._optId, "value", "")); + } + } + return c; +}; +dhtmlXCombo.prototype.isChecked = function (a) { + return this.doWithItem(a, "isChecked"); +}; +dhtmlXCombo.prototype.modes.image = { + image: true, + html: true, + image_css: "dhxcombo_image", + option_css: "dhxcombo_option_text dhxcombo_option_text_image", + render: function (a, c) { + a._conf = { value: c.value, css: "" }; + a.className = "dhxcombo_option"; + a.innerHTML = "
 
"; + if (c.css != null) { + a.lastChild.style.cssText += c.css; + a._conf.css = c.css; + } + this.setText(a, c.text); + this.setImage(a, c.img, c.img_dis, c.img_path, c.img_def, c.img_def_dis); + return this; + }, + update: function (a, c) { + a._conf.value = c.value; + a._conf.css = c.css; + a.lastChild.style.cssText = c.css; + this.setText(a, c.text); + this.setImage(a, c.img, c.img_dis, c.img_path, c.img_def, c.img_def_dis); + }, + setImage: function (e, a, h, j, g, c) { + if (a != null && a.length > 0) { + a = j + a; + } else { + if (g != null && g.length > 0) { + a = j + g; + } else { + a = null; + } + } + if (h != null && h.length > 0) { + h = j + h; + } else { + if (c != null && c.length > 0) { + h = j + c; + } else { + if (c == true) { + h = a; + } else { + h = null; + } + } + } + e._conf.img = a; + e._conf.img_dis = h; + e.firstChild.style.backgroundImage = a != null ? "url(" + a + ")" : "none"; + }, + getExtraData: function (a) { + return { type: "image" }; + }, + getTopImage: function (g, e) { + var c = e ? "img" : "img_dis"; + if (g != null && g._conf[c] != null) { + return "
"; + } + return ""; + }, +}; +dhtmlXComboExtend("image", "option"); +dhtmlXCombo.prototype.setDefaultImage = function (a, c) { + if (a != null) { + this.conf.img_def = a; + } + if (c != null) { + this.conf.img_def_dis = c; + } +}; +dhtmlXCombo.prototype.setImagePath = function (a) { + this.conf.img_path = a; +}; +function dhtmlXColorPicker(m) { + if (!(this instanceof dhtmlXColorPicker)) { + return new dhtmlXColorPicker(m); + } + dhx4._eventable(this); + var h = this, + g = undefined, + j = null, + e, + a, + c; + this._nodes = []; + this.activeNode = null; + this._inputListenerId = null; + this.base = null; + this._globalNode = null; + this.memory = null; + this.skin = null; + this.conf = { cp_id: dhx4.newId(), x: 0, y: 0, c: 0, indent: 2, position: "right", customColors: false, selectedColor: null, hide: false, hideOnSelect: false, lang: "en", closeable: true }; + this.value = { red: -1, blue: -1, green: -1, hue: -1, sat: -1, lum: -1 }; + this._initMoveSelection = function (l) { + l = l || event; + if (typeof window.addEventListener == "function") { + h._controllerNodes.colorArea.addEventListener("mousemove", h._setMoveSelection, false); + document.body.addEventListener("mouseup", h._cleanMoveSelection, false); + } else { + h._controllerNodes.colorArea.attachEvent("onmousemove", h._setMoveSelection); + document.body.attachEvent("onmouseup", h._cleanMoveSelection); + } + h._setMoveSelection(l, h._controllerNodes.colorArea); + return false; + }; + this._cleanMoveSelection = function () { + if (typeof window.removeEventListener == "function") { + h._controllerNodes.colorArea.removeEventListener("mousemove", h._setMoveSelection, false); + document.body.removeEventListener("mouseup", h._cleanMoveSelection, false); + } else { + h._controllerNodes.colorArea.detachEvent("onmousemove", h._setMoveSelection); + document.body.detachEvent("onmouseup", h._cleanMoveSelection); + } + return false; + }; + this._setMoveSelection = function (l) { + l = l || event; + var n = h._getOffsetPosition(l, h._controllerNodes.colorArea); + if (h._controllerNodes.fr_cover) { + setTimeout(function () { + h._setColorAreaXY(n.x, n.y); + h._setColorByXYC(); + }, 0); + } else { + h._setColorAreaXY(n.x, n.y); + h._setColorByXYC(); + } + return false; + }; + this._initMoveContrast = function (l) { + l = l || event; + if (typeof window.addEventListener == "function") { + document.body.addEventListener("mousemove", h._setMoveContrast, false); + document.body.addEventListener("mouseup", h._cleanMoveContrast, false); + } else { + document.body.attachEvent("onmousemove", h._setMoveContrast); + document.body.attachEvent("onmouseup", h._cleanMoveContrast); + } + h._setMoveContrast(l, h._controllerNodes.contrastArea); + }; + this._cleanMoveContrast = function () { + if (typeof window.removeEventListener == "function") { + document.body.removeEventListener("mousemove", h._setMoveContrast, false); + document.body.removeEventListener("mouseup", h._cleanMoveContrast, false); + } else { + document.body.detachEvent("onmousemove", h._setMoveContrast); + document.body.detachEvent("onmouseup", h._cleanMoveContrast); + } + }; + this._setMoveContrast = function (l) { + l = l || event; + var n = h._getOffsetPosition(l, h._controllerNodes.contrastArea); + h._setContrastY(n.y); + h._setColorByXYC(true); + }; + this._doOnSelectColor = function () { + var l = h.colorAIP.rgb2hex({ r: h.value.red, g: h.value.green, b: h.value.blue }); + if (h.activeNode != null) { + if (h.activeNode.valueCont) { + h.activeNode.valueCont.value = l; + } + if (h.activeNode.valueColor) { + h.activeNode.valueColor.style.backgroundColor = l; + } + } + if (h.base._dhx_remove || h.conf.hideOnSelect) { + h.hide(); + } + h.callEvent("onSelect", [l, h.activeNode ? h.activeNode.node : null]); + }; + this._doOnCancel = function () { + if (h.callEvent("onCancel", [h.activeNode ? h.activeNode.node : null]) == true && h.conf.closeable == true) { + h.hide(); + } + }; + this._doOnFocusByInput = function () { + var n = this != window ? this : event.srcElement; + var l = h.activeNode && h.activeNode.valueCont && h.activeNode.valueCont == n ? h.activeNode : h._getNodeByValueCont(n); + h.activeNode = l; + if (l && l == h.activeNode) { + h._initListenerInput(); + } + }; + this._doOnBlurByInput = function () { + var n = this != window ? this : event.srcElement; + var l = h.activeNode && h.activeNode.valueCont && h.activeNode.valueCont == n ? h.activeNode : h._getNodeByValueCont(n); + if (l && l == h.activeNode) { + h._removeListenerInput(); + } + }; + this._doOnClickByNode = function (n) { + n = n || event; + var l = this != window ? this : event.srcElement; + h.activeNode = h.activeNode.node != l ? h._getNodeByElement(l) : h.activeNode; + if (!h.isVisible()) { + h.show(); + } + }; + this.saveColor = function () { + h.memory.setValue(h.value); + }; + this._onSelectMemoryEl = function (n) { + var l; + h._refreshCoordinatesByHSL(n.value.hue, n.value.sat, n.value.lum); + for (l in n.value) { + h.value[l] = n.value[l]; + } + h._refreshContrast(); + h._refreshInputValues(); + h._refreshColorValue(); + }; + this._doOnClickByBody = function (o) { + o = o || event; + var l = true, + n = o.target || o.srcElement; + if (h._isBaseNode(n)) { + l = false; + } + if (l && h.activeNode && (h.activeNode.node == n || h.activeNode.valueCont == n)) { + l = false; + } + if (l) { + h.hide(); + } + }; + this._doOnChangeHSL = function () { + var o = parseInt(h._controllerNodes.hue.value), + n = parseInt(h._controllerNodes.sat.value), + l = parseInt(h._controllerNodes.lum.value), + r; + if (isNaN(o) || o > 359 || o < 0) { + h._controllerNodes.hue.value = h.value.hue; + } else { + h.value.hue = o; + } + if (isNaN(n) || n > 100 || n < 0) { + h._controllerNodes.sat.value = h.value.sat; + } else { + h.value.sat = n; + } + if (isNaN(l) || l > 100 || l < 0) { + h._controllerNodes.lum.value = h.value.lum; + } else { + h.value.lum = l; + } + r = h.colorAIP.hsl2rgb(h.value.hue, h.value.sat / 100, h.value.lum / 100); + h.value.red = Math.round(255 * r.r); + h.value.green = Math.round(255 * r.g); + h.value.blue = Math.round(255 * r.b); + h._refreshCoordinatesByHSL(h.value.hue, h.value.sat, h.value.lum); + h._refreshContrast(); + h._refreshInputValues(); + h._refreshColorValue(); + }; + this._doOnChangeRGB = function () { + var r = parseInt(h._controllerNodes.red.value), + o = parseInt(h._controllerNodes.green.value), + l = parseInt(h._controllerNodes.blue.value), + n; + if (isNaN(r) || r > 255 || r < 0) { + h._controllerNodes.red.value = h.value.red; + } else { + h.value.red = r; + } + if (isNaN(o) || o > 255 || o < 0) { + h._controllerNodes.green.value = h.value.green; + } else { + h.value.green = o; + } + if (isNaN(l) || l > 255 || l < 0) { + h._controllerNodes.blue.value = h.value.blue; + } else { + h.value.blue = l; + } + n = h.colorAIP.rgb2hsl(h.value.red / 255, h.value.green / 255, h.value.blue / 255); + h.value.hue = Math.round(n.h); + h.value.sat = Math.round(n.s * 100); + h.value.lum = Math.round(n.l * 100); + h._refreshCoordinatesByHSL(h.value.hue, h.value.sat, h.value.lum); + h._refreshContrast(); + h._refreshInputValues(); + h._refreshColorValue(); + }; + this._doOnChangeHSV = function () { + h._controllerNodes.hsv.value = h.setColor(h._controllerNodes.hsv.value); + }; + this._checkType = function (n) { + var l; + if (n instanceof Array) { + l = h._checkType(n[0]); + switch (l) { + case "string": + return "array_string"; + break; + case "input": + case "textarea": + return "array_input"; + break; + case "object": + return "array_object"; + break; + default: + return undefined; + } + } else { + if (n == undefined) { + return null; + } else { + if (typeof n == "string") { + return "string"; + } else { + if (n.tagName && n.tagName.toLowerCase() == "input") { + return "input"; + } else { + if (n.tagName && n.tagName.toLowerCase() == "textarea") { + return "textarea"; + } else { + if (n.tagName) { + return "container"; + } else { + if (typeof n == "object") { + return "object"; + } else { + return undefined; + } + } + } + } + } + } + } + }; + this._initByObject = function (l) { + if (l.parent && l.parent.tagName) { + h.base = l.parent; + } else { + if (typeof l.parent == "string") { + h.base = document.getElementById(l.parent); + } else { + h.base = document.createElement("div"); + h.base._dhx_remove = true; + } + } + if (l.color) { + h.conf.selectedColor = l.color; + } + if (typeof l.closeable != "undefined") { + this.conf.closeable = dhx4.s2b(l.closeable); + } + if (l.custom_colors) { + this._tempInitCC = function () { + var r, o; + this.initMemoryColors(); + this.conf.customColors = true; + if (l.custom_colors instanceof Array) { + o = l.custom_colors.length; + for (r = 0; r < o; r++) { + this.setCustomColors(l.custom_colors[r]); + } + } + if (this.base.parentNode) { + this.showMemory(); + } + delete this._tempInitCC; + }; + } + if (l.hide) { + h.conf.hide = true; + } + if (l.input) { + h._addNode(l.input, l.target_color, l.target_value); + } + var n = l.skin || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxcolorpicker") || "dhx_skyblue"; + h.setSkin(n); + if (l.colors) { + h.initMemoryColors(); + h.conf.customColors = true; + } + if (l.link) { + h._addNode(l.link); + } + }; + this.unload = function () { + var r, n, o; + if (this.isVisible()) { + this.hide(); + } + this.destructMemory(); + n = this._nodes.length; + for (r = 0; r < n; r++) { + this._detachEventsFromNode(this._nodes[r]); + for (o in this._nodes[r]) { + this._nodes[r][o] = null; + } + delete this._nodes[r]; + } + this._nodes = null; + if (!this.base._dhx_remove) { + this.base.className = this.base.className.replace(/\s?dhtmlxcp_\S*/, ""); + } else { + delete this.base._dhx_remove; + } + if (typeof window.addEventListener == "function") { + this._controllerNodes.colorArea.removeEventListener("mousedown", this._initMoveSelection, false); + this._controllerNodes.colorArea.removeEventListener("dblclick", this._doOnSelectColor, false); + this._controllerNodes.contrastArea.removeEventListener("mousedown", this._initMoveContrast, false); + this._controllerNodes.button_save.removeEventListener("click", this._doOnSelectColor, false); + this._controllerNodes.button_cancel.removeEventListener("click", this._doOnCancel, false); + this._controllerNodes.hue.removeEventListener("change", this._doOnChangeHSL, false); + this._controllerNodes.sat.removeEventListener("change", this._doOnChangeHSL, false); + this._controllerNodes.lum.removeEventListener("change", this._doOnChangeHSL, false); + this._controllerNodes.red.removeEventListener("change", this._doOnChangeRGB, false); + this._controllerNodes.green.removeEventListener("change", this._doOnChangeRGB, false); + this._controllerNodes.blue.removeEventListener("change", this._doOnChangeRGB, false); + this._controllerNodes.hsv.removeEventListener("change", this._doOnChangeHSV, false); + } else { + this._controllerNodes.colorArea.detachEvent("onmousedown", this._initMoveSelection); + this._controllerNodes.colorArea.detachEvent("ondblclick", this._doOnSelectColor); + this._controllerNodes.contrastArea.detachEvent("onmousedown", this._initMoveContrast); + this._controllerNodes.button_save.detachEvent("onclick", this._doOnSelectColor); + this._controllerNodes.button_cancel.detachEvent("onclick", this._doOnCancel); + this._controllerNodes.hue.detachEvent("onchange", this._doOnChangeHSL); + this._controllerNodes.sat.detachEvent("onchange", this._doOnChangeHSL); + this._controllerNodes.lum.detachEvent("onchange", this._doOnChangeHSL); + this._controllerNodes.red.detachEvent("onchange", this._doOnChangeRGB); + this._controllerNodes.green.detachEvent("onchange", this._doOnChangeRGB); + this._controllerNodes.blue.detachEvent("onchange", this._doOnChangeRGB); + this._controllerNodes.hsv.detachEvent("onchange", this._doOnChangeHSV); + } + if (this._controllerNodes.fr_cover) { + if (this._controllerNodes.fr_cover.parentNode) { + this._controllerNodes.fr_cover.parentNode.removeChild(this._controllerNodes.fr_cover); + } + delete this._controllerNodes.fr_cover; + } + dhx4.zim.clear(this.conf.cp_id); + dhx4._eventable(this, "clear"); + for (o in this) { + this[o] = null; + } + (h = null), (j = null), (c = null); + }; + g = this._checkType(m); + switch (g) { + case "object": + h._initByObject(m); + break; + case "input": + case "textarea": + h._initByObject({}); + this._addNode(m); + break; + case "string": + j = document.getElementById(m); + return new dhtmlXColorPicker(j); + break; + case "container": + h._initByObject({ parent: m }); + break; + case null: + h._initByObject({}); + break; + case "array_string": + case "array_input": + h._initByObject({}); + a = m.length; + for (e = 0; e < a; e++) { + this._addNode(m[e]); + } + break; + case "array_object": + h._initByObject({}); + a = m.length; + for (e = 0; e < a; e++) { + c = this._addNode(m[e].input, m[e].target_color, m[e].target_value).conf; + c.customColors = m[e].custom_colors != undefined ? dhx4.s2b(m[e].custom_colors) : c.customColors; + c.selectedColor = m[e].color != undefined ? m[e].color : c.selectedColor; + } + break; + } + this.base.innerHTML = + "
" + + this.i18n[this.conf.lang].labelHue + + "" + + this.i18n[this.conf.lang].labelRed + + "
" + + this.i18n[this.conf.lang].labelSat + + "" + + this.i18n[this.conf.lang].labelGreen + + "
" + + this.i18n[this.conf.lang].labelLum + + "" + + this.i18n[this.conf.lang].labelBlue + + "
"; + ("
"); + this._globalNode = this.base.firstChild; + this._controllerNodes = { + colorArea: this._globalNode.firstChild.firstChild.firstChild, + v_line: this._globalNode.firstChild.firstChild.firstChild.childNodes[0], + h_line: this._globalNode.firstChild.firstChild.firstChild.childNodes[1], + contrastArea: this._globalNode.firstChild.firstChild.childNodes[1], + contrast_line: this._globalNode.firstChild.firstChild.childNodes[1].firstChild, + color: this._globalNode.firstChild.childNodes[1].childNodes[0].firstChild, + hsv: this._globalNode.firstChild.childNodes[1].childNodes[0].childNodes[1], + hue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[1].firstChild, + sat: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[1].firstChild, + lum: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[1].firstChild, + red: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[3].firstChild, + green: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[3].firstChild, + blue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[3].firstChild, + memory_block: this._globalNode.firstChild.childNodes[2], + button_save: this._globalNode.firstChild.childNodes[3].firstChild, + button_cancel: this._globalNode.firstChild.childNodes[3].childNodes[1], + }; + this._labelNodes = { + labelHue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].firstChild, + labelSat: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].firstChild, + labelLum: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].firstChild, + labelRed: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[2], + labelGreen: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[2], + labelBlue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[2], + btnAddColor: null, + btnSelect: this._globalNode.firstChild.childNodes[3].firstChild, + btnCancel: this._globalNode.firstChild.childNodes[3].childNodes[1], + }; + if (typeof this._tempInitCC == "function") { + this._tempInitCC(); + } + if (typeof window.addEventListener == "function") { + this._controllerNodes.colorArea.addEventListener("mousedown", this._initMoveSelection, false); + this._controllerNodes.colorArea.addEventListener("dblclick", this._doOnSelectColor, false); + this._controllerNodes.contrastArea.addEventListener("mousedown", this._initMoveContrast, false); + this._controllerNodes.button_save.addEventListener("click", this._doOnSelectColor, false); + this._controllerNodes.button_cancel.addEventListener("click", this._doOnCancel, false); + this._controllerNodes.hue.addEventListener("change", this._doOnChangeHSL, false); + this._controllerNodes.sat.addEventListener("change", this._doOnChangeHSL, false); + this._controllerNodes.lum.addEventListener("change", this._doOnChangeHSL, false); + this._controllerNodes.red.addEventListener("change", this._doOnChangeRGB, false); + this._controllerNodes.green.addEventListener("change", this._doOnChangeRGB, false); + this._controllerNodes.blue.addEventListener("change", this._doOnChangeRGB, false); + this._controllerNodes.hsv.addEventListener("change", this._doOnChangeHSV, false); + } else { + this._controllerNodes.colorArea.attachEvent("onmousedown", this._initMoveSelection); + this._controllerNodes.colorArea.attachEvent("ondblclick", this._doOnSelectColor); + this._controllerNodes.contrastArea.attachEvent("onmousedown", this._initMoveContrast); + this._controllerNodes.button_save.attachEvent("onclick", this._doOnSelectColor); + this._controllerNodes.button_cancel.attachEvent("onclick", this._doOnCancel); + this._controllerNodes.hue.attachEvent("onchange", this._doOnChangeHSL); + this._controllerNodes.sat.attachEvent("onchange", this._doOnChangeHSL); + this._controllerNodes.lum.attachEvent("onchange", this._doOnChangeHSL); + this._controllerNodes.red.attachEvent("onchange", this._doOnChangeRGB); + this._controllerNodes.green.attachEvent("onchange", this._doOnChangeRGB); + this._controllerNodes.blue.attachEvent("onchange", this._doOnChangeRGB); + this._controllerNodes.hsv.attachEvent("onchange", this._doOnChangeHSV); + } + this.setColor(this.conf.selectedColor || "#ffffff"); + if (this._nodes.length) { + for (var e = 0; e < this._nodes.length; e++) { + this._attachEventsToNode(this._nodes[e]); + } + } + if (this.conf.hide) { + this.hide(); + } + if (typeof this._cpInitFRM == "function") { + this._cpInitFRM(); + } +} +dhtmlXColorPicker.prototype.linkTo = function (c, e, g) { + if (arguments.length == 1) { + e = g = c; + } + var a; + c = c || null; + g = g || null; + if (typeof e == "string") { + e = document.getElementById(e); + } + a = this._addNode(e, c, g); + if (a) { + this._attachEventsToNode(a); + } + return a; +}; +dhtmlXColorPicker.prototype._isBaseNode = function (a) { + if (a == this.base) { + return true; + } + if (a.parentElement == document.body) { + return false; + } else { + if (!a.parentElement) { + return false; + } else { + return this._isBaseNode(a.parentElement); + } + } +}; +dhtmlXColorPicker.prototype._hasInput = function (e) { + var c, + a, + g = false; + a = this._nodes.length; + for (c = 0; c < a; c++) { + if (this._nodes[c].valueCont == e) { + g = true; + break; + } + } + return g; +}; +dhtmlXColorPicker.prototype._findNodesByArray = function (h) { + var e, + a, + c, + g = []; + a = h.length; + for (e = 0; e < a; e++) { + if (typeof h[e] == "string") { + c = document.getElementById(h[e]); + } else { + c = h[e]; + } + if (c) { + this._addNode(c); + } + } +}; +dhtmlXColorPicker.prototype._addNode = function (h, l, j) { + var c, g, e, a; + if (typeof h == "string") { + c = document.getElementById(h); + } else { + c = h; + } + if (typeof l == "string") { + l = document.getElementById(l); + } + if (typeof j == "string") { + j = document.getElementById(j); + } + if (!c) { + return null; + } + if (dhx4.s2b(c.getAttribute("colorbox"))) { + g = document.createElement("div"); + g.style.width = c.offsetWidth + "px"; + g.style.height = c.offsetHeight + "px"; + c.style.width = c.offsetWidth - (c.offsetHeight + 8) + "px"; + c.parentNode.insertBefore(g, c); + g.style.position = "relative"; + e = document.createElement("div"); + g.appendChild(c); + g.appendChild(e); + e.className = "dhxcp_colorBox"; + c.className += " dhxcp_colorInput"; + e.style.width = e.style.height = c.offsetHeight + "px"; + } + a = { + node: c, + valueColor: l != undefined ? l : e || c, + valueCont: j != undefined ? j : c, + conf: { customColors: c.getAttribute("customcolors") != null ? dhx4.s2b(c.getAttribute("customcolors")) : null, selectedColor: c.getAttribute("selectedcolor") }, + }; + this._nodes.push(a); + if (!this.activeNode) { + this.activeNode = a; + } + return a; +}; +dhtmlXColorPicker.prototype.getNode = function (e) { + var a = null, + c = null; + if (typeof e == "string") { + a = document.getElementById(e); + } else { + a = e; + } + if (a.tagName != undefined) { + c = this._getNodeByElement(a); + } + return c; +}; +dhtmlXColorPicker.prototype._getNodeByElement = function (e) { + var g = null, + c, + a; + a = this._nodes.length; + for (c = 0; c < a; c++) { + if (this._nodes[c].node == e) { + g = this._nodes[c]; + } + } + return g; +}; +dhtmlXColorPicker.prototype._getNodeByValueCont = function (e) { + var g = null, + c, + a; + a = this._nodes.length; + for (c = 0; c < a; c++) { + if (this._nodes[c].valueCont && this._nodes[c].valueCont == e) { + g = this._nodes[c]; + } + } + return g; +}; +dhtmlXColorPicker.prototype.initMemoryColors = function () { + var c = this; + this._controllerNodes.memory_block.innerHTML = + "
"; + this.memory = new this.Memory(this._controllerNodes.memory_block.childNodes[1]); + this.memory.onSelect = this._onSelectMemoryEl; + this.memory.onSave = function (g) { + var e = c.colorAIP.rgb2hex({ r: g.red, g: g.green, b: g.blue }); + c.callEvent("onSaveColor", [e]); + }; + var a = this._controllerNodes.memory_block.childNodes[0].firstChild; + this._labelNodes.btnAddColor = this._controllerNodes.memory_block.childNodes[0].firstChild.firstChild; + if (typeof window.addEventListener == "function") { + a.addEventListener("click", this.saveColor, false); + } else { + a.attachEvent("onclick", this.saveColor); + } +}; +dhtmlXColorPicker.prototype._refreshCoordinatesByHSL = function (m, j, c) { + var a, g, e; + a = Math.round(((this.configColorArea.maxX - this.configColorArea.minX) * m) / 359) + this.configColorArea.minX; + g = Math.round(((this.configColorArea.maxY - this.configColorArea.minY) * (100 - c)) / 100) + this.configColorArea.minY; + e = Math.round(((this.configColorArea.maxY - this.configColorArea.minY) * (100 - j)) / 100) + this.configColorArea.minY; + this._setColorAreaXY(a, g); + this._setContrastY(e); +}; +dhtmlXColorPicker.prototype._parseColor = function (e) { + if (e instanceof Array) { + var c = { r: parseInt(e[0]), g: parseInt(e[1]), b: parseInt(e[2]) }; + } else { + if (typeof e == "string") { + e = e.replace(/\s/g, ""); + if (/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i.test(e)) { + var a = e.match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i); + var c = { r: parseInt(a[1]), g: parseInt(a[2]), b: parseInt(a[3]) }; + } else { + var c = this.colorAIP.hex2rgb(e); + } + } + } + return c; +}; +dhtmlXColorPicker.prototype.setColor = function (j) { + var c = this.colorAIP.rgb2hex({ r: this.value.red, g: this.value.green, b: this.value.blue }); + var e = this._parseColor(j); + var h = e instanceof Object; + h = h && 0 <= e.r && e.r <= 255; + h = h && 0 <= e.g && e.g <= 255; + h = h && 0 <= e.b && e.b <= 255; + if (!h) { + return c; + } + var g = this.colorAIP.rgb2hex({ r: e.r, g: e.g, b: e.b }); + if (g == c) { + return c; + } + this.value.red = e.r; + this.value.green = e.g; + this.value.blue = e.b; + var a = this.colorAIP.rgb2hsl(e.r / 255, e.g / 255, e.b / 255); + this.value.hue = Math.round(a.h); + this.value.sat = Math.round(a.s * 100); + this.value.lum = Math.round(a.l * 100); + this._refreshCoordinatesByHSL(this.value.hue, this.value.sat, this.value.lum); + this._refreshContrast(); + this._refreshInputValues(); + this._refreshColorValue(); + return g; +}; +dhtmlXColorPicker.prototype.getSelectedColor = function () { + return [this.colorAIP.rgb2hex({ r: this.value.red, g: this.value.green, b: this.value.blue }), [this.value.red, this.value.green, this.value.blue], [this.value.hue, this.value.sat, this.value.lum]]; +}; +dhtmlXColorPicker.prototype._attachEventsToNode = function (a) { + if (typeof window.addEventListener == "function") { + a.node.addEventListener("click", this._doOnClickByNode, false); + } else { + a.node.attachEvent("onclick", this._doOnClickByNode); + } + if (a.valueCont && a.valueCont.tagName.toLowerCase() == "input") { + if (typeof window.addEventListener == "function") { + a.valueCont.addEventListener("focus", this._doOnFocusByInput, false); + a.valueCont.addEventListener("blur", this._doOnBlurByInput, false); + } else { + a.valueCont.attachEvent("onfocus", this._doOnFocusByInput); + a.valueCont.attachEvent("onblur", this._doOnBlurByInput); + } + } +}; +dhtmlXColorPicker.prototype._detachEventsFromNode = function (a) { + if (typeof window.addEventListener == "function") { + a.node.removeEventListener("click", this._doOnClickByNode, false); + } else { + a.node.detachEvent("onclick", this._doOnClickByNode); + } + if (a.valueCont && a.valueCont.tagName.toLowerCase() == "input") { + if (typeof window.addEventListener == "function") { + a.valueCont.removeEventListener("focus", this._doOnFocusByInput, false); + a.valueCont.removeEventListener("blur", this._doOnBlurByInput, false); + } else { + a.valueCont.detachEvent("onfocus", this._doOnFocusByInput); + a.valueCont.detachEvent("onblur", this._doOnBlurByInput); + } + } +}; +dhtmlXColorPicker.prototype.show = function (c) { + var a = false; + if (c != undefined) { + this.activeNode = this.getNode(c) || this.activeNode; + } + if (this.activeNode && this.activeNode.valueCont && this.activeNode.valueCont.value) { + this.setColor(this.activeNode.valueCont.value); + } + if (this.activeNode) { + a = this.activeNode.conf.customColors != null ? this.activeNode.conf.customColors : this.conf.customColors; + this.setColor(this.activeNode.conf.selectedColor); + } else { + a = this.conf.customColors; + } + if (a) { + this.showMemory(); + } else { + this.hideMemory(); + } + if (this.base._dhx_remove) { + this.base.firstChild.style.zIndex = dhx4.zim.reserve(this.conf.cp_id); + this.base.style.visibility = "hidden"; + if (document.body.firstChild) { + document.body.insertBefore(this.base, document.body.firstChild); + } else { + document.body.appendChild(this.base); + } + this._refreshPosition(); + this.base.style.visibility = "visible"; + if (typeof window.addEventListener == "function") { + document.body.addEventListener("mousedown", this._doOnClickByBody, false); + } else { + document.body.attachEvent("onmousedown", this._doOnClickByBody); + } + } else { + this.base.appendChild(this._globalNode); + } + if (this._controllerNodes.fr_cover) { + this.base.insertBefore(this._controllerNodes.fr_cover, this._globalNode); + } + this.callEvent("onShow", [this.activeNode ? this.activeNode.node : null]); +}; +dhtmlXColorPicker.prototype.setPosition = function (c, h) { + var g = null; + var a = parseInt(c); + var e = parseInt(h); + if (isNaN(a)) { + g = { right: "right", bottom: "bottom" }[c.toLowerCase()] ? c : null; + } + if (this.base._dhx_remove) { + if (g == null) { + } else { + this.conf.position = g; + this._refreshPosition(g); + } + } else { + if (isNaN(a) || isNaN(e)) { + } else { + this._globalNode.style.left = a + "px"; + this._globalNode.style.top = e + "px"; + if (this._controllerNodes.fr_cover) { + this._controllerNodes.fr_cover.style.left = this._globalNode.style.left; + this._controllerNodes.fr_cover.style.top = this._globalNode.style.top; + } + } + } +}; +dhtmlXColorPicker.prototype._initListenerInput = function () { + var a = this; + this._inputListenerId = + this._inputListenerId || + setInterval(function () { + a._refreshValueByInput(); + }, 70); +}; +dhtmlXColorPicker.prototype._removeListenerInput = function () { + if (this._inputListenerId) { + clearInterval(this._inputListenerId); + this._inputListenerId = null; + } +}; +dhtmlXColorPicker.prototype._refreshValueByInput = function () { + var c = this.activeNode.valueCont.value, + a = this.getSelectedColor()[0]; + if (this._inputListenerId) { + if (/^#[\da-f]{6}$/i.test(c) && c != a) { + this.setColor(c); + this.callEvent("onSelect", [c, this.activeNode.node]); + } + } +}; +dhtmlXColorPicker.prototype._refreshPosition = function (c) { + if (this.activeNode == null) { + return; + } + var m = dhx4.absTop(this.activeNode.node); + var a = dhx4.absLeft(this.activeNode.node); + var g = dhx4.screenDim(); + var e = this._globalNode.offsetWidth; + var h = this._globalNode.offsetHeight; + var l = 0; + c = c || this.conf.position; + switch (c) { + case "bottom": + var l = m + this.activeNode.node.offsetHeight + this.conf.indent; + var j = a; + if (j + e > g.left + g.right) { + j = a + this.activeNode.node.offsetWidth - e; + } + if (j < g.left) { + j = a; + } + if (l + h > g.top + g.bottom) { + l = m - h - this.conf.indent; + } + if (l - g.top < 0) { + l = g.top + this.conf.indent; + } + this._globalNode.style.top = l + "px"; + this._globalNode.style.left = j + "px"; + break; + default: + var j = a + this.activeNode.node.offsetWidth + this.conf.indent; + l = m; + if (c == "right") { + if (j + e > g.left + g.right) { + j = a - e - this.conf.indent; + } + if (j < g.left) { + j = a + this.activeNode.node.offsetWidth + this.conf.indent; + } + } + if (g.bottom - (l + h) <= 0) { + l = m + this.activeNode.node.offsetHeight - h; + } + if (l - g.top < 0) { + l = g.top + this.conf.indent; + } + this._globalNode.style.left = j + "px"; + this._globalNode.style.top = l + "px"; + } + if (this._controllerNodes.fr_cover) { + this._controllerNodes.fr_cover.style.left = this._globalNode.style.left; + this._controllerNodes.fr_cover.style.top = this._globalNode.style.top; + } +}; +dhtmlXColorPicker.prototype.isVisible = function () { + var a = false; + if (this.base._dhx_remove) { + a = this.base.parentNode == document.body; + } else { + a = this._globalNode.parentNode == this.base; + } + return a; +}; +dhtmlXColorPicker.prototype.hide = function () { + if (this.base._dhx_remove) { + if (this.base.parentNode) { + this.base.parentNode.removeChild(this.base); + dhx4.zim.clear(this.conf.cp_id); + if (typeof window.addEventListener == "function") { + document.body.removeEventListener("mousedown", this._doOnClickByBody, false); + } else { + document.body.detachEvent("onmousedown", this._doOnClickByBody); + } + } + } else { + if (this.isVisible() == false) { + return; + } + this.base.removeChild(this._globalNode); + } + if (this._controllerNodes.fr_cover && this._controllerNodes.fr_cover.parentNode) { + this._controllerNodes.fr_cover.parentNode.removeChild(this._controllerNodes.fr_cover); + } + if (this.callEvent != undefined) { + this.callEvent("onHide", [this.activeNode ? this.activeNode.node : null]); + } +}; +dhtmlXColorPicker.prototype.configColorArea = { minX: 1, maxX: 209, minY: 1, maxY: 119 }; +dhtmlXColorPicker.prototype._skinCollection = { dhx_skyblue: true, dhx_web: true, dhx_terrace: true }; +dhtmlXColorPicker.prototype.i18n = { en: { labelHue: "Hue", labelSat: "Sat", labelLum: "Lum", labelRed: "Red", labelGreen: "Green", labelBlue: "Blue", btnAddColor: "Save the color", btnSelect: "Select", btnCancel: "Cancel" } }; +dhtmlXColorPicker.prototype.loadUserLanguage = function (a) { + if (typeof this._mergeLangModules == "function") { + this._mergeLangModules(); + } + this.conf.lang = a; + this._refreshLanguage(); +}; +dhtmlXColorPicker.prototype._refreshLanguage = function () { + var a, + c = this.i18n[this.conf.lang]; + for (a in c) { + if (this._labelNodes[a]) { + this._labelNodes[a].innerHTML = c[a]; + } + } +}; +dhtmlXColorPicker.prototype._setColorAreaXY = function (a, e) { + var c = this.configColorArea; + a = parseInt(a); + if (c.minX > a) { + this.conf.x = c.minX; + } else { + if (a > c.maxX) { + this.conf.x = c.maxX; + } else { + if (!isNaN(a)) { + this.conf.x = a; + } + } + } + e = parseInt(e); + if (c.minY > e) { + this.conf.y = c.minY; + } else { + if (e > c.maxY) { + this.conf.y = c.maxY; + } else { + if (!isNaN(e)) { + this.conf.y = e; + } + } + } + this._refreshLines(); +}; +dhtmlXColorPicker.prototype._setColorByXYC = function (c) { + c = c || false; + this.value.hue = Math.round((359 * (this.conf.x - this.configColorArea.minX)) / (this.configColorArea.maxX - this.configColorArea.minX)); + this.value.lum = Math.round(100 - (100 * (this.conf.y - this.configColorArea.minY)) / (this.configColorArea.maxY - this.configColorArea.minY)); + this.value.sat = Math.round(100 - (100 * (this.conf.c - this.configColorArea.minY)) / (this.configColorArea.maxY - this.configColorArea.minY)); + var a = this.colorAIP.hsl2rgb(this.value.hue, this.value.sat / 100, this.value.lum / 100); + this.value.red = Math.round(255 * a.r); + this.value.green = Math.round(255 * a.g); + this.value.blue = Math.round(255 * a.b); + if (!c) { + this._refreshContrast(); + } + this._refreshInputValues(); + this._refreshColorValue(); +}; +dhtmlXColorPicker.prototype._setContrastY = function (c) { + var a = this.configColorArea; + c = parseInt(c); + if (!isNaN(c)) { + this.conf.c = Math.min(Math.max(a.minY, c), a.maxY); + } + this._refreshContrastLine(); +}; +dhtmlXColorPicker.prototype._refreshInputValues = function () { + this._controllerNodes.hue.value = this.value.hue; + this._controllerNodes.sat.value = this.value.sat; + this._controllerNodes.lum.value = this.value.lum; + this._controllerNodes.red.value = this.value.red; + this._controllerNodes.green.value = this.value.green; + this._controllerNodes.blue.value = this.value.blue; +}; +dhtmlXColorPicker.prototype._refreshColorValue = function () { + this._controllerNodes.color.style.backgroundColor = "rgb(" + [this.value.red, this.value.green, this.value.blue].join(", ") + ")"; + var a = this.colorAIP.rgb2hex({ r: this.value.red, g: this.value.green, b: this.value.blue }); + this._controllerNodes.hsv.value = a; + this.callEvent("onChange", [a]); +}; +dhtmlXColorPicker.prototype._refreshContrast = function () { + var g = this.colorAIP.hsl2rgb(this.value.hue, 0, this.value.lum / 100); + var h = this.colorAIP.hsl2rgb(this.value.hue, 1, this.value.lum / 100); + var e = this._checkIeVersion(); + if (e && e <= 9) { + var l = this._controllerNodes.contrastArea.firstChild; + if (l == this._controllerNodes.contrast_line) { + l = document.createElement("div"); + l.className += "dhxcp_ie_gradient"; + this._controllerNodes.contrastArea.appendChild(l); + this._controllerNodes.contrastArea.appendChild(this._controllerNodes.contrast_line); + } + var c = this.colorAIP.rgb2hex({ r: Math.round(255 * g.r), g: Math.round(255 * g.g), b: Math.round(255 * g.b) }); + var a = this.colorAIP.rgb2hex({ r: Math.round(255 * h.r), g: Math.round(255 * h.g), b: Math.round(255 * h.b) }); + l.style.filter = "progid:DXImageTransform.Microsoft.gradient(startColorstr='" + a + "', endColorstr='" + c + "', GradientType=0)"; + } else { + g = [Math.round(255 * g.r), Math.round(255 * g.g), Math.round(255 * g.b)]; + h = [Math.round(255 * h.r), Math.round(255 * h.g), Math.round(255 * h.b)]; + var j = "linear-gradient(rgb(" + h.join(",") + "), rgb(" + g.join(",") + "))"; + if (window.dhx4.isKHTML == true && navigator.userAgent.match(/Windows/gi) != null) { + j = "-webkit-" + j; + } + this._controllerNodes.contrastArea.style.backgroundImage = j; + } +}; +dhtmlXColorPicker.prototype._refreshLines = function () { + this._controllerNodes.v_line.style.left = this.conf.x + "px"; + this._controllerNodes.h_line.style.top = this.conf.y + "px"; +}; +dhtmlXColorPicker.prototype._refreshContrastLine = function () { + this._controllerNodes.contrast_line.style.top = this.conf.c + "px"; +}; +dhtmlXColorPicker.prototype._getOffsetPosition = function (h, a) { + var c = { x: NaN, y: NaN }, + g = h.target || h.srcElement; + if (g == a) { + c.x = h.offsetX != undefined ? h.offsetX : h.layerX; + c.y = h.offsetY != undefined ? h.offsetY : h.layerY; + } else { + if (g == this._controllerNodes.v_line) { + c.y = h.offsetY != undefined ? h.offsetY : h.layerY; + } else { + c.x = h.offsetX != undefined ? h.offsetX : h.layerX; + } + } + return c; +}; +dhtmlXColorPicker.prototype.colorAIP = { + hex2rgb: function (c) { + var a = c.match(/^(#)([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i); + if (a != null) { + return { r: parseInt("0x" + a[2]), g: parseInt("0x" + a[3]), b: parseInt("0x" + a[4]) }; + } else { + return null; + } + }, + rgb2hex: function (h) { + var e = parseInt(h.r), + c = parseInt(h.g), + a = parseInt(h.b); + (e = e || 0), (c = c || 0), (a = a || 0); + return "#" + (e ? (e < 16 ? "0" + e.toString(16) : e.toString(16)) : "00") + (c ? (c < 16 ? "0" + c.toString(16) : c.toString(16)) : "00") + (a ? (a < 16 ? "0" + a.toString(16) : a.toString(16)) : "00"); + }, + rgb2hsl: function (n, m, e) { + var l, j, c; + var a = Math.max(n, m, e), + h = Math.min(n, m, e); + c = 0.5 * (a + h); + if (a == h) { + l = 0; + } else { + if (a == n) { + l = (60 * (m - e)) / (a - h); + if (m < e) { + l += 360; + } + } else { + if (a == m) { + l = (60 * (e - n)) / (a - h) + 120; + } else { + l = (60 * (n - m)) / (a - h) + 240; + } + } + } + if (c == 0 || a == h) { + j = 0; + } else { + if (c <= 0.5) { + j = (0.5 * (a - h)) / c; + } else { + j = (0.5 * (a - h)) / (1 - c); + } + } + return { h: l, s: j, l: c }; + }, + hsl2rgb: function (n, e, l) { + var h, j, m; + var c = [], + a = []; + if (l <= 0.5) { + h = l * (1 + e); + } else { + h = l + e - l * e; + } + j = 2 * l - h; + m = n / 360; + c.push(m + 1 / 3); + c.push(m); + c.push(m - 1 / 3); + for (var g = 0; g < 3; g++) { + if (c[g] < 0) { + c[g] += 1; + } else { + if (c[g] > 1) { + c[g] -= 1; + } + } + if (c[g] < 1 / 6) { + a.push(j + (h - j) * 6 * c[g]); + } else { + if (c[g] < 0.5) { + a.push(h); + } else { + if (c[g] < 2 / 3) { + a.push(j + (h - j) * (2 / 3 - c[g]) * 6); + } else { + a.push(j); + } + } + } + } + return { r: a[0], g: a[1], b: a[2] }; + }, +}; +dhtmlXColorPicker.prototype._checkIeVersion = function () { + var a; + var c = navigator.userAgent.match(/(MSIE)\s(\d\.\d)/i); + a = c && c[2] ? parseInt(c[2]) : null; + return a; +}; +dhtmlXColorPicker.prototype.setCustomColors = function () { + if (this.memory == null) { + this.initMemoryColors(); + this.conf.customColors = true; + } + var g, e, j, c, h, a; + e = arguments.length; + for (g = 0; g < e; g++) { + if (arguments[g] instanceof Array) { + j = this._rgb2value(arguments[g][0], arguments[g][1], arguments[g][2]); + this.memory.setValue(j, null, false); + continue; + } else { + if (typeof arguments[g] == "string") { + c = arguments[g].match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i); + if (c instanceof Array) { + j = this._rgb2value(c[1], c[2], c[3]); + this.memory.setValue(j, null, false); + continue; + } + c = arguments[g].match(/(#[\da-f]{6})/gi); + if (c instanceof Array) { + a = c.length; + for (h = 0; h < a; h++) { + j = this._hex2value(c[h]); + this.memory.setValue(j, null, false); + } + } + } + } + } +}; +dhtmlXColorPicker.prototype.getCustomColors = function () { + var c = []; + if (this.memory != null && this.conf.customColors == true) { + for (var e = 0; e < this.memory.controllers.length; e++) { + var a = this.memory.controllers[e].value; + c.push(this.colorAIP.rgb2hex({ r: a.red, g: a.green, b: a.blue })); + } + } + return c; +}; +dhtmlXColorPicker.prototype._rgb2value = function (h, e, a) { + var c = this.colorAIP.rgb2hsl(h / 255, e / 255, a / 255); + return { red: h, green: e, blue: a, hue: Math.round(c.h), sat: Math.round(c.s * 100), lum: Math.round(c.l * 100) }; +}; +dhtmlXColorPicker.prototype._hex2value = function (e) { + var c, a; + c = this.colorAIP.hex2rgb(e); + a = this.colorAIP.rgb2hsl(c.r / 255, c.g / 255, c.b / 255); + return { red: c.r, green: c.g, blue: c.b, hue: Math.round(a.h), sat: Math.round(a.s * 100), lum: Math.round(a.l * 100) }; +}; +dhtmlXColorPicker.prototype.showMemory = function () { + if (this.memory == null) { + this.initMemoryColors(); + } + if (!this._globalNode.className.match(/dhxcp_add_memory/)) { + this._globalNode.className += " dhxcp_add_memory"; + } + this.conf.customColors = true; +}; +dhtmlXColorPicker.prototype.hideMemory = function () { + if (this.memory != null) { + this._globalNode.className = this._globalNode.className.replace(/\sdhxcp_add_memory/, ""); + } + this.conf.customColors = false; +}; +dhtmlXColorPicker.prototype.setSkin = function (h) { + h = h.toLowerCase(); + var e, + c = -1, + a, + g = "dhtmlxcp"; + e = this.base.className.match(/\S\w+/gi); + if (e instanceof Array) { + for (a in this._skinCollection) { + if (c == -1) { + c = this._indexOf(e, g + "_" + a); + } else { + break; + } + } + c = c == -1 ? e.length : c; + } else { + e = []; + c = 0; + } + e[c] = g + "_" + h; + this.base.className = e.join(" "); + this.skin = h; +}; +dhtmlXColorPicker.prototype.hideOnSelect = function (a) { + a = dhx4.s2b(a); + this.conf.hideOnSelect = a; +}; +dhtmlXColorPicker.prototype._indexOf = function (a, g) { + var e, + c, + h = -1; + c = a.length; + for (e = c; e >= 0; e--) { + if (a[e] == g) { + h = e; + break; + } + } + return h; +}; +dhtmlXColorPicker.prototype.destructMemory = function () { + if (this.memory == null) { + return; + } + this.hideMemory(); + var a = this._controllerNodes.memory_block.childNodes[0].firstChild; + this._labelNodes.btnAddColor = null; + if (typeof window.addEventListener == "function") { + a.removeEventListener("click", this.saveColor, false); + } else { + a.detachEvent("onclick", this.saveColor); + } + this.memory.remove(); + this._controllerNodes.memory_block.innerHTML = ""; + this.memory = null; +}; +dhtmlXColorPicker.prototype.Memory = function (e) { + var c = this, + a = null, + g = { red: 255, blue: 255, green: 255, hue: 0, sat: 0, lum: 100 }; + this.select = function () { + var j = this != window ? this : event.srcElement; + var h = h || j.dhxpc_memory; + if (a != null) { + c.unSelect(); + } + a = h; + h.domElement.className += " dhxcp_memory_el_select"; + if (typeof c.onSelect == "function") { + c.onSelect(h); + } + }; + this.onSelect = null; + this.onSave = null; + this._createMemoryController = function (h) { + var j = { domElement: h, value: dhx4._copyObj(g) }; + h.dhxpc_memory = j; + if (typeof window.addEventListener == "function") { + h.addEventListener("click", c.select, false); + } else { + h.attachEvent("onclick", c.select); + } + return j; + }; + this._findMemoryControllers = function (o) { + var m = o.getElementsByTagName("a"), + j, + h, + n = []; + h = m.length; + for (j = 0; j < h; j++) { + n.push(this._createMemoryController(m[j])); + } + return n; + }; + this.controllers = this._findMemoryControllers(e); + this.unSelect = function () { + if (a) { + a.domElement.className = a.domElement.className.replace(/\s.*$/i, ""); + } + a = null; + }; + this.setActiveNext = function () { + var j = null, + h; + if (a == null) { + a = this.controllers[0]; + } else { + j = this.getIndex(a); + h = this.controllers.length; + this.unSelect(); + a = j + 1 < h ? this.controllers[j + 1] : this.controllers[0]; + } + a.domElement.className += " dhxcp_memory_el_next"; + return a; + }; + this.setValue = function (j, h, l) { + a = h || a; + if (a == null) { + a = this.controllers[0]; + } + a.value.red = j.red; + a.value.blue = j.blue; + a.value.green = j.green; + a.value.hue = j.hue; + a.value.sat = j.sat; + a.value.lum = j.lum; + a.domElement.style.backgroundColor = "rgb(" + [j.red, j.green, j.blue].join(", ") + ")"; + this.setActiveNext(); + if (l != false && typeof this.onSave == "function") { + this.onSave(j); + } + }; + this.clean = function () { + var h = this.controllers.length, + m; + for (var j = 0; j < h; j++) { + m = this.controllers[j]; + m.value = dhx4._copyObj(g); + m.domElement.style.backgroundColor = "rgb(" + [g.red, g.green, g.blue].join(", ") + ")"; + } + this.unSelect(); + a = this.controllers[0]; + }; + this.getIndex = function (m) { + var j, + h, + n = -1; + h = this.controllers.length; + for (j = 0; j < h; j++) { + if (this.controllers[j] == m) { + n = j; + break; + } + } + return n; + }; + this.remove = function () { + var j, h; + h = this.controllers.length; + for (j = 0; j < h; j++) { + if (typeof window.addEventListener == "function") { + this.controllers[j].domElement.removeEventListener("click", this.select, false); + } else { + this.controllers[j].domElement.detachEvent("onclick", this.select); + } + delete this.controllers[j].domElement.dhxpc_memory; + } + delete this.onSelect; + delete this.controllers; + delete this.onSave; + }; +}; +if (window.dhx4.isIE6) { + dhtmlXColorPicker.prototype._cpInitFRM = function () { + var a; + if (!this._controllerNodes.fr_cover) { + a = document.createElement("IFRAME"); + a.className = "dhxcp_frm"; + a.border = 0; + a.frameBorder = 0; + this._controllerNodes.fr_cover = a; + } + if (!this.base._dhx_remove) { + this.base.insertBefore(a, this._globalNode); + } + }; +} +function dhtmlXSlider(c) { + var a = this; + this.conf = { + size: null, + skin: null, + vertical: false, + min: 0, + max: 99, + value: 0, + step: 1, + decimals: 0, + margin: 2, + border: 1, + inverse: false, + disabled: false, + tooltip: false, + visible: true, + linkTo: null, + range: false, + bg: null, + bg_mode: "left", + }; + this._attachedNode = {}; + this._movingInitialValues = null; + this.base = null; + if (arguments.length > 1) { + return new dhtmlXSlider(this._renderArgumets(arguments)); + } else { + if (typeof c == "string" || (typeof c == "object" && c.tagName)) { + return new dhtmlXSlider({ parent: c }); + } + } + if (typeof c.parent == "string") { + this.base = document.getElementById(c.parent); + } else { + this.base = c.parent; + } + this._mergeConfig(this._readAttFormNode(this.base)); + this._mergeConfig(c); + if (this.conf.bg == null) { + this.conf.bg = this.conf.range == true; + } + if (this.conf.range == true) { + if (!(this.conf.value instanceof Array)) { + this.conf.value = [this.conf.value]; + } + if (this.conf.value.length < 2) { + this.conf.value.push(this.conf.value[0]); + } + if (!(this.conf.linkTo instanceof Array)) { + this.conf.linkTo = [this.conf.linkTo]; + } + } + this._detectDecimals(); + if (this.conf.size == null || typeof this.conf.size == "undefined") { + if (this.conf.vertical) { + this.conf.size = this.base.offsetHeight; + } else { + this.conf.size = this.base.offsetWidth; + } + } + var e = this.conf.skin || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxslider") || "dhx_skyblue"; + this.setSkin(e); + this.base.innerHTML = + "
" + + (this.conf.bg == true ? "
" : "") + + "
" + + (this.conf.range == true ? "
" : "") + + "
"; + this._nodes = { cont: this.base.firstChild, track: this.base.firstChild.firstChild, runner: this.base.firstChild.childNodes[1], runner2: this.base.firstChild.childNodes[2] }; + this._nodes.cont.onmousedown = this._nodes.track.onmousedown = this._nodes.cont.onselectstart = this._nodes.track.onselectstart = function (g) { + g = g || event; + if (typeof g.preventDefault == "function") { + g.preventDefault(); + } else { + g.returnValue = false; + } + return false; + }; + this._r_actv = null; + if (this.conf.range == true) { + this.conf.value = this._normalizeRange(this.conf.value, this.conf.min, this.conf.max); + } else { + this.conf.value = this._normalize(this.conf.value, this.conf.min, this.conf.max); + } + this._setOrient(this.conf.vertical); + this.setSize(this.conf.size); + this._initMover = function (j, g) { + if (a.conf.disabled) { + return; + } + j = j || event; + if (typeof j.preventDefault == "function") { + j.preventDefault(); + } + if (g != null) { + a._r_actv = a._nodes[g == 0 ? "runner" : "runner2"]; + } else { + a._r_actv = j.target || j.srcElement; + if (a._r_actv.className.indexOf("dhxsl_runner") == -1) { + a._r_actv = a._nodes.runner; + } + } + a._r_actv.className = "dhxsl_runner dhxsl_runner_actv"; + var h = (j.type == "mousedown" ? "client" : "page") + (a.conf.vertical ? "Y" : "X"); + a._movingInitialValues = {}; + if (a.conf.range == true) { + a._movingInitialValues.index = a._r_actv == a._nodes.runner ? 0 : 1; + a._movingInitialValues.value = a.conf.value[a._movingInitialValues.index]; + } else { + a._movingInitialValues.value = a.conf.value; + } + a._movingInitialValues.coord = typeof j[h] != "undefined" && j[h] != 0 ? j[h] : j.touches != null && j.touches[0] != null ? j.touches[0][h] || 0 : 0; + if (a.conf.disabled == false) { + if (typeof window.addEventListener == "function") { + window.addEventListener("mousemove", a._move, false); + window.addEventListener("mouseup", a._cleanMove, false); + window.addEventListener("touchmove", a._move, false); + window.addEventListener("touchend", a._cleanMove, false); + } else { + document.body.attachEvent("onmousemove", a._move); + document.body.attachEvent("onmouseup", a._cleanMove); + } + } + a.callEvent("onMouseDown", [a._r_actv == a._nodes.runner ? 0 : 1]); + return false; + }; + this._move = function (o) { + if (a.conf.disabled) { + return; + } + o = o || event; + if (typeof o.preventDefault == "function") { + o.preventDefault(); + } + var m = (o.type == "mousemove" ? "client" : "page") + (a.conf.vertical ? "Y" : "X"); + var n = a.conf.vertical ? a._r_actv.offsetHeight : a._r_actv.offsetWidth; + var j = a.conf.max - a.conf.min; + var h = typeof o[m] != "undefined" && o[m] != 0 ? o[m] : o.touches != null && o.touches[0] != null ? o.touches[0][m] || 0 : 0; + var l = a._movingInitialValues.value + (((h - a._movingInitialValues.coord) * j) / (a.conf.size - n)) * (a.conf.inverse ? -1 : 1); + if (a.conf.range == true) { + var g = [a.conf.value[0], a.conf.value[1]]; + if (a._movingInitialValues.index == 0) { + g[0] = Math.min(g[1], l); + } else { + if (a._movingInitialValues.index == 1) { + g[1] = Math.max(g[0], l); + } + } + a.setValue(g, true); + } else { + a.setValue(l, true); + } + }; + this._cleanMove = function (g) { + if (typeof window.addEventListener == "function") { + window.removeEventListener("mousemove", a._move, false); + window.removeEventListener("mouseup", a._cleanMove, false); + window.removeEventListener("touchmove", a._move, false); + window.removeEventListener("touchend", a._cleanMove, false); + } else { + document.body.detachEvent("onmousemove", a._move); + document.body.detachEvent("onmouseup", a._cleanMove); + } + a._movingInitialValues = null; + a._r_actv.className = a._r_actv.className.replace(/\s{0,}dhxsl_runner_actv/gi, ""); + a.callEvent("onSlideEnd", [a.conf.value]); + a.callEvent("onMouseUp", [a._r_actv == a._nodes.runner ? 0 : 1]); + a._r_actv = null; + }; + this._doOnSetValue = function (r) { + if (a.conf.disabled) { + return; + } + if (a._movingInitialValues != null) { + return false; + } + r = r || event; + if (typeof r.preventDefault == "function") { + r.preventDefault(); + } + var o = 0; + var l = r.target || r.srcElement; + if (l.className.match(/dhxsl_track_bg/) != null) { + o = parseInt(l.style[a.conf.vertical ? "top" : "left"]); + } + var n = (a.conf.vertical ? r.offsetY || r.layerY : r.offsetX || r.layerX) + o; + var m = (a.conf.vertical ? a._nodes.runner.offsetHeight : a._nodes.runner.offsetWidth) + o; + var g = a.conf.max - a.conf.min; + var h = null; + var j = null; + if (a.conf.inverse == true) { + j = a.conf.max - (n * g) / a.conf.size; + } else { + j = (n * g) / a.conf.size + a.conf.min; + } + if (a.conf.range == true) { + h = Math.abs(a.conf.value[0] - j) <= Math.abs(a.conf.value[1] - j) ? 0 : 1; + j = [h == 0 ? j : a.conf.value[0], h == 1 ? j : a.conf.value[1]]; + } + a.conf.init_index = h; + a.setValue(j, true); + a.conf.init_index = null; + if (a._movingInitialValues == null) { + a._initMover(r, h); + } + return false; + }; + this._doOnChangeInput = function (h) { + h = h || event; + var g = h.target || h.srcElement; + a.setValue(g.value); + }; + this._doOnKeyDown = function (h) { + h = h || event; + var g = h.target || h.srcElement; + if (h.keyCode == 13) { + a.setValue(g.value); + } + }; + this._attachEvents(this._nodes); + this.unload = function () { + dhx4._eventable(this, "clear"); + this._detachNode(); + this._detachEvents(this._nodes); + this.base.removeChild(this._nodes.cont); + this._nodes.cont.onmousedown = this._nodes.track.onmousedown = this._nodes.cont.onselectstart = this._nodes.track.onselectstart = null; + delete this._nodes.cont; + delete this._nodes.track; + delete this._nodes.max; + delete this._nodes.min; + delete this._nodes.runner; + if (this._nodes.runner2) { + delete this._nodes.runner2; + } + if (/\s?dhtmlxslider_\S*/.test(this.base.className)) { + this.base.className = this.base.className.replace(/\s?dhtmlxslider_\S*/, ""); + } + for (var g in this) { + this[g] = null; + } + a = null; + }; + dhx4._eventable(this); + if (this.conf.disabled) { + this.disable(); + } + if (this.conf.tooltip) { + this.enableTooltip(); + } + if (!this.conf.visible) { + this.hide(); + } + if (this.conf.linkTo) { + this.linkTo(this.conf.linkTo); + } + return this; +} +dhtmlXSlider.prototype._setOrient = function (a) { + a = a || false; + if (/\s?dhxsl_cont_hr/i.test(this._nodes.cont.className)) { + this._nodes.cont.className = this._nodes.cont.className.replace(/\s?dhxsl_cont_hr/i, ""); + } + if (/\s?dhxsl_cont_vr/i.test(this._nodes.cont.className)) { + this._nodes.cont.className = this._nodes.cont.className.replace(/\s?dhxsl_cont_vr/i, ""); + } + if (a) { + this._nodes.cont.className += " dhxsl_cont_vr"; + } else { + this._nodes.cont.className += " dhxsl_cont_hr"; + } +}; +dhtmlXSlider.prototype._attachEvents = function (a) { + if (typeof window.addEventListener == "function") { + a.runner.addEventListener("mousedown", this._initMover, false); + a.runner.addEventListener("touchstart", this._initMover, false); + a.cont.addEventListener("mousedown", this._doOnSetValue, false); + a.cont.addEventListener("touchstart", this._doOnSetValue, false); + if (a.runner2) { + a.runner2.addEventListener("mousedown", this._initMover, false); + a.runner2.addEventListener("touchstart", this._initMover, false); + } + } else { + a.runner.attachEvent("onmousedown", this._initMover); + a.cont.attachEvent("onmousedown", this._doOnSetValue); + if (a.runner2) { + a.runner2.attachEvent("onmousedown", this._initMover); + } + } +}; +dhtmlXSlider.prototype._detachEvents = function (a) { + if (typeof window.addEventListener == "function") { + a.runner.removeEventListener("mousedown", this._initMover, false); + a.runner.removeEventListener("touchstart", this._initMover, false); + a.cont.removeEventListener("mousedown", this._doOnSetValue, false); + a.cont.removeEventListener("touchstart", this._doOnSetValue, false); + if (a.runner2) { + a.runner2.removeEventListener("mousedown", this._initMover, false); + a.runner2.removeEventListener("touchstart", this._initMover, false); + } + } else { + a.runner.detachEvent("onmousedown", this._initMover); + a.cont.detachEvent("onmousedown", this._doOnSetValue); + if (a.runner2) { + a.runner2.detachEvent("onmousedown", this._initMover); + } + } +}; +dhtmlXSlider.prototype._mergeConfig = function (c) { + for (var a in c) { + switch (a.toLowerCase()) { + case "min": + case "max": + case "size": + case "step": + case "value": + case "inverse": + this.conf[a] = c[a]; + break; + case "tooltip": + case "visible": + case "vertical": + case "disabled": + case "range": + case "bg": + this.conf[a] = dhx4.s2b(c[a]); + break; + case "bg_mode": + this.conf[a] = { left: "left", right: "right" }[c[a]] || "left"; + break; + case "parent": + continue; + break; + default: + this.conf[a] = c[a]; + } + } +}; +dhtmlXSlider.prototype._readAttFormNode = function (g) { + var j = g.attributes, + a = j.length, + e, + h = {}, + c; + for (e = 0; e < a; e++) { + c = j[e]; + switch (c.name.toLowerCase()) { + case "size": + case "min": + case "max": + case "value": + case "step": + h[c.name] = Number(c.value); + break; + case "skin": + h[c.name] = c.value; + break; + case "vertical": + case "disabled": + case "visible": + case "range": + case "bg": + h[c.name] = dhx4.s2b(c.value); + break; + case "linkto": + h[c.name] = c.value; + break; + case "tooltip": + h[c.name] = dhx4.s2b(c.value); + break; + case "bg_mode": + h[c.name] = { left: "left", right: "right" }[c.value] || "left"; + break; + } + } + return h; +}; +dhtmlXSlider.prototype._renderArgumets = function (a) { + var g = {}, + e, + c; + c = a.length; + for (e = 0; e < c; e++) { + switch (e) { + case 0: + g.parent = a[e]; + break; + case 1: + g.size = a[e]; + break; + case 2: + g.skin = a[e]; + break; + case 3: + g.vertical = a[e]; + break; + case 4: + g.min = a[e]; + break; + case 5: + g.max = a[e]; + break; + case 6: + g.value = a[e]; + break; + case 7: + g.step = a[e]; + break; + } + } + return g; +}; +dhtmlXSlider.prototype._skinCollection = { dhx_skyblue: true, dhx_web: true, dhx_terrace: true }; +dhtmlXSlider.prototype._indexOf = function (a, g) { + var e, + c, + h = -1; + c = a.length; + for (e = c; e >= 0; e--) { + if (a[e] == g) { + h = e; + break; + } + } + return h; +}; +dhtmlXSlider.prototype._refreshRunner = function (h) { + var g = this.conf.vertical == true ? { x: "top", y: "left", ofs_w: "offsetHeight", ofs_h: "offsetWidth" } : { x: "left", y: "top", ofs_w: "offsetWidth", ofs_h: "offsetHeight" }; + var a = this._nodes.cont[g.ofs_w] - this._nodes.runner[g.ofs_w]; + var e = this._nodes.runner; + var c = this._nodes.runner2; + if (h == null || h == 0) { + var j = this._getCoord(a, this.conf.value instanceof Array ? this.conf.value[0] : this.conf.value); + e.style[g.x] = j + this.conf.border + "px"; + e.style[g.y] = Math.round((this._nodes.cont[g.ofs_h] - e[g.ofs_h]) / 2) + "px"; + } + if (this.conf.range == true && (h == null || h == 1)) { + var j = this._getCoord(a, this.conf.value[1]); + c.style[g.x] = j + this.conf.border + "px"; + c.style[g.y] = Math.round((this._nodes.cont[g.ofs_h] - e[g.ofs_h]) / 2) + "px"; + } + if (this.conf.range == true) { + if (e.style[g.x] == c.style[g.x] && this.conf.value[1] == this.conf.max) { + if (e.style.zIndex != 2) { + e.style.zIndex = 2; + } + } else { + if (e.style.zIndex == 2) { + e.style.zIndex = 1; + } + } + } + e = c = null; + this._refreshBG(); +}; +dhtmlXSlider.prototype._setValueByCoord = function (g) { + var a = dhx4.absLeft(this._nodes.cont), + h = dhx4.absTop(this._nodes.cont), + e, + c; + if (this.conf.vertical) { + c = (g.y - h - this._nodes.runner.offsetHeight / 2) / (this._nodes.cont.offsetHeight - this._nodes.runner.offsetHeight); + } else { + c = (g.x - a - this._nodes.runner.offsetWidth / 2) / (this._nodes.cont.offsetWidth - this._nodes.runner.offsetWidth); + } + e = (this.conf.max - this.conf.min) * c + this.conf.min; + this.setValue(e, true); +}; +dhtmlXSlider.prototype._getCoord = function (a, g) { + var e = this.conf.inverse ? this._inverseValue(g) : g; + var c = (e - this.conf.min) / (this.conf.max - this.conf.min); + return Math.round(a * c); +}; +dhtmlXSlider.prototype._normalize = function (g, e, a) { + g = Number(g); + g = Math.round(g / this.conf.step) * this.conf.step; + var c = Math.pow(10, this.conf.decimals); + g = Math.round(g * c) / c; + g = Math.max(e, Math.min(a, g)); + return g; +}; +dhtmlXSlider.prototype._normalizeRange = function (e, c, a) { + if (e[1] < e[0]) { + e[1] = e[0]; + } + e[0] = this._normalize(e[0], c, Math.min(a, e[1])); + e[1] = this._normalize(e[1], Math.max(c, e[0]), a); + return e; +}; +dhtmlXSlider.prototype._refreshBG = function () { + if (this.conf.bg != true) { + return; + } + var g = this._nodes.track.firstChild; + var e = this._nodes.runner; + var a = e.nextSibling; + var c = this.conf.vertical == true ? { x: "top", w: "height", ofs: "offsetHeight" } : { x: "left", w: "width", ofs: "offsetWidth" }; + if (this.conf.range == true) { + g.style[c.x] = Math.floor(parseInt(e.style[c.x]) + e[c.ofs] / 2) + "px"; + g.style[c.w] = Math.max(Math.floor(parseInt(a.style[c.x]) + a[c.ofs] / 2) - parseInt(g.style[c.x]), 0) + "px"; + } else { + var h = this.conf.inverse == true ? { left: "right", right: "left" }[this.conf.bg_mode] : this.conf.bg_mode; + g.style[c.x] = (h == "left" ? "0" : Math.floor(parseInt(e.style[c.x]) + e[c.ofs] / 2)) + "px"; + g.style[c.w] = (h == "left" ? Math.floor(parseInt(e.style[c.x]) + e[c.ofs] / 2) : this._nodes.track[c.ofs] - parseInt(g.style[c.x])) + "px"; + } + g = e = a = null; +}; +dhtmlXSlider.prototype._attachNode = function (e, a) { + this._detachNode(a); + var c = e.tagName.toLowerCase(); + if (!c) { + return; + } + this._attachedNode["node_" + a] = e; + switch (c) { + case "input": + case "select": + if (typeof window.addEventListener == "function") { + e.addEventListener("change", this._doOnChangeInput, false); + e.addEventListener("keydown", this._doOnKeyDown, false); + } else { + e.attachEvent("onchange", this._doOnChangeInput); + e.attachEvent("onkeydown", this._doOnKeyDown); + } + this._attachedNode.setValue = function (l, g, j) { + var h = l instanceof Array ? l[j || 0] : l; + this["node_" + (j || 0)].value = dhtmlXSlider.prototype._atatchedNodeFixDec(h, g); + }; + break; + default: + this._attachedNode.setValue = function (l, g, j) { + var h = l instanceof Array ? l[j || 0] : l; + this["node_" + (j || 0)].innerHTML = dhtmlXSlider.prototype._atatchedNodeFixDec(h, g); + }; + } + this._attachedNode.setValue(this.conf.value, this.conf.decimals, a); +}; +dhtmlXSlider.prototype._detachNode = function (a) { + var e = this._attachedNode["node_" + a]; + if (!e) { + return; + } + var c = e.tagName; + switch (c) { + case "input": + case "select": + if (typeof window.addEventListener == "function") { + e.removeEventListener("change", this._doOnChangeInput, false); + e.removeEventListener("keydown", this._doOnChangeInput, false); + } else { + e.detachEvent("change", this._doOnChangeInput); + e.detachEvent("keydown", this._doOnChangeInput); + } + break; + } + delete this._attachedNode["node_" + a]; + delete this._attachedNode.setValue; + e = null; +}; +dhtmlXSlider.prototype._atatchedNodeFixDec = function (g, a) { + g = String(g); + if (a > 0) { + var c = g.match(/\.\d{1,}$/); + if (c != null) { + a = Math.max(a - c[0].length + 1); + } + g += g.indexOf(".") < 0 ? "." : ""; + for (var e = 0; e < a; e++) { + g += "0"; + } + } + return g; +}; +dhtmlXSlider.prototype._detectDecimals = function () { + var a = this.conf.step.toString().match(/\.(\d*)$/); + this.conf.decimals = a != null ? a[1].length : 0; +}; +dhtmlXSlider.prototype.setSize = function (a) { + if (!isNaN(a)) { + if (this.conf.vertical) { + if (this._nodes.cont.style.width) { + delete this._nodes.cont.style.width; + } + this._nodes.cont.style.height = a - this.conf.margin + "px"; + } else { + if (this._nodes.cont.style.height) { + delete this._nodes.cont.style.height; + } + this._nodes.cont.style.width = a - this.conf.margin + "px"; + } + this._refreshRunner(); + } +}; +dhtmlXSlider.prototype.setSkin = function (h) { + h = h.toLowerCase(); + var e, + c = -1, + a, + g = "dhtmlxslider"; + e = this.base.className.match(/\S\w+/gi); + if (e instanceof Array) { + for (a in this._skinCollection) { + if (c == -1) { + c = this._indexOf(e, g + "_" + a); + } else { + break; + } + } + c = c == -1 ? e.length : c; + } else { + e = []; + c = 0; + } + e[c] = g + "_" + h; + this.base.className = e.join(" "); + this.conf.skin = h; + if (this._nodes) { + this._refreshRunner(); + } +}; +dhtmlXSlider.prototype.setValue = function (g, h) { + h = h || false; + var c = null; + var e = false; + if (this.conf.range == true) { + if (this._r_actv != null) { + c = this._r_actv == this._nodes.runner ? 0 : 1; + } + g = this._normalizeRange(g, this.conf.min, this.conf.max); + e = this.conf.value[0] != g[0] || this.conf.value[1] != g[1]; + } else { + g = this._normalize(g, this.conf.min, this.conf.max); + e = this.conf.value != g; + } + if ((e = true)) { + this.conf.value = g; + this._refreshRunner(c); + this._refreshTooltip(); + if (h) { + var a = [g, this]; + if (this.conf.range == true) { + if (this._r_actv != null) { + a.push(this._r_actv == this._nodes.runner ? 0 : 1); + } else { + if (this.conf.init_index != null) { + a.push(this.conf.init_index.valueOf()); + } + } + } + this.callEvent("onChange", a); + } + } + if (typeof this._attachedNode.setValue == "function") { + if (c == null) { + c = this.conf.init_index; + } + this._attachedNode.setValue(this.conf.value, this.conf.decimals, c); + } +}; +dhtmlXSlider.prototype.getValue = function () { + if (this.conf.range == true) { + return [this.conf.value[0].valueOf(), this.conf.value[1].valueOf()]; + } else { + return this.conf.value.valueOf(); + } +}; +dhtmlXSlider.prototype._inverseValue = function (a) { + return this.conf.max + this.conf.min - a; +}; +dhtmlXSlider.prototype.disable = function (h) { + h = h == false ? false : true; + var g = null; + if (h) { + for (var c in this._nodes) { + if (c == "cont") { + continue; + } + var e = c == "runner2" ? "runner" : c; + if (this._nodes[c] != null) { + g = new RegExp("\\s?dhxsl_" + e + "_dis", "i"); + if (!g.test(this._nodes[c].className)) { + this._nodes[c].className += " dhxsl_" + e + "_dis"; + } + } + } + this.conf.disabled = true; + } else { + this.enable(); + } +}; +dhtmlXSlider.prototype.enable = function () { + var g; + for (var c in this._nodes) { + if (c == "cont") { + continue; + } + var e = c == "runner2" ? "runner" : c; + if (this._nodes[c] != null) { + g = new RegExp("\\s?dhxsl_" + e + "_dis", "i"); + if (g.test(this._nodes[c].className)) { + this._nodes[c].className = this._nodes[c].className.replace(g, ""); + } + } + } + this.conf.disabled = false; +}; +dhtmlXSlider.prototype.isEnabled = function () { + return !this.conf.disabled; +}; +dhtmlXSlider.prototype.disableTooltip = function () { + this._nodes.cont.removeAttribute("title"); + this.conf.tooltip = false; +}; +dhtmlXSlider.prototype.enableTooltip = function (a) { + if (typeof a == "undefined") { + a = true; + } else { + a = dhx4.s2b(a); + } + if (a) { + this.conf.tooltip = true; + this._refreshTooltip(); + } else { + this.disableTooltip(); + } +}; +dhtmlXSlider.prototype.setMax = function (a) { + if (!isNaN(a) && this.conf.min < a) { + this.conf.max = a; + this.setValue(this.conf.value); + } +}; +dhtmlXSlider.prototype.getMax = function () { + return this.conf.max; +}; +dhtmlXSlider.prototype.setMin = function (a) { + if (!isNaN(a) && this.conf.max > a) { + this.conf.min = a; + this.setValue(this.conf.value); + } +}; +dhtmlXSlider.prototype.getMin = function () { + return this.conf.min; +}; +dhtmlXSlider.prototype.setStep = function (a) { + var c = this.conf.max - this.conf.min; + if (!isNaN(a) && a < c) { + this.conf.step = a; + this._detectDecimals(); + this.setValue(this.conf.value); + } +}; +dhtmlXSlider.prototype.getStep = function () { + return this.conf.step; +}; +dhtmlXSlider.prototype.show = function () { + if (/\s?dhxsl_hidden/i.test(this._nodes.cont.className)) { + this._nodes.cont.className = this._nodes.cont.className.replace(/\s?dhxsl_hidden/i, ""); + } + this.conf.visible = true; +}; +dhtmlXSlider.prototype.hide = function () { + if (!/\s?dhxsl_hidden/i.test(this._nodes.cont.className)) { + this._nodes.cont.className += " dhxsl_hidden"; + } + this.conf.visible = false; +}; +dhtmlXSlider.prototype.isVisible = function () { + return this.conf.visible; +}; +dhtmlXSlider.prototype.linkTo = function (a) { + if (!(a instanceof Array)) { + a = [a]; + } + for (var c = 0; c < a.length && c < 2; c++) { + if (a[c] != null) { + if (typeof a[c] == "string") { + a[c] = document.getElementById(a[c]); + } + this._attachNode(a[c], c); + } + } +}; +dhtmlXSlider.prototype._refreshTooltip = function () { + if (this.conf.tooltip == true) { + if (this.conf.value instanceof Array) { + this._nodes.cont.title = this.conf.value.join(", "); + } else { + this._nodes.cont.title = this.conf.value; + } + } +}; +dhtmlXSlider.prototype.getRunnerIndex = function () { + if (this._r_actv == null) { + return -1; + } + return this._r_actv == this._nodes.runner ? 0 : 1; +}; +function dhtmlXPopup(e) { + var g = this; + this.conf = e || {}; + e = null; + this.mode = this.conf.mode || "bottom"; + this.conf.zi = window.dhx4.newId(); + this.conf.context = this.conf.context == null ? true : window.dhx4.s2b(this.conf.context); + this.conf.IE6_display_fix = this.conf.IE6_display_fix == null ? false : window.dhx4.s2b(this.conf.IE6_display_fix); + this.conf.last_p_click = this.conf.last_body_click = null; + this.p = document.createElement("DIV"); + this.p.style.display = "none"; + this.p.innerHTML = + "
"; + document.body.appendChild(this.p); + this.p.oncontextmenu = function (a) { + if (g.conf.context == false) { + a = a || event; + a.returnValue = false; + return false; + } + }; + this.skinParams = { dhx_terrace: { t0: 19, t1: 9, t2: 19, t3: 9 }, dhx_skyblue: { t0: 12, t1: 9, t2: 12, t3: 9 }, dhx_web: { t0: 12, t1: 9, t2: 12, t3: 9 } }; + this.p.ontouchstart = this.p.onclick = function (j) { + j = j || event; + var h = g.conf.last_p_click != null && g.conf.last_p_click != j.type; + g.conf.last_p_click = j.type; + if (h == true) { + return; + } + g._clearClick = true; + if (g._nodeObj != null) { + g.callEvent("onContentClick", []); + return true; + } + var a = j.target || j.srcElement; + var l = null; + while (a != g.p && a != null) { + if (typeof a._idd != "undefined" && !a._isSeparator) { + l = a._idd; + a = null; + } else { + a = a.parentNode; + } + } + a = null; + if (l != null) { + g.callEvent("onClick", [l]); + if (g != null && g.isVisible != null && g.isVisible() && g.callEvent("onBeforeHide", ["select", j, l]) === true) { + j.cancelBubble = true; + g.hide(); + } + } + }; + this.separator = "DHXSEP_" + window.dhx4.newId(); + this.tpl = []; + this._setTemplate = function (a) { + this.tpl = a.split(","); + }; + this.show = function (h) { + var a = null; + if (arguments.length == 1) { + if (!h) { + h = this.conf.id[0]; + } else { + if (!this._idExists(h)) { + return; + } + } + if (this.conf.toolbar) { + a = this.conf.toolbar._getItemDim(h); + } + if (this.conf.ribbon) { + a = this.conf.ribbon._getItemDim(h); + } + if (this.conf.form) { + a = this.conf.form._getItemDim(h); + } + } else { + if (arguments.length == 4) { + this._clearClick = true; + a = { left: arguments[0], top: arguments[1], width: arguments[2], height: arguments[3] }; + h = null; + } + } + if (!a) { + return; + } + this.p.style.visibility = "hidden"; + this.p.style.display = ""; + this._setPos(a); + this.p.style.zIndex = window.dhx4.zim.reserve(this.conf.zi); + this.p.style.visibility = "visible"; + this._lastId = h; + this.callEvent("onShow", [h]); + }; + this._setPos = function (I, m) { + var v = I.left; + var s = I.top; + var C = I.width; + var L = I.height; + this._posData = { left: v, top: s, width: C, height: L }; + var N = window.dhx4.screenDim(); + var F = m || this.mode; + if (typeof m == "undefined") { + m = false; + } + var P = { top: s - this.p.offsetHeight - N.top, bottom: N.bottom - (s + L + this.p.offsetHeight), left: v - this.p.offsetWidth - N.left, right: N.right - (v + C + this.p.offsetWidth) }; + if (!m && P[F] < 0) { + var J = this._getAvailPos(F, P); + if (J !== false) { + this._setPos(I, J); + return; + } + } + if (F == "top" || F == "bottom") { + var D = this.skinParams[this.conf.skin].t2; + var A = this.skinParams[this.conf.skin].t3; + var r = Math.round(this.p.offsetWidth / 2); + var a = Math.round(this.p.lastChild.offsetWidth / 2); + if (v < N.left) { + var M = Math.min(v + C, N.left); + C = v + C - M; + v = M; + } + if (v + C > N.right) { + C = N.right - v; + } + var u = Math.round(v + C / 2); + var l = u - r; + var K = u - D - a; + var o = u + a + D - this.p.offsetWidth; + if (l < N.left - A) { + l = Math.min(N.left - A, K); + } else { + if (l + this.p.offsetWidth > N.right + A) { + l = Math.max(o, N.right + A - this.p.offsetWidth); + } + } + this.p.style.left = l + "px"; + this.p.style.top = (F == "top" ? s - this.p.offsetHeight : s + L) + "px"; + u = u - l - a; + this.p.lastChild.className = "dhx_popup_arrow dhx_popup_arrow_" + F; + this.p.lastChild.style.top = (F == "top" ? this.p.offsetHeight - this.p.lastChild.offsetHeight : 0) + "px"; + this.p.lastChild.style.left = u + "px"; + } + if (F == "left" || F == "right") { + var D = this.skinParams[this.conf.skin].t0; + var A = this.skinParams[this.conf.skin].t1; + var n = Math.round(this.p.offsetHeight / 2); + var S = Math.round(this.p.lastChild.offsetHeight / 2); + if (s < N.top) { + var j = Math.min(s + L, N.top); + L = s + L - j; + s = j; + } + if (s + L > N.bottom) { + L = N.bottom - s; + } + var u = Math.round(s + L / 2); + var H = u - n; + var Q = u - D - S; + var O = u + S + D - this.p.offsetHeight; + if (H < N.top - A) { + H = Math.min(N.top - A, Q); + } else { + if (H + this.p.offsetHeight > N.bottom + A) { + H = Math.max(O, N.bottom + A - this.p.offsetHeight); + } + } + this.p.style.left = (F == "left" ? v - this.p.offsetWidth : v + C) + "px"; + this.p.style.top = H + "px"; + u = u - H - S; + this.p.lastChild.className = "dhx_popup_arrow dhx_popup_arrow_" + F; + this.p.lastChild.style.left = (F == "left" ? this.p.offsetWidth - this.p.lastChild.offsetWidth : 0) + "px"; + this.p.lastChild.style.top = u + "px"; + } + if (this._IEDisp && this._nodeId != null) { + var E = document.getElementById(this._nodeId); + if (this.conf.IE6_display_fix == true) { + E.style.visibility = "hidden"; + } + window.setTimeout(function () { + E.style.visibility = "visible"; + E = null; + }, 1); + } + }; + this._getAvailPos = function (o, n) { + var j = { top: ["bottom", "right", "left"], bottom: ["top", "right", "left"], left: ["right", "bottom", "top"], right: ["left", "bottom", "top"] }; + var l = null; + for (var m = 0; m < j[o].length; m++) { + if (l == null && n[j[o][m]] > 0) { + l = j[o][m]; + } + } + if (l == null) { + l = "bottom"; + for (var h in n) { + if (n[h] > n[l]) { + l = h; + } + } + } + if (l == o) { + return false; + } + return l; + }; + this._repaint = function () { + if (this.isVisible()) { + this._setPos(this._posData); + } + }; + this.clear = function () { + if (this._nodeObj) { + if (window.dhx4.isIE && typeof window.dhtmlXLayoutObject != "undefined" && this._nodeObj instanceof dhtmlXLayoutObject) { + this.p.onmousedown = null; + } + if (this._nodeObj.unload) { + this._nodeObj.unload(); + } else { + if (this._nodeObj.destruct) { + this._nodeObj.destruct(); + } + } + this._nodeObj = this._nodeId = null; + if (this._nodeObjEv != null) { + for (var h = 0; h < this._nodeObjEv.length; h++) { + this.detachEvent(this._nodeObjEv[h]); + } + this._nodeObjEv = null; + } + } + if (this._IEHoverInited) { + this._IEHoverClear(); + } + var a = this.p.firstChild.firstChild.firstChild; + while (a.childNodes.length > 0) { + a.removeChild(a.lastChild); + } + a = null; + this.itemData = {}; + }; + this.hide = function () { + if (this.p.style.display != "none") { + this.p.style.display = "none"; + window.dhx4.zim.clear(this.conf.zi); + var a = this._lastId; + this._lastId = null; + this.callEvent("onHide", [a]); + this.conf.last_p_click = this.conf.last_body_click = null; + } + }; + this.isVisible = function () { + return this.p.style.display == ""; + }; + this.itemData = {}; + this.getItemData = function (a) { + if (!a) { + return this.itemData; + } + if (this.itemData[a]) { + return this.itemData[a]; + } + return {}; + }; + this.setSkin = function (a) { + this.conf.skin = a; + this.p.className = "dhx_popup_" + this.conf.skin; + if (this._nodeObj != null && typeof this._nodeObj.setSkin == "function") { + this._nodeObj.setSkin(this.conf.skin); + } + this._repaint(); + }; + this.attachList = function (j, o) { + this._setTemplate(j); + this.clear(); + var l = this.p.firstChild.firstChild.firstChild; + for (var n = 0; n < o.length; n++) { + var m = document.createElement("TR"); + if (o[n] != this.separator) { + if (typeof o[n].id == "undefined" || o[n].id == null) { + m._idd = window.dhx4.newId(); + while (this.itemData[m._idd] != null) { + m._idd = window.dhx4.newId(); + } + } else { + m._idd = o[n].id; + } + this.itemData[m._idd] = o[n]; + } + l.appendChild(m); + if (o[n] == this.separator) { + m.className = "dhx_popup_sep"; + m._isSeparator = true; + var s = document.createElement("TD"); + s.className = "dhx_popup_sep"; + s.colSpan = this.tpl.length; + s.innerHTML = "
 
"; + m.appendChild(s); + s = null; + } else { + for (var a = 0; a < this.tpl.length; a++) { + var h = "dhx_popup_td"; + if (this._IEFirstLast && (this.tpl.length == 1 || a == 0 || a == this.tpl.length - 1)) { + if (this.tpl.length == 1) { + h += " dhx_popup_td_single"; + } else { + h += a == 0 ? " dhx_popup_td_first" : " dhx_popup_td_last"; + } + } + var s = document.createElement("TD"); + s.className = h; + s.innerHTML = o[n][this.tpl[a]] || " "; + m.appendChild(s); + s = null; + } + if (this._IEHover) { + m._IEHover = true; + if (!this._IEHoverInited) { + this._IEHoverInit(); + } + } + } + m = null; + } + l = null; + this._repaint(); + }; + this._attachNode = function (l, j) { + this.clear(); + this._nodeId = "dhxpopup_node_" + window.dhx4.newId(); + var a = this.p.firstChild.firstChild.firstChild; + var h = document.createElement("TR"); + h.className = "dhxnode"; + a.appendChild(h); + var m = document.createElement("TD"); + m.className = "dhx_popup_td"; + m.innerHTML = "
"; + if (j.width) { + m.firstChild.style.width = j.width + "px"; + } + if (j.height) { + m.firstChild.style.height = j.height + "px"; + } + h.appendChild(m); + m = h = a = null; + if (typeof this["_attach_init_" + l] == "function") { + this["_attach_init_" + l](j); + this._enableIEVFix(); + } + this._repaint(); + return this._nodeObj; + }; + this.unload = function () { + if (typeof window.addEventListener == "function") { + window.removeEventListener("touchstart", this._doOnClick, false); + window.removeEventListener("click", this._doOnClick, false); + window.removeEventListener("keyup", this._doOnKeyUp, false); + window.removeEventListener("unload", this._doOnUnload, false); + } else { + document.body.detachEvent("onclick", this._doOnClick, false); + document.body.detachEvent("onkeyup", this._doOnKeyUp, false); + document.body.detachEvent("onunload", this._doOnUnload, false); + } + window.dhx4.detachEvent(this.conf.ev_grid_click); + this.clear(); + if (this.conf.toolbarEvent != null && this.conf.toolbar != null) { + if (this.conf.toolbar.detachEvent != null) { + this.conf.toolbar.detachEvent(this.conf.toolbarEvent); + } else { + this.conf.toolbar._getItemDim = null; + } + } + if (this.conf.ribbonEvent != null && this.conf.ribbon != null) { + if (this.conf.ribbon.detachEvent != null) { + this.conf.ribbon.detachEvent(this.conf.ribbonEvent); + } else { + this.conf.ribbon._getItemDim = null; + } + } + if (this.conf.slider != null) { + for (var j = 0; j < this.conf.slider_events.length; j++) { + this.conf.slider.detachEvent(this.conf.slider_events[j]); + } + this.conf.slider_events = null; + this._sliderShow = this._sliderHide = null; + this.conf.slider = null; + } + window.dhx4._eventable(this, "clear"); + this.p.onclick = this.p.ontouchstart = this.p.oncontextmenu = null; + this.p.parentNode.removeChild(this.p); + this.p = null; + for (var h in this.conf) { + this.conf[h] = null; + } + for (var h in this) { + this[h] = null; + } + g = null; + }; + window.dhx4._eventable(this); + this._doOnClick = function (o) { + o = o || event; + var a = g.conf.last_body_click != null && g.conf.last_body_click != o.type; + g.conf.last_body_click = o.type; + if (a == true) { + return; + } + if (g._clearClick == true) { + g._clearClick = false; + return; + } + if (g.conf.form != null) { + var j; + var s = o.target || o.srcElement; + if ((s.tagName || "").toLowerCase() == "option") { + s = s.parentNode; + } + if (s.className != null && s.className.search("dhxform") >= 0) { + if (s.parentNode != null && s.parentNode.parentNode != null && s.parentNode.parentNode._idd != null) { + j = s.parentNode.parentNode._idd; + if (s.parentNode.parentNode._type == "ra") { + j = [s.parentNode.parentNode._group, s.parentNode.parentNode._value]; + } + } + } else { + var m = true; + var n = false; + while (m && !n) { + var l = (s.className || "").toLowerCase(); + if (l.length > 0) { + n = l == "dhxform_btn" || l.search(/dhxeditor_inside/gi) >= 0 || l == "dhxcombo_input" || l.search(/dhxcombolist/gi) >= 0; + } + s = s.parentNode; + m = s != null; + } + if (n) { + return; + } + } + s = null; + if (j != null && g._idExists(j)) { + return; + } + } + if (typeof window.dhtmlXForm != "undefined" && g._nodeObj instanceof window.dhtmlXForm) { + var u = {}; + var l = 0; + var h = g._nodeObj; + h.forEachItem(function (r) { + if (h.getItemType(r) == "combo") { + u[h.getCombo(r).list._listId] = true; + l++; + } + }); + h = null; + if (l > 0) { + var s = o.target || o.srcElement; + var m = true; + var n = false; + while (m == true && n != true) { + var l = (s.className || "").toLowerCase(); + if (l.length > 0 && l.search(/^dhxcombolist/gi) >= 0 && s._listId != null && u[s._listId] == true) { + n = true; + s = null; + } else { + s = s.parentNode; + m = s != null; + } + } + if (n == true) { + return; + } + } + } + if (g.isVisible() && g.callEvent("onBeforeHide", ["click", o]) === true) { + g.hide(); + } + }; + this._doOnKeyUp = function (a) { + a = a || event; + if (a.keyCode == 27) { + if (g.isVisible() && g.callEvent("onBeforeHide", ["esc", a]) === true) { + g.hide(); + } + } + }; + this._doOnUnload = function () { + g.unload(); + }; + if (typeof window.addEventListener == "function") { + window.addEventListener("touchstart", this._doOnClick, false); + window.addEventListener("click", this._doOnClick, false); + window.addEventListener("keyup", this._doOnKeyUp, false); + window.addEventListener("unload", this._doOnUnload, false); + } else { + document.body.attachEvent("onclick", this._doOnClick, false); + document.body.attachEvent("onkeyup", this._doOnKeyUp, false); + document.body.attachEvent("onunload", this._doOnUnload, false); + } + this.conf.ev_grid_click = window.dhx4.attachEvent("_onGridClick", function (h, a) { + if (g._nodeObj != null && g._nodeObj == a) { + return; + } + g._clearClick = false; + g._doOnClick(h); + }); + this._idExists = function (j) { + var a = false; + for (var h = 0; h < this.conf.id.length; h++) { + if (this.conf.id[h] instanceof Array) { + a = a || (this.conf.id[h][0] == j[0] && this.conf.id[h][1] == j[1]); + } else { + a = a || this.conf.id[h] == j; + } + } + return a; + }; + this._IEDisp = window.dhx4.isIE6 || document.compatMode != "CSS1Compat"; + this._IEHover = window.dhx4.isIE6 == true; + if (this._IEHover) { + this._IEHoverInit = function () { + this.p.onmouseover = function () { + var a = event.srcElement; + while (a != this && a._IEHover != true) { + a = a.parentNode; + } + if (a._IEHover) { + if (g._IEHoverTM) { + window.clearTimeout(g._IEHoverTM); + } + if (g._lastIEHover == a) { + return; + } + g._IEHoverRender(a); + a = null; + } + }; + this.p.onmouseout = function () { + if (g._IEHoverTM) { + window.clearTimeout(g._IEHoverTM); + } + g._IEHoverTM = window.setTimeout(function () { + g._IEHoverRender(null); + }, 1); + }; + this._IEHoverRender = function (a) { + if (this._lastIEHover != null) { + if (this._lastIEHover.className.search(/tr_hover/gi) >= 0) { + this._lastIEHover.className = this._lastIEHover.className.replace(/\s{0,}tr_hover/gi, ""); + this._lastIEHover = null; + } + } + if (a != null && a.className.search(/tr_hover/gi) < 0) { + a.className += " tr_hover"; + g._lastIEHover = a; + } + }; + this._IEHoverInited = true; + }; + this._IEHoverClear = function () { + this.p.onmouseover = null; + this.p.onmouseout = null; + this._IEHoverInited = false; + }; + } + this._IEFirstLast = window.dhx4.isIE6 || window.dhx4.isIE7 || window.dhx4.isIE8; + this._enableIEVFix = function () { + if (window.dhx4.isIE6 || window.dhx4.isIE7) { + var h = this.attachEvent("onHide", function () { + document.getElementById(this._nodeId).style.visibility = "hidden"; + }); + var a = this.attachEvent("onShow", function () { + document.getElementById(this._nodeId).style.visibility = "visible"; + }); + if (this._nodeObjEv == null) { + this._nodeObjEv = []; + } + this._nodeObjEv.push(h, a); + } + }; + if (typeof window.dhtmlXToolbarObject != "undefined" && this.conf.toolbar != null && this.conf.toolbar instanceof window.dhtmlXToolbarObject && this.conf.id != null) { + if (!(this.conf.id instanceof Array)) { + this.conf.id = [this.conf.id]; + } + this.skinParent = this.conf.toolbar.conf.skin; + this._doOnToolbarClick = function (h) { + for (var a = 0; a < g.conf.id.length; a++) { + if (h == g.conf.id[a]) { + if (h != g._lastId) { + g.show(h); + g._clearClick = true; + } + } + } + }; + if (typeof dhtmlXToolbarObject.prototype._getItemDim == "undefined") { + dhtmlXToolbarObject.prototype._getItemDim = function (j) { + var a = this.objPull[this.idPrefix + j]; + var h = { left: window.dhx4.absLeft(a.obj), top: window.dhx4.absTop(a.obj), width: a.obj.offsetWidth + (a.arw ? a.arw.offsetWidth : 0), height: a.obj.offsetHeight }; + a = null; + return h; + }; + } + this.conf.toolbarEvent = this.conf.toolbar.attachEvent("onClick", this._doOnToolbarClick); + } + if (typeof window.dhtmlXRibbon != "undefined" && this.conf.ribbon != null && this.conf.ribbon instanceof window.dhtmlXRibbon && this.conf.id != null) { + if (!(this.conf.id instanceof Array)) { + this.conf.id = [this.conf.id]; + } + this.skinParent = this.conf.ribbon.conf.skin; + this._doOnRibbonClick = function (h) { + for (var a = 0; a < g.conf.id.length; a++) { + if (h == g.conf.id[a]) { + if (h != g._lastId) { + g.show(h); + g._clearClick = true; + } + } + } + }; + if (typeof dhtmlXRibbon.prototype._getItemDim == "undefined") { + dhtmlXRibbon.prototype._getItemDim = function (j) { + var a = this._items[j].base; + var h = { left: window.dhx4.absLeft(a), top: window.dhx4.absTop(a), width: a.offsetWidth, height: a.offsetHeight }; + a = null; + return h; + }; + } + this.conf.ribbonEvent = this.conf.ribbon.attachEvent("_showPopup", this._doOnRibbonClick); + } + if (typeof window.dhtmlXForm != "undefined" && this.conf.form != null && this.conf.form instanceof window.dhtmlXForm && this.conf.id != null) { + if (!(this.conf.id instanceof Array)) { + this.conf.id = [this.conf.id]; + } + if (!this.conf.mode) { + this.mode = "right"; + } + this.skinParent = this.conf.form.skin; + if (typeof dhtmlXForm.prototype._getItemDim == "undefined") { + dhtmlXForm.prototype._getItemDim = function (a, h) { + return this.doWithItem(a, "_getDim"); + }; + for (var c in { input: 1, password: 1, select: 1, multiselect: 1, checkbox: 1, radio: 1, button: 1, combo: 1, btn2state: 1, calendar: 1, colorpicker: 1, editor: 1 }) { + if (dhtmlXForm.prototype.items[c] != null) { + dhtmlXForm.prototype.items[c]._getDim = function (h) { + var a = h; + if ({ ta: true, pw: true, se: true, calendar: true, colorpicker: 1, editor: true }[h._type]) { + a = h.childNodes[h._ll ? 1 : 0].childNodes[0]; + } + if ({ ch: true, ra: true, btn2state: true }[h._type]) { + a = h.childNodes[h._ll ? 1 : 0].childNodes[1]; + } + if ({ bt: true }[h._type]) { + a = h.firstChild; + } + if ({ combo: true }[h._type]) { + a = h._combo.DOMParent.firstChild; + } + var j = { left: window.dhx4.absLeft(a), top: window.dhx4.absTop(a), width: a.offsetWidth, height: a.offsetHeight }; + a = null; + return j; + }; + } + } + } + } + if (typeof window.dhtmlXSlider != "undefined" && this.conf.slider != null && this.conf.slider instanceof window.dhtmlXSlider) { + if (!this.conf.mode) { + this.mode = "top"; + } + this.conf.slider_tm = null; + this._sliderShow = function () { + if (g.conf.slider_tm) { + window.clearTimeout(g.conf.slider_tm); + } + var a = g.conf.slider._r_actv; + if (a != null) { + var h = { left: window.dhx4.absLeft(a), top: window.dhx4.absTop(a), width: a.offsetWidth, height: a.offsetHeight }; + g.show(h.left, h.top, h.width, h.height); + a = null; + } + }; + this._sliderHide = function () { + g.conf.slider_tm = window.setTimeout(function () { + g.hide(); + }, 200); + }; + this.conf.slider_events = [this.conf.slider.attachEvent("onMouseDown", this._sliderShow), this.conf.slider.attachEvent("onMouseUp", this._sliderHide), this.conf.slider.attachEvent("onChange", this._sliderShow)]; + } + this.setSkin(this.skinParent || this.conf.skin || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhx_popup") || "dhx_skyblue"); + return this; +} +dhtmlXPopup.prototype.attachObject = function (a) { + return this._attachNode("object", { obj: a }); +}; +dhtmlXPopup.prototype._attach_init_object = function (a) { + this._nodeObj = typeof a.obj == "string" ? document.getElementById(a.obj) : a.obj; + a.obj = null; + document.getElementById(this._nodeId).appendChild(this._nodeObj); + this._nodeObj.style.display = ""; + this._nodeObj.style.visibility = "visible"; +}; +dhtmlXPopup.prototype.attachHTML = function (a) { + return this._attachNode("html", { html: a }); +}; +dhtmlXPopup.prototype._attach_init_html = function (a) { + document.getElementById(this._nodeId).innerHTML = a.html; + this._nodeObj = { text: a.html }; +}; +dhtmlXPopup.prototype.attachForm = function (c, a) { + return this._attachNode("form", { struct: c, width: a }); +}; +dhtmlXPopup.prototype._attach_init_form = function (c) { + var a = this; + this._nodeObj = new dhtmlXForm(this._nodeId, c.struct); + this._nodeObj.setSkin(this.conf.skin); + this._nodeObj.attachEvent("_onBeforeEditorAccess", function () { + a._clearClick = true; + }); + if (this.conf.editorEv != null && this.checkEvent(this.conf.editorEv) == false) { + this.conf.editorEv = null; + } + if (dhtmlXForm.prototype.items.editor != null && this.conf.editorEv == null) { + this.conf.editorEv = this.attachEvent("onShow", function () { + var h = dhtmlXForm.prototype.items.editor.editor; + for (var e in h) { + var j = h[e].base; + var g = false; + while (j != null) { + if (j == this.p) { + g = true; + j = null; + } else { + j = j.parentNode; + } + } + j = null; + if (g == true) { + h[e].cell.conf.cells_cont = null; + h[e].setSizes(); + } + } + h = null; + this.detachEvent(this.conf.editorEv); + this.conf.editorEv = null; + }); + if (this._nodeObjEv == null) { + this._nodeObjEv = []; + } + this._nodeObjEv.push(this.conf.editorEv); + } +}; +dhtmlXPopup.prototype.attachCalendar = function (a) { + return this._attachNode("calendar", a || {}); +}; +dhtmlXPopup.prototype._attach_init_calendar = function (a) { + if (a["double"] == true) { + this._nodeObj = new dhtmlXDoubleCalendarObject(this._nodeId); + this._nodeObj.leftCalendar.setSkin(this.conf.skin); + this._nodeObj.rightCalendar.setSkin(this.conf.skin); + } else { + this._nodeObj = new dhtmlXCalendarObject(this._nodeId); + this._nodeObj.setSkin(this.conf.skin); + } + this._nodeObj.show(); +}; +dhtmlXPopup.prototype.attachGrid = function (c, a) { + return this._attachNode("grid", { width: c || 400, height: a || 200 }); +}; +dhtmlXPopup.prototype._attach_init_grid = function () { + this._nodeObj = new dhtmlXGridObject(this._nodeId); + this._nodeObj.setSkin(this.conf.skin); +}; +dhtmlXPopup.prototype.attachTree = function (e, c, a) { + return this._attachNode("tree", { width: e || 400, height: c || 200, rootId: a || 0 }); +}; +dhtmlXPopup.prototype._attach_init_tree = function (a) { + this._nodeObj = new dhtmlXTreeObject(this._nodeId, "100%", "100%", a.rootId); +}; +dhtmlXPopup.prototype.attachLayout = function (c, a, e) { + return this._attachNode("layout", { width: c || 400, height: a || 200, pattern: e || "3L" }); +}; +dhtmlXPopup.prototype._attach_init_layout = function (a) { + this._nodeObj = new dhtmlXLayoutObject(this._nodeId, a.pattern, this.conf.skin); +}; +dhtmlXPopup.prototype.attachAccordion = function (e, a, c) { + return this._attachNode("accordion", { width: e || 400, height: a || 200, conf: c || {} }); +}; +dhtmlXPopup.prototype._attach_init_accordion = function (a) { + a.conf.parent = this._nodeId; + a.conf.skin = this.conf.skin; + this._nodeObj = new dhtmlXAccordion(a.conf); +}; +dhtmlXPopup.prototype.attachTabbar = function (e, a, c) { + if (typeof c == "string") { + c = { mode: c }; + } else { + if (typeof c != "object" || c == null) { + c = {}; + } + } + return this._attachNode("tabbar", { width: e || 400, height: a || 200, conf: c }); +}; +dhtmlXPopup.prototype._attach_init_tabbar = function (a) { + a.conf.parent = this._nodeId; + a.conf.skin = this.conf.skin; + this._nodeObj = new dhtmlXTabBar(a.conf); +}; +dhtmlXPopup.prototype.attachSidebar = function (e, a, c) { + if (c == null) { + c = {}; + } + return this._attachNode("sidebar", { width: e || 400, height: a || 200, conf: c }); +}; +dhtmlXPopup.prototype._attach_init_sidebar = function (a) { + a.conf.parent = this._nodeId; + a.conf.skin = this.conf.skin; + this._nodeObj = new dhtmlXSideBar(a.conf); +}; +dhtmlXPopup.prototype.attachEditor = function (e, a, c) { + return this._attachNode("editor", { width: e || 400, height: a || 200, conf: c || {} }); +}; +dhtmlXPopup.prototype._attach_init_editor = function (c) { + document.getElementById(this._nodeId).className = "dhxeditor_" + this.conf.skin; + c.conf.parent = this._nodeId; + if (c.conf.skin == null) { + c.conf.skin = this.conf.skin; + } + this._nodeObj = new dhtmlXEditor(c.conf); + var a = this.attachEvent("onShow", function () { + if (this._nodeObj instanceof window.dhtmlXEditor) { + this._nodeObj.setSizes(); + } + }); + if (this._nodeObjEv == null) { + this._nodeObjEv = []; + } + this._nodeObjEv.push(a); +}; +dhtmlXPopup.prototype.attachColorPicker = function (a) { + if (typeof a != "object" || a == null) { + a = {}; + } + return this._attachNode("colorpicker", { conf: a }); +}; +dhtmlXPopup.prototype._attach_init_colorpicker = function (a) { + a.conf.skin = this.conf.skin; + a.conf.parent = this._nodeId; + this._nodeObj = new dhtmlXColorPicker(a.conf); +}; +dhtmlXPopup.prototype.attachCarousel = function (e, a, c) { + if (c == null) { + c = {}; + } + return this._attachNode("carousel", { width: e || 400, height: a || 300, conf: c }); +}; +dhtmlXPopup.prototype._attach_init_carousel = function (a) { + a.conf.parent = this._nodeId; + a.conf.skin = this.conf.skin; + this._nodeObj = new dhtmlXCarousel(a.conf); +}; +function dhtmlXMenuObject(h, j) { + var g = this; + this.conf = { + skin: j || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxmenu") || "dhx_skyblue", + mode: "web", + align: "left", + is_touched: false, + selected: -1, + last_click: -1, + fixed_pos: false, + rtl: false, + icons_path: "", + arrow_ff_fix: navigator.userAgent.indexOf("MSIE") >= 0 && document.compatMode == "BackCompat", + live_id: window.dhx4.newId(), + tags: { root: "menu", item: "item", text_ext: "itemtext", userdata: "userdata", tooltip: "tooltip", hotkey: "hotkey", href: "href" }, + autoload: {}, + hide_tm: {}, + top_mode: true, + top_tmtime: 200, + v_enabled: false, + v: { x1: null, x2: null, y1: null, y2: null }, + dir_toplv: "bottom", + dir_sublv: "right", + auto_overflow: false, + overflow_limit: 0, + of_utm: null, + of_utime: 20, + of_ustep: 3, + of_dtm: null, + of_dtime: 20, + of_dstep: 3, + of_ah: { dhx_skyblue: 24, dhx_web: 25, dhx_terrace: 27 }, + of_ih: { dhx_skyblue: 24, dhx_web: 24, dhx_terrace: 24 }, + tm_sec: 400, + tm_handler: null, + dload: false, + dload_url: "", + dload_icon: false, + dload_params: { action: "loadMenu" }, + dload_pid: "parentId", + tl_botmarg: 1, + tl_rmarg: 0, + tl_ofsleft: 1, + context: false, + ctx_zoneid: false, + ctx_autoshow: true, + ctx_autohide: true, + ctx_hideall: true, + ctx_zones: {}, + ctx_baseid: null, + selected_sub: [], + opened_poly: [], + }; + if (typeof h == "object" && h != null && typeof h.tagName == "undefined") { + if (h.icons_path != null || h.icon_path != null) { + this.conf.icons_path = h.icons_path || h.icon_path; + } + if (h.skin != null) { + this.conf.skin = h.skin; + } + if (h.visible_area) { + this.conf.v_enabled = true; + this.conf.v = { x1: h.visible_area.x1, x2: h.visible_area.x2, y1: h.visible_area.y1, y2: h.visible_area.y2 }; + } + for (var e in { json: 1, xml: 1, items: 1, top_text: 1, align: 1, open_mode: 1, overflow: 1, dynamic: 1, dynamic_icon: 1, context: 1, onload: 1, onclick: 1, oncheckboxclick: 1, onradioclick: 1 }) { + if (h[e] != null) { + this.conf.autoload[e] = h[e]; + } + } + h = h.parent; + } + if (h == null) { + this.base = document.body; + } else { + var c = typeof h == "string" ? document.getElementById(h) : h; + if (c != null) { + this.base = c; + if (!this.base.id) { + this.base.id = "menuBaseId_" + new Date().getTime(); + } + this.base.className += " dhtmlxMenu_" + this.conf.skin + "_Middle dir_left"; + this.base._autoSkinUpdate = true; + if (this.base.oncontextmenu) { + this.base._oldContextMenuHandler = this.base.oncontextmenu; + } + this.conf.ctx_baseid = this.base.id; + this.base.onselectstart = function (a) { + a = a || event; + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + return false; + }; + this.base.oncontextmenu = function (a) { + a = a || event; + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + return false; + }; + } else { + this.base = document.body; + } + } + this.idPrefix = ""; + this.topId = "dhxWebMenuTopId"; + this.idPull = {}; + this.itemPull = {}; + this.userData = {}; + this.radio = {}; + this.setSkin = function (m) { + var n = this.conf.skin; + this.conf.skin = m; + switch (this.conf.skin) { + case "dhx_skyblue": + case "dhx_web": + this.conf.tl_botmarg = 2; + this.conf.tl_rmarg = 1; + this.conf.tl_ofsleft = 1; + break; + case "dhx_terrace": + this.conf.tl_botmarg = 0; + this.conf.tl_rmarg = 0; + this.conf.tl_ofsleft = 0; + break; + } + if (this.base._autoSkinUpdate) { + this.base.className = this.base.className.replace("dhtmlxMenu_" + n + "_Middle", "") + " dhtmlxMenu_" + this.conf.skin + "_Middle"; + } + for (var l in this.idPull) { + this.idPull[l].className = String(this.idPull[l].className).replace(n, this.conf.skin); + } + }; + this.setSkin(this.conf.skin); + this._addSubItemToSelected = function (m, l) { + var a = true; + for (var n = 0; n < this.conf.selected_sub.length; n++) { + if (this.conf.selected_sub[n][0] == m && this.conf.selected_sub[n][1] == l) { + a = false; + } + } + if (a == true) { + this.conf.selected_sub.push(new Array(m, l)); + } + return a; + }; + this._removeSubItemFromSelected = function (o, n) { + var a = new Array(); + var l = false; + for (var r = 0; r < this.conf.selected_sub.length; r++) { + if (this.conf.selected_sub[r][0] == o && this.conf.selected_sub[r][1] == n) { + l = true; + } else { + a[a.length] = this.conf.selected_sub[r]; + } + } + if (l == true) { + this.conf.selected_sub = a; + } + return l; + }; + this._getSubItemToDeselectByPolygon = function (o) { + var a = new Array(); + for (var r = 0; r < this.conf.selected_sub.length; r++) { + if (this.conf.selected_sub[r][1] == o) { + a[a.length] = this.conf.selected_sub[r][0]; + a = a.concat(this._getSubItemToDeselectByPolygon(this.conf.selected_sub[r][0])); + var n = true; + for (var l = 0; l < this.conf.opened_poly.length; l++) { + if (this.conf.opened_poly[l] == this.conf.selected_sub[r][0]) { + n = false; + } + } + if (n == true) { + this.conf.opened_poly[this.conf.opened_poly.length] = this.conf.selected_sub[r][0]; + } + this.conf.selected_sub[r][0] = -1; + this.conf.selected_sub[r][1] = -1; + } + } + return a; + }; + this._hidePolygon = function (a) { + if (this.idPull["polygon_" + a] != null) { + if (this.idPull["polygon_" + a]._zId != null) { + window.dhx4.zim.clear(this.idPull["polygon_" + a]._zId); + } + if (typeof this._menuEffect != "undefined" && this._menuEffect !== false) { + this._hidePolygonEffect("polygon_" + a); + } else { + if (this.idPull["polygon_" + a].style.display == "none") { + return; + } + this.idPull["polygon_" + a].style.display = "none"; + if (this.idPull["arrowup_" + a] != null) { + this.idPull["arrowup_" + a].style.display = "none"; + } + if (this.idPull["arrowdown_" + a] != null) { + this.idPull["arrowdown_" + a].style.display = "none"; + } + this._updateItemComplexState(a, true, false); + if (window.dhx4.isIE6 && this.idPull["polygon_" + a + "_ie6cover"] != null) { + this.idPull["polygon_" + a + "_ie6cover"].style.display = "none"; + } + } + a = String(a).replace(this.idPrefix, ""); + if (a == this.topId) { + a = null; + } + this.callEvent("onHide", [a]); + if (a != null && this.conf.skin == "dhx_terrace" && this.itemPull[this.idPrefix + a].parent == this.idPrefix + this.topId) { + this._improveTerraceButton(this.idPrefix + a, true); + } + } + }; + this._showPolygon = function (H, m) { + var M = this._countVisiblePolygonItems(H); + if (M == 0) { + return; + } + var I = "polygon_" + H; + if (this.idPull[I] != null && this.idPull[H] != null) { + if (this.conf.top_mode && this.conf.mode == "web" && !this.conf.context) { + if (!this.idPull[H]._mouseOver && m == this.conf.dir_toplv) { + return; + } + } + if (!this.conf.fixed_pos) { + this._autoDetectVisibleArea(); + } + var J = 0; + var L = 0; + var O = null; + var D = null; + if (this.idPull[I]._zId == null) { + this.idPull[I]._zId = window.dhx4.newId(); + } + this.idPull[I]._zInd = window.dhx4.zim.reserve(this.idPull[I]._zId); + this.idPull[I].style.visibility = "hidden"; + this.idPull[I].style.left = "0px"; + this.idPull[I].style.top = "0px"; + this.idPull[I].style.display = ""; + this.idPull[I].style.zIndex = this.idPull[I]._zInd; + if (this.conf.auto_overflow) { + if (this.idPull[I].childNodes[1].childNodes[0].offsetHeight > this.conf.v.y2 - this.conf.v.y1) { + var C = Math.max(Math.floor((this.conf.v.y2 - this.conf.v.y1 - this.conf.of_ah[this.conf.skin] * 2) / this.conf.of_ih[this.conf.skin]), 1); + this.conf.overflow_limit = C; + } else { + this.conf.overflow_limit = 0; + if (this.idPull["arrowup_" + H] != null) { + this._removeUpArrow(String(H).replace(this.idPrefix, "")); + } + if (this.idPull["arrowdown_" + H] != null) { + this._removeDownArrow(String(H).replace(this.idPrefix, "")); + } + } + } + if (this.conf.overflow_limit > 0 && this.conf.overflow_limit < M) { + if (this.idPull["arrowup_" + H] == null) { + this._addUpArrow(String(H).replace(this.idPrefix, "")); + } + if (this.idPull["arrowdown_" + H] == null) { + this._addDownArrow(String(H).replace(this.idPrefix, "")); + } + O = this.idPull["arrowup_" + H]; + O.style.display = "none"; + D = this.idPull["arrowdown_" + H]; + D.style.display = "none"; + } + if (this.conf.overflow_limit > 0 && this.conf.overflow_limit < M) { + this.idPull[I].childNodes[1].style.height = this.conf.of_ih[this.conf.skin] * this.conf.overflow_limit + "px"; + O.style.width = D.style.width = this.idPull[I].childNodes[1].style.width = this.idPull[I].childNodes[1].childNodes[0].offsetWidth + "px"; + this.idPull[I].childNodes[1].scrollTop = 0; + O.style.display = ""; + J = O.offsetHeight; + D.style.display = ""; + L = D.offsetHeight; + } else { + this.idPull[I].childNodes[1].style.height = ""; + this.idPull[I].childNodes[1].style.width = ""; + } + if (this.itemPull[H] != null) { + var v = "polygon_" + this.itemPull[H]["parent"]; + } else { + if (this.conf.context) { + var v = this.idPull[this.idPrefix + this.topId]; + } + } + var a = this.idPull[H].tagName != null ? window.dhx4.absLeft(this.idPull[H]) : this.idPull[H][0]; + var N = this.idPull[H].tagName != null ? window.dhx4.absTop(this.idPull[H]) : this.idPull[H][1]; + var l = this.idPull[H].tagName != null ? this.idPull[H].offsetWidth : 0; + var n = this.idPull[H].tagName != null ? this.idPull[H].offsetHeight : 0; + var u = 0; + var s = 0; + var A = this.idPull[I].offsetWidth; + var K = this.idPull[I].offsetHeight; + if (m == "bottom") { + if (this.conf.rtl) { + u = a + (l != null ? l : 0) - A; + } else { + if (this.conf.align == "right") { + u = a + l - A; + } else { + u = a - 1 + (m == this.conf.dir_toplv ? this.conf.tl_rmarg : 0); + } + } + s = N - 1 + n + this.conf.tl_botmarg; + } + if (m == "right") { + u = a + l - 1; + s = N + 2; + } + if (m == "left") { + u = a - this.idPull[I].offsetWidth + 2; + s = N + 2; + } + if (m == "top") { + u = a - 1; + s = N - K + 2; + } + if (this.conf.fixed_pos) { + var F = 65536; + var E = 65536; + } else { + var F = this.conf.v.x2 != null ? this.conf.v.x2 : 0; + var E = this.conf.v.y2 != null ? this.conf.v.y2 : 0; + if (F == 0) { + if (window.innerWidth) { + F = window.innerWidth; + E = window.innerHeight; + } else { + F = document.body.offsetWidth; + E = document.body.scrollHeight; + } + } + } + if (u + A > F && !this.conf.rtl) { + u = a - A + 2; + } + if (u < this.conf.v.x1 && this.conf.rtl) { + u = a + l - 2; + } + if (u < 0) { + u = 0; + } + if (s + K > E && this.conf.v.y2 != null) { + s = Math.max(N + n - K + 2, this.conf.v_enabled ? this.conf.v.y1 + 2 : 2); + if (this.conf.context && this.idPrefix + this.topId == H && D != null) { + s = s - 2; + } + if (this.itemPull[H] != null && !this.conf.context) { + if (this.itemPull[H]["parent"] == this.idPrefix + this.topId) { + s = s - this.base.offsetHeight; + } + } + } + this.idPull[I].style.left = u + "px"; + this.idPull[I].style.top = s + "px"; + if (typeof this._menuEffect != "undefined" && this._menuEffect !== false) { + this._showPolygonEffect(I); + } else { + this.idPull[I].style.visibility = ""; + if (this.conf.overflow_limit > 0 && this.conf.overflow_limit < M) { + this.idPull[I].childNodes[1].scrollTop = 0; + this._checkArrowsState(H); + } + if (window.dhx4.isIE6) { + var r = I + "_ie6cover"; + if (this.idPull[r] == null) { + var o = document.createElement("IFRAME"); + o.className = "dhtmlxMenu_IE6CoverFix_" + this.conf.skin; + o.frameBorder = 0; + o.setAttribute("src", "javascript:false;"); + document.body.insertBefore(o, document.body.firstChild); + this.idPull[r] = o; + } + this.idPull[r].style.left = u + "px"; + this.idPull[r].style.top = s + "px"; + this.idPull[r].style.width = this.idPull[I].offsetWidth + "px"; + this.idPull[r].style.height = this.idPull[I].offsetHeight + "px"; + this.idPull[r].style.zIndex = this.idPull[I].style.zIndex - 1; + this.idPull[r].style.display = ""; + } + } + H = String(H).replace(this.idPrefix, ""); + if (H == this.topId) { + H = null; + } + this.callEvent("onShow", [H]); + if (H != null && this.conf.skin == "dhx_terrace" && this.itemPull[this.idPrefix + H].parent == this.idPrefix + this.topId) { + this._improveTerraceButton(this.idPrefix + H, false); + } + } + }; + this._redistribSubLevelSelection = function (o, n) { + while (this.conf.opened_poly.length > 0) { + this.conf.opened_poly.pop(); + } + var a = this._getSubItemToDeselectByPolygon(n); + this._removeSubItemFromSelected(-1, -1); + for (var l = 0; l < a.length; l++) { + if (this.idPull[a[l]] != null && a[l] != o) { + if (this.itemPull[a[l]]["state"] == "enabled") { + this.idPull[a[l]].className = "sub_item"; + } + } + } + for (var l = 0; l < this.conf.opened_poly.length; l++) { + if (this.conf.opened_poly[l] != n) { + this._hidePolygon(this.conf.opened_poly[l]); + } + } + if (this.itemPull[o]["state"] == "enabled") { + this.idPull[o].className = "sub_item_selected"; + if (this.itemPull[o]["complex"] && this.conf.dload && this.itemPull[o]["loaded"] == "no") { + if (this.conf.dload_icon == true) { + this._updateLoaderIcon(o, true); + } + this.itemPull[o].loaded = "get"; + var m = o.replace(this.idPrefix, ""); + this._dhxdataload.onBeforeXLS = function () { + var s = { params: {} }; + s.params[this.conf.dload_pid] = m; + for (var r in this.conf.dload_params) { + s.params[r] = this.conf.dload_params[r]; + } + return s; + }; + this.loadStruct(this.conf.dload_url); + } + if (this.itemPull[o]["complex"] || (this.conf.dload && this.itemPull[o]["loaded"] == "yes")) { + if (this.itemPull[o]["complex"] && this.idPull["polygon_" + o] != null) { + this._updateItemComplexState(o, true, true); + this._showPolygon(o, this.conf.dir_sublv); + } + } + this._addSubItemToSelected(o, n); + this.conf.selected = o; + } + }; + this._doOnClick = function (l, w, o) { + this.conf.last_click = l; + if (this.itemPull[this.idPrefix + l]["href_link"] != null && this.itemPull[this.idPrefix + l].state == "enabled") { + var r = document.createElement("FORM"); + var u = String(this.itemPull[this.idPrefix + l]["href_link"]).split("?"); + r.action = u[0]; + if (u[1] != null) { + var n = String(u[1]).split("&"); + for (var a = 0; a < n.length; a++) { + var v = String(n[a]).split("="); + var s = document.createElement("INPUT"); + s.type = "hidden"; + s.name = v[0] || ""; + s.value = v[1] || ""; + r.appendChild(s); + } + } + if (this.itemPull[this.idPrefix + l]["href_target"] != null) { + r.target = this.itemPull[this.idPrefix + l]["href_target"]; + } + r.style.display = "none"; + document.body.appendChild(r); + r.submit(); + if (r != null) { + document.body.removeChild(r); + r = null; + } + return; + } + if (w.charAt(0) == "c") { + return; + } + if (w.charAt(1) == "d") { + return; + } + if (w.charAt(2) == "s") { + return; + } + if (this.checkEvent("onClick")) { + this.callEvent("onClick", [l, this.conf.ctx_zoneid, o]); + } else { + if (w.charAt(1) == "d" || (this.conf.mode == "win" && w.charAt(2) == "t")) { + return; + } + } + if (this.conf.context && this._isContextMenuVisible() && this.conf.ctx_autohide) { + this._hideContextMenu(); + } else { + if (this._clearAndHide) { + this._clearAndHide(); + } + } + }; + this._doOnTouchMenu = function (a) { + if (this.conf.is_touched == false) { + this.conf.is_touched = true; + if (this.checkEvent("onTouch")) { + this.callEvent("onTouch", [a]); + } + } + }; + this._searchMenuNode = function (n, r) { + var a = new Array(); + for (var o = 0; o < r.length; o++) { + if (typeof r[o] == "object") { + if (r[o].length == 5) { + if (typeof r[o][0] != "object") { + if (r[o][0].replace(this.idPrefix, "") == n && o == 0) { + a = r; + } + } + } + var l = this._searchMenuNode(n, r[o]); + if (l.length > 0) { + a = l; + } + } + } + return a; + }; + this._getMenuNodes = function (o) { + var l = new Array(); + for (var n in this.itemPull) { + if (this.itemPull[n]["parent"] == o) { + l[l.length] = n; + } + } + return l; + }; + this._genStr = function (a) { + var l = "dhxId_"; + var n = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + for (var m = 0; m < a; m++) { + l += n.charAt(Math.round(Math.random() * (n.length - 1))); + } + return l; + }; + this.getItemType = function (a) { + a = this.idPrefix + a; + if (this.itemPull[a] == null) { + return null; + } + return this.itemPull[a]["type"]; + }; + this.forEachItem = function (m) { + for (var l in this.itemPull) { + m(String(l).replace(this.idPrefix, "")); + } + }; + this._clearAndHide = function () { + g.conf.selected = -1; + g.conf.last_click = -1; + while (g.conf.opened_poly.length > 0) { + g.conf.opened_poly.pop(); + } + for (var a = 0; a < g.conf.selected_sub.length; a++) { + var l = g.conf.selected_sub[a][0]; + if (g.idPull[l] != null) { + if (g.itemPull[l]["state"] == "enabled") { + if (g.idPull[l].className == "sub_item_selected") { + g.idPull[l].className = "sub_item"; + } + if (g.idPull[l].className == "dhtmlxMenu_" + g.conf.skin + "_TopLevel_Item_Selected") { + if (g.itemPull[l]["cssNormal"] != null) { + g.idPull[l].className = g.itemPull[l]["cssNormal"]; + } else { + g.idPull[l].className = "dhtmlxMenu_" + g.conf.skin + "_TopLevel_Item_Normal"; + } + } + } + } + g._hidePolygon(l); + } + g.conf.is_touched = false; + if (g.conf.context && g.conf.ctx_hideall) { + g._hidePolygon(g.idPrefix + g.topId); + } + }; + this._showSubLevelItem = function (l, a) { + if (document.getElementById("arrow_" + this.idPrefix + l) != null) { + document.getElementById("arrow_" + this.idPrefix + l).style.display = a ? "none" : ""; + } + if (document.getElementById("image_" + this.idPrefix + l) != null) { + document.getElementById("image_" + this.idPrefix + l).style.display = a ? "none" : ""; + } + if (document.getElementById(this.idPrefix + l) != null) { + document.getElementById(this.idPrefix + l).style.display = a ? "" : "none"; + } + }; + this._hideSubLevelItem = function (a) { + this._showSubLevelItem(a, true); + }; + this.idPrefix = this._genStr(12) + "_"; + this._bodyClick = function (a) { + a = a || event; + if (a.button == 2 || (window.dhx4.isOpera && a.ctrlKey == true)) { + return; + } + if (g.conf.context) { + if (g.conf.ctx_autohide && (!window.dhx4.isOpera || (g._isContextMenuVisible() && window.dhx4.isOpera))) { + g._hideContextMenu(); + } + } else { + if (g._clearAndHide) { + g._clearAndHide(); + } + } + }; + this._bodyContext = function (m) { + m = m || event; + var l = String((m.srcElement || m.target).className); + if (l.search("dhtmlxMenu") != -1 && l.search("SubLevelArea") != -1) { + return; + } + var a = true; + var n = m.target || m.srcElement; + while (n != null) { + if (n.id != null) { + if (g.isContextZone(n.id)) { + a = false; + } + } + if (n == document.body) { + a = false; + } + n = n.parentNode; + } + if (a) { + g.hideContextMenu(); + } + }; + if (typeof window.addEventListener != "undefined") { + window.addEventListener("click", this._bodyClick, false); + window.addEventListener("contextmenu", this._bodyContext, false); + } else { + document.body.attachEvent("onclick", this._bodyClick); + document.body.attachEvent("oncontextmenu", this._bodyContext); + } + this.unload = function () { + window.dhx4._eventable(this, "clear"); + dhtmlXMenuObject.prototype.liveInst[this.conf.live_id] = null; + try { + delete dhtmlXMenuObject.prototype.liveInst[this.conf.live_id]; + } catch (m) {} + this.conf.live_id = null; + if (typeof window.addEventListener == "function") { + window.removeEventListener("click", this._bodyClick, false); + window.removeEventListener("contextmenu", this._bodyContext, false); + } else { + document.body.detachEvent("onclick", this._bodyClick); + document.body.detachEvent("oncontextmenu", this._bodyContext); + } + this._bodyClick = null; + this._bodyContext = null; + this.removeItem(this.idPrefix + this.topId, true); + this.itemPull = null; + this.idPull = null; + if (this.conf.context) { + for (var l in this.conf.ctx_zones) { + this.removeContextZone(l); + } + } + if (this.cont != null) { + this.cont.className = ""; + this.cont.parentNode.removeChild(this.cont); + this.cont = null; + } + if (this.base != null) { + if (!this.conf.context) { + this.base.className = ""; + } + if (!this.conf.context) { + this.base.oncontextmenu = this.base._oldContextMenuHandler || null; + } + this.base.onselectstart = null; + this.base = null; + } + for (var l in this) { + this[l] = null; + } + g = null; + }; + dhtmlXMenuObject.prototype.liveInst[this.conf.live_id] = this; + window.dhx4._enableDataLoading(this, "_initObj", "_xmlToJson", this.conf.tags.root, { struct: true }); + window.dhx4._eventable(this); + if (window.dhx4.s2b(this.conf.autoload.context) == true) { + this.renderAsContextMenu(); + } + if (this.conf.autoload.dynamic != null) { + this.enableDynamicLoading(this.conf.autoload.dynamic, window.dhx4.s2b(this.conf.autoload.dynamic_icon)); + } else { + if (this.conf.autoload.items != null) { + this.loadStruct(this.conf.autoload.items, this.conf.autoload.onload); + } else { + if (this.conf.autoload.json != null) { + this.loadStruct(this.conf.autoload.json, this.conf.autoload.onload); + } else { + if (this.conf.autoload.xml != null) { + this.loadStruct(this.conf.autoload.xml, this.conf.autoload.onload); + } + } + } + } + for (var e in { onclick: 1, oncheckboxclick: 1, onradioclick: 1 }) { + if (this.conf.autoload[e] != null) { + if (typeof this.conf.autoload[e] == "function") { + this.attachEvent(e, this.conf.autoload[e]); + } else { + if (typeof window[this.conf.autoload[e]] == "function") { + this.attachEvent(e, window[this.conf.autoload[e]]); + } + } + } + } + if (this.conf.autoload.top_text != null) { + this.setTopText(this.conf.autoload.top_text); + } + if (this.conf.autoload.align != null) { + this.setAlign(this.conf.autoload.align); + } + if (this.conf.autoload.open_mode != null) { + this.setOpenMode(this.conf.autoload.open_mode); + } + if (this.conf.autoload.overflow != null) { + this.setOverflowHeight(this.conf.autoload.overflow); + } + for (var e in this.conf.autoload) { + this.conf.autoload[e] = null; + delete this.conf.autoload[e]; + } + this.conf.autoload = null; + return this; +} +dhtmlXMenuObject.prototype._init = function () { + if (this._isInited == true) { + return; + } + if (this.conf.dload) { + this._dhxdataload.onBeforeXLS = function () { + var e = { params: {} }; + for (var c in this.conf.dload_params) { + e.params[c] = this.conf.dload_params[c]; + } + return e; + }; + this.loadStruct(this.conf.dload_url); + } else { + this._initTopLevelMenu(); + this._isInited = true; + } +}; +dhtmlXMenuObject.prototype._countVisiblePolygonItems = function (j) { + var g = 0; + for (var c in this.itemPull) { + var e = this.itemPull[c]["parent"]; + var h = this.itemPull[c]["type"]; + if (this.idPull[c] != null) { + if (e == j && (h == "item" || h == "radio" || h == "checkbox") && this.idPull[c].style.display != "none") { + g++; + } + } + } + return g; +}; +dhtmlXMenuObject.prototype._redefineComplexState = function (c) { + if (this.idPrefix + this.topId == c) { + return; + } + if (this.idPull["polygon_" + c] != null && this.idPull[c] != null) { + var a = this._countVisiblePolygonItems(c); + if (a > 0 && !this.itemPull[c]["complex"]) { + this._updateItemComplexState(c, true, false); + } + if (a == 0 && this.itemPull[c]["complex"]) { + this._updateItemComplexState(c, false, false); + } + } +}; +dhtmlXMenuObject.prototype._updateItemComplexState = function (h, e, g) { + if (!this.conf.context && this._getItemLevelType(h.replace(this.idPrefix, "")) == "TopLevel") { + this.itemPull[h]["complex"] = e; + return; + } + if (this.idPull[h] == null || this.itemPull[h] == null) { + return; + } + this.itemPull[h]["complex"] = e; + if (h == this.idPrefix + this.topId) { + return; + } + var a = null; + var c = this.idPull[h].childNodes[this.conf.rtl ? 0 : 2]; + if (c.childNodes[0]) { + if (String(c.childNodes[0].className).search("complex_arrow") === 0) { + a = c.childNodes[0]; + } + } + if (this.itemPull[h]["complex"]) { + if (a == null) { + a = document.createElement("DIV"); + a.className = "complex_arrow"; + a.id = "arrow_" + h; + while (c.childNodes.length > 0) { + c.removeChild(c.childNodes[0]); + } + c.appendChild(a); + } + if (this.conf.dload && this.itemPull[h].loaded == "get" && this.conf.dload_icon) { + if (a.className != "complex_arrow_loading") { + a.className = "complex_arrow_loading"; + } + } else { + a.className = "complex_arrow"; + } + return; + } + if (!this.itemPull[h]["complex"] && a != null) { + c.removeChild(a); + if (this.itemPull[h]["hotkey_backup"] != null && this.setHotKey) { + this.setHotKey(h.replace(this.idPrefix, ""), this.itemPull[h]["hotkey_backup"]); + } + } +}; +dhtmlXMenuObject.prototype._getItemLevelType = function (a) { + return this.itemPull[this.idPrefix + a]["parent"] == this.idPrefix + this.topId ? "TopLevel" : "SubLevelArea"; +}; +dhtmlXMenuObject.prototype.setIconsPath = function (a) { + this.conf.icons_path = a; +}; +dhtmlXMenuObject.prototype._updateItemImage = function (g, h) { + g = this.idPrefix + g; + var n = this.itemPull[g]["type"]; + if (n == "checkbox" || n == "radio") { + return; + } + var j = this.itemPull[g]["parent"] == this.idPrefix + this.topId && !this.conf.context; + var l = null; + if (j) { + for (var a = 0; a < this.idPull[g].childNodes.length; a++) { + try { + if (this.idPull[g].childNodes[a].className == "dhtmlxMenu_TopLevel_Item_Icon") { + l = this.idPull[g].childNodes[a]; + } + } catch (m) {} + } + } else { + try { + var l = this.idPull[g].childNodes[this.conf.rtl ? 2 : 0].childNodes[0]; + } catch (m) {} + if (!(l != null && typeof l.className != "undefined" && l.className == "sub_icon")) { + l = null; + } + } + var r = this.itemPull[g][this.itemPull[g]["state"] == "enabled" ? "imgen" : "imgdis"]; + if (r.length > 0) { + if (l != null) { + l.src = this.conf.icons_path + r; + } else { + if (j) { + var l = document.createElement("IMG"); + l.className = "dhtmlxMenu_TopLevel_Item_Icon"; + l.src = this.conf.icons_path + r; + l.border = "0"; + l.id = "image_" + g; + if (!this.conf.rtl && this.idPull[g].childNodes.length > 0) { + this.idPull[g].insertBefore(l, this.idPull[g].childNodes[0]); + } else { + this.idPull[g].appendChild(l); + } + } else { + var l = document.createElement("IMG"); + l.className = "sub_icon"; + l.src = this.conf.icons_path + r; + l.border = "0"; + l.id = "image_" + g; + var o = this.idPull[g].childNodes[this.conf.rtl ? 2 : 0]; + while (o.childNodes.length > 0) { + o.removeChild(o.childNodes[0]); + } + o.appendChild(l); + } + } + } else { + if (l != null) { + var c = l.parentNode; + c.removeChild(l); + c.innerHTML = " "; + c = l = null; + } + } +}; +dhtmlXMenuObject.prototype._getAllParents = function (j) { + var e = new Array(); + for (var c in this.itemPull) { + if (this.itemPull[c]["parent"] == j) { + e[e.length] = this.itemPull[c]["id"]; + if (this.itemPull[c]["complex"]) { + var g = this._getAllParents(this.itemPull[c]["id"]); + for (var h = 0; h < g.length; h++) { + e[e.length] = g[h]; + } + } + } + } + return e; +}; +dhtmlXMenuObject.prototype._autoDetectVisibleArea = function () { + if (this.conf.v_enabled) { + return; + } + var a = window.dhx4.screenDim(); + this.conf.v.x1 = a.left; + this.conf.v.x2 = a.right; + this.conf.v.y1 = a.top; + this.conf.v.y2 = a.bottom; +}; +dhtmlXMenuObject.prototype.getItemPosition = function (h) { + h = this.idPrefix + h; + var g = -1; + if (this.itemPull[h] == null) { + return g; + } + var a = this.itemPull[h]["parent"]; + var e = this.idPull["polygon_" + a] != null ? this.idPull["polygon_" + a].tbd : this.cont; + for (var c = 0; c < e.childNodes.length; c++) { + if (e.childNodes[c] == this.idPull["separator_" + h] || e.childNodes[c] == this.idPull[h]) { + g = c; + } + } + return g; +}; +dhtmlXMenuObject.prototype.setItemPosition = function (l, j) { + l = this.idPrefix + l; + if (this.idPull[l] == null) { + return; + } + var c = this.itemPull[l]["parent"] == this.idPrefix + this.topId; + var a = this.idPull[l]; + var g = this.getItemPosition(l.replace(this.idPrefix, "")); + var e = this.itemPull[l]["parent"]; + var h = this.idPull["polygon_" + e] != null ? this.idPull["polygon_" + e].tbd : this.cont; + h.removeChild(h.childNodes[g]); + if (j < 0) { + j = 0; + } + if (c && j < 1) { + j = 1; + } + if (j < h.childNodes.length) { + h.insertBefore(a, h.childNodes[j]); + } else { + h.appendChild(a); + } +}; +dhtmlXMenuObject.prototype.getParentId = function (a) { + a = this.idPrefix + a; + if (this.itemPull[a] == null) { + return null; + } + return (this.itemPull[a]["parent"] != null ? this.itemPull[a]["parent"] : this.topId).replace(this.idPrefix, ""); +}; +dhtmlXMenuObject.prototype.hide = function () { + this._clearAndHide(); +}; +dhtmlXMenuObject.prototype.clearAll = function () { + this.removeItem(this.idPrefix + this.topId, true); + this._isInited = false; + this.idPrefix = this._genStr(12) + "_"; + this.itemPull = {}; +}; +if (typeof dhtmlXMenuObject.prototype.liveInst == "undefined") { + dhtmlXMenuObject.prototype.liveInst = {}; +} +dhtmlXMenuObject.prototype._redistribTopLevelSelection = function (g, c) { + var a = this._getSubItemToDeselectByPolygon("parent"); + this._removeSubItemFromSelected(-1, -1); + for (var e = 0; e < a.length; e++) { + if (a[e] != g) { + this._hidePolygon(a[e]); + } + if (this.idPull[a[e]] != null && a[e] != g) { + this.idPull[a[e]].className = this.idPull[a[e]].className.replace(/Selected/g, "Normal"); + } + } + if (this.itemPull[this.idPrefix + g]["state"] == "enabled") { + this.idPull[this.idPrefix + g].className = "dhtmlxMenu_" + this.conf.skin + "_TopLevel_Item_Selected"; + this._addSubItemToSelected(this.idPrefix + g, "parent"); + this.conf.selected = this.conf.mode == "win" ? (this.conf.selected != -1 ? g : this.conf.selected) : g; + if (this.itemPull[this.idPrefix + g]["complex"] && this.conf.selected != -1) { + this._showPolygon(this.idPrefix + g, this.conf.dir_toplv); + } + } +}; +dhtmlXMenuObject.prototype._initTopLevelMenu = function () { + this.conf.dir_toplv = "bottom"; + this.conf.dir_sublv = this.conf.rtl ? "left" : "right"; + if (this.conf.context) { + this.idPull[this.idPrefix + this.topId] = new Array(0, 0); + this._addSubMenuPolygon(this.idPrefix + this.topId, this.idPrefix + this.topId); + } else { + var a = this._getMenuNodes(this.idPrefix + this.topId); + for (var c = 0; c < a.length; c++) { + if (this.itemPull[a[c]]["type"] == "item") { + this._renderToplevelItem(a[c], null); + } + if (this.itemPull[a[c]]["type"] == "separator") { + this._renderSeparator(a[c], null); + } + } + } +}; +dhtmlXMenuObject.prototype._renderToplevelItem = function (l, j) { + var h = this; + var a = document.createElement("DIV"); + a.id = l; + if (this.itemPull[l]["state"] == "enabled" && this.itemPull[l]["cssNormal"] != null) { + a.className = this.itemPull[l]["cssNormal"]; + } else { + a.className = "dhtmlxMenu_" + this.conf.skin + "_TopLevel_Item_" + (this.itemPull[l]["state"] == "enabled" ? "Normal" : "Disabled"); + } + if (this.itemPull[l]["title"] != "") { + var g = document.createElement("DIV"); + g.className = "top_level_text"; + g.innerHTML = this.itemPull[l]["title"]; + a.appendChild(g); + } + if (this.itemPull[l]["tip"].length > 0) { + a.title = this.itemPull[l]["tip"]; + } + if (this.itemPull[l]["imgen"] != "" || this.itemPull[l]["imgdis"] != "") { + var e = this.itemPull[l][this.itemPull[l]["state"] == "enabled" ? "imgen" : "imgdis"]; + if (e) { + var c = document.createElement("IMG"); + c.border = "0"; + c.id = "image_" + l; + c.src = this.conf.icons_path + e; + c.className = "dhtmlxMenu_TopLevel_Item_Icon"; + if (a.childNodes.length > 0 && !this.conf.rtl) { + a.insertBefore(c, a.childNodes[0]); + } else { + a.appendChild(c); + } + } + } + a.onselectstart = function (m) { + m = m || event; + if (m.preventDefault) { + m.preventDefault(); + } else { + m.returnValue = false; + } + return false; + }; + a.oncontextmenu = function (m) { + m = m || event; + if (m.preventDefault) { + m.preventDefault(); + } else { + m.returnValue = false; + } + return false; + }; + if (!this.cont) { + this.cont = document.createElement("DIV"); + this.cont.dir = "ltr"; + this.cont.className = this.conf.align == "right" ? "align_right" : "align_left"; + this.base.appendChild(this.cont); + } + if (j != null) { + j++; + if (j < 0) { + j = 0; + } + if (j > this.cont.childNodes.length - 1) { + j = null; + } + } + if (j != null) { + this.cont.insertBefore(a, this.cont.childNodes[j]); + } else { + this.cont.appendChild(a); + } + this.idPull[a.id] = a; + if (this.itemPull[l]["complex"] && !this.conf.dload) { + this._addSubMenuPolygon(this.itemPull[l]["id"], this.itemPull[l]["id"]); + } + a.onmouseover = function () { + if (h.conf.mode == "web") { + window.clearTimeout(h.conf.tm_handler); + } + var m = h._getSubItemToDeselectByPolygon("parent"); + h._removeSubItemFromSelected(-1, -1); + for (var o = 0; o < m.length; o++) { + if (m[o] != this.id) { + h._hidePolygon(m[o]); + } + if (h.idPull[m[o]] != null && m[o] != this.id) { + if (h.itemPull[m[o]]["cssNormal"] != null) { + h.idPull[m[o]].className = h.itemPull[m[o]]["cssNormal"]; + } else { + if (h.idPull[m[o]].className == "sub_item_selected") { + h.idPull[m[o]].className = "sub_item"; + } + h.idPull[m[o]].className = h.idPull[m[o]].className.replace(/Selected/g, "Normal"); + } + } + } + if (h.itemPull[this.id]["state"] == "enabled") { + this.className = "dhtmlxMenu_" + h.conf.skin + "_TopLevel_Item_Selected"; + h._addSubItemToSelected(this.id, "parent"); + h.conf.selected = h.conf.mode == "win" ? (h.conf.selected != -1 ? this.id : h.conf.selected) : this.id; + if (h.conf.dload) { + if (h.itemPull[this.id].loaded == "no") { + this._dynLoadTM = new Date().getTime(); + h.itemPull[this.id].loaded = "get"; + var r = this.id.replace(h.idPrefix, ""); + h._dhxdataload.onBeforeXLS = function () { + var u = { params: {} }; + u.params[this.conf.dload_pid] = r; + for (var s in this.conf.dload_params) { + u.params[s] = this.conf.dload_params[s]; + } + return u; + }; + h.loadStruct(h.conf.dload_url); + } + if (h.conf.top_mode && h.conf.mode == "web" && !h.conf.context) { + this._mouseOver = true; + } + } + if (!h.conf.dload || (h.conf.dload && (!h.itemPull[this.id]["loaded"] || h.itemPull[this.id]["loaded"] == "yes"))) { + if (h.itemPull[this.id]["complex"] && h.conf.selected != -1) { + if (h.conf.top_mode && h.conf.mode == "web" && !h.conf.context) { + this._mouseOver = true; + var n = this.id; + this._menuOpenTM = window.setTimeout(function () { + h._showPolygon(n, h.conf.dir_toplv); + }, h.conf.top_tmtime); + } else { + h._showPolygon(this.id, h.conf.dir_toplv); + } + } + } + } + h._doOnTouchMenu(this.id.replace(h.idPrefix, "")); + }; + a.onmouseout = function () { + if (!(h.itemPull[this.id]["complex"] && h.conf.selected != -1) && h.itemPull[this.id]["state"] == "enabled") { + if (h.itemPull[this.id]["cssNormal"] != null) { + a.className = h.itemPull[this.id]["cssNormal"]; + } else { + a.className = "dhtmlxMenu_" + h.conf.skin + "_TopLevel_Item_Normal"; + } + } + if (h.conf.mode == "web") { + window.clearTimeout(h.conf.tm_handler); + h.conf.tm_handler = window.setTimeout( + function () { + h._clearAndHide(); + }, + h.conf.tm_sec, + "JavaScript" + ); + } + if (h.conf.top_mode && h.conf.mode == "web" && !h.conf.context) { + this._mouseOver = false; + window.clearTimeout(this._menuOpenTM); + } + }; + a.onclick = function (r) { + if (h.conf.mode == "web") { + window.clearTimeout(h.conf.tm_handler); + } + if (h.conf.mode != "web" && h.itemPull[this.id]["state"] == "disabled") { + return; + } + r = r || event; + r.cancelBubble = true; + if (r.preventDefault) { + r.preventDefault(); + } else { + r.returnValue = false; + } + if (h.conf.mode == "win") { + if (h.itemPull[this.id]["complex"]) { + if (h.conf.selected == this.id) { + h.conf.selected = -1; + var o = false; + } else { + h.conf.selected = this.id; + var o = true; + } + if (o) { + h._showPolygon(this.id, h.conf.dir_toplv); + } else { + h._hidePolygon(this.id); + } + } + } + var m = h.itemPull[this.id]["complex"] ? "c" : "-"; + var u = h.itemPull[this.id]["state"] != "enabled" ? "d" : "-"; + var n = { ctrl: r.ctrlKey, alt: r.altKey, shift: r.shiftKey }; + h._doOnClick(this.id.replace(h.idPrefix, ""), m + u + "t", n); + return false; + }; + if (this.conf.skin == "dhx_terrace") { + this._improveTerraceSkin(); + } +}; +dhtmlXMenuObject.prototype._addSubMenuPolygon = function (l, h) { + var c = this._renderSublevelPolygon(l, h); + var a = this._getMenuNodes(h); + for (e = 0; e < a.length; e++) { + if (this.itemPull[a[e]]["type"] == "separator") { + this._renderSeparator(a[e], null); + } else { + this._renderSublevelItem(a[e], null); + } + } + if (l == h) { + var g = "topLevel"; + } else { + var g = "subLevel"; + } + for (var e = 0; e < a.length; e++) { + if (this.itemPull[a[e]]["complex"]) { + this._addSubMenuPolygon(l, this.itemPull[a[e]]["id"]); + } + } +}; +dhtmlXMenuObject.prototype._renderSublevelPolygon = function (h, g) { + var c = document.createElement("DIV"); + c.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_Polygon " + (this.conf.rtl ? "dir_right" : ""); + c.dir = "ltr"; + c.oncontextmenu = function (j) { + j = j || event; + if (j.preventDefault) { + j.preventDefault(); + } else { + j.returnValue = false; + } + j.cancelBubble = true; + return false; + }; + c.id = "polygon_" + g; + c.onclick = function (j) { + j = j || event; + j.cancelBubble = true; + }; + c.style.display = "none"; + document.body.insertBefore(c, document.body.firstChild); + c.innerHTML = '
'; + var e = document.createElement("TABLE"); + e.className = "dhtmlxMebu_SubLevelArea_Tbl"; + e.cellSpacing = 0; + e.cellPadding = 0; + e.border = 0; + var a = document.createElement("TBODY"); + e.appendChild(a); + c.childNodes[1].appendChild(e); + c.tbl = e; + c.tbd = a; + this.idPull[c.id] = c; + if (this.sxDacProc != null) { + this.idPull["sxDac_" + g] = new this.sxDacProc(c, c.className); + if (window.dhx4.isIE) { + this.idPull["sxDac_" + g]._setSpeed(this.dacSpeedIE); + this.idPull["sxDac_" + g]._setCustomCycle(this.dacCyclesIE); + } else { + this.idPull["sxDac_" + g]._setSpeed(this.dacSpeed); + this.idPull["sxDac_" + g]._setCustomCycle(this.dacCycles); + } + } + return c; +}; +dhtmlXMenuObject.prototype._renderSublevelItem = function (a, o) { + var m = this; + var n = document.createElement("TR"); + n.className = this.itemPull[a]["state"] == "enabled" ? "sub_item" : "sub_item_dis"; + var l = document.createElement("TD"); + l.className = "sub_item_icon"; + var r = this.itemPull[a][this.itemPull[a]["state"] == "enabled" ? "imgen" : "imgdis"]; + if (r != "") { + var v = this.itemPull[a]["type"]; + if (v == "checkbox" || v == "radio") { + var h = document.createElement("DIV"); + h.id = "image_" + this.itemPull[a]["id"]; + h.className = "sub_icon " + r; + l.appendChild(h); + } + if (!(v == "checkbox" || v == "radio")) { + var h = document.createElement("IMG"); + h.id = "image_" + this.itemPull[a]["id"]; + h.className = "sub_icon"; + h.src = this.conf.icons_path + r; + l.appendChild(h); + } + } else { + l.innerHTML = " "; + } + var j = document.createElement("TD"); + j.className = "sub_item_text"; + if (this.itemPull[a]["title"] != "") { + var u = document.createElement("DIV"); + u.className = "sub_item_text"; + u.innerHTML = this.itemPull[a]["title"]; + j.appendChild(u); + } else { + j.innerHTML = " "; + } + var g = document.createElement("TD"); + g.className = "sub_item_hk"; + if (this.itemPull[a]["complex"]) { + var c = document.createElement("DIV"); + c.className = "complex_arrow"; + c.id = "arrow_" + this.itemPull[a]["id"]; + g.appendChild(c); + } else { + if (this.itemPull[a]["hotkey"].length > 0 && !this.itemPull[a]["complex"]) { + var e = document.createElement("DIV"); + e.className = "sub_item_hk"; + e.innerHTML = this.itemPull[a]["hotkey"]; + g.appendChild(e); + } else { + g.innerHTML = " "; + } + } + n.appendChild(this.conf.rtl ? g : l); + n.appendChild(j); + n.appendChild(this.conf.rtl ? l : g); + n.id = this.itemPull[a]["id"]; + n.parent = this.itemPull[a]["parent"]; + if (this.itemPull[a]["tip"].length > 0) { + n.title = this.itemPull[a]["tip"]; + } + n.onselectstart = function (w) { + w = w || event; + if (w.preventDefault) { + w.preventDefault(); + } else { + w.returnValue = false; + } + return false; + }; + n.onmouseover = function (w) { + if (m.conf.hide_tm[this.id]) { + window.clearTimeout(m.conf.hide_tm[this.id]); + } + if (m.conf.mode == "web") { + window.clearTimeout(m.conf.tm_handler); + } + if (!this._visible) { + m._redistribSubLevelSelection(this.id, this.parent); + } + this._visible = true; + }; + n.onmouseout = function () { + if (m.conf.mode == "web") { + if (m.conf.tm_handler) { + window.clearTimeout(m.conf.tm_handler); + } + m.conf.tm_handler = window.setTimeout( + function () { + if (m && m._clearAndHide) { + m._clearAndHide(); + } + }, + m.conf.tm_sec, + "JavaScript" + ); + } + var w = this; + if (m.conf.hide_tm[this.id]) { + window.clearTimeout(m.conf.hide_tm[this.id]); + } + m.conf.hide_tm[this.id] = window.setTimeout(function () { + w._visible = false; + }, 50); + }; + n.onclick = function (x) { + if (!m.checkEvent("onClick") && m.itemPull[this.id]["complex"]) { + return; + } + x = x || event; + x.cancelBubble = true; + if (x.preventDefault) { + x.preventDefault(); + } else { + x.returnValue = false; + } + tc = m.itemPull[this.id]["complex"] ? "c" : "-"; + td = m.itemPull[this.id]["state"] == "enabled" ? "-" : "d"; + var w = { ctrl: x.ctrlKey, alt: x.altKey, shift: x.shiftKey }; + switch (m.itemPull[this.id]["type"]) { + case "checkbox": + m._checkboxOnClickHandler(this.id.replace(m.idPrefix, ""), tc + td + "n", w); + break; + case "radio": + m._radioOnClickHandler(this.id.replace(m.idPrefix, ""), tc + td + "n", w); + break; + case "item": + m._doOnClick(this.id.replace(m.idPrefix, ""), tc + td + "n", w); + break; + } + return false; + }; + var s = this.idPull["polygon_" + this.itemPull[a]["parent"]]; + if (o != null) { + o++; + if (o < 0) { + o = 0; + } + if (o > s.tbd.childNodes.length - 1) { + o = null; + } + } + if (o != null && s.tbd.childNodes[o] != null) { + s.tbd.insertBefore(n, s.tbd.childNodes[o]); + } else { + s.tbd.appendChild(n); + } + this.idPull[n.id] = n; +}; +dhtmlXMenuObject.prototype._renderSeparator = function (c, l) { + var a = this.conf.context ? "SubLevelArea" : this.itemPull[c]["parent"] == this.idPrefix + this.topId ? "TopLevel" : "SubLevelArea"; + if (a == "TopLevel" && this.conf.context) { + return; + } + var h = this; + if (a != "TopLevel") { + var j = document.createElement("TR"); + j.className = "sub_sep"; + var e = document.createElement("TD"); + e.colSpan = "3"; + j.appendChild(e); + } + var g = document.createElement("DIV"); + g.id = "separator_" + c; + g.className = a == "TopLevel" ? "top_sep" : "sub_sep"; + g.onselectstart = function (o) { + o = o || event; + if (o.preventDefault) { + o.preventDefault(); + } else { + o.returnValue = false; + } + }; + g.onclick = function (r) { + r = r || event; + r.cancelBubble = true; + var o = { ctrl: r.ctrlKey, alt: r.altKey, shift: r.shiftKey }; + h._doOnClick(this.id.replace("separator_" + h.idPrefix, ""), "--s", o); + }; + if (a == "TopLevel") { + if (l != null) { + l++; + if (l < 0) { + l = 0; + } + if (this.cont.childNodes[l] != null) { + this.cont.insertBefore(g, this.cont.childNodes[l]); + } else { + this.cont.appendChild(g); + } + } else { + var n = this.cont.childNodes[this.cont.childNodes.length - 1]; + if (String(n).search("TopLevel_Text") == -1) { + this.cont.appendChild(g); + } else { + this.cont.insertBefore(g, n); + } + } + this.idPull[g.id] = g; + } else { + var m = this.idPull["polygon_" + this.itemPull[c]["parent"]]; + if (l != null) { + l++; + if (l < 0) { + l = 0; + } + if (l > m.tbd.childNodes.length - 1) { + l = null; + } + } + if (l != null && m.tbd.childNodes[l] != null) { + m.tbd.insertBefore(j, m.tbd.childNodes[l]); + } else { + m.tbd.appendChild(j); + } + e.appendChild(g); + this.idPull[g.id] = j; + } +}; +dhtmlXMenuObject.prototype.addNewSeparator = function (a, c) { + c = this.idPrefix + (c != null ? c : this._genStr(24)); + var e = this.idPrefix + this.getParentId(a); + this._addItemIntoGlobalStrorage(c, e, "", "separator", false, "", ""); + this._renderSeparator(c, this.getItemPosition(a)); +}; +dhtmlXMenuObject.prototype._initObj = function (r, s, l) { + if (!(r instanceof Array)) { + l = r.parentId; + if (l != null && String(l).indexOf(this.idPrefix) !== 0) { + l = this.idPrefix + String(l); + } + r = r.items; + } + for (var e = 0; e < r.length; e++) { + if (typeof r[e].id == "undefined" || r[e].id == null) { + r[e].id = this._genStr(24); + } + if (r[e].text == null) { + r[e].text = ""; + } + if (String(r[e].id).indexOf(this.idPrefix) !== 0) { + r[e].id = this.idPrefix + String(r[e].id); + } + var g = { type: "item", tip: "", hotkey: "", state: "enabled", imgen: "", imgdis: "" }; + for (var u in g) { + if (typeof r[e][u] == "undefined") { + r[e][u] = g[u]; + } + } + if (r[e].imgen == "" && r[e].img != null) { + r[e].imgen = r[e].img; + } + if (r[e].imgdis == "" && r[e].img_disabled != null) { + r[e].imgdis = r[e].img_disabled; + } + if (r[e].title == null && r[e].text != null) { + r[e].title = r[e].text; + } + if (r[e].href != null) { + if (r[e].href.link != null) { + r[e].href_link = r[e].href.link; + } + if (r[e].href.target != null) { + r[e].href_target = r[e].href.target; + } + } + if (r[e].userdata != null) { + for (var u in r[e].userdata) { + this.userData[r[e].id + "_" + u] = r[e].userdata[u]; + } + } + if (typeof r[e].enabled != "undefined" && window.dhx4.s2b(r[e].enabled) == false) { + r[e].state = "disabled"; + } else { + if (typeof r[e].disabled != "undefined" && window.dhx4.s2b(r[e].disabled) == true) { + r[e].state = "disabled"; + } + } + if (typeof r[e].parent == "undefined") { + r[e].parent = l != null ? l : this.idPrefix + this.topId; + } + if (r[e].type == "checkbox") { + r[e].checked = window.dhx4.s2b(r[e].checked); + r[e].imgen = r[e].imgdis = "chbx_" + (r[e].checked ? "1" : "0"); + } + if (r[e].type == "radio") { + r[e].checked = window.dhx4.s2b(r[e].checked); + r[e].imgen = r[e].imgdis = "rdbt_" + (r[e].checked ? "1" : "0"); + if (typeof r[e].group == "undefined" || r[e].group == null) { + r[e].group = this._genStr(24); + } + if (this.radio[r[e].group] == null) { + this.radio[r[e].group] = []; + } + this.radio[r[e].group].push(r[e].id); + } + this.itemPull[r[e].id] = r[e]; + if (r[e].items != null && r[e].items.length > 0) { + this.itemPull[r[e].id].complex = true; + this._initObj(r[e].items, true, r[e].id); + } else { + if (this.conf.dload && r[e].complex == true) { + this.itemPull[r[e].id].loaded = "no"; + } + } + this.itemPull[r[e].id].items = null; + } + if (s !== true) { + if (this.conf.dload == true) { + if (l == null) { + this._initTopLevelMenu(); + } else { + this._addSubMenuPolygon(l, l); + if (this.conf.selected == l) { + var o = this.itemPull[l].parent == this.idPrefix + this.topId; + var c = o && !this.conf.context ? this.conf.dir_toplv : this.conf.dir_sublv; + var h = false; + if (o && this.conf.top_mode && this.conf.mode == "web" && !this.conf.context) { + var v = this.idPull[l]; + if (v._mouseOver == true) { + var j = this.conf.top_tmtime - (new Date().getTime() - v._dynLoadTM); + if (j > 1) { + var n = l; + var m = this; + v._menuOpenTM = window.setTimeout(function () { + m._showPolygon(n, c); + m = n = null; + }, j); + h = true; + } + } + } + if (!h) { + this._showPolygon(l, c); + } + } + this.itemPull[l].loaded = "yes"; + if (this.conf.dload_icon == true) { + this._updateLoaderIcon(l, false); + } + } + } else { + this._init(); + } + } +}; +dhtmlXMenuObject.prototype._xmlToJson = function (h, g) { + var l = []; + if (g == null) { + var m = h.getElementsByTagName(this.conf.tags.root); + if (m == null || (m != null && m.length == 0)) { + return { items: [] }; + } + m = m[0]; + } else { + m = h; + } + if (m.getAttribute("parentId") != null) { + g = this.idPrefix + m.getAttribute("parentId"); + } + for (var c = 0; c < m.childNodes.length; c++) { + if (typeof m.childNodes[c].tagName != "undefined" && String(m.childNodes[c].tagName).toLowerCase() == this.conf.tags.item) { + var a = m.childNodes[c]; + var s = { + id: this.idPrefix + (a.getAttribute("id") || this._genStr(24)), + title: a.getAttribute("text") || "", + imgen: a.getAttribute("img") || "", + imgdis: a.getAttribute("imgdis") || "", + tip: "", + hotkey: "", + type: a.getAttribute("type") || "item", + }; + if (a.getAttribute("cssNormal") != null) { + s.cssNormal = a.getAttribute("cssNormal"); + } + if (s.type == "checkbox") { + s.checked = a.getAttribute("checked"); + } + if (s.type == "radio") { + s.checked = a.getAttribute("checked"); + s.group = a.getAttribute("group"); + } + s.state = "enabled"; + if (a.getAttribute("enabled") != null && window.dhx4.s2b(a.getAttribute("enabled")) == false) { + s.state = "disabled"; + } else { + if (a.getAttribute("disabled") != null && window.dhx4.s2b(a.getAttribute("disabled")) == true) { + s.state = "disabled"; + } + } + s.parent = g != null ? g : this.idPrefix + this.topId; + if (this.conf.dload) { + s.complex = a.getAttribute("complex") != null; + if (s.complex) { + s.loaded = "no"; + } + } else { + var e = this._xmlToJson(a, s.id); + s.items = e.items; + s.complex = s.items.length > 0; + } + for (var n = 0; n < a.childNodes.length; n++) { + if (typeof a.childNodes[n].tagName != "undefined") { + var o = String(a.childNodes[n].tagName || "").toLowerCase(); + if (o == this.conf.tags.userdata) { + var j = a.childNodes[n]; + if (j.getAttribute("name") != null) { + this.userData[s.id + "_" + j.getAttribute("name")] = j.firstChild != null && j.firstChild.nodeValue != null ? j.firstChild.nodeValue : ""; + } + } + if (o == this.conf.tags.text_ext) { + s.title = a.childNodes[n].firstChild.nodeValue; + } + if (o == this.conf.tags.tooltip) { + s.tip = a.childNodes[n].firstChild.nodeValue; + } + if (o == this.conf.tags.hotkey) { + s.hotkey = a.childNodes[n].firstChild.nodeValue; + } + if (o == this.conf.tags.href && s.type == "item") { + s.href_link = a.childNodes[n].firstChild.nodeValue; + if (a.childNodes[n].getAttribute("target") != null) { + s.href_target = a.childNodes[n].getAttribute("target"); + } + } + } + } + l.push(s); + } + } + var a = { parentId: g, items: l }; + return a; +}; +dhtmlXMenuObject.prototype.enableDynamicLoading = function (a, c) { + this.conf.dload = true; + this.conf.dload_url = a; + this.conf.dload_sign = String(this.conf.dload_url).search(/\?/) == -1 ? "?" : "&"; + this.conf.dload_icon = c; + this._init(); +}; +dhtmlXMenuObject.prototype._updateLoaderIcon = function (g, e) { + if (this.idPull[g] == null) { + return; + } + if (String(this.idPull[g].className).search("TopLevel_Item") >= 0) { + return; + } + var c = this.conf.rtl ? 0 : 2; + if (!this.idPull[g].childNodes[c]) { + return; + } + if (!this.idPull[g].childNodes[c].childNodes[0]) { + return; + } + var a = this.idPull[g].childNodes[c].childNodes[0]; + if (String(a.className).search("complex_arrow") === 0) { + a.className = "complex_arrow" + (e ? "_loading" : ""); + } +}; +dhtmlXMenuObject.prototype.addNewSibling = function (g, h, a, c, e, m) { + var l = this.idPrefix + (h != null ? h : this._genStr(24)); + var j = this.idPrefix + (g != null ? this.getParentId(g) : this.topId); + this._addItemIntoGlobalStrorage(l, j, a, "item", c, e, m); + if (j == this.idPrefix + this.topId && !this.conf.context) { + this._renderToplevelItem(l, this.getItemPosition(g)); + } else { + this._renderSublevelItem(l, this.getItemPosition(g)); + } +}; +dhtmlXMenuObject.prototype.addNewChild = function (l, j, g, a, c, e, h) { + if (l == null) { + if (this.conf.context) { + l = this.topId; + } else { + this.addNewSibling(l, g, a, c, e, h); + if (j != null) { + this.setItemPosition(g, j); + } + return; + } + } + g = this.idPrefix + (g != null ? g : this._genStr(24)); + if (this.setHotKey) { + this.setHotKey(l, ""); + } + l = this.idPrefix + l; + this._addItemIntoGlobalStrorage(g, l, a, "item", c, e, h); + if (this.idPull["polygon_" + l] == null) { + this._renderSublevelPolygon(l, l); + } + this._renderSublevelItem(g, j - 1); + this._redefineComplexState(l); +}; +dhtmlXMenuObject.prototype.removeItem = function (g, j, h) { + if (!j) { + g = this.idPrefix + g; + } + var l = null; + if (g != this.idPrefix + this.topId) { + if (this.itemPull[g] == null) { + return; + } + if (this.idPull["polygon_" + g] && this.idPull["polygon_" + g]._tmShow) { + window.clearTimeout(this.idPull["polygon_" + g]._tmShow); + } + var s = this.itemPull[g]["type"]; + if (s == "separator") { + var r = this.idPull["separator_" + g]; + if (this.itemPull[g]["parent"] == this.idPrefix + this.topId) { + r.onclick = null; + r.onselectstart = null; + r.id = null; + r.parentNode.removeChild(r); + } else { + r.childNodes[0].childNodes[0].onclick = null; + r.childNodes[0].childNodes[0].onselectstart = null; + r.childNodes[0].childNodes[0].id = null; + r.childNodes[0].removeChild(r.childNodes[0].childNodes[0]); + r.removeChild(r.childNodes[0]); + r.parentNode.removeChild(r); + } + this.idPull["separator_" + g] = null; + this.itemPull[g] = null; + delete this.idPull["separator_" + g]; + delete this.itemPull[g]; + r = null; + } else { + l = this.itemPull[g]["parent"]; + var r = this.idPull[g]; + r.onclick = null; + r.oncontextmenu = null; + r.onmouseover = null; + r.onmouseout = null; + r.onselectstart = null; + r.id = null; + while (r.childNodes.length > 0) { + r.removeChild(r.childNodes[0]); + } + r.parentNode.removeChild(r); + this.idPull[g] = null; + this.itemPull[g] = null; + delete this.idPull[g]; + delete this.itemPull[g]; + r = null; + } + s = null; + } + for (var n in this.itemPull) { + if (this.itemPull[n]["parent"] == g) { + this.removeItem(n, true, true); + } + } + var o = new Array(g); + if (l != null && !h) { + if (this.idPull["polygon_" + l] != null) { + if (this.idPull["polygon_" + l].tbd.childNodes.length == 0) { + o.push(l); + this._updateItemComplexState(l, false, false); + } + } + } + for (var c = 0; c < o.length; c++) { + if (this.idPull["polygon_" + o[c]]) { + var e = this.idPull["polygon_" + o[c]]; + e.onclick = null; + e.oncontextmenu = null; + e.tbl.removeChild(e.tbd); + e.tbd = null; + e.childNodes[1].removeChild(e.tbl); + e.tbl = null; + e.id = null; + e.parentNode.removeChild(e); + e = null; + if (window.dhx4.isIE6) { + var m = "polygon_" + o[c] + "_ie6cover"; + if (this.idPull[m] != null) { + document.body.removeChild(this.idPull[m]); + delete this.idPull[m]; + } + } + if (this.idPull["arrowup_" + g] != null && this._removeArrow) { + this._removeArrow("arrowup_" + g); + } + if (this.idPull["arrowdown_" + g] != null && this._removeArrow) { + this._removeArrow("arrowdown_" + g); + } + this.idPull["polygon_" + o[c]] = null; + delete this.idPull["polygon_" + o[c]]; + } + } + o = null; + if (this.conf.skin == "dhx_terrace" && arguments.length == 1) { + this._improveTerraceSkin(); + } +}; +dhtmlXMenuObject.prototype._addItemIntoGlobalStrorage = function (m, a, e, l, g, c, j) { + var h = { id: m, title: e, imgen: c != null ? c : "", imgdis: j != null ? j : "", type: l, state: g == true ? "disabled" : "enabled", parent: a, complex: false, hotkey: "", tip: "" }; + this.itemPull[h.id] = h; +}; +dhtmlXMenuObject.prototype.renderAsContextMenu = function () { + this.conf.context = true; + if (this.base._autoSkinUpdate == true) { + this.base.className = this.base.className.replace("dhtmlxMenu_" + this.conf.skin + "_Middle", ""); + this.base._autoSkinUpdate = false; + } + if (this.conf.ctx_baseid != null) { + this.addContextZone(this.conf.ctx_baseid); + } +}; +dhtmlXMenuObject.prototype.addContextZone = function (c) { + if (c == document.body) { + c = "document.body." + this.idPrefix; + var g = document.body; + } else { + if (typeof c == "string") { + var g = document.getElementById(c); + } else { + var g = c; + } + } + var j = false; + for (var e in this.conf.ctx_zones) { + j = j || e == c || this.conf.ctx_zones[e] == g; + } + if (j == true) { + return false; + } + this.conf.ctx_zones[c] = g; + var h = this; + if (window.dhx4.isOpera) { + this.operaContext = function (a) { + h._doOnContextMenuOpera(a, h); + }; + g.addEventListener("mouseup", this.operaContext, false); + } else { + if (g.oncontextmenu != null && !g._oldContextMenuHandler) { + g._oldContextMenuHandler = g.oncontextmenu; + } + g.oncontextmenu = function (l) { + for (var a in dhtmlXMenuObject.prototype.liveInst) { + if (a != h.conf.live_id) { + if (dhtmlXMenuObject.prototype.liveInst[a].context) { + dhtmlXMenuObject.prototype.liveInst[a]._hideContextMenu(); + } + } + } + l = l || event; + l.cancelBubble = true; + if (l.preventDefault) { + l.preventDefault(); + } else { + l.returnValue = false; + } + h._doOnContextBeforeCall(l, this); + return false; + }; + } +}; +dhtmlXMenuObject.prototype._doOnContextMenuOpera = function (g, a) { + for (var c in dhtmlXMenuObject.prototype.liveInst) { + if (c != a.conf.live_id) { + if (dhtmlXMenuObject.prototype.liveInst[c].context) { + dhtmlXMenuObject.prototype.liveInst[c]._hideContextMenu(); + } + } + } + g.cancelBubble = true; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + if (g.button == 0 && g.ctrlKey == true) { + a._doOnContextBeforeCall(g, this); + } + return false; +}; +dhtmlXMenuObject.prototype.removeContextZone = function (a) { + if (!this.isContextZone(a)) { + return false; + } + if (a == document.body) { + a = "document.body." + this.idPrefix; + } + var c = this.conf.ctx_zones[a]; + if (window.dhx4.isOpera) { + c.removeEventListener("mouseup", this.operaContext, false); + } else { + c.oncontextmenu = c._oldContextMenuHandler != null ? c._oldContextMenuHandler : null; + c._oldContextMenuHandler = null; + } + try { + this.conf.ctx_zones[a] = null; + delete this.conf.ctx_zones[a]; + } catch (g) {} + return true; +}; +dhtmlXMenuObject.prototype.isContextZone = function (a) { + if (a == document.body && this.conf.ctx_zones["document.body." + this.idPrefix] != null) { + return true; + } + var c = false; + if (this.conf.ctx_zones[a] != null) { + if (this.conf.ctx_zones[a] == document.getElementById(a)) { + c = true; + } + } + return c; +}; +dhtmlXMenuObject.prototype._isContextMenuVisible = function () { + if (this.idPull["polygon_" + this.idPrefix + this.topId] == null) { + return false; + } + return this.idPull["polygon_" + this.idPrefix + this.topId].style.display == ""; +}; +dhtmlXMenuObject.prototype._showContextMenu = function (c, e, a) { + this._clearAndHide(); + if (this.idPull["polygon_" + this.idPrefix + this.topId] == null) { + return false; + } + window.clearTimeout(this.conf.tm_handler); + this.idPull[this.idPrefix + this.topId] = new Array(c, e); + this._showPolygon(this.idPrefix + this.topId, "bottom"); + this.callEvent("onContextMenu", [a]); +}; +dhtmlXMenuObject.prototype._hideContextMenu = function () { + if (this.idPull["polygon_" + this.idPrefix + this.topId] == null) { + return false; + } + this._clearAndHide(); + this._hidePolygon(this.idPrefix + this.topId); +}; +dhtmlXMenuObject.prototype._doOnContextBeforeCall = function (j, m) { + this.conf.ctx_zoneid = m.id; + this._clearAndHide(); + this._hideContextMenu(); + var h = j.srcElement || j.target; + var c = window.dhx4.isIE || window.dhx4.isOpera || window.dhx4.isKHTML || window.dhx4.isEdge ? j.offsetX : j.layerX; + var a = window.dhx4.isIE || window.dhx4.isOpera || window.dhx4.isKHTML || window.dhx4.isEdge ? j.offsetY : j.layerY; + var l = window.dhx4.absLeft(h) + c; + var g = window.dhx4.absTop(h) + a; + if (this.checkEvent("onBeforeContextMenu")) { + if (this.callEvent("onBeforeContextMenu", [m.id, j])) { + if (this.conf.ctx_autoshow) { + this._showContextMenu(l, g, m.id); + this.callEvent("onAfterContextMenu", [m.id, j]); + } + } + } else { + if (this.conf.ctx_autoshow) { + this._showContextMenu(l, g, m.id); + this.callEvent("onAfterContextMenu", [m.id]); + } + } +}; +dhtmlXMenuObject.prototype.showContextMenu = function (a, c) { + this._showContextMenu(a, c, false); +}; +dhtmlXMenuObject.prototype.hideContextMenu = function () { + this._hideContextMenu(); +}; +dhtmlXMenuObject.prototype.setAutoShowMode = function (a) { + this.conf.ctx_autoshow = a == true ? true : false; +}; +dhtmlXMenuObject.prototype.setAutoHideMode = function (a) { + this.conf.ctx_autohide = a == true ? true : false; +}; +dhtmlXMenuObject.prototype.setContextMenuHideAllMode = function (a) { + this.conf.ctx_hideall = a == true ? true : false; +}; +dhtmlXMenuObject.prototype.getContextMenuHideAllMode = function () { + return this.conf.ctx_hideall; +}; +dhtmlXMenuObject.prototype._improveTerraceSkin = function () { + for (var e in this.itemPull) { + if (this.itemPull[e].parent == this.idPrefix + this.topId && this.idPull[e] != null) { + var h = false; + var g = false; + if (this.idPull[e].parentNode.firstChild == this.idPull[e]) { + h = true; + } + if (this.idPull[e].parentNode.lastChild == this.idPull[e]) { + g = true; + } + for (var c in this.itemPull) { + if (this.itemPull[c].type == "separator" && this.itemPull[c].parent == this.idPrefix + this.topId) { + if (this.idPull[e].nextSibling == this.idPull["separator_" + c]) { + g = true; + } + if (this.idPull[e].previousSibling == this.idPull["separator_" + c]) { + h = true; + } + } + } + this.idPull[e].style.borderLeftWidth = h ? "1px" : "0px"; + this.idPull[e].style.borderTopLeftRadius = this.idPull[e].style.borderBottomLeftRadius = h ? "3px" : "0px"; + this.idPull[e].style.borderTopRightRadius = this.idPull[e].style.borderBottomRightRadius = g ? "3px" : "0px"; + this.idPull[e]._bl = h; + this.idPull[e]._br = g; + } + } +}; +dhtmlXMenuObject.prototype._improveTerraceButton = function (c, a) { + if (a) { + this.idPull[c].style.borderBottomLeftRadius = this.idPull[c]._bl ? "3px" : "0px"; + this.idPull[c].style.borderBottomRightRadius = this.idPull[c]._br ? "3px" : "0px"; + } else { + this.idPull[c].style.borderBottomLeftRadius = "0px"; + this.idPull[c].style.borderBottomRightRadius = "0px"; + } +}; +if (typeof window.dhtmlXCellObject != "undefined") { + dhtmlXCellObject.prototype._createNode_menu = function (h, c, g, a, e) { + if (typeof e != "undefined") { + h = e; + } else { + h = document.createElement("DIV"); + h.className = "dhx_cell_menu_" + (this.conf.borders ? "def" : "no_borders"); + h.appendChild(document.createElement("DIV")); + } + this.cell.insertBefore(h, this.cell.childNodes[this.conf.idx.toolbar || this.conf.idx.cont]); + this.conf.ofs_nodes.t.menu = true; + this._updateIdx(); + return h; + }; + dhtmlXCellObject.prototype.attachMenu = function (a) { + if (this.dataNodes.menu) { + return; + } + this.callEvent("_onBeforeContentAttach", ["menu"]); + if (typeof a == "undefined") { + a = {}; + } + if (typeof a.skin == "undefined") { + a.skin = this.conf.skin; + } + a.parent = this._attachObject("menu").firstChild; + this.dataNodes.menu = new dhtmlXMenuObject(a); + this._adjustCont(this._idd); + a.parent = null; + a = null; + this.callEvent("_onContentAttach", []); + return this.dataNodes.menu; + }; + dhtmlXCellObject.prototype.detachMenu = function () { + if (!this.dataNodes.menu) { + return; + } + this.dataNodes.menu.unload(); + this.dataNodes.menu = null; + delete this.dataNodes.menu; + this._detachObject("menu"); + }; + dhtmlXCellObject.prototype.showMenu = function () { + this._mtbShowHide("menu", ""); + }; + dhtmlXCellObject.prototype.hideMenu = function () { + this._mtbShowHide("menu", "none"); + }; + dhtmlXCellObject.prototype.getAttachedMenu = function () { + return this.dataNodes.menu; + }; +} +dhtmlXMenuObject.prototype.setItemEnabled = function (a) { + this._changeItemState(a, "enabled", this._getItemLevelType(a)); +}; +dhtmlXMenuObject.prototype.setItemDisabled = function (a) { + this._changeItemState(a, "disabled", this._getItemLevelType(a)); +}; +dhtmlXMenuObject.prototype.isItemEnabled = function (a) { + return this.itemPull[this.idPrefix + a] != null ? this.itemPull[this.idPrefix + a]["state"] == "enabled" : false; +}; +dhtmlXMenuObject.prototype._changeItemState = function (h, g, c) { + var e = false; + var a = this.idPrefix + h; + if (this.itemPull[a] != null && this.idPull[a] != null) { + if (this.itemPull[a]["state"] != g) { + this.itemPull[a]["state"] = g; + if (this.itemPull[a]["parent"] == this.idPrefix + this.topId && !this.conf.context) { + this.idPull[a].className = "dhtmlxMenu_" + this.conf.skin + "_TopLevel_Item_" + (this.itemPull[a]["state"] == "enabled" ? "Normal" : "Disabled"); + } else { + this.idPull[a].className = "sub_item" + (this.itemPull[a]["state"] == "enabled" ? "" : "_dis"); + } + this._updateItemComplexState(this.idPrefix + h, this.itemPull[this.idPrefix + h]["complex"], false); + this._updateItemImage(h, c); + if (this.idPrefix + this.conf.last_click == a && c != "TopLevel") { + this._redistribSubLevelSelection(a, this.itemPull[a]["parent"]); + } + if (c == "TopLevel" && !this.conf.context) { + } + } + } + return e; +}; +dhtmlXMenuObject.prototype.getItemText = function (a) { + return this.itemPull[this.idPrefix + a] != null ? this.itemPull[this.idPrefix + a]["title"] : ""; +}; +dhtmlXMenuObject.prototype.setItemText = function (j, h) { + j = this.idPrefix + j; + if (this.itemPull[j] != null && this.idPull[j] != null) { + this._clearAndHide(); + this.itemPull[j]["title"] = h; + if (this.itemPull[j]["parent"] == this.idPrefix + this.topId && !this.conf.context) { + var g = null; + for (var a = 0; a < this.idPull[j].childNodes.length; a++) { + try { + if (this.idPull[j].childNodes[a].className == "top_level_text") { + g = this.idPull[j].childNodes[a]; + } + } catch (c) {} + } + if (String(this.itemPull[j]["title"]).length == "" || this.itemPull[j]["title"] == null) { + if (g != null) { + g.parentNode.removeChild(g); + } + } else { + if (!g) { + g = document.createElement("DIV"); + g.className = "top_level_text"; + if (this.conf.rtl && this.idPull[j].childNodes.length > 0) { + this.idPull[j].insertBefore(g, this.idPull[j].childNodes[0]); + } else { + this.idPull[j].appendChild(g); + } + } + g.innerHTML = this.itemPull[j]["title"]; + } + } else { + var g = null; + for (var a = 0; a < this.idPull[j].childNodes[1].childNodes.length; a++) { + if (String(this.idPull[j].childNodes[1].childNodes[a].className || "") == "sub_item_text") { + g = this.idPull[j].childNodes[1].childNodes[a]; + } + } + if (String(this.itemPull[j]["title"]).length == "" || this.itemPull[j]["title"] == null) { + if (g) { + g.parentNode.removeChild(g); + g = null; + this.idPull[j].childNodes[1].innerHTML = " "; + } + } else { + if (!g) { + g = document.createElement("DIV"); + g.className = "sub_item_text"; + this.idPull[j].childNodes[1].innerHTML = ""; + this.idPull[j].childNodes[1].appendChild(g); + } + g.innerHTML = this.itemPull[j]["title"]; + } + } + } +}; +dhtmlXMenuObject.prototype.loadFromHTML = function (e, j, g) { + var c = this.conf.tags.item; + this.conf.tags.item = "div"; + var h = typeof e == "string" ? document.getElementById(e) : e; + var a = this._xmlToJson(h, this.idPrefix + this.topId); + this._initObj(a); + this.conf.tags.item = c; + if (j) { + h.parentNode.removeChild(h); + } + h = objOd = null; + if (onload != null) { + if (typeof g == "function") { + g(); + } else { + if (typeof window[g] == "function") { + window[g](); + } + } + } +}; +dhtmlXMenuObject.prototype.hideItem = function (a) { + this._changeItemVisible(a, false); +}; +dhtmlXMenuObject.prototype.showItem = function (a) { + this._changeItemVisible(a, true); +}; +dhtmlXMenuObject.prototype.isItemHidden = function (c) { + var a = null; + if (this.idPull[this.idPrefix + c] != null) { + a = this.idPull[this.idPrefix + c].style.display == "none"; + } + return a; +}; +dhtmlXMenuObject.prototype._changeItemVisible = function (e, c) { + var a = this.idPrefix + e; + if (this.itemPull[a] == null) { + return; + } + if (this.itemPull[a]["type"] == "separator") { + a = "separator_" + a; + } + if (this.idPull[a] == null) { + return; + } + this.idPull[a].style.display = c ? "" : "none"; + this._redefineComplexState(this.itemPull[this.idPrefix + e]["parent"]); +}; +dhtmlXMenuObject.prototype.setUserData = function (e, a, c) { + this.userData[this.idPrefix + e + "_" + a] = c; +}; +dhtmlXMenuObject.prototype.getUserData = function (c, a) { + return this.userData[this.idPrefix + c + "_" + a] != null ? this.userData[this.idPrefix + c + "_" + a] : null; +}; +dhtmlXMenuObject.prototype.setOpenMode = function (a) { + this.conf.mode = a == "win" ? "win" : "web"; +}; +dhtmlXMenuObject.prototype.setWebModeTimeout = function (a) { + this.conf.tm_sec = !isNaN(a) ? a : 400; +}; +dhtmlXMenuObject.prototype.getItemImage = function (c) { + var a = new Array(null, null); + c = this.idPrefix + c; + if (this.itemPull[c]["type"] == "item") { + a[0] = this.itemPull[c]["imgen"]; + a[1] = this.itemPull[c]["imgdis"]; + } + return a; +}; +dhtmlXMenuObject.prototype.setItemImage = function (e, a, c) { + if (this.itemPull[this.idPrefix + e]["type"] != "item") { + return; + } + this.itemPull[this.idPrefix + e]["imgen"] = a; + this.itemPull[this.idPrefix + e]["imgdis"] = c; + this._updateItemImage(e, this._getItemLevelType(e)); +}; +dhtmlXMenuObject.prototype.clearItemImage = function (a) { + this.setItemImage(a, "", ""); +}; +dhtmlXMenuObject.prototype.setVisibleArea = function (c, a, g, e) { + this.conf.v_enabled = true; + this.conf.v.x1 = c; + this.conf.v.x2 = a; + this.conf.v.y1 = g; + this.conf.v.y2 = e; +}; +dhtmlXMenuObject.prototype.setTooltip = function (c, a) { + c = this.idPrefix + c; + if (!(this.itemPull[c] != null && this.idPull[c] != null)) { + return; + } + this.idPull[c].title = a.length > 0 ? a : null; + this.itemPull[c]["tip"] = a; +}; +dhtmlXMenuObject.prototype.getTooltip = function (a) { + if (this.itemPull[this.idPrefix + a] == null) { + return null; + } + return this.itemPull[this.idPrefix + a]["tip"]; +}; +dhtmlXMenuObject.prototype.setTopText = function (a) { + if (this.conf.context) { + return; + } + if (this._topText == null) { + this._topText = document.createElement("DIV"); + this._topText.className = "dhtmlxMenu_TopLevel_Text_" + (this.conf.rtl ? "left" : this.conf.align == "left" ? "right" : "left"); + this.base.appendChild(this._topText); + } + this._topText.innerHTML = a; +}; +dhtmlXMenuObject.prototype.setAlign = function (a) { + if (this.conf.align == a) { + return; + } + if (a == "left" || a == "right") { + this.conf.align = a; + if (this.cont) { + this.cont.className = this.conf.align == "right" ? "align_right" : "align_left"; + } + if (this._topText != null) { + this._topText.className = "dhtmlxMenu_TopLevel_Text_" + (this.conf.align == "left" ? "right" : "left"); + } + } +}; +dhtmlXMenuObject.prototype.setHref = function (e, a, c) { + if (this.itemPull[this.idPrefix + e] == null) { + return; + } + this.itemPull[this.idPrefix + e]["href_link"] = a; + if (c != null) { + this.itemPull[this.idPrefix + e]["href_target"] = c; + } +}; +dhtmlXMenuObject.prototype.clearHref = function (a) { + if (this.itemPull[this.idPrefix + a] == null) { + return; + } + delete this.itemPull[this.idPrefix + a]["href_link"]; + delete this.itemPull[this.idPrefix + a]["href_target"]; +}; +dhtmlXMenuObject.prototype.getCircuit = function (c) { + var a = new Array(c); + while (this.getParentId(c) != this.topId) { + c = this.getParentId(c); + a[a.length] = c; + } + return a.reverse(); +}; +dhtmlXMenuObject.prototype._getCheckboxState = function (a) { + if (this.itemPull[this.idPrefix + a] == null) { + return null; + } + return this.itemPull[this.idPrefix + a]["checked"]; +}; +dhtmlXMenuObject.prototype._setCheckboxState = function (c, a) { + if (this.itemPull[this.idPrefix + c] == null) { + return; + } + this.itemPull[this.idPrefix + c]["checked"] = a; +}; +dhtmlXMenuObject.prototype._updateCheckboxImage = function (c) { + if (this.idPull[this.idPrefix + c] == null) { + return; + } + this.itemPull[this.idPrefix + c]["imgen"] = "chbx_" + (this._getCheckboxState(c) ? "1" : "0"); + this.itemPull[this.idPrefix + c]["imgdis"] = this.itemPull[this.idPrefix + c]["imgen"]; + try { + this.idPull[this.idPrefix + c].childNodes[this.conf.rtl ? 2 : 0].childNodes[0].className = "sub_icon " + this.itemPull[this.idPrefix + c]["imgen"]; + } catch (a) {} +}; +dhtmlXMenuObject.prototype._checkboxOnClickHandler = function (g, a, c) { + if (a.charAt(1) == "d") { + return; + } + if (this.itemPull[this.idPrefix + g] == null) { + return; + } + var e = this._getCheckboxState(g); + if (this.checkEvent("onCheckboxClick")) { + if (this.callEvent("onCheckboxClick", [g, e, this.conf.ctx_zoneid, c])) { + this.setCheckboxState(g, !e); + } + } else { + this.setCheckboxState(g, !e); + } + if (this.checkEvent("onClick")) { + this.callEvent("onClick", [g]); + } +}; +dhtmlXMenuObject.prototype.setCheckboxState = function (c, a) { + this._setCheckboxState(c, a); + this._updateCheckboxImage(c); +}; +dhtmlXMenuObject.prototype.getCheckboxState = function (a) { + return this._getCheckboxState(a); +}; +dhtmlXMenuObject.prototype.addCheckbox = function (m, g, n, o, r, a, h) { + if (this.conf.context && g == this.topId) { + } else { + if (this.itemPull[this.idPrefix + g] == null) { + return; + } + if (m == "child" && this.itemPull[this.idPrefix + g]["type"] != "item") { + return; + } + } + var j = "chbx_" + (a ? "1" : "0"); + var e = j; + if (m == "sibling") { + var c = this.idPrefix + (o != null ? o : this._genStr(24)); + var l = this.idPrefix + this.getParentId(g); + this._addItemIntoGlobalStrorage(c, l, r, "checkbox", h, j, e); + this.itemPull[c]["checked"] = a; + this._renderSublevelItem(c, this.getItemPosition(g)); + } else { + var c = this.idPrefix + (o != null ? o : this._genStr(24)); + var l = this.idPrefix + g; + this._addItemIntoGlobalStrorage(c, l, r, "checkbox", h, j, e); + this.itemPull[c]["checked"] = a; + if (this.idPull["polygon_" + l] == null) { + this._renderSublevelPolygon(l, l); + } + this._renderSublevelItem(c, n - 1); + this._redefineComplexState(l); + } +}; +dhtmlXMenuObject.prototype.setHotKey = function (l, a) { + l = this.idPrefix + l; + if (!(this.itemPull[l] != null && this.idPull[l] != null)) { + return; + } + if (this.itemPull[l]["parent"] == this.idPrefix + this.topId && !this.conf.context) { + return; + } + if (this.itemPull[l]["complex"]) { + return; + } + var c = this.itemPull[l]["type"]; + if (!(c == "item" || c == "checkbox" || c == "radio")) { + return; + } + var j = null; + try { + if (this.idPull[l].childNodes[this.conf.rtl ? 0 : 2].childNodes[0].className == "sub_item_hk") { + j = this.idPull[l].childNodes[this.conf.rtl ? 0 : 2].childNodes[0]; + } + } catch (h) {} + if (a.length == 0) { + this.itemPull[l]["hotkey_backup"] = this.itemPull[l]["hotkey"]; + this.itemPull[l]["hotkey"] = ""; + if (j != null) { + j.parentNode.removeChild(j); + } + } else { + this.itemPull[l]["hotkey"] = a; + this.itemPull[l]["hotkey_backup"] = null; + if (j == null) { + j = document.createElement("DIV"); + j.className = "sub_item_hk"; + var g = this.idPull[l].childNodes[this.conf.rtl ? 0 : 2]; + while (g.childNodes.length > 0) { + g.removeChild(g.childNodes[0]); + } + g.appendChild(j); + } + j.innerHTML = a; + } +}; +dhtmlXMenuObject.prototype.getHotKey = function (a) { + if (this.itemPull[this.idPrefix + a] == null) { + return null; + } + return this.itemPull[this.idPrefix + a]["hotkey"]; +}; +dhtmlXMenuObject.prototype._clearAllSelectedSubItemsInPolygon = function (a) { + var e = this._getSubItemToDeselectByPolygon(a); + for (var c = 0; c < this.conf.opened_poly.length; c++) { + if (this.conf.opened_poly[c] != a) { + this._hidePolygon(this.conf.opened_poly[c]); + } + } + for (var c = 0; c < e.length; c++) { + if (this.idPull[e[c]] != null && this.itemPull[e[c]]["state"] == "enabled") { + this.idPull[e[c]].className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_Item_Normal"; + } + } +}; +dhtmlXMenuObject.prototype._checkArrowsState = function (g) { + var c = this.idPull["polygon_" + g].childNodes[1]; + var e = this.idPull["arrowup_" + g]; + var a = this.idPull["arrowdown_" + g]; + if (c.scrollTop == 0) { + e.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp_Disabled"; + } else { + e.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp" + (e.over ? "_Over" : ""); + } + if (c.scrollTop + c.offsetHeight < c.scrollHeight) { + a.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowDown" + (a.over ? "_Over" : ""); + } else { + a.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowDown_Disabled"; + } + c = e = a = null; +}; +dhtmlXMenuObject.prototype._addUpArrow = function (g) { + var c = this; + var e = document.createElement("DIV"); + e.pId = this.idPrefix + g; + e.id = "arrowup_" + this.idPrefix + g; + e.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp"; + e.over = false; + e.onselectstart = function (h) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + return false; + }; + e.oncontextmenu = function (h) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + return false; + }; + e.onmouseover = function () { + if (c.conf.mode == "web") { + window.clearTimeout(c.conf.tm_handler); + } + c._clearAllSelectedSubItemsInPolygon(this.pId); + if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp_Disabled") { + return; + } + this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp_Over"; + this.over = true; + c._canScrollUp = true; + c._doScrollUp(this.pId, true); + }; + e.onmouseout = function () { + if (c.conf.mode == "web") { + window.clearTimeout(c.conf.tm_handler); + c.conf.tm_handler = window.setTimeout( + function () { + c._clearAndHide(); + }, + c.conf.tm_sec, + "JavaScript" + ); + } + this.over = false; + c._canScrollUp = false; + if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp_Disabled") { + return; + } + this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp"; + window.clearTimeout(c.conf.of_utm); + }; + e.onclick = function (h) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + h.cancelBubble = true; + return false; + }; + var a = this.idPull["polygon_" + this.idPrefix + g]; + a.childNodes[0].appendChild(e); + this.idPull[e.id] = e; + a = e = null; +}; +dhtmlXMenuObject.prototype._addDownArrow = function (g) { + var c = this; + var e = document.createElement("DIV"); + e.pId = this.idPrefix + g; + e.id = "arrowdown_" + this.idPrefix + g; + e.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowDown"; + e.over = false; + e.onselectstart = function (h) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + return false; + }; + e.oncontextmenu = function (h) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + return false; + }; + e.onmouseover = function () { + if (c.conf.mode == "web") { + window.clearTimeout(c.conf.tm_handler); + } + c._clearAllSelectedSubItemsInPolygon(this.pId); + if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown_Disabled") { + return; + } + this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown_Over"; + this.over = true; + c._canScrollDown = true; + c._doScrollDown(this.pId, true); + }; + e.onmouseout = function () { + if (c.conf.mode == "web") { + window.clearTimeout(c.conf.tm_handler); + c.conf.tm_handler = window.setTimeout( + function () { + c._clearAndHide(); + }, + c.conf.tm_sec, + "JavaScript" + ); + } + this.over = false; + c._canScrollDown = false; + if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown_Disabled") { + return; + } + this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown"; + window.clearTimeout(c.conf.of_dtm); + }; + e.onclick = function (h) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + h.cancelBubble = true; + return false; + }; + var a = this.idPull["polygon_" + this.idPrefix + g]; + a.childNodes[2].appendChild(e); + this.idPull[e.id] = e; + a = e = null; +}; +dhtmlXMenuObject.prototype._removeUpArrow = function (c) { + var a = "arrowup_" + this.idPrefix + c; + this._removeArrow(a); +}; +dhtmlXMenuObject.prototype._removeDownArrow = function (c) { + var a = "arrowdown_" + this.idPrefix + c; + this._removeArrow(a); +}; +dhtmlXMenuObject.prototype._removeArrow = function (a) { + var c = this.idPull[a]; + c.onselectstart = null; + c.oncontextmenu = null; + c.onmouseover = null; + c.onmouseout = null; + c.onclick = null; + if (c.parentNode) { + c.parentNode.removeChild(c); + } + c = null; + this.idPull[a] = null; + try { + delete this.idPull[a]; + } catch (g) {} +}; +dhtmlXMenuObject.prototype._isArrowExists = function (a) { + if (this.idPull["arrowup_" + a] != null && this.idPull["arrowdown_" + a] != null) { + return true; + } + return false; +}; +dhtmlXMenuObject.prototype._doScrollUp = function (j, g) { + var a = this.idPull["polygon_" + j].childNodes[1]; + if (this._canScrollUp && a.scrollTop > 0) { + var e = false; + var h = a.scrollTop - this.conf.of_ustep; + if (h < 0) { + e = true; + h = 0; + } + a.scrollTop = h; + if (!e) { + var c = this; + this.conf.of_utm = window.setTimeout(function () { + c._doScrollUp(j, false); + c = null; + }, this.conf.of_utime); + } else { + g = true; + } + } else { + this._canScrollUp = false; + this._checkArrowsState(j); + } + if (g) { + this._checkArrowsState(j); + } +}; +dhtmlXMenuObject.prototype._doScrollDown = function (j, g) { + var a = this.idPull["polygon_" + j].childNodes[1]; + if (this._canScrollDown && a.scrollTop + a.offsetHeight <= a.scrollHeight) { + var e = false; + var h = a.scrollTop + this.conf.of_dstep; + if (h + a.offsetHeight >= a.scrollHeight) { + e = true; + h = a.scrollHeight - a.offsetHeight; + } + a.scrollTop = h; + if (!e) { + var c = this; + this.conf.of_dtm = window.setTimeout(function () { + c._doScrollDown(j, false); + c = null; + }, this.conf.of_dtime); + } else { + g = true; + } + } else { + this._canScrollDown = false; + this._checkArrowsState(j); + } + if (g) { + this._checkArrowsState(j); + } +}; +dhtmlXMenuObject.prototype._countPolygonItems = function (j) { + var g = 0; + for (var c in this.itemPull) { + var e = this.itemPull[c]["parent"]; + var h = this.itemPull[c]["type"]; + if (e == this.idPrefix + j && (h == "item" || h == "radio" || h == "checkbox")) { + g++; + } + } + return g; +}; +dhtmlXMenuObject.prototype.setOverflowHeight = function (g) { + if (g === "auto") { + this.conf.overflow_limit = 0; + this.conf.auto_overflow = true; + return; + } + if (this.conf.overflow_limit == 0 && g <= 0) { + return; + } + this._clearAndHide(); + if (this.conf.overflow_limit >= 0 && g > 0) { + this.conf.overflow_limit = g; + return; + } + if (this.conf.overflow_limit > 0 && g <= 0) { + for (var e in this.itemPull) { + if (this._isArrowExists(e)) { + var c = String(e).replace(this.idPrefix, ""); + this._removeUpArrow(c); + this._removeDownArrow(c); + this.idPull["polygon_" + e].childNodes[1].style.height = ""; + } + } + this.conf.overflow_limit = 0; + return; + } +}; +dhtmlXMenuObject.prototype._getRadioImgObj = function (g) { + try { + var a = this.idPull[this.idPrefix + g].childNodes[this.conf.rtl ? 2 : 0].childNodes[0]; + } catch (c) { + var a = null; + } + return a; +}; +dhtmlXMenuObject.prototype._setRadioState = function (g, e) { + var c = this._getRadioImgObj(g); + if (c != null) { + var a = this.itemPull[this.idPrefix + g]; + a.checked = e; + a.imgen = "rdbt_" + (a.checked ? "1" : "0"); + a.imgdis = a.imgen; + c.className = "sub_icon " + a.imgen; + } +}; +dhtmlXMenuObject.prototype._radioOnClickHandler = function (g, a, c) { + if (a.charAt(1) == "d" || this.itemPull[this.idPrefix + g]["group"] == null) { + return; + } + var e = this.itemPull[this.idPrefix + g]["group"]; + if (this.checkEvent("onRadioClick")) { + if (this.callEvent("onRadioClick", [e, this.getRadioChecked(e), g, this.conf.ctx_zoneid, c])) { + this.setRadioChecked(e, g); + } + } else { + this.setRadioChecked(e, g); + } + if (this.checkEvent("onClick")) { + this.callEvent("onClick", [g]); + } +}; +dhtmlXMenuObject.prototype.getRadioChecked = function (g) { + var j = null; + for (var e = 0; e < this.radio[g].length; e++) { + var h = this.radio[g][e].replace(this.idPrefix, ""); + var a = this._getRadioImgObj(h); + if (a != null) { + var c = a.className.match(/rdbt_1$/gi); + if (c != null) { + j = h; + } + } + } + return j; +}; +dhtmlXMenuObject.prototype.setRadioChecked = function (c, g) { + if (this.radio[c] == null) { + return; + } + for (var a = 0; a < this.radio[c].length; a++) { + var e = this.radio[c][a].replace(this.idPrefix, ""); + this._setRadioState(e, e == g); + } +}; +dhtmlXMenuObject.prototype.addRadioButton = function (n, h, o, r, s, u, a, j) { + if (this.conf.context && h == this.topId) { + } else { + if (this.itemPull[this.idPrefix + h] == null) { + return; + } + if (n == "child" && this.itemPull[this.idPrefix + h]["type"] != "item") { + return; + } + } + var e = this.idPrefix + (r != null ? r : this._genStr(24)); + var l = "rdbt_" + (a ? "1" : "0"); + var c = l; + if (n == "sibling") { + var m = this.idPrefix + this.getParentId(h); + this._addItemIntoGlobalStrorage(e, m, s, "radio", j, l, c); + this._renderSublevelItem(e, this.getItemPosition(h)); + } else { + var m = this.idPrefix + h; + this._addItemIntoGlobalStrorage(e, m, s, "radio", j, l, c); + if (this.idPull["polygon_" + m] == null) { + this._renderSublevelPolygon(m, m); + } + this._renderSublevelItem(e, o - 1); + this._redefineComplexState(m); + } + var g = u != null ? u : this._genStr(24); + this.itemPull[e]["group"] = g; + if (this.radio[g] == null) { + this.radio[g] = new Array(); + } + this.radio[g][this.radio[g].length] = e; + if (a == true) { + this.setRadioChecked(g, String(e).replace(this.idPrefix, "")); + } +}; +dhtmlXMenuObject.prototype.serialize = function () { + var a = "" + this._readLevel(this.idPrefix + this.topId) + ""; + return a; +}; +dhtmlXMenuObject.prototype._readLevel = function (g) { + var h = ""; + for (var n in this.itemPull) { + if (this.itemPull[n]["parent"] == g) { + var c = ""; + var e = ""; + var r = ""; + var m = String(this.itemPull[n]["id"]).replace(this.idPrefix, ""); + var l = ""; + var o = this.itemPull[n]["title"] != "" ? ' text="' + this.itemPull[n]["title"] + '"' : ""; + var j = ""; + if (this.itemPull[n]["type"] == "item") { + if (this.itemPull[n]["imgen"] != "") { + c = ' img="' + this.itemPull[n]["imgen"] + '"'; + } + if (this.itemPull[n]["imgdis"] != "") { + e = ' imgdis="' + this.itemPull[n]["imgdis"] + '"'; + } + if (this.itemPull[n]["hotkey"] != "") { + r = "" + this.itemPull[n]["hotkey"] + ""; + } + } + if (this.itemPull[n]["type"] == "separator") { + l = ' type="separator"'; + } else { + if (this.itemPull[n]["state"] == "disabled") { + j = ' enabled="false"'; + } + } + if (this.itemPull[n]["type"] == "checkbox") { + l = ' type="checkbox"' + (this.itemPull[n]["checked"] ? ' checked="true"' : ""); + } + if (this.itemPull[n]["type"] == "radio") { + l = ' type="radio" group="' + this.itemPull[n]["group"] + '" ' + (this.itemPull[n]["checked"] ? ' checked="true"' : ""); + } + h += ""; + h += r; + if (this.itemPull[n]["complex"]) { + h += this._readLevel(n); + } + h += ""; + } + } + return h; +}; +dhtmlXMenuObject.prototype.enableEffect = function (e, h, g) { + this._menuEffect = e == "opacity" || e == "slide" || e == "slide+" ? e : false; + this._pOpStyleIE = navigator.userAgent.search(/MSIE\s[678]\.0/gi) >= 0; + for (var c in this.idPull) { + if (c.search(/polygon/) === 0) { + this._pOpacityApply(c, this._pOpStyleIE ? 100 : 1); + this.idPull[c].style.height = ""; + } + } + this._pOpMax = (typeof h == "undefined" ? 100 : h) / (this._pOpStyleIE ? 1 : 100); + this._pOpStyleName = this._pOpStyleIE ? "filter" : "opacity"; + this._pOpStyleValue = this._pOpStyleIE ? "progid:DXImageTransform.Microsoft.Alpha(Opacity=#)" : "#"; + this._pSlSteps = this._pOpStyleIE ? 10 : 20; + this._pSlTMTimeMax = g || 50; +}; +dhtmlXMenuObject.prototype._showPolygonEffect = function (a) { + this._pShowHide(a, true); +}; +dhtmlXMenuObject.prototype._hidePolygonEffect = function (a) { + this._pShowHide(a, false); +}; +dhtmlXMenuObject.prototype._pOpacityApply = function (a, c) { + this.idPull[a].style[this._pOpStyleName] = String(this._pOpStyleValue).replace("#", c || this.idPull[a]._op); +}; +dhtmlXMenuObject.prototype._pShowHide = function (a, c) { + if (!this.idPull) { + return; + } + if (this.idPull[a]._tmShow != null) { + if ((this.idPull[a]._step_h > 0 && c == true) || (this.idPull[a]._step_h < 0 && c == false)) { + return; + } + window.clearTimeout(this.idPull[a]._tmShow); + this.idPull[a]._tmShow = null; + this.idPull[a]._max_h = null; + } + if (c == false && (this.idPull[a].style.visibility == "hidden" || this.idPull[a].style.display == "none")) { + return; + } + if (c == true && this.idPull[a].style.display == "none") { + this.idPull[a].style.visibility = "hidden"; + this.idPull[a].style.display = ""; + } + if (this.idPull[a]._max_h == null) { + this.idPull[a]._max_h = parseInt(this.idPull[a].offsetHeight); + this.idPull[a]._h = c == true ? 0 : this.idPull[a]._max_h; + this.idPull[a]._step_h = Math.round(this.idPull[a]._max_h / this._pSlSteps) * (c == true ? 1 : -1); + if (this.idPull[a]._step_h == 0) { + return; + } + this.idPull[a]._step_tm = Math.round(this._pSlTMTimeMax / this._pSlSteps); + if (this._menuEffect == "slide+" || this._menuEffect == "opacity") { + this.idPull[a].op_tm = this.idPull[a]._step_tm; + this.idPull[a].op_step = (this._pOpMax / this._pSlSteps) * (c == true ? 1 : -1); + if (this._pOpStyleIE) { + this.idPull[a].op_step = Math.round(this.idPull[a].op_step); + } + this.idPull[a]._op = c == true ? 0 : this._pOpMax; + this._pOpacityApply(a); + } else { + this.idPull[a]._op = this._pOpStyleIE ? 100 : 1; + this._pOpacityApply(a); + } + if (this._menuEffect.search(/slide/) === 0) { + this.idPull[a].style.height = "0px"; + } + this.idPull[a].style.visibility = "visible"; + } + this._pEffectSet(a, this.idPull[a]._h + this.idPull[a]._step_h); +}; +dhtmlXMenuObject.prototype._pEffectSet = function (e, c) { + if (!this.idPull) { + return; + } + if (this.idPull[e]._tmShow) { + window.clearTimeout(this.idPull[e]._tmShow); + } + this.idPull[e]._h = Math.max(0, Math.min(c, this.idPull[e]._max_h)); + if (this._menuEffect.search(/slide/) === 0) { + this.idPull[e].style.height = this.idPull[e]._h + "px"; + } + c += this.idPull[e]._step_h; + if (this._menuEffect == "slide+" || this._menuEffect == "opacity") { + this.idPull[e]._op = Math.max(0, Math.min(this._pOpMax, this.idPull[e]._op + this.idPull[e].op_step)); + this._pOpacityApply(e); + } + if ((this.idPull[e]._step_h > 0 && c <= this.idPull[e]._max_h) || (this.idPull[e]._step_h < 0 && c >= 0)) { + var a = this; + this.idPull[e]._tmShow = window.setTimeout(function () { + a._pEffectSet(e, c); + }, this.idPull[e]._step_tm); + } else { + if (this._menuEffect.search(/slide/) === 0) { + this.idPull[e].style.height = ""; + } + if (this.idPull[e]._step_h < 0) { + this.idPull[e].style.visibility = "hidden"; + } + if (this._menuEffect == "slide+" || this._menuEffect == "opacity") { + this.idPull[e]._op = this.idPull[e]._step_h < 0 ? (this._pOpStyleIE ? 100 : 1) : this._pOpMax; + this._pOpacityApply(e); + } + this.idPull[e]._tmShow = null; + this.idPull[e]._h = null; + this.idPull[e]._max_h = null; + this.idPull[e]._step_tm = null; + } +}; +function dhtmlXRibbon(g) { + var e = this, + c, + a; + this.conf = { type: "ribbon", icons_path: g && g.icons_path ? g.icons_path : "", arrows_mode: g && g.arrows_mode ? g.arrows_mode : null, skin: "dhx_skyblue" }; + this._eventHandlers = {}; + this._base = null; + this._items = {}; + this._tabbar = null; + this.childIds = []; + if (typeof g == "string") { + a = g; + } else { + if (g && g.tagName) { + a = g; + } else { + if (g && g.parent) { + if (g.parent.tagName || typeof g.parent == "string") { + a = g.parent; + } + } + } + } + this._doOnHighlight0 = function (m) { + m = m || event; + var l = m.target || m.srcElement; + var h = e._findItemByNode(l); + var j = e._items[h._dhx_ribbonId]; + if (j.conf.disable) { + return; + } + if (e.items[j.type] && typeof e.items[j.type].mouseover == "function") { + if (e.items[j.type].mouseover(j, e, m) != true) { + return false; + } + } + if (!/dhxrb_highlight0/.test(h.className)) { + h.className += " dhxrb_highlight0"; + } + }; + this._doOffHighlight0 = function (m) { + m = m || event; + var l = m.target || m.srcElement; + var h = e._findItemByNode(l); + var j = e._items[h._dhx_ribbonId]; + if (j.conf.disable) { + return; + } + if (e.items[j.type] && typeof e.items[j.type].mouseout == "function") { + if (e.items[j.type].mouseout(j, e, m) != true) { + return false; + } + } + if (/dhxrb_highlight1/.test(h.className)) { + h.className = h.className.replace(/\s?dhxrb_highlight1/, ""); + } + if (/dhxrb_highlight0/.test(h.className)) { + h.className = h.className.replace(/\s?dhxrb_highlight0/, ""); + } + }; + this._doOnHighlight1 = function (m) { + m = m || event; + var l = m.target || m.srcElement; + var h = e._findItemByNode(l); + var j = e._items[h._dhx_ribbonId]; + if (j.conf.disable) { + return; + } + e.callEvent("_showPopup", [j.id]); + if (e.items[j.type] && typeof e.items[j.type].mousedown == "function") { + if (e.items[j.type].mousedown(j, e, m) != true) { + return false; + } + } + if (!/dhxrb_highlight1/.test(h.className)) { + h.className += " dhxrb_highlight1"; + } + }; + this._doOffHighlight1 = function (m) { + m = m || event; + var l = m.target || m.srcElement; + var h = e._findItemByNode(l); + var j = e._items[h._dhx_ribbonId]; + if (j.conf.disable) { + return; + } + if (e.items[j.type] && typeof e.items[j.type].mouseup == "function") { + if (e.items[j.type].mouseup(j, e, m) != true) { + return false; + } + } + if (/dhxrb_highlight1/.test(h.className)) { + h.className = h.className.replace(/\s?dhxrb_highlight1/, ""); + } + }; + this._doOnClick = function (m) { + m = m || event; + var l = m.target || m.srcElement; + var h = e._findItemByNode(l); + var j = e._items[h._dhx_ribbonId]; + if (j.conf.disable) { + return; + } + if (e.items[j.type] && typeof e.items[j.type].click == "function") { + e.items[j.type].click(j, e, m); + } + }; + this._doOnFocus = function (m) { + m = m || event; + var l = m.target || m.srcElement; + var h = e._findItemByNode(l); + var j = e._items[h._dhx_ribbonId]; + if (j.conf.disable) { + return; + } + e.callEvent("_showPopup", [j.id]); + if (e.items[j.type] && typeof e.items[j.type].focus == "function") { + e.items[j.type].focus(j, e, m); + } + }; + this._doOnBlur = function (m) { + m = m || event; + var l = m.target || m.srcElement; + var h = e._findItemByNode(l); + var j = e._items[h._dhx_ribbonId]; + if (j.conf.disable) { + return; + } + if (e.items[j.type] && typeof e.items[j.type].blur == "function") { + e.items[j.type].blur(j, e, m); + } + }; + this._doOnChange = function (m) { + m = m || event; + var l = m.target || m.srcElement; + var h = e._findItemByNode(l); + var j = e._items[h._dhx_ribbonId]; + if (j.conf.disable) { + return; + } + if (e.items[j.type] && typeof e.items[j.type].change == "function") { + e.items[j.type].change(j, e, m); + } + }; + this._doOnKeydown = function (m) { + m = m || event; + var l = m.target || m.srcElement; + var h = e._findItemByNode(l); + var j = e._items[h._dhx_ribbonId]; + if (j.conf.disable) { + return; + } + if (e.items[j.type] && typeof e.items[j.type].keydown == "function") { + e.items[j.type].keydown(j, e, m); + } + }; + this._tabCustomApi = { + enable: function (m, j) { + var h = null; + j = j || false; + if (j != true) { + h = e._items[this._idd]; + for (var l = 0; l < h.childIds.length; l++) { + e.enable(h.childIds[l]); + } + } + return e._tabOriginalApi.enable.apply(this, [m]); + }, + disable: function (m, j) { + var h = null; + if (j != false) { + h = e._items[this._idd]; + for (var l = 0; l < h.childIds.length; l++) { + e.disable(h.childIds[l]); + } + } + return e._tabOriginalApi.disable.apply(this, [m]); + }, + close: function (l) { + var j = e._items[this._idd]; + e._removeTab(j); + e._tabOriginalApi.close.apply(this, [l]); + for (var h in e._tabOriginalApi) { + this[h] = null; + } + }, + }; + this._attachEventTabbar = function () { + this._tabbar.attachEvent("onSelect", function () { + return e.callEvent("onSelect", arguments); + }); + this._tabbar.attachEvent("onTabClick", function () { + return e.callEvent("onTabClick", arguments); + }); + this._tabbar.attachEvent("onTabClose", function () { + return e.callEvent("onTabClose", arguments); + }); + }; + if (typeof a == "string") { + this._base = document.getElementById(a); + } else { + if (a && a.tagName) { + this._base = a; + } else { + this._base = document.createElement("div"); + this._base._dhx_remove = true; + if (document.body.firstChild) { + document.body.insertBefore(this._base, document.body.firstChild); + } else { + document.body.appendChild(this._base); + } + } + } + c = dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || dhx4.skinDetect("dhtmlxribbon") || "dhx_skyblue"; + if (typeof g == "object" && g.skin) { + c = g.skin; + } + this.setSkin(c); + dhx4._eventable(this); + dhx4._enableDataLoading(this, "_renderData", "_xmlToJson", "ribbon", { struct: true }); + this.attachEvent("_onHeightChanged", function () { + this.conf.inited = true; + }); + this._base.className += " dhxrb_without_tabbar"; + this._base.innerHTML = "
"; + if (g != null) { + if (g.json) { + this.loadStruct(g.json, g.onload); + } else { + if (g.xml) { + this.loadStruct(g.xml, g.onload); + } else { + this._renderData(g); + } + } + } + this.unload = function () { + var j = []; + for (var l = 0; l < this.childIds.length; l++) { + j.push(this.childIds[l]); + } + dhx4._enableDataLoading(this, null, null, null, "clear"); + dhx4._eventable(this, "clear"); + for (var l = 0; l < j.length; l++) { + if (this._items[j[l]].type == "tab") { + this.tabs(j[l]).close(false); + } else { + this.removeItem(j[l]); + } + } + if (this._tabbar) { + this._tabbar.unload(); + this._tabbar = null; + } + this._base.innerHTML = ""; + if (this._base._dhx_remove) { + this._base.parentNode.removeChild(this._base); + } else { + this._base.className = this._base.className.replace(/\s?(dhtmlx|dhxrb)(\S*)/gi, ""); + } + for (var h in this) { + this[h] = null; + } + e = null; + }; +} +dhtmlXRibbon.prototype.setSizes = function () { + if (this._tabbar != null && typeof this.setSizes == "function") { + this._tabbar.setSizes(); + } +}; +dhtmlXRibbon.prototype._renderData = function (c) { + var a = this._base.firstChild; + if (c != null) { + this.conf.icons_path = c.icons_path || this.conf.icons_path; + if (c.tabs instanceof Array) { + this._base.className = this._base.className.replace(/\s?dhxrb_without_tabbar/i, ""); + a.className = "dhxrb_with_tabbar"; + this._tabbar = new dhtmlXTabBar(a); + this._attachEventTabbar(); + this._tabbar.setSkin(this.conf.skin); + if (this.conf.arrows_mode != null) { + this._tabbar.setArrowsMode(this.conf.arrows_mode); + } + this.childIds = this._appendTabs(c.tabs); + } else { + if (c.items instanceof Array) { + if (!/\s?dhxrb_without_tabbar/i.test(this._base.className)) { + this._base.className += " dhxrb_without_tabbar"; + } + if (/\s?dhxrb_background_area/i.test(a.className)) { + a.className = "dhxrb_background_area"; + } + a.innerHTML = "
"; + this.childIds = this._appendBlocks(c.items, a.firstChild); + } + } + this.callEvent("_onHeightChanged", []); + } +}; +dhtmlXRibbon.prototype._xmlToJson = function (c) { + var a = c.lastChild || null, + g = {}, + e = []; + if (a && a.tagName == "ribbon") { + e = this._convertXmlNodeListIntoObject(a.childNodes); + } + if (e[0] && e[0].type && e[0].type.toLowerCase() == "block") { + g.items = e; + } else { + g.tabs = e; + } + return g; +}; +dhtmlXRibbon.prototype._convertXmlNodeListIntoObject = function (c) { + var e, + a, + h = [], + g; + a = c.length; + for (e = 0; e < a; e++) { + g = this._covertXmlNodeToObject(c[e]); + if (g) { + h.push(g); + } + } + return h; +}; +dhtmlXRibbon.prototype._covertXmlNodeToObject = function (g) { + if (!g || !g.tagName || !(g.tagName.toLowerCase() == "item" || g.tagName.toLowerCase() == "tab")) { + return null; + } + var e, + a, + c = g.attributes, + h = {}; + a = c.length; + for (e = 0; e < a; e++) { + switch (c[e].name) { + case "isbig": + h.isbig = dhx4.s2b(c[e].value); + break; + case "state": + h.state = dhx4.s2b(c[e].value); + break; + default: + h[c[e].name] = c[e].value; + } + } + if (g.childNodes.length) { + if (g.getAttribute("type") == "buttonCombo" || g.getAttribute("type") == "buttonSelect") { + h.data = g; + } else { + if (g.tagName.toLowerCase() == "tab") { + h.items = this._convertXmlNodeListIntoObject(g.childNodes); + } else { + h.list = this._convertXmlNodeListIntoObject(g.childNodes); + } + } + } + return h; +}; +dhtmlXRibbon.prototype._appendTabs = function (h) { + var c, + a, + e, + g = []; + a = h.length; + for (c = 0; c < a; c++) { + e = this._addTab(h[c]); + if (h[c].items instanceof Array) { + e.childIds = this._appendBlocks(h[c].items, e.base, e); + } + g.push(e.id); + } + return g; +}; +dhtmlXRibbon.prototype._addTab = function (e) { + var a, g; + var c = { conf: { active: false, text: "", width: null, position: null, disable: false }, base: document.createElement("div"), type: "tab", childIds: [] }; + for (a in e) { + if (a == "items") { + continue; + } + c.conf[a] = e[a]; + } + if (!e.id) { + c.id = dhx4.newId(); + } else { + c.id = e.id; + } + while (this._items[c.id]) { + c.id = dhx4.newId(); + } + this._tabbar.addTab(c.id, c.conf.text, c.conf.width, c.conf.position, c.conf.active); + c.base.className = "dhxrb_g_area"; + c.base._dhx_ribbonId = c.id; + this.tabs(c.id).attachObject(c.base); + this._changeApiForTab(this.tabs(c.id)); + this._items[c.id] = c; + return c; +}; +dhtmlXRibbon.prototype._changeApiForTab = function (c) { + var a; + for (a in this._tabOriginalApi) { + this._tabOriginalApi[a] = this._tabOriginalApi[a] || c[a]; + c[a] = this._tabCustomApi[a]; + } +}; +dhtmlXRibbon.prototype._tabOriginalApi = { enable: null, disable: null, close: null }; +dhtmlXRibbon.prototype._appendBlocks = function (a, r, e) { + var j, + g, + m, + h, + n, + c, + o = []; + e = e || null; + g = a.length; + for (j = 0; j < g; j++) { + if (typeof a[j] == "object" && a[j].type == "block") { + m = this._addBlock(a[j], r); + if (a[j].list && a[j].list instanceof Array) { + h = a[j].list; + n = h.length; + for (c = 0; c < n; c++) { + this._addItem(m.id, null, null, h[c]); + } + } + if (e != null) { + m.parentId = e.id; + } + if (m.conf.disable) { + this.disable(m.id); + } + o.push(m.id); + } + } + return o; +}; +dhtmlXRibbon.prototype._addBlock = function (h, g) { + var e, a, j, c; + j = { + conf: { text: "", text_pos: "bottom", type: "block", mode: "cols", disable: false }, + type: "block", + childIds: [], + base: document.createElement("div"), + contForItems: document.createElement("div"), + contForText: document.createElement("div"), + }; + for (c in h) { + if (c == "list" || c == "type" || c == "id") { + continue; + } + j.conf[c] = h[c]; + } + if (!h.id) { + j.id = dhx4.newId(); + } else { + j.id = h.id; + } + while (this._items[j.id]) { + j.id = dhx4.newId(); + } + j.base.className = "dhxrb_block_base"; + g.appendChild(j.base); + j.contForItems.className = "dhxrb_block_items"; + j.contForText.className = "dhxrb_block_label"; + j.base.appendChild(j.contForItems); + if (j.conf.text) { + j.contForText.innerHTML = j.conf.text; + if (j.conf.text_pos == "top") { + j.base.insertBefore(j.contForText, j.contForItems); + } else { + j.base.appendChild(j.contForText); + } + } + j.base._dhx_ribbonId = j.id; + this._items[j.id] = j; + return j; +}; +dhtmlXRibbon.prototype._addItem = function (e, c, n, l) { + var h = this._items[e], + a, + j, + r = null, + m = this, + g; + if (l.type != "newLevel" && !this.items[l.type]) { + return null; + } + if (l.type == "newLevel") { + this._addNewLevel(h); + } else { + if (h.type == "group") { + a = document.createElement("div"); + a.className = "dhxrb_in_group"; + h.base.appendChild(a); + } else { + if (l.isbig) { + a = document.createElement("div"); + a.className = "dhxrb_big_button"; + h.contForItems.appendChild(a); + } else { + j = this._getContainerForSmallItem(h); + a = document.createElement("div"); + a.className = h.conf.mode == "rows" ? "dhxrb_in_row" : "dhxrb_3rows_button"; + j.appendChild(a); + } + } + } + if (a) { + this._attachEventForItem(a); + g = { icons_path: l.icons_path || this.conf.icons_path, skin: this.conf.skin }; + for (var o in l) { + g[o] = l[o]; + } + if (!g.id) { + g.id = dhx4.newId(); + } + while (this._items[g.id]) { + g.id = dhx4.newId(); + } + r = this.items[g.type] && this.items[g.type].render ? this.items[g.type].render(a, g) : null; + } + if (r != null) { + this._items[r.id] = r; + r.parentId = h.id; + h.childIds.push(r.id); + a._dhx_ribbonId = r.id; + if (g.onclick && typeof g.onclick == "function") { + this._eventHandlers[r.id] = this._eventHandlers[r.id] || {}; + this._eventHandlers[r.id]["onclick"] = g.onclick; + } + r.callEvent = function () { + m.callEvent.apply(m, arguments); + }; + r._callHandler = function () { + m._callHandler.apply(m, arguments); + }; + if (this.items[g.type] && typeof this.items[g.type].callAfterInit == "function") { + this.items[g.type].callAfterInit.apply(this, [r]); + } + } + return r; +}; +dhtmlXRibbon.prototype._callHandler = function (c, a) { + if (this._eventHandlers[c] && this._eventHandlers[c].onclick) { + this._eventHandlers[c].onclick.apply(this, a); + } +}; +dhtmlXRibbon.prototype.items = {}; +dhtmlXRibbon.prototype.items.button = { + render: function (c, a) { + var e, g; + g = { base: c, id: a.id, type: a.type, conf: { text: "", text_pos: a.isbig ? "bottom" : "right", img: null, imgdis: null, isbig: false, disable: false, skin: a.skin } }; + for (e in a) { + if (e == "id" || e == "onclick" || e == "type") { + continue; + } + g.conf[e] = a[e]; + } + c.innerHTML = "
" + g.conf.text + "
"; + if (typeof this.afterRender == "function") { + this.afterRender(g); + } + if (g.conf.disable) { + this.disable(g); + } + return g; + }, + getText: function (a) { + return a.conf.text; + }, + setText: function (c, e) { + var a = c.base.childNodes[1]; + c.conf.text = e; + a.innerHTML = e; + }, + setImage: function (c, a) { + c.conf.img = a; + if (c.conf.disable == false) { + c.base.childNodes[0].src = c.conf.icons_path + c.conf.img; + } + }, + setImageDis: function (c, a) { + c.conf.imgdis = a; + if (c.conf.disable == true) { + c.base.childNodes[0].src = c.conf.icons_path + c.conf.imgdis; + } + }, + mousedown: function (a, g, c) { + return true; + }, + click: function (a, g, c) { + if (c.button != 0) { + return false; + } + g._callHandler(a.id, [a.id]); + a.callEvent("onClick", [a.id]); + return false; + }, + disable: function (c) { + var e = c.base.childNodes[0], + a = c.base.childNodes[1]; + if (c.conf.imgdis) { + e.src = c.conf.icons_path + c.conf.imgdis; + if (/\s?dhxrb_invisible/i.test(e.className)) { + e.className = e.className.replace(/\s?dhxrb_invisible/i, ""); + } + } + if (!/\s?dhxrb_disable_text_style/i.test(a.className)) { + a.className += " dhxrb_disable_text_style"; + } + return true; + }, + enable: function (c) { + var e = c.base.childNodes[0], + a = c.base.childNodes[1]; + if (c.conf.img) { + e.src = c.conf.icons_path + c.conf.img; + } else { + if (!/\s?dhxrb_invisible/i.test(e.className)) { + e.className += " dhxrb_invisible"; + } + } + if (/\s?dhxrb_disable_text_style/i.test(a.className)) { + a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, ""); + } + return true; + }, +}; +dhtmlXRibbon.prototype.items.buttonTwoState = { + click: function (a, g, c) { + return false; + }, + afterRender: function (a) { + if (a.conf.state) { + this.setState(a, a.conf.state); + } + }, + mouseover: function (a) { + if (!/dhxrb_highlight0/.test(a.base.className)) { + a.base.className += " dhxrb_highlight0"; + } + return false; + }, + mouseout: function (a) { + if (/dhxrb_highlight0/.test(a.base.className)) { + a.base.className = a.base.className.replace(/\s?dhxrb_highlight0/, ""); + } + return false; + }, + mousedown: function (a, g, c) { + g._callHandler(a.id, [a.id, !a.conf.state]); + this.setState(a, !a.conf.state, true); + return false; + }, + mouseup: function (a) { + return false; + }, + setState: function (a, c, e) { + e = e || false; + c = dhx4.s2b(c); + if (c) { + if (!/dhxrb_highlight1/.test(a.base.className)) { + a.base.className += " dhxrb_highlight1"; + } + } else { + if (/dhxrb_highlight1/.test(a.base.className)) { + a.base.className = a.base.className.replace(/\s?dhxrb_highlight1/, ""); + } + } + a.conf.state = c; + if (e) { + a.callEvent("onStateChange", [a.id, a.conf.state]); + } + }, + getState: function (a) { + return a.conf.state == true; + }, +}; +dhtmlXRibbon.prototype.items.buttonSegment = { + click: function (a, g, c) { + return false; + }, + mousedown: function (a, g, c) { + this.setState(a, g, true); + return false; + }, + callAfterInit: function (a) { + if (a.conf.state || dhtmlXRibbon.prototype.items.buttonSegment._getSelectedNeighbor(a, this) == null) { + if (a.conf.state) { + a.conf.state = false; + } + dhtmlXRibbon.prototype.items.buttonSegment.setState(a, this, false); + } + }, + afterRender: function () {}, + setState: function (a, h, g) { + g = g || false; + var e = null, + c = dhx4.s2b(a.conf.state); + if (c == false) { + e = this._getSelectedNeighbor(a, h); + if (e != null) { + this._unSelect(e); + } + if (!/dhxrb_highlight1/.test(a.base.className)) { + a.base.className += " dhxrb_highlight1"; + } + a.conf.state = true; + if (g) { + h._callHandler(a.id, [a.id, e ? e.id : null]); + h.callEvent("onStateChange", [a.id, e ? e.id : null]); + } + } + }, + remove: function (e, l) { + var h = dhx4.s2b(e.conf.state), + j = null, + a = 0, + c = l._items[e.parentId], + g; + if (h) { + while (c.childIds[a] && j == null) { + g = l._items[c.childIds[a]]; + if (g.type == "buttonSegment" && g != e) { + j = g; + } + a++; + } + if (j) { + this.setState(j, l); + } + } + }, + _unSelect: function (a) { + var c = dhx4.s2b(a.conf.state); + if (c) { + if (/dhxrb_highlight1/.test(a.base.className)) { + a.base.className = a.base.className.replace(/\s?dhxrb_highlight1/, ""); + } + a.conf.state = false; + } + }, + _getSelectedNeighbor: function (g, m) { + var e = m._items[g.parentId], + c, + a, + j, + h = null; + a = e.childIds.length; + for (c = 0; c < a; c++) { + j = m._items[e.childIds[c]]; + if (j.type == "buttonSegment" && j.conf.state) { + h = j; + break; + } + } + return h; + }, +}; +dhtmlXRibbon.prototype.items.buttonSelect = { + itemCollection: [], + _isAttachedEventInWindow: false, + afterRender: function (c) { + var a = c.base.childNodes[1]; + a.innerHTML += " "; + c.menu = null; + this.itemCollection.push(c); + this._attachEventToWindow(); + a = null; + }, + setText: function (a, e) { + var c = a.base.childNodes[1].lastChild; + a.conf.text = e; + a.base.childNodes[1].innerHTML = e; + a.base.childNodes[1].appendChild(c); + }, + setOptionText: function (a, e, c) { + if (a.menu != null) { + a.menu.setItemText(e, c); + } else { + this._loopThroughItems(a.conf.items, e, c, false); + } + }, + getOptionText: function (a, c) { + if (a.menu != null) { + return a.menu.getItemText(c); + } + return this._loopThroughItems(a.conf.items, c, null, true); + }, + _loopThroughItems: function (a, j, h, g) { + for (var e = 0; e < a.length; e++) { + if (a[e].id == j) { + if (g != true) { + a[e].text = h; + return true; + } else { + return a[e].text; + } + } + if (a[e].items != null) { + var c = this._loopThroughItems(a[e].items, j, h, g); + if (c != null) { + return c; + } + } + } + return null; + }, + _attachEventToWindow: function () { + if (this._isAttachedEventInWindow == false) { + if (typeof window.addEventListener == "function") { + document.body.addEventListener("mousedown", this._hideAllMenus, false); + } else { + document.body.attachEvent("onmousedown", this._hideAllMenus); + } + this._isAttachedEventInWindow = true; + } + }, + _detachEventFromWindow: function () { + if (typeof window.addEventListener == "function") { + document.body.removeEventListener("mousedown", this._hideAllMenus, false); + } else { + document.body.detachEvent("onmousedown", this._hideAllMenus); + } + this._isAttachedEventInWindow = false; + }, + _hideAllMenus: function (j) { + j = j || event; + var g = j.target || j.srcElement; + var a = true; + while (g != null && a == true) { + if (g.className != null && /SubLevelArea_Polygon/i.test(g.className)) { + a = false; + } else { + g = g.parentNode; + } + } + if (a == false) { + return; + } + var c = dhtmlXRibbon.prototype.items.buttonSelect.itemCollection; + for (var l in c) { + var h = c[l]; + if (h.menu instanceof dhtmlXMenuObject) { + if (h._skipHiding) { + h._skipHiding = false; + } else { + dhtmlXRibbon.prototype.items.buttonSelect.hideMenu(h); + } + } + } + }, + mousedown: function (a, g, c) { + a._skipHiding = true; + this.showMenu(a); + return false; + }, + mouseup: function (a) { + return false; + }, + click: function () {}, + setState: function () {}, + showMenu: function (c) { + var a = dhx4.absLeft(c.base), + e = dhx4.absTop(c.base) + c.base.offsetHeight; + if (!(c.menu instanceof dhtmlXMenuObject)) { + c.menu = new dhtmlXMenuObject({ parent: c.base, icons_path: c.conf.icons_path, context: true, items: c.conf.items, skin: c.conf.skin }); + if (c.conf.data) { + c.menu.loadStruct(c.conf.data); + delete c.conf.data; + } + c.menu.setAutoHideMode(false); + c.menu.attachEvent("onHide", function (g) { + if (g == null) { + dhtmlXRibbon.prototype.items.buttonSelect._doOnHideMenu(c); + } + }); + c.menu.attachEvent("onShow", function (g) { + if (g == null) { + dhtmlXRibbon.prototype.items.buttonSelect._doOnShowMenu(c); + } + }); + c.menu.attachEvent("onClick", function (g) { + c.callEvent("onClick", [g, c.id]); + }); + c.base.oncontextmenu = function () { + return false; + }; + dhtmlXRibbon.prototype.items.buttonSelect.showMenu(c); + } else { + c.menu.showContextMenu(a, e); + } + }, + hideMenu: function (a) { + if (a.menu instanceof dhtmlXMenuObject) { + a.menu.hideContextMenu(); + } + }, + remove: function (c) { + var e, a; + if (c.menu instanceof dhtmlXMenuObject) { + c.menu.unload(); + c.menu = null; + } + c.base.oncontextmenu = null; + e = dhtmlXRibbon.prototype._indexOf(dhtmlXRibbon.prototype.items.buttonSelect.itemCollection, c); + if (e != -1) { + dhtmlXRibbon.prototype.items.buttonSelect.itemCollection.splice(e, 1); + } + if (dhtmlXRibbon.prototype.items.buttonSelect.itemCollection.length == 0) { + this._detachEventFromWindow(); + } + }, + setSkin: function (a, c) { + if (a.menu instanceof dhtmlXMenuObject) { + a.menu.setSkin(c); + } + }, + _doOnHideMenu: function (a) { + if (a._skipHiding) { + a._skipHiding = false; + } else { + if (/dhxrb_highlight1/.test(a.base.className)) { + a.base.className = a.base.className.replace(/\s?dhxrb_highlight1/, ""); + } + } + }, + _doOnShowMenu: function (a) { + if (!/dhxrb_highlight1/.test(a.base.className)) { + a.base.className += " dhxrb_highlight1"; + } + }, +}; +dhtmlXRibbon.prototype.items.group = { + render: function (c, a) { + var e, g; + g = { base: c, id: a.id, type: a.type, conf: { disable: false, skin: a.skin }, childIds: [] }; + c.className = "dhxrb_group"; + for (e in a) { + if (e == "id" || e == "onclick" || e == "type") { + continue; + } + g.conf[e] = a[e]; + } + return g; + }, + callAfterInit: function (h) { + this._detachEventFromItem(h.base); + var g, + a, + j = h.conf.list, + m, + e, + c; + a = j ? j.length : 0; + for (g = 0; g < a; g++) { + m = this._addItem(h.id, null, null, j[g]); + if (m == null) { + continue; + } + e = m.base.childNodes[1]; + if (e && !e.innerHTML && !/\s?dhxrb_label_hide/i.test(e.className)) { + e.className += " dhxrb_label_hide"; + } + } + dhtmlXRibbon.prototype.items.group.normalize(h); + if (h.conf.disable) { + this.disable(h.id); + } + j = undefined; + }, + normalize: function (m) { + var a = m.base.children; + var e = a.length, + c = false, + n = 0; + var g, j; + for (var h = 0; h < e; h++) { + if (!/dhxrb_separator_group/i.test(a[h].className)) { + if (/dhxrb_item_hide/i.test(a[h].className)) { + n++; + continue; + } + } + if (Math.ceil((h - n) / 2) - Math.floor((h - n) / 2) == 0) { + if (/dhxrb_separator_group/i.test(a[h].className)) { + a[h].parentNode.removeChild(a[h]); + c = true; + break; + } + } else { + if (!/dhxrb_separator_group/i.test(a[h].className)) { + g = document.createElement("div"); + g.className = "dhxrb_separator_groupp"; + m.base.insertBefore(g, a[h]); + c = true; + break; + } + } + } + if (c) { + this.normalize(m); + } else { + j = m.base.lastChild; + if (j && /dhxrb_separator_group/i.test(j.className)) { + j.parentNode.removeChild(j); + } + } + }, + hideChild: function (c, g) { + var a = dhtmlXRibbon.prototype._indexOf(c.base.children, g.base); + if (a == 0) { + a++; + } else { + if (a != -1) { + a--; + } else { + return; + } + } + var e = c.base.children[a]; + if (e && /dhxrb_separator_group/i.test(e.className)) { + e.parentNode.removeChild(e); + } + }, + showChild: function (a) { + this.normalize(a); + }, +}; +dhtmlXRibbon.prototype.items.input = { + render: function (c, a) { + var e, g; + g = { base: c, id: a.id, type: a.type, conf: { text: "", text_pos: a.isbig ? "bottom" : "right", img: null, imgdis: null, isbig: false, disable: false, skin: a.skin, value: "" } }; + for (e in a) { + if (e == "id" || e == "onclick" || e == "type") { + continue; + } + g.conf[e] = a[e]; + } + c.innerHTML = "
" + g.conf.text + "
"; + if (typeof this.afterRender == "function") { + this.afterRender(g); + } + if (g.conf.disable) { + this.disable(g); + } + if (g.conf.width) { + this.setWidth(g, g.conf.width); + } + if (g.conf.value) { + this.setValue(g, g.conf.value); + } + return g; + }, + callAfterInit: function (c) { + var a = c.base.childNodes[0]; + this._detachEventFromItem(c.base); + this._attachEventsToInput(a); + }, + setText: dhtmlXRibbon.prototype.items.button.setText, + getText: dhtmlXRibbon.prototype.items.button.getText, + change: function (c) { + var a = c.base.childNodes[0]; + c.conf.value = a.value; + }, + keydown: function (c, h, g) { + if (g.keyCode == 13) { + var a = c.base.childNodes[0]; + c.conf.value = a.value; + h.callEvent("onEnter", [c.id, c.conf.value]); + } + }, + remove: function (c, e) { + var a = c.base.childNodes[0]; + e._detachEventsFromInput(a); + }, + getValue: function (c) { + var a = c.base.childNodes[0], + e; + e = a.value; + a = undefined; + return e; + }, + setValue: function (c, e) { + var a = c.base.childNodes[0], + e; + a.value = e; + c.conf.value = e; + }, + setWidth: function (c, e) { + var a = c.base.childNodes[0]; + a.style.width = parseInt(e) + "px"; + }, + disable: function (e) { + var c = e.base.childNodes[0], + a = e.base.childNodes[1]; + c.disabled = true; + if (!/\s?dhxrb_disable_text_style/i.test(a.className)) { + a.className += " dhxrb_disable_text_style"; + } + return true; + }, + enable: function (e) { + var c = e.base.childNodes[0], + a = e.base.childNodes[1]; + c.disabled = false; + if (/\s?dhxrb_disable_text_style/i.test(a.className)) { + a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, ""); + } + return true; + }, + getInput: function (a) { + return a.base.childNodes[0]; + }, +}; +dhtmlXRibbon.prototype.getInput = function (c) { + var a = this._items[c]; + if (a == null || a.type != "input") { + return null; + } + return this.items[a.type].getInput(a); +}; +dhtmlXRibbon.prototype.items.checkbox = { + render: function (c, a) { + var e, g; + g = { base: c, id: a.id, type: a.type, conf: { text: "", text_pos: a.isbig ? "bottom" : "right", disable: false, checked: false } }; + for (e in a) { + if (e == "id" || e == "onclick" || e == "type") { + continue; + } + g.conf[e] = a[e]; + } + c.innerHTML = "
" + g.conf.text + "
"; + if (typeof this.afterRender == "function") { + this.afterRender(g); + } + if (g.conf.checked) { + this.check(g); + } + return g; + }, + callAfterInit: function (a) { + if (a.conf.disable) { + this.disable(a.id); + } + }, + setText: dhtmlXRibbon.prototype.items.button.setText, + getText: dhtmlXRibbon.prototype.items.button.getText, + mousedown: function (a) { + return false; + }, + mouseup: function (a) { + return false; + }, + click: function (a, g, c) { + if (c.button != 0) { + return false; + } + if (a.type == "checkbox") { + if (a.conf.checked) { + this.uncheck(a, true); + } else { + this.check(a, true); + } + } + }, + check: function (a, c) { + c = c || false; + if (a.type != "checkbox") { + return; + } + a.conf.checked = true; + if (!/\s?dhxrb_checked/i.test(a.base.className)) { + a.base.className += " dhxrb_checked"; + } + if (c) { + a.callEvent("onCheck", [a.id, a.conf.checked]); + } + }, + uncheck: function (a, c) { + c = c || false; + if (a.type != "checkbox") { + return; + } + a.conf.checked = false; + if (/\s?dhxrb_checked/i.test(a.base.className)) { + a.base.className = a.base.className.replace(/\s?dhxrb_checked/i, ""); + } + if (c) { + a.callEvent("onCheck", [a.id, a.conf.checked]); + } + }, + isChecked: function (a) { + if (a.type != "checkbox") { + return false; + } + return a.conf.checked == true; + }, + disable: function (a) { + return true; + }, + enable: function (a) { + return true; + }, +}; +dhtmlXRibbon.prototype.items.text = { + render: function (a, g) { + var e = { base: a, id: g.id, type: g.type, conf: { text: "" } }; + for (var c in g) { + if (c == "id" || c == "type") { + continue; + } + e.conf[c] = g[c]; + } + a.innerHTML = "
" + e.conf.text + "
"; + if (typeof this.afterRender == "function") { + this.afterRender(e); + } + return e; + }, + callAfterInit: function (a) { + this._detachEventFromItem(a.base); + }, + getText: function (a) { + return a.conf.text; + }, + setText: function (a, c) { + a.conf.text = c; + a.base.firstChild.innerHTML = a.conf.text; + }, +}; +dhtmlXRibbon.prototype.items.buttonCombo = { + render: function (a, c) { + var e, + g, + h = {}; + g = { base: a, id: c.id, type: c.type, conf: { text: "", text_pos: "right", width: 140, skin: c.skin, callEvent: true } }; + for (e in c) { + if (e == "id" || e == "onclick" || e == "type") { + continue; + } + g.conf[e] = c[e]; + } + for (e in g.conf) { + if (e == "text" || e == "text_pos" || e == "disable" || e == "data") { + continue; + } + h[e] = g.conf[e]; + } + g.base.className += " dhxrb_buttoncombo_cont"; + g.base.innerHTML = "
" + g.conf.text + "
"; + h.parent = g.base.firstChild; + g.combo = new dhtmlXCombo(h); + g.combo.setSkin(h.skin); + g.combo.attachEvent("onChange", function (j, l) { + g._callHandler(g.id, [j, l]); + if (g.conf.callEvent == true) { + g.callEvent("onSelectOption", [g.id, j, l]); + } + g.conf.callEvent = true; + }); + if (g.conf.data) { + g.combo.load(g.conf.data); + delete g.conf.data; + } + if (typeof this.afterRender == "function") { + this.afterRender(g); + } + if (g.conf.disable) { + this.disable(g); + } + return g; + }, + callAfterInit: function (a) { + this._detachEventFromItem(a.base); + }, + disable: function (c) { + var a = c.base.lastChild; + if (c.combo instanceof dhtmlXCombo) { + c.combo.disable(); + } + if (!/\s?dhxrb_disable_text_style/i.test(a.className)) { + a.className += " dhxrb_disable_text_style"; + } + return true; + }, + enable: function (c) { + var a = c.base.lastChild; + if (c.combo instanceof dhtmlXCombo) { + c.combo.enable(); + } + if (/\s?dhxrb_disable_text_style/i.test(a.className)) { + a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, ""); + } + return true; + }, + remove: function (a) { + if (a.combo instanceof dhtmlXCombo) { + a.combo.unload(); + a.combo = null; + } + }, + getValue: function (a) { + var c = null; + if (a.combo instanceof dhtmlXCombo) { + c = a.combo.getSelectedValue(); + } + return c; + }, + setValue: function (a, c, e) { + if (a.combo instanceof dhtmlXCombo) { + a.conf.callEvent = e; + a.combo.setComboValue(c); + } + }, + setSkin: function (a, c) { + if (a.combo instanceof dhtmlXCombo) { + a.combo.setSkin(c); + } + }, +}; +dhtmlXRibbon.prototype.items.slider = { + render: function (a, h) { + var e, + g, + c = {}; + g = { base: a, id: h.id, type: h.type, conf: { text: "", text_pos: "right", size: 150, vertical: false, min: 0, max: 99, value: 0, step: 1, margin: 10, disabled: false, enableTooltip: false } }; + for (e in h) { + if (e == "id" || e == "onclick" || e == "type") { + continue; + } + g.conf[e] = h[e]; + } + for (e in g.conf) { + if (e == "text" || e == "text_pos" || e == "isbig") { + continue; + } + c[e] = g.conf[e]; + } + g.base.innerHTML = "
" + g.conf.text + "
"; + c.parent = g.base.firstChild.firstChild; + g.slider = new dhtmlXSlider(c); + if (typeof this.afterRender == "function") { + this.afterRender(g); + } + if (g.conf.disable) { + this.disable(g); + } + g.slider.attachEvent("onChange", function (j) { + g._callHandler(g.id, [j]); + g.callEvent("onValueChange", [g.id, j]); + }); + return g; + }, + callAfterInit: function (a) { + this._detachEventFromItem(a.base); + }, + setSkin: function (a, c) { + if (a.slider instanceof dhtmlXSlider) { + a.slider.setSkin(c); + } + }, + disable: function (c) { + var a = c.base.childNodes[1]; + if (c.slider instanceof dhtmlXSlider) { + c.slider.disable(); + } + if (!/\s?dhxrb_disable_text_style/i.test(a.className)) { + a.className += " dhxrb_disable_text_style"; + } + return true; + }, + enable: function (c) { + var a = c.base.childNodes[1]; + if (c.slider instanceof dhtmlXSlider) { + c.slider.enable(); + } + if (/\s?dhxrb_disable_text_style/i.test(a.className)) { + a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, ""); + } + return true; + }, + remove: function (a) { + if (a.slider instanceof dhtmlXSlider) { + a.slider.unload(); + a.slider = null; + } + }, + getValue: function (a) { + var c = null; + if (a.slider instanceof dhtmlXSlider) { + c = a.slider.getValue(); + } + return c; + }, + setValue: function (a, c) { + if (a.slider instanceof dhtmlXSlider) { + a.slider.setValue(c); + } + }, +}; +dhtmlXRibbon.prototype.items._extends = function (e, c) { + var a; + for (a in c) { + e[a] = e[a] || c[a]; + } + return e; +}; +dhtmlXRibbon.prototype._addNewLevel = function (e) { + var c, a; + if (e.conf.mode == "rows") { + c = e.contForItems.lastChild; + if (c && /dhxrb_block_rows/i.test(c.className) && c.childNodes.length < 3) { + a = document.createElement("div"); + a.className = "dhxrb_block_row"; + c.appendChild(a); + } else { + c = document.createElement("div"); + c.className = "dhxrb_block_rows"; + e.contForItems.appendChild(c); + a = document.createElement("div"); + a.className = "dhxrb_block_row"; + c.appendChild(a); + } + } else { + var a = document.createElement("div"); + a.className = "dhxrb_3rows_block"; + e.contForItems.appendChild(a); + } +}; +dhtmlXRibbon.prototype._attachEventForItem = function (a) { + if (typeof window.addEventListener == "function") { + a.addEventListener("mouseover", this._doOnHighlight0, false); + a.addEventListener("mouseout", this._doOffHighlight0, false); + a.addEventListener("mousedown", this._doOnHighlight1, false); + a.addEventListener("mouseup", this._doOffHighlight1, false); + a.addEventListener("click", this._doOnClick, false); + } else { + a.attachEvent("onmouseover", this._doOnHighlight0); + a.attachEvent("onmouseout", this._doOffHighlight0); + a.attachEvent("onmousedown", this._doOnHighlight1); + a.attachEvent("onmouseup", this._doOffHighlight1); + a.attachEvent("onclick", this._doOnClick); + } +}; +dhtmlXRibbon.prototype._detachEventFromItem = function (a) { + if (typeof window.addEventListener == "function") { + a.removeEventListener("mouseover", this._doOnHighlight0, false); + a.removeEventListener("mouseout", this._doOffHighlight0, false); + a.removeEventListener("mousedown", this._doOnHighlight1, false); + a.removeEventListener("mouseup", this._doOffHighlight1, false); + a.removeEventListener("click", this._doOnClick, false); + } else { + a.detachEvent("onmouseover", this._doOnHighlight0); + a.detachEvent("onmouseout", this._doOffHighlight0); + a.detachEvent("onmousedown", this._doOnHighlight1); + a.detachEvent("onmouseup", this._doOffHighlight1); + a.detachEvent("onclick", this._doOnClick); + } +}; +dhtmlXRibbon.prototype._attachEventsToInput = function (a) { + if (typeof window.addEventListener == "function") { + a.addEventListener("focus", this._doOnFocus, false); + a.addEventListener("blur", this._doOnBlur, false); + a.addEventListener("change", this._doOnChange, false); + a.addEventListener("keydown", this._doOnKeydown, false); + } else { + a.attachEvent("onfocus", this._doOnFocus); + a.attachEvent("onblur", this._doOnBlur); + a.attachEvent("onchange", this._doOnChange); + a.attachEvent("onkeydown", this._doOnKeydown); + } +}; +dhtmlXRibbon.prototype._detachEventsFromInput = function (a) { + if (typeof window.addEventListener == "function") { + a.removeEventListener("focus", this._doOnFocus, false); + a.removeEventListener("blur", this._doOnBlur, false); + a.removeEventListener("change", this._doOnChange, false); + a.removeEventListener("keydown", this._doOnKeydown, false); + } else { + a.detachEvent("onfocus", this._doOnFocus); + a.detachEvent("onblur", this._doOnBlur); + a.detachEvent("onchange", this._doOnChange); + a.detachEvent("onkeydown", this._doOnKeydown); + } +}; +dhtmlXRibbon.prototype._getContainerForSmallItem = function (e) { + var c = e.contForItems.lastChild, + a = null; + if (e.conf.mode == "rows") { + if (c && /\s?dhxrb_block_rows/i.test(c.className)) { + a = c.lastChild; + if (!a) { + a = document.createElement("div"); + a.className = "dhxrb_block_row"; + c.appendChild(a); + } + } else { + c = document.createElement("div"); + c.className = "dhxrb_block_rows"; + e.contForItems.appendChild(c); + a = document.createElement("div"); + a.className = "dhxrb_block_row"; + c.appendChild(a); + } + } else { + if (c && /dhxrb_3rows_block/i.test(c.className) && c.childNodes.length < 3) { + a = c; + } else { + a = document.createElement("div"); + a.className = "dhxrb_3rows_block"; + e.contForItems.appendChild(a); + } + } + return a; +}; +dhtmlXRibbon.prototype._findItemByNode = function (a) { + while (a && !a._dhx_ribbonId) { + a = a.parentNode; + } + return a; +}; +dhtmlXRibbon.prototype._indexOf = function (a, g) { + var e, c; + c = a.length; + for (e = 0; e < c; e++) { + if (a[e] == g) { + return e; + } + } + return -1; +}; +dhtmlXRibbon.prototype._removeItem = function (e) { + var a, + g = -1, + c = this._items[e.parentId]; + if (e.type == "group") { + this._removeGroup(e); + return; + } + delete this._items[e.id]; + a = e.base.parentNode; + this._detachEventFromItem(e.base); + a.removeChild(e.base); + if (c.type == "block") { + if (a != c.contForItems && a.childNodes.length == 0) { + a.parentNode.removeChild(a); + } + } else { + if (c.type == "group") { + dhtmlXRibbon.prototype.items.group.normalize(c); + } + } + g = this._indexOf(c.childIds, e.id); + if (g != -1) { + c.childIds.splice(g, 1); + } + if (this.items[e.type] && typeof this.items[e.type].remove == "function") { + this.items[e.type].remove(e, this); + } +}; +dhtmlXRibbon.prototype._removeGroup = function (g) { + var c = [], + j, + e = this._items[g.parentId], + a = g.base.parentNode; + for (var h = 0; h < g.childIds.length; h++) { + c.push(this._items[g.childIds[h]]); + } + for (var h = 0; h < c.length; h++) { + this._removeItem(c[h]); + } + delete this._items[g.id]; + if (g.base.parentNode) { + a.removeChild(g.base); + } + if (a.childNodes.length == 0) { + a.parentNode.removeChild(a); + } + j = this._indexOf(e.childIds, g.id); + if (j != -1) { + e.childIds.splice(j, 1); + } + if (this.items[g.type] && typeof this.items[g.type].remove == "function") { + this.items[g.type].remove(g); + } +}; +dhtmlXRibbon.prototype._removeBlock = function (h) { + var a = [], + g, + c; + for (var e = 0; e < h.childIds.length; e++) { + a.push(this._items[h.childIds[e]]); + } + for (var e = 0; e < a.length; e++) { + this._removeItem(a[e]); + } + delete this._items[h.id]; + h.base.parentNode.removeChild(h.base); + if (h.parentId) { + c = this._items[h.parentId]; + } else { + c = this; + } + g = this._indexOf(c.childIds, h.id); + if (g != -1) { + c.childIds.splice(g, 1); + } +}; +dhtmlXRibbon.prototype._removeTab = function (c, a) { + var h = [], + g; + for (var e = 0; e < c.childIds.length; e++) { + h.push(this._items[c.childIds[e]]); + } + for (var e = 0; e < h.length; e++) { + this._removeBlock(h[e]); + } + delete this._items[c.id]; + g = this._indexOf(this.childIds, c.id); + if (g != -1) { + this.childIds.splice(g, 1); + } +}; +dhtmlXRibbon.prototype._skinCollection = { dhx_skyblue: true, dhx_web: true, dhx_terrace: true }; +dhtmlXRibbon.prototype._setSkinForItems = function (e) { + var a, c; + for (a in this._items) { + c = this._items[a]; + c.conf.skin = e; + if (dhtmlXRibbon.prototype.items[c.type] && typeof dhtmlXRibbon.prototype.items[c.type].setSkin == "function") { + dhtmlXRibbon.prototype.items[c.type].setSkin(c, e); + } + } + (c = undefined), (a = undefined); +}; +dhtmlXRibbon.prototype._setBlockText = function (a, c) { + a.conf.text = c; + a.contForText.innerHTML = c; + if (!c && c != 0 && a.contForText.parentNode) { + a.contForText.parentNode.removeChild(a.contForText); + } else { + if (!a.contForText.parentNode) { + if (a.conf.text_pos == "top") { + a.base.insertBefore(a.contForText, a.contForItems); + } else { + a.base.appendChild(a.contForText); + } + } + } +}; +dhtmlXRibbon.prototype.hide = function (e) { + var c = this._items[e]; + if (this.items[c.type] && typeof this.items[c.type].hide == "function") { + if (this.items[c.type].hide(c) != true) { + return; + } + } + if (c.type == "tab") { + return; + } else { + if (!/\s?dhxrb_item_hide/i.test(c.base.className)) { + c.base.className += " dhxrb_item_hide"; + } + } + var a = this._items[c.parentId]; + if (a && this.items[a.type] && typeof this.items[a.type].hideChild == "function") { + this.items[a.type].hideChild(a, c); + } +}; +dhtmlXRibbon.prototype.show = function (e) { + var c = this._items[e]; + if (this.items[c.type] && typeof this.items[c.type].show == "function") { + if (this.items[c.type].show(c) != true) { + return; + } + } + if (c.type == "tab") { + return; + } else { + if (/\s?dhxrb_item_hide/i.test(c.base.className)) { + c.base.className = c.base.className.replace(/\s?dhxrb_item_hide/i, ""); + } + } + var a = this._items[c.parentId]; + if (a && this.items[a.type] && typeof this.items[a.type].showChild == "function") { + this.items[a.type].showChild(a, c); + } +}; +dhtmlXRibbon.prototype.check = function (e, c) { + c = dhx4.s2b(c); + var a = this._items[e]; + if (a && !a.conf.checked && typeof this.items[a.type].check == "function") { + this.items[a.type].check(a); + if (c) { + this.callEvent("onCheck", [a.id, a.conf.checked]); + } + } +}; +dhtmlXRibbon.prototype.uncheck = function (e, c) { + c = dhx4.s2b(c); + var a = this._items[e]; + if (a && a.conf.checked && typeof this.items[a.type].uncheck == "function") { + this.items[a.type].uncheck(a); + if (c) { + this.callEvent("onCheck", [a.id, a.conf.checked]); + } + } +}; +dhtmlXRibbon.prototype.isChecked = function (c) { + var a = this._items[c]; + if (a && typeof this.items[a.type].isChecked == "function") { + return this.items[a.type].isChecked(a); + } +}; +dhtmlXRibbon.prototype.disable = function (g, a) { + var c = this._items[g]; + if (this.items[c.type] && typeof this.items[c.type].disable == "function") { + if (this.items[c.type].disable(c) != true) { + return; + } + } + if (c.type == "tab") { + return; + } else { + if (c.type == "block" || c.type == "group") { + for (var e = 0; e < c.childIds.length; e++) { + this.disable(c.childIds[e]); + } + } + } + if (!/\s?dhxrb_item_disable/i.test(c.base.className)) { + c.base.className += " dhxrb_item_disable"; + } + c.conf.disable = true; +}; +dhtmlXRibbon.prototype.enable = function (e, a) { + var c = this._items[e]; + if (this.items[c.type] && typeof this.items[c.type].enable == "function") { + if (this.items[c.type].enable(c) != true) { + return; + } + } + if (c.type == "tab") { + return; + } else { + if (c.type == "block" || c.type == "group") { + for (q = 0; q < c.childIds.length; q++) { + this.enable(c.childIds[q]); + } + } + } + if (/\s?dhxrb_item_disable/i.test(c.base.className)) { + c.base.className = c.base.className.replace(/\s?dhxrb_item_disable/i, ""); + } + c.conf.disable = false; +}; +dhtmlXRibbon.prototype.isEnabled = function (c) { + var a = this._items[c]; + if (this.items[a.type] && typeof this.items[a.type].isEnabled == "function") { + return this.items[a.type].isEnabled(a); + } + if (a.type == "tab") { + return; + } else { + return a.conf.disable != true; + } +}; +dhtmlXRibbon.prototype.isVisible = function (c) { + var a = this._items[c]; + if (this.items[a.type] && typeof this.items[a.type].isVisible == "function") { + return this.items[a.type].isVisible(a); + } + if (a.type == "tab") { + return; + } else { + return !/\s?dhxrb_item_hide/i.test(a.base.className); + } +}; +dhtmlXRibbon.prototype.setItemState = function (g, c, e) { + c = dhx4.s2b(c); + e = dhx4.s2b(e); + var a = this._items[g]; + if (a && typeof this.items[a.type].setState == "function") { + switch (a.type) { + case "buttonSegment": + this.items[a.type].setState(a, this, e); + break; + default: + this.items[a.type].setState(a, c, e); + } + } +}; +dhtmlXRibbon.prototype.getItemState = function (c) { + var a = this._items[c]; + if (a && typeof this.items[a.type].getState == "function") { + switch (a.type) { + case "buttonTwoState": + case "buttonSegment": + return this.items[a.type].getState(a); + break; + } + } + return null; +}; +dhtmlXRibbon.prototype.setIconPath = function (a) { + this.conf.icons_path = a; +}; +dhtmlXRibbon.prototype.removeItem = function (c) { + var a = this._items[c]; + if (a == null) { + return; + } + switch (a.type) { + case "tab": + break; + case "block": + this._removeBlock(a); + break; + case "group": + this._removeGroup(a); + break; + default: + this._removeItem(a); + } +}; +dhtmlXRibbon.prototype.setSkin = function (h) { + h = typeof h == "string" ? h.toLowerCase() : ""; + if (this._skinCollection[h] != true) { + return; + } + var e, + c = -1, + a, + g = "dhtmlxribbon"; + e = this._base.className.match(/\S\w+/gi); + if (e instanceof Array) { + for (a in this._skinCollection) { + if (c == -1) { + c = this._indexOf(e, g + "_" + a); + } else { + break; + } + } + c = c == -1 ? e.length : c; + } else { + e = []; + c = 0; + } + e[c] = g + "_" + h; + this._base.className = e.join(" "); + this.conf.skin = h; + if (this._tabbar != null) { + this._tabbar.setSkin(h); + } + this._setSkinForItems(h); +}; +dhtmlXRibbon.prototype.tabs = function (a) { + if (this._tabbar instanceof dhtmlXTabBar) { + return this._tabbar.tabs(a); + } else { + return undefined; + } +}; +dhtmlXRibbon.prototype.getItemType = function (c) { + var a = this._items[c]; + if (a) { + return a.type; + } else { + return undefined; + } +}; +dhtmlXRibbon.prototype.getValue = function (e) { + var a = this._items[e], + c = undefined; + if (a && this.items[a.type] && typeof this.items[a.type].getValue == "function") { + c = this.items[a.type].getValue(a); + } + return c; +}; +dhtmlXRibbon.prototype.setValue = function (g, c, e) { + var a = this._items[g]; + e = e === false ? false : true; + if (a && this.items[a.type] && typeof this.items[a.type].setValue == "function") { + this.items[a.type].setValue(a, c, e); + } +}; +dhtmlXRibbon.prototype.getItemText = function (c) { + var a = this._items[c]; + if (!a) { + return null; + } else { + if (a.type == "tab") { + return this.tabs(a.id).getText(); + } else { + if (a.type == "block") { + return this.items.button.getText(a); + } else { + if (this.items[a.type] && typeof this.items[a.type].getText == "function") { + return this.items[a.type].getText(a); + } else { + return null; + } + } + } + } +}; +dhtmlXRibbon.prototype.setItemText = function (e, c) { + var a = this._items[e]; + if (!a) { + return; + } else { + if (a.type == "tab") { + this.tabs(a.id).setText(c); + } else { + if (a.type == "block") { + this._setBlockText(a, c); + } else { + if (this.items[a.type] && typeof this.items[a.type].setText == "function") { + this.items[a.type].setText(a, c); + } + } + } + } +}; +dhtmlXRibbon.prototype.setItemOptionText = function (g, e, c) { + var a = this._items[g]; + if (a.type == "buttonSelect") { + this.items[a.type].setOptionText(a, e, c); + } +}; +dhtmlXRibbon.prototype.getItemOptionText = function (e, c) { + var a = this._items[e]; + if (a.type == "buttonSelect") { + return this.items[a.type].getOptionText(a, c); + } + return null; +}; +dhtmlXRibbon.prototype.setItemImage = function (e, a) { + var c = this._items[e]; + if (c != null && this.items[c.type] != null && typeof this.items[c.type].setImage == "function") { + this.items[c.type].setImage(c, a); + } +}; +dhtmlXRibbon.prototype.setItemImageDis = function (e, a) { + var c = this._items[e]; + if (c != null && this.items[c.type] != null && typeof this.items[c.type].setImageDis == "function") { + this.items[c.type].setImageDis(c, a); + } +}; +dhtmlXRibbon.prototype.getCombo = function (c) { + var a = this._items[c]; + if (a != null && a.type == "buttonCombo") { + return a.combo; + } + return null; +}; +(function () { + var a = dhtmlXRibbon.prototype.items; + a.buttonTwoState = a._extends(a.buttonTwoState, a.button); + a.buttonSelect = a._extends(a.buttonSelect, a.buttonTwoState); + a.buttonSegment = a._extends(a.buttonSegment, a.buttonTwoState); +})(); +if (typeof window.dhtmlXCellObject != "undefined") { + dhtmlXCellObject.prototype._createNode_ribbon = function (h, c, g, a, e) { + if (typeof e != "undefined") { + h = e; + } else { + h = document.createElement("DIV"); + h.className = "dhx_cell_ribbon_" + (this.conf.borders ? "def" : "no_borders"); + h.appendChild(document.createElement("DIV")); + } + this.cell.insertBefore(h, this.cell.childNodes[this.conf.idx.cont]); + this.conf.ofs_nodes.t.ribbon = true; + this._updateIdx(); + this._adjustCont(this._idd); + return h; + }; + dhtmlXCellObject.prototype.attachRibbon = function (a) { + if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) { + return; + } + this.callEvent("_onBeforeContentAttach", ["ribbon"]); + if (typeof a == "undefined") { + a = {}; + } + if (typeof a.skin == "undefined") { + a.skin = this.conf.skin; + } + a.parent = this._attachObject("ribbon").firstChild; + this.dataNodes.ribbon = new dhtmlXRibbon(a); + var c = this; + this.dataNodes.ribbon.attachEvent("_onHeightChanged", function () { + c._adjustCont(c._idd); + }); + this._adjustCont(); + a.parent = null; + a = null; + this.callEvent("_onContentAttach", []); + return this.dataNodes.ribbon; + }; + dhtmlXCellObject.prototype.detachRibbon = function () { + if (!this.dataNodes.ribbon) { + return; + } + this.dataNodes.ribbon.unload(); + this.dataNodes.ribbon = null; + delete this.dataNodes.ribbon; + this._detachObject("ribbon"); + }; + dhtmlXCellObject.prototype.showRibbon = function () { + this._mtbShowHide("ribbon", ""); + }; + dhtmlXCellObject.prototype.hideRibbon = function () { + this._mtbShowHide("ribbon", "none"); + }; + dhtmlXCellObject.prototype.getAttachedRibbon = function () { + return this.dataNodes.ribbon; + }; +} +function dhtmlXToolbarObject(c, e) { + var a = this; + this.conf = { + skin: e || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxtoolbar") || "dhx_skyblue", + align: "left", + align_autostart: "left", + icons_path: "", + iconSize: 18, + sel_ofs_x: 0, + sel_ofs_y: 0, + xml_autoload: null, + items_autoload: null, + }; + if (typeof c == "object" && c != null && typeof c.tagName == "undefined") { + if (c.icons_path != null || c.icon_path != null) { + this.conf.icons_path = c.icons_path || c.icon_path; + } + if (c.icons_size != null) { + this.conf.icons_size_autoload = c.icons_size; + } + if (c.json != null) { + this.conf.json_autoload = c.json; + } + if (c.xml != null) { + this.conf.xml_autoload = c.xml; + } + if (c.onload != null) { + this.conf.onload_autoload = c.onload; + } + if (c.onclick != null || c.onClick != null) { + this.conf.auto_onclick = c.onclick || c.onClick; + } + if (c.items != null) { + this.conf.items_autoload = c.items; + } + if (c.skin != null) { + this.conf.skin = c.skin; + } + if (c.align != null) { + this.conf.align_autostart = c.align; + } + c = c.parent; + } + this.cont = typeof c != "object" ? document.getElementById(c) : c; + while (this.cont.childNodes.length > 0) { + this.cont.removeChild(this.cont.childNodes[0]); + } + c = null; + this.cont.dir = "ltr"; + this.base = document.createElement("DIV"); + this.base.className = "dhxtoolbar_float_left"; + this.cont.appendChild(this.base); + if (window.dhx4.isIPad) { + this.cont.ontouchstart = function (g) { + g = g || event; + if (String(g.target.tagName || "").toLowerCase() == "input") { + return true; + } + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + g.cancelBubble = true; + return false; + }; + } + this.setSkin(this.conf.skin); + this.objPull = {}; + this.anyUsed = "none"; + this._genStr = function (g) { + var h = "dhxId_"; + var l = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + for (var j = 0; j < g; j++) { + h += l.charAt(Math.round(Math.random() * (l.length - 1))); + } + return h; + }; + this.rootTypes = new Array("button", "buttonSelect", "buttonTwoState", "separator", "label", "slider", "text", "buttonInput"); + this.idPrefix = this._genStr(12); + window.dhx4._enableDataLoading(this, "_initObj", "_xmlToJson", "toolbar", { struct: true }); + window.dhx4._eventable(this); + this._getObj = function (l, g) { + var h = null; + for (var j = 0; j < l.childNodes.length; j++) { + if (l.childNodes[j].tagName != null) { + if (String(l.childNodes[j].tagName).toLowerCase() == String(g).toLowerCase()) { + h = l.childNodes[j]; + } + } + } + return h; + }; + this._addImgObj = function (h) { + var g = document.createElement("IMG"); + if (h.childNodes.length > 0) { + h.insertBefore(g, h.childNodes[0]); + } else { + h.appendChild(g); + } + return g; + }; + this._setItemImage = function (l, h, g) { + if (g == true) { + l.imgEn = h; + } else { + l.imgDis = h; + } + if ((!l.state && g == true) || (l.state && g == false)) { + return; + } + var j = this._getObj(l.obj, "img"); + if (j == null) { + j = this._addImgObj(l.obj); + } + j.src = this.conf.icons_path + h; + }; + this._clearItemImage = function (j, g) { + if (g == true) { + j.imgEn = ""; + } else { + j.imgDis = ""; + } + if ((!j.state && g == true) || (j.state && g == false)) { + return; + } + var h = this._getObj(j.obj, "img"); + if (h != null) { + h.parentNode.removeChild(h); + } + }; + this._setItemText = function (g, j) { + var h = this._getObj(g.obj, "div"); + if (j == null || j.length == 0) { + if (h != null) { + h.parentNode.removeChild(h); + } + return; + } + if (h == null) { + h = document.createElement("DIV"); + h.className = "dhxtoolbar_text"; + g.obj.appendChild(h); + } + h.innerHTML = j; + }; + this._getItemText = function (g) { + var h = this._getObj(g.obj, "div"); + if (h != null) { + return h.innerHTML; + } + return ""; + }; + this._enableItem = function (h) { + if (h.state) { + return; + } + h.state = true; + if (this.objPull[h.id]["type"] == "buttonTwoState" && this.objPull[h.id]["obj"]["pressed"] == true) { + h.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres"; + h.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"; + } else { + h.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; + h.obj.renderAs = h.obj.className; + } + if (h.arw) { + h.arw.className = String(h.obj.className).replace("btn", "arw"); + } + var g = this._getObj(h.obj, "img"); + if (h.imgEn != "") { + if (g == null) { + g = this._addImgObj(h.obj); + } + g.src = this.conf.icons_path + h.imgEn; + } else { + if (g != null) { + g.parentNode.removeChild(g); + } + } + }; + this._disableItem = function (h) { + if (!h.state) { + return; + } + h.state = false; + h.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.objPull[h.id]["type"] == "buttonTwoState" && h.obj.pressed ? "pres_" : "") + "dis"; + h.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; + if (h.arw) { + h.arw.className = String(h.obj.className).replace("btn", "arw"); + } + var g = this._getObj(h.obj, "img"); + if (h.imgDis != "") { + if (g == null) { + g = this._addImgObj(h.obj); + } + g.src = this.conf.icons_path + h.imgDis; + } else { + if (g != null) { + g.parentNode.removeChild(g); + } + } + if (h.polygon != null) { + if (h.polygon.style.display != "none") { + window.dhx4.zim.clear(h.polygon._idd); + h.polygon.style.display = "none"; + if (h.polygon._ie6cover) { + h.polygon._ie6cover.style.display = "none"; + } + if (this.conf.skin == "dhx_terrace") { + this._improveTerraceButtonSelect(h.id, true); + } + this.callEvent("onButtonSelectHide", [h.obj.idd]); + } + } + this.anyUsed = "none"; + }; + this.clearAll = function () { + for (var g in this.objPull) { + this._removeItem(String(g).replace(this.idPrefix, "")); + } + }; + this._doOnClick = function (g) { + if (a && a.forEachItem) { + a.forEachItem(function (j) { + if (a.objPull[a.idPrefix + j]["type"] == "buttonSelect") { + var h = a.objPull[a.idPrefix + j]; + if (h.arw._skip === true) { + h.arw._skip = false; + } else { + if (h.polygon.style.display != "none") { + h.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; + h.obj.className = h.obj.renderAs; + h.arw.className = String(h.obj.renderAs).replace("btn", "arw"); + a.anyUsed = "none"; + window.dhx4.zim.clear(h.polygon._idd); + h.polygon.style.display = "none"; + if (h.polygon._ie6cover) { + h.polygon._ie6cover.style.display = "none"; + } + if (a.conf.skin == "dhx_terrace") { + a._improveTerraceButtonSelect(h.id, true); + } + a.callEvent("onButtonSelectHide", [h.obj.idd]); + } + } + } + }); + } + }; + if (window.dhx4.isIPad) { + document.addEventListener("touchstart", this._doOnClick, false); + } else { + if (typeof window.addEventListener != "undefined") { + window.addEventListener("mousedown", this._doOnClick, false); + } else { + document.body.attachEvent("onmousedown", this._doOnClick); + } + } + if (this.conf.icons_size_autoload != null) { + this.setIconSize(this.conf.icons_size_autoload); + this.conf.icons_size_autoload = null; + } + if (this.conf.items_autoload != null) { + this.loadStruct(this.conf.items_autoload, this.conf.onload_autoload); + this.conf.items_autoload = null; + } else { + if (this.conf.json_autoload != null) { + this.loadStruct(this.conf.json_autoload, this.conf.onload_autoload); + this.conf.json_autoload = null; + } else { + if (this.conf.xml_autoload != null) { + this.loadStruct(this.conf.xml_autoload, this.conf.onload_autoload); + this.conf.xml_autoload = null; + } + } + } + if (this.conf.align_autostart != this.conf.align) { + this.setAlign(this.conf.align_autostart); + this.conf.align_autostart = null; + } + if (typeof this.conf.auto_onclick == "function") { + this.attachEvent("onClick", this.conf.auto_onclick); + } else { + if (typeof this.conf.auto_onclick == "string" && typeof window[this.conf.auto_onclick] == "function") { + this.attachEvent("onClick", window[this.conf.auto_onclick]); + } + } + return this; +} +dhtmlXToolbarObject.prototype.addSpacer = function (e) { + var c = this.idPrefix + e; + if (this._spacer != null) { + if (this._spacer.idd == e) { + return; + } + if (this._spacer == this.objPull[c].obj.parentNode) { + var a = true; + while (a) { + var l = this._spacer.childNodes[0].idd; + this.base.appendChild(this._spacer.childNodes[0]); + if (l == e || this._spacer.childNodes.length == 0) { + if (this.objPull[c].arw != null) { + this.base.appendChild(this.objPull[c].arw); + } + a = false; + } + } + this._spacer.idd = e; + this._fixSpacer(); + return; + } + if (this.base == this.objPull[c].obj.parentNode) { + var a = true; + var j = this.objPull[c].arw != null; + while (a) { + var g = this.base.childNodes.length - 1; + if (j == true) { + if (this.base.childNodes[g] == this.objPull[c].arw) { + a = false; + } + } + if (this.base.childNodes[g].idd == e) { + a = false; + } + if (a) { + if (this._spacer.childNodes.length > 0) { + this._spacer.insertBefore(this.base.childNodes[g], this._spacer.childNodes[0]); + } else { + this._spacer.appendChild(this.base.childNodes[g]); + } + } + } + this._spacer.idd = e; + this._fixSpacer(); + return; + } + } else { + var h = null; + for (var g = 0; g < this.base.childNodes.length; g++) { + if (this.base.childNodes[g] == this.objPull[this.idPrefix + e].obj) { + h = g; + if (this.objPull[this.idPrefix + e].arw != null) { + h = g + 1; + } + } + } + if (h != null) { + this._spacer = document.createElement("DIV"); + this._spacer.className = this.conf.align == "right" ? " dhxtoolbar_float_left" : " dhxtoolbar_float_right"; + this._spacer.dir = "ltr"; + this._spacer.idd = e; + while (this.base.childNodes.length > h + 1) { + this._spacer.appendChild(this.base.childNodes[h + 1]); + } + this.cont.appendChild(this._spacer); + this._fixSpacer(); + } + } + if (this.conf.skin == "dhx_terrace") { + this._improveTerraceSkin(); + } +}; +dhtmlXToolbarObject.prototype.removeSpacer = function () { + if (!this._spacer) { + return; + } + while (this._spacer.childNodes.length > 0) { + this.base.appendChild(this._spacer.childNodes[0]); + } + this._spacer.parentNode.removeChild(this._spacer); + this._spacer = null; + if (this.conf.skin == "dhx_terrace") { + this._improveTerraceSkin(); + } +}; +dhtmlXToolbarObject.prototype._fixSpacer = function () { + if (typeof window.addEventListener == "undefined" && this._spacer != null) { + this._spacer.style.borderLeft = "1px solid #a4bed4"; + var a = this._spacer; + window.setTimeout(function () { + a.style.borderLeft = "0px solid #a4bed4"; + a = null; + }, 1); + } +}; +dhtmlXToolbarObject.prototype.getType = function (e) { + var g = this.getParentId(e); + if (g != null) { + var c = null; + var a = this.objPull[this.idPrefix + g]._listOptions[e]; + if (a != null) { + if (a.sep != null) { + c = "buttonSelectSeparator"; + } else { + c = "buttonSelectButton"; + } + } + return c; + } else { + if (this.objPull[this.idPrefix + e] == null) { + return null; + } + return this.objPull[this.idPrefix + e]["type"]; + } +}; +dhtmlXToolbarObject.prototype.getTypeExt = function (c) { + var a = this.getType(c); + if (a == "buttonSelectButton" || a == "buttonSelectSeparator") { + if (a == "buttonSelectButton") { + a = "button"; + } else { + a = "separator"; + } + return a; + } + return null; +}; +dhtmlXToolbarObject.prototype.inArray = function (e, c) { + for (var a = 0; a < e.length; a++) { + if (e[a] == c) { + return true; + } + } + return false; +}; +dhtmlXToolbarObject.prototype.getParentId = function (g) { + var h = null; + for (var e in this.objPull) { + if (this.objPull[e]._listOptions) { + for (var c in this.objPull[e]._listOptions) { + if (c == g) { + h = String(e).replace(this.idPrefix, ""); + } + } + } + } + return h; +}; +dhtmlXToolbarObject.prototype._addItem = function (a, c) { + if (typeof a.text == "string") { + a.text = window.dhx4.trim(a.text); + if (a.text.length == 0) { + a.text = null; + } + } + this._addItemToStorage(a, c); + if (this.conf.skin == "dhx_terrace") { + this._improveTerraceSkin(); + } +}; +dhtmlXToolbarObject.prototype.addButton = function (h, g, c, a, e) { + this._addItem({ id: h, type: "button", text: c, img: a, imgdis: e }, g); +}; +dhtmlXToolbarObject.prototype.addText = function (e, c, a) { + this._addItem({ id: e, type: "text", text: a }, c); +}; +dhtmlXToolbarObject.prototype.addButtonSelect = function (g, m, r, a, c, n, l, v, h, j) { + var s = []; + for (var e = 0; e < a.length; e++) { + var o = {}; + if (a[e] instanceof Array) { + o.id = a[e][0]; + o.type = a[e][1] == "obj" ? "button" : "separator"; + o.text = a[e][2] || null; + o.img = a[e][3] || null; + } else { + if (a[e] instanceof Object && a[e] != null && typeof a[e].id != "undefined" && typeof a[e].type != "undefined") { + o.id = a[e].id; + o.type = a[e].type == "obj" ? "button" : "separator"; + o.text = a[e].text; + o.img = a[e].img; + } + } + s.push(o); + } + this._addItem({ id: g, type: "buttonSelect", text: r, img: c, imgdis: n, renderSelect: l, openAll: v, options: s, maxOpen: h, mode: j }, m); +}; +dhtmlXToolbarObject.prototype.addButtonTwoState = function (h, g, c, a, e) { + this._addItem({ id: h, type: "buttonTwoState", img: a, imgdis: e, text: c }, g); +}; +dhtmlXToolbarObject.prototype.addSeparator = function (c, a) { + this._addItem({ id: c, type: "separator" }, a); +}; +dhtmlXToolbarObject.prototype.addSlider = function (c, l, h, g, n, e, j, a, m) { + this._addItem({ id: c, type: "slider", length: h, valueMin: g, valueMax: n, valueNow: e, textMin: j, textMax: a, toolTip: m }, l); +}; +dhtmlXToolbarObject.prototype.addInput = function (g, e, c, a) { + this._addItem({ id: g, type: "buttonInput", value: c, width: a }, e); +}; +dhtmlXToolbarObject.prototype.forEachItem = function (e) { + for (var c in this.objPull) { + if (this.inArray(this.rootTypes, this.objPull[c]["type"])) { + e(this.objPull[c]["id"].replace(this.idPrefix, "")); + } + } +}; +(function () { + var j = "isVisible,enableItem,disableItem,isEnabled,setItemText,getItemText,setItemToolTip,getItemToolTip,getInput,setItemImage,setItemImageDis,clearItemImage,clearItemImageDis,setItemState,getItemState,setItemToolTipTemplate,getItemToolTipTemplate,setValue,getValue,setMinValue,getMinValue,setMaxValue,getMaxValue,setWidth,getWidth,setMaxOpen".split( + "," + ); + var e = [false, "", "", false, "", "", "", "", "", "", "", "", "", false, "", "", "", null, "", [null, null], "", [null, null], "", null]; + var c = function (l, m) { + return function (r, o, n) { + r = this.idPrefix + r; + if (this.objPull[r][l] != null) { + return this.objPull[r][l].call(this.objPull[r], o, n); + } else { + return m; + } + }; + }; + for (var h = 0; h < j.length; h++) { + var a = j[h]; + var g = e[h]; + dhtmlXToolbarObject.prototype[a] = c(a, g); + } +})(); +dhtmlXToolbarObject.prototype.showItem = function (a) { + a = this.idPrefix + a; + if (this.objPull[a] != null && this.objPull[a].showItem != null) { + this.objPull[a].showItem(); + if (this.conf.skin == "dhx_terrace") { + this._improveTerraceSkin(); + } + } +}; +dhtmlXToolbarObject.prototype.hideItem = function (a) { + a = this.idPrefix + a; + if (this.objPull[a] != null && this.objPull[a].hideItem != null) { + this.objPull[a].hideItem(); + if (this.conf.skin == "dhx_terrace") { + this._improveTerraceSkin(); + } + } +}; +dhtmlXToolbarObject.prototype.getPosition = function (a) { + return this._getPosition(a); +}; +dhtmlXToolbarObject.prototype._getPosition = function (h, e) { + if (this.objPull[this.idPrefix + h] == null) { + return null; + } + var g = null; + var a = 0; + for (var c = 0; c < this.base.childNodes.length; c++) { + if (this.base.childNodes[c].idd != null) { + if (this.base.childNodes[c].idd == h) { + g = a; + } + a++; + } + } + if (!g && this._spacer != null) { + for (var c = 0; c < this._spacer.childNodes.length; c++) { + if (this._spacer.childNodes[c].idd != null) { + if (this._spacer.childNodes[c].idd == h) { + g = a; + } + a++; + } + } + } + return g; +}; +dhtmlXToolbarObject.prototype.setPosition = function (a, c) { + this._setPosition(a, c); +}; +dhtmlXToolbarObject.prototype._setPosition = function (h, g) { + if (this.objPull[this.idPrefix + h] == null) { + return; + } + if (isNaN(g)) { + g = this.base.childNodes.length; + } + if (g < 0) { + g = 0; + } + var a = null; + if (this._spacer) { + a = this._spacer.idd; + this.removeSpacer(); + } + var e = this.objPull[this.idPrefix + h]; + this.base.removeChild(e.obj); + if (e.arw) { + this.base.removeChild(e.arw); + } + var c = this._getIdByPosition(g, true); + if (c[0] == null) { + this.base.appendChild(e.obj); + if (e.arw) { + this.base.appendChild(e.arw); + } + } else { + this.base.insertBefore(e.obj, this.base.childNodes[c[1]]); + if (e.arw) { + this.base.insertBefore(e.arw, this.base.childNodes[c[1] + 1]); + } + } + if (a != null) { + this.addSpacer(a); + } +}; +dhtmlXToolbarObject.prototype._getIdByPosition = function (j, c) { + var h = null; + var a = 0; + var e = 0; + for (var g = 0; g < this.base.childNodes.length; g++) { + if (this.base.childNodes[g]["idd"] != null && h == null) { + if (a++ == j) { + h = this.base.childNodes[g]["idd"]; + } + } + if (h == null) { + e++; + } + } + e = h == null ? null : e; + return c == true ? new Array(h, e) : h; +}; +dhtmlXToolbarObject.prototype.removeItem = function (a) { + this._removeItem(a); + if (this.conf.skin == "dhx_terrace") { + this._improveTerraceSkin(); + } +}; +dhtmlXToolbarObject.prototype._removeItem = function (h) { + var e = this.getType(h); + h = this.idPrefix + h; + var g = this.objPull[h]; + if (e == "button") { + g.obj._doOnMouseOver = null; + g.obj._doOnMouseOut = null; + g.obj._doOnMouseUp = null; + g.obj._doOnMouseUpOnceAnywhere = null; + g.obj.onclick = null; + g.obj.onmouseover = null; + g.obj.onmouseout = null; + g.obj.onmouseup = null; + g.obj.onmousedown = null; + g.obj.onselectstart = null; + g.obj.renderAs = null; + g.obj.idd = null; + g.obj.parentNode.removeChild(g.obj); + g.obj = null; + g.id = null; + g.state = null; + g.img = null; + g.imgEn = null; + g.imgDis = null; + g.type = null; + g.enableItem = null; + g.disableItem = null; + g.isEnabled = null; + g.showItem = null; + g.hideItem = null; + g.isVisible = null; + g.setItemText = null; + g.getItemText = null; + g.setItemImage = null; + g.clearItemImage = null; + g.setItemImageDis = null; + g.clearItemImageDis = null; + g.setItemToolTip = null; + g.getItemToolTip = null; + } + if (e == "buttonTwoState") { + g.obj._doOnMouseOver = null; + g.obj._doOnMouseOut = null; + g.obj.onmouseover = null; + g.obj.onmouseout = null; + g.obj.onmousedown = null; + g.obj.onselectstart = null; + g.obj.renderAs = null; + g.obj.idd = null; + g.obj.parentNode.removeChild(g.obj); + g.obj = null; + g.id = null; + g.state = null; + g.img = null; + g.imgEn = null; + g.imgDis = null; + g.type = null; + g.enableItem = null; + g.disableItem = null; + g.isEnabled = null; + g.showItem = null; + g.hideItem = null; + g.isVisible = null; + g.setItemText = null; + g.getItemText = null; + g.setItemImage = null; + g.clearItemImage = null; + g.setItemImageDis = null; + g.clearItemImageDis = null; + g.setItemToolTip = null; + g.getItemToolTip = null; + g.setItemState = null; + g.getItemState = null; + } + if (e == "buttonSelect") { + for (var c in g._listOptions) { + this.removeListOption(h, c); + } + g._listOptions = null; + if (g.polygon._ie6cover) { + document.body.removeChild(g.polygon._ie6cover); + g.polygon._ie6cover = null; + } + g.p_tbl.removeChild(g.p_tbody); + g.polygon.removeChild(g.p_tbl); + g.polygon.onselectstart = null; + document.body.removeChild(g.polygon); + g.p_tbody = null; + g.p_tbl = null; + g.polygon = null; + g.obj.onclick = null; + g.obj.onmouseover = null; + g.obj.onmouseout = null; + g.obj.onmouseup = null; + g.obj.onmousedown = null; + g.obj.onselectstart = null; + g.obj.idd = null; + g.obj.iddPrefix = null; + g.obj.parentNode.removeChild(g.obj); + g.obj = null; + g.arw.onclick = null; + g.arw.onmouseover = null; + g.arw.onmouseout = null; + g.arw.onmouseup = null; + g.arw.onmousedown = null; + g.arw.onselectstart = null; + g.arw.parentNode.removeChild(g.arw); + g.arw = null; + g.renderSelect = null; + g.state = null; + g.type = null; + g.id = null; + g.img = null; + g.imgEn = null; + g.imgDis = null; + g.openAll = null; + g._isListButton = null; + g._separatorButtonSelectObject = null; + g._buttonButtonSelectObject = null; + g.setWidth = null; + g.enableItem = null; + g.disableItem = null; + g.isEnabled = null; + g.showItem = null; + g.hideItem = null; + g.isVisible = null; + g.setItemText = null; + g.getItemText = null; + g.setItemImage = null; + g.clearItemImage = null; + g.setItemImageDis = null; + g.clearItemImageDis = null; + g.setItemToolTip = null; + g.getItemToolTip = null; + g.addListOption = null; + g.removeListOption = null; + g.showListOption = null; + g.hideListOption = null; + g.isListOptionVisible = null; + g.enableListOption = null; + g.disableListOption = null; + g.isListOptionEnabled = null; + g.setListOptionPosition = null; + g.getListOptionPosition = null; + g.setListOptionImage = null; + g.getListOptionImage = null; + g.clearListOptionImage = null; + g.setListOptionText = null; + g.getListOptionText = null; + g.setListOptionToolTip = null; + g.getListOptionToolTip = null; + g.forEachListOption = null; + g.getAllListOptions = null; + g.setListOptionSelected = null; + g.getListOptionSelected = null; + } + if (e == "buttonInput") { + g.obj.childNodes[0].onkeydown = null; + g.obj.removeChild(g.obj.childNodes[0]); + g.obj.w = null; + g.obj.idd = null; + g.obj.parentNode.removeChild(g.obj); + g.obj = null; + g.id = null; + g.type = null; + g.enableItem = null; + g.disableItem = null; + g.isEnabled = null; + g.showItem = null; + g.hideItem = null; + g.isVisible = null; + g.setItemToolTip = null; + g.getItemToolTip = null; + g.setWidth = null; + g.getWidth = null; + g.setValue = null; + g.getValue = null; + g.setItemText = null; + g.getItemText = null; + } + if (e == "slider") { + if (window.dhx4.isIPad) { + document.removeEventListener("touchmove", pen._doOnMouseMoveStart, false); + document.removeEventListener("touchend", pen._doOnMouseMoveEnd, false); + } else { + if (typeof window.addEventListener == "function") { + window.removeEventListener("mousemove", g.pen._doOnMouseMoveStart, false); + window.removeEventListener("mouseup", g.pen._doOnMouseMoveEnd, false); + } else { + document.body.detachEvent("onmousemove", g.pen._doOnMouseMoveStart); + document.body.detachEvent("onmouseup", g.pen._doOnMouseMoveEnd); + } + } + g.pen.allowMove = null; + g.pen.initXY = null; + g.pen.maxX = null; + g.pen.minX = null; + g.pen.nowX = null; + g.pen.newNowX = null; + g.pen.valueMax = null; + g.pen.valueMin = null; + g.pen.valueNow = null; + g.pen._definePos = null; + g.pen._detectLimits = null; + g.pen._doOnMouseMoveStart = null; + g.pen._doOnMouseMoveEnd = null; + g.pen.onmousedown = null; + g.obj.removeChild(g.pen); + g.pen = null; + g.label.tip = null; + document.body.removeChild(g.label); + g.label = null; + g.obj.onselectstart = null; + g.obj.idd = null; + while (g.obj.childNodes.length > 0) { + g.obj.removeChild(g.obj.childNodes[0]); + } + g.obj.parentNode.removeChild(g.obj); + g.obj = null; + g.id = null; + g.type = null; + g.state = null; + g.enableItem = null; + g.disableItem = null; + g.isEnabled = null; + g.setItemToolTipTemplate = null; + g.getItemToolTipTemplate = null; + g.setMaxValue = null; + g.setMinValue = null; + g.getMaxValue = null; + g.getMinValue = null; + g.setValue = null; + g.getValue = null; + g.showItem = null; + g.hideItem = null; + g.isVisible = null; + } + if (e == "separator") { + g.obj.onselectstart = null; + g.obj.idd = null; + g.obj.parentNode.removeChild(g.obj); + g.obj = null; + g.id = null; + g.type = null; + g.showItem = null; + g.hideItem = null; + g.isVisible = null; + } + if (e == "text") { + g.obj.onselectstart = null; + g.obj.idd = null; + g.obj.parentNode.removeChild(g.obj); + g.obj = null; + g.id = null; + g.type = null; + g.showItem = null; + g.hideItem = null; + g.isVisible = null; + g.setWidth = null; + g.setItemText = null; + g.getItemText = null; + } + e = null; + g = null; + this.objPull[this.idPrefix + h] = null; + delete this.objPull[this.idPrefix + h]; +}; +(function () { + var g = "addListOption,removeListOption,showListOption,hideListOption,isListOptionVisible,enableListOption,disableListOption,isListOptionEnabled,setListOptionPosition,getListOptionPosition,setListOptionText,getListOptionText,setListOptionToolTip,getListOptionToolTip,setListOptionImage,getListOptionImage,clearListOptionImage,forEachListOption,getAllListOptions,setListOptionSelected,getListOptionSelected".split( + "," + ); + var c = function (h) { + return function (r, l, j, o, n, m) { + r = this.idPrefix + r; + if (this.objPull[r] == null) { + return; + } + if (this.objPull[r]["type"] != "buttonSelect") { + return; + } + return this.objPull[r][h].call(this.objPull[r], l, j, o, n, m); + }; + }; + for (var e = 0; e < g.length; e++) { + var a = g[e]; + dhtmlXToolbarObject.prototype[a] = c(a); + } +})(); +dhtmlXToolbarObject.prototype._rtlParseBtn = function (c, a) { + return c + a; +}; +dhtmlXToolbarObject.prototype._separatorObject = function (a, e, c) { + this.id = a.idPrefix + e; + this.obj = document.createElement("DIV"); + this.obj.className = "dhx_toolbar_sep"; + this.obj.style.display = c.hidden != null ? "none" : ""; + this.obj.idd = String(e); + this.obj.title = c.title || ""; + this.obj.onselectstart = function (g) { + g = g || event; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + }; + if (window.dhx4.isIPad) { + this.obj.ontouchstart = function (g) { + g = g || event; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + g.cancelBubble = true; + return false; + }; + } + a.base.appendChild(this.obj); + this.showItem = function () { + this.obj.style.display = ""; + }; + this.hideItem = function () { + this.obj.style.display = "none"; + }; + this.isVisible = function () { + return this.obj.style.display == ""; + }; + return this; +}; +dhtmlXToolbarObject.prototype._textObject = function (a, e, c) { + this.id = a.idPrefix + e; + this.obj = document.createElement("DIV"); + this.obj.className = "dhx_toolbar_text"; + this.obj.style.display = c.hidden != null ? "none" : ""; + this.obj.idd = String(e); + this.obj.title = c.title || ""; + this.obj.onselectstart = function (g) { + g = g || event; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + }; + if (window.dhx4.isIPad) { + this.obj.ontouchstart = function (g) { + g = g || event; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + g.cancelBubble = true; + return false; + }; + } + this.obj.innerHTML = c.text || ""; + a.base.appendChild(this.obj); + this.showItem = function () { + this.obj.style.display = ""; + }; + this.hideItem = function () { + this.obj.style.display = "none"; + }; + this.isVisible = function () { + return this.obj.style.display == ""; + }; + this.setItemText = function (g) { + this.obj.innerHTML = g; + }; + this.getItemText = function () { + return this.obj.innerHTML; + }; + this.setWidth = function (g) { + this.obj.style.width = g + "px"; + }; + this.setItemToolTip = function (g) { + this.obj.title = g; + }; + this.getItemToolTip = function () { + return this.obj.title; + }; + return this; +}; +dhtmlXToolbarObject.prototype._buttonObject = function (a, g, c) { + this.id = a.idPrefix + g; + this.state = c.enabled != null ? false : true; + this.imgEn = c.img || ""; + this.imgDis = c.imgdis || ""; + this.img = this.state ? (this.imgEn != "" ? this.imgEn : "") : this.imgDis != "" ? this.imgDis : ""; + this.obj = document.createElement("DIV"); + this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis"); + this.obj.style.display = c.hidden != null ? "none" : ""; + this.obj.allowClick = false; + this.obj.extAction = c.action || null; + this.obj.renderAs = this.obj.className; + this.obj.idd = String(g); + this.obj.title = c.title || ""; + this.obj.pressed = false; + this.obj.innerHTML = a._rtlParseBtn(this.img != "" ? "" : "", c.text != null ? "
" + c.text + "
" : ""); + var e = this; + this.obj.onselectstart = function (h) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + }; + this.obj.onmouseover = function () { + this._doOnMouseOver(); + }; + this.obj.onmouseout = function () { + this._doOnMouseOut(); + }; + this.obj._doOnMouseOver = function () { + this.allowClick = true; + if (e.state == false) { + return; + } + if (a.anyUsed != "none") { + return; + } + this.className = "dhx_toolbar_btn dhxtoolbar_btn_over"; + this.renderAs = this.className; + }; + this.obj._doOnMouseOut = function () { + this.allowClick = false; + if (e.state == false) { + return; + } + if (a.anyUsed != "none") { + return; + } + this.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; + this.renderAs = this.renderAs; + }; + this.obj.onclick = function (h) { + if (e.state == false) { + return; + } + if (this.allowClick == false) { + return; + } + h = h || event; + var j = this.idd.replace(a.idPrefix, ""); + if (this.extAction) { + try { + window[this.extAction](j); + } catch (h) {} + } + if (a && a.callEvent) { + a.callEvent("onClick", [j]); + } + }; + this.obj[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function (h) { + if (e.state == false) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + h.cancelBubble = true; + return false; + } + if (a.anyUsed != "none") { + return; + } + a.anyUsed = this.idd; + this.className = "dhx_toolbar_btn dhxtoolbar_btn_pres"; + this.pressed = true; + this.onmouseover = function () { + this._doOnMouseOver(); + }; + this.onmouseout = function () { + a.anyUsed = "none"; + this._doOnMouseOut(); + }; + return false; + }; + this.obj[window.dhx4.isIPad ? "ontouchend" : "onmouseup"] = function (l) { + if (e.state == false) { + return; + } + if (a.anyUsed != "none") { + if (a.anyUsed != this.idd) { + return; + } + } + var j = a.anyUsed; + this._doOnMouseUp(); + if (window.dhx4.isIPad && j != "none") { + if (this.extAction) { + var h = this; + window.setTimeout(function () { + try { + window[h.extAction](g); + } catch (m) {} + h = null; + }, 1); + } + a.callEvent("onClick", [this.idd.replace(a.idPrefix, "")]); + } + }; + if (window.dhx4.isIPad) { + this.obj.ontouchmove = function (h) { + this._doOnMouseUp(); + }; + } + this.obj._doOnMouseUp = function () { + a.anyUsed = "none"; + this.className = this.renderAs; + this.pressed = false; + }; + this.obj._doOnMouseUpOnceAnywhere = function () { + this._doOnMouseUp(); + this.onmouseover = function () { + this._doOnMouseOver(); + }; + this.onmouseout = function () { + this._doOnMouseOut(); + }; + }; + a.base.appendChild(this.obj); + this.enableItem = function () { + a._enableItem(this); + }; + this.disableItem = function () { + a._disableItem(this); + }; + this.isEnabled = function () { + return this.state; + }; + this.showItem = function () { + this.obj.style.display = ""; + }; + this.hideItem = function () { + this.obj.style.display = "none"; + }; + this.isVisible = function () { + return this.obj.style.display == ""; + }; + this.setItemText = function (h) { + a._setItemText(this, h); + }; + this.getItemText = function () { + return a._getItemText(this); + }; + this.setItemImage = function (h) { + a._setItemImage(this, h, true); + }; + this.clearItemImage = function () { + a._clearItemImage(this, true); + }; + this.setItemImageDis = function (h) { + a._setItemImage(this, h, false); + }; + this.clearItemImageDis = function () { + a._clearItemImage(this, false); + }; + this.setItemToolTip = function (h) { + this.obj.title = h; + }; + this.getItemToolTip = function () { + return this.obj.title; + }; + return this; +}; +dhtmlXToolbarObject.prototype._buttonSelectObject = function (e, j, h) { + this.id = e.idPrefix + j; + this.state = h.enabled != null ? (h.enabled == "true" ? true : false) : true; + this.imgEn = h.img || ""; + this.imgDis = h.imgdis || ""; + this.img = this.state ? (this.imgEn != "" ? this.imgEn : "") : this.imgDis != "" ? this.imgDis : ""; + this.mode = h.mode || "button"; + if (this.mode == "select") { + this.openAll = true; + this.renderSelect = false; + if (!h.text || h.text.length == 0) { + h.text = " "; + } + } else { + this.openAll = window.dhx4.s2b(h.openAll) == true; + this.renderSelect = h.renderSelect == null ? true : window.dhx4.s2b(h.renderSelect); + } + this.maxOpen = !isNaN(h.maxOpen ? h.maxOpen : "") ? h.maxOpen : null; + this._maxOpenTest = function () { + if (!isNaN(this.maxOpen)) { + if (!e._sbw) { + var m = document.createElement("DIV"); + m.className = "dhxtoolbar_maxopen_test"; + document.body.appendChild(m); + var l = document.createElement("DIV"); + l.className = "dhxtoolbar_maxopen_test2"; + m.appendChild(l); + e._sbw = m.offsetWidth - l.offsetWidth; + m.removeChild(l); + l = null; + document.body.removeChild(m); + m = null; + } + } + }; + this._maxOpenTest(); + this.obj = document.createElement("DIV"); + this.obj.allowClick = false; + this.obj.extAction = h.action || null; + this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis"); + this.obj.style.display = h.hidden != null ? "none" : ""; + this.obj.renderAs = this.obj.className; + this.obj.onselectstart = function (l) { + l = l || event; + if (l.preventDefault) { + l.preventDefault(); + } else { + l.returnValue = false; + } + }; + this.obj.idd = String(j); + this.obj.title = h.title || ""; + this.obj.pressed = false; + this.callEvent = false; + this.obj.innerHTML = e._rtlParseBtn(this.img != "" ? "" : "", h.text != null ? "
" + h.text + "
" : ""); + e.base.appendChild(this.obj); + this.arw = document.createElement("DIV"); + this.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_" + (this.state ? "def" : "dis"); + this.arw.style.display = this.obj.style.display; + this.arw.innerHTML = "
 
"; + this.arw.title = this.obj.title; + this.arw.onselectstart = function (l) { + l = l || event; + if (l.preventDefault) { + l.preventDefault(); + } else { + l.returnValue = false; + } + }; + e.base.appendChild(this.arw); + var a = this; + this.obj.onmouseover = function (l) { + l = l || event; + if (e.anyUsed != "none") { + return; + } + if (!a.state) { + return; + } + a.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"; + a.obj.className = a.obj.renderAs; + a.arw.className = String(a.obj.renderAs).replace("btn", "arw"); + }; + this.obj.onmouseout = function () { + a.obj.allowClick = false; + if (e.anyUsed != "none") { + return; + } + if (!a.state) { + return; + } + a.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; + a.obj.className = a.obj.renderAs; + a.arw.className = String(a.obj.renderAs).replace("btn", "arw"); + a.callEvent = false; + }; + this.arw.onmouseover = this.obj.onmouseover; + this.arw.onmouseout = this.obj.onmouseout; + if (this.openAll == true) { + } else { + this.obj.onclick = function (l) { + l = l || event; + if (!a.obj.allowClick) { + return; + } + if (!a.state) { + return; + } + if (e.anyUsed != "none") { + return; + } + var m = a.obj.idd.replace(e.idPrefix, ""); + if (a.obj.extAction) { + try { + window[a.obj.extAction](m); + } catch (l) {} + } + e.callEvent("onClick", [m]); + }; + this.obj[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function (l) { + l = l || event; + if (e.anyUsed != "none") { + return; + } + if (!a.state) { + return; + } + a.obj.allowClick = true; + a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres"; + a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_pres"; + a.callEvent = true; + }; + this.obj[window.dhx4.isIPad ? "ontouchend" : "onmouseup"] = function (m) { + m = m || event; + m.cancelBubble = true; + if (e.anyUsed != "none") { + return; + } + if (!a.state) { + return; + } + a.obj.className = a.obj.renderAs; + a.arw.className = String(a.obj.renderAs).replace("btn", "arw"); + if (window.dhx4.isIPad) { + if (this.extAction) { + var l = this; + window.setTimeout(function () { + try { + window[l.extAction](n); + } catch (o) {} + l = null; + }, 1); + } + if (a.callEvent) { + var n = a.obj.idd.replace(e.idPrefix, ""); + e.callEvent("onClick", [n]); + } + } + }; + } + if (window.dhx4.isIPad) { + this.obj.ontouchmove = this.obj.onmouseout; + } + this.arw[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function (n) { + n = n || event; + var w = this.className.indexOf("dhx_toolbar_arw") === 0 ? this : this.nextSibling; + if (w._skip) { + n = n || event; + n.cancelBubble = true; + } else { + w._skip = true; + } + w = null; + if (!a.state) { + return; + } + if (e.anyUsed == a.obj.idd) { + a.obj.className = a.obj.renderAs; + a.arw.className = String(a.obj.renderAs).replace("btn", "arw"); + e.anyUsed = "none"; + window.dhx4.zim.clear(a.polygon._idd); + a.polygon.style.display = "none"; + if (a.polygon._ie6cover) { + a.polygon._ie6cover.style.display = "none"; + } + if (e.conf.skin == "dhx_terrace") { + e._improveTerraceButtonSelect(a.id, true); + } + e.callEvent("onButtonSelectHide", [a.obj.idd]); + } else { + if (e.anyUsed != "none") { + if (e.objPull[e.idPrefix + e.anyUsed]["type"] == "buttonSelect") { + var v = e.objPull[e.idPrefix + e.anyUsed]; + if (v.polygon.style.display != "none") { + v.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; + v.obj.className = v.obj.renderAs; + v.arw.className = String(a.obj.renderAs).replace("btn", "arw"); + window.dhx4.zim.clear(v.polygon._idd); + v.polygon.style.display = "none"; + if (v.polygon._ie6cover) { + v.polygon._ie6cover.style.display = "none"; + } + if (e.conf.skin == "dhx_terrace") { + e._improveTerraceButtonSelect(v.id, true); + } + e.callEvent("onButtonSelectHide", [v.obj.idd]); + } + } + } + a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_over"; + a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_pres"; + e.anyUsed = a.obj.idd; + a.polygon.style.top = "0px"; + a.polygon.style.visibility = "hidden"; + a.polygon.style.zIndex = window.dhx4.zim.reserve(a.polygon._idd); + a.polygon.style.display = ""; + if (e.conf.skin == "dhx_terrace") { + e._improveTerraceButtonSelect(a.id, false); + } + a._fixMaxOpenHeight(a.maxOpen || null); + e._autoDetectVisibleArea(); + var o = window.dhx4.absTop(a.obj) + a.obj.offsetHeight + e.conf.sel_ofs_y; + var s = a.polygon.offsetHeight; + if (o + s > e.tY2) { + var r = a.maxOpen != null ? Math.floor((e.tY2 - o) / 22) : 0; + if (r >= 1) { + a._fixMaxOpenHeight(r); + } else { + o = window.dhx4.absTop(a.obj) - s - e.conf.sel_ofs_y; + if (o < 0) { + o = 0; + } + } + } + a.polygon.style.top = o + "px"; + if (e.rtl) { + a.polygon.style.left = window.dhx4.absLeft(a.obj) + a.obj.offsetWidth - a.polygon.offsetWidth + e.conf.sel_ofs_x + "px"; + } else { + var m = document.body.scrollLeft; + var l = m + (window.innerWidth || document.body.clientWidth); + var u = window.dhx4.absLeft(a.obj) + e.conf.sel_ofs_x; + if (u + a.polygon.offsetWidth > l) { + u = window.dhx4.absLeft(a.arw) + a.arw.offsetWidth - a.polygon.offsetWidth; + } + a.polygon.style.left = Math.max(u, 5) + "px"; + } + a.polygon.style.visibility = "visible"; + if (a.polygon._ie6cover) { + a.polygon._ie6cover.style.left = a.polygon.style.left; + a.polygon._ie6cover.style.top = a.polygon.style.top; + a.polygon._ie6cover.style.width = a.polygon.offsetWidth + "px"; + a.polygon._ie6cover.style.height = a.polygon.offsetHeight + "px"; + a.polygon._ie6cover.style.display = ""; + } + e.callEvent("onButtonSelectShow", [a.obj.idd]); + } + return false; + }; + this.arw.onclick = function (l) { + l = l || event; + l.cancelBubble = true; + }; + this.arw[window.dhx4.isIPad ? "ontouchend" : "onmouseup"] = function (l) { + l = l || event; + l.cancelBubble = true; + }; + if (this.openAll === true) { + this.obj.onclick = this.arw.onclick; + this.obj.onmousedown = this.arw.onmousedown; + this.obj.onmouseup = this.arw.onmouseup; + if (window.dhx4.isIPad) { + this.obj.ontouchstart = this.arw.ontouchstart; + this.obj.ontouchend = this.arw.ontouchend; + } + } + this.obj.iddPrefix = e.idPrefix; + this._listOptions = {}; + this._fixMaxOpenHeight = function (r) { + var o = "auto"; + var n = false; + if (r !== null) { + var m = 0; + for (var l in this._listOptions) { + m++; + } + if (m > r) { + this._ph = 22 * r; + o = this._ph + "px"; + } else { + n = true; + } + } + this.polygon.style.width = "auto"; + this.polygon.style.height = "auto"; + if (!n && a.maxOpen != null) { + this.polygon.style.width = this.p_tbl.offsetWidth + e._sbw + "px"; + this.polygon.style.height = o; + } + }; + this._separatorButtonSelectObject = function (n, l, m) { + this.obj = {}; + this.obj.tr = document.createElement("TR"); + this.obj.tr.className = "tr_sep"; + this.obj.tr.onselectstart = function (o) { + o = o || event; + if (o.preventDefault) { + o.preventDefault(); + } else { + o.returnValue = false; + } + return false; + }; + this.obj.td = document.createElement("TD"); + this.obj.td.colSpan = "2"; + this.obj.td.className = "td_btn_sep"; + this.obj.td.onselectstart = function (o) { + o = o || event; + if (o.preventDefault) { + o.preventDefault(); + } else { + o.returnValue = false; + } + return false; + }; + if (isNaN(m)) { + m = a.p_tbody.childNodes.length + 1; + } else { + if (m < 1) { + m = 1; + } + } + if (m > a.p_tbody.childNodes.length) { + a.p_tbody.appendChild(this.obj.tr); + } else { + a.p_tbody.insertBefore(this.obj.tr, a.p_tbody.childNodes[m - 1]); + } + this.obj.tr.appendChild(this.obj.td); + this.obj.sep = document.createElement("DIV"); + this.obj.sep.className = "btn_sep"; + this.obj.sep.onselectstart = function (o) { + o = o || event; + if (o.preventDefault) { + o.preventDefault(); + } else { + o.returnValue = false; + } + return false; + }; + this.obj.td.appendChild(this.obj.sep); + a._listOptions[n] = this.obj; + return this; + }; + this._buttonButtonSelectObject = function (r, n, o) { + var m = true; + if (typeof n.enabled != "undefined") { + m = window.dhx4.s2b(n.enabled); + } else { + if (typeof n.disabled != "undefined") { + m = window.dhx4.s2b(n.disabled); + } + } + this.obj = {}; + this.obj.tr = document.createElement("TR"); + this.obj.tr.en = m; + this.obj.tr.extAction = n.action || null; + this.obj.tr._selected = n.selected != null; + this.obj.tr.className = "tr_btn" + (this.obj.tr.en ? (this.obj.tr._selected && a.renderSelect ? " tr_btn_selected" : "") : " tr_btn_disabled"); + this.obj.tr.onselectstart = function (s) { + s = s || event; + if (s.preventDefault) { + s.preventDefault(); + } else { + s.returnValue = false; + } + return false; + }; + this.obj.tr.idd = String(r); + if (isNaN(o)) { + o = a.p_tbody.childNodes.length + 1; + } else { + if (o < 1) { + o = 1; + } + } + if (o > a.p_tbody.childNodes.length) { + a.p_tbody.appendChild(this.obj.tr); + } else { + a.p_tbody.insertBefore(this.obj.tr, a.p_tbody.childNodes[o - 1]); + } + this.obj.td_a = document.createElement("TD"); + this.obj.td_a.className = "td_btn_img"; + this.obj.td_a.onselectstart = function (s) { + s = s || event; + if (s.preventDefault) { + s.preventDefault(); + } else { + s.returnValue = false; + } + return false; + }; + this.obj.td_b = document.createElement("TD"); + this.obj.td_b.className = "td_btn_txt"; + this.obj.td_b.onselectstart = function (s) { + s = s || event; + if (s.preventDefault) { + s.preventDefault(); + } else { + s.returnValue = false; + } + return false; + }; + if (e.rtl) { + this.obj.tr.appendChild(this.obj.td_b); + this.obj.tr.appendChild(this.obj.td_a); + } else { + this.obj.tr.appendChild(this.obj.td_a); + this.obj.tr.appendChild(this.obj.td_b); + } + if (n.img != null) { + this.obj.td_a.innerHTML = ""; + this.obj.tr._img = n.img; + } else { + this.obj.td_a.innerHTML = " "; + } + var l = n.text != null ? n.text : n.itemText || ""; + this.obj.td_b.innerHTML = "
" + l + "
"; + this.obj.tr[window.dhx4.isIPad ? "ontouchstart" : "onmouseover"] = function () { + if (!this.en || (this._selected && a.renderSelect)) { + return; + } + this.className = "tr_btn tr_btn_over"; + }; + this.obj.tr.onmouseout = function () { + if (!this.en) { + return; + } + if (this._selected && a.renderSelect) { + if (String(this.className).search("tr_btn_selected") == -1) { + this.className = "tr_btn tr_btn_selected"; + } + } else { + this.className = "tr_btn"; + } + }; + this.obj.tr[window.dhx4.isIPad ? "ontouchend" : "onclick"] = function (s) { + s = s || event; + s.cancelBubble = true; + if (!this.en) { + return; + } + a.setListOptionSelected(this.idd.replace(e.idPrefix, "")); + a.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; + a.obj.className = a.obj.renderAs; + a.arw.className = String(a.obj.renderAs).replace("btn", "arw"); + window.dhx4.zim.clear(a.polygon._idd); + a.polygon.style.display = "none"; + if (a.polygon._ie6cover) { + a.polygon._ie6cover.style.display = "none"; + } + if (e.conf.skin == "dhx_terrace") { + e._improveTerraceButtonSelect(a.id, true); + } + e.anyUsed = "none"; + e.callEvent("onButtonSelectHide", [a.obj.idd]); + var u = this.idd.replace(e.idPrefix, ""); + if (this.extAction) { + try { + window[this.extAction](u); + } catch (s) {} + } + e.callEvent("onClick", [u]); + }; + a._listOptions[r] = this.obj; + return this; + }; + this.polygon = document.createElement("DIV"); + this.polygon.dir = "ltr"; + this.polygon.style.display = "none"; + this.polygon.className = "dhx_toolbar_poly_" + e.conf.skin + " dhxtoolbar_icons_" + e.conf.iconSize; + this.polygon.onselectstart = function (l) { + l = l || event; + if (l.preventDefault) { + l.preventDefault(); + } else { + l.returnValue = false; + } + }; + this.polygon.onmousedown = function (l) { + l = l || event; + l.cancelBubble = true; + }; + this.polygon.style.overflowY = "auto"; + this.polygon._idd = window.dhx4.newId(); + if (window.dhx4.isIPad) { + this.polygon.ontouchstart = function (l) { + l = l || event; + if (l.preventDefault) { + l.preventDefault(); + } else { + l.returnValue = false; + } + l.cancelBubble = true; + return false; + }; + } + this.p_tbl = document.createElement("TABLE"); + this.p_tbl.className = "buttons_cont"; + this.p_tbl.cellSpacing = "0"; + this.p_tbl.cellPadding = "0"; + this.p_tbl.border = "0"; + this.polygon.appendChild(this.p_tbl); + this.p_tbody = document.createElement("TBODY"); + this.p_tbl.appendChild(this.p_tbody); + if (h.options != null) { + for (var g = 0; g < h.options.length; g++) { + var c = "_" + (h.options[g].type || "") + "ButtonSelectObject"; + if (h.options[g].id == null) { + h.options[g].id = e._genStr(24); + } + if (typeof this[c] == "function") { + new this[c](h.options[g].id, h.options[g]); + } + } + } + document.body.appendChild(this.polygon); + if (window.dhx4.isIE6) { + this.polygon._ie6cover = document.createElement("IFRAME"); + this.polygon._ie6cover.frameBorder = 0; + this.polygon._ie6cover.style.position = "absolute"; + this.polygon._ie6cover.style.border = "none"; + this.polygon._ie6cover.style.backgroundColor = "#000000"; + this.polygon._ie6cover.style.filter = "alpha(opacity=100)"; + this.polygon._ie6cover.style.display = "none"; + this.polygon._ie6cover.setAttribute("src", "javascript:false;"); + document.body.appendChild(this.polygon._ie6cover); + } + this.setWidth = function (l) { + this.obj.style.width = l - this.arw.offsetWidth + "px"; + this.polygon.style.width = this.obj.offsetWidth + this.arw.offsetWidth - 2 + "px"; + this.p_tbl.style.width = this.polygon.style.width; + }; + this.enableItem = function () { + e._enableItem(this); + }; + this.disableItem = function () { + e._disableItem(this); + }; + this.isEnabled = function () { + return this.state; + }; + this.showItem = function () { + this.obj.style.display = ""; + this.arw.style.display = ""; + }; + this.hideItem = function () { + this.obj.style.display = "none"; + this.arw.style.display = "none"; + }; + this.isVisible = function () { + return this.obj.style.display == ""; + }; + this.setItemText = function (l) { + e._setItemText(this, l); + }; + this.getItemText = function () { + return e._getItemText(this); + }; + this.setItemImage = function (l) { + e._setItemImage(this, l, true); + }; + this.clearItemImage = function () { + e._clearItemImage(this, true); + }; + this.setItemImageDis = function (l) { + e._setItemImage(this, l, false); + }; + this.clearItemImageDis = function () { + e._clearItemImage(this, false); + }; + this.setItemToolTip = function (l) { + this.obj.title = l; + this.arw.title = l; + }; + this.getItemToolTip = function () { + return this.obj.title; + }; + this.addListOption = function (s, r, n, o, l) { + if (!(n == "button" || n == "separator")) { + return; + } + var m = { id: s, type: n, text: o, img: l }; + new this["_" + n + "ButtonSelectObject"](s, m, r); + }; + this.removeListOption = function (n) { + if (!this._isListButton(n, true)) { + return; + } + var l = this._listOptions[n]; + if (l.td_a != null && l.td_b != null) { + l.td_a.onselectstart = null; + l.td_b.onselectstart = null; + while (l.td_a.childNodes.length > 0) { + l.td_a.removeChild(l.td_a.childNodes[0]); + } + while (l.td_b.childNodes.length > 0) { + l.td_b.removeChild(l.td_b.childNodes[0]); + } + l.tr.onselectstart = null; + l.tr.onmouseover = null; + l.tr.onmouseout = null; + l.tr.onclick = null; + while (l.tr.childNodes.length > 0) { + l.tr.removeChild(l.tr.childNodes[0]); + } + l.tr.parentNode.removeChild(l.tr); + l.td_a = null; + l.td_b = null; + l.tr = null; + } else { + l.sep.onselectstart = null; + l.td.onselectstart = null; + l.tr.onselectstart = null; + while (l.td.childNodes.length > 0) { + l.td.removeChild(l.td.childNodes[0]); + } + while (l.tr.childNodes.length > 0) { + l.tr.removeChild(l.tr.childNodes[0]); + } + l.tr.parentNode.removeChild(l.tr); + l.sep = null; + l.td = null; + l.tr = null; + } + l = null; + this._listOptions[n] = null; + try { + delete this._listOptions[n]; + } catch (m) {} + }; + this.showListOption = function (l) { + if (!this._isListButton(l, true)) { + return; + } + this._listOptions[l].tr.style.display = ""; + }; + this.hideListOption = function (l) { + if (!this._isListButton(l, true)) { + return; + } + this._listOptions[l].tr.style.display = "none"; + }; + this.isListOptionVisible = function (l) { + if (!this._isListButton(l, true)) { + return; + } + return this._listOptions[l].tr.style.display != "none"; + }; + this.enableListOption = function (l) { + if (!this._isListButton(l)) { + return; + } + this._listOptions[l].tr.en = true; + this._listOptions[l].tr.className = "tr_btn" + (this._listOptions[l].tr._selected && e.renderSelect ? " tr_btn_selected" : ""); + }; + this.disableListOption = function (l) { + if (!this._isListButton(l)) { + return; + } + this._listOptions[l].tr.en = false; + this._listOptions[l].tr.className = "tr_btn tr_btn_disabled"; + }; + this.isListOptionEnabled = function (l) { + if (!this._isListButton(l)) { + return; + } + return this._listOptions[l].tr.en; + }; + this.setListOptionPosition = function (n, m) { + if (!this._listOptions[n] || this.getListOptionPosition(n) == m || isNaN(m)) { + return; + } + if (m < 1) { + m = 1; + } + var l = this._listOptions[n].tr; + this.p_tbody.removeChild(l); + if (m > this.p_tbody.childNodes.length) { + this.p_tbody.appendChild(l); + } else { + this.p_tbody.insertBefore(l, this.p_tbody.childNodes[m - 1]); + } + l = null; + }; + this.getListOptionPosition = function (n) { + var m = -1; + if (!this._listOptions[n]) { + return m; + } + for (var l = 0; l < this.p_tbody.childNodes.length; l++) { + if (this.p_tbody.childNodes[l] == this._listOptions[n].tr) { + m = l + 1; + } + } + return m; + }; + this.setListOptionImage = function (n, l) { + if (!this._isListButton(n)) { + return; + } + var m = this._listOptions[n].tr.childNodes[e.rtl ? 1 : 0]; + m.innerHTML = ""; + m = null; + }; + this.getListOptionImage = function (n) { + if (!this._isListButton(n)) { + return; + } + var m = this._listOptions[n].tr.childNodes[e.rtl ? 1 : 0]; + var l = null; + if (m.childNodes.length > 0) { + l = m.childNodes[0].src; + } + m = null; + return l; + }; + this.clearListOptionImage = function (m) { + if (!this._isListButton(m)) { + return; + } + var l = this._listOptions[m].tr.childNodes[e.rtl ? 1 : 0]; + while (l.childNodes.length > 0) { + l.removeChild(l.childNodes[0]); + } + l.innerHTML = " "; + l = null; + }; + this.setListOptionText = function (m, l) { + if (!this._isListButton(m)) { + return; + } + this._listOptions[m].tr.childNodes[e.rtl ? 0 : 1].childNodes[0].innerHTML = l; + }; + this.getListOptionText = function (l) { + if (!this._isListButton(l)) { + return; + } + return this._listOptions[l].tr.childNodes[e.rtl ? 0 : 1].childNodes[0].innerHTML; + }; + this.setListOptionToolTip = function (m, l) { + if (!this._isListButton(m)) { + return; + } + this._listOptions[m].tr.title = l; + }; + this.getListOptionToolTip = function (l) { + if (!this._isListButton(l)) { + return; + } + return this._listOptions[l].tr.title; + }; + this.forEachListOption = function (m) { + for (var l in this._listOptions) { + m(l); + } + }; + this.getAllListOptions = function () { + var m = new Array(); + for (var l in this._listOptions) { + m[m.length] = l; + } + return m; + }; + this.setListOptionSelected = function (n) { + for (var l in this._listOptions) { + var m = this._listOptions[l]; + if (m.td_a != null && m.td_b != null && m.tr.en) { + if (l == n) { + m.tr._selected = true; + m.tr.className = "tr_btn" + (this.renderSelect ? " tr_btn_selected" : ""); + if (this.mode == "select") { + if (m.tr._img) { + this.setItemImage(m.tr._img); + } else { + this.clearItemImage(); + } + this.setItemText(this.getListOptionText(n)); + } + } else { + m.tr._selected = false; + m.tr.className = "tr_btn"; + } + } + m = null; + } + }; + this.getListOptionSelected = function () { + var m = null; + for (var l in this._listOptions) { + if (this._listOptions[l].tr._selected == true) { + m = l; + } + } + return m; + }; + this._isListButton = function (m, l) { + if (this._listOptions[m] == null) { + return false; + } + if (!l && this._listOptions[m].tr.className == "tr_sep") { + return false; + } + return true; + }; + this.setMaxOpen = function (l) { + this._ph = null; + if (typeof l == "number") { + this.maxOpen = l; + this._maxOpenTest(); + return; + } + this.maxOpen = null; + }; + if (h.width) { + this.setWidth(h.width); + } + if (this.mode == "select" && typeof h.selected != "undefined") { + this.setListOptionSelected(h.selected); + } + return this; +}; +dhtmlXToolbarObject.prototype._buttonInputObject = function (e, h, g) { + this.id = e.idPrefix + h; + this.obj = document.createElement("DIV"); + this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; + this.obj.style.display = g.hidden != null ? "none" : ""; + this.obj.idd = String(h); + this.obj.w = g.width != null ? g.width : 100; + this.obj.title = g.title != null ? g.title : ""; + this.obj.innerHTML = ""; + var c = e; + var a = this; + this.obj.childNodes[0].onkeydown = function (j) { + j = j || event; + if (j.keyCode == 13) { + c.callEvent("onEnter", [a.obj.idd, this.value]); + } + }; + e.base.appendChild(this.obj); + this.enableItem = function () { + this.obj.childNodes[0].disabled = false; + }; + this.disableItem = function () { + this.obj.childNodes[0].disabled = true; + }; + this.isEnabled = function () { + return !this.obj.childNodes[0].disabled; + }; + this.showItem = function () { + this.obj.style.display = ""; + }; + this.hideItem = function () { + this.obj.style.display = "none"; + }; + this.isVisible = function () { + return this.obj.style.display != "none"; + }; + this.setValue = function (j) { + this.obj.childNodes[0].value = j; + }; + this.getValue = function () { + return this.obj.childNodes[0].value; + }; + this.setWidth = function (j) { + this.obj.w = j; + this.obj.childNodes[0].style.width = this.obj.w + "px"; + }; + this.getWidth = function () { + return this.obj.w; + }; + this.setItemToolTip = function (j) { + this.obj.title = j; + }; + this.getItemToolTip = function () { + return this.obj.title; + }; + this.getInput = function () { + return this.obj.firstChild; + }; + if (typeof g.enabled != "undefined" && window.dhx4.s2b(g.enabled) == false) { + this.disableItem(); + } + return this; +}; +dhtmlXToolbarObject.prototype._buttonTwoStateObject = function (a, g, c) { + this.id = a.idPrefix + g; + this.state = c.enabled != null ? false : true; + this.imgEn = c.img != null ? c.img : ""; + this.imgDis = c.imgdis != null ? c.imgdis : ""; + this.img = this.state ? (this.imgEn != "" ? this.imgEn : "") : this.imgDis != "" ? this.imgDis : ""; + this.obj = document.createElement("DIV"); + this.obj.pressed = c.selected != null; + this.obj.extAction = c.action || null; + this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.obj.pressed ? "pres" + (this.state ? "" : "_dis") : this.state ? "def" : "dis"); + this.obj.style.display = c.hidden != null ? "none" : ""; + this.obj.renderAs = this.obj.className; + this.obj.idd = String(g); + this.obj.title = c.title || ""; + if (this.obj.pressed) { + this.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"; + } + this.obj.innerHTML = a._rtlParseBtn(this.img != "" ? "" : "", c.text != null ? "
" + c.text + "
" : ""); + a.base.appendChild(this.obj); + var e = this; + this.obj.onselectstart = function (h) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + }; + this.obj.onmouseover = function () { + this._doOnMouseOver(); + }; + this.obj.onmouseout = function () { + this._doOnMouseOut(); + }; + this.obj._doOnMouseOver = function () { + if (e.state == false) { + return; + } + if (a.anyUsed != "none") { + return; + } + if (this.pressed) { + this.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"; + return; + } + this.className = "dhx_toolbar_btn dhxtoolbar_btn_over"; + this.renderAs = this.className; + }; + this.obj._doOnMouseOut = function () { + if (e.state == false) { + return; + } + if (a.anyUsed != "none") { + return; + } + if (this.pressed) { + this.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; + return; + } + this.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; + this.renderAs = this.className; + }; + this.obj[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function (h) { + if (a.checkEvent("onBeforeStateChange")) { + if (!a.callEvent("onBeforeStateChange", [this.idd.replace(a.idPrefix, ""), this.pressed])) { + return; + } + } + if (e.state == false) { + return; + } + if (a.anyUsed != "none") { + return; + } + this.pressed = !this.pressed; + this.className = this.pressed ? "dhx_toolbar_btn dhxtoolbar_btn_pres" : this.renderAs; + var j = this.idd.replace(a.idPrefix, ""); + if (this.extAction) { + try { + window[this.extAction](j, this.pressed); + } catch (h) {} + } + a.callEvent("onStateChange", [j, this.pressed]); + return false; + }; + this.setItemState = function (h, l) { + if (this.obj.pressed != h) { + if (h == true) { + this.obj.pressed = true; + this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres" + (this.state ? "" : "_dis"); + this.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"; + } else { + this.obj.pressed = false; + this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis"); + this.obj.renderAs = this.obj.className; + } + if (l == true) { + var m = this.obj.idd.replace(a.idPrefix, ""); + if (this.obj.extAction) { + try { + window[this.obj.extAction](m, this.obj.pressed); + } catch (j) {} + } + a.callEvent("onStateChange", [m, this.obj.pressed]); + } + } + }; + this.getItemState = function () { + return this.obj.pressed; + }; + this.enableItem = function () { + a._enableItem(this); + }; + this.disableItem = function () { + a._disableItem(this); + }; + this.isEnabled = function () { + return this.state; + }; + this.showItem = function () { + this.obj.style.display = ""; + }; + this.hideItem = function () { + this.obj.style.display = "none"; + }; + this.isVisible = function () { + return this.obj.style.display == ""; + }; + this.setItemText = function (h) { + a._setItemText(this, h); + }; + this.getItemText = function () { + return a._getItemText(this); + }; + this.setItemImage = function (h) { + a._setItemImage(this, h, true); + }; + this.clearItemImage = function () { + a._clearItemImage(this, true); + }; + this.setItemImageDis = function (h) { + a._setItemImage(this, h, false); + }; + this.clearItemImageDis = function () { + a._clearItemImage(this, false); + }; + this.setItemToolTip = function (h) { + this.obj.title = h; + }; + this.getItemToolTip = function () { + return this.obj.title; + }; + return this; +}; +dhtmlXToolbarObject.prototype._sliderObject = function (g, j, h) { + this.id = g.idPrefix + j; + this.state = h.enabled != null ? (h.enabled == "true" ? true : false) : true; + this.obj = document.createElement("DIV"); + this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis"); + this.obj.style.display = h.hidden != null ? "none" : ""; + this.obj.onselectstart = function (l) { + l = l || event; + if (l.preventDefault) { + l.preventDefault(); + } else { + l.returnValue = false; + } + }; + this.obj.idd = String(j); + this.obj.len = h.length != null ? Number(h.length) : 50; + this.obj.innerHTML = + "
" + + (h.textMin || "") + + "
" + + (h.textMax || "") + + "
"; + g.base.appendChild(this.obj); + var a = this; + this.pen = document.createElement("DIV"); + this.pen.className = "dhxtoolbar_sl_pen"; + this.obj.appendChild(this.pen); + var e = this.pen; + this.label = document.createElement("DIV"); + this.label.dir = "ltr"; + this.label.className = "dhx_toolbar_slider_label_" + g.conf.skin + (g.rtl ? "_rtl" : ""); + this.label.style.display = "none"; + this.label.tip = h.toolTip || "%v"; + this.label._zi = window.dhx4.newId(); + document.body.appendChild(this.label); + var c = this.label; + this.pen.valueMin = h.valueMin != null ? Number(h.valueMin) : 0; + this.pen.valueMax = h.valueMax != null ? Number(h.valueMax) : 100; + if (this.pen.valueMin > this.pen.valueMax) { + this.pen.valueMin = this.pen.valueMax; + } + this.pen.valueNow = h.valueNow != null ? Number(h.valueNow) : this.pen.valueMax; + if (this.pen.valueNow > this.pen.valueMax) { + this.pen.valueNow = this.pen.valueMax; + } + if (this.pen.valueNow < this.pen.valueMin) { + this.pen.valueNow = this.pen.valueMin; + } + this.pen._detectLimits = function () { + this.minX = a.obj.childNodes[1].offsetLeft + 2; + this.maxX = a.obj.childNodes[3].offsetLeft - this.offsetWidth + 1; + }; + this.pen._detectLimits(); + this.pen._definePos = function () { + this.nowX = Math.round(((this.valueNow - this.valueMin) * (this.maxX - this.minX)) / (this.valueMax - this.valueMin) + this.minX); + this.style.left = this.nowX + "px"; + this.newNowX = this.nowX; + }; + this.pen._definePos(); + this.pen.initXY = 0; + this.pen.allowMove = false; + this.pen[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function (l) { + if (a.state == false) { + return; + } + l = l || event; + this.initXY = window.dhx4.isIPad ? l.touches[0].clientX : l.clientX; + this.newValueNow = this.valueNow; + this.allowMove = true; + this.className = "dhxtoolbar_sl_pen dhxtoolbar_over"; + if (c.tip != "") { + c.style.visibility = "hidden"; + c.style.display = ""; + c.innerHTML = c.tip.replace("%v", this.valueNow); + c.style.left = Math.round(window.dhx4.absLeft(this) + this.offsetWidth / 2 - c.offsetWidth / 2) + "px"; + c.style.top = window.dhx4.absTop(this) - c.offsetHeight - 3 + "px"; + c.style.visibility = ""; + c.style.zIndex = window.dhx4.zim.reserve(c._zi); + } + }; + this.pen._doOnMouseMoveStart = function (m) { + m = m || event; + if (!e.allowMove) { + return; + } + var l = window.dhx4.isIPad ? m.touches[0].clientX : m.clientX; + var n = l - e.initXY; + if (l < window.dhx4.absLeft(e) + Math.round(e.offsetWidth / 2) && e.nowX == e.minX) { + return; + } + if (l > window.dhx4.absLeft(e) + Math.round(e.offsetWidth / 2) && e.nowX == e.maxX) { + return; + } + e.newNowX = e.nowX + n; + if (e.newNowX < e.minX) { + e.newNowX = e.minX; + } + if (e.newNowX > e.maxX) { + e.newNowX = e.maxX; + } + e.nowX = e.newNowX; + e.style.left = e.nowX + "px"; + e.initXY = l; + e.newValueNow = Math.round(((e.valueMax - e.valueMin) * (e.newNowX - e.minX)) / (e.maxX - e.minX) + e.valueMin); + if (c.tip != "") { + c.innerHTML = c.tip.replace(/%v/gi, e.newValueNow); + c.style.left = Math.round(window.dhx4.absLeft(e) + e.offsetWidth / 2 - c.offsetWidth / 2) + "px"; + c.style.top = window.dhx4.absTop(e) - c.offsetHeight - 3 + "px"; + } + m.cancelBubble = true; + if (m.preventDefault) { + m.preventDefault(); + } else { + m.returnValue = false; + } + return false; + }; + this.pen._doOnMouseMoveEnd = function () { + if (!e.allowMove) { + return; + } + e.className = "dhxtoolbar_sl_pen"; + e.allowMove = false; + e.nowX = e.newNowX; + e.valueNow = e.newValueNow; + if (c.tip != "") { + c.style.display = "none"; + window.dhx4.zim.clear(c._zi); + } + g.callEvent("onValueChange", [a.obj.idd.replace(g.idPrefix, ""), e.valueNow]); + }; + if (window.dhx4.isIPad) { + document.addEventListener("touchmove", e._doOnMouseMoveStart, false); + document.addEventListener("touchend", e._doOnMouseMoveEnd, false); + } else { + if (typeof window.addEventListener != "undefined") { + window.addEventListener("mousemove", e._doOnMouseMoveStart, false); + window.addEventListener("mouseup", e._doOnMouseMoveEnd, false); + } else { + document.body.attachEvent("onmousemove", e._doOnMouseMoveStart); + document.body.attachEvent("onmouseup", e._doOnMouseMoveEnd); + } + } + this.enableItem = function () { + if (this.state) { + return; + } + this.state = true; + this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; + }; + this.disableItem = function () { + if (!this.state) { + return; + } + this.state = false; + this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_dis"; + }; + this.isEnabled = function () { + return this.state; + }; + this.showItem = function () { + this.obj.style.display = ""; + }; + this.hideItem = function () { + this.obj.style.display = "none"; + }; + this.isVisible = function () { + return this.obj.style.display == ""; + }; + this.setValue = function (l, m) { + l = Number(l); + if (l < this.pen.valueMin) { + l = this.pen.valueMin; + } + if (l > this.pen.valueMax) { + l = this.pen.valueMax; + } + this.pen.valueNow = l; + this.pen._definePos(); + if (m == true) { + g.callEvent("onValueChange", [this.obj.idd.replace(g.idPrefix, ""), this.pen.valueNow]); + } + }; + this.getValue = function () { + return this.pen.valueNow; + }; + this.setMinValue = function (m, l) { + m = Number(m); + if (m > this.pen.valueMax) { + return; + } + this.obj.childNodes[0].innerHTML = l; + this.obj.childNodes[0].style.display = l.length > 0 ? "" : "none"; + this.pen.valueMin = m; + if (this.pen.valueNow < this.pen.valueMin) { + this.pen.valueNow = this.pen.valueMin; + } + this.pen._detectLimits(); + this.pen._definePos(); + }; + this.setMaxValue = function (m, l) { + m = Number(m); + if (m < this.pen.valueMin) { + return; + } + this.obj.childNodes[4].innerHTML = l; + this.obj.childNodes[4].style.display = l.length > 0 ? "" : "none"; + this.pen.valueMax = m; + if (this.pen.valueNow > this.pen.valueMax) { + this.pen.valueNow = this.pen.valueMax; + } + this.pen._detectLimits(); + this.pen._definePos(); + }; + this.getMinValue = function () { + var l = this.obj.childNodes[0].innerHTML; + var m = this.pen.valueMin; + return new Array(m, l); + }; + this.getMaxValue = function () { + var l = this.obj.childNodes[4].innerHTML; + var m = this.pen.valueMax; + return new Array(m, l); + }; + this.setItemToolTipTemplate = function (l) { + this.label.tip = l; + }; + this.getItemToolTipTemplate = function () { + return this.label.tip; + }; + return this; +}; +dhtmlXToolbarObject.prototype.unload = function () { + if (this.conf.isIPad) { + document.removeEventListener("touchstart", this._doOnClick, false); + } else { + if (typeof window.addEventListener == "function") { + window.removeEventListener("mousedown", this._doOnClick, false); + } else { + document.body.detachEvent("onmousedown", this._doOnClick); + } + } + this._doOnClick = null; + this.clearAll(); + this.objPull = null; + if (this._xmlLoader) { + this._xmlLoader.destructor(); + this._xmlLoader = null; + } + while (this.base.childNodes.length > 0) { + this.base.removeChild(this.base.childNodes[0]); + } + this.cont.removeChild(this.base); + this.base = null; + while (this.cont.childNodes.length > 0) { + this.cont.removeChild(this.cont.childNodes[0]); + } + this.cont.className = ""; + this.cont = null; + window.dhx4._enableDataLoading(this, null, null, null, "clear"); + window.dhx4._eventable(this, "clear"); + this.tX1 = null; + this.tX2 = null; + this.tY1 = null; + this.tY2 = null; + this.anyUsed = null; + this.idPrefix = null; + this.rootTypes = null; + this._rtl = null; + this._rtlParseBtn = null; + this.setRTL = null; + this._sbw = null; + this._getObj = null; + this._addImgObj = null; + this._setItemImage = null; + this._clearItemImage = null; + this._setItemText = null; + this._getItemText = null; + this._enableItem = null; + this._disableItem = null; + this._xmlParser = null; + this._addItemToStorage = null; + this._genStr = null; + this._addItem = null; + this._getPosition = null; + this._setPosition = null; + this._getIdByPosition = null; + this._separatorObject = null; + this._textObject = null; + this._buttonObject = null; + this._buttonSelectObject = null; + this._buttonInputObject = null; + this._buttonTwoStateObject = null; + this._sliderObject = null; + this._autoDetectVisibleArea = null; + this._removeItem = null; + this.setAlign = null; + this.setSkin = null; + this.setIconsPath = null; + this.setIconPath = null; + this.loadXML = null; + this.loadXMLString = null; + this.clearAll = null; + this.addSpacer = null; + this.removeSpacer = null; + this.getType = null; + this.getTypeExt = null; + this.inArray = null; + this.getParentId = null; + this.addButton = null; + this.addText = null; + this.addButtonSelect = null; + this.addButtonTwoState = null; + this.addSeparator = null; + this.addSlider = null; + this.addInput = null; + this.forEachItem = null; + this.showItem = null; + this.hideItem = null; + this.isVisible = null; + this.enableItem = null; + this.disableItem = null; + this.isEnabled = null; + this.setItemText = null; + this.getItemText = null; + this.setItemToolTip = null; + this.getItemToolTip = null; + this.setItemImage = null; + this.setItemImageDis = null; + this.clearItemImage = null; + this.clearItemImageDis = null; + this.setItemState = null; + this.getItemState = null; + this.setItemToolTipTemplate = null; + this.getItemToolTipTemplate = null; + this.setValue = null; + this.getValue = null; + this.setMinValue = null; + this.getMinValue = null; + this.setMaxValue = null; + this.getMaxValue = null; + this.setWidth = null; + this.getWidth = null; + this.getPosition = null; + this.setPosition = null; + this.removeItem = null; + this.addListOption = null; + this.removeListOption = null; + this.showListOption = null; + this.hideListOption = null; + this.isListOptionVisible = null; + this.enableListOption = null; + this.disableListOption = null; + this.isListOptionEnabled = null; + this.setListOptionPosition = null; + this.getListOptionPosition = null; + this.setListOptionText = null; + this.getListOptionText = null; + this.setListOptionToolTip = null; + this.getListOptionToolTip = null; + this.setListOptionImage = null; + this.getListOptionImage = null; + this.clearListOptionImage = null; + this.forEachListOption = null; + this.getAllListOptions = null; + this.setListOptionSelected = null; + this.getListOptionSelected = null; + this.unload = null; + this.setUserData = null; + this.getUserData = null; + this.setMaxOpen = null; + this.items = null; + this.conf = null; +}; +dhtmlXToolbarObject.prototype._autoDetectVisibleArea = function () { + var a = window.dhx4.screenDim(); + this.tX1 = a.left; + this.tX2 = a.right; + this.tY1 = a.top; + this.tY2 = a.bottom; +}; +dhtmlXToolbarObject.prototype._initObj = function (c) { + for (var a = 0; a < c.length; a++) { + this._addItemToStorage(c[a]); + } + if (this.conf.skin == "dhx_terrace") { + this._improveTerraceSkin(); + } +}; +dhtmlXToolbarObject.prototype._xmlToJson = function (s) { + var n = []; + var y = s.getElementsByTagName("toolbar"); + if (y != null && y[0] != null) { + y = y[0]; + var v = function (e) { + var h = e.getElementsByTagName("itemText"); + if (h != null && h[0] != null) { + return window.dhx4._xmlNodeValue(h[0]); + } + return null; + }; + var D = [ + "id", + "type", + "hidden", + "title", + "text", + "enabled", + "img", + "imgdis", + "action", + "openAll", + "renderSelect", + "mode", + "maxOpen", + "width", + "value", + "selected", + "length", + "textMin", + "textMax", + "toolTip", + "valueMin", + "valueMax", + "valueNow", + ]; + var g = ["id", "type", "enabled", "disabled", "action", "selected", "img", "text"]; + for (var c = 0; c < y.childNodes.length; c++) { + if (y.childNodes[c].tagName == "item") { + var m = {}; + for (var A = 0; A < D.length; A++) { + var j = y.childNodes[c].getAttribute(D[A]); + if (j != null) { + m[D[A]] = j; + } + } + for (var x = 0; x < y.childNodes[c].childNodes.length; x++) { + if (y.childNodes[c].childNodes[x].tagName == "item" && m.type == "buttonSelect") { + var C = {}; + for (var A = 0; A < g.length; A++) { + var j = y.childNodes[c].childNodes[x].getAttribute(g[A]); + if (j != null) { + C[g[A]] = j; + } + } + var o = y.childNodes[c].childNodes[x].getElementsByTagName("userdata"); + for (var A = 0; A < o.length; A++) { + if (!C.userdata) { + C.userdata = {}; + } + var a = {}; + try { + a.name = o[A].getAttribute("name"); + } catch (l) { + a.name = null; + } + try { + a.value = o[A].firstChild.nodeValue; + } catch (l) { + a.value = ""; + } + if (a.name != null) { + C.userdata[a.name] = a.value; + } + } + C.text = v(y.childNodes[c].childNodes[x]) || C.text; + if (m.options == null) { + m.options = []; + } + m.options.push(C); + } + if (y.childNodes[c].childNodes[x].tagName == "userdata") { + if (m.userdata == null) { + m.userdata = {}; + } + var C = {}; + try { + C.name = y.childNodes[c].childNodes[x].getAttribute("name"); + } catch (l) { + C.name = null; + } + try { + C.value = y.childNodes[c].childNodes[x].firstChild.nodeValue; + } catch (l) { + C.value = ""; + } + if (C.name != null) { + m.userdata[C.name] = C.value; + } + } + } + m.text = v(y.childNodes[c]) || m.text; + n.push(m); + } + } + v = null; + } + return n; +}; +dhtmlXToolbarObject.prototype._addItemToStorage = function (j, m) { + var l = j.id || this._genStr(24); + var g = j.type || ""; + if (g == "spacer") { + this.addSpacer(this._lastId); + } else { + this._lastId = l; + } + if (g != "" && this["_" + g + "Object"] != null) { + if (g == "buttonSelect") { + if (j.options != null) { + for (var h = 0; h < j.options.length; h++) { + if (j.options[h].type == "obj") { + j.options[h].type = "button"; + } + if (j.options[h].type == "sep") { + j.options[h].type = "separator"; + } + } + } + } + if (g == "slider") { + var e = { tip_template: "toolTip", value_min: "valueMin", value_max: "valueMax", value_now: "valueNow", text_min: "textMin", text_max: "textMax" }; + for (var c in e) { + if (j[e[c]] == null && j[c] != null) { + j[e[c]] = j[c]; + } + } + } + if (g == "buttonInput") { + if (j.value == null && j.text != null) { + j.value = j.text; + } + } + if (g == "buttonTwoState") { + if (typeof j.selected == "undefined" && typeof j.pressed != "undefined" && window.dhx4.s2b(j.pressed)) { + j.selected = true; + } + } + if (typeof j.enabled == "undefined" && typeof j.disabled != "undefined" && window.dhx4.s2b(j.disabled)) { + j.enabled = false; + } + if (j.imgDis == null && j.img_disabled != null) { + j.imgdis = j.img_disabled; + } + if ((typeof j.openAll == "undefined" || j.openAll == null) && this.conf.skin == "dhx_terrace") { + j.openAll = true; + } + this.objPull[this.idPrefix + l] = new this["_" + g + "Object"](this, l, j); + this.objPull[this.idPrefix + l]["type"] = g; + this.setPosition(l, m); + } + if (j.userdata != null) { + for (var c in j.userdata) { + this.setUserData(l, c, j.userdata[c]); + } + } + if (j.options != null) { + for (var h = 0; h < j.options.length; h++) { + if (j.options[h].userdata != null) { + for (var c in j.options[h].userdata) { + this.setListOptionUserData(j.id, j.options[h].id, c, j.options[h].userdata[c]); + } + } + } + } +}; +dhtmlXToolbarObject.prototype.setSkin = function (h, e) { + if (e === true) { + this.cont.className = this.cont.className.replace(/dhxtoolbar_icons_\d{1,}/, "dhxtoolbar_icons_" + this.conf.iconSize); + } else { + this.conf.skin = h; + if (this.conf.skin == "dhx_skyblue") { + this.conf.sel_ofs_y = 1; + } + if (this.conf.skin == "dhx_web") { + this.conf.sel_ofs_y = 1; + this.conf.sel_ofs_x = 1; + } + if (this.conf.skin == "dhx_terrace") { + this.conf.sel_ofs_y = -1; + this.conf.sel_ofs_x = 0; + } + this.cont.className = "dhx_toolbar_" + this.conf.skin + " dhxtoolbar_icons_" + this.conf.iconSize; + } + for (var c in this.objPull) { + var g = this.objPull[c]; + if (g.type == "slider") { + g.pen._detectLimits(); + g.pen._definePos(); + g.label.className = "dhx_toolbar_slider_label_" + this.conf.skin; + } + if (g.type == "buttonSelect") { + g.polygon.className = "dhx_toolbar_poly_" + this.conf.skin + " dhxtoolbar_icons_" + this.conf.iconSize; + } + } + if (h == "dhx_terrace") { + this._improveTerraceSkin(); + } +}; +dhtmlXToolbarObject.prototype.setAlign = function (a) { + this.conf.align = a == "right" ? "right" : "left"; + this.base.className = a == "right" ? "dhxtoolbar_float_right" : "dhxtoolbar_float_left"; + if (this._spacer) { + this._spacer.className = a == "right" ? " dhxtoolbar_float_left" : " dhxtoolbar_float_right"; + } +}; +dhtmlXToolbarObject.prototype.setIconSize = function (a) { + this.conf.iconSize = { 18: true, 24: true, 32: true, 48: true }[a] ? a : 18; + this.setSkin(this.conf.skin, true); + this.callEvent("_onIconSizeChange", [this.conf.iconSize]); +}; +dhtmlXToolbarObject.prototype.setIconsPath = function (a) { + this.conf.icons_path = a; +}; +dhtmlXToolbarObject.prototype.setUserData = function (e, a, c) { + e = this.idPrefix + e; + if (this.objPull[e] != null) { + if (this.objPull[e].userData == null) { + this.objPull[e].userData = {}; + } + this.objPull[e].userData[a] = c; + } +}; +dhtmlXToolbarObject.prototype.getUserData = function (c, a) { + c = this.idPrefix + c; + if (this.objPull[c] != null && this.objPull[c].userData != null) { + return this.objPull[c].userData[a] || null; + } + return null; +}; +dhtmlXToolbarObject.prototype._isListOptionExists = function (a, e) { + if (this.objPull[this.idPrefix + a] == null) { + return false; + } + var c = this.objPull[this.idPrefix + a]; + if (c.type != "buttonSelect") { + return false; + } + if (c._listOptions[e] == null) { + return false; + } + return true; +}; +dhtmlXToolbarObject.prototype.setListOptionUserData = function (a, h, c, g) { + if (!this._isListOptionExists(a, h)) { + return; + } + var e = this.objPull[this.idPrefix + a]._listOptions[h]; + if (e.userData == null) { + e.userData = {}; + } + e.userData[c] = g; +}; +dhtmlXToolbarObject.prototype.getListOptionUserData = function (a, g, c) { + if (!this._isListOptionExists(a, g)) { + return null; + } + var e = this.objPull[this.idPrefix + a]._listOptions[g]; + if (!e.userData) { + return null; + } + return e.userData[c] ? e.userData[c] : null; +}; +dhtmlXToolbarObject.prototype._improveTerraceSkin = function () { + if (this.conf.terrace_radius == null) { + this.conf.terrace_radius = "3px"; + } + var g = []; + var h = { separator: true, text: true }; + var l = [this.base]; + if (this._spacer != null) { + l.push(this._spacer); + } + for (var n = 0; n < l.length; n++) { + g[n] = []; + for (var c = 0; c < l[n].childNodes.length; c++) { + if (l[n].childNodes[c].idd != null && l[n].childNodes[c].style.display != "none") { + var m = this.idPrefix + l[n].childNodes[c].idd; + if (this.objPull[m] != null && this.objPull[m].obj == l[n].childNodes[c]) { + g[n].push({ a: m, type: this.objPull[m].type, node: this.objPull[m][this.objPull[m].type == "buttonSelect" ? "arw" : "obj"] }); + } + } + } + l[n] = null; + } + for (var n = 0; n < g.length; n++) { + for (var c = 0; c < g[n].length; c++) { + var o = g[n][c]; + var r = false; + var j = false; + if (!h[o.type]) { + if (c == g[n].length - 1 || (g[n][c + 1] != null && h[g[n][c + 1].type])) { + r = true; + } + if (c == 0 || (c - 1 >= 0 && g[n][c - 1] != null && h[g[n][c - 1].type])) { + j = true; + } + } + o.node.style.borderRightWidth = r ? "1px" : "0px"; + o.node.style.borderTopRightRadius = o.node.style.borderBottomRightRadius = r ? this.conf.terrace_radius : "0px"; + if (o.type == "buttonSelect") { + o.node.previousSibling.style.borderTopLeftRadius = o.node.previousSibling.style.borderBottomLeftRadius = j ? this.conf.terrace_radius : "0px"; + o.node.previousSibling._br = r; + o.node.previousSibling._bl = j; + } else { + o.node.style.borderTopLeftRadius = o.node.style.borderBottomLeftRadius = j ? this.conf.terrace_radius : "0px"; + } + o.node._br = r; + o.node._bl = j; + } + } + for (var n = 0; n < g.length; n++) { + for (var c = 0; c < g[n].length; c++) { + for (var m in g[n][c]) { + g[n][c][m] = null; + } + g[n][c] = null; + } + g[n] = null; + } + g = l = null; +}; +dhtmlXToolbarObject.prototype._improveTerraceButtonSelect = function (e, c) { + var a = this.objPull[e]; + if (c == true) { + a.obj.style.borderBottomLeftRadius = a.obj._bl ? this.conf.terrace_radius : "0px"; + a.arw.style.borderBottomRightRadius = a.obj._br ? this.conf.terrace_radius : "0px"; + } else { + a.obj.style.borderBottomLeftRadius = "0px"; + a.arw.style.borderBottomRightRadius = "0px"; + } + a = null; +}; +if (typeof window.dhtmlXCellObject != "undefined") { + dhtmlXCellObject.prototype._createNode_toolbar = function (h, c, g, a, e) { + if (typeof e != "undefined") { + h = e; + } else { + h = document.createElement("DIV"); + h.className = "dhx_cell_toolbar_" + (this.conf.borders ? "def" : "no_borders"); + h.appendChild(document.createElement("DIV")); + h.firstChild.className = "dhx_toolbar_base_18_dhx_skyblue"; + } + this.cell.insertBefore(h, this.cell.childNodes[this.conf.idx.cont]); + this.conf.ofs_nodes.t.toolbar = true; + this._updateIdx(); + return h; + }; + dhtmlXCellObject.prototype.attachToolbar = function (a) { + if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) { + return; + } + this.callEvent("_onBeforeContentAttach", ["toolbar"]); + if (typeof a == "undefined") { + a = {}; + } else { + if (typeof a == "string") { + a = { skin: a }; + } + } + if (typeof a.skin == "undefined") { + a.skin = this.conf.skin; + } + a.parent = this._attachObject("toolbar").firstChild; + this.dataNodes.toolbar = new dhtmlXToolbarObject(a); + this._adjustCont(this._idd); + this.dataNodes.toolbar._masterCell = this; + this.dataNodes.toolbar.attachEvent("_onIconSizeChange", function () { + this._masterCell._adjustCont(); + }); + a.parent = null; + a = null; + this.callEvent("_onContentAttach", []); + return this.dataNodes.toolbar; + }; + dhtmlXCellObject.prototype.detachToolbar = function () { + if (!this.dataNodes.toolbar) { + return; + } + this.dataNodes.toolbar._masterCell = null; + this.dataNodes.toolbar.unload(); + this.dataNodes.toolbar = null; + delete this.dataNodes.toolbar; + this._detachObject("toolbar"); + }; + dhtmlXCellObject.prototype.showToolbar = function () { + this._mtbShowHide("toolbar", ""); + }; + dhtmlXCellObject.prototype.hideToolbar = function () { + this._mtbShowHide("toolbar", "none"); + }; + dhtmlXCellObject.prototype.getAttachedToolbar = function () { + return this.dataNodes.toolbar; + }; +} +function dhtmlXEditor(e, g) { + var c = this; + this.conf = { + content: "", + contentHTML: "", + resizeTM: null, + resizeTMTime: 100, + roMode: false, + toolbar: false, + iconsPath: "", + evs: ["focus", "blur", "keydown", "keyup", "keypress", "mouseup", "mousedown", "click", "touchend"], + iOSfix: navigator.userAgent.match(/Mobile/gi) != null && navigator.userAgent.match(/iPad/gi) != null && navigator.userAgent.match(/AppleWebKit/gi) != null, + }; + this._doOnFocusChanged = null; + this._doOnAccess = null; + if (typeof e == "object" && e != null && e.tagName == null) { + g = e.skin; + if (e.content != null) { + this.conf.content = e.content; + } + if (e.contentHTML != null) { + this.conf.contentHTML = e.contentHTML; + } + if (e.iconsPath != null) { + this.conf.iconsPath = e.iconsPath; + } + if (e.toolbar != null) { + this.conf.toolbar = window.dhx4.s2b(e.toolbar); + } + if (e.onFocusChanged != null) { + this._doOnFocusChanged = e.onFocusChanged; + } + if (e.onAccess != null) { + this._doOnAccess = e.onAccess; + } + e = e.parent; + } + this.conf.skin = g || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxeditor") || "dhx_skyblue"; + if (typeof e == "string") { + e = document.getElementById(e); + } + this.base = e; + this.base.className += " dhxeditor_" + this.conf.skin; + while (this.base.childNodes.length > 0) { + this.base.removeChild(this.base.childNodes[0]); + } + var h = window.dhx4.isIE ? this.base.currentStyle.position : window.getComputedStyle != null ? window.getComputedStyle(this.base, null).getPropertyValue("position") : ""; + if (!(h == "relative" || h == "absolute")) { + this.base.style.position = "relative"; + } + this.cell = new dhtmlXEditorCell(window.dhx4.newId(), this); + this.base.appendChild(this.cell.cell); + this.cBlock = document.createElement("DIV"); + this.cBlock.className = "dhxcont_content_blocker"; + this.cBlock.style.display = "none"; + this.base.appendChild(this.cBlock); + this.editor = document.createElement("IFRAME"); + this.editor.className = "dhxeditor_mainiframe"; + this.editor.frameBorder = 0; + if (window.dhx4.isOpera) { + this.editor.scrolling = "yes"; + } + this.setSizes(); + var a = this.editor; + if (typeof window.addEventListener != "undefined") { + a.onload = function () { + for (var j = 0; j < c.conf.evs.length; j++) { + a.contentWindow.addEventListener(c.conf.evs[j], c._ev, false); + } + }; + } else { + a.onreadystatechange = function (j) { + if (typeof a.readyState != "undefined" && a.readyState == "complete") { + try { + for (var l = 0; l < c.conf.evs.length; l++) { + a.contentWindow.document.body.attachEvent("on" + c.conf.evs[l], c._ev); + } + } catch (m) {} + } + }; + } + this._ev = function (l) { + l = l || event; + var j = l.type; + if (c.conf.iOSfix == true && j == "touchend") { + c.editor.contentWindow.focus(); + return; + } + c.callEvent("onAccess", [j, l]); + if (typeof c._doOnAccess == "function") { + c._doOnAccess(j, l); + } else { + if (typeof c._doOnAccess == "string" && typeof window[c._doOnAccess] == "function") { + window[c._doOnAccess](j, l); + } + } + }; + this._focus = function () { + if (window.dhx4.isIE) { + this.editor.contentWindow.document.body.focus(); + } else { + this.editor.contentWindow.focus(); + } + }; + this.cell.attachObject(this.editor); + this.edWin = this.editor.contentWindow; + this.edDoc = this.edWin.document; + this._prepareContent = function (m, o) { + var l = ""; + if (m === true && this.getContent != null) { + l = this.getContent(); + } + var j = this.editor.contentWindow.document; + j.open("text/html", "replace"); + if (window.dhx4.isOpera) { + j.write( + "" + ); + } else { + if (window.dhx4.isKHTML) { + j.write( + "" + ); + } else { + if (window.dhx4.isIE) { + j.write( + "" + ); + } else { + j.write( + "" + ); + } + } + } + j.close(); + if (window.dhx4.isIE) { + j.contentEditable = o !== true; + } else { + j.designMode = o !== true ? "On" : "Off"; + } + if (window.dhx4.isFF) { + try { + j.execCommand("useCSS", false, true); + } catch (n) {} + } + if (m === true && this.setContent != null) { + this.setContent(l); + } + }; + this._prepareContent(); + this._doOnResize = function () { + window.clearTimeout(c.conf.resizeTM); + c.conf.resizeTM = window.setTimeout(function () { + if (c.setSizes) { + c.setSizes(); + } + }, c.conf.resizeTMTime); + }; + this._runCommand = function (m, o) { + if (this.conf.roMode === true) { + return; + } + if (arguments.length < 2) { + o = null; + } + if (window.dhx4.isIE) { + this.edWin.focus(); + } + try { + var l = this.editor.contentWindow.document; + l.execCommand(m, false, o); + } catch (n) {} + if (window.dhx4.isIE) { + this.edWin.focus(); + var j = this; + window.setTimeout(function () { + j.edWin.focus(); + j = null; + }, 1); + } + }; + this.applyBold = function () { + this._runCommand("Bold"); + }; + this.applyItalic = function () { + this._runCommand("Italic"); + }; + this.applyUnderscore = function () { + this._runCommand("Underline"); + }; + this.clearFormatting = function () { + this._runCommand("RemoveFormat"); + var j = this.getContent(); + j = j.replace(/<\/?h\d>/gi, ""); + this.setContent(j); + }; + this._doOnClick = function (m) { + var l = m || window.event; + var j = l.target || l.srcElement; + c._showInfo(j); + }; + this._doOnMouseDown = function (m) { + var l = m || window.event; + var j = l.target || l.srcElement; + c._showInfo(j); + }; + this._doOnKeyUp = function (n) { + var m = n || window.event; + var j = m.keyCode; + var l = m.target || m.srcElement; + if ({ 37: 1, 38: 1, 39: 1, 40: 1, 13: 1 }[j] == 1) { + c._showInfo(l); + } + }; + this._getParentByTag = function (j, m) { + m = m.toLowerCase(); + var l = j; + do { + if (m == "" || l.nodeName.toLowerCase() == m) { + return l; + } + } while ((l = l.parentNode)); + return j; + }; + this._isStyleProperty = function (l, o, j, m) { + o = o.toLowerCase(); + var r = l; + do { + if (r.nodeName.toLowerCase() == o && r.style[j] == m) { + return true; + } + } while ((r = r.parentNode)); + return false; + }; + this._setStyleProperty = function (j, m) { + this.style[m] = false; + var l = this._getParentByTag(j, m); + if (l && l.tagName.toLowerCase() == m) { + this.style[m] = true; + } + if (m == "del" && this._getParentByTag(j, "strike") && this._getParentByTag(j, "strike").tagName.toLowerCase() == "strike") { + this.style.del = true; + } + }; + this._showInfo = function (l) { + var l = this._getSelectionBounds().end ? this._getSelectionBounds().end : l; + if (!l || !this._setStyleProperty) { + return; + } + try { + if (this.edWin.getComputedStyle) { + var j = this.edWin.getComputedStyle(l, null); + var m = j.getPropertyValue("font-weight") == 401 ? 700 : j.getPropertyValue("font-weight"); + this.style = { + fontStyle: j.getPropertyValue("font-style"), + fontSize: j.getPropertyValue("font-size"), + textDecoration: j.getPropertyValue("text-decoration"), + fontWeight: m, + fontFamily: j.getPropertyValue("font-family"), + textAlign: j.getPropertyValue("text-align"), + }; + if (window.dhx4.isKHTML) { + this.style.fontStyle = j.getPropertyValue("font-style"); + this.style.vAlign = j.getPropertyValue("vertical-align"); + this.style.del = this._isStyleProperty(l, "span", "textDecoration", "line-through"); + this.style.u = this._isStyleProperty(l, "span", "textDecoration", "underline"); + } + } else { + var j = l.currentStyle; + this.style = { fontStyle: j.fontStyle, fontSize: j.fontSize, textDecoration: j.textDecoration, fontWeight: j.fontWeight, fontFamily: j.fontFamily, textAlign: j.textAlign }; + } + this._setStyleProperty(l, "h1"); + this._setStyleProperty(l, "h2"); + this._setStyleProperty(l, "h3"); + this._setStyleProperty(l, "h4"); + if (!window.dhx4.isKHTML) { + this._setStyleProperty(l, "del"); + this._setStyleProperty(l, "sub"); + this._setStyleProperty(l, "sup"); + this._setStyleProperty(l, "u"); + } + this.callEvent("onFocusChanged", [this.style, j]); + } catch (n) { + return null; + } + }; + this._getSelectionBounds = function () { + var o, m, s, l; + if (this.edWin.getSelection) { + var r = this.edWin.getSelection(); + if (window.dhx4.isEdge && r.rangeCount == 0) { + return { root: null, start: null, end: null }; + } + o = r.getRangeAt(r.rangeCount - 1); + s = o.startContainer; + l = o.endContainer; + m = o.commonAncestorContainer; + if (s.nodeName == "#text") { + m = m.parentNode; + } + if (s.nodeName == "#text") { + s = s.parentNode; + } + if (s.nodeName.toLowerCase() == "body") { + s = s.firstChild; + } + if (l.nodeName == "#text") { + l = l.parentNode; + } + if (l.nodeName.toLowerCase() == "body") { + l = l.lastChild; + } + if (s == l) { + m = s; + } + return { root: m, start: s, end: l }; + } else { + if (this.edWin.document.selection) { + o = this.edDoc.selection.createRange(); + if (!o.duplicate) { + return null; + } + m = o.parentElement(); + var n = o.duplicate(); + var j = o.duplicate(); + n.collapse(true); + j.moveToElementText(n.parentElement()); + j.setEndPoint("EndToStart", n); + s = n.parentElement(); + n = o.duplicate(); + j = o.duplicate(); + j.collapse(false); + n.moveToElementText(j.parentElement()); + n.setEndPoint("StartToEnd", j); + l = j.parentElement(); + if (s.nodeName.toLowerCase() == "body") { + s = s.firstChild; + } + if (l.nodeName.toLowerCase() == "body") { + l = l.lastChild; + } + if (s == l) { + m = s; + } + return { root: m, start: s, end: l }; + } + } + return null; + }; + this.getContent = function () { + if (!this.edDoc.body) { + return ""; + } else { + if (window.dhx4.isFF) { + return this.editor.contentWindow.document.body.innerHTML.replace(/<\/{0,}br\/{0,}>\s{0,}$/gi, ""); + } + if (window.dhx4.isIE && this.edDoc.body.innerText.length == 0) { + return ""; + } + return this.edDoc.body.innerHTML; + } + }; + this.setContent = function (m) { + m = m || ""; + if (this.edDoc.body) { + var l = false; + if (window.dhx4.isFF) { + var j = navigator.userAgent.match(/Firefox\/(\d*)/); + l = j != null && j[1] < 28; + } + if (l) { + if (typeof this.conf.ffTest == "undefined") { + this.editor.contentWindow.document.body.innerHTML = ""; + this._runCommand("InsertHTML", "test"); + this.conf.ffTest = this.editor.contentWindow.document.body.innerHTML.length > 0; + } + if (this.conf.ffTest) { + this.editor.contentWindow.document.body.innerHTML = m; + } else { + this.editor.contentWindow.document.body.innerHTML = ""; + if (m.length == 0) { + m = " "; + } + this._runCommand("InsertHTML", m); + } + } else { + this.editor.contentWindow.document.body.innerHTML = m; + } + this.callEvent("onContentSet", []); + } else { + if (!this.conf.firstLoadEv) { + this.conf.firstLoadEv = true; + this.conf.firstLoadData = m; + this._onFirstLoad = function () { + c.setContent(c.conf.firstLoadData); + if (typeof window.addEventListener == "function") { + c.edWin.removeEventListener("load", c._onFirstLoad, false); + } else { + c.edWin.detachEvent("onload", c._onFirstLoad); + } + c.conf.firstLoadData = null; + c.conf.firstLoadEv = false; + c._onFirstLoad = null; + }; + if (typeof window.addEventListener == "function") { + this.edWin.addEventListener("load", this._onFirstLoad, false); + } else { + this.edWin.attachEvent("onload", this._onFirstLoad); + } + } + } + }; + this.setContentHTML = function (j) { + window.dhx4.ajax.get(j, function (l) { + if (l.xmlDoc.responseText != null) { + c.setContent(l.xmlDoc.responseText); + } + }); + }; + window.dhx4._eventable(this); + this.attachEvent("onFocusChanged", function (j) { + if (typeof this._doOnFocusChanged == "function") { + this._doOnFocusChanged(j); + } else { + if (typeof this._doOnFocusChanged == "string" && typeof window[this._doOnFocusChanged] == "function") { + window[this._doOnFocusChanged](j); + } + } + }); + if (typeof window.addEventListener == "function") { + window.addEventListener("resize", this._doOnResize, false); + this.edDoc.addEventListener("click", this._doOnClick, false); + this.edDoc.addEventListener("keyup", this._doOnKeyUp, false); + if (window.dhx4.isOpera) { + this.edDoc.addEventListener("mousedown", this._doOnMouseDown, false); + } + } else { + window.attachEvent("onresize", this._doOnResize); + this.edDoc.attachEvent("onclick", this._doOnClick); + this.edDoc.attachEvent("onkeyup", this._doOnKeyUp); + } + this.unload = function () { + if (typeof window.addEventListener == "function") { + window.removeEventListener("resize", this._doOnResize, false); + this.edDoc.removeEventListener("click", this._doOnClick, false); + this.edDoc.removeEventListener("keyup", this._doOnKeyUp, false); + if (window.dhx4.isOpera) { + this.edDoc.removeEventListener("mousedown", this._doOnMouseDown, false); + } + for (var j = 0; j < c.conf.evs.length; j++) { + a.contentWindow.removeEventListener(c.conf.evs[j], c._ev, false); + } + if (this.tb != null && this.conf.iOSfix == true) { + this.tb.cont.removeEventListener("touchend", this._doOnIOSFix, false); + this._doOnIOSFix = null; + } + } else { + window.detachEvent("onresize", this._doOnResize, false); + this.edDoc.detachEvent("onclick", this._doOnClick); + this.edDoc.detachEvent("onkeyup", this._doOnKeyUp); + for (var j = 0; j < c.conf.evs.length; j++) { + a.contentWindow.document.body.detachEvent("on" + c.conf.evs[j], c._ev); + } + } + this._doOnAccess = null; + this._doOnFocusChanged = null; + if (typeof window.addEventListener == "function") { + this.editor.onload = null; + } else { + this.editor.onreadystatechange = null; + } + this.editor.parentNode.removeChild(this.editor); + this.editor = null; + this.edDoc = null; + this.edWin = null; + this.cell._unload(); + this.cell = null; + this.tb = null; + window.dhx4._eventable(this, "clear"); + this.cBlock.parentNode.removeChild(this.cBlock); + this.cBlock = null; + this.base.className = String(this.base.className).replace(new RegExp("\\s{0,}dhxeditor_" + this.conf.skin), ""); + while (this.base.childNodes.length > 0) { + this.base.removeChild(this.base.childNodes[0]); + } + this.base = null; + this._doOnClick = null; + this._doOnKeyUp = null; + this._doOnMouseDown = null; + this._ev = null; + this._focus = null; + this._prepareContent = null; + this._doOnResize = null; + this.setIconsPath = null; + this.init = null; + this.setSizes = null; + this._runCommand = null; + this.applyBold = null; + this.applyItalic = null; + this.applyUnderscore = null; + this.clearFormatting = null; + this._showInfo = null; + this._getSelectionBounds = null; + this.getContent = null; + this.setContent = null; + this.setContentHTML = null; + this.setReadonly = null; + this.isReadonly = null; + this.unload = null; + c = a = null; + }; + if (this.conf.toolbar == true && typeof this.attachToolbar == "function" && typeof window.dhtmlXToolbarObject == "function") { + this.attachToolbar(this.conf.iconsPath); + if (this.conf.iOSfix == true) { + this._doOnIOSFix = function () { + c.editor.contentWindow.focus(); + }; + this.tb.cont.addEventListener("touchend", this._doOnIOSFix, false); + } + } + this.setIconsPath = function (j) { + this.conf.iconsPath = j; + }; + if (this.conf.content.length > 0) { + this.setContent(this.conf.content); + this.conf.content = ""; + } else { + if (this.conf.contentHTML.length > 0) { + this.setContentHTML(this.conf.contentHTML); + this.conf.contentHTML = ""; + } + } + return this; +} +dhtmlXEditor.prototype.setSizes = function () { + this.cell._setSize(0, 0, this.base.clientWidth, this.base.clientHeight); + if (this.editor != null) { + this.editor.style.left = "5px"; + this.editor.style.width = this.base.clientWidth - 5 + "px"; + } +}; +dhtmlXEditor.prototype.setReadonly = function (a) { + this.conf.roMode = a === true; + this._prepareContent(true, this.conf.roMode); + this.cBlock.style.display = this.conf.roMode ? "" : "none"; +}; +dhtmlXEditor.prototype.isReadonly = function (a) { + return this.conf.roMode || false; +}; +dhtmlXEditor.prototype.setSkin = function (a) { + this.base.className = String(this.base.className).replace(new RegExp("dhxeditor_" + this.conf.skin), "dhxeditor_" + a); + this.conf.skin = this.cell.conf.skin = a; + if (this.tb) { + this.cell.detachToolbar(a); + this.tb = null; + this.attachToolbar(); + } + this.setSizes(); +}; +window.dhtmlXEditorCell = function (e, a) { + dhtmlXCellObject.apply(this, [e, "_editor"]); + var c = this; + this.editor = a; + this.conf.skin = this.editor.conf.skin; + this.attachEvent("_onCellUnload", function () { + this._stbUnload(); + this.editor = null; + c = null; + }); + this._stbInit(); + return this; +}; +dhtmlXEditorCell.prototype = new dhtmlXCellObject(); +dhtmlXEditorCell.prototype._stbInit = function () { + var j = this; + var h = document.createElement("DIV"); + h.className = "dhx_cell_stb"; + this.cell.insertBefore(h, this.cell.childNodes[this.conf.idx.cont]); + h.onselectstart = function (a) { + a = a || event; + a.cancelBubble = true; + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + return false; + }; + var g = { bold: "applyBold", italic: "applyItalic", underline: "applyUnderscore", clearformat: "clearFormatting" }; + for (var e in g) { + var c = document.createElement("A"); + c.href = "javascript:void(0);"; + c.tabIndex = -1; + h.appendChild(c); + c.onmousedown = c.onclick = function (a) { + a = a || event; + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + return false; + }; + var l = document.createElement("DIV"); + l.className = "dhx_cell_stb_button btn_" + e; + l._actv = e.charAt(0); + l._cmd = g[e]; + c.appendChild(l); + l.onclick = function (a) { + a = a || event; + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + return false; + }; + l.onmousedown = function (a) { + a = a || event; + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + j.editor[this._cmd](); + j.editor.callEvent("onToolbarClick", [this._actv]); + }; + l = c = null; + } + h = null; + this._stbUnload = function () { + var a = this.cell.childNodes[this.conf.idx.stb]; + a.onselectstart = null; + while (a.childNodes.length > 0) { + a.lastChild.onmousedown = a.lastChild.onclick = null; + a.lastChild.firstChild.onmousedown = a.lastChild.firstChild.onclick = null; + a.lastChild.firstChild._actv = a.lastChild.firstChild._cmd = null; + a.lastChild.removeChild(a.lastChild.firstChild); + a.removeChild(a.lastChild); + } + a.parentNode.removeChild(a); + a = j = null; + this.conf.idx_data.stb = this.conf.ofs_nodes.t._getStbHeight = null; + delete this.conf.ofs_nodes.t._getStbHeight; + delete this.conf.idx_data.stb; + this._updateIdx(); + }; + this.conf.ofs_nodes.t._getStbHeight = "func"; + this.conf.idx_data.stb = "dhx_cell_stb"; + this._updateIdx(); +}; +dhtmlXEditorCell.prototype._stbHide = function () { + this.cell.childNodes[this.conf.idx.stb].style.display = "none"; +}; +dhtmlXEditorCell.prototype._getStbHeight = function () { + return this.cell.childNodes[this.conf.idx.stb].offsetHeight; +}; +dhtmlXCellObject.prototype.attachEditor = function (a) { + this.callEvent("_onBeforeContentAttach", ["editor"]); + var e = document.createElement("DIV"); + e.style.width = "100%"; + e.style.height = "100%"; + e.style.position = "relative"; + e.style.overflow = "hidden"; + this._attachObject(e); + if (!(typeof a == "object" && a != null)) { + a = {}; + } + a.parent = e; + this.dataType = "editor"; + this.dataObj = new dhtmlXEditor(a); + e = null; + a.parent = null; + a = null; + if (typeof window.dhtmlXPortalCell != "undefined" && this instanceof window.dhtmlXPortalCell) { + if (this.portal.conf.editor_ev == null) { + var g = this.portal.attachEvent("onBeforeDrag", function (h) { + if (this.cdata[h].dataType == "editor") { + this.cdata[h].conf.editor_cont = this.cdata[h].dataObj.getContent(); + } + return true; + }); + var c = this.portal.attachEvent("onDrop", function (h) { + if (this.cdata[h].dataType == "editor") { + this.cdata[h].dataObj.setContent(this.cdata[h].conf.editor_cont); + this.cdata[h].dataObj._prepareContent(true); + this.cdata[h].conf.editor_cont = null; + } + }); + this.portal.conf.editor_ev = [g, c]; + } + this.conf.editor_ev = this.attachEvent("_onBeforeContentDetach", function () { + this.detachEvent(this.conf.editor_ev); + this.conf.editor_ev = null; + if (this instanceof window.dhtmlXPortalCell) { + var j = false; + for (var h in this.portal.cdata) { + if (this.portal.cdata[h] != this && this.portal.cdata[h].dataType == "editor") { + j = true; + } + } + if (j == false) { + for (var l = 0; l < this.portal.conf.editor_ev.length; l++) { + this.portal.detachEvent(this.portal.conf.editor_ev[l]); + } + this.portal.conf.editor_ev = null; + } + } + }); + } + this.callEvent("_onContentAttach", []); + return this.dataObj; +}; +dhtmlXEditor.prototype.attachToolbar = function (c) { + if (this.tb != null) { + return; + } + if (c != null) { + this.conf.iconsPath = c; + } + this.cell._stbHide(); + this.tb = this.cell.attachToolbar({ icons_path: this.conf.iconsPath + "/dhxeditor_" + String(this.conf.skin).replace(/^dhx_/, "") + "/", skin: this.conf.skin }); + this.setSizes(); + this._availFonts = new Array("Arial", "Arial Narrow", "Comic Sans MS", "Courier", "Georgia", "Impact", "Tahoma", "Times New Roman", "Verdana"); + this._initFont = this._availFonts[0]; + this._xmlFonts = ""; + for (var j = 0; j < this._availFonts.length; j++) { + var g = String(this._availFonts[j]).replace(/\s/g, "_"); + this._xmlFonts += + ']]>'; + } + this._availSizes = { "1": "8pt", "2": "10pt", "3": "12pt", "4": "14pt", "5": "18pt", "6": "24pt", "7": "36pt" }; + this._xmlSizes = ""; + for (var e in this._availSizes) { + this._xmlSizes += ''; + } + this.tbXML = + ''; + this.tb.loadStruct(this.tbXML); + this._checkAlign = function (a) { + this.tb.setItemState("alignCenter", false); + this.tb.setItemState("alignRight", false); + this.tb.setItemState("alignJustify", false); + this.tb.setItemState("alignLeft", false); + if (a) { + this.tb.setItemState(a, true); + } + }; + this._checkH = function (a) { + this.tb.setItemState("applyH1", false); + this.tb.setItemState("applyH2", false); + this.tb.setItemState("applyH3", false); + this.tb.setItemState("applyH4", false); + if (a) { + this.tb.setItemState(a, true); + } + }; + this._doOnFocusChanged = function (m) { + if (!m.h1 && !m.h2 && !m.h3 && !m.h4) { + var a = String(m.fontWeight).search(/bold/i) != -1 || Number(m.fontWeight) >= 700; + this.tb.setItemState("applyBold", a); + } else { + this.tb.setItemState("applyBold", false); + } + var l = "alignLeft"; + if (String(m.textAlign).search(/center/) != -1) { + l = "alignCenter"; + } + if (String(m.textAlign).search(/right/) != -1) { + l = "alignRight"; + } + if (String(m.textAlign).search(/justify/) != -1) { + l = "alignJustify"; + } + this.tb.setItemState(l, true); + this._checkAlign(l); + this.tb.setItemState("applyH1", m.h1); + this.tb.setItemState("applyH2", m.h2); + this.tb.setItemState("applyH3", m.h3); + this.tb.setItemState("applyH4", m.h4); + if (window._KHTMLrv) { + m.sub = m.vAlign == "sub"; + m.sup = m.vAlign == "super"; + } + this.tb.setItemState("applyItalic", m.fontStyle == "italic"); + this.tb.setItemState("applyStrikethrough", m.del); + this.tb.setItemState("applySub", m.sub); + this.tb.setItemState("applySuper", m.sup); + this.tb.setItemState("applyUnderscore", m.u); + }; + this._doOnToolbarClick = function (l) { + var a = String(l).split(":"); + if (this[a[0]] != null) { + if (typeof this[a[0]] == "function") { + this[a[0]](a[1]); + this.callEvent("onToolbarClick", [l]); + } + } + }; + this._doOnStateChange = function (l, a) { + this[l](); + switch (l) { + case "alignLeft": + case "alignCenter": + case "alignRight": + case "alignJustify": + this._checkAlign(l); + break; + case "applyH1": + case "applyH2": + case "applyH3": + case "applyH4": + this._checkH(l); + break; + } + this.callEvent("onToolbarClick", [l]); + }; + this._doOnBeforeStateChange = function (l, a) { + if ((l == "alignLeft" || l == "alignCenter" || l == "alignRight" || l == "alignJustify") && a == true) { + return false; + } + return true; + }; + var h = this; + this.tb.attachEvent("onClick", function (a) { + h._doOnToolbarClick(a); + }); + this.tb.attachEvent("onStateChange", function (l, a) { + h._doOnStateChange(l, a); + }); + this.tb.attachEvent("onBeforeStateChange", function (l, a) { + return h._doOnBeforeStateChange(l, a); + }); + this.applyBold = function () { + this._runCommand("Bold"); + }; + this.applyItalic = function () { + this._runCommand("Italic"); + }; + this.applyUnderscore = function () { + this._runCommand("Underline"); + }; + this.applyStrikethrough = function () { + this._runCommand("StrikeThrough"); + }; + this.alignLeft = function () { + this._runCommand("JustifyLeft"); + }; + this.alignRight = function () { + this._runCommand("JustifyRight"); + }; + this.alignCenter = function () { + this._runCommand("JustifyCenter"); + }; + this.alignJustify = function () { + this._runCommand("JustifyFull"); + }; + this.applySub = function () { + this._runCommand("Subscript"); + }; + this.applySuper = function () { + this._runCommand("Superscript"); + }; + this.applyH1 = function () { + this._runCommand("FormatBlock", "

"); + }; + this.applyH2 = function () { + this._runCommand("FormatBlock", "

"); + }; + this.applyH3 = function () { + this._runCommand("FormatBlock", "

"); + }; + this.applyH4 = function () { + this._runCommand("FormatBlock", "

"); + }; + this.createNumList = function () { + this._runCommand("InsertOrderedList"); + }; + this.createBulList = function () { + this._runCommand("InsertUnorderedList"); + }; + this.increaseIndent = function () { + this._runCommand("Indent"); + }; + this.decreaseIndent = function () { + this._runCommand("Outdent"); + }; + this.clearFormatting = function () { + this._runCommand("RemoveFormat"); + this.tb.setItemState("applyBold", false); + this.tb.setItemState("applyItalic", false); + this.tb.setItemState("applyStrikethrough", false); + this.tb.setItemState("applySub", false); + this.tb.setItemState("applySuper", false); + this.tb.setItemState("applyUnderscore", false); + var a = this.getContent(); + a = a.replace(/<\/?h\d>/gi, ""); + this.setContent(a); + }; +}; +dhtmlx.Group = { + _init: function () { + dhtmlx.assert(this.data, "DataStore required for grouping"); + this.data.attachEvent( + "onStoreLoad", + dhtmlx.bind(function () { + if (this._settings.group) { + this.group(this._settings.group, false); + } + }, this) + ); + this.attachEvent( + "onBeforeRender", + dhtmlx.bind(function (a) { + if (this._settings.sort) { + a.block(); + a.sort(this._settings.sort); + a.unblock(); + } + }, this) + ); + this.data.attachEvent( + "onClearAll", + dhtmlx.bind(function () { + this.data._not_grouped_order = this.data._not_grouped_pull = null; + }, this) + ); + this.attachEvent( + "onBeforeSort", + dhtmlx.bind(function () { + this._settings.sort = null; + }, this) + ); + }, + _init_group_data_event: function (c, a) { + c.attachEvent( + "onClearAll", + dhtmlx.bind(function () { + this.ungroup(false); + this.block(); + this.clearAll(); + this.unblock(); + }, a) + ); + }, + sum: function (c, a) { + c = dhtmlx.Template.setter(c); + a = a || this.data; + var e = 0; + a.each(function (g) { + e += c(g) * 1; + }); + return e; + }, + min: function (e, c) { + e = dhtmlx.Template.setter(e); + c = c || this.data; + var a = Infinity; + c.each(function (g) { + if (e(g) * 1 < a) { + a = e(g) * 1; + } + }); + return a * 1; + }, + max: function (e, c) { + e = dhtmlx.Template.setter(e); + c = c || this.data; + var a = -Infinity; + c.each(function (g) { + if (e(g) * 1 > a) { + a = e(g) * 1; + } + }); + return a; + }, + _split_data_by: function (j) { + var m = function (r, o) { + r = dhtmlx.Template.setter(r); + return r(o[0]); + }; + var n = dhtmlx.Template.setter(j.by); + if (!j.map[n]) { + j.map[n] = [n, m]; + } + var e = {}; + var l = []; + this.data.each(function (o) { + var r = n(o); + if (!e[r]) { + l.push({ id: r }); + e[r] = dhtmlx.toArray(); + } + e[r].push(o); + }); + for (var a in j.map) { + var h = j.map[a][1] || m; + if (typeof h != "function") { + h = this[h]; + } + for (var g = 0; g < l.length; g++) { + l[g][a] = h.call(this, j.map[a][0], e[l[g].id]); + } + } + this.data._not_grouped_order = this.data.order; + this.data._not_grouped_pull = this.data.pull; + this.data.order = dhtmlx.toArray(); + this.data.pull = {}; + for (var g = 0; g < l.length; g++) { + var c = this.data.id(l[g]); + this.data.pull[c] = l[g]; + this.data.order.push(c); + } + this.callEvent("onStoreUpdated", []); + }, + group: function (a, c) { + this.ungroup(false); + this._split_data_by(a); + if (c !== false) { + this.data.callEvent("onStoreUpdated", []); + } + }, + ungroup: function (a) { + if (this.data._not_grouped_order) { + this.data.order = this.data._not_grouped_order; + this.data.pull = this.data._not_grouped_pull; + this.data._not_grouped_pull = this.data._not_grouped_order = null; + } + if (a !== false) { + this.data.callEvent("onStoreUpdated", []); + } + }, + group_setter: function (a) { + dhtmlx.assert(typeof a == "object", "Incorrect group value"); + dhtmlx.assert(a.by, "group.by is mandatory"); + dhtmlx.assert(a.map, "group.map is mandatory"); + return a; + }, + sort_setter: function (a) { + if (typeof a != "object") { + a = { by: a }; + } + this._mergeSettings(a, { as: "string", dir: "asc" }); + return a; + }, +}; +dhtmlx.Date = { + Locale: { + month_full: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + month_short: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], + day_full: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + day_short: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + }, + date_part: function (a) { + a.setHours(0); + a.setMinutes(0); + a.setSeconds(0); + a.setMilliseconds(0); + return a; + }, + time_part: function (a) { + return (a.valueOf() / 1000 - a.getTimezoneOffset() * 60) % 86400; + }, + week_start: function (c) { + var a = c.getDay(); + if (this.config.start_on_monday) { + if (a === 0) { + a = 6; + } else { + a--; + } + } + return this.date_part(this.add(c, -1 * a, "day")); + }, + month_start: function (a) { + a.setDate(1); + return this.date_part(a); + }, + year_start: function (a) { + a.setMonth(0); + return this.month_start(a); + }, + day_start: function (a) { + return this.date_part(a); + }, + add: function (c, e, g) { + var a = new Date(c.valueOf()); + switch (g) { + case "day": + a.setDate(a.getDate() + e); + break; + case "week": + a.setDate(a.getDate() + 7 * e); + break; + case "month": + a.setMonth(a.getMonth() + e); + break; + case "year": + a.setYear(a.getFullYear() + e); + break; + case "hour": + a.setHours(a.getHours() + e); + break; + case "minute": + a.setMinutes(a.getMinutes() + e); + break; + default: + return dhtmlx.Date["add_" + g](c, e, g); + } + return a; + }, + to_fixed: function (a) { + if (a < 10) { + return "0" + a; + } + return a; + }, + copy: function (a) { + return new Date(a.valueOf()); + }, + date_to_str: function (c, a) { + c = c.replace(/%[a-zA-Z]/g, function (e) { + switch (e) { + case "%d": + return '"+dhtmlx.Date.to_fixed(date.getDate())+"'; + case "%m": + return '"+dhtmlx.Date.to_fixed((date.getMonth()+1))+"'; + case "%j": + return '"+date.getDate()+"'; + case "%n": + return '"+(date.getMonth()+1)+"'; + case "%y": + return '"+dhtmlx.Date.to_fixed(date.getFullYear()%100)+"'; + case "%Y": + return '"+date.getFullYear()+"'; + case "%D": + return '"+dhtmlx.Date.Locale.day_short[date.getDay()]+"'; + case "%l": + return '"+dhtmlx.Date.Locale.day_full[date.getDay()]+"'; + case "%M": + return '"+dhtmlx.Date.Locale.month_short[date.getMonth()]+"'; + case "%F": + return '"+dhtmlx.Date.Locale.month_full[date.getMonth()]+"'; + case "%h": + return '"+dhtmlx.Date.to_fixed((date.getHours()+11)%12+1)+"'; + case "%g": + return '"+((date.getHours()+11)%12+1)+"'; + case "%G": + return '"+date.getHours()+"'; + case "%H": + return '"+dhtmlx.Date.to_fixed(date.getHours())+"'; + case "%i": + return '"+dhtmlx.Date.to_fixed(date.getMinutes())+"'; + case "%a": + return '"+(date.getHours()>11?"pm":"am")+"'; + case "%A": + return '"+(date.getHours()>11?"PM":"AM")+"'; + case "%s": + return '"+dhtmlx.Date.to_fixed(date.getSeconds())+"'; + case "%W": + return '"+dhtmlx.Date.to_fixed(dhtmlx.Date.getISOWeek(date))+"'; + default: + return e; + } + }); + if (a) { + c = c.replace(/date\.get/g, "date.getUTC"); + } + return new Function("date", 'return "' + c + '";'); + }, + str_to_date: function (h, e) { + var j = "var temp=date.split(/[^0-9a-zA-Z]+/g);"; + var a = h.match(/%[a-zA-Z]/g); + for (var c = 0; c < a.length; c++) { + switch (a[c]) { + case "%j": + case "%d": + j += "set[2]=temp[" + c + "]||1;"; + break; + case "%n": + case "%m": + j += "set[1]=(temp[" + c + "]||1)-1;"; + break; + case "%y": + j += "set[0]=temp[" + c + "]*1+(temp[" + c + "]>50?1900:2000);"; + break; + case "%g": + case "%G": + case "%h": + case "%H": + j += "set[3]=temp[" + c + "]||0;"; + break; + case "%i": + j += "set[4]=temp[" + c + "]||0;"; + break; + case "%Y": + j += "set[0]=temp[" + c + "]||0;"; + break; + case "%a": + case "%A": + j += "set[3]=set[3]%12+((temp[" + c + "]||'').toLowerCase()=='am'?0:12);"; + break; + case "%s": + j += "set[5]=temp[" + c + "]||0;"; + break; + } + } + var g = "set[0],set[1],set[2],set[3],set[4],set[5]"; + if (e) { + g = " Date.UTC(" + g + ")"; + } + return new Function("date", "var set=[0,0,1,0,0,0]; " + j + " return new Date(" + g + ");"); + }, + getISOWeek: function (e) { + if (!e) { + return false; + } + var c = e.getDay(); + if (c === 0) { + c = 7; + } + var g = new Date(e.valueOf()); + g.setDate(e.getDate() + (4 - c)); + var a = g.getFullYear(); + var j = Math.floor((g.getTime() - new Date(a, 0, 1).getTime()) / 86400000); + var h = 1 + Math.floor(j / 7); + return h; + }, + getUTCISOWeek: function (a) { + return this.getISOWeek(a); + }, +}; +dhtmlx.math = {}; +dhtmlx.math._toHex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]; +dhtmlx.math.toHex = function (c, a) { + c = parseInt(c, 10); + str = ""; + while (c > 0) { + str = this._toHex[c % 16] + str; + c = Math.floor(c / 16); + } + while (str.length < a) { + str = "0" + str; + } + return str; +}; +dhtmlx.math.hexToDec = function (a) { + return parseInt(a, 16); +}; +dhtmlx.math.toRgb = function (c) { + var h, e, a, j; + if (typeof c != "string") { + h = c[0]; + e = c[1]; + a = c[2]; + } else { + if (c.indexOf("rgb") != -1) { + j = c.substr(c.indexOf("(") + 1, c.lastIndexOf(")") - c.indexOf("(") - 1).split(","); + h = j[0]; + e = j[1]; + a = j[2]; + } else { + if (c.substr(0, 1) == "#") { + c = c.substr(1); + } + h = this.hexToDec(c.substr(0, 2)); + e = this.hexToDec(c.substr(2, 2)); + a = this.hexToDec(c.substr(4, 2)); + } + } + h = parseInt(h, 10) || 0; + e = parseInt(e, 10) || 0; + a = parseInt(a, 10) || 0; + if (h < 0 || h > 255) { + h = 0; + } + if (e < 0 || e > 255) { + e = 0; + } + if (a < 0 || a > 255) { + a = 0; + } + return [h, e, a]; +}; +dhtmlx.math.hsvToRgb = function (l, x, u) { + var j, n, e, c, w, a, m, o; + j = Math.floor(l / 60) % 6; + n = l / 60 - j; + e = u * (1 - x); + c = u * (1 - n * x); + w = u * (1 - (1 - n) * x); + a = 0; + m = 0; + o = 0; + switch (j) { + case 0: + a = u; + m = w; + o = e; + break; + case 1: + a = c; + m = u; + o = e; + break; + case 2: + a = e; + m = u; + o = w; + break; + case 3: + a = e; + m = c; + o = u; + break; + case 4: + a = w; + m = e; + o = u; + break; + case 5: + a = u; + m = e; + o = c; + break; + } + a = Math.floor(a * 255); + m = Math.floor(m * 255); + o = Math.floor(o * 255); + return [a, m, o]; +}; +dhtmlx.math.rgbToHsv = function (c, m, n) { + var j, e, o, a, u, x, l, w; + j = c / 255; + e = m / 255; + o = n / 255; + var a = Math.min(j, e, o); + var u = Math.max(j, e, o); + l = 0; + x = u == 0 ? 0 : 1 - a / u; + w = u; + if (u == a) { + l = 0; + } else { + if (u == j && e >= o) { + l = (60 * (e - o)) / (u - a) + 0; + } else { + if (u == j && e < o) { + l = (60 * (e - o)) / (u - a) + 360; + } else { + if (u == e) { + l = (60 * (o - j)) / (u - a) + 120; + } else { + if (u == o) { + l = (60 * (j - e)) / (u - a) + 240; + } + } + } + } + } + return [l, x, w]; +}; +if (!dhtmlx.presets) { + dhtmlx.presets = {}; +} +dhtmlx.presets.chart = { + simple: { item: { borderColor: "#ffffff", color: "#2b7100", shadow: false, borderWidth: 2 }, line: { color: "#8ecf03", width: 2 } }, + plot: { color: "#1293f8", item: { borderColor: "#636363", borderWidth: 1, color: "#ffffff", type: "r", shadow: false }, line: { color: "#1293f8", width: 2 } }, + diamond: { color: "#b64040", item: { borderColor: "#b64040", color: "#b64040", type: "d", radius: 3, shadow: true }, line: { color: "#ff9000", width: 2 } }, + point: { color: "#fe5916", disableLines: true, fill: false, disableItems: false, item: { color: "#feb916", borderColor: "#fe5916", radius: 2, borderWidth: 1, type: "r" }, alpha: 1 }, + line: { line: { color: "#3399ff", width: 2 }, item: { color: "#ffffff", borderColor: "#3399ff", radius: 2, borderWidth: 2, type: "d" }, fill: false, disableItems: false, disableLines: false, alpha: 1 }, + area: { fill: "#3399ff", line: { color: "#3399ff", width: 1 }, disableItems: true, alpha: 0.2, disableLines: false }, + round: { item: { radius: 3, borderColor: "#3f83ff", borderWidth: 1, color: "#3f83ff", type: "r", shadow: false, alpha: 0.6 } }, + square: { item: { radius: 3, borderColor: "#447900", borderWidth: 2, color: "#69ba00", type: "s", shadow: false, alpha: 1 } }, + column: { color: "RAINBOW", gradient: false, width: 45, radius: 0, alpha: 1, border: true }, + stick: { width: 5, gradient: false, color: "#67b5c9", radius: 2, alpha: 1, border: false }, + alpha: { color: "#b9a8f9", width: 70, gradient: "falling", radius: 0, alpha: 0.5, border: true }, +}; +dhtmlx.ui.Map = function (a) { + this.name = "Map"; + this._id = "map_" + dhtmlx.uid(); + this._key = a; + this._map = []; + this._areas = []; +}; +dhtmlx.ui.Map.prototype = { + addRect: function (e, c, a) { + this._areas.push({ index: a, points: c }); + this._createMapArea(e, "RECT", c, a); + }, + addPoly: function (e, c, a) { + this._createMapArea(e, "POLY", c, a); + }, + _createMapArea: function (h, c, g, e) { + var a = ""; + if (arguments.length == 4) { + a = "userdata='" + e + "'"; + } + this._map.push(""); + }, + addSector: function (a, o, n, l, h, e, g, j) { + var m = []; + m.push(l); + m.push(Math.floor(h * g)); + for (var c = o; c < n; c += Math.PI / 18) { + m.push(Math.floor(l + e * Math.cos(c))); + m.push(Math.floor((h + e * Math.sin(c)) * g)); + } + m.push(Math.floor(l + e * Math.cos(n))); + m.push(Math.floor((h + e * Math.sin(n)) * g)); + m.push(l); + m.push(Math.floor(h * g)); + return this.addPoly(a, m, j); + }, + render: function (a) { + var e = dhtmlx.html.create("DIV"); + e.style.cssText = "position:absolute; width:100%; height:100%; top:0px; left:0px;"; + a.appendChild(e); + var c = dhtmlx._isIE ? "" : "src='data:image/gif;base64,R0lGODlhEgASAIAAAP///////yH5BAUUAAEALAAAAAASABIAAAIPjI+py+0Po5y02ouz3pwXADs='"; + e.innerHTML = "" + this._map.join("\n") + ""; + a._htmlmap = e; + this._map = []; + }, +}; +dhtmlx.chart = {}; +dhtmlx.chart.scatter = { + pvt_render_scatter: function (o, j, n, m, l, a) { + if (!this._settings.xValue) { + return dhtmlx.log("warning", "Undefined propery: xValue"); + } + var e = this._getLimits(); + var h = this._getLimits("h", "xValue"); + if (!l) { + if (!this.canvases.x) { + this.canvases.x = new dhtmlx.ui.Canvas(this._obj, "axis_x"); + } + if (!this.canvases.y) { + this.canvases.y = new dhtmlx.ui.Canvas(this._obj, "axis_y"); + } + this._drawYAxis(this.canvases.y.getCanvas(), j, n, m, e.min, e.max); + this._drawHXAxis(this.canvases.x.getCanvas(), j, n, m, h.min, h.max); + } + e = { min: this._settings.yAxis.start, max: this._settings.yAxis.end }; + h = { min: this._settings.xAxis.start, max: this._settings.xAxis.end }; + var c = this._getScatterParams(o, j, n, m, h, e); + this._mapStart = n; + for (var g = 0; g < j.length; g++) { + this._drawScatterItem(o, a, n, m, c, h, e, j[g], l); + } + }, + _getScatterParams: function (a, g, e, c, l, j) { + var h = {}; + h.totalHeight = c.y - e.y; + h.totalWidth = c.x - e.x; + this._calcScatterUnit(h, l.min, l.max, h.totalWidth, "X"); + this._calcScatterUnit(h, j.min, j.max, h.totalHeight, "Y"); + return h; + }, + _drawScatterItem: function (r, a, n, m, e, h, g, j, l) { + var c = this._calculateScatterItemPosition(e, m, n, h, j, "X"); + var o = this._calculateScatterItemPosition(e, n, m, g, j, "Y"); + this._drawItem(r, c, o, j, this._settings.label.call(this, j), l, a); + }, + _calculateScatterItemPosition: function (e, m, l, a, h, c) { + var o = this._settings[c == "X" ? "xValue" : "value"].call(this, h); + var g = e["valueFactor" + c]; + var r = (parseFloat(o || 0) - a.min) * g; + var n = e["unit" + c]; + var j = l[c.toLowerCase()] - (c == "X" ? -1 : 1) * Math.floor(n * r); + if (r < 0) { + j = l[c.toLowerCase()]; + } + if (o > a.max) { + j = m[c.toLowerCase()]; + } + if (o < a.min) { + j = l[c.toLowerCase()]; + } + return j; + }, + _calcScatterUnit: function (j, e, a, c, g) { + var h = this._getRelativeValue(e, a); + g = g || ""; + j["relValue" + g] = h[0]; + j["valueFactor" + g] = h[1]; + j["unit" + g] = j["relValue" + g] ? c / j["relValue" + g] : 10; + }, +}; +dhtmlx.chart.radar = { + pvt_render_radar: function (c, g, a, j, e, h) { + this._renderRadarChart(c, g, a, j, e, h); + }, + _renderRadarChart: function (u, h, r, o, n, a) { + if (!h.length) { + return; + } + var l = this._getPieParameters(r, o); + var m = this._settings.radius ? this._settings.radius : l.radius; + var c = this._settings.x ? this._settings.x : l.x; + var s = this._settings.y ? this._settings.y : l.y; + var e = []; + for (var g = 0; g < h.length; g++) { + e.push(1); + } + var j = this._getRatios(e, h.length); + this._mapStart = r; + if (!n) { + this._drawRadarAxises(j, c, s, m, h); + } + this._drawRadarData(u, j, c, s, m, h, n, a); + }, + _drawRadarData: function (C, s, m, l, h, N, D, M) { + var A, v, L, J, E, I, g, e, F, K, H, u, c, w, o, n, a, r, j; + L = this._settings; + E = L.yAxis.start; + I = L.yAxis.end; + j = this._getRelativeValue(E, I); + u = j[0]; + r = u ? h / u : h / 2; + a = j[1]; + c = -Math.PI / 2; + A = v = c; + F = []; + e = 0; + for (J = 0; J < N.length; J++) { + if (!n) { + w = L.value(N[J]); + o = (parseFloat(w || 0) - E) * a; + } else { + o = n; + } + K = Math.floor(r * o); + w = L.value(J != N.length - 1 ? N[J + 1] : N[0]); + n = (parseFloat(w || 0) - E) * a; + H = Math.floor(r * n); + A = v; + v = J != N.length - 1 ? c + s[J] - 0.0001 : c; + g = e || this._getPositionByAngle(A, m, l, K); + e = this._getPositionByAngle(v, m, l, H); + F.push(g); + } + if (L.fill) { + this._fillRadarChart(C, F, N); + } + if (!L.disableLines) { + this._strokeRadarChart(C, F, N); + } + if (!L.disableItems) { + this._drawRadarItemMarkers(C, F, N, D, M); + } + F = null; + }, + _drawRadarItemMarkers: function (a, e, h, g, j) { + for (var c = 0; c < e.length; c++) { + this._drawItem(a, e[c].x, e[c].y, h[c], this._settings.label.call(this, h), g, j); + } + }, + _fillRadarChart: function (a, g, j) { + var h, e; + a.globalAlpha = this._settings.alpha.call(this, {}); + a.beginPath(); + for (var c = 0; c < g.length; c++) { + a.fillStyle = this._settings.fill.call(this, j[c]); + h = g[c]; + e = g[c + 1] || g[0]; + if (!c) { + a.moveTo(h.x, h.y); + } + a.lineTo(e.x, e.y); + } + a.fill(); + a.globalAlpha = 1; + }, + _strokeRadarChart: function (a, g, j) { + var h, e; + for (var c = 0; c < g.length; c++) { + h = g[c]; + e = g[c + 1] || g[0]; + this._drawLine(a, h.x, h.y, e.x, e.y, this._settings.line.color.call(this, j[c]), this._settings.line.width); + } + }, + _drawRadarAxises: function (C, w, v, m, P) { + var a = this._settings.yAxis; + var g = this._settings.xAxis; + var n = a.start; + var l = a.end; + var r = a.step; + var D = {}; + var O = this._configYAxis; + if (typeof O.step == "undefined" || typeof O.start == "undefined" || typeof O.end == "undefined") { + var s = this._getLimits(); + D = this._calculateScale(s.min, s.max); + n = D.start; + l = D.end; + r = D.step; + a.end = l; + a.start = n; + } + var J = []; + var M, L, E; + var N = 0; + var e = (m * r) / (l - n); + var u, A; + if (r < 1) { + u = Math.min(this._log10(r), n <= 0 ? 0 : this._log10(n)); + A = Math.pow(10, -u); + } + var K = []; + if (!this.canvases.scale) { + this.canvases.scale = new dhtmlx.ui.Canvas(this._obj, "radar_scale"); + } + var I = this.canvases.scale.getCanvas(); + for (M = l; M >= n; M -= r) { + if (D.fixNum) { + M = parseFloat(new Number(M).toFixed(D.fixNum)); + } + J.push(Math.floor(N * e) + 0.5); + if (A) { + M = Math.round(M * A) / A; + } + var o = v - m + J[J.length - 1]; + this.canvases.scale.renderTextAt("middle", "left", w, o, a.template(M.toString()), "dhx_axis_item_y dhx_radar"); + if (C.length < 2) { + this._drawScaleSector(I, "arc", w, v, m - J[J.length - 1], -Math.PI / 2, (3 * Math.PI) / 2, M); + return; + } + var h = -Math.PI / 2; + var H = h; + var F; + for (L = 0; L < C.length; L++) { + if (M == l) { + K.push(H); + } + F = h + C[L] - 0.0001; + this._drawScaleSector(I, O.lineShape || "line", w, v, m - J[J.length - 1], H, F, M, L, P[M]); + H = F; + } + N++; + } + for (M = 0; M < K.length; M++) { + E = this._getPositionByAngle(K[M], w, v, m); + if (g.lines.call(this, P[M], M)) { + this._drawLine(I, w, v, E.x, E.y, g ? g.lineColor.call(this, P[M]) : "#cfcfcf", 1); + } + this._drawRadarScaleLabel(I, w, v, m, K[M], g ? g.template.call(this, P[M]) : " "); + } + }, + _drawScaleSector: function (u, l, s, o, h, c, a, g, e) { + var r, n; + if (h < 0) { + return false; + } + r = this._getPositionByAngle(c, s, o, h); + n = this._getPositionByAngle(a, s, o, h); + var m = this._settings.yAxis; + if (m.bg) { + u.beginPath(); + u.moveTo(s, o); + if (l == "arc") { + u.arc(s, o, h, c, a, false); + } else { + u.lineTo(r.x, r.y); + u.lineTo(n.x, n.y); + } + u.fillStyle = m.bg(g, e); + u.moveTo(s, o); + u.fill(); + u.closePath(); + } + if (m.lines.call(this, g)) { + u.lineWidth = 1; + u.beginPath(); + if (l == "arc") { + u.arc(s, o, h, c, a, false); + } else { + u.moveTo(r.x, r.y); + u.lineTo(n.x, n.y); + } + u.strokeStyle = m.lineColor.call(this, g); + u.stroke(); + } + }, + _drawRadarScaleLabel: function (w, n, l, c, m, u) { + var v = this.canvases.scale.renderText(0, 0, u, "dhx_axis_radar_title", 1); + var e = v.scrollWidth; + var s = v.offsetHeight; + var o = 0.001; + var j = this._getPositionByAngle(m, n, l, c + 5); + var h = 0, + g = 0; + if (m < 0 || m > Math.PI) { + g = -s; + } + if (m > Math.PI / 2) { + h = -e; + } + if (Math.abs(m + Math.PI / 2) < o || Math.abs(m - Math.PI / 2) < o) { + h = -e / 2; + } else { + if (Math.abs(m) < o || Math.abs(m - Math.PI) < o) { + g = -s / 2; + } + } + v.style.top = j.y + g + "px"; + v.style.left = j.x + h + "px"; + v.style.width = e + "px"; + v.style.whiteSpace = "nowrap"; + }, +}; +dhtmlx.chart.area = { + pvt_render_area: function (m, E, h, g, n, A) { + var r, y, s, o, j, x, l, D, C, w, v, c, u, a, e; + x = this._calculateLineParams(m, E, h, g, n); + y = this._settings; + o = y.eventRadius || Math.floor(x.cellWidth / 2); + if (E.length) { + l = []; + w = !y.offset ? h.x : h.x + x.cellWidth * 0.5; + for (s = 0; s < E.length; s++) { + j = E[s]; + C = this._getPointY(j, h, g, x); + u = w + x.cellWidth * s; + if (C) { + a = typeof C == "object" ? C.y0 : C; + if (s && this._settings.fixOverflow) { + D = this._getPointY(E[s - 1], h, g, x); + if (D.out && D.out == C.out) { + continue; + } + v = x.cellWidth * (s - 1) - 0.5 + w; + c = typeof D == "object" ? D.y0 : D; + if (D.out) { + e = D.out == "min" ? g.y : h.y; + l.push([this._calcOverflowX(v, u, c, a, e), e]); + } + if (C.out) { + e = C.out == "min" ? g.y : h.y; + l.push([this._calcOverflowX(v, u, c, a, e), e]); + if (s == E.length - 1 && e == h.y) { + l.push([u, h.y]); + } + } + } + if (!C.out) { + l.push([u, a]); + A.addRect(j.id, [u - o - h.x, a - o - h.y, u + o - h.x, a + o - h.y], n); + } + if (!y.yAxis) { + r = !y.offset && s == E.length - 1 ? "left" : "center"; + this.canvases[n].renderTextAt(false, r, u, a - y.labelOffset, y.label(j)); + } + } + } + if (l.length) { + l.push([u, g.y]); + l.push([l[0][0], g.y]); + } + m.globalAlpha = this._settings.alpha.call(this, E[0]); + m.fillStyle = this._settings.color.call(this, E[0]); + m.beginPath(); + this._path(m, l); + m.fill(); + if (y.border) { + m.lineWidth = y.borderWidth || 1; + if (y.borderColor) { + m.strokeStyle = y.borderColor.call(this, E[0]); + } else { + this._setBorderStyles(m, m.fillStyle); + } + m.beginPath(); + this._path(m, l); + m.stroke(); + } + m.lineWidth = 1; + m.globalAlpha = 1; + } + }, +}; +dhtmlx.chart.stackedArea = { + pvt_render_stackedArea: function (o, H, c, a, r, E) { + var J, I, v, D, A, w, h, u, l, C, n, g, e, m; + C = this._calculateLineParams(o, H, c, a, r); + D = this._settings; + u = D.eventRadius || Math.floor(C.cellWidth / 2); + if (H.length) { + n = []; + m = []; + g = !D.offset ? c.x : c.x + C.cellWidth * 0.5; + var F = function (j, x) { + return r ? (H[j].$startY ? x - a.y + H[j].$startY : 0) : x; + }; + var s = function (j, L, K) { + var y = (K.y - L.y) / (K.x - L.x); + return y * j + L.y - y * L.x; + }; + for (A = 0; A < H.length; A++) { + l = H[A]; + if (!A) { + e = F(A, a.y); + n.push([g, e]); + } else { + g += C.cellWidth; + } + e = F(A, this._getPointY(l, c, a, C)); + m.push(isNaN(e) && !A ? H[A].$startY || a.y : e); + if (e) { + n.push([g, e]); + E.addRect(l.id, [g - u - c.x, e - u - c.y, g + u - c.x, e + u - c.y], r); + if (!D.yAxis) { + v = !D.offset && h ? "left" : "center"; + this.canvases[r].renderTextAt(false, v, g, e - D.labelOffset, D.label(l)); + } + } + } + n.push([g, F(A - 1, a.y)]); + if (r) { + for (A = H.length - 2; A > 0; A--) { + g -= C.cellWidth; + e = H[A].$startY; + if (e) { + n.push([g, e]); + } + } + } + n.push([n[0][0], n[0][1]]); + o.globalAlpha = this._settings.alpha.call(this, H[0]); + o.fillStyle = this._settings.color.call(this, H[0]); + o.beginPath(); + this._path(o, n); + o.fill(); + for (A = 0; A < H.length; A++) { + e = m[A]; + if (!e) { + if (A == H.length - 1) { + e = H[A].$startY; + } + for (w = A + 1; w < H.length; w++) { + if (m[w]) { + J = { x: c.x, y: m[0] }; + I = { x: c.x + C.cellWidth * w, y: m[w] }; + e = s(c.x + C.cellWidth * A, J, I); + break; + } + } + } + H[A].$startY = e; + } + } + }, +}; +dhtmlx.chart.spline = { + pvt_render_spline: function (o, I, g, e, r, H) { + var F, u, n, s, E, m, l, A, w, v, h, c, a; + E = this._calculateLineParams(o, I, g, e, r); + F = this._settings; + this._mapStart = g; + n = []; + if (I.length) { + A = F.offset ? g.x + E.cellWidth * 0.5 : g.x; + for (u = 0; u < I.length; u++) { + h = this._getPointY(I[u], g, e, E); + if (h) { + l = !u ? A : E.cellWidth * u - 0.5 + A; + n.push({ x: l, y: h, index: u }); + } + } + m = this._getSplineParameters(n); + for (u = 0; u < n.length; u++) { + w = n[u].x; + c = n[u].y; + if (u < n.length - 1) { + v = n[u + 1].x; + a = n[u + 1].y; + for (s = w; s < v; s++) { + var D = this._getSplineYPoint(s, w, u, m.a, m.b, m.c, m.d); + if (D < g.y) { + D = g.y; + } + if (D > e.y) { + D = e.y; + } + var C = this._getSplineYPoint(s + 1, w, u, m.a, m.b, m.c, m.d); + if (C < g.y) { + C = g.y; + } + if (C > e.y) { + C = e.y; + } + this._drawLine(o, s, D, s + 1, C, F.line.color(I[u]), F.line.width); + } + this._drawLine(o, v - 1, this._getSplineYPoint(s, w, u, m.a, m.b, m.c, m.d), v, a, F.line.color(I[u]), F.line.width); + } + this._drawItem(o, w, c, I[n[u].index], F.label(I[n[u].index]), r, H); + } + } + }, + _getSplineParameters: function (y) { + var j, + C, + A, + D, + x, + w, + r, + o, + l = [], + g = [], + e = y.length; + for (j = 0; j < e - 1; j++) { + l[j] = y[j + 1].x - y[j].x; + g[j] = (y[j + 1].y - y[j].y) / l[j]; + } + C = []; + A = []; + C[0] = 0; + C[1] = 2 * (l[0] + l[1]); + A[0] = 0; + A[1] = 6 * (g[1] - g[0]); + for (j = 2; j < e - 1; j++) { + C[j] = 2 * (l[j - 1] + l[j]) - (l[j - 1] * l[j - 1]) / C[j - 1]; + A[j] = 6 * (g[j] - g[j - 1]) - (l[j - 1] * A[j - 1]) / C[j - 1]; + } + D = []; + D[e - 1] = D[0] = 0; + for (j = e - 2; j >= 1; j--) { + D[j] = (A[j] - l[j] * D[j + 1]) / C[j]; + } + x = []; + w = []; + r = []; + o = []; + for (j = 0; j < e - 1; j++) { + x[j] = y[j].y; + w[j] = (-l[j] * D[j + 1]) / 6 - (l[j] * D[j]) / 3 + (y[j + 1].y - y[j].y) / l[j]; + r[j] = D[j] / 2; + o[j] = (D[j + 1] - D[j]) / (6 * l[j]); + } + return { a: x, b: w, c: r, d: o }; + }, + _getSplineYPoint: function (g, j, l, h, e, n, m) { + return h[l] + (g - j) * (e[l] + (g - j) * (n[l] + (g - j) * m[l])); + }, +}; +dhtmlx.chart.barH = { + pvt_render_barH: function (C, P, l, j, D, O) { + var s, v, F, E, a, I, o, M, w, N, c, y, m, J, x, h, A, u, L, g, r; + F = (j.y - l.y) / P.length; + o = this._getLimits("h"); + M = o.max; + w = o.min; + h = j.x - l.x; + r = !!this._settings.yAxis; + if (!D) { + this._drawHScales(C, P, l, j, w, M, F); + } + if (r) { + M = parseFloat(this._settings.xAxis.end); + w = parseFloat(this._settings.xAxis.start); + } + J = this._getRelativeValue(w, M); + y = J[0]; + c = J[1]; + u = y ? h / y : 10; + if (!r) { + x = 10; + u = y ? (h - x) / y : 10; + } + v = parseInt(this._settings.width, 10); + var K = this._series.length; + var n = this._settings.seriesMargin; + var e = this._settings.seriesPadding; + if (this._series && v * K + e + (K > 2 ? n * K : 0) > F) { + v = F / K - e - (K > 2 ? n : 0); + } + s = (F - v * K - n * (K - 1)) / 2; + if (this._settings.border) { + v = parseInt(v, 10); + s = parseInt(s, 10); + } + m = typeof this._settings.radius != "undefined" ? parseInt(this._settings.radius, 10) : Math.round(v / 5); + N = false; + a = this._settings.gradient; + if (a && typeof a != "function") { + N = a; + a = false; + } else { + if (a) { + a = C.createLinearGradient(l.x, l.y, j.x, l.y); + this._settings.gradient(a); + } + } + if (!r) { + this._drawLine(C, l.x - 0.5, l.y, l.x - 0.5, j.y, "#000000", 1); + } + for (I = 0; I < P.length; I++) { + A = parseFloat(this._settings.value(P[I] || 0)); + if (A > M) { + A = M; + } + A -= w; + A *= c; + L = l.x; + g = l.y + s + (K > 2 ? n * D : 0) + parseInt(I * F, 10) + v * D; + if ((A < 0 && this._settings.origin == "auto") || (this._settings.xAxis && A === 0 && !(this._settings.origin != "auto" && this._settings.origin > w))) { + this.canvases[D].renderTextAt("middle", "right", L + 10, g + v / 2 + s, this._settings.label(P[I])); + continue; + } + if (A < 0 && this._settings.origin != "auto" && this._settings.origin > w) { + A = 0; + } + if (!r) { + A += x / u; + } + E = a || this._settings.color.call(this, P[I]); + if (this._settings.border) { + this._drawBarHBorder(C, L, g, v, w, m, u, A, E); + } + C.globalAlpha = this._settings.alpha.call(this, P[I]); + var H = this._drawBarH(C, j, L, g, v, w, m, u, A, E, a, N); + if (N != false) { + this._drawBarHGradient(C, L, g, v, w, m, u, A, E, N); + } + C.globalAlpha = 1; + if (H[3] == g) { + this.canvases[D].renderTextAt("middle", "left", H[0] - 5, H[3] + Math.floor(v / 2), this._settings.label(P[I])); + O.addRect(P[I].id, [H[0] - l.x, H[3] - l.y, H[2] - l.x, H[3] + v - l.y], D); + } else { + this.canvases[D].renderTextAt("middle", false, H[2] + 5, H[1] + Math.floor(v / 2), this._settings.label(P[I])); + O.addRect(P[I].id, [H[0] - l.x, g - l.y, H[2] - l.x, H[3] - l.y], D); + } + } + }, + _setBarHPoints: function (w, g, u, x, l, v, s, j, h) { + var c = 0; + if (l > v * s) { + var r = (l - v * s) / l; + c = -Math.asin(r) + Math.PI / 2; + } + w.moveTo(g, u + j); + var e = g + v * s - l - (l ? 0 : j); + if (l < v * s) { + w.lineTo(e, u + j); + } + var o = u + l; + if (l && l > 0) { + w.arc(e, o, l - j, -Math.PI / 2 + c, 0, false); + } + var n = u + x - l - (l ? 0 : j); + var a = e + l - (l ? j : 0); + w.lineTo(a, n); + if (l && l > 0) { + w.arc(e, n, l - j, 0, Math.PI / 2 - c, false); + } + var m = u + x - j; + w.lineTo(g, m); + if (!h) { + w.lineTo(g, u + j); + } + return [a, m]; + }, + _drawHScales: function (e, l, j, h, m, c, g) { + var a = 0; + if (this._settings.xAxis) { + if (!this.canvases.x) { + this.canvases.x = new dhtmlx.ui.Canvas(this._obj); + } + a = this._drawHXAxis(this.canvases.x.getCanvas(), l, j, h, m, c); + } + if (this._settings.yAxis) { + if (!this.canvases.y) { + this.canvases.y = new dhtmlx.ui.Canvas(this._obj); + } + this._drawHYAxis(this.canvases.y.getCanvas(), l, j, h, g, a); + } + }, + _drawHYAxis: function (s, h, n, l, e, a) { + if (!this._settings.yAxis) { + return; + } + var j; + var c = parseInt(a ? a : n.x, 10) - 0.5; + var o = l.y + 0.5; + var m = n.y; + this._drawLine(s, c, o, c, m, this._settings.yAxis.color, 1); + for (var g = 0; g < h.length; g++) { + var r = this._settings.origin != "auto" && this._settings.view == "barH" && parseFloat(this._settings.value(h[g])) < this._settings.origin; + j = m + e / 2 + g * e; + this.canvases.y.renderTextAt("middle", r ? false : "left", r ? c + 5 : c - 5, j, this._settings.yAxis.template(h[g]), "dhx_axis_item_y", r ? 0 : c - 10); + if (this._settings.yAxis.lines.call(this, h[g])) { + this._drawLine(s, n.x, j, l.x, j, this._settings.yAxis.lineColor.call(this, h[g]), 1); + } + } + this._drawLine(s, n.x + 0.5, m + 0.5, l.x, m + 0.5, this._settings.yAxis.lineColor.call(this, {}), 1); + this._setYAxisTitle(n, l); + }, + _drawHXAxis: function (A, s, x, w, e, n) { + var l; + var h = {}; + var m = this._settings.xAxis; + if (!m) { + return; + } + var y = w.y + 0.5; + var g = x.x - 0.5; + var a = w.x - 0.5; + var r = x.x; + this._drawLine(A, g, y, a, y, m.color, 1); + if (m.step) { + l = parseFloat(m.step); + } + if (typeof this._configXAxis.step == "undefined" || typeof this._configXAxis.start == "undefined" || typeof this._configXAxis.end == "undefined") { + h = this._calculateScale(e, n); + e = h.start; + n = h.end; + l = h.step; + this._settings.xAxis.end = n; + this._settings.xAxis.start = e; + this._settings.xAxis.step = l; + } + if (l === 0) { + return; + } + var j = ((a - g) * l) / (n - e); + var v = 0; + for (var o = e; o <= n; o += l) { + if (h.fixNum) { + o = parseFloat(new Number(o).toFixed(h.fixNum)); + } + var u = Math.floor(g + v * j) + 0.5; + if (!(o == e && this._settings.origin == "auto") && m.lines.call(this, o)) { + this._drawLine(A, u, y, u, x.y, this._settings.xAxis.lineColor.call(this, o), 1); + } + if (o == this._settings.origin) { + r = u + 1; + } + this.canvases.x.renderTextAt(false, true, u, y + 2, m.template(o.toString()), "dhx_axis_item_x"); + v++; + } + this.canvases.x.renderTextAt(true, false, g, w.y + this._settings.padding.bottom - 3, this._settings.xAxis.title, "dhx_axis_title_x", w.x - x.x); + if (!m.lines.call(this, {})) { + this._drawLine(A, g, x.y - 0.5, a, x.y - 0.5, this._settings.xAxis.color, 0.2); + } + return r; + }, + _correctBarHParams: function (m, h, e, j, l, n, g) { + var a = this._settings.yAxis; + var c = h; + if (!!a && this._settings.origin != "auto" && this._settings.origin > g) { + h += (this._settings.origin - g) * l; + c = h; + j = j - (this._settings.origin - g); + if (j < 0) { + j *= -1; + m.translate(h, e + n); + m.rotate(Math.PI); + h = 0.5; + e = 0; + } + h += 0.5; + } + return { value: j, x0: h, y0: e, start: c }; + }, + _drawBarH: function (u, h, A, g, n, o, j, m, s, v, a, l) { + var w; + u.save(); + var r = this._correctBarHParams(u, A, g, s, m, n, o); + u.fillStyle = v; + u.beginPath(); + if (m * r.value > 0) { + w = this._setBarHPoints(u, r.x0, r.y0, n, j, m, r.value, this._settings.border ? 1 : 0); + if (a && !l) { + u.lineTo(h.x, r.y0 + (this._settings.border ? 1 : 0)); + } + } else { + w = [r.x0, r.y0 + 1]; + } + u.fill(); + u.restore(); + var e = r.y0; + var c = r.y0 != g ? g : w[1]; + var y = r.y0 != g ? r.start - w[0] : r.start; + var x = r.y0 != g ? r.start : w[0]; + return [y, e, x, c]; + }, + _drawBarHBorder: function (n, c, l, o, h, g, m, j, e) { + n.save(); + var a = this._correctBarHParams(n, c, l, j, m, o, h); + n.beginPath(); + this._setBorderStyles(n, e); + n.globalAlpha = 0.9; + if (m * a.value > 0) { + this._setBarHPoints(n, a.x0, a.y0, o, g, m, a.value, n.lineWidth / 2, 1); + } + n.stroke(); + n.restore(); + }, + _drawBarHGradient: function (r, e, n, s, l, j, o, m, g, a) { + r.save(); + var c = this._correctBarHParams(r, e, n, m, o, s, l); + var h = this._setBarGradient(r, c.x0, c.y0 + s, c.x0 + o * c.value, c.y0, a, g, "x"); + r.fillStyle = h.gradient; + r.beginPath(); + if (o * c.value > 0) { + this._setBarHPoints(r, c.x0, c.y0 + h.offset, s - h.offset * 2, j, o, c.value, h.offset); + } + r.fill(); + r.globalAlpha = 1; + r.restore(); + }, +}; +dhtmlx.assert(dhtmlx.chart.barH); +dhtmlx.chart.stackedBarH = { + pvt_render_stackedBarH: function (C, P, h, g, D, O) { + var N, v; + var c; + var w; + var y = g.x - h.x; + var m = !!this._settings.yAxis; + var l = this._getStackedLimits(P); + N = l.max; + v = l.min; + var F = Math.floor((g.y - h.y) / P.length); + if (!D) { + this._drawHScales(C, P, h, g, v, N, F); + } + if (m) { + N = parseFloat(this._settings.xAxis.end); + v = parseFloat(this._settings.xAxis.start); + } + var K = this._getRelativeValue(v, N); + w = K[0]; + c = K[1]; + var s = w ? y / w : 10; + if (!m) { + var x = 10; + s = w ? (y - x) / w : 10; + } + var u = parseInt(this._settings.width, 10); + if (u + 4 > F) { + u = F - 4; + } + var n = (F - u) / 2; + var j = 0; + var o = false; + var a = this._settings.gradient; + if (a) { + o = true; + } + if (!m) { + this._drawLine(C, h.x - 0.5, h.y, h.x - 0.5, g.y, "#000000", 1); + } + var M = 0; + var J = 0; + for (I = 0; I < this._series.length; I++) { + if (I == D) { + J = M; + } + if (this._series[I].view == "stackedBarH") { + M++; + } + } + for (var I = 0; I < P.length; I++) { + if (!J) { + P[I].$startX = h.x; + } + var A = parseFloat(this._settings.value(P[I] || 0)); + if (A > N) { + A = N; + } + A -= v; + A *= c; + var L = h.x; + var e = h.y + n + I * F; + if (!J) { + P[I].$startX = L; + } else { + L = P[I].$startX; + } + if (A < 0 || (this._settings.yAxis && A === 0)) { + this.canvases.y.renderTextAt("middle", true, L + 10, e + u / 2, this._settings.label(P[I])); + continue; + } + if (!m) { + A += x / s; + } + var E = this._settings.color.call(this, P[I]); + C.globalAlpha = this._settings.alpha.call(this, P[I]); + C.fillStyle = this._settings.color.call(this, P[I]); + C.beginPath(); + var H = this._setBarHPoints(C, L, e, u, j, s, A, this._settings.border ? 1 : 0); + if (a && !o) { + C.lineTo(h.x + y, e + (this._settings.border ? 1 : 0)); + } + C.fill(); + if (o != false) { + var r = this._setBarGradient(C, L, e + u, L, e, o, E, "x"); + C.fillStyle = r.gradient; + C.beginPath(); + H = this._setBarHPoints(C, L, e, u, j, s, A, 0); + C.fill(); + } + if (this._settings.border) { + this._drawBarHBorder(C, L, e, u, v, j, s, A, E); + } + C.globalAlpha = 1; + this.canvases[D].renderTextAt("middle", true, P[I].$startX + (H[0] - P[I].$startX) / 2 - 1, e + (H[1] - e) / 2, this._settings.label(P[I])); + O.addRect(P[I].id, [P[I].$startX - h.x, e - h.y, H[0] - h.x, H[1] - h.y], D); + P[I].$startX = H[0]; + } + }, +}; +dhtmlx.chart.stackedBar = { + pvt_render_stackedBar: function (x, L, g, e, y, K) { + var I, s; + var a; + var u; + var v = e.y - g.y; + var j = !!this._settings.yAxis; + var J = !!this._settings.xAxis; + var h = this._getStackedLimits(L); + I = h.max; + s = h.min; + var C = Math.floor((e.x - g.x) / L.length); + if (!y) { + this._drawScales(L, g, e, s, I, C); + } + if (j) { + I = parseFloat(this._settings.yAxis.end); + s = parseFloat(this._settings.yAxis.start); + } + var F = this._getRelativeValue(s, I); + u = F[0]; + a = F[1]; + var o = u ? v / u : 10; + var r = parseInt(this._settings.width, 10); + if (r + 4 > C) { + r = C - 4; + } + var l = Math.floor((C - r) / 2); + var m = this._settings.gradient ? this._settings.gradient : false; + if (!J) { + this._drawLine(x, g.x, e.y + 0.5, e.x, e.y + 0.5, "#000000", 1); + } + for (var E = 0; E < L.length; E++) { + var w = parseFloat(this._settings.value(L[E] || 0)); + if (!w) { + if (!y || !L[E].$startY) { + L[E].$startY = e.y; + } + continue; + } + if (!y) { + w -= s; + } + w *= a; + var H = g.x + l + E * C; + var c = e.y; + if (!y) { + L[E].$startY = c; + } else { + c = L[E].$startY; + } + if (c < g.y + 1) { + continue; + } + if (w < 0 || (this._settings.yAxis && w === 0)) { + this.canvases.y.renderTextAt(true, true, H + Math.floor(r / 2), c, this._settings.label(L[E])); + continue; + } + var A = this._settings.color.call(this, L[E]); + x.globalAlpha = this._settings.alpha.call(this, L[E]); + x.fillStyle = this._settings.color.call(this, L[E]); + x.beginPath(); + var D = this._setStakedBarPoints(x, H - (this._settings.border ? 0.5 : 0), c, r + (this._settings.border ? 0.5 : 0), o, w, 0, g.y); + x.fill(); + if (m) { + x.save(); + var n = this._setBarGradient(x, H, c, H + r, D[1], m, A, "y"); + x.fillStyle = n.gradient; + x.beginPath(); + D = this._setStakedBarPoints(x, H + n.offset, c, r - n.offset * 2, o, w, this._settings.border ? 1 : 0, g.y); + x.fill(); + x.restore(); + } + if (this._settings.border) { + x.save(); + this._setBorderStyles(x, A); + x.beginPath(); + this._setStakedBarPoints(x, H - 0.5, c, r + 1, o, w, 0, g.y, 1); + x.stroke(); + x.restore(); + } + x.globalAlpha = 1; + this.canvases[y].renderTextAt(false, true, H + Math.floor(r / 2), D[1] + (c - D[1]) / 2 - 7, this._settings.label(L[E])); + K.addRect(L[E].id, [H - g.x, D[1] - g.y, D[0] - g.x, (L[E].$startY || c) - g.y], y); + L[E].$startY = this._settings.border ? D[1] + 1 : D[1]; + } + }, + _setStakedBarPoints: function (s, c, n, u, o, m, g, e, h) { + s.moveTo(c, n); + var l = n - o * m + g; + if (l < e) { + l = e; + } + s.lineTo(c, l); + var a = c + u; + var j = l; + s.lineTo(a, j); + var r = c + u; + s.lineTo(r, n); + if (!h) { + s.lineTo(c, n); + } + return [r, j - 2 * g]; + }, +}; +dhtmlx.chart.line = { + pvt_render_line: function (l, A, h, g, m, x) { + var w, n, j, u, s, r, o, c, a, e, y, v; + u = this._calculateLineParams(l, A, h, g, m); + w = this._settings; + if (A.length) { + s = w.offset ? h.x + u.cellWidth * 0.5 : h.x; + j = []; + for (n = 0; n < A.length; n++) { + v = this._getPointY(A[n], h, g, u); + if (v) { + o = !n ? s : u.cellWidth * n - 0.5 + s; + a = typeof v == "object" ? v.y0 : v; + if (n && this._settings.fixOverflow) { + y = this._getPointY(A[n - 1], h, g, u); + if (y.out && y.out == v.out) { + continue; + } + r = u.cellWidth * (n - 1) - 0.5 + s; + c = typeof y == "object" ? y.y0 : y; + if (y.out) { + e = y.out == "min" ? g.y : h.y; + j.push({ x: this._calcOverflowX(r, o, c, a, e), y: e }); + } + if (v.out) { + e = v.out == "min" ? g.y : h.y; + j.push({ x: this._calcOverflowX(r, o, c, a, e), y: e }); + } + } + if (!v.out) { + j.push({ x: o, y: v, index: n }); + } + } + } + this._mapStart = h; + for (n = 1; n <= j.length; n++) { + r = j[n - 1].x; + c = j[n - 1].y; + if (n < j.length) { + o = j[n].x; + a = j[n].y; + this._drawLine(l, r, c, o, a, w.line.color.call(this, A[n - 1]), w.line.width); + if (w.line && w.line.shadow) { + l.globalAlpha = 0.3; + this._drawLine(l, r + 2, c + w.line.width + 8, o + 2, a + w.line.width + 8, "#eeeeee", w.line.width + 3); + l.globalAlpha = 1; + } + } + if (typeof j[n - 1].index != "undefined") { + this._drawItem(l, r, c, A[j[n - 1].index], w.label(A[j[n - 1].index]), m, x, h); + } + } + } + }, + _calcOverflowX: function (c, a, g, e, h) { + return c + ((h - g) * (a - c)) / (e - g); + }, + _drawItem: function (u, e, s, n, r, o, c) { + var g = this._settings.item; + var m = parseInt(g.radius.call(this, n), 10) || 0; + var l = this._mapStart; + if (m) { + u.save(); + if (g.shadow) { + u.lineWidth = 1; + u.strokeStyle = "#bdbdbd"; + u.fillStyle = "#bdbdbd"; + var a = [0.1, 0.2, 0.3]; + for (var j = a.length - 1; j >= 0; j--) { + u.globalAlpha = a[j]; + u.strokeStyle = "#d0d0d0"; + u.beginPath(); + this._strokeChartItem(u, e, s + (2 * m) / 3, m + j + 1, g.type); + u.stroke(); + } + u.beginPath(); + u.globalAlpha = 0.3; + u.fillStyle = "#bdbdbd"; + this._strokeChartItem(u, e, s + (2 * m) / 3, m + 1, g.type); + u.fill(); + } + u.restore(); + if (g.type == "image" && g.src) { + this._drawImage(u, e - m, s - m, g.src, m * 2, m * 2); + } else { + u.lineWidth = g.borderWidth; + u.fillStyle = g.color.call(this, n); + u.strokeStyle = g.borderColor.call(this, n); + u.globalAlpha = g.alpha.call(this, n); + u.beginPath(); + this._strokeChartItem(u, e, s, m + 1, g.type); + u.fill(); + u.stroke(); + u.globalAlpha = 1; + } + } + if (r) { + this.canvases[o].renderTextAt(false, true, e, s - m - this._settings.labelOffset, this._settings.label.call(this, n)); + } + var h = this._settings.eventRadius || m + 1; + c.addRect(n.id, [e - h - l.x, s - h - l.y, e + h - l.x, s + h - l.y], o); + }, + _drawImage: function (e, c, m, j, g, a) { + var h = document.createElement("img"); + h.style.display = "none"; + h.style.width = g + "px"; + h.style.height = a + "px"; + document.body.appendChild(h); + h.src = j; + var l = function () { + e.drawImage(h, c, m); + }; + if (h.complete) { + l(h); + } else { + h.onload = l; + } + }, + _strokeChartItem: function (a, c, h, g, e) { + var j = []; + c = parseInt(c, 10); + h = parseInt(h, 10); + if (e && (e == "square" || e == "s")) { + g *= Math.sqrt(2) / 2; + j = [ + [c - g - a.lineWidth / 2, h - g], + [c + g, h - g], + [c + g, h + g], + [c - g, h + g], + [c - g, h - g], + ]; + } else { + if (e && (e == "diamond" || e == "d")) { + var l = a.lineWidth > 1 ? (a.lineWidth * Math.sqrt(2)) / 4 : 0; + j = [ + [c, h - g], + [c + g, h], + [c, h + g], + [c - g, h], + [c + l, h - g - l], + ]; + } else { + if (e && (e == "triangle" || e == "t")) { + j = [ + [c, h - g], + [c + (Math.sqrt(3) * g) / 2, h + g / 2], + [c - (Math.sqrt(3) * g) / 2, h + g / 2], + [c, h - g], + ]; + } else { + j = [[c, h, g, 0, Math.PI * 2, true]]; + } + } + } + this._path(a, j); + }, + _getPointY: function (e, m, j, a) { + var l = a.minValue; + var g = a.maxValue; + var o = a.unit; + var c = a.valueFactor; + var n = this._settings.value(e); + var r = (parseFloat(n || 0) - l) * c; + if (!this._settings.yAxis) { + r += a.startValue / o; + } + var h = j.y - o * r; + if (this._settings.fixOverflow && (this._settings.view == "line" || this._settings.view == "area")) { + if (n > g) { + h = { y: m.y, y0: h, out: "max" }; + } else { + if (r < 0 || n < l) { + h = { y: j.y, y0: h, out: "min" }; + } + } + } else { + if (n > g) { + h = m.y; + } + if (r < 0 || n < l) { + h = j.y; + } + } + return h; + }, + _calculateLineParams: function (n, g, l, j, h) { + var c = {}; + var o; + c.totalHeight = j.y - l.y; + c.cellWidth = (j.x - l.x) / (!this._settings.offset ? g.length - 1 : g.length); + var e = !!this._settings.yAxis; + var a = this._settings.view.indexOf("stacked") != -1 ? this._getStackedLimits(g) : this._getLimits(); + c.maxValue = a.max; + c.minValue = a.min; + if (!h) { + this._drawScales(g, l, j, c.minValue, c.maxValue, c.cellWidth); + } + if (e) { + c.maxValue = parseFloat(this._settings.yAxis.end); + c.minValue = parseFloat(this._settings.yAxis.start); + } + var m = this._getRelativeValue(c.minValue, c.maxValue); + o = m[0]; + c.valueFactor = m[1]; + c.unit = o ? c.totalHeight / o : 10; + c.startValue = 0; + if (!e) { + c.startValue = 10; + if (c.unit != c.totalHeight) { + c.unit = o ? (c.totalHeight - c.startValue) / o : 10; + } + } + return c; + }, +}; +dhtmlx.chart.bar = { + pvt_render_bar: function (C, S, j, h, D, Q) { + var v, + F, + J, + n, + O, + w, + x, + c, + K, + y, + u, + N, + o, + P = h.y - j.y; + o = !!this._settings.yAxis; + N = !!this._settings.xAxis; + n = this._getLimits(); + O = n.max; + w = n.min; + F = (h.x - j.x) / S.length; + if (!D && !(this._settings.origin != "auto" && !o)) { + this._drawScales(S, j, h, w, O, F); + } + if (o) { + O = parseFloat(this._settings.yAxis.end); + w = parseFloat(this._settings.yAxis.start); + } + K = this._getRelativeValue(w, O); + x = K[0]; + c = K[1]; + u = x ? P / x : x; + if (!o && !(this._settings.origin != "auto" && N)) { + y = 10; + u = x ? (P - y) / x : y; + } + if (!D && this._settings.origin != "auto" && !o && this._settings.origin > w) { + this._drawXAxis(C, S, j, h, F, h.y - u * (this._settings.origin - w)); + } + v = parseInt(this._settings.width, 10); + var M = 0; + var I = 0; + for (J = 0; J < this._series.length; J++) { + if (J == D) { + I = M; + } + if (this._series[J].view == "bar") { + M++; + } + } + var m = this._settings.seriesMargin; + var g = this._settings.seriesPadding; + if (this._series && v * M + g + (M > 2 ? m * M : 0) > F) { + v = F / M - g - (M > 2 ? m : 0); + } + var r = (F - v * M - m * (M - 1)) / 2; + if (this._settings.border) { + v = parseInt(v, 10); + r = parseInt(r, 10); + } + var l = typeof this._settings.radius != "undefined" ? parseInt(this._settings.radius, 10) : Math.round(v / 5); + var s = false; + var a = this._settings.gradient; + if (a && typeof a != "function") { + s = a; + a = false; + } else { + if (a) { + a = C.createLinearGradient(0, h.y, 0, j.y); + this._settings.gradient(a); + } + } + if (!N) { + this._drawLine(C, j.x, h.y + 0.5, h.x, h.y + 0.5, "#000000", 1); + } + for (J = 0; J < S.length; J++) { + var A = parseFloat(this._settings.value(S[J]) || 0); + if (isNaN(A)) { + continue; + } + if (A > O) { + A = O; + } + A -= w; + A *= c; + var L = j.x + r + (M > 2 ? m * I : 0) + J * F + v * I; + var e = h.y; + if (A < 0 || (this._settings.yAxis && A === 0 && !(this._settings.origin != "auto" && this._settings.origin > w))) { + this.canvases[D].renderTextAt(true, true, L + Math.floor(v / 2), e, this._settings.label(S[J])); + continue; + } + if (!o && !(this._settings.origin != "auto" && N)) { + A += y / u; + } + var E = a || this._settings.color.call(this, S[J]); + C.globalAlpha = this._settings.alpha.call(this, S[J]); + var H = this._drawBar(C, j, L, e, v, w, l, u, A, E, a, s); + if (s) { + this._drawBarGradient(C, L, e, v, w, l, u, A, E, s); + } + if (this._settings.border) { + this._drawBarBorder(C, L, e, v, w, l, u, A, E); + } + C.globalAlpha = 1; + if (H[0] != L) { + this.canvases[D].renderTextAt(false, true, L + Math.floor(v / 2), H[1], this._settings.label(S[J])); + } else { + this.canvases[D].renderTextAt(true, true, L + Math.floor(v / 2), H[3], this._settings.label(S[J])); + } + Q.addRect(S[J].id, [L - j.x, H[3] - j.y, H[2] - j.x, H[1] - j.y], D); + } + }, + _correctBarParams: function (m, h, e, j, l, n, g) { + var a = this._settings.xAxis; + var c = e; + if (!!a && this._settings.origin != "auto" && this._settings.origin > g) { + e -= (this._settings.origin - g) * l; + c = e; + j = j - (this._settings.origin - g); + if (j < 0) { + j *= -1; + m.translate(h + n, e); + m.rotate(Math.PI); + h = 0; + e = 0; + } + e -= 0.5; + } + return { value: j, x0: h, y0: e, start: c }; + }, + _drawBar: function (u, h, A, g, n, o, j, m, s, v, a, l) { + var w; + u.save(); + u.fillStyle = v; + var r = this._correctBarParams(u, A, g, s, m, n, o); + if (m * r.value > 0) { + w = this._setBarPoints(u, r.x0, r.y0, n, j, m, r.value, this._settings.border ? 1 : 0); + } else { + w = [r.x0, r.y0]; + } + if (a && !l) { + u.lineTo(r.x0 + (this._settings.border ? 1 : 0), h.y); + } + u.fill(); + u.restore(); + var y = r.x0; + var x = r.x0 != A ? A + w[0] : w[0]; + var e = r.x0 != A ? r.start - w[1] - r.y0 : r.y0; + var c = r.x0 != A ? r.start - r.y0 : w[1]; + return [y, e, x, c]; + }, + _drawBarBorder: function (n, c, l, o, h, g, m, j, e) { + var a; + n.save(); + a = this._correctBarParams(n, c, l, j, m, o, h); + this._setBorderStyles(n, e); + if (m * a.value > 0) { + this._setBarPoints(n, a.x0, a.y0, o, g, m, a.value, n.lineWidth / 2, 1); + } + n.stroke(); + n.restore(); + }, + _drawBarGradient: function (s, g, o, u, m, l, r, n, h, c) { + s.save(); + var e = this._correctBarParams(s, g, o, n, r, u, m); + var j = this._setBarGradient(s, e.x0, e.y0, e.x0 + u, e.y0 - r * e.value + 2, c, h, "y"); + var a = this._settings.border ? 1 : 0; + s.fillStyle = j.gradient; + if (r * e.value > 0) { + this._setBarPoints(s, e.x0 + j.offset, e.y0, u - j.offset * 2, l, r, e.value, j.offset + a); + } + s.fill(); + s.restore(); + }, + _setBarPoints: function (w, g, s, x, m, u, r, h, l) { + w.beginPath(); + var c = 0; + if (m > u * r) { + var j = (m - u * r) / m; + if (j <= 1 && j >= -1) { + c = -Math.acos(j) + Math.PI / 2; + } + } + w.moveTo(g + h, s); + var o = s - Math.floor(u * r) + m + (m ? 0 : h); + if (m < u * r) { + w.lineTo(g + h, o); + } + var e = g + m; + if (m && m > 0) { + w.arc(e, o, m - h, -Math.PI + c, -Math.PI / 2, false); + } + var a = g + x - m - h; + var n = o - m + (m ? h : 0); + w.lineTo(a, n); + if (m && m > 0) { + w.arc(a, o, m - h, -Math.PI / 2, 0 - c, false); + } + var v = g + x - h; + w.lineTo(v, s); + if (!l) { + w.lineTo(g + h, s); + } + return [v, n]; + }, +}; +dhtmlx.chart.pie = { + pvt_render_pie: function (c, g, a, j, e, h) { + this._renderPie(c, g, a, j, 1, h, e); + }, + _renderPie: function (s, F, h, g, D, E, u) { + if (!F.length) { + return; + } + var v = this._getPieParameters(h, g); + var l = this._settings.radius ? this._settings.radius : v.radius; + if (l < 0) { + return; + } + var a = this._getValues(F); + var j = this._getTotalValue(a); + var m = this._getRatios(a, j); + var C = this._settings.x ? this._settings.x : v.x; + var e = this._settings.y ? this._settings.y : v.y; + if (D == 1 && this._settings.shadow) { + this._addShadow(s, C, e, l); + } + e = e / D; + var r = -Math.PI / 2; + var o; + var x = []; + s.scale(1, D); + if (this._settings.gradient) { + var A = D != 1 ? C + l / 3 : C; + var c = D != 1 ? e + l / 3 : e; + this._showRadialGradient(s, C, e, l, A, c); + } + if (this._settings.labelLines) { + this._labelMargins = this._getLabelMargins(m, l); + } + for (var y = 0; y < F.length; y++) { + if (!a[y]) { + continue; + } + s.strokeStyle = F.length == 1 ? this._settings.color.call(this, F[y]) : this._settings.lineColor.call(this, F[y]); + s.beginPath(); + s.moveTo(C, e); + x.push(r); + o = -Math.PI / 2 + m[y] - 0.0001; + s.arc(C, e, l, r, o, false); + s.lineTo(C, e); + var w = this._settings.color.call(this, F[y]); + s.fillStyle = w; + s.fill(); + if (this._settings.pieInnerText) { + this._drawSectorLabel(C, e, (5 * l) / 6, r, o, D, this._settings.pieInnerText(F[y], j), true); + } + if (this._settings.label) { + this._drawSectorLabel(C, e, l, r, o, D, this._settings.label(F[y]), 0, this._labelMargins ? this._labelMargins[y] : {}, s); + } + if (D != 1) { + this._createLowerSector(s, C, e, r, o, l, true); + s.fillStyle = "#000000"; + s.globalAlpha = 0.2; + this._createLowerSector(s, C, e, r, o, l, false); + s.globalAlpha = 1; + s.fillStyle = w; + } + E.addSector(F[y].id, r, o, C - h.x, e - h.y / D, l, D, u); + r = o; + } + s.globalAlpha = 0.8; + var n; + if (x.length > 1) { + for (y = 0; y < x.length; y++) { + n = this._getPositionByAngle(x[y], C, e, l); + this._drawLine(s, C, e, n.x, n.y, this._settings.lineColor.call(this, F[y]), 2); + } + } + if (D == 1) { + s.lineWidth = 2; + s.strokeStyle = "#ffffff"; + s.beginPath(); + s.arc(C, e, l + 1, 0, 2 * Math.PI, false); + s.stroke(); + } + s.globalAlpha = 1; + s.scale(1, 1 / D); + }, + _getLabelMargins: function (v, l) { + var D, + C, + J, + I, + a = [], + w = []; + var M = { 1: [0] }; + for (J = 1; J < v.length; J++) { + D = -Math.PI / 2 + (J > 1 ? v[J - 1] - (v[J - 1] - v[J - 2]) / 2 : v[J - 1] / 2); + C = -Math.PI / 2 + v[J] - (v[J] - v[J - 1]) / 2; + var h = Math.cos(C); + var y = Math.sin(C); + var m = Math.cos(D); + var A = Math.sin(D); + var E = Math.round((l + 8) * Math.abs(Math.sin(C) - Math.sin(D))); + var s = h < 0 ? (y < 0 ? 4 : 3) : y < 0 ? 1 : 2; + var u = m < 0 ? (A < 0 ? 4 : 3) : A < 0 ? 1 : 2; + if (!M[s]) { + M[s] = []; + } + M[s].push(u == s ? E : 0); + } + var F = []; + var L = 0; + for (var x in M) { + var g = 0; + var e = M[x].length; + var o = 0; + var n = 0; + if (x == 1 || x == 3) { + I = x - 1; + var K = 0; + while (I > 0) { + if (M[I]) { + K += M[I].length; + } + I--; + } + F[K + M[x].length - 1] = { y: 0, x: 0 }; + var I = M[x].length - 2; + while (I >= 0) { + if ((o || I) && M[x][I + 1] - o < 18) { + o += 18 - M[x][I + 1]; + } else { + o = 0; + } + F[K + I] = { y: o * (x == 1 ? -1 : 1) }; + I--; + } + for (var H = F.length - M[x].length; H < F.length; H++) { + if (F[H]["y"] != 0) { + n += 6; + F[H]["x"] = n; + } else { + F[H]["x"] = 0; + n = 0; + } + } + } else { + var I = 1; + F.push({ y: 0, x: 0 }); + while (I < M[x].length) { + if (M[x][I] - o < 18) { + o += 18 - M[x][I]; + } else { + o = 0; + } + F.push({ y: o * (x == 4 ? -1 : 1) }); + I++; + } + for (var H = F.length - 1; H >= F.length - M[x].length; H--) { + if (F[H]["y"] != 0) { + n += 8; + F[H]["x"] = n; + } else { + n = 0; + F[H]["x"] = 0; + } + } + } + } + return F; + }, + _getValues: function (e) { + var a = []; + for (var c = 0; c < e.length; c++) { + a.push(parseFloat(this._settings.value(e[c]) || 0)); + } + return a; + }, + _getTotalValue: function (a) { + var e = 0; + for (var c = 0; c < a.length; c++) { + e += a[c]; + } + return e; + }, + _getRatios: function (c, a) { + var j; + var h = []; + var g = 0; + a = a || this._getTotalValue(c); + for (var e = 0; e < c.length; e++) { + j = c[e]; + h[e] = Math.PI * 2 * (a ? (j + g) / a : 1 / c.length); + g += j; + } + return h; + }, + _getPieParameters: function (l, h) { + var g = h.x - l.x; + var c = h.y - l.y; + var e = l.x + g / 2; + var j = l.y + c / 2; + var a = Math.min(g / 2, c / 2); + return { x: e, y: j, radius: a }; + }, + _createLowerSector: function (g, h, l, e, a, j, c) { + g.lineWidth = 1; + if (!((e <= 0 && a >= 0) || (e >= 0 && a <= Math.PI) || (Math.abs(e - Math.PI) > 0.003 && e <= Math.PI && a >= Math.PI))) { + return; + } + if (e <= 0 && a >= 0) { + e = 0; + c = false; + this._drawSectorLine(g, h, l, j, e, a); + } + if (e <= Math.PI && a >= Math.PI) { + a = Math.PI; + c = false; + this._drawSectorLine(g, h, l, j, e, a); + } + var m = (this._settings.height || Math.floor(j / 4)) / this._settings.cant; + g.beginPath(); + g.arc(h, l, j, e, a, false); + g.lineTo(h + j * Math.cos(a), l + j * Math.sin(a) + m); + g.arc(h, l + m, j, a, e, true); + g.lineTo(h + j * Math.cos(e), l + j * Math.sin(e)); + g.fill(); + if (c) { + g.stroke(); + } + }, + _drawSectorLine: function (e, g, j, h, c, a) { + e.beginPath(); + e.arc(g, j, h, c, a, false); + e.stroke(); + }, + _addShadow: function (c, a, j, g) { + c.globalAlpha = 0.5; + var h = ["#c4c4c4", "#c6c6c6", "#cacaca", "#dcdcdc", "#dddddd", "#e0e0e0", "#eeeeee", "#f5f5f5", "#f8f8f8"]; + for (var e = h.length - 1; e > -1; e--) { + c.beginPath(); + c.fillStyle = h[e]; + c.arc(a + 1, j + 1, g + e, 0, Math.PI * 2, true); + c.fill(); + } + c.globalAlpha = 1; + }, + _getGrayGradient: function (a) { + a.addColorStop(0, "#ffffff"); + a.addColorStop(0.7, "#7a7a7a"); + a.addColorStop(1, "#000000"); + return a; + }, + _showRadialGradient: function (e, c, l, a, g, h) { + e.beginPath(); + var j; + if (typeof this._settings.gradient != "function") { + j = e.createRadialGradient(g, h, a / 4, c, l, a); + j = this._getGrayGradient(j); + } else { + j = this._settings.gradient(j); + } + e.fillStyle = j; + e.arc(c, l, a, 0, Math.PI * 2, true); + e.fill(); + e.globalAlpha = 0.7; + }, + _drawSectorLabel: function (M, g, l, E, D, N, A, a, C, H) { + var w = this.canvases[0].renderText(0, 0, A, 0, 1); + if (!w) { + return; + } + var O = w.scrollWidth; + w.style.width = O + "px"; + if (O > M) { + O = M; + } + var F = D - E < 0.2 ? 4 : 8; + if (a) { + F = O / 1.8; + } + var j = E + (D - E) / 2; + var h = l; + l = a ? (5 * l) / 6 : l + this._settings.labelOffset; + l = l - (F - 8) / 2; + var r = -F; + var o = -8; + var I = "right"; + if ((j >= Math.PI / 2 && j < Math.PI) || (j <= (3 * Math.PI) / 2 && j >= Math.PI)) { + r = -O - r; + I = "left"; + } + var m = 0; + if (!a && N < 1 && j > 0 && j < Math.PI) { + m = (this._settings.height || Math.floor(l / 4)) / N; + } + var s = (g + Math.floor(l + m) * Math.sin(j)) * N + o; + var u = M + Math.floor(l + F / 2) * Math.cos(j) + r; + var n = D < Math.PI / 2 + 0.01; + var v = E < Math.PI / 2; + if (v && n) { + u = Math.max(u, M + 3); + } else { + if (!v && !n) { + u = Math.min(u, M - O); + } else { + if (!a && !this._settings.labelLines && ((j >= Math.PI / 2 && j < Math.PI) || (j <= (3 * Math.PI) / 2 && j >= Math.PI))) { + u += O / 3; + } + } + } + if (this._settings.labelLines && !a) { + var J = Math.abs((Math.abs(C || 0) + Math.abs(h * Math.sin(j))) / Math.sin(j)); + if (C.y) { + s += C.y; + } + if (I == "left") { + u -= C.x; + } else { + u += C.x; + } + H.beginPath(); + H.strokeStyle = "#555"; + var L = M + h * Math.cos(j); + var e = g + h * Math.sin(j); + H.moveTo(L, e); + var K = u - (I == "left" ? r - 8 : 2); + var c = s; + if (I == "left" && K > L) { + K = L - Math.abs(c - e + 16) / Math.tan(j - Math.PI); + c = c + 16; + if (j < Math.PI) { + c -= 8; + } + } else { + c += 8; + } + H.lineTo(K, c); + H.lineTo(K + (I == "left" ? -5 : 5), c); + H.stroke(); + s = c - 8; + u = K + r + (I == "left" ? -15 : 15); + } + w.style.top = s + "px"; + w.style.left = u + "px"; + w.style.width = O + "px"; + w.style.textAlign = I; + w.style.whiteSpace = "nowrap"; + }, +}; +dhtmlx.chart.pie3D = { + pvt_render_pie3D: function (c, g, a, j, e, h) { + this._renderPie(c, g, a, j, this._settings.cant, h); + }, +}; +dhtmlx.chart.donut = { + pvt_render_donut: function (s, h, o, n, l, c) { + if (!h.length) { + return; + } + this._renderPie(s, h, o, n, 1, c); + var g = this._settings; + var j = this._getPieParameters(o, n); + var a = g.radius ? g.radius : j.radius; + var m = g.innerRadius && g.innerRadius < a ? g.innerRadius : a / 3; + var e = g.x ? g.x : j.x; + var r = g.y ? g.y : j.y; + s.fillStyle = "#ffffff"; + s.beginPath(); + s.arc(e, r, m, 0, Math.PI * 2, true); + s.fill(); + }, +}; +dhtmlx.DataDriver.dhtmlxgrid = { + _grid_getter: "_get_cell_value", + toObject: function (a) { + this._grid = a; + return a; + }, + getRecords: function (a) { + return a.rowsBuffer; + }, + getDetails: function (e) { + var a = {}; + for (var c = 0; c < this._grid.getColumnsNum(); c++) { + a["data" + c] = this._grid[this._grid_getter](e, c); + } + return a; + }, + getInfo: function (a) { + return { _size: 0, _from: 0 }; + }, +}; +dhtmlx.ui.Canvas = function (c, e, h) { + this._canvas_labels = []; + this._canvas_name = e; + this._obj = c; + var g = c.offsetWidth * (window.devicePixelRatio || 1); + var a = c.offsetHeight * (window.devicePixelRatio || 1); + var h = h || ""; + h += ";width:" + c.offsetWidth + "px;height:" + c.offsetHeight + "px;"; + this._prepareCanvas(e, h, g, a); +}; +dhtmlx.ui.Canvas.prototype = { + _prepareCanvas: function (c, g, e, a) { + this._canvas = dhtmlx.html.create("canvas", { width: e, height: a, canvas_id: c, style: g || "" }); + this._obj.appendChild(this._canvas); + if (!this._canvas.getContext) { + if (dhtmlx._isIE) { + dhtmlx.require("thirdparty/excanvas/excanvas.js"); + G_vmlCanvasManager.init_(document); + G_vmlCanvasManager.initElement(this._canvas); + } else { + dhtmlx.error("Canvas is not supported in the current browser"); + } + } + return this._canvas; + }, + getCanvas: function (c) { + var a = (this._canvas || this._prepareCanvas()).getContext(c || "2d"); + if (!this._webixDevicePixelRatio) { + this._webixDevicePixelRatio = true; + a.scale(window.devicePixelRatio || 1, window.devicePixelRatio || 1); + } + return a; + }, + _resizeCanvas: function () { + if (this._canvas) { + var a = this._canvas.parentNode.offsetWidth; + var c = this._canvas.parentNode.offsetHeight; + this._canvas.setAttribute("width", a * (window.devicePixelRatio || 1)); + this._canvas.setAttribute("height", c * (window.devicePixelRatio || 1)); + this._canvas.style.width = a + "px"; + this._canvas.style.height = c + "px"; + this._webixDevicePixelRatio = false; + } + }, + renderText: function (a, j, h, g, c) { + if (!h) { + return; + } + var e = dhtmlx.html.create("DIV", { class: "dhx_canvas_text" + (g ? " " + g : ""), style: "left:" + a + "px; top:" + j + "px;" }, h); + this._obj.appendChild(e); + this._canvas_labels.push(e); + if (c) { + e.style.width = c + "px"; + } + return e; + }, + renderTextAt: function (h, n, a, m, g, l, e) { + var j = this.renderText.call(this, a, m, g, l, e); + if (j) { + if (h) { + if (h == "middle") { + j.style.top = parseInt(m - j.offsetHeight / 2, 10) + "px"; + } else { + j.style.top = m - j.offsetHeight + "px"; + } + } + if (n) { + if (n == "left") { + j.style.left = a - j.offsetWidth + "px"; + } else { + j.style.left = parseInt(a - j.offsetWidth / 2, 10) + "px"; + } + } + } + return j; + }, + clearCanvas: function (a) { + var c = [], + e; + for (e = 0; e < this._canvas_labels.length; e++) { + this._obj.removeChild(this._canvas_labels[e]); + } + this._canvas_labels = []; + if (!a && this._obj._htmlmap) { + c = this._getMapAreas(); + while (c.length) { + c[0].parentNode.removeChild(c[0]); + c.splice(0, 1); + } + c = null; + if (!this._obj._htmlmap.getElementsByTagName("AREA").length) { + this._obj._htmlmap.parentNode.removeChild(this._obj._htmlmap); + this._obj._htmlmap = null; + } + } + this.getCanvas().clearRect(0, 0, this._obj.offsetWidth * (window.devicePixelRatio || 1), this._obj.offsetHeight * (window.devicePixelRatio || 1)); + }, + toggleCanvas: function () { + this._toggleCanvas(this._canvas.style.display == "none"); + }, + showCanvas: function () { + this._toggleCanvas(true); + }, + hideCanvas: function () { + this._toggleCanvas(false); + }, + _toggleCanvas: function (a) { + var c, e; + for (e = 0; e < this._canvas_labels.length; e++) { + this._canvas_labels[e].style.display = a ? "" : "none"; + } + if (this._obj._htmlmap) { + c = this._getMapAreas(); + for (e = 0; e < c.length; e++) { + if (a) { + c[e].removeAttribute("disabled"); + } else { + c[e].setAttribute("disabled", "true"); + } + } + } + this._canvas.style.display = a ? "" : "none"; + }, + _getMapAreas: function () { + var e = [], + a, + c; + a = this._obj._htmlmap.getElementsByTagName("AREA"); + for (c = 0; c < a.length; c++) { + if (a[c].getAttribute("userdata") == this._canvas_name) { + e.push(a[c]); + } + } + return e; + }, +}; +dhtmlXChart = function (a) { + this.name = "Chart"; + if (dhtmlx.assert_enabled()) { + this._assert(); + } + dhtmlx.extend(this, dhtmlx.Settings); + this._parseContainer(a, "dhx_chart"); + dhtmlx.extend(this, dhtmlx.AtomDataLoader); + dhtmlx.extend(this, dhtmlx.DataLoader); + this.data.provideApi(this, true); + dhtmlx.extend(this, dhtmlx.EventSystem); + dhtmlx.extend(this, dhtmlx.MouseEvents); + dhtmlx.extend(this, dhtmlx.Destruction); + dhtmlx.extend(this, dhtmlx.Group); + dhtmlx.extend(this, dhtmlx.AutoTooltip); + for (var c in dhtmlx.chart) { + dhtmlx.extend(this, dhtmlx.chart[c]); + } + if (a.preset) { + this.definePreset(a); + } + this._parseSettings(a, this.defaults); + this._series = [this._settings]; + this.data.attachEvent( + "onStoreUpdated", + dhtmlx.bind(function () { + this.render(); + }, this) + ); + this.attachEvent("onLocateData", this._switchSerie); +}; +dhtmlXChart.prototype = { + _id: "dhx_area_id", + on_click: { + dhx_chart_legend_item: function (l, m, j) { + var h = j.getAttribute("series_id"); + if (this.callEvent("onLegendClick", [l, h, j])) { + var g = this._settings; + var c = g.legend.values; + var a = c && typeof c[h].toggle != "undefined" ? c[h].toggle : g.legend.toggle; + if (typeof h != "undefined" && this._series.length > 1) { + if (a) { + if (j.className.indexOf("hidden") != -1) { + this.showSeries(h); + } else { + this.hideSeries(h); + } + } + } + } + }, + }, + on_dblclick: {}, + on_mouse_move: {}, + bind: function () { + dhx.BaseBind.legacyBind.apply(this, arguments); + }, + sync: function () { + dhx.BaseBind.legacySync.apply(this, arguments); + }, + resize: function () { + for (var a in this.canvases) { + this.canvases[a]._resizeCanvas(); + } + this.render(); + }, + view_setter: function (a) { + if (!dhtmlx.chart[a]) { + dhtmlx.error("Chart type extension is not loaded: " + a); + } + if (typeof this._settings.offset == "undefined") { + this._settings.offset = !(a == "area" || a == "stackedArea"); + } + if (a == "radar" && !this._settings.yAxis) { + this.define("yAxis", {}); + } + if (a == "scatter") { + if (!this._settings.yAxis) { + this.define("yAxis", {}); + } + if (!this._settings.xAxis) { + this.define("xAxis", {}); + } + } + return a; + }, + clearCanvas: function () { + if (this.canvases && typeof this.canvases == "object") { + for (var a in this.canvases) { + this.canvases[a].clearCanvas(); + } + } + }, + render: function () { + var e, c, g, h, a; + if (!this.callEvent("onBeforeRender", [this.data])) { + return; + } + if (this.canvases && typeof this.canvases == "object") { + for (c in this.canvases) { + this.canvases[c].clearCanvas(); + } + } else { + this.canvases = {}; + } + if (this._settings.legend) { + if (!this.canvases.legend) { + this.canvases.legend = new dhtmlx.ui.Canvas(this._obj, "legend"); + } + this._drawLegend(this.data.getRange(), this._obj.offsetWidth); + } + e = this._getChartBounds(this._obj.offsetWidth, this._obj.offsetHeight); + this._map = h = new dhtmlx.ui.Map(this._id); + a = this._settings; + g = this._getChartData(); + for (c = 0; c < this._series.length; c++) { + this._settings = this._series[c]; + if (!this.canvases[c]) { + this.canvases[c] = new dhtmlx.ui.Canvas(this._obj, c, "z-index:" + (2 + c)); + } + this["pvt_render_" + this._settings.view](this.canvases[c].getCanvas(), g, e.start, e.end, c, h); + } + h.render(this._obj); + this._obj.lastChild.style.zIndex = 1000; + this._applyBounds(this._obj.lastChild, e); + this.callEvent("onAfterRender", []); + this._settings = a; + }, + _applyBounds: function (e, c) { + var a = {}; + a.left = c.start.x; + a.top = c.start.y; + a.width = c.end.x - c.start.x; + a.height = c.end.y - c.start.y; + for (var g in a) { + e.style[g] = a[g] + "px"; + } + }, + _getChartData: function () { + var g, l, e, h, j, o, a, m, n, c; + h = this.data.getRange(); + g = this._settings.view.toLowerCase().indexOf("barh") != -1 ? "yAxis" : "xAxis"; + l = this._settings[g]; + if (l && l.units && typeof l.units == "object") { + e = l.units; + m = []; + if (typeof e.start != "undefined" && typeof e.end != "undefined" && typeof e.next != "undefined") { + a = e.start; + while (a <= e.end) { + m.push(a); + a = e.next.call(this, a); + } + } else { + if (Object.prototype.toString.call(e) === "[object Array]") { + m = e; + } + } + o = []; + if (m.length) { + n = l.value; + c = {}; + for (j = 0; j < h.length; j++) { + c[n(h[j])] = j; + } + for (j = 0; j < m.length; j++) { + if (typeof c[m[j]] != "undefined") { + h[c[m[j]]].$unit = m[j]; + o.push(h[c[m[j]]]); + } else { + o.push({ $unit: m[j] }); + } + } + } + return o; + } + return h; + }, + value_setter: dhtmlx.Template.obj_setter, + xValue_setter: dhtmlx.Template.obj_setter, + yValue_setter: function (a) { + this.define("value", a); + }, + alpha_setter: dhtmlx.Template.obj_setter, + label_setter: dhtmlx.Template.obj_setter, + lineColor_setter: dhtmlx.Template.obj_setter, + borderColor_setter: dhtmlx.Template.obj_setter, + pieInnerText_setter: dhtmlx.Template.obj_setter, + gradient_setter: function (a) { + if (typeof a != "function" && a && a === true) { + a = "light"; + } + return a; + }, + colormap: { + RAINBOW: function (a) { + var c = Math.floor((this.indexById(a.id) / this.dataCount()) * 1536); + if (c == 1536) { + c -= 1; + } + return this._rainbow[Math.floor(c / 256)](c % 256); + }, + }, + color_setter: function (a) { + return this.colormap[a] || dhtmlx.Template.obj_setter(a); + }, + fill_setter: function (a) { + return !a || a == 0 ? false : dhtmlx.Template.obj_setter(a); + }, + definePreset: function (a) { + this.define("preset", a.preset); + delete a.preset; + }, + preset_setter: function (h) { + var e, c, g; + this.defaults = dhtmlx.extend({}, this.defaults); + if (typeof dhtmlx.presets.chart[h] == "object") { + g = dhtmlx.presets.chart[h]; + for (e in g) { + if (typeof g[e] == "object") { + if (!this.defaults[e] || typeof this.defaults[e] != "object") { + this.defaults[e] = dhtmlx.extend({}, g[e]); + } else { + this.defaults[e] = dhtmlx.extend({}, this.defaults[e]); + for (c in g[e]) { + this.defaults[e][c] = g[e][c]; + } + } + } else { + this.defaults[e] = g[e]; + } + } + return h; + } + return false; + }, + legend_setter: function (a) { + if (!a) { + if (this.legendObj) { + this.legendObj.innerHTML = ""; + this.legendObj = null; + } + return false; + } + if (typeof a != "object") { + a = { template: a }; + } + this._mergeSettings(a, { + width: 150, + height: 18, + layout: "y", + align: "left", + valign: "bottom", + template: "", + toggle: this._settings.view.toLowerCase().indexOf("stacked") != -1 ? "" : "hide", + marker: { type: "square", width: 15, height: 15, radius: 3 }, + margin: 4, + padding: 3, + }); + a.template = dhtmlx.Template.setter(a.template); + return a; + }, + defaults: { + color: "RAINBOW", + alpha: "1", + label: false, + value: "{obj.value}", + padding: {}, + view: "pie", + lineColor: "#ffffff", + cant: 0.5, + width: 30, + labelWidth: 100, + line: { width: 2, color: "#1293f8" }, + seriesMargin: 1, + seriesPadding: 4, + item: { radius: 3, borderColor: "#636363", borderWidth: 1, color: "#ffffff", alpha: 1, type: "r", shadow: false }, + shadow: true, + gradient: false, + border: true, + labelOffset: 20, + origin: "auto", + }, + item_setter: function (a) { + if (typeof a != "object") { + a = { color: a, borderColor: a }; + } + this._mergeSettings(a, dhtmlx.extend({}, this.defaults.item)); + var e = ["alpha", "borderColor", "color", "radius"]; + for (var c = 0; c < e.length; c++) { + a[e[c]] = dhtmlx.Template.setter(a[e[c]]); + } + return a; + }, + line_setter: function (a) { + if (typeof a != "object") { + a = { color: a }; + } + dhtmlx.extend(this.defaults.line, a); + a = dhtmlx.extend({}, this.defaults.line); + a.color = dhtmlx.Template.setter(a.color); + return a; + }, + padding_setter: function (a) { + if (typeof a != "object") { + a = { left: a, right: a, top: a, bottom: a }; + } + this._mergeSettings(a, { left: 50, right: 20, top: 35, bottom: 40 }); + return a; + }, + xAxis_setter: function (a) { + if (!a) { + return false; + } + if (typeof a != "object") { + a = { template: a }; + } + if (!a.value) { + a.value = a.template; + } + this._mergeSettings(a, { title: "", color: "#000000", lineColor: "#cfcfcf", template: "{obj}", value: "{obj}", lines: true }); + var c = ["lineColor", "template", "lines", "value"]; + this._converToTemplate(c, a); + this._configXAxis = dhtmlx.extend({}, a); + return a; + }, + yAxis_setter: function (a) { + this._mergeSettings(a, { title: "", color: "#000000", lineColor: "#cfcfcf", template: "{obj}", lines: true, bg: "#ffffff" }); + var c = ["lineColor", "template", "lines", "bg"]; + this._converToTemplate(c, a); + this._configYAxis = dhtmlx.extend({}, a); + return a; + }, + _converToTemplate: function (a, c) { + for (var e = 0; e < a.length; e++) { + c[a[e]] = dhtmlx.Template.setter(c[a[e]]); + } + }, + _drawScales: function (h, g, e, l, a, c) { + var j = 0; + if (this._settings.yAxis) { + if (!this.canvases.y) { + this.canvases.y = new dhtmlx.ui.Canvas(this._obj, "axis_y"); + } + j = this._drawYAxis(this.canvases.y.getCanvas(), h, g, e, l, a); + } + if (this._settings.xAxis) { + if (!this.canvases.x) { + this.canvases.x = new dhtmlx.ui.Canvas(this._obj, "axis_x"); + } + this._drawXAxis(this.canvases.x.getCanvas(), h, g, e, c, j); + } + return j; + }, + _drawXAxis: function (u, j, r, o, g, n) { + var e = r.x - 0.5; + var s = parseInt(n ? n : o.y, 10) + 0.5; + var c = o.x; + var l; + var a = true; + for (var h = 0; h < j.length; h++) { + if (this._settings.offset === true) { + l = e + g / 2 + h * g; + } else { + l = h == j.length - 1 ? o.x : e + h * g; + a = !!h; + } + l = Math.ceil(l) - 0.5; + var m = this._settings.origin != "auto" && this._settings.view == "bar" && parseFloat(this._settings.value(j[h])) < this._settings.origin; + this._drawXAxisLabel(l, s, j[h], a, m); + if ((this._settings.offset || h) && this._settings.xAxis.lines.call(this, j[h])) { + this._drawXAxisLine(u, l, o.y, r.y, j[h]); + } + } + this.canvases.x.renderTextAt(true, false, e, o.y + this._settings.padding.bottom - 3, this._settings.xAxis.title, "dhx_axis_title_x", o.x - r.x); + this._drawLine(u, e, s, c, s, this._settings.xAxis.color, 1); + if (!this._settings.xAxis.lines.call(this, {}) || !this._settings.offset) { + return; + } + this._drawLine(u, c + 0.5, o.y, c + 0.5, r.y + 0.5, this._settings.xAxis.color, 0.2); + }, + _drawYAxis: function (w, D, j, h, m, l) { + var n; + var u = {}; + if (!this._settings.yAxis) { + return; + } + var y = j.x - 0.5; + var g = h.y; + var e = j.y; + var v = h.y; + if (this._settings.yAxis.step) { + n = parseFloat(this._settings.yAxis.step); + } + if (typeof this._configYAxis.step == "undefined" || typeof this._configYAxis.start == "undefined" || typeof this._configYAxis.end == "undefined") { + u = this._calculateScale(m, l); + m = u.start; + l = u.end; + n = u.step; + this._settings.yAxis.end = l; + this._settings.yAxis.start = m; + } + this._setYAxisTitle(j, h); + if (n === 0) { + l = m; + n = 1; + } + var a = l == m ? g - e : ((g - e) * n) / (l - m); + var A = 0; + for (var x = m; x <= l; x += n) { + if (u.fixNum) { + x = parseFloat(new Number(x).toFixed(u.fixNum)); + } + var C = Math.floor(g - A * a) + 0.5; + if (!(x == m && this._settings.origin == "auto") && this._settings.yAxis.lines.call(this, x)) { + this._drawLine(w, y, C, h.x, C, this._settings.yAxis.lineColor.call(this, x), 1); + } + if (x == this._settings.origin) { + v = C; + } + var o = x; + if (n < 1) { + var r = Math.min(this._log10(n), m <= 0 ? 0 : this._log10(m)); + var s = Math.pow(10, -r); + o = Math.round(x * s) / s; + x = o; + } + this.canvases.y.renderText(0, C - 5, this._settings.yAxis.template(o.toString()), "dhx_axis_item_y", j.x - 5); + A++; + } + this._drawLine(w, y, g + 1, y, e, this._settings.yAxis.color, 1); + return v; + }, + _setYAxisTitle: function (e, c) { + var a = "dhx_axis_title_y" + (dhtmlx._isIE && dhtmlx._isIE != 9 ? " dhx_ie_filter" : ""); + var g = this.canvases.y.renderTextAt("middle", false, 0, parseInt((c.y - e.y) / 2 + e.y, 10), this._settings.yAxis.title, a); + if (g) { + g.style.left = (dhtmlx.env.transform ? (g.offsetHeight - g.offsetWidth) / 2 : 0) + "px"; + } + }, + _calculateScale: function (o, c) { + if (this._settings.origin != "auto" && this._settings.origin < o) { + o = this._settings.origin; + } + var h, g, l; + h = (c - o) / 8 || 1; + var e = Math.floor(this._log10(h)); + var a = Math.pow(10, e); + var j = h / a; + j = j > 5 ? 10 : 5; + h = parseInt(j, 10) * a; + if (h > Math.abs(o)) { + g = o < 0 ? -h : 0; + } else { + var r = Math.abs(o); + var n = Math.floor(this._log10(r)); + var m = r / Math.pow(10, n); + g = (Math.ceil(m * 10) / 10) * Math.pow(10, n) - h; + if (r > 1 && h > 0.1) { + g = Math.ceil(g); + } + while (o < 0 ? g <= o : g >= o) { + g -= h; + } + if (o < 0) { + g = -g - 2 * h; + } + } + l = g; + while (l < c) { + l += h; + l = parseFloat(new Number(l).toFixed(Math.abs(e))); + } + return { start: g, end: l, step: h, fixNum: Math.abs(e) }; + }, + _getLimits: function (c, l) { + var m, j; + var h = arguments.length && c == "h" ? this._configXAxis : this._configYAxis; + l = l || "value"; + if (h && typeof h.end != "undefined" && typeof h.start != "undefined" && h.step) { + m = parseFloat(h.end); + j = parseFloat(h.start); + } else { + m = this.max(this._series[0][l]); + j = h && typeof h.start != "undefined" ? parseFloat(h.start) : this.min(this._series[0][l]); + if (this._series.length > 1) { + for (var g = 1; g < this._series.length; g++) { + var a = this.max(this._series[g][l]); + var e = this.min(this._series[g][l]); + if (a > m) { + m = a; + } + if (e < j) { + j = e; + } + } + } + } + return { max: m, min: j }; + }, + _log10: function (c) { + var a = "log"; + return Math.floor(Math[a](c) / Math.LN10); + }, + _drawXAxisLabel: function (c, j, h, a, g) { + if (!this._settings.xAxis) { + return; + } + var e = this.canvases.x.renderTextAt(g, a, c, j - (g ? 2 : 0), this._settings.xAxis.template(h)); + if (e) { + e.className += " dhx_axis_item_x"; + } + }, + _drawXAxisLine: function (c, a, g, e, h) { + if (!this._settings.xAxis || !this._settings.xAxis.lines) { + return; + } + this._drawLine(c, a, g, a, e, this._settings.xAxis.lineColor.call(this, h), 1); + }, + _drawLine: function (a, g, l, e, h, c, j) { + a.strokeStyle = c; + a.lineWidth = j; + a.beginPath(); + a.moveTo(g, l); + a.lineTo(e, h); + a.stroke(); + a.lineWidth = 1; + }, + _getRelativeValue: function (g, h) { + var e, a; + var c = 1; + if (h != g) { + e = h - g; + } else { + e = g; + } + return [e, c]; + }, + _rainbow: [ + function (a) { + return "#FF" + dhtmlx.math.toHex(a / 2, 2) + "00"; + }, + function (a) { + return "#FF" + dhtmlx.math.toHex(a / 2 + 128, 2) + "00"; + }, + function (a) { + return "#" + dhtmlx.math.toHex(255 - a, 2) + "FF00"; + }, + function (a) { + return "#00FF" + dhtmlx.math.toHex(a, 2); + }, + function (a) { + return "#00" + dhtmlx.math.toHex(255 - a, 2) + "FF"; + }, + function (a) { + return "#" + dhtmlx.math.toHex(a, 2) + "00FF"; + }, + ], + addSeries: function (c) { + var a = this._settings; + this._settings = dhtmlx.extend({}, a); + this._parseSettings(c, {}); + this._series.push(this._settings); + this._settings = a; + }, + _switchSerie: function (j, a, h) { + var g; + this._active_serie = this._series.length == 1 ? a.getAttribute("userdata") : this._getActiveSeries(h); + if (!this._series[this._active_serie]) { + return; + } + for (var c = 0; c < this._series.length; c++) { + g = this._series[c].tooltip; + if (g) { + g.disable(); + } + } + if (!a.getAttribute("disabled")) { + g = this._series[this._active_serie].tooltip; + if (g) { + g.enable(); + } + } + }, + _getActiveSeries: function (j) { + var n, c, h, g, m, r, o, l; + c = this._map._areas; + g = dhtmlx.html.offset(this._obj._htmlmap); + m = dhtmlx.html.pos(j); + o = m.x - g.x; + l = m.y - g.y; + for (h = 0; h < c.length; h++) { + n = c[h].points; + if (o <= n[2] && o >= n[0] && l <= n[3] && l >= n[1]) { + if (r) { + if (c[h].index > r.index) { + r = c[h]; + } + } else { + r = c[h]; + } + } + } + return r ? r.index : 0; + }, + hideSeries: function (a) { + this.canvases[a].hideCanvas(); + if (this._settings.legend.values && this._settings.legend.values[a]) { + this._settings.legend.values[a].$hidden = true; + } + this._drawLegend(); + }, + showSeries: function (a) { + this.canvases[a].showCanvas(); + if (this._settings.legend.values && this._settings.legend.values[a]) { + delete this._settings.legend.values[a].$hidden; + } + this._drawLegend(); + }, + _changeColorSV: function (c, h, a) { + var g, e; + e = dhtmlx.math.toRgb(c); + g = dhtmlx.math.rgbToHsv(e[0], e[1], e[2]); + g[1] *= h; + g[2] *= a; + return "rgb(" + dhtmlx.math.hsvToRgb(g[0], g[1], g[2]) + ")"; + }, + _setBorderStyles: function (a, c) { + var g, e; + e = dhtmlx.math.toRgb(c); + g = dhtmlx.math.rgbToHsv(e[0], e[1], e[2]); + g[2] /= 2; + c = "rgb(" + dhtmlx.math.hsvToRgb(g[0], g[1], g[2]) + ")"; + a.strokeStyle = c; + if (a.globalAlpha == 1) { + a.globalAlpha = 0.9; + } + }, + _drawLegend: function (h, c) { + var j, + r, + A, + s, + l, + u, + a, + n = 0, + m = 0, + w, + o, + g, + v; + h = h || []; + c = c || this._obj.offsetWidth; + w = this.canvases.legend.getCanvas(); + r = this._settings.legend; + a = this._settings.legend.layout != "x" ? "width:" + r.width + "px" : ""; + if (this.legendObj) { + this.legendObj.innerHTML = ""; + this.legendObj.parentNode.removeChild(this.legendObj); + } + this.canvases.legend.clearCanvas(true); + A = dhtmlx.html.create("DIV", { class: "dhx_chart_legend", style: "left:" + n + "px; top:" + m + "px;" + a }, ""); + if (r.padding) { + A.style.padding = r.padding + "px"; + } + this.legendObj = A; + this._obj.appendChild(A); + l = []; + if (!r.values) { + for (j = 0; j < h.length; j++) { + l.push(this._drawLegendText(A, r.template(h[j]))); + } + } else { + for (j = 0; j < r.values.length; j++) { + l.push(this._drawLegendText(A, r.values[j].text, typeof r.values[j].id != "undefined" ? typeof r.values[j].id : j, r.values[j].$hidden)); + } + } + u = A.offsetWidth; + s = A.offsetHeight; + if (u < this._obj.offsetWidth) { + if (r.layout == "x" && r.align == "center") { + n = (this._obj.offsetWidth - u) / 2; + } + if (r.align == "right") { + n = this._obj.offsetWidth - u; + } + if (r.margin && r.align != "center") { + n += (r.align == "left" ? 1 : -1) * r.margin; + } + } + if (s < this._obj.offsetHeight) { + if (r.valign == "middle" && r.align != "center" && r.layout != "x") { + m = (this._obj.offsetHeight - s) / 2; + } else { + if (r.valign == "bottom") { + m = this._obj.offsetHeight - s; + } + } + if (r.margin && r.valign != "middle") { + m += (r.valign == "top" ? 1 : -1) * r.margin; + } + } + A.style.left = n + "px"; + A.style.top = m + "px"; + w.save(); + for (j = 0; j < l.length; j++) { + v = l[j]; + if (r.values && r.values[j].$hidden) { + g = true; + o = r.values[j].disableColor ? r.values[j].disableColor : "#d9d9d9"; + } else { + g = false; + o = r.values ? r.values[j].color : this._settings.color.call(this, h[j]); + } + var e = r.marker.position == "right" ? v.offsetWidth - r.marker.width : 0; + this._drawLegendMarker(w, v.offsetLeft + n + e, v.offsetTop + m, o, v.offsetHeight, g, j); + } + w.restore(); + l = null; + }, + _drawLegendText: function (a, j, c, h) { + var g = ""; + var e = this._settings.legend; + if (e.layout == "x") { + g = "float:left;"; + } + var m = e.marker.position; + var l = dhtmlx.html.create("DIV", { style: g + "padding-" + (m && m == "right" ? "right" : "left") + ":" + (10 + e.marker.width) + "px", class: "dhx_chart_legend_item" + (h ? " hidden" : "") }, j); + if (arguments.length > 2) { + l.setAttribute("series_id", c); + } + a.appendChild(l); + return l; + }, + _drawLegendMarker: function (A, s, r, h, w, j, m) { + var c = []; + var l = this._settings.legend.marker; + var v = this._settings.legend.values; + var o = v && v[m].markerType ? v[m].markerType : l.type; + if (h) { + A.fillStyle = h; + A.strokeStyle = this._getDarkenColor(h, 0.75); + } + A.beginPath(); + if (o == "round" || !l.radius) { + A.lineWidth = l.height; + A.lineCap = o; + s += A.lineWidth / 2 + 5; + r += w / 2; + A.moveTo(s, r); + var a = s + l.width - l.height + 1; + A.lineTo(a, r); + } else { + if (o == "item") { + if (this._settings.line && this._settings.view != "scatter" && !this._settings.disableLines) { + A.beginPath(); + A.lineWidth = this._series[m].line.width; + A.strokeStyle = j ? h : this._series[m].line.color.call(this, {}); + var e = s + 5; + var u = r + w / 2; + A.moveTo(e, u); + var a = e + l.width; + A.lineTo(a, u); + A.stroke(); + } + var g = this._series[m].item; + var n = parseInt(g.radius.call(this, {}), 10) || 0; + if (n) { + if (g.type == "image" && g.src) { + this._drawImage(A, s + 5, r + l.height / 2 - 5, g.src, n * 2, n * 2); + return; + } else { + A.beginPath(); + if (j) { + A.lineWidth = g.borderWidth; + A.strokeStyle = h; + A.fillStyle = h; + } else { + A.lineWidth = g.borderWidth; + A.fillStyle = g.color.call(this, {}); + A.strokeStyle = g.borderColor.call(this, {}); + A.globalAlpha = g.alpha.call(this, {}); + } + A.beginPath(); + s += l.width / 2 + 5; + r += w / 2; + this._strokeChartItem(A, s, r, n + 1, g.type); + A.fill(); + A.stroke(); + } + } + A.globalAlpha = 1; + } else { + A.lineWidth = 1; + s += 5; + r += parseInt(w / 2 - l.height / 2, 10); + c = [ + [s + l.radius, r + l.radius, l.radius, Math.PI, (3 * Math.PI) / 2, false], + [s + l.width - l.radius, r], + [s + l.width - l.radius, r + l.radius, l.radius, -Math.PI / 2, 0, false], + [s + l.width, r + l.height - l.radius], + [s + l.width - l.radius, r + l.height - l.radius, l.radius, 0, Math.PI / 2, false], + [s + l.radius, r + l.height], + [s + l.radius, r + l.height - l.radius, l.radius, Math.PI / 2, Math.PI, false], + [s, r + l.radius], + ]; + this._path(A, c); + } + } + A.stroke(); + A.fill(); + }, + _getDarkenColor: function (a, g) { + var e, c; + c = dhtmlx.math.toRgb(a); + e = dhtmlx.math.rgbToHsv(c[0], c[1], c[2]); + e[2] = e[2] * g; + return "rgb(" + dhtmlx.math.hsvToRgb(e[0], e[1], e[2]) + ")"; + }, + _getChartBounds: function (a, l) { + var n, e, m, c; + n = this._settings.padding.left; + e = this._settings.padding.top; + m = a - this._settings.padding.right; + c = l - this._settings.padding.bottom; + if (this._settings.legend) { + var h = this._settings.legend; + var j = this._settings.legend.width; + var g = this._settings.legend.height; + if (h.layout == "x") { + if (h.valign == "center") { + if (h.align == "right") { + m -= j; + } else { + if (h.align == "left") { + n += j; + } + } + } else { + if (h.valign == "bottom") { + c -= g; + } else { + e += g; + } + } + } else { + if (h.align == "right") { + m -= j; + } else { + if (h.align == "left") { + n += j; + } + } + } + } + return { start: { x: n, y: e }, end: { x: m, y: c } }; + }, + _getStackedLimits: function (h) { + var c, a, l, g, e; + if (this._settings.yAxis && typeof this._settings.yAxis.end != "undefined" && typeof this._settings.yAxis.start != "undefined" && this._settings.yAxis.step) { + l = parseFloat(this._settings.yAxis.end); + g = parseFloat(this._settings.yAxis.start); + } else { + for (c = 0; c < h.length; c++) { + h[c].$sum = 0; + h[c].$min = Infinity; + for (a = 0; a < this._series.length; a++) { + e = parseFloat(this._series[a].value(h[c]) || 0); + if (isNaN(e)) { + continue; + } + if (this._series[a].view.toLowerCase().indexOf("stacked") != -1) { + h[c].$sum += e; + } + if (e < h[c].$min) { + h[c].$min = e; + } + } + } + l = -Infinity; + g = Infinity; + for (c = 0; c < h.length; c++) { + if (h[c].$sum > l) { + l = h[c].$sum; + } + if (h[c].$min < g) { + g = h[c].$min; + } + } + if (g > 0) { + g = 0; + } + } + return { max: l, min: g }; + }, + _setBarGradient: function (v, c, r, a, n, m, g, e) { + var o, h, l, j, u, s; + if (m == "light") { + if (e == "x") { + o = v.createLinearGradient(c, r, a, r); + } else { + o = v.createLinearGradient(c, r, c, n); + } + s = [ + [0, "#FFFFFF"], + [0.9, g], + [1, g], + ]; + h = 2; + } else { + if (m == "falling" || m == "rising") { + if (e == "x") { + o = v.createLinearGradient(c, r, a, r); + } else { + o = v.createLinearGradient(c, r, c, n); + } + l = dhtmlx.math.toRgb(g); + j = dhtmlx.math.rgbToHsv(l[0], l[1], l[2]); + j[1] *= 1 / 2; + u = "rgb(" + dhtmlx.math.hsvToRgb(j[0], j[1], j[2]) + ")"; + if (m == "falling") { + s = [ + [0, u], + [0.7, g], + [1, g], + ]; + } else { + if (m == "rising") { + s = [ + [0, g], + [0.3, g], + [1, u], + ]; + } + } + h = 0; + } else { + v.globalAlpha = 0.37; + h = 0; + if (e == "x") { + o = v.createLinearGradient(c, n, c, r); + } else { + o = v.createLinearGradient(c, r, a, r); + } + s = [ + [0, "#9d9d9d"], + [0.3, "#e8e8e8"], + [0.45, "#ffffff"], + [0.55, "#ffffff"], + [0.7, "#e8e8e8"], + [1, "#9d9d9d"], + ]; + } + } + this._gradient(o, s); + return { gradient: o, offset: h }; + }, + _getPositionByAngle: function (e, c, h, g) { + e *= -1; + c = c + Math.cos(e) * g; + h = h - Math.sin(e) * g; + return { x: c, y: h }; + }, + _gradient: function (e, c) { + for (var a = 0; a < c.length; a++) { + e.addColorStop(c[a][0], c[a][1]); + } + }, + _path: function (a, e) { + var c, g; + for (c = 0; c < e.length; c++) { + g = c ? "lineTo" : "moveTo"; + if (e[c].length > 2) { + g = "arc"; + } + a[g].apply(a, e[c]); + } + }, + _circle: function (c, a, g, e) { + c.arc(a, g, e, Math.PI * 2, true); + }, + _addMapRect: function (g, h, a, e, c) { + g.addRect(h, [a[0].x - e.x, a[0].y - e.y, a[1].x - e.x, a[1].y - e.y], c); + }, +}; +dhtmlx.compat("layout"); +if (typeof window.dhtmlXCellObject != "undefined") { + dhtmlXCellObject.prototype.attachChart = function (a) { + this.callEvent("_onBeforeContentAttach", ["chart"]); + var c = document.createElement("DIV"); + c.id = "dhxChartObj_" + window.dhx4.newId(); + c.style.width = "100%"; + c.style.height = "100%"; + document.body.appendChild(c); + this._attachObject(c); + a.container = c.id; + this.dataType = "chart"; + this.dataObj = new dhtmlXChart(a); + if (!this.dataObj.setSizes) { + this.dataObj.setSizes = function () { + if (this.resize) { + this.resize(); + } else { + this.render(); + } + }; + } + return this.dataObj; + }; +} +dhtmlx.ui.pager = function (a) { + this.name = "Pager"; + if (dhtmlx.assert_enabled()) { + this._assert(); + } + dhtmlx.extend(this, dhtmlx.Settings); + this._parseContainer(a, "dhx_pager"); + dhtmlx.extend(this, dhtmlx.EventSystem); + dhtmlx.extend(this, dhtmlx.SingleRender); + dhtmlx.extend(this, dhtmlx.MouseEvents); + this._parseSettings(a, { size: 10, page: -1, group: 5, count: 0, type: "default" }); + this.data = this._settings; + this.refresh(); +}; +dhtmlx.ui.pager.prototype = { + _id: "dhx_p_id", + on_click: { + dhx_pager_item: function (a, c) { + this.select(c); + }, + }, + select: function (a) { + switch (a) { + case "next": + a = this._settings.page + 1; + break; + case "prev": + a = this._settings.page - 1; + break; + case "first": + a = 0; + break; + case "last": + a = this._settings.limit - 1; + break; + default: + break; + } + if (a < 0) { + a = 0; + } + if (a >= this.data.limit) { + a = this.data.limit - 1; + } + if (this.callEvent("onBeforePageChange", [this._settings.page, a])) { + this.data.page = a * 1; + this.refresh(); + this.callEvent("onAfterPageChange", [a]); + } + }, + types: { + default: { + template: dhtmlx.Template.fromHTML("{common.pages()}"), + pages: function (e) { + var c = ""; + if (e.page == -1) { + return ""; + } + e.min = e.page - Math.round((e.group - 1) / 2); + e.max = e.min + e.group - 1; + if (e.min < 0) { + e.max += e.min * -1; + e.min = 0; + } + if (e.max >= e.limit) { + e.min -= Math.min(e.min, e.max - e.limit + 1); + e.max = e.limit - 1; + } + for (var a = e.min || 0; a <= e.max; a++) { + c += this.button({ id: a, index: a + 1, selected: a == e.page ? "_selected" : "" }); + } + return c; + }, + page: function (a) { + return a.page + 1; + }, + first: function () { + return this.button({ id: "first", index: " << ", selected: "" }); + }, + last: function () { + return this.button({ id: "last", index: " >> ", selected: "" }); + }, + prev: function () { + return this.button({ id: "prev", index: "<", selected: "" }); + }, + next: function () { + return this.button({ id: "next", index: ">", selected: "" }); + }, + button: dhtmlx.Template.fromHTML("
{obj.index}
"), + }, + }, + refresh: function () { + var a = this._settings; + a.limit = Math.ceil(a.count / a.size); + if (a.limit && a.limit != a.old_limit) { + a.page = Math.min(a.limit - 1, a.page); + } + var c = a.page; + if ((c != -1 && c != a.old_page) || a.limit != a.old_limit) { + this.render(); + this.callEvent("onRefresh", []); + a.old_limit = a.limit; + a.old_page = a.page; + } + }, + template_item_start: dhtmlx.Template.fromHTML("
"), + template_item_end: dhtmlx.Template.fromHTML("
"), +}; +dhtmlx.DataProcessor = { + _dp_init: function (c) { + var a = "_methods"; + c[a] = ["setItemStyle", "", "changeId", "remove"]; + this.attachEvent("onAfterAdd", function (e) { + c.setUpdated(e, true, "inserted"); + }); + this.data.attachEvent( + "onStoreLoad", + dhtmlx.bind(function (g, e) { + if (g.getUserData) { + g.getUserData(e, this._userdata); + } + }, this) + ); + this.attachEvent("onBeforeDelete", function (g) { + if (c._silent_mode) { + return true; + } + var e = c.getState(g); + if (e == "inserted") { + c.setUpdated(g, false); + return true; + } + if (e == "deleted") { + return false; + } + if (e == "true_deleted") { + return true; + } + c.setUpdated(g, true, "deleted"); + return false; + }); + this.attachEvent("onAfterEditStop", function (e) { + c.setUpdated(e, true, "updated"); + }); + this.attachEvent("onBindUpdate", function (e) { + window.setTimeout(function () { + c.setUpdated(e.id, true, "updated"); + }, 1); + }); + a = "_getRowData"; + c[a] = function (l, e) { + var h = this.obj.data.get(l); + var j = {}; + for (var g in h) { + if (g.indexOf("_") === 0) { + continue; + } + j[g] = h[g]; + } + return j; + }; + a = "_clearUpdateFlag"; + c[a] = function () {}; + this._userdata = {}; + c.attachEvent("insertCallback", this._dp_callback); + c.attachEvent("updateCallback", this._dp_callback); + c.attachEvent("deleteCallback", function (e, g) { + this.obj.setUserData(g, this.action_param, "true_deleted"); + this.obj.remove(g); + }); + dhtmlx.compat("dataProcessor", c); + }, + _dp_callback: function (a, c) { + this.obj.data.set(c, dhtmlx.DataDriver.xml.getDetails(a.firstChild)); + this.obj.data.refresh(c); + }, + setItemStyle: function (e, a) { + var c = this._locateHTML(e); + if (c) { + c.style.cssText += ";" + a; + } + }, + changeId: function (c, a) { + this.data.changeId(c, a); + this.refresh(); + }, + setUserData: function (e, a, c) { + if (e) { + this.data.get(e)[a] = c; + } else { + this._userdata[a] = c; + } + }, + getUserData: function (c, a) { + return c ? this.data.get(c)[a] : this._userdata[a]; + }, +}; +(function () { + var a = "_dp_init"; + dhtmlx.DataProcessor[a] = dhtmlx.DataProcessor._dp_init; +})(); +dhtmlx.compat.dnd = function () { + if (window.dhtmlDragAndDropObject) { + var m = "_dragged"; + var g = dhtmlDragAndDropObject.prototype.checkLanding; + dhtmlDragAndDropObject.prototype.checkLanding = function (o, r, n) { + g.apply(this, arguments); + if (!n) { + var s = (dhtmlx.DragControl._drag_context = dhtmlx.DragControl._drag_context || {}); + if (!s.from) { + s.from = this.dragStartObject; + } + dhtmlx.DragControl._checkLand(o, r, true); + } + }; + var c = dhtmlDragAndDropObject.prototype.stopDrag; + dhtmlDragAndDropObject.prototype.stopDrag = function (r, n, o) { + if (!o) { + if (dhtmlx.DragControl._last) { + dhtmlx.DragControl._active = l.dragStartNode; + dhtmlx.DragControl._stopDrag(r, true); + } + } + c.apply(this, arguments); + }; + var l = new dhtmlDragAndDropObject(); + var h = dhtmlx.DragControl._startDrag; + dhtmlx.DragControl._startDrag = function () { + h.apply(this, arguments); + var s = dhtmlx.DragControl._drag_context; + if (!s) { + return; + } + var r = []; + var o = []; + for (var n = 0; n < s.source.length; n++) { + r[n] = { idd: s.source[n] }; + o.push(s.source[n]); + } + l.dragStartNode = { parentNode: {}, parentObject: { idd: r, id: o.length == 1 ? o[0] : o, treeNod: { object: s.from } } }; + l.dragStartNode.parentObject.treeNod[m] = r; + l.dragStartObject = s.from; + }; + var j = dhtmlx.DragControl._checkLand; + dhtmlx.DragControl._checkLand = function (o, r, n) { + j.apply(this, arguments); + if (!this._last && !n) { + o = l.checkLanding(o, r, true); + } + }; + var a = dhtmlx.DragControl._stopDrag; + dhtmlx.DragControl._stopDrag = function (o, n) { + a.apply(this, arguments); + if (l.lastLanding && !n) { + l.stopDrag(o, false, true); + } + }; + var e = dhtmlx.DragControl.getMaster; + dhtmlx.DragControl.getMaster = function (o) { + var r = null; + if (o) { + r = e.apply(this, arguments); + } + if (!r) { + r = l.dragStartObject; + var s = []; + var u = r[m]; + for (var n = 0; n < u.length; n++) { + s.push(u[n].idd || u[n].id); + } + dhtmlx.DragControl._drag_context.source = s; + } + return r; + }; + } +}; +dhtmlx.DataMove = { + _init: function () { + dhtmlx.assert(this.data, "DataMove :: Component doesn't have DataStore"); + }, + copy: function (c, h, a, g) { + var e = this.get(c); + if (!e) { + dhtmlx.log("Warning", "Incorrect ID in DataMove::copy"); + return; + } + if (a) { + dhtmlx.assert(a.externalData, "DataMove :: External object doesn't support operation"); + e = a.externalData(e); + } + a = a || this; + return a.add(a.externalData(e, g), h); + }, + move: function (e, l, c, j) { + if (e instanceof Array) { + for (var g = 0; g < e.length; g++) { + var a = (c || this).indexById(this.move(e[g], l, c, e[g])); + if (e[g + 1]) { + l = a + (this.indexById(e[g + 1]) < a ? 0 : 1); + } + } + return; + } + nid = e; + if (l < 0) { + dhtmlx.log("Info", "DataMove::move - moving outside of bounds is ignored"); + return; + } + var h = this.get(e); + if (!h) { + dhtmlx.log("Warning", "Incorrect ID in DataMove::move"); + return; + } + if (!c || c == this) { + this.data.move(this.indexById(e), l); + } else { + dhtmlx.assert(c.externalData, "DataMove :: External object doesn't support operation"); + nid = c.add(c.externalData(h, j), l); + this.remove(e); + } + return nid; + }, + moveUp: function (c, a) { + return this.move(c, this.indexById(c) - (a || 1)); + }, + moveDown: function (c, a) { + return this.moveUp(c, (a || 1) * -1); + }, + moveTop: function (a) { + return this.move(a, 0); + }, + moveBottom: function (a) { + return this.move(a, this.data.dataCount() - 1); + }, + externalData: function (a, e) { + var c = dhtmlx.extend({}, a); + c.id = e || dhtmlx.uid(); + c.$selected = c.$template = null; + return c; + }, +}; +dhtmlx.DragControl = { + _drag_masters: dhtmlx.toArray(["dummy"]), + addDrop: function (c, e, a) { + c = dhtmlx.toNode(c); + c.dhx_drop = this._getCtrl(e); + if (a) { + c.dhx_master = true; + } + }, + _getCtrl: function (c) { + c = c || dhtmlx.DragControl; + var a = this._drag_masters.find(c); + if (a < 0) { + a = this._drag_masters.length; + this._drag_masters.push(c); + } + return a; + }, + addDrag: function (a, c) { + a = dhtmlx.toNode(a); + a.dhx_drag = this._getCtrl(c); + dhtmlx.event(a, "mousedown", this._preStart, a); + }, + _preStart: function (a) { + if (dhtmlx.DragControl._active) { + dhtmlx.DragControl._preStartFalse(); + dhtmlx.DragControl.destroyDrag(); + } + dhtmlx.DragControl._active = this; + dhtmlx.DragControl._start_pos = { x: a.pageX, y: a.pageY }; + dhtmlx.DragControl._dhx_drag_mm = dhtmlx.event(document.body, "mousemove", dhtmlx.DragControl._startDrag); + dhtmlx.DragControl._dhx_drag_mu = dhtmlx.event(document.body, "mouseup", dhtmlx.DragControl._preStartFalse); + dhtmlx.DragControl._dhx_drag_sc = dhtmlx.event(this, "scroll", dhtmlx.DragControl._preStartFalse); + a.cancelBubble = true; + return false; + }, + _preStartFalse: function (a) { + dhtmlx.DragControl._dhx_drag_mm = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mm); + dhtmlx.DragControl._dhx_drag_mu = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mu); + dhtmlx.DragControl._dhx_drag_sc = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_sc); + }, + _startDrag: function (a) { + var c = { x: a.pageX, y: a.pageY }; + if (Math.abs(c.x - dhtmlx.DragControl._start_pos.x) < 5 && Math.abs(c.y - dhtmlx.DragControl._start_pos.y) < 5) { + return; + } + dhtmlx.DragControl._preStartFalse(); + if (!dhtmlx.DragControl.createDrag(a)) { + return; + } + dhtmlx.DragControl.sendSignal("start"); + dhtmlx.DragControl._dhx_drag_mm = dhtmlx.event(document.body, "mousemove", dhtmlx.DragControl._moveDrag); + dhtmlx.DragControl._dhx_drag_mu = dhtmlx.event(document.body, "mouseup", dhtmlx.DragControl._stopDrag); + dhtmlx.DragControl._moveDrag(a); + }, + _stopDrag: function (a) { + dhtmlx.DragControl._dhx_drag_mm = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mm); + dhtmlx.DragControl._dhx_drag_mu = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mu); + if (dhtmlx.DragControl._last) { + dhtmlx.DragControl.onDrop(dhtmlx.DragControl._active, dhtmlx.DragControl._last, this._landing, a); + dhtmlx.DragControl.onDragOut(dhtmlx.DragControl._active, dhtmlx.DragControl._last, null, a); + } + dhtmlx.DragControl.destroyDrag(); + dhtmlx.DragControl.sendSignal("stop"); + }, + _moveDrag: function (a) { + var c = dhtmlx.html.pos(a); + dhtmlx.DragControl._html.style.top = c.y + dhtmlx.DragControl.top + "px"; + dhtmlx.DragControl._html.style.left = c.x + dhtmlx.DragControl.left + "px"; + if (dhtmlx.DragControl._skip) { + dhtmlx.DragControl._skip = false; + } else { + dhtmlx.DragControl._checkLand(a.srcElement || a.target, a); + } + a.cancelBubble = true; + return false; + }, + _checkLand: function (a, c) { + while (a && a.tagName != "BODY") { + if (a.dhx_drop) { + if (this._last && (this._last != a || a.dhx_master)) { + this.onDragOut(this._active, this._last, a, c); + } + if (!this._last || this._last != a || a.dhx_master) { + this._last = null; + this._landing = this.onDragIn(dhtmlx.DragControl._active, a, c); + if (this._landing) { + this._last = a; + } + return; + } + return; + } + a = a.parentNode; + } + if (this._last) { + this._last = this._landing = this.onDragOut(this._active, this._last, null, c); + } + }, + sendSignal: function (a) { + dhtmlx.DragControl.active = a == "start"; + }, + getMaster: function (a) { + return this._drag_masters[a.dhx_drag || a.dhx_drop]; + }, + getContext: function (a) { + return this._drag_context; + }, + createDrag: function (j) { + var g = dhtmlx.DragControl._active; + var h = this._drag_masters[g.dhx_drag]; + var c; + if (h.onDragCreate) { + c = h.onDragCreate(g, j); + c.style.position = "absolute"; + c.style.zIndex = dhtmlx.zIndex.drag; + c.onmousemove = dhtmlx.DragControl._skip_mark; + } else { + var l = dhtmlx.DragControl.onDrag(g, j); + if (!l) { + return false; + } + var c = document.createElement("DIV"); + c.innerHTML = l; + c.className = "dhx_drag_zone"; + c.onmousemove = dhtmlx.DragControl._skip_mark; + document.body.appendChild(c); + } + dhtmlx.DragControl._html = c; + return true; + }, + _skip_mark: function () { + dhtmlx.DragControl._skip = true; + }, + destroyDrag: function () { + var c = dhtmlx.DragControl._active; + var e = this._drag_masters[c.dhx_drag]; + if (e && e.onDragDestroy) { + e.onDragDestroy(c, dhtmlx.DragControl._html); + } else { + dhtmlx.html.remove(dhtmlx.DragControl._html); + } + dhtmlx.DragControl._landing = dhtmlx.DragControl._active = dhtmlx.DragControl._last = dhtmlx.DragControl._html = null; + }, + top: 5, + left: 5, + onDragIn: function (g, c, h) { + var a = this._drag_masters[c.dhx_drop]; + if (a.onDragIn && a != this) { + return a.onDragIn(g, c, h); + } + c.className = c.className + " dhx_drop_zone"; + return c; + }, + onDragOut: function (g, c, j, h) { + var a = this._drag_masters[c.dhx_drop]; + if (a.onDragOut && a != this) { + return a.onDragOut(g, c, j, h); + } + c.className = c.className.replace("dhx_drop_zone", ""); + return null; + }, + onDrop: function (g, c, j, h) { + var a = this._drag_masters[c.dhx_drop]; + dhtmlx.DragControl._drag_context.from = dhtmlx.DragControl.getMaster(g); + if (a.onDrop && a != this) { + return a.onDrop(g, c, j, h); + } + c.appendChild(g); + }, + onDrag: function (c, g) { + var a = this._drag_masters[c.dhx_drag]; + if (a.onDrag && a != this) { + return a.onDrag(c, g); + } + dhtmlx.DragControl._drag_context = { source: c, from: c }; + return "
" + c.innerHTML + "
"; + }, +}; +dhtmlx.DragItem = { + _init: function () { + dhtmlx.assert(this.move, "DragItem :: Component doesn't have DataMove interface"); + dhtmlx.assert(this.locate, "DragItem :: Component doesn't have RenderStack interface"); + dhtmlx.assert(dhtmlx.DragControl, "DragItem :: DragControl is not included"); + if (!this._settings || this._settings.drag) { + dhtmlx.DragItem._initHandlers(this); + } else { + if (this._settings) { + this.drag_setter = function (a) { + if (a) { + this._initHandlers(this); + delete this.drag_setter; + } + return a; + }; + } + } + if (this.dragMarker) { + this.attachEvent("onBeforeDragIn", this.dragMarker); + this.attachEvent("onDragOut", this.dragMarker); + } + }, + _initHandlers: function (a) { + dhtmlx.DragControl.addDrop(a._obj, a, true); + dhtmlx.DragControl.addDrag(a._obj, a); + }, + onDragIn: function (h, g, j) { + var m = this.locate(j) || null; + var c = dhtmlx.DragControl._drag_context; + var l = dhtmlx.DragControl.getMaster(h); + var a = this._locateHTML(m) || this._obj; + if (a == dhtmlx.DragControl._landing) { + return a; + } + c.target = m; + c.to = l; + if (!this.callEvent("onBeforeDragIn", [c, j])) { + c.id = null; + return null; + } + dhtmlx.html.addCss(a, "dhx_drag_over"); + return a; + }, + onDragOut: function (h, g, m, j) { + var l = this.locate(j) || null; + if (m != this._dataobj) { + l = null; + } + var c = this._locateHTML(l) || (m ? dhtmlx.DragControl.getMaster(m)._obj : window.undefined); + if (c == dhtmlx.DragControl._landing) { + return null; + } + var a = dhtmlx.DragControl._drag_context; + dhtmlx.html.removeCss(dhtmlx.DragControl._landing, "dhx_drag_over"); + a.target = a.to = null; + this.callEvent("onDragOut", [a, j]); + return null; + }, + onDrop: function (g, c, j, h) { + var a = dhtmlx.DragControl._drag_context; + a.to = this; + a.index = a.target ? this.indexById(a.target) : this.dataCount(); + a.new_id = dhtmlx.uid(); + if (!this.callEvent("onBeforeDrop", [a, h])) { + return; + } + if (a.from == a.to) { + this.move(a.source, a.index); + } else { + if (a.from) { + a.from.move(a.source, a.index, a.to, a.new_id); + } else { + dhtmlx.error("Unsopported d-n-d combination"); + } + } + this.callEvent("onAfterDrop", [a, h]); + }, + onDrag: function (g, j) { + var l = this.locate(j); + var h = [l]; + if (l) { + if (this.getSelected) { + var c = this.getSelected(); + if (dhtmlx.PowerArray.find.call(c, l) != -1) { + h = c; + } + } + var a = (dhtmlx.DragControl._drag_context = { source: h, start: l }); + a.from = this; + if (this.callEvent("onBeforeDrag", [a, j])) { + return a.html || this._toHTML(this.get(l)); + } + } + return null; + }, +}; +dhtmlx.EditAbility = { + _init: function (a) { + this._edit_id = null; + this._edit_bind = null; + dhtmlx.assert(this.data, "EditAbility :: Component doesn't have DataStore"); + dhtmlx.assert(this._locateHTML, "EditAbility :: Component doesn't have RenderStack"); + this.attachEvent("onEditKeyPress", function (e, g, c) { + if (e == 13 && !c) { + this.stopEdit(); + } else { + if (e == 27) { + this.stopEdit(true); + } + } + }); + this.attachEvent("onBeforeRender", function () { + this.stopEdit(); + }); + }, + isEdit: function () { + return this._edit_id; + }, + edit: function (c) { + if (this.stopEdit(false, c)) { + if (!this.callEvent("onBeforeEditStart", [c])) { + return; + } + var a = this.data.get(c); + if (a.$template) { + return; + } + a.$template = "edit"; + this.data.refresh(c); + this._edit_id = c; + this._save_binding(c); + this._edit_bind(true, a); + this.callEvent("onAfterEditStart", [c]); + } + }, + stopEdit: function (e, h) { + if (!this._edit_id) { + return true; + } + if (this._edit_id == h) { + return false; + } + var a = {}; + if (!e) { + this._edit_bind(false, a); + } else { + a = null; + } + if (!this.callEvent("onBeforeEditStop", [this._edit_id, a])) { + return false; + } + var c = this.data.get(this._edit_id); + c.$template = null; + if (!e) { + this._edit_bind(false, c); + } + var g = this._edit_id; + this._edit_bind = this._edit_id = null; + this.data.refresh(g); + this.callEvent("onAfterEditStop", [g, a]); + return true; + }, + _save_binding: function (m) { + var a = this._locateHTML(m); + var e = ""; + var j = ""; + var h = []; + if (a) { + var g = a.getElementsByTagName("*"); + var l = ""; + for (var c = 0; c < g.length; c++) { + if (g[c].nodeType == 1 && (l = g[c].getAttribute("bind"))) { + e += "els[" + h.length + "].value=" + l + ";"; + j += l + "=els[" + h.length + "].value;"; + h.push(g[c]); + g[c].className += " dhx_allow_selection"; + g[c].onselectstart = this._block_native; + } + } + g = null; + } + e = Function("obj", "els", e); + j = Function("obj", "els", j); + this._edit_bind = function (o, n) { + if (o) { + e(n, h); + if (h.length && h[0].select) { + h[0].select(); + } + } else { + j(n, h); + } + }; + }, + _block_native: function (a) { + (a || event).cancelBubble = true; + return true; + }, +}; +dhtmlx.SelectionModel = { + _init: function () { + this._selected = dhtmlx.toArray(); + dhtmlx.assert(this.data, "SelectionModel :: Component doesn't have DataStore"); + this.data.attachEvent("onStoreUpdated", dhtmlx.bind(this._data_updated, this)); + this.data.attachEvent("onStoreLoad", dhtmlx.bind(this._data_loaded, this)); + this.data.attachEvent("onAfterFilter", dhtmlx.bind(this._data_filtered, this)); + this.data.attachEvent("onIdChange", dhtmlx.bind(this._id_changed, this)); + }, + _id_changed: function (e, a) { + for (var c = this._selected.length - 1; c >= 0; c--) { + if (this._selected[c] == e) { + this._selected[c] = a; + } + } + }, + _data_filtered: function () { + for (var a = this._selected.length - 1; a >= 0; a--) { + if (this.data.indexById(this._selected[a]) < 0) { + var e = this._selected[a]; + var c = this.item(e); + if (c) { + delete c.$selected; + } + this._selected.splice(a, 1); + this.callEvent("onSelectChange", [e]); + } + } + }, + _data_updated: function (e, c, a) { + if (a == "delete") { + this._selected.remove(e); + } else { + if (!this.data.dataCount() && !this.data._filter_order) { + this._selected = dhtmlx.toArray(); + } + } + }, + _data_loaded: function () { + if (this._settings.select) { + this.data.each(function (a) { + if (a.$selected) { + this.select(a.id); + } + }, this); + } + }, + _select_mark: function (e, c, a) { + if (!a && !this.callEvent("onBeforeSelect", [e, c])) { + return false; + } + this.data.item(e).$selected = c; + if (a) { + a.push(e); + } else { + if (c) { + this._selected.push(e); + } else { + this._selected.remove(e); + } + this._refresh_selection(e); + } + return true; + }, + select: function (g, e, a) { + if (!g) { + return this.selectAll(); + } + if (g instanceof Array) { + for (var c = 0; c < g.length; c++) { + this.select(g[c], e, a); + } + return; + } + if (!this.data.exists(g)) { + dhtmlx.error("Incorrect id in select command: " + g); + return; + } + if (a && this._selected.length) { + return this.selectAll(this._selected[this._selected.length - 1], g); + } + if (!e && (this._selected.length != 1 || this._selected[0] != g)) { + this._silent_selection = true; + this.unselectAll(); + this._silent_selection = false; + } + if (this.isSelected(g)) { + if (e) { + this.unselect(g); + } + return; + } + if (this._select_mark(g, true)) { + this.callEvent("onAfterSelect", [g]); + } + }, + unselect: function (a) { + if (!a) { + return this.unselectAll(); + } + if (!this.isSelected(a)) { + return; + } + this._select_mark(a, false); + }, + selectAll: function (g, e) { + var a; + var c = []; + if (g || e) { + a = this.data.getRange(g || null, e || null); + } else { + a = this.data.getRange(); + } + a.each(function (h) { + var j = this.data.item(h.id); + if (!j.$selected) { + this._selected.push(h.id); + this._select_mark(h.id, true, c); + } + return h.id; + }, this); + this._refresh_selection(c); + }, + unselectAll: function () { + var a = []; + this._selected.each(function (c) { + this._select_mark(c, false, a); + }, this); + this._selected = dhtmlx.toArray(); + this._refresh_selection(a); + }, + isSelected: function (a) { + return this._selected.find(a) != -1; + }, + getSelected: function (a) { + switch (this._selected.length) { + case 0: + return a ? [] : ""; + case 1: + return a ? [this._selected[0]] : this._selected[0]; + default: + return [].concat(this._selected); + } + }, + _is_mass_selection: function (a) { + return a.length > 100 || a.length > this.data.dataCount / 2; + }, + _refresh_selection: function (c) { + if (typeof c != "object") { + c = [c]; + } + if (!c.length) { + return; + } + if (this._is_mass_selection(c)) { + this.data.refresh(); + } else { + for (var a = 0; a < c.length; a++) { + this.render(c[a], this.data.item(c[a]), "update"); + } + } + if (!this._silent_selection) { + this.callEvent("onSelectChange", [c]); + } + }, +}; +dhtmlx.RenderStack = { + _init: function () { + dhtmlx.assert(this.data, "RenderStack :: Component doesn't have DataStore"); + dhtmlx.assert(dhtmlx.Template, "dhtmlx.Template :: dhtmlx.Template is not accessible"); + this._html = document.createElement("DIV"); + }, + _toHTML: function (a) { + dhtmlx.assert(!a.$template || this.type["template_" + a.$template], "RenderStack :: Unknown template: " + a.$template); + this.callEvent("onItemRender", [a]); + return this.type._item_start(a, this.type) + (a.$template ? this.type["template_" + a.$template] : this.type.template)(a, this.type) + this.type._item_end; + }, + _toHTMLObject: function (a) { + this._html.innerHTML = this._toHTML(a); + return this._html.firstChild; + }, + _locateHTML: function (a) { + if (this._htmlmap) { + return this._htmlmap[a]; + } + this._htmlmap = {}; + var e = this._dataobj.childNodes; + for (var c = 0; c < e.length; c++) { + var g = e[c].getAttribute(this._id); + if (g) { + this._htmlmap[g] = e[c]; + } + } + return this._locateHTML(a); + }, + locate: function (a) { + return dhtmlx.html.locate(a, this._id); + }, + show: function (c) { + var a = this._locateHTML(c); + if (a) { + this._dataobj.scrollTop = a.offsetTop - this._dataobj.offsetTop; + } + }, + render: function (j, g, e, h) { + if (j) { + var a = this._locateHTML(j); + switch (e) { + case "update": + if (!a) { + return; + } + var c = (this._htmlmap[j] = this._toHTMLObject(g)); + dhtmlx.html.insertBefore(c, a); + dhtmlx.html.remove(a); + break; + case "delete": + if (!a) { + return; + } + dhtmlx.html.remove(a); + delete this._htmlmap[j]; + break; + case "add": + var c = (this._htmlmap[j] = this._toHTMLObject(g)); + dhtmlx.html.insertBefore(c, this._locateHTML(this.data.next(j)), this._dataobj); + break; + case "move": + this.render(j, g, "delete"); + this.render(j, g, "add"); + break; + default: + dhtmlx.error("Unknown render command: " + e); + break; + } + } else { + if (this.callEvent("onBeforeRender", [this.data])) { + this._dataobj.innerHTML = this.data.getRange().map(this._toHTML, this).join(""); + this._htmlmap = null; + } + } + this.callEvent("onAfterRender", []); + }, + pager_setter: function (c) { + this.attachEvent("onBeforeRender", function () { + var g = this._settings.pager._settings; + if (g.page == -1) { + return false; + } + this.data.min = g.page * g.size; + this.data.max = (g.page + 1) * g.size - 1; + return true; + }); + var a = new dhtmlx.ui.pager(c); + var e = dhtmlx.bind(function () { + this.data.refresh(); + }, this); + a.attachEvent("onRefresh", e); + this.data.attachEvent("onStoreUpdated", function (h) { + var g = this.dataCount(); + if (g != a._settings.count) { + a._settings.count = g; + if (a._settings.page == -1) { + a._settings.page = 0; + } + a.refresh(); + } + }); + return a; + }, + height_setter: function (a) { + if (a == "auto") { + this.attachEvent("onAfterRender", this._correct_height); + dhtmlx.event(window, "resize", dhtmlx.bind(this._correct_height, this)); + } + return a; + }, + _correct_height: function () { + this._dataobj.style.overflow = "hidden"; + this._dataobj.style.height = "1px"; + var a = this._dataobj.scrollHeight; + this._dataobj.style.height = a + "px"; + if (dhtmlx._isFF) { + var c = this._dataobj.scrollHeight; + if (c != a) { + this._dataobj.style.height = c + "px"; + } + } + this._obj.style.height = this._dataobj.style.height; + }, + _getDimension: function () { + var a = this.type; + var c = (a.border || 0) + (a.padding || 0) * 2 + (a.margin || 0) * 2; + return { x: a.width + c, y: a.height + c }; + }, + x_count_setter: function (c) { + var e = this._getDimension(); + var a = dhtmlx.$customScroll ? 0 : 18; + this._dataobj.style.width = e.x * c + (this._settings.height != "auto" ? a : 0) + "px"; + return c; + }, + y_count_setter: function (a) { + var c = this._getDimension(); + this._dataobj.style.height = c.y * a + "px"; + return a; + }, +}; +dhtmlx.VirtualRenderStack = { + _init: function () { + dhtmlx.assert(this.render, "VirtualRenderStack :: Object must use RenderStack first"); + this._htmlmap = {}; + this._dataobj.style.overflowY = "scroll"; + dhtmlx.event(this._dataobj, "scroll", dhtmlx.bind(this._render_visible_rows, this)); + dhtmlx.event( + window, + "resize", + dhtmlx.bind(function () { + this.render(); + }, this) + ); + this.data._unrendered_area = []; + this.data.getIndexRange = this._getIndexRange; + }, + _locateHTML: function (a) { + return this._htmlmap[a]; + }, + show: function (e) { + range = this._getVisibleRange(); + var c = this.data.indexById(e); + var a = Math.floor(c / range._dx) * range._y; + this._dataobj.scrollTop = a; + }, + _getIndexRange: function (h, g) { + if (g !== 0) { + g = Math.min(g || Infinity, this.dataCount() - 1); + } + var a = dhtmlx.toArray(); + for (var c = h || 0; c <= g; c++) { + var e = this.item(this.order[c]); + if (this.order.length > c) { + if (!e) { + this.order[c] = dhtmlx.uid(); + e = { id: this.order[c], $template: "loading" }; + this._unrendered_area.push(this.order[c]); + } else { + if (e.$template == "loading") { + this._unrendered_area.push(this.order[c]); + } + } + a.push(e); + } + } + return a; + }, + render: function (j, g, e, h) { + if (j) { + var a = this._locateHTML(j); + switch (e) { + case "update": + if (!a) { + return; + } + var c = (this._htmlmap[j] = this._toHTMLObject(g)); + dhtmlx.html.insertBefore(c, a); + dhtmlx.html.remove(a); + break; + default: + this._render_delayed(); + break; + } + } else { + if (this.callEvent("onBeforeRender", [this.data])) { + this._htmlmap = {}; + this._render_visible_rows(null, true); + this._wait_for_render = false; + this.callEvent("onAfterRender", []); + } + } + }, + _render_delayed: function () { + if (this._wait_for_render) { + return; + } + this._wait_for_render = true; + window.setTimeout( + dhtmlx.bind(function () { + this.render(); + }, this), + 1 + ); + }, + _create_placeholder: function (a) { + var c = document.createElement("DIV"); + c.className = "dhxdataview_placeholder"; + c.style.cssText = "height:" + a + "px; width:100%; overflow:hidden;"; + return c; + }, + _render_visible_rows: function (A, E) { + this.data._unrendered_area = []; + var y = this._getVisibleRange(); + if (!this._dataobj.firstChild || E) { + this._dataobj.innerHTML = ""; + this._dataobj.appendChild(this._create_placeholder(y._max)); + this._htmlrows = [this._dataobj.firstChild]; + } + var j = Math.max(y._from, 0); + var x = this.data.max || this.data.max === 0 ? this.data.max : Infinity; + while (j <= y._height) { + while (this._htmlrows[j] && this._htmlrows[j]._filled && j <= y._height) { + j++; + } + if (j > y._height) { + break; + } + var n = j; + while (!this._htmlrows[n]) { + n--; + } + var a = this._htmlrows[n]; + var g = j * y._dx + (this.data.min || 0); + if (g > x) { + break; + } + var l = Math.min(g + y._dx - 1, x); + var r = this._create_placeholder(y._y); + var m = this.data.getIndexRange(g, l); + if (!m.length) { + break; + } + r.innerHTML = m.map(this._toHTML, this).join(""); + for (var v = 0; v < m.length; v++) { + this._htmlmap[this.data.idByIndex(g + v)] = r.childNodes[v]; + } + var w = parseInt(a.style.height, 10); + var D = (j - n) * y._y; + var u = w - D - y._y; + dhtmlx.html.insertBefore(r, D ? a.nextSibling : a, this._dataobj); + this._htmlrows[j] = r; + r._filled = true; + if (D <= 0 && u > 0) { + a.style.height = u + "px"; + this._htmlrows[j + 1] = a; + } else { + if (D < 0) { + dhtmlx.html.remove(a); + } else { + a.style.height = D + "px"; + } + if (u > 0) { + var o = (this._htmlrows[j + 1] = this._create_placeholder(u)); + dhtmlx.html.insertBefore(o, r.nextSibling, this._dataobj); + } + } + j++; + } + if (this.data._unrendered_area.length) { + var s = this.indexById(this.data._unrendered_area[0]); + var c = this.indexById(this.data._unrendered_area.pop()) + 1; + if (c > s) { + if (!this.callEvent("onDataRequest", [s, c - s])) { + return false; + } + dhtmlx.assert(this.data.feed, "Data feed is missed"); + this.data.feed.call(this, s, c - s); + } + } + if (dhtmlx._isIE) { + var C = this._getVisibleRange(); + if (C._from != y._from) { + this._render_visible_rows(); + } + } + }, + _getVisibleRange: function () { + var c = dhtmlx.$customScroll ? 0 : 18; + var l = this._dataobj.scrollTop; + var a = this._dataobj.scrollWidth; + var m = this._dataobj.offsetHeight; + var o = this.type; + var g = this._getDimension(); + var r = Math.floor(a / g.x) || 1; + var e = Math.floor(l / g.y); + var n = Math.ceil((m + l) / g.y) - 1; + var h = this.data.max ? this.data.max - this.data.min : this.data.dataCount(); + var j = Math.ceil(h / r) * g.y; + return { _from: e, _height: n, _top: l, _max: j, _y: g.y, _dx: r }; + }, +}; +dhtmlXDataView = function (a) { + this.name = "DataView"; + if (dhtmlx.assert_enabled()) { + this._assert(); + } + dhtmlx.extend(this, dhtmlx.Settings); + this._parseContainer(a, "dhx_dataview"); + dhtmlx.extend(this, dhtmlx.AtomDataLoader); + dhtmlx.extend(this, dhtmlx.DataLoader); + dhtmlx.extend(this, dhtmlx.EventSystem); + dhtmlx.extend(this, dhtmlx.RenderStack); + dhtmlx.extend(this, dhtmlx.SelectionModel); + dhtmlx.extend(this, dhtmlx.MouseEvents); + dhtmlx.extend(this, dhtmlx.KeyEvents); + dhtmlx.extend(this, dhtmlx.EditAbility); + dhtmlx.extend(this, dhtmlx.DataMove); + dhtmlx.extend(this, dhtmlx.DragItem); + dhtmlx.extend(this, dhtmlx.DataProcessor); + dhtmlx.extend(this, dhtmlx.AutoTooltip); + dhtmlx.extend(this, dhtmlx.Destruction); + this.data.attachEvent( + "onStoreUpdated", + dhtmlx.bind(function () { + this.render.apply(this, arguments); + }, this) + ); + this._parseSettings(a, { drag: false, edit: false, select: "multiselect", type: "default" }); + if (this._settings.height != "auto" && !this._settings.renderAll) { + dhtmlx.extend(this, dhtmlx.VirtualRenderStack); + } + this.data.provideApi(this, true); + if (this.config.autowidth) { + this.attachEvent("onBeforeRender", function () { + this.type.width = Math.floor(this._dataobj.scrollWidth / (this.config.autowidth * 1 || 1)) - this.type.padding * 2 - this.type.margin * 2 - this.type.border * 2; + this.type._item_start = dhtmlx.Template.fromHTML(this.template_item_start(this.type)); + this.type._item_end = this.template_item_end(this.type); + }); + dhtmlx.event( + window, + "resize", + function () { + this.refresh(); + }, + this + ); + } + if (dhtmlx.$customScroll) { + dhtmlx.CustomScroll.enable(this); + } +}; +dhtmlXDataView.prototype = { + bind: function () { + dhx.BaseBind.legacyBind.apply(this, arguments); + }, + sync: function () { + dhx.BaseBind.legacySync.apply(this, arguments); + }, + dragMarker: function (e, h) { + var g = this._locateHTML(e.target); + if (this.type.drag_marker) { + if (this._drag_marker) { + this._drag_marker.style.backgroundImage = ""; + this._drag_marker.style.backgroundRepeat = ""; + } + if (g) { + g.style.backgroundImage = "url(" + (dhtmlx.image_path || "") + this.type.drag_marker + ")"; + g.style.backgroundRepeat = "no-repeat"; + this._drag_marker = g; + } + } + if (g && this._settings.auto_scroll) { + var a = g.offsetTop; + var j = g.offsetHeight; + var c = this._obj.scrollTop; + var l = this._obj.offsetHeight; + if (a - j >= 0 && a - j * 0.75 < c) { + c = Math.max(a - j, 0); + } else { + if (a + j / 0.75 > c + l) { + c = c + j; + } + } + this._obj.scrollTop = c; + } + return true; + }, + _id: "dhx_f_id", + on_click: { + dhx_dataview_item: function (a, c) { + if (this.stopEdit(false, c)) { + if (this._settings.select) { + if (this._settings.select == "multiselect") { + this.select(c, a.ctrlKey, a.shiftKey); + } else { + this.select(c); + } + } + } + }, + }, + on_dblclick: { + dhx_dataview_item: function (a, c) { + if (this._settings.edit) { + this.edit(c); + } + }, + }, + on_mouse_move: {}, + types: { + default: { + css: "default", + template: dhtmlx.Template.fromHTML("
{obj.text}
"), + template_edit: dhtmlx.Template.fromHTML("
"), + template_loading: dhtmlx.Template.fromHTML("
Loading...
"), + width: 210, + height: 115, + margin: 0, + padding: 10, + border: 1, + }, + }, + template_item_start: dhtmlx.Template.fromHTML( + "
" + ), + template_item_end: dhtmlx.Template.fromHTML("
"), +}; +dhtmlx.compat("layout"); +if (typeof window.dhtmlXCellObject != "undefined") { + dhtmlXCellObject.prototype.attachDataView = function (a) { + this.callEvent("_onBeforeContentAttach", ["dataview"]); + var c = document.createElement("DIV"); + c.style.width = "100%"; + c.style.height = "100%"; + c.style.position = "relative"; + c.style.overflow = "hidden"; + this._attachObject(c); + if (typeof a == "undefined") { + a = {}; + } + c.id = "DataViewObject_" + new Date().getTime(); + a.container = c.id; + a.skin = this.conf.skin; + this.dataType = "dataview"; + this.dataObj = new dhtmlXDataView(a); + this.dataObj.setSizes = function () { + this.render(); + }; + c = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; + }; +} +dhtmlXList = function (a) { + this.name = "List"; + dhtmlx.extend(this, dhtmlx.Settings); + this._parseContainer(a, "dhx_list"); + dhtmlx.extend(this, dhtmlx.AtomDataLoader); + dhtmlx.extend(this, dhtmlx.DataLoader); + dhtmlx.extend(this, dhtmlx.EventSystem); + dhtmlx.extend(this, dhtmlx.RenderStack); + dhtmlx.extend(this, dhtmlx.SelectionModel); + dhtmlx.extend(this, dhtmlx.MouseEvents); + dhtmlx.extend(this, dhtmlx.KeyEvents); + dhtmlx.extend(this, dhtmlx.EditAbility); + dhtmlx.extend(this, dhtmlx.DataMove); + dhtmlx.extend(this, dhtmlx.DragItem); + dhtmlx.extend(this, dhtmlx.DataProcessor); + dhtmlx.extend(this, dhtmlx.AutoTooltip); + dhtmlx.extend(this, dhtmlx.Destruction); + this._getDimension = function () { + var c = this.type; + var e = (c.margin || 0) * 2; + return { x: c.width + e, y: c.height + e }; + }; + this.data.attachEvent( + "onStoreUpdated", + dhtmlx.bind(function () { + this.render.apply(this, arguments); + }, this) + ); + this._parseSettings(a, { drag: false, edit: false, select: "multiselect", type: "default" }); + this.data.provideApi(this, true); + if (dhtmlx.$customScroll) { + dhtmlx.CustomScroll.enable(this); + } +}; +dhtmlXList.prototype = { + bind: function () { + dhx.BaseBind.legacyBind.apply(this, arguments); + }, + sync: function () { + dhx.BaseBind.legacySync.apply(this, arguments); + }, + dragMarker: function (e, h) { + var g = this._locateHTML(e.target); + if (g && this._settings.auto_scroll) { + var a = g.offsetTop; + var j = g.offsetHeight; + var c = this._obj.scrollTop; + var l = this._obj.offsetHeight; + if (a - j >= 0 && a - j * 0.75 < c) { + c = Math.max(a - j, 0); + } else { + if (a + j / 0.75 > c + l) { + c = c + j; + } + } + this._obj.scrollTop = c; + } + return true; + }, + _id: "dhx_f_id", + on_click: { + dhx_list_item: function (a, c) { + if (this.stopEdit(false, c)) { + if (this._settings.select) { + if (this._settings.select == "multiselect") { + this.select(c, a.ctrlKey, a.shiftKey); + } else { + this.select(c); + } + } + } + }, + }, + on_dblclick: { + dhx_list_item: function (a, c) { + if (this._settings.edit) { + this.edit(c); + } + }, + }, + on_mouse_move: {}, + types: { + default: { + css: "default", + template: dhtmlx.Template.fromHTML("
{obj.text}
"), + template_edit: dhtmlx.Template.fromHTML("
"), + template_loading: dhtmlx.Template.fromHTML("
Loading...
"), + height: 50, + margin: 0, + padding: 10, + border: 1, + }, + }, + template_item_start: dhtmlx.Template.fromHTML( + "
" + ), + template_item_end: dhtmlx.Template.fromHTML("
"), +}; +dhtmlx.compat("layout"); +if (typeof window.dhtmlXCellObject != "undefined") { + dhtmlXCellObject.prototype.attachList = function (a) { + this.callEvent("_onBeforeContentAttach", ["list"]); + var c = document.createElement("DIV"); + c.style.width = "100%"; + c.style.height = "100%"; + c.style.position = "relative"; + c.style.overflow = "hidden"; + this._attachObject(c); + if (typeof a == "undefined") { + a = {}; + } + c.id = "ListObject_" + new Date().getTime(); + a.container = c.id; + a.skin = this.conf.skin; + this.dataType = "list"; + this.dataObj = new dhtmlXList(a); + this.dataObj.setSizes = function () { + this.render(); + }; + c = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; + }; +} +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.wholeText || this.d.firstChild.data : ""; + }, + each: function (g, l, j, h) { + var e = this.d.childNodes; + var m = new xmlPointer(); + if (e.length) { + for (h = h || 0; h < e.length; h++) { + if (e[h].tagName == g) { + m.d = e[h]; + if (l.apply(j, [m, h]) == -1) { + return; + } + } + } + } + }, + get_all: function () { + var e = {}; + var c = this.d.attributes; + for (var g = 0; g < c.length; g++) { + e[c[g].name] = c[g].value; + } + return e; + }, + sub: function (g) { + var e = this.d.childNodes; + var j = new xmlPointer(); + if (e.length) { + for (var h = 0; h < e.length; h++) { + if (e[h].tagName == g) { + j.d = e[h]; + return j; + } + } + } + }, + up: function (a) { + return new xmlPointer(this.d.parentNode); + }, + set: function (a, c) { + this.d.setAttribute(a, c); + }, + clone: function (a) { + return new xmlPointer(this.d); + }, + sub_exists: function (e) { + var c = this.d.childNodes; + if (c.length) { + for (var g = 0; g < c.length; g++) { + if (c[g].tagName == e) { + return true; + } + } + } + return false; + }, + through: function (e, l, o, h, r) { + var m = this.d.childNodes; + if (m.length) { + for (var g = 0; g < m.length; g++) { + if (m[g].tagName == e && m[g].getAttribute(l) != null && m[g].getAttribute(l) != "" && (!o || m[g].getAttribute(l) == o)) { + var j = new xmlPointer(m[g]); + h.apply(r, [j, g]); + } + var n = this.d; + this.d = m[g]; + this.through(e, l, o, h, r); + this.d = n; + } + } + }, +}; +function dhtmlXTreeObject(l, h, c, a) { + if (dhtmlxEvent.initTouch) { + dhtmlxEvent.initTouch(); + } + if (_isIE) { + try { + document.execCommand("BackgroundImageCache", false, true); + } catch (j) {} + } + if (typeof l != "object") { + this.parentObject = document.getElementById(l); + } else { + this.parentObject = l; + } + this.parentObject.style.overflow = "hidden"; + this._itim_dg = true; + this.dlmtr = ","; + this.dropLower = false; + this.enableIEImageFix(true); + this.xmlstate = 0; + this.mytype = "tree"; + this.smcheck = true; + this.width = h; + this.height = c; + this.rootId = a; + this.childCalc = null; + this.def_img_x = "18px"; + this.def_img_y = "18px"; + this.def_line_img_x = "18px"; + this.def_line_img_y = "24px"; + this._dragged = new Array(); + this._selected = new Array(); + this.style_pointer = "pointer"; + this._aimgs = true; + this.htmlcA = " ["; + this.htmlcB = "]"; + this.lWin = window; + this.cMenu = 0; + this.mlitems = 0; + this.iconURL = ""; + this.dadmode = 0; + this.slowParse = false; + this.autoScroll = true; + this.hfMode = 0; + this.nodeCut = new Array(); + this.XMLsource = 0; + this.XMLloadingWarning = 0; + this._idpull = {}; + this._pullSize = 0; + this.treeLinesOn = true; + this.tscheck = false; + this.timgen = true; + this.dpcpy = false; + this._ld_id = null; + this._dynDeleteBranches = {}; + this._oie_onXLE = []; + this.imPath = window.dhx_globalImgPath || ""; + this.checkArray = new Array("iconUncheckAll.gif", "iconCheckAll.gif", "iconCheckGray.gif", "iconUncheckDis.gif", "iconCheckDis.gif", "iconCheckDis.gif"); + this.radioArray = new Array("radio_off.gif", "radio_on.gif", "radio_on.gif", "radio_off.gif", "radio_on.gif", "radio_on.gif"); + this.lineArray = new Array("line2.gif", "line3.gif", "line4.gif", "blank.gif", "blank.gif", "line1.gif"); + this.minusArray = new Array("minus2.gif", "minus3.gif", "minus4.gif", "minus.gif", "minus5.gif"); + this.plusArray = new Array("plus2.gif", "plus3.gif", "plus4.gif", "plus.gif", "plus5.gif"); + this.imageArray = new Array("leaf.gif", "folderOpen.gif", "folderClosed.gif"); + this.cutImg = new Array(0, 0, 0); + this.cutImage = "but_cut.gif"; + dhx4._eventable(this); + this.dragger = new dhtmlDragAndDropObject(); + 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 = this._createSelf(); + this.allTree.appendChild(this.htmlNode.htmlNode); + if (dhtmlx.$customScroll) { + dhtmlx.CustomScroll.enable(this); + } + if (_isFF) { + this.allTree.childNodes[0].width = "100%"; + this.allTree.childNodes[0].style.overflow = "hidden"; + } + var g = this; + this.allTree.onselectstart = new Function("return false;"); + if (_isMacOS) { + this.allTree.oncontextmenu = function (m) { + return g._doContClick(m || window.event, true); + }; + } + this.allTree.onmousedown = function (m) { + return g._doContClick(m || window.event); + }; + this.XMLLoader = this._parseXMLTree; + if (_isIE) { + this.preventIECashing(true); + } + this.selectionBar = document.createElement("DIV"); + this.selectionBar.className = "selectionBar"; + this.selectionBar.innerHTML = " "; + this.selectionBar.style.display = "none"; + this.allTree.appendChild(this.selectionBar); + if (window.addEventListener) { + window.addEventListener( + "unload", + function () { + try { + g.destructor(); + } catch (m) {} + }, + false + ); + } + if (window.attachEvent) { + window.attachEvent("onunload", function () { + try { + g.destructor(); + } catch (m) {} + }); + } + this.setImagesPath = this.setImagePath; + this.setIconsPath = this.setIconPath; + if (dhtmlx.image_path) { + this.setImagePath(dhtmlx.image_path); + } + this.setSkin(window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxtree") || "dhx_skyblue"); + return this; +} +dhtmlXTreeObject.prototype.setDataMode = function (a) { + this._datamode = a; +}; +dhtmlXTreeObject.prototype._doContClick = function (l, a) { + if (!a && l.button != 2) { + if (this._acMenu) { + if (this._acMenu.hideContextMenu) { + this._acMenu.hideContextMenu(); + } else { + this.cMenu._contextEnd(); + } + } + return true; + } + var c = _isIE ? l.srcElement : l.target; + while (c && c.tagName != "BODY") { + if (c.parentObject) { + break; + } + c = c.parentNode; + } + if (!c || !c.parentObject) { + return true; + } + var h = c.parentObject; + if (!this.callEvent("onRightClick", [h.id, l])) { + (l.srcElement || l.target).oncontextmenu = function (o) { + (o || event).cancelBubble = true; + return false; + }; + } + this._acMenu = h.cMenu || this.cMenu; + if (this._acMenu) { + if (!this.callEvent("onBeforeContextMenu", [h.id])) { + return true; + } + if (!_isMacOS) { + (l.srcElement || l.target).oncontextmenu = function (o) { + (o || event).cancelBubble = true; + return false; + }; + } + if (this._acMenu.showContextMenu) { + var g = window.document.documentElement; + var e = window.document.body; + var m = new Array(g.scrollLeft || e.scrollLeft, g.scrollTop || e.scrollTop); + if (_isIE) { + var n = l.clientX + m[0]; + var j = l.clientY + m[1]; + } else { + var n = l.pageX; + var j = l.pageY; + } + this._acMenu.showContextMenu(n - 1, j - 1); + this.contextID = h.id; + l.cancelBubble = true; + this._acMenu._skip_hide = true; + } else { + c.contextMenuId = h.id; + c.contextMenu = this._acMenu; + c.a = this._acMenu._contextStart; + c.a(c, l); + c.a = null; + } + return false; + } + return true; +}; +dhtmlXTreeObject.prototype.enableIEImageFix = function (a) { + if (!a) { + this._getImg = function (c) { + return document.createElement(c == this.rootId ? "div" : "img"); + }; + this._setSrc = function (e, c) { + e.src = c; + }; + this._getSrc = function (c) { + return c.src; + }; + } else { + this._getImg = function () { + var c = document.createElement("DIV"); + c.innerHTML = " "; + c.className = "dhx_bg_img_fix"; + return c; + }; + this._setSrc = function (e, c) { + e.style.backgroundImage = "url(" + c + ")"; + }; + this._getSrc = function (c) { + var e = c.style.backgroundImage; + return e.substr(4, e.length - 5).replace(/(^")|("$)/g, ""); + }; + } +}; +dhtmlXTreeObject.prototype.destructor = function () { + for (var c in this._idpull) { + var e = this._idpull[c]; + if (!e) { + continue; + } + e.parentObject = null; + e.treeNod = null; + e.childNodes = null; + e.span = null; + e.tr.nodem = null; + e.tr = null; + e.htmlNode.objBelong = null; + e.htmlNode = null; + this._idpull[c] = null; + } + this.parentObject.innerHTML = ""; + this.allTree.onselectstart = null; + this.allTree.oncontextmenu = null; + this.allTree.onmousedown = null; + for (var c in this) { + this[c] = null; + } +}; +function cObject() { + return this; +} +cObject.prototype = new Object(); +cObject.prototype.clone = function () { + function a() {} + a.prototype = this; + return new a(); +}; +function dhtmlXTreeItemObject(j, c, e, a, g, h) { + 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 = a; + this.label = c; + this.parentObject = e; + this.actionHandler = g; + this.images = new Array(a.imageArray[0], a.imageArray[1], a.imageArray[2]); + this.id = a._globalIdStorageAdd(j, this); + if (this.treeNod.checkBoxOff) { + this.htmlNode = this.treeNod._createItem(1, this, h); + } else { + this.htmlNode = this.treeNod._createItem(0, this, h); + } + this.htmlNode.objBelong = this; + return this; +} +dhtmlXTreeObject.prototype._globalIdStorageAdd = function (c, a) { + if (this._globalIdStorageFind(c, 1, 1)) { + c = c + "_" + new Date().valueOf(); + return this._globalIdStorageAdd(c, a); + } + this._idpull[c] = a; + this._pullSize++; + return c; +}; +dhtmlXTreeObject.prototype._globalIdStorageSub = function (a) { + if (this._idpull[a]) { + this._unselectItem(this._idpull[a]); + this._idpull[a] = null; + this._pullSize--; + } + if (this._locker && this._locker[a]) { + this._locker[a] = false; + } +}; +dhtmlXTreeObject.prototype._globalIdStorageFind = function (l, a, e, g) { + var h = this._idpull[l]; + if (h) { + if (h.unParsed && !e) { + this.reParse(h, 0); + } + if (this._srnd && !h.htmlNode) { + this._buildSRND(h, e); + } + if (g && this._edsbpsA) { + for (var c = 0; c < this._edsbpsA.length; c++) { + if (this._edsbpsA[c][2] == l) { + dhx4.callEvent("ongetItemError", ["Requested item still in parsing process.", l]); + return null; + } + } + } + return h; + } + if (this.slowParse && l != 0 && !a) { + return this.preParse(l); + } else { + return null; + } +}; +dhtmlXTreeObject.prototype._getSubItemsXML = function (a) { + var c = []; + a.each( + "item", + function (e) { + c.push(e.get("id")); + }, + this + ); + return c.join(this.dlmtr); +}; +dhtmlXTreeObject.prototype.enableSmartXMLParsing = function (a) { + this.slowParse = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.findXML = function (c, a, e) {}; +dhtmlXTreeObject.prototype._getAllCheckedXML = function (c, a, g) { + var e = []; + if (g == 2) { + c.through( + "item", + "checked", + -1, + function (h) { + e.push(h.get("id")); + }, + this + ); + } + if (g == 1) { + c.through( + "item", + "id", + null, + function (h) { + if (h.get("checked") && h.get("checked") != -1) { + e.push(h.get("id")); + } + }, + this + ); + } + if (g == 0) { + c.through( + "item", + "id", + null, + function (h) { + if (!h.get("checked") || h.get("checked") == 0) { + e.push(h.get("id")); + } + }, + this + ); + } + if (e.length) { + return a + (a ? this.dlmtr : "") + e.join(this.dlmtr); + } + if (a) { + return a; + } else { + return ""; + } +}; +dhtmlXTreeObject.prototype._setSubCheckedXML = function (a, c) { + var e = a ? "1" : ""; + c.through( + "item", + "id", + null, + function (g) { + if (!g.get("disabled") || g.get("disabled") == 0) { + g.set("checked", e); + } + }, + this + ); +}; +dhtmlXTreeObject.prototype._getAllScraggyItemsXML = function (e, a) { + var g = []; + var c = function (h) { + if (!h.sub_exists("item")) { + g.push(h.get("id")); + } else { + h.each("item", c, this); + } + }; + c(e); + return g.join(","); +}; +dhtmlXTreeObject.prototype._getAllFatItemsXML = function (e, a) { + var g = []; + var c = function (h) { + if (!h.sub_exists("item")) { + return; + } + g.push(h.get("id")); + h.each("item", c, this); + }; + c(e); + return g.join(","); +}; +dhtmlXTreeObject.prototype._getAllSubItemsXML = function (e, c, a) { + var c = []; + a.through( + "item", + "id", + null, + function (g) { + c.push(g.get("id")); + }, + this + ); + return c.join(","); +}; +dhtmlXTreeObject.prototype.reParse = function (e) { + var j = this; + if (!this.parsCount) { + j.callEvent("onXLS", [j, e.id]); + } + this.xmlstate = 1; + var g = e.unParsed; + e.unParsed = 0; + this.XMLloadingWarning = 1; + var a = this.parsingOn; + var l = this.waitUpdateXML; + var m = this.parsedArray; + this.parsedArray = new Array(); + this.waitUpdateXML = false; + this.parsingOn = e.id; + this.parsedArray = new Array(); + this.setCheckList = ""; + this._parse(g, e.id, 2); + var o = this.setCheckList.split(this.dlmtr); + for (var h = 0; h < this.parsedArray.length; h++) { + e.htmlNode.childNodes[0].appendChild(this.parsedArray[h]); + } + if (g.get("order") && g.get("order") != "none") { + this._reorderBranch(e, g.get("order"), true); + } + this.oldsmcheck = this.smcheck; + this.smcheck = false; + for (var c = 0; c < o.length; c++) { + if (o[c]) { + this.setCheck(o[c], 1); + } + } + this.smcheck = this.oldsmcheck; + this.parsingOn = a; + this.waitUpdateXML = l; + this.parsedArray = m; + this.XMLloadingWarning = 0; + this._redrawFrom(this, e); + if (this._srnd && !e._sready) { + this.prepareSR(e.id); + } + this.xmlstate = 0; + return true; +}; +dhtmlXTreeObject.prototype.preParse = function (c) { + if (!c || !this._p) { + return null; + } + var a = false; + this._p.clone().through( + "item", + "id", + c, + function (g) { + this._globalIdStorageFind(g.up().get("id")); + return (a = true); + }, + this + ); + if (a) { + var e = this._globalIdStorageFind(c, true, false); + if (!e) { + dhx4.callEvent("ongetItemError", ["The item " + c + " not operable. Seems you have non-unique|incorrect IDs in tree's XML.", c]); + } + } + return e; +}; +dhtmlXTreeObject.prototype._escape = function (a) { + switch (this.utfesc) { + case "none": + return a; + break; + case "utf8": + return encodeURIComponent(a); + break; + default: + return escape(a); + break; + } +}; +dhtmlXTreeObject.prototype._drawNewTr = function (h, e) { + var g = document.createElement("tr"); + var c = document.createElement("td"); + var a = document.createElement("td"); + c.appendChild(document.createTextNode(" ")); + a.colSpan = 3; + a.appendChild(h); + g.appendChild(c); + g.appendChild(a); + return g; +}; +dhtmlXTreeObject.prototype.parse = function (g, e, a) { + if (typeof e == "string") { + a = e; + e = null; + } + if (a === "json") { + return this._loadJSONObject(g, e); + } else { + if (a === "csv") { + return this._loadCSVString(g, e); + } else { + if (a === "jsarray") { + return this._loadJSArray(g, e); + } + } + } + var c = this; + if (!this.parsCount) { + this.callEvent("onXLS", [c, null]); + } + this.xmlstate = 1; + this.XMLLoader({ responseXML: dhx4.ajax.parse(g) }, e); +}; +dhtmlXTreeObject.prototype.loadXMLString = function () { + if (window.console && window.console.info) { + window.console.info("loadXMLString was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44"); + } + return this.parse.apply(this, arguments); +}; +dhtmlXTreeObject.prototype.load = function (c, h, e) { + if (typeof h == "string") { + e = h; + h = null; + } + e = e || this._datamode; + if (e === "json") { + return this._loadJSON(c, h); + } else { + if (e === "csv") { + return this._loadCSV(c, h); + } else { + if (e === "jsarray") { + return this._loadJSArrayFile(xmlString, h); + } + } + } + var g = this; + if (!this.parsCount) { + this.callEvent("onXLS", [g, this._ld_id]); + } + this._ld_id = null; + this.xmlstate = 1; + this.XMLLoader = this._parseXMLTree; + var a = this; + dhx4.ajax.get(c, function (j) { + a.XMLLoader(j.xmlDoc, h); + a = null; + }); +}; +dhtmlXTreeObject.prototype.loadXML = function () { + if (window.console && window.console.info) { + window.console.info("loadXML was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44"); + } + return this.load.apply(this, arguments); +}; +dhtmlXTreeObject.prototype._attachChildNode = function (l, j, g, m, D, C, A, o, e, u, v) { + if (u && u.parentObject) { + l = u.parentObject; + } + if (l.XMLload == 0 && this.XMLsource && !this.XMLloadingWarning) { + l.XMLload = 1; + this._loadDynXML(l.id); + } + var r = l.childsCount; + var E = l.childNodes; + if (v && v.tr.previousSibling) { + if (v.tr.previousSibling.previousSibling) { + u = v.tr.previousSibling.nodem; + } else { + o = o.replace("TOP", "") + ",TOP"; + } + } + if (u) { + var h, y; + for (h = 0; h < r; h++) { + if (E[h] == u) { + for (y = r; y != h; y--) { + E[1 + y] = E[y]; + } + break; + } + } + h++; + r = h; + } + if (o) { + var w = o.split(","); + for (var x = 0; x < w.length; x++) { + switch (w[x]) { + case "TOP": + if (l.childsCount > 0) { + u = new Object(); + u.tr = l.childNodes[0].tr.previousSibling; + } + l._has_top = true; + for (h = r; h > 0; h--) { + E[h] = E[h - 1]; + } + r = 0; + break; + } + } + } + var s; + if (!(s = this._idpull[j]) || s.span != -1) { + s = E[r] = new dhtmlXTreeItemObject(j, g, l, this, m, 1); + j = E[r].id; + l.childsCount++; + } + if (!s.htmlNode) { + s.label = g; + s.htmlNode = this._createItem(this.checkBoxOff ? 1 : 0, s); + s.htmlNode.objBelong = s; + } + if (D) { + s.images[0] = D; + } + if (C) { + s.images[1] = C; + } + if (A) { + s.images[2] = A; + } + var c = this._drawNewTr(s.htmlNode); + if (this.XMLloadingWarning || this._hAdI) { + s.htmlNode.parentNode.parentNode.style.display = "none"; + } + if (u && u.tr && u.tr.nextSibling) { + l.htmlNode.childNodes[0].insertBefore(c, u.tr.nextSibling); + } else { + if (this.parsingOn == l.id) { + this.parsedArray[this.parsedArray.length] = c; + } else { + l.htmlNode.childNodes[0].appendChild(c); + } + } + if (u && !u.span) { + u = null; + } + if (this.XMLsource) { + if (e && e != 0) { + s.XMLload = 0; + } else { + s.XMLload = 1; + } + } + s.tr = c; + c.nodem = s; + if (l.itemId == 0) { + c.childNodes[0].className = "hiddenRow"; + } + if (l._r_logic || this._frbtr) { + this._setSrc(s.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0], this.imPath + this.radioArray[0]); + } + if (o) { + var w = o.split(","); + for (var x = 0; x < w.length; x++) { + switch (w[x]) { + case "SELECT": + this.selectItem(j, false); + break; + case "CALL": + this.selectItem(j, true); + break; + case "CHILD": + s.XMLload = 0; + break; + case "CHECKED": + if (this.XMLloadingWarning) { + this.setCheckList += this.dlmtr + j; + } else { + this.setCheck(j, 1); + } + break; + case "HCHECKED": + this._setCheck(s, "unsure"); + break; + case "OPEN": + s.openMe = 1; + break; + } + } + } + if (!this.XMLloadingWarning) { + if (this._getOpenState(l) < 0 && !this._hAdI) { + this.openItem(l.id); + } + if (u) { + this._correctPlus(u); + this._correctLine(u); + } + this._correctPlus(l); + this._correctLine(l); + this._correctPlus(s); + if (l.childsCount >= 2) { + this._correctPlus(E[l.childsCount - 2]); + this._correctLine(E[l.childsCount - 2]); + } + if (l.childsCount != 2) { + this._correctPlus(E[0]); + } + if (this.tscheck) { + this._correctCheckStates(l); + } + if (this._onradh) { + if (this.xmlstate == 1) { + var a = this.onXLE; + this.onXLE = function (n) { + this._onradh(j); + if (a) { + a(n); + } + }; + } else { + this._onradh(j); + } + } + } + return s; +}; +dhtmlXTreeObject.prototype.enableContextMenu = function (a) { + if (a) { + this.cMenu = a; + } +}; +dhtmlXTreeObject.prototype.setItemContextMenu = function (h, g) { + var a = h.toString().split(this.dlmtr); + for (var e = 0; e < a.length; e++) { + var c = this._globalIdStorageFind(a[e]); + if (!c) { + continue; + } + c.cMenu = g; + } +}; +dhtmlXTreeObject.prototype.insertNewItem = function (g, m, o, e, l, j, h, c, a) { + var r = this._globalIdStorageFind(g); + if (!r) { + return -1; + } + var n = this._attachChildNode(r, m, o, e, l, j, h, c, a); + if (!this._idpull[this.rootId].XMLload) { + this._idpull[this.rootId].XMLload = 1; + } + if (!this.XMLloadingWarning && this.childCalc) { + this._fixChildCountLabel(r); + } + return n; +}; +dhtmlXTreeObject.prototype.insertNewChild = function (g, m, n, e, l, j, h, c, a) { + return this.insertNewItem(g, m, n, e, l, j, h, c, a); +}; +dhtmlXTreeObject.prototype._parseXMLTree = function (a, e) { + var c = new xmlPointer(dhx4.ajax.xmltop("tree", a)); + this._parse(c); + this._p = c; + if (e) { + e.call(this, a); + } +}; +dhtmlXTreeObject.prototype._parseItem = function (j, o, h, m) { + var e; + if (this._srnd && (!this._idpull[(e = j.get("id"))] || !this._idpull[e].span)) { + this._addItemSRND(o.id, e, j); + return; + } + var l = j.get_all(); + if (typeof this.waitUpdateXML == "object" && !this.waitUpdateXML[l.id]) { + this._parse(j, l.id, 1); + return; + } + if (l.text === null || typeof l.text == "undefined") { + l.text = j.sub("itemtext"); + if (l.text) { + l.text = l.text.content(); + } + } + var s = []; + if (l.select) { + s.push("SELECT"); + } + if (l.top) { + s.push("TOP"); + } + if (l.call) { + this.nodeAskingCall = l.id; + } + if (l.checked == -1) { + s.push("HCHECKED"); + } else { + if (l.checked) { + s.push("CHECKED"); + } + } + if (l.open) { + s.push("OPEN"); + } + if (this.waitUpdateXML) { + if (this._globalIdStorageFind(l.id)) { + var n = this.updateItem(l.id, l.text, l.im0, l.im1, l.im2, l.checked, l.child); + } else { + if (this.npl == 0) { + s.push("TOP"); + } else { + h = o.childNodes[this.npl]; + } + var n = this._attachChildNode(o, l.id, l.text, 0, l.im0, l.im1, l.im2, s.join(","), l.child, 0, h); + l.id = n.id; + h = null; + } + } else { + var n = this._attachChildNode(o, l.id, l.text, 0, l.im0, l.im1, l.im2, s.join(","), l.child, m || 0, h); + } + if (l.tooltip) { + n.span.parentNode.parentNode.title = l.tooltip; + } + if (l.style) { + if (n.span.style.cssText) { + n.span.style.cssText += ";" + l.style; + } else { + n.span.setAttribute("style", n.span.getAttribute("style") + "; " + l.style); + } + } + if (l.radio) { + n._r_logic = true; + } + if (l.nocheckbox) { + var r = n.span.parentNode.previousSibling.previousSibling; + r.style.display = "none"; + n.nocheckbox = true; + } + if (l.disabled) { + if (l.checked != null) { + this._setCheck(n, l.checked); + } + this.disableCheckbox(n, 1); + } + n._acc = l.child || 0; + if (this.parserExtension) { + this.parserExtension._parseExtension.call(this, j, l, o ? o.id : 0); + } + this.setItemColor(n, l.aCol, l.sCol); + if (l.locked == "1") { + this.lockItem(n.id, true, true); + } + if (l.imwidth || l.imheight) { + this.setIconSize(l.imwidth, l.imheight, n); + } + if (l.closeable == "0" || l.closeable == "1") { + this.setItemCloseable(n, l.closeable); + } + var g = ""; + if (l.topoffset) { + this.setItemTopOffset(n, l.topoffset); + } + if (!this.slowParse || typeof this.waitUpdateXML == "object") { + if (j.sub_exists("item")) { + g = this._parse(j, l.id, 1); + } + } else { + if (!n.childsCount && j.sub_exists("item")) { + n.unParsed = j.clone(); + } + j.each( + "userdata", + function (a) { + this.setUserData(l.id, a.get("name"), a.content()); + }, + this + ); + } + if (g != "") { + this.nodeAskingCall = g; + } + j.each( + "userdata", + function (a) { + this.setUserData(j.get("id"), a.get("name"), a.content()); + }, + this + ); +}; +dhtmlXTreeObject.prototype._parse = function (e, j, a, c) { + if (this._srnd && !this.parentObject.offsetHeight) { + var v = this; + return window.setTimeout(function () { + v._parse(e, j, a, c); + }, 100); + } + if (!e.exists()) { + return; + } + this.skipLock = true; + if (!j) { + j = e.get("id"); + if (this._dynDeleteBranches[j]) { + this.deleteChildItems(j); + this._dynDeleteBranches[j]--; + if (!this._dynDeleteBranches[j]) { + delete this._dynDeleteBranches[j]; + } + } + var s = e.get("dhx_security"); + if (s) { + dhtmlx.security_key = s; + } + if (e.get("radio")) { + this.htmlNode._r_logic = true; + } + this.parsingOn = j; + this.parsedArray = new Array(); + this.setCheckList = ""; + this.nodeAskingCall = ""; + } + var u = this._globalIdStorageFind(j); + if (!u) { + return dhx4.callEvent("onDataStructureError", ["XML refers to not existing parent"]); + } + this.parsCount = this.parsCount ? this.parsCount + 1 : 1; + this.XMLloadingWarning = 1; + if (u.childsCount && !c && !this._edsbps && !u._has_top) { + var l = 0; + } else { + var l = 0; + } + this.npl = 0; + e.each( + "item", + function (w, n) { + u.XMLload = 1; + this._parseItem(w, u, 0, l); + if (this._edsbps && this.npl == this._edsbpsC) { + this._distributedStart(e, n + 1, j, a, u.childsCount); + return -1; + } + this.npl++; + }, + this, + c + ); + if (!a) { + e.each( + "userdata", + function (n) { + this.setUserData(e.get("id"), n.get("name"), n.content()); + }, + this + ); + u.XMLload = 1; + if (this.waitUpdateXML) { + this.waitUpdateXML = false; + for (var h = u.childsCount - 1; h >= 0; h--) { + if (u.childNodes[h]._dmark) { + this.deleteItem(u.childNodes[h].id); + } + } + } + var o = this._globalIdStorageFind(this.parsingOn); + for (var h = 0; h < this.parsedArray.length; h++) { + u.htmlNode.childNodes[0].appendChild(this.parsedArray[h]); + } + this.parsedArray = []; + this.lastLoadedXMLId = j; + this.XMLloadingWarning = 0; + var r = this.setCheckList.split(this.dlmtr); + for (var g = 0; g < r.length; g++) { + if (r[g]) { + this.setCheck(r[g], 1); + } + } + if (this.XMLsource && this.tscheck && this.smcheck && u.id != this.rootId) { + if (u.checkstate === 0) { + this._setSubChecked(0, u); + } else { + if (u.checkstate === 1) { + this._setSubChecked(1, u); + } + } + } + this._redrawFrom(this, null, c); + if (e.get("order") && e.get("order") != "none") { + this._reorderBranch(u, e.get("order"), true); + } + if (this.nodeAskingCall != "") { + this.callEvent("onClick", [this.nodeAskingCall, this.getSelectedItemId()]); + } + if (this._branchUpdate) { + this._branchUpdateNext(e); + } + } + if (this.parsCount == 1) { + this.parsingOn = null; + if (this._srnd && u.id != this.rootId) { + this.prepareSR(u.id); + if (this.XMLsource) { + this.openItem(u.id); + } + } + e.through( + "item", + "open", + null, + function (n) { + this.openItem(n.get("id")); + }, + this + ); + if (!this._edsbps || !this._edsbpsA.length) { + var m = this; + window.setTimeout(function () { + m.callEvent("onXLE", [m, j]); + }, 1); + this.xmlstate = 0; + } + this.skipLock = false; + } + this.parsCount--; + var m = this; + if (this._edsbps) { + window.setTimeout(function () { + m._distributedStep(j); + }, this._edsbpsD); + } + if (!a && this.onXLE) { + this.onXLE(this, j); + } + return this.nodeAskingCall; +}; +dhtmlXTreeObject.prototype._branchUpdateNext = function (a) { + a.each( + "item", + function (g) { + var e = g.get("id"); + if (this._idpull[e] && !this._idpull[e].XMLload) { + return; + } + this._branchUpdate++; + this.smartRefreshItem(g.get("id"), g); + }, + this + ); + this._branchUpdate--; +}; +dhtmlXTreeObject.prototype.checkUserData = function (c, e) { + if (c.nodeType == 1 && c.tagName == "userdata") { + var a = c.getAttribute("name"); + if (a && c.childNodes[0]) { + this.setUserData(e, a, c.childNodes[0].data); + } + } +}; +dhtmlXTreeObject.prototype._redrawFrom = function (m, c, l, e) { + if (!c) { + var h = m._globalIdStorageFind(m.lastLoadedXMLId); + m.lastLoadedXMLId = -1; + if (!h) { + return 0; + } + } else { + h = c; + } + var j = 0; + for (var g = l ? l - 1 : 0; g < h.childsCount; g++) { + if (!this._branchUpdate || this._getOpenState(h) == 1) { + if (!c || e == 1) { + h.childNodes[g].htmlNode.parentNode.parentNode.style.display = ""; + } + } + if (h.childNodes[g].openMe == 1) { + this._openItem(h.childNodes[g]); + h.childNodes[g].openMe = 0; + } + m._redrawFrom(m, h.childNodes[g]); + if (this.childCalc != null) { + if (h.childNodes[g].unParsed || (!h.childNodes[g].XMLload && this.XMLsource)) { + if (h.childNodes[g]._acc) { + h.childNodes[g].span.innerHTML = h.childNodes[g].label + this.htmlcA + h.childNodes[g]._acc + this.htmlcB; + } else { + h.childNodes[g].span.innerHTML = h.childNodes[g].label; + } + } + if (h.childNodes[g].childNodes.length && this.childCalc) { + if (this.childCalc == 1) { + h.childNodes[g].span.innerHTML = h.childNodes[g].label + this.htmlcA + h.childNodes[g].childsCount + this.htmlcB; + } + if (this.childCalc == 2) { + var a = h.childNodes[g].childsCount - (h.childNodes[g].pureChilds || 0); + if (a) { + h.childNodes[g].span.innerHTML = h.childNodes[g].label + this.htmlcA + a + this.htmlcB; + } + if (h.pureChilds) { + h.pureChilds++; + } else { + h.pureChilds = 1; + } + } + if (this.childCalc == 3) { + h.childNodes[g].span.innerHTML = h.childNodes[g].label + this.htmlcA + h.childNodes[g]._acc + this.htmlcB; + } + if (this.childCalc == 4) { + var a = h.childNodes[g]._acc; + if (a) { + h.childNodes[g].span.innerHTML = h.childNodes[g].label + this.htmlcA + a + this.htmlcB; + } + } + } else { + if (this.childCalc == 4) { + j++; + } + } + j += h.childNodes[g]._acc; + if (this.childCalc == 3) { + j++; + } + } + } + if (!h.unParsed && (h.XMLload || !this.XMLsource)) { + h._acc = j; + } + m._correctLine(h); + m._correctPlus(h); + if (this.childCalc && !c) { + m._fixChildCountLabel(h); + } +}; +dhtmlXTreeObject.prototype._createSelf = function () { + var a = document.createElement("div"); + a.className = "containerTableStyle"; + a.style.width = this.width; + a.style.height = this.height; + this.parentObject.appendChild(a); + return a; +}; +dhtmlXTreeObject.prototype._xcloseAll = function (c) { + if (c.unParsed) { + return; + } + if (this.rootId != c.id) { + if (!c.htmlNode) { + return; + } + var g = c.htmlNode.childNodes[0].childNodes; + var a = g.length; + for (var e = 1; e < a; e++) { + g[e].style.display = "none"; + } + this._correctPlus(c); + } + for (var e = 0; e < c.childsCount; e++) { + if (c.childNodes[e].childsCount) { + this._xcloseAll(c.childNodes[e]); + } + } +}; +dhtmlXTreeObject.prototype._xopenAll = function (a) { + this._HideShow(a, 2); + for (var c = 0; c < a.childsCount; c++) { + this._xopenAll(a.childNodes[c]); + } +}; +dhtmlXTreeObject.prototype._correctPlus = function (c) { + if (!c.htmlNode) { + return; + } + var e = c.htmlNode.childNodes[0].childNodes[0].childNodes[0].lastChild; + var h = c.htmlNode.childNodes[0].childNodes[0].childNodes[2].childNodes[0]; + var a = this.lineArray; + if (this.XMLsource && !c.XMLload) { + var a = this.plusArray; + this._setSrc(h, this.iconURL + c.images[2]); + if (this._txtimg) { + return (e.innerHTML = "[+]"); + } + } else { + if (c.childsCount || c.unParsed) { + if (c.htmlNode.childNodes[0].childNodes[1] && c.htmlNode.childNodes[0].childNodes[1].style.display != "none") { + if (!c.wsign) { + var a = this.minusArray; + } + this._setSrc(h, this.iconURL + c.images[1]); + if (this._txtimg) { + return (e.innerHTML = "[-]"); + } + } else { + if (!c.wsign) { + var a = this.plusArray; + } + this._setSrc(h, this.iconURL + c.images[2]); + if (this._txtimg) { + return (e.innerHTML = "[+]"); + } + } + } else { + this._setSrc(h, this.iconURL + c.images[0]); + } + } + var g = 2; + if (!c.treeNod.treeLinesOn) { + this._setSrc(e, this.imPath + a[3]); + } else { + if (c.parentObject) { + g = this._getCountStatus(c.id, c.parentObject); + } + this._setSrc(e, this.imPath + a[g]); + } +}; +dhtmlXTreeObject.prototype._correctLine = function (c) { + if (!c.htmlNode) { + return; + } + var a = c.parentObject; + if (a) { + if (this._getLineStatus(c.id, a) == 0 || !this.treeLinesOn) { + for (var e = 1; e <= c.childsCount; e++) { + if (!c.htmlNode.childNodes[0].childNodes[e]) { + break; + } + c.htmlNode.childNodes[0].childNodes[e].childNodes[0].style.backgroundImage = ""; + c.htmlNode.childNodes[0].childNodes[e].childNodes[0].style.backgroundRepeat = ""; + } + } else { + for (var e = 1; e <= c.childsCount; e++) { + if (!c.htmlNode.childNodes[0].childNodes[e]) { + break; + } + c.htmlNode.childNodes[0].childNodes[e].childNodes[0].style.backgroundImage = "url(" + this.imPath + this.lineArray[5] + ")"; + c.htmlNode.childNodes[0].childNodes[e].childNodes[0].style.backgroundRepeat = "repeat-y"; + } + } + } +}; +dhtmlXTreeObject.prototype._getCountStatus = function (c, a) { + if (a.childsCount <= 1) { + if (a.id == this.rootId) { + return 4; + } else { + return 0; + } + } + if (a.childNodes[0].id == c) { + if (a.id == this.rootId) { + return 2; + } else { + return 1; + } + } + if (a.childNodes[a.childsCount - 1].id == c) { + return 0; + } + return 1; +}; +dhtmlXTreeObject.prototype._getLineStatus = function (c, a) { + if (a.childNodes[a.childsCount - 1].id == c) { + return 0; + } + return 1; +}; +dhtmlXTreeObject.prototype._HideShow = function (c, h) { + if (this.XMLsource && !c.XMLload) { + if (h == 1) { + return; + } + c.XMLload = 1; + this._loadDynXML(c.id); + return; + } + if (c.unParsed) { + this.reParse(c); + } + var g = c.htmlNode.childNodes[0].childNodes; + var a = g.length; + if (a > 1) { + if ((g[1].style.display != "none" || h == 1) && h != 2) { + this.allTree.childNodes[0].border = "1"; + this.allTree.childNodes[0].border = "0"; + nodestyle = "none"; + } else { + nodestyle = ""; + } + for (var e = 1; e < a; e++) { + g[e].style.display = nodestyle; + } + } + this._correctPlus(c); +}; +dhtmlXTreeObject.prototype._getOpenState = function (a) { + if (!a.htmlNode) { + return 0; + } + var c = a.htmlNode.childNodes[0].childNodes; + if (c.length <= 1) { + return 0; + } + if (c[1].style.display != "none") { + return 1; + } else { + return -1; + } +}; +dhtmlXTreeObject.prototype.onRowClick2 = function () { + var a = this.parentObject.treeNod; + if (!a.callEvent("onDblClick", [this.parentObject.id, a])) { + return false; + } + if (this.parentObject.closeble && this.parentObject.closeble != "0") { + a._HideShow(this.parentObject); + } else { + a._HideShow(this.parentObject, 2); + } + if (a.checkEvent("onOpenEnd")) { + if (!a.xmlstate) { + a.callEvent("onOpenEnd", [this.parentObject.id, a._getOpenState(this.parentObject)]); + } else { + a._oie_onXLE.push(a.onXLE); + a.onXLE = a._epnFHe; + } + } + return false; +}; +dhtmlXTreeObject.prototype.onRowClick = function () { + var a = this.parentObject.treeNod; + if (!a.callEvent("onOpenStart", [this.parentObject.id, a._getOpenState(this.parentObject)])) { + return 0; + } + if (this.parentObject.closeble && this.parentObject.closeble != "0") { + a._HideShow(this.parentObject); + } else { + a._HideShow(this.parentObject, 2); + } + if (a.checkEvent("onOpenEnd")) { + if (!a.xmlstate) { + a.callEvent("onOpenEnd", [this.parentObject.id, a._getOpenState(this.parentObject)]); + } else { + a._oie_onXLE.push(a.onXLE); + a.onXLE = a._epnFHe; + } + } +}; +dhtmlXTreeObject.prototype._epnFHe = function (c, e, a) { + if (e != this.rootId) { + this.callEvent("onOpenEnd", [e, c.getOpenState(e)]); + } + c.onXLE = c._oie_onXLE.pop(); + if (!a && !c._oie_onXLE.length) { + if (c.onXLE) { + c.onXLE(c, e); + } + } +}; +dhtmlXTreeObject.prototype.onRowClickDown = function (c) { + c = c || window.event; + var a = this.parentObject.treeNod; + a._selectItem(this.parentObject, c); +}; +dhtmlXTreeObject.prototype.getSelectedItemId = function () { + var c = new Array(); + for (var a = 0; a < this._selected.length; a++) { + c[a] = this._selected[a].id; + } + return c.join(this.dlmtr); +}; +dhtmlXTreeObject.prototype._selectItem = function (l, m) { + if (this.checkEvent("onSelect")) { + this._onSSCFold = this.getSelectedItemId(); + } + if (!this._amsel || !m || (!m.ctrlKey && !m.metaKey && !m.shiftKey)) { + this._unselectItems(); + } + if (l.i_sel && this._amsel && m && (m.ctrlKey || m.metaKey)) { + this._unselectItem(l); + } else { + if (!l.i_sel && (!this._amselS || this._selected.length == 0 || this._selected[0].parentObject == l.parentObject)) { + if (this._amsel && m && m.shiftKey && this._selected.length != 0 && this._selected[this._selected.length - 1].parentObject == l.parentObject) { + var h = this._getIndex(this._selected[this._selected.length - 1]); + var g = this._getIndex(l); + if (g < h) { + var o = h; + h = g; + g = o; + } + for (var j = h; j <= g; j++) { + if (!l.parentObject.childNodes[j].i_sel) { + this._markItem(l.parentObject.childNodes[j]); + } + } + } else { + this._markItem(l); + } + } + } + if (this.checkEvent("onSelect")) { + var n = this.getSelectedItemId(); + if (n != this._onSSCFold) { + this.callEvent("onSelect", [n]); + } + } +}; +dhtmlXTreeObject.prototype._markItem = function (a) { + if (a.scolor) { + a.span.style.color = a.scolor; + } + a.span.className = "selectedTreeRow"; + a.i_sel = true; + this._selected[this._selected.length] = a; +}; +dhtmlXTreeObject.prototype.getIndexById = function (c) { + var a = this._globalIdStorageFind(c); + if (!a) { + return null; + } + return this._getIndex(a); +}; +dhtmlXTreeObject.prototype._getIndex = function (a) { + var e = a.parentObject; + for (var c = 0; c < e.childsCount; c++) { + if (e.childNodes[c] == a) { + return c; + } + } +}; +dhtmlXTreeObject.prototype._unselectItem = function (c) { + if (c && c.i_sel) { + c.span.className = "standartTreeRow"; + if (c.acolor) { + c.span.style.color = c.acolor; + } + c.i_sel = false; + for (var a = 0; a < this._selected.length; a++) { + if (!this._selected[a].i_sel) { + this._selected.splice(a, 1); + break; + } + } + } +}; +dhtmlXTreeObject.prototype._unselectItems = function () { + for (var a = 0; a < this._selected.length; a++) { + var c = this._selected[a]; + c.span.className = "standartTreeRow"; + if (c.acolor) { + c.span.style.color = c.acolor; + } + c.i_sel = false; + } + this._selected = new Array(); +}; +dhtmlXTreeObject.prototype.onRowSelect = function (h, g, l) { + h = h || window.event; + var c = this.parentObject; + if (g) { + c = g.parentObject; + } + var a = c.treeNod; + var j = a.getSelectedItemId(); + if (!h || !h.skipUnSel) { + a._selectItem(c, h); + } + if (!l) { + if (c.actionHandler) { + c.actionHandler(c.id, j); + } else { + a.callEvent("onClick", [c.id, j]); + } + } +}; +dhtmlXTreeObject.prototype._correctCheckStates = function (h) { + if (!this.tscheck) { + return; + } + if (!h) { + return; + } + if (h.id == this.rootId) { + return; + } + var e = h.childNodes; + var c = 0; + var a = 0; + if (h.childsCount == 0) { + return; + } + for (var g = 0; g < h.childsCount; g++) { + if (e[g].dscheck) { + continue; + } + if (e[g].checkstate == 0) { + c = 1; + } else { + if (e[g].checkstate == 1) { + a = 1; + } else { + c = 1; + a = 1; + break; + } + } + } + if (c && a) { + this._setCheck(h, "unsure"); + } else { + if (c) { + this._setCheck(h, false); + } else { + this._setCheck(h, true); + } + } + this._correctCheckStates(h.parentObject); +}; +dhtmlXTreeObject.prototype.onCheckBoxClick = function (a) { + if (!this.treeNod.callEvent("onBeforeCheck", [this.parentObject.id, this.parentObject.checkstate])) { + return; + } + if (this.parentObject.dscheck) { + return true; + } + if (this.treeNod.tscheck) { + if (this.parentObject.checkstate == 1) { + this.treeNod._setSubChecked(false, this.parentObject); + } else { + this.treeNod._setSubChecked(true, this.parentObject); + } + } else { + if (this.parentObject.checkstate == 1) { + this.treeNod._setCheck(this.parentObject, false); + } else { + this.treeNod._setCheck(this.parentObject, true); + } + } + this.treeNod._correctCheckStates(this.parentObject.parentObject); + return this.treeNod.callEvent("onCheck", [this.parentObject.id, this.parentObject.checkstate]); +}; +dhtmlXTreeObject.prototype._createItem = function (s, r, m) { + var u = document.createElement("table"); + u.cellSpacing = 0; + u.cellPadding = 0; + u.border = 0; + if (this.hfMode) { + u.style.tableLayout = "fixed"; + } + u.style.margin = 0; + u.style.padding = 0; + var l = document.createElement("tbody"); + var o = document.createElement("tr"); + var g = document.createElement("td"); + g.className = "standartTreeImage"; + if (this._txtimg) { + var h = document.createElement("div"); + g.appendChild(h); + h.className = "dhx_tree_textSign"; + } else { + var h = this._getImg(r.id); + h.border = "0"; + if (h.tagName == "IMG") { + h.align = "absmiddle"; + } + g.appendChild(h); + h.style.padding = 0; + h.style.margin = 0; + h.style.width = this.def_line_img_x; + } + var e = document.createElement("td"); + var n = this._getImg(this.cBROf ? this.rootId : r.id); + n.checked = 0; + this._setSrc(n, this.imPath + this.checkArray[0]); + n.style.width = "18px"; + n.style.height = "18px"; + if (!s) { + e.style.display = "none"; + } + e.appendChild(n); + if (!this.cBROf && n.tagName == "IMG") { + n.align = "absmiddle"; + } + n.onclick = this.onCheckBoxClick; + n.treeNod = this; + n.parentObject = r; + if (!window._KHTMLrv) { + e.width = "20px"; + } else { + e.width = "16px"; + } + var c = document.createElement("td"); + c.className = "standartTreeImage"; + var j = this._getImg(this.timgen ? r.id : this.rootId); + j.onmousedown = this._preventNsDrag; + j.ondragstart = this._preventNsDrag; + j.border = "0"; + if (this._aimgs) { + j.parentObject = r; + if (j.tagName == "IMG") { + j.align = "absmiddle"; + } + j.onclick = this.onRowSelect; + } + if (!m) { + this._setSrc(j, this.iconURL + this.imageArray[0]); + } + c.appendChild(j); + j.style.padding = 0; + j.style.margin = 0; + if (this.timgen) { + c.style.width = j.style.width = this.def_img_x; + j.style.height = this.def_img_y; + } else { + j.style.width = "0px"; + j.style.height = "0px"; + if (_isOpera || window._KHTMLrv) { + c.style.display = "none"; + } + } + var a = document.createElement("td"); + a.className = "standartTreeRow"; + r.span = document.createElement("span"); + r.span.className = "standartTreeRow"; + if (this.mlitems) { + r.span.style.width = this.mlitems; + r.span.style.display = "block"; + } else { + a.noWrap = true; + } + if (dhx4.isIE8) { + a.style.width = "99999px"; + } else { + if (!window._KHTMLrv) { + a.style.width = "100%"; + } + } + r.span.innerHTML = r.label; + a.appendChild(r.span); + a.parentObject = r; + g.parentObject = r; + a.onclick = this.onRowSelect; + g.onclick = this.onRowClick; + a.ondblclick = this.onRowClick2; + if (this.ettip) { + o.title = r.label; + } + if (this.dragAndDropOff) { + if (this._aimgs) { + this.dragger.addDraggableItem(c, this); + c.parentObject = r; + } + this.dragger.addDraggableItem(a, this); + } + r.span.style.paddingLeft = "5px"; + r.span.style.paddingRight = "5px"; + a.style.verticalAlign = ""; + a.style.fontSize = "10pt"; + a.style.cursor = this.style_pointer; + o.appendChild(g); + o.appendChild(e); + o.appendChild(c); + o.appendChild(a); + l.appendChild(o); + u.appendChild(l); + if (this.ehlt || this.checkEvent("onMouseIn") || this.checkEvent("onMouseOut")) { + o.onmousemove = this._itemMouseIn; + o[_isIE ? "onmouseleave" : "onmouseout"] = this._itemMouseOut; + } + return u; +}; +dhtmlXTreeObject.prototype.setImagePath = function (a) { + this.imPath = a; + this.iconURL = a; +}; +dhtmlXTreeObject.prototype.setIconPath = function (a) { + this.iconURL = a; +}; +dhtmlXTreeObject.prototype._getLeafCount = function (g) { + var e = 0; + for (var c = 0; c < g.childsCount; c++) { + if (g.childNodes[c].childsCount == 0) { + e++; + } + } + return e; +}; +dhtmlXTreeObject.prototype._getChildCounterValue = function (c) { + var a = this._globalIdStorageFind(c); + if (!a) { + return 0; + } + if (a.unParsed || (!a.XMLload && this.XMLsource)) { + return a._acc; + } + switch (this.childCalc) { + case 1: + return a.childsCount; + break; + case 2: + return this._getLeafCount(a); + break; + case 3: + return a._acc; + break; + case 4: + return a._acc; + break; + } +}; +dhtmlXTreeObject.prototype._fixChildCountLabel = function (j, g) { + if (this.childCalc == null) { + return; + } + if (j.unParsed || (!j.XMLload && this.XMLsource)) { + if (j._acc) { + j.span.innerHTML = j.label + this.htmlcA + j._acc + this.htmlcB; + } else { + j.span.innerHTML = j.label; + } + return; + } + switch (this.childCalc) { + case 1: + if (j.childsCount != 0) { + j.span.innerHTML = j.label + this.htmlcA + j.childsCount + this.htmlcB; + } else { + j.span.innerHTML = j.label; + } + break; + case 2: + var h = this._getLeafCount(j); + if (h != 0) { + j.span.innerHTML = j.label + this.htmlcA + h + this.htmlcB; + } else { + j.span.innerHTML = j.label; + } + break; + case 3: + if (j.childsCount != 0) { + var e = 0; + for (var c = 0; c < j.childsCount; c++) { + if (!j.childNodes[c]._acc) { + j.childNodes[c]._acc = 0; + } + e += j.childNodes[c]._acc * 1; + } + e += j.childsCount * 1; + j.span.innerHTML = j.label + this.htmlcA + e + this.htmlcB; + j._acc = e; + } else { + j.span.innerHTML = j.label; + j._acc = 0; + } + if (j.parentObject && j.parentObject != this.htmlNode) { + this._fixChildCountLabel(j.parentObject); + } + break; + case 4: + if (j.childsCount != 0) { + var e = 0; + for (var c = 0; c < j.childsCount; c++) { + if (!j.childNodes[c]._acc) { + j.childNodes[c]._acc = 1; + } + e += j.childNodes[c]._acc * 1; + } + j.span.innerHTML = j.label + this.htmlcA + e + this.htmlcB; + j._acc = e; + } else { + j.span.innerHTML = j.label; + j._acc = 1; + } + if (j.parentObject && j.parentObject != this.htmlNode) { + this._fixChildCountLabel(j.parentObject); + } + break; + } +}; +dhtmlXTreeObject.prototype.setChildCalcMode = function (a) { + switch (a) { + case "child": + this.childCalc = 1; + break; + case "leafs": + this.childCalc = 2; + break; + case "childrec": + this.childCalc = 3; + break; + case "leafsrec": + this.childCalc = 4; + break; + case "disabled": + this.childCalc = null; + break; + default: + this.childCalc = 4; + } +}; +dhtmlXTreeObject.prototype.setChildCalcHTML = function (c, a) { + this.htmlcA = c; + this.htmlcB = 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 (c) { + var a = this._globalIdStorageFind(c); + if (!a) { + return 0; + } + this._xopenAll(a); +}; +dhtmlXTreeObject.prototype.getOpenState = function (c) { + var a = this._globalIdStorageFind(c); + if (!a) { + return ""; + } + return this._getOpenState(a); +}; +dhtmlXTreeObject.prototype.closeAllItems = function (c) { + if (c === window.undefined) { + c = this.rootId; + } + var a = this._globalIdStorageFind(c); + if (!a) { + return 0; + } + this._xcloseAll(a); + this.allTree.childNodes[0].border = "1"; + this.allTree.childNodes[0].border = "0"; +}; +dhtmlXTreeObject.prototype.setUserData = function (g, c, e) { + var a = this._globalIdStorageFind(g, 0, true); + if (!a) { + return; + } + if (c == "hint") { + a.htmlNode.childNodes[0].childNodes[0].title = e; + } + if (typeof a.userData["t_" + c] == "undefined") { + if (!a._userdatalist) { + a._userdatalist = c; + } else { + a._userdatalist += "," + c; + } + } + a.userData["t_" + c] = e; +}; +dhtmlXTreeObject.prototype.getUserData = function (e, c) { + var a = this._globalIdStorageFind(e, 0, true); + if (!a) { + return; + } + return a.userData["t_" + c]; +}; +dhtmlXTreeObject.prototype.getItemColor = function (e) { + var a = this._globalIdStorageFind(e); + if (!a) { + return 0; + } + var c = new Object(); + if (a.acolor) { + c.acolor = a.acolor; + } + if (a.scolor) { + c.scolor = a.scolor; + } + return c; +}; +dhtmlXTreeObject.prototype.setItemColor = function (e, c, g) { + if (e && e.span) { + var a = e; + } else { + var a = this._globalIdStorageFind(e); + } + if (!a) { + return 0; + } else { + if (a.i_sel) { + if (g) { + a.span.style.color = g; + } + } else { + if (c) { + a.span.style.color = c; + } + } + if (g) { + a.scolor = g; + } + if (c) { + a.acolor = c; + } + } +}; +dhtmlXTreeObject.prototype.getItemText = function (c) { + var a = this._globalIdStorageFind(c); + if (!a) { + return 0; + } + return a.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].innerHTML; +}; +dhtmlXTreeObject.prototype.getParentId = function (c) { + var a = this._globalIdStorageFind(c); + if (!a || !a.parentObject) { + return ""; + } + return a.parentObject.id; +}; +dhtmlXTreeObject.prototype.changeItemId = function (c, e) { + if (c == e) { + return; + } + var a = this._globalIdStorageFind(c); + if (!a) { + return 0; + } + a.id = e; + a.span.contextMenuId = e; + this._idpull[e] = this._idpull[c]; + delete this._idpull[c]; +}; +dhtmlXTreeObject.prototype.doCut = function () { + if (this.nodeCut) { + this.clearCut(); + } + this.nodeCut = new Array().concat(this._selected); + for (var a = 0; a < this.nodeCut.length; a++) { + var c = this.nodeCut[a]; + c._cimgs = new Array(); + c._cimgs[0] = c.images[0]; + c._cimgs[1] = c.images[1]; + c._cimgs[2] = c.images[2]; + c.images[0] = c.images[1] = c.images[2] = this.cutImage; + this._correctPlus(c); + } +}; +dhtmlXTreeObject.prototype.doPaste = function (e) { + var a = this._globalIdStorageFind(e); + if (!a) { + return 0; + } + for (var c = 0; c < this.nodeCut.length; c++) { + if (this._checkPNodes(a, this.nodeCut[c])) { + continue; + } + this._moveNode(this.nodeCut[c], a); + } + this.clearCut(); +}; +dhtmlXTreeObject.prototype.clearCut = function () { + for (var a = 0; a < this.nodeCut.length; a++) { + var c = this.nodeCut[a]; + c.images[0] = c._cimgs[0]; + c.images[1] = c._cimgs[1]; + c.images[2] = c._cimgs[2]; + this._correctPlus(c); + } + this.nodeCut = new Array(); +}; +dhtmlXTreeObject.prototype._moveNode = function (a, c) { + var j = this.dadmodec; + if (j == 1) { + var h = c; + if (this.dadmodefix < 0) { + while (true) { + h = this._getPrevNode(h); + if (h == -1) { + h = this.htmlNode; + break; + } + if (h.tr == 0 || h.tr.style.display == "" || !h.parentObject) { + break; + } + } + var g = h; + var e = c; + } else { + if (h.tr && h.tr.nextSibling && h.tr.nextSibling.nodem && this._getOpenState(h) < 1) { + h = h.tr.nextSibling.nodem; + } else { + h = this._getNextNode(h); + if (h == -1) { + h = this.htmlNode; + } + } + var e = h; + var g = c; + } + if (this._getNodeLevel(g, 0) > this._getNodeLevel(e, 0)) { + if (!this.dropLower) { + return this._moveNodeTo(a, g.parentObject); + } else { + if (e.id != this.rootId) { + return this._moveNodeTo(a, e.parentObject, e); + } else { + return this._moveNodeTo(a, this.htmlNode, null); + } + } + } else { + return this._moveNodeTo(a, e.parentObject, e); + } + } else { + return this._moveNodeTo(a, c); + } +}; +dhtmlXTreeObject.prototype._fixNodesCollection = function (m, j) { + var c = 0; + var g = 0; + var l = m.childNodes; + var a = m.childsCount - 1; + if (j == l[a]) { + return; + } + for (var h = 0; h < a; h++) { + if (l[h] == l[a]) { + l[h] = l[h + 1]; + l[h + 1] = l[a]; + } + } + for (var h = 0; h < a + 1; h++) { + if (c) { + var e = l[h]; + l[h] = c; + c = e; + } else { + if (l[h] == j) { + c = l[h]; + l[h] = l[a]; + } + } + } +}; +dhtmlXTreeObject.prototype._recreateBranch = function (j, m, h, a) { + var c; + var n = ""; + if (h) { + for (c = 0; c < m.childsCount; c++) { + if (m.childNodes[c] == h) { + break; + } + } + if (c != 0) { + h = m.childNodes[c - 1]; + } else { + n = "TOP"; + h = ""; + } + } + var e = this._onradh; + this._onradh = null; + var l = this._attachChildNode(m, j.id, j.label, 0, j.images[0], j.images[1], j.images[2], n, 0, h); + l._userdatalist = j._userdatalist; + l.userData = j.userData.clone(); + if (j._attrs) { + l._attrs = {}; + for (var g in j._attrs) { + l._attrs[g] = j._attrs[g]; + } + } + l.XMLload = j.XMLload; + if (e) { + this._onradh = e; + this._onradh(l.id); + } + if (j.treeNod.dpcpy) { + j.treeNod._globalIdStorageFind(j.id); + } else { + l.unParsed = j.unParsed; + } + this._correctPlus(l); + for (var c = 0; c < j.childsCount; c++) { + this._recreateBranch(j.childNodes[c], l, 0, 1); + } + if (!a && this.childCalc) { + this._redrawFrom(this, m); + } + return l; +}; +dhtmlXTreeObject.prototype._moveNodeTo = function (s, v, r) { + if (s.treeNod._nonTrivialNode) { + return s.treeNod._nonTrivialNode(this, v, r, s); + } + if (this._checkPNodes(v, s)) { + return false; + } + if (v.mytype) { + var l = s.treeNod.lWin != v.lWin; + } else { + var l = s.treeNod.lWin != v.treeNod.lWin; + } + if (!this.callEvent("onDrag", [s.id, v.id, r ? r.id : null, s.treeNod, v.treeNod])) { + return false; + } + if (v.XMLload == 0 && this.XMLsource) { + v.XMLload = 1; + this._loadDynXML(v.id); + } + this.openItem(v.id); + var e = s.treeNod; + var n = s.parentObject.childsCount; + var o = s.parentObject; + if (l || e.dpcpy) { + var g = s.id; + s = this._recreateBranch(s, v, r); + if (!e.dpcpy) { + e.deleteItem(g); + } + } else { + var h = v.childsCount; + var u = v.childNodes; + if (h == 0) { + v._open = true; + } + e._unselectItem(s); + u[h] = s; + s.treeNod = v.treeNod; + v.childsCount++; + var m = this._drawNewTr(u[h].htmlNode); + if (!r) { + v.htmlNode.childNodes[0].appendChild(m); + if (this.dadmode == 1) { + this._fixNodesCollection(v, r); + } + } else { + v.htmlNode.childNodes[0].insertBefore(m, r.tr); + this._fixNodesCollection(v, r); + u = v.childNodes; + } + } + if (!e.dpcpy && !l) { + var a = s.tr; + if (document.all && navigator.appVersion.search(/MSIE\ 5\.0/gi) != -1) { + window.setTimeout(function () { + a.parentNode.removeChild(a); + }, 250); + } else { + s.parentObject.htmlNode.childNodes[0].removeChild(s.tr); + } + if (!r || v != s.parentObject) { + for (var j = 0; j < o.childsCount; j++) { + if (o.childNodes[j].id == s.id) { + o.childNodes[j] = 0; + break; + } + } + } else { + o.childNodes[o.childsCount - 1] = 0; + } + e._compressChildList(o.childsCount, o.childNodes); + o.childsCount--; + } + if (!l && !e.dpcpy) { + s.tr = m; + m.nodem = s; + s.parentObject = v; + if (e != v.treeNod) { + if (s.treeNod._registerBranch(s, e)) { + return; + } + this._clearStyles(s); + this._redrawFrom(this, s.parentObject); + if (this._onradh) { + this._onradh(s.id); + } + } + this._correctPlus(v); + this._correctLine(v); + this._correctLine(s); + this._correctPlus(s); + if (r) { + this._correctPlus(r); + } else { + if (v.childsCount >= 2) { + this._correctPlus(u[v.childsCount - 2]); + this._correctLine(u[v.childsCount - 2]); + } + } + this._correctPlus(u[v.childsCount - 1]); + if (this.tscheck) { + this._correctCheckStates(v); + } + if (e.tscheck) { + e._correctCheckStates(o); + } + } + if (n > 1) { + e._correctPlus(o.childNodes[n - 2]); + e._correctLine(o.childNodes[n - 2]); + } + e._correctPlus(o); + e._correctLine(o); + this._fixChildCountLabel(v); + e._fixChildCountLabel(o); + this.callEvent("onDrop", [s.id, v.id, r ? r.id : null, e, v.treeNod]); + return s.id; +}; +dhtmlXTreeObject.prototype._clearStyles = function (a) { + if (!a.htmlNode) { + return; + } + var g = a.htmlNode.childNodes[0].childNodes[0].childNodes[1]; + var c = g.nextSibling.nextSibling; + a.span.innerHTML = a.label; + a.i_sel = false; + if (a._aimgs) { + this.dragger.removeDraggableItem(g.nextSibling); + } + if (this.checkBoxOff) { + g.childNodes[0].style.display = ""; + g.childNodes[0].onclick = this.onCheckBoxClick; + this._setSrc(g.childNodes[0], this.imPath + this.checkArray[a.checkstate]); + } else { + g.style.display = "none"; + } + g.childNodes[0].treeNod = this; + this.dragger.removeDraggableItem(c); + if (this.dragAndDropOff) { + this.dragger.addDraggableItem(c, this); + } + if (this._aimgs) { + this.dragger.addDraggableItem(g.nextSibling, this); + } + c.childNodes[0].className = "standartTreeRow"; + c.onclick = this.onRowSelect; + c.ondblclick = this.onRowClick2; + g.previousSibling.onclick = this.onRowClick; + this._correctLine(a); + this._correctPlus(a); + for (var e = 0; e < a.childsCount; e++) { + this._clearStyles(a.childNodes[e]); + } +}; +dhtmlXTreeObject.prototype._registerBranch = function (c, a) { + if (a) { + a._globalIdStorageSub(c.id); + } + c.id = this._globalIdStorageAdd(c.id, c); + c.treeNod = this; + for (var e = 0; e < c.childsCount; e++) { + this._registerBranch(c.childNodes[e], a); + } + return 0; +}; +dhtmlXTreeObject.prototype.enableThreeStateCheckboxes = function (a) { + this.tscheck = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.setOnMouseInHandler = function (a) { + this.ehlt = true; + this.attachEvent("onMouseIn", a); +}; +dhtmlXTreeObject.prototype.setOnMouseOutHandler = function (a) { + this.ehlt = true; + this.attachEvent("onMouseOut", a); +}; +dhtmlXTreeObject.prototype.enableMercyDrag = function (a) { + this.dpcpy = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.enableTreeImages = function (a) { + this.timgen = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.enableFixedMode = function (a) { + this.hfMode = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.enableCheckBoxes = function (c, a) { + this.checkBoxOff = dhx4.s2b(c); + this.cBROf = !(this.checkBoxOff || dhx4.s2b(a)); +}; +dhtmlXTreeObject.prototype.setStdImages = function (a, e, c) { + this.imageArray[0] = a; + this.imageArray[1] = e; + this.imageArray[2] = c; +}; +dhtmlXTreeObject.prototype.enableTreeLines = function (a) { + this.treeLinesOn = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.setImageArrays = function (g, a, j, h, e, c) { + switch (g) { + case "plus": + this.plusArray[0] = a; + this.plusArray[1] = j; + this.plusArray[2] = h; + this.plusArray[3] = e; + this.plusArray[4] = c; + break; + case "minus": + this.minusArray[0] = a; + this.minusArray[1] = j; + this.minusArray[2] = h; + this.minusArray[3] = e; + this.minusArray[4] = c; + break; + } +}; +dhtmlXTreeObject.prototype.openItem = function (c) { + this.skipLock = true; + var a = this._globalIdStorageFind(c); + if (!a) { + return 0; + } else { + return this._openItem(a); + } + this.skipLock = false; +}; +dhtmlXTreeObject.prototype._openItem = function (a) { + var c = this._getOpenState(a); + if (c < 0 || (this.XMLsource && !a.XMLload)) { + if (!this.callEvent("onOpenStart", [a.id, c])) { + return 0; + } + this._HideShow(a, 2); + if (this.checkEvent("onOpenEnd")) { + if (this.onXLE == this._epnFHe) { + this._epnFHe(this, a.id, true); + } + if (!this.xmlstate || !this.XMLsource) { + this.callEvent("onOpenEnd", [a.id, this._getOpenState(a)]); + } else { + this._oie_onXLE.push(this.onXLE); + this.onXLE = this._epnFHe; + } + } + } else { + if (this._srnd) { + this._HideShow(a, 2); + } + } + if (a.parentObject && !this._skip_open_parent) { + this._openItem(a.parentObject); + } +}; +dhtmlXTreeObject.prototype.closeItem = function (c) { + if (this.rootId == c) { + return 0; + } + this.skipLock = true; + var a = this._globalIdStorageFind(c); + if (!a) { + return 0; + } + if (a.closeble) { + this._HideShow(a, 1); + } + this.skipLock = false; +}; +dhtmlXTreeObject.prototype.getLevel = function (c) { + var a = this._globalIdStorageFind(c); + if (!a) { + return 0; + } + return this._getNodeLevel(a, 0); +}; +dhtmlXTreeObject.prototype.setItemCloseable = function (e, a) { + a = dhx4.s2b(a); + if (e && e.span) { + var c = e; + } else { + var c = this._globalIdStorageFind(e); + } + if (!c) { + return 0; + } + c.closeble = a; +}; +dhtmlXTreeObject.prototype._getNodeLevel = function (a, c) { + if (a.parentObject) { + return this._getNodeLevel(a.parentObject, c + 1); + } + return c; +}; +dhtmlXTreeObject.prototype.hasChildren = function (c) { + var a = this._globalIdStorageFind(c); + if (!a) { + return 0; + } else { + if (this.XMLsource && !a.XMLload) { + return true; + } else { + return a.childsCount; + } + } +}; +dhtmlXTreeObject.prototype._getLeafCount = function (g) { + var e = 0; + for (var c = 0; c < g.childsCount; c++) { + if (g.childNodes[c].childsCount == 0) { + e++; + } + } + return e; +}; +dhtmlXTreeObject.prototype.setItemText = function (g, e, c) { + var a = this._globalIdStorageFind(g); + if (!a) { + return 0; + } + a.label = e; + a.span.innerHTML = e; + if (this.childCalc) { + this._fixChildCountLabel(a); + } + a.span.parentNode.parentNode.title = c || ""; +}; +dhtmlXTreeObject.prototype.getItemTooltip = function (c) { + var a = this._globalIdStorageFind(c); + if (!a) { + return ""; + } + return a.span.parentNode.parentNode._dhx_title || a.span.parentNode.parentNode.title || ""; +}; +dhtmlXTreeObject.prototype.refreshItem = function (c) { + if (!c) { + c = this.rootId; + } + var a = this._globalIdStorageFind(c); + this._dynDeleteBranches[c] = (this._dynDeleteBranches[c] || 0) + 1; + this._loadDynXML(c); +}; +dhtmlXTreeObject.prototype.setItemImage2 = function (g, a, h, e) { + var c = this._globalIdStorageFind(g); + if (!c) { + return 0; + } + c.images[1] = h; + c.images[2] = e; + c.images[0] = a; + this._correctPlus(c); +}; +dhtmlXTreeObject.prototype.setItemImage = function (e, a, g) { + var c = this._globalIdStorageFind(e); + if (!c) { + return 0; + } + if (g) { + c.images[1] = a; + c.images[2] = g; + } else { + c.images[0] = a; + } + this._correctPlus(c); +}; +dhtmlXTreeObject.prototype.getSubItems = function (e) { + var a = this._globalIdStorageFind(e, 0, 1); + if (!a) { + return 0; + } + if (a.unParsed) { + return this._getSubItemsXML(a.unParsed); + } + var c = ""; + for (i = 0; i < a.childsCount; i++) { + if (!c) { + c = "" + a.childNodes[i].id; + } else { + c += this.dlmtr + a.childNodes[i].id; + } + } + return c; +}; +dhtmlXTreeObject.prototype._getAllScraggyItems = function (e) { + var g = ""; + for (var c = 0; c < e.childsCount; c++) { + if (e.childNodes[c].unParsed || e.childNodes[c].childsCount > 0) { + if (e.childNodes[c].unParsed) { + var a = this._getAllScraggyItemsXML(e.childNodes[c].unParsed, 1); + } else { + var a = this._getAllScraggyItems(e.childNodes[c]); + } + if (a) { + if (g) { + g += this.dlmtr + a; + } else { + g = a; + } + } + } else { + if (!g) { + g = "" + e.childNodes[c].id; + } else { + g += this.dlmtr + e.childNodes[c].id; + } + } + } + return g; +}; +dhtmlXTreeObject.prototype._getAllFatItems = function (e) { + var g = ""; + for (var c = 0; c < e.childsCount; c++) { + if (e.childNodes[c].unParsed || e.childNodes[c].childsCount > 0) { + if (!g) { + g = "" + e.childNodes[c].id; + } else { + g += this.dlmtr + e.childNodes[c].id; + } + if (e.childNodes[c].unParsed) { + var a = this._getAllFatItemsXML(e.childNodes[c].unParsed, 1); + } else { + var a = this._getAllFatItems(e.childNodes[c]); + } + if (a) { + g += this.dlmtr + a; + } + } + } + return g; +}; +dhtmlXTreeObject.prototype._getAllSubItems = function (j, h, g) { + if (g) { + c = g; + } else { + var c = this._globalIdStorageFind(j); + } + if (!c) { + return 0; + } + h = ""; + for (var e = 0; e < c.childsCount; e++) { + if (!h) { + h = "" + c.childNodes[e].id; + } else { + h += this.dlmtr + c.childNodes[e].id; + } + var a = this._getAllSubItems(0, h, c.childNodes[e]); + if (a) { + h += this.dlmtr + a; + } + } + if (c.unParsed) { + h = this._getAllSubItemsXML(j, h, c.unParsed); + } + return h; +}; +dhtmlXTreeObject.prototype.selectItem = function (g, e, c) { + e = dhx4.s2b(e); + var a = this._globalIdStorageFind(g); + if (!a || !a.parentObject) { + return 0; + } + if (this.XMLloadingWarning) { + a.parentObject.openMe = 1; + } else { + this._openItem(a.parentObject); + } + var h = null; + if (c) { + h = new Object(); + h.ctrlKey = true; + if (a.i_sel) { + h.skipUnSel = true; + } + } + if (e) { + this.onRowSelect(h, a.htmlNode.childNodes[0].childNodes[0].childNodes[3], false); + } else { + this.onRowSelect(h, a.htmlNode.childNodes[0].childNodes[0].childNodes[3], true); + } +}; +dhtmlXTreeObject.prototype.getSelectedItemText = function () { + var c = new Array(); + for (var a = 0; a < this._selected.length; a++) { + c[a] = this._selected[a].span.innerHTML; + } + return c.join(this.dlmtr); +}; +dhtmlXTreeObject.prototype._compressChildList = function (a, e) { + a--; + for (var c = 0; c < a; c++) { + if (e[c] == 0) { + e[c] = e[c + 1]; + e[c + 1] = 0; + } + } +}; +dhtmlXTreeObject.prototype._deleteNode = function (l, h, n) { + if (!h || !h.parentObject) { + return 0; + } + var a = 0; + var c = 0; + if (h.tr.nextSibling) { + a = h.tr.nextSibling.nodem; + } + if (h.tr.previousSibling) { + c = h.tr.previousSibling.nodem; + } + var j = h.parentObject; + var e = j.childsCount; + var m = j.childNodes; + for (var g = 0; g < e; g++) { + if (m[g].id == l) { + if (!n) { + j.htmlNode.childNodes[0].removeChild(m[g].tr); + } + m[g] = 0; + break; + } + } + this._compressChildList(e, m); + if (!n) { + j.childsCount--; + } + if (a) { + this._correctPlus(a); + this._correctLine(a); + } + if (c) { + this._correctPlus(c); + this._correctLine(c); + } + if (this.tscheck) { + this._correctCheckStates(j); + } + if (!n) { + this._globalIdStorageRecSub(h); + } +}; +dhtmlXTreeObject.prototype.setCheck = function (e, c) { + var a = this._globalIdStorageFind(e, 0, 1); + if (!a) { + return; + } + if (c === "unsure") { + this._setCheck(a, c); + } else { + c = dhx4.s2b(c); + if (this.tscheck && this.smcheck) { + this._setSubChecked(c, a); + } else { + this._setCheck(a, c); + } + } + if (this.smcheck) { + this._correctCheckStates(a.parentObject); + } +}; +dhtmlXTreeObject.prototype._setCheck = function (a, e) { + if (!a) { + return; + } + if ((a.parentObject._r_logic || this._frbtr) && e) { + if (this._frbtrs) { + if (this._frbtrL) { + this.setCheck(this._frbtrL.id, 0); + } + this._frbtrL = a; + } else { + for (var c = 0; c < a.parentObject.childsCount; c++) { + this._setCheck(a.parentObject.childNodes[c], 0); + } + } + } + var g = a.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0]; + if (e == "unsure") { + a.checkstate = 2; + } else { + if (e) { + a.checkstate = 1; + } else { + a.checkstate = 0; + } + } + if (a.dscheck) { + a.checkstate = a.dscheck; + } + this._setSrc(g, this.imPath + (a.parentObject._r_logic || this._frbtr ? this.radioArray : this.checkArray)[a.checkstate]); +}; +dhtmlXTreeObject.prototype.setSubChecked = function (e, c) { + var a = this._globalIdStorageFind(e); + this._setSubChecked(c, a); + this._correctCheckStates(a.parentObject); +}; +dhtmlXTreeObject.prototype._setSubChecked = function (e, a) { + e = dhx4.s2b(e); + if (!a) { + return; + } + if ((a.parentObject._r_logic || this._frbtr) && e) { + for (var c = 0; c < a.parentObject.childsCount; c++) { + this._setSubChecked(0, a.parentObject.childNodes[c]); + } + } + if (a.unParsed) { + this._setSubCheckedXML(e, a.unParsed); + } + if (a._r_logic || this._frbtr) { + this._setSubChecked(e, a.childNodes[0]); + } else { + for (var c = 0; c < a.childsCount; c++) { + this._setSubChecked(e, a.childNodes[c]); + } + } + var g = a.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0]; + if (e) { + a.checkstate = 1; + } else { + a.checkstate = 0; + } + if (a.dscheck) { + a.checkstate = a.dscheck; + } + this._setSrc(g, this.imPath + (a.parentObject._r_logic || this._frbtr ? this.radioArray : this.checkArray)[a.checkstate]); +}; +dhtmlXTreeObject.prototype.isItemChecked = function (c) { + var a = this._globalIdStorageFind(c); + if (!a) { + return; + } + return a.checkstate; +}; +dhtmlXTreeObject.prototype.deleteChildItems = function (g) { + var a = this._globalIdStorageFind(g); + if (!a) { + return; + } + var c = a.childsCount; + for (var e = 0; e < c; e++) { + this._deleteNode(a.childNodes[0].id, a.childNodes[0]); + } +}; +dhtmlXTreeObject.prototype.deleteItem = function (e, a) { + if (!this._onrdlh || this._onrdlh(e)) { + var c = this._deleteItem(e, a); + if (c) { + this._fixChildCountLabel(c); + } + } + this.allTree.childNodes[0].border = "1"; + this.allTree.childNodes[0].border = "0"; +}; +dhtmlXTreeObject.prototype._deleteItem = function (j, c, h) { + c = dhx4.s2b(c); + var a = this._globalIdStorageFind(j); + if (!a) { + return; + } + var e = this.getParentId(j); + var g = a.parentObject; + this._deleteNode(j, a, h); + if (this._editCell && this._editCell.id == j) { + this._editCell = null; + } + this._correctPlus(g); + this._correctLine(g); + if (c && e != this.rootId) { + this.selectItem(e, 1); + } + return g; +}; +dhtmlXTreeObject.prototype._globalIdStorageRecSub = function (a) { + for (var c = 0; c < a.childsCount; c++) { + this._globalIdStorageRecSub(a.childNodes[c]); + this._globalIdStorageSub(a.childNodes[c].id); + } + this._globalIdStorageSub(a.id); + var e = a; + e.span = null; + e.tr.nodem = null; + e.tr = null; + e.htmlNode = null; +}; +dhtmlXTreeObject.prototype.insertNewNext = function (m, r, o, e, j, h, g, c, a) { + var l = this._globalIdStorageFind(m); + if (!l || !l.parentObject) { + return 0; + } + var n = this._attachChildNode(0, r, o, e, j, h, g, c, a, l); + if (!this.XMLloadingWarning && this.childCalc) { + this._fixChildCountLabel(l.parentObject); + } + return n; +}; +dhtmlXTreeObject.prototype.getItemIdByIndex = function (e, a) { + var c = this._globalIdStorageFind(e); + if (!c || a >= c.childsCount) { + return null; + } + return c.childNodes[a].id; +}; +dhtmlXTreeObject.prototype.getChildItemIdByIndex = function (e, a) { + var c = this._globalIdStorageFind(e); + if (!c || a >= c.childsCount) { + return null; + } + return c.childNodes[a].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.selectionBar.style.display = "none"; + this.allTree.className = this.allTree.className.replace(" selectionBox", ""); +}; +dhtmlXTreeObject.prototype.enableDragAndDrop = function (c, a) { + if (c == "temporary_disabled") { + this.dADTempOff = false; + c = true; + } else { + this.dADTempOff = true; + } + this.dragAndDropOff = dhx4.s2b(c); + if (this.dragAndDropOff) { + this.dragger.addDragLanding(this.allTree, this); + } + if (arguments.length > 1) { + this._ddronr = !dhx4.s2b(a); + } +}; +dhtmlXTreeObject.prototype._setMove = function (h, e, l) { + if (h.parentObject.span) { + var g = dhx4.absTop(h); + var c = dhx4.absTop(this.allTree) - this.allTree.scrollTop; + this.dadmodec = this.dadmode; + this.dadmodefix = 0; + if (this.dadmode == 2) { + var j = l - g + (document.body.scrollTop || document.documentElement.scrollTop) - 2 - h.offsetHeight / 2; + if (Math.abs(j) - h.offsetHeight / 6 > 0) { + this.dadmodec = 1; + if (j < 0) { + this.dadmodefix = 0 - h.offsetHeight; + } + } else { + this.dadmodec = 0; + } + } + if (this.dadmodec == 0) { + var a = h.parentObject.span; + a.className += " dragAndDropRow"; + this._lastMark = a; + } else { + this._clearMove(); + this.selectionBar.style.top = g - c + ((parseInt(h.parentObject.span.parentNode.previousSibling.childNodes[0].style.height) || 18) - 1) + this.dadmodefix + "px"; + this.selectionBar.style.left = "5px"; + if (this.allTree.offsetWidth > 20) { + this.selectionBar.style.width = this.allTree.offsetWidth - (_isFF ? 30 : 25) + "px"; + } + this.selectionBar.style.display = ""; + } + this._autoScroll(null, g, c); + } +}; +dhtmlXTreeObject.prototype._autoScroll = function (e, c, a) { + if (this.autoScroll) { + if (e) { + c = dhx4.absTop(e); + a = dhx4.absTop(this.allTree) - this.allTree.scrollTop; + } + if (c - a - parseInt(this.allTree.scrollTop) > parseInt(this.allTree.offsetHeight) - 50) { + this.allTree.scrollTop = parseInt(this.allTree.scrollTop) + 20; + } + if (c - a < parseInt(this.allTree.scrollTop) + 30) { + this.allTree.scrollTop = parseInt(this.allTree.scrollTop) - 20; + } + } +}; +dhtmlXTreeObject.prototype._createDragNode = function (j, h) { + if (!this.dADTempOff) { + return null; + } + var g = j.parentObject; + if (!this.callEvent("onBeforeDrag", [g.id, h])) { + return null; + } + if (!g.i_sel) { + this._selectItem(g, h); + } + this._checkMSelectionLogic(); + var c = document.createElement("div"); + var l = new Array(); + if (this._itim_dg) { + for (var a = 0; a < this._selected.length; a++) { + l[a] = + "
" + + this._selected[a].span.innerHTML + + "
"; + } + } else { + l = this.getSelectedItemText().split(this.dlmtr); + } + c.innerHTML = l.join(""); + c.style.position = "absolute"; + c.className = "dragSpanDiv"; + this._dragged = new Array().concat(this._selected); + return c; +}; +dhtmlXTreeObject.prototype._focusNode = function (a) { + var c = dhx4.absTop(a.htmlNode) - dhx4.absTop(this.allTree); + if (c > this.allTree.offsetHeight - 30 || c < 0) { + this.allTree.scrollTop = c + this.allTree.scrollTop; + } +}; +dhtmlXTreeObject.prototype._preventNsDrag = function (a) { + if (a && a.preventDefault) { + a.preventDefault(); + return false; + } + return false; +}; +dhtmlXTreeObject.prototype._drag = function (l, m, a) { + if (this._autoOpenTimer) { + clearTimeout(this._autoOpenTimer); + } + if (!a.parentObject) { + a = this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0]; + this.dadmodec = 0; + } + this._clearMove(); + var j = l.parentObject.treeNod; + if (j && j._clearMove) { + j._clearMove(""); + } + if (!this.dragMove || this.dragMove()) { + if (!j || !j._clearMove || !j._dragged) { + var g = new Array(l.parentObject); + } else { + var g = j._dragged; + } + var c = a.parentObject; + for (var h = 0; h < g.length; h++) { + var e = this._moveNode(g[h], c); + if (this.dadmodec && e !== false) { + c = this._globalIdStorageFind(e, true, true); + } + if (e && !this._sADnD) { + this.selectItem(e, 0, 1); + } + } + } + if (j) { + j._dragged = new Array(); + } +}; +dhtmlXTreeObject.prototype._dragIn = function (g, c, j, h) { + if (!this.dADTempOff) { + return 0; + } + var l = c.parentObject; + var a = g.parentObject; + if (!a && this._ddronr) { + return; + } + if (!this.callEvent("onDragIn", [l.id, a ? a.id : null, l.treeNod, this])) { + if (a) { + this._autoScroll(g); + } + return 0; + } + if (!a) { + this.allTree.className += " selectionBox"; + } else { + if (l.childNodes == null) { + this._setMove(g, j, h); + return g; + } + var n = l.treeNod; + for (var e = 0; e < n._dragged.length; e++) { + if (this._checkPNodes(a, n._dragged[e])) { + this._autoScroll(g); + return 0; + } + } + this.selectionBar.parentNode.removeChild(this.selectionBar); + a.span.parentNode.appendChild(this.selectionBar); + this._setMove(g, j, h); + if (this._getOpenState(a) <= 0) { + var m = this; + this._autoOpenId = a.id; + this._autoOpenTimer = window.setTimeout(function () { + m._autoOpenItem(null, m); + m = null; + }, 1000); + } + } + return g; +}; +dhtmlXTreeObject.prototype._autoOpenItem = function (c, a) { + a.openItem(a._autoOpenId); +}; +dhtmlXTreeObject.prototype._dragOut = function (a) { + this._clearMove(); + if (this._autoOpenTimer) { + clearTimeout(this._autoOpenTimer); + } +}; +dhtmlXTreeObject.prototype._getNextNode = function (a, c) { + if (!c && a.childsCount) { + return a.childNodes[0]; + } + if (a == this.htmlNode) { + return -1; + } + if (a.tr && a.tr.nextSibling && a.tr.nextSibling.nodem) { + return a.tr.nextSibling.nodem; + } + return this._getNextNode(a.parentObject, true); +}; +dhtmlXTreeObject.prototype._lastChild = function (a) { + if (a.childsCount) { + return this._lastChild(a.childNodes[a.childsCount - 1]); + } else { + return a; + } +}; +dhtmlXTreeObject.prototype._getPrevNode = function (a, c) { + if (a.tr && a.tr.previousSibling && a.tr.previousSibling.nodem) { + return this._lastChild(a.tr.previousSibling.nodem); + } + if (a.parentObject) { + return a.parentObject; + } else { + return -1; + } +}; +dhtmlXTreeObject.prototype.findItem = function (a, e, c) { + var g = this._findNodeByLabel(a, e, c ? this.htmlNode : null); + if (g) { + this.selectItem(g.id, true); + this._focusNode(g); + return g.id; + } else { + return null; + } +}; +dhtmlXTreeObject.prototype.findItemIdByLabel = function (a, e, c) { + var g = this._findNodeByLabel(a, e, c ? this.htmlNode : null); + if (g) { + return g.id; + } else { + return null; + } +}; +dhtmlXTreeObject.prototype.findStrInXML = function (c, e, h) { + if (!c.childNodes && c.item) { + return this.findStrInJSON(c, e, h); + } + if (!c.childNodes) { + return false; + } + for (var a = 0; a < c.childNodes.length; a++) { + if (c.childNodes[a].nodeType == 1) { + var g = c.childNodes[a].getAttribute(e); + if (!g && c.childNodes[a].tagName == "itemtext") { + g = c.childNodes[a].firstChild.data; + } + if (g && g.toLowerCase().search(h) != -1) { + return true; + } + if (this.findStrInXML(c.childNodes[a], e, h)) { + return true; + } + } + } + return false; +}; +dhtmlXTreeObject.prototype.findStrInJSON = function (c, e, h) { + for (var a = 0; a < c.item.length; a++) { + var g = c.item[a].text; + if (g && g.toLowerCase().search(h) != -1) { + return true; + } + if (c.item[a].item && this.findStrInJSON(c.item[a], e, h)) { + return true; + } + } + return false; +}; +dhtmlXTreeObject.prototype._findNodeByLabel = function (a, h, g) { + var a = a.replace(new RegExp("^( )+"), "").replace(new RegExp("( )+$"), ""); + a = new RegExp(a.replace(/([\^\.\?\*\+\\\[\]\(\)]{1})/gi, "\\$1").replace(/ /gi, ".*"), "gi"); + if (!g) { + g = this._selected[0]; + if (!g) { + g = this.htmlNode; + } + } + var c = g; + if (!h) { + if (g.unParsed && this.findStrInXML(g.unParsed.d, "text", a)) { + this.reParse(g); + } + g = this._getNextNode(c); + if (g == -1) { + g = this.htmlNode.childNodes[0]; + } + } else { + var e = this._getPrevNode(c); + if (e == -1) { + e = this._lastChild(this.htmlNode); + } + if (e.unParsed && this.findStrInXML(e.unParsed.d, "text", a)) { + this.reParse(e); + g = this._getPrevNode(c); + } else { + g = e; + } + if (g == -1) { + g = this._lastChild(this.htmlNode); + } + } + while (g && g != c) { + if (g.label && g.label.search(a) != -1) { + return g; + } + if (!h) { + if (g == -1) { + if (c == this.htmlNode) { + break; + } + g = this.htmlNode.childNodes[0]; + } + if (g.unParsed && this.findStrInXML(g.unParsed.d, "text", a)) { + this.reParse(g); + } + g = this._getNextNode(g); + if (g == -1) { + g = this.htmlNode; + } + } else { + var e = this._getPrevNode(g); + if (e == -1) { + e = this._lastChild(this.htmlNode); + } + if (e.unParsed && this.findStrInXML(e.unParsed.d, "text", a)) { + this.reParse(e); + g = this._getPrevNode(g); + } else { + g = e; + } + if (g == -1) { + g = this._lastChild(this.htmlNode); + } + } + } + return null; +}; +dhtmlXTreeObject.prototype.moveItem = function (m, c, n, a) { + var h = this._globalIdStorageFind(m); + if (!h) { + return 0; + } + var j = null; + switch (c) { + case "right": + alert("Not supported yet"); + break; + case "item_child": + var e = (a || this)._globalIdStorageFind(n); + if (!e) { + return 0; + } + j = (a || this)._moveNodeTo(h, e, 0); + break; + case "item_sibling": + var e = (a || this)._globalIdStorageFind(n); + if (!e) { + return 0; + } + j = (a || this)._moveNodeTo(h, e.parentObject, e); + break; + case "item_sibling_next": + var e = (a || this)._globalIdStorageFind(n); + if (!e) { + return 0; + } + if (e.tr && e.tr.nextSibling && e.tr.nextSibling.nodem) { + j = (a || this)._moveNodeTo(h, e.parentObject, e.tr.nextSibling.nodem); + } else { + j = (a || this)._moveNodeTo(h, e.parentObject); + } + break; + case "left": + if (h.parentObject.parentObject) { + j = this._moveNodeTo(h, h.parentObject.parentObject, h.parentObject); + } + break; + case "up": + var l = this._getPrevNode(h); + if (l == -1 || !l.parentObject) { + return null; + } + j = this._moveNodeTo(h, l.parentObject, l); + break; + case "up_strict": + var l = this._getIndex(h); + if (l != 0) { + j = this._moveNodeTo(h, h.parentObject, h.parentObject.childNodes[l - 1]); + } + break; + case "down_strict": + var l = this._getIndex(h); + var g = h.parentObject.childsCount - 2; + if (l == g) { + j = this._moveNodeTo(h, h.parentObject); + } else { + if (l < g) { + j = this._moveNodeTo(h, h.parentObject, h.parentObject.childNodes[l + 2]); + } + } + break; + case "down": + var l = this._getNextNode(this._lastChild(h)); + if (l == -1 || !l.parentObject) { + return; + } + if (l.parentObject == h.parentObject) { + var l = this._getNextNode(l); + } + if (l == -1) { + j = this._moveNodeTo(h, h.parentObject); + } else { + if (l == -1 || !l.parentObject) { + return; + } + j = this._moveNodeTo(h, l.parentObject, l); + } + break; + } + if (_isIE && _isIE < 8) { + this.allTree.childNodes[0].border = "1"; + this.allTree.childNodes[0].border = "0"; + } + return j; +}; +dhtmlXTreeObject.prototype.setDragBehavior = function (c, a) { + this._sADnD = !dhx4.s2b(a); + switch (c) { + case "child": + this.dadmode = 0; + break; + case "sibling": + this.dadmode = 1; + break; + case "complex": + this.dadmode = 2; + break; + } +}; +dhtmlXTreeObject.prototype._loadDynXML = function (e, c) { + c = c || this.XMLsource; + var a = new Date().valueOf(); + this._ld_id = e; + if (this.xmlalb == "function") { + if (c) { + c(this._escape(e)); + } + } else { + if (this.xmlalb == "name") { + this.load(c + this._escape(e)); + } else { + if (this.xmlalb == "xmlname") { + this.load(c + this._escape(e) + ".xml?uid=" + a); + } else { + this.load(c + dhtmlx.url(c) + "uid=" + a + "&id=" + this._escape(e)); + } + } + } +}; +dhtmlXTreeObject.prototype.enableMultiselection = function (c, a) { + this._amsel = dhx4.s2b(c); + this._amselS = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype._checkMSelectionLogic = function () { + var e = new Array(); + for (var c = 0; c < this._selected.length; c++) { + for (var a = 0; a < this._selected.length; a++) { + if (c != a && this._checkPNodes(this._selected[a], this._selected[c])) { + e[e.length] = this._selected[a]; + } + } + } + for (var c = 0; c < e.length; c++) { + this._unselectItem(e[c]); + } +}; +dhtmlXTreeObject.prototype._checkPNodes = function (c, a) { + if (this._dcheckf) { + return false; + } + if (a == c) { + return 1; + } + if (c.parentObject) { + return this._checkPNodes(c.parentObject, a); + } else { + return 0; + } +}; +dhtmlXTreeObject.prototype.disableDropCheck = function (a) { + this._dcheckf = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.enableDistributedParsing = function (e, c, a) { + this._edsbps = dhx4.s2b(e); + this._edsbpsA = new Array(); + this._edsbpsC = c || 10; + this._edsbpsD = a || 250; +}; +dhtmlXTreeObject.prototype.getDistributedParsingState = function () { + return !(!this._edsbpsA || !this._edsbpsA.length); +}; +dhtmlXTreeObject.prototype.getItemParsingState = function (e) { + var c = this._globalIdStorageFind(e, true, true); + if (!c) { + return 0; + } + if (this._edsbpsA) { + for (var a = 0; a < this._edsbpsA.length; a++) { + if (this._edsbpsA[a][2] == e) { + return -1; + } + } + } + return 1; +}; +dhtmlXTreeObject.prototype._distributedStart = function (c, h, g, e, a) { + if (!this._edsbpsA) { + this._edsbpsA = new Array(); + } + this._edsbpsA[this._edsbpsA.length] = [c, h, g, e, a]; +}; +dhtmlXTreeObject.prototype._distributedStep = function (g) { + var c = this; + if (!this._edsbpsA || !this._edsbpsA.length) { + c.XMLloadingWarning = 0; + return; + } + var h = this._edsbpsA[0]; + this.parsedArray = new Array(); + this._parse(h[0], h[2], h[3], h[1]); + var a = this._globalIdStorageFind(h[2]); + this._redrawFrom(this, a, h[4], this._getOpenState(a)); + var e = this.setCheckList.split(this.dlmtr); + for (var j = 0; j < e.length; j++) { + if (e[j]) { + this.setCheck(e[j], 1); + } + } + this._edsbpsA = new Array().concat(this._edsbpsA.slice(1)); + if (!this._edsbpsA.length) { + window.setTimeout(function () { + if (c.onXLE) { + c.onXLE(c, g); + } + c.callEvent("onXLE", [c, g]); + }, 1); + c.xmlstate = 0; + } +}; +dhtmlXTreeObject.prototype.enableTextSigns = function (a) { + this._txtimg = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.preventIECaching = function (a) { + dhx4.ajax.cache = !a; +}; +dhtmlXTreeObject.prototype.preventIECashing = dhtmlXTreeObject.prototype.preventIECaching; +dhtmlXTreeObject.prototype.disableCheckbox = function (e, c) { + if (typeof e != "object") { + var a = this._globalIdStorageFind(e, 0, 1); + } else { + var a = e; + } + if (!a) { + return; + } + a.dscheck = dhx4.s2b(c) ? ((a.checkstate || 0) % 3) + 3 : a.checkstate > 2 ? a.checkstate - 3 : a.checkstate; + this._setCheck(a); + if (a.dscheck < 3) { + a.dscheck = false; + } +}; +dhtmlXTreeObject.prototype.smartRefreshBranch = function (c, a) { + this._branchUpdate = 1; + this.smartRefreshItem(c, a); +}; +dhtmlXTreeObject.prototype.smartRefreshItem = function (g, e) { + var a = this._globalIdStorageFind(g); + for (var c = 0; c < a.childsCount; c++) { + a.childNodes[c]._dmark = true; + } + this.waitUpdateXML = true; + if (e && e.exists) { + this._parse(e, g); + } else { + this._loadDynXML(g, e); + } +}; +dhtmlXTreeObject.prototype.refreshItems = function (c, e) { + var g = c.toString().split(this.dlmtr); + this.waitUpdateXML = new Array(); + for (var a = 0; a < g.length; a++) { + this.waitUpdateXML[g[a]] = true; + } + this.load((e || this.XMLsource) + dhtmlx.url(e || this.XMLsource) + "ids=" + this._escape(c)); +}; +dhtmlXTreeObject.prototype.updateItem = function (l, j, g, e, c, h, m) { + var a = this._globalIdStorageFind(l); + a.userData = new cObject(); + if (j) { + a.label = j; + } + a.images = new Array(g || this.imageArray[0], e || this.imageArray[1], c || this.imageArray[2]); + this.setItemText(l, j); + if (h) { + this._setCheck(a, true); + } + if (m == "1" && !this.hasChildren(l)) { + a.XMLload = 0; + } + this._correctPlus(a); + a._dmark = false; + return a; +}; +dhtmlXTreeObject.prototype.setDropHandler = function (a) { + this.attachEvent("onDrop", a); +}; +dhtmlXTreeObject.prototype.setOnLoadingStart = function (a) { + this.attachEvent("onXLS", a); +}; +dhtmlXTreeObject.prototype.setOnLoadingEnd = function (a) { + this.attachEvent("onXLE", a); +}; +dhtmlXTreeObject.prototype.setXMLAutoLoadingBehaviour = function (a) { + this.xmlalb = a; +}; +dhtmlXTreeObject.prototype.enableSmartCheckboxes = function (a) { + this.smcheck = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.getXMLState = function () { + return this.xmlstate == 1; +}; +dhtmlXTreeObject.prototype.setItemTopOffset = function (j, g) { + var e; + if (typeof j != "object") { + e = this._globalIdStorageFind(j); + } else { + e = j; + } + var h = e.span.parentNode.parentNode; + e.span.style.paddingBottom = "1px"; + for (var c = 0; c < h.childNodes.length; c++) { + if (c != 0) { + if (_isIE) { + h.childNodes[c].style.height = "18px"; + h.childNodes[c].style.paddingTop = parseInt(g) + "px"; + } else { + h.childNodes[c].style.height = 18 + parseInt(g) + "px"; + } + } else { + var a = h.childNodes[c].firstChild; + if (h.childNodes[c].firstChild.tagName != "DIV") { + a = document.createElement("DIV"); + h.childNodes[c].insertBefore(a, h.childNodes[c].firstChild); + } + if ((e.parentObject.id != this.rootId || e.parentObject.childNodes[0] != e) && this.treeLinesOn) { + h.childNodes[c].style.backgroundImage = "url(" + this.imPath + this.lineArray[5] + ")"; + } + a.innerHTML = " "; + a.style.overflow = "hidden"; + } + a.style.verticalAlign = h.childNodes[c].style.verticalAlign = "bottom"; + if (_isIE) { + this.allTree.childNodes[0].border = "1"; + this.allTree.childNodes[0].border = "0"; + } + } +}; +dhtmlXTreeObject.prototype.setIconSize = function (g, c, h) { + if (h) { + if (h && h.span) { + var a = h; + } else { + var a = this._globalIdStorageFind(h); + } + if (!a) { + return 0; + } + var e = a.span.parentNode.previousSibling.childNodes[0]; + if (g) { + e.style.width = g + "px"; + if (window._KHTMLrv) { + e.parentNode.style.width = g + "px"; + } + } + if (c) { + e.style.height = c + "px"; + if (window._KHTMLrv) { + e.parentNode.style.height = c + "px"; + } + } + } else { + this.def_img_x = g; + this.def_img_y = c; + } +}; +dhtmlXTreeObject.prototype.getItemImage = function (h, g, c) { + var e = this._globalIdStorageFind(h); + if (!e) { + return ""; + } + var a = e.images[g || 0]; + if (c) { + a = this.iconURL + a; + } + return a; +}; +dhtmlXTreeObject.prototype.enableRadioButtons = function (g, e) { + if (arguments.length == 1) { + this._frbtr = dhx4.s2b(g); + this.checkBoxOff = this.checkBoxOff || this._frbtr; + return; + } + var c = this._globalIdStorageFind(g); + if (!c) { + return ""; + } + e = dhx4.s2b(e); + if (e && !c._r_logic) { + c._r_logic = true; + for (var a = 0; a < c.childsCount; a++) { + this._setCheck(c.childNodes[a], c.childNodes[a].checkstate); + } + } + if (!e && c._r_logic) { + c._r_logic = false; + for (var a = 0; a < c.childsCount; a++) { + this._setCheck(c.childNodes[a], c.childNodes[a].checkstate); + } + } +}; +dhtmlXTreeObject.prototype.enableSingleRadioMode = function (a) { + this._frbtrs = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.openOnItemAdded = function (a) { + this._hAdI = !dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.openOnItemAdding = function (a) { + this._hAdI = !dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.enableMultiLineItems = function (a) { + if (a === true) { + this.mlitems = "100%"; + } else { + this.mlitems = a; + } +}; +dhtmlXTreeObject.prototype.enableAutoTooltips = function (a) { + this.ettip = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.clearSelection = function (a) { + if (a) { + this._unselectItem(this._globalIdStorageFind(a)); + } else { + this._unselectItems(); + } +}; +dhtmlXTreeObject.prototype.showItemSign = function (g, c) { + var a = this._globalIdStorageFind(g); + if (!a) { + return 0; + } + var e = a.span.parentNode.previousSibling.previousSibling.previousSibling; + if (!dhx4.s2b(c)) { + this._openItem(a); + a.closeble = false; + a.wsign = true; + } else { + a.closeble = true; + a.wsign = false; + } + this._correctPlus(a); +}; +dhtmlXTreeObject.prototype.showItemCheckbox = function (h, g) { + if (!h) { + for (var c in this._idpull) { + this.showItemCheckbox(this._idpull[c], g); + } + } + if (typeof h != "object") { + h = this._globalIdStorageFind(h, 0, 0); + } + if (!h) { + return 0; + } + h.nocheckbox = !dhx4.s2b(g); + var e = h.span.parentNode.previousSibling.previousSibling.childNodes[0]; + e.parentNode.style.display = !h.nocheckbox ? "" : "none"; +}; +dhtmlXTreeObject.prototype.setListDelimeter = function (a) { + this.dlmtr = a; +}; +dhtmlXTreeObject.prototype.setEscapingMode = function (a) { + this.utfesc = a; +}; +dhtmlXTreeObject.prototype.enableHighlighting = function (a) { + this.ehlt = true; + this.ehlta = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype._itemMouseOut = function () { + var c = this.childNodes[3].parentObject; + var a = c.treeNod; + a.callEvent("onMouseOut", [c.id]); + if (c.id == a._l_onMSI) { + a._l_onMSI = null; + } + if (!a.ehlta) { + return; + } + c.span.className = c.span.className.replace("_lor", ""); +}; +dhtmlXTreeObject.prototype._itemMouseIn = function () { + var c = this.childNodes[3].parentObject; + var a = c.treeNod; + if (a._l_onMSI != c.id) { + a.callEvent("onMouseIn", [c.id]); + } + a._l_onMSI = c.id; + if (!a.ehlta) { + return; + } + c.span.className = c.span.className.replace("_lor", ""); + c.span.className = c.span.className.replace(/((standart|selected)TreeRow)/, "$1_lor"); +}; +dhtmlXTreeObject.prototype.enableActiveImages = function (a) { + this._aimgs = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.focusItem = function (c) { + var a = this._globalIdStorageFind(c); + if (!a) { + return 0; + } + this._focusNode(a); +}; +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 (e) { + var g = ""; + for (var c = 0; c < e.childsCount; c++) { + if (e.childNodes[c].unParsed || e.childNodes[c].childsCount > 0) { + if (e.childNodes[c].unParsed) { + var a = this._getAllScraggyItemsXML(e.childNodes[c].unParsed, 1); + } else { + var a = this._getAllScraggyItems(e.childNodes[c]); + } + if (a) { + if (g) { + g += this.dlmtr + a; + } else { + g = a; + } + } + } else { + if (!g) { + g = "" + e.childNodes[c].id; + } else { + g += this.dlmtr + e.childNodes[c].id; + } + } + } + return g; +}; +dhtmlXTreeObject.prototype._getAllFatItems = function (e) { + var g = ""; + for (var c = 0; c < e.childsCount; c++) { + if (e.childNodes[c].unParsed || e.childNodes[c].childsCount > 0) { + if (!g) { + g = "" + e.childNodes[c].id; + } else { + g += this.dlmtr + e.childNodes[c].id; + } + if (e.childNodes[c].unParsed) { + var a = this._getAllFatItemsXML(e.childNodes[c].unParsed, 1); + } else { + var a = this._getAllFatItems(e.childNodes[c]); + } + if (a) { + g += this.dlmtr + a; + } + } + } + return g; +}; +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) { + if (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)]; + var c = this._getAllChecked("", "", 2); + if (c) { + a.push(c); + } + return a.join(this.dlmtr); +}; +dhtmlXTreeObject.prototype._getAllChecked = function (g, e, h) { + if (!g) { + g = this.htmlNode; + } + if (g.checkstate == h) { + if (!g.nocheckbox) { + if (e) { + e += this.dlmtr + g.id; + } else { + e = "" + g.id; + } + } + } + var a = g.childsCount; + for (var c = 0; c < a; c++) { + e = this._getAllChecked(g.childNodes[c], e, h); + } + if (g.unParsed) { + e = this._getAllCheckedXML(g.unParsed, e, h); + } + if (e) { + return e; + } else { + return ""; + } +}; +dhtmlXTreeObject.prototype.setItemStyle = function (g, e, c) { + var c = c || false; + var a = this._globalIdStorageFind(g); + if (!a) { + return 0; + } + if (!a.span.style.cssText) { + a.span.setAttribute("style", a.span.getAttribute("style") + "; " + e); + } else { + a.span.style.cssText = c ? e : a.span.style.cssText + ";" + e; + } +}; +dhtmlXTreeObject.prototype.enableImageDrag = function (a) { + this._itim_dg = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.setOnDragIn = function (a) { + this.attachEvent("onDragIn", a); +}; +dhtmlXTreeObject.prototype.enableDragAndDropScrolling = function (a) { + this.autoScroll = dhx4.s2b(a); +}; +dhtmlXTreeObject.prototype.setSkin = function (a) { + var c = this.parentObject.className.replace(/dhxtree_[^ ]*/gi, ""); + this.parentObject.className = c + " dhxtree_" + a; + if (a == "dhx_terrace" || a == "dhx_web") { + this.enableTreeLines(false); + } +}; +(function () { + dhtmlx.extend_api( + "dhtmlXTreeObject", + { + _init: function (a) { + return [a.parent, a.width || "100%", a.height || "100%", a.root_id || 0]; + }, + auto_save_selection: "enableAutoSavingSelected", + auto_tooltip: "enableAutoTooltips", + checkbox: "enableCheckBoxes", + checkbox_3_state: "enableThreeStateCheckboxes", + checkbox_smart: "enableSmartCheckboxes", + context_menu: "enableContextMenu", + distributed_parsing: "enableDistributedParsing", + drag: "enableDragAndDrop", + drag_copy: "enableMercyDrag", + drag_image: "enableImageDrag", + drag_scroll: "enableDragAndDropScrolling", + editor: "enableItemEditor", + hover: "enableHighlighting", + images: "enableTreeImages", + image_fix: "enableIEImageFix", + image_path: "setImagePath", + lines: "enableTreeLines", + loading_item: "enableLoadingItem", + multiline: "enableMultiLineItems", + multiselect: "enableMultiselection", + navigation: "enableKeyboardNavigation", + radio: "enableRadioButtons", + radio_single: "enableSingleRadioMode", + rtl: "enableRTL", + search: "enableKeySearch", + smart_parsing: "enableSmartXMLParsing", + smart_rendering: "enableSmartRendering", + text_icons: "enableTextSigns", + xml: "loadXML", + skin: "setSkin", + }, + {} + ); +})(); +dhtmlXTreeObject.prototype._dp_init = function (a) { + a.attachEvent("insertCallback", function (g, j, c) { + var e = dhx4.ajax.xpath(".//item", g); + var h = e[0].getAttribute("text"); + this.obj.insertNewItem(c, j, h, 0, 0, 0, 0, "CHILD"); + }); + a.attachEvent("updateCallback", function (g, j, c) { + var e = dhx4.ajax.xpath(".//item", g); + var h = e[0].getAttribute("text"); + this.obj.setItemText(j, h); + if (this.obj.getParentId(j) != c) { + this.obj.moveItem(j, "item_child", c); + } + this.setUpdated(j, true, "updated"); + }); + a.attachEvent("deleteCallback", function (e, g, c) { + this.obj.setUserData(g, this.action_param, "true_deleted"); + this.obj.deleteItem(g, false); + }); + a._methods = ["setItemStyle", "", "changeItemId", "deleteItem"]; + this.attachEvent("onEdit", function (c, e) { + if (c == 3) { + a.setUpdated(e, true); + } + return true; + }); + this.attachEvent("onDrop", function (j, h, g, e, c) { + if (e == c) { + a.setUpdated(j, true); + } + }); + this._onrdlh = function (c) { + var e = a.getState(c); + if (e == "inserted") { + a.set_invalid(c, false); + a.setUpdated(c, false); + return true; + } + if (e == "true_deleted") { + a.setUpdated(c, false); + return true; + } + a.setUpdated(c, true, "deleted"); + return false; + }; + this._onradh = function (c) { + a.setUpdated(c, true, "inserted"); + }; + a._getRowData = function (h) { + var g = {}; + var j = this.obj._globalIdStorageFind(h); + var e = j.parentObject; + var c = 0; + for (c = 0; c < e.childsCount; c++) { + if (e.childNodes[c] == j) { + break; + } + } + g.tr_id = j.id; + g.tr_pid = e.id; + g.tr_order = c; + g.tr_text = j.span.innerHTML; + e = (j._userdatalist || "").split(","); + for (c = 0; c < e.length; c++) { + g[e[c]] = j.userData["t_" + e[c]]; + } + return g; + }; +}; +if (typeof window.dhtmlXCellObject != "undefined") { + dhtmlXCellObject.prototype.attachTree = function (a) { + this.callEvent("_onBeforeContentAttach", ["tree"]); + var c = document.createElement("DIV"); + c.style.width = "100%"; + c.style.height = "100%"; + c.style.position = "relative"; + c.style.overflow = "hidden"; + this._attachObject(c); + this.dataType = "tree"; + this.dataObj = new dhtmlXTreeObject(c, "100%", "100%", a || 0); + this.dataObj.setSkin(this.conf.skin); + this.dataObj.allTree.childNodes[0].style.marginTop = "2px"; + this.dataObj.allTree.childNodes[0].style.marginBottom = "2px"; + c = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; + }; +} +dhtmlXTreeObject.prototype.makeDraggable = function (c, a) { + if (typeof c != "object") { + c = document.getElementById(c); + } + dragger = new dhtmlDragAndDropObject(); + dropper = new dhx_dragSomethingInTree(); + dragger.addDraggableItem(c, dropper); + c.dragLanding = null; + c.ondragstart = dropper._preventNsDrag; + c.onselectstart = new Function("return false;"); + c.parentObject = new Object(); + c.parentObject.img = c; + c.parentObject.treeNod = dropper; + dropper._customDrop = a; +}; +dhtmlXTreeObject.prototype.makeDragable = dhtmlXTreeObject.prototype.makeDraggable; +dhtmlXTreeObject.prototype.makeAllDraggable = function (c) { + var e = document.getElementsByTagName("div"); + for (var a = 0; a < e.length; a++) { + if (e[a].getAttribute("dragInDhtmlXTree")) { + this.makeDragable(e[a], c); + } + } +}; +function dhx_dragSomethingInTree() { + this.lWin = window; + this._createDragNode = function (c) { + var a = document.createElement("div"); + a.style.position = "absolute"; + a.innerHTML = c.innerHTML || c.value; + a.className = "dragSpanDiv"; + return a; + }; + this._preventNsDrag = function (a) { + (a || window.event).cancelBubble = true; + if (a && a.preventDefault) { + a.preventDefault(); + return false; + } + return false; + }; + this._nonTrivialNode = function (c, e, a, g) { + if (this._customDrop) { + return this._customDrop(c, g.img.id, e.id, a ? a.id : null); + } + var h = g.img.getAttribute("image") || ""; + var l = g.img.id || "new"; + var j = g.img.getAttribute("text") || (_isIE ? g.img.innerText : g.img.textContent); + c[a ? "insertNewNext" : "insertNewItem"](a ? a.id : e.id, l, j, "", h, h, h); + }; +} +dhtmlXTreeObject.prototype.enableItemEditor = function (a) { + this._eItEd = dhx4.s2b(a); + 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 (e, c) { + if (this._edn_dblclick) { + this._editItem(e, c); + } + return true; + }); + this.setOnClickHandler(function (e, c) { + this._stopEditItem(e, c); + if (this.ed_hist_clcik == e && this._edn_click_IE) { + this._editItem(e, c); + } + this.ed_hist_clcik = e; + return true; + }); + this._eItEdFlag = true; + } +}; +dhtmlXTreeObject.prototype.setOnEditHandler = function (a) { + this.attachEvent("onEdit", a); +}; +dhtmlXTreeObject.prototype.setEditStartAction = function (a, c) { + this._edn_click_IE = dhx4.s2b(a); + this._edn_dblclick = dhx4.s2b(c); +}; +dhtmlXTreeObject.prototype._stopEdit = function (c, j) { + if (this._editCell) { + this.dADTempOff = this.dADTempOffEd; + if (this._editCell.id != c) { + var g = true; + if (!j) { + g = this.callEvent("onEdit", [2, this._editCell.id, this, this._editCell.span.childNodes[0].value]); + } else { + g = false; + this.callEvent("onEditCancel", [this._editCell.id, this._editCell._oldValue]); + } + if (g === true) { + g = this._editCell.span.childNodes[0].value; + } else { + if (g === false) { + g = this._editCell._oldValue; + } + } + var h = g != this._editCell._oldValue; + this._editCell.span.innerHTML = g; + this._editCell.label = this._editCell.span.innerHTML; + var e = this._editCell.i_sel ? "selectedTreeRow" : "standartTreeRow"; + this._editCell.span.className = e; + 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 l = this._editCell.id; + if (this.childCalc) { + this._fixChildCountLabel(this._editCell); + } + this._editCell = null; + if (!j) { + this.callEvent("onEdit", [3, l, this, h]); + } + if (this._enblkbrd) { + this.parentObject.lastChild.focus(); + this.parentObject.lastChild.focus(); + } + } + } +}; +dhtmlXTreeObject.prototype._stopEditItem = function (c, a) { + this._stopEdit(c); +}; +dhtmlXTreeObject.prototype.stopEdit = function (a) { + if (this._editCell) { + this._stopEdit(this._editCell.id + "_non", a); + } +}; +dhtmlXTreeObject.prototype.editItem = function (a) { + this._editItem(a, this); +}; +dhtmlXTreeObject.prototype._editItem = function (h, a) { + if (this._eItEd) { + this._stopEdit(); + var e = this._globalIdStorageFind(h); + if (!e) { + return; + } + var g = this.callEvent("onEdit", [0, h, this, e.span.innerHTML]); + if (g === true) { + g = typeof e.span.innerText != "undefined" ? e.span.innerText : e.span.textContent; + } else { + if (g === false) { + return; + } + } + this.dADTempOffEd = this.dADTempOff; + this.dADTempOff = false; + this._editCell = e; + e._oldValue = g; + e.span.innerHTML = ""; + e.span.style.paddingRight = e.span.style.paddingLeft = "0px"; + e.span.onclick = e.span.ondblclick = function (j) { + (j || event).cancelBubble = true; + }; + e.span.childNodes[0].value = g; + e.span.childNodes[0].onselectstart = function (j) { + (j || event).cancelBubble = true; + return true; + }; + e.span.childNodes[0].onmousedown = function (j) { + (j || event).cancelBubble = true; + return true; + }; + e.span.childNodes[0].focus(); + e.span.childNodes[0].focus(); + e.span.onclick = function (j) { + (j || event).cancelBubble = true; + return false; + }; + e.span.className = ""; + e.span.parentNode.className = ""; + var c = this; + e.span.childNodes[0].onkeydown = function (j) { + if (!j) { + j = window.event; + } + if (j.keyCode == 13) { + j.cancelBubble = true; + c._stopEdit(window.undefined); + } else { + if (j.keyCode == 27) { + c._stopEdit(window.undefined, true); + } + } + (j || event).cancelBubble = true; + }; + this.callEvent("onEdit", [1, h, this]); + } +}; +function jsonPointer(c, a) { + this.d = c; + this.dp = a; +} +jsonPointer.prototype = { + text: function () { + var a = function (h) { + var g = []; + for (var e = 0; e < h.length; e++) { + g.push("{" + c(h[e]) + "}"); + } + return g.join(","); + }; + var c = function (h) { + var g = []; + for (var e in h) { + if (typeof h[e] == "object") { + if (e.length) { + g.push('"' + e + '":[' + a(h[e]) + "]"); + } else { + g.push('"' + e + '":{' + c(h[e]) + "}"); + } + } else { + g.push('"' + e + '":"' + h[e] + '"'); + } + } + return g.join(","); + }; + return "{" + c(this.d) + "}"; + }, + get: function (a) { + return this.d[a]; + }, + exists: function () { + return !!this.d; + }, + content: function () { + return this.d.content; + }, + each: function (g, l, j) { + var e = this.d[g]; + var m = new jsonPointer(); + if (e) { + for (var h = 0; h < e.length; h++) { + m.d = e[h]; + l.apply(j, [m, h]); + } + } + }, + get_all: function () { + return this.d; + }, + sub: function (a) { + return new jsonPointer(this.d[a], this.d); + }, + sub_exists: function (a) { + return !!this.d[a]; + }, + each_x: function (g, m, l, j, h) { + var e = this.d[g]; + var n = new jsonPointer(0, this.d); + if (e) { + for (h = h || 0; h < e.length; h++) { + if (e[h][m]) { + n.d = e[h]; + if (l.apply(j, [n, h]) == -1) { + return; + } + } + } + } + }, + up: function (a) { + return new jsonPointer(this.dp, this.d); + }, + set: function (a, c) { + this.d[a] = c; + }, + clone: function (a) { + return new jsonPointer(this.d, this.dp); + }, + through: function (e, l, o, h, r) { + var m = this.d[e]; + if (m.length) { + for (var g = 0; g < m.length; g++) { + if (m[g][l] != null && m[g][l] != "" && (!o || m[g][l] == o)) { + var j = new jsonPointer(m[g], this.d); + h.apply(r, [j, g]); + } + var n = this.d; + this.d = m[g]; + if (this.sub_exists(e)) { + this.through(e, l, o, h, r); + } + this.d = n; + } + } + }, +}; +dhtmlXTreeObject.prototype.loadJSArrayFile = function (a, c) { + if (window.console && window.console.info) { + window.console.info("loadJSArrayFile was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44"); + } + return this._loadJSArrayFile(a, c); +}; +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); + }); +}; +dhtmlXTreeObject.prototype.loadCSV = function (a, c) { + if (window.console && window.console.info) { + window.console.info("loadCSV was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44"); + } + return this._loadCSV(a, c); +}; +dhtmlXTreeObject.prototype._loadCSV = function (a, e) { + if (!this.parsCount) { + this.callEvent("onXLS", [this, this._ld_id]); + } + this._ld_id = null; + this.xmlstate = 1; + var c = this; + this.XMLLoader = function (g, h) { + this._loadCSVString(g.responseText); + if (h) { + h.call(this, g); + } + }; + dhx4.ajax.get(a, function (g) { + c.XMLLoader(g.xmlDoc, e); + }); +}; +dhtmlXTreeObject.prototype.loadJSArray = function (a, c) { + if (window.console && window.console.info) { + window.console.info("loadJSArray was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44"); + } + return this._loadJSArray(a, c); +}; +dhtmlXTreeObject.prototype._loadJSArray = function (a, g) { + var j = []; + for (var c = 0; c < a.length; c++) { + if (!j[a[c][1]]) { + j[a[c][1]] = []; + } + j[a[c][1]].push({ id: a[c][0], text: a[c][2] }); + } + var h = { id: this.rootId }; + var e = function (n, m) { + if (j[n.id]) { + n.item = j[n.id]; + for (var l = 0; l < n.item.length; l++) { + m(n.item[l], m); + } + } + }; + e(h, e); + this._loadJSONObject(h, g); +}; +dhtmlXTreeObject.prototype.loadCSVString = function (a, c) { + if (window.console && window.console.info) { + window.console.info("loadCSVString was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44"); + } + return this._loadCSVString(a, c); +}; +dhtmlXTreeObject.prototype._loadCSVString = function (a, j) { + var m = []; + var c = a.split("\n"); + for (var g = 0; g < c.length; g++) { + var e = c[g].split(","); + if (!m[e[1]]) { + m[e[1]] = []; + } + m[e[1]].push({ id: e[0], text: e[2] }); + } + var l = { id: this.rootId }; + var h = function (r, o) { + if (m[r.id]) { + r.item = m[r.id]; + for (var n = 0; n < r.item.length; n++) { + o(r.item[n], o); + } + } + }; + h(l, h); + this._loadJSONObject(l, j); +}; +dhtmlXTreeObject.prototype.loadJSONObject = function (a, c) { + if (window.console && window.console.info) { + window.console.info("loadJSONObject was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44"); + } + return this._loadJSONObject(a, c); +}; +dhtmlXTreeObject.prototype._loadJSONObject = function (a, c) { + if (!this.parsCount) { + this.callEvent("onXLS", [this, null]); + } + this.xmlstate = 1; + var e = new jsonPointer(a); + this._parse(e); + this._p = e; + if (c) { + c(); + } +}; +dhtmlXTreeObject.prototype.loadJSON = function (a, c) { + if (window.console && window.console.info) { + window.console.info("loadJSON was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44"); + } + return this._loadJSON(a, c); +}; +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); + }); +}; +dhtmlXTreeObject.prototype.serializeTreeToJSON = function () { + var a = ['{"id":"' + this.rootId + '", "item":[']; + var e = []; + for (var c = 0; c < this.htmlNode.childsCount; c++) { + e.push(this._serializeItemJSON(this.htmlNode.childNodes[c])); + } + a.push(e.join(",")); + a.push("]}"); + return a.join(""); +}; +dhtmlXTreeObject.prototype._serializeItemJSON = function (l) { + var a = []; + if (l.unParsed) { + return l.unParsed.text(); + } + if (this._selected.length) { + var e = this._selected[0].id; + } else { + e = ""; + } + var j = l.span.innerHTML; + j = j.replace(/\"/g, '\\"', j); + if (!this._xfullXML) { + a.push('{ "id":"' + l.id + '", ' + (this._getOpenState(l) == 1 ? ' "open":"1", ' : "") + (e == l.id ? ' "select":"1",' : "") + ' "text":"' + j + '"' + (this.XMLsource && l.XMLload == 0 ? ', "child":"1" ' : "")); + } else { + a.push( + '{ "id":"' + + l.id + + '", ' + + (this._getOpenState(l) == 1 ? ' "open":"1", ' : "") + + (e == l.id ? ' "select":"1",' : "") + + ' "text":"' + + j + + '", "im0":"' + + l.images[0] + + '", "im1":"' + + l.images[1] + + '", "im2":"' + + l.images[2] + + '" ' + + (l.acolor ? ', "aCol":"' + l.acolor + '" ' : "") + + (l.scolor ? ', "sCol":"' + l.scolor + '" ' : "") + + (l.checkstate == 1 ? ', "checked":"1" ' : l.checkstate == 2 ? ', "checked":"-1"' : "") + + (l.closeable ? ', "closeable":"1" ' : "") + + (this.XMLsource && l.XMLload == 0 ? ', "child":"1" ' : "") + ); + } + if (this._xuserData && l._userdatalist) { + a.push(', "userdata":['); + var h = l._userdatalist.split(","); + var g = []; + for (var c = 0; c < h.length; c++) { + g.push('{ "name":"' + h[c] + '" , "content":"' + l.userData["t_" + h[c]] + '" }'); + } + a.push(g.join(",")); + a.push("]"); + } + if (l.childsCount) { + a.push(', "item":['); + var g = []; + for (var c = 0; c < l.childsCount; c++) { + g.push(this._serializeItemJSON(l.childNodes[c])); + } + a.push(g.join(",")); + a.push("]\n"); + } + a.push("}\n"); + return a.join(""); +}; +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("" + cont + ""); + } + window[id] = t; + var oninit = obj.getAttribute("oninit"); + if (oninit) { + eval(oninit); + } + return t; +} +function dhx_init_trees() { + var c = document.getElementsByTagName("div"); + for (var a = 0; a < c.length; a++) { + if (c[a].className == "dhtmlxTree") { + dhtmlXTreeFromHTML(c[a]); + } + } +} +function dhx_li2trees(s, l, e) { + for (var m = 0; m < s.childNodes.length; m++) { + var r = s.childNodes[m]; + if (r.nodeType == 1 && r.tagName.toLowerCase() == "li") { + var o = ""; + var n = null; + var a = r.getAttribute("checked"); + for (var h = 0; h < r.childNodes.length; h++) { + var g = r.childNodes[h]; + if (g.nodeType == 3) { + o += g.data; + } else { + if (g.tagName.toLowerCase() != "ul") { + o += dhx_outer_html(g); + } else { + n = g; + } + } + } + l[l.length] = [e, o, a, r.id || l.length + 1]; + if (n) { + l = dhx_li2trees(n, l, r.id || l.length); + } + } + } + return l; +} +function dhx_outer_html(c) { + if (c.outerHTML) { + return c.outerHTML; + } + var a = document.createElement("DIV"); + a.appendChild(c.cloneNode(true)); + a = a.innerHTML; + return a; +} +if (window.addEventListener) { + window.addEventListener("load", dhx_init_trees, false); +} else { + if (window.attachEvent) { + window.attachEvent("onload", dhx_init_trees); + } +} +var globalActiveDHTMLGridObject; +String.prototype._dhx_trim = function () { + return this.replace(/ /g, " ").replace(/(^[ \t]*)|([ \t]*$)/g, ""); +}; +function dhtmlxArray(a) { + return dhtmlx.extend(a || new Array(), dhtmlxArray._master); +} +dhtmlxArray._master = { + _dhx_find: function (c) { + for (var a = 0; a < this.length; a++) { + if (c == this[a]) { + return a; + } + } + return -1; + }, + _dhx_insertAt: function (e, c) { + this[this.length] = null; + for (var a = this.length - 1; a >= e; a--) { + this[a] = this[a - 1]; + } + this[e] = c; + }, + _dhx_removeAt: function (a) { + this.splice(a, 1); + }, + _dhx_swapItems: function (a, e) { + var c = this[a]; + this[a] = this[e]; + this[e] = c; + }, +}; +function dhtmlXGridObject(id) { + if (dhtmlxEvent.initTouch) { + dhtmlxEvent.initTouch(); + } + if (_isIE) { + try { + document.execCommand("BackgroundImageCache", false, true); + } catch (e) {} + } + if (id) { + if (typeof id == "object") { + this.entBox = id; + if (!this.entBox.id) { + this.entBox.id = "cgrid2_" + this.uid(); + } + } else { + this.entBox = document.getElementById(id); + } + } else { + this.entBox = document.createElement("DIV"); + this.entBox.id = "cgrid2_" + this.uid(); + } + this.entBox.innerHTML = ""; + dhx4._eventable(this); + var self = this; + this._wcorr = 0; + this.fontWidth = 7; + this.cell = null; + this.row = null; + this.iconURL = ""; + this.editor = null; + this._f2kE = true; + this._dclE = true; + this.combos = new Array(0); + this.defVal = new Array(0); + this.rowsAr = {}; + this.rowsBuffer = dhtmlxArray(); + this.rowsCol = dhtmlxArray(); + this._data_cache = {}; + this._ecache = {}; + this._ud_enabled = true; + this.xmlLoader = this.doLoadDetails; + this._maskArr = []; + this.selectedRows = dhtmlxArray(); + this.UserData = {}; + this._sizeFix = this._borderFix = 0; + this.entBox.className += " gridbox"; + this.entBox.style.width = + this.entBox.getAttribute("width") || + (window.getComputedStyle ? this.entBox.style.width || window.getComputedStyle(this.entBox, null)["width"] : this.entBox.currentStyle ? this.entBox.currentStyle.width : this.entBox.style.width || 0) || + "100%"; + this.entBox.style.height = + this.entBox.getAttribute("height") || + (window.getComputedStyle ? this.entBox.style.height || window.getComputedStyle(this.entBox, null)["height"] : this.entBox.currentStyle ? this.entBox.currentStyle.height : this.entBox.style.height || 0) || + "100%"; + this.entBox.style.cursor = "default"; + this.entBox.onselectstart = function () { + return false; + }; + var t_creator = function (name) { + var t = document.createElement("TABLE"); + t.cellSpacing = t.cellPadding = 0; + t.style.cssText = "width:100%;table-layout:fixed;"; + t.className = name.substr(2); + return t; + }; + this.obj = t_creator("c_obj"); + this.hdr = t_creator("c_hdr"); + this.hdr.style.marginRight = "20px"; + this.hdr.style.paddingRight = "20px"; + this.objBox = document.createElement("DIV"); + this.objBox.style.width = "100%"; + this.objBox.style.overflow = "auto"; + this.objBox.appendChild(this.obj); + this.objBox.className = "objbox"; + if (dhtmlx.$customScroll) { + dhtmlx.CustomScroll.enable(this); + } + this.hdrBox = document.createElement("DIV"); + this.hdrBox.style.width = "100%"; + this.hdrBox.style.height = "25px"; + this.hdrBox.style.overflow = "hidden"; + this.hdrBox.className = "xhdr"; + this.preloadImagesAr = new Array(0); + this.sortImg = document.createElement("DIV"); + this.sortImg.style.display = "none"; + this.hdrBox.appendChild(this.sortImg); + this.hdrBox.appendChild(this.hdr); + this.hdrBox.style.position = "relative"; + this.entBox.appendChild(this.hdrBox); + this.entBox.appendChild(this.objBox); + this.entBox.grid = this; + this.objBox.grid = this; + this.hdrBox.grid = this; + this.obj.grid = this; + this.hdr.grid = this; + this.cellWidthPX = []; + this.cellWidthPC = []; + this.cellWidthType = this.entBox.cellwidthtype || "px"; + this.delim = this.entBox.delimiter || ","; + this._csvDelim = ","; + this.hdrLabels = []; + this.columnIds = []; + this.columnColor = []; + this._hrrar = []; + this.cellType = dhtmlxArray(); + this.cellAlign = []; + this.initCellWidth = []; + this.fldSort = []; + this._srdh = _isIE && document.compatMode != "BackCompat" ? 22 : 20; + this.imgURL = window.dhx_globalImgPath || ""; + this.isActive = false; + this.isEditable = true; + this.useImagesInHeader = false; + this.pagingOn = false; + this.rowsBufferOutSize = 0; + dhtmlxEvent(window, "unload", function () { + try { + if (self.destructor) { + self.destructor(); + } + } catch (e) {} + }); + this.setSkin = function (name) { + this._srdh = window.dhx4.readFromCss("dhxgrid_rh_" + name) + 4; + this.skin_name = name; + if (this._imgURL) { + this.setImagePath(this._imgURL); + } + var classname = this.entBox.className.split(" gridbox")[0]; + this.entBox.className = classname + " gridbox gridbox_" + name + (_isIE ? " isIE" : " isModern"); + this.skin_h_correction = 0; + this.enableAlterCss("ev_" + name, "odd_" + name, this.isTreeGrid()); + this._fixAlterCss(); + switch (name) { + case "dhx_terrace": + this._srdh = 33; + this.forceDivInHeader = true; + break; + case "dhx_web": + this.forceDivInHeader = true; + this._srdh = 31; + break; + case "dhx_skyblue": + this.forceDivInHeader = true; + break; + } + if (_isIE && this.hdr) { + var d = this.hdr.parentNode; + d.removeChild(this.hdr); + d.appendChild(this.hdr); + } + this.setSizes(); + }; + if (_isIE) { + this.preventIECaching(true); + } + if (window.dhtmlDragAndDropObject) { + this.dragger = new dhtmlDragAndDropObject(); + } + this._doOnScroll = function (e, mode) { + this.callEvent("onScroll", [this.objBox.scrollLeft, this.objBox.scrollTop]); + this.doOnScroll(e, mode); + }; + this.doOnScroll = function (e, mode) { + this.hdrBox.scrollLeft = this.objBox.scrollLeft; + if (this.ftr) { + this.ftr.parentNode.scrollLeft = this.objBox.scrollLeft; + } + if (mode) { + return; + } + if (this._srnd) { + if (this._dLoadTimer) { + window.clearTimeout(this._dLoadTimer); + } + this._dLoadTimer = window.setTimeout(function () { + if (self._update_srnd_view) { + self._update_srnd_view(); + } + }, 100); + } + }; + this.attachToObject = function (obj) { + obj.appendChild(this.globalBox ? this.globalBox : this.entBox); + this.setSizes(); + }; + this.init = function (fl) { + if (this.isTreeGrid() && !this._h2) { + this._h2 = this._createHierarchy(); + if (this._fake && !this._realfake) { + this._fake._h2 = this._h2; + } + this._tgc = { imgURL: null }; + } + if (!this._hstyles) { + return; + } + if (!this.skin_name) { + this.setSkin(window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxgrid") || "dhx_skyblue"); + } + this.editStop(); + this.lastClicked = null; + this.resized = null; + this.fldSorted = this.r_fldSorted = null; + this.cellWidthPX = []; + this.cellWidthPC = []; + if (this.hdr.rows.length > 0) { + var temp = this.xmlFileUrl; + this.clearAll(true); + this.xmlFileUrl = temp; + } + var hdrRow = this.hdr.insertRow(0); + for (var i = 0; i < this.hdrLabels.length; i++) { + hdrRow.appendChild(document.createElement("TH")); + hdrRow.childNodes[i]._cellIndex = i; + hdrRow.childNodes[i].style.height = "0px"; + } + if (_isIE && _isIE < 8 && document.body.style.msTouchAction == this.undefined) { + hdrRow.style.position = "absolute"; + } else { + hdrRow.style.height = "auto"; + } + var hdrRow = this.hdr.insertRow(_isKHTML ? 2 : 1); + hdrRow._childIndexes = new Array(); + var col_ex = 0; + for (var i = 0; i < this.hdrLabels.length; i++) { + hdrRow._childIndexes[i] = i - col_ex; + if (this.hdrLabels[i] == this.splitSign && i != 0) { + if (_isKHTML) { + hdrRow.insertCell(i - col_ex); + } + hdrRow.cells[i - col_ex - 1].colSpan = (hdrRow.cells[i - col_ex - 1].colSpan || 1) + 1; + hdrRow.childNodes[i - col_ex - 1]._cellIndex++; + col_ex++; + hdrRow._childIndexes[i] = i - col_ex; + continue; + } + hdrRow.insertCell(i - col_ex); + hdrRow.childNodes[i - col_ex]._cellIndex = i; + hdrRow.childNodes[i - col_ex]._cellIndexS = i; + this.setColumnLabel(i, this.hdrLabels[i]); + } + if (col_ex == 0) { + hdrRow._childIndexes = null; + } + this._cCount = this.hdrLabels.length; + if (_isIE) { + window.setTimeout(function () { + if (self.setSizes) { + self.setSizes(); + } + }, 1); + } + if (!this.obj.firstChild) { + this.obj.appendChild(document.createElement("TBODY")); + } + var tar = this.obj.firstChild; + if (!tar.firstChild) { + tar.appendChild(document.createElement("TR")); + tar = tar.firstChild; + if (_isIE && _isIE < 8 && document.body.style.msTouchAction == this.undefined) { + tar.style.position = "absolute"; + } else { + tar.style.height = "auto"; + } + for (var i = 0; i < this.hdrLabels.length; i++) { + tar.appendChild(document.createElement("TH")); + tar.childNodes[i].style.height = "0px"; + } + } + this._c_order = null; + if (this.multiLine != true) { + this.obj.className += " row20px"; + } + this.sortImg.style.position = "absolute"; + this.sortImg.style.display = "none"; + this.sortImg.className = "dhxgrid_sort_desc"; + this.sortImg.defLeft = 0; + if (this.noHeader) { + this.hdrBox.style.display = "none"; + } else { + this.noHeader = false; + } + if (this._ivizcol) { + this.setColHidden(); + } + this.attachHeader(); + this.attachHeader(0, 0, "_aFoot"); + this.setSizes(); + if (fl) { + this.parseXML(); + } + this.obj.scrollTop = 0; + if (this.dragAndDropOff) { + this.dragger.addDragLanding(this.entBox, this); + } + if (this._initDrF) { + this._initD(); + } + dhx4.callEvent("onGridCreated", [this]); + }; + this.setColumnSizes = function (gridWidth) { + var summ = 0; + var fcols = []; + var fix = 0; + for (var i = 0; i < this._cCount; i++) { + if (this.initCellWidth[i] == "*" && !this._hrrar[i]) { + this._awdth = false; + fcols.push(i); + continue; + } + if (this.cellWidthType == "%") { + if (typeof this.cellWidthPC[i] == "undefined") { + this.cellWidthPC[i] = this.initCellWidth[i]; + } + var cwidth = (gridWidth * this.cellWidthPC[i]) / 100 || 0; + if (fix > 0.5) { + cwidth++; + fix--; + } + var rwidth = (this.cellWidthPX[i] = Math.floor(cwidth)); + var fix = fix + cwidth - rwidth; + } else { + if (typeof this.cellWidthPX[i] == "undefined") { + this.cellWidthPX[i] = this.initCellWidth[i]; + } + } + if (!this._hrrar[i]) { + summ += this.cellWidthPX[i] * 1; + } + } + if (fcols.length) { + var ms = Math.floor((gridWidth - summ) / fcols.length); + if (ms < 0) { + ms = 1; + } + for (var i = 0; i < fcols.length; i++) { + var next = Math.max(this._drsclmW ? this._drsclmW[fcols[i]] || 0 : 0, ms); + this.cellWidthPX[fcols[i]] = next; + summ += next; + } + if (gridWidth > summ) { + var last = fcols[fcols.length - 1]; + this.cellWidthPX[last] = this.cellWidthPX[last] + (gridWidth - summ); + summ = gridWidth; + } + this._setAutoResize(); + } + this.obj.style.width = summ + "px"; + this.hdr.style.width = summ + "px"; + if (this.ftr) { + this.ftr.style.width = summ + "px"; + } + this.chngCellWidth(); + return summ; + }; + this.setSizes = function () { + if (!this.hdr.rows[0]) { + return; + } + var quirks = (this.quirks = _isIE && document.compatMode == "BackCompat"); + var outerBorder = (this.entBox.offsetWidth - this.entBox.clientWidth) / 2; + if (!this.dontSetSizes) { + if (this.globalBox) { + if (!this.globalBox.clientWidth) { + return; + } + var ow = this.globalBox.clientWidth; + var splitOuterBorder = (this.globalBox.offsetWidth - ow) / 2; + if (this._delta_x && !this._realfake) { + this.globalBox.style.width = this._delta_x; + var owu = this.globalBox.clientWidth; + this.entBox.style.width = Math.max(0, owu + (quirks ? splitOuterBorder * 2 : 0) - this._fake.entBox.clientWidth) + "px"; + if (owu != this._lastTimeSplitWidth) { + this._fake._correctSplit(this._fake.entBox.clientWidth); + this._lastTimeSplitWidth = owu; + } + } + if (this._delta_y && !this._realfake) { + this.globalBox.style.height = this._delta_y; + this.entBox.style.overflow = this._fake.entBox.style.overflow = "hidden"; + this.entBox.style.height = this._fake.entBox.style.height = this.globalBox.clientHeight + (quirks ? splitOuterBorder * 2 : 0) + "px"; + } + } else { + if (this._delta_x) { + if (this.entBox.parentNode && this.entBox.parentNode.tagName == "TD") { + this.entBox.style.width = "1px"; + this.entBox.style.width = (parseInt(this._delta_x) * this.entBox.parentNode.clientWidth) / 100 - outerBorder * 2 + "px"; + } else { + this.entBox.style.width = this._delta_x; + } + } + if (this._delta_y) { + this.entBox.style.height = this._delta_y; + } + } + } + window.clearTimeout(this._sizeTime); + if (!this.entBox.offsetWidth && (!this.globalBox || !this.globalBox.offsetWidth)) { + this._sizeTime = window.setTimeout(function () { + if (self.setSizes) { + self.setSizes(); + } + }, 250); + return; + } + var border_x = !this._wthB && (this.entBox.cmp || this._delta_x) && (this.skin_name || "").indexOf("dhx") == 0 && !quirks ? 2 : 0; + var border_y = !this._wthB && (this.entBox.cmp || this._delta_y) && (this.skin_name || "").indexOf("dhx") == 0 && !quirks ? 2 : 0; + if (this._sizeFix) { + border_x -= this._sizeFix; + border_y -= this._sizeFix; + } + var isVScroll = this.parentGrid ? false : this.objBox.scrollHeight > this.objBox.offsetHeight; + var scrfix = dhtmlx.$customScroll ? 0 : 18; + var gridWidth = this.entBox.clientWidth - (this.skin_h_correction || 0) * (quirks ? 0 : 1) - border_x; + var gridWidthActive = this.entBox.clientWidth - (this.skin_h_correction || 0) - border_x; + var gridHeight = this.entBox.clientHeight - border_y; + var summ = this.setColumnSizes(gridWidthActive - (isVScroll ? scrfix : 0) - (this._correction_x || 0)); + var isHScroll = this.parentGrid ? false : this.objBox.scrollWidth > this.objBox.offsetWidth || this.objBox.style.overflowX == "scroll"; + var headerHeight = this.hdr.clientHeight; + var footerHeight = this.ftr ? this.ftr.clientHeight : 0; + var newWidth = gridWidth; + var newHeight = gridHeight - headerHeight - footerHeight; + if (this._awdth && this._awdth[0] && this._awdth[1] == 99999) { + isHScroll = 0; + } + if (this._ahgr) { + if (this._ahgrMA) { + newHeight = this.entBox.parentNode.clientHeight - headerHeight - footerHeight; + } else { + newHeight = this.obj.offsetHeight + (isHScroll ? scrfix : 0) + (this._correction_y || 0); + } + if (this._ahgrM) { + if (this._ahgrF) { + newHeight = Math.min(this._ahgrM, newHeight + headerHeight + footerHeight) - headerHeight - footerHeight; + } else { + newHeight = Math.min(this._ahgrM, newHeight); + } + } + if (isVScroll && newHeight >= this.obj.scrollHeight + (isHScroll ? scrfix : 0)) { + isVScroll = false; + this.setColumnSizes(gridWidthActive - (this._correction_x || 0)); + } + } + if (this._awdth && this._awdth[0]) { + if (this.cellWidthType == "%") { + this.cellWidthType = "px"; + } + if (this._fake) { + summ += this._fake.entBox.clientWidth; + } + var newWidth = Math.min(Math.max(summ + (isVScroll ? scrfix : 0), this._awdth[2]), this._awdth[1]) + (this._correction_x || 0); + this.objBox.style.overflowX = !isVScroll && this.objBox.scrollWidth <= newWidth ? "hidden" : "auto"; + if (this._fake) { + newWidth -= this._fake.entBox.clientWidth; + } + } + newHeight = Math.max(0, newHeight); + this._ff_size_delta = this._ff_size_delta == 0.1 ? 0.2 : 0.1; + if (!_isFF) { + this._ff_size_delta = 0; + } + if (!this.dontSetSizes) { + this.entBox.style.width = Math.max(0, newWidth + (quirks ? 2 : 0) * outerBorder + this._ff_size_delta) + "px"; + this.entBox.style.height = newHeight + (quirks ? 2 : 0) * outerBorder + headerHeight + footerHeight + "px"; + } + this.objBox.style.height = newHeight + (quirks && !isVScroll ? 2 : 0) * outerBorder + "px"; + this.hdrBox.style.height = headerHeight + "px"; + if (newHeight != gridHeight) { + this.doOnScroll(0, !this._srnd); + } + var ext = this["setSizes_" + this.skin_name]; + if (ext) { + ext.call(this); + } + this.setSortImgPos(); + if (headerHeight != this.hdr.clientHeight && this._ahgr) { + this.setSizes(); + } + this.callEvent("onSetSizes", []); + }; + this.chngCellWidth = function () { + if (_isOpera && this.ftr) { + this.ftr.width = this.objBox.scrollWidth + "px"; + } + var l = this._cCount; + for (var i = 0; i < l; i++) { + this.hdr.rows[0].cells[i].style.width = this.cellWidthPX[i] + "px"; + this.obj.rows[0].childNodes[i].style.width = this.cellWidthPX[i] + "px"; + if (this.ftr) { + this.ftr.rows[0].cells[i].style.width = this.cellWidthPX[i] + "px"; + } + } + }; + this.setDelimiter = function (delim) { + this.delim = delim; + }; + this.setInitWidthsP = function (wp) { + this.cellWidthType = "%"; + this.initCellWidth = wp.split(this.delim.replace(/px/gi, "")); + if (!arguments[1]) { + this._setAutoResize(); + } + }; + this._setAutoResize = function () { + if (this._realfake) { + return; + } + var el = window; + var self = this; + dhtmlxEvent(window, "resize", function () { + window.clearTimeout(self._resize_timer); + if (self._setAutoResize) { + self._resize_timer = window.setTimeout(function () { + if (self.setSizes) { + self.setSizes(); + } + if (self._fake) { + self._fake._correctSplit(); + } + }, 100); + } + }); + }; + this.setInitWidths = function (wp) { + this.cellWidthType = "px"; + this.initCellWidth = wp.split(this.delim); + if (_isFF) { + for (var i = 0; i < this.initCellWidth.length; i++) { + if (this.initCellWidth[i] != "*") { + this.initCellWidth[i] = parseInt(this.initCellWidth[i]); + } + } + } + }; + this.enableMultiline = function (state) { + this.multiLine = dhx4.s2b(state); + }; + this.enableMultiselect = function (state) { + this.selMultiRows = dhx4.s2b(state); + }; + this.setImagePath = function (path) { + path = path.replace(/imgs\/dhxgrid_[a-z]*\/$/, "imgs/"); + this._imgURL = path; + this.imgURL = path + "dhxgrid_" + (this.skin_name || "dhx_skyblue").replace("dhx_", "") + "/"; + this.iconTree = this.imgURL + "tree/"; + }; + this.setImagesPath = this.setImagePath; + this.setIconPath = function (path) { + this.iconURL = path; + }; + this.setIconsPath = this.setIconPath; + this.changeCursorState = function (ev) { + var el = ev.target || ev.srcElement; + if (el.tagName != "TD") { + el = this.getFirstParentOfType(el, "TD"); + } + if (!el) { + return; + } + if (el.tagName == "TD" && this._drsclmn && !this._drsclmn[el._cellIndex]) { + return (el.style.cursor = "default"); + } + var check = (ev.layerX || 0) + (!_isIE && ev.target.tagName == "DIV" ? el.offsetLeft : 0); + if (el.offsetWidth - (ev.offsetX || (parseInt(this.getPosition(el, this.hdrBox)) - check) * -1) < (_isOpera ? 20 : 10)) { + el.style.cursor = "E-resize"; + } else { + el.style.cursor = "default"; + } + if (_isOpera) { + this.hdrBox.scrollLeft = this.objBox.scrollLeft; + } + }; + this.startColResize = function (ev) { + if (this.resized) { + this.stopColResize(); + } + this.resized = null; + var el = ev.target || ev.srcElement; + if (el.tagName != "TD") { + el = this.getFirstParentOfType(el, "TD"); + } + var x = ev.clientX; + var tabW = this.hdr.offsetWidth; + var startW = parseInt(el.offsetWidth); + if (el.tagName == "TD" && el.style.cursor != "default") { + if (this._drsclmn && !this._drsclmn[el._cellIndex]) { + return; + } + self._old_d_mm = document.body.onmousemove; + self._old_d_mu = document.body.onmouseup; + document.body.onmousemove = function (e) { + if (self) { + self.doColResize(e || window.event, el, startW, x, tabW); + } + }; + document.body.onmouseup = function () { + if (self) { + self.stopColResize(); + } + }; + } + }; + this.stopColResize = function () { + document.body.onmousemove = self._old_d_mm || ""; + document.body.onmouseup = self._old_d_mu || ""; + this.setSizes(); + this.doOnScroll(0, 1); + this.callEvent("onResizeEnd", [this]); + }; + this.doColResize = function (ev, el, startW, x, tabW) { + el.style.cursor = "E-resize"; + this.resized = el; + var fcolW = startW + (ev.clientX - x); + var wtabW = tabW + (ev.clientX - x); + if (!this.callEvent("onResize", [el._cellIndex, fcolW, this])) { + return; + } + if (_isIE) { + this.objBox.scrollLeft = this.hdrBox.scrollLeft; + } + var result = false; + if (el.colSpan > 1) { + var a_sizes = new Array(); + for (var i = 0; i < el.colSpan; i++) { + a_sizes[i] = Math.round((fcolW * this.hdr.rows[0].childNodes[el._cellIndexS + i].offsetWidth) / el.offsetWidth); + } + for (var i = 0; i < el.colSpan; i++) { + result = this._setColumnSizeR(el._cellIndexS + i * 1, a_sizes[i]); + } + } else { + result = this._setColumnSizeR(el._cellIndex, fcolW); + } + this.doOnScroll(0, 1); + this.setSizes(); + if (this._fake && this._awdth) { + this._fake._correctSplit(); + } + return result; + }; + this._setColumnSizeR = function (ind, fcolW) { + if (fcolW > (this._drsclmW && !this._notresize ? this._drsclmW[ind] || 10 : 10)) { + this.obj.rows[0].childNodes[ind].style.width = fcolW + "px"; + this.hdr.rows[0].childNodes[ind].style.width = fcolW + "px"; + if (this.ftr) { + this.ftr.rows[0].childNodes[ind].style.width = fcolW + "px"; + } + if (this.cellWidthType == "px") { + this.cellWidthPX[ind] = fcolW; + } else { + var gridWidth = parseInt(this.entBox.offsetWidth); + if (this.objBox.scrollHeight > this.objBox.offsetHeight) { + gridWidth -= 17; + } + var pcWidth = Math.round((fcolW / gridWidth) * 100); + this.cellWidthPC[ind] = pcWidth; + } + if (this.sortImg.style.display != "none") { + this.setSortImgPos(); + } + } else { + return false; + } + }; + this.setSortImgState = function (state, ind, order, row) { + order = (order || "asc").toLowerCase(); + if (!dhx4.s2b(state)) { + this.sortImg.style.display = "none"; + this.fldSorted = this.r_fldSorted = null; + return; + } + if (order == "asc") { + this.sortImg.className = "dhxgrid_sort_asc"; + } else { + this.sortImg.className = "dhxgrid_sort_desc"; + } + this.sortImg.style.display = ""; + this.fldSorted = this.hdr.rows[0].childNodes[ind]; + var r = this.hdr.rows[row || 1]; + if (!r) { + return; + } + for (var i = 0; i < r.childNodes.length; i++) { + if (r.childNodes[i]._cellIndexS == ind) { + this.r_fldSorted = r.childNodes[i]; + return this.setSortImgPos(); + } + } + return this.setSortImgState(state, ind, order, (row || 1) + 1); + }; + this.setSortImgPos = function (ind, mode, hRowInd, el) { + if (this._hrrar && this._hrrar[this.r_fldSorted ? this.r_fldSorted._cellIndex : ind]) { + return; + } + if (!el) { + if (!ind) { + var el = this.r_fldSorted; + } else { + var el = this.hdr.rows[hRowInd || 0].cells[ind]; + } + } + if (el != null) { + var pos = this.getPosition(el, this.hdrBox); + var wdth = el.offsetWidth; + this.sortImg.style.left = Number(pos[0] + wdth - 13) + "px"; + this.sortImg.defLeft = parseInt(this.sortImg.style.left); + this.sortImg.style.top = Number(pos[1] + 5) + "px"; + if (!this.useImagesInHeader && !mode) { + this.sortImg.style.display = "inline"; + } + this.sortImg.style.left = this.sortImg.defLeft + "px"; + } + }; + this.setActive = function (fl) { + if (arguments.length == 0) { + var fl = true; + } + if (fl == true) { + if (globalActiveDHTMLGridObject && globalActiveDHTMLGridObject != this) { + globalActiveDHTMLGridObject.editStop(); + globalActiveDHTMLGridObject.callEvent("onBlur", [globalActiveDHTMLGridObject]); + } + globalActiveDHTMLGridObject = this; + this.isActive = true; + } else { + this.isActive = false; + this.callEvent("onBlur", [this]); + } + }; + this._doClick = function (ev) { + var selMethod = 0; + var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD"); + if (!el || !el.parentNode || !el.parentNode.idd) { + return; + } + var fl = true; + if (this.markedCells) { + var markMethod = 0; + if (ev.shiftKey || ev.metaKey) { + markMethod = 1; + } + if (ev.ctrlKey) { + markMethod = 2; + } + this.doMark(el, markMethod); + return true; + } + if (this.selMultiRows != false) { + if (ev.shiftKey && this.row != null && this.selectedRows.length) { + selMethod = 1; + } + if (ev.ctrlKey || ev.metaKey) { + selMethod = 2; + } + } + return this.doClick(el, fl, selMethod, false); + }; + this._doContClick = function (ev) { + var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD"); + if (!el || typeof el.parentNode.idd == "undefined") { + this.callEvent("onEmptyClick", [ev]); + return true; + } + if (ev.button == 2 || (_isMacOS && ev.ctrlKey)) { + if (!this.callEvent("onRightClick", [el.parentNode.idd, el._cellIndex, ev])) { + var z = function (e) { + (e || event).cancelBubble = true; + return false; + }; + (ev.srcElement || ev.target).oncontextmenu = z; + return z(ev); + } + if (this._ctmndx) { + if (!this.callEvent("onBeforeContextMenu", [el.parentNode.idd, el._cellIndex, this])) { + return true; + } + if (_isIE) { + ev.srcElement.oncontextmenu = function () { + event.cancelBubble = true; + return false; + }; + } + if (this._ctmndx.showContextMenu) { + var dEl0 = window.document.documentElement; + var dEl1 = window.document.body; + var corrector = new Array(dEl0.scrollLeft || dEl1.scrollLeft, dEl0.scrollTop || dEl1.scrollTop); + if (_isIE) { + var x = ev.clientX + corrector[0]; + var y = ev.clientY + corrector[1]; + } else { + var x = ev.pageX; + var y = ev.pageY; + } + this._ctmndx.showContextMenu(x - 1, y - 1); + this.contextID = this._ctmndx.contextMenuZoneId = el.parentNode.idd + "_" + el._cellIndex; + this._ctmndx._skip_hide = true; + } else { + el.contextMenuId = el.parentNode.idd + "_" + el._cellIndex; + el.contextMenu = this._ctmndx; + el.a = this._ctmndx._contextStart; + el.a(el, ev); + el.a = null; + } + ev.cancelBubble = true; + return false; + } + } else { + if (this._ctmndx) { + if (this._ctmndx.hideContextMenu) { + this._ctmndx.hideContextMenu(); + } else { + this._ctmndx._contextEnd(); + } + } + } + return true; + }; + this.doClick = function (el, fl, selMethod, show) { + if (!this.selMultiRows) { + selMethod = 0; + } + var psid = this.row ? this.row.idd : 0; + this.setActive(true); + if (!selMethod) { + selMethod = 0; + } + if (this.cell != null) { + this.cell.className = this.cell.className.replace(/cellselected/g, ""); + } + if (el.tagName == "TD") { + if (this.checkEvent("onSelectStateChanged")) { + var initial = this.getSelectedId(); + } + var prow = this.row; + if (selMethod == 1) { + var elRowIndex = this.rowsCol._dhx_find(el.parentNode); + var lcRowIndex = this.rowsCol._dhx_find(this.lastClicked); + if (elRowIndex > lcRowIndex) { + var strt = lcRowIndex; + var end = elRowIndex; + } else { + var strt = elRowIndex; + var end = lcRowIndex; + } + for (var i = 0; i < this.rowsCol.length; i++) { + if (i >= strt && i <= end) { + if (this.rowsCol[i] && !this.rowsCol[i]._sRow) { + if (!this.rowsCol[i].idd) { + continue; + } + if (this.rowsCol[i].className.indexOf("rowselected") == -1 && this.callEvent("onBeforeSelect", [this.rowsCol[i].idd, psid, el._cellIndex])) { + this.rowsCol[i].className += " rowselected"; + this.selectedRows[this.selectedRows.length] = this.rowsCol[i]; + } + } else { + this.clearSelection(); + return this.doClick(el, fl, 0, show); + } + } + } + } else { + if (selMethod == 2) { + if (el.parentNode.className.indexOf("rowselected") != -1) { + el.parentNode.className = el.parentNode.className.replace(/rowselected/g, ""); + this.selectedRows._dhx_removeAt(this.selectedRows._dhx_find(el.parentNode)); + var skipRowSelection = true; + show = false; + } + } + } + this.editStop(); + if (typeof el.parentNode.idd == "undefined") { + return true; + } + if (!skipRowSelection && !el.parentNode._sRow) { + if (this.callEvent("onBeforeSelect", [el.parentNode.idd, psid, el._cellIndex])) { + if (this.getSelectedRowId() != el.parentNode.idd) { + if (selMethod == 0) { + this.clearSelection(); + } + this.cell = el; + if (prow == el.parentNode && this._chRRS) { + fl = false; + } + this.row = el.parentNode; + this.row.className += " rowselected"; + if (this.selectedRows._dhx_find(this.row) == -1) { + this.selectedRows[this.selectedRows.length] = this.row; + } + } else { + this.cell = el; + this.row = el.parentNode; + } + } else { + fl = false; + } + } + if (this.cell && this.cell.parentNode.className.indexOf("rowselected") != -1) { + this.cell.className = this.cell.className.replace(/cellselected/g, "") + " cellselected"; + } + if (selMethod != 1) { + if (!this.row) { + return; + } + } + this.lastClicked = el.parentNode; + var rid = this.row.idd; + var cid = this.cell; + if (fl && typeof rid != "undefined" && cid && !skipRowSelection) { + self.onRowSelectTime = setTimeout(function () { + if (self.callEvent) { + self.callEvent("onRowSelect", [rid, cid._cellIndex]); + } + }, 100); + } else { + this.callEvent("onRowSelectRSOnly", [rid]); + } + if (this.checkEvent("onSelectStateChanged")) { + var afinal = this.getSelectedId(); + if (initial != afinal) { + this.callEvent("onSelectStateChanged", [afinal, initial]); + } + } + if (skipRowSelection) { + return false; + } + } + this.isActive = true; + if (show !== false && this.cell && this.cell.parentNode.idd) { + this.moveToVisible(this.cell); + } + }; + this.selectAll = function () { + this.clearSelection(); + var coll = this.rowsBuffer; + if (this.pagingOn) { + coll = this.rowsCol; + } + for (var i = 0; i < coll.length; i++) { + this.render_row(i).className += " rowselected"; + } + this.selectedRows = dhtmlxArray([].concat(coll)); + if (this.selectedRows.length) { + this.row = this.selectedRows[0]; + this.cell = this.row.cells[0]; + } + if (this._fake && !this._realfake) { + this._fake.selectAll(); + } + }; + this.selectCell = function (r, cInd, fl, preserve, edit, show) { + if (!fl) { + fl = false; + } + if (typeof r != "object") { + r = this.render_row(r); + } + if (!r || r == -1) { + return null; + } + if (r._childIndexes) { + var c = r.childNodes[r._childIndexes[cInd]]; + } else { + var c = r.childNodes[cInd]; + } + if (!c) { + c = r.childNodes[0]; + } + if (!this.markedCells) { + if (preserve) { + this.doClick(c, fl, 3, show); + } else { + this.doClick(c, fl, 0, show); + } + } else { + this.doMark(c, preserve ? 2 : 0); + } + if (edit) { + this.editCell(); + } + }; + this.moveToVisible = function (cell_obj, onlyVScroll) { + if (this.pagingOn) { + var newPage = Math.floor(this.getRowIndex(cell_obj.parentNode.idd) / this.rowsBufferOutSize) + 1; + if (newPage != this.currentPage) { + this.changePage(newPage); + } + } + try { + if (cell_obj.offsetHeight) { + var distance = cell_obj.offsetLeft + cell_obj.offsetWidth + 20; + var scrollLeft = 0; + if (distance > this.objBox.offsetWidth + this.objBox.scrollLeft) { + if (cell_obj.offsetLeft > this.objBox.scrollLeft) { + scrollLeft = cell_obj.offsetLeft - (this.objBox.offsetWidth - cell_obj.offsetWidth) + 5; + } + } else { + if (cell_obj.offsetLeft < this.objBox.scrollLeft) { + distance -= (cell_obj.offsetWidth * 2) / 3; + if (distance < this.objBox.scrollLeft) { + scrollLeft = cell_obj.offsetLeft - 5; + } + } + } + if (scrollLeft && !onlyVScroll) { + this.objBox.scrollLeft = scrollLeft; + } + } + if (!cell_obj.offsetHeight) { + var mask = this._realfake ? this._fake.rowsAr[cell_obj.parentNode.idd] : cell_obj.parentNode; + distance = this.rowsBuffer._dhx_find(mask) * this._srdh; + } else { + distance = cell_obj.offsetTop; + } + var distancemax = distance + cell_obj.offsetHeight + 38; + if (distancemax > this.objBox.offsetHeight + this.objBox.scrollTop) { + var scrollTop = distance; + } else { + if (distance < this.objBox.scrollTop) { + var scrollTop = distance - 5; + } + } + if (scrollTop) { + this.objBox.scrollTop = scrollTop; + } + } catch (er) {} + }; + this.editCell = function () { + if (this.editor && this.cell == this.editor.cell) { + return; + } + this.editStop(); + if (this.isEditable != true || !this.cell) { + return false; + } + var c = this.cell; + if (c.parentNode._locked) { + return false; + } + this.editor = this.cells4(c); + if (this.editor != null) { + if (this.editor.isDisabled()) { + this.editor = null; + return false; + } + if (this.callEvent("onEditCell", [0, this.row.idd, this.cell._cellIndex]) != false && this.editor.edit) { + this._Opera_stop = new Date().valueOf(); + this.editor.edit(); + c.className += " editable"; + this.callEvent("onEditCell", [1, this.row.idd, this.cell._cellIndex]); + } else { + this.editor = null; + } + } + }; + this.editStop = function (mode) { + if (_isOpera) { + if (this._Opera_stop) { + if (this._Opera_stop * 1 + 50 > new Date().valueOf()) { + return; + } + this._Opera_stop = null; + } + } + if (this.editor && this.editor != null) { + this.editor.cell.className = this.editor.cell.className.replace("editable", ""); + if (mode) { + var t = this.editor.val; + this.editor.detach(); + this.editor.setValue(t); + this.editor = null; + this.callEvent("onEditCancel", [this.row.idd, this.cell._cellIndex, t]); + return; + } + if (this.editor.detach()) { + this.cell.wasChanged = true; + } + var g = this.editor; + if (g == null) { + return; + } + this.editor = null; + var z = this.callEvent("onEditCell", [2, this.row.idd, this.cell._cellIndex, g.getValue(), g.val]); + if (typeof z == "string" || typeof z == "number") { + g[g.setImage ? "setLabel" : "setValue"](z); + } else { + if (!z) { + g[g.setImage ? "setLabel" : "setValue"](g.val); + } + } + if (this._ahgr && this.multiLine) { + this.setSizes(); + } + } + }; + this._nextRowCell = function (row, dir, pos) { + row = this._nextRow((this._groups ? this.rowsCol : this.rowsBuffer)._dhx_find(row), dir); + if (!row) { + return null; + } + return row.childNodes[row._childIndexes ? row._childIndexes[pos] : pos]; + }; + this._getNextCell = function (acell, dir, i) { + acell = acell || this.cell; + var arow = acell.parentNode; + if (this._tabOrder) { + i = this._tabOrder[acell._cellIndex]; + if (typeof i != "undefined") { + if (i < 0) { + acell = this._nextRowCell(arow, dir, Math.abs(i) - 1); + } else { + acell = arow.childNodes[i]; + } + } + } else { + var i = acell._cellIndex + dir; + if (i >= 0 && i < this._cCount) { + if (arow._childIndexes) { + i = arow._childIndexes[acell._cellIndex] + dir; + } + acell = arow.childNodes[i]; + } else { + acell = this._nextRowCell(arow, dir, dir == 1 ? 0 : this._cCount - 1); + } + } + if (!acell) { + if (dir == 1 && this.tabEnd) { + this.tabEnd.focus(); + this.tabEnd.focus(); + this.setActive(false); + } + if (dir == -1 && this.tabStart) { + this.tabStart.focus(); + this.tabStart.focus(); + this.setActive(false); + } + return null; + } + if (acell.style.display != "none" && (!this.smartTabOrder || !this.cells(acell.parentNode.idd, acell._cellIndex).isDisabled())) { + return acell; + } + return this._getNextCell(acell, dir); + }; + this._nextRow = function (ind, dir) { + var r = this.render_row(ind + dir); + if (!r || r == -1) { + return null; + } + if (r && r.style.display == "none") { + return this._nextRow(ind + dir, dir); + } + return r; + }; + this.scrollPage = function (dir) { + if (!this.rowsBuffer.length) { + return; + } + var master = this._realfake ? this._fake : this; + var new_ind = Math.floor((master._r_select || this.getRowIndex(this.row.idd) || 0) + (dir * this.objBox.offsetHeight) / (this._srdh || 20)); + if (new_ind < 0) { + new_ind = 0; + } + if (new_ind >= this.rowsBuffer.length) { + new_ind = this.rowsBuffer.length - 1; + } + if (this._srnd && !this.rowsBuffer[new_ind]) { + this.objBox.scrollTop += Math.floor((dir * this.objBox.offsetHeight) / (this._srdh || 20)) * (this._srdh || 20); + if (this._fake) { + this._fake.objBox.scrollTop = this.objBox.scrollTop; + } + master._r_select = new_ind; + } else { + this.selectCell(new_ind, this.cell._cellIndex, true, false, false, this.multiLine || this._srnd); + if (!this.multiLine && !this._srnd && !this._realfake) { + this.objBox.scrollTop = this.getRowById(this.getRowId(new_ind)).offsetTop; + if (this._fake) { + this._fake.objBox.scrollTop = this.objBox.scrollTop; + } + } + master._r_select = null; + } + }; + this.doKey = function (ev) { + if (!ev) { + return true; + } + if ((ev.target || ev.srcElement).value !== window.undefined) { + var zx = ev.target || ev.srcElement; + if (zx.className != "dhxcombo_input" && (!zx.parentNode || zx.parentNode.className.indexOf("editable") == -1)) { + return true; + } + } + if (globalActiveDHTMLGridObject && this != globalActiveDHTMLGridObject) { + return globalActiveDHTMLGridObject.doKey(ev); + } + if (this.isActive == false) { + return true; + } + if (this._htkebl) { + return true; + } + if (!this.callEvent("onKeyPress", [ev.keyCode, ev.ctrlKey, ev.shiftKey, ev])) { + return false; + } + var code = "k" + ev.keyCode + "_" + (ev.ctrlKey ? 1 : 0) + "_" + (ev.shiftKey ? 1 : 0); + if (this.cell) { + if (this._key_events[code]) { + if (false === this._key_events[code].call(this)) { + return true; + } + if (ev.preventDefault) { + ev.preventDefault(); + } + ev.cancelBubble = true; + return false; + } + if (this._key_events.k_other) { + this._key_events.k_other.call(this, ev); + } + } + return true; + }; + this.selectRow = function (r, fl, preserve, show) { + if (typeof r != "object") { + r = this.render_row(r); + } + this.selectCell(r, 0, fl, preserve, false, show); + }; + this.wasDblClicked = function (ev) { + var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD"); + if (el) { + var rowId = el.parentNode.idd; + return this.callEvent("onRowDblClicked", [rowId, el._cellIndex, ev]); + } + }; + this._onHeaderClick = function (e, el) { + var that = this.grid; + el = el || that.getFirstParentOfType(_isIE ? event.srcElement : e.target, "TD"); + if (this.grid.resized == null) { + if (!this.grid.callEvent("onHeaderClick", [el._cellIndexS, e || window.event])) { + return false; + } + that.sortField(el._cellIndexS, false, el); + } + this.grid.resized = null; + }; + this.deleteSelectedRows = function () { + var num = this.selectedRows.length; + if (num == 0) { + return; + } + var tmpAr = this.selectedRows; + this.selectedRows = dhtmlxArray(); + for (var i = num - 1; i >= 0; i--) { + var node = tmpAr[i]; + if (!this.deleteRow(node.idd, node)) { + this.selectedRows[this.selectedRows.length] = node; + } else { + if (node == this.row) { + var ind = i; + } + } + } + if (ind) { + try { + if (ind + 1 > this.rowsCol.length) { + ind--; + } + this.selectCell(ind, 0, true); + } catch (er) { + this.row = null; + this.cell = null; + } + } + }; + this.getSelectedRowId = function () { + var selAr = new Array(0); + var uni = {}; + for (var i = 0; i < this.selectedRows.length; i++) { + var id = this.selectedRows[i].idd; + if (uni[id]) { + continue; + } + selAr[selAr.length] = id; + uni[id] = true; + } + if (selAr.length == 0) { + return null; + } else { + return selAr.join(this.delim); + } + }; + this.getSelectedCellIndex = function () { + if (this.cell != null) { + return this.cell._cellIndex; + } else { + return -1; + } + }; + this.getColWidth = function (ind) { + return parseInt(this.cellWidthPX[ind]); + }; + this.setColWidth = function (ind, value) { + if (value == "*") { + this.initCellWidth[ind] = "*"; + } else { + if (this._hrrar[ind]) { + return; + } + if (this.cellWidthType == "px") { + this.cellWidthPX[ind] = parseInt(value); + } else { + this.cellWidthPC[ind] = parseInt(value); + } + } + this.setSizes(); + }; + this.getRowIndex = function (row_id) { + for (var i = 0; i < this.rowsBuffer.length; i++) { + if (this.rowsBuffer[i] && this.rowsBuffer[i].idd == row_id) { + return i; + } + } + return -1; + }; + this.getRowId = function (ind) { + return this.rowsBuffer[ind] ? this.rowsBuffer[ind].idd : this.undefined; + }; + this.setRowId = function (ind, row_id) { + this.changeRowId(this.getRowId(ind), row_id); + }; + this.changeRowId = function (oldRowId, newRowId) { + if (oldRowId == newRowId) { + return; + } + var row = this.rowsAr[oldRowId]; + row.idd = newRowId; + if (this.UserData[oldRowId]) { + this.UserData[newRowId] = this.UserData[oldRowId]; + this.UserData[oldRowId] = null; + } + if (this._h2 && this._h2.get[oldRowId]) { + this._h2.get[newRowId] = this._h2.get[oldRowId]; + this._h2.get[newRowId].id = newRowId; + delete this._h2.get[oldRowId]; + } + this.rowsAr[oldRowId] = null; + this.rowsAr[newRowId] = row; + for (var i = 0; i < row.childNodes.length; i++) { + if (row.childNodes[i]._code) { + row.childNodes[i]._code = this._compileSCL(row.childNodes[i]._val, row.childNodes[i]); + } + } + if (this._mat_links && this._mat_links[oldRowId]) { + var a = this._mat_links[oldRowId]; + delete this._mat_links[oldRowId]; + for (var c in a) { + for (var i = 0; i < a[c].length; i++) { + this._compileSCL(a[c][i].original, a[c][i]); + } + } + } + this.callEvent("onRowIdChange", [oldRowId, newRowId]); + }; + this.setColumnIds = function (ids) { + this.columnIds = ids.split(this.delim); + }; + this.setColumnId = function (ind, id) { + this.columnIds[ind] = id; + }; + this.getColIndexById = function (id) { + for (var i = 0; i < this.columnIds.length; i++) { + if (this.columnIds[i] == id) { + return i; + } + } + }; + this.getColumnId = function (cin) { + return this.columnIds[cin]; + }; + this.getColumnLabel = function (cin, ind, hdr) { + var z = (hdr || this.hdr).rows[(ind || 0) + 1]; + for (var i = 0; i < z.cells.length; i++) { + if (z.cells[i]._cellIndexS == cin) { + return _isIE ? z.cells[i].innerText : z.cells[i].textContent; + } + } + return ""; + }; + this.getColLabel = this.getColumnLabel; + this.getFooterLabel = function (cin, ind) { + return this.getColumnLabel(cin, ind, this.ftr); + }; + this.setRowTextBold = function (row_id) { + var r = this.getRowById(row_id); + if (r) { + r.style.fontWeight = "bold"; + } + }; + this.setRowTextStyle = function (row_id, styleString) { + var r = this.getRowById(row_id); + if (!r) { + return; + } + for (var i = 0; i < r.childNodes.length; i++) { + var pfix = r.childNodes[i]._attrs.style || ""; + if (this._hrrar && this._hrrar[i]) { + pfix = "display:none;"; + } + if (_isIE) { + r.childNodes[i].style.cssText = pfix + "width:" + r.childNodes[i].style.width + ";" + styleString; + } else { + r.childNodes[i].style.cssText = pfix + "width:" + r.childNodes[i].style.width + ";" + styleString; + } + } + }; + this.setRowColor = function (row_id, color) { + var r = this.getRowById(row_id); + for (var i = 0; i < r.childNodes.length; i++) { + r.childNodes[i].bgColor = color; + } + }; + this.setCellTextStyle = function (row_id, ind, styleString) { + var r = this.getRowById(row_id); + if (!r) { + return; + } + var cell = r.childNodes[r._childIndexes ? r._childIndexes[ind] : ind]; + if (!cell) { + return; + } + var pfix = ""; + if (this._hrrar && this._hrrar[ind]) { + pfix = "display:none;"; + } + if (_isIE) { + cell.style.cssText = pfix + "width:" + cell.style.width + ";" + styleString; + } else { + cell.style.cssText = pfix + "width:" + cell.style.width + ";" + styleString; + } + }; + this.setRowTextNormal = function (row_id) { + var r = this.getRowById(row_id); + if (r) { + r.style.fontWeight = "normal"; + } + }; + this.doesRowExist = function (row_id) { + if (this.getRowById(row_id) != null) { + return true; + } else { + return false; + } + }; + this.getColumnsNum = function () { + return this._cCount; + }; + this.moveRowUp = function (row_id) { + var r = this.getRowById(row_id); + if (this.isTreeGrid()) { + return this.moveRowUDTG(row_id, -1); + } + var rInd = this.rowsCol._dhx_find(r); + if (r.previousSibling && rInd != 0) { + r.parentNode.insertBefore(r, r.previousSibling); + this.rowsCol._dhx_swapItems(rInd, rInd - 1); + this.setSizes(); + var bInd = this.rowsBuffer._dhx_find(r); + this.rowsBuffer._dhx_swapItems(bInd, bInd - 1); + if (this._cssEven) { + this._fixAlterCss(rInd - 1); + } + } + }; + this.moveRowDown = function (row_id) { + var r = this.getRowById(row_id); + if (this.isTreeGrid()) { + return this.moveRowUDTG(row_id, 1); + } + var rInd = this.rowsCol._dhx_find(r); + if (r.nextSibling) { + this.rowsCol._dhx_swapItems(rInd, rInd + 1); + if (r.nextSibling.nextSibling) { + r.parentNode.insertBefore(r, r.nextSibling.nextSibling); + } else { + r.parentNode.appendChild(r); + } + this.setSizes(); + var bInd = this.rowsBuffer._dhx_find(r); + this.rowsBuffer._dhx_swapItems(bInd, bInd + 1); + if (this._cssEven) { + this._fixAlterCss(rInd); + } + } + }; + this.getCombo = function (col_ind) { + if (!this.combos[col_ind]) { + this.combos[col_ind] = new dhtmlXGridComboObject(); + } + return this.combos[col_ind]; + }; + this.setUserData = function (row_id, name, value) { + if (!row_id) { + row_id = "gridglobaluserdata"; + } + if (!this.UserData[row_id]) { + this.UserData[row_id] = new Hashtable(); + } + this.UserData[row_id].put(name, value); + }; + this.getUserData = function (row_id, name) { + if (!row_id) { + row_id = "gridglobaluserdata"; + } + this.getRowById(row_id); + var z = this.UserData[row_id]; + return z ? z.get(name) : ""; + }; + this.setEditable = function (fl) { + this.isEditable = dhx4.s2b(fl); + }; + this.selectRowById = function (row_id, multiFL, show, call) { + if (!call) { + call = false; + } + this.selectCell(this.getRowById(row_id), 0, call, multiFL, false, show); + }; + this.clearSelection = function () { + this.editStop(); + for (var i = 0; i < this.selectedRows.length; i++) { + var r = this.rowsAr[this.selectedRows[i].idd]; + if (r) { + r.className = r.className.replace(/rowselected/g, ""); + } + } + this.selectedRows = dhtmlxArray(); + this.row = null; + if (this.cell != null) { + this.cell.className = this.cell.className.replace(/cellselected/g, ""); + this.cell = null; + } + this.callEvent("onSelectionCleared", []); + }; + this.copyRowContent = function (from_row_id, to_row_id) { + var frRow = this.getRowById(from_row_id); + if (!this.isTreeGrid()) { + for (var i = 0; i < frRow.cells.length; i++) { + this.cells(to_row_id, i).setValue(this.cells(from_row_id, i).getValue()); + } + } else { + this._copyTreeGridRowContent(frRow, from_row_id, to_row_id); + } + if (!_isIE) { + this.getRowById(from_row_id).cells[0].height = frRow.cells[0].offsetHeight; + } + }; + this.setFooterLabel = function (c, label, ind) { + return this.setColumnLabel(c, label, ind, this.ftr); + }; + this.setColumnLabel = function (c, label, ind, hdr) { + var z = (hdr || this.hdr).rows[ind || 1]; + var col = z._childIndexes ? z._childIndexes[c] : c; + if (!z.cells[col]) { + return; + } + if (!this.useImagesInHeader) { + var hdrHTML = "
"; + if (label.indexOf("img:[") != -1) { + var imUrl = label.replace(/.*\[([^>]+)\].*/, "$1"); + label = label.substr(label.indexOf("]") + 1, label.length); + hdrHTML += ""; + } + hdrHTML += label; + hdrHTML += "
"; + z.cells[col].innerHTML = hdrHTML; + if (this._hstyles[col]) { + z.cells[col].style.cssText = this._hstyles[c]; + } + } else { + z.cells[col].style.textAlign = "left"; + z.cells[col].innerHTML = ""; + var a = new Image(); + a.src = "" + label.replace(/(\.[a-z]+)/, ".des$1"); + this.preloadImagesAr[this.preloadImagesAr.length] = a; + var b = new Image(); + b.src = "" + label.replace(/(\.[a-z]+)/, ".asc$1"); + this.preloadImagesAr[this.preloadImagesAr.length] = b; + } + if ((label || "").indexOf("#") != -1) { + var t = label.match(/(^|{)#([^}]+)(}|$)/); + if (t) { + var tn = "_in_header_" + t[2]; + if (this[tn]) { + this[tn](this.forceDivInHeader ? z.cells[col].firstChild : z.cells[col], col, label.split(t[0])); + } + } + } + }; + this.setColLabel = function (a, b, ind, c) { + return this.setColumnLabel(a, b, (ind || 0) + 1, c); + }; + this.clearAll = function (header) { + if (!this.obj.rows[0]) { + return; + } + if (this._h2) { + this._h2 = this._createHierarchy(); + if (this._fake) { + if (this._realfake) { + this._h2 = this._fake._h2; + } else { + this._fake._h2 = this._h2; + } + } + } + this.limit = this._limitC = 0; + this.editStop(true); + if (this._dLoadTimer) { + window.clearTimeout(this._dLoadTimer); + } + if (this._dload) { + this.objBox.scrollTop = 0; + this.limit = this._limitC || 0; + this._initDrF = true; + } + var len = this.rowsCol.length; + len = this.obj.rows.length; + for (var i = len - 1; i > 0; i--) { + var t_r = this.obj.rows[i]; + t_r.parentNode.removeChild(t_r); + } + if (header) { + this._master_row = null; + this.obj.rows[0].parentNode.removeChild(this.obj.rows[0]); + for (var i = this.hdr.rows.length - 1; i >= 0; i--) { + var t_r = this.hdr.rows[i]; + t_r.parentNode.removeChild(t_r); + } + if (this.ftr) { + this.ftr.parentNode.removeChild(this.ftr); + this.ftr = null; + } + this._aHead = this.ftr = this.cellWidth = this._aFoot = null; + this.cellType = dhtmlxArray(); + this._hrrar = []; + this.columnIds = []; + this.combos = []; + this._strangeParams = []; + this.defVal = []; + this._ivizcol = null; + } + this.row = null; + this.cell = null; + this.rowsCol = dhtmlxArray(); + this.rowsAr = {}; + this._RaSeCol = []; + this.rowsBuffer = dhtmlxArray(); + this.UserData = []; + this.selectedRows = dhtmlxArray(); + if (this.pagingOn || this._srnd) { + this.xmlFileUrl = ""; + } + if (this.pagingOn) { + this.changePage(1); + } + if (this._contextCallTimer) { + window.clearTimeout(this._contextCallTimer); + } + if (this._sst) { + this.enableStableSorting(true); + } + this._fillers = this.undefined; + this.setSortImgState(false); + this.setSizes(); + this.callEvent("onClearAll", []); + }; + this.sortField = function (ind, repeatFl, r_el) { + if (this.getRowsNum() == 0) { + return false; + } + var el = this.hdr.rows[0].cells[ind]; + if (!el) { + return; + } + if (el.tagName == "TH" && this.fldSort.length - 1 >= el._cellIndex && this.fldSort[el._cellIndex] != "na") { + var data = this.getSortingState(); + var sortType = data[0] == ind && data[1] == "asc" ? "des" : "asc"; + if (!this.callEvent("onBeforeSorting", [ind, this.fldSort[ind], sortType])) { + return; + } + this.sortImg.className = "dhxgrid_sort_" + (sortType == "asc" ? "asc" : "desc"); + if (this.useImagesInHeader) { + var cel = this.hdr.rows[1].cells[el._cellIndex].firstChild; + if (this.fldSorted != null) { + var celT = this.hdr.rows[1].cells[this.fldSorted._cellIndex].firstChild; + celT.src = celT.src.replace(/(\.asc\.)|(\.des\.)/, "."); + } + cel.src = cel.src.replace(/(\.[a-z]+)$/, "." + sortType + "$1"); + } + this.sortRows(el._cellIndex, this.fldSort[el._cellIndex], sortType); + this.fldSorted = el; + this.r_fldSorted = r_el; + var c = this.hdr.rows[1]; + var c = r_el.parentNode; + var real_el = c._childIndexes ? c._childIndexes[el._cellIndex] : el._cellIndex; + this.setSortImgPos(false, false, false, r_el); + } + }; + this.setCustomSorting = function (func, col) { + if (!this._customSorts) { + this._customSorts = new Array(); + } + this._customSorts[col] = typeof func == "string" ? eval(func) : func; + this.fldSort[col] = "cus"; + }; + this.enableHeaderImages = function (fl) { + this.useImagesInHeader = fl; + }; + this.setHeader = function (hdrStr, splitSign, styles) { + if (typeof hdrStr != "object") { + var arLab = this._eSplit(hdrStr); + } else { + arLab = [].concat(hdrStr); + } + var arWdth = new Array(0); + var arTyp = new dhtmlxArray(0); + var arAlg = new Array(0); + var arVAlg = new Array(0); + var arSrt = new Array(0); + for (var i = 0; i < arLab.length; i++) { + arWdth[arWdth.length] = Math.round(100 / arLab.length); + arTyp[arTyp.length] = "ed"; + arAlg[arAlg.length] = "left"; + arVAlg[arVAlg.length] = "middle"; + arSrt[arSrt.length] = "na"; + } + this.splitSign = splitSign || "#cspan"; + this.hdrLabels = arLab; + this.cellWidth = arWdth; + if (!this.initCellWidth.length) { + this.setInitWidthsP(arWdth.join(this.delim), true); + } + this.cellType = arTyp; + this.cellAlign = arAlg; + this.cellVAlign = arVAlg; + this.fldSort = arSrt; + this._hstyles = styles || []; + }; + this._eSplit = function (str) { + if (![].push) { + return str.split(this.delim); + } + var a = "r" + new Date().valueOf(); + var z = this.delim.replace(/([\|\+\*\^])/g, "\\$1"); + return (str || "") + .replace(RegExp(z, "g"), a) + .replace(RegExp("\\\\" + a, "g"), this.delim) + .split(a); + }; + this.getColType = function (cInd) { + return this.cellType[cInd]; + }; + this.getColTypeById = function (cID) { + return this.cellType[this.getColIndexById(cID)]; + }; + this.setColTypes = function (typeStr) { + this.cellType = dhtmlxArray(typeStr.split(this.delim)); + this._strangeParams = new Array(); + for (var i = 0; i < this.cellType.length; i++) { + if (this.cellType[i].indexOf("[") != -1) { + var z = this.cellType[i].split(/[\[\]]+/g); + this.cellType[i] = z[0]; + this.defVal[i] = z[1]; + if (z[1].indexOf("=") == 0) { + this.cellType[i] = "math"; + this._strangeParams[i] = z[0]; + } + } + if (!window["eXcell_" + this.cellType[i]]) { + dhx4.callEvent("onConfigurationError", ["Incorrect cell type: " + this.cellType[i], this, this.cellType[i]]); + } + } + }; + this.setColSorting = function (sortStr) { + this.fldSort = sortStr.split(this.delim); + var check = { str: 1, int: 1, date: 1 }; + for (var i = 0; i < this.fldSort.length; i++) { + if (!check[this.fldSort[i]] && typeof window[this.fldSort[i]] == "function") { + if (!this._customSorts) { + this._customSorts = new Array(); + } + this._customSorts[i] = window[this.fldSort[i]]; + this.fldSort[i] = "cus"; + } + } + }; + this.setColAlign = function (alStr) { + this.cellAlign = alStr.split(this.delim); + for (var i = 0; i < this.cellAlign.length; i++) { + this.cellAlign[i] = this.cellAlign[i]._dhx_trim(); + } + }; + this.setColVAlign = function (valStr) { + this.cellVAlign = valStr.split(this.delim); + }; + this.setNoHeader = function (fl) { + this.noHeader = dhx4.s2b(fl); + }; + this.showRow = function (rowID) { + this.getRowById(rowID); + if (this._h2) { + this.openItem(this._h2.get[rowID].parent.id); + } + var c = this.getRowById(rowID).childNodes[0]; + while (c && c.style.display == "none") { + c = c.nextSibling; + } + if (c) { + this.moveToVisible(c, true); + } + }; + this.setStyle = function (ss_header, ss_grid, ss_selCell, ss_selRow) { + this.ssModifier = [ss_header, ss_grid, ss_selCell, ss_selCell, ss_selRow]; + var prefs = [ + "#" + this.entBox.id + " table.hdr td", + "#" + this.entBox.id + " table.obj td", + "#" + this.entBox.id + " table.obj tr.rowselected td.cellselected", + "#" + this.entBox.id + " table.obj td.cellselected", + "#" + this.entBox.id + " table.obj tr.rowselected td", + ]; + var index = 0; + while (!_isIE) { + try { + var temp = document.styleSheets[index].cssRules.length; + } catch (e) { + index++; + continue; + } + break; + } + for (var i = 0; i < prefs.length; i++) { + if (this.ssModifier[i]) { + if (_isIE) { + document.styleSheets[0].addRule(prefs[i], this.ssModifier[i]); + } else { + document.styleSheets[index].insertRule(prefs[i] + (" { " + this.ssModifier[i] + " }"), document.styleSheets[index].cssRules.length); + } + } + } + }; + this.setColumnColor = function (clr) { + this.columnColor = clr.split(this.delim); + }; + this.enableAlterCss = function (cssE, cssU, perLevel, levelUnique) { + if (cssE || cssU) { + this.attachEvent("onGridReconstructed", function () { + this._fixAlterCss(); + if (this._fake) { + this._fake._fixAlterCss(); + } + }); + } + this._cssSP = perLevel; + this._cssSU = levelUnique; + this._cssEven = cssE; + this._cssUnEven = cssU; + }; + this._fixAlterCss = function (ind) { + if (this._h2 && (this._cssSP || this._cssSU)) { + return this._fixAlterCssTGR(ind); + } + if (!this._cssEven && !this._cssUnEven) { + return; + } + ind = ind || 0; + var j = ind; + for (var i = ind; i < this.rowsCol.length; i++) { + if (!this.rowsCol[i]) { + continue; + } + if (this.rowsCol[i].style.display != "none") { + if (this.rowsCol[i]._cntr) { + j = 1; + continue; + } + if (this.rowsCol[i].className.indexOf("rowselected") != -1) { + if (j % 2 == 1) { + this.rowsCol[i].className = this._cssUnEven + " rowselected " + (this.rowsCol[i]._css || ""); + } else { + this.rowsCol[i].className = this._cssEven + " rowselected " + (this.rowsCol[i]._css || ""); + } + } else { + if (j % 2 == 1) { + this.rowsCol[i].className = this._cssUnEven + " " + (this.rowsCol[i]._css || ""); + } else { + this.rowsCol[i].className = this._cssEven + " " + (this.rowsCol[i]._css || ""); + } + } + j++; + } + } + }; + this.clearChangedState = function () { + for (var i = 0; i < this.rowsCol.length; i++) { + var row = this.rowsCol[i]; + if (row && row.childNodes) { + var cols = row.childNodes.length; + for (var j = 0; j < cols; j++) { + row.childNodes[j].wasChanged = false; + } + } + } + }; + this.getChangedRows = function (and_added) { + var res = new Array(); + this.forEachRow(function (id) { + var row = this.rowsAr[id]; + if (row.tagName != "TR") { + return; + } + var cols = row.childNodes.length; + if (and_added && row._added) { + res[res.length] = row.idd; + } else { + for (var j = 0; j < cols; j++) { + if (row.childNodes[j].wasChanged) { + res[res.length] = row.idd; + break; + } + } + } + }); + return res.join(this.delim); + }; + this._sUDa = false; + this._sAll = false; + this.setSerializationLevel = function (userData, fullXML, config, changedAttr, onlyChanged, asCDATA) { + this._sUDa = userData; + this._sAll = fullXML; + this._sConfig = config; + this._chAttr = changedAttr; + this._onlChAttr = onlyChanged; + this._asCDATA = asCDATA; + }; + this.setSerializableColumns = function (list) { + if (!list) { + this._srClmn = null; + return; + } + this._srClmn = (list || "").split(","); + for (var i = 0; i < this._srClmn.length; i++) { + this._srClmn[i] = dhx4.s2b(this._srClmn[i]); + } + }; + this._serialise = function (rCol, inner, closed) { + this.editStop(); + var out = []; + var close = ""; + if (this.isTreeGrid()) { + this._h2.forEachChildF( + 0, + function (el) { + var temp = this._serializeRow(this.render_row_tree(-1, el.id)); + out.push(temp); + if (temp) { + return true; + } else { + return false; + } + }, + this, + function () { + out.push(close); + } + ); + } else { + for (var i = 0; i < this.rowsBuffer.length; i++) { + if (this.rowsBuffer[i]) { + if (this._chAttr && this.rowsBuffer[i]._locator) { + continue; + } + var temp = this._serializeRow(this.render_row(i)); + out.push(temp); + if (temp) { + out.push(close); + } + } + } + } + return [out.join("")]; + }; + this._serializeRow = function (r, i) { + var out = []; + var ra = this.xml.row_attrs; + var ca = this.xml.cell_attrs; + out.push("<" + this.xml.s_row); + out.push(" id='" + r.idd + "'"); + if (this._sAll && this.selectedRows._dhx_find(r) != -1) { + out.push(" selected='1'"); + } + if (this._h2 && this._h2.get[r.idd].state == "minus") { + out.push(" open='1'"); + } + if (ra.length) { + for (var i = 0; i < ra.length; i++) { + out.push(" " + ra[i] + "='" + r._attrs[ra[i]] + "'"); + } + } + out.push(">"); + if (this._sUDa && this.UserData[r.idd]) { + keysAr = this.UserData[r.idd].getKeys(); + for (var ii = 0; ii < keysAr.length; ii++) { + out.push("" + (this._asCDATA ? "" : "") + ""); + } + } + var changeFl = false; + for (var jj = 0; jj < this._cCount; jj++) { + if (!this._srClmn || this._srClmn[jj]) { + var zx = this.cells3(r, jj); + out.push(""; + } + if (this._ecspn && zx.cell.colSpan && zx.cell.colSpan > 1) { + out.push(' colspan="' + zx.cell.colSpan + '" '); + } + if (this._chAttr) { + if (zx.wasChanged()) { + out.push(' changed="1"'); + changeFl = true; + } + } else { + if (this._onlChAttr && zx.wasChanged()) { + changeFl = true; + } + } + if (this._sAll && this.cellType[jj] == "tree") { + out.push((this._h2 ? " image='" + this._h2.get[r.idd].image + "'" : "") + ">" + zxVal + ""); + } else { + out.push(">" + zxVal + ""); + } + if (this._ecspn && zx.cell.colSpan) { + for (var u = 0; u < zx.cell.colSpan - 1; u++) { + out.push(""); + jj++; + } + } + } + } + if (this._onlChAttr && !changeFl && !r._added) { + return ""; + } + return out.join(""); + }; + this._serialiseConfig = function () { + var out = ""; + for (var i = 0; i < this.hdr.rows[0].cells.length; i++) { + if (this._srClmn && !this._srClmn[i]) { + continue; + } + var sort = this.fldSort[i]; + if (sort == "cus") { + sort = this._customSorts[i].toString(); + sort = sort.replace(/function[\ ]*/, "").replace(/\([^\f]*/, ""); + } + out += + ""; + if (this._asCDATA) { + out += ""; + } else { + out += this.getColumnLabel(i); + } + var z = this.getCombo(i); + if (z) { + for (var j = 0; j < z.keys.length; j++) { + out += ""; + } + } + out += ""; + } + return (out += ""); + }; + this.serialize = function () { + var out = ''; + if (this._mathSerialization) { + this._agetm = "getMathValue"; + } else { + this._agetm = "getValue"; + } + if (this._sUDa && this.UserData.gridglobaluserdata) { + var keysAr = this.UserData.gridglobaluserdata.getKeys(); + for (var i = 0; i < keysAr.length; i++) { + out += "" + this.UserData.gridglobaluserdata.get(keysAr[i]) + ""; + } + } + if (this._sConfig) { + out += this._serialiseConfig(); + } + out += this._serialise(); + out += ""; + return out; + }; + this.getPosition = function (oNode, pNode) { + if (!pNode) { + var pos = dhx4.getOffset(oNode); + return [pos.left, pos.top]; + } + pNode = pNode || document.body; + var oCurrentNode = oNode; + var iLeft = 0; + var iTop = 0; + while (oCurrentNode && oCurrentNode != pNode) { + iLeft += oCurrentNode.offsetLeft - oCurrentNode.scrollLeft; + iTop += oCurrentNode.offsetTop - oCurrentNode.scrollTop; + oCurrentNode = oCurrentNode.offsetParent; + } + if (pNode == document.body) { + if (_isIE) { + iTop += document.body.offsetTop || document.documentElement.offsetTop; + iLeft += document.body.offsetLeft || document.documentElement.offsetLeft; + } else { + if (!_isFF) { + iLeft += document.body.offsetLeft; + iTop += document.body.offsetTop; + } + } + } + return [iLeft, iTop]; + }; + this.getFirstParentOfType = function (obj, tag) { + while (obj && obj.tagName != tag && obj.tagName != "BODY") { + obj = obj.parentNode; + } + return obj; + }; + this.objBox.onscroll = function () { + this.grid._doOnScroll(); + }; + this.hdrBox.onscroll = function () { + if (this._try_header_sync) { + return; + } + this._try_header_sync = true; + if (Math.abs(this.grid.objBox.scrollLeft - this.scrollLeft) > 1) { + this.grid.objBox.scrollLeft = this.scrollLeft; + } + this._try_header_sync = false; + }; + if (!_isOpera || _OperaRv > 8.5) { + this.hdr.onmousemove = function (e) { + this.grid.changeCursorState(e || window.event); + }; + this.hdr.onmousedown = function (e) { + return this.grid.startColResize(e || window.event); + }; + } + this.obj.onmousemove = this._drawTooltip; + this.objBox.onclick = function (e) { + e = e || event; + e.cancelBubble = true; + this.firstChild.grid.setActive(true); + window.dhx4.callEvent("_onGridClick", [e, this.firstChild.grid]); + }; + this.obj.onclick = function (e) { + if (this.grid._doClick(e || window.event) !== false) { + if (this.grid._sclE) { + this.grid.editCell(e || window.event); + } else { + this.grid.editStop(); + } + } + e = e || event; + e.cancelBubble = true; + window.dhx4.callEvent("_onGridClick", [e, this.grid]); + }; + if (_isMacOS) { + this.entBox.oncontextmenu = function (e) { + e.cancelBubble = true; + if (e.preventDefault) { + e.preventDefault(); + } else { + e.returnValue = false; + } + var that = this.grid; + if (that._realfake) { + that = that._fake; + } + return that._doContClick(e || window.event); + }; + } else { + this.entBox.onmousedown = function (e) { + return this.grid._doContClick(e || window.event); + }; + this.entBox.oncontextmenu = function (e) { + if (this.grid._ctmndx) { + (e || event).cancelBubble = true; + } + return !this.grid._ctmndx; + }; + } + this.obj.ondblclick = function (e) { + if (!this.grid.wasDblClicked(e || window.event)) { + return false; + } + if (this.grid._dclE) { + var row = this.grid.getFirstParentOfType(_isIE ? event.srcElement : e.target, "TR"); + if (row == this.grid.row) { + this.grid.editCell(e || window.event); + } + } + (e || event).cancelBubble = true; + if (_isOpera) { + return false; + } + }; + this.hdr.onclick = this._onHeaderClick; + this.sortImg.onclick = function () { + self._onHeaderClick.apply({ grid: self }, [null, self.r_fldSorted]); + }; + this.hdr.ondblclick = this._onHeaderDblClick; + if (!document.body._dhtmlxgrid_onkeydown) { + dhtmlxEvent(document, "keydown", function (e) { + if (globalActiveDHTMLGridObject) { + return globalActiveDHTMLGridObject.doKey(e || window.event); + } + }); + document.body._dhtmlxgrid_onkeydown = true; + } + dhtmlxEvent(document.body, "click", function () { + if (self.editStop) { + self.editStop(); + } + if (self.isActive) { + self.setActive(false); + } + }); + if (this.entBox.style.height.toString().indexOf("%") != -1) { + this._delta_y = this.entBox.style.height; + } + if (this.entBox.style.width.toString().indexOf("%") != -1) { + this._delta_x = this.entBox.style.width; + } + if (this._delta_x || this._delta_y) { + this._setAutoResize(); + } + this.setColHidden = this.setColumnsVisibility; + this.enableCollSpan = this.enableColSpan; + this.setMultiselect = this.enableMultiselect; + this.setMultiLine = this.enableMultiline; + this.deleteSelectedItem = this.deleteSelectedRows; + this.getSelectedId = this.getSelectedRowId; + this.getHeaderCol = this.getColumnLabel; + this.isItemExists = this.doesRowExist; + this.getColumnCount = this.getColumnsNum; + this.setSelectedRow = this.selectRowById; + this.setHeaderCol = this.setColumnLabel; + this.preventIECashing = this.preventIECaching; + this.enableAutoHeigth = this.enableAutoHeight; + this.getUID = this.uid; + if (dhtmlx.image_path) { + this.setImagePath(dhtmlx.image_path); + } + if (dhtmlx.skin) { + this.setSkin(dhtmlx.skin); + } + return this; +} +dhtmlXGridObject.prototype = { + getRowAttribute: function (c, a) { + return this.getRowById(c)._attrs[a]; + }, + setRowAttribute: function (e, a, c) { + this.getRowById(e)._attrs[a] = c; + }, + isTreeGrid: function () { + return this.cellType._dhx_find("tree") != -1; + }, + setRowHidden: function (j, e) { + var c = dhx4.s2b(e); + var h = this.getRowById(j); + if (!h) { + return; + } + if (h.expand === "") { + this.collapseKids(h); + } + if (e && h.style.display != "none") { + h.style.display = "none"; + var g = this.selectedRows._dhx_find(h); + if (g != -1) { + h.className = h.className.replace("rowselected", ""); + for (var a = 0; a < h.childNodes.length; a++) { + h.childNodes[a].className = h.childNodes[a].className.replace(/cellselected/g, ""); + } + this.selectedRows._dhx_removeAt(g); + } + this.callEvent("onGridReconstructed", []); + } + if (!e && h.style.display == "none") { + h.style.display = ""; + this.callEvent("onGridReconstructed", []); + } + this.callEvent("onRowHide", [j, e]); + this.setSizes(); + }, + setColumnHidden: function (e, c) { + if (!this.hdr.rows.length) { + if (!this._ivizcol) { + this._ivizcol = []; + } + return (this._ivizcol[e] = c); + } + if (this.fldSorted && this.fldSorted.cellIndex == e && c) { + this.sortImg.style.display = "none"; + } + var a = dhx4.s2b(c); + if (a) { + if (!this._hrrar) { + this._hrrar = new Array(); + } else { + if (this._hrrar[e]) { + return; + } + } + this._hrrar[e] = "display:none;"; + this._hideShowColumn(e, "none"); + } else { + if (!this._hrrar || !this._hrrar[e]) { + return; + } + this._hrrar[e] = ""; + this._hideShowColumn(e, ""); + } + if (this.fldSorted && this.fldSorted.cellIndex == e && !c) { + this.sortImg.style.display = "inline"; + } + this.setSortImgPos(); + this.callEvent("onColumnHidden", [e, c]); + }, + isColumnHidden: function (a) { + if (this._hrrar && this._hrrar[a]) { + return true; + } + return false; + }, + setColumnsVisibility: function (c) { + if (c) { + this._ivizcol = c.split(this.delim); + } + if (this.hdr.rows.length && this._ivizcol) { + for (var a = 0; a < this._ivizcol.length; a++) { + this.setColumnHidden(a, this._ivizcol[a]); + } + } + }, + _fixHiddenRowsAll: function (n, e, a, c, l) { + l = l || "_cellIndex"; + var m = n.rows.length; + for (var h = 0; h < m; h++) { + var o = n.rows[h].childNodes; + if (o.length != this._cCount) { + for (var g = 0; g < o.length; g++) { + if (o[g][l] == e) { + o[g].style[a] = c; + break; + } + } + } else { + o[e].style[a] = c; + } + } + }, + _hideShowColumn: function (h, g) { + var a = h; + if (this.hdr.rows[1] && this.hdr.rows[1]._childIndexes && this.hdr.rows[1]._childIndexes[h] != h) { + a = this.hdr.rows[1]._childIndexes[h]; + } + if (g == "none") { + this.hdr.rows[0].cells[h]._oldWidth = this.hdr.rows[0].cells[h].style.width || this.initCellWidth[h] + "px"; + this.hdr.rows[0].cells[h]._oldWidthP = this.cellWidthPC[h]; + this.obj.rows[0].cells[h].style.width = "0px"; + var c = { rows: [this.obj.rows[0]] }; + this.forEachRow(function (j) { + if (this.rowsAr[j].tagName == "TR") { + c.rows.push(this.rowsAr[j]); + } + }); + this._fixHiddenRowsAll(c, h, "display", "none"); + if (this.isTreeGrid()) { + this._fixHiddenRowsAllTG(h, "none"); + } + if ((_isOpera && _OperaRv < 9) || _isKHTML || _isFF) { + this._fixHiddenRowsAll(this.hdr, h, "display", "none", "_cellIndexS"); + } + if (this.ftr) { + this._fixHiddenRowsAll(this.ftr.childNodes[0], h, "display", "none"); + } + this._fixHiddenRowsAll(this.hdr, h, "whiteSpace", "nowrap", "_cellIndexS"); + if (!this.cellWidthPX.length && !this.cellWidthPC.length) { + this.cellWidthPX = [].concat(this.initCellWidth); + } + if (this.cellWidthPX[h]) { + this.cellWidthPX[h] = 0; + } + if (this.cellWidthPC[h]) { + this.cellWidthPC[h] = 0; + } + } else { + if (this.hdr.rows[0].cells[h]._oldWidth) { + var e = this.hdr.rows[0].cells[h]; + if (_isOpera || _isKHTML || _isFF) { + this._fixHiddenRowsAll(this.hdr, h, "display", "", "_cellIndexS"); + } + if (this.ftr) { + this._fixHiddenRowsAll(this.ftr.childNodes[0], h, "display", ""); + } + var c = { rows: [this.obj.rows[0]] }; + this.forEachRow(function (j) { + if (this.rowsAr[j].tagName == "TR") { + c.rows.push(this.rowsAr[j]); + } + }); + this._fixHiddenRowsAll(c, h, "display", ""); + if (this.isTreeGrid()) { + this._fixHiddenRowsAllTG(h, ""); + } + this._fixHiddenRowsAll(this.hdr, h, "whiteSpace", "normal", "_cellIndexS"); + if (e._oldWidthP) { + this.cellWidthPC[h] = e._oldWidthP; + } + if (e._oldWidth) { + this.cellWidthPX[h] = parseInt(e._oldWidth); + } + } + } + this.setSizes(); + if (!_isIE && !_isFF) { + this.obj.border = 1; + this.obj.border = 0; + } + }, + enableColSpan: function (a) { + this._ecspn = dhx4.s2b(a); + }, + enableRowsHover: function (c, a) { + this._unsetRowHover(false, true); + this._hvrCss = a; + if (dhx4.s2b(c)) { + if (!this._elmnh) { + this.obj._honmousemove = this.obj.onmousemove; + this.obj.onmousemove = this._setRowHover; + if (_isIE) { + this.obj.onmouseleave = this._unsetRowHover; + } else { + this.obj.onmouseout = this._unsetRowHover; + } + this._elmnh = true; + } + } else { + if (this._elmnh) { + this.obj.onmousemove = this.obj._honmousemove; + if (_isIE) { + this.obj.onmouseleave = null; + } else { + this.obj.onmouseout = null; + } + this._elmnh = false; + } + } + }, + enableEditEvents: function (c, e, a) { + this._sclE = dhx4.s2b(c); + this._dclE = dhx4.s2b(e); + this._f2kE = dhx4.s2b(a); + }, + enableLightMouseNavigation: function (a) { + if (dhx4.s2b(a)) { + if (!this._elmn) { + this.entBox._onclick = this.entBox.onclick; + this.entBox.onclick = function () { + return true; + }; + this.obj._onclick = this.obj.onclick; + this.obj.onclick = function (g) { + var h = this.grid.getFirstParentOfType(g ? g.target : event.srcElement, "TD"); + if (!h) { + return; + } + this.grid.editStop(); + this.grid.doClick(h); + this.grid.editCell(); + (g || event).cancelBubble = true; + }; + this.obj._onmousemove = this.obj.onmousemove; + this.obj.onmousemove = this._autoMoveSelect; + this._elmn = true; + } + } else { + if (this._elmn) { + this.entBox.onclick = this.entBox._onclick; + this.obj.onclick = this.obj._onclick; + this.obj.onmousemove = this.obj._onmousemove; + this._elmn = false; + } + } + }, + _unsetRowHover: function (g, h) { + if (h) { + that = this; + } else { + that = this.grid; + } + if (that._lahRw && that._lahRw != h) { + for (var a = 0; a < that._lahRw.childNodes.length; a++) { + that._lahRw.childNodes[a].className = that._lahRw.childNodes[a].className.replace(that._hvrCss, ""); + } + that._lahRw = null; + } + }, + _setRowHover: function (g) { + var h = this.grid.getFirstParentOfType(g ? g.target : event.srcElement, "TD"); + if (h && h.parentNode != this.grid._lahRw) { + this.grid._unsetRowHover(0, h); + h = h.parentNode; + if (!h.idd || h.idd == "__filler__") { + return; + } + for (var a = 0; a < h.childNodes.length; a++) { + h.childNodes[a].className += " " + this.grid._hvrCss; + } + this.grid._lahRw = h; + } + this._honmousemove(g); + }, + _autoMoveSelect: function (a) { + if (!this.grid.editor) { + var g = this.grid.getFirstParentOfType(a ? a.target : event.srcElement, "TD"); + if (g.parentNode.idd) { + this.grid.doClick(g, true, 0); + } + } + this._onmousemove(a); + }, + enableDistributedParsing: function (e, a, c) { + if (dhx4.s2b(e)) { + this._ads_count = a || 10; + this._ads_time = c || 250; + } else { + this._ads_count = 0; + } + }, + destructor: function () { + this.editStop(true); + if (this._sizeTime) { + this._sizeTime = window.clearTimeout(this._sizeTime); + } + this.entBox.className = (this.entBox.className || "").replace(/gridbox.*/, ""); + if (this.formInputs) { + for (var e = 0; e < this.formInputs.length; e++) { + this.parentForm.removeChild(this.formInputs[e]); + } + } + var c; + for (var e = 0; e < this.rowsCol.length; e++) { + if (this.rowsCol[e]) { + this.rowsCol[e].grid = null; + } + } + for (e in this.rowsAr) { + if (this.rowsAr[e]) { + this.rowsAr[e] = null; + } + } + this.rowsCol = new dhtmlxArray(); + this.rowsAr = {}; + this.entBox.innerHTML = ""; + var g = function () {}; + this.entBox.onclick = this.entBox.onmousedown = this.entBox.onbeforeactivate = this.entBox.onbeforedeactivate = this.entBox.onbeforedeactivate = this.entBox.onselectstart = g; + this.setSizes = this._update_srnd_view = this.callEvent = g; + this.entBox.grid = this.objBox.grid = this.hdrBox.grid = this.obj.grid = this.hdr.grid = null; + if (this._fake) { + this.globalBox.innerHTML = ""; + this._fake.setSizes = this._fake._update_srnd_view = this._fake.callEvent = g; + this.globalBox.onclick = this.globalBox.onmousedown = this.globalBox.onbeforeactivate = this.globalBox.onbeforedeactivate = this.globalBox.onbeforedeactivate = this.globalBox.onselectstart = g; + } + for (c in this) { + if (this[c] && this[c].m_obj) { + this[c].m_obj = null; + } + this[c] = null; + } + if (this == globalActiveDHTMLGridObject) { + globalActiveDHTMLGridObject = null; + } + return null; + }, + getSortingState: function () { + var a = new Array(); + if (this.fldSorted) { + a[0] = this.fldSorted._cellIndex; + a[1] = this.sortImg.className == "dhxgrid_sort_desc" ? "des" : "asc"; + } + return a; + }, + enableAutoHeight: function (e, c, a) { + this._ahgr = dhx4.s2b(e); + this._ahgrF = dhx4.s2b(a); + this._ahgrM = c || null; + if (arguments.length == 1) { + this.objBox.style.overflowY = e ? "hidden" : "auto"; + } + if (c == "auto") { + this._ahgrM = null; + this._ahgrMA = true; + this._setAutoResize(); + } + }, + enableStableSorting: function (a) { + this._sst = dhx4.s2b(a); + this.rowsCol.stablesort = function (l) { + var h = this.length - 1; + for (var g = 0; g < this.length - 1; g++) { + for (var e = 0; e < h; e++) { + if (l(this[e], this[e + 1]) > 0) { + var c = this[e]; + this[e] = this[e + 1]; + this[e + 1] = c; + } + } + h--; + } + }; + }, + enableKeyboardSupport: function (a) { + this._htkebl = !dhx4.s2b(a); + }, + enableContextMenu: function (a) { + this._ctmndx = a; + }, + setScrollbarWidthCorrection: function (a) {}, + enableTooltips: function (c) { + this._enbTts = c.split(","); + for (var a = 0; a < this._enbTts.length; a++) { + this._enbTts[a] = dhx4.s2b(this._enbTts[a]); + } + }, + enableResizing: function (c) { + this._drsclmn = c.split(","); + for (var a = 0; a < this._drsclmn.length; a++) { + this._drsclmn[a] = dhx4.s2b(this._drsclmn[a]); + } + }, + setColumnMinWidth: function (a, c) { + if (arguments.length == 2) { + if (!this._drsclmW) { + this._drsclmW = new Array(); + } + this._drsclmW[c] = a; + } else { + this._drsclmW = a.split(","); + } + }, + enableCellIds: function (a) { + this._enbCid = dhx4.s2b(a); + }, + lockRow: function (a, e) { + var c = this.getRowById(a); + if (c) { + c._locked = dhx4.s2b(e); + if (this.cell && this.cell.parentNode.idd == a) { + this.editStop(); + } + } + }, + _getRowArray: function (h) { + var g = new Array(); + for (var e = 0; e < h.childNodes.length; e++) { + var c = this.cells3(h, e); + g[e] = c.getValue(); + } + return g; + }, + setDateFormat: function (c, a) { + this._dtmask = c; + this._dtmask_inc = a; + }, + setNumberFormat: function (m, e, h, l) { + var g = m.replace(/[^0\,\.]*/g, ""); + var a = g.indexOf("."); + if (a > -1) { + a = g.length - a - 1; + } + var c = g.indexOf(","); + if (c > -1) { + c = g.length - a - 2 - c; + } + if (typeof h != "string") { + h = this.i18n.decimal_separator; + } + if (typeof l != "string") { + l = this.i18n.group_separator; + } + var n = m.split(g)[0]; + var j = m.split(g)[1]; + this._maskArr[e] = [a, c, n, j, h, l]; + }, + _aplNFb: function (h, g) { + var c = this._maskArr[g]; + if (!c) { + return h; + } + var e = parseFloat(h.toString().replace(/[^0-9]*/g, "")); + if (h.toString().substr(0, 1) == "-") { + e = e * -1; + } + if (c[0] > 0) { + e = e / Math.pow(10, c[0]); + } + return e; + }, + _aplNF: function (l, h) { + var e = this._maskArr[h]; + if (!e) { + return l; + } + var m = (parseFloat(l) < 0 ? "-" : "") + e[2]; + l = Math.abs(Math.round(parseFloat(l) * Math.pow(10, e[0] > 0 ? e[0] : 0))).toString(); + l = (l.length < e[0] + ? Math.pow(10, e[0] + 1 - l.length) + .toString() + .substr(1, e[0] + 1) + l.toString() + : l + ) + .split("") + .reverse(); + l[e[0]] = (l[e[0]] || "0") + e[4]; + if (e[1] > 0) { + for (var g = (e[0] > 0 ? 0 : 1) + e[0] + e[1]; g < l.length; g += e[1]) { + l[g] += e[5]; + } + } + return m + l.reverse().join("") + e[3]; + }, + _launchCommands: function (a) { + for (var g = 0; g < a.length; g++) { + var e = new Array(); + for (var c = 0; c < a[g].childNodes.length; c++) { + if (a[g].childNodes[c].nodeType == 1) { + e[e.length] = a[g].childNodes[c].firstChild.data; + } + } + this[a[g].getAttribute("command")].apply(this, e); + } + }, + _parseHead: function (h) { + var g = dhx4.ajax.xpath("./head", h); + if (g.length) { + var l = dhx4.ajax.xpath("./column", g[0]); + var m = dhx4.ajax.xpath("./settings", g[0]); + var C = "setInitWidths"; + var w = false; + if (m[0]) { + for (var n = 0; n < m[0].childNodes.length; n++) { + switch (m[0].childNodes[n].tagName) { + case "colwidth": + if (m[0].childNodes[n].firstChild && m[0].childNodes[n].firstChild.data == "%") { + C = "setInitWidthsP"; + } + break; + case "splitat": + w = m[0].childNodes[n].firstChild ? m[0].childNodes[n].firstChild.data : false; + break; + } + } + } + this._launchCommands(dhx4.ajax.xpath("./beforeInit/call", g[0])); + if (l.length > 0) { + if (this.hdr.rows.length > 0) { + this.clearAll(true); + } + var a = [[], [], [], [], [], [], [], [], []]; + var v = ["", "width", "type", "align", "sort", "color", "format", "hidden", "id"]; + var u = ["", C, "setColTypes", "setColAlign", "setColSorting", "setColumnColor", "", "", "setColumnIds"]; + for (var A = 0; A < l.length; A++) { + for (var y = 1; y < v.length; y++) { + a[y].push(l[A].getAttribute(v[y])); + } + a[0].push((l[A].firstChild ? l[A].firstChild.data : "").replace(/^\s*((\s\S)*.+)\s*$/gi, "$1")); + } + this.setHeader(a[0]); + for (var A = 0; A < u.length; A++) { + if (u[A]) { + this[u[A]](a[A].join(this.delim)); + } + } + for (var A = 0; A < l.length; A++) { + if (this.cellType[A].indexOf("co") == 0 || this.cellType[A] == "clist") { + var o = dhx4.ajax.xpath("./option", l[A]); + if (o.length) { + var x = new Array(); + if (this.cellType[A] == "clist") { + for (var y = 0; y < o.length; y++) { + x[x.length] = o[y].firstChild ? o[y].firstChild.data : ""; + } + this.registerCList(A, x); + } else { + var D = this.getCombo(A); + for (var y = 0; y < o.length; y++) { + D.put(o[y].getAttribute("value"), o[y].firstChild ? o[y].firstChild.data : ""); + } + } + } + } else { + if (a[6][A]) { + if (this.cellType[A].toLowerCase().indexOf("calendar") != -1 || this.fldSort[A] == "date") { + this.setDateFormat(a[6][A]); + } else { + this.setNumberFormat(a[6][A], A); + } + } + } + } + this.init(); + var e = a[7].join(this.delim); + if (this.setColHidden && e.replace(/,/g, "") != "") { + this.setColHidden(e); + } + if (w && this.splitAt) { + this.splitAt(w); + } + } + this._launchCommands(dhx4.ajax.xpath("./afterInit/call", g[0])); + } + var c = dhx4.ajax.xpath("//rows/userdata", h); + if (c.length > 0) { + if (!this.UserData.gridglobaluserdata) { + this.UserData.gridglobaluserdata = new Hashtable(); + } + for (var y = 0; y < c.length; y++) { + var E = ""; + for (var r = 0; r < c[y].childNodes.length; r++) { + E += c[y].childNodes[r].nodeValue; + } + this.UserData.gridglobaluserdata.put(c[y].getAttribute("name"), E); + } + } + }, + getCheckedRows: function (a) { + var c = new Array(); + this.forEachRowA(function (g) { + var e = this.cells(g, a); + if (e.changeState && e.getValue() != 0) { + c.push(g); + } + }, true); + return c.join(","); + }, + checkAll: function () { + var c = arguments.length ? arguments[0] : 1; + for (var a = 0; a < this.getColumnsNum(); a++) { + if (this.getColType(a) == "ch") { + this.setCheckedRows(a, c); + } + } + }, + uncheckAll: function () { + this.checkAll(0); + }, + setCheckedRows: function (c, a) { + this.forEachRowA(function (e) { + if (this.cells(e, c).isCheckbox()) { + this.cells(e, c).setValue(a); + } + }); + }, + _drawTooltip: function (j) { + var l = this.grid.getFirstParentOfType(j ? j.target : event.srcElement, "TD"); + if (!l || (this.grid.editor && this.grid.editor.cell == l)) { + return true; + } + var h = l.parentNode; + if (!h.idd || h.idd == "__filler__") { + return; + } + var g = j ? j.target : event.srcElement; + if (h.idd == window.unknown) { + return true; + } + if (!this.grid.callEvent("onMouseOver", [h.idd, l._cellIndex, j || window.event])) { + return true; + } + if (this.grid._enbTts && !this.grid._enbTts[l._cellIndex]) { + if (g.title) { + g.title = ""; + } + return true; + } + if (l._cellIndex >= this.grid._cCount) { + return; + } + var a = this.grid.cells3(h, l._cellIndex); + if (!a || !a.cell || !a.cell._attrs) { + return; + } + if (g._title) { + a.cell.title = ""; + } + if (!a.cell._attrs.title) { + g._title = true; + } + if (a) { + g.title = a.cell._attrs.title || (a.getTitle ? a.getTitle() : (a.getValue() || "").toString().replace(/<[^>]*>/gi, "")); + } + return true; + }, + enableCellWidthCorrection: function (a) { + if (_isFF) { + this._wcorr = parseInt(a); + } + }, + getAllRowIds: function (e) { + var a = []; + for (var c = 0; c < this.rowsBuffer.length; c++) { + if (this.rowsBuffer[c]) { + a.push(this.rowsBuffer[c].idd); + } + } + return a.join(e || this.delim); + }, + getAllItemIds: function () { + return this.getAllRowIds(); + }, + setColspan: function (e, x, g) { + if (!this._ecspn) { + return; + } + var a = this.getRowById(e); + if (a._childIndexes && a.childNodes[a._childIndexes[x]]) { + var o = a._childIndexes[x]; + var h = a.childNodes[o]; + var l = h.colSpan; + h.colSpan = 1; + if (l && l != 1) { + for (var u = 1; u < l; u++) { + var w = document.createElement("TD"); + if (h.nextSibling) { + a.insertBefore(w, h.nextSibling); + } else { + a.appendChild(w); + } + a._childIndexes[x + u] = o + u; + w._cellIndex = x + u; + w.style.textAlign = this.cellAlign[u]; + w.style.verticalAlign = this.cellVAlign[u]; + h = w; + this.cells3(a, x + u).setValue(""); + } + } + for (var v = x * 1 + 1 * l; v < a._childIndexes.length; v++) { + a._childIndexes[v] += (l - 1) * 1; + } + } + if (g && g > 1) { + if (a._childIndexes) { + var o = a._childIndexes[x]; + } else { + var o = x; + a._childIndexes = new Array(); + for (var v = 0; v < a.childNodes.length; v++) { + a._childIndexes[v] = v; + } + } + a.childNodes[o].colSpan = g; + for (var v = 1; v < g; v++) { + a._childIndexes[a.childNodes[o + 1]._cellIndex] = o; + a.removeChild(a.childNodes[o + 1]); + } + var s = a.childNodes[a._childIndexes[x]]._cellIndex; + for (var v = s * 1 + 1 * g; v < a._childIndexes.length; v++) { + a._childIndexes[v] -= g - 1; + } + } + }, + preventIECaching: function (a) { + dhx4.ajax.cache = !a; + }, + enableColumnAutoSize: function (a) { + this._eCAS = dhx4.s2b(a); + }, + _onHeaderDblClick: function (g) { + var c = this.grid; + var a = c.getFirstParentOfType(_isIE ? event.srcElement : g.target, "TD"); + if (!c._eCAS) { + return false; + } + c.adjustColumnSize(a._cellIndexS); + }, + adjustColumnSize: function (o, c) { + if (this._hrrar && this._hrrar[o]) { + return; + } + this._notresize = true; + var e = 0; + this._setColumnSizeR(o, 20); + for (var h = 1; h < this.hdr.rows.length; h++) { + var s = this.hdr.rows[h]; + s = s.childNodes[s._childIndexes ? s._childIndexes[o] : o]; + if (s && (!s.colSpan || s.colSpan < 2) && s._cellIndex == o) { + if (s.childNodes[0] && s.childNodes[0].className == "hdrcell") { + s = s.childNodes[0]; + } + e = Math.max(e, s.scrollWidth); + } + } + var g = this.obj.rows.length; + var r = 0; + var v = this.cellType._dhx_find("tree"); + for (var n = 1; n < g; n++) { + var u = this.obj.rows[n]; + if (!this.rowsAr[u.idd]) { + continue; + } + if ((u._childIndexes && u._childIndexes[o] != o) || !u.childNodes[o]) { + continue; + } + r = (u.childNodes[o].innerText || u.childNodes[o].textContent || "").length * this.fontWidth; + if (this._h2 && o == v) { + r += this._h2.get[u.idd].level * 22; + } + if (r > e) { + e = r; + } + } + e += 20 + (c || 0); + this._setColumnSizeR(o, e); + this._notresize = false; + this.setSizes(); + }, + detachHeader: function (a, e) { + e = e || this.hdr; + var c = e.rows[a + 1]; + if (c) { + c.parentNode.removeChild(c); + } + this.setSizes(); + }, + detachFooter: function (a) { + this.detachHeader(a, this.ftr); + }, + attachHeader: function (a, g, c) { + if (typeof a == "string") { + a = this._eSplit(a); + } + if (typeof g == "string") { + g = g.split(this.delim); + } + c = c || "_aHead"; + if (this.hdr.rows.length) { + if (a) { + this._createHRow([a, g], this[c == "_aHead" ? "hdr" : "ftr"]); + } else { + if (this[c]) { + for (var e = 0; e < this[c].length; e++) { + this.attachHeader.apply(this, this[c][e]); + } + } + } + } else { + if (!this[c]) { + this[c] = new Array(); + } + this[c][this[c].length] = [a, g, c]; + } + }, + _createHRow: function (e, r) { + if (!r) { + if (this.entBox.style.position != "absolute") { + this.entBox.style.position = "relative"; + } + var m = document.createElement("DIV"); + m.className = "c_ftr".substr(2); + this.entBox.appendChild(m); + var v = document.createElement("TABLE"); + v.cellPadding = v.cellSpacing = 0; + if (!_isIE || _isIE == 8) { + v.width = "100%"; + v.style.paddingRight = "20px"; + } + v.style.marginRight = "20px"; + v.style.tableLayout = "fixed"; + m.appendChild(v); + v.appendChild(document.createElement("TBODY")); + this.ftr = r = v; + var l = v.insertRow(0); + var a = this.hdrLabels.length <= 1 ? e[0].length : this.hdrLabels.length; + for (var g = 0; g < a; g++) { + l.appendChild(document.createElement("TH")); + l.childNodes[g]._cellIndex = g; + } + if (_isIE && _isIE < 8) { + l.style.position = "absolute"; + } else { + l.style.height = "auto"; + } + } + var h = e[1]; + var m = document.createElement("TR"); + r.rows[0].parentNode.appendChild(m); + for (var g = 0; g < e[0].length; g++) { + if (e[0][g] == "#cspan") { + var n = m.cells[m.cells.length - 1]; + n.colSpan = (n.colSpan || 1) + 1; + continue; + } + if (e[0][g] == "#rspan" && r.rows.length > 1) { + var y = r.rows.length - 2; + var x = false; + var n = null; + while (!x) { + var n = r.rows[y]; + for (var c = 0; c < n.cells.length; c++) { + if (n.cells[c]._cellIndex == g) { + x = c + 1; + break; + } + } + y--; + } + n = n.cells[x - 1]; + n.rowSpan = (n.rowSpan || 1) + 1; + continue; + } + var o = document.createElement("TD"); + o._cellIndex = o._cellIndexS = g; + if (this._hrrar && this._hrrar[g] && !_isIE) { + o.style.display = "none"; + } + if (typeof e[0][g] == "object") { + o.appendChild(e[0][g]); + } else { + if (this.forceDivInHeader) { + o.innerHTML = "
" + (e[0][g] || " ") + "
"; + } else { + o.innerHTML = e[0][g] || " "; + } + if ((e[0][g] || "").indexOf("#") != -1) { + var v = e[0][g].match(/(^|{)#([^}]+)(}|$)/); + if (v) { + var s = "_in_header_" + v[2]; + if (this[s]) { + this[s](this.forceDivInHeader ? o.firstChild : o, g, e[0][g].split(v[0])); + } + } + } + } + if (h) { + o.style.cssText = h[g]; + } + m.appendChild(o); + } + var u = r; + if (_isKHTML) { + if (r._kTimer) { + window.clearTimeout(r._kTimer); + } + r._kTimer = window.setTimeout(function () { + r.rows[1].style.display = "none"; + window.setTimeout(function () { + r.rows[1].style.display = ""; + }, 1); + }, 500); + } + }, + attachFooter: function (a, c) { + this.attachHeader(a, c, "_aFoot"); + }, + setCellExcellType: function (e, a, c) { + this.changeCellType(this.getRowById(e), a, c); + }, + changeCellType: function (e, g, c) { + c = c || this.cellType[g]; + var h = this.cells3(e, g); + var a = h.getValue(); + h.cell._cellType = c; + var h = this.cells3(e, g); + h.setValue(a); + }, + setRowExcellType: function (e, c) { + var g = this.rowsAr[e]; + for (var a = 0; a < g.childNodes.length; a++) { + this.changeCellType(g, a, c); + } + }, + setColumnExcellType: function (a, e) { + for (var c = 0; c < this.rowsBuffer.length; c++) { + if (this.rowsBuffer[c] && this.rowsBuffer[c].tagName == "TR") { + this.changeCellType(this.rowsBuffer[c], a, e); + } + } + if (this.cellType[a] == "math") { + this._strangeParams[c] = e; + } else { + this.cellType[a] = e; + } + }, + forEachRow: function (e) { + for (var c in this.rowsAr) { + if (this.rowsAr[c] && this.rowsAr[c].idd) { + e.apply(this, [this.rowsAr[c].idd]); + } + } + }, + forEachRowA: function (e) { + for (var c = 0; c < this.rowsBuffer.length; c++) { + if (this.rowsBuffer[c]) { + e.call(this, this.render_row(c).idd); + } + } + }, + forEachCell: function (e, c) { + var g = this.getRowById(e); + if (!g) { + return; + } + for (var a = 0; a < this._cCount; a++) { + c(this.cells3(g, a), a); + } + }, + enableAutoWidth: function (e, a, c) { + this._awdth = [dhx4.s2b(e), parseInt(a || 99999), parseInt(c || 0)]; + if (arguments.length == 1) { + this.objBox.style.overflowX = e ? "hidden" : "auto"; + } + }, + updateFromXML: function (a, g, c, e) { + if (typeof g == "undefined") { + g = true; + } + this._refresh_mode = [true, g, c]; + this.load(a, e); + }, + _refreshFromXML: function (g) { + if (this._f_rowsBuffer) { + this.filterBy(0, ""); + } + reset = false; + if (window.eXcell_tree) { + eXcell_tree.prototype.setValueX = eXcell_tree.prototype.setValue; + eXcell_tree.prototype.setValue = function (u) { + var s = this.grid._h2.get[this.cell.parentNode.idd]; + if (s && this.cell.parentNode.valTag) { + this.setLabel(u); + } else { + this.setValueX(u); + } + }; + } + var r = this.cellType._dhx_find("tree"); + var j = dhx4.ajax.xmltop("rows", g); + var h = j.getAttribute("parent") || 0; + var m = {}; + if (this._refresh_mode[2]) { + if (r != -1) { + this._h2.forEachChild( + h, + function (s) { + m[s.id] = true; + }, + this + ); + } else { + this.forEachRow(function (s) { + m[s] = true; + }); + } + } + var o = dhx4.ajax.xpath("//row", j); + for (var e = 0; e < o.length; e++) { + var n = o[e]; + var a = n.getAttribute("id"); + m[a] = false; + var h = n.parentNode.getAttribute("id") || h; + if (this.rowsAr[a] && this.rowsAr[a].tagName != "TR") { + if (this._h2) { + this._h2.get[a].buff.data = n; + } else { + this.rowsBuffer[this.getRowIndex(a)].data = n; + } + this.rowsAr[a] = n; + } else { + if (this.rowsAr[a]) { + this._process_xml_row(this.rowsAr[a], n, -1); + this._postRowProcessing(this.rowsAr[a], true); + if (this._fake && this._fake.rowsAr[a]) { + this._fake._process_xml_row(this._fake.rowsAr[a], n, -1); + } + } else { + if (this._refresh_mode[1]) { + var l = { idd: a, data: n, _parser: this._process_xml_row, _locator: this._get_xml_data }; + var c = this.rowsBuffer.length; + if (this._refresh_mode[1] == "top") { + this.rowsBuffer.unshift(l); + c = 0; + } else { + this.rowsBuffer.push(l); + } + if (this._h2) { + reset = true; + this._h2.add(a, n.parentNode.getAttribute("id") || n.parentNode.getAttribute("parent")).buff = this.rowsBuffer[this.rowsBuffer.length - 1]; + } else { + if (this._srnd) { + reset = true; + } + } + this.rowsAr[a] = n; + n = this.render_row(c); + this._insertRowAt(n, c ? -1 : 0); + } + } + } + } + if (this._refresh_mode[2]) { + for (a in m) { + if (m[a] && this.rowsAr[a]) { + this.deleteRow(a); + } + } + } + this._refresh_mode = null; + if (window.eXcell_tree) { + eXcell_tree.prototype.setValue = eXcell_tree.prototype.setValueX; + } + if (reset) { + if (this._h2) { + this._renderSort(); + } else { + this.render_dataset(); + } + } + if (this._f_rowsBuffer) { + this._f_rowsBuffer = null; + this.filterByAll(); + } + }, + getCustomCombo: function (e, c) { + var a = this.cells(e, c).cell; + if (!a._combo) { + a._combo = new dhtmlXGridComboObject(); + } + return a._combo; + }, + setTabOrder: function (c) { + var g = c.split(this.delim); + this._tabOrder = []; + var a = this._cCount || c.length; + for (var e = 0; e < a; e++) { + g[e] = { c: parseInt(g[e]), ind: e }; + } + g.sort(function (j, h) { + return j.c > h.c ? 1 : -1; + }); + for (var e = 0; e < a; e++) { + if (!g[e + 1] || typeof g[e].c == "undefined") { + this._tabOrder[g[e].ind] = (g[0].ind + 1) * -1; + } else { + this._tabOrder[g[e].ind] = g[e + 1].ind; + } + } + }, + i18n: { loading: "Loading", decimal_separator: ".", group_separator: "," }, + _key_events: { + k13_1_0: function () { + var a = this.rowsCol._dhx_find(this.row); + this.selectCell(this.rowsCol[a + 1], this.cell._cellIndex, true); + }, + k13_0_1: function () { + var a = this.rowsCol._dhx_find(this.row); + this.selectCell(this.rowsCol[a - 1], this.cell._cellIndex, true); + }, + k13_0_0: function () { + this.editStop(); + this.callEvent("onEnter", [this.row ? this.row.idd : null, this.cell ? this.cell._cellIndex : null]); + this._still_active = true; + }, + k9_0_0: function () { + this.editStop(); + if (!this.callEvent("onTab", [true])) { + return true; + } + var a = this._getNextCell(null, 1); + if (a) { + this.selectCell(a.parentNode, a._cellIndex, this.row != a.parentNode, false, true); + this._still_active = true; + } + }, + k9_0_1: function () { + this.editStop(); + if (!this.callEvent("onTab", [false])) { + return false; + } + var a = this._getNextCell(null, -1); + if (a) { + this.selectCell(a.parentNode, a._cellIndex, this.row != a.parentNode, false, true); + this._still_active = true; + } + }, + k113_0_0: function () { + if (this._f2kE) { + this.editCell(); + } + }, + k32_0_0: function () { + var a = this.cells4(this.cell); + if (!a.changeState || a.changeState() === false) { + return false; + } + }, + k27_0_0: function () { + this.editStop(true); + }, + k33_0_0: function () { + if (this.pagingOn) { + this.changePage(this.currentPage - 1); + } else { + this.scrollPage(-1); + } + }, + k34_0_0: function () { + if (this.pagingOn) { + this.changePage(this.currentPage + 1); + } else { + this.scrollPage(1); + } + }, + k37_0_0: function () { + if (!this.editor && this.isTreeGrid()) { + this.collapseKids(this.row); + } else { + return false; + } + }, + k39_0_0: function () { + if (!this.editor && this.isTreeGrid()) { + this.expandKids(this.row); + } else { + return false; + } + }, + k40_0_0: function () { + var c = this._realfake ? this._fake : this; + if (this.editor && this.editor.combo) { + this.editor.shiftNext(); + } else { + if (!this.row.idd) { + return; + } + var a = Math.max(c._r_select || 0, this.getRowIndex(this.row.idd)); + var e = this._nextRow(a, 1); + if (e) { + c._r_select = null; + this.selectCell(e, this.cell._cellIndex, true); + if (c.pagingOn) { + c.showRow(e.idd); + } + } else { + if (!this.callEvent("onLastRow", [])) { + return false; + } + this._key_events.k34_0_0.apply(this, []); + if (this.pagingOn && this.rowsCol[a + 1]) { + this.selectCell(a + 1, 0, true); + } + } + } + this._still_active = true; + }, + k38_0_0: function () { + var c = this._realfake ? this._fake : this; + if (this.editor && this.editor.combo) { + this.editor.shiftPrev(); + } else { + if (!this.row.idd) { + return; + } + var a = this.getRowIndex(this.row.idd) + 1; + if (a != -1 && (!this.pagingOn || a != 1)) { + var e = this._nextRow(a - 1, -1); + this.selectCell(e, this.cell._cellIndex, true); + if (c.pagingOn && e) { + c.showRow(e.idd); + } + } else { + this._key_events.k33_0_0.apply(this, []); + } + } + this._still_active = true; + }, + }, + _build_master_row: function () { + var e = document.createElement("DIV"); + var c = [""]; + for (var a = 0; a < this._cCount; a++) { + c.push(""); + } + c.push("
"); + e.innerHTML = c.join(""); + this._master_row = e.firstChild.rows[0]; + }, + _prepareRow: function (a) { + if (!this._master_row) { + this._build_master_row(); + } + var e = this._master_row.cloneNode(true); + for (var c = 0; c < e.childNodes.length; c++) { + e.childNodes[c]._cellIndex = c; + if (this._enbCid) { + e.childNodes[c].id = "c_" + a + "_" + c; + } + if (this.dragAndDropOff) { + this.dragger.addDraggableItem(e.childNodes[c], this); + } + } + e.idd = a; + e.grid = this; + return e; + }, + _process_jsarray_row: function (c, e) { + c._attrs = {}; + for (var a = 0; a < c.childNodes.length; a++) { + c.childNodes[a]._attrs = {}; + } + this._fillRow(c, this._c_order ? this._swapColumns(e) : e); + return c; + }, + _get_jsarray_data: function (c, a) { + return c[a]; + }, + _process_json_row: function (a, c) { + c = this._c_order ? this._swapColumns(c.data) : c.data; + return this._process_some_row(a, c); + }, + _process_some_row: function (c, e) { + c._attrs = {}; + for (var a = 0; a < c.childNodes.length; a++) { + c.childNodes[a]._attrs = {}; + } + this._fillRow(c, e); + return c; + }, + _get_json_data: function (c, a) { + return c.data[a]; + }, + _process_js_row: function (e, g) { + var a = []; + for (var c = 0; c < this.columnIds.length; c++) { + a[c] = g[this.columnIds[c]]; + if (!a[c] && a[c] !== 0) { + a[c] = ""; + } + } + this._process_some_row(e, a); + e._attrs = g; + return e; + }, + _get_js_data: function (c, a) { + return c[this.columnIds[a]]; + }, + _process_csv_row: function (c, e) { + c._attrs = {}; + for (var a = 0; a < c.childNodes.length; a++) { + c.childNodes[a]._attrs = {}; + } + this._fillRow(c, this._c_order ? this._swapColumns(e.split(this.csv.cell)) : e.split(this.csv.cell)); + return c; + }, + _get_csv_data: function (c, a) { + return c.split(this.csv.cell)[a]; + }, + _process_store_row: function (h, g) { + var a = []; + for (var e = 0; e < this.columnIds.length; e++) { + a[e] = g[this.columnIds[e]]; + } + for (var c = 0; c < h.childNodes.length; c++) { + h.childNodes[c]._attrs = {}; + } + h._attrs = g; + this._fillRow(h, a); + }, + _process_xml_row: function (a, l) { + var u = dhx4.ajax.xpath(this.xml.cell, l); + var o = []; + a._attrs = this._xml_attrs(l); + if (this._ud_enabled) { + var s = dhx4.ajax.xpath("./userdata", l); + for (var h = s.length - 1; h >= 0; h--) { + var n = ""; + for (var e = 0; e < s[h].childNodes.length; e++) { + n += s[h].childNodes[e].nodeValue; + } + this.setUserData(a.idd, s[h].getAttribute("name"), n); + } + } + for (var e = 0; e < u.length; e++) { + var g = u[this._c_order ? this._c_order[e] : e]; + if (!g) { + continue; + } + var c = a._childIndexes ? a._childIndexes[e] : e; + var m = g.getAttribute("type"); + if (a.childNodes[c]) { + if (m) { + a.childNodes[c]._cellType = m; + } + a.childNodes[c]._attrs = this._xml_attrs(g); + } + if (!g.getAttribute("xmlcontent")) { + if (g.firstChild) { + g = g.firstChild.wholeText || g.firstChild.data; + } else { + g = ""; + } + } + o.push(g); + } + for (e < u.length; e < a.childNodes.length; e++) { + a.childNodes[e]._attrs = {}; + } + if (a.parentNode && a.parentNode.tagName == "row") { + a._attrs.parent = a.parentNode.getAttribute("idd"); + } + this._fillRow(a, o); + return a; + }, + _get_xml_data: function (c, a) { + c = c.firstChild; + while (true) { + if (!c) { + return ""; + } + if (c.tagName == "cell") { + a--; + } + if (a < 0) { + break; + } + c = c.nextSibling; + } + return c.firstChild ? c.firstChild.data : ""; + }, + _fillRow: function (g, j) { + if (this.editor && this.editor.parentNode && this.editor.parentNode.idd == g.idd) { + this.editStop(); + } + for (var c = 0; c < g.childNodes.length; c++) { + if (c < j.length || this.defVal[c]) { + var e = g.childNodes[c]._cellIndex; + var h = j[e]; + var a = this.cells4(g.childNodes[c]); + if (this.defVal[e] && (h == "" || typeof h == "undefined")) { + h = this.defVal[e]; + } + if (a) { + a.setValue(h); + } + } else { + g.childNodes[c].innerHTML = " "; + g.childNodes[c]._clearCell = true; + } + } + return g; + }, + _postRowProcessing: function (j, m) { + if (j._attrs["class"]) { + j._css = j.className = j._attrs["class"]; + } + if (j._attrs.locked) { + j._locked = true; + } + if (j._attrs.bgColor) { + j.bgColor = j._attrs.bgColor; + } + var l = 0; + for (var e = 0; e < j.childNodes.length; e++) { + var n = j.childNodes[e]; + var h = n._cellIndex; + var g = n._attrs.style || j._attrs.style; + if (g) { + n.style.cssText += ";" + g; + } + if (n._attrs["class"]) { + n.className = n._attrs["class"]; + } + g = n._attrs.align || this.cellAlign[h]; + if (g) { + n.align = g; + } + n.vAlign = n._attrs.valign || this.cellVAlign[h]; + var a = n._attrs.bgColor || this.columnColor[h]; + if (a) { + n.bgColor = a; + } + if (n._attrs.colspan && !m) { + this.setColspan(j.idd, e + l, n._attrs.colspan); + l += n._attrs.colspan - 1; + } + if (this._hrrar && this._hrrar[h] && !m) { + n.style.display = "none"; + } + } + this.callEvent("onRowCreated", [j.idd, j, null]); + }, + load: function (a, e, c) { + this.callEvent("onXLS", [this]); + if (arguments.length == 2 && typeof e != "function") { + c = e; + e = null; + } + c = c || "xml"; + if (!this.xmlFileUrl) { + this.xmlFileUrl = a; + } + this._data_type = c; + this.xmlLoader = this.doLoadDetails; + var g = this; + this.xmlLoader = function (h) { + if (!g.callEvent) { + return; + } + g["_process_" + c](h.xmlDoc); + if (!g._contextCallTimer) { + g.callEvent("onXLE", [g, 0, 0, h.xmlDoc]); + } + if (e) { + e(); + e = null; + } + }; + return dhx4.ajax.get(a, this.xmlLoader); + }, + loadXMLString: function (c, a) { + if (window.console && window.console.info) { + window.console.info("loadXMLString was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44"); + } + this.parse({ responseXML: dhx4.ajax.parse(c) }, a, "xml"); + }, + loadXML: function (a, c) { + if (window.console && window.console.info) { + window.console.info("loadXML was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44"); + } + this.load(a, c, "xml"); + }, + parse: function (e, c, a) { + if (arguments.length == 2 && typeof c != "function") { + a = c; + c = null; + } + a = a || "xml"; + this._data_type = a; + if (a == "xml" && typeof e == "string") { + e = { responseXML: dhx4.ajax.parse(e) }; + } + this["_process_" + a](e); + if (!this._contextCallTimer) { + this.callEvent("onXLE", [this, 0, 0, e]); + } + if (c) { + c(); + } + }, + xml: { top: "rows", row: "./row", cell: "./cell", s_row: "row", s_cell: "cell", row_attrs: [], cell_attrs: [] }, + csv: { row: "\n", cell: "," }, + _xml_attrs: function (c) { + var e = {}; + if (c.attributes.length) { + for (var a = 0; a < c.attributes.length; a++) { + e[c.attributes[a].name] = c.attributes[a].value; + } + } + return e; + }, + _process_xml: function (o) { + if (this._refresh_mode) { + return this._refreshFromXML(o); + } + this._parsing = true; + var l = dhx4.ajax.xmltop(this.xml.top, o); + if (l.tagName != this.xml.top) { + return; + } + var n = l.getAttribute("dhx_security"); + if (n) { + dhtmlx.security_key = n; + } + this._parseHead(l); + var r = dhx4.ajax.xpath(this.xml.row, l); + var j = parseInt(l.getAttribute("pos") || 0); + var m = parseInt(l.getAttribute("total_count") || 0); + if (!this.pagingOn) { + var m = Math.min(m, 32000000 / this._srdh); + } + var g = false; + if (m && m != this.rowsBuffer.length) { + if (!this.rowsBuffer[m - 1]) { + if (this.rowsBuffer.length) { + g = true; + } + this.rowsBuffer[m - 1] = null; + } + if (m < this.rowsBuffer.length) { + this.rowsBuffer.splice(m, this.rowsBuffer.length - m); + g = true; + } + } + if (this.isTreeGrid()) { + return this._process_tree_xml(l); + } + for (var c = 0; c < r.length; c++) { + if (this.rowsBuffer[c + j]) { + continue; + } + var a = r[c].getAttribute("id") || c + j + 1; + this.rowsBuffer[c + j] = { idd: a, data: r[c], _parser: this._process_xml_row, _locator: this._get_xml_data }; + this.rowsAr[a] = r[c]; + } + this.callEvent("onDataReady", []); + if (g && this._srnd) { + var e = this.objBox.scrollTop; + this._reset_view(); + this.objBox.scrollTop = e; + } else { + this.render_dataset(); + } + this._parsing = false; + }, + _process_jsarray: function (data) { + this._parsing = true; + data = data.responseText || data; + if (typeof data == "string") { + eval("dhtmlx.temp=" + data + ";"); + data = dhtmlx.temp; + } + for (var i = 0; i < data.length; i++) { + var id = i + 1; + this.rowsBuffer.push({ idd: id, data: data[i], _parser: this._process_jsarray_row, _locator: this._get_jsarray_data }); + this.rowsAr[id] = data[i]; + } + this.render_dataset(); + this._parsing = false; + }, + _process_csv: function (g) { + this._parsing = true; + g = g.responseText || g; + g = g.replace(/\r/g, ""); + g = g.split(this.csv.row); + if (this._csvHdr) { + this.clearAll(); + var e = g.splice(0, 1)[0].split(this.csv.cell); + if (!this._csvAID) { + e.splice(0, 1); + } + this.setHeader(e.join(this.delim)); + this.init(); + } + for (var c = 0; c < g.length; c++) { + if (!g[c] && c == g.length - 1) { + continue; + } + if (this._csvAID) { + var h = c + 1; + this.rowsBuffer.push({ idd: h, data: g[c], _parser: this._process_csv_row, _locator: this._get_csv_data }); + } else { + var a = g[c].split(this.csv.cell); + var h = a.splice(0, 1)[0]; + this.rowsBuffer.push({ idd: h, data: a, _parser: this._process_jsarray_row, _locator: this._get_jsarray_data }); + } + this.rowsAr[h] = g[c]; + } + this.render_dataset(); + this._parsing = false; + }, + _process_js: function (a) { + return this._process_json(a, "js"); + }, + _process_json: function (data, mode) { + this._parsing = true; + var data = data.responseText || data; + if (typeof data == "string") { + eval("dhtmlx.temp=" + data + ";"); + data = dhtmlx.temp; + } + if (mode == "js") { + if (data.data) { + data = data.data; + } + for (var i = 0; i < data.length; i++) { + var row = data[i]; + var id = row.id || i + 1; + this.rowsBuffer.push({ idd: id, data: row, _parser: this._process_js_row, _locator: this._get_js_data }); + this.rowsAr[id] = data[i]; + } + } else { + if (data.rows) { + for (var i = 0; i < data.rows.length; i++) { + var id = data.rows[i].id; + this.rowsBuffer.push({ idd: id, data: data.rows[i], _parser: this._process_json_row, _locator: this._get_json_data }); + this.rowsAr[id] = data.rows[i]; + } + } + } + if (data.dhx_security) { + dhtmlx.security_key = data.dhx_security; + } + this.callEvent("onDataReady", []); + this.render_dataset(); + this._parsing = false; + }, + render_dataset: function (g, a) { + if (this._srnd) { + if (this._fillers) { + return this._update_srnd_view(); + } + a = Math.min(this._get_view_size() + (this._srnd_pr || 0), this.rowsBuffer.length); + } + if (this.pagingOn) { + g = Math.max(g || 0, (this.currentPage - 1) * this.rowsBufferOutSize); + a = Math.min(this.currentPage * this.rowsBufferOutSize, this.rowsBuffer.length); + } else { + g = g || 0; + a = a || this.rowsBuffer.length; + } + for (var e = g; e < a; e++) { + var j = this.render_row(e); + if (j == -1) { + if (this.xmlFileUrl) { + if (this.callEvent("onDynXLS", [e, this._dpref ? this._dpref : a - e])) { + this.load(this.xmlFileUrl + dhtmlx.url(this.xmlFileUrl) + "posStart=" + e + "&count=" + (this._dpref ? this._dpref : a - e), this._data_type); + } + } + a = e; + break; + } + if (!j.parentNode || !j.parentNode.tagName) { + this._insertRowAt(j, e); + if (j._attrs.selected || j._attrs.select) { + this.selectRow(j, j._attrs.call ? true : false, true); + j._attrs.selected = j._attrs.select = null; + } + } + if (this._ads_count && e - g == this._ads_count) { + var h = this; + this._context_parsing = this._context_parsing || this._parsing; + return (this._contextCallTimer = window.setTimeout(function () { + h._contextCallTimer = null; + h.render_dataset(e, a); + if (!h._contextCallTimer) { + if (h._context_parsing) { + h.callEvent("onXLE", []); + } else { + h._fixAlterCss(); + } + h._context_parsing = false; + } + }, this._ads_time)); + } + } + if (this._ads_count && e == a) { + this.callEvent("onDistributedEnd", []); + } + if (this._srnd && !this._fillers) { + var c = this.rowsBuffer.length - a; + this._fillers = []; + if (this._fake && !this._realfake) { + this._fake._fillers = []; + } + while (c > 0) { + var m = _isIE || window._FFrv ? Math.min(c, 35000) : c; + var l = this._add_filler(a, m); + if (l) { + this._fillers.push(l); + } + c -= m; + a += m; + } + } + this.setSizes(); + }, + render_row: function (c) { + if (!this.rowsBuffer[c]) { + return -1; + } + if (this.rowsBuffer[c]._parser) { + var a = this.rowsBuffer[c]; + if (this.rowsAr[a.idd] && this.rowsAr[a.idd].tagName == "TR") { + return (this.rowsBuffer[c] = this.rowsAr[a.idd]); + } + var e = this._prepareRow(a.idd); + this.rowsBuffer[c] = e; + this.rowsAr[a.idd] = e; + a._parser.call(this, e, a.data); + this._postRowProcessing(e); + return e; + } + return this.rowsBuffer[c]; + }, + _get_cell_value: function (c, a, e) { + if (c._locator) { + if (this._c_order) { + a = this._c_order[a]; + } + return c._locator.call(this, c.data, a); + } + return this.cells3(c, a)[e ? e : "getValue"](); + }, + sortRows: function (e, j, c) { + this.editStop(); + c = (c || "asc").toLowerCase(); + j = j || this.fldSort[e]; + e = e || 0; + if (this.isTreeGrid()) { + this.sortTreeRows(e, j, c); + } else { + var a = {}; + var h = this.cellType[e]; + var l = "getValue"; + if (h == "link") { + l = "getContent"; + } + if (h == "dhxCalendar" || h == "dhxCalendarA") { + l = "getDate"; + } + for (var g = 0; g < this.rowsBuffer.length; g++) { + a[this.rowsBuffer[g].idd] = this._get_cell_value(this.rowsBuffer[g], e, l); + } + this._sortRows(e, j, c, a); + } + this.callEvent("onAfterSorting", [e, j, c]); + }, + _sortCore: function (e, j, c, a, h) { + var g = "sort"; + if (this._sst) { + h.stablesort = this.rowsCol.stablesort; + g = "stablesort"; + } + if (j.length > 4) { + j = window[j]; + } + if (j == "cus") { + var l = this._customSorts[e]; + h[g](function (n, m) { + return l(a[n.idd], a[m.idd], c, n.idd, m.idd); + }); + } else { + if (typeof j == "function") { + h[g](function (n, m) { + return j(a[n.idd], a[m.idd], c, n.idd, m.idd); + }); + } else { + if (j == "str") { + h[g](function (n, m) { + var value1 = a[n.idd].toLowerCase(); + var value2 = a[m.idd].toLowerCase(); + if (c == "asc") { + return value1 > value2 ? 1 : value1 < value2 ? -1 : 0; + } else { + return value1 < value2 ? 1 : value1 > value2 ? -1 : 0; + } + }); + } else { + if (j == "int") { + h[g](function (o, n) { + var m = parseFloat(a[o.idd].replace(/\,/g, "")); + m = isNaN(m) ? -99999999999999 : m; + var r = parseFloat(a[n.idd].replace(/\,/g, "")); + var r = parseFloat(a[n.idd]); + r = isNaN(r) ? -99999999999999 : r; + if (c == "asc") { + return m - r; + } else { + return r - m; + } + }); + } else { + if (j == "date") { + h[g](function (o, n) { + var m = Date.parse(a[o.idd]) || Date.parse("01/01/1900"); + var r = Date.parse(a[n.idd]) || Date.parse("01/01/1900"); + if (c == "asc") { + return m - r; + } else { + return r - m; + } + }); + } + } + } + } + } + }, + _sortRows: function (e, g, c, a) { + this._sortCore(e, g, c, a, this.rowsBuffer); + this._reset_view(); + this.callEvent("onGridReconstructed", []); + }, + _reset_view: function (e) { + if (!this.obj.rows[0]) { + return; + } + if (this._lahRw) { + this._unsetRowHover(0, true); + } + this.callEvent("onResetView", []); + var a = this.obj.rows[0].parentNode; + var g = a.removeChild(a.childNodes[0], true); + if (_isKHTML) { + for (var c = a.parentNode.childNodes.length - 1; c >= 0; c--) { + if (a.parentNode.childNodes[c].tagName == "TR") { + a.parentNode.removeChild(a.parentNode.childNodes[c], true); + } + } + } else { + if (_isIE) { + for (var c = a.childNodes.length - 1; c >= 0; c--) { + a.childNodes[c].removeNode(true); + } + } else { + a.innerHTML = ""; + } + } + a.appendChild(g); + this.rowsCol = dhtmlxArray(); + if (this._sst) { + this.enableStableSorting(true); + } + this._fillers = this.undefined; + if (!e) { + if (_isIE && this._srnd) { + this.render_dataset(); + } else { + this.render_dataset(); + } + } + }, + deleteRow: function (c, g) { + if (!g) { + g = this.getRowById(c); + } + if (!g) { + return; + } + this.editStop(); + if (!this._realfake) { + if (this.callEvent("onBeforeRowDeleted", [c]) == false) { + return false; + } + } + var a = 0; + if (this.cellType._dhx_find("tree") != -1 && !this._realfake) { + a = this._h2.get[c].parent.id; + this._removeTrGrRow(g); + } else { + if (g.parentNode) { + g.parentNode.removeChild(g); + } + var j = this.rowsCol._dhx_find(g); + if (j != -1) { + this.rowsCol._dhx_removeAt(j); + } + for (var e = 0; e < this.rowsBuffer.length; e++) { + if (this.rowsBuffer[e] && this.rowsBuffer[e].idd == c) { + this.rowsBuffer._dhx_removeAt(e); + j = e; + break; + } + } + } + this.rowsAr[c] = null; + for (var e = 0; e < this.selectedRows.length; e++) { + if (this.selectedRows[e].idd == c) { + this.selectedRows._dhx_removeAt(e); + } + } + if (this._srnd) { + for (var e = 0; e < this._fillers.length; e++) { + var h = this._fillers[e]; + if (!h) { + continue; + } + if (h[0] >= j) { + this._update_fillers(e, 0, -1); + } else { + if (h[0] + h[1] > j) { + this._update_fillers(e, -1, 0); + } + } + } + this._update_srnd_view(); + } + if (this.pagingOn) { + this.changePage(); + } + if (!this._realfake) { + this.callEvent("onAfterRowDeleted", [c, a]); + } + this.callEvent("onGridReconstructed", []); + if (this._ahgr) { + this.setSizes(); + } + return true; + }, + _addRow: function (l, m, c) { + if (c == -1 || typeof c == "undefined") { + c = this.rowsBuffer.length; + } + if (typeof m == "string") { + m = m.split(this.delim); + } + var n = this._prepareRow(l); + n._attrs = {}; + for (var e = 0; e < n.childNodes.length; e++) { + n.childNodes[e]._attrs = {}; + } + this.rowsAr[n.idd] = n; + if (this._h2) { + this._h2.get[n.idd].buff = n; + } + this._fillRow(n, m); + this._postRowProcessing(n); + if (this._skipInsert) { + this._skipInsert = false; + return (this.rowsAr[n.idd] = n); + } + if (this.pagingOn) { + this.rowsBuffer._dhx_insertAt(c, n); + this.rowsAr[n.idd] = n; + return n; + } + if (this._fillers) { + this.rowsCol._dhx_insertAt(c, null); + this.rowsBuffer._dhx_insertAt(c, n); + if (this._fake) { + this._fake.rowsCol._dhx_insertAt(c, null); + } + this.rowsAr[n.idd] = n; + var o = false; + for (var g = 0; g < this._fillers.length; g++) { + var h = this._fillers[g]; + if (h && h[0] <= c && h[0] + h[1] >= c) { + h[1] = h[1] + 1; + var a = (h[2].firstChild.style.height = parseInt(h[2].firstChild.style.height) + this._srdh + "px"); + o = true; + if (this._fake) { + this._fake._fillers[g][1]++; + this._fake._fillers[g][2].firstChild.style.height = a; + } + } + if (h && h[0] > c) { + h[0] = h[0] + 1; + if (this._fake) { + this._fake._fillers[g][0]++; + } + } + } + if (!o) { + this._fillers.push(this._add_filler(c, 1, c == 0 ? { parentNode: this.obj.rows[0].parentNode, nextSibling: this.rowsCol[1] } : this.rowsCol[c - 1])); + } + return n; + } + this.rowsBuffer._dhx_insertAt(c, n); + return this._insertRowAt(n, c); + }, + addRow: function (a, g, e) { + var c = this._addRow(a, g, e); + if (!this.dragContext) { + this.callEvent("onRowAdded", [a]); + } + if (this.pagingOn) { + this.changePage(this.currentPage); + } + if (this._srnd) { + this._update_srnd_view(); + } + c._added = true; + if (this._srnd && !this._fillers) { + this._fillers = []; + } + if (this._ahgr) { + this.setSizes(); + } + this.callEvent("onGridReconstructed", []); + return c; + }, + _insertRowAt: function (e, g, c) { + this.rowsAr[e.idd] = e; + if (this._skipInsert) { + this._skipInsert = false; + return e; + } + if (g < 0 || (!g && parseInt(g) !== 0)) { + g = this.rowsCol.length; + } else { + if (g > this.rowsCol.length) { + g = this.rowsCol.length; + } + } + if (this._cssEven) { + var a = e.className.replace(this._cssUnEven, ""); + if ((this._cssSP ? this.getLevel(e.idd) : g) % 2 == 1) { + e.className = a + " " + this._cssUnEven + (this._cssSU ? " " + this._cssUnEven + "_" + this.getLevel(e.idd) : ""); + } else { + e.className = a + " " + this._cssEven + (this._cssSU ? " " + this._cssEven + "_" + this.getLevel(e.idd) : ""); + } + } + if (!c) { + if (g == this.obj.rows.length - 1 || !this.rowsCol[g]) { + if (_isKHTML) { + this.obj.appendChild(e); + } else { + this.obj.firstChild.appendChild(e); + } + } else { + this.rowsCol[g].parentNode.insertBefore(e, this.rowsCol[g]); + } + } + this.rowsCol._dhx_insertAt(g, e); + this.callEvent("onRowInserted", [e, g]); + return e; + }, + getRowById: function (e) { + var c = this.rowsAr[e]; + if (c) { + if (c.tagName != "TR") { + for (var a = 0; a < this.rowsBuffer.length; a++) { + if (this.rowsBuffer[a] && this.rowsBuffer[a].idd == e) { + return this.render_row(a); + } + } + if (this._h2) { + return this.render_row(null, c.idd); + } + } + return c; + } + return null; + }, + cellById: function (c, a) { + return this.cells(c, a); + }, + cells: function (g, e) { + if (arguments.length == 0) { + return this.cells4(this.cell); + } else { + var h = this.getRowById(g); + } + var a = h._childIndexes ? h.childNodes[h._childIndexes[e]] : h.childNodes[e]; + if (!a && h._childIndexes) { + a = h.firstChild || {}; + } + return this.cells4(a); + }, + cellByIndex: function (c, a) { + return this.cells2(c, a); + }, + cells2: function (g, e) { + var h = this.render_row(g); + var a = h._childIndexes ? h.childNodes[h._childIndexes[e]] : h.childNodes[e]; + if (!a && h._childIndexes) { + a = h.firstChild || {}; + } + return this.cells4(a); + }, + cells3: function (e, c) { + var a = e._childIndexes ? e.childNodes[e._childIndexes[c]] : e.childNodes[c]; + return this.cells4(a); + }, + cells4: function (a) { + var c = window["eXcell_" + (a._cellType || this.cellType[a._cellIndex])]; + if (c) { + return new c(a); + } + }, + cells5: function (a, e) { + var e = e || a._cellType || this.cellType[a._cellIndex]; + if (!this._ecache[e]) { + if (!window["eXcell_" + e]) { + var c = eXcell_ro; + } else { + var c = window["eXcell_" + e]; + } + this._ecache[e] = new c(a); + } + this._ecache[e].cell = a; + return this._ecache[e]; + }, + dma: function (a) { + if (!this._ecache) { + this._ecache = {}; + } + if (a && !this._dma) { + this._dma = this.cells4; + this.cells4 = this.cells5; + } else { + if (!a && this._dma) { + this.cells4 = this._dma; + this._dma = null; + } + } + }, + getRowsNum: function () { + return this.rowsBuffer.length; + }, + enableEditTabOnly: function (a) { + if (arguments.length > 0) { + this.smartTabOrder = dhx4.s2b(a); + } else { + this.smartTabOrder = true; + } + }, + setExternalTabOrder: function (h, a) { + var c = this; + this.tabStart = typeof h == "object" ? h : document.getElementById(h); + var e = this.tabStart.onkeydown; + this.tabStart.onkeydown = function (l) { + if (e) { + e.call(this, l); + } + var j = l || window.event; + if (j.keyCode == 9 && !j.shiftKey) { + j.cancelBubble = true; + c.selectCell(0, 0, 0, 0, 1); + if (c.smartTabOrder && c.cells2(0, 0).isDisabled()) { + c._key_events.k9_0_0.call(c); + } + this.blur(); + return false; + } + }; + if (_isOpera) { + this.tabStart.onkeypress = this.tabStart.onkeydown; + } + this.tabEnd = typeof a == "object" ? a : document.getElementById(a); + var g = this.tabEnd.onkeydown; + this.tabEnd.onkeydown = this.tabEnd.onkeypress = function (l) { + if (g) { + g.call(this, l); + } + var j = l || window.event; + if (j.keyCode == 9 && j.shiftKey) { + j.cancelBubble = true; + c.selectCell(c.getRowsNum() - 1, c.getColumnCount() - 1, 0, 0, 1); + if (c.smartTabOrder && c.cells2(c.getRowsNum() - 1, c.getColumnCount() - 1).isDisabled()) { + c._key_events.k9_0_1.call(c); + } + this.blur(); + return false; + } + }; + if (_isOpera) { + this.tabEnd.onkeypress = this.tabEnd.onkeydown; + } + }, + uid: function () { + if (!this._ui_seed) { + this._ui_seed = new Date().valueOf(); + } + return this._ui_seed++; + }, + clearAndLoad: function () { + if (this._last_load_request) { + var c = this._last_load_request.xmlDoc; + if (c.readyState != 4) { + try { + c.onreadystatechange = function () {}; + c.abort(); + } catch (g) {} + } + } + var a = this._pgn_skin; + this._pgn_skin = null; + this.clearAll(); + this._pgn_skin = a; + this._last_load_request = this.load.apply(this, arguments); + }, + getStateOfView: function () { + if (this.pagingOn) { + var a = (this.currentPage - 1) * this.rowsBufferOutSize; + return [this.currentPage, a, Math.min(a + this.rowsBufferOutSize, this.rowsBuffer.length), this.rowsBuffer.length]; + } + return [Math.floor(this.objBox.scrollTop / this._srdh), Math.ceil(parseInt(this.objBox.offsetHeight) / this._srdh), this.rowsBuffer.length]; + }, +}; +(function () { + function g(l, m) { + this[l] = m; + } + function j(l, m) { + this[l].call(this, m); + } + function e(l, m) { + this[l].call(this, m.join(this.delim)); + } + function a(l, o) { + for (var n = 0; n < o.length; n++) { + if (typeof o[n] == "object") { + var r = this.getCombo(n); + for (var m in o[n]) { + r.put(m, o[n][m]); + } + } + } + } + function h(l, v, o) { + var x = 1; + var u = []; + function w(A, y, C) { + if (!u[y]) { + u[y] = []; + } + if (typeof C == "object") { + C.toString = function () { + return this.text; + }; + } + u[y][A] = C; + } + for (var r = 0; r < v.length; r++) { + if (typeof v[r] == "object" && v[r].length) { + for (var n = 0; n < v[r].length; n++) { + w(r, n, v[r][n]); + } + } else { + w(r, 0, v[r]); + } + } + for (var r = 0; r < u.length; r++) { + for (var n = 0; n < u[0].length; n++) { + var s = u[r][n]; + u[r][n] = (s || "").toString() || " "; + if (s && s.colspan) { + for (var m = 1; m < s.colspan; m++) { + w(n + m, r, "#cspan"); + } + } + if (s && s.rowspan) { + for (var m = 1; m < s.rowspan; m++) { + w(n, r + m, "#rspan"); + } + } + } + } + this.setHeader(u[0]); + for (var r = 1; r < u.length; r++) { + this.attachHeader(u[r]); + } + } + var c = [ + { name: "label", def: " ", operation: "setHeader", type: h }, + { name: "id", def: "", operation: "columnIds", type: g }, + { name: "width", def: "*", operation: "setInitWidths", type: e }, + { name: "align", def: "left", operation: "cellAlign", type: g }, + { name: "valign", def: "middle", operation: "cellVAlign", type: g }, + { name: "sort", def: "na", operation: "fldSort", type: g }, + { name: "type", def: "ro", operation: "setColTypes", type: e }, + { name: "options", def: "", operation: "", type: a }, + ]; + dhtmlx.extend_api( + "dhtmlXGridObject", + { + _init: function (l) { + return [l.parent]; + }, + image_path: "setImagePath", + columns: "columns", + rows: "rows", + headers: "headers", + skin: "setSkin", + smart_rendering: "enableSmartRendering", + css: "enableAlterCss", + auto_height: "enableAutoHeight", + save_hidden: "enableAutoHiddenColumnsSaving", + save_cookie: "enableAutoSaving", + save_size: "enableAutoSizeSaving", + auto_width: "enableAutoWidth", + block_selection: "enableBlockSelection", + csv_id: "enableCSVAutoID", + csv_header: "enableCSVHeader", + cell_ids: "enableCellIds", + colspan: "enableColSpan", + column_move: "enableColumnMove", + context_menu: "enableContextMenu", + distributed: "enableDistributedParsing", + drag: "enableDragAndDrop", + drag_order: "enableDragOrder", + tabulation: "enableEditTabOnly", + header_images: "enableHeaderImages", + header_menu: "enableHeaderMenu", + keymap: "enableKeyboardSupport", + mouse_navigation: "enableLightMouseNavigation", + markers: "enableMarkedCells", + math_editing: "enableMathEditing", + math_serialization: "enableMathSerialization", + drag_copy: "enableMercyDrag", + multiline: "enableMultiline", + multiselect: "enableMultiselect", + save_column_order: "enableOrderSaving", + hover: "enableRowsHover", + rowspan: "enableRowspan", + smart: "enableSmartRendering", + save_sorting: "enableSortingSaving", + stable_sorting: "enableStableSorting", + undo: "enableUndoRedo", + csv_cell: "setCSVDelimiter", + date_format: "setDateFormat", + drag_behavior: "setDragBehavior", + editable: "setEditable", + without_header: "setNoHeader", + submit_changed: "submitOnlyChanged", + submit_serialization: "submitSerialization", + submit_selected: "submitOnlySelected", + submit_id: "submitOnlyRowID", + xml: "load", + }, + { + columns: function (r) { + for (var l = 0; l < c.length; l++) { + var o = []; + for (var m = 0; m < r.length; m++) { + o[m] = r[m][c[l].name] || c[l].def; + } + var n = c[l].type || j; + n.call(this, c[l].operation, o, r); + } + this.init(); + }, + rows: function (l) {}, + headers: function (m) { + for (var l = 0; l < m.length; l++) { + this.attachHeader(m[l]); + } + }, + } + ); +})(); +dhtmlXGridObject.prototype._dp_init = function (a) { + a.attachEvent("insertCallback", function (c, g) { + if (this.obj._h2) { + this.obj.addRow(g, e, null, parent); + } else { + this.obj.addRow(g, [], 0); + } + var e = this.obj.getRowById(g); + if (e) { + this.obj._process_xml_row(e, c.firstChild); + this.obj._postRowProcessing(e); + } + }); + a.attachEvent("updateCallback", function (c, g) { + var e = this.obj.getRowById(g); + if (e) { + this.obj._process_xml_row(e, c.firstChild); + this.obj._postRowProcessing(e); + } + }); + a.attachEvent("deleteCallback", function (c, e) { + this.obj.setUserData(e, this.action_param, "true_deleted"); + this.obj.deleteRow(e); + }); + a._methods = ["setRowTextStyle", "setCellTextStyle", "changeRowId", "deleteRow"]; + this.attachEvent("onEditCell", function (g, h, e) { + if (a._columns && !a._columns[e]) { + return true; + } + var c = this.cells(h, e); + if (g == 1) { + if (c.isCheckbox()) { + a.setUpdated(h, true); + } + } else { + if (g == 2) { + if (c.wasChanged()) { + a.setUpdated(h, true); + } + } + } + return true; + }); + this.attachEvent("onRowPaste", function (c) { + a.setUpdated(c, true); + }); + this.attachEvent("onUndo", function (c) { + a.setUpdated(c, true); + }); + this.attachEvent("onRowIdChange", function (g, c) { + var e = a.findRow(g); + if (e < a.updatedRows.length) { + a.updatedRows[e] = c; + } + }); + this.attachEvent("onSelectStateChanged", function (c) { + if (a.updateMode == "row") { + a.sendData(); + } + return true; + }); + this.attachEvent("onEnter", function (e, c) { + if (a.updateMode == "row") { + a.sendData(); + } + return true; + }); + this.attachEvent("onBeforeRowDeleted", function (c) { + if (a._silent_mode || !this.rowsAr[c]) { + return true; + } + if (this.dragContext && a.dnd) { + window.setTimeout(function () { + a.setUpdated(c, true); + }, 1); + return true; + } + var e = a.getState(c); + if (this._h2) { + this._h2.forEachChild( + c, + function (g) { + a.setUpdated(g.id, false); + a.markRow(g.id, true, "deleted"); + }, + this + ); + } + if (e == "inserted") { + a.set_invalid(c, false); + a.setUpdated(c, false); + return true; + } + if (e == "deleted") { + return false; + } + if (e == "true_deleted") { + a.setUpdated(c, false); + return true; + } + a.setUpdated(c, true, "deleted"); + return false; + }); + this.attachEvent("onBindUpdate", function (c) { + if (typeof c == "object") { + c = c.id; + } + a.setUpdated(c, true); + }); + this.attachEvent("onRowAdded", function (c) { + if (this.dragContext && a.dnd) { + return true; + } + a.setUpdated(c, true, "inserted"); + return true; + }); + a._getRowData = function (g, u) { + var m = []; + m.gr_id = g; + if (this.obj.isTreeGrid()) { + m.gr_pid = this.obj.getParentId(g); + } + var e = this.obj.getRowById(g); + for (var n = 0; n < this.obj._cCount; n++) { + if (this.obj._c_order) { + var o = this.obj._c_order[n]; + } else { + var o = n; + } + var s = this.obj.cells(e.idd, n); + if (this._changed && !s.wasChanged()) { + continue; + } + if (this._endnm) { + m[this.obj.getColumnId(n)] = s.getValue(); + } else { + m["c" + o] = s.getValue(); + } + } + var h = this.obj.UserData[g]; + if (h) { + for (var l = 0; l < h.keys.length; l++) { + if (h.keys[l] && h.keys[l].indexOf("__") != 0) { + m[h.keys[l]] = h.values[l]; + } + } + } + var h = this.obj.UserData.gridglobaluserdata; + if (h) { + for (var l = 0; l < h.keys.length; l++) { + m[h.keys[l]] = h.values[l]; + } + } + return m; + }; + a._clearUpdateFlag = function (e) { + var g = this.obj.getRowById(e); + if (g) { + for (var c = 0; c < this.obj._cCount; c++) { + this.obj.cells(e, c).cell.wasChanged = false; + } + } + }; + a.checkBeforeUpdate = function (j) { + var h = true; + var c = []; + for (var g = 0; g < this.obj._cCount; g++) { + if (this.mandatoryFields[g]) { + var e = this.mandatoryFields[g].call(this.obj, this.obj.cells(j, g).getValue(), j, g); + if (typeof e == "string") { + this.messages.push(e); + h = false; + } else { + h &= e; + c[g] = !e; + } + } + } + if (!h) { + this.set_invalid(j, "invalid", c); + this.setUpdated(j, false); + } + return h; + }; +}; +dhx4.attachEvent("onGridCreated", function (c) { + c._con_f_used = [].concat(c._con_f_used); + dhtmlXGridObject.prototype._con_f_used = []; + var a = function (j) { + j = j.replace(/(\?|\&)connector[^\f]*/g, ""); + return j + (j.indexOf("?") != -1 ? "&" : "?") + "connector=true" + (this.hdr.rows.length > 0 ? "&dhx_no_header=1" : ""); + }; + var h = function (j) { + return a.call(this, j) + (this._connector_sorting || "") + (this._connector_filter || ""); + }; + var g = function (l, m, j) { + this._connector_sorting = "&dhx_sort[" + m + "]=" + j; + return h.call(this, l); + }; + var e = function (l, j, n) { + var o = []; + for (var m = 0; m < j.length; m++) { + o[m] = "dhx_filter[" + j[m] + "]=" + encodeURIComponent(n[m]); + } + this._connector_filter = "&" + o.join("&"); + return h.call(this, l); + }; + c.attachEvent("onCollectValues", function (j) { + if (this._con_f_used[j]) { + if (typeof this._con_f_used[j] == "object") { + return this._con_f_used[j]; + } else { + return false; + } + } + return true; + }); + c.attachEvent("onDynXLS", function () { + if (this.xmlFileUrl) { + this.xmlFileUrl = h.call(this, this.xmlFileUrl); + } + return true; + }); + c.attachEvent("onBeforeSorting", function (n, m, l) { + if (m == "connector") { + var j = this; + this.clearAndLoad(g.call(this, this.xmlFileUrl, n, l), function () { + j.setSortImgState(true, n, l); + }); + return false; + } + return true; + }); + c.attachEvent("onFilterStart", function (l, j) { + if (this._con_f_used.length) { + var n = this.getSortingState(); + var m = this; + this.clearAndLoad(e.call(this, this.xmlFileUrl, l, j)); + if (n.length) { + m.setSortImgState(true, n[0], n[1]); + } + return false; + } + return true; + }); +}); +dhtmlXGridObject.prototype._con_f_used = []; +dhtmlXGridObject.prototype._in_header_connector_text_filter = function (c, a) { + if (!this._con_f_used[a]) { + this._con_f_used[a] = 1; + } + return this._in_header_text_filter(c, a); +}; +dhtmlXGridObject.prototype._in_header_connector_select_filter = function (c, a) { + if (!this._con_f_used[a]) { + this._con_f_used[a] = 2; + } + return this._in_header_select_filter(c, a); +}; +if (!dhtmlXGridObject.prototype.load_connector) { + dhtmlXGridObject.prototype.load_connector = dhtmlXGridObject.prototype.load; + dhtmlXGridObject.prototype.load = function (c, h, g) { + if (!this._colls_loaded && this.cellType) { + var a = []; + for (var e = 0; e < this.cellType.length; e++) { + if (this.cellType[e].indexOf("co") == 0 || this.cellType[e].indexOf("clist") == 0 || this._con_f_used[e] == 2) { + a.push(e); + } + } + if (a.length) { + arguments[0] += (arguments[0].indexOf("?") != -1 ? "&" : "?") + "connector=true&dhx_colls=" + a.join(","); + } + } + return this.load_connector.apply(this, arguments); + }; + dhtmlXGridObject.prototype._parseHead_connector = dhtmlXGridObject.prototype._parseHead; + dhtmlXGridObject.prototype._parseHead = function (c, w, r) { + this._parseHead_connector.apply(this, arguments); + if (!this._colls_loaded) { + var s = dhx4.ajax.xpath("./coll_options", arguments[0]); + for (var m = 0; m < s.length; m++) { + var o = s[m].getAttribute("for"); + var u = []; + var g = null; + if (this.cellType[o] == "combo") { + g = this.getColumnCombo(o); + } else { + if (this.cellType[o].indexOf("co") == 0) { + g = this.getCombo(o); + } + } + var l = dhx4.ajax.xpath("./item", s[m]); + var a = []; + for (var h = 0; h < l.length; h++) { + var e = l[h].getAttribute("value"); + if (g) { + var n = l[h].getAttribute("label") || e; + if (g.addOption) { + a.push([e, n]); + } else { + g.put(e, n); + } + u[u.length] = n; + } else { + u[u.length] = e; + } + } + if (a.length) { + if (g) { + g.addOption(a); + } + } else { + if (u.length && !g) { + if (this.registerCList) { + this.registerCList(o * 1, u); + } + } + } + if (this._con_f_used[o * 1]) { + this._con_f_used[o * 1] = u; + } + } + this._colls_loaded = true; + } + }; +} +function dhtmlXGridCellObject(a) { + this.destructor = function () { + this.cell.obj = null; + this.cell = null; + this.grid = null; + this.base = null; + return null; + }; + this.cell = a; + this.getValue = function () { + if (this.cell.textContent && this.cell.textContent.tagName == "TEXTAREA") { + return this.cell.textContent.value; + } else { + return this.cell.innerHTML._dhx_trim(); + } + }; + this.getMathValue = function () { + if (this.cell.original) { + return this.cell.original; + } else { + return this.getValue(); + } + }; + this.getFont = function () { + arOut = new Array(3); + if (this.cell.style.fontFamily) { + arOut[0] = this.cell.style.fontFamily; + } + if (this.cell.style.fontWeight == "bold" || this.cell.parentNode.style.fontWeight == "bold") { + arOut[1] = "bold"; + } + if (this.cell.style.fontStyle == "italic" || this.cell.parentNode.style.fontWeight == "italic") { + arOut[1] += "italic"; + } + if (this.cell.style.fontSize) { + arOut[2] = this.cell.style.fontSize; + } else { + arOut[2] = ""; + } + return arOut.join("-"); + }; + this.getTextColor = function () { + if (this.cell.style.color) { + return this.cell.style.color; + } else { + return "#000000"; + } + }; + this.getBgColor = function () { + return this.cell.style.backgroundColor || "#FFFFFF"; + }; + this.getHorAlign = function () { + if (this.cell.style.textAlign) { + return this.cell.style.textAlign; + } else { + if (this.cell.style.textAlign) { + return this.cell.style.textAlign; + } else { + return "left"; + } + } + }; + this.getWidth = function () { + return this.cell.scrollWidth; + }; + this.setFont = function (c) { + fntAr = c.split("-"); + this.cell.style.fontFamily = fntAr[0]; + this.cell.style.fontSize = fntAr[fntAr.length - 1]; + if (fntAr.length == 3) { + if (/bold/.test(fntAr[1])) { + this.cell.style.fontWeight = "bold"; + } + if (/italic/.test(fntAr[1])) { + this.cell.style.fontStyle = "italic"; + } + if (/underline/.test(fntAr[1])) { + this.cell.style.textDecoration = "underline"; + } + } + }; + this.setTextColor = function (c) { + this.cell.style.color = c; + }; + this.setBgColor = function (c) { + if (c == "") { + c = null; + } + this.cell.style.background = c; + }; + this.setHorAlign = function (c) { + if (c.length == 1) { + if (c == "c") { + this.cell.style.textAlign = "center"; + } else { + if (c == "l") { + this.cell.style.textAlign = "left"; + } else { + this.cell.style.textAlign = "right"; + } + } + } else { + this.cell.style.textAlign = c; + } + }; + this.wasChanged = function () { + if (this.cell.wasChanged) { + return true; + } else { + return false; + } + }; + this.isCheckbox = function () { + var c = this.cell.firstChild; + if (c && c.tagName == "INPUT") { + type = c.type; + if (type == "radio" || type == "checkbox") { + return true; + } else { + return false; + } + } else { + return false; + } + }; + this.isChecked = function () { + if (this.isCheckbox()) { + return this.cell.firstChild.checked; + } + }; + this.isDisabled = function () { + return this.cell._disabled; + }; + this.setChecked = function (c) { + if (this.isCheckbox()) { + if (c != "true" && c != 1) { + c = false; + } + this.cell.firstChild.checked = c; + } + }; + this.setDisabled = function (c) { + if (c != "true" && c != 1) { + c = false; + } + if (this.isCheckbox()) { + this.cell.firstChild.disabled = c; + if (this.disabledF) { + this.disabledF(c); + } + } + this.cell._disabled = c; + }; +} +dhtmlXGridCellObject.prototype = { + getAttribute: function (a) { + return this.cell._attrs[a]; + }, + setAttribute: function (a, c) { + this.cell._attrs[a] = c; + }, + getInput: function () { + if (this.obj && (this.obj.tagName == "INPUT" || this.obj.tagName == "TEXTAREA")) { + return this.obj; + } + var a = (this.obj || this.cell).getElementsByTagName("TEXTAREA"); + if (!a.length) { + a = (this.obj || this.cell).getElementsByTagName("INPUT"); + } + return a[0]; + }, +}; +dhtmlXGridCellObject.prototype.setValue = function (a) { + if (typeof a != "number" && (!a || a.toString()._dhx_trim() == "")) { + a = " "; + this.cell._clearCell = true; + } else { + this.cell._clearCell = false; + } + this.setCValue(a); +}; +dhtmlXGridCellObject.prototype.getTitle = function () { + return _isIE ? this.cell.innerText : this.cell.textContent; +}; +dhtmlXGridCellObject.prototype.setCValue = function (c, a) { + this.cell.innerHTML = c; + this.grid.callEvent("onCellChanged", [this.cell.parentNode.idd, this.cell._cellIndex, arguments.length > 1 ? a : c]); +}; +dhtmlXGridCellObject.prototype.setCTxtValue = function (a) { + this.cell.innerHTML = ""; + this.cell.appendChild(document.createTextNode(a)); + this.grid.callEvent("onCellChanged", [this.cell.parentNode.idd, this.cell._cellIndex, a]); +}; +dhtmlXGridCellObject.prototype.setLabel = function (a) { + this.cell.innerHTML = a; +}; +dhtmlXGridCellObject.prototype.getMath = function () { + if (this._val) { + return this.val; + } else { + return this.getValue(); + } +}; +function eXcell() { + this.obj = null; + this.val = null; + this.changeState = function () { + return false; + }; + this.edit = function () { + this.val = this.getValue(); + }; + this.detach = function () { + return false; + }; + this.getPosition = function (g) { + var a = g; + var e = 0; + var c = 0; + while (a.tagName != "BODY") { + e += a.offsetLeft; + c += a.offsetTop; + a = a.offsetParent; + } + return new Array(e, c); + }; +} +eXcell.prototype = new dhtmlXGridCellObject(); +function eXcell_ed(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + } + this.edit = function () { + this.cell.atag = !this.grid.multiLine ? "INPUT" : "TEXTAREA"; + this.val = this.getValue(); + this.obj = document.createElement(this.cell.atag); + this.obj.setAttribute("autocomplete", "off"); + this.obj.style.height = this.cell.offsetHeight - (_isIE ? 4 : 4) + "px"; + this.obj.className = "dhx_combo_edit"; + this.obj.wrap = "soft"; + this.obj.style.textAlign = this.cell.style.textAlign; + this.obj.onclick = function (c) { + (c || event).cancelBubble = true; + }; + this.obj.onmousedown = function (c) { + (c || event).cancelBubble = true; + }; + this.obj.value = this.val; + this.cell.innerHTML = ""; + this.cell.appendChild(this.obj); + this.obj.onselectstart = function (c) { + if (!c) { + c = event; + } + c.cancelBubble = true; + return true; + }; + if (_isIE) { + this.obj.focus(); + this.obj.blur(); + } + this.obj.focus(); + }; + this.getValue = function () { + if (this.cell.firstChild && this.cell.atag && this.cell.firstChild.tagName == this.cell.atag) { + return this.cell.firstChild.value; + } + if (this.cell._clearCell) { + return ""; + } + return this.cell.innerHTML.toString()._dhx_trim(); + }; + this.detach = function () { + this.setValue(this.obj.value); + return this.val != this.getValue(); + }; +} +eXcell_ed.prototype = new eXcell(); +function eXcell_edtxt(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + } + this.getValue = function () { + if (this.cell.firstChild && this.cell.atag && this.cell.firstChild.tagName == this.cell.atag) { + return this.cell.firstChild.value; + } + if (this.cell._clearCell) { + return ""; + } + return _isIE ? this.cell.innerText : this.cell.textContent; + }; + this.setValue = function (c) { + if (!c || c.toString()._dhx_trim() == "") { + c = " "; + this.cell._clearCell = true; + } else { + this.cell._clearCell = false; + } + this.setCTxtValue(c); + }; +} +eXcell_edtxt.prototype = new eXcell_ed(); +function eXcell_edn(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + } + this.getValue = function () { + if (this.cell.firstChild && this.cell.firstChild.tagName == "TEXTAREA") { + return this.cell.firstChild.value; + } + if (this.cell._clearCell) { + return ""; + } + return this.cell._orig_value || this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(), this.cell._cellIndex); + }; + this.detach = function () { + var c = this.obj.value; + this.setValue(c); + return this.val != this.getValue(); + }; +} +eXcell_edn.prototype = new eXcell_ed(); +eXcell_edn.prototype.setValue = function (a) { + if (!a || a.toString()._dhx_trim() == "") { + this.cell._clearCell = true; + return this.setCValue(" ", 0); + } else { + this.cell._clearCell = false; + this.cell._orig_value = a; + } + this.setCValue(this.grid._aplNF(a, this.cell._cellIndex), a); +}; +function eXcell_ch(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + } + this.disabledF = function (c) { + if (c == true || c == 1) { + this.cell.innerHTML = this.cell.innerHTML.replace("item_chk0.", "item_chk0_dis.").replace("item_chk1.", "item_chk1_dis."); + } else { + this.cell.innerHTML = this.cell.innerHTML.replace("item_chk0_dis.", "item_chk0.").replace("item_chk1_dis.", "item_chk1."); + } + }; + this.changeState = function (c) { + if (c === true && !this.grid.isActive) { + if (window.globalActiveDHTMLGridObject != null && window.globalActiveDHTMLGridObject != this.grid && window.globalActiveDHTMLGridObject.isActive) { + window.globalActiveDHTMLGridObject.setActive(false); + } + this.grid.setActive(true); + } + if (!this.grid.isEditable || this.cell.parentNode._locked || this.isDisabled()) { + return; + } + if (this.grid.callEvent("onEditCell", [0, this.cell.parentNode.idd, this.cell._cellIndex])) { + this.val = this.getValue(); + if (this.val == "1") { + this.setValue("0"); + } else { + this.setValue("1"); + } + this.cell.wasChanged = true; + this.grid.callEvent("onEditCell", [1, this.cell.parentNode.idd, this.cell._cellIndex]); + this.grid.callEvent("onCheckbox", [this.cell.parentNode.idd, this.cell._cellIndex, this.val != "1"]); + this.grid.callEvent("onCheck", [this.cell.parentNode.idd, this.cell._cellIndex, this.val != "1"]); + } else { + this.editor = null; + } + }; + this.getValue = function () { + return this.cell.chstate ? this.cell.chstate.toString() : "0"; + }; + this.isCheckbox = function () { + return true; + }; + this.isChecked = function () { + if (this.getValue() == "1") { + return true; + } else { + return false; + } + }; + this.setChecked = function (c) { + this.setValue(c.toString()); + }; + this.detach = function () { + return this.val != this.getValue(); + }; + this.edit = null; +} +eXcell_ch.prototype = new eXcell(); +eXcell_ch.prototype.setValue = function (c) { + this.cell.style.verticalAlign = "middle"; + if (c) { + c = c.toString()._dhx_trim(); + if (c == "false" || c == "0") { + c = ""; + } + } + if (c) { + c = "1"; + this.cell.chstate = "1"; + } else { + c = "0"; + this.cell.chstate = "0"; + } + var a = this; + this.setCValue("", this.cell.chstate); +}; +function eXcell_ra(a) { + this.base = eXcell_ch; + this.base(a); + this.grid = a.parentNode.grid; + this.disabledF = function (c) { + if (c == true || c == 1) { + this.cell.innerHTML = this.cell.innerHTML.replace("radio_chk0.", "radio_chk0_dis.").replace("radio_chk1.", "radio_chk1_dis."); + } else { + this.cell.innerHTML = this.cell.innerHTML.replace("radio_chk0_dis.", "radio_chk0.").replace("radio_chk1_dis.", "radio_chk1."); + } + }; + this.changeState = function (c) { + if (c === false && this.getValue() == 1) { + return; + } + if (!this.grid.isEditable || this.cell.parentNode._locked || this.isDisabled()) { + return; + } + if (this.grid.callEvent("onEditCell", [0, this.cell.parentNode.idd, this.cell._cellIndex]) != false) { + this.val = this.getValue(); + if (this.val == "1") { + this.setValue("0"); + } else { + this.setValue("1"); + } + this.cell.wasChanged = true; + this.grid.callEvent("onEditCell", [1, this.cell.parentNode.idd, this.cell._cellIndex]); + this.grid.callEvent("onCheckbox", [this.cell.parentNode.idd, this.cell._cellIndex, this.val != "1"]); + this.grid.callEvent("onCheck", [this.cell.parentNode.idd, this.cell._cellIndex, this.val != "1"]); + } else { + this.editor = null; + } + }; + this.edit = null; +} +eXcell_ra.prototype = new eXcell_ch(); +eXcell_ra.prototype.setValue = function (c) { + this.cell.style.verticalAlign = "middle"; + if (c) { + c = c.toString()._dhx_trim(); + if (c == "false" || c == "0") { + c = ""; + } + } + if (c) { + if (!this.grid._RaSeCol) { + this.grid._RaSeCol = []; + } + if (this.grid._RaSeCol[this.cell._cellIndex]) { + var a = this.grid.cells4(this.grid._RaSeCol[this.cell._cellIndex]); + a.setValue("0"); + if (this.grid.rowsAr[a.cell.parentNode.idd]) { + this.grid.callEvent("onEditCell", [1, a.cell.parentNode.idd, a.cell._cellIndex]); + } + } + this.grid._RaSeCol[this.cell._cellIndex] = this.cell; + c = "1"; + this.cell.chstate = "1"; + } else { + c = "0"; + this.cell.chstate = "0"; + } + this.setCValue("", this.cell.chstate); +}; +function eXcell_txt(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + } + this.edit = function () { + this.val = this.getValue(); + this.obj = document.createElement("TEXTAREA"); + this.obj.className = "dhx_textarea"; + this.obj.onclick = function (g) { + (g || event).cancelBubble = true; + }; + var c = this.grid.getPosition(this.cell); + this.obj.value = this.val; + this.obj.style.display = ""; + this.obj.style.textAlign = this.cell.style.textAlign; + document.body.appendChild(this.obj); + if (_isOpera) { + this.obj.onkeypress = function (g) { + if (g.keyCode == 9 || g.keyCode == 27) { + return false; + } + }; + } + this.obj.onkeydown = function (h) { + var g = h || event; + if (g.keyCode == 9 || g.keyCode == 27) { + globalActiveDHTMLGridObject.entBox.focus(); + globalActiveDHTMLGridObject.doKey({ keyCode: g.keyCode, shiftKey: g.shiftKey, srcElement: "0" }); + return false; + } + }; + this.obj.style.left = c[0] + "px"; + this.obj.style.top = c[1] + this.cell.offsetHeight + "px"; + if (this.cell.offsetWidth < 200) { + var e = 200; + } else { + var e = this.cell.offsetWidth; + } + this.obj.style.width = e + 16 + "px"; + if (_isIE) { + this.obj.select(); + this.obj.value = this.obj.value; + } + this.obj.focus(); + }; + this.detach = function () { + var c = ""; + c = this.obj.value; + if (c == "") { + this.cell._clearCell = true; + } else { + this.cell._clearCell = false; + } + this.setValue(c); + document.body.removeChild(this.obj); + this.obj = null; + return this.val != this.getValue(); + }; + this.getValue = function () { + if (this.obj) { + return this.obj.value; + } + if (this.cell._clearCell) { + return ""; + } + if (typeof this.cell._brval != "undefined") { + return this.cell._brval; + } + if (!this.grid.multiLine) { + return this.cell._brval || this.cell.innerHTML; + } else { + return this.cell._brval || this.cell.innerHTML.replace(/]*>/gi, "\n")._dhx_trim(); + } + }; +} +eXcell_txt.prototype = new eXcell(); +function eXcell_txttxt(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + } + this.getValue = function () { + if (this.cell.firstChild && this.cell.firstChild.tagName == "TEXTAREA") { + return this.cell.firstChild.value; + } + if (this.cell._clearCell) { + return ""; + } + if (!this.grid.multiLine && this.cell._brval) { + return this.cell._brval; + } + return _isIE ? this.cell.innerText : this.cell.textContent; + }; + this.setValue = function (c) { + this.cell._brval = c; + if (!c || c.toString()._dhx_trim() == "") { + c = " "; + this.cell._clearCell = true; + } else { + this.cell._clearCell = false; + } + this.setCTxtValue(c); + }; +} +eXcell_txttxt.prototype = new eXcell_txt(); +eXcell_txt.prototype.setValue = function (a) { + this.cell._brval = a; + if (!a || a.toString()._dhx_trim() == "") { + a = " "; + this.cell._clearCell = true; + } else { + this.cell._clearCell = false; + } + if (!this.grid.multiLine || this.cell._clearCell) { + this.setCValue(a, this.cell._brval); + } else { + this.setCValue(a.replace(/\n/g, "
"), a); + } +}; +function eXcell_co(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + this.combo = this.cell._combo || this.grid.getCombo(this.cell._cellIndex); + this.editable = true; + } + this.shiftNext = function () { + var c = this.list.options[this.list.selectedIndex + 1]; + if (c) { + c.selected = true; + } + this.obj.value = this.list.options[this.list.selectedIndex].text; + return true; + }; + this.shiftPrev = function () { + if (this.list.selectedIndex != 0) { + var c = this.list.options[this.list.selectedIndex - 1]; + if (c) { + c.selected = true; + } + this.obj.value = this.list.options[this.list.selectedIndex].text; + } + return true; + }; + this.edit = function () { + this.val = this.getValue(); + this.text = this.getText()._dhx_trim(); + var g = this.grid.getPosition(this.cell); + this.obj = document.createElement("TEXTAREA"); + this.obj.className = "dhx_combo_edit"; + this.obj.style.height = this.cell.offsetHeight - (_isIE ? 4 : 4) + "px"; + this.obj.wrap = "soft"; + this.obj.style.textAlign = this.cell.style.textAlign; + this.obj.onclick = function (n) { + (n || event).cancelBubble = true; + }; + this.obj.onmousedown = function (n) { + (n || event).cancelBubble = true; + }; + this.obj.value = this.text; + this.obj.onselectstart = function (n) { + if (!n) { + n = event; + } + n.cancelBubble = true; + return true; + }; + var j = this; + this.obj.onkeyup = function (r) { + var o = (r || event).keyCode; + if (o == 38 || o == 40 || o == 9) { + return; + } + var s = this.readonly ? String.fromCharCode(o) : this.value; + var u = j.list.options; + for (var n = 0; n < u.length; n++) { + if (u[n].text.indexOf(s) == 0) { + return (u[n].selected = true); + } + } + }; + this.list = document.createElement("SELECT"); + this.list.className = "dhx_combo_select"; + this.list.style.width = this.cell.offsetWidth + "px"; + this.list.style.left = g[0] + "px"; + this.list.style.top = g[1] + this.cell.offsetHeight + "px"; + this.list.onclick = function (r) { + var o = r || window.event; + var n = o.target || o.srcElement; + if (n.tagName == "OPTION") { + n = n.parentNode; + } + j.editable = false; + j.grid.editStop(); + o.cancelBubble = true; + }; + var c = this.combo.getKeys(); + var h = false; + var m = 0; + for (var e = 0; e < c.length; e++) { + var l = this.combo.get(c[e]); + this.list.options[this.list.options.length] = new Option(l, c[e]); + if (c[e] == this.val) { + m = this.list.options.length - 1; + h = true; + } + } + if (h == false) { + this.list.options[this.list.options.length] = new Option(this.text, this.val === null ? "" : this.val); + m = this.list.options.length - 1; + } + document.body.appendChild(this.list); + this.list.size = "6"; + this.cstate = 1; + if (this.editable) { + this.cell.innerHTML = ""; + } else { + this.obj.style.width = "1px"; + this.obj.style.height = "1px"; + } + this.cell.appendChild(this.obj); + this.list.options[m].selected = true; + if (this.editable) { + this.obj.focus(); + this.obj.focus(); + } + if (!this.editable) { + this.obj.style.visibility = "hidden"; + this.list.focus(); + this.list.onkeydown = function (n) { + n = n || window.event; + j.grid.setActive(true); + if (n.keyCode < 30) { + return j.grid.doKey({ target: j.cell, keyCode: n.keyCode, shiftKey: n.shiftKey, ctrlKey: n.ctrlKey }); + } + }; + } + }; + this.getValue = function () { + return this.cell.combo_value == window.undefined ? "" : this.cell.combo_value; + }; + this.detach = function () { + if (this.val != this.getValue()) { + this.cell.wasChanged = true; + } + if (this.list.parentNode != null) { + if (this.editable) { + var c = this.list.options[this.list.selectedIndex]; + if (c && c.text == this.obj.value) { + this.setValue(this.list.value); + } else { + var e = this.cell._combo || this.grid.getCombo(this.cell._cellIndex); + var g = e.values._dhx_find(this.obj.value); + if (g != -1) { + this.setValue(e.keys[g]); + } else { + this.setValue((this.cell.combo_value = this.obj.value)); + } + } + } else { + this.setValue(this.list.value); + } + } + if (this.list.parentNode) { + this.list.parentNode.removeChild(this.list); + } + if (this.obj.parentNode) { + this.obj.parentNode.removeChild(this.obj); + } + return this.val != this.getValue(); + }; +} +eXcell_co.prototype = new eXcell(); +eXcell_co.prototype.getText = function () { + return this.cell.innerHTML; +}; +eXcell_co.prototype.setValue = function (g) { + if (typeof g == "object") { + var e = dhx4.ajax.xpath("./option", g); + if (e.length) { + this.cell._combo = new dhtmlXGridComboObject(); + } + for (var c = 0; c < e.length; c++) { + this.cell._combo.put(e[c].getAttribute("value"), e[c].firstChild ? e[c].firstChild.data : ""); + } + g = g.firstChild.data; + } + if ((g || "").toString()._dhx_trim() == "") { + g = null; + } + this.cell.combo_value = g; + if (g !== null) { + var a = (this.cell._combo || this.grid.getCombo(this.cell._cellIndex)).get(g); + this.setCValue(a === null ? g : a, g); + } else { + this.setCValue(" ", g); + } +}; +function eXcell_coro(a) { + this.base = eXcell_co; + this.base(a); + this.editable = false; +} +eXcell_coro.prototype = new eXcell_co(); +function eXcell_cotxt(a) { + this.base = eXcell_co; + this.base(a); +} +eXcell_cotxt.prototype = new eXcell_co(); +eXcell_cotxt.prototype.getText = function () { + return _isIE ? this.cell.innerText : this.cell.textContent; +}; +eXcell_cotxt.prototype.setValue = function (e) { + if (typeof e == "object") { + var c = dhx4.ajax.xpath("./option", e); + if (c.length) { + this.cell._combo = new dhtmlXGridComboObject(); + } + for (var a = 0; a < c.length; a++) { + this.cell._combo.put(c[a].getAttribute("value"), c[a].firstChild ? c[a].firstChild.data : ""); + } + e = e.firstChild.data; + } + if ((e || "").toString()._dhx_trim() == "") { + e = null; + } + if (e !== null) { + this.setCTxtValue((this.cell._combo || this.grid.getCombo(this.cell._cellIndex)).get(e) || e, e); + } else { + this.setCTxtValue(" ", e); + } + this.cell.combo_value = e; +}; +function eXcell_corotxt(a) { + this.base = eXcell_co; + this.base(a); + this.editable = false; +} +eXcell_corotxt.prototype = new eXcell_cotxt(); +function eXcell_cp(a) { + try { + this.cell = a; + this.grid = this.cell.parentNode.grid; + } catch (c) {} + this.edit = function () { + this.val = this.getValue(); + this.obj = document.createElement("SPAN"); + this.obj.style.border = "1px solid black"; + this.obj.style.position = "absolute"; + var e = this.grid.getPosition(this.cell); + this.colorPanel(4, this.obj); + document.body.appendChild(this.obj); + this.obj.style.left = e[0] + "px"; + this.obj.style.zIndex = 1000; + this.obj.style.top = e[1] + this.cell.offsetHeight + "px"; + }; + this.toolDNum = function (e) { + if (e.length == 1) { + e = "0" + e; + } + return e; + }; + this.colorPanel = function (s, w) { + var m = document.createElement("TABLE"); + w.appendChild(m); + m.cellSpacing = 0; + m.editor_obj = this; + m.style.cursor = "default"; + m.onclick = function (x) { + var r = x || window.event; + var j = r.target || r.srcElement; + var n = j.parentNode.parentNode.parentNode.editor_obj; + if (n) { + n.setValue(j._bg); + n.grid.editStop(); + } + }; + var h = 256 / s; + for (var l = 0; l <= 256 / h; l++) { + var e = m.insertRow(l); + for (var o = 0; o <= 256 / h; o++) { + for (var g = 0; g <= 256 / h; g++) { + R = new Number(h * l) - (l == 0 ? 0 : 1); + G = new Number(h * o) - (o == 0 ? 0 : 1); + B = new Number(h * g) - (g == 0 ? 0 : 1); + var v = this.toolDNum(R.toString(16)) + "" + this.toolDNum(G.toString(16)) + "" + this.toolDNum(B.toString(16)); + var u = e.insertCell(o); + u.width = "10px"; + u.innerHTML = " "; + u.title = v.toUpperCase(); + u.style.backgroundColor = "#" + v; + u._bg = "#" + v; + if (this.val != null && "#" + v.toUpperCase() == this.val.toUpperCase()) { + u.style.border = "2px solid white"; + } + } + } + } + }; + this.getValue = function () { + return this.cell.firstChild._bg || ""; + }; + this.getRed = function () { + return Number(parseInt(this.getValue().substr(1, 2), 16)); + }; + this.getGreen = function () { + return Number(parseInt(this.getValue().substr(3, 2), 16)); + }; + this.getBlue = function () { + return Number(parseInt(this.getValue().substr(5, 2), 16)); + }; + this.detach = function () { + if (this.obj.offsetParent != null) { + document.body.removeChild(this.obj); + } + return this.val != this.getValue(); + }; +} +eXcell_cp.prototype = new eXcell(); +eXcell_cp.prototype.setValue = function (a) { + this.setCValue("
 
", a); + this.cell.firstChild._bg = a; +}; +function eXcell_img(a) { + try { + this.cell = a; + this.grid = this.cell.parentNode.grid; + } catch (c) {} + this.getValue = function () { + if (this.cell.firstChild.tagName == "IMG") { + return this.cell.firstChild.src + (this.cell.titFl != null ? "^" + this.cell._brval : ""); + } else { + if (this.cell.firstChild.tagName == "A") { + var e = this.cell.firstChild.firstChild.src + (this.cell.titFl != null ? "^" + this.cell._brval : ""); + e += "^" + this.cell.lnk; + if (this.cell.trg) { + e += "^" + this.cell.trg; + } + return e; + } + } + }; + this.isDisabled = function () { + return true; + }; +} +eXcell_img.prototype = new eXcell(); +eXcell_img.prototype.getTitle = function () { + return this.cell._brval; +}; +eXcell_img.prototype.setValue = function (e) { + var c = e; + if ((e || "").indexOf("^") != -1) { + var a = e.split("^"); + e = a[0]; + c = this.cell._attrs.title || a[1]; + if (a.length > 2) { + this.cell.lnk = a[2]; + if (a[3]) { + this.cell.trg = a[3]; + } + } + this.cell.titFl = "1"; + } + if (!this.grid.multiLine) { + this.setCValue("", e); + } else { + this.setCValue("", e); + } + if (this.cell.lnk) { + this.cell.innerHTML = "" + this.cell.innerHTML + ""; + } + this.cell._brval = c; +}; +function eXcell_price(a) { + this.base = eXcell_ed; + this.base(a); + this.getValue = function () { + if (this.cell.childNodes.length > 1) { + return this.cell.childNodes[1].innerHTML.toString()._dhx_trim(); + } else { + return "0"; + } + }; +} +eXcell_price.prototype = new eXcell_ed(); +eXcell_price.prototype.setValue = function (c) { + if (isNaN(parseFloat(c))) { + c = this.val || 0; + } + var a = "green"; + if (c < 0) { + a = "red"; + } + this.setCValue("$" + c + "", c); +}; +function eXcell_dyn(a) { + this.base = eXcell_ed; + this.base(a); + this.getValue = function () { + return this.cell.firstChild.childNodes[1].innerHTML.toString()._dhx_trim(); + }; +} +eXcell_dyn.prototype = new eXcell_ed(); +eXcell_dyn.prototype.setValue = function (e) { + if (!e || isNaN(Number(e))) { + if (e !== "") { + e = 0; + } + } + if (e > 0) { + var c = "green"; + var a = "dyn_up.gif"; + } else { + if (e == 0) { + var c = "black"; + var a = "dyn_.gif"; + } else { + var c = "red"; + var a = "dyn_down.gif"; + } + } + this.setCValue( + "
" + + e + + "
", + e + ); +}; +function eXcell_ro(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + } + this.edit = function () {}; + this.isDisabled = function () { + return true; + }; + this.getValue = function () { + return this.cell._clearCell ? "" : this.cell.innerHTML.toString()._dhx_trim(); + }; +} +eXcell_ro.prototype = new eXcell(); +window.eXcell_hidden = function (a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + } + this.edit = function () {}; + this.isDisabled = function () { + return true; + }; + this.getValue = function () { + return this.cell.val; + }; +}; +eXcell_hidden.prototype = new eXcell(); +eXcell_hidden.prototype.setValue = function (a) { + this.cell.val = a; +}; +function eXcell_ron(a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + this.edit = function () {}; + this.isDisabled = function () { + return true; + }; + this.getValue = function () { + return this.cell._clearCell ? "" : this.cell._orig_value || this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(), this.cell._cellIndex).toString(); + }; +} +eXcell_ron.prototype = new eXcell(); +eXcell_ron.prototype.setValue = function (a) { + if (a === 0) { + } else { + if (!a || a.toString()._dhx_trim() == "") { + this.setCValue(" "); + return (this.cell._clearCell = true); + } + } + this.cell._orig_value = a; + this.cell._clearCell = false; + this.setCValue(a ? this.grid._aplNF(a, this.cell._cellIndex) : "0"); +}; +function eXcell_rotxt(a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + this.edit = function () {}; + this.isDisabled = function () { + return true; + }; + this.setValue = function (c) { + if (!c) { + c = " "; + this.cell._clearCell = true; + } else { + this.cell._clearCell = false; + } + this.setCTxtValue(c); + }; + this.getValue = function () { + if (this.cell._clearCell) { + return ""; + } + return _isIE ? this.cell.innerText : this.cell.textContent; + }; +} +eXcell_rotxt.prototype = new eXcell(); +function dhtmlXGridComboObject() { + this.keys = new dhtmlxArray(); + this.values = new dhtmlxArray(); + this.put = function (c, e) { + for (var a = 0; a < this.keys.length; a++) { + if (this.keys[a] == c) { + this.values[a] = e; + return true; + } + } + this.values[this.values.length] = e; + this.keys[this.keys.length] = c; + }; + this.get = function (c) { + for (var a = 0; a < this.keys.length; a++) { + if (this.keys[a] == c) { + return this.values[a]; + } + } + return null; + }; + this.clear = function () { + this.keys = new dhtmlxArray(); + this.values = new dhtmlxArray(); + }; + this.remove = function (c) { + for (var a = 0; a < this.keys.length; a++) { + if (this.keys[a] == c) { + this.keys._dhx_removeAt(a); + this.values._dhx_removeAt(a); + return true; + } + } + }; + this.size = function () { + var a = 0; + for (var c = 0; c < this.keys.length; c++) { + if (this.keys[c] != null) { + a++; + } + } + return a; + }; + this.getKeys = function () { + var a = new Array(0); + for (var c = 0; c < this.keys.length; c++) { + if (this.keys[c] != null) { + a[a.length] = this.keys[c]; + } + } + return a; + }; + this.save = function () { + this._save = new Array(); + for (var a = 0; a < this.keys.length; a++) { + this._save[a] = [this.keys[a], this.values[a]]; + } + }; + this.restore = function () { + if (this._save) { + this.keys[a] = new Array(); + this.values[a] = new Array(); + for (var a = 0; a < this._save.length; a++) { + this.keys[a] = this._save[a][0]; + this.values[a] = this._save[a][1]; + } + } + }; + return this; +} +function Hashtable() { + this.keys = new dhtmlxArray(); + this.values = new dhtmlxArray(); + return this; +} +Hashtable.prototype = new dhtmlXGridComboObject(); +if (typeof window.dhtmlXCellObject != "undefined") { + dhtmlXCellObject.prototype.attachGrid = function () { + this.callEvent("_onBeforeContentAttach", ["grid"]); + var a = document.createElement("DIV"); + a.style.width = "100%"; + a.style.height = "100%"; + a.style.position = "relative"; + a.style.overflow = "hidden"; + this._attachObject(a); + this.dataType = "grid"; + this.dataObj = new dhtmlXGridObject(a); + this.dataObj.setSkin(this.conf.skin); + if (typeof window.dhtmlXTabBarCell != "undefined" && this instanceof window.dhtmlXTabBarCell && navigator.userAgent.match(/7[\.\d]* mobile/gi) != null && navigator.userAgent.match(/AppleWebKit/gi) != null) { + this.dataObj.objBox.style.webkitOverflowScrolling = "auto"; + } + if (this.conf.skin == "dhx_skyblue" && typeof window.dhtmlXWindowsCell != "undefined" && this instanceof window.dhtmlXWindowsCell) { + this.dataObj.entBox.style.border = "1px solid #a4bed4"; + this.dataObj._sizeFix = 0; + } else { + this.dataObj.entBox.style.border = "0px solid white"; + this.dataObj._sizeFix = 2; + } + a = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; + }; +} +dhtmlXGridObject.prototype.enableDragAndDrop = function (a) { + if (a == "temporary_disabled") { + this.dADTempOff = false; + a = true; + } else { + this.dADTempOff = true; + } + this.dragAndDropOff = dhx4.s2b(a); + this._drag_validate = true; + if (a) { + this.objBox.ondragstart = function (c) { + (c || event).cancelBubble = true; + return false; + }; + } +}; +dhtmlXGridObject.prototype.setDragBehavior = function (a) { + this.dadmodec = this.dadmodefix = 0; + switch (a) { + case "child": + this.dadmode = 0; + this._sbmod = false; + break; + case "sibling": + this.dadmode = 1; + this._sbmod = false; + break; + case "sibling-next": + this.dadmode = 1; + this._sbmod = true; + break; + case "complex": + this.dadmode = 2; + this._sbmod = false; + break; + case "complex-next": + this.dadmode = 2; + this._sbmod = true; + break; + } +}; +dhtmlXGridObject.prototype.enableDragOrder = function (a) { + this._dndorder = dhx4.s2b(a); +}; +dhtmlXGridObject.prototype._checkParent = function (g, c) { + var e = this._h2.get[g.idd].parent; + if (!e.parent) { + return; + } + for (var a = 0; a < c.length; a++) { + if (c[a] == e.id) { + return true; + } + } + return this._checkParent(this.rowsAr[e.id], c); +}; +dhtmlXGridObject.prototype._createDragNode = function (g, h) { + this.editStop(); + if (window.dhtmlDragAndDrop.dragNode) { + return null; + } + if (!this.dADTempOff) { + return null; + } + g.parentObject = new Object(); + g.parentObject.treeNod = this; + var n = this.callEvent("onBeforeDrag", [g.parentNode.idd, g._cellIndex, h]); + if (!n) { + return null; + } + var j = new Array(); + j = this.getSelectedId(); + j = j && j != "" ? j.split(this.delim) : []; + var l = false; + for (var c = 0; c < j.length; c++) { + if (j[c] == g.parentNode.idd) { + l = true; + } + } + if (!l) { + this.selectRow(this.rowsAr[g.parentNode.idd], false, h.ctrlKey, false); + if (!h.ctrlKey) { + j = []; + } + j[this.selMultiRows ? j.length : 0] = g.parentNode.idd; + } + if (this.isTreeGrid()) { + for (var c = j.length - 1; c >= 0; c--) { + if (this._checkParent(this.rowsAr[j[c]], j)) { + j.splice(c, 1); + } + } + } + var o = this; + if (j.length && this._dndorder) { + j.sort(function (r, e) { + return o.rowsAr[r].rowIndex > o.rowsAr[e].rowIndex ? 1 : -1; + }); + } + var a = this.getFirstParentOfType(_isIE ? h.srcElement : h.target, "TD"); + if (a) { + this._dndExtra = a._cellIndex; + } + this._dragged = new Array(); + for (var c = 0; c < j.length; c++) { + if (this.rowsAr[j[c]]) { + this._dragged[this._dragged.length] = this.rowsAr[j[c]]; + this.rowsAr[j[c]].treeNod = this; + } + } + g.parentObject.parentNode = g.parentNode; + var m = document.createElement("div"); + m.innerHTML = n !== true ? n : this.rowToDragElement(g.parentNode.idd); + m.style.position = "absolute"; + m.className = "dragSpanDiv"; + return m; +}; +dhtmlXGridObject.prototype._createSdrgc = function () { + this._sdrgc = document.createElement("DIV"); + this._sdrgc.innerHTML = " "; + this._sdrgc.className = "gridDragLine"; + this.objBox.appendChild(this._sdrgc); +}; +function dragContext(x, w, v, u, s, r, n, o, m, g) { + this.source = x || "grid"; + this.target = w || "grid"; + this.mode = v || "move"; + this.dropmode = u || "child"; + this.sid = s || 0; + this.tid = r; + this.sobj = n || null; + this.tobj = o || null; + this.sExtra = m || null; + this.tExtra = g || null; + return this; +} +dragContext.prototype.valid = function () { + if (this.sobj != this.tobj) { + return true; + } + if (this.sid == this.tid) { + return false; + } + if (this.target == "treeGrid") { + var a = this.tid; + while ((a = this.tobj.getParentId(a))) { + if (this.sid == a) { + return false; + } + } + } + return true; +}; +dragContext.prototype.close = function () { + this.sobj = null; + this.tobj = null; +}; +dragContext.prototype.copy = function () { + return new dragContext(this.source, this.target, this.mode, this.dropmode, this.sid, this.tid, this.sobj, this.tobj, this.sExtra, this.tExtra); +}; +dragContext.prototype.set = function (e, c) { + this[e] = c; + return this; +}; +dragContext.prototype.uid = function (e, c) { + this.nid = this.sid; + while (this.tobj.rowsAr[this.nid]) { + this.nid = this.nid + new Date().valueOf(); + } + return this; +}; +dragContext.prototype.data = function () { + if (this.sobj == this.tobj) { + return this.sobj._getRowArray(this.sobj.rowsAr[this.sid]); + } + if (this.source == "tree") { + return this.tobj.treeToGridElement(this.sobj, this.sid, this.tid); + } else { + return this.tobj.gridToGrid(this.sid, this.sobj, this.tobj); + } +}; +dragContext.prototype.attrs = function () { + if (this.source == "tree") { + return {}; + } else { + return this.sobj.rowsAr[this.sid]._attrs; + } +}; +dragContext.prototype.childs = function () { + if (this.source == "treeGrid") { + return this.sobj._h2.get[this.sid]._xml_await ? this.sobj._h2.get[this.sid].has_kids : null; + } + return null; +}; +dragContext.prototype.pid = function () { + if (!this.tid) { + return 0; + } + if (!this.tobj._h2) { + return 0; + } + if (this.target == "treeGrid") { + if (this.dropmode == "child") { + return this.tid; + } else { + var c = this.tobj.rowsAr[this.tid]; + var a = this.tobj._h2.get[c.idd].parent.id; + if (this.alfa && this.tobj._sbmod && c.nextSibling) { + var e = this.tobj._h2.get[c.nextSibling.idd].parent.id; + if (e == this.tid) { + return this.tid; + } + if (e != a) { + return e; + } + } + return a; + } + } +}; +dragContext.prototype.ind = function () { + if (this.tid == window.unknown) { + return this.tobj.rowsBuffer.length; + } + if (this.target == "treeGrid") { + if (this.dropmode == "child") { + this.tobj.openItem(this.tid); + } else { + this.tobj.openItem(this.tobj.getParentId(this.tid)); + } + } + var a = this.tobj.rowsBuffer._dhx_find(this.tobj.rowsAr[this.tid]); + if (this.alfa && this.tobj._sbmod && this.dropmode == "sibling") { + var c = this.tobj.rowsAr[this.tid]; + if (c.nextSibling && this._h2.get[c.nextSibling.idd].parent.id == this.tid) { + return a + 1; + } + } + return a + 1 + (this.target == "treeGrid" && a >= 0 && this.tobj._h2.get[this.tobj.rowsBuffer[a].idd].state == "minus" ? this.tobj._getOpenLenght(this.tobj.rowsBuffer[a].idd, 0) : 0); +}; +dragContext.prototype.img = function () { + if (this.target != "grid" && this.sobj._h2) { + return this.sobj.getItemImage(this.sid); + } else { + return null; + } +}; +dragContext.prototype.slist = function () { + var c = new Array(); + for (var a = 0; a < this.sid.length; a++) { + c[c.length] = this.sid[a][this.source == "tree" ? "id" : "idd"]; + } + return c.join(","); +}; +dhtmlXGridObject.prototype._drag = function (r, h, o, s) { + if (this._realfake) { + return this._fake._drag(); + } + var n = this.lastLanding; + if (this._autoOpenTimer) { + window.clearTimeout(this._autoOpenTimer); + } + var g = o.parentNode; + var e = r.parentObject; + if (!g.idd) { + g.grid = this; + this.dadmodefix = 0; + } + var m = new dragContext(0, 0, 0, g.grid.dadmode == 1 || g.grid.dadmodec ? "sibling" : "child"); + if (e && e.childNodes) { + m.set("source", "tree").set("sobj", e.treeNod).set("sid", m.sobj._dragged); + } else { + if (!e) { + return true; + } + if (e.treeNod.isTreeGrid && e.treeNod.isTreeGrid()) { + m.set("source", "treeGrid"); + } + m.set("sobj", e.treeNod).set("sid", m.sobj._dragged); + } + if (g.grid.isTreeGrid()) { + m.set("target", "treeGrid"); + } else { + m.set("dropmode", "sibling"); + } + m.set("tobj", g.grid).set("tid", g.idd); + if (m.tobj.dadmode == 2 && m.tobj.dadmodec == 1 && m.tobj.dadmodefix < 0) { + if (m.tobj.obj.rows[1].idd != m.tid) { + m.tid = g.previousSibling.idd; + } else { + m.tid = 0; + } + } + var a = this.getFirstParentOfType(s, "TD"); + if (a) { + m.set("tExtra", a._cellIndex); + } + if (a) { + m.set("sExtra", m.sobj._dndExtra); + } + if (m.sobj.dpcpy) { + m.set("mode", "copy"); + } + if (m.tobj._realfake) { + m.tobj = m.tobj._fake; + } + if (m.sobj._realfake) { + m.sobj = m.sobj._fake; + } + m.tobj._clearMove(); + if (e && e.treeNod && e.treeNod._nonTrivialRow) { + e.treeNod._nonTrivialRow(this, m.tid, m.dropmode, e); + } else { + m.tobj.dragContext = m; + if (!m.tobj.callEvent("onDrag", [m.slist(), m.tid, m.sobj, m.tobj, m.sExtra, m.tExtra])) { + return (m.tobj.dragContext = null); + } + var u = new Array(); + if (typeof m.sid == "object") { + var l = m.copy(); + for (var j = 0; j < m.sid.length; j++) { + if ( + !l + .set("alfa", !j) + .set("sid", m.sid[j][m.source == "tree" ? "id" : "idd"]) + .valid() + ) { + continue; + } + l.tobj._dragRoutine(l); + if (l.target == "treeGrid" && l.dropmode == "child") { + l.tobj.openItem(l.tid); + } + u[u.length] = l.nid; + l.set("dropmode", "sibling").set("tid", l.nid); + } + l.close(); + } else { + m.tobj._dragRoutine(m); + } + if (m.tobj.laterLink) { + m.tobj.laterLink(); + } + m.tobj.callEvent("onDrop", [m.slist(), m.tid, u.join(","), m.sobj, m.tobj, m.sExtra, m.tExtra]); + } + m.tobj.dragContext = null; + m.close(); +}; +dhtmlXGridObject.prototype._dragRoutine = function (s) { + if (s.sobj == s.tobj && s.source == "grid" && s.mode == "move" && !this._fake) { + if (s.sobj._dndProblematic) { + return; + } + var o = s.sobj.rowsAr[s.sid]; + var r = s.sobj.rowsCol._dhx_find(o); + s.sobj.rowsCol._dhx_removeAt(s.sobj.rowsCol._dhx_find(o)); + s.sobj.rowsBuffer._dhx_removeAt(s.sobj.rowsBuffer._dhx_find(o)); + s.sobj.rowsBuffer._dhx_insertAt(s.ind(), o); + if (s.tobj._fake) { + s.tobj._fake.rowsCol._dhx_removeAt(r); + var u = s.tobj._fake.rowsAr[s.sid]; + u.parentNode.removeChild(u); + } + s.sobj._insertRowAt(o, s.ind()); + s.nid = s.sid; + s.sobj.callEvent("onGridReconstructed", []); + return; + } + var n; + if (this._h2 && typeof s.tid != "undefined" && s.dropmode == "sibling" && (this._sbmod || s.tid)) { + if (s.alfa && this._sbmod && this._h2.get[s.tid].childs.length) { + this.openItem(s.tid); + n = s.uid().tobj.addRowBefore(s.nid, s.data(), this._h2.get[s.tid].childs[0].id, s.img(), s.childs()); + } else { + n = s.uid().tobj.addRowAfter(s.nid, s.data(), s.tid, s.img(), s.childs()); + } + } else { + n = s.uid().tobj.addRow(s.nid, s.data(), s.ind(), s.pid(), s.img(), s.childs()); + } + n._attrs = s.attrs(); + if (s.source == "tree") { + this.callEvent("onRowAdded", [s.nid]); + var a = s.sobj._globalIdStorageFind(s.sid); + if (a.childsCount) { + var m = s + .copy() + .set("tid", s.nid) + .set("dropmode", s.target == "grid" ? "sibling" : "child"); + for (var g = 0; g < a.childsCount; g++) { + s.tobj._dragRoutine(m.set("sid", a.childNodes[g].id)); + if (s.mode == "move") { + g--; + } + } + m.close(); + } + } else { + s.tobj._copyUserData(s); + this.callEvent("onRowAdded", [s.nid]); + if (s.source == "treeGrid") { + if (s.sobj == s.tobj) { + n._xml = s.sobj.rowsAr[s.sid]._xml; + } + var h = s.sobj._h2.get[s.sid]; + if (h && h.childs.length) { + var m = s.copy().set("tid", s.nid); + if (s.target == "grid") { + m.set("dropmode", "sibling"); + } else { + if (!m.tobj.kidsXmlFile) { + m.tobj.openItem(s.tid); + } + m.set("dropmode", "child"); + } + var e = h.childs.length; + if (!m.tobj.kidsXmlFile) { + for (var g = 0; g < e; g++) { + s.sobj.render_row_tree(null, h.childs[g].id); + s.tobj._dragRoutine(m.set("sid", h.childs[g].id)); + if (e != h.childs.length) { + g--; + e = h.childs.length; + } + } + } + m.close(); + } + } + } + if (s.mode == "move") { + s.sobj[s.source == "tree" ? "deleteItem" : "deleteRow"](s.sid); + if (s.sobj == s.tobj && !s.tobj.rowsAr[s.sid]) { + s.tobj.changeRowId(s.nid, s.sid); + s.nid = s.sid; + } + } +}; +dhtmlXGridObject.prototype.gridToGrid = function (g, a, e) { + var h = new Array(); + for (var c = 0; c < a.hdr.rows[0].cells.length; c++) { + h[c] = a.cells(g, c).getValue(); + } + return h; +}; +dhtmlXGridObject.prototype.checkParentLine = function (a, c) { + if (!this._h2 || !c || !a) { + return false; + } + if (a.id == c) { + return true; + } else { + return this.checkParentLine(a.parent, c); + } +}; +dhtmlXGridObject.prototype._dragIn = function (j, g, c, l) { + if (!this.dADTempOff) { + return 0; + } + var a = this.isTreeGrid(); + var h = g.parentNode.idd ? g.parentNode : g.parentObject; + if (this._drag_validate) { + if (j.parentNode == g.parentNode) { + return 0; + } + if (a && this == h.grid && this.checkParentLine(this._h2.get[j.parentNode.idd], g.parentNode.idd)) { + return 0; + } + } + if (!this.callEvent("onDragIn", [h.idd || h.id, j.parentNode.idd, h.grid || h.treeNod, j.grid || j.parentNode.grid])) { + return this._setMove(j, c, l, true); + } + this._setMove(j, c, l); + if (a && j.parentNode.expand != "") { + var e = this; + this._autoOpenTimer = window.setTimeout(function () { + e._autoOpenItem(null, e); + e = null; + }, 1000); + this._autoOpenId = j.parentNode.idd; + } else { + if (this._autoOpenTimer) { + window.clearTimeout(this._autoOpenTimer); + } + } + return j; +}; +dhtmlXGridObject.prototype._autoOpenItem = function (a, c) { + c.openItem(c._autoOpenId); +}; +dhtmlXGridObject.prototype._dragOut = function (c) { + this._clearMove(); + var a = c.parentNode.parentObject ? c.parentObject.id : c.parentNode.idd; + this.callEvent("onDragOut", [a]); + if (this._autoOpenTimer) { + window.clearTimeout(this._autoOpenTimer); + } +}; +dhtmlXGridObject.prototype._setMove = function (j, c, m, h) { + if (!j.parentNode.idd) { + return; + } + var e = dhx4.absTop(j); + var a = dhx4.absTop(this.objBox); + if (e - a > parseInt(this.objBox.offsetHeight) - 50) { + this.objBox.scrollTop = parseInt(this.objBox.scrollTop) + 20; + } + if (e - a + parseInt(this.objBox.scrollTop) < parseInt(this.objBox.scrollTop) + 30) { + this.objBox.scrollTop = parseInt(this.objBox.scrollTop) - 20; + } + if (h) { + return 0; + } + if (this.dadmode == 2) { + var l = m - e + (document.body.scrollTop || document.documentElement.scrollTop) - 2 - j.offsetHeight / 2; + if (Math.abs(l) - j.offsetHeight / 6 > 0) { + this.dadmodec = 1; + if (l < 0) { + this.dadmodefix = -1; + } else { + this.dadmodefix = 1; + } + } else { + this.dadmodec = 0; + } + } else { + this.dadmodec = this.dadmode; + } + if (this.dadmodec) { + if (!this._sdrgc) { + this._createSdrgc(); + } + this._sdrgc.style.display = "block"; + this._sdrgc.style.top = e - a + parseInt(this.objBox.scrollTop) + (this.dadmodefix >= 0 ? j.offsetHeight : 0) + "px"; + } else { + this._llSelD = j; + if (j.parentNode.tagName == "TR") { + for (var g = 0; g < j.parentNode.childNodes.length; g++) { + var l = j.parentNode.childNodes[g]; + l._bgCol = l.style.backgroundColor; + l.style.backgroundColor = "#FFCCCC"; + } + } + } +}; +dhtmlXGridObject.prototype._clearMove = function () { + if (this._sdrgc) { + this._sdrgc.style.display = "none"; + } + if (this._llSelD && this._llSelD.parentNode.tagName == "TR") { + var c = this._llSelD.parentNode.childNodes; + for (var a = 0; a < c.length; a++) { + c[a].style.backgroundColor = c[a]._bgCol; + } + } + this._llSelD = null; +}; +dhtmlXGridObject.prototype.rowToDragElement = function (a) { + var c = this.cells(a, 0).getValue(); + return c; +}; +dhtmlXGridObject.prototype._copyUserData = function (g) { + if (!g.tobj.UserData[g.nid] || g.tobj != g.sobj) { + g.tobj.UserData[g.nid] = new Hashtable(); + } else { + return; + } + var e = g.sobj.UserData[g.sid]; + var a = g.tobj.UserData[g.nid]; + if (e) { + a.keys = a.keys.concat(e.keys); + a.values = a.values.concat(e.values); + } +}; +dhtmlXGridObject.prototype.moveRow = function (e, g, a, c) { + switch (g) { + case "row_sibling": + this.moveRowTo(e, a, "move", "sibling", this, c); + break; + case "up": + this.moveRowUp(e); + break; + case "down": + this.moveRowDown(e); + break; + } +}; +dhtmlXGridObject.prototype._nonTrivialNode = function (r, o, l, m, e) { + if (r.callEvent && !e) { + if (!r.callEvent("onDrag", [m.idd, o.id, l ? l.id : null, this, r])) { + return false; + } + } + var n = m.idd; + var a = n; + while (r._idpull[a]) { + a += new Date().getMilliseconds().toString(); + } + var h = this.isTreeGrid() ? this.getItemImage(n) : ""; + if (l) { + for (g = 0; g < o.childsCount; g++) { + if (o.childNodes[g] == l) { + break; + } + } + if (g != 0) { + l = o.childNodes[g - 1]; + } else { + st = "TOP"; + l = ""; + } + } + var c = r._attachChildNode(o, a, this.gridToTreeElement(r, a, n), "", h, h, h, "", "", l); + if (this._h2) { + var j = this._h2.get[n]; + if (j.childs.length) { + for (var g = 0; g < j.childs.length; g++) { + this._nonTrivialNode(r, c, 0, this.rowsAr[j.childs[g].id], 1); + if (!this.dpcpy) { + g--; + } + } + } + } + if (!this.dpcpy) { + this.deleteRow(n); + } + if (r.callEvent && !e) { + r.callEvent("onDrop", [a, o.id, l ? l.id : null, this, r]); + } +}; +dhtmlXGridObject.prototype.gridToTreeElement = function (c, e, a) { + return this.cells(a, 0).getValue(); +}; +dhtmlXGridObject.prototype.treeToGridElement = function (g, h, a) { + var c = new Array(); + var j = this.cellType._dhx_find("tree"); + if (j == -1) { + j = 0; + } + for (var e = 0; e < this.getColumnCount(); e++) { + c[c.length] = e != j ? g.getUserData(h, this.getColumnId(e)) || "" : g.getItemText(h); + } + return c; +}; +dhtmlXGridObject.prototype.moveRowTo = function (g, e, l, j, a, h) { + var m = new dragContext((a || this).isTreeGrid() ? "treeGrid" : "grid", (h || this).isTreeGrid() ? "treeGrid" : "grid", l, j || "sibling", g, e, a || this, h || this); + m.tobj._dragRoutine(m); + m.close(); + return m.nid; +}; +dhtmlXGridObject.prototype.enableMercyDrag = function (a) { + this.dpcpy = dhx4.s2b(a); +}; +dhtmlXGridObject.prototype.toPDF = function (g, o, v, s, m, C) { + var h = { row: (this.getSelectedRowId() || "").split(this.delim), col: this.getSelectedCellIndex() }; + if (h.row === null || h.col === -1) { + h = false; + } else { + if (h.row) { + for (var w = 0; w < h.row.length; w++) { + if (h.row[w]) { + var c = this.cells(h.row[w], h.col).cell; + c.parentNode.className = c.parentNode.className.replace(" rowselected", ""); + c.className = c.className.replace(" cellselected", ""); + h.row[w] = c; + } + } + } else { + h = false; + } + } + o = o || "color"; + var x = o == "full_color"; + var a = this; + a._asCDATA = true; + if (typeof C === "undefined") { + this.target = ' target="_blank"'; + } else { + this.target = C; + } + eXcell_ch.prototype.getContent = function () { + return this.getValue(); + }; + eXcell_ra.prototype.getContent = function () { + return this.getValue(); + }; + function A(F) { + var M = []; + for (var K = 1; K < a.hdr.rows.length; K++) { + M[K] = []; + for (var J = 0; J < a._cCount; J++) { + var O = a.hdr.rows[K].childNodes[J]; + if (!M[K][J]) { + M[K][J] = [0, 0]; + } + if (O) { + M[K][O._cellIndexS] = [O.colSpan, O.rowSpan]; + } + } + } + var L = "" + + a + ._serialiseExportConfig(M) + .replace(/^$/, "columns>"); + for (var K = 2; K < a.hdr.rows.length; K++) { + var D = 0; + var S = a.hdr.rows[K]; + var N = ""; + for (var J = 0; J < a._cCount; J++) { + if ((a._srClmn && !a._srClmn[J]) || (a._hrrar[J] && (!a._fake || J >= a._fake.hdrLabels.length))) { + D++; + continue; + } + var Q = M[K][J]; + var P = Q[0] && Q[0] > 1 ? ' colspan="' + Q[0] + '" ' : ""; + if (Q[1] && Q[1] > 1) { + P += ' rowspan="' + Q[1] + '" '; + D = -1; + } + var E = ""; + var I = S; + if (a._fake && J < a._fake._cCount) { + I = a._fake.hdr.rows[K]; + } + for (var H = 0; H < I.cells.length; H++) { + if (I.cells[H]._cellIndexS == J) { + if (I.cells[H].getElementsByTagName("SELECT").length) { + E = ""; + } else { + E = _isIE ? I.cells[H].innerText : I.cells[H].textContent; + } + E = E.replace(/[ \n\r\t\xA0]+/, " "); + break; + } + } + if (!E || E == " ") { + D++; + } + N += ""; + } + if (D != a._cCount) { + L += "\n" + N + ""; + } + } + L += "\n"; + L += n(); + return L; + } + function e() { + var D = []; + if (m) { + for (var E = 0; E < m.length; E++) { + D.push(u(a.getRowIndex(m[E]))); + } + } else { + for (var E = 0; E < a.getRowsNum(); E++) { + D.push(u(E)); + } + } + return D.join("\n"); + } + function n() { + var F = [""]; + if (!a.ftr) { + return ""; + } + for (var H = 1; H < a.ftr.rows.length; H++) { + F.push(""); + var K = a.ftr.rows[H]; + for (var E = 0; E < a._cCount; E++) { + if (a._srClmn && !a._srClmn[E]) { + continue; + } + if (a._hrrar[E] && (!a._fake || E >= a._fake.hdrLabels.length)) { + continue; + } + for (var D = 0; D < K.cells.length; D++) { + var J = ""; + var I = ""; + if (K.cells[D]._cellIndexS == E) { + J = _isIE ? K.cells[D].innerText : K.cells[D].textContent; + J = J.replace(/[ \n\r\t\xA0]+/, " "); + if (K.cells[D].colSpan && K.cells[D].colSpan != 1) { + I = " colspan='" + K.cells[D].colSpan + "' "; + } + if (K.cells[D].rowSpan && K.cells[D].rowSpan != 1) { + I = " rowspan='" + K.cells[D].rowSpan + "' "; + } + break; + } + } + F.push(""); + } + F.push(""); + } + F.push(""); + return F.join("\n"); + } + function l(E, D) { + return (window.getComputedStyle ? window.getComputedStyle(E, null)[D] : E.currentStyle ? E.currentStyle[D] : null) || ""; + } + function u(H) { + if (!a.rowsBuffer[H]) { + return ""; + } + var D = a.render_row(H); + if (D.style.display == "none") { + return ""; + } + var E = a.isTreeGrid() ? ' level="' + a.getLevel(D.idd) + '"' : ""; + var L = ""; + for (var J = 0; J < a._cCount; J++) { + if ((!a._srClmn || a._srClmn[J]) && (!a._hrrar[J] || (a._fake && J < a._fake.hdrLabels.length))) { + var P = a.cells(D.idd, J); + if (x) { + var I = l(P.cell, "color"); + var O = l(P.cell, "backgroundColor"); + var N = l(P.cell, "font-weight") || l(P.cell, "fontWeight"); + var K = l(P.cell, "font-style") || l(P.cell, "fontStyle"); + var M = l(P.cell, "text-align") || l(P.cell, "textAlign"); + var F = l(P.cell, "font-family") || l(P.cell, "fontFamily"); + if (O == "transparent" || O == "rgba(0, 0, 0, 0)") { + O = "rgb(255,255,255)"; + } + L += ""; + } else { + L += ""; + } + L += ""; + } + } + return L + ""; + } + function r() { + var D = ""; + return D; + } + var y = document.createElement("div"); + y.style.display = "none"; + document.body.appendChild(y); + var j = "form_" + a.uid(); + y.innerHTML = '
'; + document.getElementById(j).firstChild.value = encodeURIComponent(A(o).replace("\u2013", "-") + e() + r()); + document.getElementById(j).submit(); + y.parentNode.removeChild(y); + a = null; + if (h && h.row.length) { + for (var w = 0; w < h.row.length; w++) { + h.row[w].parentNode.className += " rowselected"; + if (h.row.length == 1) { + h.row[w].className += " cellselected"; + } + } + } + h = null; +}; +dhtmlXGridObject.prototype._serialiseExportConfig = function (l) { + function h(j) { + if (typeof j !== "string") { + return j; + } + j = j.replace(/&/g, "&"); + j = j.replace(/"/g, """); + j = j.replace(/'/g, "'"); + j = j.replace(//g, ">"); + return j; + } + var c = ""; + for (var e = 0; e < this.hdr.rows[0].cells.length; e++) { + if (this._srClmn && !this._srClmn[e]) { + continue; + } + if (this._hrrar[e] && (!this._fake || e >= this._fake.hdrLabels.length)) { + continue; + } + var g = this.fldSort[e]; + if (g == "cus") { + g = this._customSorts[e].toString(); + g = g.replace(/function[\ ]*/, "").replace(/\([^\f]*/, ""); + } + var o = l[1][e]; + var m = (o[1] && o[1] > 1 ? ' rowspan="' + o[1] + '" ' : "") + (o[0] && o[0] > 1 ? ' colspan="' + o[0] + '" ' : ""); + c += + ""; + } + return (c += ""); +}; +if (window.eXcell_sub_row_grid) { + window.eXcell_sub_row_grid.prototype.getContent = function () { + return ""; + }; +} +dhtmlXGridObject.prototype.toExcel = function (a, g, l, j, c) { + if (!document.getElementById("ifr")) { + var h = document.createElement("iframe"); + h.style.display = "none"; + h.setAttribute("name", "dhx_export_iframe"); + h.setAttribute("src", ""); + h.setAttribute("id", "dhx_export_iframe"); + document.body.appendChild(h); + } + var e = ' target="dhx_export_iframe"'; + this.toPDF(a, g, l, j, c, e); +}; +dhtmlXGridObject.prototype.filterBy = function (e, g, c) { + if (this.isTreeGrid()) { + return this.filterTreeBy(e, g, c); + } + if (this._f_rowsBuffer) { + if (!c) { + this.rowsBuffer = dhtmlxArray([].concat(this._f_rowsBuffer)); + if (this._fake) { + this._fake.rowsBuffer = this.rowsBuffer; + } + } + } else { + this._f_rowsBuffer = [].concat(this.rowsBuffer); + } + if (!this.rowsBuffer.length) { + return; + } + var h = true; + this.dma(true); + if (typeof e == "object") { + for (var a = 0; a < g.length; a++) { + this._filterA(e[a], g[a]); + } + } else { + this._filterA(e, g); + } + this.dma(false); + if (this.pagingOn && this.rowsBuffer.length / this.rowsBufferOutSize < this.currentPage - 1) { + this.changePage(0); + } + this._reset_view(); + this.callEvent("onGridReconstructed", []); +}; +dhtmlXGridObject.prototype._filterA = function (c, e) { + if (e == "") { + return; + } + var g = true; + if (typeof e == "function") { + g = false; + } else { + e = (e || "").toString().toLowerCase(); + } + if (!this.rowsBuffer.length) { + return; + } + for (var a = this.rowsBuffer.length - 1; a >= 0; a--) { + if (g ? this._get_cell_value(this.rowsBuffer[a], c).toString().toLowerCase().indexOf(e) == -1 : !e.call(this, this._get_cell_value(this.rowsBuffer[a], c), this.rowsBuffer[a].idd)) { + this.rowsBuffer.splice(a, 1); + } + } +}; +dhtmlXGridObject.prototype.getFilterElement = function (a) { + if (!this.filters) { + return; + } + for (var c = 0; c < this.filters.length; c++) { + if (this.filters[c][1] == a) { + return this.filters[c][0].combo || this.filters[c][0]; + } + } + return null; +}; +dhtmlXGridObject.prototype.collectValues = function (g) { + var s = this.dhxevs.data.oncollectvalues; + if (s) { + var o = true; + for (var r in s) { + var u = s[r].call(this, g); + if (u !== true) { + o = u || o; + } + } + if (o !== true) { + return o; + } + } + if (this.isTreeGrid()) { + return this.collectTreeValues(g); + } + this.dma(true); + this._build_m_order(); + g = this._m_order ? this._m_order[g] : g; + var m = {}; + var j = []; + var e = this._f_rowsBuffer || this.rowsBuffer; + for (var h = 0; h < e.length; h++) { + var a = this._get_cell_value(e[h], g); + if (a && (!e[h]._childIndexes || e[h]._childIndexes[g] != e[h]._childIndexes[g - 1])) { + m[a] = true; + } + } + this.dma(false); + var n = this.combos[g] || (this._col_combos ? this._col_combos[g] : false); + for (var l in m) { + if (m[l] === true) { + if (n) { + if (n.get && n.get(l)) { + l = n.get(l); + } else { + if (n.getOption && n.getOption(l)) { + l = n.getOption(l).text; + } + } + } + j.push(l); + } + } + return j.sort(); +}; +dhtmlXGridObject.prototype._build_m_order = function () { + if (this._c_order) { + this._m_order = []; + for (var a = 0; a < this._c_order.length; a++) { + this._m_order[this._c_order[a]] = a; + } + } +}; +dhtmlXGridObject.prototype.filterByAll = function () { + var e = []; + var c = []; + this._build_m_order(); + for (var g = 0; g < this.filters.length; g++) { + var j = this._m_order ? this._m_order[this.filters[g][1]] : this.filters[g][1]; + if (j >= this._cCount) { + continue; + } + c.push(j); + var l = (this.filters[g][0].old_value = this.filters[g][0].value); + if (this.filters[g][0]._filter) { + l = this.filters[g][0]._filter(); + } + var h; + if (typeof l != "function" && (h = this.combos[j] || (this._col_combos ? this._col_combos[j] : false))) { + if (h.values) { + j = h.values._dhx_find(l); + l = j == -1 ? l : h.keys[j]; + } else { + if (h.getOptionByLabel) { + l = h.getOptionByLabel(l) ? h.getOptionByLabel(l).value : l; + } + } + } + e.push(l); + } + if (!this.callEvent("onFilterStart", [c, e])) { + return; + } + this.filterBy(c, e); + if (this._cssEven) { + this._fixAlterCss(); + } + this.callEvent("onFilterEnd", [this.filters]); + if (this._f_rowsBuffer && this.rowsBuffer.length == this._f_rowsBuffer.length) { + this._f_rowsBuffer = null; + } +}; +dhtmlXGridObject.prototype.makeFilter = function (h, e, c) { + if (!this.filters) { + this.filters = []; + } + if (typeof h != "object") { + h = document.getElementById(h); + } + if (!h) { + return; + } + var a = this; + if (!h.style.width) { + h.style.width = "90%"; + } + if (h.tagName == "SELECT") { + this.filters.push([h, e]); + this._loadSelectOptins(h, e); + h.onchange = function () { + a.filterByAll(); + }; + if (_isIE) { + h.style.marginTop = "1px"; + } + this.attachEvent("onEditCell", function (l, j, m) { + this._build_m_order(); + if (l == 2 && this.filters && (this._m_order ? m == this._m_order[e] : m == e)) { + this._loadSelectOptins(h, e); + } + return true; + }); + } else { + if (h.tagName == "INPUT") { + this.filters.push([h, e]); + h.old_value = h.value = ""; + h.onkeydown = function () { + if (this._timer) { + window.clearTimeout(this._timer); + } + this._timer = window.setTimeout(function () { + if (h.value != h.old_value) { + a.filterByAll(); + h.old_value = h.value; + } + }, 500); + }; + } else { + if (h.tagName == "DIV") { + this.filters.push([h, e]); + h.style.padding = "0px"; + h.style.margin = "0px"; + if (!window.dhx_globalImgPath) { + window.dhx_globalImgPath = this.imgURL; + } + var g = new dhtmlXCombo(h, "_filter", "90%"); + g.filterSelfA = g.filterSelf; + g.filterSelf = function () { + if (this.getSelectedIndex() == 0) { + this.setComboText(""); + } + this.filterSelfA.apply(this, arguments); + this.optionsArr[0].hide(false); + }; + g.enableFilteringMode(true); + h.combo = g; + h.value = ""; + this._loadComboOptins(h, e); + g.attachEvent("onChange", function () { + h.value = g.getSelectedValue(); + if (h.value === null) { + h.value = ""; + } + a.filterByAll(); + }); + } + } + } + if (h.parentNode) { + h.parentNode.className += " filter"; + } + this._filters_ready(); +}; +dhtmlXGridObject.prototype.findCell = function (l, m, g, h) { + var h = + h || + function (n, j) { + return j.toString().toLowerCase().indexOf(n) != -1; + }; + if (h === true) { + h = function (n, j) { + return j.toString().toLowerCase() == n; + }; + } + var e = new Array(); + l = l.toString().toLowerCase(); + if (typeof g != "number") { + g = g ? 1 : 0; + } + if (!this.rowsBuffer.length) { + return e; + } + for (var c = m || 0; c < this._cCount; c++) { + if (this._h2) { + this._h2.forEachChild( + 0, + function (j) { + if (g && e.length == g) { + return e; + } + if (h(l, this._get_cell_value(j.buff, c))) { + e.push([j.id, c]); + } + }, + this + ); + } else { + for (var a = 0; a < this.rowsBuffer.length; a++) { + if (h(l, this._get_cell_value(this.rowsBuffer[a], c))) { + e.push([this.rowsBuffer[a].idd, c]); + if (g && e.length == g) { + return e; + } + } + } + } + if (typeof m != "undefined") { + return e; + } + } + return e; +}; +dhtmlXGridObject.prototype.makeSearch = function (g, e, a) { + if (typeof g != "object") { + g = document.getElementById(g); + } + if (!g) { + return; + } + var c = this; + if (g.tagName == "INPUT") { + g.onkeypress = function () { + if (this._timer) { + window.clearTimeout(this._timer); + } + this._timer = window.setTimeout(function () { + if (g.value == "") { + return; + } + var h = c.findCell(g.value, e, true, a); + if (h.length) { + if (c._h2) { + c.openItem(h[0][0]); + } + c.selectCell(c.getRowIndex(h[0][0]), e || 0); + } + }, 500); + }; + } + if (g.parentNode) { + g.parentNode.className += " filter"; + } +}; +dhtmlXGridObject.prototype._loadSelectOptins = function (h, m) { + var a = this.collectValues(m); + var e = h.value; + h.innerHTML = ""; + h.options[0] = new Option("", ""); + var j = this._filter_tr ? this._filter_tr[m] : null; + for (var g = 0; g < a.length; g++) { + h.options[h.options.length] = new Option(j ? j(a[g]) : a[g], a[g]); + } + h.value = e; +}; +dhtmlXGridObject.prototype.setSelectFilterLabel = function (c, a) { + if (!this._filter_tr) { + this._filter_tr = []; + } + this._filter_tr[c] = a; +}; +dhtmlXGridObject.prototype._loadComboOptins = function (g, j) { + if (!g.combo) { + return; + } + var a = this.collectValues(j); + g.combo.clearAll(); + var h = [["", ""]]; + for (var e = 0; e < a.length; e++) { + h.push([a[e], a[e]]); + } + g.combo.addOption(h); +}; +dhtmlXGridObject.prototype.refreshFilters = function () { + if (!this.filters) { + return; + } + for (var a = 0; a < this.filters.length; a++) { + switch (this.filters[a][0].tagName.toLowerCase()) { + case "input": + break; + case "select": + this._loadSelectOptins.apply(this, this.filters[a]); + break; + case "div": + this._loadComboOptins.apply(this, this.filters[a]); + break; + } + } +}; +dhtmlXGridObject.prototype._filters_ready = function (c, a) { + this.attachEvent("onXLE", this.refreshFilters); + this.attachEvent("onRowCreated", function (h, g) { + if (this._f_rowsBuffer) { + for (var e = 0; e < this._f_rowsBuffer.length; e++) { + if (this._f_rowsBuffer[e].idd == h) { + return (this._f_rowsBuffer[e] = g); + } + } + } + }); + this.attachEvent("onClearAll", function () { + this._f_rowsBuffer = null; + if (!this.hdr.rows.length) { + this.filters = []; + } + }); + this.attachEvent("onSetSizes", this._filters_resize_combo); + this.attachEvent("onResize", this._filters_resize_combo); + this._filters_ready = function () {}; +}; +dhtmlXGridObject.prototype._filters_resize_combo = function () { + if (!this.filters) { + return; + } + for (var a = 0; a < this.filters.length; a++) { + if (this.filters[a][0].combo != null) { + this.filters[a][0].combo.setSize(Math.round((this.filters[a][0].offsetWidth * 90) / 100)); + } + } + return true; +}; +dhtmlXGridObject.prototype._in_header_text_filter = function (c, a) { + c.innerHTML = ""; + c.onclick = c.onmousedown = function (g) { + (g || event).cancelBubble = true; + return true; + }; + c.onselectstart = function () { + return (event.cancelBubble = true); + }; + this.makeFilter(c.firstChild, a); +}; +dhtmlXGridObject.prototype._in_header_text_filter_inc = function (c, a) { + c.innerHTML = ""; + c.onclick = c.onmousedown = function (g) { + (g || event).cancelBubble = true; + return true; + }; + c.onselectstart = function () { + return (event.cancelBubble = true); + }; + this.makeFilter(c.firstChild, a); + c.firstChild._filter = function () { + if (c.firstChild.value == "") { + return ""; + } + return function (e) { + return e.toString().toLowerCase().indexOf(c.firstChild.value.toLowerCase()) == 0; + }; + }; + this._filters_ready(); +}; +dhtmlXGridObject.prototype._in_header_select_filter = function (c, a) { + c.innerHTML = ""; + c.onclick = function (g) { + (g || event).cancelBubble = true; + return false; + }; + this.makeFilter(c.firstChild, a); +}; +dhtmlXGridObject.prototype._in_header_select_filter_strict = function (e, c) { + e.innerHTML = ""; + e.onclick = function (g) { + (g || event).cancelBubble = true; + return false; + }; + this.makeFilter(e.firstChild, c); + var a = this.combos; + e.firstChild._filter = function () { + var g = e.firstChild.value; + if (!g) { + return ""; + } + if (a[c]) { + g = a[c].keys[a[c].values._dhx_find(g)]; + } + g = g.toLowerCase(); + return function (h) { + return h.toString().toLowerCase() == g; + }; + }; + this._filters_ready(); +}; +dhtmlXGridObject.prototype._in_header_combo_filter = function (c, a) { + c.innerHTML = "
"; + c.onselectstart = function () { + return (event.cancelBubble = true); + }; + c.onclick = c.onmousedown = function (g) { + (g || event).cancelBubble = true; + return true; + }; + this.makeFilter(c.firstChild, a); +}; +dhtmlXGridObject.prototype._search_common = function (c, a) { + c.innerHTML = ""; + c.onclick = c.onmousedown = function (g) { + (g || event).cancelBubble = true; + return true; + }; + c.onselectstart = function () { + return (event.cancelBubble = true); + }; +}; +dhtmlXGridObject.prototype._in_header_text_search = function (e, c, a) { + this._search_common(e, c); + this.makeSearch(e.firstChild, c); +}; +dhtmlXGridObject.prototype._in_header_text_search_strict = function (c, a) { + this._search_common(c, a); + this.makeSearch(c.firstChild, a, true); +}; +dhtmlXGridObject.prototype._in_header_numeric_filter = function (c, a) { + this._in_header_text_filter.call(this, c, a); + c.firstChild._filter = function () { + var e = this.value; + var h; + var l = "=="; + var g = parseFloat(e.replace("=", "")); + var j = null; + if (e) { + if (e.indexOf("..") != -1) { + e = e.split(".."); + g = parseFloat(e[0]); + j = parseFloat(e[1]); + return function (m) { + if (m >= g && m <= j) { + return true; + } + return false; + }; + } + h = e.match(/>=|<=|>|" + h[1]; + var a = this; + g.getElementsByTagName("input")[0].onclick = function (l) { + a._build_m_order(); + var c = a._m_order ? a._m_order[e] : e; + var m = this.checked ? 1 : 0; + a.forEachRowA(function (n) { + var j = this.cells(n, c); + if (j.isCheckbox()) { + j.setValue(m); + j.cell.wasChanged = true; + } + this.callEvent("onEditCell", [1, n, c, m]); + this.callEvent("onCheckbox", [n, c, m]); + }); + (l || event).cancelBubble = true; + }; +}; +dhtmlXGridObject.prototype._in_header_stat_total = function (e, a, h) { + var g = function () { + var n = 0; + this._build_m_order(); + var m = this._m_order ? this._m_order[a] : a; + for (var l = 0; l < this.rowsBuffer.length; l++) { + var c = parseFloat(this._get_cell_value(this.rowsBuffer[l], m)); + n += isNaN(c) ? 0 : c; + } + return this._maskArr[m] ? this._aplNF(n, m) : Math.round(n * 100) / 100; + }; + this._stat_in_header(e, g, a, h, h); +}; +dhtmlXGridObject.prototype._in_header_stat_multi_total = function (h, g, n) { + var m = n[1].split(":"); + n[1] = ""; + for (var e = 0; e < m.length; e++) { + m[e] = parseInt(m[e]); + } + var j = function () { + var s = 0; + for (var r = 0; r < this.rowsBuffer.length; r++) { + var o = 1; + for (var c = 0; c < m.length; c++) { + o *= parseFloat(this._get_cell_value(this.rowsBuffer[r], m[c])); + } + s += isNaN(o) ? 0 : o; + } + return this._maskArr[g] ? this._aplNF(s, g) : Math.round(s * 100) / 100; + }; + var a = []; + for (var l = 0; l < m.length; l++) { + a[m[l]] = true; + } + this._stat_in_header(h, j, a, n, n); +}; +dhtmlXGridObject.prototype._in_header_stat_max = function (e, a, h) { + var g = function () { + this._build_m_order(); + var l = this._m_order ? this._m_order[a] : a; + var m = -999999999; + if (this.getRowsNum() == 0) { + return " "; + } + for (var c = 0; c < this.rowsBuffer.length; c++) { + m = Math.max(m, parseFloat(this._get_cell_value(this.rowsBuffer[c], l))); + } + return this._maskArr[a] ? this._aplNF(m, a) : m; + }; + this._stat_in_header(e, g, a, h); +}; +dhtmlXGridObject.prototype._in_header_stat_min = function (e, a, h) { + var g = function () { + this._build_m_order(); + var l = this._m_order ? this._m_order[a] : a; + var m = 999999999; + if (this.getRowsNum() == 0) { + return " "; + } + for (var c = 0; c < this.rowsBuffer.length; c++) { + m = Math.min(m, parseFloat(this._get_cell_value(this.rowsBuffer[c], l))); + } + return this._maskArr[a] ? this._aplNF(m, a) : m; + }; + this._stat_in_header(e, g, a, h); +}; +dhtmlXGridObject.prototype._in_header_stat_average = function (e, a, h) { + var g = function () { + this._build_m_order(); + var m = this._m_order ? this._m_order[a] : a; + var o = 0; + var n = 0; + if (this.getRowsNum() == 0) { + return " "; + } + for (var l = 0; l < this.rowsBuffer.length; l++) { + var c = parseFloat(this._get_cell_value(this.rowsBuffer[l], m)); + if (!isNaN(c)) { + o += c; + n++; + } + } + return this._maskArr[a] ? this._aplNF(o / n, a) : Math.round((o / n) * 100) / 100; + }; + this._stat_in_header(e, g, a, h); +}; +dhtmlXGridObject.prototype._in_header_stat_count = function (e, a, h) { + var g = function () { + return this.getRowsNum(); + }; + this._stat_in_header(e, g, a, h); +}; +dhtmlXGridObject.prototype._stat_in_header = function (e, g, a, l) { + var h = this; + var j = function () { + this.dma(true); + e.innerHTML = (l[0] ? l[0] : "") + g.call(this) + (l[1] ? l[1] : ""); + this.dma(false); + this.callEvent("onStatReady", []); + }; + if (!this._stat_events) { + this._stat_events = []; + this.attachEvent("onClearAll", function () { + if (!this.hdr.rows[1]) { + for (var m = 0; m < this._stat_events.length; m++) { + for (var c = 0; c < 4; c++) { + this.detachEvent(this._stat_events[m][c]); + } + } + this._stat_events = []; + } + }); + } + this._stat_events.push([ + this.attachEvent("onGridReconstructed", j), + this.attachEvent("onXLE", j), + this.attachEvent("onFilterEnd", j), + this.attachEvent("onEditCell", function (c, n, m) { + if (c == 2 && (m == a || (a && a[m]))) { + j.call(this); + } + return true; + }), + ]); + e.innerHTML = ""; +}; +dhtmlXGridObject.prototype.loadCSVFile = function (c, a) { + this.load(c, a, "csv"); +}; +dhtmlXGridObject.prototype.enableCSVAutoID = function (a) { + this._csvAID = dhx4.s2b(a); +}; +dhtmlXGridObject.prototype.enableCSVHeader = function (a) { + this._csvHdr = dhx4.s2b(a); +}; +dhtmlXGridObject.prototype.setCSVDelimiter = function (a) { + this.csv.cell = a; +}; +dhtmlXGridObject.prototype._csvAID = true; +dhtmlXGridObject.prototype.loadCSVString = function (a) { + this.parse(a, "csv"); +}; +dhtmlXGridObject.prototype.serializeToCSV = function (n) { + this.editStop(); + if (this._mathSerialization) { + this._agetm = "getMathValue"; + } else { + if (this._strictText || n) { + this._agetm = "getTitle"; + } else { + this._agetm = "getValue"; + } + } + var l = []; + if (this._csvHdr) { + for (var h = 1; h < this.hdr.rows.length; h++) { + var c = []; + for (var m = 0; m < this._cCount; m++) { + if (!this._srClmn || this._srClmn[m]) { + c.push(this.getColumnLabel(m, h - 1)); + } + } + l.push(this.csvParser.str(c, this.csv.cell, this.csv.row)); + } + } + var m = 0; + var g = this.rowsBuffer.length; + for (m; m < g; m++) { + var e = this._serializeRowToCVS(null, m); + if (e != "") { + l.push(e); + } + } + return this.csvParser.block(l, this.csv.row); +}; +dhtmlXGridObject.prototype._serializeRowToCVS = function (a, n, e, l) { + var m = new Array(); + if (!a) { + a = this.render_row(n); + if (this._fake && !this._fake.rowsAr[a.idd]) { + this._fake.render_row(n); + } + } + if (!this._csvAID) { + m[m.length] = a.idd; + } + e = e || 0; + l = l || this._cCount; + var s = false; + var g = e; + while (a.childNodes[e]._cellIndex > g && e) { + e--; + } + for (var o = e; g < l; o++) { + if (!a.childNodes[o]) { + break; + } + var c = a.childNodes[o]._cellIndex; + if ((!this._srClmn || this._srClmn[c]) && (!this._serialize_visible || !this._hrrar[c])) { + var h = a.childNodes[o]; + var j = this.cells(a.idd, c); + while (g != c) { + g++; + m.push(""); + if (g >= l) { + break; + } + } + if (g >= l) { + break; + } + g++; + if (j.cell) { + zxVal = j[this._agetm](); + } else { + zxVal = ""; + } + if (this._chAttr && j.wasChanged()) { + s = true; + } + m[m.length] = zxVal === null ? "" : zxVal; + if (this._ecspn && h.colSpan && h.colSpan > 1) { + h = h.colSpan - 1; + for (var v = 0; v < h; v++) { + m[m.length] = ""; + g++; + } + } + } else { + g++; + } + } + if (this._onlChAttr && !s) { + return ""; + } + return this.csvParser.str(m, this.csv.cell, this.csv.row); +}; +dhtmlXGridObject.prototype.toClipBoard = function (a) { + if (window.clipboardData) { + window.clipboardData.setData("Text", a); + } else { + new Clipboard().copy(a); + } +}; +dhtmlXGridObject.prototype.fromClipBoard = function () { + if (window.clipboardData) { + return window.clipboardData.getData("Text"); + } else { + return new Clipboard().paste(); + } +}; +dhtmlXGridObject.prototype.cellToClipboard = function (e, c) { + if (!e || (!c && c !== 0)) { + if (!this.selectedRows[0]) { + return; + } + e = this.selectedRows[0].idd; + c = this.cell._cellIndex; + } + var a = this.cells(e, c); + this.toClipBoard(((a.getLabel ? a.getLabel() : a.getValue()) || "").toString()); +}; +dhtmlXGridObject.prototype.updateCellFromClipboard = function (e, c) { + if (!e || !c) { + if (!this.selectedRows[0]) { + return; + } + e = this.selectedRows[0].idd; + c = this.cell._cellIndex; + } + var a = this.cells(e, c); + a[a.setImage ? "setLabel" : "setValue"](this.fromClipBoard()); +}; +dhtmlXGridObject.prototype.rowToClipboard = function (g) { + var a = ""; + if (this._mathSerialization) { + this._agetm = "getMathValue"; + } else { + if (this._strictText) { + this._agetm = "getTitle"; + } else { + this._agetm = "getValue"; + } + } + this._serialize_visible = !this._fake; + if (g) { + a = this._serializeRowToCVS(this.getRowById(g)); + } else { + var e = []; + for (var c = 0; c < this.selectedRows.length; c++) { + e[e.length] = this._serializeRowToCVS(this.selectedRows[c]); + a = this.csvParser.block(e, this.csv.row); + } + } + this._serialize_visible = false; + this.toClipBoard(a); +}; +dhtmlXGridObject.prototype.updateRowFromClipboard = function (h) { + var a = this.fromClipBoard(); + if (!a) { + return; + } + if (h) { + var g = this.getRowById(h); + } else { + var g = this.selectedRows[0]; + } + if (!g) { + return; + } + var j = this.csvParser; + a = j.unblock(a, this.csv.cell, this.csv.row)[0]; + if (!this._csvAID) { + a.splice(0, 1); + } + for (var e = 0; e < a.length; e++) { + var c = this.cells3(g, e); + c[c.setImage ? "setLabel" : "setValue"](a[e]); + } +}; +dhtmlXGridObject.prototype.csvParser = { + block: function (a, c) { + return a.join(c); + }, + unblock: function (j, a, h) { + var g = (j || "").split(h); + for (var c = 0; c < g.length; c++) { + g[c] = (g[c] || "").split(a); + } + var e = g.length - 1; + if (g[e].length == 1 && g[e][0] == "") { + g.splice(e, 1); + } + return g; + }, + str: function (c, a, e) { + return c.join(a); + }, +}; +dhtmlXGridObject.prototype.csvExtParser = { + _quote: RegExp('"', "g"), + _quote_esc: RegExp('\\\\"', "g"), + block: function (a, c) { + return a.join(c); + }, + unblock: function (m, r, u) { + var e = [[]]; + var c = 0; + if (!m) { + return e; + } + var n = /^[ ]*"/; + var l = /"[ ]*$/; + var a = new RegExp(".*" + u + ".*$"); + var h = m.split(r); + for (var g = 0; g < h.length; g++) { + if (h[g].match(n)) { + var s = h[g].replace(n, ""); + while (!h[g].match(l)) { + g++; + s += h[g]; + } + e[c].push(s.replace(l, "").replace(this._quote_esc, '"')); + } else { + if (h[g].match(a)) { + var j = h[g].indexOf(u); + e[c].push(h[g].substr(0, j)); + c++; + e[c] = []; + h[g] = h[g].substr(j + 1); + g--; + } else { + if (h[g] || g != h.length - 1) { + e[c].push(h[g]); + } + } + } + } + var o = e.length - 1; + if (o > 0 && !e[o].length) { + e.splice(o, 1); + } + return e; + }, + str: function (e, a, g) { + for (var c = 0; c < e.length; c++) { + e[c] = '"' + e[c].replace(this._quote, '\\"') + '"'; + } + return e.join(a); + }, +}; +dhtmlXGridObject.prototype.addRowFromClipboard = function () { + var a = this.fromClipBoard(); + if (!a) { + return; + } + var e = this.csvParser.unblock(a, this.csv.cell, this.csv.row); + for (var c = 0; c < e.length; c++) { + if (e[c]) { + a = e[c]; + if (!a.length) { + continue; + } + if (this._csvAID) { + this.addRow(this.getRowsNum() + 2, a); + } else { + if (this.rowsAr[a[0]]) { + a[0] = this.uid(); + } + this.addRow(a[0], a.slice(1)); + } + } + } +}; +dhtmlXGridObject.prototype.gridToClipboard = function () { + this.toClipBoard(this.serializeToCSV()); +}; +dhtmlXGridObject.prototype.gridFromClipboard = function () { + var a = this.fromClipBoard(); + if (!a) { + return; + } + this.loadCSVString(a); +}; +dhtmlXGridObject.prototype.getXLS = function (j) { + if (!this.xslform) { + this.xslform = document.createElement("FORM"); + this.xslform.action = (j || "") + "xls.php"; + this.xslform.method = "post"; + this.xslform.target = _isIE ? "_blank" : ""; + document.body.appendChild(this.xslform); + var h = document.createElement("INPUT"); + h.type = "hidden"; + h.name = "csv"; + this.xslform.appendChild(h); + var g = document.createElement("INPUT"); + g.type = "hidden"; + g.name = "csv_header"; + this.xslform.appendChild(g); + } + var m = this.serializeToCSV(); + this.xslform.childNodes[0].value = m; + var e = []; + var a = this._cCount; + for (var c = 0; c < a; c++) { + e.push(this.getHeaderCol(c)); + } + e = e.join(","); + this.xslform.childNodes[1].value = e; + this.xslform.submit(); +}; +dhtmlXGridObject.prototype.printView = function (s, e) { + var o = ""; + var C = null; + if (this._fake) { + C = [].concat(this._hrrar); + for (var A = 0; A < this._fake._cCount; A++) { + this._hrrar[A] = null; + } + } + o += ""; + if (!this.parentGrid) { + o += s || ""; + } + o += ''; + var r = Math.max(this.rowsBuffer.length, this.rowsCol.length); + var n = this._cCount; + var u = this._printWidth(); + o += ''; + for (var A = 0; A < n; A++) { + if (this._hrrar && this._hrrar[A]) { + continue; + } + var h = this.hdr.rows[1].cells[this.hdr.rows[1]._childIndexes ? this.hdr.rows[1]._childIndexes[parseInt(A)] : A]; + var a = h.colSpan || 1; + var H = h.rowSpan || 1; + for (var y = 1; y < a; y++) { + u[A] += u[y]; + } + o += '"; + A += a - 1; + } + o += ""; + for (var A = 2; A < this.hdr.rows.length; A++) { + if (_isIE) { + o += ""; + var g = this.hdr.rows[A].childNodes; + for (var y = 0; y < g.length; y++) { + if (!this._hrrar || !this._hrrar[g[y]._cellIndex]) { + o += g[y].outerHTML; + } + } + o += ""; + } else { + o += "" + (this._fake ? this._fake.hdr.rows[A].innerHTML : "") + this.hdr.rows[A].innerHTML + ""; + } + } + for (var A = 0; A < r; A++) { + o += ""; + if (this.rowsCol[A] && this.rowsCol[A]._cntr) { + o += this.rowsCol[A].innerHTML.replace(/]*>/gi, "") + ""; + continue; + } + if (this.rowsCol[A] && this.rowsCol[A].style.display == "none") { + continue; + } + var m; + if (this.rowsCol[A]) { + m = this.rowsCol[A].idd; + } else { + if (this.rowsBuffer[A]) { + m = this.rowsBuffer[A].idd; + } else { + continue; + } + } + for (var y = 0; y < n; y++) { + if (this._hrrar && this._hrrar[y]) { + continue; + } + if (this.rowsAr[m] && this.rowsAr[m].tagName == "TR") { + var F = this.cells(m, y); + if (F._setState) { + var v = ""; + } else { + if (F.getContent) { + v = F.getContent(); + } else { + if (F.getImage || F.combo) { + var v = F.cell.innerHTML; + } else { + var v = F.getValue(); + } + } + } + } else { + var v = this._get_cell_value(this.rowsBuffer[A], y); + } + var w = this.columnColor[y] ? "background-color:" + this.columnColor[y] + ";" : ""; + var x = this.cellAlign[y] ? "text-align:" + this.cellAlign[y] + ";" : ""; + var D = F.getAttribute("colspan"); + o += '"; + if (D) { + y += D - 1; + } + } + o += ""; + if (this.rowsCol[A] && this.rowsCol[A]._expanded) { + var l = this.cells4(this.rowsCol[A]._expanded.ctrl); + if (l.getSubGrid) { + o += '"; + } else { + o += '"; + } + } + } + if (this.ftr) { + for (var A = 1; A < this.ftr.childNodes[0].rows.length; A++) { + o += "" + (this._fake ? this._fake.ftr.childNodes[0].rows[A].innerHTML : "") + this.ftr.childNodes[0].rows[A].innerHTML + ""; + } + } + o += "
' + this.getHeaderCol(A) + "
" + (v === "" ? " " : v) + "
' + l.getSubGrid().printView() + "
' + this.rowsCol[A]._expanded.innerHTML + "
"; + if (this.parentGrid) { + return o; + } + o += e || ""; + var E = window.open("", "_blank"); + E.document.write(o); + E.document.write(""); + E.document.close(); + if (this._fake) { + this._hrrar = C; + } +}; +dhtmlXGridObject.prototype._printWidth = function () { + var h = []; + var g = 0; + for (var e = 0; e < this._cCount; e++) { + var a = this.getColWidth(e); + h.push(a); + g += a; + } + var l = []; + var c = 0; + for (var e = 0; e < h.length; e++) { + var j = Math.floor((h[e] / g) * 100); + c += j; + l.push(j); + } + l[l.length - 1] += 100 - c; + return l; +}; +dhtmlXGridObject.prototype.enableBlockSelection = function (e) { + if (typeof this._bs_mode == "undefined") { + var a = this; + this.obj.onmousedown = function (g) { + if (a._bs_mode) { + a._OnSelectionStart(g || event, this); + } + return true; + }; + this._CSVRowDelimiter = this.csv.row; + this.attachEvent("onResize", function () { + a._HideSelection(); + return true; + }); + this.attachEvent("onGridReconstructed", function () { + a._HideSelection(); + return true; + }); + this.attachEvent("onFilterEnd", this._HideSelection); + } + if (e === false) { + this._bs_mode = false; + return this._HideSelection(); + } else { + this._bs_mode = true; + } + if (!window.dhx4.isIPad) { + var c = (this._clip_area = document.createElement("textarea")); + c.style.cssText = "position:absolute; width:1px; height:1px; overflow:hidden; color:transparent; background-color:transparent; bottom:1px; right:1px; border:none;"; + c.onkeydown = function (g) { + g = g || event; + if (g.keyCode == 86 && (g.ctrlKey || g.metaKey)) { + a.pasteBlockFromClipboard(); + } + }; + document.body.insertBefore(this._clip_area, document.body.firstChild); + dhtmlxEvent(this.entBox, "click", function () { + if (!a.editor && a._clip_area) { + a._clip_area.select(); + } + }); + } +}; +dhtmlXGridObject.prototype.forceLabelSelection = function (a) { + this._strictText = dhx4.s2b(a); +}; +dhtmlXGridObject.prototype._OnSelectionStart = function (e, g) { + var c = this; + if (e.button == 2) { + return; + } + var h = e.srcElement || e.target; + if (this.editor) { + if (h.tagName && (h.tagName == "INPUT" || h.tagName == "TEXTAREA")) { + return; + } + this.editStop(); + } + c.setActive(true); + var l = this.getPosition(this.obj); + var a = e.clientX - l[0] + (document.body.scrollLeft || (document.documentElement ? document.documentElement.scrollLeft : 0)); + var j = e.clientY - l[1] + (document.body.scrollTop || (document.documentElement ? document.documentElement.scrollTop : 0)); + this._CreateSelection(a - 4, j - 4); + if (h == this._selectionObj) { + this._HideSelection(); + this._startSelectionCell = null; + } else { + while (h && (!h.tagName || h.tagName.toLowerCase() != "td")) { + h = h.parentNode; + } + this._startSelectionCell = h; + } + if (this._startSelectionCell) { + if (!this.callEvent("onBeforeBlockSelected", [this._startSelectionCell.parentNode.idd, this._startSelectionCell._cellIndex])) { + return (this._startSelectionCell = null); + } + } + this.obj.onmousedown = null; + this.obj[_isIE ? "onmouseleave" : "onmouseout"] = function (m) { + if (c._blsTimer) { + window.clearTimeout(c._blsTimer); + } + }; + this.obj.onmmold = this.obj.onmousemove; + this._init_pos = [a, j]; + this._selectionObj.onmousemove = this.obj.onmousemove = function (m) { + m = m || e; + if (m.preventDefault) { + m.preventDefault(); + } else { + m.returnValue = false; + } + c._OnSelectionMove(m); + }; + this._oldDMP = document.body.onmouseup; + document.body.onmouseup = function (m) { + m = m || e; + c._OnSelectionStop(m, this); + return true; + }; + this.callEvent("onBeforeBlockSelection", []); + document.body.onselectstart = function () { + return false; + }; +}; +dhtmlXGridObject.prototype._getCellByPos = function (a, g) { + a = a; + if (this._fake) { + a += this._fake.objBox.scrollWidth; + } + g = g; + var c = 0; + for (var e = 0; e < this.obj.rows.length; e++) { + g -= this.obj.rows[e].offsetHeight; + if (g <= 0) { + c = this.obj.rows[e]; + break; + } + } + if (!c || !c.idd) { + return null; + } + for (var e = 0; e < this._cCount; e++) { + a -= this.getColWidth(e); + if (a <= 0) { + while (true) { + if (c._childIndexes && c._childIndexes[e + 1] == c._childIndexes[e]) { + c = c.previousSibling; + } else { + return this.cells(c.idd, e).cell; + } + } + } + } + return null; +}; +dhtmlXGridObject.prototype._OnSelectionMove = function (g) { + var w = this; + this._ShowSelection(); + var r = this.getPosition(this.obj); + var l = g.clientX - r[0] + (document.body.scrollLeft || (document.documentElement ? document.documentElement.scrollLeft : 0)); + var j = g.clientY - r[1] + (document.body.scrollTop || (document.documentElement ? document.documentElement.scrollTop : 0)); + if (Math.abs(this._init_pos[0] - l) < 5 && Math.abs(this._init_pos[1] - j) < 5) { + return this._HideSelection(); + } + var u = this._endSelectionCell; + if (this._startSelectionCell == null) { + this._endSelectionCell = this._startSelectionCell = this.getFirstParentOfType(g.srcElement || g.target, "TD"); + } else { + if (g.srcElement || g.target) { + if ((g.srcElement || g.target).className == "dhtmlxGrid_selection") { + this._endSelectionCell = this._getCellByPos(l, j) || this._endSelectionCell; + } else { + var v = this.getFirstParentOfType(g.srcElement || g.target, "TD"); + if (v.parentNode.idd) { + this._endSelectionCell = v; + } + } + } + } + if (this._endSelectionCell) { + if (!this.callEvent("onBeforeBlockSelected", [this._endSelectionCell.parentNode.idd, this._endSelectionCell._cellIndex])) { + this._endSelectionCell = u; + } + } + var h = this.objBox.scrollLeft + this.objBox.clientWidth; + var c = this.objBox.scrollTop + this.objBox.clientHeight; + var n = this.objBox.scrollLeft; + var m = this.objBox.scrollTop; + var e = false; + if (this._blsTimer) { + window.clearTimeout(this._blsTimer); + } + if (l + 20 >= h) { + this.objBox.scrollLeft = this.objBox.scrollLeft + 20; + e = true; + } else { + if (l - 20 < n) { + this.objBox.scrollLeft = this.objBox.scrollLeft - 20; + e = true; + } + } + if (j + 20 >= c && !this._realfake) { + this.objBox.scrollTop = this.objBox.scrollTop + 20; + e = true; + } else { + if (j - 20 < m && !this._realfake) { + this.objBox.scrollTop = this.objBox.scrollTop - 20; + e = true; + } + } + this._selectionArea = this._RedrawSelectionPos(this._startSelectionCell, this._endSelectionCell); + if (e) { + var s = g.clientX; + var o = g.clientY; + this._blsTimer = window.setTimeout(function () { + w._OnSelectionMove({ clientX: s, clientY: o }); + }, 100); + } +}; +dhtmlXGridObject.prototype._OnSelectionStop = function (c) { + var a = this; + if (this._blsTimer) { + window.clearTimeout(this._blsTimer); + } + this.obj.onmousedown = function (g) { + if (a._bs_mode) { + a._OnSelectionStart(g || c, this); + } + return true; + }; + this.obj.onmousemove = this.obj.onmmold || null; + this._selectionObj.onmousemove = null; + document.body.onmouseup = this._oldDMP || null; + if (parseInt(this._selectionObj.style.width) < 2 && parseInt(this._selectionObj.style.height) < 2) { + this._HideSelection(); + } else { + var e = this.getFirstParentOfType(c.srcElement || c.target, "TD"); + if (!e || !e.parentNode.idd) { + e = this._endSelectionCell; + } + while (e && (!e.tagName || e.tagName.toLowerCase() != "td")) { + e = e.parentNode; + } + if (!e) { + return this._HideSelection(); + } + this._stopSelectionCell = e; + this._selectionArea = this._RedrawSelectionPos(this._startSelectionCell, this._stopSelectionCell); + this.callEvent("onBlockSelected", []); + } + document.body.onselectstart = function () {}; +}; +dhtmlXGridObject.prototype._RedrawSelectionPos = function (s, l) { + if (s.parentNode.grid != l.parentNode.grid) { + return this._selectionArea; + } + var o = {}; + o.LeftTopCol = s._cellIndex; + o.LeftTopRow = this.getRowIndex(s.parentNode.idd); + o.RightBottomCol = l._cellIndex; + o.RightBottomRow = this.getRowIndex(l.parentNode.idd); + var g = s.offsetWidth; + var e = s.offsetHeight; + s = this.getPosition(s, this.obj); + var u = l.offsetWidth; + var m = l.offsetHeight; + l = this.getPosition(l, this.obj); + if (s[0] < l[0]) { + var h = s[0]; + var j = l[0] + u; + } else { + var n = o.RightBottomCol; + o.RightBottomCol = o.LeftTopCol; + o.LeftTopCol = n; + var h = l[0]; + var j = s[0] + g; + } + if (s[1] < l[1]) { + var r = s[1]; + var a = l[1] + m; + } else { + var n = o.RightBottomRow; + o.RightBottomRow = o.LeftTopRow; + o.LeftTopRow = n; + var r = l[1]; + var a = s[1] + e; + } + var v = j - h; + var c = a - r; + this._selectionObj.style.left = h + "px"; + this._selectionObj.style.top = r + "px"; + this._selectionObj.style.width = v + "px"; + this._selectionObj.style.height = c + "px"; + return o; +}; +dhtmlXGridObject.prototype._CreateSelection = function (a, e) { + if (this._selectionObj == null) { + var c = document.createElement("div"); + c.style.position = "absolute"; + c.style.display = "none"; + c.className = "dhtmlxGrid_selection"; + this._selectionObj = c; + this._selectionObj.onmousedown = function (g) { + g = g || event; + if (g.button == 2 || (_isMacOS && g.ctrlKey)) { + return this.parentNode.grid.callEvent("onBlockRightClick", ["BLOCK", g]); + } + }; + this._selectionObj.oncontextmenu = function (g) { + (g || event).cancelBubble = true; + return false; + }; + this.objBox.appendChild(this._selectionObj); + } + this._selectionObj.style.width = "0px"; + this._selectionObj.style.height = "0px"; + this._selectionObj.style.left = a + "px"; + this._selectionObj.style.top = e + "px"; + this._selectionObj.startX = a; + this._selectionObj.startY = e; +}; +dhtmlXGridObject.prototype._ShowSelection = function () { + if (this._selectionObj) { + this._selectionObj.style.display = ""; + } +}; +dhtmlXGridObject.prototype._HideSelection = function () { + if (this._selectionObj) { + this._selectionObj.style.display = "none"; + } + this._selectionArea = null; + if (this._clip_area) { + this._clip_area.value = ""; + this._clip_area.blur(); + } +}; +dhtmlXGridObject.prototype.copyBlockToClipboard = function () { + if (!this._clip_area) { + return; + } + if (this._selectionArea != null) { + var e = new Array(); + if (this._mathSerialization) { + this._agetm = "getMathValue"; + } else { + if (this._strictText) { + this._agetm = "getTitle"; + } else { + this._agetm = "getValue"; + } + } + this._serialize_visible = true; + for (var a = this._selectionArea.LeftTopRow; a <= this._selectionArea.RightBottomRow; a++) { + var c = this._serializeRowToCVS(this.rowsBuffer[a], null, this._selectionArea.LeftTopCol, this._selectionArea.RightBottomCol + 1); + if (!this._csvAID) { + e[e.length] = c.substr(c.indexOf(this.csv.cell) + 1); + } else { + e[e.length] = c; + } + } + e = e.join(this._CSVRowDelimiter); + this._clip_area.value = e; + this._clip_area.select(); + this._serialize_visible = false; + } +}; +dhtmlXGridObject.prototype.pasteBlockFromClipboard = function () { + if (!this._clip_area) { + return; + } + this._clip_area.select(); + var a = this; + window.setTimeout(function () { + a._pasteBlockFromClipboard(); + a = null; + }, 1); +}; +dhtmlXGridObject.prototype._pasteBlockFromClipboard = function () { + var m = this._clip_area.value; + if (!m) { + return; + } + if (this._selectionArea != null) { + var w = this._selectionArea.LeftTopRow; + var a = this._selectionArea.LeftTopCol; + } else { + if (this.cell != null && !this.editor) { + var w = this.getRowIndex(this.cell.parentNode.idd); + var a = this.cell._cellIndex; + } else { + return false; + } + } + m = this.csvParser.unblock(m, this.csv.cell, this.csv.row); + var o = w + m.length; + var u = a + m[0].length; + if (u > this._cCount) { + u = this._cCount; + } + var g = 0; + for (var r = w; r < o; r++) { + var x = this.render_row(r); + if (x == -1) { + continue; + } + var e = 0; + for (var h = a; h < u; h++) { + if (this._hrrar[h] && !this._fake) { + u = Math.min(u + 1, this._cCount); + continue; + } + var s = this.cells3(x, h); + if (s.isDisabled()) { + e++; + continue; + } + if (this._onEditUndoRedo) { + this._onEditUndoRedo(2, x.idd, h, m[g][e], s.getValue()); + } + if (s.combo) { + var v = s.combo.values; + for (var c = 0; c < v.length; c++) { + if (m[g][e] == v[c]) { + s.setValue(s.combo.keys[c]); + v = null; + break; + } + } + if (v != null && s.editable) { + s.setValue(m[g][e++]); + } else { + e++; + } + } else { + s[s.setImage ? "setLabel" : "setValue"](m[g][e++]); + } + s.cell.wasChanged = true; + } + this.callEvent("onRowPaste", [x.idd]); + g++; + } +}; +dhtmlXGridObject.prototype.getSelectedBlock = function () { + if (this._selectionArea) { + return this._selectionArea; + } else { + if (this.getSelectedRowId() !== null) { + return { LeftTopRow: this.getSelectedRowId(), LeftTopCol: this.getSelectedCellIndex(), RightBottomRow: this.getSelectedRowId(), RightBottomCol: this.getSelectedCellIndex() }; + } else { + return null; + } + } +}; +dhtmlXGridObject.prototype.enableSmartRendering = function (e, c, a) { + if (arguments.length > 2) { + if (c && !this.rowsBuffer[c - 1]) { + this.rowsBuffer[c - 1] = 0; + } + c = a; + } + this._srnd = dhx4.s2b(e); + this._srdh = this._srdh || 20; + this._dpref = c || 0; +}; +dhtmlXGridObject.prototype.enablePreRendering = function (a) { + this._srnd_pr = parseInt(a || 50); +}; +dhtmlXGridObject.prototype.forceFullLoading = function (a, h) { + for (var e = 0; e < this.rowsBuffer.length; e++) { + if (!this.rowsBuffer[e]) { + var g = a || this.rowsBuffer.length - e; + if (this.callEvent("onDynXLS", [e, g])) { + var c = this; + this.load( + this.xmlFileUrl + dhtmlx.url(this.xmlFileUrl) + "posStart=" + e + "&count=" + g, + function () { + window.setTimeout(function () { + c.forceFullLoading(a, h); + }, 100); + }, + this._data_type + ); + } + return; + } + } + if (h) { + h.call(this); + } +}; +dhtmlXGridObject.prototype.setAwaitedRowHeight = function (a) { + this._srdh = parseInt(a); +}; +dhtmlXGridObject.prototype._get_view_size = function () { + return Math.floor(parseInt(this.entBox.offsetHeight) / this._srdh) + 2; +}; +dhtmlXGridObject.prototype._add_filler = function (l, a, c, g) { + if (!a) { + return null; + } + var j = "__filler__"; + var h = this._prepareRow(j); + h.firstChild.style.width = "1px"; + h.firstChild.style.borderWidth = h.firstChild.style.padding = h.firstChild.style.margin = "0px"; + for (var e = 1; e < h.childNodes.length; e++) { + h.childNodes[e].style.display = "none"; + } + h.firstChild.style.height = a * this._srdh + "px"; + c = c || this.rowsCol[l]; + if (c && c.nextSibling) { + c.parentNode.insertBefore(h, c.nextSibling); + } else { + if (_isKHTML) { + this.obj.appendChild(h); + } else { + this.obj.rows[0].parentNode.appendChild(h); + } + } + this.callEvent("onAddFiller", [l, a, h, c, g]); + return [l, a, h]; +}; +dhtmlXGridObject.prototype._update_srnd_view = function () { + var l = Math.floor(this.objBox.scrollTop / this._srdh); + var c = l + this._get_view_size(); + if (this.multiLine) { + var m = this.objBox.scrollTop; + l = 0; + while (m > 0) { + m -= this.rowsCol[l] ? this.rowsCol[l].offsetHeight : this._srdh; + l++; + } + c = l + this._get_view_size(); + if (l > 0) { + l--; + } + } + c += this._srnd_pr || 0; + if (c > this.rowsBuffer.length) { + c = this.rowsBuffer.length; + } + for (var g = l; g < c; g++) { + if (!this.rowsCol[g]) { + var h = this._add_from_buffer(g); + if (h == -1) { + if (this.xmlFileUrl) { + if (this._dpref && this.rowsBuffer[c - 1]) { + var e = this._dpref ? this._dpref : c - g; + var a = Math.max(0, Math.min(g, c - this._dpref)); + this._current_load = [a, c - a]; + } else { + this._current_load = [g, this._dpref ? this._dpref : c - g]; + } + if (this.callEvent("onDynXLS", this._current_load)) { + this.load(this.xmlFileUrl + dhtmlx.url(this.xmlFileUrl) + "posStart=" + this._current_load[0] + "&count=" + this._current_load[1], this._data_type); + } + } + return; + } else { + if (this._tgle) { + this._updateLine(this._h2.get[this.rowsBuffer[g].idd], this.rowsBuffer[g]); + this._updateParentLine(this._h2.get[this.rowsBuffer[g].idd], this.rowsBuffer[g]); + } + if (g && g == (this._realfake ? this._fake : this)["_r_select"]) { + this.selectCell(g, this.cell ? this.cell._cellIndex : 0, true); + } + } + } + } + if (this._fake && !this._realfake && this.multiLine) { + this._fake.objBox.scrollTop = this.objBox.scrollTop; + } +}; +dhtmlXGridObject.prototype._add_from_buffer = function (g) { + var h = this.render_row(g); + if (h == -1) { + return -1; + } + if (h._attrs.selected || h._attrs.select) { + this.selectRow(h, false, true); + h._attrs.selected = h._attrs.select = null; + } + if (!this._cssSP) { + if (this._cssEven && g % 2 == 0) { + h.className = this._cssEven + (h.className.indexOf("rowselected") != -1 ? " rowselected " : " ") + (h._css || ""); + } else { + if (this._cssUnEven && g % 2 == 1) { + h.className = this._cssUnEven + (h.className.indexOf("rowselected") != -1 ? " rowselected " : " ") + (h._css || ""); + } + } + } else { + if (this._h2) { + var a = this._h2.get[h.idd]; + h.className += " " + (a.level % 2 ? this._cssUnEven + " " + this._cssUnEven : this._cssEven + " " + this._cssEven) + "_" + a.level + (this.rowsAr[a.id]._css || ""); + } + } + for (var c = 0; c < this._fillers.length; c++) { + var e = this._fillers[c]; + if (e && e[0] <= g && e[0] + e[1] > g) { + var j = g - e[0]; + if (j == 0) { + this._insert_before(g, h, e[2]); + this._update_fillers(c, -1, 1); + } else { + if (j == e[1] - 1) { + this._insert_after(g, h, e[2]); + this._update_fillers(c, -1, 0); + } else { + this._fillers.push(this._add_filler(g + 1, e[1] - j - 1, e[2], 1)); + this._insert_after(g, h, e[2]); + this._update_fillers(c, -e[1] + j, 0); + } + } + return; + } + } +}; +dhtmlXGridObject.prototype._update_fillers = function (e, a, g) { + var c = this._fillers[e]; + c[1] = c[1] + a; + c[0] = c[0] + g; + if (!c[1]) { + this.callEvent("onRemoveFiller", [c[2]]); + c[2].parentNode.removeChild(c[2]); + this._fillers.splice(e, 1); + } else { + c[2].firstChild.style.height = parseFloat(c[2].firstChild.style.height) + a * this._srdh + "px"; + this.callEvent("onUpdateFiller", [c[2]]); + } +}; +dhtmlXGridObject.prototype._insert_before = function (c, e, a) { + a.parentNode.insertBefore(e, a); + this.rowsCol[c] = e; + this.callEvent("onRowInserted", [e, null, a, "before"]); +}; +dhtmlXGridObject.prototype._insert_after = function (c, e, a) { + if (a.nextSibling) { + a.parentNode.insertBefore(e, a.nextSibling); + } else { + a.parentNode.appendChild(e); + } + this.rowsCol[c] = e; + this.callEvent("onRowInserted", [e, null, a, "after"]); +}; +if (typeof window.dhtmlxValidation != "undefined") { + dhtmlxValidation.trackInput = function (e, g, c, a) { + dhtmlxEvent(e, "keyup", function (h) { + if (dhtmlxValidation._timer) { + window.clearTimeout(dhtmlxValidation._timer); + dhtmlxValidation._timer = null; + } + dhtmlxValidation._timer = window.setTimeout(function () { + if (!dhtmlxValidation.checkInput(e, g)) { + if (!c || c(e, e.value, g)) { + e.className += " dhtmlx_live_validation_error"; + } + } else { + e.className = e.className.replace(/[ ]*dhtmlx_live_validation_error/g, ""); + if (a) { + a(e, e.value, g); + } + } + }, 250); + }); + }; + dhtmlxValidation.checkInput = function (a, c) { + return dhtmlxValidation.checkValue(a.value, c); + }; + dhtmlxValidation.checkValue = function (e, g) { + if (typeof g == "string") { + g = g.split(","); + } + var a = true; + for (var c = 0; c < g.length; c++) { + if (!this["is" + g[c]]) { + alert("Incorrect validation rule: " + g[c]); + } else { + a = a && this["is" + g[c]](e); + } + } + return a; + }; +} +dhtmlXGridObject.prototype.enableValidation = function (c, a) { + c = dhx4.s2b(c); + if (c) { + this._validators = { data: [] }; + } else { + this._validators = false; + } + if (arguments.length > 1) { + this._validators._live = a; + } + if (!this._validators._event) { + this._validators._event = this.attachEvent("onEditCell", this.validationEvent); + } +}; +dhtmlXGridObject.prototype.setColValidators = function (a) { + if (!this._validators) { + this.enableValidation(true); + } + if (typeof a == "string") { + a = a.split(this.delim); + } + this._validators.data = a; +}; +dhtmlXGridObject.prototype.validationEvent = function (j, c, g, e, m) { + var n = this._validators; + if (!n) { + return true; + } + var l = n.data[g] || this.cells(c, g).getAttribute("validate") || ""; + if (j == 1 && l) { + var h = this.editor || (this._fake || {}).editor; + if (!h) { + return true; + } + h.cell.className = h.cell.className.replace(/[ ]*dhtmlx_validation_error/g, ""); + if (n._live) { + var a = this; + dhtmlxValidation.trackInput( + h.getInput(), + l, + function (o, r, s) { + return a.callEvent("onLiveValidationError", [c, g, r, o, s]); + }, + function (o, r, s) { + return a.callEvent("onLiveValidationCorrect", [c, g, r, o, s]); + } + ); + } + } + if (j == 2) { + this.validateCell(c, g, l, e); + } + return true; +}; +dhtmlXGridObject.prototype.validateCell = function (l, h, j, g) { + j = j || this._validators.data[h] || this.cells(l, h).getAttribute("validate"); + g = g || this.cells(l, h).getValue(); + if (!j) { + return; + } + var c = this.cells(l, h).cell; + var a = true; + if (typeof j == "string") { + j = j.split(this.delim); + } + for (var e = 0; e < j.length; e++) { + if (!dhtmlxValidation.checkValue(g, j[e])) { + if (this.callEvent("onValidationError", [l, h, g, j[e]])) { + c.className += " dhtmlx_validation_error"; + } + a = false; + } + } + if (a) { + this.callEvent("onValidationCorrect", [l, h, g, j]); + c.className = c.className.replace(/[ ]*dhtmlx_validation_error/g, ""); + } + return a; +}; +function eXcell_stree(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + if (!this.grid._sub_trees) { + return; + } + this._sub = this.grid._sub_trees[a._cellIndex]; + if (!this._sub) { + return; + } + this._sub = this._sub[0]; + } + this.getValue = function () { + return this.cell._val; + }; + this.setValue = function (c) { + this.cell._val = c; + c = this._sub.getItemText(this.cell._val); + this.setCValue(c || " ", c); + }; + this.edit = function () { + this._sub.parentObject.style.display = "block"; + var e = this.grid.getPosition(this.cell); + this._sub.parentObject.style.top = e[1] + "px"; + this._sub.parentObject.style.left = e[0] + "px"; + this._sub.parentObject.style.position = "absolute"; + var c = this.grid.editStop; + this.grid.editStop = function () {}; + this.grid.editStop = c; + }; + this.detach = function () { + this._sub.parentObject.style.display = "none"; + if (this.grid._sub_id != null) { + var c = this.cell._val; + this.setValue(this._sub.getSelectedItemId()); + this.grid._sub_id = null; + return this.cell._val != c; + } + }; +} +eXcell_stree.prototype = new eXcell(); +dhtmlXGridObject.prototype.setSubTree = function (a, c) { + if (!this._sub_trees) { + this._sub_trees = []; + } + this._sub_trees[c] = [a]; + a.parentObject.style.display = "none"; + var e = this; + a.parentObject.onclick = function (g) { + (g || window.event).cancelBubble = true; + return false; + }; + a.ev_onDblClick = null; + a.attachEvent("onDblClick", function (g) { + e._sub_id = g; + e.editStop(); + return true; + }); + a._chRRS = true; +}; +function eXcell_link(a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + this.isDisabled = function () { + return true; + }; + this.edit = function () {}; + this.getValue = function () { + if (this.cell.firstChild.getAttribute) { + var c = this.cell.firstChild.getAttribute("target"); + return this.cell.firstChild.innerHTML + "^" + this.cell.firstChild.getAttribute("href") + (c ? "^" + c : ""); + } else { + return ""; + } + }; + this.setValue = function (e) { + if (typeof e != "number" && (!e || e.toString()._dhx_trim() == "")) { + this.setCValue(" ", c); + return (this.cell._clearCell = true); + } + var c = e.split("^"); + if (c.length == 1) { + c[1] = ""; + } else { + if (c.length > 1) { + c[1] = "href='" + c[1] + "'"; + if (c.length == 3) { + c[1] += " target='" + c[2] + "'"; + } else { + c[1] += " target='_blank'"; + } + } + } + this.setCValue("" + c[0] + "", c); + }; +} +eXcell_link.prototype = new eXcell(); +eXcell_link.prototype.getTitle = function () { + var a = this.cell.firstChild; + return a && a.tagName ? a.getAttribute("href") : ""; +}; +eXcell_link.prototype.getContent = function () { + var a = this.cell.firstChild; + return a && a.tagName ? a.innerHTML : ""; +}; +function eXcell_grid(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + if (!this.grid._sub_grids) { + return; + } + this._sub = this.grid._sub_grids[a._cellIndex]; + if (!this._sub) { + return; + } + this._sindex = this._sub[1]; + this._sub = this._sub[0]; + } + this.getValue = function () { + return this.cell.val; + }; + this.setValue = function (c) { + this.cell.val = c; + if (this._sub.getRowById(c)) { + c = this._sub.cells(c, this._sindex); + if (c) { + c = c.getValue(); + } else { + c = ""; + } + } + this.setCValue(c || " ", c); + }; + this.edit = function () { + this.val = this.cell.val; + this._sub.entBox.style.display = "block"; + var e = this.grid.getPosition(this.cell); + this._sub.entBox.style.top = e[1] + "px"; + this._sub.entBox.style.left = e[0] + "px"; + this._sub.entBox.style.position = "absolute"; + this._sub.setSizes(); + var c = this.grid.editStop; + this.grid.editStop = function () {}; + if (this._sub.getRowById(this.cell.val)) { + this._sub.setSelectedRow(this.cell.val); + } + this._sub.setActive(true); + this.grid.editStop = c; + }; + this.detach = function () { + var c = this.cell.val; + this._sub.entBox.style.display = "none"; + if (this._sub.getSelectedId() === null) { + return false; + } + this.setValue(this._sub.getSelectedId()); + this.grid.setActive(true); + return this.cell.val != c; + }; +} +eXcell_grid.prototype = new eXcell(); +dhtmlXGridObject.prototype.setSubGrid = function (c, a, g) { + if (!this._sub_grids) { + this._sub_grids = []; + } + this._sub_grids[a] = [c, g]; + c.entBox.style.display = "none"; + var e = this; + c.entBox.onclick = function (h) { + (h || window.event).cancelBubble = true; + return false; + }; + c.attachEvent("onRowSelect", function (h) { + e.editStop(); + return true; + }); + c._chRRS = false; +}; +function eXcell_dhxCalendar(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + if (!this.grid._grid_calendarA) { + var e = (this.grid._grid_calendarA = new dhtmlxCalendarObject()); + this.grid.callEvent("onDhxCalendarCreated", [e]); + var c = this.grid; + e.attachEvent("onClick", function () { + this._last_operation_calendar = true; + window.setTimeout(function () { + c.editStop(); + }, 1); + return true; + }); + var g = function (h) { + (h || event).cancelBubble = true; + }; + dhtmlxEvent(e.base, "click", g); + e = null; + } + } +} +eXcell_dhxCalendar.prototype = new eXcell(); +eXcell_dhxCalendar.prototype.edit = function () { + var c = this.grid.getPosition(this.cell); + this.grid._grid_calendarA._show(false, false); + this.grid._grid_calendarA.setPosition(c[0], c[1] + this.cell.offsetHeight); + this.grid._grid_calendarA._last_operation_calendar = false; + this.grid.callEvent("onCalendarShow", [this.grid._grid_calendarA, this.cell.parentNode.idd, this.cell._cellIndex]); + this.cell._cediton = true; + this.val = this.cell.val; + this._val = this.cell.innerHTML; + var a = this.grid._grid_calendarA.draw; + this.grid._grid_calendarA.draw = function () {}; + this.grid._grid_calendarA.setDateFormat(this.grid._dtmask || "%d/%m/%Y"); + this.grid._grid_calendarA.setDate(this.val || new Date()); + this.grid._grid_calendarA.draw = a; +}; +eXcell_dhxCalendar.prototype.getDate = function () { + if (this.cell.val) { + return this.cell.val; + } + return null; +}; +eXcell_dhxCalendar.prototype.getValue = function () { + if (this.cell._clearCell) { + return ""; + } + if (this.grid._dtmask_inc && this.cell.val) { + return this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask_inc, this.cell.val).toString(); + } + return this.cell.innerHTML.toString()._dhx_trim(); +}; +eXcell_dhxCalendar.prototype.detach = function () { + if (!this.grid._grid_calendarA) { + return; + } + this.grid._grid_calendarA.hide(); + if (this.cell._cediton) { + this.cell._cediton = false; + } else { + return; + } + if (this.grid._grid_calendarA._last_operation_calendar) { + var e = this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask || "%d/%m/%Y"); + var c = this.grid._grid_calendarA.getDate(); + this.cell.val = new Date(c); + this.setCValue(e, c); + this.cell._clearCell = !e; + var a = this.val; + this.val = this._val; + return this.cell.val.valueOf() != (a || "").valueOf(); + } + return false; +}; +eXcell_dhxCalendar.prototype.setValue = function (a) { + if (a && typeof a == "object") { + this.cell.val = a; + this.cell._clearCell = false; + this.setCValue(this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask || "%d/%m/%Y", a).toString(), this.cell.val); + return; + } + if (!a || a.toString()._dhx_trim() == "") { + a = " "; + this.cell._clearCell = true; + this.cell.val = ""; + } else { + this.cell._clearCell = false; + this.cell.val = new Date(this.grid._grid_calendarA.setFormatedDate(this.grid._dtmask_inc || this.grid._dtmask || "%d/%m/%Y", a.toString(), null, true)); + if (this.grid._dtmask_inc) { + a = this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask || "%d/%m/%Y", this.cell.val); + } + } + if (this.cell.val == "NaN" || this.cell.val == "Invalid Date") { + this.cell._clearCell = true; + this.cell.val = new Date(); + this.setCValue(" ", 0); + } else { + this.setCValue((a || "").toString(), this.cell.val); + } +}; +function eXcell_dhxCalendarA(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + if (!this.grid._grid_calendarA) { + var e = (this.grid._grid_calendarA = new dhtmlxCalendarObject()); + this.grid.callEvent("onDhxCalendarCreated", [e]); + var c = this.grid; + e.attachEvent("onClick", function () { + this._last_operation_calendar = true; + window.setTimeout(function () { + c.editStop(); + }, 1); + return true; + }); + var g = function (h) { + (h || event).cancelBubble = true; + }; + dhtmlxEvent(e.base, "click", g); + } + } +} +eXcell_dhxCalendarA.prototype = new eXcell(); +eXcell_dhxCalendarA.prototype.edit = function () { + var c = this.grid.getPosition(this.cell); + this.grid._grid_calendarA._show(false, false); + this.grid._grid_calendarA.setPosition(c[0] * 1 + this.cell.offsetWidth, c[1] * 1); + this.grid.callEvent("onCalendarShow", [this.grid._grid_calendarA, this.cell.parentNode.idd, this.cell._cellIndex]); + this.grid._grid_calendarA._last_operation_calendar = false; + this.cell._cediton = true; + this.val = this.cell.val; + this._val = this.cell.innerHTML; + var a = this.grid._grid_calendarA.draw; + this.grid._grid_calendarA.draw = function () {}; + this.grid._grid_calendarA.setDateFormat(this.grid._dtmask || "%d/%m/%Y"); + this.grid._grid_calendarA.setDate(this.val); + this.grid._grid_calendarA.draw = a; + this.cell.atag = !this.grid.multiLine && (_isKHTML || _isMacOS || _isFF) ? "INPUT" : "TEXTAREA"; + this.obj = document.createElement(this.cell.atag); + this.obj.style.height = this.cell.offsetHeight - 4 + "px"; + this.obj.className = "dhx_combo_edit"; + this.obj.wrap = "soft"; + this.obj.style.textAlign = this.cell.align; + this.obj.onclick = function (g) { + (g || event).cancelBubble = true; + }; + this.obj.onmousedown = function (g) { + (g || event).cancelBubble = true; + }; + this.obj.value = this.getValue(); + this.cell.innerHTML = ""; + this.cell.appendChild(this.obj); + if (window.dhx4.isIE) { + this.obj.style.overflow = "visible"; + if (this.grid.multiLine && this.obj.offsetHeight >= 18 && this.obj.offsetHeight < 40) { + this.obj.style.height = "36px"; + this.obj.style.overflow = "scroll"; + } + } + this.obj.onselectstart = function (g) { + if (!g) { + g = event; + } + g.cancelBubble = true; + return true; + }; + this.obj.focus(); + this.obj.focus(); +}; +eXcell_dhxCalendarA.prototype.getDate = function () { + if (this.cell.val) { + return this.cell.val; + } + return null; +}; +eXcell_dhxCalendarA.prototype.getValue = function () { + if (this.cell._clearCell) { + return ""; + } + if (this.grid._dtmask_inc && this.cell.val) { + return this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask_inc, this.cell.val).toString(); + } + return this.cell.innerHTML.toString()._dhx_trim(); +}; +eXcell_dhxCalendarA.prototype.detach = function () { + if (!this.grid._grid_calendarA) { + return; + } + this.grid._grid_calendarA.hide(); + if (this.cell._cediton) { + this.cell._cediton = false; + } else { + return; + } + if (this.grid._grid_calendarA._last_operation_calendar) { + this.grid._grid_calendarA._last_operation_calendar = false; + var e = this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask || "%d/%m/%Y"); + var c = this.grid._grid_calendarA.getDate(); + this.cell.val = new Date(c); + this.setCValue(e, c); + this.cell._clearCell = !e; + var a = this.val; + this.val = this._val; + return this.cell.val.valueOf() != (a || "").valueOf(); + } + this.setValue(this.obj.value); + var a = this.val; + this.val = this._val; + return this.cell.val.valueOf() != (a || "").valueOf(); +}; +eXcell_dhxCalendarA.prototype.setValue = function (a) { + if (a && typeof a == "object") { + this.cell.val = a; + this.cell._clearCell = false; + this.setCValue(this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask || "%d/%m/%Y", a).toString(), this.cell.val); + return; + } + if (!a || a.toString()._dhx_trim() == "") { + a = " "; + this.cell._clearCell = true; + this.cell.val = ""; + } else { + this.cell._clearCell = false; + this.cell.val = new Date(this.grid._grid_calendarA.setFormatedDate(this.grid._dtmask_inc || this.grid._dtmask || "%d/%m/%Y", a.toString(), null, true)); + if (this.grid._dtmask_inc) { + a = this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask || "%d/%m/%Y", this.cell.val); + } + } + if (this.cell.val == "NaN" || this.cell.val == "Invalid Date") { + this.cell.val = new Date(); + this.cell._clearCell = true; + this.setCValue(" ", 0); + } else { + this.setCValue((a || "").toString(), this.cell.val); + } +}; +function eXcell_cntr(a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + if (!this.grid._ex_cntr_ready && !this._realfake) { + this.grid._ex_cntr_ready = true; + if (this.grid._h2) { + this.grid.attachEvent("onOpenEn", function (e) { + this.resetCounter(a._cellIndex); + }); + } + var c = function () { + var e = this; + window.setTimeout(function () { + if (!e.resetCounter) { + return; + } + if (e._fake && !e._realfake && a._cellIndex < e._fake._cCount) { + e._fake.resetCounter(a._cellIndex); + } else { + e.resetCounter(a._cellIndex); + } + }, 1); + return true; + }; + this.grid.attachEvent("onBeforeSorting", c); + this.grid.attachEvent("onFilterEnd", c); + } + this.edit = function () {}; + this.getValue = function () { + return this.cell.innerHTML; + }; + this.setValue = function (g) { + this.cell.style.paddingRight = "2px"; + var e = this.cell; + window.setTimeout(function () { + if (!e.parentNode) { + return; + } + var h = e.parentNode.rowIndex; + if (e.parentNode.grid.currentPage || h < 0 || e.parentNode.grid._srnd) { + h = e.parentNode.grid.rowsBuffer._dhx_find(e.parentNode) + 1; + } + if (h <= 0) { + return; + } + e.innerHTML = h; + if (e.parentNode.grid._fake && e._cellIndex < e.parentNode.grid._fake._cCount && e.parentNode.grid._fake.rowsAr[e.parentNode.idd]) { + e.parentNode.grid._fake.cells(e.parentNode.idd, e._cellIndex).setCValue(h); + } + e = null; + }, 100); + }; +} +dhtmlXGridObject.prototype.resetCounter = function (c) { + if (this._fake && !this._realfake && c < this._fake._cCount) { + this._fake.resetCounter(c, this.currentPage); + } + var a = arguments[0] || 0; + if (this.currentPage) { + a = (this.currentPage - 1) * this.rowsBufferOutSize; + } + for (a = 0; a < this.rowsBuffer.length; a++) { + if (this.rowsBuffer[a] && this.rowsBuffer[a].tagName == "TR" && this.rowsAr[this.rowsBuffer[a].idd]) { + this.rowsAr[this.rowsBuffer[a].idd].childNodes[c].innerHTML = a + 1; + } + } +}; +eXcell_cntr.prototype = new eXcell(); +function eXcell_acheck(a) { + try { + this.cell = a; + this.grid = this.cell.parentNode.grid; + this.cell.obj = this; + } catch (c) {} + this.changeState = function () { + if (!this.grid.isEditable || this.cell.parentNode._locked || this.isDisabled()) { + return; + } + if (this.grid.callEvent("onEditCell", [0, this.cell.parentNode.idd, this.cell._cellIndex]) != false) { + this.val = this.getValue(); + if (this.val == "1") { + this.setValue(""); + } else { + this.setValue(""); + } + this.cell.wasChanged = true; + this.grid.callEvent("onEditCell", [1, this.cell.parentNode.idd, this.cell._cellIndex]); + this.grid.callEvent("onCheck", [this.cell.parentNode.idd, this.cell._cellIndex, this.val != "1"]); + this.grid.callEvent("onCheckbox", [this.cell.parentNode.idd, this.cell._cellIndex, this.val != "1"]); + } else { + this.editor = null; + } + }; + this.getValue = function () { + try { + return this.cell.chstate.toString(); + } catch (e) { + return null; + } + }; + this.isCheckbox = function () { + return true; + }; + this.isChecked = function () { + if (this.getValue() == "1") { + return true; + } else { + return false; + } + }; + this.setChecked = function (e) { + this.setValue(e.toString()); + }; + this.detach = function () { + return this.val != this.getValue(); + }; + this.drawCurrentState = function () { + if (this.cell.chstate == 1) { + return "
 Yes
"; + } else { + return "
 No
"; + } + }; +} +eXcell_acheck.prototype = new eXcell(); +eXcell_acheck.prototype.setValue = function (c) { + c = (c || "").toString(); + if (c.indexOf("1") != -1 || c.indexOf("true") != -1) { + c = "1"; + this.cell.chstate = "1"; + } else { + c = "0"; + this.cell.chstate = "0"; + } + var a = this; + this.setCValue(this.drawCurrentState(), this.cell.chstate); +}; +function eXcell_context(a) { + if (a) { + this.cell = a; + this.grid = this.cell.parentNode.grid; + if (!this.grid._sub_context) { + return; + } + this._sub = this.grid._sub_context[a._cellIndex]; + if (!this._sub) { + return; + } + this._sindex = this._sub[1]; + this._sub = this._sub[0]; + } + this.getValue = function () { + return _isIE ? this.cell.innerText : this.cell.textContent; + }; + this.setValue = function (e) { + this.cell._val = e; + var c = this._sub.itemPull[this._sub.idPrefix + this.cell._val]; + e = c ? c.title : e; + this.setCValue(e || " ", e); + }; + this.edit = function () { + var e = this.grid.getPosition(this.cell); + this._sub.showContextMenu(e[0] + this.cell.offsetWidth, e[1]); + var c = this.grid.editStop; + this.grid.editStop = function () {}; + this.grid.editStop = c; + }; + this.detach = function () { + if (this.grid._sub_id != null) { + var c = this.cell._val; + this.setValue(this.grid._sub_id); + this.grid._sub_id = null; + return this.cell._val != c; + } + this._sub.hideContextMenu(); + }; +} +eXcell_context.prototype = new eXcell(); +dhtmlXGridObject.prototype.setSubContext = function (a, c, g) { + var e = this; + a.attachEvent("onClick", function (j, h) { + e._sub_id = j; + e.editStop(); + a.hideContextMenu(); + return true; + }); + if (!this._sub_context) { + this._sub_context = []; + } + this._sub_context[c] = [a, g]; + a.hideContextMenu(); +}; +function dhtmlXGridFromTable(obj, init) { + if (typeof obj != "object") { + obj = document.getElementById(obj); + } + var w = document.createElement("DIV"); + w.setAttribute("width", obj.getAttribute("gridWidth") || (obj.offsetWidth ? obj.offsetWidth + "px" : 0) || (window.getComputedStyle ? window.getComputedStyle(obj, null)["width"] : obj.currentStyle ? obj.currentStyle.width : 0)); + w.setAttribute("height", obj.getAttribute("gridHeight") || (obj.offsetHeight ? obj.offsetHeight + "px" : 0) || (window.getComputedStyle ? window.getComputedStyle(obj, null)["height"] : obj.currentStyle ? obj.currentStyle.height : 0)); + w.className = obj.className; + obj.className = ""; + if (obj.id) { + w.id = obj.id; + } + var mr = obj; + var drag = obj.getAttribute("dragAndDrop"); + mr.parentNode.insertBefore(w, mr); + var f = mr.getAttribute("name") || "name_" + new Date().valueOf(); + var windowf = new dhtmlXGridObject(w); + window[f] = windowf; + var acs = mr.getAttribute("onbeforeinit"); + var acs2 = mr.getAttribute("oninit"); + if (acs) { + eval(acs); + } + windowf.setImagePath(windowf.imgURL || mr.getAttribute("imgpath") || mr.getAttribute("image_path") || ""); + var skin = mr.getAttribute("skin"); + if (skin) { + windowf.setSkin(skin); + } + if (init) { + init(windowf); + } + var hrow = mr.rows[0]; + var za = ""; + var zb = ""; + var zc = ""; + var zd = ""; + var ze = ""; + for (var i = 0; i < hrow.cells.length; i++) { + za += (za ? "," : "") + hrow.cells[i].innerHTML; + var width = hrow.cells[i].getAttribute("width") || hrow.cells[i].offsetWidth || (window.getComputedStyle ? window.getComputedStyle(hrow.cells[i], null)["width"] : hrow.cells[i].currentStyle ? hrow.cells[i].currentStyle.width : 0); + zb += (zb ? "," : "") + (width == "*" ? width : parseInt(width)); + zc += (zc ? "," : "") + (hrow.cells[i].getAttribute("align") || "left"); + zd += (zd ? "," : "") + (hrow.cells[i].getAttribute("type") || "ed"); + ze += (ze ? "," : "") + (hrow.cells[i].getAttribute("sort") || "str"); + var f_a = hrow.cells[i].getAttribute("format"); + if (f_a) { + if (hrow.cells[i].getAttribute("type").toLowerCase().indexOf("calendar") != -1) { + windowf._dtmask = f_a; + } else { + windowf.setNumberFormat(f_a, i); + } + } + } + windowf.setHeader(za); + windowf.setInitWidths(zb); + windowf.setColAlign(zc); + windowf.setColTypes(zd); + windowf.setColSorting(ze); + if (obj.getAttribute("gridHeight") == "auto") { + windowf.enableAutoHeigth(true); + } + if (obj.getAttribute("multiline")) { + windowf.enableMultiline(true); + } + var lmn = mr.getAttribute("lightnavigation"); + if (lmn) { + windowf.enableLightMouseNavigation(lmn); + } + var evr = mr.getAttribute("evenrow"); + var uevr = mr.getAttribute("unevenrow"); + if (evr || uevr) { + windowf.enableAlterCss(evr, uevr); + } + if (drag) { + windowf.enableDragAndDrop(true); + } + windowf.init(); + if (obj.getAttribute("split")) { + windowf.splitAt(obj.getAttribute("split")); + } + windowf._process_inner_html(mr, 1); + if (acs2) { + eval(acs2); + } + if (obj.parentNode && obj.parentNode.removeChild) { + obj.parentNode.removeChild(obj); + } + return windowf; +} +dhtmlXGridObject.prototype._process_html = function (c) { + if (c.tagName && c.tagName == "TABLE") { + return this._process_inner_html(c, 0); + } + var a = document.createElement("DIV"); + a.innerHTML = c.xmlDoc.responseText; + var e = a.getElementsByTagName("TABLE")[0]; + this._process_inner_html(e, 0); +}; +dhtmlXGridObject.prototype._process_inner_html = function (e, h) { + var c = e.rows.length; + for (var a = h; a < c; a++) { + var g = e.rows[a].getAttribute("id") || a; + this.rowsBuffer.push({ idd: g, data: e.rows[a], _parser: this._process_html_row, _locator: this._get_html_data }); + } + this.render_dataset(); + this.setSizes(); +}; +dhtmlXGridObject.prototype._process_html_row = function (n, h) { + var m = h.getElementsByTagName("TD"); + var c = []; + n._attrs = this._xml_attrs(h); + for (var g = 0; g < m.length; g++) { + var l = m[g]; + var a = l.getAttribute("type"); + if (n.childNodes[g]) { + if (a) { + n.childNodes[g]._cellType = a; + } + n.childNodes[g]._attrs = this._xml_attrs(m[g]); + } + if (l.firstChild) { + c.push(l.innerHTML); + } else { + c.push(""); + } + if (l.colSpan > 1) { + n.childNodes[g]._attrs.colspan = l.colSpan; + for (var e = 1; e < l.colSpan; e++) { + c.push(""); + } + } + } + for (g < m.length; g < n.childNodes.length; g++) { + n.childNodes[g]._attrs = {}; + } + this._fillRow(n, this._c_order ? this._swapColumns(c) : c); + return n; +}; +dhtmlXGridObject.prototype._get_html_data = function (c, a) { + c = c.firstChild; + while (true) { + if (!c) { + return ""; + } + if (c.tagName == "TD") { + a--; + } + if (a < 0) { + break; + } + c = c.nextSibling; + } + return c.firstChild ? c.firstChild.data : ""; +}; +dhtmlxEvent(window, "load", function () { + var e = document.getElementsByTagName("table"); + for (var c = 0; c < e.length; c++) { + if (e[c].className == "dhtmlxGrid") { + dhtmlXGridFromTable(e[c]); + } + } +}); +function dhtmlXForm(h, g, j) { + this.idef = { position: "label-left", labelWidth: "auto", labelHeight: "auto", inputWidth: "auto", inputHeight: "auto", labelAlign: "left", noteWidth: "auto", offsetTop: 0, offsetLeft: 0, blockOffset: 20 }; + this.idef_const = { offsetNested: 20 }; + this.apos_css = { "label-left": "dhxform_item_label_left", "label-right": "dhxform_item_label_right", "label-top": "dhxform_item_label_top", "label-bottom": "dhxform_item_label_bottom", absolute: "dhxform_item_absolute" }; + this.align_css = { left: "dhxform_label_align_left", center: "dhxform_label_align_center", right: "dhxform_label_align_right" }; + var e = this; + this.setSkin = function (a) { + this.skin = a; + this.cont.className = "dhxform_obj_" + this.skin; + this.cont.style.fontSize = a == "dhx_terrace" ? "13px" : "12px"; + this._updateBlocks(); + this.forEachItem(function (m) { + var l = e.getItemType(m); + if (typeof e.items[l] != "undefined" && typeof e.items[l].setSkin == "function") { + e.doWithItem(m, "setSkin", a); + } + }); + }; + this.skin = j || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhx_form") || "dhx_skyblue"; + this.separator = ","; + this.live_validate = false; + this._type = "checkbox"; + this._rGroup = "default"; + this._idIndex = {}; + this._indexId = []; + this.cont = typeof h == "object" ? h : document.getElementById(h); + if (!h._isNestedForm) { + this._parentForm = true; + this.cont.style.fontSize = this.skin == "dhx_terrace" ? "13px" : "12px"; + this.cont.className = "dhxform_obj_" + this.skin; + this.setFontSize = function (a) { + this.cont.style.fontSize = a; + this._updateBlocks(); + }; + this.getForm = function () { + return this; + }; + this.cont.onkeypress = function (l) { + l = l || event; + if (l.keyCode == 13) { + var a = l.target || l.srcElement; + if (typeof a.tagName != "undefined" && String(a.tagName).toLowerCase() == "textarea" && !l.ctrlKey) { + return; + } + e.callEvent("onEnter", []); + } + }; + } + this.b_index = null; + this.base = []; + this._prepare = function (s, u) { + if (this.b_index == null) { + this.b_index = 0; + } else { + this.b_index++; + } + var m = null; + var l = null; + if (u != null) { + if (u < 0) { + u = 0; + } + var o = 0; + for (var a = 0; a < this.cont.childNodes.length; a++) { + for (var r = 0; r < this.cont.childNodes[a].childNodes.length; r++) { + if (l == null && this.cont.childNodes[a].childNodes[r]._isNestedForm != true) { + if (o == u) { + m = this.cont.childNodes[a].nextSibling; + l = this.cont.childNodes[a].childNodes[r]; + } + o++; + } + } + } + } + this.base[this.b_index] = document.createElement("DIV"); + this.base[this.b_index].className = "dhxform_base"; + if (typeof s != "undefined") { + this.base[this.b_index].style.cssText += " margin-left:" + s + "px!important;"; + } + if (m != null) { + this.cont.insertBefore(this.base[this.b_index], m); + m = null; + } else { + this.cont.appendChild(this.base[this.b_index]); + } + if (l != null) { + while (l != null) { + var n = l; + l = l.nextSibling; + this.base[this.b_index].appendChild(n); + n = null; + } + } + }; + this.setSizes = function () {}; + this._mergeSettings = function (r) { + var m = -1; + var n = { type: "settings" }; + for (var l in this.idef) { + n[l] = this.idef[l]; + } + for (var o = 0; o < r.length; o++) { + if (typeof r[o] != "undefined" && r[o].type == "settings") { + for (var l in r[o]) { + n[l] = r[o][l]; + } + m = o; + } + } + r[m >= 0 ? m : r.length] = n; + return r; + }; + this._genStr = function (a) { + var l = "dhxId_"; + var n = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + for (var m = 0; m < a; m++) { + l += n.charAt(Math.floor(Math.random() * n.length)); + } + return l; + }; + this.idPrefix = "dhxForm_" + this._genStr(12) + "_"; + this._rId = this._parentForm ? this._genStr(12) + "_" : h._rId; + this.objPull = {}; + this.itemPull = {}; + this._ic = 0; + this._addItem = function (D, o, v, s, A, E, y) { + if (this.items[D]._index) { + this.getForm()._indexId.push(o); + this.getForm()._idIndex[o] = { ind: this.getForm()._indexId.length - 1 }; + } + if (!D) { + D = this._type; + } + if (D == "list" && A != null && this.itemPull[this.idPrefix + A] != null && typeof this.itemPull[this.idPrefix + A]._addSubListNode == "function") { + var C = this.itemPull[this.idPrefix + A]._addSubListNode(); + } else { + if (D == "newcolumn") { + var C = {}; + } else { + var r = this.base[this.b_index]; + var l = null; + if (typeof E != "undefined" && !isNaN(E) && D != "list") { + E = Math.max(parseInt(E), 0) + 1; + for (var H = 0; H < this.cont.childNodes.length; H++) { + for (var m = 0; m < this.cont.childNodes[H].childNodes.length; m++) { + if (l == null && this.cont.childNodes[H].childNodes[m]._isNestedForm != true) { + E--; + if (E == 0) { + l = this.cont.childNodes[H].childNodes[m]; + r = this.cont.childNodes[H]; + } + } + } + } + } else { + if (D == "list") { + for (var F in this.itemPull) { + if (F == this.idPrefix + o) { + l = this.itemPull[F].nextSibling; + if (this.itemPull[F]._listBase != null && this.itemPull[F]._listBase.length > 0) { + l = this.itemPull[F]._listBase[this.itemPull[F]._listBase.length - 1]; + } + } + } + } + } + var C = document.createElement("DIV"); + if (y == true && l != null) { + l = l.nextSibling; + } + if (l != null) { + r.insertBefore(C, l); + } else { + r.appendChild(C); + } + } + } + C._idd = o; + C._rId = this._rId; + if (typeof C.style != "undefined") { + if (typeof v.offsetLeft == "undefined" && this.idef.offsetLeft > 0) { + v.offsetLeft = this.idef.offsetLeft; + } + if (typeof v.offsetTop == "undefined" && this.idef.offsetTop > 0) { + v.offsetTop = this.idef.offsetTop; + } + var u = ""; + if (typeof v.offsetLeft != "undefined") { + u += " padding-left:" + v.offsetLeft + "px!important;"; + } + if (typeof v.offsetTop != "undefined") { + u += " padding-top:" + v.offsetTop + "px!important;"; + } + C.style.cssText += u; + } + if (D == "block") { + if (isNaN(v.blockOffset)) { + v.blockOffset = this.idef.blockOffset; + } + } + if (D == "list") { + if (typeof C._ofsNested == "undefined") { + C._ofsNested = this.idef_const.offsetNested; + } + if (s != null) { + C._sId = s; + } + var x = this.items[D].render(C, this.skin); + if (!this.itemPull[this.idPrefix + o]._listObj) { + this.itemPull[this.idPrefix + o]._listObj = []; + } + if (!this.itemPull[this.idPrefix + o]._list) { + this.itemPull[this.idPrefix + o]._list = []; + } + if (!this.itemPull[this.idPrefix + o]._listBase) { + this.itemPull[this.idPrefix + o]._listBase = []; + } + this.itemPull[this.idPrefix + o]._listObj.push(x[0]); + this.itemPull[this.idPrefix + o]._list.push(x[1]); + this.itemPull[this.idPrefix + o]._listBase.push(C); + x[1].checkEvent = function (a) { + return e.checkEvent(a); + }; + x[1].callEvent = function (a, w) { + return e.callEvent(a, w); + }; + x[1].getForm = function () { + return e.getForm(); + }; + x[1]._initObj(this._mergeSettings(v)); + if (C._inBlcok) { + C.className += " in_block"; + } + return x[1]; + } + if (D == "newcolumn") { + this._prepare(v.offset, E); + return; + } + if (D == "label" && this._ic++ == 0) { + v._isTopmost = true; + } + v.position = this.apos_css[!v.position || !this.apos_css[v.position] ? this.idef.position : v.position]; + C.className = v.position + (typeof v.className == "string" ? " " + v.className : ""); + if (!v.labelWidth) { + v.labelWidth = this.idef.labelWidth; + } + if (!v.labelHeight) { + v.labelHeight = this.idef.labelHeight; + } + if (typeof v.wrap != "undefined") { + v.wrap = window.dhx4.s2b(v.wrap); + } + v.labelAlign = this.align_css[v.labelAlign] ? this.align_css[v.labelAlign] : this.align_css[this.idef.labelAlign]; + v.inputWidth = v.width ? v.width : v.inputWidth ? v.inputWidth : this.idef.inputWidth; + if (!v.inputHeight) { + v.inputHeight = this.idef.inputHeight; + } + if (typeof v.note != "undefined") { + if (v.note.length != null && v.note[0] != null) { + v.note = v.note[0]; + } + if (typeof v.note.width == "undefined") { + v.note.width = this.idef.noteWidth; + } + if (v.note.width == "auto") { + v.note.width = v.inputWidth; + } + } + C.checkEvent = function (a) { + return e.checkEvent(a); + }; + C.callEvent = function (a, w) { + return e.callEvent(a, w); + }; + C.getForm = function () { + return e.getForm(); + }; + C._autoCheck = function (a) { + e._autoCheck(a); + }; + if (typeof v.readonly == "string") { + v.readonly = window.dhx4.s2b(v.readonly); + } + if (typeof v.autoStart == "string") { + v.autoStart = window.dhx4.s2b(v.autoStart); + } + if (typeof v.autoRemove == "string") { + v.autoRemove = window.dhx4.s2b(v.autoRemove); + } + if (typeof v.titleScreen == "string") { + v.titleScreen = window.dhx4.s2b(v.titleScreen); + } + if (typeof v.info == "string") { + v.info = window.dhx4.s2b(v.info); + } + if (typeof v.hidden == "string") { + v.hidden = window.dhx4.s2b(v.hidden); + } + if (typeof v.checked == "string") { + v.checked = window.dhx4.s2b(v.checked); + } + if (typeof v.userdata != "undefined") { + for (var F in v.userdata) { + this.getForm().setUserData(o, F, v.userdata[F]); + } + } + if (v.validate) { + if (typeof (v.validate != "undefined") && (typeof v.validate == "function" || typeof window[v.validate] == "function")) { + C._validate = [v.validate]; + } else { + C._validate = String(v.validate).split(this.separator); + } + } + if (typeof v.required != "undefined") { + if (typeof v.required == "string") { + v.required = window.dhx4.s2b(v.required); + } + C._required = v.required == true; + } + if (C._required) { + if (!C._validate) { + C._validate = []; + } + var n = false; + for (m = 0; m < C._validate.length; m++) { + n = n || C._validate[m] == "NotEmpty"; + } + if (!n) { + C._validate.push("NotEmpty"); + } + } + C._ll = v.position == this.apos_css["label-left"] || v.position == this.apos_css["label-top"]; + this.objPull[this.idPrefix + o] = this.items[D].render(C, v); + this.itemPull[this.idPrefix + o] = C; + }; + this._initObj = function (o, m) { + if (typeof o.data != "undefined") { + var r = null; + if (typeof m != "undefined") { + r = m.match(/(\?|\&)id\=([a-z0-9_\-]*)/i); + if (r != null && r[0] != null) { + r = r[0].split("=")[1]; + } + } + if (this.callEvent("onBeforeDataLoad", [r, window.dhx4._copyObj(o.data)]) === true) { + this.formId = r; + this._last_load_data = o; + this.setFormData(o.data); + this.resetDataProcessor("updated"); + } + return; + } + this._prepare(); + for (var n = 0; n < o.length; n++) { + if (typeof o[n] != "undefined" && o[n].type == "settings") { + for (var l in o[n]) { + this.idef[l] = o[n][l]; + } + } + } + for (var n = 0; n < o.length; n++) { + this._prepareItem(o[n]); + } + this._autoCheck(); + }; + this._prepareItem = function (o, u, n) { + var m = o != null && o.type != null ? o.type : ""; + if (this.items[m]) { + if (!o.name) { + o.name = this._genStr(12); + } + var s = o.name; + if (this.objPull[this.idPrefix + s] != null || m == "radio") { + s = this._genStr(12); + } + var r = o; + r.label = r.label || ""; + r.value = r.value; + r.checked = window.dhx4.s2b(r.checked); + r.disabled = window.dhx4.s2b(r.disabled); + r.name = r.name || this._genStr(12); + r.options = r.options || []; + r.rows = r.rows || "none"; + r.uid = this._genStr(12); + this._addItem(m, s, r, null, null, u, n); + u = null; + if (this._parentEnabled === false) { + this._disableItem(s); + } + for (var l = 0; l < r.options.length; l++) { + if (r.options[l].list != null) { + if (!r.options[l].value) { + r.options[l].value = this._genStr(); + } + var a = this._addItem("list", s, r.options[l].list, r.options[l].value, null); + a._subSelect = true; + a._subSelectId = r.options[l].value; + } + } + if (o.list != null) { + if (!o.listParent) { + o.listParent = r.name; + } + var a = this._addItem("list", s, o.list, null, o.listParent); + } + } + }; + this._xmlSubItems = { item: "list", option: "options", note: "note", userdata: "_userdata" }; + this._xmlToObject = function (A, l) { + if (typeof l == "undefined") { + l = true; + } + if (l) { + var D = A.getElementsByTagName("items"); + D = D != null && D[0] != null ? D[0] : null; + var m = A.getElementsByTagName("data"); + m = m != null && m[0] != null ? m[0] : null; + } else { + D = A; + } + var x = l ? [] : {}; + if (D != null) { + for (var o = 0; o < D.childNodes.length; o++) { + if (typeof D.childNodes[o].tagName != "undefined") { + var r = D.childNodes[o].tagName; + if (this._xmlSubItems[r] != null) { + var s = this._xmlSubItems[r]; + if (typeof x[s] == "undefined") { + x[s] = []; + } + var y = D.childNodes[o]; + var v = {}; + for (var I = 0; I < y.attributes.length; I++) { + var E = y.attributes[I].name; + var C = y.attributes[I].value; + v[E] = C; + } + if (s == "note") { + v.text = y.firstChild.nodeValue; + } + if (s == "_userdata") { + v.value = y.firstChild != null && y.firstChild.nodeValue != null ? y.firstChild.nodeValue : ""; + } + var u = this._xmlToObject(y, false); + for (var F in u) { + if (F == "_userdata") { + if (!v.userdata) { + v.userdata = {}; + } + for (var I = 0; I < u[F].length; I++) { + v.userdata[u[F][I].name] = u[F][I].value; + } + } else { + v[F] = u[F]; + } + } + y = null; + if (l) { + x.push(v); + } else { + x[s].push(v); + } + } + } + } + } + if (m != null) { + x = { data: {} }; + for (var o = 0; o < m.childNodes.length; o++) { + if (typeof m.childNodes[o].tagName != "undefined") { + var n = m.childNodes[o].tagName; + var H = m.childNodes[o].firstChild != null ? m.childNodes[o].firstChild.nodeValue : ""; + x.data[n] = H; + } + } + } + return x; + }; + this._autoCheck = function (r) { + if (this._locked === true) { + r = false; + } else { + if (typeof r == "undefined") { + r = true; + } + } + for (var n in this.itemPull) { + var s = r && this.itemPull[n]._udis !== true; + this[s ? "_enableItem" : "_disableItem"](this.itemPull[n]._idd); + if (this.getForm()._idIndex[this.itemPull[n]._idd] != null) { + this.getForm()._idIndex[this.itemPull[n]._idd].enabled = s; + } + var m = s && (typeof this.itemPull[n]._checked == "boolean" ? this.itemPull[n]._checked : true); + if (this.itemPull[n]._list) { + for (var x = 0; x < this.itemPull[n]._list.length; x++) { + var u = true; + if (this.itemPull[n]._list[x]._subSelect == true) { + u = false; + var o = this.getItemValue(this.itemPull[n]._idd); + if (!(typeof o == "object" && typeof o.length == "number")) { + o = [o]; + } + for (var l = 0; l < o.length; l++) { + u = o[l] == this.itemPull[n]._list[x]._subSelectId || u; + } + this.itemPull[n]._listObj[x][u ? "show" : "hide"](this.itemPull[n]._listBase[x]); + } + this.itemPull[n]._list[x]._autoCheck(m && u); + } + } + } + }; + this.doWithItem = function (n, l, w, v, u, s) { + if (typeof n == "object") { + var y = n[0]; + var x = n[1]; + var A = null; + var r = null; + for (var o in this.itemPull) { + if ((this.itemPull[o]._value == x || x === null) && this.itemPull[o]._group == y) { + return this.objPull[o][l](this.itemPull[o], w, v, u, s); + } + if (this.itemPull[o]._list != null && !r) { + for (var m = 0; m < this.itemPull[o]._list.length; m++) { + r = this.itemPull[o]._list[m].doWithItem(n, l, w, v, u); + } + } + } + if (r != null) { + return r; + } else { + if (l == "getType") { + return this.doWithItem(n[0], "getType"); + } + } + } else { + if (!this.itemPull[this.idPrefix + n]) { + var r = null; + for (var o in this.itemPull) { + if (this.itemPull[o]._list && !r) { + for (var m = 0; m < this.itemPull[o]._list.length; m++) { + if (r == null) { + r = this.itemPull[o]._list[m].doWithItem(n, l, w, v, u, s); + } + } + } + } + return r; + } else { + return this.objPull[this.idPrefix + n][l](this.itemPull[this.idPrefix + n], w, v, u, s); + } + } + }; + this._removeItem = function (l, a) { + if (a != null) { + l = this.doWithItem([l, a], "destruct"); + } else { + this.doWithItem(l, "destruct"); + } + this._clearItemData(l); + }; + this._clearItemData = function (n) { + if (this.itemPull[this.idPrefix + n]) { + n = this.idPrefix + n; + try { + this.objPull[n] = null; + this.itemPull[n] = null; + delete this.objPull[n]; + delete this.itemPull[n]; + } catch (m) {} + } else { + for (var a in this.itemPull) { + if (this.itemPull[a]._list) { + for (var l = 0; l < this.itemPull[a]._list.length; l++) { + this.itemPull[a]._list[l]._clearItemData(n); + } + } + } + } + }; + this.isItem = function (l, a) { + if (a != null) { + l = [l, a]; + } + return this.doWithItem(l, "isExist"); + }; + this.getItemType = function (l, a) { + l = [l, a || null]; + return this.doWithItem(l, "getType"); + }; + this.forEachItem = function (m) { + for (var l in this.objPull) { + if (this.objPull[l].t == "radio") { + m(this.itemPull[l]._group, this.itemPull[l]._value); + } else { + m(String(l).replace(this.idPrefix, "")); + } + if (this.itemPull[l]._list) { + for (var n = 0; n < this.itemPull[l]._list.length; n++) { + this.itemPull[l]._list[n].forEachItem(m); + } + } + } + }; + this.setItemLabel = function (m, a, l) { + if (l != null) { + m = [m, a]; + } else { + l = a; + } + this.doWithItem(m, "setText", l); + }; + this.getItemLabel = function (l, a) { + if (a != null) { + l = [l, a]; + } + return this.doWithItem(l, "getText"); + }; + this._enableItem = function (a) { + this.doWithItem(a, "enable"); + }; + this._disableItem = function (a) { + this.doWithItem(a, "disable"); + }; + this._isItemEnabled = function (a) { + return this.doWithItem(a, "isEnabled"); + }; + this.checkItem = function (l, a) { + if (a != null) { + l = [l, a]; + } + this.doWithItem(l, "check"); + this._autoCheck(); + }; + this.uncheckItem = function (l, a) { + if (a != null) { + l = [l, a]; + } + this.doWithItem(l, "unCheck"); + this._autoCheck(); + }; + this.isItemChecked = function (l, a) { + if (a != null) { + l = [l, a]; + } + return this.doWithItem(l, "isChecked"); + }; + this.getCheckedValue = function (a) { + return this.doWithItem([a, null], "getChecked"); + }; + this._getRGroup = function (s, o) { + for (var l in this.itemPull) { + if (this.itemPull[l]._group == s && (o == null || this.itemPull[l]._value == o)) { + return this.itemPull[l]._idd; + } + if (this.itemPull[l]._list != null) { + for (var n = 0; n < this.itemPull[l]._list.length; n++) { + var m = this.itemPull[l]._list[n]._getRGroup(s, o); + if (m != null) { + return m; + } + } + } + } + return null; + }; + this.setItemValue = function (l, a) { + this.resetValidateCss(l, a); + if (this.getItemType(l) == "radio") { + if (this._getRGroup(l, a) != null) { + this.checkItem(l, a); + } else { + this.uncheckItem(l, this.getCheckedValue(l)); + } + return null; + } + return this.doWithItem(l, "setValue", a); + }; + this.getItemValue = function (l, a) { + if (this.getItemType(l) == "radio") { + return this.getCheckedValue(l); + } + return this.doWithItem(l, "getValue", a); + }; + this.updateValues = function () { + this._updateValues(); + }; + this.showItem = function (l, a) { + if (a != null) { + l = [l, a]; + } + this.doWithItem(l, "show"); + }; + this.hideItem = function (l, a) { + if (a != null) { + l = [l, a]; + } + this.doWithItem(l, "hide"); + }; + this.isItemHidden = function (l, a) { + if (a != null) { + l = [l, a]; + } + return this.doWithItem(l, "isHidden"); + }; + this.getOptions = function (a) { + return this.doWithItem(a, "getOptions"); + }; + this.setItemWidth = function (l, a) { + this.doWithItem(l, "setWidth", a); + }; + this.getItemWidth = function (a) { + return this.doWithItem(a, "getWidth"); + }; + this.setItemHeight = function (l, a) { + this.doWithItem(l, "setHeight", a); + }; + this.setItemFocus = function (l, a) { + if (a != null) { + l = [l, a]; + } + this.doWithItem(l, "setFocus"); + }; + this._updateValues = function () { + for (var l in this.itemPull) { + if (this.objPull[l] && typeof this.objPull[l].updateValue == "function") { + this.objPull[l].updateValue(this.itemPull[l]); + } + if (this.itemPull[l]._list) { + for (var m = 0; m < this.itemPull[l]._list.length; m++) { + this.itemPull[l]._list[m]._updateValues(); + } + } + } + }; + this._getItemByName = function (o) { + for (var l in this.itemPull) { + if (this.itemPull[l]._idd == o) { + return this.itemPull[l]; + } + if (this.itemPull[l]._list != null) { + for (var n = 0; n < this.itemPull[l]._list.length; n++) { + var m = this.itemPull[l]._list[n]._getItemByName(o); + if (m != null) { + return m; + } + } + } + } + return null; + }; + this._resetValidateCss = function (a) { + a.className = a.className.replace(a._vcss, ""); + a._vcss = null; + }; + this.setValidateCss = function (a, n, m) { + var l = this[this.getItemType(a) == "radio" ? "_getRGroup" : "_getItemByName"](a); + if (!l) { + return; + } + if (l._vcss != null) { + this._resetValidateCss(l); + } + l._vcss = typeof m == "string" ? m : "validate_" + (n === true ? "ok" : "error"); + l.className += " " + l._vcss; + }; + this.resetValidateCss = function (m) { + for (var l in this.itemPull) { + if (this.itemPull[l]._vcss != null) { + this._resetValidateCss(this.itemPull[l]); + } + if (this.itemPull[l]._list != null) { + for (var n = 0; n < this.itemPull[l]._list.length; n++) { + this.itemPull[l]._list[n].resetValidateCss(); + } + } + } + }; + this.validate = function (l) { + if (this.callEvent("onBeforeValidate", []) == false) { + return; + } + var a = true; + this.forEachItem(function (n, o) { + if (typeof o != "undefined") { + n = [n, o]; + } + var m = e.doWithItem(n, "_validate"); + if (typeof m != "boolean") { + m = true; + } + a = m && a; + }); + this.callEvent("onAfterValidate", [a]); + return a; + }; + this.validateItem = function (a, l) { + if (typeof l != "undefined") { + a = [a, l]; + } + return this.doWithItem(a, "_validate"); + }; + this.enableLiveValidation = function (a) { + this.live_validate = a == true; + }; + this.setReadonly = function (l, a) { + this.doWithItem(l, "setReadonly", a); + }; + this.isReadonly = function (a) { + return this.doWithItem(a, "isReadonly"); + }; + this.getFirstActive = function (l) { + for (var n = 0; n < this._indexId.length; n++) { + var a = true; + if (l == true) { + var m = this.getItemType(this._indexId[n]); + if (!dhtmlXForm.prototype.items[m].setFocus) { + a = false; + } + } + if (a && this._idIndex[this._indexId[n]].enabled) { + return this._indexId[n]; + } + } + return null; + }; + this.setFocusOnFirstActive = function () { + var a = this.getFirstActive(true); + if (a != null) { + this.setItemFocus(a); + } + }; + this.enableItem = function (l, a) { + if (a != null) { + l = [l, a]; + } + this.doWithItem(l, "userEnable"); + this._autoCheck(); + }; + this.disableItem = function (l, a) { + if (a != null) { + l = [l, a]; + } + this.doWithItem(l, "userDisable"); + this._autoCheck(); + }; + this.isItemEnabled = function (l, a) { + if (a != null) { + l = [l, a]; + } + return this.doWithItem(l, "isUserEnabled"); + }; + this.clear = function () { + var l = {}; + this.formId = new Date().valueOf(); + this.resetDataProcessor("inserted"); + for (var m in this.itemPull) { + var n = this.itemPull[m]._idd; + if (this.itemPull[m]._type == "ch") { + this.uncheckItem(n); + } + if (this.itemPull[m]._type in { ta: 1, editor: 1, calendar: 1, pw: 1, hd: 1 }) { + this.setItemValue(n, ""); + } + if (this.itemPull[m]._type == "combo") { + this.itemPull[m]._apiChange = true; + var u = this.getCombo(n); + u.selectOption(0); + u = null; + this.itemPull[m]._apiChange = false; + } + if (this.itemPull[m]._type == "se") { + var r = this.getOptions(n); + if (r.length > 0) { + r[0].selected = true; + } + } + if (this.itemPull[m]._type == "ra") { + var o = this.itemPull[m]._group; + if (!l[o]) { + this.checkItem(o, this.doWithItem(n, "_getFirstValue")); + l[o] = true; + } + } + if (this.itemPull[m]._list) { + for (var s = 0; s < this.itemPull[m]._list.length; s++) { + this.itemPull[m]._list[s].clear(); + } + } + if (this["setFormData_" + this.itemPull[m]._type]) { + this["setFormData_" + this.itemPull[m]._type](n, ""); + } + } + l = null; + if (this._parentForm) { + this._autoCheck(); + } + this.resetValidateCss(); + }; + this.unload = function () { + window.dhx4._enableDataLoading(this, null, null, null, "clear"); + window.dhx4._eventable(this, "clear"); + for (var l in this.objPull) { + this._removeItem(String(l).replace(this.idPrefix, "")); + } + if (this._ccTm) { + window.clearTimeout(this._ccTm); + } + this._formLS = null; + for (var m = 0; m < this.base.length; m++) { + while (this.base[m].childNodes.length > 0) { + this.base[m].removeChild(this.base[m].childNodes[0]); + } + if (this.base[m].parentNode) { + this.base[m].parentNode.removeChild(this.base[m]); + } + this.base[m] = null; + } + this.base = null; + this.cont.onkeypress = null; + this.cont.className = ""; + this.cont = null; + for (var l in this) { + this[l] = null; + } + e = null; + }; + for (var c in this.items) { + this.items[c].t = c; + if (typeof this.items[c]._index == "undefined") { + this.items[c]._index = true; + } + if (!this.items[c].show) { + this.items[c].show = function (a) { + a.style.display = ""; + if (a._listObj) { + for (var l = 0; l < a._listObj.length; l++) { + a._listObj[l].show(a._listBase[l]); + } + } + }; + } + if (!this.items[c].hide) { + this.items[c].hide = function (a) { + a.style.display = "none"; + if (a._listObj) { + for (var l = 0; l < a._listObj.length; l++) { + a._listObj[l].hide(a._listBase[l]); + } + } + }; + } + if (!this.items[c].isHidden) { + this.items[c].isHidden = function (a) { + return a.style.display == "none"; + }; + } + if (!this.items[c].userEnable) { + this.items[c].userEnable = function (a) { + a._udis = false; + }; + } + if (!this.items[c].userDisable) { + this.items[c].userDisable = function (a) { + a._udis = true; + }; + } + if (!this.items[c].isUserEnabled) { + this.items[c].isUserEnabled = function (a) { + return a._udis !== true; + }; + } + if (!this.items[c].getType) { + this.items[c].getType = function () { + return this.t; + }; + } + if (!this.items[c].isExist) { + this.items[c].isExist = function () { + return true; + }; + } + if (!this.items[c]._validate) { + this.items[c]._validate = function (m) { + if (!m._validate || !m._enabled) { + return true; + } + if (m._type == "ch") { + var s = this.isChecked(m) ? this.getValue(m) : 0; + } else { + var s = this.getValue(m); + } + var l = true; + for (var o = 0; o < m._validate.length; o++) { + var a = "is" + m._validate[o]; + if ((s == null || s.length == 0) && a != "isNotEmpty" && m._type != "container") { + } else { + var n = dhtmlxValidation[a]; + if (m._type == "container" && typeof n == "function") { + n = function () { + return true; + }; + } + if (typeof n != "function" && typeof m._validate[o] == "function") { + n = m._validate[o]; + } + if (typeof n != "function" && typeof window[m._validate[o]] == "function") { + n = window[m._validate[o]]; + } + l = (typeof n == "function" ? n(s, m._idd) : new RegExp(m._validate[o]).test(s)) && l; + n = null; + } + } + if (!(m.callEvent("onValidate" + (l ? "Success" : "Error"), [m._idd, s, l]) === false)) { + m.getForm().setValidateCss(m._idd, l); + } + return l; + }; + } + } + this._locked = false; + this._doLock = function (l) { + var a = l === true ? true : false; + if (this._locked == a) { + return; + } else { + this._locked = a; + } + this._autoCheck(!this._locked); + }; + this.lock = function () { + this._doLock(true); + }; + this.unlock = function () { + this._doLock(false); + }; + this.isLocked = function () { + return this._locked; + }; + this.setNumberFormat = function (n, l, a, m) { + return this.doWithItem(n, "setNumberFormat", l, a, m); + }; + window.dhx4._enableDataLoading(this, "_initObj", "_xmlToObject", "items", { struct: true, data: true }); + window.dhx4._eventable(this); + this.attachEvent("_onButtonClick", function (a, l) { + this.callEvent("onButtonClick", [a, l]); + }); + this._updateBlocks = function () { + this.forEachItem(function (a) { + if (e.getItemType(a) == "block" || e.getItemType(a) == "combo") { + e.doWithItem(a, "_setCss", e.skin, e.cont.style.fontSize); + } + }); + }; + this._isObj = function (a) { + return a != null && typeof a == "object" && typeof a.length == "undefined"; + }; + this._copyObj = function (n) { + if (this._isObj(n)) { + var m = {}; + for (var l in n) { + if (typeof n[l] == "object" && n[l] != null) { + m[l] = this._copyObj(n[l]); + } else { + m[l] = n[l]; + } + } + } else { + var m = []; + for (var l = 0; l < n.length; l++) { + if (typeof n[l] == "object" && n[l] != null) { + m[l] = this._copyObj(n[l]); + } else { + m[l] = n[l]; + } + } + } + return m; + }; + if (g != null && typeof g == "object") { + this._initObj(this._copyObj(g)); + } + if (this._parentForm) { + this._updateBlocks(); + } + this._ccActive = false; + this._ccTm = null; + return this; +} +dhtmlXForm.prototype.getInput = function (a) { + return this.doWithItem(a, "getInput"); +}; +dhtmlXForm.prototype.getSelect = function (a) { + return this.doWithItem(a, "getSelect"); +}; +dhtmlXForm.prototype.items = {}; +dhtmlXForm.prototype.items.checkbox = { + render: function (a, c) { + a._type = "ch"; + a._enabled = true; + a._checked = false; + a._value = typeof c.value == "undefined" ? null : String(c.value); + a._ro = c.readonly == true; + if (c._autoInputWidth !== false) { + c.inputWidth = 14; + } + this.doAddLabel(a, c); + this.doAddInput(a, c, "INPUT", "TEXT", true, true, "dhxform_textarea"); + a.childNodes[a._ll ? 1 : 0].className += " dhxform_img_node"; + var e = document.createElement("DIV"); + e.className = "dhxform_img chbx0"; + a.appendChild(e); + if (!isNaN(c.inputLeft)) { + a.childNodes[a._ll ? 1 : 0].style.left = parseInt(c.inputLeft) + "px"; + } + if (!isNaN(c.inputTop)) { + a.childNodes[a._ll ? 1 : 0].style.top = parseInt(c.inputTop) + "px"; + } + a.childNodes[a._ll ? 1 : 0].appendChild(e); + a.childNodes[a._ll ? 1 : 0].firstChild.value = String(c.value); + a._updateImgNode = function (h, j) { + var g = h.childNodes[h._ll ? 1 : 0].lastChild; + g.className = (j ? "dhxform_actv_c" : "dhxform_img") + " " + (h._checked ? "chbx1" : "chbx0"); + h = g = null; + }; + a._doOnFocus = function (g) { + g.getForm().callEvent("onFocus", [g._idd]); + }; + a._doOnBlur = function (g) { + g.getForm().callEvent("onBlur", [g._idd]); + }; + a._doOnKeyUpDown = function (h, g) { + this.callEvent(h, [this.childNodes[this._ll ? 0 : 1].childNodes[0], g, this._idd]); + }; + if (c.checked == true) { + this.check(a); + } + if (c.hidden == true) { + this.hide(a); + } + if (c.disabled == true) { + this.userDisable(a); + } + this.doAttachEvents(a); + return this; + }, + destruct: function (a) { + a._doOnFocus = a._doOnBlur = a._updateImgNode = null; + this.doUnloadNestedLists(a); + this.doDestruct(a); + }, + doAddLabel: function (c, e) { + var a = document.createElement("DIV"); + a.className = "dhxform_label " + e.labelAlign; + if (e.wrap == true) { + a.style.whiteSpace = "normal"; + } + if (c._ll) { + c.insertBefore(a, c.firstChild); + } else { + c.appendChild(a); + } + if (typeof e.tooltip != "undefined") { + a.title = e.tooltip; + } + a.innerHTML = + ""; + if (!isNaN(e.labelWidth)) { + a.firstChild.style.width = parseInt(e.labelWidth) + "px"; + } + if (!isNaN(e.labelHeight)) { + a.firstChild.style.height = parseInt(e.labelHeight) + "px"; + } + if (!isNaN(e.labelLeft)) { + a.style.left = parseInt(e.labelLeft) + "px"; + } + if (!isNaN(e.labelTop)) { + a.style.top = parseInt(e.labelTop) + "px"; + } + }, + doAddInput: function (v, g, c, n, o, h, j) { + var a = document.createElement("DIV"); + a.className = "dhxform_control"; + if (v._ll) { + v.appendChild(a); + } else { + v.insertBefore(a, v.firstChild); + } + var s = document.createElement(c); + s.className = j; + s.name = v._idd; + s._idd = v._idd; + s.id = g.uid; + if (typeof n == "string") { + s.type = n; + } + if (c == "INPUT" || c == "TEXTAREA") { + s.onkeyup = function (u) { + u = u || event; + v.callEvent("onKeyUp", [this, u, this._idd]); + }; + s.onkeydown = function (u) { + u = u || event; + v.callEvent("onKeyDown", [this, u, this._idd]); + }; + } + a.appendChild(s); + if (g.readonly) { + this.setReadonly(v, true); + } + if (g.hidden == true) { + this.hide(v); + } + if (g.disabled == true) { + this.userDisable(v); + } + if (o) { + if (!isNaN(g.inputLeft)) { + a.style.left = parseInt(g.inputLeft) + "px"; + } + if (!isNaN(g.inputTop)) { + a.style.top = parseInt(g.inputTop) + "px"; + } + } + var r = ""; + var l = false; + if (h) { + if (!isNaN(g.inputWidth)) { + r += "width:" + parseInt(g.inputWidth) + "px;"; + l = true; + } + if (!isNaN(g.inputHeight)) { + r += "height:" + parseInt(g.inputHeight) + "px;"; + } + } + if (typeof g.style == "string") { + r += g.style; + } + s.style.cssText = r; + if (g.maxLength) { + s.setAttribute("maxLength", g.maxLength); + } + if (g.connector) { + s.setAttribute("connector", g.connector); + } + var e = dhtmlXForm.prototype.items[this.t] != null ? dhtmlXForm.prototype.items[this.t]._dimFix == true : false; + if (l && ({ input: 1, password: 1, select: 1, multiselect: 1, calendar: 1, colorpicker: 1 }[this.t] == 1 || e)) { + if (dhtmlXForm.prototype.items[this.t]._dim == null) { + dhtmlXForm.prototype.items[this.t]._dim = v.getForm()._checkDim(a, s); + } + s.style.width = parseInt(s.style.width) - dhtmlXForm.prototype.items[this.t]._dim + "px"; + } + if (typeof g.note == "object") { + var m = document.createElement("DIV"); + m.className = "dhxform_note"; + m.style.width = (isNaN(g.note.width) ? s.offsetWidth : parseInt(g.note.width)) + "px"; + m._w = g.note.width; + m.innerHTML = g.note.text; + a.appendChild(m); + m = null; + } + }, + doUnloadNestedLists: function (a) { + if (!a._list) { + return; + } + for (var c = 0; c < a._list.length; c++) { + a._list[c].unload(); + a._list[c] = null; + a._listObj[c] = null; + a._listBase[c].parentNode.removeChild(a._listBase[c]); + a._listBase[c] = null; + } + a._list = null; + a._listObj = null; + a._listBase = null; + }, + doDestruct: function (a) { + a.callEvent = null; + a.checkEvent = null; + a.getForm = null; + a._autoCheck = null; + a._checked = null; + a._enabled = null; + a._idd = null; + a._type = null; + a._value = null; + a._group = null; + a.onselectstart = null; + a.childNodes[a._ll ? 1 : 0].onmousedown = null; + a.childNodes[a._ll ? 1 : 0].ontouchstart = null; + a.childNodes[a._ll ? 0 : 1].onmousedown = null; + a.childNodes[a._ll ? 0 : 1].ontouchstart = null; + a.childNodes[a._ll ? 0 : 1].childNodes[0].onfocus = null; + a.childNodes[a._ll ? 0 : 1].childNodes[0].onblur = null; + a.childNodes[a._ll ? 0 : 1].childNodes[0].onkeypress = null; + a.childNodes[a._ll ? 0 : 1].childNodes[0].onkeyup = null; + a.childNodes[a._ll ? 0 : 1].childNodes[0].onkeydown = null; + a.childNodes[a._ll ? 0 : 1].childNodes[0].onmousedown = null; + a.childNodes[a._ll ? 0 : 1].childNodes[0].ontouchstart = null; + a.childNodes[a._ll ? 0 : 1].removeChild(a.childNodes[a._ll ? 0 : 1].childNodes[0]); + while (a.childNodes.length > 0) { + a.removeChild(a.childNodes[0]); + } + a.parentNode.removeChild(a); + a = null; + }, + doAttachEvents: function (c) { + var a = this; + c.childNodes[c._ll ? 1 : 0][window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function (h) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } + var g = h.target || h.srcElement; + if (!this.parentNode._enabled || this.parentNode._ro || (typeof g.className != "undefined" && g.className == "dhxform_note")) { + h.cancelBubble = true; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + return false; + } + a.doClick(this.parentNode); + }; + c.childNodes[c._ll ? 0 : 1].childNodes[0][window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function (h) { + h = h || event; + if (h.preventDefault) { + h.preventDefault(); + } + if (!this.parentNode.parentNode._enabled) { + h.cancelBubble = true; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + return false; + } + var g = h.target || h.srcElement; + if (typeof g.className != "undefined" && g.className == "dhxform_info") { + this.parentNode.parentNode.callEvent("onInfo", [this.parentNode.parentNode._idd, h]); + h.cancelBubble = true; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + return false; + } + a.doClick(this.parentNode.parentNode); + }; + }, + doClick: function (a) { + a.childNodes[a._ll ? 0 : 1].childNodes[0].focus(); + if (!a._enabled || a._ro) { + return; + } + if (a.checkEvent("onBeforeChange")) { + if (a.callEvent("onBeforeChange", [a._idd, a._value, a._checked]) !== true) { + return; + } + } + this.setChecked(a, !a._checked); + a._autoCheck(); + a.callEvent("onChange", [a._idd, a._value, a._checked]); + }, + doCheckValue: function (a) { + if (a._checked && a._enabled) { + a.childNodes[a._ll ? 1 : 0].firstChild.name = String(a._idd); + a.childNodes[a._ll ? 1 : 0].firstChild.value = this.getValue(a); + } else { + a.childNodes[a._ll ? 1 : 0].firstChild.name = ""; + a.childNodes[a._ll ? 1 : 0].firstChild.value = ""; + } + }, + setChecked: function (a, c) { + a._checked = c === true ? true : false; + a.childNodes[a._ll ? 1 : 0].lastChild.className = a.childNodes[a._ll ? 1 : 0].lastChild.className.replace(/chbx[0-1]{1}/gi, "") + (a._checked ? " chbx1" : " chbx0"); + this.doCheckValue(a); + }, + check: function (a) { + this.setChecked(a, true); + }, + unCheck: function (a) { + this.setChecked(a, false); + }, + isChecked: function (a) { + return a._checked; + }, + enable: function (a) { + if (String(a.className).search("disabled") >= 0) { + a.className = String(a.className).replace(/disabled/gi, ""); + } + a._enabled = true; + a.childNodes[a._ll ? 0 : 1].childNodes[0].tabIndex = 0; + a.childNodes[a._ll ? 0 : 1].childNodes[0].removeAttribute("disabled"); + this.doCheckValue(a); + }, + disable: function (a) { + if (String(a.className).search("disabled") < 0) { + a.className += " disabled"; + } + a._enabled = false; + if (a._updateImgNode != null) { + a._updateImgNode(a, false); + } + a.childNodes[a._ll ? 0 : 1].childNodes[0].tabIndex = -1; + a.childNodes[a._ll ? 0 : 1].childNodes[0].setAttribute("disabled", "true"); + this.doCheckValue(a); + }, + isEnabled: function (a) { + return a._enabled; + }, + setText: function (a, c) { + a.childNodes[a._ll ? 0 : 1].childNodes[0].innerHTML = c + (a._required ? "*" : ""); + }, + getText: function (a) { + return a.childNodes[a._ll ? 0 : 1].childNodes[0].innerHTML.replace(/[^<]*<\/span>/g, ""); + }, + setValue: function (a, c) { + this.setChecked(a, c === true || parseInt(c) == 1 || c == "true" || a._value === c); + }, + getValue: function (a, c) { + if (c == "realvalue") { + return a._value; + } + return typeof a._value == "undefined" || a._value == null ? (a._checked ? 1 : 0) : a._value; + }, + setReadonly: function (a, c) { + a._ro = c === true; + }, + isReadonly: function (a) { + return a._ro; + }, + setFocus: function (a) { + a.childNodes[a._ll ? 0 : 1].childNodes[0].focus(); + }, +}; +dhtmlXForm.prototype.items.radio = { + input: {}, + r: {}, + firstValue: {}, + render: function (e, g, c) { + e._type = "ra"; + e._enabled = true; + e._checked = false; + e._group = g.name; + e._value = g.value; + e._uid = c; + e._ro = g.readonly == true; + e._rName = e._rId + e._group; + this.r[e._idd] = e; + g.inputWidth = 14; + this.doAddLabel(e, g); + this.doAddInput(e, g, "INPUT", "TEXT", true, true, "dhxform_textarea"); + e.childNodes[e._ll ? 1 : 0].className += " dhxform_img_node"; + var h = document.createElement("DIV"); + h.className = "dhxform_img rdbt0"; + e.appendChild(h); + if (!isNaN(g.inputLeft)) { + e.childNodes[e._ll ? 1 : 0].style.left = parseInt(g.inputLeft) + "px"; + } + if (!isNaN(g.inputTop)) { + e.childNodes[e._ll ? 1 : 0].style.top = parseInt(g.inputTop) + "px"; + } + e.childNodes[e._ll ? 1 : 0].appendChild(h); + e.childNodes[e._ll ? 1 : 0].firstChild.name = ""; + e.childNodes[e._ll ? 1 : 0].firstChild.value = ""; + e._updateImgNode = function (l, m) { + var j = l.childNodes[l._ll ? 1 : 0].lastChild; + j.className = (m ? "dhxform_actv_r" : "dhxform_img") + " " + (l._checked ? "rdbt1" : "rdbt0"); + l = j = null; + }; + e._doOnFocus = function (j) { + j.getForm().callEvent("onFocus", [j._group, j._value]); + }; + e._doOnBlur = function (j) { + j.getForm().callEvent("onBlur", [j._group, j._value]); + }; + e._doOnKeyUpDown = function (l, j) { + this.callEvent(l, [this.childNodes[this._ll ? 0 : 1].childNodes[0], j, this._group, this._value]); + }; + if (this.input[e._rName] == null) { + var a = document.createElement("INPUT"); + a.type = "HIDDEN"; + a.name = g.name; + a.firstValue = e._value; + e.appendChild(a); + this.input[e._rName] = a; + } + if (!this.firstValue[e._rName]) { + this.firstValue[e._rName] = g.value; + } + if (g.checked == true) { + this.check(e); + } + if (g.hidden == true) { + this.hide(e); + } + if (g.disabled == true) { + this.userDisable(e); + } + this.doAttachEvents(e); + return this; + }, + destruct: function (g, h) { + if (g.lastChild == this.input[g._rName]) { + var e = false; + for (var c in this.r) { + if (!e && this.r[c]._group == g._group && this.r[c]._idd != g._idd) { + this.r[c].appendChild(this.input[g._rName]); + e = true; + } + } + if (!e) { + this.input[g._rName].parentNode.removeChild(this.input[g._rName]); + this.input[g._rName] = null; + this.firstValue[g._rName] = null; + } + } + var j = g._idd; + g._doOnFocus = g._doOnBlur = g._updateImgNode = null; + this.doUnloadNestedLists(g); + this.doDestruct(g); + return j; + }, + doClick: function (c) { + c.childNodes[c._ll ? 0 : 1].childNodes[0].focus(); + if (!(c._enabled && !c._checked)) { + return; + } + if (c._ro) { + return; + } + var a = [c._group, c._value, true]; + if (c.checkEvent("onBeforeChange")) { + if (c.callEvent("onBeforeChange", a) !== true) { + return; + } + } + this.setChecked(c, true); + c.getForm()._autoCheck(); + c.callEvent("onChange", a); + }, + doCheckValue: function (e) { + var g = null; + for (var c in this.r) { + if (this.r[c]._checked && this.r[c]._group == e._group && this.r[c]._rId == e._rId) { + g = this.r[c]._value; + } + } + if (g != null && this.r[c]._enabled) { + this.input[e._rName].name = String(e._group); + this.input[e._rName].value = g; + } else { + this.input[e._rName].name = ""; + this.input[e._rName].value = ""; + } + this.input[e._rName]._value = g; + }, + setChecked: function (h, j) { + j = j === true; + for (var c in this.r) { + if (this.r[c]._group == h._group && this.r[c]._rId == h._rId) { + var g = false; + if (this.r[c]._idd == h._idd) { + if (this.r[c]._checked != j) { + this.r[c]._checked = j; + g = true; + } + } else { + if (this.r[c]._checked) { + this.r[c]._checked = false; + g = true; + } + } + if (g) { + var e = this.r[c].childNodes[this.r[c]._ll ? 1 : 0].childNodes[1]; + e.className = e.className.replace(/rdbt[0-1]{1}/gi, "") + (this.r[c]._checked ? " rdbt1" : " rdbt0"); + e = null; + } + } + } + this.doCheckValue(h); + }, + getChecked: function (a) { + return this.input[a._rName]._value; + }, + _getFirstValue: function (a) { + return this.firstValue[a._rName]; + }, + _getId: function (a) { + return a._idd; + }, + setValue: function (a, c) {}, +}; +(function () { + for (var c in { + doAddLabel: 1, + doAddInput: 1, + doDestruct: 1, + doUnloadNestedLists: 1, + doAttachEvents: 1, + check: 1, + unCheck: 1, + isChecked: 1, + enable: 1, + disable: 1, + isEnabled: 1, + setText: 1, + getText: 1, + getValue: 1, + setReadonly: 1, + isReadonly: 1, + setFocus: 1, + }) { + dhtmlXForm.prototype.items.radio[c] = dhtmlXForm.prototype.items.checkbox[c]; + } +})(); +dhtmlXForm.prototype.items.select = { + render: function (a, c) { + a._type = "se"; + a._enabled = true; + a._value = null; + a._newValue = null; + this.doAddLabel(a, c); + this.doAddInput(a, c, "SELECT", null, true, true, "dhxform_select"); + this.doAttachEvents(a); + this.doLoadOpts(a, c); + if (c.connector != null) { + this.doLoadOptsConnector(a, c.connector); + } + if (typeof c.value != "undefined" && c.value != null) { + this.setValue(a, c.value); + } + return this; + }, + destruct: function (a) { + this.doUnloadNestedLists(a); + a.callEvent = null; + a.checkEvent = null; + a.getForm = null; + a._autoCheck = null; + a._enabled = null; + a._idd = null; + a._type = null; + a._value = null; + a._newValue = null; + a.onselectstart = null; + a.childNodes[a._ll ? 1 : 0].childNodes[0].onclick = null; + a.childNodes[a._ll ? 1 : 0].childNodes[0].onkeydown = null; + a.childNodes[a._ll ? 1 : 0].childNodes[0].onchange = null; + a.childNodes[a._ll ? 1 : 0].childNodes[0].onfocus = null; + a.childNodes[a._ll ? 1 : 0].childNodes[0].onblur = null; + a.childNodes[a._ll ? 1 : 0].childNodes[0].onkeyup = null; + a.childNodes[a._ll ? 1 : 0].removeChild(a.childNodes[a._ll ? 1 : 0].childNodes[0]); + while (a.childNodes.length > 0) { + a.removeChild(a.childNodes[0]); + } + a.parentNode.removeChild(a); + a = null; + }, + doAddLabel: function (c, e) { + var a = document.createElement("DIV"); + a.className = "dhxform_label " + e.labelAlign; + a.innerHTML = ""; + if (e.wrap == true) { + a.style.whiteSpace = "normal"; + } + if (typeof e.tooltip != "undefined") { + a.title = e.tooltip; + } + c.appendChild(a); + if (typeof e.label == "undefined" || e.label == null || e.label.length == 0) { + a.style.display = "none"; + } + if (!isNaN(e.labelWidth)) { + a.style.width = parseInt(e.labelWidth) + "px"; + } + if (!isNaN(e.labelHeight)) { + a.style.height = parseInt(e.labelHeight) + "px"; + } + if (!isNaN(e.labelLeft)) { + a.style.left = parseInt(e.labelLeft) + "px"; + } + if (!isNaN(e.labelTop)) { + a.style.top = parseInt(e.labelTop) + "px"; + } + if (e.info) { + a.onclick = function (h) { + h = h || event; + var g = h.target || h.srcElement; + if (typeof g.className != "undefined" && g.className == "dhxform_info") { + this.parentNode.callEvent("onInfo", [this.parentNode._idd, h]); + h.cancelBubble = true; + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + return false; + } + }; + } + }, + doAttachEvents: function (e) { + var a = e.childNodes[e._ll ? 1 : 0].childNodes[0]; + var c = this; + a.onclick = function () { + c.doOnChange(this); + }; + a.onkeydown = function (g) { + g = g || event; + c.doOnChange(this); + this.parentNode.parentNode.callEvent("onKeyDown", [this, g, this.parentNode.parentNode._idd]); + }; + a.onchange = function () { + c.doOnChange(this); + }; + a.onkeyup = function (g) { + g = g || event; + this.parentNode.parentNode.callEvent("onKeyUp", [this, g, this.parentNode.parentNode._idd]); + }; + a = null; + this.doAttachChangeLS(e); + }, + doAttachChangeLS: function (c) { + var a = c.childNodes[c._ll ? 1 : 0].childNodes[0]; + a.onfocus = function () { + var e = this.parentNode.parentNode; + e.getForm()._ccActivate(e._idd, this, e.getForm().getItemValue(e._idd, true)); + e.getForm().callEvent("onFocus", [e._idd]); + e = null; + }; + a.onblur = function () { + var e = this.parentNode.parentNode; + e.getForm()._ccDeactivate(e._idd); + e.getForm().callEvent("onBlur", [e._idd]); + e = null; + }; + a = null; + }, + doValidate: function (a) { + if (a.getForm().live_validate) { + this._validate(a); + } + }, + doLoadOpts: function (l, h, n) { + var m = l.childNodes[l._ll ? 1 : 0].childNodes[0]; + var a = h.options; + var g = false; + for (var c = 0; c < a.length; c++) { + var j = a[c].text || a[c].label; + if (!j || typeof j == "undefined") { + j = ""; + } + var e = new Option(j, a[c].value); + if (typeof a[c].img_src == "string") { + e.setAttribute("img_src", a[c].img_src); + } + m.options.add(e); + if (typeof a[c].selected != "undefined" && window.dhx4.s2b(a[c].selected) == true) { + e.selected = true; + l._value = a[c].value; + g = true; + } + if (typeof a[c].checked != "undefined" && window.dhx4.s2b(a[c].checked) == true) { + e.setAttribute("checked", "1"); + } + if (typeof a[c].img != "undefined") { + e.setAttribute("img", a[c].img); + } + if (typeof a[c].img_dis != "undefined") { + e.setAttribute("img_dis", a[c].img_dis); + } + if (typeof a[c].css != "undefined") { + e.setAttribute("css", a[c].css); + } + } + if (!g && m.selectedIndex >= 0) { + l._value = m.options[m.selectedIndex].value; + } + if (n === true) { + l.callEvent("onOptionsLoaded", [l._idd]); + } + this._checkNoteWidth(l); + }, + doLoadOptsConnector: function (e, a) { + var c = this; + e._connector_working = true; + window.dhx4.ajax.get(a, function (l) { + l = l.xmlDoc.responseXML; + if (l == null) { + return; + } + var g = l.getElementsByTagName("data"); + if (g == null || g[0] == null) { + return; + } + g = g[0]; + var j = []; + for (var m = 0; m < g.childNodes.length; m++) { + if (typeof g.childNodes[m].tagName != "undefined" && String(g.childNodes[m].tagName).toLowerCase() == "item") { + var h = g.childNodes[m]; + j.push({ label: h.getAttribute("label"), value: h.getAttribute("value"), selected: h.getAttribute("selected") != null }); + h = null; + } + } + c.doLoadOpts(e, { options: j }, true); + e._connector_working = false; + if (e._connector_value != null) { + c.setValue(e, e._connector_value); + e._connector_value = null; + } + c = e = null; + }); + }, + doOnChange: function (e) { + var a = e.parentNode.parentNode; + a._newValue = e.selectedIndex >= 0 ? e.options[e.selectedIndex].value : null; + if (a._newValue != a._value) { + if (a.checkEvent("onBeforeChange")) { + if (a.callEvent("onBeforeChange", [a._idd, a._value, a._newValue]) !== true) { + for (var c = 0; c < e.options.length; c++) { + if (e.options[c].value == a._value) { + e.options[c].selected = true; + } + } + return; + } + } + a._value = a._newValue; + a.callEvent("onChange", [a._idd, a._value]); + if (a._type == "se" && a.getForm().live_validate) { + this._validate(a); + } + } + a._autoCheck(); + }, + setText: function (a, c) { + if (!c) { + c = ""; + } + a.childNodes[a._ll ? 0 : 1].childNodes[0].innerHTML = c + (a._required ? "*" : ""); + a.childNodes[a._ll ? 0 : 1].style.display = c.length == 0 || c == null ? "none" : ""; + }, + getText: function (a) { + return a.childNodes[a._ll ? 0 : 1].childNodes[0].innerHTML.replace(/[^<]*<\/span>/g, ""); + }, + enable: function (a) { + if (String(a.className).search("disabled") >= 0) { + a.className = String(a.className).replace(/disabled/gi, ""); + } + a._enabled = true; + a.childNodes[a._ll ? 1 : 0].childNodes[0].removeAttribute("disabled"); + }, + disable: function (a) { + if (String(a.className).search("disabled") < 0) { + a.className += " disabled"; + } + a._enabled = false; + a.childNodes[a._ll ? 1 : 0].childNodes[0].setAttribute("disabled", true); + }, + getOptions: function (a) { + return a.childNodes[a._ll ? 1 : 0].childNodes[0].options; + }, + setValue: function (c, g) { + if (c._connector_working) { + c._connector_value = g; + return; + } + var a = this.getOptions(c); + for (var e = 0; e < a.length; e++) { + if (a[e].value == g) { + a[e].selected = true; + c._value = a[e].value; + } + } + if (c._list != null && c._list.length > 0) { + c.getForm()._autoCheck(); + } + c.getForm()._ccReload(c._idd, c._value); + }, + getValue: function (e) { + var a = -1; + var c = this.getOptions(e); + for (var g = 0; g < c.length; g++) { + if (c[g].selected) { + a = c[g].value; + } + } + return a; + }, + setWidth: function (c, a) { + c.childNodes[c._ll ? 1 : 0].childNodes[0].style.width = a + "px"; + }, + getSelect: function (a) { + return a.childNodes[a._ll ? 1 : 0].childNodes[0]; + }, + setFocus: function (a) { + a.childNodes[a._ll ? 1 : 0].childNodes[0].focus(); + }, + _checkNoteWidth: function (c) { + var a; + if (c.childNodes[c._ll ? 1 : 0].childNodes[1] != null) { + a = c.childNodes[c._ll ? 1 : 0].childNodes[1]; + if (a.className != null && a.className.search(/dhxform_note/gi) >= 0 && a._w == "auto") { + a.style.width = c.childNodes[c._ll ? 1 : 0].childNodes[0].offsetWidth + "px"; + } + } + a = null; + }, +}; +(function () { + for (var c in { doAddInput: 1, doUnloadNestedLists: 1, isEnabled: 1 }) { + dhtmlXForm.prototype.items.select[c] = dhtmlXForm.prototype.items.checkbox[c]; + } +})(); +dhtmlXForm.prototype.items.multiselect = { + doLoadOpts: function (g, j, l) { + var c = g.childNodes[g._ll ? 1 : 0].childNodes[0]; + c.multiple = true; + if (!isNaN(j.size)) { + c.size = Number(j.size); + } + g._value = []; + g._newValue = []; + var e = j.options; + for (var h = 0; h < e.length; h++) { + var a = new Option(e[h].text || e[h].label, e[h].value); + c.options.add(a); + if (e[h].selected == true || e[h].selected == "true") { + a.selected = true; + g._value.push(e[h].value); + } + } + if (l === true) { + g.callEvent("onOptionsLoaded", [g._idd]); + } + this._checkNoteWidth(g); + }, + doAttachEvents: function (e) { + var a = e.childNodes[e._ll ? 1 : 0].childNodes[0]; + var c = this; + a.onfocus = function () { + c.doOnChange(this); + var g = this.parentNode.parentNode; + g.getForm().callEvent("onFocus", [g._idd]); + g = null; + }; + a.onblur = function () { + c.doOnChange(this); + var g = this.parentNode.parentNode; + g.getForm().callEvent("onBlur", [g._idd]); + g = null; + }; + a.onclick = function () { + c.doOnChange(this); + var g = this.parentNode.parentNode; + g._autoCheck(); + g = null; + }; + }, + doOnChange: function (g) { + var c = g.parentNode.parentNode; + c._newValue = []; + for (var e = 0; e < g.options.length; e++) { + if (g.options[e].selected) { + c._newValue.push(g.options[e].value); + } + } + if (c._value.sort().toString() != c._newValue.sort().toString()) { + if (c.checkEvent("onBeforeChange")) { + if (c.callEvent("onBeforeChange", [c._idd, c._value, c._newValue]) !== true) { + var a = {}; + for (var e = 0; e < c._value.length; e++) { + a[c._value[e]] = true; + } + for (var e = 0; e < g.options.length; e++) { + g.options[e].selected = a[g.options[e].value] == true; + } + a = null; + return; + } + } + c._value = []; + for (var e = 0; e < c._newValue.length; e++) { + c._value.push(c._newValue[e]); + } + c.callEvent("onChange", [c._idd, c._value]); + } + c._autoCheck(); + }, + setValue: function (e, h) { + var a = {}; + if (typeof h == "string") { + h = h.split(","); + } + if (typeof h != "object") { + h = [h]; + } + for (var g = 0; g < h.length; g++) { + a[h[g]] = true; + } + var c = this.getOptions(e); + for (var g = 0; g < c.length; g++) { + c[g].selected = a[c[g].value] == true; + } + e._autoCheck(); + }, + getValue: function (e) { + var a = []; + var c = this.getOptions(e); + for (var g = 0; g < c.length; g++) { + if (c[g].selected) { + a.push(c[g].value); + } + } + return a; + }, +}; +(function () { + for (var c in dhtmlXForm.prototype.items.select) { + if (!dhtmlXForm.prototype.items.multiselect[c]) { + dhtmlXForm.prototype.items.multiselect[c] = dhtmlXForm.prototype.items.select[c]; + } + } +})(); +dhtmlXForm.prototype.items.input = { + render: function (j, l) { + var h = !isNaN(l.rows); + j._type = "ta"; + j._enabled = true; + this.doAddLabel(j, l); + this.doAddInput(j, l, h ? "TEXTAREA" : "INPUT", h ? null : "TEXT", true, true, "dhxform_textarea"); + this.doAttachEvents(j); + if (h) { + j.childNodes[j._ll ? 1 : 0].childNodes[0].rows = Number(l.rows) + (window.dhx4.isIE6 ? 1 : 0); + } + if (typeof l.numberFormat != "undefined") { + var g, + e = null, + m = null; + if (typeof l.numberFormat != "string") { + g = l.numberFormat[0]; + e = l.numberFormat[1] || null; + m = l.numberFormat[2] || null; + } else { + g = l.numberFormat; + if (typeof l.groupSep == "string") { + e = l.groupSep; + } + if (typeof l.decSep == "string") { + m = l.decSep; + } + } + this.setNumberFormat(j, g, e, m, false); + } + this.setValue(j, l.value); + return this; + }, + doAttachEvents: function (c) { + var a = this; + if (c._type == "ta" || c._type == "se" || c._type == "pw") { + c.childNodes[c._ll ? 1 : 0].childNodes[0].onfocus = function () { + var e = this.parentNode.parentNode; + if (e._df != null) { + this.value = e._value || ""; + } + e.getForm()._ccActivate(e._idd, this, this.value); + e.getForm().callEvent("onFocus", [e._idd]); + e = null; + }; + } + c.childNodes[c._ll ? 1 : 0].childNodes[0].onblur = function () { + var e = this.parentNode.parentNode; + e.getForm()._ccDeactivate(e._idd); + a.updateValue(e, true); + if (e.getForm().live_validate) { + a._validate(e); + } + e.getForm().callEvent("onBlur", [e._idd]); + e = null; + }; + }, + updateValue: function (h, a) { + var j = h.childNodes[h._ll ? 1 : 0].childNodes[0].value; + var g = h.getForm(); + var c = g._ccActive == true && g._formLS != null && g._formLS[h._idd] != null; + g = null; + if (!c && h._df != null && j == window.dhx4.template._getFmtValue(h._value, h._df)) { + return; + } + if (!a && h._df != null && h._value == j && j == window.dhx4.template._getFmtValue(j, h._df)) { + return; + } + var e = this; + if (h._value != j) { + if (h.checkEvent("onBeforeChange")) { + if (h.callEvent("onBeforeChange", [h._idd, h._value, j]) !== true) { + if (h._df != null) { + e.setValue(h, h._value); + } else { + h.childNodes[h._ll ? 1 : 0].childNodes[0].value = h._value; + } + return; + } + } + if (h._df != null && a) { + e.setValue(h, j); + } else { + h._value = j; + } + h.callEvent("onChange", [h._idd, j]); + return; + } + if (h._df != null && a) { + this.setValue(h, h._value); + } + }, + setValue: function (e, g) { + e._value = typeof g != "undefined" && g != null ? g : ""; + var c = String(e._value) || ""; + var a = e.childNodes[e._ll ? 1 : 0].childNodes[0]; + if (e._df != null) { + c = window.dhx4.template._getFmtValue(c, e._df); + } + if (a.value != c) { + a.value = c; + e.getForm()._ccReload(e._idd, c); + } + a = null; + }, + getValue: function (a) { + var c = a.getForm(); + if (c._formLS && c._formLS[a._idd] != null) { + this.updateValue(a); + } + c = null; + return typeof a._value != "undefined" && a._value != null ? a._value : ""; + }, + setReadonly: function (a, c) { + a._ro = c === true; + if (a._ro) { + a.childNodes[a._ll ? 1 : 0].childNodes[0].setAttribute("readOnly", "true"); + } else { + a.childNodes[a._ll ? 1 : 0].childNodes[0].removeAttribute("readOnly"); + } + }, + isReadonly: function (a) { + if (!a._ro) { + a._ro = false; + } + return a._ro; + }, + getInput: function (a) { + return a.childNodes[a._ll ? 1 : 0].childNodes[0]; + }, + setNumberFormat: function (g, h, e, j, c) { + if (typeof c != "boolean") { + c = true; + } + if (h == "") { + g._df = null; + if (c) { + this.setValue(g, g._value); + } + return true; + } + if (typeof h != "string") { + return; + } + var a = window.dhx4.template._parseFmt(h, e, j); + if (a == false) { + return false; + } else { + g._df = a; + } + if (c) { + this.setValue(g, g._value); + } + return true; + }, +}; +(function () { + for (var c in { doAddLabel: 1, doAddInput: 1, destruct: 1, doUnloadNestedLists: 1, setText: 1, getText: 1, enable: 1, disable: 1, isEnabled: 1, setWidth: 1, setFocus: 1 }) { + dhtmlXForm.prototype.items.input[c] = dhtmlXForm.prototype.items.select[c]; + } +})(); +dhtmlXForm.prototype.items.password = { + render: function (a, c) { + a._type = "pw"; + a._enabled = true; + this.doAddLabel(a, c); + this.doAddInput(a, c, "INPUT", "PASSWORD", true, true, "dhxform_textarea"); + this.doAttachEvents(a); + this.setValue(a, c.value); + return this; + }, +}; +(function () { + for (var c in { + doAddLabel: 1, + doAddInput: 1, + doAttachEvents: 1, + destruct: 1, + doUnloadNestedLists: 1, + setText: 1, + getText: 1, + setValue: 1, + getValue: 1, + updateValue: 1, + enable: 1, + disable: 1, + isEnabled: 1, + setWidth: 1, + setReadonly: 1, + isReadonly: 1, + setFocus: 1, + getInput: 1, + }) { + dhtmlXForm.prototype.items.password[c] = dhtmlXForm.prototype.items.input[c]; + } +})(); +dhtmlXForm.prototype.items.file = { + render: function (e, g) { + e._type = "fl"; + e._enabled = true; + this.doAddLabel(e, g); + this.doAddInput(e, g, "INPUT", "FILE", true, false, "dhxform_textarea"); + var a = e.childNodes[e._ll ? 1 : 0].childNodes[0]; + var c = this; + a.onfocus = function () { + var h = this.parentNode.parentNode; + h.getForm().callEvent("onFocus", [h._idd]); + h = null; + }; + a.onblur = function () { + var h = this.parentNode.parentNode; + if (h.getForm().live_validate) { + c._validate(h); + } + h.getForm().callEvent("onBlur", [h._idd]); + h = null; + }; + a = null; + e.childNodes[e._ll ? 1 : 0].childNodes[0].onchange = function () { + e.callEvent("onChange", [e._idd, this.value]); + }; + return this; + }, + setValue: function () {}, + getValue: function (a) { + return a.childNodes[a._ll ? 1 : 0].childNodes[0].value; + }, +}; +(function () { + for (var c in { doAddLabel: 1, doAddInput: 1, destruct: 1, doUnloadNestedLists: 1, setText: 1, getText: 1, getInput: 1, enable: 1, disable: 1, isEnabled: 1, setWidth: 1 }) { + dhtmlXForm.prototype.items.file[c] = dhtmlXForm.prototype.items.input[c]; + } +})(); +dhtmlXForm.prototype.items.label = { + _index: false, + render: function (c, e) { + c._type = "lb"; + c._enabled = true; + c._checked = true; + var a = document.createElement("DIV"); + a.className = "dhxform_txt_label2" + (e._isTopmost ? " topmost" : ""); + a.innerHTML = e.label; + c.appendChild(a); + if (e.hidden == true) { + this.hide(c); + } + if (e.disabled == true) { + this.userDisable(c); + } + if (!isNaN(e.labelWidth)) { + a.style.width = parseInt(e.labelWidth) + "px"; + } + if (!isNaN(e.labelHeight)) { + a.style.height = parseInt(e.labelHeight) + "px"; + } + if (!isNaN(e.labelLeft)) { + a.style.left = parseInt(e.labelLeft) + "px"; + } + if (!isNaN(e.labelTop)) { + a.style.top = parseInt(e.labelTop) + "px"; + } + return this; + }, + destruct: function (a) { + this.doUnloadNestedLists(a); + a._autoCheck = null; + a._enabled = null; + a._type = null; + a.callEvent = null; + a.checkEvent = null; + a.getForm = null; + a.onselectstart = null; + a.parentNode.removeChild(a); + a = null; + }, + enable: function (a) { + if (String(a.className).search("disabled") >= 0) { + a.className = String(a.className).replace(/disabled/gi, ""); + } + a._enabled = true; + }, + disable: function (a) { + if (String(a.className).search("disabled") < 0) { + a.className += " disabled"; + } + a._enabled = false; + }, + setText: function (a, c) { + a.firstChild.innerHTML = c; + }, + getText: function (a) { + return a.firstChild.innerHTML; + }, +}; +(function () { + for (var c in { doUnloadNestedLists: 1, isEnabled: 1 }) { + dhtmlXForm.prototype.items.label[c] = dhtmlXForm.prototype.items.checkbox[c]; + } +})(); +dhtmlXForm.prototype.items.button = { + render: function (c, e) { + c._type = "bt"; + c._enabled = true; + c._name = e.name; + c.className = String(c.className).replace("item_label_top", "item_label_left").replace("item_label_right", "item_label_left"); + c._doOnKeyUpDown = function (h, g) { + this.callEvent(h, [this.childNodes[0].childNodes[0], g, this._idd]); + }; + c.innerHTML = '
' + e.value + '
'; + if (!isNaN(e.width)) { + var a = Math.max(e.width, 10); + if (dhtmlXForm.prototype.items[this.t]._dim == null) { + c.firstChild.style.width = a + "px"; + dhtmlXForm.prototype.items[this.t]._dim = c.getForm()._checkDim(c, c.firstChild); + } + c.firstChild.style.width = a - dhtmlXForm.prototype.items[this.t]._dim + "px"; + c.firstChild.firstChild.className += " dhxform_btn_txt_autowidth"; + } + if (!isNaN(e.inputLeft)) { + c.childNodes[0].style.left = parseInt(e.inputLeft) + "px"; + } + if (!isNaN(e.inputTop)) { + c.childNodes[0].style.top = parseInt(e.inputTop) + "px"; + } + if (e.hidden == true) { + this.hide(c); + } + if (e.disabled == true) { + this.userDisable(c); + } + if (typeof e.tooltip != "undefined") { + c.firstChild.title = e.tooltip; + } + c.onselectstart = function (g) { + g = g || event; + g.cancelBubble = true; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + return false; + }; + c.firstChild.onselectstart = function (g) { + g = g || event; + g.cancelBubble = true; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + return false; + }; + c.firstChild.onkeypress = function (g) { + g = g || event; + if ((g.keyCode == 32 || g.charCode == 32 || g.keyCode == 13 || g.charCode == 13) && !this.parentNode._busy) { + this.parentNode._busy = true; + g.cancelBubble = true; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + _dhxForm_doClick(this.childNodes[0], ["mousedown", "mouseup"]); + return false; + } + }; + c.firstChild.onfocus = function () { + this.parentNode._doOnFocus(this.parentNode); + }; + c.firstChild.onblur = function () { + _dhxForm_doClick(this.childNodes[0], "mouseout"); + this.parentNode._doOnBlur(this.parentNode); + }; + c.firstChild.onkeyup = function (g) { + this.parentNode._doOnKeyUpDown("onKeyUp", g || event); + }; + c.firstChild.onkeydown = function (g) { + this.parentNode._doOnKeyUpDown("onKeyDown", g || event); + }; + c.firstChild.onmouseover = function () { + var g = this.parentNode; + if (!g._enabled) { + return; + } + this._isOver = true; + this.className = "dhxform_btn dhxform_btn_over"; + g = null; + }; + c.firstChild.onmouseout = function () { + var g = this.parentNode; + if (!g._enabled) { + return; + } + this.className = "dhxform_btn"; + this._allowClick = false; + this._pressed = false; + this._isOver = false; + g = null; + }; + c.firstChild.ontouchstart = c.firstChild.onmousedown = function (h) { + h = h || event; + if (h.type == "touchstart" && h.preventDefault) { + h.preventDefault(); + } + if (h.button >= 2) { + return; + } + if (this._pressed) { + return; + } + var g = this.parentNode; + if (!g._enabled) { + return; + } + this.className = "dhxform_btn dhxform_btn_pressed"; + this._allowClick = true; + this._pressed = true; + g = null; + }; + c.firstChild.ontouchend = c.firstChild.onmouseup = function (h) { + h = h || event; + if (h.button >= 2) { + return; + } + if (!this._pressed) { + return; + } + var g = this.parentNode; + if (!g._enabled) { + return; + } + g._busy = false; + this.className = "dhxform_btn" + (this._isOver ? " dhxform_btn_over" : ""); + if (this._pressed && this._allowClick) { + g.callEvent("_onButtonClick", [g._name, g._cmd]); + } + this._allowClick = false; + this._pressed = false; + g = null; + }; + c._doOnFocus = function (g) { + g.getForm().callEvent("onFocus", [g._idd]); + }; + c._doOnBlur = function (g) { + g.getForm().callEvent("onBlur", [g._idd]); + }; + return this; + }, + destruct: function (a) { + this.doUnloadNestedLists(a); + a.callEvent = null; + a.checkEvent = null; + a.getForm = null; + a._autoCheck = null; + a._type = null; + a._enabled = null; + a._cmd = null; + a._name = null; + a._doOnFocus = null; + a._doOnBlur = null; + a._doOnKeyUpDown = null; + a.onselectstart = null; + a.firstChild.onselectstart = null; + a.firstChild.onkeypress = null; + a.firstChild.ontouchstart = null; + a.firstChild.ontouchend = null; + a.firstChild.onfocus = null; + a.firstChild.onblur = null; + a.firstChild.onkeyup = null; + a.firstChild.onkeydown = null; + a.firstChild.onmouseover = null; + a.firstChild.onmouseout = null; + a.firstChild.onmousedown = null; + a.firstChild.onmouseup = null; + while (a.childNodes.length > 0) { + a.removeChild(a.childNodes[0]); + } + a.parentNode.removeChild(a); + a = null; + }, + enable: function (a) { + if (String(a.className).search("disabled") >= 0) { + a.className = String(a.className).replace(/disabled/gi, ""); + } + a._enabled = true; + a.childNodes[0].removeAttribute("disabled"); + a.childNodes[0].setAttribute("role", "link"); + a.childNodes[0].setAttribute("tabIndex", "0"); + }, + disable: function (a) { + if (String(a.className).search("disabled") < 0) { + a.className += " disabled"; + } + a._enabled = false; + a.childNodes[0].setAttribute("disabled", "true"); + a.childNodes[0].removeAttribute("role"); + a.childNodes[0].removeAttribute("tabIndex"); + }, + setText: function (a, c) { + a.childNodes[0].childNodes[0].innerHTML = c; + }, + getText: function (a) { + return a.childNodes[0].childNodes[0].innerHTML; + }, + setFocus: function (a) { + a.childNodes[0].focus(); + }, +}; +(function () { + for (var c in { doUnloadNestedLists: 1, isEnabled: 1 }) { + dhtmlXForm.prototype.items.button[c] = dhtmlXForm.prototype.items.checkbox[c]; + } +})(); +dhtmlXForm.prototype.items.hidden = { + _index: false, + render: function (c, e) { + c.style.display = "none"; + c._name = e.name; + c._type = "hd"; + c._enabled = true; + var a = document.createElement("INPUT"); + a.type = "HIDDEN"; + a.name = e.name; + a.value = e.value || ""; + c.appendChild(a); + return this; + }, + destruct: function (a) { + this.doUnloadNestedLists(a); + while (a.childNodes.length > 0) { + a.removeChild(a.childNodes[0]); + } + a._autoCheck = null; + a._name = null; + a._type = null; + a._enabled = null; + a.onselectstart = null; + a.callEvent = null; + a.checkEvent = null; + a.getForm = null; + a.parentNode.removeChild(a); + a = null; + }, + enable: function (a) { + a._enabled = true; + a.childNodes[0].setAttribute("name", a._name); + }, + disable: function (a) { + a._enabled = false; + a.childNodes[0].removeAttribute("name"); + }, + show: function () {}, + hide: function () {}, + isHidden: function () { + return true; + }, + setValue: function (a, c) { + a.childNodes[0].value = c; + }, + getValue: function (a) { + return a.childNodes[0].value; + }, + getInput: function (a) { + return a.childNodes[0]; + }, +}; +(function () { + for (var c in { doUnloadNestedLists: 1, isEnabled: 1 }) { + dhtmlXForm.prototype.items.hidden[c] = dhtmlXForm.prototype.items.checkbox[c]; + } +})(); +dhtmlXForm.prototype.items.list = { + _index: false, + render: function (a, c) { + a._type = "list"; + a._enabled = true; + a._isNestedForm = true; + a.style.paddingLeft = a._ofsNested + "px"; + a.className = "dhxform_base_nested" + (a._custom_css || ""); + return [this, new dhtmlXForm(a, null, c)]; + }, + destruct: function (a) {}, +}; +dhtmlXForm.prototype.items.fieldset = { + _index: false, + render: function (c, g) { + c._type = "fs"; + if (typeof parseInt(g.inputWidth) == "number") { + } + c._width = g.width; + c._enabled = true; + c._checked = true; + c.className = "fs_" + g.position + (typeof g.className == "string" ? " " + g.className : ""); + var e = document.createElement("FIELDSET"); + e.className = "dhxform_fs"; + var h = String(g.labelAlign).replace("align_", ""); + e.innerHTML = "" + g.label + ""; + c.appendChild(e); + if (!isNaN(g.inputLeft)) { + e.style.left = parseInt(g.inputLeft) + "px"; + } + if (!isNaN(g.inputTop)) { + e.style.top = parseInt(g.inputTop) + "px"; + } + if (g.inputWidth != "auto") { + if (!isNaN(g.inputWidth)) { + e.style.width = parseInt(g.inputWidth) + "px"; + var a = parseInt(e.style.width); + if (e.offsetWidth > a) { + e.style.width = a + (a - e.offsetWidth) + "px"; + } + } + } + c._addSubListNode = function () { + var j = document.createElement("DIV"); + j._custom_css = " dhxform_fs_nested"; + this.childNodes[0].appendChild(j); + return j; + }; + if (g.hidden == true) { + this.hide(c); + } + if (g.disabled == true) { + this.userDisable(c); + } + return this; + }, + destruct: function (a) { + this.doUnloadNestedLists(a); + a._checked = null; + a._enabled = null; + a._idd = null; + a._type = null; + a._width = null; + a.onselectstart = null; + a._addSubListNode = null; + a._autoCheck = null; + a.callEvent = null; + a.checkEvent = null; + a.getForm = null; + while (a.childNodes.length > 0) { + a.removeChild(a.childNodes[0]); + } + a.parentNode.removeChild(a); + a = null; + }, + setText: function (a, c) { + a.childNodes[0].childNodes[0].innerHTML = c; + }, + getText: function (a) { + return a.childNodes[0].childNodes[0].innerHTML; + }, + enable: function (a) { + a._enabled = true; + if (String(a.className).search("disabled") >= 0) { + a.className = String(a.className).replace(/disabled/gi, ""); + } + }, + disable: function (a) { + a._enabled = false; + if (String(a.className).search("disabled") < 0) { + a.className += " disabled"; + } + }, + setWidth: function (c, a) { + c.childNodes[0].style.width = a + "px"; + c._width = a; + }, + getWidth: function (a) { + return a._width; + }, +}; +(function () { + for (var c in { doUnloadNestedLists: 1, isEnabled: 1 }) { + dhtmlXForm.prototype.items.fieldset[c] = dhtmlXForm.prototype.items.checkbox[c]; + } +})(); +dhtmlXForm.prototype.items.block = { + _index: false, + render: function (c, e) { + c._type = "bl"; + c._width = e.width; + c._enabled = true; + c._checked = true; + c.className = "block_" + e.position + (typeof e.className == "string" ? " " + e.className : ""); + var a = document.createElement("DIV"); + a.className = "dhxform_obj_" + c.getForm().skin + " dhxform_block"; + a.style.fontSize = c.getForm().cont.style.fontSize; + if (e.style) { + a.style.cssText = e.style; + } + if (typeof e.id != "undefined") { + a.id = e.id; + } + c.appendChild(a); + if (!isNaN(e.inputLeft)) { + a.style.left = parseInt(e.inputLeft) + "px"; + } + if (!isNaN(e.inputTop)) { + a.style.top = parseInt(e.inputTop) + "px"; + } + if (e.inputWidth != "auto") { + if (!isNaN(e.inputWidth)) { + a.style.width = parseInt(e.inputWidth) + "px"; + } + } + if (!isNaN(e.blockOffset)) { + c._ofsNested = e.blockOffset; + } + c._addSubListNode = function () { + var g = document.createElement("DIV"); + g._inBlcok = true; + if (typeof this._ofsNested != "undefined") { + g._ofsNested = this._ofsNested; + } + this.childNodes[0].appendChild(g); + return g; + }; + if (e.hidden == true) { + this.hide(c); + } + if (e.disabled == true) { + this.userDisable(c); + } + return this; + }, + _setCss: function (a, e, c) { + a.firstChild.className = "dhxform_obj_" + e + " dhxform_block"; + a.firstChild.style.fontSize = c; + }, +}; +(function () { + for (var c in { enable: 1, disable: 1, isEnabled: 1, setWidth: 1, getWidth: 1, doUnloadNestedLists: 1, destruct: 1 }) { + dhtmlXForm.prototype.items.block[c] = dhtmlXForm.prototype.items.fieldset[c]; + } +})(); +dhtmlXForm.prototype.items.newcolumn = { _index: false }; +dhtmlXForm.prototype.items.template = { + render: function (c, e) { + var a = !isNaN(e.rows); + c._type = "tp"; + c._enabled = true; + if (e.format != null) { + if (typeof e.format == "function") { + c.format = e.format; + } else { + if (typeof e.format == "string" && typeof window[e.format] == "function") { + c.format = window[e.format]; + } + } + } + if (c.format == null) { + c.format = function (g, h) { + return h; + }; + } + this.doAddLabel(c, e); + this.doAddInput(c, e, "DIV", null, true, true, "dhxform_item_template"); + this.setValue(c, e.value || ""); + return this; + }, + destruct: function (a) { + a.format = null; + this.d2(a); + a = null; + }, + setValue: function (a, c) { + a._value = c; + a.childNodes[a._ll ? 1 : 0].childNodes[0].innerHTML = a.format(a._idd, a._value); + }, + getValue: function (a) { + return a._value; + }, + enable: function (a) { + if (String(a.className).search("disabled") >= 0) { + a.className = String(a.className).replace(/disabled/gi, ""); + } + a._enabled = true; + }, + disable: function (a) { + if (String(a.className).search("disabled") < 0) { + a.className += " disabled"; + } + a._enabled = false; + }, +}; +(function () { + dhtmlXForm.prototype.items.template.d2 = dhtmlXForm.prototype.items.input.destruct; + for (var c in { doAddLabel: 1, doAddInput: 1, doUnloadNestedLists: 1, setText: 1, getText: 1, isEnabled: 1, setWidth: 1 }) { + dhtmlXForm.prototype.items.template[c] = dhtmlXForm.prototype.items.select[c]; + } +})(); +dhtmlXForm.prototype._ulToObject = function (j, o) { + var l = []; + for (var c = 0; c < j.childNodes.length; c++) { + if (String(j.childNodes[c].tagName || "").toLowerCase() == "li") { + var g = {}; + var s = j.childNodes[c]; + for (var r = 0; r < o.length; r++) { + if (s.getAttribute(o[r]) != null) { + g[String(o[r]).replace("ftype", "type")] = s.getAttribute(o[r]); + } + } + if (!g.label) { + try { + g.label = s.firstChild.nodeValue; + } catch (m) {} + } + var h = s.getElementsByTagName("UL"); + if (h[0] != null) { + g[g.type == "select" ? "options" : "list"] = dhtmlXForm.prototype._ulToObject(h[0], o); + } + for (var r = 0; r < s.childNodes.length; r++) { + if (String(s.childNodes[r].tagName || "").toLowerCase() == "userdata") { + if (!g.userdata) { + g.userdata = {}; + } + g.userdata[s.childNodes[r].getAttribute("name")] = s.childNodes[r].firstChild.nodeValue; + } + } + l[l.length] = g; + } + if (String(j.childNodes[c].tagName || "").toLowerCase() == "div") { + var g = {}; + g.type = "label"; + try { + g.label = j.childNodes[c].firstChild.nodeValue; + } catch (m) {} + l[l.length] = g; + } + } + return l; +}; +dhtmlXForm.prototype.setUserData = function (h, e, g, a) { + if (typeof a != "undefined") { + var c = this.doWithItem([h, e], "_getId"); + if (c != null) { + h = c; + e = g; + g = a; + } + } + if (!this._userdata) { + this._userdata = {}; + } + this._userdata[h] = this._userdata[h] || {}; + this._userdata[h][e] = g; +}; +dhtmlXForm.prototype.getUserData = function (g, e, a) { + if (typeof a != "undefined") { + var c = this.doWithItem([g, e], "_getId"); + if (c != null) { + g = c; + e = a; + } + } + if (this._userdata != null && typeof this._userdata[g] != "undefined" && typeof this._userdata[g][e] != "undefined") { + return this._userdata[g][e]; + } + return ""; +}; +dhtmlXForm.prototype.setRTL = function (a) { + this._rtl = a === true ? true : false; + if (this._rtl) { + if (String(this.cont).search(/dhxform_rtl/gi) < 0) { + this.cont.className += " dhxform_rtl"; + } + } else { + if (String(this.cont).search(/dhxform_rtl/gi) >= 0) { + this.cont.className = String(this.cont.className).replace(/dhxform_rtl/gi, ""); + } + } +}; +_dhxForm_doClick = function (h, c) { + if (typeof c == "object") { + var a = c[1]; + c = c[0]; + } + if (document.createEvent) { + var g = document.createEvent("MouseEvents"); + g.initEvent(c, true, false); + h.dispatchEvent(g); + } else { + if (document.createEventObject) { + var g = document.createEventObject(); + g.button = 1; + h.fireEvent("on" + c, g); + } + } + if (a) { + window.setTimeout(function () { + _dhxForm_doClick(h, a); + }, 100); + } +}; +dhtmlXForm.prototype.setFormData = function (e) { + for (var c in e) { + var g = this.getItemType(c); + switch (g) { + case "checkbox": + this[e[c] == true || parseInt(e[c]) == 1 || e[c] == "true" || e[c] == this.getItemValue(c, "realvalue") ? "checkItem" : "uncheckItem"](c); + break; + case "radio": + this.checkItem(c, e[c]); + break; + case "input": + case "textarea": + case "password": + case "select": + case "multiselect": + case "hidden": + case "template": + case "combo": + case "calendar": + case "colorpicker": + case "editor": + this.setItemValue(c, e[c]); + break; + default: + if (this["setFormData_" + g]) { + this["setFormData_" + g](c, e[c]); + } else { + if (!this.hId) { + this.hId = this._genStr(12); + } + this.setUserData(this.hId, c, e[c]); + } + break; + } + } +}; +dhtmlXForm.prototype.getFormData = function (u, j) { + var c = {}; + var n = this; + for (var s in this.itemPull) { + var m = this.itemPull[s]._idd; + var v = this.itemPull[s]._type; + if (v == "ch") { + c[m] = this.isItemChecked(m) ? this.getItemValue(m) : 0; + } + if (v == "ra" && !c[this.itemPull[s]._group]) { + c[this.itemPull[s]._group] = this.getCheckedValue(this.itemPull[s]._group); + } + if (v in { se: 1, ta: 1, pw: 1, hd: 1, tp: 1, fl: 1, calendar: 1, combo: 1, editor: 1, colorpicker: 1 }) { + c[m] = this.getItemValue(m, u); + } + if (this["getFormData_" + v]) { + c[m] = this["getFormData_" + v](m); + } + if (v == "up") { + var h = this.getItemValue(m); + for (var g in h) { + c[g] = h[g]; + } + } + if (this.itemPull[s]._list) { + for (var e = 0; e < this.itemPull[s]._list.length; e++) { + var l = this.itemPull[s]._list[e].getFormData(u, j); + for (var o in l) { + c[o] = l[o]; + } + } + } + } + if (!j && this.hId && this._userdata[this.hId]) { + for (var s in this._userdata[this.hId]) { + if (!c[s]) { + c[s] = this._userdata[this.hId][s]; + } + } + } + return c; +}; +dhtmlXForm.prototype.adjustParentSize = function () { + var j = 0; + var h = -1; + for (var l = 0; l < this.base.length; l++) { + j += this.base[l].firstChild.offsetWidth; + if (this.base[l].offsetHeight > h) { + h = this.base[l].offsetHeight; + } + } + var g = false; + try { + g = this.cont.parentNode.parentNode.parentNode.parentNode._isCell == true; + if (g) { + var a = this.cont.parentNode.parentNode.parentNode.parentNode; + } + } catch (m) {} + if (g && typeof a != "undefined") { + if (j > 0) { + a.setWidth(j + 10); + } + if (h > 0) { + a.setHeight(h + a.firstChild.firstChild.offsetHeight + 5); + } + g = a = null; + return; + } + var c = false; + try { + c = this.cont.parentNode.parentNode.parentNode._isWindow == true; + if (c) { + var n = this.cont.parentNode.parentNode; + if (typeof n.callEvent == "function") { + this.cont.style.display = "none"; + n.callEvent("_setCellSize", [j + 15, h + 15]); + this.cont.style.display = ""; + } + } + } catch (m) {} +}; +dhtmlXForm.prototype.reset = function () { + if (this.callEvent("onBeforeReset", [this.formId, this.getFormData()])) { + if (this._last_load_data) { + this.setFormData(this._last_load_data); + } + this.callEvent("onAfterReset", [this.formId]); + } +}; +dhtmlXForm.prototype.send = function (c, l, m, g) { + if (typeof l == "function") { + m = l; + l = "post"; + } else { + l = l == "get" ? "get" : "post"; + } + if (g !== true && !this.validate()) { + return; + } + var j = this.getFormData(true); + var h = []; + for (var e in j) { + h.push(e + "=" + encodeURIComponent(j[e])); + } + var a = function (n) { + if (m) { + m.call(this, n, n.xmlDoc.responseText); + } + }; + if (l == "get") { + window.dhx4.ajax.get(c + (c.indexOf("?") == -1 ? "?" : "&") + h.join("&"), a); + } else { + window.dhx4.ajax.post(c, h.join("&"), a); + } +}; +dhtmlXForm.prototype.save = function (a, c) {}; +dhtmlXForm.prototype.dummy = function () {}; +dhtmlXForm.prototype._changeFormId = function (c, a) { + this.formId = a; +}; +dhtmlXForm.prototype._dp_init = function (a) { + a._methods = ["dummy", "dummy", "_changeFormId", "dummy"]; + a._getRowData = function (g, c) { + var e = this.obj.getFormData(true); + e[this.action_param] = this.obj.getUserData(g, this.action_param); + return e; + }; + a._clearUpdateFlag = function () {}; + a.attachEvent("onAfterUpdate", function (e, g, h, c) { + if (g == "inserted" || g == "updated") { + this.obj.resetDataProcessor("updated"); + this.obj._last_load_data = this.obj.getFormData(true); + } + this.obj.callEvent("onAfterSave", [this.obj.formId, c]); + return true; + }); + a.autoUpdate = false; + a.setTransactionMode("POST", true); + this.dp = a; + this.formId = new Date().valueOf(); + this.resetDataProcessor("inserted"); + this.save = function () { + if (!this.callEvent("onBeforeSave", [this.formId, this.getFormData()])) { + return; + } + if (!this.validate()) { + return; + } + a.sendData(); + }; +}; +dhtmlXForm.prototype.resetDataProcessor = function (a) { + if (!this.dp) { + return; + } + this.dp.updatedRows = []; + this.dp._in_progress = []; + this.dp.setUpdated(this.formId, true, a); +}; +dhtmlXForm.prototype._ccActivate = function (e, a, c) { + if (!this._formLS) { + this._formLS = {}; + } + if (!this._formLS[e]) { + this._formLS[e] = { input: a, value: c }; + } + if (!this._ccActive) { + this._ccActive = true; + this._ccDo(); + } + a = null; +}; +dhtmlXForm.prototype._ccDeactivate = function (a) { + if (this._ccTm) { + window.clearTimeout(this._ccTm); + } + this._ccActive = false; + if (this._formLS != null && this._formLS[a] != null) { + this._formLS[a].input = null; + this._formLS[a] = null; + delete this._formLS[a]; + } +}; +dhtmlXForm.prototype._ccDo = function () { + if (this._ccTm) { + window.clearTimeout(this._ccTm); + } + for (var c in this._formLS) { + var h = this._formLS[c].input; + if (String(h.tagName).toLowerCase() == "select") { + var e = ""; + if (h.selectedIndex >= 0 && h.selectedIndex < h.options.length) { + e = h.options[h.selectedIndex].value; + } + } else { + var e = h.value; + } + if (e != this._formLS[c].value) { + this._formLS[c].value = e; + this.callEvent("onInputChange", [h._idd, e, this]); + } + h = null; + } + if (this._ccActive) { + var g = this; + this._ccTm = window.setTimeout(function () { + g._ccDo(); + g = null; + }, 100); + } +}; +dhtmlXForm.prototype._ccReload = function (c, a) { + if (this._formLS && this._formLS[c]) { + this._formLS[c].value = a; + } +}; +dhtmlXForm.prototype._checkDim = function (l, j) { + var g = document.createElement("DIV"); + g.className = "dhxform_obj_" + this.skin; + g.style.cssText += dhx4.isIE6 == true ? "visibility:hidden;" : "position:absolute;left:-2000px;top:-1000px;"; + document.body.appendChild(g); + var h = l.parentNode; + var c = l.nextSibling; + g.appendChild(l); + var e = parseInt(j.style.width); + var a = dhx4.isFF || dhx4.isIE || dhx4.isChrome || dhx4.isOpera ? j.offsetWidth : j.clientWidth; + var m = a - e; + if (c != null) { + h.insertBefore(l, c); + } else { + h.appendChild(l); + } + g.parentNode.removeChild(g); + h = c = g = l = j = null; + return m; +}; +dhtmlXForm.prototype._autoload = function () { + var c = [ + "ftype", + "name", + "value", + "label", + "check", + "checked", + "disabled", + "text", + "rows", + "select", + "selected", + "width", + "style", + "className", + "labelWidth", + "labelHeight", + "labelLeft", + "labelTop", + "inputWidth", + "inputHeight", + "inputLeft", + "inputTop", + "position", + "size", + ]; + var e = document.getElementsByTagName("UL"); + var g = []; + for (var l = 0; l < e.length; l++) { + if (e[l].className == "dhtmlxForm") { + var j = document.createElement("DIV"); + g[g.length] = { nodeUL: e[l], nodeForm: j, data: dhtmlXForm.prototype._ulToObject(e[l], c), name: e[l].getAttribute("name") || null }; + } + } + for (var l = 0; l < g.length; l++) { + g[l].nodeUL.parentNode.insertBefore(g[l].nodeForm, g[l].nodeUL); + var m = new dhtmlXForm(g[l].nodeForm, g[l].data); + if (g[l].name !== null) { + window[g[l].name] = m; + } + var h = g[l].nodeUL.getAttribute("oninit") || null; + g[l].nodeUL.parentNode.removeChild(g[l].nodeUL); + g[l].nodeUL = null; + g[l].nodeForm = null; + g[l].data = null; + g[l] = null; + if (h) { + if (typeof h == "function") { + h(); + } else { + if (typeof window[h] == "function") { + window[h](); + } + } + } + } + if (typeof window.addEventListener == "function") { + window.removeEventListener("load", dhtmlXForm.prototype._autoload, false); + } else { + window.detachEvent("onload", dhtmlXForm.prototype._autoload); + } +}; +if (typeof window.addEventListener == "function") { + window.addEventListener("load", dhtmlXForm.prototype._autoload, false); +} else { + window.attachEvent("onload", dhtmlXForm.prototype._autoload); +} +if (typeof window.dhtmlXCellObject != "undefined") { + dhtmlXCellObject.prototype.attachForm = function (a) { + this.callEvent("_onBeforeContentAttach", ["form"]); + var c = document.createElement("DIV"); + c.style.width = "100%"; + c.style.height = "100%"; + c.style.position = "relative"; + if (window.dhtmlx && dhtmlx.$customScroll) { + dhtmlx.CustomScroll.enable(c); + } else { + c.style.overflow = "auto"; + } + this._attachObject(c); + this.dataType = "form"; + this.dataObj = new dhtmlXForm(c, a); + this.dataObj.setSkin(this.conf.skin); + c = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; + }; +} +dhtmlXForm.prototype.items.combo = { + render: function (c, e) { + c._type = "combo"; + c._enabled = true; + c._value = null; + c._newValue = null; + this.doAddLabel(c, e); + this.doAddInput(c, e, "SELECT", null, true, true, "dhxform_select"); + this.doAttachEvents(c); + this.doLoadOpts(c, e); + c.onselectstart = function (g) { + return true; + }; + c.childNodes[c._ll ? 1 : 0].childNodes[0].setAttribute("mode", e.comboType || ""); + if (e.comboImagePath) { + c.childNodes[c._ll ? 1 : 0].childNodes[0].setAttribute("imagePath", e.comboImagePath); + } + if (e.comboDefaultImage) { + c.childNodes[c._ll ? 1 : 0].childNodes[0].setAttribute("defaultImage", e.comboDefaultImage); + } + if (e.comboDefaultImageDis) { + c.childNodes[c._ll ? 1 : 0].childNodes[0].setAttribute("defaultImageDis", e.comboDefaultImageDis); + } + c._combo = new dhtmlXComboFromSelect(c.childNodes[c._ll ? 1 : 0].childNodes[0]); + c._combo.setSkin(c.getForm().skin); + c._combo._currentComboValue = c._combo.getSelectedValue(); + c._combo.getInput().id = e.uid; + var a = this; + c._combo.attachEvent("onChange", function () { + a.doOnChange(this); + }); + if (e.connector) { + this.doLoadOptsConnector(c, e.connector); + } + if (e.filtering) { + c._combo.enableFilteringMode(true); + } else { + if (e.serverFiltering) { + c._combo.enableFilteringMode(true, e.serverFiltering, e.filterCache, e.filterSubLoad); + } + } + if (e.readonly == true) { + this.setReadonly(c, true); + } + if (e.style) { + c._combo.DOMelem_input.style.cssText += e.style; + } + c._combo.attachEvent("onFocus", function () { + var g = this.cont.parentNode.parentNode; + var h = g.getForm(); + if (h.skin == "dhx_terrace" && this.cont.className.search(/combo_in_focus/) < 0) { + this.cont.className += " combo_in_focus"; + } + h.callEvent("onFocus", [g._idd]); + h = g = null; + }); + c._combo.attachEvent("onBlur", function () { + var g = this.cont.parentNode.parentNode; + var h = g.getForm(); + if (h.skin == "dhx_terrace" && this.cont.className.search(/combo_in_focus/) >= 0) { + this.cont.className = this.cont.className.replace(/\s{0,}combo_in_focus/gi, ""); + } + h.callEvent("onBlur", [g._idd]); + h = g = null; + }); + return this; + }, + destruct: function (a) { + a.childNodes[a._ll ? 1 : 0].childNodes[0].onchange = null; + a._combo._currentComboValue = null; + a._combo.unload(); + a._combo = null; + a._apiChange = null; + this.d2(a); + a = null; + }, + doAttachEvents: function (c) { + var a = this; + c.childNodes[c._ll ? 1 : 0].childNodes[0].onchange = function () { + a.doOnChange(this); + a.doValidate(this.DOMParent.parentNode.parentNode); + }; + }, + doValidate: function (a) { + if (a.getForm().hot_validate) { + this._validate(a); + } + }, + doOnChange: function (c) { + var a = c.base.parentNode.parentNode.parentNode; + if (a._apiChange) { + return; + } + c._newComboValue = c.getSelectedValue(); + if (c._newComboValue != c._currentComboValue) { + if (a.checkEvent("onBeforeChange")) { + if (a.callEvent("onBeforeChange", [a._idd, c._currentComboValue, c._newComboValue]) !== true) { + window.setTimeout(function () { + c.setComboValue(c._currentComboValue); + }, 1); + return false; + } + } + c._currentComboValue = c._newComboValue; + a.callEvent("onChange", [a._idd, c._currentComboValue]); + } + a._autoCheck(a._enabled); + }, + doLoadOptsConnector: function (g, a) { + var e = this; + var c = g; + g._connector_working = true; + g._apiChange = true; + g._combo.load(a, function () { + c.callEvent("onOptionsLoaded", [c._idd]); + c._connector_working = false; + if (c._connector_value != null) { + e.setValue(c, c._connector_value); + c._connector_value = null; + } + c._apiChange = false; + e = c = null; + }); + }, + enable: function (a) { + if (String(a.className).search("disabled") >= 0) { + a.className = String(a.className).replace(/disabled/gi, ""); + } + a._enabled = true; + a._combo.enable(); + }, + disable: function (a) { + if (String(a.className).search("disabled") < 0) { + a.className += " disabled"; + } + a._enabled = false; + a._combo.disable(); + }, + getCombo: function (a) { + return a._combo; + }, + setValue: function (a, c) { + if (a._connector_working) { + a._connector_value = c; + return; + } + a._apiChange = true; + a._combo.setComboValue(c); + a._combo._currentComboValue = a._combo.getActualValue(); + a._apiChange = false; + }, + getValue: function (a) { + return a._combo.getActualValue(); + }, + setWidth: function (c, a) { + c.childNodes[c._ll ? 1 : 0].childNodes[0].style.width = a + "px"; + }, + setReadonly: function (a, c) { + if (!a._combo) { + return; + } + a._combo_ro = c; + a._combo.readonly(a._combo_ro); + }, + isReadonly: function (a, c) { + return a._combo_ro || false; + }, + setFocus: function (a) { + if (a._enabled) { + a._combo.setFocus(); + } + }, + _setCss: function (a, e, c) { + a._combo.setFontSize(c, c); + }, +}; +(function () { + for (var c in { doAddLabel: 1, doAddInput: 1, doLoadOpts: 1, doUnloadNestedLists: 1, setText: 1, getText: 1, isEnabled: 1, _checkNoteWidth: 1 }) { + dhtmlXForm.prototype.items.combo[c] = dhtmlXForm.prototype.items.select[c]; + } +})(); +dhtmlXForm.prototype.items.combo.d2 = dhtmlXForm.prototype.items.select.destruct; +dhtmlXForm.prototype.getCombo = function (a) { + return this.doWithItem(a, "getCombo"); +}; +dhtmlXForm.prototype.items.calendar = { + render: function (e, h) { + var c = this; + e._type = "calendar"; + e._enabled = true; + var j = navigator.userAgent; + var a = j.indexOf("MSIE 6.0") >= 0 || j.indexOf("MSIE 7.0") >= 0 || j.indexOf("MSIE 8.0") >= 0; + this.doAddLabel(e, h); + this.doAddInput(e, h, "INPUT", "TEXT", true, true, "dhxform_textarea calendar"); + this.doAttachChangeLS(e); + if (a) { + e.childNodes[e._ll ? 1 : 0].childNodes[0].onfocus2 = e.childNodes[e._ll ? 1 : 0].childNodes[0].onfocus; + e.childNodes[e._ll ? 1 : 0].childNodes[0].onfocus = function () { + if (this._skipOnFocus == true) { + this._skipOnFocus = false; + return; + } + this.onfocus2.apply(this, arguments); + }; + } + e.childNodes[e._ll ? 1 : 0].childNodes[0]._idd = e._idd; + e.childNodes[e._ll ? 1 : 0].childNodes[0].onblur = function () { + var l = this.parentNode.parentNode; + if (l._c.base._formMouseDown) { + l._c.base._formMouseDown = false; + this._skipOnFocus = true; + this.focus(); + this.value = this.value; + l = null; + return true; + } + var m = l.getForm(); + m._ccDeactivate(l._idd); + c.checkEnteredValue(this.parentNode.parentNode); + if (m.live_validate) { + c._validate(l); + } + m.callEvent("onBlur", [l._idd]); + if (!l._c.isVisible()) { + l._tempValue = null; + } + m = l = null; + }; + e._f = h.dateFormat || null; + e._f0 = h.serverDateFormat || e._f; + var g = e.getForm(); + e._c = new dhtmlXCalendarObject(e.childNodes[e._ll ? 1 : 0].childNodes[0], h.skin || g.skin || "dhx_skyblue"); + e._c._nullInInput = true; + e._c.enableListener(e.childNodes[e._ll ? 1 : 0].childNodes[0]); + if (e._f != null) { + e._c.setDateFormat(e._f); + } + if (!window.dhx4.s2b(h.enableTime)) { + e._c.hideTime(); + } + if (window.dhx4.s2b(h.showWeekNumbers)) { + e._c.showWeekNumbers(); + } + if (!isNaN(h.weekStart)) { + e._c.setWeekStartDay(h.weekStart); + } + if (typeof h.calendarPosition != "undefined") { + e._c.setPosition(h.calendarPosition); + } + if (h.minutesInterval != null) { + e._c.setMinutesInterval(h.minutesInterval); + } + e._c._itemIdd = e._idd; + e._c.attachEvent("onBeforeChange", function (l) { + if (e._value != l) { + if (e.checkEvent("onBeforeChange")) { + if (e.callEvent("onBeforeChange", [e._idd, e._value, l]) !== true) { + return false; + } + } + e._tempValue = e._value = l; + c.setValue(e, l, false); + e.callEvent("onChange", [this._itemIdd, e._value]); + } + return true; + }); + e._c.attachEvent("onClick", function () { + e._tempValue = null; + }); + e._c.attachEvent("onHide", function () { + e._tempValue = null; + }); + if (a) { + e._c.base.onmousedown = function () { + this._formMouseDown = true; + return false; + }; + } + this.setValue(e, h.value); + g = null; + return this; + }, + getCalendar: function (a) { + return a._c; + }, + setSkin: function (a, c) { + a._c.setSkin(c); + }, + setValue: function (c, e, a) { + if (!e || e == null || typeof e == "undefined" || e == "") { + c._value = null; + c.childNodes[c._ll ? 1 : 0].childNodes[0].value = ""; + } else { + c._value = e instanceof Date ? e : c._c._strToDate(e, c._f0 || c._c._dateFormat); + c.childNodes[c._ll ? 1 : 0].childNodes[0].value = c._c._dateToStr(c._value, c._f || c._c._dateFormat); + } + if (a !== false) { + c._c.setDate(c._value); + } + }, + getValue: function (c, a) { + var e = c._tempValue || c._c.getDate(); + if (a === true && e == null) { + return ""; + } + return a === true ? c._c._dateToStr(e, c._f0 || c._c._dateFormat) : e; + }, + setDateFormat: function (c, a, e) { + c._f = a; + c._f0 = e || c._f; + c._c.setDateFormat(c._f); + this.setValue(c, this.getValue(c)); + }, + destruct: function (a) { + a._c.disableListener(a.childNodes[a._ll ? 1 : 0].childNodes[0]); + a._c.unload(); + a._c = null; + try { + delete a._c; + } catch (c) {} + a._f = null; + try { + delete a._f; + } catch (c) {} + a._f0 = null; + try { + delete a._f0; + } catch (c) {} + a.childNodes[a._ll ? 1 : 0].childNodes[0]._idd = null; + a.childNodes[a._ll ? 1 : 0].childNodes[0].onblur = null; + this.d2(a); + a = null; + }, + checkEnteredValue: function (a) { + this.setValue(a, a._c.getDate()); + }, +}; +(function () { + for (var c in { doAddLabel: 1, doAddInput: 1, doUnloadNestedLists: 1, setText: 1, getText: 1, enable: 1, disable: 1, isEnabled: 1, setWidth: 1, setReadonly: 1, isReadonly: 1, setFocus: 1, getInput: 1 }) { + dhtmlXForm.prototype.items.calendar[c] = dhtmlXForm.prototype.items.input[c]; + } +})(); +dhtmlXForm.prototype.items.calendar.doAttachChangeLS = dhtmlXForm.prototype.items.select.doAttachChangeLS; +dhtmlXForm.prototype.items.calendar.d2 = dhtmlXForm.prototype.items.input.destruct; +dhtmlXForm.prototype.getCalendar = function (a) { + return this.doWithItem(a, "getCalendar"); +}; +dhtmlXForm.prototype.setCalendarDateFormat = function (c, a, e) { + this.doWithItem(c, "setDateFormat", a, e); +}; +dhtmlXForm.prototype.items.btn2state = { + setChecked: function (a, c) { + a._checked = c === true ? true : false; + a.childNodes[a._ll ? 1 : 0].lastChild.className = "dhxform_img " + a._cssName + "_" + (a._checked ? "1" : "0"); + this.doCheckValue(a); + }, +}; +(function () { + for (var c in dhtmlXForm.prototype.items.checkbox) { + if (!dhtmlXForm.prototype.items.btn2state[c]) { + dhtmlXForm.prototype.items.btn2state[c] = dhtmlXForm.prototype.items.checkbox[c]; + } + } +})(); +dhtmlXForm.prototype.items.btn2state.render2 = dhtmlXForm.prototype.items.btn2state.render; +dhtmlXForm.prototype.items.btn2state.render = function (a, c) { + c._autoInputWidth = false; + this.render2(a, c); + a._type = "btn2state"; + a._cssName = typeof c.cssName == "undefined" ? "btn2state" : c.cssName; + a._updateImgNode = function () {}; + a._doOnFocus = function () { + a.getForm().callEvent("onFocus", [a._idd]); + }; + a._doOnBlur = function () { + a.getForm().callEvent("onBlur", [a._idd]); + }; + a._doOnKeyUpDown = function (g, e, h) { + this.callEvent(g, [this.childNodes[this._ll ? 0 : 1].childNodes[0], e, this._idd]); + }; + this.setChecked(a, a._checked); + return this; +}; +dhtmlXForm.prototype.setFormData_btn2state = function (a, c) { + this[c == true || parseInt(c) == 1 || c == "true" || c == this.getItemValue(a) ? "checkItem" : "uncheckItem"](a); +}; +dhtmlXForm.prototype.getFormData_btn2state = function (a) { + return this.isItemChecked(a) ? this.getItemValue(a) : 0; +}; +dhtmlXForm.prototype.items.colorpicker = { + colorpicker: {}, + render: function (e, g) { + var c = this; + e._type = "colorpicker"; + e._enabled = true; + this.doAddLabel(e, g); + this.doAddInput(e, g, "INPUT", "TEXT", true, true, "dhxform_textarea"); + e._value = g.value || ""; + e.childNodes[e._ll ? 1 : 0].childNodes[0].value = e._value; + var a = { input: e.childNodes[e._ll ? 1 : 0].childNodes[0], custom_colors: window.dhx4.s2b(g.enableCustomColors) == true, skin: e.getForm().skin }; + this.colorpicker[e._idd] = new dhtmlXColorPicker(a); + this.colorpicker[e._idd]._nodes[0].valueColor = null; + this.colorpicker[e._idd].base.className += " dhtmlxcp_in_form"; + if (typeof g.customColors != "undefined") { + this.colorpicker[e._idd].setCustomColors(g.customColors); + } + if (typeof g.cpPosition == "string") { + this.colorpicker[e._idd].setPosition(g.cpPosition); + } + this.colorpicker[e._idd].attachEvent("onSelect", function (h) { + if (e._value != h) { + if (e.checkEvent("onBeforeChange")) { + if (e.callEvent("onBeforeChange", [e._idd, e._value, h]) !== true) { + e.childNodes[e._ll ? 1 : 0].childNodes[0].value = e._value; + return; + } + } + e._value = h; + c.setValue(e, h); + e.callEvent("onChange", [e._idd, e._value]); + } + }); + this.colorpicker[e._idd].attachEvent("onHide", function (h) { + var j = e.childNodes[e._ll ? 1 : 0].childNodes[0]; + if (j.value != e._value) { + j.value = e._value; + } + j = null; + }); + e.childNodes[e._ll ? 1 : 0].childNodes[0]._idd = e._idd; + return this; + }, + getColorPicker: function (a) { + return this.colorpicker[a._idd]; + }, + destruct: function (a) { + if (this.colorpicker[a._idd].unload) { + this.colorpicker[a._idd].unload(); + } + this.colorpicker[a._idd] = null; + try { + delete this.colorpicker[a._idd]; + } catch (c) {} + a.childNodes[a._ll ? 1 : 0].childNodes[0]._idd = null; + this.d2(a); + a = null; + }, + setSkin: function (a, c) { + this.colorpicker[a._idd].setSkin(c); + }, +}; +(function () { + for (var c in { + doAddLabel: 1, + doAddInput: 1, + doUnloadNestedLists: 1, + setText: 1, + getText: 1, + enable: 1, + disable: 1, + isEnabled: 1, + setWidth: 1, + setReadonly: 1, + isReadonly: 1, + setValue: 1, + getValue: 1, + updateValue: 1, + setFocus: 1, + getInput: 1, + }) { + dhtmlXForm.prototype.items.colorpicker[c] = dhtmlXForm.prototype.items.input[c]; + } +})(); +dhtmlXForm.prototype.items.colorpicker.d2 = dhtmlXForm.prototype.items.input.destruct; +dhtmlXForm.prototype.getColorPicker = function (a) { + return this.doWithItem(a, "getColorPicker"); +}; +dhtmlXForm.prototype.items.container = { + render: function (a, c) { + a._type = "container"; + a._enabled = true; + this.doAddLabel(a, c); + this.doAddInput(a, c, "DIV", null, true, true, "dhxform_container"); + return this; + }, + getContainer: function (a) { + return a.childNodes[a._ll ? 1 : 0].childNodes[0]; + }, + enable: function (a) { + a._enabled = true; + if (String(a.className).search("disabled") >= 0) { + a.className = String(a.className).replace(/disabled/gi, ""); + } + a.callEvent("onEnable", [a._idd]); + }, + disable: function (a) { + a._enabled = false; + if (String(a.className).search("disabled") < 0) { + a.className += " disabled"; + } + a.callEvent("onDisable", [a._idd]); + }, + doAttachEvents: function () {}, + setValue: function () {}, + getValue: function () { + return null; + }, +}; +dhtmlXForm.prototype.getContainer = function (a) { + return this.doWithItem(a, "getContainer"); +}; +(function () { + for (var c in dhtmlXForm.prototype.items.input) { + if (!dhtmlXForm.prototype.items.container[c]) { + dhtmlXForm.prototype.items.container[c] = dhtmlXForm.prototype.items.input[c]; + } + } +})(); +dhtmlXForm.prototype.items.editor = { + editor: {}, + render: function (e, g) { + var a = !isNaN(g.rows); + e._type = "editor"; + e._enabled = true; + e._editor_id = e.getForm().idPrefix + e._idd; + this.doAddLabel(e, g); + this.doAddInput(e, g, "DIV", null, true, true, "dhxform_item_template"); + e._value = g.value || ""; + var c = this; + this.editor[e._editor_id] = new dhtmlXEditor({ parent: e.childNodes[e._ll ? 1 : 0].childNodes[0], content: e._value, iconsPath: g.iconsPath, toolbar: g.toolbar }); + this.editor[e._editor_id].attachEvent("onAccess", function (j, l) { + e.callEvent("_onBeforeEditorAccess", []); + _dhxForm_doClick(document.body, "click"); + if (j == "blur") { + c.doOnBlur(e, this); + e.callEvent("onBlur", [e._idd]); + if (e.getForm().skin == "dhx_terrace") { + var h = e.childNodes[e._ll ? 1 : 0].className; + if (h.indexOf("dhxeditor_focus") >= 0) { + e.childNodes[e._ll ? 1 : 0].className = h.replace(/\s{0,}dhxeditor_focus/gi, ""); + } + } + } else { + e.callEvent("onEditorAccess", [e._idd, j, l, this, e.getForm()]); + e.callEvent("onFocus", [e._idd]); + if (e.getForm().skin == "dhx_terrace") { + var h = e.childNodes[e._ll ? 1 : 0].className; + if (h.indexOf("dhxeditor_focus") == -1) { + e.childNodes[e._ll ? 1 : 0].className += " dhxeditor_focus"; + } + } + } + }); + this.editor[e._editor_id].attachEvent("onToolbarClick", function (h) { + e.callEvent("onEditorToolbarClick", [e._idd, h, this, e.getForm()]); + }); + if (g.readonly) { + this.setReadonly(e, true); + } + e.childNodes[e._ll ? 0 : 1].childNodes[0].removeAttribute("for"); + e.childNodes[e._ll ? 0 : 1].childNodes[0].onclick = function () { + c.editor[e._editor_id]._focus(); + }; + return this; + }, + doOnBlur: function (e, c) { + var a = c.getContent(); + if (e._value != a) { + if (e.checkEvent("onBeforeChange")) { + if (e.callEvent("onBeforeChange", [e._idd, e._value, a]) !== true) { + c.setContent(e._value); + return; + } + } + e._value = a; + e.callEvent("onChange", [e._idd, a]); + } + }, + setValue: function (a, c) { + if (a._value == c) { + return; + } + a._value = c; + this.editor[a._editor_id].setContent(a._value); + }, + getValue: function (a) { + a._value = this.editor[a._editor_id].getContent(); + return a._value; + }, + enable: function (a) { + if (this.isEnabled(a) != true) { + this.editor[a._editor_id].setReadonly(false); + this.doEn(a); + } + }, + disable: function (a) { + if (this.isEnabled(a) == true) { + this.editor[a._editor_id].setReadonly(true); + this.doDis(a); + } + }, + setReadonly: function (a, c) { + this.editor[a._editor_id].setReadonly(c); + }, + getEditor: function (a) { + return this.editor[a._editor_id] || null; + }, + destruct: function (a) { + a.childNodes[a._ll ? 0 : 1].childNodes[0].onclick = null; + this.editor[a._editor_id].unload(); + this.editor[a._editor_id] = null; + this.d2(a); + a = null; + }, + setFocus: function (a) { + this.editor[a._editor_id]._focus(); + }, +}; +(function () { + for (var c in { doAddLabel: 1, doAddInput: 1, doUnloadNestedLists: 1, setText: 1, getText: 1, setWidth: 1, isEnabled: 1 }) { + dhtmlXForm.prototype.items.editor[c] = dhtmlXForm.prototype.items.template[c]; + } +})(); +dhtmlXForm.prototype.items.editor.d2 = dhtmlXForm.prototype.items.select.destruct; +dhtmlXForm.prototype.items.editor.doEn = dhtmlXForm.prototype.items.select.enable; +dhtmlXForm.prototype.items.editor.doDis = dhtmlXForm.prototype.items.select.disable; +dhtmlXForm.prototype.getEditor = function (a) { + return this.doWithItem(a, "getEditor"); +}; +dhtmlXForm.prototype.items.image = { + _dimFix: true, + render: function (j, l) { + j._type = "image"; + j._enabled = true; + j._fr_name = "dhxform_image_" + window.dhx4.newId(); + j._url = l.url; + if (l.inputWidth == "auto") { + l.inputWidth = 120; + } + if (l.inputHeight == "auto") { + l.inputHeight = l.inputWidth; + } + this.doAddLabel(j, l); + this.doAddInput(j, l, "DIV", null, true, true, "dhxform_image"); + var c = j.childNodes[j._ll ? 1 : 0].childNodes[0]; + c.style.height = parseInt(c.style.height) - dhtmlXForm.prototype.items[this.t]._dim + "px"; + var a = typeof l.imageWidth != "undefined" ? parseInt(l.imageWidth) : l.inputWidth; + var e = typeof l.imageHeight != "undefined" ? parseInt(l.imageHeight) : l.inputHeight; + if (e == "auto") { + e = a; + } + j._dim = { mw: l.inputWidth - this._dim, mh: l.inputHeight - this._dim, w: a, h: e }; + c.innerHTML = + "
"; + ("
"); + this.adjustImage(j); + c.childNodes[2].firstChild.lastChild.onchange = function () { + j._is_uploading = true; + this.parentNode.submit(); + this.parentNode.parentNode.className = "dhxform_image_wrap dhxform_image_in_progress"; + }; + var g = this; + if (window.navigator.userAgent.indexOf("MSIE") >= 0) { + c.childNodes[1].onreadystatechange = function () { + if (this.readyState == "complete") { + g.doOnUpload(j); + } + }; + } else { + c.childNodes[1].onload = function () { + g.doOnUpload(j); + }; + } + this._moreClear = function () { + g = null; + }; + this.setValue(j, l.value || ""); + c = null; + return this; + }, + destruct: function (c) { + var a = c.childNodes[c._ll ? 1 : 0].childNodes[0]; + a.childNodes[2].firstChild.lastChild.onchange = null; + a.childNodes[1].onreadystatechange = null; + a.childNodes[1].onload = null; + this._moreClear(); + this.d2(c); + c = null; + }, + doAttachEvents: function () {}, + setValue: function (e, h) { + e._value = h == null ? "" : h; + var c = + e._url + + (e._url.indexOf("?") >= 0 ? "&" : "?") + + "action=loadImage&itemId=" + + encodeURIComponent(e._idd) + + "&itemValue=" + + encodeURIComponent(e._value) + + (window.dhx4.ajax.cache != true ? "&dhxr" + new Date().getTime() + "=1" : ""); + var g = e.childNodes[e._ll ? 1 : 0].childNodes[0].firstChild; + if (g.nextSibling.tagName.toLowerCase() == "img") { + g.nextSibling.src = c; + } else { + var a = document.createElement("IMG"); + a.className = "dhxform_image_img"; + a.style.visibility = "hidden"; + a.onload = function () { + this.style.visibility = "visible"; + this.parentNode.removeChild(this.nextSibling); + this.onload = this.onerror = null; + }; + a.onerror = function () { + this.onload.apply(this, arguments); + this.style.visibility = "hidden"; + }; + g.parentNode.insertBefore(a, g); + a.src = c; + a = null; + this.adjustImage(e); + } + g = null; + }, + getValue: function (a) { + return a._value; + }, + doOnUpload: function (e) { + if (e._is_uploading == true) { + var a = e.childNodes[e._ll ? 1 : 0].childNodes[0].lastChild.previousSibling; + var c = dhx4.s2j(a.contentWindow.document.body.innerHTML); + if (typeof c == "object" && c != null && c.state == true && c.itemId == e._idd) { + this.setValue(e, c.itemValue, true); + e.getForm().callEvent("onImageUploadSuccess", [c.itemId, c.itemVaule, c.extra]); + } else { + e.getForm().callEvent("onImageUploadFail", [e._idd, c ? c.extra : null]); + } + c = a = null; + window.setTimeout(function () { + e.childNodes[e._ll ? 1 : 0].childNodes[0].lastChild.className = "dhxform_image_wrap"; + e._is_uploading = false; + }, 50); + } + }, + adjustImage: function (g) { + var c = g.childNodes[g._ll ? 1 : 0].childNodes[0].firstChild; + var a = Math.min(g._dim.mw, g._dim.w); + var e = Math.min(g._dim.mh, g._dim.h); + c.style.width = a + "px"; + c.style.height = e + "px"; + c.style.marginLeft = Math.max(0, Math.round(g._dim.mw / 2 - a / 2)) + "px"; + c.style.marginTop = Math.max(0, Math.round(g._dim.mh / 2 - e / 2)) + "px"; + c = g = null; + }, +}; +(function () { + for (var c in dhtmlXForm.prototype.items.input) { + if (!dhtmlXForm.prototype.items.image[c]) { + dhtmlXForm.prototype.items.image[c] = dhtmlXForm.prototype.items.input[c]; + } + } +})(); +dhtmlXForm.prototype.items.image.d2 = dhtmlXForm.prototype.items.input.destruct; +dhtmlXForm.prototype.setFormData_image = function (a, c) { + this.setItemValue(a, c); +}; +dhtmlXForm.prototype.getFormData_image = function (a) { + return this.getItemValue(a); +}; +dhtmlXForm.prototype.items.upload = { + render: function (c, e) { + c._type = "up"; + c._enabled = true; + c._checked = true; + c.className = e.position + (typeof e.className == "string" ? " " + e.className : ""); + var a = document.createElement("DIV"); + c.appendChild(a); + if (!isNaN(e.inputLeft)) { + c.style.left = parseInt(e.inputLeft) + "px"; + } + if (!isNaN(e.inputTop)) { + c.style.top = parseInt(e.inputTop) + "px"; + } + if (e.inputWidth != "auto") { + if (!isNaN(e.inputWidth)) { + a.style.width = parseInt(e.inputWidth) + "px"; + } + } + c._uploader = new dhtmlXFileUploader(a, e.swfPath || "", e.swfUrl || "", e.mode || null, e.swfLogs, e.slXap || "", e.slUrl || "", e.slLogs || "", e.multiple); + c._uploader.setURL(e.url || ""); + c._uploader.callEvent = c.callEvent; + if (typeof e.autoStart != "undefined") { + c._uploader.setAutoStart(e.autoStart); + } + if (typeof e.autoRemove != "undefined") { + c._uploader.setAutoRemove(e.autoRemove); + } + if (typeof e.titleScreen != "undefined") { + c._uploader.enableTitleScreen(e.titleScreen); + } + if (typeof e.titleText != "undefined") { + c._uploader.setTitleText(e.titleText); + } + if (e.hidden == true) { + this.hide(c); + } + if (e.disabled == true) { + this.userDisable(c); + } + if (!(e.inputHeight == "auto" || parseInt(e.inputHeight) == NaN)) { + c._uploader.p_files.style.height = parseInt(e.inputHeight) + "px"; + } + return this; + }, + destruct: function (a) { + this.doUnloadNestedLists(a); + a._uploader.callEvent = function () { + return true; + }; + a._uploader.unload(); + a._uploader.callEvent = null; + a._uploader = null; + a._checked = null; + a._enabled = null; + a._idd = null; + a._type = null; + a.onselectstart = null; + a._autoCheck = null; + a.callEvent = null; + a.checkEvent = null; + a.getForm = null; + while (a.childNodes.length > 0) { + a.removeChild(a.childNodes[0]); + } + a.parentNode.removeChild(a); + a = null; + }, + setText: function (a, c) {}, + getText: function (a) {}, + enable: function (a) { + a._enabled = true; + if (String(a.className).search("disabled") >= 0) { + a.className = String(a.className).replace(/disabled/gi, ""); + } + a._uploader.enable(); + }, + disable: function (a) { + a._enabled = false; + if (String(a.className).search("disabled") < 0) { + a.className += " disabled"; + } + a._uploader.disable(); + }, + setWidth: function (c, a) { + c.childNodes[0].style.width = a + "px"; + c._width = a; + }, + getWidth: function (a) { + return a._width || parseInt(a.childNodes[0].style.width); + }, + setValue: function (a) { + a._uploader.clear(); + }, + getValue: function (j) { + var g = j._uploader.getData(); + var h = {}; + var e = 0; + for (var c in g) { + h[j._idd + "_r_" + e] = g[c].realName; + h[j._idd + "_s_" + e] = g[c].serverName; + e++; + } + h[j._idd + "_count"] = e; + return h; + }, + getUploader: function (a) { + return a._uploader; + }, + getStatus: function (a) { + return a._uploader.getStatus(); + }, +}; +(function () { + for (var c in { doUnloadNestedLists: 1, isEnabled: 1 }) { + dhtmlXForm.prototype.items.upload[c] = dhtmlXForm.prototype.items.checkbox[c]; + } +})(); +dhtmlXForm.prototype.setFormData_upload = function (a) { + this.doWithItem(a, "setValue"); +}; +dhtmlXForm.prototype.getUploader = function (a) { + return this.doWithItem(a, "getUploader"); +}; +dhtmlXForm.prototype.getUploaderStatus = function (a) { + return this.doWithItem(a, "getStatus"); +}; +function dhtmlXFileUploader(c, m, l, n, s, j, v, h, w) { + var o = this; + if (typeof n == "string" && typeof this[n] == "function") { + this.engine = n; + } else { + this.engine = "html4"; + var g = null; + if (typeof window.FormData != "undefined" && typeof window.XMLHttpRequest != "undefined") { + g = new XMLHttpRequest(); + if (typeof g.upload == "undefined") { + g = null; + } + } + if (g != null) { + this.engine = "html5"; + } else { + if (typeof window.swfobject != "undefined" || g === false) { + var g = swfobject.getFlashPlayerVersion(); + if (g.major >= 10) { + this.engine = "flash"; + } + } else { + this._sl_v = this.getSLVersion(); + if (this._sl_v) { + this.engine = "sl"; + } + } + } + g = null; + } + if (typeof c == "string") { + c = document.getElementById(c); + } + this._upload_mp = typeof w != "undefined" ? w == true : true; + this._upload_dnd = true; + this._swf_file_url = m || ""; + this._swf_upolad_url = l || ""; + this._swf_logs = s; + this._sl_xap = j; + this._sl_upload_url = v; + this._sl_logs = h; + this.p = document.createElement("DIV"); + this.p.className += " dhx_file_uploader"; + c.appendChild(this.p); + this.p_files = document.createElement("DIV"); + this.p_files.className = "dhx_upload_files"; + this.p.appendChild(this.p_files); + this.p_controls = document.createElement("DIV"); + this.p_controls.className = "dhx_upload_controls"; + this.p.appendChild(this.p_controls); + this._files = {}; + this._items = {}; + this._data = {}; + this._autoStart = false; + this._autoRemove = false; + this._titleScreen = true; + this._enabled = true; + this._uploaded_count = 0; + this._initToolbar = function () { + this.b_opts = { + info: { onclick: null }, + browse: { onclick: null, tooltip: "Browse" }, + upload: { + onclick: function () { + if (!o._enabled) { + return; + } + if (!o._uploading) { + o._uploadStart(); + } + }, + tooltip: "Upload", + }, + cancel: { + onclick: function () { + if (!o._enabled) { + return; + } + o._uploadStop(); + o._switchButton(false); + }, + tooltip: "Stop", + }, + clear: { + onclick: function () { + if (!o._enabled) { + return; + } + o.clear(); + }, + tooltip: "Clear list", + }, + }; + this.buttons = {}; + for (var e in this.b_opts) { + var x = document.createElement("DIV"); + x.innerHTML = " "; + x.className = "dhx_file_uploader_button button_" + e; + x.onclick = this.b_opts[e].onclick; + if (this.b_opts[e].tooltip) { + x.title = this.b_opts[e].tooltip; + } + this.p_controls.appendChild(x); + this.buttons[e] = x; + x = null; + } + this.buttons.cancel.style.display = "none"; + }; + this._readableSize = function (x) { + var e = false; + var a = ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb"]; + for (var y = 0; y < a.length; y++) { + if (x > 1024) { + x = x / 1024; + } else { + if (e === false) { + e = y; + } + } + } + if (e === false) { + e = a.length - 1; + } + return Math.round(x * 100) / 100 + " " + a[e]; + }; + this._beforeAddFileToList = function (a, e) { + return this.callEvent("onBeforeFileAdd", [a, e]) === true; + }; + this._addFileToList = function (C, e, y, A, a) { + this._checkTitleScreen(); + var x = document.createElement("DIV"); + x._idd = C; + x.className = "dhx_file dhx_file_" + A; + x.innerHTML = "
 
" + a + "%
 
"; + this.p_files.appendChild(x); + x.childNodes[0].style.width = x.offsetWidth - 127 + "px"; + this._items[C] = x; + this._updateFileNameSize(C); + x.childNodes[2].onclick = function () { + if (!o._enabled) { + return; + } + var D = this.parentNode._idd; + o._removeFileFromQueue(D); + }; + this.callEvent("onFileAdd", [e]); + }; + this._removeFileFromList = function (a) { + if (!this._items[a]) { + return; + } + this._items[a].childNodes[2].onclick = null; + this._items[a].parentNode.removeChild(this._items[a]); + this._items[a] = null; + delete this._items[a]; + if (this._data[a]) { + this._data[a] = null; + delete this._data[a]; + } + this._checkTitleScreen(); + }; + this._updateFileNameSize = function (a) { + this._items[a].childNodes[0].innerHTML = this._files[a].name + (!isNaN(this._files[a].size) ? " (" + this._readableSize(this._files[a].size) + ")" : " "); + this._items[a].childNodes[0].title = this._files[a].name + (!isNaN(this._files[a].size) ? " (" + this._readableSize(this._files[a].size) + ")" : ""); + }; + this._updateFileInList = function (x, e, a) { + if (!this._items[x]) { + return; + } + this._items[x].className = "dhx_file dhx_file_" + e; + this._updateProgress(x, e, a); + this._updateFileNameSize(x); + }; + this._updateProgress = function (x, e, a) { + if (e == "uploading" && a < 100 && this._progress_type == "loader") { + this._items[x].childNodes[1].className = "dhx_file_param dhx_file_uploading"; + this._items[x].childNodes[1].innerHTML = " "; + } else { + this._items[x].childNodes[1].className = "dhx_file_param dhx_file_progress"; + this._items[x].childNodes[1].innerHTML = a + "%"; + } + this._updateFileNameSize(x); + }; + this._removeFilesByState = function (x) { + for (var e in this._files) { + if (x === true || this._files[e].state == x) { + this._removeFileFromQueue(e); + } + } + }; + this._switchButton = function (e) { + if (e == true) { + this.buttons.upload.style.display = "none"; + this.buttons.cancel.style.display = ""; + } else { + var a = this._uploaded_count; + this.buttons.upload.style.display = ""; + this.buttons.cancel.style.display = "none"; + this._uploaded_count = 0; + if (a > 0) { + this.callEvent("onUploadComplete", [a]); + } + } + }; + this._uploadStart = function () { + this._switchButton(true); + if (!this._uploading) { + for (var e in this._files) { + if (this._files[e].state == "fail") { + this._files[e].state = "added"; + this._updateFileInList(e, "added", 0); + } + } + } + this._uploading = true; + var x = false; + for (var e in this._files) { + if (!x && [this._files[e].state] == "added") { + x = true; + this._files[e].state = "uploading"; + this._updateFileInList(e, "uploading", 0); + this._doUploadFile(e); + } + } + if (!x) { + this._uploading = false; + this._switchButton(false); + } + }; + this._onUploadSuccess = function (A, y, x, a) { + if (typeof x != "undefined" && this.engine == "flash") { + var e = dhx4.s2j(x.data); + if (e != null && e.state == true && e.name != null) { + y = e.name; + if (e.extra != null) { + a = e.extra; + } + } else { + this._onUploadFail(A, e != null && e.extra != null ? e.extra : null); + return; + } + } + this._uploaded_count++; + this._data[A] = { realName: this._files[A].name, serverName: y }; + this._files[A].state = "uploaded"; + this._updateFileInList(A, "uploaded", 100); + this.callEvent("onUploadFile", [this._files[A].name, y, a]); + if (this._autoRemove) { + this._removeFileFromQueue(A); + } + if (this._uploading) { + this._uploadStart(); + } + }; + this._onUploadFail = function (e, a) { + this._files[e].state = "fail"; + this._updateFileInList(e, "fail", 0); + this.callEvent("onUploadFail", [this._files[e].name, a]); + if (this._uploading) { + this._uploadStart(); + } + }; + this._onUploadAbort = function (a) { + this._uploading = false; + this._files[a].state = "added"; + this._updateFileInList(a, "added", 0); + this.callEvent("onUploadCancel", [this._files[a].name]); + }; + this._checkTitleScreen = function () { + var x = 0; + for (var e in this._files) { + x++; + } + if (x == 0 && this.p.className.search("dhx_file_uploader_title") < 0 && this._titleScreen) { + this.p.className += " dhx_file_uploader_title"; + this.buttons.info.innerHTML = this._titleText; + this.buttons.info.style.width = Math.max(this.p_controls.offsetWidth - 134, 0) + "px"; + } + if ((x > 0 || !this._titleScreen) && this.p.className.search("dhx_file_uploader_title") >= 0) { + this.p.className = this.p.className.replace(/dhx_file_uploader_title/g, ""); + this.buttons.info.innerHTML = ""; + } + }; + this.callEvent = function () {}; + this.upload = function () { + if (!this._uploading) { + this._uploadStart(); + } + }; + this.setAutoStart = function (a) { + this._autoStart = a == true; + }; + this.setAutoRemove = function (a) { + this._autoRemove = a == true; + }; + this.enableTitleScreen = function (a) { + this._titleScreen = a == true; + this._checkTitleScreen(); + }; + this.setTitleText = function (a) { + this._titleText = a; + if (this.p.className.search("dhx_file_uploader_title") >= 0) { + this.buttons.info.innerHTML = this._titleText; + } + }; + this.setURL = function (a) { + this._url = a; + }; + this.setSWFURL = function (a) { + this._swf_upolad_url = a; + }; + this.enable = function () { + this._enabled = true; + this.p_files.className = "dhx_upload_files"; + this.p_controls.className = "dhx_upload_controls"; + }; + this.disable = function () { + this._enabled = false; + this.p_files.className = "dhx_upload_files dhx_uploader_dis"; + this.p_controls.className = "dhx_upload_controls dhx_uploader_dis"; + }; + this.getStatus = function () { + var x = 0; + for (var e in this._files) { + if (this._files[e].state != "uploaded") { + return -1; + } + x = 1; + } + return x; + }; + this.getData = function () { + return this._data; + }; + this.clear = function () { + if (this.callEvent("onBeforeClear", []) !== true) { + return; + } + if (this._uploading) { + o._uploadStop(); + } + o._switchButton(false); + o._removeFilesByState(true); + this.callEvent("onClear", []); + }; + this.unload = function () { + this._removeFilesByState(true); + this._data = null; + this._files = null; + this._items = null; + this._unloadEngine(); + for (var e in this.buttons) { + this.buttons[e].onclick = null; + this.buttons[e].parentNode.removeChild(this.buttons[e]); + this.buttons[e] = null; + delete this.buttons[e]; + } + this.buttons = null; + for (var e in this.b_opts) { + this.b_opts[e].onclick = null; + this.b_opts[e] = null; + delete this.b_opts[e]; + } + this.b_opts = null; + this.p_controls.parentNode.removeChild(this.p_controls); + this.p_files.parentNode.removeChild(this.p_files); + this.p.className = this.p.className.replace(/dhx_file_uploader_title/gi, "").replace(/dhx_file_uploader/gi, ""); + for (var e in this) { + this[e] = null; + } + o = e = null; + }; + var r = new this[this.engine](); + for (var u in r) { + this[u] = r[u]; + r[u] = null; + } + u = r = c = null; + this._initToolbar(); + this._initEngine(); + this._checkTitleScreen(); + return this; +} +dhtmlXFileUploader.prototype.html5 = function () {}; +dhtmlXFileUploader.prototype.html5.prototype = { + _initEngine: function () { + var c = this; + this.buttons.browse.onclick = function () { + if (c._enabled) { + c.f.click(); + } + }; + this._progress_type = "percentage"; + var a = window.navigator.userAgent; + if (a.match(/Windows/gi) != null && a.match(/AppleWebKit/gi) != null && a.match(/Safari/gi) != null) { + if (a.match(/Version\/5\.1\.5/gi)) { + this._upload_mp = false; + } + if (a.match(/Version\/5\.1[^\.\d{1,}]/gi)) { + this._upload_dnd = false; + } + if (a.match(/Version\/5\.1\.1/gi)) { + this._upload_mp = false; + this._upload_dnd = false; + } + if (a.match(/Version\/5\.1\.2/gi)) { + this._upload_dnd = false; + } + if (a.match(/Version\/5\.1\.7/gi)) { + this._upload_mp = false; + } + } + this._addFileInput(); + if (this._upload_dnd) { + this.p.ondragenter = function (g) { + if (!g.dataTransfer) { + return; + } + g.stopPropagation(); + g.preventDefault(); + }; + this.p.ondragover = function (g) { + if (!g.dataTransfer) { + return; + } + g.stopPropagation(); + g.preventDefault(); + }; + this.p.ondrop = function (g) { + if (!g.dataTransfer) { + return; + } + g.stopPropagation(); + g.preventDefault(); + if (c._enabled) { + c._parseFilesInInput(g.dataTransfer.files); + } + }; + this._titleText = "Drag-n-Drop files here or
click to select files for upload."; + } else { + this._titleText = "Click to select files for upload."; + } + }, + _addFileInput: function () { + if (this.f != null) { + this.f.onchange = null; + this.f.parentNode.removeChild(this.f); + this.f = null; + } + var a = this; + this.f = document.createElement("INPUT"); + this.f.type = "file"; + if (this._upload_mp) { + this.f.multiple = "1"; + } + this.f.className = "dhx_uploader_input"; + this.p_controls.appendChild(this.f); + this.f.onchange = function () { + a._parseFilesInInput(this.files); + if (window.dhx4.isOpera) { + a._addFileInput(); + } else { + this.value = ""; + } + }; + }, + _doUploadFile: function (e) { + var c = this; + if (!this._loader) { + this._loader = new XMLHttpRequest(); + this._loader.upload.onprogress = function (g) { + if (c._files[this._idd].state == "uploading") { + c._updateFileInList(this._idd, "uploading", Math.round((g.loaded * 100) / g.total)); + } + }; + this._loader.onload = function (h) { + var g = dhx4.s2j(this.responseText); + if (typeof g == "object" && g != null && typeof g.state != "undefined" && g.state == true) { + c._onUploadSuccess(this.upload._idd, g.name, null, g.extra); + g = null; + } else { + c._onUploadFail(this.upload._idd, g != null && g.extra != null ? g.extra : null); + } + }; + this._loader.onerror = function (g) { + c._onUploadFail(this.upload._idd); + }; + this._loader.onabort = function (g) { + c._onUploadAbort(this.upload._idd); + }; + } + this._loader.upload._idd = e; + var a = new FormData(); + a.append("file", this._files[e].file); + this._loader.open("POST", this._url + (String(this._url).indexOf("?") < 0 ? "?" : "&") + "mode=html5&dhxr" + new Date().getTime(), true); + this._loader.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + this._loader.send(a); + }, + _uploadStop: function () { + if (!this._uploading || !this._loader) { + return; + } + this._loader.abort(); + }, + _parseFilesInInput: function (c) { + for (var a = 0; a < c.length; a++) { + this._addFileToQueue(c[a]); + } + }, + _addFileToQueue: function (a) { + if (!this._beforeAddFileToList(a.name, a.size)) { + return; + } + var c = a._idd || window.dhx4.newId(); + this._files[c] = { file: a, name: a.name, size: a.size, state: "added" }; + this._addFileToList(c, a.name, a.size, "added", 0); + if (this._autoStart && !this._uploading) { + this._uploadStart(true); + } + }, + _removeFileFromQueue: function (g) { + if (!this._files[g]) { + return; + } + var c = this._files[g].name; + var e = this._data != null && this._data[g] != null ? this._data[g].serverName : null; + if (this.callEvent("onBeforeFileRemove", [c, e]) !== true) { + return; + } + var a = false; + if (this._uploading && g == this._loader.upload._idd && this._files[g].state == "uploading") { + this._uploadStop(); + a = true; + } + this._files[g].file = null; + this._files[g].name = null; + this._files[g].size = null; + this._files[g].state = null; + this._files[g] = null; + delete this._files[g]; + this._removeFileFromList(g); + this.callEvent("onFileRemove", [c, e]); + if (a) { + this._uploadStart(); + } + }, + _unloadEngine: function () { + this.buttons.browse.onclick = null; + this.f.onchange = null; + this.f.parentNode.removeChild(this.f); + this.f = null; + this.p.ondragenter = null; + this.p.ondragover = null; + this.p.ondrop = null; + if (this._loader) { + this._loader.upload.onprogress = null; + this._loader.onload = null; + this._loader.onerror = null; + this._loader.onabort = null; + this._loader.upload._idd = null; + this._loader = null; + } + this._initEngine = null; + this._doUploadFile = null; + this._uploadStop = null; + this._parseFilesInInput = null; + this._addFileToQueue = null; + this._removeFileFromQueue = null; + this._unloadEngine = null; + }, +}; +dhtmlXFileUploader.prototype.html4 = function () {}; +dhtmlXFileUploader.prototype.html4.prototype = { + _initEngine: function () { + this._addForm(); + this._progress_type = "loader"; + this._titleText = "Click button
to select files for upload."; + }, + _addForm: function () { + var a = this; + var e = window.dhx4.newId(); + if (!this.k) { + this.k = document.createElement("DIV"); + this.k.className = "dhx_file_form_cont"; + this.buttons.browse.appendChild(this.k); + this.fr_name = "dhx_file_" + window.dhx4.newId(); + this.k.innerHTML = ''; + this.fr = this.k.firstChild; + if (window.navigator.userAgent.indexOf("MSIE") >= 0) { + this.fr.onreadystatechange = function () { + if (this.readyState == "complete") { + a._onLoad(); + } + }; + } else { + this.fr.onload = function () { + a._onLoad(); + }; + } + } + var c = document.createElement("DIV"); + c.innerHTML = + "
"; + this.k.appendChild(c); + c.firstChild.lastChild._idd = e; + c.firstChild.lastChild.onchange = function () { + if (!a._beforeAddFileToList(this.value, null)) { + return; + } + a._addFileToQueue(this); + this.onchange = null; + this.parentNode.parentNode.style.display = "none"; + a._addForm(); + }; + c = null; + }, + _onLoad: function () { + if (this._uploading) { + var a = dhx4.s2j(this.fr.contentWindow.document.body.innerHTML); + if (typeof a == "object" && a != null) { + if (typeof a.state != "undefined") { + if (a.state == "cancelled") { + this._onUploadAbort(this.fr._idd); + a = null; + return; + } else { + if (a.state == true) { + if (typeof a.size != "undefined" && !isNaN(a.size)) { + this._files[this.fr._idd].size = a.size; + } + this._onUploadSuccess(this.fr._idd, a.name, null, a.extra); + a = null; + return; + } + } + } + } + this._onUploadFail(this.fr._idd, a != null && a.extra != null ? a.extra : null); + } + }, + _addFileToQueue: function (c) { + var a = c.value.match(/[^\\\/]*$/g); + if (a[0] != null) { + a = a[0]; + } else { + a = c.value; + } + this._files[c._idd] = { name: a, form: c.parentNode, node: c.parentNode.parentNode, input: c, state: "added" }; + this._addFileToList(c._idd, c.value, false, "added", 0); + if (this._autoStart && !this._uploading) { + this._uploadStart(true); + } + }, + _removeFileFromQueue: function (e) { + var a = this._files[e].name; + var c = this._data != null && this._data[e] != null ? this._data[e].serverName : null; + if (this.callEvent("onBeforeFileRemove", [a, c]) !== true) { + return; + } + this._files[e].input.onchange = null; + this._files[e].form.removeChild(this._files[e].input); + this._files[e].node.removeChild(this._files[e].form); + this._files[e].node.parentNode.removeChild(this._files[e].node); + this._files[e].input = null; + this._files[e].name = null; + this._files[e].form = null; + this._files[e].node = null; + this._files[e].size = null; + this._files[e].state = null; + this._files[e] = null; + delete this._files[e]; + this._removeFileFromList(e); + this.callEvent("onFileRemove", [a, c]); + }, + _doUploadFile: function (a) { + this.fr._idd = a; + this._files[a].form.action = this._url; + this._files[a].form.submit(); + }, + _uploadStop: function () { + if (!this._uploading) { + return; + } + this.fr.contentWindow.location.href = this._url + (this._url.indexOf("?") < 0 ? "?" : "&") + "mode=html4&action=cancel&dhxr" + new Date().getTime(); + }, + _unloadEngine: function () { + if (this.k) { + this.fr_name = null; + this.fr.onreadystatechange = null; + this.fr.onload = null; + this.fr.parentNode.removeChild(this.fr); + this.fr = null; + this.k.firstChild.firstChild.lastChild.onchange = null; + this.k.parentNode.removeChild(this.k); + this.k = null; + } + this._initEngine = null; + this._addForm = null; + this._onLoad = null; + this._addFileToQueue = null; + this._removeFileFromQueue = null; + this._doUploadFile = null; + this._uploadStop = null; + this._unloadEngine = null; + }, +}; +dhtmlXFileUploader.prototype.flash = function () {}; +dhtmlXFileUploader.prototype.flash.prototype = { + _initEngine: function () { + if (!window.dhtmlXSWFObjectsPull) { + window.dhtmlXSWFObjectsPull = { + items: {}, + callEvent: function (h, e, g) { + return window.dhtmlXSWFObjectsPull.items[h].uploader[e].apply(window.dhtmlXSWFObjectsPull.items[h].uploader, g); + }, + }; + } + var c = this; + this._swf_obj_id = "dhtmlXFileUploaderSWFObject_" + window.dhx4.newId(); + this._swf_file_url = this._swf_file_url + (this._swf_file_url.indexOf("?") >= 0 ? "&" : "?") + "dhxr" + new Date().getTime(); + this.buttons.browse.innerHTML = "
"; + swfobject.embedSWF(this._swf_file_url, this._swf_obj_id, "100%", "100%", "9", null, { ID: this._swf_obj_id, enableLogs: this._swf_logs }, { wmode: "transparent" }); + var a = swfobject.getFlashPlayerVersion(); + this._titleText = "Engine successfuly inited
Flash Player: " + a.major + "." + a.minor + "." + a.release; + this._progress_type = "percentage"; + window.dhtmlXSWFObjectsPull.items[this._swf_obj_id] = { id: this._swf_obj_id, uploader: this }; + }, + _beforeAddFileToQueue: function (a, c) { + return this.callEvent("onBeforeFileAdd", [a, c]) === true; + }, + _addFileToQueue: function (g, c, e) { + if (window.dhx4.isIE) { + var a = document.createElement("INPUT"); + a.type = "TEXT"; + a.style.position = "absolute"; + a.style.left = "0px"; + a.style.top = window.dhx4.absTop(this.buttons.browse) + "px"; + a.style.width = "10px"; + document.body.appendChild(a); + a.focus(); + document.body.removeChild(a); + a = null; + } + this._files[g] = { name: c, size: e, state: "added" }; + this._addFileToList(g, c, e, "added", 0); + if (this._autoStart && !this._uploading) { + this._uploadStart(true); + } + }, + _removeFileFromQueue: function (g) { + if (!this._files[g]) { + return; + } + var c = this._files[g].name; + var e = this._data != null && this._data[g] != null ? this._data[g].serverName : null; + if (this.callEvent("onBeforeFileRemove", [c, e]) !== true) { + return; + } + var a = false; + if (this._uploading && this._files[g].state == "uploading") { + this._uploadStop(); + a = true; + } + swfobject.getObjectById(this._swf_obj_id).removeFileById(g); + this._files[g].name = null; + this._files[g].size = null; + this._files[g].state = null; + this._files[g] = null; + delete this._files[g]; + this._removeFileFromList(g); + this.callEvent("onFileRemove", [c, e]); + if (a) { + this._uploadStart(); + } + }, + _doUploadFile: function (a) { + swfobject.getObjectById(this._swf_obj_id).upload(a, this._swf_upolad_url); + }, + _uploadStop: function (e) { + for (var c in this._files) { + if (this._files[c].state == "uploading") { + swfobject.getObjectById(this._swf_obj_id).uploadStop(c); + } + } + }, + _unloadEngine: function () { + if (window.dhtmlXSWFObjectsPull.items[this._swf_obj_id]) { + window.dhtmlXSWFObjectsPull.items[this._swf_obj_id].id = null; + window.dhtmlXSWFObjectsPull.items[this._swf_obj_id].uploader = null; + window.dhtmlXSWFObjectsPull.items[this._swf_obj_id] = null; + delete window.dhtmlXSWFObjectsPull.items[this._swf_obj_id]; + } + this._swf_obj_id = null; + this._initEngine = null; + this._addFileToQueue = null; + this._removeFileFromQueue = null; + this._doUploadFile = null; + this._uploadStop = null; + this._unloadEngine = null; + }, +}; +dhtmlXFileUploader.prototype.sl = function () {}; +dhtmlXFileUploader.prototype.sl.prototype = { + _initEngine: function () { + if (typeof this._sl_v == "undefined") { + this._sl_v = this.getSLVersion(); + } + if (!window.dhtmlXFileUploaderSLObjects) { + window.dhtmlXFileUploaderSLObjects = { + items: {}, + callEvent: function (e, a, c) { + window.dhtmlXFileUploaderSLObjects.items[e].uploader[a].apply(window.dhtmlXFileUploaderSLObjects.items[e].uploader, c); + }, + }; + } + this._sl_obj_id = "dhtmlXFileUploaderSLObject_" + window.dhx4.newId(); + if (this._sl_v != false) { + this._titleText = "Engine successfuly inited
Silverlight version: " + this._sl_v[0] + "." + this._sl_v[1]; + this.buttons.browse.innerHTML = + '
'; + } else { + this._titleText = "Silverlight plugin not found
or version less than 4.0"; + this.buttons.browse.style.cursor = "wait"; + this.buttons.browse.title = ""; + } + this._progress_type = "percentage"; + window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id] = { id: this._sl_obj_id, uploader: this }; + }, + _addFileToQueue: function (e, a, c) { + this._files[e] = { name: a, size: c, state: "added" }; + this._addFileToList(e, a, c, "added", 0); + if (this._autoStart && !this._uploading) { + this._uploadStart(true); + } + }, + _removeFileFromQueue: function (c) { + if (!this._files[c]) { + return; + } + var a = false; + if (this._uploading && this._files[c].state == "uploading") { + this._uploadStop(); + a = true; + } + document.getElementById([this._sl_obj_id]).Content.a.removeFileById(c); + this._files[c].name = null; + this._files[c].size = null; + this._files[c].state = null; + this._files[c] = null; + delete this._files[c]; + this._removeFileFromList(c); + if (a) { + this._uploadStart(); + } + }, + _doUploadFile: function (c) { + var a = this._sl_upload_url.split("?"); + a = a[1] != null ? "&" + a[1] : ""; + document.getElementById(this._sl_obj_id).Content.a.upload(c, this._sl_upload_url, a + "&mode=sl&dhxr" + new Date().getTime()); + }, + _uploadStop: function (e) { + this._uploading = false; + for (var c in this._files) { + if (this._files[c].state == "uploading") { + document.getElementById(this._sl_obj_id).Content.a.uploadStop(c); + } + } + }, + _unloadEngine: function () { + if (window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]) { + window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id].id = null; + window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id].uploader = null; + window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id] = null; + delete window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]; + } + this._sl_obj_id = null; + this._initEngine = null; + this._addFileToQueue = null; + this._removeFileFromQueue = null; + this._doUploadFile = null; + this._uploadStop = null; + this._unloadEngine = null; + }, +}; +dhtmlXFileUploader.prototype.setSLURL = function (a) { + this._sl_upload_url = a; +}; +dhtmlXFileUploader.prototype.getSLVersion = function () { + var a = false; + if (window.dhx4.isIE) { + try { + var c = new ActiveXObject("AgControl.AgControl"); + if (c != null) { + var j = 4, + h = 0; + while (c.isVersionSupported([j, h].join("."))) { + a = [j, h]; + if (++h > 9) { + j++; + h = 0; + } + } + } + c = null; + } catch (g) {} + } else { + if (navigator.plugins["Silverlight Plug-In"] != null) { + a = navigator.plugins["Silverlight Plug-In"].description.split("."); + } + } + return a; +}; +dhtmlXForm.prototype.saveBackup = function () { + if (!this._backup) { + this._backup = {}; + this._backupId = new Date().getTime(); + } + this._backup[++this._backupId] = this.getFormData(); + return this._backupId; +}; +dhtmlXForm.prototype.restoreBackup = function (a) { + if (this._backup != null && this._backup[a] != null) { + this.setFormData(this._backup[a]); + } +}; +dhtmlXForm.prototype.clearBackup = function (a) { + if (this._backup != null && this._backup[a] != null) { + this._backup[a] = null; + delete this._backup[a]; + } +}; +dhtmlXForm.prototype.addItem = function (e, a, j, g) { + var c = null; + if (e instanceof Array) { + c = e[1]; + e = e[0]; + } + var h = null; + if (e != null) { + var h = this._getParentForm(e, c); + if (h != null) { + if (h.item._list == null) { + if (!a.listParent) { + a.listParent = h.item._idd; + } + h.form._addItem("list", h.item._idd, [a], null, h.item._idd, j, g); + } else { + h.item._list[0].addItem(null, a, j, g); + } + h.form = h.item = null; + h = null; + this._autoCheck(); + return; + } + } + this._prepareItem(a, j, g); + this._autoCheck(); +}; +dhtmlXForm.prototype.removeItem = function (c, a) { + this._removeItem(c, a); +}; +dhtmlXForm.prototype.removeColumn = function (l, j, g, e) { + var n = null; + if (l instanceof Array) { + n = l[1]; + l = l[0]; + } + if (l != null) { + var h = this._getParentForm(l, n); + if (h != null) { + if (h.item._list != null && h.item._list[0] != null) { + h.item._list[0].removeColumn(null, j, g, e); + } + h.form = h.item = null; + h = null; + } + return; + } + j = Math.min(Math.max(j, 0), this.cont.childNodes.length - 1); + if (this.cont.childNodes.length == 1) { + if (g == true) { + this._removeItemsInColumn(this.cont.childNodes[j]); + } + } else { + if (g == true) { + this._removeItemsInColumn(this.cont.childNodes[j]); + } else { + if (!e) { + var a = j - 1; + if (a < 0) { + a = j + 1; + } + } else { + var a = j + 1; + if (a > this.cont.childNodes.length - 1) { + a = j - 1; + } + } + while (this.cont.childNodes[j].childNodes.length > 0) { + this.cont.childNodes[a].appendChild(this.cont.childNodes[j].childNodes[0]); + } + } + var m = []; + for (var c = 0; c < this.base.length; c++) { + if (this.cont.childNodes[j] != this.base[c]) { + m.push(this.base[c]); + } + } + this.base = m; + this.cont.removeChild(this.cont.childNodes[j]); + this.b_index--; + m = null; + } +}; +dhtmlXForm.prototype.getColumnNode = function (e, c) { + var g = null; + var a = null; + if (e instanceof Array) { + a = e[1]; + e = e[0]; + } + if (e != null) { + var h = this._getParentForm(e, a); + if (h != null) { + if (h.item._list != null && h.item._list[0] != null && g == null) { + g = h.item._list[0].getColumnNode(null, c); + } + h.form = h.item = null; + h = null; + } + return g; + } + if (c < 0 || c > this.cont.childNodes.length - 1) { + return null; + } + return this.cont.childNodes[c]; +}; +dhtmlXForm.prototype._removeItemsInColumn = function (g) { + var a = []; + for (var e = 0; e < g.childNodes.length; e++) { + var c = g.childNodes[e]; + if (c._idd != null && c._type != null) { + a.push([c._idd, c._type == "ra" ? c._value : null]); + } + c = null; + } + for (var e = 0; e < a.length; e++) { + this.removeItem(a[e][0], a[e][1]); + } +}; +dhtmlXForm.prototype._getParentForm = function (j, h) { + if (this.itemPull[this.idPrefix + j] != null) { + return { form: this, item: this.itemPull[this.idPrefix + j] }; + } + for (var c in this.itemPull) { + if (this.itemPull[c]._type == "ra" && this.itemPull[c]._group == j && this.itemPull[c]._value == h) { + return { form: this, item: this.itemPull[c] }; + } + } + var g = null; + for (var c in this.itemPull) { + if (!g && this.itemPull[c]._list != null) { + for (var e = 0; e < this.itemPull[c]._list.length; e++) { + if (!g) { + g = this.itemPull[c]._list[e]._getParentForm(j, h); + } + } + } + } + return g; +}; +(function () { + for (var c in dhtmlXForm.prototype.items) { + if (!dhtmlXForm.prototype.items[c]._getItemNode) { + dhtmlXForm.prototype.items[c]._getItemNode = function (a) { + return a; + }; + } + } +})(); +dhtmlXForm.prototype._getItemNode = function (c, a) { + if (a != null) { + c = [c, a]; + } + return this.doWithItem(c, "_getItemNode"); +}; +dhtmlXForm.prototype.setRequired = function (m, j, h) { + if (typeof h == "undefined") { + h = j; + } else { + m = [m, j]; + } + var e = this._getItemNode(m); + if (!e) { + return; + } + h = window.dhx4.s2b(h); + e._required = h == true; + if (e._required) { + if (!e._validate) { + e._validate = []; + } + var c = false; + for (var g = 0; g < e._validate.length; g++) { + c = e._validate[g] == "NotEmpty" || c; + } + if (!c) { + e._validate.push("NotEmpty"); + } + var l = e.childNodes[e._ll ? 0 : 1].childNodes[0]; + if (!(l.lastChild && l.lastChild.className && l.lastChild.className.search(/required/) >= 0)) { + var a = document.createElement("SPAN"); + a.className = "dhxform_item_required"; + a.innerHTML = "*"; + l.appendChild(a); + a = l = null; + } + } else { + if (e._validate != null) { + var c = e._validate; + e._validate = []; + for (var g = 0; g < c.length; g++) { + if (c[g] != "NotEmpty") { + e._validate.push(c[g]); + } + } + if (e._validate.length == 0) { + e._validate = null; + } + } + var l = e.childNodes[e._ll ? 0 : 1].childNodes[0]; + if (l.lastChild && l.lastChild.className && l.lastChild.className.search(/required/) >= 0) { + l.removeChild(l.lastChild); + l = null; + } + } + this._resetValidateCss(e); + e = null; +}; +dhtmlXForm.prototype.setNote = function (h, e, a) { + if (typeof a == "undefined") { + a = e; + } else { + h = [h, e]; + } + var c = this._getItemNode(h); + if (!c) { + return; + } + var g = this._getNoteNode(c); + if (!g) { + if (!a.width) { + a.width = c.childNodes[c._ll ? 1 : 0].childNodes[0].offsetWidth; + } + g = document.createElement("DIV"); + g.className = "dhxform_note"; + if ({ ch: 1, ra: 1 }[c._type]) { + c.childNodes[c._ll ? 1 : 0].insertBefore(g, c.childNodes[c._ll ? 1 : 0].lastChild); + } else { + c.childNodes[c._ll ? 1 : 0].appendChild(g); + } + } + g.innerHTML = a.text; + if (a.width != null) { + g.style.width = a.width + "px"; + g._w = a.width; + } + g = null; +}; +dhtmlXForm.prototype.clearNote = function (g, c) { + if (typeof c != "undefined") { + g = [g, c]; + } + var a = this._getItemNode(g); + if (!a) { + return; + } + var e = this._getNoteNode(a); + if (e != null) { + e.parentNode.removeChild(e); + e = null; + } +}; +dhtmlXForm.prototype._getNoteNode = function (a) { + var e = null; + for (var c = 0; c < a.childNodes[a._ll ? 1 : 0].childNodes.length; c++) { + if (String(a.childNodes[a._ll ? 1 : 0].childNodes[c].className).search(/dhxform_note/) >= 0) { + e = a.childNodes[a._ll ? 1 : 0].childNodes[c]; + } + } + a = null; + return e; +}; +dhtmlXForm.prototype.setValidation = function (j, g, h) { + if (typeof note == "undefined") { + h = g; + } else { + j = [j, g]; + } + var c = this._getItemNode(j); + if (!c) { + return; + } + if (c._validate != null) { + for (var e = 0; e < c._validate.length; e++) { + c._validate[e] = null; + } + } + c._validate = []; + if (typeof h == "function" || typeof window[h] == "function") { + c._validate = [h]; + } else { + c._validate = String(h).split(this.separator); + } + if (c._required) { + var a = false; + for (var e = 0; e < c._validate.length; e++) { + a = c._validate[e] == "NotEmpty" || a; + } + if (!a) { + c._validate.push("NotEmpty"); + } + } + c = null; +}; +dhtmlXForm.prototype.clearValidation = function (g, e) { + if (typeof e != "undefined") { + g = [g, e]; + } + var a = this._getItemNode(g); + if (!a) { + return; + } + if (a._validate != null) { + for (var c = 0; c < a._validate.length; c++) { + a._validate[c] = null; + } + } + a._validate = a._required ? ["NotEmpty"] : null; + a = null; +}; +dhtmlXForm.prototype.reloadOptions = function (a, j) { + var c = this.getItemType(a); + if (!{ select: 1, multiselect: 1, combo: 1 }[c]) { + return; + } + if (c == "select" || c == "multiselect") { + var g = this.getOptions(a); + while (g.length > 0) { + g.remove(0); + } + g.length = 0; + g = null; + if (typeof j == "string") { + this.doWithItem(a, "doLoadOptsConnector", j); + } else { + if (j instanceof Array) { + this.doWithItem(a, "doLoadOpts", { options: j }); + } + } + } + if (c == "combo") { + var l = this.getCombo(a); + l.clearAll(); + l.setComboValue(""); + if (typeof j == "string") { + this.doWithItem(a, "doLoadOptsConnector", j); + } else { + if (j instanceof Array) { + var e = null; + for (var h = 0; h < j.length; h++) { + if (window.dhx4.s2b(j[h].selected)) { + e = j[h].value; + } + } + l.addOption(j); + if (e != null) { + this.setItemValue(a, e); + } + l = null; + } + } + } +}; +dhtmlXForm.prototype.setTooltip = function (j, h, g) { + if (typeof g == "undefined") { + g = h; + } else { + j = [j, h]; + } + var c = this._getItemNode(j); + if (!c) { + return; + } + var a = null; + if (c.childNodes.length == 1) { + a = c.childNodes[0]; + } else { + for (var e = 0; e < c.childNodes.length; e++) { + if (c.childNodes[e].className != null && c.childNodes[e].className.search("dhxform_label") >= 0) { + a = c.childNodes[e]; + } + } + } + if (a != null) { + if (g == null || g.length == 0) { + a.removeAttribute("title"); + } else { + a.title = g; + } + } + a = null; +}; +function dhtmlXAccordion(h, l) { + var g = this; + var e = window.dhx4.transDetect(); + this.conf = { + skin: l || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxacc") || "dhx_skyblue", + css: "dhxacc", + icons_path: "", + multi_mode: false, + last_opened: null, + on_active_id: null, + on_active_click: false, + size_changed: true, + def_height: 90, + total_count: 0, + hiden_count: 0, + cont_w: null, + }; + this.conf.tr = { + prop: e.transProp, + ev: e.transEv, + height_open: "height 0.2s cubic-bezier(0.25,0.1,0.25,1)", + height_close: "height 0.18s cubic-bezier(0.25,0.1,0.25,1)", + op_open: "opacity 0.16s ease-in", + op_close: "opacity 0.2s ease-out", + op_v_open: "1", + op_v_close: "0.4", + dnd_top: "top 0.16s", + }; + this.ofs = { + m: {}, + s: {}, + def: { m: { left: 0, right: 0, first: 0, between: 8 }, s: { left: 0, right: 0, first: 0, between: -1, last: 0 } }, + base: { s: {}, m: {} }, + skin: { dhx_web: { s: { between: 3 }, m: { between: 3 } }, dhx_terrace: { m: { between: 12, left: 0, right: 0 } } }, + }; + if (navigator.userAgent.indexOf("MSIE") >= 0 || navigator.userAgent.indexOf("Trident") >= 0) { + this.conf.tr.height_open = this.conf.tr.height_close; + } else { + this.conf.tr.height_open = this.conf.tr.height_close; + } + var j = null; + if (typeof h == "object" && !h.tagName) { + j = {}; + for (var c in h) { + j[c] = h[c]; + h[c] = null; + } + h = j.parent; + j.parent = null; + } + window.dhtmlXCellTop.apply(this, [h, h._ofs]); + this._adjustCont(); + if (this.base._ofs != null) { + for (var m in this.ofs.base) { + if (this.base._ofs[m] != null) { + for (var c in this.base._ofs[m]) { + this.ofs.base[m][c] = this.base._ofs[m][c]; + } + } + } + } + this._applyOffsets = function () { + for (var u in this.ofs.def) { + var r = this.ofs.def[u]; + var s = this.ofs.skin[this.conf.skin] != null && this.ofs.skin[this.conf.skin][u] != null ? this.ofs.skin[this.conf.skin][u] : null; + var o = this.base._ofs != null ? this.base._ofs[u] : null; + for (var n in r) { + if (s != null && s[n] != null) { + this.ofs[u][n] = s[n]; + } else { + if (o != null && o[n] != null) { + this.ofs[u][n] = o[n]; + } else { + this.ofs[u][n] = r[n]; + } + } + } + } + }; + this._applyOffsets(); + this.t = {}; + this.addItem = function (w, v, o, n, u) { + if (w == null) { + w = "a" + window.dhx4.newId(); + } + while (this.t[w] != null) { + w = "a" + window.dhx4.newId(); + } + var a = new dhtmlXAccordionCell(w, this); + a.conf.skin = this.conf.skin; + a.setText(v); + if (u != null) { + a.setIcon(u); + } + a.cell._accId = w; + a.cell.childNodes[a.conf.idx.hdr].onselectstart = function (x) { + x = x || event; + if (x.preventDefault) { + x.preventDefault(); + } else { + x.returnValue = false; + } + return false; + }; + a.cell.childNodes[a.conf.idx.hdr].onclick = function (y) { + y = y || event; + if (y.preventDefault) { + y.preventDefault(); + } else { + y.returnValue = false; + } + if (g._dnd != null && g._dnd.ofs == true) { + return; + } + var x = y.target || y.srcElement; + var A = null; + while (x._accId != this && A == null) { + if (x._accId != null) { + A = x._accId; + } else { + x = x.parentNode; + } + } + if (A != null) { + g._hdrClick(A); + } + }; + this.t[w] = { cell: a }; + this.conf.total_count++; + if (this.conf.multi_mode) { + if (typeof o == "undefined") { + o = true; + } + this.cont.appendChild(a.cell); + a.conf.opened = o == true; + if (typeof n == "undefined" || n == null || n == "*") { + if (n == "*") { + a.conf.h_auto = true; + } + n = this.conf.def_height; + } else { + n = Math.max(parseInt(n), 30); + } + a._setSize(this.ofs.m.left, 0, this.conf.cont_w || this._getAvailItemWidth(), a.conf.opened ? n : a._getHdrHeight()); + a.cell.style.marginTop = (a.cell == this.cont.firstChild ? this.ofs.m.first : this.ofs.m.between) + "px"; + if (o != true) { + a.conf.size.h = n; + a._adjustCell(); + a.cell.className += " dhx_cell_closed"; + } + this._adjustOpened(); + if (this._dnd != null) { + this._dndAttachEvent(w); + } + } else { + o = this.conf.last_opened == null ? true : window.dhx4.s2b(o); + var s = this._updateCellsHeight(); + if (this.conf.last_opened != null) { + if (o) { + this._closeItem(this.conf.last_opened, false); + } else { + var r = this.t[this.conf.last_opened].cell; + r._setSize(r.conf.size.x, r.conf.size.y, r.conf.size.w, s); + r = null; + } + } + this.cont.appendChild(a.cell); + a.conf.opened = o; + a.cell.style.marginTop = String(a.cell == this.cont.firstChild ? this.ofs.s.first : this.ofs.s.between) + "px"; + a._setSize(this.ofs.s.left, 0, this.conf.cont_w || this._getAvailItemWidth(), o ? s : a._getHdrHeight()); + if (o) { + this.conf.last_opened = w; + } else { + a.conf.size.h = s; + a._adjustCell(); + a.cell.className += " dhx_cell_closed"; + } + } + a = null; + return this.t[w].cell; + }; + this.removeItem = function (a) { + if (!this.t[a]) { + return; + } + if (this.conf.last_opened == a) { + this.conf.last_opened = null; + } + if (this.conf.on_active_id == a) { + this.conf.on_active_id = null; + } + if (this._dnd != null) { + this._dndClearCell(a); + } + this.conf.total_count--; + if (!this.conf.multi_mode && !this.t[a].cell.conf.visible) { + this.conf.hiden_count--; + } + this.t[a].cell._unload(); + this.t[a].cell = null; + this.t[a] = null; + delete this.t[a]; + if (!this.conf.unloading) { + if (!this.conf.multi_mode) { + this._updateCellsMargin(); + } + this.setSizes(); + } + }; + this.cells = function (a) { + return this.t[a].cell; + }; + this.enableMultiMode = function (a, n) { + this.conf.multi_mode = true; + if (!isNaN(n)) { + this.conf.def_height = n; + } + if (a == "auto" || a == "scroll") { + this.cont.style.overflowX = "hidden"; + this.cont.style.overflowY = a; + } else { + this.cont.style.overflow = "visible"; + } + }; + this.forEachItem = function (o) { + for (var n in this.t) { + if (typeof o == "function") { + o.apply(this, [this.t[n].cell]); + } else { + if (typeof o == "string" && typeof window[o] == "function") { + window[o].apply(this, [this.t[n].cell]); + } + } + } + }; + this._openItem = function (n, a) { + if (typeof a == "undefined") { + a = true; + } + if (this.t[n].cell.conf.opened == false) { + if (this.conf.multi_mode) { + this.t[n].cell._open(a); + } else { + if (this.conf.tr.prop == false) { + if (this.conf.last_opened != null) { + this.t[this.conf.last_opened].cell._close(false); + } + this.t[n].cell._open(false); + this.conf.last_opened = n; + } else { + this.conf.on_active_id = n; + this.t[n].cell._open(a); + if (this.conf.last_opened != null) { + this.t[this.conf.last_opened].cell._close(a); + } + this.conf.last_opened = n; + } + } + } + }; + this._closeItem = function (n, a) { + if (typeof a == "undefined") { + a = true; + } + if (this.t[n].cell.conf.opened == true) { + this.t[n].cell._close(a); + this.conf.last_opened = null; + } + }; + this._adjustOpened = function () { + if (this.conf.multi_mode == true) { + if (this._openCache == null) { + var s = this._getDynData(); + for (var o in s) { + this.t[o].cell.conf.size.h = s[o]; + this.t[o].cell.cell.style.height = s[o] + "px"; + } + } else { + var u = false; + for (var o in this._openCache) { + u = u || this._openCache[o]; + } + if (u == true) { + return; + } + this._openCache = this._openId = null; + } + var n = this._getAvailItemWidth(); + for (var o in this.t) { + var r = true; + if (n == this.t[o].cell.conf.size.w && (this._openMode == "close" || this.t[o].cell.conf.opened == false)) { + r = false; + } + if (r) { + this.t[o].cell._setWidth(n); + } + } + this._openMode = null; + } else { + if (this.conf.last_opened != null) { + var v = this.conf.last_opened; + this.t[v].cell._setSize(this.t[v].cell.conf.size.x, this.t[v].cell.conf.size.y, this.t[v].cell.conf.size.w, this.t[v].cell.conf.size.h); + } + } + }; + this._getDynData = function (C, A) { + if (typeof C == "undefined" || C == null) { + C = {}; + } + if (typeof A == "undefined" || A == null) { + A = {}; + } + var v = {}; + var y = 0; + var u = 0; + var r = 0; + for (var n = 0; n < this.cont.childNodes.length; n++) { + var o = this.cont.childNodes[n]._accId; + var E = this.t[o].cell; + if (E.conf.visible == true) { + var w = this.ofs.m[r == 0 ? "first" : "between"]; + if (C[o] == true || A[o] == true || (E.conf.opened == true && E.conf.h_auto == true)) { + if (A[o] == true) { + var x = E._getHdrHeight(); + v[o] = x; + u += x + w; + } else { + if (E.conf.h_auto == true) { + v[o] = true; + u += w; + y++; + } else { + if (C[o] == true) { + v[o] = E.conf.size.h; + u += E.conf.size.h + w; + } + } + } + } else { + u += E.cell.offsetHeight + w; + } + r++; + } + E = null; + } + if (y > 0) { + var s = this.cont.offsetHeight - u; + var u = Math.floor(s / y); + for (var D in v) { + if (v[D] == true) { + if (y > 1) { + s -= u; + } else { + u = s; + } + v[D] = u; + y--; + } + } + } + return v; + }; + this.setSizes = function () { + this._adjustCont(); + if (this.conf.multi_mode == true) { + this._adjustOpened(); + } else { + this.conf.cont_w = null; + var o = this._updateCellsHeight(); + for (var n in this.t) { + if (this.t[n].cell.conf.visible == true) { + this.t[n].cell._setSize(this.ofs.s.left, 0, this.conf.cont_w || this._getAvailItemWidth(), this.t[n].cell.conf.opened ? o : this.t[n].cell._getHdrHeight()); + if (this.t[n].cell.conf.opened != true) { + this.t[n].cell.conf.size.h = o; + this.t[n].cell._adjustCell(); + } + } + } + this.conf.size_changed = true; + } + this.callEvent("_onSetSizes", []); + }; + this.setSkin = function (o) { + this._setBaseSkin(o); + this.conf.skin = o; + for (var n in this.t) { + this.t[n].cell.conf.cells_cont = null; + this.t[n].cell.conf.skin = this.conf.skin; + } + this._applyOffsets(); + this._updateCellsMargin(); + this.setSizes(); + }; + this.setIconsPath = function (a) { + this.conf.icons_path = a; + }; + this._getAvailItemWidth = function () { + var n = this.ofs[this.conf.multi_mode ? "m" : "s"]; + var a = Math.max(this.cont.clientWidth - n.left - n.right, 10); + this.conf.cont_w = a; + n = null; + return a; + }; + this._updateCellsHeight = function () { + if (this.conf.multi_mode == true) { + return; + } + var o = this.conf.total_count - this.conf.hiden_count; + var r = this.cont.offsetHeight - this.ofs.s.last; + if (o == 0) { + return r; + } + var u = false; + for (var s = 0; s < this.cont.childNodes.length; s++) { + if (u == false) { + var v = this.cont.childNodes[s]._accId; + if (this.t[v].cell.conf.visible) { + r -= this.t[v].cell._getHdrHeight() * (o - 1); + u = true; + } + } + } + r -= (o - 1) * this.ofs.s.between + this.ofs.s.first; + for (var n in this.t) { + if (this.t[n].cell.conf.size != null) { + this.t[n].cell.conf.size.h = r; + this.t[n].cell._adjustCell(); + } + } + return r; + }; + this._updateCellsMargin = function () { + var a = 0; + for (var n = 0; n < this.cont.childNodes.length; n++) { + var o = this.cont.childNodes[n]._accId; + if (this.t[o].cell.conf.visible) { + this.t[o].cell.cell.style.marginTop = String(this.ofs[this.conf.multi_mode ? "m" : "s"][a++ == 0 ? "first" : "between"]) + "px"; + } + } + }; + this._hdrClick = function (n) { + if (!this.conf.multi_mode && this.t[n].cell.conf.opened) { + return; + } + var a = this.t[n].cell.conf.opened; + if (this.callEvent("onBeforeActive", [n, a ? false : true]) !== true) { + return; + } + this.conf.on_active_click = true; + this[a ? "_closeItem" : "_openItem"](n); + if (this.conf.multi_mode && this.conf.tr.prop == false) { + this._adjustOpened(); + } + }; + this.unload = function () { + this.conf.unloading = true; + for (var n in this.t) { + this.removeItem(n); + } + this.t = null; + if (typeof this._unloadDND == "function") { + this._unloadDND(); + } + if (this.dhxWins) { + this.dhxWins.unload(); + this.dhxWins = null; + } + this._unloadTop(); + window.dhx4._enableDataLoading(this, null, null, null, "clear"); + window.dhx4._eventable(this, "clear"); + this.ofs = this.conf = null; + for (var n in this) { + this[n] = null; + } + g = null; + }; + this.setOffset = function (a) { + this.ofs.s.between = a; + this.ofs.m.between = a; + this._updateCellsMargin(); + this.setSizes(); + }; + this._initObj = function (n) { + if (n.skin != null) { + this.setSkin(n.skin); + } + if (window.dhx4.s2b(n.multi_mode)) { + this.enableMultiMode(); + } + if (n.icons_path != null) { + this.setIconsPath(n.icons_path); + } + if (n.icon_path != null) { + this.setIconsPath(n.icon_path); + } + if (n.items != null) { + for (var a = 0; a < n.items.length; a++) { + this.addItem(n.items[a].id, n.items[a].text, n.items[a].open, n.items[a].height, n.items[a].icon || n.items[a].img); + } + } + if (window.dhx4.s2b(n.dnd) == true && typeof this.enableDND == "function") { + this.enableDND(); + } + }; + this._xmlToObj = function (s) { + var o = { items: [] }; + var a = s.getElementsByTagName("accordion")[0]; + if (a.getAttribute("skin") != null) { + o.skin = a.getAttribute("skin"); + } + if (a.getAttribute("mode") == "multi") { + o.multi_mode = true; + } + if (a.getAttribute("multiMode") != null) { + o.multi_mode = window.dhx4.s2b(a.getAttribute("multiMode")); + } + if (a.getAttribute("iconsPath") != null) { + o.icons_path = a.getAttribute("iconsPath"); + } + for (var r = 0; r < a.childNodes.length; r++) { + var u = a.childNodes[r]; + if (typeof u.tagName != "undefined" && String(u.tagName).toLowerCase() == "cell") { + var n = {}; + if (u.getAttribute("id") != null) { + n.id = u.getAttribute("id"); + } + if (u.getAttribute("icon") != null) { + n.icon = u.getAttribute("icon"); + } + if (u.getAttribute("height") != null) { + n.height = u.getAttribute("height"); + } + if (u.getAttribute("open") != null) { + n.open = window.dhx4.s2b(u.getAttribute("open")); + } + n.text = u.firstChild.nodeValue; + o.items.push(n); + } + u = null; + } + return o; + }; + window.dhx4._enableDataLoading(this, "_initObj", "_xmlToObj", "accordion", { struct: true }); + window.dhx4._eventable(this); + this._callMainEvent = function (n, a) { + return this.callEvent(n, a); + }; + this.attachEvent("onActive", function (a) { + if (a != null && this.t[a] != null && this.t[a].cell.dataObj != null && this.t[a].cell.dataType == "editor") { + this.t[a].cell.dataObj._prepareContent(true); + } + if (a != null && this.t[a] != null && this.t[a].cell.conf.opened == true) { + this.t[a].cell._adjustProgress(); + } + }); + if (typeof window.dhtmlXWindows == "function") { + this.dhxWins = new dhtmlXWindows(); + this.dhxWins.setSkin(this.conf.skin); + } + if (j != null) { + this._initObj(j); + j = null; + } + return this; +} +dhtmlXAccordion.prototype = new dhtmlXCellTop(); +function dhtmlXAccordionCell(g, e) { + dhtmlXCellObject.apply(this, [g, "_acc"]); + this.acc = e; + this.conf.visible = true; + this.conf.docked = true; + this.attachEvent("_onCellUnload", function () { + this._trDetachEv(); + this._unloadDocking(); + this.acc = null; + this.cell._accObj = null; + this.cell.childNodes[this.conf.idx.hdr].onselectstart = null; + this.cell.childNodes[this.conf.idx.hdr].onclick = null; + this._initHeader = null; + this._getHdrHeight = null; + this._setWidth = null; + this._adjustCell = null; + this._open = null; + this._close = null; + this._isOpened = null; + this._trInitEv = null; + this._trAttachEv = null; + this._trDetachEv = null; + this._trOnEnd = null; + this._onActiveCall = null; + this.setText = null; + this.getText = null; + this.setIcon = null; + this.clearIcon = null; + this.show = null; + this.hide = null; + this.isVisible = null; + this.setHeight = null; + this.moveOnTop = null; + }); + this.acc.attachEvent("onBeforeDrag", function (j) { + if (this.t[j].cell.dataObj != null && this.t[j].cell.dataType == "editor") { + if (this.conf.editor_data == null) { + this.conf.editor_data = {}; + } + this.conf.editor_data[j] = this.t[j].cell.dataObj.getContent(); + } + for (var h in this.t) { + this.t[h].cell._showCellCover(); + } + return true; + }); + this.acc.attachEvent("onDrop", function (j) { + if (this.t[j].cell.dataObj != null && this.t[j].cell.dataType == "editor") { + this.t[j].cell.dataObj._prepareContent(true); + if (this.conf.editor_data != null && this.conf.editor_data[j] != null) { + this.t[j].cell.dataObj.setContent(this.conf.editor_data[j]); + this.conf.editor_data[j] = null; + } + } + for (var h in this.t) { + this.t[h].cell._hideCellCover(); + } + }); + this.attachEvent("_onContentLoaded", function () { + this.acc._callMainEvent("onContentLoaded", arguments); + }); + this.attachEvent("_onBeforeContentAttach", function (a) { + if (a == "sidebar" && this.conf.skin != "dhx_skyblue") { + this._hideBorders(); + } + }); + this._initHeader(); + this.conf.tr = {}; + for (var c in this.acc.conf.tr) { + this.conf.tr[c] = this.acc.conf.tr[c]; + } + if (this.conf.tr.prop != false) { + this.attachEvent("_onIdxUpdated", function () { + this._cellSetOpacity(this.conf.opened ? "open" : "close", false); + }); + } + this.open = function (a) { + if (window.dhx4.s2b(a) == true) { + this.acc.conf.on_active_click = true; + } + this.acc._openItem(this._idd); + }; + this.close = function (a) { + if (window.dhx4.s2b(a) == true) { + this.acc.conf.on_active_click = true; + } + this.acc._closeItem(this._idd); + }; + this._setWidth = function (a) { + if (a != this.conf.size.w) { + this.conf.size.w = a; + this.cell.style.width = a + "px"; + } + this._adjustCell(); + }; + this._adjustCell = function () { + this._adjustCont(); + if (this.dataObj != null && typeof this.dataObj.setSizes == "function") { + this.dataObj.setSizes(); + } + }; + this._initDocking(); + return this; +} +dhtmlXAccordionCell.prototype = new dhtmlXCellObject(); +dhtmlXAccordionCell.prototype._initHeader = function () { + var a = document.createElement("DIV"); + a.className = "dhx_cell_hdr"; + a.innerHTML = "
"; + this.cell.insertBefore(a, this.cell.childNodes[this.conf.idx.cont]); + a = null; + this.conf.ofs_nodes.t._getHdrHeight = "func"; + this.conf.hdr = { visible: true }; + this.conf.idx_data.hdr = "dhx_cell_hdr"; + this._updateIdx(); +}; +dhtmlXAccordionCell.prototype._getHdrHeight = function () { + return this.cell.childNodes[this.conf.idx.hdr].offsetHeight; +}; +dhtmlXAccordionCell.prototype.showHeader = function () { + if (this.conf.hdr.visible == true) { + return; + } + this.conf.hdr.visible = true; + this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_hdr"; + this._adjustCont(this._idd); +}; +dhtmlXAccordionCell.prototype.hideHeader = function () { + if (this.conf.hdr.visible != true) { + return; + } + this.conf.hdr.visible = false; + this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_hdr dhx_cell_hdr_hidden"; + this._adjustCont(this._idd); +}; +dhtmlXAccordionCell.prototype.isHeaderVisible = function () { + return this.conf.hdr.visible == true; +}; +dhtmlXAccordionCell.prototype.setText = function (c) { + this.conf.text = c; + var a = this.cell.childNodes[this.conf.idx.hdr]; + a.childNodes[a.firstChild.className == "dhx_cell_hdr_icon" ? 1 : 0].innerHTML = "" + c + ""; + a = null; +}; +dhtmlXAccordionCell.prototype.getText = function () { + return this.conf.text; +}; +dhtmlXAccordionCell.prototype.setIcon = function (e) { + var c = this.cell.childNodes[this.conf.idx.hdr]; + if (c.firstChild.className != "dhx_cell_hdr_icon") { + c.firstChild.className += " dhx_cell_hdr_icon"; + var a = document.createElement("IMG"); + a.className = "dhx_cell_hdr_icon"; + c.insertBefore(a, c.firstChild); + a = null; + } + c.firstChild.src = this.acc.conf.icons_path + e; + c = null; +}; +dhtmlXAccordionCell.prototype.clearIcon = function () { + var a = this.cell.childNodes[this.conf.idx.hdr]; + if (a.firstChild.className == "dhx_cell_hdr_icon") { + a.removeChild(a.firstChild); + a.firstChild.className = String(a.firstChild.className).replace(/\s{1,}dhx_cell_hdr_icon/gi, ""); + } + a = null; +}; +dhtmlXAccordionCell.prototype._open = function (c) { + var h = {}; + if (this.acc.conf.multi_mode) { + var g = {}; + g[this._idd] = true; + h = this.acc._getDynData(g); + this.acc._openId = this._idd; + this.acc._openCache = {}; + this.acc._openMode = "open"; + } else { + h[this._idd] = this.conf.size.h; + } + for (var e in h) { + if (this.acc._openCache != null) { + this.acc._openCache[e] = true; + } + var j = this.acc.t[e].cell; + j.cell.className = String(j.cell.className).replace(/\s{1,}dhx_cell_closed/gi, ""); + j.conf.opened = true; + j._trInitEv("open", c); + j.conf.size.h = h[e]; + j.cell.style.height = j.conf.size.h + "px"; + j = null; + } + if (this.conf.tr.prop == false) { + this.acc._openId = this.acc._openCache = this.acc._openMode = null; + this._onActiveCall(true); + } +}; +dhtmlXAccordionCell.prototype._close = function (c) { + var g = {}; + if (this.acc.conf.multi_mode) { + var h = {}; + h[this._idd] = true; + g = this.acc._getDynData(null, h); + this.acc._openId = this._idd; + this.acc._openCache = {}; + this.acc._openMode = "close"; + } else { + g[this._idd] = this._getHdrHeight(); + } + for (var e in g) { + var j = this.acc.t[e].cell; + if (this.acc._openCache != null) { + this.acc._openCache[e] = true; + } + if (e == this._idd) { + j.cell.className += " dhx_cell_closed"; + j.conf.opened = false; + j._trInitEv("close", c); + } else { + j.conf.size.h = g[e]; + j._adjustCell(); + j._trInitEv("open", c); + } + j.cell.style.height = g[e] + "px"; + j = null; + } + if (this.conf.tr.prop == false) { + this.acc._openId = this.acc._openCache = this.acc._openMode = null; + this._onActiveCall(false); + } +}; +dhtmlXAccordionCell.prototype.isOpened = function () { + return this.conf.opened == true; +}; +dhtmlXAccordionCell.prototype._trInitEv = function (c, a) { + if (this.conf.tr.prop == false) { + return; + } + this._trAttachEv(); + if (!this.cell._accObj) { + this.cell._accObj = this.acc; + } + if (a) { + this.cell.style[this.conf.tr.prop] = this.conf.tr["height_" + c]; + } + this._cellSetOpacity(c, a); +}; +dhtmlXAccordionCell.prototype._trAttachEv = function () { + if (!this.conf.tr.ev_attached) { + this.cell._trProp = this.conf.tr.prop; + this.cell.addEventListener(this.conf.tr.ev, this._trOnEnd, false); + this.conf.tr.ev_attached = true; + } +}; +dhtmlXAccordionCell.prototype._trDetachEv = function () { + if (this.conf.tr.ev_attached) { + this.cell.addEventListener(this.conf.tr.ev, this._trOnEnd, false); + this.conf.tr.ev_attached = false; + } +}; +dhtmlXAccordionCell.prototype._trOnEnd = function (a) { + if (a.stopPropagation) { + a.stopPropagation(); + } + if (a.propertyName == "height" && this._accObj != null) { + this.style[this._trProp] = ""; + if (this._accObj.conf.multi_mode) { + if (this._accObj._openCache != null) { + this._accObj._openCache[this._accId] = false; + } + this._accObj._adjustOpened(); + } + if (this._accObj.conf.on_active_click == true) { + if (this._accObj.conf.multi_mode) { + this._accObj._callMainEvent("onActive", [this._accId, this._accObj.t[this._accId].cell.conf.opened]); + this._accObj.conf.on_active_click = false; + } else { + if (this._accObj.conf.on_active_id != null) { + this._accObj._callMainEvent("onActive", [this._accObj.conf.on_active_id, true]); + } + this._accObj.conf.on_active_id = null; + this._accObj.conf.on_active_click = false; + } + } + this._accObj = null; + } +}; +dhtmlXAccordionCell.prototype._cellSetOpacity = function (g, c) { + for (var e in this.conf.idx) { + if ({ hdr: true, pr1: true, pr2: true, cover: true }[e] != true) { + if (c) { + this.cell.childNodes[this.conf.idx[e]].style[this.conf.tr.prop] = this.conf.tr["op_" + g]; + } + this.cell.childNodes[this.conf.idx[e]].style.opacity = this.conf.tr["op_v_" + g]; + } + } +}; +dhtmlXAccordionCell.prototype._onActiveCall = function (a) { + if (this.acc.conf.on_active_click == false) { + return; + } + if (this.acc.conf.multi_mode == true) { + this.acc._callMainEvent("onActive", [this._idd, this.conf.opened]); + this.acc.conf.on_active_click = false; + } else { + if (a == true) { + this.acc._callMainEvent("onActive", [this._idd, true]); + this.acc.conf.on_active_click = false; + } + } +}; +dhtmlXAccordionCell.prototype.show = function () { + if (this.conf.visible) { + return; + } + if (this.conf.docked == false) { + this.dock(); + return; + } + this.cell.style.display = ""; + this.conf.visible = true; + if (!this.acc.conf.multi_mode) { + this.acc.conf.hiden_count--; + this.acc._updateCellsHeight(); + this.acc._updateCellsMargin(); + } + if (this.acc.conf.size_changed) { + this.acc.setSizes(); + this.acc.conf.size_changed = false; + } else { + this.acc._adjustOpened(); + } +}; +dhtmlXAccordionCell.prototype.hide = function () { + if (!this.conf.visible) { + return; + } + if (!this.acc.conf.multi_mode && this.conf.opened) { + this._close(false); + this.acc.conf.last_opened = null; + } + this.cell.style.display = "none"; + this.conf.visible = false; + if (!this.acc.conf.multi_mode) { + this.acc.conf.hiden_count++; + this.acc._updateCellsHeight(); + this.acc._updateCellsMargin(); + } + this.acc._adjustOpened(); +}; +dhtmlXAccordionCell.prototype.isVisible = function () { + return this.conf.visible == true; +}; +dhtmlXAccordionCell.prototype.setHeight = function (a) { + if (!this.acc.conf.multi_mode) { + return; + } + if (a == "*") { + this.conf.h_auto = true; + } else { + this.conf.h_auto = false; + this.conf.size.h = a; + } + if (this.conf.opened) { + if (a != "*") { + this.cell.style.height = a + "px"; + } + this.acc._adjustOpened(); + } +}; +dhtmlXAccordionCell.prototype.moveOnTop = function () { + if (this.cell.parentNode.firstChild == this.cell) { + return; + } + this.cell.parentNode.insertBefore(this.cell, this.cell.parentNode.firstChild); + this.acc._updateCellsMargin(); +}; +dhtmlXAccordionCell.prototype._initDocking = function () { + var a = this; + this.dock = function () { + if (this.acc.dhxWins == null || this.conf.docked == true) { + return; + } + var c = this.acc.dhxWins.window(this._idd); + c.close(); + this._attachFromCell(c); + this.conf.docked = true; + this.show(); + if (this.conf.dock_opened) { + this.open(); + } + c = null; + this.acc._callMainEvent("onDock", [this._idd]); + }; + this.undock = function (c, l, g, j) { + if (this.acc.dhxWins == null || this.conf.docked == false) { + return; + } + this.conf.dock_opened = this.conf.opened; + if (this.acc.dhxWins.window(this._idd) != null) { + var e = this.acc.dhxWins.window(this._idd); + e.show(); + } else { + if (c == null) { + c = 20; + } + if (l == null) { + l = 20; + } + if (g == null) { + g = 320; + } + if (j == null) { + j = 200; + } + var e = this.acc.dhxWins.createWindow(this._idd, c, l, g, j); + e.button("close").hide(); + e.addUserButton("dock", 99, "Dock"); + e.button("dock").show(); + e.button("dock").attachEvent("onClick", this._doOnDockClick); + e.setText(this.getText()); + e.attachEvent("onClose", this._doOnDockWinClose); + } + this.conf.docked = false; + this.hide(); + e._attachFromCell(this); + e = null; + this.acc._callMainEvent("onUnDock", [this._idd]); + }; + this._doOnDockClick = function () { + a.dock(); + }; + this._doOnDockWinClose = function (c) { + c.hide(); + return false; + }; + this._unloadDocking = function () { + a = null; + }; +}; +dhtmlXCellObject.prototype.attachAccordion = function (a) { + this.callEvent("_onBeforeContentAttach", ["acc"]); + var c = document.createElement("DIV"); + c.style.width = "100%"; + c.style.height = "100%"; + c.style.position = "relative"; + this._attachObject(c); + if (typeof a == "undefined") { + a = {}; + } + if (typeof a.skin == "undefined") { + a.skin = this.conf.skin; + } + a.parent = c; + if (typeof window.dhtmlXAccordionCell != "undefined" && this instanceof window.dhtmlXAccordionCell) { + c._ofs = { s: { first: -1 }, m: { first: 4 } }; + } + if (typeof window.dhtmlXTabBarCell != "undefined" && this instanceof window.dhtmlXTabBarCell) { + if (this.conf.skin == "dhx_skyblue") { + c._ofs = { t: -1, r: -1, b: -1, l: -1 }; + } + } + if (typeof window.dhtmlXSideBarCell != "undefined" && this instanceof window.dhtmlXSideBarCell) { + if (this.conf.skin == "dhx_web") { + c._ofs = {}; + if (this.sidebar.conf.autohide != true) { + c._ofs.l = 2; + } + if (this.sidebar.conf.header == true) { + c._ofs.t = 3; + } + } else { + c._ofs = { l: -1 }; + if (this.conf.skin == "dhx_terrace") { + if (this.sidebar.conf.autohide == true) { + c._ofs.l = 0; + } + if (this.sidebar.conf.header == true) { + c._ofs.t = -1; + } + } + } + } + if (typeof window.dhtmlXCarouselCell != "undefined" && this instanceof window.dhtmlXCarouselCell) { + this._hideBorders(); + } + this.dataType = "acc"; + this.dataObj = new dhtmlXAccordion(a); + a.parent = null; + c = a = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; +}; +dhtmlXAccordion.prototype.enableDND = function () { + if (this.conf.multi_mode == false || this._dnd != null) { + return; + } + var e = this; + this._dnd = { tr_count: 0, tr_items: {} }; + this._dndAttachEvent = function (g) { + var a = this.t[g].cell; + if (a.conf.dnd_inited != true) { + if (typeof window.addEventListener == "function") { + a.cell.childNodes[a.conf.idx.hdr].addEventListener("mousedown", this._dndOnMouseDown, false); + } else { + a.cell.childNodes[a.conf.idx.hdr].attachEvent("onmousedown", this._dndOnMouseDown); + } + a.conf.dnd_inited = true; + } + a = null; + }; + this._dndDetachEvent = function (g) { + var a = this.t[g].cell; + if (a.conf.dnd_inited == true) { + if (typeof window.addEventListener == "function") { + a.cell.childNodes[a.conf.idx.hdr].removeEventListener("mousedown", this._dndOnMouseDown, false); + } else { + a.cell.childNodes[a.conf.idx.hdr].detachEvent("onmousedown", this._dndOnMouseDown); + } + a.conf.dnd_inited = false; + } + a = null; + }; + this._dndOnMouseDown = function (g) { + g = g || event; + if (g.preventDefault) { + g.preventDefault(); + } + var a = g.target || g.srcElement; + while (a != null && a.parentNode != e.cont) { + a = a.parentNode; + } + if (a != null) { + e._dndDragStart(g, a); + } + a = null; + }; + this._dndDragStart = function (l, h) { + if (this._dnd.tr_waiting == true) { + return; + } + var a = -1; + for (var j = 0; j < h.parentNode.childNodes.length; j++) { + if (h.parentNode.childNodes[j] == h) { + a = j; + } + } + if (this.callEvent("onBeforeDrag", [h._accId, a]) !== true) { + return; + } + if (typeof window.addEventListener == "function") { + document.body.addEventListener("mousemove", this._dndOnMouseMove, false); + document.body.addEventListener("mouseup", this._dndOnMouseUp, false); + } else { + document.body.attachEvent("onmousemove", this._dndOnMouseMove, false); + document.body.attachEvent("onmouseup", this._dndOnMouseUp, false); + } + this._dnd.dragObj = h; + this._dnd.dy = l.clientY; + var g = 0; + for (var j = 0; j < this._dnd.dragObj.parentNode.childNodes.length; j++) { + this._dnd.dragObj.parentNode.childNodes[j]._ind = j; + if (this._dnd.dragObj.parentNode.childNodes[j] == this._dnd.dragObj) { + this._dnd.dragObj._k0 = g; + if (j > 0) { + this._dnd.dragObj._k0 += this.ofs.m.between - this.ofs.m.first; + } + g = 0; + } else { + g += this._dnd.dragObj.parentNode.childNodes[j].offsetHeight + parseInt(this._dnd.dragObj.parentNode.childNodes[j].style.marginTop); + } + } + this._dnd.dragObj._k1 = g; + this._dnd.h = this._dnd.dragObj.offsetHeight; + this._dnd.ofs = false; + }; + this._dndDoDrag = function (o) { + if (!this._dnd.dragObj) { + return; + } + if (this._dnd.tr_waiting == true) { + return; + } + var l = o.clientY - this._dnd.dy; + if (this._dnd.ofs == false && Math.abs(l) > 5) { + this._dnd.dragObj.className += " acc_cell_dragged"; + this._dnd.ofs = true; + } + if (l < 0) { + if (l < -this._dnd.dragObj._k0) { + l = -this._dnd.dragObj._k0; + } + } else { + if (l > this._dnd.dragObj._k1) { + l = this._dnd.dragObj._k1; + } + } + this._dnd.dragObj.style.top = l + "px"; + var n = o.clientY - this._dnd.dy; + var j = 0; + var g = 0; + for (var m = this._dnd.dragObj._ind + 1; m <= this._dnd.dragObj.parentNode.lastChild._ind; m++) { + var a = this._dnd.dragObj.parentNode.childNodes[m].offsetHeight; + if (n > j + (a * 2) / 3) { + g++; + } + j += a; + } + var h = this._dnd.dragObj.nextSibling; + var m = 0; + while (h != null) { + if (++m <= g && h != null) { + if (!h._ontop) { + if (h._tm) { + window.clearTimeout(h._tm); + } + this._dndAnim(h, false, parseInt(h.style.top || 0), -this._dnd.h - this.ofs.m.between); + h._ontop = true; + } + } else { + if (h._ontop) { + if (h._tm) { + window.clearTimeout(h._tm); + } + this._dndAnim(h, true, parseInt(h.style.top || 0), 0); + h._ontop = false; + } + } + h = h.nextSibling; + } + var n = this._dnd.dy - o.clientY; + var j = 0; + var g = 0; + for (var m = this._dnd.dragObj._ind - 1; m >= this._dnd.dragObj.parentNode.firstChild._ind; m--) { + var a = this._dnd.dragObj.parentNode.childNodes[m].offsetHeight; + if (n > j + (a * 2) / 3) { + g++; + } + j += a; + } + var h = this._dnd.dragObj.previousSibling; + var m = 0; + while (h != null) { + if (++m <= g && h != null) { + if (!h._onbottom) { + if (h._tm) { + window.clearTimeout(h._tm); + } + this._dndAnim(h, true, parseInt(h.style.top || 0), this._dnd.h + this.ofs.m.between); + h._onbottom = true; + } + } else { + if (h._onbottom) { + if (h._tm) { + window.clearTimeout(h._tm); + } + this._dndAnim(h, false, parseInt(h.style.top), 0); + h._onbottom = false; + } + } + h = h.previousSibling; + } + }; + this._dndDragStop = function (n, l) { + if (l) { + } else { + if (this._dnd.tr_count > 0) { + this._dnd.tr_waiting = true; + return; + } + } + if (!this._dnd.dragObj) { + return; + } + this._dnd.dragObj.className = String(this._dnd.dragObj.className).replace(/\s{0,}acc_cell_dragged/gi, ""); + this._dnd.dragObj.style.top = "0px"; + var m = false; + for (var j = 0; j < this._dnd.dragObj.parentNode.childNodes.length; j++) { + var h = this._dnd.dragObj.parentNode.childNodes[j]; + if (h != this._dnd.dragObj) { + if (h._tm) { + window.clearTimeout(h._tm); + } + h.style.top = "0px"; + if (h._ontop && ((h.nextSibling != null && h.nextSibling._ontop != true) || !h.nextSibling)) { + m = h.nextSibling || null; + } + if (h._onbottom && ((h.previousSibling != null && h.previousSibling._onbottom != true) || !h.previousSibling)) { + m = h; + } + } + h = null; + } + for (var j = 0; j < this._dnd.dragObj.parentNode.childNodes.length; j++) { + this._dnd.dragObj.parentNode.childNodes[j]._ontop = null; + this._dnd.dragObj.parentNode.childNodes[j]._onbottom = null; + } + if (m !== false) { + if (m == null) { + this._dnd.dragObj.parentNode.appendChild(this._dnd.dragObj); + } else { + this._dnd.dragObj.parentNode.insertBefore(this._dnd.dragObj, m); + } + } + var o = this._dnd.dragObj._accId; + var g = this._dnd.dragObj._ind; + var a = g; + for (var j = 0; j < this._dnd.dragObj.parentNode.childNodes.length; j++) { + if (this._dnd.dragObj.parentNode.childNodes[j] == this._dnd.dragObj) { + a = j; + } + } + this._dnd.dragObj = null; + this._dnd.tr_waiting = false; + this._updateCellsMargin(); + if (g != a) { + this.setSizes(); + this.callEvent("onDrop", [o, g, a]); + } + if (typeof window.addEventListener == "function") { + document.body.removeEventListener("mousemove", this._dndOnMouseMove, false); + document.body.removeEventListener("mouseup", this._dndOnMouseUp, false); + } else { + document.body.detachEvent("onmousemove", this._dndOnMouseMove, false); + document.body.detachEvent("onmouseup", this._dndOnMouseUp, false); + } + }; + this._dndAnim = function (l, a, j, h) { + if (this.conf.tr.prop != false) { + if (!l._dnd_ev) { + l._dnd_ev = true; + l._dnd_tr_prop = this.conf.tr.prop; + l.addEventListener(this.conf.tr.ev, this._dndOnTrEnd, false); + } + if (this._dnd.tr_items[l._accId] != true) { + this._dnd.tr_items[l._accId] = true; + this._dnd.tr_count++; + } + l.style[this.conf.tr.prop] = this.conf.tr.dnd_top; + l.style.top = h + "px"; + return; + } + var g = false; + if (a) { + j += 5; + if (j >= h) { + j = h; + g = true; + } + } else { + j -= 5; + if (j <= h) { + j = h; + g = true; + } + } + l.style.top = j + "px"; + if (l._tm) { + window.clearTimeout(l._tm); + } + if (!g) { + l._tm = window.setTimeout(function () { + e._dndAnim(l, a, j, h); + }, 5); + } else { + l._tm = null; + } + }; + this._dndOnTrEnd = function (a) { + if (a.stopPropagation) { + a.stopPropagation(); + } + if (a.propertyName == "top") { + if (e._dnd.tr_items[this._accId] == true) { + e._dnd.tr_count--; + e._dnd.tr_items[this._accId] = false; + } + this.style[this._dnd_tr_prop] = ""; + if (e._dnd.tr_count == 0 && e._dnd.tr_waiting == true) { + e._dndDragStop(null, true); + } + } + }; + this._dndOnMouseMove = function (a) { + e._dndDoDrag(a || event); + }; + this._dndOnMouseUp = function (a) { + e._dndDragStop(a || event); + }; + this._dndClearCell = function (a) { + if (this.t[a].cell.cell._dnd_ev) { + this.t[a].cell.cell.addEventListener(this.conf.tr.ev, this._dndOnTrEnd, false); + } + this._dndDetachEvent(a); + }; + this._unloadDND = function () { + for (var g in this) { + if (String(g).indexOf("_dnd") == 0 && typeof this[g] == "function") { + this[g] = null; + } + } + this._dnd = null; + e = null; + }; + for (var c in this.t) { + this._dndAttachEvent(c); + } +}; +function dhtmlXLayoutObject(e, n, v) { + var s = null; + if (e != null && typeof e == "object" && typeof e.tagName == "undefined" && e._isCell != true) { + s = {}; + if (e.autosize != null) { + s.autosize = e.autosize; + } + if (e.cells != null) { + s.cells = e.cells; + } + if (e.pattern != null) { + n = e.pattern; + } + if (e.skin != null) { + v = e.skin; + } + if (e.offsets != null) { + s.offsets = e.offsets; + } + e = e.parent; + } + this.cdata = {}; + this.conf = { + skin: v || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxlayout") || "dhx_skyblue", + css: "dhxlayout", + hh: 20, + autosize: "b", + nextCell: { a: "b", b: "a" }, + inited: false, + b_size: { w: -1, h: -1 }, + }; + if (typeof e == "object" && e._isCell == true) { + var m = typeof s != "undefined" && s != null ? s : {}; + if (m.pattern == null && n != null) { + m.pattern = n; + } + if (m.skin == null && v != null) { + m.skin = v; + } + var j = e.attachLayout(m); + return j; + } + window.dhtmlXCellTop.apply(this, [e, s == null ? null : s.offsets]); + this.conf.sw = this._detectSW(); + var l = this; + this._getLayout = function () { + return this; + }; + this.mainInst = e._layoutMainInst != null ? e._layoutMainInst : null; + this._getMainInst = function () { + if (this.mainInst != null) { + return this.mainInst._getMainInst(); + } + return this; + }; + this._init = function (A) { + var y = typeof A == "string" ? this.tplData[A] : A; + this.conf.mode = y.mode; + if (this.conf.mode == "c") { + this.cdata.a = new dhtmlXLayoutCell("a", this); + } else { + this.cdata.a = new dhtmlXLayoutCell("a", this); + this.cdata.b = new dhtmlXLayoutCell("b", this); + } + for (var x in this.cdata) { + this.cont.appendChild(this.cdata[x].cell); + this.cdata[x].conf.init = { w: 0.5, h: 0.5 }; + } + if (this.conf.mode != "c") { + var w = this._getMainInst(); + if (w.conf.sep_idx == null) { + w.conf.sep_idx = 1; + } else { + w.conf.sep_idx++; + } + this.sep = new dhtmlXLayoutSepObject(this.conf.mode, w.conf.sep_idx); + this.cont.appendChild(this.sep.sep); + this.sep._getLayout = function () { + return l._getLayout(); + }; + w = null; + } + if (y.cells != null) { + for (var x in y.cells) { + if (y.cells[x].width != null) { + this.cdata[x].conf.init.w = y.cells[x].width; + } + if (y.cells[x].height != null) { + this.cdata[x].conf.init.h = y.cells[x].height; + } + if (y.cells[x].name != null) { + this.cdata[x].conf.name = y.cells[x].name; + this.cdata[x].setText(y.cells[x].name); + } + if (y.cells[x].fsize != null) { + this.cdata[x].conf.fsize = y.cells[x].fsize; + } + } + } + this.setSizes(); + for (var x in this.cdata) { + this.cdata[x].conf.init = {}; + } + if (y.cells != null) { + for (var x in y.cells) { + if (y.cells[x].layout != null) { + this.cdata[x].dataNested = true; + this.cdata[x]._layoutMainInst = this; + this.cdata[x].attachLayout({ pattern: y.cells[x].layout }); + this.cdata[x]._layoutMainInst = null; + } + } + } + }; + this.setSizes = function (F, N, J, y) { + var H = this.conf.inited == true && this._getMainInst() == this && this.checkEvent("onResizeFinish") == true ? {} : false; + this._adjustCont(); + var M = this.cont.offsetWidth; + var D = this.cont.offsetHeight; + if (this.conf.mode == "c") { + var a = 0; + var O = 0; + var x = M; + var L = D; + this.cdata.a._setSize(a, O, x, L, F, J, y); + this.callEvent("_onSetSizes", []); + if (H && !(this.conf.b_size.w == M && this.conf.b_size.h == D)) { + this._callMainEvent("onResizeFinish", []); + } + this.conf.b_size = { w: M, h: D }; + return; + } + if (typeof N == "undefined") { + var A = this.conf.mode == "v" ? "w" : "h"; + N = this.conf.autosize; + if (this.cdata.a.conf.collapsed) { + N = "b"; + } else { + if (this.cdata.b.conf.collapsed) { + N = "a"; + } else { + if (F == "a" || F == "b") { + N = this.conf.nextCell[F]; + } + } + } + } else { + } + if (this.conf.mode == "v") { + if (N == "a") { + if (this.cdata.b.conf.init.w != null) { + var K = Math.round(M * this.cdata.b.conf.init.w - this.conf.sw / 2); + } else { + var K = this.cdata.b.conf.size.w; + } + var I = M - K; + var E = 0; + var C = D; + var a = 0; + var O = E; + var x = I - a - this.conf.sw; + var L = C; + } else { + var a = 0; + var O = 0; + if (this.cdata.a.conf.init.w != null) { + var x = Math.round(M * this.cdata.a.conf.init.w - this.conf.sw / 2) - a; + } else { + var x = this.cdata.a.conf.size.w; + } + var L = D - O; + var I = a + x + this.conf.sw; + var E = O; + var K = M - I; + var C = L; + } + this.cdata.a._setSize(a, O, x, L, F, J, y); + this.cdata.b._setSize(I, E, K, C, F, J, y); + this.sep._setSize(a + x, O, this.conf.sw, L); + } else { + if (N == "a") { + if (this.cdata.b.conf.init.h != null) { + var C = Math.round(D * this.cdata.b.conf.init.h - this.conf.sw / 2); + } else { + var C = this.cdata.b.conf.size.h; + } + var I = 0; + var E = D - C; + var K = M - I; + var a = I; + var O = 0; + var x = K; + var L = E - O - this.conf.sw; + } else { + var a = 0; + var O = 0; + var x = M - a; + if (this.cdata.a.conf.init.h != null) { + var L = Math.round(D * this.cdata.a.conf.init.h - this.conf.sw / 2); + } else { + var L = this.cdata.a.conf.size.h; + } + var I = a; + var E = O + L + this.conf.sw; + var K = x; + var C = D - E; + } + this.cdata.a._setSize(a, O, x, L, F, J, y); + this.cdata.b._setSize(I, E, K, C, F, J, y); + this.sep._setSize(a, O + L, x, this.conf.sw); + } + this.callEvent("_onSetSizes", []); + if (H && !(this.conf.b_size.w == M && this.conf.b_size.h == D)) { + this._callMainEvent("onResizeFinish", []); + } + this.conf.b_size = { w: M, h: D }; + }; + this._getAvailWidth = function () { + var A = []; + for (var E = 0; E < this.conf.as_cells.h.length; E++) { + var x = this.cells(this.conf.as_cells.h[E]); + var C = x.layout; + var y = C.conf.autosize; + if (x.conf.collapsed) { + x = C.cdata[C.conf.nextCell[x._idd]]; + y = C.conf.nextCell[y]; + } + A.push(Math.max(0, x.getWidth() - x._getMinWidth(y))); + C = x = null; + } + var D = A.length > 0 ? Math.min.apply(window, A) : 0; + return this.cont.offsetWidth - D; + }; + this._getAvailHeight = function () { + var A = []; + for (var D = 0; D < this.conf.as_cells.v.length; D++) { + var w = this.cells(this.conf.as_cells.v[D]); + var y = w.layout; + var x = y.conf.autosize; + if (w.conf.collapsed) { + w = y.cdata[y.conf.nextCell[w._idd]]; + x = y.conf.nextCell[x]; + } + A.push(Math.max(0, w.getHeight() - w._getHdrHeight() - w._getMinHeight(x))); + y = w = null; + } + var C = Math.min.apply(window, A); + return this.cont.offsetHeight - C; + }; + this.setSkin = function (a) { + this._setBaseSkin(a); + this.conf.skin = a; + }; + this.unload = function () { + this.conf.unloading = true; + this.mainInst = null; + this.parentLayout = null; + if (this.items != null) { + for (var x = 0; x < this.items.length; x++) { + this.items[x] = null; + } + this.items = null; + } + if (this.dhxWins != null) { + this.dhxWins.unload(); + this.dhxWins = null; + } + if (this.sep != null) { + this.sep._unload(); + this.sep = null; + } + for (var w in this.cdata) { + this.cdata[w]._unload(); + this.cdata[w] = null; + } + this._unloadTop(); + window.dhx4._eventable(this, "clear"); + for (var w in this) { + this[w] = null; + } + l = null; + }; + this._getWindowMinDimension = function (A) { + var a = l._getAvailWidth() + 7 + 7; + var y = l._getAvailHeight() + 7 + 31; + var x = { w: Math.max(a, 200), h: Math.max(y, 140) }; + A = null; + return x; + }; + window.dhx4._eventable(this); + this._callMainEvent = function (w, a) { + return this.callEvent(w, a); + }; + this._init(n || "3E"); + var o = this._availAutoSize[n]; + if (o != null) { + this.conf.pattern = n; + this.setAutoSize(o.h[o.h.length - 1], o.v[o.v.length - 1]); + } + if (typeof window.dhtmlXWindows == "function" && this.mainInst == null) { + var g = { vp_overflow: this.conf.fs_mode == true ? false : "auto" }; + this.dhxWins = new dhtmlXWindows(g); + this.dhxWins.setSkin(this.conf.skin); + } + this.conf.inited = true; + if (this == this._getMainInst()) { + var r = 0; + this.items = []; + this.forEachItem(function (a) { + l.items.push(a); + a.conf.index = r++; + }); + } + if (this == this._getMainInst() && s != null) { + if (s.autosize != null) { + this.setAutoSize.apply(this, s.autosize); + } + if (s.cells != null) { + for (var c = 0; c < s.cells.length; c++) { + var h = s.cells[c]; + var u = this.cells(h.id); + if (h.width) { + u.setWidth(h.width); + } + if (h.height) { + u.setHeight(h.height); + } + if (h.text) { + u.setText(h.text); + } + if (h.collapsed_text) { + u.setCollapsedText(h.collapsed_text); + } + if (h.collapse) { + u.collapse(); + } + if (h.fix_size) { + u.fixSize(h.fix_size[0], h.fix_size[1]); + } + if (typeof h.header != "undefined" && window.dhx4.s2b(h.header) == false) { + u.hideHeader(); + } + } + } + } + s = null; + return this; +} +dhtmlXLayoutObject.prototype = new dhtmlXCellTop(); +dhtmlXLayoutObject.prototype.cells = function (g) { + for (var c in this.cdata) { + if (this.cdata[c].conf.name == g) { + return this.cdata[c]; + } + if (this.cdata[c].dataType == "layout" && this.cdata[c].dataNested == true && this.cdata[c].dataObj != null) { + var e = this.cdata[c].dataObj.cells(g); + if (e != null) { + return e; + } + } + } + return null; +}; +dhtmlXLayoutObject.prototype.forEachItem = function (g, e) { + if (typeof g != "function") { + return; + } + if (typeof e == "undefined") { + e = this; + } + for (var c in this.cdata) { + if (typeof this.cdata[c].conf.name != "undefined") { + g.apply(e, [this.cdata[c]]); + } + if (this.cdata[c].dataType == "layout" && this.cdata[c].dataNested == true && this.cdata[c].dataObj != null) { + this.cdata[c].dataObj.forEachItem(g, e); + } + } + e = null; +}; +dhtmlXLayoutObject.prototype._forEachSep = function (g, e) { + if (typeof g != "function") { + return; + } + if (typeof e == "undefined") { + e = this; + } + if (this.sep != null) { + g.apply(e, [this.sep]); + } + for (var c in this.cdata) { + if (this.cdata[c].dataType == "layout" && this.cdata[c].dataNested == true && this.cdata[c].dataObj != null) { + this.cdata[c].dataObj._forEachSep(g, e); + } + } + e = null; +}; +dhtmlXLayoutObject.prototype._detectSW = function () { + if (this._confGlob.sw == null) { + this._confGlob.sw = {}; + } + if (this._confGlob.sw[this.conf.skin] == null) { + this._confGlob.sw[this.conf.skin] = window.dhx4.readFromCss("dhxlayout_sep_sw_" + this.conf.skin); + } + return this._confGlob.sw[this.conf.skin]; +}; +dhtmlXLayoutObject.prototype._confGlob = {}; +dhtmlXLayoutObject.prototype.listPatterns = function () { + var e = []; + for (var c in this.tplData) { + e.push(c); + } + return e; +}; +dhtmlXLayoutObject.prototype.listAutoSizes = function () { + var g = this.conf.as_cells != null ? this.conf.as_cells.h.join(";") : ""; + var e = this.conf.as_cells != null ? this.conf.as_cells.v.join(";") : ""; + var c = this._availAutoSize[this.conf.pattern].h; + var a = this._availAutoSize[this.conf.pattern].v; + return [g, e, c, a]; +}; +dhtmlXLayoutObject.prototype._getCellsNames = function (g) { + var h = {}; + if (this.cdata[g].conf.name != null) { + h[this.cdata[g].conf.name] = true; + } + if (this.cdata[g].dataType == "layout" && this.cdata[g].dataObj != null && this.cdata[g].dataObj.mainInst == this) { + var c = this.cdata[g].dataObj._getCellsNames("a"); + var j = this.cdata[g].dataObj._getCellsNames("b"); + for (var e in c) { + h[e] = c[e]; + } + for (var e in j) { + h[e] = j[e]; + } + } + return h; +}; +dhtmlXLayoutObject.prototype.setAutoSize = function (c, n, o) { + if (o !== true) { + var u = this.listAutoSizes(); + if (u[0] == c && u[1] == n) { + return; + } + var l = false; + var j = false; + for (var e = 0; e < u[2].length; e++) { + l = l || u[2][e] == c; + } + for (var e = 0; e < u[3].length; e++) { + j = j || u[3][e] == n; + } + if (!l || !j) { + return; + } + } + this.conf.as_cells = { h: c.split(";"), v: n.split(";") }; + var g = this.conf.mode == "v" ? "h" : "v"; + for (var r in this.cdata) { + var h = this._getCellsNames(r); + var v = false; + for (var e = 0; e < this.conf.as_cells[g].length; e++) { + v = v || h[this.conf.as_cells[g][e]]; + } + if (v) { + this.conf.autosize = r; + } + if (this.cdata[r].dataType == "layout" && this.cdata[r].dataObj != null) { + this.cdata[r].dataObj.setAutoSize(c, n, true); + } + } +}; +dhtmlXLayoutObject.prototype.tplData = { + "1C": { mode: "c", cells: { a: { name: "a" } } }, + "2E": { mode: "h", cells: { a: { name: "a", fsize: { v: 1 } }, b: { name: "b", fsize: { v: 1 } } } }, + "2U": { mode: "v", cells: { a: { name: "a", fsize: { h: 1 } }, b: { name: "b", fsize: { h: 1 } } } }, + "3E": { mode: "h", cells: { a: { name: "a", height: 1 / 3, fsize: { v: 1 } }, b: { layout: { mode: "h", cells: { a: { name: "b", fsize: { v: [1, 2] } }, b: { name: "c", fsize: { v: 2 } } } } } } }, + "3W": { mode: "v", cells: { a: { name: "a", width: 1 / 3, fsize: { h: 1 } }, b: { layout: { mode: "v", cells: { a: { name: "b", fsize: { h: [1, 2] } }, b: { name: "c", fsize: { h: 2 } } } } } } }, + "3J": { mode: "v", cells: { a: { layout: { mode: "h", cells: { a: { name: "a", fsize: { h: 1, v: 2 } }, b: { name: "c", fsize: { h: 1, v: 2 } } } } }, b: { name: "b", fsize: { h: 1 } } } }, + "3L": { mode: "v", cells: { a: { name: "a", fsize: { h: 1 } }, b: { layout: { mode: "h", cells: { a: { name: "b", fsize: { h: 1, v: 2 } }, b: { name: "c", fsize: { h: 1, v: 2 } } } } } } }, + "3T": { mode: "h", cells: { a: { name: "a", fsize: { v: 1 } }, b: { layout: { mode: "v", cells: { a: { name: "b", fsize: { h: 2, v: 1 } }, b: { name: "c", fsize: { h: 2, v: 1 } } } } } } }, + "3U": { mode: "h", cells: { a: { layout: { mode: "v", cells: { a: { name: "a", fsize: { h: 2, v: 1 } }, b: { name: "b", fsize: { h: 2, v: 1 } } } } }, b: { name: "c", fsize: { v: 1 } } } }, + "4H": { + mode: "v", + cells: { + a: { name: "a", width: 1 / 3, fsize: { h: 1 } }, + b: { layout: { mode: "v", cells: { a: { layout: { mode: "h", cells: { a: { name: "b", fsize: { h: [1, 2], v: 3 } }, b: { name: "c", fsize: { h: [1, 2], v: 3 } } } } }, b: { name: "d", fsize: { h: 2 } } } } }, + }, + }, + "4I": { + mode: "h", + cells: { + a: { name: "a", height: 1 / 3, fsize: { v: 1 } }, + b: { layout: { mode: "h", cells: { a: { layout: { mode: "v", cells: { a: { name: "b", fsize: { h: 3, v: [1, 2] } }, b: { name: "c", fsize: { h: 3, v: [1, 2] } } } } }, b: { name: "d", fsize: { v: 2 } } } } }, + }, + }, + "4T": { + mode: "h", + cells: { + a: { name: "a", fsize: { v: 1 } }, + b: { layout: { mode: "v", cells: { a: { name: "b", width: 1 / 3, fsize: { h: 2, v: 1 } }, b: { layout: { mode: "v", cells: { a: { name: "c", fsize: { h: [2, 3], v: 1 } }, b: { name: "d", fsize: { h: 3, v: 1 } } } } } } } }, + }, + }, + "4U": { + mode: "h", + cells: { + a: { layout: { mode: "v", cells: { a: { name: "a", width: 1 / 3, fsize: { h: 2, v: 1 } }, b: { layout: { mode: "v", cells: { a: { name: "b", fsize: { h: [2, 3], v: 1 } }, b: { name: "c", fsize: { h: 3, v: 1 } } } } } } } }, + b: { name: "d", fsize: { v: 1 } }, + }, + }, + "4E": { + mode: "h", + cells: { + a: { name: "a", height: 1 / 4, fsize: { v: 1 } }, + b: { layout: { mode: "h", cells: { a: { name: "b", height: 1 / 3, fsize: { v: [1, 2] } }, b: { layout: { mode: "h", cells: { a: { name: "c", fsize: { v: [2, 3] } }, b: { name: "d", fsize: { v: 3 } } } } } } } }, + }, + }, + "4W": { + mode: "v", + cells: { + a: { name: "a", width: 1 / 4, fsize: { h: 1 } }, + b: { layout: { mode: "v", cells: { a: { name: "b", width: 1 / 3, fsize: { h: [1, 2] } }, b: { layout: { mode: "v", cells: { a: { name: "c", fsize: { h: [2, 3] } }, b: { name: "d", fsize: { h: 3 } } } } } } } }, + }, + }, + "4A": { + mode: "v", + cells: { + a: { width: 1 / 3, layout: { mode: "h", cells: { a: { name: "a", fsize: { h: 1, v: 2 } }, b: { name: "b", fsize: { h: 1, v: 2 } } } } }, + b: { layout: { mode: "v", cells: { a: { name: "c", fsize: { h: [1, 3] } }, b: { name: "d", fsize: { h: 3 } } } } }, + }, + }, + "4L": { + mode: "v", + cells: { + a: { name: "a", width: 1 / 3, fsize: { h: 1 } }, + b: { layout: { mode: "v", cells: { a: { name: "b", fsize: { h: [1, 2] } }, b: { layout: { mode: "h", cells: { a: { name: "c", fsize: { h: 2, v: 3 } }, b: { name: "d", fsize: { h: 2, v: 3 } } } } } } } }, + }, + }, + "4J": { + mode: "h", + cells: { + a: { name: "a", height: 1 / 3, fsize: { v: 1 } }, + b: { layout: { mode: "h", cells: { a: { name: "b", fsize: { v: [1, 2] } }, b: { layout: { mode: "v", cells: { a: { name: "c", fsize: { h: 3, v: 2 } }, b: { name: "d", fsize: { h: 3, v: 2 } } } } } } } }, + }, + }, + "4F": { + mode: "h", + cells: { + a: { height: 1 / 3, layout: { mode: "v", cells: { a: { name: "a", fsize: { h: 2, v: 1 } }, b: { name: "b", fsize: { h: 2, v: 1 } } } } }, + b: { layout: { mode: "h", cells: { a: { name: "c", fsize: { v: [1, 3] } }, b: { name: "d", fsize: { v: 3 } } } } }, + }, + }, + "4G": { + mode: "v", + cells: { + a: { layout: { mode: "h", cells: { a: { name: "a", height: 1 / 3, fsize: { h: 1, v: 2 } }, b: { layout: { mode: "h", cells: { a: { name: "b", fsize: { h: 1, v: [2, 3] } }, b: { name: "c", fsize: { h: 1, v: 3 } } } } } } } }, + b: { name: "d", fsize: { h: 1 } }, + }, + }, + "4C": { + mode: "v", + cells: { + a: { name: "a", fsize: { h: 1 } }, + b: { layout: { mode: "h", cells: { a: { name: "b", height: 1 / 3, fsize: { h: 1, v: 2 } }, b: { layout: { mode: "h", cells: { a: { name: "c", fsize: { h: 1, v: [2, 3] } }, b: { name: "d", fsize: { h: 1, v: 3 } } } } } } } }, + }, + }, + "5H": { + mode: "v", + cells: { + a: { width: 1 / 3, name: "a", fsize: { h: 1 } }, + b: { + layout: { + mode: "v", + cells: { + a: { + layout: { + mode: "h", + cells: { + a: { name: "b", height: 1 / 3, fsize: { h: [1, 2], v: 3 } }, + b: { layout: { mode: "h", cells: { a: { name: "c", fsize: { h: [1, 2], v: [3, 4] } }, b: { name: "d", fsize: { h: [1, 2], v: 4 } } } } }, + }, + }, + }, + b: { name: "e", fsize: { h: 2 } }, + }, + }, + }, + }, + }, + "5I": { + mode: "h", + cells: { + a: { height: 1 / 3, name: "a", fsize: { v: 1 } }, + b: { + layout: { + mode: "h", + cells: { + a: { + layout: { + mode: "v", + cells: { a: { name: "b", width: 1 / 3, fsize: { h: 3, v: [1, 2] } }, b: { layout: { mode: "v", cells: { a: { name: "c", fsize: { h: [3, 4], v: [1, 2] } }, b: { name: "d", fsize: { h: 4, v: [1, 2] } } } } } }, + }, + }, + b: { name: "e", fsize: { v: 2 } }, + }, + }, + }, + }, + }, + "5U": { + mode: "h", + cells: { + a: { + layout: { + mode: "v", + cells: { + a: { name: "a", width: 1 / 4, fsize: { h: 2, v: 1 } }, + b: { + layout: { + mode: "v", + cells: { a: { name: "b", width: 1 / 3, fsize: { h: [2, 3], v: 1 } }, b: { layout: { mode: "v", cells: { a: { name: "c", fsize: { h: [3, 4], v: 1 } }, b: { name: "d", fsize: { h: 4, v: 1 } } } } } }, + }, + }, + }, + }, + }, + b: { name: "e", fsize: { v: 1 } }, + }, + }, + "5E": { + mode: "h", + cells: { + a: { name: "a", height: 1 / 5, fsize: { v: 1 } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "b", height: 1 / 4, fsize: { v: [1, 2] } }, + b: { layout: { mode: "h", cells: { a: { name: "c", height: 1 / 3, fsize: { v: [2, 3] } }, b: { layout: { mode: "h", cells: { a: { name: "d", fsize: { v: [3, 4] } }, b: { name: "e", fsize: { v: 4 } } } } } } } }, + }, + }, + }, + }, + }, + "5W": { + mode: "v", + cells: { + a: { name: "a", width: 1 / 5, fsize: { h: 1 } }, + b: { + layout: { + mode: "v", + cells: { + a: { name: "b", width: 1 / 4, fsize: { h: [1, 2] } }, + b: { layout: { mode: "v", cells: { a: { name: "c", width: 1 / 3, fsize: { h: [2, 3] } }, b: { layout: { mode: "v", cells: { a: { name: "d", fsize: { h: [3, 4] } }, b: { name: "e", fsize: { h: 4 } } } } } } } }, + }, + }, + }, + }, + }, + "5K": { + mode: "v", + cells: { + a: { layout: { mode: "h", cells: { a: { name: "a", height: 1 / 3, fsize: { h: 1, v: 2 } }, b: { layout: { mode: "h", cells: { a: { name: "b", fsize: { h: 1, v: [2, 3] } }, b: { name: "c", fsize: { h: 1, v: 3 } } } } } } } }, + b: { layout: { mode: "h", cells: { a: { name: "d", fsize: { h: 1, v: 4 } }, b: { name: "e", fsize: { h: 1, v: 4 } } } } }, + }, + }, + "5S": { + mode: "v", + cells: { + a: { layout: { mode: "h", cells: { a: { name: "a", fsize: { h: 1, v: 2 } }, b: { name: "b", fsize: { h: 1, v: 2 } } } } }, + b: { layout: { mode: "h", cells: { a: { name: "c", height: 1 / 3, fsize: { h: 1, v: 3 } }, b: { layout: { mode: "h", cells: { a: { name: "d", fsize: { h: 1, v: [3, 2] } }, b: { name: "e", fsize: { h: 1, v: 4 } } } } } } } }, + }, + }, + "5G": { + mode: "v", + cells: { + a: { + width: 1 / 3, + layout: { mode: "h", cells: { a: { name: "a", height: 1 / 3, fsize: { h: 1, v: 2 } }, b: { layout: { mode: "h", cells: { a: { name: "b", fsize: { h: 1, v: [2, 3] } }, b: { name: "c", fsize: { h: 1, v: 3 } } } } } } }, + }, + b: { layout: { mode: "v", cells: { a: { name: "d", fsize: { h: [1, 4] } }, b: { name: "e", fsize: { h: 4 } } } } }, + }, + }, + "5C": { + mode: "v", + cells: { + a: { width: 2 / 3, layout: { mode: "v", cells: { a: { name: "a", fsize: { h: 2 } }, b: { name: "b", fsize: { h: [2, 1] } } } } }, + b: { layout: { mode: "h", cells: { a: { name: "c", height: 1 / 3, fsize: { h: 1, v: 3 } }, b: { layout: { mode: "h", cells: { a: { name: "d", fsize: { h: 1, v: [3, 4] } }, b: { name: "e", fsize: { h: 1, v: 4 } } } } } } } }, + }, + }, + "6H": { + mode: "v", + cells: { + a: { width: 1 / 3, name: "a", fsize: { h: 1 } }, + b: { + layout: { + mode: "v", + cells: { + a: { + layout: { + mode: "h", + cells: { + a: { name: "b", height: 1 / 4, fsize: { h: [1, 2], v: 3 } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "c", height: 1 / 3, fsize: { h: [1, 2], v: [3, 4] } }, + b: { layout: { mode: "h", cells: { a: { name: "d", fsize: { h: [1, 2], v: [4, 5] } }, b: { name: "e", fsize: { h: [1, 2], v: 5 } } } } }, + }, + }, + }, + }, + }, + }, + b: { name: "f", fsize: { h: 2 } }, + }, + }, + }, + }, + }, + "6I": { + mode: "h", + cells: { + a: { height: 1 / 3, name: "a", fsize: { v: 1 } }, + b: { + layout: { + mode: "h", + cells: { + a: { + layout: { + mode: "v", + cells: { + a: { name: "b", width: 1 / 4, fsize: { h: 3, v: [1, 2] } }, + b: { + layout: { + mode: "v", + cells: { + a: { name: "c", width: 1 / 3, fsize: { h: [3, 4], v: [1, 2] } }, + b: { layout: { mode: "v", cells: { a: { name: "d", fsize: { h: [4, 5], v: [1, 2] } }, b: { name: "e", fsize: { h: 5, v: [1, 2] } } } } }, + }, + }, + }, + }, + }, + }, + b: { name: "f", fsize: { v: 2 } }, + }, + }, + }, + }, + }, + "6A": { + mode: "v", + cells: { + a: { + layout: { + mode: "h", + cells: { + a: { name: "a", height: 1 / 5, fsize: { h: 1, v: 2 } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "b", height: 1 / 4, fsize: { h: 1, v: [2, 3] } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "c", height: 1 / 3, fsize: { h: 1, v: [3, 4] } }, + b: { layout: { mode: "h", cells: { a: { name: "d", fsize: { h: 1, v: [4, 5] } }, b: { name: "e", fsize: { h: 1, v: 5 } } } } }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + b: { name: "f", fsize: { h: 1 } }, + }, + }, + "6C": { + mode: "v", + cells: { + a: { name: "a", fsize: { h: 1 } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "b", height: 1 / 5, fsize: { h: 1, v: 2 } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "c", height: 1 / 4, fsize: { h: 1, v: [2, 3] } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "d", height: 1 / 3, fsize: { h: 1, v: [3, 4] } }, + b: { layout: { mode: "h", cells: { a: { name: "e", fsize: { h: 1, v: [4, 5] } }, b: { name: "f", fsize: { h: 1, v: 5 } } } } }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "6J": { + mode: "v", + cells: { + a: { + width: 1 / 3, + layout: { + mode: "h", + cells: { + a: { name: "a", height: 1 / 4, fsize: { h: 1, v: 2 } }, + b: { + layout: { + mode: "h", + cells: { a: { name: "b", height: 1 / 3, fsize: { h: 1, v: [2, 3] } }, b: { layout: { mode: "h", cells: { a: { name: "c", fsize: { h: 1, v: [3, 4] } }, b: { name: "d", fsize: { h: 1, v: 4 } } } } } }, + }, + }, + }, + }, + }, + b: { layout: { mode: "v", cells: { a: { name: "e", fsize: { h: [1, 5] } }, b: { name: "f", fsize: { h: 5 } } } } }, + }, + }, + "6E": { + mode: "v", + cells: { + a: { name: "a", width: 1 / 3, fsize: { h: 1 } }, + b: { + layout: { + mode: "v", + cells: { + a: { name: "b", fsize: { h: [1, 2] } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "c", height: 1 / 4, fsize: { h: 2, v: 3 } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "d", height: 1 / 3, fsize: { h: 2, v: [3, 4] } }, + b: { layout: { mode: "h", cells: { a: { name: "e", fsize: { h: 2, v: [4, 5] } }, b: { name: "f", fsize: { h: 2, v: 5 } } } } }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "6W": { + mode: "v", + cells: { + a: { name: "a", width: 1 / 6, fsize: { h: 1 } }, + b: { + layout: { + mode: "v", + cells: { + a: { name: "b", width: 1 / 5, fsize: { h: [1, 2] } }, + b: { + layout: { + mode: "v", + cells: { + a: { name: "c", width: 1 / 4, fsize: { h: [2, 3] } }, + b: { + layout: { + mode: "v", + cells: { a: { name: "d", width: 1 / 3, fsize: { h: [3, 4] } }, b: { layout: { mode: "v", cells: { a: { name: "e", fsize: { h: [4, 5] } }, b: { name: "f", fsize: { h: 5 } } } } } }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + "7H": { + mode: "v", + cells: { + a: { name: "a", width: 1 / 3, fsize: { h: 1 } }, + b: { + layout: { + mode: "v", + cells: { + a: { + layout: { + mode: "h", + cells: { + a: { name: "b", height: 1 / 5, fsize: { h: [1, 2], v: 3 } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "c", height: 1 / 4, fsize: { h: [1, 2], v: [3, 4] } }, + b: { + layout: { + mode: "h", + cells: { + a: { name: "d", height: 1 / 3, fsize: { h: [1, 2], v: [4, 5] } }, + b: { layout: { mode: "h", cells: { a: { name: "e", fsize: { h: [1, 2], v: [5, 6] } }, b: { name: "f", fsize: { h: [1, 2], v: 6 } } } } }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + b: { name: "g", fsize: { h: 2 } }, + }, + }, + }, + }, + }, + "7I": { + mode: "h", + cells: { + a: { name: "a", height: 1 / 3, fsize: { v: 1 } }, + b: { + layout: { + mode: "h", + cells: { + a: { + layout: { + mode: "v", + cells: { + a: { name: "b", width: 1 / 5, fsize: { h: 3, v: [1, 2] } }, + b: { + layout: { + mode: "v", + cells: { + a: { name: "c", width: 1 / 4, fsize: { h: [3, 4], v: [1, 2] } }, + b: { + layout: { + mode: "v", + cells: { + a: { name: "d", width: 1 / 3, fsize: { h: [4, 5], v: [1, 2] } }, + b: { layout: { mode: "v", cells: { a: { name: "e", fsize: { h: [5, 6], v: [1, 2] } }, b: { name: "f", fsize: { h: 6, v: [1, 2] } } } } }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + b: { name: "g", fsize: { v: 2 } }, + }, + }, + }, + }, + }, +}; +dhtmlXLayoutObject.prototype._availAutoSize = { + "1C": { h: ["a"], v: ["a"] }, + "2E": { h: ["a;b"], v: ["a", "b"] }, + "2U": { h: ["a", "b"], v: ["a;b"] }, + "3E": { h: ["a;b;c"], v: ["a", "b", "c"] }, + "3W": { h: ["a", "b", "c"], v: ["a;b;c"] }, + "3J": { h: ["a;c", "b"], v: ["a;b", "b;c"] }, + "3L": { h: ["a", "b;c"], v: ["a;b", "a;c"] }, + "3T": { h: ["a;b", "a;c"], v: ["a", "b;c"] }, + "3U": { h: ["a;c", "b;c"], v: ["a;b", "c"] }, + "4H": { h: ["a", "b;c", "d"], v: ["a;b;d", "a;c;d"] }, + "4I": { h: ["a;b;d", "a;c;d"], v: ["a", "b;c", "d"] }, + "4T": { h: ["a;b", "a;c", "a;d"], v: ["a", "b;c;d"] }, + "4U": { h: ["a;d", "b;d", "c;d"], v: ["a;b;c", "d"] }, + "4E": { h: ["a;b;c;d"], v: ["a", "b", "c", "d"] }, + "4W": { h: ["a", "b", "c", "d"], v: ["a;b;c;d"] }, + "4A": { h: ["a;b", "c", "d"], v: ["a;c;d", "b;c;d"] }, + "4L": { h: ["a", "b", "c;d"], v: ["a;b;c", "a;b;d"] }, + "4J": { h: ["a;b;c", "a;b;d"], v: ["a", "b", "c;d"] }, + "4F": { h: ["a;c;d", "b;c;d"], v: ["a;b", "c", "d"] }, + "4G": { h: ["a;b;c", "d"], v: ["a;d", "b;d", "c;d"] }, + "4C": { h: ["a", "b;c;d"], v: ["a;b", "a;c", "a;d"] }, + "5H": { h: ["a", "b;c;d", "e"], v: ["a;b;e", "a;c;e", "a;d;e"] }, + "5I": { h: ["a;b;e", "a;c;e", "a;d;e"], v: ["a", "b;c;d", "e"] }, + "5U": { h: ["a;e", "b;e", "c;e", "d;e"], v: ["a;b;c;d", "e"] }, + "5E": { h: ["a;b;c;d;e"], v: ["a", "b", "c", "d", "e"] }, + "5W": { h: ["a", "b", "c", "d", "e"], v: ["a;b;c;d;e"] }, + "5K": { h: ["a;b;c", "d;e"], v: ["a;d", "b;d", "c;d", "a;e", "b;e", "c;e"] }, + "5S": { h: ["a;b", "c;d;e"], v: ["a;c", "a;d", "a;e", "b;c", "b;d", "b;e"] }, + "5G": { h: ["a;b;c", "d", "e"], v: ["a;d;e", "b;d;e", "c;d;e"] }, + "5C": { h: ["a", "b", "c;d;e"], v: ["a;b;c", "a;b;d", "a;b;e"] }, + "6H": { h: ["a", "b;c;d;e", "f"], v: ["a;b;f", "a;c;f", "a;d;f", "a;e;f"] }, + "6I": { h: ["a;b;f", "a;c;f", "a;d;f", "a;e;f"], v: ["a", "b;c;d;e", "f"] }, + "6A": { h: ["a;b;c;d;e", "f"], v: ["a;f", "b;f", "c;f", "d;f", "e;f"] }, + "6C": { h: ["a", "b;c;d;e;f"], v: ["a;b", "a;c", "a;d", "a;e", "a;f"] }, + "6J": { h: ["a;b;c;d", "e", "f"], v: ["a;e;f", "b;e;f", "c;e;f", "d;e;f"] }, + "6E": { h: ["a", "b", "c;d;e;f"], v: ["a;b;c", "a;b;d", "a;b;e", "a;b;f"] }, + "6W": { h: ["a", "b", "c", "d", "e", "f"], v: ["a;b;c;d;e;f"] }, + "7H": { h: ["a", "b;c;d;e;f", "g"], v: ["a;b;g", "a;c;g", "a;d;g", "a;e;g", "a;f;g"] }, + "7I": { h: ["a;b;g", "a;c;g", "a;d;g", "a;e;g", "a;f;g"], v: ["a", "b;c;d;e;f", "g"] }, +}; +function dhtmlXLayoutSepObject(e, a) { + var c = this; + this.conf = { mode: e, idx: a, blocked: false, locked: false, btn_left: (window.dhx4.isIE6 || window.dhx4.isIE7 || window.dhx4.isIE8) && typeof window.addEventListener == "undefined" ? 1 : 0 }; + if (window.dhx4.isIE && navigator.userAgent.indexOf("MSIE 7.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0) { + this.conf.btn_left = 1; + } + this.sep = document.createElement("DIV"); + this.sep.className = "dhxlayout_sep"; + if (window.dhx4.isIE == true) { + this.sep.onselectstart = function () { + return false; + }; + } + this.sep.className = "dhxlayout_sep dhxlayout_sep_resize_" + this.conf.mode; + this._setSize = function (g, m, j, l) { + this.sep.style.left = g + "px"; + this.sep.style.top = m + "px"; + this.sep.style.width = Math.max(j, 0) + "px"; + this.sep.style.height = Math.max(l, 0) + "px"; + }; + this._lockSep = function (g) { + this.conf.locked = g == true; + this._blockSep(); + }; + this._setWH = function (g) { + var h = this._getLayout(); + h.conf.sw = g == null ? h._detectSW() : Math.max(parseInt(g) || -1, -1); + h._getMainInst().setSizes(); + h = null; + }; + this._blockSep = function () { + var g = this._getLayout(); + var h = g.cdata.a.conf.collapsed || g.cdata.b.conf.collapsed || this.conf.locked; + g = null; + if (this.conf.blocked == h) { + return; + } + this.sep.className = "dhxlayout_sep" + (h ? "" : " dhxlayout_sep_resize_" + this.conf.mode); + this.conf.blocked = h; + }; + this._beforeResize = function (h) { + if (this.conf.blocked) { + return; + } + if (this.conf.resize != null && this.conf.resize.active == true) { + return; + } + if (h.type == window.dhx4.dnd.evs.start) { + this.sep.className += " dhxlayout_sep_resize_actv"; + var l = h.pageX || h.touches[0].pageX; + var j = h.pageY || h.touches[0].pageY; + } else { + if (h.button !== this.conf.btn_left) { + return; + } + var l = h.clientX; + var j = h.clientY; + } + if (window.dhx4.dnd.p_en == true) { + window.dhx4.dnd._touchOff(); + } + var g = this._getLayout(); + this.conf.resize = { + sx: l, + sy: j, + tx: h.layerX, + ty: h.layerY, + sep_x: parseInt(this.sep.style.left), + sep_y: parseInt(this.sep.style.top), + min_wa: g.cdata.a._getAvailWidth("a"), + min_wb: g.cdata.b._getAvailWidth("b"), + min_ha: g.cdata.a._getAvailHeight("a"), + min_hb: g.cdata.b._getAvailHeight("b"), + }; + this.conf.resize.nx = this.conf.resize.sep_x; + this.conf.resize.ny = this.conf.resize.sep_y; + if (typeof window.addEventListener == "function") { + window.addEventListener("mousemove", this._doOnMouseMove, false); + window.addEventListener("mouseup", this._doOnMouseUp, false); + window.addEventListener(window.dhx4.dnd.evs.move, this._doOnMouseMove, false); + window.addEventListener(window.dhx4.dnd.evs.end, this._doOnMouseUp, false); + } else { + document.body.attachEvent("onmousemove", this._doOnMouseMove); + document.body.attachEvent("onmouseup", this._doOnMouseUp); + } + g = null; + }; + this._onResize = function (j) { + if (!this.conf.resize.active) { + this._initResizeArea(); + this.conf.resize.active = true; + } + if (this.conf.mode == "v") { + var g = j.type == "mousemove" ? j.clientX : j.pageX || j.touches[0].pageX; + var h = this.conf.resize.sx - g; + this.conf.resize.nx = this.conf.resize.sep_x - h; + if (this.conf.resize.nx > this.conf.resize.sep_x + this.conf.resize.min_wb) { + this.conf.resize.nx = this.conf.resize.sep_x + this.conf.resize.min_wb; + } else { + if (this.conf.resize.nx < this.conf.resize.sep_x - this.conf.resize.min_wa) { + this.conf.resize.nx = this.conf.resize.sep_x - this.conf.resize.min_wa; + } + } + this.r_sep.style.left = this.conf.resize.nx + "px"; + } else { + var l = j.type == "mousemove" ? j.clientY : j.pageY || j.touches[0].pageY; + var h = this.conf.resize.sy - l; + this.conf.resize.ny = this.conf.resize.sep_y - h; + if (this.conf.resize.ny > this.conf.resize.sep_y + this.conf.resize.min_hb) { + this.conf.resize.ny = this.conf.resize.sep_y + this.conf.resize.min_hb; + } else { + if (this.conf.resize.ny < this.conf.resize.sep_y - this.conf.resize.min_ha) { + this.conf.resize.ny = this.conf.resize.sep_y - this.conf.resize.min_ha; + } + } + this.r_sep.style.top = this.conf.resize.ny + "px"; + } + }; + this._afterResize = function (o) { + if (typeof window.addEventListener == "function") { + window.removeEventListener("mousemove", this._doOnMouseMove, false); + window.removeEventListener("mouseup", this._doOnMouseUp, false); + window.removeEventListener(window.dhx4.dnd.evs.move, this._doOnMouseMove, false); + window.removeEventListener(window.dhx4.dnd.evs.end, this._doOnMouseUp, false); + } else { + document.body.detachEvent("onmousemove", this._doOnMouseMove); + document.body.detachEvent("onmouseup", this._doOnMouseUp); + } + if (!this.conf.resize.active) { + this.conf.resize = null; + return; + } + if (o.type == window.dhx4.dnd.evs.end) { + this.sep.className = this.sep.className.replace(/\s{0,}dhxlayout_sep_resize_actv/gi, ""); + } else { + if (o.button !== this.conf.btn_left) { + return; + } + } + var l = this._getLayout(); + var h = l._getMainInst(); + var m = h.checkEvent("onPanelResizeFinish") == true ? {} : false; + if (m !== false) { + h.forEachItem(function (s) { + m[s.conf.name] = { w: s.conf.size.w, h: s.conf.size.h }; + s = null; + }); + } + var j = this.conf.resize.nx - this.conf.resize.sep_x; + var g = this.conf.resize.ny - this.conf.resize.sep_y; + l.cdata.a._setSize(l.cdata.a.conf.size.x, l.cdata.a.conf.size.y, l.cdata.a.conf.size.w + j, l.cdata.a.conf.size.h + g, "a"); + l.cdata.b._setSize(l.cdata.b.conf.size.x + j, l.cdata.b.conf.size.y + g, l.cdata.b.conf.size.w - j, l.cdata.b.conf.size.h - g, "b"); + this._setSize(parseInt(this.r_sep.style.left), parseInt(this.r_sep.style.top), parseInt(this.r_sep.style.width), parseInt(this.r_sep.style.height)); + if (window.dhx4.isIE) { + var r = this; + window.setTimeout(function () { + r._removeResizeArea(); + r = null; + }, 1); + } else { + this._removeResizeArea(); + } + if (m !== false) { + var n = []; + h.forEachItem(function (s) { + var u = m[s.conf.name]; + if (!(u.w == s.conf.size.w && u.h == s.conf.size.h)) { + n.push(s.conf.name); + } + s = null; + }); + h._callMainEvent("onPanelResizeFinish", [n]); + } + h = l = null; + this.conf.resize.active = false; + this.conf.resize = null; + if (window.dhx4.dnd.p_en == true) { + window.dhx4.dnd._touchOn(); + } + }; + this._initResizeArea = function () { + if (this.r_sep == null) { + this.r_sep = document.createElement("DIV"); + this.r_sep.className = "dhxlayout_resize_sep"; + this.r_sep.style.left = this.sep.style.left; + this.r_sep.style.top = this.sep.style.top; + this.r_sep.style.width = this.sep.style.width; + this.r_sep.style.height = this.sep.style.height; + this.sep.parentNode.appendChild(this.r_sep); + if (window.dhx4.isIE) { + this.r_sep.onselectstart = function () { + return false; + }; + } + } + if (this.r_area == null) { + this.r_area = document.createElement("DIV"); + this.r_area.className = "dhxlayout_resize_area"; + this.sep.parentNode.appendChild(this.r_area); + if (window.dhx4.isIE) { + this.r_area.onselectstart = function () { + return false; + }; + } + if (this.conf.mode == "v") { + var g = parseInt(this.r_sep.style.left) - this.conf.resize.min_wa; + var m = parseInt(this.r_sep.style.top); + var j = this.conf.resize.min_wa + this.conf.resize.min_wb + parseInt(this.r_sep.style.width); + var l = parseInt(this.r_sep.style.height); + } else { + var g = parseInt(this.r_sep.style.left); + var m = parseInt(this.r_sep.style.top) - this.conf.resize.min_ha; + var j = parseInt(this.r_sep.style.width); + var l = this.conf.resize.min_ha + this.conf.resize.min_hb + parseInt(this.r_sep.style.height); + } + this.r_area.style.left = g + "px"; + this.r_area.style.top = m + "px"; + if (!dhtmlXLayoutObject.prototype._confGlob.reszieCover) { + dhtmlXLayoutObject.prototype._confGlob.reszieCover = {}; + this.r_area.style.width = j + "px"; + this.r_area.style.height = l + "px"; + dhtmlXLayoutObject.prototype._confGlob.reszieCover.w = parseInt(this.r_area.style.width) - this.r_area.offsetWidth; + dhtmlXLayoutObject.prototype._confGlob.reszieCover.h = parseInt(this.r_area.style.height) - this.r_area.offsetHeight; + } + this.r_area.style.width = j + dhtmlXLayoutObject.prototype._confGlob.reszieCover.w + "px"; + this.r_area.style.height = l + dhtmlXLayoutObject.prototype._confGlob.reszieCover.h + "px"; + } + document.body.className += " dhxlayout_resize_" + this.conf.mode; + }; + this._removeResizeArea = function () { + this.r_sep.onselectstart = null; + this.r_sep.parentNode.removeChild(this.r_sep); + this.r_sep = null; + this.r_area.onselectstart = null; + this.r_area.parentNode.removeChild(this.r_area); + this.r_area = null; + document.body.className = String(document.body.className).replace(/\s{0,}dhxlayout_resize_[vh]/gi, ""); + }; + this._doOnMouseDown = function (g) { + g = g || event; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.cancelBubble = true; + } + c._beforeResize(g); + }; + this._doOnBodyMouseDown = function (g) { + g = g || event; + if (c.conf.resize == null) { + return; + } + if (c.conf.resize.active == true && g.button !== c.conf.btn_left) { + if (g.preventDefault) { + g.preventDefault(); + } + g.returnValue = false; + g.cancelBubble = true; + return false; + } + }; + this._doOnMouseMove = function (g) { + g = g || event; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.cancelBubble = true; + } + c._onResize(g); + }; + this._doOnMouseUp = function (g) { + g = g || event; + if (g.type == "mouseup" && g.button !== c.conf.btn_left) { + return; + } + c._afterResize(g); + }; + if (typeof window.addEventListener == "function") { + this.sep.addEventListener("mousedown", this._doOnMouseDown, false); + this.sep.addEventListener(window.dhx4.dnd.evs.start, this._doOnMouseDown, false); + document.body.addEventListener("mousedown", this._doOnBodyMouseDown, false); + document.body.addEventListener("contextmenu", this._doOnBodyMouseDown, false); + } else { + this.sep.attachEvent("onmousedown", this._doOnMouseDown); + document.body.attachEvent("onmousedown", this._doOnBodyMouseDown); + document.body.attachEvent("oncontextmenu", this._doOnBodyMouseDown); + } + this._unload = function () { + if (typeof window.addEventListener == "function") { + this.sep.removeEventListener("mousedown", this._doOnMouseDown, false); + this.sep.removeEventListener(window.dhx4.dnd.evs.start, this._doOnMouseDown, false); + document.body.removeEventListener("mousedown", this._doOnBodyMouseDown, false); + document.body.removeEventListener("contextmenu", this._doOnBodyMouseDown, false); + } else { + this.sep.detachEvent("onmousedown", this._doOnMouseDown); + document.body.detachEvent("onmousedown", this._doOnBodyMouseDown); + document.body.detachEvent("oncontextmenu", this._doOnBodyMouseDown); + } + if (window.dhx4.isIE == true) { + this.sep.onselectstart = null; + } + this.sep.parentNode.removeChild(this.sep); + this.sep = null; + for (var g in this) { + this[g] = null; + } + c = null; + }; + return this; +} +dhtmlXLayoutObject.prototype.setSeparatorSize = function (e, g) { + if (typeof e == "number") { + var h = this.setSeparatorSize({ index: e, current: -1 }, g); + if (h.sep != null) { + h.sep._setWH(g); + } + return; + } + for (var c in this.cdata) { + if (this.cdata[c].dataType == "layout" && this.cdata[c].dataNested == true && this.cdata[c].dataObj != null) { + e = this.cdata[c].dataObj.setSeparatorSize(e, g); + if (e.sep != null) { + return e; + } + } + if (c == "a" && this.sep != null) { + e.current++; + if (e.index == e.current) { + return { sep: this.sep }; + } + } + } + return e; +}; +window.dhtmlXLayoutCell = function (g, e) { + dhtmlXCellObject.apply(this, [g, "_layout"]); + var c = this; + this.layout = e; + this.conf.skin = this.layout.conf.skin; + this.conf.mode = this.layout.conf.mode; + this.conf.collapsed = false; + this.conf.fixed = { w: false, h: false }; + this.conf.docked = true; + this.conf.min_width = 26; + this.conf.min_height = 26; + this.attachEvent("_onCellUnload", function () { + this.cell.childNodes[this.conf.idx.hdr].ondblclick = null; + if (this.conf.mode != "c") { + this.cell.childNodes[this.conf.idx.hdr].lastChild.ondblclick = null; + } + this._unloadDocking(); + this.layout = null; + c = null; + }); + this._hdrInit(); + this.cell.childNodes[this.conf.idx.hdr].ondblclick = function () { + var h = c.layout._getMainInst(); + h._callMainEvent("onDblClick", [c.conf.name]); + h = null; + }; + this.attachEvent("_onContentLoaded", function () { + var h = this.layout._getMainInst(); + h._callMainEvent("onContentLoaded", [this.conf.name]); + h = null; + }); + if (this.conf.mode != "c") { + var a = document.createElement("DIV"); + a.className = "dhxlayout_arrow dhxlayout_arrow_" + this.conf.mode + this._idd; + this.cell.childNodes[this.conf.idx.hdr].appendChild(a); + a.onclick = function (h) { + if (c.conf.collapsed) { + c.expand(); + } else { + c.collapse(); + } + }; + a = null; + } + this.attachEvent("_onBeforeContentAttach", function (h) { + if (h == "tabbar" || h == "layout" || h == "acc") { + this._hideBorders(); + } + if (h == "sidebar" && this.conf.skin != "dhx_skyblue") { + this._hideBorders(); + this.showHeader(); + } + }); + this._initDocking(); + return this; +}; +dhtmlXLayoutCell.prototype = new dhtmlXCellObject(); +dhtmlXLayoutCell.prototype.getId = function () { + return this.conf.name; +}; +dhtmlXLayoutCell.prototype._initDocking = function () { + var a = this; + this.dock = function () { + var e = this.layout._getMainInst(); + if (e.dhxWins == null || this.conf.docked) { + e = null; + return; + } + var c = e.dhxWins.window(this.conf.name); + c.close(); + this._attachFromCell(c); + this.conf.docked = true; + if (!this.conf.dock_collapsed) { + this.expand(); + } + e._callMainEvent("onDock", [this.conf.name]); + e = c = null; + }; + this.undock = function (c, m, j, l) { + var g = this.layout._getMainInst(); + if (g.dhxWins == null || this.conf.docked == false) { + g = null; + return; + } + this.conf.dock_collapsed = this.conf.collapsed; + if (!this.conf.collapsed) { + this.collapse(); + } + if (g.dhxWins.window(this.conf.name) != null) { + var e = g.dhxWins.window(this.conf.name); + e.show(); + } else { + if (c == null) { + c = 20; + } + if (m == null) { + m = 20; + } + if (j == null) { + j = 320; + } + if (l == null) { + l = 200; + } + var e = g.dhxWins.createWindow(this.conf.name, c, m, j, l); + e.button("close").hide(); + e.addUserButton("dock", 99, "Dock"); + e.button("dock").show(); + e.button("dock").attachEvent("onClick", this._doOnDockClick); + e.setText(this.getText()); + e.attachEvent("onClose", this._doOnDockWinClose); + } + this.conf.docked = false; + e._attachFromCell(this); + g._callMainEvent("onUnDock", [this.conf.name]); + g = e = null; + }; + this._doOnDockClick = function () { + a.dock(); + }; + this._doOnDockWinClose = function (c) { + c.hide(); + return false; + }; + this._unloadDocking = function () { + a = null; + }; +}; +dhtmlXLayoutCell.prototype._hdrInit = function () { + var c = ""; + if (window.dhx4.isIE) { + if (navigator.userAgent.indexOf("MSIE 9.0") != -1) { + c = " dhx_cell_hdr_text_ie9"; + } else { + if (window.dhx4.isIE8) { + c = " dhx_cell_hdr_text_ie8"; + } else { + if (window.dhx4.isIE7) { + c = " dhx_cell_hdr_text_ie7"; + } else { + if (window.dhx4.isIE6) { + c = " dhx_cell_hdr_text_ie6"; + } + } + } + } + } else { + if (window.dhx4.isChrome || window.dhx4.isKHTML) { + c = " dhx_cell_hdr_text_chrome"; + } + } + var a = document.createElement("DIV"); + a.className = "dhx_cell_hdr"; + a.innerHTML = "
"; + this.cell.insertBefore(a, this.cell.childNodes[this.conf.idx.cont]); + a = null; + this.conf.ofs_nodes.t._getHdrHeight = "func"; + this.conf.hdr = { visible: true }; + this.conf.idx_data.hdr = "dhx_cell_hdr"; + this._updateIdx(); + this.attachEvent("_onSetSize", this._hdrOnSetSize); + this.attachEvent("_onBorderChange", this._hdrOnBorderChange); + this.attachEvent("_onViewSave", this._hdrOnViewSave); + this.attachEvent("_onViewRestore", this._hdrOnViewRestore); +}; +dhtmlXLayoutCell.prototype.showHeader = function (a) { + if (this.conf.hdr.visible || this.conf.collapsed) { + return; + } + if (this.conf.hdr.w_saved > this._getAvailWidth() || this.conf.hdr.h_saved > this._getAvailHeight()) { + return; + } + this.conf.hdr.w_saved = this.conf.hdr.h_saved = null; + this.conf.hdr.visible = true; + this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_hdr"; + if (a !== true) { + this._adjustCont(this._idd); + } +}; +dhtmlXLayoutCell.prototype.hideHeader = function (a) { + if (!this.conf.hdr.visible || this.conf.collapsed) { + return; + } + this.conf.hdr.w_saved = this._getMinWidth(this._idd); + this.conf.hdr.h_saved = this._getMinHeight(this._idd); + this.conf.hdr.visible = false; + this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_hdr dhx_cell_hdr_hidden"; + this._hdrUpdBorder(); + this._mtbUpdBorder(); + if (a !== true) { + this._adjustCont(this._idd); + } +}; +dhtmlXLayoutCell.prototype.isHeaderVisible = function () { + return this.conf.hdr.visible == true; +}; +dhtmlXLayoutCell.prototype.showArrow = function () { + this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display = ""; +}; +dhtmlXLayoutCell.prototype.hideArrow = function () { + this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display = "none"; +}; +dhtmlXLayoutCell.prototype.isArrowVisible = function () { + return this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display == ""; +}; +dhtmlXLayoutCell.prototype.setText = function (a) { + this.conf.hdr.text = a; + this._hdrUpdText(); +}; +dhtmlXLayoutCell.prototype.getText = function () { + return this.conf.hdr.text; +}; +dhtmlXLayoutCell.prototype.setCollapsedText = function (a) { + this.conf.hdr.text_collapsed = a; + this._hdrUpdText(); +}; +dhtmlXLayoutCell.prototype.getCollapsedText = function () { + return this.conf.hdr.text_collapsed != null ? this.conf.hdr.text_collapsed : this.conf.hdr.text; +}; +dhtmlXLayoutCell.prototype._hdrUpdText = function () { + var a = this.conf.collapsed == true && this.conf.hdr.text_collapsed != null ? this.conf.hdr.text_collapsed : this.conf.hdr.text; + this.cell.childNodes[this.conf.idx.hdr].firstChild.innerHTML = "" + a + ""; +}; +dhtmlXLayoutCell.prototype._hdrUpdBorder = function () { + if (this.conf.borders == true) { + this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_hdr" + (this.conf.hdr.visible ? "" : " dhx_cell_hdr_hidden"); + } else { + if (!this.conf.hdr.visible) { + this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_hdr dhx_cell_hdr_hidden_no_borders"; + } + } +}; +dhtmlXLayoutCell.prototype._hdrOnSetSize = function () { + if (this.conf.collapsed && this.conf.mode == "v") { + this._fitHdr(); + } +}; +dhtmlXLayoutCell.prototype._hdrOnBorderChange = function () { + this.hideHeader(true); + this._hdrUpdBorder(); +}; +dhtmlXLayoutCell.prototype._hdrOnViewSave = function (a) { + this.views[a].hdr_vis = this.conf.hdr.visible; +}; +dhtmlXLayoutCell.prototype._hdrOnViewRestore = function (a) { + if (this.conf.hdr.visible != this.views[a].hdr_vis) { + this[this.views[a].hdr_vis ? "showHeader" : "hideHeader"](true); + } + this.views[a].hdr_vis = null; + delete this.views[a].hdr_vis; +}; +dhtmlXLayoutCell.prototype._getHdrHeight = function (a) { + if (this.conf.collapsed && this.conf.mode == "v" && a !== true) { + return 27; + } + return this.cell.childNodes[this.conf.idx.hdr].offsetHeight; +}; +dhtmlXLayoutCell.prototype._fitHdr = function () { + if (this.conf.collapsed) { + if (typeof dhtmlXLayoutObject.prototype._confGlob.hdrColH == "undefined") { + this.cell.childNodes[this.conf.idx.hdr].style.height = this.cell.offsetHeight + "px"; + dhtmlXLayoutObject.prototype._confGlob.hdrColH = parseInt(this.cell.childNodes[this.conf.idx.hdr].style.height) - this._getHdrHeight(true); + } + this.cell.childNodes[this.conf.idx.hdr].style.height = this.cell.offsetHeight + dhtmlXLayoutObject.prototype._confGlob.hdrColH + "px"; + } else { + this.cell.childNodes[this.conf.idx.hdr].style.height = null; + } +}; +dhtmlXLayoutCell.prototype.expand = function (l) { + if (!this.conf.collapsed) { + return true; + } + var e = this.layout; + if (this.conf.mode == "v") { + var j = l ? e.conf.hh : e.cdata[e.conf.nextCell[this._idd]]._getMinWidth(this._idd); + var g = e.cont.offsetWidth - e.conf.sw; + if (j + this.conf.size.w_avl > g) { + e = null; + return false; + } + } else { + var h = l ? e.conf.hh : e.cdata[e.conf.nextCell[this._idd]]._getMinHeight(this._idd) + e.cdata[e.conf.nextCell[this._idd]]._getHdrHeight(); + var c = e.cont.offsetHeight - e.conf.sw; + if (h + this.conf.size.h_avl > c) { + e = null; + return false; + } + } + if (this.conf.docked == false) { + this.dock(); + return; + } + this.cell.className = String(this.cell.className).replace(/\s{0,}dhxlayout_collapsed_[hv]/gi, ""); + this.conf.collapsed = false; + if (this.conf.mode == "v") { + this.conf.size.w = Math.min(g - j, this.conf.size.w_saved); + this.conf.size.w_saved = this.conf.size.w_avl = null; + } else { + this.conf.size.h = Math.min(c - h, this.conf.size.h_saved); + this.conf.size.h_saved = this.conf.size.h_avl = null; + } + if (this.conf.mode == "v") { + this._fitHdr(); + } + e.setSizes(e.conf.nextCell[this._idd], e.conf.nextCell[this._idd], l == true, "expand"); + e.sep._blockSep(); + e = null; + this._hdrUpdText(); + var a = this.layout._getMainInst(); + a._callMainEvent("onExpand", [this.conf.name]); + a = null; + return true; +}; +dhtmlXLayoutCell.prototype.collapse = function () { + if (this.conf.collapsed) { + return false; + } + var c = this.layout; + if (c.cdata[c.conf.nextCell[this._idd]].expand(true) == false) { + return false; + } + if (this.conf.mode == "v") { + this.conf.size.w_saved = this.conf.size.w; + this.conf.size.w_avl = this._getMinWidth(this._idd); + } else { + this.conf.size.h_saved = this.conf.size.h; + this.conf.size.h_avl = this._getMinHeight(this._idd) + this._getHdrHeight(); + } + this.cell.className += " dhxlayout_collapsed_" + this.conf.mode; + this.conf.collapsed = true; + if (this.conf.mode == "v") { + this.conf.size.w = c.conf.hh; + } else { + this.conf.size.h = this._getHdrHeight(); + } + c.setSizes(c.conf.nextCell[this._idd], c.conf.nextCell[this._idd], false, "collapse"); + c.sep._blockSep(); + c = null; + this._hdrUpdText(); + var a = this.layout._getMainInst(); + a._callMainEvent("onCollapse", [this.conf.name]); + a = null; + return true; +}; +dhtmlXLayoutCell.prototype.isCollapsed = function () { + return this.conf.collapsed == true; +}; +dhtmlXLayoutCell.prototype.setMinWidth = function (a) { + this.conf.min_width = parseInt(a) || 0; +}; +dhtmlXLayoutCell.prototype.setMinHeight = function (a) { + this.conf.min_height = parseInt(a) || 0; +}; +dhtmlXLayoutCell.prototype._getMinWidth = function (c) { + if (this.dataType == "layout" && this.dataObj != null) { + if (this.layout._getMainInst() != this.dataObj._getMainInst()) { + return this.dataObj._getAvailWidth(); + } + if (this.dataObj.conf.pattern == "1C") { + return Math.max(this.conf.min_width, this.dataObj.cdata.a._getMinWidth(c)); + } else { + if (this.dataObj.conf.mode == "v") { + var a = c || this._idd; + if (this.dataObj.cdata[a].conf.collapsed) { + a = this.dataObj.conf.nextCell[a]; + } + return Math.max(this.conf.min_width, this.dataObj.cdata[a]._getMinWidth(c) + this.dataObj.cdata[this.dataObj.conf.nextCell[a]]._getWidth() + this.dataObj.conf.sw); + } else { + return Math.max(this.conf.min_width, this.dataObj.cdata.a._getMinWidth(c), this.dataObj.cdata.b._getMinWidth(c)); + } + } + } + return Math.max(this.conf.min_width, 1); +}; +dhtmlXLayoutCell.prototype._getMinHeight = function (e) { + var c = 0; + if (this.conf.idx.menu != null) { + c += this.cell.childNodes[this.conf.idx.menu].offsetHeight; + } + if (this.dataType == "layout" && this.dataObj != null) { + if (this.layout._getMainInst() != this.dataObj._getMainInst()) { + return this.dataObj._getAvailHeight(); + } + if (this.dataObj.conf.pattern == "1C") { + return Math.max(this.conf.min_height, this.dataObj.cdata.a._getMinHeight(e)); + } else { + if (this.dataObj.conf.mode == "h") { + var a = e; + if (this.dataObj.cdata[a].conf.collapsed) { + a = this.dataObj.conf.nextCell[a]; + } + return Math.max(this.conf.min_height, this.dataObj.cdata[a]._getMinHeight(e) + this.dataObj.cdata[a]._getHdrHeight() + this.dataObj.cdata[this.dataObj.conf.nextCell[a]]._getHeight() + this.dataObj.conf.sw); + } else { + return Math.max(this.conf.min_height, this.dataObj.cdata.a._getMinHeight(e) + this.dataObj.cdata.a._getHdrHeight(), this.dataObj.cdata.b._getMinHeight(e) + this.dataObj.cdata.b._getHdrHeight()); + } + } + } + return Math.max(this.conf.min_height, c); +}; +dhtmlXLayoutCell.prototype._getAvailWidth = function (e) { + if (this.dataType == "layout" && this.dataObj != null) { + if (this.dataObj.conf.pattern == "1C") { + return this.dataObj.cdata.a._getAvailWidth(e); + } else { + if (this.dataObj.conf.mode == "v") { + var a = this.dataObj.cdata.a.conf.collapsed == true; + var c = this.dataObj.cdata.b.conf.collapsed == true; + if (e == "a") { + return this.dataObj.cdata[c ? "a" : "b"]._getAvailWidth(e); + } else { + return this.dataObj.cdata[a ? "b" : "a"]._getAvailWidth(e); + } + } else { + return Math.min(this.dataObj.cdata.a._getAvailWidth(e), this.dataObj.cdata.b._getAvailWidth(e)); + } + } + } + return this.cell.offsetWidth - this._getMinWidth(); +}; +dhtmlXLayoutCell.prototype._getAvailHeight = function (g) { + if (this.dataType == "layout" && this.dataObj != null) { + if (this.dataObj.conf.pattern == "1C") { + return this.dataObj.cdata.a._getAvailHeight(g); + } else { + if (this.dataObj.conf.mode == "h") { + var c = this.dataObj.cdata.a.conf.collapsed == true; + var e = this.dataObj.cdata.b.conf.collapsed == true; + if (g == "a") { + return this.dataObj.cdata[e ? "a" : "b"]._getAvailHeight(g); + } else { + return this.dataObj.cdata[c ? "b" : "a"]._getAvailHeight(g); + } + } else { + return Math.min(this.dataObj.cdata.a._getAvailHeight(g), this.dataObj.cdata.b._getAvailHeight(g)); + } + } + } + var a = this._getHdrHeight(); + if (this.conf.mode == "v" && this.conf.collapsed) { + a = this.conf.hh; + } + return this.cell.offsetHeight - a - this._getMinHeight(); +}; +dhtmlXLayoutCell.prototype.setWidth = function (g) { + if (this.conf.mode == "v") { + if (this.conf.collapsed) { + return; + } + var h = this.layout; + var j = h.cdata[h.conf.nextCell[this._idd]]; + if (j.conf.collapsed) { + g = g + h.conf.sw + j._getWidth(); + l = h = j = null; + return; + } + var e = this._getMinWidth(this._idd); + var m = h.cont.offsetWidth - j._getMinWidth(this._idd) - h.conf.sw; + g = Math.max(e, Math.min(g, m)); + this.conf.size.w = g; + h.setSizes(j._idd, j._idd); + h = j = null; + } else { + if (this.layout == null || this.layout.parentLayout == null) { + return; + } + var l = this.layout.parentLayout; + var h = this.layout; + var j = h.cdata[h.conf.nextCell[this._idd]]; + for (var c in l.cdata) { + if (l.cdata[c].dataObj == h) { + l.cdata[c].setWidth(g); + } + } + l = h = null; + } +}; +dhtmlXLayoutCell.prototype.setHeight = function (m) { + if (this.conf.mode == "h") { + if (this.conf.collapsed) { + return; + } + var g = this.layout; + var l = g.cdata[g.conf.nextCell[this._idd]]; + if (l.conf.collapsed) { + m = m + g.conf.sw + l._getHeight(); + var n = this.layout != null && this.layout.parentLayout != null ? this.layout.parentLayout : null; + if (n != null) { + for (var c in n.cdata) { + if (n.cdata[c].dataObj == g) { + n.cdata[c].setHeight(m); + } + } + } + n = g = l = null; + return; + } + var j = this._getMinHeight(this._idd) + this._getHdrHeight(); + var e = g.cont.offsetHeight - l._getMinHeight(this._idd) - l._getHdrHeight() - g.conf.sw; + m = Math.max(j, Math.min(m, e)); + this.conf.size.h = m; + g.setSizes(l._idd, l._idd); + g = l = null; + } else { + if (this.layout == null || this.layout.parentLayout == null) { + return; + } + var n = this.layout.parentLayout; + var g = this.layout; + var l = g.cdata[g.conf.nextCell[this._idd]]; + for (var c in n.cdata) { + if (n.cdata[c].dataObj == g) { + n.cdata[c].setHeight(m); + } + } + n = g = null; + } +}; +dhtmlXLayoutCell.prototype.getWidth = function () { + return this.conf.size.w; +}; +dhtmlXLayoutCell.prototype.getHeight = function () { + return this.conf.size.h; +}; +dhtmlXLayoutCell.prototype.fixSize = function (c, g) { + this.conf.fixed.w = window.dhx4.s2b(c); + this.conf.fixed.h = window.dhx4.s2b(g); + var a = this.layout._getMainInst(); + var e = {}; + a.forEachItem(function (h) { + if (h.conf.fsize != null) { + var n = h.getId(); + var m = { h: h.conf.fixed.w == true, v: h.conf.fixed.h == true }; + for (var j in m) { + if (m[j] == true && h.conf.fsize[j] != null) { + if (!(h.conf.fsize[j] instanceof Array)) { + h.conf.fsize[j] = [h.conf.fsize[j]]; + } + for (var l = 0; l < h.conf.fsize[j].length; l++) { + e[h.conf.fsize[j][l]] = true; + } + } + } + } + h = null; + }); + a._forEachSep(function (h) { + h._lockSep(e[h.conf.idx] == true); + h = null; + }); + a = null; +}; +dhtmlXCellObject.prototype.attachLayout = function (a) { + this.callEvent("_onBeforeContentAttach", ["layout"]); + var c = document.createElement("DIV"); + c.style.width = "100%"; + c.style.height = "100%"; + c.style.position = "relative"; + c.style.overflow = "hidden"; + this._attachObject(c); + if (typeof this._layoutMainInst != "undefined") { + c._layoutMainInst = this._layoutMainInst; + } + if (typeof window.dhtmlXLayoutCell != "undefined" && this instanceof dhtmlXLayoutCell) { + c._isParentCell = true; + } + if (typeof window.dhtmlXAccordionCell != "undefined" && this instanceof window.dhtmlXAccordionCell) { + c._ofs = { t: -1, r: -1, l: -1, b: -1 }; + } + if (typeof window.dhtmlXTabBarCell != "undefined" && this instanceof window.dhtmlXTabBarCell) { + if (this.conf.skin == "dhx_skyblue") { + c._ofs = { t: -1, r: -1, b: -1, l: -1 }; + } + } + if (typeof window.dhtmlXSideBarCell != "undefined" && this instanceof window.dhtmlXSideBarCell) { + if (this.conf.skin == "dhx_web") { + c._ofs = { l: 8 }; + if (this.sidebar.conf.autohide == true) { + c._ofs.l = 0; + } + if (this.sidebar.conf.header == true) { + c._ofs.t = 9; + } + } else { + if (this.conf.skin == "dhx_terrace") { + c._ofs = { l: 11 }; + if (this.sidebar.conf.autohide == true) { + c._ofs.l = 0; + } + if (this.sidebar.conf.header == true) { + c._ofs.t = 10; + } + } else { + c._ofs = { l: -1 }; + } + } + } + if (typeof window.dhtmlXCarouselCell != "undefined" && this instanceof window.dhtmlXCarouselCell) { + this._hideBorders(); + } + if (typeof a == "string") { + a = { pattern: a }; + } + if (typeof a.skin == "undefined") { + a.skin = this.conf.skin; + } + a.parent = c; + this.dataType = "layout"; + this.dataObj = new dhtmlXLayoutObject(a); + if (this instanceof dhtmlXLayoutCell) { + this.dataObj.parentLayout = this.layout; + } + c._layoutMainInst = null; + a.parent = null; + c = a = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; +}; +function dhtmlXTabBar(g, l) { + var h = this; + this.conf = { + skin: window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxtabbar") || "dhx_skyblue", + css: "dhxtabbar", + lastActive: null, + closeButton: false, + align: "left", + tabsMode: l == "bottom" ? "bottom" : "top", + tabsContCss: "", + contZone: true, + transSpeed: "0.15s", + arwMode: "always", + tabsOfs: 1, + tabsTop: 0, + url_demand: false, + urls: {}, + autoload: {}, + tabsWidth: { dhx_terrace: [44, 14], dhx_web: [35, 9], dhx_skyblue: [35, 9] }, + }; + var c = navigator.userAgent; + if (c.indexOf("Safari") >= 0 && (c.indexOf("5.1.7") >= 0 || (c.match(/7[\.\d]* mobile/gi) != null && c.match(/AppleWebKit/gi) != null))) { + this.conf.tabsContCss = " safari_517_fix"; + } + var j; + if (g != null && typeof g == "object" && typeof g.tagName == "undefined") { + j = g.parent; + if (typeof g.skin != "undefined") { + this.conf.skin = g.skin; + } + if (typeof g.mode != "undefined") { + this.conf.tabsMode = g.mode == "bottom" ? "bottom" : "top"; + } + if (typeof g.align != "undefined") { + this.conf.align = g.align == "right" ? "right" : "left"; + } + if (typeof g.close_button != "undefined") { + this.conf.closeButton = window.dhx4.s2b(g.close_button); + } + if (typeof g.content_zone != "undefined") { + this.conf.contZone = window.dhx4.s2b(g.content_zone); + } + if (typeof g.xml != "undefined") { + this.conf.autoload.xml = g.xml; + } + if (typeof g.json != "undefined") { + this.conf.autoload.xml = g.json; + } + if (typeof g.tabs != "undefined") { + this.conf.autoload.tabs = g.tabs; + } + if (typeof g.onload != "undefined") { + this.conf.autoload.tabs = g.tabs; + } + if (typeof g.arrows_mode != "undefined") { + this.conf.autoload.arrows_mode = g.arrows_mode; + } + } else { + j = g; + } + window.dhtmlXCellTop.apply(this, [j, g.offsets]); + if (this.base._ofs != null && this.base._ofs.t != null) { + this.conf.tabsTop = this.base._ofs.t; + } + this.tabsMode = document.createElement("DIV"); + this.tabsMode.className = "dhxtabbar_tabs_" + this.conf.tabsMode; + this.cont.appendChild(this.tabsMode); + this.tabsArea = document.createElement("DIV"); + this.tabsArea.className = "dhxtabbar_tabs dhxtabbar_tabs_" + this.conf.tabsMode; + this.tabsArea.innerHTML = + "
"; + this.tabsArea.style.top = this.conf.tabsMode == "top" ? this.conf.tabsTop + "px" : "auto"; + this.tabsMode.appendChild(this.tabsArea); + this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align] = "0px"; + this.tabsArea.childNodes[0].onclick = function () { + if (h.conf.align == "left") { + h._moveTabs(1); + } else { + h._moveTabs(-1); + } + }; + this.tabsArea.childNodes[2].onclick = function () { + if (h.conf.align == "left") { + h._moveTabs(-1); + } else { + h._moveTabs(1); + } + }; + this._onTabsAreaClick = function (a) { + return this._callMainEvent("onTabClose", [a]); + }; + this.tabsArea.onclick = function (m) { + m = m || event; + var a = m.target || m.srcElement; + while (a != null) { + if (typeof a._tabCloseId != "undefined") { + if (h._onTabsAreaClick(a._tabCloseId) !== true) { + return; + } + h.t[a._tabCloseId].conf.remove = true; + h._hideTab(a._tabCloseId); + a = null; + } else { + if (typeof a._tabId != "undefined") { + h._doOnClick(a._tabId); + a = null; + } + } + if (a != null) { + a = a.parentNode; + if (a == this) { + a = null; + } + } + } + }; + this.tabsArea.onselectstart = function (a) { + a = a || event; + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + }; + this._doOnClick = function (a) { + this.callEvent("onTabClick", [a, this.conf.lastActive]); + if (this.t[a].conf.enabled) { + this._setTabActive(a); + } + }; + this.t = {}; + this.addTab = function (a, v, n, s, r, w) { + if (typeof w != "boolean") { + w = this.conf.closeButton == true; + } + r = window.dhx4.s2b(r); + var o = document.createElement("DIV"); + o.className = "dhxtabbar_tab"; + o.innerHTML = "
" + v + "
" + (w ? "
" : ""); + o._tabId = a; + if (w) { + o.childNodes[1]._tabCloseId = a; + } + var m = this.tabsArea.childNodes[1].firstChild; + if (s != null && s + 1 > 0 && s + 1 < m.childNodes.length) { + m.insertBefore(o, m.childNodes[s + 1]); + } else { + m.appendChild(o); + } + var x = false; + if (typeof n == "undefined" || n == null || n == "*") { + n = this._getLabelWidth(v, w); + x = true; + } else { + n = parseInt(n); + } + o.style.width = n + "px"; + var u = new dhtmlXTabBarCell(a, this); + this.tabsMode.appendChild(u.cell); + this.t[a] = { tab: o, cell: u, conf: { text: v, visible: true, active: false, enabled: true, close: w, width: n, autowidth: x } }; + m = u = null; + if (r) { + this._setTabActive(a); + } else { + this._adjustCell(a); + } + if (this.conf.initSeq != true && this.conf.arwMode == "auto") { + this.setSizes(); + } + }; + this.setSizes = function () { + this._adjustCont(); + if (this.conf.tabsAreaOfs == null) { + this.tabsArea.style.width = this.cont.offsetWidth + "px"; + this.conf.tabsAreaOfs = parseInt(this.tabsArea.style.width) - this.tabsArea.offsetWidth; + } + this.tabsArea.style.width = this.cont.offsetWidth + this.conf.tabsAreaOfs + "px"; + this._adjustCell(this.conf.lastActive); + this._adjustTabs(true); + this.callEvent("_onSetSizes", []); + }; + this._adjustCell = function (o) { + if (!this.conf.contZone || o == null) { + return; + } + var n = (this.conf.tabsMode == "top" ? this.tabsArea.offsetHeight : 0) + this.conf.tabsTop; + var m = this.cont.offsetHeight - this.tabsArea.offsetHeight - this.conf.tabsTop; + var a = this.t[o].cell.dataType; + if (this.conf.skin == "dhx_skyblue" && (a == "layout" || a == "tabbar" || a == "acc")) { + if (this.conf.tabsMode == "top") { + n = n - 1; + } + m = m + 1; + } + if (o != this.conf.lastActive) { + n = -5000; + this.t[o].cell.cell.style.visibility = "hidden"; + this.t[o].cell.cell.style.zIndex = 0; + } + this.t[o].cell._setSize(0, n, this.cont.offsetWidth, m); + }; + this.setTabsMode = function (a) { + this.conf.tabsMode = a == "bottom" ? "bottom" : "top"; + this.tabsMode.className = "dhxtabbar_tabs_" + this.conf.tabsMode; + this.tabsArea.className = "dhxtabbar_tabs dhxtabbar_tabs_" + this.conf.tabsMode; + this.tabsArea.style.top = this.conf.tabsMode == "top" ? this.conf.tabsTop + "px" : "auto"; + this.setSizes(); + }; + this._tabCss = function (s, o) { + var m = this.t[s].conf.active; + var r = !this.t[s].conf.enabled; + var n = !this.t[s].conf.visible; + return "dhxtabbar_tab" + (n ? " dhxtabbar_tab_hidden" : m || r ? " dhxtabbar_tab" + (m ? "_actv" : "") + (r ? "_dis" : "") : ""); + }; + this._getLabelWidth = function (n, m) { + if (this.tabsTextTest == null) { + this.tabsTextTest = document.createElement("SPAN"); + this.tabsTextTest.className = "dhxtabbar_tabs_text_test_" + this.conf.skin; + } + document.body.appendChild(this.tabsTextTest); + this.tabsTextTest.innerHTML = n; + var a = this.tabsTextTest.offsetWidth; + if (window.dhx4.isIE && a == 0) { + a = this.tabsTextTest.offsetWidth; + } + a += this.conf.tabsWidth[this.conf.skin][0]; + if (m == true) { + a += this.conf.tabsWidth[this.conf.skin][1]; + } + document.body.removeChild(this.tabsTextTest); + return a; + }; + this._adjustTabs = function (o) { + if (this._checkArrows() == true || o == true) { + this.tabsArea.childNodes[1].style.left = this.tabsArea.childNodes[0].offsetWidth - 1 + "px"; + this.tabsArea.childNodes[1].style.width = Math.max(0, this.tabsArea.clientWidth - this.tabsArea.childNodes[0].offsetWidth - this.tabsArea.childNodes[2].offsetWidth) + 1 + "px"; + } + var s = this.tabsArea.childNodes[1]; + if (s.offsetWidth < 5) { + s = null; + return; + } + var a = parseInt(s.childNodes[0].style[this.conf.align]); + var n = null; + for (var r = 0; r < s.childNodes[0].childNodes.length; r++) { + var u = s.childNodes[0].childNodes[r]._tabId; + if (u != null && this.t[u].conf.visible) { + var m = this.t[u].tab.offsetWidth - this.conf.tabsOfs; + if (this.t[u].conf.active) { + if (a < 0 || s.offsetWidth < m) { + n = { d: 1, id: u }; + } else { + if (a + m > s.offsetWidth) { + n = { d: -1, id: u }; + } + } + } + a += m; + } + } + if (n != null) { + this._moveTabs(n.d, n.id); + } else { + if (s.offsetWidth > a + 1) { + s.childNodes[0].style[this.conf.align] = Math.min(0, parseInt(s.childNodes[0].style[this.conf.align]) + (s.offsetWidth - a)) + "px"; + } + } + s = n = null; + }; + this._moveTabs = function (w, o) { + var n = this.tabsArea.childNodes[1].childNodes[0]; + var u = 0; + var y = []; + var C = null; + for (var a = 0; a < n.childNodes.length; a++) { + var m = n.childNodes[a]._tabId; + if (m != null && this.t[m].conf.visible) { + y.push({ id: m, w: this.t[m].tab.offsetWidth - this.conf.tabsOfs, ind: u }); + if (m == o) { + C = u; + } + u++; + } + } + var A = parseInt(this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]); + var s = this.tabsArea.clientWidth - this.tabsArea.childNodes[0].offsetWidth - this.tabsArea.childNodes[2].offsetWidth + this.conf.tabsOfs; + var v = null; + var r = null; + for (var a = 0; a < y.length; a++) { + y[a].x = A; + if (v == null && A >= 0 && A + y[a].w > 0) { + v = y[a]; + } + if (A < s && A + y[a].w <= s) { + r = y[a]; + } + A += y[a].w; + } + if (C != null) { + var D = y[C]; + } else { + var D = null; + if (w > 0) { + if (v == null) { + if (y.length > 0) { + D = y[y.length - 1]; + } + } else { + if (v.ind > 0 && y.length >= v.ind) { + D = y[v.ind - 1]; + } + } + } else { + if (r == null) { + if (y.length > 0) { + D = y[0]; + } + } else { + if (y.length > r.ind) { + D = y[r.ind + 1]; + } + } + } + } + if (D != null) { + if (w > 0) { + if (A < s) { + n.style[this.conf.align] = Math.min(0, parseInt(n.style[this.conf.align]) + (s - A)) + "px"; + } else { + n.style[this.conf.align] = parseInt(n.style[this.conf.align]) - D.x + "px"; + } + } else { + n.style[this.conf.align] = parseInt(n.style[this.conf.align]) - D.x + s - D.w + "px"; + } + } + n = D = y = null; + }; + this._getNextVisible = function (m, a) { + return this._getNearVisible(m, a, "next"); + }; + this._getPrevVisible = function (m, a) { + return this._getNearVisible(m, a, "previous"); + }; + this._getFirstVisible = function () { + return this._getNearVisible(null, false, "first"); + }; + this._getNearVisible = function (s, n, r) { + if (r == "first") { + var o = this.tabsArea.childNodes[1].childNodes[0].childNodes[1]; + r = "next"; + } else { + if (s == null || this.t[s] == null) { + return n ? this._getFirstVisible() : null; + } + var o = this.t[s].tab[r + "Sibling"]; + } + var m = null; + while (o != null && m == null) { + var a = o._tabId; + if (a != null && m == null && this.t[a].conf.visible) { + m = a; + } else { + o = o[r + "Sibling"]; + } + } + o = null; + return m; + }; + this._showTab = function (m, a) { + if (this.t[m] == null) { + return; + } + if (this.t[m].conf.transActv == true) { + if (this.t[m].conf.transMode == "show") { + return; + } + } else { + if (this.t[m].conf.visible == true) { + return; + } + } + if (this.conf.transProp !== false) { + this.t[m].conf.transActv = true; + this.t[m].conf.transMode = "show"; + this.t[m].conf.transProp = this.conf.transProp; + this.t[m].conf.transActvId = a ? m : null; + if (!this.t[m].conf.transEv) { + this.t[m].tab.addEventListener(this.conf.transEv, this._doOnTrEnd, false); + this.t[m].conf.transEv = true; + } + this.t[m].conf.visible = true; + this.t[m].tab.className = this._tabCss(m); + this.t[m].tab.style[this.conf.transProp] = this.conf.transValueWidth; + this.t[m].tab.style.width = this.t[m].conf.width + "px"; + if (this.t[m].tab.clientWidth >= this.t[m].conf.width) { + this.t[m].tab.style.visibility = "visible"; + } + } else { + this.t[m].conf.visible = true; + this.t[m].tab.style.display = ""; + if (a || this.t[m].conf.active) { + this.t[m].conf.active = false; + this._setTabActive(m); + } else { + this._adjustTabs(); + } + } + }; + this._hideTab = function (s, a) { + if (this.t[s] == null) { + return; + } + if (this.t[s].conf.transActv == true) { + if (this.t[s].conf.transMode == "hide") { + return; + } + } else { + if (this.t[s].conf.visible != true) { + return; + } + } + var m = false; + if (this.conf.lastActive == s) { + this.conf.lastActive = null; + this.t[s].conf.active = false; + this.t[s].tab.className = this._tabCss(s); + m = true; + } + var o = this._getPrevVisible(s); + var n = this._getNextVisible(s); + var r = m && a !== false ? (a == true ? null : a) || n || o : null; + if (this.conf.transProp !== false) { + this.t[s].conf.transActv = true; + this.t[s].conf.transMode = "hide"; + this.t[s].conf.transProp = this.conf.transProp; + this.t[s].conf.transActvId = r; + this.t[s].conf.visible = false; + if (!this.t[s].conf.transEv) { + this.t[s].tab.addEventListener(this.conf.transEv, this._doOnTrEnd, false); + this.t[s].conf.transEv = true; + } + this.t[s].tab.style.visibility = "hidden"; + this.t[s].tab.className = h._tabCss(s); + this.t[s].tab.style[this.conf.transProp] = this.conf.transValueWidth; + this.t[s].tab.style.width = "0px"; + } else { + this.t[s].tab.style.display = "none"; + this.t[s].conf.visible = false; + if (this.conf.contZone) { + this.t[s].cell.cell.style.visibility = "hidden"; + this.t[s].cell.cell.style.top = "-5000px"; + } + if (r != null) { + this._setTabActive(r); + } + this._adjustTabs(); + if (this.t[s].conf.remove) { + this._removeTab(s); + } + } + }; + this._isTabVisible = function (a) { + return this.t[a].conf.visible == true; + }; + this._doOnTrEnd = function () { + var n = this._tabId; + if (h.t[n] == null) { + return; + } + var a = h.t[n]; + var m = a.conf.transActvId; + if (a.conf.transMode == "hide") { + if (a.conf.remove) { + h._removeTab(n); + } else { + a.tab.style[a.conf.transProp] = ""; + if (h.conf.contZone) { + a.cell.cell.style.visibility = "hidden"; + a.cell.cell.style.top = "-5000px"; + } + a.conf.transActv = false; + } + } else { + if (a.conf.transMode == "show") { + a.tab.style[a.conf.transProp] = ""; + a.tab.style.visibility = "visible"; + a.conf.transMode = null; + a.conf.transActv = false; + } + } + if (m != null) { + h._setTabActive(m); + } else { + h._adjustTabs(); + } + a = null; + }; + this.enableTabCloseButton = function (a) { + this.conf.closeButton = window.dhx4.s2b(a); + }; + this.unload = function () { + this.conf.unloading = true; + this.clearAll(); + this.t = null; + if (this.tabsTextTest != null) { + if (this.tabsTextTest.parentNode) { + this.tabsTextTest.parentNode.removeChild(this.tabsTextTest); + } + this.tabsTextTest = null; + } + window.dhx4._enableDataLoading(this, null, null, null, "clear"); + this.tabsArea.childNodes[0].onclick = null; + this.tabsArea.childNodes[2].onclick = null; + this.tabsArea.onclick = null; + this.tabsArea.onselectstart = null; + this.tabsArea.parentNode.removeChild(this.tabsArea); + this.tabsArea = null; + this.tabsMode.parentNode.removeChild(this.tabsMode); + this.tabsMode = null; + this._unloadTop(); + window.dhx4._eventable(this, "clear"); + for (var m in this) { + this[m] = null; + } + h = null; + }; + this.enableContentZone = function (a) { + this.conf.contZone = a == true; + }; + this.setSkin = function (n) { + this._setBaseSkin(n); + this.conf.skin = n; + if (this.tabsTextTest != null) { + this.tabsTextTest.className = "dhxtabbar_tabs_text_test_" + this.conf.skin; + } + for (var m in this.t) { + this.t[m].cell._resetSizeState(); + if (this.t[m].conf.autowidth == true) { + this.t[m].conf.width = this._getLabelWidth(this.t[m].conf.text, this.t[m].conf.close); + if (this.t[m].conf.visible) { + this.t[m].tab.style.width = this.t[m].conf.width + "px"; + } + } + } + this.conf.tabsAreaOfs = null; + this._fixTabsOfs(); + this.setSizes(); + }; + this.setAlign = function (a) { + a = a == "left" ? "left" : "right"; + if (a == this.conf.align) { + this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align] = "0px"; + return; + } + if (this.conf.transProp !== false) { + this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp] = ""; + } + this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align] = ""; + this.conf.align = a; + this.tabsArea.childNodes[1].childNodes[0].className = "dhxtabbar_tabs_cont_" + this.conf.align + this.conf.tabsContCss; + this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align] = "0px"; + if (this.conf.transProp !== false) { + this.conf.transValuePos = this.conf.align + " " + this.conf.transSpeed; + this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp] = this.conf.transValuePos; + } + }; + this._initObj = function (o) { + this.conf.initSeq = true; + this.clearAll(); + var a = false; + if (o.settings != null) { + if (o.settings.skin != null) { + this.setSkin(o.settings.skin); + } + if (o.settings.closeButton != null) { + this.enableTabCloseButton(window.dhx4.s2b(o.settings.closeButton)); + } + if (o.settings.align != null) { + this.setAlign(o.settings.align); + } + if (o.settings.hrefmode == "ajax") { + a = true; + } + if (o.settings.hrefmode == "ajax-html") { + a = true; + this.conf.url_demand = true; + } + } + if (o.tabs != null) { + for (var n = 0; n < o.tabs.length; n++) { + var m = o.tabs[n]; + if (typeof m.id == "undefined") { + m.id = window.dhx4.newId(); + } + if (!isNaN(parseInt(m.width))) { + m.width = parseInt(m.width); + } else { + m.width = null; + } + this.addTab(m.id, m.text || m.label || "", m.width, m.index, window.dhx4.s2b(m.selected) || window.dhx4.s2b(m.active), m.close); + if (m.content != null) { + this.cells(m.id).attachHTMLString(m.content); + } else { + if (m.href != null) { + if (this.conf.url_demand == true) { + this.conf.urls[m.id] = { href: m.href, ajax: a }; + } else { + this.cells(m.id).attachURL(m.href, a); + } + } + } + if (typeof m.enabled != "undefined" && window.dhx4.s2b(m.enabled) == false) { + this.tabs(m.id).disable(); + } else { + if (typeof m.disabled != "undefined" && window.dhx4.s2b(m.disabled) == true) { + this.tabs(m.id).disable(); + } + } + } + } + this.conf.initSeq = false; + if (this.conf.arwMode == "auto") { + this.setSizes(); + } + if (this.conf.url_demand == true) { + this._loadURLOnDemand(this.conf.lastActive); + } + }; + this._xmlToObj = function (u) { + var s = { settings: {}, tabs: [] }; + var m = u.getElementsByTagName("tabbar")[0]; + if (m != null) { + for (var v in { skin: 1, align: 1, closeButton: 1, hrefmode: 1 }) { + if (m.getAttribute(v) != null) { + s.settings[v] = m.getAttribute(v); + } + } + var y = m.getElementsByTagName("tab"); + for (var n = 0; n < y.length; n++) { + var o = { text: y[n].firstChild.nodeValue || "" }; + for (var v in { id: 1, width: 1, close: 1, selected: 1, active: 1, enabled: 1, disabled: 1, href: 1 }) { + if (y[n].getAttribute(v) != null) { + o[v] = y[n].getAttribute(v); + } + } + var A = y[n].getElementsByTagName("content")[0]; + if (A != null) { + o.content = ""; + for (var x = 0; x < A.childNodes.length; x++) { + o.content += A.childNodes[x].nodeValue || ""; + } + } + s.tabs.push(o); + } + } + return s; + }; + dhx4._enableDataLoading(this, "_initObj", "_xmlToObj", "tabbar", { struct: true }); + var e = window.dhx4.transDetect(); + this.conf.transProp = e.transProp; + this.conf.transEv = e.transEv; + this.conf.transValueWidth = "width " + this.conf.transSpeed; + e = null; + if (this.conf.transProp !== false) { + this.conf.transValuePos = this.conf.align + " " + this.conf.transSpeed; + this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp] = this.conf.transValuePos; + } + this._callMainEvent = function (m, a) { + return this.callEvent(m, a); + }; + window.dhx4._eventable(this); + if (this.conf.autoload.json != null) { + this.loadStruct(this.conf.autoload.json, this.conf.autoload.onload); + } else { + if (this.conf.autoload.xml != null) { + this.loadStruct(this.conf.autoload.xml, this.conf.autoload.onload); + } else { + if (this.conf.autoload.tabs != null) { + this.loadStruct({ tabs: this.conf.autoload.tabs }); + } + } + } + if (this.conf.autoload.arrows_mode != null) { + this.setArrowsMode(this.conf.autoload.arrows_mode); + } + this._fixTabsOfs(); + this.setSizes(); + return this; +} +dhtmlXTabBar.prototype = new dhtmlXCellTop(); +dhtmlXTabBar.prototype._fixTabsOfs = function () { + this.conf.tabsOfs = this.conf.skin == "dhx_web" ? 0 : 1; +}; +dhtmlXTabBar.prototype.cells = dhtmlXTabBar.prototype.tabs = function (a) { + if (this.t[a]) { + return this.t[a].cell; + } + return null; +}; +dhtmlXTabBar.prototype.getAllTabs = function () { + var e = []; + for (var c in this.t) { + e.push(c); + } + return e; +}; +dhtmlXTabBar.prototype._setTabActive = function (c, a) { + if (!this.t[c] || this.t[c].conf.active) { + return; + } + if (typeof a == "undefined") { + a = true; + } + if (a == true && this.callEvent("onSelect", [c, this.conf.lastActive]) !== true) { + return; + } + this.setTabInActive(); + this.t[c].conf.active = true; + if (this.conf.contZone) { + this.t[c].cell.cell.style.visibility = "visible"; + this.t[c].cell.cell.style.top = "0px"; + this.t[c].cell.cell.style.zIndex = 1; + } + this.t[c].tab.className = this._tabCss(c); + this.conf.lastActive = c; + this.setSizes(); + if (this.conf.url_demand == true) { + this._loadURLOnDemand(c); + } +}; +dhtmlXTabBar.prototype.setTabInActive = function () { + if (this.conf.lastActive && this.t[this.conf.lastActive]) { + this.t[this.conf.lastActive].conf.active = false; + if (this.conf.contZone) { + this.t[this.conf.lastActive].cell.cell.style.visibility = "hidden"; + this.t[this.conf.lastActive].cell.cell.style.top = "-5000px"; + this.t[this.conf.lastActive].cell.cell.style.zIndex = 0; + } + this.t[this.conf.lastActive].tab.className = this._tabCss(this.conf.lastActive); + this.conf.lastActive = null; + } +}; +dhtmlXTabBar.prototype._isTabActive = function (a) { + return a == this.conf.lastActive && this.conf.lastActive != null; +}; +dhtmlXTabBar.prototype.getActiveTab = function () { + return this.conf.lastActive; +}; +dhtmlXTabBar.prototype.goToNextTab = function () { + var a = this._getNextVisible(this.conf.lastActive, true); + if (a != null) { + this._setTabActive(a); + } +}; +dhtmlXTabBar.prototype.goToPrevTab = function () { + var a = this._getPrevVisible(this.conf.lastActive, true); + if (a != null) { + this._setTabActive(a); + } +}; +dhtmlXTabBar.prototype._enableTab = function (c, a) { + if (!this.t[c] || this.t[c].conf.enabled) { + return; + } + this.t[c].conf.enabled = true; + this.t[c].tab.className = this._tabCss(c); + if (a == true) { + this._setTabActive(c); + } +}; +dhtmlXTabBar.prototype._disableTab = function (c, a) { + if (!this.t[c] || !this.t[c].conf.enabled) { + return; + } + this.t[c].conf.enabled = false; + this.t[c].tab.className = this._tabCss(c); + if (a !== false && this.conf.lastActive == c) { + if (a == true) { + a = this._getNextVisible(c) || this._getPrevVisible(c); + } + this._setTabActive(a); + } +}; +dhtmlXTabBar.prototype._isTabEnabled = function (a) { + return this.t[a] != null && this.t[a].conf.enabled == true; +}; +dhtmlXTabBar.prototype._setTabText = function (g, e, c) { + if (!this.t[g]) { + return; + } + var a = false; + if (typeof c == "undefined" || c == null) { + c = this._getLabelWidth(e, this.t[g].conf.close); + a = true; + } + this.t[g].tab.style.width = c + "px"; + this.t[g].tab.childNodes[0].innerHTML = e; + this.t[g].conf.text = e; + this.t[g].conf.width = c; + this.t[g].conf.autowidth = a; +}; +dhtmlXTabBar.prototype._getTabText = function (a) { + if (!this.t[a]) { + return null; + } + return this.t[a].conf.text; +}; +dhtmlXTabBar.prototype._removeTab = function (m, e, j) { + if (!this.t[m]) { + return; + } + if (j != true && this.t[m].conf.remove != true) { + this.t[m].conf.remove = true; + this._hideTab(m, e); + return; + } + if (typeof e == "undefined") { + e = true; + } + var g = this._getNextVisible(m); + var h = this._getPrevVisible(m); + if (this.t[m].conf.transEv == true) { + this.t[m].tab.removeEventListener(this.conf.transEv, this._doOnTrEnd, false); + this.t[m].conf.transEv = false; + } + for (var c in this.t[m].conf) { + this.t[m].conf[c] = null; + } + this.t[m].conf = null; + delete this.t[m].conf; + this.t[m].cell._unload(); + this.t[m].cell = null; + this.t[m].tab.parentNode.removeChild(this.t[m].tab); + this.t[m].tab = null; + this.t[m] = null; + delete this.t[m]; + this.conf.urls[m] = null; + delete this.conf.urls[m]; + if (this.conf.lastActive == m) { + this.conf.lastActive = null; + if (e != false) { + var l = e == true ? g || h || this._getFirstVisible() : e; + if (l != null) { + this._setTabActive(l); + } + } + } else { + if (j != true) { + this._adjustTabs(); + } + } +}; +dhtmlXTabBar.prototype.clearAll = function () { + for (var c in this.t) { + this._removeTab(c, false, true); + } + this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align] = "0px"; +}; +dhtmlXTabBar.prototype.moveTab = function (e, a) { + if (!this.t[e] || a < 0) { + return; + } + a += 1; + var c = this.tabsArea.childNodes[1].firstChild; + if (c.childNodes[a] != this.t[e].tab) { + c.removeChild(this.t[e].tab); + if (a >= c.childNodes.length) { + c.appendChild(this.t[e].tab); + } else { + c.insertBefore(this.t[e].tab, c.childNodes[a]); + } + } + c = null; +}; +dhtmlXTabBar.prototype._getIndex = function (g) { + var a = -1; + var e = this.tabsArea.childNodes[1].firstChild; + for (var c = 1; c < e.childNodes.length; c++) { + if (e.childNodes[c]._tabId == g) { + a = c - 1; + } + } + e = null; + return a; +}; +dhtmlXTabBar.prototype.getNumberOfTabs = function (g) { + var e = 0; + for (var c in this.t) { + e += g != true ? 1 : this.t[c].conf.visible == true ? 1 : 0; + } + return e; +}; +dhtmlXTabBar.prototype.forEachCell = dhtmlXTabBar.prototype.forEachTab = function (e) { + for (var c in this.t) { + e.apply(window, [this.t[c].cell]); + } +}; +dhtmlXTabBar.prototype.enableAutoReSize = function () { + this._initFSResize(); +}; +dhtmlXTabBar.prototype.setArrowsMode = function (a) { + a = { auto: "auto", always: "always" }[String(a)]; + if (a == null || a == this.conf.mode) { + return; + } + this.conf.arwMode = a; + if (a == "always") { + this.tabsArea.childNodes[0].className = "dhxtabbar_tabs_ar_left"; + this.tabsArea.childNodes[2].className = "dhxtabbar_tabs_ar_right"; + } + this.setSizes(); +}; +dhtmlXTabBar.prototype._checkArrows = function () { + var h = false; + if (this.conf.arwMode == "auto") { + var g = 0; + for (var e in this.t) { + g += this.t[e].tab.offsetWidth; + } + var c = this.tabsArea.childNodes[0]; + var j = this.tabsArea.childNodes[2]; + if (g > this.cont.offsetWidth) { + if (c.className.search(/dhxtabbar_tabs_ar_hidden/) >= 0) { + c.className = c.className.replace(/\s{0,}dhxtabbar_tabs_ar_hidden/, ""); + j.className = j.className.replace(/\s{0,}dhxtabbar_tabs_ar_hidden/, ""); + h = true; + } + } else { + if (c.className.search(/dhxtabbar_tabs_ar_hidden/) < 1) { + c.className += " dhxtabbar_tabs_ar_hidden"; + j.className += " dhxtabbar_tabs_ar_hidden"; + h = true; + } + } + c = j = null; + } + return h; +}; +dhtmlXTabBar.prototype._loadURLOnDemand = function (a) { + if (a != null && this.conf.urls[a] != null) { + this.cells(a).attachURL(this.conf.urls[a].href, this.conf.urls[a].ajax); + this.conf.urls[a] = null; + } +}; +window.dhtmlXTabBarCell = function (g, e) { + dhtmlXCellObject.apply(this, [g, "_tabbar"]); + this.tabbar = e; + this.conf.skin = this.tabbar.conf.skin; + this.conf.tabbar_funcs = { + show: "_showTab", + hide: "_hideTab", + isVisible: "_isTabVisible", + enable: "_enableTab", + disable: "_disableTab", + isEnabled: "_isTabEnabled", + getIndex: "_getIndex", + getText: "_getTabText", + setText: "_setTabText", + setActive: "_setTabActive", + isActive: "_isTabActive", + close: "_removeTab", + }; + this._tabbarCall = function (a) { + return function () { + var h = [this._idd]; + for (var j = 0; j < arguments.length; j++) { + h.push(arguments[j]); + } + return this.tabbar[a].apply(this.tabbar, h); + }; + }; + for (var c in this.conf.tabbar_funcs) { + if (typeof this[c] != "function") { + this[c] = this._tabbarCall(this.conf.tabbar_funcs[c]); + } + } + this.attachEvent("_onCellUnload", function () { + this.tabbar = null; + for (var h in this.conf.tabbar_funcs) { + this[h] = null; + this.conf.tabbar_funcs[h] = null; + } + this.conf.tabbar_funcs = null; + }); + this.attachEvent("_onContentLoaded", function () { + this.tabbar._callMainEvent("onContentLoaded", arguments); + this.tabbar._callMainEvent("onTabContentLoaded", arguments); + }); + this.attachEvent("_onContentAttach", function () { + this.tabbar._adjustCell(this.tabbar.conf.lastActive); + }); + this.attachEvent("_onBeforeContentAttach", function (a) { + if (a == "sidebar" && this.conf.skin != "dhx_skyblue") { + this._hideBorders(); + } + }); +}; +window.dhtmlXTabBarCell.prototype = new dhtmlXCellObject(); +dhtmlXCellObject.prototype.attachTabbar = function (a) { + this.callEvent("_onBeforeContentAttach", ["tabbar"]); + if (typeof a == "string") { + a = { mode: a }; + } else { + if (typeof a != "object" || a == null) { + a = {}; + } + } + var c = document.createElement("DIV"); + c.style.width = "100%"; + c.style.height = "100%"; + c.style.position = "relative"; + c.style.overflow = "hidden"; + if (typeof window.dhtmlXAccordionCell != "undefined" && this instanceof window.dhtmlXAccordionCell) { + c._ofs = { t: -1 }; + } + if (typeof window.dhtmlXTabBarCell != "undefined" && this instanceof window.dhtmlXTabBarCell) { + if (this.conf.skin == "dhx_skyblue") { + c._ofs = { t: -1, r: -1, b: -1, l: -1 }; + } + } + if (typeof window.dhtmlXSideBarCell != "undefined" && this instanceof window.dhtmlXSideBarCell) { + c._ofs = { l: -1 }; + if (this.conf.skin == "dhx_web" && this.sidebar.conf.autohide == true) { + c._ofs.l = 0; + } + if (this.conf.skin == "dhx_terrace") { + if (this.sidebar.conf.autohide == true) { + c._ofs.l = 0; + } + if (this.sidebar.conf.header == true) { + c._ofs.t = -1; + } + } + } + if (typeof window.dhtmlXCarouselCell != "undefined" && this instanceof window.dhtmlXCarouselCell) { + this._hideBorders(); + } + this._attachObject(c); + a.skin = this.conf.skin; + a.parent = c; + this.dataType = "tabbar"; + this.dataObj = new dhtmlXTabBar(a); + a.parent = c = null; + a = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; +}; +function dhtmlXTabBarInitFromHTML() { + var z = document.getElementsByTagName("div"); + for (var i = 0; i < z.length; i++) { + if (z[i].className.indexOf("dhtmlxTabBar") != -1) { + var conf = { settings: {}, tabs: [] }; + var n = z[i]; + var id = n.id; + n.className = ""; + var k = new Array(); + for (var j = 0; j < n.childNodes.length; j++) { + if (n.childNodes[j].tagName && n.childNodes[j].tagName != "!") { + k[k.length] = n.childNodes[j]; + } + } + var skin = n.getAttribute("skin"); + if (skin != null) { + conf.settings.skin = skin; + } + var w = new dhtmlXTabBar({ parent: id, mode: n.getAttribute("mode") }); + window[id] = w; + acs = n.getAttribute("onbeforeinit"); + if (acs) { + eval(acs); + } + align = n.getAttribute("align"); + if (align) { + conf.settings.align = align; + } + var cont = {}; + for (var j = 0; j < k.length; j++) { + var m = k[j]; + var tab = { id: m.id, text: m.getAttribute("name"), width: m.getAttribute("width"), selected: m.getAttribute("selected"), active: m.getAttribute("active"), close: m.getAttribute("close") }; + var href = m.getAttribute("href"); + if (href) { + cont[m.id] = { href: href }; + } else { + cont[m.id] = { cont: m }; + } + conf.tabs.push(tab); + } + w.loadStruct(conf); + for (var a in cont) { + if (cont[a].href) { + w.cells(a).attachURL(cont[a].href); + cont[a].href = null; + } else { + w.cells(a).attachObject(cont[a].cont); + if (cont[a].cont.style.display == "none") { + cont[a].cont.style.display = ""; + } + cont[a].cont = null; + } + cont[a] = null; + } + var selId = n.getAttribute("select"); + if (selId != null) { + w.tabs(selId).setActive(); + } else { + if (w.getActiveTab() == null) { + var v = w._getFirstVisible(); + if (v != null) { + w.cells(v).setActive(); + } + } + } + acs = n.getAttribute("oninit"); + if (acs) { + eval(acs); + } + } + } + if (typeof window.addEventListener == "function") { + window.removeEventListener("load", dhtmlXTabBarInitFromHTML, false); + } else { + window.detachEvent("onload", dhtmlXTabBarInitFromHTML); + } +} +if (typeof window.addEventListener == "function") { + window.addEventListener("load", dhtmlXTabBarInitFromHTML, false); +} else { + window.attachEvent("onload", dhtmlXTabBarInitFromHTML); +} +function dhtmlXSideBar(c) { + var e = this; + this.conf = { + skin: c.skin || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxsidebar") || "dhx_skyblue", + css: "dhxsidebar", + width: c.width || 200, + scroll_size: 12, + scroll_mult: 20, + close_button: false, + icons_path: c.icons_path || "", + selected: null, + single_cell: typeof c.single_cell == "undefined" ? false : window.dhx4.s2b(c.single_cell), + cell: null, + header: window.dhx4.s2b(c.header), + autohide: window.dhx4.s2b(c.autohide), + animate_items: true, + }; + this.setTemplate(c.template); + window.dhtmlXCellTop.apply(this, [c.parent, c == null ? null : c.offsets]); + window.dhx4._eventable(this); + if (window.navigator.msPointerEnabled == true) { + this.conf.touch_ms = true; + (this.conf.touch_start = "MSPointerDown"), (this.conf.touch_end = "MSPointerUp"); + } else { + this.conf.touch_ms = false; + (this.conf.touch_start = "touchstart"), (this.conf.touch_end = "touchend"); + } + this.side = document.createElement("DIV"); + this.side.className = "dhxsidebar_side dhxsidebar_tpl_" + this.conf.tpl_name; + this.side.innerHTML = "
"; + this.cont.appendChild(this.side); + this.arw = document.createElement("DIV"); + this.arw.className = "dhxsidebar_arrows dhxsidebar_arrows_hidden"; + this.arw.innerHTML = "
"; + this.cont.appendChild(this.arw); + if (this.conf.autohide == true) { + this.hideSide(); + this.cont.className += " dhxsidebar_autohide"; + this._doOnBodyClick = function () { + if (e.conf.clear_click == true) { + e.conf.clear_click = false; + return; + } + e.hideSide(); + }; + this._doOnEscDown = function (g) { + g = g || event; + if (g.keyCode == 27) { + e.conf.clear_click = false; + e.hideSide(); + } + }; + if (typeof window.addEventListener == "function") { + window.addEventListener(this.conf.touch_start, this._doOnBodyClick, false); + window.addEventListener("click", this._doOnBodyClick, false); + window.addEventListener("keydown", this._doOnEscDown, false); + } else { + document.body.attachEvent("onclick", this._doOnBodyClick); + document.body.attachEvent("onkeydown", this._doOnEscDown); + } + } + window.setTimeout(function () { + if (e != null && e.side != null) { + e.side.firstChild.style.top = "0px"; + } + }, 1); + this._doOnArwClick = function (h) { + h = h || event; + if (h.type != "click" && h.preventDefault) { + h.preventDefault(); + } + var g = h.target || h.srcElement; + if (g.className.match(/dhxsidebar_arrow_image/) != null) { + g = g.parentNode; + } + if (g.className.match(/dhxsidebar_arrow_left/) != null) { + e._scrollSide(-e.conf.scroll_size); + } else { + if (g.className.match(/dhxsidebar_arrow_right/) != null) { + e._scrollSide(e.conf.scroll_size); + } + } + g = null; + }; + if (typeof window.addEventListener == "function") { + this.arw.addEventListener(this.conf.touch_start, this._doOnArwClick, false); + this.arw.addEventListener("click", this._doOnArwClick, false); + } else { + this.arw.attachEvent("onclick", this._doOnArwClick); + } + this._doOnSideClick = function (j) { + j = j || event; + var h = j.target || j.srcElement; + var l = null; + var g = false; + e.conf.clear_click = true; + if (j.type == "touchstart" || j.type == "pointerdown" || j.type == "MSPointerDown") { + if (j.preventDefault) { + j.preventDefault(); + } + if (this.className.match(/dhxsidebar_touch/gi) == null) { + if (j.type == "touchstart" || (j.type == "pointerdown" && j.pointerType == "touch")) { + this.className += " dhxsidebar_touch"; + } + } + } + while (h != null && l == null && j.type != "pointerdown" && j.type != "MSPointerDown") { + if (typeof h.className != "undefined") { + if (h.className.match(/^dhxsidebar_item/) != null && typeof h._idd != "undefined") { + l = h._idd; + } else { + if (h.className.match(/^dhxsidebar_bubble/) != null) { + g = true; + l = h.parentNode._idd; + } + } + } + h = h.parentNode; + } + if (l != null) { + if (g == false || (g == true && e.callEvent("onBubbleClick", [l, e.t[l].conf.bubble]) == true)) { + e._setItemActive(l, true); + } + } + h = null; + }; + if (typeof window.addEventListener == "function") { + this.side.addEventListener(this.conf.touch_start, this._doOnSideClick, false); + this.side.addEventListener(this.conf.touch_end, this._doOnSideClick, false); + this.side.addEventListener("mouseup", this._doOnSideClick, false); + } else { + this.side.attachEvent("onclick", this._doOnSideClick); + } + this.side.onmouseover = function () { + this.className = this.className.replace(/\s*dhxsidebar_touch/gi, ""); + }; + this._doOnSideScroll = function (g) { + g = g || event; + var h = g.type == "mousewheel" ? -g.wheelDelta : g.deltaY; + e._scrollSide((h / Math.abs(h)) * 3); + }; + this._scrollSide = function (g) { + var h = parseInt(this.side.firstChild.style.top || 0) - g * this.conf.scroll_mult; + if (h + this.side.firstChild.offsetHeight < this.side.clientHeight) { + h = this.side.clientHeight - this.side.firstChild.offsetHeight; + } + if (h > 0) { + h = 0; + } + this.side.firstChild.style.top = h + "px"; + }; + if (typeof window.addEventListener == "function") { + this.side.addEventListener("wheel", this._doOnSideScroll, false); + } else { + this.side.attachEvent("onmousewheel", this._doOnSideScroll); + } + this.t = {}; + this.s = {}; + this._adjustCell = function (o, m) { + if (this.conf.single_cell != true && o == null) { + return; + } + var g = this.conf.autohide == true ? 0 : this.conf.width; + var j = this.cont.offsetWidth - g; + var n = 0; + var l = this.cont.offsetHeight; + if (this.conf.single_cell == true) { + if (m == true) { + this.conf.cell._setSize(g, n, j, l); + } + } else { + if (o != this.conf.selected) { + n = -5000; + this.t[o].cell.cell.style.visibility = "hidden"; + this.t[o].cell.cell.style.zIndex = 0; + } + this.t[o].cell._setSize(g, n, j, l); + } + }; + var a = window.dhx4.transDetect(); + this.conf.transProp = a.transProp; + this.conf.transEv = a.transEv; + this.conf.transValue = "all 0.1s"; + this._doOnTrEnd = function (h) { + var l = this._idd; + if (e.t[l] == null) { + return; + } + var g = e.t[l]; + var j = g.conf.transActvId; + if (g.conf.transMode == "hide") { + if (g.conf.remove == true) { + e._removeItem(l); + } else { + g.item.style[g.conf.transProp] = ""; + if (e.conf.single_cell != true) { + g.cell.cell.style.visibility = "hidden"; + g.cell.cell.style.top = "-5000px"; + } + g.conf.transActv = false; + } + } else { + if (g.conf.transMode == "show") { + g.item.style[g.conf.transProp] = ""; + g.item.style.visibility = "visible"; + g.conf.transMode = null; + g.conf.transActv = false; + } + } + if (j != null) { + e._setItemActive(j); + } else { + e._checkHeight(); + } + g = null; + }; + this._initObj = function (g) { + this.clearAll(); + if (g.items != null) { + this.addItem(g.items); + } + }; + this._xmlToObj = function (o) { + var h = []; + var m = o.getElementsByTagName("sidebar"); + if (m != null && m[0] != null) { + var j = m[0].getElementsByTagName("item"); + for (var n = 0; n < j.length; n++) { + var l = {}; + for (var g = 0; g < j[n].attributes.length; g++) { + l[j[n].attributes[g].nodeName] = j[n].attributes[g].nodeValue; + } + h.push(l); + } + } + return { items: h }; + }; + dhx4._enableDataLoading(this, "_initObj", "_xmlToObj", "sidebar", { struct: true }); + this.unload = function () { + this.conf.unloading = true; + if (typeof window.addEventListener == "function") { + this.side.removeEventListener("wheel", this._doOnSideScroll, false); + } else { + this.side.detachEvent("onmousewheel", this._doOnSideScroll); + } + if (this.conf.autohide == true) { + if (typeof window.addEventListener == "function") { + window.removeEventListener("click", this._doOnBodyClick, false); + window.removeEventListener("keydown", this._doOnEscDown, false); + } else { + document.body.detachEvent("onclick", this._doOnBodyClick); + document.body.detachEvent("onkeydown", this._doOnEscDown); + } + } + if (typeof this._sideCoverDetach == "function") { + this._sideCoverDetach(); + } + this.clearAll(); + this.s = this.t = null; + if (typeof window.addEventListener == "function") { + this.arw.removeEventListener(this.conf.touch_start, this._doOnArwClick, false); + this.arw.removeEventListener("click", this._doOnArwClick, false); + } else { + this.arw.detachEvent("onclick", this._doOnArwClick); + } + this.arw.parentNode.removeChild(this.arw); + this.arw = null; + if (typeof window.addEventListener == "function") { + this.side.removeEventListener(this.conf.touch_start, this._doOnSideClick, false); + this.side.removeEventListener(this.conf.touch_end, this._doOnSideClick, false); + this.side.removeEventListener("click", this._doOnSideClick, false); + } else { + this.side.detachEvent("onclick", this._doOnSideClick); + } + this.side.onmouseover = null; + this.side.parentNode.removeChild(this.side); + this.side = null; + this._unloadTop(); + if (this.conf.single_cell == true) { + this.conf.cell._unload(); + this.conf.cell = null; + } + window.dhx4._eventable(this, "clear"); + window.dhx4._enableDataLoading(this, null, null, null, "clear"); + for (var g in this) { + this[g] = null; + } + e = null; + }; + if (this.conf.single_cell == true) { + this.conf.cell = new dhtmlXSideBarCell("master", this); + this.cont.appendChild(this.conf.cell.cell); + this._cells_native = this.cells; + this.cells = function (g) { + this.conf.cell._idd = g; + return this.conf.cell; + }; + } + this.setSizes(); + if (c.items != null) { + this._initObj(c); + } else { + if (c.json != null) { + this.loadStruct(c.json, c.onload); + } else { + if (c.xml != null) { + this.loadStruct(c.xml, c.onload); + } + } + } + return this; +} +dhtmlXSideBar.prototype = new dhtmlXCellTop(); +dhtmlXSideBar.prototype._addItem = function (c) { + var g = typeof c.id != "undefined" ? c.id : window.dhx4.newId(); + if (c.type == "separator") { + var e = document.createElement("DIV"); + e.className = "dhxsidebar_sep"; + this.side.firstChild.appendChild(e); + this.s[g] = { sep: e }; + e = null; + return; + } + c.icons_path = this.conf.icons_path; + var e = document.createElement("DIV"); + e.className = "dhxsidebar_item"; + e.innerHTML = window.dhx4.template(this.conf.tpl_str, c); + e._idd = g; + this.side.firstChild.appendChild(e); + e.ondragstart = function () { + return false; + }; + if (this.conf.single_cell == true) { + var a = this.conf.cell; + } else { + var a = new dhtmlXSideBarCell(g, this); + this.cont.appendChild(a.cell); + } + this.t[g] = { item: e, cell: a, init: c, conf: { selected: false, visible: true, close: close } }; + if (typeof c.bubble != "undefined") { + this._setItemBubble(g, c.bubble); + } + if (this.conf.header == true) { + a.setHeaderText(window.dhx4.template(this.tpl_header, c)); + } + a = e = null; + if (window.dhx4.s2b(c.selected) == true) { + this._setItemActive(g); + } else { + this._adjustCell(g); + } + this._checkHeight(); +}; +dhtmlXSideBar.prototype.addItem = function (a) { + if (!(a instanceof Array)) { + a = [a]; + } + for (var c = 0; c < a.length; c++) { + this._addItem(a[c]); + } +}; +dhtmlXSideBar.prototype.items = dhtmlXSideBar.prototype.cells = function (a) { + if (this.conf.single_cell == true) { + return this.conf.cell; + } + if (this.t[a] != null) { + return this.t[a].cell; + } + return null; +}; +dhtmlXSideBar.prototype.forEachCell = dhtmlXSideBar.prototype.forEachItem = function (e) { + if (this.conf.single_cell == true) { + if (typeof e == "function") { + e.apply(window, [this.conf.cell]); + } else { + if (typeof e == "string" && typeof window[e] == "function") { + window[e].apply(window, [this.conf.cell]); + } + } + return; + } + for (var c in this.t) { + if (typeof e == "function") { + e.apply(window, [this.t[c].cell]); + } else { + if (typeof e == "string" && typeof window[e] == "function") { + window[e].apply(window, [this.t[c].cell]); + } + } + } +}; +dhtmlXSideBar.prototype.getAllItems = function () { + var e = []; + for (var c in this.t) { + e.push(c); + } + return e; +}; +dhtmlXSideBar.prototype.getNumberOfItems = function () { + return this.getAllItems().length; +}; +dhtmlXSideBar.prototype.clearAll = function () { + for (var c in this.t) { + this._removeItem(c, false, true); + } + for (var c in this.s) { + this.removeSep(c); + } +}; +dhtmlXSideBar.prototype.setSizes = function () { + this._adjustCont(); + this._adjustSide(); + this._checkHeight(); + this._adjustCell(this.conf.selected, true); + this.callEvent("_onSetSizes", []); +}; +dhtmlXSideBar.prototype.setSideWidth = function (a) { + this.conf.width = a; + this.setSizes(); +}; +dhtmlXSideBar.prototype._adjustSide = function () { + if (this.conf.side_ofs == null) { + this.conf.side_ofs = {}; + this.side.style.width = this.conf.width + "px"; + this.side.style.height = this.side.parentNode.offsetHeight + "px"; + this.conf.side_ofs.w = this.side.offsetWidth - parseInt(this.side.style.width); + this.conf.side_ofs.h = this.side.offsetHeight - parseInt(this.side.style.height); + } + this.side.style.width = this.conf.width - this.conf.side_ofs.w + "px"; + this.side.style.height = this.side.parentNode.offsetHeight - this.arw.offsetHeight - this.conf.side_ofs.h + "px"; + this.arw.style.width = this.side.style.width; + this._scrollSide(0); +}; +dhtmlXSideBar.prototype._checkHeight = function () { + var a = this.arw.className.match(/dhxsidebar_arrows_hidden/) != null; + if (this.conf.side_hfix == null) { + this.conf.side_hfix = this.side.offsetHeight - this.side.clientHeight; + } + if (this.side.firstChild.offsetHeight > this.side.parentNode.clientHeight - this.conf.side_hfix) { + if (a == true) { + this.arw.className = "dhxsidebar_arrows"; + this._adjustSide(); + } + } else { + if (a == false) { + this.arw.className = "dhxsidebar_arrows dhxsidebar_arrows_hidden"; + this.side.firstChild.style.top = "0px"; + this._adjustSide(); + } + } +}; +dhtmlXSideBar.prototype.removeSep = function (c) { + if (this.s[c] == null) { + return; + } + this.side.firstChild.removeChild(this.s[c].sep); + this.s[c].sep = null; + this.s[c] = null; + try { + delete this.s[c]; + } catch (a) {} +}; +dhtmlXSideBar.prototype.showSide = function () { + if (this.conf.autohide != true) { + return; + } + if (this.sideCover == null) { + this._sideCoverAttach(); + } + if (this.conf.animate_items == true) { + var e = function (j, a, l) { + window.setTimeout(function () { + j.style[l] = "transform 0.3s"; + j.style.transform = "translate(0px,0px)"; + j = null; + }, a); + }; + if (this.conf.transProp !== false) { + var h = 100; + for (var c in this.t) { + this.t[c].item.style[this.conf.transProp] = ""; + this.t[c].item.style.transform = "translate(-" + (this.conf.width + 20) + "px,0px)"; + e(this.t[c].item, (h += 50), this.conf.transProp); + } + } + } + var g = this; + window.setTimeout(function () { + g.arw.style.left = g.side.style.left = "0px"; + g.sideCover.className = "dhxsidebar_side_cover dhxsidebar_side_cover_actv"; + g = null; + }, 50); +}; +dhtmlXSideBar.prototype.hideSide = function (a) { + if (this.conf.autohide != true) { + return; + } + this.arw.style.left = this.side.style.left = -this.conf.width - 10 + "px"; + if (this.sideCover != null) { + if (this.conf.transProp !== false) { + this.sideCover.className = "dhxsidebar_side_cover"; + } else { + this._sideCoverDetach(); + } + } +}; +dhtmlXSideBar.prototype._sideCoverAttach = function () { + var a = this; + this.sideCover = document.createElement("DIV"); + this.sideCover.className = "dhxsidebar_side_cover"; + if (this.arw.nextSibling != null) { + this.cont.insertBefore(this.sideCover, this.arw.nextSibling); + } else { + this.cont.appendChild(this.sideCover); + } + this._sideCoverOnTrEnd = function () { + if (this.className.match(/dhxsidebar_side_cover_actv/) == null) { + a._sideCoverDetach(); + } + }; + this._sideCoverDetach = function () { + if (this.sideCover == null) { + return; + } + if (this.conf.transProp !== false) { + this.sideCover.removeEventListener(this.conf.transEv, this._sideCoverOnTrEnd, false); + } + this.sideCover.parentNode.removeChild(this.sideCover); + this.sideCover = null; + a = null; + }; + if (this.conf.transProp !== false) { + this.sideCover.addEventListener(this.conf.transEv, this._sideCoverOnTrEnd, false); + } +}; +dhtmlXSideBar.prototype._setItemActive = function (e, c) { + if (this.conf.selected == e) { + if (this.conf.autohide == true) { + this.hideSide(); + } + return; + } + if (typeof c == "undefined") { + c = false; + } + if (c == true && this.callEvent("onBeforeSelect", [e, this.conf.selected]) !== true) { + return; + } + var a = null; + if (this.conf.selected != null) { + a = this.conf.selected; + this._setItemInactive(this.conf.selected); + } + if (this.t[e] != null) { + this.conf.selected = e; + this.t[e].selected = true; + this.t[e].item.className += " dhxsidebar_item_selected"; + if (this.conf.single_cell != true) { + this.t[e].cell.cell.style.visibility = "visible"; + this.t[e].cell.cell.style.top = "0px"; + this.t[e].cell.cell.style.zIndex = 1; + } + } else { + this.conf.selected = null; + } + this._adjustCell(e); + if (c == true) { + this.callEvent("onSelect", [e, a]); + } + if (this.conf.autohide == true) { + this.hideSide(); + } +}; +dhtmlXSideBar.prototype._setItemInactive = function (a) { + if (this.t[a] == null) { + return; + } + this.t[a].selected = false; + this.t[a].item.className = this.t[a].item.className.replace(/\s{0,}dhxsidebar_item_selected/gi, ""); + if (this.conf.single_cell != true) { + this.t[a].cell.cell.style.visibility = "hidden"; + this.t[a].cell.cell.style.top = "-5000px"; + this.t[a].cell.cell.style.zIndex = 0; + } +}; +dhtmlXSideBar.prototype._isItemActive = function (a) { + return this.conf.selected == a; +}; +dhtmlXSideBar.prototype._getNextVisible = function (c, a) { + return this._getNearVisible(c, a, "next"); +}; +dhtmlXSideBar.prototype._getPrevVisible = function (c, a) { + return this._getNearVisible(c, a, "previous"); +}; +dhtmlXSideBar.prototype._getFirstVisible = function () { + return this._getNearVisible(null, false, "first"); +}; +dhtmlXSideBar.prototype._getNearVisible = function (j, c, h) { + if (h == "first") { + var e = this.side.firstChild.firstChild; + h = "next"; + } else { + if (j == null || this.t[j] == null) { + return c ? this._getFirstVisible() : null; + } + var e = this.t[j].item[h + "Sibling"]; + } + var g = null; + while (e != null && g == null) { + var a = e._idd; + if (a != null && g == null && this.t[a].conf.visible) { + g = a; + } else { + e = e[h + "Sibling"]; + } + } + e = null; + return g; +}; +dhtmlXSideBar.prototype.goToNextItem = function (a) { + var c = this._getNextVisible(this.conf.selected, true); + if (c != null) { + this._setItemActive(c, a); + } +}; +dhtmlXSideBar.prototype.goToPrevItem = function (a) { + var c = this._getPrevVisible(this.conf.selected, true); + if (c != null) { + this._setItemActive(c, a); + } +}; +dhtmlXSideBar.prototype.getActiveItem = function () { + return this.conf.selected; +}; +dhtmlXSideBar.prototype.setTemplate = function (g, c) { + this.conf.tpl_name = g != null && this.templates[g] != null ? g : "details"; + this.conf.tpl_str = this.templates[this.conf.tpl_name]; + if (c != null) { + this.conf.icons_path = c; + } + for (var e in this.t) { + this.t[e].init.icons_path = this.conf.icons_path; + this.t[e].item.innerHTML = window.dhx4.template(this.conf.tpl_str, this.t[e].init); + } + if (this.side != null) { + this.side.className = "dhxsidebar_side dhxsidebar_tpl_" + this.conf.tpl_name; + } + if (this._scrollSide != null) { + this._scrollSide(0); + this._checkHeight(); + } +}; +dhtmlXSideBar.prototype.templates = { + details: "
#text#
", + tiles: "
#text#
", + icons: "", + icons_text: "
#text#
", + text: "
#text#
", +}; +dhtmlXSideBar.prototype.tpl_bubble = "
#value#
"; +dhtmlXSideBar.prototype.tpl_header = "#text#"; +window.dhtmlXSideBarCell = function (h, g) { + dhtmlXCellObject.apply(this, [h, "_sidebar"]); + var e = this; + this.sidebar = g; + this.conf.skin = this.sidebar.conf.skin; + this.conf.sidebar_funcs = { + show: "_showItem", + hide: "_hideItem", + isVisible: "_isItemVisible", + setActive: "_setItemActive", + isActive: "_isItemActive", + setText: "_setItemText", + getText: "_getItemText", + remove: "_removeItem", + setBubble: "_setItemBubble", + getBubble: "_getItemBubble", + clearBubble: "_clearItemBubble", + }; + this._sidebarCall = function (a) { + return function () { + var j = [this._idd]; + for (var l = 0; l < arguments.length; l++) { + j.push(arguments[l]); + } + return this.sidebar[a].apply(this.sidebar, j); + }; + }; + for (var c in this.conf.sidebar_funcs) { + if (typeof this[c] != "function") { + this[c] = this._sidebarCall(this.conf.sidebar_funcs[c]); + } + } + if (this.sidebar.conf.header == true) { + this._initHeader(); + this.cell.childNodes[this.conf.idx.hdr].onclick = function (j) { + j = j || event; + var a = j.target || j.srcElement; + if (a.className.match(/dhx_cell_sidebar_hdr_icon/gi) != null) { + e.sidebar.conf.clear_click = true; + e.sidebar.showSide(); + } + a = null; + }; + } + this.attachEvent("_onCellUnload", function () { + if (this.conf.idx.hdr != null) { + this.cell.childNodes[this.conf.idx.hdr].onclick = null; + } + this.sidebar = null; + for (var j in this.conf.sidebar_funcs) { + this[j] = this.conf.sidebar_funcs[j] = null; + } + this.conf.sidebar_funcs = null; + e = null; + }); + this.attachEvent("_onContentLoaded", function () { + this.sidebar.callEvent("onContentLoaded", arguments); + }); + this.attachEvent("_onBeforeContentAttach", function (a) { + if (a == "tabbar" || a == "layout" || a == "acc") { + this._hideBorders(); + } + if (a == "sidebar" && this.conf.skin != "dhx_skyblue") { + this._hideBorders(); + } + if ((this.conf.skin == "dhx_web" || this.conf.skin == "dhx_terrace") && (a == "menu" || a == "toolbar" || a == "ribbon")) { + if (this.cell.className.match(/dhx_cell_cont_no_top/gi) == null) { + this.cell.className += " dhx_cell_cont_no_top"; + } + } + }); +}; +dhtmlXSideBarCell.prototype = new dhtmlXCellObject(); +dhtmlXSideBar.prototype._setItemText = function (g, e) { + if (this.t[g] != null) { + for (var c in e) { + this.t[g].init[c] = e[c]; + } + this.t[g].init.icons_path = this.conf.icons_path; + this.t[g].item.innerHTML = window.dhx4.template(this.conf.tpl_str, this.t[g].init); + if (this.t[g].conf.bubble != null) { + this.t[g].item.innerHTML += window.dhx4.template(this.tpl_bubble, { value: this.t[g].conf.bubble }); + } + if (this.conf.header == true) { + this.t[g].cell.setHeaderText(window.dhx4.template(this.tpl_header, this.t[g].init)); + } + } +}; +dhtmlXSideBar.prototype._getItemText = function (g) { + var e = {}; + if (this.t[g] != null) { + for (var c in this.t[g].init) { + e[c] = this.t[g].init[c]; + } + } + return e; +}; +dhtmlXSideBar.prototype._removeItem = function (n, m, j) { + if (this.t[n] == null) { + return; + } + if (j != true && this.t[n].conf.remove != true) { + this.t[n].conf.remove = true; + this._hideItem(n, m); + return; + } + if (typeof m == "undefined") { + m = true; + } + var g = this._getNextVisible(n); + var h = this._getPrevVisible(n); + if (this.t[n].conf.transEv == true) { + this.t[n].item.removeEventListener(this.conf.transEv, this._doOnTrEnd); + this.t[n].conf.transEv = false; + } + if (this.conf.single_cell != true) { + this.t[n].cell._unload(); + this.t[n].cell = null; + } + this.t[n].item.ondragstart = null; + this.t[n].item.parentNode.removeChild(this.t[n].item); + this.t[n].item = null; + for (var c in this.t[n]) { + this.t[n][c] = null; + } + this.t[n] = null; + try { + delete this.t[n]; + } catch (l) {} + if (this.conf.selected == n && m != false) { + this.conf.selected = null; + var m = m == true ? g || h || this._getFirstVisible() : m; + if (m != null) { + this._setItemActive(m); + } + } else { + if (j != true) { + this._checkHeight(); + } + } +}; +dhtmlXSideBar.prototype._showItem = function (c, a) { + if (this.t[c] == null || this.t[c].conf.visible == true || this.t[c].conf.transActv == true) { + return; + } + if (this.conf.transProp !== false) { + this.t[c].conf.transActv = true; + this.t[c].conf.transMode = "show"; + this.t[c].conf.transProp = this.conf.transProp; + this.t[c].conf.transActvId = a ? c : null; + if (this.t[c].conf.transEv != true) { + this.t[c].item.addEventListener(this.conf.transEv, this._doOnTrEnd); + this.t[c].conf.transEv = true; + } + this.t[c].conf.visible = true; + this.t[c].item.style[this.conf.transProp] = this.conf.transValue; + this.t[c].item.className = "dhxsidebar_item"; + } else { + this.t[c].conf.visible = true; + this.t[c].item.style.display = ""; + if (a == true) { + this._setItemActive(c); + } else { + this._checkHeight(); + } + } +}; +dhtmlXSideBar.prototype._hideItem = function (h, g) { + if (this.t[h] == null || this.t[h].conf.visible != true || this.t[h].conf.transActv == true) { + return; + } + var e = false; + if (this.conf.selected == h) { + this.conf.selected = null; + this.t[h].conf.active = false; + this.t[h].item.className = "dhxsidebar_item"; + e = true; + } + var c = this._getPrevVisible(h); + var a = this._getNextVisible(h); + var g = e && g !== false ? (g == true ? null : g) || a || c : null; + if (this.conf.transProp !== false) { + this.t[h].conf.transActv = true; + this.t[h].conf.transMode = "hide"; + this.t[h].conf.transProp = this.conf.transProp; + this.t[h].conf.transActvId = g; + this.t[h].conf.visible = false; + if (this.t[h].conf.transEv != true) { + this.t[h].item.addEventListener(this.conf.transEv, this._doOnTrEnd); + this.t[h].conf.transEv = true; + } + this.t[h].item.style[this.conf.transProp] = this.conf.transValue; + this.t[h].item.className = "dhxsidebar_item dhxsidebar_item_hidden"; + } else { + this.t[h].item.style.display = "none"; + this.t[h].conf.visible = false; + if (this.conf.single_cell != true) { + this.t[h].cell.cell.style.visibility = "hidden"; + this.t[h].cell.cell.style.top = "-5000px"; + } + if (g != null) { + this._setItemActive(g); + } + this._checkHeight(); + if (this.t[h].conf.remove == true) { + this._removeItem(h); + } + } +}; +dhtmlXSideBar.prototype._isItemVisible = function (a) { + return this.t[a].conf.visible == true; +}; +dhtmlXSideBar.prototype._setItemBubble = function (c, a) { + if (this.t[c] == null) { + return; + } + this.t[c].item.innerHTML = window.dhx4.template(this.conf.tpl_str, this.t[c].init) + window.dhx4.template(this.tpl_bubble, { value: String(a) }); + this.t[c].conf.bubble = a; +}; +dhtmlXSideBar.prototype._getItemBubble = function (a) { + if (this.t[a] == null) { + return null; + } + return typeof this.t[a].conf.bubble == "undefuned" ? null : this.t[a].conf.bubble; +}; +dhtmlXSideBar.prototype._clearItemBubble = function (a) { + if (this.t[a] == null) { + return; + } + this.t[a].item.innerHTML = window.dhx4.template(this.conf.tpl_str, this.t[a].init); + this.t[a].conf.bubble = null; +}; +dhtmlXCellObject.prototype.attachSidebar = function (a) { + this.callEvent("_onBeforeContentAttach", ["sidebar"]); + if (a == null) { + a = {}; + } + var c = document.createElement("DIV"); + c.style.width = "100%"; + c.style.height = "100%"; + c.style.position = "relative"; + c.style.overflow = "hidden"; + if (typeof window.dhtmlXWindowsCell != "undefined" && this instanceof window.dhtmlXWindowsCell) { + } else { + if (this.conf.skin == "dhx_skyblue") { + c._ofs = { t: -1, r: -1, b: -1, l: -1 }; + } + if (this.conf.skin == "dhx_web") { + if (typeof window.dhtmlXSideBarCell != "undefined" && this instanceof window.dhtmlXSideBarCell) { + c._ofs = { l: 8 }; + } + if (typeof window.dhtmlXLayoutCell != "undefined" && this instanceof window.dhtmlXLayoutCell) { + c._ofs = { t: 2 }; + } + if (typeof window.dhtmlXTabBarCell != "undefined" && this instanceof window.dhtmlXTabBarCell) { + c._ofs = { t: 8 }; + } + if (typeof window.dhtmlXAccordionCell != "undefined" && this instanceof window.dhtmlXAccordionCell) { + c._ofs = { t: 2 }; + } + } + if (this.conf.skin == "dhx_terrace") { + if (typeof window.dhtmlXSideBarCell != "undefined" && this instanceof window.dhtmlXSideBarCell) { + c._ofs = { l: -1 }; + } + if (typeof window.dhtmlXLayoutCell != "undefined" && this instanceof window.dhtmlXLayoutCell) { + c._ofs = { t: -1 }; + } + if (typeof window.dhtmlXTabBarCell != "undefined" && this instanceof window.dhtmlXTabBarCell) { + c._ofs = { t: -1 }; + } + if (typeof window.dhtmlXAccordionCell != "undefined" && this instanceof window.dhtmlXAccordionCell) { + c._ofs = { t: -1, r: -1, b: -1, l: -1 }; + } + } + } + this._attachObject(c); + a.skin = this.conf.skin; + a.parent = c; + this.dataType = "sidebar"; + this.dataObj = new dhtmlXSideBar(a); + a.parent = c = null; + a = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; +}; +dhtmlXSideBarCell.prototype._initHeader = function () { + var a = document.createElement("DIV"); + a.className = "dhx_cell_sidebar_hdr"; + a.innerHTML = + (this.sidebar.conf.autohide == true ? "
" : "") + "
"; + this.cell.insertBefore(a, this.cell.childNodes[this.conf.idx.cont]); + a = null; + this.conf.ofs_nodes.t._getHdrHeight = "func"; + this.conf.hdr = { visible: true }; + this.conf.idx_data.hdr = "dhx_cell_sidebar_hdr"; + this._updateIdx(); +}; +dhtmlXSideBarCell.prototype._getHdrHeight = function () { + return this.cell.childNodes[this.conf.idx.hdr].offsetHeight; +}; +dhtmlXSideBarCell.prototype.showHeader = function () { + if (this.conf.hdr.visible == true) { + return; + } + this.conf.hdr.visible = true; + this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_sidebar_hdr"; + this._adjustCont(this._idd); +}; +dhtmlXSideBarCell.prototype.hideHeader = function () { + if (this.conf.hdr.visible != true) { + return; + } + this.conf.hdr.visible = false; + this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_sidebar_hdr dhx_cell_sidebar_hdr_hidden"; + this._adjustCont(this._idd); +}; +dhtmlXSideBarCell.prototype.isHeaderVisible = function () { + return this.conf.hdr.visible == true; +}; +dhtmlXSideBarCell.prototype.setHeaderText = function (c) { + this.conf.text = c; + var a = this.cell.childNodes[this.conf.idx.hdr]; + a.childNodes[a.firstChild.className == "dhx_cell_sidebar_hdr_icon" ? 1 : 0].innerHTML = "" + c + ""; + a = null; +}; +dhtmlXSideBarCell.prototype.getHeaderText = function () { + return this.conf.text; +}; +function dhtmlXCarousel(g, j, m) { + if (typeof g == "string" || (typeof g == "object" && typeof g.tagName != "undefined")) { + g = { parent: typeof g == "string" ? document.getElementById(g) : g, effect: j, skin: m, delete_conf: true }; + } else { + if (typeof g == "undefined" || g == null) { + g = {}; + } + } + this.conf = { + skin: g.skin || window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxcarousel") || "dhx_skyblue", + css: "dhxcarousel", + items_count: 0, + selected: -1, + item_width: Number(g.item_width) || "auto", + item_height: Number(g.item_height) || "auto", + ofs_item: Number(g.offset_item) || 1, + ofs_left: Number(g.offset_left) || 0, + ofs_top: Number(g.offset_top) || 0, + buttons: typeof g.buttons == "undefined" ? true : window.dhx4.s2b(g.buttons), + drops: false, + keys: typeof g.keys == "undefined" ? true : window.dhx4.s2b(g.keys), + key_data: { left: 37, right: 39 }, + touch_scroll: typeof g.touch_scroll != "undefined" ? window.dhx4.s2b(g.touch_scroll) : true, + arw: ["◄", "►"], + }; + this.conf.autowidth = this.conf.item_width == "auto"; + this.conf.autoheight = this.conf.item_height == "auto"; + var e = window.dhx4.transDetect(); + this.conf.transProp = e.transProp; + this.conf.transEv = e.transEv; + this.conf.anim_type = g.effect || "slide"; + if (this.ef[this.conf.anim_type] == true) { + var h = this["_" + this.conf.anim_type + "_init"](); + if (h === false) { + this.conf.anim_type = "slide"; + h = this["_" + this.conf.anim_type + "_init"](); + } + if (typeof h == "object") { + for (var c in h) { + if (typeof this.conf[c] == "undefined") { + this.conf[c] = h[c]; + } + } + } + } + this.conf.anim_f = this["_" + this.conf.anim_type + "_f"](); + var l = this; + window.dhtmlXCellTop.apply(this, [g.parent, g.offsets]); + this.area = document.createElement("DIV"); + this.area.className = "dhxcarousel_area"; + this.cont.appendChild(this.area); + if (typeof window.addEventListener == "function" && l.conf.touch_scroll == true) { + this._doOnTouchStart = function (a) { + if (window.dhx4.dnd._mTouch(a) == true) { + return; + } + if (l.conf.animating == true) { + return; + } + if (a.preventDefault) { + a.preventDefault(); + } + l.area.className += " dhxcarousel_area_dnd"; + l.conf.touch_conf = { t: new Date().getTime(), dx: null, dy: null }; + if (a.type.match(/^touch/) != null) { + l.conf.touch_conf.id = a.touches[0].identifier; + l.conf.touch_conf.x = a.touches[0].clientX; + l.conf.touch_conf.y = a.touches[0].clientY; + } else { + l.area.style.touchAction = l.area.style.msTouchAction = "none"; + l.conf.touch_conf.x = a.clientX; + l.conf.touch_conf.y = a.clientY; + } + window.addEventListener(window.dhx4.dnd.evs.move, l._doOnTouchMove, false); + window.addEventListener(window.dhx4.dnd.evs.end, l._doOnTouchEnd, false); + }; + this._doOnTouchMove = function (a) {}; + this._doOnTouchEnd = function (r) { + if (r.type.match(/^touch/) != null) { + var n = 0; + for (var o = 0; o < r.changedTouches.length; o++) { + if (r.changedTouches[o].identifier == l.conf.touch_conf.id) { + n = l.conf.touch_conf.x - r.changedTouches[o].clientX; + } + } + } else { + var n = l.conf.touch_conf.x - r.clientX; + } + window.removeEventListener(window.dhx4.dnd.evs.move, l._doOnTouchMove, false); + window.removeEventListener(window.dhx4.dnd.evs.end, l._doOnTouchEnd, false); + l.area.className = l.area.className.replace(/\s*dhxcarousel_area_dnd$/, ""); + if (n == 0 || new Date().getTime() - l.conf.touch_conf.t > 400) { + return; + } + var a = n / Math.abs(n); + l._animateStart(a); + }; + this.area.addEventListener(window.dhx4.dnd.evs.start, this._doOnTouchStart, false); + } + this.cdata = {}; + this.ind = {}; + this.addCell = function (s, r) { + this.conf.items_count++; + if (this.conf.selected == -1) { + this.conf.selected = 0; + } + this.setSizes(); + this._checkControls(); + if (typeof r == "undefined" || r == null) { + r = this.conf.items_count - 1; + } else { + if (r < 0) { + r = 0; + } else { + if (r > this.conf.items_count - 1) { + r = this.conf.items_count - 1; + } + } + } + for (var o in this.cdata) { + if (this.cdata[o].index >= r) { + this.cdata[o].index++; + this.ind[this.cdata[o].index] = o; + this._adjustCell(o); + } + } + if (s == null) { + s = String(window.dhx4.newId()); + } + while (this.cdata[s] != null) { + s = String(window.dhx4.newId()); + } + var n = new dhtmlXCarouselCell(s, this); + if (this.area.childNodes[r] != null) { + this.area.insertBefore(n.cell, this.area.childNodes[r]); + } else { + this.area.appendChild(n.cell); + } + this.cdata[s] = { index: r, cell: n }; + this.ind[r] = s; + this._adjustCell(s); + this._addBar(); + this._setBarIndex(this.conf.selected); + n = null; + this[this.conf.anim_f.cell_added](s); + return s; + }; + this._removeCell = function (u) { + var r = this.cdata[u].index; + this.cdata[u].cell._unload(); + this.cdata[u].index = this.cdata[u].cell = null; + this.cdata[u] = null; + delete this.cdata[u]; + delete this.ind[r]; + this.conf.items_count--; + if (this.conf.unloading == true) { + return; + } + this.ind = {}; + var n = 0; + for (var o in this.cdata) { + if (this.cdata[o].index > r) { + this.cdata[o].index--; + } + this.ind[this.cdata[o].index] = o; + } + var s = false; + if (this.conf.selected > r) { + this.conf.selected--; + } else { + if (this.conf.selected == r) { + this.conf.selected = Math.min(this.conf.selected, this.conf.items_count - 1); + s = true; + } else { + } + } + this._removeBar(false); + this._setBarIndex(this.conf.selected); + if (s == true) { + if (this.conf.selected >= 0) { + this[this.conf.anim_f.update_selected](this.ind[this.conf.selected]); + } + } + this.setSizes(); + this._checkControls(); + }; + this.setSizes = function () { + this._adjustCont(); + var u = {}; + this.area.style.height = this.cont.offsetHeight - this.controls.offsetHeight + "px"; + this.conf.width = this.conf.autowidth ? this.cont.offsetWidth - this.conf.ofs_left * 2 : this.conf.item_width; + this.conf.height = this.conf.autoheight ? this.area.offsetHeight - this.conf.ofs_top * 2 : this.conf.item_height; + this.conf.top = Math.max(0, this.conf.autoheight ? this.conf.ofs_top : Math.floor((this.area.offsetHeight - this.conf.height) / 2)); + this.area.style.width = this[this.conf.anim_f.detect_aw]() * (this.conf.width + this.conf.ofs_item) + this.conf.ofs_item + "px"; + this.area.style.left = Math.round(this.cont.offsetWidth / 2 - this.conf.width / 2 - this.conf.ofs_item) + "px"; + for (var o in this.cdata) { + var r = {}; + for (var n in this.cdata[o].cell.conf.size) { + r[n] = this.cdata[o].cell.conf.size[n]; + } + if (this.conf.autowidth == true) { + r.w = this.conf.width; + r.x = this[this.conf.anim_f.detect_x](o); + } + if (this.conf.autoheight == true) { + r.h = this.conf.height; + } + u[o] = r; + } + this.area.style.left = Math.round(this.cont.offsetWidth / 2 - this.conf.width / 2 - this.conf.ofs_item) - (this.conf.width + this.conf.ofs_item) * this.conf.selected + "px"; + this._adjustControls(); + if (this.conf.autoheight != true) { + this.conf.top = Math.max(0, Math.floor(this.area.offsetHeight - this.conf.height) / 2); + for (var o in u) { + u[o].y = this.conf.top; + } + } + for (var o in u) { + this.cdata[o].cell._setSize(u[o].x, u[o].y, u[o].w, u[o].h); + } + this.callEvent("_onSetSizes", []); + }; + this._adjustCell = function (a) { + this.cdata[a].cell._setSize(this[this.conf.anim_f.detect_x](a), this.conf.top, this.conf.width, this.conf.height); + }; + this._animateStart = function (n, a) { + if ((this.conf.selected <= 0 && n < 0) || (this.conf.selected >= this.conf.items_count - 1 && n > 0)) { + return; + } + if (this.conf.animating == true) { + return; + } + this.conf.animating = true; + this[this.conf.anim_f.prepare](n, a); + }; + this._animateTransEnd = function (a) { + l[l.conf.anim_f.end](a || event, this); + }; + this._animateEnd = function (a) { + this.conf.selected = this.conf.selected + a; + this._checkControls(); + this._setBarIndex(this.conf.selected); + this.callEvent("onSelect", [this.ind[this.conf.selected]]); + this.conf.animating = false; + }; + this._initControls(); + this.setCellSize = function (a, n) { + this.conf.item_width = a == null ? "auto" : a; + this.conf.item_height = n == null ? "auto" : n; + this.setSizes(); + }; + this.setOffset = function (o, n, a) { + if (o != null) { + this.conf.ofs_left = o; + } + if (n != null) { + this.conf.ofs_top = n; + } + if (a != null) { + this.conf.ofs_item = a; + } + this.setSizes(); + }; + this.enableHotKeys = function (a) { + this.conf.keys = window.dhx4.s2b(a); + }; + this.goFirst = function () { + if (this.conf.selected == 0) { + return; + } + this._animateStart(-this.conf.selected); + }; + this.goLast = function () { + if (this.conf.selected == this.conf.items_count - 1) { + return; + } + this._animateStart(this.conf.items_count - 1 - this.conf.selected); + }; + this.goNext = function () { + this._animateStart(1); + }; + this.goPrev = function () { + this._animateStart(-1); + }; + this.getActiveIndex = function () { + return this.conf.selected; + }; + this.getActiveId = function () { + return this.ind[this.conf.selected]; + }; + this.getActiveCell = function () { + var a = this.getActiveId(); + if (a != null) { + return this.cdata[a].cell; + } + return null; + }; + this.unload = function () { + this.conf.unloading = true; + if (typeof window.addEventListener == "function") { + window.removeEventListener("keydown", this._doOnWinKeyDown, false); + if (this._doOnTouchStart != null) { + this.area.removeEventListener(window.dhx4.dnd.evs.start, this._doOnTouchStart, false); + } + } else { + document.body.detachEvent("onkeydown", this._doOnWinKeyDown); + } + for (var n in this.cdata) { + this._removeCell(n); + } + this.cdata[n] = null; + this.area.parentNode.removeChild(this.area); + this.area = null; + this._unloadControls(); + this._unloadTop(); + window.dhx4._eventable(this, "clear"); + for (var n in this) { + this[n] = null; + } + l = null; + }; + window.dhx4._eventable(this); + this._callMainEvent = function (n, a) { + this.callEvent(n, a); + }; + this.conf.ev_coverclick = this.attachEvent("_cellCoverClick", function (a) { + var n = a - this.conf.selected; + if (Math.abs(n) == 1) { + this._animateStart(n); + } + }); + this._doOnWinKeyDown = function (o) { + o = o || event; + if (l.conf.keys == true) { + if (o.ctrlKey == true && o.shiftKey != true && o.altKey != true) { + var n = o.keyCode; + var a = l.conf.key_data; + if (n == a.left || n == a.right) { + if (o.preventDefault) { + o.preventDefault(); + } else { + o.returnValue = false; + } + l._animateStart(n == a.left ? -1 : 1); + } + } + } + }; + if (typeof window.addEventListener == "function") { + window.addEventListener("keydown", this._doOnWinKeyDown, false); + } else { + document.body.attachEvent("onkeydown", this._doOnWinKeyDown); + } + if (g.delete_conf == true) { + for (var c in g) { + g[c] = null; + } + g = null; + } + return this; +} +dhtmlXCarousel.prototype = new dhtmlXCellTop(); +dhtmlXCarousel.prototype.ef = {}; +dhtmlXCarousel.prototype.cells = function (a) { + return this.cdata[a].cell; +}; +dhtmlXCarousel.prototype.forEachCell = function (e) { + for (var c in this.cdata) { + if (typeof e == "function") { + e.apply(window, [this.cdata[c].cell]); + } else { + if (typeof e == "string" && typeof window[e] == "function") { + window[e].apply(window, [this.cdata[c].cell]); + } + } + } +}; +dhtmlXCarousel.prototype._initControls = function () { + var a = this; + this.controls = document.createElement("DIV"); + this.controls.className = "dhx_carousel_controls"; + this.controls.innerHTML = ""; + this.cont.appendChild(this.controls); + this._doOnControlClick = function (j) { + if (a.conf.clear_click == true) { + a.conf.clear_click = false; + return; + } + j = j || event; + if (window.dhx4.dnd.evs.start != null && j.type != "click" && a.conf.clear_click != true) { + if (window.dhx4.dnd._mTouch(j) == true) { + return; + } + a.conf.clear_click = true; + } + var c = j.target || j.srcElement; + var h = null; + if (c.className != null) { + if (c.className.match(/btn_prev/) != null) { + h = -1; + } else { + if (c.className.match(/btn_next/) != null) { + h = 1; + } else { + if (c.className.match(/dhx_carousel_onebar/) != null && c.className.match(/dhx_carousel_baractv/) == null) { + for (var g = 0; g < c.parentNode.childNodes.length; g++) { + if (c.parentNode.childNodes[g] == c) { + h = g - a.conf.selected; + } + } + } + } + } + } + if (h != null) { + a._animateStart(h); + } + c = null; + }; + if (typeof window.addEventListener == "function") { + this.controls.addEventListener("click", this._doOnControlClick, false); + if (window.dhx4.dnd.evs.start != null) { + this.controls.addEventListener(window.dhx4.dnd.evs.start, this._doOnControlClick, false); + } + } else { + this.controls.attachEvent("onclick", this._doOnControlClick); + if (window.dhx4.isIE6 || window.dhx4.isIE7 || window.dhx4.isIE8) { + this.controls.onselectstart = function (c) { + c = c || event; + if (c.preventDefault) { + c.preventDefault(); + } + c.returnValue = false; + return false; + }; + } + } + this.showControls = function () { + this.controls.style.display = ""; + this.setSizes(); + }; + this.hideControls = function () { + this.controls.style.display = "none"; + this.setSizes(); + }; + this._checkControls = function () { + this.controls.childNodes[1].className = "dhx_carousel_btn dhx_carousel_btn_prev" + (this.conf.selected <= 0 ? "_dis" : ""); + this.controls.childNodes[2].className = "dhx_carousel_btn dhx_carousel_btn_next" + (this.conf.selected >= this.conf.items_count - 1 || this.conf.items_count == 0 ? "_dis" : ""); + }; + this._adjustControls = function () { + this.controls.firstChild.style.left = Math.round(this.cont.offsetWidth / 2 - this.controls.firstChild.offsetWidth / 2) + "px"; + }; + this._addBar = function () { + var c = document.createElement("DIV"); + c.className = "dhx_carousel_onebar"; + c.innerHTML = ""; + this.controls.firstChild.appendChild(c); + c = null; + this._adjustControls(); + }; + this._removeBar = function (e) { + var c = this.controls.firstChild.lastChild; + if (c != null) { + c.parentNode.removeChild(c); + c = null; + if (e !== false) { + this._adjustControls(); + } + } + }; + this._setBarIndex = function (c) { + for (var e = 0; e < this.controls.firstChild.childNodes.length; e++) { + this.controls.firstChild.childNodes[e].className = "dhx_carousel_onebar" + (e == c ? " dhx_carousel_baractv" : ""); + } + }; + this._unloadControls = function () { + if (typeof window.addEventListener == "function") { + this.controls.removeEventListener("click", this._doOnControlClick, false); + if (window.dhx4.dnd.evs.start != null) { + this.controls.removeEventListener(window.dhx4.dnd.evs.start, this._doOnControlClick, false); + } + } else { + this.controls.detachEvent("onclick", this._doOnControlClick); + if (window.dhx4.isIE6 || window.dhx4.isIE7 || window.dhx4.isIE8) { + this.controls.onselectstart = null; + } + } + while (this.controls.firstChild.childNodes.length > 0) { + this._removeBar(false); + } + this.cont.removeChild(this.controls); + this.controls = null; + a = null; + }; + if (this.conf.buttons != true) { + this.hideControls(); + } + this._checkControls(); +}; +window.dhtmlXCarouselCell = function (e, c) { + dhtmlXCellObject.apply(this, [e, "_carousel"]); + var a = this; + this.carousel = c; + this.conf.skin = this.carousel.conf.skin; + this.attachEvent("_onCellUnload", function () { + this.carousel = null; + a = null; + }); + this.attachEvent("_onContentLoaded", function () { + this.carousel._callMainEvent("onContentLoaded", [this._idd]); + }); + this._showCover = function () { + if (this.conf.cover == true) { + return; + } + this._showCellCover(); + var g = this.cell.childNodes[this.conf.idx.cover]; + g.onclick = function () { + a.carousel._callMainEvent("_cellCoverClick", [a._idd]); + }; + g = null; + }; + this._hideCover = function () { + if (this.conf.cover != true) { + return; + } + this.cell.childNodes[this.conf.idx.cover].onclick = null; + this._hideCellCover(); + }; + return this; +}; +dhtmlXCarouselCell.prototype = new dhtmlXCellObject(); +dhtmlXCarouselCell.prototype.getId = function () { + return this._idd; +}; +dhtmlXCarouselCell.prototype.getIndex = function () { + return this.carousel.cdata[this._idd].index; +}; +dhtmlXCarouselCell.prototype.setActive = function () { + var a = this.getIndex() - this.carousel.conf.selected; + if (a != 0) { + this.carousel._animateStart(a); + } +}; +dhtmlXCarouselCell.prototype.remove = function () { + this.carousel._removeCell(this._idd); +}; +dhtmlXCellObject.prototype.attachCarousel = function (a) { + this.callEvent("_onBeforeContentAttach", ["carousel"]); + var c = document.createElement("DIV"); + c.style.width = "100%"; + c.style.height = "100%"; + c.style.position = "relative"; + c.style.overflow = "hidden"; + this._attachObject(c); + if (typeof window.dhtmlXSideBarCell != "undefined" && this instanceof window.dhtmlXSideBarCell) { + if (this.conf.skin == "dhx_terrace") { + c._ofs = { t: -1, r: -1, b: -1, l: -1 }; + } + } + if (typeof a == "undefined" || a == null) { + a = {}; + } + if (typeof a.skin == "undefined") { + a.skin = this.conf.skin; + } + a.parent = c; + this.dataType = "carousel"; + this.dataObj = new dhtmlXCarousel(a); + a.parent = null; + c = a = null; + this.callEvent("_onContentAttach", []); + return this.dataObj; +}; +dhtmlXCarousel.prototype.ef.slide = true; +dhtmlXCarousel.prototype.ef.slide_conf = { anim_step: 25, anim_timeout: 10, anim_slide: "left 0.3s" }; +dhtmlXCarousel.prototype.ef.slide_f = { + prepare: "_slide_prepare", + start: "_slide_start", + end: "_slide_end", + update_selected: "_slide_update_selected", + detect_x: "_slide_detect_x", + detect_aw: "_slide_detect_area_width", + cell_added: "_slide_cell_added", +}; +dhtmlXCarousel.prototype._slide_init = function () { + return this.ef.slide_conf; +}; +dhtmlXCarousel.prototype._slide_f = function () { + return this.ef.slide_f; +}; +dhtmlXCarousel.prototype._slide_prepare = function (c, a) { + var g = this.conf.anim_step; + var h = this.conf.width + this.conf.ofs_item; + if (a == false) { + g = h + 1; + } + this.area._init = parseInt(this.area.style.left); + var e = this.ind[this.conf.selected + c]; + this._slide_update_selected(e); + if (this.conf.transProp !== false && a != false) { + if (this.conf.transEvInit != true) { + this.area.addEventListener(this.conf.transEv, this._animateTransEnd, false); + this.conf.transEvInit = true; + } + this.conf.current_dir = c; + this.area.style[this.conf.transProp] = this.conf.anim_slide; + this.area.style.left = this.area._init + h * -c + "px"; + } else { + this._slide_start(g, 0, h, c); + } +}; +dhtmlXCarousel.prototype._slide_start = function (h, a, j, c) { + var g = false; + a += h; + if (a >= j) { + a = j; + g = true; + } + this.area.style.left = this.area._init + a * -c + "px"; + if (g != true) { + var e = this; + window.setTimeout(function () { + e._slide_start(h, a, j, c); + e = null; + }, this.conf.anim_timeout); + } else { + this.cdata[this.ind[this.conf.selected]].cell._showCover(); + this._animateEnd(c); + } +}; +dhtmlXCarousel.prototype._slide_end = function (c, a) { + if (c.type == this.conf.transEv && a == this.area) { + this.area.style[this.conf.transProp] = ""; + if (this.conf.transEvInit == true) { + this.area.removeEventListener(this.conf.transEv, this._animateTransEnd, false); + this.conf.transEvInit = false; + } + this.cdata[this.ind[this.conf.selected]].cell._showCover(); + this._animateEnd(this.conf.current_dir); + } +}; +dhtmlXCarousel.prototype._slide_update_selected = function (a) { + this.cdata[a].cell._hideCover(); +}; +dhtmlXCarousel.prototype._slide_detect_x = function (e) { + var c = this.cdata[e].index; + var a = c * (this.conf.width + this.conf.ofs_item) + this.conf.ofs_item; + return a; +}; +dhtmlXCarousel.prototype._slide_cell_added = function (a) { + if (this.conf.selected != this.cdata[a].index) { + this.cdata[a].cell._showCover(); + } + if (this.cdata[a].index <= this.conf.selected && this.conf.items_count > 1) { + this._animateStart(1, false); + } +}; +dhtmlXCarousel.prototype._slide_detect_area_width = function () { + return this.conf.items_count; +}; +dhtmlXCarousel.prototype.ef.flip = true; +dhtmlXCarousel.prototype.ef.flip_conf = { anim_flip: "transform 0.3s ease-out", anim_flip_ang: -87, anim_flip_trstyle: "transform" }; +dhtmlXCarousel.prototype.ef.flip_f = { + prepare: "_flip_prepare", + start: "_flip_start", + end: "_flip_end", + update_selected: "_flip_update_selected", + detect_x: "_flip_detect_x", + detect_aw: "_flip_detect_area_width", + cell_added: "_flip_cell_added", +}; +dhtmlXCarousel.prototype._flip_init = function () { + var a = this.conf.transProp == false ? false : this.ef.flip_conf; + if (a !== false && window.dhx4.isKHTML == true && a.anim_flip.match("webkit") == null) { + a.anim_flip = a.anim_flip.replace(/transform/, "-webkit-transform"); + a.anim_flip_trstyle = "webkitTransform"; + } + return a; +}; +dhtmlXCarousel.prototype._flip_f = function () { + return this.ef.flip_f; +}; +dhtmlXCarousel.prototype._flip_prepare = function (a) { + this.conf.flip_data = { fromIndex: this.conf.selected, toIndex: this.conf.selected + a, mode: 0, dir: a }; + this._flip_start(); +}; +dhtmlXCarousel.prototype._flip_start = function () { + var a = this.cdata[this.ind[this.conf.flip_data.mode == 0 ? this.conf.flip_data.fromIndex : this.conf.flip_data.toIndex]].cell; + if (this.area.className.match(/dhxcarousel_area_flip/) == null) { + this.area.className += " dhxcarousel_area_flip"; + } + if (a.conf.tr_ev != true) { + a.cell.addEventListener(this.conf.transEv, this._animateTransEnd, false); + a.conf.tr_ev = true; + } + if (this.conf.flip_data.mode == 0) { + a.cell.style[this.conf.anim_flip_trstyle] = "rotateY(" + String(this.conf.flip_data.dir > 0 ? this.conf.anim_flip_ang : -this.conf.anim_flip_ang) + "deg)"; + } else { + a.cell.style.visibility = "visible"; + a.cell.style[this.conf.anim_flip_trstyle] = "rotateY(0deg)"; + } + a.cell.style[this.conf.transProp] = this.conf.anim_flip; + a = null; +}; +dhtmlXCarousel.prototype._flip_end = function (m, l) { + if (m.type == this.conf.transEv) { + var a = this.cdata[this.ind[this.conf.flip_data.mode == 0 ? this.conf.flip_data.fromIndex : this.conf.flip_data.toIndex]].cell; + if (l == a.cell) { + a.cell.removeEventListener(this.conf.transEv, this._animateTransEnd, false); + a.conf.tr_ev = false; + if (this.conf.flip_data.mode == 0) { + a.cell.style[this.conf.transProp] = ""; + a.cell.style.visibility = "hidden"; + this.conf.flip_data.mode = 1; + this._flip_start(); + } else { + var g = this.conf.flip_data.dir; + var h = Math.min(this.conf.flip_data.fromIndex, this.conf.flip_data.toIndex) + 1; + var c = Math.max(this.conf.flip_data.fromIndex, this.conf.flip_data.toIndex) - 1; + for (var j = h; j <= c; j++) { + this.cdata[this.ind[j]].cell.cell.style[this.conf.anim_flip_trstyle] = "rotateY(" + String((this.conf.anim_flip_ang * g) / Math.abs(g)) + "deg)"; + } + if (this.area.className.match(/dhxcarousel_area_flip/) != null) { + this.area.className = String(this.area.className).replace(/\s{0,}dhxcarousel_area_flip/gi, ""); + } + this.conf.flip_data = null; + a.cell.style[this.conf.transProp] = ""; + this._animateEnd(g); + } + } + a = null; + } +}; +dhtmlXCarousel.prototype._flip_update_selected = function (a) {}; +dhtmlXCarousel.prototype._flip_detect_x = function (e) { + var c = 0; + var a = c * (this.conf.width + this.conf.ofs_item) + this.conf.ofs_item; + return a; +}; +dhtmlXCarousel.prototype._flip_cell_added = function (a) { + if (this.conf.selected != this.cdata[a].index) { + this.cdata[a].cell.cell.style[this.conf.anim_flip_trstyle] = "rotateY(" + String(this.cdata[a].index < this.conf.selected ? this.conf.anim_flip_ang : -this.conf.anim_flip_ang) + "deg)"; + this.cdata[a].cell.cell.style.visibility = "hidden"; + } else { + this.cdata[a].cell.cell.style[this.conf.anim_flip_trstyle] = "rotateY(0deg)"; + } +}; +dhtmlXCarousel.prototype._flip_detect_area_width = function () { + return 1; +}; +dhtmlXCarousel.prototype.ef.cards = true; +dhtmlXCarousel.prototype.ef.cards_conf = { anim_cards: "left 0.3s" }; +dhtmlXCarousel.prototype.ef.cards_f = { + prepare: "_cards_prepare", + start: "_cards_start", + end: "_cards_end", + update_selected: "_cards_update_selected", + detect_x: "_cards_detect_x", + detect_aw: "_cards_detect_area_width", + cell_added: "_cards_cell_added", +}; +dhtmlXCarousel.prototype._cards_init = function () { + return this.conf.transProp == false ? false : this.ef.cards_conf; +}; +dhtmlXCarousel.prototype._cards_f = function () { + return this.ef.cards_f; +}; +dhtmlXCarousel.prototype._cards_prepare = function (e, c) { + if (e > 0) { + var g = this.ind[this.conf.selected + e]; + var a = this.cdata[g].cell; + this._cards_update_selected(g); + if (a.conf.transEvInit != true) { + a.cell.addEventListener(this.conf.transEv, this._animateTransEnd, false); + a.conf.transEvInit = true; + } + this.conf.current_id = g; + this.conf.current_dir = e; + a.cell.style[this.conf.transProp] = this.conf.anim_cards; + a.cell.style.left = this._cards_detect_x(g, 0) + "px"; + a = null; + } else { + this._cards_adjust_middle(this.conf.selected + e + 1, this.conf.selected - 1, 1); + var g = this.ind[this.conf.selected]; + var a = this.cdata[g].cell; + a._hideCover(); + if (a.conf.transEvInit != true) { + a.cell.addEventListener(this.conf.transEv, this._animateTransEnd, false); + a.conf.transEvInit = true; + } + this.conf.current_id = g; + this.conf.current_dir = e; + this.cdata[this.ind[this.conf.selected + e]].cell._hideCover(); + a.cell.style[this.conf.transProp] = this.conf.anim_cards; + a.cell.style.left = this._cards_detect_x(g, 1) + "px"; + a = null; + } +}; +dhtmlXCarousel.prototype._cards_start = function (e, a, g, c) {}; +dhtmlXCarousel.prototype._cards_end = function (g, c) { + if (g.type == this.conf.transEv && this.conf.current_id != null && c == this.cdata[this.conf.current_id].cell.cell) { + var a = this.cdata[this.conf.current_id].cell; + a.cell.style[this.conf.transProp] = ""; + if (a.conf.transEvInit != true) { + a.cell.removeEventListener(this.conf.transEv, this._animateTransEnd, false); + a.conf.transEvInit = false; + } + this.conf.current_id = null; + if (this.conf.current_dir > 0) { + this._cards_adjust_middle(this.conf.selected + 1, this.conf.selected + this.conf.current_dir - 1, 0); + } + this.cdata[this.ind[this.conf.selected]].cell._showCover(); + this._animateEnd(this.conf.current_dir); + } +}; +dhtmlXCarousel.prototype._cards_update_selected = function (a) { + this.cdata[a].cell._hideCover(); +}; +dhtmlXCarousel.prototype._cards_adjust_middle = function (e, h, c) { + for (var g = e; g <= h; g++) { + var j = this.ind[g]; + var a = this.cdata[j].cell; + a.conf.size.x = this._cards_detect_x(j, c); + a.cell.style.left = a.conf.size.x + "px"; + a = null; + } +}; +dhtmlXCarousel.prototype._cards_detect_x = function (e, c) { + if (typeof c == "undefined" || c == null) { + c = this.cdata[e].index <= this.conf.selected ? 0 : 1; + } + var a = c * (this.conf.width + this.conf.ofs_left + this.conf.ofs_item) + this.conf.ofs_item; + return a; +}; +dhtmlXCarousel.prototype._cards_cell_added = function (a) { + this.cdata[a].cell.conf.size.x = this._cards_detect_x(a); + this.cdata[a].cell.cell.style.left = this.cdata[a].cell.conf.size.x + "px"; + if (this.conf.selected != this.cdata[a].index) { + this.cdata[a].cell._showCover(); + } +}; +dhtmlXCarousel.prototype._cards_detect_area_width = function () { + return 2; +}; +function dhtmlXWindows(m) { + var j = this; + var g = {}; + if (typeof m != "undefined") { + for (var e in m) { + g[e] = m[e]; + } + } + m = null; + this.conf = { + skin: window.dhx4.skin || (typeof dhtmlx != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxwins") || "dhx_skyblue", + vp_pos_ofs: 20, + vp_custom: false, + vp_of_auto: g.vp_overflow == "auto", + vp_of_id: window.dhx4.newId(), + ofs_w: null, + ofs_h: null, + button_last: null, + dblclick_tm: 300, + dblclick_last: null, + dblclick_id: null, + dblclick_mode: "minmax", + dblclick_active: false, + dblclick_ev: window.dhx4.isIE6 || window.dhx4.isIE7 || window.dhx4.isIE8, + fr_cover: navigator.userAgent.indexOf("MSIE 6.0") >= 0, + }; + var c = window.dhx4.transDetect(); + this.conf.tr = { + prop: c.transProp, + ev: c.transEv, + height_open: "height 0.2s cubic-bezier(0.25,0.1,0.25,1)", + height_close: "height 0.18s cubic-bezier(0.25,0.1,0.25,1)", + op_open: "opacity 0.16s ease-in", + op_close: "opacity 0.2s ease-out", + op_v_open: "1", + op_v_close: "0.4", + }; + if (!g.viewport) { + this.attachViewportTo(document.body); + } else { + if (g.viewport.object != null) { + this.attachViewportTo(g.viewport.object); + } else { + if (g.viewport.left != null && g.viewport.top != null && g.viewport.width != null && g.viewport.height != null) { + this.setViewport(g.viewport.left, g.viewport.top, g.viewport.width, g.viewport.height, g.viewport.parent); + } else { + this.attachViewportTo(document.body); + } + } + } + this.w = {}; + this.createWindow = function (o, F, D, s, I) { + var n = {}; + if (arguments.length == 1 && typeof o == "object") { + n = o; + } else { + n.id = o; + n.left = F; + n.top = D; + n.width = s; + n.height = I; + if (typeof n.id == "undefined" || n.id == null) { + n.id = window.dhx4.newId(); + } + while (this.w[n.id] != null) { + n.id = window.dhx4.newId(); + } + } + if (n.left == null) { + n.left = 0; + } + if (n.top == null) { + n.top = 0; + } + n.move = n.move != null && window.dhx4.s2b(n.move) == false ? false : n.deny_move != null && window.dhx4.s2b(n.deny_move) == true ? false : true; + n.park = n.park != null && window.dhx4.s2b(n.park) == false ? false : n.deny_park != null && window.dhx4.s2b(n.deny_park) == true ? false : true; + n.resize = n.resize != null && window.dhx4.s2b(n.resize) == false ? false : n.deny_resize != null && window.dhx4.s2b(n.deny_resize) == true ? false : true; + n.keep_in_viewport = n.keep_in_viewport != null && window.dhx4.s2b(n.keep_in_viewport); + n.modal = n.modal != null && window.dhx4.s2b(n.modal); + n.center = n.center != null && window.dhx4.s2b(n.center); + n.text = n.text != null ? n.text : n.caption != null ? n.caption : "dhtmlxWindow"; + n.header = !(n.header != null && window.dhx4.s2b(n.header) == false); + var J = document.createElement("DIV"); + J.className = "dhxwin_active"; + this.vp.appendChild(J); + J._isWindow = true; + J._idd = n.id; + var w = document.createElement("DIV"); + w.className = "dhxwin_hdr"; + w.style.zIndex = 0; + w.innerHTML = "
" + n.text + "
"; + J.appendChild(w); + w.onselectstart = function (a) { + a = a || event; + if (a.preventDefault) { + a.preventDefault(); + } else { + a.returnValue = false; + } + return false; + }; + w.oncontextmenu = function (a) { + a = a || event; + a.cancelBubble = true; + return false; + }; + w._isWinHdr = true; + w.firstChild._isWinIcon = true; + var u = document.createElement("DIV"); + u.className = "dhxwin_brd"; + J.appendChild(u); + var C = document.createElement("DIV"); + C.className = "dhxwin_fr_cover"; + C.innerHTML = "
"; + J.appendChild(C); + this.w[n.id] = { + win: J, + hdr: w, + brd: u, + fr_cover: C, + b: {}, + conf: { + z_id: window.dhx4.newId(), + actv: false, + modal: false, + maxed: false, + parked: false, + sticked: false, + visible: true, + header: true, + text: n.text, + keep_in_vp: n.keep_in_viewport, + allow_move: n.move, + allow_park: n.park, + allow_resize: n.resize, + max_w: null, + max_h: null, + min_w: 80, + min_h: 80, + }, + }; + var v = { help: { title: "Help", visible: false }, stick: { title: "Stick", visible: false }, park: { title: "Park", visible: true }, minmax: { title: "Min/Max", visible: true }, close: { title: "Close", visible: true } }; + for (var E in v) { + var A = new dhtmlXWindowsButton(this, n.id, E, v[E].title, false); + if (v[E].visible == false) { + A.hide(); + } + w.lastChild.appendChild(A.button); + this.w[n.id].b[E] = A; + A = null; + } + this._winAdjustTitle(n.id); + this.w[n.id].win.style.zIndex = window.dhx4.zim.reserve(this.w[n.id].conf.z_id); + var H = new dhtmlXWindowsCell(n.id, this); + this.w[n.id].win.insertBefore(H.cell, C); + this.w[n.id].cell = H; + if (typeof window.addEventListener == "function") { + this.w[n.id].win.addEventListener("mousedown", this._winOnMouseDown, false); + this.w[n.id].win.addEventListener("mouseup", this._winOnMouseDown, false); + if (this.conf.dblclick_ev) { + this.w[n.id].win.addEventListener("dblclick", this._winOnMouseDown, false); + } + if (this.conf.dnd_enabled == true && window.dhx4.dnd.evs.start != null) { + this.w[n.id].win.addEventListener(window.dhx4.dnd.evs.start, this._winOnMouseDown, false); + if (window.dhx4.dnd.p_en != true) { + this.w[n.id].win.addEventListener(window.dhx4.dnd.evs.start, this._winOnMouseDown, false); + this.w[n.id].win.addEventListener(window.dhx4.dnd.evs.end, this._winOnMouseDown, false); + } + } + } else { + this.w[n.id].win.attachEvent("onmousedown", this._winOnMouseDown); + this.w[n.id].win.attachEvent("onmouseup", this._winOnMouseDown); + if (this.conf.dblclick_ev) { + this.w[n.id].win.attachEvent("ondblclick", this._winOnMouseDown); + } + } + this._winInitFRM(n.id); + this._winSetPosition(n.id, n.left, n.top); + this._winSetSize(n.id, n.width, n.height); + this._winMakeActive(n.id); + if (n.center == true) { + this.w[n.id].cell.center(); + } + if (n.modal == true) { + this.w[n.id].cell.setModal(true); + } + if (n.header == false) { + this.w[n.id].cell.hideHeader(); + } + f = J = w = u = C = H = null; + return this.w[n.id].cell; + }; + this._winOnMouseDown = function (o) { + o = o || event; + var a = o.target || o.srcElement; + var n = { press_type: o.type }; + if (o.type == "MSPointerDown" || o.type == "pointerdown") { + j.conf.ev_skip = true; + } else { + if (j.conf.ev_skip == true) { + j.conf.ev_skip = false; + a = null; + return; + } + } + while (a != null && a._isWindow != true) { + if (typeof a.className != "undefined" && n.mode == null) { + if (typeof a._buttonName != "undefined") { + n.mode = "button"; + n.button_name = a._buttonName; + } else { + if (a._isWinHdr == true) { + n.mode = "hdr"; + } else { + if (a._isWinIcon == true) { + n.mode = "icon"; + } + } + } + } + a = a.parentNode; + } + if (n.mode == null) { + n.mode = "win"; + } + n.id = a != null && a._isWindow == true ? a._idd : null; + a = null; + if (n.id != null && j.w[n.id] != null) { + j.callEvent("_winMouseDown", [o, n]); + } + }; + this._winOnParkTrans = function (n) { + if (n.stopPropagation) { + n.stopPropagation(); + } + var a = j.w[this._idd]; + if (n.propertyName == "opacity") { + j._winCellClearOpacity(this._idd); + } + if (n.propertyName == "height" && a.conf.tr_mode == "park") { + if (a.conf.tr_mode == "park") { + a.win.style[j.conf.tr.prop] = ""; + if (!a.conf.parked) { + j._winAdjustCell(this._idd); + j._callMainEvent("onParkDown", this._idd); + if (a.conf.keep_in_vp) { + j._winAdjustPosition(this._idd, a.conf.x, a.conf.y); + } + } else { + a.hdr.style.zIndex = 3; + j._callMainEvent("onParkUp", this._idd); + } + } + } + a = null; + }; + this.unload = function () { + this.conf.unloading = true; + if (this._dndInitModule) { + this._dndUnloadModule(); + } + for (var n in this.w) { + this._winClose(n); + } + this.w = null; + if (this.cm != null && typeof this._unloadContextMenu == "function") { + this._unloadContextMenu(); + } + window.dhx4._eventable(this, "clear"); + this.attachViewportTo(null); + for (var n in this.conf) { + this.conf[n] = null; + delete this.conf[n]; + } + for (var n in this) { + this[n] = null; + } + j = n = null; + }; + window.dhx4._eventable(this); + this.attachEvent("_winMouseDown", this._winMouseDownHandler); + if (this._dndInitModule) { + this._dndInitModule(); + } + if (g.wins != null) { + for (var l = 0; l < g.wins.length; l++) { + var h = g.wins[l]; + this.createWindow(h); + } + } + g = null; + return this; +} +dhtmlXWindows.prototype.forEachWindow = function (e) { + for (var c in this.w) { + e.apply(window, [this.w[c].cell]); + } +}; +dhtmlXWindows.prototype.window = function (a) { + if (this.w[a] != null) { + return this.w[a].cell; + } + return null; +}; +dhtmlXWindows.prototype.isWindow = function (a) { + return this.w[a] != null; +}; +dhtmlXWindows.prototype.findByText = function (g) { + var e = []; + for (var c in this.w) { + if (this.w[c].cell.getText().indexOf(String(g)) >= 0) { + e.push(this.w[c]); + } + } + return e; +}; +dhtmlXWindows.prototype.setSkin = function (e) { + if (e == this.conf.skin) { + return; + } + if (this.vp != null) { + this.vp.className = String(this.vp.className).replace("dhxwins_vp_" + this.conf.skin, " dhxwins_vp_" + e); + } + for (var c in this.w) { + this.w[c].cell._resetSizeState(); + this._winAdjustCell(c); + this._winAdjustTitle(c); + } + this.conf.skin = e; +}; +dhtmlXWindows.prototype.getBottommostWindow = function () { + return this._getTopBottomWin(false); +}; +dhtmlXWindows.prototype.getTopmostWindow = function () { + return this._getTopBottomWin(true); +}; +dhtmlXWindows.prototype._getTopBottomWin = function (h) { + var g = null; + for (var c in this.w) { + if (this.w[c].conf.visible) { + var e = false; + if (g != null) { + e = g.z > this.w[c].win.style.zIndex; + if (h) { + e = !e; + } + } + if (g == null || e) { + g = { win: this.w[c].cell, z: this.w[c].win.style.zIndex }; + } + } + } + return g ? g.win : null; +}; +dhtmlXWindows.prototype._winMakeActive = function (e, h) { + if (e != null && h !== true && this.w[e].conf.actv == true) { + return; + } + var s = []; + var m = {}; + for (var c = 0; c < this._zOrder.length; c++) { + var l = this._zOrder[c].name; + var g = this._zOrder[c].value; + var u = []; + for (var o in this.w) { + var r = this.w[o]; + if (m[o] == null && r.conf[l] === g && r.conf.visible == true) { + if (e != o) { + window.dhx4.zim.clear(r.conf.z_id); + u.push([o, Number(r.win.style.zIndex)]); + m[o] = true; + } + } + r = null; + } + u.sort(function (w, v) { + return w[1] < v[1] ? 1 : -1; + }); + if (e != null && this.w[e].conf[l] === g && m[e] == null) { + window.dhx4.zim.clear(this.w[e].conf.z_id); + var j = [[e, Number(this.w[e].win.style.zIndex)]]; + u = j.concat(u); + m[e] = true; + } + s = s.concat(u); + } + for (var c = s.length - 1; c >= 0; c--) { + var o = s[c][0]; + var r = this.w[o]; + r.win.style.zIndex = window.dhx4.zim.reserve(r.conf.z_id); + if (r.conf.modal && this.mcover != null) { + for (var n in this.mcover) { + this.mcover[n].style.zIndex = r.win.style.zIndex; + } + } + this._winAdjustFRMZIndex(o); + if (e == null && c == 0) { + e = o; + } + r.conf.actv = e == o; + r.win.className = r.conf.actv ? "dhxwin_active" : "dhxwin_inactive"; + r = null; + } + if (e != null && this.conf.last_active != e) { + this._callMainEvent("onFocus", e); + } + this.conf.last_active = e; +}; +dhtmlXWindows.prototype._zOrder = [ + { name: "modal", value: true }, + { name: "sticked", value: true }, + { name: "sticked", value: false }, +]; +dhtmlXWindows.prototype._vpPull = {}; +dhtmlXWindows.prototype._vpOf = {}; +dhtmlXWindows.prototype._vpPullAdd = function () { + if (this.vp == null) { + return; + } + var e = null; + for (var c in this._vpPull) { + if (this._vpPull[c].vp == this.vp) { + this._vpPull[c].count++; + e = c; + } + } + if (e == null) { + this._vpPull[window.dhx4.newId()] = { vp: this.vp, count: 1 }; + } + if (this.vp == document.body && this.conf.vp_of_auto == true) { + this._vpOfInit(); + } + this._vpOfUpd(); +}; +dhtmlXWindows.prototype._vpPullRemove = function () { + if (this.vp == null) { + return 0; + } + var e = 0; + for (var c in this._vpPull) { + if (this._vpPull[c].vp == this.vp) { + e = --this._vpPull[c].count; + if (e == 0) { + this._vpPull[c].vp = null; + this._vpPull[c].count = null; + delete this._vpPull[c]; + } + } + } + this._vpOfClear(); + return e; +}; +dhtmlXWindows.prototype._vpOfInit = function () { + this._vpOf[this.conf.vp_of_id] = true; +}; +dhtmlXWindows.prototype._vpOfClear = function () { + this._vpOf[this.conf.vp_of_id] = false; + delete this._vpOf[this.conf.vp_of_id]; + this._vpOfUpd(); +}; +dhtmlXWindows.prototype._vpOfUpd = function () { + var e = false; + for (var c in this._vpOf) { + e = e || this._vpOf[c]; + } + if (e == true) { + if (document.body.className.match(/dhxwins_vp_auto/) == null) { + document.body.className += " dhxwins_vp_auto"; + } + } else { + if (document.body.className.match(/dhxwins_vp_auto/) != null) { + document.body.className = String(document.body.className).replace(/\s{0,}dhxwins_vp_auto/gi, ""); + } + } +}; +dhtmlXWindows.prototype.attachViewportTo = function (h) { + var e = this._vpPullRemove(); + if (this.conf.vp_custom) { + while (this.vp.childNodes.length > 0) { + this.vp.removeChild(this.vp.lastChild); + } + this.vp.parentNode.removeChild(this.vp); + this.vp = null; + } else { + if (this.vp != null && e == 0) { + this.vp.className = String(this.vp.className).replace(new RegExp("\\s{1,}dhxwins_vp_" + this.conf.skin), ""); + } + } + if (h == null) { + this.vp = null; + } else { + this.vp = typeof h == "string" ? document.getElementById(h) : h; + var g = "dhxwins_vp_" + this.conf.skin; + if (this.vp.className.indexOf(g) < 0) { + this.vp.className += " " + g; + } + h = null; + for (var c in this.w) { + this.vp.appendChild(this.w[c].win); + } + this.conf.vp_custom = false; + } + if (this.vp == document.body) { + document.body.style.position = "static"; + } + this._vpPullAdd(); +}; +dhtmlXWindows.prototype.setViewport = function (c, j, g, a, h) { + var e = document.createElement("DIV"); + e.style.position = "absolute"; + e.style.left = c + "px"; + e.style.top = j + "px"; + e.style.width = g + "px"; + e.style.height = a + "px"; + if (typeof h == "undefined" || h == null) { + h = document.body; + } else { + if (typeof h == "string") { + h = document.getElementById(h); + } + } + h.appendChild(e); + this.attachViewportTo(e); + this.conf.vp_custom = true; + h = e = null; +}; +dhtmlXWindows.prototype._winSetPosition = function (g, a, e) { + var c = this.w[g]; + if (c.conf.maxed) { + c.conf.lastMX += a - c.conf.x; + c.conf.lastMY += e - c.conf.y; + } + c.conf.x = a; + c.conf.y = e; + c.win.style.left = c.conf.x + "px"; + c.win.style.top = c.conf.y + "px"; + this._winAdjustFRMPosition(g); + c = null; +}; +dhtmlXWindows.prototype._winAdjustPosition = function (l, c, j) { + var e = this.w[l]; + if (typeof c == "undefined") { + c = e.conf.x; + } + if (typeof j == "undefined") { + j = e.conf.y; + } + var a = e.conf.keep_in_vp ? 0 : -e.conf.w + this.conf.vp_pos_ofs; + var h = e.conf.keep_in_vp ? this.vp.clientWidth - e.conf.w : this.vp.clientWidth - this.conf.vp_pos_ofs; + if (c < a) { + c = a; + } else { + if (c > h) { + c = h; + } + } + var g = e.conf.keep_in_vp ? this.vp.clientHeight - e.conf.h : this.vp.clientHeight - this.conf.vp_pos_ofs; + if (j < 0) { + j = 0; + } else { + if (j > g) { + j = g; + } + } + if (c != e.conf.x || j != e.conf.y) { + this._winSetPosition(l, c, j); + } + e = null; +}; +dhtmlXWindows.prototype._winSetSize = function (m, j, e, l, c) { + var g = this.w[m]; + var a = j != null ? j : g.conf.w; + var h = e != null ? e : g.conf.h; + if (this.conf.ofs_w == null) { + g.win.style.width = a + "px"; + g.win.style.height = h + "px"; + this.conf.ofs_w = g.win.offsetWidth - a; + this.conf.ofs_h = g.win.offsetHeight - h; + } + if (g.conf.min_w != null && a < g.conf.min_w) { + a = g.conf.min_w; + } + if (g.conf.max_w != null && a > g.conf.max_w) { + a = g.conf.max_w; + } + if (!g.conf.parked && g.conf.min_h != null && h < g.conf.min_h) { + h = g.conf.min_h; + } + if (g.conf.max_h != null && h > g.conf.max_h) { + h = g.conf.max_h; + } + if (g.conf.keep_in_vp) { + if (a > this.vp.clientWidth) { + a = this.vp.clientWidth; + } + if (h > this.vp.clientHeight) { + h = this.vp.clientHeight; + } + } + g.win.style.width = a - this.conf.ofs_w + "px"; + g.win.style.height = h - this.conf.ofs_h + "px"; + g.conf.w = a; + g.conf.h = h; + this._winAdjustFRMSize(m); + if (c) { + this._winAdjustPosition(m, g.conf.x, g.conf.y); + } + if (!g.conf.parked && l != true) { + this._winAdjustCell(m); + } + g = null; +}; +dhtmlXWindows.prototype._winMinmax = function (h, e) { + if (typeof e != "undefined" && this.w[h].conf.maxed == e) { + return; + } + if (this.w[h].conf.allow_resize == false) { + return; + } + var c = this.w[h]; + if (c.conf.parked) { + this._winPark(h, false); + } + if (c.conf.maxed) { + this._winSetSize(h, c.conf.lastMW, c.conf.lastMH); + this._winAdjustPosition(h, c.conf.lastMX, c.conf.lastMY); + c.conf.maxed = false; + } else { + var a = 0; + var g = 0; + if (c.conf.max_w != null) { + a = c.conf.x + Math.round(c.conf.w - c.conf.max_w) / 2; + } + if (c.conf.max_h != null) { + g = Math.max(c.conf.y + Math.round(c.conf.h - c.conf.max_h) / 2, 0); + } + c.conf.lastMX = c.conf.x; + c.conf.lastMY = c.conf.y; + c.conf.lastMW = c.conf.w; + c.conf.lastMH = c.conf.h; + this._winSetSize(h, this.vp.clientWidth, this.vp.clientHeight); + this._winAdjustPosition(h, a, g); + c.conf.maxed = true; + } + c.b.minmax.setCss(c.conf.maxed ? "minmaxed" : "minmax"); + if (c.conf.maxed) { + this._callMainEvent("onMaximize", h); + } else { + this._callMainEvent("onMinimize", h); + } + c = null; +}; +dhtmlXWindows.prototype._winShow = function (c, a) { + if (this.w[c].conf.visible == true) { + return; + } + this.w[c].win.style.display = ""; + this.w[c].conf.visible = true; + if (a == true || this.conf.last_active == null) { + this._winMakeActive(c, true); + } + this._callMainEvent("onShow", c); +}; +dhtmlXWindows.prototype._winHide = function (c, a) { + if (this.w[c].conf.visible == false) { + return; + } + this.w[c].win.style.display = "none"; + this.w[c].conf.visible = false; + if (this.w[c].conf.actv) { + this.w[c].conf.actv = false; + this.w[c].win.className = "dhxwin_inactive"; + this._winMakeActive(null, true); + } + this._callMainEvent("onHide", c); +}; +dhtmlXWindows.prototype._winPark = function (e, a) { + if (this.w[e].conf.allow_park == false) { + return; + } + if (this.w[e].conf.header == false) { + return; + } + var c = this.w[e]; + if (a == true && this.conf.tr.prop !== false) { + c.win.style[this.conf.tr.prop] = this.conf.tr[c.conf.parked ? "height_open" : "height_close"]; + if (!c.conf.tr_ev) { + c.win.addEventListener(this.conf.tr.ev, this._winOnParkTrans, false); + c.conf.tr_ev = true; + } + } + if (c.conf.parked) { + c.hdr.className = String(c.hdr.className).replace(/\s{1,}dhxwin_hdr_parked/gi, ""); + c.hdr.style.zIndex = 0; + c.conf.parked = false; + c.conf.tr_mode = "park"; + this._winCellSetOpacity(e, "open", a); + this._winSetSize(e, c.conf.w, c.conf.lastPH, a == true && this.conf.tr.prop !== false); + if (!(a == true && this.conf.tr.prop !== false)) { + this._callMainEvent("onParkDown", e); + if (c.conf.keep_in_vp) { + this._winAdjustPosition(e, c.conf.x, c.conf.y); + } + } + if (window.dhx4.isIE8 == true && this.conf.tr.prop == false && c.cell.cell.className.match(/dhxwin_parked/) != null) { + c.cell.cell.className = c.cell.cell.className.replace(/\s{0,}dhxwin_parked/gi, ""); + } + } else { + c.conf.lastPH = c.conf.h; + c.hdr.className += " dhxwin_hdr_parked"; + if (a == false || this.conf.tr.prop == false) { + c.hdr.style.zIndex = 3; + } + c.conf.parked = true; + c.conf.tr_mode = "park"; + this._winCellSetOpacity(e, "close", a); + this._winSetSize(e, c.conf.w, c.hdr.offsetHeight + this.conf.ofs_h, a == true && this.conf.tr.prop !== false); + if (!(a == true && this.conf.tr.prop !== false)) { + this._callMainEvent("onParkUp", e); + } + if (window.dhx4.isIE8 == true && this.conf.tr.prop == false && c.cell.cell.className.match(/dhxwin_parked/) == null) { + c.cell.cell.className += " dhxwin_parked"; + } + } + c = null; +}; +dhtmlXWindows.prototype._winCellSetOpacity = function (l, j, e, h) { + var c = this.w[l].cell; + for (var g in c.conf.idx) { + if ({ pr1: true, pr2: true }[g] != true) { + if (e == true && this.conf.tr.prop != false) { + c.cell.childNodes[c.conf.idx[g]].style[this.conf.tr.prop] = this.conf.tr["op_" + j]; + } + c.cell.childNodes[c.conf.idx[g]].style.opacity = this.conf.tr["op_v_" + j]; + } + } + c = null; +}; +dhtmlXWindows.prototype._winCellClearOpacity = function (g) { + var c = this.w[g].cell; + for (var e in c.conf.idx) { + if ({ pr1: true, pr2: true }[e] != true) { + if (this.conf.tr.prop != false) { + c.cell.childNodes[c.conf.idx[e]].style[this.conf.tr.prop] = ""; + } + } + } + c = null; +}; +dhtmlXWindows.prototype._winStick = function (c, a) { + if (typeof a != "undefined" && this.w[c].conf.sticked == a) { + return; + } + this.w[c].conf.sticked = !this.w[c].conf.sticked; + this.w[c].b.stick.setCss(this.w[c].conf.sticked ? "sticked" : "stick"); + this._winMakeActive(this.conf.last_active, true); + if (this.w[c].conf.sticked) { + this._callMainEvent("onStick", c); + } else { + this._callMainEvent("onUnStick", c); + } +}; +dhtmlXWindows.prototype._winClose = function (g) { + if (this._callMainEvent("onClose", g) !== true && this.conf.unloading != true) { + return; + } + var e = this.w[g]; + if (e.conf.fs_mode) { + e.cell.setToFullScreen(false); + } + if (e.conf.modal) { + this._winSetModal(g, false); + } + window.dhx4.zim.clear(e.conf.z_id); + if (this.cm != null && this.cm.icon[g] != null) { + this._detachContextMenu("icon", g, null); + } + if (typeof window.addEventListener == "function") { + e.win.removeEventListener("mousedown", this._winOnMouseDown, false); + e.win.removeEventListener("mouseup", this._winOnMouseDown, false); + if (this.conf.dblclick_ev) { + e.win.removeEventListener("dblclick", this._winOnMouseDown, false); + } + if (this.conf.dnd_enabled == true && window.dhx4.dnd.evs.start != null) { + e.win.removeEventListener(window.dhx4.dnd.evs.start, this._winOnMouseDown, false); + if (window.dhx4.dnd.p_en != true) { + e.win.removeEventListener(window.dhx4.dnd.evs.start, this._winOnMouseDown, false); + e.win.removeEventListener(window.dhx4.dnd.evs.end, this._winOnMouseDown, false); + } + } + } else { + e.win.detachEvent("onmousedown", this._winOnMouseDown); + e.win.detachEvent("onmouseup", this._winOnMouseDown); + if (this.conf.dblclick_ev) { + e.win.attachEvent("ondblclick", this._winOnMouseDown); + } + } + for (var c in e.b) { + this._winRemoveButton(g, c, true); + } + e.b = null; + e.cell._unload(); + e.cell = null; + e.brd.parentNode.removeChild(e.brd); + e.brd = null; + if (e.fr_cover != null) { + e.fr_cover.parentNode.removeChild(e.fr_cover); + e.fr_cover = null; + } + if (e.fr_m_cover != null) { + e.fr_m_cover.parentNode.removeChild(e.fr_m_cover); + e.fr_m_cover = null; + } + e.hdr._isWinHdr = true; + e.hdr.firstChild._isWinIcon = true; + e.hdr.onselectstart = null; + e.hdr.parentNode.removeChild(e.hdr); + e.hdr = null; + for (var c in e.conf) { + e.conf[c] = null; + delete e.conf[c]; + } + e.conf = null; + e.win._idd = null; + e.win._isWindow = null; + e.win.parentNode.removeChild(e.win); + e.win = null; + e = null; + this.w[g] = null; + delete this.w[g]; + if (!this.conf.unloading) { + this._winMakeActive(null, true); + } +}; +dhtmlXWindows.prototype._winSetModal = function (l, g, j) { + if (this.w[l].conf.modal == g) { + return; + } + if (typeof j == "undefined") { + j = true; + } + var e = this.w[l]; + if (g == true && e.conf.modal == false) { + if (this.conf.last_modal != null) { + this._winSetModal(this.conf.last_modal, false, false); + } + if (this.mcover == null) { + var h = document.createElement("DIV"); + h.className = "dhxwins_mcover"; + this.vp.insertBefore(h, e.fr_m_cover || e.win); + this.mcover = { d: h }; + if (this.conf.fr_cover) { + this.mcover.f = document.createElement("IFRAME"); + this.mcover.f.className = "dhxwins_mcover"; + this.mcover.f.border = 0; + this.mcover.f.frameBorder = 0; + this.vp.insertBefore(this.mcover.f, h); + } + h = null; + } else { + if (this.mcover.d.nextSibling != (e.fr_m_cover || e.win)) { + this.vp.insertBefore(this.mcover.d, e.fr_m_cover || e.win); + if (this.mcover.f != null) { + this.vp.insertBefore(this.mcover.f, this.mcover.d); + } + } + } + e.conf.modal = true; + this.conf.last_modal = l; + this._winMakeActive(l, true); + } else { + if (g == false && e.conf.modal == true) { + e.conf.modal = false; + this.conf.last_modal = null; + if (j && this.mcover != null) { + for (var c in this.mcover) { + this.vp.removeChild(this.mcover[c]); + this.mcover[c] = null; + } + this.mcover = null; + } + } + } + e = null; +}; +dhtmlXWindows.prototype._winMouseDownHandler = function (g, c) { + var a = g.target || g.srcElement; + if (g.button >= 2) { + return; + } + if (c.mode == "button") { + if (c.press_type == "mousedown") { + this.conf.button_last = c.button_name; + } else { + if ((c.press_type == "mouseup" && c.button_name == this.conf.button_last) || c.press_type == "MSPointerDown" || c.press_type == "pointerdown") { + this.conf.button_last = null; + if (this._winButtonClick(c.id, c.button_name, g) !== true) { + return; + } + } + } + } + if ((c.press_type == "pointerdown" || c.press_type == "mousedown" || c.press_type == "dblclick") && c.mode == "hdr") { + this.conf.dblclick_active = false; + if (this.conf.dblclick_ev == true) { + if (c.press_type == "dblclick") { + this.conf.dblclick_active = true; + } + } else { + if (this.conf.dblclick_last == null) { + this.conf.dblclick_last = new Date().getTime(); + this.dblclick_id = c.id; + } else { + var a = new Date().getTime(); + if (this.conf.dblclick_last + this.conf.dblclick_tm > a && this.dblclick_id == c.id) { + this.conf.dblclick_active = true; + this.conf.dblclick_last = null; + this.dblclick_id = null; + } else { + this.conf.dblclick_last = a; + this.dblclick_id = c.id; + } + } + } + if (this.conf.dblclick_active) { + this._winDoHeaderDblClick(c.id); + return; + } + } + if (c.press_type == "mousedown" || c.press_type == window.dhx4.dnd.evs.start) { + this._winMakeActive(c.id); + } + if (c.press_type == "touchend") { + } +}; +dhtmlXWindows.prototype._winDoHeaderDblClick = function (a) { + if (this.conf.dblclick_mode == "minmax") { + this._winMinmax(a); + return; + } + if (this.conf.dblclick_mode == "park") { + this._winPark(a, true); + return; + } + if (typeof this.conf.dblclick_mode == "function") { + this.conf.dblclick_mode.apply(window, [a]); + return; + } + if (typeof window[this.conf.dblclick_mode] == "function") { + window[this.conf.dblclick_mode].apply(window, [a]); + return; + } +}; +dhtmlXWindows.prototype._winAdjustCell = function (c) { + var o = this.w[c]; + var n = 1; + var m = o.conf.header ? o.hdr.offsetHeight : 1; + var g = o.win.clientWidth - 2; + var r = o.win.clientHeight - m - 1; + o.brd.style.left = n + "px"; + o.brd.style.top = m + "px"; + if (o.conf.brd == null) { + o.brd.style.width = g + "px"; + o.brd.style.height = r + "px"; + o.conf.brd = { w: g - o.brd.offsetWidth, h: r - o.brd.offsetHeight }; + } + o.brd.style.width = g + o.conf.brd.w + "px"; + o.brd.style.height = r + o.conf.brd.h + "px"; + var e = 5; + var a = 1 + e; + var l = o.conf.header ? m : m + e; + var h = o.brd.clientWidth; + var j = o.brd.clientHeight; + o.cell._setSize(a, l, h, j); + o.fr_cover.style.left = a + "px"; + o.fr_cover.style.top = l + "px"; + o.fr_cover.style.width = h + "px"; + o.fr_cover.style.height = j + "px"; + o = null; +}; +dhtmlXWindows.prototype._winAdjustTitle = function (g) { + var a = this.w[g].hdr.childNodes[0]; + var e = this.w[g].hdr.childNodes[1]; + var c = this.w[g].hdr.childNodes[2]; + e.style.paddingLeft = a.offsetWidth + 12 + "px"; + e.style.paddingRight = c.offsetWidth + 10 + "px"; + e = c = a = null; +}; +dhtmlXWindows.prototype._callMainEvent = function (c, g) { + var a = this.w[g]; + if (a.cell.checkEvent(c)) { + var e = a.cell._callMainEvent(c, [a.cell]); + } else { + var e = this.callEvent(c, [a.cell]); + } + a = null; + return e; +}; +dhtmlXWindows.prototype._winInitFRM = function (e) { + if (this.conf.fr_cover != true) { + return; + } + var a = this.w[e]; + var c = document.createElement("IFRAME"); + c.className = "dhxwin_main_fr_cover"; + c.border = 0; + c.frameBorder = 0; + c.style.zIndex = a.win.style.zIndex; + a.win.parentNode.insertBefore(c, a.win); + a.fr_m_cover = c; + c = null; +}; +dhtmlXWindows.prototype._winAdjustFRMSize = function (c) { + var a = this.w[c]; + if (a.fr_m_cover != null) { + a.fr_m_cover.style.width = a.conf.w + "px"; + a.fr_m_cover.style.height = a.conf.h + "px"; + } + a = null; +}; +dhtmlXWindows.prototype._winAdjustFRMPosition = function (c) { + var a = this.w[c]; + if (a.fr_m_cover != null) { + a.fr_m_cover.style.left = a.win.style.left; + a.fr_m_cover.style.top = a.win.style.top; + } + a = null; +}; +dhtmlXWindows.prototype._winAdjustFRMZIndex = function (c) { + var a = this.w[c]; + if (a.fr_m_cover != null) { + a.fr_m_cover.style.zIndex = a.win.style.zIndex; + } + a = null; +}; +function dhtmlXWindowsCell(h, g) { + dhtmlXCellObject.apply(this, [h, "_wins"]); + this.wins = g; + this.cell._winId = h; + this.conf.skin = this.wins.conf.skin; + this.attachEvent("_onCellUnload", function () { + if (this._unloadResize) { + this._unloadResize(); + } + window.dhx4._eventable(this.cell, "clear"); + this.cell._winId = null; + this.wins = null; + this.setText = null; + this.getText = null; + this.allowMove = null; + this.denyMove = null; + this.isMovable = null; + this.allowResize = null; + this.denyResize = null; + this.isResizable = null; + this.maximize = null; + this.minimize = null; + this.isMaximized = null; + this.setPosition = null; + this.getPosition = null; + this.adjustPosition = null; + this.park = null; + this.isParked = null; + this.allowPark = null; + this.denyPark = null; + this.isParkable = null; + this.show = null; + this.hide = null; + this.isHidden = null; + this.stick = null; + this.unstick = null; + this.isSticked = null; + this.setDimension = null; + this.getDimension = null; + this.setMinDimension = null; + this.getMinDimension = null; + this.setMaxDimension = null; + this.getMaxDimension = null; + this.keepInViewport = null; + this.center = null; + this.centerOnScreen = null; + this.bringToTop = null; + this.bringToBottom = null; + this.isOnTop = null; + this.isOnBottom = null; + this.showHeader = null; + this.hideHeader = null; + this.setModal = null; + this.isModal = null; + this.close = null; + this._adjustByCont = null; + this.button = null; + this.addUserButton = null; + this.removeUserButton = null; + e = null; + }); + this.attachEvent("_onContentLoaded", function () { + this.wins._callMainEvent("onContentLoaded", this._idd); + }); + this.attachEvent("_onContentMouseDown", function (j, a) { + this.wins.callEvent("_winMouseDown", [a, { id: j, mode: "win" }]); + }); + this._callMainEvent = function (j, a) { + return this.callEvent(j, a); + }; + this.conf.tr = {}; + for (var c in this.wins.conf.tr) { + this.conf.tr[c] = this.wins.conf.tr[c]; + } + if (this.conf.tr.prop != false) { + } + if (this._initResize) { + this._initResize(); + } + window.dhx4._eventable(this.cell); + var e = this; + this.cell.attachEvent("_setCellSize", function (a, m) { + var j = e.wins.w[this._winId].conf.w - e.conf.size.w; + var l = e.wins.w[this._winId].conf.h - e.conf.size.h; + e.setDimension(a + j, m + l); + }); + return this; +} +dhtmlXWindowsCell.prototype = new dhtmlXCellObject(); +dhtmlXWindowsCell.prototype.setText = function (a) { + this.wins.w[this._idd].conf.text = a; + this.wins.w[this._idd].hdr.childNodes[1].firstChild.innerHTML = a; +}; +dhtmlXWindowsCell.prototype.getText = function () { + return this.wins.w[this._idd].conf.text; +}; +dhtmlXWindowsCell.prototype.allowMove = function () { + this.wins.w[this._idd].conf.allow_move = true; +}; +dhtmlXWindowsCell.prototype.denyMove = function () { + this.wins.w[this._idd].conf.allow_move = false; +}; +dhtmlXWindowsCell.prototype.isMovable = function () { + return this.wins.w[this._idd].conf.allow_move == true; +}; +dhtmlXWindowsCell.prototype.allowResize = function () { + this.wins.w[this._idd].conf.allow_resize = true; + this.wins.w[this._idd].b.minmax.enable(); +}; +dhtmlXWindowsCell.prototype.denyResize = function () { + this.wins.w[this._idd].conf.allow_resize = false; + this.wins.w[this._idd].b.minmax.disable(); +}; +dhtmlXWindowsCell.prototype.isResizable = function () { + return this.wins.w[this._idd].conf.allow_resize == true; +}; +dhtmlXWindowsCell.prototype.maximize = function () { + this.wins._winMinmax(this._idd, true); +}; +dhtmlXWindowsCell.prototype.minimize = function () { + this.wins._winMinmax(this._idd, false); +}; +dhtmlXWindowsCell.prototype.isMaximized = function () { + return this.wins.w[this._idd].conf.maxed == true; +}; +dhtmlXWindowsCell.prototype.setPosition = function (a, c) { + this.wins._winSetPosition(this._idd, a, c); +}; +dhtmlXWindowsCell.prototype.getPosition = function () { + var a = this.wins.w[this._idd]; + var c = [a.conf.x, a.conf.y]; + a = null; + return c; +}; +dhtmlXWindowsCell.prototype.adjustPosition = function () { + this.wins._winAdjustPosition(this._idd); +}; +dhtmlXWindowsCell.prototype.park = function () { + this.wins._winPark(this._idd, true); +}; +dhtmlXWindowsCell.prototype.isParked = function () { + return this.wins.w[this._idd].conf.parked == true; +}; +dhtmlXWindowsCell.prototype.allowPark = function () { + this.wins.w[this._idd].conf.allow_park = true; + this.wins.w[this._idd].b.park.enable(); +}; +dhtmlXWindowsCell.prototype.denyPark = function () { + this.wins.w[this._idd].conf.allow_park = false; + this.wins.w[this._idd].b.park.disable(); +}; +dhtmlXWindowsCell.prototype.isParkable = function () { + return this.wins.w[this._idd].conf.allow_park == true; +}; +dhtmlXWindowsCell.prototype.show = function (a) { + this.wins._winShow(this._idd, window.dhx4.s2b(a)); +}; +dhtmlXWindowsCell.prototype.hide = function () { + this.wins._winHide(this._idd); +}; +dhtmlXWindowsCell.prototype.isHidden = function () { + return this.wins.w[this._idd].conf.visible != true; +}; +dhtmlXWindowsCell.prototype.stick = function () { + this.wins._winStick(this._idd, true); +}; +dhtmlXWindowsCell.prototype.unstick = function () { + this.wins._winStick(this._idd, false); +}; +dhtmlXWindowsCell.prototype.isSticked = function () { + return this.wins.w[this._idd].conf.sticked == true; +}; +dhtmlXWindowsCell.prototype.setDimension = function (e, a) { + var c = this.wins.w[this._idd]; + if (c.conf.parked) { + this.wins._winPark(this._idd, false); + } + if (c.conf.maxed) { + if (e != null) { + c.conf.lastMW = e; + } + if (a != null) { + c.conf.lastMH = a; + } + this.wins._winMinmax(this._idd); + } else { + this.wins._winSetSize(this._idd, e, a, false, true); + } + c = null; +}; +dhtmlXWindowsCell.prototype.getDimension = function () { + var a = this.wins.w[this._idd]; + var c = [a.conf.w, a.conf.h]; + a = null; + return c; +}; +dhtmlXWindowsCell.prototype.setMinDimension = function (e, a) { + var c = this.wins.w[this._idd]; + c.conf.min_w = e; + c.conf.min_h = a; + this.wins._winSetSize(this._idd, c.conf.w, c.conf.h); + c = null; +}; +dhtmlXWindowsCell.prototype.getMinDimension = function () { + var a = this.wins.w[this._idd]; + var c = [a.conf.min_w, a.conf.min_h]; + a = null; + return c; +}; +dhtmlXWindowsCell.prototype.setMaxDimension = function (e, a) { + var c = this.wins.w[this._idd]; + c.conf.max_w = e; + c.conf.max_h = a; + this.wins._winSetSize(this._idd, c.conf.w, c.conf.h); + c = null; +}; +dhtmlXWindowsCell.prototype.getMaxDimension = function () { + var a = this.wins.w[this._idd]; + var c = [a.conf.max_w, a.conf.max_h]; + a = null; + return c; +}; +dhtmlXWindowsCell.prototype.keepInViewport = function (a) { + this.wins.w[this._idd].conf.keep_in_vp = window.dhx4.s2b(a); +}; +dhtmlXWindowsCell.prototype.center = function () { + var e = this.wins.vp; + var c = this.wins.w[this._idd]; + var a = Math.round((e.clientWidth - c.conf.w) / 2); + var g = Math.round((e.clientHeight - c.conf.h) / 2); + this.wins._winSetPosition(this._idd, a, g); + e = c = null; +}; +dhtmlXWindowsCell.prototype.centerOnScreen = function () { + var c = this.wins.w[this._idd]; + var j = window.dhx4.screenDim(); + var h = window.dhx4.absLeft(this.wins.vp); + var g = window.dhx4.absTop(this.wins.vp); + var e = this.wins.vp.parentNode; + while (e != null) { + if (e.scrollLeft) { + h = h - e.scrollLeft; + } + if (e.scrollTop) { + g = g - e.scrollTop; + } + e = e.parentNode; + } + var a = Math.round((j.right - j.left - c.conf.w) / 2); + var l = Math.round((j.bottom - j.top - c.conf.h) / 2); + this.wins._winAdjustPosition(this._idd, a - h, l - g); + d = c = null; +}; +dhtmlXWindowsCell.prototype.bringToTop = function () { + this.wins._winMakeActive(this._idd, true); +}; +dhtmlXWindowsCell.prototype.bringToBottom = function () { + var a = this.wins.w[this._idd].conf.actv ? null : this.wins.conf.last_active; + window.dhx4.zim.clear(this.wins.w[this._idd].conf.z_id); + this.wins.w[this._idd].win.style.zIndex = 0; + this.wins._winMakeActive(a, true); +}; +dhtmlXWindowsCell.prototype.isOnTop = function () { + return this.wins.w[this._idd].conf.actv == true; +}; +dhtmlXWindowsCell.prototype.isOnBottom = function () { + var e = { id: null, z: +Infinity }; + for (var c in this.wins.w) { + if (this.wins.w[c].conf.visible && this.wins.w[c].win.style.zIndex < e.z) { + e.id = c; + e.z = this.wins.w[c].win.style.zIndex; + } + } + return e.id == this._idd; +}; +dhtmlXWindowsCell.prototype.showHeader = function () { + var a = this.wins.w[this._idd]; + if (a.conf.header == false) { + a.hdr.className = String(a.hdr.className).replace(/\s{0,}dhxwin_hdr_hidden/gi, ""); + a.brd.className = String(a.brd.className).replace(/\s{0,}dhxwin_hdr_hidden/gi, ""); + this.conf.cells_cont = null; + a.conf.brd = null; + a.conf.header = true; + this.wins._winAdjustCell(this._idd); + } + a = null; +}; +dhtmlXWindowsCell.prototype.hideHeader = function () { + var a = this.wins.w[this._idd]; + if (a.conf.header == true) { + if (a.conf.parked) { + this.wins._winPark(this._idd, false); + } + a.hdr.className += " dhxwin_hdr_hidden"; + a.brd.className += " dhxwin_hdr_hidden"; + this.conf.cells_cont = null; + a.conf.brd = null; + a.conf.header = false; + this.wins._winAdjustCell(this._idd); + } + a = null; +}; +dhtmlXWindowsCell.prototype.setModal = function (a) { + this.wins._winSetModal(this._idd, window.dhx4.s2b(a)); +}; +dhtmlXWindowsCell.prototype.isModal = function () { + return this.wins.w[this._idd].conf.modal == true; +}; +dhtmlXWindowsCell.prototype._adjustByCont = function (a, c) { + a += this.wins.w[this._idd].conf.w - this.conf.size.w; + c += this.wins.w[this._idd].conf.h - this.conf.size.h; + this.wins._winSetSize(this._idd, a, c); +}; +dhtmlXWindowsCell.prototype.close = function () { + this.wins._winClose(this._idd); +}; +dhtmlXWindowsCell.prototype.setIconCss = function (a) { + this.wins.w[this._idd].hdr.firstChild.className = "dhxwin_icon " + a; + this.wins._winAdjustTitle(this._idd); +}; +dhtmlXWindowsCell.prototype.setToFullScreen = function (c) { + c = window.dhx4.s2b(c); + var a = this.wins.w[this._idd]; + if (a.conf.fs_mode == c) { + a = null; + return; + } + if (this.wins.fsn == null) { + this.wins.fsn = document.createElement("DIV"); + this.wins.fsn.className = this.wins.vp.className + " dhxwins_vp_fs"; + document.body.appendChild(this.wins.fsn); + } + if (c) { + this.wins.fsn.appendChild(a.win); + this.maximize(); + this.hideHeader(); + } else { + this.wins.vp.appendChild(a.win); + this.minimize(); + this.showHeader(); + if (this.wins.fsn.childNodes.length == 0) { + this.wins.fsn.parentNode.removeChild(this.wins.fsn); + this.wins.fsn = null; + } + } + a.conf.fs_mode = c; + a = null; +}; +dhtmlXWindowsCell.prototype.button = function (a) { + if (a == "minmax1" || a == "minmax2") { + a = "minmax"; + } + return this.wins.w[this._idd].b[a]; +}; +dhtmlXWindowsCell.prototype.addUserButton = function (l, j, e) { + var a = new dhtmlXWindowsButton(this.wins, this._idd, l, e, true); + var g = null; + var c = this.wins.w[this._idd].hdr.lastChild; + if (isNaN(j)) { + j = 0; + } else { + if (j < 0) { + j = 0; + } + } + if (c.childNodes[j] != null) { + g = c.childNodes[j]; + } + if (g != null) { + c.insertBefore(a.button, g); + } else { + c.appendChild(a.button); + } + this.wins.w[this._idd].b[l] = a; + a = g = c = null; + this.wins._winAdjustTitle(this._idd); +}; +dhtmlXWindowsCell.prototype.removeUserButton = function (a) { + if (this.wins.w[this._idd].b[a] == null || this.wins.w[this._idd].b[a].conf.custom != true) { + return; + } + this.wins._winRemoveButton(this._idd, a); +}; +window.dhtmlXWindowsButton = function (h, c, a, g, e) { + this.conf = { wins: h, winId: c, name: a, enabled: true, visible: true, custom: true }; + this.button = document.createElement("DIV"); + this.button._buttonName = a; + this.button.title = g; + this.enable = function () { + this.conf.enabled = true; + this.setCss(this.conf.css); + }; + this.disable = function () { + this.conf.enabled = false; + this.setCss(this.conf.css); + }; + this.isEnabled = function () { + return this.conf.enabled == true; + }; + this.show = function () { + this.button.style.display = ""; + this.conf.visible = true; + this.conf.wins._winAdjustTitle(this.conf.winId); + }; + this.hide = function () { + this.button.style.display = "none"; + this.conf.visible = false; + this.conf.wins._winAdjustTitle(this.conf.winId); + }; + this.isHidden = function () { + return this.conf.visible == false; + }; + this.setCss = function (l) { + this.conf.css = l; + var j = this.conf.enabled ? "" : "_dis"; + this.button.className = "dhxwin_button" + j + " dhxwin_button_" + this.conf.css + j; + }; + this._doOnClick = function (j) { + return this.callEvent("onClick", [this.conf.wins.w[this.conf.winId].cell, this]); + }; + this.unload = function (j) { + dhx4._eventable(this, "clear"); + this.button._buttonName = null; + this.button.parentNode.removeChild(this.button); + if (this.conf.wins.cm != null && this.conf.wins.cm.button[this.conf.winId] != null && this.conf.wins.cm.button[this.conf.winId][this.conf.name] != null) { + this.conf.wins._detachContextMenu("button", this.conf.winId, this.conf.name); + } + this.button = null; + this.enable = null; + this.disable = null; + this.isEnabled = null; + this.show = null; + this.hide = null; + this.isHidden = null; + this.setCss = null; + this.unload = null; + if (j != true) { + this.conf.wins._winAdjustTitle(this.conf.winId); + } + this.conf.wins = null; + this.conf.winId = null; + this.conf = null; + }; + this.setCss(a); + dhx4._eventable(this); + return this; +}; +dhtmlXWindows.prototype._winButtonClick = function (e, a, c) { + if (!this.w[e].b[a].isEnabled()) { + return true; + } + if (this.w[e].b[a]._doOnClick() !== true) { + return; + } + if (a == "help") { + this._callMainEvent("onHelp", e); + } + if (a == "park") { + this._winPark(e, true); + } + if (a == "minmax") { + this._winMinmax(e); + } + if (a == "stick") { + this._winStick(e); + return false; + } + if (a == "close") { + this._winClose(e); + return false; + } + return true; +}; +dhtmlXWindows.prototype._winRemoveButton = function (e, a, c) { + this.w[e].b[a].unload(c); + this.w[e].b[a] = null; + delete this.w[e].b[a]; +}; +dhtmlXWindows.prototype._dndInitModule = function () { + var a = this; + this.conf.dnd_enabled = true; + this.conf.dnd_tm = null; + this.conf.dnd_time = 0; + this._dndOnMouseDown = function (h, j) { + if (a.conf.dblclick_active) { + return; + } + if (h.preventDefault) { + h.preventDefault(); + } else { + h.returnValue = false; + } + if (a._callMainEvent("onBeforeMoveStart", j) !== true) { + return; + } + a.conf.dnd = { id: j, x: a._dndPos(h, "X"), y: a._dndPos(h, "Y"), ready: true, css: false, css_touch: false, css_vp: false, tr: null, mode: "def", moved: false, prevent: false }; + if (a.w[j].conf.keep_in_vp) { + a.conf.dnd.minX = 0; + a.conf.dnd.maxX = a.vp.clientWidth - a.w[j].conf.w; + a.conf.dnd.minY = 0; + a.conf.dnd.maxY = a.vp.clientHeight - a.w[j].conf.h; + } else { + a.conf.dnd.minX = -a.w[j].conf.w + a.conf.vp_pos_ofs; + a.conf.dnd.maxX = a.vp.clientWidth - a.conf.vp_pos_ofs; + a.conf.dnd.minY = 0; + a.conf.dnd.maxY = a.vp.clientHeight - a.conf.vp_pos_ofs; + } + var c = ["MozTransform", "WebkitTransform", "OTransform", "msTransform", "transform"]; + for (var g = 0; g < c.length; g++) { + if (document.documentElement.style[c[g]] != null && a.conf.dnd.tr == null) { + a.conf.dnd.tr = c[g]; + a.conf.dnd.mode = "tr"; + } + } + if (a.conf.dnd.mode == "tr") { + a.w[j].win.style[a.conf.dnd.tr] = "translate(0px,0px)"; + if (a.w[j].fr_m_cover != null) { + a.w[j].fr_m_cover.style[a.conf.dnd.tr] = a.w[j].win.style[a.conf.dnd.tr]; + } + } + if (window.dhx4.dnd._mTouch(h) == false && h.type == window.dhx4.dnd.evs.start) { + if (a.conf.dnd.css_touch == false) { + a.w[j].win.className += " dhxwin_dnd_touch"; + a.conf.dnd.css_touch = true; + } + if (a.conf.dnd.css_vp == false) { + a.vp.className += " dhxwins_vp_dnd"; + a.conf.dnd.css_vp = true; + } + } else { + a._dndInitEvents(); + } + }; + this._dndOnMouseMove = function (j) { + j = j || event; + var h = a.conf.dnd; + var c = a._dndPos(j, "X") - h.x; + var l = a._dndPos(j, "Y") - h.y; + if (j.type == window.dhx4.dnd.evs.move) { + if (h.moved != true && (Math.abs(c) > 20 || Math.abs(l) > 20)) { + if (a.conf.dnd_tm != null) { + window.clearTimeout(a.conf.dnd_tm); + a.conf.dnd_tm = null; + } + window.removeEventListener(window.dhx4.dnd.evs.start, a._dndOnMouseMove, false); + return; + } + } + if (h.ready != true) { + return; + } + var g = a.w[h.id]; + if (j.preventDefault) { + j.preventDefault(); + } else { + j.returnValue = false; + } + if (h.css != true) { + if (h.css_touch == false) { + g.win.className += " dhxwin_dnd"; + } + g.fr_cover.className += " dhxwin_fr_cover_dnd"; + h.css = true; + } + if (h.css_vp != true) { + a.vp.className += " dhxwins_vp_dnd"; + h.css_vp = true; + } + h.newX = g.conf.x + c; + h.newY = g.conf.y + l; + if (h.mode == "tr") { + h.newX = Math.min(Math.max(h.newX, h.minX), h.maxX); + c = h.newX - g.conf.x; + h.newY = Math.min(Math.max(h.newY, h.minY), h.maxY); + l = h.newY - g.conf.y; + g.win.style[h.tr] = "translate(" + c + "px," + l + "px)"; + if (g.fr_m_cover != null) { + g.fr_m_cover.style[h.tr] = g.win.style[h.tr]; + } + } else { + if (h.newX < h.minX || h.newX > h.maxX) { + h.newX = Math.min(Math.max(h.newX, h.minX), h.maxX); + } else { + h.x = a._dndPos(j, "X"); + } + if (h.newY < h.minY || h.newY > h.maxY) { + h.newY = Math.min(Math.max(h.newY, h.minY), h.maxY); + } else { + h.y = a._dndPos(j, "Y"); + } + a._winSetPosition(h.id, h.newX, h.newY); + } + h.moved = true; + g = h = null; + }; + this._dndOnMouseUp = function (h) { + h = h || event; + if (a.conf.dnd != null) { + var g = a.conf.dnd; + var c = a.w[g.id]; + if (g.newX != null) { + if (g.mode == "tr") { + a._winSetPosition(g.id, g.newX, g.newY); + c.win.style[g.tr] = "translate(0px,0px)"; + if (c.fr_m_cover != null) { + c.fr_m_cover.style[g.tr] = c.win.style[g.tr]; + } + } + } + if (g.css == true) { + if (g.css_touch == false) { + c.win.className = String(c.win.className).replace(/\s{0,}dhxwin_dnd/gi, ""); + } + c.fr_cover.className = String(c.fr_cover.className).replace(/\s{0,}dhxwin_fr_cover_dnd/gi, ""); + } + if (g.css_touch == true) { + c.win.className = String(c.win.className).replace(/\s{0,}dhxwin_dnd_touch/gi, ""); + } + if (g.css_vp == true) { + a.vp.className = String(a.vp.className).replace(/\s{0,}dhxwins_vp_dnd/gi, ""); + } + a._dndUnloadEvents(); + if (g.moved == true) { + a._callMainEvent("onMoveFinish", g.id); + } else { + a._callMainEvent("onMoveCancel", g.id); + } + c = g = a.conf.dnd = null; + } + if (window.dhx4.dnd.p_en == true && h.type == window.dhx4.dnd.evs.end) { + window.dhx4.dnd._touchOn(); + window.removeEventListener(window.dhx4.dnd.evs.end, a._dndOnMouseUp, false); + window.removeEventListener(window.dhx4.dnd.evs.move, a._dndOnMouseMove, false); + if (a.conf.dnd_tm != null) { + window.clearTimeout(a.conf.dnd_tm); + } + a.conf.dnd_tm = null; + } + }; + this._dndOnSelectStart = function (c) { + c = c || event; + if (c.preventDefault) { + c.preventDefault(); + } else { + c.returnValue = false; + } + return false; + }; + this._dndInitEvents = function () { + if (typeof window.addEventListener == "function") { + window.addEventListener("mousemove", this._dndOnMouseMove, false); + window.addEventListener("mouseup", this._dndOnMouseUp, false); + window.addEventListener("selectstart", this._dndOnSelectStart, false); + } else { + document.body.attachEvent("onmousemove", this._dndOnMouseMove); + document.body.attachEvent("onmouseup", this._dndOnMouseUp); + document.body.attachEvent("onselectstart", this._dndOnSelectStart); + } + }; + this._dndUnloadEvents = function () { + if (typeof window.addEventListener == "function") { + window.removeEventListener("mousemove", this._dndOnMouseMove, false); + window.removeEventListener("mouseup", this._dndOnMouseUp, false); + window.removeEventListener("selectstart", this._dndOnSelectStart, false); + } else { + document.body.detachEvent("onmousemove", this._dndOnMouseMove); + document.body.detachEvent("onmouseup", this._dndOnMouseUp); + document.body.detachEvent("onselectstart", this._dndOnSelectStart); + } + }; + this._dndUnloadModule = function () { + this.detachEvent(this.conf.dnd_evid); + this.conf.dnd_evid = null; + this._dndOnMouseDown = null; + this._dndOnMouseMove = null; + this._dndOnMouseUp = null; + this._dndOnSelectStart = null; + this._dndInitEvents = null; + this._dndUnloadEvents = null; + this._dndInitModule = null; + this._dndUnloadModule = null; + a = null; + }; + this._dndPos = function (e, c) { + var g = e[this.conf.dnd_ev_prefix + c]; + if ((g == null || g == 0) && e.touches != null) { + g = e.touches[0][this.conf.dnd_ev_prefix + c]; + } + return g; + }; + this.conf.dnd_evid = this.attachEvent("_winMouseDown", function (g, c) { + if (this.w[c.id] == null || this.w[c.id].conf.allow_move != true) { + return; + } + if (typeof g.button != "undefined" && g.button >= 2) { + return; + } + if (g.type == window.dhx4.dnd.evs.start) { + if (c.mode == "hdr") { + if (this.w[c.id].conf.maxed && this.w[c.id].conf.max_w == null && this.w[c.id].conf.max_h == null) { + return; + } + this.conf.dnd_ev_prefix = "page"; + this.conf.dnd = { x: this._dndPos(g, "X"), y: this._dndPos(g, "Y") }; + if (this.conf.dnd_time < 1) { + this._dndOnMouseDown(g, c.id); + } else { + if (this.conf.dnd_tm != null) { + window.clearTimeout(this.conf.dnd_tm); + } + this.conf.dnd_tm = window.setTimeout(function () { + a._dndOnMouseDown(g, c.id); + }, this.conf.dnd_time); + } + if (window.dhx4.dnd.p_en == true) { + window.dhx4.dnd._touchOff(); + window.addEventListener(window.dhx4.dnd.evs.end, this._dndOnMouseUp, false); + } + window.addEventListener(window.dhx4.dnd.evs.move, this._dndOnMouseMove, false); + } + return false; + } + if (g.type == window.dhx4.dnd.evs.end) { + if (this.conf.dnd_tm != null) { + window.clearTimeout(this.conf.dnd_tm); + this.conf.dnd_tm = null; + } + this._dndOnMouseUp(g); + window.removeEventListener(window.dhx4.dnd.evs.move, this._dndOnMouseMove, false); + return false; + } + this.conf.dnd_ev_prefix = "client"; + if (!(c.mode == "hdr" && g.type == "mousedown")) { + return; + } + if (this.w[c.id].conf.maxed && this.w[c.id].conf.max_w == null && this.w[c.id].conf.max_h == null) { + return; + } + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + this._dndOnMouseDown(g, c.id); + return false; + }); +}; +dhtmlXWindowsCell.prototype._initResize = function () { + var a = this; + var c = navigator.userAgent; + this.conf.resize = { + b_width: 6, + c_type: c.indexOf("MSIE 10.0") > 0 || c.indexOf("MSIE 9.0") > 0 || c.indexOf("MSIE 8.0") > 0 || c.indexOf("MSIE 7.0") > 0 || c.indexOf("MSIE 6.0") > 0, + btn_left: (window.dhx4.isIE6 || window.dhx4.isIE7 || window.dhx4.isIE8) && typeof window.addEventListener == "undefined" ? 1 : 0, + }; + this._rOnCellMouseMove = function (m) { + if (a.wins.conf.resize_actv == true || a.wins.w[a._idd].conf.allow_resize == false || a.conf.progress == true || a.wins.w[a._idd].conf.maxed == true || a.wins.w[a._idd].conf.fs_mode == true) { + var j = a.wins.w[a._idd].brd; + if (j.style.cursor != "default") { + j.style.cursor = "default"; + } + j = null; + return; + } + m = m || event; + var v = a.wins.w[a._idd].brd; + var g = a.conf.resize; + var o = a.wins.w[a._idd].conf.header == false; + var s = m.clientX; + var n = m.clientY; + var h = window.dhx4.absLeft(v); + var u = window.dhx4.absTop(v); + var l = ""; + if (s <= h + g.b_width) { + l = "w"; + } else { + if (s >= h + v.offsetWidth - g.b_width) { + l = "e"; + } + } + if (n >= u + v.offsetHeight - g.b_width) { + l = "s" + l; + } else { + if (o && n <= u + g.b_width) { + l = "n" + l; + } + } + if (l == "") { + l = false; + } + if (g.mode != l) { + g.mode = l; + if (l == false) { + v.style.cursor = "default"; + } else { + v.style.cursor = l + "-resize"; + } + } + v = g = null; + }; + this._rOnCellMouseDown = function (l) { + l = l || event; + if (typeof l.button != "undefined" && l.button != a.conf.resize.btn_left) { + return; + } + if (a.conf.resize.mode == false) { + return; + } + if (a.conf.progress == true) { + return; + } + if (a.wins.w[a._idd].conf.allow_resize == false) { + return; + } + if (a.wins.w[a._idd].conf.fs_mode == true) { + return; + } + if (l.preventDefault) { + l.preventDefault(); + } else { + l.returnValue = false; + } + if (a.wins._callMainEvent("onBeforeResizeStart", a._idd) !== true) { + return; + } + var g = a.wins.w[a._idd]; + var j = a.conf.resize; + a.wins.conf.resize_actv = true; + j.min_w = g.conf.min_w; + j.min_h = g.conf.min_h; + j.max_w = g.conf.max_w || +Infinity; + j.max_h = g.conf.max_h || +Infinity; + if (g.cell.dataType == "layout" && g.cell.dataObj != null && typeof g.cell.dataObj._getWindowMinDimension == "function") { + var h = g.cell.dataObj._getWindowMinDimension(g.cell); + j.min_w = Math.max(h.w, j.min_w); + j.min_h = Math.max(h.h, j.min_h); + } + j.vp_l = a.wins.conf.vp_pos_ofs; + j.vp_r = a.wins.vp.clientWidth - a.wins.conf.vp_pos_ofs; + j.vp_b = a.wins.vp.clientHeight - a.wins.conf.vp_pos_ofs; + j.x = l.clientX; + j.y = l.clientY; + if (typeof window.addEventListener == "function") { + window.addEventListener("mousemove", a._rOnWinMouseMove, false); + window.addEventListener("mouseup", a._rOnWinMouseUp, false); + window.addEventListener("selectstart", a._rOnSelectStart, false); + } else { + document.body.attachEvent("onmousemove", a._rOnWinMouseMove); + document.body.attachEvent("onmouseup", a._rOnWinMouseUp); + document.body.attachEvent("onselectstart", a._rOnSelectStart); + } + j.resized = false; + j.vp_cursor = a.wins.vp.style.cursor; + a.wins.vp.style.cursor = j.mode + "-resize"; + g = j = null; + }; + this._rOnCellContextMenu = function (g) { + g = g || event; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + return false; + }; + this._rOnWinMouseMove = function (l) { + l = l || event; + var h = a.wins.w[a._idd]; + var j = a.conf.resize; + if (!j.resized) { + h.fr_cover.className += " dhxwin_fr_cover_resize"; + j.resized = true; + } + var g = l.clientX - j.x; + var m = l.clientY - j.y; + if (j.mode.indexOf("e") >= 0) { + j.rw = Math.min(Math.max(h.conf.w + g, j.min_w), j.max_w); + j.rx = null; + if (h.conf.x + j.rw < j.vp_l) { + j.rw = j.vp_l - h.conf.x; + } else { + if (h.conf.x + j.rw > a.wins.vp.clientWidth) { + j.rw = a.wins.vp.clientWidth - h.conf.x; + } + } + } else { + if (j.mode.indexOf("w") >= 0) { + j.rw = Math.min(Math.max(h.conf.w - g, j.min_w), j.max_w); + j.rx = h.conf.x + h.conf.w - j.rw; + if (j.rx < 0) { + j.rw = j.rw + j.rx; + j.rx = 0; + } else { + if (j.rx > j.vp_r) { + j.rw = j.rw - j.vp_r; + j.rx = j.vp_r; + } + } + } + } + if (j.mode.indexOf("s") >= 0) { + j.rh = Math.min(Math.max(h.conf.h + m, j.min_h), j.max_h); + j.ry = null; + if (h.conf.y + j.rh > a.wins.vp.clientHeight) { + j.rh = a.wins.vp.clientHeight - h.conf.y; + } + } else { + if (j.mode.indexOf("n") >= 0) { + j.rh = Math.min(Math.max(h.conf.h - m, j.min_h), j.max_h); + j.ry = h.conf.y + h.conf.h - j.rh; + if (j.ry < 0) { + j.rh = j.rh + j.ry; + j.ry = 0; + } else { + if (j.ry > j.vp_b) { + j.rh = j.rh - j.vp_b; + j.ry = j.vp_b; + } + } + } + } + a._rAdjustSizer(); + h = j = null; + }; + this._rOnWinMouseUp = function () { + var g = a.conf.resize; + var e = a.wins.w[a._idd]; + a.wins.conf.resize_actv = false; + a.wins.vp.style.cursor = g.vp_cursor; + e.fr_cover.className = String(e.fr_cover.className).replace(/\s{0,}dhxwin_fr_cover_resize/gi, ""); + if (g.resized) { + a.wins._winSetSize(a._idd, g.rw, g.rh); + if (g.rx == null) { + g.rx = e.conf.x; + } + if (g.ry == null) { + g.ry = e.conf.y; + } + if (g.rx != e.conf.x || g.ry != e.conf.y) { + a.wins._winSetPosition(a._idd, g.rx, g.ry); + } + } + if (g.obj != null) { + g.obj.parentNode.removeChild(g.obj); + g.obj = null; + } + if (g.objFR != null) { + g.objFR.parentNode.removeChild(g.objFR); + g.objFR = null; + } + if (typeof window.addEventListener == "function") { + window.removeEventListener("mousemove", a._rOnWinMouseMove, false); + window.removeEventListener("mouseup", a._rOnWinMouseUp, false); + window.removeEventListener("selectstart", a._rOnSelectStart, false); + } else { + document.body.detachEvent("onmousemove", a._rOnWinMouseMove); + document.body.detachEvent("onmouseup", a._rOnWinMouseUp); + document.body.detachEvent("onselectstart", a._rOnSelectStart); + } + if (g.resized == true) { + if (a.dataType == "layout" && a.dataObj != null) { + a.dataObj.callEvent("onResize", []); + } + a.wins._callMainEvent("onResizeFinish", a._idd); + } else { + a.wins._callMainEvent("onResizeCancel", a._idd); + } + g.mode = ""; + e = g = null; + }; + this._rOnSelectStart = function (g) { + g = g || event; + if (g.preventDefault) { + g.preventDefault(); + } else { + g.returnValue = false; + } + return false; + }; + this._rInitSizer = function () { + var g = a.conf.resize; + var e = a.wins.w[a._idd]; + g.obj = document.createElement("DIV"); + g.obj.className = "dhxwin_resize"; + g.obj.style.zIndex = e.win.style.zIndex; + g.obj.style.cursor = g.mode + "-resize"; + a.wins.vp.appendChild(g.obj); + if (a.wins.conf.fr_cover == true) { + g.objFR = document.createElement("IFRAME"); + g.objFR.className = "dhxwin_resize_fr_cover"; + g.objFR.style.zIndex = g.obj.style.zIndex; + a.wins.vp.insertBefore(g.objFR, g.obj); + } + g.rx = e.conf.x; + g.ry = e.conf.y; + g.rw = e.conf.w; + g.rh = e.conf.h; + g = null; + }; + this._rAdjustSizer = function () { + var e = a.conf.resize; + if (!e.obj) { + this._rInitSizer(); + } + e.obj.style.width = e.rw + "px"; + e.obj.style.height = e.rh + "px"; + if (e.rx != null) { + e.obj.style.left = e.rx + "px"; + } + if (e.ry != null) { + e.obj.style.top = e.ry + "px"; + } + if (e.objFR != null) { + e.objFR.style.width = e.obj.style.width; + e.objFR.style.height = e.obj.style.height; + if (e.rx != null) { + e.objFR.style.left = e.obj.style.left; + } + if (e.ry != null) { + e.objFR.style.top = e.obj.style.top; + } + } + e = null; + }; + if (typeof window.addEventListener == "function") { + this.wins.w[this._idd].brd.addEventListener("mousemove", this._rOnCellMouseMove, false); + this.wins.w[this._idd].brd.addEventListener("mousedown", this._rOnCellMouseDown, false); + this.wins.w[this._idd].brd.addEventListener("contextmenu", this._rOnCellContextMenu, false); + } else { + this.wins.w[this._idd].brd.attachEvent("onmousemove", this._rOnCellMouseMove); + this.wins.w[this._idd].brd.attachEvent("onmousedown", this._rOnCellMouseDown); + this.wins.w[this._idd].brd.attachEvent("oncontextmenu", this._rOnCellContextMenu); + } + this._unloadResize = function () { + if (typeof window.addEventListener == "function") { + this.wins.w[this._idd].brd.removeEventListener("mousemove", this._rOnCellMouseMove, false); + this.wins.w[this._idd].brd.removeEventListener("mousedown", this._rOnCellMouseDown, false); + this.wins.w[this._idd].brd.removeEventListener("contextmenu", this._rOnCellContextMenu, false); + } else { + this.wins.w[this._idd].brd.detachEvent("onmousemove", this._rOnCellMouseMove); + this.wins.w[this._idd].brd.detachEvent("onmousedown", this._rOnCellMouseDown); + this.wins.w[this._idd].brd.detachEvent("oncontextmenu", this._rOnCellContextMenu); + } + this._initResize = null; + this._rOnCellMouseMove = null; + this._rOnCellMouseDown = null; + this._rOnWinMouseMove = null; + this._rOnWinMouseUp = null; + this._rOnSelectStart = null; + this._rInitSizer = null; + this._rAdjustSizer = null; + this._unloadResize = null; + this.conf.resize = null; + a = null; + }; +}; +dhtmlXWindows.prototype.attachContextMenu = function (a) { + return this._renderContextMenu("icon", null, null, a); +}; +dhtmlXWindows.prototype.getContextMenu = function () { + if (this.cm != null && this.cm.global != null) { + return this.cm.global; + } + return null; +}; +dhtmlXWindows.prototype.detachContextMenu = function () { + this._detachContextMenu("icon", null, null); +}; +dhtmlXWindowsCell.prototype.attachContextMenu = function (a) { + return this.wins._renderContextMenu("icon", this._idd, null, a); +}; +dhtmlXWindowsCell.prototype.getContextMenu = function () { + if (this.wins.cm != null && this.wins.cm.icon[this._idd] != null) { + return this.wins.cm.icon[this._idd]; + } + return null; +}; +dhtmlXWindowsCell.prototype.detachContextMenu = function () { + this.wins._detachContextMenu("icon", this._idd, null); +}; +dhtmlXWindowsButton.prototype.attachContextMenu = function (a) { + return this.conf.wins._renderContextMenu("button", this.conf.winId, this.conf.name, a); +}; +dhtmlXWindowsButton.prototype.getContextMenu = function () { + if (this.conf.wins.cm == null || this.conf.wins.cm.button[this.conf.winId] == null) { + return null; + } + if (this.conf.wins.cm.button[this.conf.winId][this.conf.name] != null) { + return this.conf.wins.cm.button[this.conf.winId][this.conf.name]; + } + return null; +}; +dhtmlXWindowsButton.prototype.detachContextMenu = function () { + this.conf.wins._detachContextMenu("button", this.conf.winId, this.conf.name); +}; +dhtmlXWindows.prototype._renderContextMenu = function (l, j, e, c) { + var g = this; + var a = false; + if (this.cm == null) { + this.cm = { global: null, icon: {}, button: {} }; + a = true; + } + if (j == null) { + if (this.cm.global != null) { + return; + } + } else { + if (l == "icon") { + if (this.cm.icon[j] != null) { + return; + } + } else { + if (l == "button") { + if (this.cm.button[j] != null && this.cm.button[j][e] != null) { + return; + } + } + } + } + if (c == null) { + c = {}; + } + c.parent = null; + c.context = true; + var h = new dhtmlXMenuObject(c); + h.setAutoHideMode(false); + h.attachEvent("onShow", function () { + this.conf.wins_menu_open = true; + }); + h.attachEvent("onHide", function () { + this.conf.wins_menu_open = false; + g.conf.opened_menu = null; + }); + if (j == null) { + this.cm.global = h; + } else { + if (l == "icon") { + this.cm.icon[j] = h; + } else { + if (l == "button") { + if (this.cm.button[j] == null) { + this.cm.button[j] = {}; + } + this.cm.button[j][e] = h; + } + } + } + if (a) { + this._showContextMenu = function (r, o) { + if (r.button >= 2) { + return; + } + if (o.mode == "icon" && o.id != null && o.press_type == "mousedown") { + var s = this.cm.icon[o.id] || this.cm.global; + if (s == null) { + return; + } + r.cancelBubble = true; + var n = this.w[o.id].hdr.firstChild; + if (s.conf.wins_menu_open && this.conf.opened_menu == o.id) { + s.hideContextMenu(); + } else { + this._hideContextMenu(); + s.showContextMenu(window.dhx4.absLeft(n), window.dhx4.absTop(n) + n.offsetHeight); + this.conf.opened_menu = o.id; + } + s = n = null; + } + if (o.mode == "button" && o.id != null && o.press_type == "mousedown") { + if (this.cm.button[o.id] == null || this.cm.button[o.id][o.button_name] == null) { + return; + } + r.cancelBubble = true; + this.conf.button_last = null; + var s = this.cm.button[o.id][o.button_name]; + var m = this.w[o.id].b[o.button_name].button; + if (s.conf.wins_menu_open && this.conf.opened_menu == o.id) { + s.hideContextMenu(); + } else { + this._hideContextMenu(); + s.showContextMenu(window.dhx4.absLeft(m), window.dhx4.absTop(m) + m.offsetHeight); + this.conf.opened_menu = o.id; + } + s = m = null; + } + }; + this._hideContextMenu = function (u) { + if (u != null) { + u = u || event; + if (u.type == "keydown" && u.keyCode != 27) { + return; + } + var s = u.target || u.srcElement; + var o = true; + while (s != null && o == true) { + if (s.className != null && s.className.search(/SubLevelArea_Polygon/) >= 0) { + o = false; + } else { + s = s.parentNode; + } + } + } + if (o || u == null) { + if (g.cm.global != null) { + g.cm.global.hideContextMenu(); + } + for (var r in g.cm.icon) { + if (g.cm.icon[r] != null) { + g.cm.icon[r].hideContextMenu(); + } + } + for (var r in g.cm.button) { + for (var n in g.cm.button[r]) { + if (g.cm.button[r][n] != null) { + g.cm.button[r][n].hideContextMenu(); + } + } + } + } + }; + this._detachContextMenu = function (o, n, m) { + if (this.cm == null) { + return; + } + if (n == null) { + if (this.cm.global != null) { + this.cm.global.unload(); + this.cm.global = null; + } + } else { + if (o == "icon") { + if (this.cm.icon[n] != null) { + this.cm.icon[n].unload(); + this.cm.icon[n] = null; + } + } else { + if (o == "button") { + if (this.cm.button[n] != null && this.cm.button[n][m] != null) { + this.cm.button[n][m].unload(); + this.cm.button[n][m] = null; + } + } + } + } + }; + this.attachEvent("_winMouseDown", this._showContextMenu); + if (typeof window.addEventListener == "function") { + window.addEventListener("mousedown", this._hideContextMenu, false); + window.addEventListener("keydown", this._hideContextMenu, false); + } else { + document.body.attachEvent("onmousedown", this._hideContextMenu); + document.body.attachEvent("onkeydown", this._hideContextMenu); + } + this._unloadContextMenu = function () { + this._detachContextMenu("icon", null, null); + this.cm = null; + if (typeof window.addEventListener == "function") { + window.removeEventListener("mousedown", this._hideContextMenu, false); + window.removeEventListener("keydown", this._hideContextMenu, false); + } else { + document.body.detachEvent("onmousedown", this._hideContextMenu); + document.body.detachEvent("onkeydown", this._hideContextMenu); + } + g = null; + }; + } + return h; +}; +if (!window.dhtmlx) { + window.dhtmlx = {}; +} +(function () { + var o = null; + function s(y, w) { + var x = y.callback; + r(false); + y.box.parentNode.removeChild(y.box); + o = y.box = null; + if (x) { + x(w); + } + } + function a(x) { + if (o) { + x = x || event; + var w = x.which || event.keyCode; + if (dhtmlx.message.keyboard) { + if (w == 13 || w == 32) { + s(o, true); + } + if (w == 27) { + s(o, false); + } + } + if (x.preventDefault) { + x.preventDefault(); + } + return !(x.cancelBubble = true); + } + } + if (document.attachEvent) { + document.attachEvent("onkeydown", a); + } else { + document.addEventListener("keydown", a, true); + } + function r(x) { + if (!r.cover) { + r.cover = document.createElement("DIV"); + r.cover.onkeydown = a; + r.cover.className = "dhx_modal_cover"; + document.body.appendChild(r.cover); + } + var w = document.body.scrollHeight; + r.cover.style.display = x ? "inline-block" : "none"; + } + function j(x, w) { + return "
" + x + "
"; + } + function e(x) { + if (!u.area) { + u.area = document.createElement("DIV"); + u.area.className = "dhtmlx_message_area"; + u.area.style[u.position] = "5px"; + document.body.appendChild(u.area); + } + u.hide(x.id); + var w = document.createElement("DIV"); + w.innerHTML = "
" + x.text + "
"; + w.className = "dhtmlx-info dhtmlx-" + x.type; + w.onclick = function () { + if (x) { + u.hide(x.id); + } + x = null; + }; + if (u.position == "bottom" && u.area.firstChild) { + u.area.insertBefore(w, u.area.firstChild); + } else { + u.area.appendChild(w); + } + if (x.expire > 0) { + u.timers[x.id] = window.setTimeout(function () { + u.hide(x.id); + }, x.expire); + } + u.pull[x.id] = w; + w = null; + return x.id; + } + function l(x, A, E) { + var D = document.createElement("DIV"); + D.className = " dhtmlx_modal_box dhtmlx-" + x.type; + D.setAttribute("dhxbox", 1); + var w = ""; + if (x.width) { + D.style.width = x.width; + } + if (x.height) { + D.style.height = x.height; + } + if (x.title) { + w += '
' + x.title + "
"; + } + w += '
' + (x.content ? "" : x.text) + '
'; + if (A) { + w += j(x.ok || "OK", true); + } + if (E) { + w += j(x.cancel || "Cancel", false); + } + if (x.buttons) { + for (var y = 0; y < x.buttons.length; y++) { + w += j(x.buttons[y], y); + } + } + w += "
"; + D.innerHTML = w; + if (x.content) { + var C = x.content; + if (typeof C == "string") { + C = document.getElementById(C); + } + if (C.style.display == "none") { + C.style.display = ""; + } + D.childNodes[x.title ? 1 : 0].appendChild(C); + } + D.onclick = function (I) { + I = I || event; + var H = I.target || I.srcElement; + if (!H.className) { + H = H.parentNode; + } + if (H.className == "dhtmlx_popup_button") { + var F = H.getAttribute("result"); + F = F == "true" || (F == "false" ? false : F); + s(x, F); + } + }; + x.box = D; + if (A || E) { + o = x; + } + return D; + } + function v(A, C, E) { + var D = A.tagName ? A : l(A, C, E); + if (!A.hidden) { + r(true); + } + document.body.appendChild(D); + var w = A.left || Math.abs(Math.floor(((window.innerWidth || document.documentElement.offsetWidth) - D.offsetWidth) / 2)); + var F = A.top || Math.abs(Math.floor(((window.innerHeight || document.documentElement.offsetHeight) - D.offsetHeight) / 2)); + if (A.position == "top") { + D.style.top = "-3px"; + } else { + D.style.top = F + "px"; + } + D.style.left = w + "px"; + D.onkeydown = a; + D.focus(); + if (A.hidden) { + dhtmlx.modalbox.hide(D); + } + return D; + } + function n(w) { + return v(w, true, false); + } + function c(w) { + return v(w, true, true); + } + function h(w) { + return v(w); + } + function m(x, w, y) { + if (typeof x != "object") { + if (typeof w == "function") { + y = w; + w = ""; + } + x = { text: x, type: w, callback: y }; + } + return x; + } + function g(y, x, w, A) { + if (typeof y != "object") { + y = { text: y, type: x, expire: w, id: A }; + } + y.id = y.id || u.uid(); + y.expire = y.expire || u.expire; + return y; + } + dhtmlx.alert = function () { + var w = m.apply(this, arguments); + w.type = w.type || "confirm"; + return n(w); + }; + dhtmlx.confirm = function () { + var w = m.apply(this, arguments); + w.type = w.type || "alert"; + return c(w); + }; + dhtmlx.modalbox = function () { + var w = m.apply(this, arguments); + w.type = w.type || "alert"; + return h(w); + }; + dhtmlx.modalbox.hide = function (w) { + while (w && w.getAttribute && !w.getAttribute("dhxbox")) { + w = w.parentNode; + } + if (w) { + w.parentNode.removeChild(w); + r(false); + o = null; + } + }; + var u = (dhtmlx.message = function (A, y, x, C) { + A = g.apply(this, arguments); + A.type = A.type || "info"; + var w = A.type.split("-")[0]; + switch (w) { + case "alert": + return n(A); + case "confirm": + return c(A); + case "modalbox": + return h(A); + default: + return e(A); + break; + } + }); + u.seed = new Date().valueOf(); + u.uid = function () { + return u.seed++; + }; + u.expire = 4000; + u.keyboard = true; + u.position = "top"; + u.pull = {}; + u.timers = {}; + u.hideAll = function () { + for (var w in u.pull) { + u.hide(w); + } + }; + u.hide = function (x) { + var w = u.pull[x]; + if (w && w.parentNode) { + window.setTimeout(function () { + w.parentNode.removeChild(w); + w = null; + }, 2000); + w.className += " hidden"; + if (u.timers[x]) { + window.clearTimeout(u.timers[x]); + } + delete u.pull[x]; + } + }; +})(); +if (!window.dhx) { + dhx = {}; +} +dhx.assert = function (c, a) { + if (!c) { + dhx.assert_error(a); + } +}; +dhx.assert_error = function (message) { + dhx.log("error", message); + if (dhx.message && typeof message == "string") { + dhx.message({ type: "debug", text: message, expire: -1 }); + } + if (dhx.debug !== false) { + eval("debugger;"); + } +}; +dhx.assert_core_ready = function () { + if (window.dhx_on_core_ready) { + dhx_on_core_ready(); + } +}; +dhx.codebase = "./"; +dhx.name = "Core"; +dhx.clone = function (c) { + var a = dhx.clone._function; + a.prototype = c; + return new a(); +}; +dhx.clone._function = function () {}; +dhx.extend = function (e, c, a) { + dhx.assert(e, "Invalid mixing target"); + dhx.assert(c, "Invalid mixing source"); + if (e._dhx_proto_wait) { + dhx.PowerArray.insertAt.call(e._dhx_proto_wait, c, 1); + return e; + } + for (var g in c) { + if (!e[g] || a) { + e[g] = c[g]; + } + } + if (c.defaults) { + dhx.extend(e.defaults, c.defaults); + } + if (c.$init) { + c.$init.call(e); + } + return e; +}; +dhx.copy = function (a) { + dhx.assert(a, "Invalid mixing target"); + if (arguments.length > 1) { + var c = arguments[0]; + a = arguments[1]; + } else { + var c = dhx.isArray(a) ? [] : {}; + } + for (var e in a) { + if (a[e] && typeof a[e] == "object" && !dhx.isDate(a[e])) { + c[e] = dhx.isArray(a[e]) ? [] : {}; + dhx.copy(c[e], a[e]); + } else { + c[e] = a[e]; + } + } + return c; +}; +dhx.single = function (e) { + var a = null; + var c = function (g) { + if (!a) { + a = new e({}); + } + if (a._reinit) { + a._reinit.apply(a, arguments); + } + return a; + }; + return c; +}; +dhx.protoUI = function () { + if (dhx.debug_proto) { + dhx.log("UI registered: " + arguments[0].name); + } + var e = arguments; + var a = e[0].name; + var c = function (h) { + if (!c) { + return dhx.ui[a].prototype; + } + var l = c._dhx_proto_wait; + if (l) { + var j = [l[0]]; + for (var g = 1; g < l.length; g++) { + j[g] = l[g]; + if (j[g]._dhx_proto_wait) { + j[g] = j[g].call(dhx, j[g].name); + } + if (j[g].prototype && j[g].prototype.name) { + dhx.ui[j[g].prototype.name] = j[g]; + } + } + dhx.ui[a] = dhx.proto.apply(dhx, j); + if (c._dhx_type_wait) { + for (var g = 0; g < c._dhx_type_wait.length; g++) { + dhx.Type(dhx.ui[a], c._dhx_type_wait[g]); + } + } + c = l = null; + } + if (this != dhx) { + return new dhx.ui[a](h); + } else { + return dhx.ui[a]; + } + }; + c._dhx_proto_wait = Array.prototype.slice.call(arguments, 0); + return (dhx.ui[a] = c); +}; +dhx.proto = function () { + if (dhx.debug_proto) { + dhx.log("Proto chain:" + arguments[0].name + "[" + arguments.length + "]"); + } + var j = arguments; + var h = j[0]; + var c = !!h.$init; + var m = []; + dhx.assert(h, "Invalid mixing target"); + for (var g = j.length - 1; g > 0; g--) { + dhx.assert(j[g], "Invalid mixing source"); + if (typeof j[g] == "function") { + j[g] = j[g].prototype; + } + if (j[g].$init) { + m.push(j[g].$init); + } + if (j[g].defaults) { + var e = j[g].defaults; + if (!h.defaults) { + h.defaults = {}; + } + for (var a in e) { + if (dhx.isUndefined(h.defaults[a])) { + h.defaults[a] = e[a]; + } + } + } + if (j[g].type && h.type) { + for (var a in j[g].type) { + if (!h.type[a]) { + h.type[a] = j[g].type[a]; + } + } + } + for (var l in j[g]) { + if (!h[l]) { + h[l] = j[g][l]; + } + } + } + if (c) { + m.push(h.$init); + } + h.$init = function () { + for (var o = 0; o < m.length; o++) { + m[o].apply(this, arguments); + } + }; + var n = function (o) { + this.$ready = []; + dhx.assert(this.$init, "object without init method"); + this.$init(o); + if (this._parseSettings) { + this._parseSettings(o, this.defaults); + } + for (var r = 0; r < this.$ready.length; r++) { + this.$ready[r].call(this); + } + }; + n.prototype = h; + h = j = null; + return n; +}; +dhx.bind = function (c, a) { + return function () { + return c.apply(a, arguments); + }; +}; +dhx.require = function (c, m, l) { + if (typeof c != "string") { + var j = c.length || 0; + var h = m; + if (!j) { + for (var a in c) { + j++; + } + m = function () { + j--; + if (j === 0) { + h.apply(this, arguments); + } + }; + for (var a in c) { + dhx.require(a, m, l); + } + } else { + m = function () { + if (j) { + j--; + dhx.require(c[c.length - j - 1], m, l); + } else { + return h.apply(this, arguments); + } + }; + m(); + } + return; + } + if (dhx._modules[c] !== true) { + if (c.substr(-4) == ".css") { + var g = dhx.html.create("LINK", { type: "text/css", rel: "stylesheet", href: dhx.codebase + c }); + document.head.appendChild(g); + if (m) { + m.call(l || window); + } + return; + } + var e = arguments[4]; + if (!m) { + dhx.exec( + dhx + .ajax() + .sync() + .get(dhx.codebase + c).responseText + ); + dhx._modules[c] = true; + } else { + if (!dhx._modules[c]) { + dhx._modules[c] = [[m, l]]; + dhx.ajax(dhx.codebase + c, function (r) { + dhx.exec(r); + var o = dhx._modules[c]; + dhx._modules[c] = true; + for (var n = 0; n < o.length; n++) { + o[n][0].call(o[n][1] || window, !n); + } + }); + } else { + dhx._modules[c].push([m, l]); + } + } + } +}; +dhx._modules = {}; +dhx.exec = function (code) { + if (window.execScript) { + window.execScript(code); + } else { + window.eval(code); + } +}; +dhx.wrap = function (c, a) { + if (!c) { + return a; + } + return function () { + var e = c.apply(this, arguments); + a.apply(this, arguments); + return e; + }; +}; +dhx.isUndefined = function (c) { + return typeof c == "undefined"; +}; +dhx.delay = function (g, c, e, a) { + return window.setTimeout(function () { + var h = g.apply(c, e || []); + g = c = e = null; + return h; + }, a || 1); +}; +dhx.uid = function () { + if (!this._seed) { + this._seed = new Date().valueOf(); + } + this._seed++; + return this._seed; +}; +dhx.toNode = function (a) { + if (typeof a == "string") { + return document.getElementById(a); + } + return a; +}; +dhx.toArray = function (a) { + return dhx.extend(a || [], dhx.PowerArray, true); +}; +dhx.toFunctor = function (str) { + return typeof str == "string" ? eval(str) : str; +}; +dhx.isArray = function (a) { + return Array.isArray ? Array.isArray(a) : Object.prototype.toString.call(a) === "[object Array]"; +}; +dhx.isDate = function (a) { + return a instanceof Date; +}; +dhx._events = {}; +dhx.event = function (g, e, a, c) { + g = dhx.toNode(g); + var h = dhx.uid(); + if (c) { + a = dhx.bind(a, c); + } + dhx._events[h] = [g, e, a]; + if (g.addEventListener) { + g.addEventListener(e, a, false); + } else { + if (g.attachEvent) { + g.attachEvent("on" + e, a); + } + } + return h; +}; +dhx.eventRemove = function (c) { + if (!c) { + return; + } + dhx.assert(this._events[c], "Removing non-existing event"); + var a = dhx._events[c]; + if (a[0].removeEventListener) { + a[0].removeEventListener(a[1], a[2], false); + } else { + if (a[0].detachEvent) { + a[0].detachEvent("on" + a[1], a[2]); + } + } + delete this._events[c]; +}; +dhx.log = function (c, e, a) { + if (arguments.length == 1) { + e = c; + c = "log"; + } + if (window.console && console.log) { + c = c.toLowerCase(); + if (window.console[c]) { + window.console[c](e || "unknown error"); + } else { + window.console.log(c + ": " + e); + } + if (a) { + window.console.log(a); + } + } +}; +dhx.log_full_time = function (a) { + dhx._start_time_log = new Date(); + dhx.log("Timing start [" + a + "]"); + window.setTimeout(function () { + var c = new Date(); + dhx.log("Timing end [" + a + "]:" + (c.valueOf() - dhx._start_time_log.valueOf()) / 1000 + "s"); + }, 1); +}; +dhx.log_time = function (a) { + var e = "_start_time_log" + a; + if (!dhx[e]) { + dhx[e] = new Date(); + dhx.log("Info", "Timing start [" + a + "]"); + } else { + var c = new Date(); + dhx.log("Info", "Timing end [" + a + "]:" + (c.valueOf() - dhx[e].valueOf()) / 1000 + "s"); + dhx[e] = null; + } +}; +dhx.debug_code = function (a) { + a.call(dhx); +}; +dhx.EventSystem = { + $init: function () { + if (!this._evs_events) { + this._evs_events = {}; + this._evs_handlers = {}; + this._evs_map = {}; + } + }, + blockEvent: function () { + this._evs_events._block = true; + }, + unblockEvent: function () { + this._evs_events._block = false; + }, + mapEvent: function (a) { + dhx.extend(this._evs_map, a, true); + }, + on_setter: function (a) { + if (a) { + for (var c in a) { + if (typeof a[c] == "function") { + this.attachEvent(c, a[c]); + } + } + } + }, + callEvent: function (e, h) { + if (this._evs_events._block) { + return true; + } + e = e.toLowerCase(); + var g = this._evs_events[e.toLowerCase()]; + var a = true; + if (dhx.debug) { + dhx.log("info", "[" + this.name + "] event:" + e, h); + } + if (g) { + for (var c = 0; c < g.length; c++) { + if (g[c].apply(this, h || []) === false) { + a = false; + } + } + } + if (this._evs_map[e] && !this._evs_map[e].callEvent(e, h)) { + a = false; + } + return a; + }, + attachEvent: function (c, a, g) { + dhx.assert(a, "Invalid event handler for " + c); + c = c.toLowerCase(); + g = g || dhx.uid(); + a = dhx.toFunctor(a); + var e = this._evs_events[c] || dhx.toArray(); + e.push(a); + this._evs_events[c] = e; + this._evs_handlers[g] = { f: a, t: c }; + return g; + }, + detachEvent: function (g) { + if (!this._evs_handlers[g]) { + return; + } + var c = this._evs_handlers[g].t; + var a = this._evs_handlers[g].f; + var e = this._evs_events[c]; + e.remove(a); + delete this._evs_handlers[g]; + }, + hasEvent: function (a) { + a = a.toLowerCase(); + return this._evs_events[a] ? true : false; + }, +}; +dhx.extend(dhx, dhx.EventSystem); +dhx.PowerArray = { + removeAt: function (c, a) { + if (c >= 0) { + this.splice(c, a || 1); + } + }, + remove: function (a) { + this.removeAt(this.find(a)); + }, + insertAt: function (c, e) { + if (!e && e !== 0) { + this.push(c); + } else { + var a = this.splice(e, this.length - e); + this[e] = c; + this.push.apply(this, a); + } + }, + find: function (c) { + for (var a = 0; a < this.length; a++) { + if (c == this[a]) { + return a; + } + } + return -1; + }, + each: function (a, e) { + for (var c = 0; c < this.length; c++) { + a.call(e || this, this[c]); + } + }, + map: function (a, e) { + for (var c = 0; c < this.length; c++) { + this[c] = a.call(e || this, this[c]); + } + return this; + }, + filter: function (a, e) { + for (var c = 0; c < this.length; c++) { + if (!a.call(e || this, this[c])) { + this.splice(c, 1); + c--; + } + } + return this; + }, +}; +dhx.env = {}; +(function () { + if (navigator.userAgent.indexOf("Mobile") != -1) { + dhx.env.mobile = true; + } + if (dhx.env.mobile || navigator.userAgent.indexOf("iPad") != -1 || navigator.userAgent.indexOf("Android") != -1) { + dhx.env.touch = true; + } + if (navigator.userAgent.indexOf("Opera") != -1) { + dhx.env.isOpera = true; + } else { + dhx.env.isIE = !!document.all; + dhx.env.isFF = !document.all; + dhx.env.isWebKit = navigator.userAgent.indexOf("KHTML") != -1; + dhx.env.isSafari = dhx.env.isWebKit && navigator.userAgent.indexOf("Mac") != -1; + } + if (navigator.userAgent.toLowerCase().indexOf("android") != -1) { + dhx.env.isAndroid = true; + } + dhx.env.transform = false; + dhx.env.transition = false; + var e = {}; + e.names = ["transform", "transition"]; + e.transform = ["transform", "WebkitTransform", "MozTransform", "OTransform", "msTransform"]; + e.transition = ["transition", "WebkitTransition", "MozTransition", "OTransition", "msTransition"]; + var m = document.createElement("DIV"); + for (var h = 0; h < e.names.length; h++) { + var g = e[e.names[h]]; + for (var c = 0; c < g.length; c++) { + if (typeof m.style[g[c]] != "undefined") { + dhx.env[e.names[h]] = g[c]; + break; + } + } + } + m.style[dhx.env.transform] = "translate3d(0,0,0)"; + dhx.env.translate = m.style[dhx.env.transform] ? "translate3d" : "translate"; + var l = ""; + var a = false; + if (dhx.env.isOpera) { + l = "-o-"; + a = "O"; + } + if (dhx.env.isFF) { + l = "-Moz-"; + } + if (dhx.env.isWebKit) { + l = "-webkit-"; + } + if (dhx.env.isIE) { + l = "-ms-"; + } + dhx.env.transformCSSPrefix = l; + dhx.env.transformPrefix = a || dhx.env.transformCSSPrefix.replace(/-/gi, ""); + dhx.env.transitionEnd = dhx.env.transformCSSPrefix == "-Moz-" ? "transitionend" : dhx.env.transformPrefix + "TransitionEnd"; +})(); +dhx.env.svg = (function () { + return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1"); +})(); +dhx.html = { + _native_on_selectstart: 0, + denySelect: function () { + if (!dhx._native_on_selectstart) { + dhx._native_on_selectstart = document.onselectstart; + } + document.onselectstart = dhx.html.stopEvent; + }, + allowSelect: function () { + if (dhx._native_on_selectstart !== 0) { + document.onselectstart = dhx._native_on_selectstart || null; + } + dhx._native_on_selectstart = 0; + }, + index: function (c) { + var a = 0; + while ((c = c.previousSibling)) { + a++; + } + return a; + }, + _style_cache: {}, + createCss: function (e) { + var g = ""; + for (var c in e) { + g += c + ":" + e[c] + ";"; + } + var a = this._style_cache[g]; + if (!a) { + a = "s" + dhx.uid(); + this.addStyle("." + a + "{" + g + "}"); + this._style_cache[g] = a; + } + return a; + }, + addStyle: function (c) { + var a = document.createElement("style"); + a.setAttribute("type", "text/css"); + a.setAttribute("media", "screen"); + if (a.styleSheet) { + a.styleSheet.cssText = c; + } else { + a.appendChild(document.createTextNode(c)); + } + document.getElementsByTagName("head")[0].appendChild(a); + }, + create: function (c, a, e) { + a = a || {}; + var g = document.createElement(c); + for (var h in a) { + g.setAttribute(h, a[h]); + } + if (a.style) { + g.style.cssText = a.style; + } + if (a["class"]) { + g.className = a["class"]; + } + if (e) { + g.innerHTML = e; + } + return g; + }, + getValue: function (a) { + a = dhx.toNode(a); + if (!a) { + return ""; + } + return dhx.isUndefined(a.value) ? a.innerHTML : a.value; + }, + remove: function (c) { + if (c instanceof Array) { + for (var a = 0; a < c.length; a++) { + this.remove(c[a]); + } + } else { + if (c && c.parentNode) { + c.parentNode.removeChild(c); + } + } + }, + insertBefore: function (c, e, a) { + if (!c) { + return; + } + if (e && e.parentNode) { + e.parentNode.insertBefore(c, e); + } else { + a.appendChild(c); + } + }, + locate: function (c, h) { + if (c.tagName) { + var a = c; + } else { + c = c || event; + var a = c.target || c.srcElement; + } + while (a) { + if (a.getAttribute) { + var g = a.getAttribute(h); + if (g) { + return g; + } + } + a = a.parentNode; + } + return null; + }, + offset: function (g) { + if (g.getBoundingClientRect) { + var l = g.getBoundingClientRect(); + var m = document.body; + var c = document.documentElement; + var a = window.pageYOffset || c.scrollTop || m.scrollTop; + var h = window.pageXOffset || c.scrollLeft || m.scrollLeft; + var j = c.clientTop || m.clientTop || 0; + var n = c.clientLeft || m.clientLeft || 0; + var o = l.top + a - j; + var e = l.left + h - n; + return { y: Math.round(o), x: Math.round(e) }; + } else { + var o = 0, + e = 0; + while (g) { + o = o + parseInt(g.offsetTop, 10); + e = e + parseInt(g.offsetLeft, 10); + g = g.offsetParent; + } + return { y: o, x: e }; + } + }, + posRelative: function (a) { + a = a || event; + if (!dhx.isUndefined(a.offsetX)) { + return { x: a.offsetX, y: a.offsetY }; + } else { + return { x: a.layerX, y: a.layerY }; + } + }, + pos: function (a) { + a = a || event; + if (a.pageX || a.pageY) { + return { x: a.pageX, y: a.pageY }; + } + var c = dhx.env.isIE && document.compatMode != "BackCompat" ? document.documentElement : document.body; + return { x: a.clientX + c.scrollLeft - c.clientLeft, y: a.clientY + c.scrollTop - c.clientTop }; + }, + preventEvent: function (a) { + if (a && a.preventDefault) { + a.preventDefault(); + } + return dhx.html.stopEvent(a); + }, + stopEvent: function (a) { + (a || event).cancelBubble = true; + return false; + }, + addCss: function (c, a) { + c.className += " " + a; + }, + removeCss: function (c, a) { + c.className = c.className.replace(RegExp(" " + a, "g"), ""); + }, +}; +dhx.ready = function (a) { + if (this._ready) { + a.call(); + } else { + this._ready_code.push(a); + } +}; +dhx._ready_code = []; +(function () { + var a = document.getElementsByTagName("SCRIPT"); + dhx.assert(a.length, "Can't locate codebase"); + if (a.length) { + a = (a[a.length - 1].getAttribute("src") || "").split("/"); + a.splice(a.length - 1, 1); + dhx.codebase = a.slice(0, a.length).join("/") + "/"; + } + dhx.event(window, "load", function () { + dhx4.callEvent("onReady", []); + dhx.delay(function () { + dhx._ready = true; + for (var c = 0; c < dhx._ready_code.length; c++) { + dhx._ready_code[c].call(); + } + dhx._ready_code = []; + }); + }); +})(); +dhx.locale = dhx.locale || {}; +dhx.assert_core_ready(); +dhx.ready(function () { + dhx.event(document.body, "click", function (a) { + dhx4.callEvent("onClick", [a || event]); + }); +}); +(function () { + var e = {}; + var c = new RegExp("(\\r\\n|\\n)", "g"); + var a = new RegExp('(\\")', "g"); + dhx.Template = function (h) { + if (typeof h == "function") { + return h; + } + if (e[h]) { + return e[h]; + } + h = (h || "").toString(); + if (h.indexOf("->") != -1) { + h = h.split("->"); + switch (h[0]) { + case "html": + h = dhx.html.getValue(h[1]); + break; + case "http": + h = new dhx.ajax().sync().get(h[1], { uid: dhx.uid() }).responseText; + break; + default: + break; + } + } + h = (h || "").toString(); + h = h.replace(c, "\\n"); + h = h.replace(a, '\\"'); + h = h.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g, '"+(obj.$1?"$2":"$3")+"'); + h = h.replace(/\{common\.([^}\(]*)\}/g, "\"+(common.$1||'')+\""); + h = h.replace(/\{common\.([^\}\(]*)\(\)\}/g, '"+(common.$1?common.$1.apply(this, arguments):"")+"'); + h = h.replace(/\{obj\.([^}]*)\}/g, '"+(obj.$1)+"'); + h = h.replace("{obj}", '"+obj+"'); + h = h.replace(/#([^#'";, ]+)#/gi, '"+(obj.$1)+"'); + try { + e[h] = Function("obj", "common", 'return "' + h + '";'); + } catch (g) { + dhx.assert_error("Invalid template:" + h); + } + return e[h]; + }; + dhx.Template.empty = function () { + return ""; + }; + dhx.Template.bind = function (g) { + return dhx.bind(dhx.Template(g), this); + }; + dhx.Type = function (m, l) { + if (m._dhx_proto_wait) { + if (!m._dhx_type_wait) { + m._dhx_type_wait = []; + } + m._dhx_type_wait.push(l); + return; + } + if (typeof m == "function") { + m = m.prototype; + } + if (!m.types) { + m.types = { default: m.type }; + m.type.name = "default"; + } + var g = l.name; + var j = m.type; + if (g) { + j = m.types[g] = dhx.clone(l.baseType ? m.types[l.baseType] : m.type); + } + for (var h in l) { + if (h.indexOf("template") === 0) { + j[h] = dhx.Template(l[h]); + } else { + j[h] = l[h]; + } + } + return g; + }; +})(); +dhx.Settings = { + $init: function () { + this._settings = this.config = {}; + }, + define: function (c, a) { + if (typeof c == "object") { + return this._parseSeetingColl(c); + } + return this._define(c, a); + }, + _define: function (c, a) { + var e = this[c + "_setter"]; + return (this._settings[c] = e ? e.call(this, a, c) : a); + }, + _parseSeetingColl: function (e) { + if (e) { + for (var c in e) { + this._define(c, e[c]); + } + } + }, + _parseSettings: function (e, a) { + var c = {}; + if (a) { + c = dhx.extend(c, a); + } + if (typeof e == "object" && !e.tagName) { + dhx.extend(c, e, true); + } + this._parseSeetingColl(c); + }, + _mergeSettings: function (a, e) { + for (var c in e) { + switch (typeof a[c]) { + case "object": + a[c] = this._mergeSettings(a[c] || {}, e[c]); + break; + case "undefined": + a[c] = e[c]; + break; + default: + break; + } + } + return a; + }, + debug_freid_c_id: true, + debug_freid_a_name: true, +}; +dhx.ajax = function (a, c, e) { + if (arguments.length !== 0) { + var g = new dhx.ajax(); + if (e) { + g.master = e; + } + return g.get(a, null, c); + } + if (!this.getXHR) { + return new dhx.ajax(); + } + return this; +}; +dhx.ajax.count = 0; +dhx.ajax.prototype = { + master: null, + getXHR: function () { + if (dhx.env.isIE) { + return new ActiveXObject("Microsoft.xmlHTTP"); + } else { + return new XMLHttpRequest(); + } + }, + send: function (h, n, l) { + var c = this.getXHR(); + if (!dhx.isArray(l)) { + l = [l]; + } + if (typeof n == "object") { + var j = []; + for (var e in n) { + var m = n[e]; + if (m === null || m === dhx.undefined) { + m = ""; + } + j.push(e + "=" + encodeURIComponent(m)); + } + n = j.join("&"); + } + if (n && this.request === "GET") { + h = h + (h.indexOf("?") != -1 ? "&" : "?") + n; + n = null; + } + c.open(this.request, h, !this._sync); + if (this.request === "POST") { + c.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + } + var g = this; + c.onreadystatechange = function () { + if (!c.readyState || c.readyState == 4) { + if (dhx.debug_time) { + dhx.log_full_time("data_loading"); + } + dhx.ajax.count++; + if (l && g) { + for (var a = 0; a < l.length; a++) { + if (l[a]) { + var o = l[a].success || l[a]; + if (c.status >= 400 || (!c.status && !c.responseText)) { + o = l[a].error; + } + if (o) { + o.call(g.master || g, c.responseText, c.responseXML, c); + } + } + } + } + if (g) { + g.master = null; + } + l = g = null; + } + }; + c.send(n || null); + return c; + }, + get: function (a, e, c) { + if (arguments.length == 2) { + c = e; + e = null; + } + this.request = "GET"; + return this.send(a, e, c); + }, + post: function (a, e, c) { + this.request = "POST"; + return this.send(a, e, c); + }, + put: function (a, e, c) { + this.request = "PUT"; + return this.send(a, e, c); + }, + del: function (a, e, c) { + this.request = "DELETE"; + return this.send(a, e, c); + }, + sync: function () { + this._sync = true; + return this; + }, + bind: function (a) { + this.master = a; + return this; + }, +}; +dhx.send = function (e, c, l, j) { + var g = dhx.html.create("FORM", { target: j || "_self", action: e, method: l || "POST" }, ""); + for (var a in c) { + var h = dhx.html.create("INPUT", { type: "hidden", name: a, value: c[a] }, ""); + g.appendChild(h); + } + g.style.display = "none"; + document.body.appendChild(g); + g.submit(); + document.body.removeChild(g); +}; +dhx.AtomDataLoader = { + $init: function (a) { + this.data = {}; + if (a) { + this._settings.datatype = a.datatype || "json"; + this.$ready.push(this._load_when_ready); + } + }, + _load_when_ready: function () { + this._ready_for_data = true; + if (this._settings.url) { + this.url_setter(this._settings.url); + } + if (this._settings.data) { + this.data_setter(this._settings.data); + } + }, + url_setter: function (a) { + if (!this._ready_for_data) { + return a; + } + this.load(a, this._settings.datatype); + return a; + }, + data_setter: function (a) { + if (!this._ready_for_data) { + return a; + } + this.parse(a, this._settings.datatype); + return true; + }, + debug_freid_c_datatype: true, + debug_freid_c_dataFeed: true, + load: function (a, c) { + if (a.$proxy) { + a.load(this, typeof c == "string" ? c : "json"); + return; + } + this.callEvent("onXLS", []); + if (typeof c == "string") { + this.data.driver = dhx.DataDriver[c]; + c = arguments[2]; + } else { + if (!this.data.driver) { + this.data.driver = dhx.DataDriver.json; + } + } + var e = [{ success: this._onLoad, error: this._onLoadError }]; + if (c) { + if (dhx.isArray(c)) { + e.push.apply(e, c); + } else { + e.push(c); + } + } + return dhx.ajax(a, e, this); + }, + parse: function (c, a) { + this.callEvent("onXLS", []); + this.data.driver = dhx.DataDriver[a || "json"]; + this._onLoad(c, null); + }, + _onLoad: function (l, c, a, e) { + var h = this.data.driver; + var g = h.toObject(l, c); + if (g) { + var j = h.getRecords(g)[0]; + this.data = h ? h.getDetails(j) : l; + } else { + this._onLoadError(l, c, a); + } + this.callEvent("onXLE", []); + }, + _onLoadError: function (e, a, c) { + this.callEvent("onXLE", []); + this.callEvent("onLoadError", arguments); + dhx4.callEvent("onLoadError", [e, a, c, this]); + }, + _check_data_feed: function (c) { + if (!this._settings.dataFeed || this._ignore_feed || !c) { + return true; + } + var a = this._settings.dataFeed; + if (typeof a == "function") { + return a.call(this, c.id || c, c); + } + a = a + (a.indexOf("?") == -1 ? "?" : "&") + "action=get&id=" + encodeURIComponent(c.id || c); + this.callEvent("onXLS", []); + dhx.ajax( + a, + function (j, g, e) { + this._ignore_feed = true; + var h = dhx.DataDriver.toObject(j, g); + if (h) { + this.setValues(h.getDetails(h.getRecords()[0])); + } else { + this._onLoadError(j, g, e); + } + this._ignore_feed = false; + this.callEvent("onXLE", []); + }, + this + ); + return false; + }, +}; +dhx.DataDriver = {}; +dhx.DataDriver.json = { + toObject: function (data) { + if (!data) { + data = "[]"; + } + if (typeof data == "string") { + try { + eval("dhx.temp=" + data); + } catch (e) { + dhx.assert_error(e); + return null; + } + data = dhx.temp; + } + if (data.data) { + var t = (data.data.config = {}); + for (var key in data) { + if (key != "data") { + t[key] = data[key]; + } + } + data = data.data; + } + return data; + }, + getRecords: function (a) { + if (a && !dhx.isArray(a)) { + return [a]; + } + return a; + }, + getDetails: function (a) { + if (typeof a == "string") { + return { id: dhx.uid(), value: a }; + } + return a; + }, + getInfo: function (c) { + var a = c.config; + if (!a) { + return {}; + } + return { _size: a.total_count || 0, _from: a.pos || 0, _parent: a.parent || 0, _config: a.config, _key: a.dhx_security }; + }, + child: "data", +}; +dhx.DataDriver.html = { + toObject: function (c) { + if (typeof c == "string") { + var a = null; + if (c.indexOf("<") == -1) { + a = dhx.toNode(c); + } + if (!a) { + a = document.createElement("DIV"); + a.innerHTML = c; + } + return a.getElementsByTagName(this.tag); + } + return c; + }, + getRecords: function (c) { + var e = []; + for (var a = 0; a < c.childNodes.length; a++) { + var g = c.childNodes[a]; + if (g.nodeType == 1) { + e.push(g); + } + } + return e; + }, + getDetails: function (a) { + return dhx.DataDriver.xml.tagToObject(a); + }, + getInfo: function (a) { + return { _size: 0, _from: 0 }; + }, + tag: "LI", +}; +dhx.DataDriver.jsarray = { + toObject: function (data) { + if (typeof data == "string") { + eval("dhx.temp=" + data); + return dhx.temp; + } + return data; + }, + getRecords: function (a) { + return a; + }, + getDetails: function (e) { + var a = {}; + for (var c = 0; c < e.length; c++) { + a["data" + c] = e[c]; + } + return a; + }, + getInfo: function (a) { + return { _size: 0, _from: 0 }; + }, +}; +dhx.DataDriver.csv = { + toObject: function (a) { + return a; + }, + getRecords: function (a) { + return a.split(this.row); + }, + getDetails: function (e) { + e = this.stringToArray(e); + var a = {}; + for (var c = 0; c < e.length; c++) { + a["data" + c] = e[c]; + } + return a; + }, + getInfo: function (a) { + return { _size: 0, _from: 0 }; + }, + stringToArray: function (c) { + c = c.split(this.cell); + for (var a = 0; a < c.length; a++) { + c[a] = c[a].replace(/^[ \t\n\r]*(\"|)/g, "").replace(/(\"|)[ \t\n\r]*$/g, ""); + } + return c; + }, + row: "\n", + cell: ",", +}; +dhx.DataDriver.xml = { + _isValidXML: function (a) { + if (!a || !a.documentElement) { + return null; + } + if (a.getElementsByTagName("parsererror").length) { + return null; + } + return a; + }, + toObject: function (e, a) { + if (this._isValidXML(c)) { + return c; + } + if (typeof e == "string") { + var c = this.fromString(e.replace(/^[\s]+/, "")); + } else { + c = e; + } + if (this._isValidXML(c)) { + return c; + } + return null; + }, + getRecords: function (a) { + return this.xpath(a, this.records); + }, + records: "/*/item", + child: "item", + config: "/*/config", + getDetails: function (a) { + return this.tagToObject(a, {}); + }, + getInfo: function (c) { + var a = this.xpath(c, this.config); + if (a.length) { + a = this.assignTypes(this.tagToObject(a[0], {})); + } else { + a = null; + } + return { + _size: c.documentElement.getAttribute("total_count") || 0, + _from: c.documentElement.getAttribute("pos") || 0, + _parent: c.documentElement.getAttribute("parent") || 0, + _config: a, + _key: c.documentElement.getAttribute("dhx_security") || null, + }; + }, + xpath: function (h, o) { + if (window.XPathResult) { + var g = h; + if (h.nodeName.indexOf("document") == -1) { + h = h.ownerDocument; + } + var m = []; + var c = h.evaluate(o, g, null, XPathResult.ANY_TYPE, null); + var n = c.iterateNext(); + while (n) { + m.push(n); + n = c.iterateNext(); + } + return m; + } else { + var l = true; + try { + if (typeof h.selectNodes == "undefined") { + l = false; + } + } catch (j) {} + if (l) { + return h.selectNodes(o); + } else { + var a = o.split("/").pop(); + return h.getElementsByTagName(a); + } + } + }, + assignTypes: function (c) { + for (var a in c) { + var e = c[a]; + if (typeof e == "object") { + this.assignTypes(e); + } else { + if (typeof e == "string") { + if (e === "") { + continue; + } + if (e == "true") { + c[a] = true; + } else { + if (e == "false") { + c[a] = false; + } else { + if (e == e * 1) { + c[a] = c[a] * 1; + } + } + } + } + } + } + return c; + }, + tagToObject: function (e, n) { + n = n || {}; + var h = false; + var g = e.attributes; + if (g && g.length) { + for (var l = 0; l < g.length; l++) { + n[g[l].name] = g[l].value; + } + h = true; + } + var c = e.childNodes; + var m = {}; + for (var l = 0; l < c.length; l++) { + if (c[l].nodeType == 1) { + var j = c[l].tagName; + if (typeof n[j] != "undefined") { + if (!dhx.isArray(n[j])) { + n[j] = [n[j]]; + } + n[j].push(this.tagToObject(c[l], {})); + } else { + n[c[l].tagName] = this.tagToObject(c[l], {}); + } + h = true; + } + } + if (!h) { + return this.nodeValue(e); + } + n.value = n.value || this.nodeValue(e); + return n; + }, + nodeValue: function (a) { + if (a.firstChild) { + return a.firstChild.data; + } + return ""; + }, + fromString: function (g) { + try { + if (window.DOMParser) { + return new DOMParser().parseFromString(g, "text/xml"); + } + if (window.ActiveXObject) { + var a = new ActiveXObject("Microsoft.xmlDOM"); + a.loadXML(g); + return a; + } + } catch (c) { + dhx.assert_error(c); + return null; + } + dhx.assert_error("Load from xml string is not supported"); + }, +}; +dhx.DataLoader = dhx.proto( + { + $init: function (a) { + a = a || ""; + this._ajax_queue = dhx.toArray(); + this.data = new dhx.DataStore(); + this.data.attachEvent("onClearAll", dhx.bind(this._call_onclearall, this)); + this.data.attachEvent("onServerConfig", dhx.bind(this._call_on_config, this)); + this.data.feed = this._feed; + }, + _feed: function (e, a, c) { + if (this._load_count) { + return (this._load_count = [e, a, c]); + } else { + this._load_count = true; + } + this._feed_last = [e, a]; + this._feed_common.call(this, e, a, c); + }, + _feed_common: function (g, c, e) { + var a = this.data.url; + if (g < 0) { + g = 0; + } + this.load(a + (a.indexOf("?") == -1 ? "?" : "&") + (this.dataCount() ? "continue=true&" : "") + "start=" + g + "&count=" + c, [this._feed_callback, e]); + }, + _feed_callback: function () { + var a = this._load_count; + var c = this._feed_last; + this._load_count = false; + if (typeof a == "object" && (a[0] != c[0] || a[1] != c[1])) { + this.data.feed.apply(this, a); + } + }, + load: function (a, c) { + var e = dhx.AtomDataLoader.load.apply(this, arguments); + this._ajax_queue.push(e); + if (!this.data.url) { + this.data.url = a; + } + }, + loadNext: function (e, h, g, c, a) { + if (this._settings.datathrottle && !a) { + if (this._throttle_request) { + window.clearTimeout(this._throttle_request); + } + this._throttle_request = dhx.delay( + function () { + this.loadNext(e, h, g, c, true); + }, + this, + 0, + this._settings.datathrottle + ); + return; + } + if (!h && h !== 0) { + h = this.dataCount(); + } + this.data.url = this.data.url || c; + if (this.callEvent("onDataRequest", [h, e, g, c]) && this.data.url) { + this.data.feed.call(this, h, e, g); + } + }, + _maybe_loading_already: function (c, e) { + var a = this._feed_last; + if (this._load_count && a) { + if (a[0] <= e && a[1] + a[0] >= c + e) { + return true; + } + } + return false; + }, + _onLoad: function (g, c, a) { + this._ajax_queue.remove(a); + var e = this.data.driver.toObject(g, c); + if (e) { + this.data._parse(e); + } else { + return this._onLoadError(g, c, a); + } + this._call_onready(); + this.callEvent("onXLE", []); + }, + removeMissed_setter: function (a) { + return (this.data._removeMissed = a); + }, + scheme_setter: function (a) { + this.data.scheme(a); + }, + dataFeed_setter: function (a) { + this.data.attachEvent( + "onBeforeFilter", + dhx.bind(function (l, j) { + if (this._settings.dataFeed) { + var h = {}; + if (!l && !j) { + return; + } + if (typeof l == "function") { + if (!j) { + return; + } + l(j, h); + } else { + h = { text: j }; + } + this.clearAll(); + var c = this._settings.dataFeed; + var g = []; + if (typeof c == "function") { + return c.call(this, j, h); + } + for (var e in h) { + g.push("dhx_filter[" + e + "]=" + encodeURIComponent(h[e])); + } + this.load(c + (c.indexOf("?") < 0 ? "?" : "&") + g.join("&"), this._settings.datatype); + return false; + } + }, this) + ); + return a; + }, + debug_freid_c_ready: true, + debug_freid_c_datathrottle: true, + _call_onready: function () { + if (this._settings.ready && !this._ready_was_used) { + var a = dhx.toFunctor(this._settings.ready); + if (a) { + dhx.delay(a, this, arguments); + } + this._ready_was_used = true; + } + }, + _call_onclearall: function () { + for (var a = 0; a < this._ajax_queue.length; a++) { + this._ajax_queue[a].abort(); + } + this._ajax_queue = dhx.toArray(); + }, + _call_on_config: function (a) { + this._parseSeetingColl(a); + }, + }, + dhx.AtomDataLoader +); +dhx.DataStore = function () { + this.name = "DataStore"; + dhx.extend(this, dhx.EventSystem); + this.setDriver("json"); + this.pull = {}; + this.order = dhx.toArray(); + this._marks = {}; +}; +dhx.DataStore.prototype = { + setDriver: function (a) { + dhx.assert(dhx.DataDriver[a], "incorrect DataDriver"); + this.driver = dhx.DataDriver[a]; + }, + _parse: function (e, a) { + this.callEvent("onParse", [this.driver, e]); + if (this._filter_order) { + this.filter(); + } + var g = this.driver.getInfo(e); + if (g._key) { + dhx.securityKey = g._key; + } + if (g._config) { + this.callEvent("onServerConfig", [g._config]); + } + var c = this.driver.getRecords(e); + this._inner_parse(g, c); + if (this._scheme_group && this._group_processing) { + this._group_processing(this._scheme_group); + } + if (this._scheme_sort) { + this.blockEvent(); + this.sort(this._scheme_sort); + this.unblockEvent(); + } + this.callEvent("onStoreLoad", [this.driver, e]); + this.refresh(); + }, + _inner_parse: function (c, m) { + var o = (c._from || 0) * 1; + var l = true; + var n = false; + if (o === 0 && this.order[0]) { + if (this._removeMissed) { + n = {}; + for (var g = 0; g < this.order.length; g++) { + n[this.order[g]] = true; + } + } + l = false; + o = this.order.length; + } + var e = 0; + for (var g = 0; g < m.length; g++) { + var r = this.driver.getDetails(m[g]); + var a = this.id(r); + if (!this.pull[a]) { + this.order[e + o] = a; + e++; + } else { + if (l && this.order[e + o]) { + e++; + } + } + if (this.pull[a]) { + dhx.extend(this.pull[a], r, true); + if (this._scheme_update) { + this._scheme_update(this.pull[a]); + } + if (n) { + delete n[a]; + } + } else { + this.pull[a] = r; + if (this._scheme_init) { + this._scheme_init(r); + } + } + } + if (n) { + this.blockEvent(); + for (var h in n) { + this.remove(h); + } + this.unblockEvent(); + } + if (!this.order[c._size - 1]) { + this.order[c._size - 1] = dhx.undefined; + } + }, + id: function (a) { + return a.id || (a.id = dhx.uid()); + }, + changeId: function (c, a) { + if (this.pull[c]) { + this.pull[a] = this.pull[c]; + } + this.pull[a].id = a; + this.order[this.order.find(c)] = a; + if (this._filter_order) { + this._filter_order[this._filter_order.find(c)] = a; + } + if (this._marks[c]) { + this._marks[a] = this._marks[c]; + delete this._marks[c]; + } + this.callEvent("onIdChange", [c, a]); + if (this._render_change_id) { + this._render_change_id(c, a); + } + delete this.pull[c]; + }, + item: function (a) { + return this.pull[a]; + }, + update: function (c, a) { + if (dhx.isUndefined(a)) { + a = this.item(c); + } + if (this._scheme_update) { + this._scheme_update(a); + } + if (this.callEvent("onBeforeUpdate", [c, a]) === false) { + return false; + } + this.pull[c] = a; + this.callEvent("onStoreUpdated", [c, a, "update"]); + }, + refresh: function (a) { + if (this._skip_refresh) { + return; + } + if (a) { + this.callEvent("onStoreUpdated", [a, this.pull[a], "paint"]); + } else { + this.callEvent("onStoreUpdated", [null, null, null]); + } + }, + silent: function (c, a) { + this._skip_refresh = true; + c.call(a || this); + this._skip_refresh = false; + }, + getRange: function (g, e) { + if (g) { + g = this.indexById(g); + } else { + g = this.$min || this.startOffset || 0; + } + if (e) { + e = this.indexById(e); + } else { + e = Math.min(this.$max || this.endOffset || Infinity, this.dataCount() - 1); + if (e < 0) { + e = 0; + } + } + if (g > e) { + var c = e; + e = g; + g = c; + } + return this.getIndexRange(g, e); + }, + getIndexRange: function (g, e) { + e = Math.min(e || Infinity, this.dataCount() - 1); + var a = dhx.toArray(); + for (var c = g || 0; c <= e; c++) { + a.push(this.item(this.order[c])); + } + return a; + }, + dataCount: function () { + return this.order.length; + }, + exists: function (a) { + return !!this.pull[a]; + }, + move: function (a, g) { + dhx.assert(a >= 0 && g >= 0, "DataStore::move", "Incorrect indexes"); + var e = this.idByIndex(a); + var c = this.item(e); + this.order.removeAt(a); + this.order.insertAt(e, Math.min(this.order.length, g)); + this.callEvent("onStoreUpdated", [e, c, "move"]); + }, + scheme: function (a) { + this._scheme = {}; + this._scheme_init = a.$init; + this._scheme_update = a.$update; + this._scheme_serialize = a.$serialize; + this._scheme_group = a.$group; + this._scheme_sort = a.$sort; + for (var c in a) { + if (c.substr(0, 1) != "$") { + this._scheme[c] = a[c]; + } + } + }, + sync: function (g, e, a) { + if (typeof g == "string") { + g = $$("source"); + } + if (typeof e != "function") { + a = e; + e = null; + } + if (dhx.debug_bind) { + this.debug_sync_master = g; + dhx.log("[sync] " + this.debug_bind_master.name + "@" + this.debug_bind_master._settings.id + " <= " + this.debug_sync_master.name + "@" + this.debug_sync_master._settings.id); + } + this._backbone_source = false; + if (g.name != "DataStore") { + if (g.data && g.data.name == "DataStore") { + g = g.data; + } else { + this._backbone_source = true; + } + } + var c = dhx.bind(function (m, h, l) { + if (this._backbone_source) { + if (!m) { + return; + } + if (m.indexOf("change") === 0) { + if (m == "change") { + this.pull[h.id] = h.attributes; + this.refresh(h.id); + return; + } else { + return; + } + } + if (m == "reset") { + l = h; + } + this.order = []; + this.pull = {}; + this._filter_order = null; + for (var j = 0; j < l.models.length; j++) { + var n = l.models[j].id; + this.order.push(n); + this.pull[n] = l.models[j].attributes; + } + } else { + this._filter_order = null; + this.order = dhx.toArray([].concat(g.order)); + this.pull = g.pull; + } + if (e) { + this.silent(e); + } + if (this._on_sync) { + this._on_sync(); + } + if (dhx.debug_bind) { + dhx.log("[sync:request] " + this.debug_sync_master.name + "@" + this.debug_sync_master._settings.id + " <= " + this.debug_bind_master.name + "@" + this.debug_bind_master._settings.id); + } + this.callEvent("onSyncApply", []); + if (!a) { + this.refresh(); + } else { + a = false; + } + }, this); + if (this._backbone_source) { + g.bind("all", c); + } else { + this._sync_events = [ + g.attachEvent("onStoreUpdated", c), + g.attachEvent( + "onIdChange", + dhx.bind(function (h, j) { + this.changeId(h, j); + }, this) + ), + ]; + } + c(); + }, + add: function (j, c) { + if (this._scheme) { + for (var e in this._scheme) { + if (dhx.isUndefined(j[e])) { + j[e] = this._scheme[e]; + } + } + } + if (this._scheme_init) { + this._scheme_init(j); + } + var l = this.id(j); + var a = arguments[2] || this.order; + var h = a.length; + if (dhx.isUndefined(c) || c < 0) { + c = h; + } + if (c > h) { + dhx.log("Warning", "DataStore:add", "Index of out of bounds"); + c = Math.min(a.length, c); + } + if (this.callEvent("onBeforeAdd", [l, j, c]) === false) { + return false; + } + dhx.assert(!this.exists(l), "Not unique ID"); + this.pull[l] = j; + a.insertAt(l, c); + if (this._filter_order) { + var g = this._filter_order.length; + if (!c && this.order.length) { + g = 0; + } + this._filter_order.insertAt(l, g); + } + this.callEvent("onAfterAdd", [l, c]); + this.callEvent("onStoreUpdated", [l, j, "add"]); + return l; + }, + remove: function (e) { + if (dhx.isArray(e)) { + for (var a = 0; a < e.length; a++) { + this.remove(e[a]); + } + return; + } + if (this.callEvent("onBeforeDelete", [e]) === false) { + return false; + } + dhx.assert(this.exists(e), "Not existing ID in remove command" + e); + var c = this.item(e); + this.order.remove(e); + if (this._filter_order) { + this._filter_order.remove(e); + } + delete this.pull[e]; + if (this._marks[e]) { + delete this._marks[e]; + } + this.callEvent("onAfterDelete", [e]); + this.callEvent("onStoreUpdated", [e, c, "delete"]); + }, + clearAll: function () { + this.pull = {}; + this.order = dhx.toArray(); + this._filter_order = this.url = null; + this.callEvent("onClearAll", []); + this.refresh(); + }, + idByIndex: function (a) { + if (a >= this.order.length || a < 0) { + dhx.log("Warning", "DataStore::idByIndex Incorrect index"); + } + return this.order[a]; + }, + indexById: function (c) { + var a = this.order.find(c); + if (!this.pull[c]) { + dhx.log("Warning", "DataStore::indexById Non-existing ID: " + c); + } + return a; + }, + next: function (c, a) { + return this.order[this.indexById(c) + (a || 1)]; + }, + first: function () { + return this.order[0]; + }, + last: function () { + return this.order[this.order.length - 1]; + }, + previous: function (c, a) { + return this.order[this.indexById(c) - (a || 1)]; + }, + sort: function (h, c, a) { + var e = h; + if (typeof h == "function") { + e = { as: h, dir: c }; + } else { + if (typeof h == "string") { + e = { by: h.replace(/#/g, ""), dir: c, as: a }; + } + } + var g = [e.by, e.dir, e.as]; + if (!this.callEvent("onBeforeSort", g)) { + return; + } + this._sort_core(e); + this.refresh(); + this.callEvent("onAfterSort", g); + }, + _sort_core: function (a) { + if (this.order.length) { + var e = this._sort._create(a); + var c = this.getRange(this.first(), this.last()); + c.sort(e); + this.order = c.map(function (g) { + dhx.assert(g, "Client sorting can't be used with dynamic loading"); + return this.id(g); + }, this); + } + }, + _filter_reset: function (a) { + if (this._filter_order && !a) { + this.order = this._filter_order; + delete this._filter_order; + } + }, + _filter_core: function (e, h, c) { + var g = dhx.toArray(); + for (var a = 0; a < this.order.length; a++) { + var j = this.order[a]; + if (e(this.item(j), h)) { + g.push(j); + } + } + if (!c || !this._filter_order) { + this._filter_order = this.order; + } + this.order = g; + }, + filter: function (g, e, a) { + if (!this.callEvent("onBeforeFilter", [g, e])) { + return; + } + this._filter_reset(a); + if (!this.order.length) { + return; + } + if (g) { + var c = g; + e = e || ""; + if (typeof g == "string") { + g = g.replace(/#/g, ""); + if (typeof e == "function") { + c = function (h) { + return e(h[g]); + }; + } else { + e = e.toString().toLowerCase(); + c = function (j, h) { + dhx.assert(j, "Client side filtering can't be used with dynamic loading"); + return (j[g] || "").toString().toLowerCase().indexOf(h) != -1; + }; + } + } + this._filter_core(c, e, a, this._filterMode); + } + this.refresh(); + this.callEvent("onAfterFilter", []); + }, + each: function (e, c) { + for (var a = 0; a < this.order.length; a++) { + e.call(c || this, this.item(this.order[a])); + } + }, + _methodPush: function (a, c) { + return function () { + return a[c].apply(a, arguments); + }; + }, + addMark: function (h, g, a, c) { + var e = this._marks[h] || {}; + this._marks[h] = e; + if (!e[g]) { + e[g] = c || true; + if (a) { + this.item(h).$css = (this.item(h).$css || "") + " " + g; + this.refresh(h); + } + } + return e[g]; + }, + removeMark: function (h, g, a) { + var e = this._marks[h]; + if (e && e[g]) { + delete e[g]; + } + if (a) { + var c = this.item(h).$css; + if (c) { + this.item(h).$css = c.replace(g, ""); + this.refresh(h); + } + } + }, + hasMark: function (e, c) { + var a = this._marks[e]; + return a && a[c]; + }, + provideApi: function (g, c) { + this.debug_bind_master = g; + if (c) { + this.mapEvent({ onbeforesort: g, onaftersort: g, onbeforeadd: g, onafteradd: g, onbeforedelete: g, onafterdelete: g, onbeforeupdate: g }); + } + var e = ["sort", "add", "remove", "exists", "idByIndex", "indexById", "item", "update", "refresh", "dataCount", "filter", "next", "previous", "clearAll", "first", "last", "serialize", "sync", "addMark", "removeMark", "hasMark"]; + for (var a = 0; a < e.length; a++) { + g[e[a]] = this._methodPush(this, e[a]); + } + }, + serialize: function () { + var g = this.order; + var a = []; + for (var c = 0; c < g.length; c++) { + var e = this.pull[g[c]]; + if (this._scheme_serialize) { + e = this._scheme_serialize(e); + if (e === false) { + continue; + } + } + a.push(e); + } + return a; + }, + _sort: { + _create: function (a) { + return this._dir(a.dir, this._by(a.by, a.as)); + }, + _as: { + date: function (e, c) { + e = e - 0; + c = c - 0; + return e > c ? 1 : e < c ? -1 : 0; + }, + int: function (e, c) { + e = e * 1; + c = c * 1; + return e > c ? 1 : e < c ? -1 : 0; + }, + string_strict: function (e, c) { + e = e.toString(); + c = c.toString(); + return e > c ? 1 : e < c ? -1 : 0; + }, + string: function (e, c) { + if (!c) { + return 1; + } + if (!e) { + return -1; + } + e = e.toString().toLowerCase(); + c = c.toString().toLowerCase(); + return e > c ? 1 : e < c ? -1 : 0; + }, + }, + _by: function (c, a) { + if (!c) { + return a; + } + if (typeof a != "function") { + a = this._as[a || "string"]; + } + dhx.assert(a, "Invalid sorting method"); + return function (g, e) { + return a(g[c], e[c]); + }; + }, + _dir: function (c, a) { + if (c == "asc" || !c) { + return a; + } + return function (g, e) { + return a(g, e) * -1; + }; + }, + }, +}; +dhx.BaseBind = { + debug_freid_ignore: { id: true }, + bind: function (h, g, e) { + if (typeof h == "string") { + h = dhx.ui.get(h); + } + if (h._initBindSource) { + h._initBindSource(); + } + if (this._initBindSource) { + this._initBindSource(); + } + if (!h.getBindData) { + dhx.extend(h, dhx.BindSource); + } + if (!this._bind_ready) { + var j = this.render; + if (this.filter) { + var c = this._settings.id; + this.data._on_sync = function () { + h._bind_updated[c] = false; + }; + } + this.render = function () { + if (this._in_bind_processing) { + return; + } + this._in_bind_processing = true; + var l = this.callEvent("onBindRequest"); + this._in_bind_processing = false; + return j.apply(this, l === false ? arguments : []); + }; + if (this.getValue || this.getValues) { + this.save = function () { + if (this.validate && !this.validate()) { + return; + } + h.setBindData(this.getValue ? this.getValue : this.getValues(), this._settings.id); + }; + } + this._bind_ready = true; + } + h.addBind(this._settings.id, g, e); + if (dhx.debug_bind) { + dhx.log("[bind] " + this.name + "@" + this._settings.id + " <= " + h.name + "@" + h._settings.id); + } + var a = this._settings.id; + this.attachEvent(this.touchable ? "onAfterRender" : "onBindRequest", function () { + return h.getBindData(a); + }); + if (!this._settings.dataFeed && this.loadNext) { + this.data.attachEvent("onStoreLoad", function () { + h._bind_updated[a] = false; + }); + } + if (this.isVisible(this._settings.id)) { + this.refresh(); + } + }, + unbind: function (a) { + return this._unbind(a); + }, + _unbind: function (e) { + e.removeBind(this._settings.id); + var c = this._sync_events || (this.data ? this.data._sync_events : 0); + if (c && e.data) { + for (var a = 0; a < c.length; a++) { + e.data.detachEvent(c[a]); + } + } + }, +}; +dhx.BindSource = { + $init: function () { + this._bind_hash = {}; + this._bind_updated = {}; + this._ignore_binds = {}; + this._bind_specific_rules(this); + }, + saveBatch: function (a) { + this._do_not_update_binds = true; + a.call(this); + this._do_not_update_binds = false; + this._update_binds(); + }, + setBindData: function (c, a) { + if (a) { + this._ignore_binds[a] = true; + } + if (dhx.debug_bind) { + dhx.log("[bind:save] " + this.name + "@" + this._settings.id + " <= @" + a); + } + if (this.setValue) { + this.setValue(c); + } else { + if (this.setValues) { + this.setValues(c); + } else { + var e = this.getCursor(); + if (e) { + c = dhx.extend(this.item(e), c, true); + this.update(e, c); + } + } + } + this.callEvent("onBindUpdate", [c, a]); + if (this.save) { + this.save(); + } + if (a) { + this._ignore_binds[a] = false; + } + }, + getBindData: function (a, e) { + if (this._bind_updated[a]) { + return false; + } + var c = dhx.ui.get(a); + if (c.isVisible(c._settings.id)) { + this._bind_updated[a] = true; + if (dhx.debug_bind) { + dhx.log("[bind:request] " + this.name + "@" + this._settings.id + " => " + c.name + "@" + c._settings.id); + } + this._bind_update(c, this._bind_hash[a][0], this._bind_hash[a][1]); + if (e && c.filter) { + c.refresh(); + } + } + }, + addBind: function (a, e, c) { + this._bind_hash[a] = [e, c]; + }, + removeBind: function (a) { + delete this._bind_hash[a]; + delete this._bind_updated[a]; + delete this._ignore_binds[a]; + }, + _bind_specific_rules: function (a) { + if (a.filter) { + dhx.extend(this, dhx.CollectionBind); + } else { + if (a.setValue) { + dhx.extend(this, dhx.ValueBind); + } else { + dhx.extend(this, dhx.RecordBind); + } + } + }, + _update_binds: function () { + if (!this._do_not_update_binds) { + for (var a in this._bind_hash) { + if (this._ignore_binds[a]) { + continue; + } + this._bind_updated[a] = false; + this.getBindData(a, true); + } + } + }, + _bind_update_common: function (e, c, a) { + if (e.setValue) { + e.setValue(a ? a[c] : a); + } else { + if (!e.filter) { + if (!a && e.clear) { + e.clear(); + } else { + if (e._check_data_feed(a)) { + e.setValues(dhx.clone(a)); + } + } + } else { + e.data.silent(function () { + this.filter(c, a); + }); + } + } + e.callEvent("onBindApply", [a, c, this]); + }, +}; +dhx.DataValue = dhx.proto( + { + name: "DataValue", + isVisible: function () { + return true; + }, + $init: function (a) { + this.data = "" || a; + var c = a && a.id ? a.id : dhx.uid(); + this._settings = { id: c }; + dhx.ui.views[c] = this; + }, + setValue: function (a) { + this.data = a; + this.callEvent("onChange", [a]); + }, + getValue: function () { + return this.data; + }, + refresh: function () { + this.callEvent("onBindRequest"); + }, + }, + dhx.EventSystem, + dhx.BaseBind +); +dhx.DataRecord = dhx.proto( + { + name: "DataRecord", + isVisible: function () { + return true; + }, + $init: function (a) { + this.data = a || {}; + var c = a && a.id ? a.id : dhx.uid(); + this._settings = { id: c }; + dhx.ui.views[c] = this; + }, + getValues: function () { + return this.data; + }, + setValues: function (a) { + this.data = a; + this.callEvent("onChange", [a]); + }, + refresh: function () { + this.callEvent("onBindRequest"); + }, + }, + dhx.EventSystem, + dhx.BaseBind, + dhx.AtomDataLoader, + dhx.Settings +); +dhx.DataCollection = dhx.proto( + { + name: "DataCollection", + isVisible: function () { + if (!this.data.order.length && !this.data._filter_order && !this._settings.dataFeed) { + return false; + } + return true; + }, + $init: function (a) { + this.data.provideApi(this, true); + var c = a && a.id ? a.id : dhx.uid(); + this._settings.id = c; + dhx.ui.views[c] = this; + this.data.attachEvent( + "onStoreLoad", + dhx.bind(function () { + this.callEvent("onBindRequest", []); + }, this) + ); + }, + refresh: function () { + this.callEvent("onBindRequest", []); + }, + }, + dhx.DataLoader, + dhx.EventSystem, + dhx.BaseBind, + dhx.Settings +); +dhx.ValueBind = { + $init: function () { + this.attachEvent("onChange", this._update_binds); + }, + _bind_update: function (h, g, e) { + var c = this.getValue() || ""; + if (e) { + c = e(c); + } + if (h.setValue) { + h.setValue(c); + } else { + if (!h.filter) { + var a = {}; + a[g] = c; + if (h._check_data_feed(c)) { + h.setValues(a); + } + } else { + h.data.silent(function () { + this.filter(g, c); + }); + } + } + h.callEvent("onBindApply", [c, g, this]); + }, +}; +dhx.RecordBind = { + $init: function () { + this.attachEvent("onChange", this._update_binds); + }, + _bind_update: function (e, c) { + var a = this.getValues() || null; + this._bind_update_common(e, c, a); + }, +}; +dhx.CollectionBind = { + $init: function () { + this._cursor = null; + this.attachEvent("onSelectChange", function (c) { + var a = this.getSelected(); + this.setCursor(a ? a.id || a : null); + }); + this.attachEvent("onAfterCursorChange", this._update_binds); + this.data.attachEvent( + "onStoreUpdated", + dhx.bind(function (e, a, c) { + if (e && e == this.getCursor() && c != "paint") { + this._update_binds(); + } + }, this) + ); + this.data.attachEvent( + "onClearAll", + dhx.bind(function () { + this._cursor = null; + }, this) + ); + this.data.attachEvent( + "onIdChange", + dhx.bind(function (c, a) { + if (this._cursor == c) { + this._cursor = a; + } + }, this) + ); + }, + setCursor: function (a) { + if (a == this._cursor || (a !== null && !this.item(a))) { + return; + } + this.callEvent("onBeforeCursorChange", [this._cursor]); + this._cursor = a; + this.callEvent("onAfterCursorChange", [a]); + }, + getCursor: function () { + return this._cursor; + }, + _bind_update: function (e, c) { + var a = this.item(this.getCursor()) || this._settings.defaultData || null; + this._bind_update_common(e, c, a); + }, +}; +if (!dhx.ui) { + dhx.ui = {}; +} +if (!dhx.ui.views) { + dhx.ui.views = {}; + dhx.ui.get = function (a) { + if (a._settings) { + return a; + } + return dhx.ui.views[a]; + }; +} +dhtmlXDataStore = function (c) { + var e = new dhx.DataCollection(c); + var a = "_dp_init"; + e[a] = function (h) { + var g = "_methods"; + h[g] = ["dummy", "dummy", "changeId", "dummy"]; + this.data._old_names = { add: "inserted", update: "updated", delete: "deleted" }; + this.data.attachEvent("onStoreUpdated", function (m, j, l) { + if (m && !h._silent) { + h.setUpdated(m, true, this._old_names[l]); + } + }); + g = "_getRowData"; + h[g] = function (o, j) { + var m = this.obj.data.item(o); + var n = { id: o }; + n[this.action_param] = this.obj.getUserData(o); + if (m) { + for (var l in m) { + n[l] = m[l]; + } + } + return n; + }; + this.changeId = function (l, j) { + this.data.changeId(l, j); + h._silent = true; + this.data.callEvent("onStoreUpdated", [j, this.item(j), "update"]); + h._silent = false; + }; + g = "_clearUpdateFlag"; + h[g] = function () {}; + this._userdata = {}; + }; + e.dummy = function () {}; + e.setUserData = function (j, g, h) { + this._userdata[j] = h; + }; + e.getUserData = function (h, g) { + return this._userdata[h]; + }; + e.dataFeed = function (g) { + this.define("dataFeed", g); + }; + dhx.extend(e, dhx.BindSource); + return e; +}; +if (window.dhtmlXDataView) { + dhtmlXDataView.prototype._initBindSource = function () { + this.isVisible = function () { + if (!this.data.order.length && !this.data._filter_order && !this._settings.dataFeed) { + return false; + } + return true; + }; + var a = "_settings"; + this._settings = this._settings || this[a]; + if (!this._settings.id) { + this._settings.id = dhx.uid(); + } + this.unbind = dhx.BaseBind.unbind; + this.unsync = dhx.BaseBind.unsync; + dhx.ui.views[this._settings.id] = this; + }; +} +if (window.dhtmlXChart) { + dhtmlXChart.prototype._initBindSource = function () { + this.isVisible = function () { + if (!this.data.order.length && !this.data._filtered_state && !this._settings.dataFeed) { + return false; + } + return true; + }; + var a = "_settings"; + this._settings = this._settings || this[a]; + if (!this._settings.id) { + this._settings.id = dhx.uid(); + } + this.unbind = dhx.BaseBind.unbind; + this.unsync = dhx.BaseBind.unsync; + dhx.ui.views[this._settings.id] = this; + }; +} +dhx.BaseBind.unsync = function (a) { + return dhx.BaseBind._unbind.call(this, a); +}; +dhx.BaseBind.unbind = function (a) { + return dhx.BaseBind._unbind.call(this, a); +}; +dhx.BaseBind.legacyBind = function () { + return dhx.BaseBind.bind.apply(this, arguments); +}; +dhx.BaseBind.legacySync = function (a, c) { + if (this._initBindSource) { + this._initBindSource(); + } + if (a._initBindSource) { + a._initBindSource(); + } + this.attachEvent("onAfterEditStop", function (e) { + this.save(e); + return true; + }); + this.attachEvent("onDataRequest", function (h, g) { + for (var e = h; e < h + g; e++) { + if (!a.data.order[e]) { + a.loadNext(g, h); + return false; + } + } + }); + this.save = function (j) { + if (!j) { + j = this.getCursor(); + } + var h = this.item(j); + var e = a.item(j); + for (var g in h) { + if (g.indexOf("$") !== 0) { + e[g] = h[g]; + } + } + a.refresh(j); + }; + if (a && a.name == "DataCollection") { + return a.data.sync.apply(this.data, arguments); + } else { + return this.data.sync.apply(this.data, arguments); + } +}; +if (window.dhtmlXForm) { + dhtmlXForm.prototype.bind = function (a) { + dhx.BaseBind.bind.apply(this, arguments); + a.getBindData(this._settings.id); + }; + dhtmlXForm.prototype.unbind = function (a) { + dhx.BaseBind._unbind.call(this, a); + }; + dhtmlXForm.prototype._initBindSource = function () { + if (dhx.isUndefined(this._settings)) { + this._settings = { id: dhx.uid(), dataFeed: this._server_feed }; + dhx.ui.views[this._settings.id] = this; + } + }; + dhtmlXForm.prototype._check_data_feed = function (c) { + if (!this._settings.dataFeed || this._ignore_feed || !c) { + return true; + } + var a = this._settings.dataFeed; + if (typeof a == "function") { + return a.call(this, c.id || c, c); + } + a = a + (a.indexOf("?") == -1 ? "?" : "&") + "action=get&id=" + encodeURIComponent(c.id || c); + this.load(a); + return false; + }; + dhtmlXForm.prototype.setValues = dhtmlXForm.prototype.setFormData; + dhtmlXForm.prototype.getValues = function () { + return this.getFormData(false, true); + }; + dhtmlXForm.prototype.dataFeed = function (a) { + if (this._settings) { + this._settings.dataFeed = a; + } else { + this._server_feed = a; + } + }; + dhtmlXForm.prototype.refresh = dhtmlXForm.prototype.isVisible = function (a) { + return true; + }; +} +if (window.scheduler) { + if (!window.Scheduler) { + window.Scheduler = {}; + } + Scheduler.$syncFactory = function (a) { + a.sync = function (e, h) { + if (this._initBindSource) { + this._initBindSource(); + } + if (e._initBindSource) { + e._initBindSource(); + } + var g = "_process_loading"; + var c = function (o) { + a.clearAll(); + var j = e.data.order; + var n = e.data.pull; + var l = []; + for (var m = 0; m < j.length; m++) { + if (h && h.copy) { + l[m] = dhx.clone(n[j[m]]); + } else { + l[m] = n[j[m]]; + } + } + a[g](l); + a.callEvent("onSyncApply", []); + }; + this.save = function (m) { + if (!m) { + m = this.getCursor(); + } + var l = this.item(m); + var j = e.item(m); + if (this.callEvent("onStoreSave", [m, l, j])) { + dhx.extend(e.item(m), l, true); + e.update(m); + } + }; + this.item = function (j) { + return this.getEvent(j); + }; + this._sync_events = [ + e.data.attachEvent("onStoreUpdated", function (m, j, l) { + c.call(this); + }), + e.data.attachEvent("onIdChange", function (l, j) { + combo.changeOptionId(l, j); + }), + ]; + this.attachEvent("onEventChanged", function (j) { + this.save(j); + }); + this.attachEvent("onEventAdded", function (l, j) { + if (!e.data.pull[l]) { + e.add(j); + } + }); + this.attachEvent("onEventDeleted", function (j) { + if (e.data.pull[j]) { + e.remove(j); + } + }); + c(); + }; + a.unsync = function (c) { + dhx.BaseBind._unbind.call(this, c); + }; + a._initBindSource = function () { + if (!this._settings) { + this._settings = { id: dhx.uid() }; + } + }; + }; + Scheduler.$syncFactory(window.scheduler); +} +if (window.dhtmlXCombo) { + dhtmlXCombo.prototype.bind = function () { + dhx.BaseBind.bind.apply(this, arguments); + }; + dhtmlXCombo.unbind = function (a) { + dhx.BaseBind._unbind.call(this, a); + }; + dhtmlXCombo.unsync = function (a) { + dhx.BaseBind._unbind.call(this, a); + }; + dhtmlXCombo.prototype.dataFeed = function (a) { + if (this._settings) { + this._settings.dataFeed = a; + } else { + this._server_feed = a; + } + }; + dhtmlXCombo.prototype.sync = function (c, g) { + if (this._initBindSource) { + this._initBindSource(); + } + if (c._initBindSource) { + c._initBindSource(); + } + var e = this; + var a = function (h) { + e.clearAll(); + e.addOption(this.serialize()); + e.callEvent("onSyncApply", []); + }; + this._sync_events = [ + c.data.attachEvent("onStoreUpdated", function (l, h, j) { + a.call(this); + }), + c.data.attachEvent("onIdChange", function (j, h) { + e.changeOptionId(j, h); + }), + ]; + a.call(c); + }; + dhtmlXCombo.prototype._initBindSource = function () { + if (dhx.isUndefined(this._settings)) { + this._settings = { id: dhx.uid(), dataFeed: this._server_feed }; + dhx.ui.views[this._settings.id] = this; + this.data = { + silent: dhx.bind(function (a) { + a.call(this); + }, this), + }; + dhx4._eventable(this.data); + this.attachEvent("onChange", function () { + this.callEvent("onSelectChange", [this.getSelectedValue()]); + }); + this.attachEvent("onXLE", function () { + this.callEvent("onBindRequest", []); + }); + } + }; + dhtmlXCombo.prototype.item = function (a) { + return this.getOption(a); + }; + dhtmlXCombo.prototype.getSelected = function () { + return this.getSelectedValue(); + }; + dhtmlXCombo.prototype.isVisible = function () { + if (!this.optionsArr.length && !this._settings.dataFeed) { + return false; + } + return true; + }; + dhtmlXCombo.prototype.refresh = function () { + this.render(true); + }; +} +if (window.dhtmlXGridObject) { + dhtmlXGridObject.prototype.bind = function (a, e, c) { + dhx.BaseBind.bind.apply(this, arguments); + }; + dhtmlXGridObject.prototype.unbind = function (a) { + dhx.BaseBind._unbind.call(this, a); + }; + dhtmlXGridObject.prototype.unsync = function (a) { + dhx.BaseBind._unbind.call(this, a); + }; + dhtmlXGridObject.prototype.dataFeed = function (a) { + if (this._settings) { + this._settings.dataFeed = a; + } else { + this._server_feed = a; + } + }; + dhtmlXGridObject.prototype.sync = function (a, n) { + if (this._initBindSource) { + this._initBindSource(); + } + if (a._initBindSource) { + a._initBindSource(); + } + var c = this; + var m = "_parsing"; + var e = "_parser"; + var j = "_locator"; + var g = "_process_store_row"; + var l = "_get_store_data"; + this.save = function (o) { + if (!o) { + o = this.getCursor(); + } + dhx.extend(a.item(o), this.item(o), true); + a.update(o); + }; + var h = function (w) { + var s = c.getCursor ? c.getCursor() : null; + var v = 0; + if (c._legacy_ignore_next) { + v = c._legacy_ignore_next; + c._legacy_ignore_next = false; + } else { + c.clearAll(); + } + var r = this.dataCount(); + if (r) { + c[m] = true; + for (var o = v; o < r; o++) { + var u = this.order[o]; + if (!u) { + continue; + } + if (v && c.rowsBuffer[o]) { + continue; + } + c.rowsBuffer[o] = { idd: u, data: this.pull[u] }; + c.rowsBuffer[o][e] = c[g]; + c.rowsBuffer[o][j] = c[l]; + c.rowsAr[u] = this.pull[u]; + } + if (!c.rowsBuffer[r - 1]) { + c.rowsBuffer[r - 1] = dhtmlx.undefined; + c.xmlFileUrl = c.xmlFileUrl || this.url; + } + if (c.pagingOn) { + c.changePage(); + } else { + if (c._srnd && c._fillers) { + c._update_srnd_view(); + } else { + c.render_dataset(); + c.callEvent("onXLE", []); + } + } + c[m] = false; + } + if (s && c.setCursor) { + c.setCursor(c.rowsAr[s] ? s : null); + } + c.callEvent("onSyncApply", []); + }; + this._sync_events = [ + a.data.attachEvent("onStoreUpdated", function (s, o, r) { + if (r == "delete") { + c.deleteRow(s); + c.data.callEvent("onStoreUpdated", [s, o, r]); + } else { + if (r == "update") { + c.callEvent("onSyncUpdate", [o, r]); + c.update(s, o); + c.data.callEvent("onStoreUpdated", [s, o, r]); + } else { + if (r == "add") { + c.callEvent("onSyncUpdate", [o, r]); + c.add(s, o, this.indexById(s)); + c.data.callEvent("onStoreUpdated", [s, o, r]); + } else { + h.call(this); + } + } + } + }), + a.data.attachEvent("onStoreLoad", function (r, o) { + c.xmlFileUrl = a.data.url; + c._legacy_ignore_next = r.getInfo(o)._from; + }), + a.data.attachEvent("onIdChange", function (r, o) { + c.changeRowId(r, o); + }), + ]; + c.attachEvent("onDynXLS", function (s, r) { + for (var o = s; o < s + r; o++) { + if (!a.data.order[o]) { + a.loadNext(r, s); + return false; + } + } + c._legacy_ignore_next = s; + h.call(a.data); + }); + h.call(a.data); + c.attachEvent("onEditCell", function (o, v, s, r, u) { + if (o == 2 && r != u) { + this.save(v); + } + return true; + }); + c.attachEvent("onClearAll", function () { + var o = "_f_rowsBuffer"; + this[o] = null; + }); + if (n && n.sort) { + c.attachEvent("onBeforeSorting", function (s, r, o) { + if (r == "connector") { + return false; + } + var u = this.getColumnId(s); + a.sort("#" + u + "#", o == "asc" ? "asc" : "desc", r == "int" ? r : "string"); + c.setSortImgState(true, s, o); + return false; + }); + } + if (n && n.filter) { + c.attachEvent("onFilterStart", function (s, o) { + var r = "_con_f_used"; + if (c[r] && c[r].length) { + return false; + } + a.data.silent(function () { + a.filter(); + for (var u = 0; u < s.length; u++) { + if (o[u] == "") { + continue; + } + var v = c.getColumnId(s[u]); + a.filter("#" + v + "#", o[u], u != 0); + } + }); + a.refresh(); + return false; + }); + c.collectValues = function (o) { + var r = this.getColumnId(o); + return function (v) { + var s = []; + var u = {}; + this.data.each(function (x) { + var w = x[v]; + if (!u[w]) { + u[w] = true; + s.push(w); + } + }); + s.sort(); + return s; + }.call(a, r); + }; + } + if (n && n.select) { + c.attachEvent("onRowSelect", function (o) { + a.setCursor(o); + }); + } + c.clearAndLoad = function (o) { + a.clearAll(); + a.load(o); + }; + }; + dhtmlXGridObject.prototype._initBindSource = function () { + if (dhx.isUndefined(this._settings)) { + this._settings = { id: dhx.uid(), dataFeed: this._server_feed }; + dhx.ui.views[this._settings.id] = this; + this.data = { + silent: dhx.bind(function (e) { + e.call(this); + }, this), + }; + dhx4._eventable(this.data); + var a = "_cCount"; + for (var c = 0; c < this[a]; c++) { + if (!this.columnIds[c]) { + this.columnIds[c] = "cell" + c; + } + } + this.attachEvent("onSelectStateChanged", function (e) { + this.callEvent("onSelectChange", [e]); + }); + this.attachEvent("onSelectionCleared", function () { + this.callEvent("onSelectChange", [null]); + }); + this.attachEvent("onEditCell", function (e, g) { + if (e === 2 && this.getCursor) { + if (g && g == this.getCursor()) { + this._update_binds(); + } + } + return true; + }); + this.attachEvent("onXLE", function () { + this.callEvent("onBindRequest", []); + }); + } + }; + dhtmlXGridObject.prototype.item = function (j) { + if (j === null) { + return null; + } + var h = this.getRowById(j); + if (!h) { + return null; + } + var a = "_attrs"; + var g = dhx.copy(h[a]); + g.id = j; + var e = this.getColumnsNum(); + for (var c = 0; c < e; c++) { + g[this.columnIds[c]] = this.cells(j, c).getValue(); + } + return g; + }; + dhtmlXGridObject.prototype.update = function (j, h) { + for (var g = 0; g < this.columnIds.length; g++) { + var e = this.columnIds[g]; + if (!dhx.isUndefined(h[e])) { + this.cells(j, g).setValue(h[e]); + } + } + var c = "_attrs"; + var a = this.getRowById(j)[c]; + for (var e in h) { + a[e] = h[e]; + } + this.callEvent("onBindUpdate", [j]); + }; + dhtmlXGridObject.prototype.add = function (l, j, e) { + var a = []; + for (var h = 0; h < this.columnIds.length; h++) { + var g = this.columnIds[h]; + a[h] = dhx.isUndefined(j[g]) ? "" : j[g]; + } + this.addRow(l, a, e); + var c = "_attrs"; + this.getRowById(l)[c] = dhx.copy(j); + }; + dhtmlXGridObject.prototype.getSelected = function () { + return this.getSelectedRowId(); + }; + dhtmlXGridObject.prototype.isVisible = function () { + var a = "_f_rowsBuffer"; + if (!this.rowsBuffer.length && !this[a] && !this._settings.dataFeed) { + return false; + } + return true; + }; + dhtmlXGridObject.prototype.refresh = function () { + this.render_dataset(); + }; + dhtmlXGridObject.prototype.filter = function (j, h) { + if (this._settings.dataFeed) { + var g = {}; + if (!j && !h) { + return; + } + if (typeof j == "function") { + if (!h) { + return; + } + j(h, g); + } else { + if (dhx.isUndefined(j)) { + g = h; + } else { + g[j] = h; + } + } + this.clearAll(); + var a = this._settings.dataFeed; + if (typeof a == "function") { + return a.call(this, h, g); + } + var e = []; + for (var c in g) { + e.push("dhx_filter[" + c + "]=" + encodeURIComponent(g[c])); + } + this.load(a + (a.indexOf("?") < 0 ? "?" : "&") + e.join("&")); + return false; + } + if (h === null) { + return this.filterBy(0, function () { + return false; + }); + } + this.filterBy(0, function (l, m) { + return j.call(this, m, h); + }); + }; +} +if (window.dhtmlXTreeObject) { + dhtmlXTreeObject.prototype.bind = function () { + dhx.BaseBind.bind.apply(this, arguments); + }; + dhtmlXTreeObject.prototype.unbind = function (a) { + dhx.BaseBind._unbind.call(this, a); + }; + dhtmlXTreeObject.prototype.dataFeed = function (a) { + if (this._settings) { + this._settings.dataFeed = a; + } else { + this._server_feed = a; + } + }; + dhtmlXTreeObject.prototype._initBindSource = function () { + if (dhx.isUndefined(this._settings)) { + this._settings = { id: dhx.uid(), dataFeed: this._server_feed }; + dhx.ui.views[this._settings.id] = this; + this.data = { + silent: dhx.bind(function (a) { + a.call(this); + }, this), + }; + dhx4._eventable(this.data); + this.attachEvent("onSelect", function (a) { + this.callEvent("onSelectChange", [a]); + }); + this.attachEvent("onEdit", function (a, c) { + if (a === 2) { + if (c && c == this.getCursor()) { + this._update_binds(); + } + } + return true; + }); + } + }; + dhtmlXTreeObject.prototype.item = function (a) { + if (a === null) { + return null; + } + return { id: a, text: this.getItemText(a) }; + }; + dhtmlXTreeObject.prototype.getSelected = function () { + return this.getSelectedItemId(); + }; + dhtmlXTreeObject.prototype.isVisible = function () { + return true; + }; + dhtmlXTreeObject.prototype.refresh = function () {}; + dhtmlXTreeObject.prototype.filter = function (j, h) { + if (this._settings.dataFeed) { + var g = {}; + if (!j && !h) { + return; + } + if (typeof j == "function") { + if (!h) { + return; + } + j(h, g); + } else { + if (dhx.isUndefined(j)) { + g = h; + } else { + g[j] = h; + } + } + this.deleteChildItems(0); + var a = this._settings.dataFeed; + if (typeof a == "function") { + return a.call(this, [data.id || data, data]); + } + var e = []; + for (var c in g) { + e.push("dhx_filter[" + c + "]=" + encodeURIComponent(g[c])); + } + this.loadXML(a + (a.indexOf("?") < 0 ? "?" : "&") + e.join("&")); + return false; + } + }; + dhtmlXTreeObject.prototype.update = function (c, a) { + if (!dhx.isUndefined(a.text)) { + this.setItemText(c, a.text); + } + }; +} +function dataProcessor(a) { + this.serverProcessor = a; + this.action_param = "!nativeeditor_status"; + this.object = null; + this.updatedRows = []; + this.autoUpdate = true; + this.updateMode = "cell"; + this._tMode = "GET"; + this._headers = null; + this._payload = null; + this.post_delim = "_"; + this._waitMode = 0; + this._in_progress = {}; + this._invalid = {}; + this.mandatoryFields = []; + this.messages = []; + this.styles = { + updated: "font-weight:bold;", + inserted: "font-weight:bold;", + deleted: "text-decoration : line-through;", + invalid: "background-color:FFE0E0;", + invalid_cell: "border-bottom:2px solid red;", + error: "color:red;", + clear: "font-weight:normal;text-decoration:none;", + }; + this.enableUTFencoding(true); + dhx4._eventable(this); + if (this.connector_init) { + this.setTransactionMode("POST", true); + this.serverProcessor += (this.serverProcessor.indexOf("?") != -1 ? "&" : "?") + "editing=true"; + } + return this; +} +dataProcessor.prototype = { + setTransactionMode: function (c, a) { + if (typeof c == "object") { + this._tMode = c.mode || this._tMode; + this._headers = this._headers || c.headers; + this._payload = this._payload || c.payload; + } else { + this._tMode = c; + this._tSend = a; + } + if (this._tMode == "REST") { + this._tSend = false; + this._endnm = true; + } + }, + escape: function (a) { + if (this._utf) { + return encodeURIComponent(a); + } else { + return escape(a); + } + }, + enableUTFencoding: function (a) { + this._utf = dhx4.s2b(a); + }, + setDataColumns: function (a) { + this._columns = typeof a == "string" ? a.split(",") : a; + }, + getSyncState: function () { + return !this.updatedRows.length; + }, + enableDataNames: function (a) { + this._endnm = dhx4.s2b(a); + }, + enablePartialDataSend: function (a) { + this._changed = dhx4.s2b(a); + }, + setUpdateMode: function (c, a) { + this.autoUpdate = c == "cell"; + this.updateMode = c; + this.dnd = a; + }, + ignore: function (c, a) { + this._silent_mode = true; + c.call(a || window); + this._silent_mode = false; + }, + setUpdated: function (g, e, h) { + if (this._silent_mode) { + return; + } + var c = this.findRow(g); + h = h || "updated"; + var a = this.obj.getUserData(g, this.action_param); + if (a && h == "updated") { + h = a; + } + if (e) { + this.set_invalid(g, false); + this.updatedRows[c] = g; + this.obj.setUserData(g, this.action_param, h); + if (this._in_progress[g]) { + this._in_progress[g] = "wait"; + } + } else { + if (!this.is_invalid(g)) { + this.updatedRows.splice(c, 1); + this.obj.setUserData(g, this.action_param, ""); + } + } + if (!e) { + this._clearUpdateFlag(g); + } + this.markRow(g, e, h); + if (e && this.autoUpdate) { + this.sendData(g); + } + }, + _clearUpdateFlag: function (a) {}, + markRow: function (j, e, h) { + var g = ""; + var c = this.is_invalid(j); + if (c) { + g = this.styles[c]; + e = true; + } + if (this.callEvent("onRowMark", [j, e, h, c])) { + g = this.styles[e ? h : "clear"] + g; + this.obj[this._methods[0]](j, g); + if (c && c.details) { + g += this.styles[c + "_cell"]; + for (var a = 0; a < c.details.length; a++) { + if (c.details[a]) { + this.obj[this._methods[1]](j, a, g); + } + } + } + } + }, + getState: function (a) { + return this.obj.getUserData(a, this.action_param); + }, + is_invalid: function (a) { + return this._invalid[a]; + }, + set_invalid: function (e, c, a) { + if (a) { + c = { + value: c, + details: a, + toString: function () { + return this.value.toString(); + }, + }; + } + this._invalid[e] = c; + }, + checkBeforeUpdate: function (a) { + return true; + }, + sendData: function (a) { + if (this._waitMode && (this.obj.mytype == "tree" || this.obj._h2)) { + return; + } + if (this.obj.editStop) { + this.obj.editStop(); + } + if (typeof a == "undefined" || this._tSend) { + return this.sendAllData(); + } + if (this._in_progress[a]) { + return false; + } + this.messages = []; + if (this.getState(a) !== "deleted") { + if (!this.checkBeforeUpdate(a) && this.callEvent("onValidationError", [a, this.messages])) { + return false; + } + } + this._beforeSendData(this._getRowData(a), a); + }, + _beforeSendData: function (a, c) { + if (!this.callEvent("onBeforeUpdate", [c, this.getState(c), a])) { + return false; + } + this._sendData(a, c); + }, + serialize: function (g, h) { + if (typeof g == "string") { + return g; + } + if (typeof h != "undefined") { + return this.serialize_one(g, ""); + } else { + var a = []; + var e = []; + for (var c in g) { + if (g.hasOwnProperty(c)) { + a.push(this.serialize_one(g[c], c + this.post_delim)); + e.push(c); + } + } + a.push("ids=" + this.escape(e.join(","))); + if (dhtmlx.security_key) { + a.push("dhx_security=" + dhtmlx.security_key); + } + return a.join("&"); + } + }, + serialize_one: function (g, c) { + if (typeof g == "string") { + return g; + } + var a = []; + for (var e in g) { + if (g.hasOwnProperty(e)) { + if ((e == "id" || e == this.action_param) && this._tMode == "REST") { + continue; + } + a.push(this.escape((c || "") + e) + "=" + this.escape(g[e])); + } + } + return a.join("&"); + }, + _sendData: function (h, j) { + if (!h) { + return; + } + if (!this.callEvent("onBeforeDataSending", j ? [j, this.getState(j), h] : [null, null, h])) { + return false; + } + if (j) { + this._in_progress[j] = new Date().valueOf(); + } + var o = this; + var n = function (s) { + var v = []; + if (j) { + v.push(j); + } else { + if (h) { + for (var u in h) { + v.push(u); + } + } + } + return o.afterUpdate(o, s, v); + }; + var c = this.serverProcessor + (this._user ? dhtmlx.url(this.serverProcessor) + ["dhx_user=" + this._user, "dhx_version=" + this.obj.getUserData(0, "version")].join("&") : ""); + if (this._tMode == "GET") { + dhx4.ajax.get(c + (c.indexOf("?") != -1 ? "&" : "?") + this.serialize(h, j), n); + } else { + if (this._tMode == "POST") { + dhx4.ajax.post(c, this.serialize(h, j), n); + } else { + if (this._tMode == "REST") { + var e = this.getState(j); + var g = c.replace(/(\&|\?)editing\=true/, ""); + var l = g.split("?"); + if (l[1]) { + l[1] = "?" + l[1]; + } + var m = ""; + var a = "post"; + if (e == "inserted") { + m = this.serialize(h, j); + } else { + if (e == "deleted") { + a = "DELETE"; + g = l[0] + j + (l[1] || ""); + } else { + a = "PUT"; + m = this.serialize(h, j); + g = l[0] + j + (l[1] || ""); + } + } + if (this._payload) { + for (var r in this._payload) { + g = g + (g.indexOf("?") === -1 ? "?" : "&") + this.escape(r) + "=" + this.escape(this._payload[r]); + } + } + dhx4.ajax.query({ url: g, method: a, headers: this._headers, data: m, callback: n }); + } + } + } + this._waitMode++; + }, + sendAllData: function () { + if (!this.updatedRows.length) { + return; + } + this.messages = []; + var c = true; + for (var a = 0; a < this.updatedRows.length; a++) { + if (this.getState(this.updatedRows[a]) !== "deleted") { + c &= this.checkBeforeUpdate(this.updatedRows[a]); + } + } + if (!c && !this.callEvent("onValidationError", ["", this.messages])) { + return false; + } + if (this._tSend) { + this._sendData(this._getAllData()); + } else { + for (var a = 0; a < this.updatedRows.length; a++) { + if (!this._in_progress[this.updatedRows[a]]) { + if (this.is_invalid(this.updatedRows[a])) { + continue; + } + this._beforeSendData(this._getRowData(this.updatedRows[a]), this.updatedRows[a]); + if (this._waitMode && (this.obj.mytype == "tree" || this.obj._h2)) { + return; + } + } + } + } + }, + _getAllData: function (g) { + var c = {}; + var a = false; + for (var e = 0; e < this.updatedRows.length; e++) { + var h = this.updatedRows[e]; + if (this._in_progress[h] || this.is_invalid(h)) { + continue; + } + if (!this.callEvent("onBeforeUpdate", [h, this.getState(h), this._getRowData(h)])) { + continue; + } + c[h] = this._getRowData(h, h + this.post_delim); + a = true; + this._in_progress[h] = new Date().valueOf(); + } + return a ? c : null; + }, + setVerificator: function (c, a) { + this.mandatoryFields[c] = + a || + function (e) { + return e !== ""; + }; + }, + clearVerificator: function (a) { + this.mandatoryFields[a] = false; + }, + findRow: function (c) { + var a = 0; + for (a = 0; a < this.updatedRows.length; a++) { + if (c == this.updatedRows[a]) { + break; + } + } + return a; + }, + defineAction: function (a, c) { + if (!this._uActions) { + this._uActions = []; + } + this._uActions[a] = c; + }, + afterUpdateCallback: function (c, l, j, h) { + var a = c; + var g = j != "error" && j != "invalid"; + if (!g) { + this.set_invalid(c, j); + } + if (this._uActions && this._uActions[j] && !this._uActions[j](h)) { + return delete this._in_progress[a]; + } + if (this._in_progress[a] != "wait") { + this.setUpdated(c, false); + } + var e = c; + switch (j) { + case "inserted": + case "insert": + if (l != c) { + this.obj[this._methods[2]](c, l); + c = l; + } + break; + case "delete": + case "deleted": + this.obj.setUserData(c, this.action_param, "true_deleted"); + this.obj[this._methods[3]](c); + delete this._in_progress[a]; + return this.callEvent("onAfterUpdate", [c, j, l, h]); + break; + } + if (this._in_progress[a] != "wait") { + if (g) { + this.obj.setUserData(c, this.action_param, ""); + } + delete this._in_progress[a]; + } else { + delete this._in_progress[a]; + this.setUpdated(l, true, this.obj.getUserData(c, this.action_param)); + } + this.callEvent("onAfterUpdate", [e, j, l, h]); + }, + afterUpdate: function (n, m, a) { + if (window.JSON) { + try { + var u = JSON.parse(m.xmlDoc.responseText); + var h = u.action || this.getState(a) || "updated"; + var c = u.sid || a[0]; + var g = u.tid || a[0]; + n.afterUpdateCallback(c, g, h, u); + n.finalizeUpdate(); + return; + } catch (o) {} + } + var s = dhx4.ajax.xmltop("data", m.xmlDoc); + if (!s || s.tagName == "DIV") { + return this.cleanUpdate(a); + } + var r = dhx4.ajax.xpath("//data/action", s); + if (!r.length) { + return this.cleanUpdate(a); + } + for (var l = 0; l < r.length; l++) { + var j = r[l]; + var h = j.getAttribute("type"); + var c = j.getAttribute("sid"); + var g = j.getAttribute("tid"); + n.afterUpdateCallback(c, g, h, j); + } + n.finalizeUpdate(); + }, + cleanUpdate: function (c) { + if (c) { + for (var a = 0; a < c.length; a++) { + delete this._in_progress[c[a]]; + } + } + }, + finalizeUpdate: function () { + if (this._waitMode) { + this._waitMode--; + } + if ((this.obj.mytype == "tree" || this.obj._h2) && this.updatedRows.length) { + this.sendData(); + } + this.callEvent("onAfterUpdateFinish", []); + if (!this.updatedRows.length) { + this.callEvent("onFullSync", []); + } + }, + init: function (a) { + this.obj = a; + if (a._dp_init) { + a._dp_init(this); + } + if (this.connector_init) { + a._dataprocessor = this; + } + }, + setOnAfterUpdate: function (a) { + this.attachEvent("onAfterUpdate", a); + }, + enableDebug: function (a) {}, + setOnBeforeUpdateHandler: function (a) { + this.attachEvent("onBeforeDataSending", a); + }, + setAutoUpdate: function (e, c) { + e = e || 2000; + this._user = c || new Date().valueOf(); + this._need_update = false; + this._update_busy = false; + this.attachEvent("onAfterUpdate", function (g, j, l, h) { + this.afterAutoUpdate(g, j, l, h); + }); + this.attachEvent("onFullSync", function () { + this.fullSync(); + }); + var a = this; + window.setInterval(function () { + a.loadUpdate(); + }, e); + }, + afterAutoUpdate: function (a, e, g, c) { + if (e == "collision") { + this._need_update = true; + return false; + } else { + return true; + } + }, + fullSync: function () { + if (this._need_update == true) { + this._need_update = false; + this.loadUpdate(); + } + return true; + }, + getUpdates: function (a, c) { + if (this._update_busy) { + return false; + } else { + this._update_busy = true; + } + dhx4.ajax.get(a, c); + }, + _v: function (a) { + if (a.firstChild) { + return a.firstChild.nodeValue; + } + return ""; + }, + _a: function (a) { + var e = []; + for (var c = 0; c < a.length; c++) { + e[c] = this._v(a[c]); + } + return e; + }, + loadUpdate: function () { + var c = this; + var a = this.obj.getUserData(0, "version"); + var e = this.serverProcessor + dhtmlx.url(this.serverProcessor) + ["dhx_user=" + this._user, "dhx_version=" + a].join("&"); + e = e.replace("editing=true&", ""); + this.getUpdates(e, function (n) { + var o = dhx4.ajax.xmltop("updates", n.xmlDoc); + var j = dhx4.ajax.xpath("//userdata", o); + c.obj.setUserData(0, "version", c._v(j[0])); + var g = dhx4.ajax.xpath("//update", o); + if (g.length) { + c._silent_mode = true; + for (var l = 0; l < g.length; l++) { + var h = g[l].getAttribute("status"); + var s = g[l].getAttribute("id"); + var m = g[l].getAttribute("parent"); + switch (h) { + case "inserted": + c.callEvent("insertCallback", [g[l], s, m]); + break; + case "updated": + c.callEvent("updateCallback", [g[l], s, m]); + break; + case "deleted": + c.callEvent("deleteCallback", [g[l], s, m]); + break; + } + } + c._silent_mode = false; + } + c._update_busy = false; + c = null; + }); + }, +}; +if (window.dataProcessor && !dataProcessor.prototype.init_original) { + dataProcessor.prototype.connector_init = true; +}