/* Product Name: dhtmlxSuite Version: 5.2.0 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.dhx) == "undefined") { window.dhx = window.dhx4 = { version: "5.2.0", skin: null, skinDetect: function(a) { var c = Math.floor(dhx4.readFromCss(a + "_skin_detect") / 10) * 10; return { 10: "dhx_skyblue", 20: "dhx_web", 30: "dhx_terrace", 40: "material" }[c] || null }, readFromCss: function(e, g, h) { var c = document.createElement("DIV"); c.className = e; if (document.body.firstChild != null) { document.body.insertBefore(c, document.body.firstChild) } else { document.body.appendChild(c) } if (typeof(h) == "string") { c.innerHTML = h } var a = c[g || "offsetWidth"]; c.parentNode.removeChild(c); c = null; return a }, lastId: 1, newId: function() { return this.lastId++ }, zim: { data: {}, step: 5, first: function() { return 100 }, last: function() { var e = this.first(); for (var c in this.data) { e = Math.max(e, this.data[c]) } return e }, reserve: function(a) { this.data[a] = this.last() + this.step; return this.data[a] }, clear: function(a) { if (this.data[a] != null) { this.data[a] = null; delete this.data[a] } } }, s2b: function(a) { if (typeof(a) == "string") { a = a.toLowerCase() } return (a == true || a == 1 || a == "true" || a == "1" || a == "yes" || a == "y" || a == "on") }, s2j: function(s) { var obj = null; dhx4.temp = null; try { eval("dhx4.temp=" + s) } catch (e) { dhx4.temp = null } obj = dhx4.temp; dhx4.temp = null; return obj }, absLeft: function(a) { if (typeof(a) == "string") { a = document.getElementById(a) } return this.getOffset(a).left }, absTop: function(a) { if (typeof(a) == "string") { a = document.getElementById(a) } return this.getOffset(a).top }, _aOfs: function(a) { var e = 0, c = 0; while (a) { e = e + parseInt(a.offsetTop); c = c + parseInt(a.offsetLeft); a = a.offsetParent } return { top: e, left: c } }, _aOfsRect: function(g) { var m = g.getBoundingClientRect(); var n = document.body; var c = document.documentElement; var a = window.pageYOffset || c.scrollTop || n.scrollTop; var h = window.pageXOffset || c.scrollLeft || n.scrollLeft; var l = c.clientTop || n.clientTop || 0; var o = c.clientLeft || n.clientLeft || 0; var q = m.top + a - l; var e = m.left + h - o; return { top: Math.round(q), left: Math.round(e) } }, getOffset: function(a) { if (a.getBoundingClientRect) { return this._aOfsRect(a) } else { return this._aOfs(a) } }, _isObj: function(a) { return (a != null && typeof(a) == "object" && typeof(a.length) == "undefined") }, _copyObj: function(g) { if (this._isObj(g)) { var e = {}; for (var c in g) { if (typeof(g[c]) == "object" && g[c] != null) { e[c] = this._copyObj(g[c]) } else { e[c] = g[c] } } } else { var e = []; for (var c = 0; c < g.length; c++) { if (typeof(g[c]) == "object" && g[c] != null) { e[c] = this._copyObj(g[c]) } else { e[c] = g[c] } } } return e }, 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 e = { MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd", OTransition: "oTransitionEnd", msTransition: "transitionend", transition: "transitionend" }; for (var c in e) { if (this.transData.transProp == false && document.documentElement.style[c] != null) { this.transData.transProp = c; this.transData.transEv = e[c] } } e = null } return this.transData }, _xmlNodeValue: function(a) { var e = ""; for (var c = 0; c < a.childNodes.length; c++) { e += (a.childNodes[c].nodeValue != null ? a.childNodes[c].nodeValue.toString().replace(/^[\n\r\s]{0,}/, "").replace(/[\n\r\s]{0,}$/, "") : "") } return e } }; window.dhx4.isIE = (navigator.userAgent.indexOf("MSIE") >= 0 || navigator.userAgent.indexOf("Trident") >= 0); window.dhx4.isIE6 = (window.XMLHttpRequest == null && navigator.userAgent.indexOf("MSIE") >= 0); window.dhx4.isIE7 = (navigator.userAgent.indexOf("MSIE 7.0") >= 0 && navigator.userAgent.indexOf("Trident") < 0); window.dhx4.isIE8 = (navigator.userAgent.indexOf("MSIE 8.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0); window.dhx4.isIE9 = (navigator.userAgent.indexOf("MSIE 9.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0); window.dhx4.isIE10 = (navigator.userAgent.indexOf("MSIE 10.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0 && window.navigator.pointerEnabled != true); window.dhx4.isIE11 = (navigator.userAgent.indexOf("Trident") >= 0 && window.navigator.pointerEnabled == true); window.dhx4.isEdge = (navigator.userAgent.indexOf("Edge") >= 0); window.dhx4.isOpera = (navigator.userAgent.indexOf("Opera") >= 0); window.dhx4.isChrome = (navigator.userAgent.indexOf("Chrome") >= 0) && !window.dhx4.isEdge; window.dhx4.isKHTML = (navigator.userAgent.indexOf("Safari") >= 0 || navigator.userAgent.indexOf("Konqueror") >= 0) && !window.dhx4.isEdge; window.dhx4.isFF = (navigator.userAgent.indexOf("Firefox") >= 0); window.dhx4.isIPad = (navigator.userAgent.search(/iPad/gi) >= 0); window.dhx4.dnd = { evs: {}, p_en: ((window.dhx4.isIE || window.dhx4.isEdge) && (window.navigator.pointerEnabled || window.navigator.msPointerEnabled)), _mTouch: function(a) { return (window.dhx4.isIE10 && a.pointerType == a.MSPOINTER_TYPE_MOUSE || window.dhx4.isIE11 && a.pointerType == "mouse" || window.dhx4.isEdge && a.pointerType == "mouse") }, _touchOn: function(a) { if (a == null) { a = document.body } a.style.touchAction = a.style.msTouchAction = ""; a = null }, _touchOff: function(a) { if (a == null) { a = document.body } a.style.touchAction = a.style.msTouchAction = "none"; a = null } }; if (window.navigator.pointerEnabled == true) { window.dhx4.dnd.evs = { start: "pointerdown", move: "pointermove", end: "pointerup" } } else { if (window.navigator.msPointerEnabled == true) { window.dhx4.dnd.evs = { start: "MSPointerDown", move: "MSPointerMove", end: "MSPointerUp" } } else { if (typeof(window.addEventListener) != "undefined") { window.dhx4.dnd.evs = { start: "touchstart", move: "touchmove", end: "touchend" } } } } } if (typeof(window.dhx4.template) == "undefined") { window.dhx4.trim = function(a) { return String(a).replace(/^\s{1,}/, "").replace(/\s{1,}$/, "") }; window.dhx4.template = function(c, e, a) { return c.replace(/#([a-z0-9_-]{1,})(\|([^#]*))?#/gi, function() { var m = arguments[1]; var l = window.dhx4.trim(arguments[3]); var n = null; var h = [e[m]]; if (l.length > 0) { l = l.split(":"); var g = []; for (var o = 0; o < l.length; o++) { if (o > 0 && g[g.length - 1].match(/\\$/) != null) { g[g.length - 1] = g[g.length - 1].replace(/\\$/, "") + ":" + l[o] } else { g.push(l[o]) } } n = g[0]; for (var o = 1; o < g.length; o++) { h.push(g[o]) } } if (typeof(n) == "string" && typeof(window.dhx4.template[n]) == "function") { return window.dhx4.template[n].apply(window.dhx4.template, h) } if (m.length > 0 && typeof(e[m]) != "undefined") { if (!e[m] && e[m] !== 0) { return "" } if (a == true) { return window.dhx4.trim(e[m]) } return String(e[m]) } return "" }) }; window.dhx4.template.date = function(a, c) { if (a != null) { if (a instanceof Date) { return window.dhx4.date2str(a, c) } else { a = a.toString(); if (a.match(/^\d*$/) != null) { return window.dhx4.date2str(new Date(parseInt(a)), c) } return a } } return "" }; window.dhx4.template.maxlength = function(c, a) { return String(c).substr(0, a) }; window.dhx4.template.number_format = function(g, h, e, a) { var c = window.dhx4.template._parseFmt(h, e, a); if (c == false) { return g } return window.dhx4.template._getFmtValue(g, c) }; window.dhx4.template.lowercase = function(a) { if (typeof(a) == "undefined" || a == null) { a = "" } return String(a).toLowerCase() }; window.dhx4.template.uppercase = function(a) { if (typeof(a) == "undefined" || a == null) { a = "" } return String(a).toUpperCase() }; window.dhx4.template._parseFmt = function(m, e, a) { var g = m.match(/^([^\.\,0-9]*)([0\.\,]*)([^\.\,0-9]*)/); if (g == null || g.length != 4) { return false } var c = { i_len: false, i_sep: (typeof(e) == "string" ? e : ","), d_len: false, d_sep: (typeof(a) == "string" ? a : "."), s_bef: (typeof(g[1]) == "string" ? g[1] : ""), s_aft: (typeof(g[3]) == "string" ? g[3] : "") }; var l = g[2].split("."); if (l[1] != null) { c.d_len = l[1].length } var h = l[0].split(","); if (h.length > 1) { c.i_len = h[h.length - 1].length } return c }; window.dhx4.template._getFmtValue = function(value, fmt) { var r = String(value).match(/^(-)?([0-9]{1,})(\.([0-9]{1,}))?$/); if (r != null && r.length == 5) { var v0 = ""; if (r[1] != null) { v0 += r[1] } v0 += fmt.s_bef; if (fmt.i_len !== false) { var i = 0; var v1 = ""; for (var q = r[2].length - 1; q >= 0; q--) { v1 = "" + r[2].charAt(q) + v1; if (++i == fmt.i_len && q > 0) { v1 = fmt.i_sep + v1; i = 0 } } v0 += v1 } else { v0 += r[2] } if (fmt.d_len !== false) { if (r[4] == null) { r[4] = "" } while (r[4].length < fmt.d_len) { r[4] += "0" } eval("dhx4.temp = new RegExp(/\\d{" + fmt.d_len + "}/);"); var t1 = (r[4]).match(dhx4.temp); if (t1 != null) { v0 += fmt.d_sep + t1 } dhx4.temp = t1 = null } v0 += fmt.s_aft; return v0 } return value } } if (typeof(window.dhx4.dateLang) == "undefined") { window.dhx4.dateLang = "en"; window.dhx4.dateStrings = { en: { monthFullName: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthShortName: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayFullName: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayShortName: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] } }; window.dhx4.dateFormat = { en: "%Y-%m-%d" }; window.dhx4.date2str = function(l, g, a) { if (g == null || typeof(g) == "undefined") { g = window.dhx4.dateFormat[window.dhx4.dateLang] } if (a == null || typeof(a) == "undefined") { a = window.dhx4.dateStrings[window.dhx4.dateLang] } if (l instanceof Date) { var h = function(m) { return (String(m).length == 1 ? "0" + String(m) : m) }; var c = function(o) { switch (o) { case "%d": return h(l.getDate()); case "%j": return l.getDate(); case "%D": return a.dayShortName[l.getDay()]; case "%l": return a.dayFullName[l.getDay()]; case "%m": return h(l.getMonth() + 1); case "%n": return l.getMonth() + 1; case "%M": return a.monthShortName[l.getMonth()]; case "%F": return a.monthFullName[l.getMonth()]; case "%y": return h(l.getYear() % 100); case "%Y": return l.getFullYear(); case "%g": return (l.getHours() + 11) % 12 + 1; case "%h": return h((l.getHours() + 11) % 12 + 1); case "%G": return l.getHours(); case "%H": return h(l.getHours()); case "%i": return h(l.getMinutes()); case "%s": return h(l.getSeconds()); case "%a": return (l.getHours() > 11 ? "pm" : "am"); case "%A": return (l.getHours() > 11 ? "PM" : "AM"); case "%%": return "%"; case "%u": return l.getMilliseconds(); case "%P": if (window.dhx4.temp_calendar != null && window.dhx4.temp_calendar.tz != null) { return window.dhx4.temp_calendar.tz } var r = l.getTimezoneOffset(); var q = Math.abs(Math.floor(r / 60)); var n = Math.abs(r) - q * 60; return (r > 0 ? "-" : "+") + h(q) + ":" + h(n); default: return o } }; var e = String(g || window.dhx4.dateFormat).replace(/%[a-zA-Z]/g, c) } return (e || String(l)) }; window.dhx4.str2date = function(l, A, E) { if (A == null || typeof(A) == "undefined") { A = window.dhx4.dateFormat[window.dhx4.dateLang] } if (E == null || typeof(E) == "undefined") { E = window.dhx4.dateStrings[window.dhx4.dateLang] } A = A.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\\:|]/g, "\\$&"); var D = []; var o = []; A = A.replace(/%[a-z]/gi, function(e) { switch (e) { case "%d": case "%m": case "%y": case "%h": case "%H": case "%i": case "%s": o.push(e); return "(\\d{2})"; case "%D": case "%l": case "%M": case "%F": o.push(e); return "([a-z??????\u0430-\u044F\u0451]{1,})"; case "%j": case "%n": case "%g": case "%G": o.push(e); return "(\\d{1,2})"; case "%Y": o.push(e); return "(\\d{4})"; case "%a": o.push(e); return "([a|p]m)"; case "%A": o.push(e); return "([A|P]M)"; case "%u": o.push(e); return "(\\d{1,6})"; case "%P": o.push(e); return "([+-]\\d{1,2}:\\d{1,2})" } return e }); var F = new RegExp(A, "i"); var s = l.match(F); if (s == null || s.length - 1 != o.length) { return "Invalid Date" } for (var c = 1; c < s.length; c++) { D.push(s[c]) } var g = { "%y": 1, "%Y": 1, "%n": 2, "%m": 2, "%M": 2, "%F": 2, "%d": 3, "%j": 3, "%a": 4, "%A": 4, "%H": 5, "%G": 5, "%h": 5, "%g": 5, "%i": 6, "%s": 7, "%u": 7, "%P": 7 }; var u = {}; var n = {}; for (var c = 0; c < o.length; c++) { if (typeof(g[o[c]]) != "undefined") { var h = g[o[c]]; if (!u[h]) { u[h] = []; n[h] = [] } u[h].push(D[c]); n[h].push(o[c]) } } D = []; o = []; for (var c = 1; c <= 7; c++) { if (u[c] != null) { for (var y = 0; y < u[c].length; y++) { D.push(u[c][y]); o.push(n[c][y]) } } } var a = new Date(); a.setDate(1); a.setHours(0); a.setMinutes(0); a.setSeconds(0); a.setMilliseconds(0); var x = function(v, e) { for (var r = 0; r < e.length; r++) { if (e[r].toLowerCase() == v) { return r } } return -1 }; for (var c = 0; c < D.length; c++) { switch (o[c]) { case "%d": case "%j": case "%n": case "%m": case "%Y": case "%H": case "%G": case "%i": case "%s": case "%u": if (!isNaN(D[c])) { a[{ "%d": "setDate", "%j": "setDate", "%n": "setMonth", "%m": "setMonth", "%Y": "setFullYear", "%H": "setHours", "%G": "setHours", "%i": "setMinutes", "%s": "setSeconds", "%u": "setMilliseconds" }[o[c]]](Number(D[c]) + (o[c] == "%m" || o[c] == "%n" ? -1 : 0)) } break; case "%M": case "%F": var m = x(D[c].toLowerCase(), E[{ "%M": "monthShortName", "%F": "monthFullName" }[o[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 + (x("pm", D) >= 0 ? (C == 12 ? 0 : 12) : (C == 12 ? -12 : 0))) } } break; case "%P": if (window.dhx4.temp_calendar != null) { window.dhx4.temp_calendar.tz = D[c] } break } } return a } } if (typeof(window.dhx4.ajax) == "undefined") { window.dhx4.ajax = function(c) { return dhx4.ajax.get(c) }; var ajaxbase = { cache: false, method: "get", parse: function(a) { if (typeof a !== "string") { return a } a = a.replace(/^[\s]+/, ""); if (window.DOMParser && !dhx4.isIE) { var c = (new window.DOMParser()).parseFromString(a, "text/xml") } else { if (window.ActiveXObject !== window.undefined) { var c = new window.ActiveXObject("Microsoft.XMLDOM"); c.async = "false"; c.loadXML(a) } } return c }, xmltop: function(a, h, g) { if (typeof h.status == "undefined" || h.status < 400) { xml = (!h.responseXML) ? dhx4.ajax.parse(h.responseText || h) : (h.responseXML || h); if (xml && xml.documentElement !== null) { try { if (!xml.getElementsByTagName("parsererror").length) { return xml.getElementsByTagName(a)[0] } } catch (c) {} } } if (g !== -1) { dhx4.callEvent("onLoadXMLError", ["Incorrect XML", arguments[1], g]) } return document.createElement("DIV") }, xpath: function(g, a) { if (!a.nodeName) { a = a.responseXML || a } if (dhx4.isIE) { try { return a.selectNodes(g) || [] } catch (l) { return [] } } else { var h = []; var m; var c = (a.ownerDocument || a).evaluate(g, a, null, XPathResult.ANY_TYPE, null); while (m = c.iterateNext()) { h.push(m) } return h } }, query: function(a) { return dhx4.ajax._call((a.method || "GET"), a.url, a.data || "", (a.async || true), a.callback, null, a.headers) }, get: function(a, c) { return this._call("GET", a, null, true, c) }, getSync: function(a) { return this._call("GET", a, null, false) }, put: function(c, a, e) { return this._call("PUT", c, a, true, e) }, del: function(c, a, e) { return this._call("DELETE", c, a, true, e) }, post: function(c, a, e) { if (arguments.length == 1) { a = "" } else { if (arguments.length == 2 && (typeof(a) == "function" || typeof(window[a]) == "function")) { e = a; a = "" } else { if (!a || typeof a !== "object") { a = String(a) } } } return this._call("POST", c, a, true, e) }, postSync: function(c, a) { a = (a == null ? "" : String(a)); return this._call("POST", c, a, false) }, getLong: function(a, c) { this._call("GET", a, null, true, c, { url: a }) }, postLong: function(c, a, e) { if (arguments.length == 2 && (typeof(a) == "function" || typeof(window[a]))) { e = a; a = "" } this._call("POST", c, a, true, e, { url: c, postData: a }) }, _call: function(c, e, g, n, q, v, l) { if (typeof g === "object") { var m = []; for (var r in g) { m.push(r + "=" + encodeURIComponent(g[r])) } g = m.join("&") } var h = dhx.promise.defer(); var u = (window.XMLHttpRequest && !dhx4.isIE ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP")); var o = (navigator.userAgent.match(/AppleWebKit/) != null && navigator.userAgent.match(/Qt/) != null && navigator.userAgent.match(/Safari/) != null); if (n == true) { u.onreadystatechange = function() { if ((u.readyState == 4) || (o == true && u.readyState == 3)) { if (u.status != 200 || u.responseText == "") { h.reject(u); if (!dhx4.callEvent("onAjaxError", [{ xmlDoc: u, filePath: e, async: n }])) { return } } window.setTimeout(function() { if (typeof(q) == "function") { try { q.apply(window, [{ xmlDoc: u, filePath: e, async: n }]) } catch (a) { h.reject(a) } } if (v != null) { if (typeof(v.postData) != "undefined") { dhx4.ajax.postLong(v.url, v.postData, q) } else { dhx4.ajax.getLong(v.url, q) } } h.resolve(u.responseText); q = null; u = null }, 1) } } } if (c == "GET") { e += this._dhxr(e) } u.open(c, e, n); if (l != null) { for (var s in l) { u.setRequestHeader(s, l[s]) } } else { if (c == "POST" || c == "PUT" || c == "DELETE") { u.setRequestHeader("Content-Type", "application/x-www-form-urlencoded") } else { if (c == "GET") { g = null } } } u.setRequestHeader("X-Requested-With", "XMLHttpRequest"); u.send(g); if (n != true) { if ((u.readyState == 4) || (o == true && u.readyState == 3)) { if (u.status != 200 || u.responseText == "") { dhx4.callEvent("onAjaxError", [{ xmlDoc: u, filePath: e, async: n }]) } } } h.xmlDoc = u; h.filePath = e; h.async = n; return h }, _dhxr: function(a, c) { if (this.cache != true) { if (a.match(/^[\?\&]$/) == null) { a = (a.indexOf("?") >= 0 ? "&" : "?") } if (typeof(c) == "undefined") { c = true } return a + "dhxr" + new Date().getTime() + (c == true ? "=1" : "") } return "" } }; for (var key in ajaxbase) { dhx4.ajax[key] = ajaxbase[key] } } if (typeof(window.dhx4._enableDataLoading) == "undefined") { window.dhx4._enableDataLoading = function(m, e, l, h, n) { if (n == "clear") { for (var c in m._dhxdataload) { m._dhxdataload[c] = null; delete m._dhxdataload[c] } m._loadData = null; m._dhxdataload = null; m.load = null; m.loadStruct = null; m = null; return } m._dhxdataload = { initObj: e, xmlToJson: l, xmlRootTag: h, onBeforeXLS: null }; m._loadData = function(u, v, w) { if (arguments.length == 2) { w = v; v = null } var s = null; if (arguments.length == 3) { w = arguments[2] } this.callEvent("onXLS", []); if (typeof(u) == "string") { var r = u.replace(/^\s{1,}/, "").replace(/\s{1,}$/, ""); var A = new RegExp("^<" + this._dhxdataload.xmlRootTag); if (A.test(r.replace(/^<\?xml[^\?]*\?>\s*/, ""))) { s = dhx4.ajax.parse(u); if (s != null) { s = this[this._dhxdataload.xmlToJson].apply(this, [s]) } } if (s == null && (r.match(/^[\s\S]*{[.\s\S]*}[\s\S]*$/) != null || r.match(/^[\s\S]*\[[.\s\S]*\][\s\S]*$/) != null)) { s = dhx4.s2j(r) } if (s == null) { var q = []; if (typeof(this._dhxdataload.onBeforeXLS) == "function") { var r = this._dhxdataload.onBeforeXLS.apply(this, [u]); if (r != null && typeof(r) == "object") { if (r.url != null) { u = r.url } if (r.params != null) { for (var x in r.params) { q.push(x + "=" + encodeURIComponent(r.params[x])) } } } } var y = this; var o = function(a) { var C = null; if ((a.xmlDoc.getResponseHeader("Content-Type") || "").search(/xml/gi) >= 0 || (a.xmlDoc.responseText.replace(/^\s{1,}/, "")).match(/^ 0 ? (u.indexOf("?") > 0 ? "&" : "?") + q : ""), o) } } return } } else { if (typeof(u.documentElement) == "object" || (typeof(u.tagName) != "undefined" && typeof(u.getElementsByTagName) != "undefined" && u.getElementsByTagName(this._dhxdataload.xmlRootTag).length > 0)) { s = this[this._dhxdataload.xmlToJson].apply(this, [u]) } else { s = window.dhx4._copyObj(u) } } if (s != null) { this[this._dhxdataload.initObj].apply(this, [s]) } this.callEvent("onXLE", []); if (w != null) { if (typeof(w) == "function") { w.apply(this, []) } else { if (typeof(window[w]) == "function") { window[w].apply(this, []) } } w = null } }; if (n != null) { var g = { struct: "loadStruct", data: "load" }; for (var c in n) { if (n[c] == true) { m[g[c]] = function() { return this._loadData.apply(this, arguments) } } } } m = null } } if (typeof(window.dhx4._eventable) == "undefined") { window.dhx4._eventable = function(a, c) { if (c == "clear") { a.detachAllEvents(); a.dhxevs = null; a.attachEvent = null; a.detachEvent = null; a.checkEvent = null; a.callEvent = null; a.detachAllEvents = null; a = null; return } a.dhxevs = { data: {} }; a.attachEvent = function(e, h) { e = String(e).toLowerCase(); if (!this.dhxevs.data[e]) { this.dhxevs.data[e] = {} } var g = window.dhx4.newId(); this.dhxevs.data[e][g] = h; return g }; a.detachEvent = function(l) { for (var g in this.dhxevs.data) { var h = 0; for (var e in this.dhxevs.data[g]) { if (e == l) { this.dhxevs.data[g][e] = null; delete this.dhxevs.data[g][e] } else { h++ } } if (h == 0) { this.dhxevs.data[g] = null; delete this.dhxevs.data[g] } } }; a.checkEvent = function(e) { e = String(e).toLowerCase(); return (this.dhxevs.data[e] != null) }; a.callEvent = function(g, l) { g = String(g).toLowerCase(); if (this.dhxevs.data[g] == null) { return true } var h = true; for (var e in this.dhxevs.data[g]) { h = this.dhxevs.data[g][e].apply(this, l) && h } return h }; a.detachAllEvents = function() { for (var g in this.dhxevs.data) { for (var e in this.dhxevs.data[g]) { this.dhxevs.data[g][e] = null; delete this.dhxevs.data[g][e] } this.dhxevs.data[g] = null; delete this.dhxevs.data[g] } }; a = null }; dhx4._eventable(dhx4) } if (!window.dhtmlxValidation) { dhtmlxValidation = function() {}; dhtmlxValidation.prototype = { isEmpty: function(a) { return a == "" }, isNotEmpty: function(a) { return (a instanceof Array ? a.length > 0 : !a == "") }, isValidBoolean: function(a) { return !!a.toString().match(/^(0|1|true|false)$/) }, isValidEmail: function(a) { return !!a.toString().match(/^[a-z0-9][0-9a-z\-_\.]*@[0-9a-z_\-\.]*\.[a-z]{2,5}$/i) }, isValidInteger: function(a) { return !!a.toString().match(/(^-?\d+$)/) }, isValidNumeric: function(a) { return !!a.toString().match(/(^-?\d\d*[\.|,]\d*$)|(^-?\d\d*$)|(^-?[\.|,]\d\d*$)/) }, isValidAplhaNumeric: function(a) { return !!a.toString().match(/^[_\-a-z0-9]+$/gi) }, isValidDatetime: function(c) { var a = c.toString().match(/^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/); return a && !!(a[1] <= 9999 && a[2] <= 12 && a[3] <= 31 && a[4] <= 59 && a[5] <= 59 && a[6] <= 59) || false }, isValidDate: function(a) { var c = a.toString().match(/^(\d{4})-(\d{2})-(\d{2})$/); return c && !!(c[1] <= 9999 && c[2] <= 12 && c[3] <= 31) || false }, isValidTime: function(c) { var a = c.toString().match(/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/); return a && !!(a[1] <= 24 && a[2] <= 59 && a[3] <= 59) || false }, isValidIPv4: function(a) { var c = a.toString().match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/); return c && !!(c[1] <= 255 && c[2] <= 255 && c[3] <= 255 && c[4] <= 255) || false }, isValidCurrency: function(a) { return a.toString().match(/^\$?\s?\d+?([\.,\,]?\d+)?\s?\$?$/) && true || false }, isValidSSN: function(a) { return a.toString().match(/^\d{3}\-?\d{2}\-?\d{4}$/) && true || false }, isValidSIN: function(a) { return a.toString().match(/^\d{9}$/) && true || false } }; dhtmlxValidation = new dhtmlxValidation() } if (typeof(window.dhtmlx) == "undefined") { window.dhtmlx = {} } if (!window.dhtmlx.extend) { window.dhtmlx.extend = function(e, c) { for (var g in c) { if (!e[g]) { e[g] = c[g] } } return e }; window.dhtmlx.extend_api = function(a, g, e) { var c = window[a]; if (!c) { return } window[a] = function(m) { if (m && typeof m == "object" && !m.tagName) { var l = c.apply(this, (g._init ? g._init(m) : arguments)); for (var h in dhtmlx) { if (g[h]) { this[g[h]](dhtmlx[h]) } } for (var h in m) { if (g[h]) { this[g[h]](m[h]) } else { if (h.indexOf("on") === 0) { this.attachEvent(h, m[h]) } } } } else { var l = c.apply(this, arguments) } if (g._patch) { g._patch(this) } return l || this }; window[a].prototype = c.prototype; if (e) { dhtmlx.extend(window[a].prototype, e) } }; window.dhtmlx.url = function(a) { if (a.indexOf("?") != -1) { return "&" } else { return "?" } } } function dhtmlDragAndDropObject() { if (window.dhtmlDragAndDrop) { return window.dhtmlDragAndDrop } this.lastLanding = 0; this.dragNode = 0; this.dragStartNode = 0; this.dragStartObject = 0; this.tempDOMU = null; this.tempDOMM = null; this.waitDrag = 0; window.dhtmlDragAndDrop = this; return this } dhtmlDragAndDropObject.prototype.removeDraggableItem = function(a) { a.onmousedown = null; a.dragStarter = null; a.dragLanding = null }; dhtmlDragAndDropObject.prototype.addDraggableItem = function(a, c) { a.onmousedown = this.preCreateDragCopy; a.dragStarter = c; this.addDragLanding(a, c) }; dhtmlDragAndDropObject.prototype.addDragLanding = function(a, c) { a.dragLanding = c }; dhtmlDragAndDropObject.prototype.preCreateDragCopy = function(a) { if ((a || window.event) && (a || event).button == 2) { return } if (window.dhtmlDragAndDrop.waitDrag) { window.dhtmlDragAndDrop.waitDrag = 0; document.body.onmouseup = window.dhtmlDragAndDrop.tempDOMU; document.body.onmousemove = window.dhtmlDragAndDrop.tempDOMM; return false } if (window.dhtmlDragAndDrop.dragNode) { window.dhtmlDragAndDrop.stopDrag(a) } window.dhtmlDragAndDrop.waitDrag = 1; window.dhtmlDragAndDrop.tempDOMU = document.body.onmouseup; window.dhtmlDragAndDrop.tempDOMM = document.body.onmousemove; window.dhtmlDragAndDrop.dragStartNode = this; window.dhtmlDragAndDrop.dragStartObject = this.dragStarter; document.body.onmouseup = window.dhtmlDragAndDrop.preCreateDragCopy; document.body.onmousemove = window.dhtmlDragAndDrop.callDrag; window.dhtmlDragAndDrop.downtime = new Date().valueOf(); if ((a) && (a.preventDefault)) { a.preventDefault(); return false } return false }; dhtmlDragAndDropObject.prototype.callDrag = function(g) { if (!g) { g = window.event } dragger = window.dhtmlDragAndDrop; if ((new Date()).valueOf() - dragger.downtime < 100) { return } if (!dragger.dragNode) { if (dragger.waitDrag) { dragger.dragNode = dragger.dragStartObject._createDragNode(dragger.dragStartNode, g); if (!dragger.dragNode) { return dragger.stopDrag() } dragger.dragNode.onselectstart = function() { return false }; dragger.gldragNode = dragger.dragNode; document.body.appendChild(dragger.dragNode); document.body.onmouseup = dragger.stopDrag; dragger.waitDrag = 0; dragger.dragNode.pWindow = window; dragger.initFrameRoute() } else { return dragger.stopDrag(g, true) } } if (dragger.dragNode.parentNode != window.document.body && dragger.gldragNode) { var a = dragger.gldragNode; if (dragger.gldragNode.old) { a = dragger.gldragNode.old } a.parentNode.removeChild(a); var c = dragger.dragNode.pWindow; if (a.pWindow && a.pWindow.dhtmlDragAndDrop.lastLanding) { a.pWindow.dhtmlDragAndDrop.lastLanding.dragLanding._dragOut(a.pWindow.dhtmlDragAndDrop.lastLanding) } if (_isIE) { var 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(h) { if (window.name) { var e = parent.frames[window.name].frameElement.offsetParent; var g = 0; var c = 0; while (e) { g += e.offsetLeft; c += e.offsetTop; e = e.offsetParent } if ((parent.dhtmlDragAndDrop)) { var a = parent.dhtmlDragAndDrop.calculateFramePosition(1); g += a.split("_")[0] * 1; c += a.split("_")[1] * 1 } if (h) { return g + "_" + c } else { this.fx = g } this.fy = c } return "0_0" }; dhtmlDragAndDropObject.prototype.checkLanding = function(c, a) { if ((c) && (c.dragLanding)) { if (this.lastLanding) { this.lastLanding.dragLanding._dragOut(this.lastLanding) } this.lastLanding = c; this.lastLanding = this.lastLanding.dragLanding._dragIn(this.lastLanding, this.dragStartNode, a.clientX, a.clientY, a); this.lastLanding_scr = (_isIE ? a.srcElement : a.target) } else { if ((c) && (c.tagName != "BODY")) { this.checkLanding(c.parentNode, a) } else { if (this.lastLanding) { this.lastLanding.dragLanding._dragOut(this.lastLanding, a.clientX, a.clientY, a) } this.lastLanding = 0; if (this._onNotFound) { this._onNotFound() } } } }; dhtmlDragAndDropObject.prototype.stopDrag = function(c, g) { dragger = window.dhtmlDragAndDrop; if (!g) { dragger.stopFrameRoute(); var a = dragger.lastLanding; dragger.lastLanding = null; if (a) { a.dragLanding._drag(dragger.dragStartNode, dragger.dragStartObject, a, (_isIE ? event.srcElement : c.target)) } } dragger.lastLanding = null; if ((dragger.dragNode) && (dragger.dragNode.parentNode == document.body)) { dragger.dragNode.parentNode.removeChild(dragger.dragNode) } dragger.dragNode = 0; dragger.gldragNode = 0; dragger.fx = 0; dragger.fy = 0; dragger.dragStartNode = 0; dragger.dragStartObject = 0; document.body.onmouseup = dragger.tempDOMU; document.body.onmousemove = dragger.tempDOMM; dragger.tempDOMU = null; dragger.tempDOMM = null; dragger.waitDrag = 0 }; dhtmlDragAndDropObject.prototype.stopFrameRoute = function(g) { if (g) { window.dhtmlDragAndDrop.stopDrag(1, 1) } for (var a = 0; a < window.frames.length; a++) { try { if ((window.frames[a] != g) && (window.frames[a].dhtmlDragAndDrop)) { window.frames[a].dhtmlDragAndDrop.stopFrameRoute(window) } } catch (c) {} } try { if ((parent.dhtmlDragAndDrop) && (parent != window) && (parent != g)) { parent.dhtmlDragAndDrop.stopFrameRoute(window) } } catch (c) {} }; dhtmlDragAndDropObject.prototype.initFrameRoute = function(g, h) { if (g) { window.dhtmlDragAndDrop.preCreateDragCopy(); window.dhtmlDragAndDrop.dragStartNode = g.dhtmlDragAndDrop.dragStartNode; window.dhtmlDragAndDrop.dragStartObject = g.dhtmlDragAndDrop.dragStartObject; window.dhtmlDragAndDrop.dragNode = g.dhtmlDragAndDrop.dragNode; window.dhtmlDragAndDrop.gldragNode = g.dhtmlDragAndDrop.dragNode; window.document.body.onmouseup = window.dhtmlDragAndDrop.stopDrag; window.waitDrag = 0; if (((!_isIE) && (h)) && ((!_isFF) || (_FFrv < 1.8))) { window.dhtmlDragAndDrop.calculateFramePosition() } } try { if ((parent.dhtmlDragAndDrop) && (parent != window) && (parent != g)) { parent.dhtmlDragAndDrop.initFrameRoute(window) } } catch (c) {} for (var a = 0; a < window.frames.length; a++) { try { if ((window.frames[a] != g) && (window.frames[a].dhtmlDragAndDrop)) { window.frames[a].dhtmlDragAndDrop.initFrameRoute(window, ((!g || h) ? 1 : 0)) } } catch (c) {} } }; _isFF = false; _isIE = false; _isOpera = false; _isKHTML = false; _isMacOS = false; _isChrome = false; _FFrv = false; _KHTMLrv = false; _OperaRv = false; if (navigator.userAgent.indexOf("Macintosh") != -1) { _isMacOS = true } if (navigator.userAgent.toLowerCase().indexOf("chrome") > -1) { _isChrome = true } if ((navigator.userAgent.indexOf("Safari") != -1) || (navigator.userAgent.indexOf("Konqueror") != -1)) { _KHTMLrv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Safari") + 7, 5)); if (_KHTMLrv > 525) { _isFF = true; _FFrv = 1.9 } else { _isKHTML = true } } else { if (navigator.userAgent.indexOf("Opera") != -1) { _isOpera = true; _OperaRv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera") + 6, 3)) } else { if (navigator.appName.indexOf("Microsoft") != -1) { _isIE = true; if ((navigator.appVersion.indexOf("MSIE 8.0") != -1 || navigator.appVersion.indexOf("MSIE 9.0") != -1 || navigator.appVersion.indexOf("MSIE 10.0") != -1 || document.documentMode > 7) && document.compatMode != "BackCompat") { _isIE = 8 } } else { if (navigator.appName == "Netscape" && navigator.userAgent.indexOf("Trident") != -1) { _isIE = 8 } else { _isFF = true; _FFrv = parseFloat(navigator.userAgent.split("rv:")[1]) } } } } if (typeof(window.dhtmlxEvent) == "undefined") { window.dhtmlxEvent = function(c, e, a) { if (c.addEventListener) { c.addEventListener(e, a, false) } else { if (c.attachEvent) { c.attachEvent("on" + e, a) } } } } if (dhtmlxEvent.touchDelay == null) { dhtmlxEvent.touchDelay = 2000 } if (typeof(dhtmlxEvent.initTouch) == "undefined") { dhtmlxEvent.initTouch = function() { var g; var h; var c, a; dhtmlxEvent(document.body, "touchstart", function(l) { h = l.touches[0].target; c = l.touches[0].clientX; a = l.touches[0].clientY; g = window.setTimeout(e, dhtmlxEvent.touchDelay) }); function e() { if (h) { var l = document.createEvent("HTMLEvents"); l.initEvent("dblclick", true, true); h.dispatchEvent(l); g = h = null } } dhtmlxEvent(document.body, "touchmove", function(l) { if (g) { if (Math.abs(l.touches[0].clientX - c) > 50 || Math.abs(l.touches[0].clientY - a) > 50) { window.clearTimeout(g); g = h = false } } }); dhtmlxEvent(document.body, "touchend", function(l) { if (g) { window.clearTimeout(g); g = h = false } }); dhtmlxEvent.initTouch = function() {} } }(function(c) { var e = typeof setImmediate !== "undefined" ? setImmediate : function(h) { setTimeout(h, 0) }; function g(l, m) { var h = this; h.promise = h; h.state = "pending"; h.val = null; h.fn = l || null; h.er = m || null; h.next = [] } g.prototype.resolve = function(l) { var h = this; if (h.state === "pending") { h.val = l; h.state = "resolving"; e(function() { h.fire() }) } }; g.prototype.reject = function(l) { var h = this; if (h.state === "pending") { h.val = l; h.state = "rejecting"; e(function() { h.fire() }) } }; g.prototype.then = function(l, n) { var h = this; var m = new g(l, n); h.next.push(m); if (h.state === "resolved") { m.resolve(h.val) } if (h.state === "rejected") { m.reject(h.val) } return m }; g.prototype.fail = function(h) { return this.then(null, h) }; g.prototype.finish = function(m) { var h = this; h.state = m; if (h.state === "resolved") { for (var l = 0; l < h.next.length; l++) { h.next[l].resolve(h.val) } } if (h.state === "rejected") { for (var l = 0; l < h.next.length; l++) { h.next[l].reject(h.val) } if (!h.next.length) { throw (h.val) } } }; g.prototype.thennable = function(o, h, m, s, r) { var l = this; r = r || l.val; if (typeof r === "object" && typeof o === "function") { try { var n = 0; o.call(r, function(u) { if (n++ !== 0) { return } h(u) }, function(u) { if (n++ !== 0) { return } m(u) }) } catch (q) { m(q) } } else { s(r) } }; g.prototype.fire = function() { var h = this; var l; try { l = h.val && h.val.then } catch (m) { h.val = m; h.state = "rejecting"; return h.fire() } h.thennable(l, function(n) { h.val = n; h.state = "resolving"; h.fire() }, function(n) { h.val = n; h.state = "rejecting"; h.fire() }, function(n) { h.val = n; if (h.state === "resolving" && typeof h.fn === "function") { try { h.val = h.fn.call(undefined, h.val) } catch (o) { h.val = o; return h.finish("rejected") } } if (h.state === "rejecting" && typeof h.er === "function") { try { h.val = h.er.call(undefined, h.val); h.state = "resolving" } catch (o) { h.val = o; return h.finish("rejected") } } if (h.val === h) { h.val = TypeError(); return h.finish("rejected") } h.thennable(l, function(q) { h.val = q; h.finish("resolved") }, function(q) { h.val = q; h.finish("rejected") }, function(q) { h.val = q; h.state === "resolving" ? h.finish("resolved") : h.finish("rejected") }) }) }; g.prototype.done = function() { if (this.state = "rejected" && !this.next) { throw this.val } return null }; g.prototype.nodeify = function(h) { if (typeof h === "function") { return this.then(function(m) { try { h(null, m) } catch (l) { setImmediate(function() { throw l }) } return m }, function(m) { try { h(m) } catch (l) { setImmediate(function() { throw l }) } return m }) } return this }; g.prototype.spread = function(h, l) { return this.all().then(function(m) { return typeof h === "function" && h.apply(null, m) }, l) }; g.prototype.all = function() { var h = this; return this.then(function(w) { var m = new g(); if (!(w instanceof Array)) { m.reject(TypeError); return m } var o = 0; var v = w.length; function r() { if (++o === v) { m.resolve(w) } } for (var s = 0, q = w.length; s < q; s++) { var x = w[s]; var n; try { n = x && x.then } catch (u) { m.reject(u); break }(function(l) { h.thennable(n, function(y) { w[l] = y; r() }, function(y) { m.reject(y) }, function() { r() }, x) })(s) } return m }) }; var a = { all: function(h) { var l = new g(null, null); l.resolve(h); return l.all() }, defer: function() { return new g(null, null) }, fcall: function() { var m = new g(); var h = Array.apply([], arguments); var l = h.shift(); try { var o = l.apply(null, h); m.resolve(o) } catch (n) { m.reject(n) } return m }, nfcall: function() { var m = new g(); var h = Array.apply([], arguments); var l = h.shift(); try { h.push(function(o, q) { if (o) { return m.reject(o) } return m.resolve(q) }); l.apply(null, h) } catch (n) { m.reject(n) } return m } }; c.promise = a })(dhx); if (!window.dhtmlx) { dhtmlx = {} } dhtmlx.assert = function(c, a) { if (!c) { dhtmlx.error(a) } }; dhtmlx.assert_enabled = function() { return false }; dhtmlx.assert_event = function(l, e) { if (!l._event_check) { l._event_check = {}; l._event_check_size = {} } for (var c in e) { l._event_check[c.toLowerCase()] = e[c]; var h = -1; for (var g in e[c]) { h++ } l._event_check_size[c.toLowerCase()] = h } }; dhtmlx.assert_method_info = function(h, c, g, l) { var a = []; for (var e = 0; e < l.length; e++) { a.push(l[e][0] + " : " + l[e][1] + "\n " + l[e][2].describe() + (l[e][3] ? "; optional" : "")) } return h.name + "." + c + "\n" + g + "\n Arguments:\n - " + a.join("\n - ") }; dhtmlx.assert_method = function(e, a) { for (var c in a) { dhtmlx.assert_method_process(e, c, a[c].descr, a[c].args, (a[c].min || 99), a[c].skip) } }; dhtmlx.assert_method_process = function(l, c, h, m, e, g) { var a = l[c]; if (!g) { l[c] = function() { if (arguments.length != m.length && arguments.length < e) { dhtmlx.log("warn", "Incorrect count of parameters\n" + l[c].describe() + "\n\nExpecting " + m.length + " but have only " + arguments.length) } else { for (var n = 0; n < m.length; n++) { if (!m[n][3] && !m[n][2](arguments[n])) { dhtmlx.log("warn", "Incorrect method call\n" + l[c].describe() + "\n\nActual value of " + (n + 1) + " parameter: {" + (typeof arguments[n]) + "} " + arguments[n]) } } } return a.apply(this, arguments) } } l[c].describe = function() { return dhtmlx.assert_method_info(l, c, h, m) } }; dhtmlx.assert_event_call = function(e, c, a) { if (e._event_check) { if (!e._event_check[c]) { dhtmlx.log("warn", "Not expected event call :" + c) } else { if (dhtmlx.isNotDefined(a)) { dhtmlx.log("warn", "Event without parameters :" + c) } else { if (e._event_check_size[c] != a.length) { dhtmlx.log("warn", "Incorrect event call, expected " + e._event_check_size[c] + " parameter(s), but have " + a.length + " parameter(s), for " + c + " event") } } } } }; dhtmlx.assert_event_attach = function(c, a) { if (c._event_check && !c._event_check[a]) { dhtmlx.log("warn", "Unknown event name: " + a) } }; dhtmlx.assert_property = function(c, a) { if (!c._settings_check) { c._settings_check = {} } dhtmlx.extend(c._settings_check, a) }; dhtmlx.assert_check = function(e, c) { if (typeof e == "object") { for (var a in e) { dhtmlx.assert_settings(a, e[a], c) } } }; dhtmlx.assert_settings = function(n, h, g) { g = g || this._settings_check; if (g) { if (!g[n]) { return dhtmlx.log("warn", "Unknown propery: " + n) } var m = ""; var c = ""; var a = false; for (var e = 0; e < g[n].length; e++) { var l = g[n][e]; if (typeof l == "string") { continue } if (typeof l == "function") { a = a || l(h) } else { if (typeof l == "object" && typeof l[1] == "function") { a = a || l[1](h); if (a && l[2]) { dhtmlx.assert_check(h, l[2]) } } } if (a) { break } } if (!a) { dhtmlx.log("warn", "Invalid configuration\n" + dhtmlx.assert_info(n, g) + "\nActual value: {" + (typeof h) + "} " + h) } } }; dhtmlx.assert_info = function(c, l) { var a = l[c]; var h = ""; var g = []; for (var e = 0; e < a.length; e++) { if (typeof rule == "string") { h = a[e] } else { if (a[e].describe) { g.push(a[e].describe()) } else { if (a[e][1] && a[e][1].describe) { g.push(a[e][1].describe()) } } } } return "Property: " + c + ", " + h + " \nExpected value: \n - " + g.join("\n - ") }; if (dhtmlx.assert_enabled()) { dhtmlx.assert_rule_color = function(a) { if (typeof a != "string") { return false } if (a.indexOf("#") !== 0) { return false } if (a.substr(1).replace(/[0-9A-F]/gi, "") !== "") { return false } return true }; dhtmlx.assert_rule_color.describe = function() { return "{String} Value must start from # and contain hexadecimal code of color" }; dhtmlx.assert_rule_template = function(a) { if (typeof a == "function") { return true } if (typeof a == "string") { return true } return false }; dhtmlx.assert_rule_template.describe = function() { return "{Function},{String} Value must be a function which accepts data object and return text string, or a sting with optional template markers" }; dhtmlx.assert_rule_boolean = function(a) { if (typeof a == "boolean") { return true } return false }; dhtmlx.assert_rule_boolean.describe = function() { return "{Boolean} true or false" }; dhtmlx.assert_rule_object = function(a, c) { if (typeof a == "object") { return true } return false }; dhtmlx.assert_rule_object.describe = function() { return "{Object} Configuration object" }; dhtmlx.assert_rule_string = function(a) { if (typeof a == "string") { return true } return false }; dhtmlx.assert_rule_string.describe = function() { return "{String} Plain string" }; dhtmlx.assert_rule_htmlpt = function(a) { return !!dhtmlx.toNode(a) }; dhtmlx.assert_rule_htmlpt.describe = function() { return "{Object},{String} HTML node or ID of HTML Node" }; dhtmlx.assert_rule_notdocumented = function(a) { return false }; dhtmlx.assert_rule_notdocumented.describe = function() { return "This options wasn't documented" }; dhtmlx.assert_rule_key = function(c) { var a = function(e) { return c[e] }; a.describe = function() { var g = []; for (var e in c) { g.push(e) } return "{String} can take one of next values: " + g.join(", ") }; return a }; dhtmlx.assert_rule_dimension = function(a) { if (a * 1 == a && !isNaN(a) && a >= 0) { return true } return false }; dhtmlx.assert_rule_dimension.describe = function() { return "{Integer} value must be a positive number" }; dhtmlx.assert_rule_number = function(a) { if (typeof a == "number") { return true } return false }; dhtmlx.assert_rule_number.describe = function() { return "{Integer} value must be a number" }; dhtmlx.assert_rule_function = function(a) { if (typeof a == "function") { return true } return false }; dhtmlx.assert_rule_function.describe = function() { return "{Function} value must be a custom function" }; dhtmlx.assert_rule_any = function(a) { return true }; dhtmlx.assert_rule_any.describe = function() { return "Any value" }; dhtmlx.assert_rule_mix = function(e, c) { var g = function(a) { if (e(a) || c(a)) { return true } return false }; g.describe = function() { return e.describe() }; return g } } dhtmlx.codebase = "./"; dhtmlx.copy = function(c) { var a = dhtmlx.copy._function; a.prototype = c; return new a() }; dhtmlx.copy._function = function() {}; dhtmlx.extend = function(c, a) { for (var e in a) { c[e] = a[e] } if (dhtmlx.assert_enabled() && a._assert) { c._assert(); c._assert = null } dhtmlx.assert(c, "Invalid nesting target"); dhtmlx.assert(a, "Invalid nesting source"); if (a._init) { c._init() } return c }; dhtmlx.proto_extend = function() { var l = arguments; var e = l[0]; var c = []; for (var h = l.length - 1; h > 0; h--) { if (typeof l[h] == "function") { l[h] = l[h].prototype } for (var g in l[h]) { if (g == "_init") { c.push(l[h][g]) } else { if (!e[g]) { e[g] = l[h][g] } } } } if (l[0]._init) { c.push(l[0]._init) } e._init = function() { for (var m = 0; m < c.length; m++) { c[m].apply(this, arguments) } }; e.base = l[1]; var a = function(m) { this._init(m); if (this._parseSettings) { this._parseSettings(m, this.defaults) } }; a.prototype = e; e = l = null; return a }; dhtmlx.bind = function(c, a) { return function() { return c.apply(a, arguments) } }; dhtmlx.require = function(a) { if (!dhtmlx._modules[a]) { dhtmlx.assert(dhtmlx.ajax, "load module is required"); dhtmlx.exec(dhtmlx.ajax().sync().get(dhtmlx.codebase + a).responseText); dhtmlx._modules[a] = true } }; dhtmlx._modules = {}; dhtmlx.exec = function(code) { if (window.execScript) { window.execScript(code) } else { window.eval(code) } }; dhtmlx.methodPush = function(a, e, c) { return function() { var g = false; g = a[e].apply(a, arguments); return g } }; dhtmlx.isNotDefined = function(c) { return typeof c == "undefined" }; dhtmlx.delay = function(g, c, e, a) { setTimeout(function() { var h = g.apply(c, e); g = c = e = null; return h }, a || 1) }; dhtmlx.uid = function() { if (!this._seed) { this._seed = (new Date).valueOf() } this._seed++; return this._seed }; dhtmlx.toNode = function(a) { if (typeof a == "string") { return document.getElementById(a) } return a }; dhtmlx.toArray = function(a) { return dhtmlx.extend((a || []), dhtmlx.PowerArray) }; dhtmlx.toFunctor = function(str) { return (typeof(str) == "string") ? eval(str) : str }; dhtmlx._events = {}; dhtmlx.event = function(g, e, a, c) { g = dhtmlx.toNode(g); var h = dhtmlx.uid(); dhtmlx._events[h] = [g, e, a]; if (c) { a = dhtmlx.bind(a, c) } if (g.addEventListener) { g.addEventListener(e, a, false) } else { if (g.attachEvent) { g.attachEvent("on" + e, a) } } return h }; dhtmlx.eventRemove = function(c) { if (!c) { return } dhtmlx.assert(this._events[c], "Removing non-existing event"); var a = dhtmlx._events[c]; if (a[0].removeEventListener) { a[0].removeEventListener(a[1], a[2], false) } else { if (a[0].detachEvent) { a[0].detachEvent("on" + a[1], a[2]) } } delete this._events[c] }; dhtmlx.log = function(c, e, a) { if (window.console && console.log) { c = c.toLowerCase(); if (window.console[c]) { window.console[c](e || "unknown error") } else { window.console.log(c + ": " + e) } if (a) { window.console.log(a) } } }; dhtmlx.log_full_time = function(a) { dhtmlx._start_time_log = new Date(); dhtmlx.log("Info", "Timing start [" + a + "]"); window.setTimeout(function() { var c = new Date(); dhtmlx.log("Info", "Timing end [" + a + "]:" + (c.valueOf() - dhtmlx._start_time_log.valueOf()) / 1000 + "s") }, 1) }; dhtmlx.log_time = function(a) { var e = "_start_time_log" + a; if (!dhtmlx[e]) { dhtmlx[e] = new Date(); dhtmlx.log("Info", "Timing start [" + a + "]") } else { var c = new Date(); dhtmlx.log("Info", "Timing end [" + a + "]:" + (c.valueOf() - dhtmlx[e].valueOf()) / 1000 + "s"); dhtmlx[e] = null } }; dhtmlx.error = function(c, a) { dhtmlx.log("error", c, a) }; dhtmlx.EventSystem = { _init: function() { this._events = {}; this._handlers = {}; this._map = {} }, block: function() { this._events._block = true }, unblock: function() { this._events._block = false }, mapEvent: function(a) { dhtmlx.extend(this._map, a) }, callEvent: function(e, h) { if (this._events._block) { return true } e = e.toLowerCase(); dhtmlx.assert_event_call(this, e, h); var g = this._events[e.toLowerCase()]; var a = true; if (dhtmlx.debug) { dhtmlx.log("info", "[" + this.name + "] event:" + e, h) } if (g) { for (var c = 0; c < g.length; c++) { if (g[c].apply(this, (h || [])) === false) { a = false } } } if (this._map[e] && !this._map[e].callEvent(e, h)) { a = false } return a }, attachEvent: function(c, a, g) { c = c.toLowerCase(); dhtmlx.assert_event_attach(this, c); g = g || dhtmlx.uid(); a = dhtmlx.toFunctor(a); var e = this._events[c] || dhtmlx.toArray(); e.push(a); this._events[c] = e; this._handlers[g] = { f: a, t: c }; return g }, detachEvent: function(g) { if (this._handlers[g]) { var c = this._handlers[g].t; var a = this._handlers[g].f; var e = this._events[c]; e.remove(a); delete this._handlers[g] } } }; dhtmlx.PowerArray = { removeAt: function(c, a) { if (c >= 0) { this.splice(c, (a || 1)) } }, remove: function(a) { this.removeAt(this.find(a)) }, insertAt: function(c, e) { if (!e && e !== 0) { this.push(c) } else { var a = this.splice(e, (this.length - e)); this[e] = c; this.push.apply(this, a) } }, find: function(c) { for (var a = 0; a < this.length; a++) { if (c == this[a]) { return a } } return -1 }, each: function(a, e) { for (var c = 0; c < this.length; c++) { a.call((e || this), this[c]) } }, map: function(a, e) { for (var c = 0; c < this.length; c++) { this[c] = a.call((e || this), this[c]) } return this } }; dhtmlx.env = {}; if (navigator.userAgent.indexOf("Opera") != -1) { dhtmlx._isOpera = true } else { dhtmlx._isIE = !!document.all; dhtmlx._isFF = !document.all; dhtmlx._isWebKit = (navigator.userAgent.indexOf("KHTML") != -1); if (navigator.appVersion.indexOf("MSIE 8.0") != -1 && document.compatMode != "BackCompat") { dhtmlx._isIE = 8 } if (navigator.appVersion.indexOf("MSIE 9.0") != -1 && document.compatMode != "BackCompat") { dhtmlx._isIE = 9 } } dhtmlx.env = {}; (function() { dhtmlx.env.transform = false; dhtmlx.env.transition = false; var a = {}; a.names = ["transform", "transition"]; a.transform = ["transform", "WebkitTransform", "MozTransform", "oTransform", "msTransform"]; a.transition = ["transition", "WebkitTransition", "MozTransition", "oTransition"]; var g = document.createElement("DIV"); var e; for (var c = 0; c < a.names.length; c++) { while (p = a[a.names[c]].pop()) { if (typeof g.style[p] != "undefined") { dhtmlx.env[a.names[c]] = true } } } })(); dhtmlx.env.transform_prefix = (function() { var a; if (dhtmlx._isOpera) { a = "-o-" } else { a = ""; if (dhtmlx._isFF) { a = "-moz-" } if (dhtmlx._isWebKit) { a = "-webkit-" } } return a })(); dhtmlx.env.svg = (function() { return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") })(); dhtmlx.zIndex = { drag: 10000 }; dhtmlx.html = { create: function(c, a, e) { a = a || {}; var g = document.createElement(c); for (var h in a) { g.setAttribute(h, a[h]) } if (a.style) { g.style.cssText = a.style } if (a["class"]) { g.className = a["class"] } if (e) { g.innerHTML = e } return g }, getValue: function(a) { a = dhtmlx.toNode(a); if (!a) { return "" } return dhtmlx.isNotDefined(a.value) ? a.innerHTML : a.value }, remove: function(c) { if (c instanceof Array) { for (var a = 0; a < c.length; a++) { this.remove(c[a]) } } else { if (c && c.parentNode) { c.parentNode.removeChild(c) } } }, insertBefore: function(c, e, a) { if (!c) { return } if (e) { e.parentNode.insertBefore(c, e) } else { a.appendChild(c) } }, locate: function(c, h) { c = c || event; var a = c.target || c.srcElement; while (a) { if (a.getAttribute) { var g = a.getAttribute(h); if (g) { return g } } a = a.parentNode } return null }, offset: function(g) { if (g.getBoundingClientRect) { var m = g.getBoundingClientRect(); var n = document.body; var c = document.documentElement; var a = window.pageYOffset || c.scrollTop || n.scrollTop; var h = window.pageXOffset || c.scrollLeft || n.scrollLeft; var l = c.clientTop || n.clientTop || 0; var o = c.clientLeft || n.clientLeft || 0; var q = m.top + a - l; var e = m.left + h - o; return { y: Math.round(q), x: Math.round(e) } } else { var q = 0, e = 0; while (g) { q = q + parseInt(g.offsetTop, 10); e = e + parseInt(g.offsetLeft, 10); g = g.offsetParent } return { y: q, x: e } } }, pos: function(a) { a = a || event; if (a.pageX || a.pageY) { return { x: a.pageX, y: a.pageY } } var c = ((dhtmlx._isIE) && (document.compatMode != "BackCompat")) ? document.documentElement : document.body; return { x: a.clientX + c.scrollLeft - c.clientLeft, y: a.clientY + c.scrollTop - c.clientTop } }, preventEvent: function(a) { if (a && a.preventDefault) { a.preventDefault() } dhtmlx.html.stopEvent(a) }, stopEvent: function(a) { (a || event).cancelBubble = true; return false }, addCss: function(c, a) { c.className += " " + a }, removeCss: function(c, a) { c.className = c.className.replace(RegExp(a, "g"), "") } }; (function() { var a = document.getElementsByTagName("SCRIPT"); dhtmlx.assert(a.length, "Can't locate codebase"); if (a.length) { a = (a[a.length - 1].getAttribute("src") || "").split("/"); a.splice(a.length - 1, 1); dhtmlx.codebase = a.slice(0, a.length).join("/") + "/" } })(); if (!dhtmlx.ui) { dhtmlx.ui = {} } dhtmlx.Destruction = { _init: function() { dhtmlx.destructors.push(this) }, destructor: function(a) { 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 = {}; this.canvases = []; if (this.render) { this.render = function() {} } } }; dhtmlx.destructors = []; dhtmlx.event(window, "unload", function() { if (dhtmlx.destructors) { for (var e = 0; e < dhtmlx.destructors.length; e++) { dhtmlx.destructors[e].destructor(-1) } dhtmlx.destructors = [] } for (var c in dhtmlx._events) { var g = dhtmlx._events[c]; if (g[0].removeEventListener) { g[0].removeEventListener(g[1], g[2], false) } else { if (g[0].detachEvent) { g[0].detachEvent("on" + g[1], g[2]) } } delete dhtmlx._events[c] } }); dhtmlx.ajax = function(a, c, e) { if (arguments.length !== 0) { var g = new dhtmlx.ajax(); if (e) { g.master = e } g.get(a, null, c) } if (!this.getXHR) { return new dhtmlx.ajax() } return this }; dhtmlx.ajax.prototype = { getXHR: function() { if (dhtmlx._isIE) { return new ActiveXObject("Microsoft.xmlHTTP") } else { return new XMLHttpRequest() } }, send: function(h, o, m) { var c = this.getXHR(); if (typeof m == "function") { m = [m] } if (typeof o == "object") { var l = []; for (var e in o) { var n = o[e]; if (n === null || n === dhtmlx.undefined) { n = "" } l.push(e + "=" + encodeURIComponent(n)) } o = l.join("&") } if (o && !this.post) { h = h + (h.indexOf("?") != -1 ? "&" : "?") + o; o = null } c.open(this.post ? "POST" : "GET", h, !this._sync); if (this.post) { c.setRequestHeader("Content-type", "application/x-www-form-urlencoded") } var g = this; c.onreadystatechange = function() { if (!c.readyState || c.readyState == 4) { if (m && g) { for (var a = 0; a < m.length; a++) { if (m[a]) { m[a].call((g.master || g), c.responseText, c.responseXML, c) } } } g.master = null; m = g = null } }; c.send(o || null); return c }, get: function(a, e, c) { this.post = false; return this.send(a, e, c) }, post: function(a, e, c) { this.post = true; return this.send(a, e, c) }, sync: function() { this._sync = true; return this } }; dhtmlx.AtomDataLoader = { _init: function(a) { this.data = {}; if (a) { this._settings.datatype = a.datatype || "json"; this._after_init.push(this._load_when_ready) } }, _load_when_ready: function() { this._ready_for_data = true; if (this._settings.url) { this.url_setter(this._settings.url) } if (this._settings.data) { this.data_setter(this._settings.data) } }, url_setter: function(a) { if (!this._ready_for_data) { return a } this.load(a, this._settings.datatype); return a }, data_setter: function(a) { if (!this._ready_for_data) { return a } this.parse(a, this._settings.datatype); return true }, load: function(a, c) { this.callEvent("onXLS", []); if (typeof c == "string") { this.data.driver = dhtmlx.DataDriver[c]; c = arguments[2] } else { this.data.driver = dhtmlx.DataDriver[this._settings.datatype || "xml"] } if (window.dhx4) { return dhx4.ajax.get(a, dhtmlx.bind(function(g) { var e = g.xmlDoc; var l = e.responseText; var h = e.responseXML; if (this._onLoad) { this._onLoad.call(this, l, h, e) } if (c) { c.call(this, l, h, e) } }, this)) } else { dhtmlx.ajax(a, [this._onLoad, c], this) } }, parse: function(c, a) { this.callEvent("onXLS", []); this.data.driver = dhtmlx.DataDriver[a || "xml"]; this._onLoad(c, null) }, _onLoad: function(h, c, a) { var e = this.data.driver; var g = e.getRecords(e.toObject(h, c))[0]; this.data = (e ? e.getDetails(g) : h); this.callEvent("onXLE", []) }, _check_data_feed: function(c) { if (!this._settings.dataFeed || this._ignore_feed || !c) { return true } var a = this._settings.dataFeed; if (typeof a == "function") { return a.call(this, (c.id || c), c) } a = a + (a.indexOf("?") == -1 ? "?" : "&") + "action=get&id=" + encodeURIComponent(c.id || c); this.callEvent("onXLS", []); dhtmlx.ajax(a, function(g, e) { this._ignore_feed = true; this.setValues(dhtmlx.DataDriver.json.toObject(g)[0]); this._ignore_feed = false; this.callEvent("onXLE", []) }, this); return false } }; dhtmlx.DataDriver = {}; dhtmlx.DataDriver.json = { toObject: function(data) { if (!data) { data = "[]" } if (typeof data == "string") { eval("dhtmlx.temp=" + data); return dhtmlx.temp } return data }, getRecords: function(a) { if (a && a.data) { a = a.data } if (a && !(a instanceof Array)) { return [a] } return a }, getDetails: function(a) { return a }, getInfo: function(a) { return { _size: (a.total_count || 0), _from: (a.pos || 0), _key: (a.dhx_security) } } }; dhtmlx.DataDriver.json_ext = { toObject: function(data) { if (!data) { data = "[]" } if (typeof data == "string") { var temp; eval("temp=" + data); dhtmlx.temp = []; var header = temp.header; for (var i = 0; i < temp.data.length; i++) { var item = {}; for (var j = 0; j < header.length; j++) { if (typeof(temp.data[i][j]) != "undefined") { item[header[j]] = temp.data[i][j] } } dhtmlx.temp.push(item) } return dhtmlx.temp } return data }, getRecords: function(a) { if (a && !(a instanceof Array)) { return [a] } return a }, getDetails: function(a) { return a }, getInfo: function(a) { return { _size: (a.total_count || 0), _from: (a.pos || 0) } } }; dhtmlx.DataDriver.html = { toObject: function(c) { if (typeof c == "string") { var a = null; if (c.indexOf("<") == -1) { a = dhtmlx.toNode(c) } if (!a) { a = document.createElement("DIV"); a.innerHTML = c } return a.getElementsByTagName(this.tag) } return c }, getRecords: function(a) { if (a.tagName) { return a.childNodes } return a }, getDetails: function(a) { return dhtmlx.DataDriver.xml.tagToObject(a) }, getInfo: function(a) { return { _size: 0, _from: 0 } }, tag: "LI" }; dhtmlx.DataDriver.jsarray = { toObject: function(data) { if (typeof data == "string") { eval("dhtmlx.temp=" + data); return dhtmlx.temp } return data }, getRecords: function(a) { return a }, getDetails: function(e) { var a = {}; for (var c = 0; c < e.length; c++) { a["data" + c] = e[c] } return a }, getInfo: function(a) { return { _size: 0, _from: 0 } } }; dhtmlx.DataDriver.csv = { toObject: function(a) { return a }, getRecords: function(a) { return a.split(this.row) }, getDetails: function(e) { e = this.stringToArray(e); var a = {}; for (var c = 0; c < e.length; c++) { a["data" + c] = e[c] } return a }, getInfo: function(a) { return { _size: 0, _from: 0 } }, stringToArray: function(c) { c = c.split(this.cell); for (var a = 0; a < c.length; a++) { c[a] = c[a].replace(/^[ \t\n\r]*(\"|)/g, "").replace(/(\"|)[ \t\n\r]*$/g, "") } return c }, row: "\n", cell: "," }; dhtmlx.DataDriver.xml = { toObject: function(c, a) { if (a && (a = this.checkResponse(c, a))) { return a } if (typeof c == "string") { return this.fromString(c) } return c }, getRecords: function(a) { return this.xpath(a, this.records) }, records: "/*/item", getDetails: function(a) { return this.tagToObject(a, {}) }, getInfo: function(a) { return { _size: (a.documentElement.getAttribute("total_count") || 0), _from: (a.documentElement.getAttribute("pos") || 0), _key: (a.documentElement.getAttribute("dhx_security")) } }, xpath: function(h, 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(e, o) { o = o || {}; var h = false; var c = e.childNodes; var n = {}; for (var m = 0; m < c.length; m++) { if (c[m].nodeType == 1) { var l = c[m].tagName; if (typeof o[l] != "undefined") { if (!(o[l] instanceof Array)) { o[l] = [o[l]] } o[l].push(this.tagToObject(c[m], {})) } else { o[c[m].tagName] = this.tagToObject(c[m], {}) } h = true } } var g = e.attributes; if (g && g.length) { for (var m = 0; m < g.length; m++) { o[g[m].name] = g[m].value } h = true } if (!h) { return this.nodeValue(e) } o.value = this.nodeValue(e); return o }, nodeValue: function(a) { if (a.firstChild) { return a.firstChild.wholeText || a.firstChild.data } return "" }, fromString: function(c) { if (window.DOMParser && !dhtmlx._isIE) { return (new DOMParser()).parseFromString(c, "text/xml") } if (window.ActiveXObject) { var a = new ActiveXObject("Microsoft.xmlDOM"); a.loadXML(c); return a } dhtmlx.error("Load from xml string is not supported") }, checkResponse: function(g, e) { if (e && (e.firstChild && e.firstChild.tagName != "parsererror")) { return e } var c = this.fromString(g.replace(/^[\s]+/, "")); if (c) { return c } dhtmlx.error("xml can't be parsed", g) } }; dhtmlx.DataLoader = { _init: function(a) { a = a || ""; this.name = "DataStore"; this.data = (a.datastore) || (new dhtmlx.DataStore()); this._readyHandler = this.data.attachEvent("onStoreLoad", dhtmlx.bind(this._call_onready, this)) }, load: function(a, c) { dhtmlx.AtomDataLoader.load.apply(this, arguments); if (!this.data.feed) { this.data.feed = function(g, e) { if (this._load_count) { return this._load_count = [g, e] } else { this._load_count = true } this.load(a + ((a.indexOf("?") == -1) ? "?" : "&") + "posStart=" + g + "&count=" + e, function() { var h = this._load_count; this._load_count = false; if (typeof h == "object") { this.data.feed.apply(this, h) } }) } } }, _onLoad: function(e, c, a) { this.data._parse(this.data.driver.toObject(e, c)); this.callEvent("onXLE", []); if (this._readyHandler) { this.data.detachEvent(this._readyHandler); this._readyHandler = null } }, dataFeed_setter: function(a) { this.data.attachEvent("onBeforeFilter", dhtmlx.bind(function(m, l) { if (this._settings.dataFeed) { var h = {}; if (!m && !h) { return } if (typeof m == "function") { if (!l) { return } m(l, h) } else { h = { text: l } } this.clearAll(); var c = this._settings.dataFeed; if (typeof c == "function") { return c.call(this, l, h) } var g = []; for (var e in h) { g.push("dhx_filter[" + e + "]=" + encodeURIComponent(h[e])) } this.load(c + (c.indexOf("?") < 0 ? "?" : "&") + g.join("&"), this._settings.datatype); return false } }, this)); return a }, _call_onready: function() { if (this._settings.ready) { var a = dhtmlx.toFunctor(this._settings.ready); if (a && a.call) { a.apply(this, arguments) } } } }; dhtmlx.DataStore = function() { this.name = "DataStore"; dhtmlx.extend(this, dhtmlx.EventSystem); this.setDriver("xml"); this.pull = {}; this.order = dhtmlx.toArray() }; dhtmlx.DataStore.prototype = { setDriver: function(a) { dhtmlx.assert(dhtmlx.DataDriver[a], "incorrect DataDriver"); this.driver = dhtmlx.DataDriver[a] }, _parse: function(h) { this.callEvent("onParse", [this.driver, h]); if (this._filter_order) { this.filter() } var l = this.driver.getInfo(h); if (l._key) { dhtmlx.security_key = l._key } var g = this.driver.getRecords(h); var n = (l._from || 0) * 1; if (n === 0 && this.order[0]) { n = this.order.length } var c = 0; for (var e = 0; e < g.length; e++) { var a = this.driver.getDetails(g[e]); var m = this.id(a); if (!this.pull[m]) { this.order[c + n] = m; c++ } this.pull[m] = a; if (this.extraParser) { this.extraParser(a) } if (this._scheme) { if (this._scheme.$init) { this._scheme.$update(a) } else { if (this._scheme.$update) { this._scheme.$update(a) } } } } for (var e = 0; e < l._size; e++) { if (!this.order[e]) { var m = dhtmlx.uid(); var a = { id: m, $template: "loading" }; this.pull[m] = a; this.order[e] = m } } this.callEvent("onStoreLoad", [this.driver, h]); this.refresh() }, id: function(a) { return a.id || (a.id = dhtmlx.uid()) }, changeId: function(c, a) { dhtmlx.assert(this.pull[c], "Can't change id, for non existing item: " + c); this.pull[a] = this.pull[c]; this.pull[a].id = a; this.order[this.order.find(c)] = a; if (this._filter_order) { this._filter_order[this._filter_order.find(c)] = a } this.callEvent("onIdChange", [c, a]); if (this._render_change_id) { this._render_change_id(c, a) } }, get: function(a) { return this.item(a) }, set: function(c, a) { return this.update(c, a) }, item: function(a) { return this.pull[a] }, update: function(c, a) { if (this._scheme && this._scheme.$update) { this._scheme.$update(a) } if (this.callEvent("onBeforeUpdate", [c, a]) === false) { return false } this.pull[c] = a; this.refresh(c) }, refresh: function(a) { if (this._skip_refresh) { return } if (a) { this.callEvent("onStoreUpdated", [a, this.pull[a], "update"]) } else { this.callEvent("onStoreUpdated", [null, null, null]) } }, silent: function(a) { this._skip_refresh = true; a.call(this); this._skip_refresh = false }, getRange: function(g, e) { if (g) { g = this.indexById(g) } else { g = this.startOffset || 0 } if (e) { e = this.indexById(e) } else { e = Math.min((this.endOffset || Infinity), (this.dataCount() - 1)); if (e < 0) { e = 0 } } if (this.min) { g = this.min } if (this.max) { e = this.max } if (g > e) { var c = e; e = g; g = c } return this.getIndexRange(g, e) }, getIndexRange: function(g, e) { e = Math.min((e || Infinity), this.dataCount() - 1); var a = dhtmlx.toArray(); for (var c = (g || 0); c <= e; c++) { a.push(this.item(this.order[c])) } return a }, dataCount: function() { return this.order.length }, exists: function(a) { return !!(this.pull[a]) }, move: function(a, g) { if (a < 0 || g < 0) { dhtmlx.error("DataStore::move", "Incorrect indexes"); return } var e = this.idByIndex(a); var c = this.item(e); this.order.removeAt(a); this.order.insertAt(e, Math.min(this.order.length, g)); this.callEvent("onStoreUpdated", [e, c, "move"]) }, scheme: function(a) { this._scheme = a }, sync: function(h, g, a) { if (typeof g != "function") { a = g; g = null } if (dhtmlx.debug_bind) { this.debug_sync_master = h; dhtmlx.log("[sync] " + this.debug_bind_master.name + "@" + this.debug_bind_master._settings.id + " <= " + this.debug_sync_master.name + "@" + this.debug_sync_master._settings.id) } var e = h; if (h.name != "DataStore") { h = h.data } var c = dhtmlx.bind(function(n, l, m) { if (m != "update" || g) { n = null } if (!n) { this.order = dhtmlx.toArray([].concat(h.order)); this._filter_order = null; this.pull = h.pull; if (g) { this.silent(g) } if (this._on_sync) { this._on_sync() } } if (dhtmlx.debug_bind) { dhtmlx.log("[sync:request] " + this.debug_sync_master.name + "@" + this.debug_sync_master._settings.id + " <= " + this.debug_bind_master.name + "@" + this.debug_bind_master._settings.id) } if (!a) { this.refresh(n) } else { a = false } }, this); h.attachEvent("onStoreUpdated", c); this.feed = function(m, l) { e.loadNext(l, m) }; c() }, add: function(h, a) { if (this._scheme) { h = h || {}; for (var c in this._scheme) { h[c] = h[c] || this._scheme[c] } if (this._scheme) { if (this._scheme.$init) { this._scheme.$update(h) } else { if (this._scheme.$update) { this._scheme.$update(h) } } } } var l = this.id(h); var g = this.dataCount(); if (dhtmlx.isNotDefined(a) || a < 0) { a = g } if (a > g) { dhtmlx.log("Warning", "DataStore:add", "Index of out of bounds"); a = Math.min(this.order.length, a) } if (this.callEvent("onBeforeAdd", [l, h, a]) === false) { return false } if (this.exists(l)) { return dhtmlx.error("Not unique ID") } this.pull[l] = h; this.order.insertAt(l, a); if (this._filter_order) { var e = this._filter_order.length; if (!a && this.order.length) { e = 0 } this._filter_order.insertAt(l, e) } this.callEvent("onafterAdd", [l, a]); this.callEvent("onStoreUpdated", [l, h, "add"]); return l }, remove: function(e) { if (e instanceof Array) { for (var a = 0; a < e.length; a++) { this.remove(e[a]) } return } if (this.callEvent("onBeforeDelete", [e]) === false) { return false } if (!this.exists(e)) { return dhtmlx.error("Not existing ID", e) } var c = this.item(e); this.order.remove(e); if (this._filter_order) { this._filter_order.remove(e) } delete this.pull[e]; this.callEvent("onafterdelete", [e]); this.callEvent("onStoreUpdated", [e, c, "delete"]) }, clearAll: function() { this.pull = {}; this.order = dhtmlx.toArray(); this.feed = null; this._filter_order = null; this.callEvent("onClearAll", []); this.refresh() }, idByIndex: function(a) { if (a >= this.order.length || a < 0) { dhtmlx.log("Warning", "DataStore::idByIndex Incorrect index") } return this.order[a] }, indexById: function(c) { var a = this.order.find(c); return a }, next: function(c, a) { return this.order[this.indexById(c) + (a || 1)] }, first: function() { return this.order[0] }, last: function() { return this.order[this.order.length - 1] }, previous: function(c, a) { return this.order[this.indexById(c) - (a || 1)] }, sort: function(l, c, a) { var e = l; if (typeof l == "function") { e = { as: l, dir: c } } else { if (typeof l == "string") { e = { by: l, dir: c, as: a } } } var h = [e.by, e.dir, e.as]; if (!this.callEvent("onbeforesort", h)) { return } if (this.order.length) { var m = dhtmlx.sort.create(e); var g = this.getRange(this.first(), this.last()); g.sort(m); this.order = g.map(function(n) { return this.id(n) }, this) } this.refresh(); this.callEvent("onaftersort", h) }, filter: function(h, g) { if (!this.callEvent("onBeforeFilter", [h, g])) { return } if (this._filter_order) { this.order = this._filter_order; delete this._filter_order } if (!this.order.length) { return } if (h) { var c = h; g = g || ""; if (typeof h == "string") { h = dhtmlx.Template.fromHTML(h); g = g.toString().toLowerCase(); c = function(n, m) { return h(n).toLowerCase().indexOf(m) != -1 } } var e = dhtmlx.toArray(); for (var a = 0; a < this.order.length; a++) { var l = this.order[a]; if (c(this.item(l), g)) { e.push(l) } } this._filter_order = this.order; this.order = e } this.refresh(); this.callEvent("onAfterFilter", []) }, each: function(e, c) { for (var a = 0; a < this.order.length; a++) { e.call((c || this), this.item(this.order[a])) } }, provideApi: function(g, c) { this.debug_bind_master = g; if (c) { this.mapEvent({ onbeforesort: g, onaftersort: g, onbeforeadd: g, onafteradd: g, onbeforedelete: g, onafterdelete: g, onbeforeupdate: g }) } var e = ["get", "set", "sort", "add", "remove", "exists", "idByIndex", "indexById", "item", "update", "refresh", "dataCount", "filter", "next", "previous", "clearAll", "first", "last", "serialize"]; for (var a = 0; a < e.length; a++) { g[e[a]] = dhtmlx.methodPush(this, e[a]) } if (dhtmlx.assert_enabled()) { this.assert_event(g) } }, serialize: function() { var e = this.order; var a = []; for (var c = 0; c < e.length; c++) { a.push(this.pull[e[c]]) } return a } }; dhtmlx.sort = { create: function(a) { return dhtmlx.sort.dir(a.dir, dhtmlx.sort.by(a.by, a.as)) }, as: { "int": function(e, c) { e = e * 1; c = c * 1; return e > c ? 1 : (e < c ? -1 : 0) }, string_strict: function(e, c) { e = e.toString(); c = c.toString(); return e > c ? 1 : (e < c ? -1 : 0) }, string: function(e, c) { e = e.toString().toLowerCase(); c = c.toString().toLowerCase(); return e > c ? 1 : (e < c ? -1 : 0) } }, by: function(c, a) { if (!c) { return a } if (typeof a != "function") { a = dhtmlx.sort.as[a || "string"] } c = dhtmlx.Template.fromHTML(c); return function(g, e) { return a(c(g), c(e)) } }, dir: function(c, a) { if (c == "asc") { return a } return function(g, e) { return a(g, e) * -1 } } }; dhtmlx.KeyEvents = { _init: function() { dhtmlx.event(this._obj, "keypress", this._onKeyPress, this) }, _onKeyPress: function(c) { c = c || event; var a = c.which || c.keyCode; this.callEvent((this._edit_id ? "onEditKeyPress" : "onKeyPress"), [a, c.ctrlKey, c.shiftKey, c]) } }; dhtmlx.MouseEvents = { _init: function() { if (this.on_click) { dhtmlx.event(this._obj, "click", this._onClick, this); dhtmlx.event(this._obj, "contextmenu", this._onContext, this) } if (this.on_dblclick) { dhtmlx.event(this._obj, "dblclick", this._onDblClick, this) } if (this.on_mouse_move) { dhtmlx.event(this._obj, "mousemove", this._onMouse, this); dhtmlx.event(this._obj, (dhtmlx._isIE ? "mouseleave" : "mouseout"), this._onMouse, this) } }, _onClick: function(a) { return this._mouseEvent(a, this.on_click, "ItemClick") }, _onDblClick: function(a) { return this._mouseEvent(a, this.on_dblclick, "ItemDblClick") }, _onContext: function(a) { var c = dhtmlx.html.locate(a, this._id); if (c && !this.callEvent("onBeforeContextMenu", [c, a])) { return dhtmlx.html.preventEvent(a) } }, _onMouse: function(a) { if (dhtmlx._isIE) { a = document.createEventObject(event) } if (this._mouse_move_timer) { window.clearTimeout(this._mouse_move_timer) } this.callEvent("onMouseMoving", [a]); this._mouse_move_timer = window.setTimeout(dhtmlx.bind(function() { if (a.type == "mousemove") { this._onMouseMove(a) } else { this._onMouseOut(a) } }, this), 500) }, _onMouseMove: function(a) { if (!this._mouseEvent(a, this.on_mouse_move, "MouseMove")) { this.callEvent("onMouseOut", [a || event]) } }, _onMouseOut: function(a) { this.callEvent("onMouseOut", [a || event]) }, _mouseEvent: function(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, m]) } 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 e = this[c + "_setter"]; return this._settings[c] = e ? e.call(this, a) : a }, _parseSeetingColl: function(e) { if (e) { for (var c in e) { this._define(c, e[c]) } } }, _parseSettings: function(e, a) { var c = dhtmlx.extend({}, a); if (typeof e == "object" && !e.tagName) { dhtmlx.extend(c, e) } this._parseSeetingColl(c) }, _mergeSettings: function(a, e) { for (var c in e) { switch (typeof a[c]) { case "object": a[c] = this._mergeSettings((a[c] || {}), e[c]); break; case "undefined": a[c] = e[c]; break; default: break } } return a }, _parseContainer: function(c, a, e) { if (typeof c == "object" && !c.tagName) { c = c.container } this._obj = this.$view = dhtmlx.toNode(c); if (!this._obj && e) { this._obj = e(c) } dhtmlx.assert(this._obj, "Incorrect html container"); this._obj.className += " " + a; this._obj.onselectstart = function() { return false }; this._dataobj = this._obj }, _set_type: function(a) { if (typeof a == "object") { return this.type_setter(a) } dhtmlx.assert(this.types, "RenderStack :: Types are not defined"); dhtmlx.assert(this.types[a], "RenderStack :: Inccorect type name", a); this.type = dhtmlx.extend({}, this.types[a]); this.customize() }, customize: function(a) { if (a) { dhtmlx.extend(this.type, a) } this.type._item_start = dhtmlx.Template.fromHTML(this.template_item_start(this.type)); this.type._item_end = this.template_item_end(this.type); this.render() }, type_setter: function(a) { this._set_type(typeof a == "object" ? dhtmlx.Type.add(this, a) : a); return a }, template_setter: function(a) { return this.type_setter({ template: a }) }, css_setter: function(a) { this._obj.className += " " + a; return a } }; dhtmlx.Template = { _cache: {}, empty: function() { return "" }, setter: function(a) { return dhtmlx.Template.fromHTML(a) }, obj_setter: function(c) { var a = dhtmlx.Template.setter(c); var e = this; return function() { return a.apply(e, arguments) } }, fromHTML: function(a) { if (typeof a == "function") { return a } if (this._cache[a]) { return this._cache[a] } a = (a || "").toString(); a = a.replace(/[\r\n]+/g, "\\n"); a = a.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g, '"+(obj.$1?"$2":"$3")+"'); a = a.replace(/\{common\.([^}\(]*)\}/g, '"+common.$1+"'); a = a.replace(/\{common\.([^\}\(]*)\(\)\}/g, '"+(common.$1?common.$1(obj):"")+"'); a = a.replace(/\{obj\.([^}]*)\}/g, '"+obj.$1+"'); a = a.replace(/#([a-z0-9_]+)#/gi, '"+obj.$1+"'); a = a.replace(/\{obj\}/g, '"+obj+"'); a = a.replace(/\{-obj/g, "{obj"); a = a.replace(/\{-common/g, "{common"); a = 'return "' + a + '";'; return this._cache[a] = Function("obj", "common", a) } }; dhtmlx.Type = { add: function(e, c) { if (!e.types && e.prototype.types) { e = e.prototype } if (dhtmlx.assert_enabled()) { this.assert_event(c) } var a = c.name || "default"; this._template(c); this._template(c, "edit"); this._template(c, "loading"); e.types[a] = dhtmlx.extend(dhtmlx.extend({}, (e.types[a] || this._default)), c); return a }, _default: { css: "default", template: function() { return "" }, template_edit: function() { return "" }, template_loading: function() { return "..." }, width: 150, height: 80, margin: 5, padding: 0 }, _template: function(e, a) { a = "template" + (a ? ("_" + a) : ""); var c = e[a]; if (c && (typeof c == "string")) { if (c.indexOf("->") != -1) { c = c.split("->"); switch (c[0]) { case "html": c = dhtmlx.html.getValue(c[1]).replace(/\"/g, '\\"'); break; case "http": c = new dhtmlx.ajax().sync().get(c[1], { uid: (new Date()).valueOf() }).responseText; break; default: break } } e[a] = dhtmlx.Template.fromHTML(c) } } }; dhtmlx.SingleRender = { _init: function() {}, _toHTML: function(a) { return this.type._item_start(a, this.type) + this.type.template(a, this.type) + this.type._item_end }, render: function() { if (!this.callEvent || this.callEvent("onBeforeRender", [this.data])) { if (this.data) { this._dataobj.innerHTML = this._toHTML(this.data) } if (this.callEvent) { this.callEvent("onAfterRender", []) } } } }; dhtmlx.ui.Tooltip = function(a) { this.name = "Tooltip"; if (dhtmlx.assert_enabled()) { this._assert() } if (typeof a == "string") { a = { template: a } } dhtmlx.extend(this, dhtmlx.Settings); dhtmlx.extend(this, dhtmlx.SingleRender); this._parseSettings(a, { type: "default", dy: 0, dx: 20 }); this._dataobj = this._obj = document.createElement("DIV"); this._obj.className = "dhx_tooltip"; dhtmlx.html.insertBefore(this._obj, document.body.firstChild) }; dhtmlx.ui.Tooltip.prototype = { show: function(a, c) { if (this._disabled) { return } if (this.data != a) { this.data = a; this.render(a) } this._obj.style.top = c.y + this._settings.dy + "px"; this._obj.style.left = c.x + this._settings.dx + "px"; this._obj.style.display = "block" }, hide: function() { this.data = null; this._obj.style.display = "none" }, disable: function() { this._disabled = true }, enable: function() { this._disabled = false }, types: { "default": dhtmlx.Template.fromHTML("{obj.id}") }, template_item_start: dhtmlx.Template.empty, template_item_end: dhtmlx.Template.empty }; dhtmlx.AutoTooltip = { tooltip_setter: function(c) { var a = new dhtmlx.ui.Tooltip(c); this.attachEvent("onMouseMove", function(h, g) { a.show(this.get(h), dhtmlx.html.pos(g)) }); this.attachEvent("onMouseOut", function(h, g) { a.hide() }); this.attachEvent("onMouseMoving", function(h, g) { a.hide() }); return a } }; dhtmlx.compat = function(a, c) { if (dhtmlx.compat[a]) { dhtmlx.compat[a](c) } }; if (!dhtmlx.attaches) { dhtmlx.attaches = {} } dhtmlx.attaches.attachAbstract = function(c, a) { var h = document.createElement("DIV"); h.id = "CustomObject_" + dhtmlx.uid(); h.style.width = "100%"; h.style.height = "100%"; h.cmp = "grid"; document.body.appendChild(h); this.attachObject(h.id); a.container = h.id; var g = this.vs[this.av]; g.grid = new window[c](a); g.gridId = h.id; g.gridObj = h; g.grid.setSizes = function() { if (this.resize) { this.resize() } else { this.render() } }; var e = "_viewRestore"; return this.vs[this[e]()].grid }; dhtmlx.attaches.attachDataView = function(a) { return this.attachAbstract("dhtmlXDataView", a) }; dhtmlx.attaches.attachChart = function(a) { return this.attachAbstract("dhtmlXChart", a) }; dhtmlx.compat.layout = function() {}; function dhtmlXCellObject(e, a) { this.cell = document.createElement("DIV"); this.cell.className = "dhx_cell" + (a || ""); this._idd = e; this._isCell = true; this.conf = { borders: true, idx: {}, css: a || "", idx_data: { cont: "dhx_cell_cont", pr1: "dhx_cell_progress_bar", pr2: "dhx_cell_progress_img", pr3: "dhx_cell_progress_svg", menu: "dhx_cell_menu", toolbar: "dhx_cell_toolbar", ribbon: "dhx_cell_ribbon", sb: "dhx_cell_statusbar", cover: "dhx_cell_cover" }, ofs_nodes: { t: {}, b: {} } }; this.dataNodes = {}; this.views = {}; var c = document.createElement("DIV"); c.className = "dhx_cell_cont" + this.conf.css; this.cell.appendChild(c); c = null; this._updateIdx = function() { for (var g in this.conf.idx) { this.conf.idx[g] = null; delete this.conf.idx[g] } for (var m = 0; m < this.cell.childNodes.length; m++) { var h = this.cell.childNodes[m].className; for (var g in this.conf.idx_data) { var l = new RegExp(this.conf.idx_data[g]); if (h.match(l) != null) { this.conf.idx[g] = m } } } this.callEvent("_onIdxUpdated", []) }; this._adjustAttached = function() { for (var g in this.dataNodes) { if (this.dataNodes[g] != null && typeof(this.dataNodes[g].setSizes) == "function") { this.dataNodes[g].setSizes() } } if (this.dataObj != null && typeof(this.dataObj.setSizes) == "function") { if (this.dataType == "layout" && typeof(window.dhtmlXLayoutCell) == "function" && this instanceof window.dhtmlXLayoutCell && this.dataObj._getMainInst() != this.layout._getMainInst()) { this.dataObj.setSizes(); return } this.dataObj.setSizes.apply(this.dataObj, arguments) } }; this._setSize = function(u, r, v, n, o, q, l, m) { if (this.conf.size == null) { this.conf.size = {} } if (m == null) { m = {} } var A = { left: "x", top: "y", width: "w", height: "h" }; this.conf.size.x = u; this.conf.size.y = r; this.conf.size.w = Math.max(v, 0); this.conf.size.h = Math.max(n, 0); for (var s in A) { var g = (m[s] || s); this.cell.style[g] = this.conf.size[A[s]] + "px" } this.callEvent("_onSetSize", []); if (q !== true) { this._adjustCont(o, l) } else { this._adjustAttached(o) } this._adjustProgress() }; this._adjustCont = function(o, m) { var n = this.cell.childNodes[this.conf.idx.cont]; if (typeof(window.dhtmlXLayoutCell) == "function" && this instanceof window.dhtmlXLayoutCell && this.conf.collapsed == true) { n.style.left = n.style.top = "0px"; n.style.width = n.style.height = "200px"; n = null; return } var l = 0; for (var g in this.conf.ofs_nodes.t) { var h = this.conf.ofs_nodes.t[g]; l += (h == "func" ? this[g]() : (h == true ? this.cell.childNodes[this.conf.idx[g]].offsetHeight : 0)) } var q = 0; for (var g in this.conf.ofs_nodes.b) { var h = this.conf.ofs_nodes.b[g]; q += (h == "func" ? this[g]() : (h == true ? this.cell.childNodes[this.conf.idx[g]].offsetHeight : 0)) } n.style.left = "0px"; n.style.top = l + "px"; if (this.conf.cells_cont == null) { this.conf.cells_cont = {}; n.style.width = this.cell.offsetWidth + "px"; n.style.height = Math.max(this.cell.offsetHeight - l - q, 0) + "px"; this.conf.cells_cont.w = parseInt(n.style.width) - n.offsetWidth; this.conf.cells_cont.h = parseInt(n.style.height) - n.offsetHeight } n.style.left = "0px"; n.style.top = l + "px"; n.style.width = Math.max(this.cell.offsetWidth + this.conf.cells_cont.w, 0) + "px"; n.style.height = Math.max(this.conf.size.h - l - q + this.conf.cells_cont.h, 0) + "px"; n = null; this._adjustAttached(o); if (m == "expand" && this.dataType == "editor" && this.dataObj != null) { this.dataObj._prepareContent(true) } }; this._mtbUpdBorder = function() { var h = ["menu", "toolbar", "ribbon"]; for (var m = 0; m < h.length; m++) { if (this.conf.idx[h[m]] != null) { var n = this.cell.childNodes[this.conf.idx[h[m]]]; var l = "dhx_cell_" + h[m] + "_no_borders"; var g = "dhx_cell_" + h[m] + "_def"; n.className = n.className.replace(new RegExp(this.conf.borders ? l : g), this.conf.borders ? g : l); n = 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(l) { this.views[l] = { borders: this.conf.borders, ofs_nodes: { t: {}, b: {} }, url_data: this.conf.url_data, dataType: this.dataType, dataObj: this.dataObj, cellCont: [], dataNodes: {}, dataNodesCont: {} }; var m = this.cell.childNodes[this.conf.idx.cont]; while (m.childNodes.length > 0) { this.views[l].cellCont.push(m.firstChild); m.removeChild(m.firstChild) } m = null; this.dataType = null; this.dataObj = null; this.conf.url_data = null; for (var h in this.dataNodes) { for (var g in this.conf.ofs_nodes) { if (typeof(this.conf.ofs_nodes[g][h]) != "undefined") { this.views[l].ofs_nodes[g][h] = this.conf.ofs_nodes[g][h]; this.conf.ofs_nodes[g][h] = null; delete this.conf.ofs_nodes[g][h] } } this.views[l].dataNodesCont[h] = this.cell.childNodes[this.conf.idx[h]]; this.cell.removeChild(this.cell.childNodes[this.conf.idx[h]]); this.views[l].dataNodes[h] = this.dataNodes[h]; this.dataNodes[h] = null; delete this.dataNodes[h]; this._updateIdx() } this.callEvent("_onViewSave", [l]) }; this._viewRestore = function(l) { if (this.views[l] == null) { return } this.dataObj = this.views[l].dataObj; this.dataType = this.views[l].dataType; this.conf.url_data = this.views[l].url_data; for (var m = 0; m < this.views[l].cellCont.length; m++) { this.cell.childNodes[this.conf.idx.cont].appendChild(this.views[l].cellCont[m]) } for (var h in this.views[l].dataNodes) { this.dataNodes[h] = this.views[l].dataNodes[h]; if (h == "menu") { this.cell.insertBefore(this.views[l].dataNodesCont[h], this.cell.childNodes[this.conf.idx.toolbar || this.conf.idx.cont]) } if (h == "toolbar") { this.cell.insertBefore(this.views[l].dataNodesCont[h], this.cell.childNodes[this.conf.idx.cont]) } if (h == "ribbon") { this.cell.insertBefore(this.views[l].dataNodesCont[h], this.cell.childNodes[this.conf.idx.cont]) } if (h == "sb") { this.cell.appendChild(this.views[l].dataNodesCont[h]) } this._updateIdx() } for (var h in this.views[l].ofs_nodes) { for (var g in this.views[l].ofs_nodes[h]) { this.conf.ofs_nodes[h][g] = this.views[l].ofs_nodes[h][g] } } if (this.conf.borders != this.views[l].borders) { this[this.views[l].borders ? "_showBorders" : "_hideBorders"](true) } if (this.dataType == "url" && this.conf.url_data != null && this.conf.url_data.ajax == false && this.conf.url_data.post_data != null) { this.reloadURL() } this.callEvent("_onViewRestore", [l]); this._viewDelete(l) }; this._viewDelete = function(l) { if (this.views[l] == null) { return } this.views[l].borders = null; for (var h in this.views[l].ofs_nodes) { for (var g in this.views[l].ofs_nodes[h]) { this.views[l].ofs_nodes[h][g] = null } this.views[l].ofs_nodes[h] = null } this.views[l].dataType = null; this.views[l].dataObj = null; this.views[l].url_data = null; for (var m = 0; m < this.views[l].cellCont.length; m++) { this.views[l].cellCont[m] = null } this.views[l].cellCont = null; for (var h in this.views[l].dataNodes) { this.views[l].dataNodes[h] = null; this.views[l].dataNodesCont[h] = null } this.views[l].dataNodes = this.views[l].dataNodesCont = null; this.views[l] = null; delete this.views[l] }; window.dhx4._eventable(this); this._updateIdx(); return this } dhtmlXCellObject.prototype.showView = function(a) { if (this.conf.view == a) { return false } this._viewSave(this.conf.view); this._viewRestore(a); this._updateIdx(); this._adjustCont(); this.conf.view = a; var c = (typeof(this.conf.views_loaded[this.conf.view]) == "undefined"); this.conf.views_loaded[this.conf.view] = true; return c }; dhtmlXCellObject.prototype.getViewName = function() { return this.conf.view }; dhtmlXCellObject.prototype.unloadView = function(g) { if (g == this.conf.view) { var h = this.conf.unloading; this.conf.unloading = true; if (typeof(this.detachMenu) == "function") { this.detachMenu() } if (typeof(this.detachToolbar) == "function") { this.detachToolbar() } if (typeof(this.detachRibbon) == "function") { this.detachRibbon() } this.detachStatusBar(); this._detachObject(null, true); this.conf.unloading = h; if (!this.conf.unloading) { this._adjustCont(this._idd) } return } if (this.views[g] == null) { return } var e = this.views[g]; for (var c in e.dataNodes) { if (typeof(e.dataNodes[c].unload) == "function") { e.dataNodes[c].unload() } e.dataNodes[c] = null; e.dataNodesCont[c] = null } if (e.dataType == "url") { if (e.cellCont != null && e.cellCont[0] != "null") { this._detachURLEvents(e.cellCont[0]) } } else { if (e.dataObj != null) { if (typeof(e.dataObj.unload) == "function") { e.dataObj.unload() } else { if (typeof(e.dataObj.destructor) == "function") { e.dataObj.destructor() } } e.dataObj = null } } e = null; this._viewDelete(g); if (typeof(this.conf.views_loaded[g]) != "undefined") { delete this.conf.views_loaded[g] } }; dhtmlXCellObject.prototype.getId = function() { return this._idd }; dhtmlXCellObject.prototype.progressOn = function() { if (this.conf.progress == true) { return } this.conf.progress = true; var c = document.createElement("DIV"); c.className = this.conf.idx_data.pr1; var a = document.createElement("DIV"); if (this.conf.skin == "material" && (window.dhx4.isFF || window.dhx4.isChrome || window.dhx4.isOpera || window.dhx4.isEdge)) { a.className = this.conf.idx_data.pr3; a.innerHTML = '' } else { a.className = this.conf.idx_data.pr2 } if (this.conf.idx.cover != null) { this.cell.insertBefore(a, this.cell.childNodes[this.conf.idx.cover]) } else { this.cell.appendChild(a) } this.cell.insertBefore(c, a); c = a = null; this._updateIdx(); this._adjustProgress() }; dhtmlXCellObject.prototype.progressOff = function() { if (this.conf.progress != true) { return } for (var c in { pr3: 3, pr2: 2, pr1: 1 }) { var e = this.cell.childNodes[this.conf.idx[c]]; if (e != null) { e.parentNode.removeChild(e) } e = null } 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] || this.cell.childNodes[this.conf.idx.pr3]; if (!this.conf.pr.ofs) { a.style.width = c.offsetWidth + "px"; a.style.height = c.offsetHeight + "px"; this.conf.pr.ofs = { w: a.offsetWidth - a.clientWidth, h: a.offsetHeight - a.clientHeight } } a.style.width = c.offsetWidth - this.conf.pr.ofs.w + "px"; a.style.height = c.offsetHeight - this.conf.pr.ofs.h + "px"; c = a = null }; dhtmlXCellObject.prototype._showCellCover = function() { if (this.conf.cover == true) { return } this.conf.cover = true; var a = document.createElement("DIV"); a.className = this.conf.idx_data.cover; this.cell.appendChild(a); a = null; this._updateIdx() }; dhtmlXCellObject.prototype._hideCellCover = function() { if (this.conf.cover != true) { return } this.cell.removeChild(this.cell.childNodes[this.conf.idx.cover]); this._updateIdx(); this.conf.cover = false }; dhtmlXCellObject.prototype._showBorders = function(a) { if (this.conf.borders) { return } this.conf.borders = true; this.cell.childNodes[this.conf.idx.cont].className = "dhx_cell_cont" + this.conf.css; this.conf.cells_cont = null; this._mtbUpdBorder(); this.callEvent("_onBorderChange", [true]); if (a !== true) { this._adjustCont(this._idd) } }; dhtmlXCellObject.prototype._hideBorders = function(a) { if (!this.conf.borders) { return } this.conf.borders = false; this.cell.childNodes[this.conf.idx.cont].className = "dhx_cell_cont" + this.conf.css + " dhx_cell_cont_no_borders"; this.conf.cells_cont = null; this._mtbUpdBorder(); this.callEvent("_onBorderChange", [false]); if (a !== true) { this._adjustCont(this._idd) } }; dhtmlXCellObject.prototype._getWidth = function() { return this.cell.offsetWidth }; dhtmlXCellObject.prototype._getHeight = function() { return this.cell.offsetHeight }; dhtmlXCellObject.prototype.showInnerScroll = function() { this.cell.childNodes[this.conf.idx.cont].style.overflow = "auto" }; dhtmlXCellObject.prototype._unload = function() { this.conf.unloading = true; this.callEvent("_onCellUnload", []); this.progressOff(); this.unloadView(this.conf.view); this.dataNodes = null; this.cell.parentNode.removeChild(this.cell); this.cell = null; window.dhx4._eventable(this, "clear"); for (var c in this.views) { this.unloadView(c) } this.conf = null; for (var c in this) { this[c] = null } }; dhtmlXCellObject.prototype.attachObject = function(g, e) { if (window.dhx4.s2b(e) && !(typeof(window.dhtmlXWindowsCell) == "function" && this instanceof window.dhtmlXWindowsCell)) { e = false } if (typeof(g) == "string") { g = document.getElementById(g) } if (g.parentNode == this.cell.childNodes[this.conf.idx.cont]) { g = null; return } if (e) { g.style.display = ""; var a = g.offsetWidth; var c = g.offsetHeight } this._attachObject(g); this.dataType = "obj"; g.style.display = ""; g = null; if (e) { this._adjustByCont(a, c) } }; dhtmlXCellObject.prototype.appendObject = function(a) { if (typeof(a) == "string") { a = document.getElementById(a) } if (a.parentNode == this.cell.childNodes[this.conf.idx.cont]) { a = null; return } if (!this.conf.append_mode) { this.cell.childNodes[this.conf.idx.cont].style.overflow = "auto"; this.conf.append_mode = true } this._attachObject(a, null, null, true); this.dataType = "obj"; a.style.display = ""; a = null }; dhtmlXCellObject.prototype.detachObject = function(c, a) { this._detachObject(null, c, a) }; dhtmlXCellObject.prototype.getAttachedStatusBar = function() { return this.dataNodes.sb }; dhtmlXCellObject.prototype.getAttachedObject = function() { if (this.dataType == "obj" || this.dataType == "url" || this.dataType == "url-ajax") { return this.cell.childNodes[this.conf.idx.cont].firstChild } else { return this.dataObj } }; dhtmlXCellObject.prototype.attachURL = function(c, s, g) { if (g == true) { g = {} } var h = (typeof(g) != "undefined" && g != false && g != null); if (this.conf.url_data == null) { this.conf.url_data = {} } this.conf.url_data.url = c; this.conf.url_data.ajax = (s == true); this.conf.url_data.post_data = (g == true ? {} : (g || null)); if (this.conf.url_data.xml_doc != null) { try { this.conf.url_data.xml_doc.xmlDoc.abort() } catch (n) {} this.conf.url_data.xml_doc.xmlDoc = null; this.conf.url_data.xml_doc = null } if (s == true) { var r = this; if (h) { var l = ""; for (var q in g) { l += "&" + encodeURIComponent(q) + "=" + encodeURIComponent(g[q]) } this.conf.url_data.xml_doc = dhx4.ajax.post(c, l, function(a) { if (r.attachHTMLString != null && typeof(a.xmlDoc.responseText) == "string") { r.attachHTMLString("
" + a.xmlDoc.responseText + "
"); if (typeof(r._doOnFrameContentLoaded) == "function") { r._doOnFrameContentLoaded() } r.dataType = "url-ajax" } r = a = null }) } else { this.conf.url_data.xml_doc = dhx4.ajax.get(c, function(a) { if (r.attachHTMLString != null && typeof(a.xmlDoc.responseText) == "string") { r.attachHTMLString("
" + a.xmlDoc.responseText + "
"); if (typeof(r._doOnFrameContentLoaded) == "function") { r._doOnFrameContentLoaded() } r.dataType = "url-ajax" } r = 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 o = (typeof(this.conf.url_data.post_ifr) == "undefined"); this.conf.url_data.post_ifr = true; if (o) { this._attachURLEvents() } m.src = "about:blank" } else { m.src = c + window.dhx4.ajax._dhxr(c) } 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.attachScheduler = function(a, m, c, g) { g = g || window.scheduler; var h = false; if (c) { var l = document.getElementById(c); if (l) { h = true } } if (!h) { var e = c || '
'; var l = document.createElement("DIV"); l.id = "dhxSchedObj_" + new Date().getTime(); l.style.width = "100%"; l.style.height = "100%"; l.style.position = "relative"; l.style.overflow = "hidden"; l.className = "dhx_cal_container"; l.innerHTML = '
 
 
' + e + '
' } this._attachObject(l); this.dataType = "scheduler"; this.dataObj = g; this.dataObj.setSizes = function() { this.update_view() }; g.init(l.id, a, m); l = null; this.callEvent("_onContentAttach", []); return this.dataObj }; dhtmlXCellObject.prototype.attachMap = function(a) { var c = document.createElement("DIV"); c.style.width = "100%"; c.style.height = "100%"; c.style.position = "relative"; c.style.overflow = "hidden"; this._attachObject(c); if (!a) { a = { center: new google.maps.LatLng(40.719837, -73.992348), zoom: 11, mapTypeId: google.maps.MapTypeId.ROADMAP } } this.dataType = "maps"; this.dataObj = new google.maps.Map(c, a); this.dataObj.setSizes = function() { google.maps.event.trigger(this, "resize") }; c = null; this.callEvent("_onContentAttach", []); return this.dataObj }; dhtmlXCellObject.prototype._createNode_sb = function(n, g, m, a, l) { if (typeof(l) != "undefined") { n = l } else { var c = g || {}; var o = (typeof(c.text) == "string" && c.text.length > 0 ? c.text : " "); var e = (typeof(c.height) == "number" ? c.height : false); var n = document.createElement("DIV"); n.className = "dhx_cell_statusbar_def"; n.innerHTML = "
" + o + "
"; if (e != false) { n.firstChild.style.height = n.firstChild.style.lineHeight = e + "px" } } if (this.conf.idx.pr1 != null) { this.cell.insertBefore(n, this.cell.childNodes[this.conf.idx.pr1]) } else { this.cell.appendChild(n) } this.conf.ofs_nodes.b.sb = true; this._updateIdx(); this._adjustCont(this._idd); return n }; dhtmlXCellObject.prototype.attachStatusBar = function(a) { if (this.dataNodes.sb) { return } if (a != null && window.dhx4.s2b(a.paging) == true) { a.height = null } if (this.conf.skin == "dhx_skyblue" && typeof(window.dhtmlXWindowsCell) == "function" && this instanceof window.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) == "function" && this instanceof window.dhtmlXWindowsCell) { this.cell.childNodes[this.conf.idx.cont].className = this.cell.childNodes[this.conf.idx.cont].className.replace(/\s{0,}dhx_cell_statusbar_attached/, "") } this.dataNodes.sb.setText = this.dataNodes.sb.getText = this.dataNodes.sb.onselectstart = null; this.dataNodes.sb = null; delete this.dataNodes.sb; this._detachObject("sb") }; dhtmlXCellObject.prototype.showStatusBar = function() { this._mtbShowHide("sb", "") }; dhtmlXCellObject.prototype.hideStatusBar = function() { this._mtbShowHide("sb", "none") }; dhtmlXCellObject.prototype._mtbShowHide = function(c, a) { if (!this.dataNodes[c]) { return } this.cell.childNodes[this.conf.idx[c]].style.display = a; this._adjustCont() }; dhtmlXCellObject.prototype.getFrame = dhtmlXCellObject.prototype._getFrame = function() { if (this.dataType != "url") { return null } return this.cell.childNodes[this.conf.idx.cont].firstChild }; dhtmlXCellObject.prototype._attachURLEvents = function() { if (this.dataType != "url") { return } var e = this; var c = this._idd; var a = this.cell.childNodes[this.conf.idx.cont].firstChild; if (typeof(this._doOnFrameMouseDown) != "function") { this._doOnFrameMouseDown = function(g) { e.callEvent("_onContentMouseDown", [c, g || event]) } } if (typeof(window.addEventListener) == "function") { a.onload = function() { try { if (typeof(e._doOnFrameMouseDown) == "function") { this.contentWindow.document.body.addEventListener("mousedown", e._doOnFrameMouseDown, false) } } catch (g) {} try { if (typeof(e._doOnFrameContentLoaded) == "function") { e._doOnFrameContentLoaded() } } catch (g) {} } } else { a.onreadystatechange = function(g) { if (this.readyState == "complete") { try { if (typeof(e._doOnFrameMouseDown) == "function") { this.contentWindow.document.body.attachEvent("onmousedown", e._doOnFrameMouseDown) } } catch (h) {} try { if (typeof(e._doOnFrameContentLoaded) == "function") { e._doOnFrameContentLoaded() } } catch (h) {} } } } }; dhtmlXCellObject.prototype._doOnFrameContentLoaded = function() { if (this.conf.url_data.post_ifr == true) { var l = this.getFrame().contentWindow.document; var h = l.createElement("FORM"); h.method = "POST"; h.action = this.conf.url_data.url; l.body.appendChild(h); var e = {}; if (window.dhx4.ajax.cache != true) { e["dhxr" + new Date().getTime()] = "1" } for (var c in this.conf.url_data.post_data) { e[c] = this.conf.url_data.post_data[c] } for (var c in e) { var g = l.createElement("INPUT"); g.type = "hidden"; g.name = c; g.value = e[c]; h.appendChild(g); g = null } this.conf.url_data.post_ifr = false; h.submit() } else { this.callEvent("_onContentLoaded", [this._idd]) } }; dhtmlXCellObject.prototype._detachURLEvents = function(a) { if (a == null) { if (this.dataType != "url") { return } a = this.cell.childNodes[this.conf.idx.cont].firstChild } if (!a) { return } if (typeof(window.addEventListener) == "function") { a.onload = null; try { a.contentWindow.document.body.removeEventListener("mousedown", this._doOnFrameMouseDown, false) } catch (c) {} } else { a.onreadystatechange = null; try { a.contentWindow.document.body.detachEvent("onmousedown", this._doOnFrameMouseDown) } catch (c) {} } a = null }; dhtmlXCellObject.prototype._attachObject = function(h, c, g, a, e) { if (typeof(h) == "string" && { menu: 1, toolbar: 1, ribbon: 1, sb: 1 }[h] == 1) { return this["_createNode_" + h].apply(this, arguments) } if (a != true) { this._detachObject(null, true, null) } if (typeof(g) == "string") { this.cell.childNodes[this.conf.idx.cont].innerHTML = g } else { this.cell.childNodes[this.conf.idx.cont].appendChild(h) } h = null }; dhtmlXCellObject.prototype._detachObject = function(m, c, a) { this.callEvent("_onBeforeContentDetach", []); if (m == "menu" || m == "toolbar" || m == "ribbon" || m == "sb") { var l = this.cell.childNodes[this.conf.idx[m]]; l.parentNode.removeChild(l); l = null; this.conf.ofs_nodes[m == "sb" ? "b" : "t"][m] = 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.conf.unloading == true && String(this.dataType).match(/ajax/) != null) { if (this.conf.url_data != null && this.conf.url_data.xml_doc != null) { try { this.conf.url_data.xml_doc.xmlDoc.abort() } catch (h) {} this.conf.url_data.xml_doc.xmlDoc = null; this.conf.url_data.xml_doc = null } } 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 l = this.cell.childNodes[this.conf.idx.cont]; while (l.childNodes.length > 0) { if (a === false) { l.removeChild(l.lastChild) } else { l.firstChild.style.display = "none"; a.appendChild(l.firstChild) } } if (this.conf.append_mode) { l.style.overflow = ""; this.conf.append_mode = false } var g = (this.dataType == "tabbar"); this.dataObj = null; this.dataType = null; a = l = null; if (this.conf.unloading != true && g) { this.showHeader(true); this._showBorders() } }; dhtmlXCellObject.prototype._attachFromCell = function(c) { this.detachObject(true); var g = "layout"; if (typeof(window.dhtmlXWindowsCell) == "function" && this instanceof window.dhtmlXWindowsCell) { g = "window" } if (typeof(window.dhtmlXWindowsCell) == "function" && c instanceof window.dhtmlXWindowsCell && c.wins.w[c._idd].conf.parked == true) { c.wins._winCellSetOpacity(c._idd, "open", false) } if (typeof(window.dhtmlXAccordionCell) == "function" && c instanceof window.dhtmlXAccordionCell && c.conf.opened == false) { c._cellSetOpacity("open", false) } for (var e in c.dataNodes) { this._attachObject(e, null, null, null, c.cell.childNodes[c.conf.idx[e]]); this.dataNodes[e] = c.dataNodes[e]; c.dataNodes[e] = null; c.conf.ofs_nodes[e == "sb" ? "b" : "t"][e] = false; c._updateIdx() } this._mtbUpdBorder(); if (c.dataType != null && c.dataObj != null) { this.dataType = c.dataType; this.dataObj = c.dataObj; while (c.cell.childNodes[c.conf.idx.cont].childNodes.length > 0) { this.cell.childNodes[this.conf.idx.cont].appendChild(c.cell.childNodes[c.conf.idx.cont].firstChild) } c.dataType = null; c.dataObj = null; if (this.dataType == "grid") { if (g == "window" && this.conf.skin == "dhx_skyblue") { this.dataObj.entBox.style.border = "1px solid #a4bed4"; this.dataObj._sizeFix = 0 } else { this.dataObj.entBox.style.border = "0px solid white"; this.dataObj._sizeFix = 2 } } } else { while (c.cell.childNodes[c.conf.idx.cont].childNodes.length > 0) { this.cell.childNodes[this.conf.idx.cont].appendChild(c.cell.childNodes[c.conf.idx.cont].firstChild) } } this.conf.view = c.conf.view; c.conf.view = "def"; for (var e in c.views) { this.views[e] = c.views[e]; c.views[e] = null; delete c.views[e] } c._updateIdx(); c._adjustCont(); this._updateIdx(); this._adjustCont(); if (c.conf.progress == true) { c.progressOff(); this.progressOn() } else { this.progressOff() } if (g == "window" && this.wins.w[this._idd].conf.parked) { this.wins._winCellSetOpacity(this._idd, "close", false) } }; function dhtmlXCellTop(h, c) { if (arguments.length == 0 || typeof(h) == "undefined") { return } var a = this; this.dataNodes = {}; this.conf.ofs = { t: 0, b: 0, l: 0, r: 0 }; this.conf.ofs_nodes = { t: {}, b: {} }; this.conf.progress = false; this.conf.fs_mode = false; this.conf.fs_tm = null; this.conf.fs_resize = false; if (h == document.body) { this.conf.fs_mode = true; this.base = h; if (this.base == document.body) { var g = { dhx_skyblue: { t: 2, b: 2, l: 2, r: 2 }, dhx_web: { t: 8, b: 8, l: 8, r: 8 }, dhx_terrace: { t: 9, b: 9, l: 8, r: 8 }, material: { t: 9, b: 9, l: 8, r: 8 } }; this.conf.ofs = (g[this.conf.skin] != null ? g[this.conf.skin] : g.dhx_skyblue) } } else { this.base = (typeof(h) == "string" ? document.getElementById(h) : h) } this.base.className += " " + this.conf.css + "_base_" + this.conf.skin; this.cont = document.createElement("DIV"); this.cont.className = this.conf.css + "_cont"; this.base.appendChild(this.cont); if (c != null) { this.setOffsets(c, false) } else { if (this.base._ofs != null) { this.setOffsets(this.base._ofs, false); this.base._ofs = null; try { delete this.base._ofs } catch (l) {} } } this._adjustCont = function() { var n = this.conf.ofs.t; for (var m in this.conf.ofs_nodes.t) { n += (this.conf.ofs_nodes.t[m] == true ? this.dataNodes[m].offsetHeight : 0) } var e = this.conf.ofs.b; for (var m in this.conf.ofs_nodes.b) { e += (this.conf.ofs_nodes.b[m] == true ? this.dataNodes[m].offsetHeight : 0) } this.cont.style.left = this.conf.ofs.l + "px"; this.cont.style.width = this.base.clientWidth - this.conf.ofs.l - this.conf.ofs.r + "px"; this.cont.style.top = n + "px"; this.cont.style.height = this.base.clientHeight - n - e + "px" }; this._setBaseSkin = function(e) { this.base.className = this.base.className.replace(new RegExp(this.conf.css + "_base_" + this.conf.skin, "gi"), this.conf.css + "_base_" + e) }; this._initFSResize = function() { if (this.conf.fs_resize == true) { return } this._doOnResizeStart = function() { window.clearTimeout(a.conf.fs_tm); a.conf.fs_tm = window.setTimeout(a._doOnResizeEnd, 200) }; this._doOnResizeEnd = function() { a.setSizes() }; if (typeof(window.addEventListener) == "function") { window.addEventListener("resize", this._doOnResizeStart, false) } else { window.attachEvent("onresize", this._doOnResizeStart) } this.conf.fs_resize = true }; if (this.conf.fs_mode == true) { this._initFSResize() } this._unloadTop = function() { this._mtbUnload(); this.detachHeader(); this.detachFooter(); if (this.conf.fs_mode == true) { if (typeof(window.addEventListener) == "function") { window.removeEventListener("resize", this._doOnResizeStart, false) } else { window.detachEvent("onresize", this._doOnResizeStart) } } this.base.removeChild(this.cont); var e = new RegExp("s{0,}" + this.conf.css + "_base_" + this.conf.skin, "gi"); this.base.className = this.base.className.replace(e, ""); this.cont = this.base = null; a = null }; h = null } dhtmlXCellTop.prototype.setOffsets = function(l, h) { var g = false; for (var c in l) { var e = c.charAt(0); if (typeof(this.conf.ofs[e]) != "undefined" && !isNaN(l[c])) { this.conf.ofs[e] = parseInt(l[c]); g = true } } if (h !== false && typeof(this.setSizes) == "function" && g == true) { this.setSizes() } }; dhtmlXCellTop.prototype.attachMenu = function(a) { if (this.dataNodes.menu != null) { return } this.dataNodes.menuObj = document.createElement("DIV"); this.dataNodes.menuObj.className = "dhxcelltop_menu"; this.base.insertBefore(this.dataNodes.menuObj, this.dataNodes.toolbarObj || this.dataNodes.ribbonObj || this.cont); if (typeof(a) != "object" || a == null) { a = {} } a.skin = this.conf.skin; a.parent = this.dataNodes.menuObj; this.dataNodes.menu = new dhtmlXMenuObject(a); this.dataNodes.menuEv = this.attachEvent("_onSetSizes", function() { if (this.dataNodes.menuObj.style.display == "none") { return } if (this.conf.ofs_menu == null) { this.dataNodes.menuObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"; this.conf.ofs_menu = { w: this.dataNodes.menuObj.offsetWidth - parseInt(this.dataNodes.menuObj.style.width) } } this.dataNodes.menuObj.style.left = this.conf.ofs.l + "px"; this.dataNodes.menuObj.style.marginTop = (this.dataNodes.haObj != null ? 0 : this.conf.ofs.t) + "px"; this.dataNodes.menuObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r - this.conf.ofs_menu.w + "px" }); this.conf.ofs_nodes.t.menuObj = true; this.setSizes(); a.parnt = null; a = null; return this.dataNodes.menu }; dhtmlXCellTop.prototype.detachMenu = function() { if (this.dataNodes.menu == null) { return } this.dataNodes.menu.unload(); this.dataNodes.menu = null; this.dataNodes.menuObj.parentNode.removeChild(this.dataNodes.menuObj); this.dataNodes.menuObj = null; this.detachEvent(this.dataNodes.menuEv); this.dataNodes.menuEv = null; delete this.dataNodes.menu; delete this.dataNodes.menuObj; delete this.dataNodes.menuEv; this.conf.ofs_nodes.t.menuObj = false; if (!this.conf.unloading) { this.setSizes() } }; dhtmlXCellTop.prototype.attachToolbar = function(a) { if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) { return } this.dataNodes.toolbarObj = document.createElement("DIV"); this.dataNodes.toolbarObj.className = "dhxcelltop_toolbar"; this.base.insertBefore(this.dataNodes.toolbarObj, this.cont); this.dataNodes.toolbarObj.appendChild(document.createElement("DIV")); if (typeof(a) != "object" || a == null) { a = {} } a.skin = this.conf.skin; a.parent = this.dataNodes.toolbarObj.firstChild; this.dataNodes.toolbar = new dhtmlXToolbarObject(a); this.dataNodes.toolbarEv = this.attachEvent("_onSetSizes", function() { if (this.dataNodes.toolbarObj.style.display == "none") { return } this.dataNodes.toolbarObj.style.left = this.conf.ofs.l + "px"; this.dataNodes.toolbarObj.style.marginTop = (this.dataNodes.haObj != null || this.dataNodes.menuObj != null ? 0 : this.conf.ofs.t) + "px"; this.dataNodes.toolbarObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px" }); this.dataNodes.toolbar._masterCell = this; this.dataNodes.toolbar.attachEvent("_onIconSizeChange", function() { this._masterCell.setSizes() }); this.conf.ofs_nodes.t.toolbarObj = true; this.setSizes(); a.parnt = null; a = null; return this.dataNodes.toolbar }; dhtmlXCellTop.prototype.detachToolbar = function() { if (this.dataNodes.toolbar == null) { return } this.dataNodes.toolbar._masterCell = null; this.dataNodes.toolbar.unload(); this.dataNodes.toolbar = null; this.dataNodes.toolbarObj.parentNode.removeChild(this.dataNodes.toolbarObj); this.dataNodes.toolbarObj = null; this.detachEvent(this.dataNodes.toolbarEv); this.dataNodes.toolbarEv = null; this.conf.ofs_nodes.t.toolbarObj = false; delete this.dataNodes.toolbar; delete this.dataNodes.toolbarObj; delete this.dataNodes.toolbarEv; if (!this.conf.unloading) { this.setSizes() } }; dhtmlXCellTop.prototype.attachRibbon = function(a) { if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) { return } this.dataNodes.ribbonObj = document.createElement("DIV"); this.dataNodes.ribbonObj.className = "dhxcelltop_ribbon"; this.base.insertBefore(this.dataNodes.ribbonObj, this.cont); this.dataNodes.ribbonObj.appendChild(document.createElement("DIV")); if (typeof(a) != "object" || a == null) { a = {} } a.skin = this.conf.skin; a.parent = this.dataNodes.ribbonObj.firstChild; this.dataNodes.ribbon = new dhtmlXRibbon(a); this.dataNodes.ribbonEv = this.attachEvent("_onSetSizes", function() { if (this.dataNodes.ribbonObj.style.display == "none") { return } this.dataNodes.ribbonObj.style.left = this.conf.ofs.l + "px"; this.dataNodes.ribbonObj.style.marginTop = (this.dataNodes.haObj != null || this.dataNodes.menuObj != null ? 0 : this.conf.ofs.t) + "px"; this.dataNodes.ribbonObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"; this.dataNodes.ribbon.setSizes() }); this.conf.ofs_nodes.t.ribbonObj = true; var c = this; this.dataNodes.ribbon.attachEvent("_onHeightChanged", function() { c.setSizes() }); this.setSizes(); a.parnt = null; a = null; return this.dataNodes.ribbon }; dhtmlXCellTop.prototype.detachRibbon = function() { if (this.dataNodes.ribbon == null) { return } this.dataNodes.ribbon.unload(); this.dataNodes.ribbon = null; this.dataNodes.ribbonObj.parentNode.removeChild(this.dataNodes.ribbonObj); this.dataNodes.ribbonObj = null; this.detachEvent(this.dataNodes.ribbonEv); this.dataNodes.ribbonEv = null; this.conf.ofs_nodes.t.ribbonObj = false; delete this.dataNodes.ribbon; delete this.dataNodes.ribbonObj; delete this.dataNodes.ribbonEv; if (!this.conf.unloading) { this.setSizes() } }; dhtmlXCellTop.prototype.attachStatusBar = function(a) { if (this.dataNodes.sbObj) { return } if (typeof(a) == "undefined") { a = {} } this.dataNodes.sbObj = document.createElement("DIV"); this.dataNodes.sbObj.className = "dhxcelltop_statusbar"; if (this.cont.nextSibling != null) { this.base.insertBefore(this.dataNodes.sbObj, this.cont.nextSibling) } else { this.base.appendChild(this.dataNodes.sbObj) } this.dataNodes.sbObj.innerHTML = "
" + (typeof(a.text) == "string" && a.text.length > 0 ? a.text : " ") + "
"; if (typeof(a.height) == "number") { this.dataNodes.sbObj.firstChild.style.height = this.dataNodes.sbObj.firstChild.style.lineHeight = a.height + "px" } this.dataNodes.sbObj.setText = function(c) { this.childNodes[0].innerHTML = c }; this.dataNodes.sbObj.getText = function() { return this.childNodes[0].innerHTML }; this.dataNodes.sbObj.onselectstart = function(c) { return false }; this.dataNodes.sbEv = this.attachEvent("_onSetSizes", function() { if (this.dataNodes.sbObj.style.display == "none") { return } this.dataNodes.sbObj.style.left = this.conf.ofs.l + "px"; this.dataNodes.sbObj.style.bottom = (this.dataNodes.faObj != null ? this.dataNodes.faObj.offsetHeight : 0) + this.conf.ofs.b + "px"; this.dataNodes.sbObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px" }); this.conf.ofs_nodes.b.sbObj = true; this.setSizes(); return this.dataNodes.sbObj }; dhtmlXCellTop.prototype.detachStatusBar = function() { if (!this.dataNodes.sbObj) { return } this.dataNodes.sbObj.setText = this.dataNodes.sbObj.getText = this.dataNodes.sbObj.onselectstart = null; this.dataNodes.sbObj.parentNode.removeChild(this.dataNodes.sbObj); this.dataNodes.sbObj = null; this.detachEvent(this.dataNodes.sbEv); this.dataNodes.sbEv = null; this.conf.ofs_nodes.b.sbObj = false; delete this.dataNodes.sb; delete this.dataNodes.sbObj; delete this.dataNodes.sbEv; if (!this.conf.unloading) { this.setSizes() } }; dhtmlXCellTop.prototype.showMenu = function() { this._mtbShowHide("menuObj", "") }; dhtmlXCellTop.prototype.hideMenu = function() { this._mtbShowHide("menuObj", "none") }; dhtmlXCellTop.prototype.showToolbar = function() { this._mtbShowHide("toolbarObj", "") }; dhtmlXCellTop.prototype.hideToolbar = function() { this._mtbShowHide("toolbarObj", "none") }; dhtmlXCellTop.prototype.showRibbon = function() { this._mtbShowHide("ribbonObj", "") }; dhtmlXCellTop.prototype.hideRibbon = function() { this._mtbShowHide("ribbonObj", "none") }; dhtmlXCellTop.prototype.showStatusBar = function() { this._mtbShowHide("sbObj", "") }; dhtmlXCellTop.prototype.hideStatusBar = function() { this._mtbShowHide("sbObj", "none") }; dhtmlXCellTop.prototype._mtbShowHide = function(c, a) { if (this.dataNodes[c] == null) { return } this.dataNodes[c].style.display = a; this.setSizes() }; dhtmlXCellTop.prototype._mtbUnload = function(c, a) { this.detachMenu(); this.detachToolbar(); this.detachStatusBar(); this.detachRibbon() }; dhtmlXCellTop.prototype.getAttachedMenu = function() { return this.dataNodes.menu }; dhtmlXCellTop.prototype.getAttachedToolbar = function() { return this.dataNodes.toolbar }; dhtmlXCellTop.prototype.getAttachedRibbon = function() { return this.dataNodes.ribbon }; dhtmlXCellTop.prototype.getAttachedStatusBar = function() { return this.dataNodes.sbObj }; dhtmlXCellTop.prototype.progressOn = function() { if (this.conf.progress) { return } this.conf.progress = true; var c = document.createElement("DIV"); c.className = "dhxcelltop_progress"; this.base.appendChild(c); var a = document.createElement("DIV"); if (this.conf.skin == "material" && (window.dhx4.isFF || window.dhx4.isChrome || window.dhx4.isOpera || window.dhx4.isEdge)) { a.className = "dhxcelltop_progress_svg"; a.innerHTML = '' } else { var a = document.createElement("DIV"); a.className = "dhxcelltop_progress_img" } this.base.appendChild(a); c = a = null }; dhtmlXCellTop.prototype.progressOff = function() { if (!this.conf.progress) { return } var g = { dhxcelltop_progress: true, dhxcelltop_progress_img: true, dhxcelltop_progress_svg: true }; for (var e = 0; e < this.base.childNodes.length; e++) { if (typeof(this.base.childNodes[e].className) != "undefined" && g[this.base.childNodes[e].className] == true) { g[this.base.childNodes[e].className] = this.base.childNodes[e] } } for (var c in g) { if (g[c] != true) { this.base.removeChild(g[c]) } g[c] = null } this.conf.progress = false; g = null }; dhtmlXCellTop.prototype.attachHeader = function(c, a) { if (this.dataNodes.haObj != null) { return } if (typeof(c) != "object") { c = document.getElementById(c) } this.dataNodes.haObj = document.createElement("DIV"); this.dataNodes.haObj.className = "dhxcelltop_hdr"; this.dataNodes.haObj.style.height = (a || c.offsetHeight) + "px"; this.base.insertBefore(this.dataNodes.haObj, this.dataNodes.menuObj || this.dataNodes.toolbarObj || this.cont); this.dataNodes.haObj.appendChild(c); c.style.visibility = "visible"; c = null; this.dataNodes.haEv = this.attachEvent("_onSetSizes", function() { this.dataNodes.haObj.style.left = this.conf.ofs.l + "px"; this.dataNodes.haObj.style.marginTop = this.conf.ofs.t + "px"; this.dataNodes.haObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px" }); this.conf.ofs_nodes.t.haObj = true; this.setSizes() }; dhtmlXCellTop.prototype.detachHeader = function() { if (!this.dataNodes.haObj) { return } while (this.dataNodes.haObj.childNodes.length > 0) { this.dataNodes.haObj.lastChild.style.visibility = "hidden"; document.body.appendChild(this.dataNodes.haObj.lastChild) } this.dataNodes.haObj.parentNode.removeChild(this.dataNodes.haObj); this.dataNodes.haObj = null; this.detachEvent(this.dataNodes.haEv); this.dataNodes.haEv = null; this.conf.ofs_nodes.t.haObj = false; delete this.dataNodes.haEv; delete this.dataNodes.haObj; if (!this.conf.unloading) { this.setSizes() } }; dhtmlXCellTop.prototype.attachFooter = function(e, a) { if (this.dataNodes.faObj != null) { return } if (typeof(e) != "object") { e = document.getElementById(e) } this.dataNodes.faObj = document.createElement("DIV"); this.dataNodes.faObj.className = "dhxcelltop_ftr"; this.dataNodes.faObj.style.height = (a || e.offsetHeight) + "px"; var c = (this.dataNodes.sbObj || this.cont); if (this.base.lastChild == c) { this.base.appendChild(this.dataNodes.faObj) } else { this.base.insertBefore(this.dataNodes.faObj, c.nextSibling) } this.dataNodes.faEv = this.attachEvent("_onSetSizes", function() { this.dataNodes.faObj.style.left = this.conf.ofs.l + "px"; this.dataNodes.faObj.style.bottom = this.conf.ofs.b + "px"; this.dataNodes.faObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px" }); this.dataNodes.faObj.appendChild(e); e.style.visibility = "visible"; c = e = null; this.conf.ofs_nodes.b.faObj = true; this.setSizes() }; dhtmlXCellTop.prototype.detachFooter = function() { if (!this.dataNodes.faObj) { return } while (this.dataNodes.faObj.childNodes.length > 0) { this.dataNodes.faObj.lastChild.style.visibility = "hidden"; document.body.appendChild(this.dataNodes.faObj.lastChild) } this.dataNodes.faObj.parentNode.removeChild(this.dataNodes.faObj); this.dataNodes.faObj = null; this.detachEvent(this.dataNodes.faEv); this.dataNodes.faEv = null; this.conf.ofs_nodes.b.faObj = false; delete this.dataNodes.faEv; delete this.dataNodes.faObj; if (!this.conf.unloading) { this.setSizes() } }; function dhtmlXCalendarObject(l, s) { this.i = {}; var e = null; if (typeof(l) == "string") { var g = document.getElementById(l) } else { var g = l } if (g && typeof(g) == "object" && g.tagName && String(g.tagName).toLowerCase() != "input") { e = g } g = null; if (typeof(l) != "object" || !l.length) { l = [l] } for (var c = 0; c < l.length; c++) { if (typeof(l[c]) == "string") { l[c] = (document.getElementById(l[c]) || null) } if (l[c] != null && l[c].tagName && String(l[c].tagName).toLowerCase() == "input") { this.i[window.dhx4.newId()] = { input: l[c] } } else { if (!(l[c] instanceof Array) && l[c] instanceof Object && (l[c].input != null || l[c].button != null)) { if (l[c].input != null && typeof(l[c].input) == "string") { l[c].input = document.getElementById(l[c].input) } if (l[c].button != null && typeof(l[c].button) == "string") { l[c].button = document.getElementById(l[c].button) } this.i[window.dhx4.newId()] = l[c] } } l[c] = null } this.conf = { skin: (s || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhtmlxcalendar") || "material"), zi: window.dhx4.newId(), touch: !window.dhx4.isIE, time: true, today: false, ws_first: true }; 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 (e != null) { this._hasParent = true; e.appendChild(this.base); e = null } else { document.body.appendChild(this.base) } this.setParent = function(a) { if (this._hasParent) { if (typeof(a) == "object") { a.appendChild(this.base) } else { if (typeof(a) == "string") { document.getElementById(a).appendChild(this.base) } } } }; this.setSkin(this.conf.skin, true); this.base.onclick = function(a) { a = a || event; if (a.preventDefault) { a.preventDefault() } a.cancelBubble = true }; this.base.onmousedown = function() { return false }; if (this.conf.touch) { this.base.ontouchstart = function(a) { a = a || event; a.cancelBubble = true } } this.loadUserLanguage = function(x) { if (!this.langData[x]) { return } this.lang = x; this.setWeekStartDay(this.langData[this.lang].weekstart); this.setDateFormat(this.langData[this.lang].dateformat || "%Y-%m-%d"); if (this.msCont) { var v = 0; for (var u = 0; u < this.msCont.childNodes.length; u++) { for (var a = 0; a < this.msCont.childNodes[u].childNodes.length; a++) { this.msCont.childNodes[u].childNodes[a].innerHTML = this.langData[this.lang].monthesSNames[v++] } } } this.contTime.childNodes[0].childNodes[0].childNodes[5].innerHTML = this.langData[this.lang].today; this.contTime.childNodes[0].childNodes[0].childNodes[4].innerHTML = this.langData[this.lang].clear }; 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 m = document.createElement("UL"); m.className = "dhtmlxcalendar_line"; this.contMonth.appendChild(m); var r = document.createElement("LI"); r.className = "dhtmlxcalendar_cell dhtmlxcalendar_month_hdr"; r.innerHTML = "
"; m.appendChild(r); var h = this; r.onclick = function(v) { v = v || event; if (v.type == "touchstart" && v.preventDefault != null) { v.preventDefault() } var q = (v.target || v.srcElement); if (q.className && q.className.indexOf("dhtmlxcalendar_month_arrow") === 0) { h._hideSelector(); var u = (q.parentNode.firstChild == q ? -1 : 1); var a = new Date(h._activeMonth); h._drawMonth(new Date(h._activeMonth.getFullYear(), h._activeMonth.getMonth() + u, 1, 0, 0, 0, 0)); h._evOnArrowClick([a, new Date(h._activeMonth)]); return } if (q.className && q.className == "dhtmlxcalendar_month_label_month") { v.cancelBubble = true; h._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") { v.cancelBubble = true; h._showSelector("year", Math.round(q.offsetLeft + q.offsetWidth / 2), q.offsetTop + q.offsetHeight + 2, "selector_year", true); return } h._hideSelector() }; if (this.conf.touch == true) { r.ontouchstart = r.onclick } this.contDays = document.createElement("DIV"); this.contDays.className = "dhtmlxcalendar_days_cont"; this.base.firstChild.appendChild(this.contDays); this.setWeekStartDay = function(a) { if (a == 0) { a = 7 } this._wStart = Math.min(Math.max((isNaN(a) ? 1 : a), 1), 7); this._drawDaysOfWeek() }; this._drawDaysOfWeek = function() { if (this.contDays.childNodes.length == 0) { var x = document.createElement("UL"); x.className = "dhtmlxcalendar_line"; this.contDays.appendChild(x) } else { var x = this.contDays.firstChild } var u = this._wStart; var v = this.langData[this.lang].daysSNames; v.push(String(this.langData[this.lang].daysSNames[0]).valueOf()); for (var y = 0; y < 8; y++) { if (x.childNodes[y] == null) { var a = document.createElement("LI"); x.appendChild(a) } else { var a = x.childNodes[y] } if (y == 0) { a.className = "dhtmlxcalendar_cell_wn"; a.innerHTML = "
" + (this.langData[this.lang].weekname || "w") + "
" } else { a.className = "dhtmlxcalendar_cell" + (u >= 6 ? " dhtmlxcalendar_day_weekday_cell" : "") + (y == 1 ? "_first" : ""); a.innerHTML = v[u]; if (++u > 7) { u = 1 } } } if (this._activeMonth != null) { this._drawMonth(this._activeMonth) } }; this._wStart = this.langData[this.lang].weekstart; this.setWeekStartDay(this._wStart); this.contDates = document.createElement("DIV"); this.contDates.className = "dhtmlxcalendar_dates_cont"; this.base.firstChild.appendChild(this.contDates); this.contDates.onclick = function(x) { x = x || event; var q = (x.target || x.srcElement); if (q.parentNode != null && q.parentNode._date != null) { q = q.parentNode } if (q._date != null && !q._css_dis) { var v = h._activeDate.getHours(); var u = h._activeDate.getMinutes(); var w = q._date; if (h.checkEvent("onBeforeChange")) { if (!h.callEvent("onBeforeChange", [new Date(q._date.getFullYear(), q._date.getMonth(), q._date.getDate(), v, u)])) { return } } if (h._activeDateCell != null) { h._activeDateCell._css_date = false; h._updateCellStyle(h._activeDateCell._q, h._activeDateCell._w) } var a = (h._activeDate.getFullYear() + "_" + h._activeDate.getMonth() != w.getFullYear() + "_" + w.getMonth()); h._nullDate = false; h._activeDate = new Date(w.getFullYear(), w.getMonth(), w.getDate(), v, u); h._activeDateCell = q; h._activeDateCell._css_date = true; h._activeDateCell._css_hover = false; h._updateCellStyle(h._activeDateCell._q, h._activeDateCell._w); if (a) { h._drawMonth(h._activeDate) } h._updateInp(); if (!h._hasParent) { if (x.type == "touchstart") { window.setTimeout(function() { h._hide() }, 400) } else { h._hide() } } h._evOnClick([new Date(h._activeDate.getTime())]); h._doOnSelectorChange(true) } }; if (this.conf.touch == true) { this.contDates.ontouchstart = this.contDates.onclick } 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 (h._lastHover == a || a._css_hover) { return } a._css_hover = true; h._updateCellStyle(a._q, a._w); h._lastHover = a; h._evOnMouseOver([new Date(a._date.getFullYear(), a._date.getMonth(), a._date.getDate(), 0, 0, 0, 0), q]); a = null } }; this.contDates.onmouseout = function(a) { h._clearDayHover(a || event) }; this._lastHover = null; this._clearDayHover = function(a) { if (!this._lastHover) { return } this._lastHover._css_hover = false; this._updateCellStyle(this._lastHover._q, this._lastHover._w); if (a != null) { h._evOnMouseOut([new Date(this._lastHover._date.getFullYear(), this._lastHover._date.getMonth(), this._lastHover._date.getDate(), 0, 0, 0, 0), a]) } this._lastHover = null }; for (var c = 0; c < 6; c++) { var m = document.createElement("UL"); m.className = "dhtmlxcalendar_line"; this.contDates.appendChild(m); for (var o = 0; o <= 7; o++) { var r = document.createElement("LI"); if (o == 0) { r.className = "dhtmlxcalendar_cell_wn" } else { r.className = "dhtmlxcalendar_cell" } m.appendChild(r) } } this.contTime = document.createElement("DIV"); this.contTime.className = "dhtmlxcalendar_time_cont"; this.contTime.style.display = "none"; this.base.firstChild.appendChild(this.contTime); this.showTime = function() { if (this.conf.time != true) { this.conf.time = true; this._adjustTimeCont() } }; this.hideTime = function() { if (this.conf.time == true) { this.conf.time = false; this._adjustTimeCont() } }; this.showToday = function() { if (this.conf.today != true) { this.conf.today = true; this._adjustTimeCont() } }; this.hideToday = function() { if (this.conf.today == true) { this.conf.today = false; this._adjustTimeCont() } }; this._adjustTimeCont = function() { var a = ""; if (this.conf.time == true) { a += "_time" } if (this.conf.today == true) { a += "_today" } if (a == "") { this.contTime.style.display = "none" } else { this.contTime.className = "dhtmlxcalendar_time_cont dhtmlxcalendar_mode" + a; this.contTime.style.display = "" } this._ifrSize() }; this._adjustTimeCont(); var m = document.createElement("UL"); m.className = "dhtmlxcalendar_line"; this.contTime.appendChild(m); var r = document.createElement("LI"); r.className = "dhtmlxcalendar_cell dhtmlxcalendar_time_hdr"; r.innerHTML = "
:" + this.langData[this.lang].clear + "" + this.langData[this.lang].today + ""; m.appendChild(r); r.onclick = function(u) { u = u || event; if (u.type == "touchstart" && u.preventDefault != null) { u.preventDefault() } var a = (u.target || u.srcElement); if (a.tagName != null && a.tagName.toLowerCase() == "span" && a._par == true && a.parentNode != null) { a = a.parentNode } if (a.className && a.className == "dhtmlxcalendar_label_hours") { u.cancelBubble = true; var q = h.contMonth.offsetHeight + h.contDays.offsetHeight + h.contDates.offsetHeight + a.offsetTop; h._showSelector("hours", Math.round(a.offsetLeft + a.offsetWidth / 2), q - 2, "selector_hours", true); return } if (a.className && a.className == "dhtmlxcalendar_label_minutes") { u.cancelBubble = true; if (h._minutesInterval == 1) { var v = h.getFormatedDate("%i"); a.innerHTML = "" + v.charAt(0) + "" + v.charAt(1); a.firstChild._par = true; h._selectorMode = 1 } var q = h.contMonth.offsetHeight + h.contDays.offsetHeight + h.contDates.offsetHeight + a.offsetTop; h._showSelector("minutes", Math.round(a.offsetLeft + a.offsetWidth / 2), q - 2, "selector_minutes", true); return } h._hideSelector(); if (a.className && a.className == "dhtmlxcalendar_label_today") { var v = new Date(); v = new Date(v.getFullYear(), v.getMonth(), v.getDate(), h._activeDate.getHours(), h._activeDate.getMinutes(), h._activeDate.getSeconds(), h._activeDate.getMilliseconds()); h.setDate(v); h._updateInp(); h.callEvent("onButtonClick", [v]) } if (a.className && a.className == "dhtmlxcalendar_label_clear") { h._nullDate = true; h._drawMonth(new Date()); h._updateInp(); h.callEvent("onButtonClick", [null]) } }; if (this.conf.touch == true) { r.ontouchstart = r.onclick } this._activeMonth = null; this._activeDate = new Date(); this._activeDateCell = null; this.setDate = function(q) { window.dhx4.temp_calendar = { tz: null }; this._nullDate = (typeof(q) == "undefined" || q === "" || !q); if (!(q instanceof Date)) { q = this._strToDate(String(q || "")); if (q == "Invalid Date") { q = new Date() } else { this.conf.tz = window.dhx4.temp_calendar.tz } window.dhx4.temp_calendar = null } if (this.conf.tz == null) { this.conf.tz = window.dhx4.date2str(q, "%P") } 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(u) { if (this._nullDate) { return null } var a = new Date(this._activeDate.getTime()); if (u) { window.dhx4.temp_calendar = { tz: this.conf.tz }; var q = this._dateToStr(a); window.dhx4.temp_calendar = null; return q } return a }; this._drawMonth = function(F) { if (!(F instanceof Date)) { return } if (isNaN(F.getFullYear())) { F = new Date(this._activeMonth.getFullYear(), this._activeMonth.getMonth(), 1, 0, 0, 0, 0) } this._activeMonth = new Date(F.getFullYear(), F.getMonth(), 1, 0, 0, 0, 0); this._activeDateCell = null; var D = new Date(this._activeMonth.getTime()); var v = D.getDay(); var J = v - this._wStart; if (J < 0) { J = J + 7 } D.setDate(D.getDate() - J); var M = F.getMonth(); var N = new Date(this._activeDate.getFullYear(), this._activeDate.getMonth(), this._activeDate.getDate(), 0, 0, 0, 0).getTime(); var A = 0; for (var u = 0; u < 6; u++) { var E = this._wStart; for (var L = 0; L <= 7; L++) { if (L == 0) { var K = this.getWeekNumber(new Date(D.getFullYear(), D.getMonth(), D.getDate() + A, 0, 0, 0, 0)); if (K >= 52 && this.conf.ws_first == true && this._activeMonth.getMonth() == 0) { var y = this.getWeekNumber(new Date(D.getFullYear(), D.getMonth(), D.getDate() + A + 7, 0, 0, 0, 0)); if (y < K && y > 1) { K = 1 } } else { if (K > 52 && this._activeMonth.getMonth() == 11) { var y = this.getWeekNumber(new Date(D.getFullYear() + 1, 0, 1)); if (y == 1) { K = 1 } } } this.contDates.childNodes[u].childNodes[L].innerHTML = "
" + K + "
" } else { var a = new Date(D.getFullYear(), D.getMonth(), D.getDate() + A, 0, 0, 0, 0); if (a.getHours() != 0) { var C = (a.getHours() > 12 ? 24 - a.getHours() : a.getHours()); a.setTime(a.getTime() + 60 * 60 * 1000 * C) } var I = a.getDay(); var x = a.getTime(); var H = "dhtmlxcalendar_label"; if (this._tipData[x] != null) { if (this._tipData[x].usePopup && typeof(window.dhtmlXPopup) == "function") { this.contDates.childNodes[u].childNodes[L].removeAttribute("title"); this._initTooltipPopup() } else { this.contDates.childNodes[u].childNodes[L].setAttribute("title", this._tipData[x].text) } if (this._tipData[x].showIcon) { H += " dhtmlxcalendar_label_title" } } else { this.contDates.childNodes[u].childNodes[L].removeAttribute("title") } this.contDates.childNodes[u].childNodes[L].innerHTML = "
" + a.getDate() + "
"; this.contDates.childNodes[u].childNodes[L]._date = new Date(x); this.contDates.childNodes[u].childNodes[L]._q = u; this.contDates.childNodes[u].childNodes[L]._w = L; this.contDates.childNodes[u].childNodes[L]._css_month = (a.getMonth() == M); this.contDates.childNodes[u].childNodes[L]._css_date = (!this._nullDate && x == N); this.contDates.childNodes[u].childNodes[L]._css_weekend = (E >= 6); this.contDates.childNodes[u].childNodes[L]._css_dis = this._isOutOfRange(x); this.contDates.childNodes[u].childNodes[L]._css_holiday = (this._holidays[x] == true); this._updateCellStyle(u, L); if (x == N) { this._activeDateCell = this.contDates.childNodes[u].childNodes[L] } if (++E > 7) { E = 1 } A++ } } } this.contMonth.firstChild.firstChild.childNodes[1].innerHTML = this._buildMonthHdr(F) }; this._updateCellStyle = function(x, a) { var v = this.contDates.childNodes[x].childNodes[a]; var u = "dhtmlxcalendar_cell dhtmlxcalendar_cell"; u += (v._css_month ? "_month" : ""); u += (v._css_date ? "_date" : ""); u += (v._css_weekend ? "_weekend" : ""); u += (v._css_holiday ? "_holiday" : ""); u += (v._css_dis ? "_dis" : ""); u += (v._css_hover && !v._css_dis ? "_hover" : ""); v.className = u; v = null }; this._minutesInterval = 5; this._initSelector = function(D, x) { if (!this._selCover) { this._selCover = document.createElement("DIV"); this._selCover.className = "dhtmlxcalendar_selector_cover"; this.base.firstChild.appendChild(this._selCover) } if (!this._sel) { this._sel = document.createElement("DIV"); this._sel.className = "dhtmlxcalendar_selector_obj"; this.base.firstChild.appendChild(this._sel); this._sel.appendChild(document.createElement("TABLE")); this._sel.firstChild.className = "dhtmlxcalendar_selector_table"; this._sel.firstChild.cellSpacing = 0; this._sel.firstChild.cellPadding = 0; this._sel.firstChild.border = 0; this._sel.firstChild.appendChild(document.createElement("TBODY")); this._sel.firstChild.firstChild.appendChild(document.createElement("TR")); this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD")); this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD")); this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD")); this._sel.firstChild.firstChild.firstChild.childNodes[0].className = "dhtmlxcalendar_selector_cell_left"; this._sel.firstChild.firstChild.firstChild.childNodes[1].className = "dhtmlxcalendar_selector_cell_middle"; this._sel.firstChild.firstChild.firstChild.childNodes[2].className = "dhtmlxcalendar_selector_cell_right"; this._sel.firstChild.firstChild.firstChild.childNodes[0].innerHTML = " "; this._sel.firstChild.firstChild.firstChild.childNodes[2].innerHTML = " "; this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseover = function() { this.className = "dhtmlxcalendar_selector_cell_left dhtmlxcalendar_selector_cell_left_hover" }; this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseout = function() { this.className = "dhtmlxcalendar_selector_cell_left" }; this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseover = function() { this.className = "dhtmlxcalendar_selector_cell_right dhtmlxcalendar_selector_cell_right_hover" }; this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseout = function() { this.className = "dhtmlxcalendar_selector_cell_right" }; this._sel.onmouseover = function(w) { w = w || event; var q = (w.target || w.srcElement); if (q._cell === true) { if (h._selHover != q) { h._clearSelHover() } if (String(q.className).match(/^\s{0,}dhtmlxcalendar_selector_cell\s{0,}$/gi) != null) { q.className += " dhtmlxcalendar_selector_cell_hover"; h._selHover = q } } }; this._sel.onmouseout = function() { h._clearSelHover() }; this._sel.firstChild.firstChild.firstChild.childNodes[0].onclick = function(q) { q = q || event; if (q.type == "touchstart" && q.preventDefault != null) { q.preventDefault() } q.cancelBubble = true; h._scrollYears(-1) }; this._sel.firstChild.firstChild.firstChild.childNodes[2].onclick = function(q) { q = q || event; if (q.type == "touchstart" && q.preventDefault != null) { q.preventDefault() } q.cancelBubble = true; h._scrollYears(1) }; if (this.conf.touch == true) { this._sel.firstChild.firstChild.firstChild.childNodes[0].ontouchstart = this._sel.firstChild.firstChild.firstChild.childNodes[0].onclick; this._sel.firstChild.firstChild.firstChild.childNodes[2].ontouchstart = this._sel.firstChild.firstChild.firstChild.childNodes[2].onclick } this._sel._ta = {}; this._selHover = null; this._sel.appendChild(document.createElement("DIV")); this._sel.lastChild.className = "dhtmlxcalendar_selector_obj_arrow" } if (this._sel._ta[D] == true) { return } if (D == "month") { this._msCells = {}; this.msCont = document.createElement("DIV"); this.msCont.className = "dhtmlxcalendar_area_" + x; this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.msCont); var u = 0; for (var a = 0; a < 4; a++) { var C = document.createElement("UL"); C.className = "dhtmlxcalendar_selector_line"; this.msCont.appendChild(C); for (var E = 0; E < 3; E++) { var F = document.createElement("LI"); F.innerHTML = this.langData[this.lang].monthesSNames[u]; F.className = "dhtmlxcalendar_selector_cell"; C.appendChild(F); F._month = u; F._cell = true; this._msCells[u++] = F } } this.msCont.onclick = function(w) { w = w || event; if (w.type == "touchstart" && w.preventDefault != null) { w.preventDefault() } w.cancelBubble = true; var q = (w.target || w.srcElement); if (q._month != null) { h._hideSelector(); h._updateActiveMonth(); h._drawMonth(new Date(h._activeMonth.getFullYear(), q._month, 1, 0, 0, 0, 0)); h._doOnSelectorChange() } }; if (this.conf.touch == true) { this.msCont.ontouchstart = this.msCont.onclick } } if (D == "year") { this._ysCells = {}; this.ysCont = document.createElement("DIV"); this.ysCont.className = "dhtmlxcalendar_area_" + x; this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.ysCont); for (var a = 0; a < 4; a++) { var C = document.createElement("UL"); C.className = "dhtmlxcalendar_selector_line"; this.ysCont.appendChild(C); for (var E = 0; E < 3; E++) { var F = document.createElement("LI"); F.className = "dhtmlxcalendar_selector_cell"; F._cell = true; C.appendChild(F) } } this.ysCont.onclick = function(w) { w = w || event; if (w.type == "touchstart" && w.preventDefault != null) { w.preventDefault() } w.cancelBubble = true; var q = (w.target || w.srcElement); if (q._year != null) { h._hideSelector(); h._drawMonth(new Date(q._year, h._activeMonth.getMonth(), 1, 0, 0, 0, 0)); h._doOnSelectorChange() } }; if (this.conf.touch == true) { this.ysCont.ontouchstart = this.ysCont.onclick } } if (D == "hours") { this._hsCells = {}; this.hsCont = document.createElement("DIV"); this.hsCont.className = "dhtmlxcalendar_area_" + x; this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.hsCont); var u = 0; for (var a = 0; a < 4; a++) { var C = document.createElement("UL"); C.className = "dhtmlxcalendar_selector_line"; this.hsCont.appendChild(C); for (var E = 0; E < 6; E++) { var F = document.createElement("LI"); F.innerHTML = this._fixLength(u, 2); F.className = "dhtmlxcalendar_selector_cell"; C.appendChild(F); F._hours = u; F._cell = true; this._hsCells[u++] = F } } this.hsCont.onclick = function(w) { w = w || event; if (w.type == "touchstart" && w.preventDefault != null) { w.preventDefault() } w.cancelBubble = true; var q = (w.target || w.srcElement); if (q._hours != null) { h._hideSelector(); h._activeDate.setHours(q._hours); h._updateActiveHours(); h._updateVisibleHours(); h._doOnSelectorChange(); h.callEvent("onTimeChange", [new Date(h._activeDate.getTime())]) } }; if (this.conf.touch == true) { this.hsCont.ontouchstart = this.hsCont.onclick } } if (D == "minutes") { var A = 4; var v = 3; var y = 2; if (this._minutesInterval == 1) { if (this._selectorMode == 1) { A = 2; v = 3; y = 1 } else { A = 2; v = 5; y = 1; x += "5" } } if (this._minutesInterval == 10) { A = 2 } if (this._minutesInterval == 15) { A = 1; v = 4; x += "4" } this._rsCells = {}; this.rsCont = document.createElement("DIV"); this.rsCont.className = "dhtmlxcalendar_area_" + x; this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.rsCont); var u = 0; for (var a = 0; a < A; a++) { var C = document.createElement("UL"); C.className = "dhtmlxcalendar_selector_line"; this.rsCont.appendChild(C); for (var E = 0; E < v; E++) { var F = document.createElement("LI"); F.innerHTML = (y > 1 ? this._fixLength(u, y) : u); F.className = "dhtmlxcalendar_selector_cell"; C.appendChild(F); F._minutes = u; F._cell = true; this._rsCells[u] = F; u += this._minutesInterval } } this.rsCont.onclick = function(H) { H = H || event; if (H.type == "touchstart" && H.preventDefault != null) { H.preventDefault() } H.cancelBubble = true; var w = (H.target || H.srcElement); if (w._minutes != null) { if (h._minutesInterval == 1) { var q = h.getFormatedDate("%i"); if (h._selectorMode == 1) { q = w._minutes.toString() + q.charAt(1) } else { q = q.charAt(0) + w._minutes.toString() } h._activeDate.setMinutes(Number(q)); h.callEvent("onTimeChange", [new Date(h._activeDate.getTime())]); h._hideSelector(); if (h._selectorMode == 1) { h._updateVisibleMinutes(true); h._selectorMode = 2; h._showSelector("minutes", h._sel._x, h._sel._y, "selector_minutes", true); h._updateActiveMinutes(); return } else { h._selectorMode = 1 } } else { h._hideSelector(); h._activeDate.setMinutes(w._minutes); h._updateActiveMinutes(); h.callEvent("onTimeChange", [new Date(h._activeDate.getTime())]) } h._updateVisibleMinutes(); h._doOnSelectorChange() } }; if (this.conf.touch == true) { this.rsCont.ontouchstart = this.rsCont.onclick } } this._sel._ta[D] = true }; this._showSelector = function(w, q, A, v, a) { if (a === true && this._sel != null && this._isSelectorVisible() && w == this._sel._t) { this._hideSelector(); return } if (this.conf.skin == "dhx_terrace") { q += 12 } if (!this._sel || !this._sel._ta[w]) { this._initSelector(w, v) } if (w != this._sel._t && this._sel._t == "minutes" && this._minutesInterval == 1) { this.contTime.firstChild.firstChild.childNodes[3].innerHTML = this.getFormatedDate("%i") } this._sel._x = q; this._sel._y = A; this._sel.style.visibility = "hidden"; this._sel.style.display = ""; this._selCover.style.width = this.base.offsetWidth - 2 + "px"; this._selCover.style.top = this.contMonth.offsetHeight + "px"; this._selCover.style.height = this.contDates.offsetHeight + this.contDays.offsetHeight - 1 + "px"; this._selCover.style.display = ""; this._sel._t = w; this._sel.className = "dhtmlxcalendar_selector_obj dhtmlxcalendar_" + v + (w == "hours" && this.conf.today == true ? "2" : ""); this._sel.childNodes[0].firstChild.firstChild.childNodes[0].style.display = this._sel.childNodes[0].firstChild.firstChild.childNodes[2].style.display = (w == "year" ? "" : "none"); var u = Math.max(0, q - Math.round(this._sel.offsetWidth / 2)); if (u + this._sel.offsetWidth > this._sel.parentNode.offsetWidth) { u = this._sel.parentNode.offsetWidth - this._sel.offsetWidth } this._sel.style.left = u + "px"; if (w == "hours" || w == "minutes") { this._sel.style.top = A - this._sel.offsetHeight + "px" } else { this._sel.style.top = A + "px" } this._sel.childNodes[1].style.width = this._sel.childNodes[0].offsetWidth + "px"; this._sel.style.visibility = "visible"; this._doOnSelectorShow(w) }; this._doOnSelectorShow = function(a) { if (a == "month") { this._updateActiveMonth() } if (a == "year") { this._updateYearsList(this._activeMonth) } if (a == "hours") { this._updateActiveHours() } if (a == "minutes") { this._updateActiveMinutes() } }; this._hideSelector = function(a) { if (!this._sel) { return } this._sel.style.display = "none"; this._sel.style.visible = "hidden"; this._selCover.style.display = "none"; if (this._sel._t == "minutes" && this._minutesInterval == 1) { this.contTime.firstChild.firstChild.childNodes[3].innerHTML = this.getFormatedDate("%i"); this._unloadSelector("minutes") } }; this._isSelectorVisible = function() { if (!this._sel) { return false } return (this._sel.style.display != "none") }; this._doOnSelectorChange = function(a) { this.callEvent("onChange", [new Date(this._activeMonth.getFullYear(), this._activeMonth.getMonth(), this._activeDate.getDate(), this._activeDate.getHours(), this._activeDate.getMinutes(), this._activeDate.getSeconds()), a === true]) }; this._clearSelHover = function() { if (!this._selHover) { return } this._selHover.className = String(this._selHover.className.replace(/dhtmlxcalendar_selector_cell_hover/gi, "")); this._selHover = null }; this._unloadSelector = function(u) { if (!this._sel) { return } if (!this._sel._ta[u]) { return } if (u == "month") { this.msCont.onclick = this.msCont.ontouchstart = null; this._msActive = null; for (var 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 (u == "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 (u == "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 (u == "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[u] = null }; this.setMinutesInterval = function(a) { if (!(a == 1 || a == 5 || a == 10 || a == 15)) { return } this._minutesInterval = a; this._unloadSelector("minutes") }; this._updateActiveMonth = function() { if (typeof(this._msActive) != "undefined" && typeof(this._msCells[this._msActive]) != "undefined") { this._msCells[this._msActive].className = "dhtmlxcalendar_selector_cell" } this._msActive = this._activeMonth.getMonth(); this._msCells[this._msActive].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active" }; this._updateActiveYear = function() { var a = this._activeMonth.getFullYear(); if (this._ysCells[a]) { this._ysCells[a].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active" } }; this._updateYearsList = function(A) { for (var v in this._ysCells) { this._ysCells[v] = null; delete this._ysCells[v] } var x = 12 * Math.floor(A.getFullYear() / 12); for (var y = 0; y < 4; y++) { for (var u = 0; u < 3; u++) { this.ysCont.childNodes[y].childNodes[u].innerHTML = x; this.ysCont.childNodes[y].childNodes[u]._year = x; this.ysCont.childNodes[y].childNodes[u].className = "dhtmlxcalendar_selector_cell"; this._ysCells[x++] = this.ysCont.childNodes[y].childNodes[u] } } this._updateActiveYear() }; this._scrollYears = function(a) { var u = (a < 0 ? this.ysCont.firstChild.firstChild._year : this.ysCont.lastChild.lastChild._year) + a; var q = new Date(u, 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(w) { var v = {}; if (this._strToDate != null) { for (var q in this.i) { if (this.i[q].input != null && this.i[q].input.value.length > 0) { var x = this._strToDate(this.i[q].input.value, this._dateFormat || this.langData[this.lang].dateformat || "%Y-%m-%d"); if (x instanceof Date) { v[q] = x } } } } this._dateFormat = w; var u = String(this._dateFormat).replace(/%[a-zA-Z]+/g, function(a) { var y = a.replace(/%/, ""); switch (y) { case "n": case "h": case "j": case "g": case "G": return "\\d{1,2}"; case "m": case "d": case "H": case "i": case "s": case "y": return "\\d{2}"; case "Y": return "\\d{4}"; case "M": return "(" + h.langData[h.lang].monthesSNames.join("|").toLowerCase() + "){1,}"; case "F": return "(" + h.langData[h.lang].monthesFNames.join("|").toLowerCase() + "){1,}"; case "D": return "[a-z]{2}"; case "a": case "A": return "AM|PM"; case "u": return "\\d{1,6}"; case "P": return "[\\+\\-]\\d{1,2}\\:\\d{1,2}" } return a }); this._dateFormatRE = new RegExp(u, "i"); for (var q in v) { this.i[q].input.value = this._dateToStr(v[q]) } v = null }; this.setDateFormat(this.langData[this.lang].dateformat || "%Y-%m-%d"); this._updateDateStr = function(q) { var a; if (!q) { a = new Date() } else { if (!this._dateFormatRE || !q.match(this._dateFormatRE)) { return } if (q == this.getFormatedDate()) { return } 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())])) { this._updateInp(); return } } this._nullDate = false; this._activeDate = a; this._drawMonth(this._nullDate ? new Date() : this._activeDate); this._updateVisibleMinutes(); this._updateVisibleHours(); if (this._sel && this._isSelectorVisible()) { this._doOnSelectorShow(this._sel._t) } this._doOnSelectorChange(true) }; this.showMonth = function(a) { if (typeof(a) == "string") { a = this._strToDate(a) } if (!(a instanceof Date)) { return } this._drawMonth(a) }; this.setFormatedDate = function(w, x, q, v) { var u = this._strToDate(x, w); if (v) { return u } this.setDate(u) }; 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(u) { if (typeof(u) == "string") { u = this._strToDate(u) } if (!(u instanceof Date)) { return "Invalid Date" } var q = u.getDay(); if (q === 0) { q = 7 } var v = new Date(u.valueOf()); v.setDate(u.getDate() + (4 - q)); var a = v.getFullYear(); var w = Math.round((v.getTime() - new Date(a, 0, 1).getTime()) / 86400000); return 1 + Math.floor(w / 7) }; 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) == "string") { var u = document.getElementById(v); if (u != null && typeof(u._dhtmlxcalendar_uid) != "undefined" && this.i[u._dhtmlxcalendar_uid] != null) { this._show(u._dhtmlxcalendar_uid); 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, q) { if (q === true && this._activeInp == A && this._isVisible()) { this._hide(); return } this.base.style.visibility = "hidden"; this.base.style.display = ""; if (!A) { if (this._px != null && this._py != null) { this.base.style.left = this._px + "px"; this.base.style.top = this._py + "px" } else { this.base.style.left = "0px"; this.base.style.top = "0px" } } else { if (this.base.className.indexOf("dhtmlxcalendar_in_input") == -1) { this.base.className += " dhtmlxcalendar_in_input" } var u = (this.i[A].input || this.i[A].button); var C = window.dhx4.screenDim(); var y = { top: window.dhx4.absTop(u), left: window.dhx4.absLeft(u) }; if (this.pos == "right") { this.base.style.left = y.left + u.offsetWidth + "px"; this.base.style.top = Math.min(y.top, C.bottom - this.base.offsetHeight) + "px" } else { if (this.pos == "bottom") { var w = y.top + u.offsetHeight + 1; if (w + this.base.offsetHeight > C.bottom) { var v = y.top - this.base.offsetHeight; if (v >= -20) { w = v } } var a = y.left; if (a + this.base.offsetWidth > C.right) { a = Math.max(0, y.left + u.offsetWidth - this.base.offsetWidth) } this.base.style.left = a + "px"; this.base.style.top = w + "px" } else { this.base.style.left = (this._px || 0) + "px"; this.base.style.top = (this._py || 0) + "px" } } this._activeInp = A; u = null } this._hideSelector(); this.base.style.visibility = "visible"; this.base.style.zIndex = window.dhx4.zim.reserve(this.conf.zi); this._ifrSize(); if (this._ifr) { this._ifr.style.display = "" } this.callEvent("onShow", []) }; this._hide = function() { if (this._lastHover != null) { this._clearDayHover() } this._hideSelector(); this.base.style.display = "none"; window.dhx4.zim.clear(this.conf.zi); if (this.base.className.indexOf("dhtmlxcalendar_in_input") >= 0) { this.base.className = this.base.className.replace(/\s{0,}dhtmlxcalendar_in_input/gi, "") } this._activeInp = null; if (this._ifr) { this._ifr.style.display = "none" } this.callEvent("onHide", []) }; this._isVisible = function() { return (this.base.style.display != "none") }; this._rangeActive = false; this._rangeFrom = null; this._rangeTo = null; this._rangeSet = {}; this.setInsensitiveDays = function(v) { var a = this._extractDates(v); for (var u = 0; u < a.length; u++) { this._rangeSet[new Date(a[u].getFullYear(), a[u].getMonth(), a[u].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(u) { if (u == null) { this._clearHolidays() } else { if (u != null) { var a = this._extractDates(u); for (var v = 0; v < a.length; v++) { this._holidays[new Date(a[v].getFullYear(), a[v].getMonth(), a[v].getDate(), 0, 0, 0, 0).getTime()] = true } } } this._drawMonth(this._activeMonth) }; this._extractDates = function(v) { if (typeof(v) == "string" || v instanceof Date) { v = [v] } var u = []; for (var x = 0; x < v.length; x++) { if (typeof(v[x]) == "string") { var y = v[x].split(","); for (var a = 0; a < y.length; a++) { u.push(this._strToDate(y[a])) } } else { if (v[x] instanceof Date) { u.push(v[x]) } } } return u }; 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(v, u, a) { var q = false; if (v != null && u != null) { if (!(v instanceof Date)) { v = this._strToDate(v) } if (!(u instanceof Date)) { u = this._strToDate(u) } if (v.getTime() > u.getTime()) { return } this._rangeFrom = new Date(v.getFullYear(), v.getMonth(), v.getDate(), 0, 0, 0, 0).getTime(); this._rangeTo = new Date(u.getFullYear(), u.getMonth(), u.getDate(), 0, 0, 0, 0).getTime(); this._rangeActive = true; this._rangeType = "in"; q = true } if (!q && v != null && u == null) { if (!(v instanceof Date)) { v = this._strToDate(v) } this._rangeFrom = new Date(v.getFullYear(), v.getMonth(), v.getDate(), 0, 0, 0, 0).getTime(); this._rangeTo = null; if (a === true) { this._rangeFrom++ } this._rangeActive = true; this._rangeType = "from"; q = true } if (!q && v == null && u != null) { if (!(u instanceof Date)) { u = this._strToDate(u) } this._rangeFrom = null; this._rangeTo = new Date(u.getFullYear(), u.getMonth(), u.getDate(), 0, 0, 0, 0).getTime(); if (a === true) { this._rangeTo-- } this._rangeActive = true; this._rangeType = "to"; 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(y, x) { if (y == "week") { if (typeof(x) != "object" && typeof(x.length) == "undefined") { x = [x] } if (!this._rangeWeekData) { this._rangeWeekData = {} } for (var u in this._rangeWeekData) { this._rangeWeekData[u] = false; delete this._rangeWeekData[u] } for (var w = 0; w < x.length; w++) { this._rangeWeekData[x[w]] = true; if (x[w] == 7) { this._rangeWeekData[0] = true } } this._rangeWeek = true } if (y == "month") { if (typeof(x) != "object" && typeof(x.length) == "undefined") { x = [x] } if (!this._rangeMonthData) { this._rangeMonthData = {} } for (var u in this._rangeMonthData) { this._rangeMonthData[u] = false; delete this._rangeMonthData[u] } for (var w = 0; w < x.length; w++) { this._rangeMonthData[x[w]] = true } this._rangeMonth = true } if (y == "year") { var v = this._extractDates(x); if (!this._rangeYearData) { this._rangeYearData = {} } for (var u in this._rangeYearData) { this._rangeYearData[u] = false; delete this._rangeYearData[u] } for (var w = 0; w < v.length; w++) { this._rangeYearData[v[w].getMonth() + "_" + v[w].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(v, y, A, a) { var w = this._extractDates(v); for (var x = 0; x < w.length; x++) { var u = new Date(w[x].getFullYear(), w[x].getMonth(), w[x].getDate(), 0, 0, 0, 0).getTime(); this._tipData[u] = { text: y, showIcon: A, usePopup: a } } this._drawMonth(this._activeMonth) }; this.clearTooltip = function(u) { var v = this._extractDates(u); for (var w = 0; w < v.length; w++) { var a = new Date(v[w].getFullYear(), v[w].getMonth(), v[w].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(v, a, A, q, u) { if (!h._tipPopup) { h._tipPopup = new dhtmlXPopup({ mode: "top" }) } h._tipPopup.attachHTML(h._tipText); h._tipPopup.show(h._tipCellDim.x, h._tipCellDim.y, h._tipCellDim.w, h._tipCellDim.h); h.callEvent("onPopupShow", [h._tipCellDate]) }; this._hideTooltipPopup = function() { if (this._tipTM) { window.clearTimeout(this._tipTM) } if (this._tipPopup != null && this._tipPopup.isVisible()) { this._tipPopup.hide(); this.callEvent("onPopupHide", [this._tipCellDate]) } }; this.getPopup = function() { return this._tipPopup }; this.getCellDimension = function(v) { if (typeof(v) == "string") { v = this._strToDate(v) } if (!(v instanceof Date)) { return null } var x = new Date(v.getFullYear(), v.getMonth(), v.getDate(), 0, 0, 0, 0).getTime(); var u = null; for (var y = 0; y < this.contDates.childNodes.length; y++) { for (var a = 0; a < this.contDates.childNodes[y].childNodes.length; a++) { var A = this.contDates.childNodes[y].childNodes[a]; if (A._date != null && A._date.getTime() == x) { u = { x: window.dhx4.absLeft(A), y: window.dhx4.absTop(A), w: A.offsetWidth, h: A.offsetHeight } } A = null } } return u }; this._updateFromInput = function(a) { if (this._nullInInput && ((a.value).replace(/\s/g, "")).length == 0) { if (this.checkEvent("onBeforeChange")) { if (!this.callEvent("onBeforeChange", [null])) { this._updateInp(); 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 != h._activeInp && h._isVisible() && h._activeInp) { h._hide(); return } if (!a._dhtmlxcalendar_uid || !h.i[a._dhtmlxcalendar_uid]) { if (h._isSelectorVisible()) { h._hideSelector() } else { if (!h._hasParent && h._isVisible()) { h._hide() } } } }; this._doOnKeyDown = function(a) { a = a || event; if (a.keyCode == 27 || a.keyCode == 13) { if (h._isSelectorVisible()) { h._hideSelector() } else { if (h._isVisible() && !h._hasParent) { h._hide() } } } }; this._doOnInpClick = function(q) { q = q || event; if (q.type == "touchstart" && q.preventDefault != null) { q.preventDefault() } var a = (q.target || q.srcElement); if (!a._dhtmlxcalendar_uid) { return } if (!h._listenerEnabled) { h._updateFromInput(a) } h._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 (!h._listenerEnabled) { h._updateFromInput(a) } }; this._doOnBtnClick = function(q) { q = q || event; if (q.type == "touchstart" && q.preventDefault != null) { q.preventDefault() } var a = (q.target || q.srcElement); if (!a._dhtmlxcalendar_uid) { return } if (h.i[a._dhtmlxcalendar_uid].input != null) { h._updateFromInput(h.i[a._dhtmlxcalendar_uid].input) } h._show(a._dhtmlxcalendar_uid, true) }; this._doOnUnload = function() { if (h && h.unload) { h.unload() } }; if (typeof(window.addEventListener) == "function") { document.body.addEventListener("click", h._doOnClick, false); window.addEventListener("keydown", h._doOnKeyDown, false); window.addEventListener("unload", h._doOnUnload, false); if (this.conf.touch == true) { document.body.addEventListener("touchstart", h._doOnClick, false) } } else { document.body.attachEvent("onclick", h._doOnClick); document.body.attachEvent("onkeydown", h._doOnKeyDown); window.attachEvent("onunload", h._doOnUnload) } this.attachObj = function(u) { var q = window.dhx4.newId(); if (typeof(u) == "string") { this.i[q] = { input: document.getElementById(u) } } else { if (typeof(u.tagName) != "undefined") { this.i[q] = { input: u } } else { if (typeof(u) == "object" && (u.input != null || u.button != null)) { this.i[q] = {}; if (u.input != null) { this.i[q].input = (typeof(u.input) == "string" ? document.getElementById(u.input) : u.input) } if (u.button != null) { this.i[q].button = (typeof(u.button) == "string" ? document.getElementById(u.button) : u.button) } } } } this._attachEventsToObject(q); return q }; this.detachObj = function(v) { var u = null; if (this.i[v] != null) { u = v } else { if (typeof(v) == "string") { v = document.getElementById(v); u = v._dhtmlxcalendar_uid } else { if (typeof(v.tagName) != "undefined") { u = v._dhtmlxcalendar_uid } else { if (typeof(v) == "object" && (v.input != null || v.button != null)) { if (u == null && v.input != null) { u = (typeof(v.input) == "string" ? document.getElementById(v.input) : v.input)._dhtmlxcalendar_uid } if (u == null && v.button != null) { u = (typeof(v.button) == "string" ? document.getElementById(v.button) : v.button)._dhtmlxcalendar_uid } } } } } if (u != null && this.i[u] != null) { this._detachEventsFromObject(u); for (var q in this.i[q]) { this.i[u][q]._dhtmlxcalendar_uid = null; this.i[u][q] = null; delete this.i[u][q] } this.i[u] = null; delete this.i[u]; 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("click", h._doOnBtnClick, false); if (this.conf.touch == true) { this.i[q].button.addEventListener("touchstart", h._doOnBtnClick, false) } } else { this.i[q].button.attachEvent("onclick", h._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("click", h._doOnInpClick, false); this.i[q].input.addEventListener("keyup", h._doOnInpKeyUp, false); if (this.conf.touch == true) { this.i[q].input.addEventListener("touchstart", h._doOnInpClick, false) } } else { this.i[q].input.attachEvent("onclick", h._doOnInpClick); this.i[q].input.attachEvent("onkeyup", h._doOnInpKeyUp) } } } }; this._detachEventsFromObject = function(q) { if (this.i[q].button != null) { if (typeof(window.addEventListener) == "function") { this.i[q].button.removeEventListener("click", h._doOnBtnClick, false); if (this.conf.touch == true) { this.i[q].button.removeEventListener("touchstart", h._doOnBtnClick, false) } } else { this.i[q].button.detachEvent("onclick", h._doOnBtnClick) } } else { if (this.i[q].input != null) { if (typeof(window.addEventListener) == "function") { this.i[q].input.removeEventListener("click", h._doOnInpClick, false); this.i[q].input.removeEventListener("keyup", h._doOnInpKeyUp, false); if (this.conf.touch == true) { this.i[q].input.removeEventListener("touchstart", h._doOnInpClick, false) } } else { this.i[q].input.detachEvent("onclick", h._doOnInpClick); this.i[q].input.detachEvent("onkeyup", h._doOnInpKeyUp) } } } }; this._updateInp = function() { 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() } }; this.enableListener = function(a) { if (!a) { return } if (typeof(window.addEventListener) == "function") { a.addEventListener("focus", h._listenerEvFocus, false); a.addEventListener("blur", h._listenerEvBlur, false) } else { a.attachEvent("onfocus", h._listenerEvFocus); a.attachEvent("onblur", h._listenerEvBlur) } a = null }; this.disableListener = function(a) { if (!a) { return } a._f0 = false; if (this._tmListener) { window.clearTimeout(this._tmListener) } if (typeof(window.addEventListener) == "function") { a.removeEventListener("focus", h._listenerEvFocus, false); a.removeEventListener("blur", h._listenerEvBlur, false) } else { a.detachEvent("onfocus", h._listenerEvFocus); a.detachEvent("onblur", h._listenerEvBlur) } a = null }; this._startListener = function(a) { if (this._tmListener) { window.clearTimeout(this._tmListener) } if (typeof(a._v1) == "undefined") { a._v1 = a.value } if (a._v1 != a.value) { this._updateFromInput(a); a._v1 = a.value } if (a._f0) { this._tmListener = window.setTimeout(function() { h._startListener(a) }, 100) } }; this._listenerEvFocus = function(q) { q = q || event; var a = q.target || q.srcElement; a._f0 = true; h._startListener(a); a = null }; this._listenerEvBlur = function(q) { q = q || event; var a = q.target || q.srcElement; a._f0 = false; a = null }; for (var n in this.i) { this._attachEventsToObject(n) } window.dhx4._eventable(this); this._evOnArrowClick = function(a) { return this.callEvent("onArrowClick", a) }; this._evOnClick = function(a) { return this.callEvent("onClick", a) }; this._evOnMouseOut = function(a) { return this.callEvent("onMouseOut", a) }; this._evOnMouseOver = function(a) { return this.callEvent("onMouseOver", a) }; this.unload = function() { this._activeDate = null; this._activeDateCell = null; this._activeInp = null; this._activeMonth = null; this._dateFormat = null; this._dateFormatRE = null; this._lastHover = null; if (this._tmListener) { window.clearTimeout(this._tmListener) } this._tmListener = null; if (typeof(window.addEventListener) == "function") { document.body.removeEventListener("click", h._doOnClick, false); window.removeEventListener("keydown", h._doOnKeyDown, false); window.removeEventListener("unload", h._doOnUnload, false); if (this.conf.touch == true) { document.body.removeEventListener("touchstart", h._doOnClick, false) } } else { document.body.detachEvent("onclick", h._doOnClick); document.body.detachEvent("onkeydown", h._doOnKeyDown); window.detachEvent("onunload", h._doOnKeyDown) } this._doOnClick = null; this._doOnKeyDown = null; this._doOnUnload = null; for (var 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._ifrSize = null; this._hide = null; this._hideSelector = null; this._initSelector = null; this._isSelectorVisible = null; this._isVisible = null; this._scrollYears = null; this._show = null; this._showSelector = null; this._strToDate = null; this._updateActiveHours = null; this._updateActiveMinutes = null; this._updateActiveMonth = null; this._updateActiveYear = null; this._updateCellStyle = null; this._updateDateStr = null; this._updateVisibleHours = null; this._updateVisibleMinutes = null; this._updateYearsList = null; this.enableIframe = null; this.hide = null; this.hideTime = null; this.setDate = null; this.setDateFormat = null; this.setYearsRange = null; this.show = null; this.showTime = null; this.unload = null; if (this._tipPopup != null) { this._tipPopup.unload(); this._tipPopup = null } for (var q in this) { delete this[q] } q = h = null }; this.setDate(this._activeDate); return this } dhtmlXCalendarObject.prototype.lang = "en"; dhtmlXCalendarObject.prototype.langData = { en: { dateformat: "%Y-%m-%d", hdrformat: "%F %Y", monthesFNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthesSNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], daysFNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], daysSNames: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], weekstart: 1, weekname: "w", today: "Today", clear: "Clear" } }; dhtmlXCalendarObject.prototype._buildMonthHdr = function(h) { var c = this; var g = function(l) { return (String(l).length == 1 ? "0" + String(l) : l) }; var a = function(l, m) { return "" + m + "" }; var e = String(this.langData[this.lang].hdrformat || ("%F %Y")).replace(/%[a-z]/gi, function(l) { switch (l) { case "%m": return a("month", g(h.getMonth() + 1)); case "%n": return a("month", h.getMonth() + 1); case "%M": return a("month", c.langData[c.lang].monthesSNames[h.getMonth()]); case "%F": return a("month", c.langData[c.lang].monthesFNames[h.getMonth()]); case "%y": return a("year", g(h.getYear() % 100)); case "%Y": return a("year", h.getFullYear()); case "%%": return "%"; default: return l } }); c = g = a = null; return e }; dhtmlXCalendarObject.prototype.enableIframe = function(a) { if (a == true) { if (!this._ifr) { this._ifr = document.createElement("IFRAME"); this._ifr.frameBorder = 0; this._ifr.border = 0; this._ifr.setAttribute("src", "javascript:false;"); this._ifr.className = "dhtmlxcalendar_ifr"; this._ifr.onload = function() { this.onload = null; this.contentWindow.document.open("text/html", "replace"); this.contentWindow.document.write("") }; this.base.parentNode.insertBefore(this._ifr, this.base); this._ifrSize() } } else { if (this._ifr) { this._ifr.parentNode.removeChild(this._ifr); this._ifr = null } } }; dhtmlXCalendarObject.prototype._ifrSize = function() { if (this._ifr) { this._ifr.style.left = this.base.style.left; this._ifr.style.top = this.base.style.top; this._ifr.style.width = this.base.offsetWidth + "px"; this._ifr.style.height = this.base.offsetHeight + "px" } }; dhtmlxCalendarObject = dhtmlXCalendarObject; dhtmlXCalendarObject.prototype._dateStrings = function() { var a = this.langData[this.lang]; return { monthFullName: a.monthesFNames, monthShortName: a.monthesSNames, dayFullName: a.daysFNames, dayShortName: a.daysSNames } }; dhtmlXCalendarObject.prototype._strToDate = function(c, a) { return window.dhx4.str2date(c, a || this._dateFormat, this._dateStrings()) }; dhtmlXCalendarObject.prototype._dateToStr = function(c, a) { return window.dhx4.date2str(c, a || this._dateFormat, this._dateStrings()) }; window.dhtmlxDblCalendarObject = window.dhtmlXDoubleCalendarObject = window.dhtmlXDoubleCalendar = function(c) { var a = this; this.leftCalendar = new dhtmlXCalendarObject(c); this.leftCalendar.hideTime(); this.rightCalendar = new dhtmlXCalendarObject(c); this.rightCalendar.hideTime(); this.leftCalendar.attachEvent("onClick", function(e) { a._updateRange("rightCalendar", e, null); a._evOnClick(["left", e]) }); this.rightCalendar.attachEvent("onClick", function(e) { a._updateRange("leftCalendar", null, e); a._evOnClick(["right", e]) }); this.leftCalendar.attachEvent("onBeforeChange", function(e) { return a._evOnBeforeChange(["left", e]) }); this.rightCalendar.attachEvent("onBeforeChange", function(e) { return a._evOnBeforeChange(["right", e]) }); this.show = function() { this.leftCalendar.show(); this.rightCalendar.base.style.marginLeft = this.leftCalendar.base.offsetWidth - 1 + "px"; this.rightCalendar.show() }; this.hide = function() { this.leftCalendar.hide(); this.rightCalendar.hide() }; this.setDateFormat = function(e) { this.leftCalendar.setDateFormat(e); this.rightCalendar.setDateFormat(e) }; this.setDates = function(g, e) { if (g != null) { this.leftCalendar.setDate(g) } if (e != null) { this.rightCalendar.setDate(e) } this._updateRange() }; this._updateRange = function(e, h, g) { if (arguments.length == 3) { (e == "leftCalendar" ? this.leftCalendar : this.rightCalendar).setSensitiveRange(h, g) } else { this.leftCalendar.setSensitiveRange(null, this.rightCalendar.getDate()); this.rightCalendar.setSensitiveRange(this.leftCalendar.getDate(), null) } }; this.getFormatedDate = function() { return this.leftCalendar.getFormatedDate.apply(this.leftCalendar, arguments) }; this.unload = function() { window.dhx4._eventable(this, "clear"); this.leftCalendar.unload(); this.rightCalendar.unload(); this.leftCalendar = this.rightCalendar = null; this._updateRange = null; this._evOnClick = null; this._evOnBeforeChange = null; this.show = null; this.hide = null; this.setDateFormat = null; this.setDates = null; this.getFormatedDate = null; this.unload = null; a = null }; this._evOnClick = function(e) { return this.callEvent("onClick", e) }; this._evOnBeforeChange = function(e) { return this.callEvent("onBeforeChange", e) }; window.dhx4._eventable(this); return this }; function dhtmlXCombo(l, r, e, n, h) { var m = this; var g = null; var s = null; if (typeof(l) == "object" && !l.tagName) { g = l; l = g.parent; e = g.width; r = g.name; n = g.mode; s = g.skin } this.cont = (typeof(l) == "string" ? document.getElementById(l) : l); this.conf = { skin: null, form_name: r || "dhxcombo", combo_width: (parseInt(e) || this.cont.offsetWidth || 120) - (dhx4.isFF || dhx4.isIE || dhx4.isChrome || dhx4.isOpera ? 2 : 0), combo_image: false, combo_focus: false, opts_type: (typeof(n) == "string" && typeof(this.modes[n]) != "undefined" ? n : "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, free_text_empty: false, enabled: true, btn_left: ((window.dhx4.isIE6 || window.dhx4.isIE7 || window.dhx4.isIE8) && typeof(window.addEventListener) == "undefined" ? 1 : 0), ro_mode: false, ro_text: "", ro_tm: null, ro_tm_time: 750, img_path: "", img_def: "", img_def_dis: true, template: { header: true, input: "#text#", option: "#text#" }, f_func: null, f_mode: false, f_url: false, f_cache: false, f_cache_data: {}, f_dyn: false, f_dyn_end: false, f_mask: "", f_ac: true, f_ac_text: "", f_server_tm: null, f_server_last: "", f_loading: false, s_tm: null, s_time: 200, s_mode: "select", last_hover: null, last_selected: null, last_match: null, last_text: "", last_value: "", tm_hover: null, tm_confirm_blur: null, clear_click: false, clear_blur: false, clear_bsp: false, clear_key: false, i_ofs: 23, sp: { dhx_skyblue: { list_ofs: 1, hdr_ofs: 1, scr_ofs: 1 }, dhx_web: { list_ofs: 0, hdr_ofs: 1, scr_ofs: 0 }, dhx_terrace: { list_ofs: 1, hdr_ofs: 1, scr_ofs: 1 }, material: { list_ofs: 0, hdr_ofs: 1, scr_ofs: 1 } }, col_w: null }; this.conf.combo_image = (this.modes[this.conf.opts_type].image == true); this.t = {}; this.base = document.createElement("DIV"); this.base.style.width = this.conf.combo_width + "px"; this.base.innerHTML = "
" + (this.conf.combo_image ? "
" + this.modes[this.conf.opts_type].getTopImage(null, this.conf.enabled) + "
" : ""); this.cont.appendChild(this.base); this.list = document.createElement("DIV"); this.list._listId = window.dhx4.newId(); this.list.style.display = "none"; document.body.insertBefore(this.list, document.body.firstChild); this._doOnListScroll = function() { if (m.conf.s_tm != null) { window.clearTimeout(m.conf.s_tm) } m.conf.s_tm = window.setTimeout(m._doOnListScrollAction, m.conf.s_time) }; this._doOnListScrollAction = function() { m.conf.s_tm = null; if (m.conf.s_mode == "scroll" && m.list.scrollHeight - m.list.scrollTop - 10 < m.list.clientHeight) { m._subloadRequest() } }; if (typeof(window.addEventListener) == "function") { this.list.addEventListener("scroll", this._doOnListScroll, false) } else { this.list.attachEvent("onscroll", this._doOnListScroll) } this.setSkin(s || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxcombo") || "material"); 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(A) { if (this.conf.f_server_tm) { window.clearTimeout(this.conf.f_server_tm) } var w = String(this.base.firstChild.value).replace(new RegExp(this._fixRE(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) { 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 v = 0; v < this.conf.f_cache_data[w].data.length; v++) { this.load(this.conf.f_cache_data[w].data[v]) } 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 (A !== true) { this._showList(true); this._checkForMatch() } } else { this.conf.f_server_tm = window.setTimeout(function() { m.conf.f_server_last = w.toLowerCase(); m.conf.f_mask = w; var q = "mask=" + encodeURIComponent(w); if (m.conf.f_dyn) { q += "&pos=0"; m.conf.f_dyn_end = false } var a = function(I) { if (m.conf.f_cache) { if (!m.conf.f_cache_data[w]) { m.conf.f_cache_data[w] = { data: [], dyn_end: false, mask: w } } m.conf.f_cache_data[w].data.push(I.xmlDoc.responseXML) } m.clearAll(); m.load(I.xmlDoc.responseText); var H = (m.base.offsetWidth > 0 && m.base.offsetHeight > 0); if (H == true && m.conf.enabled == true && m.conf.combo_focus == true && A !== true) { if (m.conf.f_ac && m.conf.f_mode == "start" && m.conf.clear_bsp == false && m.list.firstChild != null) { var F = m.list.firstChild._optId; var J = String(m.t[F].obj.getText(m.list.firstChild, true)); if (w == m.base.firstChild.value && String(J).toLowerCase().indexOf(String(w).toLowerCase()) === 0) { m.base.firstChild.value = J; m.conf.f_ac_text = J.substr(w.length); m._selectRange(w.length, J.length) } } m._showList(true); m._checkForMatch() } a = null }; if (window.dhx4.ajax.method == "post") { window.dhx4.ajax.post(m.conf.f_url, q, a) } else { if (window.dhx4.ajax.method == "get") { window.dhx4.ajax.get(m.conf.f_url + (String(m.conf.f_url).indexOf("?") >= 0 ? "&" : "?") + q, a) } } }, 200) } } else { this.conf.f_server_last = w.toLowerCase(); var u = (w.length == 0 ? true : new RegExp((this.conf.f_mode == "start" ? "^" : "") + this._fixRE(w), "i")); var x = null; for (var C in this.t) { var E = false; if (u !== true) { if (this.conf.f_func != null) { var y = this._getOption(this.t[C].item._optId, v); E = (this.conf.f_func.apply(window, [w, y]) == true) } else { var D = this.t[C].obj.getText(this.t[C].item, true); E = (u.test(D) == true) } } if (u === true || E == true) { this.t[C].item.style.display = ""; if (x == null && w.length > 0) { x = String(this.t[C].obj.getText(this.t[C].item, true)) } } else { this.t[C].item.style.display = "none" } } if (this.conf.f_ac && this.conf.f_mode == "start" && this.conf.clear_bsp == false && x != null) { this.conf.f_ac_text = x.replace(new RegExp("^" + w, "i"), ""); this.base.firstChild.value = x; 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 (A !== true) { this._showList(true); this._checkForMatch() } } }; this._searchRO = function(u) { if (this.conf.ro_tm) { window.clearTimeout(this.conf.ro_tm) } this.conf.ro_text += u; this._showList(); for (var v = 0; v < this.list.childNodes.length; v++) { var a = this.list.childNodes[v]._optId; var w = String(this.t[a].obj.getText(this.list.childNodes[v], true)).toLowerCase(); if (w.indexOf(this.conf.ro_text) === 0) { this._setSelected(a, true, true); this._confirmSelect("script", false); break } } this.conf.ro_tm = window.setTimeout(function() { m.conf.ro_text = "" }, this.conf.ro_tm_time) }; this._fixRE = function(a) { return String(a).replace(/[\\\^\$\*\+\?\.\(\)\|\{\}\[\]]/gi, "\\$&") }; this._initObj = function(a) { if (typeof(a.template) != "undefined") { this.setTemplate(a.template) } if (a.add != true && this.conf.f_loading != true) { this.clearAll(false) } this.addOption(a.options) }; this._xmlToObj = function(P, x, v) { var C = { add: false, options: [] }; var J = (x == true ? P : P.getElementsByTagName("complete")); if (J.length > 0) { if (window.dhx4.s2b(J[0].getAttribute("add")) == true) { C.add = true } var I = J[0].childNodes; for (var F = 0; F < I.length; F++) { if (typeof(I[F].tagName) != "undefined") { if (String(I[F].tagName).toLowerCase() == "template") { var O = {}; for (var A = 0; A < I[F].childNodes.length; A++) { var H = I[F].childNodes[A]; if (H.tagName != null) { var K = H.tagName; if (typeof(this.conf.template[K]) != "undefined") { O[K] = window.dhx4._xmlNodeValue(H) } if (K == "columns") { for (var M = 0; M < H.childNodes.length; M++) { var y = H.childNodes[M]; if (y.tagName != null && y.tagName == "column") { var E = {}; for (var N in { width: 1, css: 1, header: 1, option: 1 }) { if (y.getAttribute(N) != null) { E[N] = y.getAttribute(N) } } for (var N in { header: 1, option: 1 }) { var L = y.getElementsByTagName(N); if (L[0] != null && L[0].firstChild != null) { E[N] = window.dhx4._xmlNodeValue(L[0]) } } if (O.columns == null) { O.columns = [] } O.columns.push(E) } y = null } } } H = null } this.setTemplate(O) } if (String(I[F].tagName).toLowerCase() == "option") { var D = false; if (x == true) { D = (C.options.length == v) } else { D = window.dhx4.s2b(I[F].getAttribute("selected")) } var u = { value: I[F].getAttribute("value"), text: window.dhx4._xmlNodeValue(I[F]), selected: D, checked: window.dhx4.s2b(I[F].getAttribute("checked")) }; for (var N in { img: 1, img_dis: 1, img_src: 1, img_src_dis: 1, css: 1 }) { if (I[F].getAttribute(N) != null) { u[N] = I[F].getAttribute(N) } } for (var A = 0; A < I[F].childNodes.length; A++) { if (I[F].childNodes[A].tagName != null && String(I[F].childNodes[A].tagName).toLowerCase() == "text") { u.text = {}; var H = I[F].childNodes[A]; for (var M = 0; M < H.childNodes.length; M++) { if (H.childNodes[M].tagName != null) { u.text[H.childNodes[M].tagName] = window.dhx4._xmlNodeValue(H.childNodes[M]) } } } } C.options.push(u) } } } J = I = null } return C }; window.dhx4._enableDataLoading(this, "_initObj", "_xmlToObj", "complete", { data: true }); window.dhx4._eventable(this); this._getNearItem = function(u, q) { var a = null; while (u != null) { u = u[q < 0 ? "previousSibling" : "nextSibling"]; if (a == null && u != null && u.style.display == "" && u._optId != null) { a = u; u = null } } return a }; this.setName(this.conf.form_name); this._doOnListMouseMove = function(q) { q = q || event; var a = q.target || q.srcElement; while (a != null && a != this) { if (typeof(a._optId) != "undefined") { if (m.conf.tm_hover) { window.clearTimeout(m.conf.tm_hover) } m._setSelected(a._optId, false, false, true) } a = a.parentNode } a = null }; this._doOnListMouseDown = function(a) { a = a || event; a.cancelBubble = true; m.conf.clear_click = true; window.setTimeout(function() { m.base.firstChild.focus() }, 1) }; this._doOnListMouseUp = function(u) { u = u || event; if (u.button != m.conf.btn_left) { return } var a = u.target || u.srcElement; while (a != null && a != this) { if (typeof(a._optId) != "undefined") { var q = true; if (typeof(m.t[a._optId].obj.optionClick) == "function" && m.t[a._optId].obj.optionClick(a, u, m) !== true) { q = false } if (q) { m._setSelected(a._optId, null, true); m._confirmSelect("click") } } a = a.parentNode } a = null }; this._doOnListMouseOut = function(a) { if (m.conf.tm_hover) { window.clearTimeout(m.conf.tm_hover) } m.conf.tm_hover = window.setTimeout(function() { var q = m.conf.last_match || m.conf.last_selected; if (m.conf.last_match == null && m.t[q] != null) { if (m.base.firstChild.value != m.t[q].obj.getText(m.t[q].item, true)) { q = null } } m._setSelected(q, null, true, true) }, 1) }; this._doOnBaseMouseDown = function(w) { if (!m.conf.enabled) { return } m.conf.clear_click = true; w = w || event; if (w.button != m.conf.btn_left) { return } var q = w.target || w.srcElement; if (q != this.firstChild) { window.setTimeout(function() { m.base.firstChild.focus() }, 1); var v = q; while (v != this && v != null) { if (v == this.lastChild) { if (typeof(m.modes[m.conf.opts_type].topImageClick) == "function") { var u = (m.conf.last_hover || m.conf.last_selected); var a = (u != null ? m.t[u].item : null); if (m.modes[m.conf.opts_type].topImageClick(a, m) !== true) { u = a = null; return } } v = null } else { v = v.parentNode } } } if (m._isListVisible()) { m._hideList() } else { if (q != this.firstChild) { m.conf.clear_blur = true } m._showList(); m._setSelected(m.conf.last_selected, true, true) } q = null }; this._doOnBodyMouseDown = function() { if (m.conf.clear_click) { m.conf.clear_click = false; return } m._confirmSelect("blur") }; this._doOnInputFocus = function() { m.conf.clear_blur = false; if (m.conf.tm_confirm_blur) { window.clearTimeout(m.conf.tm_confirm_blur) } if (m.conf.combo_focus == false) { m.conf.combo_focus = true; if (m.conf.skin == "material" && m.base.className.match(/dhxcombo_actv/) == null) { m.base.className += " dhxcombo_actv" } m.callEvent("onFocus", []) } }; this._doOnInputBlur = function() { if (m.conf.clear_blur == true) { m.conf.clear_blur = false; return } if (m.conf.tm_confirm_blur) { window.clearTimeout(m.conf.tm_confirm_blur) } m.conf.tm_confirm_blur = window.setTimeout(function() { if (m.conf.clear_click == false) { m._confirmSelect("blur"); m.conf.combo_focus = false; if (m.conf.skin == "material" && m.base.className.match(/dhxcombo_actv/) != null) { m.base.className = m.base.className.replace(/\s*dhxcombo_actv/gi, "") } m.callEvent("onBlur", []) } }, 20) }; this._doOnInputKeyUp = function(a) { a = a || event; if (m.conf.f_mode != false) { m.conf.clear_bsp = (a.keyCode == 8 || a.keyCode == 46); m._filterOpts(); return } else { m._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; m._keyOnUpDown(a.keyCode == 38 ? -1 : 1) } if (a.keyCode == 113) { if (!m._isListVisible()) { m._showList(); if (m.base.firstChild.value == m.conf.last_text) { m._setSelected(m.conf.last_selected, true, true); m.base.firstChild.value = m.conf.last_text; m.conf.f_server_last = m.base.firstChild.value.toLowerCase() } else { m.conf.f_server_last = m.base.firstChild.value.toLowerCase(); if (m.conf.f_mode == false) { m._checkForMatch() } } } else {} } if (a.keyCode == 27) { if (a.preventDefault) { a.preventDefault() } else { a.returnValue = false } a.cancelBubble = true; m._cancelSelect() } if (a.keyCode == 13) { if (a.preventDefault) { a.preventDefault() } m._confirmSelect("kbd") } if (m.conf.ro_mode == true && ((a.keyCode >= 48 && a.keyCode <= 57) || (a.keyCode >= 65 && a.keyCode <= 90))) { m._searchRO(String.fromCharCode(a.keyCode).toLowerCase()); a.cancelBubble = true } m.conf.clear_key = true; m.callEvent("onKeyPressed", [a.keyCode || a.charCode]) }; this._doOnInputKeyPress = function(a) { if (m.conf.clear_key) { m.conf.clear_key = false; return } a = a || event; m.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 u = String(this.t[q._optId].obj.getText(q, true)); if (this.conf.f_mode == "start" && this.conf.f_ac == true) { if (u.toLowerCase().indexOf(this.conf.f_server_last) === 0) { this.conf.f_ac_text = u.substring(this.conf.f_server_last.length, u.length); this.base.firstChild.value = u; this._selectRange(this.conf.f_server_last.length, this.base.firstChild.value.length) } else { this.base.firstChild.value = u; this.conf.f_server_last = this.base.firstChild.value.toLowerCase(); this._selectRange(0, this.base.firstChild.value.length) } } else { this.base.firstChild.value = u; this.conf.f_server_last = this.base.firstChild.value.toLowerCase() } } 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 o in this.conf.evs_nodes[c].evs) { if (typeof(window.addEventListener) == "function") { this.conf.evs_nodes[c].node.addEventListener(o, this[this.conf.evs_nodes[c].evs[o]], false) } else { this.conf.evs_nodes[c].node.attachEvent("on" + o, this[this.conf.evs_nodes[c].evs[o]]) } } } this.unload = function() { this.clearAll(); this.t = null; for (var v = 0; v < this.conf.evs_nodes.length; v++) { for (var u in this.conf.evs_nodes[v].evs) { if (typeof(window.addEventListener) == "function") { this.conf.evs_nodes[v].node.removeEventListener(u, this[this.conf.evs_nodes[v].evs[u]], false) } else { this.conf.evs_nodes[v].node.detachEvent("on" + u, this[this.conf.evs_nodes[v].evs[u]]) } this.conf.evs_nodes[v].evs[u] = null; delete this.conf.evs_nodes[v].evs[u] } this.conf.evs_nodes[v].node = null; this.conf.evs_nodes[v].evs = null; delete this.conf.evs_nodes[v].node; delete this.conf.evs_nodes[v].evs; this.conf.evs_nodes[v] = null } window.dhx4._eventable(this, "clear"); window.dhx4._enableDataLoading(this, null, null, null, "clear"); this._mcDetachHeader(); this.DOMelem_input = this.DOMelem_button = this.DOMlist = this.DOMelem = this.DOMParent = null; for (var u in this.conf) { this.conf[u] = null; delete this.conf[u] } this.conf = null; if (typeof(window.addEventListener) == "function") { this.list.removeEventListener("scroll", this._doOnListScroll, false) } else { this.list.detachEvent("onscroll", this._doOnListScroll) } this.base.parentNode.removeChild(this.base); this.list.parentNode.removeChild(this.list); this.base = this.list = this.cont = null; this.modes = null; for (var u in this) { if (typeof(this[u]) == "function") { this[u] = null } } m = 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 = l; l = null; if (g != null) { if (g.filter != null) { if (typeof(g.filter) == "string") { this.enableFilteringMode(true, g.filter, window.dhx4.s2b(g.filter_cache), window.dhx4.s2b(g.filter_sub_load)) } else { this.enableFilteringMode(true) } } if (g.image_path != null) { this.setImagePath(g.image_path) } if (g.default_image != null || g.default_image_dis != null) { this.setDefaultImage(g.default_image, g.default_image_dis) } if (g.items || g.options) { this.addOption(g.items || g.options) } if (g.xml || g.json) { this.load(g.xml || g.json) } if (typeof(g.readonly) != "undefined") { this.readonly(g.readonly) } g = null } return this } function dhtmlXComboFromSelect(g, e) { if (typeof(g) == "string") { g = document.getElementById(g) } var c = e || 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, g.selectedIndex); 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.replace(/(\[.*)?$/, "_new_value$1") }; dhtmlXCombo.prototype.readonly = function(a) { if (window.dhx4.s2b(a)) { this.base.firstChild.setAttribute("readOnly", "true"); this.conf.ro_mode = true } else { this.base.firstChild.removeAttribute("readOnly"); this.conf.ro_mode = false } }; dhtmlXCombo.prototype.setPlaceholder = function(a) { if (typeof(a) == "undefined" || a == null) { a = "" } this.base.firstChild.setAttribute("placeholder", String(a)) }; dhtmlXCombo.prototype.setTemplate = function(e) { for (var c in e) { if (typeof(this.conf.template[c]) != "undefined") { if (c == "header") { this.conf.template[c] = window.dhx4.s2b(e[c]) } else { this.conf.template[c] = String(e[c]) } } } if (e.columns != null) { this._mcMakeTemplate(e.columns) } else { this._mcDetachHeader() } for (var c in this.t) { this.t[c].obj.setText(this.t[c].item, this.t[c].item._conf.text) } this._confirmSelect("template") }; dhtmlXCombo.prototype.setSkin = function(a) { if (a == this.conf.skin) { return } this.conf.skin = a; this.base.className = "dhxcombo_" + this.conf.skin + (this.conf.enabled ? "" : " dhxcombo_disabled"); this.list.className = "dhxcombolist_" + this.conf.skin + (this.hdr != null ? " dhxcombolist_multicolumn" : ""); if (this.hdr != null) { this.hdr.className = "dhxcombolist_" + this.conf.skin + " dhxcombolist_hdr" } this.conf.i_ofs = (a == "material" ? 26 : 23); this._adjustBase() }; dhtmlXCombo.prototype.getInput = function() { return this.base.firstChild }; dhtmlXCombo.prototype.getButton = function() { return this.base.childNodes[this.base.childNodes.length - (this.conf.combo_image ? 2 : 1)] }; dhtmlXCombo.prototype.getList = function() { return this.list }; dhtmlXCombo.prototype.getBase = function() { return this.base }; dhtmlXCombo.prototype.getParent = function() { return this.DOMParent }; dhtmlXCombo.prototype.forEachOption = function(a) { for (var c = 0; c < this.list.childNodes.length; c++) { a.apply(window, [this._getOption(this.list.childNodes[c]._optId, c)]) } }; dhtmlXCombo.prototype.setFocus = function() { if (this.conf.enabled) { this.base.firstChild.focus() } }; dhtmlXCombo.prototype.setFontSize = function(a, c) { if (a != null) { this.base.firstChild.style.fontSize = a } if (c != null) { this.list.style.fontSize = c } }; dhtmlXCombo.prototype.getOption = function(h) { var l = null; var e = null; for (var g = 0; g < this.list.childNodes.length; g++) { if (l == null) { var c = this.list.childNodes[g]._optId; if (this.t[c].obj.getValue(this.t[c].item) == h) { l = c; e = g } } } return (l == null ? null : this._getOption(l, e)) }; dhtmlXCombo.prototype.getOptionByIndex = function(a) { if (a < 0) { return null } if (this.list.childNodes[a] == null) { return null } return this._getOption(this.list.childNodes[a]._optId, a) }; dhtmlXCombo.prototype.getOptionByLabel = function(h) { var l = null; var e = null; for (var g = 0; g < this.list.childNodes.length; g++) { if (l == null) { var c = this.list.childNodes[g]._optId; if (this.t[c].obj.getText(this.t[c].item, true) == h) { l = c; e = g } } } return (l == null ? null : this._getOption(l, e)) }; dhtmlXCombo.prototype.getSelectedIndex = function() { return this._getOptionProp(this.conf.last_selected, "index", -1) }; dhtmlXCombo.prototype.getSelectedText = function() { return this._getOptionProp(this.conf.last_selected, "text", "") }; dhtmlXCombo.prototype.getSelectedValue = function() { return this._getOptionProp(this.conf.temp_selected || this.conf.last_selected, "value", null) }; dhtmlXCombo.prototype.getActualValue = function() { return this.base.childNodes[1].value }; dhtmlXCombo.prototype.getComboText = function() { return this.base.childNodes[0].value }; dhtmlXCombo.prototype.getIndexByValue = function(c) { var a = this.getOption(c); return (a != null ? a.index : -1) }; dhtmlXCombo.prototype.setComboText = function(a) { if (this.conf.allow_free_text != true) { return } this.unSelectOption(); this.conf.last_text = this.base.firstChild.value = a; this.conf.f_server_last = this.base.firstChild.value.toLowerCase() }; dhtmlXCombo.prototype.setComboValue = function(c) { var a = this.getOption(c); if (a != null) { this.selectOption(a.index) } else { this.conf.last_value = c; this.base.childNodes[1].value = this.conf.last_value; this.base.childNodes[2].value = "true" } }; dhtmlXCombo.prototype.selectOption = function(c, e, a) { if (c < 0 || c >= this.list.childNodes.length) { return } var g = this.list.childNodes[c]._optId; this._setSelected(g, this._isListVisible(), true); this._confirmSelect("script") }; dhtmlXCombo.prototype.unSelectOption = function() { if (this.conf.last_hover != null) { this.t[this.conf.last_hover].obj.setSelected(this.t[this.conf.last_hover].item, false); this.conf.last_hover = null } this.base.firstChild.value = ""; if (this.conf.f_mode != false) { this._filterOpts(true) } this._hideList(); this._updateTopImage(null); this._confirmSelect("script") }; dhtmlXCombo.prototype.confirmValue = function() { this._confirmSelect("script") }; dhtmlXCombo.prototype.enable = function(a) { a = (typeof(a) == "undefined" ? true : window.dhx4.s2b(a)); if (this.conf.enabled == a) { return } this.conf.enabled = a; if (a) { this.base.className = "dhxcombo_" + this.conf.skin; this.base.firstChild.removeAttribute("disabled") } else { this._hideList(); this.base.className = "dhxcombo_" + this.conf.skin + " dhxcombo_disabled"; this.base.firstChild.setAttribute("disabled", "true") } this._updateTopImage(this.conf.last_selected) }; dhtmlXCombo.prototype.disable = function(a) { a = (typeof(a) == "undefined" ? true : window.dhx4.s2b(a)); this.enable(!a) }; dhtmlXCombo.prototype.isEnabled = function() { return (this.conf.enabled == true) }; dhtmlXCombo.prototype.show = function(a) { if (typeof(a) == "undefined") { a = true } else { a = window.dhx4.s2b(a) } this.base.style.display = (a == true ? "" : "none") }; dhtmlXCombo.prototype.hide = function(a) { if (typeof(a) == "undefined") { a = true } this.show(!a) }; dhtmlXCombo.prototype.isVisible = function() { return (this.base.style.display == "") }; dhtmlXCombo.prototype.setFilterHandler = function(a) { if (typeof(a) == "function") { this.conf.f_func = a; this.conf.f_mode = true; this.conf.f_dyn = this.conf.f_cache = this.conf.f_url = null } else { if (typeof(a) == "string" && typeof(window[a]) == "function") { this.conf.f_func = window[a]; this.conf.f_mode = true; this.conf.f_dyn = this.conf.f_cache = this.conf.f_url = null } else { this.conf.f_func = null } } }; dhtmlXCombo.prototype.enableFilteringMode = function(g, c, a, e) { if (g == true || g == "between") { this.conf.f_mode = (g == true ? "start" : "between"); if (c) { this.conf.f_url = c; this.conf.f_cache = window.dhx4.s2b(a); this.conf.f_dyn = window.dhx4.s2b(e) } else { this.conf.f_url = null; this.conf.f_cache = false; this.conf.f_dyn = false } } else { this.conf.f_mode = false; this.conf.f_url = null; this.conf.f_cache = false; this.conf.f_dyn = false } }; dhtmlXCombo.prototype.filter = function(e, a) { for (var g = 0; g < this.list.childNodes.length; g++) { var c = e.apply(window, [this._getOption(this.list.childNodes[g]._optId, g)]); this.list.childNodes[g].style.display = (c === true ? "" : "none") } if (typeof(a) == "undefined" || a == true) { this._showList(true) } }; dhtmlXCombo.prototype.sort = function(e) { var a = []; for (var c = 0; c < this.list.childNodes.length; c++) { var g = this.list.childNodes[c]._optId; a.push([g, this._getOption(g, c)]) } if (e == "asc" || e == "desc") { k = true; a.sort(function(l, h) { l = l[1].text_option.toLowerCase(); h = h[1].text_option.toLowerCase(); var m = (e == "asc" ? 1 : -1); return (l > h ? m : -1 * m) }) } else { if (typeof(e) == "function" || typeof(window[e]) == "function") { if (typeof(window[e]) == "function") { e = window[e] } a.sort(function(l, h) { return e.apply(window, [l[1], h[1]]) }) } } while (this.list.childNodes.length > 0) { this.list.removeChild(this.list.lastChild) } for (var c = 0; c < a.length; c++) { this.list.appendChild(this.t[a[c][0]].item) } }; dhtmlXCombo.prototype.enableAutocomplete = function(a) { if (typeof(a) == "undefined") { a = true } else { a = window.dhx4.s2b(a) } this.conf.f_ac = a }; dhtmlXCombo.prototype.disableAutocomplete = function(a) { if (typeof(a) == "undefined") { a = true } else { a = window.dhx4.s2b(a) } this.enableAutocomplete(!a) }; dhtmlXCombo.prototype.allowFreeText = function(c, a) { this.conf.allow_free_text = (typeof(c) == "undefined" ? true : window.dhx4.s2b(c)); this.conf.free_text_empty = (typeof(a) == "undefined" ? false : window.dhx4.s2b(a)) }; dhtmlXCombo.prototype._checkForMatch = function(g) { var a = window.dhx4.trim(this.base.firstChild.value).toLowerCase(); var h = null; var c = this.list.firstChild; while (c != null) { if (c.style.display == "" && c._optId != null) { var e = window.dhx4.trim(this.t[c._optId].obj.getText(c, true)).toLowerCase(); if (a == e) { h = c._optId; c = null } } if (c != null) { c = c.nextSibling } } if (this.conf.last_match == null) { if (h != null) { this._setSelected(h, true, true); this.conf.last_match = h } else { if (this.conf.f_mode != "between" || g == true) { this._setSelected(null, true, true); this.conf.last_match = null } } } else { if (h != null) { if (h != this.conf.last_match) { this._setSelected(h, true, true); this.conf.last_match = h } } else { this._setSelected(null, true, true); this.conf.last_match = null } } }; dhtmlXCombo.prototype._selectRange = function(c, a) { if (this.conf.combo_focus == true) { window.dhx4.selectTextRange(this.base.firstChild, c, a) } }; dhtmlXCombo.prototype.openSelect = function() { if (!this._isListVisible()) { this._showList() } }; dhtmlXCombo.prototype.closeAll = function() { this._hideList() }; dhtmlXCombo.prototype._showList = function(a) { if (this._getListVisibleCount() == 0) { if (a && this._isListVisible()) { this._hideList() } return } if (this._isListVisible()) { this._checkListHeight(); return } this.list.style.zIndex = window.dhx4.zim.reserve(this.conf.list_zi_id); if (this.hdr != null && this.conf.template.header == true) { this.hdr.style.zIndex = Number(this.list.style.zIndex) + 1 } this.list.style.visibility = "hidden"; this.list.style.display = ""; if (this.hdr != null && this.conf.template.header == true) { this.hdr.style.visibility = this.list.style.visibility; this.hdr.style.display = this.list.style.display } var c = (this.hdr != null && this.conf.template.header == true ? this.hdr.offsetHeight : 0); this.list.style.width = Math.max(this.conf.opts_width || this.conf.col_w || 0, this.conf.combo_width) + "px"; this.list.style.top = window.dhx4.absTop(this.base) + c + this.base.offsetHeight - 1 + "px"; this.list.style.left = window.dhx4.absLeft(this.base) + "px"; if (this.hdr != null && this.conf.template.header == true) { this.hdr.style.width = this.list.style.width; this.hdr.style.left = this.list.style.left; this.hdr.style.top = parseInt(this.list.style.top) - c + "px" } this._checkListHeight(); this.list.style.visibility = "visible"; if (this.hdr != null && this.conf.template.header == true) { this.hdr.style.visibility = "visible" } this.callEvent("onOpen", []) }; dhtmlXCombo.prototype._hideList = function() { if (!this._isListVisible()) { return } window.dhx4.zim.clear(this.conf.list_zi_id); this.list.style.display = "none"; if (this.hdr != null && this.conf.template.header == true) { this.hdr.style.display = "none" } this.conf.clear_click = false; this.callEvent("onClose", []) }; dhtmlXCombo.prototype._isListVisible = function() { return (this.list.style.display == "") }; dhtmlXCombo.prototype._getListVisibleCount = function() { var a = 0; for (var c = 0; c < this.list.childNodes.length; c++) { a += (this.list.childNodes[c].style.display == "" ? 1 : 0) } return a }; dhtmlXCombo.prototype._checkListHeight = function() { if (!this._isListVisible()) { return } if (this.conf.item_h == null) { var q = this.list.firstChild; while (q != null) { if (q.style.display == "") { this.conf.item_h = q.offsetHeight + (this.hdr != null ? -1 : 0); q = null } else { q = q.nextSibling } } q = null } var r = window.dhx4.screenDim(); var m = window.dhx4.absTop(this.base); var c = this.base.offsetHeight; var a = (this.hdr != null && this.conf.template.header == true ? this.hdr.offsetHeight : 0); var e = Math.max(0, Math.floor((m - a - r.top) / this.conf.item_h)); var o = Math.max(0, Math.floor((r.bottom - (m + c + a)) / this.conf.item_h)); var u = this._getListVisibleCount(); if (o < Math.min(this.conf.opts_count_min, u) && e > o) { o = null } var n = Math.min((o == null ? e : o), this.conf.opts_count, u); var g = (n < u ? (n * this.conf.item_h) + "px" : ""); var l = this.conf.sp[this.conf.skin][this.hdr != null && this.conf.template.header == true ? "hdr_ofs" : "list_ofs"]; this.list.style.height = g; this.list.style.top = (o == null ? m - this.list.offsetHeight + l : m + c + a - l) + "px"; if (this.hdr != null && this.conf.template.header == true) { this.hdr.style.top = (o == null ? m - a - this.list.offsetHeight + l : m + c - l) + "px" } }; dhtmlXCombo.prototype._scrollToItem = function(h) { var g = this.t[h].item.offsetTop; var e = g + this.t[h].item.offsetHeight; var c = this.list.scrollTop; var a = c + this.list.clientHeight; if (g < c) { this.list.scrollTop = g + (this.hdr != null && this.conf.template.header == true ? 1 : 0) } else { if (e > a) { this.list.scrollTop = e - this.list.clientHeight + (this.hdr != null && this.conf.template.header == true ? -this.conf.sp[this.conf.skin].scr_ofs : 0) } } }; dhtmlXCombo.prototype._setSelected = function(g, e, c, a) { this.conf.temp_selected = null; if (c) { this._updateTopImage(g) } if (g != null && this.conf.last_hover == g) { if (e) { this._scrollToItem(g) } 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 (g == null) { this.callEvent("onSelectionChange", []) } } if (g != null) { this.t[g].obj.setSelected(this.t[g].item, true); this.conf.last_hover = g; if (a != true) { this.conf.temp_selected = g; this.callEvent("onSelectionChange", []) } if (this.conf.s_mode == "select" && this.t[g].item == this.t[g].item.parentNode.lastChild) { this._subloadRequest() } if (e) { this._scrollToItem(g) } } }; dhtmlXCombo.prototype._subloadRequest = function() { if (this.conf.f_url != null && this.conf.f_dyn == true && this.conf.f_dyn_end == false) { var e = "mask=" + encodeURIComponent(this.conf.f_mask) + "&pos=" + this.list.childNodes.length; var a = this; var c = function(h) { if (a.conf.f_cache) { a.conf.f_cache_data[a.conf.f_mask].data.push(h.xmlDoc.responseXML) } var g = a.list.childNodes.length; a.conf.f_loading = true; a.load(h.xmlDoc.responseXML); a.conf.f_loading = false; if (g == a.list.childNodes.length) { a.conf.f_dyn_end = true; if (a.conf.f_cache) { a.conf.f_cache_data[a.conf.f_mask].dyn_end = true } } c = a = null }; if (window.dhx4.ajax.method == "post") { window.dhx4.ajax.post(this.conf.f_url, e, c) } else { if (window.dhx4.ajax.method == "get") { window.dhx4.ajax.get(this.conf.f_url + (String(this.conf.f_url).indexOf("?") >= 0 ? "&" : "?") + e, c) } } } }; dhtmlXCombo.prototype.addOption = function(l, m, c, a, g) { var e = null; if (!(l instanceof Array)) { var n = this._renderOption({ value: l, text: m, css: c, img: a }); if (e == null && window.dhx4.s2b(g) == true) { e = n } } else { for (var h = 0; h < l.length; h++) { if (typeof(l[h]) == "undefined") { continue } if (l[h] instanceof Array) { n = this._renderOption({ value: l[h][0], text: l[h][1], css: l[h][2], img: l[h][3] }); if (e == null && window.dhx4.s2b(l[h][4]) == true) { e = n } } else { var n = this._renderOption(l[h]); if (e == null && window.dhx4.s2b(l[h].selected) == true) { e = n } } } } if (e != null) { this._setSelected(e, this._isListVisible(), true); this._confirmSelect("onInit") } }; dhtmlXCombo.prototype.updateOption = function(a, e, c, g) { var h = this._getOptionId(a); if (h == null) { return } this.t[h].obj.update(this.t[h].item, { value: e, text: c, css: g }); if (this.conf.last_selected == h) { this.conf.last_text = this.base.firstChild.value = this.t[h].obj.getText(this.t[h].item, true); this.conf.f_server_last = this.base.firstChild.value.toLowerCase() } }; dhtmlXCombo.prototype.deleteOption = function(g) { for (var c in this.t) { var e = this.t[c].obj.getValue(this.t[c].item); if (e == g) { this._removeOption(c) } } if (this._isListVisible()) { this._showList(true) } }; dhtmlXCombo.prototype.clearAll = function(c) { c = (typeof(c) == "undefined" ? true : window.dhx4.s2b(c)); for (var e in this.t) { this._removeOption(e) } if (this.conf.tm_hover) { window.clearTimeout(this.conf.tm_hover) } this.conf.last_hover = null; this.conf.last_selected = null; this.list.scrollTop = 0; if (c == true) { this._hideList() } }; dhtmlXCombo.prototype._renderOption = function(g) { var h = window.dhx4.newId(); var e = document.createElement("DIV"); e._optId = h; e._tpl = this.conf.template; if (typeof(g.img) == "undefined" && typeof(g.img_src) != "undefined") { g.img = g.img_src; delete g.img_src } if (typeof(g.img_dis) == "undefined" && typeof(g.img_src_dis) != "undefined") { g.img_dis = g.img_src_dis; delete g.img_src_dis } g.img_path = this.conf.img_path; g.img_def = this.conf.img_def; g.img_def_dis = this.conf.img_def_dis; this.list.appendChild(e); var c = (this._isListVisible() && window.dhx4.isFF == true); if (c == true) { var a = this.list.scrollTop; this.list.scrollTop -= 1 } if (this.hdr != null) { g.multicol = true } this.t[e._optId] = { obj: this.modes[this.conf.opts_type].render(e, g), item: e, conf: { type: this.conf.opts_type } }; e = null; if (c == true) { this.list.scrollTop += 1 } return h }; dhtmlXCombo.prototype._removeOption = function(a) { this.t[a].obj.destruct(this.t[a].item); this.t[a].obj = null; this.t[a].item.parentNode.removeChild(this.t[a].item); this.t[a].item = null; this.t[a].conf = null; this.t[a] = null; delete this.t[a]; if (this.conf.last_hover == a) { this.conf.last_hover = null } if (this.conf.last_selected == a) { this.conf.last_selected = null; this._confirmSelect("onDelete") } }; dhtmlXCombo.prototype._confirmSelect = function(e, a) { var c = false; if (typeof(a) == "undefined") { a = true } if (this.conf.f_server_tm) { window.clearTimeout(this.conf.f_server_tm) } if (this.conf.last_hover != null) { c = c || (this.conf.last_value != this._getOptionValue(this.conf.last_hover)); this.conf.last_match = this.conf.last_selected = this.conf.last_hover; this.conf.last_value = this._getOptionValue(this.conf.last_selected); this.conf.last_text = this.base.firstChild.value = this.t[this.conf.last_selected].obj.getText(this.t[this.conf.last_selected].item, true); this.conf.f_server_last = this.base.firstChild.value.toLowerCase(); this.base.childNodes[1].value = this.conf.last_value; this.base.childNodes[2].value = "false" } else { if (this.conf.allow_free_text || (this.base.firstChild.value == "" && this.conf.allow_empty_value)) { c = c || (this.conf.last_text != this.base.firstChild.value); this.conf.last_match = this.conf.last_value = this.conf.last_selected = null; if (e != "onDelete") { 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 { if (e != "template") { this._cancelSelect(true); this._updateTopImage(this.conf.last_selected); return } } } if (this.conf.f_ac && this.conf.f_mode == "start") { this.conf.f_ac_text = ""; if (e != "blur") { this._selectRange(this.base.firstChild.value.length, this.base.firstChild.value.length) } } if (a) { this._hideList() } if (c == true && e != "onInit" && e != "onDelete") { this.callEvent("onSelectionChange", []); this.callEvent("onChange", [this.conf.last_value, this.conf.last_text]) } }; dhtmlXCombo.prototype._cancelSelect = function(a) { this._hideList(); if (a == true && this.conf.allow_free_text == false && this.conf.free_text_empty == true) { this.conf.f_server_last = this.conf.last_match = this.conf.last_value = this.conf.last_selected = null; this.base.childNodes[1].value = this.conf.last_text = this.base.firstChild.value = ""; this.base.childNodes[2].value = "false" } else { this.base.firstChild.value = this.conf.last_text } if (this.conf.f_mode != false) { this._filterOpts(true) } }; dhtmlXCombo.prototype._getOption = function(m, g) { if (!this.t[m]) { return null } if (typeof(g) == "undefined") { g = -1 } if (g < 0) { for (var l = 0; l < this.list.childNodes.length; l++) { if (g < 0 && this.list.childNodes[l]._optId == m) { g = l } } } var h = { value: this.t[m].obj.getValue(this.t[m].item), text: this.t[m].obj.getText(this.t[m].item), text_input: this.t[m].obj.getText(this.t[m].item, true), text_option: this.t[m].obj.getText(this.t[m].item, null, true), css: this.t[m].obj.getCss(this.t[m].item), selected: (m == this.conf.last_selected), index: g }; if (typeof(this.t[m].obj.getExtraData) == "function") { var e = this.t[m].obj.getExtraData(this.t[m].item); for (var c in e) { if (typeof(h[c]) == "undefined") { h[c] = e[c] } } } return h }; dhtmlXCombo.prototype._getOptionProp = function(g, e, c) { if (g != null) { var a = this._getOption(g); if (a != null) { return a[e] } } return c }; dhtmlXCombo.prototype._getOptionId = function(c) { var g = null; for (var a = 0; a < this.list.childNodes.length; a++) { if (g == null) { var e = this.list.childNodes[a]._optId; if (c == this.t[e].obj.getValue(this.t[e].item)) { g = e } } } return g }; dhtmlXCombo.prototype._getOptionValue = function(a) { return this._getOptionProp(a, "value", null) }; dhtmlXCombo.prototype.setSize = function(a) { this.conf.combo_width = parseInt(a) - (dhx4.isFF || dhx4.isIE || dhx4.isChrome || dhx4.isOpera ? 2 : 0); this.base.style.width = Math.max(0, this.conf.combo_width) + "px"; this._adjustBase(); if (this._isListVisible()) { this._hideList(); this._showList() } }; dhtmlXCombo.prototype._adjustBase = function() { this.base.firstChild.style.width = Math.max(0, (this.conf.combo_width - (this.conf.i_ofs + 1) - (this.conf.combo_image ? this.conf.i_ofs : 0))) + "px"; this.base.firstChild.style.marginLeft = (this.conf.combo_image ? this.conf.i_ofs + "px" : "0px") }; dhtmlXCombo.prototype.setOptionWidth = function(a) { this.conf.opts_width = (parseInt(a) || null) }; dhtmlXCombo.prototype.setOptionIndex = function(e, a) { if (isNaN(a) || a < 0) { return } var g = this.getOption(e); if (g == null) { return } if (a == g.index) { return } var c = this.list.childNodes[g.index]; c.parentNode.removeChild(c); if (this.list.childNodes[a] != null) { this.list.insertBefore(c, this.list.childNodes[a]) } else { this.list.appendChild(c) } c = null }; dhtmlXCombo.prototype.getOptionsCount = function() { return this.list.childNodes.length }; dhtmlXCombo.prototype._mcMakeTemplate = function(o) { var l = ""; var g = ""; this.conf.col_w = 0; for (var m = 0; m < o.length; m++) { var a = Number(parseInt(o[m].width) || 50); var e = (o[m].css || ""); var n = (m == 0 && window.dhx4.isIE6 == true ? "_first" : ""); g += "
" + (o[m].option || " ") + "
"; l += "
" + (o[m].header || " ") + "
"; this.conf.col_w += a + 1 } var a = 500; var c = document.createElement("DIV"); c.style.position = "absolute"; c.style.top = "10px"; c.style.left = -a * 2 + "px"; c.style.width = a + "px"; c.style.height = "50px"; c.style.overflowY = "scroll"; c.innerHTML = "
 
"; document.body.appendChild(c); this.conf.col_w += a - c.firstChild.offsetWidth + 10; c.parentNode.removeChild(c); c = null; this.conf.template.option = g; this._mcAttachHeader(l); this.list.className += " dhxcombolist_multicolumn" }; dhtmlXCombo.prototype._mcAttachHeader = function(a) { if (this.hdr == null) { this.hdr = document.createElement("DIV"); this.hdr.className = "dhxcombolist_" + this.conf.skin + " dhxcombolist_hdr"; this.hdr.style.display = "none"; this.list.parentNode.insertBefore(this.hdr, this.list); if (typeof(window.addEventListener) == "function") { this.hdr.addEventListener("mousedown", this._doOnListMouseDown, false) } else { this.hdr.attachEvent("onmousedown", this._doOnListMouseDown) } if (this.conf.opts_type == "checkbox" && this.conf.combo_image == true) { this.conf.combo_image = false; if (this.base.lastChild.className.match(/dhxcombo_top_image/) != null) { this.base.removeChild(this.base.lastChild) } this._adjustBase() } } this.hdr.innerHTML = "
" + a + "
" }; dhtmlXCombo.prototype._mcDetachHeader = function() { if (this.hdr != null) { if (typeof(window.addEventListener) == "function") { this.hdr.removeEventListener("mousedown", this._doOnListMouseDown, false) } else { this.hdr.detachEvent("onmousedown", this._doOnListMouseDown) } this.hdr.parentNode.removeChild(this.hdr); this.hdr = null } this.conf.col_w = null; this.conf.item_h = null }; dhtmlXCombo.prototype.modes = {}; dhtmlXCombo.prototype.doWithItem = function(a, m, h, e) { var l = (a >= 0 && a < this.list.childNodes.length ? this.list.childNodes[a]._optId : null); if (l == null) { return null } if (typeof(this.t[l].obj[m]) != "function") { return null } var g = [this.t[l].item]; for (var c = 2; c < arguments.length; c++) { g.push(arguments[c]) } return this.t[l].obj[m].apply(this.t[l].obj, g) }; function dhtmlXComboExtend(g, e) { for (var c in dhtmlXCombo.prototype.modes[e]) { if (typeof(dhtmlXCombo.prototype.modes[g][c]) == "undefined") { dhtmlXCombo.prototype.modes[g][c] = dhtmlXCombo.prototype.modes[e][c] } } } dhtmlXCombo.prototype.modes.option = { image: false, html: false, option_css: "dhxcombo_option_text", render: function(a, c) { a._conf = { value: c.value, css: "" }; a.className = "dhxcombo_option"; a.innerHTML = "
 
"; if (c.css != null) { a.lastChild.style.cssText = c.css; a._conf.css = c.css } this.setText(a, c.text); return this }, destruct: function(a) { a._conf = null }, update: function(a, c) { a._conf.value = c.value; a._conf.css = c.css; a.lastChild.style.cssText = c.css; this.setText(a, c.text) }, setText: function(e, g, c) { e._conf.text = g; var a = (typeof(g) == "object" ? window.dhx4.template(e._tpl.option, this.replaceHtml(e._conf.text, c), true) : window.dhx4.trim(this.replaceHtml(e._conf.text, c) || "")); e.lastChild.innerHTML = (a.length == 0 ? " " : a) }, getText: function(e, a, c) { if (window.dhx4.s2b(a) && typeof(e._conf.text) == "object") { return window.dhx4.template(e._tpl.input, e._conf.text, true) } if (window.dhx4.s2b(c) && typeof(e._conf.text) == "object") { return window.dhx4.template(e._tpl.option, e._conf.text, true) } return e._conf.text }, getValue: function(a) { return a._conf.value }, getCss: function(a) { return a._conf.css }, setSelected: function(a, c) { a.className = "dhxcombo_option" + (c ? " dhxcombo_option_selected" : "") }, isSelected: function(a) { return String(a.className).indexOf("dhxcombo_option_selected") >= 0 }, getExtraData: function(a) { return { type: "option" } }, replaceHtml: function(h, g) { if (h === 0) { h = "0" } if (this.html == true) { return h } if (typeof(g) == "undefined" || g == null) { g = {} } if (typeof(h) == "object" && h) { var e = {}; for (var c in h) { e[c] = (g[c] == true ? h[c] : this.replaceHtml(h[c])) } } else { var e = (h || "").replace(/[\<\>\&\s]/g, function(a) { switch (a) { case "<": return "<"; case ">": return ">"; case "&": return "&"; case " ": return " " } return a }) } return e } }; dhtmlXCombo.prototype.modes.checkbox = { image: true, html: false, image_css: "dhxcombo_checkbox dhxcombo_chbx_#state#", option_css: "dhxcombo_option_text dhxcombo_option_text_chbx", render: function(c, e) { if (this.image_css_regexp == null) { this.image_css_regexp = new RegExp(this.image_css.replace("#state#", "\\d*")) } c._conf = { value: e.value, css: "", checked: window.dhx4.s2b(e.checked) }; c.className = "dhxcombo_option"; var a = {}; if (e.multicol == true) { e.text.checkbox = "
 "; a.checkbox = true; c.innerHTML = "
" } else { c.innerHTML = "
 
" } if (e.css != null) { c.lastChild.style.cssText += e.css; c._conf.css = e.css } this.setText(c, e.text, a); return this }, setChecked: function(c, e) { c._conf.checked = window.dhx4.s2b(e); var a = String(this.image_css).replace("#state#", (c._conf.checked ? "1" : "0")); this._changeChbxCss(c.childNodes, a) }, _changeChbxCss: function(a, c) { for (var e = 0; e < a.length; e++) { if (a[e].tagName != null && a[e].className != null && a[e].className.match(this.image_css_regexp) != null) { a[e].className = c } else { if (a[e].childNodes.length > 0) { this._changeChbxCss(a[e].childNodes, c) } } } }, isChecked: function(a) { return (a._conf.checked == true) }, getExtraData: function(a) { return { type: "checkbox", checked: a._conf.checked } }, optionClick: function(h, g, l) { var e = true; var c = (g.target || g.srcElement); while (e == true && c != null && c != h && c.className != null) { if (c.className.match(this.image_css_regexp) != null) { var a = [h._conf.value, !h._conf.checked]; if (l.callEvent("onBeforeCheck", a) === true) { this.setChecked(h, !this.isChecked(h)); l.callEvent("onCheck", a) } e = false; a = null } else { c = c.parentNode } } c = l = h = null; return e }, getTopImage: function(c, a) { return "" }, topImageClick: function(a, c) { return true } }; dhtmlXComboExtend("checkbox", "option"); dhtmlXCombo.prototype.setChecked = function(a, c) { this.doWithItem(a, "setChecked", c) }; dhtmlXCombo.prototype.getChecked = function(a) { var c = []; for (var e = 0; e < this.list.childNodes.length; e++) { if (this.isChecked(e)) { c.push(this._getOptionProp(this.list.childNodes[e]._optId, "value", "")) } } return c }; dhtmlXCombo.prototype.isChecked = function(a) { return this.doWithItem(a, "isChecked") }; dhtmlXCombo.prototype.modes.image = { image: true, html: false, image_css: "dhxcombo_image", option_css: "dhxcombo_option_text dhxcombo_option_text_image", render: function(a, c) { a._conf = { value: c.value, css: "" }; a.className = "dhxcombo_option"; a.innerHTML = "
 
"; if (c.css != null) { a.lastChild.style.cssText += c.css; a._conf.css = c.css } this.setText(a, c.text); this.setImage(a, c.img, c.img_dis, c.img_path, c.img_def, c.img_def_dis); return this }, update: function(a, c) { a._conf.value = c.value; a._conf.css = c.css; a.lastChild.style.cssText = c.css; this.setText(a, c.text); this.setImage(a, c.img, c.img_dis, c.img_path, c.img_def, c.img_def_dis) }, setImage: function(e, a, h, l, g, c) { if (a != null && a.length > 0) { a = l + a } else { if (g != null && g.length > 0) { a = l + g } else { a = null } } if (h != null && h.length > 0) { h = l + h } else { if (c != null && c.length > 0) { h = l + c } else { if (c == true) { h = a } else { h = null } } } e._conf.img = a; e._conf.img_dis = h; e.firstChild.style.backgroundImage = (a != null ? "url(" + a + ")" : "none") }, getExtraData: function(a) { return { type: "image" } }, getTopImage: function(g, e) { var c = (e ? "img" : "img_dis"); if (g != null && g._conf[c] != null) { return "
" } return "" } }; dhtmlXComboExtend("image", "option"); dhtmlXCombo.prototype.setDefaultImage = function(a, c) { if (a != null) { this.conf.img_def = a } if (c != null) { this.conf.img_def_dis = c } }; dhtmlXCombo.prototype.setImagePath = function(a) { this.conf.img_path = a }; function dhtmlXColorPicker(n) { if (!(this instanceof window.dhtmlXColorPicker)) { return new dhtmlXColorPicker(n) } dhx4._eventable(this); var h = this, g = undefined, m = null, e, a, c; this._nodes = []; this.activeNode = null; this._inputListenerId = null; this.base = null; this._globalNode = null; this.memory = null; this.skin = null; this.conf = { cp_id: dhx4.newId(), x: 0, y: 0, c: 0, indent: 2, position: "right", customColors: false, selectedColor: null, hide: false, hideOnSelect: false, lang: "en", closeable: true }; this.value = { red: -1, blue: -1, green: -1, hue: -1, sat: -1, lum: -1 }; this._initMoveSelection = function(l) { l = l || event; if (typeof(window.addEventListener) == "function") { h._controllerNodes.colorArea.addEventListener("mousemove", h._setMoveSelection, false); document.body.addEventListener("mouseup", h._cleanMoveSelection, false) } else { h._controllerNodes.colorArea.attachEvent("onmousemove", h._setMoveSelection); document.body.attachEvent("onmouseup", h._cleanMoveSelection) } h._setMoveSelection(l, h._controllerNodes.colorArea); return false }; this._cleanMoveSelection = function() { if (typeof(window.removeEventListener) == "function") { h._controllerNodes.colorArea.removeEventListener("mousemove", h._setMoveSelection, false); document.body.removeEventListener("mouseup", h._cleanMoveSelection, false) } else { h._controllerNodes.colorArea.detachEvent("onmousemove", h._setMoveSelection); document.body.detachEvent("onmouseup", h._cleanMoveSelection) } return false }; this._setMoveSelection = function(l) { l = l || event; var o = h._getOffsetPosition(l, h._controllerNodes.colorArea); if (h._controllerNodes.fr_cover) { setTimeout(function() { h._setColorAreaXY(o.x, o.y); h._setColorByXYC() }, 0) } else { h._setColorAreaXY(o.x, o.y); h._setColorByXYC() } return false }; this._initMoveContrast = function(l) { l = l || event; if (typeof(window.addEventListener) == "function") { document.body.addEventListener("mousemove", h._setMoveContrast, false); document.body.addEventListener("mouseup", h._cleanMoveContrast, false) } else { document.body.attachEvent("onmousemove", h._setMoveContrast); document.body.attachEvent("onmouseup", h._cleanMoveContrast) } h._setMoveContrast(l, h._controllerNodes.contrastArea) }; this._cleanMoveContrast = function() { if (typeof(window.removeEventListener) == "function") { document.body.removeEventListener("mousemove", h._setMoveContrast, false); document.body.removeEventListener("mouseup", h._cleanMoveContrast, false) } else { document.body.detachEvent("onmousemove", h._setMoveContrast); document.body.detachEvent("onmouseup", h._cleanMoveContrast) } }; this._setMoveContrast = function(l) { l = l || event; var o = h._getOffsetPosition(l, h._controllerNodes.contrastArea); h._setContrastY(o.y); h._setColorByXYC(true) }; this._doOnSelectColor = function() { var l = h.colorAIP.rgb2hex({ r: h.value.red, g: h.value.green, b: h.value.blue }); if (h.activeNode != null) { if (h.activeNode.valueCont) { h.activeNode.valueCont.value = l } if (h.activeNode.valueColor) { h.activeNode.valueColor.style.backgroundColor = l } } if (h.base._dhx_remove || h.conf.hideOnSelect) { h.hide() } h.callEvent("onSelect", [l, ((h.activeNode) ? h.activeNode.node : null)]) }; this._doOnCancel = function() { if (h.callEvent("onCancel", [((h.activeNode) ? h.activeNode.node : null)]) == true && h.conf.closeable == true) { h.hide() } }; this._doOnFocusByInput = function() { var o = (this != window) ? this : event.srcElement; var l = (h.activeNode && h.activeNode.valueCont && h.activeNode.valueCont == o) ? h.activeNode : h._getNodeByValueCont(o); h.activeNode = l; if (l && l == h.activeNode) { h._initListenerInput() } }; this._doOnBlurByInput = function() { var o = (this != window) ? this : event.srcElement; var l = (h.activeNode && h.activeNode.valueCont && h.activeNode.valueCont == o) ? h.activeNode : h._getNodeByValueCont(o); if (l && l == h.activeNode) { h._removeListenerInput() } }; this._doOnClickByNode = function(o) { o = o || event; var l = (this != window) ? this : event.srcElement; h.activeNode = (h.activeNode.node != l) ? h._getNodeByElement(l) : h.activeNode; if (!h.isVisible()) { h.show() } }; this.saveColor = function() { h.memory.setValue(h.value) }; this._onSelectMemoryEl = function(o) { var l; h._refreshCoordinatesByHSL(o.value.hue, o.value.sat, o.value.lum); for (l in o.value) { h.value[l] = o.value[l] } h._refreshContrast(); h._refreshInputValues(); h._refreshColorValue() }; this._doOnClickByBody = function(q) { q = q || event; var l = true, o = q.target || q.srcElement; if (h._isBaseNode(o)) { l = false } if (l && h.activeNode && (h.activeNode.node == o || h.activeNode.valueCont == o)) { l = false } if (l) { h.hide() } }; this._doOnChangeHSL = function() { var q = parseInt(h._controllerNodes.hue.value), o = parseInt(h._controllerNodes.sat.value), l = parseInt(h._controllerNodes.lum.value), r; if (isNaN(q) || q > 359 || q < 0) { h._controllerNodes.hue.value = h.value.hue } else { h.value.hue = q } if (isNaN(o) || o > 100 || o < 0) { h._controllerNodes.sat.value = h.value.sat } else { h.value.sat = o } if (isNaN(l) || l > 100 || l < 0) { h._controllerNodes.lum.value = h.value.lum } else { h.value.lum = l } r = h.colorAIP.hsl2rgb(h.value.hue, h.value.sat / 100, h.value.lum / 100); h.value.red = Math.round(255 * r.r); h.value.green = Math.round(255 * r.g); h.value.blue = Math.round(255 * r.b); h._refreshCoordinatesByHSL(h.value.hue, h.value.sat, h.value.lum); h._refreshContrast(); h._refreshInputValues(); h._refreshColorValue() }; this._doOnChangeRGB = function() { var r = parseInt(h._controllerNodes.red.value), q = parseInt(h._controllerNodes.green.value), l = parseInt(h._controllerNodes.blue.value), o; if (isNaN(r) || r > 255 || r < 0) { h._controllerNodes.red.value = h.value.red } else { h.value.red = r } if (isNaN(q) || q > 255 || q < 0) { h._controllerNodes.green.value = h.value.green } else { h.value.green = q } if (isNaN(l) || l > 255 || l < 0) { h._controllerNodes.blue.value = h.value.blue } else { h.value.blue = l } o = h.colorAIP.rgb2hsl(h.value.red / 255, h.value.green / 255, h.value.blue / 255); h.value.hue = Math.round(o.h); h.value.sat = Math.round(o.s * 100); h.value.lum = Math.round(o.l * 100); h._refreshCoordinatesByHSL(h.value.hue, h.value.sat, h.value.lum); h._refreshContrast(); h._refreshInputValues(); h._refreshColorValue() }; this._doOnChangeHSV = function() { h._controllerNodes.hsv.value = h.setColor(h._controllerNodes.hsv.value) }; this._checkType = function(o) { var l; if (o instanceof Array) { l = h._checkType(o[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 (o == undefined) { return null } else { if (typeof(o) == "string") { return "string" } else { if (o.tagName && o.tagName.toLowerCase() == "input") { return "input" } else { if (o.tagName && o.tagName.toLowerCase() == "textarea") { return "textarea" } else { if (o.tagName) { return "container" } else { if (typeof(o) == "object") { return "object" } else { return undefined } } } } } } } }; this._initByObject = function(l) { if (l.parent && l.parent.tagName) { h.base = l.parent } else { if (typeof(l.parent) == "string") { h.base = document.getElementById(l.parent) } else { h.base = document.createElement("div"); h.base._dhx_remove = true } } if (l.color) { h.conf.selectedColor = l.color } if (typeof(l.closeable) != "undefined") { this.conf.closeable = dhx4.s2b(l.closeable) } if (l.custom_colors) { this._tempInitCC = function() { var r, q; this.initMemoryColors(); this.conf.customColors = true; if (l.custom_colors instanceof Array) { q = l.custom_colors.length; for (r = 0; r < q; r++) { this.setCustomColors(l.custom_colors[r]) } } if (this.base.parentNode) { this.showMemory() } delete this._tempInitCC } } if (l.hide) { h.conf.hide = true } if (l.input) { h._addNode(l.input, l.target_color, l.target_value) } var o = l.skin || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxcolorpicker") || "material"; h.setSkin(o); if (l.colors) { h.initMemoryColors(); h.conf.customColors = true } if (l.link) { h._addNode(l.link) } }; this.unload = function() { var r, o, q; if (this.isVisible()) { this.hide() } this.destructMemory(); o = this._nodes.length; for (r = 0; r < o; r++) { this._detachEventsFromNode(this._nodes[r]); for (q in this._nodes[r]) { this._nodes[r][q] = null } delete this._nodes[r] } this._nodes = null; if (!this.base._dhx_remove) { this.base.className = this.base.className.replace(/\s?dhtmlxcp_\S*/, "") } else { delete this.base._dhx_remove } if (typeof(window.addEventListener) == "function") { this._controllerNodes.colorArea.removeEventListener("mousedown", this._initMoveSelection, false); this._controllerNodes.colorArea.removeEventListener("dblclick", this._doOnSelectColor, false); this._controllerNodes.contrastArea.removeEventListener("mousedown", this._initMoveContrast, false); this._controllerNodes.button_save.removeEventListener("click", this._doOnSelectColor, false); this._controllerNodes.button_cancel.removeEventListener("click", this._doOnCancel, false); this._controllerNodes.hue.removeEventListener("change", this._doOnChangeHSL, false); this._controllerNodes.sat.removeEventListener("change", this._doOnChangeHSL, false); this._controllerNodes.lum.removeEventListener("change", this._doOnChangeHSL, false); this._controllerNodes.red.removeEventListener("change", this._doOnChangeRGB, false); this._controllerNodes.green.removeEventListener("change", this._doOnChangeRGB, false); this._controllerNodes.blue.removeEventListener("change", this._doOnChangeRGB, false); this._controllerNodes.hsv.removeEventListener("change", this._doOnChangeHSV, false) } else { this._controllerNodes.colorArea.detachEvent("onmousedown", this._initMoveSelection); this._controllerNodes.colorArea.detachEvent("ondblclick", this._doOnSelectColor); this._controllerNodes.contrastArea.detachEvent("onmousedown", this._initMoveContrast); this._controllerNodes.button_save.detachEvent("onclick", this._doOnSelectColor); this._controllerNodes.button_cancel.detachEvent("onclick", this._doOnCancel); this._controllerNodes.hue.detachEvent("onchange", this._doOnChangeHSL); this._controllerNodes.sat.detachEvent("onchange", this._doOnChangeHSL); this._controllerNodes.lum.detachEvent("onchange", this._doOnChangeHSL); this._controllerNodes.red.detachEvent("onchange", this._doOnChangeRGB); this._controllerNodes.green.detachEvent("onchange", this._doOnChangeRGB); this._controllerNodes.blue.detachEvent("onchange", this._doOnChangeRGB); this._controllerNodes.hsv.detachEvent("onchange", this._doOnChangeHSV) } if (this._controllerNodes.fr_cover) { if (this._controllerNodes.fr_cover.parentNode) { this._controllerNodes.fr_cover.parentNode.removeChild(this._controllerNodes.fr_cover) } delete this._controllerNodes.fr_cover } dhx4.zim.clear(this.conf.cp_id); dhx4._eventable(this, "clear"); for (q in this) { this[q] = null } h = null, m = null, c = null }; g = this._checkType(n); switch (g) { case "object": h._initByObject(n); break; case "input": case "textarea": h._initByObject({}); this._addNode(n); break; case "string": m = document.getElementById(n); return new dhtmlXColorPicker(m); break; case "container": h._initByObject({ parent: n }); break; case null: h._initByObject({}); break; case "array_string": case "array_input": h._initByObject({}); a = n.length; for (e = 0; e < a; e++) { this._addNode(n[e]) } break; case "array_object": h._initByObject({}); a = n.length; for (e = 0; e < a; e++) { c = this._addNode(n[e].input, n[e].target_color, n[e].target_value).conf; c.customColors = (n[e].custom_colors != undefined) ? dhx4.s2b(n[e].custom_colors) : c.customColors; c.selectedColor = (n[e].color != undefined) ? n[e].color : c.selectedColor } break } this.base.innerHTML = "
" + this.i18n[this.conf.lang].labelHue + "" + this.i18n[this.conf.lang].labelRed + "
" + this.i18n[this.conf.lang].labelSat + "" + this.i18n[this.conf.lang].labelGreen + "
" + this.i18n[this.conf.lang].labelLum + "" + this.i18n[this.conf.lang].labelBlue + "
"; "
"; this._globalNode = this.base.firstChild; this._controllerNodes = { colorArea: this._globalNode.firstChild.firstChild.firstChild, v_line: this._globalNode.firstChild.firstChild.firstChild.childNodes[0], h_line: this._globalNode.firstChild.firstChild.firstChild.childNodes[1], contrastArea: this._globalNode.firstChild.firstChild.childNodes[1], contrast_line: this._globalNode.firstChild.firstChild.childNodes[1].firstChild, color: this._globalNode.firstChild.childNodes[1].childNodes[0].firstChild, hsv: this._globalNode.firstChild.childNodes[1].childNodes[0].childNodes[1], hue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[1].firstChild, sat: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[1].firstChild, lum: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[1].firstChild, red: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[3].firstChild, green: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[3].firstChild, blue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[3].firstChild, memory_block: this._globalNode.firstChild.childNodes[2], button_save: this._globalNode.firstChild.childNodes[3].firstChild, button_cancel: this._globalNode.firstChild.childNodes[3].childNodes[1] }; this._labelNodes = { labelHue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].firstChild, labelSat: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].firstChild, labelLum: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].firstChild, labelRed: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[2], labelGreen: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[2], labelBlue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[2], btnAddColor: null, btnSelect: this._globalNode.firstChild.childNodes[3].firstChild, btnCancel: this._globalNode.firstChild.childNodes[3].childNodes[1] }; if (typeof(this._tempInitCC) == "function") { this._tempInitCC() } if (typeof(window.addEventListener) == "function") { this._controllerNodes.colorArea.addEventListener("mousedown", this._initMoveSelection, false); this._controllerNodes.colorArea.addEventListener("dblclick", this._doOnSelectColor, false); this._controllerNodes.contrastArea.addEventListener("mousedown", this._initMoveContrast, false); this._controllerNodes.button_save.addEventListener("click", this._doOnSelectColor, false); this._controllerNodes.button_cancel.addEventListener("click", this._doOnCancel, false); this._controllerNodes.hue.addEventListener("change", this._doOnChangeHSL, false); this._controllerNodes.sat.addEventListener("change", this._doOnChangeHSL, false); this._controllerNodes.lum.addEventListener("change", this._doOnChangeHSL, false); this._controllerNodes.red.addEventListener("change", this._doOnChangeRGB, false); this._controllerNodes.green.addEventListener("change", this._doOnChangeRGB, false); this._controllerNodes.blue.addEventListener("change", this._doOnChangeRGB, false); this._controllerNodes.hsv.addEventListener("change", this._doOnChangeHSV, false) } else { this._controllerNodes.colorArea.attachEvent("onmousedown", this._initMoveSelection); this._controllerNodes.colorArea.attachEvent("ondblclick", this._doOnSelectColor); this._controllerNodes.contrastArea.attachEvent("onmousedown", this._initMoveContrast); this._controllerNodes.button_save.attachEvent("onclick", this._doOnSelectColor); this._controllerNodes.button_cancel.attachEvent("onclick", this._doOnCancel); this._controllerNodes.hue.attachEvent("onchange", this._doOnChangeHSL); this._controllerNodes.sat.attachEvent("onchange", this._doOnChangeHSL); this._controllerNodes.lum.attachEvent("onchange", this._doOnChangeHSL); this._controllerNodes.red.attachEvent("onchange", this._doOnChangeRGB); this._controllerNodes.green.attachEvent("onchange", this._doOnChangeRGB); this._controllerNodes.blue.attachEvent("onchange", this._doOnChangeRGB); this._controllerNodes.hsv.attachEvent("onchange", this._doOnChangeHSV) } this.setColor(this.conf.selectedColor || "#ffffff"); if (this._nodes.length) { for (var e = 0; e < this._nodes.length; e++) { this._attachEventsToNode(this._nodes[e]) } } if (this.conf.hide) { this.hide() } if (typeof(this._cpInitFRM) == "function") { this._cpInitFRM() } } dhtmlXColorPicker.prototype.linkTo = function(c, e, g) { if (arguments.length == 1) { e = g = c } var a; c = c || null; g = g || null; if (typeof(e) == "string") { e = document.getElementById(e) } a = this._addNode(e, c, g); if (a) { this._attachEventsToNode(a) } return a }; dhtmlXColorPicker.prototype._isBaseNode = function(a) { if (a == this.base) { return true } if (a.parentElement == document.body) { return false } else { if (!a.parentElement) { return false } else { return this._isBaseNode(a.parentElement) } } }; dhtmlXColorPicker.prototype._hasInput = function(e) { var c, a, g = false; a = this._nodes.length; for (c = 0; c < a; c++) { if (this._nodes[c].valueCont == e) { g = true; break } } return g }; dhtmlXColorPicker.prototype._findNodesByArray = function(h) { var e, a, c, g = []; a = h.length; for (e = 0; e < a; e++) { if (typeof(h[e]) == "string") { c = document.getElementById(h[e]) } else { c = h[e] } if (c) { this._addNode(c) } } }; dhtmlXColorPicker.prototype._addNode = function(h, m, l) { var c, g, e, a; if (typeof(h) == "string") { c = document.getElementById(h) } else { c = h } if (typeof(m) == "string") { m = document.getElementById(m) } if (typeof(l) == "string") { l = document.getElementById(l) } if (!c) { return null } if (dhx4.s2b(c.getAttribute("colorbox"))) { g = document.createElement("div"); g.style.width = c.offsetWidth + "px"; g.style.height = c.offsetHeight + "px"; c.style.width = c.offsetWidth - (c.offsetHeight + 8) + "px"; c.parentNode.insertBefore(g, c); g.style.position = "relative"; e = document.createElement("div"); g.appendChild(c); g.appendChild(e); e.className = "dhxcp_colorBox"; c.className += " dhxcp_colorInput"; e.style.width = e.style.height = c.offsetHeight + "px" } a = { node: c, valueColor: (m != undefined) ? m : e || c, valueCont: (l != undefined) ? l : c, conf: { customColors: (c.getAttribute("customcolors") != null) ? dhx4.s2b(c.getAttribute("customcolors")) : null, selectedColor: c.getAttribute("selectedcolor") } }; this._nodes.push(a); if (!this.activeNode) { this.activeNode = a } return a }; dhtmlXColorPicker.prototype.getNode = function(e) { var a = null, c = null; if (typeof(e) == "string") { a = document.getElementById(e) } else { a = e } if (a.tagName != undefined) { c = this._getNodeByElement(a) } return c }; dhtmlXColorPicker.prototype._getNodeByElement = function(e) { var g = null, c, a; a = this._nodes.length; for (c = 0; c < a; c++) { if (this._nodes[c].node == e) { g = this._nodes[c] } } return g }; dhtmlXColorPicker.prototype._getNodeByValueCont = function(e) { var g = null, c, a; a = this._nodes.length; for (c = 0; c < a; c++) { if (this._nodes[c].valueCont && this._nodes[c].valueCont == e) { g = this._nodes[c] } } return g }; dhtmlXColorPicker.prototype.initMemoryColors = function() { var c = this; this._controllerNodes.memory_block.innerHTML = "
"; this.memory = new this.Memory(this._controllerNodes.memory_block.childNodes[1]); this.memory.onSelect = this._onSelectMemoryEl; this.memory.onSave = function(g) { var e = c.colorAIP.rgb2hex({ r: g.red, g: g.green, b: g.blue }); c.callEvent("onSaveColor", [e]) }; var a = this._controllerNodes.memory_block.childNodes[0].firstChild; this._labelNodes.btnAddColor = this._controllerNodes.memory_block.childNodes[0].firstChild.firstChild; if (typeof(window.addEventListener) == "function") { a.addEventListener("click", this.saveColor, false) } else { a.attachEvent("onclick", this.saveColor) } }; dhtmlXColorPicker.prototype._refreshCoordinatesByHSL = function(n, m, c) { var a, g, e; a = Math.round((this.configColorArea.maxX - this.configColorArea.minX) * n / 359) + this.configColorArea.minX; g = Math.round((this.configColorArea.maxY - this.configColorArea.minY) * (100 - c) / 100) + this.configColorArea.minY; e = Math.round((this.configColorArea.maxY - this.configColorArea.minY) * (100 - m) / 100) + this.configColorArea.minY; this._setColorAreaXY(a, g); this._setContrastY(e) }; dhtmlXColorPicker.prototype._parseColor = function(e) { if (e instanceof Array) { var c = { r: parseInt(e[0]), g: parseInt(e[1]), b: parseInt(e[2]) } } else { if (typeof(e) == "string") { e = e.replace(/\s/g, ""); if (/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i.test(e)) { var a = e.match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i); var c = { r: parseInt(a[1]), g: parseInt(a[2]), b: parseInt(a[3]) } } else { var c = this.colorAIP.hex2rgb(e) } } } return c }; dhtmlXColorPicker.prototype.setColor = function(l) { var c = this.colorAIP.rgb2hex({ r: this.value.red, g: this.value.green, b: this.value.blue }); var e = this._parseColor(l); var h = (e instanceof Object); h = h && (0 <= e.r && e.r <= 255); h = h && (0 <= e.g && e.g <= 255); h = h && (0 <= e.b && e.b <= 255); if (!h) { return c } var g = this.colorAIP.rgb2hex({ r: e.r, g: e.g, b: e.b }); if (g == c) { return c } this.value.red = e.r; this.value.green = e.g; this.value.blue = e.b; var a = this.colorAIP.rgb2hsl(e.r / 255, e.g / 255, e.b / 255); this.value.hue = Math.round(a.h); this.value.sat = Math.round(a.s * 100); this.value.lum = Math.round(a.l * 100); this._refreshCoordinatesByHSL(this.value.hue, this.value.sat, this.value.lum); this._refreshContrast(); this._refreshInputValues(); this._refreshColorValue(); return g }; dhtmlXColorPicker.prototype.getSelectedColor = function() { return [this.colorAIP.rgb2hex({ r: this.value.red, g: this.value.green, b: this.value.blue }), [this.value.red, this.value.green, this.value.blue], [this.value.hue, this.value.sat, this.value.lum] ] }; dhtmlXColorPicker.prototype._attachEventsToNode = function(a) { if (typeof(window.addEventListener) == "function") { a.node.addEventListener("click", this._doOnClickByNode, false) } else { a.node.attachEvent("onclick", this._doOnClickByNode) } if (a.valueCont && a.valueCont.tagName.toLowerCase() == "input") { if (typeof(window.addEventListener) == "function") { a.valueCont.addEventListener("focus", this._doOnFocusByInput, false); a.valueCont.addEventListener("blur", this._doOnBlurByInput, false) } else { a.valueCont.attachEvent("onfocus", this._doOnFocusByInput); a.valueCont.attachEvent("onblur", this._doOnBlurByInput) } } }; dhtmlXColorPicker.prototype._detachEventsFromNode = function(a) { if (typeof(window.addEventListener) == "function") { a.node.removeEventListener("click", this._doOnClickByNode, false) } else { a.node.detachEvent("onclick", this._doOnClickByNode) } if (a.valueCont && a.valueCont.tagName.toLowerCase() == "input") { if (typeof(window.addEventListener) == "function") { a.valueCont.removeEventListener("focus", this._doOnFocusByInput, false); a.valueCont.removeEventListener("blur", this._doOnBlurByInput, false) } else { a.valueCont.detachEvent("onfocus", this._doOnFocusByInput); a.valueCont.detachEvent("onblur", this._doOnBlurByInput) } } }; dhtmlXColorPicker.prototype.show = function(c) { var a = false; if (c != undefined) { this.activeNode = this.getNode(c) || this.activeNode } if (this.activeNode && this.activeNode.valueCont && this.activeNode.valueCont.value) { this.setColor(this.activeNode.valueCont.value) } if (this.activeNode) { a = (this.activeNode.conf.customColors != null ? this.activeNode.conf.customColors : this.conf.customColors); this.setColor(this.activeNode.conf.selectedColor) } else { a = this.conf.customColors } if (a) { this.showMemory() } else { this.hideMemory() } if (this.base._dhx_remove) { this.base.firstChild.style.zIndex = dhx4.zim.reserve(this.conf.cp_id); this.base.style.visibility = "hidden"; if (document.body.firstChild) { document.body.insertBefore(this.base, document.body.firstChild) } else { document.body.appendChild(this.base) } this._refreshPosition(); this.base.style.visibility = "visible"; if (typeof(window.addEventListener) == "function") { document.body.addEventListener("mousedown", this._doOnClickByBody, false) } else { document.body.attachEvent("onmousedown", this._doOnClickByBody) } } else { this.base.appendChild(this._globalNode) } if (this._controllerNodes.fr_cover) { this.base.insertBefore(this._controllerNodes.fr_cover, this._globalNode) } this.callEvent("onShow", [((this.activeNode) ? this.activeNode.node : null)]) }; dhtmlXColorPicker.prototype.setPosition = function(c, h) { var g = null; var a = parseInt(c); var e = parseInt(h); if (isNaN(a)) { g = ({ right: "right", bottom: "bottom" }[c.toLowerCase()] ? c : null) } if (this.base._dhx_remove) { if (g == null) {} else { this.conf.position = g; this._refreshPosition(g) } } else { if (isNaN(a) || isNaN(e)) {} else { this._globalNode.style.left = a + "px"; this._globalNode.style.top = e + "px"; if (this._controllerNodes.fr_cover) { this._controllerNodes.fr_cover.style.left = this._globalNode.style.left; this._controllerNodes.fr_cover.style.top = this._globalNode.style.top } } } }; dhtmlXColorPicker.prototype._initListenerInput = function() { var a = this; this._inputListenerId = this._inputListenerId || setInterval(function() { a._refreshValueByInput() }, 70) }; dhtmlXColorPicker.prototype._removeListenerInput = function() { if (this._inputListenerId) { clearInterval(this._inputListenerId); this._inputListenerId = null } }; dhtmlXColorPicker.prototype._refreshValueByInput = function() { var c = this.activeNode.valueCont.value, a = this.getSelectedColor()[0]; if (this._inputListenerId) { if (/^#[\da-f]{6}$/i.test(c) && c != a) { this.setColor(c); this.callEvent("onSelect", [c, this.activeNode.node]) } } }; dhtmlXColorPicker.prototype._refreshPosition = function(c) { if (this.activeNode == null) { return } var n = dhx4.absTop(this.activeNode.node); var a = dhx4.absLeft(this.activeNode.node); var g = dhx4.screenDim(); var e = this._globalNode.offsetWidth; var h = this._globalNode.offsetHeight; var m = 0; c = c || this.conf.position; switch (c) { case "bottom": var m = n + this.activeNode.node.offsetHeight + this.conf.indent; var l = a; if (l + e > g.left + g.right) { l = a + this.activeNode.node.offsetWidth - e } if (l < g.left) { l = a } if (m + h > g.top + g.bottom) { m = n - h - this.conf.indent } if (m - g.top < 0) { m = g.top + this.conf.indent } this._globalNode.style.top = m + "px"; this._globalNode.style.left = l + "px"; break; default: var l = a + this.activeNode.node.offsetWidth + this.conf.indent; m = n; if (c == "right") { if (l + e > g.left + g.right) { l = a - e - this.conf.indent } if (l < g.left) { l = a + this.activeNode.node.offsetWidth + this.conf.indent } } if (g.bottom - (m + h) <= 0) { m = n + this.activeNode.node.offsetHeight - h } if (m - g.top < 0) { m = g.top + this.conf.indent } this._globalNode.style.left = l + "px"; this._globalNode.style.top = m + "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, material: true }; dhtmlXColorPicker.prototype.i18n = { en: { labelHue: "Hue", labelSat: "Sat", labelLum: "Lum", labelRed: "Red", labelGreen: "Green", labelBlue: "Blue", btnAddColor: "Save the color", btnSelect: "Select", btnCancel: "Cancel" } }; dhtmlXColorPicker.prototype.loadUserLanguage = function(a) { if (typeof(this._mergeLangModules) == "function") { this._mergeLangModules() } this.conf.lang = a; this._refreshLanguage() }; dhtmlXColorPicker.prototype._refreshLanguage = function() { var a, c = this.i18n[this.conf.lang]; for (a in c) { if (this._labelNodes[a]) { this._labelNodes[a].innerHTML = c[a] } } }; dhtmlXColorPicker.prototype._setColorAreaXY = function(a, e) { var c = this.configColorArea; a = parseInt(a); if (c.minX > a) { this.conf.x = c.minX } else { if (a > c.maxX) { this.conf.x = c.maxX } else { if (!isNaN(a)) { this.conf.x = a } } } e = parseInt(e); if (c.minY > e) { this.conf.y = c.minY } else { if (e > c.maxY) { this.conf.y = c.maxY } else { if (!isNaN(e)) { this.conf.y = e } } } this._refreshLines() }; dhtmlXColorPicker.prototype._setColorByXYC = function(c) { c = c || false; this.value.hue = Math.round((359 * (this.conf.x - this.configColorArea.minX)) / (this.configColorArea.maxX - this.configColorArea.minX)); this.value.lum = Math.round(100 - (100 * (this.conf.y - this.configColorArea.minY)) / (this.configColorArea.maxY - this.configColorArea.minY)); this.value.sat = Math.round(100 - (100 * (this.conf.c - this.configColorArea.minY)) / (this.configColorArea.maxY - this.configColorArea.minY)); var a = this.colorAIP.hsl2rgb(this.value.hue, this.value.sat / 100, this.value.lum / 100); this.value.red = Math.round(255 * a.r); this.value.green = Math.round(255 * a.g); this.value.blue = Math.round(255 * a.b); if (!c) { this._refreshContrast() } this._refreshInputValues(); this._refreshColorValue() }; dhtmlXColorPicker.prototype._setContrastY = function(c) { var a = this.configColorArea; c = parseInt(c); if (!isNaN(c)) { this.conf.c = Math.min(Math.max(a.minY, c), a.maxY) } this._refreshContrastLine() }; dhtmlXColorPicker.prototype._refreshInputValues = function() { this._controllerNodes.hue.value = this.value.hue; this._controllerNodes.sat.value = this.value.sat; this._controllerNodes.lum.value = this.value.lum; this._controllerNodes.red.value = this.value.red; this._controllerNodes.green.value = this.value.green; this._controllerNodes.blue.value = this.value.blue }; dhtmlXColorPicker.prototype._refreshColorValue = function() { this._controllerNodes.color.style.backgroundColor = "rgb(" + [this.value.red, this.value.green, this.value.blue].join(", ") + ")"; var a = this.colorAIP.rgb2hex({ r: this.value.red, g: this.value.green, b: this.value.blue }); this._controllerNodes.hsv.value = a; this.callEvent("onChange", [a]) }; dhtmlXColorPicker.prototype._refreshContrast = function() { var g = this.colorAIP.hsl2rgb(this.value.hue, 0, this.value.lum / 100); var h = this.colorAIP.hsl2rgb(this.value.hue, 1, this.value.lum / 100); var e = this._checkIeVersion(); if (e && e <= 9) { var 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 * g.r), g: Math.round(255 * g.g), b: Math.round(255 * g.b) }); var a = this.colorAIP.rgb2hex({ r: Math.round(255 * h.r), g: Math.round(255 * h.g), b: Math.round(255 * h.b) }); m.style.filter = "progid:DXImageTransform.Microsoft.gradient(startColorstr='" + a + "', endColorstr='" + c + "', GradientType=0)" } else { g = [Math.round(255 * g.r), Math.round(255 * g.g), Math.round(255 * g.b)]; h = [Math.round(255 * h.r), Math.round(255 * h.g), Math.round(255 * h.b)]; var l = "linear-gradient(rgb(" + h.join(",") + "), rgb(" + g.join(",") + "))"; if (window.dhx4.isKHTML == true && navigator.userAgent.match(/Windows/gi) != null) { l = "-webkit-" + l } this._controllerNodes.contrastArea.style.backgroundImage = l } }; dhtmlXColorPicker.prototype._refreshLines = function() { this._controllerNodes.v_line.style.left = this.conf.x + "px"; this._controllerNodes.h_line.style.top = this.conf.y + "px" }; dhtmlXColorPicker.prototype._refreshContrastLine = function() { this._controllerNodes.contrast_line.style.top = this.conf.c + "px" }; dhtmlXColorPicker.prototype._getOffsetPosition = function(h, a) { var c = { x: NaN, y: NaN }, g = h.target || h.srcElement; if (g == a) { c.x = (h.offsetX != undefined) ? h.offsetX : h.layerX; c.y = (h.offsetY != undefined) ? h.offsetY : h.layerY } else { if (g == this._controllerNodes.v_line) { c.y = (h.offsetY != undefined) ? h.offsetY : h.layerY } else { c.x = (h.offsetX != undefined) ? h.offsetX : h.layerX } } return c }; dhtmlXColorPicker.prototype.colorAIP = { hex2rgb: function(c) { var a = c.match(/^(#)([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i); if (a != null) { return { r: parseInt("0x" + a[2]), g: parseInt("0x" + a[3]), b: parseInt("0x" + a[4]) } } else { return null } }, rgb2hex: function(h) { var e = parseInt(h.r), c = parseInt(h.g), a = parseInt(h.b); e = e || 0, c = c || 0, a = a || 0; return "#" + ((e) ? ((e < 16) ? "0" + e.toString(16) : e.toString(16)) : "00") + ((c) ? ((c < 16) ? "0" + c.toString(16) : c.toString(16)) : "00") + ((a) ? ((a < 16) ? "0" + a.toString(16) : a.toString(16)) : "00") }, rgb2hsl: function(o, n, e) { var m, l, c; var a = Math.max(o, n, e), h = Math.min(o, n, e); c = 0.5 * (a + h); if (a == h) { m = 0 } else { if (a == o) { m = 60 * (n - e) / (a - h); if (n < e) { m += 360 } } else { if (a == n) { m = 60 * (e - o) / (a - h) + 120 } else { m = 60 * (o - n) / (a - h) + 240 } } } if (c == 0 || a == h) { l = 0 } else { if (c <= 0.5) { l = 0.5 * (a - h) / c } else { l = 0.5 * (a - h) / (1 - c) } } return { h: m, s: l, l: c } }, hsl2rgb: function(o, e, m) { var h, l, n; var c = [], a = []; if (m <= 0.5) { h = m * (1 + e) } else { h = m + e - (m * e) } l = 2 * m - h; n = o / 360; c.push(n + 1 / 3); c.push(n); c.push(n - 1 / 3); for (var g = 0; g < 3; g++) { if (c[g] < 0) { c[g] += 1 } else { if (c[g] > 1) { c[g] -= 1 } } if (c[g] < 1 / 6) { a.push(l + (h - l) * 6 * c[g]) } else { if (c[g] < 0.5) { a.push(h) } else { if (c[g] < 2 / 3) { a.push(l + (h - l) * (2 / 3 - c[g]) * 6) } else { a.push(l) } } } } return { r: a[0], g: a[1], b: a[2] } } }; dhtmlXColorPicker.prototype._checkIeVersion = function() { var a; var c = navigator.userAgent.match(/(MSIE)\s(\d\.\d)/i); a = (c && c[2]) ? parseInt(c[2]) : null; return a }; dhtmlXColorPicker.prototype.setCustomColors = function() { if (this.memory == null) { this.initMemoryColors(); this.conf.customColors = true } var g, e, m, c, h, a; e = arguments.length; for (g = 0; g < e; g++) { if (arguments[g] instanceof Array) { m = this._rgb2value(arguments[g][0], arguments[g][1], arguments[g][2]); this.memory.setValue(m, null, false); continue } else { if (typeof(arguments[g]) == "string") { c = arguments[g].match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i); if (c instanceof Array) { m = this._rgb2value(c[1], c[2], c[3]); this.memory.setValue(m, null, false); continue } c = arguments[g].match(/(#[\da-f]{6})/ig); if (c instanceof Array) { a = c.length; for (h = 0; h < a; h++) { m = this._hex2value(c[h]); this.memory.setValue(m, null, false) } } } } } }; dhtmlXColorPicker.prototype.getCustomColors = function() { var c = []; if (this.memory != null && this.conf.customColors == true) { for (var e = 0; e < this.memory.controllers.length; e++) { var a = this.memory.controllers[e].value; c.push(this.colorAIP.rgb2hex({ r: a.red, g: a.green, b: a.blue })) } } return c }; dhtmlXColorPicker.prototype._rgb2value = function(h, e, a) { var c = this.colorAIP.rgb2hsl(h / 255, e / 255, a / 255); return { red: h, green: e, blue: a, hue: Math.round(c.h), sat: Math.round(c.s * 100), lum: Math.round(c.l * 100) } }; dhtmlXColorPicker.prototype._hex2value = function(e) { var c, a; c = this.colorAIP.hex2rgb(e); a = this.colorAIP.rgb2hsl(c.r / 255, c.g / 255, c.b / 255); return { red: c.r, green: c.g, blue: c.b, hue: Math.round(a.h), sat: Math.round(a.s * 100), lum: Math.round(a.l * 100) } }; dhtmlXColorPicker.prototype.showMemory = function() { if (this.memory == null) { this.initMemoryColors() } if (!this._globalNode.className.match(/dhxcp_add_memory/)) { this._globalNode.className += " dhxcp_add_memory" } this.conf.customColors = true }; dhtmlXColorPicker.prototype.hideMemory = function() { if (this.memory != null) { this._globalNode.className = this._globalNode.className.replace(/\sdhxcp_add_memory/, "") } this.conf.customColors = false }; dhtmlXColorPicker.prototype.setSkin = function(h) { if (this._skinCollection[h] != true) { return } var g = "dhtmlxcp_" + (this.skin || "dummy"); this.base.className = this.base.className.replace(new RegExp(g), ""); this.base.className += " dhtmlxcp_" + h; this.skin = h; if (this.skin == "material") { var e = { labelHue: "H", labelSat: "S", labelLum: "L", labelRed: "R", labelGreen: "G", labelBlue: "B" }; for (var c in e) { this.i18n.en[c] = e[c] } } if (this.base.className.match(/dhxcp_shadow/) == null && !(dhx4.isIE6 || dhx4.isIE7 || dhx4.isIE8)) { this.base.className += " dhxcp_shadow" } }; dhtmlXColorPicker.prototype.hideOnSelect = function(a) { a = dhx4.s2b(a); this.conf.hideOnSelect = a }; dhtmlXColorPicker.prototype._indexOf = function(a, g) { var e, c, h = -1; c = a.length; for (e = c; e >= 0; e--) { if (a[e] == g) { h = e; break } } return h }; dhtmlXColorPicker.prototype.destructMemory = function() { if (this.memory == null) { return } this.hideMemory(); var a = this._controllerNodes.memory_block.childNodes[0].firstChild; this._labelNodes.btnAddColor = null; if (typeof(window.addEventListener) == "function") { a.removeEventListener("click", this.saveColor, false) } else { a.detachEvent("onclick", this.saveColor) } this.memory.remove(); this._controllerNodes.memory_block.innerHTML = ""; this.memory = null }; dhtmlXColorPicker.prototype.Memory = function(e) { var c = this, a = null, g = { red: 255, blue: 255, green: 255, hue: 0, sat: 0, lum: 100 }; this.select = function() { var l = (this != window) ? this : event.srcElement; var h = h || l.dhxpc_memory; if (a != null) { c.unSelect() } a = h; h.domElement.className += " dhxcp_memory_el_select"; if (typeof(c.onSelect) == "function") { c.onSelect(h) } }; this.onSelect = null; this.onSave = null; this._createMemoryController = function(h) { var l = { domElement: h, value: dhx4._copyObj(g) }; h.dhxpc_memory = l; if (typeof(window.addEventListener) == "function") { h.addEventListener("click", c.select, false) } else { h.attachEvent("onclick", c.select) } return l }; this._findMemoryControllers = function(q) { var n = q.getElementsByTagName("a"), m, h, o = []; h = n.length; for (m = 0; m < h; m++) { o.push(this._createMemoryController(n[m])) } return o }; this.controllers = this._findMemoryControllers(e); this.unSelect = function() { if (a) { a.domElement.className = a.domElement.className.replace(/\s.*$/i, "") } a = null }; this.setActiveNext = function() { var m = null, h; if (a == null) { a = this.controllers[0] } else { m = this.getIndex(a); h = this.controllers.length; this.unSelect(); a = (m + 1 < h) ? this.controllers[m + 1] : this.controllers[0] } a.domElement.className += " dhxcp_memory_el_next"; return a }; this.setValue = function(l, h, m) { a = h || a; if (a == null) { a = this.controllers[0] } a.value.red = l.red; a.value.blue = l.blue; a.value.green = l.green; a.value.hue = l.hue; a.value.sat = l.sat; a.value.lum = l.lum; a.domElement.style.backgroundColor = "rgb(" + [l.red, l.green, l.blue].join(", ") + ")"; this.setActiveNext(); if ((m != false) && (typeof(this.onSave) == "function")) { this.onSave(l) } }; this.clean = function() { var h = this.controllers.length, n; for (var m = 0; m < h; m++) { n = this.controllers[m]; n.value = dhx4._copyObj(g); n.domElement.style.backgroundColor = "rgb(" + [g.red, g.green, g.blue].join(", ") + ")" } this.unSelect(); a = this.controllers[0] }; this.getIndex = function(n) { var m, h, o = -1; h = this.controllers.length; for (m = 0; m < h; m++) { if (this.controllers[m] == n) { o = m; break } } return o }; this.remove = function() { var m, h; h = this.controllers.length; for (m = 0; m < h; m++) { if (typeof(window.addEventListener) == "function") { this.controllers[m].domElement.removeEventListener("click", this.select, false) } else { this.controllers[m].domElement.detachEvent("onclick", this.select) } delete this.controllers[m].domElement.dhxpc_memory } delete this.onSelect; delete this.controllers; delete this.onSave } }; if (window.dhx4.isIE6) { dhtmlXColorPicker.prototype._cpInitFRM = function() { var a; if (!this._controllerNodes.fr_cover) { a = document.createElement("IFRAME"); a.className = "dhxcp_frm"; a.border = 0; a.frameBorder = 0; this._controllerNodes.fr_cover = a } if (!this.base._dhx_remove) { this.base.insertBefore(a, this._globalNode) } } } function dhtmlXSlider(c) { var a = this; this.conf = { size: null, skin: null, vertical: false, min: 0, max: 99, value: 0, step: 1, decimals: 0, margin: 2, border: 1, inverse: false, disabled: false, tooltip: false, visible: true, linkTo: null, range: false, bg: null, bg_mode: "left" }; this._attachedNode = {}; this._movingInitialValues = null; this.base = null; if (arguments.length > 1) { return new dhtmlXSlider(this._renderArgumets(arguments)) } else { if (typeof(c) == "string" || (typeof(c) == "object" && c.tagName)) { return new dhtmlXSlider({ parent: c }) } } if (typeof(c.parent) == "string") { this.base = document.getElementById(c.parent) } else { this.base = c.parent } this._mergeConfig(this._readAttFormNode(this.base)); this._mergeConfig(c); if (this.conf.bg == null) { this.conf.bg = (this.conf.range == true) } if (this.conf.range == true) { if (!(this.conf.value instanceof Array)) { this.conf.value = [this.conf.value] } if (this.conf.value.length < 2) { this.conf.value.push(this.conf.value[0]) } if (!(this.conf.linkTo instanceof Array)) { this.conf.linkTo = [this.conf.linkTo] } } this._detectDecimals(); if (this.conf.size == null || typeof(this.conf.size) == "undefined") { if (this.conf.vertical) { this.conf.size = this.base.offsetHeight } else { this.conf.size = this.base.offsetWidth } } var e = this.conf.skin || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxslider") || "material"; this.setSkin(e); this.base.innerHTML = "
" + (this.conf.bg == true ? "
" : "") + "
" + (this.conf.range == true ? "
" : "") + "
"; this._nodes = { cont: this.base.firstChild, track: this.base.firstChild.firstChild, runner: this.base.firstChild.childNodes[1], runner2: this.base.firstChild.childNodes[2] }; this._nodes.cont.onmousedown = this._nodes.track.onmousedown = this._nodes.cont.onselectstart = this._nodes.track.onselectstart = function(g) { g = g || event; if (typeof(g.preventDefault) == "function") { g.preventDefault() } else { g.returnValue = false } return false }; this._r_actv = null; if (this.conf.range == true) { this.conf.value = this._normalizeRange(this.conf.value, this.conf.min, this.conf.max) } else { this.conf.value = this._normalize(this.conf.value, this.conf.min, this.conf.max) } this._setOrient(this.conf.vertical); this.setSize(this.conf.size); this._initMover = function(h, g) { if (a.conf.disabled) { return } h = h || event; if (typeof(h.preventDefault) == "function") { h.preventDefault() } if (g != null) { a._r_actv = a._nodes[g == 0 ? "runner" : "runner2"] } else { a._r_actv = h.target || h.srcElement; if (a._r_actv.className.indexOf("dhxsl_runner") == -1) { a._r_actv = a._nodes.runner } } a._r_actv.className = "dhxsl_runner dhxsl_runner_actv"; a._movingInitialValues = {}; if (a.conf.range == true) { a._movingInitialValues.index = (a._r_actv == a._nodes.runner ? 0 : 1); a._movingInitialValues.value = a.conf.value[a._movingInitialValues.index] } else { a._movingInitialValues.value = a.conf.value } a._movingInitialValues.coord = a._getTouchCoord(h); if (a.conf.disabled == false) { if (typeof(window.addEventListener) == "function") { window.addEventListener("mousemove", a._move, false); window.addEventListener("mouseup", a._cleanMove, false); window.addEventListener("touchmove", a._move, false); window.addEventListener("touchend", a._cleanMove, false) } else { document.body.attachEvent("onmousemove", a._move); document.body.attachEvent("onmouseup", a._cleanMove) } } a.callEvent("onMouseDown", [a._r_actv == a._nodes.runner ? 0 : 1]); return false }; this._move = function(o) { if (a.conf.disabled) { return } o = o || event; if (typeof(o.preventDefault) == "function") { o.preventDefault() } var n = (a.conf.vertical) ? a._r_actv.offsetHeight : a._r_actv.offsetWidth; var l = a.conf.max - a.conf.min; var h = a._getTouchCoord(o); var m = a._movingInitialValues.value + (h - a._movingInitialValues.coord) * l / (a.conf.size - n) * (a.conf.inverse ? -1 : 1); if (a.conf.range == true) { var g = [a.conf.value[0], a.conf.value[1]]; if (a._movingInitialValues.index == 0) { g[0] = Math.min(g[1], m) } else { if (a._movingInitialValues.index == 1) { g[1] = Math.max(g[0], m) } } a.setValue(g, true) } else { a.setValue(m, true) } }; this._cleanMove = function(g) { if (typeof(window.addEventListener) == "function") { window.removeEventListener("mousemove", a._move, false); window.removeEventListener("mouseup", a._cleanMove, false); window.removeEventListener("touchmove", a._move, false); window.removeEventListener("touchend", a._cleanMove, false) } else { document.body.detachEvent("onmousemove", a._move); document.body.detachEvent("onmouseup", a._cleanMove) } a._movingInitialValues = null; a._r_actv.className = a._r_actv.className.replace(/\s{0,}dhxsl_runner_actv/gi, ""); a.callEvent("onSlideEnd", [a.conf.value]); a.callEvent("onMouseUp", [a._r_actv == a._nodes.runner ? 0 : 1]); a._r_actv = null }; this._doOnSetValue = function(r) { if (a.conf.disabled) { return } if (a._movingInitialValues != null) { return false } r = r || event; if (typeof(r.preventDefault) == "function") { r.preventDefault() } var q = 0; var m = r.target || r.srcElement; if (m.className.match(/dhxsl_track_bg/) != null) { q = parseInt(m.style[a.conf.vertical ? "top" : "left"]) } if (r.type.match(/touch/) != null) { var o = a._getTouchCoord(r) + q } else { var o = (a.conf.vertical ? (r.offsetY || r.layerY) : (r.offsetX || r.layerX)) + q } var n = (a.conf.vertical ? a._nodes.runner.offsetHeight : a._nodes.runner.offsetWidth) + q; var g = a.conf.max - a.conf.min; var h = null; var l = null; if (a.conf.inverse == true) { l = a.conf.max - (o * g / (a.conf.size)) } else { l = (o * g / (a.conf.size) + a.conf.min) } if (a.conf.range == true) { h = (Math.abs(a.conf.value[0] - l) <= Math.abs(a.conf.value[1] - l) ? 0 : 1); l = [h == 0 ? l : a.conf.value[0], h == 1 ? l : a.conf.value[1]] } a.conf.init_index = h; a.setValue(l, true); a.conf.init_index = null; if (a._movingInitialValues == null) { a._initMover(r, h) } return false }; this._doOnChangeInput = function(h) { h = h || event; var g = h.target || h.srcElement; a.setValue(g.value) }; this._doOnKeyDown = function(h) { h = h || event; var g = h.target || h.srcElement; if (h.keyCode == 13) { a.setValue(g.value) } }; this._attachEvents(this._nodes); this.unload = function() { dhx4._eventable(this, "clear"); this._detachNode(); this._detachEvents(this._nodes); this.base.removeChild(this._nodes.cont); this._nodes.cont.onmousedown = this._nodes.track.onmousedown = this._nodes.cont.onselectstart = this._nodes.track.onselectstart = null; delete this._nodes.cont; delete this._nodes.track; delete this._nodes.max; delete this._nodes.min; delete this._nodes.runner; if (this._nodes.runner2) { delete this._nodes.runner2 } if (/\s?dhtmlxslider_\S*/.test(this.base.className)) { this.base.className = this.base.className.replace(/\s?dhtmlxslider_\S*/, "") } for (var g in this) { this[g] = null } a = null }; dhx4._eventable(this); if (this.conf.disabled) { this.disable() } if (this.conf.tooltip) { this.enableTooltip() } if (!this.conf.visible) { this.hide() } if (this.conf.linkTo) { this.linkTo(this.conf.linkTo) } return this } dhtmlXSlider.prototype._setOrient = function(a) { a = a || false; if (/\s?dhxsl_cont_hr/i.test(this._nodes.cont.className)) { this._nodes.cont.className = this._nodes.cont.className.replace(/\s?dhxsl_cont_hr/i, "") } if (/\s?dhxsl_cont_vr/i.test(this._nodes.cont.className)) { this._nodes.cont.className = this._nodes.cont.className.replace(/\s?dhxsl_cont_vr/i, "") } if (a) { this._nodes.cont.className += " dhxsl_cont_vr" } else { this._nodes.cont.className += " dhxsl_cont_hr" } }; dhtmlXSlider.prototype._getTouchCoord = function(c) { var a = (c.type.match(/mouse/) != null ? "client" : "page") + (this.conf.vertical == true ? "Y" : "X"); var g = (typeof(c[a]) != "undefined" && c[a] != 0 ? c[a] : (c.touches != null && c.touches[0] != null ? c.touches[0][a] || 0 : 0)); return g }; dhtmlXSlider.prototype._attachEvents = function(a) { if (typeof(window.addEventListener) == "function") { a.runner.addEventListener("mousedown", this._initMover, false); a.runner.addEventListener("touchstart", this._initMover, false); a.cont.addEventListener("mousedown", this._doOnSetValue, false); a.cont.addEventListener("touchstart", this._doOnSetValue, false); if (a.runner2) { a.runner2.addEventListener("mousedown", this._initMover, false); a.runner2.addEventListener("touchstart", this._initMover, false) } } else { a.runner.attachEvent("onmousedown", this._initMover); a.cont.attachEvent("onmousedown", this._doOnSetValue); if (a.runner2) { a.runner2.attachEvent("onmousedown", this._initMover) } } }; dhtmlXSlider.prototype._detachEvents = function(a) { if (typeof(window.addEventListener) == "function") { a.runner.removeEventListener("mousedown", this._initMover, false); a.runner.removeEventListener("touchstart", this._initMover, false); a.cont.removeEventListener("mousedown", this._doOnSetValue, false); a.cont.removeEventListener("touchstart", this._doOnSetValue, false); if (a.runner2) { a.runner2.removeEventListener("mousedown", this._initMover, false); a.runner2.removeEventListener("touchstart", this._initMover, false) } } else { a.runner.detachEvent("onmousedown", this._initMover); a.cont.detachEvent("onmousedown", this._doOnSetValue); if (a.runner2) { a.runner2.detachEvent("onmousedown", this._initMover) } } }; dhtmlXSlider.prototype._mergeConfig = function(c) { for (var a in c) { switch (a.toLowerCase()) { case "min": case "max": case "size": case "step": case "value": case "inverse": this.conf[a] = c[a]; break; case "tooltip": case "visible": case "vertical": case "disabled": case "range": case "bg": this.conf[a] = dhx4.s2b(c[a]); break; case "bg_mode": this.conf[a] = ({ left: "left", right: "right" }[c[a]]) || "left"; break; case "parent": continue; break; case "skin": this.conf[a] = (this._skinCollection[c[a]] == true ? c[a] : null); break; default: this.conf[a] = c[a] } } }; dhtmlXSlider.prototype._readAttFormNode = function(g) { var m = g.attributes, a = m.length, e, h = {}, c; for (e = 0; e < a; e++) { c = m[e]; switch (c.name.toLowerCase()) { case "size": case "min": case "max": case "value": case "step": h[c.name] = Number(c.value); break; case "skin": h[c.name] = c.value; break; case "vertical": case "disabled": case "visible": case "range": case "bg": h[c.name] = dhx4.s2b(c.value); break; case "linkto": h[c.name] = c.value; break; case "tooltip": h[c.name] = dhx4.s2b(c.value); break; case "bg_mode": h[c.name] = ({ left: "left", right: "right" }[c.value]) || "left"; break } } return h }; dhtmlXSlider.prototype._renderArgumets = function(a) { var g = {}, e, c; c = a.length; for (e = 0; e < c; e++) { switch (e) { case 0: g.parent = a[e]; break; case 1: g.size = a[e]; break; case 2: g.skin = a[e]; break; case 3: g.vertical = a[e]; break; case 4: g.min = a[e]; break; case 5: g.max = a[e]; break; case 6: g.value = a[e]; break; case 7: g.step = a[e]; break } } return g }; dhtmlXSlider.prototype._skinCollection = { dhx_skyblue: true, dhx_web: true, dhx_terrace: true, material: true }; dhtmlXSlider.prototype._indexOf = function(a, g) { var e, c, h = -1; c = a.length; for (e = c; e >= 0; e--) { if (a[e] == g) { h = e; break } } return h }; dhtmlXSlider.prototype._refreshRunner = function(h) { var g = (this.conf.vertical == true ? { x: "top", y: "left", ofs_w: "offsetHeight", ofs_h: "offsetWidth" } : { x: "left", y: "top", ofs_w: "offsetWidth", ofs_h: "offsetHeight" }); var a = this._nodes.cont[g.ofs_w] - this._nodes.runner[g.ofs_w]; var e = this._nodes.runner; var c = this._nodes.runner2; if (h == null || h == 0) { var l = this._getCoord(a, (this.conf.value instanceof Array ? this.conf.value[0] : this.conf.value)); e.style[g.x] = l + this.conf.border + "px"; e.style[g.y] = Math.round((this._nodes.cont[g.ofs_h] - e[g.ofs_h]) / 2) + "px" } if (this.conf.range == true && (h == null || h == 1)) { var l = this._getCoord(a, this.conf.value[1]); c.style[g.x] = l + this.conf.border + "px"; c.style[g.y] = Math.round((this._nodes.cont[g.ofs_h] - e[g.ofs_h]) / 2) + "px" } if (this.conf.range == true) { if (e.style[g.x] == c.style[g.x] && this.conf.value[1] == this.conf.max) { if (e.style.zIndex != 2) { e.style.zIndex = 2 } } else { if (e.style.zIndex == 2) { e.style.zIndex = 1 } } } e = c = null; this._refreshBG() }; dhtmlXSlider.prototype._setValueByCoord = function(g) { var a = dhx4.absLeft(this._nodes.cont), h = dhx4.absTop(this._nodes.cont), e, c; if (this.conf.vertical) { c = (g.y - h - this._nodes.runner.offsetHeight / 2) / (this._nodes.cont.offsetHeight - this._nodes.runner.offsetHeight) } else { c = (g.x - a - this._nodes.runner.offsetWidth / 2) / (this._nodes.cont.offsetWidth - this._nodes.runner.offsetWidth) } e = (this.conf.max - this.conf.min) * c + this.conf.min; this.setValue(e, true) }; dhtmlXSlider.prototype._getCoord = function(a, g) { var e = (this.conf.inverse ? this._inverseValue(g) : g); var c = (e - this.conf.min) / (this.conf.max - this.conf.min); return Math.round(a * c) }; dhtmlXSlider.prototype._normalize = function(g, e, a) { g = Number(g); g = Math.round(g / this.conf.step) * this.conf.step; var c = Math.pow(10, this.conf.decimals); g = Math.round(g * c) / c; g = Math.max(e, Math.min(a, g)); return g }; dhtmlXSlider.prototype._normalizeRange = function(e, c, a) { if (e[1] < e[0]) { e[1] = e[0] } e[0] = this._normalize(e[0], c, Math.min(a, e[1])); e[1] = this._normalize(e[1], Math.max(c, e[0]), a); return e }; dhtmlXSlider.prototype._refreshBG = function() { if (this.conf.bg != true) { return } var g = this._nodes.track.firstChild; var e = this._nodes.runner; var a = e.nextSibling; var c = (this.conf.vertical == true ? { x: "top", w: "height", ofs: "offsetHeight" } : { x: "left", w: "width", ofs: "offsetWidth" }); if (this.conf.range == true) { g.style[c.x] = Math.floor(parseInt(e.style[c.x]) + e[c.ofs] / 2) + "px"; g.style[c.w] = Math.max(Math.floor(parseInt(a.style[c.x]) + a[c.ofs] / 2) - parseInt(g.style[c.x]), 0) + "px" } else { var h = (this.conf.inverse == true ? { left: "right", right: "left" }[this.conf.bg_mode] : this.conf.bg_mode); g.style[c.x] = (h == "left" ? "0" : Math.floor(parseInt(e.style[c.x]) + e[c.ofs] / 2)) + "px"; g.style[c.w] = (h == "left" ? Math.floor(parseInt(e.style[c.x]) + e[c.ofs] / 2) : this._nodes.track[c.ofs] - parseInt(g.style[c.x])) + "px" } g = e = a = null }; dhtmlXSlider.prototype._attachNode = function(e, a) { this._detachNode(a); var c = e.tagName.toLowerCase(); if (!c) { return } this._attachedNode["node_" + a] = e; switch (c) { case "input": case "select": if (typeof(window.addEventListener) == "function") { e.addEventListener("change", this._doOnChangeInput, false); e.addEventListener("keydown", this._doOnKeyDown, false) } else { e.attachEvent("onchange", this._doOnChangeInput); e.attachEvent("onkeydown", this._doOnKeyDown) } this._attachedNode.setValue = function(m, g, l) { var h = (m instanceof Array ? m[l || 0] : m); this["node_" + (l || 0)].value = dhtmlXSlider.prototype._atatchedNodeFixDec(h, g) }; break; default: this._attachedNode.setValue = function(m, g, l) { var h = (m instanceof Array ? m[l || 0] : m); this["node_" + (l || 0)].innerHTML = dhtmlXSlider.prototype._atatchedNodeFixDec(h, g) } } this._attachedNode.setValue(this.conf.value, this.conf.decimals, a) }; dhtmlXSlider.prototype._detachNode = function(a) { var e = this._attachedNode["node_" + a]; if (!e) { return } var c = e.tagName; switch (c) { case "input": case "select": if (typeof(window.addEventListener) == "function") { e.removeEventListener("change", this._doOnChangeInput, false); e.removeEventListener("keydown", this._doOnChangeInput, false) } else { e.detachEvent("change", this._doOnChangeInput); e.detachEvent("keydown", this._doOnChangeInput) } break } delete this._attachedNode["node_" + a]; delete this._attachedNode.setValue; e = null }; dhtmlXSlider.prototype._atatchedNodeFixDec = function(g, a) { g = String(g); if (a > 0) { var c = g.match(/\.\d{1,}$/); if (c != null) { a = Math.max(a - c[0].length + 1) } g += (g.indexOf(".") < 0 ? "." : ""); for (var e = 0; e < a; e++) { g += "0" } } return g }; dhtmlXSlider.prototype._detectDecimals = function() { var a = this.conf.step.toString().match(/\.(\d*)$/); this.conf.decimals = (a != null ? a[1].length : 0) }; dhtmlXSlider.prototype.setSize = function(a) { if (!isNaN(a)) { if (this.conf.vertical) { if (this._nodes.cont.style.width) { delete this._nodes.cont.style.width } this._nodes.cont.style.height = a - this.conf.margin + "px" } else { if (this._nodes.cont.style.height) { delete this._nodes.cont.style.height } this._nodes.cont.style.width = a - this.conf.margin + "px" } this._refreshRunner() } }; dhtmlXSlider.prototype.setSkin = function(h) { h = h.toLowerCase(); var e, c = -1, a, g = "dhtmlxslider"; e = this.base.className.match(/\S\w+/ig); if (e instanceof Array) { for (a in this._skinCollection) { if (c == -1) { c = this._indexOf(e, g + "_" + a) } else { break } } c = (c == -1) ? e.length : c } else { e = []; c = 0 } e[c] = g + "_" + h; this.base.className = e.join(" "); this.conf.skin = h; if (this._nodes) { this._refreshRunner() } }; dhtmlXSlider.prototype.setValue = function(g, h) { h = h || false; var c = null; var e = false; if (this.conf.range == true) { if (this._r_actv != null) { c = (this._r_actv == this._nodes.runner ? 0 : 1) } g = this._normalizeRange(g, this.conf.min, this.conf.max); e = (this.conf.value[0] != g[0] || this.conf.value[1] != g[1]) } else { g = this._normalize(g, this.conf.min, this.conf.max); e = (this.conf.value != g) } if (e = true) { this.conf.value = g; this._refreshRunner(c); this._refreshTooltip(); if (h) { var a = [g, this]; if (this.conf.range == true) { if (this._r_actv != null) { a.push(this._r_actv == this._nodes.runner ? 0 : 1) } else { if (this.conf.init_index != null) { a.push(this.conf.init_index.valueOf()) } } } this.callEvent("onChange", a) } } if (typeof(this._attachedNode.setValue) == "function") { if (c == null) { c = this.conf.init_index } if (typeof c === "undefined" && g instanceof Array) { this._attachedNode.setValue(this.conf.value, this.conf.decimals, (c || 0)); this._attachedNode.setValue(this.conf.value, this.conf.decimals, (c || 0) + 1) } else { this._attachedNode.setValue(this.conf.value, this.conf.decimals, c) } } }; dhtmlXSlider.prototype.getValue = function() { if (this.conf.range == true) { return [this.conf.value[0].valueOf(), this.conf.value[1].valueOf()] } else { return this.conf.value.valueOf() } }; dhtmlXSlider.prototype._inverseValue = function(a) { return this.conf.max + this.conf.min - a }; dhtmlXSlider.prototype.disable = function(h) { h = (h == false) ? false : true; var g = null; if (h) { for (var c in this._nodes) { if (c == "cont") { continue } var e = (c == "runner2" ? "runner" : c); if (this._nodes[c] != null) { g = new RegExp("\\s?dhxsl_" + e + "_dis", "i"); if (!g.test(this._nodes[c].className)) { this._nodes[c].className += " dhxsl_" + e + "_dis" } } } this.conf.disabled = true } else { this.enable() } }; dhtmlXSlider.prototype.enable = function() { var g; for (var c in this._nodes) { if (c == "cont") { continue } var e = (c == "runner2" ? "runner" : c); if (this._nodes[c] != null) { g = new RegExp("\\s?dhxsl_" + e + "_dis", "i"); if (g.test(this._nodes[c].className)) { this._nodes[c].className = this._nodes[c].className.replace(g, "") } } } this.conf.disabled = false }; dhtmlXSlider.prototype.isEnabled = function() { return !this.conf.disabled }; dhtmlXSlider.prototype.disableTooltip = function() { this._nodes.cont.removeAttribute("title"); this.conf.tooltip = false }; dhtmlXSlider.prototype.enableTooltip = function(a) { if (typeof(a) == "undefined") { a = true } else { a = dhx4.s2b(a) } if (a) { this.conf.tooltip = true; this._refreshTooltip() } else { this.disableTooltip() } }; dhtmlXSlider.prototype.setMax = function(a) { if (!isNaN(a) && this.conf.min < a) { this.conf.max = a; this.setValue(this.conf.value) } }; dhtmlXSlider.prototype.getMax = function() { return this.conf.max }; dhtmlXSlider.prototype.setMin = function(a) { if (!isNaN(a) && this.conf.max > a) { this.conf.min = a; this.setValue(this.conf.value) } }; dhtmlXSlider.prototype.getMin = function() { return this.conf.min }; dhtmlXSlider.prototype.setStep = function(a) { var c = this.conf.max - this.conf.min; if (!isNaN(a) && a < c) { this.conf.step = a; this._detectDecimals(); this.setValue(this.conf.value) } }; dhtmlXSlider.prototype.getStep = function() { return this.conf.step }; dhtmlXSlider.prototype.show = function() { if (/\s?dhxsl_hidden/i.test(this._nodes.cont.className)) { this._nodes.cont.className = this._nodes.cont.className.replace(/\s?dhxsl_hidden/i, "") } this.conf.visible = true }; dhtmlXSlider.prototype.hide = function() { if (!/\s?dhxsl_hidden/i.test(this._nodes.cont.className)) { this._nodes.cont.className += " dhxsl_hidden" } this.conf.visible = false }; dhtmlXSlider.prototype.isVisible = function() { return this.conf.visible }; dhtmlXSlider.prototype.linkTo = function(a) { if (!(a instanceof Array)) { a = [a] } for (var c = 0; c < a.length && c < 2; c++) { if (a[c] != null) { if (typeof(a[c]) == "string") { a[c] = document.getElementById(a[c]) } this._attachNode(a[c], c) } } }; dhtmlXSlider.prototype._refreshTooltip = function() { if (this.conf.tooltip == true) { if (this.conf.value instanceof Array) { this._nodes.cont.title = this.conf.value.join(", ") } else { this._nodes.cont.title = this.conf.value } } }; dhtmlXSlider.prototype.getRunnerIndex = function() { if (this._r_actv == null) { return -1 } return (this._r_actv == this._nodes.runner ? 0 : 1) }; function dhtmlXPopup(e) { var g = this; this.conf = e || {}; e = null; this.mode = (this.conf.mode || "bottom"); this.conf.zi = window.dhx4.newId(); this.conf.context = (this.conf.context == null ? true : window.dhx4.s2b(this.conf.context)); this.conf.IE6_display_fix = (this.conf.IE6_display_fix == null ? false : window.dhx4.s2b(this.conf.IE6_display_fix)); this.conf.last_p_click = this.conf.last_body_click = null; this.p = document.createElement("DIV"); this.p.style.display = "none"; this.p.innerHTML = "
"; document.body.appendChild(this.p); this.p.oncontextmenu = function(a) { if (g.conf.context == false) { a = a || event; a.returnValue = false; return false } }; this.skinParams = { dhx_terrace: { t0: 19, t1: 9, t2: 19, t3: 9 }, dhx_skyblue: { t0: 12, t1: 9, t2: 12, t3: 9 }, dhx_web: { t0: 12, t1: 9, t2: 12, t3: 9 }, material: { t0: 19, t1: 9, t2: 19, t3: 9 } }; this.p.ontouchstart = this.p.onclick = function(l) { l = l || event; var h = (g.conf.last_p_click != null && g.conf.last_p_click != l.type); g.conf.last_p_click = l.type; if (h == true) { return } g._clearClick = true; if (g._nodeObj != null) { g.callEvent("onContentClick", []); return true } var a = (l.target || l.srcElement); var m = null; while (a != g.p && a != null) { if (typeof(a._idd) != "undefined" && !a._isSeparator) { m = a._idd; a = null } else { a = a.parentNode } } a = null; if (m != null) { g.callEvent("onClick", [m]); if (g != null && g.isVisible != null && g.isVisible() && g.callEvent("onBeforeHide", ["select", l, m]) === true) { l.cancelBubble = true; g.hide() } } }; this.separator = "DHXSEP_" + window.dhx4.newId(); this.tpl = []; this._setTemplate = function(a) { this.tpl = a.split(",") }; this.show = function(h) { var a = null; if (arguments.length == 1) { if (!h) { h = this.conf.id[0] } else { if (!this._idExists(h)) { return } } if (this.conf.toolbar) { a = this.conf.toolbar._getItemDim(h) } if (this.conf.ribbon) { a = this.conf.ribbon._getItemDim(h) } if (this.conf.form) { a = this.conf.form._getItemDim(h) } } else { if (arguments.length == 4) { this._clearClick = true; a = { left: arguments[0], top: arguments[1], width: arguments[2], height: arguments[3] }; h = null } } if (!a) { return } this.p.style.visibility = "hidden"; this.p.style.display = ""; this._setPos(a); this.p.style.zIndex = window.dhx4.zim.reserve(this.conf.zi); this.p.style.visibility = "visible"; this._lastId = h; this.callEvent("onShow", [h]) }; this._setPos = function(I, 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); if (this.conf.IE6_display_fix == true) { E.style.visibility = "hidden" } window.setTimeout(function() { E.style.visibility = "visible"; E = null }, 1) } }; this._getAvailPos = function(r, o) { var l = { top: ["bottom", "right", "left"], bottom: ["top", "right", "left"], left: ["right", "bottom", "top"], right: ["left", "bottom", "top"] }; var m = null; for (var n = 0; n < l[r].length; n++) { if (m == null && o[l[r][n]] > 0) { m = l[r][n] } } if (m == null) { m = "bottom"; for (var h in o) { if (o[h] > o[m]) { m = h } } } if (m == r) { return false } return m }; this._repaint = function() { if (this.isVisible()) { this._setPos(this._posData) } }; this.clear = function() { if (this._nodeObj) { if (window.dhx4.isIE && typeof(window.dhtmlXLayoutObject) == "function" && this._nodeObj instanceof window.dhtmlXLayoutObject) { this.p.onmousedown = null } if (this._nodeObj.unload) { this._nodeObj.unload() } else { if (this._nodeObj.destruct) { this._nodeObj.destruct() } } this._nodeObj = this._nodeId = null; if (this._nodeObjEv != null) { for (var h = 0; h < this._nodeObjEv.length; h++) { this.detachEvent(this._nodeObjEv[h]) } this._nodeObjEv = null } } if (this._IEHoverInited) { this._IEHoverClear() } var a = this.p.firstChild.firstChild.firstChild; while (a.childNodes.length > 0) { a.removeChild(a.lastChild) } a = null; this.itemData = {} }; this.hide = function() { if (this.p.style.display != "none") { this.p.style.display = "none"; window.dhx4.zim.clear(this.conf.zi); var a = this._lastId; this._lastId = null; this.callEvent("onHide", [a]); this.conf.last_p_click = this.conf.last_body_click = null } }; this.isVisible = function() { return (this.p.style.display == "") }; this.itemData = {}; this.getItemData = function(a) { if (!a) { return this.itemData } if (this.itemData[a]) { return this.itemData[a] } return {} }; this.setSkin = function(a) { this.conf.skin = a; this.p.className = "dhx_popup_" + this.conf.skin; if (this._nodeObj != null && typeof(this._nodeObj.setSkin) == "function") { this._nodeObj.setSkin(this.conf.skin) } this._repaint() }; this.attachList = function(l, s) { this._setTemplate(l); this.clear(); var m = this.p.firstChild.firstChild.firstChild; for (var o = 0; o < s.length; o++) { var n = document.createElement("TR"); if (s[o] != this.separator) { if (typeof(s[o].id) == "undefined" || s[o].id == null) { n._idd = window.dhx4.newId(); while (this.itemData[n._idd] != null) { n._idd = window.dhx4.newId() } } else { n._idd = s[o].id } this.itemData[n._idd] = s[o] } m.appendChild(n); if (s[o] == this.separator) { n.className = "dhx_popup_sep"; n._isSeparator = true; var u = document.createElement("TD"); u.className = "dhx_popup_sep"; u.colSpan = this.tpl.length; u.innerHTML = "
 
"; n.appendChild(u); u = null } else { for (var a = 0; a < this.tpl.length; a++) { var h = "dhx_popup_td"; if (this._IEFirstLast && (this.tpl.length == 1 || a == 0 || a == this.tpl.length - 1)) { if (this.tpl.length == 1) { h += " dhx_popup_td_single" } else { h += (a == 0 ? " dhx_popup_td_first" : " dhx_popup_td_last") } } var u = document.createElement("TD"); u.className = h; u.innerHTML = s[o][this.tpl[a]] || " "; n.appendChild(u); u = null } if (this._IEHover) { n._IEHover = true; if (!this._IEHoverInited) { this._IEHoverInit() } } } n = null } m = null; this._repaint() }; this._attachNode = function(m, l) { this.clear(); this._nodeId = "dhxpopup_node_" + window.dhx4.newId(); var a = this.p.firstChild.firstChild.firstChild; var h = document.createElement("TR"); h.className = "dhxnode"; a.appendChild(h); var n = document.createElement("TD"); n.className = "dhx_popup_td"; n.innerHTML = "
"; if (l.width) { n.firstChild.style.width = l.width + "px" } if (l.height) { n.firstChild.style.height = l.height + "px" } h.appendChild(n); n = h = a = null; if (typeof(this["_attach_init_" + m]) == "function") { this["_attach_init_" + m](l); this._enableIEVFix() } this._repaint(); return this._nodeObj }; this.unload = function() { if (typeof(window.addEventListener) == "function") { window.removeEventListener("touchstart", this._doOnClick, false); window.removeEventListener("click", this._doOnClick, false); window.removeEventListener("keyup", this._doOnKeyUp, false); window.removeEventListener("unload", this._doOnUnload, false) } else { document.body.detachEvent("onclick", this._doOnClick, false); document.body.detachEvent("onkeyup", this._doOnKeyUp, false); document.body.detachEvent("onunload", this._doOnUnload, false) } window.dhx4.detachEvent(this.conf.ev_grid_click); this.clear(); if (this.conf.toolbarEvent != null && this.conf.toolbar != null) { if (this.conf.toolbar.detachEvent != null) { this.conf.toolbar.detachEvent(this.conf.toolbarEvent) } else { this.conf.toolbar._getItemDim = null } } if (this.conf.ribbonEvent != null && this.conf.ribbon != null) { if (this.conf.ribbon.detachEvent != null) { this.conf.ribbon.detachEvent(this.conf.ribbonEvent) } else { this.conf.ribbon._getItemDim = null } } if (this.conf.slider != null) { for (var l = 0; l < this.conf.slider_events.length; l++) { this.conf.slider.detachEvent(this.conf.slider_events[l]) } this.conf.slider_events = null; this._sliderShow = this._sliderHide = null; this.conf.slider = null } window.dhx4._eventable(this, "clear"); this.p.onclick = this.p.ontouchstart = this.p.oncontextmenu = null; this.p.parentNode.removeChild(this.p); this.p = null; for (var h in this.conf) { this.conf[h] = null } for (var h in this) { this[h] = null } g = null }; window.dhx4._eventable(this); this._doOnClick = function(q) { q = q || event; var a = (g.conf.last_body_click != null && g.conf.last_body_click != q.type); g.conf.last_body_click = q.type; if (a == true) { return } if (g._clearClick == true) { g._clearClick = false; return } if (g.conf.form != null) { var l; var s = (q.target || q.srcElement); if ((s.tagName || "").toLowerCase() == "option") { s = s.parentNode } if (s.className != null && s.className.search("dhxform") >= 0) { if (s.parentNode != null && s.parentNode.parentNode != null && s.parentNode.parentNode._idd != null) { l = s.parentNode.parentNode._idd; if (s.parentNode.parentNode._type == "ra") { l = [s.parentNode.parentNode._group, s.parentNode.parentNode._value] } } } else { var n = true; var o = false; while (n && !o) { var m = (s.className || "").toLowerCase(); if (m.length > 0) { o = (m == "dhxform_btn" || m.search(/dhxeditor_inside/gi) >= 0 || m == "dhxcombo_input" || m.search(/dhxcombolist/gi) >= 0) } s = s.parentNode; n = (s != null) } if (o) { return } } s = null; if (l != null && g._idExists(l)) { return } } if (typeof(window.dhtmlXForm) == "function" && g._nodeObj instanceof window.dhtmlXForm) { var u = {}; var m = 0; var h = g._nodeObj; h.forEachItem(function(r) { if (h.getItemType(r) == "combo") { u[h.getCombo(r).list._listId] = true; m++ } }); h = null; if (m > 0) { var s = (q.target || q.srcElement); var n = true; var o = false; while (n == true && o != true) { var m = (s.className || "").toLowerCase(); if (m.length > 0 && m.search(/^dhxcombolist/gi) >= 0 && s._listId != null && u[s._listId] == true) { o = true; s = null } else { s = s.parentNode; n = (s != null) } } if (o == true) { return } } } if (g.isVisible() && g.callEvent("onBeforeHide", ["click", q]) === true) { g.hide() } }; this._doOnKeyUp = function(a) { a = a || event; if (a.keyCode == 27) { if (g.isVisible() && g.callEvent("onBeforeHide", ["esc", a]) === true) { g.hide() } } }; this._doOnUnload = function() { g.unload() }; if (typeof(window.addEventListener) == "function") { window.addEventListener("touchstart", this._doOnClick, false); window.addEventListener("click", this._doOnClick, false); window.addEventListener("keyup", this._doOnKeyUp, false); window.addEventListener("unload", this._doOnUnload, false) } else { document.body.attachEvent("onclick", this._doOnClick, false); document.body.attachEvent("onkeyup", this._doOnKeyUp, false); document.body.attachEvent("onunload", this._doOnUnload, false) } this.conf.ev_grid_click = window.dhx4.attachEvent("_onGridClick", function(h, a) { if (g.p.contains(a.entBox)) {} else { g._clearClick = false; g._doOnClick(h) } a = null }); this._findGrid = function(h, a) { var l = false; if (typeof(window.dhtmlXTabBar) == "function" && h instanceof window.dhtmlXTabBar) { h.forEachTab(function(m) { var n = m.getAttachedObject(); if (l == false && n != null) { l = l || (n == a) || this._findGrid(n); n = null } }) } if (typeof(window.dhtmlXForm) == "function" && h instanceof window.dhtmlXForm) { h.forEachItem(function(m) { if (l != true && h.getItemType(m) == "container" && a.entBox == h.getContainer(m)) { l = true } }) } h = null; return l }; this._idExists = function(l) { var a = false; for (var h = 0; h < this.conf.id.length; h++) { if (this.conf.id[h] instanceof Array) { a = a || (this.conf.id[h][0] == l[0] && this.conf.id[h][1] == l[1]) } else { a = a || this.conf.id[h] == l } } return a }; this._IEDisp = (window.dhx4.isIE6 || document.compatMode != "CSS1Compat"); this._IEHover = (window.dhx4.isIE6 == true); if (this._IEHover) { this._IEHoverInit = function() { this.p.onmouseover = function() { var a = event.srcElement; while (a != this && a._IEHover != true) { a = a.parentNode } if (a._IEHover) { if (g._IEHoverTM) { window.clearTimeout(g._IEHoverTM) } if (g._lastIEHover == a) { return } g._IEHoverRender(a); a = null } }; this.p.onmouseout = function() { if (g._IEHoverTM) { window.clearTimeout(g._IEHoverTM) } g._IEHoverTM = window.setTimeout(function() { g._IEHoverRender(null) }, 1) }; this._IEHoverRender = function(a) { if (this._lastIEHover != null) { if (this._lastIEHover.className.search(/tr_hover/gi) >= 0) { this._lastIEHover.className = this._lastIEHover.className.replace(/\s{0,}tr_hover/gi, ""); this._lastIEHover = null } } if (a != null && a.className.search(/tr_hover/gi) < 0) { a.className += " tr_hover"; g._lastIEHover = a } }; this._IEHoverInited = true }; this._IEHoverClear = function() { this.p.onmouseover = null; this.p.onmouseout = null; this._IEHoverInited = false } } this._IEFirstLast = (window.dhx4.isIE6 || window.dhx4.isIE7 || window.dhx4.isIE8); this._enableIEVFix = function() { if (window.dhx4.isIE6 || window.dhx4.isIE7) { var h = this.attachEvent("onHide", function() { document.getElementById(this._nodeId).style.visibility = "hidden" }); var a = this.attachEvent("onShow", function() { document.getElementById(this._nodeId).style.visibility = "visible" }); if (this._nodeObjEv == null) { this._nodeObjEv = [] } this._nodeObjEv.push(h, a) } }; if (typeof(window.dhtmlXToolbarObject) == "function" && this.conf.toolbar != null && this.conf.toolbar instanceof window.dhtmlXToolbarObject && this.conf.id != null) { if (!(this.conf.id instanceof Array)) { this.conf.id = [this.conf.id] } this.skinParent = this.conf.toolbar.conf.skin; this._doOnToolbarClick = function(h) { for (var a = 0; a < g.conf.id.length; a++) { if (h == g.conf.id[a]) { if (h != g._lastId) { g.show(h); g._clearClick = true } } } }; if (typeof(dhtmlXToolbarObject.prototype._getItemDim) == "undefined") { dhtmlXToolbarObject.prototype._getItemDim = function(l) { var a = this.objPull[this.idPrefix + l]; var h = { left: window.dhx4.absLeft(a.obj), top: window.dhx4.absTop(a.obj), width: a.obj.offsetWidth + (a.arw ? a.arw.offsetWidth : 0), height: a.obj.offsetHeight }; a = null; return h } } this.conf.toolbarEvent = this.conf.toolbar.attachEvent("onClick", this._doOnToolbarClick) } if (typeof(window.dhtmlXRibbon) == "function" && this.conf.ribbon != null && this.conf.ribbon instanceof window.dhtmlXRibbon && this.conf.id != null) { if (!(this.conf.id instanceof Array)) { this.conf.id = [this.conf.id] } this.skinParent = this.conf.ribbon.conf.skin; this._doOnRibbonClick = function(h) { for (var a = 0; a < g.conf.id.length; a++) { if (h == g.conf.id[a]) { if (h != g._lastId) { g.show(h); g._clearClick = true } } } }; if (typeof(dhtmlXRibbon.prototype._getItemDim) == "undefined") { dhtmlXRibbon.prototype._getItemDim = function(l) { var a = this._items[l].base; var h = { left: window.dhx4.absLeft(a), top: window.dhx4.absTop(a), width: a.offsetWidth, height: a.offsetHeight }; a = null; return h } } this.conf.ribbonEvent = this.conf.ribbon.attachEvent("_showPopup", this._doOnRibbonClick) } if (typeof(window.dhtmlXForm) == "function" && this.conf.form != null && this.conf.form instanceof window.dhtmlXForm && this.conf.id != null) { if (!(this.conf.id instanceof Array)) { this.conf.id = [this.conf.id] } if (!this.conf.mode) { this.mode = "right" } this.skinParent = this.conf.form.skin; if (typeof(dhtmlXForm.prototype._getItemDim) == "undefined") { dhtmlXForm.prototype._getItemDim = function(a, h) { return this.doWithItem(a, "_getDim") }; for (var c in dhtmlXForm.prototype.items) { dhtmlXForm.prototype.items[c]._getDim = function(h) { var a = h; if ({ ta: true, pw: true, se: true, tp: true, fl: true, calendar: true, colorpicker: 1, editor: true, container: true }[h._type]) { a = h.childNodes[h._ll ? 1 : 0].childNodes[0] } if ({ ch: true, ra: true, btn2state: true }[h._type]) { a = h.childNodes[h._ll ? 1 : 0].childNodes[1] } if ({ bt: true, lb: true, fs: true }[h._type]) { a = h.firstChild } if ({ combo: true }[h._type]) { a = h._combo.DOMParent.firstChild } if ({ image: true }[h._type]) { a = h.childNodes[h._ll ? 1 : 0].lastChild } if ({ bl: true }[h._type]) { a = h.firstChild.firstChild.firstChild } var l = { left: window.dhx4.absLeft(a), top: window.dhx4.absTop(a), width: a.offsetWidth, height: a.offsetHeight }; a = null; return l } } } } if (typeof(window.dhtmlXSlider) == "function" && this.conf.slider != null && this.conf.slider instanceof window.dhtmlXSlider) { if (!this.conf.mode) { this.mode = "top" } this.conf.slider_tm = null; this._sliderShow = function() { if (g.conf.slider_tm) { window.clearTimeout(g.conf.slider_tm) } var a = g.conf.slider._r_actv; if (a != null) { var h = { left: window.dhx4.absLeft(a), top: window.dhx4.absTop(a), width: a.offsetWidth, height: a.offsetHeight }; g.show(h.left, h.top, h.width, h.height); a = null } }; this._sliderHide = function() { g.conf.slider_tm = window.setTimeout(function() { g.hide() }, 200) }; this.conf.slider_events = [this.conf.slider.attachEvent("onMouseDown", this._sliderShow), this.conf.slider.attachEvent("onMouseUp", this._sliderHide), this.conf.slider.attachEvent("onChange", this._sliderShow)] } this.setSkin(this.skinParent || this.conf.skin || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhx_popup") || "material"); return this } dhtmlXPopup.prototype.attachObject = function(a) { return this._attachNode("object", { obj: a }) }; dhtmlXPopup.prototype._attach_init_object = function(a) { this._nodeObj = (typeof(a.obj) == "string" ? document.getElementById(a.obj) : a.obj); a.obj = null; document.getElementById(this._nodeId).appendChild(this._nodeObj); this._nodeObj.style.display = ""; this._nodeObj.style.visibility = "visible" }; dhtmlXPopup.prototype.attachHTML = function(a) { return this._attachNode("html", { html: a }) }; dhtmlXPopup.prototype._attach_init_html = function(a) { document.getElementById(this._nodeId).innerHTML = a.html; this._nodeObj = { text: a.html } }; dhtmlXPopup.prototype.attachForm = function(c, a) { return this._attachNode("form", { struct: c, width: a }) }; dhtmlXPopup.prototype._attach_init_form = function(c) { var a = this; this._nodeObj = new dhtmlXForm(this._nodeId, c.struct); this._nodeObj.setSkin(this.conf.skin); this._nodeObj.attachEvent("_onBeforeEditorAccess", function() { a._clearClick = true }); if (this.conf.editorEv != null && this.checkEvent(this.conf.editorEv) == false) { this.conf.editorEv = null } if (dhtmlXForm.prototype.items.editor != null && this.conf.editorEv == null) { this.conf.editorEv = this.attachEvent("onShow", function() { var h = dhtmlXForm.prototype.items.editor.editor; for (var e in h) { var l = h[e].base; var g = false; while (l != null) { if (l == this.p) { g = true; l = null } else { l = l.parentNode } } l = null; if (g == true) { h[e].cell.conf.cells_cont = null; h[e].setSizes() } } h = null; this.detachEvent(this.conf.editorEv); this.conf.editorEv = null }); if (this._nodeObjEv == null) { this._nodeObjEv = [] } this._nodeObjEv.push(this.conf.editorEv) } }; dhtmlXPopup.prototype.attachCalendar = function(a) { return this._attachNode("calendar", a || {}) }; dhtmlXPopup.prototype._attach_init_calendar = function(a) { if (a["double"] == true) { this._nodeObj = new dhtmlXDoubleCalendarObject(this._nodeId); this._nodeObj.leftCalendar.setSkin(this.conf.skin); this._nodeObj.rightCalendar.setSkin(this.conf.skin) } else { this._nodeObj = new dhtmlXCalendarObject(this._nodeId); this._nodeObj.setSkin(this.conf.skin) } this._nodeObj.show() }; dhtmlXPopup.prototype.attachGrid = function(c, a) { return this._attachNode("grid", { width: c || 400, height: a || 200 }) }; dhtmlXPopup.prototype._attach_init_grid = function() { this._nodeObj = new dhtmlXGridObject(this._nodeId); this._nodeObj.setSkin(this.conf.skin) }; dhtmlXPopup.prototype.attachTree = function(e, c, a) { return this._attachNode("tree", { width: e || 400, height: c || 200, rootId: a || 0 }) }; dhtmlXPopup.prototype._attach_init_tree = function(a) { this._nodeObj = new dhtmlXTreeObject(this._nodeId, "100%", "100%", (a.rootId)) }; dhtmlXPopup.prototype.attachLayout = function(c, a, e) { return this._attachNode("layout", { width: c || 400, height: a || 200, pattern: e || "3L" }) }; dhtmlXPopup.prototype._attach_init_layout = function(a) { this._nodeObj = new dhtmlXLayoutObject(this._nodeId, a.pattern, this.conf.skin) }; dhtmlXPopup.prototype.attachAccordion = function(e, a, c) { return this._attachNode("accordion", { width: e || 400, height: a || 200, conf: c || {} }) }; dhtmlXPopup.prototype._attach_init_accordion = function(a) { a.conf.parent = this._nodeId; a.conf.skin = this.conf.skin; this._nodeObj = new dhtmlXAccordion(a.conf) }; dhtmlXPopup.prototype.attachTabbar = function(e, a, c) { if (typeof(c) == "string") { c = { mode: c } } else { if (typeof(c) != "object" || c == null) { c = {} } } return this._attachNode("tabbar", { width: e || 400, height: a || 200, conf: c }) }; dhtmlXPopup.prototype._attach_init_tabbar = function(a) { a.conf.parent = this._nodeId; a.conf.skin = this.conf.skin; this._nodeObj = new dhtmlXTabBar(a.conf) }; dhtmlXPopup.prototype.attachSidebar = function(e, a, c) { if (c == null) { c = {} } return this._attachNode("sidebar", { width: e || 400, height: a || 200, conf: c }) }; dhtmlXPopup.prototype._attach_init_sidebar = function(a) { a.conf.parent = this._nodeId; a.conf.skin = this.conf.skin; this._nodeObj = new dhtmlXSideBar(a.conf) }; dhtmlXPopup.prototype.attachEditor = function(e, a, c) { return this._attachNode("editor", { width: e || 400, height: a || 200, conf: c || {} }) }; dhtmlXPopup.prototype._attach_init_editor = function(c) { document.getElementById(this._nodeId).className = "dhxeditor_" + this.conf.skin; c.conf.parent = this._nodeId; if (c.conf.skin == null) { c.conf.skin = this.conf.skin } this._nodeObj = new dhtmlXEditor(c.conf); var a = this.attachEvent("onShow", function() { if (this._nodeObj instanceof window.dhtmlXEditor) { this._nodeObj.setSizes() } }); if (this._nodeObjEv == null) { this._nodeObjEv = [] } this._nodeObjEv.push(a) }; dhtmlXPopup.prototype.attachColorPicker = function(a) { if (typeof(a) != "object" || a == null) { a = {} } return this._attachNode("colorpicker", { conf: a }) }; dhtmlXPopup.prototype._attach_init_colorpicker = function(a) { a.conf.skin = this.conf.skin; a.conf.parent = this._nodeId; this._nodeObj = new dhtmlXColorPicker(a.conf) }; dhtmlXPopup.prototype.attachCarousel = function(e, a, c) { if (c == null) { c = {} } return this._attachNode("carousel", { width: e || 400, height: a || 300, conf: c }) }; dhtmlXPopup.prototype._attach_init_carousel = function(a) { a.conf.parent = this._nodeId; a.conf.skin = this.conf.skin; this._nodeObj = new dhtmlXCarousel(a.conf) }; dhtmlXPopup.prototype.attachTreeView = function(e, a, c) { if (c == null) { c = {} } return this._attachNode("treeview", { width: e || 400, height: a || 300, conf: c }) }; dhtmlXPopup.prototype._attach_init_treeview = function(a) { a.conf.parent = this._nodeId; a.conf.skin = this.conf.skin; this._nodeObj = new dhtmlXTreeView(a.conf); this._nodeObj.base.className += " dhxtreeview_with_border"; var c = this.attachEvent("onShow", function() { if (this._nodeObj instanceof window.dhtmlXTreeView) { this._nodeObj.setSizes() } }); if (this._nodeObjEv == null) { this._nodeObjEv = [] } this._nodeObjEv.push(c) }; dhtmlXPopup.prototype.setDimension = function(a, c) { if (this._nodeId == null || (a == null && c == null)) { return } var e = document.getElementById(this._nodeId); if (a != null) { e.style.width = a + "px" } if (c != null) { e.style.height = c + "px" } this._repaint(); if (this._nodeObj != null && typeof(this._nodeObj.setSizes) == "function") { this._nodeObj.setSizes() } e = null }; function dhtmlXMenuObject(h, l) { var g = this; this.conf = { skin: (l || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxmenu") || "material"), mode: "web", align: "left", is_touched: false, selected: -1, last_click: -1, fixed_pos: false, rtl: false, icons_path: "", icons_css: false, arrow_ff_fix: (navigator.userAgent.indexOf("MSIE") >= 0 && document.compatMode == "BackCompat"), live_id: window.dhx4.newId(), tags: { root: "menu", item: "item", text_ext: "itemtext", userdata: "userdata", tooltip: "tooltip", hotkey: "hotkey", href: "href" }, autoload: {}, hide_tm: {}, top_mode: true, top_tmtime: 200, v_enabled: false, v: { x1: null, x2: null, y1: null, y2: null }, dir_toplv: "bottom", dir_sublv: "right", auto_overflow: false, overflow_limit: 0, of_utm: null, of_utime: 20, of_ustep: 3, of_dtm: null, of_dtime: 20, of_dstep: 3, of_ah: { dhx_skyblue: 24, dhx_web: 25, dhx_terrace: 27, material: 25 }, of_ih: { dhx_skyblue: 24, dhx_web: 24, dhx_terrace: 24, material: 30 }, tm_sec: 400, tm_handler: null, dload: false, dload_url: "", dload_icon: false, dload_params: { action: "loadMenu" }, dload_pid: "parentId", tl_botmarg: 1, tl_rmarg: 0, tl_ofsleft: 1, context: false, ctx_zoneid: false, ctx_autoshow: true, ctx_autohide: true, ctx_hideall: true, ctx_zones: {}, ctx_baseid: null, selected_sub: [], opened_poly: [] }; if (typeof(h) == "object" && h != null && typeof(h.tagName) == "undefined") { if (h.icons_path != null || h.icon_path != null) { this.conf.icons_path = (h.icons_path || h.icon_path) } if (h.skin != null) { this.conf.skin = h.skin } if (h.visible_area) { this.conf.v_enabled = true; this.conf.v = { x1: h.visible_area.x1, x2: h.visible_area.x2, y1: h.visible_area.y1, y2: h.visible_area.y2 } } for (var e in { json: 1, xml: 1, items: 1, top_text: 1, align: 1, open_mode: 1, overflow: 1, dynamic: 1, dynamic_icon: 1, context: 1, onload: 1, onclick: 1, oncheckboxclick: 1, onradioclick: 1, iconset: 1 }) { if (h[e] != null) { this.conf.autoload[e] = h[e] } } h = h.parent } if (h == null) { this.base = document.body } else { var c = (typeof(h) == "string" ? document.getElementById(h) : h); if (c != null) { this.base = c; if (!this.base.id) { this.base.id = "menuBaseId_" + new Date().getTime() } this.base.className += " dhtmlxMenu_" + this.conf.skin + "_Middle dir_left"; this.base._autoSkinUpdate = true; if (this.base.oncontextmenu) { this.base._oldContextMenuHandler = this.base.oncontextmenu } this.conf.ctx_baseid = this.base; 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(n) { var o = this.conf.skin; this.conf.skin = n; 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": case "material": 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_" + o + "_Middle", "") + " dhtmlxMenu_" + this.conf.skin + "_Middle" } for (var m in this.idPull) { this.idPull[m].className = String(this.idPull[m].className).replace(o, this.conf.skin) } }; this.setSkin(this.conf.skin); this._addSubItemToSelected = function(n, m) { var a = true; for (var o = 0; o < this.conf.selected_sub.length; o++) { if ((this.conf.selected_sub[o][0] == n) && (this.conf.selected_sub[o][1] == m)) { a = false } } if (a == true) { this.conf.selected_sub.push(new Array(n, m)) } 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(H, n) { var M = this._countVisiblePolygonItems(H); if (M == 0) { return } var I = "polygon_" + H; if ((this.idPull[I] != null) && (this.idPull[H] != null)) { if (this.conf.top_mode && this.conf.mode == "web" && !this.conf.context) { if (!this.idPull[H]._mouseOver && n == this.conf.dir_toplv) { return } } if (!this.conf.fixed_pos) { this._autoDetectVisibleArea() } var J = 0; var L = 0; var O = null; var D = null; if (this.idPull[I]._zId == null) { this.idPull[I]._zId = window.dhx4.newId() } this.idPull[I]._zInd = window.dhx4.zim.reserve(this.idPull[I]._zId); this.idPull[I].style.visibility = "hidden"; this.idPull[I].style.left = "0px"; this.idPull[I].style.top = "0px"; this.idPull[I].style.display = ""; this.idPull[I].style.zIndex = this.idPull[I]._zInd; if (this.conf.auto_overflow) { if (this.idPull[I].childNodes[1].childNodes[0].offsetHeight > this.conf.v.y2 - this.conf.v.y1) { var C = Math.max(Math.floor((this.conf.v.y2 - this.conf.v.y1 - this.conf.of_ah[this.conf.skin] * 2) / this.conf.of_ih[this.conf.skin]), 1); this.conf.overflow_limit = C } else { this.conf.overflow_limit = 0; if (this.idPull["arrowup_" + H] != null) { this._removeUpArrow(String(H).replace(this.idPrefix, "")) } if (this.idPull["arrowdown_" + H] != null) { this._removeDownArrow(String(H).replace(this.idPrefix, "")) } } } if (this.conf.overflow_limit > 0 && this.conf.overflow_limit < M) { if (this.idPull["arrowup_" + H] == null) { this._addUpArrow(String(H).replace(this.idPrefix, "")) } if (this.idPull["arrowdown_" + H] == null) { this._addDownArrow(String(H).replace(this.idPrefix, "")) } O = this.idPull["arrowup_" + H]; O.style.display = "none"; D = this.idPull["arrowdown_" + H]; D.style.display = "none" } if (this.conf.overflow_limit > 0 && this.conf.overflow_limit < M) { this.idPull[I].childNodes[1].style.height = this.conf.of_ih[this.conf.skin] * this.conf.overflow_limit + "px"; O.style.width = D.style.width = this.idPull[I].childNodes[1].style.width = this.idPull[I].childNodes[1].childNodes[0].offsetWidth + "px"; this.idPull[I].childNodes[1].scrollTop = 0; O.style.display = ""; J = O.offsetHeight; D.style.display = ""; L = D.offsetHeight } else { this.idPull[I].childNodes[1].style.height = ""; this.idPull[I].childNodes[1].style.width = "" } if (this.itemPull[H] != null) { var v = "polygon_" + this.itemPull[H]["parent"] } else { if (this.conf.context) { var v = this.idPull[this.idPrefix + this.topId] } } var a = (this.idPull[H].tagName != null ? window.dhx4.absLeft(this.idPull[H]) : this.idPull[H][0]); var N = (this.idPull[H].tagName != null ? window.dhx4.absTop(this.idPull[H]) : this.idPull[H][1]); var m = (this.idPull[H].tagName != null ? this.idPull[H].offsetWidth : 0); var o = (this.idPull[H].tagName != null ? this.idPull[H].offsetHeight : 0); var u = 0; var s = 0; var A = this.idPull[I].offsetWidth; var K = this.idPull[I].offsetHeight; if (n == "bottom") { if (this.conf.rtl) { u = a + (m != null ? m : 0) - A } else { if (this.conf.align == "right") { u = a + m - A } else { u = a - 1 + (n == this.conf.dir_toplv ? this.conf.tl_rmarg : 0) } } s = N - 1 + o + this.conf.tl_botmarg } if (n == "right") { u = a + m - 1; s = N + 2 } if (n == "left") { u = a - this.idPull[I].offsetWidth + 2; s = N + 2 } if (n == "top") { u = a - 1; s = N - K + 2 } if (this.conf.fixed_pos) { var F = 65536; var E = 65536 } else { var F = (this.conf.v.x2 != null ? this.conf.v.x2 : 0); var E = (this.conf.v.y2 != null ? this.conf.v.y2 : 0); if (F == 0) { if (window.innerWidth) { F = window.innerWidth; E = window.innerHeight } else { F = document.body.offsetWidth; E = document.body.scrollHeight } } } if (u + A > F && !this.conf.rtl) { u = a - A + 2 } if (u < this.conf.v.x1 && this.conf.rtl) { u = a + m - 2 } if (u < 0) { u = 0 } if (s + K > E && this.conf.v.y2 != null) { s = Math.max(N + o - K + 2, (this.conf.v_enabled ? this.conf.v.y1 + 2 : 2)); if (this.conf.context && this.idPrefix + this.topId == H && D != null) { s = s - 2 } if (this.itemPull[H] != null && !this.conf.context) { if (this.itemPull[H]["parent"] == this.idPrefix + this.topId) { s = s - this.base.offsetHeight } } } this.idPull[I].style.left = u + "px"; this.idPull[I].style.top = s + "px"; if (typeof(this._menuEffect) != "undefined" && this._menuEffect !== false) { this._showPolygonEffect(I) } else { this.idPull[I].style.visibility = ""; if (this.conf.overflow_limit > 0 && this.conf.overflow_limit < M) { this.idPull[I].childNodes[1].scrollTop = 0; this._checkArrowsState(H) } if (window.dhx4.isIE6) { var r = I + "_ie6cover"; if (this.idPull[r] == null) { var q = document.createElement("IFRAME"); q.className = "dhtmlxMenu_IE6CoverFix_" + this.conf.skin; q.frameBorder = 0; q.setAttribute("src", "javascript:false;"); document.body.insertBefore(q, document.body.firstChild); this.idPull[r] = q } this.idPull[r].style.left = u + "px"; this.idPull[r].style.top = s + "px"; this.idPull[r].style.width = this.idPull[I].offsetWidth + "px"; this.idPull[r].style.height = this.idPull[I].offsetHeight + "px"; this.idPull[r].style.zIndex = this.idPull[I].style.zIndex - 1; this.idPull[r].style.display = "" } } H = String(H).replace(this.idPrefix, ""); if (H == this.topId) { H = null } this.callEvent("onShow", [H]); if (H != null && this.conf.skin == "dhx_terrace" && this.itemPull[this.idPrefix + H].parent == this.idPrefix + this.topId) { this._improveTerraceButton(this.idPrefix + H, false) } } }; this._redistribSubLevelSelection = function(r, o) { while (this.conf.opened_poly.length > 0) { this.conf.opened_poly.pop() } var a = this._getSubItemToDeselectByPolygon(o); this._removeSubItemFromSelected(-1, -1); for (var m = 0; m < a.length; m++) { if ((this.idPull[a[m]] != null) && (a[m] != r)) { if (this.itemPull[a[m]]["state"] == "enabled") { this.idPull[a[m]].className = "sub_item" } } } for (var m = 0; m < this.conf.opened_poly.length; m++) { if (this.conf.opened_poly[m] != o) { this._hidePolygon(this.conf.opened_poly[m]) } } if (this.itemPull[r]["state"] == "enabled") { this.idPull[r].className = "sub_item_selected"; if (this.itemPull[r]["complex"] && this.conf.dload && (this.itemPull[r]["loaded"] == "no")) { if (this.conf.dload_icon == true) { this._updateLoaderIcon(r, true) } this.itemPull[r].loaded = "get"; var n = r.replace(this.idPrefix, ""); this._dhxdataload.onBeforeXLS = function() { var s = { params: {} }; s.params[this.conf.dload_pid] = n; for (var q in this.conf.dload_params) { s.params[q] = this.conf.dload_params[q] } return s }; this.loadStruct(this.conf.dload_url) } if (this.itemPull[r]["complex"] || (this.conf.dload && (this.itemPull[r]["loaded"] == "yes"))) { if ((this.itemPull[r]["complex"]) && (this.idPull["polygon_" + r] != null)) { this._updateItemComplexState(r, true, true); this._showPolygon(r, this.conf.dir_sublv) } } this._addSubItemToSelected(r, o); this.conf.selected = r } }; 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 m = "dhxId_"; var o = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for (var n = 0; n < a; n++) { m += o.charAt(Math.round(Math.random() * (o.length - 1))) } return m }; this.getItemType = function(a) { a = this.idPrefix + a; if (this.itemPull[a] == null) { return null } return this.itemPull[a]["type"] }; this.forEachItem = function(n) { for (var m in this.itemPull) { n(String(m).replace(this.idPrefix, "")) } }; this._clearAndHide = function() { g.conf.selected = -1; g.conf.last_click = -1; while (g.conf.opened_poly.length > 0) { g.conf.opened_poly.pop() } for (var a = 0; a < g.conf.selected_sub.length; a++) { var m = g.conf.selected_sub[a][0]; if (g.idPull[m] != null) { if (g.itemPull[m]["state"] == "enabled") { if (g.idPull[m].className == "sub_item_selected") { g.idPull[m].className = "sub_item" } if (g.idPull[m].className == "dhtmlxMenu_" + g.conf.skin + "_TopLevel_Item_Selected") { if (g.itemPull[m]["cssNormal"] != null) { g.idPull[m].className = g.itemPull[m]["cssNormal"] } else { g.idPull[m].className = "dhtmlxMenu_" + g.conf.skin + "_TopLevel_Item_Normal" } } } } g._hidePolygon(m) } g.conf.is_touched = false; if (g.conf.context && g.conf.ctx_hideall) { g._hidePolygon(g.idPrefix + g.topId) } }; this._showSubLevelItem = function(m, a) { if (document.getElementById("arrow_" + this.idPrefix + m) != null) { document.getElementById("arrow_" + this.idPrefix + m).style.display = (a ? "none" : "") } if (document.getElementById("image_" + this.idPrefix + m) != null) { document.getElementById("image_" + this.idPrefix + m).style.display = (a ? "none" : "") } if (document.getElementById(this.idPrefix + m) != null) { document.getElementById(this.idPrefix + m).style.display = (a ? "" : "none") } }; this._hideSubLevelItem = function(a) { this._showSubLevelItem(a, true) }; this.idPrefix = this._genStr(12) + "_"; this._bodyClick = function(a) { a = a || event; if (a.button == 2 || (window.dhx4.isOpera && a.ctrlKey == true)) { return } if (g.conf.context) { if (g.conf.ctx_autohide && (!window.dhx4.isOpera || (g._isContextMenuVisible() && window.dhx4.isOpera))) { g._hideContextMenu() } } else { if (g._clearAndHide) { g._clearAndHide() } } }; this._bodyContext = function(n) { n = n || event; var m = String((n.srcElement || n.target).className); if (m.search("dhtmlxMenu") != -1 && m.search("SubLevelArea") != -1) { return } var a = true; var o = n.target || n.srcElement; while (o != null) { if (o.id != null) { if (g.isContextZone(o.id)) { a = false } } if (o == document.body) { a = false } o = o.parentNode } if (a) { g.hideContextMenu() } }; if (typeof(window.addEventListener) != "undefined") { window.addEventListener("click", this._bodyClick, false); window.addEventListener("contextmenu", this._bodyContext, false) } else { document.body.attachEvent("onclick", this._bodyClick); document.body.attachEvent("oncontextmenu", this._bodyContext) } this._gridClickHandler = dhx4.attachEvent("_onGridClick", this._bodyClick); 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 (n) {} 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) } dhx4.detachEvent(this._gridClickHandler); 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 m in this.conf.ctx_zones) { this.removeContextZone(m) } } if (this.cont != null) { this.cont.className = ""; this.cont.parentNode.removeChild(this.cont); this.cont = null } if (this.base != null) { if (!this.conf.context) { this.base.className = "" } if (!this.conf.context) { this.base.oncontextmenu = (this.base._oldContextMenuHandler || null) } this.base.onselectstart = null; this.base = null } for (var m in this) { this[m] = null } g = null }; dhtmlXMenuObject.prototype.liveInst[this.conf.live_id] = this; window.dhx4._enableDataLoading(this, "_initObj", "_xmlToJson", this.conf.tags.root, { struct: true }); window.dhx4._eventable(this); if (window.dhx4.s2b(this.conf.autoload.context) == true) { this.renderAsContextMenu() } if (this.conf.autoload.iconset == "awesome") { this.conf.icons_css = true } if (this.conf.autoload.dynamic != null) { this.enableDynamicLoading(this.conf.autoload.dynamic, window.dhx4.s2b(this.conf.autoload.dynamic_icon)) } else { if (this.conf.autoload.items != null) { this.loadStruct(this.conf.autoload.items, this.conf.autoload.onload) } else { if (this.conf.autoload.json != null) { this.loadStruct(this.conf.autoload.json, this.conf.autoload.onload) } else { if (this.conf.autoload.xml != null) { this.loadStruct(this.conf.autoload.xml, this.conf.autoload.onload) } } } } for (var e in { onclick: 1, oncheckboxclick: 1, onradioclick: 1 }) { if (this.conf.autoload[e] != null) { if (typeof(this.conf.autoload[e]) == "function") { this.attachEvent(e, this.conf.autoload[e]) } else { if (typeof(window[this.conf.autoload[e]]) == "function") { this.attachEvent(e, window[this.conf.autoload[e]]) } } } } if (this.conf.autoload.top_text != null) { this.setTopText(this.conf.autoload.top_text) } if (this.conf.autoload.align != null) { this.setAlign(this.conf.autoload.align) } if (this.conf.autoload.open_mode != null) { this.setOpenMode(this.conf.autoload.open_mode) } if (this.conf.autoload.overflow != null) { this.setOverflowHeight(this.conf.autoload.overflow) } for (var e in this.conf.autoload) { this.conf.autoload[e] = null; delete this.conf.autoload[e] } this.conf.autoload = null; return this } dhtmlXMenuObject.prototype._init = function() { if (this._isInited == true) { return } if (this.conf.dload) { this._dhxdataload.onBeforeXLS = function() { var e = { params: {} }; for (var c in this.conf.dload_params) { e.params[c] = this.conf.dload_params[c] } return e }; this.loadStruct(this.conf.dload_url) } else { this._initTopLevelMenu(); this._isInited = true } }; dhtmlXMenuObject.prototype._countVisiblePolygonItems = function(l) { var g = 0; for (var c in this.itemPull) { var e = this.itemPull[c]["parent"]; var h = this.itemPull[c]["type"]; if (this.idPull[c] != null) { if (e == l && (h == "item" || h == "radio" || h == "checkbox") && this.idPull[c].style.display != "none") { g++ } } } return g }; dhtmlXMenuObject.prototype._redefineComplexState = function(c) { if (this.idPrefix + this.topId == c) { return } if ((this.idPull["polygon_" + c] != null) && (this.idPull[c] != null)) { var a = this._countVisiblePolygonItems(c); if ((a > 0) && (!this.itemPull[c]["complex"])) { this._updateItemComplexState(c, true, false) } if ((a == 0) && (this.itemPull[c]["complex"])) { this._updateItemComplexState(c, false, false) } } }; dhtmlXMenuObject.prototype._updateItemComplexState = function(h, e, g) { if ((!this.conf.context) && (this._getItemLevelType(h.replace(this.idPrefix, "")) == "TopLevel")) { this.itemPull[h]["complex"] = e; return } if ((this.idPull[h] == null) || (this.itemPull[h] == null)) { return } this.itemPull[h]["complex"] = e; if (h == this.idPrefix + this.topId) { return } var a = null; var c = this.idPull[h].childNodes[this.conf.rtl ? 0 : 2]; if (c.childNodes[0]) { if (String(c.childNodes[0].className).search("complex_arrow") === 0) { a = c.childNodes[0] } } if (this.itemPull[h]["complex"]) { if (a == null) { a = document.createElement("DIV"); a.className = "complex_arrow"; a.id = "arrow_" + h; while (c.childNodes.length > 0) { c.removeChild(c.childNodes[0]) } c.appendChild(a) } if (this.conf.dload && (this.itemPull[h].loaded == "get") && this.conf.dload_icon) { if (a.className != "complex_arrow_loading") { a.className = "complex_arrow_loading" } } else { a.className = "complex_arrow" } return } if ((!this.itemPull[h]["complex"]) && (a != null)) { c.removeChild(a); if (this.itemPull[h]["hotkey_backup"] != null && this.setHotKey) { this.setHotKey(h.replace(this.idPrefix, ""), this.itemPull[h]["hotkey_backup"]) } } }; dhtmlXMenuObject.prototype._getItemLevelType = function(a) { return (this.itemPull[this.idPrefix + a]["parent"] == this.idPrefix + this.topId ? "TopLevel" : "SubLevelArea") }; dhtmlXMenuObject.prototype.setIconsPath = function(a) { this.conf.icons_path = a }; dhtmlXMenuObject.prototype._updateItemImage = function(g, h) { g = this.idPrefix + g; var o = this.itemPull[g]["type"]; if (o == "checkbox" || o == "radio") { return } 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++) { if (m == null && (this.idPull[g].childNodes[a].className || "") == "dhtmlxMenu_TopLevel_Item_Icon" || (this.idPull[g].childNodes[a].tagName || "").toLowerCase() == "i") { m = this.idPull[g].childNodes[a] } } } 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.tagName.toLowerCase() == "i"))) { m = null } } var s = this.itemPull[g][(this.itemPull[g]["state"] == "enabled" ? "imgen" : "imgdis")]; if (s.length > 0) { if (m != null) { if (this.conf.icons_css == true) { m.className = this.conf.icons_path + s } else { m.src = this.conf.icons_path + s } } else { if (l) { if (this.conf.icons_css == true) { var m = document.createElement("i"); m.className = this.conf.icons_path + s } else { var m = document.createElement("IMG"); m.className = "dhtmlxMenu_TopLevel_Item_Icon"; m.src = this.conf.icons_path + s; 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 { if (this.conf.icons_css == true) { var r = this.idPull[g].childNodes[this.conf.rtl ? 2 : 0]; r.innerHTML = "" } else { var m = document.createElement("IMG"); m.className = "sub_icon"; m.src = this.conf.icons_path + s; m.border = "0"; m.id = "image_" + g; var r = this.idPull[g].childNodes[this.conf.rtl ? 2 : 0]; while (r.childNodes.length > 0) { r.removeChild(r.childNodes[0]) } r.appendChild(m) } } } } else { if (m != null) { if (l) { m.parentNode.removeChild(m); m = null } else { var c = m.parentNode; c.removeChild(m); c.innerHTML = " "; c = m = null } } } }; dhtmlXMenuObject.prototype._getAllParents = function(l) { var e = new Array(); for (var c in this.itemPull) { if (this.itemPull[c]["parent"] == l) { e[e.length] = this.itemPull[c]["id"]; if (this.itemPull[c]["complex"]) { var g = this._getAllParents(this.itemPull[c]["id"]); for (var h = 0; h < g.length; h++) { e[e.length] = g[h] } } } } return e }; dhtmlXMenuObject.prototype._autoDetectVisibleArea = function() { if (this.conf.v_enabled) { return } var a = window.dhx4.screenDim(); this.conf.v.x1 = a.left; this.conf.v.x2 = a.right; this.conf.v.y1 = a.top; this.conf.v.y2 = a.bottom }; dhtmlXMenuObject.prototype.getItemPosition = function(h) { h = this.idPrefix + h; var g = -1; if (this.itemPull[h] == null) { return g } var a = this.itemPull[h]["parent"]; var e = (this.idPull["polygon_" + a] != null ? this.idPull["polygon_" + a].tbd : this.cont); for (var c = 0; c < e.childNodes.length; c++) { if (e.childNodes[c] == this.idPull["separator_" + h] || e.childNodes[c] == this.idPull[h]) { g = c } } return g }; dhtmlXMenuObject.prototype.setItemPosition = function(m, l) { m = this.idPrefix + m; if (this.idPull[m] == null) { return } var c = (this.itemPull[m]["parent"] == this.idPrefix + this.topId); var a = this.idPull[m]; var g = this.getItemPosition(m.replace(this.idPrefix, "")); var e = this.itemPull[m]["parent"]; var h = (this.idPull["polygon_" + e] != null ? this.idPull["polygon_" + e].tbd : this.cont); h.removeChild(h.childNodes[g]); if (l < 0) { l = 0 } if (c && l < 1) { l = 1 } if (l < h.childNodes.length) { h.insertBefore(a, h.childNodes[l]) } else { h.appendChild(a) } }; dhtmlXMenuObject.prototype.getParentId = function(a) { a = this.idPrefix + a; if (this.itemPull[a] == null) { return null } return ((this.itemPull[a]["parent"] != null ? this.itemPull[a]["parent"] : this.topId).replace(this.idPrefix, "")) }; dhtmlXMenuObject.prototype.hide = function() { this._clearAndHide() }; dhtmlXMenuObject.prototype.clearAll = function() { this.removeItem(this.idPrefix + this.topId, true); this._isInited = false; this.idPrefix = this._genStr(12) + "_"; this.itemPull = {} }; if (typeof(dhtmlXMenuObject.prototype.liveInst) == "undefined") { dhtmlXMenuObject.prototype.liveInst = {} } dhtmlXMenuObject.prototype.setIconset = function(a) { this.conf.icons_css = (a == "awesome") }; dhtmlXMenuObject.prototype._redistribTopLevelSelection = function(g, c) { var a = this._getSubItemToDeselectByPolygon("parent"); this._removeSubItemFromSelected(-1, -1); for (var e = 0; e < a.length; e++) { if (a[e] != g) { this._hidePolygon(a[e]) } if ((this.idPull[a[e]] != null) && (a[e] != g)) { this.idPull[a[e]].className = this.idPull[a[e]].className.replace(/Selected/g, "Normal") } } if (this.itemPull[this.idPrefix + g]["state"] == "enabled") { this.idPull[this.idPrefix + g].className = "dhtmlxMenu_" + this.conf.skin + "_TopLevel_Item_Selected"; this._addSubItemToSelected(this.idPrefix + g, "parent"); this.conf.selected = (this.conf.mode == "win" ? (this.conf.selected != -1 ? g : this.conf.selected) : g); if ((this.itemPull[this.idPrefix + g]["complex"]) && (this.conf.selected != -1)) { this._showPolygon(this.idPrefix + g, this.conf.dir_toplv) } } }; dhtmlXMenuObject.prototype._initTopLevelMenu = function() { this.conf.dir_toplv = "bottom"; this.conf.dir_sublv = (this.conf.rtl ? "left" : "right"); if (this.conf.context) { this.idPull[this.idPrefix + this.topId] = new Array(0, 0); this._addSubMenuPolygon(this.idPrefix + this.topId, this.idPrefix + this.topId) } else { var a = this._getMenuNodes(this.idPrefix + this.topId); for (var c = 0; c < a.length; c++) { if (this.itemPull[a[c]]["type"] == "item") { this._renderToplevelItem(a[c], null) } if (this.itemPull[a[c]]["type"] == "separator") { this._renderSeparator(a[c], null) } } } }; dhtmlXMenuObject.prototype._renderToplevelItem = function(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) { if (this.conf.icons_css == true) { var e = document.createElement("i"); e.className = this.conf.icons_path + g; if (a.childNodes.length > 0 && !this.conf.rtl) { a.insertBefore(e, a.childNodes[0]) } else { a.appendChild(e) } } else { 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(l, h) { var c = this._renderSublevelPolygon(l, h); var a = this._getMenuNodes(h); for (e = 0; e < a.length; e++) { if (this.itemPull[a[e]]["type"] == "separator") { this._renderSeparator(a[e], null) } else { this._renderSublevelItem(a[e], null) } } if (l == h) { var g = "topLevel" } else { var g = "subLevel" } for (var e = 0; e < a.length; e++) { if (this.itemPull[a[e]]["complex"]) { this._addSubMenuPolygon(l, this.itemPull[a[e]]["id"]) } } }; dhtmlXMenuObject.prototype._renderSublevelPolygon = function(h, g) { var c = document.createElement("DIV"); c.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_Polygon " + (this.conf.rtl ? "dir_right" : ""); c.dir = "ltr"; c.oncontextmenu = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } l.cancelBubble = true; return false }; c.id = "polygon_" + g; c.onclick = function(l) { l = l || event; l.cancelBubble = true }; c.style.display = "none"; document.body.insertBefore(c, document.body.firstChild); c.innerHTML = '
'; var e = document.createElement("TABLE"); e.className = "dhtmlxMebu_SubLevelArea_Tbl"; e.cellSpacing = 0; e.cellPadding = 0; e.border = 0; var a = document.createElement("TBODY"); e.appendChild(a); c.childNodes[1].appendChild(e); c.tbl = e; c.tbd = a; this.idPull[c.id] = c; if (this.sxDacProc != null) { this.idPull["sxDac_" + g] = new this.sxDacProc(c, c.className); if (window.dhx4.isIE) { this.idPull["sxDac_" + g]._setSpeed(this.dacSpeedIE); this.idPull["sxDac_" + g]._setCustomCycle(this.dacCyclesIE) } else { this.idPull["sxDac_" + g]._setSpeed(this.dacSpeed); this.idPull["sxDac_" + g]._setCustomCycle(this.dacCycles) } } return c }; dhtmlXMenuObject.prototype._renderSublevelItem = function(a, q) { var n = this; var o = document.createElement("TR"); o.className = (this.itemPull[a]["state"] == "enabled" ? "sub_item" : "sub_item_dis"); var m = document.createElement("TD"); m.className = "sub_item_icon"; var v = this.itemPull[a]["type"]; var r = this.itemPull[a][(this.itemPull[a]["state"] == "enabled" ? "imgen" : "imgdis")]; if (r != "") { if (v == "checkbox" || v == "radio") { var h = document.createElement("DIV"); h.id = "image_" + this.itemPull[a]["id"]; h.className = "sub_icon " + r; m.appendChild(h) } if (!(v == "checkbox" || v == "radio")) { if (this.conf.icons_css == true) { m.innerHTML = "" } else { var h = document.createElement("IMG"); h.id = "image_" + this.itemPull[a]["id"]; h.className = "sub_icon"; h.src = this.conf.icons_path + r; m.appendChild(h) } } } else { m.innerHTML = " " } var l = document.createElement("TD"); l.className = "sub_item_text"; if (this.itemPull[a]["title"] != "") { var u = document.createElement("DIV"); u.className = "sub_item_text"; u.innerHTML = this.itemPull[a]["title"]; l.appendChild(u) } else { l.innerHTML = " " } var g = document.createElement("TD"); g.className = "sub_item_hk"; if (this.itemPull[a]["complex"]) { var c = document.createElement("DIV"); c.className = "complex_arrow"; c.id = "arrow_" + this.itemPull[a]["id"]; g.appendChild(c) } else { if (this.itemPull[a]["hotkey"].length > 0 && !this.itemPull[a]["complex"]) { var e = document.createElement("DIV"); e.className = "sub_item_hk"; e.innerHTML = this.itemPull[a]["hotkey"]; g.appendChild(e) } else { g.innerHTML = " " } } o.appendChild(this.conf.rtl ? g : m); o.appendChild(l); o.appendChild(this.conf.rtl ? m : g); o.id = this.itemPull[a]["id"]; o.parent = this.itemPull[a]["parent"]; if (this.itemPull[a]["tip"].length > 0) { o.title = this.itemPull[a]["tip"] } o.onselectstart = function(w) { w = w || event; if (w.preventDefault) { w.preventDefault() } else { w.returnValue = false } return false }; o.onmouseover = function(w) { if (n.conf.hide_tm[this.id]) { window.clearTimeout(n.conf.hide_tm[this.id]) } if (n.conf.mode == "web") { window.clearTimeout(n.conf.tm_handler) } if (!this._visible) { n._redistribSubLevelSelection(this.id, this.parent) } this._visible = true }; o.onmouseout = function(y) { var w = y.relatedTarget; if (w && (w.className === "sub_sep" || (w.firstChild && w.firstChild.className === "sub_sep"))) { this._visible = false; return } if (n.conf.mode == "web") { if (n.conf.tm_handler) { window.clearTimeout(n.conf.tm_handler) } n.conf.tm_handler = window.setTimeout(function() { if (n && n._clearAndHide) { n._clearAndHide() } }, n.conf.tm_sec, "JavaScript") } var x = this; if (n.conf.hide_tm[this.id]) { window.clearTimeout(n.conf.hide_tm[this.id]) } n.conf.hide_tm[this.id] = window.setTimeout(function() { x._visible = false }, 50) }; o.onclick = function(x) { if (!n.checkEvent("onClick") && n.itemPull[this.id]["complex"]) { return } x = x || event; x.cancelBubble = true; if (x.preventDefault) { x.preventDefault() } else { x.returnValue = false } tc = (n.itemPull[this.id]["complex"] ? "c" : "-"); td = (n.itemPull[this.id]["state"] == "enabled" ? "-" : "d"); var w = { ctrl: x.ctrlKey, alt: x.altKey, shift: x.shiftKey }; switch (n.itemPull[this.id]["type"]) { case "checkbox": n._checkboxOnClickHandler(this.id.replace(n.idPrefix, ""), tc + td + "n", w); break; case "radio": n._radioOnClickHandler(this.id.replace(n.idPrefix, ""), tc + td + "n", w); break; case "item": n._doOnClick(this.id.replace(n.idPrefix, ""), tc + td + "n", w); break } return false }; var s = this.idPull["polygon_" + this.itemPull[a]["parent"]]; if (q != null) { q++; if (q < 0) { q = 0 } if (q > s.tbd.childNodes.length - 1) { q = null } } if (q != null && s.tbd.childNodes[q] != null) { s.tbd.insertBefore(o, s.tbd.childNodes[q]) } else { s.tbd.appendChild(o) } this.idPull[o.id] = o }; dhtmlXMenuObject.prototype._renderSeparator = function(c, m) { var a = (this.conf.context ? "SubLevelArea" : (this.itemPull[c]["parent"] == this.idPrefix + this.topId ? "TopLevel" : "SubLevelArea")); if (a == "TopLevel" && this.conf.context) { return } var h = this; if (a != "TopLevel") { var l = document.createElement("TR"); l.className = "sub_sep"; var e = document.createElement("TD"); e.colSpan = "3"; l.appendChild(e) } var g = document.createElement("DIV"); g.id = "separator_" + c; g.className = (a == "TopLevel" ? "top_sep" : "sub_sep"); g.onselectstart = function(q) { q = q || event; if (q.preventDefault) { q.preventDefault() } else { q.returnValue = false } }; g.onclick = function(r) { r = r || event; r.cancelBubble = true; var q = { ctrl: r.ctrlKey, alt: r.altKey, shift: r.shiftKey }; h._doOnClick(this.id.replace("separator_" + h.idPrefix, ""), "--s", q) }; if (a == "TopLevel") { if (m != null) { m++; if (m < 0) { m = 0 } if (this.cont.childNodes[m] != null) { this.cont.insertBefore(g, this.cont.childNodes[m]) } else { this.cont.appendChild(g) } } else { var o = this.cont.childNodes[this.cont.childNodes.length - 1]; if (String(o).search("TopLevel_Text") == -1) { this.cont.appendChild(g) } else { this.cont.insertBefore(g, o) } } this.idPull[g.id] = g } else { var n = this.idPull["polygon_" + this.itemPull[c]["parent"]]; if (m != null) { m++; if (m < 0) { m = 0 } if (m > n.tbd.childNodes.length - 1) { m = null } } if (m != null && n.tbd.childNodes[m] != null) { n.tbd.insertBefore(l, n.tbd.childNodes[m]) } else { n.tbd.appendChild(l) } e.appendChild(g); this.idPull[g.id] = l } }; dhtmlXMenuObject.prototype.addNewSeparator = function(a, c) { c = this.idPrefix + (c != null ? c : this._genStr(24)); var e = this.idPrefix + this.getParentId(a); this._addItemIntoGlobalStrorage(c, e, "", "separator", false, "", ""); this._renderSeparator(c, this.getItemPosition(a)) }; dhtmlXMenuObject.prototype._initObj = function(s, u, m) { if (!(s instanceof Array)) { m = s.parentId; if (m != null && String(m).indexOf(this.idPrefix) !== 0) { m = this.idPrefix + String(m) } s = s.items } for (var e = 0; e < s.length; e++) { if (typeof(s[e].id) == "undefined" || s[e].id == null) { s[e].id = this._genStr(24) } if (s[e].text == null) { s[e].text = "" } if (String(s[e].id).indexOf(this.idPrefix) !== 0) { s[e].id = this.idPrefix + String(s[e].id) } var g = { type: "item", tip: "", hotkey: "", state: "enabled", imgen: "", imgdis: "" }; for (var v in g) { if (typeof(s[e][v]) == "undefined") { s[e][v] = g[v] } } if (s[e].imgen == "" && s[e].img != null) { s[e].imgen = s[e].img } if (s[e].imgdis == "" && s[e].img_disabled != null) { s[e].imgdis = s[e].img_disabled } if (s[e].title == null && s[e].text != null) { s[e].title = s[e].text } if (s[e].href != null) { if (s[e].href.link != null) { s[e].href_link = s[e].href.link } if (s[e].href.target != null) { s[e].href_target = s[e].href.target } } if (s[e].userdata != null) { for (var v in s[e].userdata) { this.userData[s[e].id + "_" + v] = s[e].userdata[v] } } if (typeof(s[e].enabled) != "undefined" && window.dhx4.s2b(s[e].enabled) == false) { s[e].state = "disabled" } else { if (typeof(s[e].disabled) != "undefined" && window.dhx4.s2b(s[e].disabled) == true) { s[e].state = "disabled" } } if (typeof(s[e].parent) == "undefined") { s[e].parent = (m != null ? m : this.idPrefix + this.topId) } if (s[e].type == "checkbox") { s[e].checked = window.dhx4.s2b(s[e].checked); s[e].imgen = s[e].imgdis = "chbx_" + (s[e].checked ? "1" : "0") } if (s[e].type == "radio") { s[e].checked = window.dhx4.s2b(s[e].checked); s[e].imgen = s[e].imgdis = "rdbt_" + (s[e].checked ? "1" : "0"); if (typeof(s[e].group) == "undefined" || s[e].group == null) { s[e].group = this._genStr(24) } if (this.radio[s[e].group] == null) { this.radio[s[e].group] = [] } this.radio[s[e].group].push(s[e].id) } this.itemPull[s[e].id] = s[e]; if (s[e].items != null && s[e].items.length > 0) { this.itemPull[s[e].id].complex = true; this._initObj(s[e].items, true, s[e].id) } else { if (this.conf.dload && s[e].complex == true) { this.itemPull[s[e].id].loaded = "no" } } this.itemPull[s[e].id].items = null } if (u !== true) { if (this.conf.dload == true) { if (m == null) { this._initTopLevelMenu() } else { this._addSubMenuPolygon(m, m); if (this.conf.selected == m) { var r = (this.itemPull[m].parent == this.idPrefix + this.topId); var c = (r && !this.conf.context ? this.conf.dir_toplv : this.conf.dir_sublv); var h = false; if (r && this.conf.top_mode && this.conf.mode == "web" && !this.conf.context) { var w = this.idPull[m]; if (w._mouseOver == true) { var l = this.conf.top_tmtime - (new Date().getTime() - w._dynLoadTM); if (l > 1) { var o = m; var n = this; w._menuOpenTM = window.setTimeout(function() { n._showPolygon(o, c); n = o = null }, l); h = true } } } if (!h) { this._showPolygon(m, c) } } this.itemPull[m].loaded = "yes"; if (this.conf.dload_icon == true) { this._updateLoaderIcon(m, false) } } } else { this._init() } } }; dhtmlXMenuObject.prototype._xmlToJson = function(h, g) { var m = []; if (g == null) { var n = h.getElementsByTagName(this.conf.tags.root); if (n == null || (n != null && n.length == 0)) { return { items: [] } } n = n[0] } else { n = h } if (n.getAttribute("parentId") != null) { g = this.idPrefix + n.getAttribute("parentId") } for (var c = 0; c < n.childNodes.length; c++) { if (typeof(n.childNodes[c].tagName) != "undefined" && String(n.childNodes[c].tagName).toLowerCase() == this.conf.tags.item) { var a = n.childNodes[c]; var u = { 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) { u.cssNormal = a.getAttribute("cssNormal") } if (u.type == "checkbox") { u.checked = a.getAttribute("checked") } if (u.type == "radio") { u.checked = a.getAttribute("checked"); u.group = a.getAttribute("group") } u.state = "enabled"; if (a.getAttribute("enabled") != null && window.dhx4.s2b(a.getAttribute("enabled")) == false) { u.state = "disabled" } else { if (a.getAttribute("disabled") != null && window.dhx4.s2b(a.getAttribute("disabled")) == true) { u.state = "disabled" } } u.parent = (g != null ? g : this.idPrefix + this.topId); if (this.conf.dload) { u.complex = (a.getAttribute("complex") != null); if (u.complex) { u.loaded = "no" } } else { var e = this._xmlToJson(a, u.id); u.items = e.items; u.complex = (u.items.length > 0) } for (var o = 0; o < a.childNodes.length; o++) { if (typeof(a.childNodes[o].tagName) != "undefined") { var s = String(a.childNodes[o].tagName || "").toLowerCase(); if (s == this.conf.tags.userdata) { var l = a.childNodes[o]; if (l.getAttribute("name") != null) { this.userData[u.id + "_" + l.getAttribute("name")] = (l.firstChild != null && l.firstChild.nodeValue != null ? l.firstChild.nodeValue : "") } } if (s == this.conf.tags.text_ext) { u.title = a.childNodes[o].firstChild.nodeValue } if (s == this.conf.tags.tooltip) { u.tip = a.childNodes[o].firstChild.nodeValue } if (s == this.conf.tags.hotkey) { u.hotkey = a.childNodes[o].firstChild.nodeValue } if (s == this.conf.tags.href && u.type == "item") { u.href_link = a.childNodes[o].firstChild.nodeValue; if (a.childNodes[o].getAttribute("target") != null) { u.href_target = a.childNodes[o].getAttribute("target") } } } } m.push(u) } } var a = { parentId: g, items: m }; return a }; dhtmlXMenuObject.prototype.enableDynamicLoading = function(a, c) { this.conf.dload = true; this.conf.dload_url = a; this.conf.dload_sign = (String(this.conf.dload_url).search(/\?/) == -1 ? "?" : "&"); this.conf.dload_icon = c; this._init() }; dhtmlXMenuObject.prototype._updateLoaderIcon = function(g, e) { if (this.idPull[g] == null) { return } if (String(this.idPull[g].className).search("TopLevel_Item") >= 0) { return } var c = (this.conf.rtl ? 0 : 2); if (!this.idPull[g].childNodes[c]) { return } if (!this.idPull[g].childNodes[c].childNodes[0]) { return } var a = this.idPull[g].childNodes[c].childNodes[0]; if (String(a.className).search("complex_arrow") === 0) { a.className = "complex_arrow" + (e ? "_loading" : "") } }; dhtmlXMenuObject.prototype.addNewSibling = function(g, h, a, c, e, n) { var m = this.idPrefix + (h != null ? h : this._genStr(24)); var l = this.idPrefix + (g != null ? this.getParentId(g) : this.topId); this._addItemIntoGlobalStrorage(m, l, a, "item", c, e, n); if ((l == this.idPrefix + this.topId) && (!this.conf.context)) { this._renderToplevelItem(m, this.getItemPosition(g)) } else { this._renderSublevelItem(m, this.getItemPosition(g)) } }; dhtmlXMenuObject.prototype.addNewChild = function(m, l, g, a, c, e, h) { if (m == null) { if (this.conf.context) { m = this.topId } else { this.addNewSibling(m, g, a, c, e, h); if (l != null) { this.setItemPosition(g, l) } return } } g = this.idPrefix + (g != null ? g : this._genStr(24)); if (this.setHotKey) { this.setHotKey(m, "") } m = this.idPrefix + m; this._addItemIntoGlobalStrorage(g, m, a, "item", c, e, h); if (this.idPull["polygon_" + m] == null) { this._renderSublevelPolygon(m, m) } this._renderSublevelItem(g, l - 1); this._redefineComplexState(m) }; dhtmlXMenuObject.prototype.removeItem = function(g, l, h) { if (!l) { g = this.idPrefix + g } var m = null; if (g != this.idPrefix + this.topId) { if (this.itemPull[g] == null) { return } if (this.idPull["polygon_" + g] && this.idPull["polygon_" + g]._tmShow) { window.clearTimeout(this.idPull["polygon_" + g]._tmShow) } var u = this.itemPull[g]["type"]; if (u == "separator") { var s = this.idPull["separator_" + g]; if (this.itemPull[g]["parent"] == this.idPrefix + this.topId) { s.onclick = null; s.onselectstart = null; s.id = null; s.parentNode.removeChild(s) } else { s.childNodes[0].childNodes[0].onclick = null; s.childNodes[0].childNodes[0].onselectstart = null; s.childNodes[0].childNodes[0].id = null; s.childNodes[0].removeChild(s.childNodes[0].childNodes[0]); s.removeChild(s.childNodes[0]); s.parentNode.removeChild(s) } this.idPull["separator_" + g] = null; this.itemPull[g] = null; delete this.idPull["separator_" + g]; delete this.itemPull[g]; s = null } else { m = this.itemPull[g]["parent"]; var s = this.idPull[g]; s.onclick = null; s.oncontextmenu = null; s.onmouseover = null; s.onmouseout = null; s.onselectstart = null; s.id = null; while (s.childNodes.length > 0) { s.removeChild(s.childNodes[0]) } s.parentNode.removeChild(s); this.idPull[g] = null; this.itemPull[g] = null; delete this.idPull[g]; delete this.itemPull[g]; s = null } u = null } for (var o in this.itemPull) { if (this.itemPull[o]["parent"] == g) { this.removeItem(o, true, true) } } var r = new Array(g); if (m != null && !h) { if (this.idPull["polygon_" + m] != null) { if (this.idPull["polygon_" + m].tbd.childNodes.length == 0) { r.push(m); this._updateItemComplexState(m, false, false) } } } for (var c = 0; c < r.length; c++) { if (this.idPull["polygon_" + r[c]]) { var e = this.idPull["polygon_" + r[c]]; e.onclick = null; e.oncontextmenu = null; e.tbl.removeChild(e.tbd); e.tbd = null; e.childNodes[1].removeChild(e.tbl); e.tbl = null; e.id = null; e.parentNode.removeChild(e); e = null; if (window.dhx4.isIE6) { var n = "polygon_" + r[c] + "_ie6cover"; if (this.idPull[n] != null) { document.body.removeChild(this.idPull[n]); delete this.idPull[n] } } if (this.idPull["arrowup_" + g] != null && this._removeArrow) { this._removeArrow("arrowup_" + g) } if (this.idPull["arrowdown_" + g] != null && this._removeArrow) { this._removeArrow("arrowdown_" + g) } this.idPull["polygon_" + r[c]] = null; delete this.idPull["polygon_" + r[c]] } } r = null; if (this.conf.skin == "dhx_terrace" && arguments.length == 1) { this._improveTerraceSkin() } }; dhtmlXMenuObject.prototype._addItemIntoGlobalStrorage = function(n, a, e, m, g, c, l) { var h = { id: n, title: e, imgen: (c != null ? c : ""), imgdis: (l != null ? l : ""), type: m, state: (g == true ? "disabled" : "enabled"), parent: a, complex: false, hotkey: "", tip: "" }; this.itemPull[h.id] = h }; dhtmlXMenuObject.prototype.renderAsContextMenu = function() { this.conf.context = true; if (this.base._autoSkinUpdate == true) { this.base.className = this.base.className.replace("dhtmlxMenu_" + this.conf.skin + "_Middle", ""); this.base._autoSkinUpdate = false } if (this.conf.ctx_baseid != null) { this.addContextZone(this.conf.ctx_baseid) } }; dhtmlXMenuObject.prototype.addContextZone = function(c) { if (c == document.body) { c = "document.body." + this.idPrefix; var g = document.body } else { if (typeof(c) == "string") { var g = document.getElementById(c) } else { var g = c } } var l = false; for (var e in this.conf.ctx_zones) { l = l || (e == c) || (this.conf.ctx_zones[e] == g) } if (l == true) { return false } this.conf.ctx_zones[c] = g; var h = this; if (window.dhx4.isOpera) { this.operaContext = function(a) { h._doOnContextMenuOpera(a, h) }; g.addEventListener("mouseup", this.operaContext, false) } else { if (g.oncontextmenu != null && !g._oldContextMenuHandler) { g._oldContextMenuHandler = g.oncontextmenu } g.oncontextmenu = function(m) { for (var a in dhtmlXMenuObject.prototype.liveInst) { if (a != h.conf.live_id) { if (dhtmlXMenuObject.prototype.liveInst[a].context) { dhtmlXMenuObject.prototype.liveInst[a]._hideContextMenu() } } } m = m || event; m.cancelBubble = true; if (m.preventDefault) { m.preventDefault() } else { m.returnValue = false } h._doOnContextBeforeCall(m, this); return false } } }; dhtmlXMenuObject.prototype._doOnContextMenuOpera = function(g, a) { for (var c in dhtmlXMenuObject.prototype.liveInst) { if (c != a.conf.live_id) { if (dhtmlXMenuObject.prototype.liveInst[c].context) { dhtmlXMenuObject.prototype.liveInst[c]._hideContextMenu() } } } g.cancelBubble = true; if (g.preventDefault) { g.preventDefault() } else { g.returnValue = false } if (g.button == 0 && g.ctrlKey == true) { a._doOnContextBeforeCall(g, this) } return false }; dhtmlXMenuObject.prototype.removeContextZone = function(a) { if (!this.isContextZone(a)) { return false } if (a == document.body) { a = "document.body." + this.idPrefix } var c = this.conf.ctx_zones[a]; if (window.dhx4.isOpera) { c.removeEventListener("mouseup", this.operaContext, false) } else { c.oncontextmenu = (c._oldContextMenuHandler != null ? c._oldContextMenuHandler : null); c._oldContextMenuHandler = null } try { this.conf.ctx_zones[a] = null; delete this.conf.ctx_zones[a] } catch (g) {} return true }; dhtmlXMenuObject.prototype.isContextZone = function(a) { if (a == document.body && this.conf.ctx_zones["document.body." + this.idPrefix] != null) { return true } var c = false; if (this.conf.ctx_zones[a] != null) { if (this.conf.ctx_zones[a] == document.getElementById(a)) { c = true } } return c }; dhtmlXMenuObject.prototype._isContextMenuVisible = function() { if (this.idPull["polygon_" + this.idPrefix + this.topId] == null) { return false } return (this.idPull["polygon_" + this.idPrefix + this.topId].style.display == "") }; dhtmlXMenuObject.prototype._showContextMenu = function(c, e, a) { this._clearAndHide(); if (this.idPull["polygon_" + this.idPrefix + this.topId] == null) { return false } window.clearTimeout(this.conf.tm_handler); this.idPull[this.idPrefix + this.topId] = new Array(c, e); this._showPolygon(this.idPrefix + this.topId, "bottom"); this.callEvent("onContextMenu", [a]) }; dhtmlXMenuObject.prototype._hideContextMenu = function() { if (this.idPull["polygon_" + this.idPrefix + this.topId] == null) { return false } this._clearAndHide(); this._hidePolygon(this.idPrefix + this.topId) }; dhtmlXMenuObject.prototype._doOnContextBeforeCall = function(l, n) { this.conf.ctx_zoneid = n.id; this._clearAndHide(); this._hideContextMenu(); if (window.dhx4.isChrome == true || window.dhx4.isEdge == true || window.dhx4.isOpera == true || window.dhx4.isIE11 == true) { var m = window.dhx4.absLeft(l.target) + l.offsetX; var h = window.dhx4.absTop(l.target) + l.offsetY } else { if (window.dhx4.isIE6 == true || window.dhx4.isIE7 == true || window.dhx4.isIE == true) { var m = window.dhx4.absLeft(l.srcElement) + l.x || 0; var h = window.dhx4.absTop(l.srcElement) + l.y || 0 } else { var g = (l.srcElement || l.target); var c = (window.dhx4.isIE || window.dhx4.isKHTML ? l.offsetX : l.layerX); var a = (window.dhx4.isIE || window.dhx4.isKHTML ? l.offsetY : l.layerY); var m = window.dhx4.absLeft(g) + c; var h = window.dhx4.absTop(g) + a } } if (this.checkEvent("onBeforeContextMenu")) { if (this.callEvent("onBeforeContextMenu", [n.id, l])) { if (this.conf.ctx_autoshow) { this._showContextMenu(m, h, n.id); this.callEvent("onAfterContextMenu", [n.id, l]) } } } else { if (this.conf.ctx_autoshow) { this._showContextMenu(m, h, 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 e in this.itemPull) { if (this.itemPull[e].parent == this.idPrefix + this.topId && this.idPull[e] != null) { var h = false; var g = false; if (this.idPull[e].parentNode.firstChild == this.idPull[e]) { h = true } if (this.idPull[e].parentNode.lastChild == this.idPull[e]) { g = true } for (var c in this.itemPull) { if (this.itemPull[c].type == "separator" && this.itemPull[c].parent == this.idPrefix + this.topId) { if (this.idPull[e].nextSibling == this.idPull["separator_" + c]) { g = true } if (this.idPull[e].previousSibling == this.idPull["separator_" + c]) { h = true } } } this.idPull[e].style.borderLeftWidth = (h ? "1px" : "0px"); this.idPull[e].style.borderTopLeftRadius = this.idPull[e].style.borderBottomLeftRadius = (h ? "3px" : "0px"); this.idPull[e].style.borderTopRightRadius = this.idPull[e].style.borderBottomRightRadius = (g ? "3px" : "0px"); this.idPull[e]._bl = h; this.idPull[e]._br = g } } }; dhtmlXMenuObject.prototype._improveTerraceButton = function(c, a) { if (a) { this.idPull[c].style.borderBottomLeftRadius = (this.idPull[c]._bl ? "3px" : "0px"); this.idPull[c].style.borderBottomRightRadius = (this.idPull[c]._br ? "3px" : "0px") } else { this.idPull[c].style.borderBottomLeftRadius = "0px"; this.idPull[c].style.borderBottomRightRadius = "0px" } }; if (typeof(window.dhtmlXCellObject) != "undefined") { dhtmlXCellObject.prototype._createNode_menu = function(h, c, g, a, e) { if (typeof(e) != "undefined") { h = e } else { h = document.createElement("DIV"); h.className = "dhx_cell_menu_" + (this.conf.borders ? "def" : "no_borders"); h.appendChild(document.createElement("DIV")) } this.cell.insertBefore(h, this.cell.childNodes[this.conf.idx.toolbar || this.conf.idx.cont]); this.conf.ofs_nodes.t.menu = true; this._updateIdx(); return h }; dhtmlXCellObject.prototype.attachMenu = function(a) { if (this.dataNodes.menu) { return } this.callEvent("_onBeforeContentAttach", ["menu"]); if (typeof(a) == "undefined") { a = {} } if (typeof(a.skin) == "undefined") { a.skin = this.conf.skin } a.parent = this._attachObject("menu").firstChild; this.dataNodes.menu = new dhtmlXMenuObject(a); this._adjustCont(this._idd); a.parent = null; a = null; this.callEvent("_onContentAttach", []); return this.dataNodes.menu }; dhtmlXCellObject.prototype.detachMenu = function() { if (this.dataNodes.menu == null) { return } if (typeof(this.dataNodes.menu.unload) == "function") { this.dataNodes.menu.unload() } this.dataNodes.menu = null; delete this.dataNodes.menu; this._detachObject("menu") }; dhtmlXCellObject.prototype.showMenu = function() { this._mtbShowHide("menu", "") }; dhtmlXCellObject.prototype.hideMenu = function() { this._mtbShowHide("menu", "none") }; dhtmlXCellObject.prototype.getAttachedMenu = function() { return this.dataNodes.menu } } dhtmlXMenuObject.prototype.setItemEnabled = function(a) { this._changeItemState(a, "enabled", this._getItemLevelType(a)) }; dhtmlXMenuObject.prototype.setItemDisabled = function(a) { this._changeItemState(a, "disabled", this._getItemLevelType(a)) }; dhtmlXMenuObject.prototype.isItemEnabled = function(a) { return (this.itemPull[this.idPrefix + a] != null ? (this.itemPull[this.idPrefix + a]["state"] == "enabled") : false) }; dhtmlXMenuObject.prototype._changeItemState = function(h, g, c) { var e = false; var a = this.idPrefix + h; if ((this.itemPull[a] != null) && (this.idPull[a] != null)) { if (this.itemPull[a]["state"] != g) { this.itemPull[a]["state"] = g; if (this.itemPull[a]["parent"] == this.idPrefix + this.topId && !this.conf.context) { this.idPull[a].className = "dhtmlxMenu_" + this.conf.skin + "_TopLevel_Item_" + (this.itemPull[a]["state"] == "enabled" ? "Normal" : "Disabled") } else { this.idPull[a].className = "sub_item" + (this.itemPull[a]["state"] == "enabled" ? "" : "_dis") } this._updateItemComplexState(this.idPrefix + h, this.itemPull[this.idPrefix + h]["complex"], false); this._updateItemImage(h, c); if ((this.idPrefix + this.conf.last_click == a) && (c != "TopLevel")) { this._redistribSubLevelSelection(a, this.itemPull[a]["parent"]) } if (c == "TopLevel" && !this.conf.context) {} } } return e }; dhtmlXMenuObject.prototype.getItemText = function(a) { return (this.itemPull[this.idPrefix + a] != null ? this.itemPull[this.idPrefix + a]["title"] : "") }; dhtmlXMenuObject.prototype.setItemText = function(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(e, l, g) { var c = this.conf.tags.item; this.conf.tags.item = "div"; var h = (typeof(e) == "string" ? document.getElementById(e) : e); var a = this._xmlToJson(h, this.idPrefix + this.topId); this._initObj(a); this.conf.tags.item = c; if (l) { h.parentNode.removeChild(h) } h = objOd = null; if (onload != null) { if (typeof(g) == "function") { g() } else { if (typeof(window[g]) == "function") { window[g]() } } } }; dhtmlXMenuObject.prototype.hideItem = function(a) { this._changeItemVisible(a, false) }; dhtmlXMenuObject.prototype.showItem = function(a) { this._changeItemVisible(a, true) }; dhtmlXMenuObject.prototype.isItemHidden = function(c) { var a = null; if (this.idPull[this.idPrefix + c] != null) { a = (this.idPull[this.idPrefix + c].style.display == "none") } return a }; dhtmlXMenuObject.prototype._changeItemVisible = function(e, c) { var a = this.idPrefix + e; if (this.itemPull[a] == null) { return } if (this.itemPull[a]["type"] == "separator") { a = "separator_" + a } if (this.idPull[a] == null) { return } this.idPull[a].style.display = (c ? "" : "none"); this._redefineComplexState(this.itemPull[this.idPrefix + e]["parent"]) }; dhtmlXMenuObject.prototype.setUserData = function(e, a, c) { this.userData[this.idPrefix + e + "_" + a] = c }; dhtmlXMenuObject.prototype.getUserData = function(c, a) { return (this.userData[this.idPrefix + c + "_" + a] != null ? this.userData[this.idPrefix + c + "_" + a] : null) }; dhtmlXMenuObject.prototype.setOpenMode = function(a) { this.conf.mode = (a == "win" ? "win" : "web") }; dhtmlXMenuObject.prototype.setWebModeTimeout = function(a) { this.conf.tm_sec = (!isNaN(a) ? a : 400) }; dhtmlXMenuObject.prototype.getItemImage = function(c) { var a = new Array(null, null); c = this.idPrefix + c; if (this.itemPull[c]["type"] == "item") { a[0] = this.itemPull[c]["imgen"]; a[1] = this.itemPull[c]["imgdis"] } return a }; dhtmlXMenuObject.prototype.setItemImage = function(e, a, c) { if (this.itemPull[this.idPrefix + e]["type"] != "item") { return } this.itemPull[this.idPrefix + e]["imgen"] = a; this.itemPull[this.idPrefix + e]["imgdis"] = c; this._updateItemImage(e, this._getItemLevelType(e)) }; dhtmlXMenuObject.prototype.clearItemImage = function(a) { this.setItemImage(a, "", "") }; dhtmlXMenuObject.prototype.setVisibleArea = function(c, a, g, e) { this.conf.v_enabled = true; this.conf.v.x1 = c; this.conf.v.x2 = a; this.conf.v.y1 = g; this.conf.v.y2 = e }; dhtmlXMenuObject.prototype.setTooltip = function(c, a) { c = this.idPrefix + c; if (!(this.itemPull[c] != null && this.idPull[c] != null)) { return } this.idPull[c].title = (a.length > 0 ? a : null); this.itemPull[c]["tip"] = a }; dhtmlXMenuObject.prototype.getTooltip = function(a) { if (this.itemPull[this.idPrefix + a] == null) { return null } return this.itemPull[this.idPrefix + a]["tip"] }; dhtmlXMenuObject.prototype.setTopText = function(a) { if (this.conf.context) { return } if (this._topText == null) { this._topText = document.createElement("DIV"); this._topText.className = "dhtmlxMenu_TopLevel_Text_" + (this.conf.rtl ? "left" : (this.conf.align == "left" ? "right" : "left")); this.base.appendChild(this._topText) } this._topText.innerHTML = a }; dhtmlXMenuObject.prototype.setAlign = function(a) { if (this.conf.align == a) { return } if (a == "left" || a == "right") { this.conf.align = a; if (this.cont) { this.cont.className = (this.conf.align == "right" ? "align_right" : "align_left") } if (this._topText != null) { this._topText.className = "dhtmlxMenu_TopLevel_Text_" + (this.conf.align == "left" ? "right" : "left") } } }; dhtmlXMenuObject.prototype.setHref = function(e, a, c) { if (this.itemPull[this.idPrefix + e] == null) { return } this.itemPull[this.idPrefix + e]["href_link"] = a; if (c != null) { this.itemPull[this.idPrefix + e]["href_target"] = c } }; dhtmlXMenuObject.prototype.clearHref = function(a) { if (this.itemPull[this.idPrefix + a] == null) { return } delete this.itemPull[this.idPrefix + a]["href_link"]; delete this.itemPull[this.idPrefix + a]["href_target"] }; dhtmlXMenuObject.prototype.getCircuit = function(c) { var a = new Array(c); while (this.getParentId(c) != this.topId) { c = this.getParentId(c); a[a.length] = c } return a.reverse() }; dhtmlXMenuObject.prototype._getCheckboxState = function(a) { if (this.itemPull[this.idPrefix + a] == null) { return null } return this.itemPull[this.idPrefix + a]["checked"] }; dhtmlXMenuObject.prototype._setCheckboxState = function(c, a) { if (this.itemPull[this.idPrefix + c] == null) { return } this.itemPull[this.idPrefix + c]["checked"] = a }; dhtmlXMenuObject.prototype._updateCheckboxImage = function(c) { if (this.idPull[this.idPrefix + c] == null) { return } this.itemPull[this.idPrefix + c]["imgen"] = "chbx_" + (this._getCheckboxState(c) ? "1" : "0"); this.itemPull[this.idPrefix + c]["imgdis"] = this.itemPull[this.idPrefix + c]["imgen"]; try { this.idPull[this.idPrefix + c].childNodes[(this.conf.rtl ? 2 : 0)].childNodes[0].className = "sub_icon " + this.itemPull[this.idPrefix + c]["imgen"] } catch (a) {} }; dhtmlXMenuObject.prototype._checkboxOnClickHandler = function(g, a, c) { if (a.charAt(1) == "d") { return } if (this.itemPull[this.idPrefix + g] == null) { return } var e = this._getCheckboxState(g); if (this.checkEvent("onCheckboxClick")) { if (this.callEvent("onCheckboxClick", [g, e, this.conf.ctx_zoneid, c])) { this.setCheckboxState(g, !e) } } else { this.setCheckboxState(g, !e) } if (this.checkEvent("onClick")) { this.callEvent("onClick", [g]) } }; dhtmlXMenuObject.prototype.setCheckboxState = function(c, a) { this._setCheckboxState(c, a); this._updateCheckboxImage(c) }; dhtmlXMenuObject.prototype.getCheckboxState = function(a) { return this._getCheckboxState(a) }; dhtmlXMenuObject.prototype.addCheckbox = function(n, g, o, q, r, a, h) { if (this.conf.context && g == this.topId) {} else { if (this.itemPull[this.idPrefix + g] == null) { return } if (n == "child" && this.itemPull[this.idPrefix + g]["type"] != "item") { return } } var l = "chbx_" + (a ? "1" : "0"); var e = l; if (n == "sibling") { var c = this.idPrefix + (q != null ? q : this._genStr(24)); var m = this.idPrefix + this.getParentId(g); this._addItemIntoGlobalStrorage(c, m, r, "checkbox", h, l, e); this.itemPull[c]["checked"] = a; this._renderSublevelItem(c, this.getItemPosition(g)) } else { var c = this.idPrefix + (q != null ? q : this._genStr(24)); var m = this.idPrefix + g; this._addItemIntoGlobalStrorage(c, m, r, "checkbox", h, l, e); this.itemPull[c]["checked"] = a; if (this.idPull["polygon_" + m] == null) { this._renderSublevelPolygon(m, m) } this._renderSublevelItem(c, o - 1); this._redefineComplexState(m) } }; 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 e = this._getSubItemToDeselectByPolygon(a); for (var c = 0; c < this.conf.opened_poly.length; c++) { if (this.conf.opened_poly[c] != a) { this._hidePolygon(this.conf.opened_poly[c]) } } for (var c = 0; c < e.length; c++) { if (this.idPull[e[c]] != null && this.itemPull[e[c]]["state"] == "enabled") { this.idPull[e[c]].className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_Item_Normal" } } }; dhtmlXMenuObject.prototype._checkArrowsState = function(g) { var c = this.idPull["polygon_" + g].childNodes[1]; var e = this.idPull["arrowup_" + g]; var a = this.idPull["arrowdown_" + g]; if (c.scrollTop == 0) { e.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp_Disabled" } else { e.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp" + (e.over ? "_Over" : "") } if (c.scrollTop + c.offsetHeight < c.scrollHeight) { a.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowDown" + (a.over ? "_Over" : "") } else { a.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowDown_Disabled" } c = e = a = null }; dhtmlXMenuObject.prototype._addUpArrow = function(g) { var c = this; var e = document.createElement("DIV"); e.pId = this.idPrefix + g; e.id = "arrowup_" + this.idPrefix + g; e.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp"; e.over = false; e.onselectstart = function(h) { h = h || event; if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } return false }; e.oncontextmenu = function(h) { h = h || event; if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } return false }; e.onmouseover = function() { if (c.conf.mode == "web") { window.clearTimeout(c.conf.tm_handler) } c._clearAllSelectedSubItemsInPolygon(this.pId); if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp_Disabled") { return } this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp_Over"; this.over = true; c._canScrollUp = true; c._doScrollUp(this.pId, true) }; e.onmouseout = function() { if (c.conf.mode == "web") { window.clearTimeout(c.conf.tm_handler); c.conf.tm_handler = window.setTimeout(function() { c._clearAndHide() }, c.conf.tm_sec, "JavaScript") } this.over = false; c._canScrollUp = false; if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp_Disabled") { return } this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp"; window.clearTimeout(c.conf.of_utm) }; e.onclick = function(h) { h = h || event; if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } h.cancelBubble = true; return false }; var a = this.idPull["polygon_" + this.idPrefix + g]; a.childNodes[0].appendChild(e); this.idPull[e.id] = e; a = e = null }; dhtmlXMenuObject.prototype._addDownArrow = function(g) { var c = this; var e = document.createElement("DIV"); e.pId = this.idPrefix + g; e.id = "arrowdown_" + this.idPrefix + g; e.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowDown"; e.over = false; e.onselectstart = function(h) { h = h || event; if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } return false }; e.oncontextmenu = function(h) { h = h || event; if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } return false }; e.onmouseover = function() { if (c.conf.mode == "web") { window.clearTimeout(c.conf.tm_handler) } c._clearAllSelectedSubItemsInPolygon(this.pId); if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown_Disabled") { return } this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown_Over"; this.over = true; c._canScrollDown = true; c._doScrollDown(this.pId, true) }; e.onmouseout = function() { if (c.conf.mode == "web") { window.clearTimeout(c.conf.tm_handler); c.conf.tm_handler = window.setTimeout(function() { c._clearAndHide() }, c.conf.tm_sec, "JavaScript") } this.over = false; c._canScrollDown = false; if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown_Disabled") { return } this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown"; window.clearTimeout(c.conf.of_dtm) }; e.onclick = function(h) { h = h || event; if (h.preventDefault) { h.preventDefault() } else { h.returnValue = false } h.cancelBubble = true; return false }; var a = this.idPull["polygon_" + this.idPrefix + g]; a.childNodes[2].appendChild(e); this.idPull[e.id] = e; a = e = null }; dhtmlXMenuObject.prototype._removeUpArrow = function(c) { var a = "arrowup_" + this.idPrefix + c; this._removeArrow(a) }; dhtmlXMenuObject.prototype._removeDownArrow = function(c) { var a = "arrowdown_" + this.idPrefix + c; this._removeArrow(a) }; dhtmlXMenuObject.prototype._removeArrow = function(a) { var c = this.idPull[a]; c.onselectstart = null; c.oncontextmenu = null; c.onmouseover = null; c.onmouseout = null; c.onclick = null; if (c.parentNode) { c.parentNode.removeChild(c) } c = null; this.idPull[a] = null; try { delete this.idPull[a] } catch (g) {} }; dhtmlXMenuObject.prototype._isArrowExists = function(a) { if (this.idPull["arrowup_" + a] != null && this.idPull["arrowdown_" + a] != null) { return true } return false }; dhtmlXMenuObject.prototype._doScrollUp = function(l, g) { var a = this.idPull["polygon_" + l].childNodes[1]; if (this._canScrollUp && a.scrollTop > 0) { var e = false; var h = a.scrollTop - this.conf.of_ustep; if (h < 0) { e = true; h = 0 } a.scrollTop = h; if (!e) { var c = this; this.conf.of_utm = window.setTimeout(function() { c._doScrollUp(l, false); c = null }, this.conf.of_utime) } else { g = true } } else { this._canScrollUp = false; this._checkArrowsState(l) } if (g) { this._checkArrowsState(l) } }; dhtmlXMenuObject.prototype._doScrollDown = function(l, g) { var a = this.idPull["polygon_" + l].childNodes[1]; if (this._canScrollDown && a.scrollTop + a.offsetHeight <= a.scrollHeight) { var e = false; var h = a.scrollTop + this.conf.of_dstep; if (h + a.offsetHeight >= a.scrollHeight) { e = true; h = a.scrollHeight - a.offsetHeight } a.scrollTop = h; if (!e) { var c = this; this.conf.of_dtm = window.setTimeout(function() { c._doScrollDown(l, false); c = null }, this.conf.of_dtime) } else { g = true } } else { this._canScrollDown = false; this._checkArrowsState(l) } if (g) { this._checkArrowsState(l) } }; dhtmlXMenuObject.prototype._countPolygonItems = function(l) { var g = 0; for (var c in this.itemPull) { var e = this.itemPull[c]["parent"]; var h = this.itemPull[c]["type"]; if (e == this.idPrefix + l && (h == "item" || h == "radio" || h == "checkbox")) { g++ } } return g }; dhtmlXMenuObject.prototype.setOverflowHeight = function(g) { if (g === "auto") { this.conf.overflow_limit = 0; this.conf.auto_overflow = true; return } if (this.conf.overflow_limit == 0 && g <= 0) { return } this._clearAndHide(); if (this.conf.overflow_limit >= 0 && g > 0) { this.conf.overflow_limit = g; return } if (this.conf.overflow_limit > 0 && g <= 0) { for (var e in this.itemPull) { if (this._isArrowExists(e)) { var c = String(e).replace(this.idPrefix, ""); this._removeUpArrow(c); this._removeDownArrow(c); this.idPull["polygon_" + e].childNodes[1].style.height = "" } } this.conf.overflow_limit = 0; return } }; dhtmlXMenuObject.prototype._getRadioImgObj = function(g) { try { var a = this.idPull[this.idPrefix + g].childNodes[(this.conf.rtl ? 2 : 0)].childNodes[0] } catch (c) { var a = null } return a }; dhtmlXMenuObject.prototype._setRadioState = function(g, e) { var c = this._getRadioImgObj(g); if (c != null) { var a = this.itemPull[this.idPrefix + g]; a.checked = e; a.imgen = "rdbt_" + (a.checked ? "1" : "0"); a.imgdis = a.imgen; c.className = "sub_icon " + a.imgen } }; dhtmlXMenuObject.prototype._radioOnClickHandler = function(g, a, c) { if (a.charAt(1) == "d" || this.itemPull[this.idPrefix + g]["group"] == null) { return } var e = this.itemPull[this.idPrefix + g]["group"]; if (this.checkEvent("onRadioClick")) { if (this.callEvent("onRadioClick", [e, this.getRadioChecked(e), g, this.conf.ctx_zoneid, c])) { this.setRadioChecked(e, g) } } else { this.setRadioChecked(e, g) } if (this.checkEvent("onClick")) { this.callEvent("onClick", [g]) } }; dhtmlXMenuObject.prototype.getRadioChecked = function(g) { var l = null; for (var e = 0; e < this.radio[g].length; e++) { var h = this.radio[g][e].replace(this.idPrefix, ""); var a = this._getRadioImgObj(h); if (a != null) { var c = (a.className).match(/rdbt_1$/gi); if (c != null) { l = h } } } return l }; dhtmlXMenuObject.prototype.setRadioChecked = function(c, g) { if (this.radio[c] == null) { return } for (var a = 0; a < this.radio[c].length; a++) { var e = this.radio[c][a].replace(this.idPrefix, ""); this._setRadioState(e, (e == g)) } }; dhtmlXMenuObject.prototype.addRadioButton = function(o, h, q, r, s, u, 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 e = this.idPrefix + (r != null ? r : this._genStr(24)); var m = "rdbt_" + (a ? "1" : "0"); var c = m; if (o == "sibling") { var n = this.idPrefix + this.getParentId(h); this._addItemIntoGlobalStrorage(e, n, s, "radio", l, m, c); this._renderSublevelItem(e, this.getItemPosition(h)) } else { var n = this.idPrefix + h; this._addItemIntoGlobalStrorage(e, n, s, "radio", l, m, c); if (this.idPull["polygon_" + n] == null) { this._renderSublevelPolygon(n, n) } this._renderSublevelItem(e, q - 1); this._redefineComplexState(n) } var g = (u != null ? u : this._genStr(24)); this.itemPull[e]["group"] = g; if (this.radio[g] == null) { this.radio[g] = new Array() } this.radio[g][this.radio[g].length] = e; if (a == true) { this.setRadioChecked(g, String(e).replace(this.idPrefix, "")) } }; dhtmlXMenuObject.prototype.serialize = function() { var a = "" + this._readLevel(this.idPrefix + this.topId) + ""; return a }; dhtmlXMenuObject.prototype._readLevel = function(g) { var h = ""; for (var o in this.itemPull) { if (this.itemPull[o]["parent"] == g) { var c = ""; var e = ""; var r = ""; var n = String(this.itemPull[o]["id"]).replace(this.idPrefix, ""); var m = ""; var q = (this.itemPull[o]["title"] != "" ? ' text="' + this.itemPull[o]["title"] + '"' : ""); var l = ""; if (this.itemPull[o]["type"] == "item") { if (this.itemPull[o]["imgen"] != "") { c = ' img="' + this.itemPull[o]["imgen"] + '"' } if (this.itemPull[o]["imgdis"] != "") { e = ' imgdis="' + this.itemPull[o]["imgdis"] + '"' } if (this.itemPull[o]["hotkey"] != "") { r = "" + this.itemPull[o]["hotkey"] + "" } } if (this.itemPull[o]["type"] == "separator") { m = ' type="separator"' } else { if (this.itemPull[o]["state"] == "disabled") { l = ' enabled="false"' } } if (this.itemPull[o]["type"] == "checkbox") { m = ' type="checkbox"' + (this.itemPull[o]["checked"] ? ' checked="true"' : "") } if (this.itemPull[o]["type"] == "radio") { m = ' type="radio" group="' + this.itemPull[o]["group"] + '" ' + (this.itemPull[o]["checked"] ? ' checked="true"' : "") } h += ""; h += r; if (this.itemPull[o]["complex"]) { h += this._readLevel(o) } h += "" } } return h }; dhtmlXMenuObject.prototype.enableEffect = function(e, h, g) { this._menuEffect = (e == "opacity" || e == "slide" || e == "slide+" ? e : false); this._pOpStyleIE = (navigator.userAgent.search(/MSIE\s[678]\.0/gi) >= 0); for (var c in this.idPull) { if (c.search(/polygon/) === 0) { this._pOpacityApply(c, (this._pOpStyleIE ? 100 : 1)); this.idPull[c].style.height = "" } } this._pOpMax = (typeof(h) == "undefined" ? 100 : h) / (this._pOpStyleIE ? 1 : 100); this._pOpStyleName = (this._pOpStyleIE ? "filter" : "opacity"); this._pOpStyleValue = (this._pOpStyleIE ? "progid:DXImageTransform.Microsoft.Alpha(Opacity=#)" : "#"); this._pSlSteps = (this._pOpStyleIE ? 10 : 20); this._pSlTMTimeMax = g || 50 }; dhtmlXMenuObject.prototype._showPolygonEffect = function(a) { this._pShowHide(a, true) }; dhtmlXMenuObject.prototype._hidePolygonEffect = function(a) { this._pShowHide(a, false) }; dhtmlXMenuObject.prototype._pOpacityApply = function(a, c) { this.idPull[a].style[this._pOpStyleName] = String(this._pOpStyleValue).replace("#", c || this.idPull[a]._op) }; dhtmlXMenuObject.prototype._pShowHide = function(a, c) { if (!this.idPull) { return } if (this.idPull[a]._tmShow != null) { if ((this.idPull[a]._step_h > 0 && c == true) || (this.idPull[a]._step_h < 0 && c == false)) { return } window.clearTimeout(this.idPull[a]._tmShow); this.idPull[a]._tmShow = null; this.idPull[a]._max_h = null } if (c == false && (this.idPull[a].style.visibility == "hidden" || this.idPull[a].style.display == "none")) { return } if (c == true && this.idPull[a].style.display == "none") { this.idPull[a].style.visibility = "hidden"; this.idPull[a].style.display = "" } if (this.idPull[a]._max_h == null) { this.idPull[a]._max_h = parseInt(this.idPull[a].offsetHeight); this.idPull[a]._h = (c == true ? 0 : this.idPull[a]._max_h); this.idPull[a]._step_h = Math.round(this.idPull[a]._max_h / this._pSlSteps) * (c == true ? 1 : -1); if (this.idPull[a]._step_h == 0) { return } this.idPull[a]._step_tm = Math.round(this._pSlTMTimeMax / this._pSlSteps); if (this._menuEffect == "slide+" || this._menuEffect == "opacity") { this.idPull[a].op_tm = this.idPull[a]._step_tm; this.idPull[a].op_step = (this._pOpMax / this._pSlSteps) * (c == true ? 1 : -1); if (this._pOpStyleIE) { this.idPull[a].op_step = Math.round(this.idPull[a].op_step) } this.idPull[a]._op = (c == true ? 0 : this._pOpMax); this._pOpacityApply(a) } else { this.idPull[a]._op = (this._pOpStyleIE ? 100 : 1); this._pOpacityApply(a) } if (this._menuEffect.search(/slide/) === 0) { this.idPull[a].style.height = "0px" } this.idPull[a].style.visibility = "visible" } this._pEffectSet(a, this.idPull[a]._h + this.idPull[a]._step_h) }; dhtmlXMenuObject.prototype._pEffectSet = function(e, c) { if (!this.idPull) { return } if (this.idPull[e]._tmShow) { window.clearTimeout(this.idPull[e]._tmShow) } this.idPull[e]._h = Math.max(0, Math.min(c, this.idPull[e]._max_h)); if (this._menuEffect.search(/slide/) === 0) { this.idPull[e].style.height = this.idPull[e]._h + "px" } c += this.idPull[e]._step_h; if (this._menuEffect == "slide+" || this._menuEffect == "opacity") { this.idPull[e]._op = Math.max(0, Math.min(this._pOpMax, this.idPull[e]._op + this.idPull[e].op_step)); this._pOpacityApply(e) } if ((this.idPull[e]._step_h > 0 && c <= this.idPull[e]._max_h) || (this.idPull[e]._step_h < 0 && c >= 0)) { var a = this; this.idPull[e]._tmShow = window.setTimeout(function() { a._pEffectSet(e, c) }, this.idPull[e]._step_tm) } else { if (this._menuEffect.search(/slide/) === 0) { this.idPull[e].style.height = "" } if (this.idPull[e]._step_h < 0) { this.idPull[e].style.visibility = "hidden" } if (this._menuEffect == "slide+" || this._menuEffect == "opacity") { this.idPull[e]._op = (this.idPull[e]._step_h < 0 ? (this._pOpStyleIE ? 100 : 1) : this._pOpMax); this._pOpacityApply(e) } this.idPull[e]._tmShow = null; this.idPull[e]._h = null; this.idPull[e]._max_h = null; this.idPull[e]._step_tm = null } }; function dhtmlXRibbon(g) { var e = this, c, a; this.conf = { type: "ribbon", icons_path: (g && g.icons_path) ? g.icons_path : "", icons_css: (g && g.iconsset == "awesome"), arrows_mode: (g && g.arrows_mode) ? g.arrows_mode : null, skin: "dhx_skyblue" }; this._eventHandlers = {}; this._base = null; this._items = {}; this._tabbar = null; this.childIds = []; if (typeof(g) == "string") { a = g } else { if (g && g.tagName) { a = g } else { if (g && g.parent) { if (g.parent.tagName || typeof(g.parent) == "string") { a = g.parent } } } } this._doOnHighlight0 = function(n) { n = n || event; var m = n.target || n.srcElement; var h = e._findItemByNode(m); var l = e._items[h._dhx_ribbonId]; if (l.conf.disable) { return } if (e.items[l.type] && typeof(e.items[l.type].mouseover) == "function") { if (e.items[l.type].mouseover(l, e, n) != true) { return false } } if (!/dhxrb_highlight0/.test(h.className)) { h.className += " dhxrb_highlight0" } }; this._doOffHighlight0 = function(n) { n = n || event; var m = n.target || n.srcElement; var h = e._findItemByNode(m); var l = e._items[h._dhx_ribbonId]; if (l.conf.disable) { return } if (e.items[l.type] && typeof(e.items[l.type].mouseout) == "function") { if (e.items[l.type].mouseout(l, e, n) != true) { return false } } if (/dhxrb_highlight1/.test(h.className)) { h.className = h.className.replace(/\s?dhxrb_highlight1/, "") } if (/dhxrb_highlight0/.test(h.className)) { h.className = h.className.replace(/\s?dhxrb_highlight0/, "") } }; this._doOnHighlight1 = function(n) { n = n || event; var m = n.target || n.srcElement; var h = e._findItemByNode(m); var l = e._items[h._dhx_ribbonId]; if (l.conf.disable) { return } e.callEvent("_showPopup", [l.id]); if (e.items[l.type] && typeof(e.items[l.type].mousedown) == "function") { if (e.items[l.type].mousedown(l, e, n) != true) { return false } } if (!/dhxrb_highlight1/.test(h.className)) { h.className += " dhxrb_highlight1" } }; this._doOffHighlight1 = function(n) { n = n || event; var m = n.target || n.srcElement; var h = e._findItemByNode(m); var l = e._items[h._dhx_ribbonId]; if (l.conf.disable) { return } if (e.items[l.type] && typeof(e.items[l.type].mouseup) == "function") { if (e.items[l.type].mouseup(l, e, n) != true) { return false } } if (/dhxrb_highlight1/.test(h.className)) { h.className = h.className.replace(/\s?dhxrb_highlight1/, "") } }; this._doOnClick = function(n) { n = n || event; var m = n.target || n.srcElement; var h = e._findItemByNode(m); var l = e._items[h._dhx_ribbonId]; if (l.conf.disable) { return } if (e.items[l.type] && typeof(e.items[l.type].click) == "function") { e.items[l.type].click(l, e, n) } }; this._doOnFocus = function(n) { n = n || event; var m = n.target || n.srcElement; var h = e._findItemByNode(m); var l = e._items[h._dhx_ribbonId]; if (l.conf.disable) { return } e.callEvent("_showPopup", [l.id]); if (e.items[l.type] && typeof(e.items[l.type].focus) == "function") { e.items[l.type].focus(l, e, n) } }; this._doOnBlur = function(n) { n = n || event; var m = n.target || n.srcElement; var h = e._findItemByNode(m); var l = e._items[h._dhx_ribbonId]; if (l.conf.disable) { return } if (e.items[l.type] && typeof(e.items[l.type].blur) == "function") { e.items[l.type].blur(l, e, n) } }; this._doOnChange = function(n) { n = n || event; var m = n.target || n.srcElement; var h = e._findItemByNode(m); var l = e._items[h._dhx_ribbonId]; if (l.conf.disable) { return } if (e.items[l.type] && typeof(e.items[l.type].change) == "function") { e.items[l.type].change(l, e, n) } }; this._doOnKeydown = function(n) { n = n || event; var m = n.target || n.srcElement; var h = e._findItemByNode(m); var l = e._items[h._dhx_ribbonId]; if (l.conf.disable) { return } if (e.items[l.type] && typeof(e.items[l.type].keydown) == "function") { e.items[l.type].keydown(l, e, n) } }; this._tabCustomApi = { enable: function(n, l) { var h = null; l = l || false; if (l != true) { h = e._items[this._idd]; for (var m = 0; m < h.childIds.length; m++) { e.enable(h.childIds[m]) } } return e._tabOriginalApi.enable.apply(this, [n]) }, disable: function(n, l) { var h = null; if (l != false) { h = e._items[this._idd]; for (var m = 0; m < h.childIds.length; m++) { e.disable(h.childIds[m]) } } return e._tabOriginalApi.disable.apply(this, [n]) }, close: function(m) { var l = e._items[this._idd]; e._removeTab(l); e._tabOriginalApi.close.apply(this, [m]); for (var h in e._tabOriginalApi) { this[h] = null } } }; this._attachEventTabbar = function() { this._tabbar.attachEvent("onSelect", function() { return e.callEvent("onSelect", arguments) }); this._tabbar.attachEvent("onTabClick", function() { return e.callEvent("onTabClick", arguments) }); this._tabbar.attachEvent("onTabClose", function() { return e.callEvent("onTabClose", arguments) }) }; if (typeof(a) == "string") { this._base = document.getElementById(a) } else { if (a && a.tagName) { this._base = a } else { this._base = document.createElement("div"); this._base._dhx_remove = true; if (document.body.firstChild) { document.body.insertBefore(this._base, document.body.firstChild) } else { document.body.appendChild(this._base) } } } c = dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || dhx4.skinDetect("dhtmlxribbon") || "material"; if (typeof(g) == "object" && g.skin) { c = g.skin } this.setSkin(c); dhx4._eventable(this); dhx4._enableDataLoading(this, "_renderData", "_xmlToJson", "ribbon", { struct: true }); this.attachEvent("_onHeightChanged", function() { this.conf.inited = true }); this._base.className += " dhxrb_without_tabbar"; this._base.innerHTML = "
"; if (g != null) { if (g.json) { this.loadStruct(g.json, g.onload) } else { if (g.xml) { this.loadStruct(g.xml, g.onload) } } this._renderData(g) } this.unload = function() { var l = []; for (var m = 0; m < this.childIds.length; m++) { l.push(this.childIds[m]) } dhx4._enableDataLoading(this, null, null, null, "clear"); dhx4._eventable(this, "clear"); for (var m = 0; m < l.length; 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 (var h in this) { this[h] = null } e = null } } dhtmlXRibbon.prototype.setSizes = function() { if (this._tabbar != null && typeof(this.setSizes) == "function") { this._tabbar.setSizes() } }; dhtmlXRibbon.prototype._renderData = function(c) { var a = this._base.firstChild; if (c != null) { this.conf.icons_path = c.icons_path || this.conf.icons_path; this.conf.icons_css = this.conf.icons_css || (c.iconset == "awesome"); if (c.tabs instanceof Array) { this._base.className = this._base.className.replace(/\s?dhxrb_without_tabbar/i, ""); a.className = "dhxrb_with_tabbar"; this._tabbar = new dhtmlXTabBar(a); this._attachEventTabbar(); this._tabbar.setSkin(this.conf.skin); if (this.conf.arrows_mode != null) { this._tabbar.setArrowsMode(this.conf.arrows_mode) } this.childIds = this._appendTabs(c.tabs) } else { if (c.items instanceof Array) { if (!/\s?dhxrb_without_tabbar/i.test(this._base.className)) { this._base.className += " dhxrb_without_tabbar" } if (/\s?dhxrb_background_area/i.test(a.className)) { a.className = "dhxrb_background_area" } a.innerHTML = "
"; this.childIds = this._appendBlocks(c.items, a.firstChild) } } this.callEvent("_onHeightChanged", []) } }; dhtmlXRibbon.prototype._xmlToJson = function(c) { if (!c) { dhx4.callEvent("onLoadXMLError", ["Incorrect XML", null, c]); return } var a = c.lastChild || null, g = {}, e = []; if (a && a.tagName == "ribbon") { e = this._convertXmlNodeListIntoObject(a.childNodes) } if (e[0] && e[0].type && e[0].type.toLowerCase() == "block") { g.items = e } else { g.tabs = e } return g }; dhtmlXRibbon.prototype._convertXmlNodeListIntoObject = function(c) { var e, a, h = [], g; a = c.length; for (e = 0; e < a; e++) { g = this._covertXmlNodeToObject(c[e]); if (g) { h.push(g) } } return h }; dhtmlXRibbon.prototype._covertXmlNodeToObject = function(g) { if (!g || !g.tagName || !(g.tagName.toLowerCase() == "item" || g.tagName.toLowerCase() == "tab")) { return null } var e, a, c = g.attributes, h = {}; a = c.length; for (e = 0; e < a; e++) { switch (c[e].name) { case "isbig": h.isbig = dhx4.s2b(c[e].value); break; case "state": h.state = dhx4.s2b(c[e].value); break; default: h[c[e].name] = c[e].value } } if (g.childNodes.length) { if (g.getAttribute("type") == "buttonCombo" || g.getAttribute("type") == "buttonSelect") { h.data = g } else { if (g.tagName.toLowerCase() == "tab") { h.items = this._convertXmlNodeListIntoObject(g.childNodes) } else { h.list = this._convertXmlNodeListIntoObject(g.childNodes) } } } return h }; dhtmlXRibbon.prototype._appendTabs = function(h) { var c, a, e, g = []; a = h.length; for (c = 0; c < a; c++) { e = this._addTab(h[c]); if (h[c].items instanceof Array) { e.childIds = this._appendBlocks(h[c].items, e.base, e) } g.push(e.id) } return g }; dhtmlXRibbon.prototype._addTab = function(e) { var a, g; var c = { conf: { active: false, text: "", width: null, position: null, disable: false }, base: document.createElement("div"), type: "tab", childIds: [] }; for (a in e) { if (a == "items") { continue } c.conf[a] = e[a] } if (!e.id) { c.id = dhx4.newId() } else { c.id = e.id } while (this._items[c.id]) { c.id = dhx4.newId() } this._tabbar.addTab(c.id, c.conf.text, c.conf.width, c.conf.position, c.conf.active); c.base.className = "dhxrb_g_area"; c.base._dhx_ribbonId = c.id; this.tabs(c.id).attachObject(c.base); this._changeApiForTab(this.tabs(c.id)); this._items[c.id] = c; return c }; dhtmlXRibbon.prototype._changeApiForTab = function(c) { var a; for (a in this._tabOriginalApi) { this._tabOriginalApi[a] = this._tabOriginalApi[a] || c[a]; c[a] = this._tabCustomApi[a] } }; dhtmlXRibbon.prototype._tabOriginalApi = { enable: null, disable: null, close: null }; dhtmlXRibbon.prototype._appendBlocks = function(a, s, e) { var m, g, n, h, o, c, r = []; e = e || null; g = a.length; for (m = 0; m < g; m++) { if (typeof(a[m]) == "object" && a[m].type == "block") { n = this._addBlock(a[m], s); if (a[m].list && (a[m].list instanceof Array)) { h = a[m].list; o = h.length; for (c = 0; c < o; c++) { this._addItem(n.id, null, null, h[c]) } } if (e != null) { n.parentId = e.id } if (n.conf.disable) { this.disable(n.id) } r.push(n.id) } } return r }; dhtmlXRibbon.prototype._addBlock = function(h, g) { var e, a, m, c; m = { conf: { text: "", text_pos: "bottom", type: "block", mode: "cols", disable: false }, type: "block", childIds: [], base: document.createElement("div"), contForItems: document.createElement("div"), contForText: document.createElement("div") }; for (c in h) { if (c == "list" || c == "type" || c == "id") { continue } m.conf[c] = h[c] } if (!h.id) { m.id = dhx4.newId() } else { m.id = h.id } while (this._items[m.id]) { m.id = dhx4.newId() } m.base.className = "dhxrb_block_base"; g.appendChild(m.base); m.contForItems.className = "dhxrb_block_items"; m.contForText.className = "dhxrb_block_label"; m.base.appendChild(m.contForItems); if (m.conf.text) { m.contForText.innerHTML = m.conf.text; if (m.conf.text_pos == "top") { m.base.insertBefore(m.contForText, m.contForItems) } else { m.base.appendChild(m.contForText) } } m.base._dhx_ribbonId = m.id; this._items[m.id] = m; return m }; dhtmlXRibbon.prototype._addItem = function(e, c, o, m) { var h = this._items[e], a, l, r = null, n = this, g; if (m.type != "newLevel" && !this.items[m.type]) { return null } if (m.type == "newLevel") { this._addNewLevel(h) } else { if (h.type == "group") { a = document.createElement("div"); a.className = "dhxrb_in_group"; h.base.appendChild(a) } else { if (m.isbig) { a = document.createElement("div"); a.className = "dhxrb_big_button"; h.contForItems.appendChild(a) } else { l = this._getContainerForSmallItem(h); a = document.createElement("div"); a.className = (h.conf.mode == "rows") ? "dhxrb_in_row" : "dhxrb_3rows_button"; l.appendChild(a) } } } if (a) { this._attachEventForItem(a); g = { icons_path: m.icons_path || this.conf.icons_path, icons_css: this.conf.icons_css, skin: this.conf.skin }; for (var q in m) { g[q] = m[q] } if (!g.id) { g.id = dhx4.newId() } while (this._items[g.id]) { g.id = dhx4.newId() } r = (this.items[g.type] && this.items[g.type].render) ? this.items[g.type].render(a, g) : null } if (r != null) { this._items[r.id] = r; r.parentId = h.id; h.childIds.push(r.id); a._dhx_ribbonId = r.id; if (g.onclick && (typeof(g.onclick) == "function")) { this._eventHandlers[r.id] = this._eventHandlers[r.id] || {}; this._eventHandlers[r.id]["onclick"] = g.onclick } r.callEvent = function() { n.callEvent.apply(n, arguments) }; r._callHandler = function() { n._callHandler.apply(n, arguments) }; if (this.items[g.type] && typeof(this.items[g.type].callAfterInit) == "function") { this.items[g.type].callAfterInit.apply(this, [r]) } } return r }; dhtmlXRibbon.prototype._callHandler = function(c, a) { if (this._eventHandlers[c] && this._eventHandlers[c].onclick) { this._eventHandlers[c].onclick.apply(this, a) } }; dhtmlXRibbon.prototype.items = {}; dhtmlXRibbon.prototype.items.button = { render: function(c, a) { var 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, icons_css: a.icons_css } }; for (g in a) { if (g == "id" || g == "onclick" || g == "type") { continue } h.conf[g] = a[g] } if (h.conf.icons_css == true) { var e = "" } else { var e = "" } c.innerHTML = e + "
" + 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, e) { var a = c.base.childNodes[1]; c.conf.text = e; a.innerHTML = e }, setImage: function(c, a) { c.conf.img = a; if (c.conf.disable == false) { c.base.childNodes[0][c.conf.icons_css ? "className" : "src"] = c.conf.icons_path + c.conf.img } }, setImageDis: function(c, a) { c.conf.imgdis = a; if (c.conf.disable == true) { c.base.childNodes[0][c.conf.icons_css ? "className" : "src"] = c.conf.icons_path + c.conf.imgdis } }, mousedown: function(a, g, c) { return true }, click: function(a, g, c) { if (c.button != 0) { return false } g._callHandler(a.id, [a.id]); a.callEvent("onClick", [a.id]); return false }, disable: function(c) { var e = c.base.childNodes[0], a = c.base.childNodes[1]; if (c.conf.imgdis) { e[c.conf.icons_css ? "className" : "src"] = c.conf.icons_path + c.conf.imgdis; if (/\s?dhxrb_invisible/i.test(e.className)) { e.className = e.className.replace(/\s?dhxrb_invisible/i, "") } } if (!/\s?dhxrb_disable_text_style/i.test(a.className)) { a.className += " dhxrb_disable_text_style" } return true }, enable: function(c) { var e = c.base.childNodes[0], a = c.base.childNodes[1]; if (c.conf.img) { e[c.conf.icons_css ? "className" : "src"] = c.conf.icons_path + c.conf.img } else { if (!/\s?dhxrb_invisible/i.test(e.className)) { e.className += " dhxrb_invisible" } } if (/\s?dhxrb_disable_text_style/i.test(a.className)) { a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, "") } return true } }; dhtmlXRibbon.prototype.items.buttonTwoState = { click: function(a, g, c) { return false }, afterRender: function(a) { if (a.conf.state) { this.setState(a, a.conf.state) } }, mouseover: function(a) { if (!/dhxrb_highlight0/.test(a.base.className)) { a.base.className += " dhxrb_highlight0" } return false }, mouseout: function(a) { if (/dhxrb_highlight0/.test(a.base.className)) { a.base.className = a.base.className.replace(/\s?dhxrb_highlight0/, "") } return false }, mousedown: function(a, g, c) { g._callHandler(a.id, [a.id, !a.conf.state]); this.setState(a, !a.conf.state, true); return false }, mouseup: function(a) { return false }, setState: function(a, c, e) { e = e || false; c = dhx4.s2b(c); if (c) { if (!/dhxrb_highlight1/.test(a.base.className)) { a.base.className += " dhxrb_highlight1" } } else { if (/dhxrb_highlight1/.test(a.base.className)) { a.base.className = a.base.className.replace(/\s?dhxrb_highlight1/, "") } } a.conf.state = c; if (e) { a.callEvent("onStateChange", [a.id, a.conf.state]) } }, getState: function(a) { return (a.conf.state == true) } }; dhtmlXRibbon.prototype.items.buttonSegment = { click: function(a, g, c) { return false }, mousedown: function(a, g, c) { this.setState(a, g, true); return false }, callAfterInit: function(a) { if (a.conf.state || dhtmlXRibbon.prototype.items.buttonSegment._getSelectedNeighbor(a, this) == null) { if (a.conf.state) { a.conf.state = false } dhtmlXRibbon.prototype.items.buttonSegment.setState(a, this, false) } }, afterRender: function() {}, setState: function(a, h, g) { g = g || false; var e = null, c = dhx4.s2b(a.conf.state); if (c == false) { e = this._getSelectedNeighbor(a, h); if (e != null) { this._unSelect(e) } if (!/dhxrb_highlight1/.test(a.base.className)) { a.base.className += " dhxrb_highlight1" } a.conf.state = true; if (g) { h._callHandler(a.id, [a.id, (e ? e.id : null)]); h.callEvent("onStateChange", [a.id, (e ? e.id : null)]) } } }, remove: function(e, m) { var h = dhx4.s2b(e.conf.state), l = null, a = 0, c = m._items[e.parentId], g; if (h) { while (c.childIds[a] && l == null) { g = m._items[c.childIds[a]]; if (g.type == "buttonSegment" && g != e) { l = g } a++ } if (l) { this.setState(l, m) } } }, _unSelect: function(a) { var c = dhx4.s2b(a.conf.state); if (c) { if (/dhxrb_highlight1/.test(a.base.className)) { a.base.className = a.base.className.replace(/\s?dhxrb_highlight1/, "") } a.conf.state = false } }, _getSelectedNeighbor: function(g, n) { var e = n._items[g.parentId], c, a, m, h = null; a = e.childIds.length; for (c = 0; c < a; c++) { m = n._items[e.childIds[c]]; if (m.type == "buttonSegment" && m.conf.state) { h = m; break } } return h } }; dhtmlXRibbon.prototype.items.buttonSelect = { itemCollection: [], _isAttachedEventInWindow: false, afterRender: function(c) { var a = c.base.childNodes[1]; a.innerHTML += " "; c.menu = null; this.itemCollection.push(c); this._attachEventToWindow(); a = null }, setText: function(a, e) { var c = a.base.childNodes[1].lastChild; a.conf.text = e; a.base.childNodes[1].innerHTML = e; a.base.childNodes[1].appendChild(c) }, setOptionText: function(a, e, c) { if (a.menu != null) { a.menu.setItemText(e, c) } else { this._loopThroughItems(a.conf.items, e, c, false) } }, getOptionText: function(a, c) { if (a.menu != null) { return a.menu.getItemText(c) } return this._loopThroughItems(a.conf.items, c, null, true) }, _loopThroughItems: function(a, l, h, g) { for (var e = 0; e < a.length; e++) { if (a[e].id == l) { if (g != true) { a[e].text = h; return true } else { return a[e].text } } if (a[e].items != null) { var c = this._loopThroughItems(a[e].items, l, h, g); if (c != null) { return c } } } return null }, _attachEventToWindow: function() { if (this._isAttachedEventInWindow == false) { if (typeof(window.addEventListener) == "function") { document.body.addEventListener("mousedown", this._hideAllMenus, false) } else { document.body.attachEvent("onmousedown", this._hideAllMenus) } this._isAttachedEventInWindow = true } }, _detachEventFromWindow: function() { if (typeof(window.addEventListener) == "function") { document.body.removeEventListener("mousedown", this._hideAllMenus, false) } else { document.body.detachEvent("onmousedown", this._hideAllMenus) } this._isAttachedEventInWindow = false }, _hideAllMenus: function(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), e = dhx4.absTop(c.base) + c.base.offsetHeight; if (!(c.menu instanceof dhtmlXMenuObject)) { c.menu = new dhtmlXMenuObject({ parent: c.base, icons_path: c.conf.icons_path, context: true, items: c.conf.items, skin: c.conf.skin }); if (c.conf.data) { c.menu.loadStruct(c.conf.data); delete c.conf.data } c.menu.setAutoHideMode(false); c.menu.attachEvent("onHide", function(g) { if (g == null) { dhtmlXRibbon.prototype.items.buttonSelect._doOnHideMenu(c) } }); c.menu.attachEvent("onShow", function(g) { if (g == null) { dhtmlXRibbon.prototype.items.buttonSelect._doOnShowMenu(c) } }); c.menu.attachEvent("onClick", function(g) { c.callEvent("onClick", [g, c.id]) }); c.base.oncontextmenu = function() { return false }; dhtmlXRibbon.prototype.items.buttonSelect.showMenu(c) } else { c.menu.showContextMenu(a, e) } }, hideMenu: function(a) { if (a.menu instanceof dhtmlXMenuObject) { a.menu.hideContextMenu() } }, remove: function(c) { var e, a; if (c.menu instanceof dhtmlXMenuObject) { c.menu.unload(); c.menu = null } c.base.oncontextmenu = null; e = dhtmlXRibbon.prototype._indexOf(dhtmlXRibbon.prototype.items.buttonSelect.itemCollection, c); if (e != -1) { dhtmlXRibbon.prototype.items.buttonSelect.itemCollection.splice(e, 1) } if (dhtmlXRibbon.prototype.items.buttonSelect.itemCollection.length == 0) { this._detachEventFromWindow() } }, setSkin: function(a, c) { if (a.menu instanceof dhtmlXMenuObject) { a.menu.setSkin(c) } }, _doOnHideMenu: function(a) { if (a._skipHiding) { a._skipHiding = false } else { if (/dhxrb_highlight1/.test(a.base.className)) { a.base.className = a.base.className.replace(/\s?dhxrb_highlight1/, "") } } }, _doOnShowMenu: function(a) { if (!/dhxrb_highlight1/.test(a.base.className)) { a.base.className += " dhxrb_highlight1" } } }; dhtmlXRibbon.prototype.items.group = { render: function(c, a) { var e, g; g = { base: c, id: a.id, type: a.type, conf: { disable: false, skin: a.skin }, childIds: [] }; c.className = "dhxrb_group"; for (e in a) { if (e == "id" || e == "onclick" || e == "type") { continue } g.conf[e] = a[e] } return g }, callAfterInit: function(h) { this._detachEventFromItem(h.base); var g, a, m = h.conf.list, n, e, c; a = (m) ? m.length : 0; for (g = 0; g < a; g++) { n = this._addItem(h.id, null, null, m[g]); if (n == null) { continue } e = n.base.childNodes[1]; if (e && !e.innerHTML && !/\s?dhxrb_label_hide/i.test(e.className)) { e.className += " dhxrb_label_hide" } } dhtmlXRibbon.prototype.items.group.normalize(h); if (h.conf.disable) { this.disable(h.id) } m = undefined }, normalize: function(n) { var a = n.base.children; var e = a.length, c = false, o = 0; var g, m; for (var h = 0; h < e; h++) { if (!/dhxrb_separator_group/i.test(a[h].className)) { if (/dhxrb_item_hide/i.test(a[h].className)) { o++; continue } } if ((Math.ceil((h - o) / 2) - Math.floor((h - o) / 2)) == 0) { if (/dhxrb_separator_group/i.test(a[h].className)) { a[h].parentNode.removeChild(a[h]); c = true; break } } else { if (!/dhxrb_separator_group/i.test(a[h].className)) { g = document.createElement("div"); g.className = "dhxrb_separator_groupp"; n.base.insertBefore(g, a[h]); c = true; break } } } if (c) { this.normalize(n) } else { m = n.base.lastChild; if (m && /dhxrb_separator_group/i.test(m.className)) { m.parentNode.removeChild(m) } } }, hideChild: function(c, g) { var a = dhtmlXRibbon.prototype._indexOf(c.base.children, g.base); if (a == 0) { a++ } else { if (a != -1) { a-- } else { return } } var e = c.base.children[a]; if (e && /dhxrb_separator_group/i.test(e.className)) { e.parentNode.removeChild(e) } }, showChild: function(a) { this.normalize(a) } }; dhtmlXRibbon.prototype.items.input = { render: function(c, a) { var e, g; g = { base: c, id: a.id, type: a.type, conf: { text: "", text_pos: (a.isbig) ? "bottom" : "right", img: null, imgdis: null, isbig: false, disable: false, skin: a.skin, value: "" } }; for (e in a) { if (e == "id" || e == "onclick" || e == "type") { continue } g.conf[e] = a[e] } c.innerHTML = "
" + g.conf.text + "
"; if (typeof(this.afterRender) == "function") { this.afterRender(g) } if (g.conf.disable) { this.disable(g) } if (g.conf.width) { this.setWidth(g, g.conf.width) } if (g.conf.value) { this.setValue(g, g.conf.value) } return g }, callAfterInit: function(c) { var a = c.base.childNodes[0]; this._detachEventFromItem(c.base); this._attachEventsToInput(a) }, setText: dhtmlXRibbon.prototype.items.button.setText, getText: dhtmlXRibbon.prototype.items.button.getText, change: function(c) { var a = c.base.childNodes[0]; c.conf.value = a.value }, keydown: function(c, h, g) { if (g.keyCode == 13) { var a = c.base.childNodes[0]; c.conf.value = a.value; h.callEvent("onEnter", [c.id, c.conf.value]) } }, remove: function(c, e) { var a = c.base.childNodes[0]; e._detachEventsFromInput(a) }, getValue: function(c) { var a = c.base.childNodes[0], e; e = a.value; a = undefined; return e }, setValue: function(c, e) { var a = c.base.childNodes[0], e; a.value = e; c.conf.value = e }, setWidth: function(c, e) { var a = c.base.childNodes[0]; a.style.width = parseInt(e) + "px" }, disable: function(e) { var c = e.base.childNodes[0], a = e.base.childNodes[1]; c.disabled = true; if (!/\s?dhxrb_disable_text_style/i.test(a.className)) { a.className += " dhxrb_disable_text_style" } return true }, enable: function(e) { var c = e.base.childNodes[0], a = e.base.childNodes[1]; c.disabled = false; if (/\s?dhxrb_disable_text_style/i.test(a.className)) { a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, "") } return true }, getInput: function(a) { return a.base.childNodes[0] } }; dhtmlXRibbon.prototype.getInput = function(c) { var a = this._items[c]; if (a == null || a.type != "input") { return null } return this.items[a.type].getInput(a) }; dhtmlXRibbon.prototype.items.checkbox = { render: function(c, a) { var e, g; g = { base: c, id: a.id, type: a.type, conf: { text: "", text_pos: (a.isbig) ? "bottom" : "right", disable: false, checked: false } }; for (e in a) { if (e == "id" || e == "onclick" || e == "type") { continue } g.conf[e] = a[e] } c.innerHTML = "
" + g.conf.text + "
"; if (typeof(this.afterRender) == "function") { this.afterRender(g) } if (g.conf.checked) { this.check(g) } return g }, callAfterInit: function(a) { if (a.conf.disable) { this.disable(a.id) } }, setText: dhtmlXRibbon.prototype.items.button.setText, getText: dhtmlXRibbon.prototype.items.button.getText, mousedown: function(a) { return false }, mouseup: function(a) { return false }, click: function(a, g, c) { if (c.button != 0) { return false } if (a.type == "checkbox") { if (a.conf.checked) { this.uncheck(a, true) } else { this.check(a, true) } } }, check: function(a, c) { c = c || false; if (a.type != "checkbox") { return } a.conf.checked = true; if (!/\s?dhxrb_checked/i.test(a.base.className)) { a.base.className += " dhxrb_checked" } if (c) { a.callEvent("onCheck", [a.id, a.conf.checked]) } }, uncheck: function(a, c) { c = c || false; if (a.type != "checkbox") { return } a.conf.checked = false; if (/\s?dhxrb_checked/i.test(a.base.className)) { a.base.className = a.base.className.replace(/\s?dhxrb_checked/i, "") } if (c) { a.callEvent("onCheck", [a.id, a.conf.checked]) } }, isChecked: function(a) { if (a.type != "checkbox") { return false } return (a.conf.checked == true) }, disable: function(a) { return true }, enable: function(a) { return true } }; dhtmlXRibbon.prototype.items.text = { render: function(a, g) { var e = { base: a, id: g.id, type: g.type, conf: { text: "" } }; for (var c in g) { if (c == "id" || c == "type") { continue } e.conf[c] = g[c] } a.innerHTML = "
" + e.conf.text + "
"; if (typeof(this.afterRender) == "function") { this.afterRender(e) } return e }, callAfterInit: function(a) { this._detachEventFromItem(a.base) }, getText: function(a) { return a.conf.text }, setText: function(a, c) { a.conf.text = c; a.base.firstChild.innerHTML = a.conf.text } }; dhtmlXRibbon.prototype.items.buttonCombo = { render: function(a, c) { var e, g, h = {}; g = { base: a, id: c.id, type: c.type, conf: { text: "", text_pos: "right", width: 140, skin: c.skin, callEvent: true, mode: c.comboType, image_path: c.comboImagePath, default_image: c.comboDefaultImage, default_image_dis: c.comboDefaultImageDis } }; for (e in c) { if (e == "id" || e == "onclick" || e == "type") { continue } g.conf[e] = c[e] } for (e in g.conf) { if (e == "text" || e == "text_pos" || e == "disable" || e == "data") { continue } h[e] = g.conf[e] } g.base.className += " dhxrb_buttoncombo_cont"; g.base.innerHTML = "
" + g.conf.text + "
"; h.parent = g.base.firstChild; g.combo = new dhtmlXCombo(h); g.combo.setSkin(h.skin); g.combo.attachEvent("onChange", function(l, m) { g._callHandler(g.id, [l, m]); if (g.conf.callEvent == true) { g.callEvent("onSelectOption", [g.id, l, m]) } g.conf.callEvent = true }); if (g.conf.data) { g.combo.load(g.conf.data); delete g.conf.data } if (typeof(this.afterRender) == "function") { this.afterRender(g) } if (g.conf.disable) { this.disable(g) } return g }, callAfterInit: function(a) { this._detachEventFromItem(a.base) }, disable: function(c) { var a = c.base.lastChild; if (c.combo instanceof dhtmlXCombo) { c.combo.disable() } if (!/\s?dhxrb_disable_text_style/i.test(a.className)) { a.className += " dhxrb_disable_text_style" } return true }, enable: function(c) { var a = c.base.lastChild; if (c.combo instanceof dhtmlXCombo) { c.combo.enable() } if (/\s?dhxrb_disable_text_style/i.test(a.className)) { a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, "") } return true }, remove: function(a) { if (a.combo instanceof dhtmlXCombo) { a.combo.unload(); a.combo = null } }, getValue: function(a) { var c = null; if (a.combo instanceof dhtmlXCombo) { c = a.combo.getSelectedValue() } return c }, setValue: function(a, c, e) { if (a.combo instanceof dhtmlXCombo) { a.conf.callEvent = e; a.combo.setComboValue(c); a.conf.callEvent = true } }, setSkin: function(a, c) { if (a.combo instanceof dhtmlXCombo) { a.combo.setSkin(c) } } }; dhtmlXRibbon.prototype.items.slider = { render: function(a, h) { var e, g, c = {}; g = { base: a, id: h.id, type: h.type, conf: { text: "", text_pos: "right", size: 150, vertical: false, min: 0, max: 99, value: 0, step: 1, margin: 10, disabled: false, enableTooltip: false } }; for (e in h) { if (e == "id" || e == "onclick" || e == "type") { continue } g.conf[e] = h[e] } for (e in g.conf) { if (e == "text" || e == "text_pos" || e == "isbig") { continue } c[e] = g.conf[e] } g.base.innerHTML = "
" + g.conf.text + "
"; c.parent = g.base.firstChild.firstChild; g.slider = new dhtmlXSlider(c); if (typeof(this.afterRender) == "function") { this.afterRender(g) } if (g.conf.disable) { this.disable(g) } g.slider.attachEvent("onChange", function(l) { g._callHandler(g.id, [l]); g.callEvent("onValueChange", [g.id, l]) }); return g }, callAfterInit: function(a) { this._detachEventFromItem(a.base) }, setSkin: function(a, c) { if (a.slider instanceof dhtmlXSlider) { a.slider.setSkin(c) } }, disable: function(c) { var a = c.base.childNodes[1]; if (c.slider instanceof dhtmlXSlider) { c.slider.disable() } if (!/\s?dhxrb_disable_text_style/i.test(a.className)) { a.className += " dhxrb_disable_text_style" } return true }, enable: function(c) { var a = c.base.childNodes[1]; if (c.slider instanceof dhtmlXSlider) { c.slider.enable() } if (/\s?dhxrb_disable_text_style/i.test(a.className)) { a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, "") } return true }, remove: function(a) { if (a.slider instanceof dhtmlXSlider) { a.slider.unload(); a.slider = null } }, getValue: function(a) { var c = null; if (a.slider instanceof dhtmlXSlider) { c = a.slider.getValue() } return c }, setValue: function(a, c) { if (a.slider instanceof dhtmlXSlider) { a.slider.setValue(c) } } }; dhtmlXRibbon.prototype.items._extends = function(e, c) { var a; for (a in c) { e[a] = e[a] || c[a] } return e }; dhtmlXRibbon.prototype._addNewLevel = function(e) { var c, a; if (e.conf.mode == "rows") { c = e.contForItems.lastChild; if (c && /dhxrb_block_rows/i.test(c.className) && (c.childNodes.length < 3)) { a = document.createElement("div"); a.className = "dhxrb_block_row"; c.appendChild(a) } else { c = document.createElement("div"); c.className = "dhxrb_block_rows"; e.contForItems.appendChild(c); a = document.createElement("div"); a.className = "dhxrb_block_row"; c.appendChild(a) } } else { var a = document.createElement("div"); a.className = "dhxrb_3rows_block"; e.contForItems.appendChild(a) } }; dhtmlXRibbon.prototype._attachEventForItem = function(a) { if (typeof(window.addEventListener) == "function") { a.addEventListener("mouseover", this._doOnHighlight0, false); a.addEventListener("mouseout", this._doOffHighlight0, false); a.addEventListener("mousedown", this._doOnHighlight1, false); a.addEventListener("mouseup", this._doOffHighlight1, false); a.addEventListener("click", this._doOnClick, false) } else { a.attachEvent("onmouseover", this._doOnHighlight0); a.attachEvent("onmouseout", this._doOffHighlight0); a.attachEvent("onmousedown", this._doOnHighlight1); a.attachEvent("onmouseup", this._doOffHighlight1); a.attachEvent("onclick", this._doOnClick) } }; dhtmlXRibbon.prototype._detachEventFromItem = function(a) { if (typeof(window.addEventListener) == "function") { a.removeEventListener("mouseover", this._doOnHighlight0, false); a.removeEventListener("mouseout", this._doOffHighlight0, false); a.removeEventListener("mousedown", this._doOnHighlight1, false); a.removeEventListener("mouseup", this._doOffHighlight1, false); a.removeEventListener("click", this._doOnClick, false) } else { a.detachEvent("onmouseover", this._doOnHighlight0); a.detachEvent("onmouseout", this._doOffHighlight0); a.detachEvent("onmousedown", this._doOnHighlight1); a.detachEvent("onmouseup", this._doOffHighlight1); a.detachEvent("onclick", this._doOnClick) } }; dhtmlXRibbon.prototype._attachEventsToInput = function(a) { if (typeof(window.addEventListener) == "function") { a.addEventListener("focus", this._doOnFocus, false); a.addEventListener("blur", this._doOnBlur, false); a.addEventListener("change", this._doOnChange, false); a.addEventListener("keydown", this._doOnKeydown, false) } else { a.attachEvent("onfocus", this._doOnFocus); a.attachEvent("onblur", this._doOnBlur); a.attachEvent("onchange", this._doOnChange); a.attachEvent("onkeydown", this._doOnKeydown) } }; dhtmlXRibbon.prototype._detachEventsFromInput = function(a) { if (typeof(window.addEventListener) == "function") { a.removeEventListener("focus", this._doOnFocus, false); a.removeEventListener("blur", this._doOnBlur, false); a.removeEventListener("change", this._doOnChange, false); a.removeEventListener("keydown", this._doOnKeydown, false) } else { a.detachEvent("onfocus", this._doOnFocus); a.detachEvent("onblur", this._doOnBlur); a.detachEvent("onchange", this._doOnChange); a.detachEvent("onkeydown", this._doOnKeydown) } }; dhtmlXRibbon.prototype._getContainerForSmallItem = function(e) { var c = e.contForItems.lastChild, a = null; if (e.conf.mode == "rows") { if (c && /\s?dhxrb_block_rows/i.test(c.className)) { a = c.lastChild; if (!a) { a = document.createElement("div"); a.className = "dhxrb_block_row"; c.appendChild(a) } } else { c = document.createElement("div"); c.className = "dhxrb_block_rows"; e.contForItems.appendChild(c); a = document.createElement("div"); a.className = "dhxrb_block_row"; c.appendChild(a) } } else { if (c && /dhxrb_3rows_block/i.test(c.className) && (c.childNodes.length < 3)) { a = c } else { a = document.createElement("div"); a.className = "dhxrb_3rows_block"; e.contForItems.appendChild(a) } } return a }; dhtmlXRibbon.prototype._findItemByNode = function(a) { while (a && !a._dhx_ribbonId) { a = a.parentNode } return a }; dhtmlXRibbon.prototype._indexOf = function(a, g) { var e, c; c = a.length; for (e = 0; e < c; e++) { if (a[e] == g) { return e } } return -1 }; dhtmlXRibbon.prototype._removeItem = function(e) { var a, g = -1, c = this._items[e.parentId]; if (e.type == "group") { this._removeGroup(e); return } delete this._items[e.id]; a = e.base.parentNode; this._detachEventFromItem(e.base); a.removeChild(e.base); if (c.type == "block") { if (a != c.contForItems && a.childNodes.length == 0) { a.parentNode.removeChild(a) } } else { if (c.type == "group") { dhtmlXRibbon.prototype.items.group.normalize(c) } } g = this._indexOf(c.childIds, e.id); if (g != -1) { c.childIds.splice(g, 1) } if (this.items[e.type] && (typeof(this.items[e.type].remove) == "function")) { this.items[e.type].remove(e, this) } }; dhtmlXRibbon.prototype._removeGroup = function(g) { var c = [], l, e = this._items[g.parentId], a = g.base.parentNode; for (var h = 0; h < g.childIds.length; h++) { c.push(this._items[g.childIds[h]]) } for (var h = 0; h < c.length; h++) { this._removeItem(c[h]) } delete this._items[g.id]; if (g.base.parentNode) { a.removeChild(g.base) } if (a.childNodes.length == 0) { a.parentNode.removeChild(a) } l = this._indexOf(e.childIds, g.id); if (l != -1) { e.childIds.splice(l, 1) } if (this.items[g.type] && (typeof(this.items[g.type].remove) == "function")) { this.items[g.type].remove(g) } }; dhtmlXRibbon.prototype._removeBlock = function(h) { var a = [], g, c; for (var e = 0; e < h.childIds.length; e++) { a.push(this._items[h.childIds[e]]) } for (var e = 0; e < a.length; e++) { this._removeItem(a[e]) } delete this._items[h.id]; h.base.parentNode.removeChild(h.base); if (h.parentId) { c = this._items[h.parentId] } else { c = this } g = this._indexOf(c.childIds, h.id); if (g != -1) { c.childIds.splice(g, 1) } }; dhtmlXRibbon.prototype._removeTab = function(c, a) { var h = [], g; for (var e = 0; e < c.childIds.length; e++) { h.push(this._items[c.childIds[e]]) } for (var e = 0; e < h.length; e++) { this._removeBlock(h[e]) } delete this._items[c.id]; g = this._indexOf(this.childIds, c.id); if (g != -1) { this.childIds.splice(g, 1) } }; dhtmlXRibbon.prototype._skinCollection = { dhx_skyblue: true, dhx_web: true, dhx_terrace: true, material: true }; dhtmlXRibbon.prototype._setSkinForItems = function(e) { var a, c; for (a in this._items) { c = this._items[a]; c.conf.skin = e; if (dhtmlXRibbon.prototype.items[c.type] && typeof(dhtmlXRibbon.prototype.items[c.type].setSkin) == "function") { dhtmlXRibbon.prototype.items[c.type].setSkin(c, e) } } c = undefined, a = undefined }; dhtmlXRibbon.prototype._setBlockText = function(a, c) { a.conf.text = c; a.contForText.innerHTML = c; if (!c && (c != 0) && a.contForText.parentNode) { a.contForText.parentNode.removeChild(a.contForText) } else { if (!a.contForText.parentNode) { if (a.conf.text_pos == "top") { a.base.insertBefore(a.contForText, a.contForItems) } else { a.base.appendChild(a.contForText) } } } }; dhtmlXRibbon.prototype.hide = function(e) { var c = this._items[e]; if (this.items[c.type] && (typeof(this.items[c.type].hide) == "function")) { if (this.items[c.type].hide(c) != true) { return } } if (c.type == "tab") { return } else { if (!/\s?dhxrb_item_hide/i.test(c.base.className)) { c.base.className += " dhxrb_item_hide" } } var a = this._items[c.parentId]; if (a && this.items[a.type] && (typeof(this.items[a.type].hideChild) == "function")) { this.items[a.type].hideChild(a, c) } }; dhtmlXRibbon.prototype.show = function(e) { var c = this._items[e]; if (this.items[c.type] && (typeof(this.items[c.type].show) == "function")) { if (this.items[c.type].show(c) != true) { return } } if (c.type == "tab") { return } else { if (/\s?dhxrb_item_hide/i.test(c.base.className)) { c.base.className = c.base.className.replace(/\s?dhxrb_item_hide/i, "") } } var a = this._items[c.parentId]; if (a && this.items[a.type] && (typeof(this.items[a.type].showChild) == "function")) { this.items[a.type].showChild(a, c) } }; dhtmlXRibbon.prototype.check = function(e, c) { c = dhx4.s2b(c); var a = this._items[e]; if (a && !a.conf.checked && typeof(this.items[a.type].check) == "function") { this.items[a.type].check(a); if (c) { this.callEvent("onCheck", [a.id, a.conf.checked]) } } }; dhtmlXRibbon.prototype.uncheck = function(e, c) { c = dhx4.s2b(c); var a = this._items[e]; if (a && a.conf.checked && typeof(this.items[a.type].uncheck) == "function") { this.items[a.type].uncheck(a); if (c) { this.callEvent("onCheck", [a.id, a.conf.checked]) } } }; dhtmlXRibbon.prototype.isChecked = function(c) { var a = this._items[c]; if (a && typeof(this.items[a.type].isChecked) == "function") { return this.items[a.type].isChecked(a) } }; dhtmlXRibbon.prototype.disable = function(g, a) { var c = this._items[g]; if (this.items[c.type] && (typeof(this.items[c.type].disable) == "function")) { if (this.items[c.type].disable(c) != true) { return } } if (c.type == "tab") { return } else { if (c.type == "block" || c.type == "group") { for (var e = 0; e < c.childIds.length; e++) { this.disable(c.childIds[e]) } } } if (!/\s?dhxrb_item_disable/i.test(c.base.className)) { c.base.className += " dhxrb_item_disable" } if (c.base.className.match(/dhxrb_highlight/gi) != null) { if (c.type == "buttonTwoState") { c.base.className = c.base.className.replace(/\s*dhxrb_highlight0/gi, "") } else { c.base.className = c.base.className.replace(/\s*dhxrb_highlight\d/gi, "") } } c.conf.disable = true }; dhtmlXRibbon.prototype.enable = function(g, a) { var c = this._items[g]; if (this.items[c.type] && (typeof(this.items[c.type].enable) == "function")) { if (this.items[c.type].enable(c) != true) { return } } if (c.type == "tab") { return } else { if (c.type == "block" || c.type == "group") { for (var e = 0; e < c.childIds.length; e++) { this.enable(c.childIds[e]) } } } if (/\s?dhxrb_item_disable/i.test(c.base.className)) { c.base.className = c.base.className.replace(/\s?dhxrb_item_disable/i, "") } c.conf.disable = false }; dhtmlXRibbon.prototype.isEnabled = function(c) { var a = this._items[c]; if (this.items[a.type] && typeof(this.items[a.type].isEnabled) == "function") { return this.items[a.type].isEnabled(a) } if (a.type == "tab") { return } else { return a.conf.disable != true } }; dhtmlXRibbon.prototype.isVisible = function(c) { var a = this._items[c]; if (this.items[a.type] && (typeof(this.items[a.type].isVisible) == "function")) { return this.items[a.type].isVisible(a) } if (a.type == "tab") { return } else { return !/\s?dhxrb_item_hide/i.test(a.base.className) } }; dhtmlXRibbon.prototype.setItemState = function(g, c, e) { c = dhx4.s2b(c); e = dhx4.s2b(e); var a = this._items[g]; if (a && (typeof(this.items[a.type].setState) == "function")) { switch (a.type) { case "buttonSegment": this.items[a.type].setState(a, this, e); break; default: this.items[a.type].setState(a, c, e) } } }; dhtmlXRibbon.prototype.getItemState = function(c) { var a = this._items[c]; if (a && (typeof(this.items[a.type].getState) == "function")) { switch (a.type) { case "buttonTwoState": case "buttonSegment": return this.items[a.type].getState(a); break } } return null }; dhtmlXRibbon.prototype.setIconPath = function(a) { this.conf.icons_path = a }; dhtmlXRibbon.prototype.setIconset = function(a) { this.conf.icons_css = (a == "awesome") }; dhtmlXRibbon.prototype.removeItem = function(c) { var a = this._items[c]; if (a == null) { return } switch (a.type) { case "tab": break; case "block": this._removeBlock(a); break; case "group": this._removeGroup(a); break; default: this._removeItem(a) } }; dhtmlXRibbon.prototype.setSkin = function(h) { h = (typeof(h) == "string") ? h.toLowerCase() : ""; if (this._skinCollection[h] != true) { return } var e, c = -1, a, g = "dhtmlxribbon"; e = this._base.className.match(/\S\w+/ig); if (e instanceof Array) { for (a in this._skinCollection) { if (c == -1) { c = this._indexOf(e, g + "_" + a) } else { break } } c = (c == -1) ? e.length : c } else { e = []; c = 0 } e[c] = g + "_" + h; this._base.className = e.join(" "); this.conf.skin = h; if (this._tabbar != null) { this._tabbar.setSkin(h) } this._setSkinForItems(h) }; dhtmlXRibbon.prototype.tabs = function(a) { if (this._tabbar instanceof dhtmlXTabBar) { return this._tabbar.tabs(a) } else { return undefined } }; dhtmlXRibbon.prototype.getItemType = function(c) { var a = this._items[c]; if (a) { return a.type } else { return undefined } }; dhtmlXRibbon.prototype.getValue = function(e) { var a = this._items[e], c = undefined; if (a && this.items[a.type] && typeof(this.items[a.type].getValue) == "function") { c = this.items[a.type].getValue(a) } return c }; dhtmlXRibbon.prototype.setValue = function(g, c, e) { var a = this._items[g]; e = (e === false ? false : true); if (a && this.items[a.type] && typeof(this.items[a.type].setValue) == "function") { this.items[a.type].setValue(a, c, e) } }; dhtmlXRibbon.prototype.getItemText = function(c) { var a = this._items[c]; if (!a) { return null } else { if (a.type == "tab") { return this.tabs(a.id).getText() } else { if (a.type == "block") { return this.items.button.getText(a) } else { if (this.items[a.type] && typeof(this.items[a.type].getText) == "function") { return this.items[a.type].getText(a) } else { return null } } } } }; dhtmlXRibbon.prototype.setItemText = function(e, c) { var a = this._items[e]; if (!a) { return } else { if (a.type == "tab") { this.tabs(a.id).setText(c) } else { if (a.type == "block") { this._setBlockText(a, c) } else { if (this.items[a.type] && typeof(this.items[a.type].setText) == "function") { this.items[a.type].setText(a, c) } } } } }; dhtmlXRibbon.prototype.setItemOptionText = function(g, e, c) { var a = this._items[g]; if (a.type == "buttonSelect") { this.items[a.type].setOptionText(a, e, c) } }; dhtmlXRibbon.prototype.getItemOptionText = function(e, c) { var a = this._items[e]; if (a.type == "buttonSelect") { return this.items[a.type].getOptionText(a, c) } return null }; dhtmlXRibbon.prototype.setItemImage = function(e, a) { var c = this._items[e]; if (c != null && this.items[c.type] != null && typeof(this.items[c.type].setImage) == "function") { this.items[c.type].setImage(c, a) } }; dhtmlXRibbon.prototype.setItemImageDis = function(e, a) { var c = this._items[e]; if (c != null && this.items[c.type] != null && typeof(this.items[c.type].setImageDis) == "function") { this.items[c.type].setImageDis(c, a) } }; dhtmlXRibbon.prototype.getCombo = function(c) { var a = this._items[c]; if (a != null && a.type == "buttonCombo") { return a.combo } return null }; (function() { var a = dhtmlXRibbon.prototype.items; a.buttonTwoState = a._extends(a.buttonTwoState, a.button); a.buttonSelect = a._extends(a.buttonSelect, a.buttonTwoState); a.buttonSegment = a._extends(a.buttonSegment, a.buttonTwoState) })(); if (typeof(window.dhtmlXCellObject) != "undefined") { dhtmlXCellObject.prototype._createNode_ribbon = function(h, c, g, a, e) { if (typeof(e) != "undefined") { h = e } else { h = document.createElement("DIV"); h.className = "dhx_cell_ribbon_" + (this.conf.borders ? "def" : "no_borders"); h.appendChild(document.createElement("DIV")) } this.cell.insertBefore(h, this.cell.childNodes[this.conf.idx.cont]); this.conf.ofs_nodes.t.ribbon = true; this._updateIdx(); this._adjustCont(this._idd); return h }; dhtmlXCellObject.prototype.attachRibbon = function(a) { if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) { return } this.callEvent("_onBeforeContentAttach", ["ribbon"]); if (typeof(a) == "undefined") { a = {} } if (typeof(a.skin) == "undefined") { a.skin = this.conf.skin } a.parent = this._attachObject("ribbon").firstChild; this.dataNodes.ribbon = new dhtmlXRibbon(a); var c = this; this.dataNodes.ribbon.attachEvent("_onHeightChanged", function() { c._adjustCont(c._idd) }); this._adjustCont(); a.parent = null; a = null; this.callEvent("_onContentAttach", []); return this.dataNodes.ribbon }; dhtmlXCellObject.prototype.detachRibbon = function() { if (this.dataNodes.ribbon == null) { return } if (typeof(this.dataNodes.ribbon.unload) == "function") { this.dataNodes.ribbon.unload() } this.dataNodes.ribbon = null; delete this.dataNodes.ribbon; this._detachObject("ribbon") }; dhtmlXCellObject.prototype.showRibbon = function() { this._mtbShowHide("ribbon", "") }; dhtmlXCellObject.prototype.hideRibbon = function() { this._mtbShowHide("ribbon", "none") }; dhtmlXCellObject.prototype.getAttachedRibbon = function() { return this.dataNodes.ribbon } } function dhtmlXToolbarObject(c, e) { var a = this; this.conf = { skin: (e || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxtoolbar") || "material"), align: "left", align_autostart: "left", icons_path: "", icons_css: false, iconSize: 18, sel_ofs_x: 0, sel_ofs_y: 0, xml_autoload: null, items_autoload: null, cssShadow: (dhx4.isIE6 || dhx4.isIE7 || dhx4.isIE8 ? "" : " dhx_toolbar_shadow") }; 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.iconset != null) { this.conf.icons_css = (c.iconset == "awesome") } if (c.json != null) { this.conf.json_autoload = c.json } if (c.xml != null) { this.conf.xml_autoload = c.xml } if (c.onload != null) { this.conf.onload_autoload = c.onload } if (c.onclick != null || c.onClick != null) { this.conf.auto_onclick = (c.onclick || c.onClick) } if (c.items != null) { this.conf.items_autoload = c.items } if (c.skin != null) { this.conf.skin = c.skin } if (c.align != null) { this.conf.align_autostart = c.align } c = c.parent } this.cont = (typeof(c) != "object") ? document.getElementById(c) : c; while (this.cont.childNodes.length > 0) { this.cont.removeChild(this.cont.childNodes[0]) } c = null; this.cont.dir = "ltr"; this.base = document.createElement("DIV"); this.base.className = "dhxtoolbar_float_left"; this.cont.appendChild(this.base); this.cont.ontouchstart = function(g) { g = g || event; if ((String(g.target.tagName || "").toLowerCase() == "input")) { return true } if (g.preventDefault) { g.preventDefault() } else { g.returnValue = false } g.cancelBubble = true; return false }; this.setSkin(this.conf.skin); this.objPull = {}; this.anyUsed = null; this._genStr = function(g) { var h = "dhxId_"; var m = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for (var l = 0; l < g; l++) { h += m.charAt(Math.round(Math.random() * (m.length - 1))) } return h }; this.rootTypes = new Array("button", "buttonSelect", "buttonTwoState", "separator", "label", "slider", "text", "buttonInput"); this.idPrefix = this._genStr(12); window.dhx4._enableDataLoading(this, "_initObj", "_xmlToJson", "toolbar", { struct: true }); window.dhx4._eventable(this); this._getObj = function(m, g) { var h = null; for (var l = 0; l < m.childNodes.length; l++) { if (m.childNodes[l].tagName != null) { if (String(m.childNodes[l].tagName).toLowerCase() == String(g).toLowerCase()) { h = m.childNodes[l] } } } return h }; this._addImgObj = function(h) { var g = document.createElement(this.conf.icons_css == true ? "I" : "IMG"); if (h.childNodes.length > 0) { h.insertBefore(g, h.childNodes[0]) } else { h.appendChild(g) } return g }; this._setItemImage = function(m, h, g) { if (g == true) { m.imgEn = h } else { m.imgDis = h } if ((!m.state && g == true) || (m.state && g == false)) { return } if (this.conf.icons_css == true) { var l = this._getObj(m.obj, "i"); if (l == null) { l = this._addImgObj(m.obj) } l.className = this.conf.icons_path + h } else { var l = this._getObj(m.obj, "img"); if (l == null) { l = this._addImgObj(m.obj) } l.src = this.conf.icons_path + h } }; this._clearItemImage = function(l, g) { if (g == true) { l.imgEn = "" } else { l.imgDis = "" } if ((!l.state && g == true) || (l.state && g == false)) { return } var h = this._getObj(l.obj, (this.conf.icons_css ? "i" : "img")); if (h != null) { h.parentNode.removeChild(h) } }; this._setItemText = function(g, l) { var h = this._getObj(g.obj, "div"); if (l == null || l.length == 0) { if (h != null) { h.parentNode.removeChild(h) } return } if (h == null) { h = document.createElement("DIV"); h.className = "dhxtoolbar_text"; g.obj.appendChild(h) } h.innerHTML = l }; this._getItemText = function(g) { var h = this._getObj(g.obj, "div"); if (h != null) { return h.innerHTML } return "" }; this._enableItem = function(h) { if (h.state) { return } h.state = true; if (this.objPull[h.id]["type"] == "buttonTwoState" && this.objPull[h.id]["obj"]["pressed"] == true) { h.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres"; h.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over" } else { h.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; h.obj.renderAs = h.obj.className } if (h.arw) { h.arw.className = String(h.obj.className).replace("btn", "arw") } var g = this._getObj(h.obj, (this.conf.icons_css ? "i" : "img")); if (h.imgEn != "") { if (g == null) { g = this._addImgObj(h.obj) } g[this.conf.icons_css ? "className" : "src"] = this.conf.icons_path + h.imgEn } else { if (g != null) { g.parentNode.removeChild(g) } } }; this._disableItem = function(h) { if (!h.state) { return } h.state = false; h.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.objPull[h.id]["type"] == "buttonTwoState" && h.obj.pressed ? "pres_" : "") + "dis"; h.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; if (h.arw) { h.arw.className = String(h.obj.className).replace("btn", "arw") } var g = this._getObj(h.obj, (this.conf.icons_css ? "i" : "img")); if (h.imgDis != "") { if (g == null) { g = this._addImgObj(h.obj) } g[this.conf.icons_css ? "className" : "src"] = this.conf.icons_path + h.imgDis } else { if (g != null) { g.parentNode.removeChild(g) } } if (h.polygon != null) { if (h.polygon.style.display != "none") { window.dhx4.zim.clear(h.polygon._idd); h.polygon.style.display = "none"; if (h.polygon._ie6cover) { h.polygon._ie6cover.style.display = "none" } if (this.conf.skin == "dhx_terrace") { this._improveTerraceButtonSelect(h.id, true) } this.callEvent("onButtonSelectHide", [h.obj.idd]) } } this.anyUsed = null }; this.clearAll = function() { for (var g in this.objPull) { this._removeItem(String(g).replace(this.idPrefix, "")) } this._spacer = null }; this._doOnClick = function(g) { if (a && a.forEachItem) { a.forEachItem(function(l) { if (a.objPull[a.idPrefix + l].type == "buttonSelect") { var h = a.objPull[a.idPrefix + l]; if (h.arw._skip === true) { h.arw._skip = false } else { if (h.polygon.style.display != "none") { h.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def"; h.obj.className = h.obj.renderAs; h.arw.className = String(h.obj.renderAs).replace("btn", "arw"); a.anyUsed = null; a.conf.touch_id = null; window.dhx4.zim.clear(h.polygon._idd); h.polygon.style.display = "none"; if (h.polygon._ie6cover) { h.polygon._ie6cover.style.display = "none" } if (a.conf.skin == "dhx_terrace") { a._improveTerraceButtonSelect(h.id, true) } a.callEvent("onButtonSelectHide", [h.obj.idd]) } } } }) } }; if (typeof(window.addEventListener) != "undefined") { window.addEventListener("mousedown", this._doOnClick, false); window.addEventListener("touchstart", this._doOnClick, false) } else { document.body.attachEvent("onmousedown", this._doOnClick) } if (this.conf.icons_size_autoload != null) { this.setIconSize(this.conf.icons_size_autoload); this.conf.icons_size_autoload = null } if (this.conf.items_autoload != null) { this.loadStruct(this.conf.items_autoload, this.conf.onload_autoload); this.conf.items_autoload = null } else { if (this.conf.json_autoload != null) { this.loadStruct(this.conf.json_autoload, this.conf.onload_autoload); this.conf.json_autoload = null } else { if (this.conf.xml_autoload != null) { this.loadStruct(this.conf.xml_autoload, this.conf.onload_autoload); this.conf.xml_autoload = null } } } if (this.conf.align_autostart != this.conf.align) { this.setAlign(this.conf.align_autostart); this.conf.align_autostart = null } if (typeof(this.conf.auto_onclick) == "function") { this.attachEvent("onClick", this.conf.auto_onclick) } else { if (typeof(this.conf.auto_onclick) == "string" && typeof(window[this.conf.auto_onclick]) == "function") { this.attachEvent("onClick", window[this.conf.auto_onclick]) } } return this } dhtmlXToolbarObject.prototype.addSpacer = function(e) { var c = this.idPrefix + e; if (this._spacer != null) { if (this._spacer.idd == e) { return } if (this._spacer == this.objPull[c].obj.parentNode) { var a = true; while (a) { var m = this._spacer.childNodes[0].idd; this.base.appendChild(this._spacer.childNodes[0]); if (m == e || this._spacer.childNodes.length == 0) { if (this.objPull[c].arw != null) { this.base.appendChild(this.objPull[c].arw) } a = false } } this._spacer.idd = e; this._fixSpacer(); return } if (this.base == this.objPull[c].obj.parentNode) { var a = true; var l = (this.objPull[c].arw != null); while (a) { var g = this.base.childNodes.length - 1; if (l == true) { if (this.base.childNodes[g] == this.objPull[c].arw) { a = false } } if (this.base.childNodes[g].idd == e) { a = false } if (a) { if (this._spacer.childNodes.length > 0) { this._spacer.insertBefore(this.base.childNodes[g], this._spacer.childNodes[0]) } else { this._spacer.appendChild(this.base.childNodes[g]) } } } this._spacer.idd = e; this._fixSpacer(); return } } else { var h = null; for (var g = 0; g < this.base.childNodes.length; g++) { if (this.base.childNodes[g] == this.objPull[this.idPrefix + e].obj) { h = g; if (this.objPull[this.idPrefix + e].arw != null) { h = g + 1 } } } if (h != null) { this._spacer = document.createElement("DIV"); this._spacer.className = (this.conf.align == "right" ? " dhxtoolbar_float_left" : " dhxtoolbar_float_right"); this._spacer.dir = "ltr"; this._spacer.idd = e; while (this.base.childNodes.length > h + 1) { this._spacer.appendChild(this.base.childNodes[h + 1]) } this.cont.appendChild(this._spacer); this._fixSpacer() } } if (this.conf.skin == "dhx_terrace") { this._improveTerraceSkin() } }; dhtmlXToolbarObject.prototype.removeSpacer = function() { if (!this._spacer) { return } while (this._spacer.childNodes.length > 0) { this.base.appendChild(this._spacer.childNodes[0]) } this._spacer.parentNode.removeChild(this._spacer); this._spacer = null; if (this.conf.skin == "dhx_terrace") { this._improveTerraceSkin() } }; dhtmlXToolbarObject.prototype._fixSpacer = function() { if (typeof(window.addEventListener) == "undefined" && this._spacer != null) { this._spacer.style.borderLeft = "1px solid #a4bed4"; var a = this._spacer; window.setTimeout(function() { a.style.borderLeft = "0px solid #a4bed4"; a = null }, 1) } }; dhtmlXToolbarObject.prototype.getType = function(e) { var g = this.getParentId(e); if (g != null) { var c = null; var a = this.objPull[this.idPrefix + g]._listOptions[e]; if (a != null) { if (a.sep != null) { c = "buttonSelectSeparator" } else { c = "buttonSelectButton" } } return c } else { if (this.objPull[this.idPrefix + e] == null) { return null } return this.objPull[this.idPrefix + e]["type"] } }; dhtmlXToolbarObject.prototype.getTypeExt = function(c) { var a = this.getType(c); if (a == "buttonSelectButton" || a == "buttonSelectSeparator") { if (a == "buttonSelectButton") { a = "button" } else { a = "separator" } return a } return null }; dhtmlXToolbarObject.prototype.inArray = function(e, c) { for (var a = 0; a < e.length; a++) { if (e[a] == c) { return true } } return false }; dhtmlXToolbarObject.prototype.getParentId = function(g) { var h = null; for (var e in this.objPull) { if (this.objPull[e]._listOptions) { for (var c in this.objPull[e]._listOptions) { if (c == g) { h = String(e).replace(this.idPrefix, "") } } } } return h }; dhtmlXToolbarObject.prototype._addItem = function(a, c) { if (typeof(a.text) == "string") { a.text = window.dhx4.trim(a.text); if (a.text.length == 0) { a.text = null } } this._addItemToStorage(a, c); if (this.conf.skin == "dhx_terrace") { this._improveTerraceSkin() } }; dhtmlXToolbarObject.prototype.addButton = function(h, g, c, a, e) { this._addItem({ id: h, type: "button", text: c, img: a, imgdis: e }, g) }; dhtmlXToolbarObject.prototype.addText = function(e, c, a) { this._addItem({ id: e, type: "text", text: a }, c) }; dhtmlXToolbarObject.prototype.addButtonSelect = function(g, n, s, a, c, o, m, w, h, l) { var v = []; for (var e = 0; e < a.length; e++) { var r = {}; if (a[e] instanceof Array) { r.id = a[e][0]; r.type = (a[e][1] == "obj" ? "button" : "separator"); r.text = (a[e][2] || null); r.img = (a[e][3] || null) } else { if (a[e] instanceof Object && a[e] != null && typeof(a[e].id) != "undefined" && typeof(a[e].type) != "undefined") { r.id = a[e].id; r.type = (a[e].type == "obj" ? "button" : "separator"); r.text = a[e].text; r.img = a[e].img } } v.push(r) } this._addItem({ id: g, type: "buttonSelect", text: s, img: c, imgdis: o, renderSelect: m, openAll: w, options: v, maxOpen: h, mode: l }, n) }; dhtmlXToolbarObject.prototype.addButtonTwoState = function(h, g, c, a, e) { this._addItem({ id: h, type: "buttonTwoState", img: a, imgdis: e, text: c }, g) }; dhtmlXToolbarObject.prototype.addSeparator = function(c, a) { this._addItem({ id: c, type: "separator" }, a) }; dhtmlXToolbarObject.prototype.addSlider = function(c, m, h, g, o, e, l, a, n) { this._addItem({ id: c, type: "slider", length: h, valueMin: g, valueMax: o, valueNow: e, textMin: l, textMax: a, toolTip: n }, m) }; dhtmlXToolbarObject.prototype.addInput = function(g, e, c, a) { this._addItem({ id: g, type: "buttonInput", value: c, width: a }, e) }; dhtmlXToolbarObject.prototype.forEachItem = function(e) { for (var c in this.objPull) { if (this.inArray(this.rootTypes, this.objPull[c]["type"])) { e(this.objPull[c]["id"].replace(this.idPrefix, "")) } } }; (function() { var l = "isVisible,enableItem,disableItem,isEnabled,setItemText,getItemText,setItemToolTip,getItemToolTip,getInput,setItemImage,setItemImageDis,clearItemImage,clearItemImageDis,setItemState,getItemState,setItemToolTipTemplate,getItemToolTipTemplate,setValue,getValue,setMinValue,getMinValue,setMaxValue,getMaxValue,setWidth,getWidth,setMaxOpen".split(","); var e = [false, "", "", false, "", "", "", "", "", "", "", "", "", false, "", "", "", null, "", [null, null], "", [null, null], "", null]; var c = function(m, n) { return function(r, q, o) { r = this.idPrefix + r; if (this.objPull[r][m] != null) { return this.objPull[r][m].call(this.objPull[r], q, o) } else { return n } } }; for (var h = 0; h < l.length; h++) { var a = l[h]; var g = e[h]; dhtmlXToolbarObject.prototype[a] = c(a, g) } })(); dhtmlXToolbarObject.prototype.showItem = function(a) { a = this.idPrefix + a; if (this.objPull[a] != null && this.objPull[a].showItem != null) { this.objPull[a].showItem(); if (this.conf.skin == "dhx_terrace") { this._improveTerraceSkin() } } }; dhtmlXToolbarObject.prototype.hideItem = function(a) { a = this.idPrefix + a; if (this.objPull[a] != null && this.objPull[a].hideItem != null) { this.objPull[a].hideItem(); if (this.conf.skin == "dhx_terrace") { this._improveTerraceSkin() } } }; dhtmlXToolbarObject.prototype.getPosition = function(a) { return this._getPosition(a) }; dhtmlXToolbarObject.prototype._getPosition = function(h, e) { if (this.objPull[this.idPrefix + h] == null) { return null } var g = null; var a = 0; for (var c = 0; c < this.base.childNodes.length; c++) { if (this.base.childNodes[c].idd != null) { if (this.base.childNodes[c].idd == h) { g = a } a++ } } if (!g && this._spacer != null) { for (var c = 0; c < this._spacer.childNodes.length; c++) { if (this._spacer.childNodes[c].idd != null) { if (this._spacer.childNodes[c].idd == h) { g = a } a++ } } } return g }; dhtmlXToolbarObject.prototype.setPosition = function(a, c) { this._setPosition(a, c) }; dhtmlXToolbarObject.prototype._setPosition = function(h, g) { if (this.objPull[this.idPrefix + h] == null) { return } var a = null; if (this._spacer) { a = this._spacer.idd; this.removeSpacer() } if (isNaN(g)) { g = this.base.childNodes.length } if (g < 0) { g = 0 } var e = this.objPull[this.idPrefix + h]; this.base.removeChild(e.obj); if (e.arw) { this.base.removeChild(e.arw) } var c = this._getIdByPosition(g, true); if (c[0] == null) { this.base.appendChild(e.obj); if (e.arw) { this.base.appendChild(e.arw) } } else { this.base.insertBefore(e.obj, this.base.childNodes[c[1]]); if (e.arw) { this.base.insertBefore(e.arw, this.base.childNodes[c[1] + 1]) } } if (a != null) { this.addSpacer(a) } }; dhtmlXToolbarObject.prototype._getIdByPosition = function(l, c) { var h = null; var a = 0; var e = 0; for (var g = 0; g < this.base.childNodes.length; g++) { if (this.base.childNodes[g]["idd"] != null && h == null) { if ((a++) == l) { h = this.base.childNodes[g]["idd"] } } if (h == null) { e++ } } e = (h == null ? null : e); return (c == true ? new Array(h, e) : h) }; dhtmlXToolbarObject.prototype.removeItem = function(a) { this._removeItem(a); if (this.conf.skin == "dhx_terrace") { this._improveTerraceSkin() } }; dhtmlXToolbarObject.prototype._removeItem = function(h) { var e = this.getType(h); h = this.idPrefix + h; var g = this.objPull[h]; if ({ button: 1, buttonTwoState: 1 }[e] == 1) { if (window.dhx4.isIE) { g.obj.onselectstart = null } this._evs.clear.apply(g, [g.obj.evs, g.obj]); for (var c in g.obj) { if (typeof(g.obj[c]) == "function") { g.obj[c] = null } } g.obj.parentNode.removeChild(g.obj); g.obj = null; for (var c in g) { g[c] = null } } if (e == "buttonSelect") { for (var c in g._listOptions) { this.removeListOption(h, c) } g._listOptions = null; if (g.polygon._ie6cover) { document.body.removeChild(g.polygon._ie6cover); g.polygon._ie6cover = null } g.p_tbl.removeChild(g.p_tbody); g.polygon.removeChild(g.p_tbl); g.polygon.onselectstart = null; document.body.removeChild(g.polygon); if (window.dhx4.isIE) { g.obj.onselectstart = null; g.arw.onselectstart = null } this._evs.clear.apply(g, [g.obj.evs, g.obj]); this._evs.clear.apply(g, [g.arw.evs, g.arw]); for (var c in g.obj) { if (typeof(g.obj[c]) == "function") { g.obj[c] = null } } g.obj.parentNode.removeChild(g.obj); g.obj = null; for (var c in g.arw) { if (typeof(g.arw[c]) == "function") { g.arw[c] = null } } g.arw.parentNode.removeChild(g.arw); g.arw = null; for (var c in g) { g[c] = null } } if (e == "buttonInput") { g.obj.childNodes[0].onkeydown = null; g.obj.removeChild(g.obj.childNodes[0]); g.obj.w = null; g.obj.idd = null; g.obj.parentNode.removeChild(g.obj); g.obj = null; g.id = null; g.type = null; g.enableItem = null; g.disableItem = null; g.isEnabled = null; g.showItem = null; g.hideItem = null; g.isVisible = null; g.setItemToolTip = null; g.getItemToolTip = null; g.setWidth = null; g.getWidth = null; g.setValue = null; g.getValue = null; g.setItemText = null; g.getItemText = null } if (e == "slider") { if (window.dhx4.isIPad) { document.removeEventListener("touchmove", pen._doOnMouseMoveStart, false); document.removeEventListener("touchend", pen._doOnMouseMoveEnd, false) } else { if (typeof(window.addEventListener) == "function") { window.removeEventListener("mousemove", g.pen._doOnMouseMoveStart, false); window.removeEventListener("mouseup", g.pen._doOnMouseMoveEnd, false) } else { document.body.detachEvent("onmousemove", g.pen._doOnMouseMoveStart); document.body.detachEvent("onmouseup", g.pen._doOnMouseMoveEnd) } } g.pen.allowMove = null; g.pen.initXY = null; g.pen.maxX = null; g.pen.minX = null; g.pen.nowX = null; g.pen.newNowX = null; g.pen.valueMax = null; g.pen.valueMin = null; g.pen.valueNow = null; g.pen._definePos = null; g.pen._detectLimits = null; g.pen._doOnMouseMoveStart = null; g.pen._doOnMouseMoveEnd = null; g.pen.onmousedown = null; g.obj.removeChild(g.pen); g.pen = null; g.label.tip = null; document.body.removeChild(g.label); g.label = null; g.obj.onselectstart = null; g.obj.idd = null; while (g.obj.childNodes.length > 0) { g.obj.removeChild(g.obj.childNodes[0]) } g.obj.parentNode.removeChild(g.obj); g.obj = null; g.id = null; g.type = null; g.state = null; g.enableItem = null; g.disableItem = null; g.isEnabled = null; g.setItemToolTipTemplate = null; g.getItemToolTipTemplate = null; g.setMaxValue = null; g.setMinValue = null; g.getMaxValue = null; g.getMinValue = null; g.setValue = null; g.getValue = null; g.showItem = null; g.hideItem = null; g.isVisible = null } if (e == "separator") { g.obj.onselectstart = null; g.obj.idd = null; g.obj.parentNode.removeChild(g.obj); g.obj = null; g.id = null; g.type = null; g.showItem = null; g.hideItem = null; g.isVisible = null } if (e == "text") { g.obj.onselectstart = null; g.obj.idd = null; g.obj.parentNode.removeChild(g.obj); g.obj = null; g.id = null; g.type = null; g.showItem = null; g.hideItem = null; g.isVisible = null; g.setWidth = null; g.setItemText = null; g.getItemText = null } e = null; g = null; this.objPull[h] = null; delete this.objPull[h] }; (function() { var g = "addListOption,removeListOption,showListOption,hideListOption,isListOptionVisible,enableListOption,disableListOption,isListOptionEnabled,setListOptionPosition,getListOptionPosition,setListOptionText,getListOptionText,setListOptionToolTip,getListOptionToolTip,setListOptionImage,getListOptionImage,clearListOptionImage,forEachListOption,getAllListOptions,setListOptionSelected,getListOptionSelected".split(","); var c = function(h) { return function(r, m, l, q, o, n) { r = this.idPrefix + r; if (this.objPull[r] == null) { return } if (this.objPull[r]["type"] != "buttonSelect") { return } return this.objPull[r][h].call(this.objPull[r], m, l, q, o, n) } }; for (var e = 0; e < g.length; e++) { var a = g[e]; dhtmlXToolbarObject.prototype[a] = c(a) } })(); dhtmlXToolbarObject.prototype._rtlParseBtn = function(c, a) { return c + a }; dhtmlXToolbarObject.prototype._separatorObject = function(a, e, c) { this.id = a.idPrefix + e; this.obj = document.createElement("DIV"); this.obj.className = "dhx_toolbar_sep"; this.obj.style.display = (c.hidden != null ? "none" : ""); this.obj.idd = String(e); this.obj.title = (c.title || ""); this.obj.onselectstart = function(g) { g = g || event; if (g.preventDefault) { g.preventDefault() } else { g.returnValue = false } }; this.obj.ontouchstart = function(g) { g = g || event; if (g.preventDefault) { g.preventDefault() } else { g.returnValue = false } g.cancelBubble = true; return false }; a.base.appendChild(this.obj); this.showItem = function() { this.obj.style.display = "" }; this.hideItem = function() { this.obj.style.display = "none" }; this.isVisible = function() { return (this.obj.style.display == "") }; return this }; dhtmlXToolbarObject.prototype._textObject = function(a, e, c) { this.id = a.idPrefix + e; this.obj = document.createElement("DIV"); this.obj.className = "dhx_toolbar_text"; this.obj.style.display = (c.hidden != null ? "none" : ""); this.obj.idd = String(e); this.obj.title = (c.title || ""); this.obj.onselectstart = function(g) { g = g || event; if (g.preventDefault) { g.preventDefault() } else { g.returnValue = false } }; this.obj.ontouchstart = function(g) { g = g || event; if (g.preventDefault) { g.preventDefault() } else { g.returnValue = false } g.cancelBubble = true; return false }; this.obj.innerHTML = (c.text || ""); a.base.appendChild(this.obj); this.showItem = function() { this.obj.style.display = "" }; this.hideItem = function() { this.obj.style.display = "none" }; this.isVisible = function() { return (this.obj.style.display == "") }; this.setItemText = function(g) { this.obj.innerHTML = g }; this.getItemText = function() { return this.obj.innerHTML }; this.setWidth = function(g) { this.obj.style.width = g + "px" }; this.setItemToolTip = function(g) { this.obj.title = g }; this.getItemToolTip = function() { return this.obj.title }; return this }; dhtmlXToolbarObject.prototype._buttonObject = function(e, h, g) { this.id = e.idPrefix + h; this.state = (g.enabled != null ? false : true); this.imgEn = (g.img || ""); this.imgDis = (g.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 = (g.hidden != null ? "none" : ""); this.obj.allowClick = false; this.obj.extAction = (g.action || null); this.obj.renderAs = this.obj.className; this.obj.idd = String(h); this.obj.title = (g.title || ""); this.obj.pressed = false; var a = (e.conf.icons_css ? "" : ""); this.obj.innerHTML = e._rtlParseBtn((this.img != "" ? a : ""), (g.text != null ? "
" + g.text + "
" : "")); e.base.appendChild(this.obj); if (window.dhx4.isIE) { this.obj.onselectstart = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } return false } } var c = this; this._doOnMouseOver = function(l) { l = l || event; if (c.state == false || c.obj.pressed == true || c.obj.over == true) { return } if (c.obj.className.match(/dhxtoolbar_btn_over/gi) == null) { c.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_over" } c.obj.over = true }; this._doOnMouseOut = function(l) { l = l || event; if (c.state == false) { return } if (c.obj.className.match(/dhxtoolbar_btn_over/gi) != null) { c.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def" } c.obj.over = c.obj.pressed = false }; this._doOnMouseDown = function(l) { l = l || event; if (l.type == "touchstart") { if (l.preventDefault) { l.preventDefault() } l.cancelBubble = true; if (e.conf.touch_id != null && e.conf.touch_id != c.id) { return } e.conf.touch_id = c.id } if (c.state == false) { return } if (c.obj.className.match(/dhxtoolbar_btn_pres/gi) == null) { c.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres" } c.obj.pressed = true }; this._doOnMouseUp = function(l) { l = l || event; if (l.type == "touchend") { if (l.preventDefault) { l.preventDefault() } l.cancelBubble = true; if (e.conf.touch_id == c.id) { e.conf.touch_id = null } } if (c.state == false || c.obj.pressed == false) { return } if (c.obj.className.match(/dhxtoolbar_btn_pres/gi) != null) { c.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (c.obj.over ? "over" : "def") } c.obj.pressed = false; if (c.obj.extAction) { window.setTimeout(function() { try { if (c && c.obj) { window[c.obj.extAction](c.id) } } catch (m) {} }, 1) } e.callEvent("onClick", [c.obj.idd.replace(e.idPrefix, "")]) }; this.obj.evs = { mouseover: "_doOnMouseOver", mouseout: "_doOnMouseOut", mousedown: "_doOnMouseDown", mouseup: "_doOnMouseUp", touchstart: "_doOnMouseDown", touchend: "_doOnMouseUp" }; e._evs.add.apply(this, [this.obj.evs, this.obj]); this.enableItem = function() { e._enableItem(this) }; this.disableItem = function() { e._disableItem(this) }; this.isEnabled = function() { return this.state }; this.showItem = function() { this.obj.style.display = "" }; this.hideItem = function() { this.obj.style.display = "none" }; this.isVisible = function() { return (this.obj.style.display == "") }; this.setItemText = function(l) { e._setItemText(this, l) }; this.getItemText = function() { return e._getItemText(this) }; this.setItemImage = function(l) { e._setItemImage(this, l, true) }; this.clearItemImage = function() { e._clearItemImage(this, true) }; this.setItemImageDis = function(l) { e._setItemImage(this, l, false) }; this.clearItemImageDis = function() { e._clearItemImage(this, false) }; this.setItemToolTip = function(l) { this.obj.title = l }; this.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; var c = (g.conf.icons_css ? "" : ""); this.obj.innerHTML = g._rtlParseBtn((this.img != "" ? c : ""), (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; if (window.dhx4.isIE) { this.arw.onselectstart = this.obj.onselectstart = function(n) { n = n || event; if (n.preventDefault) { n.preventDefault() } else { n.returnValue = false } return false } } this._doOnMouseOver = function(n) { n = n || event; if (a.state == false || a.obj.over == true || g.anyUsed == a.obj.idd) { return } if (a.obj.className.match(/dhxtoolbar_btn_over/gi) == null) { a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_over"; a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_over" } a.obj.over = true }; this._doOnMouseOut = function(n) { n = n || event; if (a.state == false || g.anyUsed == a.obj.idd || g.anyUsed == a.obj.idd) { return } if (a.obj.className.match(/dhxtoolbar_btn_over/gi) != null) { a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_def" } a.obj.over = a.obj.pressed = false }; this._doOnMouseDown = function(o) { o = o || event; if (o.type == "touchstart") { if (o.preventDefault) { o.preventDefault() } o.cancelBubble = true; if (g.conf.touch_id != null && g.conf.touch_id != a.id) { return } g.conf.touch_id = a.id } if (a.state == false) { return } if (g.anyUsed == a.obj.idd) { if (a.obj.over == true) { a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_over"; a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_over" } else { a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_def" } a._hidePoly(true); g.anyUsed = null } else { var n = (o.target || o.srcElement); if (a.openAll == true || n == a.arw || n.parentNode == a.arw) { if (o.type == "touchstart") { a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_over" } a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_pres"; a.arw._skip = true; a._showPoly(true); g.anyUsed = a.obj.idd } else { if (a.obj.className.match(/dhxtoolbar_btn_pres/gi) == null) { a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres"; a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_pres" } a.obj.pressed = true } } }; this._doOnMouseUp = function(o) { o = o || event; if (o.type == "touchend") { if (a.polygon.style.display == "") { return } if (o.preventDefault) { o.preventDefault() } o.cancelBubble = true; if (g.conf.touch_id == a.id) { g.conf.touch_id = null } } if (a.state == false || a.obj.pressed == false) { return } if (a.obj.className.match(/dhxtoolbar_btn_pres/gi) != null) { a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (a.obj.over ? "over" : "def"); a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_" + (a.obj.over ? "over" : "def") } if (this.extAction) { var n = this; window.setTimeout(function() { try { window[n.extAction](m) } catch (q) {} n = null }, 1) } g.callEvent("onClick", [a.obj.idd.replace(g.idPrefix, "")]) }; this.arw.evs = { mouseover: "_doOnMouseOver", mouseout: "_doOnMouseOut", mousedown: "_doOnMouseDown", touchstart: "_doOnMouseDown" }; g._evs.add.apply(this, [this.arw.evs, this.arw]); this.obj.evs = { mouseover: "_doOnMouseOver", mouseout: "_doOnMouseOut", mousedown: "_doOnMouseDown", mouseup: "_doOnMouseUp", touchstart: "_doOnMouseDown", touchend: "_doOnMouseUp" }; g._evs.add.apply(this, [this.obj.evs, this.obj]); this._showPoly = function(w) { if (g.anyUsed != null) { if (g.objPull[g.idPrefix + g.anyUsed].type == "buttonSelect") { var v = g.objPull[g.idPrefix + g.anyUsed]; if (v.polygon.style.display != "none") { v.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; v.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_def"; v.obj.over = false; window.dhx4.zim.clear(v.polygon._idd); v.polygon.style.display = "none"; if (v.polygon._ie6cover) { v.polygon._ie6cover.style.display = "none" } if (g.conf.skin == "dhx_terrace") { g._improveTerraceButtonSelect(v.id, true) } g.callEvent("onButtonSelectHide", [v.obj.idd]) } } } this.polygon.style.top = "0px"; this.polygon.style.visibility = "hidden"; this.polygon.style.zIndex = window.dhx4.zim.reserve(this.polygon._idd); this.polygon.style.display = ""; if (g.conf.skin == "dhx_terrace") { g._improveTerraceButtonSelect(this.id, false) } this._fixMaxOpenHeight(this.maxOpen || null); g._autoDetectVisibleArea(); var o = window.dhx4.absTop(this.obj) + this.obj.offsetHeight + g.conf.sel_ofs_y; var s = this.polygon.offsetHeight; var r = Math.floor((g.tY2 - o) / 22); if (o + s > g.tY2) { o = window.dhx4.absTop(this.obj) - s - g.conf.sel_ofs_y; if (o < 0) { o = 0 } } this.polygon.style.top = o + "px"; if (g.rtl) { this.polygon.style.left = window.dhx4.absLeft(this.obj) + this.obj.offsetWidth - this.polygon.offsetWidth + g.conf.sel_ofs_x + "px" } else { var q = document.body.scrollLeft; var n = q + (window.innerWidth || document.body.clientWidth); var u = window.dhx4.absLeft(this.obj) + g.conf.sel_ofs_x; if (u + this.polygon.offsetWidth > n) { u = window.dhx4.absLeft(this.arw) + this.arw.offsetWidth - this.polygon.offsetWidth } this.polygon.style.left = Math.max(u, 5) + "px" } this.polygon.style.visibility = "visible"; if (this.polygon._ie6cover) { this.polygon._ie6cover.style.left = this.polygon.style.left; this.polygon._ie6cover.style.top = this.polygon.style.top; this.polygon._ie6cover.style.width = this.polygon.offsetWidth + "px"; this.polygon._ie6cover.style.height = this.polygon.offsetHeight + "px"; this.polygon._ie6cover.style.display = "" } if (w) { g.callEvent("onButtonSelectShow", [this.obj.idd]) } }; this._hidePoly = function(n) { window.dhx4.zim.clear(this.polygon._idd); this.polygon.style.display = "none"; if (this.polygon._ie6cover) { this.polygon._ie6cover.style.display = "none" } if (g.conf.skin == "dhx_terrace") { g._improveTerraceButtonSelect(this.id, true) } if (n) { g.callEvent("onButtonSelectHide", [this.obj.idd]) } g.conf.touch_id = null }; 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) { if (g.conf.icons_css == true) { this.obj.td_a.innerHTML = "" } else { 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.onmouseover = function(u) { u = u || event; if (u.type.match(/touch/) != null) { return } if (!this.en || (this._selected && a.renderSelect)) { return } this.className = "tr_btn tr_btn_over" }; this.obj.tr.onmouseout = function(u) { u = u || event; if (u.type.match(/touch/) != null) { return } 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.ontouchstart = this.obj.tr.onmousedown = function(u) { u = u || event; if (this._etype == null) { this._etype = u.type } }; this.obj.tr.onclick = function(v) { v = v || event; v.cancelBubble = true; if (!this.en) { return } a.setListOptionSelected(this.idd.replace(g.idPrefix, "")); a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_def"; a.obj.over = false; if (this._etype != null && this._etype.match(/touch/) == null) { window.dhx4.zim.clear(a.polygon._idd); a.polygon.style.display = "none"; if (a.polygon._ie6cover) { a.polygon._ie6cover.style.display = "none" } } else { var u = a.polygon; window.setTimeout(function() { window.dhx4.zim.clear(u._idd); u.style.display = "none"; u = null }, 500) } this._etype = null; if (g.conf.skin == "dhx_terrace") { g._improveTerraceButtonSelect(a.id, true) } g.anyUsed = null; g.conf.touch_id = null; g.callEvent("onButtonSelectHide", [a.obj.idd]); var w = this.idd.replace(g.idPrefix, ""); if (this.extAction) { try { window[this.extAction](w) } catch (v) {} } g.callEvent("onClick", [w]) }; 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 + g.conf.cssShadow; 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(); this.polygon.ontouchstart = function(n) { n = n || event; n.cancelBubble = true }; this.polygon.ontouchend = function(n) { n = n || event; n.cancelBubble = true }; 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 e = "_" + (l.options[h].type || "") + "ButtonSelectObject"; if (l.options[h].id == null) { l.options[h].id = g._genStr(24) } if (typeof(this[e]) == "function") { new this[e](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; n.tr.ontouchstart = null; n.tr.onmousedown = 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(q, n) { if (!this._isListButton(q)) { return } var o = this._listOptions[q].tr.childNodes[(g.rtl ? 1 : 0)]; o.innerHTML = (g.conf.icons_css ? "" : ""); o = 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][(g.conf.icons_css ? "className" : "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(e, h, g) { this.id = e.idPrefix + h; this.obj = document.createElement("DIV"); this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"; this.obj.style.display = (g.hidden != null ? "none" : ""); this.obj.idd = String(h); this.obj.w = (g.width != null ? g.width : 100); this.obj.title = (g.title != null ? g.title : ""); this.obj.innerHTML = ""; var c = e; var a = this; this.obj.childNodes[0].onkeydown = function(l) { l = l || event; if (l.keyCode == 13) { c.callEvent("onEnter", [a.obj.idd, a.obj.childNodes[0].value]) } else { if (c._valueChangeTimer) { clearTimeout(c._valueChangeTimer) } c._valueChangeTimer = setTimeout(function() { try { c.callEvent("onValueChange", [a.obj.idd, a.obj.childNodes[0].value]) } catch (m) {} }, 250) } }; e.base.appendChild(this.obj); this.enableItem = function() { this.obj.childNodes[0].disabled = false }; this.disableItem = function() { this.obj.childNodes[0].disabled = true }; this.isEnabled = function() { return (!this.obj.childNodes[0].disabled) }; this.showItem = function() { this.obj.style.display = "" }; this.hideItem = function() { this.obj.style.display = "none" }; this.isVisible = function() { return (this.obj.style.display != "none") }; this.setValue = function(l) { this.obj.childNodes[0].value = l }; this.getValue = function() { return this.obj.childNodes[0].value }; this.setWidth = function(l) { this.obj.w = l; this.obj.childNodes[0].style.width = this.obj.w + "px" }; this.getWidth = function() { return this.obj.w }; this.setItemToolTip = function(l) { this.obj.title = l }; this.getItemToolTip = function() { return this.obj.title }; this.getInput = function() { return this.obj.firstChild }; if (typeof(g.enabled) != "undefined" && window.dhx4.s2b(g.enabled) == false) { this.disableItem() } return this }; dhtmlXToolbarObject.prototype._buttonTwoStateObject = function(e, h, g) { this.id = e.idPrefix + h; this.state = (g.enabled != null ? false : true); this.imgEn = (g.img != null ? g.img : ""); this.imgDis = (g.imgdis != null ? g.imgdis : ""); this.img = (this.state ? (this.imgEn != "" ? this.imgEn : "") : (this.imgDis != "" ? this.imgDis : "")); this.obj = document.createElement("DIV"); this.obj.pressed = (g.selected != null); this.obj.extAction = (g.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 = (g.hidden != null ? "none" : ""); this.obj.renderAs = this.obj.className; this.obj.idd = String(h); this.obj.title = (g.title || ""); if (this.obj.pressed) { this.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over" } var a = (e.conf.icons_css ? "" : ""); this.obj.innerHTML = e._rtlParseBtn((this.img != "" ? a : ""), (g.text != null ? "
" + g.text + "
" : "")); e.base.appendChild(this.obj); if (window.dhx4.isIE) { this.obj.onselectstart = function(l) { l = l || event; if (l.preventDefault) { l.preventDefault() } else { l.returnValue = false } return false } } var c = this; this._doOnMouseOver = function(l) { l = l || event; if (c.state == false || c.obj.over == true) { return } if (c.obj.pressed != true && c.obj.className.match(/dhxtoolbar_btn_over/gi) == null) { c.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_over" } c.obj.over = true }; this._doOnMouseOut = function(l) { l = l || event; if (c.state == false) { return } if (c.obj.pressed != true && c.obj.className.match(/dhxtoolbar_btn_over/gi) != null) { c.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def" } c.obj.over = false }; this._doOnMouseDown = function(l) { l = l || event; if (l.type == "touchstart") { if (l.preventDefault) { l.preventDefault() } l.cancelBubble = true; if (e.conf.touch_id != null && e.conf.touch_id != c.id) { return } e.conf.touch_id = c.id } if (c.state == false) { return } if (e.callEvent("onBeforeStateChange", [c.obj.idd.replace(e.idPrefix, ""), c.obj.pressed]) !== true) { return } c.obj.pressed = !c.obj.pressed; c.obj.className = "dhx_toolbar_btn " + (c.obj.pressed == true ? "dhxtoolbar_btn_pres" : (c.obj.over == true ? "dhxtoolbar_btn_over" : "dhxtoolbar_btn_def")); var m = c.obj.idd.replace(e.idPrefix, ""); if (c.obj.extAction) { try { window[c.obj.extAction](idd, c.obj.pressed) } catch (l) {} } e.callEvent("onStateChange", [m, c.obj.pressed]) }; this._doOnMouseUp = function(l) { l = l || event; if (l.type == "touchend") { if (l.preventDefault) { l.preventDefault() } l.cancelBubble = true; if (e.conf.touch_id == c.id) { e.conf.touch_id = null } } }; this.obj.evs = { mouseover: "_doOnMouseOver", mouseout: "_doOnMouseOut", mousedown: "_doOnMouseDown", touchstart: "_doOnMouseDown", touchend: "_doOnMouseUp" }; e._evs.add.apply(this, [this.obj.evs, this.obj]); 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") } else { this.obj.pressed = false; this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis") } if (n == true) { var o = this.obj.idd.replace(e.idPrefix, ""); if (this.obj.extAction) { try { window[this.obj.extAction](o, this.obj.pressed) } catch (m) {} } e.callEvent("onStateChange", [o, this.obj.pressed]) } } }; this.getItemState = function() { return this.obj.pressed }; this.enableItem = function() { e._enableItem(this) }; this.disableItem = function() { e._disableItem(this) }; this.isEnabled = function() { return this.state }; this.showItem = function() { this.obj.style.display = "" }; this.hideItem = function() { this.obj.style.display = "none" }; this.isVisible = function() { return (this.obj.style.display == "") }; this.setItemText = function(l) { e._setItemText(this, l) }; this.getItemText = function() { return e._getItemText(this) }; this.setItemImage = function(l) { e._setItemImage(this, l, true) }; this.clearItemImage = function() { e._clearItemImage(this, true) }; this.setItemImageDis = function(l) { e._setItemImage(this, l, false) }; this.clearItemImageDis = function() { e._clearItemImage(this, false) }; this.setItemToolTip = function(l) { this.obj.title = l }; this.getItemToolTip = function() { return this.obj.title }; return this }; dhtmlXToolbarObject.prototype._sliderObject = function(g, l, h) { this.id = g.idPrefix + l; this.state = (h.enabled != null ? (h.enabled == "true" ? true : false) : true); this.obj = document.createElement("DIV"); this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis"); this.obj.style.display = (h.hidden != null ? "none" : ""); this.obj.onselectstart = function(m) { m = m || event; if (m.preventDefault) { m.preventDefault() } else { m.returnValue = false } }; this.obj.idd = String(l); this.obj.len = (h.length != null ? Number(h.length) : 50); this.obj.innerHTML = "
" + (h.textMin || "") + "
" + (h.textMax || "") + "
"; g.base.appendChild(this.obj); var a = this; this.pen = document.createElement("DIV"); this.pen.className = "dhxtoolbar_sl_pen"; this.obj.appendChild(this.pen); var e = this.pen; this.label = document.createElement("DIV"); this.label.dir = "ltr"; this.label.className = "dhx_toolbar_slider_label_" + g.conf.skin + (g.rtl ? "_rtl" : ""); this.label.style.display = "none"; this.label.tip = (h.toolTip || "%v"); this.label._zi = window.dhx4.newId(); document.body.appendChild(this.label); var c = this.label; this.pen.valueMin = (h.valueMin != null ? Number(h.valueMin) : 0); this.pen.valueMax = (h.valueMax != null ? Number(h.valueMax) : 100); if (this.pen.valueMin > this.pen.valueMax) { this.pen.valueMin = this.pen.valueMax } this.pen.valueNow = (h.valueNow != null ? Number(h.valueNow) : this.pen.valueMax); if (this.pen.valueNow > this.pen.valueMax) { this.pen.valueNow = this.pen.valueMax } if (this.pen.valueNow < this.pen.valueMin) { this.pen.valueNow = this.pen.valueMin } this.pen._detectLimits = function() { this.minX = a.obj.childNodes[1].offsetLeft + 2; this.maxX = a.obj.childNodes[3].offsetLeft - this.offsetWidth + 1 }; this.pen._detectLimits(); this.pen._definePos = function() { this.nowX = Math.round((this.valueNow - this.valueMin) * (this.maxX - this.minX) / (this.valueMax - this.valueMin) + this.minX); this.style.left = this.nowX + "px"; this.newNowX = this.nowX }; this.pen._definePos(); this.pen.initXY = 0; this.pen.allowMove = false; this.pen[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(m) { if (a.state == false) { return } m = m || event; this.initXY = (window.dhx4.isIPad ? m.touches[0].clientX : m.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(n) { n = n || event; if (!e.allowMove) { return } var m = (window.dhx4.isIPad ? n.touches[0].clientX : n.clientX); var o = m - e.initXY; if (m < window.dhx4.absLeft(e) + Math.round(e.offsetWidth / 2) && e.nowX == e.minX) { return } if (m > window.dhx4.absLeft(e) + Math.round(e.offsetWidth / 2) && e.nowX == e.maxX) { return } e.newNowX = e.nowX + o; if (e.newNowX < e.minX) { e.newNowX = e.minX } if (e.newNowX > e.maxX) { e.newNowX = e.maxX } e.nowX = e.newNowX; e.style.left = e.nowX + "px"; e.initXY = m; e.newValueNow = Math.round((e.valueMax - e.valueMin) * (e.newNowX - e.minX) / (e.maxX - e.minX) + e.valueMin); if (c.tip != "") { c.innerHTML = c.tip.replace(/%v/gi, e.newValueNow); c.style.left = Math.round(window.dhx4.absLeft(e) + e.offsetWidth / 2 - c.offsetWidth / 2) + "px"; c.style.top = window.dhx4.absTop(e) - c.offsetHeight - 3 + "px" } n.cancelBubble = true; if (n.preventDefault) { n.preventDefault() } else { n.returnValue = false } return false }; this.pen._doOnMouseMoveEnd = function() { if (!e.allowMove) { return } e.className = "dhxtoolbar_sl_pen"; e.allowMove = false; e.nowX = e.newNowX; e.valueNow = e.newValueNow; if (c.tip != "") { c.style.display = "none"; window.dhx4.zim.clear(c._zi) } g.callEvent("onValueChange", [a.obj.idd.replace(g.idPrefix, ""), e.valueNow]) }; if (window.dhx4.isIPad) { document.addEventListener("touchmove", e._doOnMouseMoveStart, false); document.addEventListener("touchend", e._doOnMouseMoveEnd, false) } else { if (typeof(window.addEventListener) != "undefined") { window.addEventListener("mousemove", e._doOnMouseMoveStart, false); window.addEventListener("mouseup", e._doOnMouseMoveEnd, false) } else { document.body.attachEvent("onmousemove", e._doOnMouseMoveStart); document.body.attachEvent("onmouseup", e._doOnMouseMoveEnd) } } this.enableItem = function() { if (this.state) { return } this.state = true; this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def" }; this.disableItem = function() { if (!this.state) { return } this.state = false; this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_dis" }; this.isEnabled = function() { return this.state }; this.showItem = function() { this.obj.style.display = "" }; this.hideItem = function() { this.obj.style.display = "none" }; this.isVisible = function() { return (this.obj.style.display == "") }; this.setValue = function(m, n) { m = Number(m); if (m < this.pen.valueMin) { m = this.pen.valueMin } if (m > this.pen.valueMax) { m = this.pen.valueMax } this.pen.valueNow = m; this.pen._definePos(); if (n == true) { g.callEvent("onValueChange", [this.obj.idd.replace(g.idPrefix, ""), this.pen.valueNow]) } }; this.getValue = function() { return this.pen.valueNow }; this.setMinValue = function(n, m) { n = Number(n); if (n > this.pen.valueMax) { return } this.obj.childNodes[0].innerHTML = m; this.obj.childNodes[0].style.display = (m.length > 0 ? "" : "none"); this.pen.valueMin = n; if (this.pen.valueNow < this.pen.valueMin) { this.pen.valueNow = this.pen.valueMin } this.pen._detectLimits(); this.pen._definePos() }; this.setMaxValue = function(n, m) { n = Number(n); if (n < this.pen.valueMin) { return } this.obj.childNodes[4].innerHTML = m; this.obj.childNodes[4].style.display = (m.length > 0 ? "" : "none"); this.pen.valueMax = n; if (this.pen.valueNow > this.pen.valueMax) { this.pen.valueNow = this.pen.valueMax } this.pen._detectLimits(); this.pen._definePos() }; this.getMinValue = function() { var m = this.obj.childNodes[0].innerHTML; var n = this.pen.valueMin; return new Array(n, m) }; this.getMaxValue = function() { var m = this.obj.childNodes[4].innerHTML; var n = this.pen.valueMax; return new Array(n, m) }; this.setItemToolTipTemplate = function(m) { this.label.tip = m }; this.getItemToolTipTemplate = function() { return this.label.tip }; return this }; dhtmlXToolbarObject.prototype.unload = function() { if (typeof(window.addEventListener) == "function") { window.removeEventListener("mousedown", this._doOnClick, false); window.removeEventListener("touchstart", 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.setIconset = function(a) { this.conf.icons_css = (a == "awesome") }; dhtmlXToolbarObject.prototype._evs = { add: function(e, g) { for (var c in e) { if (typeof(window.addEventListener) == "function") { g.addEventListener(c, this[e[c]], false) } else { if (c.match(/^touch/) == null) { g.attachEvent("on" + c, this[e[c]]) } } } g = e = null }, clear: function(e, g) { for (var c in e) { if (typeof(window.addEventListener) == "function") { g.removeEventListener(c, this[e[c]], false) } else { if (c.match(/^touch/) == null) { g.detachEvent("on" + c, this[e[c]]) } } } g = e = null } }; 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 x = function(h) { var e = null; for (var r = 0; r < h.childNodes.length; r++) { if (e == null && h.childNodes[r].tagName == "itemText") { e = window.dhx4._xmlNodeValue(h.childNodes[r]); break } } return e }; 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 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 } } D.text = x(A.childNodes[c].childNodes[y]) || D.text; 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 } } } n.text = x(A.childNodes[c]) || n.text; o.push(n) } } x = null } return o }; dhtmlXToolbarObject.prototype._addItemToStorage = function(l, n) { var m = (l.id || this._genStr(24)); var g = (l.type || ""); if (g == "spacer") { this.addSpacer(this._lastId) } else { this._lastId = m } if (g != "" && this["_" + g + "Object"] != null) { if (g == "buttonSelect") { if (l.options != null) { for (var h = 0; h < l.options.length; h++) { if (l.options[h].type == "obj") { l.options[h].type = "button" } if (l.options[h].type == "sep") { l.options[h].type = "separator" } } } } if (g == "slider") { var e = { tip_template: "toolTip", value_min: "valueMin", value_max: "valueMax", value_now: "valueNow", text_min: "textMin", text_max: "textMax" }; for (var c in e) { if (l[e[c]] == null && l[c] != null) { l[e[c]] = l[c] } } } if (g == "buttonInput") { if (l.value == null && l.text != null) { l.value = l.text } } if (g == "buttonTwoState") { if (typeof(l.selected) == "undefined" && typeof(l.pressed) != "undefined" && window.dhx4.s2b(l.pressed)) { l.selected = true } } if (typeof(l.enabled) == "undefined" && typeof(l.disabled) != "undefined" && window.dhx4.s2b(l.disabled)) { l.enabled = false } if (l.imgDis == null && l.img_disabled != null) { l.imgdis = l.img_disabled } if ((typeof(l.openAll) == "undefined" || l.openAll == null) && this.conf.skin == "dhx_terrace") { l.openAll = true } this.objPull[this.idPrefix + m] = new this["_" + g + "Object"](this, m, l); this.objPull[this.idPrefix + m]["type"] = g; this.setPosition(m, n) } if (l.userdata != null) { for (var c in l.userdata) { this.setUserData(m, c, l.userdata[c]) } } if (l.options != null) { for (var h = 0; h < l.options.length; h++) { if (l.options[h].userdata != null) { for (var c in l.options[h].userdata) { this.setListOptionUserData(l.id, l.options[h].id, c, l.options[h].userdata[c]) } } } } }; dhtmlXToolbarObject.prototype.setSkin = function(h, e) { if (e === true) { this.cont.className = this.cont.className.replace(/dhxtoolbar_icons_\d{1,}/, "dhxtoolbar_icons_" + this.conf.iconSize) } else { this.conf.skin = h; if (this.conf.skin == "dhx_skyblue") { this.conf.sel_ofs_y = 1 } if (this.conf.skin == "dhx_web") { this.conf.sel_ofs_y = 1; this.conf.sel_ofs_x = 1 } if (this.conf.skin == "dhx_terrace") { this.conf.sel_ofs_y = -1; this.conf.sel_ofs_x = 0 } if (this.conf.skin == "material") { 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 + this.conf.cssShadow } for (var c in this.objPull) { var g = this.objPull[c]; if (g.type == "slider") { g.pen._detectLimits(); g.pen._definePos(); g.label.className = "dhx_toolbar_slider_label_" + this.conf.skin } if (g.type == "buttonSelect") { g.polygon.className = "dhx_toolbar_poly_" + this.conf.skin + " dhxtoolbar_icons_" + this.conf.iconSize + this.conf.cssShadow } } if (h == "dhx_terrace") { this._improveTerraceSkin() } }; dhtmlXToolbarObject.prototype.setAlign = function(a) { this.conf.align = (a == "right" ? "right" : "left"); this.base.className = (a == "right" ? "dhxtoolbar_float_right" : "dhxtoolbar_float_left"); if (this._spacer) { this._spacer.className = (a == "right" ? " dhxtoolbar_float_left" : " dhxtoolbar_float_right") } }; dhtmlXToolbarObject.prototype.setIconSize = function(a) { this.conf.iconSize = ({ 18: true, 24: true, 32: true, 48: true }[a] ? a : 18); this.setSkin(this.conf.skin, true); this.callEvent("_onIconSizeChange", [this.conf.iconSize]) }; dhtmlXToolbarObject.prototype.setIconsPath = function(a) { this.conf.icons_path = a }; dhtmlXToolbarObject.prototype.setUserData = function(e, a, c) { e = this.idPrefix + e; if (this.objPull[e] != null) { if (this.objPull[e].userData == null) { this.objPull[e].userData = {} } this.objPull[e].userData[a] = c } }; dhtmlXToolbarObject.prototype.getUserData = function(c, a) { c = this.idPrefix + c; if (this.objPull[c] != null && this.objPull[c].userData != null) { return this.objPull[c].userData[a] || null } return null }; dhtmlXToolbarObject.prototype._isListOptionExists = function(a, e) { if (this.objPull[this.idPrefix + a] == null) { return false } var c = this.objPull[this.idPrefix + a]; if (c.type != "buttonSelect") { return false } if (c._listOptions[e] == null) { return false } return true }; dhtmlXToolbarObject.prototype.setListOptionUserData = function(a, h, c, g) { if (!this._isListOptionExists(a, h)) { return } var e = this.objPull[this.idPrefix + a]._listOptions[h]; if (e.userData == null) { e.userData = {} } e.userData[c] = g }; dhtmlXToolbarObject.prototype.getListOptionUserData = function(a, g, c) { if (!this._isListOptionExists(a, g)) { return null } var e = this.objPull[this.idPrefix + a]._listOptions[g]; if (!e.userData) { return null } return (e.userData[c] ? e.userData[c] : null) }; dhtmlXToolbarObject.prototype._improveTerraceSkin = function() { if (this.conf.terrace_radius == null) { this.conf.terrace_radius = "3px" } var g = []; var h = { separator: true, text: true }; var 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(e, c) { var a = this.objPull[e]; if (c == true) { a.obj.style.borderBottomLeftRadius = (a.obj._bl ? this.conf.terrace_radius : "0px"); a.arw.style.borderBottomRightRadius = (a.obj._br ? this.conf.terrace_radius : "0px") } else { a.obj.style.borderBottomLeftRadius = "0px"; a.arw.style.borderBottomRightRadius = "0px" } a = null }; if (typeof(window.dhtmlXCellObject) != "undefined") { dhtmlXCellObject.prototype._createNode_toolbar = function(h, c, g, a, e) { if (typeof(e) != "undefined") { h = e } else { h = document.createElement("DIV"); h.className = "dhx_cell_toolbar_" + (this.conf.borders ? "def" : "no_borders"); h.appendChild(document.createElement("DIV")); h.firstChild.className = "dhx_toolbar_base_18_dhx_skyblue" } this.cell.insertBefore(h, this.cell.childNodes[this.conf.idx.cont]); this.conf.ofs_nodes.t.toolbar = true; this._updateIdx(); return h }; dhtmlXCellObject.prototype.attachToolbar = function(a) { if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) { return } this.callEvent("_onBeforeContentAttach", ["toolbar"]); if (typeof(a) == "undefined") { a = {} } else { if (typeof(a) == "string") { a = { skin: a } } } if (typeof(a.skin) == "undefined") { a.skin = this.conf.skin } a.parent = this._attachObject("toolbar").firstChild; this.dataNodes.toolbar = new dhtmlXToolbarObject(a); this._adjustCont(this._idd); this.dataNodes.toolbar._masterCell = this; this.dataNodes.toolbar.attachEvent("_onIconSizeChange", function() { this._masterCell._adjustCont() }); a.parent = null; a = null; this.callEvent("_onContentAttach", []); return this.dataNodes.toolbar }; dhtmlXCellObject.prototype.detachToolbar = function() { if (this.dataNodes.toolbar == null) { return } this.dataNodes.toolbar._masterCell = null; if (typeof(this.dataNodes.toolbar.unload) == "function") { this.dataNodes.toolbar.unload() } this.dataNodes.toolbar = null; delete this.dataNodes.toolbar; this._detachObject("toolbar") }; dhtmlXCellObject.prototype.showToolbar = function() { this._mtbShowHide("toolbar", "") }; dhtmlXCellObject.prototype.hideToolbar = function() { this._mtbShowHide("toolbar", "none") }; dhtmlXCellObject.prototype.getAttachedToolbar = function() { return this.dataNodes.toolbar } } function dhtmlXEditor(e, g) { var c = this; this.conf = { content: "", contentHTML: "", resizeTM: null, resizeTMTime: 100, roMode: false, toolbar: false, iconsPath: "", evs: ["focus", "blur", "keydown", "keyup", "keypress", "mouseup", "mousedown", "click", "touchend"], iOSfix: (navigator.userAgent.match(/Mobile/gi) != null && navigator.userAgent.match(/iPad/gi) != null && navigator.userAgent.match(/AppleWebKit/gi) != null), extra_css: "", font: { family: "Tahoma", size: "12px", color: "black" } }; this._doOnFocusChanged = null; this._doOnAccess = null; if (typeof(e) == "object" && e != null && e.tagName == null) { g = e.skin; if (e.content != null) { this.conf.content = e.content } if (e.contentHTML != null) { this.conf.contentHTML = e.contentHTML } if (e.iconsPath != null) { this.conf.iconsPath = e.iconsPath } if (e.extraCss != null) { this.conf.extra_css = e.extraCss } if (e.toolbar != null) { this.conf.toolbar = window.dhx4.s2b(e.toolbar) } if (e.onFocusChanged != null) { this._doOnFocusChanged = e.onFocusChanged } if (e.onAccess != null) { this._doOnAccess = e.onAccess } e = e.parent } this.conf.skin = (g || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxeditor") || "material"); if (typeof(e) == "string") { e = document.getElementById(e) } this.base = e; this.base.className += " dhxeditor_" + this.conf.skin; while (this.base.childNodes.length > 0) { this.base.removeChild(this.base.childNodes[0]) } var h = (window.dhx4.isIE ? this.base.currentStyle.position : (window.getComputedStyle != null ? window.getComputedStyle(this.base, null).getPropertyValue("position") : "")); if (!(h == "relative" || h == "absolute")) { this.base.style.position = "relative" } this.cell = new dhtmlXEditorCell(window.dhx4.newId(), this); this.base.appendChild(this.cell.cell); this.cBlock = document.createElement("DIV"); this.cBlock.className = "dhxcont_content_blocker"; this.cBlock.style.display = "none"; this.base.appendChild(this.cBlock); this.editor = document.createElement("IFRAME"); this.editor.className = "dhxeditor_mainiframe"; this.editor.frameBorder = 0; if (window.dhx4.isOpera) { this.editor.scrolling = "yes" } this.setSizes(); var a = this.editor; if (typeof(window.addEventListener) != "undefined") { a.onload = function() { for (var l = 0; l < c.conf.evs.length; l++) { a.contentWindow.addEventListener(c.conf.evs[l], c._ev, false) } } } else { a.onreadystatechange = function(l) { if (typeof(a.readyState) != "undefined" && a.readyState == "complete") { try { for (var m = 0; m < c.conf.evs.length; m++) { a.contentWindow.document.body.attachEvent("on" + c.conf.evs[m], c._ev) } } catch (n) {} } } } this._ev = function(m) { m = m || event; var l = m.type; if (c.conf.iOSfix == true && l == "touchend") { c.editor.contentWindow.focus(); return } c.callEvent("onAccess", [l, m]); if (typeof(c._doOnAccess) == "function") { c._doOnAccess(l, m) } else { if (typeof(c._doOnAccess) == "string" && typeof(window[c._doOnAccess]) == "function") { window[c._doOnAccess](l, m) } } }; 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(n, q) { var m = ""; if (n === true && this.getContent != null) { m = this.getContent() } var l = this.editor.contentWindow.document; l.open("text/html", "replace"); if (window.dhx4.isOpera) { l.write("" + this.conf.extra_css + "") } else { if (window.dhx4.isKHTML) { l.write("" + this.conf.extra_css + "") } else { if (window.dhx4.isIE) { l.write("" + this.conf.extra_css + "") } else { l.write("" + this.conf.extra_css + "") } } } l.close(); if (window.dhx4.isIE) { l.contentEditable = (q !== true) } else { l.designMode = (q !== true ? "On" : "Off") } if (window.dhx4.isFF) { try { l.execCommand("useCSS", false, true) } catch (o) {} } if (n === true && this.setContent != null) { this.setContent(m) } }; 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(n, q) { if (this.conf.roMode === true) { return } if (arguments.length < 2) { q = null } if (window.dhx4.isIE) { this.edWin.focus() } try { var m = this.editor.contentWindow.document; m.execCommand(n, false, q) } catch (o) {} if (window.dhx4.isIE) { this.edWin.focus(); var l = this; window.setTimeout(function() { l.edWin.focus(); l = null }, 1) } }; this.applyBold = function() { this._runCommand("Bold") }; this.applyItalic = function() { this._runCommand("Italic") }; this.applyUnderscore = function() { this._runCommand("Underline") }; this.clearFormatting = function() { this._runCommand("RemoveFormat"); var l = this.getContent(); l = l.replace(/<\/?h\d>/gi, ""); this.setContent(l) }; this._doOnClick = function(n) { var m = n || window.event; var l = m.target || m.srcElement; c._showInfo(l) }; this._doOnMouseDown = function(n) { var m = n || window.event; var l = m.target || m.srcElement; c._showInfo(l) }; this._doOnKeyUp = function(o) { var n = o || window.event; var l = n.keyCode; var m = n.target || n.srcElement; if ({ 37: 1, 38: 1, 39: 1, 40: 1, 13: 1 }[l] == 1) { c._showInfo(m) } }; this._getParentByTag = function(l, n) { n = n.toLowerCase(); var m = l; do { if (n == "" || m.nodeName.toLowerCase() == n) { return m } } while (m = m.parentNode); return l }; this._isStyleProperty = function(m, q, l, o) { q = q.toLowerCase(); var r = m; do { if ((r.nodeName.toLowerCase() == q) && (r.style[l] == o)) { return true } } while (r = r.parentNode); return false }; this._setStyleProperty = function(l, o) { this.style[o] = false; var m = this._getParentByTag(l, o); if (m && (m.tagName.toLowerCase() == o)) { this.style[o] = true } if (o == "del" && this._getParentByTag(l, "strike") && this._getParentByTag(l, "strike").tagName.toLowerCase() == "strike") { this.style.del = true } }; this._showInfo = function(m) { var m = (this._getSelectionBounds().end) ? this._getSelectionBounds().end : m; if (!m || !this._setStyleProperty) { return } try { if (this.edWin.getComputedStyle) { var l = this.edWin.getComputedStyle(m, null); var n = ((l.getPropertyValue("font-weight") == 401) ? 700 : l.getPropertyValue("font-weight")); this.style = { fontStyle: l.getPropertyValue("font-style"), fontSize: l.getPropertyValue("font-size"), textDecoration: l.getPropertyValue("text-decoration"), fontWeight: n, fontFamily: l.getPropertyValue("font-family"), textAlign: l.getPropertyValue("text-align") }; if (window.dhx4.isKHTML) { this.style.fontStyle = l.getPropertyValue("font-style"); this.style.vAlign = l.getPropertyValue("vertical-align"); this.style.del = this._isStyleProperty(m, "span", "textDecoration", "line-through"); this.style.u = this._isStyleProperty(m, "span", "textDecoration", "underline") } } else { var l = m.currentStyle; this.style = { fontStyle: l.fontStyle, fontSize: l.fontSize, textDecoration: l.textDecoration, fontWeight: l.fontWeight, fontFamily: l.fontFamily, textAlign: l.textAlign } } this._setStyleProperty(m, "h1"); this._setStyleProperty(m, "h2"); this._setStyleProperty(m, "h3"); this._setStyleProperty(m, "h4"); if (!window.dhx4.isKHTML) { this._setStyleProperty(m, "del"); this._setStyleProperty(m, "sub"); this._setStyleProperty(m, "sup"); this._setStyleProperty(m, "u") } this.callEvent("onFocusChanged", [this.style, l]) } catch (o) { return null } }; this._getSelectionBounds = function() { var q, n, s, m; if (this.edWin.getSelection) { var r = this.edWin.getSelection(); if (window.dhx4.isEdge && r.rangeCount == 0) { return { root: null, start: null, end: null } } q = r.getRangeAt(r.rangeCount - 1); s = q.startContainer; m = q.endContainer; n = q.commonAncestorContainer; if (s.nodeName == "#text") { n = n.parentNode } if (s.nodeName == "#text") { s = s.parentNode } if (s.nodeName.toLowerCase() == "body") { s = s.firstChild } if (m.nodeName == "#text") { m = m.parentNode } if (m.nodeName.toLowerCase() == "body") { m = m.lastChild } if (s == m) { n = s } return { root: n, start: s, end: m } } else { if (this.edWin.document.selection) { q = this.edDoc.selection.createRange(); if (!q.duplicate) { return null } n = q.parentElement(); var o = q.duplicate(); var l = q.duplicate(); o.collapse(true); l.moveToElementText(o.parentElement()); l.setEndPoint("EndToStart", o); s = o.parentElement(); o = q.duplicate(); l = q.duplicate(); l.collapse(false); o.moveToElementText(l.parentElement()); o.setEndPoint("StartToEnd", l); m = l.parentElement(); if (s.nodeName.toLowerCase() == "body") { s = s.firstChild } if (m.nodeName.toLowerCase() == "body") { m = m.lastChild } if (s == m) { n = s } return { root: n, start: s, end: m } } } return null }; this.getContent = function() { if (!this.edDoc.body) { return "" } else { if (window.dhx4.isFF || window.dhx4.isChrome) { 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(n) { n = n || ""; if (this.edDoc.body) { var m = false; if (window.dhx4.isFF) { var l = navigator.userAgent.match(/Firefox\/(\d*)/); m = (l != null && l[1] < 28) } if (m) { 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 = n } else { this.editor.contentWindow.document.body.innerHTML = ""; if (n.length == 0) { n = " " } this._runCommand("InsertHTML", n) } } else { this.editor.contentWindow.document.body.innerHTML = n } this.callEvent("onContentSet", []) } else { if (!this.conf.firstLoadEv) { this.conf.firstLoadEv = true; this.conf.firstLoadData = n; 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(l) { window.dhx4.ajax.get(l, function(m) { if (m.xmlDoc.responseText != null) { c.setContent(m.xmlDoc.responseText) } }) }; window.dhx4._eventable(this); this.attachEvent("onFocusChanged", function(l) { if (typeof(this._doOnFocusChanged) == "function") { this._doOnFocusChanged(l) } else { if (typeof(this._doOnFocusChanged) == "string" && typeof(window[this._doOnFocusChanged]) == "function") { window[this._doOnFocusChanged](l) } } }); 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 l = 0; l < c.conf.evs.length; l++) { a.contentWindow.removeEventListener(c.conf.evs[l], c._ev, false) } if (this.tb != null && this.conf.iOSfix == true) { this.tb.cont.removeEventListener("touchend", this._doOnIOSFix, false); this._doOnIOSFix = null } } else { window.detachEvent("onresize", this._doOnResize, false); this.edDoc.detachEvent("onclick", this._doOnClick); this.edDoc.detachEvent("onkeyup", this._doOnKeyUp); for (var l = 0; l < c.conf.evs.length; l++) { a.contentWindow.document.body.detachEvent("on" + c.conf.evs[l], c._ev) } } this._doOnAccess = null; this._doOnFocusChanged = null; if (typeof(window.addEventListener) == "function") { this.editor.onload = null } else { this.editor.onreadystatechange = null } this.editor.parentNode.removeChild(this.editor); this.editor = null; this.edDoc = null; this.edWin = null; this.cell._unload(); this.cell = null; this.tb = null; window.dhx4._eventable(this, "clear"); this.cBlock.parentNode.removeChild(this.cBlock); this.cBlock = null; this.base.className = String(this.base.className).replace(new RegExp("\\s{0,}dhxeditor_" + this.conf.skin), ""); while (this.base.childNodes.length > 0) { this.base.removeChild(this.base.childNodes[0]) } this.base = null; this._doOnClick = null; this._doOnKeyUp = null; this._doOnMouseDown = null; this._ev = null; this._focus = null; this._prepareContent = null; this._doOnResize = null; this.setIconsPath = null; this.init = null; this.setSizes = null; this._runCommand = null; this.applyBold = null; this.applyItalic = null; this.applyUnderscore = null; this.clearFormatting = null; this._showInfo = null; this._getSelectionBounds = null; this.getContent = null; this.setContent = null; this.setContentHTML = null; this.setReadonly = null; this.isReadonly = null; this.unload = null; c = a = null }; if (this.conf.toolbar == true && typeof(this.attachToolbar) == "function" && typeof(window.dhtmlXToolbarObject) == "function") { this.attachToolbar(this.conf.iconsPath); if (this.conf.iOSfix == true) { this._doOnIOSFix = function() { c.editor.contentWindow.focus() }; this.tb.cont.addEventListener("touchend", this._doOnIOSFix, false) } } this.setIconsPath = function(l) { this.conf.iconsPath = l }; if (this.conf.content.length > 0) { this.setContent(this.conf.content); this.conf.content = "" } else { if (this.conf.contentHTML.length > 0) { this.setContentHTML(this.conf.contentHTML); this.conf.contentHTML = "" } } return this } dhtmlXEditor.prototype.setSizes = function() { this.cell._setSize(0, 0, this.base.clientWidth, this.base.clientHeight); if (this.editor != null) { this.editor.style.left = "5px"; this.editor.style.width = this.base.clientWidth - 5 + "px" } }; dhtmlXEditor.prototype.setReadonly = function(a) { this.conf.roMode = (a === true); this._prepareContent(true, this.conf.roMode); this.cBlock.style.display = (this.conf.roMode ? "" : "none") }; dhtmlXEditor.prototype.isReadonly = function(a) { return (this.conf.roMode || false) }; dhtmlXEditor.prototype.setSkin = function(a) { this.base.className = String(this.base.className).replace(new RegExp("dhxeditor_" + this.conf.skin), "dhxeditor_" + a); this.conf.skin = this.cell.conf.skin = a; if (this.tb) { this.cell.detachToolbar(a); this.tb = null; this.attachToolbar() } this.setSizes() }; dhtmlXEditor.prototype._fontConf = function() { if (this.conf.skin == "") { var a = { family: this.conf.font.family, size: this.conf.font.size, color: this.conf.font.color } } else { var a = { family: "Roboto, Arial, Helvetica", size: "14px", color: "#404040" } } return window.dhx4.template("font-size: #size#; font-family: #family#; color: #color#;", a) }; window.dhtmlXEditorCell = function(e, a) { dhtmlXCellObject.apply(this, [e, "_editor"]); var c = this; this.editor = a; this.conf.skin = this.editor.conf.skin; this.attachEvent("_onCellUnload", function() { this._stbUnload(); this.editor = null; c = null }); this._stbInit(); return this }; dhtmlXEditorCell.prototype = new dhtmlXCellObject(); dhtmlXEditorCell.prototype._stbInit = function() { var l = this; var h = document.createElement("DIV"); h.className = "dhx_cell_stb" + (dhx4.isIE6 || dhx4.isIE7 || dhx4.isIE8 ? "" : " dhx_cell_stb_shadow"); this.cell.insertBefore(h, this.cell.childNodes[this.conf.idx.cont]); h.onselectstart = function(a) { a = a || event; a.cancelBubble = true; if (a.preventDefault) { a.preventDefault() } else { a.returnValue = false } return false }; var g = { bold: "applyBold", italic: "applyItalic", underline: "applyUnderscore", clearformat: "clearFormatting" }; for (var e in g) { var c = document.createElement("A"); c.href = "javascript:void(0);"; c.tabIndex = -1; h.appendChild(c); c.onmousedown = c.onclick = function(a) { a = a || event; if (a.preventDefault) { a.preventDefault() } else { a.returnValue = false } return false }; var m = document.createElement("DIV"); m.className = "dhx_cell_stb_button btn_" + e; m._actv = e.charAt(0); m._cmd = g[e]; c.appendChild(m); m.onclick = function(a) { a = a || event; if (a.preventDefault) { a.preventDefault() } else { a.returnValue = false } return false }; m.onmousedown = function(a) { a = a || event; if (a.preventDefault) { a.preventDefault() } else { a.returnValue = false } l.editor[this._cmd](); l.editor.callEvent("onToolbarClick", [this._actv]) }; m = c = null } h = null; this._stbUnload = function() { var a = this.cell.childNodes[this.conf.idx.stb]; a.onselectstart = null; while (a.childNodes.length > 0) { a.lastChild.onmousedown = a.lastChild.onclick = null; a.lastChild.firstChild.onmousedown = a.lastChild.firstChild.onclick = null; a.lastChild.firstChild._actv = a.lastChild.firstChild._cmd = null; a.lastChild.removeChild(a.lastChild.firstChild); a.removeChild(a.lastChild) } a.parentNode.removeChild(a); a = l = 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.stb_visible = true; 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"; this.conf.stb_visible = false }; dhtmlXEditorCell.prototype._getStbHeight = function() { if (this.conf.stb_visible == true && this.conf.skin == "material") { if (this.conf.stb_height == null) { this.conf.stb_height = window.dhx4.readFromCss("dhxeditor_material stb_height_detect", "scrollHeight", "
") } return this.conf.stb_height } return this.cell.childNodes[this.conf.idx.stb].offsetHeight }; dhtmlXCellObject.prototype.attachEditor = function(a) { this.callEvent("_onBeforeContentAttach", ["editor"]); var e = document.createElement("DIV"); e.style.width = "100%"; e.style.height = "100%"; e.style.position = "relative"; e.style.overflow = "hidden"; this._attachObject(e); if (!(typeof(a) == "object" && a != null)) { a = {} } a.parent = e; this.dataType = "editor"; this.dataObj = new dhtmlXEditor(a); e = null; a.parent = null; a = null; if (typeof(window.dhtmlXPortalCell) == "function" && this instanceof window.dhtmlXPortalCell) { if (this.portal.conf.editor_ev == null) { var g = this.portal.attachEvent("onBeforeDrag", function(h) { if (this.cdata[h].dataType == "editor") { this.cdata[h].conf.editor_cont = this.cdata[h].dataObj.getContent() } return true }); var c = this.portal.attachEvent("onDrop", function(h) { if (this.cdata[h].dataType == "editor") { this.cdata[h].dataObj.setContent(this.cdata[h].conf.editor_cont); this.cdata[h].dataObj._prepareContent(true); this.cdata[h].conf.editor_cont = null } }); this.portal.conf.editor_ev = [g, c] } this.conf.editor_ev = this.attachEvent("_onBeforeContentDetach", function() { this.detachEvent(this.conf.editor_ev); this.conf.editor_ev = null; if (this instanceof window.dhtmlXPortalCell) { var l = false; for (var h in this.portal.cdata) { if (this.portal.cdata[h] != this && this.portal.cdata[h].dataType == "editor") { l = true } } if (l == false) { for (var m = 0; m < this.portal.conf.editor_ev.length; m++) { this.portal.detachEvent(this.portal.conf.editor_ev[m]) } this.portal.conf.editor_ev = null } } }) } this.callEvent("_onContentAttach", []); return this.dataObj }; dhtmlXEditor.prototype.attachToolbar = function(c) { if (this.tb != null) { return } if (c != null) { this.conf.iconsPath = c } this.cell._stbHide(); this.tb = this.cell.attachToolbar({ icons_path: this.conf.iconsPath + "/dhxeditor_" + String(this.conf.skin).replace(/^dhx_/, "") + "/", skin: this.conf.skin }); this.setSizes(); var h = (this.conf.skin == "material" ? "png" : "gif"); 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 g = 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 e in this._availSizes) { this._xmlSizes += '' } this.tbXML = ''; this.tb.loadStruct(this.tbXML); this._checkAlign = function(a) { this.tb.setItemState("alignCenter", false); this.tb.setItemState("alignRight", false); this.tb.setItemState("alignJustify", false); this.tb.setItemState("alignLeft", false); if (a) { this.tb.setItemState(a, true) } }; this._checkH = function(a) { this.tb.setItemState("applyH1", false); this.tb.setItemState("applyH2", false); this.tb.setItemState("applyH3", false); this.tb.setItemState("applyH4", false); if (a) { this.tb.setItemState(a, true) } }; this._doOnFocusChanged = function(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); var a = this.getContent(); a = a.replace(/<\/?h\d>/gi, ""); this.setContent(a) } }; dhtmlx.Group = { _init: function() { dhtmlx.assert(this.data, "DataStore required for grouping"); this.data.attachEvent("onStoreLoad", dhtmlx.bind(function() { if (this._settings.group) { this.group(this._settings.group, false) } }, this)); this.attachEvent("onBeforeRender", dhtmlx.bind(function(a) { if (this._settings.sort) { a.block(); a.sort(this._settings.sort); a.unblock() } }, this)); this.data.attachEvent("onClearAll", dhtmlx.bind(function() { this.data._not_grouped_order = this.data._not_grouped_pull = null }, this)); this.attachEvent("onBeforeSort", dhtmlx.bind(function() { this._settings.sort = null }, this)) }, _init_group_data_event: function(c, a) { c.attachEvent("onClearAll", dhtmlx.bind(function() { this.ungroup(false); this.block(); this.clearAll(); this.unblock() }, a)) }, sum: function(c, a) { c = dhtmlx.Template.setter(c); a = a || this.data; var e = 0; a.each(function(g) { e += c(g) * 1 }); return e }, min: function(e, c) { e = dhtmlx.Template.setter(e); c = c || this.data; var a = Infinity; c.each(function(g) { if (e(g) * 1 < a) { a = e(g) * 1 } }); return a * 1 }, max: function(e, c) { e = dhtmlx.Template.setter(e); c = c || this.data; var a = -Infinity; c.each(function(g) { if (e(g) * 1 > a) { a = e(g) * 1 } }); return a }, _split_data_by: function(l) { var n = function(r, q) { r = dhtmlx.Template.setter(r); return r(q[0]) }; var o = dhtmlx.Template.setter(l.by); if (!l.map[o]) { l.map[o] = [o, n] } var e = {}; var m = []; this.data.each(function(q) { var r = o(q); if (!e[r]) { m.push({ id: r }); e[r] = dhtmlx.toArray() } e[r].push(q) }); for (var a in l.map) { var h = (l.map[a][1] || n); if (typeof h != "function") { h = this[h] } for (var g = 0; g < m.length; g++) { m[g][a] = h.call(this, l.map[a][0], e[m[g].id]) } } this.data._not_grouped_order = this.data.order; this.data._not_grouped_pull = this.data.pull; this.data.order = dhtmlx.toArray(); this.data.pull = {}; for (var g = 0; g < m.length; g++) { var c = this.data.id(m[g]); this.data.pull[c] = m[g]; this.data.order.push(c) } this.callEvent("onStoreUpdated", []) }, group: function(a, c) { this.ungroup(false); this._split_data_by(a); if (c !== false) { this.data.callEvent("onStoreUpdated", []) } }, ungroup: function(a) { if (this.data._not_grouped_order) { this.data.order = this.data._not_grouped_order; this.data.pull = this.data._not_grouped_pull; this.data._not_grouped_pull = this.data._not_grouped_order = null } if (a !== false) { this.data.callEvent("onStoreUpdated", []) } }, group_setter: function(a) { dhtmlx.assert(typeof a == "object", "Incorrect group value"); dhtmlx.assert(a.by, "group.by is mandatory"); dhtmlx.assert(a.map, "group.map is mandatory"); return a }, sort_setter: function(a) { if (typeof a != "object") { a = { by: a } } this._mergeSettings(a, { as: "string", dir: "asc" }); return a } }; dhtmlx.Date = { Locale: { month_full: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], month_short: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], day_full: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], day_short: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] }, date_part: function(a) { a.setHours(0); a.setMinutes(0); a.setSeconds(0); a.setMilliseconds(0); return a }, time_part: function(a) { return (a.valueOf() / 1000 - a.getTimezoneOffset() * 60) % 86400 }, week_start: function(c) { var a = c.getDay(); if (this.config.start_on_monday) { if (a === 0) { a = 6 } else { a-- } } return this.date_part(this.add(c, -1 * a, "day")) }, month_start: function(a) { a.setDate(1); return this.date_part(a) }, year_start: function(a) { a.setMonth(0); return this.month_start(a) }, day_start: function(a) { return this.date_part(a) }, add: function(c, e, g) { var a = new Date(c.valueOf()); switch (g) { case "day": a.setDate(a.getDate() + e); break; case "week": a.setDate(a.getDate() + 7 * e); break; case "month": a.setMonth(a.getMonth() + e); break; case "year": a.setYear(a.getFullYear() + e); break; case "hour": a.setHours(a.getHours() + e); break; case "minute": a.setMinutes(a.getMinutes() + e); break; default: return dhtmlx.Date["add_" + g](c, e, g) } return a }, to_fixed: function(a) { if (a < 10) { return "0" + a } return a }, copy: function(a) { return new Date(a.valueOf()) }, date_to_str: function(c, a) { c = c.replace(/%[a-zA-Z]/g, function(e) { switch (e) { case "%d": return '"+dhtmlx.Date.to_fixed(date.getDate())+"'; case "%m": return '"+dhtmlx.Date.to_fixed((date.getMonth()+1))+"'; case "%j": return '"+date.getDate()+"'; case "%n": return '"+(date.getMonth()+1)+"'; case "%y": return '"+dhtmlx.Date.to_fixed(date.getFullYear()%100)+"'; case "%Y": return '"+date.getFullYear()+"'; case "%D": return '"+dhtmlx.Date.Locale.day_short[date.getDay()]+"'; case "%l": return '"+dhtmlx.Date.Locale.day_full[date.getDay()]+"'; case "%M": return '"+dhtmlx.Date.Locale.month_short[date.getMonth()]+"'; case "%F": return '"+dhtmlx.Date.Locale.month_full[date.getMonth()]+"'; case "%h": return '"+dhtmlx.Date.to_fixed((date.getHours()+11)%12+1)+"'; case "%g": return '"+((date.getHours()+11)%12+1)+"'; case "%G": return '"+date.getHours()+"'; case "%H": return '"+dhtmlx.Date.to_fixed(date.getHours())+"'; case "%i": return '"+dhtmlx.Date.to_fixed(date.getMinutes())+"'; case "%a": return '"+(date.getHours()>11?"pm":"am")+"'; case "%A": return '"+(date.getHours()>11?"PM":"AM")+"'; case "%s": return '"+dhtmlx.Date.to_fixed(date.getSeconds())+"'; case "%W": return '"+dhtmlx.Date.to_fixed(dhtmlx.Date.getISOWeek(date))+"'; default: return e } }); if (a) { c = c.replace(/date\.get/g, "date.getUTC") } return new Function("date", 'return "' + c + '";') }, str_to_date: function(h, e) { var l = "var temp=date.split(/[^0-9a-zA-Z]+/g);"; var a = h.match(/%[a-zA-Z]/g); for (var c = 0; c < a.length; c++) { switch (a[c]) { case "%j": case "%d": l += "set[2]=temp[" + c + "]||1;"; break; case "%n": case "%m": l += "set[1]=(temp[" + c + "]||1)-1;"; break; case "%y": l += "set[0]=temp[" + c + "]*1+(temp[" + c + "]>50?1900:2000);"; break; case "%g": case "%G": case "%h": case "%H": l += "set[3]=temp[" + c + "]||0;"; break; case "%i": l += "set[4]=temp[" + c + "]||0;"; break; case "%Y": l += "set[0]=temp[" + c + "]||0;"; break; case "%a": case "%A": l += "set[3]=set[3]%12+((temp[" + c + "]||'').toLowerCase()=='am'?0:12);"; break; case "%s": l += "set[5]=temp[" + c + "]||0;"; break } } var g = "set[0],set[1],set[2],set[3],set[4],set[5]"; if (e) { g = " Date.UTC(" + g + ")" } return new Function("date", "var set=[0,0,1,0,0,0]; " + l + " return new Date(" + g + ");") }, getISOWeek: function(e) { if (!e) { return false } var c = e.getDay(); if (c === 0) { c = 7 } var g = new Date(e.valueOf()); g.setDate(e.getDate() + (4 - c)); var a = g.getFullYear(); var l = Math.floor((g.getTime() - new Date(a, 0, 1).getTime()) / 86400000); var h = 1 + Math.floor(l / 7); return h }, getUTCISOWeek: function(a) { return this.getISOWeek(a) } }; dhtmlx.math = {}; dhtmlx.math._toHex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"]; dhtmlx.math.toHex = function(c, a) { c = parseInt(c, 10); str = ""; while (c > 0) { str = this._toHex[c % 16] + str; c = Math.floor(c / 16) } while (str.length < a) { str = "0" + str } return str }; dhtmlx.math.hexToDec = function(a) { return parseInt(a, 16) }; dhtmlx.math.toRgb = function(c) { var h, e, a, l; if (typeof(c) != "string") { h = c[0]; e = c[1]; a = c[2] } else { if (c.indexOf("rgb") != -1) { l = c.substr(c.indexOf("(") + 1, c.lastIndexOf(")") - c.indexOf("(") - 1).split(","); h = l[0]; e = l[1]; a = l[2] } else { if (c.substr(0, 1) == "#") { c = c.substr(1) } h = this.hexToDec(c.substr(0, 2)); e = this.hexToDec(c.substr(2, 2)); a = this.hexToDec(c.substr(4, 2)) } } h = (parseInt(h, 10) || 0); e = (parseInt(e, 10) || 0); a = (parseInt(a, 10) || 0); if (h < 0 || h > 255) { h = 0 } if (e < 0 || e > 255) { e = 0 } if (a < 0 || a > 255) { a = 0 } return [h, e, a] }; dhtmlx.math.hsvToRgb = function(m, y, w) { var l, o, e, c, x, a, n, u; l = Math.floor((m / 60)) % 6; o = m / 60 - l; e = w * (1 - y); c = w * (1 - o * y); x = w * (1 - (1 - o) * y); a = 0; n = 0; u = 0; switch (l) { case 0: a = w; n = x; u = e; break; case 1: a = c; n = w; u = e; break; case 2: a = e; n = w; u = x; break; case 3: a = e; n = c; u = w; break; case 4: a = x; n = e; u = w; break; case 5: a = w; n = e; u = c; break } a = Math.floor(a * 255); n = Math.floor(n * 255); u = Math.floor(u * 255); return [a, n, u] }; dhtmlx.math.rgbToHsv = function(c, n, o) { var l, e, q, a, u, x, m, w; l = c / 255; e = n / 255; q = o / 255; var a = Math.min(l, e, q); var u = Math.max(l, e, q); m = 0; x = u == 0 ? 0 : (1 - a / u); w = u; if (u == a) { m = 0 } else { if (u == l && e >= q) { m = 60 * (e - q) / (u - a) + 0 } else { if (u == l && e < q) { m = 60 * (e - q) / (u - a) + 360 } else { if (u == e) { m = 60 * (q - l) / (u - a) + 120 } else { if (u == q) { m = 60 * (l - e) / (u - a) + 240 } } } } } return [m, x, w] }; if (!dhtmlx.presets) { dhtmlx.presets = {} } dhtmlx.presets.chart = { simple: { item: { borderColor: "#ffffff", color: "#2b7100", shadow: false, borderWidth: 2 }, line: { color: "#8ecf03", width: 2 } }, plot: { color: "#1293f8", item: { borderColor: "#636363", borderWidth: 1, color: "#ffffff", type: "r", shadow: false }, line: { color: "#1293f8", width: 2 } }, diamond: { color: "#b64040", item: { borderColor: "#b64040", color: "#b64040", type: "d", radius: 3, shadow: true }, line: { color: "#ff9000", width: 2 } }, point: { color: "#fe5916", disableLines: true, fill: false, disableItems: false, item: { color: "#feb916", borderColor: "#fe5916", radius: 2, borderWidth: 1, type: "r" }, alpha: 1 }, line: { line: { color: "#3399ff", width: 2 }, item: { color: "#ffffff", borderColor: "#3399ff", radius: 2, borderWidth: 2, type: "d" }, fill: false, disableItems: false, disableLines: false, alpha: 1 }, area: { fill: "#3399ff", line: { color: "#3399ff", width: 1 }, disableItems: true, alpha: 0.2, disableLines: false }, round: { item: { radius: 3, borderColor: "#3f83ff", borderWidth: 1, color: "#3f83ff", type: "r", shadow: false, alpha: 0.6 } }, square: { item: { radius: 3, borderColor: "#447900", borderWidth: 2, color: "#69ba00", type: "s", shadow: false, alpha: 1 } }, column: { color: "RAINBOW", gradient: false, width: 45, radius: 0, alpha: 1, border: true }, stick: { width: 5, gradient: false, color: "#67b5c9", radius: 2, alpha: 1, border: false }, alpha: { color: "#b9a8f9", width: 70, gradient: "falling", radius: 0, alpha: 0.5, border: true } }; dhtmlx.ui.Map = function(a) { this.name = "Map"; this._id = "map_" + dhtmlx.uid(); this._key = a; this._map = []; this._areas = [] }; dhtmlx.ui.Map.prototype = { addRect: function(e, c, a) { this._areas.push({ index: a, points: c }); this._createMapArea(e, "RECT", c, a) }, addPoly: function(e, c, a) { this._createMapArea(e, "POLY", c, a) }, _createMapArea: function(h, c, g, e) { var a = ""; if (arguments.length == 4) { a = "userdata='" + e + "'" } this._map.push("") }, addSector: function(a, q, o, m, h, e, g, l) { var n = []; n.push(m); n.push(Math.floor(h * g)); for (var c = q; c < o; c += Math.PI / 18) { n.push(Math.floor(m + e * Math.cos(c))); n.push(Math.floor((h + e * Math.sin(c)) * g)) } n.push(Math.floor(m + e * Math.cos(o))); n.push(Math.floor((h + e * Math.sin(o)) * g)); n.push(m); n.push(Math.floor(h * g)); return this.addPoly(a, n, l) }, render: function(a) { var e = dhtmlx.html.create("DIV"); e.style.cssText = "position:absolute; width:100%; height:100%; top:0px; left:0px;"; a.appendChild(e); var c = dhtmlx._isIE ? "" : "src='data:image/gif;base64,R0lGODlhEgASAIAAAP///////yH5BAUUAAEALAAAAAASABIAAAIPjI+py+0Po5y02ouz3pwXADs='"; e.innerHTML = "" + this._map.join("\n") + ""; a._htmlmap = e; this._map = [] } }; dhtmlx.chart = {}; dhtmlx.chart.scatter = { pvt_render_scatter: function(q, l, o, n, m, a) { if (!this._settings.xValue) { return dhtmlx.log("warning", "Undefined propery: xValue") } var e = this._getLimits(); var h = this._getLimits("h", "xValue"); if (!m) { 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(), l, o, n, e.min, e.max); this._drawHXAxis(this.canvases.x.getCanvas(), l, o, n, h.min, h.max) } e = { min: this._settings.yAxis.start, max: this._settings.yAxis.end }; h = { min: this._settings.xAxis.start, max: this._settings.xAxis.end }; var c = this._getScatterParams(q, l, o, n, h, e); this._mapStart = o; for (var g = 0; g < l.length; g++) { this._drawScatterItem(q, a, o, n, c, h, e, l[g], m) } }, _getScatterParams: function(a, g, e, c, m, l) { var h = {}; h.totalHeight = c.y - e.y; h.totalWidth = c.x - e.x; this._calcScatterUnit(h, m.min, m.max, h.totalWidth, "X"); this._calcScatterUnit(h, l.min, l.max, h.totalHeight, "Y"); return h }, _drawScatterItem: function(r, a, o, n, e, h, g, l, m) { var c = this._calculateScatterItemPosition(e, n, o, h, l, "X"); var q = this._calculateScatterItemPosition(e, o, n, g, l, "Y"); this._drawItem(r, c, q, l, this._settings.label.call(this, l), m, a) }, _calculateScatterItemPosition: function(e, n, m, a, h, c) { var q = this._settings[c == "X" ? "xValue" : "value"].call(this, h); var g = e["valueFactor" + c]; var r = (parseFloat(q || 0) - a.min) * g; var o = e["unit" + c]; var l = m[c.toLowerCase()] - (c == "X" ? (-1) : 1) * Math.floor(o * r); if (r < 0) { l = m[c.toLowerCase()] } if (q > a.max) { l = n[c.toLowerCase()] } if (q < a.min) { l = m[c.toLowerCase()] } return l }, _calcScatterUnit: function(l, e, a, c, g) { var h = this._getRelativeValue(e, a); g = (g || ""); l["relValue" + g] = h[0]; l["valueFactor" + g] = h[1]; l["unit" + g] = (l["relValue" + g] ? c / l["relValue" + g] : 10) } }; dhtmlx.chart.radar = { pvt_render_radar: function(c, g, a, l, e, h) { this._renderRadarChart(c, g, a, l, e, h) }, _renderRadarChart: function(u, h, r, q, o, a) { if (!h.length) { return } var m = this._getPieParameters(r, q); var n = (this._settings.radius ? this._settings.radius : m.radius); var c = (this._settings.x ? this._settings.x : m.x); var s = (this._settings.y ? this._settings.y : m.y); var e = []; for (var g = 0; g < h.length; g++) { e.push(1) } var l = this._getRatios(e, h.length); this._mapStart = r; if (!o) { this._drawRadarAxises(l, c, s, n, h) } this._drawRadarData(u, l, c, s, n, h, o, a) }, _drawRadarData: function(C, s, n, m, h, N, D, M) { var A, v, L, J, E, I, g, e, F, K, H, u, c, w, q, o, a, r, l; L = this._settings; E = L.yAxis.start; I = L.yAxis.end; l = this._getRelativeValue(E, I); u = l[0]; r = (u ? h / u : h / 2); a = l[1]; c = -Math.PI / 2; A = v = c; F = []; e = 0; for (J = 0; J < N.length; J++) { if (!o) { w = L.value(N[J]); q = (parseFloat(w || 0) - E) * a } else { q = o } K = Math.floor(r * q); w = L.value((J != (N.length - 1)) ? N[J + 1] : N[0]); o = (parseFloat(w || 0) - E) * a; H = Math.floor(r * o); A = v; v = ((J != (N.length - 1)) ? (c + s[J] - 0.0001) : c); g = (e || this._getPositionByAngle(A, n, m, K)); e = this._getPositionByAngle(v, n, m, H); F.push(g) } if (L.fill) { this._fillRadarChart(C, F, N) } if (!L.disableLines) { this._strokeRadarChart(C, F, N) } if (!L.disableItems) { this._drawRadarItemMarkers(C, F, N, D, M) } F = null }, _drawRadarItemMarkers: function(a, e, h, g, l) { for (var c = 0; c < e.length; c++) { this._drawItem(a, e[c].x, e[c].y, h[c], this._settings.label.call(this, h), g, l) } }, _fillRadarChart: function(a, g, l) { var h, e; a.globalAlpha = this._settings.alpha.call(this, {}); a.beginPath(); for (var c = 0; c < g.length; c++) { a.fillStyle = this._settings.fill.call(this, l[c]); h = g[c]; e = (g[c + 1] || g[0]); if (!c) { a.moveTo(h.x, h.y) } a.lineTo(e.x, e.y) } a.fill(); a.globalAlpha = 1 }, _strokeRadarChart: function(a, g, l) { var h, e; for (var c = 0; c < g.length; c++) { h = g[c]; e = (g[c + 1] || g[0]); this._drawLine(a, h.x, h.y, e.x, e.y, this._settings.line.color.call(this, l[c]), this._settings.line.width) } }, _drawRadarAxises: function(A, v, u, m, O) { var a = this._settings.yAxis; var g = this._settings.xAxis; var n = a.start; var l = a.end; var q = a.step; var C = {}; var N = this._configYAxis; if (typeof N.step == "undefined" || typeof N.start == "undefined" || typeof N.end == "undefined") { var r = this._getLimits(); C = this._calculateScale(r.min, r.max); n = C.start; l = C.end; q = C.step; a.end = l; a.start = n } var I = []; var L, K, D; var M = 0; var e = m * q / (l - n); var s, w; if (q < 1) { s = Math.min(this._log10(q), (n <= 0 ? 0 : this._log10(n))); w = Math.pow(10, -s) } var J = []; if (!this.canvases.scale) { this.canvases.scale = new dhtmlx.ui.Canvas(this._obj, "radar_scale") } var H = this.canvases.scale.getCanvas(); for (L = l; L >= n; L -= q) { if (C.fixNum) { L = parseFloat((new Number(L)).toFixed(C.fixNum)) } I.push(Math.floor(M * e) + 0.5); if (w) { L = Math.round(L * w) / w } var o = u - m + I[I.length - 1]; this.canvases.scale.renderTextAt("middle", "left", v, o, a.template(L.toString()), "dhx_axis_item_y dhx_radar"); if (A.length < 2) { this._drawScaleSector(H, "arc", v, u, m - I[I.length - 1], -Math.PI / 2, 3 * Math.PI / 2, L); return } var h = -Math.PI / 2; var F = h; var E; for (K = 0; K < A.length; K++) { if (L == l) { J.push(F) } E = h + A[K] - 0.0001; this._drawScaleSector(H, (N.lineShape || "line"), v, u, m - I[I.length - 1], F, E, L, K, O[L]); F = E } M++ } for (L = 0; L < J.length; L++) { D = this._getPositionByAngle(J[L], v, u, m); if (g.lines.call(this, O[L], L)) { this._drawLine(H, v, u, D.x, D.y, (g ? g.lineColor.call(this, O[L]) : "#cfcfcf"), 1) } this._drawRadarScaleLabel(H, v, u, m, J[L], (g ? g.template.call(this, O[L]) : " ")) } }, _drawScaleSector: function(s, l, r, o, h, c, a, g, e) { var q, n; if (h < 0) { return false } q = this._getPositionByAngle(c, r, o, h); n = this._getPositionByAngle(a, r, o, h); var m = this._settings.yAxis; if (m.bg) { s.beginPath(); s.moveTo(r, o); if (l == "arc") { s.arc(r, o, h, c, a, false) } else { s.lineTo(q.x, q.y); s.lineTo(n.x, n.y) } s.fillStyle = m.bg(g, e); s.moveTo(r, o); s.fill(); s.closePath() } if (m.lines.call(this, g)) { s.lineWidth = 1; s.beginPath(); if (l == "arc") { s.arc(r, o, h, c, a, false) } else { s.moveTo(q.x, q.y); s.lineTo(n.x, n.y) } s.strokeStyle = m.lineColor.call(this, g); s.stroke() } }, _drawRadarScaleLabel: function(w, o, m, c, n, u) { var v = this.canvases.scale.renderText(0, 0, u, "dhx_axis_radar_title", 1); var e = v.scrollWidth; var s = v.offsetHeight; var q = 0.001; var l = this._getPositionByAngle(n, o, m, c + 5); var h = 0, g = 0; if (n < 0 || n > Math.PI) { g = -s } if (n > Math.PI / 2) { h = -e } if (Math.abs(n + Math.PI / 2) < q || Math.abs(n - Math.PI / 2) < q) { h = -e / 2 } else { if (Math.abs(n) < q || Math.abs(n - Math.PI) < q) { g = -s / 2 } } v.style.top = l.y + g + "px"; v.style.left = l.x + h + "px"; v.style.width = e + "px"; v.style.whiteSpace = "nowrap" } }; dhtmlx.chart.area = { pvt_render_area: function(n, E, h, g, o, A) { var r, y, s, q, l, x, m, D, C, w, v, c, u, a, e; x = this._calculateLineParams(n, E, h, g, o); y = this._settings; q = (y.eventRadius || Math.floor(x.cellWidth / 2)); if (E.length) { m = []; w = (!y.offset ? h.x : h.x + x.cellWidth * 0.5); for (s = 0; s < E.length; s++) { l = E[s]; C = this._getPointY(l, h, g, x); u = w + x.cellWidth * s; if (C) { a = (typeof C == "object" ? C.y0 : C); if (s && this._settings.fixOverflow) { D = this._getPointY(E[s - 1], h, g, x); if (D.out && D.out == C.out) { continue } v = x.cellWidth * (s - 1) - 0.5 + w; c = (typeof D == "object" ? D.y0 : D); if (D.out) { e = (D.out == "min" ? g.y : h.y); m.push([this._calcOverflowX(v, u, c, a, e), e]) } if (C.out) { e = (C.out == "min" ? g.y : h.y); m.push([this._calcOverflowX(v, u, c, a, e), e]); if (s == (E.length - 1) && e == h.y) { m.push([u, h.y]) } } } if (!C.out) { m.push([u, a]); A.addRect(l.id, [u - q - h.x, a - q - h.y, u + q - h.x, a + q - h.y], o) } if (!y.yAxis) { r = (!y.offset && (s == E.length - 1) ? "left" : "center"); this.canvases[o].renderTextAt(false, r, u, a - y.labelOffset, y.label(l)) } } } if (m.length) { m.push([u, g.y]); m.push([m[0][0], g.y]) } n.globalAlpha = this._settings.alpha.call(this, E[0]); n.fillStyle = this._settings.color.call(this, E[0]); n.beginPath(); this._path(n, m); n.fill(); if (y.border) { n.lineWidth = y.borderWidth || 1; if (y.borderColor) { n.strokeStyle = y.borderColor.call(this, E[0]) } else { this._setBorderStyles(n, n.fillStyle) } n.beginPath(); this._path(n, m); n.stroke() } n.lineWidth = 1; n.globalAlpha = 1 } } }; dhtmlx.chart.stackedArea = { pvt_render_stackedArea: function(o, F, c, a, q, D) { var I, H, u, C, w, v, h, s, l, A, n, g, e, m; A = this._calculateLineParams(o, F, c, a, q); C = this._settings; s = (C.eventRadius || Math.floor(A.cellWidth / 2)); if (F.length) { n = []; m = []; g = (!C.offset ? c.x : c.x + A.cellWidth * 0.5); var E = function(x, J) { return q ? (F[x].$startY ? J - a.y + F[x].$startY : 0) : J }; var r = function(y, L, K) { var J = (K.y - L.y) / (K.x - L.x); return J * y + L.y - J * L.x }; for (w = 0; w < F.length; w++) { l = F[w]; if (!w) { e = E(w, a.y); n.push([g, e]) } else { g += A.cellWidth } e = E(w, this._getPointY(l, c, a, A)); m.push((isNaN(e) && !w) ? (F[w].$startY || a.y) : e); if (e) { n.push([g, e]); D.addRect(l.id, [g - s - c.x, e - s - c.y, g + s - c.x, e + s - c.y], q); if (!C.yAxis) { u = (!C.offset && h ? "left" : "center"); this.canvases[q].renderTextAt(false, u, g, e - C.labelOffset, C.label(l)) } } } n.push([g, E(w - 1, a.y)]); if (q) { for (w = F.length - 2; w > 0; w--) { g -= A.cellWidth; e = F[w].$startY; if (e) { n.push([g, e]) } } } n.push([n[0][0], n[0][1]]); 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(); for (w = 0; w < F.length; w++) { e = m[w]; if (!e) { if (w == F.length - 1) { e = F[w].$startY } for (v = w + 1; v < F.length; v++) { if (m[v]) { I = { x: c.x, y: m[0] }; H = { x: (c.x + A.cellWidth * v), y: m[v] }; e = r(c.x + A.cellWidth * w, I, H); break } } } F[w].$startY = e } } } }; dhtmlx.chart.spline = { pvt_render_spline: function(o, H, g, e, q, F) { var E, s, n, r, D, m, l, w, v, u, h, c, a; D = this._calculateLineParams(o, H, g, e, q); E = this._settings; this._mapStart = g; n = []; if (H.length) { w = (E.offset ? g.x + D.cellWidth * 0.5 : g.x); for (s = 0; s < H.length; s++) { h = this._getPointY(H[s], g, e, D); if (h) { l = ((!s) ? w : D.cellWidth * s - 0.5 + w); n.push({ x: l, y: h, index: s }) } } m = this._getSplineParameters(n); for (s = 0; s < n.length; s++) { v = n[s].x; c = n[s].y; if (s < n.length - 1) { u = n[s + 1].x; a = n[s + 1].y; for (r = v; r < u; r++) { var C = this._getSplineYPoint(r, v, s, m.a, m.b, m.c, m.d); if (C < g.y) { C = g.y } if (C > e.y) { C = e.y } var A = this._getSplineYPoint(r + 1, v, s, m.a, m.b, m.c, m.d); if (A < g.y) { A = g.y } if (A > e.y) { A = e.y } this._drawLine(o, r, C, r + 1, A, E.line.color(H[s]), E.line.width) } this._drawLine(o, u - 1, this._getSplineYPoint(r, v, s, m.a, m.b, m.c, m.d), u, a, E.line.color(H[s]), E.line.width) } this._drawItem(o, v, c, H[n[s].index], E.label(H[n[s].index]), q, F) } } }, _getSplineParameters: function(y) { var l, C, A, D, x, w, r, q, o = [], g = [], e = y.length; for (l = 0; l < e - 1; l++) { o[l] = y[l + 1].x - y[l].x; g[l] = (y[l + 1].y - y[l].y) / o[l] } C = []; A = []; C[0] = 0; C[1] = 2 * (o[0] + o[1]); A[0] = 0; A[1] = 6 * (g[1] - g[0]); for (l = 2; l < e - 1; l++) { C[l] = 2 * (o[l - 1] + o[l]) - o[l - 1] * o[l - 1] / C[l - 1]; A[l] = 6 * (g[l] - g[l - 1]) - o[l - 1] * A[l - 1] / C[l - 1] } D = []; D[e - 1] = D[0] = 0; for (l = e - 2; l >= 1; l--) { D[l] = (A[l] - o[l] * D[l + 1]) / C[l] } x = []; w = []; r = []; q = []; for (l = 0; l < e - 1; l++) { x[l] = y[l].y; w[l] = -o[l] * D[l + 1] / 6 - o[l] * D[l] / 3 + (y[l + 1].y - y[l].y) / o[l]; r[l] = D[l] / 2; q[l] = (D[l + 1] - D[l]) / (6 * o[l]) } return { a: x, b: w, c: r, d: q } }, _getSplineYPoint: function(g, l, m, h, e, o, n) { return h[m] + (g - l) * (e[m] + (g - l) * (o[m] + (g - l) * n[m])) } }; dhtmlx.chart.barH = { pvt_render_barH: function(C, P, m, l, D, O) { var s, v, F, E, a, I, q, M, w, N, c, y, n, J, x, h, A, u, L, g, r; F = (l.y - m.y) / P.length; q = this._getLimits("h"); M = q.max; w = q.min; h = l.x - m.x; r = !!this._settings.yAxis; if (!D) { this._drawHScales(C, P, m, l, w, M, F) } if (r) { M = parseFloat(this._settings.xAxis.end); w = parseFloat(this._settings.xAxis.start) } J = this._getRelativeValue(w, M); y = J[0]; c = J[1]; u = (y ? h / y : 10); if (!r) { x = 10; u = (y ? (h - x) / y : 10) } v = parseInt(this._settings.width, 10); var K = this._series.length; var o = this._settings.seriesMargin; var e = this._settings.seriesPadding; if (this._series && (v * K + e + (K > 2 ? o * K : 0) > F)) { v = F / K - e - (K > 2 ? o : 0) } s = (F - v * K - o * (K - 1)) / 2; if (this._settings.border) { v = parseInt(v, 10); s = parseInt(s, 10) } n = (typeof this._settings.radius != "undefined" ? parseInt(this._settings.radius, 10) : Math.round(v / 5)); N = false; a = this._settings.gradient; if (a && typeof(a) != "function") { N = a; a = false } else { if (a) { a = C.createLinearGradient(m.x, m.y, l.x, m.y); this._settings.gradient(a) } } if (!r) { this._drawLine(C, m.x - 0.5, m.y, m.x - 0.5, l.y, "#000000", 1) } for (I = 0; I < P.length; I++) { A = parseFloat(this._settings.value(P[I] || 0)); if (A > M) { A = M } A -= w; A *= c; L = m.x; g = m.y + s + (K > 2 ? o * D : 0) + parseInt(I * F, 10) + v * D; if ((A < 0 && this._settings.origin == "auto") || (this._settings.xAxis && A === 0 && !(this._settings.origin != "auto" && this._settings.origin > w))) { this.canvases[D].renderTextAt("middle", "right", L + 10, g + v / 2 + s, this._settings.label(P[I])); continue } if (A < 0 && this._settings.origin != "auto" && this._settings.origin > w) { A = 0 } if (!r) { A += x / u } E = a || this._settings.color.call(this, P[I]); if (this._settings.border) { this._drawBarHBorder(C, L, g, v, w, n, u, A, E) } C.globalAlpha = this._settings.alpha.call(this, P[I]); var H = this._drawBarH(C, l, L, g, v, w, n, u, A, E, a, N); if (N != false) { this._drawBarHGradient(C, L, g, v, w, n, u, A, E, N) } C.globalAlpha = 1; if (H[3] == g) { this.canvases[D].renderTextAt("middle", "left", H[0] - 5, H[3] + Math.floor(v / 2), this._settings.label(P[I])); O.addRect(P[I].id, [H[0] - m.x, H[3] - m.y, H[2] - m.x, H[3] + v - m.y], D) } else { this.canvases[D].renderTextAt("middle", false, H[2] + 5, H[1] + Math.floor(v / 2), this._settings.label(P[I])); O.addRect(P[I].id, [H[0] - m.x, g - m.y, H[2] - m.x, H[3] - m.y], D) } } }, _setBarHPoints: function(w, g, u, x, m, v, s, l, h) { var c = 0; if (m > v * s) { var r = (m - v * s) / m; c = -Math.asin(r) + Math.PI / 2 } w.moveTo(g, u + l); var e = g + v * s - m - (m ? 0 : l); if (m < v * s) { w.lineTo(e, u + l) } var q = u + m; if (m && m > 0) { w.arc(e, q, m - l, -Math.PI / 2 + c, 0, false) } var o = u + x - m - (m ? 0 : l); var a = e + m - (m ? l : 0); w.lineTo(a, o); if (m && m > 0) { w.arc(e, o, m - l, 0, Math.PI / 2 - c, false) } var n = u + x - l; w.lineTo(g, n); if (!h) { w.lineTo(g, u + l) } return [a, n] }, _drawHScales: function(e, m, l, h, n, c, g) { var a = 0; if (this._settings.xAxis) { if (!this.canvases.x) { this.canvases.x = new dhtmlx.ui.Canvas(this._obj) } a = this._drawHXAxis(this.canvases.x.getCanvas(), m, l, h, n, c) } if (this._settings.yAxis) { if (!this.canvases.y) { this.canvases.y = new dhtmlx.ui.Canvas(this._obj) } this._drawHYAxis(this.canvases.y.getCanvas(), m, l, h, g, a) } }, _drawHYAxis: function(s, h, o, m, e, a) { if (!this._settings.yAxis) { return } var l; var c = parseInt((a ? a : o.x), 10) - 0.5; var q = m.y + 0.5; var n = o.y; this._drawLine(s, c, q, c, n, this._settings.yAxis.color, 1); for (var g = 0; g < h.length; g++) { var r = ((this._settings.origin != "auto") && (this._settings.view == "barH") && (parseFloat(this._settings.value(h[g])) < this._settings.origin)); l = n + e / 2 + g * e; this.canvases.y.renderTextAt("middle", (r ? false : "left"), (r ? c + 5 : c - 5), l, this._settings.yAxis.template(h[g]), "dhx_axis_item_y", (r ? 0 : c - 10)); if (this._settings.yAxis.lines.call(this, h[g])) { this._drawLine(s, o.x, l, m.x, l, this._settings.yAxis.lineColor.call(this, h[g]), 1) } } this._drawLine(s, o.x + 0.5, n + 0.5, m.x, n + 0.5, this._settings.yAxis.lineColor.call(this, {}), 1); this._setYAxisTitle(o, m) }, _drawHXAxis: function(x, E, l, h, n, m) { var o; var v = {}; var e = this._settings.xAxis; if (!e) { return } var g = h.y + 0.5; var C = l.x - 0.5; var A = h.x - 0.5; var u = l.x; this._drawLine(x, C, g, A, g, e.color, 1); if (e.step) { o = parseFloat(e.step) } if (typeof this._configXAxis.step == "undefined" || typeof this._configXAxis.start == "undefined" || typeof this._configXAxis.end == "undefined") { v = this._calculateScale(n, m); n = v.start; m = v.end; o = v.step; this._settings.xAxis.end = m; this._settings.xAxis.start = n; this._settings.xAxis.step = o } if (o === 0) { return } var a = (A - C) * o / (m - n); var D = 0; for (var y = n; y <= m; y += o) { if (v.fixNum) { y = parseFloat((new Number(y)).toFixed(v.fixNum)) } var w = Math.floor(C + D * a) + 0.5; if (!(y == n && this._settings.origin == "auto") && e.lines.call(this, y)) { this._drawLine(x, w, g, w, l.y, this._settings.xAxis.lineColor.call(this, y), 1) } if (y == this._settings.origin) { u = w + 1 } var q = y; if (o < 1) { var r = Math.min(this._log10(o), (n <= 0 ? 0 : this._log10(n))); var s = Math.pow(10, -r); q = Math.round(y * s) / s } this.canvases.x.renderTextAt(false, true, w, g + 2, e.template(q.toString()), "dhx_axis_item_x"); D++ } this.canvases.x.renderTextAt(true, false, C, h.y + this._settings.padding.bottom - 3, this._settings.xAxis.title, "dhx_axis_title_x", h.x - l.x); if (!e.lines.call(this, {})) { this._drawLine(x, C, l.y - 0.5, A, l.y - 0.5, this._settings.xAxis.color, 0.2) } return u }, _correctBarHParams: function(n, h, e, l, m, o, g) { var a = this._settings.yAxis; var c = h; if (!!a && this._settings.origin != "auto" && (this._settings.origin > g)) { h += (this._settings.origin - g) * m; c = h; l = l - (this._settings.origin - g); if (l < 0) { l *= (-1); n.translate(h, e + o); n.rotate(Math.PI); h = 0.5; e = 0 } h += 0.5 } return { value: l, x0: h, y0: e, start: c } }, _drawBarH: function(u, h, A, g, o, q, l, n, s, v, a, m) { var w; u.save(); var r = this._correctBarHParams(u, A, g, s, n, o, q); u.fillStyle = v; u.beginPath(); if (n * r.value > 0) { w = this._setBarHPoints(u, r.x0, r.y0, o, l, n, r.value, (this._settings.border ? 1 : 0)); if (a && !m) { u.lineTo(h.x, r.y0 + (this._settings.border ? 1 : 0)) } } else { w = [r.x0, r.y0 + 1] } u.fill(); u.restore(); var e = r.y0; var c = (r.y0 != g ? g : w[1]); var y = (r.y0 != g ? (r.start - w[0]) : r.start); var x = (r.y0 != g ? r.start : w[0]); return [y, e, x, c] }, _drawBarHBorder: function(o, c, m, q, h, g, n, l, e) { o.save(); var a = this._correctBarHParams(o, c, m, l, n, q, h); o.beginPath(); this._setBorderStyles(o, e); o.globalAlpha = 0.9; if (n * a.value > 0) { this._setBarHPoints(o, a.x0, a.y0, q, g, n, a.value, o.lineWidth / 2, 1) } o.stroke(); o.restore() }, _drawBarHGradient: function(r, e, o, s, m, l, q, n, g, a) { r.save(); var c = this._correctBarHParams(r, e, o, n, q, s, m); var h = this._setBarGradient(r, c.x0, c.y0 + s, c.x0 + q * c.value, c.y0, a, g, "x"); r.fillStyle = h.gradient; r.beginPath(); if (q * c.value > 0) { this._setBarHPoints(r, c.x0, c.y0 + h.offset, s - h.offset * 2, l, q, c.value, h.offset) } r.fill(); r.globalAlpha = 1; r.restore() } }; dhtmlx.assert(dhtmlx.chart.barH); dhtmlx.chart.stackedBarH = { pvt_render_stackedBarH: function(C, P, h, g, D, O) { var N, v; var c; var w; var y = g.x - h.x; var n = !!this._settings.yAxis; var m = this._getStackedLimits(P); N = m.max; v = m.min; var F = Math.floor((g.y - h.y) / P.length); if (!D) { this._drawHScales(C, P, h, g, v, N, F) } if (n) { N = parseFloat(this._settings.xAxis.end); v = parseFloat(this._settings.xAxis.start) } var K = this._getRelativeValue(v, N); w = K[0]; c = K[1]; var s = (w ? y / w : 10); if (!n) { var x = 10; s = (w ? (y - x) / w : 10) } var u = parseInt(this._settings.width, 10); if ((u + 4) > F) { u = F - 4 } var o = (F - u) / 2; var l = 0; var q = false; var a = this._settings.gradient; if (a) { q = true } if (!n) { this._drawLine(C, h.x - 0.5, h.y, h.x - 0.5, g.y, "#000000", 1) } var M = 0; var J = 0; for (I = 0; I < this._series.length; I++) { if (I == D) { J = M } if (this._series[I].view == "stackedBarH") { M++ } } for (var I = 0; I < P.length; I++) { if (!J) { P[I].$startX = h.x } var A = parseFloat(this._settings.value(P[I] || 0)); if (A > N) { A = N } A -= v; A *= c; var L = h.x; var e = h.y + o + I * F; if (!J) { P[I].$startX = L } else { L = P[I].$startX } if (A < 0 || (this._settings.yAxis && A === 0)) { this.canvases.y.renderTextAt("middle", true, L + 10, e + u / 2, this._settings.label(P[I])); continue } if (!n) { A += x / s } var E = this._settings.color.call(this, P[I]); C.globalAlpha = this._settings.alpha.call(this, P[I]); C.fillStyle = this._settings.color.call(this, P[I]); C.beginPath(); var H = this._setBarHPoints(C, L, e, u, l, s, A, (this._settings.border ? 1 : 0)); if (a && !q) { C.lineTo(h.x + y, e + (this._settings.border ? 1 : 0)) } C.fill(); if (q != false) { var r = this._setBarGradient(C, L, e + u, L, e, q, E, "x"); C.fillStyle = r.gradient; C.beginPath(); H = this._setBarHPoints(C, L, e, u, l, s, A, 0); C.fill() } if (this._settings.border) { this._drawBarHBorder(C, L, e, u, v, l, s, A, E) } C.globalAlpha = 1; this.canvases[D].renderTextAt("middle", true, P[I].$startX + (H[0] - P[I].$startX) / 2 - 1, e + (H[1] - e) / 2, this._settings.label(P[I])); O.addRect(P[I].id, [P[I].$startX - h.x, e - h.y, H[0] - h.x, H[1] - h.y], D); P[I].$startX = H[0] } } }; dhtmlx.chart.stackedBar = { pvt_render_stackedBar: function(D, S, l, h, E, P) { var M, x, a, L, g; var c; var y; var O = this._settings; var A = h.y - l.y; var n = !!O.yAxis; var N = !!O.xAxis; var m = this._getStackedLimits(S); var Q = (O.origin === 0); M = m.max; x = m.min; if (!S.length) { return } var H = (h.x - l.x) / S.length; if (!E) { a = this._drawScales(S, l, h, x, M, H) } if (n) { M = parseFloat(O.yAxis.end); x = parseFloat(O.yAxis.start) } var K = this._getRelativeValue(x, M); y = K[0]; c = K[1]; var v = (y ? A / y : 10); var w = parseInt(O.width, 10); if (w + 4 > H) { w = H - 4 } var o = Math.floor((H - w) / 2); var r = (O.gradient ? O.gradient : false); if (!N) { this._drawLine(D, l.x, h.y + 0.5, h.x, h.y + 0.5, "#000000", 1) } for (var J = 0; J < S.length; J++) { var C = parseFloat(O.value(S[J] || 0)); if (this._logScaleCalc) { C = this._log10(C) } L = l.x + o + J * H; var q = Q && C < 0; if (!E) { g = a - 1; S[J].$startY = g; if (Q) { if (q) { g = a + 1 } S[J].$startYN = a + 1 } } else { g = q ? S[J].$startYN : S[J].$startY } if (!C) { continue } if (!E && !Q) { C -= x } C *= c; if (g < (l.y + 1)) { continue } if (O.yAxis && C === 0) { this.canvases.y.renderTextAt(true, true, L + Math.floor(w / 2), g, this._settings.label(S[J])); continue } var F = this._settings.color.call(this, S[J]); var u = Math.abs(g - (Q ? (h.y + x * v) : h.y)) < 3; D.globalAlpha = O.alpha.call(this, S[J]); D.fillStyle = D.strokeStyle = O.color.call(this, S[J]); D.beginPath(); var e = g - v * C + (u ? (q ? -1 : 1) : 0); var I = this._setStakedBarPoints(D, L - (O.border ? 0.5 : 0), g, w + (O.border ? 0.5 : 0), e, 0, l.y); D.fill(); D.stroke(); if (r) { D.save(); var s = this._setBarGradient(D, L, g, L + w, I[1], r, F, "y"); D.fillStyle = s.gradient; D.beginPath(); I = this._setStakedBarPoints(D, L + s.offset, g, w - s.offset * 2, e, (O.border ? 1 : 0), l.y); D.fill(); D.restore() } if (O.border) { D.save(); if (typeof O.border == "string") { D.strokeStyle = O.border } else { this._setBorderStyles(D, F) } D.beginPath(); this._setStakedBarPoints(D, L - 0.5, parseInt(g, 10) + 0.5, w + 1, parseInt(e, 10) + 0.5, 0, l.y, u); D.stroke(); D.restore() } D.globalAlpha = 1; this.canvases[E].renderTextAt(false, true, L + Math.floor(w / 2), (I[1] + (g - I[1]) / 2) - 7, this._settings.label(S[J])); P.addRect(S[J].id, [L - l.x, I[1] - l.y, I[0] - l.x, S[J][q ? "$startYN" : "$startY"] - l.y], E); S[J][q ? "$startYN" : "$startY"] = I[1] } }, _setStakedBarPoints: function(q, c, n, r, m, g, e, h) { q.moveTo(c, n); if (m < e) { m = e } q.lineTo(c, m); var a = c + r; var l = m; q.lineTo(a, l); var o = c + r; q.lineTo(o, n); if (!h) { q.lineTo(c, n) } return [o, l] } }; dhtmlx.chart.line = { pvt_render_line: function(m, A, h, g, n, x) { var w, o, l, u, s, r, q, c, a, e, y, v; u = this._calculateLineParams(m, A, h, g, n); w = this._settings; if (A.length) { s = (w.offset ? h.x + u.cellWidth * 0.5 : h.x); l = []; for (o = 0; o < A.length; o++) { v = this._getPointY(A[o], h, g, u); if (v) { q = ((!o) ? s : u.cellWidth * o - 0.5 + s); a = (typeof v == "object" ? v.y0 : v); if (o && this._settings.fixOverflow) { y = this._getPointY(A[o - 1], h, g, u); if (y.out && y.out == v.out) { continue } r = u.cellWidth * (o - 1) - 0.5 + s; c = (typeof y == "object" ? y.y0 : y); if (y.out) { e = (y.out == "min" ? g.y : h.y); l.push({ x: this._calcOverflowX(r, q, c, a, e), y: e }) } if (v.out) { e = (v.out == "min" ? g.y : h.y); l.push({ x: this._calcOverflowX(r, q, c, a, e), y: e }) } } if (!v.out) { l.push({ x: q, y: v, index: o }) } } } this._mapStart = h; for (o = 1; o <= l.length; o++) { r = l[o - 1].x; c = l[o - 1].y; if (o < l.length) { q = l[o].x; a = l[o].y; this._drawLine(m, r, c, q, a, w.line.color.call(this, A[o - 1]), w.line.width); if (w.line && w.line.shadow) { m.globalAlpha = 0.3; this._drawLine(m, r + 2, c + w.line.width + 8, q + 2, a + w.line.width + 8, "#eeeeee", w.line.width + 3); m.globalAlpha = 1 } } if (typeof l[o - 1].index != "undefined") { this._drawItem(m, r, c, A[l[o - 1].index], w.label(A[l[o - 1].index]), n, x, h) } } } }, _calcOverflowX: function(c, a, g, e, h) { return c + (h - g) * (a - c) / (e - g) }, _drawItem: function(u, e, s, o, r, q, c) { var g = this._settings.item; var n = parseInt(g.radius.call(this, o), 10) || 0; var m = this._mapStart; if (n) { u.save(); if (g.shadow) { u.lineWidth = 1; u.strokeStyle = "#bdbdbd"; u.fillStyle = "#bdbdbd"; var a = [0.1, 0.2, 0.3]; for (var l = (a.length - 1); l >= 0; l--) { u.globalAlpha = a[l]; u.strokeStyle = "#d0d0d0"; u.beginPath(); this._strokeChartItem(u, e, s + 2 * n / 3, n + l + 1, g.type); u.stroke() } u.beginPath(); u.globalAlpha = 0.3; u.fillStyle = "#bdbdbd"; this._strokeChartItem(u, e, s + 2 * n / 3, n + 1, g.type); u.fill() } u.restore(); if (g.type == "image" && g.src) { this._drawImage(u, e - n, s - n, g.src, n * 2, n * 2) } else { u.lineWidth = g.borderWidth; u.fillStyle = g.color.call(this, o); u.strokeStyle = g.borderColor.call(this, o); u.globalAlpha = g.alpha.call(this, o); u.beginPath(); this._strokeChartItem(u, e, s, n + 1, g.type); u.fill(); u.stroke(); u.globalAlpha = 1 } } if (r) { this.canvases[q].renderTextAt(false, true, e, s - n - this._settings.labelOffset, this._settings.label.call(this, o)) } var h = (this._settings.eventRadius || n + 1); c.addRect(o.id, [e - h - m.x, s - h - m.y, e + h - m.x, s + h - m.y], q) }, _drawImage: function(e, c, n, l, g, a) { var h = document.createElement("img"); h.style.display = "none"; h.style.width = g + "px"; h.style.height = a + "px"; document.body.appendChild(h); h.src = l; var m = function() { e.drawImage(h, c, n) }; if (h.complete) { m(h) } else { h.onload = m } }, _strokeChartItem: function(a, c, h, g, e) { var l = []; c = parseInt(c, 10); h = parseInt(h, 10); if (e && (e == "square" || e == "s")) { g *= Math.sqrt(2) / 2; l = [ [c - g - a.lineWidth / 2, h - g], [c + g, h - g], [c + g, h + g], [c - g, h + g], [c - g, h - g] ] } else { if (e && (e == "diamond" || e == "d")) { var m = (a.lineWidth > 1 ? a.lineWidth * Math.sqrt(2) / 4 : 0); l = [ [c, h - g], [c + g, h], [c, h + g], [c - g, h], [c + m, h - g - m] ] } else { if (e && (e == "triangle" || e == "t")) { l = [ [c, h - g], [c + Math.sqrt(3) * g / 2, h + g / 2], [c - Math.sqrt(3) * g / 2, h + g / 2], [c, h - g] ] } else { l = [ [c, h, g, 0, Math.PI * 2, true] ] } } } this._path(a, l) }, _getPointY: function(e, n, l, a) { var m = a.minValue; var g = a.maxValue; var q = a.unit; var c = a.valueFactor; var o = this._settings.value(e); var r = (parseFloat(o || 0) - m) * c; if (!this._settings.yAxis) { r += a.startValue / q } var h = l.y - q * r; if (this._settings.fixOverflow && (this._settings.view == "line" || this._settings.view == "area")) { if (o > g) { h = { y: n.y, y0: h, out: "max" } } else { if (r < 0 || o < m) { h = { y: l.y, y0: h, out: "min" } } } } else { if (o > g) { h = n.y } if (r < 0 || o < m) { h = l.y } } return h }, _calculateLineParams: function(o, g, m, l, h) { var c = {}; var q; c.totalHeight = l.y - m.y; c.cellWidth = (l.x - m.x) / ((!this._settings.offset) ? (g.length - 1) : g.length); var e = !!this._settings.yAxis; var a = (this._settings.view.indexOf("stacked") != -1 ? this._getStackedLimits(g) : this._getLimits()); c.maxValue = a.max; c.minValue = a.min; if (!h) { this._drawScales(g, m, l, c.minValue, c.maxValue, c.cellWidth) } if (e) { c.maxValue = parseFloat(this._settings.yAxis.end); c.minValue = parseFloat(this._settings.yAxis.start) } var n = this._getRelativeValue(c.minValue, c.maxValue); q = n[0]; c.valueFactor = n[1]; c.unit = (q ? c.totalHeight / q : 10); c.startValue = 0; if (!e) { c.startValue = 10; if (c.unit != c.totalHeight) { c.unit = (q ? (c.totalHeight - c.startValue) / q : 10) } } return c } }; dhtmlx.chart.bar = { pvt_render_bar: function(C, S, l, h, D, Q) { var v, F, J, o, O, w, x, c, K, y, u, N, q, P = h.y - l.y; q = !!this._settings.yAxis; N = !!this._settings.xAxis; o = this._getLimits(); O = o.max; w = o.min; F = (h.x - l.x) / S.length; if (!D && !(this._settings.origin != "auto" && !q)) { this._drawScales(S, l, h, w, O, F) } if (q) { O = parseFloat(this._settings.yAxis.end); w = parseFloat(this._settings.yAxis.start) } K = this._getRelativeValue(w, O); x = K[0]; c = K[1]; u = (x ? P / x : x); if (!q && !(this._settings.origin != "auto" && N)) { y = 10; u = (x ? (P - y) / x : y) } if (!D && (this._settings.origin != "auto" && !q) && this._settings.origin > w) { this._drawXAxis(C, S, l, h, F, h.y - u * (this._settings.origin - w)) } v = parseInt(this._settings.width, 10); var M = 0; var I = 0; for (J = 0; J < this._series.length; J++) { if (J == D) { I = M } if (this._series[J].view == "bar") { M++ } } var n = this._settings.seriesMargin; var g = this._settings.seriesPadding; if (this._series && (v * M + g + (M > 2 ? n * M : 0) > F)) { v = F / M - g - (M > 2 ? n : 0) } var r = (F - v * M - n * (M - 1)) / 2; if (this._settings.border) { v = parseInt(v, 10); r = parseInt(r, 10) } var m = (typeof this._settings.radius != "undefined" ? parseInt(this._settings.radius, 10) : Math.round(v / 5)); var s = false; var a = this._settings.gradient; if (a && typeof(a) != "function") { s = a; a = false } else { if (a) { a = C.createLinearGradient(0, h.y, 0, l.y); this._settings.gradient(a) } } if (!N) { this._drawLine(C, l.x, h.y + 0.5, h.x, h.y + 0.5, "#000000", 1) } for (J = 0; J < S.length; J++) { var A = parseFloat(this._settings.value(S[J]) || 0); if (isNaN(A)) { continue } if (A > O) { A = O } A -= w; A *= c; var L = l.x + r + (M > 2 ? n * I : 0) + J * F + v * I; var e = h.y; if (A < 0 || (this._settings.yAxis && A === 0 && !(this._settings.origin != "auto" && this._settings.origin > w))) { this.canvases[D].renderTextAt(true, true, L + Math.floor(v / 2), e, this._settings.label(S[J])); continue } if (!q && !(this._settings.origin != "auto" && N)) { A += y / u } var E = a || this._settings.color.call(this, S[J]); C.globalAlpha = this._settings.alpha.call(this, S[J]); var H = this._drawBar(C, l, L, e, v, w, m, u, A, E, a, s); if (s) { this._drawBarGradient(C, L, e, v, w, m, u, A, E, s) } if (this._settings.border) { this._drawBarBorder(C, L, e, v, w, m, u, A, E) } C.globalAlpha = 1; if (H[0] != L) { this.canvases[D].renderTextAt(false, true, L + Math.floor(v / 2), H[1], this._settings.label(S[J])) } else { this.canvases[D].renderTextAt(true, true, L + Math.floor(v / 2), H[3], this._settings.label(S[J])) } Q.addRect(S[J].id, [L - l.x, H[3] - l.y, H[2] - l.x, H[1] - l.y], D) } }, _correctBarParams: function(n, h, e, l, m, o, g) { var a = this._settings.xAxis; var c = e; if (!!a && this._settings.origin != "auto" && (this._settings.origin > g)) { e -= (this._settings.origin - g) * m; c = e; l = l - (this._settings.origin - g); if (l < 0) { l *= (-1); n.translate(h + o, e); n.rotate(Math.PI); h = 0; e = 0 } e -= 0.5 } return { value: l, x0: h, y0: e, start: c } }, _drawBar: function(u, h, A, g, o, q, l, n, s, v, a, m) { var w; u.save(); u.fillStyle = v; var r = this._correctBarParams(u, A, g, s, n, o, q); if (n * r.value > 0) { w = this._setBarPoints(u, r.x0, r.y0, o, l, n, r.value, (this._settings.border ? 1 : 0)) } else { w = [r.x0, r.y0] } if (a && !m) { u.lineTo(r.x0 + (this._settings.border ? 1 : 0), h.y) } u.fill(); u.restore(); var y = r.x0; var x = (r.x0 != A ? A + w[0] : w[0]); var e = (r.x0 != A ? (r.start - w[1] - r.y0) : r.y0); var c = (r.x0 != A ? r.start - r.y0 : w[1]); return [y, e, x, c] }, _drawBarBorder: function(o, c, m, q, h, g, n, l, e) { var a; o.save(); a = this._correctBarParams(o, c, m, l, n, q, h); this._setBorderStyles(o, e); if (n * a.value > 0) { this._setBarPoints(o, a.x0, a.y0, q, g, n, a.value, o.lineWidth / 2, 1) } o.stroke(); o.restore() }, _drawBarGradient: function(s, g, q, u, n, m, r, o, h, c) { s.save(); var e = this._correctBarParams(s, g, q, o, r, u, n); var l = this._setBarGradient(s, e.x0, e.y0, e.x0 + u, e.y0 - r * e.value + 2, c, h, "y"); var a = this._settings.border ? 1 : 0; s.fillStyle = l.gradient; if (r * e.value > 0) { this._setBarPoints(s, e.x0 + l.offset, e.y0, u - l.offset * 2, m, r, e.value, l.offset + a) } s.fill(); s.restore() }, _setBarPoints: function(w, g, s, x, n, u, r, h, m) { w.beginPath(); var c = 0; if (n > u * r) { var l = (n - u * r) / n; if (l <= 1 && l >= -1) { c = -Math.acos(l) + Math.PI / 2 } } w.moveTo(g + h, s); var q = s - Math.floor(u * r) + n + (n ? 0 : h); if (n < u * r) { w.lineTo(g + h, q) } var e = g + n; if (n && n > 0) { w.arc(e, q, n - h, -Math.PI + c, -Math.PI / 2, false) } var a = g + x - n - h; var o = q - n + (n ? h : 0); w.lineTo(a, o); if (n && n > 0) { w.arc(a, q, n - h, -Math.PI / 2, 0 - c, false) } var v = g + x - h; w.lineTo(v, s); if (!m) { w.lineTo(g + h, s) } return [v, o] } }; dhtmlx.chart.pie = { pvt_render_pie: function(c, g, a, l, e, h) { this._renderPie(c, g, a, l, 1, h, e) }, _renderPie: function(s, F, h, g, D, E, u) { if (!F.length) { return } var v = this._getPieParameters(h, g); var m = (this._settings.radius ? this._settings.radius : v.radius); if (m < 0) { return } var a = this._getValues(F); var l = this._getTotalValue(a); var n = this._getRatios(a, l); var C = (this._settings.x ? this._settings.x : v.x); var e = (this._settings.y ? this._settings.y : v.y); if (D == 1 && this._settings.shadow) { this._addShadow(s, C, e, m) } e = e / D; var r = -Math.PI / 2; var q; var x = []; s.scale(1, D); if (this._settings.gradient) { var A = (D != 1 ? C + m / 3 : C); var c = (D != 1 ? e + m / 3 : e); this._showRadialGradient(s, C, e, m, A, c) } if (this._settings.labelLines) { this._labelMargins = this._getLabelMargins(n, m) } for (var y = 0; y < F.length; y++) { if (!a[y]) { continue } s.strokeStyle = (F.length == 1 ? this._settings.color.call(this, F[y]) : this._settings.lineColor.call(this, F[y])); s.beginPath(); s.moveTo(C, e); x.push(r); q = -Math.PI / 2 + n[y] - 0.0001; s.arc(C, e, m, r, q, false); s.lineTo(C, e); var w = this._settings.color.call(this, F[y]); s.fillStyle = w; s.fill(); if (this._settings.pieInnerText) { this._drawSectorLabel(C, e, 5 * m / 6, r, q, D, this._settings.pieInnerText(F[y], l), true) } if (this._settings.label) { this._drawSectorLabel(C, e, m, r, q, D, this._settings.label(F[y]), 0, (this._labelMargins ? this._labelMargins[y] : {}), s) } if (D != 1) { this._createLowerSector(s, C, e, r, q, m, true); s.fillStyle = "#000000"; s.globalAlpha = 0.2; this._createLowerSector(s, C, e, r, q, m, false); s.globalAlpha = 1; s.fillStyle = w } E.addSector(F[y].id, r, q, C - h.x, e - h.y / D, m, D, u); r = q } s.globalAlpha = 0.8; var o; if (x.length > 1) { for (y = 0; y < x.length; y++) { o = this._getPositionByAngle(x[y], C, e, m); this._drawLine(s, C, e, o.x, o.y, this._settings.lineColor.call(this, F[y]), 2) } } if (D == 1) { s.lineWidth = 2; s.strokeStyle = "#ffffff"; s.beginPath(); s.arc(C, e, m + 1, 0, 2 * Math.PI, false); s.stroke() } s.globalAlpha = 1; s.scale(1, 1 / D) }, _getLabelMargins: function(v, l) { var D, C, J, I, a = [], w = []; var M = { 1: [0] }; for (J = 1; J < v.length; J++) { D = -Math.PI / 2 + (J > 1 ? (v[J - 1] - (v[J - 1] - v[J - 2]) / 2) : v[J - 1] / 2); C = -Math.PI / 2 + v[J] - (v[J] - v[J - 1]) / 2; var h = Math.cos(C); var y = Math.sin(C); var m = Math.cos(D); var A = Math.sin(D); var E = Math.round((l + 8) * Math.abs(Math.sin(C) - Math.sin(D))); var s = (h < 0 ? (y < 0 ? 4 : 3) : (y < 0 ? 1 : 2)); var u = (m < 0 ? (A < 0 ? 4 : 3) : (A < 0 ? 1 : 2)); if (!M[s]) { M[s] = [] } M[s].push(u == s ? E : 0) } var F = []; var L = 0; for (var x in M) { var g = 0; var e = M[x].length; var o = 0; var n = 0; if (x == 1 || x == 3) { I = x - 1; var K = 0; while (I > 0) { if (M[I]) { K += M[I].length } I-- } F[K + M[x].length - 1] = { y: 0, x: 0 }; var I = M[x].length - 2; while (I >= 0) { if ((o || I) && M[x][I + 1] - o < 18) { o += 18 - M[x][I + 1] } else { o = 0 } F[K + I] = { y: o * (x == 1 ? -1 : 1) }; I-- } for (var H = F.length - M[x].length; H < F.length; H++) { if (F[H]["y"] != 0) { n += 6; F[H]["x"] = n } else { F[H]["x"] = 0; n = 0 } } } else { var I = 1; F.push({ y: 0, x: 0 }); while (I < M[x].length) { if (M[x][I] - o < 18) { o += 18 - M[x][I] } else { o = 0 } F.push({ y: o * (x == 4 ? -1 : 1) }); I++ } for (var H = F.length - 1; H >= F.length - M[x].length; H--) { if (F[H]["y"] != 0) { n += 8; F[H]["x"] = n } else { n = 0; F[H]["x"] = 0 } } } } return F }, _getValues: function(e) { var a = []; for (var c = 0; c < e.length; c++) { a.push(parseFloat(this._settings.value(e[c]) || 0)) } return a }, _getTotalValue: function(a) { var e = 0; for (var c = 0; c < a.length; c++) { e += a[c] } return e }, _getRatios: function(c, a) { var l; var h = []; var g = 0; a = a || this._getTotalValue(c); for (var e = 0; e < c.length; e++) { l = c[e]; h[e] = Math.PI * 2 * (a ? ((l + g) / a) : (1 / c.length)); g += l } return h }, _getPieParameters: function(m, h) { var g = h.x - m.x; var c = h.y - m.y; var e = m.x + g / 2; var l = m.y + c / 2; var a = Math.min(g / 2, c / 2); return { x: e, y: l, radius: a } }, _createLowerSector: function(g, h, m, e, a, l, c) { g.lineWidth = 1; if (!((e <= 0 && a >= 0) || (e >= 0 && a <= Math.PI) || (Math.abs(e - Math.PI) > 0.003 && e <= Math.PI && a >= Math.PI))) { return } if (e <= 0 && a >= 0) { e = 0; c = false; this._drawSectorLine(g, h, m, l, e, a) } if (e <= Math.PI && a >= Math.PI) { a = Math.PI; c = false; this._drawSectorLine(g, h, m, l, e, a) } var n = (this._settings.height || Math.floor(l / 4)) / this._settings.cant; g.beginPath(); g.arc(h, m, l, e, a, false); g.lineTo(h + l * Math.cos(a), m + l * Math.sin(a) + n); g.arc(h, m + n, l, a, e, true); g.lineTo(h + l * Math.cos(e), m + l * Math.sin(e)); g.fill(); if (c) { g.stroke() } }, _drawSectorLine: function(e, g, l, h, c, a) { e.beginPath(); e.arc(g, l, h, c, a, false); e.stroke() }, _addShadow: function(c, a, l, g) { c.globalAlpha = 0.5; var h = ["#c4c4c4", "#c6c6c6", "#cacaca", "#dcdcdc", "#dddddd", "#e0e0e0", "#eeeeee", "#f5f5f5", "#f8f8f8"]; for (var e = h.length - 1; e > -1; e--) { c.beginPath(); c.fillStyle = h[e]; c.arc(a + 1, l + 1, g + e, 0, Math.PI * 2, true); c.fill() } c.globalAlpha = 1 }, _getGrayGradient: function(a) { a.addColorStop(0, "#ffffff"); a.addColorStop(0.7, "#7a7a7a"); a.addColorStop(1, "#000000"); return a }, _showRadialGradient: function(e, c, m, a, g, h) { e.beginPath(); var l; if (typeof this._settings.gradient != "function") { l = e.createRadialGradient(g, h, a / 4, c, m, a); l = this._getGrayGradient(l) } else { l = this._settings.gradient(l) } e.fillStyle = l; e.arc(c, m, a, 0, Math.PI * 2, true); e.fill(); e.globalAlpha = 0.7 }, _drawSectorLabel: function(M, g, m, E, D, N, A, a, C, H) { var w = this.canvases[0].renderText(0, 0, A, 0, 1); if (!w) { return } var O = w.scrollWidth; w.style.width = O + "px"; if (O > M) { O = M } var F = (D - E < 0.2 ? 4 : 8); if (a) { F = O / 1.8 } var l = E + (D - E) / 2; var h = m; m = (a ? 5 * m / 6 : m + this._settings.labelOffset); m = m - (F - 8) / 2; var r = -F; var q = -8; var I = "right"; if (l >= Math.PI / 2 && l < Math.PI || l <= 3 * Math.PI / 2 && l >= Math.PI) { r = -O - r; I = "left" } var n = 0; if (!a && N < 1 && (l > 0 && l < Math.PI)) { n = (this._settings.height || Math.floor(m / 4)) / N } var s = (g + Math.floor(m + n) * Math.sin(l)) * N + q; var u = M + Math.floor(m + F / 2) * Math.cos(l) + r; var o = (D < Math.PI / 2 + 0.01); var v = (E < Math.PI / 2); if (v && o) { u = Math.max(u, M + 3) } else { if (!v && !o) { u = Math.min(u, M - O) } else { if (!a && !this._settings.labelLines && (l >= Math.PI / 2 && l < Math.PI || l <= 3 * Math.PI / 2 && l >= Math.PI)) { u += O / 3 } } } if (this._settings.labelLines && !a) { var J = Math.abs((Math.abs(C || 0) + Math.abs(h * Math.sin(l))) / Math.sin(l)); if (C.y) { s += C.y } if (I == "left") { u -= C.x } else { u += C.x } H.beginPath(); H.strokeStyle = "#555"; var L = M + h * Math.cos(l); var e = g + h * Math.sin(l); H.moveTo(L, e); var K = u - (I == "left" ? r - 8 : 2); var c = s; if (I == "left" && K > L) { K = L - Math.abs(c - e + 16) / Math.tan(l - Math.PI); c = c + 16; if (l < Math.PI) { c -= 8 } } else { c += 8 } H.lineTo(K, c); H.lineTo(K + (I == "left" ? -5 : 5), c); H.stroke(); s = c - 8; u = K + r + (I == "left" ? -15 : 15) } w.style.top = s + "px"; w.style.left = u + "px"; w.style.width = O + "px"; w.style.textAlign = I; w.style.whiteSpace = "nowrap" } }; dhtmlx.chart.pie3D = { pvt_render_pie3D: function(c, g, a, l, e, h) { this._renderPie(c, g, a, l, this._settings.cant, h) } }; dhtmlx.chart.donut = { pvt_render_donut: function(s, h, q, o, m, c) { if (!h.length) { return } this._renderPie(s, h, q, o, 1, c); var g = this._settings; var l = this._getPieParameters(q, o); var a = (g.radius ? g.radius : l.radius); var n = ((g.innerRadius && (g.innerRadius < a)) ? g.innerRadius : a / 3); var e = (g.x ? g.x : l.x); var r = (g.y ? g.y : l.y); s.fillStyle = "#ffffff"; s.beginPath(); s.arc(e, r, n, 0, Math.PI * 2, true); s.fill() } }; dhtmlx.DataDriver.dhtmlxgrid = { _grid_getter: "_get_cell_value", toObject: function(a) { this._grid = a; return a }, getRecords: function(a) { return a.rowsBuffer }, getDetails: function(e) { var a = {}; for (var c = 0; c < this._grid.getColumnsNum(); c++) { a["data" + c] = this._grid[this._grid_getter](e, c) } return a }, getInfo: function(a) { return { _size: 0, _from: 0 } } }; dhtmlx.ui.Canvas = function(c, e, h) { this._canvas_labels = []; this._canvas_name = e; this._obj = c; var g = c.offsetWidth * (window.devicePixelRatio || 1); var a = c.offsetHeight * (window.devicePixelRatio || 1); var h = h || ""; h += ";width:" + c.offsetWidth + "px;height:" + c.offsetHeight + "px;"; this._prepareCanvas(e, h, g, a) }; dhtmlx.ui.Canvas.prototype = { _prepareCanvas: function(c, g, e, a) { this._canvas = dhtmlx.html.create("canvas", { width: e, height: a, canvas_id: c, style: (g || "") }); this._obj.appendChild(this._canvas); if (!this._canvas.getContext) { if (dhtmlx._isIE) { dhtmlx.require("thirdparty/excanvas/excanvas.js"); G_vmlCanvasManager.init_(document); G_vmlCanvasManager.initElement(this._canvas) } else { dhtmlx.error("Canvas is not supported in the current browser") } } return this._canvas }, getCanvas: function(c) { var a = (this._canvas || this._prepareCanvas()).getContext(c || "2d"); if (!this._dhtmlxDevicePixelRatio) { this._dhtmlxDevicePixelRatio = 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._dhtmlxDevicePixelRatio = false } }, renderText: function(a, l, h, g, c) { if (!h) { return } var e = dhtmlx.html.create("DIV", { "class": "dhx_canvas_text" + (g ? (" " + g) : ""), style: "left:" + a + "px; top:" + l + "px;" }, h); this._obj.appendChild(e); this._canvas_labels.push(e); if (c) { e.style.width = c + "px" } return e }, renderTextAt: function(h, o, a, n, g, m, e) { var l = this.renderText.call(this, a, n, g, m, e); if (l) { if (h) { if (h == "middle") { l.style.top = parseInt(n - l.offsetHeight / 2, 10) + "px" } else { l.style.top = n - l.offsetHeight + "px" } } if (o) { if (o == "left") { l.style.left = a - l.offsetWidth + "px" } else { l.style.left = parseInt(a - l.offsetWidth / 2, 10) + "px" } } } return l }, clearCanvas: function(a) { var c = [], e; for (e = 0; e < this._canvas_labels.length; e++) { this._obj.removeChild(this._canvas_labels[e]) } this._canvas_labels = []; if (!a && this._obj._htmlmap) { c = this._getMapAreas(); while (c.length) { c[0].parentNode.removeChild(c[0]); c.splice(0, 1) } c = null; if (!this._obj._htmlmap.getElementsByTagName("AREA").length) { this._obj._htmlmap.parentNode.removeChild(this._obj._htmlmap); this._obj._htmlmap = null } } this.getCanvas().clearRect(0, 0, this._canvas.width, this._canvas.height) }, toggleCanvas: function() { this._toggleCanvas(this._canvas.style.display == "none") }, showCanvas: function() { this._toggleCanvas(true) }, hideCanvas: function() { this._toggleCanvas(false) }, _toggleCanvas: function(a) { var c, e; for (e = 0; e < this._canvas_labels.length; e++) { this._canvas_labels[e].style.display = (a ? "" : "none") } if (this._obj._htmlmap) { c = this._getMapAreas(); for (e = 0; e < c.length; e++) { if (a) { c[e].removeAttribute("disabled") } else { c[e].setAttribute("disabled", "true") } } } this._canvas.style.display = (a ? "" : "none") }, _getMapAreas: function() { var e = [], a, c; a = this._obj._htmlmap.getElementsByTagName("AREA"); for (c = 0; c < a.length; c++) { if (a[c].getAttribute("userdata") == this._canvas_name) { e.push(a[c]) } } return e } }; dhtmlXChart = function(a) { this.name = "Chart"; if (dhtmlx.assert_enabled()) { this._assert() } dhtmlx.extend(this, dhtmlx.Settings); this._parseContainer(a, "dhx_chart"); dhtmlx.extend(this, dhtmlx.AtomDataLoader); dhtmlx.extend(this, dhtmlx.DataLoader); this.data.provideApi(this, true); dhtmlx.extend(this, dhtmlx.EventSystem); dhtmlx.extend(this, dhtmlx.MouseEvents); dhtmlx.destructors.push(this); 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: {}, destructor: function() { dhtmlx.Destruction.destructor.apply(this, arguments); if (this.canvases) { for (var a in this.canvases) { this.canvases[a]._obj = null; this.canvases[a] = null } this.canvases = null } if (this.legendObj) { this.legendObj.innerHTML = ""; this.legendObj = null } if (this.config.tooltip) { this.config.tooltip._obj = null; this.config.tooltip._dataobj = null } }, bind: function() { dhtmlx.BaseBind.legacyBind.apply(this, arguments) }, sync: function() { dhtmlx.BaseBind.legacySync.apply(this, arguments) }, resize: function() { for (var a in this.canvases) { this.canvases[a]._resizeCanvas() } this.render() }, view_setter: function(a) { if (!dhtmlx.chart[a]) { dhtmlx.error("Chart type extension is not loaded: " + a) } if (typeof this._settings.offset == "undefined") { this._settings.offset = !(a == "area" || a == "stackedArea") } if (a == "radar" && !this._settings.yAxis) { this.define("yAxis", {}) } if (a == "scatter") { if (!this._settings.yAxis) { this.define("yAxis", {}) } if (!this._settings.xAxis) { this.define("xAxis", {}) } } return a }, clearCanvas: function() { if (this.canvases && typeof this.canvases == "object") { for (var a in this.canvases) { this.canvases[a].clearCanvas() } } }, render: function() { var e, c, g, h, a; if (!this.callEvent("onBeforeRender", [this.data])) { return } if (this.canvases && typeof this.canvases == "object") { for (c in this.canvases) { this.canvases[c].clearCanvas() } } else { this.canvases = {} } if (this._settings.legend) { if (!this.canvases.legend) { this.canvases.legend = new dhtmlx.ui.Canvas(this._obj, "legend") } this._drawLegend(this.data.getRange(), this._obj.offsetWidth) } e = this._getChartBounds(this._obj.offsetWidth, this._obj.offsetHeight); this._map = h = new dhtmlx.ui.Map(this._id); a = this._settings; g = this._getChartData(); for (c = 0; c < this._series.length; c++) { this._settings = this._series[c]; if (!this.canvases[c]) { this.canvases[c] = new dhtmlx.ui.Canvas(this._obj, c, "z-index:" + (2 + c)) } this["pvt_render_" + this._settings.view](this.canvases[c].getCanvas(), g, e.start, e.end, c, h) } h.render(this._obj); this._obj.lastChild.style.zIndex = 1000; this._applyBounds(this._obj.lastChild, e); this.callEvent("onAfterRender", []); this._settings = a }, _applyBounds: function(e, c) { var a = {}; a.left = c.start.x; a.top = c.start.y; a.width = c.end.x - c.start.x; a.height = c.end.y - c.start.y; for (var g in a) { e.style[g] = a[g] + "px" } }, _getChartData: function() { var g, m, e, h, l, q, a, n, o, c; h = this.data.getRange(); g = (this._settings.view.toLowerCase().indexOf("barh") != -1 ? "yAxis" : "xAxis"); m = this._settings[g]; if (m && m.units && (typeof m.units == "object")) { e = m.units; n = []; if (typeof e.start != "undefined" && typeof e.end != "undefined" && typeof e.next != "undefined") { a = e.start; while (a <= e.end) { n.push(a); a = e.next.call(this, a) } } else { if (Object.prototype.toString.call(e) === "[object Array]") { n = e } } q = []; if (n.length) { o = m.value; c = {}; for (l = 0; l < h.length; l++) { c[o(h[l])] = l } for (l = 0; l < n.length; l++) { if (typeof c[n[l]] != "undefined") { h[c[n[l]]].$unit = n[l]; q.push(h[c[n[l]]]) } else { q.push({ $unit: n[l] }) } } } return q } return h }, value_setter: dhtmlx.Template.obj_setter, xValue_setter: dhtmlx.Template.obj_setter, yValue_setter: function(a) { this.define("value", a) }, alpha_setter: dhtmlx.Template.obj_setter, label_setter: dhtmlx.Template.obj_setter, lineColor_setter: dhtmlx.Template.obj_setter, borderColor_setter: dhtmlx.Template.obj_setter, pieInnerText_setter: dhtmlx.Template.obj_setter, gradient_setter: function(a) { if ((typeof(a) != "function") && a && (a === true)) { a = "light" } return a }, colormap: { RAINBOW: function(a) { var c = Math.floor(this.indexById(a.id) / this.dataCount() * 1536); if (c == 1536) { c -= 1 } return this._rainbow[Math.floor(c / 256)](c % 256) } }, color_setter: function(a) { return this.colormap[a] || dhtmlx.Template.obj_setter(a) }, fill_setter: function(a) { return ((!a || a == 0) ? false : dhtmlx.Template.obj_setter(a)) }, definePreset: function(a) { this.define("preset", a.preset); delete a.preset }, preset_setter: function(h) { var e, c, g; this.defaults = dhtmlx.extend({}, this.defaults); if (typeof dhtmlx.presets.chart[h] == "object") { g = dhtmlx.presets.chart[h]; for (e in g) { if (typeof g[e] == "object") { if (!this.defaults[e] || typeof this.defaults[e] != "object") { this.defaults[e] = dhtmlx.extend({}, g[e]) } else { this.defaults[e] = dhtmlx.extend({}, this.defaults[e]); for (c in g[e]) { this.defaults[e][c] = g[e][c] } } } else { this.defaults[e] = g[e] } } return h } return false }, legend_setter: function(a) { if (!a) { if (this.legendObj) { this.legendObj.innerHTML = ""; this.legendObj = null } return false } if (typeof(a) != "object") { a = { template: a } } this._mergeSettings(a, { width: 150, height: 18, layout: "y", align: "left", valign: "bottom", template: "", toggle: (this._settings.view.toLowerCase().indexOf("stacked") != -1 ? "" : "hide"), marker: { type: "square", width: 15, height: 15, radius: 3 }, margin: 4, padding: 3 }); a.template = dhtmlx.Template.setter(a.template); return a }, defaults: { color: "RAINBOW", alpha: "1", label: false, value: "{obj.value}", padding: {}, view: "pie", lineColor: "#ffffff", cant: 0.5, width: 30, labelWidth: 100, line: { width: 2, color: "#1293f8" }, seriesMargin: 1, seriesPadding: 4, item: { radius: 3, borderColor: "#636363", borderWidth: 1, color: "#ffffff", alpha: 1, type: "r", shadow: false }, shadow: true, gradient: false, border: true, labelOffset: 20, origin: "auto" }, item_setter: function(a) { if (typeof(a) != "object") { a = { color: a, borderColor: a } } this._mergeSettings(a, dhtmlx.extend({}, this.defaults.item)); var e = ["alpha", "borderColor", "color", "radius"]; for (var c = 0; c < e.length; c++) { a[e[c]] = dhtmlx.Template.setter(a[e[c]]) } return a }, line_setter: function(a) { if (typeof(a) != "object") { a = { color: a } } dhtmlx.extend(this.defaults.line, a); a = dhtmlx.extend({}, this.defaults.line); a.color = dhtmlx.Template.setter(a.color); return a }, padding_setter: function(a) { if (typeof(a) != "object") { a = { left: a, right: a, top: a, bottom: a } } this._mergeSettings(a, { left: 50, right: 20, top: 35, bottom: 40 }); return a }, xAxis_setter: function(a) { if (!a) { return false } if (typeof(a) != "object") { a = { template: a } } if (!a.value) { a.value = a.template } this._mergeSettings(a, { title: "", color: "#000000", lineColor: "#cfcfcf", template: "{obj}", value: "{obj}", lines: true }); var c = ["lineColor", "template", "lines", "value"]; this._converToTemplate(c, a); this._configXAxis = dhtmlx.extend({}, a); return a }, yAxis_setter: function(a) { if (!a) { return false } this._mergeSettings(a, { title: "", color: "#000000", lineColor: "#cfcfcf", template: "{obj}", lines: true, bg: "#ffffff" }); var c = ["lineColor", "template", "lines", "bg"]; this._converToTemplate(c, a); this._configYAxis = dhtmlx.extend({}, a); return a }, _converToTemplate: function(a, c) { for (var e = 0; e < a.length; e++) { c[a[e]] = dhtmlx.Template.setter(c[a[e]]) } }, _drawScales: function(h, g, e, m, a, c) { var l = 0; if (this._settings.yAxis) { if (!this.canvases.y) { this.canvases.y = new dhtmlx.ui.Canvas(this._obj, "axis_y") } l = this._drawYAxis(this.canvases.y.getCanvas(), h, g, e, m, a) } if (this._settings.xAxis) { if (!this.canvases.x) { this.canvases.x = new dhtmlx.ui.Canvas(this._obj, "axis_x") } this._drawXAxis(this.canvases.x.getCanvas(), h, g, e, c, l) } return l }, _drawXAxis: function(v, l, s, r, g, q) { var e = s.x - 0.5; var u = parseInt((q ? q : r.y), 10) + 0.5; var c = r.x; var m; var a = true; var n = (this._settings.origin === 0 && this._settings.view == "stackedBar") ? r.y + 0.5 : u; for (var h = 0; h < l.length; h++) { if (this._settings.offset === true) { m = e + g / 2 + h * g } else { m = (h == l.length - 1) ? r.x : e + h * g; a = !!h } m = Math.ceil(m) - 0.5; var o = ((this._settings.origin != "auto") && (this._settings.view == "bar") && (parseFloat(this._settings.value(l[h])) < this._settings.origin)); this._drawXAxisLabel(m, n, l[h], a, o); if ((this._settings.offset || h) && this._settings.xAxis.lines.call(this, l[h])) { this._drawXAxisLine(v, m, r.y, s.y, l[h]) } } this.canvases.x.renderTextAt(true, false, e, r.y + this._settings.padding.bottom - 3, this._settings.xAxis.title, "dhx_axis_title_x", r.x - s.x); this._drawLine(v, e, 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(w, D, l, h, n, m) { var o; var u = {}; if (!this._settings.yAxis) { return } var y = l.x - 0.5; var g = h.y; var e = l.y; var v = h.y; if (this._settings.yAxis.step) { o = parseFloat(this._settings.yAxis.step) } if (typeof this._configYAxis.step == "undefined" || typeof this._configYAxis.start == "undefined" || typeof this._configYAxis.end == "undefined") { u = this._calculateScale(n, m); n = u.start; m = u.end; o = u.step; this._settings.yAxis.end = m; this._settings.yAxis.start = n } this._setYAxisTitle(l, h); if (o === 0) { m = n; o = 1 } var a = (m == n ? g - e : (g - e) * o / (m - n)); var A = 0; for (var x = n; x <= m; x += o) { if (u.fixNum) { x = parseFloat((new Number(x)).toFixed(u.fixNum)) } var C = Math.floor(g - A * a) + 0.5; if (!(x == n && this._settings.origin == "auto") && this._settings.yAxis.lines.call(this, x)) { this._drawLine(w, y, C, h.x, C, this._settings.yAxis.lineColor.call(this, x), 1) } if (x == this._settings.origin) { v = C } var q = x; if (o < 1) { var r = Math.min(this._log10(o), (n <= 0 ? 0 : this._log10(n))); r = -this._settings.yAxis.decimalDigits || r; var s = Math.pow(10, -r); q = Math.round(x * s) / s; x = q } this.canvases.y.renderText(0, C - 5, this._settings.yAxis.template(q.toString()), "dhx_axis_item_y", l.x - 5); A++ } this._drawLine(w, y, g + 1, y, e, this._settings.yAxis.color, 1); return v }, _setYAxisTitle: function(e, c) { var a = "dhx_axis_title_y" + (dhtmlx._isIE && dhtmlx._isIE != 9 ? " dhx_ie_filter" : ""); var g = this.canvases.y.renderTextAt("middle", false, 0, parseInt((c.y - e.y) / 2 + e.y, 10), this._settings.yAxis.title, a); if (g) { g.style.left = (dhtmlx.env.transform ? (g.offsetHeight - g.offsetWidth) / 2 : 0) + "px" } }, _calculateScale: function(q, c) { if (this._settings.origin != "auto" && this._settings.origin < q) { q = this._settings.origin } var h, g, m; h = ((c - q) / 8) || 1; var e = Math.floor(this._log10(h)); var a = Math.pow(10, e); var l = h / a; l = (l > 5 ? 10 : 5); h = parseInt(l, 10) * a; if (h > Math.abs(q)) { g = (q < 0 ? -h : 0) } else { var r = Math.abs(q); var o = Math.floor(this._log10(r)); var n = r / Math.pow(10, o); g = Math.ceil(n * 10) / 10 * Math.pow(10, o) - h; if (r > 1 && h > 0.1) { g = Math.ceil(g) } while (q < 0 ? g <= q : g >= q) { g -= h } if (q < 0) { g = -g - 2 * h } } m = g; while (m < c) { m += h; m = parseFloat((new Number(m)).toFixed(Math.abs(e))) } return { start: g, end: m, step: h, fixNum: Math.abs(e) } }, _getLimits: function(c, m) { var n, l; var h = ((arguments.length && c == "h") ? this._configXAxis : this._configYAxis); m = m || "value"; if (h && (typeof h.end != "undefined") && (typeof h.start != "undefined") && h.step) { n = parseFloat(h.end); l = parseFloat(h.start) } else { n = this.max(this._series[0][m]); l = (h && (typeof h.start != "undefined")) ? parseFloat(h.start) : this.min(this._series[0][m]); if (this._series.length > 1) { for (var g = 1; g < this._series.length; g++) { var a = this.max(this._series[g][m]); var e = this.min(this._series[g][m]); if (a > n) { n = a } if (e < l) { l = e } } } } return { max: n, min: l } }, _log10: function(c) { var a = "log"; return Math.floor((Math[a](c) / Math.LN10)) }, _drawXAxisLabel: function(c, l, h, a, g) { if (!this._settings.xAxis) { return } var e = this.canvases.x.renderTextAt(g, a, c, l - (g ? 2 : 0), this._settings.xAxis.template(h)); if (e) { e.className += " dhx_axis_item_x" } }, _drawXAxisLine: function(c, a, g, e, h) { if (!this._settings.xAxis || !this._settings.xAxis.lines) { return } this._drawLine(c, a, g, a, e, this._settings.xAxis.lineColor.call(this, h), 1) }, _drawLine: function(a, g, m, e, h, c, l) { a.strokeStyle = c; a.lineWidth = l; a.beginPath(); a.moveTo(g, m); a.lineTo(e, h); a.stroke(); a.lineWidth = 1 }, _getRelativeValue: function(g, h) { var e, a; var c = 1; if (h != g) { e = h - g } else { e = g } return [e, c] }, _rainbow: [function(a) { return "#FF" + dhtmlx.math.toHex(a / 2, 2) + "00" }, function(a) { return "#FF" + dhtmlx.math.toHex(a / 2 + 128, 2) + "00" }, function(a) { return "#" + dhtmlx.math.toHex(255 - a, 2) + "FF00" }, function(a) { return "#00FF" + dhtmlx.math.toHex(a, 2) }, function(a) { return "#00" + dhtmlx.math.toHex(255 - a, 2) + "FF" }, function(a) { return "#" + dhtmlx.math.toHex(a, 2) + "00FF" }], clearSeries: function() { this._series = [] }, 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(l, a, h) { var g; this._active_serie = (this._series.length == 1 ? a.getAttribute("userdata") : this._getActiveSeries(h)); if (!this._series[this._active_serie]) { return } for (var c = 0; c < this._series.length; c++) { g = this._series[c].tooltip; if (g) { g.disable() } } if (!a.getAttribute("disabled")) { g = this._series[this._active_serie].tooltip; if (g) { g.enable() } } }, _getActiveSeries: function(l) { var o, c, h, g, n, r, q, m; c = this._map._areas; g = dhtmlx.html.offset(this._obj._htmlmap); n = dhtmlx.html.pos(l); q = n.x - g.x; m = n.y - g.y; for (h = 0; h < c.length; h++) { o = c[h].points; if (q <= o[2] && q >= o[0] && m <= o[3] && m >= o[1]) { if (r) { if (c[h].index > r.index) { r = c[h] } } else { r = c[h] } } } return r ? r.index : 0 }, hideSeries: function(a) { this.canvases[a].hideCanvas(); if (this._settings.legend.values && this._settings.legend.values[a]) { this._settings.legend.values[a].$hidden = true } this._drawLegend() }, showSeries: function(a) { this.canvases[a].showCanvas(); if (this._settings.legend.values && this._settings.legend.values[a]) { delete this._settings.legend.values[a].$hidden } this._drawLegend() }, _changeColorSV: function(c, h, a) { var g, e; e = dhtmlx.math.toRgb(c); g = dhtmlx.math.rgbToHsv(e[0], e[1], e[2]); g[1] *= h; g[2] *= a; return "rgb(" + dhtmlx.math.hsvToRgb(g[0], g[1], g[2]) + ")" }, _setBorderStyles: function(a, c) { var g, e; e = dhtmlx.math.toRgb(c); g = dhtmlx.math.rgbToHsv(e[0], e[1], e[2]); g[2] /= 2; c = "rgb(" + dhtmlx.math.hsvToRgb(g[0], g[1], g[2]) + ")"; a.strokeStyle = c; if (a.globalAlpha == 1) { a.globalAlpha = 0.9 } }, _drawLegend: function(h, c) { var 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])) } var e = (r.marker.position == "right" ? v.offsetWidth - r.marker.width : 0); this._drawLegendMarker(w, v.offsetLeft + o + e, v.offsetTop + n, q, v.offsetHeight, g, l) } w.restore(); m = null }, _drawLegendText: function(a, l, c, h) { var g = ""; var e = this._settings.legend; if (e.layout == "x") { g = "float:left;" } var n = e.marker.position; var m = dhtmlx.html.create("DIV", { style: g + "padding-" + (n && n == "right" ? "right" : "left") + ":" + (10 + e.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(A, s, r, h, w, l, n) { var c = []; var m = this._settings.legend.marker; var v = this._settings.legend.values; var q = (v && v[n].markerType ? v[n].markerType : m.type); if (h) { A.fillStyle = h; A.strokeStyle = this._getDarkenColor(h, 0.75) } A.beginPath(); if (q == "round" || !m.radius) { A.lineWidth = m.height; A.lineCap = q; s += A.lineWidth / 2 + 5; r += w / 2; A.moveTo(s, r); var a = s + m.width - m.height + 1; A.lineTo(a, r) } else { if (q == "item") { if (this._settings.line && this._settings.view != "scatter" && !this._settings.disableLines) { A.beginPath(); A.lineWidth = this._series[n].line.width; A.strokeStyle = l ? h : this._series[n].line.color.call(this, {}); var e = s + 5; var u = r + w / 2; A.moveTo(e, u); var a = e + m.width; A.lineTo(a, u); A.stroke() } var g = this._series[n].item; var o = parseInt(g.radius.call(this, {}), 10) || 0; if (o) { if (g.type == "image" && g.src) { this._drawImage(A, s + 5, r + m.height / 2 - 5, g.src, o * 2, o * 2); return } else { A.beginPath(); if (l) { A.lineWidth = g.borderWidth; A.strokeStyle = h; A.fillStyle = h } else { A.lineWidth = g.borderWidth; A.fillStyle = g.color.call(this, {}); A.strokeStyle = g.borderColor.call(this, {}); A.globalAlpha = g.alpha.call(this, {}) } A.beginPath(); s += m.width / 2 + 5; r += w / 2; this._strokeChartItem(A, s, r, o + 1, g.type); A.fill(); A.stroke() } } A.globalAlpha = 1 } else { A.lineWidth = 1; s += 5; r += parseInt(w / 2 - m.height / 2, 10); c = [ [s + m.radius, r + m.radius, m.radius, Math.PI, 3 * Math.PI / 2, false], [s + m.width - m.radius, r], [s + m.width - m.radius, r + m.radius, m.radius, -Math.PI / 2, 0, false], [s + m.width, r + m.height - m.radius], [s + m.width - m.radius, r + m.height - m.radius, m.radius, 0, Math.PI / 2, false], [s + m.radius, r + m.height], [s + m.radius, r + m.height - m.radius, m.radius, Math.PI / 2, Math.PI, false], [s, r + m.radius] ]; this._path(A, c) } } A.stroke(); A.fill() }, _getDarkenColor: function(a, g) { var e, c; c = dhtmlx.math.toRgb(a); e = dhtmlx.math.rgbToHsv(c[0], c[1], c[2]); e[2] = e[2] * g; return "rgb(" + dhtmlx.math.hsvToRgb(e[0], e[1], e[2]) + ")" }, _getChartBounds: function(a, m) { var o, e, n, c; o = this._settings.padding.left; e = this._settings.padding.top; n = a - this._settings.padding.right; c = m - this._settings.padding.bottom; if (this._settings.legend) { var h = this._settings.legend; var l = this._settings.legend.width; var g = this._settings.legend.height; if (h.layout == "x") { if (h.valign == "center") { if (h.align == "right") { n -= l } else { if (h.align == "left") { o += l } } } else { if (h.valign == "bottom") { c -= g } else { e += g } } } else { if (h.align == "right") { n -= l } else { if (h.align == "left") { o += l } } } } return { start: { x: o, y: e }, end: { x: n, y: c } } }, _getStackedLimits: function(h) { var c, a, l, g, e; if (this._settings.yAxis && (typeof this._settings.yAxis.end != "undefined") && (typeof this._settings.yAxis.start != "undefined") && this._settings.yAxis.step) { l = parseFloat(this._settings.yAxis.end); g = parseFloat(this._settings.yAxis.start) } else { for (c = 0; c < h.length; c++) { h[c].$sum = 0; h[c].$min = Infinity; for (a = 0; a < this._series.length; a++) { e = parseFloat(this._series[a].value(h[c]) || 0); if (isNaN(e)) { continue } if (this._series[a].view.toLowerCase().indexOf("stacked") != -1) { h[c].$sum += e } if (e < h[c].$min) { h[c].$min = e } } } l = -Infinity; g = Infinity; for (c = 0; c < h.length; c++) { if (h[c].$sum > l) { l = h[c].$sum } if (h[c].$min < g) { g = h[c].$min } } if (g > 0) { g = 0 } } return { max: l, min: g } }, _setBarGradient: function(v, c, r, a, o, n, g, e) { var q, h, m, l, u, s; if (n == "light") { if (e == "x") { q = v.createLinearGradient(c, r, a, r) } else { q = v.createLinearGradient(c, r, c, o) } s = [ [0, "#FFFFFF"], [0.9, g], [1, g] ]; h = 2 } else { if (n == "falling" || n == "rising") { if (e == "x") { q = v.createLinearGradient(c, r, a, r) } else { q = v.createLinearGradient(c, r, c, o) } m = dhtmlx.math.toRgb(g); l = dhtmlx.math.rgbToHsv(m[0], m[1], m[2]); l[1] *= 1 / 2; u = "rgb(" + dhtmlx.math.hsvToRgb(l[0], l[1], l[2]) + ")"; if (n == "falling") { s = [ [0, u], [0.7, g], [1, g] ] } else { if (n == "rising") { s = [ [0, g], [0.3, g], [1, u] ] } } h = 0 } else { v.globalAlpha = 0.37; h = 0; if (e == "x") { q = v.createLinearGradient(c, o, c, r) } else { q = v.createLinearGradient(c, r, a, r) } s = [ [0, "#9d9d9d"], [0.3, "#e8e8e8"], [0.45, "#ffffff"], [0.55, "#ffffff"], [0.7, "#e8e8e8"], [1, "#9d9d9d"] ] } } this._gradient(q, s); return { gradient: q, offset: h } }, _getPositionByAngle: function(e, c, h, g) { e *= (-1); c = c + Math.cos(e) * g; h = h - Math.sin(e) * g; return { x: c, y: h } }, _gradient: function(e, c) { for (var a = 0; a < c.length; a++) { e.addColorStop(c[a][0], c[a][1]) } }, _path: function(a, e) { var c, g; for (c = 0; c < e.length; c++) { g = (c ? "lineTo" : "moveTo"); if (e[c].length > 2) { g = "arc" } a[g].apply(a, e[c]) } }, _circle: function(c, a, g, e) { c.arc(a, g, e, Math.PI * 2, true) }, _addMapRect: function(g, h, a, e, c) { g.addRect(h, [a[0].x - e.x, a[0].y - e.y, a[1].x - e.x, a[1].y - e.y], c) } }; dhtmlx.compat("layout"); if (typeof(window.dhtmlXCellObject) != "undefined") { dhtmlXCellObject.prototype.attachChart = function(a) { this.callEvent("_onBeforeContentAttach", ["chart"]); var c = document.createElement("DIV"); c.id = "dhxChartObj_" + window.dhx4.newId(); c.style.width = "100%"; c.style.height = "100%"; document.body.appendChild(c); this._attachObject(c); a.container = c.id; this.dataType = "chart"; this.dataObj = new dhtmlXChart(a); if (!this.dataObj.setSizes) { this.dataObj.setSizes = function() { if (this.resize) { this.resize() } else { this.render() } } } return this.dataObj } } dhtmlx.ui.pager = function(a) { this.name = "Pager"; if (dhtmlx.assert_enabled()) { this._assert() } dhtmlx.extend(this, dhtmlx.Settings); this._parseContainer(a, "dhx_pager"); dhtmlx.extend(this, dhtmlx.EventSystem); dhtmlx.extend(this, dhtmlx.SingleRender); dhtmlx.extend(this, dhtmlx.MouseEvents); this._parseSettings(a, { size: 10, page: -1, group: 5, count: 0, type: "default" }); this.data = this._settings; this.refresh() }; dhtmlx.ui.pager.prototype = { _id: "dhx_p_id", on_click: { dhx_pager_item: function(a, c) { this.select(c) } }, select: function(a) { switch (a) { case "next": a = this._settings.page + 1; break; case "prev": a = this._settings.page - 1; break; case "first": a = 0; break; case "last": a = this._settings.limit - 1; break; default: break } if (a < 0) { a = 0 } if (a >= this.data.limit) { a = this.data.limit - 1 } if (this.callEvent("onBeforePageChange", [this._settings.page, a])) { this.data.page = a * 1; this.refresh(); this.callEvent("onAfterPageChange", [a]) } }, types: { "default": { template: dhtmlx.Template.fromHTML("{common.pages()}"), pages: function(e) { var c = ""; if (e.page == -1) { return "" } e.min = e.page - Math.round((e.group - 1) / 2); e.max = e.min + e.group - 1; if (e.min < 0) { e.max += e.min * (-1); e.min = 0 } if (e.max >= e.limit) { e.min -= Math.min(e.min, e.max - e.limit + 1); e.max = e.limit - 1 } for (var a = (e.min || 0); a <= e.max; a++) { c += this.button({ id: a, index: (a + 1), selected: (a == e.page ? "_selected" : "") }) } return c }, page: function(a) { return a.page + 1 }, first: function() { return this.button({ id: "first", index: " << ", selected: "" }) }, last: function() { return this.button({ id: "last", index: " >> ", selected: "" }) }, prev: function() { return this.button({ id: "prev", index: "<", selected: "" }) }, next: function() { return this.button({ id: "next", index: ">", selected: "" }) }, button: dhtmlx.Template.fromHTML("
{obj.index}
") } }, refresh: function() { var a = this._settings; a.limit = Math.ceil(a.count / a.size); if (a.limit && a.limit != a.old_limit) { a.page = Math.min(a.limit - 1, a.page) } var c = a.page; if (c != -1 && (c != a.old_page) || (a.limit != a.old_limit)) { this.render(); this.callEvent("onRefresh", []); a.old_limit = a.limit; a.old_page = a.page } }, template_item_start: dhtmlx.Template.fromHTML("
"), template_item_end: dhtmlx.Template.fromHTML("
") }; dhtmlx.DataProcessor = { _dp_init: function(c) { var a = "_methods"; c[a] = ["setItemStyle", "", "changeId", "remove"]; this.attachEvent("onAfterAdd", function(e) { c.setUpdated(e, true, "inserted") }); this.data.attachEvent("onStoreLoad", dhtmlx.bind(function(g, e) { if (g.getUserData) { g.getUserData(e, this._userdata) } }, this)); this.attachEvent("onBeforeDelete", function(g) { if (c._silent_mode) { return true } var e = c.getState(g); if (e == "inserted") { c.setUpdated(g, false); return true } if (e == "deleted") { return false } if (e == "true_deleted") { return true } c.setUpdated(g, true, "deleted"); return false }); this.attachEvent("onAfterEditStop", function(e) { c.setUpdated(e, true, "updated") }); this.attachEvent("onBindUpdate", function(e) { window.setTimeout(function() { c.setUpdated(e.id, true, "updated") }, 1) }); a = "_getRowData"; c[a] = function(m, e) { var h = this.obj.data.get(m); var l = {}; for (var g in h) { if (g.indexOf("_") === 0) { continue } l[g] = h[g] } return l }; a = "_clearUpdateFlag"; c[a] = function() {}; this._userdata = {}; c.attachEvent("insertCallback", this._dp_callback); c.attachEvent("updateCallback", this._dp_callback); c.attachEvent("deleteCallback", function(e, g) { this.obj.setUserData(g, this.action_param, "true_deleted"); this.obj.remove(g) }); dhtmlx.compat("dataProcessor", c) }, _dp_callback: function(a, c) { this.obj.data.set(c, dhtmlx.DataDriver.xml.getDetails(a.firstChild)); this.obj.data.refresh(c) }, setItemStyle: function(e, a) { var c = this._locateHTML(e); if (c) { c.style.cssText += ";" + a } }, changeId: function(c, a) { this.data.changeId(c, a); this.refresh() }, setUserData: function(e, a, c) { if (e) { this.data.get(e)[a] = c } else { this._userdata[a] = c } }, getUserData: function(c, a) { return c ? this.data.get(c)[a] : this._userdata[a] } }; (function() { var a = "_dp_init"; dhtmlx.DataProcessor[a] = dhtmlx.DataProcessor._dp_init })(); dhtmlx.compat.dnd = function() { if (window.dhtmlDragAndDropObject) { var n = "_dragged"; var g = dhtmlDragAndDropObject.prototype.checkLanding; dhtmlDragAndDropObject.prototype.checkLanding = function(q, r, o) { g.apply(this, arguments); if (!o) { var s = dhtmlx.DragControl._drag_context = dhtmlx.DragControl._drag_context || {}; if (!s.from) { s.from = this.dragStartObject } dhtmlx.DragControl._checkLand(q, r, true) } }; var c = dhtmlDragAndDropObject.prototype.stopDrag; dhtmlDragAndDropObject.prototype.stopDrag = function(r, o, q) { if (!q) { if (dhtmlx.DragControl._last) { dhtmlx.DragControl._active = m.dragStartNode; dhtmlx.DragControl._stopDrag(r, true) } } c.apply(this, arguments) }; var m = new dhtmlDragAndDropObject(); var h = dhtmlx.DragControl._startDrag; dhtmlx.DragControl._startDrag = function() { h.apply(this, arguments); var s = dhtmlx.DragControl._drag_context; if (!s) { return } var r = []; var q = []; for (var o = 0; o < s.source.length; o++) { r[o] = { idd: s.source[o] }; q.push(s.source[o]) } m.dragStartNode = { parentNode: {}, parentObject: { idd: r, id: (q.length == 1 ? q[0] : q), treeNod: { object: s.from } } }; m.dragStartNode.parentObject.treeNod[n] = r; m.dragStartObject = s.from }; var l = dhtmlx.DragControl._checkLand; dhtmlx.DragControl._checkLand = function(q, r, o) { l.apply(this, arguments); if (!this._last && !o) { q = m.checkLanding(q, r, true) } }; var a = dhtmlx.DragControl._stopDrag; dhtmlx.DragControl._stopDrag = function(q, o) { a.apply(this, arguments); if (m.lastLanding && !o) { m.stopDrag(q, false, true) } }; var e = dhtmlx.DragControl.getMaster; dhtmlx.DragControl.getMaster = function(q) { var r = null; if (q) { r = e.apply(this, arguments) } if (!r) { r = m.dragStartObject; var s = []; var u = r[n]; for (var o = 0; o < u.length; o++) { s.push(u[o].idd || u[o].id) } dhtmlx.DragControl._drag_context.source = s } return r } } }; dhtmlx.DataMove = { _init: function() { dhtmlx.assert(this.data, "DataMove :: Component doesn't have DataStore") }, copy: function(c, h, a, g) { var e = this.get(c); if (!e) { dhtmlx.log("Warning", "Incorrect ID in DataMove::copy"); return } if (a) { dhtmlx.assert(a.externalData, "DataMove :: External object doesn't support operation"); e = a.externalData(e) } a = a || this; return a.add(a.externalData(e, g), h) }, move: function(e, m, c, l) { if (e instanceof Array) { for (var g = 0; g < e.length; g++) { var a = (c || this).indexById(this.move(e[g], m, c, e[g])); if (e[g + 1]) { m = a + (this.indexById(e[g + 1]) < a ? 0 : 1) } } return } nid = e; if (m < 0) { dhtmlx.log("Info", "DataMove::move - moving outside of bounds is ignored"); return } var h = this.get(e); if (!h) { dhtmlx.log("Warning", "Incorrect ID in DataMove::move"); return } if (!c || c == this) { this.data.move(this.indexById(e), m) } else { dhtmlx.assert(c.externalData, "DataMove :: External object doesn't support operation"); nid = c.add(c.externalData(h, l), m); this.remove(e) } return nid }, moveUp: function(c, a) { return this.move(c, this.indexById(c) - (a || 1)) }, moveDown: function(c, a) { return this.moveUp(c, (a || 1) * -1) }, moveTop: function(a) { return this.move(a, 0) }, moveBottom: function(a) { return this.move(a, this.data.dataCount() - 1) }, externalData: function(a, e) { var c = dhtmlx.extend({}, a); c.id = e || dhtmlx.uid(); c.$selected = c.$template = null; return c } }; dhtmlx.DragControl = { _drag_masters: dhtmlx.toArray(["dummy"]), addDrop: function(c, e, a) { c = dhtmlx.toNode(c); c.dhx_drop = this._getCtrl(e); if (a) { c.dhx_master = true } }, _getCtrl: function(c) { c = c || dhtmlx.DragControl; var a = this._drag_masters.find(c); if (a < 0) { a = this._drag_masters.length; this._drag_masters.push(c) } return a }, addDrag: function(a, c) { a = dhtmlx.toNode(a); a.dhx_drag = this._getCtrl(c); dhtmlx.event(a, "mousedown", this._preStart, a) }, _preStart: function(a) { if (dhtmlx.DragControl._active) { dhtmlx.DragControl._preStartFalse(); dhtmlx.DragControl.destroyDrag() } dhtmlx.DragControl._active = this; dhtmlx.DragControl._start_pos = { x: a.pageX, y: a.pageY }; dhtmlx.DragControl._dhx_drag_mm = dhtmlx.event(document.body, "mousemove", dhtmlx.DragControl._startDrag); dhtmlx.DragControl._dhx_drag_mu = dhtmlx.event(document.body, "mouseup", dhtmlx.DragControl._preStartFalse); dhtmlx.DragControl._dhx_drag_sc = dhtmlx.event(this, "scroll", dhtmlx.DragControl._preStartFalse); a.cancelBubble = true; return false }, _preStartFalse: function(a) { dhtmlx.DragControl._dhx_drag_mm = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mm); dhtmlx.DragControl._dhx_drag_mu = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mu); dhtmlx.DragControl._dhx_drag_sc = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_sc) }, _startDrag: function(a) { var c = { x: a.pageX, y: a.pageY }; if (Math.abs(c.x - dhtmlx.DragControl._start_pos.x) < 5 && Math.abs(c.y - dhtmlx.DragControl._start_pos.y) < 5) { return } dhtmlx.DragControl._preStartFalse(); if (!dhtmlx.DragControl.createDrag(a)) { return } dhtmlx.DragControl.sendSignal("start"); dhtmlx.DragControl._dhx_drag_mm = dhtmlx.event(document.body, "mousemove", dhtmlx.DragControl._moveDrag); dhtmlx.DragControl._dhx_drag_mu = dhtmlx.event(document.body, "mouseup", dhtmlx.DragControl._stopDrag); dhtmlx.DragControl._moveDrag(a) }, _stopDrag: function(a) { dhtmlx.DragControl._dhx_drag_mm = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mm); dhtmlx.DragControl._dhx_drag_mu = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mu); if (dhtmlx.DragControl._last) { dhtmlx.DragControl.onDrop(dhtmlx.DragControl._active, dhtmlx.DragControl._last, this._landing, a); dhtmlx.DragControl.onDragOut(dhtmlx.DragControl._active, dhtmlx.DragControl._last, null, a) } dhtmlx.DragControl.destroyDrag(); dhtmlx.DragControl.sendSignal("stop") }, _moveDrag: function(a) { var c = dhtmlx.html.pos(a); dhtmlx.DragControl._html.style.top = c.y + dhtmlx.DragControl.top + "px"; dhtmlx.DragControl._html.style.left = c.x + dhtmlx.DragControl.left + "px"; if (dhtmlx.DragControl._skip) { dhtmlx.DragControl._skip = false } else { dhtmlx.DragControl._checkLand((a.srcElement || a.target), a) } a.cancelBubble = true; return false }, _checkLand: function(a, c) { while (a && a.tagName != "BODY") { if (a.dhx_drop) { if (this._last && (this._last != a || a.dhx_master)) { this.onDragOut(this._active, this._last, a, c) } if (!this._last || this._last != a || a.dhx_master) { this._last = null; this._landing = this.onDragIn(dhtmlx.DragControl._active, a, c); if (this._landing) { this._last = a } return } return } a = a.parentNode } if (this._last) { this._last = this._landing = this.onDragOut(this._active, this._last, null, c) } }, sendSignal: function(a) { dhtmlx.DragControl.active = (a == "start") }, getMaster: function(a) { return this._drag_masters[a.dhx_drag || a.dhx_drop] }, getContext: function(a) { return this._drag_context }, createDrag: function(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 e = this._drag_masters[c.dhx_drag]; if (e && e.onDragDestroy) { e.onDragDestroy(c, dhtmlx.DragControl._html) } else { dhtmlx.html.remove(dhtmlx.DragControl._html) } dhtmlx.DragControl._landing = dhtmlx.DragControl._active = dhtmlx.DragControl._last = dhtmlx.DragControl._html = null }, top: 5, left: 5, onDragIn: function(g, c, h) { var a = this._drag_masters[c.dhx_drop]; if (a.onDragIn && a != this) { return a.onDragIn(g, c, h) } c.className = c.className + " dhx_drop_zone"; return c }, onDragOut: function(g, c, 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(e, g, c) { if (e == 13 && !c) { this.stopEdit() } else { if (e == 27) { this.stopEdit(true) } } }); this.attachEvent("onBeforeRender", function() { this.stopEdit() }) }, isEdit: function() { return this._edit_id }, edit: function(c) { if (this.stopEdit(false, c)) { if (!this.callEvent("onBeforeEditStart", [c])) { return } var a = this.data.get(c); if (a.$template) { return } a.$template = "edit"; this.data.refresh(c); this._edit_id = c; this._save_binding(c); this._edit_bind(true, a); this.callEvent("onAfterEditStart", [c]) } }, stopEdit: function(e, h) { if (!this._edit_id) { return true } if (this._edit_id == h) { return false } var a = {}; if (!e) { this._edit_bind(false, a) } else { a = null } if (!this.callEvent("onBeforeEditStop", [this._edit_id, a])) { return false } var c = this.data.get(this._edit_id); c.$template = null; if (!e) { this._edit_bind(false, c) } var g = this._edit_id; this._edit_bind = this._edit_id = null; this.data.refresh(g); this.callEvent("onAfterEditStop", [g, a]); return true }, _save_binding: function(n) { var a = this._locateHTML(n); var e = ""; var l = ""; var h = []; if (a) { var g = a.getElementsByTagName("*"); var m = ""; for (var c = 0; c < g.length; c++) { if (g[c].nodeType == 1 && (m = g[c].getAttribute("bind"))) { e += "els[" + h.length + "].value=" + m + ";"; l += m + "=els[" + h.length + "].value;"; h.push(g[c]); g[c].className += " dhx_allow_selection"; g[c].onselectstart = this._block_native } } g = null } e = Function("obj", "els", e); l = Function("obj", "els", l); this._edit_bind = function(q, o) { if (q) { e(o, h); if (h.length && h[0].select) { h[0].select() } } else { l(o, h) } } }, _block_native: function(a) { (a || event).cancelBubble = true; return true } }; dhtmlx.SelectionModel = { _init: function() { this._selected = dhtmlx.toArray(); dhtmlx.assert(this.data, "SelectionModel :: Component doesn't have DataStore"); this.data.attachEvent("onStoreUpdated", dhtmlx.bind(this._data_updated, this)); this.data.attachEvent("onStoreLoad", dhtmlx.bind(this._data_loaded, this)); this.data.attachEvent("onAfterFilter", dhtmlx.bind(this._data_filtered, this)); this.data.attachEvent("onIdChange", dhtmlx.bind(this._id_changed, this)) }, _id_changed: function(e, a) { for (var c = this._selected.length - 1; c >= 0; c--) { if (this._selected[c] == e) { this._selected[c] = a } } }, _data_filtered: function() { for (var a = this._selected.length - 1; a >= 0; a--) { if (this.data.indexById(this._selected[a]) < 0) { var e = this._selected[a]; var c = this.item(e); if (c) { delete c.$selected } this._selected.splice(a, 1); this.callEvent("onSelectChange", [e]) } } }, _data_updated: function(e, c, a) { if (a == "delete") { this._selected.remove(e) } else { if (!this.data.dataCount() && !this.data._filter_order) { this._selected = dhtmlx.toArray() } } }, _data_loaded: function() { if (this._settings.select) { this.data.each(function(a) { if (a.$selected) { this.select(a.id) } }, this) } }, _select_mark: function(e, c, a) { if (!a && !this.callEvent("onBeforeSelect", [e, c])) { return false } this.data.item(e).$selected = c; if (a) { a.push(e) } else { if (c) { this._selected.push(e) } else { this._selected.remove(e) } this._refresh_selection(e) } return true }, select: function(g, e, a) { if (!g) { return this.selectAll() } if (g instanceof Array) { for (var c = 0; c < g.length; c++) { this.select(g[c], e, a) } return } if (!this.data.exists(g)) { dhtmlx.error("Incorrect id in select command: " + g); return } if (a && this._selected.length) { return this.selectAll(this._selected[this._selected.length - 1], g) } if (!e && (this._selected.length != 1 || this._selected[0] != g)) { this._silent_selection = true; this.unselectAll(); this._silent_selection = false } if (this.isSelected(g)) { if (e) { this.unselect(g) } return } if (this._select_mark(g, true)) { this.callEvent("onAfterSelect", [g]) } }, unselect: function(a) { if (!a) { return this.unselectAll() } if (!this.isSelected(a)) { return } this._select_mark(a, false) }, selectAll: function(g, e) { var a; var c = []; if (g || e) { a = this.data.getRange(g || null, e || null) } else { a = this.data.getRange() } a.each(function(h) { var l = this.data.item(h.id); if (!l.$selected) { this._selected.push(h.id); this._select_mark(h.id, true, c) } return h.id }, this); this._refresh_selection(c) }, unselectAll: function() { var a = []; this._selected.each(function(c) { this._select_mark(c, false, a) }, this); this._selected = dhtmlx.toArray(); this._refresh_selection(a) }, isSelected: function(a) { return this._selected.find(a) != -1 }, getSelected: function(a) { switch (this._selected.length) { case 0: return a ? [] : ""; case 1: return a ? [this._selected[0]] : this._selected[0]; default: return ([].concat(this._selected)) } }, _is_mass_selection: function(a) { return a.length > 100 || a.length > this.data.dataCount / 2 }, _refresh_selection: function(c) { if (typeof c != "object") { c = [c] } if (!c.length) { return } if (this._is_mass_selection(c)) { this.data.refresh() } else { for (var a = 0; a < c.length; a++) { this.render(c[a], this.data.item(c[a]), "update") } } if (!this._silent_selection) { this.callEvent("onSelectChange", [c]) } } }; dhtmlx.RenderStack = { _init: function() { dhtmlx.assert(this.data, "RenderStack :: Component doesn't have DataStore"); dhtmlx.assert(dhtmlx.Template, "dhtmlx.Template :: dhtmlx.Template is not accessible"); this._html = document.createElement("DIV") }, _toHTML: function(a) { dhtmlx.assert((!a.$template || this.type["template_" + a.$template]), "RenderStack :: Unknown template: " + a.$template); this.callEvent("onItemRender", [a]); return this.type._item_start(a, this.type) + (a.$template ? this.type["template_" + a.$template] : this.type.template)(a, this.type) + this.type._item_end }, _toHTMLObject: function(a) { this._html.innerHTML = this._toHTML(a); return this._html.firstChild }, _locateHTML: function(a) { if (this._htmlmap) { return this._htmlmap[a] } this._htmlmap = {}; var e = this._dataobj.childNodes; for (var c = 0; c < e.length; c++) { var g = e[c].getAttribute(this._id); if (g) { this._htmlmap[g] = e[c] } } return this._locateHTML(a) }, locate: function(a) { return dhtmlx.html.locate(a, this._id) }, show: function(c) { var a = this._locateHTML(c); if (a) { this._dataobj.scrollTop = a.offsetTop - this._dataobj.offsetTop } }, render: function(l, g, e, h) { if (l) { var a = this._locateHTML(l); switch (e) { case "update": if (!a) { return } var c = this._htmlmap[l] = this._toHTMLObject(g); dhtmlx.html.insertBefore(c, a); dhtmlx.html.remove(a); break; case "delete": if (!a) { return } dhtmlx.html.remove(a); delete this._htmlmap[l]; break; case "add": var c = this._htmlmap[l] = this._toHTMLObject(g); dhtmlx.html.insertBefore(c, this._locateHTML(this.data.next(l)), this._dataobj); break; case "move": this.render(l, g, "delete"); this.render(l, g, "add"); break; default: dhtmlx.error("Unknown render command: " + e); break } } else { if (this.callEvent("onBeforeRender", [this.data])) { this._dataobj.innerHTML = this.data.getRange().map(this._toHTML, this).join(""); this._htmlmap = null } } this.callEvent("onAfterRender", []) }, pager_setter: function(c) { this.attachEvent("onBeforeRender", function() { var g = this._settings.pager._settings; if (g.page == -1) { return false } this.data.min = g.page * g.size; this.data.max = (g.page + 1) * g.size - 1; return true }); var a = new dhtmlx.ui.pager(c); var e = dhtmlx.bind(function() { this.data.refresh() }, this); a.attachEvent("onRefresh", e); this.data.attachEvent("onStoreUpdated", function(h) { var g = this.dataCount(); if (g != a._settings.count) { a._settings.count = g; if (a._settings.page == -1) { a._settings.page = 0 } a.refresh() } }); return a }, height_setter: function(a) { if (a == "auto") { this.attachEvent("onAfterRender", this._correct_height); dhtmlx.event(window, "resize", dhtmlx.bind(this._correct_height, this)) } return a }, _correct_height: function() { this._dataobj.style.overflow = "hidden"; this._dataobj.style.height = "1px"; var a = this._dataobj.scrollHeight; this._dataobj.style.height = a + "px"; if (dhtmlx._isFF) { var c = this._dataobj.scrollHeight; if (c != a) { this._dataobj.style.height = c + "px" } } this._obj.style.height = this._dataobj.style.height }, _getDimension: function() { var a = this.type; var c = (a.border || 0) + (a.padding || 0) * 2 + (a.margin || 0) * 2; return { x: a.width + c, y: a.height + c } }, x_count_setter: function(c) { var e = this._getDimension(); var a = dhtmlx.$customScroll ? 0 : 18; this._dataobj.style.width = e.x * c + (this._settings.height != "auto" ? a : 0) + "px"; return c }, y_count_setter: function(a) { var c = this._getDimension(); this._dataobj.style.height = c.y * a + "px"; return a } }; dhtmlx.VirtualRenderStack = { _init: function() { dhtmlx.assert(this.render, "VirtualRenderStack :: Object must use RenderStack first"); this._htmlmap = {}; this._dataobj.style.overflowY = "scroll"; dhtmlx.event(this._dataobj, "scroll", dhtmlx.bind(this._render_visible_rows, this)); dhtmlx.event(window, "resize", dhtmlx.bind(function() { this.render() }, this)); this.data._unrendered_area = []; this.data.getIndexRange = this._getIndexRange }, _locateHTML: function(a) { return this._htmlmap[a] }, show: function(e) { range = this._getVisibleRange(); var c = this.data.indexById(e); var a = Math.floor(c / range._dx) * range._y; this._dataobj.scrollTop = a }, _getIndexRange: function(h, g) { if (g !== 0) { g = Math.min((g || Infinity), this.dataCount() - 1) } var a = dhtmlx.toArray(); for (var c = (h || 0); c <= g; c++) { var e = this.item(this.order[c]); if (this.order.length > c) { if (!e) { this.order[c] = dhtmlx.uid(); e = { id: this.order[c], $template: "loading" }; this._unrendered_area.push(this.order[c]) } else { if (e.$template == "loading") { this._unrendered_area.push(this.order[c]) } } a.push(e) } } return a }, render: function(l, g, e, h) { if (l) { var a = this._locateHTML(l); switch (e) { case "update": if (!a) { return } var c = this._htmlmap[l] = this._toHTMLObject(g); dhtmlx.html.insertBefore(c, a); dhtmlx.html.remove(a); break; default: this._render_delayed(); break } } else { if (this.callEvent("onBeforeRender", [this.data])) { this._htmlmap = {}; this._render_visible_rows(null, true); this._wait_for_render = false; this.callEvent("onAfterRender", []) } } }, _render_delayed: function() { if (this._wait_for_render) { return } this._wait_for_render = true; window.setTimeout(dhtmlx.bind(function() { this.render() }, this), 1) }, _create_placeholder: function(a) { var c = document.createElement("DIV"); c.className = "dhxdataview_placeholder"; c.style.cssText = "height:" + a + "px; width:100%; overflow:hidden;"; return c }, _render_visible_rows: function(A, E) { this.data._unrendered_area = []; var y = this._getVisibleRange(); if (!this._dataobj.firstChild || E) { this._dataobj.innerHTML = ""; this._dataobj.appendChild(this._create_placeholder(y._max)); this._htmlrows = [this._dataobj.firstChild] } var 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 m = this._dataobj.scrollTop; var a = this._dataobj.scrollWidth; var n = this._dataobj.offsetHeight; var q = this.type; var g = this._getDimension(); var r = Math.floor(a / g.x) || 1; var e = Math.floor(m / g.y); var o = Math.ceil((n + m) / g.y) - 1; var h = this.data.max ? (this.data.max - this.data.min) : this.data.dataCount(); var l = Math.ceil(h / r) * g.y; return { _from: e, _height: o, _top: m, _max: l, _y: g.y, _dx: r } } }; dhtmlXDataView = function(a) { this.name = "DataView"; if (dhtmlx.assert_enabled()) { this._assert() } dhtmlx.extend(this, dhtmlx.Settings); this._parseContainer(a, "dhx_dataview"); dhtmlx.extend(this, dhtmlx.AtomDataLoader); dhtmlx.extend(this, dhtmlx.DataLoader); dhtmlx.extend(this, dhtmlx.EventSystem); dhtmlx.extend(this, dhtmlx.RenderStack); dhtmlx.extend(this, dhtmlx.SelectionModel); dhtmlx.extend(this, dhtmlx.MouseEvents); dhtmlx.extend(this, dhtmlx.KeyEvents); dhtmlx.extend(this, dhtmlx.EditAbility); dhtmlx.extend(this, dhtmlx.DataMove); dhtmlx.extend(this, dhtmlx.DragItem); dhtmlx.extend(this, dhtmlx.DataProcessor); dhtmlx.extend(this, dhtmlx.AutoTooltip); dhtmlx.extend(this, dhtmlx.Destruction); this.data.attachEvent("onStoreUpdated", dhtmlx.bind(function() { this.render.apply(this, arguments) }, this)); this._parseSettings(a, { drag: false, edit: false, select: "multiselect", type: "default" }); if (this._settings.height != "auto" && !this._settings.renderAll) { dhtmlx.extend(this, dhtmlx.VirtualRenderStack) } this.data.provideApi(this, true); if (this.config.autowidth) { this.attachEvent("onBeforeRender", function() { this.type.width = Math.floor((this._dataobj.scrollWidth) / (this.config.autowidth * 1 || 1)) - this.type.padding * 2 - this.type.margin * 2 - this.type.border * 2; this.type._item_start = dhtmlx.Template.fromHTML(this.template_item_start(this.type)); this.type._item_end = this.template_item_end(this.type) }); dhtmlx.event(window, "resize", function() { this.refresh() }, this) } if (dhtmlx.$customScroll) { dhtmlx.CustomScroll.enable(this) } }; dhtmlXDataView.prototype = { bind: function() { dhtmlx.BaseBind.legacyBind.apply(this, arguments) }, sync: function() { dhtmlx.BaseBind.legacySync.apply(this, arguments) }, dragMarker: function(e, h) { var g = this._locateHTML(e.target); if (this.type.drag_marker) { if (this._drag_marker) { this._drag_marker.style.backgroundImage = ""; this._drag_marker.style.backgroundRepeat = "" } if (g) { g.style.backgroundImage = "url(" + (dhtmlx.image_path || "") + this.type.drag_marker + ")"; g.style.backgroundRepeat = "no-repeat"; this._drag_marker = g } } if (g && this._settings.auto_scroll) { var a = g.offsetTop; var l = g.offsetHeight; var c = this._obj.scrollTop; var m = this._obj.offsetHeight; if (a - l >= 0 && a - l * 0.75 < c) { c = Math.max(a - l, 0) } else { if (a + l / 0.75 > c + m) { c = c + l } } 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.metaKey, a.shiftKey) } else { this.select(c) } } } } }, on_dblclick: { dhx_dataview_item: function(a, c) { if (this._settings.edit) { this.edit(c) } } }, on_mouse_move: {}, types: { "default": { css: "default", template: dhtmlx.Template.fromHTML("
{obj.text}
"), template_edit: dhtmlx.Template.fromHTML("
"), template_loading: dhtmlx.Template.fromHTML("
Loading...
"), width: 210, height: 115, margin: 0, padding: 10, border: 1 } }, template_item_start: dhtmlx.Template.fromHTML("
"), template_item_end: dhtmlx.Template.fromHTML("
") }; dhtmlx.compat("layout"); if (typeof(window.dhtmlXCellObject) != "undefined") { dhtmlXCellObject.prototype.attachDataView = function(a) { this.callEvent("_onBeforeContentAttach", ["dataview"]); var c = document.createElement("DIV"); c.style.width = "100%"; c.style.height = "100%"; c.style.position = "relative"; c.style.overflow = "hidden"; this._attachObject(c); if (typeof(a) == "undefined") { a = {} } c.id = "DataViewObject_" + dhtmlx.uid(); a.container = c.id; a.skin = this.conf.skin; this.dataType = "dataview"; this.dataObj = new dhtmlXDataView(a); this.dataObj.setSizes = function() { this.render() }; c = null; this.callEvent("_onContentAttach", []); return this.dataObj } } dhtmlXList = function(a) { this.name = "List"; dhtmlx.extend(this, dhtmlx.Settings); this._parseContainer(a, "dhx_list"); dhtmlx.extend(this, dhtmlx.AtomDataLoader); dhtmlx.extend(this, dhtmlx.DataLoader); dhtmlx.extend(this, dhtmlx.EventSystem); dhtmlx.extend(this, dhtmlx.RenderStack); dhtmlx.extend(this, dhtmlx.SelectionModel); dhtmlx.extend(this, dhtmlx.MouseEvents); dhtmlx.extend(this, dhtmlx.KeyEvents); dhtmlx.extend(this, dhtmlx.EditAbility); dhtmlx.extend(this, dhtmlx.DataMove); dhtmlx.extend(this, dhtmlx.DragItem); dhtmlx.extend(this, dhtmlx.DataProcessor); dhtmlx.extend(this, dhtmlx.AutoTooltip); dhtmlx.extend(this, dhtmlx.Destruction); this._getDimension = function() { var c = this.type; var e = (c.margin || 0) * 2; return { x: c.width + e, y: c.height + e } }; this.data.attachEvent("onStoreUpdated", dhtmlx.bind(function() { this.render.apply(this, arguments) }, this)); this._parseSettings(a, { drag: false, edit: false, select: "multiselect", type: "default" }); this.data.provideApi(this, true); if (dhtmlx.$customScroll) { dhtmlx.CustomScroll.enable(this) } }; dhtmlXList.prototype = { bind: function() { dhtmlx.BaseBind.legacyBind.apply(this, arguments) }, sync: function() { dhtmlx.BaseBind.legacySync.apply(this, arguments) }, dragMarker: function(e, h) { var g = this._locateHTML(e.target); if (g && this._settings.auto_scroll) { var a = g.offsetTop; var l = g.offsetHeight; var c = this._obj.scrollTop; var m = this._obj.offsetHeight; if (a - l >= 0 && a - l * 0.75 < c) { c = Math.max(a - l, 0) } else { if (a + l / 0.75 > c + m) { c = c + l } } this._obj.scrollTop = c } return true }, _id: "dhx_f_id", on_click: { dhx_list_item: function(a, c) { if (this.stopEdit(false, c)) { if (this._settings.select) { if (this._settings.select == "multiselect") { this.select(c, a.ctrlKey || a.metaKey, a.shiftKey) } else { this.select(c) } } } } }, on_dblclick: { dhx_list_item: function(a, c) { if (this._settings.edit) { this.edit(c) } } }, on_mouse_move: {}, types: { "default": { css: "default", template: dhtmlx.Template.fromHTML("
{obj.text}
"), template_edit: dhtmlx.Template.fromHTML("
"), template_loading: dhtmlx.Template.fromHTML("
Loading...
"), height: 50, margin: 0, padding: 10, border: 1 } }, template_item_start: dhtmlx.Template.fromHTML("
"), template_item_end: dhtmlx.Template.fromHTML("
") }; dhtmlx.compat("layout"); if (typeof(window.dhtmlXCellObject) != "undefined") { dhtmlXCellObject.prototype.attachList = function(a) { this.callEvent("_onBeforeContentAttach", ["list"]); var c = document.createElement("DIV"); c.style.width = "100%"; c.style.height = "100%"; c.style.position = "relative"; c.style.overflowX = "hidden"; this._attachObject(c); if (typeof(a) == "undefined") { a = {} } c.id = "ListObject_" + new Date().getTime(); a.container = c.id; a.skin = this.conf.skin; this.dataType = "list"; this.dataObj = new dhtmlXList(a); this.dataObj.setSizes = function() { this.render() }; c = null; this.callEvent("_onContentAttach", []); return this.dataObj } } function xmlPointer(a) { this.d = a } xmlPointer.prototype = { text: function() { if (!_isFF) { return this.d.xml } var a = new XMLSerializer(); return a.serializeToString(this.d) }, get: function(a) { return this.d.getAttribute(a) }, exists: function() { return !!this.d }, content: function() { return this.d.firstChild ? (this.d.firstChild.wholeText || this.d.firstChild.data) : "" }, each: function(g, m, l, h) { var e = this.d.childNodes; var n = new xmlPointer(); if (e.length) { for (h = h || 0; h < e.length; h++) { if (e[h].tagName == g) { n.d = e[h]; if (m.apply(l, [n, h]) == -1) { return } } } } }, get_all: function() { var e = {}; var c = this.d.attributes; for (var g = 0; g < c.length; g++) { e[c[g].name] = c[g].value } return e }, sub: function(g) { var e = this.d.childNodes; var l = new xmlPointer(); if (e.length) { for (var h = 0; h < e.length; h++) { if (e[h].tagName == g) { l.d = e[h]; return l } } } }, up: function(a) { return new xmlPointer(this.d.parentNode) }, set: function(a, c) { this.d.setAttribute(a, c) }, clone: function(a) { return new xmlPointer(this.d) }, sub_exists: function(e) { var c = this.d.childNodes; if (c.length) { for (var g = 0; g < c.length; g++) { if (c[g].tagName == e) { return true } } } return false }, through: function(e, m, q, h, r) { var n = this.d.childNodes; if (n.length) { for (var g = 0; g < n.length; g++) { if (n[g].tagName == e && n[g].getAttribute(m) != null && n[g].getAttribute(m) != "" && (!q || n[g].getAttribute(m) == q)) { var l = new xmlPointer(n[g]); h.apply(r, [l, g]) } var o = this.d; this.d = n[g]; this.through(e, m, q, h, r); this.d = o } } } }; function dhtmlXTreeObject(o, l, c, a) { if (dhtmlxEvent.initTouch) { dhtmlxEvent.initTouch() } if (_isIE) { try { document.execCommand("BackgroundImageCache", false, true) } catch (n) {} } if (typeof(o) != "object") { this.parentObject = document.getElementById(o) } else { this.parentObject = o } this.parentObject.style.overflow = "hidden"; this._itim_dg = true; this.dlmtr = ","; this.dropLower = false; this.enableIEImageFix(true); this.xmlstate = 0; this.mytype = "tree"; this.smcheck = true; this.width = l; this.height = c; this.rootId = a; this.childCalc = null; this.def_img_x = "18px"; this.def_img_y = "18px"; this.def_line_img_x = "18px"; this.def_line_img_y = "24px"; this._dragged = new Array(); this._selected = new Array(); this.style_pointer = "pointer"; this._aimgs = true; this.htmlcA = " ["; this.htmlcB = "]"; this.lWin = window; this.cMenu = 0; this.mlitems = 0; this.iconURL = ""; this.dadmode = 0; this.slowParse = false; this.autoScroll = true; this.hfMode = 0; this.nodeCut = new Array(); this.XMLsource = 0; this.XMLloadingWarning = 0; this._idpull = {}; this._pullSize = 0; this.treeLinesOn = true; this.tscheck = false; this.timgen = true; this.dpcpy = false; this._ld_id = null; this._dynDeleteBranches = {}; this._oie_onXLE = []; this.imPath = window.dhx_globalImgPath || ""; this.checkArray = new Array("iconUncheckAll.gif", "iconCheckAll.gif", "iconCheckGray.gif", "iconUncheckDis.gif", "iconCheckDis.gif", "iconCheckDis.gif"); this.radioArray = new Array("radio_off.gif", "radio_on.gif", "radio_on.gif", "radio_off.gif", "radio_on.gif", "radio_on.gif"); this.lineArray = new Array("line2.gif", "line3.gif", "line4.gif", "blank.gif", "blank.gif", "line1.gif"); this.minusArray = new Array("minus2.gif", "minus3.gif", "minus4.gif", "minus.gif", "minus5.gif"); this.plusArray = new Array("plus2.gif", "plus3.gif", "plus4.gif", "plus.gif", "plus5.gif"); this.imageArray = new Array("leaf.gif", "folderOpen.gif", "folderClosed.gif"); this.cutImg = new Array(0, 0, 0); this.cutImage = "but_cut.gif"; dhx4._eventable(this); this.dragger = new dhtmlDragAndDropObject(); this.htmlNode = new dhtmlXTreeItemObject(this.rootId, "", 0, this); this.htmlNode.htmlNode.childNodes[0].childNodes[0].style.display = "none"; this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[0].className = "hiddenRow"; this.allTree = this._createSelf(); this.allTree.appendChild(this.htmlNode.htmlNode); if (dhtmlx.$customScroll) { dhtmlx.CustomScroll.enable(this) } if (_isFF) { this.allTree.childNodes[0].width = "100%"; this.allTree.childNodes[0].style.overflow = "hidden" } var h = this; this.allTree.onselectstart = new Function("return false;"); if (_isMacOS) { this.allTree.oncontextmenu = function(q) { return h._doContClick(q || window.event, true) } } this.allTree.onmousedown = function(q) { return h._doContClick(q || window.event) }; this.XMLLoader = this._parseXMLTree; if (_isIE) { this.preventIECashing(true) } this.selectionBar = document.createElement("DIV"); this.selectionBar.className = "selectionBar"; this.selectionBar.innerHTML = " "; this.selectionBar.style.display = "none"; this.allTree.appendChild(this.selectionBar); if (window.addEventListener) { window.addEventListener("unload", function() { try { h.destructor() } catch (q) {} }, false) } if (window.attachEvent) { window.attachEvent("onunload", function() { try { h.destructor() } catch (q) {} }) } this.setImagesPath = this.setImagePath; this.setIconsPath = this.setIconPath; this.setSkin(window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxtree") || "material"); if (dhtmlx.image_path) { var m = dhtmlx.image_path; var g = this.parentObject.className.match(/dhxtree_dhx_([a-z_]*)/i); if (g != null && g[1] != null) { m += "dhxtree_" + g[1] + "/" } this.setImagePath(m) } return this } dhtmlXTreeObject.prototype.setDataMode = function(a) { this._datamode = a }; dhtmlXTreeObject.prototype._doContClick = function(m, a) { if (!a && m.button != 2) { if (this._acMenu) { if (this._acMenu.hideContextMenu) { this._acMenu.hideContextMenu() } else { this.cMenu._contextEnd() } } return true } var c = (_isIE ? m.srcElement : m.target); while ((c) && (c.tagName != "BODY")) { if (c.parentObject) { break } c = c.parentNode } if ((!c) || (!c.parentObject)) { return true } var h = c.parentObject; if (!this.callEvent("onRightClick", [h.id, m])) { (m.srcElement || m.target).oncontextmenu = function(q) { (q || event).cancelBubble = true; return false } } this._acMenu = (h.cMenu || this.cMenu); if (this._acMenu) { if (!(this.callEvent("onBeforeContextMenu", [h.id]))) { return true } if (!_isMacOS) { (m.srcElement || m.target).oncontextmenu = function(q) { (q || event).cancelBubble = true; return false } } if (this._acMenu.showContextMenu) { var g = window.document.documentElement; var e = window.document.body; var n = new Array((g.scrollLeft || e.scrollLeft), (g.scrollTop || e.scrollTop)); if (_isIE) { var o = m.clientX + n[0]; var l = m.clientY + n[1] } else { var o = m.pageX; var l = m.pageY } this._acMenu.showContextMenu(o - 1, l - 1); this.contextID = h.id; m.cancelBubble = true; this._acMenu._skip_hide = true } else { c.contextMenuId = h.id; c.contextMenu = this._acMenu; c.a = this._acMenu._contextStart; c.a(c, m); c.a = null } return false } return true }; dhtmlXTreeObject.prototype.enableIEImageFix = function(a) { if (!a) { this._getImg = function(c) { return document.createElement((c == this.rootId) ? "div" : "img") }; this._setSrc = function(e, c) { e.src = c }; this._getSrc = function(c) { return c.src } } else { this._getImg = function() { var c = document.createElement("DIV"); c.innerHTML = " "; c.className = "dhx_bg_img_fix"; return c }; this._setSrc = function(e, c) { e.style.backgroundImage = "url(" + c + ")" }; this._getSrc = function(c) { var e = c.style.backgroundImage; return e.substr(4, e.length - 5).replace(/(^")|("$)/g, "") } } }; dhtmlXTreeObject.prototype.destructor = function() { for (var c in this._idpull) { var e = this._idpull[c]; if (!e) { continue } e.parentObject = null; e.treeNod = null; e.childNodes = null; e.span = null; e.tr.nodem = null; e.tr = null; e.htmlNode.objBelong = null; e.htmlNode = null; this._idpull[c] = null } this.parentObject.innerHTML = ""; this.allTree.onselectstart = null; this.allTree.oncontextmenu = null; this.allTree.onmousedown = null; for (var c in this) { this[c] = null } }; function cObject() { return this } cObject.prototype = new Object; cObject.prototype.clone = function() { function a() {} a.prototype = this; return new a() }; function dhtmlXTreeItemObject(l, c, e, a, g, h) { this.htmlNode = ""; this.acolor = ""; this.scolor = ""; this.tr = 0; this.childsCount = 0; this.tempDOMM = 0; this.tempDOMU = 0; this.dragSpan = 0; this.dragMove = 0; this.span = 0; this.closeble = 1; this.childNodes = new Array(); this.userData = new cObject(); this.checkstate = 0; this.treeNod = a; this.label = c; this.parentObject = e; this.actionHandler = g; this.images = new Array(a.imageArray[0], a.imageArray[1], a.imageArray[2]); this.id = a._globalIdStorageAdd(l, this); if (this.treeNod.checkBoxOff) { this.htmlNode = this.treeNod._createItem(1, this, h) } else { this.htmlNode = this.treeNod._createItem(0, this, h) } this.htmlNode.objBelong = this; return this } dhtmlXTreeObject.prototype._globalIdStorageAdd = function(c, a) { if (this._globalIdStorageFind(c, 1, 1)) { c = c + "_" + (new Date()).valueOf(); return this._globalIdStorageAdd(c, a) } this._idpull[c] = a; this._pullSize++; return c }; dhtmlXTreeObject.prototype._globalIdStorageSub = function(a) { if (this._idpull[a]) { this._unselectItem(this._idpull[a]); this._idpull[a] = null; this._pullSize-- } if ((this._locker) && (this._locker[a])) { this._locker[a] = false } }; dhtmlXTreeObject.prototype._globalIdStorageFind = function(l, a, e, g) { var h = this._idpull[l]; if (h) { if ((h.unParsed) && (!e)) { this.reParse(h, 0) } if (this._srnd && !h.htmlNode) { this._buildSRND(h, e) } if ((g) && (this._edsbpsA)) { for (var c = 0; c < this._edsbpsA.length; c++) { if (this._edsbpsA[c][2] == l) { dhx4.callEvent("ongetItemError", ["Requested item still in parsing process.", l]); return null } } } return h } if ((this.slowParse) && (l != 0) && (!a)) { return this.preParse(l) } else { return null } }; dhtmlXTreeObject.prototype._getSubItemsXML = function(a) { var c = []; a.each("item", function(e) { c.push(e.get("id")) }, this); return c.join(this.dlmtr) }; dhtmlXTreeObject.prototype.enableSmartXMLParsing = function(a) { this.slowParse = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.findXML = function(c, a, e) {}; dhtmlXTreeObject.prototype._getAllCheckedXML = function(c, a, g) { var e = []; if (g == 2) { c.through("item", "checked", -1, function(h) { e.push(h.get("id")) }, this) } if (g == 1) { c.through("item", "id", null, function(h) { if (h.get("checked") && (h.get("checked") != -1)) { e.push(h.get("id")) } }, this) } if (g == 0) { c.through("item", "id", null, function(h) { if (!h.get("checked") || h.get("checked") == 0) { e.push(h.get("id")) } }, this) } if (e.length) { return a + (a ? this.dlmtr : "") + e.join(this.dlmtr) } if (a) { return a } else { return "" } }; dhtmlXTreeObject.prototype._setSubCheckedXML = function(a, c) { var e = a ? "1" : ""; c.through("item", "id", null, function(g) { if (!g.get("disabled") || g.get("disabled") == 0) { g.set("checked", e) } }, this) }; dhtmlXTreeObject.prototype._getAllScraggyItemsXML = function(e, a) { var g = []; var c = function(h) { if (!h.sub_exists("item")) { g.push(h.get("id")) } else { h.each("item", c, this) } }; c(e); return g.join(",") }; dhtmlXTreeObject.prototype._getAllFatItemsXML = function(e, a) { var g = []; var c = function(h) { if (!h.sub_exists("item")) { return } g.push(h.get("id")); h.each("item", c, this) }; c(e); return g.join(",") }; dhtmlXTreeObject.prototype._getAllSubItemsXML = function(e, c, a) { var c = []; a.through("item", "id", null, function(g) { c.push(g.get("id")) }, this); return c.join(",") }; dhtmlXTreeObject.prototype.reParse = function(e) { var l = this; if (!this.parsCount) { l.callEvent("onXLS", [l, e.id]) } this.xmlstate = 1; var g = e.unParsed; e.unParsed = 0; this.XMLloadingWarning = 1; var a = this.parsingOn; var m = this.waitUpdateXML; var o = this.parsedArray; this.parsedArray = new Array(); this.waitUpdateXML = false; this.parsingOn = e.id; this.parsedArray = new Array(); this.setCheckList = ""; this._parse(g, e.id, 2); var q = this.setCheckList.split(this.dlmtr); for (var h = 0; h < this.parsedArray.length; h++) { e.htmlNode.childNodes[0].appendChild(this.parsedArray[h]) } if (g.get("order") && g.get("order") != "none") { this._reorderBranch(e, g.get("order"), true) } this.oldsmcheck = this.smcheck; this.smcheck = false; for (var c = 0; c < q.length; c++) { if (q[c]) { this.setCheck(q[c], 1) } } this.smcheck = this.oldsmcheck; this.parsingOn = a; this.waitUpdateXML = m; this.parsedArray = o; this.XMLloadingWarning = 0; this._redrawFrom(this, e); if (this._srnd && !e._sready) { this.prepareSR(e.id) } this.xmlstate = 0; return true }; dhtmlXTreeObject.prototype.preParse = function(c) { if (!c || !this._p) { return null } var a = false; this._p.clone().through("item", "id", c, function(g) { this._globalIdStorageFind(g.up().get("id")); return a = true }, this); if (a) { var e = this._globalIdStorageFind(c, true, false); if (!e) { dhx4.callEvent("ongetItemError", ["The item " + c + " not operable. Seems you have non-unique|incorrect IDs in tree's XML.", c]) } } return e }; dhtmlXTreeObject.prototype._escape = function(a) { switch (this.utfesc) { case "none": return a; break; case "utf8": return encodeURIComponent(a); break; default: return escape(a); break } }; dhtmlXTreeObject.prototype._drawNewTr = function(h, e) { var g = document.createElement("tr"); var c = document.createElement("td"); var a = document.createElement("td"); c.appendChild(document.createTextNode(" ")); a.colSpan = 3; a.appendChild(h); g.appendChild(c); g.appendChild(a); return g }; dhtmlXTreeObject.prototype.parse = function(g, e, a) { if (typeof e == "string") { a = e; e = null } if (a === "json") { return this._loadJSONObject(g, e) } else { if (a === "csv") { return this._loadCSVString(g, e) } else { if (a === "jsarray") { return this._loadJSArray(g, e) } } } var c = this; if (!this.parsCount) { this.callEvent("onXLS", [c, null]) } this.xmlstate = 1; this.XMLLoader({ responseXML: dhx4.ajax.parse(g) }, e) }; dhtmlXTreeObject.prototype.loadXMLString = function() { if (window.console && window.console.info) { window.console.info("loadXMLString was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44") } return this.parse.apply(this, arguments) }; dhtmlXTreeObject.prototype.load = function(c, h, e) { if (typeof h == "string") { e = h; h = null } e = e || this._datamode; if (e === "json") { return this._loadJSON(c, h) } else { if (e === "csv") { return this._loadCSV(c, h) } else { if (e === "jsarray") { return this._loadJSArrayFile(xmlString, h) } } } var g = this; if (!this.parsCount) { this.callEvent("onXLS", [g, this._ld_id]) } this._ld_id = null; this.xmlstate = 1; this.XMLLoader = this._parseXMLTree; var a = this; return dhx4.ajax.get(c, function(l) { a.XMLLoader(l.xmlDoc, h); a = null }) }; dhtmlXTreeObject.prototype.loadXML = function() { if (window.console && window.console.info) { window.console.info("loadXML was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44") } return this.load.apply(this, arguments) }; dhtmlXTreeObject.prototype._attachChildNode = function(m, l, g, o, D, C, A, q, e, u, v) { if (u && u.parentObject) { m = u.parentObject } if (((m.XMLload == 0) && (this.XMLsource)) && (!this.XMLloadingWarning)) { m.XMLload = 1; this._loadDynXML(m.id) } var r = m.childsCount; var E = m.childNodes; if (v && v.tr.previousSibling) { if (v.tr.previousSibling.previousSibling) { u = v.tr.previousSibling.nodem } else { q = q.replace("TOP", "") + ",TOP" } } if (u) { var h, y; for (h = 0; h < r; h++) { if (E[h] == u) { for (y = r; y != h; y--) { E[1 + y] = E[y] } break } } h++; r = h } if (q) { var w = q.split(","); for (var x = 0; x < w.length; x++) { switch (w[x]) { case "TOP": if (m.childsCount > 0) { u = new Object; u.tr = m.childNodes[0].tr.previousSibling } m._has_top = true; for (h = r; h > 0; h--) { E[h] = E[h - 1] } r = 0; break } } } var s; if (!(s = this._idpull[l]) || s.span != -1) { s = E[r] = new dhtmlXTreeItemObject(l, g, m, this, o, 1); l = E[r].id; m.childsCount++ } if (!s.htmlNode) { s.label = g; s.htmlNode = this._createItem((this.checkBoxOff ? 1 : 0), s); s.htmlNode.objBelong = s } if (D) { s.images[0] = D } if (C) { s.images[1] = C } if (A) { s.images[2] = A } var c = this._drawNewTr(s.htmlNode); if ((this.XMLloadingWarning) || (this._hAdI)) { s.htmlNode.parentNode.parentNode.style.display = "none" } if ((u) && u.tr && (u.tr.nextSibling)) { m.htmlNode.childNodes[0].insertBefore(c, u.tr.nextSibling) } else { if (this.parsingOn == m.id) { this.parsedArray[this.parsedArray.length] = c } else { m.htmlNode.childNodes[0].appendChild(c) } } if ((u) && (!u.span)) { u = null } if (this.XMLsource) { if ((e) && (e != 0)) { s.XMLload = 0 } else { s.XMLload = 1 } } s.tr = c; c.nodem = s; if (m.itemId == 0) { c.childNodes[0].className = "hiddenRow" } if ((m._r_logic) || (this._frbtr)) { this._setSrc(s.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0], this.imPath + this.radioArray[0]) } if (q) { var w = q.split(","); for (var x = 0; x < w.length; x++) { switch (w[x]) { case "SELECT": this.selectItem(l, false); break; case "CALL": this.selectItem(l, true); break; case "CHILD": s.XMLload = 0; break; case "CHECKED": if (this.XMLloadingWarning) { this.setCheckList += this.dlmtr + l } else { this.setCheck(l, 1) } break; case "HCHECKED": this._setCheck(s, "unsure"); break; case "OPEN": s.openMe = 1; break } } } if (!this.XMLloadingWarning) { if ((this._getOpenState(m) < 0) && (!this._hAdI)) { this.openItem(m.id) } if (u) { this._correctPlus(u); this._correctLine(u) } this._correctPlus(m); this._correctLine(m); this._correctPlus(s); if (m.childsCount >= 2) { this._correctPlus(E[m.childsCount - 2]); this._correctLine(E[m.childsCount - 2]) } if (m.childsCount != 2) { this._correctPlus(E[0]) } if (this.tscheck) { this._correctCheckStates(m) } if (this._onradh) { if (this.xmlstate == 1) { var a = this.onXLE; this.onXLE = function(n) { this._onradh(l); if (a) { a(n) } } } else { this._onradh(l) } } } return s }; dhtmlXTreeObject.prototype.enableContextMenu = function(a) { if (a) { this.cMenu = a } }; dhtmlXTreeObject.prototype.setItemContextMenu = function(h, g) { var a = h.toString().split(this.dlmtr); for (var e = 0; e < a.length; e++) { var c = this._globalIdStorageFind(a[e]); if (!c) { continue } c.cMenu = g } }; dhtmlXTreeObject.prototype.insertNewItem = function(g, n, q, e, m, l, h, c, a) { var r = this._globalIdStorageFind(g); if (!r) { return (-1) } var o = this._attachChildNode(r, n, q, e, m, l, h, c, a); if (!this._idpull[this.rootId].XMLload) { this._idpull[this.rootId].XMLload = 1 } if ((!this.XMLloadingWarning) && (this.childCalc)) { this._fixChildCountLabel(r) } return o }; dhtmlXTreeObject.prototype.insertNewChild = function(g, n, o, e, m, l, h, c, a) { return this.insertNewItem(g, n, o, e, m, l, h, c, a) }; dhtmlXTreeObject.prototype._parseXMLTree = function(a, e) { var c = new xmlPointer(dhx4.ajax.xmltop("tree", a)); this._parse(c); this._p = c; if (e) { e.call(this, a) } }; dhtmlXTreeObject.prototype._parseItem = function(l, q, h, n) { var e; if (this._srnd && (!this._idpull[e = l.get("id")] || !this._idpull[e].span)) { this._addItemSRND(q.id, e, l); return } var m = l.get_all(); if ((typeof(this.waitUpdateXML) == "object") && (!this.waitUpdateXML[m.id])) { this._parse(l, m.id, 1); return } if ((m.text === null) || (typeof(m.text) == "undefined")) { m.text = l.sub("itemtext"); if (m.text) { m.text = m.text.content() } } var s = []; if (m.select) { s.push("SELECT") } if (m.top) { s.push("TOP") } if (m.call) { this.nodeAskingCall = m.id } if (m.checked == -1) { s.push("HCHECKED") } else { if (m.checked) { s.push("CHECKED") } } if (m.open) { s.push("OPEN") } if (this.waitUpdateXML) { if (this._globalIdStorageFind(m.id)) { var o = this.updateItem(m.id, m.text, m.im0, m.im1, m.im2, m.checked, m.child) } else { if (this.npl == 0) { s.push("TOP") } else { h = q.childNodes[this.npl] } var o = this._attachChildNode(q, m.id, m.text, 0, m.im0, m.im1, m.im2, s.join(","), m.child, 0, h); m.id = o.id; h = null } } else { var o = this._attachChildNode(q, m.id, m.text, 0, m.im0, m.im1, m.im2, s.join(","), m.child, (n || 0), h) } if (m.tooltip) { o.span.parentNode.parentNode.title = m.tooltip } if (m.style) { if (o.span.style.cssText) { o.span.style.cssText += (";" + m.style) } else { o.span.setAttribute("style", o.span.getAttribute("style") + "; " + m.style) } } if (m.radio) { o._r_logic = true } if (m.nocheckbox) { var r = o.span.parentNode.previousSibling.previousSibling; r.style.display = "none"; o.nocheckbox = true } if (m.disabled) { if (m.checked != null) { this._setCheck(o, m.checked) } this.disableCheckbox(o, 1) } o._acc = m.child || 0; if (this.parserExtension) { this.parserExtension._parseExtension.call(this, l, m, (q ? q.id : 0)) } this.setItemColor(o, m.aCol, m.sCol); if (m.locked == "1") { this.lockItem(o.id, true, true) } if ((m.imwidth) || (m.imheight)) { this.setIconSize(m.imwidth, m.imheight, o) } if ((m.closeable == "0") || (m.closeable == "1")) { this.setItemCloseable(o, m.closeable) } var g = ""; if (m.topoffset) { this.setItemTopOffset(o, m.topoffset) } if ((!this.slowParse) || (typeof(this.waitUpdateXML) == "object")) { if (l.sub_exists("item")) { g = this._parse(l, m.id, 1) } } else { if ((!o.childsCount) && l.sub_exists("item")) { o.unParsed = l.clone() } l.each("userdata", function(a) { this.setUserData(m.id, a.get("name"), a.content()) }, this) } if (g != "") { this.nodeAskingCall = g } l.each("userdata", function(a) { this.setUserData(l.get("id"), a.get("name"), a.content()) }, this) }; dhtmlXTreeObject.prototype._parse = function(e, l, a, c) { if (this._srnd && !this.parentObject.offsetHeight) { var v = this; return window.setTimeout(function() { v._parse(e, l, a, c) }, 100) } if (!e.exists()) { return } this.skipLock = true; if (!l) { l = e.get("id"); if (this._dynDeleteBranches[l]) { this.deleteChildItems(l); this._dynDeleteBranches[l]--; if (!this._dynDeleteBranches[l]) { delete this._dynDeleteBranches[l] } } var s = e.get("dhx_security"); if (s) { dhtmlx.security_key = s } if (e.get("radio")) { this.htmlNode._r_logic = true } this.parsingOn = l; this.parsedArray = new Array(); this.setCheckList = ""; this.nodeAskingCall = "" } var u = this._globalIdStorageFind(l); if (!u) { return dhx4.callEvent("onDataStructureError", ["XML refers to not existing parent"]) } this.parsCount = this.parsCount ? (this.parsCount + 1) : 1; this.XMLloadingWarning = 1; if ((u.childsCount) && (!c) && (!this._edsbps) && (!u._has_top)) { var m = 0 } else { var m = 0 } this.npl = 0; e.each("item", function(w, n) { u.XMLload = 1; this._parseItem(w, u, 0, m); if ((this._edsbps) && (this.npl == this._edsbpsC)) { this._distributedStart(e, n + 1, l, a, u.childsCount); return -1 } this.npl++ }, this, c); if (!a) { e.each("userdata", function(n) { this.setUserData(e.get("id"), n.get("name"), n.content()) }, this); u.XMLload = 1; if (this.waitUpdateXML) { this.waitUpdateXML = false; for (var h = u.childsCount - 1; h >= 0; h--) { if (u.childNodes[h]._dmark) { this.deleteItem(u.childNodes[h].id) } } } var q = this._globalIdStorageFind(this.parsingOn); for (var h = 0; h < this.parsedArray.length; h++) { u.htmlNode.childNodes[0].appendChild(this.parsedArray[h]) } this.parsedArray = []; this.lastLoadedXMLId = l; this.XMLloadingWarning = 0; var r = this.setCheckList.split(this.dlmtr); for (var g = 0; g < r.length; g++) { if (r[g]) { this.setCheck(r[g], 1) } } if ((this.XMLsource) && (this.tscheck) && (this.smcheck) && (u.id != this.rootId)) { if (u.checkstate === 0) { this._setSubChecked(0, u) } else { if (u.checkstate === 1) { this._setSubChecked(1, u) } } } this._redrawFrom(this, null, c); if (e.get("order") && e.get("order") != "none") { this._reorderBranch(u, e.get("order"), true) } if (this.nodeAskingCall != "") { this.callEvent("onClick", [this.nodeAskingCall, this.getSelectedItemId()]) } if (this._branchUpdate) { this._branchUpdateNext(e) } } if (this.parsCount == 1) { this.parsingOn = null; if (this._srnd && u.id != this.rootId) { this.prepareSR(u.id); if (this.XMLsource) { this.openItem(u.id) } } e.through("item", "open", null, function(n) { this.openItem(n.get("id")) }, this); if ((!this._edsbps) || (!this._edsbpsA.length)) { var o = this; window.setTimeout(function() { o.callEvent("onXLE", [o, l]) }, 1); this.xmlstate = 0 } this.skipLock = false } this.parsCount--; var o = this; if (this._edsbps) { window.setTimeout(function() { o._distributedStep(l) }, this._edsbpsD) } if (!a && this.onXLE) { this.onXLE(this, l) } return this.nodeAskingCall }; dhtmlXTreeObject.prototype._branchUpdateNext = function(a) { a.each("item", function(g) { var e = g.get("id"); if (this._idpull[e] && (!this._idpull[e].XMLload)) { return } this._branchUpdate++; this.smartRefreshItem(g.get("id"), g) }, this); this._branchUpdate-- }; dhtmlXTreeObject.prototype.checkUserData = function(c, e) { if ((c.nodeType == 1) && (c.tagName == "userdata")) { var a = c.getAttribute("name"); if ((a) && (c.childNodes[0])) { this.setUserData(e, a, c.childNodes[0].data) } } }; dhtmlXTreeObject.prototype._redrawFrom = function(n, c, m, e) { if (!c) { var h = n._globalIdStorageFind(n.lastLoadedXMLId); n.lastLoadedXMLId = -1; if (!h) { return 0 } } else { h = c } var l = 0; for (var g = (m ? m - 1 : 0); g < h.childsCount; g++) { if ((!this._branchUpdate) || (this._getOpenState(h) == 1)) { if ((!c) || (e == 1)) { h.childNodes[g].htmlNode.parentNode.parentNode.style.display = "" } } if (h.childNodes[g].openMe == 1) { this._openItem(h.childNodes[g]); h.childNodes[g].openMe = 0 } n._redrawFrom(n, h.childNodes[g]); if (this.childCalc != null) { if ((h.childNodes[g].unParsed) || ((!h.childNodes[g].XMLload) && (this.XMLsource))) { if (h.childNodes[g]._acc) { h.childNodes[g].span.innerHTML = h.childNodes[g].label + this.htmlcA + h.childNodes[g]._acc + this.htmlcB } else { h.childNodes[g].span.innerHTML = h.childNodes[g].label } } if ((h.childNodes[g].childNodes.length) && (this.childCalc)) { if (this.childCalc == 1) { h.childNodes[g].span.innerHTML = h.childNodes[g].label + this.htmlcA + h.childNodes[g].childsCount + this.htmlcB } if (this.childCalc == 2) { var a = h.childNodes[g].childsCount - (h.childNodes[g].pureChilds || 0); if (a) { h.childNodes[g].span.innerHTML = h.childNodes[g].label + this.htmlcA + a + this.htmlcB } if (h.pureChilds) { h.pureChilds++ } else { h.pureChilds = 1 } } if (this.childCalc == 3) { h.childNodes[g].span.innerHTML = h.childNodes[g].label + this.htmlcA + h.childNodes[g]._acc + this.htmlcB } if (this.childCalc == 4) { var a = h.childNodes[g]._acc; if (a) { h.childNodes[g].span.innerHTML = h.childNodes[g].label + this.htmlcA + a + this.htmlcB } } } else { if (this.childCalc == 4) { l++ } } l += h.childNodes[g]._acc; if (this.childCalc == 3) { l++ } } } if ((!h.unParsed) && ((h.XMLload) || (!this.XMLsource))) { h._acc = l } n._correctLine(h); n._correctPlus(h); if ((this.childCalc) && (!c)) { n._fixChildCountLabel(h) } }; dhtmlXTreeObject.prototype._createSelf = function() { var a = document.createElement("div"); a.className = "containerTableStyle"; a.style.width = this.width; a.style.height = this.height; this.parentObject.appendChild(a); return a }; dhtmlXTreeObject.prototype._xcloseAll = function(c) { if (c.unParsed) { return } if (this.rootId != c.id) { if (!c.htmlNode) { return } var g = c.htmlNode.childNodes[0].childNodes; var a = g.length; for (var e = 1; e < a; e++) { g[e].style.display = "none" } this._correctPlus(c) } for (var e = 0; e < c.childsCount; e++) { if (c.childNodes[e].childsCount) { this._xcloseAll(c.childNodes[e]) } } }; dhtmlXTreeObject.prototype._xopenAll = function(a) { this._HideShow(a, 2); for (var c = 0; c < a.childsCount; c++) { this._xopenAll(a.childNodes[c]) } }; dhtmlXTreeObject.prototype._correctPlus = function(c) { if (!c.htmlNode) { return } var e = c.htmlNode.childNodes[0].childNodes[0].childNodes[0].lastChild; var h = c.htmlNode.childNodes[0].childNodes[0].childNodes[2].childNodes[0]; var a = this.lineArray; if ((this.XMLsource) && (!c.XMLload)) { var a = this.plusArray; this._setSrc(h, this.iconURL + c.images[2]); if (this._txtimg) { return (e.innerHTML = "[+]") } } else { if ((c.childsCount) || (c.unParsed)) { if ((c.htmlNode.childNodes[0].childNodes[1]) && (c.htmlNode.childNodes[0].childNodes[1].style.display != "none")) { if (!c.wsign) { var a = this.minusArray } this._setSrc(h, this.iconURL + c.images[1]); if (this._txtimg) { return (e.innerHTML = "[-]") } } else { if (!c.wsign) { var a = this.plusArray } this._setSrc(h, this.iconURL + c.images[2]); if (this._txtimg) { return (e.innerHTML = "[+]") } } } else { this._setSrc(h, this.iconURL + c.images[0]) } } var g = 2; if (!c.treeNod.treeLinesOn) { this._setSrc(e, this.imPath + a[3]) } else { if (c.parentObject) { g = this._getCountStatus(c.id, c.parentObject) } this._setSrc(e, this.imPath + a[g]) } }; dhtmlXTreeObject.prototype._correctLine = function(c) { if (!c.htmlNode) { return } var a = c.parentObject; if (a) { if ((this._getLineStatus(c.id, a) == 0) || (!this.treeLinesOn)) { for (var e = 1; e <= c.childsCount; e++) { if (!c.htmlNode.childNodes[0].childNodes[e]) { break } c.htmlNode.childNodes[0].childNodes[e].childNodes[0].style.backgroundImage = ""; c.htmlNode.childNodes[0].childNodes[e].childNodes[0].style.backgroundRepeat = "" } } else { for (var e = 1; e <= c.childsCount; e++) { if (!c.htmlNode.childNodes[0].childNodes[e]) { break } c.htmlNode.childNodes[0].childNodes[e].childNodes[0].style.backgroundImage = "url(" + this.imPath + this.lineArray[5] + ")"; c.htmlNode.childNodes[0].childNodes[e].childNodes[0].style.backgroundRepeat = "repeat-y" } } } }; dhtmlXTreeObject.prototype._getCountStatus = function(c, a) { if (a.childsCount <= 1) { if (a.id == this.rootId) { return 4 } else { return 0 } } if (a.childNodes[0].id == c) { if (a.id == this.rootId) { return 2 } else { return 1 } } if (a.childNodes[a.childsCount - 1].id == c) { return 0 } return 1 }; dhtmlXTreeObject.prototype._getLineStatus = function(c, a) { if (a.childNodes[a.childsCount - 1].id == c) { return 0 } return 1 }; dhtmlXTreeObject.prototype._HideShow = function(c, h) { if (this._locker && !this.skipLock && this._locker[c.id]) { return } if ((this.XMLsource) && (!c.XMLload)) { if (h == 1) { return } c.XMLload = 1; this._loadDynXML(c.id); return } if (c.unParsed) { this.reParse(c) } var g = c.htmlNode.childNodes[0].childNodes; var a = g.length; if (a > 1) { if (((g[1].style.display != "none") || (h == 1)) && (h != 2)) { this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0"; nodestyle = "none" } else { nodestyle = "" } for (var e = 1; e < a; e++) { g[e].style.display = nodestyle } } this._correctPlus(c) }; dhtmlXTreeObject.prototype._getOpenState = function(a) { if (!a.htmlNode) { return 0 } var c = a.htmlNode.childNodes[0].childNodes; if (c.length <= 1) { return 0 } if (c[1].style.display != "none") { return 1 } else { return -1 } }; dhtmlXTreeObject.prototype.onRowClick2 = function() { var a = this.parentObject.treeNod; if (!a.callEvent("onDblClick", [this.parentObject.id, a])) { return false } if ((this.parentObject.closeble) && (this.parentObject.closeble != "0")) { a._HideShow(this.parentObject) } else { a._HideShow(this.parentObject, 2) } if (a.checkEvent("onOpenEnd")) { if (!a.xmlstate) { a.callEvent("onOpenEnd", [this.parentObject.id, a._getOpenState(this.parentObject)]) } else { a._oie_onXLE.push(a.onXLE); a.onXLE = a._epnFHe } } return false }; dhtmlXTreeObject.prototype.onRowClick = function() { var a = this.parentObject.treeNod; if (!a.callEvent("onOpenStart", [this.parentObject.id, a._getOpenState(this.parentObject)])) { return 0 } if ((this.parentObject.closeble) && (this.parentObject.closeble != "0")) { a._HideShow(this.parentObject) } else { a._HideShow(this.parentObject, 2) } if (a.checkEvent("onOpenEnd")) { if (!a.xmlstate) { a.callEvent("onOpenEnd", [this.parentObject.id, a._getOpenState(this.parentObject)]) } else { a._oie_onXLE.push(a.onXLE); a.onXLE = a._epnFHe } } }; dhtmlXTreeObject.prototype._epnFHe = function(c, e, a) { if (e != this.rootId) { this.callEvent("onOpenEnd", [e, c.getOpenState(e)]) } c.onXLE = c._oie_onXLE.pop(); if (!a && !c._oie_onXLE.length) { if (c.onXLE) { c.onXLE(c, e) } } }; dhtmlXTreeObject.prototype.onRowClickDown = function(c) { c = c || window.event; var a = this.parentObject.treeNod; a._selectItem(this.parentObject, c) }; dhtmlXTreeObject.prototype.getSelectedItemId = function() { var c = new Array(); for (var a = 0; a < this._selected.length; a++) { c[a] = this._selected[a].id } return (c.join(this.dlmtr)) }; dhtmlXTreeObject.prototype._selectItem = function(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.span.parentNode.parentNode.className = "selectedTreeRowFull"; a.i_sel = true; this._selected[this._selected.length] = a }; dhtmlXTreeObject.prototype.getIndexById = function(c) { var a = this._globalIdStorageFind(c); if (!a) { return null } return this._getIndex(a) }; dhtmlXTreeObject.prototype._getIndex = function(a) { var e = a.parentObject; for (var c = 0; c < e.childsCount; c++) { if (e.childNodes[c] == a) { return c } } }; dhtmlXTreeObject.prototype._unselectItem = function(c) { if ((c) && (c.i_sel)) { c.span.className = "standartTreeRow"; c.span.parentNode.parentNode.className = ""; 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"; c.span.parentNode.parentNode.className = ""; 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(h) { if (!this.tscheck) { return } if (!h) { return } if (h.id == this.rootId) { return } var e = h.childNodes; var c = 0; var a = 0; if (h.childsCount == 0) { return } for (var g = 0; g < h.childsCount; g++) { if (e[g].dscheck) { continue } if (e[g].checkstate == 0) { c = 1 } else { if (e[g].checkstate == 1) { a = 1 } else { c = 1; a = 1; break } } } if ((c) && (a)) { this._setCheck(h, "unsure") } else { if (c) { this._setCheck(h, false) } else { this._setCheck(h, true) } } this._correctCheckStates(h.parentObject) }; dhtmlXTreeObject.prototype.onCheckBoxClick = function(a) { if (!this.treeNod.callEvent("onBeforeCheck", [this.parentObject.id, this.parentObject.checkstate])) { return } if (this.parentObject.dscheck) { return true } if (this.treeNod.tscheck) { if (this.parentObject.checkstate == 1) { this.treeNod._setSubChecked(false, this.parentObject) } else { this.treeNod._setSubChecked(true, this.parentObject) } } else { if (this.parentObject.checkstate == 1) { this.treeNod._setCheck(this.parentObject, false) } else { this.treeNod._setCheck(this.parentObject, true) } } this.treeNod._correctCheckStates(this.parentObject.parentObject); return this.treeNod.callEvent("onCheck", [this.parentObject.id, this.parentObject.checkstate]) }; dhtmlXTreeObject.prototype._createItem = function(s, r, n) { var u = document.createElement("table"); u.cellSpacing = 0; u.cellPadding = 0; u.border = 0; if (this.hfMode) { u.style.tableLayout = "fixed" } u.style.margin = 0; u.style.padding = 0; var m = document.createElement("tbody"); var q = document.createElement("tr"); var g = document.createElement("td"); g.className = "standartTreeImage"; if (this._txtimg) { var h = document.createElement("div"); g.appendChild(h); h.className = "dhx_tree_textSign" } else { var h = this._getImg(r.id); h.border = "0"; if (h.tagName == "IMG") { h.align = "absmiddle" } g.appendChild(h); h.style.padding = 0; h.style.margin = 0; h.style.width = this.def_line_img_x } var e = document.createElement("td"); var o = this._getImg(this.cBROf ? this.rootId : r.id); o.checked = 0; this._setSrc(o, this.imPath + this.checkArray[0]); o.style.width = "18px"; o.style.height = "18px"; if (!s) { e.style.display = "none" } e.appendChild(o); if ((!this.cBROf) && (o.tagName == "IMG")) { o.align = "absmiddle" } o.onclick = this.onCheckBoxClick; o.treeNod = this; o.parentObject = r; if (!window._KHTMLrv) { e.width = "20px" } else { e.width = "16px" } var c = document.createElement("td"); c.className = "standartTreeImage"; var l = this._getImg(this.timgen ? r.id : this.rootId); l.onmousedown = this._preventNsDrag; l.ondragstart = this._preventNsDrag; l.border = "0"; if (this._aimgs) { l.parentObject = r; if (l.tagName == "IMG") { l.align = "absmiddle" } l.onclick = this.onRowSelect } if (!n) { this._setSrc(l, this.iconURL + this.imageArray[0]) } c.appendChild(l); l.style.padding = 0; l.style.margin = 0; if (this.timgen) { c.style.width = l.style.width = this.def_img_x; l.style.height = this.def_img_y } else { l.style.width = "0px"; l.style.height = "0px"; if (_isOpera || window._KHTMLrv) { c.style.display = "none" } } var a = document.createElement("td"); a.className = "dhxTextCell standartTreeRow"; r.span = document.createElement("span"); r.span.className = "standartTreeRow"; if (this.mlitems) { r.span.style.width = this.mlitems; r.span.style.display = "block" } else { a.noWrap = true } if (dhx4.isIE8) { a.style.width = "99999px" } else { if (!window._KHTMLrv) { a.style.width = "100%" } } r.span.innerHTML = r.label; a.appendChild(r.span); a.parentObject = r; g.parentObject = r; a.onclick = this.onRowSelect; g.onclick = this.onRowClick; a.ondblclick = this.onRowClick2; if (this.ettip) { q.title = r.label } if (this.dragAndDropOff) { if (this._aimgs) { this.dragger.addDraggableItem(c, this); c.parentObject = r } this.dragger.addDraggableItem(a, this) } r.span.style.paddingLeft = "5px"; r.span.style.paddingRight = "5px"; a.style.verticalAlign = ""; a.style.fontSize = "10pt"; a.style.cursor = this.style_pointer; q.appendChild(g); q.appendChild(e); q.appendChild(c); q.appendChild(a); m.appendChild(q); u.appendChild(m); if (this.ehlt || this.checkEvent("onMouseIn") || this.checkEvent("onMouseOut")) { q.onmousemove = this._itemMouseIn; q[(_isIE) ? "onmouseleave" : "onmouseout"] = this._itemMouseOut } return u }; dhtmlXTreeObject.prototype.setImagePath = function(a) { this.imPath = a; this.iconURL = a }; dhtmlXTreeObject.prototype.setIconPath = function(a) { this.iconURL = a }; dhtmlXTreeObject.prototype._getLeafCount = function(g) { var e = 0; for (var c = 0; c < g.childsCount; c++) { if (g.childNodes[c].childsCount == 0) { e++ } } return e }; dhtmlXTreeObject.prototype._getChildCounterValue = function(c) { var a = this._globalIdStorageFind(c); if (!a) { return 0 } if ((a.unParsed) || ((!a.XMLload) && (this.XMLsource))) { return a._acc } switch (this.childCalc) { case 1: return a.childsCount; break; case 2: return this._getLeafCount(a); break; case 3: return a._acc; break; case 4: return a._acc; break } }; dhtmlXTreeObject.prototype._fixChildCountLabel = function(l, g) { if (this.childCalc == null) { return } if ((l.unParsed) || ((!l.XMLload) && (this.XMLsource))) { if (l._acc) { l.span.innerHTML = l.label + this.htmlcA + l._acc + this.htmlcB } else { l.span.innerHTML = l.label } return } switch (this.childCalc) { case 1: if (l.childsCount != 0) { l.span.innerHTML = l.label + this.htmlcA + l.childsCount + this.htmlcB } else { l.span.innerHTML = l.label } break; case 2: var h = this._getLeafCount(l); if (h != 0) { l.span.innerHTML = l.label + this.htmlcA + h + this.htmlcB } else { l.span.innerHTML = l.label } break; case 3: if (l.childsCount != 0) { var e = 0; for (var c = 0; c < l.childsCount; c++) { if (!l.childNodes[c]._acc) { l.childNodes[c]._acc = 0 } e += l.childNodes[c]._acc * 1 } e += l.childsCount * 1; l.span.innerHTML = l.label + this.htmlcA + e + this.htmlcB; l._acc = e } else { l.span.innerHTML = l.label; l._acc = 0 } if ((l.parentObject) && (l.parentObject != this.htmlNode)) { this._fixChildCountLabel(l.parentObject) } break; case 4: if (l.childsCount != 0) { var e = 0; for (var c = 0; c < l.childsCount; c++) { if (!l.childNodes[c]._acc) { l.childNodes[c]._acc = 1 } e += l.childNodes[c]._acc * 1 } l.span.innerHTML = l.label + this.htmlcA + e + this.htmlcB; l._acc = e } else { l.span.innerHTML = l.label; l._acc = 1 } if ((l.parentObject) && (l.parentObject != this.htmlNode)) { this._fixChildCountLabel(l.parentObject) } break } }; dhtmlXTreeObject.prototype.setChildCalcMode = function(a) { switch (a) { case "child": this.childCalc = 1; break; case "leafs": this.childCalc = 2; break; case "childrec": this.childCalc = 3; break; case "leafsrec": this.childCalc = 4; break; case "disabled": this.childCalc = null; break; default: this.childCalc = 4 } }; dhtmlXTreeObject.prototype.setChildCalcHTML = function(c, a) { this.htmlcA = c; this.htmlcB = a }; dhtmlXTreeObject.prototype.setOnRightClickHandler = function(a) { this.attachEvent("onRightClick", a) }; dhtmlXTreeObject.prototype.setOnClickHandler = function(a) { this.attachEvent("onClick", a) }; dhtmlXTreeObject.prototype.setOnSelectStateChange = function(a) { this.attachEvent("onSelect", a) }; dhtmlXTreeObject.prototype.setXMLAutoLoading = function(a) { this.XMLsource = a }; dhtmlXTreeObject.prototype.setOnCheckHandler = function(a) { this.attachEvent("onCheck", a) }; dhtmlXTreeObject.prototype.setOnOpenHandler = function(a) { this.attachEvent("onOpenStart", a) }; dhtmlXTreeObject.prototype.setOnOpenStartHandler = function(a) { this.attachEvent("onOpenStart", a) }; dhtmlXTreeObject.prototype.setOnOpenEndHandler = function(a) { this.attachEvent("onOpenEnd", a) }; dhtmlXTreeObject.prototype.setOnDblClickHandler = function(a) { this.attachEvent("onDblClick", a) }; dhtmlXTreeObject.prototype.openAllItems = function(c) { var a = this._globalIdStorageFind(c); if (!a) { return 0 } this._xopenAll(a) }; dhtmlXTreeObject.prototype.getOpenState = function(c) { var a = this._globalIdStorageFind(c); if (!a) { return "" } return this._getOpenState(a) }; dhtmlXTreeObject.prototype.closeAllItems = function(c) { if (c === window.undefined) { c = this.rootId } var a = this._globalIdStorageFind(c); if (!a) { return 0 } this._xcloseAll(a); this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0" }; dhtmlXTreeObject.prototype.setUserData = function(g, c, e) { var a = this._globalIdStorageFind(g, 0, true); if (!a) { return } if (c == "hint") { a.htmlNode.childNodes[0].childNodes[0].title = e } if (typeof(a.userData["t_" + c]) == "undefined") { if (!a._userdatalist) { a._userdatalist = c } else { a._userdatalist += "," + c } } a.userData["t_" + c] = e }; dhtmlXTreeObject.prototype.getUserData = function(e, c) { var a = this._globalIdStorageFind(e, 0, true); if (!a) { return } return a.userData["t_" + c] }; dhtmlXTreeObject.prototype.getItemColor = function(e) { var a = this._globalIdStorageFind(e); if (!a) { return 0 } var c = new Object(); if (a.acolor) { c.acolor = a.acolor } if (a.scolor) { c.scolor = a.scolor } return c }; dhtmlXTreeObject.prototype.setItemColor = function(e, c, g) { if ((e) && (e.span)) { var a = e } else { var a = this._globalIdStorageFind(e) } if (!a) { return 0 } else { if (a.i_sel) { if (g || c) { a.span.style.color = g || c } } else { if (c) { a.span.style.color = c } } if (g) { a.scolor = g } if (c) { a.acolor = c } } }; dhtmlXTreeObject.prototype.getItemText = function(c) { var a = this._globalIdStorageFind(c); if (!a) { return 0 } return (a.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].innerHTML) }; dhtmlXTreeObject.prototype.getParentId = function(c) { var a = this._globalIdStorageFind(c); if ((!a) || (!a.parentObject)) { return "" } return a.parentObject.id }; dhtmlXTreeObject.prototype.changeItemId = function(c, e) { if (c == e) { return } var a = this._globalIdStorageFind(c); if (!a) { return 0 } a.id = e; a.span.contextMenuId = e; this._idpull[e] = this._idpull[c]; delete this._idpull[c] }; dhtmlXTreeObject.prototype.doCut = function() { if (this.nodeCut) { this.clearCut() } this.nodeCut = (new Array()).concat(this._selected); for (var a = 0; a < this.nodeCut.length; a++) { var c = this.nodeCut[a]; c._cimgs = new Array(); c._cimgs[0] = c.images[0]; c._cimgs[1] = c.images[1]; c._cimgs[2] = c.images[2]; c.images[0] = c.images[1] = c.images[2] = this.cutImage; this._correctPlus(c) } }; dhtmlXTreeObject.prototype.doPaste = function(e) { var a = this._globalIdStorageFind(e); if (!a) { return 0 } for (var c = 0; c < this.nodeCut.length; c++) { if (this._checkPNodes(a, this.nodeCut[c])) { continue } this._moveNode(this.nodeCut[c], a) } this.clearCut() }; dhtmlXTreeObject.prototype.clearCut = function() { for (var a = 0; a < this.nodeCut.length; a++) { var c = this.nodeCut[a]; c.images[0] = c._cimgs[0]; c.images[1] = c._cimgs[1]; c.images[2] = c._cimgs[2]; this._correctPlus(c) } this.nodeCut = new Array() }; dhtmlXTreeObject.prototype._moveNode = function(a, c) { var l = this.dadmodec; if (l == 1) { var h = c; if (this.dadmodefix < 0) { while (true) { h = this._getPrevNode(h); if ((h == -1)) { h = this.htmlNode; break } if ((h.tr == 0) || (h.tr.style.display == "") || (!h.parentObject)) { break } } var g = h; var e = c } else { if ((h.tr) && (h.tr.nextSibling) && (h.tr.nextSibling.nodem) && (this._getOpenState(h) < 1)) { h = h.tr.nextSibling.nodem } else { if (this._getOpenState(h) < 1) { h = this.htmlNode } else { h = this._getNextNode(h); if ((h == -1)) { h = this.htmlNode } } } var e = h; var g = c } if (this._getNodeLevel(g, 0) > this._getNodeLevel(e, 0)) { if (!this.dropLower) { return this._moveNodeTo(a, g.parentObject) } else { if (e.id != this.rootId) { return this._moveNodeTo(a, e.parentObject, e) } else { return this._moveNodeTo(a, this.htmlNode, null) } } } else { return this._moveNodeTo(a, e.parentObject, e) } } else { return this._moveNodeTo(a, c) } }; dhtmlXTreeObject.prototype._fixNodesCollection = function(n, l) { var c = 0; var g = 0; var m = n.childNodes; var a = n.childsCount - 1; if (l == m[a]) { return } for (var h = 0; h < a; h++) { if (m[h] == m[a]) { m[h] = m[h + 1]; m[h + 1] = m[a] } } for (var h = 0; h < a + 1; h++) { if (c) { var e = m[h]; m[h] = c; c = e } else { if (m[h] == l) { c = m[h]; m[h] = m[a] } } } }; dhtmlXTreeObject.prototype._recreateBranch = function(l, n, h, a) { var c; var o = ""; if (h) { for (c = 0; c < n.childsCount; c++) { if (n.childNodes[c] == h) { break } } if (c != 0) { h = n.childNodes[c - 1] } else { o = "TOP"; h = "" } } var e = this._onradh; this._onradh = null; var m = this._attachChildNode(n, l.id, l.label, 0, l.images[0], l.images[1], l.images[2], o, 0, h); m._userdatalist = l._userdatalist; m.userData = l.userData.clone(); if (l._attrs) { m._attrs = {}; for (var g in l._attrs) { m._attrs[g] = l._attrs[g] } } m.XMLload = l.XMLload; if (e) { this._onradh = e; this._onradh(m.id) } if (l.treeNod.dpcpy) { l.treeNod._globalIdStorageFind(l.id) } else { m.unParsed = l.unParsed } this._correctPlus(m); for (var c = 0; c < l.childsCount; c++) { this._recreateBranch(l.childNodes[c], m, 0, 1) } if ((!a) && (this.childCalc)) { this._redrawFrom(this, n) } return m }; dhtmlXTreeObject.prototype._moveNodeTo = function(s, v, r) { if (s.treeNod._nonTrivialNode) { return s.treeNod._nonTrivialNode(this, v, r, s) } if (this._checkPNodes(v, s)) { return false } if (v.mytype) { var m = (s.treeNod.lWin != v.lWin) } else { var m = (s.treeNod.lWin != v.treeNod.lWin) } if (!this.callEvent("onDrag", [s.id, v.id, (r ? r.id : null), s.treeNod, v.treeNod])) { return false } if ((v.XMLload == 0) && (this.XMLsource)) { v.XMLload = 1; this._loadDynXML(v.id) } this.openItem(v.id); var e = s.treeNod; var o = s.parentObject.childsCount; var q = s.parentObject; if ((m) || (e.dpcpy)) { var g = s.id; s = this._recreateBranch(s, v, r); if (!e.dpcpy) { e.deleteItem(g) } } else { var h = v.childsCount; var u = v.childNodes; if (h == 0) { v._open = true } e._unselectItem(s); u[h] = s; s.treeNod = v.treeNod; v.childsCount++; var n = this._drawNewTr(u[h].htmlNode); if (!r) { v.htmlNode.childNodes[0].appendChild(n); if (this.dadmode == 1) { this._fixNodesCollection(v, r) } } else { v.htmlNode.childNodes[0].insertBefore(n, r.tr); this._fixNodesCollection(v, r); u = v.childNodes } } if ((!e.dpcpy) && (!m)) { var a = s.tr; if ((document.all) && (navigator.appVersion.search(/MSIE\ 5\.0/gi) != -1)) { window.setTimeout(function() { a.parentNode.removeChild(a) }, 250) } else { s.parentObject.htmlNode.childNodes[0].removeChild(s.tr) } if ((!r) || (v != s.parentObject)) { for (var l = 0; l < q.childsCount; l++) { if (q.childNodes[l].id == s.id) { q.childNodes[l] = 0; break } } } else { q.childNodes[q.childsCount - 1] = 0 } e._compressChildList(q.childsCount, q.childNodes); q.childsCount-- } if ((!m) && (!e.dpcpy)) { s.tr = n; n.nodem = s; s.parentObject = v; if (e != v.treeNod) { if (s.treeNod._registerBranch(s, e)) { return } this._clearStyles(s); this._redrawFrom(this, s.parentObject); if (this._onradh) { this._onradh(s.id) } } this._correctPlus(v); this._correctLine(v); this._correctLine(s); this._correctPlus(s); if (r) { this._correctPlus(r) } else { if (v.childsCount >= 2) { this._correctPlus(u[v.childsCount - 2]); this._correctLine(u[v.childsCount - 2]) } } this._correctPlus(u[v.childsCount - 1]); if (this.tscheck) { this._correctCheckStates(v) } if (e.tscheck) { e._correctCheckStates(q) } } if (o > 1) { e._correctPlus(q.childNodes[o - 2]); e._correctLine(q.childNodes[o - 2]) } e._correctPlus(q); e._correctLine(q); this._fixChildCountLabel(v); e._fixChildCountLabel(q); this.callEvent("onDrop", [s.id, v.id, (r ? r.id : null), e, v.treeNod]); return s.id }; dhtmlXTreeObject.prototype._clearStyles = function(a) { if (!a.htmlNode) { return } var g = a.htmlNode.childNodes[0].childNodes[0].childNodes[1]; var c = g.nextSibling.nextSibling; a.span.innerHTML = a.label; a.i_sel = false; if (a._aimgs) { this.dragger.removeDraggableItem(g.nextSibling) } if (this.checkBoxOff) { g.childNodes[0].style.display = ""; g.childNodes[0].onclick = this.onCheckBoxClick; this._setSrc(g.childNodes[0], this.imPath + this.checkArray[a.checkstate]) } else { g.style.display = "none" } g.childNodes[0].treeNod = this; this.dragger.removeDraggableItem(c); if (this.dragAndDropOff) { this.dragger.addDraggableItem(c, this) } if (this._aimgs) { this.dragger.addDraggableItem(g.nextSibling, this) } c.childNodes[0].className = "standartTreeRow"; c.parentNode.className = ""; c.onclick = this.onRowSelect; c.ondblclick = this.onRowClick2; g.previousSibling.onclick = this.onRowClick; this._correctLine(a); this._correctPlus(a); for (var e = 0; e < a.childsCount; e++) { this._clearStyles(a.childNodes[e]) } }; dhtmlXTreeObject.prototype._registerBranch = function(c, a) { if (a) { a._globalIdStorageSub(c.id) } c.id = this._globalIdStorageAdd(c.id, c); c.treeNod = this; for (var e = 0; e < c.childsCount; e++) { this._registerBranch(c.childNodes[e], a) } return 0 }; dhtmlXTreeObject.prototype.enableThreeStateCheckboxes = function(a) { this.tscheck = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.setOnMouseInHandler = function(a) { this.ehlt = true; this.attachEvent("onMouseIn", a) }; dhtmlXTreeObject.prototype.setOnMouseOutHandler = function(a) { this.ehlt = true; this.attachEvent("onMouseOut", a) }; dhtmlXTreeObject.prototype.enableMercyDrag = function(a) { this.dpcpy = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.enableTreeImages = function(a) { this.timgen = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.enableFixedMode = function(a) { this.hfMode = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.enableCheckBoxes = function(c, a) { this.checkBoxOff = dhx4.s2b(c); this.cBROf = (!(this.checkBoxOff || dhx4.s2b(a))) }; dhtmlXTreeObject.prototype.setStdImages = function(a, e, c) { this.imageArray[0] = a; this.imageArray[1] = e; this.imageArray[2] = c }; dhtmlXTreeObject.prototype.enableTreeLines = function(a) { this.treeLinesOn = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.setImageArrays = function(g, a, l, h, e, c) { switch (g) { case "plus": this.plusArray[0] = a; this.plusArray[1] = l; this.plusArray[2] = h; this.plusArray[3] = e; this.plusArray[4] = c; break; case "minus": this.minusArray[0] = a; this.minusArray[1] = l; this.minusArray[2] = h; this.minusArray[3] = e; this.minusArray[4] = c; break } }; dhtmlXTreeObject.prototype.openItem = function(c) { this.skipLock = true; var a = this._globalIdStorageFind(c); if (!a) { return 0 } else { return this._openItem(a) } this.skipLock = false }; dhtmlXTreeObject.prototype._openItem = function(a) { var c = this._getOpenState(a); if ((c < 0) || (((this.XMLsource) && (!a.XMLload)))) { if (!this.callEvent("onOpenStart", [a.id, c])) { return 0 } this._HideShow(a, 2); if (this.checkEvent("onOpenEnd")) { if (this.onXLE == this._epnFHe) { this._epnFHe(this, a.id, true) } if (!this.xmlstate || !this.XMLsource) { this.callEvent("onOpenEnd", [a.id, this._getOpenState(a)]) } else { this._oie_onXLE.push(this.onXLE); this.onXLE = this._epnFHe } } } else { if (this._srnd) { this._HideShow(a, 2) } } if (a.parentObject && !this._skip_open_parent) { this._openItem(a.parentObject) } }; dhtmlXTreeObject.prototype.closeItem = function(c) { if (this.rootId == c) { return 0 } this.skipLock = true; var a = this._globalIdStorageFind(c); if (!a) { return 0 } if (a.closeble) { this._HideShow(a, 1) } this.skipLock = false }; dhtmlXTreeObject.prototype.getLevel = function(c) { var a = this._globalIdStorageFind(c); if (!a) { return 0 } return this._getNodeLevel(a, 0) }; dhtmlXTreeObject.prototype.setItemCloseable = function(e, a) { a = dhx4.s2b(a); if ((e) && (e.span)) { var c = e } else { var c = this._globalIdStorageFind(e) } if (!c) { return 0 } c.closeble = a }; dhtmlXTreeObject.prototype._getNodeLevel = function(a, c) { if (a.parentObject) { return this._getNodeLevel(a.parentObject, c + 1) } return (c) }; dhtmlXTreeObject.prototype.hasChildren = function(c) { var a = this._globalIdStorageFind(c); if (!a) { return 0 } else { if ((this.XMLsource) && (!a.XMLload)) { return true } else { return a.childsCount } } }; dhtmlXTreeObject.prototype._getLeafCount = function(g) { var e = 0; for (var c = 0; c < g.childsCount; c++) { if (g.childNodes[c].childsCount == 0) { e++ } } return e }; dhtmlXTreeObject.prototype.setItemText = function(g, e, c) { var a = this._globalIdStorageFind(g); if (!a) { return 0 } a.label = e; a.span.innerHTML = e; if (this.childCalc) { this._fixChildCountLabel(a) } a.span.parentNode.parentNode.title = c || "" }; dhtmlXTreeObject.prototype.getItemTooltip = function(c) { var a = this._globalIdStorageFind(c); if (!a) { return "" } return (a.span.parentNode.parentNode._dhx_title || a.span.parentNode.parentNode.title || "") }; dhtmlXTreeObject.prototype.refreshItem = function(c) { if (!c) { c = this.rootId } var a = this._globalIdStorageFind(c); this._dynDeleteBranches[c] = (this._dynDeleteBranches[c] || 0) + 1; this._loadDynXML(c) }; dhtmlXTreeObject.prototype.setItemImage2 = function(g, a, h, e) { var c = this._globalIdStorageFind(g); if (!c) { return 0 } c.images[1] = h; c.images[2] = e; c.images[0] = a; this._correctPlus(c) }; dhtmlXTreeObject.prototype.setItemImage = function(e, a, g) { var c = this._globalIdStorageFind(e); if (!c) { return 0 } if (g) { c.images[1] = a; c.images[2] = g } else { c.images[0] = a } this._correctPlus(c) }; dhtmlXTreeObject.prototype.getSubItems = function(e) { var a = this._globalIdStorageFind(e, 0, 1); if (!a) { return 0 } if (a.unParsed) { return (this._getSubItemsXML(a.unParsed)) } var c = ""; for (i = 0; i < a.childsCount; i++) { if (!c) { c = "" + a.childNodes[i].id } else { c += this.dlmtr + a.childNodes[i].id } } return c }; dhtmlXTreeObject.prototype._getAllScraggyItems = function(e) { var g = ""; for (var c = 0; c < e.childsCount; c++) { if ((e.childNodes[c].unParsed) || (e.childNodes[c].childsCount > 0)) { if (e.childNodes[c].unParsed) { var a = this._getAllScraggyItemsXML(e.childNodes[c].unParsed, 1) } else { var a = this._getAllScraggyItems(e.childNodes[c]) } if (a) { if (g) { g += this.dlmtr + a } else { g = a } } } else { if (!g) { g = "" + e.childNodes[c].id } else { g += this.dlmtr + e.childNodes[c].id } } } return g }; dhtmlXTreeObject.prototype._getAllFatItems = function(e) { var g = ""; for (var c = 0; c < e.childsCount; c++) { if ((e.childNodes[c].unParsed) || (e.childNodes[c].childsCount > 0)) { if (!g) { g = "" + e.childNodes[c].id } else { g += this.dlmtr + e.childNodes[c].id } if (e.childNodes[c].unParsed) { var a = this._getAllFatItemsXML(e.childNodes[c].unParsed, 1) } else { var a = this._getAllFatItems(e.childNodes[c]) } if (a) { g += this.dlmtr + a } } } return g }; dhtmlXTreeObject.prototype._getAllSubItems = function(l, h, g) { if (g) { c = g } else { var c = this._globalIdStorageFind(l) } if (!c) { return 0 } h = ""; for (var e = 0; e < c.childsCount; e++) { if (!h) { h = "" + c.childNodes[e].id } else { h += this.dlmtr + c.childNodes[e].id } var a = this._getAllSubItems(0, h, c.childNodes[e]); if (a) { h += this.dlmtr + a } } if (c.unParsed) { h = this._getAllSubItemsXML(l, h, c.unParsed) } return h }; dhtmlXTreeObject.prototype.selectItem = function(g, e, c) { e = dhx4.s2b(e); var a = this._globalIdStorageFind(g); if ((!a) || (!a.parentObject)) { return 0 } if (this.XMLloadingWarning) { a.parentObject.openMe = 1 } else { this._openItem(a.parentObject) } var h = null; if (c) { h = new Object; h.ctrlKey = true; if (a.i_sel) { h.skipUnSel = true } } if (e) { this.onRowSelect(h, a.htmlNode.childNodes[0].childNodes[0].childNodes[3], false) } else { this.onRowSelect(h, a.htmlNode.childNodes[0].childNodes[0].childNodes[3], true) } }; dhtmlXTreeObject.prototype.getSelectedItemText = function() { var c = new Array(); for (var a = 0; a < this._selected.length; a++) { c[a] = this._selected[a].span.innerHTML } return (c.join(this.dlmtr)) }; dhtmlXTreeObject.prototype._compressChildList = function(a, e) { a--; for (var c = 0; c < a; c++) { if (e[c] == 0) { e[c] = e[c + 1]; e[c + 1] = 0 } } }; dhtmlXTreeObject.prototype._deleteNode = function(m, h, o) { if ((!h) || (!h.parentObject)) { return 0 } var a = 0; var c = 0; if (h.tr.nextSibling) { a = h.tr.nextSibling.nodem } if (h.tr.previousSibling) { c = h.tr.previousSibling.nodem } var l = h.parentObject; var e = l.childsCount; var n = l.childNodes; for (var g = 0; g < e; g++) { if (n[g].id == m) { if (!o) { l.htmlNode.childNodes[0].removeChild(n[g].tr) } n[g] = 0; break } } this._compressChildList(e, n); if (!o) { l.childsCount-- } if (a) { this._correctPlus(a); this._correctLine(a) } if (c) { this._correctPlus(c); this._correctLine(c) } if (this.tscheck) { this._correctCheckStates(l) } if (!o) { this._globalIdStorageRecSub(h) } }; dhtmlXTreeObject.prototype.setCheck = function(e, c) { var a = this._globalIdStorageFind(e, 0, 1); if (!a) { return } if (c === "unsure") { this._setCheck(a, c) } else { c = dhx4.s2b(c); if ((this.tscheck) && (this.smcheck)) { this._setSubChecked(c, a) } else { this._setCheck(a, c) } } if (this.smcheck) { this._correctCheckStates(a.parentObject) } }; dhtmlXTreeObject.prototype._setCheck = function(a, e) { if (!a) { return } if (((a.parentObject._r_logic) || (this._frbtr)) && (e)) { if (this._frbtrs) { if (this._frbtrL) { this.setCheck(this._frbtrL.id, 0) } this._frbtrL = a } else { for (var c = 0; c < a.parentObject.childsCount; c++) { this._setCheck(a.parentObject.childNodes[c], 0) } } } var g = a.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0]; if (e == "unsure") { a.checkstate = 2 } else { if (e) { a.checkstate = 1 } else { a.checkstate = 0 } } if (a.dscheck) { a.checkstate = a.dscheck } this._setSrc(g, this.imPath + ((a.parentObject._r_logic || this._frbtr) ? this.radioArray : this.checkArray)[a.checkstate]) }; dhtmlXTreeObject.prototype.setSubChecked = function(e, c) { var a = this._globalIdStorageFind(e); this._setSubChecked(c, a); this._correctCheckStates(a.parentObject) }; dhtmlXTreeObject.prototype._setSubChecked = function(e, a) { e = dhx4.s2b(e); if (!a) { return } if (((a.parentObject._r_logic) || (this._frbtr)) && (e)) { for (var c = 0; c < a.parentObject.childsCount; c++) { this._setSubChecked(0, a.parentObject.childNodes[c]) } } if (a.unParsed) { this._setSubCheckedXML(e, a.unParsed) } if (a._r_logic || this._frbtr) { this._setSubChecked(e, a.childNodes[0]) } else { for (var c = 0; c < a.childsCount; c++) { this._setSubChecked(e, a.childNodes[c]) } } var g = a.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0]; if (e) { a.checkstate = 1 } else { a.checkstate = 0 } if (a.dscheck) { a.checkstate = a.dscheck } this._setSrc(g, this.imPath + ((a.parentObject._r_logic || this._frbtr) ? this.radioArray : this.checkArray)[a.checkstate]) }; dhtmlXTreeObject.prototype.isItemChecked = function(c) { var a = this._globalIdStorageFind(c); if (!a) { return } return a.checkstate }; dhtmlXTreeObject.prototype.deleteChildItems = function(g) { var a = this._globalIdStorageFind(g); if (!a) { return } var c = a.childsCount; for (var e = 0; e < c; e++) { this._deleteNode(a.childNodes[0].id, a.childNodes[0]) } }; dhtmlXTreeObject.prototype.deleteItem = function(e, a) { if ((!this._onrdlh) || (this._onrdlh(e))) { var c = this._deleteItem(e, a); if (c) { this._fixChildCountLabel(c) } } this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0" }; dhtmlXTreeObject.prototype._deleteItem = function(l, c, h) { c = dhx4.s2b(c); var a = this._globalIdStorageFind(l); if (!a) { return } var e = this.getParentId(l); var g = a.parentObject; this._deleteNode(l, a, h); if (this._editCell && this._editCell.id == l) { this._editCell = null } this._correctPlus(g); this._correctLine(g); if ((c) && (e != this.rootId)) { this.selectItem(e, 1) } return g }; dhtmlXTreeObject.prototype._globalIdStorageRecSub = function(a) { for (var c = 0; c < a.childsCount; c++) { this._globalIdStorageRecSub(a.childNodes[c]); this._globalIdStorageSub(a.childNodes[c].id) } this._globalIdStorageSub(a.id); var e = a; e.span = null; e.tr.nodem = null; e.tr = null; e.htmlNode = null }; dhtmlXTreeObject.prototype.insertNewNext = function(n, r, q, e, l, h, g, c, a) { var m = this._globalIdStorageFind(n); if ((!m) || (!m.parentObject)) { return (0) } var o = this._attachChildNode(0, r, q, e, l, h, g, c, a, m); if ((!this.XMLloadingWarning) && (this.childCalc)) { this._fixChildCountLabel(m.parentObject) } return o }; dhtmlXTreeObject.prototype.getItemIdByIndex = function(e, a) { var c = this._globalIdStorageFind(e); if ((!c) || (a >= c.childsCount)) { return null } return c.childNodes[a].id }; dhtmlXTreeObject.prototype.getChildItemIdByIndex = function(e, a) { var c = this._globalIdStorageFind(e); if ((!c) || (a >= c.childsCount)) { return null } return c.childNodes[a].id }; dhtmlXTreeObject.prototype.setDragHandler = function(a) { this.attachEvent("onDrag", a) }; dhtmlXTreeObject.prototype._clearMove = function() { if (this._lastMark) { this._lastMark.className = this._lastMark.className.replace(/dragAndDropRow/g, ""); this._lastMark = null } this.selectionBar.style.display = "none"; this.allTree.className = this.allTree.className.replace(" selectionBox", "") }; dhtmlXTreeObject.prototype.enableDragAndDrop = function(c, a) { if (c == "temporary_disabled") { this.dADTempOff = false; c = true } else { this.dADTempOff = true } this.dragAndDropOff = dhx4.s2b(c); if (this.dragAndDropOff) { this.dragger.addDragLanding(this.allTree, this) } if (arguments.length > 1) { this._ddronr = (!dhx4.s2b(a)) } }; dhtmlXTreeObject.prototype._setMove = function(h, e, m) { if (h.parentObject.span) { var g = dhx4.absTop(h); var c = dhx4.absTop(this.allTree) - this.allTree.scrollTop; this.dadmodec = this.dadmode; this.dadmodefix = 0; if (this.dadmode == 2) { var l = m - g + (document.body.scrollTop || document.documentElement.scrollTop) - 2 - h.offsetHeight / 2; if ((Math.abs(l) - h.offsetHeight / 6) > 0) { this.dadmodec = 1; if (l < 0) { this.dadmodefix = 0 - h.offsetHeight } } else { this.dadmodec = 0 } } if (this.dadmodec == 0) { var a = h.parentObject.span; a.className += " dragAndDropRow"; this._lastMark = a } else { this._clearMove(); this.selectionBar.style.top = (g - c + ((parseInt(h.parentObject.span.parentNode.parentNode.offsetHeight) || 18) - 1) + this.dadmodefix) + "px"; this.selectionBar.style.left = "5px"; if (this.allTree.offsetWidth > 20) { this.selectionBar.style.width = (this.allTree.offsetWidth - (_isFF ? 30 : 25)) + "px" } this.selectionBar.style.display = "" } this._autoScroll(null, g, c) } }; dhtmlXTreeObject.prototype._autoScroll = function(e, c, a) { if (this.autoScroll) { if (e) { c = dhx4.absTop(e); a = dhx4.absTop(this.allTree) - this.allTree.scrollTop } if ((c - a - parseInt(this.allTree.scrollTop)) > (parseInt(this.allTree.offsetHeight) - 50)) { this.allTree.scrollTop = parseInt(this.allTree.scrollTop) + 20 } if ((c - a) < (parseInt(this.allTree.scrollTop) + 30)) { this.allTree.scrollTop = parseInt(this.allTree.scrollTop) - 20 } } }; dhtmlXTreeObject.prototype._createDragNode = function(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 = dhx4.absTop(a.htmlNode) - dhx4.absTop(this.allTree); if ((c > (this.allTree.offsetHeight - 30)) || (c < 0)) { this.allTree.scrollTop = c + this.allTree.scrollTop } }; dhtmlXTreeObject.prototype._preventNsDrag = function(a) { if ((a) && (a.preventDefault)) { a.preventDefault(); return false } return false }; dhtmlXTreeObject.prototype._drag = function(m, n, 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 l = m.parentObject.treeNod; if ((l) && (l._clearMove)) { l._clearMove("") } if ((!this.dragMove) || (this.dragMove())) { if ((!l) || (!l._clearMove) || (!l._dragged)) { var g = new Array(m.parentObject) } else { var g = l._dragged } var c = a.parentObject; for (var h = 0; h < g.length; h++) { var e = this._moveNode(g[h], c); if ((this.dadmodec) && (e !== false)) { c = this._globalIdStorageFind(e, true, true) } if ((e) && (!this._sADnD)) { this.selectItem(e, 0, 1) } } } if (l) { l._dragged = new Array() } }; dhtmlXTreeObject.prototype._dragIn = function(g, c, l, h) { if (!this.dADTempOff) { return 0 } var m = c.parentObject; var a = g.parentObject; if ((!a) && (this._ddronr)) { return } if (!this.callEvent("onDragIn", [m.id, a ? a.id : null, m.treeNod, this])) { if (a) { this._autoScroll(g) } return 0 } if (!a) { this.allTree.className += " selectionBox" } else { if (m.childNodes == null) { this._setMove(g, l, h); return g } var o = m.treeNod; for (var e = 0; e < o._dragged.length; e++) { if (this._checkPNodes(a, o._dragged[e])) { this._autoScroll(g); return 0 } } this.selectionBar.parentNode.removeChild(this.selectionBar); a.span.parentNode.appendChild(this.selectionBar); this._setMove(g, l, h); if (this._getOpenState(a) <= 0) { var n = this; this._autoOpenId = a.id; this._autoOpenTimer = window.setTimeout(function() { n._autoOpenItem(null, n); n = null }, 1000) } } return g }; dhtmlXTreeObject.prototype._autoOpenItem = function(c, a) { a.openItem(a._autoOpenId) }; dhtmlXTreeObject.prototype._dragOut = function(a) { this._clearMove(); if (this._autoOpenTimer) { clearTimeout(this._autoOpenTimer) } }; dhtmlXTreeObject.prototype._getNextNode = function(a, c) { if ((!c) && (a.childsCount)) { return a.childNodes[0] } if (a == this.htmlNode) { return -1 } if ((a.tr) && (a.tr.nextSibling) && (a.tr.nextSibling.nodem)) { return a.tr.nextSibling.nodem } return this._getNextNode(a.parentObject, true) }; dhtmlXTreeObject.prototype._lastChild = function(a) { if (a.childsCount) { return this._lastChild(a.childNodes[a.childsCount - 1]) } else { return a } }; dhtmlXTreeObject.prototype._getPrevNode = function(a, c) { if ((a.tr) && (a.tr.previousSibling) && (a.tr.previousSibling.nodem)) { return this._lastChild(a.tr.previousSibling.nodem) } if (a.parentObject) { return a.parentObject } else { return -1 } }; dhtmlXTreeObject.prototype.findItem = function(a, e, c) { var g = this._findNodeByLabel(a, e, (c ? this.htmlNode : null)); if (g) { this.selectItem(g.id, true); this._focusNode(g); return g.id } else { return null } }; dhtmlXTreeObject.prototype.findItemIdByLabel = function(a, e, c) { var g = this._findNodeByLabel(a, e, (c ? this.htmlNode : null)); if (g) { return g.id } else { return null } }; dhtmlXTreeObject.prototype.findStrInXML = function(c, e, h) { if (!c.childNodes && c.item) { return this.findStrInJSON(c, e, h) } if (!c.childNodes) { return false } for (var a = 0; a < c.childNodes.length; a++) { if (c.childNodes[a].nodeType == 1) { var g = c.childNodes[a].getAttribute(e); if (!g && c.childNodes[a].tagName == "itemtext") { g = c.childNodes[a].firstChild.data } if ((g) && (g.toLowerCase().search(h) != -1)) { return true } if (this.findStrInXML(c.childNodes[a], e, h)) { return true } } } return false }; dhtmlXTreeObject.prototype.findStrInJSON = function(c, e, h) { for (var a = 0; a < c.item.length; a++) { var g = c.item[a].text; if ((g) && (g.toLowerCase().search(h) != -1)) { return true } if (c.item[a].item && this.findStrInJSON(c.item[a], e, h)) { return true } } return false }; dhtmlXTreeObject.prototype._findNodeByLabel = function(a, h, g) { var a = a.replace(new RegExp("^( )+"), "").replace(new RegExp("( )+$"), ""); a = new RegExp(a.replace(/([\^\.\?\*\+\\\[\]\(\)]{1})/gi, "\\$1").replace(/ /gi, ".*"), "gi"); if (!g) { g = this._selected[0]; if (!g) { g = this.htmlNode } } var c = g; if (!h) { if ((g.unParsed) && (this.findStrInXML(g.unParsed.d, "text", a))) { this.reParse(g) } g = this._getNextNode(c); if (g == -1) { g = this.htmlNode.childNodes[0] } } else { var e = this._getPrevNode(c); if (e == -1) { e = this._lastChild(this.htmlNode) } if ((e.unParsed) && (this.findStrInXML(e.unParsed.d, "text", a))) { this.reParse(e); g = this._getPrevNode(c) } else { g = e } if (g == -1) { g = this._lastChild(this.htmlNode) } } while ((g) && (g != c)) { if ((g.label) && (g.label.search(a) != -1)) { return (g) } if (!h) { if (g == -1) { if (c == this.htmlNode) { break } g = this.htmlNode.childNodes[0] } if ((g.unParsed) && (this.findStrInXML(g.unParsed.d, "text", a))) { this.reParse(g) } g = this._getNextNode(g); if (g == -1) { g = this.htmlNode } } else { var e = this._getPrevNode(g); if (e == -1) { e = this._lastChild(this.htmlNode) } if ((e.unParsed) && (this.findStrInXML(e.unParsed.d, "text", a))) { this.reParse(e); g = this._getPrevNode(g) } else { g = e } if (g == -1) { g = this._lastChild(this.htmlNode) } } } return null }; dhtmlXTreeObject.prototype.moveItem = function(n, c, o, a) { var h = this._globalIdStorageFind(n); if (!h) { return (0) } var l = null; switch (c) { case "right": alert("Not supported yet"); break; case "item_child": var e = (a || this)._globalIdStorageFind(o); if (!e) { return (0) } l = (a || this)._moveNodeTo(h, e, 0); break; case "item_sibling": var e = (a || this)._globalIdStorageFind(o); if (!e) { return (0) } l = (a || this)._moveNodeTo(h, e.parentObject, e); break; case "item_sibling_next": var e = (a || this)._globalIdStorageFind(o); if (!e) { return (0) } if ((e.tr) && (e.tr.nextSibling) && (e.tr.nextSibling.nodem)) { l = (a || this)._moveNodeTo(h, e.parentObject, e.tr.nextSibling.nodem) } else { l = (a || this)._moveNodeTo(h, e.parentObject) } break; case "left": if (h.parentObject.parentObject) { l = this._moveNodeTo(h, h.parentObject.parentObject, h.parentObject) } break; case "up": var m = this._getPrevNode(h); if ((m == -1) || (!m.parentObject)) { return null } l = this._moveNodeTo(h, m.parentObject, m); break; case "up_strict": var m = this._getIndex(h); if (m != 0) { l = this._moveNodeTo(h, h.parentObject, h.parentObject.childNodes[m - 1]) } break; case "down_strict": var m = this._getIndex(h); var g = h.parentObject.childsCount - 2; if (m == g) { l = this._moveNodeTo(h, h.parentObject) } else { if (m < g) { l = this._moveNodeTo(h, h.parentObject, h.parentObject.childNodes[m + 2]) } } break; case "down": var m = this._getNextNode(this._lastChild(h)); if ((m == -1) || (!m.parentObject)) { return } if (m.parentObject == h.parentObject) { var m = this._getNextNode(m) } if (m == -1) { l = this._moveNodeTo(h, h.parentObject) } else { if ((m == -1) || (!m.parentObject)) { return } l = this._moveNodeTo(h, m.parentObject, m) } break } if (_isIE && _isIE < 8) { this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0" } return l }; dhtmlXTreeObject.prototype.setDragBehavior = function(c, a) { this._sADnD = (!dhx4.s2b(a)); switch (c) { case "child": this.dadmode = 0; break; case "sibling": this.dadmode = 1; break; case "complex": this.dadmode = 2; break } }; dhtmlXTreeObject.prototype._loadDynXML = function(e, c) { c = c || this.XMLsource; var a = (new Date()).valueOf(); this._ld_id = e; if (this.xmlalb == "function") { if (c) { c(this._escape(e)) } } else { if (this.xmlalb == "name") { this.load(c + this._escape(e)) } else { if (this.xmlalb == "xmlname") { this.load(c + this._escape(e) + ".xml?uid=" + a) } else { this.load(c + dhtmlx.url(c) + "uid=" + a + "&id=" + this._escape(e)) } } } }; dhtmlXTreeObject.prototype.enableMultiselection = function(c, a) { this._amsel = dhx4.s2b(c); this._amselS = dhx4.s2b(a) }; dhtmlXTreeObject.prototype._checkMSelectionLogic = function() { var e = new Array(); for (var c = 0; c < this._selected.length; c++) { for (var a = 0; a < this._selected.length; a++) { if ((c != a) && (this._checkPNodes(this._selected[a], this._selected[c]))) { e[e.length] = this._selected[a] } } } for (var c = 0; c < e.length; c++) { this._unselectItem(e[c]) } }; dhtmlXTreeObject.prototype._checkPNodes = function(c, a) { if (this._dcheckf) { return false } if (a == c) { return 1 } if (c.parentObject) { return this._checkPNodes(c.parentObject, a) } else { return 0 } }; dhtmlXTreeObject.prototype.disableDropCheck = function(a) { this._dcheckf = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.enableDistributedParsing = function(e, c, a) { this._edsbps = dhx4.s2b(e); this._edsbpsA = new Array(); this._edsbpsC = c || 10; this._edsbpsD = a || 250 }; dhtmlXTreeObject.prototype.getDistributedParsingState = function() { return (!((!this._edsbpsA) || (!this._edsbpsA.length))) }; dhtmlXTreeObject.prototype.getItemParsingState = function(e) { var c = this._globalIdStorageFind(e, true, true); if (!c) { return 0 } if (this._edsbpsA) { for (var a = 0; a < this._edsbpsA.length; a++) { if (this._edsbpsA[a][2] == e) { return -1 } } } return 1 }; dhtmlXTreeObject.prototype._distributedStart = function(c, h, g, e, a) { if (!this._edsbpsA) { this._edsbpsA = new Array() } this._edsbpsA[this._edsbpsA.length] = [c, h, g, e, a] }; dhtmlXTreeObject.prototype._distributedStep = function(g) { var c = this; if ((!this._edsbpsA) || (!this._edsbpsA.length)) { c.XMLloadingWarning = 0; return } var h = this._edsbpsA[0]; this.parsedArray = new Array(); this._parse(h[0], h[2], h[3], h[1]); var a = this._globalIdStorageFind(h[2]); this._redrawFrom(this, a, h[4], this._getOpenState(a)); var e = this.setCheckList.split(this.dlmtr); for (var l = 0; l < e.length; l++) { if (e[l]) { this.setCheck(e[l], 1) } } this._edsbpsA = (new Array()).concat(this._edsbpsA.slice(1)); if ((!this._edsbpsA.length)) { window.setTimeout(function() { if (c.onXLE) { c.onXLE(c, g) } c.callEvent("onXLE", [c, g]) }, 1); c.xmlstate = 0 } }; dhtmlXTreeObject.prototype.enableTextSigns = function(a) { this._txtimg = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.preventIECaching = function(a) { dhx4.ajax.cache = !a }; dhtmlXTreeObject.prototype.preventIECashing = dhtmlXTreeObject.prototype.preventIECaching; dhtmlXTreeObject.prototype.disableCheckbox = function(e, c) { if (typeof(e) != "object") { var a = this._globalIdStorageFind(e, 0, 1) } else { var a = e } if (!a) { return } a.dscheck = dhx4.s2b(c) ? (((a.checkstate || 0) % 3) + 3) : ((a.checkstate > 2) ? (a.checkstate - 3) : a.checkstate); this._setCheck(a); if (a.dscheck < 3) { a.dscheck = false } }; dhtmlXTreeObject.prototype.smartRefreshBranch = function(c, a) { this._branchUpdate = 1; this.smartRefreshItem(c, a) }; dhtmlXTreeObject.prototype.smartRefreshItem = function(g, e) { var a = this._globalIdStorageFind(g); for (var c = 0; c < a.childsCount; c++) { a.childNodes[c]._dmark = true } this.waitUpdateXML = true; if (e && e.exists) { this._parse(e, g) } else { this._loadDynXML(g, e) } }; dhtmlXTreeObject.prototype.refreshItems = function(c, e) { var g = c.toString().split(this.dlmtr); this.waitUpdateXML = new Array(); for (var a = 0; a < g.length; a++) { this.waitUpdateXML[g[a]] = true } this.load((e || this.XMLsource) + dhtmlx.url(e || this.XMLsource) + "ids=" + this._escape(c)) }; dhtmlXTreeObject.prototype.updateItem = function(m, l, g, e, c, h, n) { var a = this._globalIdStorageFind(m); a.userData = new cObject(); if (l) { a.label = l } a.images = new Array(g || this.imageArray[0], e || this.imageArray[1], c || this.imageArray[2]); this.setItemText(m, l); if (h) { this._setCheck(a, true) } if (n == "1" && !this.hasChildren(m)) { a.XMLload = 0 } this._correctPlus(a); a._dmark = false; return a }; dhtmlXTreeObject.prototype.setDropHandler = function(a) { this.attachEvent("onDrop", a) }; dhtmlXTreeObject.prototype.setOnLoadingStart = function(a) { this.attachEvent("onXLS", a) }; dhtmlXTreeObject.prototype.setOnLoadingEnd = function(a) { this.attachEvent("onXLE", a) }; dhtmlXTreeObject.prototype.setXMLAutoLoadingBehaviour = function(a) { this.xmlalb = a }; dhtmlXTreeObject.prototype.enableSmartCheckboxes = function(a) { this.smcheck = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.getXMLState = function() { return (this.xmlstate == 1) }; dhtmlXTreeObject.prototype.setItemTopOffset = function(l, g) { var e; if (typeof(l) != "object") { e = this._globalIdStorageFind(l) } else { e = l } var h = e.span.parentNode.parentNode; e.span.style.paddingBottom = "1px"; for (var c = 0; c < h.childNodes.length; c++) { if (c != 0) { if (_isIE) { h.childNodes[c].style.height = "18px"; h.childNodes[c].style.paddingTop = parseInt(g) + "px" } else { h.childNodes[c].style.height = 18 + parseInt(g) + "px" } } else { var a = h.childNodes[c].firstChild; if (h.childNodes[c].firstChild.tagName != "DIV") { a = document.createElement("DIV"); h.childNodes[c].insertBefore(a, h.childNodes[c].firstChild) } if ((e.parentObject.id != this.rootId || e.parentObject.childNodes[0] != e) && this.treeLinesOn) { h.childNodes[c].style.backgroundImage = "url(" + this.imPath + this.lineArray[5] + ")" } a.innerHTML = " "; a.style.overflow = "hidden" } a.style.verticalAlign = h.childNodes[c].style.verticalAlign = "bottom"; if (_isIE) { this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0" } } }; dhtmlXTreeObject.prototype.setIconSize = function(g, c, h) { if (h) { if ((h) && (h.span)) { var a = h } else { var a = this._globalIdStorageFind(h) } if (!a) { return (0) } var e = a.span.parentNode.previousSibling.childNodes[0]; if (g) { e.style.width = g + "px"; if (window._KHTMLrv) { e.parentNode.style.width = g + "px" } } if (c) { e.style.height = c + "px"; if (window._KHTMLrv) { e.parentNode.style.height = c + "px" } } } else { this.def_img_x = g + "px"; this.def_img_y = c + "px" } }; dhtmlXTreeObject.prototype.getItemImage = function(h, g, c) { var e = this._globalIdStorageFind(h); if (!e) { return "" } var a = e.images[g || 0]; if (c) { a = this.iconURL + a } return a }; dhtmlXTreeObject.prototype.enableRadioButtons = function(g, e) { if (arguments.length == 1) { this._frbtr = dhx4.s2b(g); this.checkBoxOff = this.checkBoxOff || this._frbtr; return } var c = this._globalIdStorageFind(g); if (!c) { return "" } e = dhx4.s2b(e); if ((e) && (!c._r_logic)) { c._r_logic = true; for (var a = 0; a < c.childsCount; a++) { this._setCheck(c.childNodes[a], c.childNodes[a].checkstate) } } if ((!e) && (c._r_logic)) { c._r_logic = false; for (var a = 0; a < c.childsCount; a++) { this._setCheck(c.childNodes[a], c.childNodes[a].checkstate) } } }; dhtmlXTreeObject.prototype.enableSingleRadioMode = function(a) { this._frbtrs = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.openOnItemAdded = function(a) { this._hAdI = !dhx4.s2b(a) }; dhtmlXTreeObject.prototype.openOnItemAdding = function(a) { this._hAdI = !dhx4.s2b(a) }; dhtmlXTreeObject.prototype.enableMultiLineItems = function(a) { if (a === true) { this.mlitems = "100%" } else { this.mlitems = a } }; dhtmlXTreeObject.prototype.enableAutoTooltips = function(a) { this.ettip = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.clearSelection = function(a) { if (a) { this._unselectItem(this._globalIdStorageFind(a)) } else { this._unselectItems() } }; dhtmlXTreeObject.prototype.showItemSign = function(g, c) { var a = this._globalIdStorageFind(g); if (!a) { return 0 } var e = a.span.parentNode.previousSibling.previousSibling.previousSibling; if (!dhx4.s2b(c)) { this._openItem(a); a.closeble = false; a.wsign = true } else { a.closeble = true; a.wsign = false } this._correctPlus(a) }; dhtmlXTreeObject.prototype.showItemCheckbox = function(h, g) { if (!h) { for (var c in this._idpull) { this.showItemCheckbox(this._idpull[c], g) } } if (typeof(h) != "object") { h = this._globalIdStorageFind(h, 0, 0) } if (!h) { return 0 } h.nocheckbox = !dhx4.s2b(g); var e = h.span.parentNode.previousSibling.previousSibling.childNodes[0]; e.parentNode.style.display = (!h.nocheckbox) ? "" : "none" }; dhtmlXTreeObject.prototype.setListDelimeter = function(a) { this.dlmtr = a }; dhtmlXTreeObject.prototype.setEscapingMode = function(a) { this.utfesc = a }; dhtmlXTreeObject.prototype.enableHighlighting = function(a) { this.ehlt = true; this.ehlta = dhx4.s2b(a) }; dhtmlXTreeObject.prototype._itemMouseOut = function() { var c = this.childNodes[3].parentObject; var a = c.treeNod; a.callEvent("onMouseOut", [c.id]); if (c.id == a._l_onMSI) { a._l_onMSI = null } if (!a.ehlta) { return } c.span.className = c.span.className.replace("_lor", "") }; dhtmlXTreeObject.prototype._itemMouseIn = function() { var c = this.childNodes[3].parentObject; var a = c.treeNod; if (a._l_onMSI != c.id) { a.callEvent("onMouseIn", [c.id]) } a._l_onMSI = c.id; if (!a.ehlta) { return } c.span.className = c.span.className.replace("_lor", ""); c.span.className = c.span.className.replace(/((standart|selected)TreeRow)/, "$1_lor") }; dhtmlXTreeObject.prototype.enableActiveImages = function(a) { this._aimgs = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.focusItem = function(c) { var a = this._globalIdStorageFind(c); if (!a) { return (0) } this._focusNode(a) }; dhtmlXTreeObject.prototype.getAllSubItems = function(a) { return this._getAllSubItems(a) }; dhtmlXTreeObject.prototype.getAllChildless = function() { return this._getAllScraggyItems(this.htmlNode) }; dhtmlXTreeObject.prototype.getAllLeafs = dhtmlXTreeObject.prototype.getAllChildless; dhtmlXTreeObject.prototype._getAllScraggyItems = function(e) { var g = ""; for (var c = 0; c < e.childsCount; c++) { if ((e.childNodes[c].unParsed) || (e.childNodes[c].childsCount > 0)) { if (e.childNodes[c].unParsed) { var a = this._getAllScraggyItemsXML(e.childNodes[c].unParsed, 1) } else { var a = this._getAllScraggyItems(e.childNodes[c]) } if (a) { if (g) { g += this.dlmtr + a } else { g = a } } } else { if (!g) { g = "" + e.childNodes[c].id } else { g += this.dlmtr + e.childNodes[c].id } } } return g }; dhtmlXTreeObject.prototype._getAllFatItems = function(e) { var g = ""; for (var c = 0; c < e.childsCount; c++) { if ((e.childNodes[c].unParsed) || (e.childNodes[c].childsCount > 0)) { if (!g) { g = "" + e.childNodes[c].id } else { g += this.dlmtr + e.childNodes[c].id } if (e.childNodes[c].unParsed) { var a = this._getAllFatItemsXML(e.childNodes[c].unParsed, 1) } else { var a = this._getAllFatItems(e.childNodes[c]) } if (a) { g += this.dlmtr + a } } } return g }; dhtmlXTreeObject.prototype.getAllItemsWithKids = function() { return this._getAllFatItems(this.htmlNode) }; dhtmlXTreeObject.prototype.getAllFatItems = dhtmlXTreeObject.prototype.getAllItemsWithKids; dhtmlXTreeObject.prototype.getAllChecked = function() { return this._getAllChecked("", "", 1) }; dhtmlXTreeObject.prototype.getAllUnchecked = function(a) { if (a) { a = this._globalIdStorageFind(a) } return this._getAllChecked(a, "", 0) }; dhtmlXTreeObject.prototype.getAllPartiallyChecked = function() { return this._getAllChecked("", "", 2) }; dhtmlXTreeObject.prototype.getAllCheckedBranches = function() { var a = [this._getAllChecked("", "", 1)]; var c = this._getAllChecked("", "", 2); if (c) { a.push(c) } return a.join(this.dlmtr) }; dhtmlXTreeObject.prototype._getAllChecked = function(g, e, h) { if (!g) { g = this.htmlNode } if (g.checkstate == h && g.id != this.rootId) { if (!g.nocheckbox) { if (e) { e += this.dlmtr + g.id } else { e = "" + g.id } } } var a = g.childsCount; for (var c = 0; c < a; c++) { e = this._getAllChecked(g.childNodes[c], e, h) } if (g.unParsed) { e = this._getAllCheckedXML(g.unParsed, e, h) } if (e) { return e } else { return "" } }; dhtmlXTreeObject.prototype.setItemStyle = function(g, e, c) { var c = c || false; var a = this._globalIdStorageFind(g); if (!a) { return 0 } if (!a.span.style.cssText) { a.span.setAttribute("style", a.span.getAttribute("style") + "; " + e) } else { a.span.style.cssText = c ? e : a.span.style.cssText + ";" + e } }; dhtmlXTreeObject.prototype.enableImageDrag = function(a) { this._itim_dg = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.setOnDragIn = function(a) { this.attachEvent("onDragIn", a) }; dhtmlXTreeObject.prototype.enableDragAndDropScrolling = function(a) { this.autoScroll = dhx4.s2b(a) }; dhtmlXTreeObject.prototype.setSkin = function(a) { var c = this.parentObject.className.replace(/dhxtree_[^ ]*/gi, ""); this.parentObject.className = c + " dhxtree_" + a; if (a == "dhx_terrace" || a == "dhx_web" || a == "material") { this.enableTreeLines(false) } if (a == "material") { this.setIconSize("25", "25") } }; (function() { dhtmlx.extend_api("dhtmlXTreeObject", { _init: function(a) { return [a.parent, (a.width || "100%"), (a.height || "100%"), (a.root_id || 0)] }, auto_save_selection: "enableAutoSavingSelected", auto_tooltip: "enableAutoTooltips", checkbox: "enableCheckBoxes", checkbox_3_state: "enableThreeStateCheckboxes", checkbox_smart: "enableSmartCheckboxes", context_menu: "enableContextMenu", distributed_parsing: "enableDistributedParsing", drag: "enableDragAndDrop", drag_copy: "enableMercyDrag", drag_image: "enableImageDrag", drag_scroll: "enableDragAndDropScrolling", editor: "enableItemEditor", hover: "enableHighlighting", images: "enableTreeImages", image_fix: "enableIEImageFix", image_path: "setImagePath", lines: "enableTreeLines", loading_item: "enableLoadingItem", multiline: "enableMultiLineItems", multiselect: "enableMultiselection", navigation: "enableKeyboardNavigation", radio: "enableRadioButtons", radio_single: "enableSingleRadioMode", rtl: "enableRTL", search: "enableKeySearch", smart_parsing: "enableSmartXMLParsing", smart_rendering: "enableSmartRendering", text_icons: "enableTextSigns", xml: "loadXML", skin: "setSkin" }, {}) })(); dhtmlXTreeObject.prototype._dp_init = function(a) { a.attachEvent("insertCallback", function(g, l, c) { var e = dhx4.ajax.xpath(".//item", g); var h = e[0].getAttribute("text"); this.obj.insertNewItem(c, l, h, 0, 0, 0, 0, "CHILD") }); a.attachEvent("updateCallback", function(g, l, c) { var e = dhx4.ajax.xpath(".//item", g); var h = e[0].getAttribute("text"); this.obj.setItemText(l, h); if (this.obj.getParentId(l) != c) { this.obj.moveItem(l, "item_child", c) } this.setUpdated(l, true, "updated") }); a.attachEvent("deleteCallback", function(e, g, c) { this.obj.setUserData(g, this.action_param, "true_deleted"); this.obj.deleteItem(g, false) }); a._methods = ["setItemStyle", "", "changeItemId", "deleteItem"]; this.attachEvent("onEdit", function(c, e) { if (c == 3) { a.setUpdated(e, true) } return true }); this.attachEvent("onDrop", function(l, h, g, e, c) { if (e == c) { a.setUpdated(l, true) } }); this._onrdlh = function(c) { var e = a.getState(c); if (e == "inserted") { a.set_invalid(c, false); a.setUpdated(c, false); return true } if (e == "true_deleted") { a.setUpdated(c, false); return true } a.setUpdated(c, true, "deleted"); return false }; this._onradh = function(c) { a.setUpdated(c, true, "inserted") }; a._getRowData = function(h) { var g = {}; var l = this.obj._globalIdStorageFind(h); var e = l.parentObject; var c = 0; for (c = 0; c < e.childsCount; c++) { if (e.childNodes[c] == l) { break } } g.tr_id = l.id; g.tr_pid = e.id; g.tr_order = c; g.tr_text = l.span.innerHTML; e = (l._userdatalist || "").split(","); for (c = 0; c < e.length; c++) { g[e[c]] = l.userData["t_" + e[c]] } return g } }; if (typeof(window.dhtmlXCellObject) != "undefined") { dhtmlXCellObject.prototype.attachTree = function(a) { this.callEvent("_onBeforeContentAttach", ["tree"]); var c = document.createElement("DIV"); c.style.width = "100%"; c.style.height = "100%"; c.style.position = "relative"; c.style.overflow = "hidden"; this._attachObject(c); this.dataType = "tree"; this.dataObj = new dhtmlXTreeObject(c, "100%", "100%", (a || 0)); this.dataObj.setSkin(this.conf.skin); this.dataObj.allTree.childNodes[0].style.marginTop = "2px"; this.dataObj.allTree.childNodes[0].style.marginBottom = "2px"; c = null; this.callEvent("_onContentAttach", []); return this.dataObj } } dhtmlXTreeObject.prototype.makeDraggable = function(c, a) { if (typeof(c) != "object") { c = document.getElementById(c) } dragger = new dhtmlDragAndDropObject(); dropper = new dhx_dragSomethingInTree(); dragger.addDraggableItem(c, dropper); c.dragLanding = null; c.ondragstart = dropper._preventNsDrag; c.onselectstart = new Function("return false;"); c.parentObject = new Object; c.parentObject.img = c; c.parentObject.treeNod = dropper; dropper._customDrop = a }; dhtmlXTreeObject.prototype.makeDragable = dhtmlXTreeObject.prototype.makeDraggable; dhtmlXTreeObject.prototype.makeAllDraggable = function(c) { var e = document.getElementsByTagName("div"); for (var a = 0; a < e.length; a++) { if (e[a].getAttribute("dragInDhtmlXTree")) { this.makeDragable(e[a], c) } } }; function dhx_dragSomethingInTree() { this.lWin = window; this._createDragNode = function(c) { var a = document.createElement("div"); a.style.position = "absolute"; a.innerHTML = (c.innerHTML || c.value); a.className = "dragSpanDiv"; return a }; this._preventNsDrag = function(a) { (a || window.event).cancelBubble = true; if ((a) && (a.preventDefault)) { a.preventDefault(); return false } return false }; this._nonTrivialNode = function(c, e, a, g) { if (this._customDrop) { return this._customDrop(c, g.img.id, e.id, a ? a.id : null) } var h = (g.img.getAttribute("image") || ""); var m = g.img.id || "new"; var l = (g.img.getAttribute("text") || (_isIE ? g.img.innerText : g.img.textContent)); c[a ? "insertNewNext" : "insertNewItem"](a ? a.id : e.id, m, l, "", h, h, h) } } dhtmlXTreeObject.prototype.enableItemEditor = function(a) { this._eItEd = dhx4.s2b(a); if (!this._eItEdFlag) { this._edn_click_IE = true; this._edn_dblclick = true; this._ie_aFunc = this.aFunc; this._ie_dblclickFuncHandler = this.dblclickFuncHandler; this.setOnDblClickHandler(function(e, c) { if (this._edn_dblclick) { this._editItem(e, c) } return true }); this.setOnClickHandler(function(e, c) { this._stopEditItem(e, c); if ((this.ed_hist_clcik == e) && (this._edn_click_IE)) { this._editItem(e, c) } this.ed_hist_clcik = e; return true }); this._eItEdFlag = true } }; dhtmlXTreeObject.prototype.setOnEditHandler = function(a) { this.attachEvent("onEdit", a) }; dhtmlXTreeObject.prototype.setEditStartAction = function(a, c) { this._edn_click_IE = dhx4.s2b(a); this._edn_dblclick = dhx4.s2b(c) }; dhtmlXTreeObject.prototype._stopEdit = function(c, l) { if (this._editCell) { this.dADTempOff = this.dADTempOffEd; if (this._editCell.id != c) { var g = true; if (!l) { g = this.callEvent("onEdit", [2, this._editCell.id, this, this._editCell.span.childNodes[0].value]) } else { g = false; this.callEvent("onEditCancel", [this._editCell.id, this._editCell._oldValue]) } if (g === true) { g = this._editCell.span.childNodes[0].value } else { if (g === false) { g = this._editCell._oldValue } } var h = (g != this._editCell._oldValue); this._editCell.span.innerHTML = g; this._editCell.label = this._editCell.span.innerHTML; var e = this._editCell.i_sel ? "selectedTreeRow" : "standartTreeRow"; this._editCell.span.className = e; this._editCell.span.parentNode.className = "standartTreeRow"; this._editCell.span.style.paddingRight = this._editCell.span.style.paddingLeft = "5px"; this._editCell.span.onclick = this._editCell.span.ondblclick = function() {}; var m = this._editCell.id; if (this.childCalc) { this._fixChildCountLabel(this._editCell) } this._editCell = null; if (!l) { this.callEvent("onEdit", [3, m, this, h]) } if (this._enblkbrd) { this.parentObject.lastChild.focus(); this.parentObject.lastChild.focus() } } } }; dhtmlXTreeObject.prototype._stopEditItem = function(c, a) { this._stopEdit(c) }; dhtmlXTreeObject.prototype.stopEdit = function(a) { if (this._editCell) { this._stopEdit(this._editCell.id + "_non", a) } }; dhtmlXTreeObject.prototype.editItem = function(a) { this._editItem(a, this) }; dhtmlXTreeObject.prototype._editItem = function(h, a) { if (this._eItEd) { this._stopEdit(); var e = this._globalIdStorageFind(h); if (!e) { return } var g = this.callEvent("onEdit", [0, h, this, e.span.innerHTML]); if (g === true) { g = (typeof e.span.innerText != "undefined" ? e.span.innerText : e.span.textContent) } else { if (g === false) { return } } this.dADTempOffEd = this.dADTempOff; this.dADTempOff = false; this._editCell = e; e._oldValue = g; e.span.innerHTML = ""; e.span.style.paddingRight = e.span.style.paddingLeft = "0px"; e.span.onclick = e.span.ondblclick = function(l) { (l || event).cancelBubble = true }; e.span.childNodes[0].value = g; e.span.childNodes[0].onselectstart = function(l) { (l || event).cancelBubble = true; return true }; e.span.childNodes[0].onmousedown = function(l) { (l || event).cancelBubble = true; return true }; e.span.childNodes[0].focus(); e.span.childNodes[0].focus(); e.span.onclick = function(l) { (l || event).cancelBubble = true; return false }; e.span.className = ""; e.span.parentNode.className = ""; var c = this; e.span.childNodes[0].onkeydown = function(l) { if (!l) { l = window.event } if (l.keyCode == 13) { l.cancelBubble = true; c._stopEdit(window.undefined) } else { if (l.keyCode == 27) { c._stopEdit(window.undefined, true) } }(l || event).cancelBubble = true }; this.callEvent("onEdit", [1, h, this]) } }; function jsonPointer(c, a) { this.d = c; this.dp = a } jsonPointer.prototype = { text: function() { var a = function(h) { var g = []; for (var e = 0; e < h.length; e++) { g.push("{" + c(h[e]) + "}") } return g.join(",") }; var c = function(h) { var g = []; for (var e in h) { if (typeof(h[e]) == "object") { if (e.length) { g.push('"' + e + '":[' + a(h[e]) + "]") } else { g.push('"' + e + '":{' + c(h[e]) + "}") } } else { g.push('"' + e + '":"' + h[e] + '"') } } return g.join(",") }; return "{" + c(this.d) + "}" }, get: function(a) { return this.d[a] }, exists: function() { return !!this.d }, content: function() { return this.d.content }, each: function(g, m, l) { var e = this.d[g]; var n = new jsonPointer(); if (e) { for (var h = 0; h < e.length; h++) { n.d = e[h]; m.apply(l, [n, h]) } } }, get_all: function() { return this.d }, sub: function(a) { return new jsonPointer(this.d[a], this.d) }, sub_exists: function(a) { return !!this.d[a] }, each_x: function(g, n, m, l, h) { var e = this.d[g]; var o = new jsonPointer(0, this.d); if (e) { for (h = h || 0; h < e.length; h++) { if (e[h][n]) { o.d = e[h]; if (m.apply(l, [o, h]) == -1) { return } } } } }, up: function(a) { return new jsonPointer(this.dp, this.d) }, set: function(a, c) { this.d[a] = c }, clone: function(a) { return new jsonPointer(this.d, this.dp) }, through: function(e, m, q, h, r) { var n = this.d[e]; if (n.length) { for (var g = 0; g < n.length; g++) { if (n[g][m] != null && n[g][m] != "" && (!q || n[g][m] == q)) { var l = new jsonPointer(n[g], this.d); h.apply(r, [l, g]) } var o = this.d; this.d = n[g]; if (this.sub_exists(e)) { this.through(e, m, q, h, r) } this.d = o } } } }; dhtmlXTreeObject.prototype.loadJSArrayFile = function(a, c) { if (window.console && window.console.info) { window.console.info("loadJSArrayFile was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44") } return this._loadJSArrayFile(a, c) }; dhtmlXTreeObject.prototype._loadJSArrayFile = function(file, callback) { if (!this.parsCount) { this.callEvent("onXLS", [this, this._ld_id]) } this._ld_id = null; this.xmlstate = 1; var that = this; this.XMLLoader = function(xml, callback) { eval("var z=" + xml.responseText); this._loadJSArray(z); if (callback) { callback.call(this, xml) } }; dhx4.ajax.get(file, function(obj) { that.XMLLoader(obj.xmlDoc, callback) }) }; dhtmlXTreeObject.prototype.loadCSV = function(a, c) { if (window.console && window.console.info) { window.console.info("loadCSV was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44") } return this._loadCSV(a, c) }; dhtmlXTreeObject.prototype._loadCSV = function(a, e) { if (!this.parsCount) { this.callEvent("onXLS", [this, this._ld_id]) } this._ld_id = null; this.xmlstate = 1; var c = this; this.XMLLoader = function(g, h) { this._loadCSVString(g.responseText); if (h) { h.call(this, g) } }; dhx4.ajax.get(a, function(g) { c.XMLLoader(g.xmlDoc, e) }) }; dhtmlXTreeObject.prototype.loadJSArray = function(a, c) { if (window.console && window.console.info) { window.console.info("loadJSArray was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44") } return this._loadJSArray(a, c) }; dhtmlXTreeObject.prototype._loadJSArray = function(a, g) { var l = []; for (var c = 0; c < a.length; c++) { if (!l[a[c][1]]) { l[a[c][1]] = [] } l[a[c][1]].push({ id: a[c][0], text: a[c][2] }) } var h = { id: this.rootId }; var e = function(o, n) { if (l[o.id]) { o.item = l[o.id]; for (var m = 0; m < o.item.length; m++) { n(o.item[m], n) } } }; e(h, e); this._loadJSONObject(h, g) }; dhtmlXTreeObject.prototype.loadCSVString = function(a, c) { if (window.console && window.console.info) { window.console.info("loadCSVString was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44") } return this._loadCSVString(a, c) }; dhtmlXTreeObject.prototype._loadCSVString = function(a, l) { var n = []; var c = a.split("\n"); for (var g = 0; g < c.length; g++) { var e = c[g].split(","); if (!n[e[1]]) { n[e[1]] = [] } n[e[1]].push({ id: e[0], text: e[2] }) } var m = { id: this.rootId }; var h = function(r, q) { if (n[r.id]) { r.item = n[r.id]; for (var o = 0; o < r.item.length; o++) { q(r.item[o], q) } } }; h(m, h); this._loadJSONObject(m, l) }; dhtmlXTreeObject.prototype.loadJSONObject = function(a, c) { if (window.console && window.console.info) { window.console.info("loadJSONObject was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44") } return this._loadJSONObject(a, c) }; dhtmlXTreeObject.prototype._loadJSONObject = function(a, c) { if (!this.parsCount) { this.callEvent("onXLS", [this, null]) } this.xmlstate = 1; var e = new jsonPointer(a); this._parse(e); this._p = e; if (c) { c() } }; dhtmlXTreeObject.prototype.loadJSON = function(a, c) { if (window.console && window.console.info) { window.console.info("loadJSON was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44") } return this._loadJSON(a, c) }; dhtmlXTreeObject.prototype._loadJSON = function(file, callback) { if (!this.parsCount) { this.callEvent("onXLS", [this, this._ld_id]) } this._ld_id = null; this.xmlstate = 1; var that = this; this.XMLLoader = function(xml, callback) { try { eval("var t=" + xml.responseText) } catch (e) { dhx4.callEvent("onLoadXMLerror", ["Incorrect JSON", (xml), this]); return } var p = new jsonPointer(t); this._parse(p); this._p = p; if (callback) { callback.call(this, xml) } }; dhx4.ajax.get(file, function(obj) { that.XMLLoader(obj.xmlDoc, callback) }) }; dhtmlXTreeObject.prototype.serializeTreeToJSON = function() { var a = ['{"id":"' + this.rootId + '", "item":[']; var e = []; for (var c = 0; c < this.htmlNode.childsCount; c++) { e.push(this._serializeItemJSON(this.htmlNode.childNodes[c])) } a.push(e.join(",")); a.push("]}"); return a.join("") }; dhtmlXTreeObject.prototype._serializeItemJSON = function(m) { var a = []; if (m.unParsed) { return (m.unParsed.text()) } if (this._selected.length) { var e = this._selected[0].id } else { e = "" } var l = m.span.innerHTML; l = l.replace(/\"/g, '\\"', l); if (!this._xfullXML) { a.push('{ "id":"' + m.id + '", ' + (this._getOpenState(m) == 1 ? ' "open":"1", ' : "") + (e == m.id ? ' "select":"1",' : "") + ' "text":"' + l + '"' + (((this.XMLsource) && (m.XMLload == 0)) ? ', "child":"1" ' : "")) } else { a.push('{ "id":"' + m.id + '", ' + (this._getOpenState(m) == 1 ? ' "open":"1", ' : "") + (e == m.id ? ' "select":"1",' : "") + ' "text":"' + l + '", "im0":"' + m.images[0] + '", "im1":"' + m.images[1] + '", "im2":"' + m.images[2] + '" ' + (m.acolor ? (', "aCol":"' + m.acolor + '" ') : "") + (m.scolor ? (', "sCol":"' + m.scolor + '" ') : "") + (m.checkstate == 1 ? ', "checked":"1" ' : (m.checkstate == 2 ? ', "checked":"-1"' : "")) + (m.closeable ? ', "closeable":"1" ' : "") + (((this.XMLsource) && (m.XMLload == 0)) ? ', "child":"1" ' : "")) } if ((this._xuserData) && (m._userdatalist)) { a.push(', "userdata":['); var h = m._userdatalist.split(","); var g = []; for (var c = 0; c < h.length; c++) { g.push('{ "name":"' + h[c] + '" , "content":"' + m.userData["t_" + h[c]] + '" }') } a.push(g.join(",")); a.push("]") } if (m.childsCount) { a.push(', "item":['); var g = []; for (var c = 0; c < m.childsCount; c++) { g.push(this._serializeItemJSON(m.childNodes[c])) } a.push(g.join(",")); a.push("]\n") } a.push("}\n"); return a.join("") }; function dhtmlXTreeFromHTML(obj) { if (typeof(obj) != "object") { obj = document.getElementById(obj) } var n = obj; var id = n.id; var cont = ""; for (var j = 0; j < obj.childNodes.length; j++) { if (obj.childNodes[j].nodeType == "1") { if (obj.childNodes[j].tagName == "XMP") { var cHead = obj.childNodes[j]; for (var m = 0; m < cHead.childNodes.length; m++) { cont += cHead.childNodes[m].data } } else { if (obj.childNodes[j].tagName.toLowerCase() == "ul") { cont = dhx_li2trees(obj.childNodes[j], new Array(), 0) } } break } } obj.innerHTML = ""; var t = new dhtmlXTreeObject(obj, "100%", "100%", 0); var z_all = new Array(); for (b in t) { z_all[b.toLowerCase()] = b } var atr = obj.attributes; for (var a = 0; a < atr.length; a++) { if ((atr[a].name.indexOf("set") == 0) || (atr[a].name.indexOf("enable") == 0)) { var an = atr[a].name; if (!t[an]) { an = z_all[atr[a].name] } t[an].apply(t, atr[a].value.split(",")) } } if (typeof(cont) == "object") { t.XMLloadingWarning = 1; for (var i = 0; i < cont.length; i++) { var n = t.insertNewItem(cont[i][0], cont[i][3], cont[i][1]); if (cont[i][2]) { t._setCheck(n, cont[i][2]) } } t.XMLloadingWarning = 0; t.lastLoadedXMLId = 0; t._redrawFrom(t) } else { t.parse("" + cont + "") } window[id] = t; var oninit = obj.getAttribute("oninit"); if (oninit) { eval(oninit) } return t } function dhx_init_trees() { var c = document.getElementsByTagName("div"); for (var a = 0; a < c.length; a++) { if (c[a].className == "dhtmlxTree") { dhtmlXTreeFromHTML(c[a]) } } } function dhx_li2trees(r, l, e) { for (var m = 0; m < r.childNodes.length; m++) { var q = r.childNodes[m]; if ((q.nodeType == 1) && (q.tagName.toLowerCase() == "li")) { var o = ""; var n = null; var a = q.getAttribute("checked"); for (var h = 0; h < q.childNodes.length; h++) { var g = q.childNodes[h]; if (g.nodeType == 3) { o += g.data } else { if (g.tagName.toLowerCase() != "ul") { o += dhx_outer_html(g) } else { n = g } } } l[l.length] = [e, o, a, (q.id || (l.length + 1))]; if (n) { l = dhx_li2trees(n, l, (q.id || l.length)) } } } return l } function dhx_outer_html(c) { if (c.outerHTML) { return c.outerHTML } var a = document.createElement("DIV"); a.appendChild(c.cloneNode(true)); a = a.innerHTML; return a } if (window.addEventListener) { window.addEventListener("load", dhx_init_trees, false) } else { if (window.attachEvent) { window.attachEvent("onload", dhx_init_trees) } } dhtmlXTreeObject.prototype.parserExtension = { _parseExtension: function(g, c, e) { this._idpull[c.id]._attrs = c } }; dhtmlXTreeObject.prototype.getAttribute = function(e, a) { this._globalIdStorageFind(e); var c = this._idpull[e]._attrs; return c ? c[a] : window.undefined }; dhtmlXTreeObject.prototype.setAttribute = function(g, a, e) { this._globalIdStorageFind(g); var c = (this._idpull[g]._attrs) || {}; c[a] = e; this._idpull[g]._attrs = c }; dhtmlXTreeObject.prototype.enableKeyboardNavigation = function(e) { this._enblkbrd = dhx4.s2b(e); 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(g) { if (a.callEvent("onKeyPress", [(g || window.event).keyCode, (g || window.event)])) { return a._onKeyDown(g || window.event) } }; this.parentObject.onclick = function(g) { 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(e) { var a = this._globalIdStorageFind(e); 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(e) { var a = this._globalIdStorageFind(e); 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 = dhx4.s2b(c); if (!this._textSearch) { return } this._textSearchString = ""; var a = this; this._markItem2 = this._markItem; this._markItem = function(e) { if (!a._textSearchInProgress) { a._textSearchString = "" } a._markItem2(e) } }; 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, e) { if ((e === null) || (this._globalIdStorageFind("fake_load_xml_" + e))) { return } var c = this.XMLsource; this.XMLsource = null; this.insertNewItem(e, "fake_load_xml_" + e, 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, h, c) { if (!this._locker) { this._init_lock() } if (h) { 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 g = a.span.parentNode; var e = g.previousSibling; this.dragger.removeDraggableItem(g); this.dragger.removeDraggableItem(e) } 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 g = a.span.parentNode; var e = g.previousSibling; this.dragger.addDraggableItem(g, this); this.dragger.addDraggableItem(e, this) } if (!c) { this._correctPlus(a) } }; dhtmlXTreeObject.prototype.lockItem = function(e, c) { if (!this._locker) { this._init_lock() } this._lockOn = false; var a = this._globalIdStorageFind(e); this._lockOn = true; this._lockItem(a, dhx4.s2b(c)) }; dhtmlXTreeObject.prototype.setLockedIcons = function(e, c, a) { if (!this._locker) { this._init_lock() } this.lico0 = e; 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(e, a, c) { if (!this.skipLock) { if ((!c) && (this._lockOn == true) && (this._locker[e] == true)) { return null } } return this._globalIdStorageFindA(e, 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, e, c) { if ((e.treeNod.isLocked) && (e.treeNod.isLocked(e.id))) { return false } return this._moveNodeToA(a, e, c) }; dhtmlXTreeObject.prototype.lockTree = function(a) { if (dhx4.s2b(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 = dhx4.s2b(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(g, c, e) { var a = this._globalIdStorageFind(g); if (!a) { return false } this._reorderBranch(a, (c.toString().toLowerCase() == "asc"), dhx4.s2b(e)) }; dhtmlXTreeObject.prototype.setCustomSortFunction = function(a) { this._csfunca = a }; dhtmlXTreeObject.prototype._reorderBranch = function(n, c, o) { var a = []; var l = n.childsCount; if (!l) { return } var h = n.childNodes[0].tr.parentNode; for (var g = 0; g < l; g++) { a[g] = n.childNodes[g]; h.removeChild(a[g].tr) } var e = this; if (c == 1) { if (this._csfunca) { a.sort(function(q, m) { return e._csfunca(q.id, m.id) }) } else { a.sort(function(q, m) { return ((q.span.innerHTML.toUpperCase() > m.span.innerHTML.toUpperCase()) ? 1 : ((q.span.innerHTML.toUpperCase() == m.span.innerHTML.toUpperCase()) ? 0 : -1)) }) } } else { if (this._csfunca) { a.sort(function(q, m) { return e._csfunca(m.id, q.id) }) } else { a.sort(function(q, m) { return ((q.span.innerHTML.toUpperCase() < m.span.innerHTML.toUpperCase()) ? 1 : ((q.span.innerHTML.toUpperCase() == m.span.innerHTML.toUpperCase()) ? 0 : -1)) }) } } for (var g = 0; g < l; g++) { h.appendChild(a[g].tr); n.childNodes[g] = a[g]; if ((o) && (a[g].unParsed)) { a[g].unParsed.set("order", c ? 1 : -1) } else { if ((o) && (a[g].childsCount)) { this._reorderBranch(a[g], c, o) } } } for (var g = 0; g < l; g++) { this._correctPlus(a[g]); this._correctLine(a[g]) } }; dhtmlXTreeObject.prototype._reorderXMLBranch = function(l) { var n = l.getAttribute("order"); if (n == "none") { return } var c = (n == 1); var h = l.childNodes.length; if (!h) { return } var a = new Array(); var e = 0; for (var g = 0; g < h; g++) { if (l.childNodes[g].nodeType == 1) { a[e] = l.childNodes[g]; e++ } } for (var g = h - 1; g != 0; g--) { l.removeChild(l.childNodes[g]) } if (c) { a.sort(function(o, m) { return ((o.getAttribute("text") > m.getAttribute("text")) ? 1 : ((o.getAttribute("text") == m.getAttribute("text")) ? 0 : -1)) }) } else { a.sort(function(o, m) { return ((o.getAttribute("text") < m.getAttribute("text")) ? 1 : ((o.getAttribute("text") == m.getAttribute("text")) ? 0 : -1)) }) } for (var g = 0; g < e; g++) { a[g].setAttribute("order", n); l.appendChild(a[g]) } l.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, h, l, e) { this._xuserData = dhx4.s2b(a); this._xfullXML = dhx4.s2b(c); this._dtd = e; this._xescapeEntities = dhx4.s2b(h); if (dhx4.s2b(l)) { this._apreUC = "" } else {} for (var g = 0; g < this._serEnts.length; g++) { this._serEnts[g][2] = new RegExp(this._serEnts[g][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 e = this._idpull[this.rootId]._userdatalist.split(","); for (var c = 0; c < e.length; c++) { a += '' + this._apreUC + this._idpull[this.rootId].userData["t_" + e[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(m) { if (m.unParsed) { if (dhx4.isIE) { return m.unParsed.d.xml } else { var a = new XMLSerializer(); return a.serializeToString(m.unParsed.d) } } var c = ""; if (this._selected.length) { var g = this._selected[0].id } else { g = '"' } var l = m.span.innerHTML; if (this._xescapeEntities) { for (var e = 0; e < this._serEnts.length; e++) { l = l.replace(this._serEnts[e][2], this._serEnts[e][1]) } } if (!this._xfullXML) { c = '" } else { c = '" } if ((this._xuserData) && (m._userdatalist)) { var h = m._userdatalist.split(","); for (var e = 0; e < h.length; e++) { c += '' + this._apreUC + m.userData["t_" + h[e]] + this._apstUC + "" } } for (var e = 0; e < m.childsCount; e++) { c += this._serializeItem(m.childNodes[e]) } 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 = dhx4.s2b(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(e, c) { var h = this._escape(this.serializeTree()); var a = 4000; if (h.length > a) { if (navigator.appName.indexOf("Microsoft") != -1) { return false } this.setCookie("treeStatex" + e, Math.ceil(h.length / a)); for (var g = 0; g < Math.ceil(h.length / a); g++) { this.setCookie("treeStatex" + e + "x" + g, h.substr(g * a, a), c) } } else { this.setCookie("treeStatex" + e, h, c) } var h = this.getCookie("treeStatex" + e); if (!h) { this.setCookie("treeStatex" + e, "", c); return false } return true }; dhtmlXTreeObject.prototype.loadState = function(a) { var g = this.getCookie("treeStatex" + a); if (!g) { return false } if (g.length) { if (g.toString().length < 4) { var e = ""; for (var c = 0; c < g; c++) { e += this.getCookie("treeStatex" + a + "x" + c) } g = e } this.parse((this.utfesc == "utf8") ? decodeURI(g) : unescape(g)) } return true }; dhtmlXTreeObject.prototype.setCookie = function(c, e, a) { var g = c + "=" + e + (a ? ("; " + a) : ""); document.cookie = g }; dhtmlXTreeObject.prototype.getCookie = function(c) { var e = c + "="; if (document.cookie.length > 0) { var g = document.cookie.indexOf(e); if (g != -1) { g += e.length; var a = document.cookie.indexOf(";", g); if (a == -1) { a = document.cookie.length } return document.cookie.substring(g, a) } } }; dhtmlXTreeObject.prototype.saveOpenStates = function(c, a) { var g = []; for (var e = 0; e < this.htmlNode.childsCount; e++) { g = g.concat(this._collectOpenStates(this.htmlNode.childNodes[e])) } g = g.join(this.dlmtr); this.setCookie("treeOpenStatex" + c, g, a) }; dhtmlXTreeObject.prototype.loadOpenStates = function(c) { for (var e = 0; e < this.htmlNode.childsCount; e++) { this._xcloseAll(this.htmlNode.childNodes[e]) } this.allTree.childNodes[0].border = "1"; this.allTree.childNodes[0].border = "0"; var h = getCookie("treeOpenStatex" + c); if (h) { var a = h.split(this.dlmtr); for (var e = 0; e < a.length; e++) { var g = this._globalIdStorageFind(a[e]); if (g) { if ((this.XMLsource) && (!g.XMLload) && (g.id != this.rootId)) { this._delayedLoad(g, "loadOpenStates('" + c + "')"); return } else { this.openItem(a[e]) } } } } 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 e = []; if (this._getOpenState(c) == 1) { e.push(c.id); for (var a = 0; a < c.childsCount; a++) { e = e.concat(this._collectOpenStates(c.childNodes[a])) } } return e }; 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 = dhx4.s2b(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 }; function dhtmlXTreeView(g) { var h = this; if (typeof(g) == "object" && g.tagName == null) {} else { g = { parent: g, clear: true } } this.base = (typeof(g.parent) == "string" ? document.getElementById(g.parent) : g.parent); if (this.base != document.body) { while (this.base.childNodes.length > 0) { this.base.removeChild(this.base.lastChild) } } this.conf = { skin: (g.skin || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxtreeview") || "material"), tree_id: window.dhx4.newId(), ofs: { w: 1, h: 0 }, adjust_base: false, icons: this.icons[(typeof(g.iconset) == "string" && this.icons[g.iconset] != null && this.icons[g.iconset].r == true ? g.iconset : "tree_native")], autoload: { url: null, mode: "id" }, selected: {}, ud: {}, idx: { sign: 0, icon: 1, text: 2 }, silent: false, is_mac: (navigator.platform.match(/^mac/i) != null && typeof(window.addEventListener) == "function"), mac_cmd_key: false }; this.setSkin(this.conf.skin); this.cont = document.createElement("DIV"); this.cont.className = "dhxtreeview_cont"; this.base.appendChild(this.cont); this.area = document.createElement("DIV"); this.area.className = "dhxtreeview_area"; this.cont.appendChild(this.area); this.cont.onclick = function(a) { a = a || event; h.callEvent("_onTreeClick", [a, { stop: false }]) }; this.cont.ondblclick = function(l) { l = l || event; var a = (l.target || l.srcElement); if (a.className.match(/dhxtreeview_item_label/) != null) { h._openCloseItem(a.parentNode.parentNode._itemId, true) } }; this.items = {}; this._addItem = function(s, n, q, l) { var r = (n != null ? this.items[n].level + 1 : 1); var m = document.createElement("DIV"); m.className = "dhxtreeview_item"; m.innerHTML = "
"; if (l != null && l < 0) { q.index = 0 } if (n == null) { var o = this.area } else { var a = this.items[n].kids; if (a == false) { this._initKidsNode(n) } this.items[n].kids_request = false; var o = this.items[n].item.lastChild.firstChild } if (l != null && o.childNodes[l] != null) { o.insertBefore(m, o.childNodes[l]) } else { o.appendChild(m) } o = null; m._itemId = s; m._treeId = this.conf.tree_id; if (window.dhx4.isIE == true) { m.onselectstart = function(u) { u = u || event; if (u.preventDefault) { u.preventDefault() } else { u.returnValue = false } } } this.items[s] = { id: s, pId: n, treeId: this.conf.tree_id, text: q.text, item: m, level: r, kids: false, opened: window.dhx4.s2b(q.open), userdata: window.dhx4._copyObj(q.userdata || {}), half_opened: false }; this.callEvent("_onItemRendered", [s, q]); m.firstChild.innerHTML = this._getItemHtml(s); m = null; if (window.dhx4.s2b(q.select) == true) { this._setSelected(s, true) } this.callEvent("_onItemInited", [s, q]) }; this.addItem = function(n, l, m, a) { if (this.items[n] != null) { return } if (m != null && this.items[m] == null) { m = null } this._addItem(n, m, { text: l }, a); this._callPublicEvent("onAddItem", [n, l, m, a]) }; this._removeSingleItem = function(m) { if (window.dhx4.isIE == true) { this.items[m].item.onselectstart = null } this.items[m].item.parentNode.removeChild(this.items[m].item); for (var l in this.items[m]) { this.items[m][l] = null; delete this.items[m][l] } delete this.items[m]; if (this.conf.selected[m] == true) { delete this.conf.selected[m] } }; this._removeItem = function(o) { var m = o ? this.items[o].pId : -1; var n = -1; for (var l in this.items) { if (this.items[l].pId == m) { n++ } if (this.items[l].pId == o) { this._removeItem(l) } } if (o != null) { this._removeSingleItem(o) } if (m && !n) { this._clearKidsNode(m) } }; this.deleteItem = function(a) { if (this.items[a] == null) { return } if (!this._callPublicEvent("onBeforeDeleteItem", [a])) { return } this._removeItem(a); this._callPublicEvent("onDeleteItem", [a]) }; this.deleteChildItems = function(m) { m = m || 0; for (var l in this.items) { if (this.items[l].pId == m) { this._removeItem(l) } } this._clearKidsNode(m) }; this.clearAll = function() { this._removeItem(null); if (this.conf.unloading != true) { this._fixAreaWidth() } }; this._initKidsNode = function(l) { var a; if (this.items[l].item.lastChild.className.match(/dhxtreeview_kids_cont/) == null) { a = document.createElement("DIV"); a.className = "dhxtreeview_kids_cont"; a.innerHTML = "
"; a.style.opacity = "1"; if (this.items[l].opened != true) { if (this.conf.transProp != false) { a.style.height = "0px"; a.style.opacity = "0"; a.firstChild.style.display = "none" } else { a.style.display = "none" } } this.items[l].item.appendChild(a) } this.items[l].kids = true; this._iconUpdate(l); this._signUpdate(l); a = null }; this._clearKidsNode = function(a) { if (this.items[a].item.lastChild.className.match(/dhxtreeview_kids_cont/) != null) { this.items[a].item.removeChild(this.items[a].item.lastChild) } this.items[a].kids = false; this._iconUpdate(a); this._signUpdate(a) }; this.openItem = function(l, a) { if (this.items[l].opened != true) { if (typeof(a) == "undefined") { a = true } this._openCloseItem(l, a) } }; this.closeItem = function(l, a) { if (this.items[l].opened == true) { if (typeof(a) == "undefined") { a = true } this._openCloseItem(l, a) } }; this._openCloseItem = function(l, a) { if (this.callEvent("_onBeforeOpen", [l]) !== true) { return } if (!(this.items[l].kids == true || this.items[l].kids_request == true)) { return false } if (this.items[l].half_opened == true) { this.items[l].half_opened = false; this._signUpdate(l); return } if (a && this.conf.transProp != false) { if (!this.items[l].transEv) { this.items[l].item.lastChild.addEventListener(this.conf.transEv, this._doOnTrEnd); this.items[l].transEv = true } if (this.items[l].opened == true) { this.items[l].transMode = "close"; this.items[l].item.lastChild.style.overflow = "hidden"; this.items[l].item.lastChild.style.height = this.items[l].item.lastChild.childNodes[0].offsetHeight + "px"; window.setTimeout(function() { h.items[l].item.lastChild.style[h.conf.transProp] = h.conf.transValueHeight; h.items[l].item.lastChild.style.height = "0px"; h.items[l].item.lastChild.style.opacity = "0"; h.items[l].opened = false; h._iconUpdate(l); h._signUpdate(l) }, 50) } else { this.items[l].transMode = "open"; this.items[l].item.lastChild.style[this.conf.transProp] = this.conf.transValueHeight; this.items[l].item.lastChild.childNodes[0].style.display = ""; this.items[l].item.lastChild.style.overflow = "hidden"; this.items[l].item.lastChild.style.height = this.items[l].item.lastChild.childNodes[0].offsetHeight + "px"; this.items[l].item.lastChild.style.opacity = "1"; this.items[l].opened = true; this._iconUpdate(l); this._signUpdate(l) } } else { this.items[l].opened = !this.items[l].opened; this.items[l].item.lastChild.style.display = (this.items[l].opened == true ? "" : "none"); this.items[l].item.lastChild.childNodes[0].style.display = this.items[l].item.lastChild.style.display; this.items[l].item.lastChild.style.height = (this.items[l].opened == true ? "" : "0px"); this.items[l].item.lastChild.style.opacity = (this.items[l].opened == true ? 1 : 0); this._iconUpdate(l); this._signUpdate(l); this._fixAreaWidth() } }; this._doOnTrEnd = function() { var a = this.parentNode._itemId; h.items[a].item.lastChild.style[h.conf.transProp] = ""; if (h.items[a].transMode == "close") { h.items[a].item.lastChild.childNodes[0].style.display = "none" } else { h.items[a].item.lastChild.style.height = ""; h.items[a].item.lastChild.style.overflow = "" } h._fixAreaWidth() }; this.setSizes = function() { if (this.conf.adjust_base == true) { this.base.style.width = this.base.parentNode.clientWidth - 2 + "px"; this.base.style.height = this.base.parentNode.clientHeight - 2 + "px" } this.cont.style.left = this.conf.ofs.w + "px"; this.cont.style.top = this.conf.ofs.h + "px"; this.cont.style.width = this.base.clientWidth - this.conf.ofs.w * 2 + "px"; this.cont.style.height = this.base.clientHeight - this.conf.ofs.h * 2 + "px"; this._fixAreaWidth() }; this._fixAreaWidth = function(a) { this.area.style.width = "100%"; if (this.cont.scrollWidth != this.cont.clientWidth) { this.area.style.width = this.cont.scrollWidth + 1 + "px" } if (window.dhx4.isIE7 == true && a !== false) { window.setTimeout(function() { h._fixAreaWidth(false) }, 1) } }; this.setSizes(); dhx4._eventable(this); var e = window.dhx4.transDetect(); this.conf.transProp = e.transProp; this.conf.transEv = e.transEv; this.conf.transValueHeight = "height 0.15s"; e = null; if (this.conf.is_mac == true) { this._macOnKey = function(a) { if (((window.dhx4.isKHTML || window.dhx4.isChrome || window.dhx4.isOpera) && (a.keyCode == 91 || a.keyCode == 93)) || (window.dhx4.isFF && a.keyCode == 224)) { h.conf.mac_cmd_key = (a.type == "keydown") } }; window.addEventListener("keydown", this._macOnKey, false); window.addEventListener("keyup", this._macOnKey, false) } for (var c in this.modules) { if (this.modules[c].init != null) { this[this.modules[c].init](g) } } this.unload = function() { this.conf.unloading = true; this.cont.onclick = null; this.cont.ondblclick = null; this.clearAll(); if (this.conf.is_mac == true) { window.removeEventListener("keydown", this._macOnKey, false); window.removeEventListener("keyup", this._macOnKey, false) } for (var l in this.modules) { if (this.modules[l].unload != null) { this[this.modules[l].unload]() } } this.area.parentNode.removeChild(this.area); this.area = null; this.cont.parentNode.removeChild(this.cont); this.cont = null; this.base.className = String(this.base.className).replace(new RegExp("s{0,}dhxtreeview_" + (this.conf.skin || "")), ""); window.dhx4._eventable(this, "clear"); for (var l in this) { this[l] = null } h = null }; if (g.items != null || g.json != null || g.xml != null) { this.loadStruct(g.items || g.json || g.xml, g.onload) } return this } dhtmlXTreeView.prototype.modules = {}; dhtmlXTreeView.prototype.setSkin = function(a) { this.base.className = String(this.base.className).replace(new RegExp("s{0,}dhxtreeview_" + (this.conf.skin || "")), "") + " dhxtreeview_" + a; this.conf.skin = a; this.conf.icon_width = dhx4.readFromCss("dhxtreeview_" + this.conf.skin + " dhxtreeview_icon_width"); this.conf.ofs = (this.conf.skin == "dhx_skyblue" ? { w: 1, h: 0 } : { w: 0, h: 0 }) }; dhtmlXTreeView.prototype.setItemText = function(c, a) { if (this.items[c] != null) { this.items[c].text = a; this.items[c].item.firstChild.childNodes[this.conf.idx.text].innerHTML = a; this._callPublicEvent("onTextChange", [c, a]) } }; dhtmlXTreeView.prototype.getItemText = function(a) { return this.items[a].text }; dhtmlXTreeView.prototype.showItem = function(g) { var e = 0; var a = false; while (g) { var c = this.items[g]; if (c) { e += c.item.offsetTop + (a ? c.item.firstChild.offsetHeight : 0); g = c.pId; a = true } else { break } } this.cont.scrollTop = e }; dhtmlXTreeView.prototype.getParentId = function(a) { return this.items[a].pId }; dhtmlXTreeView.prototype.getSubItems = function(g) { var a = this.items[g]; a = a ? a.item.lastChild.firstChild : this.area; var e = []; for (var c = 0; c < a.childNodes.length; c++) { e[c] = a.childNodes[c]._itemId } return e }; dhtmlXTreeView.prototype._refreshItemHtml = function(e, a, c) { this.items[e].item.firstChild.innerHTML = this._getItemHtml(e); if (a == true) { this._signUpdate(e) } if (c == true) { this._iconUpdate(e) } }; dhtmlXTreeView.prototype._getItemHtml = function(l) { var e = []; var h = 0; for (var c in this.conf.idx) { var g = this["_itemHtml_" + c](l, h); if (g.nodeText !== false) { e.push(g.nodeText); h += g.nodeIndex } } return e.join("") }; dhtmlXTreeView.prototype._getIconOfs = function(c, a) { return ((this.items[c].level - 1 + a) * this.conf.icon_width) }; dhtmlXTreeView.prototype._itemHtml_text = function(c, a) { return { nodeIndex: 1, nodeText: "
" + this.items[c].text + "
" } }; dhtmlXTreeView.prototype.setUserData = function(g, a, e) { var c = this.items[g]; if (c) { c.userdata[a] = e } }; dhtmlXTreeView.prototype.getUserData = function(e, a) { var c = this.items[e]; if (c && !a) { return c.userdata } return c ? (c.userdata[a] || null) : null }; dhtmlXTreeView.prototype.silent = function(a) { this.conf.silent = true; if (typeof(a) == "function") { a.apply(window, [this]) } this.conf.silent = false }; dhtmlXTreeView.prototype._callPublicEvent = function() { return (this.conf.silent == false ? this.callEvent.apply(this, arguments) : true) }; dhtmlXTreeView.prototype.refreshItem = function(a) { a = a || 0; this.deleteChildItems(a); this._dynLoadRequest(a) }; dhtmlXTreeView.prototype.getLevel = function(e) { var a = this.items[e]; var c = 0; while (a) { c++; a = this.items[a.pId] } return c }; if (typeof(window.dhtmlXCellObject) == "function") { dhtmlXCellObject.prototype.attachTreeView = function(e) { this.callEvent("_onBeforeContentAttach", ["treeview"]); var h = document.createElement("DIV"); h.style.position = "relative"; h.style.overflow = "hidden"; h.style.width = "100%"; h.style.height = "100%"; this._attachObject(h); var g = { parent: h, skin: this.conf.skin }; if (e != null && typeof(e) == "object") { for (var c in e) { if (typeof(g[c]) == "undefined") { g[c] = e[c] } } } this.dataType = "treeview"; this.dataObj = new dhtmlXTreeView(g); if (typeof(window.dhtmlXWindowsCell) == "function" && this instanceof window.dhtmlXWindowsCell) { h.className += " dhxtreeview_with_border"; this.dataObj.conf.adjust_base = true; this.dataObj.setSizes() } g.parent = null; g = h = e = null; this.callEvent("_onContentAttach", []); return this.dataObj } } dhtmlXTreeView.prototype.modules.chbx = { init: "_chbxInit" }; dhtmlXTreeView.prototype.enableCheckboxes = function(e) { e = (e == true); if (this.conf.enable_chbx != e) { this.conf.enable_chbx = e; this._chbxUpdIndex(); for (var c in this.items) { this._refreshItemHtml(c, true, true) } } }; dhtmlXTreeView.prototype.getAllChecked = function(a) { return this._chbxGetCheckedBranch(a, true) }; dhtmlXTreeView.prototype.getAllUnchecked = function(a) { return this._chbxGetCheckedBranch(a, false) }; dhtmlXTreeView.prototype.checkItem = function(a) { this._chbxSetChecked(a, true, true) }; dhtmlXTreeView.prototype.uncheckItem = function(a) { this._chbxSetChecked(a, false, true) }; dhtmlXTreeView.prototype.isItemChecked = function(a) { if (this.items[a] == null) { return null } return (this.items[a].checked == true) }; dhtmlXTreeView.prototype.enableCheckbox = function(a) { this._chbxSetEnabled(a, true) }; dhtmlXTreeView.prototype.disableCheckbox = function(a) { this._chbxSetEnabled(a, false) }; dhtmlXTreeView.prototype.isCheckboxEnabled = function(a) { return (this.items[a].chbx_enabled == true) }; dhtmlXTreeView.prototype.showCheckbox = function(a) { this._chbxSetVisible(a, true) }; dhtmlXTreeView.prototype.hideCheckbox = function(a) { this._chbxSetVisible(a, false) }; dhtmlXTreeView.prototype.isCheckboxVisible = function(a) { return (this.items[a].chbx_visible == true) }; dhtmlXTreeView.prototype._chbxInit = function(a) { this.enableCheckboxes(a.checkboxes); this.attachEvent("_onItemRendered", function(g, e) { this.items[g].checked = window.dhx4.s2b(e.checked); var c = (e.checkbox || "enabled,visible"); this.items[g].chbx_enabled = (c.match(/disabled/) == null); this.items[g].chbx_visible = (c.match(/hidden/) == null) }); this.attachEvent("_onTreeClick", function(h, c) { if (this.conf.enable_chbx != true) { return } var g = (h.target || h.srcElement); if (g.tagName.toLowerCase() == "i") { g = g.parentNode } if ((g.parentNode.className || "").match(/dhxtreeview_item_text/) != null && g == g.parentNode.childNodes[this.conf.idx.chbx]) { var l = g.parentNode.parentNode._itemId; if (this.items[l].chbx_enabled == true) { this._chbxSetChecked(l, !this.items[l].checked, true) } c.stop = true } }); a = null }; dhtmlXTreeView.prototype._itemHtml_chbx = function(e, c) { var a = { nodeIndex: 0, nodeText: false }; if (this.conf.enable_chbx == true) { if (this.items[e].chbx_visible == true) { a.nodeIndex = 1 } a.nodeText = "
" + this._chbxGenIcon(e) + "
" } return a }; dhtmlXTreeView.prototype._chbxSetChecked = function(c, a) { if (this.conf.enable_chbx != true) { return } a = (a == true); if (this.items[c].checked != a) { if (this._callPublicEvent("onBeforeCheck", [c, (this.items[c].checked == true)]) !== true) { return } this.items[c].checked = a; this.items[c].item.childNodes[0].childNodes[this.conf.idx.chbx].innerHTML = this._chbxGenIcon(c); this._callPublicEvent("onCheck", [c, a]) } }; dhtmlXTreeView.prototype._chbxSetEnabled = function(c, a) { if (this.items[c].chbx_enabled != a) { this.items[c].chbx_enabled = a; this.items[c].item.firstChild.childNodes[this.conf.idx.chbx].innerHTML = this._chbxGenIcon(c) } }; dhtmlXTreeView.prototype._chbxSetVisible = function(c, a) { if (this.items[c].chbx_visible != a) { this.items[c].chbx_visible = a; this._refreshItemHtml(c, true, true) } }; dhtmlXTreeView.prototype._chbxGenIcon = function(c) { var a = this.conf.icons["chbx_" + (this.items[c].chbx_enabled ? "" : "dis_") + (this.items[c].checked ? "1" : "0")]; return '' }; dhtmlXTreeView.prototype._chbxUpdIndex = function() { if (this.conf.enable_chbx == true) { this.conf.idx = { sign: 0, chbx: 1, icon: 2, text: 3 } } else { this.conf.idx = { sign: 0, icon: 1, text: 2 } } }; dhtmlXTreeView.prototype._chbxGetCheckedBranch = function(g, h) { var e = []; for (var c in this.items) { if (this.items[c].pId == g) { if (this.items[c].checked == h) { e.push(c) } if (this.items[c].kids == true) { e = e.concat(this._chbxGetCheckedBranch(c, h)) } } } return e }; dhtmlXTreeView.prototype.modules.sign = { init: "_signInit" }; dhtmlXTreeView.prototype._signInit = function() { this.attachEvent("_onTreeClick", function(g, a) { if (a.stop == true) { return } var c = (g.target || g.srcElement); if (c.tagName.toLowerCase() == "i") { c = c.parentNode } if ((c.parentNode.className || "").match(/dhxtreeview_item_text/) != null && c == c.parentNode.childNodes[this.conf.idx.sign]) { this._openCloseItem(c.parentNode.parentNode._itemId, true); a.stop = true } }) }; dhtmlXTreeView.prototype._signUpdate = function(e) { var c = this.items[e]; var a = c.item.childNodes[0].childNodes[this.conf.idx.sign]; if (c.kids == true || c.kids_request == true) { a.innerHTML = '' } else { a.innerHTML = "" } c = a = null }; dhtmlXTreeView.prototype._itemHtml_sign = function(c, a) { return { nodeIndex: 1, nodeText: "
" } }; dhtmlXTreeView.prototype.modules.selection = { init: "_selectionInit" }; dhtmlXTreeView.prototype.selectItem = function(h) { if (this.conf.msel == true) { var e = {}; if (!(h instanceof Array)) { h = [h] } for (var g = 0; g < h.length; g++) { e[h[g]] = true } for (var c in this.conf.selected) { if (e[c] == true) { delete e[c] } else { this._setSelected(c, false) } } for (var c in e) { this._setSelected(c, true) } } else { if (h != null && this.conf.selected[h] != true && !(h instanceof Array)) { if (this._clearSelection(h) == false) { this._setSelected(h, true) } } } }; dhtmlXTreeView.prototype.unselectItem = function(c) { if (this.conf.msel == true) { if (!(c instanceof Array)) { c = [c] } for (var a = 0; a < c.length; a++) { if (this.conf.selected[c[a]] == true) { this._setSelected(c[a], false) } } } else { if (c != null) { this._setSelected(c, false) } } }; dhtmlXTreeView.prototype.getSelectedId = function() { var e = []; for (var c in this.conf.selected) { e.push(c) } return (this.conf.msel ? e : (e[0] || null)) }; dhtmlXTreeView.prototype.enableMultiselect = function(a) { a = (a == true); if (this.conf.msel != a) { this._clearSelection(); this.conf.msel = a } }; dhtmlXTreeView.prototype._selectionInit = function(a) { this.conf.msel = window.dhx4.s2b(a.multiselect); this.attachEvent("_onTreeClick", function(m, c) { if (c.stop == true) { return } var l = (m.target || m.srcElement); if (l.tagName.toLowerCase() == "i") { l = l.parentNode } var h = null; if (l.className.match(/dhxtreeview_item_label/) != null) { h = l.parentNode.parentNode._itemId } else { if (l.className.match(/^dhxtreeview_item_text/) != null) { h = l.parentNode._itemId } else { if (l.className.match(/^dhxtreeview_item_icon/) != null) { h = l.parentNode.parentNode._itemId } } } if (h != null) { if (!this._callPublicEvent("onBeforeSelect", [h])) { return } var g = new Date(); if (this._click_item !== h || (g - (this._click_timer || 0)) > 300) { this._callPublicEvent("onClick", [h]); this._click_timer = g; this._click_item = h } else { this._callPublicEvent("onDblClick", [h]); this._click_item = null } if (this.conf.msel == true) { if ((m.ctrlKey == true || this.conf.mac_cmd_key == true) && m.shiftKey == false && m.altKey == false) { this._setSelected(h, !this._isSelected(h)) } else { if (m.ctrlKey == false && m.shiftKey == false && m.altKey == false && this.conf.mac_cmd_key == false) { if (this._clearSelection(h) == false) { this._setSelected(h, true) } } } } else { if (this._clearSelection(h) == false) { this._setSelected(h, true) } } } }) }; dhtmlXTreeView.prototype._setSelected = function(c, a) { if (a == true) { if (this.conf.selected[c] != true) { this.items[c].item.childNodes[0].className += " dhxtreeview_item_text_selected"; this.conf.selected[c] = true; this._callPublicEvent("onSelect", [c, true]) } } else { if (this.conf.selected[c] == true) { this.items[c].item.childNodes[0].className = String(this.items[c].item.childNodes[0].className).replace(/\s*dhxtreeview_item_text_selected/gi, ""); delete this.conf.selected[c]; this._callPublicEvent("onSelect", [c, false]) } } }; dhtmlXTreeView.prototype._clearSelection = function(g) { var e = false; for (var c in this.conf.selected) { if (g != null && c == g) { e = true } else { this._setSelected(c, false) } } return e }; dhtmlXTreeView.prototype._isSelected = function(a) { return (this.conf.selected[a] == true) }; dhtmlXTreeView.prototype.modules.icons = { init: "_iconModuleInit" }; dhtmlXTreeView.prototype.setItemIcons = function(g, e) { if (e == null && this.items[g].icons != null) { delete this.items[g].icons } else { if (e != null) { if (this.items[g].icons == null) { this.items[g].icons = {} } for (var c in e) { if (e[c] != null) { this.items[g].icons[c] = e[c] } else { if (e[c] == null && this.items[g].icons[c] != null) { delete this.items[g].icons[c] } } } } } this._iconUpdate(g) }; dhtmlXTreeView.prototype.setIconColor = function(e, a) { var c = this.items[e].item.firstChild.childNodes[this.conf.idx.icon].firstChild; if (a == null) { if (this.items[e].icon_color != null) { delete this.items[e].icon_color; c.style.color = "inherit" } } else { if (this.items[e].icon_color != a) { this.items[e].icon_color = a; c.style.color = a } } c = null }; dhtmlXTreeView.prototype.setIconset = function(a) { if (this.icons[a] != null && this.icons[a].r == true) { this.conf.icons = this.icons[a] } }; dhtmlXTreeView.prototype._iconModuleInit = function() { this.attachEvent("_onItemRendered", function(c, a) { if (a.icons != null) { this.items[c].icons = a.icons } if (a.icon_color != null) { this.items[c].icon_color = a.icon_color } }) }; dhtmlXTreeView.prototype._iconConf = function(g) { var e = this.items[g].icons || {}; for (var c in { folder_opened: 1, folder_closed: 1, file: 1 }) { if (typeof(e[c]) == "undefined") { e[c] = this.conf.icons[c] } } return e }; dhtmlXTreeView.prototype._iconHtml = function(e, c) { var a = ['class="' + this.conf.icons.prefix + " " + c + '"']; if (this.items[e].icon_color != null) { a.push('style="color:' + this.items[e].icon_color + ';"') } return "" }; dhtmlXTreeView.prototype._itemHtml_icon = function(c, a) { return { nodeIndex: 1, nodeText: "
" + this._iconHtml(c, this._iconConf(c).file) + "
" } }; dhtmlXTreeView.prototype._iconUpdate = function(g) { var e = this.items[g]; var c = this._iconConf(g); var a = (e.kids == true || e.kids_request == true ? c[e.opened ? "folder_opened" : "folder_closed"] : c.file); e.item.childNodes[0].childNodes[this.conf.idx.icon].innerHTML = this._iconHtml(g, a); e = null }; dhtmlXTreeView.prototype.icons = { tree_native: { r: true, prefix: "dhxtreeview_icon", plus: "dhxtreeview_icon_plus", minus: "dhxtreeview_icon_minus", file: "dhxtreeview_icon_file", folder_opened: "dhxtreeview_icon_folder_opened", folder_closed: "dhxtreeview_icon_folder_closed", loading: "dhxtreeview_icon_loading", chbx_0: "dhxtreeview_icon_chbx_0", chbx_1: "dhxtreeview_icon_chbx_1", chbx_dis_0: "dhxtreeview_icon_chbx_dis_0", chbx_dis_1: "dhxtreeview_icon_chbx_dis_1" }, font_awesome: { r: (!(window.dhx4.isIE6 == true || window.dhx4.isIE7 == true)), prefix: "fa", plus: "fa-caret-right", minus: "fa-caret-down", file: "fa-file-o", folder_opened: "fa-folder-open-o", folder_closed: "fa-folder-o", loading: "fa-refresh fa-spin", chbx_0: "fa-square-o", chbx_1: "fa-check-square-o", chbx_dis_0: "fa-square-o dhx-disabled", chbx_dis_1: "fa-check-square-o dhx-disabled" } }; dhtmlXTreeView.prototype.modules.loading = { init: "_loadingInit", unload: "_loadingUnload" }; dhtmlXTreeView.prototype._loadingInit = function(a) { window.dhx4._enableDataLoading(this, "_initObj", "_xmlToObj", "tree", { struct: true }); this.conf.root_id = (typeof(a.root_id) == "undefined" || a.root_id == null ? "0" : a.root_id); this._dhxdataload.onBeforeXLS = function(c) { if (this.conf.autoload.url == null) { this.conf.autoload.url = c } return { url: c.replace(/\{id\}/gi, this.conf.root_id) } } }; dhtmlXTreeView.prototype._loadingUnload = function() { window.dhx4._enableDataLoading(this, null, null, null, "clear") }; dhtmlXTreeView.prototype._initObj = function(h, a, c, e) { for (var g = 0; g < h.length; g++) { var l = h[g].id; if (l == null) { l = "dhxtreeview_id_" + window.dhx4.newId() } if (this.items[l] == null) { this._addItem(l, c, h[g]) } if (h[g].items != null) { this._initObj(h[g].items, null, l, true) } } if (e != true) { this._fixAreaWidth() } }; dhtmlXTreeView.prototype._xmlToObj = function(n, m) { if (m != true) { n = n.getElementsByTagName("tree")[0] } var h = []; for (var c = 0; c < n.childNodes.length; c++) { var g = n.childNodes[c]; if ((g.tagName || "").toLowerCase() == "item") { var r = {}; for (var o = 0; o < g.attributes.length; o++) { r[g.attributes[o].name] = g.attributes[o].value } if (g.childNodes.length > 0) { var m = this._xmlToObj(g, true); if (m.length > 0) { r.items = m } for (var o = 0; o < g.childNodes.length; o++) { var s = (g.childNodes[o].tagName || "").toLowerCase(); if ({ icons: 1, userdata: 1 }[s] == 1) { if (r[s] == null) { r[s] = {} } for (var l = 0; l < g.childNodes[o].attributes.length; l++) { var a = g.childNodes[o].attributes[l].name; if (r[s][a] == null) { r[s][a] = g.childNodes[o].attributes[l].value } } } n2 = null } } h.push(r) } g = null } return h }; dhtmlXTreeView.prototype.modules.dnd = { init: "_dndInit", unload: "_dndUnload" }; dhtmlXTreeView.prototype.enableDragAndDrop = function(a) { this.conf.enable_dnd = window.dhx4.s2b(a) }; dhtmlXTreeView.prototype._dndInit = function(a) { var c = this; this.enableDragAndDrop(a.dnd); this.conf.dnd = null; this._dndOnMouseDown = function(n) { if (c.conf.enable_dnd != true) { return } n = n || event; if (typeof(n.button) != "undefined" && n.button >= 2) { return false } var o = null; var m = null; var l = n.target || n.srcElement; var h = window.dhx4.absLeft(l) + (typeof(n.offsetX) == "undefined" ? n.layerX : n.offsetX) - n.clientX; var g = window.dhx4.absTop(l) + (typeof(n.offsetY) == "undefined" ? n.layerY : n.offsetY) - n.clientY; while (l != null && l != c.cont) { if ((l.className || "").match(/dhxtreeview_item/) != null && l._itemId != null) { o = l._itemId; m = l._treeId; l = null } else { l = l.parentNode } } l = null; if (o == null) { return } c.conf.dnd = { inited: false, id: o, treeId: m, selected: (c.conf.selected[o] == true), tid: null, drop: {}, x: n.clientX, y: n.clientY, ofs_x: h, ofs_y: g, zi: window.dhx4.newId(), scroll: false, scroll_ofs: 5, scroll_time: 30, scroll_tm: null, kids: {}, idx: {} }; c._dndInitEvents() }; this._dndOnMouseMove = function(s) { s = s || event; if (c.conf.dnd.inited != true) { if (Math.abs(c.conf.dnd.x - s.clientX) >= 15 || Math.abs(c.conf.dnd.y - s.clientY) >= 15) { if (c._callPublicEvent("onBeforeDrag", [c.conf.dnd.id]) !== true) { return } c.conf.dnd.inited = true; c.cont.className += " dhxtreeview_dnd_mode"; c._dndInitDraggedObj(); c._dndCollectKids(c.conf.dnd.id); c._dndCollectIndexes(c.area); if (c._clearSelection(c.conf.dnd.id) == false) { c._setSelected(c.conf.dnd.id, true) } c.items[c.conf.dnd.id].item.className += " dhxtreeview_item_dragged"; document.body.className += " dhxtreeview_dnd_mode"; c.conf.dnd.cont = { x1: window.dhx4.absLeft(c.base), y1: window.dhx4.absTop(c.base) }; c.conf.dnd.cont.x2 = c.conf.dnd.cont.x1 + c.base.offsetWidth; c.conf.dnd.cont.y2 = c.conf.dnd.cont.y1 + c.base.offsetHeight } else { return } } c.conf.dnd.x = s.clientX; c.conf.dnd.y = s.clientY; c._dndAdjustDraggedObj(); var m = true; if (c.cont.scrollHeight > c.cont.clientHeight) { if (c.conf.dnd.x >= c.conf.dnd.cont.x1 && c.conf.dnd.x <= c.conf.dnd.cont.x2) { if (c.cont.scrollTop > 0 && c.conf.dnd.y >= c.conf.dnd.cont.y1 && c.conf.dnd.y <= c.conf.dnd.cont.y1 + 10) { c._dndScroll("up"); m = false } else { if (c.cont.scrollTop + c.cont.clientHeight < c.cont.scrollHeight && c.conf.dnd.y <= c.conf.dnd.cont.y2 && c.conf.dnd.y >= c.conf.dnd.cont.y2 - 10) { c._dndScroll("down"); m = false } } } } if (m == true && c.conf.dnd.scroll == true) { c._dndScroll("stop") } var v = (s.target || s.srcElement); if (v.parentNode != null && (v.parentNode.className || "").match(/dhxtreeview_kids_cont/) != null) { v = null; return } var g = false; var n = null; var r = null; if (v.className != null) { if (v.className.match(/dhxtreeview_item_[li]/) != null) { n = v.parentNode.parentNode._itemId; r = v.parentNode.parentNode._treeId } else { if (v.className.match(/dhxtreeview_item_[t]/) != null) { n = v.parentNode._itemId; r = v.parentNode._treeId } } } if (n != null && r != c.conf.dnd.treeId) { return } if (c.conf.dnd.id == n || c.conf.dnd.kids[n] == true) { n = null } if (n != null) { var o = c.items[n].item.firstChild.offsetHeight; var u = Math.max(Math.floor(Math.min(s.offsetY, o) * 3 / o), 0); if (u == 0) { if (c.items[n].item.previousSibling == c.items[c.conf.dnd.id].item) { u = null } } else { if (u == 1) { if (c.items[c.conf.dnd.id].pId == n) { u = null } else { if (c.items[n].kids == true && c.items[n].item.lastChild.firstChild.firstChild == c.items[c.conf.dnd.id].item) { u = null } else { if (c.items[n].opened == false) {} } } } else { if (u == 2) { if (c.items[n].opened == true) { u = null } else { if (c.items[n].item.nextSibling == c.items[c.conf.dnd.id].item) { u = null } } } } } if (u != c.conf.dnd.ofs) { c.conf.dnd.ofs = u; g = true } } if (n != c.conf.dnd.tid) { if (c.conf.dnd.tid != null) { c._dndUpdateTargetCss(c.conf.dnd.tid, false) } if (n != null) { g = true } c.conf.dnd.tid = n } if (g == true) { var q = false; if (u != null) { var l = { id: c.conf.dnd.id, pId: c.items[n].pId || null, index: null, idxOfs: (c.items[c.conf.dnd.id].pId == c.items[n].pId && c.conf.dnd.idx[c.conf.dnd.id] < c.conf.dnd.idx[n] ? -1 : 0) }; if (u == 0 || u == 2) { l.index = c.conf.dnd.idx[n] + (u == 2 ? 1 : 0) + l.idxOfs } else { if (u == 1) { l.pId = n; l.index = (c.items[n].item.lastChild.className.match(/dhxtreeview_kids_cont/) == null ? 0 : c.items[n].item.lastChild.firstChild.childNodes.length) } } if (c.conf.dnd.drop.id != l.id || c.conf.dnd.drop.pId != l.pId || c.conf.dnd.drop.index != l.index) { c.conf.dnd.drop = l; if (c._callPublicEvent("onDragOver", [c.conf.dnd.drop.id, c.conf.dnd.drop.pId, c.conf.dnd.drop.index]) === true) { q = true } } } if (q != true) { c.conf.dnd.ofs = u = null } c._dndUpdateTargetCss(n, q) } }; this._dndOnMouseUp = function(q) { q = q || event; if (typeof(q.button) != "undefined" && q.button >= 2) { return } c._dndUnloadEvents(); c._dndUnloadDraggedObj(); if (c.conf.dnd.scroll == true) { c._dndScroll("stop") } if (c.cont.className.match(/dhxtreeview_dnd_mode/gi) != null) { c.cont.className = String(c.cont.className).replace(/\s*dhxtreeview_dnd_mode/gi, "") } if (c.conf.dnd.tid != null) { c._dndUpdateTargetCss(c.conf.dnd.tid, false) } if (c.conf.dnd.inited == true) { c.items[c.conf.dnd.id].item.className = String(c.items[c.conf.dnd.id].item.className).replace(/\s*dhxtreeview_item_dragged/gi, ""); document.body.className = String(document.body.className).replace(/\s*dhxtreeview_dnd_mode/, ""); if (c.conf.dnd.tid != null && c.conf.dnd.ofs != null) { if (c._callPublicEvent("onBeforeDrop", [c.conf.dnd.drop.id, c.conf.dnd.drop.pId, c.conf.dnd.drop.index]) === true) { var o = c.items[c.conf.dnd.id]; var h = c.items[c.conf.dnd.tid]; var l = (o.pId != null ? c.items[o.pId] : null); var n; if (c.conf.dnd.ofs == 1) { var m = false; if (h.kids == false) { c._initKidsNode(h.id); m = true } h.item.lastChild.firstChild.appendChild(o.item); if (m == true) { c._openCloseItem(h.id, false) } o.pId = h.id; n = h.level + 1 - o.level } else { if (c.conf.dnd.ofs == 0 || c.conf.dnd.ofs == 2) { if (c.conf.dnd.ofs == 0) { h.item.parentNode.insertBefore(o.item, h.item) } else { if (h.item.nextSibling != null) { h.item.parentNode.insertBefore(o.item, h.item.nextSibling) } else { h.item.parentNode.appendChild(o.item) } } o.pId = h.pId; n = h.level - o.level } } if (n != 0) { c.conf.dnd.kids[o.id] = true; for (var g in c.conf.dnd.kids) { c.items[g].level += n; c._refreshItemHtml(g, (c.items[g].kids == true), true) } } if (l != null && l.kids == true && l.item.lastChild.firstChild.childNodes.length == 0) { c._clearKidsNode(l.id); l.opened = false } o = h = l = null; c._fixAreaWidth(); c._callPublicEvent("onDrop", [c.conf.dnd.drop.id, c.conf.dnd.drop.pId, c.conf.dnd.drop.index]) } } } window.dhx4.zim.clear(c.conf.dnd.zi); c.conf.dnd = null }; this._dndOnContextMenu = function(g) { if (c.conf.dnd.inited == true) { g = g || event; g.cancelBubble = true; if (g.preventDefault) { g.preventDefault() } g.returnValue = false; return false } }; this._dndInitEvents = function() { if (typeof(window.addEventListener) == "function") { window.addEventListener("mousemove", this._dndOnMouseMove, false); window.addEventListener("mouseup", this._dndOnMouseUp, false); window.addEventListener("contextmenu", this._dndOnContextMenu, false) } else { document.body.attachEvent("onmousemove", this._dndOnMouseMove); document.body.attachEvent("onmouseup", this._dndOnMouseUp); document.body.attachEvent("oncontextmenu", this._dndOnContextMenu) } }; this._dndUnloadEvents = function() { if (typeof(window.addEventListener) == "function") { window.removeEventListener("mousemove", this._dndOnMouseMove, false); window.removeEventListener("mouseup", this._dndOnMouseUp, false); window.removeEventListener("contextmenu", this._dndOnContextMenu, false) } else { document.body.detachEvent("onmousemove", this._dndOnMouseMove); document.body.detachEvent("onmouseup", this._dndOnMouseUp); document.body.detachEvent("oncontextmenu", this._dndOnContextMenu) } }; this._dndInitDraggedObj = function() { this.conf.dnd.dragged = document.createElement("DIV"); this.conf.dnd.dragged.className = "dhxtreeview_dragged_obj_" + this.conf.skin; this.conf.dnd.dragged.style.zIndex = window.dhx4.zim.reserve(this.conf.dnd.zi); document.body.appendChild(this.conf.dnd.dragged); this.conf.dnd.dragged.innerHTML = this.getItemText(this.conf.dnd.id) }; this._dndAdjustDraggedObj = function() { this.conf.dnd.dragged.style.left = this.conf.dnd.x + this.conf.dnd.ofs_x + 12 + "px"; this.conf.dnd.dragged.style.top = this.conf.dnd.y + this.conf.dnd.ofs_y + 18 + "px" }; this._dndUnloadDraggedObj = function() { if (this.conf.dnd.dragged != null) { document.body.removeChild(this.conf.dnd.dragged); this.conf.dnd.dragged = null } }; this._dndUpdateTargetCss = function(l, h) { var g = this.items[l].item.childNodes[0]; if (this.conf.dnd.ofs == null) { h = false } if (h == true) { g.className = String(g.className).replace(/(\s*dhxtreeview_drop_\d)?$/i, " dhxtreeview_drop_" + this.conf.dnd.ofs); if (g.nextSibling == null || g.nextSibling.className.match(/dhxtreeview_drop_preview/) == null) { var e = document.createElement("DIV"); e.className = "dhxtreeview_drop_preview"; e.style.left = g.lastChild.previousSibling.style.left; if (g.nextSibling == null) { g.parentNode.appendChild(e) } else { g.parentNode.insertBefore(e, g.nextSibling) } e = null } g.nextSibling.className = String(g.nextSibling.className).replace(/(\s*dhxtreeview_drop_\d)?$/i, " dhxtreeview_drop_" + this.conf.dnd.ofs) } else { if (g.className.match(/dhxtreeview_drop_\d/) != null) { g.className = String(g.className).replace(/\s*dhxtreeview_drop_\d/gi, ""); if (g.nextSibling != null && g.nextSibling.className.match(/dhxtreeview_drop_preview/) != null) { g.parentNode.removeChild(g.nextSibling) } } } g = null }; this._dndCollectKids = function(g) { for (var e in this.items) { if (this.items[e].pId == g) { this.conf.dnd.kids[e] = true; if (this.items[e].kids == true) { this._dndCollectKids(e) } } } }; this._dndCollectIndexes = function(e) { for (var g = 0; g < e.childNodes.length; g++) { this.conf.dnd.idx[e.childNodes[g]._itemId] = g; if (e.childNodes[g].lastChild.className.match(/dhxtreeview_kids_cont/) != null) { this._dndCollectIndexes(e.childNodes[g].lastChild.firstChild) } } }; this._dndScroll = function(h, g) { if (h == "stop") { if (c.conf.dnd.scroll == true) { if (c.conf.dnd.scroll_tm) { window.clearTimeout(c.conf.dnd.scroll_tm) } c.conf.dnd.scroll = false } return } else { if (c.conf.dnd.scroll == true) { if (g != true) { return } } else { c.conf.dnd.scroll = true } var e = false; if (h == "up") { c.cont.scrollTop = Math.max(0, c.cont.scrollTop - c.conf.dnd.scroll_ofs); if (c.cont.scrollTop == 0) { e = true } } else { c.cont.scrollTop = Math.min(c.cont.scrollHeight - c.cont.clientHeight, c.cont.scrollTop + c.conf.dnd.scroll_ofs); if (c.cont.scrollTop + c.cont.clientHeight == c.cont.scrollHeight) { e = true } } if (e != true) { c.conf.dnd.scroll_tm = window.setTimeout(function() { c._dndScroll(h, true) }, c.conf.dnd.scroll_time) } } }; if (typeof(window.addEventListener) == "function") { this.cont.addEventListener("mousedown", this._dndOnMouseDown, false) } else { this.cont.attachEvent("onmousedown", this._dndOnMouseDown) } this._dndUnload = function() { if (typeof(window.addEventListener) == "function") { this.cont.removeEventListener("mousedown", this._dndOnMouseDown, false) } else { this.cont.detachEvent("onmousedown", this._dndOnMouseDown) } c = null }; a = null }; dhtmlXTreeView.prototype.modules.ctx = { init: "_ctxInit", unload: "_ctxUnload" }; dhtmlXTreeView.prototype.enableContextMenu = function(a) { this.conf.ctx = window.dhx4.s2b(a) }; dhtmlXTreeView.prototype._ctxInit = function(a) { var c = this; this._ctxCall = function(l) { if (c.conf.ctx != true) { return } l = l || event; var h = (l.target || l.srcElement); if (h.tagName.toLowerCase() == "i") { h = h.parentNode } var n = (h.parentNode._itemId || h.parentNode.parentNode._itemId); var g = window.dhx4.absLeft(h) + (typeof(l.offsetX) == "undefined" ? l.layerX : l.offsetX); var m = window.dhx4.absTop(h) + (typeof(l.offsetY) == "undefined" ? l.layerY : l.offsetY); if (n != null && c._callPublicEvent("onContextMenu", [n, g, m, l]) !== true) { if (l.preventDefault) { l.preventDefault() } l.cancelBubble = true; l.returnValue = false; return false } }; if (typeof(window.addEventListener) == "function") { this.cont.addEventListener("contextmenu", this._ctxCall, false) } else { this.cont.attachEvent("oncontextmenu", this._ctxCall) } this._ctxUnload = function() { if (typeof(window.addEventListener) == "function") { this.cont.removeEventListener("contextmenu", this._ctxCall, false) } else { this.cont.detachEvent("oncontextmenu", this._ctxCall) } c = null }; this.enableContextMenu(a.context_menu) }; dhtmlXTreeView.prototype.modules.dynload = { init: "_dynLoadInit" }; dhtmlXTreeView.prototype._dynLoadInit = function() { this.attachEvent("_onItemInited", function(e, c) { this.items[e].kids_request = window.dhx4.s2b(c.kids); if (this.items[e].kids_request == true) { this._initKidsNode(e) } if (this.items[e].opened == true && this.items[e].kids_request == true) { var a = this; window.setTimeout(function() { a._dynLoadRequest(e); a = null }, 100) } }); this.attachEvent("_onBeforeOpen", function(a) { if (this.items[a].opened != true && this.items[a].kids_request == true) { if (this._dynLoadRequest(a) != true) { this.items[a].half_opened = true; this._signUpdate(a); return false } } return true }) }; dhtmlXTreeView.prototype._dynLoadRequest = function(c) { if (typeof(this.conf.autoload.mode) == "function") { this.conf.autoload.mode.apply(window, [c]); return true } if (this.conf.autoload.url == null) { return } this._dhxdataload.onBeforeXLS = function(e) { return { url: e.replace(/\{id\}/gi, c) } }; var a = this; this.items[c].kids_loading_tm = window.setTimeout(function() { a._dynLoadUpdateIcon(c, true); a = null }, 100); this.loadStruct(this.conf.autoload.url, function() { window.clearTimeout(this.items[c].kids_loading_tm); this._dynLoadUpdateIcon(c, false); if (this.items[c].half_opened) { this.items[c].half_opened = false; this._openCloseItem(c, true) } }); this.items[c].kids_request = false; return false }; dhtmlXTreeView.prototype._dynLoadUpdateIcon = function(c, a) { this.items[c].loading = (a == true); if (this.items[c].loading == true) { this.items[c].item.childNodes[0].childNodes[this.conf.idx.icon].innerHTML = "" } else { this._iconUpdate(c) } }; var globalActiveDHTMLGridObject; String.prototype._dhx_trim = function() { return this.replace(/ /g, " ").replace(/(^[ \t]*)|([ \t]*$)/g, "") }; function dhtmlxArray(a) { return dhtmlx.extend((a || new Array()), dhtmlxArray._master) } dhtmlxArray._master = { _dhx_find: function(c) { for (var a = 0; a < this.length; a++) { if (c == this[a]) { return a } } return -1 }, _dhx_insertAt: function(e, c) { this[this.length] = null; for (var a = this.length - 1; a >= e; a--) { this[a] = this[a - 1] } this[e] = c }, _dhx_removeAt: function(a) { this.splice(a, 1) }, _dhx_swapItems: function(a, e) { var c = this[a]; this[a] = this[e]; this[e] = c } }; function dhtmlXGridObject(id) { if (dhtmlxEvent.initTouch) { dhtmlxEvent.initTouch() } if (_isIE) { try { document.execCommand("BackgroundImageCache", false, true) } catch (e) {} } if (id) { if (typeof(id) == "object") { this.entBox = id; if (!this.entBox.id) { this.entBox.id = "cgrid2_" + this.uid() } } else { this.entBox = document.getElementById(id) } } else { this.entBox = document.createElement("DIV"); this.entBox.id = "cgrid2_" + this.uid() } this.entBox.innerHTML = ""; dhx4._eventable(this); var self = this; this._RaSeCol = []; this._wcorr = 0; this.fontWidth = 7; this.cell = null; this.row = null; this.iconURL = ""; this.editor = null; this._f2kE = true; this._dclE = true; this.combos = new Array(0); this.defVal = new Array(0); this.rowsAr = {}; this.rowsBuffer = dhtmlxArray(); this.rowsCol = dhtmlxArray(); this._data_cache = {}; this._ecache = {}; this._ud_enabled = true; this.xmlLoader = this.doLoadDetails; this._maskArr = []; this.selectedRows = dhtmlxArray(); this.UserData = {}; this._sizeFix = this._borderFix = 0; this.entBox.className += " gridbox"; this.entBox.style.width = this.entBox.getAttribute("width") || (window.getComputedStyle ? (this.entBox.style.width || window.getComputedStyle(this.entBox, null)["width"]) : (this.entBox.currentStyle ? this.entBox.currentStyle.width : this.entBox.style.width || 0)) || "100%"; this.entBox.style.height = this.entBox.getAttribute("height") || (window.getComputedStyle ? (this.entBox.style.height || window.getComputedStyle(this.entBox, null)["height"]) : (this.entBox.currentStyle ? this.entBox.currentStyle.height : this.entBox.style.height || 0)) || "100%"; this.entBox.style.cursor = "default"; this.entBox.onselectstart = function() { return false }; var t_creator = function(name) { var t = document.createElement("TABLE"); t.cellSpacing = t.cellPadding = 0; t.style.cssText = "width:100%;table-layout:fixed;"; t.className = name.substr(2); return t }; this.obj = t_creator("c_obj"); this.hdr = t_creator("c_hdr"); this.hdr.style.marginRight = "20px"; if (!dhx.isChrome) { this.hdr.style.paddingRight = "20px" } this.objBox = document.createElement("DIV"); this.objBox.style.width = "100%"; this.objBox.style.overflow = "auto"; this.objBox.appendChild(this.obj); this.objBox.className = "objbox"; if (dhtmlx.$customScroll) { dhtmlx.CustomScroll.enable(this) } this.hdrBox = document.createElement("DIV"); this.hdrBox.style.width = "100%"; this.hdrBox.style.height = "25px"; this.hdrBox.style.overflow = "hidden"; this.hdrBox.className = "xhdr"; this.preloadImagesAr = new Array(0); this.sortImg = document.createElement("DIV"); this.sortImg.style.display = "none"; this.hdrBox.appendChild(this.sortImg); this.hdrBox.appendChild(this.hdr); this.hdrBox.style.position = "relative"; this.entBox.appendChild(this.hdrBox); this.entBox.appendChild(this.objBox); this.entBox.grid = this; this.objBox.grid = this; this.hdrBox.grid = this; this.obj.grid = this; this.hdr.grid = this; this.cellWidthPX = []; this.cellWidthPC = []; this.cellWidthType = this.entBox.cellwidthtype || "px"; this.delim = this.entBox.delimiter || ","; this._csvDelim = ","; this.hdrLabels = []; this.columnIds = []; this.columnColor = []; this._hrrar = []; this.cellType = dhtmlxArray(); this.cellAlign = []; this.initCellWidth = []; this.fldSort = []; this._srdh = (_isIE && (document.compatMode != "BackCompat") ? 22 : 20); this.imgURL = window.dhx_globalImgPath || ""; this.isActive = false; this.isEditable = true; this.useImagesInHeader = false; this.pagingOn = false; this.rowsBufferOutSize = 0; dhtmlxEvent(window, "unload", function() { try { if (self.destructor) { self.destructor() } } catch (e) {} }); this.setSkin = function(name) { this._srdh = window.dhx4.readFromCss("dhxgrid_rh_" + name) + 4; this.skin_name = name; if (this._imgURL) { this.setImagePath(this._imgURL) } var classname = this.entBox.className.split(" gridbox")[0]; this.entBox.className = classname + " gridbox gridbox_" + name + (_isIE ? " isIE" : " isModern"); this.skin_h_correction = 0; this.enableAlterCss("ev_" + name, "odd_" + name, this.isTreeGrid()); this._fixAlterCss(); switch (name) { case "dhx_terrace": case "material": this._srdh = 33; this.forceDivInHeader = true; break; case "dhx_web": case "material": this.forceDivInHeader = true; this._srdh = 31; break; case "dhx_skyblue": this.forceDivInHeader = true; break } if (_isIE && this.hdr) { var d = this.hdr.parentNode; d.removeChild(this.hdr); d.appendChild(this.hdr) } this.setSizes() }; if (_isIE) { this.preventIECaching(true) } if (window.dhtmlDragAndDropObject) { this.dragger = new dhtmlDragAndDropObject() } this._doOnScroll = function(e, mode) { this.callEvent("onScroll", [this.objBox.scrollLeft, this.objBox.scrollTop]); this.doOnScroll(e, mode) }; this.doOnScroll = function(e, mode) { var box = this.hdrBox; box._try_header_sync = true; setTimeout(function() { box._try_header_sync = false }, 2000); this.hdrBox.scrollLeft = this.objBox.scrollLeft; if (this.ftr) { this.ftr.parentNode.scrollLeft = this.objBox.scrollLeft } if (mode) { return } if (this._srnd) { if (this._dLoadTimer) { window.clearTimeout(this._dLoadTimer) } this._dLoadTimer = window.setTimeout(function() { if (self._update_srnd_view) { self._update_srnd_view() } }, 100) } }; this.attachToObject = function(obj) { obj.appendChild(this.globalBox ? this.globalBox : this.entBox); this.setSizes() }; this.init = function(fl) { if ((this.isTreeGrid()) && (!this._h2)) { this._h2 = this._createHierarchy(); if ((this._fake) && (!this._realfake)) { this._fake._h2 = this._h2 } this._tgc = { imgURL: null } } if (!this._hstyles) { return } if (!this.skin_name) { this.setSkin(window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxgrid") || "material") } this.editStop(); this.lastClicked = null; this.resized = null; this.fldSorted = this.r_fldSorted = null; this.cellWidthPX = []; this.cellWidthPC = []; if (this.hdr.rows.length > 0) { var temp = this.xmlFileUrl; this.clearAll(true); this.xmlFileUrl = temp } var hdrRow = this.hdr.insertRow(0); for (var i = 0; i < this.hdrLabels.length; i++) { hdrRow.appendChild(document.createElement("TH")); hdrRow.childNodes[i]._cellIndex = i; hdrRow.childNodes[i].style.height = "0px" } if (_isIE && _isIE < 8 && document.body.style.msTouchAction == this.undefined) { hdrRow.style.position = "absolute" } else { hdrRow.style.height = "auto" } var hdrRow = this.hdr.insertRow(_isKHTML ? 2 : 1); hdrRow._childIndexes = new Array(); var col_ex = 0; for (var i = 0; i < this.hdrLabels.length; i++) { hdrRow._childIndexes[i] = i - col_ex; if ((this.hdrLabels[i] == this.splitSign) && (i != 0)) { if (_isKHTML) { hdrRow.insertCell(i - col_ex) } hdrRow.cells[i - col_ex - 1].colSpan = (hdrRow.cells[i - col_ex - 1].colSpan || 1) + 1; hdrRow.childNodes[i - col_ex - 1]._cellIndex++; col_ex++; hdrRow._childIndexes[i] = i - col_ex; continue } hdrRow.insertCell(i - col_ex); hdrRow.childNodes[i - col_ex]._cellIndex = i; hdrRow.childNodes[i - col_ex]._cellIndexS = i; this.setColumnLabel(i, this.hdrLabels[i]) } if (col_ex == 0) { hdrRow._childIndexes = null } this._cCount = this.hdrLabels.length; if (_isIE) { window.setTimeout(function() { if (self.setSizes) { self.setSizes() } }, 1) } if (!this.obj.firstChild) { this.obj.appendChild(document.createElement("TBODY")) } var tar = this.obj.firstChild; if (!tar.firstChild) { tar.appendChild(document.createElement("TR")); tar = tar.firstChild; if (_isIE && _isIE < 8 && document.body.style.msTouchAction == this.undefined) { tar.style.position = "absolute" } else { tar.style.height = "auto" } for (var i = 0; i < this.hdrLabels.length; i++) { tar.appendChild(document.createElement("TH")); tar.childNodes[i].style.height = "0px" } } this._c_order = null; if (this.multiLine != true) { this.obj.className += " row20px" } this.sortImg.style.position = "absolute"; this.sortImg.style.display = "none"; this.sortImg.className = "dhxgrid_sort_desc"; this.sortImg.defLeft = 0; if (this.noHeader) { this.hdrBox.style.display = "none" } else { this.noHeader = false } if (this._ivizcol) { this.setColHidden() } this.attachHeader(); this.attachHeader(0, 0, "_aFoot"); this.setSizes(); if (fl) { this.parseXML() } this.obj.scrollTop = 0; if (this.dragAndDropOff) { this.dragger.addDragLanding(this.entBox, this) } if (this._initDrF) { this._initD() } dhx4.callEvent("onGridCreated", [this]) }; this.setColumnSizes = function(gridWidth) { var summ = 0; var fcols = []; var fix = 0; for (var i = 0; i < this._cCount; i++) { if ((this.initCellWidth[i] == "*") && !this._hrrar[i]) { this._awdth = false; fcols.push(i); continue } if (this.cellWidthType == "%") { if (typeof this.cellWidthPC[i] == "undefined") { this.cellWidthPC[i] = this.initCellWidth[i] } var cwidth = (gridWidth * this.cellWidthPC[i] / 100) || 0; if (fix > 0.5) { cwidth++; fix-- } var rwidth = this.cellWidthPX[i] = Math.floor(cwidth); var fix = fix + cwidth - rwidth } else { if (typeof this.cellWidthPX[i] == "undefined") { this.cellWidthPX[i] = this.initCellWidth[i] } } if (!this._hrrar[i]) { summ += this.cellWidthPX[i] * 1 } } if (fcols.length) { var ms = Math.floor((gridWidth - summ) / fcols.length); if (ms < 0) { ms = 1 } for (var i = 0; i < fcols.length; i++) { var next = Math.max((this._drsclmW ? (this._drsclmW[fcols[i]] || 0) : 0), ms); this.cellWidthPX[fcols[i]] = next; summ += next } if (gridWidth > summ) { var last = fcols[fcols.length - 1]; this.cellWidthPX[last] = this.cellWidthPX[last] + (gridWidth - summ); summ = gridWidth } this._setAutoResize() } this.obj.style.width = summ + "px"; this.hdr.style.width = summ + "px"; if (this.ftr) { this.ftr.style.width = summ + "px" } this.chngCellWidth(); return summ }; this.setSizes = function() { if ((!this.hdr.rows[0])) { return } var quirks = this.quirks = (_isIE && document.compatMode == "BackCompat"); var outerBorder = (this.entBox.offsetWidth - this.entBox.clientWidth) / 2; if (!this.dontSetSizes) { if (this.globalBox) { if (!this.globalBox.clientWidth) { return } var ow = this.globalBox.clientWidth; var splitOuterBorder = (this.globalBox.offsetWidth - ow) / 2; if (this._delta_x && !this._realfake) { this.globalBox.style.width = this._delta_x; this.globalBox.style.boxSizing = "border-box"; var owu = this.globalBox.clientWidth; this.entBox.style.width = Math.max(0, (owu + (quirks ? splitOuterBorder * 2 : 0)) - this._fake.entBox.clientWidth) + "px"; if (owu != this._lastTimeSplitWidth) { this._fake._correctSplit(this._fake.entBox.clientWidth); this._lastTimeSplitWidth = owu } } if (this._delta_y && !this._realfake) { this.globalBox.style.height = this._delta_y; this.entBox.style.overflow = this._fake.entBox.style.overflow = "hidden"; this.entBox.style.height = this._fake.entBox.style.height = this.globalBox.clientHeight + (quirks ? splitOuterBorder * 2 : 0) + "px" } } else { if (this._delta_x) { if (this.entBox.parentNode && this.entBox.parentNode.tagName == "TD") { this.entBox.style.width = "1px"; this.entBox.style.width = parseInt(this._delta_x) * this.entBox.parentNode.clientWidth / 100 - outerBorder * 2 + "px" } else { if (this._delta_x === "100%" || !this.entBox.parentNode) { this.entBox.style.width = this.entBox.parentNode.offsetWidth + "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 || this.skin_name == "material") && !quirks) ? 2 : 0); var border_y = ((!this._wthB) && ((this.entBox.cmp || this._delta_y) && ((this.skin_name || "").indexOf("dhx") == 0 || this.skin_name == "material") && !quirks) ? 2 : 0); if (this._sizeFix) { border_x -= this._sizeFix; border_y -= this._sizeFix } var isVScroll = this.parentGrid ? false : (this.objBox.scrollHeight > this.objBox.offsetHeight); var scrfix = dhtmlx.$customScroll ? 0 : 18; var gridWidth = this.entBox.clientWidth - (this.skin_h_correction || 0) * (quirks ? 0 : 1) - border_x; var gridWidthActive = this.entBox.clientWidth - (this.skin_h_correction || 0) - border_x; var gridHeight = this.entBox.clientHeight - border_y; var summ = this.setColumnSizes(gridWidthActive - (isVScroll ? scrfix : 0) - (this._correction_x || 0)); var isHScroll = this.parentGrid ? false : ((this.objBox.scrollWidth > this.objBox.offsetWidth) || (this.objBox.style.overflowX == "scroll")); var headerHeight = this.hdr.clientHeight; var footerHeight = this.ftr ? this.ftr.clientHeight : 0; var newWidth = gridWidth; var newHeight = gridHeight - headerHeight - footerHeight; if (this._awdth && this._awdth[0] && this._awdth[1] == 99999) { isHScroll = 0 } if (this._ahgr) { if (this._ahgrMA) { newHeight = this.entBox.parentNode.clientHeight - headerHeight - footerHeight } else { newHeight = this.obj.offsetHeight + (isHScroll ? scrfix : 0) + (this._correction_y || 0) } if (this._ahgrM) { if (this._ahgrF) { newHeight = Math.min(this._ahgrM, newHeight + headerHeight + footerHeight) - headerHeight - footerHeight } else { newHeight = Math.min(this._ahgrM, newHeight) } } if (isVScroll && newHeight >= this.obj.scrollHeight + (isHScroll ? scrfix : 0)) { isVScroll = false; this.setColumnSizes(gridWidthActive - (this._correction_x || 0)) } } if ((this._awdth) && (this._awdth[0])) { if (this.cellWidthType == "%") { this.cellWidthType = "px" } if (this._fake) { summ += this._fake.entBox.clientWidth } var newWidth = Math.min(Math.max(summ + (isVScroll ? scrfix : 0), this._awdth[2]), this._awdth[1]) + (this._correction_x || 0); this.objBox.style.overflowX = (!isVScroll && this.objBox.scrollWidth <= newWidth) ? "hidden" : "auto"; if (this._fake) { newWidth -= this._fake.entBox.clientWidth } } newHeight = Math.max(0, newHeight); this._ff_size_delta = (this._ff_size_delta == 0.1) ? 0.2 : 0.1; if (!_isFF) { this._ff_size_delta = 0 } if (!this.dontSetSizes) { this.entBox.style.width = Math.max(0, newWidth + (quirks ? 2 : 0) * outerBorder + this._ff_size_delta) + "px"; this.entBox.style.height = newHeight + (quirks ? 2 : 0) * outerBorder + headerHeight + footerHeight + "px" } this.objBox.style.height = newHeight + ((quirks && !isVScroll) ? 2 : 0) * outerBorder + "px"; this.hdrBox.style.height = headerHeight + "px"; if (newHeight != gridHeight) { this.doOnScroll(0, !this._srnd) } var ext = this["setSizes_" + this.skin_name]; if (ext) { ext.call(this) } this.setSortImgPos(); if (headerHeight != this.hdr.clientHeight && this._ahgr) { this.setSizes() } this.callEvent("onSetSizes", []) }; this.chngCellWidth = function() { if ((_isOpera) && (this.ftr)) { this.ftr.width = this.objBox.scrollWidth + "px" } var l = this._cCount; for (var i = 0; i < l; i++) { this.hdr.rows[0].cells[i].style.width = this.cellWidthPX[i] + "px"; this.obj.rows[0].childNodes[i].style.width = this.cellWidthPX[i] + "px"; if (this.ftr) { this.ftr.rows[0].cells[i].style.width = this.cellWidthPX[i] + "px" } } }; this.setDelimiter = function(delim) { this.delim = delim }; this.setInitWidthsP = function(wp) { this.cellWidthType = "%"; this.initCellWidth = wp.split(this.delim.replace(/px/gi, "")); if (!arguments[1]) { this._setAutoResize() } }; this._setAutoResize = function() { if (this._realfake) { return } var el = window; var self = this; dhtmlxEvent(window, "resize", function() { window.clearTimeout(self._resize_timer); if (self._setAutoResize) { self._resize_timer = window.setTimeout(function() { if (self.setSizes) { self.setSizes() } if (self._fake) { self._fake._correctSplit() } }, 100) } }); this._setAutoResize = function() {} }; this.setInitWidths = function(wp) { this.cellWidthType = "px"; this.initCellWidth = wp.split(this.delim); if (_isFF) { for (var i = 0; i < this.initCellWidth.length; i++) { if (this.initCellWidth[i] != "*") { this.initCellWidth[i] = parseInt(this.initCellWidth[i]) } } } }; this.enableMultiline = function(state) { this.multiLine = dhx4.s2b(state) }; this.enableMultiselect = function(state) { this.selMultiRows = dhx4.s2b(state) }; this.setImagePath = function(path) { path = path.replace(/imgs\/dhxgrid_[a-z]*\/$/, "imgs/"); this._imgURL = path; this.imgURL = path + "dhxgrid_" + (this.skin_name || "dhx_skyblue").replace("dhx_", "") + "/"; this.iconTree = this.imgURL + "tree/" }; this.setImagesPath = this.setImagePath; this.setIconPath = function(path) { this.iconURL = path }; this.setIconsPath = this.setIconPath; this.changeCursorState = function(ev) { var el = ev.target || ev.srcElement; if (el.tagName != "TD") { el = this.getFirstParentOfType(el, "TD") } if (!el) { return } if ((el.tagName == "TD") && (this._drsclmn) && (!this._drsclmn[el._cellIndex])) { return el.style.cursor = "default" } var check = (ev.layerX || 0) + (((!_isIE) && (ev.target.tagName == "DIV")) ? el.offsetLeft : 0); if ((el.offsetWidth - (ev.offsetX || (parseInt(this.getPosition(el, this.hdrBox)) - check) * -1)) < (_isOpera ? 20 : 10)) { el.style.cursor = "E-resize" } else { el.style.cursor = "default" } if (_isOpera) { this.hdrBox.scrollLeft = this.objBox.scrollLeft } }; this.startColResize = function(ev) { if (this.resized) { this.stopColResize() } this.resized = null; var el = ev.target || ev.srcElement; if (el.tagName != "TD") { el = this.getFirstParentOfType(el, "TD") } var x = ev.clientX; var tabW = this.hdr.offsetWidth; var startW = parseInt(el.offsetWidth); if (el.tagName == "TD" && el.style.cursor != "default") { if ((this._drsclmn) && (!this._drsclmn[el._cellIndex])) { return } self._old_d_mm = document.body.onmousemove; self._old_d_mu = document.body.onmouseup; document.body.onmousemove = function(e) { if (self) { self.doColResize(e || window.event, el, startW, x, tabW) } }; document.body.onmouseup = function() { if (self) { self.stopColResize() } } } }; this.stopColResize = function() { document.body.onmousemove = self._old_d_mm || ""; document.body.onmouseup = self._old_d_mu || ""; this.setSizes(); this.doOnScroll(0, 1); this.callEvent("onResizeEnd", [this]) }; this.doColResize = function(ev, el, startW, x, tabW) { el.style.cursor = "E-resize"; this.resized = el; var fcolW = startW + (ev.clientX - x); var wtabW = tabW + (ev.clientX - x); if (!(this.callEvent("onResize", [el._cellIndex, fcolW, this]))) { return } if (_isIE) { this.objBox.scrollLeft = this.hdrBox.scrollLeft } var result = false; if (el.colSpan > 1) { var a_sizes = new Array(); for (var i = 0; i < el.colSpan; i++) { a_sizes[i] = Math.round(fcolW * this.hdr.rows[0].childNodes[el._cellIndexS + i].offsetWidth / el.offsetWidth) } for (var i = 0; i < el.colSpan; i++) { result = this._setColumnSizeR(el._cellIndexS + i * 1, a_sizes[i]) } } else { result = this._setColumnSizeR(el._cellIndex, fcolW) } this.doOnScroll(0, 1); this.setSizes(); if (this._fake && this._awdth) { this._fake._correctSplit() } return result }; this._setColumnSizeR = function(ind, fcolW) { if (fcolW > ((this._drsclmW && !this._notresize) ? (this._drsclmW[ind] || 10) : 10)) { this.obj.rows[0].childNodes[ind].style.width = fcolW + "px"; this.hdr.rows[0].childNodes[ind].style.width = fcolW + "px"; if (this.ftr) { this.ftr.rows[0].childNodes[ind].style.width = fcolW + "px" } if (this.cellWidthType == "px") { this.cellWidthPX[ind] = fcolW } else { var gridWidth = parseInt(this.entBox.offsetWidth); if (this.objBox.scrollHeight > this.objBox.offsetHeight) { gridWidth -= 17 } var pcWidth = Math.round(fcolW / gridWidth * 100); this.cellWidthPC[ind] = pcWidth } if (this.sortImg.style.display != "none") { this.setSortImgPos() } } else { return false } }; this.setSortImgState = function(state, ind, order, row) { order = (order || "asc").toLowerCase(); if (!dhx4.s2b(state)) { this.sortImg.style.display = "none"; if (this.r_fldSorted) { this.r_fldSorted.className = "" } 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 (this.ar_fldSorted) { this.ar_fldSorted.className = "" } 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.ar_fldSorted = el; el.className = this.sortImg.className + "_col"; this.sortImg.style.left = Number(pos[0] + wdth - 13) + "px"; this.sortImg.defLeft = parseInt(this.sortImg.style.left); this.sortImg.style.top = Number(pos[1] + 5) + "px"; if ((!this.useImagesInHeader) && (!mode)) { this.sortImg.style.display = "inline" } this.sortImg.style.left = this.sortImg.defLeft + "px" } }; this.setActive = function(fl) { if (arguments.length == 0) { var fl = true } if (fl == true) { if (globalActiveDHTMLGridObject && (globalActiveDHTMLGridObject != this)) { globalActiveDHTMLGridObject.editStop(); globalActiveDHTMLGridObject.callEvent("onBlur", [globalActiveDHTMLGridObject]) } globalActiveDHTMLGridObject = this; this.isActive = true } else { this.isActive = false; this.callEvent("onBlur", [this]) } }; this._doClick = function(ev) { var selMethod = 0; var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD"); if (!el || !el.parentNode || !el.parentNode.idd) { return } var fl = true; if (this.markedCells) { var markMethod = 0; if (ev.shiftKey || ev.metaKey) { markMethod = 1 } if (ev.ctrlKey) { markMethod = 2 } this.doMark(el, markMethod); return true } if (this.selMultiRows != false) { if (ev.shiftKey && this.row != null && this.selectedRows.length) { selMethod = 1 } if (ev.ctrlKey || ev.metaKey) { selMethod = 2 } } return this.doClick(el, fl, selMethod, false) }; this._doContClick = function(ev) { var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD"); if ((!el) || (typeof(el.parentNode.idd) == "undefined")) { this.callEvent("onEmptyClick", [ev]); return true } if (ev.button == 2 || (_isMacOS && ev.ctrlKey)) { if (!this.callEvent("onRightClick", [el.parentNode.idd, el._cellIndex, ev])) { var z = function(e) { (e || event).cancelBubble = true; return false }; (ev.srcElement || ev.target).oncontextmenu = z; return z(ev) } if (this._ctmndx) { if (!(this.callEvent("onBeforeContextMenu", [el.parentNode.idd, el._cellIndex, this]))) { return true } if (_isIE) { ev.srcElement.oncontextmenu = function() { event.cancelBubble = true; return false } } if (this._ctmndx.showContextMenu) { var dEl0 = window.document.documentElement; var dEl1 = window.document.body; var corrector = new Array((dEl0.scrollLeft || dEl1.scrollLeft), (dEl0.scrollTop || dEl1.scrollTop)); if (_isIE) { var x = ev.clientX + corrector[0]; var y = ev.clientY + corrector[1] } else { var x = ev.pageX; var y = ev.pageY } this._ctmndx.showContextMenu(x - 1, y - 1); this.contextID = this._ctmndx.contextMenuZoneId = el.parentNode.idd + "_" + el._cellIndex; this._ctmndx._skip_hide = true } else { el.contextMenuId = el.parentNode.idd + "_" + el._cellIndex; el.contextMenu = this._ctmndx; el.a = this._ctmndx._contextStart; el.a(el, ev); el.a = null } ev.cancelBubble = true; return false } } else { if (this._ctmndx) { if (this._ctmndx.hideContextMenu) { this._ctmndx.hideContextMenu() } else { this._ctmndx._contextEnd() } } } return true }; this.doClick = function(el, fl, selMethod, show) { if (!this.selMultiRows) { selMethod = 0 } var psid = this.row ? this.row.idd : 0; this.setActive(true); if (!selMethod) { selMethod = 0 } if (this.cell != null) { this.cell.className = this.cell.className.replace(/[ \t]*cellselected/g, "") } if (el.tagName == "TD") { if (this.checkEvent("onSelectStateChanged")) { var initial = this.getSelectedId() } var prow = this.row; if (selMethod == 1) { var elRowIndex = this.rowsCol._dhx_find(el.parentNode); var lcRowIndex = this.rowsCol._dhx_find(this.lastClicked); if (elRowIndex > lcRowIndex) { var strt = lcRowIndex; var end = elRowIndex } else { var strt = elRowIndex; var end = lcRowIndex } for (var i = 0; i < this.rowsCol.length; i++) { if ((i >= strt && i <= end)) { if (this.rowsCol[i] && (!this.rowsCol[i]._sRow)) { if (!this.rowsCol[i].idd) { continue } if (this.rowsCol[i].className.indexOf("rowselected") == -1 && (this.callEvent("onBeforeSelect", [this.rowsCol[i].idd, psid, el._cellIndex]))) { this.rowsCol[i].className += " rowselected"; this.selectedRows[this.selectedRows.length] = this.rowsCol[i] } } else { this.clearSelection(); return this.doClick(el, fl, 0, show) } } } } else { if (selMethod == 2) { if (el.parentNode.className.indexOf("rowselected") != -1) { el.parentNode.className = el.parentNode.className.replace(/[ \t]*rowselected/g, ""); this.selectedRows._dhx_removeAt(this.selectedRows._dhx_find(el.parentNode)); var skipRowSelection = true; show = false } } } this.editStop(); if (typeof(el.parentNode.idd) == "undefined") { return true } if ((!skipRowSelection) && (!el.parentNode._sRow)) { if (this.callEvent("onBeforeSelect", [el.parentNode.idd, psid, el._cellIndex])) { if (this.getSelectedRowId() != el.parentNode.idd) { if (selMethod == 0) { this.clearSelection() } this.cell = el; if ((prow == el.parentNode) && (this._chRRS)) { fl = false } this.row = el.parentNode; this.row.className += " rowselected"; if (this.selectedRows._dhx_find(this.row) == -1) { this.selectedRows[this.selectedRows.length] = this.row } } else { this.cell = el; this.row = el.parentNode } } else { fl = false } } if (this.cell && this.cell.parentNode.className.indexOf("rowselected") != -1) { this.cell.className = this.cell.className.replace(/[ \t]*cellselected/g, "") + " cellselected" } if (selMethod != 1) { if (!this.row) { return } } this.lastClicked = el.parentNode; var rid = this.row.idd; var cid = this.cell; if (fl && typeof(rid) != "undefined" && cid && !skipRowSelection) { self.onRowSelectTime = setTimeout(function() { if (self.callEvent) { self.callEvent("onRowSelect", [rid, cid._cellIndex]) } }, 100) } else { this.callEvent("onRowSelectRSOnly", [rid]) } if (this.checkEvent("onSelectStateChanged")) { var afinal = this.getSelectedId(); if (initial != afinal) { this.callEvent("onSelectStateChanged", [afinal, initial]) } } if (skipRowSelection) { return false } } this.isActive = true; if (show !== false && this.cell && this.cell.parentNode.idd) { this.moveToVisible(this.cell) } }; this.selectAll = function() { this.clearSelection(); var coll = this.rowsBuffer; if (this.pagingOn) { coll = this.rowsCol } for (var i = 0; i < coll.length; i++) { this.render_row(i).className += " rowselected" } this.selectedRows = dhtmlxArray([].concat(coll)); if (this.selectedRows.length) { this.row = this.selectedRows[0]; this.cell = this.row.cells[0] } if ((this._fake) && (!this._realfake)) { this._fake.selectAll() } }; this.selectCell = function(r, cInd, fl, preserve, edit, show) { if (!fl) { fl = false } if (typeof(r) != "object") { r = this.render_row(r) } if (!r || r == -1) { return null } if (r._childIndexes) { var c = r.childNodes[r._childIndexes[cInd]] } else { var c = r.childNodes[cInd] } if (!c) { c = r.childNodes[0] } if (!this.markedCells) { if (preserve) { this.doClick(c, fl, 3, show) } else { this.doClick(c, fl, 0, show) } } else { this.doMark(c, preserve ? 2 : 0) } if (edit) { this.editCell() } }; this.moveToVisible = function(cell_obj, onlyVScroll) { if (this.pagingOn) { var newPage = Math.floor(this.getRowIndex(cell_obj.parentNode.idd) / this.rowsBufferOutSize) + 1; if (newPage != this.currentPage) { this.changePage(newPage) } } try { if (cell_obj.offsetHeight) { var distance = cell_obj.offsetLeft + cell_obj.offsetWidth + 20; var scrollLeft = 0; if (distance > (this.objBox.offsetWidth + this.objBox.scrollLeft)) { if (cell_obj.offsetLeft > this.objBox.scrollLeft) { scrollLeft = cell_obj.offsetLeft - (this.objBox.offsetWidth - cell_obj.offsetWidth) + 5 } } else { if (cell_obj.offsetLeft < this.objBox.scrollLeft) { distance -= cell_obj.offsetWidth * 2 / 3; if (distance < this.objBox.scrollLeft) { scrollLeft = cell_obj.offsetLeft - 5 } } } if ((scrollLeft) && (!onlyVScroll)) { this.objBox.scrollLeft = scrollLeft } } if (!cell_obj.offsetHeight) { var mask = this._realfake ? this._fake.rowsAr[cell_obj.parentNode.idd] : cell_obj.parentNode; distance = this.rowsBuffer._dhx_find(mask) * this._srdh } else { distance = cell_obj.offsetTop } var distancemax = distance + cell_obj.offsetHeight + 38; if (distancemax > (this.objBox.offsetHeight + this.objBox.scrollTop)) { var scrollTop = distancemax - this.objBox.offsetHeight } 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; if (g == null) { return } this.editor = null; var z = this.callEvent("onEditCell", [2, this.row.idd, this.cell._cellIndex, g.getValue(), g.getOldValue()]); if ((typeof(z) == "string") || (typeof(z) == "number")) { g[g.setImage ? "setLabel" : "setValue"](z) } else { if (!z) { g[g.setImage ? "setLabel" : "setValue"](g.val) } } if (this._ahgr && this.multiLine) { this.setSizes() } } }; this._nextRowCell = function(row, dir, pos) { row = this._nextRow((this._groups ? this.rowsCol : this.rowsBuffer)._dhx_find(row), dir); if (!row) { return null } return row.childNodes[row._childIndexes ? row._childIndexes[pos] : pos] }; this._getNextCell = function(acell, dir, i) { acell = acell || this.cell; var arow = acell.parentNode; if (this._tabOrder) { i = this._tabOrder[acell._cellIndex]; if (typeof i != "undefined") { if (i < 0) { acell = this._nextRowCell(arow, dir, Math.abs(i) - 1) } else { acell = arow.childNodes[i] } } } else { var i = acell._cellIndex + dir; if (i >= 0 && i < this._cCount) { if (arow._childIndexes) { i = arow._childIndexes[acell._cellIndex] + dir } acell = arow.childNodes[i] } else { acell = this._nextRowCell(arow, dir, (dir == 1 ? 0 : (this._cCount - 1))) } } if (!acell) { if ((dir == 1) && this.tabEnd) { this.tabEnd.focus(); this.tabEnd.focus(); this.setActive(false) } if ((dir == -1) && this.tabStart) { this.tabStart.focus(); this.tabStart.focus(); this.setActive(false) } return null } if (acell.style.display != "none" && (!this.smartTabOrder || !this.cells(acell.parentNode.idd, acell._cellIndex).isDisabled())) { return acell } return this._getNextCell(acell, dir) }; this._nextRow = function(ind, dir) { var r = this.render_row(ind + dir); if (!r || r == -1) { return null } if (r && r.style.display == "none") { return this._nextRow(ind + dir, dir) } return r }; this.scrollPage = function(dir) { if (!this.rowsBuffer.length) { return } var master = this._realfake ? this._fake : this; var new_ind = Math.floor((master._r_select || this.getRowIndex(this.row.idd) || 0) + (dir) * this.objBox.offsetHeight / (this._srdh || 20)); if (new_ind < 0) { new_ind = 0 } if (new_ind >= this.rowsBuffer.length) { new_ind = this.rowsBuffer.length - 1 } if (this._srnd && !this.rowsBuffer[new_ind]) { this.objBox.scrollTop += Math.floor((dir) * this.objBox.offsetHeight / (this._srdh || 20)) * (this._srdh || 20); if (this._fake) { this._fake.objBox.scrollTop = this.objBox.scrollTop } master._r_select = new_ind } else { this.selectCell(new_ind, this.cell._cellIndex, true, false, false, (this.multiLine || this._srnd)); if (!this.multiLine && !this._srnd && !this._realfake) { this.objBox.scrollTop = this.getRowById(this.getRowId(new_ind)).offsetTop; if (this._fake) { this._fake.objBox.scrollTop = this.objBox.scrollTop } } master._r_select = null } }; this.doKey = function(ev) { if (!ev) { return true } if ((ev.target || ev.srcElement).value !== window.undefined) { var zx = (ev.target || ev.srcElement); if (zx.className != "dhxcombo_input" && zx.className != "dhx_tab_ignore" && ((!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, raw) { 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 raw ? z.cells[i].firstChild.innerHTML : (_isIE ? z.cells[i].innerText : z.cells[i].textContent) } } return "" }; this.getColLabel = this.getColumnLabel; this.getFooterLabel = function(cin, ind, raw) { return this.getColumnLabel(cin, ind, this.ftr, raw) }; this.setRowTextBold = function(row_id) { var r = this.getRowById(row_id); if (r) { r.style.fontWeight = "bold" } }; this.setRowTextStyle = function(row_id, styleString) { var r = this.getRowById(row_id); if (!r) { return } for (var i = 0; i < r.childNodes.length; i++) { var pfix = r.childNodes[i]._attrs.style || ""; if ((this._hrrar) && (this._hrrar[i])) { pfix = "display:none;" } if (_isIE) { r.childNodes[i].style.cssText = pfix + "width:" + r.childNodes[i].style.width + ";" + styleString } else { r.childNodes[i].style.cssText = pfix + "width:" + r.childNodes[i].style.width + ";" + styleString } } }; this.setRowColor = function(row_id, color) { var r = this.getRowById(row_id); for (var i = 0; i < r.childNodes.length; i++) { r.childNodes[i].bgColor = color } }; this.setCellTextStyle = function(row_id, ind, styleString) { var r = this.getRowById(row_id); if (!r) { return } var cell = r.childNodes[r._childIndexes ? r._childIndexes[ind] : ind]; if (!cell) { return } var pfix = ""; if ((this._hrrar) && (this._hrrar[ind])) { pfix = "display:none;" } if (_isIE) { cell.style.cssText = pfix + "width:" + cell.style.width + ";" + styleString } else { cell.style.cssText = pfix + "width:" + cell.style.width + ";" + styleString } }; this.setRowTextNormal = function(row_id) { var r = this.getRowById(row_id); if (r) { r.style.fontWeight = "normal" } }; this.doesRowExist = function(row_id) { if (this.getRowById(row_id) != null) { return true } else { return false } }; this.getColumnsNum = function() { return this._cCount }; this.moveRowUp = function(row_id) { var r = this.getRowById(row_id); if (this.isTreeGrid()) { return this.moveRowUDTG(row_id, -1) } var rInd = this.rowsCol._dhx_find(r); if ((r.previousSibling) && (rInd != 0)) { r.parentNode.insertBefore(r, r.previousSibling); this.rowsCol._dhx_swapItems(rInd, rInd - 1); this.setSizes(); var bInd = this.rowsBuffer._dhx_find(r); this.rowsBuffer._dhx_swapItems(bInd, bInd - 1); if (this._cssEven) { this._fixAlterCss(rInd - 1) } } }; this.moveRowDown = function(row_id) { var r = this.getRowById(row_id); if (this.isTreeGrid()) { return this.moveRowUDTG(row_id, 1) } var rInd = this.rowsCol._dhx_find(r); if (r.nextSibling) { this.rowsCol._dhx_swapItems(rInd, rInd + 1); if (r.nextSibling.nextSibling) { r.parentNode.insertBefore(r, r.nextSibling.nextSibling) } else { r.parentNode.appendChild(r) } this.setSizes(); var bInd = this.rowsBuffer._dhx_find(r); this.rowsBuffer._dhx_swapItems(bInd, bInd + 1); if (this._cssEven) { this._fixAlterCss(rInd) } } }; this.getCombo = function(col_ind) { if (!this.combos[col_ind]) { this.combos[col_ind] = new dhtmlXGridComboObject() } return this.combos[col_ind] }; this.setUserData = function(row_id, name, value) { if (!row_id) { row_id = "gridglobaluserdata" } if (!this.UserData[row_id]) { this.UserData[row_id] = new Hashtable() } this.UserData[row_id].put(name, value) }; this.getUserData = function(row_id, name) { if (!row_id) { row_id = "gridglobaluserdata" } this.getRowById(row_id); var z = this.UserData[row_id]; return (z ? z.get(name) : "") }; this.setEditable = function(fl) { this.isEditable = dhx4.s2b(fl) }; this.selectRowById = function(row_id, multiFL, show, call) { if (!call) { call = false } this.selectCell(this.getRowById(row_id), 0, call, multiFL, false, show) }; this.unselectRowById = function(row_id) { for (var i = 0; i < this.selectedRows.length; i++) { if (this.selectedRows[i].idd == row_id) { var r = this.rowsAr[row_id]; if (r) { r.className = r.className.replace(/[ \t]*rowselected/g, "") } if (this.cell && this.cell.parentNode == r) { this.cell.className = this.cell.className.replace(/[ \t]*cellselected/g, ""); this.cell = null } this.selectedRows.splice(i, 1); break } } }; 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(/[ \t]*rowselected/g, "") } } this.selectedRows = dhtmlxArray(); this.row = null; if (this.cell != null) { this.cell.className = this.cell.className.replace(/[ \t]*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[c]) { z.cells[col].style.cssText = this._hstyles[c] } } else { z.cells[col].style.textAlign = "left"; z.cells[col].innerHTML = ""; var a = new Image(); a.src = "" + label.replace(/(\.[a-z]+)/, ".des$1"); this.preloadImagesAr[this.preloadImagesAr.length] = a; var b = new Image(); b.src = "" + label.replace(/(\.[a-z]+)/, ".asc$1"); this.preloadImagesAr[this.preloadImagesAr.length] = b } if ((label || "").indexOf("#") != -1) { var t = label.match(/(^|{)#([^}]+)(}|$)/); if (t) { var tn = "_in_header_" + t[2]; if (this[tn]) { this[tn]((this.forceDivInHeader ? z.cells[col].firstChild : z.cells[col]), col, label.split(t[0])) } } } }; this.setColLabel = function(a, b, ind, c) { return this.setColumnLabel(a, b, (ind || 0) + 1, c) }; this.clearAll = function(header) { if (!this.obj.rows[0]) { return } if (this._h2) { this._h2 = this._createHierarchy(); if (this._fake) { if (this._realfake) { this._h2 = this._fake._h2 } else { this._fake._h2 = this._h2 } } } this.limit = this._limitC = 0; this.editStop(true); if (this._dLoadTimer) { window.clearTimeout(this._dLoadTimer) } if (this._dload) { this.objBox.scrollTop = 0; this.limit = this._limitC || 0; this._initDrF = true } var len = this.rowsCol.length; len = this.obj.rows.length; for (var i = len - 1; i > 0; i--) { var t_r = this.obj.rows[i]; t_r.parentNode.removeChild(t_r) } if (header) { this._master_row = null; this.obj.rows[0].parentNode.removeChild(this.obj.rows[0]); for (var i = this.hdr.rows.length - 1; i >= 0; i--) { var t_r = this.hdr.rows[i]; t_r.parentNode.removeChild(t_r) } if (this.ftr) { this.ftr.parentNode.removeChild(this.ftr); this.ftr = null } this._aHead = this.ftr = this.cellWidth = this._aFoot = null; this.cellType = dhtmlxArray(); this._hrrar = []; this.columnIds = []; this.combos = []; this._strangeParams = []; this.defVal = []; this._ivizcol = null } this.row = null; this.cell = null; this.rowsCol = dhtmlxArray(); this.rowsAr = {}; this._RaSeCol = []; this.rowsBuffer = dhtmlxArray(); this.UserData = []; this.selectedRows = dhtmlxArray(); if (this.pagingOn || this._srnd) { this.xmlFileUrl = "" } if (this.pagingOn) { this.changePage(1) } if (this._contextCallTimer) { window.clearTimeout(this._contextCallTimer) } if (this._sst) { this.enableStableSorting(true) } this._fillers = this.undefined; this.setSortImgState(false); this.setSizes(); this.callEvent("onClearAll", []) }; this.sortField = function(ind, repeatFl, r_el) { if (this.getRowsNum() == 0) { return false } var el = this.hdr.rows[0].cells[ind]; if (!el) { return } if (el.tagName == "TH" && (this.fldSort.length - 1) >= el._cellIndex && this.fldSort[el._cellIndex] != "na") { var data = this.getSortingState(); var sortType = (data[0] == ind && data[1] == "asc") ? "des" : "asc"; if (!this.callEvent("onBeforeSorting", [ind, this.fldSort[ind], sortType])) { return } this.sortImg.className = "dhxgrid_sort_" + (sortType == "asc" ? "asc" : "desc"); if (this.useImagesInHeader) { var cel = this.hdr.rows[1].cells[el._cellIndex].firstChild; if (this.fldSorted != null) { var celT = this.hdr.rows[1].cells[this.fldSorted._cellIndex].firstChild; celT.src = celT.src.replace(/(\.asc\.)|(\.des\.)/, ".") } cel.src = cel.src.replace(/(\.[a-z]+)$/, "." + sortType + "$1") } this.sortRows(el._cellIndex, this.fldSort[el._cellIndex], sortType); this.fldSorted = el; if (r_el && r_el.tagName.toLowerCase() != "th") { this.r_fldSorted = r_el } var c = this.hdr.rows[1]; var c = r_el.parentNode; var real_el = c._childIndexes ? c._childIndexes[el._cellIndex] : el._cellIndex; this.setSortImgPos(false, false, false, r_el) } }; this.setCustomSorting = function(func, col) { if (!this._customSorts) { this._customSorts = new Array() } this._customSorts[col] = (typeof(func) == "string") ? eval(func) : func; this.fldSort[col] = "cus" }; this.enableHeaderImages = function(fl) { this.useImagesInHeader = fl }; this.setHeader = function(hdrStr, splitSign, styles) { if (typeof(hdrStr) != "object") { var arLab = this._eSplit(hdrStr) } else { arLab = [].concat(hdrStr) } var arWdth = new Array(0); var arTyp = new dhtmlxArray(0); var arAlg = new Array(0); var arVAlg = new Array(0); var arSrt = new Array(0); for (var i = 0; i < arLab.length; i++) { arWdth[arWdth.length] = Math.round(100 / arLab.length); arTyp[arTyp.length] = "ed"; arAlg[arAlg.length] = "left"; arVAlg[arVAlg.length] = "middle"; arSrt[arSrt.length] = "na" } this.splitSign = splitSign || "#cspan"; this.hdrLabels = arLab; this.cellWidth = arWdth; if (!this.initCellWidth.length) { this.setInitWidthsP(arWdth.join(this.delim), true) } this.cellType = arTyp; this.cellAlign = arAlg; this.cellVAlign = arVAlg; this.fldSort = arSrt; this._hstyles = styles || [] }; this._eSplit = function(str) { if (![].push) { return str.split(this.delim) } var a = "r" + (new Date()).valueOf(); var z = this.delim.replace(/([\|\+\*\^])/g, "\\$1"); return (str || "").replace(RegExp(z, "g"), a).replace(RegExp("\\\\" + a, "g"), this.delim).split(a) }; this.getColType = function(cInd) { return this.cellType[cInd] }; this.getColTypeById = function(cID) { return this.cellType[this.getColIndexById(cID)] }; this.setColTypes = function(typeStr) { this.cellType = dhtmlxArray(typeStr.split(this.delim)); this._strangeParams = new Array(); for (var i = 0; i < this.cellType.length; i++) { if ((this.cellType[i].indexOf("[") != -1)) { var z = this.cellType[i].split(/[\[\]]+/g); this.cellType[i] = z[0]; this.defVal[i] = z[1]; if (z[1].indexOf("=") == 0) { this.cellType[i] = "math"; this._strangeParams[i] = z[0] } } if (!window["eXcell_" + this.cellType[i]]) { dhx4.callEvent("onConfigurationError", ["Incorrect cell type: " + this.cellType[i], this, this.cellType[i]]) } } }; this.setColSorting = function(sortStr) { this.fldSort = sortStr.split(this.delim); var check = { str: 1, "int": 1, date: 1 }; for (var i = 0; i < this.fldSort.length; i++) { if ((!check[this.fldSort[i]]) && (typeof(window[this.fldSort[i]]) == "function")) { if (!this._customSorts) { this._customSorts = new Array() } this._customSorts[i] = window[this.fldSort[i]]; this.fldSort[i] = "cus" } } }; this.setColAlign = function(alStr) { this.cellAlign = alStr.split(this.delim); for (var i = 0; i < this.cellAlign.length; i++) { this.cellAlign[i] = this.cellAlign[i]._dhx_trim() } }; this.setColVAlign = function(valStr) { this.cellVAlign = valStr.split(this.delim) }; this.setNoHeader = function(fl) { this.noHeader = dhx4.s2b(fl) }; this.showRow = function(rowID) { this.getRowById(rowID); if (this._h2) { this.openItem(this._h2.get[rowID].parent.id) } var c = this.getRowById(rowID).childNodes[0]; while (c && c.style.display == "none") { c = c.nextSibling } if (c) { this.moveToVisible(c, true) } }; this.setStyle = function(ss_header, ss_grid, ss_selCell, ss_selRow) { this.ssModifier = [ss_header, ss_grid, ss_selCell, ss_selCell, ss_selRow]; var prefs = ["#" + this.entBox.id + " table.hdr td", "#" + this.entBox.id + " table.obj td", "#" + this.entBox.id + " table.obj tr.rowselected td.cellselected", "#" + this.entBox.id + " table.obj td.cellselected", "#" + this.entBox.id + " table.obj tr.rowselected td"]; var index = 0; while (!_isIE) { try { var temp = document.styleSheets[index].cssRules.length } catch (e) { index++; continue } break } for (var i = 0; i < prefs.length; i++) { if (this.ssModifier[i]) { if (_isIE) { document.styleSheets[0].addRule(prefs[i], this.ssModifier[i]) } else { document.styleSheets[index].insertRule(prefs[i] + (" { " + this.ssModifier[i] + " }"), document.styleSheets[index].cssRules.length) } } } }; this.setColumnColor = function(clr) { this.columnColor = clr.split(this.delim) }; this.enableAlterCss = function(cssE, cssU, perLevel, levelUnique) { if (cssE || cssU) { this.attachEvent("onGridReconstructed", function() { this._fixAlterCss(); if (this._fake) { this._fake._fixAlterCss() } }) } this._cssSP = perLevel; this._cssSU = levelUnique; this._cssEven = cssE; this._cssUnEven = cssU }; this._fixAlterCss = function(ind) { if (this._h2 && (this._cssSP || this._cssSU)) { return this._fixAlterCssTGR(ind) } if (!this._cssEven && !this._cssUnEven) { return } ind = ind || 0; var j = ind; for (var i = ind; i < this.rowsCol.length; i++) { if (!this.rowsCol[i]) { continue } if (this.rowsCol[i].style.display != "none") { if (this.rowsCol[i]._cntr) { j = 1; continue } if (this.rowsCol[i].className.indexOf("rowselected") != -1) { if (j % 2 == 1) { this.rowsCol[i].className = this._cssUnEven + " rowselected " + (this.rowsCol[i]._css || "") } else { this.rowsCol[i].className = this._cssEven + " rowselected " + (this.rowsCol[i]._css || "") } } else { if (j % 2 == 1) { this.rowsCol[i].className = this._cssUnEven + " " + (this.rowsCol[i]._css || "") } else { this.rowsCol[i].className = this._cssEven + " " + (this.rowsCol[i]._css || "") } } j++ } } }; this.clearChangedState = function(clear_added) { 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 } if (clear_added) { row._added = false } } } }; this.getChangedRows = function(and_added) { var res = new Array(); this.forEachRow(function(id) { var row = this.rowsAr[id]; if (row.tagName != "TR") { return } var cols = row.childNodes.length; if (and_added && row._added) { res[res.length] = row.idd } else { for (var j = 0; j < cols; j++) { if (row.childNodes[j].wasChanged) { res[res.length] = row.idd; break } } } }); return res.join(this.delim) }; this._sUDa = false; this._sAll = false; this.setSerializationLevel = function(userData, fullXML, config, changedAttr, onlyChanged, asCDATA) { this._sUDa = userData; this._sAll = fullXML; this._sConfig = config; this._chAttr = changedAttr; this._onlChAttr = onlyChanged; this._asCDATA = asCDATA }; this.setSerializableColumns = function(list) { if (!list) { this._srClmn = null; return } this._srClmn = (list || "").split(","); for (var i = 0; i < this._srClmn.length; i++) { this._srClmn[i] = dhx4.s2b(this._srClmn[i]) } }; this._serialise = function(rCol, inner, closed) { this.editStop(); var out = []; var close = ""; if (this.isTreeGrid()) { this._h2.forEachChildF(0, function(el) { var temp = this._serializeRow(this.render_row_tree(-1, el.id)); out.push(temp); if (temp) { return true } else { return false } }, this, function() { out.push(close) }) } else { for (var i = 0; i < this.rowsBuffer.length; i++) { if (this.rowsBuffer[i]) { if (this._chAttr && this.rowsBuffer[i]._locator) { continue } var temp = this._serializeRow(this.render_row(i)); out.push(temp); if (temp) { out.push(close) } } } } return [out.join("")] }; this._serializeRow = function(r, i) { var out = []; var ra = this.xml.row_attrs; var ca = this.xml.cell_attrs; out.push("<" + this.xml.s_row); out.push(" id='" + r.idd + "'"); if ((this._sAll) && this.selectedRows._dhx_find(r) != -1) { out.push(" selected='1'") } if (this._h2 && this._h2.get[r.idd].state == "minus") { out.push(" open='1'") } if (ra.length) { for (var i = 0; i < ra.length; i++) { out.push(" " + ra[i] + "='" + r._attrs[ra[i]] + "'") } } out.push(">"); if (this._sUDa && this.UserData[r.idd]) { keysAr = this.UserData[r.idd].getKeys(); for (var ii = 0; ii < keysAr.length; ii++) { var subkey = keysAr[ii]; if (subkey.indexOf("__") !== 0) { out.push("" + (this._asCDATA ? "" : "") + "") } } } var changeFl = false; for (var jj = 0; jj < this._cCount; jj++) { if ((!this._srClmn) || (this._srClmn[jj])) { var zx = this.cells3(r, jj); out.push("" } if ((this._ecspn) && (zx.cell.colSpan) && zx.cell.colSpan > 1) { out.push(' colspan="' + zx.cell.colSpan + '" ') } if (this._chAttr) { if (zx.wasChanged()) { out.push(' changed="1"'); changeFl = true } } else { if ((this._onlChAttr) && (zx.wasChanged())) { changeFl = true } } if (this._sAll && this.cellType[jj] == "tree") { out.push((this._h2 ? (" image='" + this._h2.get[r.idd].image + "'") : "") + ">" + zxVal + "") } else { out.push(">" + zxVal + "") } if ((this._ecspn) && (zx.cell.colSpan)) { for (var u = 0; u < zx.cell.colSpan - 1; u++) { out.push(""); jj++ } } } } if ((this._onlChAttr) && (!changeFl) && (!r._added)) { return "" } return out.join("") }; this._serialiseConfig = function() { var out = ""; for (var i = 0; i < this.hdr.rows[0].cells.length; i++) { if (this._srClmn && !this._srClmn[i]) { continue } var sort = this.fldSort[i]; if (sort == "cus") { sort = this._customSorts[i].toString(); sort = sort.replace(/function[\ ]*/, "").replace(/\([^\f]*/, "") } out += ""; if (this._asCDATA) { out += "" } else { out += this.getColumnLabel(i) } var z = this.getCombo(i); if (z) { for (var j = 0; j < z.keys.length; j++) { out += "" } } out += "" } return out += "" }; this.serialize = function() { var out = ''; if (this._mathSerialization) { this._agetm = "getMathValue" } else { this._agetm = "getValue" } if (this._sUDa && this.UserData.gridglobaluserdata) { var keysAr = this.UserData.gridglobaluserdata.getKeys(); for (var i = 0; i < keysAr.length; i++) { out += "" + this.UserData.gridglobaluserdata.get(keysAr[i]) + "" } } if (this._sConfig) { out += this._serialiseConfig() } out += this._serialise(); out += ""; return out }; this.getPosition = function(oNode, pNode) { if (!pNode) { var pos = dhx4.getOffset(oNode); return [pos.left, pos.top] } pNode = pNode || document.body; var oCurrentNode = oNode; var iLeft = 0; var iTop = 0; while ((oCurrentNode) && (oCurrentNode != pNode)) { iLeft += oCurrentNode.offsetLeft - oCurrentNode.scrollLeft; iTop += oCurrentNode.offsetTop - oCurrentNode.scrollTop; oCurrentNode = oCurrentNode.offsetParent } if (pNode == document.body) { if (_isIE) { iTop += document.body.offsetTop || document.documentElement.offsetTop; iLeft += document.body.offsetLeft || document.documentElement.offsetLeft } else { if (!_isFF) { iLeft += document.body.offsetLeft; iTop += document.body.offsetTop } } } return [iLeft, iTop] }; this.getFirstParentOfType = function(obj, tag) { while (obj && obj.tagName != tag && obj.tagName != "BODY") { obj = obj.parentNode } return obj }; this.objBox.onscroll = function() { this.grid._doOnScroll() }; this.hdrBox.onscroll = function() { if (this._try_header_sync) { return } this._try_header_sync = true; if (Math.abs(this.grid.objBox.scrollLeft - this.scrollLeft) > 1) { this.grid.objBox.scrollLeft = this.scrollLeft } this._try_header_sync = false }; if ((!_isOpera) || (_OperaRv > 8.5)) { this.hdr.onmousemove = function(e) { this.grid.changeCursorState(e || window.event) }; this.hdr.onmousedown = function(e) { return this.grid.startColResize(e || window.event) } } this.obj.onmousemove = this._drawTooltip; this.objBox.onclick = function(e) { e = e || event; e.cancelBubble = true; this.firstChild.grid.setActive(true); window.dhx4.callEvent("_onGridClick", [e, this.firstChild.grid]) }; this.obj.onclick = function(e) { if (this.grid._doClick(e || window.event) !== false) { if (this.grid._sclE) { this.grid.editCell(e || window.event) } else { this.grid.editStop() } } e = e || event; e.cancelBubble = true; window.dhx4.callEvent("_onGridClick", [e, this.grid]) }; if (_isMacOS) { this.entBox.oncontextmenu = function(e) { e.cancelBubble = true; if (e.preventDefault) { e.preventDefault() } else { e.returnValue = false } var that = this.grid; if (that._realfake) { that = that._fake } return that._doContClick(e || window.event) } } else { this.entBox.onmousedown = function(e) { return this.grid._doContClick(e || window.event) }; this.entBox.oncontextmenu = function(e) { if (this.grid._ctmndx) { (e || event).cancelBubble = true } return !this.grid._ctmndx } } this.obj.ondblclick = function(e) { if (!this.grid.wasDblClicked(e || window.event)) { return false } if (this.grid._dclE) { var row = this.grid.getFirstParentOfType((_isIE ? event.srcElement : e.target), "TR"); if (row == this.grid.row) { this.grid.editCell(e || window.event) } }(e || event).cancelBubble = true; if (_isOpera) { return false } }; this.hdr.onclick = this._onHeaderClick; this.sortImg.onclick = function() { self._onHeaderClick.apply({ grid: self }, [null, self.r_fldSorted]) }; this.hdr.ondblclick = this._onHeaderDblClick; if (!document.body._dhtmlxgrid_onkeydown) { dhtmlxEvent(document, "keydown", function(e) { if (globalActiveDHTMLGridObject) { return globalActiveDHTMLGridObject.doKey(e || window.event) } }); document.body._dhtmlxgrid_onkeydown = true } dhtmlxEvent(document.body, "click", function() { if (self.editStop) { self.editStop() } if (self.isActive) { self.setActive(false) } }); if (this.entBox.style.height.toString().indexOf("%") != -1) { this._delta_y = this.entBox.style.height } if (this.entBox.style.width.toString().indexOf("%") != -1) { this._delta_x = this.entBox.style.width } if (this._delta_x || this._delta_y) { this._setAutoResize() } this.setColHidden = this.setColumnsVisibility; this.enableCollSpan = this.enableColSpan; this.setMultiselect = this.enableMultiselect; this.setMultiLine = this.enableMultiline; this.deleteSelectedItem = this.deleteSelectedRows; this.getSelectedId = this.getSelectedRowId; this.getHeaderCol = this.getColumnLabel; this.isItemExists = this.doesRowExist; this.getColumnCount = this.getColumnsNum; this.setSelectedRow = this.selectRowById; this.setHeaderCol = this.setColumnLabel; this.preventIECashing = this.preventIECaching; this.enableAutoHeigth = this.enableAutoHeight; this.getUID = this.uid; if (dhtmlx.image_path) { this.setImagePath(dhtmlx.image_path) } if (dhtmlx.skin) { this.setSkin(dhtmlx.skin) } return this } dhtmlXGridObject.prototype = { getRowAttribute: function(c, a) { return this.getRowById(c)._attrs[a] }, setRowAttribute: function(e, a, c) { this.getRowById(e)._attrs[a] = c }, isTreeGrid: function() { return (this.cellType._dhx_find("tree") != -1) }, setRowHidden: function(l, e) { var c = dhx4.s2b(e); var h = this.getRowById(l); if (!h) { return } if (h.expand === "") { this.collapseKids(h) } if ((e) && (h.style.display != "none")) { h.style.display = "none"; var g = this.selectedRows._dhx_find(h); if (g != -1) { h.className = h.className.replace("rowselected", ""); for (var a = 0; a < h.childNodes.length; a++) { h.childNodes[a].className = h.childNodes[a].className.replace(/cellselected/g, "") } this.selectedRows._dhx_removeAt(g) } this.callEvent("onGridReconstructed", []) } if ((!e) && (h.style.display == "none")) { h.style.display = ""; this.callEvent("onGridReconstructed", []) } this.callEvent("onRowHide", [l, e]); this.setSizes() }, setColumnHidden: function(e, c) { if (!this.hdr.rows.length) { if (!this._ivizcol) { this._ivizcol = [] } return this._ivizcol[e] = c } if ((this.fldSorted) && (this.fldSorted.cellIndex == e) && (c)) { this.sortImg.style.display = "none" } var a = dhx4.s2b(c); if (a) { if (!this._hrrar) { this._hrrar = new Array() } else { if (this._hrrar[e]) { return } } this._hrrar[e] = "display:none;"; this._hideShowColumn(e, "none") } else { if ((!this._hrrar) || (!this._hrrar[e])) { return } this._hrrar[e] = ""; this._hideShowColumn(e, "") } if ((this.fldSorted) && (this.fldSorted.cellIndex == e) && (!c)) { this.sortImg.style.display = "inline" } this.setSortImgPos(); this.callEvent("onColumnHidden", [e, c]) }, isColumnHidden: function(a) { if ((this._hrrar) && (this._hrrar[a])) { return true } return false }, setColumnsVisibility: function(c) { if (c) { this._ivizcol = c.split(this.delim) } if (this.hdr.rows.length && this._ivizcol) { for (var a = 0; a < this._ivizcol.length; a++) { this.setColumnHidden(a, this._ivizcol[a]) } } }, _fixHiddenRowsAll: function(n, e, a, c, l) { l = l || "_cellIndex"; var m = n.rows.length; for (var h = 0; h < m; h++) { var o = n.rows[h].childNodes; if (o.length != this._cCount) { for (var g = 0; g < o.length; g++) { if (o[g][l] == e) { o[g].style[a] = c; break } } } else { o[e].style[a] = c } } }, _hideShowColumn: function(h, g) { var a = h; if (this.hdr.rows[1] && (this.hdr.rows[1]._childIndexes) && (this.hdr.rows[1]._childIndexes[h] != h)) { a = this.hdr.rows[1]._childIndexes[h] } if (g == "none") { this.hdr.rows[0].cells[h]._oldWidth = this.hdr.rows[0].cells[h].style.width || (this.initCellWidth[h] + "px"); this.hdr.rows[0].cells[h]._oldWidthP = this.cellWidthPC[h]; this.obj.rows[0].cells[h].style.width = "0px"; var c = { rows: [this.obj.rows[0]] }; this.forEachRow(function(l) { if (this.rowsAr[l].tagName == "TR") { c.rows.push(this.rowsAr[l]) } }); this._fixHiddenRowsAll(c, h, "display", "none"); if (this.isTreeGrid()) { this._fixHiddenRowsAllTG(h, "none") } if ((_isOpera && _OperaRv < 9) || _isKHTML || (_isFF) || (_isIE && (dhx.isIE10 || dhx.isIE11))) { this._fixHiddenRowsAll(this.hdr, h, "display", "none", "_cellIndexS") } if (this.ftr) { this._fixHiddenRowsAll(this.ftr.childNodes[0], h, "display", "none") } this._fixHiddenRowsAll(this.hdr, h, "whiteSpace", "nowrap", "_cellIndexS"); if (!this.cellWidthPX.length && !this.cellWidthPC.length) { this.cellWidthPX = [].concat(this.initCellWidth) } if (this.cellWidthPX[h]) { this.cellWidthPX[h] = 0 } if (this.cellWidthPC[h]) { this.cellWidthPC[h] = 0 } } else { if (this.hdr.rows[0].cells[h]._oldWidth) { var e = this.hdr.rows[0].cells[h]; if (_isOpera || _isKHTML || (_isFF) || (_isIE && (dhx.isIE10 || dhx.isIE11))) { this._fixHiddenRowsAll(this.hdr, h, "display", "", "_cellIndexS") } if (this.ftr) { this._fixHiddenRowsAll(this.ftr.childNodes[0], h, "display", "") } var c = { rows: [this.obj.rows[0]] }; this.forEachRow(function(l) { if (this.rowsAr[l].tagName == "TR") { c.rows.push(this.rowsAr[l]) } }); this._fixHiddenRowsAll(c, h, "display", ""); if (this.isTreeGrid()) { this._fixHiddenRowsAllTG(h, "") } this._fixHiddenRowsAll(this.hdr, h, "whiteSpace", "normal", "_cellIndexS"); if (e._oldWidthP) { this.cellWidthPC[h] = e._oldWidthP } if (e._oldWidth) { this.cellWidthPX[h] = parseInt(e._oldWidth) } } } if (!g && this._realfake) { this.setColumnSizes(this.entBox.clientWidth) } this.setSizes(); if ((!_isIE) && (!_isFF)) { this.obj.border = 1; this.obj.border = 0 } }, enableColSpan: function(a) { this._ecspn = dhx4.s2b(a) }, enableRowsHover: function(c, a) { this._unsetRowHover(false, true); this._hvrCss = a; if (dhx4.s2b(c)) { if (!this._elmnh) { this.obj._honmousemove = this.obj.onmousemove; this.obj.onmousemove = this._setRowHover; if (_isIE) { this.obj.onmouseleave = this._unsetRowHover } else { this.obj.onmouseout = this._unsetRowHover } this._elmnh = true } } else { if (this._elmnh) { this.obj.onmousemove = this.obj._honmousemove; if (_isIE) { this.obj.onmouseleave = null } else { this.obj.onmouseout = null } this._elmnh = false } } }, enableEditEvents: function(c, e, a) { this._sclE = dhx4.s2b(c); this._dclE = dhx4.s2b(e); this._f2kE = dhx4.s2b(a) }, enableLightMouseNavigation: function(a) { if (dhx4.s2b(a)) { if (!this._elmn) { this.entBox._onclick = this.entBox.onclick; this.entBox.onclick = function() { return true }; this.obj._onclick = this.obj.onclick; this.obj.onclick = function(g) { var h = this.grid.getFirstParentOfType(g ? g.target : event.srcElement, "TD"); if (!h) { return } this.grid.editStop(); this.grid.doClick(h); this.grid.editCell(); (g || event).cancelBubble = true }; this.obj._onmousemove = this.obj.onmousemove; this.obj.onmousemove = this._autoMoveSelect; this._elmn = true } } else { if (this._elmn) { this.entBox.onclick = this.entBox._onclick; this.obj.onclick = this.obj._onclick; this.obj.onmousemove = this.obj._onmousemove; this._elmn = false } } }, _unsetRowHover: function(g, h) { if (h) { that = this } else { that = this.grid } if ((that._lahRw) && (that._lahRw != h)) { for (var a = 0; a < that._lahRw.childNodes.length; a++) { that._lahRw.childNodes[a].className = that._lahRw.childNodes[a].className.replace(that._hvrCss, "") } that._lahRw = null } }, _setRowHover: function(g) { var h = this.grid.getFirstParentOfType(g ? g.target : event.srcElement, "TD"); if (h && h.parentNode != this.grid._lahRw) { this.grid._unsetRowHover(0, h); h = h.parentNode; if (!h.idd || h.idd == "__filler__") { return } for (var a = 0; a < h.childNodes.length; a++) { h.childNodes[a].className += " " + this.grid._hvrCss } this.grid._lahRw = h } this._honmousemove(g) }, _autoMoveSelect: function(a) { if (!this.grid.editor) { var g = this.grid.getFirstParentOfType(a ? a.target : event.srcElement, "TD"); if (g.parentNode.idd) { this.grid.doClick(g, true, 0) } } this._onmousemove(a) }, enableDistributedParsing: function(e, a, c) { if (dhx4.s2b(e)) { this._ads_count = a || 10; this._ads_time = c || 250 } else { this._ads_count = 0 } }, destructor: function() { this.editStop(true); if (this._sizeTime) { this._sizeTime = window.clearTimeout(this._sizeTime) } this.entBox.className = (this.entBox.className || "").replace(/gridbox.*/, ""); if (this.formInputs) { for (var e = 0; e < this.formInputs.length; e++) { this.parentForm.removeChild(this.formInputs[e]) } } var c; for (var e = 0; e < this.rowsCol.length; e++) { if (this.rowsCol[e]) { this.rowsCol[e].grid = null } } for (e in this.rowsAr) { if (this.rowsAr[e]) { this.rowsAr[e] = null } } this.rowsCol = new dhtmlxArray(); this.rowsAr = {}; this.entBox.innerHTML = ""; var g = function() {}; this.entBox.onclick = this.entBox.onmousedown = this.entBox.onbeforeactivate = this.entBox.onbeforedeactivate = this.entBox.onbeforedeactivate = this.entBox.onselectstart = g; this.setSizes = this._update_srnd_view = this.callEvent = g; this.entBox.grid = this.objBox.grid = this.hdrBox.grid = this.obj.grid = this.hdr.grid = null; if (this._fake) { this.globalBox.innerHTML = ""; this._fake.setSizes = this._fake._update_srnd_view = this._fake.callEvent = g; this.globalBox.onclick = this.globalBox.onmousedown = this.globalBox.onbeforeactivate = this.globalBox.onbeforedeactivate = this.globalBox.onbeforedeactivate = this.globalBox.onselectstart = g } for (c in this) { if ((this[c]) && (this[c].m_obj)) { this[c].m_obj = null } this[c] = null } if (this == globalActiveDHTMLGridObject) { globalActiveDHTMLGridObject = null } return null }, getSortingState: function() { var a = new Array(); if (this.fldSorted) { a[0] = this.fldSorted._cellIndex; a[1] = (this.sortImg.className == "dhxgrid_sort_desc" ? "des" : "asc") } return a }, enableAutoHeight: function(e, c, a) { this._ahgr = dhx4.s2b(e); this._ahgrF = dhx4.s2b(a); this._ahgrM = c || null; if (arguments.length == 1) { this.objBox.style.overflowY = e ? "hidden" : "auto" } if (c == "auto") { this._ahgrM = null; this._ahgrMA = true; this._setAutoResize() } }, enableStableSorting: function(a) { this._sst = dhx4.s2b(a); this.rowsCol.stablesort = function(l) { var h = this.length - 1; for (var g = 0; g < this.length - 1; g++) { for (var e = 0; e < h; e++) { if (l(this[e], this[e + 1]) > 0) { var c = this[e]; this[e] = this[e + 1]; this[e + 1] = c } } h-- } } }, enableKeyboardSupport: function(a) { this._htkebl = !dhx4.s2b(a) }, enableContextMenu: function(a) { this._ctmndx = a }, setScrollbarWidthCorrection: function(a) {}, enableTooltips: function(c) { this._enbTts = c.split(","); for (var a = 0; a < this._enbTts.length; a++) { this._enbTts[a] = dhx4.s2b(this._enbTts[a]) } }, enableResizing: function(c) { this._drsclmn = c.split(","); for (var a = 0; a < this._drsclmn.length; a++) { this._drsclmn[a] = dhx4.s2b(this._drsclmn[a]) } }, setColumnMinWidth: function(a, c) { if (arguments.length == 2) { if (!this._drsclmW) { this._drsclmW = new Array() } this._drsclmW[c] = a } else { this._drsclmW = a.split(",") } }, enableCellIds: function(a) { this._enbCid = dhx4.s2b(a) }, lockRow: function(a, e) { var c = this.getRowById(a); if (c) { c._locked = dhx4.s2b(e); if ((this.cell) && (this.cell.parentNode.idd == a)) { this.editStop() } } }, _getRowArray: function(h) { var g = new Array(); for (var e = 0; e < h.childNodes.length; e++) { var c = this.cells3(h, e); g[e] = c.getValue() } return g }, setDateFormat: function(c, a) { this._dtmask = c; this._dtmask_inc = a }, setNumberFormat: function(n, e, h, m) { var g = n.replace(/[^0\,\.]*/g, ""); var a = g.indexOf("."); if (a > -1) { a = g.length - a - 1 } var c = g.indexOf(","); if (c > -1) { c = g.length - a - 2 - c } if (typeof h != "string") { h = this.i18n.decimal_separator } if (typeof m != "string") { m = this.i18n.group_separator } var o = n.split(g)[0]; var l = n.split(g)[1]; this._maskArr[e] = [a, c, o, l, h, m] }, _aplNFb: function(h, g) { var c = this._maskArr[g]; if (!c) { return h } var e = parseFloat(h.toString().replace(/[^0-9]*/g, "")); if (h.toString().substr(0, 1) == "-") { e = e * -1 } if (c[0] > 0) { e = e / Math.pow(10, c[0]) } return e }, _aplNF: function(l, h) { var e = this._maskArr[h]; if (!e) { return l } var m = (parseFloat(l) < 0 ? "-" : "") + e[2]; l = Math.abs(Math.round(parseFloat(l) * Math.pow(10, e[0] > 0 ? e[0] : 0))).toString(); l = (l.length < e[0] ? Math.pow(10, e[0] + 1 - l.length).toString().substr(1, e[0] + 1) + l.toString() : l).split("").reverse(); l[e[0]] = (l[e[0]] || "0") + e[4]; if (e[1] > 0) { for (var g = (e[0] > 0 ? 0 : 1) + e[0] + e[1]; g < l.length; g += e[1]) { l[g] += e[5] } } return m + l.reverse().join("") + e[3] }, _launchCommands: function(a) { for (var g = 0; g < a.length; g++) { var e = new Array(); for (var c = 0; c < a[g].childNodes.length; c++) { if (a[g].childNodes[c].nodeType == 1) { e[e.length] = a[g].childNodes[c].firstChild.data } } this[a[g].getAttribute("command")].apply(this, e) } }, _parseHead: function(h) { var g = dhx4.ajax.xpath("./head", h); if (g.length) { var l = dhx4.ajax.xpath("./column", g[0]); var m = dhx4.ajax.xpath("./settings", g[0]); var A = "setInitWidths"; var v = false; if (m[0]) { for (var n = 0; n < m[0].childNodes.length; n++) { switch (m[0].childNodes[n].tagName) { case "colwidth": if (m[0].childNodes[n].firstChild && m[0].childNodes[n].firstChild.data == "%") { A = "setInitWidthsP" } break; case "splitat": v = (m[0].childNodes[n].firstChild ? m[0].childNodes[n].firstChild.data : false); break } } } this._launchCommands(dhx4.ajax.xpath("./beforeInit/call", g[0])); if (l.length > 0) { if (this.hdr.rows.length > 0) { this.clearAll(true) } var a = [ [], [], [], [], [], [], [], [], [] ]; var u = ["", "width", "type", "align", "sort", "color", "format", "hidden", "id"]; var r = ["", A, "setColTypes", "setColAlign", "setColSorting", "setColumnColor", "", "", "setColumnIds"]; for (var y = 0; y < l.length; y++) { for (var x = 1; x < u.length; x++) { a[x].push(l[y].getAttribute(u[x])) } a[0].push((l[y].firstChild ? l[y].firstChild.data : "").replace(/^\s*((\s\S)*.+)\s*$/gi, "$1")) } this.setHeader(a[0]); for (var y = 0; y < r.length; y++) { if (r[y]) { this[r[y]](a[y].join(this.delim)) } } for (var y = 0; y < l.length; y++) { if ((this.cellType[y].indexOf("co") == 0) || (this.cellType[y] == "clist")) { var o = dhx4.ajax.xpath("./option", l[y]); if (o.length) { var w = new Array(); if (this.cellType[y] == "clist") { for (var x = 0; x < o.length; x++) { w[w.length] = o[x].firstChild ? o[x].firstChild.data : "" } this.registerCList(y, w) } else { var C = this.getCombo(y); for (var x = 0; x < o.length; x++) { C.put(o[x].getAttribute("value"), o[x].firstChild ? o[x].firstChild.data : "") } } } } else { if (a[6][y]) { if ((this.cellType[y].toLowerCase().indexOf("calendar") != -1) || (this.fldSort[y] == "date")) { this.setDateFormat(a[6][y]) } else { this.setNumberFormat(a[6][y], y) } } } } this.init(); var e = a[7].join(this.delim); if (this.setColHidden && e.replace(/,/g, "") != "") { this.setColHidden(e) } if ((v) && (this.splitAt)) { this.splitAt(v) } } this._launchCommands(dhx4.ajax.xpath("./afterInit/call", g[0])) } var c = dhx4.ajax.xpath("//rows/userdata", h); if (c.length > 0) { if (!this.UserData.gridglobaluserdata) { this.UserData.gridglobaluserdata = new Hashtable() } for (var x = 0; x < c.length; x++) { var D = ""; for (var q = 0; q < c[x].childNodes.length; q++) { D += c[x].childNodes[q].nodeValue } this.UserData.gridglobaluserdata.put(c[x].getAttribute("name"), D) } } }, getCheckedRows: function(a) { var c = new Array(); this.forEachRowA(function(g) { var e = this.cells(g, a); if (e.changeState && e.getValue() != 0) { c.push(g) } }, true); return c.join(",") }, checkAll: function() { var c = arguments.length ? arguments[0] : 1; for (var a = 0; a < this.getColumnsNum(); a++) { if (this.getColType(a) == "ch") { this.setCheckedRows(a, c) } } }, uncheckAll: function() { this.checkAll(0) }, setCheckedRows: function(c, a) { this.forEachRowA(function(e) { if (this.cells(e, c).isCheckbox()) { this.cells(e, c).setValue(a) } }) }, _drawTooltip: function(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(e) { var a = []; for (var c = 0; c < this.rowsBuffer.length; c++) { if (this.rowsBuffer[c]) { a.push(this.rowsBuffer[c].idd) } } return a.join(e || this.delim) }, getAllItemIds: function() { return this.getAllRowIds() }, setColspan: function(e, w, g) { if (!this._ecspn) { return } var a = this.getRowById(e); if ((a._childIndexes) && (a.childNodes[a._childIndexes[w]])) { var o = a._childIndexes[w]; var h = a.childNodes[o]; var l = h.colSpan; h.colSpan = 1; if ((l) && (l != 1)) { for (var s = 1; s < l; s++) { var v = document.createElement("TD"); if (h.nextSibling) { a.insertBefore(v, h.nextSibling) } else { a.appendChild(v) } a._childIndexes[w + s] = o + s; v._cellIndex = w + s; v.style.textAlign = this.cellAlign[s]; v.style.verticalAlign = this.cellVAlign[s]; h = v; this.cells3(a, w + s).setValue("") } } for (var u = w * 1 + 1 * l; u < a._childIndexes.length; u++) { a._childIndexes[u] += (l - 1) * 1 } } if ((g) && (g > 1)) { if (a._childIndexes) { var o = a._childIndexes[w] } else { var o = w; a._childIndexes = new Array(); for (var u = 0; u < a.childNodes.length; u++) { a._childIndexes[u] = u } } a.childNodes[o].colSpan = g; for (var u = 1; u < g; u++) { a._childIndexes[a.childNodes[o + 1]._cellIndex] = o; a.removeChild(a.childNodes[o + 1]) } var q = a.childNodes[a._childIndexes[w]]._cellIndex; for (var u = q * 1 + 1 * g; u < a._childIndexes.length; u++) { a._childIndexes[u] -= (g - 1) } } }, preventIECaching: function(a) { dhx4.ajax.cache = !a }, enableColumnAutoSize: function(a) { this._eCAS = dhx4.s2b(a) }, _onHeaderDblClick: function(g) { var c = this.grid; var a = c.getFirstParentOfType(_isIE ? event.srcElement : g.target, "TD"); if (!c._eCAS) { return false } c.adjustColumnSize(a._cellIndexS) }, adjustColumnSize: function(q, e) { 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 u = this.hdr.rows[n]; u = u.childNodes[(u._childIndexes) ? u._childIndexes[q] : q]; if ((u) && ((!u.colSpan) || (u.colSpan < 2)) && u._cellIndex == q) { if ((u.childNodes[0]) && (u.childNodes[0].className == "hdrcell")) { u = u.childNodes[0] } g = Math.max(g, u.scrollWidth) } } var h = this.obj.rows.length; var s = 0; var w = this.cellType._dhx_find("tree"); var r = document.createElement("DIV"); r.className = "dhx_grid_adjust"; r.style.cssText = "width:auto;height:auto;visibility:hidden; position:absolute; top:0px; left:0px; overflow:hidden; white-space:nowrap;"; document.body.appendChild(r); for (var o = 1; o < h; o++) { var v = this.obj.rows[o]; var c = q; if (!this.rowsAr[v.idd]) { continue } if (v._childIndexes) { if (v._childIndexes[q] == v._childIndexes[q + 1]) { continue } c = v._childIndexes[q] } if (!v.childNodes[c] || v.childNodes[c]._cellIndex != q) { continue } r.innerHTML = (v.childNodes[c].innerText || v.childNodes[c].textContent || ""); s = r.offsetWidth; if (this._h2 && q == w) { s += this._h2.get[v.idd].level * 22 } if (s > g) { g = s } } document.body.removeChild(r); g += 20 + (e || 0); this._setColumnSizeR(q, g); this._notresize = false; this.setSizes() }, detachHeader: function(a, e) { e = e || this.hdr; var c = e.rows[a + 1]; if (c) { c.parentNode.removeChild(c) } this.setSizes() }, detachFooter: function(a) { this.detachHeader(a, this.ftr) }, attachHeader: function(a, g, c) { if (typeof(a) == "string") { a = this._eSplit(a) } if (typeof(g) == "string") { g = g.split(this.delim) } c = c || "_aHead"; if (this.hdr.rows.length) { if (a) { this._createHRow([a, g], this[(c == "_aHead") ? "hdr" : "ftr"]) } else { if (this[c]) { for (var e = 0; e < this[c].length; e++) { this.attachHeader.apply(this, this[c][e]) } } } } else { if (!this[c]) { this[c] = new Array() } this[c][this[c].length] = [a, g, c] } }, _createHRow: function(e, q) { if (!q) { if (this.entBox.style.position != "absolute") { this.entBox.style.position = "relative" } var m = document.createElement("DIV"); m.className = "c_ftr".substr(2); this.entBox.appendChild(m); var u = document.createElement("TABLE"); u.cellPadding = u.cellSpacing = 0; if (!_isIE || _isIE == 8) { u.width = "100%"; u.style.paddingRight = "20px" } u.style.marginRight = "20px"; u.style.tableLayout = "fixed"; m.appendChild(u); u.appendChild(document.createElement("TBODY")); this.ftr = q = u; var l = u.insertRow(0); var a = ((this.hdrLabels.length <= 1) ? e[0].length : this.hdrLabels.length); for (var g = 0; g < a; g++) { l.appendChild(document.createElement("TH")); l.childNodes[g]._cellIndex = g } if (_isIE && _isIE < 8) { l.style.position = "absolute" } else { l.style.height = "auto" } } var h = e[1]; var m = document.createElement("TR"); q.rows[0].parentNode.appendChild(m); for (var g = 0; g < e[0].length; g++) { if (e[0][g] == "#cspan") { var n = m.cells[m.cells.length - 1]; n.colSpan = (n.colSpan || 1) + 1; continue } if ((e[0][g] == "#rspan") && (q.rows.length > 1)) { var x = q.rows.length - 2; var v = false; var n = null; while (!v) { var n = q.rows[x]; for (var c = 0; c < n.cells.length; c++) { if (n.cells[c]._cellIndex == g) { v = c + 1; break } } x-- } n = n.cells[v - 1]; n.rowSpan = (n.rowSpan || 1) + 1; continue } var o = document.createElement("TD"); o._cellIndex = o._cellIndexS = g; if (this._hrrar && this._hrrar[g] && !_isIE) { o.style.display = "none" } if (typeof e[0][g] == "object") { o.appendChild(e[0][g]) } else { if (this.forceDivInHeader) { o.innerHTML = "
" + (e[0][g] || " ") + "
" } else { o.innerHTML = (e[0][g] || " ") } if ((e[0][g] || "").indexOf("#") != -1) { var u = e[0][g].match(/(^|{)#([^}]+)(}|$)/); if (u) { var r = "_in_header_" + u[2]; if (this[r]) { this[r]((this.forceDivInHeader ? o.firstChild : o), g, e[0][g].split(u[0])) } } } } if (h) { o.style.cssText = h[g] } m.appendChild(o) } var s = q; if (_isKHTML) { if (q._kTimer) { window.clearTimeout(q._kTimer) } q._kTimer = window.setTimeout(function() { q.rows[1].style.display = "none"; window.setTimeout(function() { q.rows[1].style.display = "" }, 1) }, 500) } }, attachFooter: function(a, c) { this.attachHeader(a, c, "_aFoot") }, setCellExcellType: function(e, a, c) { this.changeCellType(this.getRowById(e), a, c) }, disableCell: function(h, a, g) { this.cells(h, a).setDisabled(g); if (this._fake) { var e = this.getRowById(h); var c = this._bfs_cells3(e, a); c.cell._disabled = g } }, getCellExcellType: function(c, a) { var g = this.getRowById(c); var e = this.cells3(g, a); return e.cell._cellType || this.cellType[a] }, changeCellType: function(e, g, c) { c = c || this.cellType[g]; var h = this.cells3(e, g); var a = h.getValue(); h.cell._cellType = c; var h = this.cells3(e, g); h.setValue(a) }, setRowExcellType: function(e, c) { var g = this.rowsAr[e]; for (var a = 0; a < g.childNodes.length; a++) { this.changeCellType(g, a, c) } }, setColumnExcellType: function(a, e) { for (var c = 0; c < this.rowsBuffer.length; c++) { if (this.rowsBuffer[c] && this.rowsBuffer[c].tagName == "TR") { this.changeCellType(this.rowsBuffer[c], a, e) } } if (this.cellType[a] == "math") { this._strangeParams[c] = e } else { this.cellType[a] = e } }, forEachRow: function(e) { for (var c in this.rowsAr) { if (this.rowsAr[c] && this.rowsAr[c].idd) { e.apply(this, [this.rowsAr[c].idd]) } } }, forEachRowA: function(e) { for (var c = 0; c < this.rowsBuffer.length; c++) { if (this.rowsBuffer[c]) { e.call(this, this.render_row(c).idd) } } }, forEachCell: function(e, c) { var g = this.getRowById(e); if (!g) { return } for (var a = 0; a < this._cCount; a++) { c(this.cells3(g, a), a) } }, enableAutoWidth: function(e, a, c) { this._awdth = [dhx4.s2b(e), parseInt(a || 99999), parseInt(c || 0)]; if (arguments.length == 1) { this.objBox.style.overflowX = e ? "hidden" : "auto" } }, updateFromXML: function(a, g, c, e) { if (typeof g == "undefined") { g = true } this._refresh_mode = [true, g, c]; this.load(a, e) }, _refreshFromXML: function(g) { if (this._f_rowsBuffer) { this.filterBy(0, "") } reset = false; if (window.eXcell_tree) { eXcell_tree.prototype.setValueX = eXcell_tree.prototype.setValue; eXcell_tree.prototype.setValue = function(u) { var s = this.grid._h2.get[this.cell.parentNode.idd]; if (s && this.cell.parentNode.valTag) { this.setLabel(u) } else { this.setValueX(u) } } } var r = this.cellType._dhx_find("tree"); var l = dhx4.ajax.xmltop("rows", g); var h = l.getAttribute("parent") || 0; var n = {}; if (this._refresh_mode[2]) { if (r != -1) { this._h2.forEachChild(h, function(s) { n[s.id] = true }, this) } else { this.forEachRow(function(s) { n[s] = true }) } } var q = dhx4.ajax.xpath("//row", l); for (var e = 0; e < q.length; e++) { var o = q[e]; var a = o.getAttribute("id"); n[a] = false; var h = o.parentNode.getAttribute("id") || h; 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(e, c) { var a = this.cells(e, c).cell; if (!a._combo) { a._combo = new dhtmlXGridComboObject() } return a._combo }, setTabOrder: function(c) { var g = c.split(this.delim); this._tabOrder = []; var a = this._cCount || c.length; for (var e = 0; e < a; e++) { g[e] = { c: parseInt(g[e]), ind: e } } g.sort(function(l, h) { return (l.c > h.c ? 1 : -1) }); for (var e = 0; e < a; e++) { if (!g[e + 1] || (typeof g[e].c == "undefined")) { this._tabOrder[g[e].ind] = (g[0].ind + 1) * -1 } else { this._tabOrder[g[e].ind] = g[e + 1].ind } } }, i18n: { loading: "Loading", decimal_separator: ".", group_separator: "," }, _key_events: { k13_1_0: function() { var a = this.rowsCol._dhx_find(this.row); this.selectCell(this.rowsCol[a + 1], this.cell._cellIndex, true) }, k13_0_1: function() { var a = this.rowsCol._dhx_find(this.row); this.selectCell(this.rowsCol[a - 1], this.cell._cellIndex, true) }, k13_0_0: function() { this.editStop(); this.callEvent("onEnter", [(this.row ? this.row.idd : null), (this.cell ? this.cell._cellIndex : null)]); this._still_active = true }, k9_0_0: function() { this.editStop(); if (!this.callEvent("onTab", [true])) { return true } var a = this._getNextCell(null, 1); if (a) { this.selectCell(a.parentNode, a._cellIndex, (this.row != a.parentNode), false, true); this._still_active = true } }, k9_0_1: function() { this.editStop(); if (!this.callEvent("onTab", [false])) { return false } var a = this._getNextCell(null, -1); if (a) { this.selectCell(a.parentNode, a._cellIndex, (this.row != a.parentNode), false, true); this._still_active = true } }, k113_0_0: function() { if (this._f2kE) { this.editCell() } }, k32_0_0: function() { var a = this.cells4(this.cell); if (!a.changeState || (a.changeState() === false)) { return false } }, k27_0_0: function() { this.editStop(true) }, k33_0_0: function() { if (this.pagingOn) { this.changePage(this.currentPage - 1) } else { this.scrollPage(-1) } }, k34_0_0: function() { if (this.pagingOn) { this.changePage(this.currentPage + 1) } else { this.scrollPage(1) } }, k37_0_0: function() { if (!this.editor && this.isTreeGrid()) { this.collapseKids(this.row) } else { return false } }, k39_0_0: function() { if (!this.editor && this.isTreeGrid()) { this.expandKids(this.row) } else { return false } }, k40_0_0: function() { var c = this._realfake ? this._fake : this; if (this.editor && this.editor.combo) { this.editor.shiftNext() } else { if (!this.row.idd) { return } var a = Math.max((c._r_select || 0), this.getRowIndex(this.row.idd)); var e = this._nextRow(a, 1); if (e) { c._r_select = null; this.selectCell(e, this.cell._cellIndex, true); if (c.pagingOn) { c.showRow(e.idd) } } else { if (!this.callEvent("onLastRow", [])) { return false } this._key_events.k34_0_0.apply(this, []); if (this.pagingOn && this.rowsCol[a + 1]) { this.selectCell(a + 1, 0, true) } } } this._still_active = true }, k38_0_0: function() { var c = this._realfake ? this._fake : this; if (this.editor && this.editor.combo) { this.editor.shiftPrev() } else { if (!this.row.idd) { return } var a = this.getRowIndex(this.row.idd) + 1; if (a != -1 && (!this.pagingOn || (a != 1))) { var e = this._nextRow(a - 1, -1); this.selectCell(e, this.cell._cellIndex, true); if (c.pagingOn && e) { c.showRow(e.idd) } } else { this._key_events.k33_0_0.apply(this, []) } } this._still_active = true } }, _build_master_row: function() { var e = document.createElement("DIV"); var c = [""]; for (var a = 0; a < this._cCount; a++) { c.push("") } c.push("
"); e.innerHTML = c.join(""); this._master_row = e.firstChild.rows[0] }, _prepareRow: function(a) { if (!this._master_row) { this._build_master_row() } var e = this._master_row.cloneNode(true); for (var c = 0; c < e.childNodes.length; c++) { e.childNodes[c]._cellIndex = c; if (this._enbCid) { e.childNodes[c].id = "c_" + a + "_" + c } if (this.dragAndDropOff) { this.dragger.addDraggableItem(e.childNodes[c], this) } } e.idd = a; e.grid = this; return e }, _process_jsarray_row: function(c, e) { c._attrs = {}; for (var a = 0; a < c.childNodes.length; a++) { c.childNodes[a]._attrs = {} } this._fillRow(c, (this._c_order ? this._swapColumns(e) : e)); return c }, _get_jsarray_data: function(c, a) { return c[a] }, _process_json_row: function(a, c) { c = this._c_order ? this._swapColumns(c.data) : c.data; return this._process_some_row(a, c) }, _process_some_row: function(c, e) { c._attrs = {}; for (var a = 0; a < c.childNodes.length; a++) { c.childNodes[a]._attrs = {} } this._fillRow(c, e); return c }, _get_json_data: function(c, a) { return c.data[a] }, _process_js_row: function(e, g) { var a = []; for (var c = 0; c < this.columnIds.length; c++) { a[c] = g[this.columnIds[c]]; if (!a[c] && a[c] !== 0) { a[c] = "" } } this._process_some_row(e, a); e._attrs = g; return e }, _get_js_data: function(c, a) { return c[this.columnIds[a]] }, _process_csv_row: function(c, e) { c._attrs = {}; for (var a = 0; a < c.childNodes.length; a++) { c.childNodes[a]._attrs = {} } this._fillRow(c, (this._c_order ? this._swapColumns(e.split(this.csv.cell)) : e.split(this.csv.cell))); return c }, _get_csv_data: function(c, a) { return c.split(this.csv.cell)[a] }, _process_store_row: function(h, g) { var a = []; for (var e = 0; e < this.columnIds.length; e++) { a[e] = g[this.columnIds[e]] } for (var c = 0; c < h.childNodes.length; c++) { h.childNodes[c]._attrs = {} } h._attrs = g; this._fillRow(h, a) }, _process_xml_row: function(a, l) { var s = dhx4.ajax.xpath(this.xml.cell, l); var o = []; a._attrs = this._xml_attrs(l); if (this._ud_enabled) { var q = dhx4.ajax.xpath("./userdata", l); for (var h = q.length - 1; h >= 0; h--) { var n = ""; for (var e = 0; e < q[h].childNodes.length; e++) { n += q[h].childNodes[e].nodeValue } this.setUserData(a.idd, q[h].getAttribute("name"), n) } } for (var e = 0; e < s.length; e++) { var g = s[this._c_order ? this._c_order[e] : e]; if (!g) { continue } var c = a._childIndexes ? a._childIndexes[e] : e; var m = g.getAttribute("type"); if (a.childNodes[c]) { if (m) { a.childNodes[c]._cellType = m } a.childNodes[c]._attrs = this._xml_attrs(g) } if (!g.getAttribute("xmlcontent")) { if (g.firstChild) { g = g.firstChild.wholeText || g.firstChild.data } else { g = "" } } o.push(g) } for (e < s.length; e < a.childNodes.length; e++) { a.childNodes[e]._attrs = {} } if (a.parentNode && a.parentNode.tagName == "row") { a._attrs.parent = a.parentNode.getAttribute("idd") } this._fillRow(a, o); return a }, _get_xml_data: function(c, a) { c = c.firstChild; while (true) { if (!c) { return "" } if (c.tagName == "cell") { a-- } if (a < 0) { break } c = c.nextSibling } return (c.firstChild ? c.firstChild.data : "") }, _fillRow: function(g, l) { if (this.editor && this.editor.parentNode && this.editor.parentNode.idd == g.idd) { this.editStop() } for (var c = 0; c < g.childNodes.length; c++) { if ((c < l.length) || (this.defVal[c])) { var e = g.childNodes[c]._cellIndex; var h = l[e]; var a = this.cells4(g.childNodes[c]); if ((this.defVal[e]) && ((h == "") || (typeof(h) == "undefined"))) { h = this.defVal[e] } if (a) { a.setValue(h) } } else { g.childNodes[c].innerHTML = " "; g.childNodes[c]._clearCell = true } } return g }, _postRowProcessing: function(l, n) { if (l._attrs["class"]) { l._css = l.className = l._attrs["class"] } if (l._attrs.locked) { l._locked = true } if (l._attrs.bgColor) { l.bgColor = l._attrs.bgColor } var m = 0; for (var e = 0; e < l.childNodes.length; e++) { var o = l.childNodes[e]; var h = o._cellIndex; var g = o._attrs.style || l._attrs.style; if (g) { o.style.cssText += ";" + g } if (o._attrs["class"]) { o.className = o._attrs["class"] } g = o._attrs.align || this.cellAlign[h]; if (g) { o.align = g } o.vAlign = o._attrs.valign || this.cellVAlign[h]; var a = o._attrs.bgColor || this.columnColor[h]; if (a) { o.bgColor = a } if (o._attrs.colspan && !n) { this.setColspan(l.idd, e + m, o._attrs.colspan); m += (o._attrs.colspan - 1) } if (this._hrrar && this._hrrar[h] && !n) { o.style.display = "none" } } this.callEvent("onRowCreated", [l.idd, l, null]) }, load: function(a, e, c) { this.callEvent("onXLS", [this]); if (arguments.length == 2 && typeof e != "function") { c = e; e = null } this._last_load_type = c = c || this._last_load_type || "xml"; if (!this.xmlFileUrl) { this.xmlFileUrl = a } this._data_type = c; this.xmlLoader = this.doLoadDetails; var g = this; this.xmlLoader = function(h) { if (!g.callEvent) { return } g["_process_" + c](h.xmlDoc); if (!g._contextCallTimer) { g.callEvent("onXLE", [g, 0, 0, h.xmlDoc, c]) } if (e) { e(); e = null } }; return dhx4.ajax.get(a, this.xmlLoader) }, loadXMLString: function(c, a) { if (window.console && window.console.info) { window.console.info("loadXMLString was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44") } this.parse({ responseXML: dhx4.ajax.parse(c) }, a, "xml") }, loadXML: function(a, c) { if (window.console && window.console.info) { window.console.info("loadXML was deprecated", "http://docs.dhtmlx.com/migration__index.html#migrationfrom43to44") } this.load(a, c, "xml") }, parse: function(e, c, a) { if (arguments.length == 2 && typeof c != "function") { a = c; c = null } this._last_load_type = a = a || this._last_load_type || "xml"; this._data_type = a; if (a == "xml" && typeof e == "string") { e = { responseXML: dhx4.ajax.parse(e) } } this["_process_" + a](e); if (!this._contextCallTimer) { this.callEvent("onXLE", [this, 0, 0, e, a]) } if (c) { c() } }, xml: { top: "rows", row: "./row", cell: "./cell", s_row: "row", s_cell: "cell", row_attrs: [], cell_attrs: [] }, csv: { row: "\n", cell: "," }, _xml_attrs: function(c) { var e = {}; if (c.attributes.length) { for (var a = 0; a < c.attributes.length; a++) { e[c.attributes[a].name] = c.attributes[a].value } } return e }, _process_xml: function(q) { if (this._refresh_mode) { return this._refreshFromXML(q) } this._parsing = true; var m = dhx4.ajax.xmltop(this.xml.top, q); if (m.tagName != this.xml.top) { return } var o = m.getAttribute("dhx_security"); if (o) { dhtmlx.security_key = o } this._parseHead(m); var r = dhx4.ajax.xpath(this.xml.row, m); var l = parseInt(m.getAttribute("pos") || 0); var n = parseInt(m.getAttribute("total_count") || 0); if (!this.pagingOn) { var n = Math.min(n, 32000000 / this._srdh) } var g = false; if (n && n != this.rowsBuffer.length) { if (!this.rowsBuffer[n - 1]) { if (this.rowsBuffer.length) { g = true } this.rowsBuffer[n - 1] = null } if (n < this.rowsBuffer.length) { this.rowsBuffer.splice(n, this.rowsBuffer.length - n); g = true } } if (this.isTreeGrid()) { return this._process_tree_xml(m) } for (var c = 0; c < r.length; c++) { if (this.rowsBuffer[c + l]) { continue } var a = r[c].getAttribute("id") || (c + l + 1); this.rowsBuffer[c + l] = { idd: a, data: r[c], _parser: this._process_xml_row, _locator: this._get_xml_data }; this.rowsAr[a] = r[c] } this.callEvent("onDataReady", []); if (g && this._srnd) { var e = this.objBox.scrollTop; this._reset_view(); this.objBox.scrollTop = e } else { this.render_dataset() } this._parsing = false }, _process_jsarray: function(data) { this._parsing = true; data = data.responseText || data; if (typeof data == "string") { eval("dhtmlx.temp=" + data + ";"); data = dhtmlx.temp } for (var i = 0; i < data.length; i++) { var id = i + 1; this.rowsBuffer.push({ idd: id, data: data[i], _parser: this._process_jsarray_row, _locator: this._get_jsarray_data }); this.rowsAr[id] = data[i] } this.render_dataset(); this._parsing = false }, _process_csv: function(g) { this._parsing = true; g = g.responseText || g; g = g.replace(/\r/g, ""); g = g.split(this.csv.row); if (this._csvHdr) { this.clearAll(); var e = g.splice(0, 1)[0].split(this.csv.cell); if (!this._csvAID) { e.splice(0, 1) } this.setHeader(e.join(this.delim)); this.init() } for (var c = 0; c < g.length; c++) { if (!g[c] && c == g.length - 1) { continue } if (this._csvAID) { var h = c + 1; this.rowsBuffer.push({ idd: h, data: g[c], _parser: this._process_csv_row, _locator: this._get_csv_data }) } else { var a = g[c].split(this.csv.cell); var h = a.splice(0, 1)[0]; this.rowsBuffer.push({ idd: h, data: a, _parser: this._process_jsarray_row, _locator: this._get_jsarray_data }) } this.rowsAr[h] = g[c] } this.render_dataset(); this._parsing = false }, _process_js: function(a) { return this._process_json(a, "js") }, _process_json: function(data, mode) { this._parsing = true; var data = data.responseText || data; if (typeof data == "string") { eval("dhtmlx.temp=" + data + ";"); data = dhtmlx.temp } if (mode == "js") { if (data.data) { data = data.data } for (var i = 0; i < data.length; i++) { var row = data[i]; var id = row.id || (i + 1); this.rowsBuffer.push({ idd: id, data: row, _parser: this._process_js_row, _locator: this._get_js_data }); this.rowsAr[id] = data[i] } } else { if (data.rows) { for (var i = 0; i < data.rows.length; i++) { var id = data.rows[i].id; this.rowsBuffer.push({ idd: id, data: data.rows[i], _parser: this._process_json_row, _locator: this._get_json_data }); this.rowsAr[id] = data.rows[i] } } } if (data.dhx_security) { dhtmlx.security_key = data.dhx_security } this.callEvent("onDataReady", []); this.render_dataset(); this._parsing = false }, render_dataset: function(g, o) { if (this._srnd) { if (this._fillers) { return this._update_srnd_view() } o = Math.min((this._get_view_size() + (this._srnd_pr || 0)), this.rowsBuffer.length) } if (this.pagingOn) { g = Math.max((g || 0), (this.currentPage - 1) * this.rowsBufferOutSize); o = Math.min(this.currentPage * this.rowsBufferOutSize, this.rowsBuffer.length) } else { g = g || 0; o = o || this.rowsBuffer.length } for (var h = g; h < o; h++) { var a = this.render_row(h); if (a == -1) { if (this.xmlFileUrl) { if (this.callEvent("onDynXLS", [h, (this._dpref ? this._dpref : (o - h))])) { this.load(this.xmlFileUrl + dhtmlx.url(this.xmlFileUrl) + "posStart=" + h + "&count=" + (this._dpref ? this._dpref : (o - h)), this._data_type) } } o = h; break } if (!a.parentNode || !a.parentNode.tagName) { this._insertRowAt(a, h); if (a._attrs.selected || a._attrs.select) { this.selectRow(a, a._attrs.call ? true : false, true); a._attrs.selected = a._attrs.select = null } } if (this._ads_count && h - g == this._ads_count) { var n = this; this._context_parsing = this._context_parsing || this._parsing; return this._contextCallTimer = window.setTimeout(function() { n._contextCallTimer = null; n.render_dataset(h, o); if (!n._contextCallTimer) { if (n._context_parsing) { n.callEvent("onXLE", []) } else { n._fixAlterCss() } n._context_parsing = false } }, this._ads_time) } } if (this._ads_count && h == o) { this.callEvent("onDistributedEnd", []) } if (this._srnd && !this._fillers) { var c = this.rowsBuffer.length - o; this._fillers = []; if (this._fake && !this._realfake) { this._fake._fillers = [] } var e = Math.round(990000 / this._srdh); while (c > 0) { var l = (_isIE || window._FFrv) ? Math.min(c, e) : c; var m = this._add_filler(o, l); if (m) { this._fillers.push(m) } c -= l; o += l } } this.setSizes() }, render_row: function(c) { if (!this.rowsBuffer[c]) { return -1 } if (this.rowsBuffer[c]._parser) { var a = this.rowsBuffer[c]; if (this.rowsAr[a.idd] && this.rowsAr[a.idd].tagName == "TR") { return this.rowsBuffer[c] = this.rowsAr[a.idd] } var e = this._prepareRow(a.idd); this.rowsBuffer[c] = e; this.rowsAr[a.idd] = e; a._parser.call(this, e, a.data); this._postRowProcessing(e); return e } return this.rowsBuffer[c] }, _get_cell_value: function(c, a, e) { if (c._locator) { if (this._c_order) { a = this._c_order[a] } return c._locator.call(this, c.data, a) } return this.cells3(c, a)[e ? e : "getValue"]() }, sortRows: function(e, l, c) { this.editStop(); c = (c || "asc").toLowerCase(); l = (l || this.fldSort[e]); e = e || 0; if (this.isTreeGrid()) { this.sortTreeRows(e, l, c) } else { var a = {}; var h = this.cellType[e]; var m = "getValue"; if (h == "link") { m = "getContent" } if (h == "dhxCalendar" || h == "dhxCalendarA") { m = "getDate" } if (h == "co" || h == "coro") { m = "getText" } for (var g = 0; g < this.rowsBuffer.length; g++) { a[this.rowsBuffer[g].idd] = this._get_cell_value(this.rowsBuffer[g], e, m) } this._sortRows(e, l, c, a) } this.callEvent("onAfterSorting", [e, l, c]) }, _sortCore: function(e, l, c, a, h) { var g = "sort"; if (this._sst) { h.stablesort = this.rowsCol.stablesort; g = "stablesort" } if (l.length > 4) { l = window[l] } if (l == "cus") { var m = this._customSorts[e]; h[g](function(o, n) { return m(a[o.idd], a[n.idd], c, o.idd, n.idd) }) } else { if (typeof(l) == "function") { h[g](function(o, n) { return l(a[o.idd], a[n.idd], c, o.idd, n.idd) }) } else { if (l == "str") { h[g](function(o, n) { if (c == "asc") { return a[o.idd] > a[n.idd] ? 1 : (a[o.idd] < a[n.idd] ? -1 : 0) } else { return a[o.idd] < a[n.idd] ? 1 : (a[o.idd] > a[n.idd] ? -1 : 0) } }) } else { if (l == "int") { h[g](function(q, o) { var n = parseFloat(a[q.idd]); n = isNaN(n) ? -99999999999999 : n; var r = parseFloat(a[o.idd]); r = isNaN(r) ? -99999999999999 : r; if (c == "asc") { return n - r } else { return r - n } }) } else { if (l == "date") { h[g](function(q, o) { var n = Date.parse(a[q.idd]) || (Date.parse("01/01/1900")); var r = Date.parse(a[o.idd]) || (Date.parse("01/01/1900")); if (c == "asc") { return n - r } else { return r - n } }) } } } } } }, _sortRows: function(e, g, c, a) { this._sortCore(e, g, c, a, this.rowsBuffer); this._reset_view(); this.callEvent("onGridReconstructed", []) }, _reset_view: function(e) { if (!this.obj.rows[0]) { return } if (this._lahRw) { this._unsetRowHover(0, true) } this.callEvent("onResetView", []); var a = this.obj.rows[0].parentNode; var g = a.removeChild(a.childNodes[0], true); if (_isKHTML) { for (var c = a.parentNode.childNodes.length - 1; c >= 0; c--) { if (a.parentNode.childNodes[c].tagName == "TR") { a.parentNode.removeChild(a.parentNode.childNodes[c], true) } } } else { if (_isIE) { for (var c = a.childNodes.length - 1; c >= 0; c--) { a.childNodes[c].removeNode(true) } } else { a.innerHTML = "" } } a.appendChild(g); this.rowsCol = dhtmlxArray(); if (this._sst) { this.enableStableSorting(true) } this._fillers = this.undefined; if (!e) { if (_isIE && this._srnd) { this.render_dataset() } else { this.render_dataset() } } }, deleteRow: function(c, g) { if (!g) { g = this.getRowById(c) } if (!g) { return } this.editStop(); if (!this._realfake) { if (this.callEvent("onBeforeRowDeleted", [c]) == false) { return false } } var a = 0; if (this.cellType._dhx_find("tree") != -1 && !this._realfake) { a = this._h2.get[c].parent.id; this._removeTrGrRow(g) } else { if (g.parentNode) { g.parentNode.removeChild(g) } var l = this.rowsCol._dhx_find(g); if (l != -1) { this.rowsCol._dhx_removeAt(l) } for (var e = 0; e < this.rowsBuffer.length; e++) { if (this.rowsBuffer[e] && this.rowsBuffer[e].idd == c) { this.rowsBuffer._dhx_removeAt(e); l = e; break } } } this.rowsAr[c] = null; for (var e = 0; e < this.selectedRows.length; e++) { if (this.selectedRows[e].idd == c) { this.selectedRows._dhx_removeAt(e) } } if (this._srnd) { for (var e = 0; e < this._fillers.length; e++) { var h = this._fillers[e]; if (!h) { continue } if (h[0] >= l) { this._update_fillers(e, 0, -1) } else { if (h[0] + h[1] > l) { this._update_fillers(e, -1, 0) } } } this._update_srnd_view() } if (this.pagingOn) { this.changePage() } if (!this._realfake) { this.callEvent("onAfterRowDeleted", [c, a]) } this.callEvent("onGridReconstructed", []); if (this._ahgr) { this.setSizes() } return true }, _addRow: function(l, m, c) { if (c == -1 || typeof c == "undefined") { c = this.rowsBuffer.length } if (typeof m == "string") { m = m.split(this.delim) } var n = this._prepareRow(l); n._attrs = {}; for (var e = 0; e < n.childNodes.length; e++) { n.childNodes[e]._attrs = {} } this.rowsAr[n.idd] = n; if (this._h2) { this._h2.get[n.idd].buff = n } this._fillRow(n, m); this._postRowProcessing(n); if (this._skipInsert) { this._skipInsert = false; return this.rowsAr[n.idd] = n } if (this.pagingOn) { this.rowsBuffer._dhx_insertAt(c, n); this.rowsAr[n.idd] = n; return n } if (this._fillers) { this.rowsCol._dhx_insertAt(c, null); this.rowsBuffer._dhx_insertAt(c, n); if (this._fake) { this._fake.rowsCol._dhx_insertAt(c, null) } this.rowsAr[n.idd] = n; var o = false; for (var g = 0; g < this._fillers.length; g++) { var h = this._fillers[g]; if (h && h[0] <= c && (h[0] + h[1]) >= c) { h[1] = h[1] + 1; var a = h[2].firstChild.style.height = parseInt(h[2].firstChild.style.height) + this._srdh + "px"; o = true; if (this._fake) { this._fake._fillers[g][1]++; this._fake._fillers[g][2].firstChild.style.height = a } } if (h && h[0] > c) { h[0] = h[0] + 1; if (this._fake) { this._fake._fillers[g][0]++ } } } if (!o) { this._fillers.push(this._add_filler(c, 1, (c == 0 ? { parentNode: this.obj.rows[0].parentNode, nextSibling: (this.rowsCol[1]) } : this.rowsCol[c - 1]))) } return n } this.rowsBuffer._dhx_insertAt(c, n); return this._insertRowAt(n, c) }, addRow: function(a, g, e) { var c = this._addRow(a, g, e); if (!this.dragContext) { this.callEvent("onRowAdded", [a]) } if (this.pagingOn) { this.changePage(this.currentPage) } if (this._srnd) { this._update_srnd_view() } c._added = true; if (this._srnd && !this._fillers) { this._fillers = [] } if (this._ahgr) { this.setSizes() } this.callEvent("onGridReconstructed", []); return c }, _insertRowAt: function(e, g, c) { this.rowsAr[e.idd] = e; if (this._skipInsert) { this._skipInsert = false; return e } if ((g < 0) || ((!g) && (parseInt(g) !== 0))) { g = this.rowsCol.length } else { if (g > this.rowsCol.length) { g = this.rowsCol.length } } if (this._cssEven) { var a = e.className.replace(this._cssUnEven, ""); if ((this._cssSP ? this.getLevel(e.idd) : g) % 2 == 1) { e.className = a + " " + this._cssUnEven + (this._cssSU ? (" " + this._cssUnEven + "_" + this.getLevel(e.idd)) : "") } else { e.className = a + " " + this._cssEven + (this._cssSU ? (" " + this._cssEven + "_" + this.getLevel(e.idd)) : "") } } if (!c) { if ((g == (this.obj.rows.length - 1)) || (!this.rowsCol[g])) { if (_isKHTML) { this.obj.appendChild(e) } else { this.obj.firstChild.appendChild(e) } } else { this.rowsCol[g].parentNode.insertBefore(e, this.rowsCol[g]) } } this.rowsCol._dhx_insertAt(g, e); this.callEvent("onRowInserted", [e, g]); return e }, getRowById: function(e) { var c = this.rowsAr[e]; if (c) { if (c.tagName != "TR") { for (var a = 0; a < this.rowsBuffer.length; a++) { if (this.rowsBuffer[a] && this.rowsBuffer[a].idd == e) { return this.render_row(a) } } if (this._h2) { return this.render_row(null, c.idd) } } return c } return null }, cellById: function(c, a) { return this.cells(c, a) }, cells: function(g, e) { if (arguments.length == 0) { return this.cells4(this.cell) } else { var h = this.getRowById(g) } var a = (h._childIndexes ? h.childNodes[h._childIndexes[e]] : h.childNodes[e]); if (!a && h._childIndexes) { a = h.firstChild || {} } return this.cells4(a) }, cellByIndex: function(c, a) { return this.cells2(c, a) }, cells2: function(g, e) { var h = this.render_row(g); var a = (h._childIndexes ? h.childNodes[h._childIndexes[e]] : h.childNodes[e]); if (!a && h._childIndexes) { a = h.firstChild || {} } return this.cells4(a) }, cells3: function(e, c) { var a = (e._childIndexes ? e.childNodes[e._childIndexes[c]] : e.childNodes[c]); return this.cells4(a) }, cells4: function(a) { var c = window["eXcell_" + (a._cellType || this.cellType[a._cellIndex])]; if (c) { return new c(a) } }, cells5: function(a, e) { var e = e || (a._cellType || this.cellType[a._cellIndex]); if (!this._ecache[e]) { if (!window["eXcell_" + e]) { var c = eXcell_ro } else { var c = window["eXcell_" + e] } this._ecache[e] = new c(a) } this._ecache[e].cell = a; return this._ecache[e] }, dma: function(a) { if (!this._ecache) { this._ecache = {} } if (a && !this._dma) { this._dma = this.cells4; this.cells4 = this.cells5 } else { if (!a && this._dma) { this.cells4 = this._dma; this._dma = null } } }, getRowsNum: function() { return this.rowsBuffer.length }, enableEditTabOnly: function(a) { if (arguments.length > 0) { this.smartTabOrder = dhx4.s2b(a) } else { this.smartTabOrder = true } }, setExternalTabOrder: function(h, a) { var c = this; this.tabStart = (typeof(h) == "object") ? h : document.getElementById(h); var e = this.tabStart.onkeydown; this.tabStart.onkeydown = function(m) { if (e) { e.call(this, m) } var l = (m || window.event); if (l.keyCode == 9 && !l.shiftKey) { l.cancelBubble = true; c.selectCell(0, 0, 0, 0, 1); if (c.smartTabOrder && c.cells2(0, 0).isDisabled()) { c._key_events.k9_0_0.call(c) } this.blur(); return false } }; if (_isOpera) { this.tabStart.onkeypress = this.tabStart.onkeydown } this.tabEnd = (typeof(a) == "object") ? a : document.getElementById(a); var g = this.tabEnd.onkeydown; this.tabEnd.onkeydown = this.tabEnd.onkeypress = function(m) { if (g) { g.call(this, m) } var l = (m || window.event); if (l.keyCode == 9 && l.shiftKey) { l.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++ }, setIconset: function(a) { this.iconset = a }, clearAndLoad: function() { if (this._last_load_request) { var c = this._last_load_request.xmlDoc; if (c.readyState != 4) { try { c.onreadystatechange = function() {}; c.abort() } catch (g) {} } } var a = this._pgn_skin; this._pgn_skin = null; this.clearAll(); this._pgn_skin = a; this._last_load_request = this.load.apply(this, arguments) }, getStateOfView: function() { if (this.pagingOn) { var g = (this.currentPage - 1) * this.rowsBufferOutSize; return [this.currentPage, g, Math.min(g + this.rowsBufferOutSize, this.rowsBuffer.length), this.rowsBuffer.length] } var c = Math.floor(this.objBox.scrollTop / this._srdh); var a = Math.ceil(parseInt(this.objBox.offsetHeight) / this._srdh); if (this.multiLine) { var e = this.objBox.scrollTop; c = 0; while (e >= 0) { e -= this.rowsCol[c] ? this.rowsCol[c].offsetHeight : this._srdh; c++ } c--; e += this.objBox.offsetHeight; a = 0; while (e >= 0) { e -= this.rowsCol[c + a] ? this.rowsCol[c + a].offsetHeight : this._srdh; a++ } } return [c, a, this.rowsBuffer.length] } }; (function() { function g(m, n) { this[m] = n } function l(m, n) { this[m].call(this, n) } function e(m, n) { this[m].call(this, n.join(this.delim)) } function a(m, q) { for (var o = 0; o < q.length; o++) { if (typeof q[o] == "object") { var r = this.getCombo(o); for (var n in q[o]) { r.put(n, q[o][n]) } } } } function h(m, v, q) { var x = 1; var u = []; function w(A, y, C) { if (!u[y]) { u[y] = [] } if (typeof C == "object") { C.toString = function() { return this.text } } u[y][A] = C } for (var r = 0; r < v.length; r++) { if (typeof(v[r]) == "object" && v[r].length) { for (var o = 0; o < v[r].length; o++) { w(r, o, v[r][o]) } } else { w(r, 0, v[r]) } } for (var r = 0; r < u.length; r++) { for (var o = 0; o < u[0].length; o++) { var s = u[r][o]; u[r][o] = (s || "").toString() || " "; if (s && s.colspan) { for (var n = 1; n < s.colspan; n++) { w(o + n, r, "#cspan") } } if (s && s.rowspan) { for (var n = 1; n < s.rowspan; n++) { w(o, r + n, "#rspan") } } } } this.setHeader(u[0]); for (var r = 1; r < u.length; r++) { this.attachHeader(u[r]) } } var c = [{ name: "label", def: " ", operation: "setHeader", type: h }, { name: "id", def: "", operation: "columnIds", type: g }, { name: "width", def: "*", operation: "setInitWidths", type: e }, { name: "align", def: "left", operation: "cellAlign", type: g }, { name: "valign", def: "middle", operation: "cellVAlign", type: g }, { name: "sort", def: "na", operation: "fldSort", type: g }, { name: "type", def: "ro", operation: "setColTypes", type: e }, { name: "options", def: "", operation: "", type: a }]; dhtmlx.extend_api("dhtmlXGridObject", { _init: function(m) { return [m.parent] }, image_path: "setImagePath", columns: "columns", rows: "rows", headers: "headers", skin: "setSkin", smart_rendering: "enableSmartRendering", css: "enableAlterCss", auto_height: "enableAutoHeight", save_hidden: "enableAutoHiddenColumnsSaving", save_cookie: "enableAutoSaving", save_size: "enableAutoSizeSaving", auto_width: "enableAutoWidth", block_selection: "enableBlockSelection", csv_id: "enableCSVAutoID", csv_header: "enableCSVHeader", cell_ids: "enableCellIds", colspan: "enableColSpan", column_move: "enableColumnMove", context_menu: "enableContextMenu", distributed: "enableDistributedParsing", drag: "enableDragAndDrop", drag_order: "enableDragOrder", tabulation: "enableEditTabOnly", header_images: "enableHeaderImages", header_menu: "enableHeaderMenu", keymap: "enableKeyboardSupport", mouse_navigation: "enableLightMouseNavigation", markers: "enableMarkedCells", math_editing: "enableMathEditing", math_serialization: "enableMathSerialization", drag_copy: "enableMercyDrag", multiline: "enableMultiline", multiselect: "enableMultiselect", save_column_order: "enableOrderSaving", hover: "enableRowsHover", rowspan: "enableRowspan", smart: "enableSmartRendering", save_sorting: "enableSortingSaving", stable_sorting: "enableStableSorting", undo: "enableUndoRedo", csv_cell: "setCSVDelimiter", date_format: "setDateFormat", drag_behavior: "setDragBehavior", editable: "setEditable", without_header: "setNoHeader", submit_changed: "submitOnlyChanged", submit_serialization: "submitSerialization", submit_selected: "submitOnlySelected", submit_id: "submitOnlyRowID", xml: "load" }, { columns: function(r) { for (var m = 0; m < c.length; m++) { var q = []; for (var n = 0; n < r.length; n++) { q[n] = r[n][c[m].name] || c[m].def } var o = c[m].type || l; o.call(this, c[m].operation, q, r) } this.init() }, rows: function(m) {}, headers: function(n) { for (var m = 0; m < n.length; m++) { this.attachHeader(n[m]) } } }) })(); dhtmlXGridObject.prototype._dp_init = function(a) { a.attachEvent("insertCallback", function(c, g) { if (this.obj._h2) { this.obj.addRow(g, e, null, parent) } else { this.obj.addRow(g, [], 0) } var e = this.obj.getRowById(g); if (e) { this.obj._process_xml_row(e, c.firstChild); this.obj._postRowProcessing(e) } }); a.attachEvent("updateCallback", function(c, g) { var e = this.obj.getRowById(g); if (e) { this.obj._process_xml_row(e, c.firstChild); this.obj._postRowProcessing(e) } }); a.attachEvent("deleteCallback", function(c, e) { this.obj.setUserData(e, this.action_param, "true_deleted"); this.obj.deleteRow(e) }); a._methods = ["setRowTextStyle", "setCellTextStyle", "changeRowId", "deleteRow"]; this.attachEvent("onEditCell", function(g, h, e) { if (a._columns && !a._columns[e]) { return true } var c = this.cells(h, e); if (g == 1) { if (c.isCheckbox()) { a.setUpdated(h, true) } } else { if (g == 2) { if (c.wasChanged()) { a.setUpdated(h, true) } } } return true }); this.attachEvent("onRowPaste", function(c) { a.setUpdated(c, true) }); this.attachEvent("onUndo", function(c) { a.setUpdated(c, true) }); this.attachEvent("onRowIdChange", function(g, c) { var e = a.findRow(g); if (e < a.updatedRows.length) { a.updatedRows[e] = c } }); this.attachEvent("onSelectStateChanged", function(c) { if (a.updateMode == "row") { a.sendData() } return true }); this.attachEvent("onEnter", function(e, c) { if (a.updateMode == "row") { a.sendData() } return true }); this.attachEvent("onBeforeRowDeleted", function(c) { if (a._silent_mode || (!this.rowsAr[c])) { return true } if (this.dragContext && a.dnd) { window.setTimeout(function() { a.setUpdated(c, true) }, 1); return true } var e = a.getState(c); if (this._h2) { this._h2.forEachChild(c, function(g) { a.setUpdated(g.id, false); a.markRow(g.id, true, "deleted") }, this) } if (e == "inserted") { a.set_invalid(c, false); a.setUpdated(c, false); return true } if (e == "deleted") { return false } if (e == "true_deleted") { a.setUpdated(c, false); return true } a.setUpdated(c, true, "deleted"); return false }); this.attachEvent("onBindUpdate", function(e, c, g) { a.setUpdated(g, true) }); this.attachEvent("onRowAdded", function(c) { if (this.dragContext && a.dnd) { return true } a.setUpdated(c, true, "inserted"); return true }); a._getRowData = function(g, s) { var m = {}; m.gr_id = g; if (this.obj.isTreeGrid()) { m.gr_pid = this.obj.getParentId(g) } var e = this.obj.getRowById(g); for (var n = 0; n < this.obj._cCount; n++) { if (this.obj._c_order) { var o = this.obj._c_order[n] } else { var o = n } var q = this.obj.cells(e.idd, n); if (this._changed && !q.wasChanged()) { continue } if (this._endnm) { m[this.obj.getColumnId(n)] = q.getValue() } else { m["c" + o] = q.getValue() } } var h = this.obj.UserData[g]; if (h) { for (var l = 0; l < h.keys.length; l++) { if (h.keys[l] && h.keys[l].indexOf("__") != 0) { m[h.keys[l]] = h.values[l] } } } var h = this.obj.UserData.gridglobaluserdata; if (h) { for (var l = 0; l < h.keys.length; l++) { m[h.keys[l]] = h.values[l] } } return m }; a._clearUpdateFlag = function(e) { var g = this.obj.getRowById(e); if (g) { for (var c = 0; c < this.obj._cCount; c++) { this.obj.cells(e, c).cell.wasChanged = false } } }; a.checkBeforeUpdate = function(l) { var h = true; var c = []; for (var g = 0; g < this.obj._cCount; g++) { if (this.mandatoryFields[g]) { var e = this.mandatoryFields[g].call(this.obj, this.obj.cells(l, g).getValue(), l, g); if (typeof e == "string") { this.messages.push(e); h = false } else { h &= e; c[g] = !e } } } if (!h) { this.set_invalid(l, "invalid", c); this.setUpdated(l, false) } return h } }; dhx4.attachEvent("onGridCreated", function(c) { c._con_f_used = [].concat(c._con_f_used); dhtmlXGridObject.prototype._con_f_used = []; if (c._was_created_once) { return } c._was_created_once = true; 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(n, o, m) { var l = this._c_order ? this._c_order[o] : o; this._connector_sorting = "&dhx_sort[" + l + "]=" + m; return h.call(this, n) }; var e = function(n, l, q) { var r = []; for (var o = 0; o < l.length; o++) { var m = this._c_order ? this._c_order[l[o]] : l[o]; r[o] = "dhx_filter[" + m + "]=" + encodeURIComponent(q[o]) } this._connector_filter = "&" + r.join("&"); return h.call(this, n) }; c.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 }); c.attachEvent("onDynXLS", function() { if (this.xmlFileUrl) { this.xmlFileUrl = h.call(this, this.xmlFileUrl) } return true }); c.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 }); c.attachEvent("onFilterStart", function(m, l) { if (this._con_f_used.length) { var o = this.getSortingState(); var n = this; this.clearAndLoad(e.call(this, this.xmlFileUrl, m, l)); if (o.length) { n.setSortImgState(true, o[0], o[1]) } return false } return true }) }); dhtmlXGridObject.prototype._con_f_used = []; dhtmlXGridObject.prototype._in_header_connector_text_filter = function(c, a) { if (!this._con_f_used[a]) { this._con_f_used[a] = 1 } return this._in_header_text_filter(c, a) }; dhtmlXGridObject.prototype._in_header_connector_select_filter = function(c, a) { if (!this._con_f_used[a]) { this._con_f_used[a] = 2 } return this._in_header_select_filter(c, a) }; if (!dhtmlXGridObject.prototype.load_connector) { dhtmlXGridObject.prototype.load_connector = dhtmlXGridObject.prototype.load; dhtmlXGridObject.prototype.load = function(c, h, g) { if (!this._colls_loaded && this.cellType) { var a = []; for (var e = 0; e < this.cellType.length; e++) { if (this.cellType[e].indexOf("co") == 0 || this.cellType[e].indexOf("clist") == 0 || this._con_f_used[e] == 2) { a.push(e) } } if (a.length) { arguments[0] += (arguments[0].indexOf("?") != -1 ? "&" : "?") + "connector=true&dhx_colls=" + a.join(",") } } return this.load_connector.apply(this, arguments) }; dhtmlXGridObject.prototype._parseHead_connector = dhtmlXGridObject.prototype._parseHead; dhtmlXGridObject.prototype._parseHead = function(c, u, q) { this._parseHead_connector.apply(this, arguments); if (!this._colls_loaded) { var r = dhx4.ajax.xpath("./coll_options", arguments[0]); for (var m = 0; m < r.length; m++) { var o = r[m].getAttribute("for"); var s = []; var g = null; if (this.cellType[o] == "combo") { g = this.getColumnCombo(o) } else { if (this.cellType[o].indexOf("co") == 0) { g = this.getCombo(o) } } var l = dhx4.ajax.xpath("./item", r[m]); var a = []; for (var h = 0; h < l.length; h++) { var e = l[h].getAttribute("value"); if (g) { var n = l[h].getAttribute("label") || e; if (g.addOption) { a.push([e, n]) } else { g.put(e, n) } s[s.length] = n } else { s[s.length] = e } } if (a.length) { if (g) { g.addOption(a) } } else { if (s.length && !g) { if (this.registerCList) { this.registerCList(o * 1, s) } } } if (this._con_f_used[o * 1]) { this._con_f_used[o * 1] = s } } this._colls_loaded = true } } } dhtmlXGridObject.prototype.getRowData = function(h) { var c = {}; var a = this.getColumnsNum(); for (var e = 0; e < a; e++) { var g = this.getColumnId(e); if (g) { c[g] = this.cells(h, e).getValue() } } return c }; dhtmlXGridObject.prototype.setRowData = function(h, e) { var a = this.getColumnsNum(); for (var c = 0; c < a; c++) { var g = this.getColumnId(c); if (g && e.hasOwnProperty(g)) { this.cells(h, c).setValue(e[g]) } } }; function dhtmlXGridCellObject(a) { this.destructor = function() { this.cell.obj = null; this.cell = null; this.grid = null; this.base = null; return null }; this.cell = a; this.getValue = function() { if ((this.cell.textContent) && (this.cell.textContent.tagName == "TEXTAREA")) { return this.cell.textContent.value } else { return this.cell.innerHTML._dhx_trim() } }; this.getMathValue = function() { if (this.cell.original) { return this.cell.original } else { return this.getValue() } }; this.getFont = function() { arOut = new Array(3); if (this.cell.style.fontFamily) { arOut[0] = this.cell.style.fontFamily } if (this.cell.style.fontWeight == "bold" || this.cell.parentNode.style.fontWeight == "bold") { arOut[1] = "bold" } if (this.cell.style.fontStyle == "italic" || this.cell.parentNode.style.fontWeight == "italic") { arOut[1] += "italic" } if (this.cell.style.fontSize) { arOut[2] = this.cell.style.fontSize } else { arOut[2] = "" } return arOut.join("-") }; this.getTextColor = function() { if (this.cell.style.color) { return this.cell.style.color } else { return "#000000" } }; this.getBgColor = function() { return this.cell.style.backgroundColor || "#FFFFFF" }; this.getHorAlign = function() { if (this.cell.style.textAlign) { return this.cell.style.textAlign } else { if (this.cell.style.textAlign) { return this.cell.style.textAlign } else { return "left" } } }; this.getWidth = function() { return this.cell.scrollWidth }; this.setFont = function(c) { fntAr = c.split("-"); this.cell.style.fontFamily = fntAr[0]; this.cell.style.fontSize = fntAr[fntAr.length - 1]; if (fntAr.length == 3) { if (/bold/.test(fntAr[1])) { this.cell.style.fontWeight = "bold" } if (/italic/.test(fntAr[1])) { this.cell.style.fontStyle = "italic" } if (/underline/.test(fntAr[1])) { this.cell.style.textDecoration = "underline" } } }; this.setTextColor = function(c) { this.cell.style.color = c }; this.setBgColor = function(c) { if (c == "") { c = null } this.cell.style.background = c }; this.setHorAlign = function(c) { if (c.length == 1) { if (c == "c") { this.cell.style.textAlign = "center" } else { if (c == "l") { this.cell.style.textAlign = "left" } else { this.cell.style.textAlign = "right" } } } else { this.cell.style.textAlign = c } }; this.wasChanged = function() { if (this.cell.wasChanged) { return true } else { return false } }; this.isCheckbox = function() { var c = this.cell.firstChild; if (c && c.tagName == "INPUT") { type = c.type; if (type == "radio" || type == "checkbox") { return true } else { return false } } else { return false } }; this.isChecked = function() { if (this.isCheckbox()) { return this.cell.firstChild.checked } }; this.isDisabled = function() { return this.cell._disabled }; this.setChecked = function(c) { if (this.isCheckbox()) { if (c != "true" && c != 1) { c = false } this.cell.firstChild.checked = c } }; this.setDisabled = function(c) { if (c != "true" && c != 1) { c = false } if (this.isCheckbox()) { this.cell.firstChild.disabled = c; if (this.disabledF) { this.disabledF(c) } } this.cell._disabled = c } } dhtmlXGridCellObject.prototype = { getAttribute: function(a) { return this.cell._attrs[a] }, setAttribute: function(a, c) { this.cell._attrs[a] = c }, getInput: function() { if (this.obj && (this.obj.tagName == "INPUT" || this.obj.tagName == "TEXTAREA")) { return this.obj } var a = (this.obj || this.cell).getElementsByTagName("TEXTAREA"); if (!a.length) { a = (this.obj || this.cell).getElementsByTagName("INPUT") } return a[0] } }; dhtmlXGridCellObject.prototype.getOldValue = function(a) { return this.val }; dhtmlXGridCellObject.prototype.setValue = function(a) { if ((typeof(a) != "number") && (!a || a.toString()._dhx_trim() == "")) { a = " "; this.cell._clearCell = true } else { this.cell._clearCell = false } this.setCValue(a) }; dhtmlXGridCellObject.prototype.getTitle = function() { return (_isIE ? this.cell.innerText : this.cell.textContent) }; dhtmlXGridCellObject.prototype.setCValue = function(c, a) { this.cell.innerHTML = c; this.grid.callEvent("onCellChanged", [this.cell.parentNode.idd, this.cell._cellIndex, (arguments.length > 1 ? a : c)]) }; dhtmlXGridCellObject.prototype.setCTxtValue = function(a) { this.cell.innerHTML = ""; this.cell.appendChild(document.createTextNode(a)); this.grid.callEvent("onCellChanged", [this.cell.parentNode.idd, this.cell._cellIndex, a]) }; dhtmlXGridCellObject.prototype.setLabel = function(a) { this.cell.innerHTML = a }; dhtmlXGridCellObject.prototype.getMath = function() { if (this._val) { return this.val } else { return this.getValue() } }; function eXcell() { this.obj = null; this.val = null; this.changeState = function() { return false }; this.edit = function() { this.val = this.getValue() }; this.detach = function() { return false }; this.getPosition = function(g) { var a = g; var e = 0; var c = 0; while (a.tagName != "BODY") { e += a.offsetLeft; c += a.offsetTop; a = a.offsetParent } return new Array(e, c) } } eXcell.prototype = new dhtmlXGridCellObject; function eXcell_ed(a) { if (a) { this.cell = a; this.grid = this.cell.parentNode.grid } this.edit = function() { this.cell.atag = (!this.grid.multiLine) ? "INPUT" : "TEXTAREA"; this.val = this.getValue(); this.obj = document.createElement(this.cell.atag); this.obj.setAttribute("autocomplete", "off"); this.obj.style.height = (this.cell.offsetHeight - (this.grid.multiLine ? 9 : 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.cell.setAttribute("excell", "ch"); 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 e = this.grid._RaSeCol[this.cell._cellIndex]; if (this.grid.rowsAr[e]) { var a = this.grid.cells(e, 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.parentNode.idd; c = "1"; this.cell.chstate = "1" } else { c = "0"; this.cell.chstate = "0" } this.cell.setAttribute("excell", "ra"); this.setCValue("", this.cell.chstate) }; function eXcell_txt(a) { if (a) { this.cell = a; this.grid = this.cell.parentNode.grid } this.edit = function() { this.val = this.getValue(); this.obj = document.createElement("TEXTAREA"); this.obj.className = "dhx_textarea"; this.obj.onclick = function(g) { (g || event).cancelBubble = true }; var c = this.grid.getPosition(this.cell); this.obj.value = this.val; this.obj.style.display = ""; this.obj.style.textAlign = this.cell.style.textAlign; document.body.appendChild(this.obj); if (_isOpera) { this.obj.onkeypress = function(g) { if (g.keyCode == 9 || g.keyCode == 27) { return false } } } this.obj.onkeydown = function(h) { var g = (h || event); if (g.keyCode == 9 || g.keyCode == 27) { globalActiveDHTMLGridObject.entBox.focus(); globalActiveDHTMLGridObject.doKey({ keyCode: g.keyCode, shiftKey: g.shiftKey, srcElement: "0" }); return false } }; this.obj.style.left = c[0] + "px"; this.obj.style.top = c[1] + this.cell.offsetHeight + "px"; if (this.cell.offsetWidth < 200) { var e = 200 } else { var e = this.cell.offsetWidth } this.obj.style.width = e + 16 + "px"; if (_isIE) { this.obj.select(); this.obj.value = this.obj.value } this.obj.focus() }; this.detach = function() { var c = ""; c = this.obj.value; if (c == "") { this.cell._clearCell = true } else { this.cell._clearCell = false } this.setValue(c); document.body.removeChild(this.obj); this.obj = null; return this.val != this.getValue() }; this.getValue = function() { if (this.obj) { return this.obj.value } if (this.cell._clearCell) { return "" } if (typeof this.cell._brval != "undefined") { return this.cell._brval } if ((!this.grid.multiLine)) { return this.cell._brval || this.cell.innerHTML } else { return this.cell._brval || this.cell.innerHTML.replace(/]*>/gi, "\n")._dhx_trim() } } } eXcell_txt.prototype = new eXcell; function eXcell_txttxt(a) { if (a) { this.cell = a; this.grid = this.cell.parentNode.grid } this.getValue = function() { if ((this.cell.firstChild) && (this.cell.firstChild.tagName == "TEXTAREA")) { return this.cell.firstChild.value } if (this.cell._clearCell) { return "" } if ((!this.grid.multiLine) && this.cell._brval) { return this.cell._brval } return (_isIE ? this.cell.innerText : this.cell.textContent) }; this.setValue = function(c) { this.cell._brval = c; if (!c || c.toString()._dhx_trim() == "") { c = " "; this.cell._clearCell = true } else { this.cell._clearCell = false } this.setCTxtValue(c) } } eXcell_txttxt.prototype = new eXcell_txt; eXcell_txt.prototype.setValue = function(a) { this.cell._brval = a; if (!a || a.toString()._dhx_trim() == "") { a = " "; this.cell._clearCell = true } else { this.cell._clearCell = false } if ((!this.grid.multiLine) || this.cell._clearCell) { this.setCValue(a, this.cell._brval) } else { this.setCValue(a.replace(/\n/g, "
"), a) } }; function eXcell_co(a) { if (a) { this.cell = a; this.grid = this.cell.parentNode.grid; this.combo = (this.cell._combo || this.grid.getCombo(this.cell._cellIndex)); this.editable = true } this.shiftNext = function() { var c = this.list.options[this.list.selectedIndex + 1]; if (c) { c.selected = true } this.obj.value = this.list.options[this.list.selectedIndex].text; return true }; this.shiftPrev = function() { if (this.list.selectedIndex != 0) { var c = this.list.options[this.list.selectedIndex - 1]; if (c) { c.selected = true } this.obj.value = this.list.options[this.list.selectedIndex].text } return true }; this.edit = function() { this.val = this.getValue(); this.text = this.getText()._dhx_trim(); var g = this.grid.getPosition(this.cell); this.obj = document.createElement("TEXTAREA"); this.obj.className = "dhx_combo_edit"; this.obj.style.height = (this.cell.offsetHeight - (this.grid.multiLine ? 9 : 4)) + "px"; this.obj.wrap = "soft"; this.obj.style.textAlign = this.cell.style.textAlign; this.obj.onclick = function(o) { (o || event).cancelBubble = true }; this.obj.onmousedown = function(o) { (o || event).cancelBubble = true }; this.obj.value = this.text; this.obj.onselectstart = function(o) { if (!o) { o = event } o.cancelBubble = true; return true }; var l = this; this.obj.onkeyup = function(r) { var q = (r || event).keyCode; if (q == 38 || q == 40 || q == 9) { return } var s = this.readonly ? String.fromCharCode(q) : this.value; var u = l.list.options; for (var o = 0; o < u.length; o++) { if (u[o].text.indexOf(s) == 0) { return u[o].selected = true } } }; this.list = document.createElement("SELECT"); this.list.className = "dhx_combo_select"; this.list.style.width = this.cell.offsetWidth + "px"; this.list.style.left = g[0] + "px"; this.list.style.top = g[1] + this.cell.offsetHeight + "px"; this.list.onclick = function(r) { var q = r || window.event; var o = q.target || q.srcElement; if (o.tagName == "OPTION") { o = o.parentNode } l.editable = false; l.grid.editStop(); q.cancelBubble = true }; var c = this.combo.getKeys(); var h = false; var n = 0; for (var e = 0; e < c.length; e++) { var m = this.combo.get(c[e]); this.list.options[this.list.options.length] = new Option(m, c[e]); if (c[e] == this.val) { n = this.list.options.length - 1; h = true } } if (h == false) { this.list.options[this.list.options.length] = new Option(this.text, this.val === null ? "" : this.val); n = 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 = "0px"; this.obj.style.height = "0px" } this.cell.appendChild(this.obj); this.list.options[n].selected = true; if (this.editable) { this.obj.focus(); this.obj.focus() } if (!this.editable) { this.obj.style.visibility = "hidden"; this.obj.style.position = "absolute"; this.list.focus(); this.list.onkeydown = function(o) { o = o || window.event; l.grid.setActive(true); if (o.keyCode < 30) { return l.grid.doKey({ target: l.cell, keyCode: o.keyCode, shiftKey: o.shiftKey, ctrlKey: o.ctrlKey }) } } } }; this.getValue = function() { return ((this.cell.combo_value == window.undefined) ? "" : this.cell.combo_value) }; this.detach = function() { if (this.val != this.getValue()) { this.cell.wasChanged = true } if (this.list.parentNode != null) { if (this.editable) { var c = this.list.options[this.list.selectedIndex]; if (c && c.text == this.obj.value) { this.setValue(this.list.value) } else { var e = (this.cell._combo || this.grid.getCombo(this.cell._cellIndex)); var g = e.values._dhx_find(this.obj.value); if (g != -1) { this.setValue(e.keys[g]) } else { this.setValue(this.cell.combo_value = this.obj.value) } } } else { this.setValue(this.list.value) } } if (this.list.parentNode) { this.list.parentNode.removeChild(this.list) } if (this.obj.parentNode) { this.obj.parentNode.removeChild(this.obj) } return this.val != this.getValue() } } eXcell_co.prototype = new eXcell; eXcell_co.prototype.getText = function() { return this.cell.innerHTML }; eXcell_co.prototype.setValue = function(g) { if (typeof(g) == "object") { var e = dhx4.ajax.xpath("./option", g); if (e.length) { this.cell._combo = new dhtmlXGridComboObject() } for (var c = 0; c < e.length; c++) { this.cell._combo.put(e[c].getAttribute("value"), e[c].firstChild ? e[c].firstChild.data : "") } g = g.firstChild.data } if ((g || "").toString()._dhx_trim() == "") { g = null } this.cell.combo_value = g; if (g !== null) { var a = (this.cell._combo || this.grid.getCombo(this.cell._cellIndex)).get(g); this.setCValue(a === null ? g : a, g) } else { this.setCValue(" ", g) } }; function eXcell_coro(a) { this.base = eXcell_co; this.base(a); this.editable = false } eXcell_coro.prototype = new eXcell_co; function eXcell_cotxt(a) { this.base = eXcell_co; this.base(a) } eXcell_cotxt.prototype = new eXcell_co; eXcell_cotxt.prototype.getText = function() { return (_isIE ? this.cell.innerText : this.cell.textContent) }; eXcell_cotxt.prototype.setValue = function(e) { if (typeof(e) == "object") { var c = dhx4.ajax.xpath("./option", e); if (c.length) { this.cell._combo = new dhtmlXGridComboObject() } for (var a = 0; a < c.length; a++) { this.cell._combo.put(c[a].getAttribute("value"), c[a].firstChild ? c[a].firstChild.data : "") } e = e.firstChild.data } if ((e || "").toString()._dhx_trim() == "") { e = null } if (e !== null) { this.setCTxtValue((this.cell._combo || this.grid.getCombo(this.cell._cellIndex)).get(e) || e, e) } else { this.setCTxtValue(" ", e) } this.cell.combo_value = e }; function eXcell_corotxt(a) { this.base = eXcell_co; this.base(a); this.editable = false } eXcell_corotxt.prototype = new eXcell_cotxt; function eXcell_cp(a) { try { this.cell = a; this.grid = this.cell.parentNode.grid } catch (c) {} this.edit = function() { this.val = this.getValue(); this.obj = document.createElement("SPAN"); this.obj.style.border = "1px solid black"; this.obj.style.position = "absolute"; var e = this.grid.getPosition(this.cell); this.colorPanel(4, this.obj); document.body.appendChild(this.obj); this.obj.style.left = e[0] + "px"; this.obj.style.zIndex = 1000; this.obj.style.top = e[1] + this.cell.offsetHeight + "px" }; this.toolDNum = function(e) { if (e.length == 1) { e = "0" + e } return e }; this.colorPanel = function(q, v) { var m = document.createElement("TABLE"); v.appendChild(m); m.cellSpacing = 0; m.editor_obj = this; m.style.cursor = "default"; m.onclick = function(x) { var w = x || window.event; var n = w.target || w.srcElement; var r = n.parentNode.parentNode.parentNode.editor_obj; if (r) { r.setValue(n._bg); r.grid.editStop() } }; var h = 256 / q; for (var l = 0; l <= (256 / h); l++) { var e = m.insertRow(l); for (var o = 0; o <= (256 / h); o++) { for (var g = 0; g <= (256 / h); g++) { R = new Number(h * l) - (l == 0 ? 0 : 1); G = new Number(h * o) - (o == 0 ? 0 : 1); B = new Number(h * g) - (g == 0 ? 0 : 1); var u = this.toolDNum(R.toString(16)) + "" + this.toolDNum(G.toString(16)) + "" + this.toolDNum(B.toString(16)); var s = e.insertCell(o); s.width = "10px"; s.innerHTML = " "; s.title = u.toUpperCase(); s.style.backgroundColor = "#" + u; s._bg = "#" + u; if (this.val != null && "#" + u.toUpperCase() == this.val.toUpperCase()) { s.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._image_src_value + (this.cell.titFl != null ? "^" + this.cell._brval : "") } else { if (this.cell.firstChild.tagName == "A") { var e = this.cell._image_src_value + (this.cell.titFl != null ? "^" + this.cell._brval : ""); e += "^" + this.cell.lnk; if (this.cell.trg) { e += "^" + this.cell.trg } return e } } }; this.isDisabled = function() { return true } } eXcell_img.prototype = new eXcell; eXcell_img.prototype.getTitle = function() { return this.cell._brval }; eXcell_img.prototype.setValue = function(e) { var c = e; if ((e || "").indexOf("^") != -1) { var a = e.split("^"); e = a[0]; c = this.cell._attrs.title || a[1]; if (a.length > 2) { this.cell.lnk = a[2]; if (a[3]) { this.cell.trg = a[3] } } this.cell.titFl = "1" } if (!this.grid.multiLine) { this.setCValue("", e) } else { this.setCValue("", e) } if (this.cell.lnk) { this.cell.innerHTML = "" + this.cell.innerHTML + "" } this.cell._brval = c; this.cell._image_src_value = e }; function eXcell_icon(a) { this.base = eXcell_ed; this.base(a); try { this.cell = a; this.grid = this.cell.parentNode.grid } catch (c) {} this.setValue = function(e) { this.cell._raw_value = e; this.setCValue('
') }; this.getValue = function() { return this.cell._raw_value }; this.isDisabled = function() { return true } } eXcell_icon.prototype = new eXcell_ed; 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() { if (!this.cell.firstChild.childNodes[1]) { return "" } var e = this.cell.firstChild.childNodes[1].innerHTML.toString()._dhx_trim(); var c = this.grid._aplNFb(e, this.cell._cellIndex); if (isNaN(Number(c))) { return e } return c } } eXcell_dyn.prototype = new eXcell_ed; eXcell_dyn.prototype.getValue = function() { var a = eXcell_ed.prototype.getValue.call(this); return }; eXcell_dyn.prototype.setValue = function(e) { if (!e || isNaN(Number(e))) { if (e !== "") { e = 0 } } else { if (e > 0) { var c = "green"; var a = "dyn_up.gif" } else { if (e == 0) { var c = "black"; var a = "dyn_.gif" } else { var c = "red"; var a = "dyn_down.gif" } } e = this.grid._aplNF(e, this.cell._cellIndex) } this.setCValue("
" + e + "
", e) }; function eXcell_ro(a) { if (a) { this.cell = a; this.grid = this.cell.parentNode.grid } this.edit = function() {}; this.isDisabled = function() { return true }; this.getValue = function() { return this.cell._clearCell ? "" : this.cell.innerHTML.toString()._dhx_trim() } } eXcell_ro.prototype = new eXcell; window.eXcell_hidden = function(a) { if (a) { this.cell = a; this.grid = this.cell.parentNode.grid } this.edit = function() {}; this.isDisabled = function() { return true }; this.getValue = function() { return this.cell.val } }; eXcell_hidden.prototype = new eXcell; eXcell_hidden.prototype.setValue = function(a) { this.cell.val = a }; function eXcell_ron(a) { this.cell = a; this.grid = this.cell.parentNode.grid; this.edit = function() {}; this.isDisabled = function() { return true }; this.getValue = function() { return this.cell._clearCell ? "" : this.cell._orig_value || this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(), this.cell._cellIndex).toString() } } eXcell_ron.prototype = new eXcell; eXcell_ron.prototype.setValue = function(a) { if (a === 0) {} else { if (!a || a.toString()._dhx_trim() == "") { this.setCValue(" "); return this.cell._clearCell = true } } this.cell._orig_value = a; this.cell._clearCell = false; this.setCValue(a ? this.grid._aplNF(a, this.cell._cellIndex) : "0") }; function eXcell_rotxt(a) { this.cell = a; this.grid = this.cell.parentNode.grid; this.edit = function() {}; this.isDisabled = function() { return true }; this.setValue = function(c) { if (!c) { c = " "; this.cell._clearCell = true } else { this.cell._clearCell = false } this.setCTxtValue(c) }; this.getValue = function() { if (this.cell._clearCell) { return "" } return (_isIE ? this.cell.innerText : this.cell.textContent) } } eXcell_rotxt.prototype = new eXcell; function dhtmlXGridComboObject() { this.keys = new dhtmlxArray(); this.values = new dhtmlxArray(); this.put = function(c, e) { for (var a = 0; a < this.keys.length; a++) { if (this.keys[a] == c) { this.values[a] = e; return true } } this.values[this.values.length] = e; this.keys[this.keys.length] = c }; this.get = function(c) { for (var a = 0; a < this.keys.length; a++) { if (this.keys[a] == c) { return this.values[a] } } return null }; this.clear = function() { this.keys = new dhtmlxArray(); this.values = new dhtmlxArray() }; this.remove = function(c) { for (var a = 0; a < this.keys.length; a++) { if (this.keys[a] == c) { this.keys._dhx_removeAt(a); this.values._dhx_removeAt(a); return true } } }; this.size = function() { var a = 0; for (var c = 0; c < this.keys.length; c++) { if (this.keys[c] != null) { a++ } } return a }; this.getKeys = function() { var a = new Array(0); for (var c = 0; c < this.keys.length; c++) { if (this.keys[c] != null) { a[a.length] = this.keys[c] } } return a }; this.save = function() { this._save = new Array(); for (var a = 0; a < this.keys.length; a++) { this._save[a] = [this.keys[a], this.values[a]] } }; this.restore = function() { if (this._save) { this.keys[a] = new Array(); this.values[a] = new Array(); for (var a = 0; a < this._save.length; a++) { this.keys[a] = this._save[a][0]; this.values[a] = this._save[a][1] } } }; return this } function Hashtable() { this.keys = new dhtmlxArray(); this.values = new dhtmlxArray(); return this } Hashtable.prototype = new dhtmlXGridComboObject; if (typeof(window.dhtmlXCellObject) != "undefined") { dhtmlXCellObject.prototype.attachGrid = function(a) { this.callEvent("_onBeforeContentAttach", ["grid"]); 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 = "grid"; if (a && typeof a === "object" && !a.tagName) { a.parent = c; c = a } this.dataObj = new dhtmlXGridObject(c); this.dataObj.setSkin(this.conf.skin); if (typeof(window.dhtmlXTabBarCell) == "function" && this instanceof window.dhtmlXTabBarCell && navigator.userAgent.match(/7[\.\d]* mobile/gi) != null && navigator.userAgent.match(/AppleWebKit/gi) != null) { this.dataObj.objBox.style.webkitOverflowScrolling = "auto" } if (this.conf.skin == "material" && typeof(window.dhtmlXLayoutCell) == "function" && this instanceof window.dhtmlXLayoutCell) { this.cell.childNodes[this.conf.idx.cont].style.overflow = "hidden" } if (this.conf.skin == "dhx_skyblue" && typeof(window.dhtmlXWindowsCell) == "function" && 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 } c = null; this.callEvent("_onContentAttach", []); return this.dataObj } } dhtmlXGridObject.prototype.enableDragAndDrop = function(a) { if (a == "temporary_disabled") { this.dADTempOff = false; a = true } else { this.dADTempOff = true } this.dragAndDropOff = dhx4.s2b(a); this._drag_validate = true; if (a) { this.objBox.ondragstart = function(c) { (c || event).cancelBubble = true; return false } } }; dhtmlXGridObject.prototype.setDragBehavior = function(a) { this.dadmodec = this.dadmodefix = 0; switch (a) { case "child": this.dadmode = 0; this._sbmod = false; break; case "sibling": this.dadmode = 1; this._sbmod = false; break; case "sibling-next": this.dadmode = 1; this._sbmod = true; break; case "complex": this.dadmode = 2; this._sbmod = false; break; case "complex-next": this.dadmode = 2; this._sbmod = true; break } }; dhtmlXGridObject.prototype.enableDragOrder = function(a) { this._dndorder = dhx4.s2b(a) }; dhtmlXGridObject.prototype._checkParent = function(g, c) { var e = this._h2.get[g.idd].parent; if (!e.parent) { return } for (var a = 0; a < c.length; a++) { if (c[a] == e.id) { return true } } return this._checkParent(this.rowsAr[e.id], c) }; dhtmlXGridObject.prototype._createDragNode = function(g, h) { this.editStop(); if (window.dhtmlDragAndDrop.dragNode) { return null } if (!this.dADTempOff) { return null } g.parentObject = new Object(); g.parentObject.treeNod = this; var 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(r, e) { return (q.rowsAr[r].rowIndex > q.rowsAr[e].rowIndex ? 1 : -1) }) } var a = this.getFirstParentOfType(_isIE ? h.srcElement : h.target, "TD"); if (a) { this._dndExtra = a._cellIndex } this._dragged = new Array(); for (var c = 0; c < 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(y, x, w, v, u, s, q, r, o, n, g) { this.source = y || "grid"; this.target = x || "grid"; this.mode = w || "move"; this.dropmode = v || "child"; this.sid = u || 0; this.tid = s; this.sobj = q || null; this.tobj = r || null; this.sExtra = o || null; this.tExtra = n || null; this.before = g || false; 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, this.before) }; dragContext.prototype.set = function(e, c) { this[e] = c; return this }; dragContext.prototype.uid = function(e, c) { this.nid = this.sid; while (this.tobj.rowsAr[this.nid]) { this.nid = this.nid + ((new Date()).valueOf()) } return this }; dragContext.prototype.data = function() { if (this.sobj == this.tobj) { return this.sobj._getRowArray(this.sobj.rowsAr[this.sid]) } if (this.source == "tree") { return this.tobj.treeToGridElement(this.sobj, this.sid, this.tid) } else { return this.tobj.gridToGrid(this.sid, this.sobj, this.tobj) } }; dragContext.prototype.attrs = function() { if (this.source == "tree") { return {} } else { return this.sobj.rowsAr[this.sid]._attrs } }; dragContext.prototype.childs = function() { if (this.source == "treeGrid") { return this.sobj._h2.get[this.sid]._xml_await ? this.sobj._h2.get[this.sid].has_kids : null } return null }; dragContext.prototype.pid = function() { if (!this.tid) { return 0 } if (!this.tobj._h2) { return 0 } if (this.target == "treeGrid") { if (this.dropmode == "child") { return this.tid } else { var c = this.tobj.rowsAr[this.tid]; var a = this.tobj._h2.get[c.idd].parent.id; if ((this.alfa) && (this.tobj._sbmod) && (c.nextSibling)) { var e = this.tobj._h2.get[c.nextSibling.idd].parent.id; if (e == this.tid) { return this.tid } if (e != a) { return e } } return a } } }; dragContext.prototype.ind = function() { if (this.tid == window.unknown) { return this.tobj.rowsBuffer.length } if (this.target == "treeGrid") { if (this.dropmode == "child") { this.tobj.openItem(this.tid) } else { this.tobj.openItem(this.tobj.getParentId(this.tid)) } } var a = this.tobj.rowsBuffer._dhx_find(this.tobj.rowsAr[this.tid]); if ((this.alfa) && (this.tobj._sbmod) && (this.dropmode == "sibling")) { var c = this.tobj.rowsAr[this.tid]; if ((c.nextSibling) && (this._h2.get[c.nextSibling.idd].parent.id == this.tid)) { return a + 1 } } return (a + 1 + ((this.target == "treeGrid" && a >= 0 && this.tobj._h2.get[this.tobj.rowsBuffer[a].idd].state == "minus") ? this.tobj._getOpenLenght(this.tobj.rowsBuffer[a].idd, 0) : 0)) }; dragContext.prototype.img = function() { if ((this.target != "grid") && (this.sobj._h2)) { return this.sobj.getItemImage(this.sid) } else { return null } }; dragContext.prototype.slist = function() { var c = new Array(); for (var a = 0; a < this.sid.length; a++) { c[c.length] = this.sid[a][(this.source == "tree") ? "id" : "idd"] } return c.join(",") }; dhtmlXGridObject.prototype._drag = function(r, h, q, s) { if (this._realfake) { return this._fake._drag() } var o = (this.lastLanding); if (this._autoOpenTimer) { window.clearTimeout(this._autoOpenTimer) } var g = q.parentNode; var e = r.parentObject; if (!g.idd) { g.grid = this; this.dadmodefix = 0 } var n = new dragContext(0, 0, 0, ((g.grid.dadmode == 1 || g.grid.dadmodec) ? "sibling" : "child")); if (e && e.childNodes) { n.set("source", "tree").set("sobj", e.treeNod).set("sid", n.sobj._dragged) } else { if (!e) { return true } if (e.treeNod.isTreeGrid && e.treeNod.isTreeGrid()) { n.set("source", "treeGrid") } n.set("sobj", e.treeNod).set("sid", n.sobj._dragged) } if (g.grid.isTreeGrid()) { n.set("target", "treeGrid") } else { n.set("dropmode", "sibling") } n.set("tobj", g.grid).set("tid", g.idd); if (((n.tobj.dadmode == 2) && (n.tobj.dadmodec == 1)) && (n.tobj.dadmodefix < 0)) { if (n.tobj.obj.rows[1].idd != n.tid) { n.tid = g.previousSibling.idd } else { if (this._h2 && n.tid) { n.before = true } else { n.tid = 0 } } } var a = this.getFirstParentOfType(s, "TD"); if (a) { n.set("tExtra", a._cellIndex) } if (a) { n.set("sExtra", n.sobj._dndExtra) } if (n.sobj.dpcpy) { n.set("mode", "copy") } if (n.tobj._realfake) { n.tobj = n.tobj._fake } if (n.sobj._realfake) { n.sobj = n.sobj._fake } n.tobj._clearMove(); if (e && e.treeNod && e.treeNod._nonTrivialRow) { e.treeNod._nonTrivialRow(this, n.tid, n.dropmode, e) } else { n.tobj.dragContext = n; if (!n.tobj.callEvent("onDrag", [n.slist(), n.tid, n.sobj, n.tobj, n.sExtra, n.tExtra])) { return n.tobj.dragContext = null } var u = new Array(); if (typeof(n.sid) == "object") { var m = n.copy(); for (var l = 0; l < n.sid.length; l++) { if (!m.set("alfa", (!l)).set("sid", n.sid[l][(n.source == "tree" ? "id" : "idd")]).valid()) { continue } m.tobj._dragRoutine(m); if (m.target == "treeGrid" && m.dropmode == "child") { m.tobj.openItem(m.tid) } u[u.length] = m.nid; m.set("dropmode", "sibling").set("tid", m.nid) } m.close() } else { n.tobj._dragRoutine(n) } if (n.tobj.laterLink) { n.tobj.laterLink() } n.tobj.callEvent("onDrop", [n.slist(), n.tid, u.join(","), n.sobj, n.tobj, n.sExtra, n.tExtra]) } n.tobj.dragContext = null; n.close() }; dhtmlXGridObject.prototype._dragRoutine = function(r) { if ((r.sobj == r.tobj) && (r.source == "grid") && (r.mode == "move") && !this._fake) { if (r.sobj._dndProblematic) { return } var o = r.sobj.rowsAr[r.sid]; var q = r.sobj.rowsCol._dhx_find(o); r.sobj.rowsCol._dhx_removeAt(r.sobj.rowsCol._dhx_find(o)); r.sobj.rowsBuffer._dhx_removeAt(r.sobj.rowsBuffer._dhx_find(o)); r.sobj.rowsBuffer._dhx_insertAt(r.ind(), o); if (r.tobj._fake) { r.tobj._fake.rowsCol._dhx_removeAt(q); var s = r.tobj._fake.rowsAr[r.sid]; s.parentNode.removeChild(s) } r.sobj._insertRowAt(o, r.ind() - (this.pagingOn ? ((this.currentPage - 1) * this.rowsBufferOutSize) : 0)); r.nid = r.sid; r.sobj.callEvent("onGridReconstructed", []); return } var n; if (this._h2 && typeof r.tid != "undefined" && r.dropmode == "sibling" && (this._sbmod || r.tid)) { if (r.before) { n = r.uid().tobj.addRowBefore(r.nid, r.data(), r.tid, r.img(), r.childs()) } else { if (r.alfa && this._sbmod && this._h2.get[r.tid].childs.length) { this.openItem(r.tid); n = r.uid().tobj.addRowBefore(r.nid, r.data(), this._h2.get[r.tid].childs[0].id, r.img(), r.childs()) } else { n = r.uid().tobj.addRowAfter(r.nid, r.data(), r.tid, r.img(), r.childs()) } } } else { n = r.uid().tobj.addRow(r.nid, r.data(), r.ind(), r.pid(), r.img(), r.childs()) } n._attrs = r.attrs(); if (r.source == "tree") { this.callEvent("onRowAdded", [r.nid]); var a = r.sobj._globalIdStorageFind(r.sid); if (a.childsCount) { var m = r.copy().set("tid", r.nid).set("dropmode", r.target == "grid" ? "sibling" : "child"); for (var g = 0; g < a.childsCount; g++) { r.tobj._dragRoutine(m.set("sid", a.childNodes[g].id)); if (r.mode == "move") { g-- } } m.close() } } else { r.tobj._copyUserData(r); this.callEvent("onRowAdded", [r.nid]); if ((r.source == "treeGrid")) { if (r.sobj == r.tobj) { n._xml = r.sobj.rowsAr[r.sid]._xml } var h = r.sobj._h2.get[r.sid]; if ((h) && (h.childs.length)) { var m = r.copy().set("tid", r.nid); if (r.target == "grid") { m.set("dropmode", "sibling") } else { if (!m.tobj.kidsXmlFile) { m.tobj.openItem(r.tid) } m.set("dropmode", "child") } var e = h.childs.length; if (!m.tobj.kidsXmlFile) { for (var g = 0; g < e; g++) { r.sobj.render_row_tree(null, h.childs[g].id); r.tobj._dragRoutine(m.set("sid", h.childs[g].id)); if (e != h.childs.length) { g--; e = h.childs.length } } } m.close() } } } if (r.mode == "move") { r.sobj[(r.source == "tree") ? "deleteItem" : "deleteRow"](r.sid); if ((r.sobj == r.tobj) && (!r.tobj.rowsAr[r.sid])) { r.tobj.changeRowId(r.nid, r.sid); r.nid = r.sid } } }; dhtmlXGridObject.prototype.gridToGrid = function(g, a, e) { var h = new Array(); for (var c = 0; c < a.hdr.rows[0].cells.length; c++) { h[c] = a.cells(g, c).getValue() } return h }; dhtmlXGridObject.prototype.checkParentLine = function(a, c) { if ((!this._h2) || (!c) || (!a)) { return false } if (a.id == c) { return true } else { return this.checkParentLine(a.parent, c) } }; dhtmlXGridObject.prototype._dragIn = function(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 != "")) { var e = this; this._autoOpenTimer = window.setTimeout(function() { e._autoOpenItem(null, e); e = null }, 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(l, c, n, h) { if (!l.parentNode.idd) { return } var e = dhx4.absTop(l); var a = dhx4.absTop(this.objBox); if ((e - a) > (parseInt(this.objBox.offsetHeight) - 50)) { this.objBox.scrollTop = parseInt(this.objBox.scrollTop) + 20 } if ((e - a + parseInt(this.objBox.scrollTop)) < (parseInt(this.objBox.scrollTop) + 30)) { this.objBox.scrollTop = parseInt(this.objBox.scrollTop) - 20 } if (h) { return 0 } if (this.dadmode == 2) { var m = n - e + (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 = -1 } else { this.dadmodefix = 1 } } else { this.dadmodec = 0 } } else { this.dadmodec = this.dadmode } if (this.dadmodec) { if (!this._sdrgc) { this._createSdrgc() } this._sdrgc.style.display = "block"; this._sdrgc.style.top = e - a + parseInt(this.objBox.scrollTop) + ((this.dadmodefix >= 0) ? l.offsetHeight : 0) + "px" } else { this._llSelD = l; if (l.parentNode.tagName == "TR") { for (var g = 0; g < l.parentNode.childNodes.length; g++) { var m = l.parentNode.childNodes[g]; m.className += " dhx_row_drag_active" } } } }; 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].className = (c[a].className || "").replace(" dhx_row_drag_active", "") } } this._llSelD = null }; dhtmlXGridObject.prototype.rowToDragElement = function(a) { var c = this.cells(a, 0).getValue(); return c }; dhtmlXGridObject.prototype._copyUserData = function(g) { if (!g.tobj.UserData[g.nid] || g.tobj != g.sobj) { g.tobj.UserData[g.nid] = new Hashtable() } else { return } var e = g.sobj.UserData[g.sid]; var a = g.tobj.UserData[g.nid]; if (e) { a.keys = a.keys.concat(e.keys); a.values = a.values.concat(e.values) } }; dhtmlXGridObject.prototype.moveRow = function(e, g, a, c) { switch (g) { case "row_sibling": this.moveRowTo(e, a, "move", "sibling", this, c); break; case "up": this.moveRowUp(e); break; case "down": this.moveRowDown(e); break } }; dhtmlXGridObject.prototype._nonTrivialNode = function(r, q, m, n, e) { if ((r.callEvent) && (!e)) { if (!r.callEvent("onDrag", [n.idd, q.id, (m ? m.id : null), this, r])) { return false } } var o = n.idd; var a = o; while (r._idpull[a]) { a += (new Date()).getMilliseconds().toString() } var h = (this.isTreeGrid() ? this.getItemImage(o) : ""); if (m) { for (g = 0; g < q.childsCount; g++) { if (q.childNodes[g] == m) { break } } if (g != 0) { m = q.childNodes[g - 1] } else { st = "TOP"; m = "" } } var c = r._attachChildNode(q, a, this.gridToTreeElement(r, a, o), "", h, h, h, "", "", m); if (this._h2) { var l = this._h2.get[o]; if (l.childs.length) { for (var g = 0; g < l.childs.length; g++) { this._nonTrivialNode(r, c, 0, this.rowsAr[l.childs[g].id], 1); if (!this.dpcpy) { g-- } } } } if (!this.dpcpy) { this.deleteRow(o) } if ((r.callEvent) && (!e)) { r.callEvent("onDrop", [a, q.id, (m ? m.id : null), this, r]) } }; dhtmlXGridObject.prototype.gridToTreeElement = function(c, e, a) { return this.cells(a, 0).getValue() }; dhtmlXGridObject.prototype.treeToGridElement = function(g, h, a) { var c = new Array(); var l = this.cellType._dhx_find("tree"); if (l == -1) { l = 0 } for (var e = 0; e < this.getColumnCount(); e++) { c[c.length] = (e != l) ? (g.getUserData(h, this.getColumnId(e)) || "") : g.getItemText(h) } return c }; dhtmlXGridObject.prototype.moveRowTo = function(g, e, m, l, a, h) { var n = new dragContext((a || this).isTreeGrid() ? "treeGrid" : "grid", (h || this).isTreeGrid() ? "treeGrid" : "grid", m, l || "sibling", g, e, a || this, h || this); n.tobj._dragRoutine(n); n.close(); return n.nid }; dhtmlXGridObject.prototype.enableMercyDrag = function(a) { this.dpcpy = dhx4.s2b(a) }; dhtmlXGridObject.prototype.toPDF = function(g, q, v, s, n, C) { var h = { row: (this.getSelectedRowId() || "").split(this.delim), col: this.getSelectedCellIndex() }; if (h.row === null || h.col === -1) { h = false } else { if (h.row) { for (var w = 0; w < h.row.length; w++) { if (h.row[w]) { var c = this.cells(h.row[w], h.col).cell; c.parentNode.className = c.parentNode.className.replace(" rowselected", ""); c.className = c.className.replace(" cellselected", ""); h.row[w] = c } } } else { h = false } } q = q || "color"; var x = q == "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 += o(); return L } function e() { var D = []; if (n) { for (var E = 0; E < n.length; E++) { D.push(u(a.getRowIndex(n[E]))) } } else { for (var E = 0; E < a.getRowsNum(); E++) { D.push(u(E)) } } return D.join("\n") } function o() { 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 m(E, D) { return (window.getComputedStyle ? (window.getComputedStyle(E, null)[D]) : (E.currentStyle ? E.currentStyle[D] : null)) || "" } function u(H) { if (!a.rowsBuffer[H]) { return "" } var D = a.render_row(H); if (D.style.display == "none") { return "" } var E = a.isTreeGrid() ? ' level="' + a.getLevel(D.idd) + '"' : ""; var L = ""; for (var J = 0; J < a._cCount; J++) { if (((!a._srClmn) || (a._srClmn[J])) && (!a._hrrar[J] || (a._fake && J < a._fake.hdrLabels.length))) { var P = a.cells(D.idd, J); if (x) { var I = m(P.cell, "color"); var O = m(P.cell, "backgroundColor"); var N = m(P.cell, "font-weight") || m(P.cell, "fontWeight"); var K = m(P.cell, "font-style") || m(P.cell, "fontStyle"); var M = m(P.cell, "text-align") || m(P.cell, "textAlign"); var F = m(P.cell, "font-family") || m(P.cell, "fontFamily"); if (O == "transparent" || O == "rgba(0, 0, 0, 0)") { O = "rgb(255,255,255)" } L += "" } else { L += "" } L += "" } } return L + "" } function r() { var D = ""; return D } var y = document.createElement("div"); y.style.display = "none"; document.body.appendChild(y); var l = "form_" + a.uid(); y.innerHTML = '
'; document.getElementById(l).firstChild.value = encodeURIComponent(A(q).replace("\u2013", "-") + e() + r()); document.getElementById(l).submit(); y.parentNode.removeChild(y); a = null; if (h && h.row.length) { for (var w = 0; w < h.row.length; w++) { h.row[w].parentNode.className += " rowselected"; if (h.row.length == 1) { h.row[w].className += " cellselected" } } } h = null }; dhtmlXGridObject.prototype._serialiseExportConfig = function(l) { function h(q) { if (typeof(q) !== "string") { return q } q = q.replace(/&/g, "&"); q = q.replace(/"/g, """); q = q.replace(/'/g, "'"); q = q.replace(//g, ">"); return q } var c = ""; for (var e = 0; e < this.hdr.rows[0].cells.length; e++) { if (this._srClmn && !this._srClmn[e]) { continue } if (this._hrrar[e] && (!this._fake || e >= this._fake.hdrLabels.length)) { continue } var g = this.fldSort[e]; if (g == "cus") { g = this._customSorts[e].toString(); g = g.replace(/function[\ ]*/, "").replace(/\([^\f]*/, "") } var o = l[1][e]; var m = ((o[1] && o[1] > 1) ? ' rowspan="' + o[1] + '" ' : "") + ((o[0] && o[0] > 1) ? ' colspan="' + o[0] + '" ' : ""); c += "" } return c += "" }; if (window.eXcell_sub_row_grid) { window.eXcell_sub_row_grid.prototype.getContent = function() { return "" } } dhtmlXGridObject.prototype.toExcel = function(a, g, m, l, c) { if (!document.getElementById("ifr")) { var h = document.createElement("iframe"); h.style.display = "none"; h.setAttribute("name", "dhx_export_iframe"); h.setAttribute("src", ""); h.setAttribute("id", "dhx_export_iframe"); document.body.appendChild(h) } var e = ' target="dhx_export_iframe"'; this.toPDF(a, g, m, l, c, e) }; dhtmlXGridObject.prototype.filterBy = function(e, g, c) { if (this.isTreeGrid()) { return this.filterTreeBy(e, g, c) } if (this._f_rowsBuffer) { if (!c) { this.rowsBuffer = dhtmlxArray([].concat(this._f_rowsBuffer)); if (this._fake) { this._fake.rowsBuffer = this.rowsBuffer } } } else { this._f_rowsBuffer = [].concat(this.rowsBuffer) } if (!this.rowsBuffer.length) { return } var h = true; this.dma(true); if (typeof(e) == "object") { for (var a = 0; a < g.length; a++) { this._filterA(e[a], g[a]) } } else { this._filterA(e, g) } this.dma(false); if (this.pagingOn && this.rowsBuffer.length / this.rowsBufferOutSize < (this.currentPage - 1)) { this.changePage(0) } this._reset_view(); this.callEvent("onGridReconstructed", []) }; dhtmlXGridObject.prototype._filterA = function(c, e) { if (e == "") { return } var g = true; if (typeof(e) == "function") { g = false } else { e = (e || "").toString().toLowerCase() } if (!this.rowsBuffer.length) { return } for (var a = this.rowsBuffer.length - 1; a >= 0; a--) { if (g ? (this._get_cell_value(this.rowsBuffer[a], c).toString().toLowerCase().indexOf(e) == -1) : (!e.call(this, this._get_cell_value(this.rowsBuffer[a], c), this.rowsBuffer[a].idd))) { this.rowsBuffer.splice(a, 1) } } }; dhtmlXGridObject.prototype.getFilterElement = function(a) { if (!this.filters) { return } for (var c = 0; c < this.filters.length; c++) { if (this.filters[c][1] == a) { return (this.filters[c][0].combo || this.filters[c][0]) } } return null }; dhtmlXGridObject.prototype.getFilterElementById = function(c) { var a = this.getColIndexById(c); return this.getFilterElement(this._m_order ? this._m_order[a] : a) }; dhtmlXGridObject.prototype.collectValues = function(g) { var u = this.dhxevs.data.oncollectvalues; if (u) { var q = true; for (var r in u) { var w = u[r].call(this, g); if (w !== true) { q = w || q } } if (q !== true) { return q } } if (this.isTreeGrid()) { return this.collectTreeValues(g) } this.dma(true); this._build_m_order(); g = this._m_order ? this._m_order[g] : g; var n = {}; var l = []; var e = this._f_rowsBuffer || this.rowsBuffer; for (var h = 0; h < e.length; h++) { var a = this._get_cell_value(e[h], g); if (a && (!e[h]._childIndexes || e[h]._childIndexes[g] != e[h]._childIndexes[g - 1])) { n[a] = true } } this.dma(false); var o = (this.combos[g] || (this._col_combos && this._col_combos[g] ? this._col_combos[g] : ((this._sub_trees && this._sub_trees[g]) ? this._sub_trees[g][0] : false))); for (var m in n) { if (n[m] === true) { if (o) { if (o.get && o.get(m)) { m = o.get(m) } else { if (o.getOption && o.getOption(m)) { m = o.getOption(m).text } else { if (o.getItemText) { var s = o.getItemText(m); var v = this._sub_trees[g][1] = this._sub_trees[g][1] || {}; v[s] = m; m = s } } } } l.push(m) } } return l.sort() }; dhtmlXGridObject.prototype._build_m_order = function() { if (this._c_order) { this._m_order = []; for (var a = 0; a < this._c_order.length; a++) { this._m_order[this._c_order[a]] = a } } }; dhtmlXGridObject.prototype.filterByAll = function() { var e = []; var c = []; this._build_m_order(); for (var g = 0; g < this.filters.length; g++) { var l = this._m_order ? this._m_order[this.filters[g][1]] : this.filters[g][1]; if (l >= this._cCount) { continue } c.push(l); var m = this.filters[g][0].old_value = this.filters[g][0].value; if (this.filters[g][0]._filter) { m = this.filters[g][0]._filter() } var h; if (typeof m != "function" && (h = (this.combos[l] || ((this._col_combos && this._col_combos[l]) ? this._col_combos[l] : ((this._sub_trees && this._sub_trees[l]) ? this._sub_trees[l][1] : false))))) { if (h.values) { l = h.values._dhx_find(m); m = (l == -1) ? m : h.keys[l] } else { if (h.getOptionByLabel) { m = (h.getOptionByLabel(m) ? h.getOptionByLabel(m).value : m) } else { m = h[m] } } } e.push(m) } if (!this.callEvent("onFilterStart", [c, e])) { return } this.filterBy(c, e); if (this._cssEven) { this._fixAlterCss() } this.callEvent("onFilterEnd", [this.filters]); if (this._f_rowsBuffer && this.rowsBuffer.length == this._f_rowsBuffer.length) { this._f_rowsBuffer = null } }; dhtmlXGridObject.prototype.makeFilter = function(h, e, c) { if (!this.filters) { this.filters = [] } if (typeof(h) != "object") { h = document.getElementById(h) } if (!h) { return } var a = this; if (!h.style.width) { h.style.width = "90%" } if (h.tagName == "SELECT") { this.filters.push([h, e]); this._loadSelectOptins(h, e); h.onchange = function() { a.filterByAll() }; if (_isIE) { h.style.marginTop = "1px" } this.attachEvent("onEditCell", function(m, l, n) { this._build_m_order(); if (m == 2 && this.filters && (this._m_order ? (n == this._m_order[e]) : (n == e))) { this._loadSelectOptins(h, e) } return true }) } else { if (h.tagName == "INPUT") { this.filters.push([h, e]); h.old_value = h.value = ""; h.onkeydown = function() { if (this._timer) { window.clearTimeout(this._timer) } this._timer = window.setTimeout(function() { if (h.value != h.old_value) { a.filterByAll(); h.old_value = h.value } }, 500) } } else { if (h.tagName == "DIV") { this.filters.push([h, e]); h.style.padding = "0px"; h.style.margin = "0px"; if (!window.dhx_globalImgPath) { window.dhx_globalImgPath = this.imgURL } var g = new dhtmlXCombo(h, "_filter", "90%"); g.filterSelfA = g.filterSelf; g.filterSelf = function() { if (this.getSelectedIndex() == 0) { this.setComboText("") } this.filterSelfA.apply(this, arguments); this.optionsArr[0].hide(false) }; g.enableFilteringMode(true); h.combo = g; h.value = ""; this._loadComboOptins(h, e); g.attachEvent("onChange", function() { h.value = g.getSelectedValue(); if (h.value === null) { h.value = "" } a.filterByAll() }) } } } if (h.parentNode) { h.parentNode.className += " filter" } this._filters_ready() }; dhtmlXGridObject.prototype.findCell = function(l, m, g, h) { var h = h || (function(o, n) { return n.toString().toLowerCase().indexOf(o) != -1 }); if (h === true) { h = function(o, n) { return n.toString().toLowerCase() == o } } var e = new Array(); l = l.toString().toLowerCase(); if (typeof g != "number") { g = g ? 1 : 0 } if (!this.rowsBuffer.length) { return e } for (var c = (m || 0); c < this._cCount; c++) { if (this._h2) { this._h2.forEachChild(0, function(n) { if (g && e.length == g) { return e } if (h(l, this._get_cell_value(n.buff, c))) { e.push([n.id, c]) } }, this) } else { for (var a = 0; a < this.rowsBuffer.length; a++) { if (h(l, this._get_cell_value(this.rowsBuffer[a], c))) { e.push([this.rowsBuffer[a].idd, c]); if (g && e.length == g) { return e } } } } if (typeof(m) != "undefined") { return e } } return e }; dhtmlXGridObject.prototype.makeSearch = function(g, e, a) { if (typeof(g) != "object") { g = document.getElementById(g) } if (!g) { return } var c = this; if (g.tagName == "INPUT") { g.onkeypress = function() { if (this._timer) { window.clearTimeout(this._timer) } this._timer = window.setTimeout(function() { if (g.value == "") { return } var h = c.findCell(g.value, e, true, a); if (h.length) { if (c._h2) { c.openItem(h[0][0]) } c.selectCell(c.getRowIndex(h[0][0]), (e || 0)) } }, 500) } } if (g.parentNode) { g.parentNode.className += " filter" } }; dhtmlXGridObject.prototype._loadSelectOptins = function(h, n) { var a = this.collectValues(n); var e = h.value; h.innerHTML = ""; h.options[0] = new Option("", ""); var m = this._filter_tr ? this._filter_tr[n] : null; for (var g = 0; g < a.length; g++) { h.options[h.options.length] = new Option(m ? m(a[g]) : a[g], a[g]) } h.value = e }; dhtmlXGridObject.prototype.setSelectFilterLabel = function(c, a) { if (!this._filter_tr) { this._filter_tr = [] } this._filter_tr[c] = a }; dhtmlXGridObject.prototype._loadComboOptins = function(g, m) { if (!g.combo) { return } var a = this.collectValues(m); g.combo.clearAll(); var h = [ ["", ""] ]; for (var e = 0; e < a.length; e++) { h.push([a[e], a[e]]) } g.combo.addOption(h) }; dhtmlXGridObject.prototype.refreshFilters = function() { if (!this.filters) { return } for (var a = 0; a < this.filters.length; a++) { switch (this.filters[a][0].tagName.toLowerCase()) { case "input": break; case "select": this._loadSelectOptins.apply(this, this.filters[a]); break; case "div": this._loadComboOptins.apply(this, this.filters[a]); break } } }; dhtmlXGridObject.prototype._filters_ready = function(c, a) { this.attachEvent("onXLE", this.refreshFilters); this.attachEvent("onSyncApply", this.refreshFilters); this.attachEvent("onRowCreated", function(h, g) { if (this._f_rowsBuffer) { for (var e = 0; e < this._f_rowsBuffer.length; e++) { if (this._f_rowsBuffer[e].idd == h) { return this._f_rowsBuffer[e] = g } } } }); this.attachEvent("onClearAll", function() { this._f_rowsBuffer = null; if (!this.hdr.rows.length) { this.filters = [] } }); this.attachEvent("onSetSizes", this._filters_resize_combo); this.attachEvent("onResize", this._filters_resize_combo); this._filters_ready = function() {} }; dhtmlXGridObject.prototype._filters_resize_combo = function() { if (!this.filters) { return } for (var a = 0; a < this.filters.length; a++) { if (this.filters[a][0].combo != null) { this.filters[a][0].combo.setSize(Math.round(this.filters[a][0].offsetWidth * 90 / 100)) } } return true }; dhtmlXGridObject.prototype._in_header_text_filter = function(c, a) { c.innerHTML = ""; c.onclick = c.onmousedown = function(g) { (g || event).cancelBubble = true; return true }; c.onselectstart = function() { return (event.cancelBubble = true) }; this.makeFilter(c.firstChild, a) }; dhtmlXGridObject.prototype._in_header_text_filter_inc = function(c, a) { c.innerHTML = ""; c.onclick = c.onmousedown = function(g) { (g || event).cancelBubble = true; return true }; c.onselectstart = function() { return (event.cancelBubble = true) }; this.makeFilter(c.firstChild, a); c.firstChild._filter = function() { if (c.firstChild.value == "") { return "" } return function(e) { return (e.toString().toLowerCase().indexOf(c.firstChild.value.toLowerCase()) == 0) } }; this._filters_ready() }; dhtmlXGridObject.prototype._in_header_select_filter = function(c, a) { c.innerHTML = ""; c.onclick = function(g) { (g || event).cancelBubble = true; return false }; this.makeFilter(c.firstChild, a) }; dhtmlXGridObject.prototype._in_header_select_filter_strict = function(e, c) { e.innerHTML = ""; e.onclick = function(g) { (g || event).cancelBubble = true; return false }; this.makeFilter(e.firstChild, c); var a = this.combos; e.firstChild._filter = function() { var g = e.firstChild.value; if (!g) { return "" } if (a[c]) { g = a[c].keys[a[c].values._dhx_find(g)] } g = g.toLowerCase(); return function(h) { return (h.toString().toLowerCase() == g) } }; this._filters_ready() }; dhtmlXGridObject.prototype._in_header_combo_filter = function(c, a) { c.innerHTML = "
"; c.onselectstart = function() { return (event.cancelBubble = true) }; c.onclick = c.onmousedown = function(g) { (g || event).cancelBubble = true; return true }; this.makeFilter(c.firstChild, a) }; dhtmlXGridObject.prototype._search_common = function(c, a) { c.innerHTML = ""; c.onclick = c.onmousedown = function(g) { (g || event).cancelBubble = true; return true }; c.onselectstart = function() { return (event.cancelBubble = true) } }; dhtmlXGridObject.prototype._in_header_text_search = function(e, c, a) { this._search_common(e, c); this.makeSearch(e.firstChild, c) }; dhtmlXGridObject.prototype._in_header_text_search_strict = function(c, a) { this._search_common(c, a); this.makeSearch(c.firstChild, a, true) }; dhtmlXGridObject.prototype._in_header_numeric_filter = function(c, a) { this._in_header_text_filter.call(this, c, a); c.firstChild._filter = function() { var e = this.value; var h; var m = "=="; var g = parseFloat(e.replace("=", "")); var l = null; if (e) { if (e.indexOf("..") != -1) { e = e.split(".."); g = parseFloat(e[0]); l = parseFloat(e[1]); return function(n) { if (n >= g && n <= l) { return true } return false } } h = e.match(/>=|<=|>|" + h[1]; var a = this; g.getElementsByTagName("input")[0].onclick = function(l) { a._build_m_order(); var c = a._m_order ? a._m_order[e] : e; var m = this.checked ? 1 : 0; a.forEachRowA(function(o) { var n = this.cells(o, c); if (n.isCheckbox() && !n.isDisabled()) { n.setValue(m); n.cell.wasChanged = true } this.callEvent("onEditCell", [1, o, c, m]); this.callEvent("onCheckbox", [o, c, m]); this.callEvent("onCheck", [o, c, m]) }); (l || event).cancelBubble = true } }; dhtmlXGridObject.prototype._in_header_stat_total = function(e, a, h) { var g = function() { var n = 0; this._build_m_order(); var m = this._m_order ? this._m_order[a] : a; for (var l = 0; l < this.rowsBuffer.length; l++) { var c = parseFloat(this._get_cell_value(this.rowsBuffer[l], m)); n += isNaN(c) ? 0 : c } return this._maskArr[m] ? this._aplNF(n, m) : (Math.round(n * 100) / 100) }; this._stat_in_header(e, g, a, h, h) }; dhtmlXGridObject.prototype._in_header_stat_multi_total = function(h, g, o) { var n = o[1].split(":"); o[1] = ""; for (var e = 0; e < n.length; e++) { n[e] = parseInt(n[e]) } var l = function() { var s = 0; for (var r = 0; r < this.rowsBuffer.length; r++) { var q = 1; for (var c = 0; c < n.length; c++) { q *= parseFloat(this._get_cell_value(this.rowsBuffer[r], n[c])) } s += isNaN(q) ? 0 : q } return this._maskArr[g] ? this._aplNF(s, g) : (Math.round(s * 100) / 100) }; var a = []; for (var m = 0; m < n.length; m++) { a[n[m]] = true } this._stat_in_header(h, l, a, o, o) }; dhtmlXGridObject.prototype._in_header_stat_max = function(e, a, h) { var g = function() { this._build_m_order(); var m = this._m_order ? this._m_order[a] : a; var n = -Infinity; for (var l = 0; l < this.rowsBuffer.length; l++) { var c = parseFloat(this._get_cell_value(this.rowsBuffer[l], m)); if (!isNaN(c)) { n = Math.max(n, c) } } if (n === -Infinity) { return " " } return this._maskArr[a] ? this._aplNF(n, a) : n }; this._stat_in_header(e, g, a, h) }; dhtmlXGridObject.prototype._in_header_stat_min = function(e, a, h) { var g = function() { this._build_m_order(); var m = this._m_order ? this._m_order[a] : a; var n = Infinity; for (var l = 0; l < this.rowsBuffer.length; l++) { var c = parseFloat(this._get_cell_value(this.rowsBuffer[l], m)); if (!isNaN(c)) { n = Math.min(n, c) } } if (n === Infinity) { return " " } return this._maskArr[a] ? this._aplNF(n, a) : n }; this._stat_in_header(e, g, a, h) }; dhtmlXGridObject.prototype._in_header_stat_average = function(e, a, h) { var g = function() { this._build_m_order(); var m = this._m_order ? this._m_order[a] : a; var o = 0; var n = 0; if (this.getRowsNum() == 0) { return " " } for (var l = 0; l < this.rowsBuffer.length; l++) { var c = parseFloat(this._get_cell_value(this.rowsBuffer[l], m)); if (!isNaN(c)) { o += c; n++ } } if (n === 0) { return " " } return this._maskArr[a] ? this._aplNF(o / n, a) : (Math.round(o / n * 100) / 100) }; this._stat_in_header(e, g, a, h) }; dhtmlXGridObject.prototype._in_header_stat_count = function(e, a, h) { var g = function() { return this.getRowsNum() }; this._stat_in_header(e, g, a, h) }; dhtmlXGridObject.prototype._stat_in_header = function(e, g, a, m) { var h = this; var l = function() { this.dma(true); e.innerHTML = (m[0] ? m[0] : "") + g.call(this) + (m[1] ? m[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 n = 0; n < this._stat_events.length; n++) { for (var c = 0; c < 4; c++) { this.detachEvent(this._stat_events[n][c]) } } this._stat_events = [] } }) } this._stat_events.push([this.attachEvent("onGridReconstructed", l), this.attachEvent("onXLE", l), this.attachEvent("onFilterEnd", l), this.attachEvent("onEditCell", function(c, o, n) { if (c == 2 && (n == a || (a && a[n]))) { l.call(this) } return true })]); e.innerHTML = "" }; dhtmlXGridObject.prototype.loadCSVFile = function(c, a) { this.load(c, a, "csv") }; dhtmlXGridObject.prototype.enableCSVAutoID = function(a) { this._csvAID = dhx4.s2b(a) }; dhtmlXGridObject.prototype.enableCSVHeader = function(a) { this._csvHdr = dhx4.s2b(a) }; dhtmlXGridObject.prototype.setCSVDelimiter = function(a) { this.csv.cell = a }; dhtmlXGridObject.prototype._csvAID = true; dhtmlXGridObject.prototype.loadCSVString = function(a) { this.parse(a, "csv") }; dhtmlXGridObject.prototype.serializeToCSV = function(n) { this.editStop(); if (this._mathSerialization) { this._agetm = "getMathValue" } else { if (this._strictText || n) { this._agetm = "getTitle" } else { this._agetm = "getValue" } } var l = []; if (this._csvHdr) { for (var h = 1; h < this.hdr.rows.length; h++) { var c = []; for (var m = 0; m < this._cCount; m++) { if ((!this._srClmn) || (this._srClmn[m])) { c.push(this.getColumnLabel(m, h - 1)) } } l.push(this.csvParser.str(c, this.csv.cell, this.csv.row)) } } var m = 0; var g = this.rowsBuffer.length; for (m; m < g; m++) { var e = this._serializeRowToCVS(null, m); if (e != "") { l.push(e) } } return this.csvParser.block(l, this.csv.row) }; dhtmlXGridObject.prototype._serializeRowToCVS = function(a, o, e, m) { var n = new Array(); if (!a) { a = this.render_row(o); if (this._fake && !this._fake.rowsAr[a.idd]) { this._fake.render_row(o) } } if (!this._csvAID) { n[n.length] = a.idd } e = e || 0; m = m || this._cCount; var s = false; var g = e; while (a.childNodes[e]._cellIndex > g && e) { e-- } for (var q = e; g < m; q++) { if (!a.childNodes[q]) { break } var c = a.childNodes[q]._cellIndex; if (((!this._srClmn) || (this._srClmn[c])) && (!this._serialize_visible || !this._hrrar[c])) { var h = a.childNodes[q]; var l = this.cells(a.idd, c); while (g != c) { g++; n.push(""); if (g >= m) { break } } if (g >= m) { break } g++; if (l.cell) { zxVal = l[this._agetm]() } else { zxVal = "" } if ((this._chAttr) && (l.wasChanged())) { s = true } n[n.length] = ((zxVal === null) ? "" : zxVal); if (this._ecspn && h.colSpan && h.colSpan > 1) { h = h.colSpan - 1; for (var v = 0; v < h; v++) { n[n.length] = ""; g++ } } } else { g++ } } if ((this._onlChAttr) && (!s)) { return "" } return this.csvParser.str(n, this.csv.cell, this.csv.row) }; dhtmlXGridObject.prototype.toClipBoard = function(a) { if (window.clipboardData) { window.clipboardData.setData("Text", a) } else { (new Clipboard()).copy(a) } }; dhtmlXGridObject.prototype.fromClipBoard = function() { if (window.clipboardData) { return window.clipboardData.getData("Text") } else { return (new Clipboard()).paste() } }; dhtmlXGridObject.prototype.cellToClipboard = function(e, c) { if ((!e) || (!c && c !== 0)) { if (!this.selectedRows[0]) { return } e = this.selectedRows[0].idd; c = this.cell._cellIndex } var a = this.cells(e, c); this.toClipBoard(((a.getLabel ? a.getLabel() : a.getValue()) || "").toString()) }; dhtmlXGridObject.prototype.updateCellFromClipboard = function(e, c) { if ((!e) || (!c)) { if (!this.selectedRows[0]) { return } e = this.selectedRows[0].idd; c = this.cell._cellIndex } var a = this.cells(e, c); a[a.setImage ? "setLabel" : "setValue"](this.fromClipBoard()) }; dhtmlXGridObject.prototype.rowToClipboard = function(g) { var a = ""; if (this._mathSerialization) { this._agetm = "getMathValue" } else { if (this._strictText) { this._agetm = "getTitle" } else { this._agetm = "getValue" } } this._serialize_visible = !this._fake; if (g) { a = this._serializeRowToCVS(this.getRowById(g)) } else { var e = []; for (var c = 0; c < this.selectedRows.length; c++) { e[e.length] = this._serializeRowToCVS(this.selectedRows[c]); a = this.csvParser.block(e, this.csv.row) } } this._serialize_visible = false; this.toClipBoard(a) }; dhtmlXGridObject.prototype.updateRowFromClipboard = function(h) { var a = this.fromClipBoard(); if (!a) { return } if (h) { var g = this.getRowById(h) } else { var g = this.selectedRows[0] } if (!g) { return } var l = this.csvParser; a = l.unblock(a, this.csv.cell, this.csv.row)[0]; if (!this._csvAID) { a.splice(0, 1) } for (var e = 0; e < a.length; e++) { var c = this.cells3(g, e); c[c.setImage ? "setLabel" : "setValue"](a[e]) } }; dhtmlXGridObject.prototype.csvParser = { block: function(a, c) { return a.join(c) }, unblock: function(l, a, h) { var g = (l || "").split(h); for (var c = 0; c < g.length; c++) { g[c] = (g[c] || "").split(a) } var e = g.length - 1; if (g[e].length == 1 && g[e][0] == "") { g.splice(e, 1) } return g }, str: function(c, a, e) { return c.join(a) } }; dhtmlXGridObject.prototype.csvExtParser = { _quote: RegExp('"', "g"), _quote_esc: RegExp('""', "g"), block: function(a, c) { return a.join(c) }, unblock: function(n, r, u) { var e = [ [] ]; var c = 0; if (!n) { return e } var o = /^[ ]*"/; var m = /"[ ]*$/; var a = new RegExp(".*" + u + ".*$"); var h = n.split(r); for (var g = 0; g < h.length; g++) { if (h[g].match(o)) { var s = h[g].replace(o, ""); while (!h[g].match(m)) { g++; s += h[g] } e[c].push(s.replace(m, "").replace(this._quote_esc, '"')) } else { if (h[g].match(a)) { var l = h[g].indexOf(u); e[c].push(h[g].substr(0, l)); c++; e[c] = []; h[g] = h[g].substr(l + 1); g-- } else { if (h[g] || g != h.length - 1) { e[c].push(h[g]) } } } } var q = e.length - 1; if (q > 0 && !e[q].length) { e.splice(q, 1) } return e }, str: function(e, a, g) { for (var c = 0; c < e.length; c++) { e[c] = '"' + e[c].replace(this._quote, '""') + '"' } return e.join(a) } }; dhtmlXGridObject.prototype.addRowFromClipboard = function() { var a = this.fromClipBoard(); if (!a) { return } var e = this.csvParser.unblock(a, this.csv.cell, this.csv.row); for (var c = 0; c < e.length; c++) { if (e[c]) { a = e[c]; if (!a.length) { continue } if (this._csvAID) { this.addRow(this.getRowsNum() + 2, a) } else { if (this.rowsAr[a[0]]) { a[0] = this.uid() } this.addRow(a[0], a.slice(1)) } } } }; dhtmlXGridObject.prototype.gridToClipboard = function() { this.toClipBoard(this.serializeToCSV()) }; dhtmlXGridObject.prototype.gridFromClipboard = function() { var a = this.fromClipBoard(); if (!a) { return } this.loadCSVString(a) }; dhtmlXGridObject.prototype.getXLS = function(m) { if (!this.xslform) { this.xslform = document.createElement("FORM"); this.xslform.action = (m || "") + "xls.php"; this.xslform.method = "post"; this.xslform.target = (_isIE ? "_blank" : ""); document.body.appendChild(this.xslform); var h = document.createElement("INPUT"); h.type = "hidden"; h.name = "csv"; this.xslform.appendChild(h); var g = document.createElement("INPUT"); g.type = "hidden"; g.name = "csv_header"; this.xslform.appendChild(g) } var n = this.serializeToCSV(); this.xslform.childNodes[0].value = n; var e = []; var a = this._cCount; for (var c = 0; c < a; c++) { e.push(this.getHeaderCol(c)) } e = e.join(","); this.xslform.childNodes[1].value = e; this.xslform.submit() }; dhtmlXGridObject.prototype.printView = function(u, e) { var q = ""; var D = null; if (this._fake) { D = [].concat(this._hrrar); for (var C = 0; C < this._fake._cCount; C++) { this._hrrar[C] = null } } var o = document.location.port; var r = document.location.hostname; q += ""; if (!this.parentGrid) { q += (u || "") } q += ''; var s = Math.max(this.rowsBuffer.length, this.rowsCol.length); var n = this._cCount; var v = this._printWidth(); q += ''; for (var C = 0; C < n; C++) { if (this._hrrar && this._hrrar[C]) { continue } var h = this.hdr.rows[1].cells[this.hdr.rows[1]._childIndexes ? this.hdr.rows[1]._childIndexes[parseInt(C)] : C]; var a = (h.colSpan || 1); var I = (h.rowSpan || 1); for (var A = 1; A < a; A++) { v[C] += v[A] } q += '"; C += a - 1 } q += ""; for (var C = 2; C < this.hdr.rows.length; C++) { if (_isIE) { q += ""; var g = this.hdr.rows[C].childNodes; for (var A = 0; A < g.length; A++) { if (!this._hrrar || !this._hrrar[g[A]._cellIndex]) { q += g[A].outerHTML } } q += "" } else { q += "" + (this._fake ? this._fake.hdr.rows[C].innerHTML : "") + this.hdr.rows[C].innerHTML + "" } } for (var C = 0; C < s; C++) { q += ""; if (this.rowsCol[C] && this.rowsCol[C]._cntr) { q += this.rowsCol[C].innerHTML.replace(/]*>/gi, "") + ""; continue } if (this.rowsCol[C] && this.rowsCol[C].style.display == "none") { continue } var m; if (this.rowsCol[C]) { m = this.rowsCol[C].idd } else { if (this.rowsBuffer[C]) { m = this.rowsBuffer[C].idd } else { continue } } for (var A = 0; A < n; A++) { if (this._hrrar && this._hrrar[A]) { continue } if (this.rowsAr[m] && this.rowsAr[m].tagName == "TR") { var H = this.cells(m, A); if (H._setState) { var w = "" } else { if (H.getContent) { w = H.getContent() } else { if (H.getImage || H.combo) { var w = H.cell.innerHTML } else { var w = H.getValue() } } } } else { var w = this._get_cell_value(this.rowsBuffer[C], A) } var x = this.columnColor[A] ? "background-color:" + this.columnColor[A] + ";" : ""; var y = this.cellAlign[A] ? "text-align:" + this.cellAlign[A] + ";" : ""; var E = H.getAttribute("colspan"); q += '"; if (E) { A += E - 1 } } q += ""; if (this.rowsCol[C] && this.rowsCol[C]._expanded) { var l = this.cells4(this.rowsCol[C]._expanded.ctrl); if (l.getSubGrid) { q += '" } else { q += '" } } } if (this.ftr) { for (var C = 1; C < this.ftr.childNodes[0].rows.length; C++) { q += "" + ((this._fake) ? this._fake.ftr.childNodes[0].rows[C].innerHTML : "") + this.ftr.childNodes[0].rows[C].innerHTML + "" } } q += "
' + this.getHeaderCol(C) + "
" + (w === "" ? " " : w) + "
' + l.getSubGrid().printView() + "
' + this.rowsCol[C]._expanded.innerHTML + "
"; if (this.parentGrid) { return q } q += (e || ""); var F = window.open("", "_blank"); F.document.write(q); F.document.write("