/* Product Name: dhtmlxSuite Version: 4.0.3 Edition: Professional License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com Copyright UAB Dinamenta http://www.dhtmlx.com */ if (typeof(window.dhx4) == "undefined") { window.dhx4 = { version: "4.0.3", skin: null, skinDetect: function(c) { var g = document.createElement("DIV"); g.className = c + "_skin_detect"; if (document.body.firstChild) { document.body.insertBefore(g, document.body.firstChild) } else { document.body.appendChild(g) } var a = g.offsetWidth; g.parentNode.removeChild(g); g = null; return { 10: "dhx_skyblue", 20: "dhx_web", 30: "dhx_terrace" }[a] || null }, lastId: 1, newId: function() { return this.lastId++ }, zim: { data: {}, step: 5, first: function() { return 100 }, last: function() { var g = this.first(); for (var c in this.data) { g = Math.max(g, this.data[c]) } return g }, 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) { return (a == true || a == 1 || a == "true" || a == "1" || a == "yes" || a == "y") }, trim: function(a) { return String(a).replace(/^\s{1,}/, "").replace(/\s{1,}$/, "") }, template: function(c, g, a) { return c.replace(/#([a-zA-Z0-9_-]{1,})#/g, function(l, h) { if (h.length > 0 && typeof(g[h]) != "undefined") { if (a == true) { return window.dhx4.trim(g[h]) } return String(g[h]) } return "" }) }, absLeft: function(a) { if (typeof(a) == "string") { a = document.getElementById(a) } return this._aOfs(a).left }, absTop: function(a) { if (typeof(a) == "string") { a = document.getElementById(a) } return this._aOfs(a).top }, _aOfsSum: function(a) { var g = 0, c = 0; while (a) { g = g + parseInt(a.offsetTop); c = c + parseInt(a.offsetLeft); a = a.offsetParent } return { top: g, left: c } }, _aOfsRect: function(h) { var n = h.getBoundingClientRect(); var o = document.body; var c = document.documentElement; var a = window.pageYOffset || c.scrollTop || o.scrollTop; var l = window.pageXOffset || c.scrollLeft || o.scrollLeft; var m = c.clientTop || o.clientTop || 0; var q = c.clientLeft || o.clientLeft || 0; var r = n.top + a - m; var g = n.left + l - q; return { top: Math.round(r), left: Math.round(g) } }, _aOfs: function(a) { if (a.getBoundingClientRect) { return this._aOfsRect(a) } else { return this._aOfsSum(a) } }, _isObj: function(a) { return (a != null && typeof(a) == "object" && typeof(a.length) == "undefined") }, _copyObj: function(h) { if (this._isObj(h)) { var g = {}; for (var c in h) { if (typeof(h[c]) == "object" && h[c] != null) { g[c] = this._copyObj(h[c]) } else { g[c] = h[c] } } } else { var g = []; for (var c = 0; c < h.length; c++) { if (typeof(h[c]) == "object" && h[c] != null) { g[c] = this._copyObj(h[c]) } else { g[c] = h[c] } } } return g }, screenDim: function() { var a = (navigator.userAgent.indexOf("MSIE") >= 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, m, c) { h = (typeof(h) == "string" ? document.getElementById(h) : h); var a = h.value.length; m = Math.max(Math.min(m, a), 0); c = Math.min(c, a); if (h.setSelectionRange) { try { h.setSelectionRange(m, c) } catch (l) {} } else { if (h.createTextRange) { var g = h.createTextRange(); g.moveStart("character", m); g.moveEnd("character", c - a); try { g.select() } catch (l) {} } } }, transData: null, transDetect: function() { if (this.transData == null) { this.transData = { transProp: false, transEv: null }; var g = { MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd", OTransition: "oTransitionEnd", msTransition: "transitionend", transition: "transitionend" }; for (var c in g) { if (this.transData.transProp == false && document.documentElement.style[c] != null) { this.transData.transProp = c; this.transData.transEv = g[c] } } g = null } return this.transData } }; 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.isOpera = (navigator.userAgent.indexOf("Opera") >= 0); window.dhx4.isChrome = (navigator.userAgent.indexOf("Chrome") >= 0); window.dhx4.isKHTML = (navigator.userAgent.indexOf("Safari") >= 0 || navigator.userAgent.indexOf("Konqueror") >= 0); window.dhx4.isFF = (navigator.userAgent.indexOf("Firefox") >= 0); window.dhx4.isIPad = (navigator.userAgent.search(/iPad/gi) >= 0) } if (typeof(window.dhx4.ajax) == "undefined") { window.dhx4.ajax = { cache: false, method: "post", get: function(a, c) { this._call("GET", a, null, true, c) }, getSync: function(a) { return this._call("GET", a, null, false) }, post: function(c, a, g) { if (arguments.length == 1) { a = "" } else { if (arguments.length == 2 && (typeof(a) == "function" || typeof(window[a]) == "function")) { g = a; a = "" } else { a = String(a) } } this._call("POST", c, a, true, g) }, 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, g) { if (arguments.length == 2 && (typeof(a) == "function" || typeof(window[a]))) { g = a; a = "" } this._call("POST", c, a, true, g, { url: c, postData: a }) }, _call: function(o, c, a, m, l, h) { var g = (window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP")); var n = (navigator.userAgent.match(/AppleWebKit/) != null && navigator.userAgent.match(/Qt/) != null && navigator.userAgent.match(/Safari/) != null); if (m == true) { g.onreadystatechange = function() { if ((g.readyState == 4 && g.status == 200) || (n == true && g.readyState == 3)) { window.setTimeout(function() { if (typeof(l) == "function") { l.apply(window, [{ xmlDoc: g }]) } if (h != null) { if (typeof(h.postData) != "undefined") { dhx4.ajax.postLong(h.url, h.postData, l) } else { dhx4.ajax.getLong(h.url, l) } } l = null; g = null }, 1) } } } if (o == "GET" && this.cache != true) { c += (c.indexOf("?") >= 0 ? "&" : "?") + "dhxr" + new Date().getTime() } g.open(o, c, m); if (o == "POST") { g.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); if (this.cache != true) { a += (a.length > 0 ? "&" : "") + "dhxr" + new Date().getTime() } } else { a = null } g.setRequestHeader("X-Requested-With", "XMLHttpRequest"); g.send(a); if (!m) { return { xmlDoc: g } } } } } if (typeof(window.dhx4._enableDataLoading) == "undefined") { window.dhx4._enableDataLoading = function(obj, initObj, xmlToJson, xmlRootTag, mode) { if (mode == "clear") { for (var a in obj._dhxdataload) { obj._dhxdataload[a] = null; delete obj._dhxdataload[a] } obj._loadData = null; obj._dhxdataload = null; obj.load = null; obj.loadStruct = null; obj = null; return } obj._dhxdataload = { initObj: initObj, xmlToJson: xmlToJson, xmlRootTag: xmlRootTag, onBeforeXLS: null }; obj._loadData = function(data, loadParams, onLoad) { if (arguments.length == 2) { onLoad = loadParams; loadParams = null } var obj = null; if (arguments.length == 3) { onLoad = arguments[2] } if (typeof(data) == "string") { var k = data.replace(/^\s{1,}/, "").replace(/\s{1,}$/, ""); var tag = new RegExp("^<" + this._dhxdataload.xmlRootTag); if (tag.test(k.replace(/^<\?xml[^\?]*\?>\s*/, ""))) { if (window.DOMParser) { obj = (new window.DOMParser()).parseFromString(data, "text/xml") } else { if (typeof(window.ActiveXObject) != "undefined") { obj = new window.ActiveXObject("Microsoft.XMLDOM"); obj.async = "false"; obj.loadXML(data) } } if (obj != null) { obj = this[this._dhxdataload.xmlToJson].apply(this, [obj]) } } if (obj == null && (k.match(/^\{.*\}$/) != null || k.match(/^\[.*\]$/) != null)) { try { eval("dhx4.temp=" + k) } catch (e) { dhx4.temp = null } obj = dhx4.temp; dhx4.temp = null } if (obj == null) { this.callEvent("onXLS", []); var params = []; if (typeof(this._dhxdataload.onBeforeXLS) == "function") { var k = this._dhxdataload.onBeforeXLS.apply(this, [data]); if (k != null && typeof(k) == "object") { if (k.url != null) { data = k.url } if (k.params != null) { for (var a in k.params) { params.push(a + "=" + encodeURIComponent(k.params[a])) } } } } var t = this; var callBack = function(r) { var obj = null; if ((r.xmlDoc.getResponseHeader("Content-Type") || "").search(/xml/gi) >= 0 || (r.xmlDoc.responseText.replace(/^\s{1,}/, "")).match(/^ 0 ? "" : "") + params, callBack) } } return } } else { if (typeof(data.documentElement) == "object" || (typeof(data.tagName) != "undefined" && typeof(data.getElementsByTagName) != "undefined" && data.getElementsByTagName(this._dhxdataload.xmlRootTag).length > 0)) { obj = this[this._dhxdataload.xmlToJson].apply(this, [data]) } else { obj = window.dhx4._copyObj(data) } } if (obj != null) { this[this._dhxdataload.initObj].apply(this, [obj]) } if (onLoad != null) { if (typeof(onLoad) == "function") { onLoad.apply(this, []) } else { if (typeof(window[onLoad]) == "function") { window[onLoad].apply(this, []) } } onLoad = null } }; if (mode != null) { var k = { struct: "loadStruct", data: "load" }; for (var a in mode) { if (mode[a] == true) { obj[k[a]] = function() { return this._loadData.apply(this, arguments) } } } } obj = 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(g, l) { g = String(g).toLowerCase(); if (!this.dhxevs.data[g]) { this.dhxevs.data[g] = {} } var h = window.dhx4.newId(); this.dhxevs.data[g][h] = l; return h }; a.detachEvent = function(m) { for (var h in this.dhxevs.data) { var l = 0; for (var g in this.dhxevs.data[h]) { if (g == m) { this.dhxevs.data[h][g] = null; delete this.dhxevs.data[h][g] } else { l++ } } if (l == 0) { this.dhxevs.data[h] = null; delete this.dhxevs.data[h] } } }; a.checkEvent = function(g) { g = String(g).toLowerCase(); return (this.dhxevs.data[g] != null) }; a.callEvent = function(h, m) { h = String(h).toLowerCase(); if (this.dhxevs.data[h] == null) { return true } var l = true; for (var g in this.dhxevs.data[h]) { l = this.dhxevs.data[h][g].apply(this, m) && l } return l }; a.detachAllEvents = function() { for (var h in this.dhxevs.data) { for (var g in this.dhxevs.data[h]) { this.dhxevs.data[h][g] = null; delete this.dhxevs.data[h][g] } this.dhxevs.data[h] = null; delete this.dhxevs.data[h] } }; a = null } } dhtmlx = function(g) { for (var c in g) { dhtmlx[c] = g[c] } return dhtmlx }; dhtmlx.extend_api = function(a, h, g) { var c = window[a]; if (!c) { return } window[a] = function(n) { if (n && typeof n == "object" && !n.tagName) { var m = c.apply(this, (h._init ? h._init(n) : arguments)); for (var l in dhtmlx) { if (h[l]) { this[h[l]](dhtmlx[l]) } } for (var l in n) { if (h[l]) { this[h[l]](n[l]) } else { if (l.indexOf("on") == 0) { this.attachEvent(l, n[l]) } } } } else { var m = c.apply(this, arguments) } if (h._patch) { h._patch(this) } return m || this }; window[a].prototype = c.prototype; if (g) { dhtmlXHeir(window[a].prototype, g) } }; dhtmlxAjax = { get: function(a, g) { var c = new dtmlXMLLoaderObject(true); c.async = (arguments.length < 3); c.waitCall = g; c.loadXML(a); return c }, post: function(a, g, h) { var c = new dtmlXMLLoaderObject(true); c.async = (arguments.length < 4); c.waitCall = h; c.loadXML(a, true, g); return c }, getSync: function(a) { return this.get(a, null, true) }, postSync: function(a, c) { return this.post(a, c, null, true) } }; function dtmlXMLLoaderObject(c, h, g, a) { this.xmlDoc = ""; if (typeof(g) != "undefined") { this.async = g } else { this.async = true } this.onloadAction = c || null; this.mainObject = h || null; this.waitCall = null; this.rSeed = a || false; return this } dtmlXMLLoaderObject.count = 0; dtmlXMLLoaderObject.prototype.waitLoadFunction = function(c) { var a = true; this.check = function() { if ((c) && (c.onloadAction != null)) { if ((!c.xmlDoc.readyState) || (c.xmlDoc.readyState == 4)) { if (!a) { return } a = false; dtmlXMLLoaderObject.count++; if (typeof c.onloadAction == "function") { c.onloadAction(c.mainObject, null, null, null, c) } if (c.waitCall) { c.waitCall.call(this, c); c.waitCall = null } } } }; return this.check }; dtmlXMLLoaderObject.prototype.getXMLTopNode = function(g, a) { if (typeof this.xmlDoc.status == "undefined" || this.xmlDoc.status < 400) { if (this.xmlDoc.responseXML) { var c = this.xmlDoc.responseXML.getElementsByTagName(g); if (c.length == 0 && g.indexOf(":") != -1) { var c = this.xmlDoc.responseXML.getElementsByTagName((g.split(":"))[1]) } var h = c[0] } else { var h = this.xmlDoc.documentElement } if (h) { this._retry = false; return h } if (!this._retry && _isIE) { this._retry = true; var a = this.xmlDoc; this.loadXMLString(this.xmlDoc.responseText.replace(/^[\s]+/, ""), true); return this.getXMLTopNode(g, a) } } dhtmlxError.throwError("LoadXML", "Incorrect XML", [(a || this.xmlDoc), this.mainObject]); return document.createElement("DIV") }; dtmlXMLLoaderObject.prototype.loadXMLString = function(c, a) { if (!_isIE) { var g = new DOMParser(); this.xmlDoc = g.parseFromString(c, "text/xml") } else { this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); this.xmlDoc.async = this.async; this.xmlDoc.onreadystatechange = function() {}; this.xmlDoc.loadXML(c) } if (a) { return } if (this.onloadAction) { this.onloadAction(this.mainObject, null, null, null, this) } if (this.waitCall) { this.waitCall(); this.waitCall = null } }; dtmlXMLLoaderObject.prototype.loadXML = function(g, c, a, h) { if (this.rSeed) { g += ((g.indexOf("?") != -1) ? "&" : "?") + "a_dhx_rSeed=" + (new Date()).valueOf() } this.filePath = g; if ((!_isIE) && (window.XMLHttpRequest)) { this.xmlDoc = new XMLHttpRequest() } else { this.xmlDoc = new ActiveXObject("Microsoft.XMLHTTP") } if (this.async) { this.xmlDoc.onreadystatechange = new this.waitLoadFunction(this) } this.xmlDoc.open(c ? "POST" : "GET", g, this.async); if (h) { this.xmlDoc.setRequestHeader("User-Agent", "dhtmlxRPC v0.1 (" + navigator.userAgent + ")"); this.xmlDoc.setRequestHeader("Content-type", "text/xml") } else { if (c) { this.xmlDoc.setRequestHeader("Content-type", (this.contenttype || "application/x-www-form-urlencoded")) } } this.xmlDoc.setRequestHeader("X-Requested-With", "XMLHttpRequest"); this.xmlDoc.send(null || a); if (!this.async) { (new this.waitLoadFunction(this))() } }; dtmlXMLLoaderObject.prototype.destructor = function() { this._filterXPath = null; this._getAllNamedChilds = null; this._retry = null; this.async = null; this.rSeed = null; this.filePath = null; this.onloadAction = null; this.mainObject = null; this.xmlDoc = null; this.doXPath = null; this.doXPathOpera = null; this.doXSLTransToObject = null; this.doXSLTransToString = null; this.loadXML = null; this.loadXMLString = null; this.doSerialization = null; this.xmlNodeToJSON = null; this.getXMLTopNode = null; this.setXSLParamValue = null; return null }; dtmlXMLLoaderObject.prototype.xmlNodeToJSON = function(h) { var g = {}; for (var c = 0; c < h.attributes.length; c++) { g[h.attributes[c].name] = h.attributes[c].value } g._tagvalue = h.firstChild ? h.firstChild.nodeValue : ""; for (var c = 0; c < h.childNodes.length; c++) { var a = h.childNodes[c].tagName; if (a) { if (!g[a]) { g[a] = [] } g[a].push(this.xmlNodeToJSON(h.childNodes[c])) } } return g }; function callerFunction(a, c) { this.handler = function(g) { if (!g) { g = window.event } a(g, c); return true }; return this.handler } function getAbsoluteLeft(a) { return getOffset(a).left } function getAbsoluteTop(a) { return getOffset(a).top } function getOffsetSum(a) { var g = 0, c = 0; while (a) { g = g + parseInt(a.offsetTop); c = c + parseInt(a.offsetLeft); a = a.offsetParent } return { top: g, left: c } } function getOffsetRect(h) { var n = h.getBoundingClientRect(); var o = document.body; var c = document.documentElement; var a = window.pageYOffset || c.scrollTop || o.scrollTop; var l = window.pageXOffset || c.scrollLeft || o.scrollLeft; var m = c.clientTop || o.clientTop || 0; var q = c.clientLeft || o.clientLeft || 0; var r = n.top + a - m; var g = n.left + l - q; return { top: Math.round(r), left: Math.round(g) } } function getOffset(a) { if (a.getBoundingClientRect) { return getOffsetRect(a) } else { return getOffsetSum(a) } } function convertStringToBoolean(a) { if (typeof(a) == "string") { a = a.toLowerCase() } switch (a) { case "1": case "true": case "yes": case "y": case 1: case true: return true; break; default: return false } } function getUrlSymbol(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 l = document.createElement("Div"); l.innerHTML = dragger.dragNode.outerHTML; dragger.dragNode = l.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(l) { if (window.name) { var g = parent.frames[window.name].frameElement.offsetParent; var h = 0; var c = 0; while (g) { h += g.offsetLeft; c += g.offsetTop; g = g.offsetParent } if ((parent.dhtmlDragAndDrop)) { var a = parent.dhtmlDragAndDrop.calculateFramePosition(1); h += a.split("_")[0] * 1; c += a.split("_")[1] * 1 } if (l) { return h + "_" + c } else { this.fx = h } 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]) } } } } dtmlXMLLoaderObject.prototype.doXPath = function(g, l, h, q) { if (_isKHTML || (!_isIE && !window.XPathResult)) { return this.doXPathOpera(g, l) } if (_isIE) { if (!l) { if (!this.xmlDoc.nodeName) { l = this.xmlDoc.responseXML } else { l = this.xmlDoc } } if (!l) { dhtmlxError.throwError("LoadXML", "Incorrect XML", [(l || this.xmlDoc), this.mainObject]) } if (h != null) { l.setProperty("SelectionNamespaces", "xmlns:xsl='" + h + "'") } if (q == "single") { return l.selectSingleNode(g) } else { return l.selectNodes(g) || new Array(0) } } else { var a = l; if (!l) { if (!this.xmlDoc.nodeName) { l = this.xmlDoc.responseXML } else { l = this.xmlDoc } } if (!l) { dhtmlxError.throwError("LoadXML", "Incorrect XML", [(l || this.xmlDoc), this.mainObject]) } if (l.nodeName.indexOf("document") != -1) { a = l } else { a = l; l = l.ownerDocument } var n = XPathResult.ANY_TYPE; if (q == "single") { n = XPathResult.FIRST_ORDERED_NODE_TYPE } var m = new Array(); var c = l.evaluate(g, a, function(r) { return h }, n, null); if (n == XPathResult.FIRST_ORDERED_NODE_TYPE) { return c.singleNodeValue } var o = c.iterateNext(); while (o) { m[m.length] = o; o = c.iterateNext() } return m } }; function _dhtmlxError(c, a, g) { if (!this.catches) { this.catches = new Array() } return this } _dhtmlxError.prototype.catchError = function(c, a) { this.catches[c] = a }; _dhtmlxError.prototype.throwError = function(c, a, g) { if (this.catches[c]) { return this.catches[c](c, a, g) } if (this.catches.ALL) { return this.catches.ALL(c, a, g) } alert("Error type: " + arguments[0] + "\nDescription: " + arguments[1]); return null }; window.dhtmlxError = new _dhtmlxError(); dtmlXMLLoaderObject.prototype.doXPathOpera = function(g, a) { var l = g.replace(/[\/]+/gi, "/").split("/"); var h = null; var c = 1; if (!l.length) { return [] } if (l[0] == ".") { h = [a] } else { if (l[0] == "") { h = (this.xmlDoc.responseXML || this.xmlDoc).getElementsByTagName(l[c].replace(/\[[^\]]*\]/g, "")); c++ } else { return [] } } for (c; c < l.length; c++) { h = this._getAllNamedChilds(h, l[c]) } if (l[c - 1].indexOf("[") != -1) { h = this._filterXPath(h, l[c - 1]) } return h }; dtmlXMLLoaderObject.prototype._filterXPath = function(h, g) { var m = new Array(); var g = g.replace(/[^\[]*\[\@/g, "").replace(/[\[\]\@]*/g, ""); for (var l = 0; l < h.length; l++) { if (h[l].getAttribute(g)) { m[m.length] = h[l] } } return m }; dtmlXMLLoaderObject.prototype._getAllNamedChilds = function(h, g) { var n = new Array(); if (_isKHTML) { g = g.toUpperCase() } for (var m = 0; m < h.length; m++) { for (var l = 0; l < h[m].childNodes.length; l++) { if (_isKHTML) { if (h[m].childNodes[l].tagName && h[m].childNodes[l].tagName.toUpperCase() == g) { n[n.length] = h[m].childNodes[l] } } else { if (h[m].childNodes[l].tagName == g) { n[n.length] = h[m].childNodes[l] } } } } return n }; function dhtmlXHeir(h, g) { for (var l in g) { if (typeof(g[l]) == "function") { h[l] = g[l] } } return h } function dhtmlxEvent(c, g, a) { if (c.addEventListener) { c.addEventListener(g, a, false) } else { if (c.attachEvent) { c.attachEvent("on" + g, a) } } } dtmlXMLLoaderObject.prototype.xslDoc = null; dtmlXMLLoaderObject.prototype.setXSLParamValue = function(c, g, h) { if (!h) { h = this.xslDoc } if (h.responseXML) { h = h.responseXML } var a = this.doXPath("/xsl:stylesheet/xsl:variable[@name='" + c + "']", h, "http://www.w3.org/1999/XSL/Transform", "single"); if (a != null) { a.firstChild.nodeValue = g } }; dtmlXMLLoaderObject.prototype.doXSLTransToObject = function(h, c) { if (!h) { h = this.xslDoc } if (h.responseXML) { h = h.responseXML } if (!c) { c = this.xmlDoc } if (c.responseXML) { c = c.responseXML } if (!_isIE) { if (!this.XSLProcessor) { this.XSLProcessor = new XSLTProcessor(); this.XSLProcessor.importStylesheet(h) } var a = this.XSLProcessor.transformToDocument(c) } else { var a = new ActiveXObject("Msxml2.DOMDocument.3.0"); try { c.transformNodeToObject(h, a) } catch (g) { a = c.transformNode(h) } } return a }; dtmlXMLLoaderObject.prototype.doXSLTransToString = function(g, c) { var a = this.doXSLTransToObject(g, c); if (typeof(a) == "string") { return a } return this.doSerialization(a) }; dtmlXMLLoaderObject.prototype.doSerialization = function(c) { if (!c) { c = this.xmlDoc } if (c.responseXML) { c = c.responseXML } if (!_isIE) { var a = new XMLSerializer(); return a.serializeToString(c) } else { return c.xml } }; dhtmlxEventable = function(obj) { obj.attachEvent = function(name, catcher, callObj) { name = "ev_" + name.toLowerCase(); if (!this[name]) { this[name] = new this.eventCatcher(callObj || this) } return (name + ":" + this[name].addEvent(catcher)) }; obj.callEvent = function(name, arg0) { name = "ev_" + name.toLowerCase(); if (this[name]) { return this[name].apply(this, arg0) } return true }; obj.checkEvent = function(name) { return ( !! this["ev_" + name.toLowerCase()]) }; obj.eventCatcher = function(obj) { var dhx_catch = []; var z = function() { var res = true; for (var i = 0; i < dhx_catch.length; i++) { if (dhx_catch[i] != null) { var zr = dhx_catch[i].apply(obj, arguments); res = res && zr } } return res }; z.addEvent = function(ev) { if (typeof(ev) != "function") { ev = eval(ev) } if (ev) { return dhx_catch.push(ev) - 1 } return false }; z.removeEvent = function(id) { dhx_catch[id] = null }; return z }; obj.detachEvent = function(id) { if (id != false) { var list = id.split(":"); this[list[0]].removeEvent(list[1]) } }; obj.detachAllEvents = function() { for (var name in this) { if (name.indexOf("ev_") == 0) { this.detachEvent(name); this[name] = null } } }; obj = null }; if (!window.dhtmlx) { dhtmlx = {} } dhtmlx.assert = function(c, a) { if (!c) { dhtmlx.error(a) } }; dhtmlx.assert_enabled = function() { return false }; dhtmlx.assert_event = function(m, g) { if (!m._event_check) { m._event_check = {}; m._event_check_size = {} } for (var c in g) { m._event_check[c.toLowerCase()] = g[c]; var l = -1; for (var h in g[c]) { l++ } m._event_check_size[c.toLowerCase()] = l } }; dhtmlx.assert_method_info = function(l, c, h, m) { var a = []; for (var g = 0; g < m.length; g++) { a.push(m[g][0] + " : " + m[g][1] + "\n " + m[g][2].describe() + (m[g][3] ? "; optional" : "")) } return l.name + "." + c + "\n" + h + "\n Arguments:\n - " + a.join("\n - ") }; dhtmlx.assert_method = function(g, a) { for (var c in a) { dhtmlx.assert_method_process(g, c, a[c].descr, a[c].args, (a[c].min || 99), a[c].skip) } }; dhtmlx.assert_method_process = function(m, c, l, n, g, h) { var a = m[c]; if (!h) { m[c] = function() { if (arguments.length != n.length && arguments.length < g) { dhtmlx.log("warn", "Incorrect count of parameters\n" + m[c].describe() + "\n\nExpecting " + n.length + " but have only " + arguments.length) } else { for (var o = 0; o < n.length; o++) { if (!n[o][3] && !n[o][2](arguments[o])) { dhtmlx.log("warn", "Incorrect method call\n" + m[c].describe() + "\n\nActual value of " + (o + 1) + " parameter: {" + (typeof arguments[o]) + "} " + arguments[o]) } } } return a.apply(this, arguments) } } m[c].describe = function() { return dhtmlx.assert_method_info(m, c, l, n) } }; dhtmlx.assert_event_call = function(g, c, a) { if (g._event_check) { if (!g._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 (g._event_check_size[c] != a.length) { dhtmlx.log("warn", "Incorrect event call, expected " + g._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(g, c) { if (typeof g == "object") { for (var a in g) { dhtmlx.assert_settings(a, g[a], c) } } }; dhtmlx.assert_settings = function(o, l, h) { h = h || this._settings_check; if (h) { if (!h[o]) { return dhtmlx.log("warn", "Unknown propery: " + o) } var n = ""; var c = ""; var a = false; for (var g = 0; g < h[o].length; g++) { var m = h[o][g]; if (typeof m == "string") { continue } if (typeof m == "function") { a = a || m(l) } else { if (typeof m == "object" && typeof m[1] == "function") { a = a || m[1](l); if (a && m[2]) { dhtmlx.assert_check(l, m[2]) } } } if (a) { break } } if (!a) { dhtmlx.log("warn", "Invalid configuration\n" + dhtmlx.assert_info(o, h) + "\nActual value: {" + (typeof l) + "} " + l) } } }; dhtmlx.assert_info = function(c, m) { var a = m[c]; var l = ""; var h = []; for (var g = 0; g < a.length; g++) { if (typeof rule == "string") { l = a[g] } else { if (a[g].describe) { h.push(a[g].describe()) } else { if (a[g][1] && a[g][1].describe) { h.push(a[g][1].describe()) } } } } return "Property: " + c + ", " + l + " \nExpected value: \n - " + h.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(g) { return c[g] }; a.describe = function() { var h = []; for (var g in c) { h.push(g) } return "{String} can take one of next values: " + h.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(g, c) { var h = function(a) { if (g(a) || c(a)) { return true } return false }; h.describe = function() { return g.describe() }; return h } } dhtmlx.version = "3.0"; 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 g in a) { c[g] = a[g] } 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 m = arguments; var g = m[0]; var c = []; for (var l = m.length - 1; l > 0; l--) { if (typeof m[l] == "function") { m[l] = m[l].prototype } for (var h in m[l]) { if (h == "_init") { c.push(m[l][h]) } else { if (!g[h]) { g[h] = m[l][h] } } } } if (m[0]._init) { c.push(m[0]._init) } g._init = function() { for (var n = 0; n < c.length; n++) { c[n].apply(this, arguments) } }; g.base = m[1]; var a = function(n) { this._init(n); if (this._parseSettings) { this._parseSettings(n, this.defaults) } }; a.prototype = g; g = m = 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, g, c) { return function() { var h = false; h = a[g].apply(a, arguments); return h } }; dhtmlx.isNotDefined = function(c) { return typeof c == "undefined" }; dhtmlx.delay = function(h, c, g, a) { setTimeout(function() { var l = h.apply(c, g); h = c = g = null; return l }, 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(h, g, a, c) { h = dhtmlx.toNode(h); var l = dhtmlx.uid(); dhtmlx._events[l] = [h, g, a]; if (c) { a = dhtmlx.bind(a, c) } if (h.addEventListener) { h.addEventListener(g, a, false) } else { if (h.attachEvent) { h.attachEvent("on" + g, a) } } return l }; 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, g, a) { if (window.console && console.log) { c = c.toLowerCase(); if (window.console[c]) { window.console[c](g || "unknown error") } else { window.console.log(c + ": " + g) } 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 g = "_start_time_log" + a; if (!dhtmlx[g]) { dhtmlx[g] = new Date(); dhtmlx.log("Info", "Timing start [" + a + "]") } else { var c = new Date(); dhtmlx.log("Info", "Timing end [" + a + "]:" + (c.valueOf() - dhtmlx[g].valueOf()) / 1000 + "s"); dhtmlx[g] = 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(g, l) { if (this._events._block) { return true } g = g.toLowerCase(); dhtmlx.assert_event_call(this, g, l); var h = this._events[g.toLowerCase()]; var a = true; if (dhtmlx.debug) { dhtmlx.log("info", "[" + this.name + "] event:" + g, l) } if (h) { for (var c = 0; c < h.length; c++) { if (h[c].apply(this, (l || [])) === false) { a = false } } } if (this._map[g] && !this._map[g].callEvent(g, l)) { a = false } return a }, attachEvent: function(c, a, h) { c = c.toLowerCase(); dhtmlx.assert_event_attach(this, c); h = h || dhtmlx.uid(); a = dhtmlx.toFunctor(a); var g = this._events[c] || dhtmlx.toArray(); g.push(a); this._events[c] = g; this._handlers[h] = { f: a, t: c }; return h }, detachEvent: function(h) { if (this._handlers[h]) { var c = this._handlers[h].t; var a = this._handlers[h].f; var g = this._events[c]; g.remove(a); delete this._handlers[h] } } }; 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, g) { if (!g && g !== 0) { this.push(c) } else { var a = this.splice(g, (this.length - g)); this[g] = 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, g) { for (var c = 0; c < this.length; c++) { a.call((g || this), this[c]) } }, map: function(a, g) { for (var c = 0; c < this.length; c++) { this[c] = a.call((g || 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 h = document.createElement("DIV"); var g; for (var c = 0; c < a.names.length; c++) { while (p = a[a.names[c]].pop()) { if (typeof h.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, g) { a = a || {}; var h = document.createElement(c); for (var l in a) { h.setAttribute(l, a[l]) } if (a.style) { h.style.cssText = a.style } if (a["class"]) { h.className = a["class"] } if (g) { h.innerHTML = g } return h }, 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, g, a) { if (!c) { return } if (g) { g.parentNode.insertBefore(c, g) } 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(h) { if (h.getBoundingClientRect) { var n = h.getBoundingClientRect(); var o = document.body; var c = document.documentElement; var a = window.pageYOffset || c.scrollTop || o.scrollTop; var l = window.pageXOffset || c.scrollLeft || o.scrollLeft; var m = c.clientTop || o.clientTop || 0; var q = c.clientLeft || o.clientLeft || 0; var r = n.top + a - m; var g = n.left + l - q; return { y: Math.round(r), x: Math.round(g) } } else { var r = 0, g = 0; while (h) { r = r + parseInt(h.offsetTop, 10); g = g + parseInt(h.offsetLeft, 10); h = h.offsetParent } return { y: r, x: g } } }, 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 g = 0; g < dhtmlx.destructors.length; g++) { dhtmlx.destructors[g].destructor() } dhtmlx.destructors = [] } for (var c in dhtmlx._events) { var h = dhtmlx._events[c]; if (h[0].removeEventListener) { h[0].removeEventListener(h[1], h[2], false) } else { if (h[0].detachEvent) { h[0].detachEvent("on" + h[1], h[2]) } } delete dhtmlx._events[c] } }); dhtmlx.ajax = function(a, c, g) { if (arguments.length !== 0) { var h = new dhtmlx.ajax(); if (g) { h.master = g } h.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(l, q, n) { var c = this.getXHR(); if (typeof n == "function") { n = [n] } if (typeof q == "object") { var m = []; for (var g in q) { var o = q[g]; if (o === null || o === dhtmlx.undefined) { o = "" } m.push(g + "=" + encodeURIComponent(o)) } q = m.join("&") } if (q && !this.post) { l = l + (l.indexOf("?") != -1 ? "&" : "?") + q; q = null } c.open(this.post ? "POST" : "GET", l, !this._sync); if (this.post) { c.setRequestHeader("Content-type", "application/x-www-form-urlencoded") } var h = this; c.onreadystatechange = function() { if (!c.readyState || c.readyState == 4) { if (n && h) { for (var a = 0; a < n.length; a++) { if (n[a]) { n[a].call((h.master || h), c.responseText, c.responseXML, c) } } } h.master = null; n = h = null } }; c.send(q || null); return c }, get: function(a, g, c) { this.post = false; return this.send(a, g, c) }, post: function(a, g, c) { this.post = true; return this.send(a, g, 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.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(l, c, a) { var g = this.data.driver; var h = g.getRecords(g.toObject(l, c))[0]; this.data = (g ? g.getDetails(h) : l); 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(h, g) { this._ignore_feed = true; this.setValues(dhtmlx.DataDriver.json.toObject(h)[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 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(g) { var a = {}; for (var c = 0; c < g.length; c++) { a["data" + c] = g[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(g) { g = this.stringToArray(g); var a = {}; for (var c = 0; c < g.length; c++) { a["data" + c] = g[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, q) { if (window.XPathResult) { var g = h; if (h.nodeName.indexOf("document") == -1) { h = h.ownerDocument } var n = []; var c = h.evaluate(q, g, null, XPathResult.ANY_TYPE, null); var o = c.iterateNext(); while (o) { n.push(o); o = c.iterateNext() } return n } else { var m = true; try { if (typeof(h.selectNodes) == "undefined") { m = false } } catch (l) {} if (m) { return h.selectNodes(q) } else { var a = q.split("/").pop(); return h.getElementsByTagName(a) } } }, tagToObject: function(g, q) { q = q || {}; var l = false; var h = g.attributes; if (h && h.length) { for (var n = 0; n < h.length; n++) { q[h[n].name] = h[n].value } l = true } var c = g.childNodes; var o = {}; for (var n = 0; n < c.length; n++) { if (c[n].nodeType == 1) { var m = c[n].tagName; if (typeof q[m] != "undefined") { if (!(q[m] instanceof Array)) { q[m] = [q[m]] } q[m].push(this.tagToObject(c[n], {})) } else { q[c[n].tagName] = this.tagToObject(c[n], {}) } l = true } } if (!l) { return this.nodeValue(g) } q.value = this.nodeValue(g); return q }, 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(h, g) { if (g && (g.firstChild && g.firstChild.tagName != "parsererror")) { return g } var c = this.fromString(h.replace(/^[\s]+/, "")); if (c) { return c } dhtmlx.error("xml can't be parsed", h) } }; 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(h, g) { if (this._load_count) { return this._load_count = [h, g] } else { this._load_count = true } this.load(a + ((a.indexOf("?") == -1) ? "?" : "&") + "posStart=" + h + "&count=" + g, function() { var l = this._load_count; this._load_count = false; if (typeof l == "object") { this.data.feed.apply(this, l) } }) } } }, _onLoad: function(g, c, a) { this.data._parse(this.data.driver.toObject(g, 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(n, m) { if (this._settings.dataFeed) { var l = {}; if (!n && !l) { return } if (typeof n == "function") { if (!m) { return } n(m, l) } else { l = { text: m } } this.clearAll(); var c = this._settings.dataFeed; if (typeof c == "function") { return c.call(this, m, l) } var h = []; for (var g in l) { h.push("dhx_filter[" + g + "]=" + encodeURIComponent(l[g])) } this.load(c + (c.indexOf("?") < 0 ? "?" : "&") + h.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(l) { this.callEvent("onParse", [this.driver, l]); if (this._filter_order) { this.filter() } var m = this.driver.getInfo(l); if (m._key) { dhtmlx.security_key = m._key } var h = this.driver.getRecords(l); var o = (m._from || 0) * 1; if (o === 0 && this.order[0]) { o = this.order.length } var c = 0; for (var g = 0; g < h.length; g++) { var a = this.driver.getDetails(h[g]); var n = this.id(a); if (!this.pull[n]) { this.order[c + o] = n; c++ } this.pull[n] = 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 g = 0; g < m._size; g++) { if (!this.order[g]) { var n = dhtmlx.uid(); var a = { id: n, $template: "loading" }; this.pull[n] = a; this.order[g] = n } } this.callEvent("onStoreLoad", [this.driver, l]); 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(h, g) { if (h) { h = this.indexById(h) } else { h = this.startOffset || 0 } if (g) { g = this.indexById(g) } else { g = Math.min((this.endOffset || Infinity), (this.dataCount() - 1)); if (g < 0) { g = 0 } } if (h > g) { var c = g; g = h; h = c } return this.getIndexRange(h, g) }, getIndexRange: function(h, g) { g = Math.min((g || Infinity), this.dataCount() - 1); var a = dhtmlx.toArray(); for (var c = (h || 0); c <= g; 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, h) { if (a < 0 || h < 0) { dhtmlx.error("DataStore::move", "Incorrect indexes"); return } var g = this.idByIndex(a); var c = this.item(g); this.order.removeAt(a); this.order.insertAt(g, Math.min(this.order.length, h)); this.callEvent("onStoreUpdated", [g, c, "move"]) }, scheme: function(a) { this._scheme = a }, sync: function(l, h, a) { if (typeof h != "function") { a = h; h = null } if (dhtmlx.debug_bind) { this.debug_sync_master = l; 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 g = l; if (l.name != "DataStore") { l = l.data } var c = dhtmlx.bind(function(o, m, n) { if (n != "update" || h) { o = null } if (!o) { this.order = dhtmlx.toArray([].concat(l.order)); this._filter_order = null; this.pull = l.pull; if (h) { this.silent(h) } 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(o) } else { a = false } }, this); l.attachEvent("onStoreUpdated", c); this.feed = function(n, m) { g.loadNext(m, n) }; c() }, add: function(l, a) { if (this._scheme) { l = l || {}; for (var c in this._scheme) { l[c] = l[c] || this._scheme[c] } if (this._scheme) { if (this._scheme.$init) { this._scheme.$update(l) } else { if (this._scheme.$update) { this._scheme.$update(l) } } } } var m = this.id(l); var h = this.dataCount(); if (dhtmlx.isNotDefined(a) || a < 0) { a = h } if (a > h) { dhtmlx.log("Warning", "DataStore:add", "Index of out of bounds"); a = Math.min(this.order.length, a) } if (this.callEvent("onBeforeAdd", [m, l, a]) === false) { return false } if (this.exists(m)) { return dhtmlx.error("Not unique ID") } this.pull[m] = l; this.order.insertAt(m, a); if (this._filter_order) { var g = this._filter_order.length; if (!a && this.order.length) { g = 0 } this._filter_order.insertAt(m, g) } this.callEvent("onafterAdd", [m, a]); this.callEvent("onStoreUpdated", [m, l, "add"]); return m }, remove: function(g) { if (g instanceof Array) { for (var a = 0; a < g.length; a++) { this.remove(g[a]) } return } if (this.callEvent("onBeforeDelete", [g]) === false) { return false } if (!this.exists(g)) { return dhtmlx.error("Not existing ID", g) } var c = this.item(g); this.order.remove(g); if (this._filter_order) { this._filter_order.remove(g) } delete this.pull[g]; this.callEvent("onafterdelete", [g]); this.callEvent("onStoreUpdated", [g, 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(m, c, a) { var g = m; if (typeof m == "function") { g = { as: m, dir: c } } else { if (typeof m == "string") { g = { by: m, dir: c, as: a } } } var l = [g.by, g.dir, g.as]; if (!this.callEvent("onbeforesort", l)) { return } if (this.order.length) { var n = dhtmlx.sort.create(g); var h = this.getRange(this.first(), this.last()); h.sort(n); this.order = h.map(function(o) { return this.id(o) }, this) } this.refresh(); this.callEvent("onaftersort", l) }, filter: function(l, h) { if (!this.callEvent("onBeforeFilter", [l, h])) { return } if (this._filter_order) { this.order = this._filter_order; delete this._filter_order } if (!this.order.length) { return } if (l) { var c = l; h = h || ""; if (typeof l == "string") { l = dhtmlx.Template.fromHTML(l); h = h.toString().toLowerCase(); c = function(o, n) { return l(o).toLowerCase().indexOf(n) != -1 } } var g = dhtmlx.toArray(); for (var a = 0; a < this.order.length; a++) { var m = this.order[a]; if (c(this.item(m), h)) { g.push(m) } } this._filter_order = this.order; this.order = g } this.refresh(); this.callEvent("onAfterFilter", []) }, each: function(g, c) { for (var a = 0; a < this.order.length; a++) { g.call((c || this), this.item(this.order[a])) } }, provideApi: function(h, c) { this.debug_bind_master = h; if (c) { this.mapEvent({ onbeforesort: h, onaftersort: h, onbeforeadd: h, onafteradd: h, onbeforedelete: h, onafterdelete: h, onbeforeupdate: h }) } var g = ["get", "set", "sort", "add", "remove", "exists", "idByIndex", "indexById", "item", "update", "refresh", "dataCount", "filter", "next", "previous", "clearAll", "first", "last", "serialize"]; for (var a = 0; a < g.length; a++) { h[g[a]] = dhtmlx.methodPush(this, g[a]) } if (dhtmlx.assert_enabled()) { this.assert_event(h) } }, serialize: function() { var g = this.order; var a = []; for (var c = 0; c < g.length; c++) { a.push(this.pull[g[c]]) } return a } }; dhtmlx.sort = { create: function(a) { return dhtmlx.sort.dir(a.dir, dhtmlx.sort.by(a.by, a.as)) }, as: { "int": function(g, c) { g = g * 1; c = c * 1; return g > c ? 1 : (g < c ? -1 : 0) }, string_strict: function(g, c) { g = g.toString(); c = c.toString(); return g > c ? 1 : (g < c ? -1 : 0) }, string: function(g, c) { g = g.toString().toLowerCase(); c = c.toString().toLowerCase(); return g > c ? 1 : (g < 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(h, g) { return a(c(h), c(g)) } }, dir: function(c, a) { if (c == "asc") { return a } return function(h, g) { return a(h, g) * -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(m, l, c) { m = m || event; var a = m.target || m.srcElement; var g = ""; var n = null; var h = false; while (a && a.parentNode) { if (!h && a.getAttribute) { n = a.getAttribute(this._id); if (n) { if (a.getAttribute("userdata")) { this.callEvent("onLocateData", [n, a]) } if (!this.callEvent("on" + c, [n, m, a])) { return } h = true } } g = a.className; if (g) { g = g.split(" "); g = g[0] || g[1]; if (l[g]) { return l[g].call(this, m, n || dhtmlx.html.locate(m, 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 g = this[c + "_setter"]; return this._settings[c] = g ? g.call(this, a) : a }, _parseSeetingColl: function(g) { if (g) { for (var c in g) { this._define(c, g[c]) } } }, _parseSettings: function(g, a) { var c = dhtmlx.extend({}, a); if (typeof g == "object" && !g.tagName) { dhtmlx.extend(c, g) } this._parseSeetingColl(c) }, _mergeSettings: function(a, g) { for (var c in g) { switch (typeof a[c]) { case "object": a[c] = this._mergeSettings((a[c] || {}), g[c]); break; case "undefined": a[c] = g[c]; break; default: break } } return a }, _parseContainer: function(c, a, g) { if (typeof c == "object" && !c.tagName) { c = c.container } this._obj = this.$view = dhtmlx.toNode(c); if (!this._obj && g) { this._obj = g(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 g = this; return function() { return a.apply(g, 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(g, c) { if (!g.types && g.prototype.types) { g = g.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"); g.types[a] = dhtmlx.extend(dhtmlx.extend({}, (g.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(g, a) { a = "template" + (a ? ("_" + a) : ""); var c = g[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 } } g[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"; this.version = "3.0"; 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) } }; (function() { if (!window.dhtmlxError) { var c = function() {}; window.dhtmlxError = { catchError: c, throwError: c }; window.convertStringToBoolean = function(g) { return !!g }; window.dhtmlxEventable = function(g) { dhtmlx.extend(g, dhtmlx.EventSystem) }; var a = { getXMLTopNode: function(g) {}, doXPath: function(g) { return dhtmlx.DataDriver.xml.xpath(this.xml, g) }, xmlDoc: { responseXML: true } }; dhtmlx.compat.dataProcessor = function(m) { var g = "_sendData"; var h = "_in_progress"; var n = "_tMode"; var l = "_waitMode"; m[g] = function(q, r) { if (!q) { return } if (r) { this[h][r] = (new Date()).valueOf() } if (!this.callEvent("onBeforeDataSending", r ? [r, this.getState(r)] : [])) { return false } var o = this; var s = this.serverProcessor; if (this[n] != "POST") { dhtmlx.ajax().get(s + ((s.indexOf("?") != -1) ? "&" : "?") + this.serialize(q, r), "", function(w, u, v) { a.xml = dhtmlx.DataDriver.xml.checkResponse(w, u); o.afterUpdate(o, null, null, null, a) }) } else { dhtmlx.ajax().post(s, this.serialize(q, r), function(w, u, v) { a.xml = dhtmlx.DataDriver.xml.checkResponse(w, u); o.afterUpdate(o, null, null, null, a) }) } this[l]++ } } } })(); if (!dhtmlx.attaches) { dhtmlx.attaches = {} } dhtmlx.attaches.attachAbstract = function(c, a) { var l = document.createElement("DIV"); l.id = "CustomObject_" + dhtmlx.uid(); l.style.width = "100%"; l.style.height = "100%"; l.cmp = "grid"; document.body.appendChild(l); this.attachObject(l.id); a.container = l.id; var h = this.vs[this.av]; h.grid = new window[c](a); h.gridId = l.id; h.gridObj = l; h.grid.setSizes = function() { if (this.resize) { this.resize() } else { this.render() } }; var g = "_viewRestore"; return this.vs[this[g]()].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 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.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); dhtmlxEventable(this); return this } dataProcessor.prototype = { setTransactionMode: function(c, a) { this._tMode = c; this._tSend = a }, escape: function(a) { if (this._utf) { return encodeURIComponent(a) } else { return escape(a) } }, enableUTFencoding: function(a) { this._utf = convertStringToBoolean(a) }, setDataColumns: function(a) { this._columns = (typeof a == "string") ? a.split(",") : a }, getSyncState: function() { return !this.updatedRows.length }, enableDataNames: function(a) { this._endnm = convertStringToBoolean(a) }, enablePartialDataSend: function(a) { this._changed = convertStringToBoolean(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(h, g, l) { if (this._silent_mode) { return } var c = this.findRow(h); l = l || "updated"; var a = this.obj.getUserData(h, this.action_param); if (a && l == "updated") { l = a } if (g) { this.set_invalid(h, false); this.updatedRows[c] = h; this.obj.setUserData(h, this.action_param, l); if (this._in_progress[h]) { this._in_progress[h] = "wait" } } else { if (!this.is_invalid(h)) { this.updatedRows.splice(c, 1); this.obj.setUserData(h, this.action_param, "") } } if (!g) { this._clearUpdateFlag(h) } this.markRow(h, g, l); if (g && this.autoUpdate) { this.sendData(h) } }, _clearUpdateFlag: function(a) {}, markRow: function(m, g, l) { var h = ""; var c = this.is_invalid(m); if (c) { h = this.styles[c]; g = true } if (this.callEvent("onRowMark", [m, g, l, c])) { h = this.styles[g ? l : "clear"] + h; this.obj[this._methods[0]](m, h); if (c && c.details) { h += this.styles[c + "_cell"]; for (var a = 0; a < c.details.length; a++) { if (c.details[a]) { this.obj[this._methods[1]](m, a, h) } } } } }, getState: function(a) { return this.obj.getUserData(a, this.action_param) }, is_invalid: function(a) { return this._invalid[a] }, set_invalid: function(g, c, a) { if (a) { c = { value: c, details: a, toString: function() { return this.value.toString() } } } this._invalid[g] = 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.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(h, l) { if (typeof h == "string") { return h } if (typeof l != "undefined") { return this.serialize_one(h, "") } else { var a = []; var g = []; for (var c in h) { if (h.hasOwnProperty(c)) { a.push(this.serialize_one(h[c], c + this.post_delim)); g.push(c) } } a.push("ids=" + this.escape(g.join(","))); if (dhtmlx.security_key) { a.push("dhx_security=" + dhtmlx.security_key) } return a.join("&") } }, serialize_one: function(h, c) { if (typeof h == "string") { return h } var a = []; for (var g in h) { if (h.hasOwnProperty(g)) { a.push(this.escape((c || "") + g) + "=" + this.escape(h[g])) } } return a.join("&") }, _sendData: function(c, g) { if (!c) { return } if (!this.callEvent("onBeforeDataSending", g ? [g, this.getState(g), c] : [null, null, c])) { return false } if (g) { this._in_progress[g] = (new Date()).valueOf() } var a = new dtmlXMLLoaderObject(this.afterUpdate, this, true); var h = this.serverProcessor + (this._user ? (getUrlSymbol(this.serverProcessor) + ["dhx_user=" + this._user, "dhx_version=" + this.obj.getUserData(0, "version")].join("&")) : ""); if (this._tMode != "POST") { a.loadXML(h + ((h.indexOf("?") != -1) ? "&" : "?") + this.serialize(c, g)) } else { a.loadXML(h, true, this.serialize(c, g)) } this._waitMode++ }, sendAllData: function() { if (!this.updatedRows.length) { return } this.messages = []; var c = true; for (var a = 0; a < this.updatedRows.length; a++) { 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(h) { var c = {}; var a = false; for (var g = 0; g < this.updatedRows.length; g++) { var l = this.updatedRows[g]; if (this._in_progress[l] || this.is_invalid(l)) { continue } if (!this.callEvent("onBeforeUpdate", [l, this.getState(l)])) { continue } c[l] = this._getRowData(l, l + this.post_delim); a = true; this._in_progress[l] = (new Date()).valueOf() } return a ? c : null }, setVerificator: function(c, a) { this.mandatoryFields[c] = a || (function(g) { return (g != "") }) }, 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, n, m, l) { var a = c; var h = (m != "error" && m != "invalid"); if (!h) { this.set_invalid(c, m) } if ((this._uActions) && (this._uActions[m]) && (!this._uActions[m](l))) { return (delete this._in_progress[a]) } if (this._in_progress[a] != "wait") { this.setUpdated(c, false) } var g = c; switch (m) { case "inserted": case "insert": if (n != c) { this.obj[this._methods[2]](c, n); c = n } 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, m, n, l]); break } if (this._in_progress[a] != "wait") { if (h) { this.obj.setUserData(c, this.action_param, "") } delete this._in_progress[a] } else { delete this._in_progress[a]; this.setUpdated(n, true, this.obj.getUserData(c, this.action_param)) } this.callEvent("onAfterUpdate", [g, m, n, l]) }, afterUpdate: function(o, u, r, q, n) { n.getXMLTopNode("data"); if (!n.xmlDoc.responseXML) { return } var s = n.doXPath("//data/action"); for (var l = 0; l < s.length; l++) { var m = s[l]; var h = m.getAttribute("type"); var a = m.getAttribute("sid"); var g = m.getAttribute("tid"); o.afterUpdateCallback(a, g, h, m) } o.finalizeUpdate() }, 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 (this.obj._dp_init) { this.obj._dp_init(this) } }, setOnAfterUpdate: function(a) { this.attachEvent("onAfterUpdate", a) }, enableDebug: function(a) {}, setOnBeforeUpdateHandler: function(a) { this.attachEvent("onBeforeDataSending", a) }, setAutoUpdate: function(g, c) { g = g || 2000; this._user = c || (new Date()).valueOf(); this._need_update = false; this._loader = null; this._update_busy = false; this.attachEvent("onAfterUpdate", function(h, m, n, l) { this.afterAutoUpdate(h, m, n, l) }); this.attachEvent("onFullSync", function() { this.fullSync() }); var a = this; window.setInterval(function() { a.loadUpdate() }, g) }, afterAutoUpdate: function(a, g, h, c) { if (g == "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 } this._loader = this._loader || new dtmlXMLLoaderObject(true); this._loader.async = true; this._loader.waitCall = c; this._loader.loadXML(a) }, _v: function(a) { if (a.firstChild) { return a.firstChild.nodeValue } return "" }, _a: function(a) { var g = []; for (var c = 0; c < a.length; c++) { g[c] = this._v(a[c]) } return g }, loadUpdate: function() { var c = this; var a = this.obj.getUserData(0, "version"); var g = this.serverProcessor + getUrlSymbol(this.serverProcessor) + ["dhx_user=" + this._user, "dhx_version=" + a].join("&"); g = g.replace("editing=true&", ""); this.getUpdates(g, function() { var m = c._loader.doXPath("//userdata"); c.obj.setUserData(0, "version", c._v(m[0])); var h = c._loader.doXPath("//update"); if (h.length) { c._silent_mode = true; for (var n = 0; n < h.length; n++) { var l = h[n].getAttribute("status"); var q = h[n].getAttribute("id"); var o = h[n].getAttribute("parent"); switch (l) { case "inserted": c.callEvent("insertCallback", [h[n], q, o]); break; case "updated": c.callEvent("updateCallback", [h[n], q, o]); break; case "deleted": c.callEvent("deleteCallback", [h[n], q, o]); break } } c._silent_mode = false } c._update_busy = false; c = null }) } }; if (window.dhtmlXGridObject && !dhtmlXGridObject.prototype._init_point_connector) { dhtmlXGridObject.prototype._init_point_connector = dhtmlXGridObject.prototype._init_point; dhtmlXGridObject.prototype._init_point = function() { this._con_f_used = [].concat(this._con_f_used); dhtmlXGridObject.prototype._con_f_used = []; var a = function(l) { l = l.replace(/(\?|\&)connector[^\f]*/g, ""); return l + (l.indexOf("?") != -1 ? "&" : "?") + "connector=true" + (this.hdr.rows.length > 0 ? "&dhx_no_header=1" : "") }; var h = function(l) { return a.call(this, l) + (this._connector_sorting || "") + (this._connector_filter || "") }; var g = function(m, n, l) { this._connector_sorting = "&dhx_sort[" + n + "]=" + l; return h.call(this, m) }; var c = function(m, l, o) { var q = []; for (var n = 0; n < l.length; n++) { q[n] = "dhx_filter[" + l[n] + "]=" + encodeURIComponent(o[n]) } this._connector_filter = "&" + q.join("&"); return h.call(this, m) }; this.attachEvent("onCollectValues", function(l) { if (this._con_f_used[l]) { if (typeof(this._con_f_used[l]) == "object") { return this._con_f_used[l] } else { return false } } return true }); this.attachEvent("onDynXLS", function() { this.xmlFileUrl = h.call(this, this.xmlFileUrl); return true }); this.attachEvent("onBeforeSorting", function(o, n, m) { if (n == "connector") { var l = this; this.clearAndLoad(g.call(this, this.xmlFileUrl, o, m), function() { l.setSortImgState(true, o, m) }); return false } return true }); this.attachEvent("onFilterStart", function(m, l) { var o = this.getSortingState(); if (this._con_f_used.length) { var n = this; this.clearAndLoad(c.call(this, this.xmlFileUrl, m, l)); if (o.length) { n.setSortImgState(true, o[0], o[1]) } return false } return true }); this.attachEvent("onXLE", function(m, l, o, n) { if (!n) { return } }); if (this._init_point_connector) { this._init_point_connector() } }; 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) }; dhtmlXGridObject.prototype.load_connector = dhtmlXGridObject.prototype.load; dhtmlXGridObject.prototype.load = function(c, l, h) { if (!this._colls_loaded && this.cellType) { var a = []; for (var g = 0; g < this.cellType.length; g++) { if (this.cellType[g].indexOf("co") == 0 || this.cellType[g].indexOf("clist") == 0 || this._con_f_used[g] == 2) { a.push(g) } } 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 = this.xmlLoader.doXPath("./coll_options", arguments[0]); for (var n = 0; n < s.length; n++) { var q = s[n].getAttribute("for"); var u = []; var h = null; if (this.cellType[q] == "combo") { h = this.getColumnCombo(q) } else { if (this.cellType[q].indexOf("co") == 0) { h = this.getCombo(q) } } var m = this.xmlLoader.doXPath("./item", s[n]); var a = []; for (var l = 0; l < m.length; l++) { var g = m[l].getAttribute("value"); if (h) { var o = m[l].getAttribute("label") || g; if (h.addOption) { a.push([g, o]) } else { h.put(g, o) } u[u.length] = o } else { u[u.length] = g } } if (a.length) { if (h) { h.addOption(a) } } else { if (u.length && !h) { if (this.registerCList) { this.registerCList(q * 1, u) } } } if (this._con_f_used[q * 1]) { this._con_f_used[q * 1] = u } } this._colls_loaded = true } } } if (window.dataProcessor && !dataProcessor.prototype.init_original) { dataProcessor.prototype.init_original = dataProcessor.prototype.init; dataProcessor.prototype.init = function(a) { this.init_original(a); a._dataprocessor = this; this.setTransactionMode("POST", true); this.serverProcessor += (this.serverProcessor.indexOf("?") != -1 ? "&" : "?") + "editing=true" } } dhtmlxError.catchError("LoadXML", function(h, g, l) { alert(l[0].responseText) }); function dhtmlXCellObject(g, a) { this.cell = document.createElement("DIV"); this.cell.className = "dhx_cell" + (a || ""); this._idd = g; 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" }, 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 h in this.conf.idx) { this.conf.idx[h] = null; delete this.conf.idx[h] } for (var n = 0; n < this.cell.childNodes.length; n++) { var l = this.cell.childNodes[n].className; for (var h in this.conf.idx_data) { var m = new RegExp(this.conf.idx_data[h]); if (l.match(m) != null) { this.conf.idx[h] = n } } } this.callEvent("_onIdxUpdated", []) }; this._adjustAttached = function() { for (var h in this.dataNodes) { if (this.dataNodes[h] != null && typeof(this.dataNodes[h].setSizes) == "function") { this.dataNodes[h].setSizes() } } if (this.dataObj != null && typeof(this.dataObj.setSizes) == "function") { this.dataObj.setSizes.apply(this.dataObj, arguments) } }; this._setSize = function(m, s, n, q, r, l, o) { if (!this.conf.size) { this.conf.size = {} } this.conf.size.x = m; this.conf.size.y = s; this.conf.size.w = n; this.conf.size.h = q; this.cell.style.left = m + "px"; this.cell.style.top = s + "px"; this.cell.style.width = n + "px"; this.cell.style.height = q + "px"; this.callEvent("_onSetSize", []); if (l !== true) { this._adjustCont(r, o) } else { this._adjustAttached(r) } this._adjustProgress() }; this._adjustCont = function(q, n) { var o = this.cell.childNodes[this.conf.idx.cont]; var m = 0; for (var h in this.conf.ofs_nodes.t) { var l = this.conf.ofs_nodes.t[h]; m += (l == "func" ? this[h]() : (l == true ? this.cell.childNodes[this.conf.idx[h]].offsetHeight : 0)) } var r = 0; for (var h in this.conf.ofs_nodes.b) { var l = this.conf.ofs_nodes.b[h]; r += (l == "func" ? this[h]() : (l == true ? this.cell.childNodes[this.conf.idx[h]].offsetHeight : 0)) } o.style.left = "0px"; o.style.top = m + "px"; if (!this.conf.cells_cont) { this.conf.cells_cont = {}; o.style.width = this.cell.offsetWidth + "px"; o.style.height = Math.max(this.cell.offsetHeight - m - r, 0) + "px"; this.conf.cells_cont.w = parseInt(o.style.width) - o.offsetWidth; this.conf.cells_cont.h = parseInt(o.style.height) - o.offsetHeight } o.style.left = "0px"; o.style.top = m + "px"; o.style.width = Math.max(this.cell.offsetWidth + this.conf.cells_cont.w, 0) + "px"; o.style.height = Math.max(this.conf.size.h - m - r + this.conf.cells_cont.h, 0) + "px"; o = null; this._adjustAttached(q); if (n == "expand" && this.dataType == "editor" && this.dataObj != null) { this.dataObj._prepareContent(true) } }; this._mtbUpdBorder = function() { var l = ["menu", "toolbar"]; for (var n = 0; n < l.length; n++) { if (this.conf.idx[l[n]] != null) { var o = this.cell.childNodes[this.conf.idx[l[n]]]; var m = "dhx_cell_" + l[n] + "_no_borders"; var h = "dhx_cell_" + l[n] + "_def"; o.className = o.className.replace(new RegExp(this.conf.borders ? m : h), this.conf.borders ? h : m); o = 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(m) { this.views[m] = { borders: this.conf.borders, ofs_nodes: { t: {}, b: {} }, dataType: this.dataType, dataObj: this.dataObj, cellCont: [], dataNodes: {}, dataNodesCont: {} }; var n = this.cell.childNodes[this.conf.idx.cont]; while (n.childNodes.length > 0) { this.views[m].cellCont.push(n.firstChild); n.removeChild(n.firstChild) } this.dataType = null; this.dataObj = null; for (var l in this.dataNodes) { for (var h in this.conf.ofs_nodes) { if (typeof(this.conf.ofs_nodes[h][l]) != "undefined") { this.views[m].ofs_nodes[h][l] = this.conf.ofs_nodes[h][l]; this.conf.ofs_nodes[h][l] = null; delete this.conf.ofs_nodes[h][l] } } this.views[m].dataNodesCont[l] = this.cell.childNodes[this.conf.idx[l]]; this.cell.removeChild(this.cell.childNodes[this.conf.idx[l]]); this.views[m].dataNodes[l] = this.dataNodes[l]; this.dataNodes[l] = null; delete this.dataNodes[l]; this._updateIdx() } this.callEvent("_onViewSave", [m]) }; this._viewRestore = function(m) { if (this.views[m] == null) { return } this.dataObj = this.views[m].dataObj; this.dataType = this.views[m].dataType; for (var n = 0; n < this.views[m].cellCont.length; n++) { this.cell.childNodes[this.conf.idx.cont].appendChild(this.views[m].cellCont[n]) } for (var l in this.views[m].dataNodes) { this.dataNodes[l] = this.views[m].dataNodes[l]; if (l == "menu") { this.cell.insertBefore(this.views[m].dataNodesCont[l], this.cell.childNodes[this.conf.idx.toolbar || this.conf.idx.cont]) } if (l == "toolbar") { this.cell.insertBefore(this.views[m].dataNodesCont[l], this.cell.childNodes[this.conf.idx.cont]) } if (l == "sb") { this.cell.appendChild(this.views[m].dataNodesCont[l]) } this._updateIdx() } for (var l in this.views[m].ofs_nodes) { for (var h in this.views[m].ofs_nodes[l]) { this.conf.ofs_nodes[l][h] = this.views[m].ofs_nodes[l][h] } } if (this.conf.borders != this.views[m].borders) { this[this.views[m].borders ? "_showBorders" : "_hideBorders"](true) } this.callEvent("_onViewRestore", [m]); this._viewDelete(m) }; this._viewDelete = function(m) { if (this.views[m] == null) { return } this.views[m].borders = null; for (var l in this.views[m].ofs_nodes) { for (var h in this.views[m].ofs_nodes[l]) { this.views[m].ofs_nodes[l][h] = null } this.views[m].ofs_nodes[l] = null } this.views[m].dataType = null; this.views[m].dataObj = null; for (var n = 0; n < this.views[m].cellCont.length; n++) { this.views[m].cellCont[n] = null } this.views[m].cellCont = null; for (var l in this.views[m].dataNodes) { this.views[m].dataNodes[l] = null; this.views[m].dataNodesCont[l] = null } this.views[m].dataNodes = this.views[m].dataNodesCont = null; this.views[m] = null; delete this.views[m] }; 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(h) { if (h == this.conf.view) { var l = this.conf.unloading; this.conf.unloading = true; this.detachMenu(); this.detachToolbar(); this.detachStatusBar(); this.detachRibbon(); this._detachObject(null, true); this.conf.unloading = l; if (!this.conf.unloading) { this._adjustCont(this._idd) } return } if (this.views[h] == null) { return } var g = this.views[h]; for (var c in g.dataNodes) { if (typeof(g.dataNodes[c].unload) == "function") { g.dataNodes[c].unload() } g.dataNodes[c] = null; g.dataNodesCont[c] = null } if (g.dataType == "url") { if (g.cellCont != null && g.cellCont[0] != "null") { this._detachURLEvents(g.cellCont[0]) } } else { if (g.dataObj != null) { if (typeof(g.dataObj.unload) == "function") { g.dataObj.unload() } else { if (typeof(g.dataObj.destructor) == "function") { g.dataObj.destructor() } } g.dataObj = null } } g = null; this._viewDelete(h); if (typeof(this.conf.views_loaded[h]) != "undefined") { delete this.conf.views_loaded[h] } }; dhtmlXCellObject.prototype.getId = function() { return this._idd }; dhtmlXCellObject.prototype.progressOn = function() { if (this.conf.progress) { return } this.conf.progress = true; var c = document.createElement("DIV"); c.className = "dhx_cell_progress_bar"; this.cell.appendChild(c); var a = document.createElement("DIV"); a.className = "dhx_cell_progress_img"; this.cell.appendChild(a); c = a = null; this._updateIdx(); this._adjustProgress() }; dhtmlXCellObject.prototype.progressOff = function() { if (!this.conf.progress) { 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._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(l, g) { if (window.dhx4.s2b(g) && !(typeof(window.dhtmlXWindowsCell) != "undefined" && (this instanceof window.dhtmlXWindowsCell))) { g = false } if (typeof(l) == "string") { l = document.getElementById(l) } if (l.parentNode == this.cell.childNodes[this.conf.idx.cont]) { l = null; return } if (g) { l.style.display = ""; var a = l.offsetWidth; var c = l.offsetHeight } this._attachObject(l); this.dataType = "obj"; l.style.display = ""; l = null; if (g) { 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.getAttachedMenu = function() { return this.dataNodes.menu }; dhtmlXCellObject.prototype.getAttachedToolbar = function() { return this.dataNodes.toolbar }; dhtmlXCellObject.prototype.getAttachedRibbon = function() { return this.dataNodes.ribbon }; dhtmlXCellObject.prototype.getAttachedStatusBar = function() { return this.dataNodes.sb }; dhtmlXCellObject.prototype.getAttachedObject = function() { return this.dataObj }; dhtmlXCellObject.prototype.attachURL = function(c, r, g) { if (g == true) { g = {} } var h = (typeof(g) != "undefined" && g != false && g != null); if (!this.conf.url_data) { this.conf.url_data = {} } this.conf.url_data.url = c; this.conf.url_data.ajax = (r == true); this.conf.url_data.post_data = (g == true ? {} : (g || null)); if (r == true) { var q = this; if (h) { var l = ""; for (var o in g) { l += "&" + encodeURIComponent(o) + "=" + encodeURIComponent(g[o]) } dhx4.ajax.post(c, l, function(a) { q.attachHTMLString("
" + a.xmlDoc.responseText + "
"); if (typeof(q._doOnFrameContentLoaded) == "function") { q._doOnFrameContentLoaded() } q.dataType = "url-ajax"; q = a = null }) } else { dhx4.ajax.get(c, function(a) { q.attachHTMLString("
" + a.xmlDoc.responseText + "
"); if (typeof(q._doOnFrameContentLoaded) == "function") { q._doOnFrameContentLoaded() } q.dataType = "url-ajax"; q = a = null }) } } else { if (this.dataType == "url") { var m = this.getFrame() } else { var m = document.createElement("IFRAME"); m.frameBorder = 0; m.border = 0; m.style.width = "100%"; m.style.height = "100%"; m.style.position = "relative"; this._attachObject(m); this.dataType = "url"; this._attachURLEvents() } if (h) { var n = (typeof(this.conf.url_data.post_ifr) == "undefined"); this.conf.url_data.post_ifr = true; if (n) { this._attachURLEvents() } m.src = "about:blank" } else { m.src = c + (c.indexOf("?") >= 0 ? "&" : "?") + "dhxr" + new Date().getTime() } m = null } m = 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.attachLayout = function(a) { if (this.conf.skin == "dhx_skyblue" && typeof(window.dhtmlXWindowsCell) != "undefined" && (this instanceof dhtmlXWindowsCell)) {} if (this instanceof dhtmlXLayoutCell) { this._hideBorders() } 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 (this instanceof window.dhtmlXLayoutCell) {} if (typeof(window.dhtmlXLayoutCell) != "undefined" && this instanceof dhtmlXLayoutCell) { c._isParentCell = true } if (typeof(window.dhtmlXAccordionCell) != "undefined" && (this instanceof window.dhtmlXAccordionCell)) { c._ofs = { t: -1 } } 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 }; dhtmlXCellObject.prototype.attachTree = 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); 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 }; dhtmlXCellObject.prototype.attachGrid = function() { 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 (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 }; dhtmlXCellObject.prototype.attachTabbar = function(a) { if (typeof(window.dhtmlXLayoutCell) != "undefined" && this instanceof dhtmlXLayoutCell) { this._hideBorders() } 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 } } 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 }; dhtmlXCellObject.prototype.attachAccordion = function(a) { if (typeof(window.dhtmlXWindowsCell) != "undefined" && (this instanceof dhtmlXWindowsCell)) {} else { if (this._isCell) { this._hideBorders() } } 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 } } } this.dataType = "acc"; this.dataObj = new dhtmlXAccordion(a); a.obj = null; c = a = null; this.callEvent("_onContentAttach", []); return this.dataObj }; dhtmlXCellObject.prototype.attachEditor = 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 (!(typeof(a) == "object" && a != null)) { a = {} } a.parent = c; this.dataType = "editor"; this.dataObj = new dhtmlXEditor(a); c = null; a.parent = null; a = null; this.callEvent("_onContentAttach", []); return this.dataObj }; dhtmlXCellObject.prototype.attachDataView = 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 (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 }; dhtmlXCellObject.prototype.attachScheduler = function(a, n, c, h) { h = h || window.scheduler; var l = false; if (c) { var m = document.getElementById(c); if (m) { l = true } } if (!l) { var g = c || '
'; var m = document.createElement("DIV"); m.id = "dhxSchedObj_" + new Date().getTime(); m.style.width = "100%"; m.style.height = "100%"; m.style.position = "relative"; m.style.overflow = "hidden"; m.className = "dhx_cal_container"; m.innerHTML = '
 
 
' + g + '
' } this._attachObject(m); this.dataType = "scheduler"; this.dataObj = h; this.dataObj.setSizes = function() { this.update_view() }; h.init(m.id, a, n); m = null; this.callEvent("_onContentAttach", []); return this.dataObj }; dhtmlXCellObject.prototype.attachForm = function(a) { 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 }; dhtmlXCellObject.prototype.attachMap = function(a) { var c = document.createElement("DIV"); c.id = "GMapsObj_" + this._genStr(12); 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.attachChart = function(a) { 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 }; dhtmlXCellObject.prototype.attachMenu = function(a) { if (this.dataNodes.menu) { return } 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; 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.attachToolbar = function(a) { if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) { return } 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; 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.attachRibbon = function(a) { if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) { return } 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; 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.attachStatusBar = function(a) { 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 += " 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._genStr = function() { if (!this._genStrId) { this._genStrId = new Date().getTime() } return this._genStrId++ }; dhtmlXCellObject.prototype._attachURLEvents = function() { if (this.dataType != "url") { return } var g = this; var c = this._idd; var a = this.cell.childNodes[this.conf.idx.cont].firstChild; if (typeof(this._doOnFrameMouseDown) != "function") { this._doOnFrameMouseDown = function(h) { g.callEvent("_onContentMouseDown", [c, h || event]) } } if (typeof(window.addEventListener) == "function") { a.onload = function() { try { if (typeof(g._doOnFrameMouseDown) == "function") { this.contentWindow.document.body.addEventListener("mousedown", g._doOnFrameMouseDown, false) } } catch (h) {} try { if (typeof(g._doOnFrameContentLoaded) == "function") { g._doOnFrameContentLoaded() } } catch (h) {} } } else { a.onreadystatechange = function(h) { if (this.readyState == "complete") { try { if (typeof(g._doOnFrameMouseDown) == "function") { this.contentWindow.document.body.attachEvent("onmousedown", g._doOnFrameMouseDown) } } catch (l) {} try { if (typeof(g._doOnFrameContentLoaded) == "function") { g._doOnFrameContentLoaded() } } catch (l) {} } } } }; dhtmlXCellObject.prototype._doOnFrameContentLoaded = function() { if (this.conf.url_data.post_ifr == true) { var m = this.getFrame().contentWindow.document; var l = m.createElement("FORM"); l.method = "POST"; l.action = this.conf.url_data.url; m.body.appendChild(l); var g = {}; g["dhxr" + new Date().getTime()] = "1"; for (var c in this.conf.url_data.post_data) { g[c] = this.conf.url_data.post_data[c] } for (var c in g) { var h = m.createElement("INPUT"); h.type = "hidden"; h.name = c; h.value = g[c]; l.appendChild(h); h = null } this.conf.url_data.post_ifr = false; l.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(o, l, n, a, m) { if (o == "menu") { if (typeof(m) != "undefined") { o = m } else { o = document.createElement("DIV"); o.className = "dhx_cell_menu_" + (this.conf.borders ? "def" : "no_borders"); o.appendChild(document.createElement("DIV")) } this.cell.insertBefore(o, this.cell.childNodes[this.conf.idx.toolbar || this.conf.idx.cont]); this.conf.ofs_nodes.t.menu = true; this._updateIdx(); return o } if (o == "toolbar") { if (typeof(m) != "undefined") { o = m } else { o = document.createElement("DIV"); o.className = "dhx_cell_toolbar_" + (this.conf.borders ? "def" : "no_borders"); o.appendChild(document.createElement("DIV")); o.firstChild.className = "dhx_toolbar_base_18_dhx_skyblue" } this.cell.insertBefore(o, this.cell.childNodes[this.conf.idx.cont]); this.conf.ofs_nodes.t.toolbar = true; this._updateIdx(); return o } if (o == "ribbon") { if (typeof(m) != "undefined") { o = m } else { o = document.createElement("DIV"); o.className = "dhx_cell_ribbon_" + (this.conf.borders ? "def" : "no_borders"); o.appendChild(document.createElement("DIV")) } this.cell.insertBefore(o, this.cell.childNodes[this.conf.idx.cont]); this.conf.ofs_nodes.t.ribbon = true; this._updateIdx(); this._adjustCont(this._idd); return o } if (o == "sb") { if (typeof(m) != "undefined") { o = m } else { var c = l || {}; var q = (typeof(c.text) == "string" && c.text.length > 0 ? c.text : " "); var g = (typeof(c.height) == "number" ? c.height : false); var o = document.createElement("DIV"); o.className = "dhx_cell_statusbar_def"; o.innerHTML = "
" + q + "
"; if (g != false) { o.firstChild.style.height = o.firstChild.style.lineHeight = g + "px" } } if (this.conf.idx.pr1 != null) { this.cell.insertBefore(o, this.cell.childNodes[this.conf.idx.pr1]) } else { this.cell.appendChild(o) } this.conf.ofs_nodes.b.sb = true; this._updateIdx(); this._adjustCont(this._idd); return o } if (a != true) { this._detachObject(null, true, null) } if (typeof(n) == "string") { this.cell.childNodes[this.conf.idx.cont].innerHTML = n } else { this.cell.childNodes[this.conf.idx.cont].appendChild(o) } o = null }; dhtmlXCellObject.prototype._detachObject = function(l, c, a) { this.callEvent("_onBeforeContentDetach", []); if (l == "menu" || l == "toolbar" || l == "ribbon" || l == "sb") { var h = this.cell.childNodes[this.conf.idx[l]]; h.parentNode.removeChild(h); h = null; this.conf.ofs_nodes[l == "sb" ? "b" : "t"][l] = 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 h = this.cell.childNodes[this.conf.idx.cont]; while (h.childNodes.length > 0) { if (a === false) { h.removeChild(h.lastChild) } else { h.firstChild.style.display = "none"; a.appendChild(h.firstChild) } } if (this.conf.append_mode) { h.style.overflow = ""; this.conf.append_mode = false } var g = (this.dataType == "tabbar"); this.dataObj = null; this.dataType = null; a = h = null; if (this.conf.unloading != true && g) { this.showHeader(true); this._showBorders() } }; dhtmlXCellObject.prototype._attachFromCell = function(c) { this.detachObject(true); var h = "layout"; if (typeof(window.dhtmlXWindowsCell) != "undefined" && this instanceof window.dhtmlXWindowsCell) { h = "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 g in c.dataNodes) { this._attachObject(g, null, null, null, c.cell.childNodes[c.conf.idx[g]]); this.dataNodes[g] = c.dataNodes[g]; c.dataNodes[g] = null; c.conf.ofs_nodes[g == "sb" ? "b" : "t"][g] = 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 (h == "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 g in c.views) { this.views[g] = c.views[g]; c.views[g] = null; delete c.views[g] } c._updateIdx(); c._adjustCont(); this._updateIdx(); this._adjustCont(); if (h == "window" && this.wins.w[this._idd].conf.parked) { this.wins._winCellSetOpacity(this._idd, "close", false) } }; function dhtmlXCalendarObject(m, u) { this.i = {}; var g = null; if (typeof(m) == "string") { var h = document.getElementById(m) } else { var h = m } if (h && typeof(h) == "object" && h.tagName && String(h.tagName).toLowerCase() != "input") { g = h } h = null; if (typeof(m) != "object" || !m.length) { m = [m] } for (var c = 0; c < m.length; c++) { if (typeof(m[c]) == "string") { m[c] = (document.getElementById(m[c]) || null) } if (m[c] != null && m[c].tagName && String(m[c].tagName).toLowerCase() == "input") { this.i[window.dhx4.newId()] = { input: m[c] } } else { if (!(m[c] instanceof Array) && m[c] instanceof Object && (m[c].input != null || m[c].button != null)) { if (m[c].input != null && typeof(m[c].input) == "string") { m[c].input = document.getElementById(m[c].input) } if (m[c].button != null && typeof(m[c].button) == "string") { m[c].button = document.getElementById(m[c].button) } this.i[window.dhx4.newId()] = m[c] } } m[c] = null } this.conf = { skin: (u || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhtmlxcalendar") || "dhx_skyblue"), zi: window.dhx4.newId(), touch: (typeof(window.ontouchstart) != "undefined") }; this.setSkin = function(q, a) { if (this.conf.skin == q && !a) { return } this.conf.skin = q; 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 (g != null) { this._hasParent = true; g.appendChild(this.base); g = 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); if (this.conf.touch) { this.base.ontouchstart = function(a) { a = a || event; if (a.preventDefault) { a.preventDefault() } a.cancelBubble = true } } else { this.base.onclick = function(a) { a = a || event; a.cancelBubble = true }; this.base.onmousedown = function() { return false } } this.loadUserLanguage = function(y) { if (!this.langData[y]) { return } this.lang = y; this.setWeekStartDay(this.langData[this.lang].weekstart); this.setDateFormat(this.langData[this.lang].dateformat || "%Y-%m-%d"); if (this.msCont) { var x = 0; for (var v = 0; v < this.msCont.childNodes.length; v++) { for (var a = 0; a < this.msCont.childNodes[v].childNodes.length; a++) { this.msCont.childNodes[v].childNodes[a].innerHTML = this.langData[this.lang].monthesSNames[x++] } } } }; 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 n = document.createElement("UL"); n.className = "dhtmlxcalendar_line"; this.contMonth.appendChild(n); var s = document.createElement("LI"); s.className = "dhtmlxcalendar_cell dhtmlxcalendar_month_hdr"; s.innerHTML = "
"; n.appendChild(s); var l = this; s[this.conf.touch ? "ontouchstart" : "onclick"] = function(w) { w = w || event; var q = (w.target || w.srcElement); if (q.className && q.className.indexOf("dhtmlxcalendar_month_arrow") === 0) { l._hideSelector(); var v = (q.parentNode.firstChild == q ? -1 : 1); var a = new Date(l._activeMonth); l._drawMonth(new Date(l._activeMonth.getFullYear(), l._activeMonth.getMonth() + v, 1, 0, 0, 0, 0)); l._evOnArrowClick([a, new Date(l._activeMonth)]); return } if (q.className && q.className == "dhtmlxcalendar_month_label_month") { w.cancelBubble = true; l._showSelector("month", Math.round(q.offsetLeft + q.offsetWidth / 2), q.offsetTop + q.offsetHeight + 2, "selector_month", true); return } if (q.className && q.className == "dhtmlxcalendar_month_label_year") { w.cancelBubble = true; l._showSelector("year", Math.round(q.offsetLeft + q.offsetWidth / 2), q.offsetTop + q.offsetHeight + 2, "selector_year", true); return } l._hideSelector() }; 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 y = document.createElement("UL"); y.className = "dhtmlxcalendar_line"; this.contDays.appendChild(y) } else { var y = this.contDays.firstChild } var v = this._wStart; var x = this.langData[this.lang].daysSNames; x.push(String(this.langData[this.lang].daysSNames[0]).valueOf()); for (var A = 0; A < 8; A++) { if (y.childNodes[A] == null) { var a = document.createElement("LI"); y.appendChild(a) } else { var a = y.childNodes[A] } if (A == 0) { a.className = "dhtmlxcalendar_cell_wn"; a.innerHTML = "
" + (this.langData[this.lang].weekname || "w") + "
" } else { a.className = "dhtmlxcalendar_cell" + (v >= 6 ? " dhtmlxcalendar_day_weekday_cell" : "") + (A == 1 ? "_first" : ""); a.innerHTML = x[v]; if (++v > 7) { v = 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[this.conf.touch ? "ontouchend" : "onclick"] = function(y) { y = y || event; var q = (y.target || y.srcElement); if (q.parentNode != null && q.parentNode._date != null) { q = q.parentNode } if (q._date != null && !q._css_dis) { var w = l._activeDate.getHours(); var v = l._activeDate.getMinutes(); var x = q._date; if (l.checkEvent("onBeforeChange")) { if (!l.callEvent("onBeforeChange", [new Date(q._date.getFullYear(), q._date.getMonth(), q._date.getDate(), w, v)])) { return } } if (l._activeDateCell != null) { l._activeDateCell._css_date = false; l._updateCellStyle(l._activeDateCell._q, l._activeDateCell._w) } var a = (l._activeDate.getFullYear() + "_" + l._activeDate.getMonth() != x.getFullYear() + "_" + x.getMonth()); l._nullDate = false; l._activeDate = new Date(x.getFullYear(), x.getMonth(), x.getDate(), w, v); l._activeDateCell = q; l._activeDateCell._css_date = true; l._activeDateCell._css_hover = false; l._updateCellStyle(l._activeDateCell._q, l._activeDateCell._w); if (a) { l._drawMonth(l._activeDate) } if (l._activeInp && l.i[l._activeInp] && l.i[l._activeInp].input != null) { l.i[l._activeInp].input.value = l._dateToStr(new Date(l._activeDate.getTime())) } if (!l._hasParent) { l._hide() } l._evOnClick([new Date(l._activeDate.getTime())]) } }; if (!this.conf.touch) { this.contDates.onmouseover = function(q) { q = q || event; var a = (q.target || q.srcElement); if (a.parentNode != null && a.parentNode._date != null) { a = a.parentNode } if (a._date != null) { if (l._lastHover == a || a._css_hover) { return } a._css_hover = true; l._updateCellStyle(a._q, a._w); l._lastHover = a; l._evOnMouseOver([new Date(a._date.getFullYear(), a._date.getMonth(), a._date.getDate(), 0, 0, 0, 0), q]); a = null } }; this.contDates.onmouseout = function(a) { l._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); l._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 n = document.createElement("UL"); n.className = "dhtmlxcalendar_line"; this.contDates.appendChild(n); for (var r = 0; r <= 7; r++) { var s = document.createElement("LI"); if (r == 0) { s.className = "dhtmlxcalendar_cell_wn" } else { s.className = "dhtmlxcalendar_cell" } n.appendChild(s) } } 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 n = document.createElement("UL"); n.className = "dhtmlxcalendar_line"; this.contTime.appendChild(n); var s = document.createElement("LI"); s.className = "dhtmlxcalendar_cell dhtmlxcalendar_time_hdr"; s.innerHTML = "
: "; n.appendChild(s); s[this.conf.touch ? "ontouchstart" : "onclick"] = function(v) { v = v || event; var a = (v.target || v.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") { v.cancelBubble = true; var q = l.contMonth.offsetHeight + l.contDays.offsetHeight + l.contDates.offsetHeight + a.offsetTop; l._showSelector("hours", Math.round(a.offsetLeft + a.offsetWidth / 2), q - 2, "selector_hours", true); return } if (a.className && a.className == "dhtmlxcalendar_label_minutes") { v.cancelBubble = true; if (l._minutesInterval == 1) { var w = l.getFormatedDate("%i"); a.innerHTML = "" + w.charAt(0) + "" + w.charAt(1); a.firstChild._par = true; l._selectorMode = 1 } var q = l.contMonth.offsetHeight + l.contDays.offsetHeight + l.contDates.offsetHeight + a.offsetTop; l._showSelector("minutes", Math.round(a.offsetLeft + a.offsetWidth / 2), q - 2, "selector_minutes", true); return } l._hideSelector() }; this._activeMonth = null; this._activeDate = new Date(); this._activeDateCell = null; this.setDate = function(q) { this._nullDate = (typeof(q) == "undefined" || q === "" || !q); if (!(q instanceof Date)) { q = this._strToDate(String(q || "")); if (q == "Invalid Date") { q = new Date() } } var a = q.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(q) { if (this._nullDate) { return null } var a = new Date(this._activeDate.getTime()); if (q) { return this._dateToStr(a) } 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 x = C.getDay(); var I = x - 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 A = 0; for (var v = 0; v < 6; v++) { 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() + A, 0, 0, 0, 0)); this.contDates.childNodes[v].childNodes[K].innerHTML = "
" + J + "
" } else { var a = new Date(C.getFullYear(), C.getMonth(), C.getDate() + A, 0, 0, 0, 0); var H = a.getDay(); var y = a.getTime(); var F = "dhtmlxcalendar_label"; if (this._tipData[y] != null) { if (this._tipData[y].usePopup && typeof(window.dhtmlXPopup) == "function") { this.contDates.childNodes[v].childNodes[K].removeAttribute("title"); this._initTooltipPopup() } else { this.contDates.childNodes[v].childNodes[K].setAttribute("title", this._tipData[y].text) } if (this._tipData[y].showIcon) { F += " dhtmlxcalendar_label_title" } } else { this.contDates.childNodes[v].childNodes[K].removeAttribute("title") } this.contDates.childNodes[v].childNodes[K].innerHTML = "
" + a.getDate() + "
"; this.contDates.childNodes[v].childNodes[K]._date = new Date(y); this.contDates.childNodes[v].childNodes[K]._q = v; this.contDates.childNodes[v].childNodes[K]._w = K; this.contDates.childNodes[v].childNodes[K]._css_month = (a.getMonth() == L); this.contDates.childNodes[v].childNodes[K]._css_date = (!this._nullDate && y == M); this.contDates.childNodes[v].childNodes[K]._css_weekend = (D >= 6); this.contDates.childNodes[v].childNodes[K]._css_dis = this._isOutOfRange(y); this.contDates.childNodes[v].childNodes[K]._css_holiday = (this._holidays[y] == true); this._updateCellStyle(v, K); if (y == M) { this._activeDateCell = this.contDates.childNodes[v].childNodes[K] } if (++D > 7) { D = 1 } A++ } } } this.contMonth.firstChild.firstChild.childNodes[1].innerHTML = this._buildMonthHdr(E) }; this._updateCellStyle = function(y, a) { var x = this.contDates.childNodes[y].childNodes[a]; var v = "dhtmlxcalendar_cell dhtmlxcalendar_cell"; v += (x._css_month ? "_month" : ""); v += (x._css_date ? "_date" : ""); v += (x._css_weekend ? "_weekend" : ""); v += (x._css_holiday ? "_holiday" : ""); v += (x._css_dis ? "_dis" : ""); v += (x._css_hover && !x._css_dis ? "_hover" : ""); x.className = v; x = null }; this._minutesInterval = 5; this._initSelector = function(E, y) { 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 = " "; if (!this.conf.touch) { 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(w) { w = w || event; var q = (w.target || w.srcElement); if (q._cell === true) { if (l._selHover != q) { l._clearSelHover() } if (String(q.className).match(/^\s{0,}dhtmlxcalendar_selector_cell\s{0,}$/gi) != null) { q.className += " dhtmlxcalendar_selector_cell_hover"; l._selHover = q } } }; this._sel.onmouseout = function() { l._clearSelHover() } } this._sel.firstChild.firstChild.firstChild.childNodes[0][this.conf.touch ? "ontouchstart" : "onclick"] = function(q) { q = q || event; q.cancelBubble = true; l._scrollYears(-1) }; this._sel.firstChild.firstChild.firstChild.childNodes[2][this.conf.touch ? "ontouchstart" : "onclick"] = function(q) { q = q || event; q.cancelBubble = true; l._scrollYears(1) }; this._sel._ta = {}; this._selHover = null; this._sel.appendChild(document.createElement("DIV")); this._sel.lastChild.className = "dhtmlxcalendar_selector_obj_arrow" } if (this._sel._ta[E] == true) { return } if (E == "month") { this._msCells = {}; this.msCont = document.createElement("DIV"); this.msCont.className = "dhtmlxcalendar_area_" + y; this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.msCont); var v = 0; for (var a = 0; a < 4; a++) { var D = document.createElement("UL"); D.className = "dhtmlxcalendar_selector_line"; this.msCont.appendChild(D); for (var F = 0; F < 3; F++) { var H = document.createElement("LI"); H.innerHTML = this.langData[this.lang].monthesSNames[v]; H.className = "dhtmlxcalendar_selector_cell"; D.appendChild(H); H._month = v; H._cell = true; this._msCells[v++] = H } } this.msCont[this.conf.touch ? "ontouchstart" : "onclick"] = function(w) { w = w || event; w.cancelBubble = true; var q = (w.target || w.srcElement); if (q._month != null) { l._hideSelector(); l._updateActiveMonth(); l._drawMonth(new Date(l._activeMonth.getFullYear(), q._month, 1, 0, 0, 0, 0)); l._doOnSelectorChange() } } } if (E == "year") { this._ysCells = {}; this.ysCont = document.createElement("DIV"); this.ysCont.className = "dhtmlxcalendar_area_" + y; this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.ysCont); for (var a = 0; a < 4; a++) { var D = document.createElement("UL"); D.className = "dhtmlxcalendar_selector_line"; this.ysCont.appendChild(D); for (var F = 0; F < 3; F++) { var H = document.createElement("LI"); H.className = "dhtmlxcalendar_selector_cell"; H._cell = true; D.appendChild(H) } } this.ysCont[this.conf.touch ? "ontouchstart" : "onclick"] = function(w) { w = w || event; w.cancelBubble = true; var q = (w.target || w.srcElement); if (q._year != null) { l._hideSelector(); l._drawMonth(new Date(q._year, l._activeMonth.getMonth(), 1, 0, 0, 0, 0)); l._doOnSelectorChange() } } } if (E == "hours") { this._hsCells = {}; this.hsCont = document.createElement("DIV"); this.hsCont.className = "dhtmlxcalendar_area_" + y; this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.hsCont); var v = 0; for (var a = 0; a < 4; a++) { var D = document.createElement("UL"); D.className = "dhtmlxcalendar_selector_line"; this.hsCont.appendChild(D); for (var F = 0; F < 6; F++) { var H = document.createElement("LI"); H.innerHTML = this._fixLength(v, 2); H.className = "dhtmlxcalendar_selector_cell"; D.appendChild(H); H._hours = v; H._cell = true; this._hsCells[v++] = H } } this.hsCont[this.conf.touch ? "ontouchstart" : "onclick"] = function(w) { w = w || event; w.cancelBubble = true; var q = (w.target || w.srcElement); if (q._hours != null) { l._hideSelector(); l._activeDate.setHours(q._hours); l._updateActiveHours(); l._updateVisibleHours(); l._doOnSelectorChange() } } } if (E == "minutes") { var C = 4; var x = 3; var A = 2; if (this._minutesInterval == 1) { if (this._selectorMode == 1) { C = 2; x = 3; A = 1 } else { C = 2; x = 5; A = 1; y += "5" } } if (this._minutesInterval == 10) { C = 2 } if (this._minutesInterval == 15) { C = 1; x = 4; y += "4" } this._rsCells = {}; this.rsCont = document.createElement("DIV"); this.rsCont.className = "dhtmlxcalendar_area_" + y; this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.rsCont); var v = 0; for (var a = 0; a < C; a++) { var D = document.createElement("UL"); D.className = "dhtmlxcalendar_selector_line"; this.rsCont.appendChild(D); for (var F = 0; F < x; F++) { var H = document.createElement("LI"); H.innerHTML = (A > 1 ? this._fixLength(v, A) : v); H.className = "dhtmlxcalendar_selector_cell"; D.appendChild(H); H._minutes = v; H._cell = true; this._rsCells[v] = H; v += this._minutesInterval } } this.rsCont[this.conf.touch ? "ontouchstart" : "onclick"] = function(I) { I = I || event; I.cancelBubble = true; var w = (I.target || I.srcElement); if (w._minutes != null) { if (l._minutesInterval == 1) { var q = l.getFormatedDate("%i"); if (l._selectorMode == 1) { q = w._minutes.toString() + q.charAt(1) } else { q = q.charAt(0) + w._minutes.toString() } l._activeDate.setMinutes(Number(q)); l._hideSelector(); if (l._selectorMode == 1) { l._updateVisibleMinutes(true); l._selectorMode = 2; l._showSelector("minutes", l._sel._x, l._sel._y, "selector_minutes", true); l._updateActiveMinutes(); return } else { l._selectorMode = 1 } } else { l._hideSelector(); l._activeDate.setMinutes(w._minutes); l._updateActiveMinutes() } l._updateVisibleMinutes(); l._doOnSelectorChange() } } } this._sel._ta[E] = true }; this._showSelector = function(A, q, C, w, a) { if (a === true && this._sel != null && this._isSelectorVisible() && A == this._sel._t) { this._hideSelector(); return } if (this.conf.skin == "dhx_terrace") { q += 12 } if (!this._sel || !this._sel._ta[A]) { this._initSelector(A, w) } if (A != this._sel._t && this._sel._t == "minutes" && this._minutesInterval == 1) { this.contTime.firstChild.firstChild.childNodes[3].innerHTML = this.getFormatedDate("%i") } this._sel._x = q; this._sel._y = C; 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 = A; this._sel.className = "dhtmlxcalendar_selector_obj dhtmlxcalendar_" + w; this._sel.childNodes[0].firstChild.firstChild.childNodes[0].style.display = this._sel.childNodes[0].firstChild.firstChild.childNodes[2].style.display = (A == "year" ? "" : "none"); var v = Math.max(0, q - Math.round(this._sel.offsetWidth / 2)); if (v + this._sel.offsetWidth > this._sel.parentNode.offsetWidth) { v = this._sel.parentNode.offsetWidth - this._sel.offsetWidth } this._sel.style.left = v + "px"; if (A == "hours" || A == "minutes") { this._sel.style.top = C - this._sel.offsetHeight + "px" } else { this._sel.style.top = C + "px" } this._sel.childNodes[1].style.width = this._sel.childNodes[0].offsetWidth + "px"; this._sel.style.visibility = "visible"; this._doOnSelectorShow(A) }; 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(v) { if (!this._sel) { return } if (!this._sel._ta[v]) { return } if (v == "month") { this.msCont.onclick = this.msCont.ontouchstart = null; this._msActive = null; for (var q in this._msCells) { this._msCells[q]._cell = null; this._msCells[q]._month = null; this._msCells[q].parentNode.removeChild(this._msCells[q]); this._msCells[q] = 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 (v == "year") { this.ysCont.onclick = this.ysCont.ontouchstart = null; for (var q in this._ysCells) { this._ysCells[q]._cell = null; this._ysCells[q]._year = null; this._ysCells[q].parentNode.removeChild(this._ysCells[q]); this._ysCells[q] = 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 (v == "hours") { this.hsCont.onclick = this.hsCont.ontouchstart = null; this._hsActive = null; for (var q in this._hsCells) { this._hsCells[q]._cell = null; this._hsCells[q]._hours = null; this._hsCells[q].parentNode.removeChild(this._hsCells[q]); this._hsCells[q] = 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 (v == "minutes") { this.rsCont.onclick = this.rsCont.ontouchstart = null; this._rsActive = null; for (var q in this._rsCells) { this._rsCells[q]._cell = null; this._rsCells[q]._minutes = null; this._rsCells[q].parentNode.removeChild(this._rsCells[q]); this._rsCells[q] = 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[v] = 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(C) { for (var x in this._ysCells) { this._ysCells[x] = null; delete this._ysCells[x] } var y = 12 * Math.floor(C.getFullYear() / 12); for (var A = 0; A < 4; A++) { for (var v = 0; v < 3; v++) { this.ysCont.childNodes[A].childNodes[v].innerHTML = y; this.ysCont.childNodes[A].childNodes[v]._year = y; this.ysCont.childNodes[A].childNodes[v].className = "dhtmlxcalendar_selector_cell"; this._ysCells[y++] = this.ysCont.childNodes[A].childNodes[v] } } this._updateActiveYear() }; this._scrollYears = function(a) { var v = (a < 0 ? this.ysCont.firstChild.firstChild._year : this.ysCont.lastChild.lastChild._year) + a; var q = new Date(v, this._activeMonth.getMonth(), 1, 0, 0, 0, 0); this._updateYearsList(q) }; 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(q) { var a = this._fixLength(this._activeDate.getMinutes(), 2).toString(); if (q == true) { a = a.charAt(0) + "" + a.charAt(1) + "" } this.contTime.firstChild.firstChild.childNodes[3].innerHTML = a; if (q == true) { this.contTime.firstChild.firstChild.childNodes[3].lastChild._par = true } }; this._fixLength = function(a, q) { while (String(a).length < q) { a = "0" + String(a) } return a }; this._dateFormat = ""; this._dateFormatRE = null; this.setDateFormat = function(x) { var w = {}; if (this._strToDate != null) { for (var q in this.i) { if (this.i[q].input != null && this.i[q].input.value.length > 0) { var y = this._strToDate(this.i[q].input.value, this._dateFormat || this.langData[this.lang].dateformat || "%Y-%m-%d"); if (y instanceof Date) { w[q] = y } } } } this._dateFormat = x; var v = String(this._dateFormat).replace(/%[a-zA-Z]+/g, function(a) { var A = a.replace(/%/, ""); switch (A) { 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 "(" + l.langData[l.lang].monthesSNames.join("|").toLowerCase() + "){1,}"; case "F": return "(" + l.langData[l.lang].monthesFNames.join("|").toLowerCase() + "){1,}"; case "D": return "[a-z]{2}"; case "a": case "A": return "AM|PM" } return a }); this._dateFormatRE = new RegExp(v, "i"); for (var q in w) { this.i[q].input.value = this._dateToStr(w[q]) } w = null }; this.setDateFormat(this.langData[this.lang].dateformat || "%Y-%m-%d"); this._getInd = function(w, a) { for (var v = 0; v < a.length; v++) { if (a[v].toLowerCase() == w) { return v } } return -1 }; this._updateDateStr = function(q) { if (!this._dateFormatRE || !q.match(this._dateFormatRE)) { return } if (q == this.getFormatedDate()) { return } var a = this._strToDate(q); 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(x, y, q, w) { var v = this._strToDate(y, x); if (w) { return v } this.setDate(v) }; this.getFormatedDate = function(q, a) { if (!(a && a instanceof Date)) { if (this._nullDate) { return "" } a = new Date(this._activeDate) } return this._dateToStr(a, q) }; 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 E = this._wStart; var w = E + 7; var D = 4; var q = new Date(x.getFullYear(), 0, 1, 0, 0, 0, 0); var v = q.getDay(); if (v == 0) { v = 7 } if (D < E) { D += 7; v += 7 } var A = 0; if (v >= E && v <= D) {} else { A = 1 } var y = v - E; var C = new Date(x.getFullYear(), 0, 1 - y + A * 7, 0, 0, 0, 0); var H = 604800000; var a = new Date(x.getFullYear(), x.getMonth(), x.getDate() + 1, 0, 0, 0, 0); var F = Math.ceil((a.getTime() - C.getTime()) / H); return F }; this.showWeekNumbers = function() { this.base.firstChild.className = "dhtmlxcalendar_wn" }; this.hideWeekNumbers = function() { this.base.firstChild.className = "" }; this.show = function(v) { if (!v && this._hasParent) { this._show(); return } if (typeof(v) == "object" && typeof(v._dhtmlxcalendar_uid) != "undefined" && this.i[v._dhtmlxcalendar_uid] == v) { this._show(v._dhtmlxcalendar_uid); return } if (typeof(v) == "undefined") { for (var q in this.i) { if (!v) { v = q } } } if (!v) { return } this._show(v) }; this.hide = function() { if (this._isVisible()) { this._hide() } }; this.isVisible = function() { return this._isVisible() }; this._activeInp = null; this.pos = "bottom"; this.setPosition = function(a, q) { 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(q) != "undefined" && !isNaN(q)) { this.base.style.top = q + "px"; this._py = q } this._ifrSize() } }; this._show = function(A, a) { if (a === 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 w = (this.i[A].input || this.i[A].button); var q = (navigator.appVersion.indexOf("MSIE") != -1); var x = Math.max((q ? document.documentElement : document.getElementsByTagName("html")[0]).scrollTop, document.body.scrollTop); var v = x + (q ? Math.max(document.documentElement.clientHeight || 0, document.documentElement.offsetHeight || 0, document.body.clientHeight || 0) : window.innerHeight); if (this.pos == "right") { this.base.style.left = this._getLeft(w) + w.offsetWidth + "px"; this.base.style.top = Math.min(this._getTop(w), v - this.base.offsetHeight) + "px" } else { if (this.pos == "bottom") { var y = this._getTop(w) + w.offsetHeight + 1; if (y + this.base.offsetHeight > v) { y = this._getTop(w) - this.base.offsetHeight } this.base.style.left = this._getLeft(w) + "px"; this.base.style.top = y + "px" } else { this.base.style.left = (this._px || 0) + "px"; this.base.style.top = (this._py || 0) + "px" } } this._activeInp = A; w = 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() { 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._getLeft = function(a) { return this._posGetOffset(a).left }; this._getTop = function(a) { return this._posGetOffset(a).top }; this._posGetOffsetSum = function(a) { var v = 0, q = 0; while (a) { v = v + parseInt(a.offsetTop); q = q + parseInt(a.offsetLeft); a = a.offsetParent } return { top: v, left: q } }; this._posGetOffsetRect = function(w) { var A = w.getBoundingClientRect(); var C = document.body; var q = document.documentElement; var a = window.pageYOffset || q.scrollTop || C.scrollTop; var x = window.pageXOffset || q.scrollLeft || C.scrollLeft; var y = q.clientTop || C.clientTop || 0; var D = q.clientLeft || C.clientLeft || 0; var E = A.top + a - y; var v = A.left + x - D; return { top: Math.round(E), left: Math.round(v) } }; this._posGetOffset = function(a) { return this[a.getBoundingClientRect ? "_posGetOffsetRect" : "_posGetOffsetSum"](a) }; this._rangeActive = false; this._rangeFrom = null; this._rangeTo = null; this._rangeSet = {}; this.setInsensitiveDays = function(w) { var a = this._extractDates(w); for (var v = 0; v < a.length; v++) { this._rangeSet[new Date(a[v].getFullYear(), a[v].getMonth(), a[v].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(v) { if (v == null) { this._clearHolidays() } else { if (v != null) { var a = this._extractDates(v); for (var w = 0; w < a.length; w++) { this._holidays[new Date(a[w].getFullYear(), a[w].getMonth(), a[w].getDate(), 0, 0, 0, 0).getTime()] = true } } } this._drawMonth(this._activeMonth) }; this._extractDates = function(x) { if (typeof(x) == "string" || x instanceof Date) { x = [x] } var v = []; for (var y = 0; y < x.length; y++) { if (typeof(x[y]) == "string") { var A = x[y].split(","); for (var a = 0; a < A.length; a++) { v.push(this._strToDate(A[a])) } } else { if (x[y] instanceof Date) { v.push(x[y]) } } } return v }; this._clearRange = function() { this._rangeActive = false; this._rangeType = null; this._rangeFrom = null; this._rangeTo = null }; this._clearRangeSet = function() { for (var q in this._rangeSet) { this._rangeSet[q] = null; delete this._rangeSet[q] } }; this._clearHolidays = function() { for (var q in this._holidays) { this._holidays[q] = null; delete this._holidays[q] } }; this._isOutOfRange = function(q) { if (this._rangeSet[q] == true) { return true } if (this._rangeActive) { if (this._rangeType == "in" && (q < this._rangeFrom || q > this._rangeTo)) { return true } if (this._rangeType == "out" && (q >= this._rangeFrom && q <= this._rangeTo)) { return true } if (this._rangeType == "from" && q < this._rangeFrom) { return true } if (this._rangeType == "to" && q > this._rangeTo) { return true } } var a = new Date(q); 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(w, v, a) { var q = false; if (w != null && v != null) { if (!(w instanceof Date)) { w = this._strToDate(w) } if (!(v instanceof Date)) { v = this._strToDate(v) } if (w.getTime() > v.getTime()) { return } this._rangeFrom = new Date(w.getFullYear(), w.getMonth(), w.getDate(), 0, 0, 0, 0).getTime(); this._rangeTo = new Date(v.getFullYear(), v.getMonth(), v.getDate(), 0, 0, 0, 0).getTime(); this._rangeActive = true; this._rangeType = "in"; q = true } if (!q && w != null && v == null) { if (!(w instanceof Date)) { w = this._strToDate(w) } this._rangeFrom = new Date(w.getFullYear(), w.getMonth(), w.getDate(), 0, 0, 0, 0).getTime(); this._rangeTo = null; if (a === true) { this._rangeFrom++ } this._rangeActive = true; this._rangeType = "from"; q = true } if (!q && w == null && v != null) { if (!(v instanceof Date)) { v = this._strToDate(v) } this._rangeFrom = null; this._rangeTo = new Date(v.getFullYear(), v.getMonth(), v.getDate(), 0, 0, 0, 0).getTime(); if (a === true) { this._rangeTo-- } this._rangeActive = true; this._rangeType = "to"; q = true } if (q) { this._drawMonth(this._activeMonth) } }; this.setInsensitiveRange = function(q, a) { if (q != null && a != null) { if (!(q instanceof Date)) { q = this._strToDate(q) } if (!(a instanceof Date)) { a = this._strToDate(a) } if (q.getTime() > a.getTime()) { return } this._rangeFrom = new Date(q.getFullYear(), q.getMonth(), q.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 (q != null && a == null) { this.setSensitiveRange(null, q, true); return } if (q == null && a != null) { this.setSensitiveRange(a, null, true); return } }; this.disableDays = function(A, y) { if (A == "week") { if (typeof(y) != "object" && typeof(y.length) == "undefined") { y = [y] } if (!this._rangeWeekData) { this._rangeWeekData = {} } for (var v in this._rangeWeekData) { this._rangeWeekData[v] = false; delete this._rangeWeekData[v] } for (var x = 0; x < y.length; x++) { this._rangeWeekData[y[x]] = true; if (y[x] == 7) { this._rangeWeekData[0] = true } } this._rangeWeek = true } if (A == "month") { if (typeof(y) != "object" && typeof(y.length) == "undefined") { y = [y] } if (!this._rangeMonthData) { this._rangeMonthData = {} } for (var v in this._rangeMonthData) { this._rangeMonthData[v] = false; delete this._rangeMonthData[v] } for (var x = 0; x < y.length; x++) { this._rangeMonthData[y[x]] = true } this._rangeMonth = true } if (A == "year") { var w = this._extractDates(y); if (!this._rangeYearData) { this._rangeYearData = {} } for (var v in this._rangeYearData) { this._rangeYearData[v] = false; delete this._rangeYearData[v] } for (var x = 0; x < w.length; x++) { this._rangeYearData[w[x].getMonth() + "_" + w[x].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(w, A, C, a) { var x = this._extractDates(w); for (var y = 0; y < x.length; y++) { var v = new Date(x[y].getFullYear(), x[y].getMonth(), x[y].getDate(), 0, 0, 0, 0).getTime(); this._tipData[v] = { text: A, showIcon: C, usePopup: a } } this._drawMonth(this._activeMonth) }; this.clearTooltip = function(v) { var w = this._extractDates(v); for (var x = 0; x < w.length; x++) { var a = new Date(w[x].getFullYear(), w[x].getMonth(), w[x].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(q) { var a = new Date(q.getFullYear(), q.getMonth(), q.getDate(), 0, 0, 0, 0).getTime(); if (this._tipData[a] != null) { if (this._tipTM) { window.clearTimeout(this._tipTM) } this._tipCellDate = q; this._tipCellDim = this.getCellDimension(q); 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(A, a, C, q, v) { if (!l._tipPopup) { l._tipPopup = new dhtmlXPopup({ mode: "top" }) } l._tipPopup.attachHTML(l._tipText); l._tipPopup.show(l._tipCellDim.x, l._tipCellDim.y, l._tipCellDim.w, l._tipCellDim.h); l.callEvent("onPopupShow", [l._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(x) { if (typeof(x) == "string") { x = this._strToDate(x) } if (!(x instanceof Date)) { return null } var y = new Date(x.getFullYear(), x.getMonth(), x.getDate(), 0, 0, 0, 0).getTime(); var v = null; for (var A = 0; A < this.contDates.childNodes.length; A++) { for (var a = 0; a < this.contDates.childNodes[A].childNodes.length; a++) { var C = this.contDates.childNodes[A].childNodes[a]; if (C._date != null && C._date.getTime() == y) { v = { x: this._getLeft(C), y: this._getTop(C), w: C.offsetWidth, h: C.offsetHeight } } C = null } } return v }; 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(q) { q = q || event; var a = (q.target || q.srcElement); if (a._dhtmlxcalendar_uid && a._dhtmlxcalendar_uid != l._activeInp && l._isVisible() && l._activeInp) { l._hide(); return } if (!a._dhtmlxcalendar_uid || !l.i[a._dhtmlxcalendar_uid]) { if (l._isSelectorVisible()) { l._hideSelector() } else { if (!l._hasParent && l._isVisible()) { l._hide() } } } }; this._doOnKeyDown = function(a) { a = a || event; if (a.keyCode == 27 || a.keyCode == 13) { if (l._isSelectorVisible()) { l._hideSelector() } else { if (l._isVisible() && !l._hasParent) { l._hide() } } } }; this._doOnInpClick = function(q) { q = q || event; var a = (q.target || q.srcElement); if (!a._dhtmlxcalendar_uid) { return } if (!l._listenerEnabled) { l._updateFromInput(a) } l._show(a._dhtmlxcalendar_uid, true) }; this._doOnInpKeyUp = function(q) { q = q || event; var a = (q.target || q.srcElement); if (q.keyCode == 13 || !a._dhtmlxcalendar_uid) { return } if (!l._listenerEnabled) { l._updateFromInput(a) } }; this._doOnBtnClick = function(q) { q = q || event; var a = (q.target || q.srcElement); if (!a._dhtmlxcalendar_uid) { return } if (l.i[a._dhtmlxcalendar_uid].input != null) { l._updateFromInput(l.i[a._dhtmlxcalendar_uid].input) } l._show(a._dhtmlxcalendar_uid, true) }; this._doOnUnload = function() { if (l && l.unload) { l.unload() } }; if (typeof(window.addEventListener) == "function") { document.body.addEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnClick, false); window.addEventListener("keydown", l._doOnKeyDown, false); window.addEventListener("unload", l._doOnUnload, false) } else { document.body.attachEvent("onclick", l._doOnClick); document.body.attachEvent("onkeydown", l._doOnKeyDown); window.attachEvent("onunload", l._doOnUnload) } this.attachObj = function(v) { var q = window.dhx4.newId(); if (typeof(v) == "string") { this.i[q] = { input: document.getElementById(v) } } else { if (typeof(v.tagName) != "undefined") { this.i[q] = { input: v } } else { if (typeof(v) == "object" && (v.input != null || v.button != null)) { this.i[q] = {}; if (v.input != null) { this.i[q].input = (typeof(v.input) == "string" ? document.getElementById(v.input) : v.input) } if (v.button != null) { this.i[q].button = (typeof(v.button) == "string" ? document.getElementById(v.button) : v.button) } } } } this._attachEventsToObject(q); return q }; this.detachObj = function(w) { var v = null; if (this.i[w] != null) { v = w } else { if (typeof(w) == "string") { w = document.getElementById(w); v = w._dhtmlxcalendar_uid } else { if (typeof(w.tagName) != "undefined") { v = w._dhtmlxcalendar_uid } else { if (typeof(w) == "object" && (w.input != null || w.button != null)) { if (v == null && w.input != null) { v = (typeof(w.input) == "string" ? document.getElementById(w.input) : w.input)._dhtmlxcalendar_uid } if (v == null && w.button != null) { v = (typeof(w.button) == "string" ? document.getElementById(w.button) : w.button)._dhtmlxcalendar_uid } } } } } if (v != null && this.i[v] != null) { this._detachEventsFromObject(v); for (var q in this.i[q]) { this.i[v][q]._dhtmlxcalendar_uid = null; this.i[v][q] = null; delete this.i[v][q] } this.i[v] = null; delete this.i[v]; return true } return false }; this._attachEventsToObject = function(q) { if (this.i[q].button != null) { this.i[q].button._dhtmlxcalendar_uid = q; if (typeof(window.addEventListener) == "function") { this.i[q].button.addEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnBtnClick, false) } else { this.i[q].button.attachEvent("onclick", l._doOnBtnClick) } } else { if (this.i[q].input != null) { this.i[q].input._dhtmlxcalendar_uid = q; if (typeof(window.addEventListener) == "function") { this.i[q].input.addEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnInpClick, false); this.i[q].input.addEventListener("keyup", l._doOnInpKeyUp, false) } else { this.i[q].input.attachEvent("onclick", l._doOnInpClick); this.i[q].input.attachEvent("onkeyup", l._doOnInpKeyUp) } } } }; this._detachEventsFromObject = function(q) { if (this.i[q].button != null) { if (typeof(window.addEventListener) == "function") { this.i[q].button.removeEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnBtnClick, false) } else { this.i[q].button.detachEvent("onclick", l._doOnBtnClick) } } else { if (this.i[q].input != null) { if (typeof(window.addEventListener) == "function") { this.i[q].input.removeEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnInpClick, false); this.i[q].input.removeEventListener("keyup", l._doOnInpKeyUp, false) } else { this.i[q].input.detachEvent("onclick", l._doOnInpClick); this.i[q].input.detachEvent("onkeyup", l._doOnInpKeyUp) } } } }; this.enableListener = function(a) { if (!a) { return } if (typeof(window.addEventListener) == "function") { a.addEventListener("focus", l._listenerEvFocus, false); a.addEventListener("blur", l._listenerEvBlur, false) } else { a.attachEvent("onfocus", l._listenerEvFocus); a.attachEvent("onblur", l._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", l._listenerEvFocus, false); a.removeEventListener("blur", l._listenerEvBlur, false) } else { a.detachEvent("onfocus", l._listenerEvFocus); a.detachEvent("onblur", l._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() { l._startListener(a) }, 100) } }; this._listenerEvFocus = function(q) { q = q || event; var a = q.target || q.srcElement; a._f0 = true; l._startListener(a); a = null }; this._listenerEvBlur = function(q) { q = q || event; var a = q.target || q.srcElement; a._f0 = false; a = null }; for (var o in this.i) { this._attachEventsToObject(o) } 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((this.conf.touch ? "touchstart" : "click"), l._doOnClick, false); window.removeEventListener("keydown", l._doOnKeyDown, false); window.removeEventListener("unload", l._doOnUnload, false) } else { document.body.detachEvent("onclick", l._doOnClick); document.body.detachEvent("onkeydown", l._doOnKeyDown); window.detachEvent("onunload", l._doOnKeyDown) } this._doOnClick = null; this._doOnKeyDown = null; this._doOnUnload = null; for (var q in this.i) { this.i[q]._dhtmlxcalendar_uid = null; this._detachEventsFromObject(q); this.disableListener(this.i[q].input); this.i[q] = null; delete this.i[q] } 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 q in this._sel._ta) { this._sel._ta[q] = 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._getLeft = null; this._getTop = null; this._ifrSize = null; this._hide = null; this._hideSelector = null; this._initSelector = null; this._isSelectorVisible = null; this._isVisible = null; this._posGetOffset = null; this._posGetOffsetRect = null; this._posGetOffsetSum = 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 q in this) { delete this[q] } q = l = 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(l) { var c = this; var h = function(m) { return (String(m).length == 1 ? "0" + String(m) : m) }; var a = function(m, n) { return "" + n + "" }; var g = String(this.langData[this.lang].hdrformat || ("%F %Y")).replace(/%[a-z]/gi, function(m) { switch (m) { case "%m": return a("month", h(l.getMonth() + 1)); case "%n": return a("month", l.getMonth() + 1); case "%M": return a("month", c.langData[c.lang].monthesSNames[l.getMonth()]); case "%F": return a("month", c.langData[c.lang].monthesFNames[l.getMonth()]); case "%y": return a("year", h(l.getYear() % 100)); case "%Y": return a("year", l.getFullYear()); case "%%": return "%"; default: return m } }); c = h = a = null; return g }; 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._strToDate = function(l, A) { A = (A || this._dateFormat); A = A.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\\:|]/g, "\\$&"); var D = []; var s = []; A = A.replace(/%[a-z]/gi, function(q) { switch (q) { case "%d": case "%m": case "%y": case "%h": case "%H": case "%i": case "%s": s.push(q); return "(\\d{2})"; case "%D": case "%l": case "%M": case "%F": s.push(q); return "([a-zéûä\u0430-\u044F\u0451]{1,})"; case "%j": case "%n": case "%g": case "%G": s.push(q); return "(\\d{1,2})"; case "%Y": s.push(q); return "(\\d{4})"; case "%a": s.push(q); return "(\\[am|pm])"; case "%A": s.push(q); return "(\\[AM|PM])" } return q }); var E = new RegExp(A); var u = l.match(E); if (u == null || u.length - 1 != s.length) { return "Invalid Date" } for (var c = 1; c < u.length; c++) { D.push(u[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 }; var x = {}; var n = {}; for (var c = 0; c < s.length; c++) { if (typeof(g[s[c]]) != "undefined") { var h = g[s[c]]; if (!x[h]) { x[h] = []; n[h] = [] } x[h].push(D[c]); n[h].push(s[c]) } } D = []; s = []; for (var c = 1; c <= 7; c++) { if (x[c] != null) { for (var y = 0; y < x[c].length; y++) { D.push(x[c][y]); s.push(n[c][y]) } } } var o = this; var a = new Date(); a.setDate(1); a.setMinutes(0); a.setSeconds(0); for (var c = 0; c < D.length; c++) { switch (s[c]) { case "%d": case "%j": case "%n": case "%m": case "%Y": case "%H": case "%G": case "%i": case "%s": if (!isNaN(D[c])) { a[{ "%d": "setDate", "%j": "setDate", "%n": "setMonth", "%m": "setMonth", "%Y": "setFullYear", "%H": "setHours", "%G": "setHours", "%i": "setMinutes", "%s": "setSeconds" }[s[c]]](Number(D[c]) + (s[c] == "%m" || s[c] == "%n" ? -1 : 0)) } break; case "%M": case "%F": var m = this._getInd(D[c].toLowerCase(), o.langData[o.lang][{ "%M": "monthesSNames", "%F": "monthesFNames" }[s[c]]]); if (m >= 0) { a.setMonth(m) } break; case "%y": if (!isNaN(D[c])) { var C = Number(D[c]); a.setFullYear(C + (C > 50 ? 1900 : 2000)) } break; case "%g": case "%h": if (!isNaN(D[c])) { var C = Number(D[c]); if (C <= 12 && C >= 0) { a.setHours(C + (this._getInd("pm", D) >= 0 ? (C == 12 ? 0 : 12) : (C == 12 ? -12 : 0))) } } break } } o = null; return a }; dhtmlXCalendarObject.prototype._dateToStr = function(m, h) { var g = this; if (m instanceof Date) { var l = function(n) { return (String(n).length == 1 ? "0" + String(n) : n) }; var a = function(n) { switch (n) { case "%d": return l(m.getDate()); case "%j": return m.getDate(); case "%D": return g.langData[g.lang].daysSNames[m.getDay()]; case "%l": return g.langData[g.lang].daysFNames[m.getDay()]; case "%m": return l(m.getMonth() + 1); case "%n": return m.getMonth() + 1; case "%M": return g.langData[g.lang].monthesSNames[m.getMonth()]; case "%F": return g.langData[g.lang].monthesFNames[m.getMonth()]; case "%y": return l(m.getYear() % 100); case "%Y": return m.getFullYear(); case "%g": return (m.getHours() + 11) % 12 + 1; case "%h": return l((m.getHours() + 11) % 12 + 1); case "%G": return m.getHours(); case "%H": return l(m.getHours()); case "%i": return l(m.getMinutes()); case "%s": return l(m.getSeconds()); case "%a": return (m.getHours() > 11 ? "pm" : "am"); case "%A": return (m.getHours() > 11 ? "PM" : "AM"); case "%%": "%"; default: return n } }; var c = String(h || this._dateFormat).replace(/%[a-zA-Z]/g, a) } g = null; return (c || String(m)) }; 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(g) { a._updateRange("rightCalendar", g, null); a._evOnClick(["left", g]) }); this.rightCalendar.attachEvent("onClick", function(g) { a._updateRange("leftCalendar", null, g); a._evOnClick(["right", g]) }); this.leftCalendar.attachEvent("onBeforeChange", function(g) { return a._evOnBeforeChange(["left", g]) }); this.rightCalendar.attachEvent("onBeforeChange", function(g) { return a._evOnBeforeChange(["right", g]) }); 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(g) { this.leftCalendar.setDateFormat(g); this.rightCalendar.setDateFormat(g) }; this.setDates = function(h, g) { if (h != null) { this.leftCalendar.setDate(h) } if (g != null) { this.rightCalendar.setDate(g) } this._updateRange() }; this._updateRange = function(g, l, h) { if (arguments.length == 3) { (g == "leftCalendar" ? this.leftCalendar : this.rightCalendar).setSensitiveRange(l, h) } 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(g) { return this.callEvent("onClick", g) }; this._evOnBeforeChange = function(g) { return this.callEvent("onBeforeChange", g) }; window.dhx4._eventable(this); return this }; function dhtmlXCombo(m, s, g, o, l) { var n = this; var h = null; var u = null; if (typeof(m) == "object" && !m.tagName) { h = m; m = h.parent; g = h.width; s = h.name; o = h.mode; u = h.skin } this.cont = (typeof(m) == "string" ? document.getElementById(m) : m); this.conf = { skin: null, form_name: s || "dhxcombo", combo_width: (parseInt(g) || this.cont.offsetWidth || 120) - (dhx4.isFF || dhx4.isIE ? 2 : 0), combo_image: false, combo_focus: false, opts_type: (typeof(o) == "string" && typeof(this.modes[o]) != "undefined" ? o : "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, img_path: "", img_def: "", img_def_dis: true, template: { input: "#text#", option: "#text#" }, 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: "", 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 }, dhx_web: { list_ofs: 0 }, dhx_terrace: { list_ofs: 1 } } }; 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.style.display = "none"; document.body.insertBefore(this.list, document.body.firstChild); this.setSkin(u || 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(D) { if (this.conf.f_server_tm) { window.clearTimeout(this.conf.f_server_tm) } var w = String(this.base.firstChild.value).replace(new RegExp(this.conf.f_ac_text + "$", "i"), ""); if (this.conf.f_server_last == w.toLowerCase()) { this._checkForMatch(); return } if (this.conf.f_url != null && this.checkEvent("onDynXLS")) { this.conf.f_server_last = w.toLowerCase(); this.callEvent("onDynXLS", [w]); return } if (this.conf.f_url != null) { if (w.length == 0) { this.conf.f_server_last = w.toLowerCase(); this.clearAll(); return } if (this.conf.f_cache == true && this.conf.f_cache_data[w] != null) { this.clearAll(); this.conf.f_server_last = w.toLowerCase(); for (var y = 0; y < this.conf.f_cache_data[w].data.length; y++) { this.load(this.conf.f_cache_data[w].data[y]) } if (this.conf.f_dyn) { this.conf.f_dyn_end = this.conf.f_cache_data[w].dyn_end; this.conf.f_mask = this.conf.f_cache_data[w].mask } if (D !== true) { this._showList(true); this._checkForMatch() } } else { this.conf.f_server_tm = window.setTimeout(function() { n.conf.f_server_last = w.toLowerCase(); n.conf.f_mask = w; var q = "mask=" + encodeURIComponent(w); if (n.conf.f_dyn) { q += "&pos=0"; n.conf.f_dyn_end = false } var a = function(F) { if (n.conf.f_cache) { if (!n.conf.f_cache_data[w]) { n.conf.f_cache_data[w] = { data: [], dyn_end: false, mask: w } } n.conf.f_cache_data[w].data.push(F.xmlDoc.responseXML) } n.clearAll(); n.load(F.xmlDoc.responseXML); if (n.conf.f_ac && n.conf.f_mode == "start" && n.conf.clear_bsp == false && n.list.firstChild != null) { var E = n.list.firstChild._optId; var H = String(n.t[E].obj.getText(n.list.firstChild, true)); if (String(H).toLowerCase().indexOf(String(w).toLowerCase()) === 0) { n.base.firstChild.value = H; n._selectRange(w.length, H.length) } } if (D !== true) { n._showList(true); n._checkForMatch() } a = null }; if (window.dhx4.ajax.method == "post") { window.dhx4.ajax.post(n.conf.f_url, q, a) } else { if (window.dhx4.ajax.method == "get") { window.dhx4.ajax.get(n.conf.f_url + (String(n.conf.f_url).indexOf("?") >= 0 ? "&" : "?") + q, a) } } }, 200) } } else { this.conf.f_server_last = w.toLowerCase(); var x = (w.length == 0 ? true : new RegExp((this.conf.f_mode == "start" ? "^" : "") + w, "i")); var C = null; for (var v in this.t) { var A = this.t[v].obj.getText(this.t[v].item, true); if (x === true || x.test(A) == true) { this.t[v].item.style.display = ""; if (C == null && w.length > 0) { C = String(this.t[v].obj.getText(this.t[v].item, true)) } } else { this.t[v].item.style.display = "none" } } if (this.conf.f_ac && this.conf.f_mode == "start" && this.conf.clear_bsp == false && C != null) { this.conf.f_ac_text = C.replace(new RegExp("^" + w, "i"), ""); this.base.firstChild.value = C; 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 (D !== true) { this._showList(true); this._checkForMatch() } } }; this._initObj = function(a) { if (typeof(a.template) != "undefined") { this.setTemplate(a.template) } this.addOption(a.options) }; this._xmlToObj = function(E, H) { var L = { options: [] }; var I = (H == true ? E : E.getElementsByTagName("complete")); if (I.length > 0) { var x = I[0].childNodes; for (var v = 0; v < x.length; v++) { if (typeof(x[v].tagName) != "undefined") { if (String(x[v].tagName).toLowerCase() == "template") { for (var K = 0; K < x[v].childNodes.length; K++) { if (x[v].childNodes[K].tagName != null) { var D = x[v].childNodes[K].tagName; if (typeof(this.conf.template[D]) != "undefined") { this.conf.template[D] = (x[v].childNodes[K].firstChild != null ? x[v].childNodes[K].firstChild.nodeValue : "") } } } } if (String(x[v].tagName).toLowerCase() == "option") { var C = false; if (H == true) { C = (window.dhx4.s2b(x[v].selected) || x[v].getAttribute("selected") != null) } else { C = window.dhx4.s2b(x[v].getAttribute("selected")) } var y = { value: x[v].getAttribute("value"), text: (x[v].firstChild != null ? x[v].firstChild.nodeValue : ""), selected: C, checked: window.dhx4.s2b(x[v].getAttribute("checked")) }; for (var J in { img: 1, img_dis: 1, img_src: 1, img_src_dis: 1 }) { if (x[v].getAttribute(J) != null) { y[J] = x[v].getAttribute(J) } } for (var K = 0; K < x[v].childNodes.length; K++) { if (x[v].childNodes[K].tagName != null && String(x[v].childNodes[K].tagName).toLowerCase() == "text") { y.text = {}; var A = x[v].childNodes[K]; for (var F = 0; F < A.childNodes.length; F++) { if (A.childNodes[F].tagName != null) { y.text[A.childNodes[F].tagName] = (A.childNodes[F].firstChild != null ? A.childNodes[F].firstChild.nodeValue : "") } } } } L.options.push(y) } } } I = x = null } return L }; window.dhx4._enableDataLoading(this, "_initObj", "_xmlToObj", "complete", { data: true }); window.dhx4._eventable(this); this._getNearItem = function(v, q) { var a = null; while (v != null) { v = v[q < 0 ? "previousSibling" : "nextSibling"]; if (a == null && v != null && v.style.display == "" && v._optId != null) { a = v; v = null } } return a }; this.setName(this.conf.form_name); this._doOnListMouseMove = function(q) { q = q || event; var a = q.target || q.srcElement; while (a != null && a != this) { if (typeof(a._optId) != "undefined") { if (n.conf.tm_hover) { window.clearTimeout(n.conf.tm_hover) } n._setSelected(a._optId) } a = a.parentNode } a = null }; this._doOnListMouseDown = function(a) { a = a || event; a.cancelBubble = true; n.conf.clear_click = true; window.setTimeout(function() { n.base.firstChild.focus() }, 1) }; this._doOnListMouseUp = function(v) { v = v || event; var a = v.target || v.srcElement; while (a != null && a != this) { if (typeof(a._optId) != "undefined") { var q = true; if (typeof(n.t[a._optId].obj.optionClick) == "function" && n.t[a._optId].obj.optionClick(a, v, n) !== true) { q = false } if (q) { n._setSelected(a._optId, null, true); n._confirmSelect("click") } } a = a.parentNode } a = null }; this._doOnListMouseOut = function(a) { if (n.conf.tm_hover) { window.clearTimeout(n.conf.tm_hover) } n.conf.tm_hover = window.setTimeout(function() { var q = n.conf.last_match || n.conf.last_selected; if (n.conf.last_match == null && n.t[q] != null) { if (n.base.firstChild.value != n.t[q].obj.getText(n.t[q].item, true)) { q = null } } n._setSelected(q, null, true) }, 1) }; this._doOnBaseMouseDown = function(x) { if (!n.conf.enabled) { return } n.conf.clear_click = true; x = x || event; var q = x.target || x.srcElement; if (q != this.firstChild) { window.setTimeout(function() { n.base.firstChild.focus() }, 1); var w = q; while (w != this && w != null) { if (w == this.lastChild) { if (typeof(n.modes[n.conf.opts_type].topImageClick) == "function") { var v = (n.conf.last_hover || n.conf.last_selected); var a = (v != null ? n.t[v].item : null); if (n.modes[n.conf.opts_type].topImageClick(a, n) !== true) { v = a = null; return } } w = null } else { w = w.parentNode } } } if (n._isListVisible()) { n._hideList() } else { if (q != this.firstChild) { n.conf.clear_blur = true } n._showList(); n._setSelected(n.conf.last_selected, true, true) } q = null }; this._doOnBodyMouseDown = function() { if (n.conf.clear_click) { n.conf.clear_click = false; return } n._confirmSelect("blur") }; this._doOnInputFocus = function() { n.conf.clear_blur = false; if (n.conf.tm_confirm_blur) { window.clearTimeout(n.conf.tm_confirm_blur) } if (n.conf.combo_focus == false) { n.conf.combo_focus = true; n.callEvent("onFocus", []) } }; this._doOnInputBlur = function() { if (n.conf.clear_blur == true) { n.conf.clear_blur = false; return } if (n.conf.tm_confirm_blur) { window.clearTimeout(n.conf.tm_confirm_blur) } n.conf.tm_confirm_blur = window.setTimeout(function() { if (n.conf.clear_click == false) { n._confirmSelect("blur"); n.conf.combo_focus = false; n.callEvent("onBlur", []) } }, 20) }; this._doOnInputKeyUp = function(a) { a = a || event; if (n.conf.f_mode != false) { n.conf.clear_bsp = (a.keyCode == 8 || a.keyCode == 46); n._filterOpts(); return } else { n._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; n._keyOnUpDown(a.keyCode == 38 ? -1 : 1) } if (a.keyCode == 113) { if (!n._isListVisible()) { n._showList(); if (n.base.firstChild.value == n.conf.last_text) { n._setSelected(n.conf.last_selected, true, true); n.base.firstChild.value = n.conf.last_text; n.conf.f_server_last = n.base.firstChild.value.toLowerCase() } else { n.conf.f_server_last = n.base.firstChild.value.toLowerCase(); if (n.conf.f_mode == false) { n._checkForMatch() } } } else {} } if (a.keyCode == 27) { if (a.preventDefault) { a.preventDefault() } else { a.returnValue = false } a.cancelBubble = true; n._cancelSelect() } if (a.keyCode == 13) { if (a.preventDefault) { a.preventDefault() } n._confirmSelect("kbd") } n.conf.clear_key = true; n.callEvent("onKeyPressed", [a.keyCode || a.charCode]) }; this._doOnInputKeyPress = function(a) { if (n.conf.clear_key) { n.conf.clear_key = false; return } a = a || event; n.callEvent("onKeyPressed", [a.keyCode || a.charCode]) }; this._keyOnUpDown = function(a) { var q = null; if (this.conf.last_hover) { q = this.t[this.conf.last_hover].item } else { if (this.conf.last_selected) { q = this.t[this.conf.last_selected].item } } if (!q && this._getListVisibleCount() == 0) { return } if (q != null && q.style.display != "") { q = null } this._showList(); if (q != null) { if (this.t[q._optId].obj.isSelected(q)) { q = this._getNearItem(q, a) } } else { q = this.list.firstChild; if (q.style.display != "") { q = this._getNearItem(q, 1) } } if (q == null) { return } this._setSelected(q._optId, true, true); if (this.conf.f_mode == false) { this.base.firstChild.value = this.t[q._optId].obj.getText(q, true) } else { var v = String(this.t[q._optId].obj.getText(q, true)); if (this.conf.f_mode == "start" && this.conf.f_ac == true) { if (v.toLowerCase().indexOf(this.conf.f_server_last) === 0) { this.conf.f_ac_text = v.substring(this.conf.f_server_last.length, v.length); this.base.firstChild.value = v; this._selectRange(this.conf.f_server_last.length, this.base.firstChild.value.length) } else { this.base.firstChild.value = v; this.conf.f_server_last = this.base.firstChild.value.toLowerCase(); this._selectRange(0, this.base.firstChild.value.length) } } else { this.base.firstChild.value = v; this.conf.f_server_last = this.base.firstChild.value.toLowerCase() } } q = 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 r in this.conf.evs_nodes[c].evs) { if (window.addEventListener) { this.conf.evs_nodes[c].node.addEventListener(r, this[this.conf.evs_nodes[c].evs[r]], false) } else { this.conf.evs_nodes[c].node.attachEvent("on" + r, this[this.conf.evs_nodes[c].evs[r]]) } } } this.unload = function() { this.clearAll(); this.t = null; for (var w = 0; w < this.conf.evs_nodes.length; w++) { for (var v in this.conf.evs_nodes[w].evs) { if (window.addEventListener) { this.conf.evs_nodes[w].node.removeEventListener(v, this[this.conf.evs_nodes[w].evs[v]], false) } else { this.conf.evs_nodes[w].node.detachEvent("on" + v, this[this.conf.evs_nodes[w].evs[v]]) } this.conf.evs_nodes[w].evs[v] = null; delete this.conf.evs_nodes[w].evs[v] } this.conf.evs_nodes[w].node = null; this.conf.evs_nodes[w].evs = null; delete this.conf.evs_nodes[w].node; delete this.conf.evs_nodes[w].evs; this.conf.evs_nodes[w] = null } window.dhx4._eventable(this, "clear"); window.dhx4._enableDataLoading(this, null, null, null, "clear"); this.DOMelem_input = this.DOMelem_button = this.DOMlist = null; for (var v in this.conf) { this.conf[v] = null; delete this.conf[v] } this.conf = null; this.base.parentNode.removeChild(this.base); this.list.parentNode.removeChild(this.list); this.base = this.list = this.cont = null; this.modes = null; for (var v in this) { if (typeof(this[v]) == "function") { this[v] = null } } n = 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 = m; m = null; if (h != null) { if (h.filter != null) { if (typeof(h.filter) == "string") { this.enableFilteringMode(true, h.filter, window.dhx4.s2b(h.filter_cache), window.dhx4.s2b(h.filter_sub_load)) } else { this.enableFilteringMode(true) } } if (h.image_path != null) { this.setImagePath(h.image_path) } if (h.default_image != null || h.default_image_dis != null) { this.setDefaultImage(h.default_image, h.default_image_dis) } if (h.items || h.options) { this.addOption(h.items || h.options) } if (h.xml || h.json) { this.load(h.xml || h.json) } if (typeof(h.readonly) != "undefined") { this.readonly(h.readonly) } h = null } return this } function dhtmlXComboFromSelect(g) { if (typeof(g) == "string") { g = document.getElementById(g) } var c = g.offsetWidth; var r = g.getAttribute("name") || null; var h = document.createElement("SPAN"); g.parentNode.insertBefore(h, g); var m = g.getAttribute("mode") || g.getAttribute("opt_type") || "option"; var l = new dhtmlXCombo(h, r, c, m); h = null; var o = g.getAttribute("imagePath"); if (o) { l.setImagePath(o) } var q = g.getAttribute("defaultImage"); var n = g.getAttribute("defaultImageDis"); if (window.dhx4.s2b(n) == true) { n = true } if (q != null || n != null) { l.setDefaultImage(q, n) } var a = l._xmlToObj([g], true); if (a.options.length > 0) { l.addOption(a.options) } a = null; g.parentNode.removeChild(g); g = null; return l } dhtmlXCombo.prototype.setName = function(a) { this.conf.form_name = a; this.base.childNodes[1].name = a; this.base.childNodes[2].name = a + "_new_value" }; dhtmlXCombo.prototype.readonly = function(a) { if (window.dhx4.s2b(a)) { this.base.firstChild.setAttribute("readOnly", "true") } else { this.base.firstChild.removeAttribute("readOnly") } }; dhtmlXCombo.prototype.setPlaceholder = function(a) { if (typeof(a) == "undefined" || a == null) { a = "" } this.base.firstChild.setAttribute("placeholder", String(a)) }; dhtmlXCombo.prototype.setTemplate = function(g) { for (var c in g) { if (typeof(this.conf.template[c]) != "undefined") { this.conf.template[c] = String(g[c]) } } 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 }; 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(l) { var m = null; var g = null; for (var h = 0; h < this.list.childNodes.length; h++) { if (m == null) { var c = this.list.childNodes[h]._optId; if (this.t[c].obj.getValue(this.t[c].item) == l) { m = c; g = h } } } return (m == null ? null : this._getOption(m, g)) }; 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(l) { var m = null; var g = null; for (var h = 0; h < this.list.childNodes.length; h++) { if (m == null) { var c = this.list.childNodes[h]._optId; if (this.t[c].obj.getText(this.t[c].item, true) == l) { m = c; g = h } } } return (m == null ? null : this._getOption(m, g)) }; 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) { 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, g, a) { if (c < 0 || c >= this.list.childNodes.length) { return } var h = this.list.childNodes[c]._optId; this._setSelected(h, this._isListVisible(), true); this._confirmSelect("script") }; dhtmlXCombo.prototype.unSelectOption = function() {}; 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.enableFilteringMode = function(h, c, a, g) { if (h == true || h == "between") { this.conf.f_mode = (h == 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(g) } 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(c) { for (var g = 0; g < this.list.childNodes.length; g++) { var a = c.apply(window, [this._getOption(this.list.childNodes[g]._optId, g)]); this.list.childNodes[g].style.display = (a === true ? "" : "none") } }; dhtmlXCombo.prototype.sort = function(g) { var a = []; for (var c = 0; c < this.list.childNodes.length; c++) { var h = this.list.childNodes[c]._optId; a.push([h, this._getOption(h, c)]) } if (g == "asc" || g == "desc") { k = true; a.sort(function(m, l) { m = m[1].text_option.toLowerCase(); l = l[1].text_option.toLowerCase(); var n = (g == "asc" ? 1 : -1); return (m > l ? n : -1 * n) }) } else { if (typeof(g) == "function" || typeof(window[g]) == "function") { if (typeof(window[g]) == "function") { g = window[g] } a.sort(function(m, l) { return g.apply(window, [m[1], l[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(h) { var a = window.dhx4.trim(this.base.firstChild.value).toLowerCase(); var l = null; var c = this.list.firstChild; while (c != null) { if (c.style.display == "" && c._optId != null) { var g = window.dhx4.trim(this.t[c._optId].obj.getText(c, true)).toLowerCase(); if (a == g) { l = c._optId; c = null } } if (c != null) { c = c.nextSibling } } if (this.conf.last_match == null) { if (l != null) { this._setSelected(l, true, true); this.conf.last_match = l } else { if (this.conf.f_mode != "between" || h == true) { this._setSelected(null, true, true); this.conf.last_match = null } } } else { if (l != null) { if (l != this.conf.last_match) { this._setSelected(l, true, true); this.conf.last_match = l } } 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); this.list.style.visibility = "hidden"; this.list.style.display = ""; this.list.style.width = Math.max(this.conf.opts_width || 0, this.conf.combo_width) + "px"; this.list.style.top = window.dhx4.absTop(this.base) + this.base.offsetHeight - 1 + "px"; this.list.style.left = window.dhx4.absLeft(this.base) + "px"; this._checkListHeight(); this.list.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"; 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 q = this.list.firstChild; while (q != null) { if (q.style.display == "") { this.conf.item_h = q.offsetHeight; q = null } else { q = q.nextSibling } } q = null } var r = window.dhx4.screenDim(); var m = window.dhx4.absTop(this.base); var a = this.base.offsetHeight; var c = Math.max(0, Math.floor((m - r.top) / this.conf.item_h)); var o = Math.max(0, Math.floor((r.bottom - (m + a)) / this.conf.item_h)); var u = this._getListVisibleCount(); if (o < Math.min(this.conf.opts_count_min, u) && c > o) { o = null } var n = Math.min((o == null ? c : o), this.conf.opts_count, u); var g = (n < u ? (n * this.conf.item_h) + "px" : ""); var l = this.conf.sp[this.conf.skin].list_ofs; this.list.style.height = g; this.list.style.top = (o == null ? m - this.list.offsetHeight + l : m + a - l) + "px" }; dhtmlXCombo.prototype._scrollToItem = function(l) { var h = this.t[l].item.offsetTop; var g = h + this.t[l].item.offsetHeight; var c = this.list.scrollTop; var a = c + this.list.clientHeight; if (h < c) { this.list.scrollTop = h } else { if (g > a) { this.list.scrollTop = g - this.list.clientHeight } } }; dhtmlXCombo.prototype._setSelected = function(m, l, c) { if (c) { this._updateTopImage(m) } if (m != null && this.conf.last_hover == m) { if (l) { this._scrollToItem(m) } 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 (m == null) { this.callEvent("onSelectionChange", []) } } if (m != null) { this.t[m].obj.setSelected(this.t[m].item, true); this.conf.last_hover = m; this.callEvent("onSelectionChange", []); if (this.t[m].item == this.t[m].item.parentNode.lastChild && this.conf.f_url != null && this.conf.f_dyn == true && !this.conf.f_dyn_end) { var h = "mask=" + encodeURIComponent(this.conf.f_mask) + "&pos=" + this.list.childNodes.length; var a = this; var g = function(o) { if (a.conf.f_cache) { a.conf.f_cache_data[a.conf.f_mask].data.push(o.xmlDoc.responseXML) } var n = a.list.childNodes.length; a.load(o.xmlDoc.responseXML); if (n == 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 } } g = a = null }; if (window.dhx4.ajax.method == "post") { window.dhx4.ajax.post(this.conf.f_url, h, g) } else { if (window.dhx4.ajax.method == "get") { window.dhx4.ajax.get(this.conf.f_url + (String(this.conf.f_url).indexOf("?") >= 0 ? "&" : "?") + h, g) } } } if (l) { this._scrollToItem(m) } } }; dhtmlXCombo.prototype.addOption = function(m, n, c, a, h) { var g = null; if (!(m instanceof Array)) { var o = this._renderOption({ value: m, text: n, css: c, img: a }); if (g == null && window.dhx4.s2b(h) == true) { g = o } } else { for (var l = 0; l < m.length; l++) { if (m[l] instanceof Array) { o = this._renderOption({ value: m[l][0], text: m[l][1], css: m[l][2], img: m[l][3] }); if (g == null && window.dhx4.s2b(m[l][4]) == true) { g = o } } else { var o = this._renderOption(m[l]); if (g == null && window.dhx4.s2b(m[l].selected) == true) { g = o } } } } if (g != null) { this._setSelected(g, this._isListVisible(), true); this._confirmSelect("onInit") } }; dhtmlXCombo.prototype.updateOption = function(a, g, c, h) { var l = this._getOptionId(a); if (l == null) { return } this.t[l].obj.update(this.t[l].item, { value: g, text: c, css: h }); if (this.conf.last_selected == l) { this.conf.last_text = this.base.firstChild.value = this.t[l].obj.getText(this.t[l].item, true); this.conf.f_server_last = this.base.firstChild.value.toLowerCase() } }; dhtmlXCombo.prototype.deleteOption = function(h) { for (var c in this.t) { var g = this.t[c].obj.getValue(this.t[c].item); if (g == h) { this._removeOption(c) } } if (this._isListVisible()) { this._showList(true) } }; dhtmlXCombo.prototype.clearAll = function() { for (var c in this.t) { this._removeOption(c) } 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; this._hideList() }; dhtmlXCombo.prototype._renderOption = function(c) { var g = window.dhx4.newId(); var a = document.createElement("DIV"); a._optId = g; a._tpl = this.conf.template; if (typeof(c.img) == "undefined" && typeof(c.img_src) != "undefined") { c.img = c.img_src; delete c.img_src } if (typeof(c.img_dis) == "undefined" && typeof(c.img_src_dis) != "undefined") { c.img_dis = c.img_src_dis; delete c.img_src_dis } c.img_path = this.conf.img_path; c.img_def = this.conf.img_def; c.img_def_dis = this.conf.img_def_dis; this.list.appendChild(a); this.t[a._optId] = { obj: this.modes[this.conf.opts_type].render(a, c), item: a, conf: { type: this.conf.opts_type } }; a = null; return g }; 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(c) { var a = false; if (this.conf.f_server_tm) { window.clearTimeout(this.conf.f_server_tm) } if (this.conf.last_hover != null) { a = a || (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)) { a = a || (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 (c != "blur") { this._selectRange(this.base.firstChild.value.length, this.base.firstChild.value.length) } } this._hideList(); if (a == true && c != "onInit" && c != "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(n, h) { if (!this.t[n]) { return null } if (typeof(h) == "undefined") { h = -1 } if (h < 0) { for (var m = 0; m < this.list.childNodes.length; m++) { if (h < 0 && this.list.childNodes[m]._optId == n) { h = m } } } var l = { value: this.t[n].obj.getValue(this.t[n].item), text: this.t[n].obj.getText(this.t[n].item), text_input: this.t[n].obj.getText(this.t[n].item, true), text_option: this.t[n].obj.getText(this.t[n].item, null, true), css: this.t[n].obj.getCss(this.t[n].item), selected: (n == this.conf.last_selected), index: h }; if (typeof(this.t[n].obj.getExtraData) == "function") { var g = this.t[n].obj.getExtraData(this.t[n].item); for (var c in g) { if (typeof(l[c]) == "undefined") { l[c] = g[c] } } } return l }; dhtmlXCombo.prototype._getOptionProp = function(h, g, c) { if (h != null) { var a = this._getOption(h); if (a != null) { return a[g] } } return c }; dhtmlXCombo.prototype._getOptionId = function(c) { var h = null; for (var a = 0; a < this.list.childNodes.length; a++) { if (h == null) { var g = this.list.childNodes[a]._optId; if (c == this.t[g].obj.getValue(this.t[g].item)) { h = g } } } return h }; dhtmlXCombo.prototype._getOptionValue = function(a) { return this._getOptionProp(a, "value", null) }; dhtmlXCombo.prototype.setSize = function(a) { this.conf.combo_width = parseInt(a); this.base.style.width = this.conf.combo_width + "px"; this.base.firstChild.style.width = (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.modes = {}; dhtmlXCombo.prototype.doWithItem = function(a, n, l, g) { var m = (a >= 0 && a < this.list.childNodes.length ? this.list.childNodes[a]._optId : null); if (m == null) { return null } if (typeof(this.t[m].obj[n]) != "function") { return null } var h = [this.t[m].item]; for (var c = 2; c < arguments.length; c++) { h.push(arguments[c]) } return this.t[m].obj[n].apply(this.t[m].obj, h) }; function dhtmlXComboExtend(h, g) { for (var c in dhtmlXCombo.prototype.modes[g]) { if (typeof(dhtmlXCombo.prototype.modes[h][c]) == "undefined") { dhtmlXCombo.prototype.modes[h][c] = dhtmlXCombo.prototype.modes[g][c] } } } dhtmlXCombo.prototype.modes.option = { image: 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, g) { c._conf.text = g; var a = (typeof(g) == "object" ? window.dhx4.template(c._tpl.option, c._conf.text, true) : window.dhx4.trim(c._conf.text || "")); c.lastChild.innerHTML = (a.length == 0 ? " " : a) }, getText: function(g, a, c) { if (window.dhx4.s2b(a) && typeof(g._conf.text) == "object") { return window.dhx4.template(g._tpl.input, g._conf.text, true) } if (window.dhx4.s2b(c) && typeof(g._conf.text) == "object") { return window.dhx4.template(g._tpl.option, g._conf.text, true) } return g._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" } } }; dhtmlXCombo.prototype.modes.checkbox = { image: true, image_css: "dhxcombo_checkbox dhxcombo_chbx_#state#", option_css: "dhxcombo_option_text dhxcombo_option_text_chbx", render: function(a, c) { a._conf = { value: c.value, css: "", checked: window.dhx4.s2b(c.checked) }; a.className = "dhxcombo_option"; a.innerHTML = "
 
"; a.firstChild._optChbxId = a._optId; if (c.css != null) { a.lastChild.style.cssText += c.css; a._conf.css = c.css } this.setText(a, c.text); return this }, setChecked: function(a, c) { a._conf.checked = window.dhx4.s2b(c); a.firstChild.className = String(this.image_css).replace("#state#", (a._conf.checked ? "1" : "0")) }, isChecked: function(a) { return (a._conf.checked == true) }, getExtraData: function(a) { return { type: "checkbox", checked: a._conf.checked } }, optionClick: function(h, g, l) { var c = true; var a = (g.target || g.srcElement); while (c == true && a != null && a != h) { if (a._optChbxId != null) { if (l.callEvent("onCheck", [h._conf.value, !h._conf.checked]) === true) { this.setChecked(h, !this.isChecked(h)) } c = false } else { a = a.parentNode } } a = l = h = null; return c }, 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, h) { var c = []; for (var g = 0; g < this.list.childNodes.length; g++) { if (this.isChecked(g)) { c.push(this._getOptionProp(this.list.childNodes[g]._optId, "value", "")) } } return c }; dhtmlXCombo.prototype.isChecked = function(a) { return this.doWithItem(a, "isChecked") }; dhtmlXCombo.prototype.modes.image = { image: 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(g, a, l, m, h, c) { if (a != null && a.length > 0) { a = m + a } else { if (h != null && h.length > 0) { a = m + h } else { a = null } } if (l != null && l.length > 0) { l = m + l } else { if (c != null && c.length > 0) { l = m + c } else { if (c == true) { l = a } else { l = null } } } g._conf.img = a; g._conf.img_dis = l; g.firstChild.style.backgroundImage = (a != null ? "url(" + a + ")" : "none") }, getExtraData: function(a) { return { type: "image" } }, getTopImage: function(h, g) { var c = (g ? "img" : "img_dis"); if (h != null && h._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(o) { if (!(this instanceof dhtmlXColorPicker)) { return new dhtmlXColorPicker(o) } dhx4._eventable(this); var m = this, h = undefined, n = null, g, 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: null, blue: null, green: null, hue: null, sat: null, lum: null }; this._initMoveSelection = function(l) { l = l || event; if (typeof(window.addEventListener) == "function") { m._controllerNodes.colorArea.addEventListener("mousemove", m._setMoveSelection, false); document.body.addEventListener("mouseup", m._cleanMoveSelection, false) } else { m._controllerNodes.colorArea.attachEvent("onmousemove", m._setMoveSelection); document.body.attachEvent("onmouseup", m._cleanMoveSelection) } m._setMoveSelection(l, m._controllerNodes.colorArea); return false }; this._cleanMoveSelection = function() { if (typeof(window.removeEventListener) == "function") { m._controllerNodes.colorArea.removeEventListener("mousemove", m._setMoveSelection, false); document.body.removeEventListener("mouseup", m._cleanMoveSelection, false) } else { m._controllerNodes.colorArea.detachEvent("onmousemove", m._setMoveSelection); document.body.detachEvent("onmouseup", m._cleanMoveSelection) } return false }; this._setMoveSelection = function(l) { l = l || event; var q = m._getOffsetPosition(l, m._controllerNodes.colorArea); if (m._controllerNodes.fr_cover) { setTimeout(function() { m._setColorAreaXY(q.x, q.y); m._setColorByXYC() }, 0) } else { m._setColorAreaXY(q.x, q.y); m._setColorByXYC() } return false }; this._initMoveContrast = function(l) { l = l || event; if (typeof(window.addEventListener) == "function") { document.body.addEventListener("mousemove", m._setMoveContrast, false); document.body.addEventListener("mouseup", m._cleanMoveContrast, false) } else { document.body.attachEvent("onmousemove", m._setMoveContrast); document.body.attachEvent("onmouseup", m._cleanMoveContrast) } m._setMoveContrast(l, m._controllerNodes.contrastArea) }; this._cleanMoveContrast = function() { if (typeof(window.removeEventListener) == "function") { document.body.removeEventListener("mousemove", m._setMoveContrast, false); document.body.removeEventListener("mouseup", m._cleanMoveContrast, false) } else { document.body.detachEvent("onmousemove", m._setMoveContrast); document.body.detachEvent("onmouseup", m._cleanMoveContrast) } }; this._setMoveContrast = function(l) { l = l || event; var q = m._getOffsetPosition(l, m._controllerNodes.contrastArea); m._setContrastY(q.y); m._setColorByXYC(true) }; this._doOnSelectColor = function() { var l = m.colorAIP.rgb2hex({ r: m.value.red, g: m.value.green, b: m.value.blue }); if (m.activeNode != null) { if (m.activeNode.valueCont) { m.activeNode.valueCont.value = l } if (m.activeNode.valueColor) { m.activeNode.valueColor.style.backgroundColor = l } } if (m.base._dhx_remove || m.conf.hideOnSelect) { m.hide() } m.callEvent("onSelect", [l, ((m.activeNode) ? m.activeNode.node : null)]) }; this._doOnCancel = function() { if (m.callEvent("onCancel", [((m.activeNode) ? m.activeNode.node : null)]) == true && m.conf.closeable == true) { m.hide() } }; this._doOnFocusByInput = function() { var q = (this != window) ? this : event.srcElement; var l = (m.activeNode && m.activeNode.valueCont && m.activeNode.valueCont == q) ? m.activeNode : m._getNodeByValueCont(q); m.activeNode = l; if (l && l == m.activeNode) { m._initListenerInput() } }; this._doOnBlurByInput = function() { var q = (this != window) ? this : event.srcElement; var l = (m.activeNode && m.activeNode.valueCont && m.activeNode.valueCont == q) ? m.activeNode : m._getNodeByValueCont(q); if (l && l == m.activeNode) { m._removeListenerInput() } }; this._doOnClickByNode = function(q) { q = q || event; var l = (this != window) ? this : event.srcElement; m.activeNode = (m.activeNode.node != l) ? m._getNodeByElement(l) : m.activeNode; if (!m.isVisible()) { m.show() } }; this.saveColor = function() { m.memory.setValue(m.value) }; this._onSelectMemoryEl = function(q) { var l; m._refreshCoordinatesByHSL(q.value.hue, q.value.sat, q.value.lum); for (l in q.value) { m.value[l] = q.value[l] } m._refreshContrast(); m._refreshInputValues(); m._refreshColorValue() }; this._doOnClickByBody = function(r) { r = r || event; var l = true, q = r.target || r.srcElement; if (m._isBaseNode(q)) { l = false } if (l && m.activeNode && (m.activeNode.node == q || m.activeNode.valueCont == q)) { l = false } if (l) { m.hide() } }; this._doOnChangeHSL = function() { var r = parseInt(m._controllerNodes.hue.value), q = parseInt(m._controllerNodes.sat.value), l = parseInt(m._controllerNodes.lum.value), s; if (isNaN(r) || r > 359 || r < 0) { m._controllerNodes.hue.value = m.value.hue } else { m.value.hue = r } if (isNaN(q) || q > 100 || q < 0) { m._controllerNodes.sat.value = m.value.sat } else { m.value.sat = q } if (isNaN(l) || l > 100 || l < 0) { m._controllerNodes.lum.value = m.value.lum } else { m.value.lum = l } s = m.colorAIP.hsl2rgb(m.value.hue, m.value.sat / 100, m.value.lum / 100); m.value.red = Math.round(255 * s.r); m.value.green = Math.round(255 * s.g); m.value.blue = Math.round(255 * s.b); m._refreshCoordinatesByHSL(m.value.hue, m.value.sat, m.value.lum); m._refreshContrast(); m._refreshInputValues(); m._refreshColorValue() }; this._doOnChangeRGB = function() { var s = parseInt(m._controllerNodes.red.value), r = parseInt(m._controllerNodes.green.value), l = parseInt(m._controllerNodes.blue.value), q; if (isNaN(s) || s > 255 || s < 0) { m._controllerNodes.red.value = m.value.red } else { m.value.red = s } if (isNaN(r) || r > 255 || r < 0) { m._controllerNodes.green.value = m.value.green } else { m.value.green = r } if (isNaN(l) || l > 255 || l < 0) { m._controllerNodes.blue.value = m.value.blue } else { m.value.blue = l } q = m.colorAIP.rgb2hsl(m.value.red / 255, m.value.green / 255, m.value.blue / 255); m.value.hue = Math.round(q.h); m.value.sat = Math.round(q.s * 100); m.value.lum = Math.round(q.l * 100); m._refreshCoordinatesByHSL(m.value.hue, m.value.sat, m.value.lum); m._refreshContrast(); m._refreshInputValues(); m._refreshColorValue() }; this._doOnChangeHSV = function() { m._controllerNodes.hsv.value = m.setColor(m._controllerNodes.hsv.value) }; this._checkType = function(q) { var l; if (q instanceof Array) { l = m._checkType(q[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 (q == undefined) { return null } else { if (typeof(q) == "string") { return "string" } else { if (q.tagName && q.tagName.toLowerCase() == "input") { return "input" } else { if (q.tagName && q.tagName.toLowerCase() == "textarea") { return "textarea" } else { if (q.tagName) { return "container" } else { if (typeof(q) == "object") { return "object" } else { return undefined } } } } } } } }; this._initByObject = function(l) { if (l.parent && l.parent.tagName) { m.base = l.parent } else { if (typeof(l.parent) == "string") { m.base = document.getElementById(l.parent) } else { m.base = document.createElement("div"); m.base._dhx_remove = true } } if (l.color) { m.conf.selectedColor = l.color } if (typeof(l.closeable) != "undefined") { this.conf.closeable = dhx4.s2b(l.closeable) } if (l.custom_colors) { this._tempInitCC = function() { var s, r; this.initMemoryColors(); this.conf.customColors = true; if (l.custom_colors instanceof Array) { r = l.custom_colors.length; for (s = 0; s < r; s++) { this.setCustomColors(l.custom_colors[s]) } } if (this.base.parentNode) { this.showMemory() } delete this._tempInitCC } } if (l.hide) { m.conf.hide = true } if (l.input) { m._addNode(l.input, l.target_color, l.target_value) } var q = l.skin || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxcolorpicker") || "dhx_skyblue"; m.setSkin(q); if (l.colors) { m.initMemoryColors(); m.conf.customColors = true } if (l.link) { m._addNode(l.link) } }; this.unload = function() { var s, q, r; if (this.isVisible()) { this.hide() } this.destructMemory(); q = this._nodes.length; for (s = 0; s < q; s++) { this._detachEventsFromNode(this._nodes[s]); for (r in this._nodes[s]) { this._nodes[s][r] = null } delete this._nodes[s] } 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 (r in this) { this[r] = null } m = null, n = null, c = null }; h = this._checkType(o); switch (h) { case "object": m._initByObject(o); break; case "input": case "textarea": m._initByObject({}); this._addNode(o); break; case "string": n = document.getElementById(o); return new dhtmlXColorPicker(n); break; case "container": m._initByObject({ parent: o }); break; case null: m._initByObject({}); break; case "array_string": case "array_input": m._initByObject({}); a = o.length; for (g = 0; g < a; g++) { this._addNode(o[g]) } break; case "array_object": m._initByObject({}); a = o.length; for (g = 0; g < a; g++) { c = this._addNode(o[g].input, o[g].target_color, o[g].target_value).conf; c.customColors = (o[g].custom_colors != undefined) ? dhx4.s2b(o[g].custom_colors) : c.customColors; c.selectedColor = (o[g].color != undefined) ? o[g].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) } if (this.conf.selectedColor) { this.setColor(this.conf.selectedColor) } else { this._setColorAreaXY(10, 10); this._setContrastY(10); m._setColorByXYC() } if (this._nodes.length) { for (var g = 0; g < this._nodes.length; g++) { this._attachEventsToNode(this._nodes[g]) } } if (this.conf.hide) { this.hide() } if (typeof(this._cpInitFRM) == "function") { this._cpInitFRM() } } dhtmlXColorPicker.prototype.linkTo = function(c, g, h) { if (arguments.length == 1) { g = h = c } var a; c = c || null; h = h || null; if (typeof(g) == "string") { g = document.getElementById(g) } a = this._addNode(g, c, h); 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(g) { var c, a, h = false; a = this._nodes.length; for (c = 0; c < a; c++) { if (this._nodes[c].valueCont == g) { h = true; break } } return h }; dhtmlXColorPicker.prototype._findNodesByArray = function(m) { var g, a, c, h = []; a = m.length; for (g = 0; g < a; g++) { if (typeof(m[g]) == "string") { c = document.getElementById(m[g]) } else { c = m[g] } if (c) { this._addNode(c) } } }; dhtmlXColorPicker.prototype._addNode = function(l, n, m) { var c, h, g, a; if (typeof(l) == "string") { c = document.getElementById(l) } else { c = l } if (typeof(n) == "string") { n = document.getElementById(n) } if (typeof(m) == "string") { m = document.getElementById(m) } if (!c) { return null } if (dhx4.s2b(c.getAttribute("colorbox"))) { h = document.createElement("div"); h.style.width = c.offsetWidth + "px"; h.style.height = c.offsetHeight + "px"; c.style.width = c.offsetWidth - (c.offsetHeight + 8) + "px"; c.parentNode.insertBefore(h, c); h.style.position = "relative"; g = document.createElement("div"); h.appendChild(c); h.appendChild(g); g.className = "dhxcp_colorBox"; c.className += " dhxcp_colorInput"; g.style.width = g.style.height = c.offsetHeight + "px" } a = { node: c, valueColor: (n != undefined) ? n : g || c, valueCont: (m != undefined) ? m : 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(g) { var a = null, c = null; if (typeof(g) == "string") { a = document.getElementById(g) } else { a = g } if (a.tagName != undefined) { c = this._getNodeByElement(a) } return c }; dhtmlXColorPicker.prototype._getNodeByElement = function(g) { var h = null, c, a; a = this._nodes.length; for (c = 0; c < a; c++) { if (this._nodes[c].node == g) { h = this._nodes[c] } } return h }; dhtmlXColorPicker.prototype._getNodeByValueCont = function(g) { var h = null, c, a; a = this._nodes.length; for (c = 0; c < a; c++) { if (this._nodes[c].valueCont && this._nodes[c].valueCont == g) { h = this._nodes[c] } } return h }; 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(h) { var g = c.colorAIP.rgb2hex({ r: h.red, g: h.green, b: h.blue }); c.callEvent("onSaveColor", [g]) }; 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(o, n, c) { var a, m, g; a = Math.round((this.configColorArea.maxX - this.configColorArea.minX) * o / 359) + this.configColorArea.minX; m = Math.round((this.configColorArea.maxY - this.configColorArea.minY) * (100 - c) / 100) + this.configColorArea.minY; g = Math.round((this.configColorArea.maxY - this.configColorArea.minY) * (100 - n) / 100) + this.configColorArea.minY; this._setColorAreaXY(a, m); this._setContrastY(g) }; dhtmlXColorPicker.prototype.setColor = function(n) { var h, g, m = true, c, a = this.colorAIP.rgb2hex({ r: this.value.red, g: this.value.green, b: this.value.blue }), l; if (n instanceof Array) { h = { r: parseInt(n[0]), g: parseInt(n[1]), b: parseInt(n[2]) } } else { if (typeof(n) == "string") { n = n.replace(/\s/g, ""); if (/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i.test(n)) { g = n.match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i); h = { r: parseInt(g[1]), g: parseInt(g[2]), b: parseInt(g[3]) } } else { h = this.colorAIP.hex2rgb(n) } } } m = m && h instanceof Object; m = m && (0 <= h.r && h.r <= 255); m = m && (0 <= h.g && h.g <= 255); m = m && (0 <= h.b && h.b <= 255); if (!m) { return a } l = this.colorAIP.rgb2hex({ r: h.r, g: h.g, b: h.b }); if (l == a) { return a } this.value.red = h.r; this.value.green = h.g; this.value.blue = h.b; c = this.colorAIP.rgb2hsl(h.r / 255, h.g / 255, h.b / 255); this.value.hue = Math.round(c.h); this.value.sat = Math.round(c.s * 100); this.value.lum = Math.round(c.l * 100); this._refreshCoordinatesByHSL(this.value.hue, this.value.sat, this.value.lum); this._refreshContrast(); this._refreshInputValues(); this._refreshColorValue(); return l }; 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); if (document.body.firstChild) { document.body.insertBefore(this.base, document.body.firstChild) } else { document.body.appendChild(this.base) } this._refreshPosition(); 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, l) { var h = null, a = parseInt(c), g = parseInt(l); if (isNaN(a)) { h = (c.toLowerCase() == "left") ? "left" : (c.toLowerCase() == "bottom") ? "bottom" : null } if (this.base._dhx_remove) { if (h == null) {} else { this.conf.position = h; this._refreshPosition(h) } } else { if (isNaN(a) || isNaN(g)) {} else { this._globalNode.style.left = a + "px"; this._globalNode.style.top = g + "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), a = dhx4.absLeft(this.activeNode.node), g = dhx4.screenDim(), h = this._globalNode.offsetHeight, l = 0; c = c || this.conf.position; switch (c) { case "bottom": this._globalNode.style.top = m + this.activeNode.node.offsetHeight + this.conf.indent + "px"; this._globalNode.style.left = a + "px"; break; default: this._globalNode.style.left = a + this.activeNode.node.offsetWidth + this.conf.indent + "px"; l = m; if (g.bottom - (l + h) <= 0) { l = g.bottom - (h + this.conf.indent) } if (l - g.top < 0) { l = g.top + this.conf.indent } 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, g) { 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 } } } g = parseInt(g); if (c.minY > g) { this.conf.y = c.minY } else { if (g > c.maxY) { this.conf.y = c.maxY } else { if (!isNaN(g)) { this.conf.y = g } } } 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 h = this.colorAIP.hsl2rgb(this.value.hue, 0, this.value.lum / 100); var l = this.colorAIP.hsl2rgb(this.value.hue, 1, this.value.lum / 100); var g = this._checkIeVersion(); if (g && g <= 8) { var m = this._controllerNodes.contrastArea.firstChild; if (m == this._controllerNodes.contrast_line) { m = document.createElement("div"); m.className += "dhxcp_ie_gradient"; this._controllerNodes.contrastArea.appendChild(m); this._controllerNodes.contrastArea.appendChild(this._controllerNodes.contrast_line) } var c = this.colorAIP.rgb2hex({ r: Math.round(255 * h.r), g: Math.round(255 * h.g), b: Math.round(255 * h.b) }); var a = this.colorAIP.rgb2hex({ r: Math.round(255 * l.r), g: Math.round(255 * l.g), b: Math.round(255 * l.b) }); m.style.filter = "progid:DXImageTransform.Microsoft.gradient(startColorstr='" + a + "', endColorstr='" + c + "', GradientType=0)" } else { h = [Math.round(255 * h.r), Math.round(255 * h.g), Math.round(255 * h.b)]; l = [Math.round(255 * l.r), Math.round(255 * l.g), Math.round(255 * l.b)]; this._controllerNodes.contrastArea.style.backgroundImage = "linear-gradient(to top, rgb(" + h.join(",") + "), rgb(" + l.join(",") + "))" } }; 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(l) { var h = parseInt(l.r), c = parseInt(l.g), a = parseInt(l.b); h = h || 0, c = c || 0, a = a || 0; return "#" + ((h) ? ((h < 16) ? "0" + h.toString(16) : h.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(q, o, h) { var n, m, c; var a = Math.max(q, o, h), l = Math.min(q, o, h); c = 0.5 * (a + l); if (a == l) { n = 0 } else { if (a == q) { n = 60 * (o - h) / (a - l); if (o < h) { n += 360 } } else { if (a == o) { n = 60 * (h - q) / (a - l) + 120 } else { n = 60 * (q - o) / (a - l) + 240 } } } if (c == 0 || a == l) { m = 0 } else { if (c <= 0.5) { m = 0.5 * (a - l) / c } else { m = 0.5 * (a - l) / (1 - c) } } return { h: n, s: m, l: c } }, hsl2rgb: function(q, g, n) { var l, m, o; var c = [], a = []; if (n <= 0.5) { l = n * (1 + g) } else { l = n + g - (n * g) } m = 2 * n - l; o = q / 360; c.push(o + 1 / 3); c.push(o); c.push(o - 1 / 3); for (var h = 0; h < 3; h++) { if (c[h] < 0) { c[h] += 1 } else { if (c[h] > 1) { c[h] -= 1 } } if (c[h] < 1 / 6) { a.push(m + (l - m) * 6 * c[h]) } else { if (c[h] < 0.5) { a.push(l) } else { if (c[h] < 2 / 3) { a.push(m + (l - m) * (2 / 3 - c[h]) * 6) } else { a.push(m) } } } } 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 h, g, n, c, m, a; g = arguments.length; for (h = 0; h < g; h++) { if (arguments[h] instanceof Array) { n = this._rgb2value(arguments[h][0], arguments[h][1], arguments[h][2]); this.memory.setValue(n, null, false); continue } else { if (typeof(arguments[h]) == "string") { c = arguments[h].match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i); if (c instanceof Array) { n = this._rgb2value(c[1], c[2], c[3]); this.memory.setValue(n, null, false); continue } c = arguments[h].match(/(#[\da-f]{6})/ig); if (c instanceof Array) { a = c.length; for (m = 0; m < a; m++) { n = this._hex2value(c[m]); this.memory.setValue(n, null, false) } } } } } }; dhtmlXColorPicker.prototype._rgb2value = function(l, h, a) { var c = this.colorAIP.rgb2hsl(l / 255, h / 255, a / 255); return { red: l, green: h, blue: a, hue: Math.round(c.h), sat: Math.round(c.s * 100), lum: Math.round(c.l * 100) } }; dhtmlXColorPicker.prototype._hex2value = function(g) { var c, a; c = this.colorAIP.hex2rgb(g); 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(l) { l = l.toLowerCase(); var g, c = -1, a, h = "dhtmlxcp"; g = this.base.className.match(/\S\w+/ig); if (g instanceof Array) { for (a in this._skinCollection) { if (c == -1) { c = this._indexOf(g, h + "_" + a) } else { break } } c = (c == -1) ? g.length : c } else { g = []; c = 0 } g[c] = h + "_" + l; this.base.className = g.join(" "); this.skin = l }; dhtmlXColorPicker.prototype.hideOnSelect = function(a) { a = dhx4.s2b(a); this.conf.hideOnSelect = a }; dhtmlXColorPicker.prototype._indexOf = function(a, h) { var g, c, m = -1; c = a.length; for (g = c; g >= 0; g--) { if (a[g] == h) { m = g; break } } return m }; 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(g) { var c = this, a = null, h = { red: 255, blue: 255, green: 255, hue: 0, sat: 0, lum: 100 }; this.select = function() { var m = (this != window) ? this : event.srcElement; var l = l || m.dhxpc_memory; if (a != null) { c.unSelect() } a = l; l.domElement.className += " dhxcp_memory_el_select"; if (typeof(c.onSelect) == "function") { c.onSelect(l) } }; this.onSelect = null; this.onSave = null; this._createMemoryController = function(l) { var m = { domElement: l, value: dhx4._copyObj(h) }; l.dhxpc_memory = m; if (typeof(window.addEventListener) == "function") { l.addEventListener("click", c.select, false) } else { l.attachEvent("onclick", c.select) } return m }; this._findMemoryControllers = function(r) { var o = r.getElementsByTagName("a"), n, m, q = []; m = o.length; for (n = 0; n < m; n++) { q.push(this._createMemoryController(o[n])) } return q }; this.controllers = this._findMemoryControllers(g); this.unSelect = function() { if (a) { a.domElement.className = a.domElement.className.replace(/\s.*$/i, "") } a = null }; this.setActiveNext = function() { var n = null, m; if (a == null) { a = this.controllers[0] } else { n = this.getIndex(a); m = this.controllers.length; this.unSelect(); a = (n + 1 < m) ? this.controllers[n + 1] : this.controllers[0] } a.domElement.className += " dhxcp_memory_el_next"; return a }; this.setValue = function(m, l, n) { a = l || a; if (a == null) { a = this.controllers[0] } a.value.red = m.red; a.value.blue = m.blue; a.value.green = m.green; a.value.hue = m.hue; a.value.sat = m.sat; a.value.lum = m.lum; a.domElement.style.backgroundColor = "rgb(" + [m.red, m.green, m.blue].join(", ") + ")"; this.setActiveNext(); if ((n != false) && (typeof(this.onSave) == "function")) { this.onSave(m) } }; this.clean = function() { var m = this.controllers.length, o; for (var n = 0; n < m; n++) { o = this.controllers[n]; o.value = dhx4._copyObj(h); o.domElement.style.backgroundColor = "rgb(" + [h.red, h.green, h.blue].join(", ") + ")" } this.unSelect(); a = this.controllers[0] }; this.getIndex = function(o) { var n, m, q = -1; m = this.controllers.length; for (n = 0; n < m; n++) { if (this.controllers[n] == o) { q = n; break } } return q }; this.remove = function() { var n, m; m = this.controllers.length; for (n = 0; n < m; n++) { if (typeof(window.addEventListener) == "function") { this.controllers[n].domElement.removeEventListener("click", this.select, false) } else { this.controllers[n].domElement.detachEvent("onclick", this.select) } delete this.controllers[n].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(g) { var c = this; this.conf = { size: null, skin: null, vertical: false, min: 0, max: 99, value: 0, step: 1, margin: 2, border: 1, disabled: false, tooltip: false, visible: true, linkTo: undefined }; this._attachedNode = {}; this.base = null; var a = null; if (arguments.length > 1) { return new dhtmlXSlider(this._renderArgumets(arguments)) } else { if (typeof(g) == "string" || (typeof(g) == "object" && g.tagName)) { return new dhtmlXSlider({ parent: g }) } } if (typeof(g.parent) == "string") { this.base = document.getElementById(g.parent) } else { this.base = g.parent } this._mergeConfig(this._readAttFormNode(this.base)); this._mergeConfig(g); if (this.conf.size == null || this.conf.size == undefined) { if (this.conf.vertical) { this.conf.size = this.base.offsetHeight } else { this.conf.size = this.base.offsetWidth } } var h = this.conf.skin || window.dhx4.skin || (typeof(dhtmlx) !== "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxslider") || "dhx_skyblue"; this.setSkin(h); this.base.innerHTML = "
"; this._nodes = { cont: this.base.firstChild, track: this.base.firstChild.firstChild, runner: this.base.firstChild.childNodes[1] }; this._nodes.cont.onmousedown = this._nodes.track.onmousedown = this._nodes.cont.onselectstart = this._nodes.track.onselectstart = function(l) { l = l || event; if (typeof(l.preventDefault) == "function") { l.preventDefault() } else { l.returnValue = false } return false }; this.conf.value = this._normalize(this.conf.value); this._setOrient(this.conf.vertical); this.setSize(this.conf.size); this._initMover = function(l) { l = l || event; a = {}; a.value = c.conf.value; a.coord = (c.conf.vertical) ? l.clientY : l.clientX; if (c.conf.disabled == false) { if (typeof(window.addEventListener) == "function") { window.addEventListener("mousemove", c._move, false); window.addEventListener("mouseup", c._cleanMove, false) } else { document.body.attachEvent("onmousemove", c._move); document.body.attachEvent("onmouseup", c._cleanMove) } } c.callEvent("_onRunnerMouseDown", []); return false }; this._move = function(q) { q = q || event; var o = (c.conf.vertical) ? c._nodes.runner.offsetHeight : c._nodes.runner.offsetWidth; var m = c.conf.max - c.conf.min; var l = (c.conf.vertical) ? q.clientY : q.clientX; var n = a.value + (l - a.coord) * m / (c.conf.size - o); c.setValue(Math.round(n), true) }; this._cleanMove = function(l) { if (typeof(window.addEventListener) == "function") { window.removeEventListener("mousemove", c._move, false); window.removeEventListener("mouseup", c._cleanMove, false) } else { document.body.detachEvent("onmousemove", c._move); document.body.detachEvent("onmouseup", c._cleanMove) } a = null; c.callEvent("onSlideEnd", [c.conf.value]); c.callEvent("_onRunnerMouseUp", []) }; this._doOnSetValue = function(q) { if (a) { return false } q = q || event; var o = (c.conf.vertical) ? (q.offsetY || q.layerY) : (q.offsetX || q.layerX); var n = (c.conf.vertical) ? c._nodes.runner.offoffsetHeightsetHe : c._nodes.runner.offsetWidth; var l = c.conf.max - c.conf.min; var m = o * l / (c.conf.size) + c.conf.min; c.setValue(Math.round(m), true); if (!a) { c._initMover(q) } return false }; this._doOnChangeInput = function(m) { m = m || event; var l = m.target || m.srcElement; c.setValue(l.value) }; this._doOnKeyDown = function(m) { m = m || event; var l = m.target || m.srcElement; if (m.keyCode == 13) { c.setValue(l.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 (/\s?dhtmlxslider_\S*/.test(this.base.className)) { this.base.className = this.base.className.replace(/\s?dhtmlxslider_\S*/, "") } for (var l in this) { this[l] = null } c = 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.cont.addEventListener("mousedown", this._doOnSetValue, false) } else { a.runner.attachEvent("onmousedown", this._initMover); a.cont.attachEvent("onmousedown", this._doOnSetValue) } }; dhtmlXSlider.prototype._detachEvents = function(a) { if (typeof(window.addEventListener) == "function") { a.runner.removeEventListener("mousedown", this._initMover, false); a.cont.removeEventListener("mousedown", this._doOnSetValue, false) } else { a.runner.detachEvent("onmousedown", this._initMover); a.cont.detachEvent("onmousedown", this._doOnSetValue) } }; dhtmlXSlider.prototype._mergeConfig = function(c) { for (var a in c) { switch (a.toLowerCase()) { case "size": case "min": case "max": case "value": case "step": this.conf[a] = parseInt(c[a]); break; case "vertical": case "tooltip": case "disabled": case "visible": this.conf[a] = dhx4.s2b(c[a]); break; case "parent": continue; break; default: this.conf[a] = c[a] } } }; dhtmlXSlider.prototype._readAttFormNode = function(h) { var n = h.attributes, a = n.length, g, m = {}, c; for (g = 0; g < a; g++) { c = n[g]; switch (c.name.toLowerCase()) { case "size": case "min": case "max": case "value": case "step": m[c.name] = parseInt(c.value); break; case "skin": m.skin = c.value; break; case "vertical": case "disabled": case "visible": m[c.name] = dhx4.s2b(c.value); break; case "linkto": m.linkTo = c.value; break; case "tooltip": m.tooltip = dhx4.s2b(c.value); break } } return m }; dhtmlXSlider.prototype._renderArgumets = function(a) { var h = {}, g, c; c = a.length; for (g = 0; g < c; g++) { switch (g) { case 0: h.parent = a[g]; break; case 1: h.size = a[g]; break; case 2: h.skin = a[g]; break; case 3: h.vertical = a[g]; break; case 4: h.min = a[g]; break; case 5: h.max = a[g]; break; case 6: h.value = a[g]; break; case 7: h.step = a[g]; break } } return h }; dhtmlXSlider.prototype._skinCollection = { dhx_skyblue: true, dhx_web: true, dhx_terrace: true }; dhtmlXSlider.prototype._indexOf = function(a, h) { var g, c, m = -1; c = a.length; for (g = c; g >= 0; g--) { if (a[g] == h) { m = g; break } } return m }; dhtmlXSlider.prototype._refreshRunner = function() { var a, c; if (this.conf.vertical) { a = this._nodes.cont.offsetHeight - this._nodes.runner.offsetHeight; c = this._getCoord(a); this._nodes.runner.style.top = c + this.conf.border + "px"; this._nodes.runner.style.left = Math.round((this._nodes.cont.offsetWidth - this._nodes.runner.offsetWidth) / 2) + "px" } else { a = this._nodes.cont.offsetWidth - this._nodes.runner.offsetWidth; c = this._getCoord(a); this._nodes.runner.style.left = c + this.conf.border + "px"; this._nodes.runner.style.top = Math.round((this._nodes.cont.offsetHeight - this._nodes.runner.offsetHeight) / 2) + "px" } }; dhtmlXSlider.prototype._setValueByCoord = function(h) { var a = dhx4.absLeft(this._nodes.cont), l = dhx4.absTop(this._nodes.cont), g, c; if (this.conf.vertical) { c = (h.y - l - this._nodes.runner.offsetHeight / 2) / (this._nodes.cont.offsetHeight - this._nodes.runner.offsetHeight) } else { c = (h.x - a - this._nodes.runner.offsetWidth / 2) / (this._nodes.cont.offsetWidth - this._nodes.runner.offsetWidth) } g = Math.round((this.conf.max - this.conf.min) * c + this.conf.min); this.setValue(g, true) }; dhtmlXSlider.prototype._getCoord = function(a) { var g = this.conf; var c = (g.value - g.min) / (g.max - g.min); return Math.round(a * c) }; dhtmlXSlider.prototype._normalize = function(a) { a = parseInt(a); return Math.round(a / this.conf.step) * this.conf.step }; dhtmlXSlider.prototype._attachNode = function(c) { var a = c.tagName.toLowerCase(); if (!a) { return } this._attachedNode.node = c; switch (a) { case "input": if (typeof(window.addEventListener) == "function") { c.addEventListener("change", this._doOnChangeInput, false); c.addEventListener("keydown", this._doOnKeyDown, false) } else { c.attachEvent("onchange", this._doOnChangeInput); c.attachEvent("onkeydown", this._doOnKeyDown) } this._attachedNode.setValue = function(g) { c.value = g }; break; default: this._attachedNode.setValue = function(g) { c.innerHTML = g } } this._attachedNode.setValue(this.conf.value) }; dhtmlXSlider.prototype._detachNode = function() { var c = this._attachedNode.node; if (!c) { return } var a = c.tagName; switch (a) { case "input": if (typeof(window.addEventListener) == "function") { c.removeEventListener("change", this._doOnChangeInput, false); c.removeEventListener("keydown", this._doOnChangeInput, false) } else { c.detachEvent("change", this._doOnChangeInput); c.detachEvent("keydown", this._doOnChangeInput) } break } delete this._attachedNode.node; delete this._attachedNode.setValue }; dhtmlXSlider.prototype.setSize = function(a) { a = parseInt(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(l) { l = l.toLowerCase(); var g, c = -1, a, h = "dhtmlxslider"; g = this.base.className.match(/\S\w+/ig); if (g instanceof Array) { for (a in this._skinCollection) { if (c == -1) { c = this._indexOf(g, h + "_" + a) } else { break } } c = (c == -1) ? g.length : c } else { g = []; c = 0 } g[c] = h + "_" + l; this.base.className = g.join(" "); this.conf.skin = l; if (this._nodes) { this._refreshRunner() } }; dhtmlXSlider.prototype.setValue = function(a, c) { a = parseInt(a); c = c || false; if (!isNaN(a)) { a = this._normalize(a); a = Math.max(this.conf.min, a); a = Math.min(this.conf.max, a); if (this.conf.value !== a) { this.conf.value = a; this._refreshRunner(); if (this.conf.tooltip) { this._nodes.cont.title = this.conf.value } if (c) { this.callEvent("onChange", [this.conf.value, this]) } } } if (typeof(this._attachedNode.setValue) == "function") { this._attachedNode.setValue(this.conf.value) } }; dhtmlXSlider.prototype.getValue = function() { return this.conf.value }; dhtmlXSlider.prototype.disable = function(g) { g = (g == false) ? false : true; var c = null; if (g) { for (var a in this._nodes) { if (a == "cont") { continue } c = new RegExp("\\s?dhxsl_" + a + "_dis", "i"); if (!c.test(this._nodes[a].className)) { this._nodes[a].className += " dhxsl_" + a + "_dis" } } this.conf.disabled = true } else { this.enable() } }; dhtmlXSlider.prototype.enable = function() { var c; for (var a in this._nodes) { if (a == "cont") { continue } c = new RegExp("\\s?dhxsl_" + a + "_dis", "i"); if (c.test(this._nodes[a].className)) { this._nodes[a].className = this._nodes[a].className.replace(c, "") } } 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._nodes.cont.title = this.conf.value; this.conf.tooltip = true } else { this.disableTooltip() } }; dhtmlXSlider.prototype.setMax = function(a) { a = parseInt(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) { a = parseInt(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) { a = parseInt(a); var c = this.conf.max - this.conf.min; if (!isNaN(a) && a < c) { this.conf.step = a; 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 (typeof(a) == "string") { a = document.getElementById(a) } if (this._attachedNode.node) { this._detachNode() } this._attachNode(a) }; function dhtmlXPopup(g) { var h = this; this.conf = g || {}; g = null; this.mode = (this.conf.mode || "bottom"); this.conf.zi = window.dhx4.newId(); this.conf.isIE = (navigator.userAgent.indexOf("MSIE") >= 0); this.p = document.createElement("DIV"); this.p.style.display = "none"; this.p.innerHTML = "
"; document.body.appendChild(this.p); 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.onclick = function(l) { l = l || event; h._clearClick = true; if (h._nodeObj != null) { h.callEvent("onContentClick", []); return true } var a = (l.target || l.srcElement); var m = null; while (a != h.p && a != null) { if (typeof(a._idd) != "undefined" && !a._isSeparator) { m = a._idd; a = null } else { a = a.parentNode } } a = null; if (m != null) { h.callEvent("onClick", [m]); if (h != null && h.isVisible != null && h.isVisible() && h.callEvent("onBeforeHide", ["select", l, m]) === true) { l.cancelBubble = true; h.hide() } } }; this.separator = "DHXSEP_" + window.dhx4.newId(); this.tpl = []; this._setTemplate = function(a) { this.tpl = a.split(",") }; this.show = function(l) { var a = null; if (arguments.length == 1) { if (!l) { l = this.conf.id[0] } else { if (!this._idExists(l)) { return } } if (this.conf.toolbar) { a = this.conf.toolbar._getItemDim(l) } if (this.conf.ribbon) { a = this.conf.ribbon._getItemDim(l) } if (this.conf.form) { a = this.conf.form._getItemDim(l) } } else { if (arguments.length == 4) { this._clearClick = true; a = { left: arguments[0], top: arguments[1], width: arguments[2], height: arguments[3] }; l = 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 = l; this.callEvent("onShow", [l]) }; this._setPos = function(I, n) { 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 = n || this.mode; if (typeof(n) == "undefined") { n = 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 (!n && 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 m = u - r; var K = u - D - a; var q = u + a + D - this.p.offsetWidth; if (m < N.left - A) { m = Math.min(N.left - A, K) } else { if (m + this.p.offsetWidth > N.right + A) { m = Math.max(q, N.right + A - this.p.offsetWidth) } } this.p.style.left = m + "px"; this.p.style.top = (F == "top" ? s - this.p.offsetHeight : s + L) + "px"; u = u - m - 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 o = Math.round(this.p.offsetHeight / 2); var S = Math.round(this.p.lastChild.offsetHeight / 2); if (s < N.top) { var l = Math.min(s + L, N.top); L = s + L - l; s = l } if (s + L > N.bottom) { L = N.bottom - s } var u = Math.round(s + L / 2); var H = u - o; 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); window.setTimeout(function() { E.style.visibility = "visible"; E = null }, 1) } }; this._getAvailPos = function(s, r) { var m = { top: ["bottom", "right", "left"], bottom: ["top", "right", "left"], left: ["right", "bottom", "top"], right: ["left", "bottom", "top"] }; var n = null; for (var o = 0; o < m[s].length; o++) { if (n == null && r[m[s][o]] > 0) { n = m[s][o] } } if (n == null) { n = "bottom"; for (var l in r) { if (r[l] > r[n]) { n = l } } } if (n == s) { return false } return n }; this._repaint = function() { if (this.isVisible()) { this._setPos(this._posData) } }; this.clear = function() { if (this._nodeObj) { if (this.conf.isIE && typeof(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 l = 0; l < this._nodeObjEv.length; l++) { this.detachEvent(this._nodeObjEv[l]) } 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.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(m, u) { this._setTemplate(m); this.clear(); var n = this.p.firstChild.firstChild.firstChild; for (var s = 0; s < u.length; s++) { var o = document.createElement("TR"); if (u[s] != this.separator) { if (typeof(u[s].id) == "undefined" || u[s].id == null) { o._idd = window.dhx4.newId(); while (this.itemData[o._idd] != null) { o._idd = window.dhx4.newId() } } else { o._idd = u[s].id } this.itemData[o._idd] = u[s] } n.appendChild(o); if (u[s] == this.separator) { o.className = "dhx_popup_sep"; o._isSeparator = true; var v = document.createElement("TD"); v.className = "dhx_popup_sep"; v.colSpan = this.tpl.length; v.innerHTML = "
 
"; o.appendChild(v); v = null } else { for (var a = 0; a < this.tpl.length; a++) { var l = "dhx_popup_td"; if (this._IEFirstLast && (this.tpl.length == 1 || a == 0 || a == this.tpl.length - 1)) { if (this.tpl.length == 1) { l += " dhx_popup_td_single" } else { l += (a == 0 ? " dhx_popup_td_first" : " dhx_popup_td_last") } } var v = document.createElement("TD"); v.className = l; v.innerHTML = u[s][this.tpl[a]] || " "; o.appendChild(v); v = null } if (this._IEHover) { o._IEHover = true; if (!this._IEHoverInited) { this._IEHoverInit() } } } o = null } n = null; this._repaint() }; this._attachNode = function(n, m) { this.clear(); this._nodeId = "dhxpopup_node_" + window.dhx4.newId(); var a = this.p.firstChild.firstChild.firstChild; var l = document.createElement("TR"); l.className = "dhxnode"; a.appendChild(l); var o = document.createElement("TD"); o.className = "dhx_popup_td"; o.innerHTML = "
"; if (m.width) { o.firstChild.style.width = m.width + "px" } if (m.height) { o.firstChild.style.height = m.height + "px" } l.appendChild(o); o = l = a = null; if (typeof(this["_attach_init_" + n]) == "function") { this["_attach_init_" + n](m); this._enableIEVFix() } this._repaint(); return this._nodeObj }; this.unload = function() { if (typeof(window.addEventListener) == "function") { 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) } this.clear(); this._doOnClick = null; this._doOnUnload = null; this._doOnKeyUp = null; 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) { for (var a = 0; a < this.conf.slider_events.length; a++) { this.conf.slider.detachEvent(this.conf.slider_events[a]) } this.conf.slider_events = null; this._sliderShow = this._sliderHide = null; this.conf.slider = null } window.dhx4._eventable(this, "clear"); this.attachList = this.attachAccordion = this.attachCalendar = this.attachForm = this.attachGrid = this.attachLayout = this.attachTabbar = this.attachTree = this.attachHTML = this.attachObject = this._attachNode = null; this.show = this.hide = this.isVisible = this._setTemplate = this._repaint = this._setPos = this.getItemData = this.clear = this._idExists = this._doOnToolbarClick = this._doOnRibbonClick = this.setSkin = null; this.tpl = this.itemData = this.separator = this.mode = null; this._clearClick = this._lastId = this._posData = this.skinParams = this.skinParent = null; this.p.onclick = null; this.p.parentNode.removeChild(this.p); this.p = null; this.conf.toolbar = this.conf.toolbarEvent = this.conf.ribbon = this.conf.ribbonEvent = this.conf.form = this.conf.id = null; this.conf = null; this._IEHover = this._IEHoverTM = this._IEHoverInit = this._IEHoverClear = this._IEHoverRender = this._IEHoverInited = null; this._IEDisp = null; this.unload = null; h = null }; window.dhx4._eventable(this); this._doOnClick = function(o) { o = o || event; if (h._clearClick) { h._clearClick = false; return } if (h.conf.form != null) { var q; var l = (o.target || o.srcElement); if ((l.tagName || "").toLowerCase() == "option") { l = l.parentNode } if (l.className != null && l.className.search("dhxform") >= 0) { if (l.parentNode != null && l.parentNode.parentNode != null && l.parentNode.parentNode._idd != null) { q = l.parentNode.parentNode._idd; if (l.parentNode.parentNode._type == "ra") { q = [l.parentNode.parentNode._group, l.parentNode.parentNode._value] } } } else { var a = true; var m = false; while (a && !m) { var n = (l.className || "").toLowerCase(); if (n.length > 0) { m = (n == "dhxform_btn" || n.search(/dhxeditor_inside/gi) >= 0 || n == "dhxcombo_input" || n.search(/dhxcombolist/gi) >= 0) } l = l.parentNode; a = (l != null) } if (m) { return } } l = null; if (q != null && h._idExists(q)) { return } } if (h.isVisible() && h.callEvent("onBeforeHide", ["click", o]) === true) { h.hide() } }; this._doOnKeyUp = function(a) { a = a || event; if (a.keyCode == 27) { if (h.isVisible() && h.callEvent("onBeforeHide", ["esc", a]) === true) { h.hide() } } }; this._doOnUnload = function() { h.unload() }; if (typeof(window.addEventListener) == "function") { 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._idExists = function(m) { var a = false; for (var l = 0; l < this.conf.id.length; l++) { if (this.conf.id[l] instanceof Array) { a = a || (this.conf.id[l][0] == m[0] && this.conf.id[l][1] == m[1]) } else { a = a || this.conf.id[l] == m } } return a }; this._IEDisp = (this.conf.isIE && (navigator.userAgent.search("MSIE 6.0") >= 0 || document.compatMode != "CSS1Compat")); this._IEHover = (this.conf.isIE && navigator.userAgent.search("MSIE 6.0") >= 0); 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 (h._IEHoverTM) { window.clearTimeout(h._IEHoverTM) } if (h._lastIEHover == a) { return } h._IEHoverRender(a); a = null } }; this.p.onmouseout = function() { if (h._IEHoverTM) { window.clearTimeout(h._IEHoverTM) } h._IEHoverTM = window.setTimeout(function() { h._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"; h._lastIEHover = a } }; this._IEHoverInited = true }; this._IEHoverClear = function() { this.p.onmouseover = null; this.p.onmouseout = null; this._IEHoverInited = false } } this._IEFirstLast = (this.conf.isIE && navigator.userAgent.search(/MSIE [6,7,8]\.0/i) >= 0); this._enableIEVFix = function() { if (this.conf.isIE && navigator.userAgent.search("MSIE 6.0") >= 0) { var l = 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(l, 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(l) { for (var a = 0; a < h.conf.id.length; a++) { if (l == h.conf.id[a]) { if (l != h._lastId) { h.show(l); h._clearClick = true } } } }; if (typeof(dhtmlXToolbarObject.prototype._getItemDim) == "undefined") { dhtmlXToolbarObject.prototype._getItemDim = function(m) { var a = this.objPull[this.idPrefix + m]; var l = { 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 l } } 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(l) { for (var a = 0; a < h.conf.id.length; a++) { if (l == h.conf.id[a]) { if (l != h._lastId) { h.show(l); h._clearClick = true } } } }; if (typeof(dhtmlXRibbon.prototype._getItemDim) == "undefined") { dhtmlXRibbon.prototype._getItemDim = function(m) { var a = this._items[m].base; var l = { left: window.dhx4.absLeft(a), top: window.dhx4.absTop(a), width: a.offsetWidth, height: a.offsetHeight }; a = null; return l } } 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, l) { 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(l) { var a = l; if ({ ta: true, pw: true, se: true, calendar: true, colorpicker: 1, editor: true }[l._type]) { a = l.childNodes[l._ll ? 1 : 0].childNodes[0] } if ({ ch: true, ra: true, btn2state: true }[l._type]) { a = l.childNodes[l._ll ? 1 : 0].childNodes[1] } if ({ bt: true }[l._type]) { a = l.firstChild } if ({ combo: true }[l._type]) { a = l._combo.DOMParent.firstChild } var m = { left: window.dhx4.absLeft(a), top: window.dhx4.absTop(a), width: a.offsetWidth, height: a.offsetHeight }; a = null; return m } } } } } 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 (h.conf.slider_tm) { window.clearTimeout(h.conf.slider_tm) } var a = h.conf.slider._nodes.runner; var l = { left: window.dhx4.absLeft(a), top: window.dhx4.absTop(a), width: a.offsetWidth, height: a.offsetHeight }; h.show(l.left, l.top, l.width, l.height) }; this._sliderHide = function() { h.conf.slider_tm = window.setTimeout(function() { h.hide() }, 200) }; this.conf.slider_events = [this.conf.slider.attachEvent("_onRunnerMouseDown", this._sliderShow), this.conf.slider.attachEvent("_onRunnerMouseUp", 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(a) { return this._attachNode("form", { struct: 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 }) }; dhtmlXPopup.prototype.attachCalendar = function() { return this._attachNode("calendar", {}) }; dhtmlXPopup.prototype._attach_init_calendar = function(a) { 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(g, c, a) { return this._attachNode("tree", { width: g || 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, g) { return this._attachNode("layout", { width: c || 400, height: a || 200, pattern: g || "3L" }) }; dhtmlXPopup.prototype._attach_init_layout = function(a) { this._nodeObj = new dhtmlXLayoutObject(this._nodeId, a.pattern, this.conf.skin) }; dhtmlXPopup.prototype.attachAccordion = function(g, a, c) { return this._attachNode("accordion", { width: g || 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(g, a, c) { if (typeof(c) == "string") { c = { mode: c } } else { if (typeof(c) != "object" || c == null) { c = {} } } return this._attachNode("tabbar", { width: g || 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.attachEditor = function(g, a, c) { return this._attachNode("editor", { width: g || 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) }; function dhtmlXMenuObject(l, m) { var h = this; this.conf = { skin: (m || 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, 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(l) == "object" && l != null && typeof(l.tagName) == "undefined") { if (l.icons_path != null || l.icon_path != null) { this.conf.icons_path = (l.icons_path || l.icon_path) } if (l.skin != null) { this.conf.skin = l.skin } if (l.visible_area) { this.conf.v_enabled = true; this.conf.v = { x1: l.visible_area.x1, x2: l.visible_area.x2, y1: l.visible_area.y1, y2: l.visible_area.y2 } } for (var g 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 (l[g] != null) { this.conf.autoload[g] = l[g] } } l = l.parent } if (l == null) { this.base = document.body } else { var c = (typeof(l) == "string" ? document.getElementById(l) : l); if (c != null) { this.base = c; if (!this.base.id) { this.base.id = (new Date()).valueOf() } 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(o) { var q = this.conf.skin; this.conf.skin = o; 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_" + q + "_Middle", "") + " dhtmlxMenu_" + this.conf.skin + "_Middle" } for (var n in this.idPull) { this.idPull[n].className = String(this.idPull[n].className).replace(q, this.conf.skin) } }; this.setSkin(this.conf.skin); this._addSubItemToSelected = function(o, n) { var a = true; 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)) { a = false } } if (a == true) { this.conf.selected_sub.push(new Array(o, n)) } return a }; this._removeSubItemFromSelected = function(r, o) { var a = new Array(); var n = false; for (var s = 0; s < this.conf.selected_sub.length; s++) { if ((this.conf.selected_sub[s][0] == r) && (this.conf.selected_sub[s][1] == o)) { n = true } else { a[a.length] = this.conf.selected_sub[s] } } if (n == true) { this.conf.selected_sub = a } return n }; this._getSubItemToDeselectByPolygon = function(r) { var a = new Array(); for (var s = 0; s < this.conf.selected_sub.length; s++) { if (this.conf.selected_sub[s][1] == r) { a[a.length] = this.conf.selected_sub[s][0]; a = a.concat(this._getSubItemToDeselectByPolygon(this.conf.selected_sub[s][0])); var o = true; for (var n = 0; n < this.conf.opened_poly.length; n++) { if (this.conf.opened_poly[n] == this.conf.selected_sub[s][0]) { o = false } } if (o == true) { this.conf.opened_poly[this.conf.opened_poly.length] = this.conf.selected_sub[s][0] } this.conf.selected_sub[s][0] = -1; this.conf.selected_sub[s][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(I, o) { var N = this._countVisiblePolygonItems(I); if (N == 0) { return } var J = "polygon_" + I; if ((this.idPull[J] != null) && (this.idPull[I] != null)) { if (this.conf.top_mode && this.conf.mode == "web" && !this.conf.context) { if (!this.idPull[I]._mouseOver && o == this.conf.dir_toplv) { return } } if (!this.conf.fixed_pos) { this._autoDetectVisibleArea() } var K = 0; var M = 0; var P = null; var E = null; if (this.idPull[J]._zId == null) { this.idPull[J]._zId = window.dhx4.newId() } this.idPull[J]._zInd = window.dhx4.zim.reserve(this.idPull[J]._zId); this.idPull[J].style.visibility = "hidden"; this.idPull[J].style.left = "0px"; this.idPull[J].style.top = "0px"; this.idPull[J].style.display = ""; this.idPull[J].style.zIndex = this.idPull[J]._zInd; if (this.conf.auto_overflow) { if (this.idPull[J].firstChild.offsetHeight > this.conf.v.y1 + this.conf.v.y2) { var D = Math.floor((this.conf.v.y2 - this.conf.v.y1 - 35) / 24); this.conf.overflow_limit = D } else { this.conf.overflow_limit = 0; if (this.idPull["arrowup_" + I] != null) { this._removeUpArrow(String(I).replace(this.idPrefix, "")) } if (this.idPull["arrowdown_" + I] != null) { this._removeDownArrow(String(I).replace(this.idPrefix, "")) } } } if (this.conf.overflow_limit > 0 && this.conf.overflow_limit < N) { if (this.idPull["arrowup_" + I] == null) { this._addUpArrow(String(I).replace(this.idPrefix, "")) } if (this.idPull["arrowdown_" + I] == null) { this._addDownArrow(String(I).replace(this.idPrefix, "")) } P = this.idPull["arrowup_" + I]; P.style.display = "none"; E = this.idPull["arrowdown_" + I]; E.style.display = "none" } if (this.conf.overflow_limit > 0) { if (this.conf.overflow_limit < N) { this.idPull[J].childNodes[1].style.height = 24 * this.conf.overflow_limit + "px"; P.style.width = E.style.width = this.idPull[J].childNodes[1].style.width = this.idPull[J].childNodes[1].childNodes[0].offsetWidth + "px"; this.idPull[J].childNodes[1].scrollTop = 0; P.style.display = ""; K = P.offsetHeight; E.style.display = ""; M = E.offsetHeight } else { this.idPull[J].childNodes[1].style.height = ""; this.idPull[J].childNodes[1].style.width = "" } } if (this.itemPull[I] != null) { var A = "polygon_" + this.itemPull[I]["parent"] } else { if (this.conf.context) { var A = this.idPull[this.idPrefix + this.topId] } } var a = (this.idPull[I].tagName != null ? window.dhx4.absLeft(this.idPull[I]) : this.idPull[I][0]); var O = (this.idPull[I].tagName != null ? window.dhx4.absTop(this.idPull[I]) : this.idPull[I][1]); var n = (this.idPull[I].tagName != null ? this.idPull[I].offsetWidth : 0); var q = (this.idPull[I].tagName != null ? this.idPull[I].offsetHeight : 0); var v = 0; var u = 0; var C = this.idPull[J].offsetWidth; var L = this.idPull[J].childNodes[1].offsetHeight + K + M; if (o == "bottom") { if (this.conf.rtl) { v = a + (n != null ? n : 0) - C } else { if (this.conf.align == "right") { v = a + n - C } else { v = a - 1 + (o == this.conf.dir_toplv ? this.conf.tl_rmarg : 0) } } u = O - 1 + q + this.conf.tl_botmarg } if (o == "right") { v = a + n - 1; u = O + 2 } if (o == "left") { v = a - this.idPull[J].offsetWidth + 2; u = O + 2 } if (o == "top") { v = a - 1; u = O - L + 2 } if (this.conf.fixed_pos) { var H = 65536; var F = 65536 } else { var H = (this.conf.v.x2 != null ? this.conf.v.x2 : 0); var F = (this.conf.v.y2 != null ? this.conf.v.y2 : 0); if (H == 0) { if (window.innerWidth) { H = window.innerWidth; F = window.innerHeight } else { H = document.body.offsetWidth; F = document.body.scrollHeight } } } if (v + C > H && !this.conf.rtl) { v = a - C + 2 } if (v < this.conf.v.x1 && this.conf.rtl) { v = a + n - 2 } if (v < 0) { v = 0 } if (u + L > F && this.conf.v.y2 != null) { u = Math.max(O + q - L + 2, (this.conf.v_enabled ? this.conf.v.y1 + 2 : 2)); if (this.conf.context && this.idPrefix + this.topId == I && E != null) { u = u - 2 } if (this.itemPull[I] != null && !this.conf.context) { if (this.itemPull[I]["parent"] == this.idPrefix + this.topId) { u = u - this.base.offsetHeight } } } this.idPull[J].style.left = v + "px"; this.idPull[J].style.top = u + "px"; if (typeof(this._menuEffect) != "undefined" && this._menuEffect !== false) { this._showPolygonEffect(J) } else { this.idPull[J].style.visibility = ""; if (this.conf.overflow_limit > 0 && this.conf.overflow_limit < N) { this.idPull[J].childNodes[1].scrollTop = 0; this._checkArrowsState(I) } if (window.dhx4.isIE6) { var s = J + "_ie6cover"; if (this.idPull[s] == null) { var r = document.createElement("IFRAME"); r.className = "dhtmlxMenu_IE6CoverFix_" + this.conf.skin; r.frameBorder = 0; r.setAttribute("src", "javascript:false;"); document.body.insertBefore(r, document.body.firstChild); this.idPull[s] = r } this.idPull[s].style.left = v + "px"; this.idPull[s].style.top = u + "px"; this.idPull[s].style.width = this.idPull[J].offsetWidth + "px"; this.idPull[s].style.height = this.idPull[J].offsetHeight + "px"; this.idPull[s].style.zIndex = this.idPull[J].style.zIndex - 1; this.idPull[s].style.display = "" } } I = String(I).replace(this.idPrefix, ""); if (I == this.topId) { I = null } this.callEvent("onShow", [I]); if (I != null && this.conf.skin == "dhx_terrace" && this.itemPull[this.idPrefix + I].parent == this.idPrefix + this.topId) { this._improveTerraceButton(this.idPrefix + I, false) } } }; this._redistribSubLevelSelection = function(s, r) { while (this.conf.opened_poly.length > 0) { this.conf.opened_poly.pop() } var a = this._getSubItemToDeselectByPolygon(r); this._removeSubItemFromSelected(-1, -1); for (var n = 0; n < a.length; n++) { if ((this.idPull[a[n]] != null) && (a[n] != s)) { if (this.itemPull[a[n]]["state"] == "enabled") { this.idPull[a[n]].className = "sub_item" } } } for (var n = 0; n < this.conf.opened_poly.length; n++) { if (this.conf.opened_poly[n] != r) { this._hidePolygon(this.conf.opened_poly[n]) } } if (this.itemPull[s]["state"] == "enabled") { this.idPull[s].className = "sub_item_selected"; if (this.itemPull[s]["complex"] && this.conf.dload && (this.itemPull[s]["loaded"] == "no")) { if (this.conf.dload_icon == true) { this._updateLoaderIcon(s, true) } this.itemPull[s].loaded = "get"; var o = s.replace(this.idPrefix, ""); this._dhxdataload.onBeforeXLS = function() { var u = { params: {} }; u.params[this.conf.dload_pid] = o; for (var q in this.conf.dload_params) { u.params[q] = this.conf.dload_params[q] } return u }; this.loadStruct(this.conf.dload_url) } if (this.itemPull[s]["complex"] || (this.conf.dload && (this.itemPull[s]["loaded"] == "yes"))) { if ((this.itemPull[s]["complex"]) && (this.idPull["polygon_" + s] != null)) { this._updateItemComplexState(s, true, true); this._showPolygon(s, this.conf.dir_sublv) } } this._addSubItemToSelected(s, r); this.conf.selected = s } }; this._doOnClick = function(n, x, r) { this.conf.last_click = n; if (this.itemPull[this.idPrefix + n]["href_link"] != null && this.itemPull[this.idPrefix + n].state == "enabled") { var s = document.createElement("FORM"); var v = String(this.itemPull[this.idPrefix + n]["href_link"]).split("?"); s.action = v[0]; if (v[1] != null) { var o = String(v[1]).split("&"); for (var a = 0; a < o.length; a++) { var w = String(o[a]).split("="); var u = document.createElement("INPUT"); u.type = "hidden"; u.name = (w[0] || ""); u.value = (w[1] || ""); s.appendChild(u) } } if (this.itemPull[this.idPrefix + n]["href_target"] != null) { s.target = this.itemPull[this.idPrefix + n]["href_target"] } s.style.display = "none"; document.body.appendChild(s); s.submit(); if (s != null) { document.body.removeChild(s); s = null } return } if (x.charAt(0) == "c") { return } if (x.charAt(1) == "d") { return } if (x.charAt(2) == "s") { return } if (this.checkEvent("onClick")) { this.callEvent("onClick", [n, this.conf.ctx_zoneid, r]) } else { if ((x.charAt(1) == "d") || (this.conf.mode == "win" && x.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(o, s) { var a = new Array(); for (var r = 0; r < s.length; r++) { if (typeof(s[r]) == "object") { if (s[r].length == 5) { if (typeof(s[r][0]) != "object") { if ((s[r][0].replace(this.idPrefix, "") == o) && (r == 0)) { a = s } } } var n = this._searchMenuNode(o, s[r]); if (n.length > 0) { a = n } } } return a }; this._getMenuNodes = function(q) { var n = new Array; for (var o in this.itemPull) { if (this.itemPull[o]["parent"] == q) { n[n.length] = o } } return n }; this._genStr = function(a) { var n = ""; var r = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for (var o = 0; o < a; o++) { n += r.charAt(Math.round(Math.random() * (r.length - 1))) } return n }; this.getItemType = function(a) { a = this.idPrefix + a; if (this.itemPull[a] == null) { return null } return this.itemPull[a]["type"] }; this.forEachItem = function(o) { for (var n in this.itemPull) { o(String(n).replace(this.idPrefix, "")) } }; this._clearAndHide = function() { h.conf.selected = -1; h.conf.last_click = -1; while (h.conf.opened_poly.length > 0) { h.conf.opened_poly.pop() } for (var a = 0; a < h.conf.selected_sub.length; a++) { var n = h.conf.selected_sub[a][0]; if (h.idPull[n] != null) { if (h.itemPull[n]["state"] == "enabled") { if (h.idPull[n].className == "sub_item_selected") { h.idPull[n].className = "sub_item" } if (h.idPull[n].className == "dhtmlxMenu_" + h.conf.skin + "_TopLevel_Item_Selected") { if (h.itemPull[n]["cssNormal"] != null) { h.idPull[n].className = h.itemPull[n]["cssNormal"] } else { h.idPull[n].className = "dhtmlxMenu_" + h.conf.skin + "_TopLevel_Item_Normal" } } } } h._hidePolygon(n) } h.conf.is_touched = false; if (h.conf.context && h.conf.ctx_hideall) { h._hidePolygon(h.idPrefix + h.topId) } }; this._showSubLevelItem = function(n, a) { if (document.getElementById("arrow_" + this.idPrefix + n) != null) { document.getElementById("arrow_" + this.idPrefix + n).style.display = (a ? "none" : "") } if (document.getElementById("image_" + this.idPrefix + n) != null) { document.getElementById("image_" + this.idPrefix + n).style.display = (a ? "none" : "") } if (document.getElementById(this.idPrefix + n) != null) { document.getElementById(this.idPrefix + n).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 (h.conf.context) { if (h.conf.ctx_autohide && (!window.dhx4.isOpera || (h._isContextMenuVisible() && window.dhx4.isOpera))) { h._hideContextMenu() } } else { if (h._clearAndHide) { h._clearAndHide() } } }; this._bodyContext = function(o) { o = o || event; var n = String((o.srcElement || o.target).className); if (n.search("dhtmlxMenu") != -1 && n.search("SubLevelArea") != -1) { return } var a = true; var q = o.target || o.srcElement; while (q != null) { if (q.id != null) { if (h.isContextZone(q.id)) { a = false } } if (q == document.body) { a = false } q = q.parentNode } if (a) { h.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 (o) {} 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 n in this.conf.ctx_zones) { this.removeContextZone(n) } } if (this.cont != null) { this.cont.className = ""; this.cont.parentNode.removeChild(this.cont); this.cont = null } if (this.base != null) { this.base.className = ""; if (!this.conf.context) { this.base.oncontextmenu = (this.base._oldContextMenuHandler || null) } this.base.onselectstart = null; this.base = null } for (var n in this) { this[n] = null } h = 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 g in { onclick: 1, oncheckboxclick: 1, onradioclick: 1 }) { if (this.conf.autoload[g] != null) { if (typeof(this.conf.autoload[g]) == "function") { this.attachEvent(g, this.conf.autoload[g]) } else { if (typeof(window[this.conf.autoload[g]]) == "function") { this.attachEvent(g, window[this.conf.autoload[g]]) } } } } 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 g in this.conf.autoload) { this.conf.autoload[g] = null; delete this.conf.autoload[g] } this.conf.autoload = null; return this } dhtmlXMenuObject.prototype._init = function() { if (this._isInited == true) { return } if (this.conf.dload) { this._dhxdataload.onBeforeXLS = function() { var g = { params: {} }; for (var c in this.conf.dload_params) { g.params[c] = this.conf.dload_params[c] } return g }; this.loadStruct(this.conf.dload_url) } else { this._initTopLevelMenu(); this._isInited = true } }; dhtmlXMenuObject.prototype._countVisiblePolygonItems = function(m) { var h = 0; for (var c in this.itemPull) { var g = this.itemPull[c]["parent"]; var l = this.itemPull[c]["type"]; if (this.idPull[c] != null) { if (g == m && (l == "item" || l == "radio" || l == "checkbox") && this.idPull[c].style.display != "none") { h++ } } } return h }; 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(l, g, h) { if ((!this.conf.context) && (this._getItemLevelType(l.replace(this.idPrefix, "")) == "TopLevel")) { this.itemPull[l]["complex"] = g; return } if ((this.idPull[l] == null) || (this.itemPull[l] == null)) { return } this.itemPull[l]["complex"] = g; if (l == this.idPrefix + this.topId) { return } var a = null; var c = this.idPull[l].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[l]["complex"]) { if (a == null) { a = document.createElement("DIV"); a.className = "complex_arrow"; a.id = "arrow_" + l; while (c.childNodes.length > 0) { c.removeChild(c.childNodes[0]) } c.appendChild(a) } if (this.conf.dload && (this.itemPull[l].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[l]["complex"]) && (a != null)) { c.removeChild(a); if (this.itemPull[l]["hotkey_backup"] != null && this.setHotKey) { this.setHotKey(l.replace(this.idPrefix, ""), this.itemPull[l]["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 l = (this.itemPull[g]["parent"] == this.idPrefix + this.topId && !this.conf.context); var m = null; if (l) { for (var a = 0; a < this.idPull[g].childNodes.length; a++) { try { if (this.idPull[g].childNodes[a].className == "dhtmlxMenu_TopLevel_Item_Icon") { m = this.idPull[g].childNodes[a] } } catch (n) {} } } else { try { var m = this.idPull[g].childNodes[this.conf.rtl ? 2 : 0].childNodes[0] } catch (n) {} if (!(m != null && typeof(m.className) != "undefined" && m.className == "sub_icon")) { m = null } } if (this.itemPull[g]["type"] == "radio") { var r = this.itemPull[g][(this.itemPull[g]["state"] == "enabled" ? "imgen" : "imgdis")] } else { var r = this.itemPull[g][(this.itemPull[g]["state"] == "enabled" ? "imgen" : "imgdis")] } if (r.length > 0) { if (m != null) { m.src = this.conf.icons_path + r } else { if (l) { var m = document.createElement("IMG"); m.className = "dhtmlxMenu_TopLevel_Item_Icon"; m.src = this.conf.icons_path + r; m.border = "0"; m.id = "image_" + g; if (!this.conf.rtl && this.idPull[g].childNodes.length > 0) { this.idPull[g].insertBefore(m, this.idPull[g].childNodes[0]) } else { this.idPull[g].appendChild(m) } } else { var m = document.createElement("IMG"); m.className = "sub_icon"; m.src = this.conf.icons_path + r; m.border = "0"; m.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(m) } } } else { if (m != null) { var c = m.parentNode; c.removeChild(m); c.innerHTML = " "; c = m = null } } }; dhtmlXMenuObject.prototype._getAllParents = function(m) { var g = new Array(); for (var c in this.itemPull) { if (this.itemPull[c]["parent"] == m) { g[g.length] = this.itemPull[c]["id"]; if (this.itemPull[c]["complex"]) { var h = this._getAllParents(this.itemPull[c]["id"]); for (var l = 0; l < h.length; l++) { g[g.length] = h[l] } } } } return g }; 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(l) { l = this.idPrefix + l; var h = -1; if (this.itemPull[l] == null) { return h } var a = this.itemPull[l]["parent"]; var g = (this.idPull["polygon_" + a] != null ? this.idPull["polygon_" + a].tbd : this.cont); for (var c = 0; c < g.childNodes.length; c++) { if (g.childNodes[c] == this.idPull["separator_" + l] || g.childNodes[c] == this.idPull[l]) { h = c } } return h }; dhtmlXMenuObject.prototype.setItemPosition = function(n, m) { n = this.idPrefix + n; if (this.idPull[n] == null) { return } var c = (this.itemPull[n]["parent"] == this.idPrefix + this.topId); var a = this.idPull[n]; var h = this.getItemPosition(n.replace(this.idPrefix, "")); var g = this.itemPull[n]["parent"]; var l = (this.idPull["polygon_" + g] != null ? this.idPull["polygon_" + g].tbd : this.cont); l.removeChild(l.childNodes[h]); if (m < 0) { m = 0 } if (c && m < 1) { m = 1 } if (m < l.childNodes.length) { l.insertBefore(a, l.childNodes[m]) } else { l.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(h, c) { var a = this._getSubItemToDeselectByPolygon("parent"); this._removeSubItemFromSelected(-1, -1); for (var g = 0; g < a.length; g++) { if (a[g] != h) { this._hidePolygon(a[g]) } if ((this.idPull[a[g]] != null) && (a[g] != h)) { this.idPull[a[g]].className = this.idPull[a[g]].className.replace(/Selected/g, "Normal") } } if (this.itemPull[this.idPrefix + h]["state"] == "enabled") { this.idPull[this.idPrefix + h].className = "dhtmlxMenu_" + this.conf.skin + "_TopLevel_Item_Selected"; this._addSubItemToSelected(this.idPrefix + h, "parent"); this.conf.selected = (this.conf.mode == "win" ? (this.conf.selected != -1 ? h : this.conf.selected) : h); if ((this.itemPull[this.idPrefix + h]["complex"]) && (this.conf.selected != -1)) { this._showPolygon(this.idPrefix + h, 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(o, n) { var l = this; var a = document.createElement("DIV"); a.id = o; if (this.itemPull[o]["state"] == "enabled" && this.itemPull[o]["cssNormal"] != null) { a.className = this.itemPull[o]["cssNormal"] } else { a.className = "dhtmlxMenu_" + this.conf.skin + "_TopLevel_Item_" + (this.itemPull[o]["state"] == "enabled" ? "Normal" : "Disabled") } if (this.itemPull[o]["title"] != "") { var h = document.createElement("DIV"); h.className = "top_level_text"; h.innerHTML = this.itemPull[o]["title"]; a.appendChild(h) } if (this.itemPull[o]["tip"].length > 0) { a.title = this.itemPull[o]["tip"] } if ((this.itemPull[o]["imgen"] != "") || (this.itemPull[o]["imgdis"] != "")) { var g = this.itemPull[o][(this.itemPull[o]["state"] == "enabled") ? "imgen" : "imgdis"]; if (g) { var c = document.createElement("IMG"); c.border = "0"; c.id = "image_" + o; c.src = this.conf.icons_path + g; 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 (n != null) { n++; if (n < 0) { n = 0 } if (n > this.cont.childNodes.length - 1) { n = null } } if (n != null) { this.cont.insertBefore(a, this.cont.childNodes[n]) } else { this.cont.appendChild(a) } this.idPull[a.id] = a; if (this.itemPull[o]["complex"] && (!this.conf.dload)) { this._addSubMenuPolygon(this.itemPull[o]["id"], this.itemPull[o]["id"]) } a.onmouseover = function() { if (l.conf.mode == "web") { window.clearTimeout(l.conf.tm_handler) } var m = l._getSubItemToDeselectByPolygon("parent"); l._removeSubItemFromSelected(-1, -1); for (var s = 0; s < m.length; s++) { if (m[s] != this.id) { l._hidePolygon(m[s]) } if ((l.idPull[m[s]] != null) && (m[s] != this.id)) { if (l.itemPull[m[s]]["cssNormal"] != null) { l.idPull[m[s]].className = l.itemPull[m[s]]["cssNormal"] } else { if (l.idPull[m[s]].className == "sub_item_selected") { l.idPull[m[s]].className = "sub_item" } l.idPull[m[s]].className = l.idPull[m[s]].className.replace(/Selected/g, "Normal") } } } if (l.itemPull[this.id]["state"] == "enabled") { this.className = "dhtmlxMenu_" + l.conf.skin + "_TopLevel_Item_Selected"; l._addSubItemToSelected(this.id, "parent"); l.conf.selected = (l.conf.mode == "win" ? (l.conf.selected != -1 ? this.id : l.conf.selected) : this.id); if (l.conf.dload) { if (l.itemPull[this.id].loaded == "no") { this._dynLoadTM = new Date().getTime(); l.itemPull[this.id].loaded = "get"; var u = this.id.replace(l.idPrefix, ""); l._dhxdataload.onBeforeXLS = function() { var v = { params: {} }; v.params[this.conf.dload_pid] = u; for (var q in this.conf.dload_params) { v.params[q] = this.conf.dload_params[q] } return v }; l.loadStruct(l.conf.dload_url) } if (l.conf.top_mode && l.conf.mode == "web" && !l.conf.context) { this._mouseOver = true } } if ((!l.conf.dload) || (l.conf.dload && (!l.itemPull[this.id]["loaded"] || l.itemPull[this.id]["loaded"] == "yes"))) { if ((l.itemPull[this.id]["complex"]) && (l.conf.selected != -1)) { if (l.conf.top_mode && l.conf.mode == "web" && !l.conf.context) { this._mouseOver = true; var r = this.id; this._menuOpenTM = window.setTimeout(function() { l._showPolygon(r, l.conf.dir_toplv) }, l.conf.top_tmtime) } else { l._showPolygon(this.id, l.conf.dir_toplv) } } } } l._doOnTouchMenu(this.id.replace(l.idPrefix, "")) }; a.onmouseout = function() { if (!((l.itemPull[this.id]["complex"]) && (l.conf.selected != -1)) && (l.itemPull[this.id]["state"] == "enabled")) { if (l.itemPull[this.id]["cssNormal"] != null) { a.className = l.itemPull[this.id]["cssNormal"] } else { a.className = "dhtmlxMenu_" + l.conf.skin + "_TopLevel_Item_Normal" } } if (l.conf.mode == "web") { window.clearTimeout(l.conf.tm_handler); l.conf.tm_handler = window.setTimeout(function() { l._clearAndHide() }, l.conf.tm_sec, "JavaScript") } if (l.conf.top_mode && l.conf.mode == "web" && !l.conf.context) { this._mouseOver = false; window.clearTimeout(this._menuOpenTM) } }; a.onclick = function(u) { if (l.conf.mode == "web") { window.clearTimeout(l.conf.tm_handler) } if (l.conf.mode != "web" && l.itemPull[this.id]["state"] == "disabled") { return } u = u || event; u.cancelBubble = true; if (u.preventDefault) { u.preventDefault() } else { u.returnValue = false } if (l.conf.mode == "win") { if (l.itemPull[this.id]["complex"]) { if (l.conf.selected == this.id) { l.conf.selected = -1; var r = false } else { l.conf.selected = this.id; var r = true } if (r) { l._showPolygon(this.id, l.conf.dir_toplv) } else { l._hidePolygon(this.id) } } } var m = (l.itemPull[this.id]["complex"] ? "c" : "-"); var v = (l.itemPull[this.id]["state"] != "enabled" ? "d" : "-"); var q = { ctrl: u.ctrlKey, alt: u.altKey, shift: u.shiftKey }; l._doOnClick(this.id.replace(l.idPrefix, ""), m + v + "t", q); return false }; if (this.conf.skin == "dhx_terrace") { this._improveTerraceSkin() } }; dhtmlXMenuObject.prototype._addSubMenuPolygon = function(m, l) { var c = this._renderSublevelPolygon(m, l); var a = this._getMenuNodes(l); for (g = 0; g < a.length; g++) { if (this.itemPull[a[g]]["type"] == "separator") { this._renderSeparator(a[g], null) } else { this._renderSublevelItem(a[g], null) } } if (m == l) { var h = "topLevel" } else { var h = "subLevel" } for (var g = 0; g < a.length; g++) { if (this.itemPull[a[g]]["complex"]) { this._addSubMenuPolygon(m, this.itemPull[a[g]]["id"]) } } }; dhtmlXMenuObject.prototype._renderSublevelPolygon = function(l, h) { var c = document.createElement("DIV"); c.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_Polygon " + (this.conf.rtl ? "dir_right" : ""); c.dir = "ltr"; c.oncontextmenu = function(m) { m = m || event; if (m.preventDefault) { m.preventDefault() } else { m.returnValue = false } m.cancelBubble = true; return false }; c.id = "polygon_" + h; c.onclick = function(m) { m = m || event; m.cancelBubble = true }; c.style.display = "none"; document.body.insertBefore(c, document.body.firstChild); c.innerHTML = '
'; var g = document.createElement("TABLE"); g.className = "dhtmlxMebu_SubLevelArea_Tbl"; g.cellSpacing = 0; g.cellPadding = 0; g.border = 0; var a = document.createElement("TBODY"); g.appendChild(a); c.childNodes[1].appendChild(g); c.tbl = g; c.tbd = a; this.idPull[c.id] = c; if (this.sxDacProc != null) { this.idPull["sxDac_" + h] = new this.sxDacProc(c, c.className); if (window.dhx4.isIE) { this.idPull["sxDac_" + h]._setSpeed(this.dacSpeedIE); this.idPull["sxDac_" + h]._setCustomCycle(this.dacCyclesIE) } else { this.idPull["sxDac_" + h]._setSpeed(this.dacSpeed); this.idPull["sxDac_" + h]._setCustomCycle(this.dacCycles) } } return c }; dhtmlXMenuObject.prototype._renderSublevelItem = function(a, r) { var o = this; var q = document.createElement("TR"); q.className = (this.itemPull[a]["state"] == "enabled" ? "sub_item" : "sub_item_dis"); var n = document.createElement("TD"); n.className = "sub_item_icon"; var s = this.itemPull[a][(this.itemPull[a]["state"] == "enabled" ? "imgen" : "imgdis")]; if (s != "") { var w = this.itemPull[a]["type"]; if (w == "checkbox" || w == "radio") { var l = document.createElement("DIV"); l.id = "image_" + this.itemPull[a]["id"]; l.className = "sub_icon " + s; n.appendChild(l) } if (!(w == "checkbox" || w == "radio")) { var l = document.createElement("IMG"); l.id = "image_" + this.itemPull[a]["id"]; l.className = "sub_icon"; l.src = this.conf.icons_path + s; n.appendChild(l) } } else { n.innerHTML = " " } var m = document.createElement("TD"); m.className = "sub_item_text"; if (this.itemPull[a]["title"] != "") { var v = document.createElement("DIV"); v.className = "sub_item_text"; v.innerHTML = this.itemPull[a]["title"]; m.appendChild(v) } else { m.innerHTML = " " } var h = document.createElement("TD"); h.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"]; h.appendChild(c) } else { if (this.itemPull[a]["hotkey"].length > 0 && !this.itemPull[a]["complex"]) { var g = document.createElement("DIV"); g.className = "sub_item_hk"; g.innerHTML = this.itemPull[a]["hotkey"]; h.appendChild(g) } else { h.innerHTML = " " } } q.appendChild(this.conf.rtl ? h : n); q.appendChild(m); q.appendChild(this.conf.rtl ? n : h); q.id = this.itemPull[a]["id"]; q.parent = this.itemPull[a]["parent"]; if (this.itemPull[a]["tip"].length > 0) { q.title = this.itemPull[a]["tip"] } q.onselectstart = function(x) { x = x || event; if (x.preventDefault) { x.preventDefault() } else { x.returnValue = false } return false }; q.onmouseover = function(x) { if (o.conf.hide_tm[this.id]) { window.clearTimeout(o.conf.hide_tm[this.id]) } if (o.conf.mode == "web") { window.clearTimeout(o.conf.tm_handler) } if (!this._visible) { o._redistribSubLevelSelection(this.id, this.parent) } this._visible = true }; q.onmouseout = function() { if (o.conf.mode == "web") { if (o.conf.tm_handler) { window.clearTimeout(o.conf.tm_handler) } o.conf.tm_handler = window.setTimeout(function() { if (o && o._clearAndHide) { o._clearAndHide() } }, o.conf.tm_sec, "JavaScript") } var x = this; if (o.conf.hide_tm[this.id]) { window.clearTimeout(o.conf.hide_tm[this.id]) } o.conf.hide_tm[this.id] = window.setTimeout(function() { x._visible = false }, 50) }; q.onclick = function(y) { if (!o.checkEvent("onClick") && o.itemPull[this.id]["complex"]) { return } y = y || event; y.cancelBubble = true; if (y.preventDefault) { y.preventDefault() } else { y.returnValue = false } tc = (o.itemPull[this.id]["complex"] ? "c" : "-"); td = (o.itemPull[this.id]["state"] == "enabled" ? "-" : "d"); var x = { ctrl: y.ctrlKey, alt: y.altKey, shift: y.shiftKey }; switch (o.itemPull[this.id]["type"]) { case "checkbox": o._checkboxOnClickHandler(this.id.replace(o.idPrefix, ""), tc + td + "n", x); break; case "radio": o._radioOnClickHandler(this.id.replace(o.idPrefix, ""), tc + td + "n", x); break; case "item": o._doOnClick(this.id.replace(o.idPrefix, ""), tc + td + "n", x); break } return false }; var u = this.idPull["polygon_" + this.itemPull[a]["parent"]]; if (r != null) { r++; if (r < 0) { r = 0 } if (r > u.tbd.childNodes.length - 1) { r = null } } if (r != null && u.tbd.childNodes[r] != null) { u.tbd.insertBefore(q, u.tbd.childNodes[r]) } else { u.tbd.appendChild(q) } this.idPull[q.id] = q }; dhtmlXMenuObject.prototype._renderSeparator = function(c, n) { var a = (this.conf.context ? "SubLevelArea" : (this.itemPull[c]["parent"] == this.idPrefix + this.topId ? "TopLevel" : "SubLevelArea")); if (a == "TopLevel" && this.conf.context) { return } var l = this; if (a != "TopLevel") { var m = document.createElement("TR"); m.className = "sub_sep"; var g = document.createElement("TD"); g.colSpan = "3"; m.appendChild(g) } var h = document.createElement("DIV"); h.id = "separator_" + c; h.className = (a == "TopLevel" ? "top_sep" : "sub_sep"); h.onselectstart = function(r) { r = r || event; if (r.preventDefault) { r.preventDefault() } else { r.returnValue = false } }; h.onclick = function(s) { s = s || event; s.cancelBubble = true; var r = { ctrl: s.ctrlKey, alt: s.altKey, shift: s.shiftKey }; l._doOnClick(this.id.replace("separator_" + l.idPrefix, ""), "--s", r) }; if (a == "TopLevel") { if (n != null) { n++; if (n < 0) { n = 0 } if (this.cont.childNodes[n] != null) { this.cont.insertBefore(h, this.cont.childNodes[n]) } else { this.cont.appendChild(h) } } else { var q = this.cont.childNodes[this.cont.childNodes.length - 1]; if (String(q).search("TopLevel_Text") == -1) { this.cont.appendChild(h) } else { this.cont.insertBefore(h, q) } } this.idPull[h.id] = h } else { var o = this.idPull["polygon_" + this.itemPull[c]["parent"]]; if (n != null) { n++; if (n < 0) { n = 0 } if (n > o.tbd.childNodes.length - 1) { n = null } } if (n != null && o.tbd.childNodes[n] != null) { o.tbd.insertBefore(m, o.tbd.childNodes[n]) } else { o.tbd.appendChild(m) } g.appendChild(h); this.idPull[h.id] = m } }; dhtmlXMenuObject.prototype.addNewSeparator = function(a, c) { c = this.idPrefix + (c != null ? c : this._genStr(24)); var g = this.idPrefix + this.getParentId(a); this._addItemIntoGlobalStrorage(c, g, "", "separator", false, "", ""); this._renderSeparator(c, this.getItemPosition(a)) }; dhtmlXMenuObject.prototype._initObj = function(u, v, n) { if (!(u instanceof Array)) { n = u.parentId; if (n != null && String(n).indexOf(this.idPrefix) !== 0) { n = this.idPrefix + String(n) } u = u.items } for (var g = 0; g < u.length; g++) { if (typeof(u[g].id) == "undefined" || u[g].id == null) { u[g].id = this._genStr(24) } if (String(u[g].id).indexOf(this.idPrefix) !== 0) { u[g].id = this.idPrefix + String(u[g].id) } var h = { type: "item", tip: "", hotkey: "", state: "enabled", imgen: "", imgdis: "" }; for (var w in h) { if (typeof(u[g][w]) == "undefined") { u[g][w] = h[w] } } if (u[g].imgen == "" && u[g].img != null) { u[g].imgen = u[g].img } if (u[g].imgdis == "" && u[g].img_disabled != null) { u[g].imgdis = u[g].img_disabled } if (u[g].title == null && u[g].text != null) { u[g].title = u[g].text } if (u[g].href != null) { if (u[g].href.link != null) { u[g].href_link = u[g].href.link } if (u[g].href.target != null) { u[g].href_target = u[g].href.target } } if (u[g].userdata != null) { for (var w in u[g].userdata) { this.userData[u[g].id + "_" + w] = u[g].userdata[w] } } if (typeof(u[g].enabled) != "undefined" && window.dhx4.s2b(u[g].enabled) == false) { u[g].state = "disabled" } else { if (typeof(u[g].disabled) != "undefined" && window.dhx4.s2b(u[g].disabled) == true) { u[g].state = "disabled" } } if (typeof(u[g].parent) == "undefined") { u[g].parent = (n != null ? n : this.idPrefix + this.topId) } if (u[g].type == "checkbox") { u[g].checked = window.dhx4.s2b(u[g].checked); u[g].imgen = u[g].imgdis = "chbx_" + (u[g].checked ? "1" : "0") } if (u[g].type == "radio") { u[g].checked = window.dhx4.s2b(u[g].checked); u[g].imgen = u[g].imgdis = "rdbt_" + (u[g].checked ? "1" : "0"); if (typeof(u[g].group) == "undefined" || u[g].group == null) { u[g].group = this._genStr(24) } if (this.radio[u[g].group] == null) { this.radio[u[g].group] = [] } this.radio[u[g].group].push(u[g].id) } this.itemPull[u[g].id] = u[g]; if (u[g].items != null && u[g].items.length > 0) { this.itemPull[u[g].id].complex = true; this._initObj(u[g].items, true, u[g].id) } else { if (this.conf.dload && u[g].complex == true) { this.itemPull[u[g].id].loaded = "no" } } this.itemPull[u[g].id].items = null } if (v !== true) { if (this.conf.dload == true) { if (n == null) { this._initTopLevelMenu() } else { this._addSubMenuPolygon(n, n); if (this.conf.selected == n) { var s = (this.itemPull[n].parent == this.idPrefix + this.topId); var c = (s && !this.conf.context ? this.conf.dir_toplv : this.conf.dir_sublv); var l = false; if (s && this.conf.top_mode && this.conf.mode == "web" && !this.conf.context) { var x = this.idPull[n]; if (x._mouseOver == true) { var m = this.conf.top_tmtime - (new Date().getTime() - x._dynLoadTM); if (m > 1) { var r = n; var o = this; x._menuOpenTM = window.setTimeout(function() { o._showPolygon(r, c); o = r = null }, m); l = true } } } if (!l) { this._showPolygon(n, c) } } this.itemPull[n].loaded = "yes"; if (this.conf.dload_icon == true) { this._updateLoaderIcon(n, false) } } } else { this._init() } } }; dhtmlXMenuObject.prototype._xmlToJson = function(l, h) { var n = []; if (h == null) { var o = l.getElementsByTagName(this.conf.tags.root); if (o == null || o.length == 0) { return data } o = o[0] } else { o = l } if (o.getAttribute("parentId") != null) { h = this.idPrefix + o.getAttribute("parentId") } for (var c = 0; c < o.childNodes.length; c++) { if (typeof(o.childNodes[c].tagName) != "undefined" && String(o.childNodes[c].tagName).toLowerCase() == this.conf.tags.item) { var a = o.childNodes[c]; var v = { 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) { v.cssNormal = a.getAttribute("cssNormal") } if (v.type == "checkbox") { v.checked = a.getAttribute("checked") } if (v.type == "radio") { v.checked = a.getAttribute("checked"); v.group = a.getAttribute("group") } v.state = "enabled"; if (a.getAttribute("enabled") != null && window.dhx4.s2b(a.getAttribute("enabled")) == false) { v.state = "disabled" } else { if (a.getAttribute("disabled") != null && window.dhx4.s2b(a.getAttribute("disabled")) == true) { v.state = "disabled" } } v.parent = (h != null ? h : this.idPrefix + this.topId); if (this.conf.dload) { v.complex = (a.getAttribute("complex") != null); if (v.complex) { v.loaded = "no" } } else { var g = this._xmlToJson(a, v.id); v.items = g.items; v.complex = (v.items.length > 0) } for (var s = 0; s < a.childNodes.length; s++) { if (typeof(a.childNodes[s].tagName) != "undefined") { var u = String(a.childNodes[s].tagName || "").toLowerCase(); if (u == this.conf.tags.userdata) { var m = a.childNodes[s]; if (m.getAttribute("name") != null) { this.userData[v.id + "_" + m.getAttribute("name")] = (m.firstChild != null && m.firstChild.nodeValue != null ? m.firstChild.nodeValue : "") } } if (u == this.conf.tags.text_ext) { v.title = a.childNodes[s].firstChild.nodeValue } if (u == this.conf.tags.tooltip) { v.tip = a.childNodes[s].firstChild.nodeValue } if (u == this.conf.tags.hotkey) { v.hotkey = a.childNodes[s].firstChild.nodeValue } if (u == this.conf.tags.href && v.type == "item") { v.href_link = a.childNodes[s].firstChild.nodeValue; if (a.childNodes[s].getAttribute("target") != null) { v.href_target = a.childNodes[s].getAttribute("target") } } } } n.push(v) } } var a = { parentId: h, items: n }; 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(h, g) { if (this.idPull[h] == null) { return } if (String(this.idPull[h].className).search("TopLevel_Item") >= 0) { return } var c = (this.conf.rtl ? 0 : 2); if (!this.idPull[h].childNodes[c]) { return } if (!this.idPull[h].childNodes[c].childNodes[0]) { return } var a = this.idPull[h].childNodes[c].childNodes[0]; if (String(a.className).search("complex_arrow") === 0) { a.className = "complex_arrow" + (g ? "_loading" : "") } }; dhtmlXMenuObject.prototype.addNewSibling = function(h, l, a, c, g, o) { var n = this.idPrefix + (l != null ? l : this._genStr(24)); var m = this.idPrefix + (h != null ? this.getParentId(h) : this.topId); this._addItemIntoGlobalStrorage(n, m, a, "item", c, g, o); if ((m == this.idPrefix + this.topId) && (!this.conf.context)) { this._renderToplevelItem(n, this.getItemPosition(h)) } else { this._renderSublevelItem(n, this.getItemPosition(h)) } }; dhtmlXMenuObject.prototype.addNewChild = function(n, m, h, a, c, g, l) { if (n == null) { if (this.conf.context) { n = this.topId } else { this.addNewSibling(n, h, a, c, g, l); if (m != null) { this.setItemPosition(h, m) } return } } h = this.idPrefix + (h != null ? h : this._genStr(24)); if (this.setHotKey) { this.setHotKey(n, "") } n = this.idPrefix + n; this._addItemIntoGlobalStrorage(h, n, a, "item", c, g, l); if (this.idPull["polygon_" + n] == null) { this._renderSublevelPolygon(n, n) } this._renderSublevelItem(h, m - 1); this._redefineComplexState(n) }; dhtmlXMenuObject.prototype.removeItem = function(h, m, l) { if (!m) { h = this.idPrefix + h } var n = null; if (h != this.idPrefix + this.topId) { if (this.itemPull[h] == null) { return } if (this.idPull["polygon_" + h] && this.idPull["polygon_" + h]._tmShow) { window.clearTimeout(this.idPull["polygon_" + h]._tmShow) } var v = this.itemPull[h]["type"]; if (v == "separator") { var u = this.idPull["separator_" + h]; if (this.itemPull[h]["parent"] == this.idPrefix + this.topId) { u.onclick = null; u.onselectstart = null; u.id = null; u.parentNode.removeChild(u) } else { u.childNodes[0].childNodes[0].onclick = null; u.childNodes[0].childNodes[0].onselectstart = null; u.childNodes[0].childNodes[0].id = null; u.childNodes[0].removeChild(u.childNodes[0].childNodes[0]); u.removeChild(u.childNodes[0]); u.parentNode.removeChild(u) } this.idPull["separator_" + h] = null; this.itemPull[h] = null; delete this.idPull["separator_" + h]; delete this.itemPull[h]; u = null } else { n = this.itemPull[h]["parent"]; var u = this.idPull[h]; u.onclick = null; u.oncontextmenu = null; u.onmouseover = null; u.onmouseout = null; u.onselectstart = null; u.id = null; while (u.childNodes.length > 0) { u.removeChild(u.childNodes[0]) } u.parentNode.removeChild(u); this.idPull[h] = null; this.itemPull[h] = null; delete this.idPull[h]; delete this.itemPull[h]; u = null } v = null } for (var r in this.itemPull) { if (this.itemPull[r]["parent"] == h) { this.removeItem(r, true, true) } } var s = new Array(h); if (n != null && !l) { if (this.idPull["polygon_" + n] != null) { if (this.idPull["polygon_" + n].tbd.childNodes.length == 0) { s.push(n); this._updateItemComplexState(n, false, false) } } } for (var c = 0; c < s.length; c++) { if (this.idPull["polygon_" + s[c]]) { var g = this.idPull["polygon_" + s[c]]; g.onclick = null; g.oncontextmenu = null; g.tbl.removeChild(g.tbd); g.tbd = null; g.childNodes[1].removeChild(g.tbl); g.tbl = null; g.id = null; g.parentNode.removeChild(g); g = null; if (window.dhx4.isIE6) { var o = "polygon_" + s[c] + "_ie6cover"; if (this.idPull[o] != null) { document.body.removeChild(this.idPull[o]); delete this.idPull[o] } } if (this.idPull["arrowup_" + h] != null && this._removeArrow) { this._removeArrow("arrowup_" + h) } if (this.idPull["arrowdown_" + h] != null && this._removeArrow) { this._removeArrow("arrowdown_" + h) } this.idPull["polygon_" + s[c]] = null; delete this.idPull["polygon_" + s[c]] } } s = null; if (this.conf.skin == "dhx_terrace" && arguments.length == 1) { this._improveTerraceSkin() } }; dhtmlXMenuObject.prototype._addItemIntoGlobalStrorage = function(o, a, g, n, h, c, m) { var l = { id: o, title: g, imgen: (c != null ? c : ""), imgdis: (m != null ? m : ""), type: n, state: (h == true ? "disabled" : "enabled"), parent: a, complex: false, hotkey: "", tip: "" }; this.itemPull[l.id] = l }; 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 h = document.body } else { var h = document.getElementById(c) } var m = false; for (var g in this.conf.ctx_zones) { m = m || (g == c) || (this.conf.ctx_zones[g] == h) } if (m == true) { return false } this.conf.ctx_zones[c] = h; var l = this; if (window.dhx4.isOpera) { this.operaContext = function(a) { l._doOnContextMenuOpera(a, l) }; h.addEventListener("mouseup", this.operaContext, false) } else { if (h.oncontextmenu != null && !h._oldContextMenuHandler) { h._oldContextMenuHandler = h.oncontextmenu } h.oncontextmenu = function(n) { for (var a in dhtmlXMenuObject.prototype.liveInst) { if (a != l.conf.live_id) { if (dhtmlXMenuObject.prototype.liveInst[a].context) { dhtmlXMenuObject.prototype.liveInst[a]._hideContextMenu() } } } n = n || event; n.cancelBubble = true; if (n.preventDefault) { n.preventDefault() } else { n.returnValue = false } l._doOnContextBeforeCall(n, 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, g, 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, g); 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(l, n) { this.conf.ctx_zoneid = n.id; this._clearAndHide(); this._hideContextMenu(); var h = (l.srcElement || l.target); var c = (window.dhx4.isIE || window.dhx4.isOpera || window.dhx4.isKHTML ? l.offsetX : l.layerX); var a = (window.dhx4.isIE || window.dhx4.isOpera || window.dhx4.isKHTML ? l.offsetY : l.layerY); var m = window.dhx4.absLeft(h) + c; var g = window.dhx4.absTop(h) + a; if (this.checkEvent("onBeforeContextMenu")) { if (this.callEvent("onBeforeContextMenu", [n.id, l])) { if (this.conf.ctx_autoshow) { this._showContextMenu(m, g, n.id); this.callEvent("onAfterContextMenu", [n.id, l]) } } } else { if (this.conf.ctx_autoshow) { this._showContextMenu(m, g, n.id); this.callEvent("onAfterContextMenu", [n.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 g in this.itemPull) { if (this.itemPull[g].parent == this.idPrefix + this.topId && this.idPull[g] != null) { var l = false; var h = false; if (this.idPull[g].parentNode.firstChild == this.idPull[g]) { l = true } if (this.idPull[g].parentNode.lastChild == this.idPull[g]) { h = true } for (var c in this.itemPull) { if (this.itemPull[c].type == "separator" && this.itemPull[c].parent == this.idPrefix + this.topId) { if (this.idPull[g].nextSibling == this.idPull["separator_" + c]) { h = true } if (this.idPull[g].previousSibling == this.idPull["separator_" + c]) { l = true } } } this.idPull[g].style.borderLeftWidth = (l ? "1px" : "0px"); this.idPull[g].style.borderTopLeftRadius = this.idPull[g].style.borderBottomLeftRadius = (l ? "3px" : "0px"); this.idPull[g].style.borderTopRightRadius = this.idPull[g].style.borderBottomRightRadius = (h ? "3px" : "0px"); this.idPull[g]._bl = l; this.idPull[g]._br = h } } }; 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" } }; 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(l, h, c) { var g = false; var a = this.idPrefix + l; if ((this.itemPull[a] != null) && (this.idPull[a] != null)) { if (this.itemPull[a]["state"] != h) { this.itemPull[a]["state"] = h; 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 + l, this.itemPull[this.idPrefix + l]["complex"], false); this._updateItemImage(l, 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 g }; dhtmlXMenuObject.prototype.getItemText = function(a) { return (this.itemPull[this.idPrefix + a] != null ? this.itemPull[this.idPrefix + a]["title"] : "") }; dhtmlXMenuObject.prototype.setItemText = function(l, h) { l = this.idPrefix + l; if ((this.itemPull[l] != null) && (this.idPull[l] != null)) { this._clearAndHide(); this.itemPull[l]["title"] = h; if (this.itemPull[l]["parent"] == this.idPrefix + this.topId && !this.conf.context) { var g = null; for (var a = 0; a < this.idPull[l].childNodes.length; a++) { try { if (this.idPull[l].childNodes[a].className == "top_level_text") { g = this.idPull[l].childNodes[a] } } catch (c) {} } if (String(this.itemPull[l]["title"]).length == "" || this.itemPull[l]["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[l].childNodes.length > 0) { this.idPull[l].insertBefore(g, this.idPull[l].childNodes[0]) } else { this.idPull[l].appendChild(g) } } g.innerHTML = this.itemPull[l]["title"] } } else { var g = null; for (var a = 0; a < this.idPull[l].childNodes[1].childNodes.length; a++) { if (String(this.idPull[l].childNodes[1].childNodes[a].className || "") == "sub_item_text") { g = this.idPull[l].childNodes[1].childNodes[a] } } if (String(this.itemPull[l]["title"]).length == "" || this.itemPull[l]["title"] == null) { if (g) { g.parentNode.removeChild(g); g = null; this.idPull[l].childNodes[1].innerHTML = " " } } else { if (!g) { g = document.createElement("DIV"); g.className = "sub_item_text"; this.idPull[l].childNodes[1].innerHTML = ""; this.idPull[l].childNodes[1].appendChild(g) } g.innerHTML = this.itemPull[l]["title"] } } } }; dhtmlXMenuObject.prototype.loadFromHTML = function(g, m, h) { var c = this.conf.tags.item; this.conf.tags.item = "div"; var l = (typeof(g) == "string" ? document.getElementById(g) : g); var a = this._xmlToJson(l, this.idPrefix + this.topId); this._initObj(a); this.conf.tags.item = c; if (m) { l.parentNode.removeChild(l) } l = objOd = null; if (onload != null) { if (typeof(h) == "function") { h() } else { if (typeof(window[h]) == "function") { window[h]() } } } }; 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(g, c) { var a = this.idPrefix + g; 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 + g]["parent"]) }; dhtmlXMenuObject.prototype.setUserData = function(g, a, c) { this.userData[this.idPrefix + g + "_" + 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(g, a, c) { if (this.itemPull[this.idPrefix + g]["type"] != "item") { return } this.itemPull[this.idPrefix + g]["imgen"] = a; this.itemPull[this.idPrefix + g]["imgdis"] = c; this._updateItemImage(g, this._getItemLevelType(g)) }; dhtmlXMenuObject.prototype.clearItemImage = function(a) { this.setItemImage(a, "", "") }; dhtmlXMenuObject.prototype.setVisibleArea = function(c, a, h, g) { this.conf.v_enabled = true; this.conf.v.x1 = c; this.conf.v.x2 = a; this.conf.v.y1 = h; this.conf.v.y2 = g }; 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(g, a, c) { if (this.itemPull[this.idPrefix + g] == null) { return } this.itemPull[this.idPrefix + g]["href_link"] = a; if (c != null) { this.itemPull[this.idPrefix + g]["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(h, a, c) { if (a.charAt(1) == "d") { return } if (this.itemPull[this.idPrefix + h] == null) { return } var g = this._getCheckboxState(h); if (this.checkEvent("onCheckboxClick")) { if (this.callEvent("onCheckboxClick", [h, g, this.conf.ctx_zoneid, c])) { this.setCheckboxState(h, !g) } } else { this.setCheckboxState(h, !g) } if (this.checkEvent("onClick")) { this.callEvent("onClick", [h]) } }; 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(o, h, q, r, s, a, l) { if (this.conf.context && h == this.topId) {} else { if (this.itemPull[this.idPrefix + h] == null) { return } if (o == "child" && this.itemPull[this.idPrefix + h]["type"] != "item") { return } } var m = "chbx_" + (a ? "1" : "0"); var g = m; if (o == "sibling") { var c = this.idPrefix + (r != null ? r : this._genStr(24)); var n = this.idPrefix + this.getParentId(h); this._addItemIntoGlobalStrorage(c, n, s, "checkbox", l, m, g); this.itemPull[c]["checked"] = a; this._renderSublevelItem(c, this.getItemPosition(h)) } else { var c = this.idPrefix + (r != null ? r : this._genStr(24)); var n = this.idPrefix + h; this._addItemIntoGlobalStrorage(c, n, s, "checkbox", l, m, g); this.itemPull[c]["checked"] = a; if (this.idPull["polygon_" + n] == null) { this._renderSublevelPolygon(n, n) } this._renderSublevelItem(c, q - 1); this._redefineComplexState(n) } }; dhtmlXMenuObject.prototype.setHotKey = function(m, a) { m = this.idPrefix + m; if (!(this.itemPull[m] != null && this.idPull[m] != null)) { return } if (this.itemPull[m]["parent"] == this.idPrefix + this.topId && !this.conf.context) { return } if (this.itemPull[m]["complex"]) { return } var c = this.itemPull[m]["type"]; if (!(c == "item" || c == "checkbox" || c == "radio")) { return } var l = null; try { if (this.idPull[m].childNodes[this.conf.rtl ? 0 : 2].childNodes[0].className == "sub_item_hk") { l = this.idPull[m].childNodes[this.conf.rtl ? 0 : 2].childNodes[0] } } catch (h) {} if (a.length == 0) { this.itemPull[m]["hotkey_backup"] = this.itemPull[m]["hotkey"]; this.itemPull[m]["hotkey"] = ""; if (l != null) { l.parentNode.removeChild(l) } } else { this.itemPull[m]["hotkey"] = a; this.itemPull[m]["hotkey_backup"] = null; if (l == null) { l = document.createElement("DIV"); l.className = "sub_item_hk"; var g = this.idPull[m].childNodes[this.conf.rtl ? 0 : 2]; while (g.childNodes.length > 0) { g.removeChild(g.childNodes[0]) } g.appendChild(l) } l.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 g = 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 < g.length; c++) { if (this.idPull[g[c]] != null && this.itemPull[g[c]]["state"] == "enabled") { this.idPull[g[c]].className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_Item_Normal" } } }; dhtmlXMenuObject.prototype._checkArrowsState = function(h) { var c = this.idPull["polygon_" + h].childNodes[1]; var g = this.idPull["arrowup_" + h]; var a = this.idPull["arrowdown_" + h]; if (c.scrollTop == 0) { g.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp_Disabled" } else { g.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp" + (g.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 = g = a = null }; dhtmlXMenuObject.prototype._addUpArrow = function(h) { var c = this; var g = document.createElement("DIV"); g.pId = this.idPrefix + h; g.id = "arrowup_" + this.idPrefix + h; g.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp"; g.over = false; g.onselectstart = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } return false }; g.oncontextmenu = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } return false }; g.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) }; g.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) }; g.onclick = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } l.cancelBubble = true; return false }; var a = this.idPull["polygon_" + this.idPrefix + h]; a.childNodes[0].appendChild(g); this.idPull[g.id] = g; a = g = null }; dhtmlXMenuObject.prototype._addDownArrow = function(h) { var c = this; var g = document.createElement("DIV"); g.pId = this.idPrefix + h; g.id = "arrowdown_" + this.idPrefix + h; g.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowDown"; g.over = false; g.onselectstart = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } return false }; g.oncontextmenu = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } return false }; g.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) }; g.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) }; g.onclick = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } l.cancelBubble = true; return false }; var a = this.idPull["polygon_" + this.idPrefix + h]; a.childNodes[2].appendChild(g); this.idPull[g.id] = g; a = g = 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(m, h) { var a = this.idPull["polygon_" + m].childNodes[1]; if (this._canScrollUp && a.scrollTop > 0) { var g = false; var l = a.scrollTop - this.conf.of_ustep; if (l < 0) { g = true; l = 0 } a.scrollTop = l; if (!g) { var c = this; this.conf.of_utm = window.setTimeout(function() { c._doScrollUp(m, false); c = null }, this.conf.of_utime) } else { h = true } } else { this._canScrollUp = false; this._checkArrowsState(m) } if (h) { this._checkArrowsState(m) } }; dhtmlXMenuObject.prototype._doScrollDown = function(m, h) { var a = this.idPull["polygon_" + m].childNodes[1]; if (this._canScrollDown && a.scrollTop + a.offsetHeight <= a.scrollHeight) { var g = false; var l = a.scrollTop + this.conf.of_dstep; if (l + a.offsetHeight >= a.scrollHeight) { g = true; l = a.scrollHeight - a.offsetHeight } a.scrollTop = l; if (!g) { var c = this; this.conf.of_dtm = window.setTimeout(function() { c._doScrollDown(m, false); c = null }, this.conf.of_dtime) } else { h = true } } else { this._canScrollDown = false; this._checkArrowsState(m) } if (h) { this._checkArrowsState(m) } }; dhtmlXMenuObject.prototype._countPolygonItems = function(m) { var h = 0; for (var c in this.itemPull) { var g = this.itemPull[c]["parent"]; var l = this.itemPull[c]["type"]; if (g == this.idPrefix + m && (l == "item" || l == "radio" || l == "checkbox")) { h++ } } return h }; dhtmlXMenuObject.prototype.setOverflowHeight = function(h) { if (h === "auto") { this.conf.overflow_limit = 0; this.conf.auto_overflow = true; return } if (this.conf.overflow_limit == 0 && h <= 0) { return } this._clearAndHide(); if (this.conf.overflow_limit >= 0 && h > 0) { this.conf.overflow_limit = h; return } if (this.conf.overflow_limit > 0 && h <= 0) { for (var g in this.itemPull) { if (this._isArrowExists(g)) { var c = String(g).replace(this.idPrefix, ""); this._removeUpArrow(c); this._removeDownArrow(c); this.idPull["polygon_" + g].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(h, g) { var c = this._getRadioImgObj(h); if (c != null) { var a = this.itemPull[this.idPrefix + h]; a.checked = g; a.imgen = "rdbt_" + (a.checked ? "1" : "0"); a.imgdis = a.imgen; c.className = "sub_icon " + a.imgen } }; dhtmlXMenuObject.prototype._radioOnClickHandler = function(h, a, c) { if (a.charAt(1) == "d" || this.itemPull[this.idPrefix + h]["group"] == null) { return } var g = this.itemPull[this.idPrefix + h]["group"]; if (this.checkEvent("onRadioClick")) { if (this.callEvent("onRadioClick", [g, this.getRadioChecked(g), h, this.conf.ctx_zoneid, c])) { this.setRadioChecked(g, h) } } else { this.setRadioChecked(g, h) } if (this.checkEvent("onClick")) { this.callEvent("onClick", [h]) } }; dhtmlXMenuObject.prototype.getRadioChecked = function(h) { var m = null; for (var g = 0; g < this.radio[h].length; g++) { var l = this.radio[h][g].replace(this.idPrefix, ""); var a = this._getRadioImgObj(l); if (a != null) { var c = (a.className).match(/rdbt_1$/gi); if (c != null) { m = l } } } return m }; dhtmlXMenuObject.prototype.setRadioChecked = function(c, h) { if (this.radio[c] == null) { return } for (var a = 0; a < this.radio[c].length; a++) { var g = this.radio[c][a].replace(this.idPrefix, ""); this._setRadioState(g, (g == h)) } }; dhtmlXMenuObject.prototype.addRadioButton = function(q, l, r, s, u, v, a, m) { if (this.conf.context && l == this.topId) {} else { if (this.itemPull[this.idPrefix + l] == null) { return } if (q == "child" && this.itemPull[this.idPrefix + l]["type"] != "item") { return } } var g = this.idPrefix + (s != null ? s : this._genStr(24)); var n = "rdbt_" + (a ? "1" : "0"); var c = n; if (q == "sibling") { var o = this.idPrefix + this.getParentId(l); this._addItemIntoGlobalStrorage(g, o, u, "radio", m, n, c); this._renderSublevelItem(g, this.getItemPosition(l)) } else { var o = this.idPrefix + l; this._addItemIntoGlobalStrorage(g, o, u, "radio", m, n, c); if (this.idPull["polygon_" + o] == null) { this._renderSublevelPolygon(o, o) } this._renderSublevelItem(g, r - 1); this._redefineComplexState(o) } var h = (v != null ? v : this._genStr(24)); this.itemPull[g]["group"] = h; if (this.radio[h] == null) { this.radio[h] = new Array() } this.radio[h][this.radio[h].length] = g; if (a == true) { this.setRadioChecked(h, String(g).replace(this.idPrefix, "")) } }; dhtmlXMenuObject.prototype.serialize = function() { var a = "" + this._readLevel(this.idPrefix + this.topId) + ""; return a }; dhtmlXMenuObject.prototype._readLevel = function(h) { var l = ""; for (var q in this.itemPull) { if (this.itemPull[q]["parent"] == h) { var c = ""; var g = ""; var s = ""; var o = String(this.itemPull[q]["id"]).replace(this.idPrefix, ""); var n = ""; var r = (this.itemPull[q]["title"] != "" ? ' text="' + this.itemPull[q]["title"] + '"' : ""); var m = ""; if (this.itemPull[q]["type"] == "item") { if (this.itemPull[q]["imgen"] != "") { c = ' img="' + this.itemPull[q]["imgen"] + '"' } if (this.itemPull[q]["imgdis"] != "") { g = ' imgdis="' + this.itemPull[q]["imgdis"] + '"' } if (this.itemPull[q]["hotkey"] != "") { s = "" + this.itemPull[q]["hotkey"] + "" } } if (this.itemPull[q]["type"] == "separator") { n = ' type="separator"' } else { if (this.itemPull[q]["state"] == "disabled") { m = ' enabled="false"' } } if (this.itemPull[q]["type"] == "checkbox") { n = ' type="checkbox"' + (this.itemPull[q]["checked"] ? ' checked="true"' : "") } if (this.itemPull[q]["type"] == "radio") { n = ' type="radio" group="' + this.itemPull[q]["group"] + '" ' + (this.itemPull[q]["checked"] ? ' checked="true"' : "") } l += ""; l += s; if (this.itemPull[q]["complex"]) { l += this._readLevel(q) } l += "" } } return l }; dhtmlXMenuObject.prototype.enableEffect = function(g, l, h) { this._menuEffect = (g == "opacity" || g == "slide" || g == "slide+" ? g : 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(l) == "undefined" ? 100 : l) / (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 = h || 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(g, c) { if (!this.idPull) { return } if (this.idPull[g]._tmShow) { window.clearTimeout(this.idPull[g]._tmShow) } this.idPull[g]._h = Math.max(0, Math.min(c, this.idPull[g]._max_h)); if (this._menuEffect.search(/slide/) === 0) { this.idPull[g].style.height = this.idPull[g]._h + "px" } c += this.idPull[g]._step_h; if (this._menuEffect == "slide+" || this._menuEffect == "opacity") { this.idPull[g]._op = Math.max(0, Math.min(this._pOpMax, this.idPull[g]._op + this.idPull[g].op_step)); this._pOpacityApply(g) } if ((this.idPull[g]._step_h > 0 && c <= this.idPull[g]._max_h) || (this.idPull[g]._step_h < 0 && c >= 0)) { var a = this; this.idPull[g]._tmShow = window.setTimeout(function() { a._pEffectSet(g, c) }, this.idPull[g]._step_tm) } else { if (this._menuEffect.search(/slide/) === 0) { this.idPull[g].style.height = "" } if (this.idPull[g]._step_h < 0) { this.idPull[g].style.visibility = "hidden" } if (this._menuEffect == "slide+" || this._menuEffect == "opacity") { this.idPull[g]._op = (this.idPull[g]._step_h < 0 ? (this._pOpStyleIE ? 100 : 1) : this._pOpMax); this._pOpacityApply(g) } this.idPull[g]._tmShow = null; this.idPull[g]._h = null; this.idPull[g]._max_h = null; this.idPull[g]._step_tm = null } }; function dhtmlXRibbon(h) { var g = this, c, a; this.conf = { type: "ribbon", icons_path: (h && h.icons_path) ? h.icons_path : "", skin: "dhx_skyblue" }; this._eventHandlers = {}; this._base = null; this._items = {}; this._tabbar = null; this.childIds = []; if (typeof(h) == "string") { a = h } else { if (h && h.tagName) { a = h } else { if (h && h.parent) { if (h.parent.tagName || typeof(h.parent) == "string") { a = h.parent } } } } this._doOnHighlight0 = function(o) { o = o || event; var n = o.target || o.srcElement; var l = g._findItemByNode(n); var m = g._items[l._dhx_ribbonId]; if (m.conf.disable) { return } if (g.items[m.type] && typeof(g.items[m.type].mouseover) == "function") { if (g.items[m.type].mouseover(m, g, o) != true) { return false } } if (!/dhxrb_highlight0/.test(l.className)) { l.className += " dhxrb_highlight0" } }; this._doOffHighlight0 = function(o) { o = o || event; var n = o.target || o.srcElement; var l = g._findItemByNode(n); var m = g._items[l._dhx_ribbonId]; if (m.conf.disable) { return } if (g.items[m.type] && typeof(g.items[m.type].mouseout) == "function") { if (g.items[m.type].mouseout(m, g, o) != true) { return false } } if (/dhxrb_highlight1/.test(l.className)) { l.className = l.className.replace(/\s?dhxrb_highlight1/, "") } if (/dhxrb_highlight0/.test(l.className)) { l.className = l.className.replace(/\s?dhxrb_highlight0/, "") } }; this._doOnHighlight1 = function(o) { o = o || event; var n = o.target || o.srcElement; var l = g._findItemByNode(n); var m = g._items[l._dhx_ribbonId]; if (m.conf.disable) { return } g.callEvent("_showPopup", [m.id]); if (g.items[m.type] && typeof(g.items[m.type].mousedown) == "function") { if (g.items[m.type].mousedown(m, g, o) != true) { return false } } if (!/dhxrb_highlight1/.test(l.className)) { l.className += " dhxrb_highlight1" } }; this._doOffHighlight1 = function(o) { o = o || event; var n = o.target || o.srcElement; var l = g._findItemByNode(n); var m = g._items[l._dhx_ribbonId]; if (m.conf.disable) { return } if (g.items[m.type] && typeof(g.items[m.type].mouseup) == "function") { if (g.items[m.type].mouseup(m, g, o) != true) { return false } } if (/dhxrb_highlight1/.test(l.className)) { l.className = l.className.replace(/\s?dhxrb_highlight1/, "") } }; this._doOnClick = function(o) { o = o || event; var n = o.target || o.srcElement; var l = g._findItemByNode(n); var m = g._items[l._dhx_ribbonId]; if (m.conf.disable) { return } if (g.items[m.type] && typeof(g.items[m.type].click) == "function") { g.items[m.type].click(m, g, o) } }; this._doOnFocus = function(o) { o = o || event; var n = o.target || o.srcElement; var l = g._findItemByNode(n); var m = g._items[l._dhx_ribbonId]; if (m.conf.disable) { return } g.callEvent("_showPopup", [m.id]); if (g.items[m.type] && typeof(g.items[m.type].focus) == "function") { g.items[m.type].focus(m, g, o) } }; this._doOnBlur = function(o) { o = o || event; var n = o.target || o.srcElement; var l = g._findItemByNode(n); var m = g._items[l._dhx_ribbonId]; if (m.conf.disable) { return } if (g.items[m.type] && typeof(g.items[m.type].blur) == "function") { g.items[m.type].blur(m, g, o) } }; this._doOnChange = function(o) { o = o || event; var n = o.target || o.srcElement; var l = g._findItemByNode(n); var m = g._items[l._dhx_ribbonId]; if (m.conf.disable) { return } if (g.items[m.type] && typeof(g.items[m.type].change) == "function") { g.items[m.type].change(m, g, o) } }; this._doOnKeydown = function(o) { o = o || event; var n = o.target || o.srcElement; var l = g._findItemByNode(n); var m = g._items[l._dhx_ribbonId]; if (m.conf.disable) { return } if (g.items[m.type] && typeof(g.items[m.type].keydown) == "function") { g.items[m.type].keydown(m, g, o) } }; this._tabCustomApi = { enable: function(o, n) { var m = null, l = null; n = n || false; if (n != true) { m = g._items[this._idd]; for (l in m.childIds) { l = parseInt(l); g.enable(m.childIds[l]) } } return g._tabOriginalApi.enable.apply(this, [o]) }, disable: function(o, n) { var m = null, l = null; if (n != false) { m = g._items[this._idd]; for (l in m.childIds) { l = parseInt(l); g.disable(m.childIds[l]) } } return g._tabOriginalApi.disable.apply(this, [o]) }, close: function(n) { var m = g._items[this._idd], l; g._removeTab(m); g._tabOriginalApi.close.apply(this, [n]); for (l in g._tabOriginalApi) { this[l] = null } } }; this._attachEventTabbar = function() { this._tabbar.attachEvent("onSelect", function() { return g.callEvent("onSelect", arguments) }); this._tabbar.attachEvent("onTabClick", function() { return g.callEvent("onTabClick", arguments) }); this._tabbar.attachEvent("onTabClose", function() { return g.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(h) == "object" && h.skin) { c = h.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 (h != null) { if (h.json) { this.loadStruct(h.json, h.onload) } else { if (h.xml) { this.loadStruct(h.xml, h.onload) } else { this._renderData(h) } } } this.unload = function() { var m = null, l = []; for (m in this.childIds) { m = parseInt(m); l.push(this.childIds[m]) } dhx4._enableDataLoading(this, null, null, null, "clear"); dhx4._eventable(this, "clear"); for (m in l) { m = parseInt(m); if (this._items[l[m]].type == "tab") { this.tabs(l[m]).close(false) } else { this.removeItem(l[m]) } } 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*)/ig, "") } for (m in this) { this[m] = null } g = 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); 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, h = {}, g = []; if (a && a.tagName == "ribbon") { g = this._convertXmlNodeListIntoObject(a.childNodes) } if (g[0] && g[0].type && g[0].type.toLowerCase() == "block") { h.items = g } else { h.tabs = g } return h }; dhtmlXRibbon.prototype._convertXmlNodeListIntoObject = function(c) { var g, a, m = [], h; a = c.length; for (g = 0; g < a; g++) { h = this._covertXmlNodeToObject(c[g]); if (h) { m.push(h) } } return m }; dhtmlXRibbon.prototype._covertXmlNodeToObject = function(h) { if (!h || !h.tagName || !(h.tagName.toLowerCase() == "item" || h.tagName.toLowerCase() == "tab")) { return null } var g, a, c = h.attributes, m = {}; a = c.length; for (g = 0; g < a; g++) { switch (c[g].name) { case "isbig": m.isbig = dhx4.s2b(c[g].value); break; case "state": m.state = dhx4.s2b(c[g].value); break; default: m[c[g].name] = c[g].value } } if (h.childNodes.length) { if (h.getAttribute("type") == "buttonCombo" || h.getAttribute("type") == "buttonSelect") { m.data = h } else { if (h.tagName.toLowerCase() == "tab") { m.items = this._convertXmlNodeListIntoObject(h.childNodes) } else { m.list = this._convertXmlNodeListIntoObject(h.childNodes) } } } return m }; dhtmlXRibbon.prototype._appendTabs = function(m) { var c, a, g, h = []; a = m.length; for (c = 0; c < a; c++) { g = this._addTab(m[c]); if (m[c].items instanceof Array) { g.childIds = this._appendBlocks(m[c].items, g.base, g) } h.push(g.id) } return h }; dhtmlXRibbon.prototype._addTab = function(g) { var a, h, c = { conf: { active: false, text: "", width: null, position: null, disable: false }, base: document.createElement("div"), type: "tab", childIds: [] }; for (a in g) { if (a == "items") { continue } c.conf[a] = g[a] } if (!g.id) { c.id = dhx4.newId() } else { c.id = g.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, u, g) { var n, h, o, m, r, c, s = []; g = g || null; h = a.length; for (n = 0; n < h; n++) { if (typeof(a[n]) == "object" && a[n].type == "block") { o = this._addBlock(a[n], u); if (a[n].list && (a[n].list instanceof Array)) { m = a[n].list; r = m.length; for (c = 0; c < r; c++) { this._addItem(o.id, null, null, m[c]) } } if (g != null) { o.parentId = g.id } if (o.conf.disable) { this.disable(o.id) } s.push(o.id) } } return s }; dhtmlXRibbon.prototype._addBlock = function(m, h) { var g, a, n, c; n = { 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 m) { if (c == "list" || c == "type" || c == "id") { continue } n.conf[c] = m[c] } if (!m.id) { n.id = dhx4.newId() } else { n.id = m.id } while (this._items[n.id]) { n.id = dhx4.newId() } n.base.className = "dhxrb_block_base"; h.appendChild(n.base); n.contForItems.className = "dhxrb_block_items"; n.contForText.className = "dhxrb_block_label"; n.base.appendChild(n.contForItems); if (n.conf.text) { n.contForText.innerHTML = n.conf.text; if (n.conf.text_pos == "top") { n.base.insertBefore(n.contForText, n.contForItems) } else { n.base.appendChild(n.contForText) } } n.base._dhx_ribbonId = n.id; this._items[n.id] = n; return n }; dhtmlXRibbon.prototype._addItem = function(g, c, q, n) { var l = this._items[g], a, m, s = null, o = this, h; if (n.type != "newLevel" && !this.items[n.type]) { return null } if (n.type == "newLevel") { this._addNewLevel(l) } else { if (l.type == "group") { a = document.createElement("div"); a.className = "dhxrb_in_group"; l.base.appendChild(a) } else { if (n.isbig) { a = document.createElement("div"); a.className = "dhxrb_big_button"; l.contForItems.appendChild(a) } else { m = this._getContainerForSmallItem(l); a = document.createElement("div"); a.className = (l.conf.mode == "rows") ? "dhxrb_in_row" : "dhxrb_3rows_button"; m.appendChild(a) } } } if (a) { this._attachEventForItem(a); h = { icons_path: n.icons_path || this.conf.icons_path, skin: this.conf.skin }; for (var r in n) { h[r] = n[r] } if (!h.id) { h.id = dhx4.newId() } while (this._items[h.id]) { h.id = dhx4.newId() } s = (this.items[h.type] && this.items[h.type].render) ? this.items[h.type].render(a, h) : null } if (s != null) { this._items[s.id] = s; s.parentId = l.id; l.childIds.push(s.id); a._dhx_ribbonId = s.id; if (h.onclick && (typeof(h.onclick) == "function")) { this._eventHandlers[s.id] = this._eventHandlers[s.id] || {}; this._eventHandlers[s.id]["onclick"] = h.onclick } s.callEvent = function() { o.callEvent.apply(o, arguments) }; s._callHandler = function() { o._callHandler.apply(o, arguments) }; if (this.items[h.type] && typeof(this.items[h.type].callAfterInit) == "function") { this.items[h.type].callAfterInit.apply(this, [s]) } } return s }; 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 g, h; h = { 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 (g in a) { if (g == "id" || g == "onclick" || g == "type") { continue } h.conf[g] = a[g] } c.innerHTML = "
" + h.conf.text + "
"; if (typeof(this.afterRender) == "function") { this.afterRender(h) } if (h.conf.disable) { this.disable(h) } return h }, getText: function(a) { return a.conf.text }, setText: function(c, g) { var a = c.base.childNodes[1]; c.conf.text = g; a.innerHTML = g }, 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 g = c.base.childNodes[0], a = c.base.childNodes[1]; if (c.conf.imgdis) { g.src = c.conf.icons_path + c.conf.imgdis; if (/\s?dhxrb_invisible/i.test(g.className)) { g.className = g.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 g = c.base.childNodes[0], a = c.base.childNodes[1]; if (c.conf.img) { g.src = c.conf.icons_path + c.conf.img } else { if (!/\s?dhxrb_invisible/i.test(g.className)) { g.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, g) { g = g || 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 (g) { a.callEvent("onStateChange", [a.id, a.conf.state]) } } }; 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, l, h) { h = h || false; var g = null, c = dhx4.s2b(a.conf.state); if (c == false) { g = this._getSelectedNeighbor(a, l); if (g != null) { this._unSelect(g) } if (!/dhxrb_highlight1/.test(a.base.className)) { a.base.className += " dhxrb_highlight1" } a.conf.state = true; if (h) { l._callHandler(a.id, [a.id, (g ? g.id : null)]); l.callEvent("onStateChange", [a.id, (g ? g.id : null)]) } } }, remove: function(g, n) { var l = dhx4.s2b(g.conf.state), m = null, a = 0, c = n._items[g.parentId], h; if (l) { while (c.childIds[a] && m == null) { h = n._items[c.childIds[a]]; if (h.type == "buttonSegment" && h != g) { m = h } a++ } if (m) { this.setState(m, n) } } }, _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(h, o) { var g = o._items[h.parentId], c, a, n, m = null; a = g.childIds.length; for (c = 0; c < a; c++) { n = o._items[g.childIds[c]]; if (n.type == "buttonSegment" && n.conf.state) { m = n; break } } return m } }; 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, g) { var c = a.base.childNodes[1].lastChild; a.conf.text = g; a.base.childNodes[1].innerHTML = g; a.base.childNodes[1].appendChild(c) }, _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(l) { l = l || event; var g = l.target || l.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 n in c) { var h = c[n]; 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), g = 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(h) { if (h == null) { dhtmlXRibbon.prototype.items.buttonSelect._doOnHideMenu(c) } }); c.menu.attachEvent("onShow", function(h) { if (h == null) { dhtmlXRibbon.prototype.items.buttonSelect._doOnShowMenu(c) } }); c.menu.attachEvent("onClick", function(h) { c.callEvent("onClick", [h]) }); c.base.oncontextmenu = function() { return false }; dhtmlXRibbon.prototype.items.buttonSelect.showMenu(c) } else { c.menu.showContextMenu(a, g) } }, hideMenu: function(a) { if (a.menu instanceof dhtmlXMenuObject) { a.menu.hideContextMenu() } }, remove: function(c) { var g, a; if (c.menu instanceof dhtmlXMenuObject) { c.menu.unload(); c.menu = null } c.base.oncontextmenu = null; g = dhtmlXRibbon.prototype._indexOf(dhtmlXRibbon.prototype.items.buttonSelect.itemCollection, c); if (g != -1) { dhtmlXRibbon.prototype.items.buttonSelect.itemCollection.splice(g, 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 g, h; h = { base: c, id: a.id, type: a.type, conf: { disable: false, skin: a.skin }, childIds: [] }; c.className = "dhxrb_group"; for (g in a) { if (g == "id" || g == "onclick" || g == "type") { continue } h.conf[g] = a[g] } return h }, callAfterInit: function(m) { this._detachEventFromItem(m.base); var h, a, n = m.conf.list, o, g, c; a = (n) ? n.length : 0; for (h = 0; h < a; h++) { o = this._addItem(m.id, null, null, n[h]); if (o == null) { continue } g = o.base.childNodes[1]; if (g && !g.innerHTML && !/\s?dhxrb_label_hide/i.test(g.className)) { g.className += " dhxrb_label_hide" } } dhtmlXRibbon.prototype.items.group.normalize(m); if (m.conf.disable) { this.disable(m.id) } n = undefined }, normalize: function(o) { var a = o.base.children; var g = a.length, c = false, q = 0; var h, n; for (var m = 0; m < g; m++) { if (!/dhxrb_separator_group/i.test(a[m].className)) { if (/dhxrb_item_hide/i.test(a[m].className)) { q++; continue } } if ((Math.ceil((m - q) / 2) - Math.floor((m - q) / 2)) == 0) { if (/dhxrb_separator_group/i.test(a[m].className)) { a[m].parentNode.removeChild(a[m]); c = true; break } } else { if (!/dhxrb_separator_group/i.test(a[m].className)) { h = document.createElement("div"); h.className = "dhxrb_separator_groupp"; o.base.insertBefore(h, a[m]); c = true; break } } } if (c) { this.normalize(o) } else { n = o.base.lastChild; if (n && /dhxrb_separator_group/i.test(n.className)) { n.parentNode.removeChild(n) } } }, hideChild: function(c, h) { var a = dhtmlXRibbon.prototype._indexOf(c.base.children, h.base); if (a == 0) { a++ } else { if (a != -1) { a-- } else { return } } var g = c.base.children[a]; if (g && /dhxrb_separator_group/i.test(g.className)) { g.parentNode.removeChild(g) } }, showChild: function(a) { this.normalize(a) } }; dhtmlXRibbon.prototype.items.input = { render: function(c, a) { var g, h; h = { 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 (g in a) { if (g == "id" || g == "onclick" || g == "type") { continue } h.conf[g] = a[g] } c.innerHTML = "
" + h.conf.text + "
"; if (typeof(this.afterRender) == "function") { this.afterRender(h) } if (h.conf.disable) { this.disable(h) } if (h.conf.width) { this.setWidth(h, h.conf.width) } if (h.conf.value) { this.setValue(h, h.conf.value) } return h }, 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, g) { var a = c.base.childNodes[0]; g._detachEventsFromInput(a) }, getValue: function(c) { var a = c.base.childNodes[0], g; g = a.value; a = undefined; return g }, setValue: function(c, g) { var a = c.base.childNodes[0], g; a.value = g; c.conf.value = g }, setWidth: function(c, g) { var a = c.base.childNodes[0]; a.style.width = parseInt(g) + "px" }, disable: function(g) { var c = g.base.childNodes[0], a = g.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(g) { var c = g.base.childNodes[0], a = g.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 } }; dhtmlXRibbon.prototype.items.checkbox = { render: function(c, a) { var g, h; h = { base: c, id: a.id, type: a.type, conf: { text: "", text_pos: (a.isbig) ? "bottom" : "right", disable: false, checked: false } }; for (g in a) { if (g == "id" || g == "onclick" || g == "type") { continue } h.conf[g] = a[g] } c.innerHTML = "
" + h.conf.text + "
"; if (typeof(this.afterRender) == "function") { this.afterRender(h) } if (h.conf.checked) { this.check(h) } return h }, 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]) } }, disable: function(a) { return true }, enable: function(a) { return true } }; dhtmlXRibbon.prototype.items.text = { render: function(a, h) { var g = { base: a, id: h.id, type: h.type, conf: { text: "" } }; for (var c in h) { if (c == "id" || c == "type") { continue } g.conf[c] = h[c] } a.innerHTML = "
" + g.conf.text + "
"; if (typeof(this.afterRender) == "function") { this.afterRender(g) } return g }, callAfterInit: function(a) { this._detachEventFromItem(a.base) }, getText: function(a) { return a.conf.text }, setText: function(a, c) { a.conf.text = c; a.base.innerHTML = c } }; dhtmlXRibbon.prototype.items.buttonCombo = { render: function(a, c) { var g, h, l = {}; h = { base: a, id: c.id, type: c.type, conf: { text: "", text_pos: "right", width: 140, skin: c.skin } }; for (g in c) { if (g == "id" || g == "onclick" || g == "type") { continue } h.conf[g] = c[g] } for (g in h.conf) { if (g == "text" || g == "text_pos" || g == "disable" || g == "data") { continue } l[g] = h.conf[g] } h.base.className += " dhxrb_buttoncombo_cont"; h.base.innerHTML = "
" + h.conf.text + "
"; l.parent = h.base.firstChild; h.combo = new dhtmlXCombo(l); h.combo.setSkin(l.skin); h.combo.attachEvent("onChange", function(m, n) { h._callHandler(h.id, [m, n]); h.callEvent("onSelectOption", [h.id, m, n]) }); if (h.conf.data) { h.combo.load(h.conf.data); delete h.conf.data } if (typeof(this.afterRender) == "function") { this.afterRender(h) } if (h.conf.disable) { this.disable(h) } return h }, 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) { if (a.combo instanceof dhtmlXCombo) { a.combo.setComboValue(c) } }, setSkin: function(a, c) { if (a.combo instanceof dhtmlXCombo) { a.combo.setSkin(c) } } }; dhtmlXRibbon.prototype.items.slider = { render: function(a, l) { var g, h, c = {}; h = { base: a, id: l.id, type: l.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 (g in l) { if (g == "id" || g == "onclick" || g == "type") { continue } h.conf[g] = l[g] } for (g in h.conf) { if (g == "text" || g == "text_pos" || g == "isbig") { continue } c[g] = h.conf[g] } h.base.innerHTML = "
" + h.conf.text + "
"; c.parent = h.base.firstChild.firstChild; h.slider = new dhtmlXSlider(c); if (typeof(this.afterRender) == "function") { this.afterRender(h) } if (h.conf.disable) { this.disable(h) } h.slider.attachEvent("onChange", function(m) { h._callHandler(h.id, [m]); h.callEvent("onValueChange", [h.id, m]) }); return h }, 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(g, c) { var a; for (a in c) { g[a] = g[a] || c[a] } return g }; dhtmlXRibbon.prototype._addNewLevel = function(g) { var c, a; if (g.conf.mode == "rows") { c = g.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"; g.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"; g.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(g) { var c = g.contForItems.lastChild, a = null; if (g.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"; g.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"; g.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, h) { var g, c; c = a.length; for (g = 0; g < c; g++) { if (a[g] == h) { return g } } return -1 }; dhtmlXRibbon.prototype._removeItem = function(g) { var a, h = -1, c = this._items[g.parentId]; if (g.type == "group") { this._removeGroup(g); return } delete this._items[g.id]; a = g.base.parentNode; this._detachEventFromItem(g.base); a.removeChild(g.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) } } h = this._indexOf(c.childIds, g.id); if (h != -1) { c.childIds.splice(h, 1) } if (this.items[g.type] && (typeof(this.items[g.type].remove) == "function")) { this.items[g.type].remove(g, this) } }; dhtmlXRibbon.prototype._removeGroup = function(h) { var c = [], l, g = this._items[h.parentId], a = h.base.parentNode; for (l in h.childIds) { l = parseInt(l); c.push(this._items[h.childIds[l]]) } for (l in c) { l = parseInt(l); this._removeItem(c[l]) } delete this._items[h.id]; if (h.base.parentNode) { a.removeChild(h.base) } if (a.childNodes.length == 0) { a.parentNode.removeChild(a) } l = this._indexOf(g.childIds, h.id); if (l != -1) { g.childIds.splice(l, 1) } if (this.items[h.type] && (typeof(this.items[h.type].remove) == "function")) { this.items[h.type].remove(h) } }; dhtmlXRibbon.prototype._removeBlock = function(h) { var a = [], g, c; for (g in h.childIds) { g = parseInt(g); a.push(this._items[h.childIds[g]]) } for (g in a) { g = parseInt(g); this._removeItem(a[g]) } 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 (g in c.childIds) { g = parseInt(g); h.push(this._items[c.childIds[g]]) } for (g in h) { g = parseInt(g); this._removeBlock(h[g]) } 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(g) { var a, c; for (a in this._items) { c = this._items[a]; c.conf.skin = g; if (dhtmlXRibbon.prototype.items[c.type] && typeof(dhtmlXRibbon.prototype.items[c.type].setSkin) == "function") { dhtmlXRibbon.prototype.items[c.type].setSkin(c, g) } } 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(g) { var c = this._items[g]; 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(g) { var c = this._items[g]; 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.getValue = function(g) { var a = this._items[g], c = undefined; if (this.items[a.type] && (typeof(this.items[a.type].getValue) == "function")) { return this.items[a.type].getValue(a) } }; dhtmlXRibbon.prototype.setValue = function(g, c) { var a = this._items[g]; if (this.items[a.type] && typeof(this.items[a.type].setValue) == "function") { this.items[a.type].setValue(a, c) } }; dhtmlXRibbon.prototype.check = function(g, c) { c = dhx4.s2b(c); var a = this._items[g]; 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(g, c) { c = dhx4.s2b(c); var a = this._items[g]; 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.disable = function(h, c) { var g = this._items[h], a; if (this.items[g.type] && (typeof(this.items[g.type].disable) == "function")) { if (this.items[g.type].disable(g) != true) { return } } if (g.type == "tab") { return } else { if (g.type == "block" || g.type == "group") { for (a in g.childIds) { a = parseInt(a); this.disable(g.childIds[a]) } } } if (!/\s?dhxrb_item_disable/i.test(g.base.className)) { g.base.className += " dhxrb_item_disable" } g.conf.disable = true }; dhtmlXRibbon.prototype.enable = function(h, c) { var g = this._items[h], a; if (this.items[g.type] && (typeof(this.items[g.type].enable) == "function")) { if (this.items[g.type].enable(g) != true) { return } } if (g.type == "tab") { return } else { if (g.type == "block" || g.type == "group") { for (a in g.childIds) { a = parseInt(a); this.enable(g.childIds[a]) } } } if (/\s?dhxrb_item_disable/i.test(g.base.className)) { g.base.className = g.base.className.replace(/\s?dhxrb_item_disable/i, "") } g.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(h, c, g) { c = dhx4.s2b(c); g = dhx4.s2b(g); var a = this._items[h]; if (a && (typeof(this.items[a.type].setState) == "function")) { switch (a.type) { case "buttonSegment": this.items[a.type].setState(a, this, g); break; default: this.items[a.type].setState(a, c, g) } } }; dhtmlXRibbon.prototype.setIconPath = function(a) { this.conf.icons_path = a }; dhtmlXRibbon.prototype.removeItem = function(c) { var a = this._items[c]; 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(l) { l = (typeof(l) == "string") ? l.toLowerCase() : ""; if (this._skinCollection[l] != true) { return } var g, c = -1, a, h = "dhtmlxribbon"; g = this._base.className.match(/\S\w+/ig); if (g instanceof Array) { for (a in this._skinCollection) { if (c == -1) { c = this._indexOf(g, h + "_" + a) } else { break } } c = (c == -1) ? g.length : c } else { g = []; c = 0 } g[c] = h + "_" + l; this._base.className = g.join(" "); this.conf.skin = l; if (this._tabbar != null) { this._tabbar.setSkin(l) } this._setSkinForItems(l) }; 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(g) { var a = this._items[g], 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(h, c, g) { var a = this._items[h]; g = g || false; if (a && this.items[a.type] && typeof(this.items[a.type].setValue) == "function") { this.items[a.type].setValue(a, c) } }; 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(g, c) { var a = this._items[g]; 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) } } } } }; (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) })(); function dhtmlXToolbarObject(c, g) { var a = this; this.conf = { skin: (g || 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.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(h) { h = h || event; if ((String(h.target.tagName || "").toLowerCase() == "input")) { return true } if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } h.cancelBubble = true; return false } } this.setSkin(this.conf.skin); this.objPull = {}; this.anyUsed = "none"; this._genStr = function(h) { var l = ""; var n = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for (var m = 0; m < h; m++) { l += n.charAt(Math.round(Math.random() * (n.length - 1))) } return l }; 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(n, h) { var l = null; for (var m = 0; m < n.childNodes.length; m++) { if (n.childNodes[m].tagName != null) { if (String(n.childNodes[m].tagName).toLowerCase() == String(h).toLowerCase()) { l = n.childNodes[m] } } } return l }; this._addImgObj = function(l) { var h = document.createElement("IMG"); if (l.childNodes.length > 0) { l.insertBefore(h, l.childNodes[0]) } else { l.appendChild(h) } return h }; this._setItemImage = function(n, l, h) { if (h == true) { n.imgEn = l } else { n.imgDis = l } if ((!n.state && h == true) || (n.state && h == false)) { return } var m = this._getObj(n.obj, "img"); if (m == null) { m = this._addImgObj(n.obj) } m.src = this.conf.icons_path + l }; this._clearItemImage = function(m, h) { if (h == true) { m.imgEn = "" } else { m.imgDis = "" } if ((!m.state && h == true) || (m.state && h == false)) { return } var l = this._getObj(m.obj, "img"); if (l != null) { l.parentNode.removeChild(l) } }; this._setItemText = function(h, m) { var l = this._getObj(h.obj, "div"); if (m == null || m.length == 0) { if (l != null) { l.parentNode.removeChild(l) } return } if (l == null) { l = document.createElement("DIV"); l.className = "dhxtoolbar_text"; h.obj.appendChild(l) } l.innerHTML = m }; this._getItemText = function(h) { var l = this._getObj(h.obj, "div"); if (l != null) { return l.innerHTML } return "" }; this._enableItem = function(l) { if (l.state) { return } l.state = true; if (this.objPull[l.id]["type"] == "buttonTwoState" && this.objPull[l.id]["obj"]["pressed"] == true) { l.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres"; l.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over" } else { l.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; l.obj.renderAs = l.obj.className } if (l.arw) { l.arw.className = String(l.obj.className).replace("btn", "arw") } var h = this._getObj(l.obj, "img"); if (l.imgEn != "") { if (h == null) { h = this._addImgObj(l.obj) } h.src = this.conf.icons_path + l.imgEn } else { if (h != null) { h.parentNode.removeChild(h) } } }; this._disableItem = function(l) { if (!l.state) { return } l.state = false; l.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.objPull[l.id]["type"] == "buttonTwoState" && l.obj.pressed ? "pres_" : "") + "dis"; l.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; if (l.arw) { l.arw.className = String(l.obj.className).replace("btn", "arw") } var h = this._getObj(l.obj, "img"); if (l.imgDis != "") { if (h == null) { h = this._addImgObj(l.obj) } h.src = this.conf.icons_path + l.imgDis } else { if (h != null) { h.parentNode.removeChild(h) } } if (l.polygon != null) { if (l.polygon.style.display != "none") { window.dhx4.zim.clear(l.polygon._idd); l.polygon.style.display = "none"; if (l.polygon._ie6cover) { l.polygon._ie6cover.style.display = "none" } if (this.conf.skin == "dhx_terrace") { this._improveTerraceButtonSelect(l.id, true) } } } this.anyUsed = "none" }; this.clearAll = function() { for (var h in this.objPull) { this._removeItem(String(h).replace(this.idPrefix, "")) } }; this._doOnClick = function(h) { if (a && a.forEachItem) { a.forEachItem(function(m) { if (a.objPull[a.idPrefix + m]["type"] == "buttonSelect") { var l = a.objPull[a.idPrefix + m]; if (l.arw._skip === true) { l.arw._skip = false } else { if (l.polygon.style.display != "none") { l.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; l.obj.className = l.obj.renderAs; l.arw.className = String(l.obj.renderAs).replace("btn", "arw"); a.anyUsed = "none"; window.dhx4.zim.clear(l.polygon._idd); l.polygon.style.display = "none"; if (l.polygon._ie6cover) { l.polygon._ie6cover.style.display = "none" } if (a.conf.skin == "dhx_terrace") { a._improveTerraceButtonSelect(l.id, true) } } } } }) } }; 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 } return this } dhtmlXToolbarObject.prototype.addSpacer = function(g) { var c = this.idPrefix + g; if (this._spacer != null) { if (this._spacer.idd == g) { return } if (this._spacer == this.objPull[c].obj.parentNode) { var a = true; while (a) { var n = this._spacer.childNodes[0].idd; this.base.appendChild(this._spacer.childNodes[0]); if (n == g || this._spacer.childNodes.length == 0) { if (this.objPull[c].arw != null) { this.base.appendChild(this.objPull[c].arw) } a = false } } this._spacer.idd = g; this._fixSpacer(); return } if (this.base == this.objPull[c].obj.parentNode) { var a = true; var m = (this.objPull[c].arw != null); while (a) { var h = this.base.childNodes.length - 1; if (m == true) { if (this.base.childNodes[h] == this.objPull[c].arw) { a = false } } if (this.base.childNodes[h].idd == g) { a = false } if (a) { if (this._spacer.childNodes.length > 0) { this._spacer.insertBefore(this.base.childNodes[h], this._spacer.childNodes[0]) } else { this._spacer.appendChild(this.base.childNodes[h]) } } } this._spacer.idd = g; this._fixSpacer(); return } } else { var l = null; for (var h = 0; h < this.base.childNodes.length; h++) { if (this.base.childNodes[h] == this.objPull[this.idPrefix + g].obj) { l = h; if (this.objPull[this.idPrefix + g].arw != null) { l = h + 1 } } } if (l != 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 = g; while (this.base.childNodes.length > l + 1) { this._spacer.appendChild(this.base.childNodes[l + 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(g) { var h = this.getParentId(g); if (h != null) { var c = null; var a = this.objPull[this.idPrefix + h]._listOptions[g]; if (a != null) { if (a.sep != null) { c = "buttonSelectSeparator" } else { c = "buttonSelectButton" } } return c } else { if (this.objPull[this.idPrefix + g] == null) { return null } return this.objPull[this.idPrefix + g]["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(g, c) { for (var a = 0; a < g.length; a++) { if (g[a] == c) { return true } } return false }; dhtmlXToolbarObject.prototype.getParentId = function(h) { var l = null; for (var g in this.objPull) { if (this.objPull[g]._listOptions) { for (var c in this.objPull[g]._listOptions) { if (c == h) { l = String(g).replace(this.idPrefix, "") } } } } return l }; dhtmlXToolbarObject.prototype._addItem = function(a, c) { this._addItemToStorage(a, c); if (this.conf.skin == "dhx_terrace") { this._improveTerraceSkin() } }; dhtmlXToolbarObject.prototype.addButton = function(l, h, c, a, g) { this._addItem({ id: l, type: "button", text: c, img: a, imgdis: g }, h) }; dhtmlXToolbarObject.prototype.addText = function(g, c, a) { this._addItem({ id: g, type: "text", text: a }, c) }; dhtmlXToolbarObject.prototype.addButtonSelect = function(h, o, v, a, c, r, n, x, l, m) { var w = []; for (var g = 0; g < a.length; g++) { var s = {}; if (a[g] instanceof Array) { s.id = a[g][0]; s.type = (a[g][1] == "obj" ? "button" : "separator"); s.text = (a[g][2] || null); s.img = (a[g][3] || null) } else { if (a[g] instanceof Object && a[g] != null && typeof(a[g].id) != "undefined" && typeof(a[g].type) != "undefined") { s.id = a[g].id; s.type = (a[g].type == "obj" ? "button" : "separator"); s.text = a[g].text; s.img = a[g].img } } w.push(s) } this._addItem({ id: h, type: "buttonSelect", text: v, img: c, imgdis: r, renderSelect: n, openAll: x, options: w, maxOpen: l, mode: m }, o) }; dhtmlXToolbarObject.prototype.addButtonTwoState = function(l, h, c, a, g) { this._addItem({ id: l, type: "buttonTwoState", img: a, imgdis: g, text: c }, h) }; dhtmlXToolbarObject.prototype.addSeparator = function(c, a) { this._addItem({ id: c, type: "separator" }, a) }; dhtmlXToolbarObject.prototype.addSlider = function(c, n, l, h, q, g, m, a, o) { this._addItem({ id: c, type: "slider", length: l, valueMin: h, valueMax: q, valueNow: g, textMin: m, textMax: a, toolTip: o }, n) }; dhtmlXToolbarObject.prototype.addInput = function(h, g, c, a) { this._addItem({ id: h, type: "buttonInput", value: c, width: a }, g) }; dhtmlXToolbarObject.prototype.forEachItem = function(g) { for (var c in this.objPull) { if (this.inArray(this.rootTypes, this.objPull[c]["type"])) { g(this.objPull[c]["id"].replace(this.idPrefix, "")) } } }; (function() { var m = "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 g = [false, "", "", false, "", "", "", "", "", "", "", "", "", false, "", "", "", null, "", [null, null], "", [null, null], "", null]; var c = function(n, o) { return function(s, r, q) { s = this.idPrefix + s; if (this.objPull[s][n] != null) { return this.objPull[s][n].call(this.objPull[s], r, q) } else { return o } } }; for (var l = 0; l < m.length; l++) { var a = m[l]; var h = g[l]; dhtmlXToolbarObject.prototype[a] = c(a, h) } })(); 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(l, g) { if (this.objPull[this.idPrefix + l] == null) { return null } var h = 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 == l) { h = a } a++ } } if (!h && 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 == l) { h = a } a++ } } } return h }; dhtmlXToolbarObject.prototype.setPosition = function(a, c) { this._setPosition(a, c) }; dhtmlXToolbarObject.prototype._setPosition = function(l, h) { if (this.objPull[this.idPrefix + l] == null) { return } if (isNaN(h)) { h = this.base.childNodes.length } if (h < 0) { h = 0 } var a = null; if (this._spacer) { a = this._spacer.idd; this.removeSpacer() } var g = this.objPull[this.idPrefix + l]; this.base.removeChild(g.obj); if (g.arw) { this.base.removeChild(g.arw) } var c = this._getIdByPosition(h, true); if (c[0] == null) { this.base.appendChild(g.obj); if (g.arw) { this.base.appendChild(g.arw) } } else { this.base.insertBefore(g.obj, this.base.childNodes[c[1]]); if (g.arw) { this.base.insertBefore(g.arw, this.base.childNodes[c[1] + 1]) } } if (a != null) { this.addSpacer(a) } }; dhtmlXToolbarObject.prototype._getIdByPosition = function(m, c) { var l = null; var a = 0; var g = 0; for (var h = 0; h < this.base.childNodes.length; h++) { if (this.base.childNodes[h]["idd"] != null && l == null) { if ((a++) == m) { l = this.base.childNodes[h]["idd"] } } if (l == null) { g++ } } g = (l == null ? null : g); return (c == true ? new Array(l, g) : l) }; dhtmlXToolbarObject.prototype.removeItem = function(a) { this._removeItem(a); if (this.conf.skin == "dhx_terrace") { this._improveTerraceSkin() } }; dhtmlXToolbarObject.prototype._removeItem = function(l) { var g = this.getType(l); l = this.idPrefix + l; var h = this.objPull[l]; if (g == "button") { h.obj._doOnMouseOver = null; h.obj._doOnMouseOut = null; h.obj._doOnMouseUp = null; h.obj._doOnMouseUpOnceAnywhere = null; h.obj.onclick = null; h.obj.onmouseover = null; h.obj.onmouseout = null; h.obj.onmouseup = null; h.obj.onmousedown = null; h.obj.onselectstart = null; h.obj.renderAs = null; h.obj.idd = null; h.obj.parentNode.removeChild(h.obj); h.obj = null; h.id = null; h.state = null; h.img = null; h.imgEn = null; h.imgDis = null; h.type = null; h.enableItem = null; h.disableItem = null; h.isEnabled = null; h.showItem = null; h.hideItem = null; h.isVisible = null; h.setItemText = null; h.getItemText = null; h.setItemImage = null; h.clearItemImage = null; h.setItemImageDis = null; h.clearItemImageDis = null; h.setItemToolTip = null; h.getItemToolTip = null } if (g == "buttonTwoState") { h.obj._doOnMouseOver = null; h.obj._doOnMouseOut = null; h.obj.onmouseover = null; h.obj.onmouseout = null; h.obj.onmousedown = null; h.obj.onselectstart = null; h.obj.renderAs = null; h.obj.idd = null; h.obj.parentNode.removeChild(h.obj); h.obj = null; h.id = null; h.state = null; h.img = null; h.imgEn = null; h.imgDis = null; h.type = null; h.enableItem = null; h.disableItem = null; h.isEnabled = null; h.showItem = null; h.hideItem = null; h.isVisible = null; h.setItemText = null; h.getItemText = null; h.setItemImage = null; h.clearItemImage = null; h.setItemImageDis = null; h.clearItemImageDis = null; h.setItemToolTip = null; h.getItemToolTip = null; h.setItemState = null; h.getItemState = null } if (g == "buttonSelect") { for (var c in h._listOptions) { this.removeListOption(l, c) } h._listOptions = null; if (h.polygon._ie6cover) { document.body.removeChild(h.polygon._ie6cover); h.polygon._ie6cover = null } h.p_tbl.removeChild(h.p_tbody); h.polygon.removeChild(h.p_tbl); h.polygon.onselectstart = null; document.body.removeChild(h.polygon); h.p_tbody = null; h.p_tbl = null; h.polygon = null; h.obj.onclick = null; h.obj.onmouseover = null; h.obj.onmouseout = null; h.obj.onmouseup = null; h.obj.onmousedown = null; h.obj.onselectstart = null; h.obj.idd = null; h.obj.iddPrefix = null; h.obj.parentNode.removeChild(h.obj); h.obj = null; h.arw.onclick = null; h.arw.onmouseover = null; h.arw.onmouseout = null; h.arw.onmouseup = null; h.arw.onmousedown = null; h.arw.onselectstart = null; h.arw.parentNode.removeChild(h.arw); h.arw = null; h.renderSelect = null; h.state = null; h.type = null; h.id = null; h.img = null; h.imgEn = null; h.imgDis = null; h.openAll = null; h._isListButton = null; h._separatorButtonSelectObject = null; h._buttonButtonSelectObject = null; h.setWidth = null; h.enableItem = null; h.disableItem = null; h.isEnabled = null; h.showItem = null; h.hideItem = null; h.isVisible = null; h.setItemText = null; h.getItemText = null; h.setItemImage = null; h.clearItemImage = null; h.setItemImageDis = null; h.clearItemImageDis = null; h.setItemToolTip = null; h.getItemToolTip = null; h.addListOption = null; h.removeListOption = null; h.showListOption = null; h.hideListOption = null; h.isListOptionVisible = null; h.enableListOption = null; h.disableListOption = null; h.isListOptionEnabled = null; h.setListOptionPosition = null; h.getListOptionPosition = null; h.setListOptionImage = null; h.getListOptionImage = null; h.clearListOptionImage = null; h.setListOptionText = null; h.getListOptionText = null; h.setListOptionToolTip = null; h.getListOptionToolTip = null; h.forEachListOption = null; h.getAllListOptions = null; h.setListOptionSelected = null; h.getListOptionSelected = null } if (g == "buttonInput") { h.obj.childNodes[0].onkeydown = null; h.obj.removeChild(h.obj.childNodes[0]); h.obj.w = null; h.obj.idd = null; h.obj.parentNode.removeChild(h.obj); h.obj = null; h.id = null; h.type = null; h.enableItem = null; h.disableItem = null; h.isEnabled = null; h.showItem = null; h.hideItem = null; h.isVisible = null; h.setItemToolTip = null; h.getItemToolTip = null; h.setWidth = null; h.getWidth = null; h.setValue = null; h.getValue = null; h.setItemText = null; h.getItemText = null } if (g == "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", h.pen._doOnMouseMoveStart, false); window.removeEventListener("mouseup", h.pen._doOnMouseMoveEnd, false) } else { document.body.detachEvent("onmousemove", h.pen._doOnMouseMoveStart); document.body.detachEvent("onmouseup", h.pen._doOnMouseMoveEnd) } } h.pen.allowMove = null; h.pen.initXY = null; h.pen.maxX = null; h.pen.minX = null; h.pen.nowX = null; h.pen.newNowX = null; h.pen.valueMax = null; h.pen.valueMin = null; h.pen.valueNow = null; h.pen._definePos = null; h.pen._detectLimits = null; h.pen._doOnMouseMoveStart = null; h.pen._doOnMouseMoveEnd = null; h.pen.onmousedown = null; h.obj.removeChild(h.pen); h.pen = null; h.label.tip = null; document.body.removeChild(h.label); h.label = null; h.obj.onselectstart = null; h.obj.idd = null; while (h.obj.childNodes.length > 0) { h.obj.removeChild(h.obj.childNodes[0]) } h.obj.parentNode.removeChild(h.obj); h.obj = null; h.id = null; h.type = null; h.state = null; h.enableItem = null; h.disableItem = null; h.isEnabled = null; h.setItemToolTipTemplate = null; h.getItemToolTipTemplate = null; h.setMaxValue = null; h.setMinValue = null; h.getMaxValue = null; h.getMinValue = null; h.setValue = null; h.getValue = null; h.showItem = null; h.hideItem = null; h.isVisible = null } if (g == "separator") { h.obj.onselectstart = null; h.obj.idd = null; h.obj.parentNode.removeChild(h.obj); h.obj = null; h.id = null; h.type = null; h.showItem = null; h.hideItem = null; h.isVisible = null } if (g == "text") { h.obj.onselectstart = null; h.obj.idd = null; h.obj.parentNode.removeChild(h.obj); h.obj = null; h.id = null; h.type = null; h.showItem = null; h.hideItem = null; h.isVisible = null; h.setWidth = null; h.setItemText = null; h.getItemText = null } g = null; h = null; this.objPull[this.idPrefix + l] = null; delete this.objPull[this.idPrefix + l] }; (function() { var h = "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(l) { return function(s, n, m, r, q, o) { s = this.idPrefix + s; if (this.objPull[s] == null) { return } if (this.objPull[s]["type"] != "buttonSelect") { return } return this.objPull[s][l].call(this.objPull[s], n, m, r, q, o) } }; for (var g = 0; g < h.length; g++) { var a = h[g]; dhtmlXToolbarObject.prototype[a] = c(a) } })(); dhtmlXToolbarObject.prototype._rtlParseBtn = function(c, a) { return c + a }; dhtmlXToolbarObject.prototype._separatorObject = function(a, g, c) { this.id = a.idPrefix + g; this.obj = document.createElement("DIV"); this.obj.className = "dhx_toolbar_sep"; this.obj.style.display = (c.hidden != null ? "none" : ""); this.obj.idd = String(g); this.obj.title = (c.title || ""); this.obj.onselectstart = function(h) { h = h || event; if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } }; if (window.dhx4.isIPad) { this.obj.ontouchstart = function(h) { h = h || event; if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } h.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, g, c) { this.id = a.idPrefix + g; this.obj = document.createElement("DIV"); this.obj.className = "dhx_toolbar_text"; this.obj.style.display = (c.hidden != null ? "none" : ""); this.obj.idd = String(g); this.obj.title = (c.title || ""); this.obj.onselectstart = function(h) { h = h || event; if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } }; if (window.dhx4.isIPad) { this.obj.ontouchstart = function(h) { h = h || event; if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } h.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(h) { this.obj.innerHTML = h }; this.getItemText = function() { return this.obj.innerHTML }; this.setWidth = function(h) { this.obj.style.width = h + "px" }; this.setItemToolTip = function(h) { this.obj.title = h }; this.getItemToolTip = function() { return this.obj.title }; return this }; dhtmlXToolbarObject.prototype._buttonObject = function(a, h, c) { this.id = a.idPrefix + h; 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(h); this.obj.title = (c.title || ""); this.obj.pressed = false; this.obj.innerHTML = a._rtlParseBtn((this.img != "" ? "" : ""), (c.text != null ? "
" + c.text + "
" : "")); var g = this; this.obj.onselectstart = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } }; this.obj.onmouseover = function() { this._doOnMouseOver() }; this.obj.onmouseout = function() { this._doOnMouseOut() }; this.obj._doOnMouseOver = function() { this.allowClick = true; if (g.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 (g.state == false) { return } if (a.anyUsed != "none") { return } this.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; this.renderAs = this.renderAs }; this.obj.onclick = function(l) { if (g.state == false) { return } if (this.allowClick == false) { return } l = l || event; var m = this.idd.replace(a.idPrefix, ""); if (this.extAction) { try { window[this.extAction](m) } catch (l) {} } if (a && a.callEvent) { a.callEvent("onClick", [m]) } }; this.obj[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(l) { if (g.state == false) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } l.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(m) { if (g.state == false) { return } if (a.anyUsed != "none") { if (a.anyUsed != this.idd) { return } } var l = a.anyUsed; this._doOnMouseUp(); if (window.dhx4.isIPad && l != "none") { a.callEvent("onClick", [this.idd.replace(a.idPrefix, "")]) } }; if (window.dhx4.isIPad) { this.obj.ontouchmove = function(l) { 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(l) { a._setItemText(this, l) }; this.getItemText = function() { return a._getItemText(this) }; this.setItemImage = function(l) { a._setItemImage(this, l, true) }; this.clearItemImage = function() { a._clearItemImage(this, true) }; this.setItemImageDis = function(l) { a._setItemImage(this, l, false) }; this.clearItemImageDis = function() { a._clearItemImage(this, false) }; this.setItemToolTip = function(l) { this.obj.title = l }; this.getItemToolTip = function() { return this.obj.title }; return this }; dhtmlXToolbarObject.prototype._buttonSelectObject = function(g, m, l) { this.id = g.idPrefix + m; this.state = (l.enabled != null ? (l.enabled == "true" ? true : false) : true); this.imgEn = (l.img || ""); this.imgDis = (l.imgdis || ""); this.img = (this.state ? (this.imgEn != "" ? this.imgEn : "") : (this.imgDis != "" ? this.imgDis : "")); this.mode = (l.mode || "button"); if (this.mode == "select") { this.openAll = true; this.renderSelect = false; if (!l.text || l.text.length == 0) { l.text = " " } } else { this.openAll = (window.dhx4.s2b(l.openAll) == true); this.renderSelect = (l.renderSelect == null ? true : window.dhx4.s2b(l.renderSelect)) } this.maxOpen = (!isNaN(l.maxOpen ? l.maxOpen : "") ? l.maxOpen : null); this._maxOpenTest = function() { if (!isNaN(this.maxOpen)) { if (!g._sbw) { var o = document.createElement("DIV"); o.className = "dhxtoolbar_maxopen_test"; document.body.appendChild(o); var n = document.createElement("DIV"); n.className = "dhxtoolbar_maxopen_test2"; o.appendChild(n); g._sbw = o.offsetWidth - n.offsetWidth; o.removeChild(n); n = null; document.body.removeChild(o); o = null } } }; this._maxOpenTest(); this.obj = document.createElement("DIV"); this.obj.allowClick = false; this.obj.extAction = (l.action || null); this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis"); this.obj.style.display = (l.hidden != null ? "none" : ""); this.obj.renderAs = this.obj.className; this.obj.onselectstart = function(n) { n = n || event; if (n.preventDefault) { n.preventDefault() } else { n.returnValue = false } }; this.obj.idd = String(m); this.obj.title = (l.title || ""); this.obj.pressed = false; this.callEvent = false; this.obj.innerHTML = g._rtlParseBtn((this.img != "" ? "" : ""), (l.text != null ? "
" + l.text + "
" : "")); g.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(n) { n = n || event; if (n.preventDefault) { n.preventDefault() } else { n.returnValue = false } }; g.base.appendChild(this.arw); var a = this; this.obj.onmouseover = function(n) { n = n || event; if (g.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 (g.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(n) { n = n || event; if (!a.obj.allowClick) { return } if (!a.state) { return } if (g.anyUsed != "none") { return } var o = a.obj.idd.replace(g.idPrefix, ""); if (a.obj.extAction) { try { window[a.obj.extAction](o) } catch (n) {} } g.callEvent("onClick", [o]) }; this.obj[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(n) { n = n || event; if (g.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(n) { n = n || event; n.cancelBubble = true; if (g.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 && a.callEvent) { var o = a.obj.idd.replace(g.idPrefix, ""); g.callEvent("onClick", [o]) } } } if (window.dhx4.isIPad) { this.obj.ontouchmove = this.obj.onmouseout } this.arw[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(q) { q = q || event; var x = (this.className.indexOf("dhx_toolbar_arw") === 0 ? this : this.nextSibling); if (x._skip) { q = q || event; q.cancelBubble = true } else { x._skip = true } x = null; if (!a.state) { return } if (g.anyUsed == a.obj.idd) { a.obj.className = a.obj.renderAs; a.arw.className = String(a.obj.renderAs).replace("btn", "arw"); g.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 (g.conf.skin == "dhx_terrace") { g._improveTerraceButtonSelect(a.id, true) } } else { if (g.anyUsed != "none") { if (g.objPull[g.idPrefix + g.anyUsed]["type"] == "buttonSelect") { var w = g.objPull[g.idPrefix + g.anyUsed]; if (w.polygon.style.display != "none") { w.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; w.obj.className = w.obj.renderAs; w.arw.className = String(a.obj.renderAs).replace("btn", "arw"); window.dhx4.zim.clear(w.polygon._idd); w.polygon.style.display = "none"; if (w.polygon._ie6cover) { w.polygon._ie6cover.style.display = "none" } if (g.conf.skin == "dhx_terrace") { g._improveTerraceButtonSelect(w.id, true) } } } } a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_over"; a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_pres"; g.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 (g.conf.skin == "dhx_terrace") { g._improveTerraceButtonSelect(a.id, false) } a._fixMaxOpenHeight(a.maxOpen || null); g._autoDetectVisibleArea(); var r = window.dhx4.absTop(a.obj) + a.obj.offsetHeight + g.conf.sel_ofs_y; var u = a.polygon.offsetHeight; if (r + u > g.tY2) { var s = (a.maxOpen != null ? Math.floor((g.tY2 - r) / 22) : 0); if (s >= 1) { a._fixMaxOpenHeight(s) } else { r = window.dhx4.absTop(a.obj) - u - g.conf.sel_ofs_y; if (r < 0) { r = 0 } } } a.polygon.style.top = r + "px"; if (g.rtl) { a.polygon.style.left = window.dhx4.absLeft(a.obj) + a.obj.offsetWidth - a.polygon.offsetWidth + g.conf.sel_ofs_x + "px" } else { var o = document.body.scrollLeft; var n = o + (window.innerWidth || document.body.clientWidth); var v = window.dhx4.absLeft(a.obj) + g.conf.sel_ofs_x; if (v + a.polygon.offsetWidth > n) { v = window.dhx4.absLeft(a.arw) + a.arw.offsetWidth - a.polygon.offsetWidth } a.polygon.style.left = Math.max(v, 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 = "" } } return false }; this.arw.onclick = function(n) { n = n || event; n.cancelBubble = true }; this.arw[window.dhx4.isIPad ? "ontouchend" : "onmouseup"] = function(n) { n = n || event; n.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 = g.idPrefix; this._listOptions = {}; this._fixMaxOpenHeight = function(s) { var r = "auto"; var q = false; if (s !== null) { var o = 0; for (var n in this._listOptions) { o++ } if (o > s) { this._ph = 22 * s; r = this._ph + "px" } else { q = true } } this.polygon.style.width = "auto"; this.polygon.style.height = "auto"; if (!q && a.maxOpen != null) { this.polygon.style.width = this.p_tbl.offsetWidth + g._sbw + "px"; this.polygon.style.height = r } }; this._separatorButtonSelectObject = function(q, n, o) { this.obj = {}; this.obj.tr = document.createElement("TR"); this.obj.tr.className = "tr_sep"; this.obj.tr.onselectstart = function(r) { r = r || event; if (r.preventDefault) { r.preventDefault() } else { r.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(r) { r = r || event; if (r.preventDefault) { r.preventDefault() } else { r.returnValue = false } return false }; 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.tr.appendChild(this.obj.td); this.obj.sep = document.createElement("DIV"); this.obj.sep.className = "btn_sep"; this.obj.sep.onselectstart = function(r) { r = r || event; if (r.preventDefault) { r.preventDefault() } else { r.returnValue = false } return false }; this.obj.td.appendChild(this.obj.sep); a._listOptions[q] = this.obj; return this }; this._buttonButtonSelectObject = function(s, q, r) { var o = true; if (typeof(q.enabled) != "undefined") { o = window.dhx4.s2b(q.enabled) } else { if (typeof(q.disabled) != "undefined") { o = window.dhx4.s2b(q.disabled) } } this.obj = {}; this.obj.tr = document.createElement("TR"); this.obj.tr.en = o; this.obj.tr.extAction = (q.action || null); this.obj.tr._selected = (q.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(u) { u = u || event; if (u.preventDefault) { u.preventDefault() } else { u.returnValue = false } return false }; this.obj.tr.idd = String(s); if (isNaN(r)) { r = a.p_tbody.childNodes.length + 1 } else { if (r < 1) { r = 1 } } if (r > a.p_tbody.childNodes.length) { a.p_tbody.appendChild(this.obj.tr) } else { a.p_tbody.insertBefore(this.obj.tr, a.p_tbody.childNodes[r - 1]) } this.obj.td_a = document.createElement("TD"); this.obj.td_a.className = "td_btn_img"; this.obj.td_a.onselectstart = function(u) { u = u || event; if (u.preventDefault) { u.preventDefault() } else { u.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(u) { u = u || event; if (u.preventDefault) { u.preventDefault() } else { u.returnValue = false } return false }; if (g.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 (q.img != null) { this.obj.td_a.innerHTML = ""; this.obj.tr._img = q.img } else { this.obj.td_a.innerHTML = " " } var n = (q.text != null ? q.text : (q.itemText || "")); this.obj.td_b.innerHTML = "
" + n + "
"; 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(u) { u = u || event; u.cancelBubble = true; if (!this.en) { return } a.setListOptionSelected(this.idd.replace(g.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 (g.conf.skin == "dhx_terrace") { g._improveTerraceButtonSelect(a.id, true) } g.anyUsed = "none"; var v = this.idd.replace(g.idPrefix, ""); if (this.extAction) { try { window[this.extAction](v) } catch (u) {} } g.callEvent("onClick", [v]) }; a._listOptions[s] = this.obj; return this }; this.polygon = document.createElement("DIV"); this.polygon.dir = "ltr"; this.polygon.style.display = "none"; this.polygon.className = "dhx_toolbar_poly_" + g.conf.skin + " dhxtoolbar_icons_" + g.conf.iconSize; this.polygon.onselectstart = function(n) { n = n || event; if (n.preventDefault) { n.preventDefault() } else { n.returnValue = false } }; this.polygon.onmousedown = function(n) { n = n || event; n.cancelBubble = true }; this.polygon.style.overflowY = "auto"; this.polygon._idd = window.dhx4.newId(); if (window.dhx4.isIPad) { this.polygon.ontouchstart = function(n) { n = n || event; if (n.preventDefault) { n.preventDefault() } else { n.returnValue = false } n.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 (l.options != null) { for (var h = 0; h < l.options.length; h++) { var c = "_" + (l.options[h].type || "") + "ButtonSelectObject"; if (l.options[h].id == null) { l.options[h].id = g._genStr(24) } if (typeof(this[c]) == "function") { new this[c](l.options[h].id, l.options[h]) } } } 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(n) { this.obj.style.width = n - 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() { g._enableItem(this) }; this.disableItem = function() { g._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(n) { g._setItemText(this, n) }; this.getItemText = function() { return g._getItemText(this) }; this.setItemImage = function(n) { g._setItemImage(this, n, true) }; this.clearItemImage = function() { g._clearItemImage(this, true) }; this.setItemImageDis = function(n) { g._setItemImage(this, n, false) }; this.clearItemImageDis = function() { g._clearItemImage(this, false) }; this.setItemToolTip = function(n) { this.obj.title = n; this.arw.title = n }; this.getItemToolTip = function() { return this.obj.title }; this.addListOption = function(u, s, q, r, n) { if (!(q == "button" || q == "separator")) { return } var o = { id: u, type: q, text: r, img: n }; new this["_" + q + "ButtonSelectObject"](u, o, s) }; this.removeListOption = function(q) { if (!this._isListButton(q, true)) { return } var n = this._listOptions[q]; if (n.td_a != null && n.td_b != null) { n.td_a.onselectstart = null; n.td_b.onselectstart = null; while (n.td_a.childNodes.length > 0) { n.td_a.removeChild(n.td_a.childNodes[0]) } while (n.td_b.childNodes.length > 0) { n.td_b.removeChild(n.td_b.childNodes[0]) } n.tr.onselectstart = null; n.tr.onmouseover = null; n.tr.onmouseout = null; n.tr.onclick = null; while (n.tr.childNodes.length > 0) { n.tr.removeChild(n.tr.childNodes[0]) } n.tr.parentNode.removeChild(n.tr); n.td_a = null; n.td_b = null; n.tr = null } else { n.sep.onselectstart = null; n.td.onselectstart = null; n.tr.onselectstart = null; while (n.td.childNodes.length > 0) { n.td.removeChild(n.td.childNodes[0]) } while (n.tr.childNodes.length > 0) { n.tr.removeChild(n.tr.childNodes[0]) } n.tr.parentNode.removeChild(n.tr); n.sep = null; n.td = null; n.tr = null } n = null; this._listOptions[q] = null; try { delete this._listOptions[q] } catch (o) {} }; this.showListOption = function(n) { if (!this._isListButton(n, true)) { return } this._listOptions[n].tr.style.display = "" }; this.hideListOption = function(n) { if (!this._isListButton(n, true)) { return } this._listOptions[n].tr.style.display = "none" }; this.isListOptionVisible = function(n) { if (!this._isListButton(n, true)) { return } return (this._listOptions[n].tr.style.display != "none") }; this.enableListOption = function(n) { if (!this._isListButton(n)) { return } this._listOptions[n].tr.en = true; this._listOptions[n].tr.className = "tr_btn" + (this._listOptions[n].tr._selected && g.renderSelect ? " tr_btn_selected" : "") }; this.disableListOption = function(n) { if (!this._isListButton(n)) { return } this._listOptions[n].tr.en = false; this._listOptions[n].tr.className = "tr_btn tr_btn_disabled" }; this.isListOptionEnabled = function(n) { if (!this._isListButton(n)) { return } return this._listOptions[n].tr.en }; this.setListOptionPosition = function(q, o) { if (!this._listOptions[q] || this.getListOptionPosition(q) == o || isNaN(o)) { return } if (o < 1) { o = 1 } var n = this._listOptions[q].tr; this.p_tbody.removeChild(n); if (o > this.p_tbody.childNodes.length) { this.p_tbody.appendChild(n) } else { this.p_tbody.insertBefore(n, this.p_tbody.childNodes[o - 1]) } n = null }; this.getListOptionPosition = function(r) { var o = -1; if (!this._listOptions[r]) { return o } for (var n = 0; n < this.p_tbody.childNodes.length; n++) { if (this.p_tbody.childNodes[n] == this._listOptions[r].tr) { o = n + 1 } } return o }; this.setListOptionImage = function(r, n) { if (!this._isListButton(r)) { return } var q = this._listOptions[r].tr.childNodes[(g.rtl ? 1 : 0)]; if (q.childNodes.length > 0) { q.childNodes[0].src = g.conf.icons_path + n } else { var o = document.createElement("IMG"); o.className = "btn_sel_img"; o.src = g.conf.icons_path + n; q.appendChild(o) } q = null }; this.getListOptionImage = function(q) { if (!this._isListButton(q)) { return } var o = this._listOptions[q].tr.childNodes[(g.rtl ? 1 : 0)]; var n = null; if (o.childNodes.length > 0) { n = o.childNodes[0].src } o = null; return n }; this.clearListOptionImage = function(o) { if (!this._isListButton(o)) { return } var n = this._listOptions[o].tr.childNodes[(g.rtl ? 1 : 0)]; while (n.childNodes.length > 0) { n.removeChild(n.childNodes[0]) } n.innerHTML = " "; n = null }; this.setListOptionText = function(o, n) { if (!this._isListButton(o)) { return } this._listOptions[o].tr.childNodes[(g.rtl ? 0 : 1)].childNodes[0].innerHTML = n }; this.getListOptionText = function(n) { if (!this._isListButton(n)) { return } return this._listOptions[n].tr.childNodes[(g.rtl ? 0 : 1)].childNodes[0].innerHTML }; this.setListOptionToolTip = function(o, n) { if (!this._isListButton(o)) { return } this._listOptions[o].tr.title = n }; this.getListOptionToolTip = function(n) { if (!this._isListButton(n)) { return } return this._listOptions[n].tr.title }; this.forEachListOption = function(o) { for (var n in this._listOptions) { o(n) } }; this.getAllListOptions = function() { var o = new Array(); for (var n in this._listOptions) { o[o.length] = n } return o }; this.setListOptionSelected = function(q) { for (var n in this._listOptions) { var o = this._listOptions[n]; if (o.td_a != null && o.td_b != null && o.tr.en) { if (n == q) { o.tr._selected = true; o.tr.className = "tr_btn" + (this.renderSelect ? " tr_btn_selected" : ""); if (this.mode == "select") { if (o.tr._img) { this.setItemImage(o.tr._img) } else { this.clearItemImage() } this.setItemText(this.getListOptionText(q)) } } else { o.tr._selected = false; o.tr.className = "tr_btn" } } o = null } }; this.getListOptionSelected = function() { var o = null; for (var n in this._listOptions) { if (this._listOptions[n].tr._selected == true) { o = n } } return o }; this._isListButton = function(o, n) { if (this._listOptions[o] == null) { return false } if (!n && this._listOptions[o].tr.className == "tr_sep") { return false } return true }; this.setMaxOpen = function(n) { this._ph = null; if (typeof(n) == "number") { this.maxOpen = n; this._maxOpenTest(); return } this.maxOpen = null }; if (l.width) { this.setWidth(l.width) } if (this.mode == "select" && typeof(l.selected) != "undefined") { this.setListOptionSelected(l.selected) } return this }; dhtmlXToolbarObject.prototype._buttonInputObject = function(g, l, h) { this.id = g.idPrefix + l; this.obj = document.createElement("DIV"); this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; this.obj.style.display = (h.hidden != null ? "none" : ""); this.obj.idd = String(l); this.obj.w = (h.width != null ? h.width : 100); this.obj.title = (h.title != null ? h.title : ""); this.obj.innerHTML = ""; var c = g; var a = this; this.obj.childNodes[0].onkeydown = function(m) { m = m || event; if (m.keyCode == 13) { c.callEvent("onEnter", [a.obj.idd, this.value]) } }; g.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(m) { this.obj.childNodes[0].value = m }; this.getValue = function() { return this.obj.childNodes[0].value }; this.setWidth = function(m) { this.obj.w = m; this.obj.childNodes[0].style.width = this.obj.w + "px" }; this.getWidth = function() { return this.obj.w }; this.setItemToolTip = function(m) { this.obj.title = m }; this.getItemToolTip = function() { return this.obj.title }; this.getInput = function() { return this.obj.firstChild }; if (typeof(h.enabled) != "undefined" && window.dhx4.s2b(h.enabled) == false) { this.disableItem() } return this }; dhtmlXToolbarObject.prototype._buttonTwoStateObject = function(a, h, c) { this.id = a.idPrefix + h; 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(h); 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 g = this; this.obj.onselectstart = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } }; this.obj.onmouseover = function() { this._doOnMouseOver() }; this.obj.onmouseout = function() { this._doOnMouseOut() }; this.obj._doOnMouseOver = function() { if (g.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 (g.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(l) { if (a.checkEvent("onBeforeStateChange")) { if (!a.callEvent("onBeforeStateChange", [this.idd.replace(a.idPrefix, ""), this.pressed])) { return } } if (g.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 m = this.idd.replace(a.idPrefix, ""); if (this.extAction) { try { window[this.extAction](m, this.pressed) } catch (l) {} } a.callEvent("onStateChange", [m, this.pressed]); return false }; this.setItemState = function(l, n) { if (this.obj.pressed != l) { if (l == 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 (n == true) { var o = this.obj.idd.replace(a.idPrefix, ""); if (this.obj.extAction) { try { window[this.obj.extAction](o, this.obj.pressed) } catch (m) {} } a.callEvent("onStateChange", [o, 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(l) { a._setItemText(this, l) }; this.getItemText = function() { return a._getItemText(this) }; this.setItemImage = function(l) { a._setItemImage(this, l, true) }; this.clearItemImage = function() { a._clearItemImage(this, true) }; this.setItemImageDis = function(l) { a._setItemImage(this, l, false) }; this.clearItemImageDis = function() { a._clearItemImage(this, false) }; this.setItemToolTip = function(l) { this.obj.title = l }; this.getItemToolTip = function() { return this.obj.title }; return this }; dhtmlXToolbarObject.prototype._sliderObject = function(h, m, l) { this.id = h.idPrefix + m; this.state = (l.enabled != null ? (l.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 = (l.hidden != null ? "none" : ""); this.obj.onselectstart = function(n) { n = n || event; if (n.preventDefault) { n.preventDefault() } else { n.returnValue = false } }; this.obj.idd = String(m); this.obj.len = (l.length != null ? Number(l.length) : 50); this.obj.innerHTML = "
" + (l.textMin || "") + "
" + (l.textMax || "") + "
"; h.base.appendChild(this.obj); var a = this; this.pen = document.createElement("DIV"); this.pen.className = "dhxtoolbar_sl_pen"; this.obj.appendChild(this.pen); var g = this.pen; this.label = document.createElement("DIV"); this.label.dir = "ltr"; this.label.className = "dhx_toolbar_slider_label_" + h.conf.skin + (h.rtl ? "_rtl" : ""); this.label.style.display = "none"; this.label.tip = (l.toolTip || "%v"); this.label._zi = window.dhx4.newId(); document.body.appendChild(this.label); var c = this.label; this.pen.valueMin = (l.valueMin != null ? Number(l.valueMin) : 0); this.pen.valueMax = (l.valueMax != null ? Number(l.valueMax) : 100); if (this.pen.valueMin > this.pen.valueMax) { this.pen.valueMin = this.pen.valueMax } this.pen.valueNow = (l.valueNow != null ? Number(l.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(n) { if (a.state == false) { return } n = n || event; this.initXY = (window.dhx4.isIPad ? n.touches[0].clientX : n.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(o) { o = o || event; if (!g.allowMove) { return } var n = (window.dhx4.isIPad ? o.touches[0].clientX : o.clientX); var q = n - g.initXY; if (n < window.dhx4.absLeft(g) + Math.round(g.offsetWidth / 2) && g.nowX == g.minX) { return } if (n > window.dhx4.absLeft(g) + Math.round(g.offsetWidth / 2) && g.nowX == g.maxX) { return } g.newNowX = g.nowX + q; if (g.newNowX < g.minX) { g.newNowX = g.minX } if (g.newNowX > g.maxX) { g.newNowX = g.maxX } g.nowX = g.newNowX; g.style.left = g.nowX + "px"; g.initXY = n; g.newValueNow = Math.round((g.valueMax - g.valueMin) * (g.newNowX - g.minX) / (g.maxX - g.minX) + g.valueMin); if (c.tip != "") { c.innerHTML = c.tip.replace(/%v/gi, g.newValueNow); c.style.left = Math.round(window.dhx4.absLeft(g) + g.offsetWidth / 2 - c.offsetWidth / 2) + "px"; c.style.top = window.dhx4.absTop(g) - c.offsetHeight - 3 + "px" } o.cancelBubble = true; if (o.preventDefault) { o.preventDefault() } else { o.returnValue = false } return false }; this.pen._doOnMouseMoveEnd = function() { if (!g.allowMove) { return } g.className = "dhxtoolbar_sl_pen"; g.allowMove = false; g.nowX = g.newNowX; g.valueNow = g.newValueNow; if (c.tip != "") { c.style.display = "none"; window.dhx4.zim.clear(c._zi) } h.callEvent("onValueChange", [a.obj.idd.replace(h.idPrefix, ""), g.valueNow]) }; if (window.dhx4.isIPad) { document.addEventListener("touchmove", g._doOnMouseMoveStart, false); document.addEventListener("touchend", g._doOnMouseMoveEnd, false) } else { if (typeof(window.addEventListener) != "undefined") { window.addEventListener("mousemove", g._doOnMouseMoveStart, false); window.addEventListener("mouseup", g._doOnMouseMoveEnd, false) } else { document.body.attachEvent("onmousemove", g._doOnMouseMoveStart); document.body.attachEvent("onmouseup", g._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(n, o) { n = Number(n); if (n < this.pen.valueMin) { n = this.pen.valueMin } if (n > this.pen.valueMax) { n = this.pen.valueMax } this.pen.valueNow = n; this.pen._definePos(); if (o == true) { h.callEvent("onValueChange", [this.obj.idd.replace(h.idPrefix, ""), this.pen.valueNow]) } }; this.getValue = function() { return this.pen.valueNow }; this.setMinValue = function(o, n) { o = Number(o); if (o > this.pen.valueMax) { return } this.obj.childNodes[0].innerHTML = n; this.obj.childNodes[0].style.display = (n.length > 0 ? "" : "none"); this.pen.valueMin = o; if (this.pen.valueNow < this.pen.valueMin) { this.pen.valueNow = this.pen.valueMin } this.pen._detectLimits(); this.pen._definePos() }; this.setMaxValue = function(o, n) { o = Number(o); if (o < this.pen.valueMin) { return } this.obj.childNodes[4].innerHTML = n; this.obj.childNodes[4].style.display = (n.length > 0 ? "" : "none"); this.pen.valueMax = o; if (this.pen.valueNow > this.pen.valueMax) { this.pen.valueNow = this.pen.valueMax } this.pen._detectLimits(); this.pen._definePos() }; this.getMinValue = function() { var n = this.obj.childNodes[0].innerHTML; var o = this.pen.valueMin; return new Array(o, n) }; this.getMaxValue = function() { var n = this.obj.childNodes[4].innerHTML; var o = this.pen.valueMax; return new Array(o, n) }; this.setItemToolTipTemplate = function(n) { this.label.tip = n }; 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(v) { var o = []; var A = v.getElementsByTagName("toolbar"); if (A != null && A[0] != null) { A = A[0]; var E = ["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 < A.childNodes.length; c++) { if (A.childNodes[c].tagName == "item") { var n = {}; for (var C = 0; C < E.length; C++) { var l = A.childNodes[c].getAttribute(E[C]); if (l != null) { n[E[C]] = l } } for (var y = 0; y < A.childNodes[c].childNodes.length; y++) { if (A.childNodes[c].childNodes[y].tagName == "item" && n.type == "buttonSelect") { var D = {}; for (var C = 0; C < g.length; C++) { var l = A.childNodes[c].childNodes[y].getAttribute(g[C]); if (l != null) { D[g[C]] = l } } var x = A.childNodes[c].childNodes[y].getElementsByTagName("itemText"); if (x != null && x[0] != null) { D.itemText = x[0].firstChild.nodeValue } var s = A.childNodes[c].childNodes[y].getElementsByTagName("userdata"); for (var C = 0; C < s.length; C++) { if (!D.userdata) { D.userdata = {} } var a = {}; try { a.name = s[C].getAttribute("name") } catch (m) { a.name = null } try { a.value = s[C].firstChild.nodeValue } catch (m) { a.value = "" } if (a.name != null) { D.userdata[a.name] = a.value } } if (n.options == null) { n.options = [] } n.options.push(D) } if (A.childNodes[c].childNodes[y].tagName == "userdata") { if (n.userdata == null) { n.userdata = {} } var D = {}; try { D.name = A.childNodes[c].childNodes[y].getAttribute("name") } catch (m) { D.name = null } try { D.value = A.childNodes[c].childNodes[y].firstChild.nodeValue } catch (m) { D.value = "" } if (D.name != null) { n.userdata[D.name] = D.value } } } o.push(n) } } } return o }; dhtmlXToolbarObject.prototype._addItemToStorage = function(m, o) { var n = (m.id || this._genStr(24)); var h = (m.type || ""); if (h != "" && this["_" + h + "Object"] != null) { if (h == "buttonSelect") { if (m.options != null) { for (var l = 0; l < m.options.length; l++) { if (m.options[l].type == "obj") { m.options[l].type = "button" } if (m.options[l].type == "sep") { m.options[l].type = "separator" } } } } if (h == "slider") { var g = { tip_template: "toolTip", value_min: "valueMin", value_max: "valueMax", value_now: "valueNow", text_min: "textMin", text_max: "textMax" }; for (var c in g) { if (m[g[c]] == null && m[c] != null) { m[g[c]] = m[c] } } } if (h == "buttonInput") { if (m.value == null && m.text != null) { m.value = m.text } } if (h == "buttonTwoState") { if (typeof(m.selected) == "undefined" && typeof(m.pressed) != "undefined" && window.dhx4.s2b(m.pressed)) { m.selected = true } } if (typeof(m.enabled) == "undefined" && typeof(m.disabled) != "undefined" && window.dhx4.s2b(m.disabled)) { m.enabled = false } if (m.imgDis == null && m.img_disabled != null) { m.imgdis = m.img_disabled } if ((typeof(m.openAll) == "undefined" || m.openAll == null) && this.conf.skin == "dhx_terrace") { m.openAll = true } this.objPull[this.idPrefix + n] = new this["_" + h + "Object"](this, n, m); this.objPull[this.idPrefix + n]["type"] = h; this.setPosition(n, o) } if (m.userdata != null) { for (var c in m.userdata) { this.setUserData(n, c, m.userdata[c]) } } if (m.options != null) { for (var l = 0; l < m.options.length; l++) { if (m.options[l].userdata != null) { for (var c in m.options[l].userdata) { this.setListOptionUserData(m.id, m.options[l].id, c, m.options[l].userdata[c]) } } } } }; dhtmlXToolbarObject.prototype.setSkin = function(l, g) { if (g === true) { this.cont.className = this.cont.className.replace(/dhxtoolbar_icons_\d{1,}/, "dhxtoolbar_icons_" + this.conf.iconSize) } else { this.conf.skin = l; 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 h = this.objPull[c]; if (h.type == "slider") { h.pen._detectLimits(); h.pen._definePos(); h.label.className = "dhx_toolbar_slider_label_" + this.conf.skin } if (h.type == "buttonSelect") { h.polygon.className = "dhx_toolbar_poly_" + this.conf.skin + " dhxtoolbar_icons_" + this.conf.iconSize } } if (l == "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(g, a, c) { g = this.idPrefix + g; if (this.objPull[g] != null) { if (this.objPull[g].userData == null) { this.objPull[g].userData = {} } this.objPull[g].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, g) { 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[g] == null) { return false } return true }; dhtmlXToolbarObject.prototype.setListOptionUserData = function(a, l, c, h) { if (!this._isListOptionExists(a, l)) { return } var g = this.objPull[this.idPrefix + a]._listOptions[l]; if (g.userData == null) { g.userData = {} } g.userData[c] = h }; dhtmlXToolbarObject.prototype.getListOptionUserData = function(a, h, c) { if (!this._isListOptionExists(a, h)) { return null } var g = this.objPull[this.idPrefix + a]._listOptions[h]; if (!g.userData) { return null } return (g.userData[c] ? g.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 m = [this.base]; if (this._spacer != null) { m.push(this._spacer) } for (var o = 0; o < m.length; o++) { g[o] = []; for (var c = 0; c < m[o].childNodes.length; c++) { if (m[o].childNodes[c].idd != null && m[o].childNodes[c].style.display != "none") { var n = this.idPrefix + m[o].childNodes[c].idd; if (this.objPull[n] != null && this.objPull[n].obj == m[o].childNodes[c]) { g[o].push({ a: n, type: this.objPull[n].type, node: this.objPull[n][this.objPull[n].type == "buttonSelect" ? "arw" : "obj"] }) } } } m[o] = null } for (var o = 0; o < g.length; o++) { for (var c = 0; c < g[o].length; c++) { var r = g[o][c]; var s = false; var l = false; if (!h[r.type]) { if (c == g[o].length - 1 || (g[o][c + 1] != null && h[g[o][c + 1].type])) { s = true } if (c == 0 || (c - 1 >= 0 && g[o][c - 1] != null && h[g[o][c - 1].type])) { l = true } } r.node.style.borderRightWidth = (s ? "1px" : "0px"); r.node.style.borderTopRightRadius = r.node.style.borderBottomRightRadius = (s ? this.conf.terrace_radius : "0px"); if (r.type == "buttonSelect") { r.node.previousSibling.style.borderTopLeftRadius = r.node.previousSibling.style.borderBottomLeftRadius = (l ? this.conf.terrace_radius : "0px"); r.node.previousSibling._br = s; r.node.previousSibling._bl = l } else { r.node.style.borderTopLeftRadius = r.node.style.borderBottomLeftRadius = (l ? this.conf.terrace_radius : "0px") } r.node._br = s; r.node._bl = l } } for (var o = 0; o < g.length; o++) { for (var c = 0; c < g[o].length; c++) { for (var n in g[o][c]) { g[o][c][n] = null } g[o][c] = null } g[o] = null } g = m = null }; dhtmlXToolbarObject.prototype._improveTerraceButtonSelect = function(g, c) { var a = this.objPull[g]; 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 }; function dhtmlXEditor(g, h) { 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"] }; this._doOnFocusChanged = null; this._doOnAccess = null; if (typeof(g) == "object" && g != null && g.tagName == null) { h = g.skin; if (g.content != null) { this.conf.content = g.content } if (g.contentHTML != null) { this.conf.contentHTML = g.contentHTML } if (g.iconsPath != null) { this.conf.iconsPath = g.iconsPath } if (g.toolbar != null) { this.conf.toolbar = window.dhx4.s2b(g.toolbar) } if (g.onFocusChanged != null) { this._doOnFocusChanged = g.onFocusChanged } if (g.onAccess != null) { this._doOnAccess = g.onAccess } g = g.parent } this.conf.skin = (h || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxeditor") || "dhx_skyblue"); if (typeof(g) == "string") { g = document.getElementById(g) } this.base = g; this.base.className += " dhxeditor_" + this.conf.skin; while (this.base.childNodes.length > 0) { this.base.removeChild(this.base.childNodes[0]) } var l = (window.dhx4.isIE ? this.base.currentStyle.position : window.getComputedStyle(this.base, null).getPropertyValue("position")); if (!(l == "relative" || l == "absolute")) { this.base.style.position = "relative" } this.cell = new dhtmlXEditorCell(window.dhx4.newId(), this); this.base.appendChild(this.cell.cell); this.setSizes(); 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" } var a = this.editor; if (typeof(window.addEventListener) != "undefined") { a.onload = function() { for (var m = 0; m < c.conf.evs.length; m++) { a.contentWindow.addEventListener(c.conf.evs[m], c._ev, false) } } } else { a.onreadystatechange = function(m) { if (typeof(a.readyState) != "undefined" && a.readyState == "complete") { try { for (var n = 0; n < c.conf.evs.length; n++) { a.contentWindow.document.body.attachEvent("on" + c.conf.evs[n], c._ev) } } catch (o) {} } } } this._ev = function(n) { n = n || event; var m = n.type; c.callEvent("onAccess", [m, n]); if (typeof(c._doOnAccess) == "function") { c._doOnAccess(m, n) } else { if (typeof(c._doOnAccess) == "string" && typeof(window[c._doOnAccess]) == "function") { window[c._doOnAccess](m, n) } } }; 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(o, r) { var n = ""; if (o === true && this.getContent != null) { n = this.getContent() } var m = this.editor.contentWindow.document; m.open("text/html", "replace"); if (window.dhx4.isOpera) { m.write("") } else { if (window.dhx4.isKHTML) { m.write("") } else { if (window.dhx4.isIE) { m.write("") } else { m.write("") } } } m.close(); if (window.dhx4.isIE) { m.contentEditable = (r !== true) } else { m.designMode = (r !== true ? "On" : "Off") } if (window.dhx4.isFF) { try { m.execCommand("useCSS", false, true) } catch (q) {} } if (o === true && this.setContent != null) { this.setContent(n) } }; 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(o, r) { if (this.conf.roMode === true) { return } if (arguments.length < 2) { r = null } if (window.dhx4.isIE) { this.edWin.focus() } try { var n = this.editor.contentWindow.document; n.execCommand(o, false, r) } catch (q) {} if (window.dhx4.isIE) { this.edWin.focus(); var m = this; window.setTimeout(function() { m.edWin.focus(); m = 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") }; this._doOnClick = function(o) { var n = o || window.event; var m = n.target || n.srcElement; c._showInfo(m) }; this._doOnMouseDown = function(o) { var n = o || window.event; var m = n.target || n.srcElement; c._showInfo(m) }; this._doOnKeyUp = function(q) { var o = q || window.event; var m = o.keyCode; var n = o.target || o.srcElement; if ({ 37: 1, 38: 1, 39: 1, 40: 1, 13: 1 }[m] == 1) { c._showInfo(n) } }; this._getParentByTag = function(m, o) { o = o.toLowerCase(); var n = m; do { if (o == "" || n.nodeName.toLowerCase() == o) { return n } } while (n = n.parentNode); return m }; this._isStyleProperty = function(o, r, m, q) { r = r.toLowerCase(); var s = o; do { if ((s.nodeName.toLowerCase() == r) && (s.style[m] == q)) { return true } } while (s = s.parentNode); return false }; this._setStyleProperty = function(m, q) { this.style[q] = false; var o = this._getParentByTag(m, q); if (o && (o.tagName.toLowerCase() == q)) { this.style[q] = true } if (q == "del" && this._getParentByTag(m, "strike") && this._getParentByTag(m, "strike").tagName.toLowerCase() == "strike") { this.style.del = true } }; this._showInfo = function(n) { var n = (this._getSelectionBounds().end) ? this._getSelectionBounds().end : n; if (!n || !this._setStyleProperty) { return } try { if (this.edWin.getComputedStyle) { var m = this.edWin.getComputedStyle(n, null); var o = ((m.getPropertyValue("font-weight") == 401) ? 700 : m.getPropertyValue("font-weight")); this.style = { fontStyle: m.getPropertyValue("font-style"), fontSize: m.getPropertyValue("font-size"), textDecoration: m.getPropertyValue("text-decoration"), fontWeight: o, fontFamily: m.getPropertyValue("font-family"), textAlign: m.getPropertyValue("text-align") }; if (window.dhx4.isKHTML) { this.style.fontStyle = m.getPropertyValue("font-style"); this.style.vAlign = m.getPropertyValue("vertical-align"); this.style.del = this._isStyleProperty(n, "span", "textDecoration", "line-through"); this.style.u = this._isStyleProperty(n, "span", "textDecoration", "underline") } } else { var m = n.currentStyle; this.style = { fontStyle: m.fontStyle, fontSize: m.fontSize, textDecoration: m.textDecoration, fontWeight: m.fontWeight, fontFamily: m.fontFamily, textAlign: m.textAlign } } this._setStyleProperty(n, "h1"); this._setStyleProperty(n, "h2"); this._setStyleProperty(n, "h3"); this._setStyleProperty(n, "h4"); if (!window.dhx4.isKHTML) { this._setStyleProperty(n, "del"); this._setStyleProperty(n, "sub"); this._setStyleProperty(n, "sup"); this._setStyleProperty(n, "u") } this.callEvent("onFocusChanged", [this.style, m]) } catch (q) { return null } }; this._getSelectionBounds = function() { var r, o, u, n; if (this.edWin.getSelection) { var s = this.edWin.getSelection(); r = s.getRangeAt(s.rangeCount - 1); u = r.startContainer; n = r.endContainer; o = r.commonAncestorContainer; if (u.nodeName == "#text") { o = o.parentNode } if (u.nodeName == "#text") { u = u.parentNode } if (u.nodeName.toLowerCase() == "body") { u = u.firstChild } if (n.nodeName == "#text") { n = n.parentNode } if (n.nodeName.toLowerCase() == "body") { n = n.lastChild } if (u == n) { o = u } return { root: o, start: u, end: n } } else { if (this.edWin.document.selection) { r = this.edDoc.selection.createRange(); if (!r.duplicate) { return null } o = r.parentElement(); var q = r.duplicate(); var m = r.duplicate(); q.collapse(true); m.moveToElementText(q.parentElement()); m.setEndPoint("EndToStart", q); u = q.parentElement(); q = r.duplicate(); m = r.duplicate(); m.collapse(false); q.moveToElementText(m.parentElement()); q.setEndPoint("StartToEnd", m); n = m.parentElement(); if (u.nodeName.toLowerCase() == "body") { u = u.firstChild } if (n.nodeName.toLowerCase() == "body") { n = n.lastChild } if (u == n) { o = u } return { root: o, start: u, end: n } } } 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(o) { o = o || ""; if (this.edDoc.body) { var n = false; if (window.dhx4.isFF) { var m = navigator.userAgent.match(/Firefox\/(\d*)/); n = (m != null && m[1] < 28) } if (n) { 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 = o } else { this.editor.contentWindow.document.body.innerHTML = ""; if (o.length == 0) { o = " " } this._runCommand("InsertHTML", o) } } else { this.editor.contentWindow.document.body.innerHTML = o } this.callEvent("onContentSet", []) } else { if (!this.conf.firstLoadEv) { this.conf.firstLoadEv = true; this.conf.firstLoadData = o; 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(m) { window.dhx4.ajax.get(m, function(n) { if (n.xmlDoc.responseText != null) { c.setContent(n.xmlDoc.responseText) } }) }; window.dhx4._eventable(this); this.attachEvent("onFocusChanged", function(m) { if (typeof(this._doOnFocusChanged) == "function") { this._doOnFocusChanged(m) } else { if (typeof(this._doOnFocusChanged) == "string" && typeof(window[this._doOnFocusChanged]) == "function") { window[this._doOnFocusChanged](m) } } }); 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 m = 0; m < c.conf.evs.length; m++) { a.contentWindow.removeEventListener(c.conf.evs[m], c._ev, false) } } else { window.detachEvent("onresize", this._doOnResize, false); this.edDoc.detachEvent("onclick", this._doOnClick); this.edDoc.detachEvent("onkeyup", this._doOnKeyUp); for (var m = 0; m < c.conf.evs.length; m++) { a.contentWindow.document.body.detachEvent("on" + c.conf.evs[m], 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) } this.setIconsPath = function(m) { this.conf.iconsPath = m }; 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) }; 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(g, a) { dhtmlXCellObject.apply(this, [g, "_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 m = this; var l = document.createElement("DIV"); l.className = "dhx_cell_stb"; this.cell.insertBefore(l, this.cell.childNodes[this.conf.idx.cont]); l.onselectstart = function(a) { a = a || event; a.cancelBubble = true; if (a.preventDefault) { a.preventDefault() } else { a.returnValue = false } return false }; var h = { bold: "applyBold", italic: "applyItalic", underline: "applyUnderscore", clearformat: "clearFormatting" }; for (var g in h) { var c = document.createElement("A"); c.href = "javascript:void(0);"; c.tabIndex = -1; l.appendChild(c); c.onmousedown = c.onclick = function(a) { a = a || event; if (a.preventDefault) { a.preventDefault() } else { a.returnValue = false } return false }; var n = document.createElement("DIV"); n.className = "dhx_cell_stb_button btn_" + g; n._actv = g.charAt(0); n._cmd = h[g]; c.appendChild(n); n.onclick = function(a) { a = a || event; if (a.preventDefault) { a.preventDefault() } else { a.returnValue = false } return false }; n.onmousedown = function(a) { a = a || event; if (a.preventDefault) { a.preventDefault() } else { a.returnValue = false } m.editor[this._cmd](); m.editor.callEvent("onToolbarClick", [this._actv]) }; n = c = null } l = 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 = m = 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 }; 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 m = 0; m < this._availFonts.length; m++) { var h = String(this._availFonts[m]).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 g 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(o) { if (!o.h1 && !o.h2 && !o.h3 && !o.h4) { var a = (String(o.fontWeight).search(/bold/i) != -1) || (Number(o.fontWeight) >= 700); this.tb.setItemState("applyBold", a) } else { this.tb.setItemState("applyBold", false) } var n = "alignLeft"; if (String(o.textAlign).search(/center/) != -1) { n = "alignCenter" } if (String(o.textAlign).search(/right/) != -1) { n = "alignRight" } if (String(o.textAlign).search(/justify/) != -1) { n = "alignJustify" } this.tb.setItemState(n, true); this._checkAlign(n); this.tb.setItemState("applyH1", o.h1); this.tb.setItemState("applyH2", o.h2); this.tb.setItemState("applyH3", o.h3); this.tb.setItemState("applyH4", o.h4); if (window._KHTMLrv) { o.sub = (o.vAlign == "sub"); o.sup = (o.vAlign == "super") } this.tb.setItemState("applyItalic", (o.fontStyle == "italic")); this.tb.setItemState("applyStrikethrough", o.del); this.tb.setItemState("applySub", o.sub); this.tb.setItemState("applySuper", o.sup); this.tb.setItemState("applyUnderscore", o.u) }; this._doOnToolbarClick = function(n) { var a = String(n).split(":"); if (this[a[0]] != null) { if (typeof(this[a[0]]) == "function") { this[a[0]](a[1]); this.callEvent("onToolbarClick", [n]) } } }; this._doOnStateChange = function(n, a) { this[n](); switch (n) { case "alignLeft": case "alignCenter": case "alignRight": case "alignJustify": this._checkAlign(n); break; case "applyH1": case "applyH2": case "applyH3": case "applyH4": this._checkH(n); break } this.callEvent("onToolbarClick", [n]) }; this._doOnBeforeStateChange = function(n, a) { if ((n == "alignLeft" || n == "alignCenter" || n == "alignRight" || n == "alignJustify") && a == true) { return false } return true }; var l = this; this.tb.attachEvent("onClick", function(a) { l._doOnToolbarClick(a) }); this.tb.attachEvent("onStateChange", function(n, a) { l._doOnStateChange(n, a) }); this.tb.attachEvent("onBeforeStateChange", function(n, a) { return l._doOnBeforeStateChange(n, 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) } }; 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.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 g = 0; a.each(function(h) { g += c(h) * 1 }); return g }, min: function(g, c) { g = dhtmlx.Template.setter(g); c = c || this.data; var a = Infinity; c.each(function(h) { if (g(h) * 1 < a) { a = g(h) * 1 } }); return a * 1 }, max: function(g, c) { g = dhtmlx.Template.setter(g); c = c || this.data; var a = -Infinity; c.each(function(h) { if (g(h) * 1 > a) { a = g(h) * 1 } }); return a }, _split_data_by: function(l) { var m = function(r, q) { r = dhtmlx.Template.setter(r); return r(q[0]) }; var h = dhtmlx.Template.setter(l.by); if (!l.map[h]) { l.map[h] = [h, m] } var a = {}; var o = []; this.data.each(function(q) { var r = h(q); if (!a[r]) { o.push({ id: r }); a[r] = dhtmlx.toArray() } a[r].push(q) }); for (var n in l.map) { var c = (l.map[n][1] || m); if (typeof c != "function") { c = this[c] } for (var g = 0; g < o.length; g++) { o[g][n] = c.call(this, l.map[n][0], a[o[g].id]) } } this._not_grouped_data = this.data; this.data = new dhtmlx.DataStore(); this.data.provideApi(this, true); this._init_group_data_event(this.data, this); this.parse(o, "json") }, group: function(a, c) { this.ungroup(false); this._split_data_by(a); if (c !== false) { this.render() } }, ungroup: function(a) { if (this._not_grouped_data) { this.data = this._not_grouped_data; this.data.provideApi(this, true) } if (a !== false) { this.render() } }, 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, g, h) { var a = new Date(c.valueOf()); switch (h) { case "day": a.setDate(a.getDate() + g); break; case "week": a.setDate(a.getDate() + 7 * g); break; case "month": a.setMonth(a.getMonth() + g); break; case "year": a.setYear(a.getFullYear() + g); break; case "hour": a.setHours(a.getHours() + g); break; case "minute": a.setMinutes(a.getMinutes() + g); break; default: return dhtmlx.Date["add_" + h](c, g, h) } 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(g) { switch (g) { 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 g } }); if (a) { c = c.replace(/date\.get/g, "date.getUTC") } return new Function("date", 'return "' + c + '";') }, str_to_date: function(l, g) { var m = "var temp=date.split(/[^0-9a-zA-Z]+/g);"; var a = l.match(/%[a-zA-Z]/g); for (var c = 0; c < a.length; c++) { switch (a[c]) { case "%j": case "%d": m += "set[2]=temp[" + c + "]||1;"; break; case "%n": case "%m": m += "set[1]=(temp[" + c + "]||1)-1;"; break; case "%y": m += "set[0]=temp[" + c + "]*1+(temp[" + c + "]>50?1900:2000);"; break; case "%g": case "%G": case "%h": case "%H": m += "set[3]=temp[" + c + "]||0;"; break; case "%i": m += "set[4]=temp[" + c + "]||0;"; break; case "%Y": m += "set[0]=temp[" + c + "]||0;"; break; case "%a": case "%A": m += "set[3]=set[3]%12+((temp[" + c + "]||'').toLowerCase()=='am'?0:12);"; break; case "%s": m += "set[5]=temp[" + c + "]||0;"; break } } var h = "set[0],set[1],set[2],set[3],set[4],set[5]"; if (g) { h = " Date.UTC(" + h + ")" } return new Function("date", "var set=[0,0,1,0,0,0]; " + m + " return new Date(" + h + ");") }, getISOWeek: function(g) { if (!g) { return false } var c = g.getDay(); if (c === 0) { c = 7 } var h = new Date(g.valueOf()); h.setDate(g.getDate() + (4 - c)); var a = h.getFullYear(); var m = Math.floor((h.getTime() - new Date(a, 0, 1).getTime()) / 86400000); var l = 1 + Math.floor(m / 7); return l }, 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 l, h, a, m; if (typeof(c) != "string") { l = c[0]; h = c[1]; a = c[2] } else { if (c.indexOf("rgb") != -1) { m = c.substr(c.indexOf("(") + 1, c.lastIndexOf(")") - c.indexOf("(") - 1).split(","); l = m[0]; h = m[1]; a = m[2] } else { if (c.substr(0, 1) == "#") { c = c.substr(1) } l = this.hexToDec(c.substr(0, 2)); h = this.hexToDec(c.substr(2, 2)); a = this.hexToDec(c.substr(4, 2)) } } l = (parseInt(l, 10) || 0); h = (parseInt(h, 10) || 0); a = (parseInt(a, 10) || 0); if (l < 0 || l > 255) { l = 0 } if (h < 0 || h > 255) { h = 0 } if (a < 0 || a > 255) { a = 0 } return [l, h, a] }; dhtmlx.math.hsvToRgb = function(n, A, x) { var m, u, l, c, y, a, o, w; m = Math.floor((n / 60)) % 6; u = n / 60 - m; l = x * (1 - A); c = x * (1 - u * A); y = x * (1 - (1 - u) * A); a = 0; o = 0; w = 0; switch (m) { case 0: a = x; o = y; w = l; break; case 1: a = c; o = x; w = l; break; case 2: a = l; o = x; w = y; break; case 3: a = l; o = c; w = x; break; case 4: a = y; o = l; w = x; break; case 5: a = x; o = l; w = c; break } a = Math.floor(a * 255); o = Math.floor(o * 255); w = Math.floor(w * 255); return [a, o, w] }; dhtmlx.math.rgbToHsv = function(c, o, q) { var m, l, u, a, w, y, n, x; m = c / 255; l = o / 255; u = q / 255; var a = Math.min(m, l, u); var w = Math.max(m, l, u); n = 0; y = w == 0 ? 0 : (1 - a / w); x = w; if (w == a) { n = 0 } else { if (w == m && l >= u) { n = 60 * (l - u) / (w - a) + 0 } else { if (w == m && l < u) { n = 60 * (l - u) / (w - a) + 360 } else { if (w == l) { n = 60 * (u - m) / (w - a) + 120 } else { if (w == u) { n = 60 * (m - l) / (w - a) + 240 } } } } } return [n, y, x] }; 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 = [] }; dhtmlx.ui.Map.prototype = { addRect: function(g, c, a) { this._createMapArea(g, "RECT", c, a) }, addPoly: function(g, c, a) { this._createMapArea(g, "POLY", c, a) }, _createMapArea: function(l, c, h, g) { var a = ""; if (arguments.length == 4) { a = "userdata='" + g + "'" } this._map.push("") }, addSector: function(a, r, q, n, l, g, h, m) { var o = []; o.push(n); o.push(Math.floor(l * h)); for (var c = r; c < q; c += Math.PI / 18) { o.push(Math.floor(n + g * Math.cos(c))); o.push(Math.floor((l + g * Math.sin(c)) * h)) } o.push(Math.floor(n + g * Math.cos(q))); o.push(Math.floor((l + g * Math.sin(q)) * h)); o.push(n); o.push(Math.floor(l * h)); return this.addPoly(a, o, m) }, render: function(a) { var g = dhtmlx.html.create("DIV"); g.style.cssText = "position:absolute; width:100%; height:100%; top:0px; left:0px;"; a.appendChild(g); var c = dhtmlx._isIE ? "" : "src='data:image/gif;base64,R0lGODlhEgASAIAAAP///////yH5BAUUAAEALAAAAAASABIAAAIPjI+py+0Po5y02ouz3pwXADs='"; g.innerHTML = "" + this._map.join("\n") + ""; a._htmlmap = g; this._map = [] } }; dhtmlx.chart = {}; dhtmlx.chart.scatter = { pvt_render_scatter: function(r, m, q, o, n, a) { if (!this._settings.xValue) { return dhtmlx.log("warning", "Undefined propery: xValue") } var g = this._getLimits(); var l = this._getLimits("h", "xValue"); if (!n) { 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(), m, q, o, g.min, g.max); this._drawHXAxis(this.canvases.x.getCanvas(), m, q, o, l.min, l.max) } g = { min: this._settings.yAxis.start, max: this._settings.yAxis.end }; l = { min: this._settings.xAxis.start, max: this._settings.xAxis.end }; var c = this._getScatterParams(r, m, q, o, l, g); this._mapStart = q; for (var h = 0; h < m.length; h++) { this._drawScatterItem(r, a, q, o, c, l, g, m[h], n) } }, _getScatterParams: function(a, h, g, c, n, m) { var l = {}; l.totalHeight = c.y - g.y; l.totalWidth = c.x - g.x; this._calcScatterUnit(l, n.min, n.max, l.totalWidth, "X"); this._calcScatterUnit(l, m.min, m.max, l.totalHeight, "Y"); return l }, _drawScatterItem: function(s, a, q, o, g, l, h, m, n) { var c = this._calculateScatterItemPosition(g, o, q, l, m, "X"); var r = this._calculateScatterItemPosition(g, q, o, h, m, "Y"); this._drawItem(s, c, r, m, this._settings.label.call(this, m), n, a) }, _calculateScatterItemPosition: function(g, o, n, a, l, c) { var r = this._settings[c == "X" ? "xValue" : "value"].call(this, l); var h = g["valueFactor" + c]; var s = (parseFloat(r || 0) - a.min) * h; var q = g["unit" + c]; var m = n[c.toLowerCase()] - (c == "X" ? (-1) : 1) * Math.floor(q * s); if (s < 0) { m = n[c.toLowerCase()] } if (r > a.max) { m = o[c.toLowerCase()] } if (r < a.min) { m = n[c.toLowerCase()] } return m }, _calcScatterUnit: function(m, g, a, c, h) { var l = this._getRelativeValue(g, a); h = (h || ""); m["relValue" + h] = l[0]; m["valueFactor" + h] = l[1]; m["unit" + h] = (m["relValue" + h] ? c / m["relValue" + h] : 10) } }; dhtmlx.chart.radar = { pvt_render_radar: function(c, h, a, m, g, l) { this._renderRadarChart(c, h, a, m, g, l) }, _renderRadarChart: function(v, l, s, r, q, a) { if (!l.length) { return } var n = this._getPieParameters(s, r); var o = (this._settings.radius ? this._settings.radius : n.radius); var c = (this._settings.x ? this._settings.x : n.x); var u = (this._settings.y ? this._settings.y : n.y); var g = []; for (var h = 0; h < l.length; h++) { g.push(1) } var m = this._getRatios(g, l.length); this._mapStart = s; if (!q) { this._drawRadarAxises(m, c, u, o, l) } this._drawRadarData(v, m, c, u, o, l, q, a) }, _drawRadarData: function(D, u, o, n, l, O, E, N) { var C, w, M, K, F, J, h, g, H, L, I, v, c, A, r, q, a, s, m; M = this._settings; F = M.yAxis.start; J = M.yAxis.end; m = this._getRelativeValue(F, J); v = m[0]; s = (v ? l / v : l / 2); a = m[1]; c = -Math.PI / 2; C = w = c; H = []; g = 0; for (K = 0; K < O.length; K++) { if (!q) { A = M.value(O[K]); r = (parseFloat(A || 0) - F) * a } else { r = q } L = Math.floor(s * r); A = M.value((K != (O.length - 1)) ? O[K + 1] : O[0]); q = (parseFloat(A || 0) - F) * a; I = Math.floor(s * q); C = w; w = ((K != (O.length - 1)) ? (c + u[K] - 0.0001) : c); h = (g || this._getPositionByAngle(C, o, n, L)); g = this._getPositionByAngle(w, o, n, I); H.push(h) } if (M.fill) { this._fillRadarChart(D, H, O) } if (!M.disableLines) { this._strokeRadarChart(D, H, O) } if (!M.disableItems) { this._drawRadarItemMarkers(D, H, O, E, N) } H = null }, _drawRadarItemMarkers: function(a, g, l, h, m) { for (var c = 0; c < g.length; c++) { this._drawItem(a, g[c].x, g[c].y, l[c], this._settings.label.call(this, l), h, m) } }, _fillRadarChart: function(a, h, m) { var l, g; a.globalAlpha = this._settings.alpha.call(this, {}); a.beginPath(); for (var c = 0; c < h.length; c++) { a.fillStyle = this._settings.fill.call(this, m[c]); l = h[c]; g = (h[c + 1] || h[0]); if (!c) { a.moveTo(l.x, l.y) } a.lineTo(g.x, g.y) } a.fill(); a.globalAlpha = 1 }, _strokeRadarChart: function(a, h, m) { var l, g; for (var c = 0; c < h.length; c++) { l = h[c]; g = (h[c + 1] || h[0]); this._drawLine(a, l.x, l.y, g.x, g.y, this._settings.line.color.call(this, m[c]), this._settings.line.width) } }, _drawRadarAxises: function(C, w, v, n, P) { var a = this._settings.yAxis; var h = this._settings.xAxis; var o = a.start; var m = 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); o = D.start; m = D.end; r = D.step; a.end = m; a.start = o } var J = []; var M, L, E; var N = 0; var g = n * r / (m - o); var u, A; if (r < 1) { u = Math.min(this._log10(r), (o <= 0 ? 0 : this._log10(o))); 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 = m; M >= o; M -= r) { if (D.fixNum) { M = parseFloat((new Number(M)).toFixed(D.fixNum)) } J.push(Math.floor(N * g) + 0.5); if (A) { M = Math.round(M * A) / A } var q = v - n + J[J.length - 1]; this.canvases.scale.renderTextAt("middle", "left", w, q, a.template(M.toString()), "dhx_axis_item_y dhx_radar"); if (C.length < 2) { this._drawScaleSector(I, "arc", w, v, n - J[J.length - 1], -Math.PI / 2, 3 * Math.PI / 2, M); return } var l = -Math.PI / 2; var H = l; var F; for (L = 0; L < C.length; L++) { if (M == m) { K.push(H) } F = l + C[L] - 0.0001; this._drawScaleSector(I, (O.lineShape || "line"), w, v, n - 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, n); if (h.lines.call(this, P[M], M)) { this._drawLine(I, w, v, E.x, E.y, (h ? h.lineColor.call(this, P[M]) : "#cfcfcf"), 1) } this._drawRadarScaleLabel(I, w, v, n, K[M], (h ? h.template.call(this, P[M]) : " ")) } }, _drawScaleSector: function(u, m, s, q, l, c, a, h, g) { var r, o; if (l < 0) { return false } r = this._getPositionByAngle(c, s, q, l); o = this._getPositionByAngle(a, s, q, l); var n = this._settings.yAxis; if (n.bg) { u.beginPath(); u.moveTo(s, q); if (m == "arc") { u.arc(s, q, l, c, a, false) } else { u.lineTo(r.x, r.y); u.lineTo(o.x, o.y) } u.fillStyle = n.bg(h, g); u.moveTo(s, q); u.fill(); u.closePath() } if (n.lines.call(this, h)) { u.lineWidth = 1; u.beginPath(); if (m == "arc") { u.arc(s, q, l, c, a, false) } else { u.moveTo(r.x, r.y); u.lineTo(o.x, o.y) } u.strokeStyle = n.lineColor.call(this, h); u.stroke() } }, _drawRadarScaleLabel: function(A, q, n, c, o, v) { var w = this.canvases.scale.renderText(0, 0, v, "dhx_axis_radar_title", 1); var g = w.scrollWidth; var u = w.offsetHeight; var s = 0.001; var m = this._getPositionByAngle(o, q, n, c + 5); var l = 0, h = 0; if (o < 0 || o > Math.PI) { h = -u } if (o > Math.PI / 2) { l = -g } if (Math.abs(o + Math.PI / 2) < s || Math.abs(o - Math.PI / 2) < s) { l = -g / 2 } else { if (Math.abs(o) < s || Math.abs(o - Math.PI) < s) { h = -u / 2 } } w.style.top = m.y + h + "px"; w.style.left = m.x + l + "px"; w.style.width = g + "px"; w.style.whiteSpace = "nowrap" } }; dhtmlx.chart.area = { pvt_render_area: function(o, F, l, h, q, C) { var s, A, u, r, m, y, n, E, D, x, w, c, v, a, g; y = this._calculateLineParams(o, F, l, h, q); A = this._settings; r = (A.eventRadius || Math.floor(y.cellWidth / 2)); if (F.length) { n = []; x = (!A.offset ? l.x : l.x + y.cellWidth * 0.5); for (u = 0; u < F.length; u++) { m = F[u]; D = this._getPointY(m, l, h, y); v = x + y.cellWidth * u; if (D) { a = (typeof D == "object" ? D.y0 : D); if (u && this._settings.fixOverflow) { E = this._getPointY(F[u - 1], l, h, y); if (E.out && E.out == D.out) { continue } w = y.cellWidth * (u - 1) - 0.5 + x; c = (typeof E == "object" ? E.y0 : E); if (E.out) { g = (E.out == "min" ? h.y : l.y); n.push([this._calcOverflowX(w, v, c, a, g), g]) } if (D.out) { g = (D.out == "min" ? h.y : l.y); n.push([this._calcOverflowX(w, v, c, a, g), g]); if (u == (F.length - 1) && g == l.y) { n.push([v, l.y]) } } } if (!D.out) { n.push([v, a]); C.addRect(m.id, [v - r - l.x, a - r - l.y, v + r - l.x, a + r - l.y], q) } if (!A.yAxis) { s = (!A.offset && (u == F.length - 1) ? "left" : "center"); this.canvases[q].renderTextAt(false, s, v, a - A.labelOffset, A.label(m)) } } } if (n.length) { n.push([v, h.y]); n.push([n[0][0], h.y]) } o.globalAlpha = this._settings.alpha.call(this, F[0]); o.fillStyle = this._settings.color.call(this, F[0]); o.beginPath(); this._path(o, n); o.fill(); if (A.border) { o.lineWidth = A.borderWidth || 1; if (A.borderColor) { o.strokeStyle = A.borderColor.call(this, F[0]) } else { this._setBorderStyles(o, o.fillStyle) } o.beginPath(); this._path(o, n); o.stroke() } o.lineWidth = 1; o.globalAlpha = 1 } } }; dhtmlx.chart.stackedArea = { pvt_render_stackedArea: function(q, H, c, a, r, E) { var J, I, v, D, A, w, l, u, m, C, o, h, g, n; C = this._calculateLineParams(q, H, c, a, r); D = this._settings; u = (D.eventRadius || Math.floor(C.cellWidth / 2)); if (H.length) { o = []; n = []; h = (!D.offset ? c.x : c.x + C.cellWidth * 0.5); var F = function(x, K) { return r ? (H[x].$startY ? K - a.y + H[x].$startY : 0) : K }; var s = function(y, M, L) { var K = (L.y - M.y) / (L.x - M.x); return K * y + M.y - K * M.x }; for (A = 0; A < H.length; A++) { m = H[A]; if (!A) { g = F(A, a.y); o.push([h, g]) } else { h += C.cellWidth } g = F(A, this._getPointY(m, c, a, C)); n.push((isNaN(g) && !A) ? (H[A].$startY || a.y) : g); if (g) { o.push([h, g]); E.addRect(m.id, [h - u - c.x, g - u - c.y, h + u - c.x, g + u - c.y], r); if (!D.yAxis) { v = (!D.offset && l ? "left" : "center"); this.canvases[r].renderTextAt(false, v, h, g - D.labelOffset, D.label(m)) } } } o.push([h, F(A - 1, a.y)]); if (r) { for (A = H.length - 2; A > 0; A--) { h -= C.cellWidth; g = H[A].$startY; if (g) { o.push([h, g]) } } } o.push([o[0][0], o[0][1]]); q.globalAlpha = this._settings.alpha.call(this, H[0]); q.fillStyle = this._settings.color.call(this, H[0]); q.beginPath(); this._path(q, o); q.fill(); for (A = 0; A < H.length; A++) { g = n[A]; if (!g) { if (A == H.length - 1) { g = H[A].$startY } for (w = A + 1; w < H.length; w++) { if (n[w]) { J = { x: c.x, y: n[0] }; I = { x: (c.x + C.cellWidth * w), y: n[w] }; g = s(c.x + C.cellWidth * A, J, I); break } } } H[A].$startY = g } } } }; dhtmlx.chart.spline = { pvt_render_spline: function(q, I, h, g, r, H) { var F, u, o, s, E, n, m, A, w, v, l, c, a; E = this._calculateLineParams(q, I, h, g, r); F = this._settings; this._mapStart = h; o = []; if (I.length) { A = (F.offset ? h.x + E.cellWidth * 0.5 : h.x); for (u = 0; u < I.length; u++) { l = this._getPointY(I[u], h, g, E); if (l) { m = ((!u) ? A : E.cellWidth * u - 0.5 + A); o.push({ x: m, y: l, index: u }) } } n = this._getSplineParameters(o); for (u = 0; u < o.length; u++) { w = o[u].x; c = o[u].y; if (u < o.length - 1) { v = o[u + 1].x; a = o[u + 1].y; for (s = w; s < v; s++) { var D = this._getSplineYPoint(s, w, u, n.a, n.b, n.c, n.d); if (D < h.y) { D = h.y } if (D > g.y) { D = g.y } var C = this._getSplineYPoint(s + 1, w, u, n.a, n.b, n.c, n.d); if (C < h.y) { C = h.y } if (C > g.y) { C = g.y } this._drawLine(q, s, D, s + 1, C, F.line.color(I[u]), F.line.width) } this._drawLine(q, v - 1, this._getSplineYPoint(s, w, u, n.a, n.b, n.c, n.d), v, a, F.line.color(I[u]), F.line.width) } this._drawItem(q, w, c, I[o[u].index], F.label(I[o[u].index]), r, H) } } }, _getSplineParameters: function(A) { var o, D, C, E, y, x, w, r, q = [], l = [], g = A.length; for (o = 0; o < g - 1; o++) { q[o] = A[o + 1].x - A[o].x; l[o] = (A[o + 1].y - A[o].y) / q[o] } D = []; C = []; D[0] = 0; D[1] = 2 * (q[0] + q[1]); C[0] = 0; C[1] = 6 * (l[1] - l[0]); for (o = 2; o < g - 1; o++) { D[o] = 2 * (q[o - 1] + q[o]) - q[o - 1] * q[o - 1] / D[o - 1]; C[o] = 6 * (l[o] - l[o - 1]) - q[o - 1] * C[o - 1] / D[o - 1] } E = []; E[g - 1] = E[0] = 0; for (o = g - 2; o >= 1; o--) { E[o] = (C[o] - q[o] * E[o + 1]) / D[o] } y = []; x = []; w = []; r = []; for (o = 0; o < g - 1; o++) { y[o] = A[o].y; x[o] = -q[o] * E[o + 1] / 6 - q[o] * E[o] / 3 + (A[o + 1].y - A[o].y) / q[o]; w[o] = E[o] / 2; r[o] = (E[o + 1] - E[o]) / (6 * q[o]) } return { a: y, b: x, c: w, d: r } }, _getSplineYPoint: function(h, m, n, l, g, q, o) { return l[n] + (h - m) * (g[n] + (h - m) * (q[n] + (h - m) * o[n])) } }; dhtmlx.chart.barH = { pvt_render_barH: function(A, N, m, l, C, M) { var r, u, E, D, a, H, o, K, v, L, c, x, n, I, w, h, y, s, J, g, q; E = (l.y - m.y) / N.length; o = this._getLimits("h"); K = o.max; v = o.min; h = l.x - m.x; q = !! this._settings.yAxis; if (!C) { this._drawHScales(A, N, m, l, v, K, E) } if (q) { K = parseFloat(this._settings.xAxis.end); v = parseFloat(this._settings.xAxis.start) } I = this._getRelativeValue(v, K); x = I[0]; c = I[1]; s = (x ? h / x : 10); if (!q) { w = 10; s = (x ? (h - w) / x : 10) } u = parseInt(this._settings.width, 10); if ((u * this._series.length + 4) > E) { u = E / this._series.length - 4 } r = Math.floor((E - u * this._series.length) / 2); n = (typeof this._settings.radius != "undefined" ? parseInt(this._settings.radius, 10) : Math.round(u / 5)); L = false; a = this._settings.gradient; if (a && typeof(a) != "function") { L = a; a = false } else { if (a) { a = A.createLinearGradient(m.x, m.y, l.x, m.y); this._settings.gradient(a) } } if (!q) { this._drawLine(A, m.x - 0.5, m.y, m.x - 0.5, l.y, "#000000", 1) } for (H = 0; H < N.length; H++) { y = parseFloat(this._settings.value(N[H] || 0)); if (y > K) { y = K } y -= v; y *= c; J = m.x; g = m.y + r + H * E + (u + 1) * C; if ((y < 0 && this._settings.origin == "auto") || (this._settings.xAxis && y === 0 && !(this._settings.origin != "auto" && this._settings.origin > v))) { this.canvases[C].renderTextAt("middle", "right", J + 10, g + u / 2 + r, this._settings.label(N[H])); continue } if (y < 0 && this._settings.origin != "auto" && this._settings.origin > v) { y = 0 } if (!q) { y += w / s } D = a || this._settings.color.call(this, N[H]); if (this._settings.border) { this._drawBarHBorder(A, J, g, u, v, n, s, y, D) } A.globalAlpha = this._settings.alpha.call(this, N[H]); var F = this._drawBarH(A, l, J, g, u, v, n, s, y, D, a, L); if (L != false) { this._drawBarHGradient(A, J, g, u, v, n, s, y, D, L) } A.globalAlpha = 1; if (F[3] == g) { this.canvases[C].renderTextAt("middle", "left", F[0] - 5, F[3] + Math.floor(u / 2), this._settings.label(N[H])); M.addRect(N[H].id, [F[0] - m.x, F[3] - m.y, F[2] - m.x, F[3] + u - m.y], C) } else { this.canvases[C].renderTextAt("middle", false, F[2] + 5, F[1] + Math.floor(u / 2), this._settings.label(N[H])); M.addRect(N[H].id, [F[0] - m.x, g - m.y, F[2] - m.x, F[3] - m.y], C) } } }, _setBarHPoints: function(x, h, v, y, n, w, u, m, l) { var c = 0; if (n > w * u) { var s = (n - w * u) / n; c = -Math.asin(s) + Math.PI / 2 } x.moveTo(h, v + m); var g = h + w * u - n - (n ? 0 : m); if (n < w * u) { x.lineTo(g, v + m) } var r = v + n; if (n && n > 0) { x.arc(g, r, n - m, -Math.PI / 2 + c, 0, false) } var q = v + y - n - (n ? 0 : m); var a = g + n - (n ? m : 0); x.lineTo(a, q); if (n && n > 0) { x.arc(g, q, n - m, 0, Math.PI / 2 - c, false) } var o = v + y - m; x.lineTo(h, o); if (!l) { x.lineTo(h, v + m) } return [a, o] }, _drawHScales: function(g, n, m, l, o, c, h) { 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(), n, m, l, o, c) } if (this._settings.yAxis) { if (!this.canvases.y) { this.canvases.y = new dhtmlx.ui.Canvas(this._obj) } this._drawHYAxis(this.canvases.y.getCanvas(), n, m, l, h, a) } }, _drawHYAxis: function(u, l, q, n, g, a) { if (!this._settings.yAxis) { return } var m; var c = parseInt((a ? a : q.x), 10) - 0.5; var r = n.y + 0.5; var o = q.y; this._drawLine(u, c, r, c, o, this._settings.yAxis.color, 1); for (var h = 0; h < l.length; h++) { var s = ((this._settings.origin != "auto") && (this._settings.view == "barH") && (parseFloat(this._settings.value(l[h])) < this._settings.origin)); m = o + g / 2 + h * g; this.canvases.y.renderTextAt("middle", (s ? false : "left"), (s ? c + 5 : c - 5), m, this._settings.yAxis.template(l[h]), "dhx_axis_item_y", (s ? 0 : c - 10)); if (this._settings.yAxis.lines.call(this, l[h])) { this._drawLine(u, q.x, m, n.x, m, this._settings.yAxis.lineColor.call(this, l[h]), 1) } } this._drawLine(u, q.x + 0.5, o + 0.5, n.x, o + 0.5, this._settings.yAxis.lineColor.call(this, {}), 1); this._setYAxisTitle(q, n) }, _drawHXAxis: function(C, u, y, x, g, q) { var n; var l = {}; var o = this._settings.xAxis; if (!o) { return } var A = x.y + 0.5; var h = y.x - 0.5; var a = x.x - 0.5; var s = y.x; this._drawLine(C, h, A, a, A, o.color, 1); if (o.step) { n = parseFloat(o.step) } if (typeof this._configXAxis.step == "undefined" || typeof this._configXAxis.start == "undefined" || typeof this._configXAxis.end == "undefined") { l = this._calculateScale(g, q); g = l.start; q = l.end; n = l.step; this._settings.xAxis.end = q; this._settings.xAxis.start = g; this._settings.xAxis.step = n } if (n === 0) { return } var m = (a - h) * n / (q - g); var w = 0; for (var r = g; r <= q; r += n) { if (l.fixNum) { r = parseFloat((new Number(r)).toFixed(l.fixNum)) } var v = Math.floor(h + w * m) + 0.5; if (!(r == g && this._settings.origin == "auto") && o.lines.call(this, r)) { this._drawLine(C, v, A, v, y.y, this._settings.xAxis.lineColor.call(this, r), 1) } if (r == this._settings.origin) { s = v + 1 } this.canvases.x.renderTextAt(false, true, v, A + 2, o.template(r.toString()), "dhx_axis_item_x"); w++ } this.canvases.x.renderTextAt(true, false, h, x.y + this._settings.padding.bottom - 3, this._settings.xAxis.title, "dhx_axis_title_x", x.x - y.x); if (!o.lines.call(this, {})) { this._drawLine(C, h, y.y - 0.5, a, y.y - 0.5, this._settings.xAxis.color, 0.2) } return s }, _correctBarHParams: function(o, l, g, m, n, q, h) { var a = this._settings.yAxis; var c = l; if ( !! a && this._settings.origin != "auto" && (this._settings.origin > h)) { l += (this._settings.origin - h) * n; c = l; m = m - (this._settings.origin - h); if (m < 0) { m *= (-1); o.translate(l, g + q); o.rotate(Math.PI); l = 0.5; g = 0 } l += 0.5 } return { value: m, x0: l, y0: g, start: c } }, _drawBarH: function(v, l, C, h, q, r, m, o, u, w, a, n) { v.save(); var s = this._correctBarHParams(v, C, h, u, o, q, r); v.fillStyle = w; v.beginPath(); var x = this._setBarHPoints(v, s.x0, s.y0, q, m, o, s.value, (this._settings.border ? 1 : 0)); if (a && !n) { v.lineTo(l.x, s.y0 + (this._settings.border ? 1 : 0)) } v.fill(); v.restore(); var g = s.y0; var c = (s.y0 != h ? h : x[1]); var A = (s.y0 != h ? (s.start - x[0]) : s.start); var y = (s.y0 != h ? s.start : x[0]); return [A, g, y, c] }, _drawBarHBorder: function(q, c, n, r, l, h, o, m, g) { q.save(); var a = this._correctBarHParams(q, c, n, m, o, r, l); q.beginPath(); this._setBorderStyles(q, g); q.globalAlpha = 0.9; this._setBarHPoints(q, a.x0, a.y0, r, h, o, a.value, q.lineWidth / 2, 1); q.stroke(); q.restore() }, _drawBarHGradient: function(s, g, q, u, n, m, r, o, h, a) { s.save(); var c = this._correctBarHParams(s, g, q, o, r, u, n); var l = this._setBarGradient(s, c.x0, c.y0 + u, c.x0 + r * c.value, c.y0, a, h, "x"); s.fillStyle = l.gradient; s.beginPath(); this._setBarHPoints(s, c.x0, c.y0 + l.offset, u - l.offset * 2, m, r, c.value, l.offset); s.fill(); s.globalAlpha = 1; s.restore() } }; dhtmlx.assert(dhtmlx.chart.barH); dhtmlx.chart.stackedBarH = { pvt_render_stackedBarH: function(D, Q, l, h, E, P) { var O, w; var c; var x; var A = h.x - l.x; var o = !! this._settings.yAxis; var n = this._getStackedLimits(Q); O = n.max; w = n.min; var H = Math.floor((h.y - l.y) / Q.length); if (!E) { this._drawHScales(D, Q, l, h, w, O, H) } if (o) { O = parseFloat(this._settings.xAxis.end); w = parseFloat(this._settings.xAxis.start) } var L = this._getRelativeValue(w, O); x = L[0]; c = L[1]; var u = (x ? A / x : 10); if (!o) { var y = 10; u = (x ? (A - y) / x : 10) } var v = parseInt(this._settings.width, 10); if ((v + 4) > H) { v = H - 4 } var q = (H - v) / 2; var m = 0; var r = false; var a = this._settings.gradient; if (a) { r = true } if (!o) { this._drawLine(D, l.x - 0.5, l.y, l.x - 0.5, h.y, "#000000", 1) } var N = 0; var K = 0; for (J = 0; J < this._series.length; J++) { if (J == E) { K = N } if (this._series[J].view == "stackedBarH") { N++ } } for (var J = 0; J < Q.length; J++) { if (!K) { Q[J].$startX = l.x } var C = parseFloat(this._settings.value(Q[J] || 0)); if (C > O) { C = O } C -= w; C *= c; var M = l.x; var g = l.y + q + J * H; if (!K) { Q[J].$startX = M } else { M = Q[J].$startX } if (C < 0 || (this._settings.yAxis && C === 0)) { this.canvases.y.renderTextAt("middle", true, M + 10, g + v / 2, this._settings.label(Q[J])); continue } if (!o) { C += y / u } var F = this._settings.color.call(this, Q[J]); D.globalAlpha = this._settings.alpha.call(this, Q[J]); D.fillStyle = this._settings.color.call(this, Q[J]); D.beginPath(); var I = this._setBarHPoints(D, M, g, v, m, u, C, (this._settings.border ? 1 : 0)); if (a && !r) { D.lineTo(l.x + A, g + (this._settings.border ? 1 : 0)) } D.fill(); if (r != false) { var s = this._setBarGradient(D, M, g + v, M, g, r, F, "x"); D.fillStyle = s.gradient; D.beginPath(); I = this._setBarHPoints(D, M, g, v, m, u, C, 0); D.fill() } if (this._settings.border) { this._drawBarHBorder(D, M, g, v, w, m, u, C, F) } D.globalAlpha = 1; this.canvases[E].renderTextAt("middle", true, Q[J].$startX + (I[0] - Q[J].$startX) / 2 - 1, g + (I[1] - g) / 2, this._settings.label(Q[J])); P.addRect(Q[J].id, [Q[J].$startX - l.x, g - l.y, I[0] - l.x, I[1] - l.y], E); Q[J].$startX = I[0] } } }; dhtmlx.chart.stackedBar = { pvt_render_stackedBar: function(y, M, h, g, A, L) { var J, u; var a; var v; var w = g.y - h.y; var m = !! this._settings.yAxis; var K = !! this._settings.xAxis; var l = this._getStackedLimits(M); J = l.max; u = l.min; var D = Math.floor((g.x - h.x) / M.length); if (!A) { this._drawScales(M, h, g, u, J, D) } if (m) { J = parseFloat(this._settings.yAxis.end); u = parseFloat(this._settings.yAxis.start) } var H = this._getRelativeValue(u, J); v = H[0]; a = H[1]; var r = (v ? w / v : 10); var s = parseInt(this._settings.width, 10); if (s + 4 > D) { s = D - 4 } var n = Math.floor((D - s) / 2); var o = (this._settings.gradient ? this._settings.gradient : false); if (!K) { this._drawLine(y, h.x, g.y + 0.5, g.x, g.y + 0.5, "#000000", 1) } for (var F = 0; F < M.length; F++) { var x = parseFloat(this._settings.value(M[F] || 0)); if (!x) { if (!A || !M[F].$startY) { M[F].$startY = g.y } continue } if (!A) { x -= u } x *= a; var I = h.x + n + F * D; var c = g.y; if (!A) { M[F].$startY = c } else { c = M[F].$startY } if (c < (h.y + 1)) { continue } if (x < 0 || (this._settings.yAxis && x === 0)) { this.canvases.y.renderTextAt(true, true, I + Math.floor(s / 2), c, this._settings.label(M[F])); continue } var C = this._settings.color.call(this, M[F]); y.globalAlpha = this._settings.alpha.call(this, M[F]); y.fillStyle = this._settings.color.call(this, M[F]); y.beginPath(); var E = this._setStakedBarPoints(y, I - (this._settings.border ? 0.5 : 0), c, s + (this._settings.border ? 0.5 : 0), r, x, 0, h.y); y.fill(); if (o) { y.save(); var q = this._setBarGradient(y, I, c, I + s, E[1], o, C, "y"); y.fillStyle = q.gradient; y.beginPath(); E = this._setStakedBarPoints(y, I + q.offset, c, s - q.offset * 2, r, x, (this._settings.border ? 1 : 0), h.y); y.fill(); y.restore() } if (this._settings.border) { y.save(); this._setBorderStyles(y, C); y.beginPath(); this._setStakedBarPoints(y, I - 0.5, c, s + 1, r, x, 0, h.y, 1); y.stroke(); y.restore() } y.globalAlpha = 1; this.canvases[A].renderTextAt(false, true, I + Math.floor(s / 2), (E[1] + (c - E[1]) / 2) - 7, this._settings.label(M[F])); L.addRect(M[F].id, [I - h.x, E[1] - h.y, E[0] - h.x, (M[F].$startY || c) - h.y], A); M[F].$startY = (this._settings.border ? (E[1] + 1) : E[1]) } }, _setStakedBarPoints: function(u, c, q, v, r, o, h, g, l) { u.moveTo(c, q); var n = q - r * o + h; if (n < g) { n = g } u.lineTo(c, n); var a = c + v; var m = n; u.lineTo(a, m); var s = c + v; u.lineTo(s, q); if (!l) { u.lineTo(c, q) } return [s, m - 2 * h] } }; dhtmlx.chart.line = { pvt_render_line: function(n, C, l, h, o, y) { var x, q, m, v, u, s, r, c, a, g, A, w; v = this._calculateLineParams(n, C, l, h, o); x = this._settings; if (C.length) { u = (x.offset ? l.x + v.cellWidth * 0.5 : l.x); m = []; for (q = 0; q < C.length; q++) { w = this._getPointY(C[q], l, h, v); if (w) { r = ((!q) ? u : v.cellWidth * q - 0.5 + u); a = (typeof w == "object" ? w.y0 : w); if (q && this._settings.fixOverflow) { A = this._getPointY(C[q - 1], l, h, v); if (A.out && A.out == w.out) { continue } s = v.cellWidth * (q - 1) - 0.5 + u; c = (typeof A == "object" ? A.y0 : A); if (A.out) { g = (A.out == "min" ? h.y : l.y); m.push({ x: this._calcOverflowX(s, r, c, a, g), y: g }) } if (w.out) { g = (w.out == "min" ? h.y : l.y); m.push({ x: this._calcOverflowX(s, r, c, a, g), y: g }) } } if (!w.out) { m.push({ x: r, y: w, index: q }) } } } this._mapStart = l; for (q = 1; q <= m.length; q++) { s = m[q - 1].x; c = m[q - 1].y; if (q < m.length) { r = m[q].x; a = m[q].y; this._drawLine(n, s, c, r, a, x.line.color.call(this, C[q - 1]), x.line.width); if (x.line && x.line.shadow) { n.globalAlpha = 0.3; this._drawLine(n, s + 2, c + x.line.width + 8, r + 2, a + x.line.width + 8, "#eeeeee", x.line.width + 3); n.globalAlpha = 1 } } if (typeof m[q - 1].index != "undefined") { this._drawItem(n, s, c, C[m[q - 1].index], x.label(C[m[q - 1].index]), o, y, l) } } } }, _calcOverflowX: function(c, a, h, g, l) { return c + (l - h) * (a - c) / (g - h) }, _drawItem: function(v, g, u, q, s, r, c) { var h = this._settings.item; var o = parseInt(h.radius.call(this, q), 10) || 0; var n = this._mapStart; if (o) { v.save(); if (h.shadow) { v.lineWidth = 1; v.strokeStyle = "#bdbdbd"; v.fillStyle = "#bdbdbd"; var a = [0.1, 0.2, 0.3]; for (var m = (a.length - 1); m >= 0; m--) { v.globalAlpha = a[m]; v.strokeStyle = "#d0d0d0"; v.beginPath(); this._strokeChartItem(v, g, u + 2 * o / 3, o + m + 1, h.type); v.stroke() } v.beginPath(); v.globalAlpha = 0.3; v.fillStyle = "#bdbdbd"; this._strokeChartItem(v, g, u + 2 * o / 3, o + 1, h.type); v.fill() } v.restore(); v.lineWidth = h.borderWidth; v.fillStyle = h.color.call(this, q); v.strokeStyle = h.borderColor.call(this, q); v.globalAlpha = h.alpha.call(this, q); v.beginPath(); this._strokeChartItem(v, g, u, o + 1, h.type); v.fill(); v.stroke(); v.globalAlpha = 1 } if (s) { this.canvases[r].renderTextAt(false, true, g, u - o - this._settings.labelOffset, this._settings.label.call(this, q)) } var l = (this._settings.eventRadius || o + 1); c.addRect(q.id, [g - l - n.x, u - l - n.y, g + l - n.x, u + l - n.y], r) }, _strokeChartItem: function(a, c, l, h, g) { var m = []; c = parseInt(c, 10); l = parseInt(l, 10); if (g && (g == "square" || g == "s")) { h *= Math.sqrt(2) / 2; m = [ [c - h - a.lineWidth / 2, l - h], [c + h, l - h], [c + h, l + h], [c - h, l + h], [c - h, l - h] ] } else { if (g && (g == "diamond" || g == "d")) { var n = (a.lineWidth > 1 ? a.lineWidth * Math.sqrt(2) / 4 : 0); m = [ [c, l - h], [c + h, l], [c, l + h], [c - h, l], [c + n, l - h - n] ] } else { if (g && (g == "triangle" || g == "t")) { m = [ [c, l - h], [c + Math.sqrt(3) * h / 2, l + h / 2], [c - Math.sqrt(3) * h / 2, l + h / 2], [c, l - h] ] } else { m = [ [c, l, h, 0, Math.PI * 2, true] ] } } } this._path(a, m) }, _getPointY: function(g, o, m, a) { var n = a.minValue; var h = a.maxValue; var r = a.unit; var c = a.valueFactor; var q = this._settings.value(g); var s = (parseFloat(q || 0) - n) * c; if (!this._settings.yAxis) { s += a.startValue / r } var l = m.y - r * s; if (this._settings.fixOverflow && (this._settings.view == "line" || this._settings.view == "area")) { if (q > h) { l = { y: o.y, y0: l, out: "max" } } else { if (s < 0 || q < n) { l = { y: m.y, y0: l, out: "min" } } } } else { if (q > h) { l = o.y } if (s < 0 || q < n) { l = m.y } } return l }, _calculateLineParams: function(q, h, n, m, l) { var c = {}; var r; c.totalHeight = m.y - n.y; c.cellWidth = (m.x - n.x) / ((!this._settings.offset) ? (h.length - 1) : h.length); var g = !! this._settings.yAxis; var a = (this._settings.view.indexOf("stacked") != -1 ? this._getStackedLimits(h) : this._getLimits()); c.maxValue = a.max; c.minValue = a.min; if (!l) { this._drawScales(h, n, m, c.minValue, c.maxValue, c.cellWidth) } if (g) { c.maxValue = parseFloat(this._settings.yAxis.end); c.minValue = parseFloat(this._settings.yAxis.start) } var o = this._getRelativeValue(c.minValue, c.maxValue); r = o[0]; c.valueFactor = o[1]; c.unit = (r ? c.totalHeight / r : 10); c.startValue = 0; if (!g) { c.startValue = 10; if (c.unit != c.totalHeight) { c.unit = (r ? (c.totalHeight - c.startValue) / r : 10) } } return c } }; dhtmlx.chart.bar = { pvt_render_bar: function(A, Q, l, h, C, P) { var u, E, I, n, N, v, w, c, J, x, s, M, o, O = h.y - l.y; o = !! this._settings.yAxis; M = !! this._settings.xAxis; n = this._getLimits(); N = n.max; v = n.min; E = (h.x - l.x) / Q.length; if (!C && !(this._settings.origin != "auto" && !o)) { this._drawScales(Q, l, h, v, N, E) } if (o) { N = parseFloat(this._settings.yAxis.end); v = parseFloat(this._settings.yAxis.start) } J = this._getRelativeValue(v, N); w = J[0]; c = J[1]; s = (w ? O / w : w); if (!o && !(this._settings.origin != "auto" && M)) { x = 10; s = (w ? (O - x) / w : x) } if (!C && (this._settings.origin != "auto" && !o) && this._settings.origin > v) { this._drawXAxis(A, Q, l, h, E, h.y - s * (this._settings.origin - v)) } u = parseInt(this._settings.width, 10); var L = 0; var H = 0; for (I = 0; I < this._series.length; I++) { if (I == C) { H = L } if (this._series[I].view == "bar") { L++ } } if (this._series && (u * L + 4) > E) { u = parseInt(E / L - 4, 10) } var q = (E - u * L) / 2; var m = (typeof this._settings.radius != "undefined" ? parseInt(this._settings.radius, 10) : Math.round(u / 5)); var r = false; var a = this._settings.gradient; if (a && typeof(a) != "function") { r = a; a = false } else { if (a) { a = A.createLinearGradient(0, h.y, 0, l.y); this._settings.gradient(a) } } if (!M) { this._drawLine(A, l.x, h.y + 0.5, h.x, h.y + 0.5, "#000000", 1) } for (I = 0; I < Q.length; I++) { var y = parseFloat(this._settings.value(Q[I]) || 0); if (isNaN(y)) { continue } if (y > N) { y = N } y -= v; y *= c; var K = l.x + q + parseInt(I * E, 10) + (u + 1) * H; var g = h.y; if (y < 0 || (this._settings.yAxis && y === 0 && !(this._settings.origin != "auto" && this._settings.origin > v))) { this.canvases[C].renderTextAt(true, true, K + Math.floor(u / 2), g, this._settings.label(Q[I])); continue } if (!o && !(this._settings.origin != "auto" && M)) { y += x / s } var D = a || this._settings.color.call(this, Q[I]); A.globalAlpha = this._settings.alpha.call(this, Q[I]); var F = this._drawBar(A, l, K, g, u, v, m, s, y, D, a, r); if (r) { this._drawBarGradient(A, K, g, u, v, m, s, y, D, r) } if (this._settings.border) { this._drawBarBorder(A, K, g, u, v, m, s, y, D) } A.globalAlpha = 1; if (F[0] != K) { this.canvases[C].renderTextAt(false, true, K + Math.floor(u / 2), F[1], this._settings.label(Q[I])) } else { this.canvases[C].renderTextAt(true, true, K + Math.floor(u / 2), F[3], this._settings.label(Q[I])) } P.addRect(Q[I].id, [K - l.x, F[3] - l.y, F[2] - l.x, F[1] - l.y], C) } }, _correctBarParams: function(o, l, g, m, n, q, h) { var a = this._settings.xAxis; var c = g; if ( !! a && this._settings.origin != "auto" && (this._settings.origin > h)) { g -= (this._settings.origin - h) * n; c = g; m = m - (this._settings.origin - h); if (m < 0) { m *= (-1); o.translate(l + q, g); o.rotate(Math.PI); l = 0; g = 0 } g -= 0.5 } return { value: m, x0: l, y0: g, start: c } }, _drawBar: function(v, l, C, h, q, r, m, o, u, w, a, n) { v.save(); v.fillStyle = w; var s = this._correctBarParams(v, C, h, u, o, q, r); var x = this._setBarPoints(v, s.x0, s.y0, q, m, o, s.value, (this._settings.border ? 1 : 0)); if (a && !n) { v.lineTo(s.x0 + (this._settings.border ? 1 : 0), l.y) } v.fill(); v.restore(); var A = s.x0; var y = (s.x0 != C ? C + x[0] : x[0]); var g = (s.x0 != C ? (s.start - x[1] - s.y0) : s.y0); var c = (s.x0 != C ? s.start - s.y0 : x[1]); return [A, g, y, c] }, _drawBarBorder: function(q, c, n, r, l, h, o, m, g) { var a; q.save(); a = this._correctBarParams(q, c, n, m, o, r, l); this._setBorderStyles(q, g); this._setBarPoints(q, a.x0, a.y0, r, h, o, a.value, q.lineWidth / 2, 1); q.stroke(); q.restore() }, _drawBarGradient: function(u, h, r, v, o, n, s, q, l, c) { u.save(); var g = this._correctBarParams(u, h, r, q, s, v, o); var m = this._setBarGradient(u, g.x0, g.y0, g.x0 + v, g.y0 - s * g.value + 2, c, l, "y"); var a = this._settings.border ? 1 : 0; u.fillStyle = m.gradient; this._setBarPoints(u, g.x0 + m.offset, g.y0, v - m.offset * 2, n, s, g.value, m.offset + a); u.fill(); u.restore() }, _setBarPoints: function(x, h, u, y, o, v, s, l, n) { x.beginPath(); var c = 0; if (o > v * s) { var m = (o - v * s) / o; if (m <= 1 && m >= -1) { c = -Math.acos(m) + Math.PI / 2 } } x.moveTo(h + l, u); var r = u - Math.floor(v * s) + o + (o ? 0 : l); if (o < v * s) { x.lineTo(h + l, r) } var g = h + o; if (o && o > 0) { x.arc(g, r, o - l, -Math.PI + c, -Math.PI / 2, false) } var a = h + y - o - l; var q = r - o + (o ? l : 0); x.lineTo(a, q); if (o && o > 0) { x.arc(a, r, o - l, -Math.PI / 2, 0 - c, false) } var w = h + y - l; x.lineTo(w, u); if (!n) { x.lineTo(h + l, u) } return [w, q] } }; dhtmlx.chart.pie = { pvt_render_pie: function(c, h, a, m, g, l) { this._renderPie(c, h, a, m, 1, l, g) }, _renderPie: function(s, F, l, h, D, E, u) { if (!F.length) { return } var v = this._getPieParameters(l, h); var n = (this._settings.radius ? this._settings.radius : v.radius); if (n < 0) { return } var a = this._getValues(F); var m = this._getTotalValue(a); var o = this._getRatios(a, m); var C = (this._settings.x ? this._settings.x : v.x); var g = (this._settings.y ? this._settings.y : v.y); if (D == 1 && this._settings.shadow) { this._addShadow(s, C, g, n) } g = g / D; var r = -Math.PI / 2; var x = []; s.scale(1, D); if (this._settings.gradient) { var A = (D != 1 ? C + n / 3 : C); var c = (D != 1 ? g + n / 3 : g); this._showRadialGradient(s, C, g, n, A, c) } for (var y = 0; y < F.length; y++) { if (!a[y]) { continue } s.strokeStyle = this._settings.lineColor.call(this, F[y]); s.beginPath(); s.moveTo(C, g); x.push(r); alpha1 = -Math.PI / 2 + o[y] - 0.0001; s.arc(C, g, n, r, alpha1, false); s.lineTo(C, g); var w = this._settings.color.call(this, F[y]); s.fillStyle = w; s.fill(); if (this._settings.pieInnerText) { this._drawSectorLabel(C, g, 5 * n / 6, r, alpha1, D, this._settings.pieInnerText(F[y], m), true) } if (this._settings.label) { this._drawSectorLabel(C, g, n + this._settings.labelOffset, r, alpha1, D, this._settings.label(F[y])) } if (D != 1) { this._createLowerSector(s, C, g, r, alpha1, n, true); s.fillStyle = "#000000"; s.globalAlpha = 0.2; this._createLowerSector(s, C, g, r, alpha1, n, false); s.globalAlpha = 1; s.fillStyle = w } E.addSector(F[y].id, r, alpha1, C - l.x, g - l.y / D, n, D, u); r = alpha1 } s.globalAlpha = 0.8; var q; for (y = 0; y < x.length; y++) { q = this._getPositionByAngle(x[y], C, g, n); this._drawLine(s, C, g, q.x, q.y, this._settings.lineColor.call(this, F[y]), 2) } if (D == 1) { s.lineWidth = 2; s.strokeStyle = "#ffffff"; s.beginPath(); s.arc(C, g, n + 1, 0, 2 * Math.PI, false); s.stroke() } s.globalAlpha = 1; s.scale(1, 1 / D) }, _getValues: function(g) { var a = []; for (var c = 0; c < g.length; c++) { a.push(parseFloat(this._settings.value(g[c]) || 0)) } return a }, _getTotalValue: function(a) { var g = 0; for (var c = 0; c < a.length; c++) { g += a[c] } return g }, _getRatios: function(c, a) { var m; var l = []; var h = 0; a = a || this._getTotalValue(c); for (var g = 0; g < c.length; g++) { m = c[g]; l[g] = Math.PI * 2 * (a ? ((m + h) / a) : (1 / c.length)); h += m } return l }, _getPieParameters: function(n, l) { var h = l.x - n.x; var c = l.y - n.y; var g = n.x + h / 2; var m = n.y + c / 2; var a = Math.min(h / 2, c / 2); return { x: g, y: m, radius: a } }, _createLowerSector: function(h, l, n, g, a, m, c) { h.lineWidth = 1; if (!((g <= 0 && a >= 0) || (g >= 0 && a <= Math.PI) || (Math.abs(g - Math.PI) > 0.003 && g <= Math.PI && a >= Math.PI))) { return } if (g <= 0 && a >= 0) { g = 0; c = false; this._drawSectorLine(h, l, n, m, g, a) } if (g <= Math.PI && a >= Math.PI) { a = Math.PI; c = false; this._drawSectorLine(h, l, n, m, g, a) } var o = (this._settings.height || Math.floor(m / 4)) / this._settings.cant; h.beginPath(); h.arc(l, n, m, g, a, false); h.lineTo(l + m * Math.cos(a), n + m * Math.sin(a) + o); h.arc(l, n + o, m, a, g, true); h.lineTo(l + m * Math.cos(g), n + m * Math.sin(g)); h.fill(); if (c) { h.stroke() } }, _drawSectorLine: function(g, h, m, l, c, a) { g.beginPath(); g.arc(h, m, l, c, a, false); g.stroke() }, _addShadow: function(c, a, m, h) { c.globalAlpha = 0.5; var l = ["#c4c4c4", "#c6c6c6", "#cacaca", "#dcdcdc", "#dddddd", "#e0e0e0", "#eeeeee", "#f5f5f5", "#f8f8f8"]; for (var g = l.length - 1; g > -1; g--) { c.beginPath(); c.fillStyle = l[g]; c.arc(a + 1, m + 1, h + g, 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(g, c, n, a, h, l) { g.beginPath(); var m; if (typeof this._settings.gradient != "function") { m = g.createRadialGradient(h, l, a / 4, c, n, a); m = this._getGrayGradient(m) } else { m = this._settings.gradient(m) } g.fillStyle = m; g.arc(c, n, a, 0, Math.PI * 2, true); g.fill(); g.globalAlpha = 0.7 }, _drawSectorLabel: function(E, c, h, A, w, F, v, a) { var u = this.canvases[0].renderText(0, 0, v, 0, 1); if (!u) { return } var H = u.scrollWidth; u.style.width = H + "px"; if (H > E) { H = E } var C = (w - A < 0.2 ? 4 : 8); if (a) { C = H / 1.8 } var g = A + (w - A) / 2; h = h - (C - 8) / 2; var o = -C; var n = -8; var D = "right"; if (g >= Math.PI / 2 && g < Math.PI || g <= 3 * Math.PI / 2 && g >= Math.PI) { o = -H - o + 1; D = "left" } var l = 0; if (!a && F < 1 && (g > 0 && g < Math.PI)) { l = (this._settings.height || Math.floor(h / 4)) / F } var q = (c + Math.floor((h + l) * Math.sin(g))) * F + n; var r = E + Math.floor((h + C / 2) * Math.cos(g)) + o; var m = (w < Math.PI / 2 + 0.01); var s = (A < Math.PI / 2); if (s && m) { r = Math.max(r, E + 3) } else { if (!s && !m) { r = Math.min(r, E - H) } else { if (!a && (g >= Math.PI / 2 && g < Math.PI || g <= 3 * Math.PI / 2 && g >= Math.PI)) { r += H / 3 } } } u.style.top = q + "px"; u.style.left = r + "px"; u.style.width = H + "px"; u.style.textAlign = D; u.style.whiteSpace = "nowrap" } }; dhtmlx.chart.pie3D = { pvt_render_pie3D: function(c, h, a, m, g, l) { this._renderPie(c, h, a, m, this._settings.cant, l) } }; dhtmlx.chart.donut = { pvt_render_donut: function(u, l, r, q, n, c) { if (!l.length) { return } this._renderPie(u, l, r, q, 1, c); var h = this._settings; var m = this._getPieParameters(r, q); var a = (h.radius ? h.radius : m.radius); var o = ((h.innerRadius && (h.innerRadius < a)) ? h.innerRadius : a / 3); var g = (h.x ? h.x : m.x); var s = (h.y ? h.y : m.y); u.fillStyle = "#ffffff"; u.beginPath(); u.arc(g, s, o, 0, Math.PI * 2, true); u.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(g) { var a = {}; for (var c = 0; c < this._grid.getColumnsNum(); c++) { a["data" + c] = this._grid[this._grid_getter](g, c) } return a }, getInfo: function(a) { return { _size: 0, _from: 0 } } }; dhtmlx.ui.Canvas = function(c, g, l) { this._canvas_labels = []; this._canvas_name = g; this._obj = c; var h = c.offsetWidth * (window.devicePixelRatio || 1); var a = c.offsetHeight * (window.devicePixelRatio || 1); var l = l || ""; l += ";width:" + c.offsetWidth + "px;height:" + c.offsetHeight + "px;"; this._prepareCanvas(g, l, h, a) }; dhtmlx.ui.Canvas.prototype = { _prepareCanvas: function(c, h, g, a) { this._canvas = dhtmlx.html.create("canvas", { width: g, height: a, canvas_id: c, style: (h || "") }); 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, m, l, h, c) { if (!l) { return } var g = dhtmlx.html.create("DIV", { "class": "dhx_canvas_text" + (h ? (" " + h) : ""), style: "left:" + a + "px; top:" + m + "px;" }, l); this._obj.appendChild(g); this._canvas_labels.push(g); if (c) { g.style.width = c + "px" } return g }, renderTextAt: function(l, q, a, o, h, n, g) { var m = this.renderText.call(this, a, o, h, n, g); if (m) { if (l) { if (l == "middle") { m.style.top = parseInt(o - m.offsetHeight / 2, 10) + "px" } else { m.style.top = o - m.offsetHeight + "px" } } if (q) { if (q == "left") { m.style.left = a - m.offsetWidth + "px" } else { m.style.left = parseInt(a - m.offsetWidth / 2, 10) + "px" } } } return m }, clearCanvas: function(a) { var c = [], g; for (g = 0; g < this._canvas_labels.length; g++) { this._obj.removeChild(this._canvas_labels[g]) } 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.offsetWidth * (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, g; for (g = 0; g < this._canvas_labels.length; g++) { this._canvas_labels[g].style.display = (a ? "" : "none") } if (this._obj._htmlmap) { c = this._getMapAreas(); for (g = 0; g < c.length; g++) { if (a) { c[g].removeAttribute("disabled") } else { c[g].setAttribute("disabled", "true") } } } this._canvas.style.display = (a ? "" : "none") }, _getMapAreas: function() { var g = [], a, c; a = this._obj._htmlmap.getElementsByTagName("AREA"); for (c = 0; c < a.length; c++) { if (a[c].getAttribute("userdata") == this._canvas_name) { g.push(a[c]) } } return g } }; dhtmlXChart = function(a) { this.name = "Chart"; this.version = "3.0"; 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(m, n, l) { var h = l.getAttribute("series_id"); if (this.callEvent("onLegendClick", [m, h, l])) { 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 (l.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 g, c, h, l, 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) } g = this._getChartBounds(this._obj.offsetWidth, this._obj.offsetHeight); l = new dhtmlx.ui.Map(this._id); a = this._settings; h = 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(), h, g.start, g.end, c, l) } l.render(this._obj); this._obj.lastChild.style.zIndex = 1000; this._applyBounds(this._obj.lastChild, g); this.callEvent("onAfterRender", []); this._settings = a }, _applyBounds: function(g, 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 h in a) { g.style[h] = a[h] + "px" } }, _getChartData: function() { var h, n, g, l, m, r, a, o, q, c; l = this.data.getRange(); h = (this._settings.view.toLowerCase().indexOf("barh") != -1 ? "yAxis" : "xAxis"); n = this._settings[h]; if (n && n.units && (typeof n.units == "object")) { g = n.units; o = []; if (typeof g.start != "undefined" && typeof g.end != "undefined" && typeof g.next != "undefined") { a = g.start; while (a <= g.end) { o.push(a); a = g.next.call(this, a) } } else { if (Object.prototype.toString.call(g) === "[object Array]") { o = g } } r = []; if (o.length) { q = n.value; c = {}; for (m = 0; m < l.length; m++) { c[q(l[m])] = m } for (m = 0; m < o.length; m++) { if (typeof c[o[m]] != "undefined") { l[c[o[m]]].$unit = o[m]; r.push(l[c[o[m]]]) } else { r.push({ $unit: o[m] }) } } } return r } return l }, 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(l) { var g, c, h; this.defaults = dhtmlx.extend({}, this.defaults); if (typeof dhtmlx.presets.chart[l] == "object") { h = dhtmlx.presets.chart[l]; for (g in h) { if (typeof h[g] == "object") { if (!this.defaults[g] || typeof this.defaults[g] != "object") { this.defaults[g] = dhtmlx.extend({}, h[g]) } else { this.defaults[g] = dhtmlx.extend({}, this.defaults[g]); for (c in h[g]) { this.defaults[g][c] = h[g][c] } } } else { this.defaults[g] = h[g] } } return l } 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" }, 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 g = ["alpha", "borderColor", "color", "radius"]; for (var c = 0; c < g.length; c++) { a[g[c]] = dhtmlx.Template.setter(a[g[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 g = 0; g < a.length; g++) { c[a[g]] = dhtmlx.Template.setter(c[a[g]]) } }, _drawScales: function(l, h, g, n, a, c) { var m = 0; if (this._settings.yAxis) { if (!this.canvases.y) { this.canvases.y = new dhtmlx.ui.Canvas(this._obj, "axis_y") } m = this._drawYAxis(this.canvases.y.getCanvas(), l, h, g, n, 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(), l, h, g, c, m) } return m }, _drawXAxis: function(v, m, s, r, h, q) { var g = s.x - 0.5; var u = parseInt((q ? q : r.y), 10) + 0.5; var c = r.x; var n; var a = true; for (var l = 0; l < m.length; l++) { if (this._settings.offset === true) { n = g + h / 2 + l * h } else { n = (l == m.length - 1) ? r.x : g + l * h; a = !! l } n = Math.ceil(n) - 0.5; var o = ((this._settings.origin != "auto") && (this._settings.view == "bar") && (parseFloat(this._settings.value(m[l])) < this._settings.origin)); this._drawXAxisLabel(n, u, m[l], a, o); if ((this._settings.offset || l) && this._settings.xAxis.lines.call(this, m[l])) { this._drawXAxisLine(v, n, r.y, s.y, m[l]) } } this.canvases.x.renderTextAt(true, false, g, r.y + this._settings.padding.bottom - 3, this._settings.xAxis.title, "dhx_axis_title_x", r.x - s.x); this._drawLine(v, g, u, c, u, this._settings.xAxis.color, 1); if (!this._settings.xAxis.lines.call(this, {}) || !this._settings.offset) { return } this._drawLine(v, c + 0.5, r.y, c + 0.5, s.y + 0.5, this._settings.xAxis.color, 0.2) }, _drawYAxis: function(x, E, m, l, o, n) { var q; var v = {}; if (!this._settings.yAxis) { return } var A = m.x - 0.5; var h = l.y; var g = m.y; var w = l.y; if (this._settings.yAxis.step) { q = parseFloat(this._settings.yAxis.step) } if (typeof this._configYAxis.step == "undefined" || typeof this._configYAxis.start == "undefined" || typeof this._configYAxis.end == "undefined") { v = this._calculateScale(o, n); o = v.start; n = v.end; q = v.step; this._settings.yAxis.end = n; this._settings.yAxis.start = o } this._setYAxisTitle(m, l); if (q === 0) { n = o; q = 1 } var a = (n == o ? h - g : (h - g) * q / (n - o)); var C = 0; for (var y = o; y <= n; y += q) { if (v.fixNum) { y = parseFloat((new Number(y)).toFixed(v.fixNum)) } var D = Math.floor(h - C * a) + 0.5; if (!(y == o && this._settings.origin == "auto") && this._settings.yAxis.lines.call(this, y)) { this._drawLine(x, A, D, l.x, D, this._settings.yAxis.lineColor.call(this, y), 1) } if (y == this._settings.origin) { w = D } var r = y; if (q < 1) { var s = Math.min(this._log10(q), (o <= 0 ? 0 : this._log10(o))); var u = Math.pow(10, -s); r = Math.round(y * u) / u; y = r } this.canvases.y.renderText(0, D - 5, this._settings.yAxis.template(r.toString()), "dhx_axis_item_y", m.x - 5); C++ } this._drawLine(x, A, h + 1, A, g, this._settings.yAxis.color, 1); return w }, _setYAxisTitle: function(g, c) { var a = "dhx_axis_title_y" + (dhtmlx._isIE && dhtmlx._isIE != 9 ? " dhx_ie_filter" : ""); var h = this.canvases.y.renderTextAt("middle", false, 0, parseInt((c.y - g.y) / 2 + g.y, 10), this._settings.yAxis.title, a); if (h) { h.style.left = (dhtmlx.env.transform ? (h.offsetHeight - h.offsetWidth) / 2 : 0) + "px" } }, _calculateScale: function(r, c) { if (this._settings.origin != "auto" && this._settings.origin < r) { r = this._settings.origin } var l, h, n; l = ((c - r) / 8) || 1; var g = Math.floor(this._log10(l)); var a = Math.pow(10, g); var m = l / a; m = (m > 5 ? 10 : 5); l = parseInt(m, 10) * a; if (l > Math.abs(r)) { h = (r < 0 ? -l : 0) } else { var s = Math.abs(r); var q = Math.floor(this._log10(s)); var o = s / Math.pow(10, q); h = Math.ceil(o * 10) / 10 * Math.pow(10, q) - l; if (s > 1 && l > 0.1) { h = Math.ceil(h) } while (r < 0 ? h <= r : h >= r) { h -= l } if (r < 0) { h = -h - 2 * l } } n = h; while (n < c) { n += l; n = parseFloat((new Number(n)).toFixed(Math.abs(g))) } return { start: h, end: n, step: l, fixNum: Math.abs(g) } }, _getLimits: function(c, n) { var o, m; var l = ((arguments.length && c == "h") ? this._configXAxis : this._configYAxis); n = n || "value"; if (l && (typeof l.end != "undefined") && (typeof l.start != "undefined") && l.step) { o = parseFloat(l.end); m = parseFloat(l.start) } else { o = this.max(this._series[0][n]); m = (l && (typeof l.start != "undefined")) ? parseFloat(l.start) : this.min(this._series[0][n]); if (this._series.length > 1) { for (var h = 1; h < this._series.length; h++) { var a = this.max(this._series[h][n]); var g = this.min(this._series[h][n]); if (a > o) { o = a } if (g < m) { m = g } } } } return { max: o, min: m } }, _log10: function(c) { var a = "log"; return Math.floor((Math[a](c) / Math.LN10)) }, _drawXAxisLabel: function(c, m, l, a, h) { if (!this._settings.xAxis) { return } var g = this.canvases.x.renderTextAt(h, a, c, m - (h ? 2 : 0), this._settings.xAxis.template(l)); if (g) { g.className += " dhx_axis_item_x" } }, _drawXAxisLine: function(c, a, h, g, l) { if (!this._settings.xAxis || !this._settings.xAxis.lines) { return } this._drawLine(c, a, h, a, g, this._settings.xAxis.lineColor.call(this, l), 1) }, _drawLine: function(a, h, n, g, l, c, m) { a.strokeStyle = c; a.lineWidth = m; a.beginPath(); a.moveTo(h, n); a.lineTo(g, l); a.stroke(); a.lineWidth = 1 }, _getRelativeValue: function(h, l) { var g, a; var c = 1; if (l != h) { g = l - h } else { g = h } return [g, 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(h, a) { var g; this._active_serie = a.getAttribute("userdata"); 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() } } }, 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() }, _setBorderStyles: function(a, c) { var h, g; g = dhtmlx.math.toRgb(c); h = dhtmlx.math.rgbToHsv(g[0], g[1], g[2]); h[2] /= 2; c = "rgb(" + dhtmlx.math.hsvToRgb(h[0], h[1], h[2]) + ")"; a.strokeStyle = c; if (a.globalAlpha == 1) { a.globalAlpha = 0.9 } }, _drawLegend: function(h, c) { var l, r, A, s, m, u, a, o = 0, n = 0, w, q, 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:" + o + "px; top:" + n + "px;" + a }, ""); if (r.padding) { A.style.padding = r.padding + "px" } this.legendObj = A; this._obj.appendChild(A); m = []; if (!r.values) { for (l = 0; l < h.length; l++) { m.push(this._drawLegendText(A, r.template(h[l]))) } } else { for (l = 0; l < r.values.length; l++) { m.push(this._drawLegendText(A, r.values[l].text, (typeof r.values[l].id != "undefined" ? typeof r.values[l].id : l), r.values[l].$hidden)) } } u = A.offsetWidth; s = A.offsetHeight; if (u < this._obj.offsetWidth) { if (r.layout == "x" && r.align == "center") { o = (this._obj.offsetWidth - u) / 2 } if (r.align == "right") { o = this._obj.offsetWidth - u } if (r.margin && r.align != "center") { o += (r.align == "left" ? 1 : -1) * r.margin } } if (s < this._obj.offsetHeight) { if (r.valign == "middle" && r.align != "center" && r.layout != "x") { n = (this._obj.offsetHeight - s) / 2 } else { if (r.valign == "bottom") { n = this._obj.offsetHeight - s } } if (r.margin && r.valign != "middle") { n += (r.valign == "top" ? 1 : -1) * r.margin } } A.style.left = o + "px"; A.style.top = n + "px"; w.save(); for (l = 0; l < m.length; l++) { v = m[l]; if (r.values && r.values[l].$hidden) { g = true; q = (r.values[l].disableColor ? r.values[l].disableColor : "#d9d9d9") } else { g = false; q = (r.values ? r.values[l].color : this._settings.color.call(this, h[l])) } this._drawLegendMarker(w, v.offsetLeft + o, v.offsetTop + n, q, v.offsetHeight, g, l) } w.restore(); m = null }, _drawLegendText: function(a, l, c, h) { var g = ""; if (this._settings.legend.layout == "x") { g = "float:left;" } var m = dhtmlx.html.create("DIV", { style: g + "padding-left:" + (10 + this._settings.legend.marker.width) + "px", "class": "dhx_chart_legend_item" + (h ? " hidden" : "") }, l); if (arguments.length > 2) { m.setAttribute("series_id", c) } a.appendChild(m); return m }, _drawLegendMarker: function(C, u, s, l, A, m, o) { var c = []; var n = this._settings.legend.marker; var w = this._settings.legend.values; var r = (w && w[o].markerType ? w[o].markerType : n.type); if (l) { C.fillStyle = l; C.strokeStyle = this._getDarkenColor(l, 0.75) } C.beginPath(); if (r == "round" || !n.radius) { C.lineWidth = n.height; C.lineCap = r; u += C.lineWidth / 2 + 5; s += A / 2; C.moveTo(u, s); var a = u + n.width - n.height + 1; C.lineTo(a, s) } else { if (r == "item") { if (this._settings.line && this._settings.view != "scatter" && !this._settings.disableLines) { C.beginPath(); C.lineWidth = this._series[o].line.width; C.strokeStyle = m ? l : this._series[o].line.color.call(this, {}); var g = u + 5; var v = s + A / 2; C.moveTo(g, v); var a = g + n.width; C.lineTo(a, v); C.stroke() } var h = this._series[o].item; var q = parseInt(h.radius.call(this, {}), 10) || 0; if (q) { C.beginPath(); if (m) { C.lineWidth = h.borderWidth; C.strokeStyle = l; C.fillStyle = l } else { C.lineWidth = h.borderWidth; C.fillStyle = h.color.call(this, {}); C.strokeStyle = h.borderColor.call(this, {}); C.globalAlpha = h.alpha.call(this, {}) } C.beginPath(); u += n.width / 2 + 5; s += A / 2; this._strokeChartItem(C, u, s, q + 1, h.type); C.fill(); C.stroke() } C.globalAlpha = 1 } else { C.lineWidth = 1; u += 5; s += parseInt(A / 2 - n.height / 2, 10); c = [ [u + n.radius, s + n.radius, n.radius, Math.PI, 3 * Math.PI / 2, false], [u + n.width - n.radius, s], [u + n.width - n.radius, s + n.radius, n.radius, -Math.PI / 2, 0, false], [u + n.width, s + n.height - n.radius], [u + n.width - n.radius, s + n.height - n.radius, n.radius, 0, Math.PI / 2, false], [u + n.radius, s + n.height], [u + n.radius, s + n.height - n.radius, n.radius, Math.PI / 2, Math.PI, false], [u, s + n.radius] ]; this._path(C, c) } } C.stroke(); C.fill() }, _getDarkenColor: function(a, h) { var g, c; c = dhtmlx.math.toRgb(a); g = dhtmlx.math.rgbToHsv(c[0], c[1], c[2]); g[2] = g[2] * h; return "rgb(" + dhtmlx.math.hsvToRgb(g[0], g[1], g[2]) + ")" }, _getChartBounds: function(a, n) { var q, g, o, c; q = this._settings.padding.left; g = this._settings.padding.top; o = a - this._settings.padding.right; c = n - this._settings.padding.bottom; if (this._settings.legend) { var l = this._settings.legend; var m = this._settings.legend.width; var h = this._settings.legend.height; if (l.layout == "x") { if (l.valign == "center") { if (l.align == "right") { o -= m } else { if (l.align == "left") { q += m } } } else { if (l.valign == "bottom") { c -= h } else { g += h } } } else { if (l.align == "right") { o -= m } else { if (l.align == "left") { q += m } } } } return { start: { x: q, y: g }, end: { x: o, y: c } } }, _getStackedLimits: function(l) { var c, a, m, h, g; if (this._settings.yAxis && (typeof this._settings.yAxis.end != "undefined") && (typeof this._settings.yAxis.start != "undefined") && this._settings.yAxis.step) { m = parseFloat(this._settings.yAxis.end); h = parseFloat(this._settings.yAxis.start) } else { for (c = 0; c < l.length; c++) { l[c].$sum = 0; l[c].$min = Infinity; for (a = 0; a < this._series.length; a++) { g = parseFloat(this._series[a].value(l[c]) || 0); if (isNaN(g)) { continue } if (this._series[a].view.toLowerCase().indexOf("stacked") != -1) { l[c].$sum += g } if (g < l[c].$min) { l[c].$min = g } } } m = -Infinity; h = Infinity; for (c = 0; c < l.length; c++) { if (l[c].$sum > m) { m = l[c].$sum } if (l[c].$min < h) { h = l[c].$min } } if (h > 0) { h = 0 } } return { max: m, min: h } }, _setBarGradient: function(w, c, s, a, q, o, h, g) { var r, l, n, m, v, u; if (o == "light") { if (g == "x") { r = w.createLinearGradient(c, s, a, s) } else { r = w.createLinearGradient(c, s, c, q) } u = [ [0, "#FFFFFF"], [0.9, h], [1, h] ]; l = 2 } else { if (o == "falling" || o == "rising") { if (g == "x") { r = w.createLinearGradient(c, s, a, s) } else { r = w.createLinearGradient(c, s, c, q) } n = dhtmlx.math.toRgb(h); m = dhtmlx.math.rgbToHsv(n[0], n[1], n[2]); m[1] *= 1 / 2; v = "rgb(" + dhtmlx.math.hsvToRgb(m[0], m[1], m[2]) + ")"; if (o == "falling") { u = [ [0, v], [0.7, h], [1, h] ] } else { if (o == "rising") { u = [ [0, h], [0.3, h], [1, v] ] } } l = 0 } else { w.globalAlpha = 0.37; l = 0; if (g == "x") { r = w.createLinearGradient(c, q, c, s) } else { r = w.createLinearGradient(c, s, a, s) } u = [ [0, "#9d9d9d"], [0.3, "#e8e8e8"], [0.45, "#ffffff"], [0.55, "#ffffff"], [0.7, "#e8e8e8"], [1, "#9d9d9d"] ] } } this._gradient(r, u); return { gradient: r, offset: l } }, _getPositionByAngle: function(g, c, l, h) { g *= (-1); c = c + Math.cos(g) * h; l = l - Math.sin(g) * h; return { x: c, y: l } }, _gradient: function(g, c) { for (var a = 0; a < c.length; a++) { g.addColorStop(c[a][0], c[a][1]) } }, _path: function(a, g) { var c, h; for (c = 0; c < g.length; c++) { h = (c ? "lineTo" : "moveTo"); if (g[c].length > 2) { h = "arc" } a[h].apply(a, g[c]) } }, _circle: function(c, a, h, g) { c.arc(a, h, g, Math.PI * 2, true) }, _addMapRect: function(h, l, a, g, c) { h.addRect(l, [a[0].x - g.x, a[0].y - g.y, a[1].x - g.x, a[1].y - g.y], c) } }; dhtmlx.compat("layout"); 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(g) { var c = ""; if (g.page == -1) { return "" } g.min = g.page - Math.round((g.group - 1) / 2); g.max = g.min + g.group - 1; if (g.min < 0) { g.max += g.min * (-1); g.min = 0 } if (g.max >= g.limit) { g.min -= Math.min(g.min, g.max - g.limit + 1); g.max = g.limit - 1 } for (var a = (g.min || 0); a <= g.max; a++) { c += this.button({ id: a, index: (a + 1), selected: (a == g.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(g) { c.setUpdated(g, true, "inserted") }); this.data.attachEvent("onStoreLoad", dhtmlx.bind(function(h, g) { if (h.getUserData) { h.getUserData(g, this._userdata) } }, this)); this.attachEvent("onBeforeDelete", function(h) { if (c._silent_mode) { return true } var g = c.getState(h); if (g == "inserted") { c.setUpdated(h, false); return true } if (g == "deleted") { return false } if (g == "true_deleted") { return true } c.setUpdated(h, true, "deleted"); return false }); this.attachEvent("onAfterEditStop", function(g) { c.setUpdated(g, true, "updated") }); this.attachEvent("onBindUpdate", function(g) { window.setTimeout(function() { c.setUpdated(g.id, true, "updated") }, 1) }); a = "_getRowData"; c[a] = function(n, g) { var l = this.obj.data.get(n); var m = {}; for (var h in l) { if (h.indexOf("_") === 0) { continue } m[h] = l[h] } return m }; a = "_clearUpdateFlag"; c[a] = function() {}; this._userdata = {}; c.attachEvent("insertCallback", this._dp_callback); c.attachEvent("updateCallback", this._dp_callback); c.attachEvent("deleteCallback", function(g, h) { this.obj.setUserData(h, this.action_param, "true_deleted"); this.obj.remove(h) }); 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(g, a) { var c = this._locateHTML(g); if (c) { c.style.cssText += ";" + a } }, changeId: function(c, a) { this.data.changeId(c, a); this.refresh() }, setUserData: function(g, a, c) { if (g) { this.data.get(g)[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 o = "_dragged"; var h = dhtmlDragAndDropObject.prototype.checkLanding; dhtmlDragAndDropObject.prototype.checkLanding = function(r, s, q) { h.apply(this, arguments); if (!q) { var u = dhtmlx.DragControl._drag_context = dhtmlx.DragControl._drag_context || {}; if (!u.from) { u.from = this.dragStartObject } dhtmlx.DragControl._checkLand(r, s, true) } }; var c = dhtmlDragAndDropObject.prototype.stopDrag; dhtmlDragAndDropObject.prototype.stopDrag = function(s, q, r) { if (!r) { if (dhtmlx.DragControl._last) { dhtmlx.DragControl._active = n.dragStartNode; dhtmlx.DragControl._stopDrag(s, true) } } c.apply(this, arguments) }; var n = new dhtmlDragAndDropObject(); var l = dhtmlx.DragControl._startDrag; dhtmlx.DragControl._startDrag = function() { l.apply(this, arguments); var u = dhtmlx.DragControl._drag_context; if (!u) { return } var s = []; var r = []; for (var q = 0; q < u.source.length; q++) { s[q] = { idd: u.source[q] }; r.push(u.source[q]) } n.dragStartNode = { parentNode: {}, parentObject: { idd: s, id: (r.length == 1 ? r[0] : r), treeNod: { object: u.from } } }; n.dragStartNode.parentObject.treeNod[o] = s; n.dragStartObject = u.from }; var m = dhtmlx.DragControl._checkLand; dhtmlx.DragControl._checkLand = function(r, s, q) { m.apply(this, arguments); if (!this._last && !q) { r = n.checkLanding(r, s, true) } }; var a = dhtmlx.DragControl._stopDrag; dhtmlx.DragControl._stopDrag = function(r, q) { a.apply(this, arguments); if (n.lastLanding && !q) { n.stopDrag(r, false, true) } }; var g = dhtmlx.DragControl.getMaster; dhtmlx.DragControl.getMaster = function(r) { var s = null; if (r) { s = g.apply(this, arguments) } if (!s) { s = n.dragStartObject; var u = []; var v = s[o]; for (var q = 0; q < v.length; q++) { u.push(v[q].idd || v[q].id) } dhtmlx.DragControl._drag_context.source = u } return s } } }; dhtmlx.DataMove = { _init: function() { dhtmlx.assert(this.data, "DataMove :: Component doesn't have DataStore") }, copy: function(c, l, a, h) { var g = this.get(c); if (!g) { dhtmlx.log("Warning", "Incorrect ID in DataMove::copy"); return } if (a) { dhtmlx.assert(a.externalData, "DataMove :: External object doesn't support operation"); g = a.externalData(g) } a = a || this; return a.add(a.externalData(g, h), l) }, move: function(g, n, c, m) { if (g instanceof Array) { for (var h = 0; h < g.length; h++) { var a = (c || this).indexById(this.move(g[h], n, c, dhtmlx.uid())); if (g[h + 1]) { n = a + (this.indexById(g[h + 1]) < a ? 0 : 1) } } return } nid = g; if (n < 0) { dhtmlx.log("Info", "DataMove::move - moving outside of bounds is ignored"); return } var l = this.get(g); if (!l) { dhtmlx.log("Warning", "Incorrect ID in DataMove::move"); return } if (!c || c == this) { this.data.move(this.indexById(g), n) } else { dhtmlx.assert(c.externalData, "DataMove :: External object doesn't support operation"); nid = c.add(c.externalData(l, m), n); this.remove(g) } 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, g) { var c = dhtmlx.extend({}, a); c.id = g || dhtmlx.uid(); c.$selected = c.$template = null; return c } }; dhtmlx.DragControl = { _drag_masters: dhtmlx.toArray(["dummy"]), addDrop: function(c, g, a) { c = dhtmlx.toNode(c); c.dhx_drop = this._getCtrl(g); 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(l) { var g = dhtmlx.DragControl._active; var h = this._drag_masters[g.dhx_drag]; var c; if (h.onDragCreate) { c = h.onDragCreate(g, l); c.style.position = "absolute"; c.style.zIndex = dhtmlx.zIndex.drag; c.onmousemove = dhtmlx.DragControl._skip_mark } else { var m = dhtmlx.DragControl.onDrag(g, l); if (!m) { return false } var c = document.createElement("DIV"); c.innerHTML = m; 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 g = this._drag_masters[c.dhx_drag]; if (g && g.onDragDestroy) { g.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, l, h) { var a = this._drag_masters[c.dhx_drop]; if (a.onDragOut && a != this) { return a.onDragOut(g, c, l, h) } c.className = c.className.replace("dhx_drop_zone", ""); return null }, onDrop: function(g, c, l, 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, l, 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, l) { var n = this.locate(l) || null; var c = dhtmlx.DragControl._drag_context; var m = dhtmlx.DragControl.getMaster(h); var a = (this._locateHTML(n) || this._obj); if (a == dhtmlx.DragControl._landing) { return a } c.target = n; c.to = m; if (!this.callEvent("onBeforeDragIn", [c, l])) { c.id = null; return null } dhtmlx.html.addCss(a, "dhx_drag_over"); return a }, onDragOut: function(h, g, o, l) { var m = this.locate(l) || null; if (o != this._dataobj) { m = null } var c = (this._locateHTML(m) || (o ? dhtmlx.DragControl.getMaster(o)._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, l]); return null }, onDrop: function(g, c, l, 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, l) { var m = this.locate(l); var h = [m]; if (m) { if (this.getSelected) { var c = this.getSelected(); if (dhtmlx.PowerArray.find.call(c, m) != -1) { h = c } } var a = dhtmlx.DragControl._drag_context = { source: h, start: m }; a.from = this; if (this.callEvent("onBeforeDrag", [a, l])) { return a.html || this._toHTML(this.get(m)) } } 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(g, h, c) { if (g == 13 && !c) { this.stopEdit() } else { if (g == 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(g, l) { if (!this._edit_id) { return true } if (this._edit_id == l) { return false } var a = {}; if (!g) { 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 (!g) { this._edit_bind(false, c) } var h = this._edit_id; this._edit_bind = this._edit_id = null; this.data.refresh(h); this.callEvent("onAfterEditStop", [h, a]); return true }, _save_binding: function(o) { var a = this._locateHTML(o); var g = ""; var m = ""; var l = []; if (a) { var h = a.getElementsByTagName("*"); var n = ""; for (var c = 0; c < h.length; c++) { if (h[c].nodeType == 1 && (n = h[c].getAttribute("bind"))) { g += "els[" + l.length + "].value=" + n + ";"; m += n + "=els[" + l.length + "].value;"; l.push(h[c]); h[c].className += " dhx_allow_selection"; h[c].onselectstart = this._block_native } } h = null } g = Function("obj", "els", g); m = Function("obj", "els", m); this._edit_bind = function(r, q) { if (r) { g(q, l); if (l.length && l[0].select) { l[0].select() } } else { m(q, l) } } }, _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(g, a) { for (var c = this._selected.length - 1; c >= 0; c--) { if (this._selected[c] == g) { 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 g = this._selected[a] } var c = this.item(g); if (c) { delete c.$selected } this._selected.splice(a, 1); this.callEvent("onSelectChange", [g]) } }, _data_updated: function(g, c, a) { if (a == "delete") { this._selected.remove(g) } 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(g, c, a) { if (!a && !this.callEvent("onBeforeSelect", [g, c])) { return false } this.data.item(g).$selected = c; if (a) { a.push(g) } else { if (c) { this._selected.push(g) } else { this._selected.remove(g) } this._refresh_selection(g) } return true }, select: function(h, g, a) { if (!h) { return this.selectAll() } if (h instanceof Array) { for (var c = 0; c < h.length; c++) { this.select(h[c], g, a) } return } if (!this.data.exists(h)) { dhtmlx.error("Incorrect id in select command: " + h); return } if (a && this._selected.length) { return this.selectAll(this._selected[this._selected.length - 1], h) } if (!g && (this._selected.length != 1 || this._selected[0] != h)) { this._silent_selection = true; this.unselectAll(); this._silent_selection = false } if (this.isSelected(h)) { if (g) { this.unselect(h) } return } if (this._select_mark(h, true)) { this.callEvent("onAfterSelect", [h]) } }, unselect: function(a) { if (!a) { return this.unselectAll() } if (!this.isSelected(a)) { return } this._select_mark(a, false) }, selectAll: function(h, g) { var a; var c = []; if (h || g) { a = this.data.getRange(h || null, g || null) } else { a = this.data.getRange() } a.each(function(l) { var m = this.data.item(l.id); if (!m.$selected) { this._selected.push(l.id); this._select_mark(l.id, true, c) } return l.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 g = this._dataobj.childNodes; for (var c = 0; c < g.length; c++) { var h = g[c].getAttribute(this._id); if (h) { this._htmlmap[h] = g[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(m, h, g, l) { if (m) { var a = this._locateHTML(m); switch (g) { case "update": if (!a) { return } var c = this._htmlmap[m] = this._toHTMLObject(h); dhtmlx.html.insertBefore(c, a); dhtmlx.html.remove(a); break; case "delete": if (!a) { return } dhtmlx.html.remove(a); delete this._htmlmap[m]; break; case "add": var c = this._htmlmap[m] = this._toHTMLObject(h); dhtmlx.html.insertBefore(c, this._locateHTML(this.data.next(m)), this._dataobj); break; case "move": this.render(m, h, "delete"); this.render(m, h, "add"); break; default: dhtmlx.error("Unknown render command: " + g); 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 h = this._settings.pager._settings; if (h.page == -1) { return false } this.data.min = h.page * h.size; this.data.max = (h.page + 1) * h.size - 1; return true }); var a = new dhtmlx.ui.pager(c); var g = dhtmlx.bind(function() { this.data.refresh() }, this); a.attachEvent("onRefresh", g); this.data.attachEvent("onStoreUpdated", function(l) { var h = this.dataCount(); if (h != a._settings.count) { a._settings.count = h; 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 g = this._getDimension(); var a = dhtmlx.$customScroll ? 0 : 18; this._dataobj.style.width = g.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(g) { range = this._getVisibleRange(); var c = this.data.indexById(g); var a = Math.floor(c / range._dx) * range._y; this._dataobj.scrollTop = a }, _getIndexRange: function(l, h) { if (h !== 0) { h = Math.min((h || Infinity), this.dataCount() - 1) } var a = dhtmlx.toArray(); for (var c = (l || 0); c <= h; c++) { var g = this.item(this.order[c]); if (this.order.length > c) { if (!g) { this.order[c] = dhtmlx.uid(); g = { id: this.order[c], $template: "loading" }; this._unrendered_area.push(this.order[c]) } else { if (g.$template == "loading") { this._unrendered_area.push(this.order[c]) } } a.push(g) } } return a }, render: function(m, h, g, l) { if (m) { var a = this._locateHTML(m); switch (g) { case "update": if (!a) { return } var c = this._htmlmap[m] = this._toHTMLObject(h); 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.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 l = Math.max(y._from, 0); var x = (this.data.max || this.data.max === 0) ? this.data.max : Infinity; while (l <= y._height) { while (this._htmlrows[l] && this._htmlrows[l]._filled && l <= y._height) { l++ } if (l > y._height) { break } var o = l; while (!this._htmlrows[o]) { o-- } var a = this._htmlrows[o]; var g = l * y._dx + (this.data.min || 0); if (g > x) { break } var m = Math.min(g + y._dx - 1, x); var r = this._create_placeholder(y._y); var n = this.data.getIndexRange(g, m); if (!n.length) { break } r.innerHTML = n.map(this._toHTML, this).join(""); for (var v = 0; v < n.length; v++) { this._htmlmap[this.data.idByIndex(g + v)] = r.childNodes[v] } var w = parseInt(a.style.height, 10); var D = (l - o) * y._y; var u = (w - D - y._y); dhtmlx.html.insertBefore(r, D ? a.nextSibling : a, this._dataobj); this._htmlrows[l] = r; r._filled = true; if (D <= 0 && u > 0) { a.style.height = u + "px"; this._htmlrows[l + 1] = a } else { if (D < 0) { dhtmlx.html.remove(a) } else { a.style.height = D + "px" } if (u > 0) { var q = this._htmlrows[l + 1] = this._create_placeholder(u); dhtmlx.html.insertBefore(q, r.nextSibling, this._dataobj) } } l++ } 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 n = this._dataobj.scrollTop; var a = Math.max(this._dataobj.scrollWidth, this._dataobj.offsetWidth) - c; var o = this._dataobj.offsetHeight; var r = this.type; var h = this._getDimension(); var s = Math.floor(a / h.x) || 1; var g = Math.floor(n / h.y); var q = Math.ceil((o + n) / h.y) - 1; var l = this.data.max ? (this.data.max - this.data.min) : this.data.dataCount(); var m = Math.ceil(l / s) * h.y; return { _from: g, _height: q, _top: n, _max: m, _y: h.y, _dx: s } } }; dhtmlXDataView = function(a) { this.name = "DataView"; this.version = "3.0"; 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 (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(g, l) { var h = this._locateHTML(g.target); if (this.type.drag_marker) { if (this._drag_marker) { this._drag_marker.style.backgroundImage = ""; this._drag_marker.style.backgroundRepeat = "" } if (h) { h.style.backgroundImage = "url(" + (dhtmlx.image_path || "") + this.type.drag_marker + ")"; h.style.backgroundRepeat = "no-repeat"; this._drag_marker = h } } if (h && this._settings.auto_scroll) { var a = h.offsetTop; var m = h.offsetHeight; var c = this._obj.scrollTop; var n = this._obj.offsetHeight; if (a - m >= 0 && a - m * 0.75 < c) { c = Math.max(a - m, 0) } else { if (a + m / 0.75 > c + n) { c = c + m } } 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"); 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(h, n, m, l) { var g = this.d.childNodes; var o = new xmlPointer(); if (g.length) { for (l = l || 0; l < g.length; l++) { if (g[l].tagName == h) { o.d = g[l]; if (n.apply(m, [o, l]) == -1) { return } } } } }, get_all: function() { var g = {}; var c = this.d.attributes; for (var h = 0; h < c.length; h++) { g[c[h].name] = c[h].value } return g }, sub: function(h) { var g = this.d.childNodes; var m = new xmlPointer(); if (g.length) { for (var l = 0; l < g.length; l++) { if (g[l].tagName == h) { m.d = g[l]; return m } } } }, 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(g) { var c = this.d.childNodes; if (c.length) { for (var h = 0; h < c.length; h++) { if (c[h].tagName == g) { return true } } } return false }, through: function(g, n, r, l, s) { var o = this.d.childNodes; if (o.length) { for (var h = 0; h < o.length; h++) { if (o[h].tagName == g && o[h].getAttribute(n) != null && o[h].getAttribute(n) != "" && (!r || o[h].getAttribute(n) == r)) { var m = new xmlPointer(o[h]); l.apply(s, [m, h]) } var q = this.d; this.d = o[h]; this.through(g, n, r, l, s); this.d = q } } } }; function dhtmlXTreeObject(m, h, c, a) { if (_isIE) { try { document.execCommand("BackgroundImageCache", false, true) } catch (l) {} } if (typeof(m) != "object") { this.parentObject = document.getElementById(m) } else { this.parentObject = m } this.parentObject.style.overflow = "hidden"; this._itim_dg = true; this.dlmtr = ","; this.dropLower = false; this.enableIEImageFix(); 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._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"; dhtmlxEventable(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(n) { return g._doContClick(n || window.event, true) } } this.allTree.onmousedown = function(n) { return g._doContClick(n || window.event) }; this.XMLLoader = new dtmlXMLLoaderObject(this._parseXMLTree, this, true, this.no_cashe); 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 (n) {} }, false) } if (window.attachEvent) { window.attachEvent("onunload", function() { try { g.destructor() } catch (n) {} }) } this.setImagesPath = this.setImagePath; this.setIconsPath = this.setIconPath; if (dhtmlx.image_path) { this.setImagePath(dhtmlx.image_path) } if (dhtmlx.skin) { this.setSkin(dhtmlx.skin) } return this } dhtmlXTreeObject.prototype.setDataMode = function(a) { this._datamode = a }; dhtmlXTreeObject.prototype._doContClick = function(n, a) { if (!a && n.button != 2) { if (this._acMenu) { if (this._acMenu.hideContextMenu) { this._acMenu.hideContextMenu() } else { this.cMenu._contextEnd() } } return true } var c = (_isIE ? n.srcElement : n.target); while ((c) && (c.tagName != "BODY")) { if (c.parentObject) { break } c = c.parentNode } if ((!c) || (!c.parentObject)) { return true } var l = c.parentObject; if (!this.callEvent("onRightClick", [l.id, n])) { (n.srcElement || n.target).oncontextmenu = function(r) { (r || event).cancelBubble = true; return false } } this._acMenu = (l.cMenu || this.cMenu); if (this._acMenu) { if (!(this.callEvent("onBeforeContextMenu", [l.id]))) { return true } if (!_isMacOS) { (n.srcElement || n.target).oncontextmenu = function(r) { (r || event).cancelBubble = true; return false } } if (this._acMenu.showContextMenu) { var h = window.document.documentElement; var g = window.document.body; var o = new Array((h.scrollLeft || g.scrollLeft), (h.scrollTop || g.scrollTop)); if (_isIE) { var q = n.clientX + o[0]; var m = n.clientY + o[1] } else { var q = n.pageX; var m = n.pageY } this._acMenu.showContextMenu(q - 1, m - 1); this.contextID = l.id; n.cancelBubble = true; this._acMenu._skip_hide = true } else { c.contextMenuId = l.id; c.contextMenu = this._acMenu; c.a = this._acMenu._contextStart; c.a(c, n); 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(g, c) { g.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(g, c) { g.style.backgroundImage = "url(" + c + ")" }; this._getSrc = function(c) { var g = c.style.backgroundImage; return g.substr(4, g.length - 5).replace(/(^")|("$)/g, "") } } }; dhtmlXTreeObject.prototype.destructor = function() { for (var c in this._idpull) { var g = this._idpull[c]; if (!g) { continue } g.parentObject = null; g.treeNod = null; g.childNodes = null; g.span = null; g.tr.nodem = null; g.tr = null; g.htmlNode.objBelong = null; g.htmlNode = null; this._idpull[c] = null } this.parentObject.innerHTML = ""; if (this.XMLLoader) { this.XMLLoader.destructor() } 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(m, c, g, a, h, l) { 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 = g; this.actionHandler = h; this.images = new Array(a.imageArray[0], a.imageArray[1], a.imageArray[2]); this.id = a._globalIdStorageAdd(m, this); if (this.treeNod.checkBoxOff) { this.htmlNode = this.treeNod._createItem(1, this, l) } else { this.htmlNode = this.treeNod._createItem(0, this, l) } 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(m, a, g, h) { var l = this._idpull[m]; if (l) { if ((l.unParsed) && (!g)) { this.reParse(l, 0) } if (this._srnd && !l.htmlNode) { this._buildSRND(l, g) } if ((h) && (this._edsbpsA)) { for (var c = 0; c < this._edsbpsA.length; c++) { if (this._edsbpsA[c][2] == m) { dhtmlxError.throwError("getItem", "Requested item still in parsing process.", m); return null } } } return l } if ((this.slowParse) && (m != 0) && (!a)) { return this.preParse(m) } else { return null } }; dhtmlXTreeObject.prototype._getSubItemsXML = function(a) { var c = []; a.each("item", function(g) { c.push(g.get("id")) }, this); return c.join(this.dlmtr) }; dhtmlXTreeObject.prototype.enableSmartXMLParsing = function(a) { this.slowParse = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.findXML = function(c, a, g) {}; dhtmlXTreeObject.prototype._getAllCheckedXML = function(c, a, h) { var g = []; if (h == 2) { c.through("item", "checked", -1, function(l) { g.push(l.get("id")) }, this) } if (h == 1) { c.through("item", "id", null, function(l) { if (l.get("checked") && (l.get("checked") != -1)) { g.push(l.get("id")) } }, this) } if (h == 0) { c.through("item", "id", null, function(l) { if (!l.get("checked") || l.get("checked") == 0) { g.push(l.get("id")) } }, this) } if (g.length) { return a + (a ? this.dlmtr : "") + g.join(this.dlmtr) } if (a) { return a } else { return "" } }; dhtmlXTreeObject.prototype._setSubCheckedXML = function(a, c) { var g = a ? "1" : ""; c.through("item", "id", null, function(h) { if (!h.get("disabled") || h.get("disabled") == 0) { h.set("checked", g) } }, this) }; dhtmlXTreeObject.prototype._getAllScraggyItemsXML = function(g, a) { var h = []; var c = function(l) { if (!l.sub_exists("item")) { h.push(l.get("id")) } else { l.each("item", c, this) } }; c(g); return h.join(",") }; dhtmlXTreeObject.prototype._getAllFatItemsXML = function(g, a) { var h = []; var c = function(l) { if (!l.sub_exists("item")) { return } h.push(l.get("id")); l.each("item", c, this) }; c(g); return h.join(",") }; dhtmlXTreeObject.prototype._getAllSubItemsXML = function(g, c, a) { var c = []; a.through("item", "id", null, function(h) { c.push(h.get("id")) }, this); return c.join(",") }; dhtmlXTreeObject.prototype.reParse = function(g) { var m = this; if (!this.parsCount) { m.callEvent("onXLS", [m, g.id]) } this.xmlstate = 1; var h = g.unParsed; g.unParsed = 0; this.XMLloadingWarning = 1; var a = this.parsingOn; var o = this.waitUpdateXML; var q = this.parsedArray; this.parsedArray = new Array(); this.waitUpdateXML = false; this.parsingOn = g.id; this.parsedArray = new Array(); this.setCheckList = ""; this._parse(h, g.id, 2); var r = this.setCheckList.split(this.dlmtr); for (var l = 0; l < this.parsedArray.length; l++) { g.htmlNode.childNodes[0].appendChild(this.parsedArray[l]) } if (h.get("order") && h.get("order") != "none") { this._reorderBranch(g, h.get("order"), true) } this.oldsmcheck = this.smcheck; this.smcheck = false; for (var c = 0; c < r.length; c++) { if (r[c]) { this.setCheck(r[c], 1) } } this.smcheck = this.oldsmcheck; this.parsingOn = a; this.waitUpdateXML = o; this.parsedArray = q; this.XMLloadingWarning = 0; this._redrawFrom(this, g); if (this._srnd && !g._sready) { this.prepareSR(g.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(h) { this._globalIdStorageFind(h.up().get("id")); return a = true }, this); if (a) { var g = this._globalIdStorageFind(c, true, false); if (!g) { dhtmlxError.throwError("getItem", "The item " + c + " not operable. Seems you have non-unique|incorrect IDs in tree's XML.", c) } } return g }; 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(l, g) { var h = document.createElement("tr"); var c = document.createElement("td"); var a = document.createElement("td"); c.appendChild(document.createTextNode(" ")); a.colSpan = 3; a.appendChild(l); h.appendChild(c); h.appendChild(a); return h }; dhtmlXTreeObject.prototype.loadXMLString = function(g, c) { var a = this; if (!this.parsCount) { this.callEvent("onXLS", [a, null]) } this.xmlstate = 1; if (c) { this.XMLLoader.waitCall = c } this.XMLLoader.loadXMLString(g) }; dhtmlXTreeObject.prototype.loadXML = function(a, g) { if (this._datamode && this._datamode != "xml") { return this["load" + this._datamode.toUpperCase()](a, g) } var c = this; if (!this.parsCount) { this.callEvent("onXLS", [c, this._ld_id]) } this._ld_id = null; this.xmlstate = 1; this.XMLLoader = new dtmlXMLLoaderObject(this._parseXMLTree, this, true, this.no_cashe); if (g) { this.XMLLoader.waitCall = g } this.XMLLoader.loadXML(a) }; dhtmlXTreeObject.prototype._attachChildNode = function(o, m, h, q, E, D, C, r, g, v, w) { if (v && v.parentObject) { o = v.parentObject } if (((o.XMLload == 0) && (this.XMLsource)) && (!this.XMLloadingWarning)) { o.XMLload = 1; this._loadDynXML(o.id) } var s = o.childsCount; var F = o.childNodes; if (w && w.tr.previousSibling) { if (w.tr.previousSibling.previousSibling) { v = w.tr.previousSibling.nodem } else { r = r.replace("TOP", "") + ",TOP" } } if (v) { var l, A; for (l = 0; l < s; l++) { if (F[l] == v) { for (A = s; A != l; A--) { F[1 + A] = F[A] } break } } l++; s = l } if (r) { var x = r.split(","); for (var y = 0; y < x.length; y++) { switch (x[y]) { case "TOP": if (o.childsCount > 0) { v = new Object; v.tr = o.childNodes[0].tr.previousSibling } o._has_top = true; for (l = s; l > 0; l--) { F[l] = F[l - 1] } s = 0; break } } } var u; if (!(u = this._idpull[m]) || u.span != -1) { u = F[s] = new dhtmlXTreeItemObject(m, h, o, this, q, 1); m = F[s].id; o.childsCount++ } if (!u.htmlNode) { u.label = h; u.htmlNode = this._createItem((this.checkBoxOff ? 1 : 0), u); u.htmlNode.objBelong = u } if (E) { u.images[0] = E } if (D) { u.images[1] = D } if (C) { u.images[2] = C } var c = this._drawNewTr(u.htmlNode); if ((this.XMLloadingWarning) || (this._hAdI)) { u.htmlNode.parentNode.parentNode.style.display = "none" } if ((v) && v.tr && (v.tr.nextSibling)) { o.htmlNode.childNodes[0].insertBefore(c, v.tr.nextSibling) } else { if (this.parsingOn == o.id) { this.parsedArray[this.parsedArray.length] = c } else { o.htmlNode.childNodes[0].appendChild(c) } } if ((v) && (!v.span)) { v = null } if (this.XMLsource) { if ((g) && (g != 0)) { u.XMLload = 0 } else { u.XMLload = 1 } } u.tr = c; c.nodem = u; if (o.itemId == 0) { c.childNodes[0].className = "hiddenRow" } if ((o._r_logic) || (this._frbtr)) { this._setSrc(u.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0], this.imPath + this.radioArray[0]) } if (r) { var x = r.split(","); for (var y = 0; y < x.length; y++) { switch (x[y]) { case "SELECT": this.selectItem(m, false); break; case "CALL": this.selectItem(m, true); break; case "CHILD": u.XMLload = 0; break; case "CHECKED": if (this.XMLloadingWarning) { this.setCheckList += this.dlmtr + m } else { this.setCheck(m, 1) } break; case "HCHECKED": this._setCheck(u, "unsure"); break; case "OPEN": u.openMe = 1; break } } } if (!this.XMLloadingWarning) { if ((this._getOpenState(o) < 0) && (!this._hAdI)) { this.openItem(o.id) } if (v) { this._correctPlus(v); this._correctLine(v) } this._correctPlus(o); this._correctLine(o); this._correctPlus(u); if (o.childsCount >= 2) { this._correctPlus(F[o.childsCount - 2]); this._correctLine(F[o.childsCount - 2]) } if (o.childsCount != 2) { this._correctPlus(F[0]) } if (this.tscheck) { this._correctCheckStates(o) } if (this._onradh) { if (this.xmlstate == 1) { var a = this.onXLE; this.onXLE = function(n) { this._onradh(m); if (a) { a(n) } } } else { this._onradh(m) } } } return u }; dhtmlXTreeObject.prototype.enableContextMenu = function(a) { if (a) { this.cMenu = a } }; dhtmlXTreeObject.prototype.setItemContextMenu = function(m, h) { var a = m.toString().split(this.dlmtr); for (var g = 0; g < a.length; g++) { var c = this._globalIdStorageFind(a[g]); if (!c) { continue } c.cMenu = h } }; dhtmlXTreeObject.prototype.insertNewItem = function(h, o, r, g, n, m, l, c, a) { var s = this._globalIdStorageFind(h); if (!s) { return (-1) } var q = this._attachChildNode(s, o, r, g, n, m, l, c, a); if (!this._idpull[this.rootId].XMLload) { this._idpull[this.rootId].XMLload = 1 } if ((!this.XMLloadingWarning) && (this.childCalc)) { this._fixChildCountLabel(s) } return q }; dhtmlXTreeObject.prototype.insertNewChild = function(h, o, q, g, n, m, l, c, a) { return this.insertNewItem(h, o, q, g, n, m, l, c, a) }; dhtmlXTreeObject.prototype._parseXMLTree = function(h, g, o, n, l) { var m = new xmlPointer(l.getXMLTopNode("tree")); h._parse(m); h._p = m }; dhtmlXTreeObject.prototype._parseItem = function(m, r, l, o) { var g; if (this._srnd && (!this._idpull[g = m.get("id")] || !this._idpull[g].span)) { this._addItemSRND(r.id, g, m); return } var n = m.get_all(); if ((typeof(this.waitUpdateXML) == "object") && (!this.waitUpdateXML[n.id])) { this._parse(m, n.id, 1); return } if ((n.text === null) || (typeof(n.text) == "undefined")) { n.text = m.sub("itemtext"); if (n.text) { n.text = n.text.content() } } var u = []; if (n.select) { u.push("SELECT") } if (n.top) { u.push("TOP") } if (n.call) { this.nodeAskingCall = n.id } if (n.checked == -1) { u.push("HCHECKED") } else { if (n.checked) { u.push("CHECKED") } } if (n.open) { u.push("OPEN") } if (this.waitUpdateXML) { if (this._globalIdStorageFind(n.id)) { var q = this.updateItem(n.id, n.text, n.im0, n.im1, n.im2, n.checked, n.child) } else { if (this.npl == 0) { u.push("TOP") } else { l = r.childNodes[this.npl] } var q = this._attachChildNode(r, n.id, n.text, 0, n.im0, n.im1, n.im2, u.join(","), n.child, 0, l); n.id = q.id; l = null } } else { var q = this._attachChildNode(r, n.id, n.text, 0, n.im0, n.im1, n.im2, u.join(","), n.child, (o || 0), l) } if (n.tooltip) { q.span.parentNode.parentNode.title = n.tooltip } if (n.style) { if (q.span.style.cssText) { q.span.style.cssText += (";" + n.style) } else { q.span.setAttribute("style", q.span.getAttribute("style") + "; " + n.style) } } if (n.radio) { q._r_logic = true } if (n.nocheckbox) { var s = q.span.parentNode.previousSibling.previousSibling; s.style.display = "none"; q.nocheckbox = true } if (n.disabled) { if (n.checked != null) { this._setCheck(q, n.checked) } this.disableCheckbox(q, 1) } q._acc = n.child || 0; if (this.parserExtension) { this.parserExtension._parseExtension.call(this, m, n, (r ? r.id : 0)) } this.setItemColor(q, n.aCol, n.sCol); if (n.locked == "1") { this.lockItem(q.id, true, true) } if ((n.imwidth) || (n.imheight)) { this.setIconSize(n.imwidth, n.imheight, q) } if ((n.closeable == "0") || (n.closeable == "1")) { this.setItemCloseable(q, n.closeable) } var h = ""; if (n.topoffset) { this.setItemTopOffset(q, n.topoffset) } if ((!this.slowParse) || (typeof(this.waitUpdateXML) == "object")) { if (m.sub_exists("item")) { h = this._parse(m, n.id, 1) } } else { if ((!q.childsCount) && m.sub_exists("item")) { q.unParsed = m.clone() } m.each("userdata", function(a) { this.setUserData(n.id, a.get("name"), a.content()) }, this) } if (h != "") { this.nodeAskingCall = h } m.each("userdata", function(a) { this.setUserData(m.get("id"), a.get("name"), a.content()) }, this) }; dhtmlXTreeObject.prototype._parse = function(g, m, a, c) { if (this._srnd && !this.parentObject.offsetHeight) { var w = this; return window.setTimeout(function() { w._parse(g, m, a, c) }, 100) } if (!g.exists()) { return } this.skipLock = true; if (!m) { m = g.get("id"); var u = g.get("dhx_security"); if (u) { dhtmlx.security_key = u } if (g.get("radio")) { this.htmlNode._r_logic = true } this.parsingOn = m; this.parsedArray = new Array(); this.setCheckList = ""; this.nodeAskingCall = "" } var v = this._globalIdStorageFind(m); if (!v) { return dhtmlxError.throwError("DataStructure", "XML refers to not existing parent") } this.parsCount = this.parsCount ? (this.parsCount + 1) : 1; this.XMLloadingWarning = 1; if ((v.childsCount) && (!c) && (!this._edsbps) && (!v._has_top)) { var o = 0 } else { var o = 0 } this.npl = 0; g.each("item", function(x, n) { v.XMLload = 1; this._parseItem(x, v, 0, o); if ((this._edsbps) && (this.npl == this._edsbpsC)) { this._distributedStart(g, n + 1, m, a, v.childsCount); return -1 } this.npl++ }, this, c); if (!a) { g.each("userdata", function(n) { this.setUserData(g.get("id"), n.get("name"), n.content()) }, this); v.XMLload = 1; if (this.waitUpdateXML) { this.waitUpdateXML = false; for (var l = v.childsCount - 1; l >= 0; l--) { if (v.childNodes[l]._dmark) { this.deleteItem(v.childNodes[l].id) } } } var r = this._globalIdStorageFind(this.parsingOn); for (var l = 0; l < this.parsedArray.length; l++) { v.htmlNode.childNodes[0].appendChild(this.parsedArray[l]) } this.parsedArray = []; this.lastLoadedXMLId = m; this.XMLloadingWarning = 0; var s = this.setCheckList.split(this.dlmtr); for (var h = 0; h < s.length; h++) { if (s[h]) { this.setCheck(s[h], 1) } } if ((this.XMLsource) && (this.tscheck) && (this.smcheck) && (v.id != this.rootId)) { if (v.checkstate === 0) { this._setSubChecked(0, v) } else { if (v.checkstate === 1) { this._setSubChecked(1, v) } } } this._redrawFrom(this, null, c); if (g.get("order") && g.get("order") != "none") { this._reorderBranch(v, g.get("order"), true) } if (this.nodeAskingCall != "") { this.callEvent("onClick", [this.nodeAskingCall, this.getSelectedItemId()]) } if (this._branchUpdate) { this._branchUpdateNext(g) } } if (this.parsCount == 1) { this.parsingOn = null; if (this._srnd && v.id != this.rootId) { this.prepareSR(v.id); if (this.XMLsource) { this.openItem(v.id) } } g.through("item", "open", null, function(n) { this.openItem(n.get("id")) }, this); if ((!this._edsbps) || (!this._edsbpsA.length)) { var q = this; window.setTimeout(function() { q.callEvent("onXLE", [q, m]) }, 1); this.xmlstate = 0 } this.skipLock = false } this.parsCount--; var q = this; if (this._edsbps) { window.setTimeout(function() { q._distributedStep(m) }, this._edsbpsD) } if (!a && this.onXLE) { this.onXLE(this, m) } return this.nodeAskingCall }; dhtmlXTreeObject.prototype._branchUpdateNext = function(a) { a.each("item", function(h) { var g = h.get("id"); if (this._idpull[g] && (!this._idpull[g].XMLload)) { return } this._branchUpdate++; this.smartRefreshItem(h.get("id"), h) }, this); this._branchUpdate-- }; dhtmlXTreeObject.prototype.checkUserData = function(c, g) { if ((c.nodeType == 1) && (c.tagName == "userdata")) { var a = c.getAttribute("name"); if ((a) && (c.childNodes[0])) { this.setUserData(g, a, c.childNodes[0].data) } } }; dhtmlXTreeObject.prototype._redrawFrom = function(o, c, n, g) { if (!c) { var l = o._globalIdStorageFind(o.lastLoadedXMLId); o.lastLoadedXMLId = -1; if (!l) { return 0 } } else { l = c } var m = 0; for (var h = (n ? n - 1 : 0); h < l.childsCount; h++) { if ((!this._branchUpdate) || (this._getOpenState(l) == 1)) { if ((!c) || (g == 1)) { l.childNodes[h].htmlNode.parentNode.parentNode.style.display = "" } } if (l.childNodes[h].openMe == 1) { this._openItem(l.childNodes[h]); l.childNodes[h].openMe = 0 } o._redrawFrom(o, l.childNodes[h]); if (this.childCalc != null) { if ((l.childNodes[h].unParsed) || ((!l.childNodes[h].XMLload) && (this.XMLsource))) { if (l.childNodes[h]._acc) { l.childNodes[h].span.innerHTML = l.childNodes[h].label + this.htmlcA + l.childNodes[h]._acc + this.htmlcB } else { l.childNodes[h].span.innerHTML = l.childNodes[h].label } } if ((l.childNodes[h].childNodes.length) && (this.childCalc)) { if (this.childCalc == 1) { l.childNodes[h].span.innerHTML = l.childNodes[h].label + this.htmlcA + l.childNodes[h].childsCount + this.htmlcB } if (this.childCalc == 2) { var a = l.childNodes[h].childsCount - (l.childNodes[h].pureChilds || 0); if (a) { l.childNodes[h].span.innerHTML = l.childNodes[h].label + this.htmlcA + a + this.htmlcB } if (l.pureChilds) { l.pureChilds++ } else { l.pureChilds = 1 } } if (this.childCalc == 3) { l.childNodes[h].span.innerHTML = l.childNodes[h].label + this.htmlcA + l.childNodes[h]._acc + this.htmlcB } if (this.childCalc == 4) { var a = l.childNodes[h]._acc; if (a) { l.childNodes[h].span.innerHTML = l.childNodes[h].label + this.htmlcA + a + this.htmlcB } } } else { if (this.childCalc == 4) { m++ } } m += l.childNodes[h]._acc; if (this.childCalc == 3) { m++ } } } if ((!l.unParsed) && ((l.XMLload) || (!this.XMLsource))) { l._acc = m } o._correctLine(l); o._correctPlus(l); if ((this.childCalc) && (!c)) { o._fixChildCountLabel(l) } }; 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 h = c.htmlNode.childNodes[0].childNodes; var a = h.length; for (var g = 1; g < a; g++) { h[g].style.display = "none" } this._correctPlus(c) } for (var g = 0; g < c.childsCount; g++) { if (c.childNodes[g].childsCount) { this._xcloseAll(c.childNodes[g]) } } }; 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 g = c.htmlNode.childNodes[0].childNodes[0].childNodes[0].lastChild; var l = 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(l, this.iconURL + c.images[2]); if (this._txtimg) { return (g.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(l, this.iconURL + c.images[1]); if (this._txtimg) { return (g.innerHTML = "[-]") } } else { if (!c.wsign) { var a = this.plusArray } this._setSrc(l, this.iconURL + c.images[2]); if (this._txtimg) { return (g.innerHTML = "[+]") } } } else { this._setSrc(l, this.iconURL + c.images[0]) } } var h = 2; if (!c.treeNod.treeLinesOn) { this._setSrc(g, this.imPath + a[3]) } else { if (c.parentObject) { h = this._getCountStatus(c.id, c.parentObject) } this._setSrc(g, this.imPath + a[h]) } }; 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 g = 1; g <= c.childsCount; g++) { if (!c.htmlNode.childNodes[0].childNodes[g]) { break } c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundImage = ""; c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundRepeat = "" } } else { for (var g = 1; g <= c.childsCount; g++) { if (!c.htmlNode.childNodes[0].childNodes[g]) { break } c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundImage = "url(" + this.imPath + this.lineArray[5] + ")"; c.htmlNode.childNodes[0].childNodes[g].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, l) { if ((this.XMLsource) && (!c.XMLload)) { if (l == 1) { return } c.XMLload = 1; this._loadDynXML(c.id); return } if (c.unParsed) { this.reParse(c) } var h = c.htmlNode.childNodes[0].childNodes; var a = h.length; if (a > 1) { if (((h[1].style.display != "none") || (l == 1)) && (l != 2)) { this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0"; nodestyle = "none" } else { nodestyle = "" } for (var g = 1; g < a; g++) { h[g].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, g, a) { if (g != this.rootId) { this.callEvent("onOpenEnd", [g, c.getOpenState(g)]) } c.onXLE = c._oie_onXLE.pop(); if (!a && !c._oie_onXLE.length) { if (c.onXLE) { c.onXLE(c, g) } } }; 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(m, n) { if (this.checkEvent("onSelect")) { this._onSSCFold = this.getSelectedItemId() } if ((!this._amsel) || (!n) || ((!n.ctrlKey) && (!n.metaKey) && (!n.shiftKey))) { this._unselectItems() } if ((m.i_sel) && (this._amsel) && (n) && (n.ctrlKey || n.metaKey)) { this._unselectItem(m) } else { if ((!m.i_sel) && ((!this._amselS) || (this._selected.length == 0) || (this._selected[0].parentObject == m.parentObject))) { if ((this._amsel) && (n) && (n.shiftKey) && (this._selected.length != 0) && (this._selected[this._selected.length - 1].parentObject == m.parentObject)) { var h = this._getIndex(this._selected[this._selected.length - 1]); var g = this._getIndex(m); if (g < h) { var q = h; h = g; g = q } for (var l = h; l <= g; l++) { if (!m.parentObject.childNodes[l].i_sel) { this._markItem(m.parentObject.childNodes[l]) } } } else { this._markItem(m) } } } if (this.checkEvent("onSelect")) { var o = this.getSelectedItemId(); if (o != this._onSSCFold) { this.callEvent("onSelect", [o]) } } }; 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 g = a.parentObject; for (var c = 0; c < g.childsCount; c++) { if (g.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, m) { h = h || window.event; var c = this.parentObject; if (g) { c = g.parentObject } var a = c.treeNod; var l = a.getSelectedItemId(); if ((!h) || (!h.skipUnSel)) { a._selectItem(c, h) } if (!m) { if (c.actionHandler) { c.actionHandler(c.id, l) } else { a.callEvent("onClick", [c.id, l]) } } }; dhtmlXTreeObject.prototype._correctCheckStates = function(l) { if (!this.tscheck) { return } if (!l) { return } if (l.id == this.rootId) { return } var g = l.childNodes; var c = 0; var a = 0; if (l.childsCount == 0) { return } for (var h = 0; h < l.childsCount; h++) { if (g[h].dscheck) { continue } if (g[h].checkstate == 0) { c = 1 } else { if (g[h].checkstate == 1) { a = 1 } else { c = 1; a = 1; break } } } if ((c) && (a)) { this._setCheck(l, "unsure") } else { if (c) { this._setCheck(l, false) } else { this._setCheck(l, true) } } this._correctCheckStates(l.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(u, s, o) { var v = document.createElement("table"); v.cellSpacing = 0; v.cellPadding = 0; v.border = 0; if (this.hfMode) { v.style.tableLayout = "fixed" } v.style.margin = 0; v.style.padding = 0; var n = document.createElement("tbody"); var r = document.createElement("tr"); var h = document.createElement("td"); h.className = "standartTreeImage"; if (this._txtimg) { var l = document.createElement("div"); h.appendChild(l); l.className = "dhx_tree_textSign" } else { var l = this._getImg(s.id); l.border = "0"; if (l.tagName == "IMG") { l.align = "absmiddle" } h.appendChild(l); l.style.padding = 0; l.style.margin = 0; l.style.width = this.def_line_img_x; l.style.height = this.def_line_img_y } var g = document.createElement("td"); var q = this._getImg(this.cBROf ? this.rootId : s.id); q.checked = 0; this._setSrc(q, this.imPath + this.checkArray[0]); q.style.width = "18px"; q.style.height = "18px"; if (!u) { g.style.display = "none" } g.appendChild(q); if ((!this.cBROf) && (q.tagName == "IMG")) { q.align = "absmiddle" } q.onclick = this.onCheckBoxClick; q.treeNod = this; q.parentObject = s; if (!window._KHTMLrv) { g.width = "20px" } else { g.width = "16px" } var c = document.createElement("td"); c.className = "standartTreeImage"; var m = this._getImg(this.timgen ? s.id : this.rootId); m.onmousedown = this._preventNsDrag; m.ondragstart = this._preventNsDrag; m.border = "0"; if (this._aimgs) { m.parentObject = s; if (m.tagName == "IMG") { m.align = "absmiddle" } m.onclick = this.onRowSelect } if (!o) { this._setSrc(m, this.iconURL + this.imageArray[0]) } c.appendChild(m); m.style.padding = 0; m.style.margin = 0; if (this.timgen) { c.style.width = m.style.width = this.def_img_x; m.style.height = this.def_img_y } else { m.style.width = "0px"; m.style.height = "0px"; if (_isOpera || window._KHTMLrv) { c.style.display = "none" } } var a = document.createElement("td"); a.className = "standartTreeRow"; s.span = document.createElement("span"); s.span.className = "standartTreeRow"; if (this.mlitems) { s.span.style.width = this.mlitems; s.span.style.display = "block" } else { a.noWrap = true } if (_isIE && _isIE > 7) { a.style.width = "999999px" } else { if (!window._KHTMLrv) { a.style.width = "100%" } } s.span.innerHTML = s.label; a.appendChild(s.span); a.parentObject = s; h.parentObject = s; a.onclick = this.onRowSelect; h.onclick = this.onRowClick; a.ondblclick = this.onRowClick2; if (this.ettip) { r.title = s.label } if (this.dragAndDropOff) { if (this._aimgs) { this.dragger.addDraggableItem(c, this); c.parentObject = s } this.dragger.addDraggableItem(a, this) } s.span.style.paddingLeft = "5px"; s.span.style.paddingRight = "5px"; a.style.verticalAlign = ""; a.style.fontSize = "10pt"; a.style.cursor = this.style_pointer; r.appendChild(h); r.appendChild(g); r.appendChild(c); r.appendChild(a); n.appendChild(r); v.appendChild(n); if (this.ehlt || this.checkEvent("onMouseIn") || this.checkEvent("onMouseOut")) { r.onmousemove = this._itemMouseIn; r[(_isIE) ? "onmouseleave" : "onmouseout"] = this._itemMouseOut } return v }; dhtmlXTreeObject.prototype.setImagePath = function(a) { this.imPath = a; this.iconURL = a }; dhtmlXTreeObject.prototype.setIconPath = function(a) { this.iconURL = a }; dhtmlXTreeObject.prototype._getLeafCount = function(h) { var g = 0; for (var c = 0; c < h.childsCount; c++) { if (h.childNodes[c].childsCount == 0) { g++ } } return g }; 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(m, h) { if (this.childCalc == null) { return } if ((m.unParsed) || ((!m.XMLload) && (this.XMLsource))) { if (m._acc) { m.span.innerHTML = m.label + this.htmlcA + m._acc + this.htmlcB } else { m.span.innerHTML = m.label } return } switch (this.childCalc) { case 1: if (m.childsCount != 0) { m.span.innerHTML = m.label + this.htmlcA + m.childsCount + this.htmlcB } else { m.span.innerHTML = m.label } break; case 2: var l = this._getLeafCount(m); if (l != 0) { m.span.innerHTML = m.label + this.htmlcA + l + this.htmlcB } else { m.span.innerHTML = m.label } break; case 3: if (m.childsCount != 0) { var g = 0; for (var c = 0; c < m.childsCount; c++) { if (!m.childNodes[c]._acc) { m.childNodes[c]._acc = 0 } g += m.childNodes[c]._acc * 1 } g += m.childsCount * 1; m.span.innerHTML = m.label + this.htmlcA + g + this.htmlcB; m._acc = g } else { m.span.innerHTML = m.label; m._acc = 0 } if ((m.parentObject) && (m.parentObject != this.htmlNode)) { this._fixChildCountLabel(m.parentObject) } break; case 4: if (m.childsCount != 0) { var g = 0; for (var c = 0; c < m.childsCount; c++) { if (!m.childNodes[c]._acc) { m.childNodes[c]._acc = 1 } g += m.childNodes[c]._acc * 1 } m.span.innerHTML = m.label + this.htmlcA + g + this.htmlcB; m._acc = g } else { m.span.innerHTML = m.label; m._acc = 1 } if ((m.parentObject) && (m.parentObject != this.htmlNode)) { this._fixChildCountLabel(m.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(h, c, g) { var a = this._globalIdStorageFind(h, 0, true); if (!a) { return } if (c == "hint") { a.htmlNode.childNodes[0].childNodes[0].title = g } if (typeof(a.userData["t_" + c]) == "undefined") { if (!a._userdatalist) { a._userdatalist = c } else { a._userdatalist += "," + c } } a.userData["t_" + c] = g }; dhtmlXTreeObject.prototype.getUserData = function(g, c) { var a = this._globalIdStorageFind(g, 0, true); if (!a) { return } return a.userData["t_" + c] }; dhtmlXTreeObject.prototype.getItemColor = function(g) { var a = this._globalIdStorageFind(g); 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(g, c, h) { if ((g) && (g.span)) { var a = g } else { var a = this._globalIdStorageFind(g) } if (!a) { return 0 } else { if (a.i_sel) { if (h) { a.span.style.color = h } } else { if (c) { a.span.style.color = c } } if (h) { a.scolor = h } 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, g) { if (c == g) { return } var a = this._globalIdStorageFind(c); if (!a) { return 0 } a.id = g; a.span.contextMenuId = g; this._idpull[g] = 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(g) { var a = this._globalIdStorageFind(g); 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 m = this.dadmodec; if (m == 1) { var l = c; if (this.dadmodefix < 0) { while (true) { l = this._getPrevNode(l); if ((l == -1)) { l = this.htmlNode; break } if ((l.tr == 0) || (l.tr.style.display == "") || (!l.parentObject)) { break } } var h = l; var g = c } else { if ((l.tr) && (l.tr.nextSibling) && (l.tr.nextSibling.nodem) && (this._getOpenState(l) < 1)) { l = l.tr.nextSibling.nodem } else { l = this._getNextNode(l); if ((l == -1)) { l = this.htmlNode } } var g = l; var h = c } if (this._getNodeLevel(h, 0) > this._getNodeLevel(g, 0)) { if (!this.dropLower) { return this._moveNodeTo(a, h.parentObject) } else { if (g.id != this.rootId) { return this._moveNodeTo(a, g.parentObject, g) } else { return this._moveNodeTo(a, this.htmlNode, null) } } } else { return this._moveNodeTo(a, g.parentObject, g) } } else { return this._moveNodeTo(a, c) } }; dhtmlXTreeObject.prototype._fixNodesCollection = function(o, m) { var c = 0; var h = 0; var n = o.childNodes; var a = o.childsCount - 1; if (m == n[a]) { return } for (var l = 0; l < a; l++) { if (n[l] == n[a]) { n[l] = n[l + 1]; n[l + 1] = n[a] } } for (var l = 0; l < a + 1; l++) { if (c) { var g = n[l]; n[l] = c; c = g } else { if (n[l] == m) { c = n[l]; n[l] = n[a] } } } }; dhtmlXTreeObject.prototype._recreateBranch = function(m, o, l, a) { var c; var q = ""; if (l) { for (c = 0; c < o.childsCount; c++) { if (o.childNodes[c] == l) { break } } if (c != 0) { l = o.childNodes[c - 1] } else { q = "TOP"; l = "" } } var g = this._onradh; this._onradh = null; var n = this._attachChildNode(o, m.id, m.label, 0, m.images[0], m.images[1], m.images[2], q, 0, l); n._userdatalist = m._userdatalist; n.userData = m.userData.clone(); if (m._attrs) { n._attrs = {}; for (var h in m._attrs) { n._attrs[h] = m._attrs[h] } } n.XMLload = m.XMLload; if (g) { this._onradh = g; this._onradh(n.id) } if (m.treeNod.dpcpy) { m.treeNod._globalIdStorageFind(m.id) } else { n.unParsed = m.unParsed } this._correctPlus(n); for (var c = 0; c < m.childsCount; c++) { this._recreateBranch(m.childNodes[c], n, 0, 1) } if ((!a) && (this.childCalc)) { this._redrawFrom(this, o) } return n }; dhtmlXTreeObject.prototype._moveNodeTo = function(u, w, s) { if (u.treeNod._nonTrivialNode) { return u.treeNod._nonTrivialNode(this, w, s, u) } if (this._checkPNodes(w, u)) { return false } if (w.mytype) { var n = (u.treeNod.lWin != w.lWin) } else { var n = (u.treeNod.lWin != w.treeNod.lWin) } if (!this.callEvent("onDrag", [u.id, w.id, (s ? s.id : null), u.treeNod, w.treeNod])) { return false } if ((w.XMLload == 0) && (this.XMLsource)) { w.XMLload = 1; this._loadDynXML(w.id) } this.openItem(w.id); var g = u.treeNod; var q = u.parentObject.childsCount; var r = u.parentObject; if ((n) || (g.dpcpy)) { var h = u.id; u = this._recreateBranch(u, w, s); if (!g.dpcpy) { g.deleteItem(h) } } else { var l = w.childsCount; var v = w.childNodes; if (l == 0) { w._open = true } g._unselectItem(u); v[l] = u; u.treeNod = w.treeNod; w.childsCount++; var o = this._drawNewTr(v[l].htmlNode); if (!s) { w.htmlNode.childNodes[0].appendChild(o); if (this.dadmode == 1) { this._fixNodesCollection(w, s) } } else { w.htmlNode.childNodes[0].insertBefore(o, s.tr); this._fixNodesCollection(w, s); v = w.childNodes } } if ((!g.dpcpy) && (!n)) { var a = u.tr; if ((document.all) && (navigator.appVersion.search(/MSIE\ 5\.0/gi) != -1)) { window.setTimeout(function() { a.parentNode.removeChild(a) }, 250) } else { u.parentObject.htmlNode.childNodes[0].removeChild(u.tr) } if ((!s) || (w != u.parentObject)) { for (var m = 0; m < r.childsCount; m++) { if (r.childNodes[m].id == u.id) { r.childNodes[m] = 0; break } } } else { r.childNodes[r.childsCount - 1] = 0 } g._compressChildList(r.childsCount, r.childNodes); r.childsCount-- } if ((!n) && (!g.dpcpy)) { u.tr = o; o.nodem = u; u.parentObject = w; if (g != w.treeNod) { if (u.treeNod._registerBranch(u, g)) { return } this._clearStyles(u); this._redrawFrom(this, u.parentObject); if (this._onradh) { this._onradh(u.id) } } this._correctPlus(w); this._correctLine(w); this._correctLine(u); this._correctPlus(u); if (s) { this._correctPlus(s) } else { if (w.childsCount >= 2) { this._correctPlus(v[w.childsCount - 2]); this._correctLine(v[w.childsCount - 2]) } } this._correctPlus(v[w.childsCount - 1]); if (this.tscheck) { this._correctCheckStates(w) } if (g.tscheck) { g._correctCheckStates(r) } } if (q > 1) { g._correctPlus(r.childNodes[q - 2]); g._correctLine(r.childNodes[q - 2]) } g._correctPlus(r); g._correctLine(r); this._fixChildCountLabel(w); g._fixChildCountLabel(r); this.callEvent("onDrop", [u.id, w.id, (s ? s.id : null), g, w.treeNod]); return u.id }; dhtmlXTreeObject.prototype._clearStyles = function(a) { if (!a.htmlNode) { return } var h = a.htmlNode.childNodes[0].childNodes[0].childNodes[1]; var c = h.nextSibling.nextSibling; a.span.innerHTML = a.label; a.i_sel = false; if (a._aimgs) { this.dragger.removeDraggableItem(h.nextSibling) } if (this.checkBoxOff) { h.childNodes[0].style.display = ""; h.childNodes[0].onclick = this.onCheckBoxClick; this._setSrc(h.childNodes[0], this.imPath + this.checkArray[a.checkstate]) } else { h.style.display = "none" } h.childNodes[0].treeNod = this; this.dragger.removeDraggableItem(c); if (this.dragAndDropOff) { this.dragger.addDraggableItem(c, this) } if (this._aimgs) { this.dragger.addDraggableItem(h.nextSibling, this) } c.childNodes[0].className = "standartTreeRow"; c.onclick = this.onRowSelect; c.ondblclick = this.onRowClick2; h.previousSibling.onclick = this.onRowClick; this._correctLine(a); this._correctPlus(a); for (var g = 0; g < a.childsCount; g++) { this._clearStyles(a.childNodes[g]) } }; dhtmlXTreeObject.prototype._registerBranch = function(c, a) { if (a) { a._globalIdStorageSub(c.id) } c.id = this._globalIdStorageAdd(c.id, c); c.treeNod = this; for (var g = 0; g < c.childsCount; g++) { this._registerBranch(c.childNodes[g], a) } return 0 }; dhtmlXTreeObject.prototype.enableThreeStateCheckboxes = function(a) { this.tscheck = convertStringToBoolean(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 = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.enableTreeImages = function(a) { this.timgen = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.enableFixedMode = function(a) { this.hfMode = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.enableCheckBoxes = function(c, a) { this.checkBoxOff = convertStringToBoolean(c); this.cBROf = (!(this.checkBoxOff || convertStringToBoolean(a))) }; dhtmlXTreeObject.prototype.setStdImages = function(a, g, c) { this.imageArray[0] = a; this.imageArray[1] = g; this.imageArray[2] = c }; dhtmlXTreeObject.prototype.enableTreeLines = function(a) { this.treeLinesOn = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.setImageArrays = function(h, a, m, l, g, c) { switch (h) { case "plus": this.plusArray[0] = a; this.plusArray[1] = m; this.plusArray[2] = l; this.plusArray[3] = g; this.plusArray[4] = c; break; case "minus": this.minusArray[0] = a; this.minusArray[1] = m; this.minusArray[2] = l; this.minusArray[3] = g; 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(g, a) { a = convertStringToBoolean(a); if ((g) && (g.span)) { var c = g } else { var c = this._globalIdStorageFind(g) } 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(h) { var g = 0; for (var c = 0; c < h.childsCount; c++) { if (h.childNodes[c].childsCount == 0) { g++ } } return g }; dhtmlXTreeObject.prototype.setItemText = function(h, g, c) { var a = this._globalIdStorageFind(h); if (!a) { return 0 } a.label = g; a.span.innerHTML = g; 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.deleteChildItems(c); this._loadDynXML(c) }; dhtmlXTreeObject.prototype.setItemImage2 = function(h, a, l, g) { var c = this._globalIdStorageFind(h); if (!c) { return 0 } c.images[1] = l; c.images[2] = g; c.images[0] = a; this._correctPlus(c) }; dhtmlXTreeObject.prototype.setItemImage = function(g, a, h) { var c = this._globalIdStorageFind(g); if (!c) { return 0 } if (h) { c.images[1] = a; c.images[2] = h } else { c.images[0] = a } this._correctPlus(c) }; dhtmlXTreeObject.prototype.getSubItems = function(g) { var a = this._globalIdStorageFind(g, 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(g) { var h = ""; for (var c = 0; c < g.childsCount; c++) { if ((g.childNodes[c].unParsed) || (g.childNodes[c].childsCount > 0)) { if (g.childNodes[c].unParsed) { var a = this._getAllScraggyItemsXML(g.childNodes[c].unParsed, 1) } else { var a = this._getAllScraggyItems(g.childNodes[c]) } if (a) { if (h) { h += this.dlmtr + a } else { h = a } } } else { if (!h) { h = "" + g.childNodes[c].id } else { h += this.dlmtr + g.childNodes[c].id } } } return h }; dhtmlXTreeObject.prototype._getAllFatItems = function(g) { var h = ""; for (var c = 0; c < g.childsCount; c++) { if ((g.childNodes[c].unParsed) || (g.childNodes[c].childsCount > 0)) { if (!h) { h = "" + g.childNodes[c].id } else { h += this.dlmtr + g.childNodes[c].id } if (g.childNodes[c].unParsed) { var a = this._getAllFatItemsXML(g.childNodes[c].unParsed, 1) } else { var a = this._getAllFatItems(g.childNodes[c]) } if (a) { h += this.dlmtr + a } } } return h }; dhtmlXTreeObject.prototype._getAllSubItems = function(m, l, h) { if (h) { c = h } else { var c = this._globalIdStorageFind(m) } if (!c) { return 0 } l = ""; for (var g = 0; g < c.childsCount; g++) { if (!l) { l = "" + c.childNodes[g].id } else { l += this.dlmtr + c.childNodes[g].id } var a = this._getAllSubItems(0, l, c.childNodes[g]); if (a) { l += this.dlmtr + a } } if (c.unParsed) { l = this._getAllSubItemsXML(m, l, c.unParsed) } return l }; dhtmlXTreeObject.prototype.selectItem = function(h, g, c) { g = convertStringToBoolean(g); var a = this._globalIdStorageFind(h); if ((!a) || (!a.parentObject)) { return 0 } if (this.XMLloadingWarning) { a.parentObject.openMe = 1 } else { this._openItem(a.parentObject) } var l = null; if (c) { l = new Object; l.ctrlKey = true; if (a.i_sel) { l.skipUnSel = true } } if (g) { this.onRowSelect(l, a.htmlNode.childNodes[0].childNodes[0].childNodes[3], false) } else { this.onRowSelect(l, 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, g) { a--; for (var c = 0; c < a; c++) { if (g[c] == 0) { g[c] = g[c + 1]; g[c + 1] = 0 } } }; dhtmlXTreeObject.prototype._deleteNode = function(n, l, q) { if ((!l) || (!l.parentObject)) { return 0 } var a = 0; var c = 0; if (l.tr.nextSibling) { a = l.tr.nextSibling.nodem } if (l.tr.previousSibling) { c = l.tr.previousSibling.nodem } var m = l.parentObject; var g = m.childsCount; var o = m.childNodes; for (var h = 0; h < g; h++) { if (o[h].id == n) { if (!q) { m.htmlNode.childNodes[0].removeChild(o[h].tr) } o[h] = 0; break } } this._compressChildList(g, o); if (!q) { m.childsCount-- } if (a) { this._correctPlus(a); this._correctLine(a) } if (c) { this._correctPlus(c); this._correctLine(c) } if (this.tscheck) { this._correctCheckStates(m) } if (!q) { this._globalIdStorageRecSub(l) } }; dhtmlXTreeObject.prototype.setCheck = function(g, c) { var a = this._globalIdStorageFind(g, 0, 1); if (!a) { return } if (c === "unsure") { this._setCheck(a, c) } else { c = convertStringToBoolean(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, g) { if (!a) { return } if (((a.parentObject._r_logic) || (this._frbtr)) && (g)) { 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 h = a.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0]; if (g == "unsure") { a.checkstate = 2 } else { if (g) { a.checkstate = 1 } else { a.checkstate = 0 } } if (a.dscheck) { a.checkstate = a.dscheck } this._setSrc(h, this.imPath + ((a.parentObject._r_logic || this._frbtr) ? this.radioArray : this.checkArray)[a.checkstate]) }; dhtmlXTreeObject.prototype.setSubChecked = function(g, c) { var a = this._globalIdStorageFind(g); this._setSubChecked(c, a); this._correctCheckStates(a.parentObject) }; dhtmlXTreeObject.prototype._setSubChecked = function(g, a) { g = convertStringToBoolean(g); if (!a) { return } if (((a.parentObject._r_logic) || (this._frbtr)) && (g)) { for (var c = 0; c < a.parentObject.childsCount; c++) { this._setSubChecked(0, a.parentObject.childNodes[c]) } } if (a.unParsed) { this._setSubCheckedXML(g, a.unParsed) } if (a._r_logic || this._frbtr) { this._setSubChecked(g, a.childNodes[0]) } else { for (var c = 0; c < a.childsCount; c++) { this._setSubChecked(g, a.childNodes[c]) } } var h = a.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0]; if (g) { a.checkstate = 1 } else { a.checkstate = 0 } if (a.dscheck) { a.checkstate = a.dscheck } this._setSrc(h, 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(h) { var a = this._globalIdStorageFind(h); if (!a) { return } var c = a.childsCount; for (var g = 0; g < c; g++) { this._deleteNode(a.childNodes[0].id, a.childNodes[0]) } }; dhtmlXTreeObject.prototype.deleteItem = function(g, a) { if ((!this._onrdlh) || (this._onrdlh(g))) { var c = this._deleteItem(g, a); if (c) { this._fixChildCountLabel(c) } } this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0" }; dhtmlXTreeObject.prototype._deleteItem = function(m, c, l) { c = convertStringToBoolean(c); var a = this._globalIdStorageFind(m); if (!a) { return } var g = this.getParentId(m); var h = a.parentObject; this._deleteNode(m, a, l); if (this._editCell && this._editCell.id == m) { this._editCell = null } this._correctPlus(h); this._correctLine(h); if ((c) && (g != this.rootId)) { this.selectItem(g, 1) } return h }; 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 g = a; g.span = null; g.tr.nodem = null; g.tr = null; g.htmlNode = null }; dhtmlXTreeObject.prototype.insertNewNext = function(o, s, r, g, m, l, h, c, a) { var n = this._globalIdStorageFind(o); if ((!n) || (!n.parentObject)) { return (0) } var q = this._attachChildNode(0, s, r, g, m, l, h, c, a, n); if ((!this.XMLloadingWarning) && (this.childCalc)) { this._fixChildCountLabel(n.parentObject) } return q }; dhtmlXTreeObject.prototype.getItemIdByIndex = function(g, a) { var c = this._globalIdStorageFind(g); if ((!c) || (a >= c.childsCount)) { return null } return c.childNodes[a].id }; dhtmlXTreeObject.prototype.getChildItemIdByIndex = function(g, a) { var c = this._globalIdStorageFind(g); 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 = convertStringToBoolean(c); if (this.dragAndDropOff) { this.dragger.addDragLanding(this.allTree, this) } if (arguments.length > 1) { this._ddronr = (!convertStringToBoolean(a)) } }; dhtmlXTreeObject.prototype._setMove = function(l, g, n) { if (l.parentObject.span) { var h = getAbsoluteTop(l); var c = getAbsoluteTop(this.allTree) - this.allTree.scrollTop; this.dadmodec = this.dadmode; this.dadmodefix = 0; if (this.dadmode == 2) { var m = n - h + (document.body.scrollTop || document.documentElement.scrollTop) - 2 - l.offsetHeight / 2; if ((Math.abs(m) - l.offsetHeight / 6) > 0) { this.dadmodec = 1; if (m < 0) { this.dadmodefix = 0 - l.offsetHeight } } else { this.dadmodec = 0 } } if (this.dadmodec == 0) { var a = l.parentObject.span; a.className += " dragAndDropRow"; this._lastMark = a } else { this._clearMove(); this.selectionBar.style.top = (h - c + ((parseInt(l.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, h, c) } }; dhtmlXTreeObject.prototype._autoScroll = function(g, c, a) { if (this.autoScroll) { if (g) { c = getAbsoluteTop(g); a = getAbsoluteTop(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(l, h) { if (!this.dADTempOff) { return null } var g = l.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 m = new Array(); if (this._itim_dg) { for (var a = 0; a < this._selected.length; a++) { m[a] = "
" + this._selected[a].span.innerHTML + "
" } } else { m = this.getSelectedItemText().split(this.dlmtr) } c.innerHTML = m.join(""); c.style.position = "absolute"; c.className = "dragSpanDiv"; this._dragged = (new Array()).concat(this._selected); return c }; dhtmlXTreeObject.prototype._focusNode = function(a) { var c = getAbsoluteTop(a.htmlNode) - getAbsoluteTop(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(n, o, 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 m = n.parentObject.treeNod; if ((m) && (m._clearMove)) { m._clearMove("") } if ((!this.dragMove) || (this.dragMove())) { if ((!m) || (!m._clearMove) || (!m._dragged)) { var h = new Array(n.parentObject) } else { var h = m._dragged } var c = a.parentObject; for (var l = 0; l < h.length; l++) { var g = this._moveNode(h[l], c); if ((this.dadmodec) && (g !== false)) { c = this._globalIdStorageFind(g, true, true) } if ((g) && (!this._sADnD)) { this.selectItem(g, 0, 1) } } } if (m) { m._dragged = new Array() } }; dhtmlXTreeObject.prototype._dragIn = function(m, h, a, o) { if (!this.dADTempOff) { return 0 } var n = h.parentObject; var c = m.parentObject; if ((!c) && (this._ddronr)) { return } if (!this.callEvent("onDragIn", [n.id, c ? c.id : null, n.treeNod, this])) { if (c) { this._autoScroll(m) } return 0 } if (!c) { this.allTree.className += " selectionBox" } else { if (n.childNodes == null) { this._setMove(m, a, o); return m } var l = n.treeNod; for (var g = 0; g < l._dragged.length; g++) { if (this._checkPNodes(c, l._dragged[g])) { this._autoScroll(m); return 0 } } this.selectionBar.parentNode.removeChild(this.selectionBar); c.span.parentNode.appendChild(this.selectionBar); this._setMove(m, a, o); if (this._getOpenState(c) <= 0) { this._autoOpenId = c.id; this._autoOpenTimer = window.setTimeout(new callerFunction(this._autoOpenItem, this), 1000) } } return m }; 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, g, c) { var h = this._findNodeByLabel(a, g, (c ? this.htmlNode : null)); if (h) { this.selectItem(h.id, true); this._focusNode(h); return h.id } else { return null } }; dhtmlXTreeObject.prototype.findItemIdByLabel = function(a, g, c) { var h = this._findNodeByLabel(a, g, (c ? this.htmlNode : null)); if (h) { return h.id } else { return null } }; dhtmlXTreeObject.prototype.findStrInXML = function(c, g, l) { if (!c.childNodes && c.item) { return this.findStrInJSON(c, g, l) } if (!c.childNodes) { return false } for (var a = 0; a < c.childNodes.length; a++) { if (c.childNodes[a].nodeType == 1) { var h = c.childNodes[a].getAttribute(g); if (!h && c.childNodes[a].tagName == "itemtext") { h = c.childNodes[a].firstChild.data } if ((h) && (h.toLowerCase().search(l) != -1)) { return true } if (this.findStrInXML(c.childNodes[a], g, l)) { return true } } } return false }; dhtmlXTreeObject.prototype.findStrInJSON = function(c, g, l) { for (var a = 0; a < c.item.length; a++) { var h = c.item[a].text; if ((h) && (h.toLowerCase().search(l) != -1)) { return true } if (c.item[a].item && this.findStrInJSON(c.item[a], g, l)) { return true } } return false }; dhtmlXTreeObject.prototype._findNodeByLabel = function(a, l, h) { var a = a.replace(new RegExp("^( )+"), "").replace(new RegExp("( )+$"), ""); a = new RegExp(a.replace(/([\^\.\?\*\+\\\[\]\(\)]{1})/gi, "\\$1").replace(/ /gi, ".*"), "gi"); if (!h) { h = this._selected[0]; if (!h) { h = this.htmlNode } } var c = h; if (!l) { if ((h.unParsed) && (this.findStrInXML(h.unParsed.d, "text", a))) { this.reParse(h) } h = this._getNextNode(c); if (h == -1) { h = this.htmlNode.childNodes[0] } } else { var g = this._getPrevNode(c); if (g == -1) { g = this._lastChild(this.htmlNode) } if ((g.unParsed) && (this.findStrInXML(g.unParsed.d, "text", a))) { this.reParse(g); h = this._getPrevNode(c) } else { h = g } if (h == -1) { h = this._lastChild(this.htmlNode) } } while ((h) && (h != c)) { if ((h.label) && (h.label.search(a) != -1)) { return (h) } if (!l) { if (h == -1) { if (c == this.htmlNode) { break } h = this.htmlNode.childNodes[0] } if ((h.unParsed) && (this.findStrInXML(h.unParsed.d, "text", a))) { this.reParse(h) } h = this._getNextNode(h); if (h == -1) { h = this.htmlNode } } else { var g = this._getPrevNode(h); if (g == -1) { g = this._lastChild(this.htmlNode) } if ((g.unParsed) && (this.findStrInXML(g.unParsed.d, "text", a))) { this.reParse(g); h = this._getPrevNode(h) } else { h = g } if (h == -1) { h = this._lastChild(this.htmlNode) } } } return null }; dhtmlXTreeObject.prototype.moveItem = function(o, c, q, a) { var l = this._globalIdStorageFind(o); if (!l) { return (0) } var m = null; switch (c) { case "right": alert("Not supported yet"); break; case "item_child": var g = (a || this)._globalIdStorageFind(q); if (!g) { return (0) } m = (a || this)._moveNodeTo(l, g, 0); break; case "item_sibling": var g = (a || this)._globalIdStorageFind(q); if (!g) { return (0) } m = (a || this)._moveNodeTo(l, g.parentObject, g); break; case "item_sibling_next": var g = (a || this)._globalIdStorageFind(q); if (!g) { return (0) } if ((g.tr) && (g.tr.nextSibling) && (g.tr.nextSibling.nodem)) { m = (a || this)._moveNodeTo(l, g.parentObject, g.tr.nextSibling.nodem) } else { m = (a || this)._moveNodeTo(l, g.parentObject) } break; case "left": if (l.parentObject.parentObject) { m = this._moveNodeTo(l, l.parentObject.parentObject, l.parentObject) } break; case "up": var n = this._getPrevNode(l); if ((n == -1) || (!n.parentObject)) { return null } m = this._moveNodeTo(l, n.parentObject, n); break; case "up_strict": var n = this._getIndex(l); if (n != 0) { m = this._moveNodeTo(l, l.parentObject, l.parentObject.childNodes[n - 1]) } break; case "down_strict": var n = this._getIndex(l); var h = l.parentObject.childsCount - 2; if (n == h) { m = this._moveNodeTo(l, l.parentObject) } else { if (n < h) { m = this._moveNodeTo(l, l.parentObject, l.parentObject.childNodes[n + 2]) } } break; case "down": var n = this._getNextNode(this._lastChild(l)); if ((n == -1) || (!n.parentObject)) { return } if (n.parentObject == l.parentObject) { var n = this._getNextNode(n) } if (n == -1) { m = this._moveNodeTo(l, l.parentObject) } else { if ((n == -1) || (!n.parentObject)) { return } m = this._moveNodeTo(l, n.parentObject, n) } break } if (_isIE && _isIE < 8) { this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0" } return m }; dhtmlXTreeObject.prototype.setDragBehavior = function(c, a) { this._sADnD = (!convertStringToBoolean(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(g, c) { c = c || this.XMLsource; var a = (new Date()).valueOf(); this._ld_id = g; if (this.xmlalb == "function") { if (c) { c(this._escape(g)) } } else { if (this.xmlalb == "name") { this.loadXML(c + this._escape(g)) } else { if (this.xmlalb == "xmlname") { this.loadXML(c + this._escape(g) + ".xml?uid=" + a) } else { this.loadXML(c + getUrlSymbol(c) + "uid=" + a + "&id=" + this._escape(g)) } } } }; dhtmlXTreeObject.prototype.enableMultiselection = function(c, a) { this._amsel = convertStringToBoolean(c); this._amselS = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype._checkMSelectionLogic = function() { var g = 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]))) { g[g.length] = this._selected[a] } } } for (var c = 0; c < g.length; c++) { this._unselectItem(g[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 = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.enableDistributedParsing = function(g, c, a) { this._edsbps = convertStringToBoolean(g); 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(g) { var c = this._globalIdStorageFind(g, true, true); if (!c) { return 0 } if (this._edsbpsA) { for (var a = 0; a < this._edsbpsA.length; a++) { if (this._edsbpsA[a][2] == g) { return -1 } } } return 1 }; dhtmlXTreeObject.prototype._distributedStart = function(c, l, h, g, a) { if (!this._edsbpsA) { this._edsbpsA = new Array() } this._edsbpsA[this._edsbpsA.length] = [c, l, h, g, a] }; dhtmlXTreeObject.prototype._distributedStep = function(h) { var c = this; if ((!this._edsbpsA) || (!this._edsbpsA.length)) { c.XMLloadingWarning = 0; return } var l = this._edsbpsA[0]; this.parsedArray = new Array(); this._parse(l[0], l[2], l[3], l[1]); var a = this._globalIdStorageFind(l[2]); this._redrawFrom(this, a, l[4], this._getOpenState(a)); var g = this.setCheckList.split(this.dlmtr); for (var m = 0; m < g.length; m++) { if (g[m]) { this.setCheck(g[m], 1) } } this._edsbpsA = (new Array()).concat(this._edsbpsA.slice(1)); if ((!this._edsbpsA.length)) { window.setTimeout(function() { if (c.onXLE) { c.onXLE(c, h) } c.callEvent("onXLE", [c, h]) }, 1); c.xmlstate = 0 } }; dhtmlXTreeObject.prototype.enableTextSigns = function(a) { this._txtimg = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.preventIECaching = function(a) { this.no_cashe = convertStringToBoolean(a); this.XMLLoader.rSeed = this.no_cashe }; dhtmlXTreeObject.prototype.preventIECashing = dhtmlXTreeObject.prototype.preventIECaching; dhtmlXTreeObject.prototype.disableCheckbox = function(g, c) { if (typeof(g) != "object") { var a = this._globalIdStorageFind(g, 0, 1) } else { var a = g } if (!a) { return } a.dscheck = convertStringToBoolean(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(h, g) { var a = this._globalIdStorageFind(h); for (var c = 0; c < a.childsCount; c++) { a.childNodes[c]._dmark = true } this.waitUpdateXML = true; if (g && g.exists) { this._parse(g, h) } else { this._loadDynXML(h, g) } }; dhtmlXTreeObject.prototype.refreshItems = function(c, g) { var h = c.toString().split(this.dlmtr); this.waitUpdateXML = new Array(); for (var a = 0; a < h.length; a++) { this.waitUpdateXML[h[a]] = true } this.loadXML((g || this.XMLsource) + getUrlSymbol(g || this.XMLsource) + "ids=" + this._escape(c)) }; dhtmlXTreeObject.prototype.updateItem = function(n, m, h, g, c, l, o) { var a = this._globalIdStorageFind(n); a.userData = new cObject(); if (m) { a.label = m } a.images = new Array(h || this.imageArray[0], g || this.imageArray[1], c || this.imageArray[2]); this.setItemText(n, m); if (l) { this._setCheck(a, true) } if (o == "1" && !this.hasChildren(n)) { 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 = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.getXMLState = function() { return (this.xmlstate == 1) }; dhtmlXTreeObject.prototype.setItemTopOffset = function(m, h) { var g; if (typeof(m) != "object") { g = this._globalIdStorageFind(m) } else { g = m } var l = g.span.parentNode.parentNode; g.span.style.paddingBottom = "1px"; for (var c = 0; c < l.childNodes.length; c++) { if (c != 0) { if (_isIE) { l.childNodes[c].style.height = "18px"; l.childNodes[c].style.paddingTop = parseInt(h) + "px" } else { l.childNodes[c].style.height = 18 + parseInt(h) + "px" } } else { var a = l.childNodes[c].firstChild; if (l.childNodes[c].firstChild.tagName != "DIV") { a = document.createElement("DIV"); l.childNodes[c].insertBefore(a, l.childNodes[c].firstChild) } a.style.height = parseInt(h) + "px"; if ((g.parentObject.id != this.rootId || g.parentObject.childNodes[0] != g) && this.treeLinesOn) { a.style.backgroundImage = "url(" + this.imPath + this.lineArray[5] + ")" } a.innerHTML = " "; a.style.overflow = "hidden"; if (parseInt(h) == 0) { l.childNodes[c].removeChild(a) } } if (!_isIE) { l.childNodes[c].style.verticalAlign = "bottom" } if (_isIE) { this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0" } } }; dhtmlXTreeObject.prototype.setIconSize = function(h, c, l) { if (l) { if ((l) && (l.span)) { var a = l } else { var a = this._globalIdStorageFind(l) } if (!a) { return (0) } var g = a.span.parentNode.previousSibling.childNodes[0]; if (h) { g.style.width = h; if (window._KHTMLrv) { g.parentNode.style.width = h } } if (c) { g.style.height = c; if (window._KHTMLrv) { g.parentNode.style.height = c } } } else { this.def_img_x = h; this.def_img_y = c } }; dhtmlXTreeObject.prototype.getItemImage = function(l, h, c) { var g = this._globalIdStorageFind(l); if (!g) { return "" } var a = g.images[h || 0]; if (c) { a = this.iconURL + a } return a }; dhtmlXTreeObject.prototype.enableRadioButtons = function(h, g) { if (arguments.length == 1) { this._frbtr = convertStringToBoolean(h); this.checkBoxOff = this.checkBoxOff || this._frbtr; return } var c = this._globalIdStorageFind(h); if (!c) { return "" } g = convertStringToBoolean(g); if ((g) && (!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 ((!g) && (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 = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.openOnItemAdded = function(a) { this._hAdI = !convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.openOnItemAdding = function(a) { this._hAdI = !convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.enableMultiLineItems = function(a) { if (a === true) { this.mlitems = "100%" } else { this.mlitems = a } }; dhtmlXTreeObject.prototype.enableAutoTooltips = function(a) { this.ettip = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.clearSelection = function(a) { if (a) { this._unselectItem(this._globalIdStorageFind(a)) } else { this._unselectItems() } }; dhtmlXTreeObject.prototype.showItemSign = function(h, c) { var a = this._globalIdStorageFind(h); if (!a) { return 0 } var g = a.span.parentNode.previousSibling.previousSibling.previousSibling; if (!convertStringToBoolean(c)) { this._openItem(a); a.closeble = false; a.wsign = true } else { a.closeble = true; a.wsign = false } this._correctPlus(a) }; dhtmlXTreeObject.prototype.showItemCheckbox = function(l, h) { if (!l) { for (var c in this._idpull) { this.showItemCheckbox(this._idpull[c], h) } } if (typeof(l) != "object") { l = this._globalIdStorageFind(l, 0, 0) } if (!l) { return 0 } l.nocheckbox = !convertStringToBoolean(h); var g = l.span.parentNode.previousSibling.previousSibling.childNodes[0]; g.parentNode.style.display = (!l.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 = convertStringToBoolean(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 = convertStringToBoolean(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(g) { var h = ""; for (var c = 0; c < g.childsCount; c++) { if ((g.childNodes[c].unParsed) || (g.childNodes[c].childsCount > 0)) { if (g.childNodes[c].unParsed) { var a = this._getAllScraggyItemsXML(g.childNodes[c].unParsed, 1) } else { var a = this._getAllScraggyItems(g.childNodes[c]) } if (a) { if (h) { h += this.dlmtr + a } else { h = a } } } else { if (!h) { h = "" + g.childNodes[c].id } else { h += this.dlmtr + g.childNodes[c].id } } } return h }; dhtmlXTreeObject.prototype._getAllFatItems = function(g) { var h = ""; for (var c = 0; c < g.childsCount; c++) { if ((g.childNodes[c].unParsed) || (g.childNodes[c].childsCount > 0)) { if (!h) { h = "" + g.childNodes[c].id } else { h += this.dlmtr + g.childNodes[c].id } if (g.childNodes[c].unParsed) { var a = this._getAllFatItemsXML(g.childNodes[c].unParsed, 1) } else { var a = this._getAllFatItems(g.childNodes[c]) } if (a) { h += this.dlmtr + a } } } return h }; 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(h, g, l) { if (!h) { h = this.htmlNode } if (h.checkstate == l) { if (!h.nocheckbox) { if (g) { g += this.dlmtr + h.id } else { g = "" + h.id } } } var a = h.childsCount; for (var c = 0; c < a; c++) { g = this._getAllChecked(h.childNodes[c], g, l) } if (h.unParsed) { g = this._getAllCheckedXML(h.unParsed, g, l) } if (g) { return g } else { return "" } }; dhtmlXTreeObject.prototype.setItemStyle = function(h, g, c) { var c = c || false; var a = this._globalIdStorageFind(h); if (!a) { return 0 } if (!a.span.style.cssText) { a.span.setAttribute("style", a.span.getAttribute("style") + "; " + g) } else { a.span.style.cssText = c ? g : a.span.style.cssText + ";" + g } }; dhtmlXTreeObject.prototype.enableImageDrag = function(a) { this._itim_dg = convertStringToBoolean(a) }; dhtmlXTreeObject.prototype.setOnDragIn = function(a) { this.attachEvent("onDragIn", a) }; dhtmlXTreeObject.prototype.enableDragAndDropScrolling = function(a) { this.autoScroll = convertStringToBoolean(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(h, m, c) { var g = this._loader.doXPath(".//item", h); var l = g[0].getAttribute("text"); this.obj.insertNewItem(c, m, l, 0, 0, 0, 0, "CHILD") }); a.attachEvent("updateCallback", function(h, m, c) { var g = this._loader.doXPath(".//item", h); var l = g[0].getAttribute("text"); this.obj.setItemText(m, l); if (this.obj.getParentId(m) != c) { this.obj.moveItem(m, "item_child", c) } this.setUpdated(m, true, "updated") }); a.attachEvent("deleteCallback", function(g, h, c) { this.obj.setUserData(h, this.action_param, "true_deleted"); this.obj.deleteItem(h, false) }); a._methods = ["setItemStyle", "", "changeItemId", "deleteItem"]; this.attachEvent("onEdit", function(c, g) { if (c == 3) { a.setUpdated(g, true) } return true }); this.attachEvent("onDrop", function(m, l, h, g, c) { if (g == c) { a.setUpdated(m, true) } }); this._onrdlh = function(c) { var g = a.getState(c); if (g == "inserted") { a.set_invalid(c, false); a.setUpdated(c, false); return true } if (g == "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(l) { var h = {}; var m = this.obj._globalIdStorageFind(l); var g = m.parentObject; var c = 0; for (c = 0; c < g.childsCount; c++) { if (g.childNodes[c] == m) { break } } h.tr_id = m.id; h.tr_pid = g.id; h.tr_order = c; h.tr_text = m.span.innerHTML; g = (m._userdatalist || "").split(","); for (c = 0; c < g.length; c++) { h[g[c]] = m.userData["t_" + g[c]] } return h } }; 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 g = document.getElementsByTagName("div"); for (var a = 0; a < g.length; a++) { if (g[a].getAttribute("dragInDhtmlXTree")) { this.makeDragable(g[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, g, a, h) { if (this._customDrop) { return this._customDrop(c, h.img.id, g.id, a ? a.id : null) } var l = (h.img.getAttribute("image") || ""); var n = h.img.id || "new"; var m = (h.img.getAttribute("text") || (_isIE ? h.img.innerText : h.img.textContent)); c[a ? "insertNewNext" : "insertNewItem"](a ? a.id : g.id, n, m, "", l, l, l) } } dhtmlXTreeObject.prototype.enableItemEditor = function(a) { this._eItEd = convertStringToBoolean(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(g, c) { if (this._edn_dblclick) { this._editItem(g, c) } return true }); this.setOnClickHandler(function(g, c) { this._stopEditItem(g, c); if ((this.ed_hist_clcik == g) && (this._edn_click_IE)) { this._editItem(g, c) } this.ed_hist_clcik = g; return true }); this._eItEdFlag = true } }; dhtmlXTreeObject.prototype.setOnEditHandler = function(a) { this.attachEvent("onEdit", a) }; dhtmlXTreeObject.prototype.setEditStartAction = function(a, c) { this._edn_click_IE = convertStringToBoolean(a); this._edn_dblclick = convertStringToBoolean(c) }; dhtmlXTreeObject.prototype._stopEdit = function(c, m) { if (this._editCell) { this.dADTempOff = this.dADTempOffEd; if (this._editCell.id != c) { var h = true; if (!m) { h = this.callEvent("onEdit", [2, this._editCell.id, this, this._editCell.span.childNodes[0].value]) } else { h = false; this.callEvent("onEditCancel", [this._editCell.id, this._editCell._oldValue]) } if (h === true) { h = this._editCell.span.childNodes[0].value } else { if (h === false) { h = this._editCell._oldValue } } var l = (h != this._editCell._oldValue); this._editCell.span.innerHTML = h; this._editCell.label = this._editCell.span.innerHTML; var g = this._editCell.i_sel ? "selectedTreeRow" : "standartTreeRow"; this._editCell.span.className = g; 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 n = this._editCell.id; if (this.childCalc) { this._fixChildCountLabel(this._editCell) } this._editCell = null; if (!m) { this.callEvent("onEdit", [3, n, this, l]) } 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(l, a) { if (this._eItEd) { this._stopEdit(); var g = this._globalIdStorageFind(l); if (!g) { return } var h = this.callEvent("onEdit", [0, l, this, g.span.innerHTML]); if (h === true) { h = (typeof g.span.innerText != "undefined" ? g.span.innerText : g.span.textContent) } else { if (h === false) { return } } this.dADTempOffEd = this.dADTempOff; this.dADTempOff = false; this._editCell = g; g._oldValue = h; g.span.innerHTML = ""; g.span.style.paddingRight = g.span.style.paddingLeft = "0px"; g.span.onclick = g.span.ondblclick = function(m) { (m || event).cancelBubble = true }; g.span.childNodes[0].value = h; g.span.childNodes[0].onselectstart = function(m) { (m || event).cancelBubble = true; return true }; g.span.childNodes[0].onmousedown = function(m) { (m || event).cancelBubble = true; return true }; g.span.childNodes[0].focus(); g.span.childNodes[0].focus(); g.span.onclick = function(m) { (m || event).cancelBubble = true; return false }; g.span.className = ""; g.span.parentNode.className = ""; var c = this; g.span.childNodes[0].onkeydown = function(m) { if (!m) { m = window.event } if (m.keyCode == 13) { m.cancelBubble = true; c._stopEdit(window.undefined) } else { if (m.keyCode == 27) { c._stopEdit(window.undefined, true) } }(m || event).cancelBubble = true }; this.callEvent("onEdit", [1, l, this]) } }; function jsonPointer(c, a) { this.d = c; this.dp = a } jsonPointer.prototype = { text: function() { var a = function(l) { var h = []; for (var g = 0; g < l.length; g++) { h.push("{" + c(l[g]) + "}") } return h.join(",") }; var c = function(l) { var h = []; for (var g in l) { if (typeof(l[g]) == "object") { if (g.length) { h.push('"' + g + '":[' + a(l[g]) + "]") } else { h.push('"' + g + '":{' + c(l[g]) + "}") } } else { h.push('"' + g + '":"' + l[g] + '"') } } return h.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(h, n, m) { var g = this.d[h]; var o = new jsonPointer(); if (g) { for (var l = 0; l < g.length; l++) { o.d = g[l]; n.apply(m, [o, l]) } } }, 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(h, o, n, m, l) { var g = this.d[h]; var q = new jsonPointer(0, this.d); if (g) { for (l = l || 0; l < g.length; l++) { if (g[l][o]) { q.d = g[l]; if (n.apply(m, [q, l]) == -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(g, n, r, l, s) { var o = this.d[g]; if (o.length) { for (var h = 0; h < o.length; h++) { if (o[h][n] != null && o[h][n] != "" && (!r || o[h][n] == r)) { var m = new jsonPointer(o[h], this.d); l.apply(s, [m, h]) } var q = this.d; this.d = o[h]; if (this.sub_exists(g)) { this.through(g, n, r, l, s) } this.d = q } } } }; dhtmlXTreeObject.prototype.loadJSArrayFile = function(file, afterCall) { if (!this.parsCount) { this.callEvent("onXLS", [this, this._ld_id]) } this._ld_id = null; this.xmlstate = 1; var that = this; this.XMLLoader = new dtmlXMLLoaderObject(function() { eval("var z=" + arguments[4].xmlDoc.responseText); that.loadJSArray(z) }, this, true, this.no_cashe); if (afterCall) { this.XMLLoader.waitCall = afterCall } this.XMLLoader.loadXML(file) }; dhtmlXTreeObject.prototype.loadCSV = function(a, g) { if (!this.parsCount) { this.callEvent("onXLS", [this, this._ld_id]) } this._ld_id = null; this.xmlstate = 1; var c = this; this.XMLLoader = new dtmlXMLLoaderObject(function() { c.loadCSVString(arguments[4].xmlDoc.responseText) }, this, true, this.no_cashe); if (g) { this.XMLLoader.waitCall = g } this.XMLLoader.loadXML(a) }; dhtmlXTreeObject.prototype.loadJSArray = function(a, h) { var m = []; for (var c = 0; c < a.length; c++) { if (!m[a[c][1]]) { m[a[c][1]] = [] } m[a[c][1]].push({ id: a[c][0], text: a[c][2] }) } var l = { id: this.rootId }; var g = function(q, o) { if (m[q.id]) { q.item = m[q.id]; for (var n = 0; n < q.item.length; n++) { o(q.item[n], o) } } }; g(l, g); this.loadJSONObject(l, h) }; dhtmlXTreeObject.prototype.loadCSVString = function(a, m) { var o = []; var c = a.split("\n"); for (var h = 0; h < c.length; h++) { var g = c[h].split(","); if (!o[g[1]]) { o[g[1]] = [] } o[g[1]].push({ id: g[0], text: g[2] }) } var n = { id: this.rootId }; var l = function(s, r) { if (o[s.id]) { s.item = o[s.id]; for (var q = 0; q < s.item.length; q++) { r(s.item[q], r) } } }; l(n, l); this.loadJSONObject(n, m) }; dhtmlXTreeObject.prototype.loadJSONObject = function(a, c) { if (!this.parsCount) { this.callEvent("onXLS", [this, null]) } this.xmlstate = 1; var g = new jsonPointer(a); this._parse(g); this._p = g; if (c) { c() } }; dhtmlXTreeObject.prototype.loadJSON = function(file, afterCall) { if (!this.parsCount) { this.callEvent("onXLS", [this, this._ld_id]) } this._ld_id = null; this.xmlstate = 1; var that = this; this.XMLLoader = new dtmlXMLLoaderObject(function() { try { eval("var t=" + arguments[4].xmlDoc.responseText) } catch (e) { dhtmlxError.throwError("LoadXML", "Incorrect JSON", [(arguments[4].xmlDoc), this]); return } var p = new jsonPointer(t); that._parse(p); that._p = p }, this, true, this.no_cashe); if (afterCall) { this.XMLLoader.waitCall = afterCall } this.XMLLoader.loadXML(file) }; dhtmlXTreeObject.prototype.serializeTreeToJSON = function() { var a = ['{"id":"' + this.rootId + '", "item":[']; var g = []; for (var c = 0; c < this.htmlNode.childsCount; c++) { g.push(this._serializeItemJSON(this.htmlNode.childNodes[c])) } a.push(g.join(",")); a.push("]}"); return a.join("") }; dhtmlXTreeObject.prototype._serializeItemJSON = function(n) { var a = []; if (n.unParsed) { return (n.unParsed.text()) } if (this._selected.length) { var g = this._selected[0].id } else { g = "" } var m = n.span.innerHTML; m = m.replace(/\"/g, '\\"', m); if (!this._xfullXML) { a.push('{ "id":"' + n.id + '", ' + (this._getOpenState(n) == 1 ? ' "open":"1", ' : "") + (g == n.id ? ' "select":"1",' : "") + ' "text":"' + m + '"' + (((this.XMLsource) && (n.XMLload == 0)) ? ', "child":"1" ' : "")) } else { a.push('{ "id":"' + n.id + '", ' + (this._getOpenState(n) == 1 ? ' "open":"1", ' : "") + (g == n.id ? ' "select":"1",' : "") + ' "text":"' + m + '", "im0":"' + n.images[0] + '", "im1":"' + n.images[1] + '", "im2":"' + n.images[2] + '" ' + (n.acolor ? (', "aCol":"' + n.acolor + '" ') : "") + (n.scolor ? (', "sCol":"' + n.scolor + '" ') : "") + (n.checkstate == 1 ? ', "checked":"1" ' : (n.checkstate == 2 ? ', "checked":"-1"' : "")) + (n.closeable ? ', "closeable":"1" ' : "") + (((this.XMLsource) && (n.XMLload == 0)) ? ', "child":"1" ' : "")) } if ((this._xuserData) && (n._userdatalist)) { a.push(', "userdata":['); var l = n._userdatalist.split(","); var h = []; for (var c = 0; c < l.length; c++) { h.push('{ "name":"' + l[c] + '" , "content":"' + n.userData["t_" + l[c]] + '" }') } a.push(h.join(",")); a.push("]") } if (n.childsCount) { a.push(', "item":['); var h = []; for (var c = 0; c < n.childsCount; c++) { h.push(this._serializeItemJSON(n.childNodes[c])) } a.push(h.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.loadXMLString("" + 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, m, g) { for (var n = 0; n < s.childNodes.length; n++) { var r = s.childNodes[n]; if ((r.nodeType == 1) && (r.tagName.toLowerCase() == "li")) { var q = ""; var o = null; var a = r.getAttribute("checked"); for (var l = 0; l < r.childNodes.length; l++) { var h = r.childNodes[l]; if (h.nodeType == 3) { q += h.data } else { if (h.tagName.toLowerCase() != "ul") { q += dhx_outer_html(h) } else { o = h } } } m[m.length] = [g, q, a, (r.id || (m.length + 1))]; if (o) { m = dhx_li2trees(o, m, (r.id || m.length)) } } } return m } 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) } } dhtmlXTreeObject.prototype.parserExtension = { _parseExtension: function(h, c, g) { this._idpull[c.id]._attrs = c } }; dhtmlXTreeObject.prototype.getAttribute = function(g, a) { this._globalIdStorageFind(g); var c = this._idpull[g]._attrs; return c ? c[a] : window.undefined }; dhtmlXTreeObject.prototype.setAttribute = function(h, a, g) { this._globalIdStorageFind(h); var c = (this._idpull[h]._attrs) || {}; c[a] = g; this._idpull[h]._attrs = c }; dhtmlXTreeObject.prototype.enableKeyboardNavigation = function(g) { this._enblkbrd = convertStringToBoolean(g); if (this._enblkbrd) { if (_isFF) { var c = window.getComputedStyle(this.parentObject, null)["position"]; if ((c != "absolute") && (c != "relative")) { this.parentObject.style.position = "relative" } } this._navKeys = [ ["up", 38], ["down", 40], ["open", 39], ["close", 37], ["call", 13], ["edit", 113] ]; var a = this; var c = document.createElement("INPUT"); c.className = "a_dhx_hidden_input"; c.autocomplete = "off"; if (window._KHTMLrv) { c.style.color = "white" } this.parentObject.appendChild(c); this.parentObject[_isOpera ? "onkeypress" : "onkeydown"] = function(h) { if (a.callEvent("onKeyPress", [(h || window.event).keyCode, (h || window.event)])) { return a._onKeyDown(h || window.event) } }; this.parentObject.onclick = function(h) { if (_isFF || _isIE) { c.select() } if (window._KHTMLrv || _isOpera) { c.focus() } } } else { this.parentObject.onkeydown = null } }; dhtmlXTreeObject.prototype._onKeyDown = function(g) { if (window.globalActiveDHTMLGridObject && globalActiveDHTMLGridObject.isActive) { return true } var a = this; for (var c = 0; c < this._navKeys.length; c++) { if (this._navKeys[c][1] == g.keyCode) { this["_onkey_" + this._navKeys[c][0]].apply(this, [this.getSelectedItemId()]); if (g.preventDefault) { g.preventDefault() }(g || event).cancelBubble = true; return false } } if (this._textSearch) { return this._searchItemByKey(g) } return true }; dhtmlXTreeObject.prototype._onkey_up = function(g) { var a = this._globalIdStorageFind(g); if (!a) { return } var c = this._getPrevVisibleNode(a); if (c.id == this.rootId) { return } this.focusItem(c.id); this.selectItem(c.id, false) }; dhtmlXTreeObject.prototype._onkey_down = function(g) { var a = this._globalIdStorageFind(g); if (!a) { return } var c = this._getNextVisibleNode(a); if (c.id == this.rootId) { return } this.focusItem(c.id); this.selectItem(c.id, false) }; dhtmlXTreeObject.prototype._onkey_open = function(a) { this.openItem(a) }; dhtmlXTreeObject.prototype._onkey_close = function(a) { this.closeItem(a) }; dhtmlXTreeObject.prototype._onkey_call = function(a) { if (this.stopEdit) { this.stopEdit(); this.parentObject.lastChild.focus(); this.parentObject.lastChild.focus(); this.selectItem(a, true) } else { this.selectItem(this.getSelectedItemId(), true) } }; dhtmlXTreeObject.prototype._onkey_edit = function(a) { if (this.editItem) { this.editItem(a) } }; dhtmlXTreeObject.prototype._getNextVisibleNode = function(a, c) { if ((!c) && (this._getOpenState(a) > 0)) { return a.childNodes[0] } if ((a.tr) && (a.tr.nextSibling) && (a.tr.nextSibling.nodem)) { return a.tr.nextSibling.nodem } if (a.parentObject) { return this._getNextVisibleNode(a.parentObject, 1) } return a }; dhtmlXTreeObject.prototype._getPrevVisibleNode = function(a) { if ((a.tr) && (a.tr.previousSibling) && (a.tr.previousSibling.nodem)) { return this._lastVisibleChild(a.tr.previousSibling.nodem) } if (a.parentObject) { return a.parentObject } else { return a } }; dhtmlXTreeObject.prototype._lastVisibleChild = function(a) { if (this._getOpenState(a) > 0) { return this._lastVisibleChild(a.childNodes[a.childsCount - 1]) } else { return a } }; dhtmlXTreeObject.prototype._searchItemByKey = function(c) { if (c.keyCode == 8) { this._textSearchString = ""; return true } var a = String.fromCharCode(c.keyCode).toUpperCase(); if (a.match(/[A-Z,a-z,0-9\ ]/)) { this._textSearchString += a; this._textSearchInProgress = true; if (!(this.getSelectedItemText() || "").match(RegExp("^" + this._textSearchString, "i"))) { this.findItem(this._textSearchString, 0) } this._textSearchInProgress = false; if (c.preventDefault) { c.preventDefault() }(c || event).cancelBubble = true; return false } return true }; dhtmlXTreeObject.prototype.assignKeys = function(a) { this._navKeys = a }; dhtmlXTreeObject.prototype.enableKeySearch = function(c) { this._textSearch = convertStringToBoolean(c); if (!this._textSearch) { return } this._textSearchString = ""; var a = this; this._markItem2 = this._markItem; this._markItem = function(g) { if (!a._textSearchInProgress) { a._textSearchString = "" } a._markItem2(g) } }; dhtmlXTreeObject.prototype.enableLoadingItem = function(a) { this.attachEvent("onXLS", this._showFakeItem); this.attachEvent("onXLE", this._hideFakeItem); this._tfi_text = a || "Loading..." }; dhtmlXTreeObject.prototype._showFakeItem = function(a, g) { if ((g === null) || (this._globalIdStorageFind("fake_load_xml_" + g))) { return } var c = this.XMLsource; this.XMLsource = null; this.insertNewItem(g, "fake_load_xml_" + g, this._tfi_text); this.XMLsource = c }; dhtmlXTreeObject.prototype._hideFakeItem = function(a, c) { if (c === null) { return } this.deleteItem("fake_load_xml_" + c) }; dhtmlXTreeObject.prototype.isLocked = function(a) { if (!this._locker) { this._init_lock() } return (this._locker[a] == true) }; dhtmlXTreeObject.prototype._lockItem = function(a, l, c) { if (!this._locker) { this._init_lock() } if (l) { if (this._locker[a.id] == true) { return } this._locker[a.id] = true; a.bIm0 = a.images[0]; a.bIm1 = a.images[1]; a.bIm2 = a.images[2]; a.images[0] = this.lico0; a.images[1] = this.lico1; a.images[2] = this.lico2; var h = a.span.parentNode; var g = h.previousSibling; this.dragger.removeDraggableItem(h); this.dragger.removeDraggableItem(g) } else { if (this._locker[a.id] != true) { return } this._locker[a.id] = false; a.images[0] = a.bIm0; a.images[1] = a.bIm1; a.images[2] = a.bIm2; var h = a.span.parentNode; var g = h.previousSibling; this.dragger.addDraggableItem(h, this); this.dragger.addDraggableItem(g, this) } if (!c) { this._correctPlus(a) } }; dhtmlXTreeObject.prototype.lockItem = function(g, c) { if (!this._locker) { this._init_lock() } this._lockOn = false; var a = this._globalIdStorageFind(g); this._lockOn = true; this._lockItem(a, convertStringToBoolean(c)) }; dhtmlXTreeObject.prototype.setLockedIcons = function(g, c, a) { if (!this._locker) { this._init_lock() } this.lico0 = g; this.lico1 = c; this.lico2 = a }; dhtmlXTreeObject.prototype._init_lock = function() { this._locker = new Array(); this._locker_count = "0"; this._lockOn = true; this._globalIdStorageFindA = this._globalIdStorageFind; this._globalIdStorageFind = this._lockIdFind; if (this._serializeItem) { this._serializeItemA = this._serializeItem; this._serializeItem = this._serializeLockItem; this._serializeTreeA = this.serializeTree; this.serializeTree = this._serializeLockTree } this.setLockedIcons(this.imageArray[0], this.imageArray[1], this.imageArray[2]) }; dhtmlXTreeObject.prototype._lockIdFind = function(g, a, c) { if (!this.skipLock) { if ((!c) && (this._lockOn == true) && (this._locker[g] == true)) { return null } } return this._globalIdStorageFindA(g, a, c) }; dhtmlXTreeObject.prototype._serializeLockItem = function(a) { if (this._locker[a.id] == true) { return "" } return this._serializeItemA(a) }; dhtmlXTreeObject.prototype._serializeLockTree = function() { var a = this._serializeTreeA(); return a.replace(/]+locked\=\"1\"[^>]+\/>/g, "") }; dhtmlXTreeObject.prototype._moveNodeToA = dhtmlXTreeObject.prototype._moveNodeTo; dhtmlXTreeObject.prototype._moveNodeTo = function(a, g, c) { if ((g.treeNod.isLocked) && (g.treeNod.isLocked(g.id))) { return false } return this._moveNodeToA(a, g, c) }; dhtmlXTreeObject.prototype.lockTree = function(a) { if (convertStringToBoolean(a)) { this._initTreeLocker() } else { if (this._TreeLocker) { this._TreeLocker.parentNode.removeChild(this._TreeLocker); this._TreeLocker = null } } }; dhtmlXTreeObject.prototype._initTreeLocker = function(a) { if (this._TreeLocker) { return } this.parentObject.style.overflow = "hidden"; if (this.parentObject.style.position != "absolute") { this.parentObject.style.position = "relative" } var c = document.createElement("div"); c.style.position = "absolute"; c.style.left = "0px"; c.style.top = "0px"; c.className = "dhx_tree_opacity"; c.style.width = this.allTree.offsetWidth + "px"; c.style.backgroundColor = "#FFFFFF"; c.style.height = this.allTree.offsetHeight + "px"; this._TreeLocker = c; this.parentObject.appendChild(this._TreeLocker) }; dhtmlXTreeObject.prototype.enableRTL = function(c) { var a = convertStringToBoolean(c); if (((a) && (!this.rtlMode)) || ((!a) && (this.rtlMode))) { this.rtlMode = a; this._switchToRTL(this.rtlMode) } }; dhtmlXTreeObject.prototype._switchToRTL = function(a) { if (a) { this.allTree.className = this._ltr_line = this.lineArray; this._ltr_min = this.minusArray; this._ltr_plus = this.plusArray; this.lineArray = new Array("line2_rtl.gif", "line3_rtl.gif", "line4_rtl.gif", "blank.gif", "blank.gif", "line1_rtl.gif"); this.minusArray = new Array("minus2_rtl.gif", "minus3_rtl.gif", "minus4_rtl.gif", "minus.gif", "minus5_rtl.gif"); this.plusArray = new Array("plus2_rtl.gif", "plus3_rtl.gif", "plus4_rtl.gif", "plus.gif", "plus5_rtl.gif"); this.allTree.className = "containerTableStyleRTL" } else { this.allTree.className = "containerTableStyle"; this.lineArray = this._ltr_line; this.minusArray = this._ltr_min; this.plusArray = this._ltr_plus } if (this.htmlNode.childsCount) { this._redrawFrom(this, this.htmlNode) } }; dhtmlXTreeObject.prototype.sortTree = function(h, c, g) { var a = this._globalIdStorageFind(h); if (!a) { return false } this._reorderBranch(a, (c.toString().toLowerCase() == "asc"), convertStringToBoolean(g)) }; dhtmlXTreeObject.prototype.setCustomSortFunction = function(a) { this._csfunca = a }; dhtmlXTreeObject.prototype._reorderBranch = function(o, c, q) { var a = []; var n = o.childsCount; if (!n) { return } var l = o.childNodes[0].tr.parentNode; for (var h = 0; h < n; h++) { a[h] = o.childNodes[h]; l.removeChild(a[h].tr) } var g = this; if (c == 1) { if (this._csfunca) { a.sort(function(r, m) { return g._csfunca(r.id, m.id) }) } else { a.sort(function(r, m) { return ((r.span.innerHTML.toUpperCase() > m.span.innerHTML.toUpperCase()) ? 1 : ((r.span.innerHTML.toUpperCase() == m.span.innerHTML.toUpperCase()) ? 0 : -1)) }) } } else { if (this._csfunca) { a.sort(function(r, m) { return g._csfunca(m.id, r.id) }) } else { a.sort(function(r, m) { return ((r.span.innerHTML.toUpperCase() < m.span.innerHTML.toUpperCase()) ? 1 : ((r.span.innerHTML.toUpperCase() == m.span.innerHTML.toUpperCase()) ? 0 : -1)) }) } } for (var h = 0; h < n; h++) { l.appendChild(a[h].tr); o.childNodes[h] = a[h]; if ((q) && (a[h].unParsed)) { a[h].unParsed.set("order", c ? 1 : -1) } else { if ((q) && (a[h].childsCount)) { this._reorderBranch(a[h], c, q) } } } for (var h = 0; h < n; h++) { this._correctPlus(a[h]); this._correctLine(a[h]) } }; dhtmlXTreeObject.prototype._reorderXMLBranch = function(n) { var o = n.getAttribute("order"); if (o == "none") { return } var c = (o == 1); var l = n.childNodes.length; if (!l) { return } var a = new Array(); var g = 0; for (var h = 0; h < l; h++) { if (n.childNodes[h].nodeType == 1) { a[g] = n.childNodes[h]; g++ } } for (var h = l - 1; h != 0; h--) { n.removeChild(n.childNodes[h]) } if (c) { a.sort(function(q, m) { return ((q.getAttribute("text") > m.getAttribute("text")) ? 1 : ((q.getAttribute("text") == m.getAttribute("text")) ? 0 : -1)) }) } else { a.sort(function(q, m) { return ((q.getAttribute("text") < m.getAttribute("text")) ? 1 : ((q.getAttribute("text") == m.getAttribute("text")) ? 0 : -1)) }) } for (var h = 0; h < g; h++) { a[h].setAttribute("order", o); n.appendChild(a[h]) } n.setAttribute("order", "none") }; dhtmlXTreeObject.prototype._serEnts = [ ["&", "&"], ["<", "<"], [">", ">"] ]; dhtmlXTreeObject.prototype.registerXMLEntity = function(a, c) { this._serEnts[this._serEnts.length] = [a, c, new RegExp(a, "g")] }; dhtmlXTreeObject.prototype.setSerializationLevel = function(a, c, l, m, g) { this._xuserData = convertStringToBoolean(a); this._xfullXML = convertStringToBoolean(c); this._dtd = g; this._xescapeEntities = convertStringToBoolean(l); if (convertStringToBoolean(m)) { this._apreUC = "" } else {} for (var h = 0; h < this._serEnts.length; h++) { this._serEnts[h][2] = new RegExp(this._serEnts[h][0], "g") } }; dhtmlXTreeObject.prototype.serializeTree = function() { if (this.stopEdit) { this.stopEdit() } this._apreUC = this._apreUC || ""; this._apstUC = this._apstUC || ""; var a = ''; if (this._dtd) { a += '' } a += ''; if ((this._xuserData) && (this._idpull[this.rootId]._userdatalist)) { var g = this._idpull[this.rootId]._userdatalist.split(","); for (var c = 0; c < g.length; c++) { a += '' + this._apreUC + this._idpull[this.rootId].userData["t_" + g[c]] + this._apstUC + "" } } for (var c = 0; c < this.htmlNode.childsCount; c++) { a += this._serializeItem(this.htmlNode.childNodes[c]) } a += ""; return a }; dhtmlXTreeObject.prototype._serializeItem = function(n) { if (n.unParsed) { if (document.all) { return n.unParsed.d.xml } else { var a = new XMLSerializer(); return a.serializeToString(n.unParsed.d) } } var c = ""; if (this._selected.length) { var h = this._selected[0].id } else { h = '"' } var m = n.span.innerHTML; if (this._xescapeEntities) { for (var g = 0; g < this._serEnts.length; g++) { m = m.replace(this._serEnts[g][2], this._serEnts[g][1]) } } if (!this._xfullXML) { c = '" } else { c = '" } if ((this._xuserData) && (n._userdatalist)) { var l = n._userdatalist.split(","); for (var g = 0; g < l.length; g++) { c += '' + this._apreUC + n.userData["t_" + l[g]] + this._apstUC + "" } } for (var g = 0; g < n.childsCount; g++) { c += this._serializeItem(n.childNodes[g]) } c += ""; return c }; dhtmlXTreeObject.prototype.saveSelectedItem = function(c, a) { c = c || ""; this.setCookie("treeStateSelected" + c, this.getSelectedItemId(), a) }; dhtmlXTreeObject.prototype.restoreSelectedItem = function(a) { a = a || ""; var c = this.getCookie("treeStateSelected" + a); this.selectItem(c, false) }; dhtmlXTreeObject.prototype.enableAutoSavingSelected = function(a, c) { this.assMode = convertStringToBoolean(a); if ((this.assMode) && (!this.oldOnSelect)) { this.oldOnSelect = this.onRowSelect; this.onRowSelect = function(h, g, l) { if (!g) { g = this } g.parentObject.treeNod.oldOnSelect(h, g, l); if (g.parentObject.treeNod.assMode) { g.parentObject.treeNod.saveSelectedItem(g.parentObject.treeNod.assCookieName) } } } this.assCookieName = c }; dhtmlXTreeObject.prototype.saveState = function(g, c) { var l = this._escape(this.serializeTree()); var a = 4000; if (l.length > a) { if (navigator.appName.indexOf("Microsoft") != -1) { return false } this.setCookie("treeStatex" + g, Math.ceil(l.length / a)); for (var h = 0; h < Math.ceil(l.length / a); h++) { this.setCookie("treeStatex" + g + "x" + h, l.substr(h * a, a), c) } } else { this.setCookie("treeStatex" + g, l, c) } var l = this.getCookie("treeStatex" + g); if (!l) { this.setCookie("treeStatex" + g, "", c); return false } return true }; dhtmlXTreeObject.prototype.loadState = function(a) { var h = this.getCookie("treeStatex" + a); if (!h) { return false } if (h.length) { if (h.toString().length < 4) { var g = ""; for (var c = 0; c < h; c++) { g += this.getCookie("treeStatex" + a + "x" + c) } h = g } this.loadXMLString((this.utfesc == "utf8") ? decodeURI(h) : unescape(h)) } return true }; dhtmlXTreeObject.prototype.setCookie = function(c, g, a) { var h = c + "=" + g + (a ? ("; " + a) : ""); document.cookie = h }; dhtmlXTreeObject.prototype.getCookie = function(c) { var g = c + "="; if (document.cookie.length > 0) { var h = document.cookie.indexOf(g); if (h != -1) { h += g.length; var a = document.cookie.indexOf(";", h); if (a == -1) { a = document.cookie.length } return document.cookie.substring(h, a) } } }; dhtmlXTreeObject.prototype.saveOpenStates = function(c, a) { var h = []; for (var g = 0; g < this.htmlNode.childsCount; g++) { h = h.concat(this._collectOpenStates(this.htmlNode.childNodes[g])) } h = h.join(this.dlmtr); this.setCookie("treeOpenStatex" + c, h, a) }; dhtmlXTreeObject.prototype.loadOpenStates = function(c) { for (var g = 0; g < this.htmlNode.childsCount; g++) { this._xcloseAll(this.htmlNode.childNodes[g]) } this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0"; var l = getCookie("treeOpenStatex" + c); if (l) { var a = l.split(this.dlmtr); for (var g = 0; g < a.length; g++) { var h = this._globalIdStorageFind(a[g]); if (h) { if ((this.XMLsource) && (!h.XMLload) && (h.id != this.rootId)) { this._delayedLoad(h, "loadOpenStates('" + c + "')"); return } else { this.openItem(a[g]) } } } } this.callEvent("onAllOpenDynamic", []) }; dhtmlXTreeObject.prototype._delayedLoad = function(c, a) { this.afterLoadMethod = a; this.onLoadReserve = this.onXLE; this.onXLE = this._delayedLoadStep2; this._loadDynXML(c.id) }; dhtmlXTreeObject.prototype._delayedLoadStep2 = function(tree) { tree.onXLE = tree.onLoadReserve; window.setTimeout(function() { dhtmlx.temp = tree; eval("dhtmlx.temp." + tree.afterLoadMethod) }, 100); if (tree.onXLE) { tree.onXLE(tree) } tree.callEvent("onXLE", [tree]) }; dhtmlXTreeObject.prototype._collectOpenStates = function(c) { var g = []; if (this._getOpenState(c) == 1) { g.push(c.id); for (var a = 0; a < c.childsCount; a++) { g = g.concat(this._collectOpenStates(c.childNodes[a])) } } return g }; function setCookie(a, c) { document.cookie = a + "=" + c } function getCookie(c) { var g = c + "="; if (document.cookie.length > 0) { var h = document.cookie.indexOf(g); if (h != -1) { h += g.length; var a = document.cookie.indexOf(";", h); if (a == -1) { a = document.cookie.length } return (document.cookie.substring(h, a)) } } } dhtmlXTreeObject.prototype.openAllItemsDynamic = function(a) { this.ClosedElem = new Array(); this.G_node = null; var c = this._globalIdStorageFind(a || this.rootId); if (c.id != this.rootId && this.getOpenState(c.id) != 0) { this.openItem(a) } this._openAllNodeChilds(c, 0); if (this.ClosedElem.length > 0) { this.onLoadReserve = this.onXLE; this.onXLE = this._loadAndOpen; this._loadAndOpen(this) } }; dhtmlXTreeObject.prototype._openAllNodeChilds = function(c) { if ((c.XMLload == 0) || (c.unParsed)) { this.ClosedElem.push(c) } for (var a = 0; a < c.childsCount; a++) { if (this._getOpenState(c.childNodes[a]) < 0) { this._HideShow(c.childNodes[a], 2) } if (c.childNodes[a].childsCount > 0) { this._openAllNodeChilds(c.childNodes[a]) } if ((c.childNodes[a].XMLload == 0) || (c.childNodes[a].unParsed)) { this.ClosedElem.push(c.childNodes[a]) } } }; dhtmlXTreeObject.prototype._loadAndOpen = function(a) { if (a.G_node) { a._openItem(a.G_node); a._openAllNodeChilds(a.G_node); a.G_node = null } if (a.ClosedElem.length > 0) { a.G_node = a.ClosedElem.shift() } if (a.G_node) { if (a.G_node.unParsed) { a.reParse(a.G_node) } else { window.setTimeout(function() { a._loadDynXML(a.G_node.id) }, 100) } } else { a.onXLE = a.onLoadReserve; if (a.onXLE) { a.onXLE(a) } a.callEvent("onAllOpenDynamic", [a]) } }; dhtmlXTreeObject.prototype.openItemsDynamic = function(c, a) { if (this.onXLE == this._stepOpen) { return } this._opnItmsDnmcFlg = convertStringToBoolean(a); this.onLoadReserve = this.onXLE; this.onXLE = this._stepOpen; this.ClosedElem = c.split(",").reverse(); this._stepOpen(this) }; dhtmlXTreeObject.prototype._stepOpen = function(c) { if (!c.ClosedElem.length) { c.onXLE = c.onLoadReserve; if (c._opnItmsDnmcFlg) { c.selectItem(c.G_node, true) } if ((c.onXLE) && (arguments[1])) { c.onXLE.apply(c, arguments) } c.callEvent("onOpenDynamicEnd", []); return } c.G_node = c.ClosedElem.pop(); c.skipLock = true; var a = c._globalIdStorageFind(c.G_node); if (a) { if (a.XMLload === 0) { c.openItem(c.G_node) } else { c.openItem(c.G_node); c._stepOpen(c) } } c.skipLock = false }; var globalActiveDHTMLGridObject; String.prototype._dhx_trim = function() { return this.replace(/ /g, " ").replace(/(^[ \t]*)|([ \t]*$)/g, "") }; function dhtmlxArray(a) { return dhtmlXHeir((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(g, c) { this[this.length] = null; for (var a = this.length - 1; a >= g; a--) { this[a] = this[a - 1] } this[g] = c }, _dhx_removeAt: function(a) { this.splice(a, 1) }, _dhx_swapItems: function(a, g) { var c = this[a]; this[a] = this[g]; this[g] = c } }; function dhtmlXGridObject(id) { 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 = ""; dhtmlxEventable(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 = new dtmlXMLLoaderObject(this.doLoadDetails, this, true, this.no_cashe); 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.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 "clear": this._topMb = document.createElement("DIV"); this._topMb.className = "topMumba"; this._topMb.innerHTML = ""; this.entBox.appendChild(this._topMb); this._botMb = document.createElement("DIV"); this._botMb.className = "bottomMumba"; this._botMb.innerHTML = ""; this.entBox.appendChild(this._botMb); if (this.entBox.style.position != "absolute") { this.entBox.style.position = "relative" } this.skin_h_correction = 20; break; case "dhx_terrace": this._srdh = 33; this.forceDivInHeader = true; break; case "dhx_skyblue": case "dhx_web": case "glassy_blue": case "dhx_black": case "dhx_blue": case "modern": case "light": this._srdh = 29; this.forceDivInHeader = true; break; case "xp": this.forceDivInHeader = true; if ((_isIE) && (document.compatMode != "BackCompat")) { this._srdh = 26 } else { this._srdh = 22 } break; case "mt": if ((_isIE) && (document.compatMode != "BackCompat")) { this._srdh = 26 } else { this._srdh = 22 } break; case "gray": if ((_isIE) && (document.compatMode != "BackCompat")) { this._srdh = 22 } break; case "sbdark": 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 = new dhtmlxHierarchy(); if ((this._fake) && (!this._realfake)) { this._fake._h2 = this._h2 } this._tgc = { imgURL: null } } if (!this._hstyles) { return } if (!this.skin_name) { this.setSkin("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() } if (this._init_point) { this._init_point() } }; 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) { var splitOuterBorder = (this.globalBox.offsetWidth - this.globalBox.clientWidth) / 2; if (this._delta_x && !this._realfake) { var ow = this.globalBox.clientWidth; this.globalBox.style.width = this._delta_x; this.entBox.style.width = Math.max(0, (this.globalBox.clientWidth + (quirks ? splitOuterBorder * 2 : 0)) - this._fake.entBox.clientWidth) + "px"; if (ow != this.globalBox.clientWidth) { this._fake._correctSplit(this._fake.entBox.clientWidth) } } 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.setSizes_clear = function() { var y = this.hdr.offsetHeight; var x = this.entBox.offsetWidth; var y2 = y + this.objBox.offsetHeight; this._topMb.style.top = (y || 0) + "px"; this._topMb.style.width = (x + 20) + "px"; this._botMb.style.top = (y2 - 3) + "px"; this._botMb.style.width = (x + 20) + "px" }; 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 = convertStringToBoolean(state) }; this.enableMultiselect = function(state) { this.selMultiRows = convertStringToBoolean(state) }; this.setImagePath = function(path) { 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 } 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++) { this._setColumnSizeR(el._cellIndexS + i * 1, a_sizes[i]) } } else { this._setColumnSizeR(el._cellIndex, fcolW) } this.doOnScroll(0, 1); this.setSizes(); if (this._fake && this._awdth) { this._fake._correctSplit() } }; 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() } } }; this.setSortImgState = function(state, ind, order, row) { order = (order || "asc").toLowerCase(); if (!convertStringToBoolean(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 } } 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].className.indexOf("rowselected") == -1 && (this._realfake || 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._realfake || 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]) } } } 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(); c.className += " editable"; this.editor.edit(); 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; 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.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 = convertStringToBoolean(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[col] } } 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 = new dhtmlxHierarchy(); 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]]) { dhtmlxError.throwError("Configuration", "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 = convertStringToBoolean(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] = convertStringToBoolean(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.getHeaderCol(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 = 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.objBox.ontouchend = function() { this.hdrBox.scrollLeft = this.objBox.scrollLeft }; 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 || event).cancelBubble = true }; this.obj.onclick = function(e) { this.grid._doClick(e || window.event); if (this.grid._sclE) { this.grid.editCell(e || window.event) } else { this.grid.editStop() }(e || event).cancelBubble = true }; 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(g, a, c) { this.getRowById(g)._attrs[a] = c }, isTreeGrid: function() { return (this.cellType._dhx_find("tree") != -1) }, setRowHidden: function(m, g) { var c = convertStringToBoolean(g); var l = this.getRowById(m); if (!l) { return } if (l.expand === "") { this.collapseKids(l) } if ((g) && (l.style.display != "none")) { l.style.display = "none"; var h = this.selectedRows._dhx_find(l); if (h != -1) { l.className = l.className.replace("rowselected", ""); for (var a = 0; a < l.childNodes.length; a++) { l.childNodes[a].className = l.childNodes[a].className.replace(/cellselected/g, "") } this.selectedRows._dhx_removeAt(h) } this.callEvent("onGridReconstructed", []) } if ((!g) && (l.style.display == "none")) { l.style.display = ""; this.callEvent("onGridReconstructed", []) } this.callEvent("onRowHide", [m, g]); this.setSizes() }, setColumnHidden: function(g, c) { if (!this.hdr.rows.length) { if (!this._ivizcol) { this._ivizcol = [] } return this._ivizcol[g] = c } if ((this.fldSorted) && (this.fldSorted.cellIndex == g) && (c)) { this.sortImg.style.display = "none" } var a = convertStringToBoolean(c); if (a) { if (!this._hrrar) { this._hrrar = new Array() } else { if (this._hrrar[g]) { return } } this._hrrar[g] = "display:none;"; this._hideShowColumn(g, "none") } else { if ((!this._hrrar) || (!this._hrrar[g])) { return } this._hrrar[g] = ""; this._hideShowColumn(g, "") } if ((this.fldSorted) && (this.fldSorted.cellIndex == g) && (!c)) { this.sortImg.style.display = "inline" } this.setSortImgPos(); this.callEvent("onColumnHidden", [g, 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(o, g, a, c, m) { m = m || "_cellIndex"; var n = o.rows.length; for (var l = 0; l < n; l++) { var q = o.rows[l].childNodes; if (q.length != this._cCount) { for (var h = 0; h < q.length; h++) { if (q[h][m] == g) { q[h].style[a] = c; break } } } else { q[g].style[a] = c } } }, _hideShowColumn: function(l, h) { var a = l; if (this.hdr.rows[1] && (this.hdr.rows[1]._childIndexes) && (this.hdr.rows[1]._childIndexes[l] != l)) { a = this.hdr.rows[1]._childIndexes[l] } if (h == "none") { this.hdr.rows[0].cells[l]._oldWidth = this.hdr.rows[0].cells[l].style.width || (this.initCellWidth[l] + "px"); this.hdr.rows[0].cells[l]._oldWidthP = this.cellWidthPC[l]; this.obj.rows[0].cells[l].style.width = "0px"; var c = { rows: [this.obj.rows[0]] }; this.forEachRow(function(m) { if (this.rowsAr[m].tagName == "TR") { c.rows.push(this.rowsAr[m]) } }); this._fixHiddenRowsAll(c, l, "display", "none"); if (this.isTreeGrid()) { this._fixHiddenRowsAllTG(l, "none") } if ((_isOpera && _OperaRv < 9) || _isKHTML || (_isFF)) { this._fixHiddenRowsAll(this.hdr, l, "display", "none", "_cellIndexS") } if (this.ftr) { this._fixHiddenRowsAll(this.ftr.childNodes[0], l, "display", "none") } this._fixHiddenRowsAll(this.hdr, l, "whiteSpace", "nowrap", "_cellIndexS"); if (!this.cellWidthPX.length && !this.cellWidthPC.length) { this.cellWidthPX = [].concat(this.initCellWidth) } if (this.cellWidthPX[l]) { this.cellWidthPX[l] = 0 } if (this.cellWidthPC[l]) { this.cellWidthPC[l] = 0 } } else { if (this.hdr.rows[0].cells[l]._oldWidth) { var g = this.hdr.rows[0].cells[l]; if (_isOpera || _isKHTML || (_isFF)) { this._fixHiddenRowsAll(this.hdr, l, "display", "", "_cellIndexS") } if (this.ftr) { this._fixHiddenRowsAll(this.ftr.childNodes[0], l, "display", "") } var c = { rows: [this.obj.rows[0]] }; this.forEachRow(function(m) { if (this.rowsAr[m].tagName == "TR") { c.rows.push(this.rowsAr[m]) } }); this._fixHiddenRowsAll(c, l, "display", ""); if (this.isTreeGrid()) { this._fixHiddenRowsAllTG(l, "") } this._fixHiddenRowsAll(this.hdr, l, "whiteSpace", "normal", "_cellIndexS"); if (g._oldWidthP) { this.cellWidthPC[l] = g._oldWidthP } if (g._oldWidth) { this.cellWidthPX[l] = parseInt(g._oldWidth) } } } this.setSizes(); if ((!_isIE) && (!_isFF)) { this.obj.border = 1; this.obj.border = 0 } }, enableColSpan: function(a) { this._ecspn = convertStringToBoolean(a) }, enableRowsHover: function(c, a) { this._unsetRowHover(false, true); this._hvrCss = a; if (convertStringToBoolean(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, g, a) { this._sclE = convertStringToBoolean(c); this._dclE = convertStringToBoolean(g); this._f2kE = convertStringToBoolean(a) }, enableLightMouseNavigation: function(a) { if (convertStringToBoolean(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(g, a, c) { if (convertStringToBoolean(g)) { 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 g = 0; g < this.formInputs.length; g++) { this.parentForm.removeChild(this.formInputs[g]) } } var c; this.xmlLoader = this.xmlLoader.destructor(); for (var g = 0; g < this.rowsCol.length; g++) { if (this.rowsCol[g]) { this.rowsCol[g].grid = null } } for (g in this.rowsAr) { if (this.rowsAr[g]) { this.rowsAr[g] = null } } this.rowsCol = new dhtmlxArray(); this.rowsAr = {}; this.entBox.innerHTML = ""; var h = function() {}; this.entBox.onclick = this.entBox.onmousedown = this.entBox.onbeforeactivate = this.entBox.onbeforedeactivate = this.entBox.onbeforedeactivate = this.entBox.onselectstart = h; this.setSizes = this._update_srnd_view = this.callEvent = h; 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 = h; this.globalBox.onclick = this.globalBox.onmousedown = this.globalBox.onbeforeactivate = this.globalBox.onbeforedeactivate = this.globalBox.onbeforedeactivate = this.globalBox.onselectstart = h } 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(g, c, a) { this._ahgr = convertStringToBoolean(g); this._ahgrF = convertStringToBoolean(a); this._ahgrM = c || null; if (arguments.length == 1) { this.objBox.style.overflowY = g ? "hidden" : "auto" } if (c == "auto") { this._ahgrM = null; this._ahgrMA = true; this._setAutoResize() } }, enableStableSorting: function(a) { this._sst = convertStringToBoolean(a); this.rowsCol.stablesort = function(m) { var l = this.length - 1; for (var h = 0; h < this.length - 1; h++) { for (var g = 0; g < l; g++) { if (m(this[g], this[g + 1]) > 0) { var c = this[g]; this[g] = this[g + 1]; this[g + 1] = c } } l-- } } }, enableKeyboardSupport: function(a) { this._htkebl = !convertStringToBoolean(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] = convertStringToBoolean(this._enbTts[a]) } }, enableResizing: function(c) { this._drsclmn = c.split(","); for (var a = 0; a < this._drsclmn.length; a++) { this._drsclmn[a] = convertStringToBoolean(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 = convertStringToBoolean(a) }, lockRow: function(a, g) { var c = this.getRowById(a); if (c) { c._locked = convertStringToBoolean(g); if ((this.cell) && (this.cell.parentNode.idd == a)) { this.editStop() } } }, _getRowArray: function(l) { var h = new Array(); for (var g = 0; g < l.childNodes.length; g++) { var c = this.cells3(l, g); h[g] = c.getValue() } return h }, setDateFormat: function(c, a) { this._dtmask = c; this._dtmask_inc = a }, setNumberFormat: function(o, g, l, n) { var h = o.replace(/[^0\,\.]*/g, ""); var a = h.indexOf("."); if (a > -1) { a = h.length - a - 1 } var c = h.indexOf(","); if (c > -1) { c = h.length - a - 2 - c } if (typeof l != "string") { l = this.i18n.decimal_separator } if (typeof n != "string") { n = this.i18n.group_separator } var q = o.split(h)[0]; var m = o.split(h)[1]; this._maskArr[g] = [a, c, q, m, l, n] }, _aplNFb: function(l, h) { var c = this._maskArr[h]; if (!c) { return l } var g = parseFloat(l.toString().replace(/[^0-9]*/g, "")); if (l.toString().substr(0, 1) == "-") { g = g * -1 } if (c[0] > 0) { g = g / Math.pow(10, c[0]) } return g }, _aplNF: function(m, l) { var g = this._maskArr[l]; if (!g) { return m } var n = (parseFloat(m) < 0 ? "-" : "") + g[2]; m = Math.abs(Math.round(parseFloat(m) * Math.pow(10, g[0] > 0 ? g[0] : 0))).toString(); m = (m.length < g[0] ? Math.pow(10, g[0] + 1 - m.length).toString().substr(1, g[0] + 1) + m.toString() : m).split("").reverse(); m[g[0]] = (m[g[0]] || "0") + g[4]; if (g[1] > 0) { for (var h = (g[0] > 0 ? 0 : 1) + g[0] + g[1]; h < m.length; h += g[1]) { m[h] += g[5] } } return n + m.reverse().join("") + g[3] }, _launchCommands: function(a) { for (var h = 0; h < a.length; h++) { var g = new Array(); for (var c = 0; c < a[h].childNodes.length; c++) { if (a[h].childNodes[c].nodeType == 1) { g[g.length] = a[h].childNodes[c].firstChild.data } } this[a[h].getAttribute("command")].apply(this, g) } }, _parseHead: function(l) { var h = this.xmlLoader.doXPath("./head", l); if (h.length) { var m = this.xmlLoader.doXPath("./column", h[0]); var n = this.xmlLoader.doXPath("./settings", h[0]); var C = "setInitWidths"; var w = false; if (n[0]) { for (var o = 0; o < n[0].childNodes.length; o++) { switch (n[0].childNodes[o].tagName) { case "colwidth": if (n[0].childNodes[o].firstChild && n[0].childNodes[o].firstChild.data == "%") { C = "setInitWidthsP" } break; case "splitat": w = (n[0].childNodes[o].firstChild ? n[0].childNodes[o].firstChild.data : false); break } } } this._launchCommands(this.xmlLoader.doXPath("./beforeInit/call", h[0])); if (m.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 < m.length; A++) { for (var y = 1; y < v.length; y++) { a[y].push(m[A].getAttribute(v[y])) } a[0].push((m[A].firstChild ? m[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 < m.length; A++) { if ((this.cellType[A].indexOf("co") == 0) || (this.cellType[A] == "clist")) { var q = this.xmlLoader.doXPath("./option", m[A]); if (q.length) { var x = new Array(); if (this.cellType[A] == "clist") { for (var y = 0; y < q.length; y++) { x[x.length] = q[y].firstChild ? q[y].firstChild.data : "" } this.registerCList(A, x) } else { var D = this.getCombo(A); for (var y = 0; y < q.length; y++) { D.put(q[y].getAttribute("value"), q[y].firstChild ? q[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 g = a[7].join(this.delim); if (this.setColHidden && g.replace(/,/g, "") != "") { this.setColHidden(g) } if ((w) && (this.splitAt)) { this.splitAt(w) } } this._launchCommands(this.xmlLoader.doXPath("./afterInit/call", h[0])) } var c = this.xmlLoader.doXPath("//rows/userdata", l); 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(h) { var g = this.cells(h, a); if (g.changeState && g.getValue() != 0) { c.push(h) } }, 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(g) { if (this.cells(g, c).isCheckbox()) { this.cells(g, c).setValue(a) } }) }, _drawTooltip: function(l) { var m = this.grid.getFirstParentOfType(l ? l.target : event.srcElement, "TD"); if (!m || ((this.grid.editor) && (this.grid.editor.cell == m))) { return true } var h = m.parentNode; if (!h.idd || h.idd == "__filler__") { return } var g = (l ? l.target : event.srcElement); if (h.idd == window.unknown) { return true } if (!this.grid.callEvent("onMouseOver", [h.idd, m._cellIndex, (l || window.event)])) { return true } if ((this.grid._enbTts) && (!this.grid._enbTts[m._cellIndex])) { if (g.title) { g.title = "" } return true } if (m._cellIndex >= this.grid._cCount) { return } var a = this.grid.cells3(h, m._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(g) { var a = []; for (var c = 0; c < this.rowsBuffer.length; c++) { if (this.rowsBuffer[c]) { a.push(this.rowsBuffer[c].idd) } } return a.join(g || this.delim) }, getAllItemIds: function() { return this.getAllRowIds() }, setColspan: function(g, x, h) { if (!this._ecspn) { return } var a = this.getRowById(g); if ((a._childIndexes) && (a.childNodes[a._childIndexes[x]])) { var q = a._childIndexes[x]; var l = a.childNodes[q]; var o = l.colSpan; l.colSpan = 1; if ((o) && (o != 1)) { for (var u = 1; u < o; u++) { var w = document.createElement("TD"); if (l.nextSibling) { a.insertBefore(w, l.nextSibling) } else { a.appendChild(w) } a._childIndexes[x + u] = q + u; w._cellIndex = x + u; w.style.textAlign = this.cellAlign[u]; w.style.verticalAlign = this.cellVAlign[u]; l = w; this.cells3(a, x + u).setValue("") } } for (var v = x * 1 + 1 * o; v < a._childIndexes.length; v++) { a._childIndexes[v] += (o - 1) * 1 } } if ((h) && (h > 1)) { if (a._childIndexes) { var q = a._childIndexes[x] } else { var q = x; a._childIndexes = new Array(); for (var v = 0; v < a.childNodes.length; v++) { a._childIndexes[v] = v } } a.childNodes[q].colSpan = h; for (var v = 1; v < h; v++) { a._childIndexes[a.childNodes[q + 1]._cellIndex] = q; a.removeChild(a.childNodes[q + 1]) } var s = a.childNodes[a._childIndexes[x]]._cellIndex; for (var v = s * 1 + 1 * h; v < a._childIndexes.length; v++) { a._childIndexes[v] -= (h - 1) } } }, preventIECaching: function(a) { this.no_cashe = convertStringToBoolean(a); this.xmlLoader.rSeed = this.no_cashe }, enableColumnAutoSize: function(a) { this._eCAS = convertStringToBoolean(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(q, c) { if (this._hrrar && this._hrrar[q]) { return } this._notresize = true; var g = 0; this._setColumnSizeR(q, 20); for (var n = 1; n < this.hdr.rows.length; n++) { var s = this.hdr.rows[n]; s = s.childNodes[(s._childIndexes) ? s._childIndexes[q] : q]; if ((s) && ((!s.colSpan) || (s.colSpan < 2)) && s._cellIndex == q) { if ((s.childNodes[0]) && (s.childNodes[0].className == "hdrcell")) { s = s.childNodes[0] } g = Math.max(g, s.scrollWidth) } } var h = this.obj.rows.length; var r = 0; var v = this.cellType._dhx_find("tree"); for (var o = 1; o < h; o++) { var u = this.obj.rows[o]; if (!this.rowsAr[u.idd]) { continue } if (u._childIndexes && u._childIndexes[q] != q || !u.childNodes[q]) { continue } r = (u.childNodes[q].innerText || u.childNodes[q].textContent || "").length * this.fontWidth; if (this._h2 && q == v) { r += this._h2.get[u.idd].level * 22 } if (r > g) { g = r } } g += 20 + (c || 0); this._setColumnSizeR(q, g); this._notresize = false; this.setSizes() }, detachHeader: function(a, g) { g = g || this.hdr; var c = g.rows[a + 1]; if (c) { c.parentNode.removeChild(c) } this.setSizes() }, detachFooter: function(a) { this.detachHeader(a, this.ftr) }, attachHeader: function(a, h, c) { if (typeof(a) == "string") { a = this._eSplit(a) } if (typeof(h) == "string") { h = h.split(this.delim) } c = c || "_aHead"; if (this.hdr.rows.length) { if (a) { this._createHRow([a, h], this[(c == "_aHead") ? "hdr" : "ftr"]) } else { if (this[c]) { for (var g = 0; g < this[c].length; g++) { this.attachHeader.apply(this, this[c][g]) } } } } else { if (!this[c]) { this[c] = new Array() } this[c][this[c].length] = [a, h, c] } }, _createHRow: function(g, r) { if (!r) { if (this.entBox.style.position != "absolute") { this.entBox.style.position = "relative" } var n = document.createElement("DIV"); n.className = "c_ftr".substr(2); this.entBox.appendChild(n); 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"; n.appendChild(v); v.appendChild(document.createElement("TBODY")); this.ftr = r = v; var m = v.insertRow(0); var a = ((this.hdrLabels.length <= 1) ? g[0].length : this.hdrLabels.length); for (var h = 0; h < a; h++) { m.appendChild(document.createElement("TH")); m.childNodes[h]._cellIndex = h } if (_isIE && _isIE < 8) { m.style.position = "absolute" } else { m.style.height = "auto" } } var l = g[1]; var n = document.createElement("TR"); r.rows[0].parentNode.appendChild(n); for (var h = 0; h < g[0].length; h++) { if (g[0][h] == "#cspan") { var o = n.cells[n.cells.length - 1]; o.colSpan = (o.colSpan || 1) + 1; continue } if ((g[0][h] == "#rspan") && (r.rows.length > 1)) { var y = r.rows.length - 2; var x = false; var o = null; while (!x) { var o = r.rows[y]; for (var c = 0; c < o.cells.length; c++) { if (o.cells[c]._cellIndex == h) { x = c + 1; break } } y-- } o = o.cells[x - 1]; o.rowSpan = (o.rowSpan || 1) + 1; continue } var q = document.createElement("TD"); q._cellIndex = q._cellIndexS = h; if (this._hrrar && this._hrrar[h] && !_isIE) { q.style.display = "none" } if (typeof g[0][h] == "object") { q.appendChild(g[0][h]) } else { if (this.forceDivInHeader) { q.innerHTML = "
" + (g[0][h] || " ") + "
" } else { q.innerHTML = (g[0][h] || " ") } if ((g[0][h] || "").indexOf("#") != -1) { var v = g[0][h].match(/(^|{)#([^}]+)(}|$)/); if (v) { var s = "_in_header_" + v[2]; if (this[s]) { this[s]((this.forceDivInHeader ? q.firstChild : q), h, g[0][h].split(v[0])) } } } } if (l) { q.style.cssText = l[h] } n.appendChild(q) } 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(g, a, c) { this.changeCellType(this.getRowById(g), a, c) }, changeCellType: function(g, h, c) { c = c || this.cellType[h]; var l = this.cells3(g, h); var a = l.getValue(); l.cell._cellType = c; var l = this.cells3(g, h); l.setValue(a) }, setRowExcellType: function(g, c) { var h = this.rowsAr[g]; for (var a = 0; a < h.childNodes.length; a++) { this.changeCellType(h, a, c) } }, setColumnExcellType: function(a, g) { for (var c = 0; c < this.rowsBuffer.length; c++) { if (this.rowsBuffer[c] && this.rowsBuffer[c].tagName == "TR") { this.changeCellType(this.rowsBuffer[c], a, g) } } if (this.cellType[a] == "math") { this._strangeParams[c] = g } else { this.cellType[a] = g } }, forEachRow: function(g) { for (var c in this.rowsAr) { if (this.rowsAr[c] && this.rowsAr[c].idd) { g.apply(this, [this.rowsAr[c].idd]) } } }, forEachRowA: function(g) { for (var c = 0; c < this.rowsBuffer.length; c++) { if (this.rowsBuffer[c]) { g.call(this, this.render_row(c).idd) } } }, forEachCell: function(g, c) { var h = this.getRowById(g); if (!h) { return } for (var a = 0; a < this._cCount; a++) { c(this.cells3(h, a), a) } }, enableAutoWidth: function(g, a, c) { this._awdth = [convertStringToBoolean(g), parseInt(a || 99999), parseInt(c || 0)]; if (arguments.length == 1) { this.objBox.style.overflowX = g ? "hidden" : "auto" } }, updateFromXML: function(a, h, c, g) { if (typeof h == "undefined") { h = true } this._refresh_mode = [true, h, c]; this.load(a, g) }, _refreshFromXML: function(h) { 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"); h.getXMLTopNode("rows"); var l = h.doXPath("//rows")[0].getAttribute("parent") || 0; var n = {}; if (this._refresh_mode[2]) { if (r != -1) { this._h2.forEachChild(l, function(s) { n[s.id] = true }, this) } else { this.forEachRow(function(s) { n[s] = true }) } } var q = h.doXPath("//row"); for (var g = 0; g < q.length; g++) { var o = q[g]; var a = o.getAttribute("id"); n[a] = false; var l = o.parentNode.getAttribute("id") || l; if (this.rowsAr[a] && this.rowsAr[a].tagName != "TR") { if (this._h2) { this._h2.get[a].buff.data = o } else { this.rowsBuffer[this.getRowIndex(a)].data = o } this.rowsAr[a] = o } else { if (this.rowsAr[a]) { this._process_xml_row(this.rowsAr[a], o, -1); this._postRowProcessing(this.rowsAr[a], true); if (this._fake && this._fake.rowsAr[a]) { this._fake._process_xml_row(this._fake.rowsAr[a], o, -1) } } else { if (this._refresh_mode[1]) { var m = { idd: a, data: o, _parser: this._process_xml_row, _locator: this._get_xml_data }; var c = this.rowsBuffer.length; if (this._refresh_mode[1] == "top") { this.rowsBuffer.unshift(m); c = 0 } else { this.rowsBuffer.push(m) } if (this._h2) { reset = true; (this._h2.add(a, (o.parentNode.getAttribute("id") || o.parentNode.getAttribute("parent")))).buff = this.rowsBuffer[this.rowsBuffer.length - 1] } else { if (this._srnd) { reset = true } } this.rowsAr[a] = o; o = this.render_row(c); this._insertRowAt(o, c ? -1 : 0) } } } } if (this._refresh_mode[2]) { for (a in n) { if (n[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(g, c) { var a = this.cells(g, c).cell; if (!a._combo) { a._combo = new dhtmlXGridComboObject() } return a._combo }, setTabOrder: function(c) { var h = c.split(this.delim); this._tabOrder = []; var a = this._cCount || c.length; for (var g = 0; g < a; g++) { h[g] = { c: parseInt(h[g]), ind: g } } h.sort(function(m, l) { return (m.c > l.c ? 1 : -1) }); for (var g = 0; g < a; g++) { if (!h[g + 1] || (typeof h[g].c == "undefined")) { this._tabOrder[h[g].ind] = (h[0].ind + 1) * -1 } else { this._tabOrder[h[g].ind] = h[g + 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 g = this._nextRow(a, 1); if (g) { c._r_select = null; this.selectCell(g, this.cell._cellIndex, true); if (c.pagingOn) { c.showRow(g.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 g = this._nextRow(a - 1, -1); this.selectCell(g, this.cell._cellIndex, true); if (c.pagingOn && g) { c.showRow(g.idd) } } else { this._key_events.k33_0_0.apply(this, []) } } this._still_active = true } }, _build_master_row: function() { var g = document.createElement("DIV"); var c = [""]; for (var a = 0; a < this._cCount; a++) { c.push("") } c.push("
"); g.innerHTML = c.join(""); this._master_row = g.firstChild.rows[0] }, _prepareRow: function(a) { if (!this._master_row) { this._build_master_row() } var g = this._master_row.cloneNode(true); for (var c = 0; c < g.childNodes.length; c++) { g.childNodes[c]._cellIndex = c; if (this._enbCid) { g.childNodes[c].id = "c_" + a + "_" + c } if (this.dragAndDropOff) { this.dragger.addDraggableItem(g.childNodes[c], this) } } g.idd = a; g.grid = this; return g }, _process_jsarray_row: function(c, g) { c._attrs = {}; for (var a = 0; a < c.childNodes.length; a++) { c.childNodes[a]._attrs = {} } this._fillRow(c, (this._c_order ? this._swapColumns(g) : g)); 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, g) { c._attrs = {}; for (var a = 0; a < c.childNodes.length; a++) { c.childNodes[a]._attrs = {} } this._fillRow(c, g); return c }, _get_json_data: function(c, a) { return c.data[a] }, _process_js_row: function(g, h) { var a = []; for (var c = 0; c < this.columnIds.length; c++) { a[c] = h[this.columnIds[c]]; if (!a[c] && a[c] !== 0) { a[c] = "" } } this._process_some_row(g, a); g._attrs = h; return g }, _get_js_data: function(c, a) { return c[this.columnIds[a]] }, _process_csv_row: function(c, g) { c._attrs = {}; for (var a = 0; a < c.childNodes.length; a++) { c.childNodes[a]._attrs = {} } this._fillRow(c, (this._c_order ? this._swapColumns(g.split(this.csv.cell)) : g.split(this.csv.cell))); return c }, _get_csv_data: function(c, a) { return c.split(this.csv.cell)[a] }, _process_store_row: function(l, h) { var a = []; for (var g = 0; g < this.columnIds.length; g++) { a[g] = h[this.columnIds[g]] } for (var c = 0; c < l.childNodes.length; c++) { l.childNodes[c]._attrs = {} } l._attrs = h; this._fillRow(l, a) }, _process_xml_row: function(a, m) { var u = this.xmlLoader.doXPath(this.xml.cell, m); var q = []; a._attrs = this._xml_attrs(m); if (this._ud_enabled) { var s = this.xmlLoader.doXPath("./userdata", m); for (var l = s.length - 1; l >= 0; l--) { var o = ""; for (var g = 0; g < s[l].childNodes.length; g++) { o += s[l].childNodes[g].nodeValue } this.setUserData(a.idd, s[l].getAttribute("name"), o) } } for (var g = 0; g < u.length; g++) { var h = u[this._c_order ? this._c_order[g] : g]; if (!h) { continue } var c = a._childIndexes ? a._childIndexes[g] : g; var n = h.getAttribute("type"); if (a.childNodes[c]) { if (n) { a.childNodes[c]._cellType = n } a.childNodes[c]._attrs = this._xml_attrs(h) } if (!h.getAttribute("xmlcontent")) { if (h.firstChild) { h = h.firstChild.data } else { h = "" } } q.push(h) } for (g < u.length; g < a.childNodes.length; g++) { a.childNodes[g]._attrs = {} } if (a.parentNode && a.parentNode.tagName == "row") { a._attrs.parent = a.parentNode.getAttribute("idd") } this._fillRow(a, q); 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(h, m) { if (this.editor) { this.editStop() } for (var c = 0; c < h.childNodes.length; c++) { if ((c < m.length) || (this.defVal[c])) { var g = h.childNodes[c]._cellIndex; var l = m[g]; var a = this.cells4(h.childNodes[c]); if ((this.defVal[g]) && ((l == "") || (typeof(l) == "undefined"))) { l = this.defVal[g] } if (a) { a.setValue(l) } } else { h.childNodes[c].innerHTML = " "; h.childNodes[c]._clearCell = true } } return h }, _postRowProcessing: function(m, o) { if (m._attrs["class"]) { m._css = m.className = m._attrs["class"] } if (m._attrs.locked) { m._locked = true } if (m._attrs.bgColor) { m.bgColor = m._attrs.bgColor } var n = 0; for (var g = 0; g < m.childNodes.length; g++) { var q = m.childNodes[g]; var l = q._cellIndex; var h = q._attrs.style || m._attrs.style; if (h) { q.style.cssText += ";" + h } if (q._attrs["class"]) { q.className = q._attrs["class"] } h = q._attrs.align || this.cellAlign[l]; if (h) { q.align = h } q.vAlign = q._attrs.valign || this.cellVAlign[l]; var a = q._attrs.bgColor || this.columnColor[l]; if (a) { q.bgColor = a } if (q._attrs.colspan && !o) { this.setColspan(m.idd, g + n, q._attrs.colspan); n += (q._attrs.colspan - 1) } if (this._hrrar && this._hrrar[l] && !o) { q.style.display = "none" } } this.callEvent("onRowCreated", [m.idd, m, null]) }, load: function(a, g, c) { this.callEvent("onXLS", [this]); if (arguments.length == 2 && typeof g != "function") { c = g; g = null } c = c || "xml"; if (!this.xmlFileUrl) { this.xmlFileUrl = a } this._data_type = c; this.xmlLoader = new dtmlXMLLoaderObject(this.doLoadDetails, this, true, this.no_cashe); this.xmlLoader.onloadAction = function(m, h, o, n, l) { if (!m.callEvent) { return } l = m["_process_" + c](l); if (!m._contextCallTimer) { m.callEvent("onXLE", [m, 0, 0, l]) } if (g) { g(); g = null } }; this.xmlLoader.loadXML(a) }, loadXMLString: function(g, c) { var a = new dtmlXMLLoaderObject(function() {}); a.loadXMLString(g); this.parse(a, c, "xml") }, loadXML: function(a, c) { this.load(a, c, "xml") }, parse: function(g, c, a) { if (arguments.length == 2 && typeof c != "function") { a = c; c = null } a = a || "xml"; this._data_type = a; g = this["_process_" + a](g); if (!this._contextCallTimer) { this.callEvent("onXLE", [this, 0, 0, g]) } 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 g = {}; if (c.attributes.length) { for (var a = 0; a < c.attributes.length; a++) { g[c.attributes[a].name] = c.attributes[a].value } } return g }, _process_xml: function(l) { if (!l.doXPath) { var s = new dtmlXMLLoaderObject(function() {}); if (typeof l == "string") { s.loadXMLString(l) } else { if (l.responseXML) { s.xmlDoc = l } else { s.xmlDoc = {} } s.xmlDoc.responseXML = l } l = s } if (this._refresh_mode) { return this._refreshFromXML(l) } this._parsing = true; var o = l.getXMLTopNode(this.xml.top); if (o.tagName != this.xml.top) { return } var r = o.getAttribute("dhx_security"); if (r) { dhtmlx.security_key = r } this._parseHead(o); var u = l.doXPath(this.xml.row, o); var n = parseInt(l.doXPath("//" + this.xml.top)[0].getAttribute("pos") || 0); var q = parseInt(l.doXPath("//" + this.xml.top)[0].getAttribute("total_count") || 0); var q = Math.min(q, 32000000 / this._srdh); var m = false; if (q && q != this.rowsBuffer.length) { if (!this.rowsBuffer[q - 1]) { if (this.rowsBuffer.length) { m = true } this.rowsBuffer[q - 1] = null } if (q < this.rowsBuffer.length) { this.rowsBuffer.splice(q, this.rowsBuffer.length - q); m = true } } if (this.isTreeGrid()) { return this._process_tree_xml(l) } for (var c = 0; c < u.length; c++) { if (this.rowsBuffer[c + n]) { continue } var a = u[c].getAttribute("id") || (c + n + 1); this.rowsBuffer[c + n] = { idd: a, data: u[c], _parser: this._process_xml_row, _locator: this._get_xml_data }; this.rowsAr[a] = u[c] } this.callEvent("onDataReady", []); if (m && this._srnd) { var g = this.objBox.scrollTop; this._reset_view(); this.objBox.scrollTop = g } else { this.render_dataset() } this._parsing = false; return l.xmlDoc.responseXML ? l.xmlDoc.responseXML : l.xmlDoc }, _process_jsarray: function(data) { this._parsing = true; if (data && data.xmlDoc) { eval("dhtmlx.temp=" + data.xmlDoc.responseText + ";"); 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(h) { this._parsing = true; if (h.xmlDoc) { h = h.xmlDoc.responseText } h = h.replace(/\r/g, ""); h = h.split(this.csv.row); if (this._csvHdr) { this.clearAll(); var g = h.splice(0, 1)[0].split(this.csv.cell); if (!this._csvAID) { g.splice(0, 1) } this.setHeader(g.join(this.delim)); this.init() } for (var c = 0; c < h.length; c++) { if (!h[c] && c == h.length - 1) { continue } if (this._csvAID) { var l = c + 1; this.rowsBuffer.push({ idd: l, data: h[c], _parser: this._process_csv_row, _locator: this._get_csv_data }) } else { var a = h[c].split(this.csv.cell); var l = a.splice(0, 1)[0]; this.rowsBuffer.push({ idd: l, data: a, _parser: this._process_jsarray_row, _locator: this._get_jsarray_data }) } this.rowsAr[l] = h[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; if (data && data.xmlDoc) { eval("dhtmlx.temp=" + data.xmlDoc.responseText + ";"); 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 { 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.render_dataset(); this._parsing = false }, render_dataset: function(h, 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) { h = Math.max((h || 0), (this.currentPage - 1) * this.rowsBufferOutSize); a = Math.min(this.currentPage * this.rowsBufferOutSize, this.rowsBuffer.length) } else { h = h || 0; a = a || this.rowsBuffer.length } for (var g = h; g < a; g++) { var m = this.render_row(g); if (m == -1) { if (this.xmlFileUrl) { if (this.callEvent("onDynXLS", [g, (this._dpref ? this._dpref : (a - g))])) { this.load(this.xmlFileUrl + getUrlSymbol(this.xmlFileUrl) + "posStart=" + g + "&count=" + (this._dpref ? this._dpref : (a - g)), this._data_type) } } a = g; break } if (!m.parentNode || !m.parentNode.tagName) { this._insertRowAt(m, g); if (m._attrs.selected || m._attrs.select) { this.selectRow(m, m._attrs.call ? true : false, true); m._attrs.selected = m._attrs.select = null } } if (this._ads_count && g - h == this._ads_count) { var l = this; this._context_parsing = this._context_parsing || this._parsing; return this._contextCallTimer = window.setTimeout(function() { l._contextCallTimer = null; l.render_dataset(g, a); if (!l._contextCallTimer) { if (l._context_parsing) { l.callEvent("onXLE", []) } else { l._fixAlterCss() } l.callEvent("onDistributedEnd", []); l._context_parsing = false } }, this._ads_time) } } if (this._ads_count && g == a) { this.callEvent("onDistributedEnd", []) } if (this._srnd && !this._fillers) { var c = this.rowsBuffer.length - a; this._fillers = []; if (this._fake) { this._fake._fillers = [] } while (c > 0) { var o = (_isIE || window._FFrv) ? Math.min(c, 50000) : c; var n = this._add_filler(a, o); if (n) { this._fillers.push(n) } c -= o; a += o } } 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 g = this._prepareRow(a.idd); this.rowsBuffer[c] = g; this.rowsAr[a.idd] = g; a._parser.call(this, g, a.data); this._postRowProcessing(g); return g } return this.rowsBuffer[c] }, _get_cell_value: function(c, a, g) { 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)[g ? g : "getValue"]() }, sortRows: function(g, m, c) { this.editStop(); c = (c || "asc").toLowerCase(); m = (m || this.fldSort[g]); g = g || 0; if (this.isTreeGrid()) { this.sortTreeRows(g, m, c) } else { var a = {}; var l = this.cellType[g]; var n = "getValue"; if (l == "link") { n = "getContent" } if (l == "dhxCalendar" || l == "dhxCalendarA") { n = "getDate" } for (var h = 0; h < this.rowsBuffer.length; h++) { a[this.rowsBuffer[h].idd] = this._get_cell_value(this.rowsBuffer[h], g, n) } this._sortRows(g, m, c, a) } this.callEvent("onAfterSorting", [g, m, c]) }, _sortCore: function(g, m, c, a, l) { var h = "sort"; if (this._sst) { l.stablesort = this.rowsCol.stablesort; h = "stablesort" } if (m.length > 4) { m = window[m] } if (m == "cus") { var n = this._customSorts[g]; l[h](function(q, o) { return n(a[q.idd], a[o.idd], c, q.idd, o.idd) }) } else { if (typeof(m) == "function") { l[h](function(q, o) { return m(a[q.idd], a[o.idd], c, q.idd, o.idd) }) } else { if (m == "str") { l[h](function(q, o) { if (c == "asc") { return a[q.idd] > a[o.idd] ? 1 : (a[q.idd] < a[o.idd] ? -1 : 0) } else { return a[q.idd] < a[o.idd] ? 1 : (a[q.idd] > a[o.idd] ? -1 : 0) } }) } else { if (m == "int") { l[h](function(r, q) { var o = parseFloat(a[r.idd]); o = isNaN(o) ? -99999999999999 : o; var s = parseFloat(a[q.idd]); s = isNaN(s) ? -99999999999999 : s; if (c == "asc") { return o - s } else { return s - o } }) } else { if (m == "date") { l[h](function(r, q) { var o = Date.parse(a[r.idd]) || (Date.parse("01/01/1900")); var s = Date.parse(a[q.idd]) || (Date.parse("01/01/1900")); if (c == "asc") { return o - s } else { return s - o } }) } } } } } }, _sortRows: function(g, h, c, a) { this._sortCore(g, h, c, a, this.rowsBuffer); this._reset_view(); this.callEvent("onGridReconstructed", []) }, _reset_view: function(g) { if (!this.obj.rows[0]) { return } if (this._lahRw) { this._unsetRowHover(0, true) } this.callEvent("onResetView", []); var a = this.obj.rows[0].parentNode; var h = 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(h); this.rowsCol = dhtmlxArray(); if (this._sst) { this.enableStableSorting(true) } this._fillers = this.undefined; if (!g) { if (_isIE && this._srnd) { this.render_dataset() } else { this.render_dataset() } } }, deleteRow: function(c, h) { if (!h) { h = this.getRowById(c) } if (!h) { 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(h) } else { if (h.parentNode) { h.parentNode.removeChild(h) } var m = this.rowsCol._dhx_find(h); if (m != -1) { this.rowsCol._dhx_removeAt(m) } for (var g = 0; g < this.rowsBuffer.length; g++) { if (this.rowsBuffer[g] && this.rowsBuffer[g].idd == c) { this.rowsBuffer._dhx_removeAt(g); m = g; break } } } this.rowsAr[c] = null; for (var g = 0; g < this.selectedRows.length; g++) { if (this.selectedRows[g].idd == c) { this.selectedRows._dhx_removeAt(g) } } if (this._srnd) { for (var g = 0; g < this._fillers.length; g++) { var l = this._fillers[g]; if (!l) { continue } if (l[0] >= m) { this._update_fillers(g, 0, -1) } else { if (l[0] + l[1] > m) { this._update_fillers(g, -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(m, n, c) { if (c == -1 || typeof c == "undefined") { c = this.rowsBuffer.length } if (typeof n == "string") { n = n.split(this.delim) } var o = this._prepareRow(m); o._attrs = {}; for (var g = 0; g < o.childNodes.length; g++) { o.childNodes[g]._attrs = {} } this.rowsAr[o.idd] = o; if (this._h2) { this._h2.get[o.idd].buff = o } this._fillRow(o, n); this._postRowProcessing(o); if (this._skipInsert) { this._skipInsert = false; return this.rowsAr[o.idd] = o } if (this.pagingOn) { this.rowsBuffer._dhx_insertAt(c, o); this.rowsAr[o.idd] = o; return o } if (this._fillers) { this.rowsCol._dhx_insertAt(c, null); this.rowsBuffer._dhx_insertAt(c, o); if (this._fake) { this._fake.rowsCol._dhx_insertAt(c, null) } this.rowsAr[o.idd] = o; var q = false; for (var h = 0; h < this._fillers.length; h++) { var l = this._fillers[h]; if (l && l[0] <= c && (l[0] + l[1]) >= c) { l[1] = l[1] + 1; var a = l[2].firstChild.style.height = parseInt(l[2].firstChild.style.height) + this._srdh + "px"; q = true; if (this._fake) { this._fake._fillers[h][1]++; this._fake._fillers[h][2].firstChild.style.height = a } } if (l && l[0] > c) { l[0] = l[0] + 1; if (this._fake) { this._fake._fillers[h][0]++ } } } if (!q) { 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 o } this.rowsBuffer._dhx_insertAt(c, o); return this._insertRowAt(o, c) }, addRow: function(a, h, g) { var c = this._addRow(a, h, g); 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._ahgr) { this.setSizes() } this.callEvent("onGridReconstructed", []); return c }, _insertRowAt: function(g, h, c) { this.rowsAr[g.idd] = g; if (this._skipInsert) { this._skipInsert = false; return g } if ((h < 0) || ((!h) && (parseInt(h) !== 0))) { h = this.rowsCol.length } else { if (h > this.rowsCol.length) { h = this.rowsCol.length } } if (this._cssEven) { var a = g.className.replace(this._cssUnEven, ""); if ((this._cssSP ? this.getLevel(g.idd) : h) % 2 == 1) { g.className = a + " " + this._cssUnEven + (this._cssSU ? (" " + this._cssUnEven + "_" + this.getLevel(g.idd)) : "") } else { g.className = a + " " + this._cssEven + (this._cssSU ? (" " + this._cssEven + "_" + this.getLevel(g.idd)) : "") } } if (!c) { if ((h == (this.obj.rows.length - 1)) || (!this.rowsCol[h])) { if (_isKHTML) { this.obj.appendChild(g) } else { this.obj.firstChild.appendChild(g) } } else { this.rowsCol[h].parentNode.insertBefore(g, this.rowsCol[h]) } } this.rowsCol._dhx_insertAt(h, g); this.callEvent("onRowInserted", [g, h]); return g }, getRowById: function(g) { var c = this.rowsAr[g]; if (c) { if (c.tagName != "TR") { for (var a = 0; a < this.rowsBuffer.length; a++) { if (this.rowsBuffer[a] && this.rowsBuffer[a].idd == g) { 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(h, g) { if (arguments.length == 0) { return this.cells4(this.cell) } else { var l = this.getRowById(h) } var a = (l._childIndexes ? l.childNodes[l._childIndexes[g]] : l.childNodes[g]); if (!a && l._childIndexes) { a = l.firstChild || {} } return this.cells4(a) }, cellByIndex: function(c, a) { return this.cells2(c, a) }, cells2: function(h, g) { var l = this.render_row(h); var a = (l._childIndexes ? l.childNodes[l._childIndexes[g]] : l.childNodes[g]); if (!a && l._childIndexes) { a = l.firstChild || {} } return this.cells4(a) }, cells3: function(g, c) { var a = (g._childIndexes ? g.childNodes[g._childIndexes[c]] : g.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, g) { var g = g || (a._cellType || this.cellType[a._cellIndex]); if (!this._ecache[g]) { if (!window["eXcell_" + g]) { var c = eXcell_ro } else { var c = window["eXcell_" + g] } this._ecache[g] = new c(a) } this._ecache[g].cell = a; return this._ecache[g] }, 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 = convertStringToBoolean(a) } else { this.smartTabOrder = true } }, setExternalTabOrder: function(l, a) { var c = this; this.tabStart = (typeof(l) == "object") ? l : document.getElementById(l); var g = this.tabStart.onkeydown; this.tabStart.onkeydown = function(n) { if (g) { g.call(this, n) } var m = (n || window.event); if (m.keyCode == 9 && !m.shiftKey) { m.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 h = this.tabEnd.onkeydown; this.tabEnd.onkeydown = this.tabEnd.onkeypress = function(n) { if (h) { h.call(this, n) } var m = (n || window.event); if (m.keyCode == 9 && m.shiftKey) { m.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() { var a = this._pgn_skin; this._pgn_skin = null; this.clearAll(); this._pgn_skin = a; 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 h(n, o) { this[n] = o } function m(n, o) { this[n].call(this, o) } function g(n, o) { this[n].call(this, o.join(this.delim)) } function a(n, r) { for (var q = 0; q < r.length; q++) { if (typeof r[q] == "object") { var s = this.getCombo(q); for (var o in r[q]) { s.put(o, r[q][o]) } } } } function l(n, w, r) { var y = 1; var v = []; function x(C, A, D) { if (!v[A]) { v[A] = [] } if (typeof D == "object") { D.toString = function() { return this.text } } v[A][C] = D } for (var s = 0; s < w.length; s++) { if (typeof(w[s]) == "object" && w[s].length) { for (var q = 0; q < w[s].length; q++) { x(s, q, w[s][q]) } } else { x(s, 0, w[s]) } } for (var s = 0; s < v.length; s++) { for (var q = 0; q < v[0].length; q++) { var u = v[s][q]; v[s][q] = (u || "").toString() || " "; if (u && u.colspan) { for (var o = 1; o < u.colspan; o++) { x(q + o, s, "#cspan") } } if (u && u.rowspan) { for (var o = 1; o < u.rowspan; o++) { x(q, s + o, "#rspan") } } } } this.setHeader(v[0]); for (var s = 1; s < v.length; s++) { this.attachHeader(v[s]) } } var c = [{ name: "label", def: " ", operation: "setHeader", type: l }, { name: "id", def: "", operation: "columnIds", type: h }, { name: "width", def: "*", operation: "setInitWidths", type: g }, { name: "align", def: "left", operation: "cellAlign", type: h }, { name: "valign", def: "middle", operation: "cellVAlign", type: h }, { name: "sort", def: "na", operation: "fldSort", type: h }, { name: "type", def: "ro", operation: "setColTypes", type: g }, { name: "options", def: "", operation: "", type: a }]; dhtmlx.extend_api("dhtmlXGridObject", { _init: function(n) { return [n.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(s) { for (var n = 0; n < c.length; n++) { var r = []; for (var o = 0; o < s.length; o++) { r[o] = s[o][c[n].name] || c[n].def } var q = c[n].type || m; q.call(this, c[n].operation, r, s) } this.init() }, rows: function(n) {}, headers: function(o) { for (var n = 0; n < o.length; n++) { this.attachHeader(o[n]) } } }) })(); dhtmlXGridObject.prototype._dp_init = function(a) { a.attachEvent("insertCallback", function(c, h) { if (this.obj._h2) { this.obj.addRow(h, g, null, parent) } else { this.obj.addRow(h, [], 0) } var g = this.obj.getRowById(h); if (g) { this.obj._process_xml_row(g, c.firstChild); this.obj._postRowProcessing(g) } }); a.attachEvent("updateCallback", function(c, h) { var g = this.obj.getRowById(h); if (g) { this.obj._process_xml_row(g, c.firstChild); this.obj._postRowProcessing(g) } }); a.attachEvent("deleteCallback", function(c, g) { this.obj.setUserData(g, this.action_param, "true_deleted"); this.obj.deleteRow(g) }); a._methods = ["setRowTextStyle", "setCellTextStyle", "changeRowId", "deleteRow"]; this.attachEvent("onEditCell", function(h, l, g) { if (a._columns && !a._columns[g]) { return true } var c = this.cells(l, g); if (h == 1) { if (c.isCheckbox()) { a.setUpdated(l, true) } } else { if (h == 2) { if (c.wasChanged()) { a.setUpdated(l, 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(h, c) { var g = a.findRow(h); if (g < a.updatedRows.length) { a.updatedRows[g] = c } }); this.attachEvent("onSelectStateChanged", function(c) { if (a.updateMode == "row") { a.sendData() } return true }); this.attachEvent("onEnter", function(g, c) { if (a.updateMode == "row") { a.sendData() } return true }); this.attachEvent("onBeforeRowDeleted", function(c) { if (!this.rowsAr[c]) { return true } if (this.dragContext && a.dnd) { window.setTimeout(function() { a.setUpdated(c, true) }, 1); return true } var g = a.getState(c); if (this._h2) { this._h2.forEachChild(c, function(h) { a.setUpdated(h.id, false); a.markRow(h.id, true, "deleted") }, this) } if (g == "inserted") { a.set_invalid(c, false); a.setUpdated(c, false); return true } if (g == "deleted") { return false } if (g == "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(h, u) { var n = []; n.gr_id = h; if (this.obj.isTreeGrid()) { n.gr_pid = this.obj.getParentId(h) } var g = this.obj.getRowById(h); for (var o = 0; o < this.obj._cCount; o++) { if (this.obj._c_order) { var q = this.obj._c_order[o] } else { var q = o } var s = this.obj.cells(g.idd, o); if (this._changed && !s.wasChanged()) { continue } if (this._endnm) { n[this.obj.getColumnId(o)] = s.getValue() } else { n["c" + q] = s.getValue() } } var l = this.obj.UserData[h]; if (l) { for (var m = 0; m < l.keys.length; m++) { if (l.keys[m] && l.keys[m].indexOf("__") != 0) { n[l.keys[m]] = l.values[m] } } } var l = this.obj.UserData.gridglobaluserdata; if (l) { for (var m = 0; m < l.keys.length; m++) { n[l.keys[m]] = l.values[m] } } return n }; a._clearUpdateFlag = function(g) { var h = this.obj.getRowById(g); if (h) { for (var c = 0; c < this.obj._cCount; c++) { this.obj.cells(g, c).cell.wasChanged = false } } }; a.checkBeforeUpdate = function(m) { var l = true; var c = []; for (var h = 0; h < this.obj._cCount; h++) { if (this.mandatoryFields[h]) { var g = this.mandatoryFields[h].call(this.obj, this.obj.cells(m, h).getValue(), m, h); if (typeof g == "string") { this.messages.push(g); l = false } else { l &= g; c[h] = !g } } } if (!l) { this.set_invalid(m, "invalid", c); this.setUpdated(m, false) } return l } }; 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.firstChild) && (this.cell.firstChild.tagName == "TEXTAREA")) { return this.cell.firstChild.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() { if (this.cell.bgColor) { return this.cell.bgColor } else { return "#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.bgColor = 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(h) { var a = h; var g = 0; var c = 0; while (a.tagName != "BODY") { g += a.offsetLeft; c += a.offsetTop; a = a.offsetParent } return new Array(g, 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) && (_isKHTML || _isMacOS || _isFF)) ? "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(l) { (l || event).cancelBubble = true }; var g = this.grid.getPosition(this.cell); this.obj.value = this.val; this.obj.style.display = ""; this.obj.style.textAlign = this.cell.style.textAlign; if (_isFF) { var c = document.createElement("DIV"); c.appendChild(this.obj); c.style.overflow = "auto"; c.className = "dhx_textarea"; this.obj.style.margin = "0px 0px 0px 0px"; this.obj.style.border = "0px"; this.obj = c } document.body.appendChild(this.obj); if (_isOpera) { this.obj.onkeypress = function(l) { if (l.keyCode == 9) { return false } } } this.obj.onkeydown = function(m) { var l = (m || event); if (l.keyCode == 9) { globalActiveDHTMLGridObject.entBox.focus(); globalActiveDHTMLGridObject.doKey({ keyCode: l.keyCode, shiftKey: l.shiftKey, srcElement: "0" }); return false } }; this.obj.style.left = g[0] + "px"; this.obj.style.top = g[1] + this.cell.offsetHeight + "px"; if (this.cell.offsetWidth < 200) { var h = 200 } else { var h = this.cell.offsetWidth } this.obj.style.width = h + (_isFF ? 18 : 16) + "px"; if (_isFF) { this.obj.firstChild.style.width = parseInt(this.obj.style.width) + "px"; this.obj.firstChild.style.height = this.obj.offsetHeight - 3 + "px" } if (_isIE) { this.obj.select(); this.obj.value = this.obj.value } if (_isFF) { this.obj.firstChild.focus() } else { this.obj.focus() } }; this.detach = function() { var c = ""; if (_isFF) { c = this.obj.firstChild.value } else { 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) { if (_isFF) { return this.obj.firstChild.value } else { 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 h = this.grid.getPosition(this.cell); this.obj = document.createElement("TEXTAREA"); this.obj.className = "dhx_combo_edit"; this.obj.style.height = (this.cell.offsetHeight - 4) + "px"; this.obj.wrap = "soft"; this.obj.style.textAlign = this.cell.style.textAlign; this.obj.onclick = function(q) { (q || event).cancelBubble = true }; this.obj.onmousedown = function(q) { (q || event).cancelBubble = true }; this.obj.value = this.text; this.obj.onselectstart = function(q) { if (!q) { q = event } q.cancelBubble = true; return true }; var m = this; this.obj.onkeyup = function(s) { var r = (s || event).keyCode; if (r == 38 || r == 40 || r == 9) { return } var u = this.readonly ? String.fromCharCode(r) : this.value; var v = m.list.options; for (var q = 0; q < v.length; q++) { if (v[q].text.indexOf(u) == 0) { return v[q].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 = h[0] + "px"; this.list.style.top = h[1] + this.cell.offsetHeight + "px"; this.list.onclick = function(s) { var r = s || window.event; var q = r.target || r.srcElement; if (q.tagName == "OPTION") { q = q.parentNode } m.editable = false; m.grid.editStop(); r.cancelBubble = true }; var c = this.combo.getKeys(); var l = false; var o = 0; for (var g = 0; g < c.length; g++) { var n = this.combo.get(c[g]); this.list.options[this.list.options.length] = new Option(n, c[g]); if (c[g] == this.val) { o = this.list.options.length - 1; l = true } } if (l == false) { this.list.options[this.list.options.length] = new Option(this.text, this.val === null ? "" : this.val); o = 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[o].selected = true; if ((!_isFF) || (this.editable)) { this.obj.focus(); this.obj.focus() } if (!this.editable) { this.obj.style.visibility = "hidden"; this.list.focus(); this.list.onkeydown = function(q) { q = q || window.event; m.grid.setActive(true); if (q.keyCode < 30) { return m.grid.doKey({ target: m.cell, keyCode: q.keyCode, shiftKey: q.shiftKey, ctrlKey: q.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 g = (this.cell._combo || this.grid.getCombo(this.cell._cellIndex)); var h = g.values._dhx_find(this.obj.value); if (h != -1) { this.setValue(g.keys[h]) } 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(h) { if (typeof(h) == "object") { var g = this.grid.xmlLoader.doXPath("./option", h); if (g.length) { this.cell._combo = new dhtmlXGridComboObject() } for (var c = 0; c < g.length; c++) { this.cell._combo.put(g[c].getAttribute("value"), g[c].firstChild ? g[c].firstChild.data : "") } h = h.firstChild.data } if ((h || "").toString()._dhx_trim() == "") { h = null } this.cell.combo_value = h; if (h !== null) { var a = (this.cell._combo || this.grid.getCombo(this.cell._cellIndex)).get(h); this.setCValue(a === null ? h : a, h) } else { this.setCValue(" ", h) } }; 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(g) { if (typeof(g) == "object") { var c = this.grid.xmlLoader.doXPath("./option", g); 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 : "") } g = g.firstChild.data } if ((g || "").toString()._dhx_trim() == "") { g = null } if (g !== null) { this.setCTxtValue((this.cell._combo || this.grid.getCombo(this.cell._cellIndex)).get(g) || g, g) } else { this.setCTxtValue(" ", g) } this.cell.combo_value = g }; 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 g = this.grid.getPosition(this.cell); this.colorPanel(4, this.obj); document.body.appendChild(this.obj); this.obj.style.left = g[0] + "px"; this.obj.style.zIndex = 1000; this.obj.style.top = g[1] + this.cell.offsetHeight + "px" }; this.toolDNum = function(g) { if (g.length == 1) { g = "0" + g } return g }; this.colorPanel = function(s, w) { var o = document.createElement("TABLE"); w.appendChild(o); o.cellSpacing = 0; o.editor_obj = this; o.style.cursor = "default"; o.onclick = function(y) { var x = y || window.event; var n = x.target || x.srcElement; var r = n.parentNode.parentNode.parentNode.editor_obj; r.setValue(n._bg); r.grid.editStop() }; var l = 256 / s; for (var m = 0; m <= (256 / l); m++) { var g = o.insertRow(m); for (var q = 0; q <= (256 / l); q++) { for (var h = 0; h <= (256 / l); h++) { R = new Number(l * m) - (m == 0 ? 0 : 1); G = new Number(l * q) - (q == 0 ? 0 : 1); B = new Number(l * h) - (h == 0 ? 0 : 1); var v = this.toolDNum(R.toString(16)) + "" + this.toolDNum(G.toString(16)) + "" + this.toolDNum(B.toString(16)); var u = g.insertCell(q); 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 g = this.cell.firstChild.firstChild.src + (this.cell.titFl != null ? "^" + this.cell._brval : ""); g += "^" + this.cell.lnk; if (this.cell.trg) { g += "^" + this.cell.trg } return g } } }; this.isDisabled = function() { return true } } eXcell_img.prototype = new eXcell; eXcell_img.prototype.getTitle = function() { return this.cell._brval }; eXcell_img.prototype.setValue = function(g) { var c = g; if ((g || "").indexOf("^") != -1) { var a = g.split("^"); g = 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" } this.setCValue("", g); 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(g) { if (!g || isNaN(Number(g))) { if (g !== "") { g = 0 } } if (g > 0) { var c = "green"; var a = "dyn_up.gif" } else { if (g == 0) { var c = "black"; var a = "dyn_.gif" } else { var c = "red"; var a = "dyn_down.gif" } } this.setCValue("
" + g + "
", g) }; 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.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._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, g) { for (var a = 0; a < this.keys.length; a++) { if (this.keys[a] == c) { this.values[a] = g; return true } } this.values[this.values.length] = g; 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; dhtmlXGridObject.prototype.enableDragAndDrop = function(a) { if (a == "temporary_disabled") { this.dADTempOff = false; a = true } else { this.dADTempOff = true } this.dragAndDropOff = convertStringToBoolean(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 = convertStringToBoolean(a) }; dhtmlXGridObject.prototype._checkParent = function(h, c) { var g = this._h2.get[h.idd].parent; if (!g.parent) { return } for (var a = 0; a < c.length; a++) { if (c[a] == g.id) { return true } } return this._checkParent(this.rowsAr[g.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 o = this.callEvent("onBeforeDrag", [g.parentNode.idd, g._cellIndex, h]); if (!o) { return null } var l = new Array(); l = this.getSelectedId(); l = (((l) && (l != "")) ? l.split(this.delim) : []); var m = false; for (var c = 0; c < l.length; c++) { if (l[c] == g.parentNode.idd) { m = true } } if (!m) { this.selectRow(this.rowsAr[g.parentNode.idd], false, h.ctrlKey, false); if (!h.ctrlKey) { l = [] } l[this.selMultiRows ? l.length : 0] = g.parentNode.idd } if (this.isTreeGrid()) { for (var c = l.length - 1; c >= 0; c--) { if (this._checkParent(this.rowsAr[l[c]], l)) { l.splice(c, 1) } } } var q = this; if (l.length && this._dndorder) { l.sort(function(s, r) { return (q.rowsAr[s].rowIndex > q.rowsAr[r].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 < l.length; c++) { if (this.rowsAr[l[c]]) { this._dragged[this._dragged.length] = this.rowsAr[l[c]]; this.rowsAr[l[c]].treeNod = this } } g.parentObject.parentNode = g.parentNode; var n = document.createElement("div"); n.innerHTML = (o !== true ? o : this.rowToDragElement(g.parentNode.idd)); n.style.position = "absolute"; n.className = "dragSpanDiv"; return n }; dhtmlXGridObject.prototype._createSdrgc = function() { this._sdrgc = document.createElement("DIV"); this._sdrgc.innerHTML = " "; this._sdrgc.className = "gridDragLine"; this.objBox.appendChild(this._sdrgc) }; function dragContext(w, v, u, s, r, q, n, o, m, g) { this.source = w || "grid"; this.target = v || "grid"; this.mode = u || "move"; this.dropmode = s || "child"; this.sid = r || 0; this.tid = q; 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(g, c) { this[g] = c; return this }; dragContext.prototype.uid = function(g, 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 g = this.tobj._h2.get[c.nextSibling.idd].parent.id; if (g == this.tid) { return this.tid } if (g != a) { return g } } 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(s, l, r, u) { if (this._realfake) { return this._fake._drag() } var q = (this.lastLanding); if (this._autoOpenTimer) { window.clearTimeout(this._autoOpenTimer) } var h = r.parentNode; var g = s.parentObject; if (!h.idd) { h.grid = this; this.dadmodefix = 0 } var o = new dragContext(0, 0, 0, ((h.grid.dadmode == 1 || h.grid.dadmodec) ? "sibling" : "child")); if (g && g.childNodes) { o.set("source", "tree").set("sobj", g.treeNod).set("sid", o.sobj._dragged) } else { if (!g) { return true } if (g.treeNod.isTreeGrid && g.treeNod.isTreeGrid()) { o.set("source", "treeGrid") } o.set("sobj", g.treeNod).set("sid", o.sobj._dragged) } if (h.grid.isTreeGrid()) { o.set("target", "treeGrid") } else { o.set("dropmode", "sibling") } o.set("tobj", h.grid).set("tid", h.idd); if (((o.tobj.dadmode == 2) && (o.tobj.dadmodec == 1)) && (o.tobj.dadmodefix < 0)) { if (o.tobj.obj.rows[1].idd != o.tid) { o.tid = h.previousSibling.idd } else { o.tid = 0 } } var a = this.getFirstParentOfType(u, "TD"); if (a) { o.set("tExtra", a._cellIndex) } if (a) { o.set("sExtra", o.sobj._dndExtra) } if (o.sobj.dpcpy) { o.set("mode", "copy") } if (o.tobj._realfake) { o.tobj = o.tobj._fake } if (o.sobj._realfake) { o.sobj = o.sobj._fake } o.tobj._clearMove(); if (g && g.treeNod && g.treeNod._nonTrivialRow) { g.treeNod._nonTrivialRow(this, o.tid, o.dropmode, g) } else { o.tobj.dragContext = o; if (!o.tobj.callEvent("onDrag", [o.slist(), o.tid, o.sobj, o.tobj, o.sExtra, o.tExtra])) { return o.tobj.dragContext = null } var v = new Array(); if (typeof(o.sid) == "object") { var n = o.copy(); for (var m = 0; m < o.sid.length; m++) { if (!n.set("alfa", (!m)).set("sid", o.sid[m][(o.source == "tree" ? "id" : "idd")]).valid()) { continue } n.tobj._dragRoutine(n); if (n.target == "treeGrid" && n.dropmode == "child") { n.tobj.openItem(n.tid) } v[v.length] = n.nid; n.set("dropmode", "sibling").set("tid", n.nid) } n.close() } else { o.tobj._dragRoutine(o) } if (o.tobj.laterLink) { o.tobj.laterLink() } o.tobj.callEvent("onDrop", [o.slist(), o.tid, v.join(","), o.sobj, o.tobj, o.sExtra, o.tExtra]) } o.tobj.dragContext = null; o.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 q = s.sobj.rowsAr[s.sid]; var r = s.sobj.rowsCol._dhx_find(q); s.sobj.rowsCol._dhx_removeAt(s.sobj.rowsCol._dhx_find(q)); s.sobj.rowsBuffer._dhx_removeAt(s.sobj.rowsBuffer._dhx_find(q)); s.sobj.rowsBuffer._dhx_insertAt(s.ind(), q); 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(q, s.ind()); s.nid = s.sid; s.sobj.callEvent("onGridReconstructed", []); return } var o; 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); o = s.uid().tobj.addRowBefore(s.nid, s.data(), this._h2.get[s.tid].childs[0].id, s.img(), s.childs()) } else { o = s.uid().tobj.addRowAfter(s.nid, s.data(), s.tid, s.img(), s.childs()) } } else { o = s.uid().tobj.addRow(s.nid, s.data(), s.ind(), s.pid(), s.img(), s.childs()) } o._attrs = s.attrs(); if (s.source == "tree") { this.callEvent("onRowAdded", [s.nid]); var a = s.sobj._globalIdStorageFind(s.sid); if (a.childsCount) { var n = s.copy().set("tid", s.nid).set("dropmode", s.target == "grid" ? "sibling" : "child"); for (var h = 0; h < a.childsCount; h++) { s.tobj._dragRoutine(n.set("sid", a.childNodes[h].id)); if (s.mode == "move") { h-- } } n.close() } } else { s.tobj._copyUserData(s); this.callEvent("onRowAdded", [s.nid]); if ((s.source == "treeGrid")) { if (s.sobj == s.tobj) { o._xml = s.sobj.rowsAr[s.sid]._xml } var m = s.sobj._h2.get[s.sid]; if ((m) && (m.childs.length)) { var n = s.copy().set("tid", s.nid); if (s.target == "grid") { n.set("dropmode", "sibling") } else { n.tobj.openItem(s.tid); n.set("dropmode", "child") } var g = m.childs.length; for (var h = 0; h < g; h++) { s.sobj.render_row_tree(null, m.childs[h].id); s.tobj._dragRoutine(n.set("sid", m.childs[h].id)); if (g != m.childs.length) { h--; g = m.childs.length } } n.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(h, a, g) { var l = new Array(); for (var c = 0; c < a.hdr.rows[0].cells.length; c++) { l[c] = a.cells(h, c).getValue() } return l }; 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(l, g, c, m) { if (!this.dADTempOff) { return 0 } var a = this.isTreeGrid(); var h = g.parentNode.idd ? g.parentNode : g.parentObject; if (this._drag_validate) { if (l.parentNode == g.parentNode) { return 0 } if ((a) && (this == h.grid) && ((this.checkParentLine(this._h2.get[l.parentNode.idd], g.parentNode.idd)))) { return 0 } } if (!this.callEvent("onDragIn", [h.idd || h.id, l.parentNode.idd, h.grid || h.treeNod, (l.grid || l.parentNode.grid)])) { return this._setMove(l, c, m, true) } this._setMove(l, c, m); if ((a) && (l.parentNode.expand != "")) { this._autoOpenTimer = window.setTimeout(new callerFunction(this._autoOpenItem, this), 1000); this._autoOpenId = l.parentNode.idd } else { if (this._autoOpenTimer) { window.clearTimeout(this._autoOpenTimer) } } return l }; 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(m, c, o, l) { if (!m.parentNode.idd) { return } var g = getAbsoluteTop(m); var a = getAbsoluteTop(this.objBox); if ((g - a) > (parseInt(this.objBox.offsetHeight) - 50)) { this.objBox.scrollTop = parseInt(this.objBox.scrollTop) + 20 } if ((g - a + parseInt(this.objBox.scrollTop)) < (parseInt(this.objBox.scrollTop) + 30)) { this.objBox.scrollTop = parseInt(this.objBox.scrollTop) - 20 } if (l) { return 0 } if (this.dadmode == 2) { var n = o - g + (document.body.scrollTop || document.documentElement.scrollTop) - 2 - m.offsetHeight / 2; if ((Math.abs(n) - m.offsetHeight / 6) > 0) { this.dadmodec = 1; if (n < 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 = g - a + parseInt(this.objBox.scrollTop) + ((this.dadmodefix >= 0) ? m.offsetHeight : 0) + "px" } else { this._llSelD = m; if (m.parentNode.tagName == "TR") { for (var h = 0; h < m.parentNode.childNodes.length; h++) { var n = m.parentNode.childNodes[h]; n._bgCol = n.style.backgroundColor; n.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(h) { if (!h.tobj.UserData[h.nid] || h.tobj != h.sobj) { h.tobj.UserData[h.nid] = new Hashtable() } else { return } var g = h.sobj.UserData[h.sid]; var a = h.tobj.UserData[h.nid]; if (g) { a.keys = a.keys.concat(g.keys); a.values = a.values.concat(g.values) } }; dhtmlXGridObject.prototype.moveRow = function(g, h, a, c) { switch (h) { case "row_sibling": this.moveRowTo(g, a, "move", "sibling", this, c); break; case "up": this.moveRowUp(g); break; case "down": this.moveRowDown(g); break } }; dhtmlXGridObject.prototype._nonTrivialNode = function(s, r, n, o, g) { if ((s.callEvent) && (!g)) { if (!s.callEvent("onDrag", [o.idd, r.id, (n ? n.id : null), this, s])) { return false } } var q = o.idd; var a = q; while (s._idpull[a]) { a += (new Date()).getMilliseconds().toString() } var l = (this.isTreeGrid() ? this.getItemImage(q) : ""); if (n) { for (h = 0; h < r.childsCount; h++) { if (r.childNodes[h] == n) { break } } if (h != 0) { n = r.childNodes[h - 1] } else { st = "TOP"; n = "" } } var c = s._attachChildNode(r, a, this.gridToTreeElement(s, a, q), "", l, l, l, "", "", n); if (this._h2) { var m = this._h2.get[q]; if (m.childs.length) { for (var h = 0; h < m.childs.length; h++) { this._nonTrivialNode(s, c, 0, this.rowsAr[m.childs[h].id], 1); if (!this.dpcpy) { h-- } } } } if (!this.dpcpy) { this.deleteRow(q) } if ((s.callEvent) && (!g)) { s.callEvent("onDrop", [a, r.id, (n ? n.id : null), this, s]) } }; dhtmlXGridObject.prototype.gridToTreeElement = function(c, g, a) { return this.cells(a, 0).getValue() }; dhtmlXGridObject.prototype.treeToGridElement = function(h, l, a) { var c = new Array(); var m = this.cellType._dhx_find("tree"); if (m == -1) { m = 0 } for (var g = 0; g < this.getColumnCount(); g++) { c[c.length] = (g != m) ? (h.getUserData(l, this.getColumnId(g)) || "") : h.getItemText(l) } return c }; dhtmlXGridObject.prototype.moveRowTo = function(h, g, n, m, a, l) { var o = new dragContext((a || this).isTreeGrid() ? "treeGrid" : "grid", (l || this).isTreeGrid() ? "treeGrid" : "grid", n, m || "sibling", h, g, a || this, l || this); o.tobj._dragRoutine(o); o.close(); return o.nid }; dhtmlXGridObject.prototype.enableMercyDrag = function(a) { this.dpcpy = convertStringToBoolean(a) }; dhtmlXGridObject.prototype.toPDF = function(h, r, w, u, o, C) { var l = { row: this.getSelectedRowId(), col: this.getSelectedCellIndex() }; if (l.row === null || l.col === -1) { l = false } else { var c = this.cells(l.row, l.col).cell; c.parentNode.className = c.parentNode.className.replace(" rowselected", ""); c.className = c.className.replace(" cellselected", ""); l.el = c } r = r || "color"; var x = r == "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 = "$/, "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 += q(); return L } function g() { var D = []; if (o) { for (var E = 0; E < o.length; E++) { D.push(v(a.getRowIndex(o[E]))) } } else { for (var E = 0; E < a.getRowsNum(); E++) { D.push(v(E)) } } return D.join("\n") } function q() { 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 n(E, D) { return (window.getComputedStyle ? (window.getComputedStyle(E, null)[D]) : (E.currentStyle ? E.currentStyle[D] : null)) || "" } function v(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 = n(P.cell, "color"); var O = n(P.cell, "backgroundColor"); var N = n(P.cell, "font-weight") || n(P.cell, "fontWeight"); var K = n(P.cell, "font-style") || n(P.cell, "fontStyle"); var M = n(P.cell, "text-align") || n(P.cell, "textAlign"); var F = n(P.cell, "font-family") || n(P.cell, "fontFamily"); if (O == "transparent" || O == "rgba(0, 0, 0, 0)") { O = "rgb(255,255,255)" } L += "" } else { L += "" } L += "" } } return L + "" } function s() { var D = ""; return D } var y = document.createElement("div"); y.style.display = "none"; document.body.appendChild(y); var m = "form_" + a.uid(); y.innerHTML = '
'; document.getElementById(m).firstChild.value = encodeURIComponent(A(r).replace("\u2013", "-") + g() + s()); document.getElementById(m).submit(); y.parentNode.removeChild(y); a = null; if (l) { l.el.parentNode.className += " rowselected"; l.el.className += " cellselected" } l = null }; dhtmlXGridObject.prototype._serialiseExportConfig = function(m) { function l(r) { if (typeof(r) !== "string") { return r } r = r.replace(/&/g, "&"); r = r.replace(/"/g, """); r = r.replace(/'/g, "'"); r = r.replace(//g, ">"); return r } var c = ""; for (var g = 0; g < this.hdr.rows[0].cells.length; g++) { if (this._srClmn && !this._srClmn[g]) { continue } if (this._hrrar[g] && (!this._fake || g >= this._fake.hdrLabels.length)) { continue } var h = this.fldSort[g]; if (h == "cus") { h = this._customSorts[g].toString(); h = h.replace(/function[\ ]*/, "").replace(/\([^\f]*/, "") } var q = m[1][g]; var n = ((q[1] && q[1] > 1) ? ' rowspan="' + q[1] + '" ' : "") + ((q[0] && q[0] > 1) ? ' colspan="' + q[0] + '" ' : ""); c += "" } return c += "" }; if (window.eXcell_sub_row_grid) { window.eXcell_sub_row_grid.prototype.getContent = function() { return "" } } dhtmlXGridObject.prototype.toExcel = function(a, h, n, m, c) { if (!document.getElementById("ifr")) { var l = document.createElement("iframe"); l.style.display = "none"; l.setAttribute("name", "dhx_export_iframe"); l.setAttribute("src", ""); l.setAttribute("id", "dhx_export_iframe"); document.body.appendChild(l) } var g = ' target="dhx_export_iframe"'; this.toPDF(a, h, n, m, c, g) }; dhtmlXGridObject.prototype.filterBy = function(g, h, c) { if (this.isTreeGrid()) { return this.filterTreeBy(g, h, 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 l = true; this.dma(true); if (typeof(g) == "object") { for (var a = 0; a < h.length; a++) { this._filterA(g[a], h[a]) } } else { this._filterA(g, h) } 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, g) { if (g == "") { return } var h = true; if (typeof(g) == "function") { h = false } else { g = (g || "").toString().toLowerCase() } if (!this.rowsBuffer.length) { return } for (var a = this.rowsBuffer.length - 1; a >= 0; a--) { if (h ? (this._get_cell_value(this.rowsBuffer[a], c).toString().toLowerCase().indexOf(g) == -1) : (!g.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(h) { var r = this.callEvent("onCollectValues", [h]); if (r !== true) { return r } if (this.isTreeGrid()) { return this.collectTreeValues(h) } this.dma(true); this._build_m_order(); h = this._m_order ? this._m_order[h] : h; var o = {}; var m = []; var g = this._f_rowsBuffer || this.rowsBuffer; for (var l = 0; l < g.length; l++) { var a = this._get_cell_value(g[l], h); if (a && (!g[l]._childIndexes || g[l]._childIndexes[h] != g[l]._childIndexes[h - 1])) { o[a] = true } } this.dma(false); var q = (this.combos[h] || (this._col_combos ? this._col_combos[h] : false)); for (var n in o) { if (o[n] === true) { if (q) { if (q.get && q.get(n)) { n = q.get(n) } else { if (q.getOption && q.getOption(n)) { n = q.getOption(n).text } } } m.push(n) } } return m.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 g = []; var c = []; this._build_m_order(); for (var h = 0; h < this.filters.length; h++) { var m = this._m_order ? this._m_order[this.filters[h][1]] : this.filters[h][1]; if (m >= this._cCount) { continue } c.push(m); var n = this.filters[h][0].old_value = this.filters[h][0].value; if (this.filters[h][0]._filter) { n = this.filters[h][0]._filter() } var l; if (typeof n != "function" && (l = (this.combos[m] || (this._col_combos ? this._col_combos[m] : false)))) { if (l.values) { m = l.values._dhx_find(n); n = (m == -1) ? n : l.keys[m] } else { if (l.getOptionByLabel) { n = (l.getOptionByLabel(n) ? l.getOptionByLabel(n).value : n) } } } g.push(n) } if (!this.callEvent("onFilterStart", [c, g])) { return } this.filterBy(c, g); 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(l, g, c) { if (!this.filters) { this.filters = [] } if (typeof(l) != "object") { l = document.getElementById(l) } if (!l) { return } var a = this; if (!l.style.width) { l.style.width = "90%" } if (l.tagName == "SELECT") { this.filters.push([l, g]); this._loadSelectOptins(l, g); l.onchange = function() { a.filterByAll() }; if (_isIE) { l.style.marginTop = "1px" } this.attachEvent("onEditCell", function(n, m, o) { this._build_m_order(); if (n == 2 && this.filters && (this._m_order ? (o == this._m_order[g]) : (o == g))) { this._loadSelectOptins(l, g) } return true }) } else { if (l.tagName == "INPUT") { this.filters.push([l, g]); l.old_value = l.value = ""; l.onkeydown = function() { if (this._timer) { window.clearTimeout(this._timer) } this._timer = window.setTimeout(function() { if (l.value != l.old_value) { a.filterByAll(); l.old_value = l.value } }, 500) } } else { if (l.tagName == "DIV" && l.className == "combo") { this.filters.push([l, g]); l.style.padding = "0px"; l.style.margin = "0px"; if (!window.dhx_globalImgPath) { window.dhx_globalImgPath = this.imgURL } var h = new dhtmlXCombo(l, "_filter", "90%"); h.filterSelfA = h.filterSelf; h.filterSelf = function() { if (this.getSelectedIndex() == 0) { this.setComboText("") } this.filterSelfA.apply(this, arguments); this.optionsArr[0].hide(false) }; h.enableFilteringMode(true); l.combo = h; l.value = ""; this._loadComboOptins(l, g); h.attachEvent("onChange", function() { l.value = h.getSelectedValue(); if (l.value === null) { l.value = "" } a.filterByAll() }) } } } if (l.parentNode) { l.parentNode.className += " filter" } this._filters_ready() }; dhtmlXGridObject.prototype.findCell = function(m, n, h, l) { var l = l || (function(q, o) { return o.toString().toLowerCase().indexOf(q) != -1 }); if (l === true) { l = function(q, o) { return o.toString().toLowerCase() == q } } var g = new Array(); m = m.toString().toLowerCase(); if (typeof h != "number") { h = h ? 1 : 0 } if (!this.rowsBuffer.length) { return g } for (var c = (n || 0); c < this._cCount; c++) { if (this._h2) { this._h2.forEachChild(0, function(o) { if (h && g.length == h) { return g } if (l(m, this._get_cell_value(o.buff, c))) { g.push([o.id, c]) } }, this) } else { for (var a = 0; a < this.rowsBuffer.length; a++) { if (l(m, this._get_cell_value(this.rowsBuffer[a], c))) { g.push([this.rowsBuffer[a].idd, c]); if (h && g.length == h) { return g } } } } if (typeof(n) != "undefined") { return g } } return g }; dhtmlXGridObject.prototype.makeSearch = function(h, g, a) { if (typeof(h) != "object") { h = document.getElementById(h) } if (!h) { return } var c = this; if (h.tagName == "INPUT") { h.onkeypress = function() { if (this._timer) { window.clearTimeout(this._timer) } this._timer = window.setTimeout(function() { if (h.value == "") { return } var l = c.findCell(h.value, g, true, a); if (l.length) { if (c._h2) { c.openItem(l[0][0]) } c.selectCell(c.getRowIndex(l[0][0]), (g || 0)) } }, 500) } } if (h.parentNode) { h.parentNode.className += " filter" } }; dhtmlXGridObject.prototype._loadSelectOptins = function(m, o) { var a = this.collectValues(o); var g = m.value; m.innerHTML = ""; m.options[0] = new Option("", ""); var n = this._filter_tr ? this._filter_tr[o] : null; for (var h = 0; h < a.length; h++) { m.options[m.options.length] = new Option(n ? n(a[h]) : a[h], a[h]) } m.value = g }; dhtmlXGridObject.prototype.setSelectFilterLabel = function(c, a) { if (!this._filter_tr) { this._filter_tr = [] } this._filter_tr[c] = a }; dhtmlXGridObject.prototype._loadComboOptins = function(h, n) { if (!h.combo) { return } var a = this.collectValues(n); h.combo.clearAll(); var m = [ ["", ""] ]; for (var g = 0; g < a.length; g++) { m.push([a[g], a[g]]) } h.combo.addOption(m) }; 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(l, h) { if (this._f_rowsBuffer) { for (var g = 0; g < this._f_rowsBuffer.length; g++) { if (this._f_rowsBuffer[g].idd == l) { return this._f_rowsBuffer[g] = h } } } }); 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(g) { return (g.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(g, c) { g.innerHTML = ""; g.onclick = function(h) { (h || event).cancelBubble = true; return false }; this.makeFilter(g.firstChild, c); var a = this.combos; g.firstChild._filter = function() { var h = g.firstChild.value; if (!h) { return "" } if (a[c]) { h = a[c].keys[a[c].values._dhx_find(h)] } h = h.toLowerCase(); return function(l) { return (l.toString().toLowerCase() == h) } }; 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(g, c, a) { this._search_common(g, c); this.makeSearch(g.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 g = this.value; var l; var n = "=="; var h = parseFloat(g.replace("=", "")); var m = null; if (g) { if (g.indexOf("..") != -1) { g = g.split(".."); h = parseFloat(g[0]); m = parseFloat(g[1]); return function(o) { if (o >= h && o <= m) { return true } return false } } l = g.match(/>=|<=|>|" + l[1]; var a = this; h.getElementsByTagName("input")[0].onclick = function(m) { a._build_m_order(); var c = a._m_order ? a._m_order[g] : g; var n = this.checked ? 1 : 0; a.forEachRowA(function(q) { var o = this.cells(q, c); if (o.isCheckbox()) { o.setValue(n); o.cell.wasChanged = true } this.callEvent("onEditCell", [1, q, c, n]); this.callEvent("onCheckbox", [q, c, n]) }); (m || event).cancelBubble = true } }; dhtmlXGridObject.prototype._in_header_stat_total = function(g, a, l) { var h = function() { var o = 0; this._build_m_order(); var n = this._m_order ? this._m_order[a] : a; for (var m = 0; m < this.rowsBuffer.length; m++) { var c = parseFloat(this._get_cell_value(this.rowsBuffer[m], n)); o += isNaN(c) ? 0 : c } return this._maskArr[n] ? this._aplNF(o, n) : (Math.round(o * 100) / 100) }; this._stat_in_header(g, h, a, l, l) }; dhtmlXGridObject.prototype._in_header_stat_multi_total = function(l, h, q) { var o = q[1].split(":"); q[1] = ""; for (var g = 0; g < o.length; g++) { o[g] = parseInt(o[g]) } var m = function() { var u = 0; for (var s = 0; s < this.rowsBuffer.length; s++) { var r = 1; for (var c = 0; c < o.length; c++) { r *= parseFloat(this._get_cell_value(this.rowsBuffer[s], o[c])) } u += isNaN(r) ? 0 : r } return this._maskArr[h] ? this._aplNF(u, h) : (Math.round(u * 100) / 100) }; var a = []; for (var n = 0; n < o.length; n++) { a[o[n]] = true } this._stat_in_header(l, m, a, q, q) }; dhtmlXGridObject.prototype._in_header_stat_max = function(g, a, l) { var h = function() { this._build_m_order(); var m = this._m_order ? this._m_order[a] : a; var n = -999999999; if (this.getRowsNum() == 0) { return " " } for (var c = 0; c < this.rowsBuffer.length; c++) { n = Math.max(n, parseFloat(this._get_cell_value(this.rowsBuffer[c], m))) } return this._maskArr[a] ? this._aplNF(n, a) : n }; this._stat_in_header(g, h, a, l) }; dhtmlXGridObject.prototype._in_header_stat_min = function(g, a, l) { var h = function() { this._build_m_order(); var m = this._m_order ? this._m_order[a] : a; var n = 999999999; if (this.getRowsNum() == 0) { return " " } for (var c = 0; c < this.rowsBuffer.length; c++) { n = Math.min(n, parseFloat(this._get_cell_value(this.rowsBuffer[c], m))) } return this._maskArr[a] ? this._aplNF(n, a) : n }; this._stat_in_header(g, h, a, l) }; dhtmlXGridObject.prototype._in_header_stat_average = function(g, a, l) { var h = function() { this._build_m_order(); var n = this._m_order ? this._m_order[a] : a; var q = 0; var o = 0; if (this.getRowsNum() == 0) { return " " } for (var m = 0; m < this.rowsBuffer.length; m++) { var c = parseFloat(this._get_cell_value(this.rowsBuffer[m], n)); q += isNaN(c) ? 0 : c; o++ } return this._maskArr[a] ? this._aplNF(q / o, a) : (Math.round(q / o * 100) / 100) }; this._stat_in_header(g, h, a, l) }; dhtmlXGridObject.prototype._in_header_stat_count = function(g, a, l) { var h = function() { return this.getRowsNum() }; this._stat_in_header(g, h, a, l) }; dhtmlXGridObject.prototype._stat_in_header = function(g, h, a, n) { var l = this; var m = function() { this.dma(true); g.innerHTML = (n[0] ? n[0] : "") + h.call(this) + (n[1] ? n[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 o = 0; o < this._stat_events.length; o++) { for (var c = 0; c < 4; c++) { this.detachEvent(this._stat_events[o][c]) } } this._stat_events = [] } }) } this._stat_events.push([this.attachEvent("onGridReconstructed", m), this.attachEvent("onXLE", m), this.attachEvent("onFilterEnd", m), this.attachEvent("onEditCell", function(c, q, o) { if (c == 2 && (o == a || (a && a[o]))) { m.call(this) } return true })]); g.innerHTML = "" }; dhtmlXGridObject.prototype.loadCSVFile = function(c, a) { this.load(c, a, "csv") }; dhtmlXGridObject.prototype.enableCSVAutoID = function(a) { this._csvAID = convertStringToBoolean(a) }; dhtmlXGridObject.prototype.enableCSVHeader = function(a) { this._csvHdr = convertStringToBoolean(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(o) { this.editStop(); if (this._mathSerialization) { this._agetm = "getMathValue" } else { if (this._strictText || o) { this._agetm = "getTitle" } else { this._agetm = "getValue" } } var m = []; if (this._csvHdr) { for (var l = 1; l < this.hdr.rows.length; l++) { var c = []; for (var n = 0; n < this._cCount; n++) { if ((!this._srClmn) || (this._srClmn[n])) { c.push(this.getColumnLabel(n, l - 1)) } } m.push(this.csvParser.str(c, this.csv.cell, this.csv.row)) } } var n = 0; var h = this.rowsBuffer.length; for (n; n < h; n++) { var g = this._serializeRowToCVS(null, n); if (g != "") { m.push(g) } } return this.csvParser.block(m, this.csv.row) }; dhtmlXGridObject.prototype._serializeRowToCVS = function(a, q, g, n) { var o = new Array(); if (!a) { a = this.render_row(q); if (this._fake && !this._fake.rowsAr[a.idd]) { this._fake.render_row(q) } } if (!this._csvAID) { o[o.length] = a.idd } g = g || 0; n = n || this._cCount; var v = false; var h = g; while (a.childNodes[g]._cellIndex > h && g) { g-- } for (var s = g; h < n; s++) { if (!a.childNodes[s]) { break } var c = a.childNodes[s]._cellIndex; if (((!this._srClmn) || (this._srClmn[c])) && (!this._serialize_visible || !this._hrrar[c])) { var l = a.childNodes[s]; var m = this.cells(a.idd, c); while (h != c) { h++; o.push(""); if (h >= n) { break } } if (h >= n) { break } h++; if (m.cell) { zxVal = m[this._agetm]() } else { zxVal = "" } if ((this._chAttr) && (m.wasChanged())) { v = true } o[o.length] = ((zxVal === null) ? "" : zxVal); if (this._ecspn && l.colSpan && l.colSpan > 1) { l = l.colSpan - 1; for (var w = 0; w < l; w++) { o[o.length] = ""; h++ } } } else { h++ } } if ((this._onlChAttr) && (!v)) { return "" } return this.csvParser.str(o, 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(g, c) { if ((!g) || (!c)) { if (!this.selectedRows[0]) { return } g = this.selectedRows[0].idd; c = this.cell._cellIndex } var a = this.cells(g, c); this.toClipBoard(((a.getLabel ? a.getLabel() : a.getValue()) || "").toString()) }; dhtmlXGridObject.prototype.updateCellFromClipboard = function(g, c) { if ((!g) || (!c)) { if (!this.selectedRows[0]) { return } g = this.selectedRows[0].idd; c = this.cell._cellIndex } var a = this.cells(g, c); a[a.setImage ? "setLabel" : "setValue"](this.fromClipBoard()) }; dhtmlXGridObject.prototype.rowToClipboard = function(h) { var a = ""; if (this._mathSerialization) { this._agetm = "getMathValue" } else { if (this._strictText) { this._agetm = "getTitle" } else { this._agetm = "getValue" } } this._serialize_visible = true; if (h) { a = this._serializeRowToCVS(this.getRowById(h)) } else { var g = []; for (var c = 0; c < this.selectedRows.length; c++) { g[g.length] = this._serializeRowToCVS(this.selectedRows[c]); a = this.csvParser.block(g, this.csv.row) } } this._serialize_visible = false; this.toClipBoard(a) }; dhtmlXGridObject.prototype.updateRowFromClipboard = function(l) { var a = this.fromClipBoard(); if (!a) { return } if (l) { var h = this.getRowById(l) } else { var h = this.selectedRows[0] } if (!h) { return } var m = this.csvParser; a = m.unblock(a, this.csv.cell, this.csv.row)[0]; if (!this._csvAID) { a.splice(0, 1) } for (var g = 0; g < a.length; g++) { var c = this.cells3(h, g); c[c.setImage ? "setLabel" : "setValue"](a[g]) } }; dhtmlXGridObject.prototype.csvParser = { block: function(a, c) { return a.join(c) }, unblock: function(m, a, l) { var h = (m || "").split(l); for (var c = 0; c < h.length; c++) { h[c] = (h[c] || "").split(a) } var g = h.length - 1; if (h[g].length == 1 && h[g][0] == "") { h.splice(g, 1) } return h }, str: function(c, a, g) { return c.join(a) } }; dhtmlXGridObject.prototype.csvExtParser = { _quote: RegExp('"', "g"), _quote_esc: RegExp('\\\\"', "g"), block: function(a, c) { return a.join(c) }, unblock: function(o, s, v) { var g = [ [] ]; var c = 0; if (!o) { return g } var q = /^[ ]*"/; var n = /"[ ]*$/; var a = new RegExp(".*" + v + ".*$"); var l = o.split(s); for (var h = 0; h < l.length; h++) { if (l[h].match(q)) { var u = l[h].replace(q, ""); while (!l[h].match(n)) { h++; u += l[h] } g[c].push(u.replace(n, "").replace(this._quote_esc, '"')) } else { if (l[h].match(a)) { var m = l[h].indexOf(v); g[c].push(l[h].substr(0, m)); c++; g[c] = []; l[h] = l[h].substr(m + 1); h-- } else { if (l[h] || h != l.length - 1) { g[c].push(l[h]) } } } } var r = g.length - 1; if (r > 0 && !g[r].length) { g.splice(r, 1) } return g }, str: function(g, a, h) { for (var c = 0; c < g.length; c++) { g[c] = '"' + g[c].replace(this._quote, '\\"') + '"' } return g.join(a) } }; dhtmlXGridObject.prototype.addRowFromClipboard = function() { var a = this.fromClipBoard(); if (!a) { return } var g = this.csvParser.unblock(a, this.csv.cell, this.csv.row); for (var c = 0; c < g.length; c++) { if (g[c]) { a = g[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(n) { if (!this.xslform) { this.xslform = document.createElement("FORM"); this.xslform.action = (n || "") + "xls.php"; this.xslform.method = "post"; this.xslform.target = (_isIE ? "_blank" : ""); document.body.appendChild(this.xslform); var m = document.createElement("INPUT"); m.type = "hidden"; m.name = "csv"; this.xslform.appendChild(m); var h = document.createElement("INPUT"); h.type = "hidden"; h.name = "csv_header"; this.xslform.appendChild(h) } var o = this.serializeToCSV(); this.xslform.childNodes[0].value = o; var g = []; var a = this._cCount; for (var c = 0; c < a; c++) { g.push(this.getHeaderCol(c)) } g = g.join(","); this.xslform.childNodes[1].value = g; this.xslform.submit() }; dhtmlXGridObject.prototype.printView = function(s, g) { var q = ""; var C = null; if (this._fake) { C = [].concat(this._hrrar); for (var A = 0; A < this._fake._cCount; A++) { this._hrrar[A] = null } } q += ""; if (!this.parentGrid) { q += (s || "") } q += ''; var r = Math.max(this.rowsBuffer.length, this.rowsCol.length); var o = this._cCount; var u = this._printWidth(); q += ''; for (var A = 0; A < o; A++) { if (this._hrrar && this._hrrar[A]) { continue } var l = this.hdr.rows[1].cells[this.hdr.rows[1]._childIndexes ? this.hdr.rows[1]._childIndexes[parseInt(A)] : A]; var a = (l.colSpan || 1); var H = (l.rowSpan || 1); for (var y = 1; y < a; y++) { u[A] += u[y] } q += '"; A += a - 1 } q += ""; for (var A = 2; A < this.hdr.rows.length; A++) { if (_isIE) { q += ""; var h = this.hdr.rows[A].childNodes; for (var y = 0; y < h.length; y++) { if (!this._hrrar || !this._hrrar[h[y]._cellIndex]) { q += h[y].outerHTML } } q += "" } else { q += "" + (this._fake ? this._fake.hdr.rows[A].innerHTML : "") + this.hdr.rows[A].innerHTML + "" } } for (var A = 0; A < r; A++) { q += ""; if (this.rowsCol[A] && this.rowsCol[A]._cntr) { q += this.rowsCol[A].innerHTML.replace(/]*>/gi, "") + ""; continue } if (this.rowsCol[A] && this.rowsCol[A].style.display == "none") { continue } var n; if (this.rowsCol[A]) { n = this.rowsCol[A].idd } else { if (this.rowsBuffer[A]) { n = this.rowsBuffer[A].idd } else { continue } } for (var y = 0; y < o; y++) { if (this._hrrar && this._hrrar[y]) { continue } if (this.rowsAr[n] && this.rowsAr[n].tagName == "TR") { var F = this.cells(n, 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"); q += '"; if (D) { y += D - 1 } } q += ""; if (this.rowsCol[A] && this.rowsCol[A]._expanded) { var m = this.cells4(this.rowsCol[A]._expanded.ctrl); if (m.getSubGrid) { q += '" } else { q += '" } } } if (this.ftr) { for (var A = 1; A < this.ftr.childNodes[0].rows.length; A++) { q += "" + ((this._fake) ? this._fake.ftr.childNodes[0].rows[A].innerHTML : "") + this.ftr.childNodes[0].rows[A].innerHTML + "" } } q += "
' + this.getHeaderCol(A) + "
" + (v === "" ? " " : v) + "
' + m.getSubGrid().printView() + "
' + this.rowsCol[A]._expanded.innerHTML + "
"; if (this.parentGrid) { return q } q += (g || ""); var E = window.open("", "_blank"); E.document.write(q); E.document.write("