65273 lines
2.1 MiB
65273 lines
2.1 MiB
/*
|
|
Product Name: dhtmlxSuite
|
|
Version: 4.0.3
|
|
Edition: Professional
|
|
License: content of this file is covered by DHTMLX Commercial or Enterprise license. Usage without proper license is prohibited. To obtain it contact sales@dhtmlx.com
|
|
Copyright UAB Dinamenta http://www.dhtmlx.com
|
|
*/
|
|
|
|
if (typeof(window.dhx4) == "undefined") {
|
|
window.dhx4 = {
|
|
version: "4.0.3",
|
|
skin: null,
|
|
skinDetect: function(c) {
|
|
var g = document.createElement("DIV");
|
|
g.className = c + "_skin_detect";
|
|
if (document.body.firstChild) {
|
|
document.body.insertBefore(g, document.body.firstChild)
|
|
} else {
|
|
document.body.appendChild(g)
|
|
}
|
|
var a = g.offsetWidth;
|
|
g.parentNode.removeChild(g);
|
|
g = null;
|
|
return {
|
|
10: "dhx_skyblue",
|
|
20: "dhx_web",
|
|
30: "dhx_terrace"
|
|
}[a] || null
|
|
},
|
|
lastId: 1,
|
|
newId: function() {
|
|
return this.lastId++
|
|
},
|
|
zim: {
|
|
data: {},
|
|
step: 5,
|
|
first: function() {
|
|
return 100
|
|
},
|
|
last: function() {
|
|
var g = this.first();
|
|
for (var c in this.data) {
|
|
g = Math.max(g, this.data[c])
|
|
}
|
|
return g
|
|
},
|
|
reserve: function(a) {
|
|
this.data[a] = this.last() + this.step;
|
|
return this.data[a]
|
|
},
|
|
clear: function(a) {
|
|
if (this.data[a] != null) {
|
|
this.data[a] = null;
|
|
delete this.data[a]
|
|
}
|
|
}
|
|
},
|
|
s2b: function(a) {
|
|
return (a == true || a == 1 || a == "true" || a == "1" || a == "yes" || a == "y")
|
|
},
|
|
trim: function(a) {
|
|
return String(a).replace(/^\s{1,}/, "").replace(/\s{1,}$/, "")
|
|
},
|
|
template: function(c, g, a) {
|
|
return c.replace(/#([a-zA-Z0-9_-]{1,})#/g, function(l, h) {
|
|
if (h.length > 0 && typeof(g[h]) != "undefined") {
|
|
if (a == true) {
|
|
return window.dhx4.trim(g[h])
|
|
}
|
|
return String(g[h])
|
|
}
|
|
return ""
|
|
})
|
|
},
|
|
absLeft: function(a) {
|
|
if (typeof(a) == "string") {
|
|
a = document.getElementById(a)
|
|
}
|
|
return this._aOfs(a).left
|
|
},
|
|
absTop: function(a) {
|
|
if (typeof(a) == "string") {
|
|
a = document.getElementById(a)
|
|
}
|
|
return this._aOfs(a).top
|
|
},
|
|
_aOfsSum: function(a) {
|
|
var g = 0,
|
|
c = 0;
|
|
while (a) {
|
|
g = g + parseInt(a.offsetTop);
|
|
c = c + parseInt(a.offsetLeft);
|
|
a = a.offsetParent
|
|
}
|
|
return {
|
|
top: g,
|
|
left: c
|
|
}
|
|
},
|
|
_aOfsRect: function(h) {
|
|
var n = h.getBoundingClientRect();
|
|
var o = document.body;
|
|
var c = document.documentElement;
|
|
var a = window.pageYOffset || c.scrollTop || o.scrollTop;
|
|
var l = window.pageXOffset || c.scrollLeft || o.scrollLeft;
|
|
var m = c.clientTop || o.clientTop || 0;
|
|
var q = c.clientLeft || o.clientLeft || 0;
|
|
var r = n.top + a - m;
|
|
var g = n.left + l - q;
|
|
return {
|
|
top: Math.round(r),
|
|
left: Math.round(g)
|
|
}
|
|
},
|
|
_aOfs: function(a) {
|
|
if (a.getBoundingClientRect) {
|
|
return this._aOfsRect(a)
|
|
} else {
|
|
return this._aOfsSum(a)
|
|
}
|
|
},
|
|
_isObj: function(a) {
|
|
return (a != null && typeof(a) == "object" && typeof(a.length) == "undefined")
|
|
},
|
|
_copyObj: function(h) {
|
|
if (this._isObj(h)) {
|
|
var g = {};
|
|
for (var c in h) {
|
|
if (typeof(h[c]) == "object" && h[c] != null) {
|
|
g[c] = this._copyObj(h[c])
|
|
} else {
|
|
g[c] = h[c]
|
|
}
|
|
}
|
|
} else {
|
|
var g = [];
|
|
for (var c = 0; c < h.length; c++) {
|
|
if (typeof(h[c]) == "object" && h[c] != null) {
|
|
g[c] = this._copyObj(h[c])
|
|
} else {
|
|
g[c] = h[c]
|
|
}
|
|
}
|
|
}
|
|
return g
|
|
},
|
|
screenDim: function() {
|
|
var a = (navigator.userAgent.indexOf("MSIE") >= 0);
|
|
var c = {};
|
|
c.left = document.body.scrollLeft;
|
|
c.right = c.left + (window.innerWidth || document.body.clientWidth);
|
|
c.top = Math.max((a ? document.documentElement : document.getElementsByTagName("html")[0]).scrollTop, document.body.scrollTop);
|
|
c.bottom = c.top + (a ? Math.max(document.documentElement.clientHeight || 0, document.documentElement.offsetHeight || 0) : window.innerHeight);
|
|
return c
|
|
},
|
|
selectTextRange: function(h, m, c) {
|
|
h = (typeof(h) == "string" ? document.getElementById(h) : h);
|
|
var a = h.value.length;
|
|
m = Math.max(Math.min(m, a), 0);
|
|
c = Math.min(c, a);
|
|
if (h.setSelectionRange) {
|
|
try {
|
|
h.setSelectionRange(m, c)
|
|
} catch (l) {}
|
|
} else {
|
|
if (h.createTextRange) {
|
|
var g = h.createTextRange();
|
|
g.moveStart("character", m);
|
|
g.moveEnd("character", c - a);
|
|
try {
|
|
g.select()
|
|
} catch (l) {}
|
|
}
|
|
}
|
|
},
|
|
transData: null,
|
|
transDetect: function() {
|
|
if (this.transData == null) {
|
|
this.transData = {
|
|
transProp: false,
|
|
transEv: null
|
|
};
|
|
var g = {
|
|
MozTransition: "transitionend",
|
|
WebkitTransition: "webkitTransitionEnd",
|
|
OTransition: "oTransitionEnd",
|
|
msTransition: "transitionend",
|
|
transition: "transitionend"
|
|
};
|
|
for (var c in g) {
|
|
if (this.transData.transProp == false && document.documentElement.style[c] != null) {
|
|
this.transData.transProp = c;
|
|
this.transData.transEv = g[c]
|
|
}
|
|
}
|
|
g = null
|
|
}
|
|
return this.transData
|
|
}
|
|
};
|
|
window.dhx4.isIE = (navigator.userAgent.indexOf("MSIE") >= 0 || navigator.userAgent.indexOf("Trident") >= 0);
|
|
window.dhx4.isIE6 = (window.XMLHttpRequest == null && navigator.userAgent.indexOf("MSIE") >= 0);
|
|
window.dhx4.isIE7 = (navigator.userAgent.indexOf("MSIE 7.0") >= 0 && navigator.userAgent.indexOf("Trident") < 0);
|
|
window.dhx4.isOpera = (navigator.userAgent.indexOf("Opera") >= 0);
|
|
window.dhx4.isChrome = (navigator.userAgent.indexOf("Chrome") >= 0);
|
|
window.dhx4.isKHTML = (navigator.userAgent.indexOf("Safari") >= 0 || navigator.userAgent.indexOf("Konqueror") >= 0);
|
|
window.dhx4.isFF = (navigator.userAgent.indexOf("Firefox") >= 0);
|
|
window.dhx4.isIPad = (navigator.userAgent.search(/iPad/gi) >= 0)
|
|
}
|
|
if (typeof(window.dhx4.ajax) == "undefined") {
|
|
window.dhx4.ajax = {
|
|
cache: false,
|
|
method: "post",
|
|
get: function(a, c) {
|
|
this._call("GET", a, null, true, c)
|
|
},
|
|
getSync: function(a) {
|
|
return this._call("GET", a, null, false)
|
|
},
|
|
post: function(c, a, g) {
|
|
if (arguments.length == 1) {
|
|
a = ""
|
|
} else {
|
|
if (arguments.length == 2 && (typeof(a) == "function" || typeof(window[a]) == "function")) {
|
|
g = a;
|
|
a = ""
|
|
} else {
|
|
a = String(a)
|
|
}
|
|
}
|
|
this._call("POST", c, a, true, g)
|
|
},
|
|
postSync: function(c, a) {
|
|
a = (a == null ? "" : String(a));
|
|
return this._call("POST", c, a, false)
|
|
},
|
|
getLong: function(a, c) {
|
|
this._call("GET", a, null, true, c, {
|
|
url: a
|
|
})
|
|
},
|
|
postLong: function(c, a, g) {
|
|
if (arguments.length == 2 && (typeof(a) == "function" || typeof(window[a]))) {
|
|
g = a;
|
|
a = ""
|
|
}
|
|
this._call("POST", c, a, true, g, {
|
|
url: c,
|
|
postData: a
|
|
})
|
|
},
|
|
_call: function(o, c, a, m, l, h) {
|
|
var g = (window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));
|
|
var n = (navigator.userAgent.match(/AppleWebKit/) != null && navigator.userAgent.match(/Qt/) != null && navigator.userAgent.match(/Safari/) != null);
|
|
if (m == true) {
|
|
g.onreadystatechange = function() {
|
|
if ((g.readyState == 4 && g.status == 200) || (n == true && g.readyState == 3)) {
|
|
window.setTimeout(function() {
|
|
if (typeof(l) == "function") {
|
|
l.apply(window, [{
|
|
xmlDoc: g
|
|
}])
|
|
}
|
|
if (h != null) {
|
|
if (typeof(h.postData) != "undefined") {
|
|
dhx4.ajax.postLong(h.url, h.postData, l)
|
|
} else {
|
|
dhx4.ajax.getLong(h.url, l)
|
|
}
|
|
}
|
|
l = null;
|
|
g = null
|
|
}, 1)
|
|
}
|
|
}
|
|
}
|
|
if (o == "GET" && this.cache != true) {
|
|
c += (c.indexOf("?") >= 0 ? "&" : "?") + "dhxr" + new Date().getTime()
|
|
}
|
|
g.open(o, c, m);
|
|
if (o == "POST") {
|
|
g.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
|
if (this.cache != true) {
|
|
a += (a.length > 0 ? "&" : "") + "dhxr" + new Date().getTime()
|
|
}
|
|
} else {
|
|
a = null
|
|
}
|
|
g.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
|
g.send(a);
|
|
if (!m) {
|
|
return {
|
|
xmlDoc: g
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (typeof(window.dhx4._enableDataLoading) == "undefined") {
|
|
window.dhx4._enableDataLoading = function(obj, initObj, xmlToJson, xmlRootTag, mode) {
|
|
if (mode == "clear") {
|
|
for (var a in obj._dhxdataload) {
|
|
obj._dhxdataload[a] = null;
|
|
delete obj._dhxdataload[a]
|
|
}
|
|
obj._loadData = null;
|
|
obj._dhxdataload = null;
|
|
obj.load = null;
|
|
obj.loadStruct = null;
|
|
obj = null;
|
|
return
|
|
}
|
|
obj._dhxdataload = {
|
|
initObj: initObj,
|
|
xmlToJson: xmlToJson,
|
|
xmlRootTag: xmlRootTag,
|
|
onBeforeXLS: null
|
|
};
|
|
obj._loadData = function(data, loadParams, onLoad) {
|
|
if (arguments.length == 2) {
|
|
onLoad = loadParams;
|
|
loadParams = null
|
|
}
|
|
var obj = null;
|
|
if (arguments.length == 3) {
|
|
onLoad = arguments[2]
|
|
}
|
|
if (typeof(data) == "string") {
|
|
var k = data.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "");
|
|
var tag = new RegExp("^<" + this._dhxdataload.xmlRootTag);
|
|
if (tag.test(k.replace(/^<\?xml[^\?]*\?>\s*/, ""))) {
|
|
if (window.DOMParser) {
|
|
obj = (new window.DOMParser()).parseFromString(data, "text/xml")
|
|
} else {
|
|
if (typeof(window.ActiveXObject) != "undefined") {
|
|
obj = new window.ActiveXObject("Microsoft.XMLDOM");
|
|
obj.async = "false";
|
|
obj.loadXML(data)
|
|
}
|
|
} if (obj != null) {
|
|
obj = this[this._dhxdataload.xmlToJson].apply(this, [obj])
|
|
}
|
|
}
|
|
if (obj == null && (k.match(/^\{.*\}$/) != null || k.match(/^\[.*\]$/) != null)) {
|
|
try {
|
|
eval("dhx4.temp=" + k)
|
|
} catch (e) {
|
|
dhx4.temp = null
|
|
}
|
|
obj = dhx4.temp;
|
|
dhx4.temp = null
|
|
}
|
|
if (obj == null) {
|
|
this.callEvent("onXLS", []);
|
|
var params = [];
|
|
if (typeof(this._dhxdataload.onBeforeXLS) == "function") {
|
|
var k = this._dhxdataload.onBeforeXLS.apply(this, [data]);
|
|
if (k != null && typeof(k) == "object") {
|
|
if (k.url != null) {
|
|
data = k.url
|
|
}
|
|
if (k.params != null) {
|
|
for (var a in k.params) {
|
|
params.push(a + "=" + encodeURIComponent(k.params[a]))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var t = this;
|
|
var callBack = function(r) {
|
|
var obj = null;
|
|
if ((r.xmlDoc.getResponseHeader("Content-Type") || "").search(/xml/gi) >= 0 || (r.xmlDoc.responseText.replace(/^\s{1,}/, "")).match(/^</) != null) {
|
|
obj = t[t._dhxdataload.xmlToJson].apply(t, [r.xmlDoc.responseXML])
|
|
} else {
|
|
try {
|
|
eval("dhx4.temp=" + r.xmlDoc.responseText)
|
|
} catch (e) {
|
|
dhx4.temp = null
|
|
}
|
|
obj = dhx4.temp;
|
|
dhx4.temp = null
|
|
} if (obj != null) {
|
|
t[t._dhxdataload.initObj].apply(t, [obj, data])
|
|
}
|
|
t.callEvent("onXLE", []);
|
|
if (onLoad != null) {
|
|
if (typeof(onLoad) == "function") {
|
|
onLoad.apply(t, [])
|
|
} else {
|
|
if (typeof(window[onLoad]) == "function") {
|
|
window[onLoad].apply(t, [])
|
|
}
|
|
}
|
|
}
|
|
callBack = onLoad = null;
|
|
obj = r = t = null
|
|
};
|
|
params = params.join("&") + (typeof(loadParams) == "string" ? "&" + loadParams : "");
|
|
if (dhx4.ajax.method == "post") {
|
|
dhx4.ajax.post(data, params, callBack)
|
|
} else {
|
|
if (dhx4.ajax.method == "get") {
|
|
dhx4.ajax.get(data + (data.indexOf("?") > 0 ? "" : "") + params, callBack)
|
|
}
|
|
}
|
|
return
|
|
}
|
|
} else {
|
|
if (typeof(data.documentElement) == "object" || (typeof(data.tagName) != "undefined" && typeof(data.getElementsByTagName) != "undefined" && data.getElementsByTagName(this._dhxdataload.xmlRootTag).length > 0)) {
|
|
obj = this[this._dhxdataload.xmlToJson].apply(this, [data])
|
|
} else {
|
|
obj = window.dhx4._copyObj(data)
|
|
}
|
|
} if (obj != null) {
|
|
this[this._dhxdataload.initObj].apply(this, [obj])
|
|
}
|
|
if (onLoad != null) {
|
|
if (typeof(onLoad) == "function") {
|
|
onLoad.apply(this, [])
|
|
} else {
|
|
if (typeof(window[onLoad]) == "function") {
|
|
window[onLoad].apply(this, [])
|
|
}
|
|
}
|
|
onLoad = null
|
|
}
|
|
};
|
|
if (mode != null) {
|
|
var k = {
|
|
struct: "loadStruct",
|
|
data: "load"
|
|
};
|
|
for (var a in mode) {
|
|
if (mode[a] == true) {
|
|
obj[k[a]] = function() {
|
|
return this._loadData.apply(this, arguments)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
obj = null
|
|
}
|
|
}
|
|
if (typeof(window.dhx4._eventable) == "undefined") {
|
|
window.dhx4._eventable = function(a, c) {
|
|
if (c == "clear") {
|
|
a.detachAllEvents();
|
|
a.dhxevs = null;
|
|
a.attachEvent = null;
|
|
a.detachEvent = null;
|
|
a.checkEvent = null;
|
|
a.callEvent = null;
|
|
a.detachAllEvents = null;
|
|
a = null;
|
|
return
|
|
}
|
|
a.dhxevs = {
|
|
data: {}
|
|
};
|
|
a.attachEvent = function(g, l) {
|
|
g = String(g).toLowerCase();
|
|
if (!this.dhxevs.data[g]) {
|
|
this.dhxevs.data[g] = {}
|
|
}
|
|
var h = window.dhx4.newId();
|
|
this.dhxevs.data[g][h] = l;
|
|
return h
|
|
};
|
|
a.detachEvent = function(m) {
|
|
for (var h in this.dhxevs.data) {
|
|
var l = 0;
|
|
for (var g in this.dhxevs.data[h]) {
|
|
if (g == m) {
|
|
this.dhxevs.data[h][g] = null;
|
|
delete this.dhxevs.data[h][g]
|
|
} else {
|
|
l++
|
|
}
|
|
}
|
|
if (l == 0) {
|
|
this.dhxevs.data[h] = null;
|
|
delete this.dhxevs.data[h]
|
|
}
|
|
}
|
|
};
|
|
a.checkEvent = function(g) {
|
|
g = String(g).toLowerCase();
|
|
return (this.dhxevs.data[g] != null)
|
|
};
|
|
a.callEvent = function(h, m) {
|
|
h = String(h).toLowerCase();
|
|
if (this.dhxevs.data[h] == null) {
|
|
return true
|
|
}
|
|
var l = true;
|
|
for (var g in this.dhxevs.data[h]) {
|
|
l = this.dhxevs.data[h][g].apply(this, m) && l
|
|
}
|
|
return l
|
|
};
|
|
a.detachAllEvents = function() {
|
|
for (var h in this.dhxevs.data) {
|
|
for (var g in this.dhxevs.data[h]) {
|
|
this.dhxevs.data[h][g] = null;
|
|
delete this.dhxevs.data[h][g]
|
|
}
|
|
this.dhxevs.data[h] = null;
|
|
delete this.dhxevs.data[h]
|
|
}
|
|
};
|
|
a = null
|
|
}
|
|
}
|
|
dhtmlx = function(g) {
|
|
for (var c in g) {
|
|
dhtmlx[c] = g[c]
|
|
}
|
|
return dhtmlx
|
|
};
|
|
dhtmlx.extend_api = function(a, h, g) {
|
|
var c = window[a];
|
|
if (!c) {
|
|
return
|
|
}
|
|
window[a] = function(n) {
|
|
if (n && typeof n == "object" && !n.tagName) {
|
|
var m = c.apply(this, (h._init ? h._init(n) : arguments));
|
|
for (var l in dhtmlx) {
|
|
if (h[l]) {
|
|
this[h[l]](dhtmlx[l])
|
|
}
|
|
}
|
|
for (var l in n) {
|
|
if (h[l]) {
|
|
this[h[l]](n[l])
|
|
} else {
|
|
if (l.indexOf("on") == 0) {
|
|
this.attachEvent(l, n[l])
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
var m = c.apply(this, arguments)
|
|
} if (h._patch) {
|
|
h._patch(this)
|
|
}
|
|
return m || this
|
|
};
|
|
window[a].prototype = c.prototype;
|
|
if (g) {
|
|
dhtmlXHeir(window[a].prototype, g)
|
|
}
|
|
};
|
|
dhtmlxAjax = {
|
|
get: function(a, g) {
|
|
var c = new dtmlXMLLoaderObject(true);
|
|
c.async = (arguments.length < 3);
|
|
c.waitCall = g;
|
|
c.loadXML(a);
|
|
return c
|
|
},
|
|
post: function(a, g, h) {
|
|
var c = new dtmlXMLLoaderObject(true);
|
|
c.async = (arguments.length < 4);
|
|
c.waitCall = h;
|
|
c.loadXML(a, true, g);
|
|
return c
|
|
},
|
|
getSync: function(a) {
|
|
return this.get(a, null, true)
|
|
},
|
|
postSync: function(a, c) {
|
|
return this.post(a, c, null, true)
|
|
}
|
|
};
|
|
|
|
function dtmlXMLLoaderObject(c, h, g, a) {
|
|
this.xmlDoc = "";
|
|
if (typeof(g) != "undefined") {
|
|
this.async = g
|
|
} else {
|
|
this.async = true
|
|
}
|
|
this.onloadAction = c || null;
|
|
this.mainObject = h || null;
|
|
this.waitCall = null;
|
|
this.rSeed = a || false;
|
|
return this
|
|
}
|
|
dtmlXMLLoaderObject.count = 0;
|
|
dtmlXMLLoaderObject.prototype.waitLoadFunction = function(c) {
|
|
var a = true;
|
|
this.check = function() {
|
|
if ((c) && (c.onloadAction != null)) {
|
|
if ((!c.xmlDoc.readyState) || (c.xmlDoc.readyState == 4)) {
|
|
if (!a) {
|
|
return
|
|
}
|
|
a = false;
|
|
dtmlXMLLoaderObject.count++;
|
|
if (typeof c.onloadAction == "function") {
|
|
c.onloadAction(c.mainObject, null, null, null, c)
|
|
}
|
|
if (c.waitCall) {
|
|
c.waitCall.call(this, c);
|
|
c.waitCall = null
|
|
}
|
|
}
|
|
}
|
|
};
|
|
return this.check
|
|
};
|
|
dtmlXMLLoaderObject.prototype.getXMLTopNode = function(g, a) {
|
|
if (typeof this.xmlDoc.status == "undefined" || this.xmlDoc.status < 400) {
|
|
if (this.xmlDoc.responseXML) {
|
|
var c = this.xmlDoc.responseXML.getElementsByTagName(g);
|
|
if (c.length == 0 && g.indexOf(":") != -1) {
|
|
var c = this.xmlDoc.responseXML.getElementsByTagName((g.split(":"))[1])
|
|
}
|
|
var h = c[0]
|
|
} else {
|
|
var h = this.xmlDoc.documentElement
|
|
} if (h) {
|
|
this._retry = false;
|
|
return h
|
|
}
|
|
if (!this._retry && _isIE) {
|
|
this._retry = true;
|
|
var a = this.xmlDoc;
|
|
this.loadXMLString(this.xmlDoc.responseText.replace(/^[\s]+/, ""), true);
|
|
return this.getXMLTopNode(g, a)
|
|
}
|
|
}
|
|
dhtmlxError.throwError("LoadXML", "Incorrect XML", [(a || this.xmlDoc), this.mainObject]);
|
|
return document.createElement("DIV")
|
|
};
|
|
dtmlXMLLoaderObject.prototype.loadXMLString = function(c, a) {
|
|
if (!_isIE) {
|
|
var g = new DOMParser();
|
|
this.xmlDoc = g.parseFromString(c, "text/xml")
|
|
} else {
|
|
this.xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
|
|
this.xmlDoc.async = this.async;
|
|
this.xmlDoc.onreadystatechange = function() {};
|
|
this.xmlDoc.loadXML(c)
|
|
} if (a) {
|
|
return
|
|
}
|
|
if (this.onloadAction) {
|
|
this.onloadAction(this.mainObject, null, null, null, this)
|
|
}
|
|
if (this.waitCall) {
|
|
this.waitCall();
|
|
this.waitCall = null
|
|
}
|
|
};
|
|
dtmlXMLLoaderObject.prototype.loadXML = function(g, c, a, h) {
|
|
if (this.rSeed) {
|
|
g += ((g.indexOf("?") != -1) ? "&" : "?") + "a_dhx_rSeed=" + (new Date()).valueOf()
|
|
}
|
|
this.filePath = g;
|
|
if ((!_isIE) && (window.XMLHttpRequest)) {
|
|
this.xmlDoc = new XMLHttpRequest()
|
|
} else {
|
|
this.xmlDoc = new ActiveXObject("Microsoft.XMLHTTP")
|
|
} if (this.async) {
|
|
this.xmlDoc.onreadystatechange = new this.waitLoadFunction(this)
|
|
}
|
|
this.xmlDoc.open(c ? "POST" : "GET", g, this.async);
|
|
if (h) {
|
|
this.xmlDoc.setRequestHeader("User-Agent", "dhtmlxRPC v0.1 (" + navigator.userAgent + ")");
|
|
this.xmlDoc.setRequestHeader("Content-type", "text/xml")
|
|
} else {
|
|
if (c) {
|
|
this.xmlDoc.setRequestHeader("Content-type", (this.contenttype || "application/x-www-form-urlencoded"))
|
|
}
|
|
}
|
|
this.xmlDoc.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
|
this.xmlDoc.send(null || a);
|
|
if (!this.async) {
|
|
(new this.waitLoadFunction(this))()
|
|
}
|
|
};
|
|
dtmlXMLLoaderObject.prototype.destructor = function() {
|
|
this._filterXPath = null;
|
|
this._getAllNamedChilds = null;
|
|
this._retry = null;
|
|
this.async = null;
|
|
this.rSeed = null;
|
|
this.filePath = null;
|
|
this.onloadAction = null;
|
|
this.mainObject = null;
|
|
this.xmlDoc = null;
|
|
this.doXPath = null;
|
|
this.doXPathOpera = null;
|
|
this.doXSLTransToObject = null;
|
|
this.doXSLTransToString = null;
|
|
this.loadXML = null;
|
|
this.loadXMLString = null;
|
|
this.doSerialization = null;
|
|
this.xmlNodeToJSON = null;
|
|
this.getXMLTopNode = null;
|
|
this.setXSLParamValue = null;
|
|
return null
|
|
};
|
|
dtmlXMLLoaderObject.prototype.xmlNodeToJSON = function(h) {
|
|
var g = {};
|
|
for (var c = 0; c < h.attributes.length; c++) {
|
|
g[h.attributes[c].name] = h.attributes[c].value
|
|
}
|
|
g._tagvalue = h.firstChild ? h.firstChild.nodeValue : "";
|
|
for (var c = 0; c < h.childNodes.length; c++) {
|
|
var a = h.childNodes[c].tagName;
|
|
if (a) {
|
|
if (!g[a]) {
|
|
g[a] = []
|
|
}
|
|
g[a].push(this.xmlNodeToJSON(h.childNodes[c]))
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
|
|
function callerFunction(a, c) {
|
|
this.handler = function(g) {
|
|
if (!g) {
|
|
g = window.event
|
|
}
|
|
a(g, c);
|
|
return true
|
|
};
|
|
return this.handler
|
|
}
|
|
|
|
function getAbsoluteLeft(a) {
|
|
return getOffset(a).left
|
|
}
|
|
|
|
function getAbsoluteTop(a) {
|
|
return getOffset(a).top
|
|
}
|
|
|
|
function getOffsetSum(a) {
|
|
var g = 0,
|
|
c = 0;
|
|
while (a) {
|
|
g = g + parseInt(a.offsetTop);
|
|
c = c + parseInt(a.offsetLeft);
|
|
a = a.offsetParent
|
|
}
|
|
return {
|
|
top: g,
|
|
left: c
|
|
}
|
|
}
|
|
|
|
function getOffsetRect(h) {
|
|
var n = h.getBoundingClientRect();
|
|
var o = document.body;
|
|
var c = document.documentElement;
|
|
var a = window.pageYOffset || c.scrollTop || o.scrollTop;
|
|
var l = window.pageXOffset || c.scrollLeft || o.scrollLeft;
|
|
var m = c.clientTop || o.clientTop || 0;
|
|
var q = c.clientLeft || o.clientLeft || 0;
|
|
var r = n.top + a - m;
|
|
var g = n.left + l - q;
|
|
return {
|
|
top: Math.round(r),
|
|
left: Math.round(g)
|
|
}
|
|
}
|
|
|
|
function getOffset(a) {
|
|
if (a.getBoundingClientRect) {
|
|
return getOffsetRect(a)
|
|
} else {
|
|
return getOffsetSum(a)
|
|
}
|
|
}
|
|
|
|
function convertStringToBoolean(a) {
|
|
if (typeof(a) == "string") {
|
|
a = a.toLowerCase()
|
|
}
|
|
switch (a) {
|
|
case "1":
|
|
case "true":
|
|
case "yes":
|
|
case "y":
|
|
case 1:
|
|
case true:
|
|
return true;
|
|
break;
|
|
default:
|
|
return false
|
|
}
|
|
}
|
|
|
|
function getUrlSymbol(a) {
|
|
if (a.indexOf("?") != -1) {
|
|
return "&"
|
|
} else {
|
|
return "?"
|
|
}
|
|
}
|
|
|
|
function dhtmlDragAndDropObject() {
|
|
if (window.dhtmlDragAndDrop) {
|
|
return window.dhtmlDragAndDrop
|
|
}
|
|
this.lastLanding = 0;
|
|
this.dragNode = 0;
|
|
this.dragStartNode = 0;
|
|
this.dragStartObject = 0;
|
|
this.tempDOMU = null;
|
|
this.tempDOMM = null;
|
|
this.waitDrag = 0;
|
|
window.dhtmlDragAndDrop = this;
|
|
return this
|
|
}
|
|
dhtmlDragAndDropObject.prototype.removeDraggableItem = function(a) {
|
|
a.onmousedown = null;
|
|
a.dragStarter = null;
|
|
a.dragLanding = null
|
|
};
|
|
dhtmlDragAndDropObject.prototype.addDraggableItem = function(a, c) {
|
|
a.onmousedown = this.preCreateDragCopy;
|
|
a.dragStarter = c;
|
|
this.addDragLanding(a, c)
|
|
};
|
|
dhtmlDragAndDropObject.prototype.addDragLanding = function(a, c) {
|
|
a.dragLanding = c
|
|
};
|
|
dhtmlDragAndDropObject.prototype.preCreateDragCopy = function(a) {
|
|
if ((a || window.event) && (a || event).button == 2) {
|
|
return
|
|
}
|
|
if (window.dhtmlDragAndDrop.waitDrag) {
|
|
window.dhtmlDragAndDrop.waitDrag = 0;
|
|
document.body.onmouseup = window.dhtmlDragAndDrop.tempDOMU;
|
|
document.body.onmousemove = window.dhtmlDragAndDrop.tempDOMM;
|
|
return false
|
|
}
|
|
if (window.dhtmlDragAndDrop.dragNode) {
|
|
window.dhtmlDragAndDrop.stopDrag(a)
|
|
}
|
|
window.dhtmlDragAndDrop.waitDrag = 1;
|
|
window.dhtmlDragAndDrop.tempDOMU = document.body.onmouseup;
|
|
window.dhtmlDragAndDrop.tempDOMM = document.body.onmousemove;
|
|
window.dhtmlDragAndDrop.dragStartNode = this;
|
|
window.dhtmlDragAndDrop.dragStartObject = this.dragStarter;
|
|
document.body.onmouseup = window.dhtmlDragAndDrop.preCreateDragCopy;
|
|
document.body.onmousemove = window.dhtmlDragAndDrop.callDrag;
|
|
window.dhtmlDragAndDrop.downtime = new Date().valueOf();
|
|
if ((a) && (a.preventDefault)) {
|
|
a.preventDefault();
|
|
return false
|
|
}
|
|
return false
|
|
};
|
|
dhtmlDragAndDropObject.prototype.callDrag = function(g) {
|
|
if (!g) {
|
|
g = window.event
|
|
}
|
|
dragger = window.dhtmlDragAndDrop;
|
|
if ((new Date()).valueOf() - dragger.downtime < 100) {
|
|
return
|
|
}
|
|
if (!dragger.dragNode) {
|
|
if (dragger.waitDrag) {
|
|
dragger.dragNode = dragger.dragStartObject._createDragNode(dragger.dragStartNode, g);
|
|
if (!dragger.dragNode) {
|
|
return dragger.stopDrag()
|
|
}
|
|
dragger.dragNode.onselectstart = function() {
|
|
return false
|
|
};
|
|
dragger.gldragNode = dragger.dragNode;
|
|
document.body.appendChild(dragger.dragNode);
|
|
document.body.onmouseup = dragger.stopDrag;
|
|
dragger.waitDrag = 0;
|
|
dragger.dragNode.pWindow = window;
|
|
dragger.initFrameRoute()
|
|
} else {
|
|
return dragger.stopDrag(g, true)
|
|
}
|
|
}
|
|
if (dragger.dragNode.parentNode != window.document.body && dragger.gldragNode) {
|
|
var a = dragger.gldragNode;
|
|
if (dragger.gldragNode.old) {
|
|
a = dragger.gldragNode.old
|
|
}
|
|
a.parentNode.removeChild(a);
|
|
var c = dragger.dragNode.pWindow;
|
|
if (a.pWindow && a.pWindow.dhtmlDragAndDrop.lastLanding) {
|
|
a.pWindow.dhtmlDragAndDrop.lastLanding.dragLanding._dragOut(a.pWindow.dhtmlDragAndDrop.lastLanding)
|
|
}
|
|
if (_isIE) {
|
|
var l = document.createElement("Div");
|
|
l.innerHTML = dragger.dragNode.outerHTML;
|
|
dragger.dragNode = l.childNodes[0]
|
|
} else {
|
|
dragger.dragNode = dragger.dragNode.cloneNode(true)
|
|
}
|
|
dragger.dragNode.pWindow = window;
|
|
dragger.gldragNode.old = dragger.dragNode;
|
|
document.body.appendChild(dragger.dragNode);
|
|
c.dhtmlDragAndDrop.dragNode = dragger.dragNode
|
|
}
|
|
dragger.dragNode.style.left = g.clientX + 15 + (dragger.fx ? dragger.fx * (-1) : 0) + (document.body.scrollLeft || document.documentElement.scrollLeft) + "px";
|
|
dragger.dragNode.style.top = g.clientY + 3 + (dragger.fy ? dragger.fy * (-1) : 0) + (document.body.scrollTop || document.documentElement.scrollTop) + "px";
|
|
if (!g.srcElement) {
|
|
var h = g.target
|
|
} else {
|
|
h = g.srcElement
|
|
}
|
|
dragger.checkLanding(h, g)
|
|
};
|
|
dhtmlDragAndDropObject.prototype.calculateFramePosition = function(l) {
|
|
if (window.name) {
|
|
var g = parent.frames[window.name].frameElement.offsetParent;
|
|
var h = 0;
|
|
var c = 0;
|
|
while (g) {
|
|
h += g.offsetLeft;
|
|
c += g.offsetTop;
|
|
g = g.offsetParent
|
|
}
|
|
if ((parent.dhtmlDragAndDrop)) {
|
|
var a = parent.dhtmlDragAndDrop.calculateFramePosition(1);
|
|
h += a.split("_")[0] * 1;
|
|
c += a.split("_")[1] * 1
|
|
}
|
|
if (l) {
|
|
return h + "_" + c
|
|
} else {
|
|
this.fx = h
|
|
}
|
|
this.fy = c
|
|
}
|
|
return "0_0"
|
|
};
|
|
dhtmlDragAndDropObject.prototype.checkLanding = function(c, a) {
|
|
if ((c) && (c.dragLanding)) {
|
|
if (this.lastLanding) {
|
|
this.lastLanding.dragLanding._dragOut(this.lastLanding)
|
|
}
|
|
this.lastLanding = c;
|
|
this.lastLanding = this.lastLanding.dragLanding._dragIn(this.lastLanding, this.dragStartNode, a.clientX, a.clientY, a);
|
|
this.lastLanding_scr = (_isIE ? a.srcElement : a.target)
|
|
} else {
|
|
if ((c) && (c.tagName != "BODY")) {
|
|
this.checkLanding(c.parentNode, a)
|
|
} else {
|
|
if (this.lastLanding) {
|
|
this.lastLanding.dragLanding._dragOut(this.lastLanding, a.clientX, a.clientY, a)
|
|
}
|
|
this.lastLanding = 0;
|
|
if (this._onNotFound) {
|
|
this._onNotFound()
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlDragAndDropObject.prototype.stopDrag = function(c, g) {
|
|
dragger = window.dhtmlDragAndDrop;
|
|
if (!g) {
|
|
dragger.stopFrameRoute();
|
|
var a = dragger.lastLanding;
|
|
dragger.lastLanding = null;
|
|
if (a) {
|
|
a.dragLanding._drag(dragger.dragStartNode, dragger.dragStartObject, a, (_isIE ? event.srcElement : c.target))
|
|
}
|
|
}
|
|
dragger.lastLanding = null;
|
|
if ((dragger.dragNode) && (dragger.dragNode.parentNode == document.body)) {
|
|
dragger.dragNode.parentNode.removeChild(dragger.dragNode)
|
|
}
|
|
dragger.dragNode = 0;
|
|
dragger.gldragNode = 0;
|
|
dragger.fx = 0;
|
|
dragger.fy = 0;
|
|
dragger.dragStartNode = 0;
|
|
dragger.dragStartObject = 0;
|
|
document.body.onmouseup = dragger.tempDOMU;
|
|
document.body.onmousemove = dragger.tempDOMM;
|
|
dragger.tempDOMU = null;
|
|
dragger.tempDOMM = null;
|
|
dragger.waitDrag = 0
|
|
};
|
|
dhtmlDragAndDropObject.prototype.stopFrameRoute = function(g) {
|
|
if (g) {
|
|
window.dhtmlDragAndDrop.stopDrag(1, 1)
|
|
}
|
|
for (var a = 0; a < window.frames.length; a++) {
|
|
try {
|
|
if ((window.frames[a] != g) && (window.frames[a].dhtmlDragAndDrop)) {
|
|
window.frames[a].dhtmlDragAndDrop.stopFrameRoute(window)
|
|
}
|
|
} catch (c) {}
|
|
}
|
|
try {
|
|
if ((parent.dhtmlDragAndDrop) && (parent != window) && (parent != g)) {
|
|
parent.dhtmlDragAndDrop.stopFrameRoute(window)
|
|
}
|
|
} catch (c) {}
|
|
};
|
|
dhtmlDragAndDropObject.prototype.initFrameRoute = function(g, h) {
|
|
if (g) {
|
|
window.dhtmlDragAndDrop.preCreateDragCopy();
|
|
window.dhtmlDragAndDrop.dragStartNode = g.dhtmlDragAndDrop.dragStartNode;
|
|
window.dhtmlDragAndDrop.dragStartObject = g.dhtmlDragAndDrop.dragStartObject;
|
|
window.dhtmlDragAndDrop.dragNode = g.dhtmlDragAndDrop.dragNode;
|
|
window.dhtmlDragAndDrop.gldragNode = g.dhtmlDragAndDrop.dragNode;
|
|
window.document.body.onmouseup = window.dhtmlDragAndDrop.stopDrag;
|
|
window.waitDrag = 0;
|
|
if (((!_isIE) && (h)) && ((!_isFF) || (_FFrv < 1.8))) {
|
|
window.dhtmlDragAndDrop.calculateFramePosition()
|
|
}
|
|
}
|
|
try {
|
|
if ((parent.dhtmlDragAndDrop) && (parent != window) && (parent != g)) {
|
|
parent.dhtmlDragAndDrop.initFrameRoute(window)
|
|
}
|
|
} catch (c) {}
|
|
for (var a = 0; a < window.frames.length; a++) {
|
|
try {
|
|
if ((window.frames[a] != g) && (window.frames[a].dhtmlDragAndDrop)) {
|
|
window.frames[a].dhtmlDragAndDrop.initFrameRoute(window, ((!g || h) ? 1 : 0))
|
|
}
|
|
} catch (c) {}
|
|
}
|
|
};
|
|
_isFF = false;
|
|
_isIE = false;
|
|
_isOpera = false;
|
|
_isKHTML = false;
|
|
_isMacOS = false;
|
|
_isChrome = false;
|
|
_FFrv = false;
|
|
_KHTMLrv = false;
|
|
_OperaRv = false;
|
|
if (navigator.userAgent.indexOf("Macintosh") != -1) {
|
|
_isMacOS = true
|
|
}
|
|
if (navigator.userAgent.toLowerCase().indexOf("chrome") > -1) {
|
|
_isChrome = true
|
|
}
|
|
if ((navigator.userAgent.indexOf("Safari") != -1) || (navigator.userAgent.indexOf("Konqueror") != -1)) {
|
|
_KHTMLrv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Safari") + 7, 5));
|
|
if (_KHTMLrv > 525) {
|
|
_isFF = true;
|
|
_FFrv = 1.9
|
|
} else {
|
|
_isKHTML = true
|
|
}
|
|
} else {
|
|
if (navigator.userAgent.indexOf("Opera") != -1) {
|
|
_isOpera = true;
|
|
_OperaRv = parseFloat(navigator.userAgent.substr(navigator.userAgent.indexOf("Opera") + 6, 3))
|
|
} else {
|
|
if (navigator.appName.indexOf("Microsoft") != -1) {
|
|
_isIE = true;
|
|
if ((navigator.appVersion.indexOf("MSIE 8.0") != -1 || navigator.appVersion.indexOf("MSIE 9.0") != -1 || navigator.appVersion.indexOf("MSIE 10.0") != -1 || document.documentMode > 7) && document.compatMode != "BackCompat") {
|
|
_isIE = 8
|
|
}
|
|
} else {
|
|
if (navigator.appName == "Netscape" && navigator.userAgent.indexOf("Trident") != -1) {
|
|
_isIE = 8
|
|
} else {
|
|
_isFF = true;
|
|
_FFrv = parseFloat(navigator.userAgent.split("rv:")[1])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
dtmlXMLLoaderObject.prototype.doXPath = function(g, l, h, q) {
|
|
if (_isKHTML || (!_isIE && !window.XPathResult)) {
|
|
return this.doXPathOpera(g, l)
|
|
}
|
|
if (_isIE) {
|
|
if (!l) {
|
|
if (!this.xmlDoc.nodeName) {
|
|
l = this.xmlDoc.responseXML
|
|
} else {
|
|
l = this.xmlDoc
|
|
}
|
|
}
|
|
if (!l) {
|
|
dhtmlxError.throwError("LoadXML", "Incorrect XML", [(l || this.xmlDoc), this.mainObject])
|
|
}
|
|
if (h != null) {
|
|
l.setProperty("SelectionNamespaces", "xmlns:xsl='" + h + "'")
|
|
}
|
|
if (q == "single") {
|
|
return l.selectSingleNode(g)
|
|
} else {
|
|
return l.selectNodes(g) || new Array(0)
|
|
}
|
|
} else {
|
|
var a = l;
|
|
if (!l) {
|
|
if (!this.xmlDoc.nodeName) {
|
|
l = this.xmlDoc.responseXML
|
|
} else {
|
|
l = this.xmlDoc
|
|
}
|
|
}
|
|
if (!l) {
|
|
dhtmlxError.throwError("LoadXML", "Incorrect XML", [(l || this.xmlDoc), this.mainObject])
|
|
}
|
|
if (l.nodeName.indexOf("document") != -1) {
|
|
a = l
|
|
} else {
|
|
a = l;
|
|
l = l.ownerDocument
|
|
}
|
|
var n = XPathResult.ANY_TYPE;
|
|
if (q == "single") {
|
|
n = XPathResult.FIRST_ORDERED_NODE_TYPE
|
|
}
|
|
var m = new Array();
|
|
var c = l.evaluate(g, a, function(r) {
|
|
return h
|
|
}, n, null);
|
|
if (n == XPathResult.FIRST_ORDERED_NODE_TYPE) {
|
|
return c.singleNodeValue
|
|
}
|
|
var o = c.iterateNext();
|
|
while (o) {
|
|
m[m.length] = o;
|
|
o = c.iterateNext()
|
|
}
|
|
return m
|
|
}
|
|
};
|
|
|
|
function _dhtmlxError(c, a, g) {
|
|
if (!this.catches) {
|
|
this.catches = new Array()
|
|
}
|
|
return this
|
|
}
|
|
_dhtmlxError.prototype.catchError = function(c, a) {
|
|
this.catches[c] = a
|
|
};
|
|
_dhtmlxError.prototype.throwError = function(c, a, g) {
|
|
if (this.catches[c]) {
|
|
return this.catches[c](c, a, g)
|
|
}
|
|
if (this.catches.ALL) {
|
|
return this.catches.ALL(c, a, g)
|
|
}
|
|
alert("Error type: " + arguments[0] + "\nDescription: " + arguments[1]);
|
|
return null
|
|
};
|
|
window.dhtmlxError = new _dhtmlxError();
|
|
dtmlXMLLoaderObject.prototype.doXPathOpera = function(g, a) {
|
|
var l = g.replace(/[\/]+/gi, "/").split("/");
|
|
var h = null;
|
|
var c = 1;
|
|
if (!l.length) {
|
|
return []
|
|
}
|
|
if (l[0] == ".") {
|
|
h = [a]
|
|
} else {
|
|
if (l[0] == "") {
|
|
h = (this.xmlDoc.responseXML || this.xmlDoc).getElementsByTagName(l[c].replace(/\[[^\]]*\]/g, ""));
|
|
c++
|
|
} else {
|
|
return []
|
|
}
|
|
}
|
|
for (c; c < l.length; c++) {
|
|
h = this._getAllNamedChilds(h, l[c])
|
|
}
|
|
if (l[c - 1].indexOf("[") != -1) {
|
|
h = this._filterXPath(h, l[c - 1])
|
|
}
|
|
return h
|
|
};
|
|
dtmlXMLLoaderObject.prototype._filterXPath = function(h, g) {
|
|
var m = new Array();
|
|
var g = g.replace(/[^\[]*\[\@/g, "").replace(/[\[\]\@]*/g, "");
|
|
for (var l = 0; l < h.length; l++) {
|
|
if (h[l].getAttribute(g)) {
|
|
m[m.length] = h[l]
|
|
}
|
|
}
|
|
return m
|
|
};
|
|
dtmlXMLLoaderObject.prototype._getAllNamedChilds = function(h, g) {
|
|
var n = new Array();
|
|
if (_isKHTML) {
|
|
g = g.toUpperCase()
|
|
}
|
|
for (var m = 0; m < h.length; m++) {
|
|
for (var l = 0; l < h[m].childNodes.length; l++) {
|
|
if (_isKHTML) {
|
|
if (h[m].childNodes[l].tagName && h[m].childNodes[l].tagName.toUpperCase() == g) {
|
|
n[n.length] = h[m].childNodes[l]
|
|
}
|
|
} else {
|
|
if (h[m].childNodes[l].tagName == g) {
|
|
n[n.length] = h[m].childNodes[l]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return n
|
|
};
|
|
|
|
function dhtmlXHeir(h, g) {
|
|
for (var l in g) {
|
|
if (typeof(g[l]) == "function") {
|
|
h[l] = g[l]
|
|
}
|
|
}
|
|
return h
|
|
}
|
|
|
|
function dhtmlxEvent(c, g, a) {
|
|
if (c.addEventListener) {
|
|
c.addEventListener(g, a, false)
|
|
} else {
|
|
if (c.attachEvent) {
|
|
c.attachEvent("on" + g, a)
|
|
}
|
|
}
|
|
}
|
|
dtmlXMLLoaderObject.prototype.xslDoc = null;
|
|
dtmlXMLLoaderObject.prototype.setXSLParamValue = function(c, g, h) {
|
|
if (!h) {
|
|
h = this.xslDoc
|
|
}
|
|
if (h.responseXML) {
|
|
h = h.responseXML
|
|
}
|
|
var a = this.doXPath("/xsl:stylesheet/xsl:variable[@name='" + c + "']", h, "http://www.w3.org/1999/XSL/Transform", "single");
|
|
if (a != null) {
|
|
a.firstChild.nodeValue = g
|
|
}
|
|
};
|
|
dtmlXMLLoaderObject.prototype.doXSLTransToObject = function(h, c) {
|
|
if (!h) {
|
|
h = this.xslDoc
|
|
}
|
|
if (h.responseXML) {
|
|
h = h.responseXML
|
|
}
|
|
if (!c) {
|
|
c = this.xmlDoc
|
|
}
|
|
if (c.responseXML) {
|
|
c = c.responseXML
|
|
}
|
|
if (!_isIE) {
|
|
if (!this.XSLProcessor) {
|
|
this.XSLProcessor = new XSLTProcessor();
|
|
this.XSLProcessor.importStylesheet(h)
|
|
}
|
|
var a = this.XSLProcessor.transformToDocument(c)
|
|
} else {
|
|
var a = new ActiveXObject("Msxml2.DOMDocument.3.0");
|
|
try {
|
|
c.transformNodeToObject(h, a)
|
|
} catch (g) {
|
|
a = c.transformNode(h)
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
dtmlXMLLoaderObject.prototype.doXSLTransToString = function(g, c) {
|
|
var a = this.doXSLTransToObject(g, c);
|
|
if (typeof(a) == "string") {
|
|
return a
|
|
}
|
|
return this.doSerialization(a)
|
|
};
|
|
dtmlXMLLoaderObject.prototype.doSerialization = function(c) {
|
|
if (!c) {
|
|
c = this.xmlDoc
|
|
}
|
|
if (c.responseXML) {
|
|
c = c.responseXML
|
|
}
|
|
if (!_isIE) {
|
|
var a = new XMLSerializer();
|
|
return a.serializeToString(c)
|
|
} else {
|
|
return c.xml
|
|
}
|
|
};
|
|
dhtmlxEventable = function(obj) {
|
|
obj.attachEvent = function(name, catcher, callObj) {
|
|
name = "ev_" + name.toLowerCase();
|
|
if (!this[name]) {
|
|
this[name] = new this.eventCatcher(callObj || this)
|
|
}
|
|
return (name + ":" + this[name].addEvent(catcher))
|
|
};
|
|
obj.callEvent = function(name, arg0) {
|
|
name = "ev_" + name.toLowerCase();
|
|
if (this[name]) {
|
|
return this[name].apply(this, arg0)
|
|
}
|
|
return true
|
|
};
|
|
obj.checkEvent = function(name) {
|
|
return ( !! this["ev_" + name.toLowerCase()])
|
|
};
|
|
obj.eventCatcher = function(obj) {
|
|
var dhx_catch = [];
|
|
var z = function() {
|
|
var res = true;
|
|
for (var i = 0; i < dhx_catch.length; i++) {
|
|
if (dhx_catch[i] != null) {
|
|
var zr = dhx_catch[i].apply(obj, arguments);
|
|
res = res && zr
|
|
}
|
|
}
|
|
return res
|
|
};
|
|
z.addEvent = function(ev) {
|
|
if (typeof(ev) != "function") {
|
|
ev = eval(ev)
|
|
}
|
|
if (ev) {
|
|
return dhx_catch.push(ev) - 1
|
|
}
|
|
return false
|
|
};
|
|
z.removeEvent = function(id) {
|
|
dhx_catch[id] = null
|
|
};
|
|
return z
|
|
};
|
|
obj.detachEvent = function(id) {
|
|
if (id != false) {
|
|
var list = id.split(":");
|
|
this[list[0]].removeEvent(list[1])
|
|
}
|
|
};
|
|
obj.detachAllEvents = function() {
|
|
for (var name in this) {
|
|
if (name.indexOf("ev_") == 0) {
|
|
this.detachEvent(name);
|
|
this[name] = null
|
|
}
|
|
}
|
|
};
|
|
obj = null
|
|
};
|
|
if (!window.dhtmlx) {
|
|
dhtmlx = {}
|
|
}
|
|
dhtmlx.assert = function(c, a) {
|
|
if (!c) {
|
|
dhtmlx.error(a)
|
|
}
|
|
};
|
|
dhtmlx.assert_enabled = function() {
|
|
return false
|
|
};
|
|
dhtmlx.assert_event = function(m, g) {
|
|
if (!m._event_check) {
|
|
m._event_check = {};
|
|
m._event_check_size = {}
|
|
}
|
|
for (var c in g) {
|
|
m._event_check[c.toLowerCase()] = g[c];
|
|
var l = -1;
|
|
for (var h in g[c]) {
|
|
l++
|
|
}
|
|
m._event_check_size[c.toLowerCase()] = l
|
|
}
|
|
};
|
|
dhtmlx.assert_method_info = function(l, c, h, m) {
|
|
var a = [];
|
|
for (var g = 0; g < m.length; g++) {
|
|
a.push(m[g][0] + " : " + m[g][1] + "\n " + m[g][2].describe() + (m[g][3] ? "; optional" : ""))
|
|
}
|
|
return l.name + "." + c + "\n" + h + "\n Arguments:\n - " + a.join("\n - ")
|
|
};
|
|
dhtmlx.assert_method = function(g, a) {
|
|
for (var c in a) {
|
|
dhtmlx.assert_method_process(g, c, a[c].descr, a[c].args, (a[c].min || 99), a[c].skip)
|
|
}
|
|
};
|
|
dhtmlx.assert_method_process = function(m, c, l, n, g, h) {
|
|
var a = m[c];
|
|
if (!h) {
|
|
m[c] = function() {
|
|
if (arguments.length != n.length && arguments.length < g) {
|
|
dhtmlx.log("warn", "Incorrect count of parameters\n" + m[c].describe() + "\n\nExpecting " + n.length + " but have only " + arguments.length)
|
|
} else {
|
|
for (var o = 0; o < n.length; o++) {
|
|
if (!n[o][3] && !n[o][2](arguments[o])) {
|
|
dhtmlx.log("warn", "Incorrect method call\n" + m[c].describe() + "\n\nActual value of " + (o + 1) + " parameter: {" + (typeof arguments[o]) + "} " + arguments[o])
|
|
}
|
|
}
|
|
}
|
|
return a.apply(this, arguments)
|
|
}
|
|
}
|
|
m[c].describe = function() {
|
|
return dhtmlx.assert_method_info(m, c, l, n)
|
|
}
|
|
};
|
|
dhtmlx.assert_event_call = function(g, c, a) {
|
|
if (g._event_check) {
|
|
if (!g._event_check[c]) {
|
|
dhtmlx.log("warn", "Not expected event call :" + c)
|
|
} else {
|
|
if (dhtmlx.isNotDefined(a)) {
|
|
dhtmlx.log("warn", "Event without parameters :" + c)
|
|
} else {
|
|
if (g._event_check_size[c] != a.length) {
|
|
dhtmlx.log("warn", "Incorrect event call, expected " + g._event_check_size[c] + " parameter(s), but have " + a.length + " parameter(s), for " + c + " event")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.assert_event_attach = function(c, a) {
|
|
if (c._event_check && !c._event_check[a]) {
|
|
dhtmlx.log("warn", "Unknown event name: " + a)
|
|
}
|
|
};
|
|
dhtmlx.assert_property = function(c, a) {
|
|
if (!c._settings_check) {
|
|
c._settings_check = {}
|
|
}
|
|
dhtmlx.extend(c._settings_check, a)
|
|
};
|
|
dhtmlx.assert_check = function(g, c) {
|
|
if (typeof g == "object") {
|
|
for (var a in g) {
|
|
dhtmlx.assert_settings(a, g[a], c)
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.assert_settings = function(o, l, h) {
|
|
h = h || this._settings_check;
|
|
if (h) {
|
|
if (!h[o]) {
|
|
return dhtmlx.log("warn", "Unknown propery: " + o)
|
|
}
|
|
var n = "";
|
|
var c = "";
|
|
var a = false;
|
|
for (var g = 0; g < h[o].length; g++) {
|
|
var m = h[o][g];
|
|
if (typeof m == "string") {
|
|
continue
|
|
}
|
|
if (typeof m == "function") {
|
|
a = a || m(l)
|
|
} else {
|
|
if (typeof m == "object" && typeof m[1] == "function") {
|
|
a = a || m[1](l);
|
|
if (a && m[2]) {
|
|
dhtmlx.assert_check(l, m[2])
|
|
}
|
|
}
|
|
} if (a) {
|
|
break
|
|
}
|
|
}
|
|
if (!a) {
|
|
dhtmlx.log("warn", "Invalid configuration\n" + dhtmlx.assert_info(o, h) + "\nActual value: {" + (typeof l) + "} " + l)
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.assert_info = function(c, m) {
|
|
var a = m[c];
|
|
var l = "";
|
|
var h = [];
|
|
for (var g = 0; g < a.length; g++) {
|
|
if (typeof rule == "string") {
|
|
l = a[g]
|
|
} else {
|
|
if (a[g].describe) {
|
|
h.push(a[g].describe())
|
|
} else {
|
|
if (a[g][1] && a[g][1].describe) {
|
|
h.push(a[g][1].describe())
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return "Property: " + c + ", " + l + " \nExpected value: \n - " + h.join("\n - ")
|
|
};
|
|
if (dhtmlx.assert_enabled()) {
|
|
dhtmlx.assert_rule_color = function(a) {
|
|
if (typeof a != "string") {
|
|
return false
|
|
}
|
|
if (a.indexOf("#") !== 0) {
|
|
return false
|
|
}
|
|
if (a.substr(1).replace(/[0-9A-F]/gi, "") !== "") {
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
dhtmlx.assert_rule_color.describe = function() {
|
|
return "{String} Value must start from # and contain hexadecimal code of color"
|
|
};
|
|
dhtmlx.assert_rule_template = function(a) {
|
|
if (typeof a == "function") {
|
|
return true
|
|
}
|
|
if (typeof a == "string") {
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
dhtmlx.assert_rule_template.describe = function() {
|
|
return "{Function},{String} Value must be a function which accepts data object and return text string, or a sting with optional template markers"
|
|
};
|
|
dhtmlx.assert_rule_boolean = function(a) {
|
|
if (typeof a == "boolean") {
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
dhtmlx.assert_rule_boolean.describe = function() {
|
|
return "{Boolean} true or false"
|
|
};
|
|
dhtmlx.assert_rule_object = function(a, c) {
|
|
if (typeof a == "object") {
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
dhtmlx.assert_rule_object.describe = function() {
|
|
return "{Object} Configuration object"
|
|
};
|
|
dhtmlx.assert_rule_string = function(a) {
|
|
if (typeof a == "string") {
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
dhtmlx.assert_rule_string.describe = function() {
|
|
return "{String} Plain string"
|
|
};
|
|
dhtmlx.assert_rule_htmlpt = function(a) {
|
|
return !!dhtmlx.toNode(a)
|
|
};
|
|
dhtmlx.assert_rule_htmlpt.describe = function() {
|
|
return "{Object},{String} HTML node or ID of HTML Node"
|
|
};
|
|
dhtmlx.assert_rule_notdocumented = function(a) {
|
|
return false
|
|
};
|
|
dhtmlx.assert_rule_notdocumented.describe = function() {
|
|
return "This options wasn't documented"
|
|
};
|
|
dhtmlx.assert_rule_key = function(c) {
|
|
var a = function(g) {
|
|
return c[g]
|
|
};
|
|
a.describe = function() {
|
|
var h = [];
|
|
for (var g in c) {
|
|
h.push(g)
|
|
}
|
|
return "{String} can take one of next values: " + h.join(", ")
|
|
};
|
|
return a
|
|
};
|
|
dhtmlx.assert_rule_dimension = function(a) {
|
|
if (a * 1 == a && !isNaN(a) && a >= 0) {
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
dhtmlx.assert_rule_dimension.describe = function() {
|
|
return "{Integer} value must be a positive number"
|
|
};
|
|
dhtmlx.assert_rule_number = function(a) {
|
|
if (typeof a == "number") {
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
dhtmlx.assert_rule_number.describe = function() {
|
|
return "{Integer} value must be a number"
|
|
};
|
|
dhtmlx.assert_rule_function = function(a) {
|
|
if (typeof a == "function") {
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
dhtmlx.assert_rule_function.describe = function() {
|
|
return "{Function} value must be a custom function"
|
|
};
|
|
dhtmlx.assert_rule_any = function(a) {
|
|
return true
|
|
};
|
|
dhtmlx.assert_rule_any.describe = function() {
|
|
return "Any value"
|
|
};
|
|
dhtmlx.assert_rule_mix = function(g, c) {
|
|
var h = function(a) {
|
|
if (g(a) || c(a)) {
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
h.describe = function() {
|
|
return g.describe()
|
|
};
|
|
return h
|
|
}
|
|
}
|
|
dhtmlx.version = "3.0";
|
|
dhtmlx.codebase = "./";
|
|
dhtmlx.copy = function(c) {
|
|
var a = dhtmlx.copy._function;
|
|
a.prototype = c;
|
|
return new a()
|
|
};
|
|
dhtmlx.copy._function = function() {};
|
|
dhtmlx.extend = function(c, a) {
|
|
for (var g in a) {
|
|
c[g] = a[g]
|
|
}
|
|
if (dhtmlx.assert_enabled() && a._assert) {
|
|
c._assert();
|
|
c._assert = null
|
|
}
|
|
dhtmlx.assert(c, "Invalid nesting target");
|
|
dhtmlx.assert(a, "Invalid nesting source");
|
|
if (a._init) {
|
|
c._init()
|
|
}
|
|
return c
|
|
};
|
|
dhtmlx.proto_extend = function() {
|
|
var m = arguments;
|
|
var g = m[0];
|
|
var c = [];
|
|
for (var l = m.length - 1; l > 0; l--) {
|
|
if (typeof m[l] == "function") {
|
|
m[l] = m[l].prototype
|
|
}
|
|
for (var h in m[l]) {
|
|
if (h == "_init") {
|
|
c.push(m[l][h])
|
|
} else {
|
|
if (!g[h]) {
|
|
g[h] = m[l][h]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (m[0]._init) {
|
|
c.push(m[0]._init)
|
|
}
|
|
g._init = function() {
|
|
for (var n = 0; n < c.length; n++) {
|
|
c[n].apply(this, arguments)
|
|
}
|
|
};
|
|
g.base = m[1];
|
|
var a = function(n) {
|
|
this._init(n);
|
|
if (this._parseSettings) {
|
|
this._parseSettings(n, this.defaults)
|
|
}
|
|
};
|
|
a.prototype = g;
|
|
g = m = null;
|
|
return a
|
|
};
|
|
dhtmlx.bind = function(c, a) {
|
|
return function() {
|
|
return c.apply(a, arguments)
|
|
}
|
|
};
|
|
dhtmlx.require = function(a) {
|
|
if (!dhtmlx._modules[a]) {
|
|
dhtmlx.assert(dhtmlx.ajax, "load module is required");
|
|
dhtmlx.exec(dhtmlx.ajax().sync().get(dhtmlx.codebase + a).responseText);
|
|
dhtmlx._modules[a] = true
|
|
}
|
|
};
|
|
dhtmlx._modules = {};
|
|
dhtmlx.exec = function(code) {
|
|
if (window.execScript) {
|
|
window.execScript(code)
|
|
} else {
|
|
window.eval(code)
|
|
}
|
|
};
|
|
dhtmlx.methodPush = function(a, g, c) {
|
|
return function() {
|
|
var h = false;
|
|
h = a[g].apply(a, arguments);
|
|
return h
|
|
}
|
|
};
|
|
dhtmlx.isNotDefined = function(c) {
|
|
return typeof c == "undefined"
|
|
};
|
|
dhtmlx.delay = function(h, c, g, a) {
|
|
setTimeout(function() {
|
|
var l = h.apply(c, g);
|
|
h = c = g = null;
|
|
return l
|
|
}, a || 1)
|
|
};
|
|
dhtmlx.uid = function() {
|
|
if (!this._seed) {
|
|
this._seed = (new Date).valueOf()
|
|
}
|
|
this._seed++;
|
|
return this._seed
|
|
};
|
|
dhtmlx.toNode = function(a) {
|
|
if (typeof a == "string") {
|
|
return document.getElementById(a)
|
|
}
|
|
return a
|
|
};
|
|
dhtmlx.toArray = function(a) {
|
|
return dhtmlx.extend((a || []), dhtmlx.PowerArray)
|
|
};
|
|
dhtmlx.toFunctor = function(str) {
|
|
return (typeof(str) == "string") ? eval(str) : str
|
|
};
|
|
dhtmlx._events = {};
|
|
dhtmlx.event = function(h, g, a, c) {
|
|
h = dhtmlx.toNode(h);
|
|
var l = dhtmlx.uid();
|
|
dhtmlx._events[l] = [h, g, a];
|
|
if (c) {
|
|
a = dhtmlx.bind(a, c)
|
|
}
|
|
if (h.addEventListener) {
|
|
h.addEventListener(g, a, false)
|
|
} else {
|
|
if (h.attachEvent) {
|
|
h.attachEvent("on" + g, a)
|
|
}
|
|
}
|
|
return l
|
|
};
|
|
dhtmlx.eventRemove = function(c) {
|
|
if (!c) {
|
|
return
|
|
}
|
|
dhtmlx.assert(this._events[c], "Removing non-existing event");
|
|
var a = dhtmlx._events[c];
|
|
if (a[0].removeEventListener) {
|
|
a[0].removeEventListener(a[1], a[2], false)
|
|
} else {
|
|
if (a[0].detachEvent) {
|
|
a[0].detachEvent("on" + a[1], a[2])
|
|
}
|
|
}
|
|
delete this._events[c]
|
|
};
|
|
dhtmlx.log = function(c, g, a) {
|
|
if (window.console && console.log) {
|
|
c = c.toLowerCase();
|
|
if (window.console[c]) {
|
|
window.console[c](g || "unknown error")
|
|
} else {
|
|
window.console.log(c + ": " + g)
|
|
} if (a) {
|
|
window.console.log(a)
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.log_full_time = function(a) {
|
|
dhtmlx._start_time_log = new Date();
|
|
dhtmlx.log("Info", "Timing start [" + a + "]");
|
|
window.setTimeout(function() {
|
|
var c = new Date();
|
|
dhtmlx.log("Info", "Timing end [" + a + "]:" + (c.valueOf() - dhtmlx._start_time_log.valueOf()) / 1000 + "s")
|
|
}, 1)
|
|
};
|
|
dhtmlx.log_time = function(a) {
|
|
var g = "_start_time_log" + a;
|
|
if (!dhtmlx[g]) {
|
|
dhtmlx[g] = new Date();
|
|
dhtmlx.log("Info", "Timing start [" + a + "]")
|
|
} else {
|
|
var c = new Date();
|
|
dhtmlx.log("Info", "Timing end [" + a + "]:" + (c.valueOf() - dhtmlx[g].valueOf()) / 1000 + "s");
|
|
dhtmlx[g] = null
|
|
}
|
|
};
|
|
dhtmlx.error = function(c, a) {
|
|
dhtmlx.log("error", c, a)
|
|
};
|
|
dhtmlx.EventSystem = {
|
|
_init: function() {
|
|
this._events = {};
|
|
this._handlers = {};
|
|
this._map = {}
|
|
},
|
|
block: function() {
|
|
this._events._block = true
|
|
},
|
|
unblock: function() {
|
|
this._events._block = false
|
|
},
|
|
mapEvent: function(a) {
|
|
dhtmlx.extend(this._map, a)
|
|
},
|
|
callEvent: function(g, l) {
|
|
if (this._events._block) {
|
|
return true
|
|
}
|
|
g = g.toLowerCase();
|
|
dhtmlx.assert_event_call(this, g, l);
|
|
var h = this._events[g.toLowerCase()];
|
|
var a = true;
|
|
if (dhtmlx.debug) {
|
|
dhtmlx.log("info", "[" + this.name + "] event:" + g, l)
|
|
}
|
|
if (h) {
|
|
for (var c = 0; c < h.length; c++) {
|
|
if (h[c].apply(this, (l || [])) === false) {
|
|
a = false
|
|
}
|
|
}
|
|
}
|
|
if (this._map[g] && !this._map[g].callEvent(g, l)) {
|
|
a = false
|
|
}
|
|
return a
|
|
},
|
|
attachEvent: function(c, a, h) {
|
|
c = c.toLowerCase();
|
|
dhtmlx.assert_event_attach(this, c);
|
|
h = h || dhtmlx.uid();
|
|
a = dhtmlx.toFunctor(a);
|
|
var g = this._events[c] || dhtmlx.toArray();
|
|
g.push(a);
|
|
this._events[c] = g;
|
|
this._handlers[h] = {
|
|
f: a,
|
|
t: c
|
|
};
|
|
return h
|
|
},
|
|
detachEvent: function(h) {
|
|
if (this._handlers[h]) {
|
|
var c = this._handlers[h].t;
|
|
var a = this._handlers[h].f;
|
|
var g = this._events[c];
|
|
g.remove(a);
|
|
delete this._handlers[h]
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.PowerArray = {
|
|
removeAt: function(c, a) {
|
|
if (c >= 0) {
|
|
this.splice(c, (a || 1))
|
|
}
|
|
},
|
|
remove: function(a) {
|
|
this.removeAt(this.find(a))
|
|
},
|
|
insertAt: function(c, g) {
|
|
if (!g && g !== 0) {
|
|
this.push(c)
|
|
} else {
|
|
var a = this.splice(g, (this.length - g));
|
|
this[g] = c;
|
|
this.push.apply(this, a)
|
|
}
|
|
},
|
|
find: function(a) {
|
|
for (i = 0; i < this.length; i++) {
|
|
if (a == this[i]) {
|
|
return i
|
|
}
|
|
}
|
|
return -1
|
|
},
|
|
each: function(a, g) {
|
|
for (var c = 0; c < this.length; c++) {
|
|
a.call((g || this), this[c])
|
|
}
|
|
},
|
|
map: function(a, g) {
|
|
for (var c = 0; c < this.length; c++) {
|
|
this[c] = a.call((g || this), this[c])
|
|
}
|
|
return this
|
|
}
|
|
};
|
|
dhtmlx.env = {};
|
|
if (navigator.userAgent.indexOf("Opera") != -1) {
|
|
dhtmlx._isOpera = true
|
|
} else {
|
|
dhtmlx._isIE = !! document.all;
|
|
dhtmlx._isFF = !document.all;
|
|
dhtmlx._isWebKit = (navigator.userAgent.indexOf("KHTML") != -1);
|
|
if (navigator.appVersion.indexOf("MSIE 8.0") != -1 && document.compatMode != "BackCompat") {
|
|
dhtmlx._isIE = 8
|
|
}
|
|
if (navigator.appVersion.indexOf("MSIE 9.0") != -1 && document.compatMode != "BackCompat") {
|
|
dhtmlx._isIE = 9
|
|
}
|
|
}
|
|
dhtmlx.env = {};
|
|
(function() {
|
|
dhtmlx.env.transform = false;
|
|
dhtmlx.env.transition = false;
|
|
var a = {};
|
|
a.names = ["transform", "transition"];
|
|
a.transform = ["transform", "WebkitTransform", "MozTransform", "oTransform", "msTransform"];
|
|
a.transition = ["transition", "WebkitTransition", "MozTransition", "oTransition"];
|
|
var h = document.createElement("DIV");
|
|
var g;
|
|
for (var c = 0; c < a.names.length; c++) {
|
|
while (p = a[a.names[c]].pop()) {
|
|
if (typeof h.style[p] != "undefined") {
|
|
dhtmlx.env[a.names[c]] = true
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
dhtmlx.env.transform_prefix = (function() {
|
|
var a;
|
|
if (dhtmlx._isOpera) {
|
|
a = "-o-"
|
|
} else {
|
|
a = "";
|
|
if (dhtmlx._isFF) {
|
|
a = "-moz-"
|
|
}
|
|
if (dhtmlx._isWebKit) {
|
|
a = "-webkit-"
|
|
}
|
|
}
|
|
return a
|
|
})();
|
|
dhtmlx.env.svg = (function() {
|
|
return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")
|
|
})();
|
|
dhtmlx.zIndex = {
|
|
drag: 10000
|
|
};
|
|
dhtmlx.html = {
|
|
create: function(c, a, g) {
|
|
a = a || {};
|
|
var h = document.createElement(c);
|
|
for (var l in a) {
|
|
h.setAttribute(l, a[l])
|
|
}
|
|
if (a.style) {
|
|
h.style.cssText = a.style
|
|
}
|
|
if (a["class"]) {
|
|
h.className = a["class"]
|
|
}
|
|
if (g) {
|
|
h.innerHTML = g
|
|
}
|
|
return h
|
|
},
|
|
getValue: function(a) {
|
|
a = dhtmlx.toNode(a);
|
|
if (!a) {
|
|
return ""
|
|
}
|
|
return dhtmlx.isNotDefined(a.value) ? a.innerHTML : a.value
|
|
},
|
|
remove: function(c) {
|
|
if (c instanceof Array) {
|
|
for (var a = 0; a < c.length; a++) {
|
|
this.remove(c[a])
|
|
}
|
|
} else {
|
|
if (c && c.parentNode) {
|
|
c.parentNode.removeChild(c)
|
|
}
|
|
}
|
|
},
|
|
insertBefore: function(c, g, a) {
|
|
if (!c) {
|
|
return
|
|
}
|
|
if (g) {
|
|
g.parentNode.insertBefore(c, g)
|
|
} else {
|
|
a.appendChild(c)
|
|
}
|
|
},
|
|
locate: function(c, h) {
|
|
c = c || event;
|
|
var a = c.target || c.srcElement;
|
|
while (a) {
|
|
if (a.getAttribute) {
|
|
var g = a.getAttribute(h);
|
|
if (g) {
|
|
return g
|
|
}
|
|
}
|
|
a = a.parentNode
|
|
}
|
|
return null
|
|
},
|
|
offset: function(h) {
|
|
if (h.getBoundingClientRect) {
|
|
var n = h.getBoundingClientRect();
|
|
var o = document.body;
|
|
var c = document.documentElement;
|
|
var a = window.pageYOffset || c.scrollTop || o.scrollTop;
|
|
var l = window.pageXOffset || c.scrollLeft || o.scrollLeft;
|
|
var m = c.clientTop || o.clientTop || 0;
|
|
var q = c.clientLeft || o.clientLeft || 0;
|
|
var r = n.top + a - m;
|
|
var g = n.left + l - q;
|
|
return {
|
|
y: Math.round(r),
|
|
x: Math.round(g)
|
|
}
|
|
} else {
|
|
var r = 0,
|
|
g = 0;
|
|
while (h) {
|
|
r = r + parseInt(h.offsetTop, 10);
|
|
g = g + parseInt(h.offsetLeft, 10);
|
|
h = h.offsetParent
|
|
}
|
|
return {
|
|
y: r,
|
|
x: g
|
|
}
|
|
}
|
|
},
|
|
pos: function(a) {
|
|
a = a || event;
|
|
if (a.pageX || a.pageY) {
|
|
return {
|
|
x: a.pageX,
|
|
y: a.pageY
|
|
}
|
|
}
|
|
var c = ((dhtmlx._isIE) && (document.compatMode != "BackCompat")) ? document.documentElement : document.body;
|
|
return {
|
|
x: a.clientX + c.scrollLeft - c.clientLeft,
|
|
y: a.clientY + c.scrollTop - c.clientTop
|
|
}
|
|
},
|
|
preventEvent: function(a) {
|
|
if (a && a.preventDefault) {
|
|
a.preventDefault()
|
|
}
|
|
dhtmlx.html.stopEvent(a)
|
|
},
|
|
stopEvent: function(a) {
|
|
(a || event).cancelBubble = true;
|
|
return false
|
|
},
|
|
addCss: function(c, a) {
|
|
c.className += " " + a
|
|
},
|
|
removeCss: function(c, a) {
|
|
c.className = c.className.replace(RegExp(a, "g"), "")
|
|
}
|
|
};
|
|
(function() {
|
|
var a = document.getElementsByTagName("SCRIPT");
|
|
dhtmlx.assert(a.length, "Can't locate codebase");
|
|
if (a.length) {
|
|
a = (a[a.length - 1].getAttribute("src") || "").split("/");
|
|
a.splice(a.length - 1, 1);
|
|
dhtmlx.codebase = a.slice(0, a.length).join("/") + "/"
|
|
}
|
|
})();
|
|
if (!dhtmlx.ui) {
|
|
dhtmlx.ui = {}
|
|
}
|
|
dhtmlx.Destruction = {
|
|
_init: function() {
|
|
dhtmlx.destructors.push(this)
|
|
},
|
|
destructor: function() {
|
|
this.destructor = function() {};
|
|
this._htmlmap = null;
|
|
this._htmlrows = null;
|
|
if (this._html) {
|
|
document.body.appendChild(this._html)
|
|
}
|
|
this._html = null;
|
|
if (this._obj) {
|
|
this._obj.innerHTML = "";
|
|
this._obj._htmlmap = null
|
|
}
|
|
this._obj = this._dataobj = null;
|
|
this.data = null;
|
|
this._events = this._handlers = {};
|
|
if (this.render) {
|
|
this.render = function() {}
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.destructors = [];
|
|
dhtmlx.event(window, "unload", function() {
|
|
if (dhtmlx.destructors) {
|
|
for (var g = 0; g < dhtmlx.destructors.length; g++) {
|
|
dhtmlx.destructors[g].destructor()
|
|
}
|
|
dhtmlx.destructors = []
|
|
}
|
|
for (var c in dhtmlx._events) {
|
|
var h = dhtmlx._events[c];
|
|
if (h[0].removeEventListener) {
|
|
h[0].removeEventListener(h[1], h[2], false)
|
|
} else {
|
|
if (h[0].detachEvent) {
|
|
h[0].detachEvent("on" + h[1], h[2])
|
|
}
|
|
}
|
|
delete dhtmlx._events[c]
|
|
}
|
|
});
|
|
dhtmlx.ajax = function(a, c, g) {
|
|
if (arguments.length !== 0) {
|
|
var h = new dhtmlx.ajax();
|
|
if (g) {
|
|
h.master = g
|
|
}
|
|
h.get(a, null, c)
|
|
}
|
|
if (!this.getXHR) {
|
|
return new dhtmlx.ajax()
|
|
}
|
|
return this
|
|
};
|
|
dhtmlx.ajax.prototype = {
|
|
getXHR: function() {
|
|
if (dhtmlx._isIE) {
|
|
return new ActiveXObject("Microsoft.xmlHTTP")
|
|
} else {
|
|
return new XMLHttpRequest()
|
|
}
|
|
},
|
|
send: function(l, q, n) {
|
|
var c = this.getXHR();
|
|
if (typeof n == "function") {
|
|
n = [n]
|
|
}
|
|
if (typeof q == "object") {
|
|
var m = [];
|
|
for (var g in q) {
|
|
var o = q[g];
|
|
if (o === null || o === dhtmlx.undefined) {
|
|
o = ""
|
|
}
|
|
m.push(g + "=" + encodeURIComponent(o))
|
|
}
|
|
q = m.join("&")
|
|
}
|
|
if (q && !this.post) {
|
|
l = l + (l.indexOf("?") != -1 ? "&" : "?") + q;
|
|
q = null
|
|
}
|
|
c.open(this.post ? "POST" : "GET", l, !this._sync);
|
|
if (this.post) {
|
|
c.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
|
|
}
|
|
var h = this;
|
|
c.onreadystatechange = function() {
|
|
if (!c.readyState || c.readyState == 4) {
|
|
if (n && h) {
|
|
for (var a = 0; a < n.length; a++) {
|
|
if (n[a]) {
|
|
n[a].call((h.master || h), c.responseText, c.responseXML, c)
|
|
}
|
|
}
|
|
}
|
|
h.master = null;
|
|
n = h = null
|
|
}
|
|
};
|
|
c.send(q || null);
|
|
return c
|
|
},
|
|
get: function(a, g, c) {
|
|
this.post = false;
|
|
return this.send(a, g, c)
|
|
},
|
|
post: function(a, g, c) {
|
|
this.post = true;
|
|
return this.send(a, g, c)
|
|
},
|
|
sync: function() {
|
|
this._sync = true;
|
|
return this
|
|
}
|
|
};
|
|
dhtmlx.AtomDataLoader = {
|
|
_init: function(a) {
|
|
this.data = {};
|
|
if (a) {
|
|
this._settings.datatype = a.datatype || "json";
|
|
this._after_init.push(this._load_when_ready)
|
|
}
|
|
},
|
|
_load_when_ready: function() {
|
|
this._ready_for_data = true;
|
|
if (this._settings.url) {
|
|
this.url_setter(this._settings.url)
|
|
}
|
|
if (this._settings.data) {
|
|
this.data_setter(this._settings.data)
|
|
}
|
|
},
|
|
url_setter: function(a) {
|
|
if (!this._ready_for_data) {
|
|
return a
|
|
}
|
|
this.load(a, this._settings.datatype);
|
|
return a
|
|
},
|
|
data_setter: function(a) {
|
|
if (!this._ready_for_data) {
|
|
return a
|
|
}
|
|
this.parse(a, this._settings.datatype);
|
|
return true
|
|
},
|
|
load: function(a, c) {
|
|
this.callEvent("onXLS", []);
|
|
if (typeof c == "string") {
|
|
this.data.driver = dhtmlx.DataDriver[c];
|
|
c = arguments[2]
|
|
} else {
|
|
this.data.driver = dhtmlx.DataDriver.xml
|
|
}
|
|
dhtmlx.ajax(a, [this._onLoad, c], this)
|
|
},
|
|
parse: function(c, a) {
|
|
this.callEvent("onXLS", []);
|
|
this.data.driver = dhtmlx.DataDriver[a || "xml"];
|
|
this._onLoad(c, null)
|
|
},
|
|
_onLoad: function(l, c, a) {
|
|
var g = this.data.driver;
|
|
var h = g.getRecords(g.toObject(l, c))[0];
|
|
this.data = (g ? g.getDetails(h) : l);
|
|
this.callEvent("onXLE", [])
|
|
},
|
|
_check_data_feed: function(c) {
|
|
if (!this._settings.dataFeed || this._ignore_feed || !c) {
|
|
return true
|
|
}
|
|
var a = this._settings.dataFeed;
|
|
if (typeof a == "function") {
|
|
return a.call(this, (c.id || c), c)
|
|
}
|
|
a = a + (a.indexOf("?") == -1 ? "?" : "&") + "action=get&id=" + encodeURIComponent(c.id || c);
|
|
this.callEvent("onXLS", []);
|
|
dhtmlx.ajax(a, function(h, g) {
|
|
this._ignore_feed = true;
|
|
this.setValues(dhtmlx.DataDriver.json.toObject(h)[0]);
|
|
this._ignore_feed = false;
|
|
this.callEvent("onXLE", [])
|
|
}, this);
|
|
return false
|
|
}
|
|
};
|
|
dhtmlx.DataDriver = {};
|
|
dhtmlx.DataDriver.json = {
|
|
toObject: function(data) {
|
|
if (!data) {
|
|
data = "[]"
|
|
}
|
|
if (typeof data == "string") {
|
|
eval("dhtmlx.temp=" + data);
|
|
return dhtmlx.temp
|
|
}
|
|
return data
|
|
},
|
|
getRecords: function(a) {
|
|
if (a && !(a instanceof Array)) {
|
|
return [a]
|
|
}
|
|
return a
|
|
},
|
|
getDetails: function(a) {
|
|
return a
|
|
},
|
|
getInfo: function(a) {
|
|
return {
|
|
_size: (a.total_count || 0),
|
|
_from: (a.pos || 0),
|
|
_key: (a.dhx_security)
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.DataDriver.json_ext = {
|
|
toObject: function(data) {
|
|
if (!data) {
|
|
data = "[]"
|
|
}
|
|
if (typeof data == "string") {
|
|
var temp;
|
|
eval("temp=" + data);
|
|
dhtmlx.temp = [];
|
|
var header = temp.header;
|
|
for (var i = 0; i < temp.data.length; i++) {
|
|
var item = {};
|
|
for (var j = 0; j < header.length; j++) {
|
|
if (typeof(temp.data[i][j]) != "undefined") {
|
|
item[header[j]] = temp.data[i][j]
|
|
}
|
|
}
|
|
dhtmlx.temp.push(item)
|
|
}
|
|
return dhtmlx.temp
|
|
}
|
|
return data
|
|
},
|
|
getRecords: function(a) {
|
|
if (a && !(a instanceof Array)) {
|
|
return [a]
|
|
}
|
|
return a
|
|
},
|
|
getDetails: function(a) {
|
|
return a
|
|
},
|
|
getInfo: function(a) {
|
|
return {
|
|
_size: (a.total_count || 0),
|
|
_from: (a.pos || 0)
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.DataDriver.html = {
|
|
toObject: function(c) {
|
|
if (typeof c == "string") {
|
|
var a = null;
|
|
if (c.indexOf("<") == -1) {
|
|
a = dhtmlx.toNode(c)
|
|
}
|
|
if (!a) {
|
|
a = document.createElement("DIV");
|
|
a.innerHTML = c
|
|
}
|
|
return a.getElementsByTagName(this.tag)
|
|
}
|
|
return c
|
|
},
|
|
getRecords: function(a) {
|
|
if (a.tagName) {
|
|
return a.childNodes
|
|
}
|
|
return a
|
|
},
|
|
getDetails: function(a) {
|
|
return dhtmlx.DataDriver.xml.tagToObject(a)
|
|
},
|
|
getInfo: function(a) {
|
|
return {
|
|
_size: 0,
|
|
_from: 0
|
|
}
|
|
},
|
|
tag: "LI"
|
|
};
|
|
dhtmlx.DataDriver.jsarray = {
|
|
toObject: function(data) {
|
|
if (typeof data == "string") {
|
|
eval("dhtmlx.temp=" + data);
|
|
return dhtmlx.temp
|
|
}
|
|
return data
|
|
},
|
|
getRecords: function(a) {
|
|
return a
|
|
},
|
|
getDetails: function(g) {
|
|
var a = {};
|
|
for (var c = 0; c < g.length; c++) {
|
|
a["data" + c] = g[c]
|
|
}
|
|
return a
|
|
},
|
|
getInfo: function(a) {
|
|
return {
|
|
_size: 0,
|
|
_from: 0
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.DataDriver.csv = {
|
|
toObject: function(a) {
|
|
return a
|
|
},
|
|
getRecords: function(a) {
|
|
return a.split(this.row)
|
|
},
|
|
getDetails: function(g) {
|
|
g = this.stringToArray(g);
|
|
var a = {};
|
|
for (var c = 0; c < g.length; c++) {
|
|
a["data" + c] = g[c]
|
|
}
|
|
return a
|
|
},
|
|
getInfo: function(a) {
|
|
return {
|
|
_size: 0,
|
|
_from: 0
|
|
}
|
|
},
|
|
stringToArray: function(c) {
|
|
c = c.split(this.cell);
|
|
for (var a = 0; a < c.length; a++) {
|
|
c[a] = c[a].replace(/^[ \t\n\r]*(\"|)/g, "").replace(/(\"|)[ \t\n\r]*$/g, "")
|
|
}
|
|
return c
|
|
},
|
|
row: "\n",
|
|
cell: ","
|
|
};
|
|
dhtmlx.DataDriver.xml = {
|
|
toObject: function(c, a) {
|
|
if (a && (a = this.checkResponse(c, a))) {
|
|
return a
|
|
}
|
|
if (typeof c == "string") {
|
|
return this.fromString(c)
|
|
}
|
|
return c
|
|
},
|
|
getRecords: function(a) {
|
|
return this.xpath(a, this.records)
|
|
},
|
|
records: "/*/item",
|
|
getDetails: function(a) {
|
|
return this.tagToObject(a, {})
|
|
},
|
|
getInfo: function(a) {
|
|
return {
|
|
_size: (a.documentElement.getAttribute("total_count") || 0),
|
|
_from: (a.documentElement.getAttribute("pos") || 0),
|
|
_key: (a.documentElement.getAttribute("dhx_security"))
|
|
}
|
|
},
|
|
xpath: function(h, q) {
|
|
if (window.XPathResult) {
|
|
var g = h;
|
|
if (h.nodeName.indexOf("document") == -1) {
|
|
h = h.ownerDocument
|
|
}
|
|
var n = [];
|
|
var c = h.evaluate(q, g, null, XPathResult.ANY_TYPE, null);
|
|
var o = c.iterateNext();
|
|
while (o) {
|
|
n.push(o);
|
|
o = c.iterateNext()
|
|
}
|
|
return n
|
|
} else {
|
|
var m = true;
|
|
try {
|
|
if (typeof(h.selectNodes) == "undefined") {
|
|
m = false
|
|
}
|
|
} catch (l) {}
|
|
if (m) {
|
|
return h.selectNodes(q)
|
|
} else {
|
|
var a = q.split("/").pop();
|
|
return h.getElementsByTagName(a)
|
|
}
|
|
}
|
|
},
|
|
tagToObject: function(g, q) {
|
|
q = q || {};
|
|
var l = false;
|
|
var h = g.attributes;
|
|
if (h && h.length) {
|
|
for (var n = 0; n < h.length; n++) {
|
|
q[h[n].name] = h[n].value
|
|
}
|
|
l = true
|
|
}
|
|
var c = g.childNodes;
|
|
var o = {};
|
|
for (var n = 0; n < c.length; n++) {
|
|
if (c[n].nodeType == 1) {
|
|
var m = c[n].tagName;
|
|
if (typeof q[m] != "undefined") {
|
|
if (!(q[m] instanceof Array)) {
|
|
q[m] = [q[m]]
|
|
}
|
|
q[m].push(this.tagToObject(c[n], {}))
|
|
} else {
|
|
q[c[n].tagName] = this.tagToObject(c[n], {})
|
|
}
|
|
l = true
|
|
}
|
|
}
|
|
if (!l) {
|
|
return this.nodeValue(g)
|
|
}
|
|
q.value = this.nodeValue(g);
|
|
return q
|
|
},
|
|
nodeValue: function(a) {
|
|
if (a.firstChild) {
|
|
return a.firstChild.wholeText || a.firstChild.data
|
|
}
|
|
return ""
|
|
},
|
|
fromString: function(c) {
|
|
if (window.DOMParser && !dhtmlx._isIE) {
|
|
return (new DOMParser()).parseFromString(c, "text/xml")
|
|
}
|
|
if (window.ActiveXObject) {
|
|
var a = new ActiveXObject("Microsoft.xmlDOM");
|
|
a.loadXML(c);
|
|
return a
|
|
}
|
|
dhtmlx.error("Load from xml string is not supported")
|
|
},
|
|
checkResponse: function(h, g) {
|
|
if (g && (g.firstChild && g.firstChild.tagName != "parsererror")) {
|
|
return g
|
|
}
|
|
var c = this.fromString(h.replace(/^[\s]+/, ""));
|
|
if (c) {
|
|
return c
|
|
}
|
|
dhtmlx.error("xml can't be parsed", h)
|
|
}
|
|
};
|
|
dhtmlx.DataLoader = {
|
|
_init: function(a) {
|
|
a = a || "";
|
|
this.name = "DataStore";
|
|
this.data = (a.datastore) || (new dhtmlx.DataStore());
|
|
this._readyHandler = this.data.attachEvent("onStoreLoad", dhtmlx.bind(this._call_onready, this))
|
|
},
|
|
load: function(a, c) {
|
|
dhtmlx.AtomDataLoader.load.apply(this, arguments);
|
|
if (!this.data.feed) {
|
|
this.data.feed = function(h, g) {
|
|
if (this._load_count) {
|
|
return this._load_count = [h, g]
|
|
} else {
|
|
this._load_count = true
|
|
}
|
|
this.load(a + ((a.indexOf("?") == -1) ? "?" : "&") + "posStart=" + h + "&count=" + g, function() {
|
|
var l = this._load_count;
|
|
this._load_count = false;
|
|
if (typeof l == "object") {
|
|
this.data.feed.apply(this, l)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
},
|
|
_onLoad: function(g, c, a) {
|
|
this.data._parse(this.data.driver.toObject(g, c));
|
|
this.callEvent("onXLE", []);
|
|
if (this._readyHandler) {
|
|
this.data.detachEvent(this._readyHandler);
|
|
this._readyHandler = null
|
|
}
|
|
},
|
|
dataFeed_setter: function(a) {
|
|
this.data.attachEvent("onBeforeFilter", dhtmlx.bind(function(n, m) {
|
|
if (this._settings.dataFeed) {
|
|
var l = {};
|
|
if (!n && !l) {
|
|
return
|
|
}
|
|
if (typeof n == "function") {
|
|
if (!m) {
|
|
return
|
|
}
|
|
n(m, l)
|
|
} else {
|
|
l = {
|
|
text: m
|
|
}
|
|
}
|
|
this.clearAll();
|
|
var c = this._settings.dataFeed;
|
|
if (typeof c == "function") {
|
|
return c.call(this, m, l)
|
|
}
|
|
var h = [];
|
|
for (var g in l) {
|
|
h.push("dhx_filter[" + g + "]=" + encodeURIComponent(l[g]))
|
|
}
|
|
this.load(c + (c.indexOf("?") < 0 ? "?" : "&") + h.join("&"), this._settings.datatype);
|
|
return false
|
|
}
|
|
}, this));
|
|
return a
|
|
},
|
|
_call_onready: function() {
|
|
if (this._settings.ready) {
|
|
var a = dhtmlx.toFunctor(this._settings.ready);
|
|
if (a && a.call) {
|
|
a.apply(this, arguments)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.DataStore = function() {
|
|
this.name = "DataStore";
|
|
dhtmlx.extend(this, dhtmlx.EventSystem);
|
|
this.setDriver("xml");
|
|
this.pull = {};
|
|
this.order = dhtmlx.toArray()
|
|
};
|
|
dhtmlx.DataStore.prototype = {
|
|
setDriver: function(a) {
|
|
dhtmlx.assert(dhtmlx.DataDriver[a], "incorrect DataDriver");
|
|
this.driver = dhtmlx.DataDriver[a]
|
|
},
|
|
_parse: function(l) {
|
|
this.callEvent("onParse", [this.driver, l]);
|
|
if (this._filter_order) {
|
|
this.filter()
|
|
}
|
|
var m = this.driver.getInfo(l);
|
|
if (m._key) {
|
|
dhtmlx.security_key = m._key
|
|
}
|
|
var h = this.driver.getRecords(l);
|
|
var o = (m._from || 0) * 1;
|
|
if (o === 0 && this.order[0]) {
|
|
o = this.order.length
|
|
}
|
|
var c = 0;
|
|
for (var g = 0; g < h.length; g++) {
|
|
var a = this.driver.getDetails(h[g]);
|
|
var n = this.id(a);
|
|
if (!this.pull[n]) {
|
|
this.order[c + o] = n;
|
|
c++
|
|
}
|
|
this.pull[n] = a;
|
|
if (this.extraParser) {
|
|
this.extraParser(a)
|
|
}
|
|
if (this._scheme) {
|
|
if (this._scheme.$init) {
|
|
this._scheme.$update(a)
|
|
} else {
|
|
if (this._scheme.$update) {
|
|
this._scheme.$update(a)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (var g = 0; g < m._size; g++) {
|
|
if (!this.order[g]) {
|
|
var n = dhtmlx.uid();
|
|
var a = {
|
|
id: n,
|
|
$template: "loading"
|
|
};
|
|
this.pull[n] = a;
|
|
this.order[g] = n
|
|
}
|
|
}
|
|
this.callEvent("onStoreLoad", [this.driver, l]);
|
|
this.refresh()
|
|
},
|
|
id: function(a) {
|
|
return a.id || (a.id = dhtmlx.uid())
|
|
},
|
|
changeId: function(c, a) {
|
|
dhtmlx.assert(this.pull[c], "Can't change id, for non existing item: " + c);
|
|
this.pull[a] = this.pull[c];
|
|
this.pull[a].id = a;
|
|
this.order[this.order.find(c)] = a;
|
|
if (this._filter_order) {
|
|
this._filter_order[this._filter_order.find(c)] = a
|
|
}
|
|
this.callEvent("onIdChange", [c, a]);
|
|
if (this._render_change_id) {
|
|
this._render_change_id(c, a)
|
|
}
|
|
},
|
|
get: function(a) {
|
|
return this.item(a)
|
|
},
|
|
set: function(c, a) {
|
|
return this.update(c, a)
|
|
},
|
|
item: function(a) {
|
|
return this.pull[a]
|
|
},
|
|
update: function(c, a) {
|
|
if (this._scheme && this._scheme.$update) {
|
|
this._scheme.$update(a)
|
|
}
|
|
if (this.callEvent("onBeforeUpdate", [c, a]) === false) {
|
|
return false
|
|
}
|
|
this.pull[c] = a;
|
|
this.refresh(c)
|
|
},
|
|
refresh: function(a) {
|
|
if (this._skip_refresh) {
|
|
return
|
|
}
|
|
if (a) {
|
|
this.callEvent("onStoreUpdated", [a, this.pull[a], "update"])
|
|
} else {
|
|
this.callEvent("onStoreUpdated", [null, null, null])
|
|
}
|
|
},
|
|
silent: function(a) {
|
|
this._skip_refresh = true;
|
|
a.call(this);
|
|
this._skip_refresh = false
|
|
},
|
|
getRange: function(h, g) {
|
|
if (h) {
|
|
h = this.indexById(h)
|
|
} else {
|
|
h = this.startOffset || 0
|
|
} if (g) {
|
|
g = this.indexById(g)
|
|
} else {
|
|
g = Math.min((this.endOffset || Infinity), (this.dataCount() - 1));
|
|
if (g < 0) {
|
|
g = 0
|
|
}
|
|
} if (h > g) {
|
|
var c = g;
|
|
g = h;
|
|
h = c
|
|
}
|
|
return this.getIndexRange(h, g)
|
|
},
|
|
getIndexRange: function(h, g) {
|
|
g = Math.min((g || Infinity), this.dataCount() - 1);
|
|
var a = dhtmlx.toArray();
|
|
for (var c = (h || 0); c <= g; c++) {
|
|
a.push(this.item(this.order[c]))
|
|
}
|
|
return a
|
|
},
|
|
dataCount: function() {
|
|
return this.order.length
|
|
},
|
|
exists: function(a) {
|
|
return !!(this.pull[a])
|
|
},
|
|
move: function(a, h) {
|
|
if (a < 0 || h < 0) {
|
|
dhtmlx.error("DataStore::move", "Incorrect indexes");
|
|
return
|
|
}
|
|
var g = this.idByIndex(a);
|
|
var c = this.item(g);
|
|
this.order.removeAt(a);
|
|
this.order.insertAt(g, Math.min(this.order.length, h));
|
|
this.callEvent("onStoreUpdated", [g, c, "move"])
|
|
},
|
|
scheme: function(a) {
|
|
this._scheme = a
|
|
},
|
|
sync: function(l, h, a) {
|
|
if (typeof h != "function") {
|
|
a = h;
|
|
h = null
|
|
}
|
|
if (dhtmlx.debug_bind) {
|
|
this.debug_sync_master = l;
|
|
dhtmlx.log("[sync] " + this.debug_bind_master.name + "@" + this.debug_bind_master._settings.id + " <= " + this.debug_sync_master.name + "@" + this.debug_sync_master._settings.id)
|
|
}
|
|
var g = l;
|
|
if (l.name != "DataStore") {
|
|
l = l.data
|
|
}
|
|
var c = dhtmlx.bind(function(o, m, n) {
|
|
if (n != "update" || h) {
|
|
o = null
|
|
}
|
|
if (!o) {
|
|
this.order = dhtmlx.toArray([].concat(l.order));
|
|
this._filter_order = null;
|
|
this.pull = l.pull;
|
|
if (h) {
|
|
this.silent(h)
|
|
}
|
|
if (this._on_sync) {
|
|
this._on_sync()
|
|
}
|
|
}
|
|
if (dhtmlx.debug_bind) {
|
|
dhtmlx.log("[sync:request] " + this.debug_sync_master.name + "@" + this.debug_sync_master._settings.id + " <= " + this.debug_bind_master.name + "@" + this.debug_bind_master._settings.id)
|
|
}
|
|
if (!a) {
|
|
this.refresh(o)
|
|
} else {
|
|
a = false
|
|
}
|
|
}, this);
|
|
l.attachEvent("onStoreUpdated", c);
|
|
this.feed = function(n, m) {
|
|
g.loadNext(m, n)
|
|
};
|
|
c()
|
|
},
|
|
add: function(l, a) {
|
|
if (this._scheme) {
|
|
l = l || {};
|
|
for (var c in this._scheme) {
|
|
l[c] = l[c] || this._scheme[c]
|
|
}
|
|
if (this._scheme) {
|
|
if (this._scheme.$init) {
|
|
this._scheme.$update(l)
|
|
} else {
|
|
if (this._scheme.$update) {
|
|
this._scheme.$update(l)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var m = this.id(l);
|
|
var h = this.dataCount();
|
|
if (dhtmlx.isNotDefined(a) || a < 0) {
|
|
a = h
|
|
}
|
|
if (a > h) {
|
|
dhtmlx.log("Warning", "DataStore:add", "Index of out of bounds");
|
|
a = Math.min(this.order.length, a)
|
|
}
|
|
if (this.callEvent("onBeforeAdd", [m, l, a]) === false) {
|
|
return false
|
|
}
|
|
if (this.exists(m)) {
|
|
return dhtmlx.error("Not unique ID")
|
|
}
|
|
this.pull[m] = l;
|
|
this.order.insertAt(m, a);
|
|
if (this._filter_order) {
|
|
var g = this._filter_order.length;
|
|
if (!a && this.order.length) {
|
|
g = 0
|
|
}
|
|
this._filter_order.insertAt(m, g)
|
|
}
|
|
this.callEvent("onafterAdd", [m, a]);
|
|
this.callEvent("onStoreUpdated", [m, l, "add"]);
|
|
return m
|
|
},
|
|
remove: function(g) {
|
|
if (g instanceof Array) {
|
|
for (var a = 0; a < g.length; a++) {
|
|
this.remove(g[a])
|
|
}
|
|
return
|
|
}
|
|
if (this.callEvent("onBeforeDelete", [g]) === false) {
|
|
return false
|
|
}
|
|
if (!this.exists(g)) {
|
|
return dhtmlx.error("Not existing ID", g)
|
|
}
|
|
var c = this.item(g);
|
|
this.order.remove(g);
|
|
if (this._filter_order) {
|
|
this._filter_order.remove(g)
|
|
}
|
|
delete this.pull[g];
|
|
this.callEvent("onafterdelete", [g]);
|
|
this.callEvent("onStoreUpdated", [g, c, "delete"])
|
|
},
|
|
clearAll: function() {
|
|
this.pull = {};
|
|
this.order = dhtmlx.toArray();
|
|
this.feed = null;
|
|
this._filter_order = null;
|
|
this.callEvent("onClearAll", []);
|
|
this.refresh()
|
|
},
|
|
idByIndex: function(a) {
|
|
if (a >= this.order.length || a < 0) {
|
|
dhtmlx.log("Warning", "DataStore::idByIndex Incorrect index")
|
|
}
|
|
return this.order[a]
|
|
},
|
|
indexById: function(c) {
|
|
var a = this.order.find(c);
|
|
return a
|
|
},
|
|
next: function(c, a) {
|
|
return this.order[this.indexById(c) + (a || 1)]
|
|
},
|
|
first: function() {
|
|
return this.order[0]
|
|
},
|
|
last: function() {
|
|
return this.order[this.order.length - 1]
|
|
},
|
|
previous: function(c, a) {
|
|
return this.order[this.indexById(c) - (a || 1)]
|
|
},
|
|
sort: function(m, c, a) {
|
|
var g = m;
|
|
if (typeof m == "function") {
|
|
g = {
|
|
as: m,
|
|
dir: c
|
|
}
|
|
} else {
|
|
if (typeof m == "string") {
|
|
g = {
|
|
by: m,
|
|
dir: c,
|
|
as: a
|
|
}
|
|
}
|
|
}
|
|
var l = [g.by, g.dir, g.as];
|
|
if (!this.callEvent("onbeforesort", l)) {
|
|
return
|
|
}
|
|
if (this.order.length) {
|
|
var n = dhtmlx.sort.create(g);
|
|
var h = this.getRange(this.first(), this.last());
|
|
h.sort(n);
|
|
this.order = h.map(function(o) {
|
|
return this.id(o)
|
|
}, this)
|
|
}
|
|
this.refresh();
|
|
this.callEvent("onaftersort", l)
|
|
},
|
|
filter: function(l, h) {
|
|
if (!this.callEvent("onBeforeFilter", [l, h])) {
|
|
return
|
|
}
|
|
if (this._filter_order) {
|
|
this.order = this._filter_order;
|
|
delete this._filter_order
|
|
}
|
|
if (!this.order.length) {
|
|
return
|
|
}
|
|
if (l) {
|
|
var c = l;
|
|
h = h || "";
|
|
if (typeof l == "string") {
|
|
l = dhtmlx.Template.fromHTML(l);
|
|
h = h.toString().toLowerCase();
|
|
c = function(o, n) {
|
|
return l(o).toLowerCase().indexOf(n) != -1
|
|
}
|
|
}
|
|
var g = dhtmlx.toArray();
|
|
for (var a = 0; a < this.order.length; a++) {
|
|
var m = this.order[a];
|
|
if (c(this.item(m), h)) {
|
|
g.push(m)
|
|
}
|
|
}
|
|
this._filter_order = this.order;
|
|
this.order = g
|
|
}
|
|
this.refresh();
|
|
this.callEvent("onAfterFilter", [])
|
|
},
|
|
each: function(g, c) {
|
|
for (var a = 0; a < this.order.length; a++) {
|
|
g.call((c || this), this.item(this.order[a]))
|
|
}
|
|
},
|
|
provideApi: function(h, c) {
|
|
this.debug_bind_master = h;
|
|
if (c) {
|
|
this.mapEvent({
|
|
onbeforesort: h,
|
|
onaftersort: h,
|
|
onbeforeadd: h,
|
|
onafteradd: h,
|
|
onbeforedelete: h,
|
|
onafterdelete: h,
|
|
onbeforeupdate: h
|
|
})
|
|
}
|
|
var g = ["get", "set", "sort", "add", "remove", "exists", "idByIndex", "indexById", "item", "update", "refresh", "dataCount", "filter", "next", "previous", "clearAll", "first", "last", "serialize"];
|
|
for (var a = 0; a < g.length; a++) {
|
|
h[g[a]] = dhtmlx.methodPush(this, g[a])
|
|
}
|
|
if (dhtmlx.assert_enabled()) {
|
|
this.assert_event(h)
|
|
}
|
|
},
|
|
serialize: function() {
|
|
var g = this.order;
|
|
var a = [];
|
|
for (var c = 0; c < g.length; c++) {
|
|
a.push(this.pull[g[c]])
|
|
}
|
|
return a
|
|
}
|
|
};
|
|
dhtmlx.sort = {
|
|
create: function(a) {
|
|
return dhtmlx.sort.dir(a.dir, dhtmlx.sort.by(a.by, a.as))
|
|
},
|
|
as: {
|
|
"int": function(g, c) {
|
|
g = g * 1;
|
|
c = c * 1;
|
|
return g > c ? 1 : (g < c ? -1 : 0)
|
|
},
|
|
string_strict: function(g, c) {
|
|
g = g.toString();
|
|
c = c.toString();
|
|
return g > c ? 1 : (g < c ? -1 : 0)
|
|
},
|
|
string: function(g, c) {
|
|
g = g.toString().toLowerCase();
|
|
c = c.toString().toLowerCase();
|
|
return g > c ? 1 : (g < c ? -1 : 0)
|
|
}
|
|
},
|
|
by: function(c, a) {
|
|
if (!c) {
|
|
return a
|
|
}
|
|
if (typeof a != "function") {
|
|
a = dhtmlx.sort.as[a || "string"]
|
|
}
|
|
c = dhtmlx.Template.fromHTML(c);
|
|
return function(h, g) {
|
|
return a(c(h), c(g))
|
|
}
|
|
},
|
|
dir: function(c, a) {
|
|
if (c == "asc") {
|
|
return a
|
|
}
|
|
return function(h, g) {
|
|
return a(h, g) * -1
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.KeyEvents = {
|
|
_init: function() {
|
|
dhtmlx.event(this._obj, "keypress", this._onKeyPress, this)
|
|
},
|
|
_onKeyPress: function(c) {
|
|
c = c || event;
|
|
var a = c.which || c.keyCode;
|
|
this.callEvent((this._edit_id ? "onEditKeyPress" : "onKeyPress"), [a, c.ctrlKey, c.shiftKey, c])
|
|
}
|
|
};
|
|
dhtmlx.MouseEvents = {
|
|
_init: function() {
|
|
if (this.on_click) {
|
|
dhtmlx.event(this._obj, "click", this._onClick, this);
|
|
dhtmlx.event(this._obj, "contextmenu", this._onContext, this)
|
|
}
|
|
if (this.on_dblclick) {
|
|
dhtmlx.event(this._obj, "dblclick", this._onDblClick, this)
|
|
}
|
|
if (this.on_mouse_move) {
|
|
dhtmlx.event(this._obj, "mousemove", this._onMouse, this);
|
|
dhtmlx.event(this._obj, (dhtmlx._isIE ? "mouseleave" : "mouseout"), this._onMouse, this)
|
|
}
|
|
},
|
|
_onClick: function(a) {
|
|
return this._mouseEvent(a, this.on_click, "ItemClick")
|
|
},
|
|
_onDblClick: function(a) {
|
|
return this._mouseEvent(a, this.on_dblclick, "ItemDblClick")
|
|
},
|
|
_onContext: function(a) {
|
|
var c = dhtmlx.html.locate(a, this._id);
|
|
if (c && !this.callEvent("onBeforeContextMenu", [c, a])) {
|
|
return dhtmlx.html.preventEvent(a)
|
|
}
|
|
},
|
|
_onMouse: function(a) {
|
|
if (dhtmlx._isIE) {
|
|
a = document.createEventObject(event)
|
|
}
|
|
if (this._mouse_move_timer) {
|
|
window.clearTimeout(this._mouse_move_timer)
|
|
}
|
|
this.callEvent("onMouseMoving", [a]);
|
|
this._mouse_move_timer = window.setTimeout(dhtmlx.bind(function() {
|
|
if (a.type == "mousemove") {
|
|
this._onMouseMove(a)
|
|
} else {
|
|
this._onMouseOut(a)
|
|
}
|
|
}, this), 500)
|
|
},
|
|
_onMouseMove: function(a) {
|
|
if (!this._mouseEvent(a, this.on_mouse_move, "MouseMove")) {
|
|
this.callEvent("onMouseOut", [a || event])
|
|
}
|
|
},
|
|
_onMouseOut: function(a) {
|
|
this.callEvent("onMouseOut", [a || event])
|
|
},
|
|
_mouseEvent: function(m, l, c) {
|
|
m = m || event;
|
|
var a = m.target || m.srcElement;
|
|
var g = "";
|
|
var n = null;
|
|
var h = false;
|
|
while (a && a.parentNode) {
|
|
if (!h && a.getAttribute) {
|
|
n = a.getAttribute(this._id);
|
|
if (n) {
|
|
if (a.getAttribute("userdata")) {
|
|
this.callEvent("onLocateData", [n, a])
|
|
}
|
|
if (!this.callEvent("on" + c, [n, m, a])) {
|
|
return
|
|
}
|
|
h = true
|
|
}
|
|
}
|
|
g = a.className;
|
|
if (g) {
|
|
g = g.split(" ");
|
|
g = g[0] || g[1];
|
|
if (l[g]) {
|
|
return l[g].call(this, m, n || dhtmlx.html.locate(m, this._id), a)
|
|
}
|
|
}
|
|
a = a.parentNode
|
|
}
|
|
return h
|
|
}
|
|
};
|
|
dhtmlx.Settings = {
|
|
_init: function() {
|
|
this._settings = this.config = {}
|
|
},
|
|
define: function(c, a) {
|
|
if (typeof c == "object") {
|
|
return this._parseSeetingColl(c)
|
|
}
|
|
return this._define(c, a)
|
|
},
|
|
_define: function(c, a) {
|
|
dhtmlx.assert_settings.call(this, c, a);
|
|
var g = this[c + "_setter"];
|
|
return this._settings[c] = g ? g.call(this, a) : a
|
|
},
|
|
_parseSeetingColl: function(g) {
|
|
if (g) {
|
|
for (var c in g) {
|
|
this._define(c, g[c])
|
|
}
|
|
}
|
|
},
|
|
_parseSettings: function(g, a) {
|
|
var c = dhtmlx.extend({}, a);
|
|
if (typeof g == "object" && !g.tagName) {
|
|
dhtmlx.extend(c, g)
|
|
}
|
|
this._parseSeetingColl(c)
|
|
},
|
|
_mergeSettings: function(a, g) {
|
|
for (var c in g) {
|
|
switch (typeof a[c]) {
|
|
case "object":
|
|
a[c] = this._mergeSettings((a[c] || {}), g[c]);
|
|
break;
|
|
case "undefined":
|
|
a[c] = g[c];
|
|
break;
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
return a
|
|
},
|
|
_parseContainer: function(c, a, g) {
|
|
if (typeof c == "object" && !c.tagName) {
|
|
c = c.container
|
|
}
|
|
this._obj = this.$view = dhtmlx.toNode(c);
|
|
if (!this._obj && g) {
|
|
this._obj = g(c)
|
|
}
|
|
dhtmlx.assert(this._obj, "Incorrect html container");
|
|
this._obj.className += " " + a;
|
|
this._obj.onselectstart = function() {
|
|
return false
|
|
};
|
|
this._dataobj = this._obj
|
|
},
|
|
_set_type: function(a) {
|
|
if (typeof a == "object") {
|
|
return this.type_setter(a)
|
|
}
|
|
dhtmlx.assert(this.types, "RenderStack :: Types are not defined");
|
|
dhtmlx.assert(this.types[a], "RenderStack :: Inccorect type name", a);
|
|
this.type = dhtmlx.extend({}, this.types[a]);
|
|
this.customize()
|
|
},
|
|
customize: function(a) {
|
|
if (a) {
|
|
dhtmlx.extend(this.type, a)
|
|
}
|
|
this.type._item_start = dhtmlx.Template.fromHTML(this.template_item_start(this.type));
|
|
this.type._item_end = this.template_item_end(this.type);
|
|
this.render()
|
|
},
|
|
type_setter: function(a) {
|
|
this._set_type(typeof a == "object" ? dhtmlx.Type.add(this, a) : a);
|
|
return a
|
|
},
|
|
template_setter: function(a) {
|
|
return this.type_setter({
|
|
template: a
|
|
})
|
|
},
|
|
css_setter: function(a) {
|
|
this._obj.className += " " + a;
|
|
return a
|
|
}
|
|
};
|
|
dhtmlx.Template = {
|
|
_cache: {},
|
|
empty: function() {
|
|
return ""
|
|
},
|
|
setter: function(a) {
|
|
return dhtmlx.Template.fromHTML(a)
|
|
},
|
|
obj_setter: function(c) {
|
|
var a = dhtmlx.Template.setter(c);
|
|
var g = this;
|
|
return function() {
|
|
return a.apply(g, arguments)
|
|
}
|
|
},
|
|
fromHTML: function(a) {
|
|
if (typeof a == "function") {
|
|
return a
|
|
}
|
|
if (this._cache[a]) {
|
|
return this._cache[a]
|
|
}
|
|
a = (a || "").toString();
|
|
a = a.replace(/[\r\n]+/g, "\\n");
|
|
a = a.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g, '"+(obj.$1?"$2":"$3")+"');
|
|
a = a.replace(/\{common\.([^}\(]*)\}/g, '"+common.$1+"');
|
|
a = a.replace(/\{common\.([^\}\(]*)\(\)\}/g, '"+(common.$1?common.$1(obj):"")+"');
|
|
a = a.replace(/\{obj\.([^}]*)\}/g, '"+obj.$1+"');
|
|
a = a.replace(/#([a-z0-9_]+)#/gi, '"+obj.$1+"');
|
|
a = a.replace(/\{obj\}/g, '"+obj+"');
|
|
a = a.replace(/\{-obj/g, "{obj");
|
|
a = a.replace(/\{-common/g, "{common");
|
|
a = 'return "' + a + '";';
|
|
return this._cache[a] = Function("obj", "common", a)
|
|
}
|
|
};
|
|
dhtmlx.Type = {
|
|
add: function(g, c) {
|
|
if (!g.types && g.prototype.types) {
|
|
g = g.prototype
|
|
}
|
|
if (dhtmlx.assert_enabled()) {
|
|
this.assert_event(c)
|
|
}
|
|
var a = c.name || "default";
|
|
this._template(c);
|
|
this._template(c, "edit");
|
|
this._template(c, "loading");
|
|
g.types[a] = dhtmlx.extend(dhtmlx.extend({}, (g.types[a] || this._default)), c);
|
|
return a
|
|
},
|
|
_default: {
|
|
css: "default",
|
|
template: function() {
|
|
return ""
|
|
},
|
|
template_edit: function() {
|
|
return ""
|
|
},
|
|
template_loading: function() {
|
|
return "..."
|
|
},
|
|
width: 150,
|
|
height: 80,
|
|
margin: 5,
|
|
padding: 0
|
|
},
|
|
_template: function(g, a) {
|
|
a = "template" + (a ? ("_" + a) : "");
|
|
var c = g[a];
|
|
if (c && (typeof c == "string")) {
|
|
if (c.indexOf("->") != -1) {
|
|
c = c.split("->");
|
|
switch (c[0]) {
|
|
case "html":
|
|
c = dhtmlx.html.getValue(c[1]).replace(/\"/g, '\\"');
|
|
break;
|
|
case "http":
|
|
c = new dhtmlx.ajax().sync().get(c[1], {
|
|
uid: (new Date()).valueOf()
|
|
}).responseText;
|
|
break;
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
g[a] = dhtmlx.Template.fromHTML(c)
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.SingleRender = {
|
|
_init: function() {},
|
|
_toHTML: function(a) {
|
|
return this.type._item_start(a, this.type) + this.type.template(a, this.type) + this.type._item_end
|
|
},
|
|
render: function() {
|
|
if (!this.callEvent || this.callEvent("onBeforeRender", [this.data])) {
|
|
if (this.data) {
|
|
this._dataobj.innerHTML = this._toHTML(this.data)
|
|
}
|
|
if (this.callEvent) {
|
|
this.callEvent("onAfterRender", [])
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.ui.Tooltip = function(a) {
|
|
this.name = "Tooltip";
|
|
this.version = "3.0";
|
|
if (dhtmlx.assert_enabled()) {
|
|
this._assert()
|
|
}
|
|
if (typeof a == "string") {
|
|
a = {
|
|
template: a
|
|
}
|
|
}
|
|
dhtmlx.extend(this, dhtmlx.Settings);
|
|
dhtmlx.extend(this, dhtmlx.SingleRender);
|
|
this._parseSettings(a, {
|
|
type: "default",
|
|
dy: 0,
|
|
dx: 20
|
|
});
|
|
this._dataobj = this._obj = document.createElement("DIV");
|
|
this._obj.className = "dhx_tooltip";
|
|
dhtmlx.html.insertBefore(this._obj, document.body.firstChild)
|
|
};
|
|
dhtmlx.ui.Tooltip.prototype = {
|
|
show: function(a, c) {
|
|
if (this._disabled) {
|
|
return
|
|
}
|
|
if (this.data != a) {
|
|
this.data = a;
|
|
this.render(a)
|
|
}
|
|
this._obj.style.top = c.y + this._settings.dy + "px";
|
|
this._obj.style.left = c.x + this._settings.dx + "px";
|
|
this._obj.style.display = "block"
|
|
},
|
|
hide: function() {
|
|
this.data = null;
|
|
this._obj.style.display = "none"
|
|
},
|
|
disable: function() {
|
|
this._disabled = true
|
|
},
|
|
enable: function() {
|
|
this._disabled = false
|
|
},
|
|
types: {
|
|
"default": dhtmlx.Template.fromHTML("{obj.id}")
|
|
},
|
|
template_item_start: dhtmlx.Template.empty,
|
|
template_item_end: dhtmlx.Template.empty
|
|
};
|
|
dhtmlx.AutoTooltip = {
|
|
tooltip_setter: function(c) {
|
|
var a = new dhtmlx.ui.Tooltip(c);
|
|
this.attachEvent("onMouseMove", function(h, g) {
|
|
a.show(this.get(h), dhtmlx.html.pos(g))
|
|
});
|
|
this.attachEvent("onMouseOut", function(h, g) {
|
|
a.hide()
|
|
});
|
|
this.attachEvent("onMouseMoving", function(h, g) {
|
|
a.hide()
|
|
});
|
|
return a
|
|
}
|
|
};
|
|
dhtmlx.compat = function(a, c) {
|
|
if (dhtmlx.compat[a]) {
|
|
dhtmlx.compat[a](c)
|
|
}
|
|
};
|
|
(function() {
|
|
if (!window.dhtmlxError) {
|
|
var c = function() {};
|
|
window.dhtmlxError = {
|
|
catchError: c,
|
|
throwError: c
|
|
};
|
|
window.convertStringToBoolean = function(g) {
|
|
return !!g
|
|
};
|
|
window.dhtmlxEventable = function(g) {
|
|
dhtmlx.extend(g, dhtmlx.EventSystem)
|
|
};
|
|
var a = {
|
|
getXMLTopNode: function(g) {},
|
|
doXPath: function(g) {
|
|
return dhtmlx.DataDriver.xml.xpath(this.xml, g)
|
|
},
|
|
xmlDoc: {
|
|
responseXML: true
|
|
}
|
|
};
|
|
dhtmlx.compat.dataProcessor = function(m) {
|
|
var g = "_sendData";
|
|
var h = "_in_progress";
|
|
var n = "_tMode";
|
|
var l = "_waitMode";
|
|
m[g] = function(q, r) {
|
|
if (!q) {
|
|
return
|
|
}
|
|
if (r) {
|
|
this[h][r] = (new Date()).valueOf()
|
|
}
|
|
if (!this.callEvent("onBeforeDataSending", r ? [r, this.getState(r)] : [])) {
|
|
return false
|
|
}
|
|
var o = this;
|
|
var s = this.serverProcessor;
|
|
if (this[n] != "POST") {
|
|
dhtmlx.ajax().get(s + ((s.indexOf("?") != -1) ? "&" : "?") + this.serialize(q, r), "", function(w, u, v) {
|
|
a.xml = dhtmlx.DataDriver.xml.checkResponse(w, u);
|
|
o.afterUpdate(o, null, null, null, a)
|
|
})
|
|
} else {
|
|
dhtmlx.ajax().post(s, this.serialize(q, r), function(w, u, v) {
|
|
a.xml = dhtmlx.DataDriver.xml.checkResponse(w, u);
|
|
o.afterUpdate(o, null, null, null, a)
|
|
})
|
|
}
|
|
this[l]++
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
if (!dhtmlx.attaches) {
|
|
dhtmlx.attaches = {}
|
|
}
|
|
dhtmlx.attaches.attachAbstract = function(c, a) {
|
|
var l = document.createElement("DIV");
|
|
l.id = "CustomObject_" + dhtmlx.uid();
|
|
l.style.width = "100%";
|
|
l.style.height = "100%";
|
|
l.cmp = "grid";
|
|
document.body.appendChild(l);
|
|
this.attachObject(l.id);
|
|
a.container = l.id;
|
|
var h = this.vs[this.av];
|
|
h.grid = new window[c](a);
|
|
h.gridId = l.id;
|
|
h.gridObj = l;
|
|
h.grid.setSizes = function() {
|
|
if (this.resize) {
|
|
this.resize()
|
|
} else {
|
|
this.render()
|
|
}
|
|
};
|
|
var g = "_viewRestore";
|
|
return this.vs[this[g]()].grid
|
|
};
|
|
dhtmlx.attaches.attachDataView = function(a) {
|
|
return this.attachAbstract("dhtmlXDataView", a)
|
|
};
|
|
dhtmlx.attaches.attachChart = function(a) {
|
|
return this.attachAbstract("dhtmlXChart", a)
|
|
};
|
|
dhtmlx.compat.layout = function() {};
|
|
|
|
function dataProcessor(a) {
|
|
this.serverProcessor = a;
|
|
this.action_param = "!nativeeditor_status";
|
|
this.object = null;
|
|
this.updatedRows = [];
|
|
this.autoUpdate = true;
|
|
this.updateMode = "cell";
|
|
this._tMode = "GET";
|
|
this.post_delim = "_";
|
|
this._waitMode = 0;
|
|
this._in_progress = {};
|
|
this._invalid = {};
|
|
this.mandatoryFields = [];
|
|
this.messages = [];
|
|
this.styles = {
|
|
updated: "font-weight:bold;",
|
|
inserted: "font-weight:bold;",
|
|
deleted: "text-decoration : line-through;",
|
|
invalid: "background-color:FFE0E0;",
|
|
invalid_cell: "border-bottom:2px solid red;",
|
|
error: "color:red;",
|
|
clear: "font-weight:normal;text-decoration:none;"
|
|
};
|
|
this.enableUTFencoding(true);
|
|
dhtmlxEventable(this);
|
|
return this
|
|
}
|
|
dataProcessor.prototype = {
|
|
setTransactionMode: function(c, a) {
|
|
this._tMode = c;
|
|
this._tSend = a
|
|
},
|
|
escape: function(a) {
|
|
if (this._utf) {
|
|
return encodeURIComponent(a)
|
|
} else {
|
|
return escape(a)
|
|
}
|
|
},
|
|
enableUTFencoding: function(a) {
|
|
this._utf = convertStringToBoolean(a)
|
|
},
|
|
setDataColumns: function(a) {
|
|
this._columns = (typeof a == "string") ? a.split(",") : a
|
|
},
|
|
getSyncState: function() {
|
|
return !this.updatedRows.length
|
|
},
|
|
enableDataNames: function(a) {
|
|
this._endnm = convertStringToBoolean(a)
|
|
},
|
|
enablePartialDataSend: function(a) {
|
|
this._changed = convertStringToBoolean(a)
|
|
},
|
|
setUpdateMode: function(c, a) {
|
|
this.autoUpdate = (c == "cell");
|
|
this.updateMode = c;
|
|
this.dnd = a
|
|
},
|
|
ignore: function(c, a) {
|
|
this._silent_mode = true;
|
|
c.call(a || window);
|
|
this._silent_mode = false
|
|
},
|
|
setUpdated: function(h, g, l) {
|
|
if (this._silent_mode) {
|
|
return
|
|
}
|
|
var c = this.findRow(h);
|
|
l = l || "updated";
|
|
var a = this.obj.getUserData(h, this.action_param);
|
|
if (a && l == "updated") {
|
|
l = a
|
|
}
|
|
if (g) {
|
|
this.set_invalid(h, false);
|
|
this.updatedRows[c] = h;
|
|
this.obj.setUserData(h, this.action_param, l);
|
|
if (this._in_progress[h]) {
|
|
this._in_progress[h] = "wait"
|
|
}
|
|
} else {
|
|
if (!this.is_invalid(h)) {
|
|
this.updatedRows.splice(c, 1);
|
|
this.obj.setUserData(h, this.action_param, "")
|
|
}
|
|
} if (!g) {
|
|
this._clearUpdateFlag(h)
|
|
}
|
|
this.markRow(h, g, l);
|
|
if (g && this.autoUpdate) {
|
|
this.sendData(h)
|
|
}
|
|
},
|
|
_clearUpdateFlag: function(a) {},
|
|
markRow: function(m, g, l) {
|
|
var h = "";
|
|
var c = this.is_invalid(m);
|
|
if (c) {
|
|
h = this.styles[c];
|
|
g = true
|
|
}
|
|
if (this.callEvent("onRowMark", [m, g, l, c])) {
|
|
h = this.styles[g ? l : "clear"] + h;
|
|
this.obj[this._methods[0]](m, h);
|
|
if (c && c.details) {
|
|
h += this.styles[c + "_cell"];
|
|
for (var a = 0; a < c.details.length; a++) {
|
|
if (c.details[a]) {
|
|
this.obj[this._methods[1]](m, a, h)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
getState: function(a) {
|
|
return this.obj.getUserData(a, this.action_param)
|
|
},
|
|
is_invalid: function(a) {
|
|
return this._invalid[a]
|
|
},
|
|
set_invalid: function(g, c, a) {
|
|
if (a) {
|
|
c = {
|
|
value: c,
|
|
details: a,
|
|
toString: function() {
|
|
return this.value.toString()
|
|
}
|
|
}
|
|
}
|
|
this._invalid[g] = c
|
|
},
|
|
checkBeforeUpdate: function(a) {
|
|
return true
|
|
},
|
|
sendData: function(a) {
|
|
if (this._waitMode && (this.obj.mytype == "tree" || this.obj._h2)) {
|
|
return
|
|
}
|
|
if (this.obj.editStop) {
|
|
this.obj.editStop()
|
|
}
|
|
if (typeof a == "undefined" || this._tSend) {
|
|
return this.sendAllData()
|
|
}
|
|
if (this._in_progress[a]) {
|
|
return false
|
|
}
|
|
this.messages = [];
|
|
if (!this.checkBeforeUpdate(a) && this.callEvent("onValidationError", [a, this.messages])) {
|
|
return false
|
|
}
|
|
this._beforeSendData(this._getRowData(a), a)
|
|
},
|
|
_beforeSendData: function(a, c) {
|
|
if (!this.callEvent("onBeforeUpdate", [c, this.getState(c), a])) {
|
|
return false
|
|
}
|
|
this._sendData(a, c)
|
|
},
|
|
serialize: function(h, l) {
|
|
if (typeof h == "string") {
|
|
return h
|
|
}
|
|
if (typeof l != "undefined") {
|
|
return this.serialize_one(h, "")
|
|
} else {
|
|
var a = [];
|
|
var g = [];
|
|
for (var c in h) {
|
|
if (h.hasOwnProperty(c)) {
|
|
a.push(this.serialize_one(h[c], c + this.post_delim));
|
|
g.push(c)
|
|
}
|
|
}
|
|
a.push("ids=" + this.escape(g.join(",")));
|
|
if (dhtmlx.security_key) {
|
|
a.push("dhx_security=" + dhtmlx.security_key)
|
|
}
|
|
return a.join("&")
|
|
}
|
|
},
|
|
serialize_one: function(h, c) {
|
|
if (typeof h == "string") {
|
|
return h
|
|
}
|
|
var a = [];
|
|
for (var g in h) {
|
|
if (h.hasOwnProperty(g)) {
|
|
a.push(this.escape((c || "") + g) + "=" + this.escape(h[g]))
|
|
}
|
|
}
|
|
return a.join("&")
|
|
},
|
|
_sendData: function(c, g) {
|
|
if (!c) {
|
|
return
|
|
}
|
|
if (!this.callEvent("onBeforeDataSending", g ? [g, this.getState(g), c] : [null, null, c])) {
|
|
return false
|
|
}
|
|
if (g) {
|
|
this._in_progress[g] = (new Date()).valueOf()
|
|
}
|
|
var a = new dtmlXMLLoaderObject(this.afterUpdate, this, true);
|
|
var h = this.serverProcessor + (this._user ? (getUrlSymbol(this.serverProcessor) + ["dhx_user=" + this._user, "dhx_version=" + this.obj.getUserData(0, "version")].join("&")) : "");
|
|
if (this._tMode != "POST") {
|
|
a.loadXML(h + ((h.indexOf("?") != -1) ? "&" : "?") + this.serialize(c, g))
|
|
} else {
|
|
a.loadXML(h, true, this.serialize(c, g))
|
|
}
|
|
this._waitMode++
|
|
},
|
|
sendAllData: function() {
|
|
if (!this.updatedRows.length) {
|
|
return
|
|
}
|
|
this.messages = [];
|
|
var c = true;
|
|
for (var a = 0; a < this.updatedRows.length; a++) {
|
|
c &= this.checkBeforeUpdate(this.updatedRows[a])
|
|
}
|
|
if (!c && !this.callEvent("onValidationError", ["", this.messages])) {
|
|
return false
|
|
}
|
|
if (this._tSend) {
|
|
this._sendData(this._getAllData())
|
|
} else {
|
|
for (var a = 0; a < this.updatedRows.length; a++) {
|
|
if (!this._in_progress[this.updatedRows[a]]) {
|
|
if (this.is_invalid(this.updatedRows[a])) {
|
|
continue
|
|
}
|
|
this._beforeSendData(this._getRowData(this.updatedRows[a]), this.updatedRows[a]);
|
|
if (this._waitMode && (this.obj.mytype == "tree" || this.obj._h2)) {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
_getAllData: function(h) {
|
|
var c = {};
|
|
var a = false;
|
|
for (var g = 0; g < this.updatedRows.length; g++) {
|
|
var l = this.updatedRows[g];
|
|
if (this._in_progress[l] || this.is_invalid(l)) {
|
|
continue
|
|
}
|
|
if (!this.callEvent("onBeforeUpdate", [l, this.getState(l)])) {
|
|
continue
|
|
}
|
|
c[l] = this._getRowData(l, l + this.post_delim);
|
|
a = true;
|
|
this._in_progress[l] = (new Date()).valueOf()
|
|
}
|
|
return a ? c : null
|
|
},
|
|
setVerificator: function(c, a) {
|
|
this.mandatoryFields[c] = a || (function(g) {
|
|
return (g != "")
|
|
})
|
|
},
|
|
clearVerificator: function(a) {
|
|
this.mandatoryFields[a] = false
|
|
},
|
|
findRow: function(c) {
|
|
var a = 0;
|
|
for (a = 0; a < this.updatedRows.length; a++) {
|
|
if (c == this.updatedRows[a]) {
|
|
break
|
|
}
|
|
}
|
|
return a
|
|
},
|
|
defineAction: function(a, c) {
|
|
if (!this._uActions) {
|
|
this._uActions = []
|
|
}
|
|
this._uActions[a] = c
|
|
},
|
|
afterUpdateCallback: function(c, n, m, l) {
|
|
var a = c;
|
|
var h = (m != "error" && m != "invalid");
|
|
if (!h) {
|
|
this.set_invalid(c, m)
|
|
}
|
|
if ((this._uActions) && (this._uActions[m]) && (!this._uActions[m](l))) {
|
|
return (delete this._in_progress[a])
|
|
}
|
|
if (this._in_progress[a] != "wait") {
|
|
this.setUpdated(c, false)
|
|
}
|
|
var g = c;
|
|
switch (m) {
|
|
case "inserted":
|
|
case "insert":
|
|
if (n != c) {
|
|
this.obj[this._methods[2]](c, n);
|
|
c = n
|
|
}
|
|
break;
|
|
case "delete":
|
|
case "deleted":
|
|
this.obj.setUserData(c, this.action_param, "true_deleted");
|
|
this.obj[this._methods[3]](c);
|
|
delete this._in_progress[a];
|
|
return this.callEvent("onAfterUpdate", [c, m, n, l]);
|
|
break
|
|
}
|
|
if (this._in_progress[a] != "wait") {
|
|
if (h) {
|
|
this.obj.setUserData(c, this.action_param, "")
|
|
}
|
|
delete this._in_progress[a]
|
|
} else {
|
|
delete this._in_progress[a];
|
|
this.setUpdated(n, true, this.obj.getUserData(c, this.action_param))
|
|
}
|
|
this.callEvent("onAfterUpdate", [g, m, n, l])
|
|
},
|
|
afterUpdate: function(o, u, r, q, n) {
|
|
n.getXMLTopNode("data");
|
|
if (!n.xmlDoc.responseXML) {
|
|
return
|
|
}
|
|
var s = n.doXPath("//data/action");
|
|
for (var l = 0; l < s.length; l++) {
|
|
var m = s[l];
|
|
var h = m.getAttribute("type");
|
|
var a = m.getAttribute("sid");
|
|
var g = m.getAttribute("tid");
|
|
o.afterUpdateCallback(a, g, h, m)
|
|
}
|
|
o.finalizeUpdate()
|
|
},
|
|
finalizeUpdate: function() {
|
|
if (this._waitMode) {
|
|
this._waitMode--
|
|
}
|
|
if ((this.obj.mytype == "tree" || this.obj._h2) && this.updatedRows.length) {
|
|
this.sendData()
|
|
}
|
|
this.callEvent("onAfterUpdateFinish", []);
|
|
if (!this.updatedRows.length) {
|
|
this.callEvent("onFullSync", [])
|
|
}
|
|
},
|
|
init: function(a) {
|
|
this.obj = a;
|
|
if (this.obj._dp_init) {
|
|
this.obj._dp_init(this)
|
|
}
|
|
},
|
|
setOnAfterUpdate: function(a) {
|
|
this.attachEvent("onAfterUpdate", a)
|
|
},
|
|
enableDebug: function(a) {},
|
|
setOnBeforeUpdateHandler: function(a) {
|
|
this.attachEvent("onBeforeDataSending", a)
|
|
},
|
|
setAutoUpdate: function(g, c) {
|
|
g = g || 2000;
|
|
this._user = c || (new Date()).valueOf();
|
|
this._need_update = false;
|
|
this._loader = null;
|
|
this._update_busy = false;
|
|
this.attachEvent("onAfterUpdate", function(h, m, n, l) {
|
|
this.afterAutoUpdate(h, m, n, l)
|
|
});
|
|
this.attachEvent("onFullSync", function() {
|
|
this.fullSync()
|
|
});
|
|
var a = this;
|
|
window.setInterval(function() {
|
|
a.loadUpdate()
|
|
}, g)
|
|
},
|
|
afterAutoUpdate: function(a, g, h, c) {
|
|
if (g == "collision") {
|
|
this._need_update = true;
|
|
return false
|
|
} else {
|
|
return true
|
|
}
|
|
},
|
|
fullSync: function() {
|
|
if (this._need_update == true) {
|
|
this._need_update = false;
|
|
this.loadUpdate()
|
|
}
|
|
return true
|
|
},
|
|
getUpdates: function(a, c) {
|
|
if (this._update_busy) {
|
|
return false
|
|
} else {
|
|
this._update_busy = true
|
|
}
|
|
this._loader = this._loader || new dtmlXMLLoaderObject(true);
|
|
this._loader.async = true;
|
|
this._loader.waitCall = c;
|
|
this._loader.loadXML(a)
|
|
},
|
|
_v: function(a) {
|
|
if (a.firstChild) {
|
|
return a.firstChild.nodeValue
|
|
}
|
|
return ""
|
|
},
|
|
_a: function(a) {
|
|
var g = [];
|
|
for (var c = 0; c < a.length; c++) {
|
|
g[c] = this._v(a[c])
|
|
}
|
|
return g
|
|
},
|
|
loadUpdate: function() {
|
|
var c = this;
|
|
var a = this.obj.getUserData(0, "version");
|
|
var g = this.serverProcessor + getUrlSymbol(this.serverProcessor) + ["dhx_user=" + this._user, "dhx_version=" + a].join("&");
|
|
g = g.replace("editing=true&", "");
|
|
this.getUpdates(g, function() {
|
|
var m = c._loader.doXPath("//userdata");
|
|
c.obj.setUserData(0, "version", c._v(m[0]));
|
|
var h = c._loader.doXPath("//update");
|
|
if (h.length) {
|
|
c._silent_mode = true;
|
|
for (var n = 0; n < h.length; n++) {
|
|
var l = h[n].getAttribute("status");
|
|
var q = h[n].getAttribute("id");
|
|
var o = h[n].getAttribute("parent");
|
|
switch (l) {
|
|
case "inserted":
|
|
c.callEvent("insertCallback", [h[n], q, o]);
|
|
break;
|
|
case "updated":
|
|
c.callEvent("updateCallback", [h[n], q, o]);
|
|
break;
|
|
case "deleted":
|
|
c.callEvent("deleteCallback", [h[n], q, o]);
|
|
break
|
|
}
|
|
}
|
|
c._silent_mode = false
|
|
}
|
|
c._update_busy = false;
|
|
c = null
|
|
})
|
|
}
|
|
};
|
|
if (window.dhtmlXGridObject && !dhtmlXGridObject.prototype._init_point_connector) {
|
|
dhtmlXGridObject.prototype._init_point_connector = dhtmlXGridObject.prototype._init_point;
|
|
dhtmlXGridObject.prototype._init_point = function() {
|
|
this._con_f_used = [].concat(this._con_f_used);
|
|
dhtmlXGridObject.prototype._con_f_used = [];
|
|
var a = function(l) {
|
|
l = l.replace(/(\?|\&)connector[^\f]*/g, "");
|
|
return l + (l.indexOf("?") != -1 ? "&" : "?") + "connector=true" + (this.hdr.rows.length > 0 ? "&dhx_no_header=1" : "")
|
|
};
|
|
var h = function(l) {
|
|
return a.call(this, l) + (this._connector_sorting || "") + (this._connector_filter || "")
|
|
};
|
|
var g = function(m, n, l) {
|
|
this._connector_sorting = "&dhx_sort[" + n + "]=" + l;
|
|
return h.call(this, m)
|
|
};
|
|
var c = function(m, l, o) {
|
|
var q = [];
|
|
for (var n = 0; n < l.length; n++) {
|
|
q[n] = "dhx_filter[" + l[n] + "]=" + encodeURIComponent(o[n])
|
|
}
|
|
this._connector_filter = "&" + q.join("&");
|
|
return h.call(this, m)
|
|
};
|
|
this.attachEvent("onCollectValues", function(l) {
|
|
if (this._con_f_used[l]) {
|
|
if (typeof(this._con_f_used[l]) == "object") {
|
|
return this._con_f_used[l]
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onDynXLS", function() {
|
|
this.xmlFileUrl = h.call(this, this.xmlFileUrl);
|
|
return true
|
|
});
|
|
this.attachEvent("onBeforeSorting", function(o, n, m) {
|
|
if (n == "connector") {
|
|
var l = this;
|
|
this.clearAndLoad(g.call(this, this.xmlFileUrl, o, m), function() {
|
|
l.setSortImgState(true, o, m)
|
|
});
|
|
return false
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onFilterStart", function(m, l) {
|
|
var o = this.getSortingState();
|
|
if (this._con_f_used.length) {
|
|
var n = this;
|
|
this.clearAndLoad(c.call(this, this.xmlFileUrl, m, l));
|
|
if (o.length) {
|
|
n.setSortImgState(true, o[0], o[1])
|
|
}
|
|
return false
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onXLE", function(m, l, o, n) {
|
|
if (!n) {
|
|
return
|
|
}
|
|
});
|
|
if (this._init_point_connector) {
|
|
this._init_point_connector()
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._con_f_used = [];
|
|
dhtmlXGridObject.prototype._in_header_connector_text_filter = function(c, a) {
|
|
if (!this._con_f_used[a]) {
|
|
this._con_f_used[a] = 1
|
|
}
|
|
return this._in_header_text_filter(c, a)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_connector_select_filter = function(c, a) {
|
|
if (!this._con_f_used[a]) {
|
|
this._con_f_used[a] = 2
|
|
}
|
|
return this._in_header_select_filter(c, a)
|
|
};
|
|
dhtmlXGridObject.prototype.load_connector = dhtmlXGridObject.prototype.load;
|
|
dhtmlXGridObject.prototype.load = function(c, l, h) {
|
|
if (!this._colls_loaded && this.cellType) {
|
|
var a = [];
|
|
for (var g = 0; g < this.cellType.length; g++) {
|
|
if (this.cellType[g].indexOf("co") == 0 || this.cellType[g].indexOf("clist") == 0 || this._con_f_used[g] == 2) {
|
|
a.push(g)
|
|
}
|
|
}
|
|
if (a.length) {
|
|
arguments[0] += (arguments[0].indexOf("?") != -1 ? "&" : "?") + "connector=true&dhx_colls=" + a.join(",")
|
|
}
|
|
}
|
|
return this.load_connector.apply(this, arguments)
|
|
};
|
|
dhtmlXGridObject.prototype._parseHead_connector = dhtmlXGridObject.prototype._parseHead;
|
|
dhtmlXGridObject.prototype._parseHead = function(c, w, r) {
|
|
this._parseHead_connector.apply(this, arguments);
|
|
if (!this._colls_loaded) {
|
|
var s = this.xmlLoader.doXPath("./coll_options", arguments[0]);
|
|
for (var n = 0; n < s.length; n++) {
|
|
var q = s[n].getAttribute("for");
|
|
var u = [];
|
|
var h = null;
|
|
if (this.cellType[q] == "combo") {
|
|
h = this.getColumnCombo(q)
|
|
} else {
|
|
if (this.cellType[q].indexOf("co") == 0) {
|
|
h = this.getCombo(q)
|
|
}
|
|
}
|
|
var m = this.xmlLoader.doXPath("./item", s[n]);
|
|
var a = [];
|
|
for (var l = 0; l < m.length; l++) {
|
|
var g = m[l].getAttribute("value");
|
|
if (h) {
|
|
var o = m[l].getAttribute("label") || g;
|
|
if (h.addOption) {
|
|
a.push([g, o])
|
|
} else {
|
|
h.put(g, o)
|
|
}
|
|
u[u.length] = o
|
|
} else {
|
|
u[u.length] = g
|
|
}
|
|
}
|
|
if (a.length) {
|
|
if (h) {
|
|
h.addOption(a)
|
|
}
|
|
} else {
|
|
if (u.length && !h) {
|
|
if (this.registerCList) {
|
|
this.registerCList(q * 1, u)
|
|
}
|
|
}
|
|
} if (this._con_f_used[q * 1]) {
|
|
this._con_f_used[q * 1] = u
|
|
}
|
|
}
|
|
this._colls_loaded = true
|
|
}
|
|
}
|
|
}
|
|
if (window.dataProcessor && !dataProcessor.prototype.init_original) {
|
|
dataProcessor.prototype.init_original = dataProcessor.prototype.init;
|
|
dataProcessor.prototype.init = function(a) {
|
|
this.init_original(a);
|
|
a._dataprocessor = this;
|
|
this.setTransactionMode("POST", true);
|
|
this.serverProcessor += (this.serverProcessor.indexOf("?") != -1 ? "&" : "?") + "editing=true"
|
|
}
|
|
}
|
|
dhtmlxError.catchError("LoadXML", function(h, g, l) {
|
|
alert(l[0].responseText)
|
|
});
|
|
|
|
function dhtmlXCellObject(g, a) {
|
|
this.cell = document.createElement("DIV");
|
|
this.cell.className = "dhx_cell" + (a || "");
|
|
this._idd = g;
|
|
this._isCell = true;
|
|
this.conf = {
|
|
borders: true,
|
|
idx: {},
|
|
css: a || "",
|
|
idx_data: {
|
|
cont: "dhx_cell_cont",
|
|
pr1: "dhx_cell_progress_bar",
|
|
pr2: "dhx_cell_progress_img",
|
|
menu: "dhx_cell_menu",
|
|
toolbar: "dhx_cell_toolbar",
|
|
ribbon: "dhx_cell_ribbon",
|
|
sb: "dhx_cell_statusbar"
|
|
},
|
|
ofs_nodes: {
|
|
t: {},
|
|
b: {}
|
|
}
|
|
};
|
|
this.dataNodes = {};
|
|
this.views = {};
|
|
var c = document.createElement("DIV");
|
|
c.className = "dhx_cell_cont" + this.conf.css;
|
|
this.cell.appendChild(c);
|
|
c = null;
|
|
this._updateIdx = function() {
|
|
for (var h in this.conf.idx) {
|
|
this.conf.idx[h] = null;
|
|
delete this.conf.idx[h]
|
|
}
|
|
for (var n = 0; n < this.cell.childNodes.length; n++) {
|
|
var l = this.cell.childNodes[n].className;
|
|
for (var h in this.conf.idx_data) {
|
|
var m = new RegExp(this.conf.idx_data[h]);
|
|
if (l.match(m) != null) {
|
|
this.conf.idx[h] = n
|
|
}
|
|
}
|
|
}
|
|
this.callEvent("_onIdxUpdated", [])
|
|
};
|
|
this._adjustAttached = function() {
|
|
for (var h in this.dataNodes) {
|
|
if (this.dataNodes[h] != null && typeof(this.dataNodes[h].setSizes) == "function") {
|
|
this.dataNodes[h].setSizes()
|
|
}
|
|
}
|
|
if (this.dataObj != null && typeof(this.dataObj.setSizes) == "function") {
|
|
this.dataObj.setSizes.apply(this.dataObj, arguments)
|
|
}
|
|
};
|
|
this._setSize = function(m, s, n, q, r, l, o) {
|
|
if (!this.conf.size) {
|
|
this.conf.size = {}
|
|
}
|
|
this.conf.size.x = m;
|
|
this.conf.size.y = s;
|
|
this.conf.size.w = n;
|
|
this.conf.size.h = q;
|
|
this.cell.style.left = m + "px";
|
|
this.cell.style.top = s + "px";
|
|
this.cell.style.width = n + "px";
|
|
this.cell.style.height = q + "px";
|
|
this.callEvent("_onSetSize", []);
|
|
if (l !== true) {
|
|
this._adjustCont(r, o)
|
|
} else {
|
|
this._adjustAttached(r)
|
|
}
|
|
this._adjustProgress()
|
|
};
|
|
this._adjustCont = function(q, n) {
|
|
var o = this.cell.childNodes[this.conf.idx.cont];
|
|
var m = 0;
|
|
for (var h in this.conf.ofs_nodes.t) {
|
|
var l = this.conf.ofs_nodes.t[h];
|
|
m += (l == "func" ? this[h]() : (l == true ? this.cell.childNodes[this.conf.idx[h]].offsetHeight : 0))
|
|
}
|
|
var r = 0;
|
|
for (var h in this.conf.ofs_nodes.b) {
|
|
var l = this.conf.ofs_nodes.b[h];
|
|
r += (l == "func" ? this[h]() : (l == true ? this.cell.childNodes[this.conf.idx[h]].offsetHeight : 0))
|
|
}
|
|
o.style.left = "0px";
|
|
o.style.top = m + "px";
|
|
if (!this.conf.cells_cont) {
|
|
this.conf.cells_cont = {};
|
|
o.style.width = this.cell.offsetWidth + "px";
|
|
o.style.height = Math.max(this.cell.offsetHeight - m - r, 0) + "px";
|
|
this.conf.cells_cont.w = parseInt(o.style.width) - o.offsetWidth;
|
|
this.conf.cells_cont.h = parseInt(o.style.height) - o.offsetHeight
|
|
}
|
|
o.style.left = "0px";
|
|
o.style.top = m + "px";
|
|
o.style.width = Math.max(this.cell.offsetWidth + this.conf.cells_cont.w, 0) + "px";
|
|
o.style.height = Math.max(this.conf.size.h - m - r + this.conf.cells_cont.h, 0) + "px";
|
|
o = null;
|
|
this._adjustAttached(q);
|
|
if (n == "expand" && this.dataType == "editor" && this.dataObj != null) {
|
|
this.dataObj._prepareContent(true)
|
|
}
|
|
};
|
|
this._mtbUpdBorder = function() {
|
|
var l = ["menu", "toolbar"];
|
|
for (var n = 0; n < l.length; n++) {
|
|
if (this.conf.idx[l[n]] != null) {
|
|
var o = this.cell.childNodes[this.conf.idx[l[n]]];
|
|
var m = "dhx_cell_" + l[n] + "_no_borders";
|
|
var h = "dhx_cell_" + l[n] + "_def";
|
|
o.className = o.className.replace(new RegExp(this.conf.borders ? m : h), this.conf.borders ? h : m);
|
|
o = null
|
|
}
|
|
}
|
|
};
|
|
this._resetSizeState = function() {
|
|
this.conf.cells_cont = null
|
|
};
|
|
this.conf.view = "def";
|
|
this.conf.views_loaded = {};
|
|
this.conf.views_loaded[this.conf.view] = true;
|
|
this._viewSave = function(m) {
|
|
this.views[m] = {
|
|
borders: this.conf.borders,
|
|
ofs_nodes: {
|
|
t: {},
|
|
b: {}
|
|
},
|
|
dataType: this.dataType,
|
|
dataObj: this.dataObj,
|
|
cellCont: [],
|
|
dataNodes: {},
|
|
dataNodesCont: {}
|
|
};
|
|
var n = this.cell.childNodes[this.conf.idx.cont];
|
|
while (n.childNodes.length > 0) {
|
|
this.views[m].cellCont.push(n.firstChild);
|
|
n.removeChild(n.firstChild)
|
|
}
|
|
this.dataType = null;
|
|
this.dataObj = null;
|
|
for (var l in this.dataNodes) {
|
|
for (var h in this.conf.ofs_nodes) {
|
|
if (typeof(this.conf.ofs_nodes[h][l]) != "undefined") {
|
|
this.views[m].ofs_nodes[h][l] = this.conf.ofs_nodes[h][l];
|
|
this.conf.ofs_nodes[h][l] = null;
|
|
delete this.conf.ofs_nodes[h][l]
|
|
}
|
|
}
|
|
this.views[m].dataNodesCont[l] = this.cell.childNodes[this.conf.idx[l]];
|
|
this.cell.removeChild(this.cell.childNodes[this.conf.idx[l]]);
|
|
this.views[m].dataNodes[l] = this.dataNodes[l];
|
|
this.dataNodes[l] = null;
|
|
delete this.dataNodes[l];
|
|
this._updateIdx()
|
|
}
|
|
this.callEvent("_onViewSave", [m])
|
|
};
|
|
this._viewRestore = function(m) {
|
|
if (this.views[m] == null) {
|
|
return
|
|
}
|
|
this.dataObj = this.views[m].dataObj;
|
|
this.dataType = this.views[m].dataType;
|
|
for (var n = 0; n < this.views[m].cellCont.length; n++) {
|
|
this.cell.childNodes[this.conf.idx.cont].appendChild(this.views[m].cellCont[n])
|
|
}
|
|
for (var l in this.views[m].dataNodes) {
|
|
this.dataNodes[l] = this.views[m].dataNodes[l];
|
|
if (l == "menu") {
|
|
this.cell.insertBefore(this.views[m].dataNodesCont[l], this.cell.childNodes[this.conf.idx.toolbar || this.conf.idx.cont])
|
|
}
|
|
if (l == "toolbar") {
|
|
this.cell.insertBefore(this.views[m].dataNodesCont[l], this.cell.childNodes[this.conf.idx.cont])
|
|
}
|
|
if (l == "sb") {
|
|
this.cell.appendChild(this.views[m].dataNodesCont[l])
|
|
}
|
|
this._updateIdx()
|
|
}
|
|
for (var l in this.views[m].ofs_nodes) {
|
|
for (var h in this.views[m].ofs_nodes[l]) {
|
|
this.conf.ofs_nodes[l][h] = this.views[m].ofs_nodes[l][h]
|
|
}
|
|
}
|
|
if (this.conf.borders != this.views[m].borders) {
|
|
this[this.views[m].borders ? "_showBorders" : "_hideBorders"](true)
|
|
}
|
|
this.callEvent("_onViewRestore", [m]);
|
|
this._viewDelete(m)
|
|
};
|
|
this._viewDelete = function(m) {
|
|
if (this.views[m] == null) {
|
|
return
|
|
}
|
|
this.views[m].borders = null;
|
|
for (var l in this.views[m].ofs_nodes) {
|
|
for (var h in this.views[m].ofs_nodes[l]) {
|
|
this.views[m].ofs_nodes[l][h] = null
|
|
}
|
|
this.views[m].ofs_nodes[l] = null
|
|
}
|
|
this.views[m].dataType = null;
|
|
this.views[m].dataObj = null;
|
|
for (var n = 0; n < this.views[m].cellCont.length; n++) {
|
|
this.views[m].cellCont[n] = null
|
|
}
|
|
this.views[m].cellCont = null;
|
|
for (var l in this.views[m].dataNodes) {
|
|
this.views[m].dataNodes[l] = null;
|
|
this.views[m].dataNodesCont[l] = null
|
|
}
|
|
this.views[m].dataNodes = this.views[m].dataNodesCont = null;
|
|
this.views[m] = null;
|
|
delete this.views[m]
|
|
};
|
|
window.dhx4._eventable(this);
|
|
this._updateIdx();
|
|
return this
|
|
}
|
|
dhtmlXCellObject.prototype.showView = function(a) {
|
|
if (this.conf.view == a) {
|
|
return false
|
|
}
|
|
this._viewSave(this.conf.view);
|
|
this._viewRestore(a);
|
|
this._updateIdx();
|
|
this._adjustCont();
|
|
this.conf.view = a;
|
|
var c = (typeof(this.conf.views_loaded[this.conf.view]) == "undefined");
|
|
this.conf.views_loaded[this.conf.view] = true;
|
|
return c
|
|
};
|
|
dhtmlXCellObject.prototype.getViewName = function() {
|
|
return this.conf.view
|
|
};
|
|
dhtmlXCellObject.prototype.unloadView = function(h) {
|
|
if (h == this.conf.view) {
|
|
var l = this.conf.unloading;
|
|
this.conf.unloading = true;
|
|
this.detachMenu();
|
|
this.detachToolbar();
|
|
this.detachStatusBar();
|
|
this.detachRibbon();
|
|
this._detachObject(null, true);
|
|
this.conf.unloading = l;
|
|
if (!this.conf.unloading) {
|
|
this._adjustCont(this._idd)
|
|
}
|
|
return
|
|
}
|
|
if (this.views[h] == null) {
|
|
return
|
|
}
|
|
var g = this.views[h];
|
|
for (var c in g.dataNodes) {
|
|
if (typeof(g.dataNodes[c].unload) == "function") {
|
|
g.dataNodes[c].unload()
|
|
}
|
|
g.dataNodes[c] = null;
|
|
g.dataNodesCont[c] = null
|
|
}
|
|
if (g.dataType == "url") {
|
|
if (g.cellCont != null && g.cellCont[0] != "null") {
|
|
this._detachURLEvents(g.cellCont[0])
|
|
}
|
|
} else {
|
|
if (g.dataObj != null) {
|
|
if (typeof(g.dataObj.unload) == "function") {
|
|
g.dataObj.unload()
|
|
} else {
|
|
if (typeof(g.dataObj.destructor) == "function") {
|
|
g.dataObj.destructor()
|
|
}
|
|
}
|
|
g.dataObj = null
|
|
}
|
|
}
|
|
g = null;
|
|
this._viewDelete(h);
|
|
if (typeof(this.conf.views_loaded[h]) != "undefined") {
|
|
delete this.conf.views_loaded[h]
|
|
}
|
|
};
|
|
dhtmlXCellObject.prototype.getId = function() {
|
|
return this._idd
|
|
};
|
|
dhtmlXCellObject.prototype.progressOn = function() {
|
|
if (this.conf.progress) {
|
|
return
|
|
}
|
|
this.conf.progress = true;
|
|
var c = document.createElement("DIV");
|
|
c.className = "dhx_cell_progress_bar";
|
|
this.cell.appendChild(c);
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhx_cell_progress_img";
|
|
this.cell.appendChild(a);
|
|
c = a = null;
|
|
this._updateIdx();
|
|
this._adjustProgress()
|
|
};
|
|
dhtmlXCellObject.prototype.progressOff = function() {
|
|
if (!this.conf.progress) {
|
|
return
|
|
}
|
|
this.cell.childNodes[this.conf.idx.pr2].parentNode.removeChild(this.cell.childNodes[this.conf.idx.pr2]);
|
|
this.cell.childNodes[this.conf.idx.pr1].parentNode.removeChild(this.cell.childNodes[this.conf.idx.pr1]);
|
|
this.conf.progress = false;
|
|
this._updateIdx()
|
|
};
|
|
dhtmlXCellObject.prototype._adjustProgress = function() {
|
|
if (this.conf.idx.pr1 == null) {
|
|
return
|
|
}
|
|
if (!this.conf.pr) {
|
|
this.conf.pr = {}
|
|
}
|
|
var c = this.cell.childNodes[this.conf.idx.pr1];
|
|
var a = this.cell.childNodes[this.conf.idx.pr2];
|
|
if (!this.conf.pr.ofs) {
|
|
a.style.width = c.offsetWidth + "px";
|
|
a.style.height = c.offsetHeight + "px";
|
|
this.conf.pr.ofs = {
|
|
w: a.offsetWidth - a.clientWidth,
|
|
h: a.offsetHeight - a.clientHeight
|
|
}
|
|
}
|
|
a.style.width = c.offsetWidth - this.conf.pr.ofs.w + "px";
|
|
a.style.height = c.offsetHeight - this.conf.pr.ofs.h + "px";
|
|
c = a = null
|
|
};
|
|
dhtmlXCellObject.prototype._showBorders = function(a) {
|
|
if (this.conf.borders) {
|
|
return
|
|
}
|
|
this.conf.borders = true;
|
|
this.cell.childNodes[this.conf.idx.cont].className = "dhx_cell_cont" + this.conf.css;
|
|
this.conf.cells_cont = null;
|
|
this._mtbUpdBorder();
|
|
this.callEvent("_onBorderChange", [true]);
|
|
if (a !== true) {
|
|
this._adjustCont(this._idd)
|
|
}
|
|
};
|
|
dhtmlXCellObject.prototype._hideBorders = function(a) {
|
|
if (!this.conf.borders) {
|
|
return
|
|
}
|
|
this.conf.borders = false;
|
|
this.cell.childNodes[this.conf.idx.cont].className = "dhx_cell_cont" + this.conf.css + " dhx_cell_cont_no_borders";
|
|
this.conf.cells_cont = null;
|
|
this._mtbUpdBorder();
|
|
this.callEvent("_onBorderChange", [false]);
|
|
if (a !== true) {
|
|
this._adjustCont(this._idd)
|
|
}
|
|
};
|
|
dhtmlXCellObject.prototype._getWidth = function() {
|
|
return this.cell.offsetWidth
|
|
};
|
|
dhtmlXCellObject.prototype._getHeight = function() {
|
|
return this.cell.offsetHeight
|
|
};
|
|
dhtmlXCellObject.prototype.showInnerScroll = function() {
|
|
this.cell.childNodes[this.conf.idx.cont].style.overflow = "auto"
|
|
};
|
|
dhtmlXCellObject.prototype._unload = function() {
|
|
this.conf.unloading = true;
|
|
this.callEvent("_onCellUnload", []);
|
|
this.progressOff();
|
|
this.unloadView(this.conf.view);
|
|
this.dataNodes = null;
|
|
this.cell.parentNode.removeChild(this.cell);
|
|
this.cell = null;
|
|
window.dhx4._eventable(this, "clear");
|
|
for (var c in this.views) {
|
|
this.unloadView(c)
|
|
}
|
|
this.conf = null;
|
|
for (var c in this) {
|
|
this[c] = null
|
|
}
|
|
};
|
|
dhtmlXCellObject.prototype.attachObject = function(l, g) {
|
|
if (window.dhx4.s2b(g) && !(typeof(window.dhtmlXWindowsCell) != "undefined" && (this instanceof window.dhtmlXWindowsCell))) {
|
|
g = false
|
|
}
|
|
if (typeof(l) == "string") {
|
|
l = document.getElementById(l)
|
|
}
|
|
if (l.parentNode == this.cell.childNodes[this.conf.idx.cont]) {
|
|
l = null;
|
|
return
|
|
}
|
|
if (g) {
|
|
l.style.display = "";
|
|
var a = l.offsetWidth;
|
|
var c = l.offsetHeight
|
|
}
|
|
this._attachObject(l);
|
|
this.dataType = "obj";
|
|
l.style.display = "";
|
|
l = null;
|
|
if (g) {
|
|
this._adjustByCont(a, c)
|
|
}
|
|
};
|
|
dhtmlXCellObject.prototype.appendObject = function(a) {
|
|
if (typeof(a) == "string") {
|
|
a = document.getElementById(a)
|
|
}
|
|
if (a.parentNode == this.cell.childNodes[this.conf.idx.cont]) {
|
|
a = null;
|
|
return
|
|
}
|
|
if (!this.conf.append_mode) {
|
|
this.cell.childNodes[this.conf.idx.cont].style.overflow = "auto";
|
|
this.conf.append_mode = true
|
|
}
|
|
this._attachObject(a, null, null, true);
|
|
this.dataType = "obj";
|
|
a.style.display = "";
|
|
a = null
|
|
};
|
|
dhtmlXCellObject.prototype.detachObject = function(c, a) {
|
|
this._detachObject(null, c, a)
|
|
};
|
|
dhtmlXCellObject.prototype.getAttachedMenu = function() {
|
|
return this.dataNodes.menu
|
|
};
|
|
dhtmlXCellObject.prototype.getAttachedToolbar = function() {
|
|
return this.dataNodes.toolbar
|
|
};
|
|
dhtmlXCellObject.prototype.getAttachedRibbon = function() {
|
|
return this.dataNodes.ribbon
|
|
};
|
|
dhtmlXCellObject.prototype.getAttachedStatusBar = function() {
|
|
return this.dataNodes.sb
|
|
};
|
|
dhtmlXCellObject.prototype.getAttachedObject = function() {
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachURL = function(c, r, g) {
|
|
if (g == true) {
|
|
g = {}
|
|
}
|
|
var h = (typeof(g) != "undefined" && g != false && g != null);
|
|
if (!this.conf.url_data) {
|
|
this.conf.url_data = {}
|
|
}
|
|
this.conf.url_data.url = c;
|
|
this.conf.url_data.ajax = (r == true);
|
|
this.conf.url_data.post_data = (g == true ? {} : (g || null));
|
|
if (r == true) {
|
|
var q = this;
|
|
if (h) {
|
|
var l = "";
|
|
for (var o in g) {
|
|
l += "&" + encodeURIComponent(o) + "=" + encodeURIComponent(g[o])
|
|
}
|
|
dhx4.ajax.post(c, l, function(a) {
|
|
q.attachHTMLString("<div style='position:relative;width:100%;height:100%;overflow:auto;'>" + a.xmlDoc.responseText + "</div>");
|
|
if (typeof(q._doOnFrameContentLoaded) == "function") {
|
|
q._doOnFrameContentLoaded()
|
|
}
|
|
q.dataType = "url-ajax";
|
|
q = a = null
|
|
})
|
|
} else {
|
|
dhx4.ajax.get(c, function(a) {
|
|
q.attachHTMLString("<div style='position:relative;width:100%;height:100%;overflow:auto;'>" + a.xmlDoc.responseText + "</div>");
|
|
if (typeof(q._doOnFrameContentLoaded) == "function") {
|
|
q._doOnFrameContentLoaded()
|
|
}
|
|
q.dataType = "url-ajax";
|
|
q = a = null
|
|
})
|
|
}
|
|
} else {
|
|
if (this.dataType == "url") {
|
|
var m = this.getFrame()
|
|
} else {
|
|
var m = document.createElement("IFRAME");
|
|
m.frameBorder = 0;
|
|
m.border = 0;
|
|
m.style.width = "100%";
|
|
m.style.height = "100%";
|
|
m.style.position = "relative";
|
|
this._attachObject(m);
|
|
this.dataType = "url";
|
|
this._attachURLEvents()
|
|
} if (h) {
|
|
var n = (typeof(this.conf.url_data.post_ifr) == "undefined");
|
|
this.conf.url_data.post_ifr = true;
|
|
if (n) {
|
|
this._attachURLEvents()
|
|
}
|
|
m.src = "about:blank"
|
|
} else {
|
|
m.src = c + (c.indexOf("?") >= 0 ? "&" : "?") + "dhxr" + new Date().getTime()
|
|
}
|
|
m = null
|
|
}
|
|
m = null
|
|
};
|
|
dhtmlXCellObject.prototype.reloadURL = function() {
|
|
if (!(this.dataType == "url" || this.dataType == "url-ajax")) {
|
|
return
|
|
}
|
|
if (this.conf.url_data == null) {
|
|
return
|
|
}
|
|
this.attachURL(this.conf.url_data.url, this.conf.url_data.ajax, this.conf.url_data.post_data)
|
|
};
|
|
dhtmlXCellObject.prototype.attachHTMLString = function(str) {
|
|
this._attachObject(null, null, str);
|
|
var z = str.match(/<script[^>]*>[^\f]*?<\/script>/g) || [];
|
|
for (var i = 0; i < z.length; i++) {
|
|
var s = z[i].replace(/<([\/]{0,1})script[^>]*>/gi, "");
|
|
if (s) {
|
|
if (window.execScript) {
|
|
window.execScript(s)
|
|
} else {
|
|
window.eval(s)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXCellObject.prototype.attachLayout = function(a) {
|
|
if (this.conf.skin == "dhx_skyblue" && typeof(window.dhtmlXWindowsCell) != "undefined" && (this instanceof dhtmlXWindowsCell)) {}
|
|
if (this instanceof dhtmlXLayoutCell) {
|
|
this._hideBorders()
|
|
}
|
|
var c = document.createElement("DIV");
|
|
c.style.width = "100%";
|
|
c.style.height = "100%";
|
|
c.style.position = "relative";
|
|
c.style.overflow = "hidden";
|
|
this._attachObject(c);
|
|
if (typeof(this._layoutMainInst) != "undefined") {
|
|
c._layoutMainInst = this._layoutMainInst
|
|
}
|
|
if (this instanceof window.dhtmlXLayoutCell) {}
|
|
if (typeof(window.dhtmlXLayoutCell) != "undefined" && this instanceof dhtmlXLayoutCell) {
|
|
c._isParentCell = true
|
|
}
|
|
if (typeof(window.dhtmlXAccordionCell) != "undefined" && (this instanceof window.dhtmlXAccordionCell)) {
|
|
c._ofs = {
|
|
t: -1
|
|
}
|
|
}
|
|
if (typeof(a) == "string") {
|
|
a = {
|
|
pattern: a
|
|
}
|
|
}
|
|
if (typeof(a.skin) == "undefined") {
|
|
a.skin = this.conf.skin
|
|
}
|
|
a.parent = c;
|
|
this.dataType = "layout";
|
|
this.dataObj = new dhtmlXLayoutObject(a);
|
|
if (this instanceof dhtmlXLayoutCell) {
|
|
this.dataObj.parentLayout = this.layout
|
|
}
|
|
c._layoutMainInst = null;
|
|
a.parent = null;
|
|
c = a = null;
|
|
this.callEvent("_onContentAttach", []);
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachTree = function(a) {
|
|
var c = document.createElement("DIV");
|
|
c.style.width = "100%";
|
|
c.style.height = "100%";
|
|
c.style.position = "relative";
|
|
c.style.overflow = "hidden";
|
|
this._attachObject(c);
|
|
this.dataType = "tree";
|
|
this.dataObj = new dhtmlXTreeObject(c, "100%", "100%", (a || 0));
|
|
this.dataObj.setSkin(this.conf.skin);
|
|
this.dataObj.allTree.childNodes[0].style.marginTop = "2px";
|
|
this.dataObj.allTree.childNodes[0].style.marginBottom = "2px";
|
|
c = null;
|
|
this.callEvent("_onContentAttach", []);
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachGrid = function() {
|
|
var a = document.createElement("DIV");
|
|
a.style.width = "100%";
|
|
a.style.height = "100%";
|
|
a.style.position = "relative";
|
|
a.style.overflow = "hidden";
|
|
this._attachObject(a);
|
|
this.dataType = "grid";
|
|
this.dataObj = new dhtmlXGridObject(a);
|
|
this.dataObj.setSkin(this.conf.skin);
|
|
if (this.conf.skin == "dhx_skyblue" && typeof(window.dhtmlXWindowsCell) != "undefined" && this instanceof window.dhtmlXWindowsCell) {
|
|
this.dataObj.entBox.style.border = "1px solid #a4bed4";
|
|
this.dataObj._sizeFix = 0
|
|
} else {
|
|
this.dataObj.entBox.style.border = "0px solid white";
|
|
this.dataObj._sizeFix = 2
|
|
}
|
|
a = null;
|
|
this.callEvent("_onContentAttach", []);
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachTabbar = function(a) {
|
|
if (typeof(window.dhtmlXLayoutCell) != "undefined" && this instanceof dhtmlXLayoutCell) {
|
|
this._hideBorders()
|
|
}
|
|
if (typeof(a) == "string") {
|
|
a = {
|
|
mode: a
|
|
}
|
|
} else {
|
|
if (typeof(a) != "object" || a == null) {
|
|
a = {}
|
|
}
|
|
}
|
|
var c = document.createElement("DIV");
|
|
c.style.width = "100%";
|
|
c.style.height = "100%";
|
|
c.style.position = "relative";
|
|
c.style.overflow = "hidden";
|
|
if (typeof(window.dhtmlXAccordionCell) != "undefined" && (this instanceof window.dhtmlXAccordionCell)) {
|
|
c._ofs = {
|
|
t: -1
|
|
}
|
|
}
|
|
this._attachObject(c);
|
|
a.skin = this.conf.skin;
|
|
a.parent = c;
|
|
this.dataType = "tabbar";
|
|
this.dataObj = new dhtmlXTabBar(a);
|
|
a.parent = c = null;
|
|
a = null;
|
|
this.callEvent("_onContentAttach", []);
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachAccordion = function(a) {
|
|
if (typeof(window.dhtmlXWindowsCell) != "undefined" && (this instanceof dhtmlXWindowsCell)) {} else {
|
|
if (this._isCell) {
|
|
this._hideBorders()
|
|
}
|
|
}
|
|
var c = document.createElement("DIV");
|
|
c.style.width = "100%";
|
|
c.style.height = "100%";
|
|
c.style.position = "relative";
|
|
this._attachObject(c);
|
|
if (typeof(a) == "undefined") {
|
|
a = {}
|
|
}
|
|
if (typeof(a.skin) == "undefined") {
|
|
a.skin = this.conf.skin
|
|
}
|
|
a.parent = c;
|
|
if (typeof(window.dhtmlXAccordionCell) != "undefined" && (this instanceof window.dhtmlXAccordionCell)) {
|
|
c._ofs = {
|
|
s: {
|
|
first: -1
|
|
},
|
|
m: {
|
|
first: 4
|
|
}
|
|
}
|
|
}
|
|
this.dataType = "acc";
|
|
this.dataObj = new dhtmlXAccordion(a);
|
|
a.obj = null;
|
|
c = a = null;
|
|
this.callEvent("_onContentAttach", []);
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachEditor = function(a) {
|
|
var c = document.createElement("DIV");
|
|
c.style.width = "100%";
|
|
c.style.height = "100%";
|
|
c.style.position = "relative";
|
|
c.style.overflow = "hidden";
|
|
this._attachObject(c);
|
|
if (!(typeof(a) == "object" && a != null)) {
|
|
a = {}
|
|
}
|
|
a.parent = c;
|
|
this.dataType = "editor";
|
|
this.dataObj = new dhtmlXEditor(a);
|
|
c = null;
|
|
a.parent = null;
|
|
a = null;
|
|
this.callEvent("_onContentAttach", []);
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachDataView = function(a) {
|
|
var c = document.createElement("DIV");
|
|
c.style.width = "100%";
|
|
c.style.height = "100%";
|
|
c.style.position = "relative";
|
|
c.style.overflow = "hidden";
|
|
this._attachObject(c);
|
|
if (typeof(a) == "undefined") {
|
|
a = {}
|
|
}
|
|
c.id = "DataViewObject_" + new Date().getTime();
|
|
a.container = c.id;
|
|
a.skin = this.conf.skin;
|
|
this.dataType = "dataview";
|
|
this.dataObj = new dhtmlXDataView(a);
|
|
this.dataObj.setSizes = function() {
|
|
this.render()
|
|
};
|
|
c = null;
|
|
this.callEvent("_onContentAttach", []);
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachScheduler = function(a, n, c, h) {
|
|
h = h || window.scheduler;
|
|
var l = false;
|
|
if (c) {
|
|
var m = document.getElementById(c);
|
|
if (m) {
|
|
l = true
|
|
}
|
|
}
|
|
if (!l) {
|
|
var g = c || '<div class="dhx_cal_tab" name="day_tab" style="right:204px;"></div><div class="dhx_cal_tab" name="week_tab" style="right:140px;"></div><div class="dhx_cal_tab" name="month_tab" style="right:76px;"></div>';
|
|
var m = document.createElement("DIV");
|
|
m.id = "dhxSchedObj_" + new Date().getTime();
|
|
m.style.width = "100%";
|
|
m.style.height = "100%";
|
|
m.style.position = "relative";
|
|
m.style.overflow = "hidden";
|
|
m.className = "dhx_cal_container";
|
|
m.innerHTML = '<div class="dhx_cal_navline"><div class="dhx_cal_prev_button"> </div><div class="dhx_cal_next_button"> </div><div class="dhx_cal_today_button"></div><div class="dhx_cal_date"></div>' + g + '</div><div class="dhx_cal_header"></div><div class="dhx_cal_data"></div>'
|
|
}
|
|
this._attachObject(m);
|
|
this.dataType = "scheduler";
|
|
this.dataObj = h;
|
|
this.dataObj.setSizes = function() {
|
|
this.update_view()
|
|
};
|
|
h.init(m.id, a, n);
|
|
m = null;
|
|
this.callEvent("_onContentAttach", []);
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachForm = function(a) {
|
|
var c = document.createElement("DIV");
|
|
c.style.width = "100%";
|
|
c.style.height = "100%";
|
|
c.style.position = "relative";
|
|
if (window.dhtmlx && dhtmlx.$customScroll) {
|
|
dhtmlx.CustomScroll.enable(c)
|
|
} else {
|
|
c.style.overflow = "auto"
|
|
}
|
|
this._attachObject(c);
|
|
this.dataType = "form";
|
|
this.dataObj = new dhtmlXForm(c, a);
|
|
this.dataObj.setSkin(this.conf.skin);
|
|
c = null;
|
|
this.callEvent("_onContentAttach", []);
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachMap = function(a) {
|
|
var c = document.createElement("DIV");
|
|
c.id = "GMapsObj_" + this._genStr(12);
|
|
c.style.width = "100%";
|
|
c.style.height = "100%";
|
|
c.style.position = "relative";
|
|
c.style.overflow = "hidden";
|
|
this._attachObject(c);
|
|
if (!a) {
|
|
a = {
|
|
center: new google.maps.LatLng(40.719837, -73.992348),
|
|
zoom: 11,
|
|
mapTypeId: google.maps.MapTypeId.ROADMAP
|
|
}
|
|
}
|
|
this.dataType = "maps";
|
|
this.dataObj = new google.maps.Map(c, a);
|
|
this.dataObj.setSizes = function() {
|
|
google.maps.event.trigger(this, "resize")
|
|
};
|
|
c = null;
|
|
this.callEvent("_onContentAttach", []);
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachChart = function(a) {
|
|
var c = document.createElement("DIV");
|
|
c.id = "dhxChartObj_" + window.dhx4.newId();
|
|
c.style.width = "100%";
|
|
c.style.height = "100%";
|
|
document.body.appendChild(c);
|
|
this._attachObject(c);
|
|
a.container = c.id;
|
|
this.dataType = "chart";
|
|
this.dataObj = new dhtmlXChart(a);
|
|
if (!this.dataObj.setSizes) {
|
|
this.dataObj.setSizes = function() {
|
|
if (this.resize) {
|
|
this.resize()
|
|
} else {
|
|
this.render()
|
|
}
|
|
}
|
|
}
|
|
return this.dataObj
|
|
};
|
|
dhtmlXCellObject.prototype.attachMenu = function(a) {
|
|
if (this.dataNodes.menu) {
|
|
return
|
|
}
|
|
if (typeof(a) == "undefined") {
|
|
a = {}
|
|
}
|
|
if (typeof(a.skin) == "undefined") {
|
|
a.skin = this.conf.skin
|
|
}
|
|
a.parent = this._attachObject("menu").firstChild;
|
|
this.dataNodes.menu = new dhtmlXMenuObject(a);
|
|
this._adjustCont(this._idd);
|
|
a.parent = null;
|
|
a = null;
|
|
return this.dataNodes.menu
|
|
};
|
|
dhtmlXCellObject.prototype.detachMenu = function() {
|
|
if (!this.dataNodes.menu) {
|
|
return
|
|
}
|
|
this.dataNodes.menu.unload();
|
|
this.dataNodes.menu = null;
|
|
delete this.dataNodes.menu;
|
|
this._detachObject("menu")
|
|
};
|
|
dhtmlXCellObject.prototype.showMenu = function() {
|
|
this._mtbShowHide("menu", "")
|
|
};
|
|
dhtmlXCellObject.prototype.hideMenu = function() {
|
|
this._mtbShowHide("menu", "none")
|
|
};
|
|
dhtmlXCellObject.prototype.attachToolbar = function(a) {
|
|
if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) {
|
|
return
|
|
}
|
|
if (typeof(a) == "undefined") {
|
|
a = {}
|
|
} else {
|
|
if (typeof(a) == "string") {
|
|
a = {
|
|
skin: a
|
|
}
|
|
}
|
|
} if (typeof(a.skin) == "undefined") {
|
|
a.skin = this.conf.skin
|
|
}
|
|
a.parent = this._attachObject("toolbar").firstChild;
|
|
this.dataNodes.toolbar = new dhtmlXToolbarObject(a);
|
|
this._adjustCont(this._idd);
|
|
this.dataNodes.toolbar._masterCell = this;
|
|
this.dataNodes.toolbar.attachEvent("_onIconSizeChange", function() {
|
|
this._masterCell._adjustCont()
|
|
});
|
|
a.parent = null;
|
|
a = null;
|
|
return this.dataNodes.toolbar
|
|
};
|
|
dhtmlXCellObject.prototype.detachToolbar = function() {
|
|
if (!this.dataNodes.toolbar) {
|
|
return
|
|
}
|
|
this.dataNodes.toolbar._masterCell = null;
|
|
this.dataNodes.toolbar.unload();
|
|
this.dataNodes.toolbar = null;
|
|
delete this.dataNodes.toolbar;
|
|
this._detachObject("toolbar")
|
|
};
|
|
dhtmlXCellObject.prototype.showToolbar = function() {
|
|
this._mtbShowHide("toolbar", "")
|
|
};
|
|
dhtmlXCellObject.prototype.hideToolbar = function() {
|
|
this._mtbShowHide("toolbar", "none")
|
|
};
|
|
dhtmlXCellObject.prototype.attachRibbon = function(a) {
|
|
if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) {
|
|
return
|
|
}
|
|
if (typeof(a) == "undefined") {
|
|
a = {}
|
|
}
|
|
if (typeof(a.skin) == "undefined") {
|
|
a.skin = this.conf.skin
|
|
}
|
|
a.parent = this._attachObject("ribbon").firstChild;
|
|
this.dataNodes.ribbon = new dhtmlXRibbon(a);
|
|
var c = this;
|
|
this.dataNodes.ribbon.attachEvent("_onHeightChanged", function() {
|
|
c._adjustCont(c._idd)
|
|
});
|
|
this._adjustCont();
|
|
a.parent = null;
|
|
a = null;
|
|
return this.dataNodes.ribbon
|
|
};
|
|
dhtmlXCellObject.prototype.detachRibbon = function() {
|
|
if (!this.dataNodes.ribbon) {
|
|
return
|
|
}
|
|
this.dataNodes.ribbon.unload();
|
|
this.dataNodes.ribbon = null;
|
|
delete this.dataNodes.ribbon;
|
|
this._detachObject("ribbon")
|
|
};
|
|
dhtmlXCellObject.prototype.showRibbon = function() {
|
|
this._mtbShowHide("ribbon", "")
|
|
};
|
|
dhtmlXCellObject.prototype.hideRibbon = function() {
|
|
this._mtbShowHide("ribbon", "none")
|
|
};
|
|
dhtmlXCellObject.prototype.attachStatusBar = function(a) {
|
|
if (this.dataNodes.sb) {
|
|
return
|
|
}
|
|
if (this.conf.skin == "dhx_skyblue" && typeof(window.dhtmlXWindowsCell) != "undefined" && (this instanceof dhtmlXWindowsCell)) {
|
|
this.cell.childNodes[this.conf.idx.cont].className += " dhx_cell_statusbar_attached"
|
|
}
|
|
this.dataNodes.sb = this._attachObject("sb", a);
|
|
this.dataNodes.sb.setText = function(c) {
|
|
this.childNodes[0].innerHTML = c
|
|
};
|
|
this.dataNodes.sb.getText = function() {
|
|
return this.childNodes[0].innerHTML
|
|
};
|
|
this.dataNodes.sb.onselectstart = function(c) {
|
|
return false
|
|
};
|
|
return this.dataNodes.sb
|
|
};
|
|
dhtmlXCellObject.prototype.detachStatusBar = function() {
|
|
if (!this.dataNodes.sb) {
|
|
return
|
|
}
|
|
if (this.conf.skin == "dhx_skyblue" && typeof(window.dhtmlXWindowsCell) != "undefined" && (this instanceof dhtmlXWindowsCell)) {
|
|
this.cell.childNodes[this.conf.idx.cont].className = this.cell.childNodes[this.conf.idx.cont].className.replace(/\s{0,}dhx_cell_statusbar_attached/, "")
|
|
}
|
|
this.dataNodes.sb.setText = this.dataNodes.sb.getText = this.dataNodes.sb.onselectstart = null;
|
|
this.dataNodes.sb = null;
|
|
delete this.dataNodes.sb;
|
|
this._detachObject("sb")
|
|
};
|
|
dhtmlXCellObject.prototype.showStatusBar = function() {
|
|
this._mtbShowHide("sb", "")
|
|
};
|
|
dhtmlXCellObject.prototype.hideStatusBar = function() {
|
|
this._mtbShowHide("sb", "none")
|
|
};
|
|
dhtmlXCellObject.prototype._mtbShowHide = function(c, a) {
|
|
if (!this.dataNodes[c]) {
|
|
return
|
|
}
|
|
this.cell.childNodes[this.conf.idx[c]].style.display = a;
|
|
this._adjustCont()
|
|
};
|
|
dhtmlXCellObject.prototype.getFrame = dhtmlXCellObject.prototype._getFrame = function() {
|
|
if (this.dataType != "url") {
|
|
return null
|
|
}
|
|
return this.cell.childNodes[this.conf.idx.cont].firstChild
|
|
};
|
|
dhtmlXCellObject.prototype._genStr = function() {
|
|
if (!this._genStrId) {
|
|
this._genStrId = new Date().getTime()
|
|
}
|
|
return this._genStrId++
|
|
};
|
|
dhtmlXCellObject.prototype._attachURLEvents = function() {
|
|
if (this.dataType != "url") {
|
|
return
|
|
}
|
|
var g = this;
|
|
var c = this._idd;
|
|
var a = this.cell.childNodes[this.conf.idx.cont].firstChild;
|
|
if (typeof(this._doOnFrameMouseDown) != "function") {
|
|
this._doOnFrameMouseDown = function(h) {
|
|
g.callEvent("_onContentMouseDown", [c, h || event])
|
|
}
|
|
}
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.onload = function() {
|
|
try {
|
|
if (typeof(g._doOnFrameMouseDown) == "function") {
|
|
this.contentWindow.document.body.addEventListener("mousedown", g._doOnFrameMouseDown, false)
|
|
}
|
|
} catch (h) {}
|
|
try {
|
|
if (typeof(g._doOnFrameContentLoaded) == "function") {
|
|
g._doOnFrameContentLoaded()
|
|
}
|
|
} catch (h) {}
|
|
}
|
|
} else {
|
|
a.onreadystatechange = function(h) {
|
|
if (this.readyState == "complete") {
|
|
try {
|
|
if (typeof(g._doOnFrameMouseDown) == "function") {
|
|
this.contentWindow.document.body.attachEvent("onmousedown", g._doOnFrameMouseDown)
|
|
}
|
|
} catch (l) {}
|
|
try {
|
|
if (typeof(g._doOnFrameContentLoaded) == "function") {
|
|
g._doOnFrameContentLoaded()
|
|
}
|
|
} catch (l) {}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXCellObject.prototype._doOnFrameContentLoaded = function() {
|
|
if (this.conf.url_data.post_ifr == true) {
|
|
var m = this.getFrame().contentWindow.document;
|
|
var l = m.createElement("FORM");
|
|
l.method = "POST";
|
|
l.action = this.conf.url_data.url;
|
|
m.body.appendChild(l);
|
|
var g = {};
|
|
g["dhxr" + new Date().getTime()] = "1";
|
|
for (var c in this.conf.url_data.post_data) {
|
|
g[c] = this.conf.url_data.post_data[c]
|
|
}
|
|
for (var c in g) {
|
|
var h = m.createElement("INPUT");
|
|
h.type = "hidden";
|
|
h.name = c;
|
|
h.value = g[c];
|
|
l.appendChild(h);
|
|
h = null
|
|
}
|
|
this.conf.url_data.post_ifr = false;
|
|
l.submit()
|
|
} else {
|
|
this.callEvent("_onContentLoaded", [this._idd])
|
|
}
|
|
};
|
|
dhtmlXCellObject.prototype._detachURLEvents = function(a) {
|
|
if (a == null) {
|
|
if (this.dataType != "url") {
|
|
return
|
|
}
|
|
a = this.cell.childNodes[this.conf.idx.cont].firstChild
|
|
}
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.onload = null;
|
|
try {
|
|
a.contentWindow.document.body.removeEventListener("mousedown", this._doOnFrameMouseDown, false)
|
|
} catch (c) {}
|
|
} else {
|
|
a.onreadystatechange = null;
|
|
try {
|
|
a.contentWindow.document.body.detachEvent("onmousedown", this._doOnFrameMouseDown)
|
|
} catch (c) {}
|
|
}
|
|
a = null
|
|
};
|
|
dhtmlXCellObject.prototype._attachObject = function(o, l, n, a, m) {
|
|
if (o == "menu") {
|
|
if (typeof(m) != "undefined") {
|
|
o = m
|
|
} else {
|
|
o = document.createElement("DIV");
|
|
o.className = "dhx_cell_menu_" + (this.conf.borders ? "def" : "no_borders");
|
|
o.appendChild(document.createElement("DIV"))
|
|
}
|
|
this.cell.insertBefore(o, this.cell.childNodes[this.conf.idx.toolbar || this.conf.idx.cont]);
|
|
this.conf.ofs_nodes.t.menu = true;
|
|
this._updateIdx();
|
|
return o
|
|
}
|
|
if (o == "toolbar") {
|
|
if (typeof(m) != "undefined") {
|
|
o = m
|
|
} else {
|
|
o = document.createElement("DIV");
|
|
o.className = "dhx_cell_toolbar_" + (this.conf.borders ? "def" : "no_borders");
|
|
o.appendChild(document.createElement("DIV"));
|
|
o.firstChild.className = "dhx_toolbar_base_18_dhx_skyblue"
|
|
}
|
|
this.cell.insertBefore(o, this.cell.childNodes[this.conf.idx.cont]);
|
|
this.conf.ofs_nodes.t.toolbar = true;
|
|
this._updateIdx();
|
|
return o
|
|
}
|
|
if (o == "ribbon") {
|
|
if (typeof(m) != "undefined") {
|
|
o = m
|
|
} else {
|
|
o = document.createElement("DIV");
|
|
o.className = "dhx_cell_ribbon_" + (this.conf.borders ? "def" : "no_borders");
|
|
o.appendChild(document.createElement("DIV"))
|
|
}
|
|
this.cell.insertBefore(o, this.cell.childNodes[this.conf.idx.cont]);
|
|
this.conf.ofs_nodes.t.ribbon = true;
|
|
this._updateIdx();
|
|
this._adjustCont(this._idd);
|
|
return o
|
|
}
|
|
if (o == "sb") {
|
|
if (typeof(m) != "undefined") {
|
|
o = m
|
|
} else {
|
|
var c = l || {};
|
|
var q = (typeof(c.text) == "string" && c.text.length > 0 ? c.text : " ");
|
|
var g = (typeof(c.height) == "number" ? c.height : false);
|
|
var o = document.createElement("DIV");
|
|
o.className = "dhx_cell_statusbar_def";
|
|
o.innerHTML = "<div class='dhx_cell_statusbar_text'>" + q + "</div>";
|
|
if (g != false) {
|
|
o.firstChild.style.height = o.firstChild.style.lineHeight = g + "px"
|
|
}
|
|
} if (this.conf.idx.pr1 != null) {
|
|
this.cell.insertBefore(o, this.cell.childNodes[this.conf.idx.pr1])
|
|
} else {
|
|
this.cell.appendChild(o)
|
|
}
|
|
this.conf.ofs_nodes.b.sb = true;
|
|
this._updateIdx();
|
|
this._adjustCont(this._idd);
|
|
return o
|
|
}
|
|
if (a != true) {
|
|
this._detachObject(null, true, null)
|
|
}
|
|
if (typeof(n) == "string") {
|
|
this.cell.childNodes[this.conf.idx.cont].innerHTML = n
|
|
} else {
|
|
this.cell.childNodes[this.conf.idx.cont].appendChild(o)
|
|
}
|
|
o = null
|
|
};
|
|
dhtmlXCellObject.prototype._detachObject = function(l, c, a) {
|
|
this.callEvent("_onBeforeContentDetach", []);
|
|
if (l == "menu" || l == "toolbar" || l == "ribbon" || l == "sb") {
|
|
var h = this.cell.childNodes[this.conf.idx[l]];
|
|
h.parentNode.removeChild(h);
|
|
h = null;
|
|
this.conf.ofs_nodes[l == "sb" ? "b" : "t"][l] = false;
|
|
this._updateIdx();
|
|
if (!this.conf.unloading) {
|
|
this._adjustCont(this._idd)
|
|
}
|
|
return
|
|
}
|
|
if (c == true) {
|
|
a = false
|
|
} else {
|
|
if (typeof(a) == "undefined") {
|
|
a = document.body
|
|
} else {
|
|
if (typeof(a) == "string") {
|
|
a = document.getElementById(a)
|
|
}
|
|
}
|
|
} if (a === false) {
|
|
if (this.dataType == "url") {
|
|
this._detachURLEvents()
|
|
} else {
|
|
if (this.dataObj != null) {
|
|
if (typeof(this.dataObj.unload) == "function") {
|
|
this.dataObj.unload()
|
|
} else {
|
|
if (typeof(this.dataObj.destructor) == "function") {
|
|
this.dataObj.destructor()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var h = this.cell.childNodes[this.conf.idx.cont];
|
|
while (h.childNodes.length > 0) {
|
|
if (a === false) {
|
|
h.removeChild(h.lastChild)
|
|
} else {
|
|
h.firstChild.style.display = "none";
|
|
a.appendChild(h.firstChild)
|
|
}
|
|
}
|
|
if (this.conf.append_mode) {
|
|
h.style.overflow = "";
|
|
this.conf.append_mode = false
|
|
}
|
|
var g = (this.dataType == "tabbar");
|
|
this.dataObj = null;
|
|
this.dataType = null;
|
|
a = h = null;
|
|
if (this.conf.unloading != true && g) {
|
|
this.showHeader(true);
|
|
this._showBorders()
|
|
}
|
|
};
|
|
dhtmlXCellObject.prototype._attachFromCell = function(c) {
|
|
this.detachObject(true);
|
|
var h = "layout";
|
|
if (typeof(window.dhtmlXWindowsCell) != "undefined" && this instanceof window.dhtmlXWindowsCell) {
|
|
h = "window"
|
|
}
|
|
if (typeof(window.dhtmlXWindowsCell) != "undefined" && c instanceof window.dhtmlXWindowsCell && c.wins.w[c._idd].conf.parked) {
|
|
c.wins._winCellSetOpacity(c._idd, "open", false)
|
|
}
|
|
if (typeof(window.dhtmlXAccordionCell) != "undefined" && c instanceof window.dhtmlXAccordionCell && c.conf.opened == false) {
|
|
c._cellSetOpacity("open", false)
|
|
}
|
|
for (var g in c.dataNodes) {
|
|
this._attachObject(g, null, null, null, c.cell.childNodes[c.conf.idx[g]]);
|
|
this.dataNodes[g] = c.dataNodes[g];
|
|
c.dataNodes[g] = null;
|
|
c.conf.ofs_nodes[g == "sb" ? "b" : "t"][g] = false;
|
|
c._updateIdx()
|
|
}
|
|
this._mtbUpdBorder();
|
|
if (c.dataType != null && c.dataObj != null) {
|
|
this.dataType = c.dataType;
|
|
this.dataObj = c.dataObj;
|
|
while (c.cell.childNodes[c.conf.idx.cont].childNodes.length > 0) {
|
|
this.cell.childNodes[this.conf.idx.cont].appendChild(c.cell.childNodes[c.conf.idx.cont].firstChild)
|
|
}
|
|
c.dataType = null;
|
|
c.dataObj = null;
|
|
if (this.dataType == "grid") {
|
|
if (h == "window" && this.conf.skin == "dhx_skyblue") {
|
|
this.dataObj.entBox.style.border = "1px solid #a4bed4";
|
|
this.dataObj._sizeFix = 0
|
|
} else {
|
|
this.dataObj.entBox.style.border = "0px solid white";
|
|
this.dataObj._sizeFix = 2
|
|
}
|
|
}
|
|
} else {
|
|
while (c.cell.childNodes[c.conf.idx.cont].childNodes.length > 0) {
|
|
this.cell.childNodes[this.conf.idx.cont].appendChild(c.cell.childNodes[c.conf.idx.cont].firstChild)
|
|
}
|
|
}
|
|
this.conf.view = c.conf.view;
|
|
c.conf.view = "def";
|
|
for (var g in c.views) {
|
|
this.views[g] = c.views[g];
|
|
c.views[g] = null;
|
|
delete c.views[g]
|
|
}
|
|
c._updateIdx();
|
|
c._adjustCont();
|
|
this._updateIdx();
|
|
this._adjustCont();
|
|
if (h == "window" && this.wins.w[this._idd].conf.parked) {
|
|
this.wins._winCellSetOpacity(this._idd, "close", false)
|
|
}
|
|
};
|
|
|
|
function dhtmlXCalendarObject(m, u) {
|
|
this.i = {};
|
|
var g = null;
|
|
if (typeof(m) == "string") {
|
|
var h = document.getElementById(m)
|
|
} else {
|
|
var h = m
|
|
} if (h && typeof(h) == "object" && h.tagName && String(h.tagName).toLowerCase() != "input") {
|
|
g = h
|
|
}
|
|
h = null;
|
|
if (typeof(m) != "object" || !m.length) {
|
|
m = [m]
|
|
}
|
|
for (var c = 0; c < m.length; c++) {
|
|
if (typeof(m[c]) == "string") {
|
|
m[c] = (document.getElementById(m[c]) || null)
|
|
}
|
|
if (m[c] != null && m[c].tagName && String(m[c].tagName).toLowerCase() == "input") {
|
|
this.i[window.dhx4.newId()] = {
|
|
input: m[c]
|
|
}
|
|
} else {
|
|
if (!(m[c] instanceof Array) && m[c] instanceof Object && (m[c].input != null || m[c].button != null)) {
|
|
if (m[c].input != null && typeof(m[c].input) == "string") {
|
|
m[c].input = document.getElementById(m[c].input)
|
|
}
|
|
if (m[c].button != null && typeof(m[c].button) == "string") {
|
|
m[c].button = document.getElementById(m[c].button)
|
|
}
|
|
this.i[window.dhx4.newId()] = m[c]
|
|
}
|
|
}
|
|
m[c] = null
|
|
}
|
|
this.conf = {
|
|
skin: (u || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhtmlxcalendar") || "dhx_skyblue"),
|
|
zi: window.dhx4.newId(),
|
|
touch: (typeof(window.ontouchstart) != "undefined")
|
|
};
|
|
this.setSkin = function(q, a) {
|
|
if (this.conf.skin == q && !a) {
|
|
return
|
|
}
|
|
this.conf.skin = q;
|
|
this.base.className = "dhtmlxcalendar_" + this.conf.skin;
|
|
this._ifrSize()
|
|
};
|
|
this.base = document.createElement("DIV");
|
|
this.base.style.display = "none";
|
|
this.base.appendChild(document.createElement("DIV"));
|
|
if (g != null) {
|
|
this._hasParent = true;
|
|
g.appendChild(this.base);
|
|
g = null
|
|
} else {
|
|
document.body.appendChild(this.base)
|
|
}
|
|
this.setParent = function(a) {
|
|
if (this._hasParent) {
|
|
if (typeof(a) == "object") {
|
|
a.appendChild(this.base)
|
|
} else {
|
|
if (typeof(a) == "string") {
|
|
document.getElementById(a).appendChild(this.base)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.setSkin(this.conf.skin, true);
|
|
if (this.conf.touch) {
|
|
this.base.ontouchstart = function(a) {
|
|
a = a || event;
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
}
|
|
a.cancelBubble = true
|
|
}
|
|
} else {
|
|
this.base.onclick = function(a) {
|
|
a = a || event;
|
|
a.cancelBubble = true
|
|
};
|
|
this.base.onmousedown = function() {
|
|
return false
|
|
}
|
|
}
|
|
this.loadUserLanguage = function(y) {
|
|
if (!this.langData[y]) {
|
|
return
|
|
}
|
|
this.lang = y;
|
|
this.setWeekStartDay(this.langData[this.lang].weekstart);
|
|
this.setDateFormat(this.langData[this.lang].dateformat || "%Y-%m-%d");
|
|
if (this.msCont) {
|
|
var x = 0;
|
|
for (var v = 0; v < this.msCont.childNodes.length; v++) {
|
|
for (var a = 0; a < this.msCont.childNodes[v].childNodes.length; a++) {
|
|
this.msCont.childNodes[v].childNodes[a].innerHTML = this.langData[this.lang].monthesSNames[x++]
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.contMonth = document.createElement("DIV");
|
|
this.contMonth.className = "dhtmlxcalendar_month_cont";
|
|
this.contMonth.onselectstart = function(a) {
|
|
a = a || event;
|
|
a.cancelBubble = true;
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
} else {
|
|
a.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
this.base.firstChild.appendChild(this.contMonth);
|
|
var n = document.createElement("UL");
|
|
n.className = "dhtmlxcalendar_line";
|
|
this.contMonth.appendChild(n);
|
|
var s = document.createElement("LI");
|
|
s.className = "dhtmlxcalendar_cell dhtmlxcalendar_month_hdr";
|
|
s.innerHTML = "<div class='dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_left' onmouseover='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_left_hover\";' onmouseout='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_left\";'></div><span></span><div class='dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_right' onmouseover='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_right_hover\";' onmouseout='this.className=\"dhtmlxcalendar_month_arrow dhtmlxcalendar_month_arrow_right\";'></div>";
|
|
n.appendChild(s);
|
|
var l = this;
|
|
s[this.conf.touch ? "ontouchstart" : "onclick"] = function(w) {
|
|
w = w || event;
|
|
var q = (w.target || w.srcElement);
|
|
if (q.className && q.className.indexOf("dhtmlxcalendar_month_arrow") === 0) {
|
|
l._hideSelector();
|
|
var v = (q.parentNode.firstChild == q ? -1 : 1);
|
|
var a = new Date(l._activeMonth);
|
|
l._drawMonth(new Date(l._activeMonth.getFullYear(), l._activeMonth.getMonth() + v, 1, 0, 0, 0, 0));
|
|
l._evOnArrowClick([a, new Date(l._activeMonth)]);
|
|
return
|
|
}
|
|
if (q.className && q.className == "dhtmlxcalendar_month_label_month") {
|
|
w.cancelBubble = true;
|
|
l._showSelector("month", Math.round(q.offsetLeft + q.offsetWidth / 2), q.offsetTop + q.offsetHeight + 2, "selector_month", true);
|
|
return
|
|
}
|
|
if (q.className && q.className == "dhtmlxcalendar_month_label_year") {
|
|
w.cancelBubble = true;
|
|
l._showSelector("year", Math.round(q.offsetLeft + q.offsetWidth / 2), q.offsetTop + q.offsetHeight + 2, "selector_year", true);
|
|
return
|
|
}
|
|
l._hideSelector()
|
|
};
|
|
this.contDays = document.createElement("DIV");
|
|
this.contDays.className = "dhtmlxcalendar_days_cont";
|
|
this.base.firstChild.appendChild(this.contDays);
|
|
this.setWeekStartDay = function(a) {
|
|
if (a == 0) {
|
|
a = 7
|
|
}
|
|
this._wStart = Math.min(Math.max((isNaN(a) ? 1 : a), 1), 7);
|
|
this._drawDaysOfWeek()
|
|
};
|
|
this._drawDaysOfWeek = function() {
|
|
if (this.contDays.childNodes.length == 0) {
|
|
var y = document.createElement("UL");
|
|
y.className = "dhtmlxcalendar_line";
|
|
this.contDays.appendChild(y)
|
|
} else {
|
|
var y = this.contDays.firstChild
|
|
}
|
|
var v = this._wStart;
|
|
var x = this.langData[this.lang].daysSNames;
|
|
x.push(String(this.langData[this.lang].daysSNames[0]).valueOf());
|
|
for (var A = 0; A < 8; A++) {
|
|
if (y.childNodes[A] == null) {
|
|
var a = document.createElement("LI");
|
|
y.appendChild(a)
|
|
} else {
|
|
var a = y.childNodes[A]
|
|
} if (A == 0) {
|
|
a.className = "dhtmlxcalendar_cell_wn";
|
|
a.innerHTML = "<div class='dhtmlxcalendar_label'>" + (this.langData[this.lang].weekname || "w") + "</div>"
|
|
} else {
|
|
a.className = "dhtmlxcalendar_cell" + (v >= 6 ? " dhtmlxcalendar_day_weekday_cell" : "") + (A == 1 ? "_first" : "");
|
|
a.innerHTML = x[v];
|
|
if (++v > 7) {
|
|
v = 1
|
|
}
|
|
}
|
|
}
|
|
if (this._activeMonth != null) {
|
|
this._drawMonth(this._activeMonth)
|
|
}
|
|
};
|
|
this._wStart = this.langData[this.lang].weekstart;
|
|
this.setWeekStartDay(this._wStart);
|
|
this.contDates = document.createElement("DIV");
|
|
this.contDates.className = "dhtmlxcalendar_dates_cont";
|
|
this.base.firstChild.appendChild(this.contDates);
|
|
this.contDates[this.conf.touch ? "ontouchend" : "onclick"] = function(y) {
|
|
y = y || event;
|
|
var q = (y.target || y.srcElement);
|
|
if (q.parentNode != null && q.parentNode._date != null) {
|
|
q = q.parentNode
|
|
}
|
|
if (q._date != null && !q._css_dis) {
|
|
var w = l._activeDate.getHours();
|
|
var v = l._activeDate.getMinutes();
|
|
var x = q._date;
|
|
if (l.checkEvent("onBeforeChange")) {
|
|
if (!l.callEvent("onBeforeChange", [new Date(q._date.getFullYear(), q._date.getMonth(), q._date.getDate(), w, v)])) {
|
|
return
|
|
}
|
|
}
|
|
if (l._activeDateCell != null) {
|
|
l._activeDateCell._css_date = false;
|
|
l._updateCellStyle(l._activeDateCell._q, l._activeDateCell._w)
|
|
}
|
|
var a = (l._activeDate.getFullYear() + "_" + l._activeDate.getMonth() != x.getFullYear() + "_" + x.getMonth());
|
|
l._nullDate = false;
|
|
l._activeDate = new Date(x.getFullYear(), x.getMonth(), x.getDate(), w, v);
|
|
l._activeDateCell = q;
|
|
l._activeDateCell._css_date = true;
|
|
l._activeDateCell._css_hover = false;
|
|
l._updateCellStyle(l._activeDateCell._q, l._activeDateCell._w);
|
|
if (a) {
|
|
l._drawMonth(l._activeDate)
|
|
}
|
|
if (l._activeInp && l.i[l._activeInp] && l.i[l._activeInp].input != null) {
|
|
l.i[l._activeInp].input.value = l._dateToStr(new Date(l._activeDate.getTime()))
|
|
}
|
|
if (!l._hasParent) {
|
|
l._hide()
|
|
}
|
|
l._evOnClick([new Date(l._activeDate.getTime())])
|
|
}
|
|
};
|
|
if (!this.conf.touch) {
|
|
this.contDates.onmouseover = function(q) {
|
|
q = q || event;
|
|
var a = (q.target || q.srcElement);
|
|
if (a.parentNode != null && a.parentNode._date != null) {
|
|
a = a.parentNode
|
|
}
|
|
if (a._date != null) {
|
|
if (l._lastHover == a || a._css_hover) {
|
|
return
|
|
}
|
|
a._css_hover = true;
|
|
l._updateCellStyle(a._q, a._w);
|
|
l._lastHover = a;
|
|
l._evOnMouseOver([new Date(a._date.getFullYear(), a._date.getMonth(), a._date.getDate(), 0, 0, 0, 0), q]);
|
|
a = null
|
|
}
|
|
};
|
|
this.contDates.onmouseout = function(a) {
|
|
l._clearDayHover(a || event)
|
|
}
|
|
}
|
|
this._lastHover = null;
|
|
this._clearDayHover = function(a) {
|
|
if (!this._lastHover) {
|
|
return
|
|
}
|
|
this._lastHover._css_hover = false;
|
|
this._updateCellStyle(this._lastHover._q, this._lastHover._w);
|
|
l._evOnMouseOut([new Date(this._lastHover._date.getFullYear(), this._lastHover._date.getMonth(), this._lastHover._date.getDate(), 0, 0, 0, 0), a]);
|
|
this._lastHover = null
|
|
};
|
|
for (var c = 0; c < 6; c++) {
|
|
var n = document.createElement("UL");
|
|
n.className = "dhtmlxcalendar_line";
|
|
this.contDates.appendChild(n);
|
|
for (var r = 0; r <= 7; r++) {
|
|
var s = document.createElement("LI");
|
|
if (r == 0) {
|
|
s.className = "dhtmlxcalendar_cell_wn"
|
|
} else {
|
|
s.className = "dhtmlxcalendar_cell"
|
|
}
|
|
n.appendChild(s)
|
|
}
|
|
}
|
|
this.contTime = document.createElement("DIV");
|
|
this.contTime.className = "dhtmlxcalendar_time_cont";
|
|
this.base.firstChild.appendChild(this.contTime);
|
|
this.showTime = function() {
|
|
this.contTime.style.display = "";
|
|
this._ifrSize()
|
|
};
|
|
this.hideTime = function() {
|
|
this.contTime.style.display = "none";
|
|
this._ifrSize()
|
|
};
|
|
var n = document.createElement("UL");
|
|
n.className = "dhtmlxcalendar_line";
|
|
this.contTime.appendChild(n);
|
|
var s = document.createElement("LI");
|
|
s.className = "dhtmlxcalendar_cell dhtmlxcalendar_time_hdr";
|
|
s.innerHTML = "<div class='dhtmlxcalendar_time_img'></div><span class='dhtmlxcalendar_label_hours'></span><span class='dhtmlxcalendar_label_colon'> : </span><span class='dhtmlxcalendar_label_minutes'></span>";
|
|
n.appendChild(s);
|
|
s[this.conf.touch ? "ontouchstart" : "onclick"] = function(v) {
|
|
v = v || event;
|
|
var a = (v.target || v.srcElement);
|
|
if (a.tagName != null && a.tagName.toLowerCase() == "span" && a._par == true && a.parentNode != null) {
|
|
a = a.parentNode
|
|
}
|
|
if (a.className && a.className == "dhtmlxcalendar_label_hours") {
|
|
v.cancelBubble = true;
|
|
var q = l.contMonth.offsetHeight + l.contDays.offsetHeight + l.contDates.offsetHeight + a.offsetTop;
|
|
l._showSelector("hours", Math.round(a.offsetLeft + a.offsetWidth / 2), q - 2, "selector_hours", true);
|
|
return
|
|
}
|
|
if (a.className && a.className == "dhtmlxcalendar_label_minutes") {
|
|
v.cancelBubble = true;
|
|
if (l._minutesInterval == 1) {
|
|
var w = l.getFormatedDate("%i");
|
|
a.innerHTML = "<span class='dhtmlxcalendar_selected_date'>" + w.charAt(0) + "</span>" + w.charAt(1);
|
|
a.firstChild._par = true;
|
|
l._selectorMode = 1
|
|
}
|
|
var q = l.contMonth.offsetHeight + l.contDays.offsetHeight + l.contDates.offsetHeight + a.offsetTop;
|
|
l._showSelector("minutes", Math.round(a.offsetLeft + a.offsetWidth / 2), q - 2, "selector_minutes", true);
|
|
return
|
|
}
|
|
l._hideSelector()
|
|
};
|
|
this._activeMonth = null;
|
|
this._activeDate = new Date();
|
|
this._activeDateCell = null;
|
|
this.setDate = function(q) {
|
|
this._nullDate = (typeof(q) == "undefined" || q === "" || !q);
|
|
if (!(q instanceof Date)) {
|
|
q = this._strToDate(String(q || ""));
|
|
if (q == "Invalid Date") {
|
|
q = new Date()
|
|
}
|
|
}
|
|
var a = q.getTime();
|
|
if (this._isOutOfRange(a)) {
|
|
return
|
|
}
|
|
this._activeDate = new Date(a);
|
|
this._drawMonth(this._nullDate ? new Date() : this._activeDate);
|
|
this._updateVisibleHours();
|
|
this._updateVisibleMinutes()
|
|
};
|
|
this.getDate = function(q) {
|
|
if (this._nullDate) {
|
|
return null
|
|
}
|
|
var a = new Date(this._activeDate.getTime());
|
|
if (q) {
|
|
return this._dateToStr(a)
|
|
}
|
|
return a
|
|
};
|
|
this._drawMonth = function(E) {
|
|
if (!(E instanceof Date)) {
|
|
return
|
|
}
|
|
if (isNaN(E.getFullYear())) {
|
|
E = new Date(this._activeMonth.getFullYear(), this._activeMonth.getMonth(), 1, 0, 0, 0, 0)
|
|
}
|
|
this._activeMonth = new Date(E.getFullYear(), E.getMonth(), 1, 0, 0, 0, 0);
|
|
this._activeDateCell = null;
|
|
var C = new Date(this._activeMonth.getTime());
|
|
var x = C.getDay();
|
|
var I = x - this._wStart;
|
|
if (I < 0) {
|
|
I = I + 7
|
|
}
|
|
C.setDate(C.getDate() - I);
|
|
var L = E.getMonth();
|
|
var M = new Date(this._activeDate.getFullYear(), this._activeDate.getMonth(), this._activeDate.getDate(), 0, 0, 0, 0).getTime();
|
|
var A = 0;
|
|
for (var v = 0; v < 6; v++) {
|
|
var D = this._wStart;
|
|
for (var K = 0; K <= 7; K++) {
|
|
if (K == 0) {
|
|
var J = this.getWeekNumber(new Date(C.getFullYear(), C.getMonth(), C.getDate() + A, 0, 0, 0, 0));
|
|
this.contDates.childNodes[v].childNodes[K].innerHTML = "<div class='dhtmlxcalendar_label'>" + J + "</div>"
|
|
} else {
|
|
var a = new Date(C.getFullYear(), C.getMonth(), C.getDate() + A, 0, 0, 0, 0);
|
|
var H = a.getDay();
|
|
var y = a.getTime();
|
|
var F = "dhtmlxcalendar_label";
|
|
if (this._tipData[y] != null) {
|
|
if (this._tipData[y].usePopup && typeof(window.dhtmlXPopup) == "function") {
|
|
this.contDates.childNodes[v].childNodes[K].removeAttribute("title");
|
|
this._initTooltipPopup()
|
|
} else {
|
|
this.contDates.childNodes[v].childNodes[K].setAttribute("title", this._tipData[y].text)
|
|
} if (this._tipData[y].showIcon) {
|
|
F += " dhtmlxcalendar_label_title"
|
|
}
|
|
} else {
|
|
this.contDates.childNodes[v].childNodes[K].removeAttribute("title")
|
|
}
|
|
this.contDates.childNodes[v].childNodes[K].innerHTML = "<div class='" + F + "'>" + a.getDate() + "</div>";
|
|
this.contDates.childNodes[v].childNodes[K]._date = new Date(y);
|
|
this.contDates.childNodes[v].childNodes[K]._q = v;
|
|
this.contDates.childNodes[v].childNodes[K]._w = K;
|
|
this.contDates.childNodes[v].childNodes[K]._css_month = (a.getMonth() == L);
|
|
this.contDates.childNodes[v].childNodes[K]._css_date = (!this._nullDate && y == M);
|
|
this.contDates.childNodes[v].childNodes[K]._css_weekend = (D >= 6);
|
|
this.contDates.childNodes[v].childNodes[K]._css_dis = this._isOutOfRange(y);
|
|
this.contDates.childNodes[v].childNodes[K]._css_holiday = (this._holidays[y] == true);
|
|
this._updateCellStyle(v, K);
|
|
if (y == M) {
|
|
this._activeDateCell = this.contDates.childNodes[v].childNodes[K]
|
|
}
|
|
if (++D > 7) {
|
|
D = 1
|
|
}
|
|
A++
|
|
}
|
|
}
|
|
}
|
|
this.contMonth.firstChild.firstChild.childNodes[1].innerHTML = this._buildMonthHdr(E)
|
|
};
|
|
this._updateCellStyle = function(y, a) {
|
|
var x = this.contDates.childNodes[y].childNodes[a];
|
|
var v = "dhtmlxcalendar_cell dhtmlxcalendar_cell";
|
|
v += (x._css_month ? "_month" : "");
|
|
v += (x._css_date ? "_date" : "");
|
|
v += (x._css_weekend ? "_weekend" : "");
|
|
v += (x._css_holiday ? "_holiday" : "");
|
|
v += (x._css_dis ? "_dis" : "");
|
|
v += (x._css_hover && !x._css_dis ? "_hover" : "");
|
|
x.className = v;
|
|
x = null
|
|
};
|
|
this._minutesInterval = 5;
|
|
this._initSelector = function(E, y) {
|
|
if (!this._selCover) {
|
|
this._selCover = document.createElement("DIV");
|
|
this._selCover.className = "dhtmlxcalendar_selector_cover";
|
|
this.base.firstChild.appendChild(this._selCover)
|
|
}
|
|
if (!this._sel) {
|
|
this._sel = document.createElement("DIV");
|
|
this._sel.className = "dhtmlxcalendar_selector_obj";
|
|
this.base.firstChild.appendChild(this._sel);
|
|
this._sel.appendChild(document.createElement("TABLE"));
|
|
this._sel.firstChild.className = "dhtmlxcalendar_selector_table";
|
|
this._sel.firstChild.cellSpacing = 0;
|
|
this._sel.firstChild.cellPadding = 0;
|
|
this._sel.firstChild.border = 0;
|
|
this._sel.firstChild.appendChild(document.createElement("TBODY"));
|
|
this._sel.firstChild.firstChild.appendChild(document.createElement("TR"));
|
|
this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));
|
|
this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));
|
|
this._sel.firstChild.firstChild.firstChild.appendChild(document.createElement("TD"));
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[0].className = "dhtmlxcalendar_selector_cell_left";
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[1].className = "dhtmlxcalendar_selector_cell_middle";
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[2].className = "dhtmlxcalendar_selector_cell_right";
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[0].innerHTML = " ";
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[2].innerHTML = " ";
|
|
if (!this.conf.touch) {
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseover = function() {
|
|
this.className = "dhtmlxcalendar_selector_cell_left dhtmlxcalendar_selector_cell_left_hover"
|
|
};
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[0].onmouseout = function() {
|
|
this.className = "dhtmlxcalendar_selector_cell_left"
|
|
};
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseover = function() {
|
|
this.className = "dhtmlxcalendar_selector_cell_right dhtmlxcalendar_selector_cell_right_hover"
|
|
};
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[2].onmouseout = function() {
|
|
this.className = "dhtmlxcalendar_selector_cell_right"
|
|
};
|
|
this._sel.onmouseover = function(w) {
|
|
w = w || event;
|
|
var q = (w.target || w.srcElement);
|
|
if (q._cell === true) {
|
|
if (l._selHover != q) {
|
|
l._clearSelHover()
|
|
}
|
|
if (String(q.className).match(/^\s{0,}dhtmlxcalendar_selector_cell\s{0,}$/gi) != null) {
|
|
q.className += " dhtmlxcalendar_selector_cell_hover";
|
|
l._selHover = q
|
|
}
|
|
}
|
|
};
|
|
this._sel.onmouseout = function() {
|
|
l._clearSelHover()
|
|
}
|
|
}
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[0][this.conf.touch ? "ontouchstart" : "onclick"] = function(q) {
|
|
q = q || event;
|
|
q.cancelBubble = true;
|
|
l._scrollYears(-1)
|
|
};
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[2][this.conf.touch ? "ontouchstart" : "onclick"] = function(q) {
|
|
q = q || event;
|
|
q.cancelBubble = true;
|
|
l._scrollYears(1)
|
|
};
|
|
this._sel._ta = {};
|
|
this._selHover = null;
|
|
this._sel.appendChild(document.createElement("DIV"));
|
|
this._sel.lastChild.className = "dhtmlxcalendar_selector_obj_arrow"
|
|
}
|
|
if (this._sel._ta[E] == true) {
|
|
return
|
|
}
|
|
if (E == "month") {
|
|
this._msCells = {};
|
|
this.msCont = document.createElement("DIV");
|
|
this.msCont.className = "dhtmlxcalendar_area_" + y;
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.msCont);
|
|
var v = 0;
|
|
for (var a = 0; a < 4; a++) {
|
|
var D = document.createElement("UL");
|
|
D.className = "dhtmlxcalendar_selector_line";
|
|
this.msCont.appendChild(D);
|
|
for (var F = 0; F < 3; F++) {
|
|
var H = document.createElement("LI");
|
|
H.innerHTML = this.langData[this.lang].monthesSNames[v];
|
|
H.className = "dhtmlxcalendar_selector_cell";
|
|
D.appendChild(H);
|
|
H._month = v;
|
|
H._cell = true;
|
|
this._msCells[v++] = H
|
|
}
|
|
}
|
|
this.msCont[this.conf.touch ? "ontouchstart" : "onclick"] = function(w) {
|
|
w = w || event;
|
|
w.cancelBubble = true;
|
|
var q = (w.target || w.srcElement);
|
|
if (q._month != null) {
|
|
l._hideSelector();
|
|
l._updateActiveMonth();
|
|
l._drawMonth(new Date(l._activeMonth.getFullYear(), q._month, 1, 0, 0, 0, 0));
|
|
l._doOnSelectorChange()
|
|
}
|
|
}
|
|
}
|
|
if (E == "year") {
|
|
this._ysCells = {};
|
|
this.ysCont = document.createElement("DIV");
|
|
this.ysCont.className = "dhtmlxcalendar_area_" + y;
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.ysCont);
|
|
for (var a = 0; a < 4; a++) {
|
|
var D = document.createElement("UL");
|
|
D.className = "dhtmlxcalendar_selector_line";
|
|
this.ysCont.appendChild(D);
|
|
for (var F = 0; F < 3; F++) {
|
|
var H = document.createElement("LI");
|
|
H.className = "dhtmlxcalendar_selector_cell";
|
|
H._cell = true;
|
|
D.appendChild(H)
|
|
}
|
|
}
|
|
this.ysCont[this.conf.touch ? "ontouchstart" : "onclick"] = function(w) {
|
|
w = w || event;
|
|
w.cancelBubble = true;
|
|
var q = (w.target || w.srcElement);
|
|
if (q._year != null) {
|
|
l._hideSelector();
|
|
l._drawMonth(new Date(q._year, l._activeMonth.getMonth(), 1, 0, 0, 0, 0));
|
|
l._doOnSelectorChange()
|
|
}
|
|
}
|
|
}
|
|
if (E == "hours") {
|
|
this._hsCells = {};
|
|
this.hsCont = document.createElement("DIV");
|
|
this.hsCont.className = "dhtmlxcalendar_area_" + y;
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.hsCont);
|
|
var v = 0;
|
|
for (var a = 0; a < 4; a++) {
|
|
var D = document.createElement("UL");
|
|
D.className = "dhtmlxcalendar_selector_line";
|
|
this.hsCont.appendChild(D);
|
|
for (var F = 0; F < 6; F++) {
|
|
var H = document.createElement("LI");
|
|
H.innerHTML = this._fixLength(v, 2);
|
|
H.className = "dhtmlxcalendar_selector_cell";
|
|
D.appendChild(H);
|
|
H._hours = v;
|
|
H._cell = true;
|
|
this._hsCells[v++] = H
|
|
}
|
|
}
|
|
this.hsCont[this.conf.touch ? "ontouchstart" : "onclick"] = function(w) {
|
|
w = w || event;
|
|
w.cancelBubble = true;
|
|
var q = (w.target || w.srcElement);
|
|
if (q._hours != null) {
|
|
l._hideSelector();
|
|
l._activeDate.setHours(q._hours);
|
|
l._updateActiveHours();
|
|
l._updateVisibleHours();
|
|
l._doOnSelectorChange()
|
|
}
|
|
}
|
|
}
|
|
if (E == "minutes") {
|
|
var C = 4;
|
|
var x = 3;
|
|
var A = 2;
|
|
if (this._minutesInterval == 1) {
|
|
if (this._selectorMode == 1) {
|
|
C = 2;
|
|
x = 3;
|
|
A = 1
|
|
} else {
|
|
C = 2;
|
|
x = 5;
|
|
A = 1;
|
|
y += "5"
|
|
}
|
|
}
|
|
if (this._minutesInterval == 10) {
|
|
C = 2
|
|
}
|
|
if (this._minutesInterval == 15) {
|
|
C = 1;
|
|
x = 4;
|
|
y += "4"
|
|
}
|
|
this._rsCells = {};
|
|
this.rsCont = document.createElement("DIV");
|
|
this.rsCont.className = "dhtmlxcalendar_area_" + y;
|
|
this._sel.firstChild.firstChild.firstChild.childNodes[1].appendChild(this.rsCont);
|
|
var v = 0;
|
|
for (var a = 0; a < C; a++) {
|
|
var D = document.createElement("UL");
|
|
D.className = "dhtmlxcalendar_selector_line";
|
|
this.rsCont.appendChild(D);
|
|
for (var F = 0; F < x; F++) {
|
|
var H = document.createElement("LI");
|
|
H.innerHTML = (A > 1 ? this._fixLength(v, A) : v);
|
|
H.className = "dhtmlxcalendar_selector_cell";
|
|
D.appendChild(H);
|
|
H._minutes = v;
|
|
H._cell = true;
|
|
this._rsCells[v] = H;
|
|
v += this._minutesInterval
|
|
}
|
|
}
|
|
this.rsCont[this.conf.touch ? "ontouchstart" : "onclick"] = function(I) {
|
|
I = I || event;
|
|
I.cancelBubble = true;
|
|
var w = (I.target || I.srcElement);
|
|
if (w._minutes != null) {
|
|
if (l._minutesInterval == 1) {
|
|
var q = l.getFormatedDate("%i");
|
|
if (l._selectorMode == 1) {
|
|
q = w._minutes.toString() + q.charAt(1)
|
|
} else {
|
|
q = q.charAt(0) + w._minutes.toString()
|
|
}
|
|
l._activeDate.setMinutes(Number(q));
|
|
l._hideSelector();
|
|
if (l._selectorMode == 1) {
|
|
l._updateVisibleMinutes(true);
|
|
l._selectorMode = 2;
|
|
l._showSelector("minutes", l._sel._x, l._sel._y, "selector_minutes", true);
|
|
l._updateActiveMinutes();
|
|
return
|
|
} else {
|
|
l._selectorMode = 1
|
|
}
|
|
} else {
|
|
l._hideSelector();
|
|
l._activeDate.setMinutes(w._minutes);
|
|
l._updateActiveMinutes()
|
|
}
|
|
l._updateVisibleMinutes();
|
|
l._doOnSelectorChange()
|
|
}
|
|
}
|
|
}
|
|
this._sel._ta[E] = true
|
|
};
|
|
this._showSelector = function(A, q, C, w, a) {
|
|
if (a === true && this._sel != null && this._isSelectorVisible() && A == this._sel._t) {
|
|
this._hideSelector();
|
|
return
|
|
}
|
|
if (this.conf.skin == "dhx_terrace") {
|
|
q += 12
|
|
}
|
|
if (!this._sel || !this._sel._ta[A]) {
|
|
this._initSelector(A, w)
|
|
}
|
|
if (A != this._sel._t && this._sel._t == "minutes" && this._minutesInterval == 1) {
|
|
this.contTime.firstChild.firstChild.childNodes[3].innerHTML = this.getFormatedDate("%i")
|
|
}
|
|
this._sel._x = q;
|
|
this._sel._y = C;
|
|
this._sel.style.visibility = "hidden";
|
|
this._sel.style.display = "";
|
|
this._selCover.style.width = this.base.offsetWidth - 2 + "px";
|
|
this._selCover.style.top = this.contMonth.offsetHeight + "px";
|
|
this._selCover.style.height = this.contDates.offsetHeight + this.contDays.offsetHeight - 1 + "px";
|
|
this._selCover.style.display = "";
|
|
this._sel._t = A;
|
|
this._sel.className = "dhtmlxcalendar_selector_obj dhtmlxcalendar_" + w;
|
|
this._sel.childNodes[0].firstChild.firstChild.childNodes[0].style.display = this._sel.childNodes[0].firstChild.firstChild.childNodes[2].style.display = (A == "year" ? "" : "none");
|
|
var v = Math.max(0, q - Math.round(this._sel.offsetWidth / 2));
|
|
if (v + this._sel.offsetWidth > this._sel.parentNode.offsetWidth) {
|
|
v = this._sel.parentNode.offsetWidth - this._sel.offsetWidth
|
|
}
|
|
this._sel.style.left = v + "px";
|
|
if (A == "hours" || A == "minutes") {
|
|
this._sel.style.top = C - this._sel.offsetHeight + "px"
|
|
} else {
|
|
this._sel.style.top = C + "px"
|
|
}
|
|
this._sel.childNodes[1].style.width = this._sel.childNodes[0].offsetWidth + "px";
|
|
this._sel.style.visibility = "visible";
|
|
this._doOnSelectorShow(A)
|
|
};
|
|
this._doOnSelectorShow = function(a) {
|
|
if (a == "month") {
|
|
this._updateActiveMonth()
|
|
}
|
|
if (a == "year") {
|
|
this._updateYearsList(this._activeMonth)
|
|
}
|
|
if (a == "hours") {
|
|
this._updateActiveHours()
|
|
}
|
|
if (a == "minutes") {
|
|
this._updateActiveMinutes()
|
|
}
|
|
};
|
|
this._hideSelector = function(a) {
|
|
if (!this._sel) {
|
|
return
|
|
}
|
|
this._sel.style.display = "none";
|
|
this._sel.style.visible = "hidden";
|
|
this._selCover.style.display = "none";
|
|
if (this._sel._t == "minutes" && this._minutesInterval == 1) {
|
|
this.contTime.firstChild.firstChild.childNodes[3].innerHTML = this.getFormatedDate("%i");
|
|
this._unloadSelector("minutes")
|
|
}
|
|
};
|
|
this._isSelectorVisible = function() {
|
|
if (!this._sel) {
|
|
return false
|
|
}
|
|
return (this._sel.style.display != "none")
|
|
};
|
|
this._doOnSelectorChange = function(a) {
|
|
this.callEvent("onChange", [new Date(this._activeMonth.getFullYear(), this._activeMonth.getMonth(), this._activeDate.getDate(), this._activeDate.getHours(), this._activeDate.getMinutes(), this._activeDate.getSeconds()), a === true])
|
|
};
|
|
this._clearSelHover = function() {
|
|
if (!this._selHover) {
|
|
return
|
|
}
|
|
this._selHover.className = String(this._selHover.className.replace(/dhtmlxcalendar_selector_cell_hover/gi, ""));
|
|
this._selHover = null
|
|
};
|
|
this._unloadSelector = function(v) {
|
|
if (!this._sel) {
|
|
return
|
|
}
|
|
if (!this._sel._ta[v]) {
|
|
return
|
|
}
|
|
if (v == "month") {
|
|
this.msCont.onclick = this.msCont.ontouchstart = null;
|
|
this._msActive = null;
|
|
for (var q in this._msCells) {
|
|
this._msCells[q]._cell = null;
|
|
this._msCells[q]._month = null;
|
|
this._msCells[q].parentNode.removeChild(this._msCells[q]);
|
|
this._msCells[q] = null
|
|
}
|
|
this._msCells = null;
|
|
while (this.msCont.childNodes.length > 0) {
|
|
this.msCont.removeChild(this.msCont.lastChild)
|
|
}
|
|
this.msCont.parentNode.removeChild(this.msCont);
|
|
this.msCont = null
|
|
}
|
|
if (v == "year") {
|
|
this.ysCont.onclick = this.ysCont.ontouchstart = null;
|
|
for (var q in this._ysCells) {
|
|
this._ysCells[q]._cell = null;
|
|
this._ysCells[q]._year = null;
|
|
this._ysCells[q].parentNode.removeChild(this._ysCells[q]);
|
|
this._ysCells[q] = null
|
|
}
|
|
this._ysCells = null;
|
|
while (this.ysCont.childNodes.length > 0) {
|
|
this.ysCont.removeChild(this.ysCont.lastChild)
|
|
}
|
|
this.ysCont.parentNode.removeChild(this.ysCont);
|
|
this.ysCont = null
|
|
}
|
|
if (v == "hours") {
|
|
this.hsCont.onclick = this.hsCont.ontouchstart = null;
|
|
this._hsActive = null;
|
|
for (var q in this._hsCells) {
|
|
this._hsCells[q]._cell = null;
|
|
this._hsCells[q]._hours = null;
|
|
this._hsCells[q].parentNode.removeChild(this._hsCells[q]);
|
|
this._hsCells[q] = null
|
|
}
|
|
this._hsCells = null;
|
|
while (this.hsCont.childNodes.length > 0) {
|
|
this.hsCont.removeChild(this.hsCont.lastChild)
|
|
}
|
|
this.hsCont.parentNode.removeChild(this.hsCont);
|
|
this.hsCont = null
|
|
}
|
|
if (v == "minutes") {
|
|
this.rsCont.onclick = this.rsCont.ontouchstart = null;
|
|
this._rsActive = null;
|
|
for (var q in this._rsCells) {
|
|
this._rsCells[q]._cell = null;
|
|
this._rsCells[q]._minutes = null;
|
|
this._rsCells[q].parentNode.removeChild(this._rsCells[q]);
|
|
this._rsCells[q] = null
|
|
}
|
|
this._rsCells = null;
|
|
while (this.rsCont.childNodes.length > 0) {
|
|
this.rsCont.removeChild(this.rsCont.lastChild)
|
|
}
|
|
this.rsCont.parentNode.removeChild(this.rsCont);
|
|
this.rsCont = null
|
|
}
|
|
this._sel._ta[v] = null
|
|
};
|
|
this.setMinutesInterval = function(a) {
|
|
if (!(a == 1 || a == 5 || a == 10 || a == 15)) {
|
|
return
|
|
}
|
|
this._minutesInterval = a;
|
|
this._unloadSelector("minutes")
|
|
};
|
|
this._updateActiveMonth = function() {
|
|
if (typeof(this._msActive) != "undefined" && typeof(this._msCells[this._msActive]) != "undefined") {
|
|
this._msCells[this._msActive].className = "dhtmlxcalendar_selector_cell"
|
|
}
|
|
this._msActive = this._activeMonth.getMonth();
|
|
this._msCells[this._msActive].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"
|
|
};
|
|
this._updateActiveYear = function() {
|
|
var a = this._activeMonth.getFullYear();
|
|
if (this._ysCells[a]) {
|
|
this._ysCells[a].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"
|
|
}
|
|
};
|
|
this._updateYearsList = function(C) {
|
|
for (var x in this._ysCells) {
|
|
this._ysCells[x] = null;
|
|
delete this._ysCells[x]
|
|
}
|
|
var y = 12 * Math.floor(C.getFullYear() / 12);
|
|
for (var A = 0; A < 4; A++) {
|
|
for (var v = 0; v < 3; v++) {
|
|
this.ysCont.childNodes[A].childNodes[v].innerHTML = y;
|
|
this.ysCont.childNodes[A].childNodes[v]._year = y;
|
|
this.ysCont.childNodes[A].childNodes[v].className = "dhtmlxcalendar_selector_cell";
|
|
this._ysCells[y++] = this.ysCont.childNodes[A].childNodes[v]
|
|
}
|
|
}
|
|
this._updateActiveYear()
|
|
};
|
|
this._scrollYears = function(a) {
|
|
var v = (a < 0 ? this.ysCont.firstChild.firstChild._year : this.ysCont.lastChild.lastChild._year) + a;
|
|
var q = new Date(v, this._activeMonth.getMonth(), 1, 0, 0, 0, 0);
|
|
this._updateYearsList(q)
|
|
};
|
|
this._updateActiveHours = function() {
|
|
if (typeof(this._hsActive) != "undefined" && typeof(this._hsCells[this._hsActive]) != "undefined") {
|
|
this._hsCells[this._hsActive].className = "dhtmlxcalendar_selector_cell"
|
|
}
|
|
this._hsActive = this._activeDate.getHours();
|
|
this._hsCells[this._hsActive].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"
|
|
};
|
|
this._updateVisibleHours = function() {
|
|
this.contTime.firstChild.firstChild.childNodes[1].innerHTML = this._fixLength(this._activeDate.getHours(), 2)
|
|
};
|
|
this._updateActiveMinutes = function() {
|
|
if (this._rsActive != null && typeof(this._rsActive) != "undefined" && typeof(this._rsCells[this._rsActive]) != "undefined") {
|
|
this._rsCells[this._rsActive].className = "dhtmlxcalendar_selector_cell"
|
|
}
|
|
if (this._minutesInterval == 1) {
|
|
this._rsActive = (this.getFormatedDate("%i").toString()).charAt(this._selectorMode == 1 ? 0 : 1)
|
|
} else {
|
|
this._rsActive = this._activeDate.getMinutes()
|
|
} if (typeof(this._rsCells[this._rsActive]) != "undefined") {
|
|
this._rsCells[this._rsActive].className = "dhtmlxcalendar_selector_cell dhtmlxcalendar_selector_cell_active"
|
|
}
|
|
};
|
|
this._updateVisibleMinutes = function(q) {
|
|
var a = this._fixLength(this._activeDate.getMinutes(), 2).toString();
|
|
if (q == true) {
|
|
a = a.charAt(0) + "<span class='dhtmlxcalendar_selected_date'>" + a.charAt(1) + "</span>"
|
|
}
|
|
this.contTime.firstChild.firstChild.childNodes[3].innerHTML = a;
|
|
if (q == true) {
|
|
this.contTime.firstChild.firstChild.childNodes[3].lastChild._par = true
|
|
}
|
|
};
|
|
this._fixLength = function(a, q) {
|
|
while (String(a).length < q) {
|
|
a = "0" + String(a)
|
|
}
|
|
return a
|
|
};
|
|
this._dateFormat = "";
|
|
this._dateFormatRE = null;
|
|
this.setDateFormat = function(x) {
|
|
var w = {};
|
|
if (this._strToDate != null) {
|
|
for (var q in this.i) {
|
|
if (this.i[q].input != null && this.i[q].input.value.length > 0) {
|
|
var y = this._strToDate(this.i[q].input.value, this._dateFormat || this.langData[this.lang].dateformat || "%Y-%m-%d");
|
|
if (y instanceof Date) {
|
|
w[q] = y
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this._dateFormat = x;
|
|
var v = String(this._dateFormat).replace(/%[a-zA-Z]+/g, function(a) {
|
|
var A = a.replace(/%/, "");
|
|
switch (A) {
|
|
case "n":
|
|
case "h":
|
|
case "j":
|
|
case "g":
|
|
case "G":
|
|
return "\\d{1,2}";
|
|
case "m":
|
|
case "d":
|
|
case "H":
|
|
case "i":
|
|
case "s":
|
|
case "y":
|
|
return "\\d{2}";
|
|
case "Y":
|
|
return "\\d{4}";
|
|
case "M":
|
|
return "(" + l.langData[l.lang].monthesSNames.join("|").toLowerCase() + "){1,}";
|
|
case "F":
|
|
return "(" + l.langData[l.lang].monthesFNames.join("|").toLowerCase() + "){1,}";
|
|
case "D":
|
|
return "[a-z]{2}";
|
|
case "a":
|
|
case "A":
|
|
return "AM|PM"
|
|
}
|
|
return a
|
|
});
|
|
this._dateFormatRE = new RegExp(v, "i");
|
|
for (var q in w) {
|
|
this.i[q].input.value = this._dateToStr(w[q])
|
|
}
|
|
w = null
|
|
};
|
|
this.setDateFormat(this.langData[this.lang].dateformat || "%Y-%m-%d");
|
|
this._getInd = function(w, a) {
|
|
for (var v = 0; v < a.length; v++) {
|
|
if (a[v].toLowerCase() == w) {
|
|
return v
|
|
}
|
|
}
|
|
return -1
|
|
};
|
|
this._updateDateStr = function(q) {
|
|
if (!this._dateFormatRE || !q.match(this._dateFormatRE)) {
|
|
return
|
|
}
|
|
if (q == this.getFormatedDate()) {
|
|
return
|
|
}
|
|
var a = this._strToDate(q);
|
|
if (!(a instanceof Date)) {
|
|
return
|
|
}
|
|
if (this.checkEvent("onBeforeChange")) {
|
|
if (!this.callEvent("onBeforeChange", [new Date(a.getFullYear(), a.getMonth(), a.getDate(), a.getHours(), a.getMinutes(), a.getSeconds())])) {
|
|
if (this.i != null && this._activeInp != null && this.i[this._activeInp] != null && this.i[this._activeInp].input != null) {
|
|
this.i[this._activeInp].input.value = this.getFormatedDate()
|
|
}
|
|
return
|
|
}
|
|
}
|
|
this._nullDate = false;
|
|
this._activeDate = a;
|
|
this._drawMonth(this._nullDate ? new Date() : this._activeDate);
|
|
this._updateVisibleMinutes();
|
|
this._updateVisibleHours();
|
|
if (this._sel && this._isSelectorVisible()) {
|
|
this._doOnSelectorShow(this._sel._t)
|
|
}
|
|
this._doOnSelectorChange(true)
|
|
};
|
|
this.showMonth = function(a) {
|
|
if (typeof(a) == "string") {
|
|
a = this._strToDate(a)
|
|
}
|
|
if (!(a instanceof Date)) {
|
|
return
|
|
}
|
|
this._drawMonth(a)
|
|
};
|
|
this.setFormatedDate = function(x, y, q, w) {
|
|
var v = this._strToDate(y, x);
|
|
if (w) {
|
|
return v
|
|
}
|
|
this.setDate(v)
|
|
};
|
|
this.getFormatedDate = function(q, a) {
|
|
if (!(a && a instanceof Date)) {
|
|
if (this._nullDate) {
|
|
return ""
|
|
}
|
|
a = new Date(this._activeDate)
|
|
}
|
|
return this._dateToStr(a, q)
|
|
};
|
|
this.getWeekNumber = function(x) {
|
|
if (typeof(x) == "string") {
|
|
x = this._strToDate(x)
|
|
}
|
|
if (!(x instanceof Date)) {
|
|
return "Invalid Date"
|
|
}
|
|
if (typeof(this._ftDay) == "undefined") {
|
|
this._ftDay = 4
|
|
}
|
|
var E = this._wStart;
|
|
var w = E + 7;
|
|
var D = 4;
|
|
var q = new Date(x.getFullYear(), 0, 1, 0, 0, 0, 0);
|
|
var v = q.getDay();
|
|
if (v == 0) {
|
|
v = 7
|
|
}
|
|
if (D < E) {
|
|
D += 7;
|
|
v += 7
|
|
}
|
|
var A = 0;
|
|
if (v >= E && v <= D) {} else {
|
|
A = 1
|
|
}
|
|
var y = v - E;
|
|
var C = new Date(x.getFullYear(), 0, 1 - y + A * 7, 0, 0, 0, 0);
|
|
var H = 604800000;
|
|
var a = new Date(x.getFullYear(), x.getMonth(), x.getDate() + 1, 0, 0, 0, 0);
|
|
var F = Math.ceil((a.getTime() - C.getTime()) / H);
|
|
return F
|
|
};
|
|
this.showWeekNumbers = function() {
|
|
this.base.firstChild.className = "dhtmlxcalendar_wn"
|
|
};
|
|
this.hideWeekNumbers = function() {
|
|
this.base.firstChild.className = ""
|
|
};
|
|
this.show = function(v) {
|
|
if (!v && this._hasParent) {
|
|
this._show();
|
|
return
|
|
}
|
|
if (typeof(v) == "object" && typeof(v._dhtmlxcalendar_uid) != "undefined" && this.i[v._dhtmlxcalendar_uid] == v) {
|
|
this._show(v._dhtmlxcalendar_uid);
|
|
return
|
|
}
|
|
if (typeof(v) == "undefined") {
|
|
for (var q in this.i) {
|
|
if (!v) {
|
|
v = q
|
|
}
|
|
}
|
|
}
|
|
if (!v) {
|
|
return
|
|
}
|
|
this._show(v)
|
|
};
|
|
this.hide = function() {
|
|
if (this._isVisible()) {
|
|
this._hide()
|
|
}
|
|
};
|
|
this.isVisible = function() {
|
|
return this._isVisible()
|
|
};
|
|
this._activeInp = null;
|
|
this.pos = "bottom";
|
|
this.setPosition = function(a, q) {
|
|
this._px = null;
|
|
this._py = null;
|
|
if (a == "right" || a == "bottom") {
|
|
this.pos = a
|
|
} else {
|
|
this.pos = "int";
|
|
if (typeof(a) != "undefined" && !isNaN(a)) {
|
|
this.base.style.left = a + "px";
|
|
this._px = a
|
|
}
|
|
if (typeof(q) != "undefined" && !isNaN(q)) {
|
|
this.base.style.top = q + "px";
|
|
this._py = q
|
|
}
|
|
this._ifrSize()
|
|
}
|
|
};
|
|
this._show = function(A, a) {
|
|
if (a === true && this._activeInp == A && this._isVisible()) {
|
|
this._hide();
|
|
return
|
|
}
|
|
this.base.style.visibility = "hidden";
|
|
this.base.style.display = "";
|
|
if (!A) {
|
|
if (this._px && this._py) {
|
|
this.base.style.left = this._px + "px";
|
|
this.base.style.top = this._py + "px"
|
|
} else {
|
|
this.base.style.left = "0px";
|
|
this.base.style.top = "0px"
|
|
}
|
|
} else {
|
|
if (this.base.className.indexOf("dhtmlxcalendar_in_input") == -1) {
|
|
this.base.className += " dhtmlxcalendar_in_input"
|
|
}
|
|
var w = (this.i[A].input || this.i[A].button);
|
|
var q = (navigator.appVersion.indexOf("MSIE") != -1);
|
|
var x = Math.max((q ? document.documentElement : document.getElementsByTagName("html")[0]).scrollTop, document.body.scrollTop);
|
|
var v = x + (q ? Math.max(document.documentElement.clientHeight || 0, document.documentElement.offsetHeight || 0, document.body.clientHeight || 0) : window.innerHeight);
|
|
if (this.pos == "right") {
|
|
this.base.style.left = this._getLeft(w) + w.offsetWidth + "px";
|
|
this.base.style.top = Math.min(this._getTop(w), v - this.base.offsetHeight) + "px"
|
|
} else {
|
|
if (this.pos == "bottom") {
|
|
var y = this._getTop(w) + w.offsetHeight + 1;
|
|
if (y + this.base.offsetHeight > v) {
|
|
y = this._getTop(w) - this.base.offsetHeight
|
|
}
|
|
this.base.style.left = this._getLeft(w) + "px";
|
|
this.base.style.top = y + "px"
|
|
} else {
|
|
this.base.style.left = (this._px || 0) + "px";
|
|
this.base.style.top = (this._py || 0) + "px"
|
|
}
|
|
}
|
|
this._activeInp = A;
|
|
w = null
|
|
}
|
|
this._hideSelector();
|
|
this.base.style.visibility = "visible";
|
|
this.base.style.zIndex = window.dhx4.zim.reserve(this.conf.zi);
|
|
this._ifrSize();
|
|
if (this._ifr) {
|
|
this._ifr.style.display = ""
|
|
}
|
|
this.callEvent("onShow", [])
|
|
};
|
|
this._hide = function() {
|
|
this._hideSelector();
|
|
this.base.style.display = "none";
|
|
window.dhx4.zim.clear(this.conf.zi);
|
|
if (this.base.className.indexOf("dhtmlxcalendar_in_input") >= 0) {
|
|
this.base.className = this.base.className.replace(/\s{0,}dhtmlxcalendar_in_input/gi, "")
|
|
}
|
|
this._activeInp = null;
|
|
if (this._ifr) {
|
|
this._ifr.style.display = "none"
|
|
}
|
|
this.callEvent("onHide", [])
|
|
};
|
|
this._isVisible = function() {
|
|
return (this.base.style.display != "none")
|
|
};
|
|
this._getLeft = function(a) {
|
|
return this._posGetOffset(a).left
|
|
};
|
|
this._getTop = function(a) {
|
|
return this._posGetOffset(a).top
|
|
};
|
|
this._posGetOffsetSum = function(a) {
|
|
var v = 0,
|
|
q = 0;
|
|
while (a) {
|
|
v = v + parseInt(a.offsetTop);
|
|
q = q + parseInt(a.offsetLeft);
|
|
a = a.offsetParent
|
|
}
|
|
return {
|
|
top: v,
|
|
left: q
|
|
}
|
|
};
|
|
this._posGetOffsetRect = function(w) {
|
|
var A = w.getBoundingClientRect();
|
|
var C = document.body;
|
|
var q = document.documentElement;
|
|
var a = window.pageYOffset || q.scrollTop || C.scrollTop;
|
|
var x = window.pageXOffset || q.scrollLeft || C.scrollLeft;
|
|
var y = q.clientTop || C.clientTop || 0;
|
|
var D = q.clientLeft || C.clientLeft || 0;
|
|
var E = A.top + a - y;
|
|
var v = A.left + x - D;
|
|
return {
|
|
top: Math.round(E),
|
|
left: Math.round(v)
|
|
}
|
|
};
|
|
this._posGetOffset = function(a) {
|
|
return this[a.getBoundingClientRect ? "_posGetOffsetRect" : "_posGetOffsetSum"](a)
|
|
};
|
|
this._rangeActive = false;
|
|
this._rangeFrom = null;
|
|
this._rangeTo = null;
|
|
this._rangeSet = {};
|
|
this.setInsensitiveDays = function(w) {
|
|
var a = this._extractDates(w);
|
|
for (var v = 0; v < a.length; v++) {
|
|
this._rangeSet[new Date(a[v].getFullYear(), a[v].getMonth(), a[v].getDate(), 0, 0, 0, 0).getTime()] = true
|
|
}
|
|
this._drawMonth(this._activeMonth)
|
|
};
|
|
this.clearInsensitiveDays = function() {
|
|
this._clearRangeSet();
|
|
this._drawMonth(this._activeMonth)
|
|
};
|
|
this._holidays = {};
|
|
this.setHolidays = function(v) {
|
|
if (v == null) {
|
|
this._clearHolidays()
|
|
} else {
|
|
if (v != null) {
|
|
var a = this._extractDates(v);
|
|
for (var w = 0; w < a.length; w++) {
|
|
this._holidays[new Date(a[w].getFullYear(), a[w].getMonth(), a[w].getDate(), 0, 0, 0, 0).getTime()] = true
|
|
}
|
|
}
|
|
}
|
|
this._drawMonth(this._activeMonth)
|
|
};
|
|
this._extractDates = function(x) {
|
|
if (typeof(x) == "string" || x instanceof Date) {
|
|
x = [x]
|
|
}
|
|
var v = [];
|
|
for (var y = 0; y < x.length; y++) {
|
|
if (typeof(x[y]) == "string") {
|
|
var A = x[y].split(",");
|
|
for (var a = 0; a < A.length; a++) {
|
|
v.push(this._strToDate(A[a]))
|
|
}
|
|
} else {
|
|
if (x[y] instanceof Date) {
|
|
v.push(x[y])
|
|
}
|
|
}
|
|
}
|
|
return v
|
|
};
|
|
this._clearRange = function() {
|
|
this._rangeActive = false;
|
|
this._rangeType = null;
|
|
this._rangeFrom = null;
|
|
this._rangeTo = null
|
|
};
|
|
this._clearRangeSet = function() {
|
|
for (var q in this._rangeSet) {
|
|
this._rangeSet[q] = null;
|
|
delete this._rangeSet[q]
|
|
}
|
|
};
|
|
this._clearHolidays = function() {
|
|
for (var q in this._holidays) {
|
|
this._holidays[q] = null;
|
|
delete this._holidays[q]
|
|
}
|
|
};
|
|
this._isOutOfRange = function(q) {
|
|
if (this._rangeSet[q] == true) {
|
|
return true
|
|
}
|
|
if (this._rangeActive) {
|
|
if (this._rangeType == "in" && (q < this._rangeFrom || q > this._rangeTo)) {
|
|
return true
|
|
}
|
|
if (this._rangeType == "out" && (q >= this._rangeFrom && q <= this._rangeTo)) {
|
|
return true
|
|
}
|
|
if (this._rangeType == "from" && q < this._rangeFrom) {
|
|
return true
|
|
}
|
|
if (this._rangeType == "to" && q > this._rangeTo) {
|
|
return true
|
|
}
|
|
}
|
|
var a = new Date(q);
|
|
if (this._rangeWeek) {
|
|
if (this._rangeWeekData[a.getDay()] === true) {
|
|
return true
|
|
}
|
|
}
|
|
if (this._rangeMonth) {
|
|
if (this._rangeMonthData[a.getDate()] === true) {
|
|
return true
|
|
}
|
|
}
|
|
if (this._rangeYear) {
|
|
if (this._rangeYearData[a.getMonth() + "_" + a.getDate()] === true) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
};
|
|
this.clearSensitiveRange = function() {
|
|
this._clearRange();
|
|
this._drawMonth(this._activeMonth)
|
|
};
|
|
this.setSensitiveRange = function(w, v, a) {
|
|
var q = false;
|
|
if (w != null && v != null) {
|
|
if (!(w instanceof Date)) {
|
|
w = this._strToDate(w)
|
|
}
|
|
if (!(v instanceof Date)) {
|
|
v = this._strToDate(v)
|
|
}
|
|
if (w.getTime() > v.getTime()) {
|
|
return
|
|
}
|
|
this._rangeFrom = new Date(w.getFullYear(), w.getMonth(), w.getDate(), 0, 0, 0, 0).getTime();
|
|
this._rangeTo = new Date(v.getFullYear(), v.getMonth(), v.getDate(), 0, 0, 0, 0).getTime();
|
|
this._rangeActive = true;
|
|
this._rangeType = "in";
|
|
q = true
|
|
}
|
|
if (!q && w != null && v == null) {
|
|
if (!(w instanceof Date)) {
|
|
w = this._strToDate(w)
|
|
}
|
|
this._rangeFrom = new Date(w.getFullYear(), w.getMonth(), w.getDate(), 0, 0, 0, 0).getTime();
|
|
this._rangeTo = null;
|
|
if (a === true) {
|
|
this._rangeFrom++
|
|
}
|
|
this._rangeActive = true;
|
|
this._rangeType = "from";
|
|
q = true
|
|
}
|
|
if (!q && w == null && v != null) {
|
|
if (!(v instanceof Date)) {
|
|
v = this._strToDate(v)
|
|
}
|
|
this._rangeFrom = null;
|
|
this._rangeTo = new Date(v.getFullYear(), v.getMonth(), v.getDate(), 0, 0, 0, 0).getTime();
|
|
if (a === true) {
|
|
this._rangeTo--
|
|
}
|
|
this._rangeActive = true;
|
|
this._rangeType = "to";
|
|
q = true
|
|
}
|
|
if (q) {
|
|
this._drawMonth(this._activeMonth)
|
|
}
|
|
};
|
|
this.setInsensitiveRange = function(q, a) {
|
|
if (q != null && a != null) {
|
|
if (!(q instanceof Date)) {
|
|
q = this._strToDate(q)
|
|
}
|
|
if (!(a instanceof Date)) {
|
|
a = this._strToDate(a)
|
|
}
|
|
if (q.getTime() > a.getTime()) {
|
|
return
|
|
}
|
|
this._rangeFrom = new Date(q.getFullYear(), q.getMonth(), q.getDate(), 0, 0, 0, 0).getTime();
|
|
this._rangeTo = new Date(a.getFullYear(), a.getMonth(), a.getDate(), 0, 0, 0, 0).getTime();
|
|
this._rangeActive = true;
|
|
this._rangeType = "out";
|
|
this._drawMonth(this._activeMonth);
|
|
return
|
|
}
|
|
if (q != null && a == null) {
|
|
this.setSensitiveRange(null, q, true);
|
|
return
|
|
}
|
|
if (q == null && a != null) {
|
|
this.setSensitiveRange(a, null, true);
|
|
return
|
|
}
|
|
};
|
|
this.disableDays = function(A, y) {
|
|
if (A == "week") {
|
|
if (typeof(y) != "object" && typeof(y.length) == "undefined") {
|
|
y = [y]
|
|
}
|
|
if (!this._rangeWeekData) {
|
|
this._rangeWeekData = {}
|
|
}
|
|
for (var v in this._rangeWeekData) {
|
|
this._rangeWeekData[v] = false;
|
|
delete this._rangeWeekData[v]
|
|
}
|
|
for (var x = 0; x < y.length; x++) {
|
|
this._rangeWeekData[y[x]] = true;
|
|
if (y[x] == 7) {
|
|
this._rangeWeekData[0] = true
|
|
}
|
|
}
|
|
this._rangeWeek = true
|
|
}
|
|
if (A == "month") {
|
|
if (typeof(y) != "object" && typeof(y.length) == "undefined") {
|
|
y = [y]
|
|
}
|
|
if (!this._rangeMonthData) {
|
|
this._rangeMonthData = {}
|
|
}
|
|
for (var v in this._rangeMonthData) {
|
|
this._rangeMonthData[v] = false;
|
|
delete this._rangeMonthData[v]
|
|
}
|
|
for (var x = 0; x < y.length; x++) {
|
|
this._rangeMonthData[y[x]] = true
|
|
}
|
|
this._rangeMonth = true
|
|
}
|
|
if (A == "year") {
|
|
var w = this._extractDates(y);
|
|
if (!this._rangeYearData) {
|
|
this._rangeYearData = {}
|
|
}
|
|
for (var v in this._rangeYearData) {
|
|
this._rangeYearData[v] = false;
|
|
delete this._rangeYearData[v]
|
|
}
|
|
for (var x = 0; x < w.length; x++) {
|
|
this._rangeYearData[w[x].getMonth() + "_" + w[x].getDate()] = true
|
|
}
|
|
this._rangeYear = true
|
|
}
|
|
this._drawMonth(this._activeMonth)
|
|
};
|
|
this.enableDays = function(a) {
|
|
if (a == "week") {
|
|
this._rangeWeek = false
|
|
}
|
|
if (a == "month") {
|
|
this._rangeMonth = false
|
|
}
|
|
if (a == "year") {
|
|
this._rangeYear = false
|
|
}
|
|
this._drawMonth(this._activeMonth)
|
|
};
|
|
this._tipData = {};
|
|
this._tipTM = null;
|
|
this._tipTMTime = 400;
|
|
this._tipEvs = false;
|
|
this._tipPopup = null;
|
|
this._tipCellDate = null;
|
|
this._tipCellDim = null;
|
|
this.setTooltip = function(w, A, C, a) {
|
|
var x = this._extractDates(w);
|
|
for (var y = 0; y < x.length; y++) {
|
|
var v = new Date(x[y].getFullYear(), x[y].getMonth(), x[y].getDate(), 0, 0, 0, 0).getTime();
|
|
this._tipData[v] = {
|
|
text: A,
|
|
showIcon: C,
|
|
usePopup: a
|
|
}
|
|
}
|
|
this._drawMonth(this._activeMonth)
|
|
};
|
|
this.clearTooltip = function(v) {
|
|
var w = this._extractDates(v);
|
|
for (var x = 0; x < w.length; x++) {
|
|
var a = new Date(w[x].getFullYear(), w[x].getMonth(), w[x].getDate(), 0, 0, 0, 0).getTime();
|
|
this._tipData[a] = null;
|
|
delete this._tipData[a]
|
|
}
|
|
this._drawMonth(this._activeMonth)
|
|
};
|
|
this._initTooltipPopup = function() {
|
|
if (this._tipEvs) {
|
|
return
|
|
}
|
|
this.attachEvent("onMouseOver", function(q) {
|
|
var a = new Date(q.getFullYear(), q.getMonth(), q.getDate(), 0, 0, 0, 0).getTime();
|
|
if (this._tipData[a] != null) {
|
|
if (this._tipTM) {
|
|
window.clearTimeout(this._tipTM)
|
|
}
|
|
this._tipCellDate = q;
|
|
this._tipCellDim = this.getCellDimension(q);
|
|
this._tipText = this._tipData[a].text;
|
|
this._tipTM = window.setTimeout(this._showTooltipPopup, this._tipTMTime)
|
|
}
|
|
});
|
|
this.attachEvent("onMouseOut", this._hideTooltipPopup);
|
|
this._tipEvs = true
|
|
};
|
|
this._showTooltipPopup = function(A, a, C, q, v) {
|
|
if (!l._tipPopup) {
|
|
l._tipPopup = new dhtmlXPopup({
|
|
mode: "top"
|
|
})
|
|
}
|
|
l._tipPopup.attachHTML(l._tipText);
|
|
l._tipPopup.show(l._tipCellDim.x, l._tipCellDim.y, l._tipCellDim.w, l._tipCellDim.h);
|
|
l.callEvent("onPopupShow", [l._tipCellDate])
|
|
};
|
|
this._hideTooltipPopup = function() {
|
|
if (this._tipTM) {
|
|
window.clearTimeout(this._tipTM)
|
|
}
|
|
if (this._tipPopup != null && this._tipPopup.isVisible()) {
|
|
this._tipPopup.hide();
|
|
this.callEvent("onPopupHide", [this._tipCellDate])
|
|
}
|
|
};
|
|
this.getPopup = function() {
|
|
return this._tipPopup
|
|
};
|
|
this.getCellDimension = function(x) {
|
|
if (typeof(x) == "string") {
|
|
x = this._strToDate(x)
|
|
}
|
|
if (!(x instanceof Date)) {
|
|
return null
|
|
}
|
|
var y = new Date(x.getFullYear(), x.getMonth(), x.getDate(), 0, 0, 0, 0).getTime();
|
|
var v = null;
|
|
for (var A = 0; A < this.contDates.childNodes.length; A++) {
|
|
for (var a = 0; a < this.contDates.childNodes[A].childNodes.length; a++) {
|
|
var C = this.contDates.childNodes[A].childNodes[a];
|
|
if (C._date != null && C._date.getTime() == y) {
|
|
v = {
|
|
x: this._getLeft(C),
|
|
y: this._getTop(C),
|
|
w: C.offsetWidth,
|
|
h: C.offsetHeight
|
|
}
|
|
}
|
|
C = null
|
|
}
|
|
}
|
|
return v
|
|
};
|
|
this._updateFromInput = function(a) {
|
|
if (this._nullInInput && ((a.value).replace(/\s/g, "")).length == 0) {
|
|
if (this.checkEvent("onBeforeChange")) {
|
|
if (!this.callEvent("onBeforeChange", [null])) {
|
|
if (this.i != null && this._activeInp != null && this.i[this._activeInp] != null && this.i[this._activeInp].input != null) {
|
|
this.i[this._activeInp].input.value = this.getFormatedDate()
|
|
}
|
|
return
|
|
}
|
|
}
|
|
this.setDate(null)
|
|
} else {
|
|
this._updateDateStr(a.value)
|
|
}
|
|
a = null
|
|
};
|
|
this._doOnClick = function(q) {
|
|
q = q || event;
|
|
var a = (q.target || q.srcElement);
|
|
if (a._dhtmlxcalendar_uid && a._dhtmlxcalendar_uid != l._activeInp && l._isVisible() && l._activeInp) {
|
|
l._hide();
|
|
return
|
|
}
|
|
if (!a._dhtmlxcalendar_uid || !l.i[a._dhtmlxcalendar_uid]) {
|
|
if (l._isSelectorVisible()) {
|
|
l._hideSelector()
|
|
} else {
|
|
if (!l._hasParent && l._isVisible()) {
|
|
l._hide()
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this._doOnKeyDown = function(a) {
|
|
a = a || event;
|
|
if (a.keyCode == 27 || a.keyCode == 13) {
|
|
if (l._isSelectorVisible()) {
|
|
l._hideSelector()
|
|
} else {
|
|
if (l._isVisible() && !l._hasParent) {
|
|
l._hide()
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this._doOnInpClick = function(q) {
|
|
q = q || event;
|
|
var a = (q.target || q.srcElement);
|
|
if (!a._dhtmlxcalendar_uid) {
|
|
return
|
|
}
|
|
if (!l._listenerEnabled) {
|
|
l._updateFromInput(a)
|
|
}
|
|
l._show(a._dhtmlxcalendar_uid, true)
|
|
};
|
|
this._doOnInpKeyUp = function(q) {
|
|
q = q || event;
|
|
var a = (q.target || q.srcElement);
|
|
if (q.keyCode == 13 || !a._dhtmlxcalendar_uid) {
|
|
return
|
|
}
|
|
if (!l._listenerEnabled) {
|
|
l._updateFromInput(a)
|
|
}
|
|
};
|
|
this._doOnBtnClick = function(q) {
|
|
q = q || event;
|
|
var a = (q.target || q.srcElement);
|
|
if (!a._dhtmlxcalendar_uid) {
|
|
return
|
|
}
|
|
if (l.i[a._dhtmlxcalendar_uid].input != null) {
|
|
l._updateFromInput(l.i[a._dhtmlxcalendar_uid].input)
|
|
}
|
|
l._show(a._dhtmlxcalendar_uid, true)
|
|
};
|
|
this._doOnUnload = function() {
|
|
if (l && l.unload) {
|
|
l.unload()
|
|
}
|
|
};
|
|
if (typeof(window.addEventListener) == "function") {
|
|
document.body.addEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnClick, false);
|
|
window.addEventListener("keydown", l._doOnKeyDown, false);
|
|
window.addEventListener("unload", l._doOnUnload, false)
|
|
} else {
|
|
document.body.attachEvent("onclick", l._doOnClick);
|
|
document.body.attachEvent("onkeydown", l._doOnKeyDown);
|
|
window.attachEvent("onunload", l._doOnUnload)
|
|
}
|
|
this.attachObj = function(v) {
|
|
var q = window.dhx4.newId();
|
|
if (typeof(v) == "string") {
|
|
this.i[q] = {
|
|
input: document.getElementById(v)
|
|
}
|
|
} else {
|
|
if (typeof(v.tagName) != "undefined") {
|
|
this.i[q] = {
|
|
input: v
|
|
}
|
|
} else {
|
|
if (typeof(v) == "object" && (v.input != null || v.button != null)) {
|
|
this.i[q] = {};
|
|
if (v.input != null) {
|
|
this.i[q].input = (typeof(v.input) == "string" ? document.getElementById(v.input) : v.input)
|
|
}
|
|
if (v.button != null) {
|
|
this.i[q].button = (typeof(v.button) == "string" ? document.getElementById(v.button) : v.button)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this._attachEventsToObject(q);
|
|
return q
|
|
};
|
|
this.detachObj = function(w) {
|
|
var v = null;
|
|
if (this.i[w] != null) {
|
|
v = w
|
|
} else {
|
|
if (typeof(w) == "string") {
|
|
w = document.getElementById(w);
|
|
v = w._dhtmlxcalendar_uid
|
|
} else {
|
|
if (typeof(w.tagName) != "undefined") {
|
|
v = w._dhtmlxcalendar_uid
|
|
} else {
|
|
if (typeof(w) == "object" && (w.input != null || w.button != null)) {
|
|
if (v == null && w.input != null) {
|
|
v = (typeof(w.input) == "string" ? document.getElementById(w.input) : w.input)._dhtmlxcalendar_uid
|
|
}
|
|
if (v == null && w.button != null) {
|
|
v = (typeof(w.button) == "string" ? document.getElementById(w.button) : w.button)._dhtmlxcalendar_uid
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} if (v != null && this.i[v] != null) {
|
|
this._detachEventsFromObject(v);
|
|
for (var q in this.i[q]) {
|
|
this.i[v][q]._dhtmlxcalendar_uid = null;
|
|
this.i[v][q] = null;
|
|
delete this.i[v][q]
|
|
}
|
|
this.i[v] = null;
|
|
delete this.i[v];
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
this._attachEventsToObject = function(q) {
|
|
if (this.i[q].button != null) {
|
|
this.i[q].button._dhtmlxcalendar_uid = q;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.i[q].button.addEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnBtnClick, false)
|
|
} else {
|
|
this.i[q].button.attachEvent("onclick", l._doOnBtnClick)
|
|
}
|
|
} else {
|
|
if (this.i[q].input != null) {
|
|
this.i[q].input._dhtmlxcalendar_uid = q;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.i[q].input.addEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnInpClick, false);
|
|
this.i[q].input.addEventListener("keyup", l._doOnInpKeyUp, false)
|
|
} else {
|
|
this.i[q].input.attachEvent("onclick", l._doOnInpClick);
|
|
this.i[q].input.attachEvent("onkeyup", l._doOnInpKeyUp)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this._detachEventsFromObject = function(q) {
|
|
if (this.i[q].button != null) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.i[q].button.removeEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnBtnClick, false)
|
|
} else {
|
|
this.i[q].button.detachEvent("onclick", l._doOnBtnClick)
|
|
}
|
|
} else {
|
|
if (this.i[q].input != null) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.i[q].input.removeEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnInpClick, false);
|
|
this.i[q].input.removeEventListener("keyup", l._doOnInpKeyUp, false)
|
|
} else {
|
|
this.i[q].input.detachEvent("onclick", l._doOnInpClick);
|
|
this.i[q].input.detachEvent("onkeyup", l._doOnInpKeyUp)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.enableListener = function(a) {
|
|
if (!a) {
|
|
return
|
|
}
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.addEventListener("focus", l._listenerEvFocus, false);
|
|
a.addEventListener("blur", l._listenerEvBlur, false)
|
|
} else {
|
|
a.attachEvent("onfocus", l._listenerEvFocus);
|
|
a.attachEvent("onblur", l._listenerEvBlur)
|
|
}
|
|
a = null
|
|
};
|
|
this.disableListener = function(a) {
|
|
if (!a) {
|
|
return
|
|
}
|
|
a._f0 = false;
|
|
if (this._tmListener) {
|
|
window.clearTimeout(this._tmListener)
|
|
}
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.removeEventListener("focus", l._listenerEvFocus, false);
|
|
a.removeEventListener("blur", l._listenerEvBlur, false)
|
|
} else {
|
|
a.detachEvent("onfocus", l._listenerEvFocus);
|
|
a.detachEvent("onblur", l._listenerEvBlur)
|
|
}
|
|
a = null
|
|
};
|
|
this._startListener = function(a) {
|
|
if (this._tmListener) {
|
|
window.clearTimeout(this._tmListener)
|
|
}
|
|
if (typeof(a._v1) == "undefined") {
|
|
a._v1 = a.value
|
|
}
|
|
if (a._v1 != a.value) {
|
|
this._updateFromInput(a);
|
|
a._v1 = a.value
|
|
}
|
|
if (a._f0) {
|
|
this._tmListener = window.setTimeout(function() {
|
|
l._startListener(a)
|
|
}, 100)
|
|
}
|
|
};
|
|
this._listenerEvFocus = function(q) {
|
|
q = q || event;
|
|
var a = q.target || q.srcElement;
|
|
a._f0 = true;
|
|
l._startListener(a);
|
|
a = null
|
|
};
|
|
this._listenerEvBlur = function(q) {
|
|
q = q || event;
|
|
var a = q.target || q.srcElement;
|
|
a._f0 = false;
|
|
a = null
|
|
};
|
|
for (var o in this.i) {
|
|
this._attachEventsToObject(o)
|
|
}
|
|
window.dhx4._eventable(this);
|
|
this._evOnArrowClick = function(a) {
|
|
return this.callEvent("onArrowClick", a)
|
|
};
|
|
this._evOnClick = function(a) {
|
|
return this.callEvent("onClick", a)
|
|
};
|
|
this._evOnMouseOut = function(a) {
|
|
return this.callEvent("onMouseOut", a)
|
|
};
|
|
this._evOnMouseOver = function(a) {
|
|
return this.callEvent("onMouseOver", a)
|
|
};
|
|
this.unload = function() {
|
|
this._activeDate = null;
|
|
this._activeDateCell = null;
|
|
this._activeInp = null;
|
|
this._activeMonth = null;
|
|
this._dateFormat = null;
|
|
this._dateFormatRE = null;
|
|
this._lastHover = null;
|
|
if (this._tmListener) {
|
|
window.clearTimeout(this._tmListener)
|
|
}
|
|
this._tmListener = null;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
document.body.removeEventListener((this.conf.touch ? "touchstart" : "click"), l._doOnClick, false);
|
|
window.removeEventListener("keydown", l._doOnKeyDown, false);
|
|
window.removeEventListener("unload", l._doOnUnload, false)
|
|
} else {
|
|
document.body.detachEvent("onclick", l._doOnClick);
|
|
document.body.detachEvent("onkeydown", l._doOnKeyDown);
|
|
window.detachEvent("onunload", l._doOnKeyDown)
|
|
}
|
|
this._doOnClick = null;
|
|
this._doOnKeyDown = null;
|
|
this._doOnUnload = null;
|
|
for (var q in this.i) {
|
|
this.i[q]._dhtmlxcalendar_uid = null;
|
|
this._detachEventsFromObject(q);
|
|
this.disableListener(this.i[q].input);
|
|
this.i[q] = null;
|
|
delete this.i[q]
|
|
}
|
|
this.i = null;
|
|
this._doOnInpClick = null;
|
|
this._doOnInpKeyUp = null;
|
|
window.dhx4._eventable(this, "clear");
|
|
this.contMonth.onselectstart = null;
|
|
this.contMonth.firstChild.firstChild.onclick = null;
|
|
this.contMonth.firstChild.firstChild.ontouchstart = null;
|
|
this.contMonth.firstChild.firstChild.firstChild.onmouseover = null;
|
|
this.contMonth.firstChild.firstChild.firstChild.onmouseout = null;
|
|
this.contMonth.firstChild.firstChild.lastChild.onmouseover = null;
|
|
this.contMonth.firstChild.firstChild.lastChild.onmouseout = null;
|
|
while (this.contMonth.firstChild.firstChild.childNodes.length > 0) {
|
|
this.contMonth.firstChild.firstChild.removeChild(this.contMonth.firstChild.firstChild.lastChild)
|
|
}
|
|
this.contMonth.firstChild.removeChild(this.contMonth.firstChild.firstChild);
|
|
this.contMonth.removeChild(this.contMonth.firstChild);
|
|
this.contMonth.parentNode.removeChild(this.contMonth);
|
|
this.contMonth = null;
|
|
while (this.contDays.firstChild.childNodes.length > 0) {
|
|
this.contDays.firstChild.removeChild(this.contDays.firstChild.lastChild)
|
|
}
|
|
this.contDays.removeChild(this.contDays.firstChild);
|
|
this.contDays.parentNode.removeChild(this.contDays);
|
|
this.contDays = null;
|
|
this.contDates.onclick = null;
|
|
this.contDates.ontouchstart = null;
|
|
this.contDates.onmouseover = null;
|
|
this.contDates.onmouseout = null;
|
|
while (this.contDates.childNodes.length > 0) {
|
|
while (this.contDates.lastChild.childNodes.length > 0) {
|
|
this.contDates.lastChild.lastChild._css_date = null;
|
|
this.contDates.lastChild.lastChild._css_month = null;
|
|
this.contDates.lastChild.lastChild._css_weekend = null;
|
|
this.contDates.lastChild.lastChild._css_hover = null;
|
|
this.contDates.lastChild.lastChild._date = null;
|
|
this.contDates.lastChild.lastChild._q = null;
|
|
this.contDates.lastChild.lastChild._w = null;
|
|
this.contDates.lastChild.removeChild(this.contDates.lastChild.lastChild)
|
|
}
|
|
this.contDates.removeChild(this.contDates.lastChild)
|
|
}
|
|
this.contDates.parentNode.removeChild(this.contDates);
|
|
this.contDates = null;
|
|
this.contTime.firstChild.firstChild.onclick = null;
|
|
this.contTime.firstChild.firstChild.ontouchstart = null;
|
|
while (this.contTime.firstChild.firstChild.childNodes.length > 0) {
|
|
this.contTime.firstChild.firstChild.removeChild(this.contTime.firstChild.firstChild.lastChild)
|
|
}
|
|
this.contTime.firstChild.removeChild(this.contTime.firstChild.firstChild);
|
|
this.contTime.removeChild(this.contTime.firstChild);
|
|
this.contTime.parentNode.removeChild(this.contTime);
|
|
this.contTime = null;
|
|
this._lastHover = null;
|
|
this._unloadSelector("month");
|
|
this._unloadSelector("year");
|
|
this._unloadSelector("hours");
|
|
this._unloadSelector("minutes");
|
|
if (this._selCover) {
|
|
this._selCover.parentNode.removeChild(this._selCover);
|
|
this._selCover = null
|
|
}
|
|
if (this._sel) {
|
|
for (var q in this._sel._ta) {
|
|
this._sel._ta[q] = null
|
|
}
|
|
this._sel._ta = null;
|
|
this._sel._t = null;
|
|
this._sel.onmouseover = null;
|
|
this._sel.onmouseout = null;
|
|
while (this._sel.firstChild.firstChild.firstChild.childNodes.length > 0) {
|
|
this._sel.firstChild.firstChild.firstChild.lastChild.onclick = null;
|
|
this._sel.firstChild.firstChild.firstChild.lastChild.onmouseover = null;
|
|
this._sel.firstChild.firstChild.firstChild.lastChild.onmouseout = null;
|
|
this._sel.firstChild.firstChild.firstChild.removeChild(this._sel.firstChild.firstChild.firstChild.lastChild)
|
|
}
|
|
this._sel.firstChild.firstChild.removeChild(this._sel.firstChild.firstChild.firstChild);
|
|
this._sel.firstChild.removeChild(this._sel.firstChild.firstChild);
|
|
while (this._sel.childNodes.length > 0) {
|
|
this._sel.removeChild(this._sel.lastChild)
|
|
}
|
|
this._sel.parentNode.removeChild(this._sel);
|
|
this._sel = null
|
|
}
|
|
this.base.onclick = null;
|
|
this.base.onmousedown = null;
|
|
this.base.ontouchstart = null;
|
|
this.base.onmouseout = null;
|
|
this.base.parentNode.removeChild(this.base);
|
|
this.base = null;
|
|
this._clearDayHover = null;
|
|
this._clearSelHover = null;
|
|
this._doOnSelectorChange = null;
|
|
this._doOnSelectorShow = null;
|
|
this._drawMonth = null;
|
|
this._fixLength = null;
|
|
this._getLeft = null;
|
|
this._getTop = null;
|
|
this._ifrSize = null;
|
|
this._hide = null;
|
|
this._hideSelector = null;
|
|
this._initSelector = null;
|
|
this._isSelectorVisible = null;
|
|
this._isVisible = null;
|
|
this._posGetOffset = null;
|
|
this._posGetOffsetRect = null;
|
|
this._posGetOffsetSum = null;
|
|
this._scrollYears = null;
|
|
this._show = null;
|
|
this._showSelector = null;
|
|
this._strToDate = null;
|
|
this._updateActiveHours = null;
|
|
this._updateActiveMinutes = null;
|
|
this._updateActiveMonth = null;
|
|
this._updateActiveYear = null;
|
|
this._updateCellStyle = null;
|
|
this._updateDateStr = null;
|
|
this._updateVisibleHours = null;
|
|
this._updateVisibleMinutes = null;
|
|
this._updateYearsList = null;
|
|
this.enableIframe = null;
|
|
this.hide = null;
|
|
this.hideTime = null;
|
|
this.setDate = null;
|
|
this.setDateFormat = null;
|
|
this.setYearsRange = null;
|
|
this.show = null;
|
|
this.showTime = null;
|
|
this.unload = null;
|
|
if (this._tipPopup != null) {
|
|
this._tipPopup.unload();
|
|
this._tipPopup = null
|
|
}
|
|
for (var q in this) {
|
|
delete this[q]
|
|
}
|
|
q = l = null
|
|
};
|
|
this.setDate(this._activeDate);
|
|
return this
|
|
}
|
|
dhtmlXCalendarObject.prototype.lang = "en";
|
|
dhtmlXCalendarObject.prototype.langData = {
|
|
en: {
|
|
dateformat: "%Y-%m-%d",
|
|
hdrformat: "%F %Y",
|
|
monthesFNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
|
monthesSNames: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
|
daysFNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
daysSNames: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
weekstart: 1,
|
|
weekname: "w"
|
|
}
|
|
};
|
|
dhtmlXCalendarObject.prototype._buildMonthHdr = function(l) {
|
|
var c = this;
|
|
var h = function(m) {
|
|
return (String(m).length == 1 ? "0" + String(m) : m)
|
|
};
|
|
var a = function(m, n) {
|
|
return "<span class='dhtmlxcalendar_month_label_" + m + "'>" + n + "</span>"
|
|
};
|
|
var g = String(this.langData[this.lang].hdrformat || ("%F %Y")).replace(/%[a-z]/gi, function(m) {
|
|
switch (m) {
|
|
case "%m":
|
|
return a("month", h(l.getMonth() + 1));
|
|
case "%n":
|
|
return a("month", l.getMonth() + 1);
|
|
case "%M":
|
|
return a("month", c.langData[c.lang].monthesSNames[l.getMonth()]);
|
|
case "%F":
|
|
return a("month", c.langData[c.lang].monthesFNames[l.getMonth()]);
|
|
case "%y":
|
|
return a("year", h(l.getYear() % 100));
|
|
case "%Y":
|
|
return a("year", l.getFullYear());
|
|
case "%%":
|
|
return "%";
|
|
default:
|
|
return m
|
|
}
|
|
});
|
|
c = h = a = null;
|
|
return g
|
|
};
|
|
dhtmlXCalendarObject.prototype.enableIframe = function(a) {
|
|
if (a == true) {
|
|
if (!this._ifr) {
|
|
this._ifr = document.createElement("IFRAME");
|
|
this._ifr.frameBorder = 0;
|
|
this._ifr.border = 0;
|
|
this._ifr.setAttribute("src", "javascript:false;");
|
|
this._ifr.className = "dhtmlxcalendar_ifr";
|
|
this._ifr.onload = function() {
|
|
this.onload = null;
|
|
this.contentWindow.document.open("text/html", "replace");
|
|
this.contentWindow.document.write("<html><head><style>html,body{width:100%;height:100%;overflow:hidden;margin:0px;}</style></head><body</body></html>")
|
|
};
|
|
this.base.parentNode.insertBefore(this._ifr, this.base);
|
|
this._ifrSize()
|
|
}
|
|
} else {
|
|
if (this._ifr) {
|
|
this._ifr.parentNode.removeChild(this._ifr);
|
|
this._ifr = null
|
|
}
|
|
}
|
|
};
|
|
dhtmlXCalendarObject.prototype._ifrSize = function() {
|
|
if (this._ifr) {
|
|
this._ifr.style.left = this.base.style.left;
|
|
this._ifr.style.top = this.base.style.top;
|
|
this._ifr.style.width = this.base.offsetWidth + "px";
|
|
this._ifr.style.height = this.base.offsetHeight + "px"
|
|
}
|
|
};
|
|
dhtmlxCalendarObject = dhtmlXCalendarObject;
|
|
dhtmlXCalendarObject.prototype._strToDate = function(l, A) {
|
|
A = (A || this._dateFormat);
|
|
A = A.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\\:|]/g, "\\$&");
|
|
var D = [];
|
|
var s = [];
|
|
A = A.replace(/%[a-z]/gi, function(q) {
|
|
switch (q) {
|
|
case "%d":
|
|
case "%m":
|
|
case "%y":
|
|
case "%h":
|
|
case "%H":
|
|
case "%i":
|
|
case "%s":
|
|
s.push(q);
|
|
return "(\\d{2})";
|
|
case "%D":
|
|
case "%l":
|
|
case "%M":
|
|
case "%F":
|
|
s.push(q);
|
|
return "([a-zéûä\u0430-\u044F\u0451]{1,})";
|
|
case "%j":
|
|
case "%n":
|
|
case "%g":
|
|
case "%G":
|
|
s.push(q);
|
|
return "(\\d{1,2})";
|
|
case "%Y":
|
|
s.push(q);
|
|
return "(\\d{4})";
|
|
case "%a":
|
|
s.push(q);
|
|
return "(\\[am|pm])";
|
|
case "%A":
|
|
s.push(q);
|
|
return "(\\[AM|PM])"
|
|
}
|
|
return q
|
|
});
|
|
var E = new RegExp(A);
|
|
var u = l.match(E);
|
|
if (u == null || u.length - 1 != s.length) {
|
|
return "Invalid Date"
|
|
}
|
|
for (var c = 1; c < u.length; c++) {
|
|
D.push(u[c])
|
|
}
|
|
var g = {
|
|
"%y": 1,
|
|
"%Y": 1,
|
|
"%n": 2,
|
|
"%m": 2,
|
|
"%M": 2,
|
|
"%F": 2,
|
|
"%d": 3,
|
|
"%j": 3,
|
|
"%a": 4,
|
|
"%A": 4,
|
|
"%H": 5,
|
|
"%G": 5,
|
|
"%h": 5,
|
|
"%g": 5,
|
|
"%i": 6,
|
|
"%s": 7
|
|
};
|
|
var x = {};
|
|
var n = {};
|
|
for (var c = 0; c < s.length; c++) {
|
|
if (typeof(g[s[c]]) != "undefined") {
|
|
var h = g[s[c]];
|
|
if (!x[h]) {
|
|
x[h] = [];
|
|
n[h] = []
|
|
}
|
|
x[h].push(D[c]);
|
|
n[h].push(s[c])
|
|
}
|
|
}
|
|
D = [];
|
|
s = [];
|
|
for (var c = 1; c <= 7; c++) {
|
|
if (x[c] != null) {
|
|
for (var y = 0; y < x[c].length; y++) {
|
|
D.push(x[c][y]);
|
|
s.push(n[c][y])
|
|
}
|
|
}
|
|
}
|
|
var o = this;
|
|
var a = new Date();
|
|
a.setDate(1);
|
|
a.setMinutes(0);
|
|
a.setSeconds(0);
|
|
for (var c = 0; c < D.length; c++) {
|
|
switch (s[c]) {
|
|
case "%d":
|
|
case "%j":
|
|
case "%n":
|
|
case "%m":
|
|
case "%Y":
|
|
case "%H":
|
|
case "%G":
|
|
case "%i":
|
|
case "%s":
|
|
if (!isNaN(D[c])) {
|
|
a[{
|
|
"%d": "setDate",
|
|
"%j": "setDate",
|
|
"%n": "setMonth",
|
|
"%m": "setMonth",
|
|
"%Y": "setFullYear",
|
|
"%H": "setHours",
|
|
"%G": "setHours",
|
|
"%i": "setMinutes",
|
|
"%s": "setSeconds"
|
|
}[s[c]]](Number(D[c]) + (s[c] == "%m" || s[c] == "%n" ? -1 : 0))
|
|
}
|
|
break;
|
|
case "%M":
|
|
case "%F":
|
|
var m = this._getInd(D[c].toLowerCase(), o.langData[o.lang][{
|
|
"%M": "monthesSNames",
|
|
"%F": "monthesFNames"
|
|
}[s[c]]]);
|
|
if (m >= 0) {
|
|
a.setMonth(m)
|
|
}
|
|
break;
|
|
case "%y":
|
|
if (!isNaN(D[c])) {
|
|
var C = Number(D[c]);
|
|
a.setFullYear(C + (C > 50 ? 1900 : 2000))
|
|
}
|
|
break;
|
|
case "%g":
|
|
case "%h":
|
|
if (!isNaN(D[c])) {
|
|
var C = Number(D[c]);
|
|
if (C <= 12 && C >= 0) {
|
|
a.setHours(C + (this._getInd("pm", D) >= 0 ? (C == 12 ? 0 : 12) : (C == 12 ? -12 : 0)))
|
|
}
|
|
}
|
|
break
|
|
}
|
|
}
|
|
o = null;
|
|
return a
|
|
};
|
|
dhtmlXCalendarObject.prototype._dateToStr = function(m, h) {
|
|
var g = this;
|
|
if (m instanceof Date) {
|
|
var l = function(n) {
|
|
return (String(n).length == 1 ? "0" + String(n) : n)
|
|
};
|
|
var a = function(n) {
|
|
switch (n) {
|
|
case "%d":
|
|
return l(m.getDate());
|
|
case "%j":
|
|
return m.getDate();
|
|
case "%D":
|
|
return g.langData[g.lang].daysSNames[m.getDay()];
|
|
case "%l":
|
|
return g.langData[g.lang].daysFNames[m.getDay()];
|
|
case "%m":
|
|
return l(m.getMonth() + 1);
|
|
case "%n":
|
|
return m.getMonth() + 1;
|
|
case "%M":
|
|
return g.langData[g.lang].monthesSNames[m.getMonth()];
|
|
case "%F":
|
|
return g.langData[g.lang].monthesFNames[m.getMonth()];
|
|
case "%y":
|
|
return l(m.getYear() % 100);
|
|
case "%Y":
|
|
return m.getFullYear();
|
|
case "%g":
|
|
return (m.getHours() + 11) % 12 + 1;
|
|
case "%h":
|
|
return l((m.getHours() + 11) % 12 + 1);
|
|
case "%G":
|
|
return m.getHours();
|
|
case "%H":
|
|
return l(m.getHours());
|
|
case "%i":
|
|
return l(m.getMinutes());
|
|
case "%s":
|
|
return l(m.getSeconds());
|
|
case "%a":
|
|
return (m.getHours() > 11 ? "pm" : "am");
|
|
case "%A":
|
|
return (m.getHours() > 11 ? "PM" : "AM");
|
|
case "%%":
|
|
"%";
|
|
default:
|
|
return n
|
|
}
|
|
};
|
|
var c = String(h || this._dateFormat).replace(/%[a-zA-Z]/g, a)
|
|
}
|
|
g = null;
|
|
return (c || String(m))
|
|
};
|
|
window.dhtmlxDblCalendarObject = window.dhtmlXDoubleCalendarObject = window.dhtmlXDoubleCalendar = function(c) {
|
|
var a = this;
|
|
this.leftCalendar = new dhtmlXCalendarObject(c);
|
|
this.leftCalendar.hideTime();
|
|
this.rightCalendar = new dhtmlXCalendarObject(c);
|
|
this.rightCalendar.hideTime();
|
|
this.leftCalendar.attachEvent("onClick", function(g) {
|
|
a._updateRange("rightCalendar", g, null);
|
|
a._evOnClick(["left", g])
|
|
});
|
|
this.rightCalendar.attachEvent("onClick", function(g) {
|
|
a._updateRange("leftCalendar", null, g);
|
|
a._evOnClick(["right", g])
|
|
});
|
|
this.leftCalendar.attachEvent("onBeforeChange", function(g) {
|
|
return a._evOnBeforeChange(["left", g])
|
|
});
|
|
this.rightCalendar.attachEvent("onBeforeChange", function(g) {
|
|
return a._evOnBeforeChange(["right", g])
|
|
});
|
|
this.show = function() {
|
|
this.leftCalendar.show();
|
|
this.rightCalendar.base.style.marginLeft = this.leftCalendar.base.offsetWidth - 1 + "px";
|
|
this.rightCalendar.show()
|
|
};
|
|
this.hide = function() {
|
|
this.leftCalendar.hide();
|
|
this.rightCalendar.hide()
|
|
};
|
|
this.setDateFormat = function(g) {
|
|
this.leftCalendar.setDateFormat(g);
|
|
this.rightCalendar.setDateFormat(g)
|
|
};
|
|
this.setDates = function(h, g) {
|
|
if (h != null) {
|
|
this.leftCalendar.setDate(h)
|
|
}
|
|
if (g != null) {
|
|
this.rightCalendar.setDate(g)
|
|
}
|
|
this._updateRange()
|
|
};
|
|
this._updateRange = function(g, l, h) {
|
|
if (arguments.length == 3) {
|
|
(g == "leftCalendar" ? this.leftCalendar : this.rightCalendar).setSensitiveRange(l, h)
|
|
} else {
|
|
this.leftCalendar.setSensitiveRange(null, this.rightCalendar.getDate());
|
|
this.rightCalendar.setSensitiveRange(this.leftCalendar.getDate(), null)
|
|
}
|
|
};
|
|
this.getFormatedDate = function() {
|
|
return this.leftCalendar.getFormatedDate.apply(this.leftCalendar, arguments)
|
|
};
|
|
this.unload = function() {
|
|
window.dhx4._eventable(this, "clear");
|
|
this.leftCalendar.unload();
|
|
this.rightCalendar.unload();
|
|
this.leftCalendar = this.rightCalendar = null;
|
|
this._updateRange = null;
|
|
this._evOnClick = null;
|
|
this._evOnBeforeChange = null;
|
|
this.show = null;
|
|
this.hide = null;
|
|
this.setDateFormat = null;
|
|
this.setDates = null;
|
|
this.getFormatedDate = null;
|
|
this.unload = null;
|
|
a = null
|
|
};
|
|
this._evOnClick = function(g) {
|
|
return this.callEvent("onClick", g)
|
|
};
|
|
this._evOnBeforeChange = function(g) {
|
|
return this.callEvent("onBeforeChange", g)
|
|
};
|
|
window.dhx4._eventable(this);
|
|
return this
|
|
};
|
|
|
|
function dhtmlXCombo(m, s, g, o, l) {
|
|
var n = this;
|
|
var h = null;
|
|
var u = null;
|
|
if (typeof(m) == "object" && !m.tagName) {
|
|
h = m;
|
|
m = h.parent;
|
|
g = h.width;
|
|
s = h.name;
|
|
o = h.mode;
|
|
u = h.skin
|
|
}
|
|
this.cont = (typeof(m) == "string" ? document.getElementById(m) : m);
|
|
this.conf = {
|
|
skin: null,
|
|
form_name: s || "dhxcombo",
|
|
combo_width: (parseInt(g) || this.cont.offsetWidth || 120) - (dhx4.isFF || dhx4.isIE ? 2 : 0),
|
|
combo_image: false,
|
|
combo_focus: false,
|
|
opts_type: (typeof(o) == "string" && typeof(this.modes[o]) != "undefined" ? o : "option"),
|
|
opts_count: 8,
|
|
opts_count_min: 3,
|
|
opts_width: null,
|
|
item_h: null,
|
|
list_zi_id: window.dhx4.newId(),
|
|
allow_free_text: true,
|
|
allow_empty_value: true,
|
|
enabled: true,
|
|
img_path: "",
|
|
img_def: "",
|
|
img_def_dis: true,
|
|
template: {
|
|
input: "#text#",
|
|
option: "#text#"
|
|
},
|
|
f_mode: false,
|
|
f_url: false,
|
|
f_cache: false,
|
|
f_cache_data: {},
|
|
f_dyn: false,
|
|
f_dyn_end: false,
|
|
f_mask: "",
|
|
f_ac: true,
|
|
f_ac_text: "",
|
|
f_server_tm: null,
|
|
f_server_last: "",
|
|
last_hover: null,
|
|
last_selected: null,
|
|
last_match: null,
|
|
last_text: "",
|
|
last_value: "",
|
|
tm_hover: null,
|
|
tm_confirm_blur: null,
|
|
clear_click: false,
|
|
clear_blur: false,
|
|
clear_bsp: false,
|
|
clear_key: false,
|
|
sp: {
|
|
dhx_skyblue: {
|
|
list_ofs: 1
|
|
},
|
|
dhx_web: {
|
|
list_ofs: 0
|
|
},
|
|
dhx_terrace: {
|
|
list_ofs: 1
|
|
}
|
|
}
|
|
};
|
|
this.conf.combo_image = (this.modes[this.conf.opts_type].image == true);
|
|
this.t = {};
|
|
this.base = document.createElement("DIV");
|
|
this.base.style.width = this.conf.combo_width + "px";
|
|
this.base.innerHTML = "<input type='text' class='dhxcombo_input' style='width:" + (this.conf.combo_width - 24 - (this.conf.combo_image ? 23 : 0)) + "px;" + (this.conf.combo_image ? "margin-left:23px;" : "") + "' autocomplete='off'><input type='hidden' value=''><input type='hidden' value='false'><div class='dhxcombo_select_button'><div class='dhxcombo_select_img'></div></div>" + (this.conf.combo_image ? "<div class='dhxcombo_top_image'>" + this.modes[this.conf.opts_type].getTopImage(null, this.conf.enabled) + "</div>" : "");
|
|
this.cont.appendChild(this.base);
|
|
this.list = document.createElement("DIV");
|
|
this.list.style.display = "none";
|
|
document.body.insertBefore(this.list, document.body.firstChild);
|
|
this.setSkin(u || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxcombo") || "dhx_skyblue");
|
|
this._updateTopImage = function(a) {
|
|
if (!this.conf.combo_image) {
|
|
return
|
|
}
|
|
if (a != null) {
|
|
this.base.lastChild.innerHTML = this.t[a].obj.getTopImage(this.t[a].item, this.conf.enabled)
|
|
} else {
|
|
this.base.lastChild.innerHTML = this.modes[this.conf.opts_type].getTopImage(null, this.conf.enabled)
|
|
}
|
|
};
|
|
this._filterOpts = function(D) {
|
|
if (this.conf.f_server_tm) {
|
|
window.clearTimeout(this.conf.f_server_tm)
|
|
}
|
|
var w = String(this.base.firstChild.value).replace(new RegExp(this.conf.f_ac_text + "$", "i"), "");
|
|
if (this.conf.f_server_last == w.toLowerCase()) {
|
|
this._checkForMatch();
|
|
return
|
|
}
|
|
if (this.conf.f_url != null && this.checkEvent("onDynXLS")) {
|
|
this.conf.f_server_last = w.toLowerCase();
|
|
this.callEvent("onDynXLS", [w]);
|
|
return
|
|
}
|
|
if (this.conf.f_url != null) {
|
|
if (w.length == 0) {
|
|
this.conf.f_server_last = w.toLowerCase();
|
|
this.clearAll();
|
|
return
|
|
}
|
|
if (this.conf.f_cache == true && this.conf.f_cache_data[w] != null) {
|
|
this.clearAll();
|
|
this.conf.f_server_last = w.toLowerCase();
|
|
for (var y = 0; y < this.conf.f_cache_data[w].data.length; y++) {
|
|
this.load(this.conf.f_cache_data[w].data[y])
|
|
}
|
|
if (this.conf.f_dyn) {
|
|
this.conf.f_dyn_end = this.conf.f_cache_data[w].dyn_end;
|
|
this.conf.f_mask = this.conf.f_cache_data[w].mask
|
|
}
|
|
if (D !== true) {
|
|
this._showList(true);
|
|
this._checkForMatch()
|
|
}
|
|
} else {
|
|
this.conf.f_server_tm = window.setTimeout(function() {
|
|
n.conf.f_server_last = w.toLowerCase();
|
|
n.conf.f_mask = w;
|
|
var q = "mask=" + encodeURIComponent(w);
|
|
if (n.conf.f_dyn) {
|
|
q += "&pos=0";
|
|
n.conf.f_dyn_end = false
|
|
}
|
|
var a = function(F) {
|
|
if (n.conf.f_cache) {
|
|
if (!n.conf.f_cache_data[w]) {
|
|
n.conf.f_cache_data[w] = {
|
|
data: [],
|
|
dyn_end: false,
|
|
mask: w
|
|
}
|
|
}
|
|
n.conf.f_cache_data[w].data.push(F.xmlDoc.responseXML)
|
|
}
|
|
n.clearAll();
|
|
n.load(F.xmlDoc.responseXML);
|
|
if (n.conf.f_ac && n.conf.f_mode == "start" && n.conf.clear_bsp == false && n.list.firstChild != null) {
|
|
var E = n.list.firstChild._optId;
|
|
var H = String(n.t[E].obj.getText(n.list.firstChild, true));
|
|
if (String(H).toLowerCase().indexOf(String(w).toLowerCase()) === 0) {
|
|
n.base.firstChild.value = H;
|
|
n._selectRange(w.length, H.length)
|
|
}
|
|
}
|
|
if (D !== true) {
|
|
n._showList(true);
|
|
n._checkForMatch()
|
|
}
|
|
a = null
|
|
};
|
|
if (window.dhx4.ajax.method == "post") {
|
|
window.dhx4.ajax.post(n.conf.f_url, q, a)
|
|
} else {
|
|
if (window.dhx4.ajax.method == "get") {
|
|
window.dhx4.ajax.get(n.conf.f_url + (String(n.conf.f_url).indexOf("?") >= 0 ? "&" : "?") + q, a)
|
|
}
|
|
}
|
|
}, 200)
|
|
}
|
|
} else {
|
|
this.conf.f_server_last = w.toLowerCase();
|
|
var x = (w.length == 0 ? true : new RegExp((this.conf.f_mode == "start" ? "^" : "") + w, "i"));
|
|
var C = null;
|
|
for (var v in this.t) {
|
|
var A = this.t[v].obj.getText(this.t[v].item, true);
|
|
if (x === true || x.test(A) == true) {
|
|
this.t[v].item.style.display = "";
|
|
if (C == null && w.length > 0) {
|
|
C = String(this.t[v].obj.getText(this.t[v].item, true))
|
|
}
|
|
} else {
|
|
this.t[v].item.style.display = "none"
|
|
}
|
|
}
|
|
if (this.conf.f_ac && this.conf.f_mode == "start" && this.conf.clear_bsp == false && C != null) {
|
|
this.conf.f_ac_text = C.replace(new RegExp("^" + w, "i"), "");
|
|
this.base.firstChild.value = C;
|
|
this._selectRange(this.conf.f_server_last.length, this.base.firstChild.value.length)
|
|
}
|
|
if (this.conf.f_mode == "between" && this.conf.clear_bsp == true) {
|
|
this._checkForMatch(true)
|
|
}
|
|
if (D !== true) {
|
|
this._showList(true);
|
|
this._checkForMatch()
|
|
}
|
|
}
|
|
};
|
|
this._initObj = function(a) {
|
|
if (typeof(a.template) != "undefined") {
|
|
this.setTemplate(a.template)
|
|
}
|
|
this.addOption(a.options)
|
|
};
|
|
this._xmlToObj = function(E, H) {
|
|
var L = {
|
|
options: []
|
|
};
|
|
var I = (H == true ? E : E.getElementsByTagName("complete"));
|
|
if (I.length > 0) {
|
|
var x = I[0].childNodes;
|
|
for (var v = 0; v < x.length; v++) {
|
|
if (typeof(x[v].tagName) != "undefined") {
|
|
if (String(x[v].tagName).toLowerCase() == "template") {
|
|
for (var K = 0; K < x[v].childNodes.length; K++) {
|
|
if (x[v].childNodes[K].tagName != null) {
|
|
var D = x[v].childNodes[K].tagName;
|
|
if (typeof(this.conf.template[D]) != "undefined") {
|
|
this.conf.template[D] = (x[v].childNodes[K].firstChild != null ? x[v].childNodes[K].firstChild.nodeValue : "")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (String(x[v].tagName).toLowerCase() == "option") {
|
|
var C = false;
|
|
if (H == true) {
|
|
C = (window.dhx4.s2b(x[v].selected) || x[v].getAttribute("selected") != null)
|
|
} else {
|
|
C = window.dhx4.s2b(x[v].getAttribute("selected"))
|
|
}
|
|
var y = {
|
|
value: x[v].getAttribute("value"),
|
|
text: (x[v].firstChild != null ? x[v].firstChild.nodeValue : ""),
|
|
selected: C,
|
|
checked: window.dhx4.s2b(x[v].getAttribute("checked"))
|
|
};
|
|
for (var J in {
|
|
img: 1,
|
|
img_dis: 1,
|
|
img_src: 1,
|
|
img_src_dis: 1
|
|
}) {
|
|
if (x[v].getAttribute(J) != null) {
|
|
y[J] = x[v].getAttribute(J)
|
|
}
|
|
}
|
|
for (var K = 0; K < x[v].childNodes.length; K++) {
|
|
if (x[v].childNodes[K].tagName != null && String(x[v].childNodes[K].tagName).toLowerCase() == "text") {
|
|
y.text = {};
|
|
var A = x[v].childNodes[K];
|
|
for (var F = 0; F < A.childNodes.length; F++) {
|
|
if (A.childNodes[F].tagName != null) {
|
|
y.text[A.childNodes[F].tagName] = (A.childNodes[F].firstChild != null ? A.childNodes[F].firstChild.nodeValue : "")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
L.options.push(y)
|
|
}
|
|
}
|
|
}
|
|
I = x = null
|
|
}
|
|
return L
|
|
};
|
|
window.dhx4._enableDataLoading(this, "_initObj", "_xmlToObj", "complete", {
|
|
data: true
|
|
});
|
|
window.dhx4._eventable(this);
|
|
this._getNearItem = function(v, q) {
|
|
var a = null;
|
|
while (v != null) {
|
|
v = v[q < 0 ? "previousSibling" : "nextSibling"];
|
|
if (a == null && v != null && v.style.display == "" && v._optId != null) {
|
|
a = v;
|
|
v = null
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
this.setName(this.conf.form_name);
|
|
this._doOnListMouseMove = function(q) {
|
|
q = q || event;
|
|
var a = q.target || q.srcElement;
|
|
while (a != null && a != this) {
|
|
if (typeof(a._optId) != "undefined") {
|
|
if (n.conf.tm_hover) {
|
|
window.clearTimeout(n.conf.tm_hover)
|
|
}
|
|
n._setSelected(a._optId)
|
|
}
|
|
a = a.parentNode
|
|
}
|
|
a = null
|
|
};
|
|
this._doOnListMouseDown = function(a) {
|
|
a = a || event;
|
|
a.cancelBubble = true;
|
|
n.conf.clear_click = true;
|
|
window.setTimeout(function() {
|
|
n.base.firstChild.focus()
|
|
}, 1)
|
|
};
|
|
this._doOnListMouseUp = function(v) {
|
|
v = v || event;
|
|
var a = v.target || v.srcElement;
|
|
while (a != null && a != this) {
|
|
if (typeof(a._optId) != "undefined") {
|
|
var q = true;
|
|
if (typeof(n.t[a._optId].obj.optionClick) == "function" && n.t[a._optId].obj.optionClick(a, v, n) !== true) {
|
|
q = false
|
|
}
|
|
if (q) {
|
|
n._setSelected(a._optId, null, true);
|
|
n._confirmSelect("click")
|
|
}
|
|
}
|
|
a = a.parentNode
|
|
}
|
|
a = null
|
|
};
|
|
this._doOnListMouseOut = function(a) {
|
|
if (n.conf.tm_hover) {
|
|
window.clearTimeout(n.conf.tm_hover)
|
|
}
|
|
n.conf.tm_hover = window.setTimeout(function() {
|
|
var q = n.conf.last_match || n.conf.last_selected;
|
|
if (n.conf.last_match == null && n.t[q] != null) {
|
|
if (n.base.firstChild.value != n.t[q].obj.getText(n.t[q].item, true)) {
|
|
q = null
|
|
}
|
|
}
|
|
n._setSelected(q, null, true)
|
|
}, 1)
|
|
};
|
|
this._doOnBaseMouseDown = function(x) {
|
|
if (!n.conf.enabled) {
|
|
return
|
|
}
|
|
n.conf.clear_click = true;
|
|
x = x || event;
|
|
var q = x.target || x.srcElement;
|
|
if (q != this.firstChild) {
|
|
window.setTimeout(function() {
|
|
n.base.firstChild.focus()
|
|
}, 1);
|
|
var w = q;
|
|
while (w != this && w != null) {
|
|
if (w == this.lastChild) {
|
|
if (typeof(n.modes[n.conf.opts_type].topImageClick) == "function") {
|
|
var v = (n.conf.last_hover || n.conf.last_selected);
|
|
var a = (v != null ? n.t[v].item : null);
|
|
if (n.modes[n.conf.opts_type].topImageClick(a, n) !== true) {
|
|
v = a = null;
|
|
return
|
|
}
|
|
}
|
|
w = null
|
|
} else {
|
|
w = w.parentNode
|
|
}
|
|
}
|
|
}
|
|
if (n._isListVisible()) {
|
|
n._hideList()
|
|
} else {
|
|
if (q != this.firstChild) {
|
|
n.conf.clear_blur = true
|
|
}
|
|
n._showList();
|
|
n._setSelected(n.conf.last_selected, true, true)
|
|
}
|
|
q = null
|
|
};
|
|
this._doOnBodyMouseDown = function() {
|
|
if (n.conf.clear_click) {
|
|
n.conf.clear_click = false;
|
|
return
|
|
}
|
|
n._confirmSelect("blur")
|
|
};
|
|
this._doOnInputFocus = function() {
|
|
n.conf.clear_blur = false;
|
|
if (n.conf.tm_confirm_blur) {
|
|
window.clearTimeout(n.conf.tm_confirm_blur)
|
|
}
|
|
if (n.conf.combo_focus == false) {
|
|
n.conf.combo_focus = true;
|
|
n.callEvent("onFocus", [])
|
|
}
|
|
};
|
|
this._doOnInputBlur = function() {
|
|
if (n.conf.clear_blur == true) {
|
|
n.conf.clear_blur = false;
|
|
return
|
|
}
|
|
if (n.conf.tm_confirm_blur) {
|
|
window.clearTimeout(n.conf.tm_confirm_blur)
|
|
}
|
|
n.conf.tm_confirm_blur = window.setTimeout(function() {
|
|
if (n.conf.clear_click == false) {
|
|
n._confirmSelect("blur");
|
|
n.conf.combo_focus = false;
|
|
n.callEvent("onBlur", [])
|
|
}
|
|
}, 20)
|
|
};
|
|
this._doOnInputKeyUp = function(a) {
|
|
a = a || event;
|
|
if (n.conf.f_mode != false) {
|
|
n.conf.clear_bsp = (a.keyCode == 8 || a.keyCode == 46);
|
|
n._filterOpts();
|
|
return
|
|
} else {
|
|
n._checkForMatch()
|
|
}
|
|
};
|
|
this._doOnInputKeyDown = function(a) {
|
|
a = a || event;
|
|
if ((a.keyCode == 38 || a.keyCode == 40) && !a.ctrlKey && !a.shiftKey && !a.altKey) {
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
} else {
|
|
a.returnValue = false
|
|
}
|
|
a.cancelBubble = true;
|
|
n._keyOnUpDown(a.keyCode == 38 ? -1 : 1)
|
|
}
|
|
if (a.keyCode == 113) {
|
|
if (!n._isListVisible()) {
|
|
n._showList();
|
|
if (n.base.firstChild.value == n.conf.last_text) {
|
|
n._setSelected(n.conf.last_selected, true, true);
|
|
n.base.firstChild.value = n.conf.last_text;
|
|
n.conf.f_server_last = n.base.firstChild.value.toLowerCase()
|
|
} else {
|
|
n.conf.f_server_last = n.base.firstChild.value.toLowerCase();
|
|
if (n.conf.f_mode == false) {
|
|
n._checkForMatch()
|
|
}
|
|
}
|
|
} else {}
|
|
}
|
|
if (a.keyCode == 27) {
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
} else {
|
|
a.returnValue = false
|
|
}
|
|
a.cancelBubble = true;
|
|
n._cancelSelect()
|
|
}
|
|
if (a.keyCode == 13) {
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
}
|
|
n._confirmSelect("kbd")
|
|
}
|
|
n.conf.clear_key = true;
|
|
n.callEvent("onKeyPressed", [a.keyCode || a.charCode])
|
|
};
|
|
this._doOnInputKeyPress = function(a) {
|
|
if (n.conf.clear_key) {
|
|
n.conf.clear_key = false;
|
|
return
|
|
}
|
|
a = a || event;
|
|
n.callEvent("onKeyPressed", [a.keyCode || a.charCode])
|
|
};
|
|
this._keyOnUpDown = function(a) {
|
|
var q = null;
|
|
if (this.conf.last_hover) {
|
|
q = this.t[this.conf.last_hover].item
|
|
} else {
|
|
if (this.conf.last_selected) {
|
|
q = this.t[this.conf.last_selected].item
|
|
}
|
|
} if (!q && this._getListVisibleCount() == 0) {
|
|
return
|
|
}
|
|
if (q != null && q.style.display != "") {
|
|
q = null
|
|
}
|
|
this._showList();
|
|
if (q != null) {
|
|
if (this.t[q._optId].obj.isSelected(q)) {
|
|
q = this._getNearItem(q, a)
|
|
}
|
|
} else {
|
|
q = this.list.firstChild;
|
|
if (q.style.display != "") {
|
|
q = this._getNearItem(q, 1)
|
|
}
|
|
} if (q == null) {
|
|
return
|
|
}
|
|
this._setSelected(q._optId, true, true);
|
|
if (this.conf.f_mode == false) {
|
|
this.base.firstChild.value = this.t[q._optId].obj.getText(q, true)
|
|
} else {
|
|
var v = String(this.t[q._optId].obj.getText(q, true));
|
|
if (this.conf.f_mode == "start" && this.conf.f_ac == true) {
|
|
if (v.toLowerCase().indexOf(this.conf.f_server_last) === 0) {
|
|
this.conf.f_ac_text = v.substring(this.conf.f_server_last.length, v.length);
|
|
this.base.firstChild.value = v;
|
|
this._selectRange(this.conf.f_server_last.length, this.base.firstChild.value.length)
|
|
} else {
|
|
this.base.firstChild.value = v;
|
|
this.conf.f_server_last = this.base.firstChild.value.toLowerCase();
|
|
this._selectRange(0, this.base.firstChild.value.length)
|
|
}
|
|
} else {
|
|
this.base.firstChild.value = v;
|
|
this.conf.f_server_last = this.base.firstChild.value.toLowerCase()
|
|
}
|
|
}
|
|
q = null
|
|
};
|
|
this.conf.evs_nodes = [{
|
|
node: document.body,
|
|
evs: {
|
|
mousedown: "_doOnBodyMouseDown"
|
|
}
|
|
}, {
|
|
node: this.base,
|
|
evs: {
|
|
mousedown: "_doOnBaseMouseDown"
|
|
}
|
|
}, {
|
|
node: this.base.firstChild,
|
|
evs: {
|
|
keyup: "_doOnInputKeyUp",
|
|
keydown: "_doOnInputKeyDown",
|
|
keypress: "_doOnInputKeyPress",
|
|
focus: "_doOnInputFocus",
|
|
blur: "_doOnInputBlur"
|
|
}
|
|
}, {
|
|
node: this.list,
|
|
evs: {
|
|
mousemove: "_doOnListMouseMove",
|
|
mousedown: "_doOnListMouseDown",
|
|
mouseup: "_doOnListMouseUp",
|
|
mouseout: "_doOnListMouseOut"
|
|
}
|
|
}];
|
|
for (var c = 0; c < this.conf.evs_nodes.length; c++) {
|
|
for (var r in this.conf.evs_nodes[c].evs) {
|
|
if (window.addEventListener) {
|
|
this.conf.evs_nodes[c].node.addEventListener(r, this[this.conf.evs_nodes[c].evs[r]], false)
|
|
} else {
|
|
this.conf.evs_nodes[c].node.attachEvent("on" + r, this[this.conf.evs_nodes[c].evs[r]])
|
|
}
|
|
}
|
|
}
|
|
this.unload = function() {
|
|
this.clearAll();
|
|
this.t = null;
|
|
for (var w = 0; w < this.conf.evs_nodes.length; w++) {
|
|
for (var v in this.conf.evs_nodes[w].evs) {
|
|
if (window.addEventListener) {
|
|
this.conf.evs_nodes[w].node.removeEventListener(v, this[this.conf.evs_nodes[w].evs[v]], false)
|
|
} else {
|
|
this.conf.evs_nodes[w].node.detachEvent("on" + v, this[this.conf.evs_nodes[w].evs[v]])
|
|
}
|
|
this.conf.evs_nodes[w].evs[v] = null;
|
|
delete this.conf.evs_nodes[w].evs[v]
|
|
}
|
|
this.conf.evs_nodes[w].node = null;
|
|
this.conf.evs_nodes[w].evs = null;
|
|
delete this.conf.evs_nodes[w].node;
|
|
delete this.conf.evs_nodes[w].evs;
|
|
this.conf.evs_nodes[w] = null
|
|
}
|
|
window.dhx4._eventable(this, "clear");
|
|
window.dhx4._enableDataLoading(this, null, null, null, "clear");
|
|
this.DOMelem_input = this.DOMelem_button = this.DOMlist = null;
|
|
for (var v in this.conf) {
|
|
this.conf[v] = null;
|
|
delete this.conf[v]
|
|
}
|
|
this.conf = null;
|
|
this.base.parentNode.removeChild(this.base);
|
|
this.list.parentNode.removeChild(this.list);
|
|
this.base = this.list = this.cont = null;
|
|
this.modes = null;
|
|
for (var v in this) {
|
|
if (typeof(this[v]) == "function") {
|
|
this[v] = null
|
|
}
|
|
}
|
|
n = null
|
|
};
|
|
this.DOMelem_input = this.base.firstChild;
|
|
this.DOMelem_button = this.base.childNodes[this.base.childNodes.length - (this.conf.combo_image ? 2 : 1)];
|
|
this.DOMlist = this.list;
|
|
this.DOMelem = this.base;
|
|
this.DOMParent = m;
|
|
m = null;
|
|
if (h != null) {
|
|
if (h.filter != null) {
|
|
if (typeof(h.filter) == "string") {
|
|
this.enableFilteringMode(true, h.filter, window.dhx4.s2b(h.filter_cache), window.dhx4.s2b(h.filter_sub_load))
|
|
} else {
|
|
this.enableFilteringMode(true)
|
|
}
|
|
}
|
|
if (h.image_path != null) {
|
|
this.setImagePath(h.image_path)
|
|
}
|
|
if (h.default_image != null || h.default_image_dis != null) {
|
|
this.setDefaultImage(h.default_image, h.default_image_dis)
|
|
}
|
|
if (h.items || h.options) {
|
|
this.addOption(h.items || h.options)
|
|
}
|
|
if (h.xml || h.json) {
|
|
this.load(h.xml || h.json)
|
|
}
|
|
if (typeof(h.readonly) != "undefined") {
|
|
this.readonly(h.readonly)
|
|
}
|
|
h = null
|
|
}
|
|
return this
|
|
}
|
|
|
|
function dhtmlXComboFromSelect(g) {
|
|
if (typeof(g) == "string") {
|
|
g = document.getElementById(g)
|
|
}
|
|
var c = g.offsetWidth;
|
|
var r = g.getAttribute("name") || null;
|
|
var h = document.createElement("SPAN");
|
|
g.parentNode.insertBefore(h, g);
|
|
var m = g.getAttribute("mode") || g.getAttribute("opt_type") || "option";
|
|
var l = new dhtmlXCombo(h, r, c, m);
|
|
h = null;
|
|
var o = g.getAttribute("imagePath");
|
|
if (o) {
|
|
l.setImagePath(o)
|
|
}
|
|
var q = g.getAttribute("defaultImage");
|
|
var n = g.getAttribute("defaultImageDis");
|
|
if (window.dhx4.s2b(n) == true) {
|
|
n = true
|
|
}
|
|
if (q != null || n != null) {
|
|
l.setDefaultImage(q, n)
|
|
}
|
|
var a = l._xmlToObj([g], true);
|
|
if (a.options.length > 0) {
|
|
l.addOption(a.options)
|
|
}
|
|
a = null;
|
|
g.parentNode.removeChild(g);
|
|
g = null;
|
|
return l
|
|
}
|
|
dhtmlXCombo.prototype.setName = function(a) {
|
|
this.conf.form_name = a;
|
|
this.base.childNodes[1].name = a;
|
|
this.base.childNodes[2].name = a + "_new_value"
|
|
};
|
|
dhtmlXCombo.prototype.readonly = function(a) {
|
|
if (window.dhx4.s2b(a)) {
|
|
this.base.firstChild.setAttribute("readOnly", "true")
|
|
} else {
|
|
this.base.firstChild.removeAttribute("readOnly")
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.setPlaceholder = function(a) {
|
|
if (typeof(a) == "undefined" || a == null) {
|
|
a = ""
|
|
}
|
|
this.base.firstChild.setAttribute("placeholder", String(a))
|
|
};
|
|
dhtmlXCombo.prototype.setTemplate = function(g) {
|
|
for (var c in g) {
|
|
if (typeof(this.conf.template[c]) != "undefined") {
|
|
this.conf.template[c] = String(g[c])
|
|
}
|
|
}
|
|
for (var c in this.t) {
|
|
this.t[c].obj.setText(this.t[c].item, this.t[c].item._conf.text)
|
|
}
|
|
this._confirmSelect()
|
|
};
|
|
dhtmlXCombo.prototype.setSkin = function(a) {
|
|
if (a == this.conf.skin) {
|
|
return
|
|
}
|
|
this.conf.skin = a;
|
|
this.base.className = "dhxcombo_" + this.conf.skin + (this.conf.enabled ? "" : " dhxcombo_disabled");
|
|
this.list.className = "dhxcombolist_" + this.conf.skin
|
|
};
|
|
dhtmlXCombo.prototype.getInput = function() {
|
|
return this.base.firstChild
|
|
};
|
|
dhtmlXCombo.prototype.getButton = function() {
|
|
return this.base.childNodes[this.base.childNodes.length - (this.conf.combo_image ? 2 : 1)]
|
|
};
|
|
dhtmlXCombo.prototype.getList = function() {
|
|
return this.list
|
|
};
|
|
dhtmlXCombo.prototype.getBase = function() {
|
|
return this.base
|
|
};
|
|
dhtmlXCombo.prototype.getParent = function() {
|
|
return this.DOMParent
|
|
};
|
|
dhtmlXCombo.prototype.forEachOption = function(a) {
|
|
for (var c = 0; c < this.list.childNodes.length; c++) {
|
|
a.apply(window, [this._getOption(this.list.childNodes[c]._optId, c)])
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.setFocus = function() {
|
|
if (this.conf.enabled) {
|
|
this.base.firstChild.focus()
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.setFontSize = function(a, c) {
|
|
if (a != null) {
|
|
this.base.firstChild.style.fontSize = a
|
|
}
|
|
if (c != null) {
|
|
this.list.style.fontSize = c
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.getOption = function(l) {
|
|
var m = null;
|
|
var g = null;
|
|
for (var h = 0; h < this.list.childNodes.length; h++) {
|
|
if (m == null) {
|
|
var c = this.list.childNodes[h]._optId;
|
|
if (this.t[c].obj.getValue(this.t[c].item) == l) {
|
|
m = c;
|
|
g = h
|
|
}
|
|
}
|
|
}
|
|
return (m == null ? null : this._getOption(m, g))
|
|
};
|
|
dhtmlXCombo.prototype.getOptionByIndex = function(a) {
|
|
if (a < 0) {
|
|
return null
|
|
}
|
|
if (this.list.childNodes[a] == null) {
|
|
return null
|
|
}
|
|
return this._getOption(this.list.childNodes[a]._optId, a)
|
|
};
|
|
dhtmlXCombo.prototype.getOptionByLabel = function(l) {
|
|
var m = null;
|
|
var g = null;
|
|
for (var h = 0; h < this.list.childNodes.length; h++) {
|
|
if (m == null) {
|
|
var c = this.list.childNodes[h]._optId;
|
|
if (this.t[c].obj.getText(this.t[c].item, true) == l) {
|
|
m = c;
|
|
g = h
|
|
}
|
|
}
|
|
}
|
|
return (m == null ? null : this._getOption(m, g))
|
|
};
|
|
dhtmlXCombo.prototype.getSelectedIndex = function() {
|
|
return this._getOptionProp(this.conf.last_selected, "index", -1)
|
|
};
|
|
dhtmlXCombo.prototype.getSelectedText = function() {
|
|
return this._getOptionProp(this.conf.last_selected, "text", "")
|
|
};
|
|
dhtmlXCombo.prototype.getSelectedValue = function() {
|
|
return this._getOptionProp(this.conf.last_selected, "value", null)
|
|
};
|
|
dhtmlXCombo.prototype.getActualValue = function() {
|
|
return this.base.childNodes[1].value
|
|
};
|
|
dhtmlXCombo.prototype.getComboText = function() {
|
|
return this.base.childNodes[0].value
|
|
};
|
|
dhtmlXCombo.prototype.getIndexByValue = function(c) {
|
|
var a = this.getOption(c);
|
|
return (a != null ? a.index : -1)
|
|
};
|
|
dhtmlXCombo.prototype.setComboText = function(a) {
|
|
this.conf.last_text = this.base.firstChild.value = a;
|
|
this.conf.f_server_last = this.base.firstChild.value.toLowerCase()
|
|
};
|
|
dhtmlXCombo.prototype.setComboValue = function(c) {
|
|
var a = this.getOption(c);
|
|
if (a != null) {
|
|
this.selectOption(a.index)
|
|
} else {
|
|
this.conf.last_value = c;
|
|
this.base.childNodes[1].value = this.conf.last_value;
|
|
this.base.childNodes[2].value = "true"
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.selectOption = function(c, g, a) {
|
|
if (c < 0 || c >= this.list.childNodes.length) {
|
|
return
|
|
}
|
|
var h = this.list.childNodes[c]._optId;
|
|
this._setSelected(h, this._isListVisible(), true);
|
|
this._confirmSelect("script")
|
|
};
|
|
dhtmlXCombo.prototype.unSelectOption = function() {};
|
|
dhtmlXCombo.prototype.confirmValue = function() {
|
|
this._confirmSelect("script")
|
|
};
|
|
dhtmlXCombo.prototype.enable = function(a) {
|
|
a = (typeof(a) == "undefined" ? true : window.dhx4.s2b(a));
|
|
if (this.conf.enabled == a) {
|
|
return
|
|
}
|
|
this.conf.enabled = a;
|
|
if (a) {
|
|
this.base.className = "dhxcombo_" + this.conf.skin;
|
|
this.base.firstChild.removeAttribute("disabled")
|
|
} else {
|
|
this._hideList();
|
|
this.base.className = "dhxcombo_" + this.conf.skin + " dhxcombo_disabled";
|
|
this.base.firstChild.setAttribute("disabled", "true")
|
|
}
|
|
this._updateTopImage(this.conf.last_selected)
|
|
};
|
|
dhtmlXCombo.prototype.disable = function(a) {
|
|
a = (typeof(a) == "undefined" ? true : window.dhx4.s2b(a));
|
|
this.enable(!a)
|
|
};
|
|
dhtmlXCombo.prototype.isEnabled = function() {
|
|
return (this.conf.enabled == true)
|
|
};
|
|
dhtmlXCombo.prototype.show = function(a) {
|
|
if (typeof(a) == "undefined") {
|
|
a = true
|
|
} else {
|
|
a = window.dhx4.s2b(a)
|
|
}
|
|
this.base.style.display = (a == true ? "" : "none")
|
|
};
|
|
dhtmlXCombo.prototype.hide = function(a) {
|
|
if (typeof(a) == "undefined") {
|
|
a = true
|
|
}
|
|
this.show(!a)
|
|
};
|
|
dhtmlXCombo.prototype.isVisible = function() {
|
|
return (this.base.style.display == "")
|
|
};
|
|
dhtmlXCombo.prototype.enableFilteringMode = function(h, c, a, g) {
|
|
if (h == true || h == "between") {
|
|
this.conf.f_mode = (h == true ? "start" : "between");
|
|
if (c != null) {
|
|
this.conf.f_url = c;
|
|
this.conf.f_cache = window.dhx4.s2b(a);
|
|
this.conf.f_dyn = window.dhx4.s2b(g)
|
|
} else {
|
|
this.conf.f_url = null;
|
|
this.conf.f_cache = false;
|
|
this.conf.f_dyn = false
|
|
}
|
|
} else {
|
|
this.conf.f_mode = false;
|
|
this.conf.f_url = null;
|
|
this.conf.f_cache = false;
|
|
this.conf.f_dyn = false
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.filter = function(c) {
|
|
for (var g = 0; g < this.list.childNodes.length; g++) {
|
|
var a = c.apply(window, [this._getOption(this.list.childNodes[g]._optId, g)]);
|
|
this.list.childNodes[g].style.display = (a === true ? "" : "none")
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.sort = function(g) {
|
|
var a = [];
|
|
for (var c = 0; c < this.list.childNodes.length; c++) {
|
|
var h = this.list.childNodes[c]._optId;
|
|
a.push([h, this._getOption(h, c)])
|
|
}
|
|
if (g == "asc" || g == "desc") {
|
|
k = true;
|
|
a.sort(function(m, l) {
|
|
m = m[1].text_option.toLowerCase();
|
|
l = l[1].text_option.toLowerCase();
|
|
var n = (g == "asc" ? 1 : -1);
|
|
return (m > l ? n : -1 * n)
|
|
})
|
|
} else {
|
|
if (typeof(g) == "function" || typeof(window[g]) == "function") {
|
|
if (typeof(window[g]) == "function") {
|
|
g = window[g]
|
|
}
|
|
a.sort(function(m, l) {
|
|
return g.apply(window, [m[1], l[1]])
|
|
})
|
|
}
|
|
}
|
|
while (this.list.childNodes.length > 0) {
|
|
this.list.removeChild(this.list.lastChild)
|
|
}
|
|
for (var c = 0; c < a.length; c++) {
|
|
this.list.appendChild(this.t[a[c][0]].item)
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.enableAutocomplete = function(a) {
|
|
if (typeof(a) == "undefined") {
|
|
a = true
|
|
} else {
|
|
a = window.dhx4.s2b(a)
|
|
}
|
|
this.conf.f_ac = a
|
|
};
|
|
dhtmlXCombo.prototype.disableAutocomplete = function(a) {
|
|
if (typeof(a) == "undefined") {
|
|
a = true
|
|
} else {
|
|
a = window.dhx4.s2b(a)
|
|
}
|
|
this.enableAutocomplete(!a)
|
|
};
|
|
dhtmlXCombo.prototype.allowFreeText = function(a) {
|
|
this.conf.allow_free_text = (typeof(a) == "undefined" ? true : window.dhx4.s2b(a))
|
|
};
|
|
dhtmlXCombo.prototype._checkForMatch = function(h) {
|
|
var a = window.dhx4.trim(this.base.firstChild.value).toLowerCase();
|
|
var l = null;
|
|
var c = this.list.firstChild;
|
|
while (c != null) {
|
|
if (c.style.display == "" && c._optId != null) {
|
|
var g = window.dhx4.trim(this.t[c._optId].obj.getText(c, true)).toLowerCase();
|
|
if (a == g) {
|
|
l = c._optId;
|
|
c = null
|
|
}
|
|
}
|
|
if (c != null) {
|
|
c = c.nextSibling
|
|
}
|
|
}
|
|
if (this.conf.last_match == null) {
|
|
if (l != null) {
|
|
this._setSelected(l, true, true);
|
|
this.conf.last_match = l
|
|
} else {
|
|
if (this.conf.f_mode != "between" || h == true) {
|
|
this._setSelected(null, true, true);
|
|
this.conf.last_match = null
|
|
}
|
|
}
|
|
} else {
|
|
if (l != null) {
|
|
if (l != this.conf.last_match) {
|
|
this._setSelected(l, true, true);
|
|
this.conf.last_match = l
|
|
}
|
|
} else {
|
|
this._setSelected(null, true, true);
|
|
this.conf.last_match = null
|
|
}
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype._selectRange = function(c, a) {
|
|
if (this.conf.combo_focus == true) {
|
|
window.dhx4.selectTextRange(this.base.firstChild, c, a)
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.openSelect = function() {
|
|
if (!this._isListVisible()) {
|
|
this._showList()
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.closeAll = function() {
|
|
this._hideList()
|
|
};
|
|
dhtmlXCombo.prototype._showList = function(a) {
|
|
if (this._getListVisibleCount() == 0) {
|
|
if (a && this._isListVisible()) {
|
|
this._hideList()
|
|
}
|
|
return
|
|
}
|
|
if (this._isListVisible()) {
|
|
this._checkListHeight();
|
|
return
|
|
}
|
|
this.list.style.zIndex = window.dhx4.zim.reserve(this.conf.list_zi_id);
|
|
this.list.style.visibility = "hidden";
|
|
this.list.style.display = "";
|
|
this.list.style.width = Math.max(this.conf.opts_width || 0, this.conf.combo_width) + "px";
|
|
this.list.style.top = window.dhx4.absTop(this.base) + this.base.offsetHeight - 1 + "px";
|
|
this.list.style.left = window.dhx4.absLeft(this.base) + "px";
|
|
this._checkListHeight();
|
|
this.list.style.visibility = "visible";
|
|
this.callEvent("onOpen", [])
|
|
};
|
|
dhtmlXCombo.prototype._hideList = function() {
|
|
if (!this._isListVisible()) {
|
|
return
|
|
}
|
|
window.dhx4.zim.clear(this.conf.list_zi_id);
|
|
this.list.style.display = "none";
|
|
this.conf.clear_click = false;
|
|
this.callEvent("onClose", [])
|
|
};
|
|
dhtmlXCombo.prototype._isListVisible = function() {
|
|
return (this.list.style.display == "")
|
|
};
|
|
dhtmlXCombo.prototype._getListVisibleCount = function() {
|
|
var a = 0;
|
|
for (var c = 0; c < this.list.childNodes.length; c++) {
|
|
a += (this.list.childNodes[c].style.display == "" ? 1 : 0)
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXCombo.prototype._checkListHeight = function() {
|
|
if (!this._isListVisible()) {
|
|
return
|
|
}
|
|
if (this.conf.item_h == null) {
|
|
var q = this.list.firstChild;
|
|
while (q != null) {
|
|
if (q.style.display == "") {
|
|
this.conf.item_h = q.offsetHeight;
|
|
q = null
|
|
} else {
|
|
q = q.nextSibling
|
|
}
|
|
}
|
|
q = null
|
|
}
|
|
var r = window.dhx4.screenDim();
|
|
var m = window.dhx4.absTop(this.base);
|
|
var a = this.base.offsetHeight;
|
|
var c = Math.max(0, Math.floor((m - r.top) / this.conf.item_h));
|
|
var o = Math.max(0, Math.floor((r.bottom - (m + a)) / this.conf.item_h));
|
|
var u = this._getListVisibleCount();
|
|
if (o < Math.min(this.conf.opts_count_min, u) && c > o) {
|
|
o = null
|
|
}
|
|
var n = Math.min((o == null ? c : o), this.conf.opts_count, u);
|
|
var g = (n < u ? (n * this.conf.item_h) + "px" : "");
|
|
var l = this.conf.sp[this.conf.skin].list_ofs;
|
|
this.list.style.height = g;
|
|
this.list.style.top = (o == null ? m - this.list.offsetHeight + l : m + a - l) + "px"
|
|
};
|
|
dhtmlXCombo.prototype._scrollToItem = function(l) {
|
|
var h = this.t[l].item.offsetTop;
|
|
var g = h + this.t[l].item.offsetHeight;
|
|
var c = this.list.scrollTop;
|
|
var a = c + this.list.clientHeight;
|
|
if (h < c) {
|
|
this.list.scrollTop = h
|
|
} else {
|
|
if (g > a) {
|
|
this.list.scrollTop = g - this.list.clientHeight
|
|
}
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype._setSelected = function(m, l, c) {
|
|
if (c) {
|
|
this._updateTopImage(m)
|
|
}
|
|
if (m != null && this.conf.last_hover == m) {
|
|
if (l) {
|
|
this._scrollToItem(m)
|
|
}
|
|
return
|
|
}
|
|
if (this.conf.last_hover != null) {
|
|
this.t[this.conf.last_hover].obj.setSelected(this.t[this.conf.last_hover].item, false);
|
|
this.conf.last_hover = null;
|
|
if (m == null) {
|
|
this.callEvent("onSelectionChange", [])
|
|
}
|
|
}
|
|
if (m != null) {
|
|
this.t[m].obj.setSelected(this.t[m].item, true);
|
|
this.conf.last_hover = m;
|
|
this.callEvent("onSelectionChange", []);
|
|
if (this.t[m].item == this.t[m].item.parentNode.lastChild && this.conf.f_url != null && this.conf.f_dyn == true && !this.conf.f_dyn_end) {
|
|
var h = "mask=" + encodeURIComponent(this.conf.f_mask) + "&pos=" + this.list.childNodes.length;
|
|
var a = this;
|
|
var g = function(o) {
|
|
if (a.conf.f_cache) {
|
|
a.conf.f_cache_data[a.conf.f_mask].data.push(o.xmlDoc.responseXML)
|
|
}
|
|
var n = a.list.childNodes.length;
|
|
a.load(o.xmlDoc.responseXML);
|
|
if (n == a.list.childNodes.length) {
|
|
a.conf.f_dyn_end = true;
|
|
if (a.conf.f_cache) {
|
|
a.conf.f_cache_data[a.conf.f_mask].dyn_end = true
|
|
}
|
|
}
|
|
g = a = null
|
|
};
|
|
if (window.dhx4.ajax.method == "post") {
|
|
window.dhx4.ajax.post(this.conf.f_url, h, g)
|
|
} else {
|
|
if (window.dhx4.ajax.method == "get") {
|
|
window.dhx4.ajax.get(this.conf.f_url + (String(this.conf.f_url).indexOf("?") >= 0 ? "&" : "?") + h, g)
|
|
}
|
|
}
|
|
}
|
|
if (l) {
|
|
this._scrollToItem(m)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.addOption = function(m, n, c, a, h) {
|
|
var g = null;
|
|
if (!(m instanceof Array)) {
|
|
var o = this._renderOption({
|
|
value: m,
|
|
text: n,
|
|
css: c,
|
|
img: a
|
|
});
|
|
if (g == null && window.dhx4.s2b(h) == true) {
|
|
g = o
|
|
}
|
|
} else {
|
|
for (var l = 0; l < m.length; l++) {
|
|
if (m[l] instanceof Array) {
|
|
o = this._renderOption({
|
|
value: m[l][0],
|
|
text: m[l][1],
|
|
css: m[l][2],
|
|
img: m[l][3]
|
|
});
|
|
if (g == null && window.dhx4.s2b(m[l][4]) == true) {
|
|
g = o
|
|
}
|
|
} else {
|
|
var o = this._renderOption(m[l]);
|
|
if (g == null && window.dhx4.s2b(m[l].selected) == true) {
|
|
g = o
|
|
}
|
|
}
|
|
}
|
|
} if (g != null) {
|
|
this._setSelected(g, this._isListVisible(), true);
|
|
this._confirmSelect("onInit")
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.updateOption = function(a, g, c, h) {
|
|
var l = this._getOptionId(a);
|
|
if (l == null) {
|
|
return
|
|
}
|
|
this.t[l].obj.update(this.t[l].item, {
|
|
value: g,
|
|
text: c,
|
|
css: h
|
|
});
|
|
if (this.conf.last_selected == l) {
|
|
this.conf.last_text = this.base.firstChild.value = this.t[l].obj.getText(this.t[l].item, true);
|
|
this.conf.f_server_last = this.base.firstChild.value.toLowerCase()
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.deleteOption = function(h) {
|
|
for (var c in this.t) {
|
|
var g = this.t[c].obj.getValue(this.t[c].item);
|
|
if (g == h) {
|
|
this._removeOption(c)
|
|
}
|
|
}
|
|
if (this._isListVisible()) {
|
|
this._showList(true)
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.clearAll = function() {
|
|
for (var c in this.t) {
|
|
this._removeOption(c)
|
|
}
|
|
if (this.conf.tm_hover) {
|
|
window.clearTimeout(this.conf.tm_hover)
|
|
}
|
|
this.conf.last_hover = null;
|
|
this.conf.last_selected = null;
|
|
this.list.scrollTop = 0;
|
|
this._hideList()
|
|
};
|
|
dhtmlXCombo.prototype._renderOption = function(c) {
|
|
var g = window.dhx4.newId();
|
|
var a = document.createElement("DIV");
|
|
a._optId = g;
|
|
a._tpl = this.conf.template;
|
|
if (typeof(c.img) == "undefined" && typeof(c.img_src) != "undefined") {
|
|
c.img = c.img_src;
|
|
delete c.img_src
|
|
}
|
|
if (typeof(c.img_dis) == "undefined" && typeof(c.img_src_dis) != "undefined") {
|
|
c.img_dis = c.img_src_dis;
|
|
delete c.img_src_dis
|
|
}
|
|
c.img_path = this.conf.img_path;
|
|
c.img_def = this.conf.img_def;
|
|
c.img_def_dis = this.conf.img_def_dis;
|
|
this.list.appendChild(a);
|
|
this.t[a._optId] = {
|
|
obj: this.modes[this.conf.opts_type].render(a, c),
|
|
item: a,
|
|
conf: {
|
|
type: this.conf.opts_type
|
|
}
|
|
};
|
|
a = null;
|
|
return g
|
|
};
|
|
dhtmlXCombo.prototype._removeOption = function(a) {
|
|
this.t[a].obj.destruct(this.t[a].item);
|
|
this.t[a].obj = null;
|
|
this.t[a].item.parentNode.removeChild(this.t[a].item);
|
|
this.t[a].item = null;
|
|
this.t[a].conf = null;
|
|
this.t[a] = null;
|
|
delete this.t[a];
|
|
if (this.conf.last_hover == a) {
|
|
this.conf.last_hover = null
|
|
}
|
|
if (this.conf.last_selected == a) {
|
|
this.conf.last_selected = null;
|
|
this._confirmSelect("onDelete")
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype._confirmSelect = function(c) {
|
|
var a = false;
|
|
if (this.conf.f_server_tm) {
|
|
window.clearTimeout(this.conf.f_server_tm)
|
|
}
|
|
if (this.conf.last_hover != null) {
|
|
a = a || (this.conf.last_value != this._getOptionValue(this.conf.last_hover));
|
|
this.conf.last_match = this.conf.last_selected = this.conf.last_hover;
|
|
this.conf.last_value = this._getOptionValue(this.conf.last_selected);
|
|
this.conf.last_text = this.base.firstChild.value = this.t[this.conf.last_selected].obj.getText(this.t[this.conf.last_selected].item, true);
|
|
this.conf.f_server_last = this.base.firstChild.value.toLowerCase();
|
|
this.base.childNodes[1].value = this.conf.last_value;
|
|
this.base.childNodes[2].value = "false"
|
|
} else {
|
|
if (this.conf.allow_free_text || (this.base.firstChild.value == "" && this.conf.allow_empty_value)) {
|
|
a = a || (this.conf.last_text != this.base.firstChild.value);
|
|
this.conf.last_match = this.conf.last_value = this.conf.last_selected = null;
|
|
this.conf.last_text = this.base.firstChild.value;
|
|
this.conf.f_server_last = this.base.firstChild.value.toLowerCase();
|
|
this.base.childNodes[1].value = this.conf.last_text;
|
|
this.base.childNodes[2].value = "true"
|
|
} else {
|
|
this._cancelSelect();
|
|
this._updateTopImage(this.conf.last_selected);
|
|
return
|
|
}
|
|
} if (this.conf.f_ac && this.conf.f_mode == "start") {
|
|
this.conf.f_ac_text = "";
|
|
if (c != "blur") {
|
|
this._selectRange(this.base.firstChild.value.length, this.base.firstChild.value.length)
|
|
}
|
|
}
|
|
this._hideList();
|
|
if (a == true && c != "onInit" && c != "onDelete") {
|
|
this.callEvent("onChange", [this.conf.last_value, this.conf.last_text])
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype._cancelSelect = function() {
|
|
this._hideList();
|
|
this.base.firstChild.value = this.conf.last_text;
|
|
if (this.conf.f_mode != false) {
|
|
this._filterOpts(true)
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype._getOption = function(n, h) {
|
|
if (!this.t[n]) {
|
|
return null
|
|
}
|
|
if (typeof(h) == "undefined") {
|
|
h = -1
|
|
}
|
|
if (h < 0) {
|
|
for (var m = 0; m < this.list.childNodes.length; m++) {
|
|
if (h < 0 && this.list.childNodes[m]._optId == n) {
|
|
h = m
|
|
}
|
|
}
|
|
}
|
|
var l = {
|
|
value: this.t[n].obj.getValue(this.t[n].item),
|
|
text: this.t[n].obj.getText(this.t[n].item),
|
|
text_input: this.t[n].obj.getText(this.t[n].item, true),
|
|
text_option: this.t[n].obj.getText(this.t[n].item, null, true),
|
|
css: this.t[n].obj.getCss(this.t[n].item),
|
|
selected: (n == this.conf.last_selected),
|
|
index: h
|
|
};
|
|
if (typeof(this.t[n].obj.getExtraData) == "function") {
|
|
var g = this.t[n].obj.getExtraData(this.t[n].item);
|
|
for (var c in g) {
|
|
if (typeof(l[c]) == "undefined") {
|
|
l[c] = g[c]
|
|
}
|
|
}
|
|
}
|
|
return l
|
|
};
|
|
dhtmlXCombo.prototype._getOptionProp = function(h, g, c) {
|
|
if (h != null) {
|
|
var a = this._getOption(h);
|
|
if (a != null) {
|
|
return a[g]
|
|
}
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXCombo.prototype._getOptionId = function(c) {
|
|
var h = null;
|
|
for (var a = 0; a < this.list.childNodes.length; a++) {
|
|
if (h == null) {
|
|
var g = this.list.childNodes[a]._optId;
|
|
if (c == this.t[g].obj.getValue(this.t[g].item)) {
|
|
h = g
|
|
}
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXCombo.prototype._getOptionValue = function(a) {
|
|
return this._getOptionProp(a, "value", null)
|
|
};
|
|
dhtmlXCombo.prototype.setSize = function(a) {
|
|
this.conf.combo_width = parseInt(a);
|
|
this.base.style.width = this.conf.combo_width + "px";
|
|
this.base.firstChild.style.width = (this.conf.combo_width - 24 - (this.conf.combo_image ? 23 : 0)) + "px";
|
|
this.base.firstChild.style.marginLeft = (this.conf.combo_image ? "23px" : "0px")
|
|
};
|
|
dhtmlXCombo.prototype.setOptionWidth = function(a) {
|
|
this.conf.opts_width = (parseInt(a) || null)
|
|
};
|
|
dhtmlXCombo.prototype.modes = {};
|
|
dhtmlXCombo.prototype.doWithItem = function(a, n, l, g) {
|
|
var m = (a >= 0 && a < this.list.childNodes.length ? this.list.childNodes[a]._optId : null);
|
|
if (m == null) {
|
|
return null
|
|
}
|
|
if (typeof(this.t[m].obj[n]) != "function") {
|
|
return null
|
|
}
|
|
var h = [this.t[m].item];
|
|
for (var c = 2; c < arguments.length; c++) {
|
|
h.push(arguments[c])
|
|
}
|
|
return this.t[m].obj[n].apply(this.t[m].obj, h)
|
|
};
|
|
|
|
function dhtmlXComboExtend(h, g) {
|
|
for (var c in dhtmlXCombo.prototype.modes[g]) {
|
|
if (typeof(dhtmlXCombo.prototype.modes[h][c]) == "undefined") {
|
|
dhtmlXCombo.prototype.modes[h][c] = dhtmlXCombo.prototype.modes[g][c]
|
|
}
|
|
}
|
|
}
|
|
dhtmlXCombo.prototype.modes.option = {
|
|
image: false,
|
|
option_css: "dhxcombo_option_text",
|
|
render: function(a, c) {
|
|
a._conf = {
|
|
value: c.value,
|
|
css: ""
|
|
};
|
|
a.className = "dhxcombo_option";
|
|
a.innerHTML = "<div class='" + this.option_css + "'> </div>";
|
|
if (c.css != null) {
|
|
a.lastChild.style.cssText = c.css;
|
|
a._conf.css = c.css
|
|
}
|
|
this.setText(a, c.text);
|
|
return this
|
|
},
|
|
destruct: function(a) {
|
|
a._conf = null
|
|
},
|
|
update: function(a, c) {
|
|
a._conf.value = c.value;
|
|
a._conf.css = c.css;
|
|
a.lastChild.style.cssText = c.css;
|
|
this.setText(a, c.text)
|
|
},
|
|
setText: function(c, g) {
|
|
c._conf.text = g;
|
|
var a = (typeof(g) == "object" ? window.dhx4.template(c._tpl.option, c._conf.text, true) : window.dhx4.trim(c._conf.text || ""));
|
|
c.lastChild.innerHTML = (a.length == 0 ? " " : a)
|
|
},
|
|
getText: function(g, a, c) {
|
|
if (window.dhx4.s2b(a) && typeof(g._conf.text) == "object") {
|
|
return window.dhx4.template(g._tpl.input, g._conf.text, true)
|
|
}
|
|
if (window.dhx4.s2b(c) && typeof(g._conf.text) == "object") {
|
|
return window.dhx4.template(g._tpl.option, g._conf.text, true)
|
|
}
|
|
return g._conf.text
|
|
},
|
|
getValue: function(a) {
|
|
return a._conf.value
|
|
},
|
|
getCss: function(a) {
|
|
return a._conf.css
|
|
},
|
|
setSelected: function(a, c) {
|
|
a.className = "dhxcombo_option" + (c ? " dhxcombo_option_selected" : "")
|
|
},
|
|
isSelected: function(a) {
|
|
return String(a.className).indexOf("dhxcombo_option_selected") >= 0
|
|
},
|
|
getExtraData: function(a) {
|
|
return {
|
|
type: "option"
|
|
}
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.modes.checkbox = {
|
|
image: true,
|
|
image_css: "dhxcombo_checkbox dhxcombo_chbx_#state#",
|
|
option_css: "dhxcombo_option_text dhxcombo_option_text_chbx",
|
|
render: function(a, c) {
|
|
a._conf = {
|
|
value: c.value,
|
|
css: "",
|
|
checked: window.dhx4.s2b(c.checked)
|
|
};
|
|
a.className = "dhxcombo_option";
|
|
a.innerHTML = "<div class='" + String(this.image_css).replace("#state#", (a._conf.checked ? "1" : "0")) + "'></div><div class='" + this.option_css + "'> </div>";
|
|
a.firstChild._optChbxId = a._optId;
|
|
if (c.css != null) {
|
|
a.lastChild.style.cssText += c.css;
|
|
a._conf.css = c.css
|
|
}
|
|
this.setText(a, c.text);
|
|
return this
|
|
},
|
|
setChecked: function(a, c) {
|
|
a._conf.checked = window.dhx4.s2b(c);
|
|
a.firstChild.className = String(this.image_css).replace("#state#", (a._conf.checked ? "1" : "0"))
|
|
},
|
|
isChecked: function(a) {
|
|
return (a._conf.checked == true)
|
|
},
|
|
getExtraData: function(a) {
|
|
return {
|
|
type: "checkbox",
|
|
checked: a._conf.checked
|
|
}
|
|
},
|
|
optionClick: function(h, g, l) {
|
|
var c = true;
|
|
var a = (g.target || g.srcElement);
|
|
while (c == true && a != null && a != h) {
|
|
if (a._optChbxId != null) {
|
|
if (l.callEvent("onCheck", [h._conf.value, !h._conf.checked]) === true) {
|
|
this.setChecked(h, !this.isChecked(h))
|
|
}
|
|
c = false
|
|
} else {
|
|
a = a.parentNode
|
|
}
|
|
}
|
|
a = l = h = null;
|
|
return c
|
|
},
|
|
getTopImage: function(c, a) {
|
|
return ""
|
|
},
|
|
topImageClick: function(a, c) {
|
|
return true
|
|
}
|
|
};
|
|
dhtmlXComboExtend("checkbox", "option");
|
|
dhtmlXCombo.prototype.setChecked = function(a, c) {
|
|
this.doWithItem(a, "setChecked", c)
|
|
};
|
|
dhtmlXCombo.prototype.getChecked = function(a, h) {
|
|
var c = [];
|
|
for (var g = 0; g < this.list.childNodes.length; g++) {
|
|
if (this.isChecked(g)) {
|
|
c.push(this._getOptionProp(this.list.childNodes[g]._optId, "value", ""))
|
|
}
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXCombo.prototype.isChecked = function(a) {
|
|
return this.doWithItem(a, "isChecked")
|
|
};
|
|
dhtmlXCombo.prototype.modes.image = {
|
|
image: true,
|
|
image_css: "dhxcombo_image",
|
|
option_css: "dhxcombo_option_text dhxcombo_option_text_image",
|
|
render: function(a, c) {
|
|
a._conf = {
|
|
value: c.value,
|
|
css: ""
|
|
};
|
|
a.className = "dhxcombo_option";
|
|
a.innerHTML = "<div class='" + this.image_css + "'></div><div class='" + this.option_css + "'> </div>";
|
|
if (c.css != null) {
|
|
a.lastChild.style.cssText += c.css;
|
|
a._conf.css = c.css
|
|
}
|
|
this.setText(a, c.text);
|
|
this.setImage(a, c.img, c.img_dis, c.img_path, c.img_def, c.img_def_dis);
|
|
return this
|
|
},
|
|
update: function(a, c) {
|
|
a._conf.value = c.value;
|
|
a._conf.css = c.css;
|
|
a.lastChild.style.cssText = c.css;
|
|
this.setText(a, c.text);
|
|
this.setImage(a, c.img, c.img_dis, c.img_path, c.img_def, c.img_def_dis)
|
|
},
|
|
setImage: function(g, a, l, m, h, c) {
|
|
if (a != null && a.length > 0) {
|
|
a = m + a
|
|
} else {
|
|
if (h != null && h.length > 0) {
|
|
a = m + h
|
|
} else {
|
|
a = null
|
|
}
|
|
} if (l != null && l.length > 0) {
|
|
l = m + l
|
|
} else {
|
|
if (c != null && c.length > 0) {
|
|
l = m + c
|
|
} else {
|
|
if (c == true) {
|
|
l = a
|
|
} else {
|
|
l = null
|
|
}
|
|
}
|
|
}
|
|
g._conf.img = a;
|
|
g._conf.img_dis = l;
|
|
g.firstChild.style.backgroundImage = (a != null ? "url(" + a + ")" : "none")
|
|
},
|
|
getExtraData: function(a) {
|
|
return {
|
|
type: "image"
|
|
}
|
|
},
|
|
getTopImage: function(h, g) {
|
|
var c = (g ? "img" : "img_dis");
|
|
if (h != null && h._conf[c] != null) {
|
|
return "<div class='" + this.image_css + "' style='background-image:url(" + h._conf[c] + ");'></div>"
|
|
}
|
|
return ""
|
|
}
|
|
};
|
|
dhtmlXComboExtend("image", "option");
|
|
dhtmlXCombo.prototype.setDefaultImage = function(a, c) {
|
|
if (a != null) {
|
|
this.conf.img_def = a
|
|
}
|
|
if (c != null) {
|
|
this.conf.img_def_dis = c
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.setImagePath = function(a) {
|
|
this.conf.img_path = a
|
|
};
|
|
|
|
function dhtmlXColorPicker(o) {
|
|
if (!(this instanceof dhtmlXColorPicker)) {
|
|
return new dhtmlXColorPicker(o)
|
|
}
|
|
dhx4._eventable(this);
|
|
var m = this,
|
|
h = undefined,
|
|
n = null,
|
|
g, a, c;
|
|
this._nodes = [];
|
|
this.activeNode = null;
|
|
this._inputListenerId = null;
|
|
this.base = null;
|
|
this._globalNode = null;
|
|
this.memory = null;
|
|
this.skin = null;
|
|
this.conf = {
|
|
cp_id: dhx4.newId(),
|
|
x: 0,
|
|
y: 0,
|
|
c: 0,
|
|
indent: 2,
|
|
position: "right",
|
|
customColors: false,
|
|
selectedColor: null,
|
|
hide: false,
|
|
hideOnSelect: false,
|
|
lang: "en",
|
|
closeable: true
|
|
};
|
|
this.value = {
|
|
red: null,
|
|
blue: null,
|
|
green: null,
|
|
hue: null,
|
|
sat: null,
|
|
lum: null
|
|
};
|
|
this._initMoveSelection = function(l) {
|
|
l = l || event;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
m._controllerNodes.colorArea.addEventListener("mousemove", m._setMoveSelection, false);
|
|
document.body.addEventListener("mouseup", m._cleanMoveSelection, false)
|
|
} else {
|
|
m._controllerNodes.colorArea.attachEvent("onmousemove", m._setMoveSelection);
|
|
document.body.attachEvent("onmouseup", m._cleanMoveSelection)
|
|
}
|
|
m._setMoveSelection(l, m._controllerNodes.colorArea);
|
|
return false
|
|
};
|
|
this._cleanMoveSelection = function() {
|
|
if (typeof(window.removeEventListener) == "function") {
|
|
m._controllerNodes.colorArea.removeEventListener("mousemove", m._setMoveSelection, false);
|
|
document.body.removeEventListener("mouseup", m._cleanMoveSelection, false)
|
|
} else {
|
|
m._controllerNodes.colorArea.detachEvent("onmousemove", m._setMoveSelection);
|
|
document.body.detachEvent("onmouseup", m._cleanMoveSelection)
|
|
}
|
|
return false
|
|
};
|
|
this._setMoveSelection = function(l) {
|
|
l = l || event;
|
|
var q = m._getOffsetPosition(l, m._controllerNodes.colorArea);
|
|
if (m._controllerNodes.fr_cover) {
|
|
setTimeout(function() {
|
|
m._setColorAreaXY(q.x, q.y);
|
|
m._setColorByXYC()
|
|
}, 0)
|
|
} else {
|
|
m._setColorAreaXY(q.x, q.y);
|
|
m._setColorByXYC()
|
|
}
|
|
return false
|
|
};
|
|
this._initMoveContrast = function(l) {
|
|
l = l || event;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
document.body.addEventListener("mousemove", m._setMoveContrast, false);
|
|
document.body.addEventListener("mouseup", m._cleanMoveContrast, false)
|
|
} else {
|
|
document.body.attachEvent("onmousemove", m._setMoveContrast);
|
|
document.body.attachEvent("onmouseup", m._cleanMoveContrast)
|
|
}
|
|
m._setMoveContrast(l, m._controllerNodes.contrastArea)
|
|
};
|
|
this._cleanMoveContrast = function() {
|
|
if (typeof(window.removeEventListener) == "function") {
|
|
document.body.removeEventListener("mousemove", m._setMoveContrast, false);
|
|
document.body.removeEventListener("mouseup", m._cleanMoveContrast, false)
|
|
} else {
|
|
document.body.detachEvent("onmousemove", m._setMoveContrast);
|
|
document.body.detachEvent("onmouseup", m._cleanMoveContrast)
|
|
}
|
|
};
|
|
this._setMoveContrast = function(l) {
|
|
l = l || event;
|
|
var q = m._getOffsetPosition(l, m._controllerNodes.contrastArea);
|
|
m._setContrastY(q.y);
|
|
m._setColorByXYC(true)
|
|
};
|
|
this._doOnSelectColor = function() {
|
|
var l = m.colorAIP.rgb2hex({
|
|
r: m.value.red,
|
|
g: m.value.green,
|
|
b: m.value.blue
|
|
});
|
|
if (m.activeNode != null) {
|
|
if (m.activeNode.valueCont) {
|
|
m.activeNode.valueCont.value = l
|
|
}
|
|
if (m.activeNode.valueColor) {
|
|
m.activeNode.valueColor.style.backgroundColor = l
|
|
}
|
|
}
|
|
if (m.base._dhx_remove || m.conf.hideOnSelect) {
|
|
m.hide()
|
|
}
|
|
m.callEvent("onSelect", [l, ((m.activeNode) ? m.activeNode.node : null)])
|
|
};
|
|
this._doOnCancel = function() {
|
|
if (m.callEvent("onCancel", [((m.activeNode) ? m.activeNode.node : null)]) == true && m.conf.closeable == true) {
|
|
m.hide()
|
|
}
|
|
};
|
|
this._doOnFocusByInput = function() {
|
|
var q = (this != window) ? this : event.srcElement;
|
|
var l = (m.activeNode && m.activeNode.valueCont && m.activeNode.valueCont == q) ? m.activeNode : m._getNodeByValueCont(q);
|
|
m.activeNode = l;
|
|
if (l && l == m.activeNode) {
|
|
m._initListenerInput()
|
|
}
|
|
};
|
|
this._doOnBlurByInput = function() {
|
|
var q = (this != window) ? this : event.srcElement;
|
|
var l = (m.activeNode && m.activeNode.valueCont && m.activeNode.valueCont == q) ? m.activeNode : m._getNodeByValueCont(q);
|
|
if (l && l == m.activeNode) {
|
|
m._removeListenerInput()
|
|
}
|
|
};
|
|
this._doOnClickByNode = function(q) {
|
|
q = q || event;
|
|
var l = (this != window) ? this : event.srcElement;
|
|
m.activeNode = (m.activeNode.node != l) ? m._getNodeByElement(l) : m.activeNode;
|
|
if (!m.isVisible()) {
|
|
m.show()
|
|
}
|
|
};
|
|
this.saveColor = function() {
|
|
m.memory.setValue(m.value)
|
|
};
|
|
this._onSelectMemoryEl = function(q) {
|
|
var l;
|
|
m._refreshCoordinatesByHSL(q.value.hue, q.value.sat, q.value.lum);
|
|
for (l in q.value) {
|
|
m.value[l] = q.value[l]
|
|
}
|
|
m._refreshContrast();
|
|
m._refreshInputValues();
|
|
m._refreshColorValue()
|
|
};
|
|
this._doOnClickByBody = function(r) {
|
|
r = r || event;
|
|
var l = true,
|
|
q = r.target || r.srcElement;
|
|
if (m._isBaseNode(q)) {
|
|
l = false
|
|
}
|
|
if (l && m.activeNode && (m.activeNode.node == q || m.activeNode.valueCont == q)) {
|
|
l = false
|
|
}
|
|
if (l) {
|
|
m.hide()
|
|
}
|
|
};
|
|
this._doOnChangeHSL = function() {
|
|
var r = parseInt(m._controllerNodes.hue.value),
|
|
q = parseInt(m._controllerNodes.sat.value),
|
|
l = parseInt(m._controllerNodes.lum.value),
|
|
s;
|
|
if (isNaN(r) || r > 359 || r < 0) {
|
|
m._controllerNodes.hue.value = m.value.hue
|
|
} else {
|
|
m.value.hue = r
|
|
} if (isNaN(q) || q > 100 || q < 0) {
|
|
m._controllerNodes.sat.value = m.value.sat
|
|
} else {
|
|
m.value.sat = q
|
|
} if (isNaN(l) || l > 100 || l < 0) {
|
|
m._controllerNodes.lum.value = m.value.lum
|
|
} else {
|
|
m.value.lum = l
|
|
}
|
|
s = m.colorAIP.hsl2rgb(m.value.hue, m.value.sat / 100, m.value.lum / 100);
|
|
m.value.red = Math.round(255 * s.r);
|
|
m.value.green = Math.round(255 * s.g);
|
|
m.value.blue = Math.round(255 * s.b);
|
|
m._refreshCoordinatesByHSL(m.value.hue, m.value.sat, m.value.lum);
|
|
m._refreshContrast();
|
|
m._refreshInputValues();
|
|
m._refreshColorValue()
|
|
};
|
|
this._doOnChangeRGB = function() {
|
|
var s = parseInt(m._controllerNodes.red.value),
|
|
r = parseInt(m._controllerNodes.green.value),
|
|
l = parseInt(m._controllerNodes.blue.value),
|
|
q;
|
|
if (isNaN(s) || s > 255 || s < 0) {
|
|
m._controllerNodes.red.value = m.value.red
|
|
} else {
|
|
m.value.red = s
|
|
} if (isNaN(r) || r > 255 || r < 0) {
|
|
m._controllerNodes.green.value = m.value.green
|
|
} else {
|
|
m.value.green = r
|
|
} if (isNaN(l) || l > 255 || l < 0) {
|
|
m._controllerNodes.blue.value = m.value.blue
|
|
} else {
|
|
m.value.blue = l
|
|
}
|
|
q = m.colorAIP.rgb2hsl(m.value.red / 255, m.value.green / 255, m.value.blue / 255);
|
|
m.value.hue = Math.round(q.h);
|
|
m.value.sat = Math.round(q.s * 100);
|
|
m.value.lum = Math.round(q.l * 100);
|
|
m._refreshCoordinatesByHSL(m.value.hue, m.value.sat, m.value.lum);
|
|
m._refreshContrast();
|
|
m._refreshInputValues();
|
|
m._refreshColorValue()
|
|
};
|
|
this._doOnChangeHSV = function() {
|
|
m._controllerNodes.hsv.value = m.setColor(m._controllerNodes.hsv.value)
|
|
};
|
|
this._checkType = function(q) {
|
|
var l;
|
|
if (q instanceof Array) {
|
|
l = m._checkType(q[0]);
|
|
switch (l) {
|
|
case "string":
|
|
return "array_string";
|
|
break;
|
|
case "input":
|
|
case "textarea":
|
|
return "array_input";
|
|
break;
|
|
case "object":
|
|
return "array_object";
|
|
break;
|
|
default:
|
|
return undefined
|
|
}
|
|
} else {
|
|
if (q == undefined) {
|
|
return null
|
|
} else {
|
|
if (typeof(q) == "string") {
|
|
return "string"
|
|
} else {
|
|
if (q.tagName && q.tagName.toLowerCase() == "input") {
|
|
return "input"
|
|
} else {
|
|
if (q.tagName && q.tagName.toLowerCase() == "textarea") {
|
|
return "textarea"
|
|
} else {
|
|
if (q.tagName) {
|
|
return "container"
|
|
} else {
|
|
if (typeof(q) == "object") {
|
|
return "object"
|
|
} else {
|
|
return undefined
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this._initByObject = function(l) {
|
|
if (l.parent && l.parent.tagName) {
|
|
m.base = l.parent
|
|
} else {
|
|
if (typeof(l.parent) == "string") {
|
|
m.base = document.getElementById(l.parent)
|
|
} else {
|
|
m.base = document.createElement("div");
|
|
m.base._dhx_remove = true
|
|
}
|
|
} if (l.color) {
|
|
m.conf.selectedColor = l.color
|
|
}
|
|
if (typeof(l.closeable) != "undefined") {
|
|
this.conf.closeable = dhx4.s2b(l.closeable)
|
|
}
|
|
if (l.custom_colors) {
|
|
this._tempInitCC = function() {
|
|
var s, r;
|
|
this.initMemoryColors();
|
|
this.conf.customColors = true;
|
|
if (l.custom_colors instanceof Array) {
|
|
r = l.custom_colors.length;
|
|
for (s = 0; s < r; s++) {
|
|
this.setCustomColors(l.custom_colors[s])
|
|
}
|
|
}
|
|
if (this.base.parentNode) {
|
|
this.showMemory()
|
|
}
|
|
delete this._tempInitCC
|
|
}
|
|
}
|
|
if (l.hide) {
|
|
m.conf.hide = true
|
|
}
|
|
if (l.input) {
|
|
m._addNode(l.input, l.target_color, l.target_value)
|
|
}
|
|
var q = l.skin || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxcolorpicker") || "dhx_skyblue";
|
|
m.setSkin(q);
|
|
if (l.colors) {
|
|
m.initMemoryColors();
|
|
m.conf.customColors = true
|
|
}
|
|
if (l.link) {
|
|
m._addNode(l.link)
|
|
}
|
|
};
|
|
this.unload = function() {
|
|
var s, q, r;
|
|
if (this.isVisible()) {
|
|
this.hide()
|
|
}
|
|
this.destructMemory();
|
|
q = this._nodes.length;
|
|
for (s = 0; s < q; s++) {
|
|
this._detachEventsFromNode(this._nodes[s]);
|
|
for (r in this._nodes[s]) {
|
|
this._nodes[s][r] = null
|
|
}
|
|
delete this._nodes[s]
|
|
}
|
|
this._nodes = null;
|
|
if (!this.base._dhx_remove) {
|
|
this.base.className = this.base.className.replace(/\s?dhtmlxcp_\S*/, "")
|
|
} else {
|
|
delete this.base._dhx_remove
|
|
} if (typeof(window.addEventListener) == "function") {
|
|
this._controllerNodes.colorArea.removeEventListener("mousedown", this._initMoveSelection, false);
|
|
this._controllerNodes.colorArea.removeEventListener("dblclick", this._doOnSelectColor, false);
|
|
this._controllerNodes.contrastArea.removeEventListener("mousedown", this._initMoveContrast, false);
|
|
this._controllerNodes.button_save.removeEventListener("click", this._doOnSelectColor, false);
|
|
this._controllerNodes.button_cancel.removeEventListener("click", this._doOnCancel, false);
|
|
this._controllerNodes.hue.removeEventListener("change", this._doOnChangeHSL, false);
|
|
this._controllerNodes.sat.removeEventListener("change", this._doOnChangeHSL, false);
|
|
this._controllerNodes.lum.removeEventListener("change", this._doOnChangeHSL, false);
|
|
this._controllerNodes.red.removeEventListener("change", this._doOnChangeRGB, false);
|
|
this._controllerNodes.green.removeEventListener("change", this._doOnChangeRGB, false);
|
|
this._controllerNodes.blue.removeEventListener("change", this._doOnChangeRGB, false);
|
|
this._controllerNodes.hsv.removeEventListener("change", this._doOnChangeHSV, false)
|
|
} else {
|
|
this._controllerNodes.colorArea.detachEvent("onmousedown", this._initMoveSelection);
|
|
this._controllerNodes.colorArea.detachEvent("ondblclick", this._doOnSelectColor);
|
|
this._controllerNodes.contrastArea.detachEvent("onmousedown", this._initMoveContrast);
|
|
this._controllerNodes.button_save.detachEvent("onclick", this._doOnSelectColor);
|
|
this._controllerNodes.button_cancel.detachEvent("onclick", this._doOnCancel);
|
|
this._controllerNodes.hue.detachEvent("onchange", this._doOnChangeHSL);
|
|
this._controllerNodes.sat.detachEvent("onchange", this._doOnChangeHSL);
|
|
this._controllerNodes.lum.detachEvent("onchange", this._doOnChangeHSL);
|
|
this._controllerNodes.red.detachEvent("onchange", this._doOnChangeRGB);
|
|
this._controllerNodes.green.detachEvent("onchange", this._doOnChangeRGB);
|
|
this._controllerNodes.blue.detachEvent("onchange", this._doOnChangeRGB);
|
|
this._controllerNodes.hsv.detachEvent("onchange", this._doOnChangeHSV)
|
|
} if (this._controllerNodes.fr_cover) {
|
|
if (this._controllerNodes.fr_cover.parentNode) {
|
|
this._controllerNodes.fr_cover.parentNode.removeChild(this._controllerNodes.fr_cover)
|
|
}
|
|
delete this._controllerNodes.fr_cover
|
|
}
|
|
dhx4.zim.clear(this.conf.cp_id);
|
|
dhx4._eventable(this, "clear");
|
|
for (r in this) {
|
|
this[r] = null
|
|
}
|
|
m = null, n = null, c = null
|
|
};
|
|
h = this._checkType(o);
|
|
switch (h) {
|
|
case "object":
|
|
m._initByObject(o);
|
|
break;
|
|
case "input":
|
|
case "textarea":
|
|
m._initByObject({});
|
|
this._addNode(o);
|
|
break;
|
|
case "string":
|
|
n = document.getElementById(o);
|
|
return new dhtmlXColorPicker(n);
|
|
break;
|
|
case "container":
|
|
m._initByObject({
|
|
parent: o
|
|
});
|
|
break;
|
|
case null:
|
|
m._initByObject({});
|
|
break;
|
|
case "array_string":
|
|
case "array_input":
|
|
m._initByObject({});
|
|
a = o.length;
|
|
for (g = 0; g < a; g++) {
|
|
this._addNode(o[g])
|
|
}
|
|
break;
|
|
case "array_object":
|
|
m._initByObject({});
|
|
a = o.length;
|
|
for (g = 0; g < a; g++) {
|
|
c = this._addNode(o[g].input, o[g].target_color, o[g].target_value).conf;
|
|
c.customColors = (o[g].custom_colors != undefined) ? dhx4.s2b(o[g].custom_colors) : c.customColors;
|
|
c.selectedColor = (o[g].color != undefined) ? o[g].color : c.selectedColor
|
|
}
|
|
break
|
|
}
|
|
this.base.innerHTML = "<div class='dhxcp_g_area'><div class='dhxcp_sub_area'><div class='dhxcp_g_color_area'><div class='dhxcp_color_selector'><div class='dhxcp_v_line'></div><div class='dhxcp_h_line'></div></div><div class='dhxcp_contrast_area'><div class='dhxcp_h_line'></div></div></div><div class='dhxcp_g_input_area'><div class='dhxcp_value_cont'><div class='dhxcp_value_color'></div><input type='text' class='dhxcp_value'/></div><table class='dhxcp_inputs_cont' cellpadding='0' cellspacing='0' border='0'><tr><td class='dhxcp_label_hsl'>" + this.i18n[this.conf.lang].labelHue + "</td><td class='dhxcp_input_hsl'><input type='text' class='dhxcp_input_hsl'/></td><td class='dhxcp_label_rgb'>" + this.i18n[this.conf.lang].labelRed + "</td><td class='dhxcp_input_rgb'><input type='text' class='dhxcp_input_rgb'/></td></tr><tr><td class='dhxcp_label_hsl'>" + this.i18n[this.conf.lang].labelSat + "</td><td class='dhxcp_input_hsl'><input type='text' class='dhxcp_input_hsl'/></td><td class='dhxcp_label_rgb'>" + this.i18n[this.conf.lang].labelGreen + "</td><td class='dhxcp_input_rgb'><input type='text' class='dhxcp_input_rgb'/></td></tr><tr><td class='dhxcp_label_hsl'>" + this.i18n[this.conf.lang].labelLum + "</td><td class='dhxcp_input_hsl'><input type='text' class='dhxcp_input_hsl'/></td><td class='dhxcp_label_rgb'>" + this.i18n[this.conf.lang].labelBlue + "</td><td class='dhxcp_input_rgb'><input type='text' class='dhxcp_input_rgb'/></td></tr></table></div><div class='dhxcp_g_memory_area'></div><div class='dhxcp_buttons_area'><button class='dhx_button_save'>" + this.i18n[this.conf.lang].btnSelect + "</button><button class='dhx_button_cancel'>" + this.i18n[this.conf.lang].btnCancel + "</button></div></div>";
|
|
"</div>";
|
|
this._globalNode = this.base.firstChild;
|
|
this._controllerNodes = {
|
|
colorArea: this._globalNode.firstChild.firstChild.firstChild,
|
|
v_line: this._globalNode.firstChild.firstChild.firstChild.childNodes[0],
|
|
h_line: this._globalNode.firstChild.firstChild.firstChild.childNodes[1],
|
|
contrastArea: this._globalNode.firstChild.firstChild.childNodes[1],
|
|
contrast_line: this._globalNode.firstChild.firstChild.childNodes[1].firstChild,
|
|
color: this._globalNode.firstChild.childNodes[1].childNodes[0].firstChild,
|
|
hsv: this._globalNode.firstChild.childNodes[1].childNodes[0].childNodes[1],
|
|
hue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[1].firstChild,
|
|
sat: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[1].firstChild,
|
|
lum: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[1].firstChild,
|
|
red: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[3].firstChild,
|
|
green: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[3].firstChild,
|
|
blue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[3].firstChild,
|
|
memory_block: this._globalNode.firstChild.childNodes[2],
|
|
button_save: this._globalNode.firstChild.childNodes[3].firstChild,
|
|
button_cancel: this._globalNode.firstChild.childNodes[3].childNodes[1]
|
|
};
|
|
this._labelNodes = {
|
|
labelHue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].firstChild,
|
|
labelSat: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].firstChild,
|
|
labelLum: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].firstChild,
|
|
labelRed: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[0].childNodes[2],
|
|
labelGreen: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[1].childNodes[2],
|
|
labelBlue: this._globalNode.firstChild.childNodes[1].childNodes[1].firstChild.childNodes[2].childNodes[2],
|
|
btnAddColor: null,
|
|
btnSelect: this._globalNode.firstChild.childNodes[3].firstChild,
|
|
btnCancel: this._globalNode.firstChild.childNodes[3].childNodes[1]
|
|
};
|
|
if (typeof(this._tempInitCC) == "function") {
|
|
this._tempInitCC()
|
|
}
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this._controllerNodes.colorArea.addEventListener("mousedown", this._initMoveSelection, false);
|
|
this._controllerNodes.colorArea.addEventListener("dblclick", this._doOnSelectColor, false);
|
|
this._controllerNodes.contrastArea.addEventListener("mousedown", this._initMoveContrast, false);
|
|
this._controllerNodes.button_save.addEventListener("click", this._doOnSelectColor, false);
|
|
this._controllerNodes.button_cancel.addEventListener("click", this._doOnCancel, false);
|
|
this._controllerNodes.hue.addEventListener("change", this._doOnChangeHSL, false);
|
|
this._controllerNodes.sat.addEventListener("change", this._doOnChangeHSL, false);
|
|
this._controllerNodes.lum.addEventListener("change", this._doOnChangeHSL, false);
|
|
this._controllerNodes.red.addEventListener("change", this._doOnChangeRGB, false);
|
|
this._controllerNodes.green.addEventListener("change", this._doOnChangeRGB, false);
|
|
this._controllerNodes.blue.addEventListener("change", this._doOnChangeRGB, false);
|
|
this._controllerNodes.hsv.addEventListener("change", this._doOnChangeHSV, false)
|
|
} else {
|
|
this._controllerNodes.colorArea.attachEvent("onmousedown", this._initMoveSelection);
|
|
this._controllerNodes.colorArea.attachEvent("ondblclick", this._doOnSelectColor);
|
|
this._controllerNodes.contrastArea.attachEvent("onmousedown", this._initMoveContrast);
|
|
this._controllerNodes.button_save.attachEvent("onclick", this._doOnSelectColor);
|
|
this._controllerNodes.button_cancel.attachEvent("onclick", this._doOnCancel);
|
|
this._controllerNodes.hue.attachEvent("onchange", this._doOnChangeHSL);
|
|
this._controllerNodes.sat.attachEvent("onchange", this._doOnChangeHSL);
|
|
this._controllerNodes.lum.attachEvent("onchange", this._doOnChangeHSL);
|
|
this._controllerNodes.red.attachEvent("onchange", this._doOnChangeRGB);
|
|
this._controllerNodes.green.attachEvent("onchange", this._doOnChangeRGB);
|
|
this._controllerNodes.blue.attachEvent("onchange", this._doOnChangeRGB);
|
|
this._controllerNodes.hsv.attachEvent("onchange", this._doOnChangeHSV)
|
|
} if (this.conf.selectedColor) {
|
|
this.setColor(this.conf.selectedColor)
|
|
} else {
|
|
this._setColorAreaXY(10, 10);
|
|
this._setContrastY(10);
|
|
m._setColorByXYC()
|
|
} if (this._nodes.length) {
|
|
for (var g = 0; g < this._nodes.length; g++) {
|
|
this._attachEventsToNode(this._nodes[g])
|
|
}
|
|
}
|
|
if (this.conf.hide) {
|
|
this.hide()
|
|
}
|
|
if (typeof(this._cpInitFRM) == "function") {
|
|
this._cpInitFRM()
|
|
}
|
|
}
|
|
dhtmlXColorPicker.prototype.linkTo = function(c, g, h) {
|
|
if (arguments.length == 1) {
|
|
g = h = c
|
|
}
|
|
var a;
|
|
c = c || null;
|
|
h = h || null;
|
|
if (typeof(g) == "string") {
|
|
g = document.getElementById(g)
|
|
}
|
|
a = this._addNode(g, c, h);
|
|
if (a) {
|
|
this._attachEventsToNode(a)
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXColorPicker.prototype._isBaseNode = function(a) {
|
|
if (a == this.base) {
|
|
return true
|
|
}
|
|
if (a.parentElement == document.body) {
|
|
return false
|
|
} else {
|
|
if (!a.parentElement) {
|
|
return false
|
|
} else {
|
|
return this._isBaseNode(a.parentElement)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._hasInput = function(g) {
|
|
var c, a, h = false;
|
|
a = this._nodes.length;
|
|
for (c = 0; c < a; c++) {
|
|
if (this._nodes[c].valueCont == g) {
|
|
h = true;
|
|
break
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXColorPicker.prototype._findNodesByArray = function(m) {
|
|
var g, a, c, h = [];
|
|
a = m.length;
|
|
for (g = 0; g < a; g++) {
|
|
if (typeof(m[g]) == "string") {
|
|
c = document.getElementById(m[g])
|
|
} else {
|
|
c = m[g]
|
|
} if (c) {
|
|
this._addNode(c)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._addNode = function(l, n, m) {
|
|
var c, h, g, a;
|
|
if (typeof(l) == "string") {
|
|
c = document.getElementById(l)
|
|
} else {
|
|
c = l
|
|
} if (typeof(n) == "string") {
|
|
n = document.getElementById(n)
|
|
}
|
|
if (typeof(m) == "string") {
|
|
m = document.getElementById(m)
|
|
}
|
|
if (!c) {
|
|
return null
|
|
}
|
|
if (dhx4.s2b(c.getAttribute("colorbox"))) {
|
|
h = document.createElement("div");
|
|
h.style.width = c.offsetWidth + "px";
|
|
h.style.height = c.offsetHeight + "px";
|
|
c.style.width = c.offsetWidth - (c.offsetHeight + 8) + "px";
|
|
c.parentNode.insertBefore(h, c);
|
|
h.style.position = "relative";
|
|
g = document.createElement("div");
|
|
h.appendChild(c);
|
|
h.appendChild(g);
|
|
g.className = "dhxcp_colorBox";
|
|
c.className += " dhxcp_colorInput";
|
|
g.style.width = g.style.height = c.offsetHeight + "px"
|
|
}
|
|
a = {
|
|
node: c,
|
|
valueColor: (n != undefined) ? n : g || c,
|
|
valueCont: (m != undefined) ? m : c,
|
|
conf: {
|
|
customColors: (c.getAttribute("customcolors") != null) ? dhx4.s2b(c.getAttribute("customcolors")) : null,
|
|
selectedColor: c.getAttribute("selectedcolor")
|
|
}
|
|
};
|
|
this._nodes.push(a);
|
|
if (!this.activeNode) {
|
|
this.activeNode = a
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXColorPicker.prototype.getNode = function(g) {
|
|
var a = null,
|
|
c = null;
|
|
if (typeof(g) == "string") {
|
|
a = document.getElementById(g)
|
|
} else {
|
|
a = g
|
|
} if (a.tagName != undefined) {
|
|
c = this._getNodeByElement(a)
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXColorPicker.prototype._getNodeByElement = function(g) {
|
|
var h = null,
|
|
c, a;
|
|
a = this._nodes.length;
|
|
for (c = 0; c < a; c++) {
|
|
if (this._nodes[c].node == g) {
|
|
h = this._nodes[c]
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXColorPicker.prototype._getNodeByValueCont = function(g) {
|
|
var h = null,
|
|
c, a;
|
|
a = this._nodes.length;
|
|
for (c = 0; c < a; c++) {
|
|
if (this._nodes[c].valueCont && this._nodes[c].valueCont == g) {
|
|
h = this._nodes[c]
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXColorPicker.prototype.initMemoryColors = function() {
|
|
var c = this;
|
|
this._controllerNodes.memory_block.innerHTML = "<div class='dhxcp_memory_button_cont'><button class='dhxcp_save_to_memory'><div class='dhxcp_label_bm'>" + this.i18n[this.conf.lang].btnAddColor + "</div></button></div><div class='dhxcp_memory_els_cont'><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a><a class='dhxcp_memory_el'></a></div>";
|
|
this.memory = new this.Memory(this._controllerNodes.memory_block.childNodes[1]);
|
|
this.memory.onSelect = this._onSelectMemoryEl;
|
|
this.memory.onSave = function(h) {
|
|
var g = c.colorAIP.rgb2hex({
|
|
r: h.red,
|
|
g: h.green,
|
|
b: h.blue
|
|
});
|
|
c.callEvent("onSaveColor", [g])
|
|
};
|
|
var a = this._controllerNodes.memory_block.childNodes[0].firstChild;
|
|
this._labelNodes.btnAddColor = this._controllerNodes.memory_block.childNodes[0].firstChild.firstChild;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.addEventListener("click", this.saveColor, false)
|
|
} else {
|
|
a.attachEvent("onclick", this.saveColor)
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._refreshCoordinatesByHSL = function(o, n, c) {
|
|
var a, m, g;
|
|
a = Math.round((this.configColorArea.maxX - this.configColorArea.minX) * o / 359) + this.configColorArea.minX;
|
|
m = Math.round((this.configColorArea.maxY - this.configColorArea.minY) * (100 - c) / 100) + this.configColorArea.minY;
|
|
g = Math.round((this.configColorArea.maxY - this.configColorArea.minY) * (100 - n) / 100) + this.configColorArea.minY;
|
|
this._setColorAreaXY(a, m);
|
|
this._setContrastY(g)
|
|
};
|
|
dhtmlXColorPicker.prototype.setColor = function(n) {
|
|
var h, g, m = true,
|
|
c, a = this.colorAIP.rgb2hex({
|
|
r: this.value.red,
|
|
g: this.value.green,
|
|
b: this.value.blue
|
|
}),
|
|
l;
|
|
if (n instanceof Array) {
|
|
h = {
|
|
r: parseInt(n[0]),
|
|
g: parseInt(n[1]),
|
|
b: parseInt(n[2])
|
|
}
|
|
} else {
|
|
if (typeof(n) == "string") {
|
|
n = n.replace(/\s/g, "");
|
|
if (/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i.test(n)) {
|
|
g = n.match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i);
|
|
h = {
|
|
r: parseInt(g[1]),
|
|
g: parseInt(g[2]),
|
|
b: parseInt(g[3])
|
|
}
|
|
} else {
|
|
h = this.colorAIP.hex2rgb(n)
|
|
}
|
|
}
|
|
}
|
|
m = m && h instanceof Object;
|
|
m = m && (0 <= h.r && h.r <= 255);
|
|
m = m && (0 <= h.g && h.g <= 255);
|
|
m = m && (0 <= h.b && h.b <= 255);
|
|
if (!m) {
|
|
return a
|
|
}
|
|
l = this.colorAIP.rgb2hex({
|
|
r: h.r,
|
|
g: h.g,
|
|
b: h.b
|
|
});
|
|
if (l == a) {
|
|
return a
|
|
}
|
|
this.value.red = h.r;
|
|
this.value.green = h.g;
|
|
this.value.blue = h.b;
|
|
c = this.colorAIP.rgb2hsl(h.r / 255, h.g / 255, h.b / 255);
|
|
this.value.hue = Math.round(c.h);
|
|
this.value.sat = Math.round(c.s * 100);
|
|
this.value.lum = Math.round(c.l * 100);
|
|
this._refreshCoordinatesByHSL(this.value.hue, this.value.sat, this.value.lum);
|
|
this._refreshContrast();
|
|
this._refreshInputValues();
|
|
this._refreshColorValue();
|
|
return l
|
|
};
|
|
dhtmlXColorPicker.prototype.getSelectedColor = function() {
|
|
return [this.colorAIP.rgb2hex({
|
|
r: this.value.red,
|
|
g: this.value.green,
|
|
b: this.value.blue
|
|
}), [this.value.red, this.value.green, this.value.blue], [this.value.hue, this.value.sat, this.value.lum]]
|
|
};
|
|
dhtmlXColorPicker.prototype._attachEventsToNode = function(a) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.node.addEventListener("click", this._doOnClickByNode, false)
|
|
} else {
|
|
a.node.attachEvent("onclick", this._doOnClickByNode)
|
|
} if (a.valueCont && a.valueCont.tagName.toLowerCase() == "input") {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.valueCont.addEventListener("focus", this._doOnFocusByInput, false);
|
|
a.valueCont.addEventListener("blur", this._doOnBlurByInput, false)
|
|
} else {
|
|
a.valueCont.attachEvent("onfocus", this._doOnFocusByInput);
|
|
a.valueCont.attachEvent("onblur", this._doOnBlurByInput)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._detachEventsFromNode = function(a) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.node.removeEventListener("click", this._doOnClickByNode, false)
|
|
} else {
|
|
a.node.detachEvent("onclick", this._doOnClickByNode)
|
|
} if (a.valueCont && a.valueCont.tagName.toLowerCase() == "input") {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.valueCont.removeEventListener("focus", this._doOnFocusByInput, false);
|
|
a.valueCont.removeEventListener("blur", this._doOnBlurByInput, false)
|
|
} else {
|
|
a.valueCont.detachEvent("onfocus", this._doOnFocusByInput);
|
|
a.valueCont.detachEvent("onblur", this._doOnBlurByInput)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype.show = function(c) {
|
|
var a = false;
|
|
if (c != undefined) {
|
|
this.activeNode = this.getNode(c) || this.activeNode
|
|
}
|
|
if (this.activeNode && this.activeNode.valueCont && this.activeNode.valueCont.value) {
|
|
this.setColor(this.activeNode.valueCont.value)
|
|
}
|
|
if (this.activeNode) {
|
|
a = (this.activeNode.conf.customColors != null) ? this.activeNode.conf.customColors : this.conf.customColors;
|
|
this.setColor(this.activeNode.conf.selectedColor)
|
|
} else {
|
|
a = this.conf.customColors
|
|
} if (a) {
|
|
this.showMemory()
|
|
} else {
|
|
this.hideMemory()
|
|
} if (this.base._dhx_remove) {
|
|
this.base.firstChild.style.zIndex = dhx4.zim.reserve(this.conf.cp_id);
|
|
if (document.body.firstChild) {
|
|
document.body.insertBefore(this.base, document.body.firstChild)
|
|
} else {
|
|
document.body.appendChild(this.base)
|
|
}
|
|
this._refreshPosition();
|
|
if (typeof(window.addEventListener) == "function") {
|
|
document.body.addEventListener("mousedown", this._doOnClickByBody, false)
|
|
} else {
|
|
document.body.attachEvent("onmousedown", this._doOnClickByBody)
|
|
}
|
|
} else {
|
|
this.base.appendChild(this._globalNode)
|
|
} if (this._controllerNodes.fr_cover) {
|
|
this.base.insertBefore(this._controllerNodes.fr_cover, this._globalNode)
|
|
}
|
|
this.callEvent("onShow", [((this.activeNode) ? this.activeNode.node : null)])
|
|
};
|
|
dhtmlXColorPicker.prototype.setPosition = function(c, l) {
|
|
var h = null,
|
|
a = parseInt(c),
|
|
g = parseInt(l);
|
|
if (isNaN(a)) {
|
|
h = (c.toLowerCase() == "left") ? "left" : (c.toLowerCase() == "bottom") ? "bottom" : null
|
|
}
|
|
if (this.base._dhx_remove) {
|
|
if (h == null) {} else {
|
|
this.conf.position = h;
|
|
this._refreshPosition(h)
|
|
}
|
|
} else {
|
|
if (isNaN(a) || isNaN(g)) {} else {
|
|
this._globalNode.style.left = a + "px";
|
|
this._globalNode.style.top = g + "px";
|
|
if (this._controllerNodes.fr_cover) {
|
|
this._controllerNodes.fr_cover.style.left = this._globalNode.style.left;
|
|
this._controllerNodes.fr_cover.style.top = this._globalNode.style.top
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._initListenerInput = function() {
|
|
var a = this;
|
|
this._inputListenerId = this._inputListenerId || setInterval(function() {
|
|
a._refreshValueByInput()
|
|
}, 70)
|
|
};
|
|
dhtmlXColorPicker.prototype._removeListenerInput = function() {
|
|
if (this._inputListenerId) {
|
|
clearInterval(this._inputListenerId);
|
|
this._inputListenerId = null
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._refreshValueByInput = function() {
|
|
var c = this.activeNode.valueCont.value,
|
|
a = this.getSelectedColor()[0];
|
|
if (this._inputListenerId) {
|
|
if (/^#[\da-f]{6}$/i.test(c) && c != a) {
|
|
this.setColor(c);
|
|
this.callEvent("onSelect", [c, this.activeNode.node])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._refreshPosition = function(c) {
|
|
if (this.activeNode == null) {
|
|
return
|
|
}
|
|
var m = dhx4.absTop(this.activeNode.node),
|
|
a = dhx4.absLeft(this.activeNode.node),
|
|
g = dhx4.screenDim(),
|
|
h = this._globalNode.offsetHeight,
|
|
l = 0;
|
|
c = c || this.conf.position;
|
|
switch (c) {
|
|
case "bottom":
|
|
this._globalNode.style.top = m + this.activeNode.node.offsetHeight + this.conf.indent + "px";
|
|
this._globalNode.style.left = a + "px";
|
|
break;
|
|
default:
|
|
this._globalNode.style.left = a + this.activeNode.node.offsetWidth + this.conf.indent + "px";
|
|
l = m;
|
|
if (g.bottom - (l + h) <= 0) {
|
|
l = g.bottom - (h + this.conf.indent)
|
|
}
|
|
if (l - g.top < 0) {
|
|
l = g.top + this.conf.indent
|
|
}
|
|
this._globalNode.style.top = l + "px"
|
|
}
|
|
if (this._controllerNodes.fr_cover) {
|
|
this._controllerNodes.fr_cover.style.left = this._globalNode.style.left;
|
|
this._controllerNodes.fr_cover.style.top = this._globalNode.style.top
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype.isVisible = function() {
|
|
var a = false;
|
|
if (this.base._dhx_remove) {
|
|
a = this.base.parentNode == document.body
|
|
} else {
|
|
a = this._globalNode.parentNode == this.base
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXColorPicker.prototype.hide = function() {
|
|
if (this.base._dhx_remove) {
|
|
if (this.base.parentNode) {
|
|
this.base.parentNode.removeChild(this.base);
|
|
dhx4.zim.clear(this.conf.cp_id);
|
|
if (typeof(window.addEventListener) == "function") {
|
|
document.body.removeEventListener("mousedown", this._doOnClickByBody, false)
|
|
} else {
|
|
document.body.detachEvent("onmousedown", this._doOnClickByBody)
|
|
}
|
|
}
|
|
} else {
|
|
if (this.isVisible() == false) {
|
|
return
|
|
}
|
|
this.base.removeChild(this._globalNode)
|
|
} if (this._controllerNodes.fr_cover && this._controllerNodes.fr_cover.parentNode) {
|
|
this._controllerNodes.fr_cover.parentNode.removeChild(this._controllerNodes.fr_cover)
|
|
}
|
|
if (this.callEvent != undefined) {
|
|
this.callEvent("onHide", [((this.activeNode) ? this.activeNode.node : null)])
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype.configColorArea = {
|
|
minX: 1,
|
|
maxX: 209,
|
|
minY: 1,
|
|
maxY: 119
|
|
};
|
|
dhtmlXColorPicker.prototype._skinCollection = {
|
|
dhx_skyblue: true,
|
|
dhx_web: true,
|
|
dhx_terrace: true
|
|
};
|
|
dhtmlXColorPicker.prototype.i18n = {
|
|
en: {
|
|
labelHue: "Hue",
|
|
labelSat: "Sat",
|
|
labelLum: "Lum",
|
|
labelRed: "Red",
|
|
labelGreen: "Green",
|
|
labelBlue: "Blue",
|
|
btnAddColor: "Save the color",
|
|
btnSelect: "Select",
|
|
btnCancel: "Cancel"
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype.loadUserLanguage = function(a) {
|
|
if (typeof(this._mergeLangModules) == "function") {
|
|
this._mergeLangModules()
|
|
}
|
|
this.conf.lang = a;
|
|
this._refreshLanguage()
|
|
};
|
|
dhtmlXColorPicker.prototype._refreshLanguage = function() {
|
|
var a, c = this.i18n[this.conf.lang];
|
|
for (a in c) {
|
|
if (this._labelNodes[a]) {
|
|
this._labelNodes[a].innerHTML = c[a]
|
|
}
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._setColorAreaXY = function(a, g) {
|
|
var c = this.configColorArea;
|
|
a = parseInt(a);
|
|
if (c.minX > a) {
|
|
this.conf.x = c.minX
|
|
} else {
|
|
if (a > c.maxX) {
|
|
this.conf.x = c.maxX
|
|
} else {
|
|
if (!isNaN(a)) {
|
|
this.conf.x = a
|
|
}
|
|
}
|
|
}
|
|
g = parseInt(g);
|
|
if (c.minY > g) {
|
|
this.conf.y = c.minY
|
|
} else {
|
|
if (g > c.maxY) {
|
|
this.conf.y = c.maxY
|
|
} else {
|
|
if (!isNaN(g)) {
|
|
this.conf.y = g
|
|
}
|
|
}
|
|
}
|
|
this._refreshLines()
|
|
};
|
|
dhtmlXColorPicker.prototype._setColorByXYC = function(c) {
|
|
c = c || false;
|
|
this.value.hue = Math.round((359 * (this.conf.x - this.configColorArea.minX)) / (this.configColorArea.maxX - this.configColorArea.minX));
|
|
this.value.lum = Math.round(100 - (100 * (this.conf.y - this.configColorArea.minY)) / (this.configColorArea.maxY - this.configColorArea.minY));
|
|
this.value.sat = Math.round(100 - (100 * (this.conf.c - this.configColorArea.minY)) / (this.configColorArea.maxY - this.configColorArea.minY));
|
|
var a = this.colorAIP.hsl2rgb(this.value.hue, this.value.sat / 100, this.value.lum / 100);
|
|
this.value.red = Math.round(255 * a.r);
|
|
this.value.green = Math.round(255 * a.g);
|
|
this.value.blue = Math.round(255 * a.b);
|
|
if (!c) {
|
|
this._refreshContrast()
|
|
}
|
|
this._refreshInputValues();
|
|
this._refreshColorValue()
|
|
};
|
|
dhtmlXColorPicker.prototype._setContrastY = function(c) {
|
|
var a = this.configColorArea;
|
|
c = parseInt(c);
|
|
if (!isNaN(c)) {
|
|
this.conf.c = Math.min(Math.max(a.minY, c), a.maxY)
|
|
}
|
|
this._refreshContrastLine()
|
|
};
|
|
dhtmlXColorPicker.prototype._refreshInputValues = function() {
|
|
this._controllerNodes.hue.value = this.value.hue;
|
|
this._controllerNodes.sat.value = this.value.sat;
|
|
this._controllerNodes.lum.value = this.value.lum;
|
|
this._controllerNodes.red.value = this.value.red;
|
|
this._controllerNodes.green.value = this.value.green;
|
|
this._controllerNodes.blue.value = this.value.blue
|
|
};
|
|
dhtmlXColorPicker.prototype._refreshColorValue = function() {
|
|
this._controllerNodes.color.style.backgroundColor = "rgb(" + [this.value.red, this.value.green, this.value.blue].join(", ") + ")";
|
|
var a = this.colorAIP.rgb2hex({
|
|
r: this.value.red,
|
|
g: this.value.green,
|
|
b: this.value.blue
|
|
});
|
|
this._controllerNodes.hsv.value = a;
|
|
this.callEvent("onChange", [a])
|
|
};
|
|
dhtmlXColorPicker.prototype._refreshContrast = function() {
|
|
var h = this.colorAIP.hsl2rgb(this.value.hue, 0, this.value.lum / 100);
|
|
var l = this.colorAIP.hsl2rgb(this.value.hue, 1, this.value.lum / 100);
|
|
var g = this._checkIeVersion();
|
|
if (g && g <= 8) {
|
|
var m = this._controllerNodes.contrastArea.firstChild;
|
|
if (m == this._controllerNodes.contrast_line) {
|
|
m = document.createElement("div");
|
|
m.className += "dhxcp_ie_gradient";
|
|
this._controllerNodes.contrastArea.appendChild(m);
|
|
this._controllerNodes.contrastArea.appendChild(this._controllerNodes.contrast_line)
|
|
}
|
|
var c = this.colorAIP.rgb2hex({
|
|
r: Math.round(255 * h.r),
|
|
g: Math.round(255 * h.g),
|
|
b: Math.round(255 * h.b)
|
|
});
|
|
var a = this.colorAIP.rgb2hex({
|
|
r: Math.round(255 * l.r),
|
|
g: Math.round(255 * l.g),
|
|
b: Math.round(255 * l.b)
|
|
});
|
|
m.style.filter = "progid:DXImageTransform.Microsoft.gradient(startColorstr='" + a + "', endColorstr='" + c + "', GradientType=0)"
|
|
} else {
|
|
h = [Math.round(255 * h.r), Math.round(255 * h.g), Math.round(255 * h.b)];
|
|
l = [Math.round(255 * l.r), Math.round(255 * l.g), Math.round(255 * l.b)];
|
|
this._controllerNodes.contrastArea.style.backgroundImage = "linear-gradient(to top, rgb(" + h.join(",") + "), rgb(" + l.join(",") + "))"
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._refreshLines = function() {
|
|
this._controllerNodes.v_line.style.left = this.conf.x + "px";
|
|
this._controllerNodes.h_line.style.top = this.conf.y + "px"
|
|
};
|
|
dhtmlXColorPicker.prototype._refreshContrastLine = function() {
|
|
this._controllerNodes.contrast_line.style.top = this.conf.c + "px"
|
|
};
|
|
dhtmlXColorPicker.prototype._getOffsetPosition = function(h, a) {
|
|
var c = {
|
|
x: NaN,
|
|
y: NaN
|
|
}, g = h.target || h.srcElement;
|
|
if (g == a) {
|
|
c.x = (h.offsetX != undefined) ? h.offsetX : h.layerX;
|
|
c.y = (h.offsetY != undefined) ? h.offsetY : h.layerY
|
|
} else {
|
|
if (g == this._controllerNodes.v_line) {
|
|
c.y = (h.offsetY != undefined) ? h.offsetY : h.layerY
|
|
} else {
|
|
c.x = (h.offsetX != undefined) ? h.offsetX : h.layerX
|
|
}
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXColorPicker.prototype.colorAIP = {
|
|
hex2rgb: function(c) {
|
|
var a = c.match(/^(#)([\da-f]{2})([\da-f]{2})([\da-f]{2})$/i);
|
|
if (a != null) {
|
|
return {
|
|
r: parseInt("0x" + a[2]),
|
|
g: parseInt("0x" + a[3]),
|
|
b: parseInt("0x" + a[4])
|
|
}
|
|
} else {
|
|
return null
|
|
}
|
|
},
|
|
rgb2hex: function(l) {
|
|
var h = parseInt(l.r),
|
|
c = parseInt(l.g),
|
|
a = parseInt(l.b);
|
|
h = h || 0, c = c || 0, a = a || 0;
|
|
return "#" + ((h) ? ((h < 16) ? "0" + h.toString(16) : h.toString(16)) : "00") + ((c) ? ((c < 16) ? "0" + c.toString(16) : c.toString(16)) : "00") + ((a) ? ((a < 16) ? "0" + a.toString(16) : a.toString(16)) : "00")
|
|
},
|
|
rgb2hsl: function(q, o, h) {
|
|
var n, m, c;
|
|
var a = Math.max(q, o, h),
|
|
l = Math.min(q, o, h);
|
|
c = 0.5 * (a + l);
|
|
if (a == l) {
|
|
n = 0
|
|
} else {
|
|
if (a == q) {
|
|
n = 60 * (o - h) / (a - l);
|
|
if (o < h) {
|
|
n += 360
|
|
}
|
|
} else {
|
|
if (a == o) {
|
|
n = 60 * (h - q) / (a - l) + 120
|
|
} else {
|
|
n = 60 * (q - o) / (a - l) + 240
|
|
}
|
|
}
|
|
} if (c == 0 || a == l) {
|
|
m = 0
|
|
} else {
|
|
if (c <= 0.5) {
|
|
m = 0.5 * (a - l) / c
|
|
} else {
|
|
m = 0.5 * (a - l) / (1 - c)
|
|
}
|
|
}
|
|
return {
|
|
h: n,
|
|
s: m,
|
|
l: c
|
|
}
|
|
},
|
|
hsl2rgb: function(q, g, n) {
|
|
var l, m, o;
|
|
var c = [],
|
|
a = [];
|
|
if (n <= 0.5) {
|
|
l = n * (1 + g)
|
|
} else {
|
|
l = n + g - (n * g)
|
|
}
|
|
m = 2 * n - l;
|
|
o = q / 360;
|
|
c.push(o + 1 / 3);
|
|
c.push(o);
|
|
c.push(o - 1 / 3);
|
|
for (var h = 0; h < 3; h++) {
|
|
if (c[h] < 0) {
|
|
c[h] += 1
|
|
} else {
|
|
if (c[h] > 1) {
|
|
c[h] -= 1
|
|
}
|
|
} if (c[h] < 1 / 6) {
|
|
a.push(m + (l - m) * 6 * c[h])
|
|
} else {
|
|
if (c[h] < 0.5) {
|
|
a.push(l)
|
|
} else {
|
|
if (c[h] < 2 / 3) {
|
|
a.push(m + (l - m) * (2 / 3 - c[h]) * 6)
|
|
} else {
|
|
a.push(m)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return {
|
|
r: a[0],
|
|
g: a[1],
|
|
b: a[2]
|
|
}
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._checkIeVersion = function() {
|
|
var a;
|
|
var c = navigator.userAgent.match(/(MSIE)\s(\d\.\d)/i);
|
|
a = (c && c[2]) ? parseInt(c[2]) : null;
|
|
return a
|
|
};
|
|
dhtmlXColorPicker.prototype.setCustomColors = function() {
|
|
if (this.memory == null) {
|
|
this.initMemoryColors();
|
|
this.conf.customColors = true
|
|
}
|
|
var h, g, n, c, m, a;
|
|
g = arguments.length;
|
|
for (h = 0; h < g; h++) {
|
|
if (arguments[h] instanceof Array) {
|
|
n = this._rgb2value(arguments[h][0], arguments[h][1], arguments[h][2]);
|
|
this.memory.setValue(n, null, false);
|
|
continue
|
|
} else {
|
|
if (typeof(arguments[h]) == "string") {
|
|
c = arguments[h].match(/^rgb\((\d{1,3})\,(\d{1,3})\,(\d{1,3})\)$/i);
|
|
if (c instanceof Array) {
|
|
n = this._rgb2value(c[1], c[2], c[3]);
|
|
this.memory.setValue(n, null, false);
|
|
continue
|
|
}
|
|
c = arguments[h].match(/(#[\da-f]{6})/ig);
|
|
if (c instanceof Array) {
|
|
a = c.length;
|
|
for (m = 0; m < a; m++) {
|
|
n = this._hex2value(c[m]);
|
|
this.memory.setValue(n, null, false)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._rgb2value = function(l, h, a) {
|
|
var c = this.colorAIP.rgb2hsl(l / 255, h / 255, a / 255);
|
|
return {
|
|
red: l,
|
|
green: h,
|
|
blue: a,
|
|
hue: Math.round(c.h),
|
|
sat: Math.round(c.s * 100),
|
|
lum: Math.round(c.l * 100)
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype._hex2value = function(g) {
|
|
var c, a;
|
|
c = this.colorAIP.hex2rgb(g);
|
|
a = this.colorAIP.rgb2hsl(c.r / 255, c.g / 255, c.b / 255);
|
|
return {
|
|
red: c.r,
|
|
green: c.g,
|
|
blue: c.b,
|
|
hue: Math.round(a.h),
|
|
sat: Math.round(a.s * 100),
|
|
lum: Math.round(a.l * 100)
|
|
}
|
|
};
|
|
dhtmlXColorPicker.prototype.showMemory = function() {
|
|
if (this.memory == null) {
|
|
this.initMemoryColors()
|
|
}
|
|
if (!this._globalNode.className.match(/dhxcp_add_memory/)) {
|
|
this._globalNode.className += " dhxcp_add_memory"
|
|
}
|
|
this.conf.customColors = true
|
|
};
|
|
dhtmlXColorPicker.prototype.hideMemory = function() {
|
|
if (this.memory != null) {
|
|
this._globalNode.className = this._globalNode.className.replace(/\sdhxcp_add_memory/, "")
|
|
}
|
|
this.conf.customColors = false
|
|
};
|
|
dhtmlXColorPicker.prototype.setSkin = function(l) {
|
|
l = l.toLowerCase();
|
|
var g, c = -1,
|
|
a, h = "dhtmlxcp";
|
|
g = this.base.className.match(/\S\w+/ig);
|
|
if (g instanceof Array) {
|
|
for (a in this._skinCollection) {
|
|
if (c == -1) {
|
|
c = this._indexOf(g, h + "_" + a)
|
|
} else {
|
|
break
|
|
}
|
|
}
|
|
c = (c == -1) ? g.length : c
|
|
} else {
|
|
g = [];
|
|
c = 0
|
|
}
|
|
g[c] = h + "_" + l;
|
|
this.base.className = g.join(" ");
|
|
this.skin = l
|
|
};
|
|
dhtmlXColorPicker.prototype.hideOnSelect = function(a) {
|
|
a = dhx4.s2b(a);
|
|
this.conf.hideOnSelect = a
|
|
};
|
|
dhtmlXColorPicker.prototype._indexOf = function(a, h) {
|
|
var g, c, m = -1;
|
|
c = a.length;
|
|
for (g = c; g >= 0; g--) {
|
|
if (a[g] == h) {
|
|
m = g;
|
|
break
|
|
}
|
|
}
|
|
return m
|
|
};
|
|
dhtmlXColorPicker.prototype.destructMemory = function() {
|
|
if (this.memory == null) {
|
|
return
|
|
}
|
|
this.hideMemory();
|
|
var a = this._controllerNodes.memory_block.childNodes[0].firstChild;
|
|
this._labelNodes.btnAddColor = null;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.removeEventListener("click", this.saveColor, false)
|
|
} else {
|
|
a.detachEvent("onclick", this.saveColor)
|
|
}
|
|
this.memory.remove();
|
|
this._controllerNodes.memory_block.innerHTML = "";
|
|
this.memory = null
|
|
};
|
|
dhtmlXColorPicker.prototype.Memory = function(g) {
|
|
var c = this,
|
|
a = null,
|
|
h = {
|
|
red: 255,
|
|
blue: 255,
|
|
green: 255,
|
|
hue: 0,
|
|
sat: 0,
|
|
lum: 100
|
|
};
|
|
this.select = function() {
|
|
var m = (this != window) ? this : event.srcElement;
|
|
var l = l || m.dhxpc_memory;
|
|
if (a != null) {
|
|
c.unSelect()
|
|
}
|
|
a = l;
|
|
l.domElement.className += " dhxcp_memory_el_select";
|
|
if (typeof(c.onSelect) == "function") {
|
|
c.onSelect(l)
|
|
}
|
|
};
|
|
this.onSelect = null;
|
|
this.onSave = null;
|
|
this._createMemoryController = function(l) {
|
|
var m = {
|
|
domElement: l,
|
|
value: dhx4._copyObj(h)
|
|
};
|
|
l.dhxpc_memory = m;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
l.addEventListener("click", c.select, false)
|
|
} else {
|
|
l.attachEvent("onclick", c.select)
|
|
}
|
|
return m
|
|
};
|
|
this._findMemoryControllers = function(r) {
|
|
var o = r.getElementsByTagName("a"),
|
|
n, m, q = [];
|
|
m = o.length;
|
|
for (n = 0; n < m; n++) {
|
|
q.push(this._createMemoryController(o[n]))
|
|
}
|
|
return q
|
|
};
|
|
this.controllers = this._findMemoryControllers(g);
|
|
this.unSelect = function() {
|
|
if (a) {
|
|
a.domElement.className = a.domElement.className.replace(/\s.*$/i, "")
|
|
}
|
|
a = null
|
|
};
|
|
this.setActiveNext = function() {
|
|
var n = null,
|
|
m;
|
|
if (a == null) {
|
|
a = this.controllers[0]
|
|
} else {
|
|
n = this.getIndex(a);
|
|
m = this.controllers.length;
|
|
this.unSelect();
|
|
a = (n + 1 < m) ? this.controllers[n + 1] : this.controllers[0]
|
|
}
|
|
a.domElement.className += " dhxcp_memory_el_next";
|
|
return a
|
|
};
|
|
this.setValue = function(m, l, n) {
|
|
a = l || a;
|
|
if (a == null) {
|
|
a = this.controllers[0]
|
|
}
|
|
a.value.red = m.red;
|
|
a.value.blue = m.blue;
|
|
a.value.green = m.green;
|
|
a.value.hue = m.hue;
|
|
a.value.sat = m.sat;
|
|
a.value.lum = m.lum;
|
|
a.domElement.style.backgroundColor = "rgb(" + [m.red, m.green, m.blue].join(", ") + ")";
|
|
this.setActiveNext();
|
|
if ((n != false) && (typeof(this.onSave) == "function")) {
|
|
this.onSave(m)
|
|
}
|
|
};
|
|
this.clean = function() {
|
|
var m = this.controllers.length,
|
|
o;
|
|
for (var n = 0; n < m; n++) {
|
|
o = this.controllers[n];
|
|
o.value = dhx4._copyObj(h);
|
|
o.domElement.style.backgroundColor = "rgb(" + [h.red, h.green, h.blue].join(", ") + ")"
|
|
}
|
|
this.unSelect();
|
|
a = this.controllers[0]
|
|
};
|
|
this.getIndex = function(o) {
|
|
var n, m, q = -1;
|
|
m = this.controllers.length;
|
|
for (n = 0; n < m; n++) {
|
|
if (this.controllers[n] == o) {
|
|
q = n;
|
|
break
|
|
}
|
|
}
|
|
return q
|
|
};
|
|
this.remove = function() {
|
|
var n, m;
|
|
m = this.controllers.length;
|
|
for (n = 0; n < m; n++) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.controllers[n].domElement.removeEventListener("click", this.select, false)
|
|
} else {
|
|
this.controllers[n].domElement.detachEvent("onclick", this.select)
|
|
}
|
|
delete this.controllers[n].domElement.dhxpc_memory
|
|
}
|
|
delete this.onSelect;
|
|
delete this.controllers;
|
|
delete this.onSave
|
|
}
|
|
};
|
|
if (window.dhx4.isIE6) {
|
|
dhtmlXColorPicker.prototype._cpInitFRM = function() {
|
|
var a;
|
|
if (!this._controllerNodes.fr_cover) {
|
|
a = document.createElement("IFRAME");
|
|
a.className = "dhxcp_frm";
|
|
a.border = 0;
|
|
a.frameBorder = 0;
|
|
this._controllerNodes.fr_cover = a
|
|
}
|
|
if (!this.base._dhx_remove) {
|
|
this.base.insertBefore(a, this._globalNode)
|
|
}
|
|
}
|
|
}
|
|
|
|
function dhtmlXSlider(g) {
|
|
var c = this;
|
|
this.conf = {
|
|
size: null,
|
|
skin: null,
|
|
vertical: false,
|
|
min: 0,
|
|
max: 99,
|
|
value: 0,
|
|
step: 1,
|
|
margin: 2,
|
|
border: 1,
|
|
disabled: false,
|
|
tooltip: false,
|
|
visible: true,
|
|
linkTo: undefined
|
|
};
|
|
this._attachedNode = {};
|
|
this.base = null;
|
|
var a = null;
|
|
if (arguments.length > 1) {
|
|
return new dhtmlXSlider(this._renderArgumets(arguments))
|
|
} else {
|
|
if (typeof(g) == "string" || (typeof(g) == "object" && g.tagName)) {
|
|
return new dhtmlXSlider({
|
|
parent: g
|
|
})
|
|
}
|
|
} if (typeof(g.parent) == "string") {
|
|
this.base = document.getElementById(g.parent)
|
|
} else {
|
|
this.base = g.parent
|
|
}
|
|
this._mergeConfig(this._readAttFormNode(this.base));
|
|
this._mergeConfig(g);
|
|
if (this.conf.size == null || this.conf.size == undefined) {
|
|
if (this.conf.vertical) {
|
|
this.conf.size = this.base.offsetHeight
|
|
} else {
|
|
this.conf.size = this.base.offsetWidth
|
|
}
|
|
}
|
|
var h = this.conf.skin || window.dhx4.skin || (typeof(dhtmlx) !== "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxslider") || "dhx_skyblue";
|
|
this.setSkin(h);
|
|
this.base.innerHTML = "<div class='dhxsl_container'><div class='dhxsl_track'></div><div class='dhxsl_runner'></div></div>";
|
|
this._nodes = {
|
|
cont: this.base.firstChild,
|
|
track: this.base.firstChild.firstChild,
|
|
runner: this.base.firstChild.childNodes[1]
|
|
};
|
|
this._nodes.cont.onmousedown = this._nodes.track.onmousedown = this._nodes.cont.onselectstart = this._nodes.track.onselectstart = function(l) {
|
|
l = l || event;
|
|
if (typeof(l.preventDefault) == "function") {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
this.conf.value = this._normalize(this.conf.value);
|
|
this._setOrient(this.conf.vertical);
|
|
this.setSize(this.conf.size);
|
|
this._initMover = function(l) {
|
|
l = l || event;
|
|
a = {};
|
|
a.value = c.conf.value;
|
|
a.coord = (c.conf.vertical) ? l.clientY : l.clientX;
|
|
if (c.conf.disabled == false) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.addEventListener("mousemove", c._move, false);
|
|
window.addEventListener("mouseup", c._cleanMove, false)
|
|
} else {
|
|
document.body.attachEvent("onmousemove", c._move);
|
|
document.body.attachEvent("onmouseup", c._cleanMove)
|
|
}
|
|
}
|
|
c.callEvent("_onRunnerMouseDown", []);
|
|
return false
|
|
};
|
|
this._move = function(q) {
|
|
q = q || event;
|
|
var o = (c.conf.vertical) ? c._nodes.runner.offsetHeight : c._nodes.runner.offsetWidth;
|
|
var m = c.conf.max - c.conf.min;
|
|
var l = (c.conf.vertical) ? q.clientY : q.clientX;
|
|
var n = a.value + (l - a.coord) * m / (c.conf.size - o);
|
|
c.setValue(Math.round(n), true)
|
|
};
|
|
this._cleanMove = function(l) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("mousemove", c._move, false);
|
|
window.removeEventListener("mouseup", c._cleanMove, false)
|
|
} else {
|
|
document.body.detachEvent("onmousemove", c._move);
|
|
document.body.detachEvent("onmouseup", c._cleanMove)
|
|
}
|
|
a = null;
|
|
c.callEvent("onSlideEnd", [c.conf.value]);
|
|
c.callEvent("_onRunnerMouseUp", [])
|
|
};
|
|
this._doOnSetValue = function(q) {
|
|
if (a) {
|
|
return false
|
|
}
|
|
q = q || event;
|
|
var o = (c.conf.vertical) ? (q.offsetY || q.layerY) : (q.offsetX || q.layerX);
|
|
var n = (c.conf.vertical) ? c._nodes.runner.offoffsetHeightsetHe : c._nodes.runner.offsetWidth;
|
|
var l = c.conf.max - c.conf.min;
|
|
var m = o * l / (c.conf.size) + c.conf.min;
|
|
c.setValue(Math.round(m), true);
|
|
if (!a) {
|
|
c._initMover(q)
|
|
}
|
|
return false
|
|
};
|
|
this._doOnChangeInput = function(m) {
|
|
m = m || event;
|
|
var l = m.target || m.srcElement;
|
|
c.setValue(l.value)
|
|
};
|
|
this._doOnKeyDown = function(m) {
|
|
m = m || event;
|
|
var l = m.target || m.srcElement;
|
|
if (m.keyCode == 13) {
|
|
c.setValue(l.value)
|
|
}
|
|
};
|
|
this._attachEvents(this._nodes);
|
|
this.unload = function() {
|
|
dhx4._eventable(this, "clear");
|
|
this._detachNode();
|
|
this._detachEvents(this._nodes);
|
|
this.base.removeChild(this._nodes.cont);
|
|
this._nodes.cont.onmousedown = this._nodes.track.onmousedown = this._nodes.cont.onselectstart = this._nodes.track.onselectstart = null;
|
|
delete this._nodes.cont;
|
|
delete this._nodes.track;
|
|
delete this._nodes.max;
|
|
delete this._nodes.min;
|
|
delete this._nodes.runner;
|
|
if (/\s?dhtmlxslider_\S*/.test(this.base.className)) {
|
|
this.base.className = this.base.className.replace(/\s?dhtmlxslider_\S*/, "")
|
|
}
|
|
for (var l in this) {
|
|
this[l] = null
|
|
}
|
|
c = null
|
|
};
|
|
dhx4._eventable(this);
|
|
if (this.conf.disabled) {
|
|
this.disable()
|
|
}
|
|
if (this.conf.tooltip) {
|
|
this.enableTooltip()
|
|
}
|
|
if (!this.conf.visible) {
|
|
this.hide()
|
|
}
|
|
if (this.conf.linkTo) {
|
|
this.linkTo(this.conf.linkTo)
|
|
}
|
|
return this
|
|
}
|
|
dhtmlXSlider.prototype._setOrient = function(a) {
|
|
a = a || false;
|
|
if (/\s?dhxsl_cont_hr/i.test(this._nodes.cont.className)) {
|
|
this._nodes.cont.className = this._nodes.cont.className.replace(/\s?dhxsl_cont_hr/i, "")
|
|
}
|
|
if (/\s?dhxsl_cont_vr/i.test(this._nodes.cont.className)) {
|
|
this._nodes.cont.className = this._nodes.cont.className.replace(/\s?dhxsl_cont_vr/i, "")
|
|
}
|
|
if (a) {
|
|
this._nodes.cont.className += " dhxsl_cont_vr"
|
|
} else {
|
|
this._nodes.cont.className += " dhxsl_cont_hr"
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype._attachEvents = function(a) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.runner.addEventListener("mousedown", this._initMover, false);
|
|
a.cont.addEventListener("mousedown", this._doOnSetValue, false)
|
|
} else {
|
|
a.runner.attachEvent("onmousedown", this._initMover);
|
|
a.cont.attachEvent("onmousedown", this._doOnSetValue)
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype._detachEvents = function(a) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.runner.removeEventListener("mousedown", this._initMover, false);
|
|
a.cont.removeEventListener("mousedown", this._doOnSetValue, false)
|
|
} else {
|
|
a.runner.detachEvent("onmousedown", this._initMover);
|
|
a.cont.detachEvent("onmousedown", this._doOnSetValue)
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype._mergeConfig = function(c) {
|
|
for (var a in c) {
|
|
switch (a.toLowerCase()) {
|
|
case "size":
|
|
case "min":
|
|
case "max":
|
|
case "value":
|
|
case "step":
|
|
this.conf[a] = parseInt(c[a]);
|
|
break;
|
|
case "vertical":
|
|
case "tooltip":
|
|
case "disabled":
|
|
case "visible":
|
|
this.conf[a] = dhx4.s2b(c[a]);
|
|
break;
|
|
case "parent":
|
|
continue;
|
|
break;
|
|
default:
|
|
this.conf[a] = c[a]
|
|
}
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype._readAttFormNode = function(h) {
|
|
var n = h.attributes,
|
|
a = n.length,
|
|
g, m = {}, c;
|
|
for (g = 0; g < a; g++) {
|
|
c = n[g];
|
|
switch (c.name.toLowerCase()) {
|
|
case "size":
|
|
case "min":
|
|
case "max":
|
|
case "value":
|
|
case "step":
|
|
m[c.name] = parseInt(c.value);
|
|
break;
|
|
case "skin":
|
|
m.skin = c.value;
|
|
break;
|
|
case "vertical":
|
|
case "disabled":
|
|
case "visible":
|
|
m[c.name] = dhx4.s2b(c.value);
|
|
break;
|
|
case "linkto":
|
|
m.linkTo = c.value;
|
|
break;
|
|
case "tooltip":
|
|
m.tooltip = dhx4.s2b(c.value);
|
|
break
|
|
}
|
|
}
|
|
return m
|
|
};
|
|
dhtmlXSlider.prototype._renderArgumets = function(a) {
|
|
var h = {}, g, c;
|
|
c = a.length;
|
|
for (g = 0; g < c; g++) {
|
|
switch (g) {
|
|
case 0:
|
|
h.parent = a[g];
|
|
break;
|
|
case 1:
|
|
h.size = a[g];
|
|
break;
|
|
case 2:
|
|
h.skin = a[g];
|
|
break;
|
|
case 3:
|
|
h.vertical = a[g];
|
|
break;
|
|
case 4:
|
|
h.min = a[g];
|
|
break;
|
|
case 5:
|
|
h.max = a[g];
|
|
break;
|
|
case 6:
|
|
h.value = a[g];
|
|
break;
|
|
case 7:
|
|
h.step = a[g];
|
|
break
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXSlider.prototype._skinCollection = {
|
|
dhx_skyblue: true,
|
|
dhx_web: true,
|
|
dhx_terrace: true
|
|
};
|
|
dhtmlXSlider.prototype._indexOf = function(a, h) {
|
|
var g, c, m = -1;
|
|
c = a.length;
|
|
for (g = c; g >= 0; g--) {
|
|
if (a[g] == h) {
|
|
m = g;
|
|
break
|
|
}
|
|
}
|
|
return m
|
|
};
|
|
dhtmlXSlider.prototype._refreshRunner = function() {
|
|
var a, c;
|
|
if (this.conf.vertical) {
|
|
a = this._nodes.cont.offsetHeight - this._nodes.runner.offsetHeight;
|
|
c = this._getCoord(a);
|
|
this._nodes.runner.style.top = c + this.conf.border + "px";
|
|
this._nodes.runner.style.left = Math.round((this._nodes.cont.offsetWidth - this._nodes.runner.offsetWidth) / 2) + "px"
|
|
} else {
|
|
a = this._nodes.cont.offsetWidth - this._nodes.runner.offsetWidth;
|
|
c = this._getCoord(a);
|
|
this._nodes.runner.style.left = c + this.conf.border + "px";
|
|
this._nodes.runner.style.top = Math.round((this._nodes.cont.offsetHeight - this._nodes.runner.offsetHeight) / 2) + "px"
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype._setValueByCoord = function(h) {
|
|
var a = dhx4.absLeft(this._nodes.cont),
|
|
l = dhx4.absTop(this._nodes.cont),
|
|
g, c;
|
|
if (this.conf.vertical) {
|
|
c = (h.y - l - this._nodes.runner.offsetHeight / 2) / (this._nodes.cont.offsetHeight - this._nodes.runner.offsetHeight)
|
|
} else {
|
|
c = (h.x - a - this._nodes.runner.offsetWidth / 2) / (this._nodes.cont.offsetWidth - this._nodes.runner.offsetWidth)
|
|
}
|
|
g = Math.round((this.conf.max - this.conf.min) * c + this.conf.min);
|
|
this.setValue(g, true)
|
|
};
|
|
dhtmlXSlider.prototype._getCoord = function(a) {
|
|
var g = this.conf;
|
|
var c = (g.value - g.min) / (g.max - g.min);
|
|
return Math.round(a * c)
|
|
};
|
|
dhtmlXSlider.prototype._normalize = function(a) {
|
|
a = parseInt(a);
|
|
return Math.round(a / this.conf.step) * this.conf.step
|
|
};
|
|
dhtmlXSlider.prototype._attachNode = function(c) {
|
|
var a = c.tagName.toLowerCase();
|
|
if (!a) {
|
|
return
|
|
}
|
|
this._attachedNode.node = c;
|
|
switch (a) {
|
|
case "input":
|
|
if (typeof(window.addEventListener) == "function") {
|
|
c.addEventListener("change", this._doOnChangeInput, false);
|
|
c.addEventListener("keydown", this._doOnKeyDown, false)
|
|
} else {
|
|
c.attachEvent("onchange", this._doOnChangeInput);
|
|
c.attachEvent("onkeydown", this._doOnKeyDown)
|
|
}
|
|
this._attachedNode.setValue = function(g) {
|
|
c.value = g
|
|
};
|
|
break;
|
|
default:
|
|
this._attachedNode.setValue = function(g) {
|
|
c.innerHTML = g
|
|
}
|
|
}
|
|
this._attachedNode.setValue(this.conf.value)
|
|
};
|
|
dhtmlXSlider.prototype._detachNode = function() {
|
|
var c = this._attachedNode.node;
|
|
if (!c) {
|
|
return
|
|
}
|
|
var a = c.tagName;
|
|
switch (a) {
|
|
case "input":
|
|
if (typeof(window.addEventListener) == "function") {
|
|
c.removeEventListener("change", this._doOnChangeInput, false);
|
|
c.removeEventListener("keydown", this._doOnChangeInput, false)
|
|
} else {
|
|
c.detachEvent("change", this._doOnChangeInput);
|
|
c.detachEvent("keydown", this._doOnChangeInput)
|
|
}
|
|
break
|
|
}
|
|
delete this._attachedNode.node;
|
|
delete this._attachedNode.setValue
|
|
};
|
|
dhtmlXSlider.prototype.setSize = function(a) {
|
|
a = parseInt(a);
|
|
if (!isNaN(a)) {
|
|
if (this.conf.vertical) {
|
|
if (this._nodes.cont.style.width) {
|
|
delete this._nodes.cont.style.width
|
|
}
|
|
this._nodes.cont.style.height = a - this.conf.margin + "px"
|
|
} else {
|
|
if (this._nodes.cont.style.height) {
|
|
delete this._nodes.cont.style.height
|
|
}
|
|
this._nodes.cont.style.width = a - this.conf.margin + "px"
|
|
}
|
|
this._refreshRunner()
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype.setSkin = function(l) {
|
|
l = l.toLowerCase();
|
|
var g, c = -1,
|
|
a, h = "dhtmlxslider";
|
|
g = this.base.className.match(/\S\w+/ig);
|
|
if (g instanceof Array) {
|
|
for (a in this._skinCollection) {
|
|
if (c == -1) {
|
|
c = this._indexOf(g, h + "_" + a)
|
|
} else {
|
|
break
|
|
}
|
|
}
|
|
c = (c == -1) ? g.length : c
|
|
} else {
|
|
g = [];
|
|
c = 0
|
|
}
|
|
g[c] = h + "_" + l;
|
|
this.base.className = g.join(" ");
|
|
this.conf.skin = l;
|
|
if (this._nodes) {
|
|
this._refreshRunner()
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype.setValue = function(a, c) {
|
|
a = parseInt(a);
|
|
c = c || false;
|
|
if (!isNaN(a)) {
|
|
a = this._normalize(a);
|
|
a = Math.max(this.conf.min, a);
|
|
a = Math.min(this.conf.max, a);
|
|
if (this.conf.value !== a) {
|
|
this.conf.value = a;
|
|
this._refreshRunner();
|
|
if (this.conf.tooltip) {
|
|
this._nodes.cont.title = this.conf.value
|
|
}
|
|
if (c) {
|
|
this.callEvent("onChange", [this.conf.value, this])
|
|
}
|
|
}
|
|
}
|
|
if (typeof(this._attachedNode.setValue) == "function") {
|
|
this._attachedNode.setValue(this.conf.value)
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype.getValue = function() {
|
|
return this.conf.value
|
|
};
|
|
dhtmlXSlider.prototype.disable = function(g) {
|
|
g = (g == false) ? false : true;
|
|
var c = null;
|
|
if (g) {
|
|
for (var a in this._nodes) {
|
|
if (a == "cont") {
|
|
continue
|
|
}
|
|
c = new RegExp("\\s?dhxsl_" + a + "_dis", "i");
|
|
if (!c.test(this._nodes[a].className)) {
|
|
this._nodes[a].className += " dhxsl_" + a + "_dis"
|
|
}
|
|
}
|
|
this.conf.disabled = true
|
|
} else {
|
|
this.enable()
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype.enable = function() {
|
|
var c;
|
|
for (var a in this._nodes) {
|
|
if (a == "cont") {
|
|
continue
|
|
}
|
|
c = new RegExp("\\s?dhxsl_" + a + "_dis", "i");
|
|
if (c.test(this._nodes[a].className)) {
|
|
this._nodes[a].className = this._nodes[a].className.replace(c, "")
|
|
}
|
|
}
|
|
this.conf.disabled = false
|
|
};
|
|
dhtmlXSlider.prototype.isEnabled = function() {
|
|
return !this.conf.disabled
|
|
};
|
|
dhtmlXSlider.prototype.disableTooltip = function() {
|
|
this._nodes.cont.removeAttribute("title");
|
|
this.conf.tooltip = false
|
|
};
|
|
dhtmlXSlider.prototype.enableTooltip = function(a) {
|
|
if (typeof(a) == "undefined") {
|
|
a = true
|
|
} else {
|
|
a = dhx4.s2b(a)
|
|
} if (a) {
|
|
this._nodes.cont.title = this.conf.value;
|
|
this.conf.tooltip = true
|
|
} else {
|
|
this.disableTooltip()
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype.setMax = function(a) {
|
|
a = parseInt(a);
|
|
if (!isNaN(a) && this.conf.min < a) {
|
|
this.conf.max = a;
|
|
this.setValue(this.conf.value)
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype.getMax = function() {
|
|
return this.conf.max
|
|
};
|
|
dhtmlXSlider.prototype.setMin = function(a) {
|
|
a = parseInt(a);
|
|
if (!isNaN(a) && this.conf.max > a) {
|
|
this.conf.min = a;
|
|
this.setValue(this.conf.value)
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype.getMin = function() {
|
|
return this.conf.min
|
|
};
|
|
dhtmlXSlider.prototype.setStep = function(a) {
|
|
a = parseInt(a);
|
|
var c = this.conf.max - this.conf.min;
|
|
if (!isNaN(a) && a < c) {
|
|
this.conf.step = a;
|
|
this.setValue(this.conf.value)
|
|
}
|
|
};
|
|
dhtmlXSlider.prototype.getStep = function() {
|
|
return this.conf.step
|
|
};
|
|
dhtmlXSlider.prototype.show = function() {
|
|
if (/\s?dhxsl_hidden/i.test(this._nodes.cont.className)) {
|
|
this._nodes.cont.className = this._nodes.cont.className.replace(/\s?dhxsl_hidden/i, "")
|
|
}
|
|
this.conf.visible = true
|
|
};
|
|
dhtmlXSlider.prototype.hide = function() {
|
|
if (!/\s?dhxsl_hidden/i.test(this._nodes.cont.className)) {
|
|
this._nodes.cont.className += " dhxsl_hidden"
|
|
}
|
|
this.conf.visible = false
|
|
};
|
|
dhtmlXSlider.prototype.isVisible = function() {
|
|
return this.conf.visible
|
|
};
|
|
dhtmlXSlider.prototype.linkTo = function(a) {
|
|
if (typeof(a) == "string") {
|
|
a = document.getElementById(a)
|
|
}
|
|
if (this._attachedNode.node) {
|
|
this._detachNode()
|
|
}
|
|
this._attachNode(a)
|
|
};
|
|
|
|
function dhtmlXPopup(g) {
|
|
var h = this;
|
|
this.conf = g || {};
|
|
g = null;
|
|
this.mode = (this.conf.mode || "bottom");
|
|
this.conf.zi = window.dhx4.newId();
|
|
this.conf.isIE = (navigator.userAgent.indexOf("MSIE") >= 0);
|
|
this.p = document.createElement("DIV");
|
|
this.p.style.display = "none";
|
|
this.p.innerHTML = "<div class='dhx_popup_area" + (this.conf.isIE ? " dhx_popup_area_ie" : "") + "'><table cellspacing='0' cellpadding='0' border='0' class='dhx_popup_table'><tbody></tbody></table></div><div class='dhx_popup_arrow dhx_popup_arrow_" + this.mode + "'></div>";
|
|
document.body.appendChild(this.p);
|
|
this.skinParams = {
|
|
dhx_terrace: {
|
|
t0: 19,
|
|
t1: 9,
|
|
t2: 19,
|
|
t3: 9
|
|
},
|
|
dhx_skyblue: {
|
|
t0: 12,
|
|
t1: 9,
|
|
t2: 12,
|
|
t3: 9
|
|
},
|
|
dhx_web: {
|
|
t0: 12,
|
|
t1: 9,
|
|
t2: 12,
|
|
t3: 9
|
|
}
|
|
};
|
|
this.p.onclick = function(l) {
|
|
l = l || event;
|
|
h._clearClick = true;
|
|
if (h._nodeObj != null) {
|
|
h.callEvent("onContentClick", []);
|
|
return true
|
|
}
|
|
var a = (l.target || l.srcElement);
|
|
var m = null;
|
|
while (a != h.p && a != null) {
|
|
if (typeof(a._idd) != "undefined" && !a._isSeparator) {
|
|
m = a._idd;
|
|
a = null
|
|
} else {
|
|
a = a.parentNode
|
|
}
|
|
}
|
|
a = null;
|
|
if (m != null) {
|
|
h.callEvent("onClick", [m]);
|
|
if (h != null && h.isVisible != null && h.isVisible() && h.callEvent("onBeforeHide", ["select", l, m]) === true) {
|
|
l.cancelBubble = true;
|
|
h.hide()
|
|
}
|
|
}
|
|
};
|
|
this.separator = "DHXSEP_" + window.dhx4.newId();
|
|
this.tpl = [];
|
|
this._setTemplate = function(a) {
|
|
this.tpl = a.split(",")
|
|
};
|
|
this.show = function(l) {
|
|
var a = null;
|
|
if (arguments.length == 1) {
|
|
if (!l) {
|
|
l = this.conf.id[0]
|
|
} else {
|
|
if (!this._idExists(l)) {
|
|
return
|
|
}
|
|
} if (this.conf.toolbar) {
|
|
a = this.conf.toolbar._getItemDim(l)
|
|
}
|
|
if (this.conf.ribbon) {
|
|
a = this.conf.ribbon._getItemDim(l)
|
|
}
|
|
if (this.conf.form) {
|
|
a = this.conf.form._getItemDim(l)
|
|
}
|
|
} else {
|
|
if (arguments.length == 4) {
|
|
this._clearClick = true;
|
|
a = {
|
|
left: arguments[0],
|
|
top: arguments[1],
|
|
width: arguments[2],
|
|
height: arguments[3]
|
|
};
|
|
l = null
|
|
}
|
|
} if (!a) {
|
|
return
|
|
}
|
|
this.p.style.visibility = "hidden";
|
|
this.p.style.display = "";
|
|
this._setPos(a);
|
|
this.p.style.zIndex = window.dhx4.zim.reserve(this.conf.zi);
|
|
this.p.style.visibility = "visible";
|
|
this._lastId = l;
|
|
this.callEvent("onShow", [l])
|
|
};
|
|
this._setPos = function(I, n) {
|
|
var v = I.left;
|
|
var s = I.top;
|
|
var C = I.width;
|
|
var L = I.height;
|
|
this._posData = {
|
|
left: v,
|
|
top: s,
|
|
width: C,
|
|
height: L
|
|
};
|
|
var N = window.dhx4.screenDim();
|
|
var F = n || this.mode;
|
|
if (typeof(n) == "undefined") {
|
|
n = false
|
|
}
|
|
var P = {
|
|
top: (s - this.p.offsetHeight) - N.top,
|
|
bottom: N.bottom - (s + L + this.p.offsetHeight),
|
|
left: v - this.p.offsetWidth - N.left,
|
|
right: N.right - (v + C + this.p.offsetWidth)
|
|
};
|
|
if (!n && P[F] < 0) {
|
|
var J = this._getAvailPos(F, P);
|
|
if (J !== false) {
|
|
this._setPos(I, J);
|
|
return
|
|
}
|
|
}
|
|
if (F == "top" || F == "bottom") {
|
|
var D = this.skinParams[this.conf.skin].t2;
|
|
var A = this.skinParams[this.conf.skin].t3;
|
|
var r = Math.round(this.p.offsetWidth / 2);
|
|
var a = Math.round(this.p.lastChild.offsetWidth / 2);
|
|
if (v < N.left) {
|
|
var M = Math.min(v + C, N.left);
|
|
C = v + C - M;
|
|
v = M
|
|
}
|
|
if (v + C > N.right) {
|
|
C = N.right - v
|
|
}
|
|
var u = Math.round(v + C / 2);
|
|
var m = u - r;
|
|
var K = u - D - a;
|
|
var q = u + a + D - this.p.offsetWidth;
|
|
if (m < N.left - A) {
|
|
m = Math.min(N.left - A, K)
|
|
} else {
|
|
if (m + this.p.offsetWidth > N.right + A) {
|
|
m = Math.max(q, N.right + A - this.p.offsetWidth)
|
|
}
|
|
}
|
|
this.p.style.left = m + "px";
|
|
this.p.style.top = (F == "top" ? s - this.p.offsetHeight : s + L) + "px";
|
|
u = u - m - a;
|
|
this.p.lastChild.className = "dhx_popup_arrow dhx_popup_arrow_" + F;
|
|
this.p.lastChild.style.top = (F == "top" ? this.p.offsetHeight - this.p.lastChild.offsetHeight : 0) + "px";
|
|
this.p.lastChild.style.left = u + "px"
|
|
}
|
|
if (F == "left" || F == "right") {
|
|
var D = this.skinParams[this.conf.skin].t0;
|
|
var A = this.skinParams[this.conf.skin].t1;
|
|
var o = Math.round(this.p.offsetHeight / 2);
|
|
var S = Math.round(this.p.lastChild.offsetHeight / 2);
|
|
if (s < N.top) {
|
|
var l = Math.min(s + L, N.top);
|
|
L = s + L - l;
|
|
s = l
|
|
}
|
|
if (s + L > N.bottom) {
|
|
L = N.bottom - s
|
|
}
|
|
var u = Math.round(s + L / 2);
|
|
var H = u - o;
|
|
var Q = u - D - S;
|
|
var O = u + S + D - this.p.offsetHeight;
|
|
if (H < N.top - A) {
|
|
H = Math.min(N.top - A, Q)
|
|
} else {
|
|
if (H + this.p.offsetHeight > N.bottom + A) {
|
|
H = Math.max(O, N.bottom + A - this.p.offsetHeight)
|
|
}
|
|
}
|
|
this.p.style.left = (F == "left" ? v - this.p.offsetWidth : v + C) + "px";
|
|
this.p.style.top = H + "px";
|
|
u = u - H - S;
|
|
this.p.lastChild.className = "dhx_popup_arrow dhx_popup_arrow_" + F;
|
|
this.p.lastChild.style.left = (F == "left" ? this.p.offsetWidth - this.p.lastChild.offsetWidth : 0) + "px";
|
|
this.p.lastChild.style.top = u + "px"
|
|
}
|
|
if (this._IEDisp && this._nodeId != null) {
|
|
var E = document.getElementById(this._nodeId);
|
|
window.setTimeout(function() {
|
|
E.style.visibility = "visible";
|
|
E = null
|
|
}, 1)
|
|
}
|
|
};
|
|
this._getAvailPos = function(s, r) {
|
|
var m = {
|
|
top: ["bottom", "right", "left"],
|
|
bottom: ["top", "right", "left"],
|
|
left: ["right", "bottom", "top"],
|
|
right: ["left", "bottom", "top"]
|
|
};
|
|
var n = null;
|
|
for (var o = 0; o < m[s].length; o++) {
|
|
if (n == null && r[m[s][o]] > 0) {
|
|
n = m[s][o]
|
|
}
|
|
}
|
|
if (n == null) {
|
|
n = "bottom";
|
|
for (var l in r) {
|
|
if (r[l] > r[n]) {
|
|
n = l
|
|
}
|
|
}
|
|
}
|
|
if (n == s) {
|
|
return false
|
|
}
|
|
return n
|
|
};
|
|
this._repaint = function() {
|
|
if (this.isVisible()) {
|
|
this._setPos(this._posData)
|
|
}
|
|
};
|
|
this.clear = function() {
|
|
if (this._nodeObj) {
|
|
if (this.conf.isIE && typeof(dhtmlXLayoutObject) != "undefined" && this._nodeObj instanceof dhtmlXLayoutObject) {
|
|
this.p.onmousedown = null
|
|
}
|
|
if (this._nodeObj.unload) {
|
|
this._nodeObj.unload()
|
|
} else {
|
|
if (this._nodeObj.destruct) {
|
|
this._nodeObj.destruct()
|
|
}
|
|
}
|
|
this._nodeObj = this._nodeId = null;
|
|
if (this._nodeObjEv != null) {
|
|
for (var l = 0; l < this._nodeObjEv.length; l++) {
|
|
this.detachEvent(this._nodeObjEv[l])
|
|
}
|
|
this._nodeObjEv = null
|
|
}
|
|
}
|
|
if (this._IEHoverInited) {
|
|
this._IEHoverClear()
|
|
}
|
|
var a = this.p.firstChild.firstChild.firstChild;
|
|
while (a.childNodes.length > 0) {
|
|
a.removeChild(a.lastChild)
|
|
}
|
|
a = null;
|
|
this.itemData = {}
|
|
};
|
|
this.hide = function() {
|
|
if (this.p.style.display != "none") {
|
|
this.p.style.display = "none";
|
|
window.dhx4.zim.clear(this.conf.zi);
|
|
var a = this._lastId;
|
|
this._lastId = null;
|
|
this.callEvent("onHide", [a])
|
|
}
|
|
};
|
|
this.isVisible = function() {
|
|
return (this.p.style.display == "")
|
|
};
|
|
this.itemData = {};
|
|
this.getItemData = function(a) {
|
|
if (!a) {
|
|
return this.itemData
|
|
}
|
|
if (this.itemData[a]) {
|
|
return this.itemData[a]
|
|
}
|
|
return {}
|
|
};
|
|
this.setSkin = function(a) {
|
|
this.conf.skin = a;
|
|
this.p.className = "dhx_popup_" + this.conf.skin;
|
|
if (this._nodeObj != null && typeof(this._nodeObj.setSkin) == "function") {
|
|
this._nodeObj.setSkin(this.conf.skin)
|
|
}
|
|
this._repaint()
|
|
};
|
|
this.attachList = function(m, u) {
|
|
this._setTemplate(m);
|
|
this.clear();
|
|
var n = this.p.firstChild.firstChild.firstChild;
|
|
for (var s = 0; s < u.length; s++) {
|
|
var o = document.createElement("TR");
|
|
if (u[s] != this.separator) {
|
|
if (typeof(u[s].id) == "undefined" || u[s].id == null) {
|
|
o._idd = window.dhx4.newId();
|
|
while (this.itemData[o._idd] != null) {
|
|
o._idd = window.dhx4.newId()
|
|
}
|
|
} else {
|
|
o._idd = u[s].id
|
|
}
|
|
this.itemData[o._idd] = u[s]
|
|
}
|
|
n.appendChild(o);
|
|
if (u[s] == this.separator) {
|
|
o.className = "dhx_popup_sep";
|
|
o._isSeparator = true;
|
|
var v = document.createElement("TD");
|
|
v.className = "dhx_popup_sep";
|
|
v.colSpan = this.tpl.length;
|
|
v.innerHTML = "<div class='dhx_popup_sep'> </div>";
|
|
o.appendChild(v);
|
|
v = null
|
|
} else {
|
|
for (var a = 0; a < this.tpl.length; a++) {
|
|
var l = "dhx_popup_td";
|
|
if (this._IEFirstLast && (this.tpl.length == 1 || a == 0 || a == this.tpl.length - 1)) {
|
|
if (this.tpl.length == 1) {
|
|
l += " dhx_popup_td_single"
|
|
} else {
|
|
l += (a == 0 ? " dhx_popup_td_first" : " dhx_popup_td_last")
|
|
}
|
|
}
|
|
var v = document.createElement("TD");
|
|
v.className = l;
|
|
v.innerHTML = u[s][this.tpl[a]] || " ";
|
|
o.appendChild(v);
|
|
v = null
|
|
}
|
|
if (this._IEHover) {
|
|
o._IEHover = true;
|
|
if (!this._IEHoverInited) {
|
|
this._IEHoverInit()
|
|
}
|
|
}
|
|
}
|
|
o = null
|
|
}
|
|
n = null;
|
|
this._repaint()
|
|
};
|
|
this._attachNode = function(n, m) {
|
|
this.clear();
|
|
this._nodeId = "dhxpopup_node_" + window.dhx4.newId();
|
|
var a = this.p.firstChild.firstChild.firstChild;
|
|
var l = document.createElement("TR");
|
|
l.className = "dhxnode";
|
|
a.appendChild(l);
|
|
var o = document.createElement("TD");
|
|
o.className = "dhx_popup_td";
|
|
o.innerHTML = "<div id='" + this._nodeId + "' style='position:relative;'></div>";
|
|
if (m.width) {
|
|
o.firstChild.style.width = m.width + "px"
|
|
}
|
|
if (m.height) {
|
|
o.firstChild.style.height = m.height + "px"
|
|
}
|
|
l.appendChild(o);
|
|
o = l = a = null;
|
|
if (typeof(this["_attach_init_" + n]) == "function") {
|
|
this["_attach_init_" + n](m);
|
|
this._enableIEVFix()
|
|
}
|
|
this._repaint();
|
|
return this._nodeObj
|
|
};
|
|
this.unload = function() {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("click", this._doOnClick, false);
|
|
window.removeEventListener("keyup", this._doOnKeyUp, false);
|
|
window.removeEventListener("unload", this._doOnUnload, false)
|
|
} else {
|
|
document.body.detachEvent("onclick", this._doOnClick, false);
|
|
document.body.detachEvent("onkeyup", this._doOnKeyUp, false);
|
|
document.body.detachEvent("onunload", this._doOnUnload, false)
|
|
}
|
|
this.clear();
|
|
this._doOnClick = null;
|
|
this._doOnUnload = null;
|
|
this._doOnKeyUp = null;
|
|
if (this.conf.toolbarEvent != null && this.conf.toolbar != null) {
|
|
if (this.conf.toolbar.detachEvent != null) {
|
|
this.conf.toolbar.detachEvent(this.conf.toolbarEvent)
|
|
} else {
|
|
this.conf.toolbar._getItemDim = null
|
|
}
|
|
}
|
|
if (this.conf.ribbonEvent != null && this.conf.ribbon != null) {
|
|
if (this.conf.ribbon.detachEvent != null) {
|
|
this.conf.ribbon.detachEvent(this.conf.ribbonEvent)
|
|
} else {
|
|
this.conf.ribbon._getItemDim = null
|
|
}
|
|
}
|
|
if (this.conf.slider) {
|
|
for (var a = 0; a < this.conf.slider_events.length; a++) {
|
|
this.conf.slider.detachEvent(this.conf.slider_events[a])
|
|
}
|
|
this.conf.slider_events = null;
|
|
this._sliderShow = this._sliderHide = null;
|
|
this.conf.slider = null
|
|
}
|
|
window.dhx4._eventable(this, "clear");
|
|
this.attachList = this.attachAccordion = this.attachCalendar = this.attachForm = this.attachGrid = this.attachLayout = this.attachTabbar = this.attachTree = this.attachHTML = this.attachObject = this._attachNode = null;
|
|
this.show = this.hide = this.isVisible = this._setTemplate = this._repaint = this._setPos = this.getItemData = this.clear = this._idExists = this._doOnToolbarClick = this._doOnRibbonClick = this.setSkin = null;
|
|
this.tpl = this.itemData = this.separator = this.mode = null;
|
|
this._clearClick = this._lastId = this._posData = this.skinParams = this.skinParent = null;
|
|
this.p.onclick = null;
|
|
this.p.parentNode.removeChild(this.p);
|
|
this.p = null;
|
|
this.conf.toolbar = this.conf.toolbarEvent = this.conf.ribbon = this.conf.ribbonEvent = this.conf.form = this.conf.id = null;
|
|
this.conf = null;
|
|
this._IEHover = this._IEHoverTM = this._IEHoverInit = this._IEHoverClear = this._IEHoverRender = this._IEHoverInited = null;
|
|
this._IEDisp = null;
|
|
this.unload = null;
|
|
h = null
|
|
};
|
|
window.dhx4._eventable(this);
|
|
this._doOnClick = function(o) {
|
|
o = o || event;
|
|
if (h._clearClick) {
|
|
h._clearClick = false;
|
|
return
|
|
}
|
|
if (h.conf.form != null) {
|
|
var q;
|
|
var l = (o.target || o.srcElement);
|
|
if ((l.tagName || "").toLowerCase() == "option") {
|
|
l = l.parentNode
|
|
}
|
|
if (l.className != null && l.className.search("dhxform") >= 0) {
|
|
if (l.parentNode != null && l.parentNode.parentNode != null && l.parentNode.parentNode._idd != null) {
|
|
q = l.parentNode.parentNode._idd;
|
|
if (l.parentNode.parentNode._type == "ra") {
|
|
q = [l.parentNode.parentNode._group, l.parentNode.parentNode._value]
|
|
}
|
|
}
|
|
} else {
|
|
var a = true;
|
|
var m = false;
|
|
while (a && !m) {
|
|
var n = (l.className || "").toLowerCase();
|
|
if (n.length > 0) {
|
|
m = (n == "dhxform_btn" || n.search(/dhxeditor_inside/gi) >= 0 || n == "dhxcombo_input" || n.search(/dhxcombolist/gi) >= 0)
|
|
}
|
|
l = l.parentNode;
|
|
a = (l != null)
|
|
}
|
|
if (m) {
|
|
return
|
|
}
|
|
}
|
|
l = null;
|
|
if (q != null && h._idExists(q)) {
|
|
return
|
|
}
|
|
}
|
|
if (h.isVisible() && h.callEvent("onBeforeHide", ["click", o]) === true) {
|
|
h.hide()
|
|
}
|
|
};
|
|
this._doOnKeyUp = function(a) {
|
|
a = a || event;
|
|
if (a.keyCode == 27) {
|
|
if (h.isVisible() && h.callEvent("onBeforeHide", ["esc", a]) === true) {
|
|
h.hide()
|
|
}
|
|
}
|
|
};
|
|
this._doOnUnload = function() {
|
|
h.unload()
|
|
};
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.addEventListener("click", this._doOnClick, false);
|
|
window.addEventListener("keyup", this._doOnKeyUp, false);
|
|
window.addEventListener("unload", this._doOnUnload, false)
|
|
} else {
|
|
document.body.attachEvent("onclick", this._doOnClick, false);
|
|
document.body.attachEvent("onkeyup", this._doOnKeyUp, false);
|
|
document.body.attachEvent("onunload", this._doOnUnload, false)
|
|
}
|
|
this._idExists = function(m) {
|
|
var a = false;
|
|
for (var l = 0; l < this.conf.id.length; l++) {
|
|
if (this.conf.id[l] instanceof Array) {
|
|
a = a || (this.conf.id[l][0] == m[0] && this.conf.id[l][1] == m[1])
|
|
} else {
|
|
a = a || this.conf.id[l] == m
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
this._IEDisp = (this.conf.isIE && (navigator.userAgent.search("MSIE 6.0") >= 0 || document.compatMode != "CSS1Compat"));
|
|
this._IEHover = (this.conf.isIE && navigator.userAgent.search("MSIE 6.0") >= 0);
|
|
if (this._IEHover) {
|
|
this._IEHoverInit = function() {
|
|
this.p.onmouseover = function() {
|
|
var a = event.srcElement;
|
|
while (a != this && a._IEHover != true) {
|
|
a = a.parentNode
|
|
}
|
|
if (a._IEHover) {
|
|
if (h._IEHoverTM) {
|
|
window.clearTimeout(h._IEHoverTM)
|
|
}
|
|
if (h._lastIEHover == a) {
|
|
return
|
|
}
|
|
h._IEHoverRender(a);
|
|
a = null
|
|
}
|
|
};
|
|
this.p.onmouseout = function() {
|
|
if (h._IEHoverTM) {
|
|
window.clearTimeout(h._IEHoverTM)
|
|
}
|
|
h._IEHoverTM = window.setTimeout(function() {
|
|
h._IEHoverRender(null)
|
|
}, 1)
|
|
};
|
|
this._IEHoverRender = function(a) {
|
|
if (this._lastIEHover != null) {
|
|
if (this._lastIEHover.className.search(/tr_hover/gi) >= 0) {
|
|
this._lastIEHover.className = this._lastIEHover.className.replace(/\s{0,}tr_hover/gi, "");
|
|
this._lastIEHover = null
|
|
}
|
|
}
|
|
if (a != null && a.className.search(/tr_hover/gi) < 0) {
|
|
a.className += " tr_hover";
|
|
h._lastIEHover = a
|
|
}
|
|
};
|
|
this._IEHoverInited = true
|
|
};
|
|
this._IEHoverClear = function() {
|
|
this.p.onmouseover = null;
|
|
this.p.onmouseout = null;
|
|
this._IEHoverInited = false
|
|
}
|
|
}
|
|
this._IEFirstLast = (this.conf.isIE && navigator.userAgent.search(/MSIE [6,7,8]\.0/i) >= 0);
|
|
this._enableIEVFix = function() {
|
|
if (this.conf.isIE && navigator.userAgent.search("MSIE 6.0") >= 0) {
|
|
var l = this.attachEvent("onHide", function() {
|
|
document.getElementById(this._nodeId).style.visibility = "hidden"
|
|
});
|
|
var a = this.attachEvent("onShow", function() {
|
|
document.getElementById(this._nodeId).style.visibility = "visible"
|
|
});
|
|
if (this._nodeObjEv == null) {
|
|
this._nodeObjEv = []
|
|
}
|
|
this._nodeObjEv.push(l, a)
|
|
}
|
|
};
|
|
if (typeof(window.dhtmlXToolbarObject) != "undefined" && this.conf.toolbar != null && this.conf.toolbar instanceof window.dhtmlXToolbarObject && this.conf.id != null) {
|
|
if (!(this.conf.id instanceof Array)) {
|
|
this.conf.id = [this.conf.id]
|
|
}
|
|
this.skinParent = this.conf.toolbar.conf.skin;
|
|
this._doOnToolbarClick = function(l) {
|
|
for (var a = 0; a < h.conf.id.length; a++) {
|
|
if (l == h.conf.id[a]) {
|
|
if (l != h._lastId) {
|
|
h.show(l);
|
|
h._clearClick = true
|
|
}
|
|
}
|
|
}
|
|
};
|
|
if (typeof(dhtmlXToolbarObject.prototype._getItemDim) == "undefined") {
|
|
dhtmlXToolbarObject.prototype._getItemDim = function(m) {
|
|
var a = this.objPull[this.idPrefix + m];
|
|
var l = {
|
|
left: window.dhx4.absLeft(a.obj),
|
|
top: window.dhx4.absTop(a.obj),
|
|
width: a.obj.offsetWidth + (a.arw ? a.arw.offsetWidth : 0),
|
|
height: a.obj.offsetHeight
|
|
};
|
|
a = null;
|
|
return l
|
|
}
|
|
}
|
|
this.conf.toolbarEvent = this.conf.toolbar.attachEvent("onClick", this._doOnToolbarClick)
|
|
}
|
|
if (typeof(window.dhtmlXRibbon) != "undefined" && this.conf.ribbon != null && this.conf.ribbon instanceof window.dhtmlXRibbon && this.conf.id != null) {
|
|
if (!(this.conf.id instanceof Array)) {
|
|
this.conf.id = [this.conf.id]
|
|
}
|
|
this.skinParent = this.conf.ribbon.conf.skin;
|
|
this._doOnRibbonClick = function(l) {
|
|
for (var a = 0; a < h.conf.id.length; a++) {
|
|
if (l == h.conf.id[a]) {
|
|
if (l != h._lastId) {
|
|
h.show(l);
|
|
h._clearClick = true
|
|
}
|
|
}
|
|
}
|
|
};
|
|
if (typeof(dhtmlXRibbon.prototype._getItemDim) == "undefined") {
|
|
dhtmlXRibbon.prototype._getItemDim = function(m) {
|
|
var a = this._items[m].base;
|
|
var l = {
|
|
left: window.dhx4.absLeft(a),
|
|
top: window.dhx4.absTop(a),
|
|
width: a.offsetWidth,
|
|
height: a.offsetHeight
|
|
};
|
|
a = null;
|
|
return l
|
|
}
|
|
}
|
|
this.conf.ribbonEvent = this.conf.ribbon.attachEvent("_showPopup", this._doOnRibbonClick)
|
|
}
|
|
if (typeof(window.dhtmlXForm) != "undefined" && this.conf.form != null && this.conf.form instanceof window.dhtmlXForm && this.conf.id != null) {
|
|
if (!(this.conf.id instanceof Array)) {
|
|
this.conf.id = [this.conf.id]
|
|
}
|
|
if (!this.conf.mode) {
|
|
this.mode = "right"
|
|
}
|
|
this.skinParent = this.conf.form.skin;
|
|
if (typeof(dhtmlXForm.prototype._getItemDim) == "undefined") {
|
|
dhtmlXForm.prototype._getItemDim = function(a, l) {
|
|
return this.doWithItem(a, "_getDim")
|
|
};
|
|
for (var c in {
|
|
input: 1,
|
|
password: 1,
|
|
select: 1,
|
|
multiselect: 1,
|
|
checkbox: 1,
|
|
radio: 1,
|
|
button: 1,
|
|
combo: 1,
|
|
btn2state: 1,
|
|
calendar: 1,
|
|
colorpicker: 1,
|
|
editor: 1
|
|
}) {
|
|
if (dhtmlXForm.prototype.items[c] != null) {
|
|
dhtmlXForm.prototype.items[c]._getDim = function(l) {
|
|
var a = l;
|
|
if ({
|
|
ta: true,
|
|
pw: true,
|
|
se: true,
|
|
calendar: true,
|
|
colorpicker: 1,
|
|
editor: true
|
|
}[l._type]) {
|
|
a = l.childNodes[l._ll ? 1 : 0].childNodes[0]
|
|
}
|
|
if ({
|
|
ch: true,
|
|
ra: true,
|
|
btn2state: true
|
|
}[l._type]) {
|
|
a = l.childNodes[l._ll ? 1 : 0].childNodes[1]
|
|
}
|
|
if ({
|
|
bt: true
|
|
}[l._type]) {
|
|
a = l.firstChild
|
|
}
|
|
if ({
|
|
combo: true
|
|
}[l._type]) {
|
|
a = l._combo.DOMParent.firstChild
|
|
}
|
|
var m = {
|
|
left: window.dhx4.absLeft(a),
|
|
top: window.dhx4.absTop(a),
|
|
width: a.offsetWidth,
|
|
height: a.offsetHeight
|
|
};
|
|
a = null;
|
|
return m
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (typeof(window.dhtmlXSlider) != "undefined" && this.conf.slider != null && this.conf.slider instanceof window.dhtmlXSlider) {
|
|
if (!this.conf.mode) {
|
|
this.mode = "top"
|
|
}
|
|
this.conf.slider_tm = null;
|
|
this._sliderShow = function() {
|
|
if (h.conf.slider_tm) {
|
|
window.clearTimeout(h.conf.slider_tm)
|
|
}
|
|
var a = h.conf.slider._nodes.runner;
|
|
var l = {
|
|
left: window.dhx4.absLeft(a),
|
|
top: window.dhx4.absTop(a),
|
|
width: a.offsetWidth,
|
|
height: a.offsetHeight
|
|
};
|
|
h.show(l.left, l.top, l.width, l.height)
|
|
};
|
|
this._sliderHide = function() {
|
|
h.conf.slider_tm = window.setTimeout(function() {
|
|
h.hide()
|
|
}, 200)
|
|
};
|
|
this.conf.slider_events = [this.conf.slider.attachEvent("_onRunnerMouseDown", this._sliderShow), this.conf.slider.attachEvent("_onRunnerMouseUp", this._sliderHide), this.conf.slider.attachEvent("onChange", this._sliderShow)]
|
|
}
|
|
this.setSkin(this.skinParent || this.conf.skin || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhx_popup") || "dhx_skyblue");
|
|
return this
|
|
}
|
|
dhtmlXPopup.prototype.attachObject = function(a) {
|
|
return this._attachNode("object", {
|
|
obj: a
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_object = function(a) {
|
|
this._nodeObj = (typeof(a.obj) == "string" ? document.getElementById(a.obj) : a.obj);
|
|
a.obj = null;
|
|
document.getElementById(this._nodeId).appendChild(this._nodeObj);
|
|
this._nodeObj.style.display = "";
|
|
this._nodeObj.style.visibility = "visible"
|
|
};
|
|
dhtmlXPopup.prototype.attachHTML = function(a) {
|
|
return this._attachNode("html", {
|
|
html: a
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_html = function(a) {
|
|
document.getElementById(this._nodeId).innerHTML = a.html;
|
|
this._nodeObj = {
|
|
text: a.html
|
|
}
|
|
};
|
|
dhtmlXPopup.prototype.attachForm = function(a) {
|
|
return this._attachNode("form", {
|
|
struct: a
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_form = function(c) {
|
|
var a = this;
|
|
this._nodeObj = new dhtmlXForm(this._nodeId, c.struct);
|
|
this._nodeObj.setSkin(this.conf.skin);
|
|
this._nodeObj.attachEvent("_onBeforeEditorAccess", function() {
|
|
a._clearClick = true
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype.attachCalendar = function() {
|
|
return this._attachNode("calendar", {})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_calendar = function(a) {
|
|
this._nodeObj = new dhtmlXCalendarObject(this._nodeId);
|
|
this._nodeObj.setSkin(this.conf.skin);
|
|
this._nodeObj.show()
|
|
};
|
|
dhtmlXPopup.prototype.attachGrid = function(c, a) {
|
|
return this._attachNode("grid", {
|
|
width: c || 400,
|
|
height: a || 200
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_grid = function() {
|
|
this._nodeObj = new dhtmlXGridObject(this._nodeId);
|
|
this._nodeObj.setSkin(this.conf.skin)
|
|
};
|
|
dhtmlXPopup.prototype.attachTree = function(g, c, a) {
|
|
return this._attachNode("tree", {
|
|
width: g || 400,
|
|
height: c || 200,
|
|
rootId: a || 0
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_tree = function(a) {
|
|
this._nodeObj = new dhtmlXTreeObject(this._nodeId, "100%", "100%", (a.rootId))
|
|
};
|
|
dhtmlXPopup.prototype.attachLayout = function(c, a, g) {
|
|
return this._attachNode("layout", {
|
|
width: c || 400,
|
|
height: a || 200,
|
|
pattern: g || "3L"
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_layout = function(a) {
|
|
this._nodeObj = new dhtmlXLayoutObject(this._nodeId, a.pattern, this.conf.skin)
|
|
};
|
|
dhtmlXPopup.prototype.attachAccordion = function(g, a, c) {
|
|
return this._attachNode("accordion", {
|
|
width: g || 400,
|
|
height: a || 200,
|
|
conf: c || {}
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_accordion = function(a) {
|
|
a.conf.parent = this._nodeId;
|
|
a.conf.skin = this.conf.skin;
|
|
this._nodeObj = new dhtmlXAccordion(a.conf)
|
|
};
|
|
dhtmlXPopup.prototype.attachTabbar = function(g, a, c) {
|
|
if (typeof(c) == "string") {
|
|
c = {
|
|
mode: c
|
|
}
|
|
} else {
|
|
if (typeof(c) != "object" || c == null) {
|
|
c = {}
|
|
}
|
|
}
|
|
return this._attachNode("tabbar", {
|
|
width: g || 400,
|
|
height: a || 200,
|
|
conf: c
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_tabbar = function(a) {
|
|
a.conf.parent = this._nodeId;
|
|
a.conf.skin = this.conf.skin;
|
|
this._nodeObj = new dhtmlXTabBar(a.conf)
|
|
};
|
|
dhtmlXPopup.prototype.attachEditor = function(g, a, c) {
|
|
return this._attachNode("editor", {
|
|
width: g || 400,
|
|
height: a || 200,
|
|
conf: c || {}
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_editor = function(c) {
|
|
document.getElementById(this._nodeId).className = "dhxeditor_" + this.conf.skin;
|
|
c.conf.parent = this._nodeId;
|
|
if (c.conf.skin == null) {
|
|
c.conf.skin = this.conf.skin
|
|
}
|
|
this._nodeObj = new dhtmlXEditor(c.conf);
|
|
var a = this.attachEvent("onShow", function() {
|
|
if (this._nodeObj instanceof window.dhtmlXEditor) {
|
|
this._nodeObj.setSizes()
|
|
}
|
|
});
|
|
if (this._nodeObjEv == null) {
|
|
this._nodeObjEv = []
|
|
}
|
|
this._nodeObjEv.push(a)
|
|
};
|
|
dhtmlXPopup.prototype.attachColorPicker = function(a) {
|
|
if (typeof(a) != "object" || a == null) {
|
|
a = {}
|
|
}
|
|
return this._attachNode("colorpicker", {
|
|
conf: a
|
|
})
|
|
};
|
|
dhtmlXPopup.prototype._attach_init_colorpicker = function(a) {
|
|
a.conf.skin = this.conf.skin;
|
|
a.conf.parent = this._nodeId;
|
|
this._nodeObj = new dhtmlXColorPicker(a.conf)
|
|
};
|
|
|
|
function dhtmlXMenuObject(l, m) {
|
|
var h = this;
|
|
this.conf = {
|
|
skin: (m || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxmenu") || "dhx_skyblue"),
|
|
mode: "web",
|
|
align: "left",
|
|
is_touched: false,
|
|
selected: -1,
|
|
last_click: -1,
|
|
fixed_pos: false,
|
|
rtl: false,
|
|
icons_path: "",
|
|
arrow_ff_fix: (navigator.userAgent.indexOf("MSIE") >= 0 && document.compatMode == "BackCompat"),
|
|
live_id: window.dhx4.newId(),
|
|
tags: {
|
|
root: "menu",
|
|
item: "item",
|
|
text_ext: "itemtext",
|
|
userdata: "userdata",
|
|
tooltip: "tooltip",
|
|
hotkey: "hotkey",
|
|
href: "href"
|
|
},
|
|
autoload: {},
|
|
hide_tm: {},
|
|
top_mode: true,
|
|
top_tmtime: 200,
|
|
v_enabled: false,
|
|
v: {
|
|
x1: null,
|
|
x2: null,
|
|
y1: null,
|
|
y2: null
|
|
},
|
|
dir_toplv: "bottom",
|
|
dir_sublv: "right",
|
|
auto_overflow: false,
|
|
overflow_limit: 0,
|
|
of_utm: null,
|
|
of_utime: 20,
|
|
of_ustep: 3,
|
|
of_dtm: null,
|
|
of_dtime: 20,
|
|
of_dstep: 3,
|
|
tm_sec: 400,
|
|
tm_handler: null,
|
|
dload: false,
|
|
dload_url: "",
|
|
dload_icon: false,
|
|
dload_params: {
|
|
action: "loadMenu"
|
|
},
|
|
dload_pid: "parentId",
|
|
tl_botmarg: 1,
|
|
tl_rmarg: 0,
|
|
tl_ofsleft: 1,
|
|
context: false,
|
|
ctx_zoneid: false,
|
|
ctx_autoshow: true,
|
|
ctx_autohide: true,
|
|
ctx_hideall: true,
|
|
ctx_zones: {},
|
|
ctx_baseid: null,
|
|
selected_sub: [],
|
|
opened_poly: []
|
|
};
|
|
if (typeof(l) == "object" && l != null && typeof(l.tagName) == "undefined") {
|
|
if (l.icons_path != null || l.icon_path != null) {
|
|
this.conf.icons_path = (l.icons_path || l.icon_path)
|
|
}
|
|
if (l.skin != null) {
|
|
this.conf.skin = l.skin
|
|
}
|
|
if (l.visible_area) {
|
|
this.conf.v_enabled = true;
|
|
this.conf.v = {
|
|
x1: l.visible_area.x1,
|
|
x2: l.visible_area.x2,
|
|
y1: l.visible_area.y1,
|
|
y2: l.visible_area.y2
|
|
}
|
|
}
|
|
for (var g in {
|
|
json: 1,
|
|
xml: 1,
|
|
items: 1,
|
|
top_text: 1,
|
|
align: 1,
|
|
open_mode: 1,
|
|
overflow: 1,
|
|
dynamic: 1,
|
|
dynamic_icon: 1,
|
|
context: 1,
|
|
onload: 1,
|
|
onclick: 1,
|
|
oncheckboxclick: 1,
|
|
onradioclick: 1
|
|
}) {
|
|
if (l[g] != null) {
|
|
this.conf.autoload[g] = l[g]
|
|
}
|
|
}
|
|
l = l.parent
|
|
}
|
|
if (l == null) {
|
|
this.base = document.body
|
|
} else {
|
|
var c = (typeof(l) == "string" ? document.getElementById(l) : l);
|
|
if (c != null) {
|
|
this.base = c;
|
|
if (!this.base.id) {
|
|
this.base.id = (new Date()).valueOf()
|
|
}
|
|
this.base.className += " dhtmlxMenu_" + this.conf.skin + "_Middle dir_left";
|
|
this.base._autoSkinUpdate = true;
|
|
if (this.base.oncontextmenu) {
|
|
this.base._oldContextMenuHandler = this.base.oncontextmenu
|
|
}
|
|
this.conf.ctx_baseid = this.base.id;
|
|
this.base.onselectstart = function(a) {
|
|
a = a || event;
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
} else {
|
|
a.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
this.base.oncontextmenu = function(a) {
|
|
a = a || event;
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
} else {
|
|
a.returnValue = false
|
|
}
|
|
return false
|
|
}
|
|
} else {
|
|
this.base = document.body
|
|
}
|
|
}
|
|
this.idPrefix = "";
|
|
this.topId = "dhxWebMenuTopId";
|
|
this.idPull = {};
|
|
this.itemPull = {};
|
|
this.userData = {};
|
|
this.radio = {};
|
|
this.setSkin = function(o) {
|
|
var q = this.conf.skin;
|
|
this.conf.skin = o;
|
|
switch (this.conf.skin) {
|
|
case "dhx_skyblue":
|
|
case "dhx_web":
|
|
this.conf.tl_botmarg = 2;
|
|
this.conf.tl_rmarg = 1;
|
|
this.conf.tl_ofsleft = 1;
|
|
break;
|
|
case "dhx_terrace":
|
|
this.conf.tl_botmarg = 0;
|
|
this.conf.tl_rmarg = 0;
|
|
this.conf.tl_ofsleft = 0;
|
|
break
|
|
}
|
|
if (this.base._autoSkinUpdate) {
|
|
this.base.className = this.base.className.replace("dhtmlxMenu_" + q + "_Middle", "") + " dhtmlxMenu_" + this.conf.skin + "_Middle"
|
|
}
|
|
for (var n in this.idPull) {
|
|
this.idPull[n].className = String(this.idPull[n].className).replace(q, this.conf.skin)
|
|
}
|
|
};
|
|
this.setSkin(this.conf.skin);
|
|
this._addSubItemToSelected = function(o, n) {
|
|
var a = true;
|
|
for (var r = 0; r < this.conf.selected_sub.length; r++) {
|
|
if ((this.conf.selected_sub[r][0] == o) && (this.conf.selected_sub[r][1] == n)) {
|
|
a = false
|
|
}
|
|
}
|
|
if (a == true) {
|
|
this.conf.selected_sub.push(new Array(o, n))
|
|
}
|
|
return a
|
|
};
|
|
this._removeSubItemFromSelected = function(r, o) {
|
|
var a = new Array();
|
|
var n = false;
|
|
for (var s = 0; s < this.conf.selected_sub.length; s++) {
|
|
if ((this.conf.selected_sub[s][0] == r) && (this.conf.selected_sub[s][1] == o)) {
|
|
n = true
|
|
} else {
|
|
a[a.length] = this.conf.selected_sub[s]
|
|
}
|
|
}
|
|
if (n == true) {
|
|
this.conf.selected_sub = a
|
|
}
|
|
return n
|
|
};
|
|
this._getSubItemToDeselectByPolygon = function(r) {
|
|
var a = new Array();
|
|
for (var s = 0; s < this.conf.selected_sub.length; s++) {
|
|
if (this.conf.selected_sub[s][1] == r) {
|
|
a[a.length] = this.conf.selected_sub[s][0];
|
|
a = a.concat(this._getSubItemToDeselectByPolygon(this.conf.selected_sub[s][0]));
|
|
var o = true;
|
|
for (var n = 0; n < this.conf.opened_poly.length; n++) {
|
|
if (this.conf.opened_poly[n] == this.conf.selected_sub[s][0]) {
|
|
o = false
|
|
}
|
|
}
|
|
if (o == true) {
|
|
this.conf.opened_poly[this.conf.opened_poly.length] = this.conf.selected_sub[s][0]
|
|
}
|
|
this.conf.selected_sub[s][0] = -1;
|
|
this.conf.selected_sub[s][1] = -1
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
this._hidePolygon = function(a) {
|
|
if (this.idPull["polygon_" + a] != null) {
|
|
if (this.idPull["polygon_" + a]._zId != null) {
|
|
window.dhx4.zim.clear(this.idPull["polygon_" + a]._zId)
|
|
}
|
|
if (typeof(this._menuEffect) != "undefined" && this._menuEffect !== false) {
|
|
this._hidePolygonEffect("polygon_" + a)
|
|
} else {
|
|
if (this.idPull["polygon_" + a].style.display == "none") {
|
|
return
|
|
}
|
|
this.idPull["polygon_" + a].style.display = "none";
|
|
if (this.idPull["arrowup_" + a] != null) {
|
|
this.idPull["arrowup_" + a].style.display = "none"
|
|
}
|
|
if (this.idPull["arrowdown_" + a] != null) {
|
|
this.idPull["arrowdown_" + a].style.display = "none"
|
|
}
|
|
this._updateItemComplexState(a, true, false);
|
|
if (window.dhx4.isIE6 && this.idPull["polygon_" + a + "_ie6cover"] != null) {
|
|
this.idPull["polygon_" + a + "_ie6cover"].style.display = "none"
|
|
}
|
|
}
|
|
a = String(a).replace(this.idPrefix, "");
|
|
if (a == this.topId) {
|
|
a = null
|
|
}
|
|
this.callEvent("onHide", [a]);
|
|
if (a != null && this.conf.skin == "dhx_terrace" && this.itemPull[this.idPrefix + a].parent == this.idPrefix + this.topId) {
|
|
this._improveTerraceButton(this.idPrefix + a, true)
|
|
}
|
|
}
|
|
};
|
|
this._showPolygon = function(I, o) {
|
|
var N = this._countVisiblePolygonItems(I);
|
|
if (N == 0) {
|
|
return
|
|
}
|
|
var J = "polygon_" + I;
|
|
if ((this.idPull[J] != null) && (this.idPull[I] != null)) {
|
|
if (this.conf.top_mode && this.conf.mode == "web" && !this.conf.context) {
|
|
if (!this.idPull[I]._mouseOver && o == this.conf.dir_toplv) {
|
|
return
|
|
}
|
|
}
|
|
if (!this.conf.fixed_pos) {
|
|
this._autoDetectVisibleArea()
|
|
}
|
|
var K = 0;
|
|
var M = 0;
|
|
var P = null;
|
|
var E = null;
|
|
if (this.idPull[J]._zId == null) {
|
|
this.idPull[J]._zId = window.dhx4.newId()
|
|
}
|
|
this.idPull[J]._zInd = window.dhx4.zim.reserve(this.idPull[J]._zId);
|
|
this.idPull[J].style.visibility = "hidden";
|
|
this.idPull[J].style.left = "0px";
|
|
this.idPull[J].style.top = "0px";
|
|
this.idPull[J].style.display = "";
|
|
this.idPull[J].style.zIndex = this.idPull[J]._zInd;
|
|
if (this.conf.auto_overflow) {
|
|
if (this.idPull[J].firstChild.offsetHeight > this.conf.v.y1 + this.conf.v.y2) {
|
|
var D = Math.floor((this.conf.v.y2 - this.conf.v.y1 - 35) / 24);
|
|
this.conf.overflow_limit = D
|
|
} else {
|
|
this.conf.overflow_limit = 0;
|
|
if (this.idPull["arrowup_" + I] != null) {
|
|
this._removeUpArrow(String(I).replace(this.idPrefix, ""))
|
|
}
|
|
if (this.idPull["arrowdown_" + I] != null) {
|
|
this._removeDownArrow(String(I).replace(this.idPrefix, ""))
|
|
}
|
|
}
|
|
}
|
|
if (this.conf.overflow_limit > 0 && this.conf.overflow_limit < N) {
|
|
if (this.idPull["arrowup_" + I] == null) {
|
|
this._addUpArrow(String(I).replace(this.idPrefix, ""))
|
|
}
|
|
if (this.idPull["arrowdown_" + I] == null) {
|
|
this._addDownArrow(String(I).replace(this.idPrefix, ""))
|
|
}
|
|
P = this.idPull["arrowup_" + I];
|
|
P.style.display = "none";
|
|
E = this.idPull["arrowdown_" + I];
|
|
E.style.display = "none"
|
|
}
|
|
if (this.conf.overflow_limit > 0) {
|
|
if (this.conf.overflow_limit < N) {
|
|
this.idPull[J].childNodes[1].style.height = 24 * this.conf.overflow_limit + "px";
|
|
P.style.width = E.style.width = this.idPull[J].childNodes[1].style.width = this.idPull[J].childNodes[1].childNodes[0].offsetWidth + "px";
|
|
this.idPull[J].childNodes[1].scrollTop = 0;
|
|
P.style.display = "";
|
|
K = P.offsetHeight;
|
|
E.style.display = "";
|
|
M = E.offsetHeight
|
|
} else {
|
|
this.idPull[J].childNodes[1].style.height = "";
|
|
this.idPull[J].childNodes[1].style.width = ""
|
|
}
|
|
}
|
|
if (this.itemPull[I] != null) {
|
|
var A = "polygon_" + this.itemPull[I]["parent"]
|
|
} else {
|
|
if (this.conf.context) {
|
|
var A = this.idPull[this.idPrefix + this.topId]
|
|
}
|
|
}
|
|
var a = (this.idPull[I].tagName != null ? window.dhx4.absLeft(this.idPull[I]) : this.idPull[I][0]);
|
|
var O = (this.idPull[I].tagName != null ? window.dhx4.absTop(this.idPull[I]) : this.idPull[I][1]);
|
|
var n = (this.idPull[I].tagName != null ? this.idPull[I].offsetWidth : 0);
|
|
var q = (this.idPull[I].tagName != null ? this.idPull[I].offsetHeight : 0);
|
|
var v = 0;
|
|
var u = 0;
|
|
var C = this.idPull[J].offsetWidth;
|
|
var L = this.idPull[J].childNodes[1].offsetHeight + K + M;
|
|
if (o == "bottom") {
|
|
if (this.conf.rtl) {
|
|
v = a + (n != null ? n : 0) - C
|
|
} else {
|
|
if (this.conf.align == "right") {
|
|
v = a + n - C
|
|
} else {
|
|
v = a - 1 + (o == this.conf.dir_toplv ? this.conf.tl_rmarg : 0)
|
|
}
|
|
}
|
|
u = O - 1 + q + this.conf.tl_botmarg
|
|
}
|
|
if (o == "right") {
|
|
v = a + n - 1;
|
|
u = O + 2
|
|
}
|
|
if (o == "left") {
|
|
v = a - this.idPull[J].offsetWidth + 2;
|
|
u = O + 2
|
|
}
|
|
if (o == "top") {
|
|
v = a - 1;
|
|
u = O - L + 2
|
|
}
|
|
if (this.conf.fixed_pos) {
|
|
var H = 65536;
|
|
var F = 65536
|
|
} else {
|
|
var H = (this.conf.v.x2 != null ? this.conf.v.x2 : 0);
|
|
var F = (this.conf.v.y2 != null ? this.conf.v.y2 : 0);
|
|
if (H == 0) {
|
|
if (window.innerWidth) {
|
|
H = window.innerWidth;
|
|
F = window.innerHeight
|
|
} else {
|
|
H = document.body.offsetWidth;
|
|
F = document.body.scrollHeight
|
|
}
|
|
}
|
|
} if (v + C > H && !this.conf.rtl) {
|
|
v = a - C + 2
|
|
}
|
|
if (v < this.conf.v.x1 && this.conf.rtl) {
|
|
v = a + n - 2
|
|
}
|
|
if (v < 0) {
|
|
v = 0
|
|
}
|
|
if (u + L > F && this.conf.v.y2 != null) {
|
|
u = Math.max(O + q - L + 2, (this.conf.v_enabled ? this.conf.v.y1 + 2 : 2));
|
|
if (this.conf.context && this.idPrefix + this.topId == I && E != null) {
|
|
u = u - 2
|
|
}
|
|
if (this.itemPull[I] != null && !this.conf.context) {
|
|
if (this.itemPull[I]["parent"] == this.idPrefix + this.topId) {
|
|
u = u - this.base.offsetHeight
|
|
}
|
|
}
|
|
}
|
|
this.idPull[J].style.left = v + "px";
|
|
this.idPull[J].style.top = u + "px";
|
|
if (typeof(this._menuEffect) != "undefined" && this._menuEffect !== false) {
|
|
this._showPolygonEffect(J)
|
|
} else {
|
|
this.idPull[J].style.visibility = "";
|
|
if (this.conf.overflow_limit > 0 && this.conf.overflow_limit < N) {
|
|
this.idPull[J].childNodes[1].scrollTop = 0;
|
|
this._checkArrowsState(I)
|
|
}
|
|
if (window.dhx4.isIE6) {
|
|
var s = J + "_ie6cover";
|
|
if (this.idPull[s] == null) {
|
|
var r = document.createElement("IFRAME");
|
|
r.className = "dhtmlxMenu_IE6CoverFix_" + this.conf.skin;
|
|
r.frameBorder = 0;
|
|
r.setAttribute("src", "javascript:false;");
|
|
document.body.insertBefore(r, document.body.firstChild);
|
|
this.idPull[s] = r
|
|
}
|
|
this.idPull[s].style.left = v + "px";
|
|
this.idPull[s].style.top = u + "px";
|
|
this.idPull[s].style.width = this.idPull[J].offsetWidth + "px";
|
|
this.idPull[s].style.height = this.idPull[J].offsetHeight + "px";
|
|
this.idPull[s].style.zIndex = this.idPull[J].style.zIndex - 1;
|
|
this.idPull[s].style.display = ""
|
|
}
|
|
}
|
|
I = String(I).replace(this.idPrefix, "");
|
|
if (I == this.topId) {
|
|
I = null
|
|
}
|
|
this.callEvent("onShow", [I]);
|
|
if (I != null && this.conf.skin == "dhx_terrace" && this.itemPull[this.idPrefix + I].parent == this.idPrefix + this.topId) {
|
|
this._improveTerraceButton(this.idPrefix + I, false)
|
|
}
|
|
}
|
|
};
|
|
this._redistribSubLevelSelection = function(s, r) {
|
|
while (this.conf.opened_poly.length > 0) {
|
|
this.conf.opened_poly.pop()
|
|
}
|
|
var a = this._getSubItemToDeselectByPolygon(r);
|
|
this._removeSubItemFromSelected(-1, -1);
|
|
for (var n = 0; n < a.length; n++) {
|
|
if ((this.idPull[a[n]] != null) && (a[n] != s)) {
|
|
if (this.itemPull[a[n]]["state"] == "enabled") {
|
|
this.idPull[a[n]].className = "sub_item"
|
|
}
|
|
}
|
|
}
|
|
for (var n = 0; n < this.conf.opened_poly.length; n++) {
|
|
if (this.conf.opened_poly[n] != r) {
|
|
this._hidePolygon(this.conf.opened_poly[n])
|
|
}
|
|
}
|
|
if (this.itemPull[s]["state"] == "enabled") {
|
|
this.idPull[s].className = "sub_item_selected";
|
|
if (this.itemPull[s]["complex"] && this.conf.dload && (this.itemPull[s]["loaded"] == "no")) {
|
|
if (this.conf.dload_icon == true) {
|
|
this._updateLoaderIcon(s, true)
|
|
}
|
|
this.itemPull[s].loaded = "get";
|
|
var o = s.replace(this.idPrefix, "");
|
|
this._dhxdataload.onBeforeXLS = function() {
|
|
var u = {
|
|
params: {}
|
|
};
|
|
u.params[this.conf.dload_pid] = o;
|
|
for (var q in this.conf.dload_params) {
|
|
u.params[q] = this.conf.dload_params[q]
|
|
}
|
|
return u
|
|
};
|
|
this.loadStruct(this.conf.dload_url)
|
|
}
|
|
if (this.itemPull[s]["complex"] || (this.conf.dload && (this.itemPull[s]["loaded"] == "yes"))) {
|
|
if ((this.itemPull[s]["complex"]) && (this.idPull["polygon_" + s] != null)) {
|
|
this._updateItemComplexState(s, true, true);
|
|
this._showPolygon(s, this.conf.dir_sublv)
|
|
}
|
|
}
|
|
this._addSubItemToSelected(s, r);
|
|
this.conf.selected = s
|
|
}
|
|
};
|
|
this._doOnClick = function(n, x, r) {
|
|
this.conf.last_click = n;
|
|
if (this.itemPull[this.idPrefix + n]["href_link"] != null && this.itemPull[this.idPrefix + n].state == "enabled") {
|
|
var s = document.createElement("FORM");
|
|
var v = String(this.itemPull[this.idPrefix + n]["href_link"]).split("?");
|
|
s.action = v[0];
|
|
if (v[1] != null) {
|
|
var o = String(v[1]).split("&");
|
|
for (var a = 0; a < o.length; a++) {
|
|
var w = String(o[a]).split("=");
|
|
var u = document.createElement("INPUT");
|
|
u.type = "hidden";
|
|
u.name = (w[0] || "");
|
|
u.value = (w[1] || "");
|
|
s.appendChild(u)
|
|
}
|
|
}
|
|
if (this.itemPull[this.idPrefix + n]["href_target"] != null) {
|
|
s.target = this.itemPull[this.idPrefix + n]["href_target"]
|
|
}
|
|
s.style.display = "none";
|
|
document.body.appendChild(s);
|
|
s.submit();
|
|
if (s != null) {
|
|
document.body.removeChild(s);
|
|
s = null
|
|
}
|
|
return
|
|
}
|
|
if (x.charAt(0) == "c") {
|
|
return
|
|
}
|
|
if (x.charAt(1) == "d") {
|
|
return
|
|
}
|
|
if (x.charAt(2) == "s") {
|
|
return
|
|
}
|
|
if (this.checkEvent("onClick")) {
|
|
this.callEvent("onClick", [n, this.conf.ctx_zoneid, r])
|
|
} else {
|
|
if ((x.charAt(1) == "d") || (this.conf.mode == "win" && x.charAt(2) == "t")) {
|
|
return
|
|
}
|
|
} if (this.conf.context && this._isContextMenuVisible() && this.conf.ctx_autohide) {
|
|
this._hideContextMenu()
|
|
} else {
|
|
if (this._clearAndHide) {
|
|
this._clearAndHide()
|
|
}
|
|
}
|
|
};
|
|
this._doOnTouchMenu = function(a) {
|
|
if (this.conf.is_touched == false) {
|
|
this.conf.is_touched = true;
|
|
if (this.checkEvent("onTouch")) {
|
|
this.callEvent("onTouch", [a])
|
|
}
|
|
}
|
|
};
|
|
this._searchMenuNode = function(o, s) {
|
|
var a = new Array();
|
|
for (var r = 0; r < s.length; r++) {
|
|
if (typeof(s[r]) == "object") {
|
|
if (s[r].length == 5) {
|
|
if (typeof(s[r][0]) != "object") {
|
|
if ((s[r][0].replace(this.idPrefix, "") == o) && (r == 0)) {
|
|
a = s
|
|
}
|
|
}
|
|
}
|
|
var n = this._searchMenuNode(o, s[r]);
|
|
if (n.length > 0) {
|
|
a = n
|
|
}
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
this._getMenuNodes = function(q) {
|
|
var n = new Array;
|
|
for (var o in this.itemPull) {
|
|
if (this.itemPull[o]["parent"] == q) {
|
|
n[n.length] = o
|
|
}
|
|
}
|
|
return n
|
|
};
|
|
this._genStr = function(a) {
|
|
var n = "";
|
|
var r = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
for (var o = 0; o < a; o++) {
|
|
n += r.charAt(Math.round(Math.random() * (r.length - 1)))
|
|
}
|
|
return n
|
|
};
|
|
this.getItemType = function(a) {
|
|
a = this.idPrefix + a;
|
|
if (this.itemPull[a] == null) {
|
|
return null
|
|
}
|
|
return this.itemPull[a]["type"]
|
|
};
|
|
this.forEachItem = function(o) {
|
|
for (var n in this.itemPull) {
|
|
o(String(n).replace(this.idPrefix, ""))
|
|
}
|
|
};
|
|
this._clearAndHide = function() {
|
|
h.conf.selected = -1;
|
|
h.conf.last_click = -1;
|
|
while (h.conf.opened_poly.length > 0) {
|
|
h.conf.opened_poly.pop()
|
|
}
|
|
for (var a = 0; a < h.conf.selected_sub.length; a++) {
|
|
var n = h.conf.selected_sub[a][0];
|
|
if (h.idPull[n] != null) {
|
|
if (h.itemPull[n]["state"] == "enabled") {
|
|
if (h.idPull[n].className == "sub_item_selected") {
|
|
h.idPull[n].className = "sub_item"
|
|
}
|
|
if (h.idPull[n].className == "dhtmlxMenu_" + h.conf.skin + "_TopLevel_Item_Selected") {
|
|
if (h.itemPull[n]["cssNormal"] != null) {
|
|
h.idPull[n].className = h.itemPull[n]["cssNormal"]
|
|
} else {
|
|
h.idPull[n].className = "dhtmlxMenu_" + h.conf.skin + "_TopLevel_Item_Normal"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
h._hidePolygon(n)
|
|
}
|
|
h.conf.is_touched = false;
|
|
if (h.conf.context && h.conf.ctx_hideall) {
|
|
h._hidePolygon(h.idPrefix + h.topId)
|
|
}
|
|
};
|
|
this._showSubLevelItem = function(n, a) {
|
|
if (document.getElementById("arrow_" + this.idPrefix + n) != null) {
|
|
document.getElementById("arrow_" + this.idPrefix + n).style.display = (a ? "none" : "")
|
|
}
|
|
if (document.getElementById("image_" + this.idPrefix + n) != null) {
|
|
document.getElementById("image_" + this.idPrefix + n).style.display = (a ? "none" : "")
|
|
}
|
|
if (document.getElementById(this.idPrefix + n) != null) {
|
|
document.getElementById(this.idPrefix + n).style.display = (a ? "" : "none")
|
|
}
|
|
};
|
|
this._hideSubLevelItem = function(a) {
|
|
this._showSubLevelItem(a, true)
|
|
};
|
|
this.idPrefix = this._genStr(12) + "_";
|
|
this._bodyClick = function(a) {
|
|
a = a || event;
|
|
if (a.button == 2 || (window.dhx4.isOpera && a.ctrlKey == true)) {
|
|
return
|
|
}
|
|
if (h.conf.context) {
|
|
if (h.conf.ctx_autohide && (!window.dhx4.isOpera || (h._isContextMenuVisible() && window.dhx4.isOpera))) {
|
|
h._hideContextMenu()
|
|
}
|
|
} else {
|
|
if (h._clearAndHide) {
|
|
h._clearAndHide()
|
|
}
|
|
}
|
|
};
|
|
this._bodyContext = function(o) {
|
|
o = o || event;
|
|
var n = String((o.srcElement || o.target).className);
|
|
if (n.search("dhtmlxMenu") != -1 && n.search("SubLevelArea") != -1) {
|
|
return
|
|
}
|
|
var a = true;
|
|
var q = o.target || o.srcElement;
|
|
while (q != null) {
|
|
if (q.id != null) {
|
|
if (h.isContextZone(q.id)) {
|
|
a = false
|
|
}
|
|
}
|
|
if (q == document.body) {
|
|
a = false
|
|
}
|
|
q = q.parentNode
|
|
}
|
|
if (a) {
|
|
h.hideContextMenu()
|
|
}
|
|
};
|
|
if (typeof(window.addEventListener) != "undefined") {
|
|
window.addEventListener("click", this._bodyClick, false);
|
|
window.addEventListener("contextmenu", this._bodyContext, false)
|
|
} else {
|
|
document.body.attachEvent("onclick", this._bodyClick);
|
|
document.body.attachEvent("oncontextmenu", this._bodyContext)
|
|
}
|
|
this.unload = function() {
|
|
window.dhx4._eventable(this, "clear");
|
|
dhtmlXMenuObject.prototype.liveInst[this.conf.live_id] = null;
|
|
try {
|
|
delete dhtmlXMenuObject.prototype.liveInst[this.conf.live_id]
|
|
} catch (o) {}
|
|
this.conf.live_id = null;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("click", this._bodyClick, false);
|
|
window.removeEventListener("contextmenu", this._bodyContext, false)
|
|
} else {
|
|
document.body.detachEvent("onclick", this._bodyClick);
|
|
document.body.detachEvent("oncontextmenu", this._bodyContext)
|
|
}
|
|
this._bodyClick = null;
|
|
this._bodyContext = null;
|
|
this.removeItem(this.idPrefix + this.topId, true);
|
|
this.itemPull = null;
|
|
this.idPull = null;
|
|
if (this.conf.context) {
|
|
for (var n in this.conf.ctx_zones) {
|
|
this.removeContextZone(n)
|
|
}
|
|
}
|
|
if (this.cont != null) {
|
|
this.cont.className = "";
|
|
this.cont.parentNode.removeChild(this.cont);
|
|
this.cont = null
|
|
}
|
|
if (this.base != null) {
|
|
this.base.className = "";
|
|
if (!this.conf.context) {
|
|
this.base.oncontextmenu = (this.base._oldContextMenuHandler || null)
|
|
}
|
|
this.base.onselectstart = null;
|
|
this.base = null
|
|
}
|
|
for (var n in this) {
|
|
this[n] = null
|
|
}
|
|
h = null
|
|
};
|
|
dhtmlXMenuObject.prototype.liveInst[this.conf.live_id] = this;
|
|
window.dhx4._enableDataLoading(this, "_initObj", "_xmlToJson", this.conf.tags.root, {
|
|
struct: true
|
|
});
|
|
window.dhx4._eventable(this);
|
|
if (window.dhx4.s2b(this.conf.autoload.context) == true) {
|
|
this.renderAsContextMenu()
|
|
}
|
|
if (this.conf.autoload.dynamic != null) {
|
|
this.enableDynamicLoading(this.conf.autoload.dynamic, window.dhx4.s2b(this.conf.autoload.dynamic_icon))
|
|
} else {
|
|
if (this.conf.autoload.items != null) {
|
|
this.loadStruct(this.conf.autoload.items, this.conf.autoload.onload)
|
|
} else {
|
|
if (this.conf.autoload.json != null) {
|
|
this.loadStruct(this.conf.autoload.json, this.conf.autoload.onload)
|
|
} else {
|
|
if (this.conf.autoload.xml != null) {
|
|
this.loadStruct(this.conf.autoload.xml, this.conf.autoload.onload)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
for (var g in {
|
|
onclick: 1,
|
|
oncheckboxclick: 1,
|
|
onradioclick: 1
|
|
}) {
|
|
if (this.conf.autoload[g] != null) {
|
|
if (typeof(this.conf.autoload[g]) == "function") {
|
|
this.attachEvent(g, this.conf.autoload[g])
|
|
} else {
|
|
if (typeof(window[this.conf.autoload[g]]) == "function") {
|
|
this.attachEvent(g, window[this.conf.autoload[g]])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this.conf.autoload.top_text != null) {
|
|
this.setTopText(this.conf.autoload.top_text)
|
|
}
|
|
if (this.conf.autoload.align != null) {
|
|
this.setAlign(this.conf.autoload.align)
|
|
}
|
|
if (this.conf.autoload.open_mode != null) {
|
|
this.setOpenMode(this.conf.autoload.open_mode)
|
|
}
|
|
if (this.conf.autoload.overflow != null) {
|
|
this.setOverflowHeight(this.conf.autoload.overflow)
|
|
}
|
|
for (var g in this.conf.autoload) {
|
|
this.conf.autoload[g] = null;
|
|
delete this.conf.autoload[g]
|
|
}
|
|
this.conf.autoload = null;
|
|
return this
|
|
}
|
|
dhtmlXMenuObject.prototype._init = function() {
|
|
if (this._isInited == true) {
|
|
return
|
|
}
|
|
if (this.conf.dload) {
|
|
this._dhxdataload.onBeforeXLS = function() {
|
|
var g = {
|
|
params: {}
|
|
};
|
|
for (var c in this.conf.dload_params) {
|
|
g.params[c] = this.conf.dload_params[c]
|
|
}
|
|
return g
|
|
};
|
|
this.loadStruct(this.conf.dload_url)
|
|
} else {
|
|
this._initTopLevelMenu();
|
|
this._isInited = true
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._countVisiblePolygonItems = function(m) {
|
|
var h = 0;
|
|
for (var c in this.itemPull) {
|
|
var g = this.itemPull[c]["parent"];
|
|
var l = this.itemPull[c]["type"];
|
|
if (this.idPull[c] != null) {
|
|
if (g == m && (l == "item" || l == "radio" || l == "checkbox") && this.idPull[c].style.display != "none") {
|
|
h++
|
|
}
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXMenuObject.prototype._redefineComplexState = function(c) {
|
|
if (this.idPrefix + this.topId == c) {
|
|
return
|
|
}
|
|
if ((this.idPull["polygon_" + c] != null) && (this.idPull[c] != null)) {
|
|
var a = this._countVisiblePolygonItems(c);
|
|
if ((a > 0) && (!this.itemPull[c]["complex"])) {
|
|
this._updateItemComplexState(c, true, false)
|
|
}
|
|
if ((a == 0) && (this.itemPull[c]["complex"])) {
|
|
this._updateItemComplexState(c, false, false)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._updateItemComplexState = function(l, g, h) {
|
|
if ((!this.conf.context) && (this._getItemLevelType(l.replace(this.idPrefix, "")) == "TopLevel")) {
|
|
this.itemPull[l]["complex"] = g;
|
|
return
|
|
}
|
|
if ((this.idPull[l] == null) || (this.itemPull[l] == null)) {
|
|
return
|
|
}
|
|
this.itemPull[l]["complex"] = g;
|
|
if (l == this.idPrefix + this.topId) {
|
|
return
|
|
}
|
|
var a = null;
|
|
var c = this.idPull[l].childNodes[this.conf.rtl ? 0 : 2];
|
|
if (c.childNodes[0]) {
|
|
if (String(c.childNodes[0].className).search("complex_arrow") === 0) {
|
|
a = c.childNodes[0]
|
|
}
|
|
}
|
|
if (this.itemPull[l]["complex"]) {
|
|
if (a == null) {
|
|
a = document.createElement("DIV");
|
|
a.className = "complex_arrow";
|
|
a.id = "arrow_" + l;
|
|
while (c.childNodes.length > 0) {
|
|
c.removeChild(c.childNodes[0])
|
|
}
|
|
c.appendChild(a)
|
|
}
|
|
if (this.conf.dload && (this.itemPull[l].loaded == "get") && this.conf.dload_icon) {
|
|
if (a.className != "complex_arrow_loading") {
|
|
a.className = "complex_arrow_loading"
|
|
}
|
|
} else {
|
|
a.className = "complex_arrow"
|
|
}
|
|
return
|
|
}
|
|
if ((!this.itemPull[l]["complex"]) && (a != null)) {
|
|
c.removeChild(a);
|
|
if (this.itemPull[l]["hotkey_backup"] != null && this.setHotKey) {
|
|
this.setHotKey(l.replace(this.idPrefix, ""), this.itemPull[l]["hotkey_backup"])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._getItemLevelType = function(a) {
|
|
return (this.itemPull[this.idPrefix + a]["parent"] == this.idPrefix + this.topId ? "TopLevel" : "SubLevelArea")
|
|
};
|
|
dhtmlXMenuObject.prototype.setIconsPath = function(a) {
|
|
this.conf.icons_path = a
|
|
};
|
|
dhtmlXMenuObject.prototype._updateItemImage = function(g, h) {
|
|
g = this.idPrefix + g;
|
|
var l = (this.itemPull[g]["parent"] == this.idPrefix + this.topId && !this.conf.context);
|
|
var m = null;
|
|
if (l) {
|
|
for (var a = 0; a < this.idPull[g].childNodes.length; a++) {
|
|
try {
|
|
if (this.idPull[g].childNodes[a].className == "dhtmlxMenu_TopLevel_Item_Icon") {
|
|
m = this.idPull[g].childNodes[a]
|
|
}
|
|
} catch (n) {}
|
|
}
|
|
} else {
|
|
try {
|
|
var m = this.idPull[g].childNodes[this.conf.rtl ? 2 : 0].childNodes[0]
|
|
} catch (n) {}
|
|
if (!(m != null && typeof(m.className) != "undefined" && m.className == "sub_icon")) {
|
|
m = null
|
|
}
|
|
} if (this.itemPull[g]["type"] == "radio") {
|
|
var r = this.itemPull[g][(this.itemPull[g]["state"] == "enabled" ? "imgen" : "imgdis")]
|
|
} else {
|
|
var r = this.itemPull[g][(this.itemPull[g]["state"] == "enabled" ? "imgen" : "imgdis")]
|
|
} if (r.length > 0) {
|
|
if (m != null) {
|
|
m.src = this.conf.icons_path + r
|
|
} else {
|
|
if (l) {
|
|
var m = document.createElement("IMG");
|
|
m.className = "dhtmlxMenu_TopLevel_Item_Icon";
|
|
m.src = this.conf.icons_path + r;
|
|
m.border = "0";
|
|
m.id = "image_" + g;
|
|
if (!this.conf.rtl && this.idPull[g].childNodes.length > 0) {
|
|
this.idPull[g].insertBefore(m, this.idPull[g].childNodes[0])
|
|
} else {
|
|
this.idPull[g].appendChild(m)
|
|
}
|
|
} else {
|
|
var m = document.createElement("IMG");
|
|
m.className = "sub_icon";
|
|
m.src = this.conf.icons_path + r;
|
|
m.border = "0";
|
|
m.id = "image_" + g;
|
|
var o = this.idPull[g].childNodes[this.conf.rtl ? 2 : 0];
|
|
while (o.childNodes.length > 0) {
|
|
o.removeChild(o.childNodes[0])
|
|
}
|
|
o.appendChild(m)
|
|
}
|
|
}
|
|
} else {
|
|
if (m != null) {
|
|
var c = m.parentNode;
|
|
c.removeChild(m);
|
|
c.innerHTML = " ";
|
|
c = m = null
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._getAllParents = function(m) {
|
|
var g = new Array();
|
|
for (var c in this.itemPull) {
|
|
if (this.itemPull[c]["parent"] == m) {
|
|
g[g.length] = this.itemPull[c]["id"];
|
|
if (this.itemPull[c]["complex"]) {
|
|
var h = this._getAllParents(this.itemPull[c]["id"]);
|
|
for (var l = 0; l < h.length; l++) {
|
|
g[g.length] = h[l]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXMenuObject.prototype._autoDetectVisibleArea = function() {
|
|
if (this.conf.v_enabled) {
|
|
return
|
|
}
|
|
var a = window.dhx4.screenDim();
|
|
this.conf.v.x1 = a.left;
|
|
this.conf.v.x2 = a.right;
|
|
this.conf.v.y1 = a.top;
|
|
this.conf.v.y2 = a.bottom
|
|
};
|
|
dhtmlXMenuObject.prototype.getItemPosition = function(l) {
|
|
l = this.idPrefix + l;
|
|
var h = -1;
|
|
if (this.itemPull[l] == null) {
|
|
return h
|
|
}
|
|
var a = this.itemPull[l]["parent"];
|
|
var g = (this.idPull["polygon_" + a] != null ? this.idPull["polygon_" + a].tbd : this.cont);
|
|
for (var c = 0; c < g.childNodes.length; c++) {
|
|
if (g.childNodes[c] == this.idPull["separator_" + l] || g.childNodes[c] == this.idPull[l]) {
|
|
h = c
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXMenuObject.prototype.setItemPosition = function(n, m) {
|
|
n = this.idPrefix + n;
|
|
if (this.idPull[n] == null) {
|
|
return
|
|
}
|
|
var c = (this.itemPull[n]["parent"] == this.idPrefix + this.topId);
|
|
var a = this.idPull[n];
|
|
var h = this.getItemPosition(n.replace(this.idPrefix, ""));
|
|
var g = this.itemPull[n]["parent"];
|
|
var l = (this.idPull["polygon_" + g] != null ? this.idPull["polygon_" + g].tbd : this.cont);
|
|
l.removeChild(l.childNodes[h]);
|
|
if (m < 0) {
|
|
m = 0
|
|
}
|
|
if (c && m < 1) {
|
|
m = 1
|
|
}
|
|
if (m < l.childNodes.length) {
|
|
l.insertBefore(a, l.childNodes[m])
|
|
} else {
|
|
l.appendChild(a)
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.getParentId = function(a) {
|
|
a = this.idPrefix + a;
|
|
if (this.itemPull[a] == null) {
|
|
return null
|
|
}
|
|
return ((this.itemPull[a]["parent"] != null ? this.itemPull[a]["parent"] : this.topId).replace(this.idPrefix, ""))
|
|
};
|
|
dhtmlXMenuObject.prototype.hide = function() {
|
|
this._clearAndHide()
|
|
};
|
|
dhtmlXMenuObject.prototype.clearAll = function() {
|
|
this.removeItem(this.idPrefix + this.topId, true);
|
|
this._isInited = false;
|
|
this.idPrefix = this._genStr(12) + "_";
|
|
this.itemPull = {}
|
|
};
|
|
if (typeof(dhtmlXMenuObject.prototype.liveInst) == "undefined") {
|
|
dhtmlXMenuObject.prototype.liveInst = {}
|
|
}
|
|
dhtmlXMenuObject.prototype._redistribTopLevelSelection = function(h, c) {
|
|
var a = this._getSubItemToDeselectByPolygon("parent");
|
|
this._removeSubItemFromSelected(-1, -1);
|
|
for (var g = 0; g < a.length; g++) {
|
|
if (a[g] != h) {
|
|
this._hidePolygon(a[g])
|
|
}
|
|
if ((this.idPull[a[g]] != null) && (a[g] != h)) {
|
|
this.idPull[a[g]].className = this.idPull[a[g]].className.replace(/Selected/g, "Normal")
|
|
}
|
|
}
|
|
if (this.itemPull[this.idPrefix + h]["state"] == "enabled") {
|
|
this.idPull[this.idPrefix + h].className = "dhtmlxMenu_" + this.conf.skin + "_TopLevel_Item_Selected";
|
|
this._addSubItemToSelected(this.idPrefix + h, "parent");
|
|
this.conf.selected = (this.conf.mode == "win" ? (this.conf.selected != -1 ? h : this.conf.selected) : h);
|
|
if ((this.itemPull[this.idPrefix + h]["complex"]) && (this.conf.selected != -1)) {
|
|
this._showPolygon(this.idPrefix + h, this.conf.dir_toplv)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._initTopLevelMenu = function() {
|
|
this.conf.dir_toplv = "bottom";
|
|
this.conf.dir_sublv = (this.conf.rtl ? "left" : "right");
|
|
if (this.conf.context) {
|
|
this.idPull[this.idPrefix + this.topId] = new Array(0, 0);
|
|
this._addSubMenuPolygon(this.idPrefix + this.topId, this.idPrefix + this.topId)
|
|
} else {
|
|
var a = this._getMenuNodes(this.idPrefix + this.topId);
|
|
for (var c = 0; c < a.length; c++) {
|
|
if (this.itemPull[a[c]]["type"] == "item") {
|
|
this._renderToplevelItem(a[c], null)
|
|
}
|
|
if (this.itemPull[a[c]]["type"] == "separator") {
|
|
this._renderSeparator(a[c], null)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._renderToplevelItem = function(o, n) {
|
|
var l = this;
|
|
var a = document.createElement("DIV");
|
|
a.id = o;
|
|
if (this.itemPull[o]["state"] == "enabled" && this.itemPull[o]["cssNormal"] != null) {
|
|
a.className = this.itemPull[o]["cssNormal"]
|
|
} else {
|
|
a.className = "dhtmlxMenu_" + this.conf.skin + "_TopLevel_Item_" + (this.itemPull[o]["state"] == "enabled" ? "Normal" : "Disabled")
|
|
} if (this.itemPull[o]["title"] != "") {
|
|
var h = document.createElement("DIV");
|
|
h.className = "top_level_text";
|
|
h.innerHTML = this.itemPull[o]["title"];
|
|
a.appendChild(h)
|
|
}
|
|
if (this.itemPull[o]["tip"].length > 0) {
|
|
a.title = this.itemPull[o]["tip"]
|
|
}
|
|
if ((this.itemPull[o]["imgen"] != "") || (this.itemPull[o]["imgdis"] != "")) {
|
|
var g = this.itemPull[o][(this.itemPull[o]["state"] == "enabled") ? "imgen" : "imgdis"];
|
|
if (g) {
|
|
var c = document.createElement("IMG");
|
|
c.border = "0";
|
|
c.id = "image_" + o;
|
|
c.src = this.conf.icons_path + g;
|
|
c.className = "dhtmlxMenu_TopLevel_Item_Icon";
|
|
if (a.childNodes.length > 0 && !this.conf.rtl) {
|
|
a.insertBefore(c, a.childNodes[0])
|
|
} else {
|
|
a.appendChild(c)
|
|
}
|
|
}
|
|
}
|
|
a.onselectstart = function(m) {
|
|
m = m || event;
|
|
if (m.preventDefault) {
|
|
m.preventDefault()
|
|
} else {
|
|
m.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
a.oncontextmenu = function(m) {
|
|
m = m || event;
|
|
if (m.preventDefault) {
|
|
m.preventDefault()
|
|
} else {
|
|
m.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
if (!this.cont) {
|
|
this.cont = document.createElement("DIV");
|
|
this.cont.dir = "ltr";
|
|
this.cont.className = (this.conf.align == "right" ? "align_right" : "align_left");
|
|
this.base.appendChild(this.cont)
|
|
}
|
|
if (n != null) {
|
|
n++;
|
|
if (n < 0) {
|
|
n = 0
|
|
}
|
|
if (n > this.cont.childNodes.length - 1) {
|
|
n = null
|
|
}
|
|
}
|
|
if (n != null) {
|
|
this.cont.insertBefore(a, this.cont.childNodes[n])
|
|
} else {
|
|
this.cont.appendChild(a)
|
|
}
|
|
this.idPull[a.id] = a;
|
|
if (this.itemPull[o]["complex"] && (!this.conf.dload)) {
|
|
this._addSubMenuPolygon(this.itemPull[o]["id"], this.itemPull[o]["id"])
|
|
}
|
|
a.onmouseover = function() {
|
|
if (l.conf.mode == "web") {
|
|
window.clearTimeout(l.conf.tm_handler)
|
|
}
|
|
var m = l._getSubItemToDeselectByPolygon("parent");
|
|
l._removeSubItemFromSelected(-1, -1);
|
|
for (var s = 0; s < m.length; s++) {
|
|
if (m[s] != this.id) {
|
|
l._hidePolygon(m[s])
|
|
}
|
|
if ((l.idPull[m[s]] != null) && (m[s] != this.id)) {
|
|
if (l.itemPull[m[s]]["cssNormal"] != null) {
|
|
l.idPull[m[s]].className = l.itemPull[m[s]]["cssNormal"]
|
|
} else {
|
|
if (l.idPull[m[s]].className == "sub_item_selected") {
|
|
l.idPull[m[s]].className = "sub_item"
|
|
}
|
|
l.idPull[m[s]].className = l.idPull[m[s]].className.replace(/Selected/g, "Normal")
|
|
}
|
|
}
|
|
}
|
|
if (l.itemPull[this.id]["state"] == "enabled") {
|
|
this.className = "dhtmlxMenu_" + l.conf.skin + "_TopLevel_Item_Selected";
|
|
l._addSubItemToSelected(this.id, "parent");
|
|
l.conf.selected = (l.conf.mode == "win" ? (l.conf.selected != -1 ? this.id : l.conf.selected) : this.id);
|
|
if (l.conf.dload) {
|
|
if (l.itemPull[this.id].loaded == "no") {
|
|
this._dynLoadTM = new Date().getTime();
|
|
l.itemPull[this.id].loaded = "get";
|
|
var u = this.id.replace(l.idPrefix, "");
|
|
l._dhxdataload.onBeforeXLS = function() {
|
|
var v = {
|
|
params: {}
|
|
};
|
|
v.params[this.conf.dload_pid] = u;
|
|
for (var q in this.conf.dload_params) {
|
|
v.params[q] = this.conf.dload_params[q]
|
|
}
|
|
return v
|
|
};
|
|
l.loadStruct(l.conf.dload_url)
|
|
}
|
|
if (l.conf.top_mode && l.conf.mode == "web" && !l.conf.context) {
|
|
this._mouseOver = true
|
|
}
|
|
}
|
|
if ((!l.conf.dload) || (l.conf.dload && (!l.itemPull[this.id]["loaded"] || l.itemPull[this.id]["loaded"] == "yes"))) {
|
|
if ((l.itemPull[this.id]["complex"]) && (l.conf.selected != -1)) {
|
|
if (l.conf.top_mode && l.conf.mode == "web" && !l.conf.context) {
|
|
this._mouseOver = true;
|
|
var r = this.id;
|
|
this._menuOpenTM = window.setTimeout(function() {
|
|
l._showPolygon(r, l.conf.dir_toplv)
|
|
}, l.conf.top_tmtime)
|
|
} else {
|
|
l._showPolygon(this.id, l.conf.dir_toplv)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
l._doOnTouchMenu(this.id.replace(l.idPrefix, ""))
|
|
};
|
|
a.onmouseout = function() {
|
|
if (!((l.itemPull[this.id]["complex"]) && (l.conf.selected != -1)) && (l.itemPull[this.id]["state"] == "enabled")) {
|
|
if (l.itemPull[this.id]["cssNormal"] != null) {
|
|
a.className = l.itemPull[this.id]["cssNormal"]
|
|
} else {
|
|
a.className = "dhtmlxMenu_" + l.conf.skin + "_TopLevel_Item_Normal"
|
|
}
|
|
}
|
|
if (l.conf.mode == "web") {
|
|
window.clearTimeout(l.conf.tm_handler);
|
|
l.conf.tm_handler = window.setTimeout(function() {
|
|
l._clearAndHide()
|
|
}, l.conf.tm_sec, "JavaScript")
|
|
}
|
|
if (l.conf.top_mode && l.conf.mode == "web" && !l.conf.context) {
|
|
this._mouseOver = false;
|
|
window.clearTimeout(this._menuOpenTM)
|
|
}
|
|
};
|
|
a.onclick = function(u) {
|
|
if (l.conf.mode == "web") {
|
|
window.clearTimeout(l.conf.tm_handler)
|
|
}
|
|
if (l.conf.mode != "web" && l.itemPull[this.id]["state"] == "disabled") {
|
|
return
|
|
}
|
|
u = u || event;
|
|
u.cancelBubble = true;
|
|
if (u.preventDefault) {
|
|
u.preventDefault()
|
|
} else {
|
|
u.returnValue = false
|
|
} if (l.conf.mode == "win") {
|
|
if (l.itemPull[this.id]["complex"]) {
|
|
if (l.conf.selected == this.id) {
|
|
l.conf.selected = -1;
|
|
var r = false
|
|
} else {
|
|
l.conf.selected = this.id;
|
|
var r = true
|
|
} if (r) {
|
|
l._showPolygon(this.id, l.conf.dir_toplv)
|
|
} else {
|
|
l._hidePolygon(this.id)
|
|
}
|
|
}
|
|
}
|
|
var m = (l.itemPull[this.id]["complex"] ? "c" : "-");
|
|
var v = (l.itemPull[this.id]["state"] != "enabled" ? "d" : "-");
|
|
var q = {
|
|
ctrl: u.ctrlKey,
|
|
alt: u.altKey,
|
|
shift: u.shiftKey
|
|
};
|
|
l._doOnClick(this.id.replace(l.idPrefix, ""), m + v + "t", q);
|
|
return false
|
|
};
|
|
if (this.conf.skin == "dhx_terrace") {
|
|
this._improveTerraceSkin()
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._addSubMenuPolygon = function(m, l) {
|
|
var c = this._renderSublevelPolygon(m, l);
|
|
var a = this._getMenuNodes(l);
|
|
for (g = 0; g < a.length; g++) {
|
|
if (this.itemPull[a[g]]["type"] == "separator") {
|
|
this._renderSeparator(a[g], null)
|
|
} else {
|
|
this._renderSublevelItem(a[g], null)
|
|
}
|
|
}
|
|
if (m == l) {
|
|
var h = "topLevel"
|
|
} else {
|
|
var h = "subLevel"
|
|
}
|
|
for (var g = 0; g < a.length; g++) {
|
|
if (this.itemPull[a[g]]["complex"]) {
|
|
this._addSubMenuPolygon(m, this.itemPull[a[g]]["id"])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._renderSublevelPolygon = function(l, h) {
|
|
var c = document.createElement("DIV");
|
|
c.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_Polygon " + (this.conf.rtl ? "dir_right" : "");
|
|
c.dir = "ltr";
|
|
c.oncontextmenu = function(m) {
|
|
m = m || event;
|
|
if (m.preventDefault) {
|
|
m.preventDefault()
|
|
} else {
|
|
m.returnValue = false
|
|
}
|
|
m.cancelBubble = true;
|
|
return false
|
|
};
|
|
c.id = "polygon_" + h;
|
|
c.onclick = function(m) {
|
|
m = m || event;
|
|
m.cancelBubble = true
|
|
};
|
|
c.style.display = "none";
|
|
document.body.insertBefore(c, document.body.firstChild);
|
|
c.innerHTML = '<div style="position:relative;"></div><div style="position: relative; overflow:hidden;"></div><div style="position:relative;"></div>';
|
|
var g = document.createElement("TABLE");
|
|
g.className = "dhtmlxMebu_SubLevelArea_Tbl";
|
|
g.cellSpacing = 0;
|
|
g.cellPadding = 0;
|
|
g.border = 0;
|
|
var a = document.createElement("TBODY");
|
|
g.appendChild(a);
|
|
c.childNodes[1].appendChild(g);
|
|
c.tbl = g;
|
|
c.tbd = a;
|
|
this.idPull[c.id] = c;
|
|
if (this.sxDacProc != null) {
|
|
this.idPull["sxDac_" + h] = new this.sxDacProc(c, c.className);
|
|
if (window.dhx4.isIE) {
|
|
this.idPull["sxDac_" + h]._setSpeed(this.dacSpeedIE);
|
|
this.idPull["sxDac_" + h]._setCustomCycle(this.dacCyclesIE)
|
|
} else {
|
|
this.idPull["sxDac_" + h]._setSpeed(this.dacSpeed);
|
|
this.idPull["sxDac_" + h]._setCustomCycle(this.dacCycles)
|
|
}
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXMenuObject.prototype._renderSublevelItem = function(a, r) {
|
|
var o = this;
|
|
var q = document.createElement("TR");
|
|
q.className = (this.itemPull[a]["state"] == "enabled" ? "sub_item" : "sub_item_dis");
|
|
var n = document.createElement("TD");
|
|
n.className = "sub_item_icon";
|
|
var s = this.itemPull[a][(this.itemPull[a]["state"] == "enabled" ? "imgen" : "imgdis")];
|
|
if (s != "") {
|
|
var w = this.itemPull[a]["type"];
|
|
if (w == "checkbox" || w == "radio") {
|
|
var l = document.createElement("DIV");
|
|
l.id = "image_" + this.itemPull[a]["id"];
|
|
l.className = "sub_icon " + s;
|
|
n.appendChild(l)
|
|
}
|
|
if (!(w == "checkbox" || w == "radio")) {
|
|
var l = document.createElement("IMG");
|
|
l.id = "image_" + this.itemPull[a]["id"];
|
|
l.className = "sub_icon";
|
|
l.src = this.conf.icons_path + s;
|
|
n.appendChild(l)
|
|
}
|
|
} else {
|
|
n.innerHTML = " "
|
|
}
|
|
var m = document.createElement("TD");
|
|
m.className = "sub_item_text";
|
|
if (this.itemPull[a]["title"] != "") {
|
|
var v = document.createElement("DIV");
|
|
v.className = "sub_item_text";
|
|
v.innerHTML = this.itemPull[a]["title"];
|
|
m.appendChild(v)
|
|
} else {
|
|
m.innerHTML = " "
|
|
}
|
|
var h = document.createElement("TD");
|
|
h.className = "sub_item_hk";
|
|
if (this.itemPull[a]["complex"]) {
|
|
var c = document.createElement("DIV");
|
|
c.className = "complex_arrow";
|
|
c.id = "arrow_" + this.itemPull[a]["id"];
|
|
h.appendChild(c)
|
|
} else {
|
|
if (this.itemPull[a]["hotkey"].length > 0 && !this.itemPull[a]["complex"]) {
|
|
var g = document.createElement("DIV");
|
|
g.className = "sub_item_hk";
|
|
g.innerHTML = this.itemPull[a]["hotkey"];
|
|
h.appendChild(g)
|
|
} else {
|
|
h.innerHTML = " "
|
|
}
|
|
}
|
|
q.appendChild(this.conf.rtl ? h : n);
|
|
q.appendChild(m);
|
|
q.appendChild(this.conf.rtl ? n : h);
|
|
q.id = this.itemPull[a]["id"];
|
|
q.parent = this.itemPull[a]["parent"];
|
|
if (this.itemPull[a]["tip"].length > 0) {
|
|
q.title = this.itemPull[a]["tip"]
|
|
}
|
|
q.onselectstart = function(x) {
|
|
x = x || event;
|
|
if (x.preventDefault) {
|
|
x.preventDefault()
|
|
} else {
|
|
x.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
q.onmouseover = function(x) {
|
|
if (o.conf.hide_tm[this.id]) {
|
|
window.clearTimeout(o.conf.hide_tm[this.id])
|
|
}
|
|
if (o.conf.mode == "web") {
|
|
window.clearTimeout(o.conf.tm_handler)
|
|
}
|
|
if (!this._visible) {
|
|
o._redistribSubLevelSelection(this.id, this.parent)
|
|
}
|
|
this._visible = true
|
|
};
|
|
q.onmouseout = function() {
|
|
if (o.conf.mode == "web") {
|
|
if (o.conf.tm_handler) {
|
|
window.clearTimeout(o.conf.tm_handler)
|
|
}
|
|
o.conf.tm_handler = window.setTimeout(function() {
|
|
if (o && o._clearAndHide) {
|
|
o._clearAndHide()
|
|
}
|
|
}, o.conf.tm_sec, "JavaScript")
|
|
}
|
|
var x = this;
|
|
if (o.conf.hide_tm[this.id]) {
|
|
window.clearTimeout(o.conf.hide_tm[this.id])
|
|
}
|
|
o.conf.hide_tm[this.id] = window.setTimeout(function() {
|
|
x._visible = false
|
|
}, 50)
|
|
};
|
|
q.onclick = function(y) {
|
|
if (!o.checkEvent("onClick") && o.itemPull[this.id]["complex"]) {
|
|
return
|
|
}
|
|
y = y || event;
|
|
y.cancelBubble = true;
|
|
if (y.preventDefault) {
|
|
y.preventDefault()
|
|
} else {
|
|
y.returnValue = false
|
|
}
|
|
tc = (o.itemPull[this.id]["complex"] ? "c" : "-");
|
|
td = (o.itemPull[this.id]["state"] == "enabled" ? "-" : "d");
|
|
var x = {
|
|
ctrl: y.ctrlKey,
|
|
alt: y.altKey,
|
|
shift: y.shiftKey
|
|
};
|
|
switch (o.itemPull[this.id]["type"]) {
|
|
case "checkbox":
|
|
o._checkboxOnClickHandler(this.id.replace(o.idPrefix, ""), tc + td + "n", x);
|
|
break;
|
|
case "radio":
|
|
o._radioOnClickHandler(this.id.replace(o.idPrefix, ""), tc + td + "n", x);
|
|
break;
|
|
case "item":
|
|
o._doOnClick(this.id.replace(o.idPrefix, ""), tc + td + "n", x);
|
|
break
|
|
}
|
|
return false
|
|
};
|
|
var u = this.idPull["polygon_" + this.itemPull[a]["parent"]];
|
|
if (r != null) {
|
|
r++;
|
|
if (r < 0) {
|
|
r = 0
|
|
}
|
|
if (r > u.tbd.childNodes.length - 1) {
|
|
r = null
|
|
}
|
|
}
|
|
if (r != null && u.tbd.childNodes[r] != null) {
|
|
u.tbd.insertBefore(q, u.tbd.childNodes[r])
|
|
} else {
|
|
u.tbd.appendChild(q)
|
|
}
|
|
this.idPull[q.id] = q
|
|
};
|
|
dhtmlXMenuObject.prototype._renderSeparator = function(c, n) {
|
|
var a = (this.conf.context ? "SubLevelArea" : (this.itemPull[c]["parent"] == this.idPrefix + this.topId ? "TopLevel" : "SubLevelArea"));
|
|
if (a == "TopLevel" && this.conf.context) {
|
|
return
|
|
}
|
|
var l = this;
|
|
if (a != "TopLevel") {
|
|
var m = document.createElement("TR");
|
|
m.className = "sub_sep";
|
|
var g = document.createElement("TD");
|
|
g.colSpan = "3";
|
|
m.appendChild(g)
|
|
}
|
|
var h = document.createElement("DIV");
|
|
h.id = "separator_" + c;
|
|
h.className = (a == "TopLevel" ? "top_sep" : "sub_sep");
|
|
h.onselectstart = function(r) {
|
|
r = r || event;
|
|
if (r.preventDefault) {
|
|
r.preventDefault()
|
|
} else {
|
|
r.returnValue = false
|
|
}
|
|
};
|
|
h.onclick = function(s) {
|
|
s = s || event;
|
|
s.cancelBubble = true;
|
|
var r = {
|
|
ctrl: s.ctrlKey,
|
|
alt: s.altKey,
|
|
shift: s.shiftKey
|
|
};
|
|
l._doOnClick(this.id.replace("separator_" + l.idPrefix, ""), "--s", r)
|
|
};
|
|
if (a == "TopLevel") {
|
|
if (n != null) {
|
|
n++;
|
|
if (n < 0) {
|
|
n = 0
|
|
}
|
|
if (this.cont.childNodes[n] != null) {
|
|
this.cont.insertBefore(h, this.cont.childNodes[n])
|
|
} else {
|
|
this.cont.appendChild(h)
|
|
}
|
|
} else {
|
|
var q = this.cont.childNodes[this.cont.childNodes.length - 1];
|
|
if (String(q).search("TopLevel_Text") == -1) {
|
|
this.cont.appendChild(h)
|
|
} else {
|
|
this.cont.insertBefore(h, q)
|
|
}
|
|
}
|
|
this.idPull[h.id] = h
|
|
} else {
|
|
var o = this.idPull["polygon_" + this.itemPull[c]["parent"]];
|
|
if (n != null) {
|
|
n++;
|
|
if (n < 0) {
|
|
n = 0
|
|
}
|
|
if (n > o.tbd.childNodes.length - 1) {
|
|
n = null
|
|
}
|
|
}
|
|
if (n != null && o.tbd.childNodes[n] != null) {
|
|
o.tbd.insertBefore(m, o.tbd.childNodes[n])
|
|
} else {
|
|
o.tbd.appendChild(m)
|
|
}
|
|
g.appendChild(h);
|
|
this.idPull[h.id] = m
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.addNewSeparator = function(a, c) {
|
|
c = this.idPrefix + (c != null ? c : this._genStr(24));
|
|
var g = this.idPrefix + this.getParentId(a);
|
|
this._addItemIntoGlobalStrorage(c, g, "", "separator", false, "", "");
|
|
this._renderSeparator(c, this.getItemPosition(a))
|
|
};
|
|
dhtmlXMenuObject.prototype._initObj = function(u, v, n) {
|
|
if (!(u instanceof Array)) {
|
|
n = u.parentId;
|
|
if (n != null && String(n).indexOf(this.idPrefix) !== 0) {
|
|
n = this.idPrefix + String(n)
|
|
}
|
|
u = u.items
|
|
}
|
|
for (var g = 0; g < u.length; g++) {
|
|
if (typeof(u[g].id) == "undefined" || u[g].id == null) {
|
|
u[g].id = this._genStr(24)
|
|
}
|
|
if (String(u[g].id).indexOf(this.idPrefix) !== 0) {
|
|
u[g].id = this.idPrefix + String(u[g].id)
|
|
}
|
|
var h = {
|
|
type: "item",
|
|
tip: "",
|
|
hotkey: "",
|
|
state: "enabled",
|
|
imgen: "",
|
|
imgdis: ""
|
|
};
|
|
for (var w in h) {
|
|
if (typeof(u[g][w]) == "undefined") {
|
|
u[g][w] = h[w]
|
|
}
|
|
}
|
|
if (u[g].imgen == "" && u[g].img != null) {
|
|
u[g].imgen = u[g].img
|
|
}
|
|
if (u[g].imgdis == "" && u[g].img_disabled != null) {
|
|
u[g].imgdis = u[g].img_disabled
|
|
}
|
|
if (u[g].title == null && u[g].text != null) {
|
|
u[g].title = u[g].text
|
|
}
|
|
if (u[g].href != null) {
|
|
if (u[g].href.link != null) {
|
|
u[g].href_link = u[g].href.link
|
|
}
|
|
if (u[g].href.target != null) {
|
|
u[g].href_target = u[g].href.target
|
|
}
|
|
}
|
|
if (u[g].userdata != null) {
|
|
for (var w in u[g].userdata) {
|
|
this.userData[u[g].id + "_" + w] = u[g].userdata[w]
|
|
}
|
|
}
|
|
if (typeof(u[g].enabled) != "undefined" && window.dhx4.s2b(u[g].enabled) == false) {
|
|
u[g].state = "disabled"
|
|
} else {
|
|
if (typeof(u[g].disabled) != "undefined" && window.dhx4.s2b(u[g].disabled) == true) {
|
|
u[g].state = "disabled"
|
|
}
|
|
} if (typeof(u[g].parent) == "undefined") {
|
|
u[g].parent = (n != null ? n : this.idPrefix + this.topId)
|
|
}
|
|
if (u[g].type == "checkbox") {
|
|
u[g].checked = window.dhx4.s2b(u[g].checked);
|
|
u[g].imgen = u[g].imgdis = "chbx_" + (u[g].checked ? "1" : "0")
|
|
}
|
|
if (u[g].type == "radio") {
|
|
u[g].checked = window.dhx4.s2b(u[g].checked);
|
|
u[g].imgen = u[g].imgdis = "rdbt_" + (u[g].checked ? "1" : "0");
|
|
if (typeof(u[g].group) == "undefined" || u[g].group == null) {
|
|
u[g].group = this._genStr(24)
|
|
}
|
|
if (this.radio[u[g].group] == null) {
|
|
this.radio[u[g].group] = []
|
|
}
|
|
this.radio[u[g].group].push(u[g].id)
|
|
}
|
|
this.itemPull[u[g].id] = u[g];
|
|
if (u[g].items != null && u[g].items.length > 0) {
|
|
this.itemPull[u[g].id].complex = true;
|
|
this._initObj(u[g].items, true, u[g].id)
|
|
} else {
|
|
if (this.conf.dload && u[g].complex == true) {
|
|
this.itemPull[u[g].id].loaded = "no"
|
|
}
|
|
}
|
|
this.itemPull[u[g].id].items = null
|
|
}
|
|
if (v !== true) {
|
|
if (this.conf.dload == true) {
|
|
if (n == null) {
|
|
this._initTopLevelMenu()
|
|
} else {
|
|
this._addSubMenuPolygon(n, n);
|
|
if (this.conf.selected == n) {
|
|
var s = (this.itemPull[n].parent == this.idPrefix + this.topId);
|
|
var c = (s && !this.conf.context ? this.conf.dir_toplv : this.conf.dir_sublv);
|
|
var l = false;
|
|
if (s && this.conf.top_mode && this.conf.mode == "web" && !this.conf.context) {
|
|
var x = this.idPull[n];
|
|
if (x._mouseOver == true) {
|
|
var m = this.conf.top_tmtime - (new Date().getTime() - x._dynLoadTM);
|
|
if (m > 1) {
|
|
var r = n;
|
|
var o = this;
|
|
x._menuOpenTM = window.setTimeout(function() {
|
|
o._showPolygon(r, c);
|
|
o = r = null
|
|
}, m);
|
|
l = true
|
|
}
|
|
}
|
|
}
|
|
if (!l) {
|
|
this._showPolygon(n, c)
|
|
}
|
|
}
|
|
this.itemPull[n].loaded = "yes";
|
|
if (this.conf.dload_icon == true) {
|
|
this._updateLoaderIcon(n, false)
|
|
}
|
|
}
|
|
} else {
|
|
this._init()
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._xmlToJson = function(l, h) {
|
|
var n = [];
|
|
if (h == null) {
|
|
var o = l.getElementsByTagName(this.conf.tags.root);
|
|
if (o == null || o.length == 0) {
|
|
return data
|
|
}
|
|
o = o[0]
|
|
} else {
|
|
o = l
|
|
} if (o.getAttribute("parentId") != null) {
|
|
h = this.idPrefix + o.getAttribute("parentId")
|
|
}
|
|
for (var c = 0; c < o.childNodes.length; c++) {
|
|
if (typeof(o.childNodes[c].tagName) != "undefined" && String(o.childNodes[c].tagName).toLowerCase() == this.conf.tags.item) {
|
|
var a = o.childNodes[c];
|
|
var v = {
|
|
id: this.idPrefix + (a.getAttribute("id") || this._genStr(24)),
|
|
title: a.getAttribute("text") || "",
|
|
imgen: a.getAttribute("img") || "",
|
|
imgdis: a.getAttribute("imgdis") || "",
|
|
tip: "",
|
|
hotkey: "",
|
|
type: a.getAttribute("type") || "item"
|
|
};
|
|
if (a.getAttribute("cssNormal") != null) {
|
|
v.cssNormal = a.getAttribute("cssNormal")
|
|
}
|
|
if (v.type == "checkbox") {
|
|
v.checked = a.getAttribute("checked")
|
|
}
|
|
if (v.type == "radio") {
|
|
v.checked = a.getAttribute("checked");
|
|
v.group = a.getAttribute("group")
|
|
}
|
|
v.state = "enabled";
|
|
if (a.getAttribute("enabled") != null && window.dhx4.s2b(a.getAttribute("enabled")) == false) {
|
|
v.state = "disabled"
|
|
} else {
|
|
if (a.getAttribute("disabled") != null && window.dhx4.s2b(a.getAttribute("disabled")) == true) {
|
|
v.state = "disabled"
|
|
}
|
|
}
|
|
v.parent = (h != null ? h : this.idPrefix + this.topId);
|
|
if (this.conf.dload) {
|
|
v.complex = (a.getAttribute("complex") != null);
|
|
if (v.complex) {
|
|
v.loaded = "no"
|
|
}
|
|
} else {
|
|
var g = this._xmlToJson(a, v.id);
|
|
v.items = g.items;
|
|
v.complex = (v.items.length > 0)
|
|
}
|
|
for (var s = 0; s < a.childNodes.length; s++) {
|
|
if (typeof(a.childNodes[s].tagName) != "undefined") {
|
|
var u = String(a.childNodes[s].tagName || "").toLowerCase();
|
|
if (u == this.conf.tags.userdata) {
|
|
var m = a.childNodes[s];
|
|
if (m.getAttribute("name") != null) {
|
|
this.userData[v.id + "_" + m.getAttribute("name")] = (m.firstChild != null && m.firstChild.nodeValue != null ? m.firstChild.nodeValue : "")
|
|
}
|
|
}
|
|
if (u == this.conf.tags.text_ext) {
|
|
v.title = a.childNodes[s].firstChild.nodeValue
|
|
}
|
|
if (u == this.conf.tags.tooltip) {
|
|
v.tip = a.childNodes[s].firstChild.nodeValue
|
|
}
|
|
if (u == this.conf.tags.hotkey) {
|
|
v.hotkey = a.childNodes[s].firstChild.nodeValue
|
|
}
|
|
if (u == this.conf.tags.href && v.type == "item") {
|
|
v.href_link = a.childNodes[s].firstChild.nodeValue;
|
|
if (a.childNodes[s].getAttribute("target") != null) {
|
|
v.href_target = a.childNodes[s].getAttribute("target")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
n.push(v)
|
|
}
|
|
}
|
|
var a = {
|
|
parentId: h,
|
|
items: n
|
|
};
|
|
return a
|
|
};
|
|
dhtmlXMenuObject.prototype.enableDynamicLoading = function(a, c) {
|
|
this.conf.dload = true;
|
|
this.conf.dload_url = a;
|
|
this.conf.dload_sign = (String(this.conf.dload_url).search(/\?/) == -1 ? "?" : "&");
|
|
this.conf.dload_icon = c;
|
|
this._init()
|
|
};
|
|
dhtmlXMenuObject.prototype._updateLoaderIcon = function(h, g) {
|
|
if (this.idPull[h] == null) {
|
|
return
|
|
}
|
|
if (String(this.idPull[h].className).search("TopLevel_Item") >= 0) {
|
|
return
|
|
}
|
|
var c = (this.conf.rtl ? 0 : 2);
|
|
if (!this.idPull[h].childNodes[c]) {
|
|
return
|
|
}
|
|
if (!this.idPull[h].childNodes[c].childNodes[0]) {
|
|
return
|
|
}
|
|
var a = this.idPull[h].childNodes[c].childNodes[0];
|
|
if (String(a.className).search("complex_arrow") === 0) {
|
|
a.className = "complex_arrow" + (g ? "_loading" : "")
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.addNewSibling = function(h, l, a, c, g, o) {
|
|
var n = this.idPrefix + (l != null ? l : this._genStr(24));
|
|
var m = this.idPrefix + (h != null ? this.getParentId(h) : this.topId);
|
|
this._addItemIntoGlobalStrorage(n, m, a, "item", c, g, o);
|
|
if ((m == this.idPrefix + this.topId) && (!this.conf.context)) {
|
|
this._renderToplevelItem(n, this.getItemPosition(h))
|
|
} else {
|
|
this._renderSublevelItem(n, this.getItemPosition(h))
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.addNewChild = function(n, m, h, a, c, g, l) {
|
|
if (n == null) {
|
|
if (this.conf.context) {
|
|
n = this.topId
|
|
} else {
|
|
this.addNewSibling(n, h, a, c, g, l);
|
|
if (m != null) {
|
|
this.setItemPosition(h, m)
|
|
}
|
|
return
|
|
}
|
|
}
|
|
h = this.idPrefix + (h != null ? h : this._genStr(24));
|
|
if (this.setHotKey) {
|
|
this.setHotKey(n, "")
|
|
}
|
|
n = this.idPrefix + n;
|
|
this._addItemIntoGlobalStrorage(h, n, a, "item", c, g, l);
|
|
if (this.idPull["polygon_" + n] == null) {
|
|
this._renderSublevelPolygon(n, n)
|
|
}
|
|
this._renderSublevelItem(h, m - 1);
|
|
this._redefineComplexState(n)
|
|
};
|
|
dhtmlXMenuObject.prototype.removeItem = function(h, m, l) {
|
|
if (!m) {
|
|
h = this.idPrefix + h
|
|
}
|
|
var n = null;
|
|
if (h != this.idPrefix + this.topId) {
|
|
if (this.itemPull[h] == null) {
|
|
return
|
|
}
|
|
if (this.idPull["polygon_" + h] && this.idPull["polygon_" + h]._tmShow) {
|
|
window.clearTimeout(this.idPull["polygon_" + h]._tmShow)
|
|
}
|
|
var v = this.itemPull[h]["type"];
|
|
if (v == "separator") {
|
|
var u = this.idPull["separator_" + h];
|
|
if (this.itemPull[h]["parent"] == this.idPrefix + this.topId) {
|
|
u.onclick = null;
|
|
u.onselectstart = null;
|
|
u.id = null;
|
|
u.parentNode.removeChild(u)
|
|
} else {
|
|
u.childNodes[0].childNodes[0].onclick = null;
|
|
u.childNodes[0].childNodes[0].onselectstart = null;
|
|
u.childNodes[0].childNodes[0].id = null;
|
|
u.childNodes[0].removeChild(u.childNodes[0].childNodes[0]);
|
|
u.removeChild(u.childNodes[0]);
|
|
u.parentNode.removeChild(u)
|
|
}
|
|
this.idPull["separator_" + h] = null;
|
|
this.itemPull[h] = null;
|
|
delete this.idPull["separator_" + h];
|
|
delete this.itemPull[h];
|
|
u = null
|
|
} else {
|
|
n = this.itemPull[h]["parent"];
|
|
var u = this.idPull[h];
|
|
u.onclick = null;
|
|
u.oncontextmenu = null;
|
|
u.onmouseover = null;
|
|
u.onmouseout = null;
|
|
u.onselectstart = null;
|
|
u.id = null;
|
|
while (u.childNodes.length > 0) {
|
|
u.removeChild(u.childNodes[0])
|
|
}
|
|
u.parentNode.removeChild(u);
|
|
this.idPull[h] = null;
|
|
this.itemPull[h] = null;
|
|
delete this.idPull[h];
|
|
delete this.itemPull[h];
|
|
u = null
|
|
}
|
|
v = null
|
|
}
|
|
for (var r in this.itemPull) {
|
|
if (this.itemPull[r]["parent"] == h) {
|
|
this.removeItem(r, true, true)
|
|
}
|
|
}
|
|
var s = new Array(h);
|
|
if (n != null && !l) {
|
|
if (this.idPull["polygon_" + n] != null) {
|
|
if (this.idPull["polygon_" + n].tbd.childNodes.length == 0) {
|
|
s.push(n);
|
|
this._updateItemComplexState(n, false, false)
|
|
}
|
|
}
|
|
}
|
|
for (var c = 0; c < s.length; c++) {
|
|
if (this.idPull["polygon_" + s[c]]) {
|
|
var g = this.idPull["polygon_" + s[c]];
|
|
g.onclick = null;
|
|
g.oncontextmenu = null;
|
|
g.tbl.removeChild(g.tbd);
|
|
g.tbd = null;
|
|
g.childNodes[1].removeChild(g.tbl);
|
|
g.tbl = null;
|
|
g.id = null;
|
|
g.parentNode.removeChild(g);
|
|
g = null;
|
|
if (window.dhx4.isIE6) {
|
|
var o = "polygon_" + s[c] + "_ie6cover";
|
|
if (this.idPull[o] != null) {
|
|
document.body.removeChild(this.idPull[o]);
|
|
delete this.idPull[o]
|
|
}
|
|
}
|
|
if (this.idPull["arrowup_" + h] != null && this._removeArrow) {
|
|
this._removeArrow("arrowup_" + h)
|
|
}
|
|
if (this.idPull["arrowdown_" + h] != null && this._removeArrow) {
|
|
this._removeArrow("arrowdown_" + h)
|
|
}
|
|
this.idPull["polygon_" + s[c]] = null;
|
|
delete this.idPull["polygon_" + s[c]]
|
|
}
|
|
}
|
|
s = null;
|
|
if (this.conf.skin == "dhx_terrace" && arguments.length == 1) {
|
|
this._improveTerraceSkin()
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._addItemIntoGlobalStrorage = function(o, a, g, n, h, c, m) {
|
|
var l = {
|
|
id: o,
|
|
title: g,
|
|
imgen: (c != null ? c : ""),
|
|
imgdis: (m != null ? m : ""),
|
|
type: n,
|
|
state: (h == true ? "disabled" : "enabled"),
|
|
parent: a,
|
|
complex: false,
|
|
hotkey: "",
|
|
tip: ""
|
|
};
|
|
this.itemPull[l.id] = l
|
|
};
|
|
dhtmlXMenuObject.prototype.renderAsContextMenu = function() {
|
|
this.conf.context = true;
|
|
if (this.base._autoSkinUpdate == true) {
|
|
this.base.className = this.base.className.replace("dhtmlxMenu_" + this.conf.skin + "_Middle", "");
|
|
this.base._autoSkinUpdate = false
|
|
}
|
|
if (this.conf.ctx_baseid != null) {
|
|
this.addContextZone(this.conf.ctx_baseid)
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.addContextZone = function(c) {
|
|
if (c == document.body) {
|
|
c = "document.body." + this.idPrefix;
|
|
var h = document.body
|
|
} else {
|
|
var h = document.getElementById(c)
|
|
}
|
|
var m = false;
|
|
for (var g in this.conf.ctx_zones) {
|
|
m = m || (g == c) || (this.conf.ctx_zones[g] == h)
|
|
}
|
|
if (m == true) {
|
|
return false
|
|
}
|
|
this.conf.ctx_zones[c] = h;
|
|
var l = this;
|
|
if (window.dhx4.isOpera) {
|
|
this.operaContext = function(a) {
|
|
l._doOnContextMenuOpera(a, l)
|
|
};
|
|
h.addEventListener("mouseup", this.operaContext, false)
|
|
} else {
|
|
if (h.oncontextmenu != null && !h._oldContextMenuHandler) {
|
|
h._oldContextMenuHandler = h.oncontextmenu
|
|
}
|
|
h.oncontextmenu = function(n) {
|
|
for (var a in dhtmlXMenuObject.prototype.liveInst) {
|
|
if (a != l.conf.live_id) {
|
|
if (dhtmlXMenuObject.prototype.liveInst[a].context) {
|
|
dhtmlXMenuObject.prototype.liveInst[a]._hideContextMenu()
|
|
}
|
|
}
|
|
}
|
|
n = n || event;
|
|
n.cancelBubble = true;
|
|
if (n.preventDefault) {
|
|
n.preventDefault()
|
|
} else {
|
|
n.returnValue = false
|
|
}
|
|
l._doOnContextBeforeCall(n, this);
|
|
return false
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._doOnContextMenuOpera = function(g, a) {
|
|
for (var c in dhtmlXMenuObject.prototype.liveInst) {
|
|
if (c != a.conf.live_id) {
|
|
if (dhtmlXMenuObject.prototype.liveInst[c].context) {
|
|
dhtmlXMenuObject.prototype.liveInst[c]._hideContextMenu()
|
|
}
|
|
}
|
|
}
|
|
g.cancelBubble = true;
|
|
if (g.preventDefault) {
|
|
g.preventDefault()
|
|
} else {
|
|
g.returnValue = false
|
|
} if (g.button == 0 && g.ctrlKey == true) {
|
|
a._doOnContextBeforeCall(g, this)
|
|
}
|
|
return false
|
|
};
|
|
dhtmlXMenuObject.prototype.removeContextZone = function(a) {
|
|
if (!this.isContextZone(a)) {
|
|
return false
|
|
}
|
|
if (a == document.body) {
|
|
a = "document.body." + this.idPrefix
|
|
}
|
|
var c = this.conf.ctx_zones[a];
|
|
if (window.dhx4.isOpera) {
|
|
c.removeEventListener("mouseup", this.operaContext, false)
|
|
} else {
|
|
c.oncontextmenu = (c._oldContextMenuHandler != null ? c._oldContextMenuHandler : null);
|
|
c._oldContextMenuHandler = null
|
|
}
|
|
try {
|
|
this.conf.ctx_zones[a] = null;
|
|
delete this.conf.ctx_zones[a]
|
|
} catch (g) {}
|
|
return true
|
|
};
|
|
dhtmlXMenuObject.prototype.isContextZone = function(a) {
|
|
if (a == document.body && this.conf.ctx_zones["document.body." + this.idPrefix] != null) {
|
|
return true
|
|
}
|
|
var c = false;
|
|
if (this.conf.ctx_zones[a] != null) {
|
|
if (this.conf.ctx_zones[a] == document.getElementById(a)) {
|
|
c = true
|
|
}
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXMenuObject.prototype._isContextMenuVisible = function() {
|
|
if (this.idPull["polygon_" + this.idPrefix + this.topId] == null) {
|
|
return false
|
|
}
|
|
return (this.idPull["polygon_" + this.idPrefix + this.topId].style.display == "")
|
|
};
|
|
dhtmlXMenuObject.prototype._showContextMenu = function(c, g, a) {
|
|
this._clearAndHide();
|
|
if (this.idPull["polygon_" + this.idPrefix + this.topId] == null) {
|
|
return false
|
|
}
|
|
window.clearTimeout(this.conf.tm_handler);
|
|
this.idPull[this.idPrefix + this.topId] = new Array(c, g);
|
|
this._showPolygon(this.idPrefix + this.topId, "bottom");
|
|
this.callEvent("onContextMenu", [a])
|
|
};
|
|
dhtmlXMenuObject.prototype._hideContextMenu = function() {
|
|
if (this.idPull["polygon_" + this.idPrefix + this.topId] == null) {
|
|
return false
|
|
}
|
|
this._clearAndHide();
|
|
this._hidePolygon(this.idPrefix + this.topId)
|
|
};
|
|
dhtmlXMenuObject.prototype._doOnContextBeforeCall = function(l, n) {
|
|
this.conf.ctx_zoneid = n.id;
|
|
this._clearAndHide();
|
|
this._hideContextMenu();
|
|
var h = (l.srcElement || l.target);
|
|
var c = (window.dhx4.isIE || window.dhx4.isOpera || window.dhx4.isKHTML ? l.offsetX : l.layerX);
|
|
var a = (window.dhx4.isIE || window.dhx4.isOpera || window.dhx4.isKHTML ? l.offsetY : l.layerY);
|
|
var m = window.dhx4.absLeft(h) + c;
|
|
var g = window.dhx4.absTop(h) + a;
|
|
if (this.checkEvent("onBeforeContextMenu")) {
|
|
if (this.callEvent("onBeforeContextMenu", [n.id, l])) {
|
|
if (this.conf.ctx_autoshow) {
|
|
this._showContextMenu(m, g, n.id);
|
|
this.callEvent("onAfterContextMenu", [n.id, l])
|
|
}
|
|
}
|
|
} else {
|
|
if (this.conf.ctx_autoshow) {
|
|
this._showContextMenu(m, g, n.id);
|
|
this.callEvent("onAfterContextMenu", [n.id])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.showContextMenu = function(a, c) {
|
|
this._showContextMenu(a, c, false)
|
|
};
|
|
dhtmlXMenuObject.prototype.hideContextMenu = function() {
|
|
this._hideContextMenu()
|
|
};
|
|
dhtmlXMenuObject.prototype.setAutoShowMode = function(a) {
|
|
this.conf.ctx_autoshow = (a == true ? true : false)
|
|
};
|
|
dhtmlXMenuObject.prototype.setAutoHideMode = function(a) {
|
|
this.conf.ctx_autohide = (a == true ? true : false)
|
|
};
|
|
dhtmlXMenuObject.prototype.setContextMenuHideAllMode = function(a) {
|
|
this.conf.ctx_hideall = (a == true ? true : false)
|
|
};
|
|
dhtmlXMenuObject.prototype.getContextMenuHideAllMode = function() {
|
|
return this.conf.ctx_hideall
|
|
};
|
|
dhtmlXMenuObject.prototype._improveTerraceSkin = function() {
|
|
for (var g in this.itemPull) {
|
|
if (this.itemPull[g].parent == this.idPrefix + this.topId && this.idPull[g] != null) {
|
|
var l = false;
|
|
var h = false;
|
|
if (this.idPull[g].parentNode.firstChild == this.idPull[g]) {
|
|
l = true
|
|
}
|
|
if (this.idPull[g].parentNode.lastChild == this.idPull[g]) {
|
|
h = true
|
|
}
|
|
for (var c in this.itemPull) {
|
|
if (this.itemPull[c].type == "separator" && this.itemPull[c].parent == this.idPrefix + this.topId) {
|
|
if (this.idPull[g].nextSibling == this.idPull["separator_" + c]) {
|
|
h = true
|
|
}
|
|
if (this.idPull[g].previousSibling == this.idPull["separator_" + c]) {
|
|
l = true
|
|
}
|
|
}
|
|
}
|
|
this.idPull[g].style.borderLeftWidth = (l ? "1px" : "0px");
|
|
this.idPull[g].style.borderTopLeftRadius = this.idPull[g].style.borderBottomLeftRadius = (l ? "3px" : "0px");
|
|
this.idPull[g].style.borderTopRightRadius = this.idPull[g].style.borderBottomRightRadius = (h ? "3px" : "0px");
|
|
this.idPull[g]._bl = l;
|
|
this.idPull[g]._br = h
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._improveTerraceButton = function(c, a) {
|
|
if (a) {
|
|
this.idPull[c].style.borderBottomLeftRadius = (this.idPull[c]._bl ? "3px" : "0px");
|
|
this.idPull[c].style.borderBottomRightRadius = (this.idPull[c]._br ? "3px" : "0px")
|
|
} else {
|
|
this.idPull[c].style.borderBottomLeftRadius = "0px";
|
|
this.idPull[c].style.borderBottomRightRadius = "0px"
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.setItemEnabled = function(a) {
|
|
this._changeItemState(a, "enabled", this._getItemLevelType(a))
|
|
};
|
|
dhtmlXMenuObject.prototype.setItemDisabled = function(a) {
|
|
this._changeItemState(a, "disabled", this._getItemLevelType(a))
|
|
};
|
|
dhtmlXMenuObject.prototype.isItemEnabled = function(a) {
|
|
return (this.itemPull[this.idPrefix + a] != null ? (this.itemPull[this.idPrefix + a]["state"] == "enabled") : false)
|
|
};
|
|
dhtmlXMenuObject.prototype._changeItemState = function(l, h, c) {
|
|
var g = false;
|
|
var a = this.idPrefix + l;
|
|
if ((this.itemPull[a] != null) && (this.idPull[a] != null)) {
|
|
if (this.itemPull[a]["state"] != h) {
|
|
this.itemPull[a]["state"] = h;
|
|
if (this.itemPull[a]["parent"] == this.idPrefix + this.topId && !this.conf.context) {
|
|
this.idPull[a].className = "dhtmlxMenu_" + this.conf.skin + "_TopLevel_Item_" + (this.itemPull[a]["state"] == "enabled" ? "Normal" : "Disabled")
|
|
} else {
|
|
this.idPull[a].className = "sub_item" + (this.itemPull[a]["state"] == "enabled" ? "" : "_dis")
|
|
}
|
|
this._updateItemComplexState(this.idPrefix + l, this.itemPull[this.idPrefix + l]["complex"], false);
|
|
this._updateItemImage(l, c);
|
|
if ((this.idPrefix + this.conf.last_click == a) && (c != "TopLevel")) {
|
|
this._redistribSubLevelSelection(a, this.itemPull[a]["parent"])
|
|
}
|
|
if (c == "TopLevel" && !this.conf.context) {}
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXMenuObject.prototype.getItemText = function(a) {
|
|
return (this.itemPull[this.idPrefix + a] != null ? this.itemPull[this.idPrefix + a]["title"] : "")
|
|
};
|
|
dhtmlXMenuObject.prototype.setItemText = function(l, h) {
|
|
l = this.idPrefix + l;
|
|
if ((this.itemPull[l] != null) && (this.idPull[l] != null)) {
|
|
this._clearAndHide();
|
|
this.itemPull[l]["title"] = h;
|
|
if (this.itemPull[l]["parent"] == this.idPrefix + this.topId && !this.conf.context) {
|
|
var g = null;
|
|
for (var a = 0; a < this.idPull[l].childNodes.length; a++) {
|
|
try {
|
|
if (this.idPull[l].childNodes[a].className == "top_level_text") {
|
|
g = this.idPull[l].childNodes[a]
|
|
}
|
|
} catch (c) {}
|
|
}
|
|
if (String(this.itemPull[l]["title"]).length == "" || this.itemPull[l]["title"] == null) {
|
|
if (g != null) {
|
|
g.parentNode.removeChild(g)
|
|
}
|
|
} else {
|
|
if (!g) {
|
|
g = document.createElement("DIV");
|
|
g.className = "top_level_text";
|
|
if (this.conf.rtl && this.idPull[l].childNodes.length > 0) {
|
|
this.idPull[l].insertBefore(g, this.idPull[l].childNodes[0])
|
|
} else {
|
|
this.idPull[l].appendChild(g)
|
|
}
|
|
}
|
|
g.innerHTML = this.itemPull[l]["title"]
|
|
}
|
|
} else {
|
|
var g = null;
|
|
for (var a = 0; a < this.idPull[l].childNodes[1].childNodes.length; a++) {
|
|
if (String(this.idPull[l].childNodes[1].childNodes[a].className || "") == "sub_item_text") {
|
|
g = this.idPull[l].childNodes[1].childNodes[a]
|
|
}
|
|
}
|
|
if (String(this.itemPull[l]["title"]).length == "" || this.itemPull[l]["title"] == null) {
|
|
if (g) {
|
|
g.parentNode.removeChild(g);
|
|
g = null;
|
|
this.idPull[l].childNodes[1].innerHTML = " "
|
|
}
|
|
} else {
|
|
if (!g) {
|
|
g = document.createElement("DIV");
|
|
g.className = "sub_item_text";
|
|
this.idPull[l].childNodes[1].innerHTML = "";
|
|
this.idPull[l].childNodes[1].appendChild(g)
|
|
}
|
|
g.innerHTML = this.itemPull[l]["title"]
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.loadFromHTML = function(g, m, h) {
|
|
var c = this.conf.tags.item;
|
|
this.conf.tags.item = "div";
|
|
var l = (typeof(g) == "string" ? document.getElementById(g) : g);
|
|
var a = this._xmlToJson(l, this.idPrefix + this.topId);
|
|
this._initObj(a);
|
|
this.conf.tags.item = c;
|
|
if (m) {
|
|
l.parentNode.removeChild(l)
|
|
}
|
|
l = objOd = null;
|
|
if (onload != null) {
|
|
if (typeof(h) == "function") {
|
|
h()
|
|
} else {
|
|
if (typeof(window[h]) == "function") {
|
|
window[h]()
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.hideItem = function(a) {
|
|
this._changeItemVisible(a, false)
|
|
};
|
|
dhtmlXMenuObject.prototype.showItem = function(a) {
|
|
this._changeItemVisible(a, true)
|
|
};
|
|
dhtmlXMenuObject.prototype.isItemHidden = function(c) {
|
|
var a = null;
|
|
if (this.idPull[this.idPrefix + c] != null) {
|
|
a = (this.idPull[this.idPrefix + c].style.display == "none")
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXMenuObject.prototype._changeItemVisible = function(g, c) {
|
|
var a = this.idPrefix + g;
|
|
if (this.itemPull[a] == null) {
|
|
return
|
|
}
|
|
if (this.itemPull[a]["type"] == "separator") {
|
|
a = "separator_" + a
|
|
}
|
|
if (this.idPull[a] == null) {
|
|
return
|
|
}
|
|
this.idPull[a].style.display = (c ? "" : "none");
|
|
this._redefineComplexState(this.itemPull[this.idPrefix + g]["parent"])
|
|
};
|
|
dhtmlXMenuObject.prototype.setUserData = function(g, a, c) {
|
|
this.userData[this.idPrefix + g + "_" + a] = c
|
|
};
|
|
dhtmlXMenuObject.prototype.getUserData = function(c, a) {
|
|
return (this.userData[this.idPrefix + c + "_" + a] != null ? this.userData[this.idPrefix + c + "_" + a] : null)
|
|
};
|
|
dhtmlXMenuObject.prototype.setOpenMode = function(a) {
|
|
this.conf.mode = (a == "win" ? "win" : "web")
|
|
};
|
|
dhtmlXMenuObject.prototype.setWebModeTimeout = function(a) {
|
|
this.conf.tm_sec = (!isNaN(a) ? a : 400)
|
|
};
|
|
dhtmlXMenuObject.prototype.getItemImage = function(c) {
|
|
var a = new Array(null, null);
|
|
c = this.idPrefix + c;
|
|
if (this.itemPull[c]["type"] == "item") {
|
|
a[0] = this.itemPull[c]["imgen"];
|
|
a[1] = this.itemPull[c]["imgdis"]
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXMenuObject.prototype.setItemImage = function(g, a, c) {
|
|
if (this.itemPull[this.idPrefix + g]["type"] != "item") {
|
|
return
|
|
}
|
|
this.itemPull[this.idPrefix + g]["imgen"] = a;
|
|
this.itemPull[this.idPrefix + g]["imgdis"] = c;
|
|
this._updateItemImage(g, this._getItemLevelType(g))
|
|
};
|
|
dhtmlXMenuObject.prototype.clearItemImage = function(a) {
|
|
this.setItemImage(a, "", "")
|
|
};
|
|
dhtmlXMenuObject.prototype.setVisibleArea = function(c, a, h, g) {
|
|
this.conf.v_enabled = true;
|
|
this.conf.v.x1 = c;
|
|
this.conf.v.x2 = a;
|
|
this.conf.v.y1 = h;
|
|
this.conf.v.y2 = g
|
|
};
|
|
dhtmlXMenuObject.prototype.setTooltip = function(c, a) {
|
|
c = this.idPrefix + c;
|
|
if (!(this.itemPull[c] != null && this.idPull[c] != null)) {
|
|
return
|
|
}
|
|
this.idPull[c].title = (a.length > 0 ? a : null);
|
|
this.itemPull[c]["tip"] = a
|
|
};
|
|
dhtmlXMenuObject.prototype.getTooltip = function(a) {
|
|
if (this.itemPull[this.idPrefix + a] == null) {
|
|
return null
|
|
}
|
|
return this.itemPull[this.idPrefix + a]["tip"]
|
|
};
|
|
dhtmlXMenuObject.prototype.setTopText = function(a) {
|
|
if (this.conf.context) {
|
|
return
|
|
}
|
|
if (this._topText == null) {
|
|
this._topText = document.createElement("DIV");
|
|
this._topText.className = "dhtmlxMenu_TopLevel_Text_" + (this.conf.rtl ? "left" : (this.conf.align == "left" ? "right" : "left"));
|
|
this.base.appendChild(this._topText)
|
|
}
|
|
this._topText.innerHTML = a
|
|
};
|
|
dhtmlXMenuObject.prototype.setAlign = function(a) {
|
|
if (this.conf.align == a) {
|
|
return
|
|
}
|
|
if (a == "left" || a == "right") {
|
|
this.conf.align = a;
|
|
if (this.cont) {
|
|
this.cont.className = (this.conf.align == "right" ? "align_right" : "align_left")
|
|
}
|
|
if (this._topText != null) {
|
|
this._topText.className = "dhtmlxMenu_TopLevel_Text_" + (this.conf.align == "left" ? "right" : "left")
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.setHref = function(g, a, c) {
|
|
if (this.itemPull[this.idPrefix + g] == null) {
|
|
return
|
|
}
|
|
this.itemPull[this.idPrefix + g]["href_link"] = a;
|
|
if (c != null) {
|
|
this.itemPull[this.idPrefix + g]["href_target"] = c
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.clearHref = function(a) {
|
|
if (this.itemPull[this.idPrefix + a] == null) {
|
|
return
|
|
}
|
|
delete this.itemPull[this.idPrefix + a]["href_link"];
|
|
delete this.itemPull[this.idPrefix + a]["href_target"]
|
|
};
|
|
dhtmlXMenuObject.prototype.getCircuit = function(c) {
|
|
var a = new Array(c);
|
|
while (this.getParentId(c) != this.topId) {
|
|
c = this.getParentId(c);
|
|
a[a.length] = c
|
|
}
|
|
return a.reverse()
|
|
};
|
|
dhtmlXMenuObject.prototype._getCheckboxState = function(a) {
|
|
if (this.itemPull[this.idPrefix + a] == null) {
|
|
return null
|
|
}
|
|
return this.itemPull[this.idPrefix + a]["checked"]
|
|
};
|
|
dhtmlXMenuObject.prototype._setCheckboxState = function(c, a) {
|
|
if (this.itemPull[this.idPrefix + c] == null) {
|
|
return
|
|
}
|
|
this.itemPull[this.idPrefix + c]["checked"] = a
|
|
};
|
|
dhtmlXMenuObject.prototype._updateCheckboxImage = function(c) {
|
|
if (this.idPull[this.idPrefix + c] == null) {
|
|
return
|
|
}
|
|
this.itemPull[this.idPrefix + c]["imgen"] = "chbx_" + (this._getCheckboxState(c) ? "1" : "0");
|
|
this.itemPull[this.idPrefix + c]["imgdis"] = this.itemPull[this.idPrefix + c]["imgen"];
|
|
try {
|
|
this.idPull[this.idPrefix + c].childNodes[(this.conf.rtl ? 2 : 0)].childNodes[0].className = "sub_icon " + this.itemPull[this.idPrefix + c]["imgen"]
|
|
} catch (a) {}
|
|
};
|
|
dhtmlXMenuObject.prototype._checkboxOnClickHandler = function(h, a, c) {
|
|
if (a.charAt(1) == "d") {
|
|
return
|
|
}
|
|
if (this.itemPull[this.idPrefix + h] == null) {
|
|
return
|
|
}
|
|
var g = this._getCheckboxState(h);
|
|
if (this.checkEvent("onCheckboxClick")) {
|
|
if (this.callEvent("onCheckboxClick", [h, g, this.conf.ctx_zoneid, c])) {
|
|
this.setCheckboxState(h, !g)
|
|
}
|
|
} else {
|
|
this.setCheckboxState(h, !g)
|
|
} if (this.checkEvent("onClick")) {
|
|
this.callEvent("onClick", [h])
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.setCheckboxState = function(c, a) {
|
|
this._setCheckboxState(c, a);
|
|
this._updateCheckboxImage(c)
|
|
};
|
|
dhtmlXMenuObject.prototype.getCheckboxState = function(a) {
|
|
return this._getCheckboxState(a)
|
|
};
|
|
dhtmlXMenuObject.prototype.addCheckbox = function(o, h, q, r, s, a, l) {
|
|
if (this.conf.context && h == this.topId) {} else {
|
|
if (this.itemPull[this.idPrefix + h] == null) {
|
|
return
|
|
}
|
|
if (o == "child" && this.itemPull[this.idPrefix + h]["type"] != "item") {
|
|
return
|
|
}
|
|
}
|
|
var m = "chbx_" + (a ? "1" : "0");
|
|
var g = m;
|
|
if (o == "sibling") {
|
|
var c = this.idPrefix + (r != null ? r : this._genStr(24));
|
|
var n = this.idPrefix + this.getParentId(h);
|
|
this._addItemIntoGlobalStrorage(c, n, s, "checkbox", l, m, g);
|
|
this.itemPull[c]["checked"] = a;
|
|
this._renderSublevelItem(c, this.getItemPosition(h))
|
|
} else {
|
|
var c = this.idPrefix + (r != null ? r : this._genStr(24));
|
|
var n = this.idPrefix + h;
|
|
this._addItemIntoGlobalStrorage(c, n, s, "checkbox", l, m, g);
|
|
this.itemPull[c]["checked"] = a;
|
|
if (this.idPull["polygon_" + n] == null) {
|
|
this._renderSublevelPolygon(n, n)
|
|
}
|
|
this._renderSublevelItem(c, q - 1);
|
|
this._redefineComplexState(n)
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.setHotKey = function(m, a) {
|
|
m = this.idPrefix + m;
|
|
if (!(this.itemPull[m] != null && this.idPull[m] != null)) {
|
|
return
|
|
}
|
|
if (this.itemPull[m]["parent"] == this.idPrefix + this.topId && !this.conf.context) {
|
|
return
|
|
}
|
|
if (this.itemPull[m]["complex"]) {
|
|
return
|
|
}
|
|
var c = this.itemPull[m]["type"];
|
|
if (!(c == "item" || c == "checkbox" || c == "radio")) {
|
|
return
|
|
}
|
|
var l = null;
|
|
try {
|
|
if (this.idPull[m].childNodes[this.conf.rtl ? 0 : 2].childNodes[0].className == "sub_item_hk") {
|
|
l = this.idPull[m].childNodes[this.conf.rtl ? 0 : 2].childNodes[0]
|
|
}
|
|
} catch (h) {}
|
|
if (a.length == 0) {
|
|
this.itemPull[m]["hotkey_backup"] = this.itemPull[m]["hotkey"];
|
|
this.itemPull[m]["hotkey"] = "";
|
|
if (l != null) {
|
|
l.parentNode.removeChild(l)
|
|
}
|
|
} else {
|
|
this.itemPull[m]["hotkey"] = a;
|
|
this.itemPull[m]["hotkey_backup"] = null;
|
|
if (l == null) {
|
|
l = document.createElement("DIV");
|
|
l.className = "sub_item_hk";
|
|
var g = this.idPull[m].childNodes[this.conf.rtl ? 0 : 2];
|
|
while (g.childNodes.length > 0) {
|
|
g.removeChild(g.childNodes[0])
|
|
}
|
|
g.appendChild(l)
|
|
}
|
|
l.innerHTML = a
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.getHotKey = function(a) {
|
|
if (this.itemPull[this.idPrefix + a] == null) {
|
|
return null
|
|
}
|
|
return this.itemPull[this.idPrefix + a]["hotkey"]
|
|
};
|
|
dhtmlXMenuObject.prototype._clearAllSelectedSubItemsInPolygon = function(a) {
|
|
var g = this._getSubItemToDeselectByPolygon(a);
|
|
for (var c = 0; c < this.conf.opened_poly.length; c++) {
|
|
if (this.conf.opened_poly[c] != a) {
|
|
this._hidePolygon(this.conf.opened_poly[c])
|
|
}
|
|
}
|
|
for (var c = 0; c < g.length; c++) {
|
|
if (this.idPull[g[c]] != null && this.itemPull[g[c]]["state"] == "enabled") {
|
|
this.idPull[g[c]].className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_Item_Normal"
|
|
}
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._checkArrowsState = function(h) {
|
|
var c = this.idPull["polygon_" + h].childNodes[1];
|
|
var g = this.idPull["arrowup_" + h];
|
|
var a = this.idPull["arrowdown_" + h];
|
|
if (c.scrollTop == 0) {
|
|
g.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp_Disabled"
|
|
} else {
|
|
g.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp" + (g.over ? "_Over" : "")
|
|
} if (c.scrollTop + c.offsetHeight < c.scrollHeight) {
|
|
a.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowDown" + (a.over ? "_Over" : "")
|
|
} else {
|
|
a.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowDown_Disabled"
|
|
}
|
|
c = g = a = null
|
|
};
|
|
dhtmlXMenuObject.prototype._addUpArrow = function(h) {
|
|
var c = this;
|
|
var g = document.createElement("DIV");
|
|
g.pId = this.idPrefix + h;
|
|
g.id = "arrowup_" + this.idPrefix + h;
|
|
g.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowUp";
|
|
g.over = false;
|
|
g.onselectstart = function(l) {
|
|
l = l || event;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
g.oncontextmenu = function(l) {
|
|
l = l || event;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
g.onmouseover = function() {
|
|
if (c.conf.mode == "web") {
|
|
window.clearTimeout(c.conf.tm_handler)
|
|
}
|
|
c._clearAllSelectedSubItemsInPolygon(this.pId);
|
|
if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp_Disabled") {
|
|
return
|
|
}
|
|
this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp_Over";
|
|
this.over = true;
|
|
c._canScrollUp = true;
|
|
c._doScrollUp(this.pId, true)
|
|
};
|
|
g.onmouseout = function() {
|
|
if (c.conf.mode == "web") {
|
|
window.clearTimeout(c.conf.tm_handler);
|
|
c.conf.tm_handler = window.setTimeout(function() {
|
|
c._clearAndHide()
|
|
}, c.conf.tm_sec, "JavaScript")
|
|
}
|
|
this.over = false;
|
|
c._canScrollUp = false;
|
|
if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp_Disabled") {
|
|
return
|
|
}
|
|
this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowUp";
|
|
window.clearTimeout(c.conf.of_utm)
|
|
};
|
|
g.onclick = function(l) {
|
|
l = l || event;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
l.cancelBubble = true;
|
|
return false
|
|
};
|
|
var a = this.idPull["polygon_" + this.idPrefix + h];
|
|
a.childNodes[0].appendChild(g);
|
|
this.idPull[g.id] = g;
|
|
a = g = null
|
|
};
|
|
dhtmlXMenuObject.prototype._addDownArrow = function(h) {
|
|
var c = this;
|
|
var g = document.createElement("DIV");
|
|
g.pId = this.idPrefix + h;
|
|
g.id = "arrowdown_" + this.idPrefix + h;
|
|
g.className = "dhtmlxMenu_" + this.conf.skin + "_SubLevelArea_ArrowDown";
|
|
g.over = false;
|
|
g.onselectstart = function(l) {
|
|
l = l || event;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
g.oncontextmenu = function(l) {
|
|
l = l || event;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
g.onmouseover = function() {
|
|
if (c.conf.mode == "web") {
|
|
window.clearTimeout(c.conf.tm_handler)
|
|
}
|
|
c._clearAllSelectedSubItemsInPolygon(this.pId);
|
|
if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown_Disabled") {
|
|
return
|
|
}
|
|
this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown_Over";
|
|
this.over = true;
|
|
c._canScrollDown = true;
|
|
c._doScrollDown(this.pId, true)
|
|
};
|
|
g.onmouseout = function() {
|
|
if (c.conf.mode == "web") {
|
|
window.clearTimeout(c.conf.tm_handler);
|
|
c.conf.tm_handler = window.setTimeout(function() {
|
|
c._clearAndHide()
|
|
}, c.conf.tm_sec, "JavaScript")
|
|
}
|
|
this.over = false;
|
|
c._canScrollDown = false;
|
|
if (this.className == "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown_Disabled") {
|
|
return
|
|
}
|
|
this.className = "dhtmlxMenu_" + c.conf.skin + "_SubLevelArea_ArrowDown";
|
|
window.clearTimeout(c.conf.of_dtm)
|
|
};
|
|
g.onclick = function(l) {
|
|
l = l || event;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
l.cancelBubble = true;
|
|
return false
|
|
};
|
|
var a = this.idPull["polygon_" + this.idPrefix + h];
|
|
a.childNodes[2].appendChild(g);
|
|
this.idPull[g.id] = g;
|
|
a = g = null
|
|
};
|
|
dhtmlXMenuObject.prototype._removeUpArrow = function(c) {
|
|
var a = "arrowup_" + this.idPrefix + c;
|
|
this._removeArrow(a)
|
|
};
|
|
dhtmlXMenuObject.prototype._removeDownArrow = function(c) {
|
|
var a = "arrowdown_" + this.idPrefix + c;
|
|
this._removeArrow(a)
|
|
};
|
|
dhtmlXMenuObject.prototype._removeArrow = function(a) {
|
|
var c = this.idPull[a];
|
|
c.onselectstart = null;
|
|
c.oncontextmenu = null;
|
|
c.onmouseover = null;
|
|
c.onmouseout = null;
|
|
c.onclick = null;
|
|
if (c.parentNode) {
|
|
c.parentNode.removeChild(c)
|
|
}
|
|
c = null;
|
|
this.idPull[a] = null;
|
|
try {
|
|
delete this.idPull[a]
|
|
} catch (g) {}
|
|
};
|
|
dhtmlXMenuObject.prototype._isArrowExists = function(a) {
|
|
if (this.idPull["arrowup_" + a] != null && this.idPull["arrowdown_" + a] != null) {
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
dhtmlXMenuObject.prototype._doScrollUp = function(m, h) {
|
|
var a = this.idPull["polygon_" + m].childNodes[1];
|
|
if (this._canScrollUp && a.scrollTop > 0) {
|
|
var g = false;
|
|
var l = a.scrollTop - this.conf.of_ustep;
|
|
if (l < 0) {
|
|
g = true;
|
|
l = 0
|
|
}
|
|
a.scrollTop = l;
|
|
if (!g) {
|
|
var c = this;
|
|
this.conf.of_utm = window.setTimeout(function() {
|
|
c._doScrollUp(m, false);
|
|
c = null
|
|
}, this.conf.of_utime)
|
|
} else {
|
|
h = true
|
|
}
|
|
} else {
|
|
this._canScrollUp = false;
|
|
this._checkArrowsState(m)
|
|
} if (h) {
|
|
this._checkArrowsState(m)
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._doScrollDown = function(m, h) {
|
|
var a = this.idPull["polygon_" + m].childNodes[1];
|
|
if (this._canScrollDown && a.scrollTop + a.offsetHeight <= a.scrollHeight) {
|
|
var g = false;
|
|
var l = a.scrollTop + this.conf.of_dstep;
|
|
if (l + a.offsetHeight >= a.scrollHeight) {
|
|
g = true;
|
|
l = a.scrollHeight - a.offsetHeight
|
|
}
|
|
a.scrollTop = l;
|
|
if (!g) {
|
|
var c = this;
|
|
this.conf.of_dtm = window.setTimeout(function() {
|
|
c._doScrollDown(m, false);
|
|
c = null
|
|
}, this.conf.of_dtime)
|
|
} else {
|
|
h = true
|
|
}
|
|
} else {
|
|
this._canScrollDown = false;
|
|
this._checkArrowsState(m)
|
|
} if (h) {
|
|
this._checkArrowsState(m)
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._countPolygonItems = function(m) {
|
|
var h = 0;
|
|
for (var c in this.itemPull) {
|
|
var g = this.itemPull[c]["parent"];
|
|
var l = this.itemPull[c]["type"];
|
|
if (g == this.idPrefix + m && (l == "item" || l == "radio" || l == "checkbox")) {
|
|
h++
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXMenuObject.prototype.setOverflowHeight = function(h) {
|
|
if (h === "auto") {
|
|
this.conf.overflow_limit = 0;
|
|
this.conf.auto_overflow = true;
|
|
return
|
|
}
|
|
if (this.conf.overflow_limit == 0 && h <= 0) {
|
|
return
|
|
}
|
|
this._clearAndHide();
|
|
if (this.conf.overflow_limit >= 0 && h > 0) {
|
|
this.conf.overflow_limit = h;
|
|
return
|
|
}
|
|
if (this.conf.overflow_limit > 0 && h <= 0) {
|
|
for (var g in this.itemPull) {
|
|
if (this._isArrowExists(g)) {
|
|
var c = String(g).replace(this.idPrefix, "");
|
|
this._removeUpArrow(c);
|
|
this._removeDownArrow(c);
|
|
this.idPull["polygon_" + g].childNodes[1].style.height = ""
|
|
}
|
|
}
|
|
this.conf.overflow_limit = 0;
|
|
return
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._getRadioImgObj = function(g) {
|
|
try {
|
|
var a = this.idPull[this.idPrefix + g].childNodes[(this.conf.rtl ? 2 : 0)].childNodes[0]
|
|
} catch (c) {
|
|
var a = null
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXMenuObject.prototype._setRadioState = function(h, g) {
|
|
var c = this._getRadioImgObj(h);
|
|
if (c != null) {
|
|
var a = this.itemPull[this.idPrefix + h];
|
|
a.checked = g;
|
|
a.imgen = "rdbt_" + (a.checked ? "1" : "0");
|
|
a.imgdis = a.imgen;
|
|
c.className = "sub_icon " + a.imgen
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype._radioOnClickHandler = function(h, a, c) {
|
|
if (a.charAt(1) == "d" || this.itemPull[this.idPrefix + h]["group"] == null) {
|
|
return
|
|
}
|
|
var g = this.itemPull[this.idPrefix + h]["group"];
|
|
if (this.checkEvent("onRadioClick")) {
|
|
if (this.callEvent("onRadioClick", [g, this.getRadioChecked(g), h, this.conf.ctx_zoneid, c])) {
|
|
this.setRadioChecked(g, h)
|
|
}
|
|
} else {
|
|
this.setRadioChecked(g, h)
|
|
} if (this.checkEvent("onClick")) {
|
|
this.callEvent("onClick", [h])
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.getRadioChecked = function(h) {
|
|
var m = null;
|
|
for (var g = 0; g < this.radio[h].length; g++) {
|
|
var l = this.radio[h][g].replace(this.idPrefix, "");
|
|
var a = this._getRadioImgObj(l);
|
|
if (a != null) {
|
|
var c = (a.className).match(/rdbt_1$/gi);
|
|
if (c != null) {
|
|
m = l
|
|
}
|
|
}
|
|
}
|
|
return m
|
|
};
|
|
dhtmlXMenuObject.prototype.setRadioChecked = function(c, h) {
|
|
if (this.radio[c] == null) {
|
|
return
|
|
}
|
|
for (var a = 0; a < this.radio[c].length; a++) {
|
|
var g = this.radio[c][a].replace(this.idPrefix, "");
|
|
this._setRadioState(g, (g == h))
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.addRadioButton = function(q, l, r, s, u, v, a, m) {
|
|
if (this.conf.context && l == this.topId) {} else {
|
|
if (this.itemPull[this.idPrefix + l] == null) {
|
|
return
|
|
}
|
|
if (q == "child" && this.itemPull[this.idPrefix + l]["type"] != "item") {
|
|
return
|
|
}
|
|
}
|
|
var g = this.idPrefix + (s != null ? s : this._genStr(24));
|
|
var n = "rdbt_" + (a ? "1" : "0");
|
|
var c = n;
|
|
if (q == "sibling") {
|
|
var o = this.idPrefix + this.getParentId(l);
|
|
this._addItemIntoGlobalStrorage(g, o, u, "radio", m, n, c);
|
|
this._renderSublevelItem(g, this.getItemPosition(l))
|
|
} else {
|
|
var o = this.idPrefix + l;
|
|
this._addItemIntoGlobalStrorage(g, o, u, "radio", m, n, c);
|
|
if (this.idPull["polygon_" + o] == null) {
|
|
this._renderSublevelPolygon(o, o)
|
|
}
|
|
this._renderSublevelItem(g, r - 1);
|
|
this._redefineComplexState(o)
|
|
}
|
|
var h = (v != null ? v : this._genStr(24));
|
|
this.itemPull[g]["group"] = h;
|
|
if (this.radio[h] == null) {
|
|
this.radio[h] = new Array()
|
|
}
|
|
this.radio[h][this.radio[h].length] = g;
|
|
if (a == true) {
|
|
this.setRadioChecked(h, String(g).replace(this.idPrefix, ""))
|
|
}
|
|
};
|
|
dhtmlXMenuObject.prototype.serialize = function() {
|
|
var a = "<menu>" + this._readLevel(this.idPrefix + this.topId) + "</menu>";
|
|
return a
|
|
};
|
|
dhtmlXMenuObject.prototype._readLevel = function(h) {
|
|
var l = "";
|
|
for (var q in this.itemPull) {
|
|
if (this.itemPull[q]["parent"] == h) {
|
|
var c = "";
|
|
var g = "";
|
|
var s = "";
|
|
var o = String(this.itemPull[q]["id"]).replace(this.idPrefix, "");
|
|
var n = "";
|
|
var r = (this.itemPull[q]["title"] != "" ? ' text="' + this.itemPull[q]["title"] + '"' : "");
|
|
var m = "";
|
|
if (this.itemPull[q]["type"] == "item") {
|
|
if (this.itemPull[q]["imgen"] != "") {
|
|
c = ' img="' + this.itemPull[q]["imgen"] + '"'
|
|
}
|
|
if (this.itemPull[q]["imgdis"] != "") {
|
|
g = ' imgdis="' + this.itemPull[q]["imgdis"] + '"'
|
|
}
|
|
if (this.itemPull[q]["hotkey"] != "") {
|
|
s = "<hotkey>" + this.itemPull[q]["hotkey"] + "</hotkey>"
|
|
}
|
|
}
|
|
if (this.itemPull[q]["type"] == "separator") {
|
|
n = ' type="separator"'
|
|
} else {
|
|
if (this.itemPull[q]["state"] == "disabled") {
|
|
m = ' enabled="false"'
|
|
}
|
|
} if (this.itemPull[q]["type"] == "checkbox") {
|
|
n = ' type="checkbox"' + (this.itemPull[q]["checked"] ? ' checked="true"' : "")
|
|
}
|
|
if (this.itemPull[q]["type"] == "radio") {
|
|
n = ' type="radio" group="' + this.itemPull[q]["group"] + '" ' + (this.itemPull[q]["checked"] ? ' checked="true"' : "")
|
|
}
|
|
l += "<item id='" + o + "'" + r + n + c + g + m + ">";
|
|
l += s;
|
|
if (this.itemPull[q]["complex"]) {
|
|
l += this._readLevel(q)
|
|
}
|
|
l += "</item>"
|
|
}
|
|
}
|
|
return l
|
|
};
|
|
dhtmlXMenuObject.prototype.enableEffect = function(g, l, h) {
|
|
this._menuEffect = (g == "opacity" || g == "slide" || g == "slide+" ? g : false);
|
|
this._pOpStyleIE = (navigator.userAgent.search(/MSIE\s[678]\.0/gi) >= 0);
|
|
for (var c in this.idPull) {
|
|
if (c.search(/polygon/) === 0) {
|
|
this._pOpacityApply(c, (this._pOpStyleIE ? 100 : 1));
|
|
this.idPull[c].style.height = ""
|
|
}
|
|
}
|
|
this._pOpMax = (typeof(l) == "undefined" ? 100 : l) / (this._pOpStyleIE ? 1 : 100);
|
|
this._pOpStyleName = (this._pOpStyleIE ? "filter" : "opacity");
|
|
this._pOpStyleValue = (this._pOpStyleIE ? "progid:DXImageTransform.Microsoft.Alpha(Opacity=#)" : "#");
|
|
this._pSlSteps = (this._pOpStyleIE ? 10 : 20);
|
|
this._pSlTMTimeMax = h || 50
|
|
};
|
|
dhtmlXMenuObject.prototype._showPolygonEffect = function(a) {
|
|
this._pShowHide(a, true)
|
|
};
|
|
dhtmlXMenuObject.prototype._hidePolygonEffect = function(a) {
|
|
this._pShowHide(a, false)
|
|
};
|
|
dhtmlXMenuObject.prototype._pOpacityApply = function(a, c) {
|
|
this.idPull[a].style[this._pOpStyleName] = String(this._pOpStyleValue).replace("#", c || this.idPull[a]._op)
|
|
};
|
|
dhtmlXMenuObject.prototype._pShowHide = function(a, c) {
|
|
if (!this.idPull) {
|
|
return
|
|
}
|
|
if (this.idPull[a]._tmShow != null) {
|
|
if ((this.idPull[a]._step_h > 0 && c == true) || (this.idPull[a]._step_h < 0 && c == false)) {
|
|
return
|
|
}
|
|
window.clearTimeout(this.idPull[a]._tmShow);
|
|
this.idPull[a]._tmShow = null;
|
|
this.idPull[a]._max_h = null
|
|
}
|
|
if (c == false && (this.idPull[a].style.visibility == "hidden" || this.idPull[a].style.display == "none")) {
|
|
return
|
|
}
|
|
if (c == true && this.idPull[a].style.display == "none") {
|
|
this.idPull[a].style.visibility = "hidden";
|
|
this.idPull[a].style.display = ""
|
|
}
|
|
if (this.idPull[a]._max_h == null) {
|
|
this.idPull[a]._max_h = parseInt(this.idPull[a].offsetHeight);
|
|
this.idPull[a]._h = (c == true ? 0 : this.idPull[a]._max_h);
|
|
this.idPull[a]._step_h = Math.round(this.idPull[a]._max_h / this._pSlSteps) * (c == true ? 1 : -1);
|
|
if (this.idPull[a]._step_h == 0) {
|
|
return
|
|
}
|
|
this.idPull[a]._step_tm = Math.round(this._pSlTMTimeMax / this._pSlSteps);
|
|
if (this._menuEffect == "slide+" || this._menuEffect == "opacity") {
|
|
this.idPull[a].op_tm = this.idPull[a]._step_tm;
|
|
this.idPull[a].op_step = (this._pOpMax / this._pSlSteps) * (c == true ? 1 : -1);
|
|
if (this._pOpStyleIE) {
|
|
this.idPull[a].op_step = Math.round(this.idPull[a].op_step)
|
|
}
|
|
this.idPull[a]._op = (c == true ? 0 : this._pOpMax);
|
|
this._pOpacityApply(a)
|
|
} else {
|
|
this.idPull[a]._op = (this._pOpStyleIE ? 100 : 1);
|
|
this._pOpacityApply(a)
|
|
} if (this._menuEffect.search(/slide/) === 0) {
|
|
this.idPull[a].style.height = "0px"
|
|
}
|
|
this.idPull[a].style.visibility = "visible"
|
|
}
|
|
this._pEffectSet(a, this.idPull[a]._h + this.idPull[a]._step_h)
|
|
};
|
|
dhtmlXMenuObject.prototype._pEffectSet = function(g, c) {
|
|
if (!this.idPull) {
|
|
return
|
|
}
|
|
if (this.idPull[g]._tmShow) {
|
|
window.clearTimeout(this.idPull[g]._tmShow)
|
|
}
|
|
this.idPull[g]._h = Math.max(0, Math.min(c, this.idPull[g]._max_h));
|
|
if (this._menuEffect.search(/slide/) === 0) {
|
|
this.idPull[g].style.height = this.idPull[g]._h + "px"
|
|
}
|
|
c += this.idPull[g]._step_h;
|
|
if (this._menuEffect == "slide+" || this._menuEffect == "opacity") {
|
|
this.idPull[g]._op = Math.max(0, Math.min(this._pOpMax, this.idPull[g]._op + this.idPull[g].op_step));
|
|
this._pOpacityApply(g)
|
|
}
|
|
if ((this.idPull[g]._step_h > 0 && c <= this.idPull[g]._max_h) || (this.idPull[g]._step_h < 0 && c >= 0)) {
|
|
var a = this;
|
|
this.idPull[g]._tmShow = window.setTimeout(function() {
|
|
a._pEffectSet(g, c)
|
|
}, this.idPull[g]._step_tm)
|
|
} else {
|
|
if (this._menuEffect.search(/slide/) === 0) {
|
|
this.idPull[g].style.height = ""
|
|
}
|
|
if (this.idPull[g]._step_h < 0) {
|
|
this.idPull[g].style.visibility = "hidden"
|
|
}
|
|
if (this._menuEffect == "slide+" || this._menuEffect == "opacity") {
|
|
this.idPull[g]._op = (this.idPull[g]._step_h < 0 ? (this._pOpStyleIE ? 100 : 1) : this._pOpMax);
|
|
this._pOpacityApply(g)
|
|
}
|
|
this.idPull[g]._tmShow = null;
|
|
this.idPull[g]._h = null;
|
|
this.idPull[g]._max_h = null;
|
|
this.idPull[g]._step_tm = null
|
|
}
|
|
};
|
|
|
|
function dhtmlXRibbon(h) {
|
|
var g = this,
|
|
c, a;
|
|
this.conf = {
|
|
type: "ribbon",
|
|
icons_path: (h && h.icons_path) ? h.icons_path : "",
|
|
skin: "dhx_skyblue"
|
|
};
|
|
this._eventHandlers = {};
|
|
this._base = null;
|
|
this._items = {};
|
|
this._tabbar = null;
|
|
this.childIds = [];
|
|
if (typeof(h) == "string") {
|
|
a = h
|
|
} else {
|
|
if (h && h.tagName) {
|
|
a = h
|
|
} else {
|
|
if (h && h.parent) {
|
|
if (h.parent.tagName || typeof(h.parent) == "string") {
|
|
a = h.parent
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this._doOnHighlight0 = function(o) {
|
|
o = o || event;
|
|
var n = o.target || o.srcElement;
|
|
var l = g._findItemByNode(n);
|
|
var m = g._items[l._dhx_ribbonId];
|
|
if (m.conf.disable) {
|
|
return
|
|
}
|
|
if (g.items[m.type] && typeof(g.items[m.type].mouseover) == "function") {
|
|
if (g.items[m.type].mouseover(m, g, o) != true) {
|
|
return false
|
|
}
|
|
}
|
|
if (!/dhxrb_highlight0/.test(l.className)) {
|
|
l.className += " dhxrb_highlight0"
|
|
}
|
|
};
|
|
this._doOffHighlight0 = function(o) {
|
|
o = o || event;
|
|
var n = o.target || o.srcElement;
|
|
var l = g._findItemByNode(n);
|
|
var m = g._items[l._dhx_ribbonId];
|
|
if (m.conf.disable) {
|
|
return
|
|
}
|
|
if (g.items[m.type] && typeof(g.items[m.type].mouseout) == "function") {
|
|
if (g.items[m.type].mouseout(m, g, o) != true) {
|
|
return false
|
|
}
|
|
}
|
|
if (/dhxrb_highlight1/.test(l.className)) {
|
|
l.className = l.className.replace(/\s?dhxrb_highlight1/, "")
|
|
}
|
|
if (/dhxrb_highlight0/.test(l.className)) {
|
|
l.className = l.className.replace(/\s?dhxrb_highlight0/, "")
|
|
}
|
|
};
|
|
this._doOnHighlight1 = function(o) {
|
|
o = o || event;
|
|
var n = o.target || o.srcElement;
|
|
var l = g._findItemByNode(n);
|
|
var m = g._items[l._dhx_ribbonId];
|
|
if (m.conf.disable) {
|
|
return
|
|
}
|
|
g.callEvent("_showPopup", [m.id]);
|
|
if (g.items[m.type] && typeof(g.items[m.type].mousedown) == "function") {
|
|
if (g.items[m.type].mousedown(m, g, o) != true) {
|
|
return false
|
|
}
|
|
}
|
|
if (!/dhxrb_highlight1/.test(l.className)) {
|
|
l.className += " dhxrb_highlight1"
|
|
}
|
|
};
|
|
this._doOffHighlight1 = function(o) {
|
|
o = o || event;
|
|
var n = o.target || o.srcElement;
|
|
var l = g._findItemByNode(n);
|
|
var m = g._items[l._dhx_ribbonId];
|
|
if (m.conf.disable) {
|
|
return
|
|
}
|
|
if (g.items[m.type] && typeof(g.items[m.type].mouseup) == "function") {
|
|
if (g.items[m.type].mouseup(m, g, o) != true) {
|
|
return false
|
|
}
|
|
}
|
|
if (/dhxrb_highlight1/.test(l.className)) {
|
|
l.className = l.className.replace(/\s?dhxrb_highlight1/, "")
|
|
}
|
|
};
|
|
this._doOnClick = function(o) {
|
|
o = o || event;
|
|
var n = o.target || o.srcElement;
|
|
var l = g._findItemByNode(n);
|
|
var m = g._items[l._dhx_ribbonId];
|
|
if (m.conf.disable) {
|
|
return
|
|
}
|
|
if (g.items[m.type] && typeof(g.items[m.type].click) == "function") {
|
|
g.items[m.type].click(m, g, o)
|
|
}
|
|
};
|
|
this._doOnFocus = function(o) {
|
|
o = o || event;
|
|
var n = o.target || o.srcElement;
|
|
var l = g._findItemByNode(n);
|
|
var m = g._items[l._dhx_ribbonId];
|
|
if (m.conf.disable) {
|
|
return
|
|
}
|
|
g.callEvent("_showPopup", [m.id]);
|
|
if (g.items[m.type] && typeof(g.items[m.type].focus) == "function") {
|
|
g.items[m.type].focus(m, g, o)
|
|
}
|
|
};
|
|
this._doOnBlur = function(o) {
|
|
o = o || event;
|
|
var n = o.target || o.srcElement;
|
|
var l = g._findItemByNode(n);
|
|
var m = g._items[l._dhx_ribbonId];
|
|
if (m.conf.disable) {
|
|
return
|
|
}
|
|
if (g.items[m.type] && typeof(g.items[m.type].blur) == "function") {
|
|
g.items[m.type].blur(m, g, o)
|
|
}
|
|
};
|
|
this._doOnChange = function(o) {
|
|
o = o || event;
|
|
var n = o.target || o.srcElement;
|
|
var l = g._findItemByNode(n);
|
|
var m = g._items[l._dhx_ribbonId];
|
|
if (m.conf.disable) {
|
|
return
|
|
}
|
|
if (g.items[m.type] && typeof(g.items[m.type].change) == "function") {
|
|
g.items[m.type].change(m, g, o)
|
|
}
|
|
};
|
|
this._doOnKeydown = function(o) {
|
|
o = o || event;
|
|
var n = o.target || o.srcElement;
|
|
var l = g._findItemByNode(n);
|
|
var m = g._items[l._dhx_ribbonId];
|
|
if (m.conf.disable) {
|
|
return
|
|
}
|
|
if (g.items[m.type] && typeof(g.items[m.type].keydown) == "function") {
|
|
g.items[m.type].keydown(m, g, o)
|
|
}
|
|
};
|
|
this._tabCustomApi = {
|
|
enable: function(o, n) {
|
|
var m = null,
|
|
l = null;
|
|
n = n || false;
|
|
if (n != true) {
|
|
m = g._items[this._idd];
|
|
for (l in m.childIds) {
|
|
l = parseInt(l);
|
|
g.enable(m.childIds[l])
|
|
}
|
|
}
|
|
return g._tabOriginalApi.enable.apply(this, [o])
|
|
},
|
|
disable: function(o, n) {
|
|
var m = null,
|
|
l = null;
|
|
if (n != false) {
|
|
m = g._items[this._idd];
|
|
for (l in m.childIds) {
|
|
l = parseInt(l);
|
|
g.disable(m.childIds[l])
|
|
}
|
|
}
|
|
return g._tabOriginalApi.disable.apply(this, [o])
|
|
},
|
|
close: function(n) {
|
|
var m = g._items[this._idd],
|
|
l;
|
|
g._removeTab(m);
|
|
g._tabOriginalApi.close.apply(this, [n]);
|
|
for (l in g._tabOriginalApi) {
|
|
this[l] = null
|
|
}
|
|
}
|
|
};
|
|
this._attachEventTabbar = function() {
|
|
this._tabbar.attachEvent("onSelect", function() {
|
|
return g.callEvent("onSelect", arguments)
|
|
});
|
|
this._tabbar.attachEvent("onTabClick", function() {
|
|
return g.callEvent("onTabClick", arguments)
|
|
});
|
|
this._tabbar.attachEvent("onTabClose", function() {
|
|
return g.callEvent("onTabClose", arguments)
|
|
})
|
|
};
|
|
if (typeof(a) == "string") {
|
|
this._base = document.getElementById(a)
|
|
} else {
|
|
if (a && a.tagName) {
|
|
this._base = a
|
|
} else {
|
|
this._base = document.createElement("div");
|
|
this._base._dhx_remove = true;
|
|
if (document.body.firstChild) {
|
|
document.body.insertBefore(this._base, document.body.firstChild)
|
|
} else {
|
|
document.body.appendChild(this._base)
|
|
}
|
|
}
|
|
}
|
|
c = dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || dhx4.skinDetect("dhtmlxribbon") || "dhx_skyblue";
|
|
if (typeof(h) == "object" && h.skin) {
|
|
c = h.skin
|
|
}
|
|
this.setSkin(c);
|
|
dhx4._eventable(this);
|
|
dhx4._enableDataLoading(this, "_renderData", "_xmlToJson", "ribbon", {
|
|
struct: true
|
|
});
|
|
this.attachEvent("_onHeightChanged", function() {
|
|
this.conf.inited = true
|
|
});
|
|
this._base.className += " dhxrb_without_tabbar";
|
|
this._base.innerHTML = "<div class='dhxrb_background_area'></div>";
|
|
if (h != null) {
|
|
if (h.json) {
|
|
this.loadStruct(h.json, h.onload)
|
|
} else {
|
|
if (h.xml) {
|
|
this.loadStruct(h.xml, h.onload)
|
|
} else {
|
|
this._renderData(h)
|
|
}
|
|
}
|
|
}
|
|
this.unload = function() {
|
|
var m = null,
|
|
l = [];
|
|
for (m in this.childIds) {
|
|
m = parseInt(m);
|
|
l.push(this.childIds[m])
|
|
}
|
|
dhx4._enableDataLoading(this, null, null, null, "clear");
|
|
dhx4._eventable(this, "clear");
|
|
for (m in l) {
|
|
m = parseInt(m);
|
|
if (this._items[l[m]].type == "tab") {
|
|
this.tabs(l[m]).close(false)
|
|
} else {
|
|
this.removeItem(l[m])
|
|
}
|
|
}
|
|
if (this._tabbar) {
|
|
this._tabbar.unload();
|
|
this._tabbar = null
|
|
}
|
|
this._base.innerHTML = "";
|
|
if (this._base._dhx_remove) {
|
|
this._base.parentNode.removeChild(this._base)
|
|
} else {
|
|
this._base.className = this._base.className.replace(/\s?(dhtmlx|dhxrb)(\S*)/ig, "")
|
|
}
|
|
for (m in this) {
|
|
this[m] = null
|
|
}
|
|
g = null
|
|
}
|
|
}
|
|
dhtmlXRibbon.prototype.setSizes = function() {
|
|
if (this._tabbar != null && typeof(this.setSizes) == "function") {
|
|
this._tabbar.setSizes()
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._renderData = function(c) {
|
|
var a = this._base.firstChild;
|
|
if (c != null) {
|
|
this.conf.icons_path = c.icons_path || this.conf.icons_path;
|
|
if (c.tabs instanceof Array) {
|
|
this._base.className = this._base.className.replace(/\s?dhxrb_without_tabbar/i, "");
|
|
a.className = "dhxrb_with_tabbar";
|
|
this._tabbar = new dhtmlXTabBar(a);
|
|
this._attachEventTabbar();
|
|
this._tabbar.setSkin(this.conf.skin);
|
|
this.childIds = this._appendTabs(c.tabs)
|
|
} else {
|
|
if (c.items instanceof Array) {
|
|
if (!/\s?dhxrb_without_tabbar/i.test(this._base.className)) {
|
|
this._base.className += " dhxrb_without_tabbar"
|
|
}
|
|
if (/\s?dhxrb_background_area/i.test(a.className)) {
|
|
a.className = "dhxrb_background_area"
|
|
}
|
|
a.innerHTML = "<div class='dhxrb_g_area'></div>";
|
|
this.childIds = this._appendBlocks(c.items, a.firstChild)
|
|
}
|
|
}
|
|
this.callEvent("_onHeightChanged", [])
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._xmlToJson = function(c) {
|
|
var a = c.lastChild || null,
|
|
h = {}, g = [];
|
|
if (a && a.tagName == "ribbon") {
|
|
g = this._convertXmlNodeListIntoObject(a.childNodes)
|
|
}
|
|
if (g[0] && g[0].type && g[0].type.toLowerCase() == "block") {
|
|
h.items = g
|
|
} else {
|
|
h.tabs = g
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXRibbon.prototype._convertXmlNodeListIntoObject = function(c) {
|
|
var g, a, m = [],
|
|
h;
|
|
a = c.length;
|
|
for (g = 0; g < a; g++) {
|
|
h = this._covertXmlNodeToObject(c[g]);
|
|
if (h) {
|
|
m.push(h)
|
|
}
|
|
}
|
|
return m
|
|
};
|
|
dhtmlXRibbon.prototype._covertXmlNodeToObject = function(h) {
|
|
if (!h || !h.tagName || !(h.tagName.toLowerCase() == "item" || h.tagName.toLowerCase() == "tab")) {
|
|
return null
|
|
}
|
|
var g, a, c = h.attributes,
|
|
m = {};
|
|
a = c.length;
|
|
for (g = 0; g < a; g++) {
|
|
switch (c[g].name) {
|
|
case "isbig":
|
|
m.isbig = dhx4.s2b(c[g].value);
|
|
break;
|
|
case "state":
|
|
m.state = dhx4.s2b(c[g].value);
|
|
break;
|
|
default:
|
|
m[c[g].name] = c[g].value
|
|
}
|
|
}
|
|
if (h.childNodes.length) {
|
|
if (h.getAttribute("type") == "buttonCombo" || h.getAttribute("type") == "buttonSelect") {
|
|
m.data = h
|
|
} else {
|
|
if (h.tagName.toLowerCase() == "tab") {
|
|
m.items = this._convertXmlNodeListIntoObject(h.childNodes)
|
|
} else {
|
|
m.list = this._convertXmlNodeListIntoObject(h.childNodes)
|
|
}
|
|
}
|
|
}
|
|
return m
|
|
};
|
|
dhtmlXRibbon.prototype._appendTabs = function(m) {
|
|
var c, a, g, h = [];
|
|
a = m.length;
|
|
for (c = 0; c < a; c++) {
|
|
g = this._addTab(m[c]);
|
|
if (m[c].items instanceof Array) {
|
|
g.childIds = this._appendBlocks(m[c].items, g.base, g)
|
|
}
|
|
h.push(g.id)
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXRibbon.prototype._addTab = function(g) {
|
|
var a, h, c = {
|
|
conf: {
|
|
active: false,
|
|
text: "",
|
|
width: null,
|
|
position: null,
|
|
disable: false
|
|
},
|
|
base: document.createElement("div"),
|
|
type: "tab",
|
|
childIds: []
|
|
};
|
|
for (a in g) {
|
|
if (a == "items") {
|
|
continue
|
|
}
|
|
c.conf[a] = g[a]
|
|
}
|
|
if (!g.id) {
|
|
c.id = dhx4.newId()
|
|
} else {
|
|
c.id = g.id
|
|
}
|
|
while (this._items[c.id]) {
|
|
c.id = dhx4.newId()
|
|
}
|
|
this._tabbar.addTab(c.id, c.conf.text, c.conf.width, c.conf.position, c.conf.active);
|
|
c.base.className = "dhxrb_g_area";
|
|
c.base._dhx_ribbonId = c.id;
|
|
this.tabs(c.id).attachObject(c.base);
|
|
this._changeApiForTab(this.tabs(c.id));
|
|
this._items[c.id] = c;
|
|
return c
|
|
};
|
|
dhtmlXRibbon.prototype._changeApiForTab = function(c) {
|
|
var a;
|
|
for (a in this._tabOriginalApi) {
|
|
this._tabOriginalApi[a] = this._tabOriginalApi[a] || c[a];
|
|
c[a] = this._tabCustomApi[a]
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._tabOriginalApi = {
|
|
enable: null,
|
|
disable: null,
|
|
close: null
|
|
};
|
|
dhtmlXRibbon.prototype._appendBlocks = function(a, u, g) {
|
|
var n, h, o, m, r, c, s = [];
|
|
g = g || null;
|
|
h = a.length;
|
|
for (n = 0; n < h; n++) {
|
|
if (typeof(a[n]) == "object" && a[n].type == "block") {
|
|
o = this._addBlock(a[n], u);
|
|
if (a[n].list && (a[n].list instanceof Array)) {
|
|
m = a[n].list;
|
|
r = m.length;
|
|
for (c = 0; c < r; c++) {
|
|
this._addItem(o.id, null, null, m[c])
|
|
}
|
|
}
|
|
if (g != null) {
|
|
o.parentId = g.id
|
|
}
|
|
if (o.conf.disable) {
|
|
this.disable(o.id)
|
|
}
|
|
s.push(o.id)
|
|
}
|
|
}
|
|
return s
|
|
};
|
|
dhtmlXRibbon.prototype._addBlock = function(m, h) {
|
|
var g, a, n, c;
|
|
n = {
|
|
conf: {
|
|
text: "",
|
|
text_pos: "bottom",
|
|
type: "block",
|
|
mode: "cols",
|
|
disable: false
|
|
},
|
|
type: "block",
|
|
childIds: [],
|
|
base: document.createElement("div"),
|
|
contForItems: document.createElement("div"),
|
|
contForText: document.createElement("div")
|
|
};
|
|
for (c in m) {
|
|
if (c == "list" || c == "type" || c == "id") {
|
|
continue
|
|
}
|
|
n.conf[c] = m[c]
|
|
}
|
|
if (!m.id) {
|
|
n.id = dhx4.newId()
|
|
} else {
|
|
n.id = m.id
|
|
}
|
|
while (this._items[n.id]) {
|
|
n.id = dhx4.newId()
|
|
}
|
|
n.base.className = "dhxrb_block_base";
|
|
h.appendChild(n.base);
|
|
n.contForItems.className = "dhxrb_block_items";
|
|
n.contForText.className = "dhxrb_block_label";
|
|
n.base.appendChild(n.contForItems);
|
|
if (n.conf.text) {
|
|
n.contForText.innerHTML = n.conf.text;
|
|
if (n.conf.text_pos == "top") {
|
|
n.base.insertBefore(n.contForText, n.contForItems)
|
|
} else {
|
|
n.base.appendChild(n.contForText)
|
|
}
|
|
}
|
|
n.base._dhx_ribbonId = n.id;
|
|
this._items[n.id] = n;
|
|
return n
|
|
};
|
|
dhtmlXRibbon.prototype._addItem = function(g, c, q, n) {
|
|
var l = this._items[g],
|
|
a, m, s = null,
|
|
o = this,
|
|
h;
|
|
if (n.type != "newLevel" && !this.items[n.type]) {
|
|
return null
|
|
}
|
|
if (n.type == "newLevel") {
|
|
this._addNewLevel(l)
|
|
} else {
|
|
if (l.type == "group") {
|
|
a = document.createElement("div");
|
|
a.className = "dhxrb_in_group";
|
|
l.base.appendChild(a)
|
|
} else {
|
|
if (n.isbig) {
|
|
a = document.createElement("div");
|
|
a.className = "dhxrb_big_button";
|
|
l.contForItems.appendChild(a)
|
|
} else {
|
|
m = this._getContainerForSmallItem(l);
|
|
a = document.createElement("div");
|
|
a.className = (l.conf.mode == "rows") ? "dhxrb_in_row" : "dhxrb_3rows_button";
|
|
m.appendChild(a)
|
|
}
|
|
}
|
|
} if (a) {
|
|
this._attachEventForItem(a);
|
|
h = {
|
|
icons_path: n.icons_path || this.conf.icons_path,
|
|
skin: this.conf.skin
|
|
};
|
|
for (var r in n) {
|
|
h[r] = n[r]
|
|
}
|
|
if (!h.id) {
|
|
h.id = dhx4.newId()
|
|
}
|
|
while (this._items[h.id]) {
|
|
h.id = dhx4.newId()
|
|
}
|
|
s = (this.items[h.type] && this.items[h.type].render) ? this.items[h.type].render(a, h) : null
|
|
}
|
|
if (s != null) {
|
|
this._items[s.id] = s;
|
|
s.parentId = l.id;
|
|
l.childIds.push(s.id);
|
|
a._dhx_ribbonId = s.id;
|
|
if (h.onclick && (typeof(h.onclick) == "function")) {
|
|
this._eventHandlers[s.id] = this._eventHandlers[s.id] || {};
|
|
this._eventHandlers[s.id]["onclick"] = h.onclick
|
|
}
|
|
s.callEvent = function() {
|
|
o.callEvent.apply(o, arguments)
|
|
};
|
|
s._callHandler = function() {
|
|
o._callHandler.apply(o, arguments)
|
|
};
|
|
if (this.items[h.type] && typeof(this.items[h.type].callAfterInit) == "function") {
|
|
this.items[h.type].callAfterInit.apply(this, [s])
|
|
}
|
|
}
|
|
return s
|
|
};
|
|
dhtmlXRibbon.prototype._callHandler = function(c, a) {
|
|
if (this._eventHandlers[c] && this._eventHandlers[c].onclick) {
|
|
this._eventHandlers[c].onclick.apply(this, a)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items = {};
|
|
dhtmlXRibbon.prototype.items.button = {
|
|
render: function(c, a) {
|
|
var g, h;
|
|
h = {
|
|
base: c,
|
|
id: a.id,
|
|
type: a.type,
|
|
conf: {
|
|
text: "",
|
|
text_pos: (a.isbig) ? "bottom" : "right",
|
|
img: null,
|
|
imgdis: null,
|
|
isbig: false,
|
|
disable: false,
|
|
skin: a.skin
|
|
}
|
|
};
|
|
for (g in a) {
|
|
if (g == "id" || g == "onclick" || g == "type") {
|
|
continue
|
|
}
|
|
h.conf[g] = a[g]
|
|
}
|
|
c.innerHTML = "<img class='dhxrb_image" + ((h.conf.img) ? "'" : " dhxrb_invisible'") + " src='" + ((h.conf.img) ? h.conf.icons_path + h.conf.img : "") + "' /><div class='dhxrb_label_button'>" + h.conf.text + "</div>";
|
|
if (typeof(this.afterRender) == "function") {
|
|
this.afterRender(h)
|
|
}
|
|
if (h.conf.disable) {
|
|
this.disable(h)
|
|
}
|
|
return h
|
|
},
|
|
getText: function(a) {
|
|
return a.conf.text
|
|
},
|
|
setText: function(c, g) {
|
|
var a = c.base.childNodes[1];
|
|
c.conf.text = g;
|
|
a.innerHTML = g
|
|
},
|
|
mousedown: function(a, g, c) {
|
|
return true
|
|
},
|
|
click: function(a, g, c) {
|
|
if (c.button != 0) {
|
|
return false
|
|
}
|
|
g._callHandler(a.id, [a.id]);
|
|
a.callEvent("onClick", [a.id]);
|
|
return false
|
|
},
|
|
disable: function(c) {
|
|
var g = c.base.childNodes[0],
|
|
a = c.base.childNodes[1];
|
|
if (c.conf.imgdis) {
|
|
g.src = c.conf.icons_path + c.conf.imgdis;
|
|
if (/\s?dhxrb_invisible/i.test(g.className)) {
|
|
g.className = g.className.replace(/\s?dhxrb_invisible/i, "")
|
|
}
|
|
}
|
|
if (!/\s?dhxrb_disable_text_style/i.test(a.className)) {
|
|
a.className += " dhxrb_disable_text_style"
|
|
}
|
|
return true
|
|
},
|
|
enable: function(c) {
|
|
var g = c.base.childNodes[0],
|
|
a = c.base.childNodes[1];
|
|
if (c.conf.img) {
|
|
g.src = c.conf.icons_path + c.conf.img
|
|
} else {
|
|
if (!/\s?dhxrb_invisible/i.test(g.className)) {
|
|
g.className += " dhxrb_invisible"
|
|
}
|
|
} if (/\s?dhxrb_disable_text_style/i.test(a.className)) {
|
|
a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, "")
|
|
}
|
|
return true
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items.buttonTwoState = {
|
|
click: function(a, g, c) {
|
|
return false
|
|
},
|
|
afterRender: function(a) {
|
|
if (a.conf.state) {
|
|
this.setState(a, a.conf.state)
|
|
}
|
|
},
|
|
mouseover: function(a) {
|
|
if (!/dhxrb_highlight0/.test(a.base.className)) {
|
|
a.base.className += " dhxrb_highlight0"
|
|
}
|
|
return false
|
|
},
|
|
mouseout: function(a) {
|
|
if (/dhxrb_highlight0/.test(a.base.className)) {
|
|
a.base.className = a.base.className.replace(/\s?dhxrb_highlight0/, "")
|
|
}
|
|
return false
|
|
},
|
|
mousedown: function(a, g, c) {
|
|
g._callHandler(a.id, [a.id, !a.conf.state]);
|
|
this.setState(a, !a.conf.state, true);
|
|
return false
|
|
},
|
|
mouseup: function(a) {
|
|
return false
|
|
},
|
|
setState: function(a, c, g) {
|
|
g = g || false;
|
|
c = dhx4.s2b(c);
|
|
if (c) {
|
|
if (!/dhxrb_highlight1/.test(a.base.className)) {
|
|
a.base.className += " dhxrb_highlight1"
|
|
}
|
|
} else {
|
|
if (/dhxrb_highlight1/.test(a.base.className)) {
|
|
a.base.className = a.base.className.replace(/\s?dhxrb_highlight1/, "")
|
|
}
|
|
}
|
|
a.conf.state = c;
|
|
if (g) {
|
|
a.callEvent("onStateChange", [a.id, a.conf.state])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items.buttonSegment = {
|
|
click: function(a, g, c) {
|
|
return false
|
|
},
|
|
mousedown: function(a, g, c) {
|
|
this.setState(a, g, true);
|
|
return false
|
|
},
|
|
callAfterInit: function(a) {
|
|
if (a.conf.state || dhtmlXRibbon.prototype.items.buttonSegment._getSelectedNeighbor(a, this) == null) {
|
|
if (a.conf.state) {
|
|
a.conf.state = false
|
|
}
|
|
dhtmlXRibbon.prototype.items.buttonSegment.setState(a, this, false)
|
|
}
|
|
},
|
|
afterRender: function() {},
|
|
setState: function(a, l, h) {
|
|
h = h || false;
|
|
var g = null,
|
|
c = dhx4.s2b(a.conf.state);
|
|
if (c == false) {
|
|
g = this._getSelectedNeighbor(a, l);
|
|
if (g != null) {
|
|
this._unSelect(g)
|
|
}
|
|
if (!/dhxrb_highlight1/.test(a.base.className)) {
|
|
a.base.className += " dhxrb_highlight1"
|
|
}
|
|
a.conf.state = true;
|
|
if (h) {
|
|
l._callHandler(a.id, [a.id, (g ? g.id : null)]);
|
|
l.callEvent("onStateChange", [a.id, (g ? g.id : null)])
|
|
}
|
|
}
|
|
},
|
|
remove: function(g, n) {
|
|
var l = dhx4.s2b(g.conf.state),
|
|
m = null,
|
|
a = 0,
|
|
c = n._items[g.parentId],
|
|
h;
|
|
if (l) {
|
|
while (c.childIds[a] && m == null) {
|
|
h = n._items[c.childIds[a]];
|
|
if (h.type == "buttonSegment" && h != g) {
|
|
m = h
|
|
}
|
|
a++
|
|
}
|
|
if (m) {
|
|
this.setState(m, n)
|
|
}
|
|
}
|
|
},
|
|
_unSelect: function(a) {
|
|
var c = dhx4.s2b(a.conf.state);
|
|
if (c) {
|
|
if (/dhxrb_highlight1/.test(a.base.className)) {
|
|
a.base.className = a.base.className.replace(/\s?dhxrb_highlight1/, "")
|
|
}
|
|
a.conf.state = false
|
|
}
|
|
},
|
|
_getSelectedNeighbor: function(h, o) {
|
|
var g = o._items[h.parentId],
|
|
c, a, n, m = null;
|
|
a = g.childIds.length;
|
|
for (c = 0; c < a; c++) {
|
|
n = o._items[g.childIds[c]];
|
|
if (n.type == "buttonSegment" && n.conf.state) {
|
|
m = n;
|
|
break
|
|
}
|
|
}
|
|
return m
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items.buttonSelect = {
|
|
itemCollection: [],
|
|
_isAttachedEventInWindow: false,
|
|
afterRender: function(c) {
|
|
var a = c.base.childNodes[1];
|
|
a.innerHTML += "<span class='dhxrb_arrow'> </span>";
|
|
c.menu = null;
|
|
this.itemCollection.push(c);
|
|
this._attachEventToWindow();
|
|
a = null
|
|
},
|
|
setText: function(a, g) {
|
|
var c = a.base.childNodes[1].lastChild;
|
|
a.conf.text = g;
|
|
a.base.childNodes[1].innerHTML = g;
|
|
a.base.childNodes[1].appendChild(c)
|
|
},
|
|
_attachEventToWindow: function() {
|
|
if (this._isAttachedEventInWindow == false) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
document.body.addEventListener("mousedown", this._hideAllMenus, false)
|
|
} else {
|
|
document.body.attachEvent("onmousedown", this._hideAllMenus)
|
|
}
|
|
this._isAttachedEventInWindow = true
|
|
}
|
|
},
|
|
_detachEventFromWindow: function() {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
document.body.removeEventListener("mousedown", this._hideAllMenus, false)
|
|
} else {
|
|
document.body.detachEvent("onmousedown", this._hideAllMenus)
|
|
}
|
|
this._isAttachedEventInWindow = false
|
|
},
|
|
_hideAllMenus: function(l) {
|
|
l = l || event;
|
|
var g = l.target || l.srcElement;
|
|
var a = true;
|
|
while (g != null && a == true) {
|
|
if (g.className != null && /SubLevelArea_Polygon/i.test(g.className)) {
|
|
a = false
|
|
} else {
|
|
g = g.parentNode
|
|
}
|
|
}
|
|
if (a == false) {
|
|
return
|
|
}
|
|
var c = dhtmlXRibbon.prototype.items.buttonSelect.itemCollection;
|
|
for (var n in c) {
|
|
var h = c[n];
|
|
if (h.menu instanceof dhtmlXMenuObject) {
|
|
if (h._skipHiding) {
|
|
h._skipHiding = false
|
|
} else {
|
|
dhtmlXRibbon.prototype.items.buttonSelect.hideMenu(h)
|
|
}
|
|
}
|
|
}
|
|
},
|
|
mousedown: function(a, g, c) {
|
|
a._skipHiding = true;
|
|
this.showMenu(a);
|
|
return false
|
|
},
|
|
mouseup: function(a) {
|
|
return false
|
|
},
|
|
click: function() {},
|
|
setState: function() {},
|
|
showMenu: function(c) {
|
|
var a = dhx4.absLeft(c.base),
|
|
g = dhx4.absTop(c.base) + c.base.offsetHeight;
|
|
if (!(c.menu instanceof dhtmlXMenuObject)) {
|
|
c.menu = new dhtmlXMenuObject({
|
|
parent: c.base,
|
|
icons_path: c.conf.icons_path,
|
|
context: true,
|
|
items: c.conf.items,
|
|
skin: c.conf.skin
|
|
});
|
|
if (c.conf.data) {
|
|
c.menu.loadStruct(c.conf.data);
|
|
delete c.conf.data
|
|
}
|
|
c.menu.setAutoHideMode(false);
|
|
c.menu.attachEvent("onHide", function(h) {
|
|
if (h == null) {
|
|
dhtmlXRibbon.prototype.items.buttonSelect._doOnHideMenu(c)
|
|
}
|
|
});
|
|
c.menu.attachEvent("onShow", function(h) {
|
|
if (h == null) {
|
|
dhtmlXRibbon.prototype.items.buttonSelect._doOnShowMenu(c)
|
|
}
|
|
});
|
|
c.menu.attachEvent("onClick", function(h) {
|
|
c.callEvent("onClick", [h])
|
|
});
|
|
c.base.oncontextmenu = function() {
|
|
return false
|
|
};
|
|
dhtmlXRibbon.prototype.items.buttonSelect.showMenu(c)
|
|
} else {
|
|
c.menu.showContextMenu(a, g)
|
|
}
|
|
},
|
|
hideMenu: function(a) {
|
|
if (a.menu instanceof dhtmlXMenuObject) {
|
|
a.menu.hideContextMenu()
|
|
}
|
|
},
|
|
remove: function(c) {
|
|
var g, a;
|
|
if (c.menu instanceof dhtmlXMenuObject) {
|
|
c.menu.unload();
|
|
c.menu = null
|
|
}
|
|
c.base.oncontextmenu = null;
|
|
g = dhtmlXRibbon.prototype._indexOf(dhtmlXRibbon.prototype.items.buttonSelect.itemCollection, c);
|
|
if (g != -1) {
|
|
dhtmlXRibbon.prototype.items.buttonSelect.itemCollection.splice(g, 1)
|
|
}
|
|
if (dhtmlXRibbon.prototype.items.buttonSelect.itemCollection.length == 0) {
|
|
this._detachEventFromWindow()
|
|
}
|
|
},
|
|
setSkin: function(a, c) {
|
|
if (a.menu instanceof dhtmlXMenuObject) {
|
|
a.menu.setSkin(c)
|
|
}
|
|
},
|
|
_doOnHideMenu: function(a) {
|
|
if (a._skipHiding) {
|
|
a._skipHiding = false
|
|
} else {
|
|
if (/dhxrb_highlight1/.test(a.base.className)) {
|
|
a.base.className = a.base.className.replace(/\s?dhxrb_highlight1/, "")
|
|
}
|
|
}
|
|
},
|
|
_doOnShowMenu: function(a) {
|
|
if (!/dhxrb_highlight1/.test(a.base.className)) {
|
|
a.base.className += " dhxrb_highlight1"
|
|
}
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items.group = {
|
|
render: function(c, a) {
|
|
var g, h;
|
|
h = {
|
|
base: c,
|
|
id: a.id,
|
|
type: a.type,
|
|
conf: {
|
|
disable: false,
|
|
skin: a.skin
|
|
},
|
|
childIds: []
|
|
};
|
|
c.className = "dhxrb_group";
|
|
for (g in a) {
|
|
if (g == "id" || g == "onclick" || g == "type") {
|
|
continue
|
|
}
|
|
h.conf[g] = a[g]
|
|
}
|
|
return h
|
|
},
|
|
callAfterInit: function(m) {
|
|
this._detachEventFromItem(m.base);
|
|
var h, a, n = m.conf.list,
|
|
o, g, c;
|
|
a = (n) ? n.length : 0;
|
|
for (h = 0; h < a; h++) {
|
|
o = this._addItem(m.id, null, null, n[h]);
|
|
if (o == null) {
|
|
continue
|
|
}
|
|
g = o.base.childNodes[1];
|
|
if (g && !g.innerHTML && !/\s?dhxrb_label_hide/i.test(g.className)) {
|
|
g.className += " dhxrb_label_hide"
|
|
}
|
|
}
|
|
dhtmlXRibbon.prototype.items.group.normalize(m);
|
|
if (m.conf.disable) {
|
|
this.disable(m.id)
|
|
}
|
|
n = undefined
|
|
},
|
|
normalize: function(o) {
|
|
var a = o.base.children;
|
|
var g = a.length,
|
|
c = false,
|
|
q = 0;
|
|
var h, n;
|
|
for (var m = 0; m < g; m++) {
|
|
if (!/dhxrb_separator_group/i.test(a[m].className)) {
|
|
if (/dhxrb_item_hide/i.test(a[m].className)) {
|
|
q++;
|
|
continue
|
|
}
|
|
}
|
|
if ((Math.ceil((m - q) / 2) - Math.floor((m - q) / 2)) == 0) {
|
|
if (/dhxrb_separator_group/i.test(a[m].className)) {
|
|
a[m].parentNode.removeChild(a[m]);
|
|
c = true;
|
|
break
|
|
}
|
|
} else {
|
|
if (!/dhxrb_separator_group/i.test(a[m].className)) {
|
|
h = document.createElement("div");
|
|
h.className = "dhxrb_separator_groupp";
|
|
o.base.insertBefore(h, a[m]);
|
|
c = true;
|
|
break
|
|
}
|
|
}
|
|
}
|
|
if (c) {
|
|
this.normalize(o)
|
|
} else {
|
|
n = o.base.lastChild;
|
|
if (n && /dhxrb_separator_group/i.test(n.className)) {
|
|
n.parentNode.removeChild(n)
|
|
}
|
|
}
|
|
},
|
|
hideChild: function(c, h) {
|
|
var a = dhtmlXRibbon.prototype._indexOf(c.base.children, h.base);
|
|
if (a == 0) {
|
|
a++
|
|
} else {
|
|
if (a != -1) {
|
|
a--
|
|
} else {
|
|
return
|
|
}
|
|
}
|
|
var g = c.base.children[a];
|
|
if (g && /dhxrb_separator_group/i.test(g.className)) {
|
|
g.parentNode.removeChild(g)
|
|
}
|
|
},
|
|
showChild: function(a) {
|
|
this.normalize(a)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items.input = {
|
|
render: function(c, a) {
|
|
var g, h;
|
|
h = {
|
|
base: c,
|
|
id: a.id,
|
|
type: a.type,
|
|
conf: {
|
|
text: "",
|
|
text_pos: (a.isbig) ? "bottom" : "right",
|
|
img: null,
|
|
imgdis: null,
|
|
isbig: false,
|
|
disable: false,
|
|
skin: a.skin,
|
|
value: ""
|
|
}
|
|
};
|
|
for (g in a) {
|
|
if (g == "id" || g == "onclick" || g == "type") {
|
|
continue
|
|
}
|
|
h.conf[g] = a[g]
|
|
}
|
|
c.innerHTML = "<input type='text' class='dhxrb_input'><div class='dhxrb_label_button'>" + h.conf.text + "</div>";
|
|
if (typeof(this.afterRender) == "function") {
|
|
this.afterRender(h)
|
|
}
|
|
if (h.conf.disable) {
|
|
this.disable(h)
|
|
}
|
|
if (h.conf.width) {
|
|
this.setWidth(h, h.conf.width)
|
|
}
|
|
if (h.conf.value) {
|
|
this.setValue(h, h.conf.value)
|
|
}
|
|
return h
|
|
},
|
|
callAfterInit: function(c) {
|
|
var a = c.base.childNodes[0];
|
|
this._detachEventFromItem(c.base);
|
|
this._attachEventsToInput(a)
|
|
},
|
|
setText: dhtmlXRibbon.prototype.items.button.setText,
|
|
getText: dhtmlXRibbon.prototype.items.button.getText,
|
|
change: function(c) {
|
|
var a = c.base.childNodes[0];
|
|
c.conf.value = a.value
|
|
},
|
|
keydown: function(c, h, g) {
|
|
if (g.keyCode == 13) {
|
|
var a = c.base.childNodes[0];
|
|
c.conf.value = a.value;
|
|
h.callEvent("onEnter", [c.id, c.conf.value])
|
|
}
|
|
},
|
|
remove: function(c, g) {
|
|
var a = c.base.childNodes[0];
|
|
g._detachEventsFromInput(a)
|
|
},
|
|
getValue: function(c) {
|
|
var a = c.base.childNodes[0],
|
|
g;
|
|
g = a.value;
|
|
a = undefined;
|
|
return g
|
|
},
|
|
setValue: function(c, g) {
|
|
var a = c.base.childNodes[0],
|
|
g;
|
|
a.value = g;
|
|
c.conf.value = g
|
|
},
|
|
setWidth: function(c, g) {
|
|
var a = c.base.childNodes[0];
|
|
a.style.width = parseInt(g) + "px"
|
|
},
|
|
disable: function(g) {
|
|
var c = g.base.childNodes[0],
|
|
a = g.base.childNodes[1];
|
|
c.disabled = true;
|
|
if (!/\s?dhxrb_disable_text_style/i.test(a.className)) {
|
|
a.className += " dhxrb_disable_text_style"
|
|
}
|
|
return true
|
|
},
|
|
enable: function(g) {
|
|
var c = g.base.childNodes[0],
|
|
a = g.base.childNodes[1];
|
|
c.disabled = false;
|
|
if (/\s?dhxrb_disable_text_style/i.test(a.className)) {
|
|
a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, "")
|
|
}
|
|
return true
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items.checkbox = {
|
|
render: function(c, a) {
|
|
var g, h;
|
|
h = {
|
|
base: c,
|
|
id: a.id,
|
|
type: a.type,
|
|
conf: {
|
|
text: "",
|
|
text_pos: (a.isbig) ? "bottom" : "right",
|
|
disable: false,
|
|
checked: false
|
|
}
|
|
};
|
|
for (g in a) {
|
|
if (g == "id" || g == "onclick" || g == "type") {
|
|
continue
|
|
}
|
|
h.conf[g] = a[g]
|
|
}
|
|
c.innerHTML = "<div class='dhxrb_checkbox'></div><div class='dhxrb_label_checkbox'>" + h.conf.text + "</div>";
|
|
if (typeof(this.afterRender) == "function") {
|
|
this.afterRender(h)
|
|
}
|
|
if (h.conf.checked) {
|
|
this.check(h)
|
|
}
|
|
return h
|
|
},
|
|
callAfterInit: function(a) {
|
|
if (a.conf.disable) {
|
|
this.disable(a.id)
|
|
}
|
|
},
|
|
setText: dhtmlXRibbon.prototype.items.button.setText,
|
|
getText: dhtmlXRibbon.prototype.items.button.getText,
|
|
mousedown: function(a) {
|
|
return false
|
|
},
|
|
mouseup: function(a) {
|
|
return false
|
|
},
|
|
click: function(a, g, c) {
|
|
if (c.button != 0) {
|
|
return false
|
|
}
|
|
if (a.type == "checkbox") {
|
|
if (a.conf.checked) {
|
|
this.uncheck(a, true)
|
|
} else {
|
|
this.check(a, true)
|
|
}
|
|
}
|
|
},
|
|
check: function(a, c) {
|
|
c = c || false;
|
|
if (a.type != "checkbox") {
|
|
return
|
|
}
|
|
a.conf.checked = true;
|
|
if (!/\s?dhxrb_checked/i.test(a.base.className)) {
|
|
a.base.className += " dhxrb_checked"
|
|
}
|
|
if (c) {
|
|
a.callEvent("onCheck", [a.id, a.conf.checked])
|
|
}
|
|
},
|
|
uncheck: function(a, c) {
|
|
c = c || false;
|
|
if (a.type != "checkbox") {
|
|
return
|
|
}
|
|
a.conf.checked = false;
|
|
if (/\s?dhxrb_checked/i.test(a.base.className)) {
|
|
a.base.className = a.base.className.replace(/\s?dhxrb_checked/i, "")
|
|
}
|
|
if (c) {
|
|
a.callEvent("onCheck", [a.id, a.conf.checked])
|
|
}
|
|
},
|
|
disable: function(a) {
|
|
return true
|
|
},
|
|
enable: function(a) {
|
|
return true
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items.text = {
|
|
render: function(a, h) {
|
|
var g = {
|
|
base: a,
|
|
id: h.id,
|
|
type: h.type,
|
|
conf: {
|
|
text: ""
|
|
}
|
|
};
|
|
for (var c in h) {
|
|
if (c == "id" || c == "type") {
|
|
continue
|
|
}
|
|
g.conf[c] = h[c]
|
|
}
|
|
a.innerHTML = "<div class='dhxrb_item_text'>" + g.conf.text + "</div>";
|
|
if (typeof(this.afterRender) == "function") {
|
|
this.afterRender(g)
|
|
}
|
|
return g
|
|
},
|
|
callAfterInit: function(a) {
|
|
this._detachEventFromItem(a.base)
|
|
},
|
|
getText: function(a) {
|
|
return a.conf.text
|
|
},
|
|
setText: function(a, c) {
|
|
a.conf.text = c;
|
|
a.base.innerHTML = c
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items.buttonCombo = {
|
|
render: function(a, c) {
|
|
var g, h, l = {};
|
|
h = {
|
|
base: a,
|
|
id: c.id,
|
|
type: c.type,
|
|
conf: {
|
|
text: "",
|
|
text_pos: "right",
|
|
width: 140,
|
|
skin: c.skin
|
|
}
|
|
};
|
|
for (g in c) {
|
|
if (g == "id" || g == "onclick" || g == "type") {
|
|
continue
|
|
}
|
|
h.conf[g] = c[g]
|
|
}
|
|
for (g in h.conf) {
|
|
if (g == "text" || g == "text_pos" || g == "disable" || g == "data") {
|
|
continue
|
|
}
|
|
l[g] = h.conf[g]
|
|
}
|
|
h.base.className += " dhxrb_buttoncombo_cont";
|
|
h.base.innerHTML = "<div class='dhxrb_buttoncombo'></div><div class='dhxrb_label_button'>" + h.conf.text + "</div>";
|
|
l.parent = h.base.firstChild;
|
|
h.combo = new dhtmlXCombo(l);
|
|
h.combo.setSkin(l.skin);
|
|
h.combo.attachEvent("onChange", function(m, n) {
|
|
h._callHandler(h.id, [m, n]);
|
|
h.callEvent("onSelectOption", [h.id, m, n])
|
|
});
|
|
if (h.conf.data) {
|
|
h.combo.load(h.conf.data);
|
|
delete h.conf.data
|
|
}
|
|
if (typeof(this.afterRender) == "function") {
|
|
this.afterRender(h)
|
|
}
|
|
if (h.conf.disable) {
|
|
this.disable(h)
|
|
}
|
|
return h
|
|
},
|
|
callAfterInit: function(a) {
|
|
this._detachEventFromItem(a.base)
|
|
},
|
|
disable: function(c) {
|
|
var a = c.base.lastChild;
|
|
if (c.combo instanceof dhtmlXCombo) {
|
|
c.combo.disable()
|
|
}
|
|
if (!/\s?dhxrb_disable_text_style/i.test(a.className)) {
|
|
a.className += " dhxrb_disable_text_style"
|
|
}
|
|
return true
|
|
},
|
|
enable: function(c) {
|
|
var a = c.base.lastChild;
|
|
if (c.combo instanceof dhtmlXCombo) {
|
|
c.combo.enable()
|
|
}
|
|
if (/\s?dhxrb_disable_text_style/i.test(a.className)) {
|
|
a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, "")
|
|
}
|
|
return true
|
|
},
|
|
remove: function(a) {
|
|
if (a.combo instanceof dhtmlXCombo) {
|
|
a.combo.unload();
|
|
a.combo = null
|
|
}
|
|
},
|
|
getValue: function(a) {
|
|
var c = null;
|
|
if (a.combo instanceof dhtmlXCombo) {
|
|
c = a.combo.getSelectedValue()
|
|
}
|
|
return c
|
|
},
|
|
setValue: function(a, c) {
|
|
if (a.combo instanceof dhtmlXCombo) {
|
|
a.combo.setComboValue(c)
|
|
}
|
|
},
|
|
setSkin: function(a, c) {
|
|
if (a.combo instanceof dhtmlXCombo) {
|
|
a.combo.setSkin(c)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items.slider = {
|
|
render: function(a, l) {
|
|
var g, h, c = {};
|
|
h = {
|
|
base: a,
|
|
id: l.id,
|
|
type: l.type,
|
|
conf: {
|
|
text: "",
|
|
text_pos: "right",
|
|
size: 150,
|
|
vertical: false,
|
|
min: 0,
|
|
max: 99,
|
|
value: 0,
|
|
step: 1,
|
|
margin: 10,
|
|
disabled: false,
|
|
enableTooltip: false
|
|
}
|
|
};
|
|
for (g in l) {
|
|
if (g == "id" || g == "onclick" || g == "type") {
|
|
continue
|
|
}
|
|
h.conf[g] = l[g]
|
|
}
|
|
for (g in h.conf) {
|
|
if (g == "text" || g == "text_pos" || g == "isbig") {
|
|
continue
|
|
}
|
|
c[g] = h.conf[g]
|
|
}
|
|
h.base.innerHTML = "<center><div class='dhxrb_slider'></div></center><div class='dhxrb_label_button'>" + h.conf.text + "</div>";
|
|
c.parent = h.base.firstChild.firstChild;
|
|
h.slider = new dhtmlXSlider(c);
|
|
if (typeof(this.afterRender) == "function") {
|
|
this.afterRender(h)
|
|
}
|
|
if (h.conf.disable) {
|
|
this.disable(h)
|
|
}
|
|
h.slider.attachEvent("onChange", function(m) {
|
|
h._callHandler(h.id, [m]);
|
|
h.callEvent("onValueChange", [h.id, m])
|
|
});
|
|
return h
|
|
},
|
|
callAfterInit: function(a) {
|
|
this._detachEventFromItem(a.base)
|
|
},
|
|
setSkin: function(a, c) {
|
|
if (a.slider instanceof dhtmlXSlider) {
|
|
a.slider.setSkin(c)
|
|
}
|
|
},
|
|
disable: function(c) {
|
|
var a = c.base.childNodes[1];
|
|
if (c.slider instanceof dhtmlXSlider) {
|
|
c.slider.disable()
|
|
}
|
|
if (!/\s?dhxrb_disable_text_style/i.test(a.className)) {
|
|
a.className += " dhxrb_disable_text_style"
|
|
}
|
|
return true
|
|
},
|
|
enable: function(c) {
|
|
var a = c.base.childNodes[1];
|
|
if (c.slider instanceof dhtmlXSlider) {
|
|
c.slider.enable()
|
|
}
|
|
if (/\s?dhxrb_disable_text_style/i.test(a.className)) {
|
|
a.className = a.className.replace(/\s?dhxrb_disable_text_style/i, "")
|
|
}
|
|
return true
|
|
},
|
|
remove: function(a) {
|
|
if (a.slider instanceof dhtmlXSlider) {
|
|
a.slider.unload();
|
|
a.slider = null
|
|
}
|
|
},
|
|
getValue: function(a) {
|
|
var c = null;
|
|
if (a.slider instanceof dhtmlXSlider) {
|
|
c = a.slider.getValue()
|
|
}
|
|
return c
|
|
},
|
|
setValue: function(a, c) {
|
|
if (a.slider instanceof dhtmlXSlider) {
|
|
a.slider.setValue(c)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.items._extends = function(g, c) {
|
|
var a;
|
|
for (a in c) {
|
|
g[a] = g[a] || c[a]
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXRibbon.prototype._addNewLevel = function(g) {
|
|
var c, a;
|
|
if (g.conf.mode == "rows") {
|
|
c = g.contForItems.lastChild;
|
|
if (c && /dhxrb_block_rows/i.test(c.className) && (c.childNodes.length < 3)) {
|
|
a = document.createElement("div");
|
|
a.className = "dhxrb_block_row";
|
|
c.appendChild(a)
|
|
} else {
|
|
c = document.createElement("div");
|
|
c.className = "dhxrb_block_rows";
|
|
g.contForItems.appendChild(c);
|
|
a = document.createElement("div");
|
|
a.className = "dhxrb_block_row";
|
|
c.appendChild(a)
|
|
}
|
|
} else {
|
|
var a = document.createElement("div");
|
|
a.className = "dhxrb_3rows_block";
|
|
g.contForItems.appendChild(a)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._attachEventForItem = function(a) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.addEventListener("mouseover", this._doOnHighlight0, false);
|
|
a.addEventListener("mouseout", this._doOffHighlight0, false);
|
|
a.addEventListener("mousedown", this._doOnHighlight1, false);
|
|
a.addEventListener("mouseup", this._doOffHighlight1, false);
|
|
a.addEventListener("click", this._doOnClick, false)
|
|
} else {
|
|
a.attachEvent("onmouseover", this._doOnHighlight0);
|
|
a.attachEvent("onmouseout", this._doOffHighlight0);
|
|
a.attachEvent("onmousedown", this._doOnHighlight1);
|
|
a.attachEvent("onmouseup", this._doOffHighlight1);
|
|
a.attachEvent("onclick", this._doOnClick)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._detachEventFromItem = function(a) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.removeEventListener("mouseover", this._doOnHighlight0, false);
|
|
a.removeEventListener("mouseout", this._doOffHighlight0, false);
|
|
a.removeEventListener("mousedown", this._doOnHighlight1, false);
|
|
a.removeEventListener("mouseup", this._doOffHighlight1, false);
|
|
a.removeEventListener("click", this._doOnClick, false)
|
|
} else {
|
|
a.detachEvent("onmouseover", this._doOnHighlight0);
|
|
a.detachEvent("onmouseout", this._doOffHighlight0);
|
|
a.detachEvent("onmousedown", this._doOnHighlight1);
|
|
a.detachEvent("onmouseup", this._doOffHighlight1);
|
|
a.detachEvent("onclick", this._doOnClick)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._attachEventsToInput = function(a) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.addEventListener("focus", this._doOnFocus, false);
|
|
a.addEventListener("blur", this._doOnBlur, false);
|
|
a.addEventListener("change", this._doOnChange, false);
|
|
a.addEventListener("keydown", this._doOnKeydown, false)
|
|
} else {
|
|
a.attachEvent("onfocus", this._doOnFocus);
|
|
a.attachEvent("onblur", this._doOnBlur);
|
|
a.attachEvent("onchange", this._doOnChange);
|
|
a.attachEvent("onkeydown", this._doOnKeydown)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._detachEventsFromInput = function(a) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.removeEventListener("focus", this._doOnFocus, false);
|
|
a.removeEventListener("blur", this._doOnBlur, false);
|
|
a.removeEventListener("change", this._doOnChange, false);
|
|
a.removeEventListener("keydown", this._doOnKeydown, false)
|
|
} else {
|
|
a.detachEvent("onfocus", this._doOnFocus);
|
|
a.detachEvent("onblur", this._doOnBlur);
|
|
a.detachEvent("onchange", this._doOnChange);
|
|
a.detachEvent("onkeydown", this._doOnKeydown)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._getContainerForSmallItem = function(g) {
|
|
var c = g.contForItems.lastChild,
|
|
a = null;
|
|
if (g.conf.mode == "rows") {
|
|
if (c && /\s?dhxrb_block_rows/i.test(c.className)) {
|
|
a = c.lastChild;
|
|
if (!a) {
|
|
a = document.createElement("div");
|
|
a.className = "dhxrb_block_row";
|
|
c.appendChild(a)
|
|
}
|
|
} else {
|
|
c = document.createElement("div");
|
|
c.className = "dhxrb_block_rows";
|
|
g.contForItems.appendChild(c);
|
|
a = document.createElement("div");
|
|
a.className = "dhxrb_block_row";
|
|
c.appendChild(a)
|
|
}
|
|
} else {
|
|
if (c && /dhxrb_3rows_block/i.test(c.className) && (c.childNodes.length < 3)) {
|
|
a = c
|
|
} else {
|
|
a = document.createElement("div");
|
|
a.className = "dhxrb_3rows_block";
|
|
g.contForItems.appendChild(a)
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXRibbon.prototype._findItemByNode = function(a) {
|
|
while (a && !a._dhx_ribbonId) {
|
|
a = a.parentNode
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXRibbon.prototype._indexOf = function(a, h) {
|
|
var g, c;
|
|
c = a.length;
|
|
for (g = 0; g < c; g++) {
|
|
if (a[g] == h) {
|
|
return g
|
|
}
|
|
}
|
|
return -1
|
|
};
|
|
dhtmlXRibbon.prototype._removeItem = function(g) {
|
|
var a, h = -1,
|
|
c = this._items[g.parentId];
|
|
if (g.type == "group") {
|
|
this._removeGroup(g);
|
|
return
|
|
}
|
|
delete this._items[g.id];
|
|
a = g.base.parentNode;
|
|
this._detachEventFromItem(g.base);
|
|
a.removeChild(g.base);
|
|
if (c.type == "block") {
|
|
if (a != c.contForItems && a.childNodes.length == 0) {
|
|
a.parentNode.removeChild(a)
|
|
}
|
|
} else {
|
|
if (c.type == "group") {
|
|
dhtmlXRibbon.prototype.items.group.normalize(c)
|
|
}
|
|
}
|
|
h = this._indexOf(c.childIds, g.id);
|
|
if (h != -1) {
|
|
c.childIds.splice(h, 1)
|
|
}
|
|
if (this.items[g.type] && (typeof(this.items[g.type].remove) == "function")) {
|
|
this.items[g.type].remove(g, this)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._removeGroup = function(h) {
|
|
var c = [],
|
|
l, g = this._items[h.parentId],
|
|
a = h.base.parentNode;
|
|
for (l in h.childIds) {
|
|
l = parseInt(l);
|
|
c.push(this._items[h.childIds[l]])
|
|
}
|
|
for (l in c) {
|
|
l = parseInt(l);
|
|
this._removeItem(c[l])
|
|
}
|
|
delete this._items[h.id];
|
|
if (h.base.parentNode) {
|
|
a.removeChild(h.base)
|
|
}
|
|
if (a.childNodes.length == 0) {
|
|
a.parentNode.removeChild(a)
|
|
}
|
|
l = this._indexOf(g.childIds, h.id);
|
|
if (l != -1) {
|
|
g.childIds.splice(l, 1)
|
|
}
|
|
if (this.items[h.type] && (typeof(this.items[h.type].remove) == "function")) {
|
|
this.items[h.type].remove(h)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._removeBlock = function(h) {
|
|
var a = [],
|
|
g, c;
|
|
for (g in h.childIds) {
|
|
g = parseInt(g);
|
|
a.push(this._items[h.childIds[g]])
|
|
}
|
|
for (g in a) {
|
|
g = parseInt(g);
|
|
this._removeItem(a[g])
|
|
}
|
|
delete this._items[h.id];
|
|
h.base.parentNode.removeChild(h.base);
|
|
if (h.parentId) {
|
|
c = this._items[h.parentId]
|
|
} else {
|
|
c = this
|
|
}
|
|
g = this._indexOf(c.childIds, h.id);
|
|
if (g != -1) {
|
|
c.childIds.splice(g, 1)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._removeTab = function(c, a) {
|
|
var h = [],
|
|
g;
|
|
for (g in c.childIds) {
|
|
g = parseInt(g);
|
|
h.push(this._items[c.childIds[g]])
|
|
}
|
|
for (g in h) {
|
|
g = parseInt(g);
|
|
this._removeBlock(h[g])
|
|
}
|
|
delete this._items[c.id];
|
|
g = this._indexOf(this.childIds, c.id);
|
|
if (g != -1) {
|
|
this.childIds.splice(g, 1)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype._skinCollection = {
|
|
dhx_skyblue: true,
|
|
dhx_web: true,
|
|
dhx_terrace: true
|
|
};
|
|
dhtmlXRibbon.prototype._setSkinForItems = function(g) {
|
|
var a, c;
|
|
for (a in this._items) {
|
|
c = this._items[a];
|
|
c.conf.skin = g;
|
|
if (dhtmlXRibbon.prototype.items[c.type] && typeof(dhtmlXRibbon.prototype.items[c.type].setSkin) == "function") {
|
|
dhtmlXRibbon.prototype.items[c.type].setSkin(c, g)
|
|
}
|
|
}
|
|
c = undefined, a = undefined
|
|
};
|
|
dhtmlXRibbon.prototype._setBlockText = function(a, c) {
|
|
a.conf.text = c;
|
|
a.contForText.innerHTML = c;
|
|
if (!c && (c != 0) && a.contForText.parentNode) {
|
|
a.contForText.parentNode.removeChild(a.contForText)
|
|
} else {
|
|
if (!a.contForText.parentNode) {
|
|
if (a.conf.text_pos == "top") {
|
|
a.base.insertBefore(a.contForText, a.contForItems)
|
|
} else {
|
|
a.base.appendChild(a.contForText)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.hide = function(g) {
|
|
var c = this._items[g];
|
|
if (this.items[c.type] && (typeof(this.items[c.type].hide) == "function")) {
|
|
if (this.items[c.type].hide(c) != true) {
|
|
return
|
|
}
|
|
}
|
|
if (c.type == "tab") {
|
|
return
|
|
} else {
|
|
if (!/\s?dhxrb_item_hide/i.test(c.base.className)) {
|
|
c.base.className += " dhxrb_item_hide"
|
|
}
|
|
}
|
|
var a = this._items[c.parentId];
|
|
if (a && this.items[a.type] && (typeof(this.items[a.type].hideChild) == "function")) {
|
|
this.items[a.type].hideChild(a, c)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.show = function(g) {
|
|
var c = this._items[g];
|
|
if (this.items[c.type] && (typeof(this.items[c.type].show) == "function")) {
|
|
if (this.items[c.type].show(c) != true) {
|
|
return
|
|
}
|
|
}
|
|
if (c.type == "tab") {
|
|
return
|
|
} else {
|
|
if (/\s?dhxrb_item_hide/i.test(c.base.className)) {
|
|
c.base.className = c.base.className.replace(/\s?dhxrb_item_hide/i, "")
|
|
}
|
|
}
|
|
var a = this._items[c.parentId];
|
|
if (a && this.items[a.type] && (typeof(this.items[a.type].showChild) == "function")) {
|
|
this.items[a.type].showChild(a, c)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.getValue = function(g) {
|
|
var a = this._items[g],
|
|
c = undefined;
|
|
if (this.items[a.type] && (typeof(this.items[a.type].getValue) == "function")) {
|
|
return this.items[a.type].getValue(a)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.setValue = function(g, c) {
|
|
var a = this._items[g];
|
|
if (this.items[a.type] && typeof(this.items[a.type].setValue) == "function") {
|
|
this.items[a.type].setValue(a, c)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.check = function(g, c) {
|
|
c = dhx4.s2b(c);
|
|
var a = this._items[g];
|
|
if (a && !a.conf.checked && typeof(this.items[a.type].check) == "function") {
|
|
this.items[a.type].check(a);
|
|
if (c) {
|
|
this.callEvent("onCheck", [a.id, a.conf.checked])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.uncheck = function(g, c) {
|
|
c = dhx4.s2b(c);
|
|
var a = this._items[g];
|
|
if (a && a.conf.checked && typeof(this.items[a.type].uncheck) == "function") {
|
|
this.items[a.type].uncheck(a);
|
|
if (c) {
|
|
this.callEvent("onCheck", [a.id, a.conf.checked])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.disable = function(h, c) {
|
|
var g = this._items[h],
|
|
a;
|
|
if (this.items[g.type] && (typeof(this.items[g.type].disable) == "function")) {
|
|
if (this.items[g.type].disable(g) != true) {
|
|
return
|
|
}
|
|
}
|
|
if (g.type == "tab") {
|
|
return
|
|
} else {
|
|
if (g.type == "block" || g.type == "group") {
|
|
for (a in g.childIds) {
|
|
a = parseInt(a);
|
|
this.disable(g.childIds[a])
|
|
}
|
|
}
|
|
} if (!/\s?dhxrb_item_disable/i.test(g.base.className)) {
|
|
g.base.className += " dhxrb_item_disable"
|
|
}
|
|
g.conf.disable = true
|
|
};
|
|
dhtmlXRibbon.prototype.enable = function(h, c) {
|
|
var g = this._items[h],
|
|
a;
|
|
if (this.items[g.type] && (typeof(this.items[g.type].enable) == "function")) {
|
|
if (this.items[g.type].enable(g) != true) {
|
|
return
|
|
}
|
|
}
|
|
if (g.type == "tab") {
|
|
return
|
|
} else {
|
|
if (g.type == "block" || g.type == "group") {
|
|
for (a in g.childIds) {
|
|
a = parseInt(a);
|
|
this.enable(g.childIds[a])
|
|
}
|
|
}
|
|
} if (/\s?dhxrb_item_disable/i.test(g.base.className)) {
|
|
g.base.className = g.base.className.replace(/\s?dhxrb_item_disable/i, "")
|
|
}
|
|
g.conf.disable = false
|
|
};
|
|
dhtmlXRibbon.prototype.isEnabled = function(c) {
|
|
var a = this._items[c];
|
|
if (this.items[a.type] && typeof(this.items[a.type].isEnabled) == "function") {
|
|
return this.items[a.type].isEnabled(a)
|
|
}
|
|
if (a.type == "tab") {
|
|
return
|
|
} else {
|
|
return a.conf.disable != true
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.isVisible = function(c) {
|
|
var a = this._items[c];
|
|
if (this.items[a.type] && (typeof(this.items[a.type].isVisible) == "function")) {
|
|
return this.items[a.type].isVisible(a)
|
|
}
|
|
if (a.type == "tab") {
|
|
return
|
|
} else {
|
|
return !/\s?dhxrb_item_hide/i.test(a.base.className)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.setItemState = function(h, c, g) {
|
|
c = dhx4.s2b(c);
|
|
g = dhx4.s2b(g);
|
|
var a = this._items[h];
|
|
if (a && (typeof(this.items[a.type].setState) == "function")) {
|
|
switch (a.type) {
|
|
case "buttonSegment":
|
|
this.items[a.type].setState(a, this, g);
|
|
break;
|
|
default:
|
|
this.items[a.type].setState(a, c, g)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.setIconPath = function(a) {
|
|
this.conf.icons_path = a
|
|
};
|
|
dhtmlXRibbon.prototype.removeItem = function(c) {
|
|
var a = this._items[c];
|
|
switch (a.type) {
|
|
case "tab":
|
|
break;
|
|
case "block":
|
|
this._removeBlock(a);
|
|
break;
|
|
case "group":
|
|
this._removeGroup(a);
|
|
break;
|
|
default:
|
|
this._removeItem(a)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.setSkin = function(l) {
|
|
l = (typeof(l) == "string") ? l.toLowerCase() : "";
|
|
if (this._skinCollection[l] != true) {
|
|
return
|
|
}
|
|
var g, c = -1,
|
|
a, h = "dhtmlxribbon";
|
|
g = this._base.className.match(/\S\w+/ig);
|
|
if (g instanceof Array) {
|
|
for (a in this._skinCollection) {
|
|
if (c == -1) {
|
|
c = this._indexOf(g, h + "_" + a)
|
|
} else {
|
|
break
|
|
}
|
|
}
|
|
c = (c == -1) ? g.length : c
|
|
} else {
|
|
g = [];
|
|
c = 0
|
|
}
|
|
g[c] = h + "_" + l;
|
|
this._base.className = g.join(" ");
|
|
this.conf.skin = l;
|
|
if (this._tabbar != null) {
|
|
this._tabbar.setSkin(l)
|
|
}
|
|
this._setSkinForItems(l)
|
|
};
|
|
dhtmlXRibbon.prototype.tabs = function(a) {
|
|
if (this._tabbar instanceof dhtmlXTabBar) {
|
|
return this._tabbar.tabs(a)
|
|
} else {
|
|
return undefined
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.getItemType = function(c) {
|
|
var a = this._items[c];
|
|
if (a) {
|
|
return a.type
|
|
} else {
|
|
return undefined
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.getValue = function(g) {
|
|
var a = this._items[g],
|
|
c = undefined;
|
|
if (a && this.items[a.type] && typeof(this.items[a.type].getValue) == "function") {
|
|
c = this.items[a.type].getValue(a)
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXRibbon.prototype.setValue = function(h, c, g) {
|
|
var a = this._items[h];
|
|
g = g || false;
|
|
if (a && this.items[a.type] && typeof(this.items[a.type].setValue) == "function") {
|
|
this.items[a.type].setValue(a, c)
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.getItemText = function(c) {
|
|
var a = this._items[c];
|
|
if (!a) {
|
|
return null
|
|
} else {
|
|
if (a.type == "tab") {
|
|
return this.tabs(a.id).getText()
|
|
} else {
|
|
if (a.type == "block") {
|
|
return this.items.button.getText(a)
|
|
} else {
|
|
if (this.items[a.type] && typeof(this.items[a.type].getText) == "function") {
|
|
return this.items[a.type].getText(a)
|
|
} else {
|
|
return null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXRibbon.prototype.setItemText = function(g, c) {
|
|
var a = this._items[g];
|
|
if (!a) {
|
|
return
|
|
} else {
|
|
if (a.type == "tab") {
|
|
this.tabs(a.id).setText(c)
|
|
} else {
|
|
if (a.type == "block") {
|
|
this._setBlockText(a, c)
|
|
} else {
|
|
if (this.items[a.type] && typeof(this.items[a.type].setText) == "function") {
|
|
this.items[a.type].setText(a, c)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
(function() {
|
|
var a = dhtmlXRibbon.prototype.items;
|
|
a.buttonTwoState = a._extends(a.buttonTwoState, a.button);
|
|
a.buttonSelect = a._extends(a.buttonSelect, a.buttonTwoState);
|
|
a.buttonSegment = a._extends(a.buttonSegment, a.buttonTwoState)
|
|
})();
|
|
|
|
function dhtmlXToolbarObject(c, g) {
|
|
var a = this;
|
|
this.conf = {
|
|
skin: (g || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxtoolbar") || "dhx_skyblue"),
|
|
align: "left",
|
|
align_autostart: "left",
|
|
icons_path: "",
|
|
iconSize: 18,
|
|
sel_ofs_x: 0,
|
|
sel_ofs_y: 0,
|
|
xml_autoload: null,
|
|
items_autoload: null
|
|
};
|
|
if (typeof(c) == "object" && c != null && typeof(c.tagName) == "undefined") {
|
|
if (c.icons_path != null || c.icon_path != null) {
|
|
this.conf.icons_path = (c.icons_path || c.icon_path)
|
|
}
|
|
if (c.icons_size != null) {
|
|
this.conf.icons_size_autoload = c.icons_size
|
|
}
|
|
if (c.json != null) {
|
|
this.conf.json_autoload = c.json
|
|
}
|
|
if (c.xml != null) {
|
|
this.conf.xml_autoload = c.xml
|
|
}
|
|
if (c.onload != null) {
|
|
this.conf.onload_autoload = c.onload
|
|
}
|
|
if (c.items != null) {
|
|
this.conf.items_autoload = c.items
|
|
}
|
|
if (c.skin != null) {
|
|
this.conf.skin = c.skin
|
|
}
|
|
if (c.align != null) {
|
|
this.conf.align_autostart = c.align
|
|
}
|
|
c = c.parent
|
|
}
|
|
this.cont = (typeof(c) != "object") ? document.getElementById(c) : c;
|
|
while (this.cont.childNodes.length > 0) {
|
|
this.cont.removeChild(this.cont.childNodes[0])
|
|
}
|
|
c = null;
|
|
this.cont.dir = "ltr";
|
|
this.base = document.createElement("DIV");
|
|
this.base.className = "dhxtoolbar_float_left";
|
|
this.cont.appendChild(this.base);
|
|
if (window.dhx4.isIPad) {
|
|
this.cont.ontouchstart = function(h) {
|
|
h = h || event;
|
|
if ((String(h.target.tagName || "").toLowerCase() == "input")) {
|
|
return true
|
|
}
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.returnValue = false
|
|
}
|
|
h.cancelBubble = true;
|
|
return false
|
|
}
|
|
}
|
|
this.setSkin(this.conf.skin);
|
|
this.objPull = {};
|
|
this.anyUsed = "none";
|
|
this._genStr = function(h) {
|
|
var l = "";
|
|
var n = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
for (var m = 0; m < h; m++) {
|
|
l += n.charAt(Math.round(Math.random() * (n.length - 1)))
|
|
}
|
|
return l
|
|
};
|
|
this.rootTypes = new Array("button", "buttonSelect", "buttonTwoState", "separator", "label", "slider", "text", "buttonInput");
|
|
this.idPrefix = this._genStr(12);
|
|
window.dhx4._enableDataLoading(this, "_initObj", "_xmlToJson", "toolbar", {
|
|
struct: true
|
|
});
|
|
window.dhx4._eventable(this);
|
|
this._getObj = function(n, h) {
|
|
var l = null;
|
|
for (var m = 0; m < n.childNodes.length; m++) {
|
|
if (n.childNodes[m].tagName != null) {
|
|
if (String(n.childNodes[m].tagName).toLowerCase() == String(h).toLowerCase()) {
|
|
l = n.childNodes[m]
|
|
}
|
|
}
|
|
}
|
|
return l
|
|
};
|
|
this._addImgObj = function(l) {
|
|
var h = document.createElement("IMG");
|
|
if (l.childNodes.length > 0) {
|
|
l.insertBefore(h, l.childNodes[0])
|
|
} else {
|
|
l.appendChild(h)
|
|
}
|
|
return h
|
|
};
|
|
this._setItemImage = function(n, l, h) {
|
|
if (h == true) {
|
|
n.imgEn = l
|
|
} else {
|
|
n.imgDis = l
|
|
} if ((!n.state && h == true) || (n.state && h == false)) {
|
|
return
|
|
}
|
|
var m = this._getObj(n.obj, "img");
|
|
if (m == null) {
|
|
m = this._addImgObj(n.obj)
|
|
}
|
|
m.src = this.conf.icons_path + l
|
|
};
|
|
this._clearItemImage = function(m, h) {
|
|
if (h == true) {
|
|
m.imgEn = ""
|
|
} else {
|
|
m.imgDis = ""
|
|
} if ((!m.state && h == true) || (m.state && h == false)) {
|
|
return
|
|
}
|
|
var l = this._getObj(m.obj, "img");
|
|
if (l != null) {
|
|
l.parentNode.removeChild(l)
|
|
}
|
|
};
|
|
this._setItemText = function(h, m) {
|
|
var l = this._getObj(h.obj, "div");
|
|
if (m == null || m.length == 0) {
|
|
if (l != null) {
|
|
l.parentNode.removeChild(l)
|
|
}
|
|
return
|
|
}
|
|
if (l == null) {
|
|
l = document.createElement("DIV");
|
|
l.className = "dhxtoolbar_text";
|
|
h.obj.appendChild(l)
|
|
}
|
|
l.innerHTML = m
|
|
};
|
|
this._getItemText = function(h) {
|
|
var l = this._getObj(h.obj, "div");
|
|
if (l != null) {
|
|
return l.innerHTML
|
|
}
|
|
return ""
|
|
};
|
|
this._enableItem = function(l) {
|
|
if (l.state) {
|
|
return
|
|
}
|
|
l.state = true;
|
|
if (this.objPull[l.id]["type"] == "buttonTwoState" && this.objPull[l.id]["obj"]["pressed"] == true) {
|
|
l.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres";
|
|
l.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"
|
|
} else {
|
|
l.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def";
|
|
l.obj.renderAs = l.obj.className
|
|
} if (l.arw) {
|
|
l.arw.className = String(l.obj.className).replace("btn", "arw")
|
|
}
|
|
var h = this._getObj(l.obj, "img");
|
|
if (l.imgEn != "") {
|
|
if (h == null) {
|
|
h = this._addImgObj(l.obj)
|
|
}
|
|
h.src = this.conf.icons_path + l.imgEn
|
|
} else {
|
|
if (h != null) {
|
|
h.parentNode.removeChild(h)
|
|
}
|
|
}
|
|
};
|
|
this._disableItem = function(l) {
|
|
if (!l.state) {
|
|
return
|
|
}
|
|
l.state = false;
|
|
l.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.objPull[l.id]["type"] == "buttonTwoState" && l.obj.pressed ? "pres_" : "") + "dis";
|
|
l.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def";
|
|
if (l.arw) {
|
|
l.arw.className = String(l.obj.className).replace("btn", "arw")
|
|
}
|
|
var h = this._getObj(l.obj, "img");
|
|
if (l.imgDis != "") {
|
|
if (h == null) {
|
|
h = this._addImgObj(l.obj)
|
|
}
|
|
h.src = this.conf.icons_path + l.imgDis
|
|
} else {
|
|
if (h != null) {
|
|
h.parentNode.removeChild(h)
|
|
}
|
|
} if (l.polygon != null) {
|
|
if (l.polygon.style.display != "none") {
|
|
window.dhx4.zim.clear(l.polygon._idd);
|
|
l.polygon.style.display = "none";
|
|
if (l.polygon._ie6cover) {
|
|
l.polygon._ie6cover.style.display = "none"
|
|
}
|
|
if (this.conf.skin == "dhx_terrace") {
|
|
this._improveTerraceButtonSelect(l.id, true)
|
|
}
|
|
}
|
|
}
|
|
this.anyUsed = "none"
|
|
};
|
|
this.clearAll = function() {
|
|
for (var h in this.objPull) {
|
|
this._removeItem(String(h).replace(this.idPrefix, ""))
|
|
}
|
|
};
|
|
this._doOnClick = function(h) {
|
|
if (a && a.forEachItem) {
|
|
a.forEachItem(function(m) {
|
|
if (a.objPull[a.idPrefix + m]["type"] == "buttonSelect") {
|
|
var l = a.objPull[a.idPrefix + m];
|
|
if (l.arw._skip === true) {
|
|
l.arw._skip = false
|
|
} else {
|
|
if (l.polygon.style.display != "none") {
|
|
l.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def";
|
|
l.obj.className = l.obj.renderAs;
|
|
l.arw.className = String(l.obj.renderAs).replace("btn", "arw");
|
|
a.anyUsed = "none";
|
|
window.dhx4.zim.clear(l.polygon._idd);
|
|
l.polygon.style.display = "none";
|
|
if (l.polygon._ie6cover) {
|
|
l.polygon._ie6cover.style.display = "none"
|
|
}
|
|
if (a.conf.skin == "dhx_terrace") {
|
|
a._improveTerraceButtonSelect(l.id, true)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
}
|
|
};
|
|
if (window.dhx4.isIPad) {
|
|
document.addEventListener("touchstart", this._doOnClick, false)
|
|
} else {
|
|
if (typeof(window.addEventListener) != "undefined") {
|
|
window.addEventListener("mousedown", this._doOnClick, false)
|
|
} else {
|
|
document.body.attachEvent("onmousedown", this._doOnClick)
|
|
}
|
|
} if (this.conf.icons_size_autoload != null) {
|
|
this.setIconSize(this.conf.icons_size_autoload);
|
|
this.conf.icons_size_autoload = null
|
|
}
|
|
if (this.conf.items_autoload != null) {
|
|
this.loadStruct(this.conf.items_autoload, this.conf.onload_autoload);
|
|
this.conf.items_autoload = null
|
|
} else {
|
|
if (this.conf.json_autoload != null) {
|
|
this.loadStruct(this.conf.json_autoload, this.conf.onload_autoload);
|
|
this.conf.json_autoload = null
|
|
} else {
|
|
if (this.conf.xml_autoload != null) {
|
|
this.loadStruct(this.conf.xml_autoload, this.conf.onload_autoload);
|
|
this.conf.xml_autoload = null
|
|
}
|
|
}
|
|
} if (this.conf.align_autostart != this.conf.align) {
|
|
this.setAlign(this.conf.align_autostart);
|
|
this.conf.align_autostart = null
|
|
}
|
|
return this
|
|
}
|
|
dhtmlXToolbarObject.prototype.addSpacer = function(g) {
|
|
var c = this.idPrefix + g;
|
|
if (this._spacer != null) {
|
|
if (this._spacer.idd == g) {
|
|
return
|
|
}
|
|
if (this._spacer == this.objPull[c].obj.parentNode) {
|
|
var a = true;
|
|
while (a) {
|
|
var n = this._spacer.childNodes[0].idd;
|
|
this.base.appendChild(this._spacer.childNodes[0]);
|
|
if (n == g || this._spacer.childNodes.length == 0) {
|
|
if (this.objPull[c].arw != null) {
|
|
this.base.appendChild(this.objPull[c].arw)
|
|
}
|
|
a = false
|
|
}
|
|
}
|
|
this._spacer.idd = g;
|
|
this._fixSpacer();
|
|
return
|
|
}
|
|
if (this.base == this.objPull[c].obj.parentNode) {
|
|
var a = true;
|
|
var m = (this.objPull[c].arw != null);
|
|
while (a) {
|
|
var h = this.base.childNodes.length - 1;
|
|
if (m == true) {
|
|
if (this.base.childNodes[h] == this.objPull[c].arw) {
|
|
a = false
|
|
}
|
|
}
|
|
if (this.base.childNodes[h].idd == g) {
|
|
a = false
|
|
}
|
|
if (a) {
|
|
if (this._spacer.childNodes.length > 0) {
|
|
this._spacer.insertBefore(this.base.childNodes[h], this._spacer.childNodes[0])
|
|
} else {
|
|
this._spacer.appendChild(this.base.childNodes[h])
|
|
}
|
|
}
|
|
}
|
|
this._spacer.idd = g;
|
|
this._fixSpacer();
|
|
return
|
|
}
|
|
} else {
|
|
var l = null;
|
|
for (var h = 0; h < this.base.childNodes.length; h++) {
|
|
if (this.base.childNodes[h] == this.objPull[this.idPrefix + g].obj) {
|
|
l = h;
|
|
if (this.objPull[this.idPrefix + g].arw != null) {
|
|
l = h + 1
|
|
}
|
|
}
|
|
}
|
|
if (l != null) {
|
|
this._spacer = document.createElement("DIV");
|
|
this._spacer.className = (this.conf.align == "right" ? " dhxtoolbar_float_left" : " dhxtoolbar_float_right");
|
|
this._spacer.dir = "ltr";
|
|
this._spacer.idd = g;
|
|
while (this.base.childNodes.length > l + 1) {
|
|
this._spacer.appendChild(this.base.childNodes[l + 1])
|
|
}
|
|
this.cont.appendChild(this._spacer);
|
|
this._fixSpacer()
|
|
}
|
|
} if (this.conf.skin == "dhx_terrace") {
|
|
this._improveTerraceSkin()
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype.removeSpacer = function() {
|
|
if (!this._spacer) {
|
|
return
|
|
}
|
|
while (this._spacer.childNodes.length > 0) {
|
|
this.base.appendChild(this._spacer.childNodes[0])
|
|
}
|
|
this._spacer.parentNode.removeChild(this._spacer);
|
|
this._spacer = null;
|
|
if (this.conf.skin == "dhx_terrace") {
|
|
this._improveTerraceSkin()
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype._fixSpacer = function() {
|
|
if (typeof(window.addEventListener) == "undefined" && this._spacer != null) {
|
|
this._spacer.style.borderLeft = "1px solid #a4bed4";
|
|
var a = this._spacer;
|
|
window.setTimeout(function() {
|
|
a.style.borderLeft = "0px solid #a4bed4";
|
|
a = null
|
|
}, 1)
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype.getType = function(g) {
|
|
var h = this.getParentId(g);
|
|
if (h != null) {
|
|
var c = null;
|
|
var a = this.objPull[this.idPrefix + h]._listOptions[g];
|
|
if (a != null) {
|
|
if (a.sep != null) {
|
|
c = "buttonSelectSeparator"
|
|
} else {
|
|
c = "buttonSelectButton"
|
|
}
|
|
}
|
|
return c
|
|
} else {
|
|
if (this.objPull[this.idPrefix + g] == null) {
|
|
return null
|
|
}
|
|
return this.objPull[this.idPrefix + g]["type"]
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype.getTypeExt = function(c) {
|
|
var a = this.getType(c);
|
|
if (a == "buttonSelectButton" || a == "buttonSelectSeparator") {
|
|
if (a == "buttonSelectButton") {
|
|
a = "button"
|
|
} else {
|
|
a = "separator"
|
|
}
|
|
return a
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXToolbarObject.prototype.inArray = function(g, c) {
|
|
for (var a = 0; a < g.length; a++) {
|
|
if (g[a] == c) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
};
|
|
dhtmlXToolbarObject.prototype.getParentId = function(h) {
|
|
var l = null;
|
|
for (var g in this.objPull) {
|
|
if (this.objPull[g]._listOptions) {
|
|
for (var c in this.objPull[g]._listOptions) {
|
|
if (c == h) {
|
|
l = String(g).replace(this.idPrefix, "")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return l
|
|
};
|
|
dhtmlXToolbarObject.prototype._addItem = function(a, c) {
|
|
this._addItemToStorage(a, c);
|
|
if (this.conf.skin == "dhx_terrace") {
|
|
this._improveTerraceSkin()
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype.addButton = function(l, h, c, a, g) {
|
|
this._addItem({
|
|
id: l,
|
|
type: "button",
|
|
text: c,
|
|
img: a,
|
|
imgdis: g
|
|
}, h)
|
|
};
|
|
dhtmlXToolbarObject.prototype.addText = function(g, c, a) {
|
|
this._addItem({
|
|
id: g,
|
|
type: "text",
|
|
text: a
|
|
}, c)
|
|
};
|
|
dhtmlXToolbarObject.prototype.addButtonSelect = function(h, o, v, a, c, r, n, x, l, m) {
|
|
var w = [];
|
|
for (var g = 0; g < a.length; g++) {
|
|
var s = {};
|
|
if (a[g] instanceof Array) {
|
|
s.id = a[g][0];
|
|
s.type = (a[g][1] == "obj" ? "button" : "separator");
|
|
s.text = (a[g][2] || null);
|
|
s.img = (a[g][3] || null)
|
|
} else {
|
|
if (a[g] instanceof Object && a[g] != null && typeof(a[g].id) != "undefined" && typeof(a[g].type) != "undefined") {
|
|
s.id = a[g].id;
|
|
s.type = (a[g].type == "obj" ? "button" : "separator");
|
|
s.text = a[g].text;
|
|
s.img = a[g].img
|
|
}
|
|
}
|
|
w.push(s)
|
|
}
|
|
this._addItem({
|
|
id: h,
|
|
type: "buttonSelect",
|
|
text: v,
|
|
img: c,
|
|
imgdis: r,
|
|
renderSelect: n,
|
|
openAll: x,
|
|
options: w,
|
|
maxOpen: l,
|
|
mode: m
|
|
}, o)
|
|
};
|
|
dhtmlXToolbarObject.prototype.addButtonTwoState = function(l, h, c, a, g) {
|
|
this._addItem({
|
|
id: l,
|
|
type: "buttonTwoState",
|
|
img: a,
|
|
imgdis: g,
|
|
text: c
|
|
}, h)
|
|
};
|
|
dhtmlXToolbarObject.prototype.addSeparator = function(c, a) {
|
|
this._addItem({
|
|
id: c,
|
|
type: "separator"
|
|
}, a)
|
|
};
|
|
dhtmlXToolbarObject.prototype.addSlider = function(c, n, l, h, q, g, m, a, o) {
|
|
this._addItem({
|
|
id: c,
|
|
type: "slider",
|
|
length: l,
|
|
valueMin: h,
|
|
valueMax: q,
|
|
valueNow: g,
|
|
textMin: m,
|
|
textMax: a,
|
|
toolTip: o
|
|
}, n)
|
|
};
|
|
dhtmlXToolbarObject.prototype.addInput = function(h, g, c, a) {
|
|
this._addItem({
|
|
id: h,
|
|
type: "buttonInput",
|
|
value: c,
|
|
width: a
|
|
}, g)
|
|
};
|
|
dhtmlXToolbarObject.prototype.forEachItem = function(g) {
|
|
for (var c in this.objPull) {
|
|
if (this.inArray(this.rootTypes, this.objPull[c]["type"])) {
|
|
g(this.objPull[c]["id"].replace(this.idPrefix, ""))
|
|
}
|
|
}
|
|
};
|
|
(function() {
|
|
var m = "isVisible,enableItem,disableItem,isEnabled,setItemText,getItemText,setItemToolTip,getItemToolTip,getInput,setItemImage,setItemImageDis,clearItemImage,clearItemImageDis,setItemState,getItemState,setItemToolTipTemplate,getItemToolTipTemplate,setValue,getValue,setMinValue,getMinValue,setMaxValue,getMaxValue,setWidth,getWidth,setMaxOpen".split(",");
|
|
var g = [false, "", "", false, "", "", "", "", "", "", "", "", "", false, "", "", "", null, "", [null, null], "", [null, null], "", null];
|
|
var c = function(n, o) {
|
|
return function(s, r, q) {
|
|
s = this.idPrefix + s;
|
|
if (this.objPull[s][n] != null) {
|
|
return this.objPull[s][n].call(this.objPull[s], r, q)
|
|
} else {
|
|
return o
|
|
}
|
|
}
|
|
};
|
|
for (var l = 0; l < m.length; l++) {
|
|
var a = m[l];
|
|
var h = g[l];
|
|
dhtmlXToolbarObject.prototype[a] = c(a, h)
|
|
}
|
|
})();
|
|
dhtmlXToolbarObject.prototype.showItem = function(a) {
|
|
a = this.idPrefix + a;
|
|
if (this.objPull[a] != null && this.objPull[a].showItem != null) {
|
|
this.objPull[a].showItem();
|
|
if (this.conf.skin == "dhx_terrace") {
|
|
this._improveTerraceSkin()
|
|
}
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype.hideItem = function(a) {
|
|
a = this.idPrefix + a;
|
|
if (this.objPull[a] != null && this.objPull[a].hideItem != null) {
|
|
this.objPull[a].hideItem();
|
|
if (this.conf.skin == "dhx_terrace") {
|
|
this._improveTerraceSkin()
|
|
}
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype.getPosition = function(a) {
|
|
return this._getPosition(a)
|
|
};
|
|
dhtmlXToolbarObject.prototype._getPosition = function(l, g) {
|
|
if (this.objPull[this.idPrefix + l] == null) {
|
|
return null
|
|
}
|
|
var h = null;
|
|
var a = 0;
|
|
for (var c = 0; c < this.base.childNodes.length; c++) {
|
|
if (this.base.childNodes[c].idd != null) {
|
|
if (this.base.childNodes[c].idd == l) {
|
|
h = a
|
|
}
|
|
a++
|
|
}
|
|
}
|
|
if (!h && this._spacer != null) {
|
|
for (var c = 0; c < this._spacer.childNodes.length; c++) {
|
|
if (this._spacer.childNodes[c].idd != null) {
|
|
if (this._spacer.childNodes[c].idd == l) {
|
|
h = a
|
|
}
|
|
a++
|
|
}
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXToolbarObject.prototype.setPosition = function(a, c) {
|
|
this._setPosition(a, c)
|
|
};
|
|
dhtmlXToolbarObject.prototype._setPosition = function(l, h) {
|
|
if (this.objPull[this.idPrefix + l] == null) {
|
|
return
|
|
}
|
|
if (isNaN(h)) {
|
|
h = this.base.childNodes.length
|
|
}
|
|
if (h < 0) {
|
|
h = 0
|
|
}
|
|
var a = null;
|
|
if (this._spacer) {
|
|
a = this._spacer.idd;
|
|
this.removeSpacer()
|
|
}
|
|
var g = this.objPull[this.idPrefix + l];
|
|
this.base.removeChild(g.obj);
|
|
if (g.arw) {
|
|
this.base.removeChild(g.arw)
|
|
}
|
|
var c = this._getIdByPosition(h, true);
|
|
if (c[0] == null) {
|
|
this.base.appendChild(g.obj);
|
|
if (g.arw) {
|
|
this.base.appendChild(g.arw)
|
|
}
|
|
} else {
|
|
this.base.insertBefore(g.obj, this.base.childNodes[c[1]]);
|
|
if (g.arw) {
|
|
this.base.insertBefore(g.arw, this.base.childNodes[c[1] + 1])
|
|
}
|
|
} if (a != null) {
|
|
this.addSpacer(a)
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype._getIdByPosition = function(m, c) {
|
|
var l = null;
|
|
var a = 0;
|
|
var g = 0;
|
|
for (var h = 0; h < this.base.childNodes.length; h++) {
|
|
if (this.base.childNodes[h]["idd"] != null && l == null) {
|
|
if ((a++) == m) {
|
|
l = this.base.childNodes[h]["idd"]
|
|
}
|
|
}
|
|
if (l == null) {
|
|
g++
|
|
}
|
|
}
|
|
g = (l == null ? null : g);
|
|
return (c == true ? new Array(l, g) : l)
|
|
};
|
|
dhtmlXToolbarObject.prototype.removeItem = function(a) {
|
|
this._removeItem(a);
|
|
if (this.conf.skin == "dhx_terrace") {
|
|
this._improveTerraceSkin()
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype._removeItem = function(l) {
|
|
var g = this.getType(l);
|
|
l = this.idPrefix + l;
|
|
var h = this.objPull[l];
|
|
if (g == "button") {
|
|
h.obj._doOnMouseOver = null;
|
|
h.obj._doOnMouseOut = null;
|
|
h.obj._doOnMouseUp = null;
|
|
h.obj._doOnMouseUpOnceAnywhere = null;
|
|
h.obj.onclick = null;
|
|
h.obj.onmouseover = null;
|
|
h.obj.onmouseout = null;
|
|
h.obj.onmouseup = null;
|
|
h.obj.onmousedown = null;
|
|
h.obj.onselectstart = null;
|
|
h.obj.renderAs = null;
|
|
h.obj.idd = null;
|
|
h.obj.parentNode.removeChild(h.obj);
|
|
h.obj = null;
|
|
h.id = null;
|
|
h.state = null;
|
|
h.img = null;
|
|
h.imgEn = null;
|
|
h.imgDis = null;
|
|
h.type = null;
|
|
h.enableItem = null;
|
|
h.disableItem = null;
|
|
h.isEnabled = null;
|
|
h.showItem = null;
|
|
h.hideItem = null;
|
|
h.isVisible = null;
|
|
h.setItemText = null;
|
|
h.getItemText = null;
|
|
h.setItemImage = null;
|
|
h.clearItemImage = null;
|
|
h.setItemImageDis = null;
|
|
h.clearItemImageDis = null;
|
|
h.setItemToolTip = null;
|
|
h.getItemToolTip = null
|
|
}
|
|
if (g == "buttonTwoState") {
|
|
h.obj._doOnMouseOver = null;
|
|
h.obj._doOnMouseOut = null;
|
|
h.obj.onmouseover = null;
|
|
h.obj.onmouseout = null;
|
|
h.obj.onmousedown = null;
|
|
h.obj.onselectstart = null;
|
|
h.obj.renderAs = null;
|
|
h.obj.idd = null;
|
|
h.obj.parentNode.removeChild(h.obj);
|
|
h.obj = null;
|
|
h.id = null;
|
|
h.state = null;
|
|
h.img = null;
|
|
h.imgEn = null;
|
|
h.imgDis = null;
|
|
h.type = null;
|
|
h.enableItem = null;
|
|
h.disableItem = null;
|
|
h.isEnabled = null;
|
|
h.showItem = null;
|
|
h.hideItem = null;
|
|
h.isVisible = null;
|
|
h.setItemText = null;
|
|
h.getItemText = null;
|
|
h.setItemImage = null;
|
|
h.clearItemImage = null;
|
|
h.setItemImageDis = null;
|
|
h.clearItemImageDis = null;
|
|
h.setItemToolTip = null;
|
|
h.getItemToolTip = null;
|
|
h.setItemState = null;
|
|
h.getItemState = null
|
|
}
|
|
if (g == "buttonSelect") {
|
|
for (var c in h._listOptions) {
|
|
this.removeListOption(l, c)
|
|
}
|
|
h._listOptions = null;
|
|
if (h.polygon._ie6cover) {
|
|
document.body.removeChild(h.polygon._ie6cover);
|
|
h.polygon._ie6cover = null
|
|
}
|
|
h.p_tbl.removeChild(h.p_tbody);
|
|
h.polygon.removeChild(h.p_tbl);
|
|
h.polygon.onselectstart = null;
|
|
document.body.removeChild(h.polygon);
|
|
h.p_tbody = null;
|
|
h.p_tbl = null;
|
|
h.polygon = null;
|
|
h.obj.onclick = null;
|
|
h.obj.onmouseover = null;
|
|
h.obj.onmouseout = null;
|
|
h.obj.onmouseup = null;
|
|
h.obj.onmousedown = null;
|
|
h.obj.onselectstart = null;
|
|
h.obj.idd = null;
|
|
h.obj.iddPrefix = null;
|
|
h.obj.parentNode.removeChild(h.obj);
|
|
h.obj = null;
|
|
h.arw.onclick = null;
|
|
h.arw.onmouseover = null;
|
|
h.arw.onmouseout = null;
|
|
h.arw.onmouseup = null;
|
|
h.arw.onmousedown = null;
|
|
h.arw.onselectstart = null;
|
|
h.arw.parentNode.removeChild(h.arw);
|
|
h.arw = null;
|
|
h.renderSelect = null;
|
|
h.state = null;
|
|
h.type = null;
|
|
h.id = null;
|
|
h.img = null;
|
|
h.imgEn = null;
|
|
h.imgDis = null;
|
|
h.openAll = null;
|
|
h._isListButton = null;
|
|
h._separatorButtonSelectObject = null;
|
|
h._buttonButtonSelectObject = null;
|
|
h.setWidth = null;
|
|
h.enableItem = null;
|
|
h.disableItem = null;
|
|
h.isEnabled = null;
|
|
h.showItem = null;
|
|
h.hideItem = null;
|
|
h.isVisible = null;
|
|
h.setItemText = null;
|
|
h.getItemText = null;
|
|
h.setItemImage = null;
|
|
h.clearItemImage = null;
|
|
h.setItemImageDis = null;
|
|
h.clearItemImageDis = null;
|
|
h.setItemToolTip = null;
|
|
h.getItemToolTip = null;
|
|
h.addListOption = null;
|
|
h.removeListOption = null;
|
|
h.showListOption = null;
|
|
h.hideListOption = null;
|
|
h.isListOptionVisible = null;
|
|
h.enableListOption = null;
|
|
h.disableListOption = null;
|
|
h.isListOptionEnabled = null;
|
|
h.setListOptionPosition = null;
|
|
h.getListOptionPosition = null;
|
|
h.setListOptionImage = null;
|
|
h.getListOptionImage = null;
|
|
h.clearListOptionImage = null;
|
|
h.setListOptionText = null;
|
|
h.getListOptionText = null;
|
|
h.setListOptionToolTip = null;
|
|
h.getListOptionToolTip = null;
|
|
h.forEachListOption = null;
|
|
h.getAllListOptions = null;
|
|
h.setListOptionSelected = null;
|
|
h.getListOptionSelected = null
|
|
}
|
|
if (g == "buttonInput") {
|
|
h.obj.childNodes[0].onkeydown = null;
|
|
h.obj.removeChild(h.obj.childNodes[0]);
|
|
h.obj.w = null;
|
|
h.obj.idd = null;
|
|
h.obj.parentNode.removeChild(h.obj);
|
|
h.obj = null;
|
|
h.id = null;
|
|
h.type = null;
|
|
h.enableItem = null;
|
|
h.disableItem = null;
|
|
h.isEnabled = null;
|
|
h.showItem = null;
|
|
h.hideItem = null;
|
|
h.isVisible = null;
|
|
h.setItemToolTip = null;
|
|
h.getItemToolTip = null;
|
|
h.setWidth = null;
|
|
h.getWidth = null;
|
|
h.setValue = null;
|
|
h.getValue = null;
|
|
h.setItemText = null;
|
|
h.getItemText = null
|
|
}
|
|
if (g == "slider") {
|
|
if (window.dhx4.isIPad) {
|
|
document.removeEventListener("touchmove", pen._doOnMouseMoveStart, false);
|
|
document.removeEventListener("touchend", pen._doOnMouseMoveEnd, false)
|
|
} else {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("mousemove", h.pen._doOnMouseMoveStart, false);
|
|
window.removeEventListener("mouseup", h.pen._doOnMouseMoveEnd, false)
|
|
} else {
|
|
document.body.detachEvent("onmousemove", h.pen._doOnMouseMoveStart);
|
|
document.body.detachEvent("onmouseup", h.pen._doOnMouseMoveEnd)
|
|
}
|
|
}
|
|
h.pen.allowMove = null;
|
|
h.pen.initXY = null;
|
|
h.pen.maxX = null;
|
|
h.pen.minX = null;
|
|
h.pen.nowX = null;
|
|
h.pen.newNowX = null;
|
|
h.pen.valueMax = null;
|
|
h.pen.valueMin = null;
|
|
h.pen.valueNow = null;
|
|
h.pen._definePos = null;
|
|
h.pen._detectLimits = null;
|
|
h.pen._doOnMouseMoveStart = null;
|
|
h.pen._doOnMouseMoveEnd = null;
|
|
h.pen.onmousedown = null;
|
|
h.obj.removeChild(h.pen);
|
|
h.pen = null;
|
|
h.label.tip = null;
|
|
document.body.removeChild(h.label);
|
|
h.label = null;
|
|
h.obj.onselectstart = null;
|
|
h.obj.idd = null;
|
|
while (h.obj.childNodes.length > 0) {
|
|
h.obj.removeChild(h.obj.childNodes[0])
|
|
}
|
|
h.obj.parentNode.removeChild(h.obj);
|
|
h.obj = null;
|
|
h.id = null;
|
|
h.type = null;
|
|
h.state = null;
|
|
h.enableItem = null;
|
|
h.disableItem = null;
|
|
h.isEnabled = null;
|
|
h.setItemToolTipTemplate = null;
|
|
h.getItemToolTipTemplate = null;
|
|
h.setMaxValue = null;
|
|
h.setMinValue = null;
|
|
h.getMaxValue = null;
|
|
h.getMinValue = null;
|
|
h.setValue = null;
|
|
h.getValue = null;
|
|
h.showItem = null;
|
|
h.hideItem = null;
|
|
h.isVisible = null
|
|
}
|
|
if (g == "separator") {
|
|
h.obj.onselectstart = null;
|
|
h.obj.idd = null;
|
|
h.obj.parentNode.removeChild(h.obj);
|
|
h.obj = null;
|
|
h.id = null;
|
|
h.type = null;
|
|
h.showItem = null;
|
|
h.hideItem = null;
|
|
h.isVisible = null
|
|
}
|
|
if (g == "text") {
|
|
h.obj.onselectstart = null;
|
|
h.obj.idd = null;
|
|
h.obj.parentNode.removeChild(h.obj);
|
|
h.obj = null;
|
|
h.id = null;
|
|
h.type = null;
|
|
h.showItem = null;
|
|
h.hideItem = null;
|
|
h.isVisible = null;
|
|
h.setWidth = null;
|
|
h.setItemText = null;
|
|
h.getItemText = null
|
|
}
|
|
g = null;
|
|
h = null;
|
|
this.objPull[this.idPrefix + l] = null;
|
|
delete this.objPull[this.idPrefix + l]
|
|
};
|
|
(function() {
|
|
var h = "addListOption,removeListOption,showListOption,hideListOption,isListOptionVisible,enableListOption,disableListOption,isListOptionEnabled,setListOptionPosition,getListOptionPosition,setListOptionText,getListOptionText,setListOptionToolTip,getListOptionToolTip,setListOptionImage,getListOptionImage,clearListOptionImage,forEachListOption,getAllListOptions,setListOptionSelected,getListOptionSelected".split(",");
|
|
var c = function(l) {
|
|
return function(s, n, m, r, q, o) {
|
|
s = this.idPrefix + s;
|
|
if (this.objPull[s] == null) {
|
|
return
|
|
}
|
|
if (this.objPull[s]["type"] != "buttonSelect") {
|
|
return
|
|
}
|
|
return this.objPull[s][l].call(this.objPull[s], n, m, r, q, o)
|
|
}
|
|
};
|
|
for (var g = 0; g < h.length; g++) {
|
|
var a = h[g];
|
|
dhtmlXToolbarObject.prototype[a] = c(a)
|
|
}
|
|
})();
|
|
dhtmlXToolbarObject.prototype._rtlParseBtn = function(c, a) {
|
|
return c + a
|
|
};
|
|
dhtmlXToolbarObject.prototype._separatorObject = function(a, g, c) {
|
|
this.id = a.idPrefix + g;
|
|
this.obj = document.createElement("DIV");
|
|
this.obj.className = "dhx_toolbar_sep";
|
|
this.obj.style.display = (c.hidden != null ? "none" : "");
|
|
this.obj.idd = String(g);
|
|
this.obj.title = (c.title || "");
|
|
this.obj.onselectstart = function(h) {
|
|
h = h || event;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.returnValue = false
|
|
}
|
|
};
|
|
if (window.dhx4.isIPad) {
|
|
this.obj.ontouchstart = function(h) {
|
|
h = h || event;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.returnValue = false
|
|
}
|
|
h.cancelBubble = true;
|
|
return false
|
|
}
|
|
}
|
|
a.base.appendChild(this.obj);
|
|
this.showItem = function() {
|
|
this.obj.style.display = ""
|
|
};
|
|
this.hideItem = function() {
|
|
this.obj.style.display = "none"
|
|
};
|
|
this.isVisible = function() {
|
|
return (this.obj.style.display == "")
|
|
};
|
|
return this
|
|
};
|
|
dhtmlXToolbarObject.prototype._textObject = function(a, g, c) {
|
|
this.id = a.idPrefix + g;
|
|
this.obj = document.createElement("DIV");
|
|
this.obj.className = "dhx_toolbar_text";
|
|
this.obj.style.display = (c.hidden != null ? "none" : "");
|
|
this.obj.idd = String(g);
|
|
this.obj.title = (c.title || "");
|
|
this.obj.onselectstart = function(h) {
|
|
h = h || event;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.returnValue = false
|
|
}
|
|
};
|
|
if (window.dhx4.isIPad) {
|
|
this.obj.ontouchstart = function(h) {
|
|
h = h || event;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.returnValue = false
|
|
}
|
|
h.cancelBubble = true;
|
|
return false
|
|
}
|
|
}
|
|
this.obj.innerHTML = (c.text || "");
|
|
a.base.appendChild(this.obj);
|
|
this.showItem = function() {
|
|
this.obj.style.display = ""
|
|
};
|
|
this.hideItem = function() {
|
|
this.obj.style.display = "none"
|
|
};
|
|
this.isVisible = function() {
|
|
return (this.obj.style.display == "")
|
|
};
|
|
this.setItemText = function(h) {
|
|
this.obj.innerHTML = h
|
|
};
|
|
this.getItemText = function() {
|
|
return this.obj.innerHTML
|
|
};
|
|
this.setWidth = function(h) {
|
|
this.obj.style.width = h + "px"
|
|
};
|
|
this.setItemToolTip = function(h) {
|
|
this.obj.title = h
|
|
};
|
|
this.getItemToolTip = function() {
|
|
return this.obj.title
|
|
};
|
|
return this
|
|
};
|
|
dhtmlXToolbarObject.prototype._buttonObject = function(a, h, c) {
|
|
this.id = a.idPrefix + h;
|
|
this.state = (c.enabled != null ? false : true);
|
|
this.imgEn = (c.img || "");
|
|
this.imgDis = (c.imgdis || "");
|
|
this.img = (this.state ? (this.imgEn != "" ? this.imgEn : "") : (this.imgDis != "" ? this.imgDis : ""));
|
|
this.obj = document.createElement("DIV");
|
|
this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis");
|
|
this.obj.style.display = (c.hidden != null ? "none" : "");
|
|
this.obj.allowClick = false;
|
|
this.obj.extAction = (c.action || null);
|
|
this.obj.renderAs = this.obj.className;
|
|
this.obj.idd = String(h);
|
|
this.obj.title = (c.title || "");
|
|
this.obj.pressed = false;
|
|
this.obj.innerHTML = a._rtlParseBtn((this.img != "" ? "<img src='" + a.conf.icons_path + this.img + "'>" : ""), (c.text != null ? "<div class='dhxtoolbar_text'>" + c.text + "</div>" : ""));
|
|
var g = this;
|
|
this.obj.onselectstart = function(l) {
|
|
l = l || event;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
};
|
|
this.obj.onmouseover = function() {
|
|
this._doOnMouseOver()
|
|
};
|
|
this.obj.onmouseout = function() {
|
|
this._doOnMouseOut()
|
|
};
|
|
this.obj._doOnMouseOver = function() {
|
|
this.allowClick = true;
|
|
if (g.state == false) {
|
|
return
|
|
}
|
|
if (a.anyUsed != "none") {
|
|
return
|
|
}
|
|
this.className = "dhx_toolbar_btn dhxtoolbar_btn_over";
|
|
this.renderAs = this.className
|
|
};
|
|
this.obj._doOnMouseOut = function() {
|
|
this.allowClick = false;
|
|
if (g.state == false) {
|
|
return
|
|
}
|
|
if (a.anyUsed != "none") {
|
|
return
|
|
}
|
|
this.className = "dhx_toolbar_btn dhxtoolbar_btn_def";
|
|
this.renderAs = this.renderAs
|
|
};
|
|
this.obj.onclick = function(l) {
|
|
if (g.state == false) {
|
|
return
|
|
}
|
|
if (this.allowClick == false) {
|
|
return
|
|
}
|
|
l = l || event;
|
|
var m = this.idd.replace(a.idPrefix, "");
|
|
if (this.extAction) {
|
|
try {
|
|
window[this.extAction](m)
|
|
} catch (l) {}
|
|
}
|
|
if (a && a.callEvent) {
|
|
a.callEvent("onClick", [m])
|
|
}
|
|
};
|
|
this.obj[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(l) {
|
|
if (g.state == false) {
|
|
l = l || event;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
l.cancelBubble = true;
|
|
return false
|
|
}
|
|
if (a.anyUsed != "none") {
|
|
return
|
|
}
|
|
a.anyUsed = this.idd;
|
|
this.className = "dhx_toolbar_btn dhxtoolbar_btn_pres";
|
|
this.pressed = true;
|
|
this.onmouseover = function() {
|
|
this._doOnMouseOver()
|
|
};
|
|
this.onmouseout = function() {
|
|
a.anyUsed = "none";
|
|
this._doOnMouseOut()
|
|
};
|
|
return false
|
|
};
|
|
this.obj[window.dhx4.isIPad ? "ontouchend" : "onmouseup"] = function(m) {
|
|
if (g.state == false) {
|
|
return
|
|
}
|
|
if (a.anyUsed != "none") {
|
|
if (a.anyUsed != this.idd) {
|
|
return
|
|
}
|
|
}
|
|
var l = a.anyUsed;
|
|
this._doOnMouseUp();
|
|
if (window.dhx4.isIPad && l != "none") {
|
|
a.callEvent("onClick", [this.idd.replace(a.idPrefix, "")])
|
|
}
|
|
};
|
|
if (window.dhx4.isIPad) {
|
|
this.obj.ontouchmove = function(l) {
|
|
this._doOnMouseUp()
|
|
}
|
|
}
|
|
this.obj._doOnMouseUp = function() {
|
|
a.anyUsed = "none";
|
|
this.className = this.renderAs;
|
|
this.pressed = false
|
|
};
|
|
this.obj._doOnMouseUpOnceAnywhere = function() {
|
|
this._doOnMouseUp();
|
|
this.onmouseover = function() {
|
|
this._doOnMouseOver()
|
|
};
|
|
this.onmouseout = function() {
|
|
this._doOnMouseOut()
|
|
}
|
|
};
|
|
a.base.appendChild(this.obj);
|
|
this.enableItem = function() {
|
|
a._enableItem(this)
|
|
};
|
|
this.disableItem = function() {
|
|
a._disableItem(this)
|
|
};
|
|
this.isEnabled = function() {
|
|
return this.state
|
|
};
|
|
this.showItem = function() {
|
|
this.obj.style.display = ""
|
|
};
|
|
this.hideItem = function() {
|
|
this.obj.style.display = "none"
|
|
};
|
|
this.isVisible = function() {
|
|
return (this.obj.style.display == "")
|
|
};
|
|
this.setItemText = function(l) {
|
|
a._setItemText(this, l)
|
|
};
|
|
this.getItemText = function() {
|
|
return a._getItemText(this)
|
|
};
|
|
this.setItemImage = function(l) {
|
|
a._setItemImage(this, l, true)
|
|
};
|
|
this.clearItemImage = function() {
|
|
a._clearItemImage(this, true)
|
|
};
|
|
this.setItemImageDis = function(l) {
|
|
a._setItemImage(this, l, false)
|
|
};
|
|
this.clearItemImageDis = function() {
|
|
a._clearItemImage(this, false)
|
|
};
|
|
this.setItemToolTip = function(l) {
|
|
this.obj.title = l
|
|
};
|
|
this.getItemToolTip = function() {
|
|
return this.obj.title
|
|
};
|
|
return this
|
|
};
|
|
dhtmlXToolbarObject.prototype._buttonSelectObject = function(g, m, l) {
|
|
this.id = g.idPrefix + m;
|
|
this.state = (l.enabled != null ? (l.enabled == "true" ? true : false) : true);
|
|
this.imgEn = (l.img || "");
|
|
this.imgDis = (l.imgdis || "");
|
|
this.img = (this.state ? (this.imgEn != "" ? this.imgEn : "") : (this.imgDis != "" ? this.imgDis : ""));
|
|
this.mode = (l.mode || "button");
|
|
if (this.mode == "select") {
|
|
this.openAll = true;
|
|
this.renderSelect = false;
|
|
if (!l.text || l.text.length == 0) {
|
|
l.text = " "
|
|
}
|
|
} else {
|
|
this.openAll = (window.dhx4.s2b(l.openAll) == true);
|
|
this.renderSelect = (l.renderSelect == null ? true : window.dhx4.s2b(l.renderSelect))
|
|
}
|
|
this.maxOpen = (!isNaN(l.maxOpen ? l.maxOpen : "") ? l.maxOpen : null);
|
|
this._maxOpenTest = function() {
|
|
if (!isNaN(this.maxOpen)) {
|
|
if (!g._sbw) {
|
|
var o = document.createElement("DIV");
|
|
o.className = "dhxtoolbar_maxopen_test";
|
|
document.body.appendChild(o);
|
|
var n = document.createElement("DIV");
|
|
n.className = "dhxtoolbar_maxopen_test2";
|
|
o.appendChild(n);
|
|
g._sbw = o.offsetWidth - n.offsetWidth;
|
|
o.removeChild(n);
|
|
n = null;
|
|
document.body.removeChild(o);
|
|
o = null
|
|
}
|
|
}
|
|
};
|
|
this._maxOpenTest();
|
|
this.obj = document.createElement("DIV");
|
|
this.obj.allowClick = false;
|
|
this.obj.extAction = (l.action || null);
|
|
this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis");
|
|
this.obj.style.display = (l.hidden != null ? "none" : "");
|
|
this.obj.renderAs = this.obj.className;
|
|
this.obj.onselectstart = function(n) {
|
|
n = n || event;
|
|
if (n.preventDefault) {
|
|
n.preventDefault()
|
|
} else {
|
|
n.returnValue = false
|
|
}
|
|
};
|
|
this.obj.idd = String(m);
|
|
this.obj.title = (l.title || "");
|
|
this.obj.pressed = false;
|
|
this.callEvent = false;
|
|
this.obj.innerHTML = g._rtlParseBtn((this.img != "" ? "<img src='" + g.conf.icons_path + this.img + "'>" : ""), (l.text != null ? "<div class='dhxtoolbar_text'>" + l.text + "</div>" : ""));
|
|
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 = "<div class='arwimg'> </div>";
|
|
this.arw.title = this.obj.title;
|
|
this.arw.onselectstart = function(n) {
|
|
n = n || event;
|
|
if (n.preventDefault) {
|
|
n.preventDefault()
|
|
} else {
|
|
n.returnValue = false
|
|
}
|
|
};
|
|
g.base.appendChild(this.arw);
|
|
var a = this;
|
|
this.obj.onmouseover = function(n) {
|
|
n = n || event;
|
|
if (g.anyUsed != "none") {
|
|
return
|
|
}
|
|
if (!a.state) {
|
|
return
|
|
}
|
|
a.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over";
|
|
a.obj.className = a.obj.renderAs;
|
|
a.arw.className = String(a.obj.renderAs).replace("btn", "arw")
|
|
};
|
|
this.obj.onmouseout = function() {
|
|
a.obj.allowClick = false;
|
|
if (g.anyUsed != "none") {
|
|
return
|
|
}
|
|
if (!a.state) {
|
|
return
|
|
}
|
|
a.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def";
|
|
a.obj.className = a.obj.renderAs;
|
|
a.arw.className = String(a.obj.renderAs).replace("btn", "arw");
|
|
a.callEvent = false
|
|
};
|
|
this.arw.onmouseover = this.obj.onmouseover;
|
|
this.arw.onmouseout = this.obj.onmouseout;
|
|
if (this.openAll == true) {} else {
|
|
this.obj.onclick = function(n) {
|
|
n = n || event;
|
|
if (!a.obj.allowClick) {
|
|
return
|
|
}
|
|
if (!a.state) {
|
|
return
|
|
}
|
|
if (g.anyUsed != "none") {
|
|
return
|
|
}
|
|
var o = a.obj.idd.replace(g.idPrefix, "");
|
|
if (a.obj.extAction) {
|
|
try {
|
|
window[a.obj.extAction](o)
|
|
} catch (n) {}
|
|
}
|
|
g.callEvent("onClick", [o])
|
|
};
|
|
this.obj[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(n) {
|
|
n = n || event;
|
|
if (g.anyUsed != "none") {
|
|
return
|
|
}
|
|
if (!a.state) {
|
|
return
|
|
}
|
|
a.obj.allowClick = true;
|
|
a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres";
|
|
a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_pres";
|
|
a.callEvent = true
|
|
};
|
|
this.obj[window.dhx4.isIPad ? "ontouchend" : "onmouseup"] = function(n) {
|
|
n = n || event;
|
|
n.cancelBubble = true;
|
|
if (g.anyUsed != "none") {
|
|
return
|
|
}
|
|
if (!a.state) {
|
|
return
|
|
}
|
|
a.obj.className = a.obj.renderAs;
|
|
a.arw.className = String(a.obj.renderAs).replace("btn", "arw");
|
|
if (window.dhx4.isIPad && a.callEvent) {
|
|
var o = a.obj.idd.replace(g.idPrefix, "");
|
|
g.callEvent("onClick", [o])
|
|
}
|
|
}
|
|
} if (window.dhx4.isIPad) {
|
|
this.obj.ontouchmove = this.obj.onmouseout
|
|
}
|
|
this.arw[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(q) {
|
|
q = q || event;
|
|
var x = (this.className.indexOf("dhx_toolbar_arw") === 0 ? this : this.nextSibling);
|
|
if (x._skip) {
|
|
q = q || event;
|
|
q.cancelBubble = true
|
|
} else {
|
|
x._skip = true
|
|
}
|
|
x = null;
|
|
if (!a.state) {
|
|
return
|
|
}
|
|
if (g.anyUsed == a.obj.idd) {
|
|
a.obj.className = a.obj.renderAs;
|
|
a.arw.className = String(a.obj.renderAs).replace("btn", "arw");
|
|
g.anyUsed = "none";
|
|
window.dhx4.zim.clear(a.polygon._idd);
|
|
a.polygon.style.display = "none";
|
|
if (a.polygon._ie6cover) {
|
|
a.polygon._ie6cover.style.display = "none"
|
|
}
|
|
if (g.conf.skin == "dhx_terrace") {
|
|
g._improveTerraceButtonSelect(a.id, true)
|
|
}
|
|
} else {
|
|
if (g.anyUsed != "none") {
|
|
if (g.objPull[g.idPrefix + g.anyUsed]["type"] == "buttonSelect") {
|
|
var w = g.objPull[g.idPrefix + g.anyUsed];
|
|
if (w.polygon.style.display != "none") {
|
|
w.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def";
|
|
w.obj.className = w.obj.renderAs;
|
|
w.arw.className = String(a.obj.renderAs).replace("btn", "arw");
|
|
window.dhx4.zim.clear(w.polygon._idd);
|
|
w.polygon.style.display = "none";
|
|
if (w.polygon._ie6cover) {
|
|
w.polygon._ie6cover.style.display = "none"
|
|
}
|
|
if (g.conf.skin == "dhx_terrace") {
|
|
g._improveTerraceButtonSelect(w.id, true)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
a.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_over";
|
|
a.arw.className = "dhx_toolbar_arw dhxtoolbar_btn_pres";
|
|
g.anyUsed = a.obj.idd;
|
|
a.polygon.style.top = "0px";
|
|
a.polygon.style.visibility = "hidden";
|
|
a.polygon.style.zIndex = window.dhx4.zim.reserve(a.polygon._idd);
|
|
a.polygon.style.display = "";
|
|
if (g.conf.skin == "dhx_terrace") {
|
|
g._improveTerraceButtonSelect(a.id, false)
|
|
}
|
|
a._fixMaxOpenHeight(a.maxOpen || null);
|
|
g._autoDetectVisibleArea();
|
|
var r = window.dhx4.absTop(a.obj) + a.obj.offsetHeight + g.conf.sel_ofs_y;
|
|
var u = a.polygon.offsetHeight;
|
|
if (r + u > g.tY2) {
|
|
var s = (a.maxOpen != null ? Math.floor((g.tY2 - r) / 22) : 0);
|
|
if (s >= 1) {
|
|
a._fixMaxOpenHeight(s)
|
|
} else {
|
|
r = window.dhx4.absTop(a.obj) - u - g.conf.sel_ofs_y;
|
|
if (r < 0) {
|
|
r = 0
|
|
}
|
|
}
|
|
}
|
|
a.polygon.style.top = r + "px";
|
|
if (g.rtl) {
|
|
a.polygon.style.left = window.dhx4.absLeft(a.obj) + a.obj.offsetWidth - a.polygon.offsetWidth + g.conf.sel_ofs_x + "px"
|
|
} else {
|
|
var o = document.body.scrollLeft;
|
|
var n = o + (window.innerWidth || document.body.clientWidth);
|
|
var v = window.dhx4.absLeft(a.obj) + g.conf.sel_ofs_x;
|
|
if (v + a.polygon.offsetWidth > n) {
|
|
v = window.dhx4.absLeft(a.arw) + a.arw.offsetWidth - a.polygon.offsetWidth
|
|
}
|
|
a.polygon.style.left = Math.max(v, 5) + "px"
|
|
}
|
|
a.polygon.style.visibility = "visible";
|
|
if (a.polygon._ie6cover) {
|
|
a.polygon._ie6cover.style.left = a.polygon.style.left;
|
|
a.polygon._ie6cover.style.top = a.polygon.style.top;
|
|
a.polygon._ie6cover.style.width = a.polygon.offsetWidth + "px";
|
|
a.polygon._ie6cover.style.height = a.polygon.offsetHeight + "px";
|
|
a.polygon._ie6cover.style.display = ""
|
|
}
|
|
}
|
|
return false
|
|
};
|
|
this.arw.onclick = function(n) {
|
|
n = n || event;
|
|
n.cancelBubble = true
|
|
};
|
|
this.arw[window.dhx4.isIPad ? "ontouchend" : "onmouseup"] = function(n) {
|
|
n = n || event;
|
|
n.cancelBubble = true
|
|
};
|
|
if (this.openAll === true) {
|
|
this.obj.onclick = this.arw.onclick;
|
|
this.obj.onmousedown = this.arw.onmousedown;
|
|
this.obj.onmouseup = this.arw.onmouseup;
|
|
if (window.dhx4.isIPad) {
|
|
this.obj.ontouchstart = this.arw.ontouchstart;
|
|
this.obj.ontouchend = this.arw.ontouchend
|
|
}
|
|
}
|
|
this.obj.iddPrefix = g.idPrefix;
|
|
this._listOptions = {};
|
|
this._fixMaxOpenHeight = function(s) {
|
|
var r = "auto";
|
|
var q = false;
|
|
if (s !== null) {
|
|
var o = 0;
|
|
for (var n in this._listOptions) {
|
|
o++
|
|
}
|
|
if (o > s) {
|
|
this._ph = 22 * s;
|
|
r = this._ph + "px"
|
|
} else {
|
|
q = true
|
|
}
|
|
}
|
|
this.polygon.style.width = "auto";
|
|
this.polygon.style.height = "auto";
|
|
if (!q && a.maxOpen != null) {
|
|
this.polygon.style.width = this.p_tbl.offsetWidth + g._sbw + "px";
|
|
this.polygon.style.height = r
|
|
}
|
|
};
|
|
this._separatorButtonSelectObject = function(q, n, o) {
|
|
this.obj = {};
|
|
this.obj.tr = document.createElement("TR");
|
|
this.obj.tr.className = "tr_sep";
|
|
this.obj.tr.onselectstart = function(r) {
|
|
r = r || event;
|
|
if (r.preventDefault) {
|
|
r.preventDefault()
|
|
} else {
|
|
r.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
this.obj.td = document.createElement("TD");
|
|
this.obj.td.colSpan = "2";
|
|
this.obj.td.className = "td_btn_sep";
|
|
this.obj.td.onselectstart = function(r) {
|
|
r = r || event;
|
|
if (r.preventDefault) {
|
|
r.preventDefault()
|
|
} else {
|
|
r.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
if (isNaN(o)) {
|
|
o = a.p_tbody.childNodes.length + 1
|
|
} else {
|
|
if (o < 1) {
|
|
o = 1
|
|
}
|
|
} if (o > a.p_tbody.childNodes.length) {
|
|
a.p_tbody.appendChild(this.obj.tr)
|
|
} else {
|
|
a.p_tbody.insertBefore(this.obj.tr, a.p_tbody.childNodes[o - 1])
|
|
}
|
|
this.obj.tr.appendChild(this.obj.td);
|
|
this.obj.sep = document.createElement("DIV");
|
|
this.obj.sep.className = "btn_sep";
|
|
this.obj.sep.onselectstart = function(r) {
|
|
r = r || event;
|
|
if (r.preventDefault) {
|
|
r.preventDefault()
|
|
} else {
|
|
r.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
this.obj.td.appendChild(this.obj.sep);
|
|
a._listOptions[q] = this.obj;
|
|
return this
|
|
};
|
|
this._buttonButtonSelectObject = function(s, q, r) {
|
|
var o = true;
|
|
if (typeof(q.enabled) != "undefined") {
|
|
o = window.dhx4.s2b(q.enabled)
|
|
} else {
|
|
if (typeof(q.disabled) != "undefined") {
|
|
o = window.dhx4.s2b(q.disabled)
|
|
}
|
|
}
|
|
this.obj = {};
|
|
this.obj.tr = document.createElement("TR");
|
|
this.obj.tr.en = o;
|
|
this.obj.tr.extAction = (q.action || null);
|
|
this.obj.tr._selected = (q.selected != null);
|
|
this.obj.tr.className = "tr_btn" + (this.obj.tr.en ? (this.obj.tr._selected && a.renderSelect ? " tr_btn_selected" : "") : " tr_btn_disabled");
|
|
this.obj.tr.onselectstart = function(u) {
|
|
u = u || event;
|
|
if (u.preventDefault) {
|
|
u.preventDefault()
|
|
} else {
|
|
u.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
this.obj.tr.idd = String(s);
|
|
if (isNaN(r)) {
|
|
r = a.p_tbody.childNodes.length + 1
|
|
} else {
|
|
if (r < 1) {
|
|
r = 1
|
|
}
|
|
} if (r > a.p_tbody.childNodes.length) {
|
|
a.p_tbody.appendChild(this.obj.tr)
|
|
} else {
|
|
a.p_tbody.insertBefore(this.obj.tr, a.p_tbody.childNodes[r - 1])
|
|
}
|
|
this.obj.td_a = document.createElement("TD");
|
|
this.obj.td_a.className = "td_btn_img";
|
|
this.obj.td_a.onselectstart = function(u) {
|
|
u = u || event;
|
|
if (u.preventDefault) {
|
|
u.preventDefault()
|
|
} else {
|
|
u.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
this.obj.td_b = document.createElement("TD");
|
|
this.obj.td_b.className = "td_btn_txt";
|
|
this.obj.td_b.onselectstart = function(u) {
|
|
u = u || event;
|
|
if (u.preventDefault) {
|
|
u.preventDefault()
|
|
} else {
|
|
u.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
if (g.rtl) {
|
|
this.obj.tr.appendChild(this.obj.td_b);
|
|
this.obj.tr.appendChild(this.obj.td_a)
|
|
} else {
|
|
this.obj.tr.appendChild(this.obj.td_a);
|
|
this.obj.tr.appendChild(this.obj.td_b)
|
|
} if (q.img != null) {
|
|
this.obj.td_a.innerHTML = "<img class='btn_sel_img' src='" + g.conf.icons_path + q.img + "' border='0'>";
|
|
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 = "<div class='btn_sel_text'>" + n + "</div>";
|
|
this.obj.tr[window.dhx4.isIPad ? "ontouchstart" : "onmouseover"] = function() {
|
|
if (!this.en || (this._selected && a.renderSelect)) {
|
|
return
|
|
}
|
|
this.className = "tr_btn tr_btn_over"
|
|
};
|
|
this.obj.tr.onmouseout = function() {
|
|
if (!this.en) {
|
|
return
|
|
}
|
|
if (this._selected && a.renderSelect) {
|
|
if (String(this.className).search("tr_btn_selected") == -1) {
|
|
this.className = "tr_btn tr_btn_selected"
|
|
}
|
|
} else {
|
|
this.className = "tr_btn"
|
|
}
|
|
};
|
|
this.obj.tr[window.dhx4.isIPad ? "ontouchend" : "onclick"] = function(u) {
|
|
u = u || event;
|
|
u.cancelBubble = true;
|
|
if (!this.en) {
|
|
return
|
|
}
|
|
a.setListOptionSelected(this.idd.replace(g.idPrefix, ""));
|
|
a.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def";
|
|
a.obj.className = a.obj.renderAs;
|
|
a.arw.className = String(a.obj.renderAs).replace("btn", "arw");
|
|
window.dhx4.zim.clear(a.polygon._idd);
|
|
a.polygon.style.display = "none";
|
|
if (a.polygon._ie6cover) {
|
|
a.polygon._ie6cover.style.display = "none"
|
|
}
|
|
if (g.conf.skin == "dhx_terrace") {
|
|
g._improveTerraceButtonSelect(a.id, true)
|
|
}
|
|
g.anyUsed = "none";
|
|
var v = this.idd.replace(g.idPrefix, "");
|
|
if (this.extAction) {
|
|
try {
|
|
window[this.extAction](v)
|
|
} catch (u) {}
|
|
}
|
|
g.callEvent("onClick", [v])
|
|
};
|
|
a._listOptions[s] = this.obj;
|
|
return this
|
|
};
|
|
this.polygon = document.createElement("DIV");
|
|
this.polygon.dir = "ltr";
|
|
this.polygon.style.display = "none";
|
|
this.polygon.className = "dhx_toolbar_poly_" + g.conf.skin + " dhxtoolbar_icons_" + g.conf.iconSize;
|
|
this.polygon.onselectstart = function(n) {
|
|
n = n || event;
|
|
if (n.preventDefault) {
|
|
n.preventDefault()
|
|
} else {
|
|
n.returnValue = false
|
|
}
|
|
};
|
|
this.polygon.onmousedown = function(n) {
|
|
n = n || event;
|
|
n.cancelBubble = true
|
|
};
|
|
this.polygon.style.overflowY = "auto";
|
|
this.polygon._idd = window.dhx4.newId();
|
|
if (window.dhx4.isIPad) {
|
|
this.polygon.ontouchstart = function(n) {
|
|
n = n || event;
|
|
if (n.preventDefault) {
|
|
n.preventDefault()
|
|
} else {
|
|
n.returnValue = false
|
|
}
|
|
n.cancelBubble = true;
|
|
return false
|
|
}
|
|
}
|
|
this.p_tbl = document.createElement("TABLE");
|
|
this.p_tbl.className = "buttons_cont";
|
|
this.p_tbl.cellSpacing = "0";
|
|
this.p_tbl.cellPadding = "0";
|
|
this.p_tbl.border = "0";
|
|
this.polygon.appendChild(this.p_tbl);
|
|
this.p_tbody = document.createElement("TBODY");
|
|
this.p_tbl.appendChild(this.p_tbody);
|
|
if (l.options != null) {
|
|
for (var h = 0; h < l.options.length; h++) {
|
|
var c = "_" + (l.options[h].type || "") + "ButtonSelectObject";
|
|
if (l.options[h].id == null) {
|
|
l.options[h].id = g._genStr(24)
|
|
}
|
|
if (typeof(this[c]) == "function") {
|
|
new this[c](l.options[h].id, l.options[h])
|
|
}
|
|
}
|
|
}
|
|
document.body.appendChild(this.polygon);
|
|
if (window.dhx4.isIE6) {
|
|
this.polygon._ie6cover = document.createElement("IFRAME");
|
|
this.polygon._ie6cover.frameBorder = 0;
|
|
this.polygon._ie6cover.style.position = "absolute";
|
|
this.polygon._ie6cover.style.border = "none";
|
|
this.polygon._ie6cover.style.backgroundColor = "#000000";
|
|
this.polygon._ie6cover.style.filter = "alpha(opacity=100)";
|
|
this.polygon._ie6cover.style.display = "none";
|
|
this.polygon._ie6cover.setAttribute("src", "javascript:false;");
|
|
document.body.appendChild(this.polygon._ie6cover)
|
|
}
|
|
this.setWidth = function(n) {
|
|
this.obj.style.width = n - this.arw.offsetWidth + "px";
|
|
this.polygon.style.width = this.obj.offsetWidth + this.arw.offsetWidth - 2 + "px";
|
|
this.p_tbl.style.width = this.polygon.style.width
|
|
};
|
|
this.enableItem = function() {
|
|
g._enableItem(this)
|
|
};
|
|
this.disableItem = function() {
|
|
g._disableItem(this)
|
|
};
|
|
this.isEnabled = function() {
|
|
return this.state
|
|
};
|
|
this.showItem = function() {
|
|
this.obj.style.display = "";
|
|
this.arw.style.display = ""
|
|
};
|
|
this.hideItem = function() {
|
|
this.obj.style.display = "none";
|
|
this.arw.style.display = "none"
|
|
};
|
|
this.isVisible = function() {
|
|
return (this.obj.style.display == "")
|
|
};
|
|
this.setItemText = function(n) {
|
|
g._setItemText(this, n)
|
|
};
|
|
this.getItemText = function() {
|
|
return g._getItemText(this)
|
|
};
|
|
this.setItemImage = function(n) {
|
|
g._setItemImage(this, n, true)
|
|
};
|
|
this.clearItemImage = function() {
|
|
g._clearItemImage(this, true)
|
|
};
|
|
this.setItemImageDis = function(n) {
|
|
g._setItemImage(this, n, false)
|
|
};
|
|
this.clearItemImageDis = function() {
|
|
g._clearItemImage(this, false)
|
|
};
|
|
this.setItemToolTip = function(n) {
|
|
this.obj.title = n;
|
|
this.arw.title = n
|
|
};
|
|
this.getItemToolTip = function() {
|
|
return this.obj.title
|
|
};
|
|
this.addListOption = function(u, s, q, r, n) {
|
|
if (!(q == "button" || q == "separator")) {
|
|
return
|
|
}
|
|
var o = {
|
|
id: u,
|
|
type: q,
|
|
text: r,
|
|
img: n
|
|
};
|
|
new this["_" + q + "ButtonSelectObject"](u, o, s)
|
|
};
|
|
this.removeListOption = function(q) {
|
|
if (!this._isListButton(q, true)) {
|
|
return
|
|
}
|
|
var n = this._listOptions[q];
|
|
if (n.td_a != null && n.td_b != null) {
|
|
n.td_a.onselectstart = null;
|
|
n.td_b.onselectstart = null;
|
|
while (n.td_a.childNodes.length > 0) {
|
|
n.td_a.removeChild(n.td_a.childNodes[0])
|
|
}
|
|
while (n.td_b.childNodes.length > 0) {
|
|
n.td_b.removeChild(n.td_b.childNodes[0])
|
|
}
|
|
n.tr.onselectstart = null;
|
|
n.tr.onmouseover = null;
|
|
n.tr.onmouseout = null;
|
|
n.tr.onclick = null;
|
|
while (n.tr.childNodes.length > 0) {
|
|
n.tr.removeChild(n.tr.childNodes[0])
|
|
}
|
|
n.tr.parentNode.removeChild(n.tr);
|
|
n.td_a = null;
|
|
n.td_b = null;
|
|
n.tr = null
|
|
} else {
|
|
n.sep.onselectstart = null;
|
|
n.td.onselectstart = null;
|
|
n.tr.onselectstart = null;
|
|
while (n.td.childNodes.length > 0) {
|
|
n.td.removeChild(n.td.childNodes[0])
|
|
}
|
|
while (n.tr.childNodes.length > 0) {
|
|
n.tr.removeChild(n.tr.childNodes[0])
|
|
}
|
|
n.tr.parentNode.removeChild(n.tr);
|
|
n.sep = null;
|
|
n.td = null;
|
|
n.tr = null
|
|
}
|
|
n = null;
|
|
this._listOptions[q] = null;
|
|
try {
|
|
delete this._listOptions[q]
|
|
} catch (o) {}
|
|
};
|
|
this.showListOption = function(n) {
|
|
if (!this._isListButton(n, true)) {
|
|
return
|
|
}
|
|
this._listOptions[n].tr.style.display = ""
|
|
};
|
|
this.hideListOption = function(n) {
|
|
if (!this._isListButton(n, true)) {
|
|
return
|
|
}
|
|
this._listOptions[n].tr.style.display = "none"
|
|
};
|
|
this.isListOptionVisible = function(n) {
|
|
if (!this._isListButton(n, true)) {
|
|
return
|
|
}
|
|
return (this._listOptions[n].tr.style.display != "none")
|
|
};
|
|
this.enableListOption = function(n) {
|
|
if (!this._isListButton(n)) {
|
|
return
|
|
}
|
|
this._listOptions[n].tr.en = true;
|
|
this._listOptions[n].tr.className = "tr_btn" + (this._listOptions[n].tr._selected && g.renderSelect ? " tr_btn_selected" : "")
|
|
};
|
|
this.disableListOption = function(n) {
|
|
if (!this._isListButton(n)) {
|
|
return
|
|
}
|
|
this._listOptions[n].tr.en = false;
|
|
this._listOptions[n].tr.className = "tr_btn tr_btn_disabled"
|
|
};
|
|
this.isListOptionEnabled = function(n) {
|
|
if (!this._isListButton(n)) {
|
|
return
|
|
}
|
|
return this._listOptions[n].tr.en
|
|
};
|
|
this.setListOptionPosition = function(q, o) {
|
|
if (!this._listOptions[q] || this.getListOptionPosition(q) == o || isNaN(o)) {
|
|
return
|
|
}
|
|
if (o < 1) {
|
|
o = 1
|
|
}
|
|
var n = this._listOptions[q].tr;
|
|
this.p_tbody.removeChild(n);
|
|
if (o > this.p_tbody.childNodes.length) {
|
|
this.p_tbody.appendChild(n)
|
|
} else {
|
|
this.p_tbody.insertBefore(n, this.p_tbody.childNodes[o - 1])
|
|
}
|
|
n = null
|
|
};
|
|
this.getListOptionPosition = function(r) {
|
|
var o = -1;
|
|
if (!this._listOptions[r]) {
|
|
return o
|
|
}
|
|
for (var n = 0; n < this.p_tbody.childNodes.length; n++) {
|
|
if (this.p_tbody.childNodes[n] == this._listOptions[r].tr) {
|
|
o = n + 1
|
|
}
|
|
}
|
|
return o
|
|
};
|
|
this.setListOptionImage = function(r, n) {
|
|
if (!this._isListButton(r)) {
|
|
return
|
|
}
|
|
var q = this._listOptions[r].tr.childNodes[(g.rtl ? 1 : 0)];
|
|
if (q.childNodes.length > 0) {
|
|
q.childNodes[0].src = g.conf.icons_path + n
|
|
} else {
|
|
var o = document.createElement("IMG");
|
|
o.className = "btn_sel_img";
|
|
o.src = g.conf.icons_path + n;
|
|
q.appendChild(o)
|
|
}
|
|
q = null
|
|
};
|
|
this.getListOptionImage = function(q) {
|
|
if (!this._isListButton(q)) {
|
|
return
|
|
}
|
|
var o = this._listOptions[q].tr.childNodes[(g.rtl ? 1 : 0)];
|
|
var n = null;
|
|
if (o.childNodes.length > 0) {
|
|
n = o.childNodes[0].src
|
|
}
|
|
o = null;
|
|
return n
|
|
};
|
|
this.clearListOptionImage = function(o) {
|
|
if (!this._isListButton(o)) {
|
|
return
|
|
}
|
|
var n = this._listOptions[o].tr.childNodes[(g.rtl ? 1 : 0)];
|
|
while (n.childNodes.length > 0) {
|
|
n.removeChild(n.childNodes[0])
|
|
}
|
|
n.innerHTML = " ";
|
|
n = null
|
|
};
|
|
this.setListOptionText = function(o, n) {
|
|
if (!this._isListButton(o)) {
|
|
return
|
|
}
|
|
this._listOptions[o].tr.childNodes[(g.rtl ? 0 : 1)].childNodes[0].innerHTML = n
|
|
};
|
|
this.getListOptionText = function(n) {
|
|
if (!this._isListButton(n)) {
|
|
return
|
|
}
|
|
return this._listOptions[n].tr.childNodes[(g.rtl ? 0 : 1)].childNodes[0].innerHTML
|
|
};
|
|
this.setListOptionToolTip = function(o, n) {
|
|
if (!this._isListButton(o)) {
|
|
return
|
|
}
|
|
this._listOptions[o].tr.title = n
|
|
};
|
|
this.getListOptionToolTip = function(n) {
|
|
if (!this._isListButton(n)) {
|
|
return
|
|
}
|
|
return this._listOptions[n].tr.title
|
|
};
|
|
this.forEachListOption = function(o) {
|
|
for (var n in this._listOptions) {
|
|
o(n)
|
|
}
|
|
};
|
|
this.getAllListOptions = function() {
|
|
var o = new Array();
|
|
for (var n in this._listOptions) {
|
|
o[o.length] = n
|
|
}
|
|
return o
|
|
};
|
|
this.setListOptionSelected = function(q) {
|
|
for (var n in this._listOptions) {
|
|
var o = this._listOptions[n];
|
|
if (o.td_a != null && o.td_b != null && o.tr.en) {
|
|
if (n == q) {
|
|
o.tr._selected = true;
|
|
o.tr.className = "tr_btn" + (this.renderSelect ? " tr_btn_selected" : "");
|
|
if (this.mode == "select") {
|
|
if (o.tr._img) {
|
|
this.setItemImage(o.tr._img)
|
|
} else {
|
|
this.clearItemImage()
|
|
}
|
|
this.setItemText(this.getListOptionText(q))
|
|
}
|
|
} else {
|
|
o.tr._selected = false;
|
|
o.tr.className = "tr_btn"
|
|
}
|
|
}
|
|
o = null
|
|
}
|
|
};
|
|
this.getListOptionSelected = function() {
|
|
var o = null;
|
|
for (var n in this._listOptions) {
|
|
if (this._listOptions[n].tr._selected == true) {
|
|
o = n
|
|
}
|
|
}
|
|
return o
|
|
};
|
|
this._isListButton = function(o, n) {
|
|
if (this._listOptions[o] == null) {
|
|
return false
|
|
}
|
|
if (!n && this._listOptions[o].tr.className == "tr_sep") {
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
this.setMaxOpen = function(n) {
|
|
this._ph = null;
|
|
if (typeof(n) == "number") {
|
|
this.maxOpen = n;
|
|
this._maxOpenTest();
|
|
return
|
|
}
|
|
this.maxOpen = null
|
|
};
|
|
if (l.width) {
|
|
this.setWidth(l.width)
|
|
}
|
|
if (this.mode == "select" && typeof(l.selected) != "undefined") {
|
|
this.setListOptionSelected(l.selected)
|
|
}
|
|
return this
|
|
};
|
|
dhtmlXToolbarObject.prototype._buttonInputObject = function(g, l, h) {
|
|
this.id = g.idPrefix + l;
|
|
this.obj = document.createElement("DIV");
|
|
this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def";
|
|
this.obj.style.display = (h.hidden != null ? "none" : "");
|
|
this.obj.idd = String(l);
|
|
this.obj.w = (h.width != null ? h.width : 100);
|
|
this.obj.title = (h.title != null ? h.title : "");
|
|
this.obj.innerHTML = "<input class='dhxtoolbar_input' type='text' style='width:" + this.obj.w + "px;'" + (h.value != null ? " value='" + h.value + "'" : "") + ">";
|
|
var c = g;
|
|
var a = this;
|
|
this.obj.childNodes[0].onkeydown = function(m) {
|
|
m = m || event;
|
|
if (m.keyCode == 13) {
|
|
c.callEvent("onEnter", [a.obj.idd, this.value])
|
|
}
|
|
};
|
|
g.base.appendChild(this.obj);
|
|
this.enableItem = function() {
|
|
this.obj.childNodes[0].disabled = false
|
|
};
|
|
this.disableItem = function() {
|
|
this.obj.childNodes[0].disabled = true
|
|
};
|
|
this.isEnabled = function() {
|
|
return (!this.obj.childNodes[0].disabled)
|
|
};
|
|
this.showItem = function() {
|
|
this.obj.style.display = ""
|
|
};
|
|
this.hideItem = function() {
|
|
this.obj.style.display = "none"
|
|
};
|
|
this.isVisible = function() {
|
|
return (this.obj.style.display != "none")
|
|
};
|
|
this.setValue = function(m) {
|
|
this.obj.childNodes[0].value = m
|
|
};
|
|
this.getValue = function() {
|
|
return this.obj.childNodes[0].value
|
|
};
|
|
this.setWidth = function(m) {
|
|
this.obj.w = m;
|
|
this.obj.childNodes[0].style.width = this.obj.w + "px"
|
|
};
|
|
this.getWidth = function() {
|
|
return this.obj.w
|
|
};
|
|
this.setItemToolTip = function(m) {
|
|
this.obj.title = m
|
|
};
|
|
this.getItemToolTip = function() {
|
|
return this.obj.title
|
|
};
|
|
this.getInput = function() {
|
|
return this.obj.firstChild
|
|
};
|
|
if (typeof(h.enabled) != "undefined" && window.dhx4.s2b(h.enabled) == false) {
|
|
this.disableItem()
|
|
}
|
|
return this
|
|
};
|
|
dhtmlXToolbarObject.prototype._buttonTwoStateObject = function(a, h, c) {
|
|
this.id = a.idPrefix + h;
|
|
this.state = (c.enabled != null ? false : true);
|
|
this.imgEn = (c.img != null ? c.img : "");
|
|
this.imgDis = (c.imgdis != null ? c.imgdis : "");
|
|
this.img = (this.state ? (this.imgEn != "" ? this.imgEn : "") : (this.imgDis != "" ? this.imgDis : ""));
|
|
this.obj = document.createElement("DIV");
|
|
this.obj.pressed = (c.selected != null);
|
|
this.obj.extAction = (c.action || null);
|
|
this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.obj.pressed ? "pres" + (this.state ? "" : "_dis") : (this.state ? "def" : "dis"));
|
|
this.obj.style.display = (c.hidden != null ? "none" : "");
|
|
this.obj.renderAs = this.obj.className;
|
|
this.obj.idd = String(h);
|
|
this.obj.title = (c.title || "");
|
|
if (this.obj.pressed) {
|
|
this.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"
|
|
}
|
|
this.obj.innerHTML = a._rtlParseBtn((this.img != "" ? "<img src='" + a.conf.icons_path + this.img + "'>" : ""), (c.text != null ? "<div class='dhxtoolbar_text'>" + c.text + "</div>" : ""));
|
|
a.base.appendChild(this.obj);
|
|
var g = this;
|
|
this.obj.onselectstart = function(l) {
|
|
l = l || event;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
};
|
|
this.obj.onmouseover = function() {
|
|
this._doOnMouseOver()
|
|
};
|
|
this.obj.onmouseout = function() {
|
|
this._doOnMouseOut()
|
|
};
|
|
this.obj._doOnMouseOver = function() {
|
|
if (g.state == false) {
|
|
return
|
|
}
|
|
if (a.anyUsed != "none") {
|
|
return
|
|
}
|
|
if (this.pressed) {
|
|
this.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over";
|
|
return
|
|
}
|
|
this.className = "dhx_toolbar_btn dhxtoolbar_btn_over";
|
|
this.renderAs = this.className
|
|
};
|
|
this.obj._doOnMouseOut = function() {
|
|
if (g.state == false) {
|
|
return
|
|
}
|
|
if (a.anyUsed != "none") {
|
|
return
|
|
}
|
|
if (this.pressed) {
|
|
this.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_def";
|
|
return
|
|
}
|
|
this.className = "dhx_toolbar_btn dhxtoolbar_btn_def";
|
|
this.renderAs = this.className
|
|
};
|
|
this.obj[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(l) {
|
|
if (a.checkEvent("onBeforeStateChange")) {
|
|
if (!a.callEvent("onBeforeStateChange", [this.idd.replace(a.idPrefix, ""), this.pressed])) {
|
|
return
|
|
}
|
|
}
|
|
if (g.state == false) {
|
|
return
|
|
}
|
|
if (a.anyUsed != "none") {
|
|
return
|
|
}
|
|
this.pressed = !this.pressed;
|
|
this.className = (this.pressed ? "dhx_toolbar_btn dhxtoolbar_btn_pres" : this.renderAs);
|
|
var m = this.idd.replace(a.idPrefix, "");
|
|
if (this.extAction) {
|
|
try {
|
|
window[this.extAction](m, this.pressed)
|
|
} catch (l) {}
|
|
}
|
|
a.callEvent("onStateChange", [m, this.pressed]);
|
|
return false
|
|
};
|
|
this.setItemState = function(l, n) {
|
|
if (this.obj.pressed != l) {
|
|
if (l == true) {
|
|
this.obj.pressed = true;
|
|
this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_pres" + (this.state ? "" : "_dis");
|
|
this.obj.renderAs = "dhx_toolbar_btn dhxtoolbar_btn_over"
|
|
} else {
|
|
this.obj.pressed = false;
|
|
this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis");
|
|
this.obj.renderAs = this.obj.className
|
|
} if (n == true) {
|
|
var o = this.obj.idd.replace(a.idPrefix, "");
|
|
if (this.obj.extAction) {
|
|
try {
|
|
window[this.obj.extAction](o, this.obj.pressed)
|
|
} catch (m) {}
|
|
}
|
|
a.callEvent("onStateChange", [o, this.obj.pressed])
|
|
}
|
|
}
|
|
};
|
|
this.getItemState = function() {
|
|
return this.obj.pressed
|
|
};
|
|
this.enableItem = function() {
|
|
a._enableItem(this)
|
|
};
|
|
this.disableItem = function() {
|
|
a._disableItem(this)
|
|
};
|
|
this.isEnabled = function() {
|
|
return this.state
|
|
};
|
|
this.showItem = function() {
|
|
this.obj.style.display = ""
|
|
};
|
|
this.hideItem = function() {
|
|
this.obj.style.display = "none"
|
|
};
|
|
this.isVisible = function() {
|
|
return (this.obj.style.display == "")
|
|
};
|
|
this.setItemText = function(l) {
|
|
a._setItemText(this, l)
|
|
};
|
|
this.getItemText = function() {
|
|
return a._getItemText(this)
|
|
};
|
|
this.setItemImage = function(l) {
|
|
a._setItemImage(this, l, true)
|
|
};
|
|
this.clearItemImage = function() {
|
|
a._clearItemImage(this, true)
|
|
};
|
|
this.setItemImageDis = function(l) {
|
|
a._setItemImage(this, l, false)
|
|
};
|
|
this.clearItemImageDis = function() {
|
|
a._clearItemImage(this, false)
|
|
};
|
|
this.setItemToolTip = function(l) {
|
|
this.obj.title = l
|
|
};
|
|
this.getItemToolTip = function() {
|
|
return this.obj.title
|
|
};
|
|
return this
|
|
};
|
|
dhtmlXToolbarObject.prototype._sliderObject = function(h, m, l) {
|
|
this.id = h.idPrefix + m;
|
|
this.state = (l.enabled != null ? (l.enabled == "true" ? true : false) : true);
|
|
this.obj = document.createElement("DIV");
|
|
this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_" + (this.state ? "def" : "dis");
|
|
this.obj.style.display = (l.hidden != null ? "none" : "");
|
|
this.obj.onselectstart = function(n) {
|
|
n = n || event;
|
|
if (n.preventDefault) {
|
|
n.preventDefault()
|
|
} else {
|
|
n.returnValue = false
|
|
}
|
|
};
|
|
this.obj.idd = String(m);
|
|
this.obj.len = (l.length != null ? Number(l.length) : 50);
|
|
this.obj.innerHTML = "<div class='dhxtoolbar_text'>" + (l.textMin || "") + "</div><div class='dhxtoolbar_sl_bg_l'></div><div class='dhxtoolbar_sl_bg_m' style='width:" + this.obj.len + "px;'></div><div class='dhxtoolbar_sl_bg_r'></div><div class='dhxtoolbar_text'>" + (l.textMax || "") + "</div>";
|
|
h.base.appendChild(this.obj);
|
|
var a = this;
|
|
this.pen = document.createElement("DIV");
|
|
this.pen.className = "dhxtoolbar_sl_pen";
|
|
this.obj.appendChild(this.pen);
|
|
var g = this.pen;
|
|
this.label = document.createElement("DIV");
|
|
this.label.dir = "ltr";
|
|
this.label.className = "dhx_toolbar_slider_label_" + h.conf.skin + (h.rtl ? "_rtl" : "");
|
|
this.label.style.display = "none";
|
|
this.label.tip = (l.toolTip || "%v");
|
|
this.label._zi = window.dhx4.newId();
|
|
document.body.appendChild(this.label);
|
|
var c = this.label;
|
|
this.pen.valueMin = (l.valueMin != null ? Number(l.valueMin) : 0);
|
|
this.pen.valueMax = (l.valueMax != null ? Number(l.valueMax) : 100);
|
|
if (this.pen.valueMin > this.pen.valueMax) {
|
|
this.pen.valueMin = this.pen.valueMax
|
|
}
|
|
this.pen.valueNow = (l.valueNow != null ? Number(l.valueNow) : this.pen.valueMax);
|
|
if (this.pen.valueNow > this.pen.valueMax) {
|
|
this.pen.valueNow = this.pen.valueMax
|
|
}
|
|
if (this.pen.valueNow < this.pen.valueMin) {
|
|
this.pen.valueNow = this.pen.valueMin
|
|
}
|
|
this.pen._detectLimits = function() {
|
|
this.minX = a.obj.childNodes[1].offsetLeft + 2;
|
|
this.maxX = a.obj.childNodes[3].offsetLeft - this.offsetWidth + 1
|
|
};
|
|
this.pen._detectLimits();
|
|
this.pen._definePos = function() {
|
|
this.nowX = Math.round((this.valueNow - this.valueMin) * (this.maxX - this.minX) / (this.valueMax - this.valueMin) + this.minX);
|
|
this.style.left = this.nowX + "px";
|
|
this.newNowX = this.nowX
|
|
};
|
|
this.pen._definePos();
|
|
this.pen.initXY = 0;
|
|
this.pen.allowMove = false;
|
|
this.pen[window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(n) {
|
|
if (a.state == false) {
|
|
return
|
|
}
|
|
n = n || event;
|
|
this.initXY = (window.dhx4.isIPad ? n.touches[0].clientX : n.clientX);
|
|
this.newValueNow = this.valueNow;
|
|
this.allowMove = true;
|
|
this.className = "dhxtoolbar_sl_pen dhxtoolbar_over";
|
|
if (c.tip != "") {
|
|
c.style.visibility = "hidden";
|
|
c.style.display = "";
|
|
c.innerHTML = c.tip.replace("%v", this.valueNow);
|
|
c.style.left = Math.round(window.dhx4.absLeft(this) + this.offsetWidth / 2 - c.offsetWidth / 2) + "px";
|
|
c.style.top = window.dhx4.absTop(this) - c.offsetHeight - 3 + "px";
|
|
c.style.visibility = "";
|
|
c.style.zIndex = window.dhx4.zim.reserve(c._zi)
|
|
}
|
|
};
|
|
this.pen._doOnMouseMoveStart = function(o) {
|
|
o = o || event;
|
|
if (!g.allowMove) {
|
|
return
|
|
}
|
|
var n = (window.dhx4.isIPad ? o.touches[0].clientX : o.clientX);
|
|
var q = n - g.initXY;
|
|
if (n < window.dhx4.absLeft(g) + Math.round(g.offsetWidth / 2) && g.nowX == g.minX) {
|
|
return
|
|
}
|
|
if (n > window.dhx4.absLeft(g) + Math.round(g.offsetWidth / 2) && g.nowX == g.maxX) {
|
|
return
|
|
}
|
|
g.newNowX = g.nowX + q;
|
|
if (g.newNowX < g.minX) {
|
|
g.newNowX = g.minX
|
|
}
|
|
if (g.newNowX > g.maxX) {
|
|
g.newNowX = g.maxX
|
|
}
|
|
g.nowX = g.newNowX;
|
|
g.style.left = g.nowX + "px";
|
|
g.initXY = n;
|
|
g.newValueNow = Math.round((g.valueMax - g.valueMin) * (g.newNowX - g.minX) / (g.maxX - g.minX) + g.valueMin);
|
|
if (c.tip != "") {
|
|
c.innerHTML = c.tip.replace(/%v/gi, g.newValueNow);
|
|
c.style.left = Math.round(window.dhx4.absLeft(g) + g.offsetWidth / 2 - c.offsetWidth / 2) + "px";
|
|
c.style.top = window.dhx4.absTop(g) - c.offsetHeight - 3 + "px"
|
|
}
|
|
o.cancelBubble = true;
|
|
if (o.preventDefault) {
|
|
o.preventDefault()
|
|
} else {
|
|
o.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
this.pen._doOnMouseMoveEnd = function() {
|
|
if (!g.allowMove) {
|
|
return
|
|
}
|
|
g.className = "dhxtoolbar_sl_pen";
|
|
g.allowMove = false;
|
|
g.nowX = g.newNowX;
|
|
g.valueNow = g.newValueNow;
|
|
if (c.tip != "") {
|
|
c.style.display = "none";
|
|
window.dhx4.zim.clear(c._zi)
|
|
}
|
|
h.callEvent("onValueChange", [a.obj.idd.replace(h.idPrefix, ""), g.valueNow])
|
|
};
|
|
if (window.dhx4.isIPad) {
|
|
document.addEventListener("touchmove", g._doOnMouseMoveStart, false);
|
|
document.addEventListener("touchend", g._doOnMouseMoveEnd, false)
|
|
} else {
|
|
if (typeof(window.addEventListener) != "undefined") {
|
|
window.addEventListener("mousemove", g._doOnMouseMoveStart, false);
|
|
window.addEventListener("mouseup", g._doOnMouseMoveEnd, false)
|
|
} else {
|
|
document.body.attachEvent("onmousemove", g._doOnMouseMoveStart);
|
|
document.body.attachEvent("onmouseup", g._doOnMouseMoveEnd)
|
|
}
|
|
}
|
|
this.enableItem = function() {
|
|
if (this.state) {
|
|
return
|
|
}
|
|
this.state = true;
|
|
this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_def"
|
|
};
|
|
this.disableItem = function() {
|
|
if (!this.state) {
|
|
return
|
|
}
|
|
this.state = false;
|
|
this.obj.className = "dhx_toolbar_btn dhxtoolbar_btn_dis"
|
|
};
|
|
this.isEnabled = function() {
|
|
return this.state
|
|
};
|
|
this.showItem = function() {
|
|
this.obj.style.display = ""
|
|
};
|
|
this.hideItem = function() {
|
|
this.obj.style.display = "none"
|
|
};
|
|
this.isVisible = function() {
|
|
return (this.obj.style.display == "")
|
|
};
|
|
this.setValue = function(n, o) {
|
|
n = Number(n);
|
|
if (n < this.pen.valueMin) {
|
|
n = this.pen.valueMin
|
|
}
|
|
if (n > this.pen.valueMax) {
|
|
n = this.pen.valueMax
|
|
}
|
|
this.pen.valueNow = n;
|
|
this.pen._definePos();
|
|
if (o == true) {
|
|
h.callEvent("onValueChange", [this.obj.idd.replace(h.idPrefix, ""), this.pen.valueNow])
|
|
}
|
|
};
|
|
this.getValue = function() {
|
|
return this.pen.valueNow
|
|
};
|
|
this.setMinValue = function(o, n) {
|
|
o = Number(o);
|
|
if (o > this.pen.valueMax) {
|
|
return
|
|
}
|
|
this.obj.childNodes[0].innerHTML = n;
|
|
this.obj.childNodes[0].style.display = (n.length > 0 ? "" : "none");
|
|
this.pen.valueMin = o;
|
|
if (this.pen.valueNow < this.pen.valueMin) {
|
|
this.pen.valueNow = this.pen.valueMin
|
|
}
|
|
this.pen._detectLimits();
|
|
this.pen._definePos()
|
|
};
|
|
this.setMaxValue = function(o, n) {
|
|
o = Number(o);
|
|
if (o < this.pen.valueMin) {
|
|
return
|
|
}
|
|
this.obj.childNodes[4].innerHTML = n;
|
|
this.obj.childNodes[4].style.display = (n.length > 0 ? "" : "none");
|
|
this.pen.valueMax = o;
|
|
if (this.pen.valueNow > this.pen.valueMax) {
|
|
this.pen.valueNow = this.pen.valueMax
|
|
}
|
|
this.pen._detectLimits();
|
|
this.pen._definePos()
|
|
};
|
|
this.getMinValue = function() {
|
|
var n = this.obj.childNodes[0].innerHTML;
|
|
var o = this.pen.valueMin;
|
|
return new Array(o, n)
|
|
};
|
|
this.getMaxValue = function() {
|
|
var n = this.obj.childNodes[4].innerHTML;
|
|
var o = this.pen.valueMax;
|
|
return new Array(o, n)
|
|
};
|
|
this.setItemToolTipTemplate = function(n) {
|
|
this.label.tip = n
|
|
};
|
|
this.getItemToolTipTemplate = function() {
|
|
return this.label.tip
|
|
};
|
|
return this
|
|
};
|
|
dhtmlXToolbarObject.prototype.unload = function() {
|
|
if (this.conf.isIPad) {
|
|
document.removeEventListener("touchstart", this._doOnClick, false)
|
|
} else {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("mousedown", this._doOnClick, false)
|
|
} else {
|
|
document.body.detachEvent("onmousedown", this._doOnClick)
|
|
}
|
|
}
|
|
this._doOnClick = null;
|
|
this.clearAll();
|
|
this.objPull = null;
|
|
if (this._xmlLoader) {
|
|
this._xmlLoader.destructor();
|
|
this._xmlLoader = null
|
|
}
|
|
while (this.base.childNodes.length > 0) {
|
|
this.base.removeChild(this.base.childNodes[0])
|
|
}
|
|
this.cont.removeChild(this.base);
|
|
this.base = null;
|
|
while (this.cont.childNodes.length > 0) {
|
|
this.cont.removeChild(this.cont.childNodes[0])
|
|
}
|
|
this.cont.className = "";
|
|
this.cont = null;
|
|
window.dhx4._enableDataLoading(this, null, null, null, "clear");
|
|
window.dhx4._eventable(this, "clear");
|
|
this.tX1 = null;
|
|
this.tX2 = null;
|
|
this.tY1 = null;
|
|
this.tY2 = null;
|
|
this.anyUsed = null;
|
|
this.idPrefix = null;
|
|
this.rootTypes = null;
|
|
this._rtl = null;
|
|
this._rtlParseBtn = null;
|
|
this.setRTL = null;
|
|
this._sbw = null;
|
|
this._getObj = null;
|
|
this._addImgObj = null;
|
|
this._setItemImage = null;
|
|
this._clearItemImage = null;
|
|
this._setItemText = null;
|
|
this._getItemText = null;
|
|
this._enableItem = null;
|
|
this._disableItem = null;
|
|
this._xmlParser = null;
|
|
this._addItemToStorage = null;
|
|
this._genStr = null;
|
|
this._addItem = null;
|
|
this._getPosition = null;
|
|
this._setPosition = null;
|
|
this._getIdByPosition = null;
|
|
this._separatorObject = null;
|
|
this._textObject = null;
|
|
this._buttonObject = null;
|
|
this._buttonSelectObject = null;
|
|
this._buttonInputObject = null;
|
|
this._buttonTwoStateObject = null;
|
|
this._sliderObject = null;
|
|
this._autoDetectVisibleArea = null;
|
|
this._removeItem = null;
|
|
this.setAlign = null;
|
|
this.setSkin = null;
|
|
this.setIconsPath = null;
|
|
this.setIconPath = null;
|
|
this.loadXML = null;
|
|
this.loadXMLString = null;
|
|
this.clearAll = null;
|
|
this.addSpacer = null;
|
|
this.removeSpacer = null;
|
|
this.getType = null;
|
|
this.getTypeExt = null;
|
|
this.inArray = null;
|
|
this.getParentId = null;
|
|
this.addButton = null;
|
|
this.addText = null;
|
|
this.addButtonSelect = null;
|
|
this.addButtonTwoState = null;
|
|
this.addSeparator = null;
|
|
this.addSlider = null;
|
|
this.addInput = null;
|
|
this.forEachItem = null;
|
|
this.showItem = null;
|
|
this.hideItem = null;
|
|
this.isVisible = null;
|
|
this.enableItem = null;
|
|
this.disableItem = null;
|
|
this.isEnabled = null;
|
|
this.setItemText = null;
|
|
this.getItemText = null;
|
|
this.setItemToolTip = null;
|
|
this.getItemToolTip = null;
|
|
this.setItemImage = null;
|
|
this.setItemImageDis = null;
|
|
this.clearItemImage = null;
|
|
this.clearItemImageDis = null;
|
|
this.setItemState = null;
|
|
this.getItemState = null;
|
|
this.setItemToolTipTemplate = null;
|
|
this.getItemToolTipTemplate = null;
|
|
this.setValue = null;
|
|
this.getValue = null;
|
|
this.setMinValue = null;
|
|
this.getMinValue = null;
|
|
this.setMaxValue = null;
|
|
this.getMaxValue = null;
|
|
this.setWidth = null;
|
|
this.getWidth = null;
|
|
this.getPosition = null;
|
|
this.setPosition = null;
|
|
this.removeItem = null;
|
|
this.addListOption = null;
|
|
this.removeListOption = null;
|
|
this.showListOption = null;
|
|
this.hideListOption = null;
|
|
this.isListOptionVisible = null;
|
|
this.enableListOption = null;
|
|
this.disableListOption = null;
|
|
this.isListOptionEnabled = null;
|
|
this.setListOptionPosition = null;
|
|
this.getListOptionPosition = null;
|
|
this.setListOptionText = null;
|
|
this.getListOptionText = null;
|
|
this.setListOptionToolTip = null;
|
|
this.getListOptionToolTip = null;
|
|
this.setListOptionImage = null;
|
|
this.getListOptionImage = null;
|
|
this.clearListOptionImage = null;
|
|
this.forEachListOption = null;
|
|
this.getAllListOptions = null;
|
|
this.setListOptionSelected = null;
|
|
this.getListOptionSelected = null;
|
|
this.unload = null;
|
|
this.setUserData = null;
|
|
this.getUserData = null;
|
|
this.setMaxOpen = null;
|
|
this.items = null;
|
|
this.conf = null
|
|
};
|
|
dhtmlXToolbarObject.prototype._autoDetectVisibleArea = function() {
|
|
var a = window.dhx4.screenDim();
|
|
this.tX1 = a.left;
|
|
this.tX2 = a.right;
|
|
this.tY1 = a.top;
|
|
this.tY2 = a.bottom
|
|
};
|
|
dhtmlXToolbarObject.prototype._initObj = function(c) {
|
|
for (var a = 0; a < c.length; a++) {
|
|
this._addItemToStorage(c[a])
|
|
}
|
|
if (this.conf.skin == "dhx_terrace") {
|
|
this._improveTerraceSkin()
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype._xmlToJson = function(v) {
|
|
var o = [];
|
|
var A = v.getElementsByTagName("toolbar");
|
|
if (A != null && A[0] != null) {
|
|
A = A[0];
|
|
var E = ["id", "type", "hidden", "title", "text", "enabled", "img", "imgdis", "action", "openAll", "renderSelect", "mode", "maxOpen", "width", "value", "selected", "length", "textMin", "textMax", "toolTip", "valueMin", "valueMax", "valueNow"];
|
|
var g = ["id", "type", "enabled", "disabled", "action", "selected", "img", "text"];
|
|
for (var c = 0; c < A.childNodes.length; c++) {
|
|
if (A.childNodes[c].tagName == "item") {
|
|
var n = {};
|
|
for (var C = 0; C < E.length; C++) {
|
|
var l = A.childNodes[c].getAttribute(E[C]);
|
|
if (l != null) {
|
|
n[E[C]] = l
|
|
}
|
|
}
|
|
for (var y = 0; y < A.childNodes[c].childNodes.length; y++) {
|
|
if (A.childNodes[c].childNodes[y].tagName == "item" && n.type == "buttonSelect") {
|
|
var D = {};
|
|
for (var C = 0; C < g.length; C++) {
|
|
var l = A.childNodes[c].childNodes[y].getAttribute(g[C]);
|
|
if (l != null) {
|
|
D[g[C]] = l
|
|
}
|
|
}
|
|
var x = A.childNodes[c].childNodes[y].getElementsByTagName("itemText");
|
|
if (x != null && x[0] != null) {
|
|
D.itemText = x[0].firstChild.nodeValue
|
|
}
|
|
var s = A.childNodes[c].childNodes[y].getElementsByTagName("userdata");
|
|
for (var C = 0; C < s.length; C++) {
|
|
if (!D.userdata) {
|
|
D.userdata = {}
|
|
}
|
|
var a = {};
|
|
try {
|
|
a.name = s[C].getAttribute("name")
|
|
} catch (m) {
|
|
a.name = null
|
|
}
|
|
try {
|
|
a.value = s[C].firstChild.nodeValue
|
|
} catch (m) {
|
|
a.value = ""
|
|
}
|
|
if (a.name != null) {
|
|
D.userdata[a.name] = a.value
|
|
}
|
|
}
|
|
if (n.options == null) {
|
|
n.options = []
|
|
}
|
|
n.options.push(D)
|
|
}
|
|
if (A.childNodes[c].childNodes[y].tagName == "userdata") {
|
|
if (n.userdata == null) {
|
|
n.userdata = {}
|
|
}
|
|
var D = {};
|
|
try {
|
|
D.name = A.childNodes[c].childNodes[y].getAttribute("name")
|
|
} catch (m) {
|
|
D.name = null
|
|
}
|
|
try {
|
|
D.value = A.childNodes[c].childNodes[y].firstChild.nodeValue
|
|
} catch (m) {
|
|
D.value = ""
|
|
}
|
|
if (D.name != null) {
|
|
n.userdata[D.name] = D.value
|
|
}
|
|
}
|
|
}
|
|
o.push(n)
|
|
}
|
|
}
|
|
}
|
|
return o
|
|
};
|
|
dhtmlXToolbarObject.prototype._addItemToStorage = function(m, o) {
|
|
var n = (m.id || this._genStr(24));
|
|
var h = (m.type || "");
|
|
if (h != "" && this["_" + h + "Object"] != null) {
|
|
if (h == "buttonSelect") {
|
|
if (m.options != null) {
|
|
for (var l = 0; l < m.options.length; l++) {
|
|
if (m.options[l].type == "obj") {
|
|
m.options[l].type = "button"
|
|
}
|
|
if (m.options[l].type == "sep") {
|
|
m.options[l].type = "separator"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (h == "slider") {
|
|
var g = {
|
|
tip_template: "toolTip",
|
|
value_min: "valueMin",
|
|
value_max: "valueMax",
|
|
value_now: "valueNow",
|
|
text_min: "textMin",
|
|
text_max: "textMax"
|
|
};
|
|
for (var c in g) {
|
|
if (m[g[c]] == null && m[c] != null) {
|
|
m[g[c]] = m[c]
|
|
}
|
|
}
|
|
}
|
|
if (h == "buttonInput") {
|
|
if (m.value == null && m.text != null) {
|
|
m.value = m.text
|
|
}
|
|
}
|
|
if (h == "buttonTwoState") {
|
|
if (typeof(m.selected) == "undefined" && typeof(m.pressed) != "undefined" && window.dhx4.s2b(m.pressed)) {
|
|
m.selected = true
|
|
}
|
|
}
|
|
if (typeof(m.enabled) == "undefined" && typeof(m.disabled) != "undefined" && window.dhx4.s2b(m.disabled)) {
|
|
m.enabled = false
|
|
}
|
|
if (m.imgDis == null && m.img_disabled != null) {
|
|
m.imgdis = m.img_disabled
|
|
}
|
|
if ((typeof(m.openAll) == "undefined" || m.openAll == null) && this.conf.skin == "dhx_terrace") {
|
|
m.openAll = true
|
|
}
|
|
this.objPull[this.idPrefix + n] = new this["_" + h + "Object"](this, n, m);
|
|
this.objPull[this.idPrefix + n]["type"] = h;
|
|
this.setPosition(n, o)
|
|
}
|
|
if (m.userdata != null) {
|
|
for (var c in m.userdata) {
|
|
this.setUserData(n, c, m.userdata[c])
|
|
}
|
|
}
|
|
if (m.options != null) {
|
|
for (var l = 0; l < m.options.length; l++) {
|
|
if (m.options[l].userdata != null) {
|
|
for (var c in m.options[l].userdata) {
|
|
this.setListOptionUserData(m.id, m.options[l].id, c, m.options[l].userdata[c])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype.setSkin = function(l, g) {
|
|
if (g === true) {
|
|
this.cont.className = this.cont.className.replace(/dhxtoolbar_icons_\d{1,}/, "dhxtoolbar_icons_" + this.conf.iconSize)
|
|
} else {
|
|
this.conf.skin = l;
|
|
if (this.conf.skin == "dhx_skyblue") {
|
|
this.conf.sel_ofs_y = 1
|
|
}
|
|
if (this.conf.skin == "dhx_web") {
|
|
this.conf.sel_ofs_y = 1;
|
|
this.conf.sel_ofs_x = 1
|
|
}
|
|
if (this.conf.skin == "dhx_terrace") {
|
|
this.conf.sel_ofs_y = -1;
|
|
this.conf.sel_ofs_x = 0
|
|
}
|
|
this.cont.className = "dhx_toolbar_" + this.conf.skin + " dhxtoolbar_icons_" + this.conf.iconSize
|
|
}
|
|
for (var c in this.objPull) {
|
|
var h = this.objPull[c];
|
|
if (h.type == "slider") {
|
|
h.pen._detectLimits();
|
|
h.pen._definePos();
|
|
h.label.className = "dhx_toolbar_slider_label_" + this.conf.skin
|
|
}
|
|
if (h.type == "buttonSelect") {
|
|
h.polygon.className = "dhx_toolbar_poly_" + this.conf.skin + " dhxtoolbar_icons_" + this.conf.iconSize
|
|
}
|
|
}
|
|
if (l == "dhx_terrace") {
|
|
this._improveTerraceSkin()
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype.setAlign = function(a) {
|
|
this.conf.align = (a == "right" ? "right" : "left");
|
|
this.base.className = (a == "right" ? "dhxtoolbar_float_right" : "dhxtoolbar_float_left");
|
|
if (this._spacer) {
|
|
this._spacer.className = (a == "right" ? " dhxtoolbar_float_left" : " dhxtoolbar_float_right")
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype.setIconSize = function(a) {
|
|
this.conf.iconSize = ({
|
|
18: true,
|
|
24: true,
|
|
32: true,
|
|
48: true
|
|
}[a] ? a : 18);
|
|
this.setSkin(this.conf.skin, true);
|
|
this.callEvent("_onIconSizeChange", [this.conf.iconSize])
|
|
};
|
|
dhtmlXToolbarObject.prototype.setIconsPath = function(a) {
|
|
this.conf.icons_path = a
|
|
};
|
|
dhtmlXToolbarObject.prototype.setUserData = function(g, a, c) {
|
|
g = this.idPrefix + g;
|
|
if (this.objPull[g] != null) {
|
|
if (this.objPull[g].userData == null) {
|
|
this.objPull[g].userData = {}
|
|
}
|
|
this.objPull[g].userData[a] = c
|
|
}
|
|
};
|
|
dhtmlXToolbarObject.prototype.getUserData = function(c, a) {
|
|
c = this.idPrefix + c;
|
|
if (this.objPull[c] != null && this.objPull[c].userData != null) {
|
|
return this.objPull[c].userData[a] || null
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXToolbarObject.prototype._isListOptionExists = function(a, g) {
|
|
if (this.objPull[this.idPrefix + a] == null) {
|
|
return false
|
|
}
|
|
var c = this.objPull[this.idPrefix + a];
|
|
if (c.type != "buttonSelect") {
|
|
return false
|
|
}
|
|
if (c._listOptions[g] == null) {
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXToolbarObject.prototype.setListOptionUserData = function(a, l, c, h) {
|
|
if (!this._isListOptionExists(a, l)) {
|
|
return
|
|
}
|
|
var g = this.objPull[this.idPrefix + a]._listOptions[l];
|
|
if (g.userData == null) {
|
|
g.userData = {}
|
|
}
|
|
g.userData[c] = h
|
|
};
|
|
dhtmlXToolbarObject.prototype.getListOptionUserData = function(a, h, c) {
|
|
if (!this._isListOptionExists(a, h)) {
|
|
return null
|
|
}
|
|
var g = this.objPull[this.idPrefix + a]._listOptions[h];
|
|
if (!g.userData) {
|
|
return null
|
|
}
|
|
return (g.userData[c] ? g.userData[c] : null)
|
|
};
|
|
dhtmlXToolbarObject.prototype._improveTerraceSkin = function() {
|
|
if (this.conf.terrace_radius == null) {
|
|
this.conf.terrace_radius = "3px"
|
|
}
|
|
var g = [];
|
|
var h = {
|
|
separator: true,
|
|
text: true
|
|
};
|
|
var m = [this.base];
|
|
if (this._spacer != null) {
|
|
m.push(this._spacer)
|
|
}
|
|
for (var o = 0; o < m.length; o++) {
|
|
g[o] = [];
|
|
for (var c = 0; c < m[o].childNodes.length; c++) {
|
|
if (m[o].childNodes[c].idd != null && m[o].childNodes[c].style.display != "none") {
|
|
var n = this.idPrefix + m[o].childNodes[c].idd;
|
|
if (this.objPull[n] != null && this.objPull[n].obj == m[o].childNodes[c]) {
|
|
g[o].push({
|
|
a: n,
|
|
type: this.objPull[n].type,
|
|
node: this.objPull[n][this.objPull[n].type == "buttonSelect" ? "arw" : "obj"]
|
|
})
|
|
}
|
|
}
|
|
}
|
|
m[o] = null
|
|
}
|
|
for (var o = 0; o < g.length; o++) {
|
|
for (var c = 0; c < g[o].length; c++) {
|
|
var r = g[o][c];
|
|
var s = false;
|
|
var l = false;
|
|
if (!h[r.type]) {
|
|
if (c == g[o].length - 1 || (g[o][c + 1] != null && h[g[o][c + 1].type])) {
|
|
s = true
|
|
}
|
|
if (c == 0 || (c - 1 >= 0 && g[o][c - 1] != null && h[g[o][c - 1].type])) {
|
|
l = true
|
|
}
|
|
}
|
|
r.node.style.borderRightWidth = (s ? "1px" : "0px");
|
|
r.node.style.borderTopRightRadius = r.node.style.borderBottomRightRadius = (s ? this.conf.terrace_radius : "0px");
|
|
if (r.type == "buttonSelect") {
|
|
r.node.previousSibling.style.borderTopLeftRadius = r.node.previousSibling.style.borderBottomLeftRadius = (l ? this.conf.terrace_radius : "0px");
|
|
r.node.previousSibling._br = s;
|
|
r.node.previousSibling._bl = l
|
|
} else {
|
|
r.node.style.borderTopLeftRadius = r.node.style.borderBottomLeftRadius = (l ? this.conf.terrace_radius : "0px")
|
|
}
|
|
r.node._br = s;
|
|
r.node._bl = l
|
|
}
|
|
}
|
|
for (var o = 0; o < g.length; o++) {
|
|
for (var c = 0; c < g[o].length; c++) {
|
|
for (var n in g[o][c]) {
|
|
g[o][c][n] = null
|
|
}
|
|
g[o][c] = null
|
|
}
|
|
g[o] = null
|
|
}
|
|
g = m = null
|
|
};
|
|
dhtmlXToolbarObject.prototype._improveTerraceButtonSelect = function(g, c) {
|
|
var a = this.objPull[g];
|
|
if (c == true) {
|
|
a.obj.style.borderBottomLeftRadius = (a.obj._bl ? this.conf.terrace_radius : "0px");
|
|
a.arw.style.borderBottomRightRadius = (a.obj._br ? this.conf.terrace_radius : "0px")
|
|
} else {
|
|
a.obj.style.borderBottomLeftRadius = "0px";
|
|
a.arw.style.borderBottomRightRadius = "0px"
|
|
}
|
|
a = null
|
|
};
|
|
|
|
function dhtmlXEditor(g, h) {
|
|
var c = this;
|
|
this.conf = {
|
|
content: "",
|
|
contentHTML: "",
|
|
resizeTM: null,
|
|
resizeTMTime: 100,
|
|
roMode: false,
|
|
toolbar: false,
|
|
iconsPath: "",
|
|
evs: ["focus", "blur", "keydown", "keyup", "keypress", "mouseup", "mousedown", "click"]
|
|
};
|
|
this._doOnFocusChanged = null;
|
|
this._doOnAccess = null;
|
|
if (typeof(g) == "object" && g != null && g.tagName == null) {
|
|
h = g.skin;
|
|
if (g.content != null) {
|
|
this.conf.content = g.content
|
|
}
|
|
if (g.contentHTML != null) {
|
|
this.conf.contentHTML = g.contentHTML
|
|
}
|
|
if (g.iconsPath != null) {
|
|
this.conf.iconsPath = g.iconsPath
|
|
}
|
|
if (g.toolbar != null) {
|
|
this.conf.toolbar = window.dhx4.s2b(g.toolbar)
|
|
}
|
|
if (g.onFocusChanged != null) {
|
|
this._doOnFocusChanged = g.onFocusChanged
|
|
}
|
|
if (g.onAccess != null) {
|
|
this._doOnAccess = g.onAccess
|
|
}
|
|
g = g.parent
|
|
}
|
|
this.conf.skin = (h || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxeditor") || "dhx_skyblue");
|
|
if (typeof(g) == "string") {
|
|
g = document.getElementById(g)
|
|
}
|
|
this.base = g;
|
|
this.base.className += " dhxeditor_" + this.conf.skin;
|
|
while (this.base.childNodes.length > 0) {
|
|
this.base.removeChild(this.base.childNodes[0])
|
|
}
|
|
var l = (window.dhx4.isIE ? this.base.currentStyle.position : window.getComputedStyle(this.base, null).getPropertyValue("position"));
|
|
if (!(l == "relative" || l == "absolute")) {
|
|
this.base.style.position = "relative"
|
|
}
|
|
this.cell = new dhtmlXEditorCell(window.dhx4.newId(), this);
|
|
this.base.appendChild(this.cell.cell);
|
|
this.setSizes();
|
|
this.cBlock = document.createElement("DIV");
|
|
this.cBlock.className = "dhxcont_content_blocker";
|
|
this.cBlock.style.display = "none";
|
|
this.base.appendChild(this.cBlock);
|
|
this.editor = document.createElement("IFRAME");
|
|
this.editor.className = "dhxeditor_mainiframe";
|
|
this.editor.frameBorder = 0;
|
|
if (window.dhx4.isOpera) {
|
|
this.editor.scrolling = "yes"
|
|
}
|
|
var a = this.editor;
|
|
if (typeof(window.addEventListener) != "undefined") {
|
|
a.onload = function() {
|
|
for (var m = 0; m < c.conf.evs.length; m++) {
|
|
a.contentWindow.addEventListener(c.conf.evs[m], c._ev, false)
|
|
}
|
|
}
|
|
} else {
|
|
a.onreadystatechange = function(m) {
|
|
if (typeof(a.readyState) != "undefined" && a.readyState == "complete") {
|
|
try {
|
|
for (var n = 0; n < c.conf.evs.length; n++) {
|
|
a.contentWindow.document.body.attachEvent("on" + c.conf.evs[n], c._ev)
|
|
}
|
|
} catch (o) {}
|
|
}
|
|
}
|
|
}
|
|
this._ev = function(n) {
|
|
n = n || event;
|
|
var m = n.type;
|
|
c.callEvent("onAccess", [m, n]);
|
|
if (typeof(c._doOnAccess) == "function") {
|
|
c._doOnAccess(m, n)
|
|
} else {
|
|
if (typeof(c._doOnAccess) == "string" && typeof(window[c._doOnAccess]) == "function") {
|
|
window[c._doOnAccess](m, n)
|
|
}
|
|
}
|
|
};
|
|
this._focus = function() {
|
|
if (window.dhx4.isIE) {
|
|
this.editor.contentWindow.document.body.focus()
|
|
} else {
|
|
this.editor.contentWindow.focus()
|
|
}
|
|
};
|
|
this.cell.attachObject(this.editor);
|
|
this.edWin = this.editor.contentWindow;
|
|
this.edDoc = this.edWin.document;
|
|
this._prepareContent = function(o, r) {
|
|
var n = "";
|
|
if (o === true && this.getContent != null) {
|
|
n = this.getContent()
|
|
}
|
|
var m = this.editor.contentWindow.document;
|
|
m.open("text/html", "replace");
|
|
if (window.dhx4.isOpera) {
|
|
m.write("<html><head><style> html, body { overflow:auto;-webkit-overflow-scrolling: touch; padding:0px; padding-left:5px !important; height:100%; margin:0px; font-family:Tahoma; font-size:12px; background-color:#ffffff;} </style></head><body " + (r !== true ? "contenteditable='true'" : "") + " tabindex='0'></body></html>")
|
|
} else {
|
|
if (window.dhx4.isKHTML) {
|
|
m.write("<html><head><style> html {overflow-x: auto;-webkit-overflow-scrolling: touch; overflow-y: auto;} body { overflow: auto; overflow-y: scroll;} html,body { padding:0px; padding-left:5px !important; height:100%; margin:0px; font-family:Tahoma; font-size:12px; background-color:#ffffff;} </style></head><body " + (r !== true ? "contenteditable='true'" : "") + " tabindex='0'></body></html>")
|
|
} else {
|
|
if (window.dhx4.isIE) {
|
|
m.write("<html><head><style> html {overflow-y: auto;} body {overflow-y: scroll;-webkit-overflow-scrolling: touch;} html,body { overflow-x: auto; padding:0px; padding-left:5px !important; height:100%; margin:0px; font-family:Tahoma; font-size:12px; background-color: #ffffff; outline: none;} </style></head><body " + (r !== true ? "contenteditable='true'" : "") + " tabindex='0'></body></html>")
|
|
} else {
|
|
m.write("<html><head><style> html,body { overflow-x: auto; overflow-y:-webkit-overflow-scrolling: touch; scroll; padding:0px; padding-left:5px !important; height:100%; margin:0px; font-family:Tahoma; font-size:12px; background-color:#ffffff;} </style></head><body " + (r !== true ? "contenteditable='true'" : "") + " tabindex='0'></body></html>")
|
|
}
|
|
}
|
|
}
|
|
m.close();
|
|
if (window.dhx4.isIE) {
|
|
m.contentEditable = (r !== true)
|
|
} else {
|
|
m.designMode = (r !== true ? "On" : "Off")
|
|
} if (window.dhx4.isFF) {
|
|
try {
|
|
m.execCommand("useCSS", false, true)
|
|
} catch (q) {}
|
|
}
|
|
if (o === true && this.setContent != null) {
|
|
this.setContent(n)
|
|
}
|
|
};
|
|
this._prepareContent();
|
|
this._doOnResize = function() {
|
|
window.clearTimeout(c.conf.resizeTM);
|
|
c.conf.resizeTM = window.setTimeout(function() {
|
|
if (c.setSizes) {
|
|
c.setSizes()
|
|
}
|
|
}, c.conf.resizeTMTime)
|
|
};
|
|
this._runCommand = function(o, r) {
|
|
if (this.conf.roMode === true) {
|
|
return
|
|
}
|
|
if (arguments.length < 2) {
|
|
r = null
|
|
}
|
|
if (window.dhx4.isIE) {
|
|
this.edWin.focus()
|
|
}
|
|
try {
|
|
var n = this.editor.contentWindow.document;
|
|
n.execCommand(o, false, r)
|
|
} catch (q) {}
|
|
if (window.dhx4.isIE) {
|
|
this.edWin.focus();
|
|
var m = this;
|
|
window.setTimeout(function() {
|
|
m.edWin.focus();
|
|
m = null
|
|
}, 1)
|
|
}
|
|
};
|
|
this.applyBold = function() {
|
|
this._runCommand("Bold")
|
|
};
|
|
this.applyItalic = function() {
|
|
this._runCommand("Italic")
|
|
};
|
|
this.applyUnderscore = function() {
|
|
this._runCommand("Underline")
|
|
};
|
|
this.clearFormatting = function() {
|
|
this._runCommand("RemoveFormat")
|
|
};
|
|
this._doOnClick = function(o) {
|
|
var n = o || window.event;
|
|
var m = n.target || n.srcElement;
|
|
c._showInfo(m)
|
|
};
|
|
this._doOnMouseDown = function(o) {
|
|
var n = o || window.event;
|
|
var m = n.target || n.srcElement;
|
|
c._showInfo(m)
|
|
};
|
|
this._doOnKeyUp = function(q) {
|
|
var o = q || window.event;
|
|
var m = o.keyCode;
|
|
var n = o.target || o.srcElement;
|
|
if ({
|
|
37: 1,
|
|
38: 1,
|
|
39: 1,
|
|
40: 1,
|
|
13: 1
|
|
}[m] == 1) {
|
|
c._showInfo(n)
|
|
}
|
|
};
|
|
this._getParentByTag = function(m, o) {
|
|
o = o.toLowerCase();
|
|
var n = m;
|
|
do {
|
|
if (o == "" || n.nodeName.toLowerCase() == o) {
|
|
return n
|
|
}
|
|
} while (n = n.parentNode);
|
|
return m
|
|
};
|
|
this._isStyleProperty = function(o, r, m, q) {
|
|
r = r.toLowerCase();
|
|
var s = o;
|
|
do {
|
|
if ((s.nodeName.toLowerCase() == r) && (s.style[m] == q)) {
|
|
return true
|
|
}
|
|
} while (s = s.parentNode);
|
|
return false
|
|
};
|
|
this._setStyleProperty = function(m, q) {
|
|
this.style[q] = false;
|
|
var o = this._getParentByTag(m, q);
|
|
if (o && (o.tagName.toLowerCase() == q)) {
|
|
this.style[q] = true
|
|
}
|
|
if (q == "del" && this._getParentByTag(m, "strike") && this._getParentByTag(m, "strike").tagName.toLowerCase() == "strike") {
|
|
this.style.del = true
|
|
}
|
|
};
|
|
this._showInfo = function(n) {
|
|
var n = (this._getSelectionBounds().end) ? this._getSelectionBounds().end : n;
|
|
if (!n || !this._setStyleProperty) {
|
|
return
|
|
}
|
|
try {
|
|
if (this.edWin.getComputedStyle) {
|
|
var m = this.edWin.getComputedStyle(n, null);
|
|
var o = ((m.getPropertyValue("font-weight") == 401) ? 700 : m.getPropertyValue("font-weight"));
|
|
this.style = {
|
|
fontStyle: m.getPropertyValue("font-style"),
|
|
fontSize: m.getPropertyValue("font-size"),
|
|
textDecoration: m.getPropertyValue("text-decoration"),
|
|
fontWeight: o,
|
|
fontFamily: m.getPropertyValue("font-family"),
|
|
textAlign: m.getPropertyValue("text-align")
|
|
};
|
|
if (window.dhx4.isKHTML) {
|
|
this.style.fontStyle = m.getPropertyValue("font-style");
|
|
this.style.vAlign = m.getPropertyValue("vertical-align");
|
|
this.style.del = this._isStyleProperty(n, "span", "textDecoration", "line-through");
|
|
this.style.u = this._isStyleProperty(n, "span", "textDecoration", "underline")
|
|
}
|
|
} else {
|
|
var m = n.currentStyle;
|
|
this.style = {
|
|
fontStyle: m.fontStyle,
|
|
fontSize: m.fontSize,
|
|
textDecoration: m.textDecoration,
|
|
fontWeight: m.fontWeight,
|
|
fontFamily: m.fontFamily,
|
|
textAlign: m.textAlign
|
|
}
|
|
}
|
|
this._setStyleProperty(n, "h1");
|
|
this._setStyleProperty(n, "h2");
|
|
this._setStyleProperty(n, "h3");
|
|
this._setStyleProperty(n, "h4");
|
|
if (!window.dhx4.isKHTML) {
|
|
this._setStyleProperty(n, "del");
|
|
this._setStyleProperty(n, "sub");
|
|
this._setStyleProperty(n, "sup");
|
|
this._setStyleProperty(n, "u")
|
|
}
|
|
this.callEvent("onFocusChanged", [this.style, m])
|
|
} catch (q) {
|
|
return null
|
|
}
|
|
};
|
|
this._getSelectionBounds = function() {
|
|
var r, o, u, n;
|
|
if (this.edWin.getSelection) {
|
|
var s = this.edWin.getSelection();
|
|
r = s.getRangeAt(s.rangeCount - 1);
|
|
u = r.startContainer;
|
|
n = r.endContainer;
|
|
o = r.commonAncestorContainer;
|
|
if (u.nodeName == "#text") {
|
|
o = o.parentNode
|
|
}
|
|
if (u.nodeName == "#text") {
|
|
u = u.parentNode
|
|
}
|
|
if (u.nodeName.toLowerCase() == "body") {
|
|
u = u.firstChild
|
|
}
|
|
if (n.nodeName == "#text") {
|
|
n = n.parentNode
|
|
}
|
|
if (n.nodeName.toLowerCase() == "body") {
|
|
n = n.lastChild
|
|
}
|
|
if (u == n) {
|
|
o = u
|
|
}
|
|
return {
|
|
root: o,
|
|
start: u,
|
|
end: n
|
|
}
|
|
} else {
|
|
if (this.edWin.document.selection) {
|
|
r = this.edDoc.selection.createRange();
|
|
if (!r.duplicate) {
|
|
return null
|
|
}
|
|
o = r.parentElement();
|
|
var q = r.duplicate();
|
|
var m = r.duplicate();
|
|
q.collapse(true);
|
|
m.moveToElementText(q.parentElement());
|
|
m.setEndPoint("EndToStart", q);
|
|
u = q.parentElement();
|
|
q = r.duplicate();
|
|
m = r.duplicate();
|
|
m.collapse(false);
|
|
q.moveToElementText(m.parentElement());
|
|
q.setEndPoint("StartToEnd", m);
|
|
n = m.parentElement();
|
|
if (u.nodeName.toLowerCase() == "body") {
|
|
u = u.firstChild
|
|
}
|
|
if (n.nodeName.toLowerCase() == "body") {
|
|
n = n.lastChild
|
|
}
|
|
if (u == n) {
|
|
o = u
|
|
}
|
|
return {
|
|
root: o,
|
|
start: u,
|
|
end: n
|
|
}
|
|
}
|
|
}
|
|
return null
|
|
};
|
|
this.getContent = function() {
|
|
if (!this.edDoc.body) {
|
|
return ""
|
|
} else {
|
|
if (window.dhx4.isFF) {
|
|
return this.editor.contentWindow.document.body.innerHTML.replace(/<\/{0,}br\/{0,}>\s{0,}$/gi, "")
|
|
}
|
|
if (window.dhx4.isIE && this.edDoc.body.innerText.length == 0) {
|
|
return ""
|
|
}
|
|
return this.edDoc.body.innerHTML
|
|
}
|
|
};
|
|
this.setContent = function(o) {
|
|
o = o || "";
|
|
if (this.edDoc.body) {
|
|
var n = false;
|
|
if (window.dhx4.isFF) {
|
|
var m = navigator.userAgent.match(/Firefox\/(\d*)/);
|
|
n = (m != null && m[1] < 28)
|
|
}
|
|
if (n) {
|
|
if (typeof(this.conf.ffTest) == "undefined") {
|
|
this.editor.contentWindow.document.body.innerHTML = "";
|
|
this._runCommand("InsertHTML", "test");
|
|
this.conf.ffTest = (this.editor.contentWindow.document.body.innerHTML.length > 0)
|
|
}
|
|
if (this.conf.ffTest) {
|
|
this.editor.contentWindow.document.body.innerHTML = o
|
|
} else {
|
|
this.editor.contentWindow.document.body.innerHTML = "";
|
|
if (o.length == 0) {
|
|
o = " "
|
|
}
|
|
this._runCommand("InsertHTML", o)
|
|
}
|
|
} else {
|
|
this.editor.contentWindow.document.body.innerHTML = o
|
|
}
|
|
this.callEvent("onContentSet", [])
|
|
} else {
|
|
if (!this.conf.firstLoadEv) {
|
|
this.conf.firstLoadEv = true;
|
|
this.conf.firstLoadData = o;
|
|
this._onFirstLoad = function() {
|
|
c.setContent(c.conf.firstLoadData);
|
|
if (typeof(window.addEventListener) == "function") {
|
|
c.edWin.removeEventListener("load", c._onFirstLoad, false)
|
|
} else {
|
|
c.edWin.detachEvent("onload", c._onFirstLoad)
|
|
}
|
|
c.conf.firstLoadData = null;
|
|
c.conf.firstLoadEv = false;
|
|
c._onFirstLoad = null
|
|
};
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.edWin.addEventListener("load", this._onFirstLoad, false)
|
|
} else {
|
|
this.edWin.attachEvent("onload", this._onFirstLoad)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.setContentHTML = function(m) {
|
|
window.dhx4.ajax.get(m, function(n) {
|
|
if (n.xmlDoc.responseText != null) {
|
|
c.setContent(n.xmlDoc.responseText)
|
|
}
|
|
})
|
|
};
|
|
window.dhx4._eventable(this);
|
|
this.attachEvent("onFocusChanged", function(m) {
|
|
if (typeof(this._doOnFocusChanged) == "function") {
|
|
this._doOnFocusChanged(m)
|
|
} else {
|
|
if (typeof(this._doOnFocusChanged) == "string" && typeof(window[this._doOnFocusChanged]) == "function") {
|
|
window[this._doOnFocusChanged](m)
|
|
}
|
|
}
|
|
});
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.addEventListener("resize", this._doOnResize, false);
|
|
this.edDoc.addEventListener("click", this._doOnClick, false);
|
|
this.edDoc.addEventListener("keyup", this._doOnKeyUp, false);
|
|
if (window.dhx4.isOpera) {
|
|
this.edDoc.addEventListener("mousedown", this._doOnMouseDown, false)
|
|
}
|
|
} else {
|
|
window.attachEvent("onresize", this._doOnResize);
|
|
this.edDoc.attachEvent("onclick", this._doOnClick);
|
|
this.edDoc.attachEvent("onkeyup", this._doOnKeyUp)
|
|
}
|
|
this.unload = function() {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("resize", this._doOnResize, false);
|
|
this.edDoc.removeEventListener("click", this._doOnClick, false);
|
|
this.edDoc.removeEventListener("keyup", this._doOnKeyUp, false);
|
|
if (window.dhx4.isOpera) {
|
|
this.edDoc.removeEventListener("mousedown", this._doOnMouseDown, false)
|
|
}
|
|
for (var m = 0; m < c.conf.evs.length; m++) {
|
|
a.contentWindow.removeEventListener(c.conf.evs[m], c._ev, false)
|
|
}
|
|
} else {
|
|
window.detachEvent("onresize", this._doOnResize, false);
|
|
this.edDoc.detachEvent("onclick", this._doOnClick);
|
|
this.edDoc.detachEvent("onkeyup", this._doOnKeyUp);
|
|
for (var m = 0; m < c.conf.evs.length; m++) {
|
|
a.contentWindow.document.body.detachEvent("on" + c.conf.evs[m], c._ev)
|
|
}
|
|
}
|
|
this._doOnAccess = null;
|
|
this._doOnFocusChanged = null;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.editor.onload = null
|
|
} else {
|
|
this.editor.onreadystatechange = null
|
|
}
|
|
this.editor.parentNode.removeChild(this.editor);
|
|
this.editor = null;
|
|
this.edDoc = null;
|
|
this.edWin = null;
|
|
this.cell._unload();
|
|
this.cell = null;
|
|
this.tb = null;
|
|
window.dhx4._eventable(this, "clear");
|
|
this.cBlock.parentNode.removeChild(this.cBlock);
|
|
this.cBlock = null;
|
|
this.base.className = String(this.base.className).replace(new RegExp("\\s{0,}dhxeditor_" + this.conf.skin), "");
|
|
while (this.base.childNodes.length > 0) {
|
|
this.base.removeChild(this.base.childNodes[0])
|
|
}
|
|
this.base = null;
|
|
this._doOnClick = null;
|
|
this._doOnKeyUp = null;
|
|
this._doOnMouseDown = null;
|
|
this._ev = null;
|
|
this._focus = null;
|
|
this._prepareContent = null;
|
|
this._doOnResize = null;
|
|
this.setIconsPath = null;
|
|
this.init = null;
|
|
this.setSizes = null;
|
|
this._runCommand = null;
|
|
this.applyBold = null;
|
|
this.applyItalic = null;
|
|
this.applyUnderscore = null;
|
|
this.clearFormatting = null;
|
|
this._showInfo = null;
|
|
this._getSelectionBounds = null;
|
|
this.getContent = null;
|
|
this.setContent = null;
|
|
this.setContentHTML = null;
|
|
this.setReadonly = null;
|
|
this.isReadonly = null;
|
|
this.unload = null;
|
|
c = a = null
|
|
};
|
|
if (this.conf.toolbar == true && typeof(this.attachToolbar) == "function" && typeof(window.dhtmlXToolbarObject) == "function") {
|
|
this.attachToolbar(this.conf.iconsPath)
|
|
}
|
|
this.setIconsPath = function(m) {
|
|
this.conf.iconsPath = m
|
|
};
|
|
if (this.conf.content.length > 0) {
|
|
this.setContent(this.conf.content);
|
|
this.conf.content = ""
|
|
} else {
|
|
if (this.conf.contentHTML.length > 0) {
|
|
this.setContentHTML(this.conf.contentHTML);
|
|
this.conf.contentHTML = ""
|
|
}
|
|
}
|
|
return this
|
|
}
|
|
dhtmlXEditor.prototype.setSizes = function() {
|
|
this.cell._setSize(0, 0, this.base.clientWidth, this.base.clientHeight)
|
|
};
|
|
dhtmlXEditor.prototype.setReadonly = function(a) {
|
|
this.conf.roMode = (a === true);
|
|
this._prepareContent(true, this.conf.roMode);
|
|
this.cBlock.style.display = (this.conf.roMode ? "" : "none")
|
|
};
|
|
dhtmlXEditor.prototype.isReadonly = function(a) {
|
|
return (this.conf.roMode || false)
|
|
};
|
|
dhtmlXEditor.prototype.setSkin = function(a) {
|
|
this.base.className = String(this.base.className).replace(new RegExp("dhxeditor_" + this.conf.skin), "dhxeditor_" + a);
|
|
this.conf.skin = this.cell.conf.skin = a;
|
|
if (this.tb) {
|
|
this.cell.detachToolbar(a);
|
|
this.tb = null;
|
|
this.attachToolbar()
|
|
}
|
|
this.setSizes()
|
|
};
|
|
window.dhtmlXEditorCell = function(g, a) {
|
|
dhtmlXCellObject.apply(this, [g, "_editor"]);
|
|
var c = this;
|
|
this.editor = a;
|
|
this.conf.skin = this.editor.conf.skin;
|
|
this.attachEvent("_onCellUnload", function() {
|
|
this._stbUnload();
|
|
this.editor = null;
|
|
c = null
|
|
});
|
|
this._stbInit();
|
|
return this
|
|
};
|
|
dhtmlXEditorCell.prototype = new dhtmlXCellObject();
|
|
dhtmlXEditorCell.prototype._stbInit = function() {
|
|
var m = this;
|
|
var l = document.createElement("DIV");
|
|
l.className = "dhx_cell_stb";
|
|
this.cell.insertBefore(l, this.cell.childNodes[this.conf.idx.cont]);
|
|
l.onselectstart = function(a) {
|
|
a = a || event;
|
|
a.cancelBubble = true;
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
} else {
|
|
a.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
var h = {
|
|
bold: "applyBold",
|
|
italic: "applyItalic",
|
|
underline: "applyUnderscore",
|
|
clearformat: "clearFormatting"
|
|
};
|
|
for (var g in h) {
|
|
var c = document.createElement("A");
|
|
c.href = "javascript:void(0);";
|
|
c.tabIndex = -1;
|
|
l.appendChild(c);
|
|
c.onmousedown = c.onclick = function(a) {
|
|
a = a || event;
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
} else {
|
|
a.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
var n = document.createElement("DIV");
|
|
n.className = "dhx_cell_stb_button btn_" + g;
|
|
n._actv = g.charAt(0);
|
|
n._cmd = h[g];
|
|
c.appendChild(n);
|
|
n.onclick = function(a) {
|
|
a = a || event;
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
} else {
|
|
a.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
n.onmousedown = function(a) {
|
|
a = a || event;
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
} else {
|
|
a.returnValue = false
|
|
}
|
|
m.editor[this._cmd]();
|
|
m.editor.callEvent("onToolbarClick", [this._actv])
|
|
};
|
|
n = c = null
|
|
}
|
|
l = null;
|
|
this._stbUnload = function() {
|
|
var a = this.cell.childNodes[this.conf.idx.stb];
|
|
a.onselectstart = null;
|
|
while (a.childNodes.length > 0) {
|
|
a.lastChild.onmousedown = a.lastChild.onclick = null;
|
|
a.lastChild.firstChild.onmousedown = a.lastChild.firstChild.onclick = null;
|
|
a.lastChild.firstChild._actv = a.lastChild.firstChild._cmd = null;
|
|
a.lastChild.removeChild(a.lastChild.firstChild);
|
|
a.removeChild(a.lastChild)
|
|
}
|
|
a.parentNode.removeChild(a);
|
|
a = m = null;
|
|
this.conf.idx_data.stb = this.conf.ofs_nodes.t._getStbHeight = null;
|
|
delete this.conf.ofs_nodes.t._getStbHeight;
|
|
delete this.conf.idx_data.stb;
|
|
this._updateIdx()
|
|
};
|
|
this.conf.ofs_nodes.t._getStbHeight = "func";
|
|
this.conf.idx_data.stb = "dhx_cell_stb";
|
|
this._updateIdx()
|
|
};
|
|
dhtmlXEditorCell.prototype._stbHide = function() {
|
|
this.cell.childNodes[this.conf.idx.stb].style.display = "none"
|
|
};
|
|
dhtmlXEditorCell.prototype._getStbHeight = function() {
|
|
return this.cell.childNodes[this.conf.idx.stb].offsetHeight
|
|
};
|
|
dhtmlXEditor.prototype.attachToolbar = function(c) {
|
|
if (this.tb != null) {
|
|
return
|
|
}
|
|
if (c != null) {
|
|
this.conf.iconsPath = c
|
|
}
|
|
this.cell._stbHide();
|
|
this.tb = this.cell.attachToolbar({
|
|
icons_path: this.conf.iconsPath + "/dhxeditor_" + String(this.conf.skin).replace(/^dhx_/, "") + "/",
|
|
skin: this.conf.skin
|
|
});
|
|
this.setSizes();
|
|
this._availFonts = new Array("Arial", "Arial Narrow", "Comic Sans MS", "Courier", "Georgia", "Impact", "Tahoma", "Times New Roman", "Verdana");
|
|
this._initFont = this._availFonts[0];
|
|
this._xmlFonts = "";
|
|
for (var m = 0; m < this._availFonts.length; m++) {
|
|
var h = String(this._availFonts[m]).replace(/\s/g, "_");
|
|
this._xmlFonts += '<item type="button" id="applyFontFamily:' + h + '"><itemText><![CDATA[<img src="' + this.tb.imagePath + "font_" + String(h).toLowerCase() + '.gif" border="0" style="/*margin-top:1px;margin-bottom:1px;*/width:110px;height:16px;">]]></itemText></item>'
|
|
}
|
|
this._availSizes = {
|
|
"1": "8pt",
|
|
"2": "10pt",
|
|
"3": "12pt",
|
|
"4": "14pt",
|
|
"5": "18pt",
|
|
"6": "24pt",
|
|
"7": "36pt"
|
|
};
|
|
this._xmlSizes = "";
|
|
for (var g in this._availSizes) {
|
|
this._xmlSizes += '<item type="button" id="applyFontSize:' + g + ":" + this._availSizes[g] + '" text="' + this._availSizes[g] + '"/>'
|
|
}
|
|
this.tbXML = '<toolbar><item id="applyH1" type="buttonTwoState" img="h1.gif" imgdis="h4_dis.gif" title="H1"/><item id="applyH2" type="buttonTwoState" img="h2.gif" imgdis="h4_dis.gif" title="H2"/><item id="applyH3" type="buttonTwoState" img="h3.gif" imgdis="h4_dis.gif" title="H3"/><item id="applyH4" type="buttonTwoState" img="h4.gif" imgdis="h4_dis.gif" title="H4"/><item id="separ01" type="separator"/><item id="applyBold" type="buttonTwoState" img="bold.gif" imgdis="bold_dis.gif" title="Bold Text"/><item id="applyItalic" type="buttonTwoState" img="italic.gif" imgdis="italic_dis.gif" title="Italic Text"/><item id="applyUnderscore" type="buttonTwoState" img="underline.gif" imgdis="underline_dis.gif" title="Underscore Text"/><item id="applyStrikethrough" type="buttonTwoState" img="strike.gif" imgdis="strike_dis.gif" title="Strikethrough Text"/><item id="separ02" type="separator"/><item id="alignLeft" type="buttonTwoState" img="align_left.gif" imgdis="align_left_dis.gif" title="Left Alignment"/><item id="alignCenter" type="buttonTwoState" img="align_center.gif" imgdis="align_center_dis.gif" title="Center Alignment"/><item id="alignRight" type="buttonTwoState" img="align_right.gif" imgdis="align_right_dis.gif" title="Right Alignment"/><item id="alignJustify" type="buttonTwoState" img="align_justify.gif" title="Justified Alignment"/><item id="separ03" type="separator"/><item id="applySub" type="buttonTwoState" img="script_sub.gif" imgdis="script_sub.gif" title="Subscript"/><item id="applySuper" type="buttonTwoState" img="script_super.gif" imgdis="script_super_dis.gif" title="Superscript"/><item id="separ04" type="separator"/><item id="createNumList" type="button" img="list_number.gif" imgdis="list_number_dis.gif" title="Number List"/><item id="createBulList" type="button" img="list_bullet.gif" imgdis="list_bullet_dis.gif" title="Bullet List"/><item id="separ05" type="separator"/><item id="increaseIndent" type="button" img="indent_inc.gif" imgdis="indent_inc_dis.gif" title="Increase Indent"/><item id="decreaseIndent" type="button" img="indent_dec.gif" imgdis="indent_dec_dis.gif" title="Decrease Indent"/><item id="separ06" type="separator"/><item id="clearFormatting" type="button" img="clear.gif" title="Clear Formatting"/></toolbar>';
|
|
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", "<H1>")
|
|
};
|
|
this.applyH2 = function() {
|
|
this._runCommand("FormatBlock", "<H2>")
|
|
};
|
|
this.applyH3 = function() {
|
|
this._runCommand("FormatBlock", "<H3>")
|
|
};
|
|
this.applyH4 = function() {
|
|
this._runCommand("FormatBlock", "<H4>")
|
|
};
|
|
this.createNumList = function() {
|
|
this._runCommand("InsertOrderedList")
|
|
};
|
|
this.createBulList = function() {
|
|
this._runCommand("InsertUnorderedList")
|
|
};
|
|
this.increaseIndent = function() {
|
|
this._runCommand("Indent")
|
|
};
|
|
this.decreaseIndent = function() {
|
|
this._runCommand("Outdent")
|
|
};
|
|
this.clearFormatting = function() {
|
|
this._runCommand("RemoveFormat");
|
|
this.tb.setItemState("applyBold", false);
|
|
this.tb.setItemState("applyItalic", false);
|
|
this.tb.setItemState("applyStrikethrough", false);
|
|
this.tb.setItemState("applySub", false);
|
|
this.tb.setItemState("applySuper", false);
|
|
this.tb.setItemState("applyUnderscore", false)
|
|
}
|
|
};
|
|
dhtmlx.Group = {
|
|
_init: function() {
|
|
dhtmlx.assert(this.data, "DataStore required for grouping");
|
|
this.data.attachEvent("onStoreLoad", dhtmlx.bind(function() {
|
|
if (this._settings.group) {
|
|
this.group(this._settings.group, false)
|
|
}
|
|
}, this));
|
|
this.attachEvent("onBeforeRender", dhtmlx.bind(function(a) {
|
|
if (this._settings.sort) {
|
|
a.block();
|
|
a.sort(this._settings.sort);
|
|
a.unblock()
|
|
}
|
|
}, this));
|
|
this.attachEvent("onBeforeSort", dhtmlx.bind(function() {
|
|
this._settings.sort = null
|
|
}, this))
|
|
},
|
|
_init_group_data_event: function(c, a) {
|
|
c.attachEvent("onClearAll", dhtmlx.bind(function() {
|
|
this.ungroup(false);
|
|
this.block();
|
|
this.clearAll();
|
|
this.unblock()
|
|
}, a))
|
|
},
|
|
sum: function(c, a) {
|
|
c = dhtmlx.Template.setter(c);
|
|
a = a || this.data;
|
|
var g = 0;
|
|
a.each(function(h) {
|
|
g += c(h) * 1
|
|
});
|
|
return g
|
|
},
|
|
min: function(g, c) {
|
|
g = dhtmlx.Template.setter(g);
|
|
c = c || this.data;
|
|
var a = Infinity;
|
|
c.each(function(h) {
|
|
if (g(h) * 1 < a) {
|
|
a = g(h) * 1
|
|
}
|
|
});
|
|
return a * 1
|
|
},
|
|
max: function(g, c) {
|
|
g = dhtmlx.Template.setter(g);
|
|
c = c || this.data;
|
|
var a = -Infinity;
|
|
c.each(function(h) {
|
|
if (g(h) * 1 > a) {
|
|
a = g(h) * 1
|
|
}
|
|
});
|
|
return a
|
|
},
|
|
_split_data_by: function(l) {
|
|
var m = function(r, q) {
|
|
r = dhtmlx.Template.setter(r);
|
|
return r(q[0])
|
|
};
|
|
var h = dhtmlx.Template.setter(l.by);
|
|
if (!l.map[h]) {
|
|
l.map[h] = [h, m]
|
|
}
|
|
var a = {};
|
|
var o = [];
|
|
this.data.each(function(q) {
|
|
var r = h(q);
|
|
if (!a[r]) {
|
|
o.push({
|
|
id: r
|
|
});
|
|
a[r] = dhtmlx.toArray()
|
|
}
|
|
a[r].push(q)
|
|
});
|
|
for (var n in l.map) {
|
|
var c = (l.map[n][1] || m);
|
|
if (typeof c != "function") {
|
|
c = this[c]
|
|
}
|
|
for (var g = 0; g < o.length; g++) {
|
|
o[g][n] = c.call(this, l.map[n][0], a[o[g].id])
|
|
}
|
|
}
|
|
this._not_grouped_data = this.data;
|
|
this.data = new dhtmlx.DataStore();
|
|
this.data.provideApi(this, true);
|
|
this._init_group_data_event(this.data, this);
|
|
this.parse(o, "json")
|
|
},
|
|
group: function(a, c) {
|
|
this.ungroup(false);
|
|
this._split_data_by(a);
|
|
if (c !== false) {
|
|
this.render()
|
|
}
|
|
},
|
|
ungroup: function(a) {
|
|
if (this._not_grouped_data) {
|
|
this.data = this._not_grouped_data;
|
|
this.data.provideApi(this, true)
|
|
}
|
|
if (a !== false) {
|
|
this.render()
|
|
}
|
|
},
|
|
group_setter: function(a) {
|
|
dhtmlx.assert(typeof a == "object", "Incorrect group value");
|
|
dhtmlx.assert(a.by, "group.by is mandatory");
|
|
dhtmlx.assert(a.map, "group.map is mandatory");
|
|
return a
|
|
},
|
|
sort_setter: function(a) {
|
|
if (typeof a != "object") {
|
|
a = {
|
|
by: a
|
|
}
|
|
}
|
|
this._mergeSettings(a, {
|
|
as: "string",
|
|
dir: "asc"
|
|
});
|
|
return a
|
|
}
|
|
};
|
|
dhtmlx.Date = {
|
|
Locale: {
|
|
month_full: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
|
|
month_short: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
|
|
day_full: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
|
|
day_short: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"]
|
|
},
|
|
date_part: function(a) {
|
|
a.setHours(0);
|
|
a.setMinutes(0);
|
|
a.setSeconds(0);
|
|
a.setMilliseconds(0);
|
|
return a
|
|
},
|
|
time_part: function(a) {
|
|
return (a.valueOf() / 1000 - a.getTimezoneOffset() * 60) % 86400
|
|
},
|
|
week_start: function(c) {
|
|
var a = c.getDay();
|
|
if (this.config.start_on_monday) {
|
|
if (a === 0) {
|
|
a = 6
|
|
} else {
|
|
a--
|
|
}
|
|
}
|
|
return this.date_part(this.add(c, -1 * a, "day"))
|
|
},
|
|
month_start: function(a) {
|
|
a.setDate(1);
|
|
return this.date_part(a)
|
|
},
|
|
year_start: function(a) {
|
|
a.setMonth(0);
|
|
return this.month_start(a)
|
|
},
|
|
day_start: function(a) {
|
|
return this.date_part(a)
|
|
},
|
|
add: function(c, g, h) {
|
|
var a = new Date(c.valueOf());
|
|
switch (h) {
|
|
case "day":
|
|
a.setDate(a.getDate() + g);
|
|
break;
|
|
case "week":
|
|
a.setDate(a.getDate() + 7 * g);
|
|
break;
|
|
case "month":
|
|
a.setMonth(a.getMonth() + g);
|
|
break;
|
|
case "year":
|
|
a.setYear(a.getFullYear() + g);
|
|
break;
|
|
case "hour":
|
|
a.setHours(a.getHours() + g);
|
|
break;
|
|
case "minute":
|
|
a.setMinutes(a.getMinutes() + g);
|
|
break;
|
|
default:
|
|
return dhtmlx.Date["add_" + h](c, g, h)
|
|
}
|
|
return a
|
|
},
|
|
to_fixed: function(a) {
|
|
if (a < 10) {
|
|
return "0" + a
|
|
}
|
|
return a
|
|
},
|
|
copy: function(a) {
|
|
return new Date(a.valueOf())
|
|
},
|
|
date_to_str: function(c, a) {
|
|
c = c.replace(/%[a-zA-Z]/g, function(g) {
|
|
switch (g) {
|
|
case "%d":
|
|
return '"+dhtmlx.Date.to_fixed(date.getDate())+"';
|
|
case "%m":
|
|
return '"+dhtmlx.Date.to_fixed((date.getMonth()+1))+"';
|
|
case "%j":
|
|
return '"+date.getDate()+"';
|
|
case "%n":
|
|
return '"+(date.getMonth()+1)+"';
|
|
case "%y":
|
|
return '"+dhtmlx.Date.to_fixed(date.getFullYear()%100)+"';
|
|
case "%Y":
|
|
return '"+date.getFullYear()+"';
|
|
case "%D":
|
|
return '"+dhtmlx.Date.Locale.day_short[date.getDay()]+"';
|
|
case "%l":
|
|
return '"+dhtmlx.Date.Locale.day_full[date.getDay()]+"';
|
|
case "%M":
|
|
return '"+dhtmlx.Date.Locale.month_short[date.getMonth()]+"';
|
|
case "%F":
|
|
return '"+dhtmlx.Date.Locale.month_full[date.getMonth()]+"';
|
|
case "%h":
|
|
return '"+dhtmlx.Date.to_fixed((date.getHours()+11)%12+1)+"';
|
|
case "%g":
|
|
return '"+((date.getHours()+11)%12+1)+"';
|
|
case "%G":
|
|
return '"+date.getHours()+"';
|
|
case "%H":
|
|
return '"+dhtmlx.Date.to_fixed(date.getHours())+"';
|
|
case "%i":
|
|
return '"+dhtmlx.Date.to_fixed(date.getMinutes())+"';
|
|
case "%a":
|
|
return '"+(date.getHours()>11?"pm":"am")+"';
|
|
case "%A":
|
|
return '"+(date.getHours()>11?"PM":"AM")+"';
|
|
case "%s":
|
|
return '"+dhtmlx.Date.to_fixed(date.getSeconds())+"';
|
|
case "%W":
|
|
return '"+dhtmlx.Date.to_fixed(dhtmlx.Date.getISOWeek(date))+"';
|
|
default:
|
|
return g
|
|
}
|
|
});
|
|
if (a) {
|
|
c = c.replace(/date\.get/g, "date.getUTC")
|
|
}
|
|
return new Function("date", 'return "' + c + '";')
|
|
},
|
|
str_to_date: function(l, g) {
|
|
var m = "var temp=date.split(/[^0-9a-zA-Z]+/g);";
|
|
var a = l.match(/%[a-zA-Z]/g);
|
|
for (var c = 0; c < a.length; c++) {
|
|
switch (a[c]) {
|
|
case "%j":
|
|
case "%d":
|
|
m += "set[2]=temp[" + c + "]||1;";
|
|
break;
|
|
case "%n":
|
|
case "%m":
|
|
m += "set[1]=(temp[" + c + "]||1)-1;";
|
|
break;
|
|
case "%y":
|
|
m += "set[0]=temp[" + c + "]*1+(temp[" + c + "]>50?1900:2000);";
|
|
break;
|
|
case "%g":
|
|
case "%G":
|
|
case "%h":
|
|
case "%H":
|
|
m += "set[3]=temp[" + c + "]||0;";
|
|
break;
|
|
case "%i":
|
|
m += "set[4]=temp[" + c + "]||0;";
|
|
break;
|
|
case "%Y":
|
|
m += "set[0]=temp[" + c + "]||0;";
|
|
break;
|
|
case "%a":
|
|
case "%A":
|
|
m += "set[3]=set[3]%12+((temp[" + c + "]||'').toLowerCase()=='am'?0:12);";
|
|
break;
|
|
case "%s":
|
|
m += "set[5]=temp[" + c + "]||0;";
|
|
break
|
|
}
|
|
}
|
|
var h = "set[0],set[1],set[2],set[3],set[4],set[5]";
|
|
if (g) {
|
|
h = " Date.UTC(" + h + ")"
|
|
}
|
|
return new Function("date", "var set=[0,0,1,0,0,0]; " + m + " return new Date(" + h + ");")
|
|
},
|
|
getISOWeek: function(g) {
|
|
if (!g) {
|
|
return false
|
|
}
|
|
var c = g.getDay();
|
|
if (c === 0) {
|
|
c = 7
|
|
}
|
|
var h = new Date(g.valueOf());
|
|
h.setDate(g.getDate() + (4 - c));
|
|
var a = h.getFullYear();
|
|
var m = Math.floor((h.getTime() - new Date(a, 0, 1).getTime()) / 86400000);
|
|
var l = 1 + Math.floor(m / 7);
|
|
return l
|
|
},
|
|
getUTCISOWeek: function(a) {
|
|
return this.getISOWeek(a)
|
|
}
|
|
};
|
|
dhtmlx.math = {};
|
|
dhtmlx.math._toHex = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"];
|
|
dhtmlx.math.toHex = function(c, a) {
|
|
c = parseInt(c, 10);
|
|
str = "";
|
|
while (c > 0) {
|
|
str = this._toHex[c % 16] + str;
|
|
c = Math.floor(c / 16)
|
|
}
|
|
while (str.length < a) {
|
|
str = "0" + str
|
|
}
|
|
return str
|
|
};
|
|
dhtmlx.math.hexToDec = function(a) {
|
|
return parseInt(a, 16)
|
|
};
|
|
dhtmlx.math.toRgb = function(c) {
|
|
var l, h, a, m;
|
|
if (typeof(c) != "string") {
|
|
l = c[0];
|
|
h = c[1];
|
|
a = c[2]
|
|
} else {
|
|
if (c.indexOf("rgb") != -1) {
|
|
m = c.substr(c.indexOf("(") + 1, c.lastIndexOf(")") - c.indexOf("(") - 1).split(",");
|
|
l = m[0];
|
|
h = m[1];
|
|
a = m[2]
|
|
} else {
|
|
if (c.substr(0, 1) == "#") {
|
|
c = c.substr(1)
|
|
}
|
|
l = this.hexToDec(c.substr(0, 2));
|
|
h = this.hexToDec(c.substr(2, 2));
|
|
a = this.hexToDec(c.substr(4, 2))
|
|
}
|
|
}
|
|
l = (parseInt(l, 10) || 0);
|
|
h = (parseInt(h, 10) || 0);
|
|
a = (parseInt(a, 10) || 0);
|
|
if (l < 0 || l > 255) {
|
|
l = 0
|
|
}
|
|
if (h < 0 || h > 255) {
|
|
h = 0
|
|
}
|
|
if (a < 0 || a > 255) {
|
|
a = 0
|
|
}
|
|
return [l, h, a]
|
|
};
|
|
dhtmlx.math.hsvToRgb = function(n, A, x) {
|
|
var m, u, l, c, y, a, o, w;
|
|
m = Math.floor((n / 60)) % 6;
|
|
u = n / 60 - m;
|
|
l = x * (1 - A);
|
|
c = x * (1 - u * A);
|
|
y = x * (1 - (1 - u) * A);
|
|
a = 0;
|
|
o = 0;
|
|
w = 0;
|
|
switch (m) {
|
|
case 0:
|
|
a = x;
|
|
o = y;
|
|
w = l;
|
|
break;
|
|
case 1:
|
|
a = c;
|
|
o = x;
|
|
w = l;
|
|
break;
|
|
case 2:
|
|
a = l;
|
|
o = x;
|
|
w = y;
|
|
break;
|
|
case 3:
|
|
a = l;
|
|
o = c;
|
|
w = x;
|
|
break;
|
|
case 4:
|
|
a = y;
|
|
o = l;
|
|
w = x;
|
|
break;
|
|
case 5:
|
|
a = x;
|
|
o = l;
|
|
w = c;
|
|
break
|
|
}
|
|
a = Math.floor(a * 255);
|
|
o = Math.floor(o * 255);
|
|
w = Math.floor(w * 255);
|
|
return [a, o, w]
|
|
};
|
|
dhtmlx.math.rgbToHsv = function(c, o, q) {
|
|
var m, l, u, a, w, y, n, x;
|
|
m = c / 255;
|
|
l = o / 255;
|
|
u = q / 255;
|
|
var a = Math.min(m, l, u);
|
|
var w = Math.max(m, l, u);
|
|
n = 0;
|
|
y = w == 0 ? 0 : (1 - a / w);
|
|
x = w;
|
|
if (w == a) {
|
|
n = 0
|
|
} else {
|
|
if (w == m && l >= u) {
|
|
n = 60 * (l - u) / (w - a) + 0
|
|
} else {
|
|
if (w == m && l < u) {
|
|
n = 60 * (l - u) / (w - a) + 360
|
|
} else {
|
|
if (w == l) {
|
|
n = 60 * (u - m) / (w - a) + 120
|
|
} else {
|
|
if (w == u) {
|
|
n = 60 * (m - l) / (w - a) + 240
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return [n, y, x]
|
|
};
|
|
if (!dhtmlx.presets) {
|
|
dhtmlx.presets = {}
|
|
}
|
|
dhtmlx.presets.chart = {
|
|
simple: {
|
|
item: {
|
|
borderColor: "#ffffff",
|
|
color: "#2b7100",
|
|
shadow: false,
|
|
borderWidth: 2
|
|
},
|
|
line: {
|
|
color: "#8ecf03",
|
|
width: 2
|
|
}
|
|
},
|
|
plot: {
|
|
color: "#1293f8",
|
|
item: {
|
|
borderColor: "#636363",
|
|
borderWidth: 1,
|
|
color: "#ffffff",
|
|
type: "r",
|
|
shadow: false
|
|
},
|
|
line: {
|
|
color: "#1293f8",
|
|
width: 2
|
|
}
|
|
},
|
|
diamond: {
|
|
color: "#b64040",
|
|
item: {
|
|
borderColor: "#b64040",
|
|
color: "#b64040",
|
|
type: "d",
|
|
radius: 3,
|
|
shadow: true
|
|
},
|
|
line: {
|
|
color: "#ff9000",
|
|
width: 2
|
|
}
|
|
},
|
|
point: {
|
|
color: "#fe5916",
|
|
disableLines: true,
|
|
fill: false,
|
|
disableItems: false,
|
|
item: {
|
|
color: "#feb916",
|
|
borderColor: "#fe5916",
|
|
radius: 2,
|
|
borderWidth: 1,
|
|
type: "r"
|
|
},
|
|
alpha: 1
|
|
},
|
|
line: {
|
|
line: {
|
|
color: "#3399ff",
|
|
width: 2
|
|
},
|
|
item: {
|
|
color: "#ffffff",
|
|
borderColor: "#3399ff",
|
|
radius: 2,
|
|
borderWidth: 2,
|
|
type: "d"
|
|
},
|
|
fill: false,
|
|
disableItems: false,
|
|
disableLines: false,
|
|
alpha: 1
|
|
},
|
|
area: {
|
|
fill: "#3399ff",
|
|
line: {
|
|
color: "#3399ff",
|
|
width: 1
|
|
},
|
|
disableItems: true,
|
|
alpha: 0.2,
|
|
disableLines: false
|
|
},
|
|
round: {
|
|
item: {
|
|
radius: 3,
|
|
borderColor: "#3f83ff",
|
|
borderWidth: 1,
|
|
color: "#3f83ff",
|
|
type: "r",
|
|
shadow: false,
|
|
alpha: 0.6
|
|
}
|
|
},
|
|
square: {
|
|
item: {
|
|
radius: 3,
|
|
borderColor: "#447900",
|
|
borderWidth: 2,
|
|
color: "#69ba00",
|
|
type: "s",
|
|
shadow: false,
|
|
alpha: 1
|
|
}
|
|
},
|
|
column: {
|
|
color: "RAINBOW",
|
|
gradient: false,
|
|
width: 45,
|
|
radius: 0,
|
|
alpha: 1,
|
|
border: true
|
|
},
|
|
stick: {
|
|
width: 5,
|
|
gradient: false,
|
|
color: "#67b5c9",
|
|
radius: 2,
|
|
alpha: 1,
|
|
border: false
|
|
},
|
|
alpha: {
|
|
color: "#b9a8f9",
|
|
width: 70,
|
|
gradient: "falling",
|
|
radius: 0,
|
|
alpha: 0.5,
|
|
border: true
|
|
}
|
|
};
|
|
dhtmlx.ui.Map = function(a) {
|
|
this.name = "Map";
|
|
this._id = "map_" + dhtmlx.uid();
|
|
this._key = a;
|
|
this._map = []
|
|
};
|
|
dhtmlx.ui.Map.prototype = {
|
|
addRect: function(g, c, a) {
|
|
this._createMapArea(g, "RECT", c, a)
|
|
},
|
|
addPoly: function(g, c, a) {
|
|
this._createMapArea(g, "POLY", c, a)
|
|
},
|
|
_createMapArea: function(l, c, h, g) {
|
|
var a = "";
|
|
if (arguments.length == 4) {
|
|
a = "userdata='" + g + "'"
|
|
}
|
|
this._map.push("<area " + this._key + "='" + l + "' shape='" + c + "' coords='" + h.join() + "' " + a + "></area>")
|
|
},
|
|
addSector: function(a, r, q, n, l, g, h, m) {
|
|
var o = [];
|
|
o.push(n);
|
|
o.push(Math.floor(l * h));
|
|
for (var c = r; c < q; c += Math.PI / 18) {
|
|
o.push(Math.floor(n + g * Math.cos(c)));
|
|
o.push(Math.floor((l + g * Math.sin(c)) * h))
|
|
}
|
|
o.push(Math.floor(n + g * Math.cos(q)));
|
|
o.push(Math.floor((l + g * Math.sin(q)) * h));
|
|
o.push(n);
|
|
o.push(Math.floor(l * h));
|
|
return this.addPoly(a, o, m)
|
|
},
|
|
render: function(a) {
|
|
var g = dhtmlx.html.create("DIV");
|
|
g.style.cssText = "position:absolute; width:100%; height:100%; top:0px; left:0px;";
|
|
a.appendChild(g);
|
|
var c = dhtmlx._isIE ? "" : "src='data:image/gif;base64,R0lGODlhEgASAIAAAP///////yH5BAUUAAEALAAAAAASABIAAAIPjI+py+0Po5y02ouz3pwXADs='";
|
|
g.innerHTML = "<map id='" + this._id + "' name='" + this._id + "'>" + this._map.join("\n") + "</map><img " + c + " class='dhx_map_img' usemap='#" + this._id + "'>";
|
|
a._htmlmap = g;
|
|
this._map = []
|
|
}
|
|
};
|
|
dhtmlx.chart = {};
|
|
dhtmlx.chart.scatter = {
|
|
pvt_render_scatter: function(r, m, q, o, n, a) {
|
|
if (!this._settings.xValue) {
|
|
return dhtmlx.log("warning", "Undefined propery: xValue")
|
|
}
|
|
var g = this._getLimits();
|
|
var l = this._getLimits("h", "xValue");
|
|
if (!n) {
|
|
if (!this.canvases.x) {
|
|
this.canvases.x = new dhtmlx.ui.Canvas(this._obj, "axis_x")
|
|
}
|
|
if (!this.canvases.y) {
|
|
this.canvases.y = new dhtmlx.ui.Canvas(this._obj, "axis_y")
|
|
}
|
|
this._drawYAxis(this.canvases.y.getCanvas(), m, q, o, g.min, g.max);
|
|
this._drawHXAxis(this.canvases.x.getCanvas(), m, q, o, l.min, l.max)
|
|
}
|
|
g = {
|
|
min: this._settings.yAxis.start,
|
|
max: this._settings.yAxis.end
|
|
};
|
|
l = {
|
|
min: this._settings.xAxis.start,
|
|
max: this._settings.xAxis.end
|
|
};
|
|
var c = this._getScatterParams(r, m, q, o, l, g);
|
|
this._mapStart = q;
|
|
for (var h = 0; h < m.length; h++) {
|
|
this._drawScatterItem(r, a, q, o, c, l, g, m[h], n)
|
|
}
|
|
},
|
|
_getScatterParams: function(a, h, g, c, n, m) {
|
|
var l = {};
|
|
l.totalHeight = c.y - g.y;
|
|
l.totalWidth = c.x - g.x;
|
|
this._calcScatterUnit(l, n.min, n.max, l.totalWidth, "X");
|
|
this._calcScatterUnit(l, m.min, m.max, l.totalHeight, "Y");
|
|
return l
|
|
},
|
|
_drawScatterItem: function(s, a, q, o, g, l, h, m, n) {
|
|
var c = this._calculateScatterItemPosition(g, o, q, l, m, "X");
|
|
var r = this._calculateScatterItemPosition(g, q, o, h, m, "Y");
|
|
this._drawItem(s, c, r, m, this._settings.label.call(this, m), n, a)
|
|
},
|
|
_calculateScatterItemPosition: function(g, o, n, a, l, c) {
|
|
var r = this._settings[c == "X" ? "xValue" : "value"].call(this, l);
|
|
var h = g["valueFactor" + c];
|
|
var s = (parseFloat(r || 0) - a.min) * h;
|
|
var q = g["unit" + c];
|
|
var m = n[c.toLowerCase()] - (c == "X" ? (-1) : 1) * Math.floor(q * s);
|
|
if (s < 0) {
|
|
m = n[c.toLowerCase()]
|
|
}
|
|
if (r > a.max) {
|
|
m = o[c.toLowerCase()]
|
|
}
|
|
if (r < a.min) {
|
|
m = n[c.toLowerCase()]
|
|
}
|
|
return m
|
|
},
|
|
_calcScatterUnit: function(m, g, a, c, h) {
|
|
var l = this._getRelativeValue(g, a);
|
|
h = (h || "");
|
|
m["relValue" + h] = l[0];
|
|
m["valueFactor" + h] = l[1];
|
|
m["unit" + h] = (m["relValue" + h] ? c / m["relValue" + h] : 10)
|
|
}
|
|
};
|
|
dhtmlx.chart.radar = {
|
|
pvt_render_radar: function(c, h, a, m, g, l) {
|
|
this._renderRadarChart(c, h, a, m, g, l)
|
|
},
|
|
_renderRadarChart: function(v, l, s, r, q, a) {
|
|
if (!l.length) {
|
|
return
|
|
}
|
|
var n = this._getPieParameters(s, r);
|
|
var o = (this._settings.radius ? this._settings.radius : n.radius);
|
|
var c = (this._settings.x ? this._settings.x : n.x);
|
|
var u = (this._settings.y ? this._settings.y : n.y);
|
|
var g = [];
|
|
for (var h = 0; h < l.length; h++) {
|
|
g.push(1)
|
|
}
|
|
var m = this._getRatios(g, l.length);
|
|
this._mapStart = s;
|
|
if (!q) {
|
|
this._drawRadarAxises(m, c, u, o, l)
|
|
}
|
|
this._drawRadarData(v, m, c, u, o, l, q, a)
|
|
},
|
|
_drawRadarData: function(D, u, o, n, l, O, E, N) {
|
|
var C, w, M, K, F, J, h, g, H, L, I, v, c, A, r, q, a, s, m;
|
|
M = this._settings;
|
|
F = M.yAxis.start;
|
|
J = M.yAxis.end;
|
|
m = this._getRelativeValue(F, J);
|
|
v = m[0];
|
|
s = (v ? l / v : l / 2);
|
|
a = m[1];
|
|
c = -Math.PI / 2;
|
|
C = w = c;
|
|
H = [];
|
|
g = 0;
|
|
for (K = 0; K < O.length; K++) {
|
|
if (!q) {
|
|
A = M.value(O[K]);
|
|
r = (parseFloat(A || 0) - F) * a
|
|
} else {
|
|
r = q
|
|
}
|
|
L = Math.floor(s * r);
|
|
A = M.value((K != (O.length - 1)) ? O[K + 1] : O[0]);
|
|
q = (parseFloat(A || 0) - F) * a;
|
|
I = Math.floor(s * q);
|
|
C = w;
|
|
w = ((K != (O.length - 1)) ? (c + u[K] - 0.0001) : c);
|
|
h = (g || this._getPositionByAngle(C, o, n, L));
|
|
g = this._getPositionByAngle(w, o, n, I);
|
|
H.push(h)
|
|
}
|
|
if (M.fill) {
|
|
this._fillRadarChart(D, H, O)
|
|
}
|
|
if (!M.disableLines) {
|
|
this._strokeRadarChart(D, H, O)
|
|
}
|
|
if (!M.disableItems) {
|
|
this._drawRadarItemMarkers(D, H, O, E, N)
|
|
}
|
|
H = null
|
|
},
|
|
_drawRadarItemMarkers: function(a, g, l, h, m) {
|
|
for (var c = 0; c < g.length; c++) {
|
|
this._drawItem(a, g[c].x, g[c].y, l[c], this._settings.label.call(this, l), h, m)
|
|
}
|
|
},
|
|
_fillRadarChart: function(a, h, m) {
|
|
var l, g;
|
|
a.globalAlpha = this._settings.alpha.call(this, {});
|
|
a.beginPath();
|
|
for (var c = 0; c < h.length; c++) {
|
|
a.fillStyle = this._settings.fill.call(this, m[c]);
|
|
l = h[c];
|
|
g = (h[c + 1] || h[0]);
|
|
if (!c) {
|
|
a.moveTo(l.x, l.y)
|
|
}
|
|
a.lineTo(g.x, g.y)
|
|
}
|
|
a.fill();
|
|
a.globalAlpha = 1
|
|
},
|
|
_strokeRadarChart: function(a, h, m) {
|
|
var l, g;
|
|
for (var c = 0; c < h.length; c++) {
|
|
l = h[c];
|
|
g = (h[c + 1] || h[0]);
|
|
this._drawLine(a, l.x, l.y, g.x, g.y, this._settings.line.color.call(this, m[c]), this._settings.line.width)
|
|
}
|
|
},
|
|
_drawRadarAxises: function(C, w, v, n, P) {
|
|
var a = this._settings.yAxis;
|
|
var h = this._settings.xAxis;
|
|
var o = a.start;
|
|
var m = a.end;
|
|
var r = a.step;
|
|
var D = {};
|
|
var O = this._configYAxis;
|
|
if (typeof O.step == "undefined" || typeof O.start == "undefined" || typeof O.end == "undefined") {
|
|
var s = this._getLimits();
|
|
D = this._calculateScale(s.min, s.max);
|
|
o = D.start;
|
|
m = D.end;
|
|
r = D.step;
|
|
a.end = m;
|
|
a.start = o
|
|
}
|
|
var J = [];
|
|
var M, L, E;
|
|
var N = 0;
|
|
var g = n * r / (m - o);
|
|
var u, A;
|
|
if (r < 1) {
|
|
u = Math.min(this._log10(r), (o <= 0 ? 0 : this._log10(o)));
|
|
A = Math.pow(10, -u)
|
|
}
|
|
var K = [];
|
|
if (!this.canvases.scale) {
|
|
this.canvases.scale = new dhtmlx.ui.Canvas(this._obj, "radar_scale")
|
|
}
|
|
var I = this.canvases.scale.getCanvas();
|
|
for (M = m; M >= o; M -= r) {
|
|
if (D.fixNum) {
|
|
M = parseFloat((new Number(M)).toFixed(D.fixNum))
|
|
}
|
|
J.push(Math.floor(N * g) + 0.5);
|
|
if (A) {
|
|
M = Math.round(M * A) / A
|
|
}
|
|
var q = v - n + J[J.length - 1];
|
|
this.canvases.scale.renderTextAt("middle", "left", w, q, a.template(M.toString()), "dhx_axis_item_y dhx_radar");
|
|
if (C.length < 2) {
|
|
this._drawScaleSector(I, "arc", w, v, n - J[J.length - 1], -Math.PI / 2, 3 * Math.PI / 2, M);
|
|
return
|
|
}
|
|
var l = -Math.PI / 2;
|
|
var H = l;
|
|
var F;
|
|
for (L = 0; L < C.length; L++) {
|
|
if (M == m) {
|
|
K.push(H)
|
|
}
|
|
F = l + C[L] - 0.0001;
|
|
this._drawScaleSector(I, (O.lineShape || "line"), w, v, n - J[J.length - 1], H, F, M, L, P[M]);
|
|
H = F
|
|
}
|
|
N++
|
|
}
|
|
for (M = 0; M < K.length; M++) {
|
|
E = this._getPositionByAngle(K[M], w, v, n);
|
|
if (h.lines.call(this, P[M], M)) {
|
|
this._drawLine(I, w, v, E.x, E.y, (h ? h.lineColor.call(this, P[M]) : "#cfcfcf"), 1)
|
|
}
|
|
this._drawRadarScaleLabel(I, w, v, n, K[M], (h ? h.template.call(this, P[M]) : " "))
|
|
}
|
|
},
|
|
_drawScaleSector: function(u, m, s, q, l, c, a, h, g) {
|
|
var r, o;
|
|
if (l < 0) {
|
|
return false
|
|
}
|
|
r = this._getPositionByAngle(c, s, q, l);
|
|
o = this._getPositionByAngle(a, s, q, l);
|
|
var n = this._settings.yAxis;
|
|
if (n.bg) {
|
|
u.beginPath();
|
|
u.moveTo(s, q);
|
|
if (m == "arc") {
|
|
u.arc(s, q, l, c, a, false)
|
|
} else {
|
|
u.lineTo(r.x, r.y);
|
|
u.lineTo(o.x, o.y)
|
|
}
|
|
u.fillStyle = n.bg(h, g);
|
|
u.moveTo(s, q);
|
|
u.fill();
|
|
u.closePath()
|
|
}
|
|
if (n.lines.call(this, h)) {
|
|
u.lineWidth = 1;
|
|
u.beginPath();
|
|
if (m == "arc") {
|
|
u.arc(s, q, l, c, a, false)
|
|
} else {
|
|
u.moveTo(r.x, r.y);
|
|
u.lineTo(o.x, o.y)
|
|
}
|
|
u.strokeStyle = n.lineColor.call(this, h);
|
|
u.stroke()
|
|
}
|
|
},
|
|
_drawRadarScaleLabel: function(A, q, n, c, o, v) {
|
|
var w = this.canvases.scale.renderText(0, 0, v, "dhx_axis_radar_title", 1);
|
|
var g = w.scrollWidth;
|
|
var u = w.offsetHeight;
|
|
var s = 0.001;
|
|
var m = this._getPositionByAngle(o, q, n, c + 5);
|
|
var l = 0,
|
|
h = 0;
|
|
if (o < 0 || o > Math.PI) {
|
|
h = -u
|
|
}
|
|
if (o > Math.PI / 2) {
|
|
l = -g
|
|
}
|
|
if (Math.abs(o + Math.PI / 2) < s || Math.abs(o - Math.PI / 2) < s) {
|
|
l = -g / 2
|
|
} else {
|
|
if (Math.abs(o) < s || Math.abs(o - Math.PI) < s) {
|
|
h = -u / 2
|
|
}
|
|
}
|
|
w.style.top = m.y + h + "px";
|
|
w.style.left = m.x + l + "px";
|
|
w.style.width = g + "px";
|
|
w.style.whiteSpace = "nowrap"
|
|
}
|
|
};
|
|
dhtmlx.chart.area = {
|
|
pvt_render_area: function(o, F, l, h, q, C) {
|
|
var s, A, u, r, m, y, n, E, D, x, w, c, v, a, g;
|
|
y = this._calculateLineParams(o, F, l, h, q);
|
|
A = this._settings;
|
|
r = (A.eventRadius || Math.floor(y.cellWidth / 2));
|
|
if (F.length) {
|
|
n = [];
|
|
x = (!A.offset ? l.x : l.x + y.cellWidth * 0.5);
|
|
for (u = 0; u < F.length; u++) {
|
|
m = F[u];
|
|
D = this._getPointY(m, l, h, y);
|
|
v = x + y.cellWidth * u;
|
|
if (D) {
|
|
a = (typeof D == "object" ? D.y0 : D);
|
|
if (u && this._settings.fixOverflow) {
|
|
E = this._getPointY(F[u - 1], l, h, y);
|
|
if (E.out && E.out == D.out) {
|
|
continue
|
|
}
|
|
w = y.cellWidth * (u - 1) - 0.5 + x;
|
|
c = (typeof E == "object" ? E.y0 : E);
|
|
if (E.out) {
|
|
g = (E.out == "min" ? h.y : l.y);
|
|
n.push([this._calcOverflowX(w, v, c, a, g), g])
|
|
}
|
|
if (D.out) {
|
|
g = (D.out == "min" ? h.y : l.y);
|
|
n.push([this._calcOverflowX(w, v, c, a, g), g]);
|
|
if (u == (F.length - 1) && g == l.y) {
|
|
n.push([v, l.y])
|
|
}
|
|
}
|
|
}
|
|
if (!D.out) {
|
|
n.push([v, a]);
|
|
C.addRect(m.id, [v - r - l.x, a - r - l.y, v + r - l.x, a + r - l.y], q)
|
|
}
|
|
if (!A.yAxis) {
|
|
s = (!A.offset && (u == F.length - 1) ? "left" : "center");
|
|
this.canvases[q].renderTextAt(false, s, v, a - A.labelOffset, A.label(m))
|
|
}
|
|
}
|
|
}
|
|
if (n.length) {
|
|
n.push([v, h.y]);
|
|
n.push([n[0][0], h.y])
|
|
}
|
|
o.globalAlpha = this._settings.alpha.call(this, F[0]);
|
|
o.fillStyle = this._settings.color.call(this, F[0]);
|
|
o.beginPath();
|
|
this._path(o, n);
|
|
o.fill();
|
|
if (A.border) {
|
|
o.lineWidth = A.borderWidth || 1;
|
|
if (A.borderColor) {
|
|
o.strokeStyle = A.borderColor.call(this, F[0])
|
|
} else {
|
|
this._setBorderStyles(o, o.fillStyle)
|
|
}
|
|
o.beginPath();
|
|
this._path(o, n);
|
|
o.stroke()
|
|
}
|
|
o.lineWidth = 1;
|
|
o.globalAlpha = 1
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.chart.stackedArea = {
|
|
pvt_render_stackedArea: function(q, H, c, a, r, E) {
|
|
var J, I, v, D, A, w, l, u, m, C, o, h, g, n;
|
|
C = this._calculateLineParams(q, H, c, a, r);
|
|
D = this._settings;
|
|
u = (D.eventRadius || Math.floor(C.cellWidth / 2));
|
|
if (H.length) {
|
|
o = [];
|
|
n = [];
|
|
h = (!D.offset ? c.x : c.x + C.cellWidth * 0.5);
|
|
var F = function(x, K) {
|
|
return r ? (H[x].$startY ? K - a.y + H[x].$startY : 0) : K
|
|
};
|
|
var s = function(y, M, L) {
|
|
var K = (L.y - M.y) / (L.x - M.x);
|
|
return K * y + M.y - K * M.x
|
|
};
|
|
for (A = 0; A < H.length; A++) {
|
|
m = H[A];
|
|
if (!A) {
|
|
g = F(A, a.y);
|
|
o.push([h, g])
|
|
} else {
|
|
h += C.cellWidth
|
|
}
|
|
g = F(A, this._getPointY(m, c, a, C));
|
|
n.push((isNaN(g) && !A) ? (H[A].$startY || a.y) : g);
|
|
if (g) {
|
|
o.push([h, g]);
|
|
E.addRect(m.id, [h - u - c.x, g - u - c.y, h + u - c.x, g + u - c.y], r);
|
|
if (!D.yAxis) {
|
|
v = (!D.offset && l ? "left" : "center");
|
|
this.canvases[r].renderTextAt(false, v, h, g - D.labelOffset, D.label(m))
|
|
}
|
|
}
|
|
}
|
|
o.push([h, F(A - 1, a.y)]);
|
|
if (r) {
|
|
for (A = H.length - 2; A > 0; A--) {
|
|
h -= C.cellWidth;
|
|
g = H[A].$startY;
|
|
if (g) {
|
|
o.push([h, g])
|
|
}
|
|
}
|
|
}
|
|
o.push([o[0][0], o[0][1]]);
|
|
q.globalAlpha = this._settings.alpha.call(this, H[0]);
|
|
q.fillStyle = this._settings.color.call(this, H[0]);
|
|
q.beginPath();
|
|
this._path(q, o);
|
|
q.fill();
|
|
for (A = 0; A < H.length; A++) {
|
|
g = n[A];
|
|
if (!g) {
|
|
if (A == H.length - 1) {
|
|
g = H[A].$startY
|
|
}
|
|
for (w = A + 1; w < H.length; w++) {
|
|
if (n[w]) {
|
|
J = {
|
|
x: c.x,
|
|
y: n[0]
|
|
};
|
|
I = {
|
|
x: (c.x + C.cellWidth * w),
|
|
y: n[w]
|
|
};
|
|
g = s(c.x + C.cellWidth * A, J, I);
|
|
break
|
|
}
|
|
}
|
|
}
|
|
H[A].$startY = g
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.chart.spline = {
|
|
pvt_render_spline: function(q, I, h, g, r, H) {
|
|
var F, u, o, s, E, n, m, A, w, v, l, c, a;
|
|
E = this._calculateLineParams(q, I, h, g, r);
|
|
F = this._settings;
|
|
this._mapStart = h;
|
|
o = [];
|
|
if (I.length) {
|
|
A = (F.offset ? h.x + E.cellWidth * 0.5 : h.x);
|
|
for (u = 0; u < I.length; u++) {
|
|
l = this._getPointY(I[u], h, g, E);
|
|
if (l) {
|
|
m = ((!u) ? A : E.cellWidth * u - 0.5 + A);
|
|
o.push({
|
|
x: m,
|
|
y: l,
|
|
index: u
|
|
})
|
|
}
|
|
}
|
|
n = this._getSplineParameters(o);
|
|
for (u = 0; u < o.length; u++) {
|
|
w = o[u].x;
|
|
c = o[u].y;
|
|
if (u < o.length - 1) {
|
|
v = o[u + 1].x;
|
|
a = o[u + 1].y;
|
|
for (s = w; s < v; s++) {
|
|
var D = this._getSplineYPoint(s, w, u, n.a, n.b, n.c, n.d);
|
|
if (D < h.y) {
|
|
D = h.y
|
|
}
|
|
if (D > g.y) {
|
|
D = g.y
|
|
}
|
|
var C = this._getSplineYPoint(s + 1, w, u, n.a, n.b, n.c, n.d);
|
|
if (C < h.y) {
|
|
C = h.y
|
|
}
|
|
if (C > g.y) {
|
|
C = g.y
|
|
}
|
|
this._drawLine(q, s, D, s + 1, C, F.line.color(I[u]), F.line.width)
|
|
}
|
|
this._drawLine(q, v - 1, this._getSplineYPoint(s, w, u, n.a, n.b, n.c, n.d), v, a, F.line.color(I[u]), F.line.width)
|
|
}
|
|
this._drawItem(q, w, c, I[o[u].index], F.label(I[o[u].index]), r, H)
|
|
}
|
|
}
|
|
},
|
|
_getSplineParameters: function(A) {
|
|
var o, D, C, E, y, x, w, r, q = [],
|
|
l = [],
|
|
g = A.length;
|
|
for (o = 0; o < g - 1; o++) {
|
|
q[o] = A[o + 1].x - A[o].x;
|
|
l[o] = (A[o + 1].y - A[o].y) / q[o]
|
|
}
|
|
D = [];
|
|
C = [];
|
|
D[0] = 0;
|
|
D[1] = 2 * (q[0] + q[1]);
|
|
C[0] = 0;
|
|
C[1] = 6 * (l[1] - l[0]);
|
|
for (o = 2; o < g - 1; o++) {
|
|
D[o] = 2 * (q[o - 1] + q[o]) - q[o - 1] * q[o - 1] / D[o - 1];
|
|
C[o] = 6 * (l[o] - l[o - 1]) - q[o - 1] * C[o - 1] / D[o - 1]
|
|
}
|
|
E = [];
|
|
E[g - 1] = E[0] = 0;
|
|
for (o = g - 2; o >= 1; o--) {
|
|
E[o] = (C[o] - q[o] * E[o + 1]) / D[o]
|
|
}
|
|
y = [];
|
|
x = [];
|
|
w = [];
|
|
r = [];
|
|
for (o = 0; o < g - 1; o++) {
|
|
y[o] = A[o].y;
|
|
x[o] = -q[o] * E[o + 1] / 6 - q[o] * E[o] / 3 + (A[o + 1].y - A[o].y) / q[o];
|
|
w[o] = E[o] / 2;
|
|
r[o] = (E[o + 1] - E[o]) / (6 * q[o])
|
|
}
|
|
return {
|
|
a: y,
|
|
b: x,
|
|
c: w,
|
|
d: r
|
|
}
|
|
},
|
|
_getSplineYPoint: function(h, m, n, l, g, q, o) {
|
|
return l[n] + (h - m) * (g[n] + (h - m) * (q[n] + (h - m) * o[n]))
|
|
}
|
|
};
|
|
dhtmlx.chart.barH = {
|
|
pvt_render_barH: function(A, N, m, l, C, M) {
|
|
var r, u, E, D, a, H, o, K, v, L, c, x, n, I, w, h, y, s, J, g, q;
|
|
E = (l.y - m.y) / N.length;
|
|
o = this._getLimits("h");
|
|
K = o.max;
|
|
v = o.min;
|
|
h = l.x - m.x;
|
|
q = !! this._settings.yAxis;
|
|
if (!C) {
|
|
this._drawHScales(A, N, m, l, v, K, E)
|
|
}
|
|
if (q) {
|
|
K = parseFloat(this._settings.xAxis.end);
|
|
v = parseFloat(this._settings.xAxis.start)
|
|
}
|
|
I = this._getRelativeValue(v, K);
|
|
x = I[0];
|
|
c = I[1];
|
|
s = (x ? h / x : 10);
|
|
if (!q) {
|
|
w = 10;
|
|
s = (x ? (h - w) / x : 10)
|
|
}
|
|
u = parseInt(this._settings.width, 10);
|
|
if ((u * this._series.length + 4) > E) {
|
|
u = E / this._series.length - 4
|
|
}
|
|
r = Math.floor((E - u * this._series.length) / 2);
|
|
n = (typeof this._settings.radius != "undefined" ? parseInt(this._settings.radius, 10) : Math.round(u / 5));
|
|
L = false;
|
|
a = this._settings.gradient;
|
|
if (a && typeof(a) != "function") {
|
|
L = a;
|
|
a = false
|
|
} else {
|
|
if (a) {
|
|
a = A.createLinearGradient(m.x, m.y, l.x, m.y);
|
|
this._settings.gradient(a)
|
|
}
|
|
} if (!q) {
|
|
this._drawLine(A, m.x - 0.5, m.y, m.x - 0.5, l.y, "#000000", 1)
|
|
}
|
|
for (H = 0; H < N.length; H++) {
|
|
y = parseFloat(this._settings.value(N[H] || 0));
|
|
if (y > K) {
|
|
y = K
|
|
}
|
|
y -= v;
|
|
y *= c;
|
|
J = m.x;
|
|
g = m.y + r + H * E + (u + 1) * C;
|
|
if ((y < 0 && this._settings.origin == "auto") || (this._settings.xAxis && y === 0 && !(this._settings.origin != "auto" && this._settings.origin > v))) {
|
|
this.canvases[C].renderTextAt("middle", "right", J + 10, g + u / 2 + r, this._settings.label(N[H]));
|
|
continue
|
|
}
|
|
if (y < 0 && this._settings.origin != "auto" && this._settings.origin > v) {
|
|
y = 0
|
|
}
|
|
if (!q) {
|
|
y += w / s
|
|
}
|
|
D = a || this._settings.color.call(this, N[H]);
|
|
if (this._settings.border) {
|
|
this._drawBarHBorder(A, J, g, u, v, n, s, y, D)
|
|
}
|
|
A.globalAlpha = this._settings.alpha.call(this, N[H]);
|
|
var F = this._drawBarH(A, l, J, g, u, v, n, s, y, D, a, L);
|
|
if (L != false) {
|
|
this._drawBarHGradient(A, J, g, u, v, n, s, y, D, L)
|
|
}
|
|
A.globalAlpha = 1;
|
|
if (F[3] == g) {
|
|
this.canvases[C].renderTextAt("middle", "left", F[0] - 5, F[3] + Math.floor(u / 2), this._settings.label(N[H]));
|
|
M.addRect(N[H].id, [F[0] - m.x, F[3] - m.y, F[2] - m.x, F[3] + u - m.y], C)
|
|
} else {
|
|
this.canvases[C].renderTextAt("middle", false, F[2] + 5, F[1] + Math.floor(u / 2), this._settings.label(N[H]));
|
|
M.addRect(N[H].id, [F[0] - m.x, g - m.y, F[2] - m.x, F[3] - m.y], C)
|
|
}
|
|
}
|
|
},
|
|
_setBarHPoints: function(x, h, v, y, n, w, u, m, l) {
|
|
var c = 0;
|
|
if (n > w * u) {
|
|
var s = (n - w * u) / n;
|
|
c = -Math.asin(s) + Math.PI / 2
|
|
}
|
|
x.moveTo(h, v + m);
|
|
var g = h + w * u - n - (n ? 0 : m);
|
|
if (n < w * u) {
|
|
x.lineTo(g, v + m)
|
|
}
|
|
var r = v + n;
|
|
if (n && n > 0) {
|
|
x.arc(g, r, n - m, -Math.PI / 2 + c, 0, false)
|
|
}
|
|
var q = v + y - n - (n ? 0 : m);
|
|
var a = g + n - (n ? m : 0);
|
|
x.lineTo(a, q);
|
|
if (n && n > 0) {
|
|
x.arc(g, q, n - m, 0, Math.PI / 2 - c, false)
|
|
}
|
|
var o = v + y - m;
|
|
x.lineTo(h, o);
|
|
if (!l) {
|
|
x.lineTo(h, v + m)
|
|
}
|
|
return [a, o]
|
|
},
|
|
_drawHScales: function(g, n, m, l, o, c, h) {
|
|
var a = 0;
|
|
if (this._settings.xAxis) {
|
|
if (!this.canvases.x) {
|
|
this.canvases.x = new dhtmlx.ui.Canvas(this._obj)
|
|
}
|
|
a = this._drawHXAxis(this.canvases.x.getCanvas(), n, m, l, o, c)
|
|
}
|
|
if (this._settings.yAxis) {
|
|
if (!this.canvases.y) {
|
|
this.canvases.y = new dhtmlx.ui.Canvas(this._obj)
|
|
}
|
|
this._drawHYAxis(this.canvases.y.getCanvas(), n, m, l, h, a)
|
|
}
|
|
},
|
|
_drawHYAxis: function(u, l, q, n, g, a) {
|
|
if (!this._settings.yAxis) {
|
|
return
|
|
}
|
|
var m;
|
|
var c = parseInt((a ? a : q.x), 10) - 0.5;
|
|
var r = n.y + 0.5;
|
|
var o = q.y;
|
|
this._drawLine(u, c, r, c, o, this._settings.yAxis.color, 1);
|
|
for (var h = 0; h < l.length; h++) {
|
|
var s = ((this._settings.origin != "auto") && (this._settings.view == "barH") && (parseFloat(this._settings.value(l[h])) < this._settings.origin));
|
|
m = o + g / 2 + h * g;
|
|
this.canvases.y.renderTextAt("middle", (s ? false : "left"), (s ? c + 5 : c - 5), m, this._settings.yAxis.template(l[h]), "dhx_axis_item_y", (s ? 0 : c - 10));
|
|
if (this._settings.yAxis.lines.call(this, l[h])) {
|
|
this._drawLine(u, q.x, m, n.x, m, this._settings.yAxis.lineColor.call(this, l[h]), 1)
|
|
}
|
|
}
|
|
this._drawLine(u, q.x + 0.5, o + 0.5, n.x, o + 0.5, this._settings.yAxis.lineColor.call(this, {}), 1);
|
|
this._setYAxisTitle(q, n)
|
|
},
|
|
_drawHXAxis: function(C, u, y, x, g, q) {
|
|
var n;
|
|
var l = {};
|
|
var o = this._settings.xAxis;
|
|
if (!o) {
|
|
return
|
|
}
|
|
var A = x.y + 0.5;
|
|
var h = y.x - 0.5;
|
|
var a = x.x - 0.5;
|
|
var s = y.x;
|
|
this._drawLine(C, h, A, a, A, o.color, 1);
|
|
if (o.step) {
|
|
n = parseFloat(o.step)
|
|
}
|
|
if (typeof this._configXAxis.step == "undefined" || typeof this._configXAxis.start == "undefined" || typeof this._configXAxis.end == "undefined") {
|
|
l = this._calculateScale(g, q);
|
|
g = l.start;
|
|
q = l.end;
|
|
n = l.step;
|
|
this._settings.xAxis.end = q;
|
|
this._settings.xAxis.start = g;
|
|
this._settings.xAxis.step = n
|
|
}
|
|
if (n === 0) {
|
|
return
|
|
}
|
|
var m = (a - h) * n / (q - g);
|
|
var w = 0;
|
|
for (var r = g; r <= q; r += n) {
|
|
if (l.fixNum) {
|
|
r = parseFloat((new Number(r)).toFixed(l.fixNum))
|
|
}
|
|
var v = Math.floor(h + w * m) + 0.5;
|
|
if (!(r == g && this._settings.origin == "auto") && o.lines.call(this, r)) {
|
|
this._drawLine(C, v, A, v, y.y, this._settings.xAxis.lineColor.call(this, r), 1)
|
|
}
|
|
if (r == this._settings.origin) {
|
|
s = v + 1
|
|
}
|
|
this.canvases.x.renderTextAt(false, true, v, A + 2, o.template(r.toString()), "dhx_axis_item_x");
|
|
w++
|
|
}
|
|
this.canvases.x.renderTextAt(true, false, h, x.y + this._settings.padding.bottom - 3, this._settings.xAxis.title, "dhx_axis_title_x", x.x - y.x);
|
|
if (!o.lines.call(this, {})) {
|
|
this._drawLine(C, h, y.y - 0.5, a, y.y - 0.5, this._settings.xAxis.color, 0.2)
|
|
}
|
|
return s
|
|
},
|
|
_correctBarHParams: function(o, l, g, m, n, q, h) {
|
|
var a = this._settings.yAxis;
|
|
var c = l;
|
|
if ( !! a && this._settings.origin != "auto" && (this._settings.origin > h)) {
|
|
l += (this._settings.origin - h) * n;
|
|
c = l;
|
|
m = m - (this._settings.origin - h);
|
|
if (m < 0) {
|
|
m *= (-1);
|
|
o.translate(l, g + q);
|
|
o.rotate(Math.PI);
|
|
l = 0.5;
|
|
g = 0
|
|
}
|
|
l += 0.5
|
|
}
|
|
return {
|
|
value: m,
|
|
x0: l,
|
|
y0: g,
|
|
start: c
|
|
}
|
|
},
|
|
_drawBarH: function(v, l, C, h, q, r, m, o, u, w, a, n) {
|
|
v.save();
|
|
var s = this._correctBarHParams(v, C, h, u, o, q, r);
|
|
v.fillStyle = w;
|
|
v.beginPath();
|
|
var x = this._setBarHPoints(v, s.x0, s.y0, q, m, o, s.value, (this._settings.border ? 1 : 0));
|
|
if (a && !n) {
|
|
v.lineTo(l.x, s.y0 + (this._settings.border ? 1 : 0))
|
|
}
|
|
v.fill();
|
|
v.restore();
|
|
var g = s.y0;
|
|
var c = (s.y0 != h ? h : x[1]);
|
|
var A = (s.y0 != h ? (s.start - x[0]) : s.start);
|
|
var y = (s.y0 != h ? s.start : x[0]);
|
|
return [A, g, y, c]
|
|
},
|
|
_drawBarHBorder: function(q, c, n, r, l, h, o, m, g) {
|
|
q.save();
|
|
var a = this._correctBarHParams(q, c, n, m, o, r, l);
|
|
q.beginPath();
|
|
this._setBorderStyles(q, g);
|
|
q.globalAlpha = 0.9;
|
|
this._setBarHPoints(q, a.x0, a.y0, r, h, o, a.value, q.lineWidth / 2, 1);
|
|
q.stroke();
|
|
q.restore()
|
|
},
|
|
_drawBarHGradient: function(s, g, q, u, n, m, r, o, h, a) {
|
|
s.save();
|
|
var c = this._correctBarHParams(s, g, q, o, r, u, n);
|
|
var l = this._setBarGradient(s, c.x0, c.y0 + u, c.x0 + r * c.value, c.y0, a, h, "x");
|
|
s.fillStyle = l.gradient;
|
|
s.beginPath();
|
|
this._setBarHPoints(s, c.x0, c.y0 + l.offset, u - l.offset * 2, m, r, c.value, l.offset);
|
|
s.fill();
|
|
s.globalAlpha = 1;
|
|
s.restore()
|
|
}
|
|
};
|
|
dhtmlx.assert(dhtmlx.chart.barH);
|
|
dhtmlx.chart.stackedBarH = {
|
|
pvt_render_stackedBarH: function(D, Q, l, h, E, P) {
|
|
var O, w;
|
|
var c;
|
|
var x;
|
|
var A = h.x - l.x;
|
|
var o = !! this._settings.yAxis;
|
|
var n = this._getStackedLimits(Q);
|
|
O = n.max;
|
|
w = n.min;
|
|
var H = Math.floor((h.y - l.y) / Q.length);
|
|
if (!E) {
|
|
this._drawHScales(D, Q, l, h, w, O, H)
|
|
}
|
|
if (o) {
|
|
O = parseFloat(this._settings.xAxis.end);
|
|
w = parseFloat(this._settings.xAxis.start)
|
|
}
|
|
var L = this._getRelativeValue(w, O);
|
|
x = L[0];
|
|
c = L[1];
|
|
var u = (x ? A / x : 10);
|
|
if (!o) {
|
|
var y = 10;
|
|
u = (x ? (A - y) / x : 10)
|
|
}
|
|
var v = parseInt(this._settings.width, 10);
|
|
if ((v + 4) > H) {
|
|
v = H - 4
|
|
}
|
|
var q = (H - v) / 2;
|
|
var m = 0;
|
|
var r = false;
|
|
var a = this._settings.gradient;
|
|
if (a) {
|
|
r = true
|
|
}
|
|
if (!o) {
|
|
this._drawLine(D, l.x - 0.5, l.y, l.x - 0.5, h.y, "#000000", 1)
|
|
}
|
|
var N = 0;
|
|
var K = 0;
|
|
for (J = 0; J < this._series.length; J++) {
|
|
if (J == E) {
|
|
K = N
|
|
}
|
|
if (this._series[J].view == "stackedBarH") {
|
|
N++
|
|
}
|
|
}
|
|
for (var J = 0; J < Q.length; J++) {
|
|
if (!K) {
|
|
Q[J].$startX = l.x
|
|
}
|
|
var C = parseFloat(this._settings.value(Q[J] || 0));
|
|
if (C > O) {
|
|
C = O
|
|
}
|
|
C -= w;
|
|
C *= c;
|
|
var M = l.x;
|
|
var g = l.y + q + J * H;
|
|
if (!K) {
|
|
Q[J].$startX = M
|
|
} else {
|
|
M = Q[J].$startX
|
|
} if (C < 0 || (this._settings.yAxis && C === 0)) {
|
|
this.canvases.y.renderTextAt("middle", true, M + 10, g + v / 2, this._settings.label(Q[J]));
|
|
continue
|
|
}
|
|
if (!o) {
|
|
C += y / u
|
|
}
|
|
var F = this._settings.color.call(this, Q[J]);
|
|
D.globalAlpha = this._settings.alpha.call(this, Q[J]);
|
|
D.fillStyle = this._settings.color.call(this, Q[J]);
|
|
D.beginPath();
|
|
var I = this._setBarHPoints(D, M, g, v, m, u, C, (this._settings.border ? 1 : 0));
|
|
if (a && !r) {
|
|
D.lineTo(l.x + A, g + (this._settings.border ? 1 : 0))
|
|
}
|
|
D.fill();
|
|
if (r != false) {
|
|
var s = this._setBarGradient(D, M, g + v, M, g, r, F, "x");
|
|
D.fillStyle = s.gradient;
|
|
D.beginPath();
|
|
I = this._setBarHPoints(D, M, g, v, m, u, C, 0);
|
|
D.fill()
|
|
}
|
|
if (this._settings.border) {
|
|
this._drawBarHBorder(D, M, g, v, w, m, u, C, F)
|
|
}
|
|
D.globalAlpha = 1;
|
|
this.canvases[E].renderTextAt("middle", true, Q[J].$startX + (I[0] - Q[J].$startX) / 2 - 1, g + (I[1] - g) / 2, this._settings.label(Q[J]));
|
|
P.addRect(Q[J].id, [Q[J].$startX - l.x, g - l.y, I[0] - l.x, I[1] - l.y], E);
|
|
Q[J].$startX = I[0]
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.chart.stackedBar = {
|
|
pvt_render_stackedBar: function(y, M, h, g, A, L) {
|
|
var J, u;
|
|
var a;
|
|
var v;
|
|
var w = g.y - h.y;
|
|
var m = !! this._settings.yAxis;
|
|
var K = !! this._settings.xAxis;
|
|
var l = this._getStackedLimits(M);
|
|
J = l.max;
|
|
u = l.min;
|
|
var D = Math.floor((g.x - h.x) / M.length);
|
|
if (!A) {
|
|
this._drawScales(M, h, g, u, J, D)
|
|
}
|
|
if (m) {
|
|
J = parseFloat(this._settings.yAxis.end);
|
|
u = parseFloat(this._settings.yAxis.start)
|
|
}
|
|
var H = this._getRelativeValue(u, J);
|
|
v = H[0];
|
|
a = H[1];
|
|
var r = (v ? w / v : 10);
|
|
var s = parseInt(this._settings.width, 10);
|
|
if (s + 4 > D) {
|
|
s = D - 4
|
|
}
|
|
var n = Math.floor((D - s) / 2);
|
|
var o = (this._settings.gradient ? this._settings.gradient : false);
|
|
if (!K) {
|
|
this._drawLine(y, h.x, g.y + 0.5, g.x, g.y + 0.5, "#000000", 1)
|
|
}
|
|
for (var F = 0; F < M.length; F++) {
|
|
var x = parseFloat(this._settings.value(M[F] || 0));
|
|
if (!x) {
|
|
if (!A || !M[F].$startY) {
|
|
M[F].$startY = g.y
|
|
}
|
|
continue
|
|
}
|
|
if (!A) {
|
|
x -= u
|
|
}
|
|
x *= a;
|
|
var I = h.x + n + F * D;
|
|
var c = g.y;
|
|
if (!A) {
|
|
M[F].$startY = c
|
|
} else {
|
|
c = M[F].$startY
|
|
} if (c < (h.y + 1)) {
|
|
continue
|
|
}
|
|
if (x < 0 || (this._settings.yAxis && x === 0)) {
|
|
this.canvases.y.renderTextAt(true, true, I + Math.floor(s / 2), c, this._settings.label(M[F]));
|
|
continue
|
|
}
|
|
var C = this._settings.color.call(this, M[F]);
|
|
y.globalAlpha = this._settings.alpha.call(this, M[F]);
|
|
y.fillStyle = this._settings.color.call(this, M[F]);
|
|
y.beginPath();
|
|
var E = this._setStakedBarPoints(y, I - (this._settings.border ? 0.5 : 0), c, s + (this._settings.border ? 0.5 : 0), r, x, 0, h.y);
|
|
y.fill();
|
|
if (o) {
|
|
y.save();
|
|
var q = this._setBarGradient(y, I, c, I + s, E[1], o, C, "y");
|
|
y.fillStyle = q.gradient;
|
|
y.beginPath();
|
|
E = this._setStakedBarPoints(y, I + q.offset, c, s - q.offset * 2, r, x, (this._settings.border ? 1 : 0), h.y);
|
|
y.fill();
|
|
y.restore()
|
|
}
|
|
if (this._settings.border) {
|
|
y.save();
|
|
this._setBorderStyles(y, C);
|
|
y.beginPath();
|
|
this._setStakedBarPoints(y, I - 0.5, c, s + 1, r, x, 0, h.y, 1);
|
|
y.stroke();
|
|
y.restore()
|
|
}
|
|
y.globalAlpha = 1;
|
|
this.canvases[A].renderTextAt(false, true, I + Math.floor(s / 2), (E[1] + (c - E[1]) / 2) - 7, this._settings.label(M[F]));
|
|
L.addRect(M[F].id, [I - h.x, E[1] - h.y, E[0] - h.x, (M[F].$startY || c) - h.y], A);
|
|
M[F].$startY = (this._settings.border ? (E[1] + 1) : E[1])
|
|
}
|
|
},
|
|
_setStakedBarPoints: function(u, c, q, v, r, o, h, g, l) {
|
|
u.moveTo(c, q);
|
|
var n = q - r * o + h;
|
|
if (n < g) {
|
|
n = g
|
|
}
|
|
u.lineTo(c, n);
|
|
var a = c + v;
|
|
var m = n;
|
|
u.lineTo(a, m);
|
|
var s = c + v;
|
|
u.lineTo(s, q);
|
|
if (!l) {
|
|
u.lineTo(c, q)
|
|
}
|
|
return [s, m - 2 * h]
|
|
}
|
|
};
|
|
dhtmlx.chart.line = {
|
|
pvt_render_line: function(n, C, l, h, o, y) {
|
|
var x, q, m, v, u, s, r, c, a, g, A, w;
|
|
v = this._calculateLineParams(n, C, l, h, o);
|
|
x = this._settings;
|
|
if (C.length) {
|
|
u = (x.offset ? l.x + v.cellWidth * 0.5 : l.x);
|
|
m = [];
|
|
for (q = 0; q < C.length; q++) {
|
|
w = this._getPointY(C[q], l, h, v);
|
|
if (w) {
|
|
r = ((!q) ? u : v.cellWidth * q - 0.5 + u);
|
|
a = (typeof w == "object" ? w.y0 : w);
|
|
if (q && this._settings.fixOverflow) {
|
|
A = this._getPointY(C[q - 1], l, h, v);
|
|
if (A.out && A.out == w.out) {
|
|
continue
|
|
}
|
|
s = v.cellWidth * (q - 1) - 0.5 + u;
|
|
c = (typeof A == "object" ? A.y0 : A);
|
|
if (A.out) {
|
|
g = (A.out == "min" ? h.y : l.y);
|
|
m.push({
|
|
x: this._calcOverflowX(s, r, c, a, g),
|
|
y: g
|
|
})
|
|
}
|
|
if (w.out) {
|
|
g = (w.out == "min" ? h.y : l.y);
|
|
m.push({
|
|
x: this._calcOverflowX(s, r, c, a, g),
|
|
y: g
|
|
})
|
|
}
|
|
}
|
|
if (!w.out) {
|
|
m.push({
|
|
x: r,
|
|
y: w,
|
|
index: q
|
|
})
|
|
}
|
|
}
|
|
}
|
|
this._mapStart = l;
|
|
for (q = 1; q <= m.length; q++) {
|
|
s = m[q - 1].x;
|
|
c = m[q - 1].y;
|
|
if (q < m.length) {
|
|
r = m[q].x;
|
|
a = m[q].y;
|
|
this._drawLine(n, s, c, r, a, x.line.color.call(this, C[q - 1]), x.line.width);
|
|
if (x.line && x.line.shadow) {
|
|
n.globalAlpha = 0.3;
|
|
this._drawLine(n, s + 2, c + x.line.width + 8, r + 2, a + x.line.width + 8, "#eeeeee", x.line.width + 3);
|
|
n.globalAlpha = 1
|
|
}
|
|
}
|
|
if (typeof m[q - 1].index != "undefined") {
|
|
this._drawItem(n, s, c, C[m[q - 1].index], x.label(C[m[q - 1].index]), o, y, l)
|
|
}
|
|
}
|
|
}
|
|
},
|
|
_calcOverflowX: function(c, a, h, g, l) {
|
|
return c + (l - h) * (a - c) / (g - h)
|
|
},
|
|
_drawItem: function(v, g, u, q, s, r, c) {
|
|
var h = this._settings.item;
|
|
var o = parseInt(h.radius.call(this, q), 10) || 0;
|
|
var n = this._mapStart;
|
|
if (o) {
|
|
v.save();
|
|
if (h.shadow) {
|
|
v.lineWidth = 1;
|
|
v.strokeStyle = "#bdbdbd";
|
|
v.fillStyle = "#bdbdbd";
|
|
var a = [0.1, 0.2, 0.3];
|
|
for (var m = (a.length - 1); m >= 0; m--) {
|
|
v.globalAlpha = a[m];
|
|
v.strokeStyle = "#d0d0d0";
|
|
v.beginPath();
|
|
this._strokeChartItem(v, g, u + 2 * o / 3, o + m + 1, h.type);
|
|
v.stroke()
|
|
}
|
|
v.beginPath();
|
|
v.globalAlpha = 0.3;
|
|
v.fillStyle = "#bdbdbd";
|
|
this._strokeChartItem(v, g, u + 2 * o / 3, o + 1, h.type);
|
|
v.fill()
|
|
}
|
|
v.restore();
|
|
v.lineWidth = h.borderWidth;
|
|
v.fillStyle = h.color.call(this, q);
|
|
v.strokeStyle = h.borderColor.call(this, q);
|
|
v.globalAlpha = h.alpha.call(this, q);
|
|
v.beginPath();
|
|
this._strokeChartItem(v, g, u, o + 1, h.type);
|
|
v.fill();
|
|
v.stroke();
|
|
v.globalAlpha = 1
|
|
}
|
|
if (s) {
|
|
this.canvases[r].renderTextAt(false, true, g, u - o - this._settings.labelOffset, this._settings.label.call(this, q))
|
|
}
|
|
var l = (this._settings.eventRadius || o + 1);
|
|
c.addRect(q.id, [g - l - n.x, u - l - n.y, g + l - n.x, u + l - n.y], r)
|
|
},
|
|
_strokeChartItem: function(a, c, l, h, g) {
|
|
var m = [];
|
|
c = parseInt(c, 10);
|
|
l = parseInt(l, 10);
|
|
if (g && (g == "square" || g == "s")) {
|
|
h *= Math.sqrt(2) / 2;
|
|
m = [
|
|
[c - h - a.lineWidth / 2, l - h],
|
|
[c + h, l - h],
|
|
[c + h, l + h],
|
|
[c - h, l + h],
|
|
[c - h, l - h]
|
|
]
|
|
} else {
|
|
if (g && (g == "diamond" || g == "d")) {
|
|
var n = (a.lineWidth > 1 ? a.lineWidth * Math.sqrt(2) / 4 : 0);
|
|
m = [
|
|
[c, l - h],
|
|
[c + h, l],
|
|
[c, l + h],
|
|
[c - h, l],
|
|
[c + n, l - h - n]
|
|
]
|
|
} else {
|
|
if (g && (g == "triangle" || g == "t")) {
|
|
m = [
|
|
[c, l - h],
|
|
[c + Math.sqrt(3) * h / 2, l + h / 2],
|
|
[c - Math.sqrt(3) * h / 2, l + h / 2],
|
|
[c, l - h]
|
|
]
|
|
} else {
|
|
m = [
|
|
[c, l, h, 0, Math.PI * 2, true]
|
|
]
|
|
}
|
|
}
|
|
}
|
|
this._path(a, m)
|
|
},
|
|
_getPointY: function(g, o, m, a) {
|
|
var n = a.minValue;
|
|
var h = a.maxValue;
|
|
var r = a.unit;
|
|
var c = a.valueFactor;
|
|
var q = this._settings.value(g);
|
|
var s = (parseFloat(q || 0) - n) * c;
|
|
if (!this._settings.yAxis) {
|
|
s += a.startValue / r
|
|
}
|
|
var l = m.y - r * s;
|
|
if (this._settings.fixOverflow && (this._settings.view == "line" || this._settings.view == "area")) {
|
|
if (q > h) {
|
|
l = {
|
|
y: o.y,
|
|
y0: l,
|
|
out: "max"
|
|
}
|
|
} else {
|
|
if (s < 0 || q < n) {
|
|
l = {
|
|
y: m.y,
|
|
y0: l,
|
|
out: "min"
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (q > h) {
|
|
l = o.y
|
|
}
|
|
if (s < 0 || q < n) {
|
|
l = m.y
|
|
}
|
|
}
|
|
return l
|
|
},
|
|
_calculateLineParams: function(q, h, n, m, l) {
|
|
var c = {};
|
|
var r;
|
|
c.totalHeight = m.y - n.y;
|
|
c.cellWidth = (m.x - n.x) / ((!this._settings.offset) ? (h.length - 1) : h.length);
|
|
var g = !! this._settings.yAxis;
|
|
var a = (this._settings.view.indexOf("stacked") != -1 ? this._getStackedLimits(h) : this._getLimits());
|
|
c.maxValue = a.max;
|
|
c.minValue = a.min;
|
|
if (!l) {
|
|
this._drawScales(h, n, m, c.minValue, c.maxValue, c.cellWidth)
|
|
}
|
|
if (g) {
|
|
c.maxValue = parseFloat(this._settings.yAxis.end);
|
|
c.minValue = parseFloat(this._settings.yAxis.start)
|
|
}
|
|
var o = this._getRelativeValue(c.minValue, c.maxValue);
|
|
r = o[0];
|
|
c.valueFactor = o[1];
|
|
c.unit = (r ? c.totalHeight / r : 10);
|
|
c.startValue = 0;
|
|
if (!g) {
|
|
c.startValue = 10;
|
|
if (c.unit != c.totalHeight) {
|
|
c.unit = (r ? (c.totalHeight - c.startValue) / r : 10)
|
|
}
|
|
}
|
|
return c
|
|
}
|
|
};
|
|
dhtmlx.chart.bar = {
|
|
pvt_render_bar: function(A, Q, l, h, C, P) {
|
|
var u, E, I, n, N, v, w, c, J, x, s, M, o, O = h.y - l.y;
|
|
o = !! this._settings.yAxis;
|
|
M = !! this._settings.xAxis;
|
|
n = this._getLimits();
|
|
N = n.max;
|
|
v = n.min;
|
|
E = (h.x - l.x) / Q.length;
|
|
if (!C && !(this._settings.origin != "auto" && !o)) {
|
|
this._drawScales(Q, l, h, v, N, E)
|
|
}
|
|
if (o) {
|
|
N = parseFloat(this._settings.yAxis.end);
|
|
v = parseFloat(this._settings.yAxis.start)
|
|
}
|
|
J = this._getRelativeValue(v, N);
|
|
w = J[0];
|
|
c = J[1];
|
|
s = (w ? O / w : w);
|
|
if (!o && !(this._settings.origin != "auto" && M)) {
|
|
x = 10;
|
|
s = (w ? (O - x) / w : x)
|
|
}
|
|
if (!C && (this._settings.origin != "auto" && !o) && this._settings.origin > v) {
|
|
this._drawXAxis(A, Q, l, h, E, h.y - s * (this._settings.origin - v))
|
|
}
|
|
u = parseInt(this._settings.width, 10);
|
|
var L = 0;
|
|
var H = 0;
|
|
for (I = 0; I < this._series.length; I++) {
|
|
if (I == C) {
|
|
H = L
|
|
}
|
|
if (this._series[I].view == "bar") {
|
|
L++
|
|
}
|
|
}
|
|
if (this._series && (u * L + 4) > E) {
|
|
u = parseInt(E / L - 4, 10)
|
|
}
|
|
var q = (E - u * L) / 2;
|
|
var m = (typeof this._settings.radius != "undefined" ? parseInt(this._settings.radius, 10) : Math.round(u / 5));
|
|
var r = false;
|
|
var a = this._settings.gradient;
|
|
if (a && typeof(a) != "function") {
|
|
r = a;
|
|
a = false
|
|
} else {
|
|
if (a) {
|
|
a = A.createLinearGradient(0, h.y, 0, l.y);
|
|
this._settings.gradient(a)
|
|
}
|
|
} if (!M) {
|
|
this._drawLine(A, l.x, h.y + 0.5, h.x, h.y + 0.5, "#000000", 1)
|
|
}
|
|
for (I = 0; I < Q.length; I++) {
|
|
var y = parseFloat(this._settings.value(Q[I]) || 0);
|
|
if (isNaN(y)) {
|
|
continue
|
|
}
|
|
if (y > N) {
|
|
y = N
|
|
}
|
|
y -= v;
|
|
y *= c;
|
|
var K = l.x + q + parseInt(I * E, 10) + (u + 1) * H;
|
|
var g = h.y;
|
|
if (y < 0 || (this._settings.yAxis && y === 0 && !(this._settings.origin != "auto" && this._settings.origin > v))) {
|
|
this.canvases[C].renderTextAt(true, true, K + Math.floor(u / 2), g, this._settings.label(Q[I]));
|
|
continue
|
|
}
|
|
if (!o && !(this._settings.origin != "auto" && M)) {
|
|
y += x / s
|
|
}
|
|
var D = a || this._settings.color.call(this, Q[I]);
|
|
A.globalAlpha = this._settings.alpha.call(this, Q[I]);
|
|
var F = this._drawBar(A, l, K, g, u, v, m, s, y, D, a, r);
|
|
if (r) {
|
|
this._drawBarGradient(A, K, g, u, v, m, s, y, D, r)
|
|
}
|
|
if (this._settings.border) {
|
|
this._drawBarBorder(A, K, g, u, v, m, s, y, D)
|
|
}
|
|
A.globalAlpha = 1;
|
|
if (F[0] != K) {
|
|
this.canvases[C].renderTextAt(false, true, K + Math.floor(u / 2), F[1], this._settings.label(Q[I]))
|
|
} else {
|
|
this.canvases[C].renderTextAt(true, true, K + Math.floor(u / 2), F[3], this._settings.label(Q[I]))
|
|
}
|
|
P.addRect(Q[I].id, [K - l.x, F[3] - l.y, F[2] - l.x, F[1] - l.y], C)
|
|
}
|
|
},
|
|
_correctBarParams: function(o, l, g, m, n, q, h) {
|
|
var a = this._settings.xAxis;
|
|
var c = g;
|
|
if ( !! a && this._settings.origin != "auto" && (this._settings.origin > h)) {
|
|
g -= (this._settings.origin - h) * n;
|
|
c = g;
|
|
m = m - (this._settings.origin - h);
|
|
if (m < 0) {
|
|
m *= (-1);
|
|
o.translate(l + q, g);
|
|
o.rotate(Math.PI);
|
|
l = 0;
|
|
g = 0
|
|
}
|
|
g -= 0.5
|
|
}
|
|
return {
|
|
value: m,
|
|
x0: l,
|
|
y0: g,
|
|
start: c
|
|
}
|
|
},
|
|
_drawBar: function(v, l, C, h, q, r, m, o, u, w, a, n) {
|
|
v.save();
|
|
v.fillStyle = w;
|
|
var s = this._correctBarParams(v, C, h, u, o, q, r);
|
|
var x = this._setBarPoints(v, s.x0, s.y0, q, m, o, s.value, (this._settings.border ? 1 : 0));
|
|
if (a && !n) {
|
|
v.lineTo(s.x0 + (this._settings.border ? 1 : 0), l.y)
|
|
}
|
|
v.fill();
|
|
v.restore();
|
|
var A = s.x0;
|
|
var y = (s.x0 != C ? C + x[0] : x[0]);
|
|
var g = (s.x0 != C ? (s.start - x[1] - s.y0) : s.y0);
|
|
var c = (s.x0 != C ? s.start - s.y0 : x[1]);
|
|
return [A, g, y, c]
|
|
},
|
|
_drawBarBorder: function(q, c, n, r, l, h, o, m, g) {
|
|
var a;
|
|
q.save();
|
|
a = this._correctBarParams(q, c, n, m, o, r, l);
|
|
this._setBorderStyles(q, g);
|
|
this._setBarPoints(q, a.x0, a.y0, r, h, o, a.value, q.lineWidth / 2, 1);
|
|
q.stroke();
|
|
q.restore()
|
|
},
|
|
_drawBarGradient: function(u, h, r, v, o, n, s, q, l, c) {
|
|
u.save();
|
|
var g = this._correctBarParams(u, h, r, q, s, v, o);
|
|
var m = this._setBarGradient(u, g.x0, g.y0, g.x0 + v, g.y0 - s * g.value + 2, c, l, "y");
|
|
var a = this._settings.border ? 1 : 0;
|
|
u.fillStyle = m.gradient;
|
|
this._setBarPoints(u, g.x0 + m.offset, g.y0, v - m.offset * 2, n, s, g.value, m.offset + a);
|
|
u.fill();
|
|
u.restore()
|
|
},
|
|
_setBarPoints: function(x, h, u, y, o, v, s, l, n) {
|
|
x.beginPath();
|
|
var c = 0;
|
|
if (o > v * s) {
|
|
var m = (o - v * s) / o;
|
|
if (m <= 1 && m >= -1) {
|
|
c = -Math.acos(m) + Math.PI / 2
|
|
}
|
|
}
|
|
x.moveTo(h + l, u);
|
|
var r = u - Math.floor(v * s) + o + (o ? 0 : l);
|
|
if (o < v * s) {
|
|
x.lineTo(h + l, r)
|
|
}
|
|
var g = h + o;
|
|
if (o && o > 0) {
|
|
x.arc(g, r, o - l, -Math.PI + c, -Math.PI / 2, false)
|
|
}
|
|
var a = h + y - o - l;
|
|
var q = r - o + (o ? l : 0);
|
|
x.lineTo(a, q);
|
|
if (o && o > 0) {
|
|
x.arc(a, r, o - l, -Math.PI / 2, 0 - c, false)
|
|
}
|
|
var w = h + y - l;
|
|
x.lineTo(w, u);
|
|
if (!n) {
|
|
x.lineTo(h + l, u)
|
|
}
|
|
return [w, q]
|
|
}
|
|
};
|
|
dhtmlx.chart.pie = {
|
|
pvt_render_pie: function(c, h, a, m, g, l) {
|
|
this._renderPie(c, h, a, m, 1, l, g)
|
|
},
|
|
_renderPie: function(s, F, l, h, D, E, u) {
|
|
if (!F.length) {
|
|
return
|
|
}
|
|
var v = this._getPieParameters(l, h);
|
|
var n = (this._settings.radius ? this._settings.radius : v.radius);
|
|
if (n < 0) {
|
|
return
|
|
}
|
|
var a = this._getValues(F);
|
|
var m = this._getTotalValue(a);
|
|
var o = this._getRatios(a, m);
|
|
var C = (this._settings.x ? this._settings.x : v.x);
|
|
var g = (this._settings.y ? this._settings.y : v.y);
|
|
if (D == 1 && this._settings.shadow) {
|
|
this._addShadow(s, C, g, n)
|
|
}
|
|
g = g / D;
|
|
var r = -Math.PI / 2;
|
|
var x = [];
|
|
s.scale(1, D);
|
|
if (this._settings.gradient) {
|
|
var A = (D != 1 ? C + n / 3 : C);
|
|
var c = (D != 1 ? g + n / 3 : g);
|
|
this._showRadialGradient(s, C, g, n, A, c)
|
|
}
|
|
for (var y = 0; y < F.length; y++) {
|
|
if (!a[y]) {
|
|
continue
|
|
}
|
|
s.strokeStyle = this._settings.lineColor.call(this, F[y]);
|
|
s.beginPath();
|
|
s.moveTo(C, g);
|
|
x.push(r);
|
|
alpha1 = -Math.PI / 2 + o[y] - 0.0001;
|
|
s.arc(C, g, n, r, alpha1, false);
|
|
s.lineTo(C, g);
|
|
var w = this._settings.color.call(this, F[y]);
|
|
s.fillStyle = w;
|
|
s.fill();
|
|
if (this._settings.pieInnerText) {
|
|
this._drawSectorLabel(C, g, 5 * n / 6, r, alpha1, D, this._settings.pieInnerText(F[y], m), true)
|
|
}
|
|
if (this._settings.label) {
|
|
this._drawSectorLabel(C, g, n + this._settings.labelOffset, r, alpha1, D, this._settings.label(F[y]))
|
|
}
|
|
if (D != 1) {
|
|
this._createLowerSector(s, C, g, r, alpha1, n, true);
|
|
s.fillStyle = "#000000";
|
|
s.globalAlpha = 0.2;
|
|
this._createLowerSector(s, C, g, r, alpha1, n, false);
|
|
s.globalAlpha = 1;
|
|
s.fillStyle = w
|
|
}
|
|
E.addSector(F[y].id, r, alpha1, C - l.x, g - l.y / D, n, D, u);
|
|
r = alpha1
|
|
}
|
|
s.globalAlpha = 0.8;
|
|
var q;
|
|
for (y = 0; y < x.length; y++) {
|
|
q = this._getPositionByAngle(x[y], C, g, n);
|
|
this._drawLine(s, C, g, q.x, q.y, this._settings.lineColor.call(this, F[y]), 2)
|
|
}
|
|
if (D == 1) {
|
|
s.lineWidth = 2;
|
|
s.strokeStyle = "#ffffff";
|
|
s.beginPath();
|
|
s.arc(C, g, n + 1, 0, 2 * Math.PI, false);
|
|
s.stroke()
|
|
}
|
|
s.globalAlpha = 1;
|
|
s.scale(1, 1 / D)
|
|
},
|
|
_getValues: function(g) {
|
|
var a = [];
|
|
for (var c = 0; c < g.length; c++) {
|
|
a.push(parseFloat(this._settings.value(g[c]) || 0))
|
|
}
|
|
return a
|
|
},
|
|
_getTotalValue: function(a) {
|
|
var g = 0;
|
|
for (var c = 0; c < a.length; c++) {
|
|
g += a[c]
|
|
}
|
|
return g
|
|
},
|
|
_getRatios: function(c, a) {
|
|
var m;
|
|
var l = [];
|
|
var h = 0;
|
|
a = a || this._getTotalValue(c);
|
|
for (var g = 0; g < c.length; g++) {
|
|
m = c[g];
|
|
l[g] = Math.PI * 2 * (a ? ((m + h) / a) : (1 / c.length));
|
|
h += m
|
|
}
|
|
return l
|
|
},
|
|
_getPieParameters: function(n, l) {
|
|
var h = l.x - n.x;
|
|
var c = l.y - n.y;
|
|
var g = n.x + h / 2;
|
|
var m = n.y + c / 2;
|
|
var a = Math.min(h / 2, c / 2);
|
|
return {
|
|
x: g,
|
|
y: m,
|
|
radius: a
|
|
}
|
|
},
|
|
_createLowerSector: function(h, l, n, g, a, m, c) {
|
|
h.lineWidth = 1;
|
|
if (!((g <= 0 && a >= 0) || (g >= 0 && a <= Math.PI) || (Math.abs(g - Math.PI) > 0.003 && g <= Math.PI && a >= Math.PI))) {
|
|
return
|
|
}
|
|
if (g <= 0 && a >= 0) {
|
|
g = 0;
|
|
c = false;
|
|
this._drawSectorLine(h, l, n, m, g, a)
|
|
}
|
|
if (g <= Math.PI && a >= Math.PI) {
|
|
a = Math.PI;
|
|
c = false;
|
|
this._drawSectorLine(h, l, n, m, g, a)
|
|
}
|
|
var o = (this._settings.height || Math.floor(m / 4)) / this._settings.cant;
|
|
h.beginPath();
|
|
h.arc(l, n, m, g, a, false);
|
|
h.lineTo(l + m * Math.cos(a), n + m * Math.sin(a) + o);
|
|
h.arc(l, n + o, m, a, g, true);
|
|
h.lineTo(l + m * Math.cos(g), n + m * Math.sin(g));
|
|
h.fill();
|
|
if (c) {
|
|
h.stroke()
|
|
}
|
|
},
|
|
_drawSectorLine: function(g, h, m, l, c, a) {
|
|
g.beginPath();
|
|
g.arc(h, m, l, c, a, false);
|
|
g.stroke()
|
|
},
|
|
_addShadow: function(c, a, m, h) {
|
|
c.globalAlpha = 0.5;
|
|
var l = ["#c4c4c4", "#c6c6c6", "#cacaca", "#dcdcdc", "#dddddd", "#e0e0e0", "#eeeeee", "#f5f5f5", "#f8f8f8"];
|
|
for (var g = l.length - 1; g > -1; g--) {
|
|
c.beginPath();
|
|
c.fillStyle = l[g];
|
|
c.arc(a + 1, m + 1, h + g, 0, Math.PI * 2, true);
|
|
c.fill()
|
|
}
|
|
c.globalAlpha = 1
|
|
},
|
|
_getGrayGradient: function(a) {
|
|
a.addColorStop(0, "#ffffff");
|
|
a.addColorStop(0.7, "#7a7a7a");
|
|
a.addColorStop(1, "#000000");
|
|
return a
|
|
},
|
|
_showRadialGradient: function(g, c, n, a, h, l) {
|
|
g.beginPath();
|
|
var m;
|
|
if (typeof this._settings.gradient != "function") {
|
|
m = g.createRadialGradient(h, l, a / 4, c, n, a);
|
|
m = this._getGrayGradient(m)
|
|
} else {
|
|
m = this._settings.gradient(m)
|
|
}
|
|
g.fillStyle = m;
|
|
g.arc(c, n, a, 0, Math.PI * 2, true);
|
|
g.fill();
|
|
g.globalAlpha = 0.7
|
|
},
|
|
_drawSectorLabel: function(E, c, h, A, w, F, v, a) {
|
|
var u = this.canvases[0].renderText(0, 0, v, 0, 1);
|
|
if (!u) {
|
|
return
|
|
}
|
|
var H = u.scrollWidth;
|
|
u.style.width = H + "px";
|
|
if (H > E) {
|
|
H = E
|
|
}
|
|
var C = (w - A < 0.2 ? 4 : 8);
|
|
if (a) {
|
|
C = H / 1.8
|
|
}
|
|
var g = A + (w - A) / 2;
|
|
h = h - (C - 8) / 2;
|
|
var o = -C;
|
|
var n = -8;
|
|
var D = "right";
|
|
if (g >= Math.PI / 2 && g < Math.PI || g <= 3 * Math.PI / 2 && g >= Math.PI) {
|
|
o = -H - o + 1;
|
|
D = "left"
|
|
}
|
|
var l = 0;
|
|
if (!a && F < 1 && (g > 0 && g < Math.PI)) {
|
|
l = (this._settings.height || Math.floor(h / 4)) / F
|
|
}
|
|
var q = (c + Math.floor((h + l) * Math.sin(g))) * F + n;
|
|
var r = E + Math.floor((h + C / 2) * Math.cos(g)) + o;
|
|
var m = (w < Math.PI / 2 + 0.01);
|
|
var s = (A < Math.PI / 2);
|
|
if (s && m) {
|
|
r = Math.max(r, E + 3)
|
|
} else {
|
|
if (!s && !m) {
|
|
r = Math.min(r, E - H)
|
|
} else {
|
|
if (!a && (g >= Math.PI / 2 && g < Math.PI || g <= 3 * Math.PI / 2 && g >= Math.PI)) {
|
|
r += H / 3
|
|
}
|
|
}
|
|
}
|
|
u.style.top = q + "px";
|
|
u.style.left = r + "px";
|
|
u.style.width = H + "px";
|
|
u.style.textAlign = D;
|
|
u.style.whiteSpace = "nowrap"
|
|
}
|
|
};
|
|
dhtmlx.chart.pie3D = {
|
|
pvt_render_pie3D: function(c, h, a, m, g, l) {
|
|
this._renderPie(c, h, a, m, this._settings.cant, l)
|
|
}
|
|
};
|
|
dhtmlx.chart.donut = {
|
|
pvt_render_donut: function(u, l, r, q, n, c) {
|
|
if (!l.length) {
|
|
return
|
|
}
|
|
this._renderPie(u, l, r, q, 1, c);
|
|
var h = this._settings;
|
|
var m = this._getPieParameters(r, q);
|
|
var a = (h.radius ? h.radius : m.radius);
|
|
var o = ((h.innerRadius && (h.innerRadius < a)) ? h.innerRadius : a / 3);
|
|
var g = (h.x ? h.x : m.x);
|
|
var s = (h.y ? h.y : m.y);
|
|
u.fillStyle = "#ffffff";
|
|
u.beginPath();
|
|
u.arc(g, s, o, 0, Math.PI * 2, true);
|
|
u.fill()
|
|
}
|
|
};
|
|
dhtmlx.DataDriver.dhtmlxgrid = {
|
|
_grid_getter: "_get_cell_value",
|
|
toObject: function(a) {
|
|
this._grid = a;
|
|
return a
|
|
},
|
|
getRecords: function(a) {
|
|
return a.rowsBuffer
|
|
},
|
|
getDetails: function(g) {
|
|
var a = {};
|
|
for (var c = 0; c < this._grid.getColumnsNum(); c++) {
|
|
a["data" + c] = this._grid[this._grid_getter](g, c)
|
|
}
|
|
return a
|
|
},
|
|
getInfo: function(a) {
|
|
return {
|
|
_size: 0,
|
|
_from: 0
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.ui.Canvas = function(c, g, l) {
|
|
this._canvas_labels = [];
|
|
this._canvas_name = g;
|
|
this._obj = c;
|
|
var h = c.offsetWidth * (window.devicePixelRatio || 1);
|
|
var a = c.offsetHeight * (window.devicePixelRatio || 1);
|
|
var l = l || "";
|
|
l += ";width:" + c.offsetWidth + "px;height:" + c.offsetHeight + "px;";
|
|
this._prepareCanvas(g, l, h, a)
|
|
};
|
|
dhtmlx.ui.Canvas.prototype = {
|
|
_prepareCanvas: function(c, h, g, a) {
|
|
this._canvas = dhtmlx.html.create("canvas", {
|
|
width: g,
|
|
height: a,
|
|
canvas_id: c,
|
|
style: (h || "")
|
|
});
|
|
this._obj.appendChild(this._canvas);
|
|
if (!this._canvas.getContext) {
|
|
if (dhtmlx._isIE) {
|
|
dhtmlx.require("thirdparty/excanvas/excanvas.js");
|
|
G_vmlCanvasManager.init_(document);
|
|
G_vmlCanvasManager.initElement(this._canvas)
|
|
} else {
|
|
dhtmlx.error("Canvas is not supported in the current browser")
|
|
}
|
|
}
|
|
return this._canvas
|
|
},
|
|
getCanvas: function(c) {
|
|
var a = (this._canvas || this._prepareCanvas()).getContext(c || "2d");
|
|
if (!this._webixDevicePixelRatio) {
|
|
this._webixDevicePixelRatio = true;
|
|
a.scale(window.devicePixelRatio || 1, window.devicePixelRatio || 1)
|
|
}
|
|
return a
|
|
},
|
|
_resizeCanvas: function() {
|
|
if (this._canvas) {
|
|
var a = this._canvas.parentNode.offsetWidth;
|
|
var c = this._canvas.parentNode.offsetHeight;
|
|
this._canvas.setAttribute("width", a * (window.devicePixelRatio || 1));
|
|
this._canvas.setAttribute("height", c * (window.devicePixelRatio || 1));
|
|
this._canvas.style.width = a + "px";
|
|
this._canvas.style.height = c + "px";
|
|
this._webixDevicePixelRatio = false
|
|
}
|
|
},
|
|
renderText: function(a, m, l, h, c) {
|
|
if (!l) {
|
|
return
|
|
}
|
|
var g = dhtmlx.html.create("DIV", {
|
|
"class": "dhx_canvas_text" + (h ? (" " + h) : ""),
|
|
style: "left:" + a + "px; top:" + m + "px;"
|
|
}, l);
|
|
this._obj.appendChild(g);
|
|
this._canvas_labels.push(g);
|
|
if (c) {
|
|
g.style.width = c + "px"
|
|
}
|
|
return g
|
|
},
|
|
renderTextAt: function(l, q, a, o, h, n, g) {
|
|
var m = this.renderText.call(this, a, o, h, n, g);
|
|
if (m) {
|
|
if (l) {
|
|
if (l == "middle") {
|
|
m.style.top = parseInt(o - m.offsetHeight / 2, 10) + "px"
|
|
} else {
|
|
m.style.top = o - m.offsetHeight + "px"
|
|
}
|
|
}
|
|
if (q) {
|
|
if (q == "left") {
|
|
m.style.left = a - m.offsetWidth + "px"
|
|
} else {
|
|
m.style.left = parseInt(a - m.offsetWidth / 2, 10) + "px"
|
|
}
|
|
}
|
|
}
|
|
return m
|
|
},
|
|
clearCanvas: function(a) {
|
|
var c = [],
|
|
g;
|
|
for (g = 0; g < this._canvas_labels.length; g++) {
|
|
this._obj.removeChild(this._canvas_labels[g])
|
|
}
|
|
this._canvas_labels = [];
|
|
if (!a && this._obj._htmlmap) {
|
|
c = this._getMapAreas();
|
|
while (c.length) {
|
|
c[0].parentNode.removeChild(c[0]);
|
|
c.splice(0, 1)
|
|
}
|
|
c = null;
|
|
if (!this._obj._htmlmap.getElementsByTagName("AREA").length) {
|
|
this._obj._htmlmap.parentNode.removeChild(this._obj._htmlmap);
|
|
this._obj._htmlmap = null
|
|
}
|
|
}
|
|
this.getCanvas().clearRect(0, 0, this._obj.offsetWidth * (window.devicePixelRatio || 1), this._obj.offsetWidth * (window.devicePixelRatio || 1))
|
|
},
|
|
toggleCanvas: function() {
|
|
this._toggleCanvas(this._canvas.style.display == "none")
|
|
},
|
|
showCanvas: function() {
|
|
this._toggleCanvas(true)
|
|
},
|
|
hideCanvas: function() {
|
|
this._toggleCanvas(false)
|
|
},
|
|
_toggleCanvas: function(a) {
|
|
var c, g;
|
|
for (g = 0; g < this._canvas_labels.length; g++) {
|
|
this._canvas_labels[g].style.display = (a ? "" : "none")
|
|
}
|
|
if (this._obj._htmlmap) {
|
|
c = this._getMapAreas();
|
|
for (g = 0; g < c.length; g++) {
|
|
if (a) {
|
|
c[g].removeAttribute("disabled")
|
|
} else {
|
|
c[g].setAttribute("disabled", "true")
|
|
}
|
|
}
|
|
}
|
|
this._canvas.style.display = (a ? "" : "none")
|
|
},
|
|
_getMapAreas: function() {
|
|
var g = [],
|
|
a, c;
|
|
a = this._obj._htmlmap.getElementsByTagName("AREA");
|
|
for (c = 0; c < a.length; c++) {
|
|
if (a[c].getAttribute("userdata") == this._canvas_name) {
|
|
g.push(a[c])
|
|
}
|
|
}
|
|
return g
|
|
}
|
|
};
|
|
dhtmlXChart = function(a) {
|
|
this.name = "Chart";
|
|
this.version = "3.0";
|
|
if (dhtmlx.assert_enabled()) {
|
|
this._assert()
|
|
}
|
|
dhtmlx.extend(this, dhtmlx.Settings);
|
|
this._parseContainer(a, "dhx_chart");
|
|
dhtmlx.extend(this, dhtmlx.AtomDataLoader);
|
|
dhtmlx.extend(this, dhtmlx.DataLoader);
|
|
this.data.provideApi(this, true);
|
|
dhtmlx.extend(this, dhtmlx.EventSystem);
|
|
dhtmlx.extend(this, dhtmlx.MouseEvents);
|
|
dhtmlx.extend(this, dhtmlx.Destruction);
|
|
dhtmlx.extend(this, dhtmlx.Group);
|
|
dhtmlx.extend(this, dhtmlx.AutoTooltip);
|
|
for (var c in dhtmlx.chart) {
|
|
dhtmlx.extend(this, dhtmlx.chart[c])
|
|
}
|
|
if (a.preset) {
|
|
this.definePreset(a)
|
|
}
|
|
this._parseSettings(a, this.defaults);
|
|
this._series = [this._settings];
|
|
this.data.attachEvent("onStoreUpdated", dhtmlx.bind(function() {
|
|
this.render()
|
|
}, this));
|
|
this.attachEvent("onLocateData", this._switchSerie)
|
|
};
|
|
dhtmlXChart.prototype = {
|
|
_id: "dhx_area_id",
|
|
on_click: {
|
|
dhx_chart_legend_item: function(m, n, l) {
|
|
var h = l.getAttribute("series_id");
|
|
if (this.callEvent("onLegendClick", [m, h, l])) {
|
|
var g = this._settings;
|
|
var c = g.legend.values;
|
|
var a = (c && (typeof c[h].toggle != "undefined")) ? c[h].toggle : g.legend.toggle;
|
|
if ((typeof h != "undefined") && this._series.length > 1) {
|
|
if (a) {
|
|
if (l.className.indexOf("hidden") != -1) {
|
|
this.showSeries(h)
|
|
} else {
|
|
this.hideSeries(h)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
on_dblclick: {},
|
|
on_mouse_move: {},
|
|
bind: function() {
|
|
dhx.BaseBind.legacyBind.apply(this, arguments)
|
|
},
|
|
sync: function() {
|
|
dhx.BaseBind.legacySync.apply(this, arguments)
|
|
},
|
|
resize: function() {
|
|
for (var a in this.canvases) {
|
|
this.canvases[a]._resizeCanvas()
|
|
}
|
|
this.render()
|
|
},
|
|
view_setter: function(a) {
|
|
if (!dhtmlx.chart[a]) {
|
|
dhtmlx.error("Chart type extension is not loaded: " + a)
|
|
}
|
|
if (typeof this._settings.offset == "undefined") {
|
|
this._settings.offset = !(a == "area" || a == "stackedArea")
|
|
}
|
|
if (a == "radar" && !this._settings.yAxis) {
|
|
this.define("yAxis", {})
|
|
}
|
|
if (a == "scatter") {
|
|
if (!this._settings.yAxis) {
|
|
this.define("yAxis", {})
|
|
}
|
|
if (!this._settings.xAxis) {
|
|
this.define("xAxis", {})
|
|
}
|
|
}
|
|
return a
|
|
},
|
|
clearCanvas: function() {
|
|
if (this.canvases && typeof this.canvases == "object") {
|
|
for (var a in this.canvases) {
|
|
this.canvases[a].clearCanvas()
|
|
}
|
|
}
|
|
},
|
|
render: function() {
|
|
var g, c, h, l, a;
|
|
if (!this.callEvent("onBeforeRender", [this.data])) {
|
|
return
|
|
}
|
|
if (this.canvases && typeof this.canvases == "object") {
|
|
for (c in this.canvases) {
|
|
this.canvases[c].clearCanvas()
|
|
}
|
|
} else {
|
|
this.canvases = {}
|
|
} if (this._settings.legend) {
|
|
if (!this.canvases.legend) {
|
|
this.canvases.legend = new dhtmlx.ui.Canvas(this._obj, "legend")
|
|
}
|
|
this._drawLegend(this.data.getRange(), this._obj.offsetWidth)
|
|
}
|
|
g = this._getChartBounds(this._obj.offsetWidth, this._obj.offsetHeight);
|
|
l = new dhtmlx.ui.Map(this._id);
|
|
a = this._settings;
|
|
h = this._getChartData();
|
|
for (c = 0; c < this._series.length; c++) {
|
|
this._settings = this._series[c];
|
|
if (!this.canvases[c]) {
|
|
this.canvases[c] = new dhtmlx.ui.Canvas(this._obj, c, "z-index:" + (2 + c))
|
|
}
|
|
this["pvt_render_" + this._settings.view](this.canvases[c].getCanvas(), h, g.start, g.end, c, l)
|
|
}
|
|
l.render(this._obj);
|
|
this._obj.lastChild.style.zIndex = 1000;
|
|
this._applyBounds(this._obj.lastChild, g);
|
|
this.callEvent("onAfterRender", []);
|
|
this._settings = a
|
|
},
|
|
_applyBounds: function(g, c) {
|
|
var a = {};
|
|
a.left = c.start.x;
|
|
a.top = c.start.y;
|
|
a.width = c.end.x - c.start.x;
|
|
a.height = c.end.y - c.start.y;
|
|
for (var h in a) {
|
|
g.style[h] = a[h] + "px"
|
|
}
|
|
},
|
|
_getChartData: function() {
|
|
var h, n, g, l, m, r, a, o, q, c;
|
|
l = this.data.getRange();
|
|
h = (this._settings.view.toLowerCase().indexOf("barh") != -1 ? "yAxis" : "xAxis");
|
|
n = this._settings[h];
|
|
if (n && n.units && (typeof n.units == "object")) {
|
|
g = n.units;
|
|
o = [];
|
|
if (typeof g.start != "undefined" && typeof g.end != "undefined" && typeof g.next != "undefined") {
|
|
a = g.start;
|
|
while (a <= g.end) {
|
|
o.push(a);
|
|
a = g.next.call(this, a)
|
|
}
|
|
} else {
|
|
if (Object.prototype.toString.call(g) === "[object Array]") {
|
|
o = g
|
|
}
|
|
}
|
|
r = [];
|
|
if (o.length) {
|
|
q = n.value;
|
|
c = {};
|
|
for (m = 0; m < l.length; m++) {
|
|
c[q(l[m])] = m
|
|
}
|
|
for (m = 0; m < o.length; m++) {
|
|
if (typeof c[o[m]] != "undefined") {
|
|
l[c[o[m]]].$unit = o[m];
|
|
r.push(l[c[o[m]]])
|
|
} else {
|
|
r.push({
|
|
$unit: o[m]
|
|
})
|
|
}
|
|
}
|
|
}
|
|
return r
|
|
}
|
|
return l
|
|
},
|
|
value_setter: dhtmlx.Template.obj_setter,
|
|
xValue_setter: dhtmlx.Template.obj_setter,
|
|
yValue_setter: function(a) {
|
|
this.define("value", a)
|
|
},
|
|
alpha_setter: dhtmlx.Template.obj_setter,
|
|
label_setter: dhtmlx.Template.obj_setter,
|
|
lineColor_setter: dhtmlx.Template.obj_setter,
|
|
borderColor_setter: dhtmlx.Template.obj_setter,
|
|
pieInnerText_setter: dhtmlx.Template.obj_setter,
|
|
gradient_setter: function(a) {
|
|
if ((typeof(a) != "function") && a && (a === true)) {
|
|
a = "light"
|
|
}
|
|
return a
|
|
},
|
|
colormap: {
|
|
RAINBOW: function(a) {
|
|
var c = Math.floor(this.indexById(a.id) / this.dataCount() * 1536);
|
|
if (c == 1536) {
|
|
c -= 1
|
|
}
|
|
return this._rainbow[Math.floor(c / 256)](c % 256)
|
|
}
|
|
},
|
|
color_setter: function(a) {
|
|
return this.colormap[a] || dhtmlx.Template.obj_setter(a)
|
|
},
|
|
fill_setter: function(a) {
|
|
return ((!a || a == 0) ? false : dhtmlx.Template.obj_setter(a))
|
|
},
|
|
definePreset: function(a) {
|
|
this.define("preset", a.preset);
|
|
delete a.preset
|
|
},
|
|
preset_setter: function(l) {
|
|
var g, c, h;
|
|
this.defaults = dhtmlx.extend({}, this.defaults);
|
|
if (typeof dhtmlx.presets.chart[l] == "object") {
|
|
h = dhtmlx.presets.chart[l];
|
|
for (g in h) {
|
|
if (typeof h[g] == "object") {
|
|
if (!this.defaults[g] || typeof this.defaults[g] != "object") {
|
|
this.defaults[g] = dhtmlx.extend({}, h[g])
|
|
} else {
|
|
this.defaults[g] = dhtmlx.extend({}, this.defaults[g]);
|
|
for (c in h[g]) {
|
|
this.defaults[g][c] = h[g][c]
|
|
}
|
|
}
|
|
} else {
|
|
this.defaults[g] = h[g]
|
|
}
|
|
}
|
|
return l
|
|
}
|
|
return false
|
|
},
|
|
legend_setter: function(a) {
|
|
if (!a) {
|
|
if (this.legendObj) {
|
|
this.legendObj.innerHTML = "";
|
|
this.legendObj = null
|
|
}
|
|
return false
|
|
}
|
|
if (typeof(a) != "object") {
|
|
a = {
|
|
template: a
|
|
}
|
|
}
|
|
this._mergeSettings(a, {
|
|
width: 150,
|
|
height: 18,
|
|
layout: "y",
|
|
align: "left",
|
|
valign: "bottom",
|
|
template: "",
|
|
toggle: (this._settings.view.toLowerCase().indexOf("stacked") != -1 ? "" : "hide"),
|
|
marker: {
|
|
type: "square",
|
|
width: 15,
|
|
height: 15,
|
|
radius: 3
|
|
},
|
|
margin: 4,
|
|
padding: 3
|
|
});
|
|
a.template = dhtmlx.Template.setter(a.template);
|
|
return a
|
|
},
|
|
defaults: {
|
|
color: "RAINBOW",
|
|
alpha: "1",
|
|
label: false,
|
|
value: "{obj.value}",
|
|
padding: {},
|
|
view: "pie",
|
|
lineColor: "#ffffff",
|
|
cant: 0.5,
|
|
width: 30,
|
|
labelWidth: 100,
|
|
line: {
|
|
width: 2,
|
|
color: "#1293f8"
|
|
},
|
|
item: {
|
|
radius: 3,
|
|
borderColor: "#636363",
|
|
borderWidth: 1,
|
|
color: "#ffffff",
|
|
alpha: 1,
|
|
type: "r",
|
|
shadow: false
|
|
},
|
|
shadow: true,
|
|
gradient: false,
|
|
border: true,
|
|
labelOffset: 20,
|
|
origin: "auto"
|
|
},
|
|
item_setter: function(a) {
|
|
if (typeof(a) != "object") {
|
|
a = {
|
|
color: a,
|
|
borderColor: a
|
|
}
|
|
}
|
|
this._mergeSettings(a, dhtmlx.extend({}, this.defaults.item));
|
|
var g = ["alpha", "borderColor", "color", "radius"];
|
|
for (var c = 0; c < g.length; c++) {
|
|
a[g[c]] = dhtmlx.Template.setter(a[g[c]])
|
|
}
|
|
return a
|
|
},
|
|
line_setter: function(a) {
|
|
if (typeof(a) != "object") {
|
|
a = {
|
|
color: a
|
|
}
|
|
}
|
|
dhtmlx.extend(this.defaults.line, a);
|
|
a = dhtmlx.extend({}, this.defaults.line);
|
|
a.color = dhtmlx.Template.setter(a.color);
|
|
return a
|
|
},
|
|
padding_setter: function(a) {
|
|
if (typeof(a) != "object") {
|
|
a = {
|
|
left: a,
|
|
right: a,
|
|
top: a,
|
|
bottom: a
|
|
}
|
|
}
|
|
this._mergeSettings(a, {
|
|
left: 50,
|
|
right: 20,
|
|
top: 35,
|
|
bottom: 40
|
|
});
|
|
return a
|
|
},
|
|
xAxis_setter: function(a) {
|
|
if (!a) {
|
|
return false
|
|
}
|
|
if (typeof(a) != "object") {
|
|
a = {
|
|
template: a
|
|
}
|
|
}
|
|
if (!a.value) {
|
|
a.value = a.template
|
|
}
|
|
this._mergeSettings(a, {
|
|
title: "",
|
|
color: "#000000",
|
|
lineColor: "#cfcfcf",
|
|
template: "{obj}",
|
|
value: "{obj}",
|
|
lines: true
|
|
});
|
|
var c = ["lineColor", "template", "lines", "value"];
|
|
this._converToTemplate(c, a);
|
|
this._configXAxis = dhtmlx.extend({}, a);
|
|
return a
|
|
},
|
|
yAxis_setter: function(a) {
|
|
this._mergeSettings(a, {
|
|
title: "",
|
|
color: "#000000",
|
|
lineColor: "#cfcfcf",
|
|
template: "{obj}",
|
|
lines: true,
|
|
bg: "#ffffff"
|
|
});
|
|
var c = ["lineColor", "template", "lines", "bg"];
|
|
this._converToTemplate(c, a);
|
|
this._configYAxis = dhtmlx.extend({}, a);
|
|
return a
|
|
},
|
|
_converToTemplate: function(a, c) {
|
|
for (var g = 0; g < a.length; g++) {
|
|
c[a[g]] = dhtmlx.Template.setter(c[a[g]])
|
|
}
|
|
},
|
|
_drawScales: function(l, h, g, n, a, c) {
|
|
var m = 0;
|
|
if (this._settings.yAxis) {
|
|
if (!this.canvases.y) {
|
|
this.canvases.y = new dhtmlx.ui.Canvas(this._obj, "axis_y")
|
|
}
|
|
m = this._drawYAxis(this.canvases.y.getCanvas(), l, h, g, n, a)
|
|
}
|
|
if (this._settings.xAxis) {
|
|
if (!this.canvases.x) {
|
|
this.canvases.x = new dhtmlx.ui.Canvas(this._obj, "axis_x")
|
|
}
|
|
this._drawXAxis(this.canvases.x.getCanvas(), l, h, g, c, m)
|
|
}
|
|
return m
|
|
},
|
|
_drawXAxis: function(v, m, s, r, h, q) {
|
|
var g = s.x - 0.5;
|
|
var u = parseInt((q ? q : r.y), 10) + 0.5;
|
|
var c = r.x;
|
|
var n;
|
|
var a = true;
|
|
for (var l = 0; l < m.length; l++) {
|
|
if (this._settings.offset === true) {
|
|
n = g + h / 2 + l * h
|
|
} else {
|
|
n = (l == m.length - 1) ? r.x : g + l * h;
|
|
a = !! l
|
|
}
|
|
n = Math.ceil(n) - 0.5;
|
|
var o = ((this._settings.origin != "auto") && (this._settings.view == "bar") && (parseFloat(this._settings.value(m[l])) < this._settings.origin));
|
|
this._drawXAxisLabel(n, u, m[l], a, o);
|
|
if ((this._settings.offset || l) && this._settings.xAxis.lines.call(this, m[l])) {
|
|
this._drawXAxisLine(v, n, r.y, s.y, m[l])
|
|
}
|
|
}
|
|
this.canvases.x.renderTextAt(true, false, g, r.y + this._settings.padding.bottom - 3, this._settings.xAxis.title, "dhx_axis_title_x", r.x - s.x);
|
|
this._drawLine(v, g, u, c, u, this._settings.xAxis.color, 1);
|
|
if (!this._settings.xAxis.lines.call(this, {}) || !this._settings.offset) {
|
|
return
|
|
}
|
|
this._drawLine(v, c + 0.5, r.y, c + 0.5, s.y + 0.5, this._settings.xAxis.color, 0.2)
|
|
},
|
|
_drawYAxis: function(x, E, m, l, o, n) {
|
|
var q;
|
|
var v = {};
|
|
if (!this._settings.yAxis) {
|
|
return
|
|
}
|
|
var A = m.x - 0.5;
|
|
var h = l.y;
|
|
var g = m.y;
|
|
var w = l.y;
|
|
if (this._settings.yAxis.step) {
|
|
q = parseFloat(this._settings.yAxis.step)
|
|
}
|
|
if (typeof this._configYAxis.step == "undefined" || typeof this._configYAxis.start == "undefined" || typeof this._configYAxis.end == "undefined") {
|
|
v = this._calculateScale(o, n);
|
|
o = v.start;
|
|
n = v.end;
|
|
q = v.step;
|
|
this._settings.yAxis.end = n;
|
|
this._settings.yAxis.start = o
|
|
}
|
|
this._setYAxisTitle(m, l);
|
|
if (q === 0) {
|
|
n = o;
|
|
q = 1
|
|
}
|
|
var a = (n == o ? h - g : (h - g) * q / (n - o));
|
|
var C = 0;
|
|
for (var y = o; y <= n; y += q) {
|
|
if (v.fixNum) {
|
|
y = parseFloat((new Number(y)).toFixed(v.fixNum))
|
|
}
|
|
var D = Math.floor(h - C * a) + 0.5;
|
|
if (!(y == o && this._settings.origin == "auto") && this._settings.yAxis.lines.call(this, y)) {
|
|
this._drawLine(x, A, D, l.x, D, this._settings.yAxis.lineColor.call(this, y), 1)
|
|
}
|
|
if (y == this._settings.origin) {
|
|
w = D
|
|
}
|
|
var r = y;
|
|
if (q < 1) {
|
|
var s = Math.min(this._log10(q), (o <= 0 ? 0 : this._log10(o)));
|
|
var u = Math.pow(10, -s);
|
|
r = Math.round(y * u) / u;
|
|
y = r
|
|
}
|
|
this.canvases.y.renderText(0, D - 5, this._settings.yAxis.template(r.toString()), "dhx_axis_item_y", m.x - 5);
|
|
C++
|
|
}
|
|
this._drawLine(x, A, h + 1, A, g, this._settings.yAxis.color, 1);
|
|
return w
|
|
},
|
|
_setYAxisTitle: function(g, c) {
|
|
var a = "dhx_axis_title_y" + (dhtmlx._isIE && dhtmlx._isIE != 9 ? " dhx_ie_filter" : "");
|
|
var h = this.canvases.y.renderTextAt("middle", false, 0, parseInt((c.y - g.y) / 2 + g.y, 10), this._settings.yAxis.title, a);
|
|
if (h) {
|
|
h.style.left = (dhtmlx.env.transform ? (h.offsetHeight - h.offsetWidth) / 2 : 0) + "px"
|
|
}
|
|
},
|
|
_calculateScale: function(r, c) {
|
|
if (this._settings.origin != "auto" && this._settings.origin < r) {
|
|
r = this._settings.origin
|
|
}
|
|
var l, h, n;
|
|
l = ((c - r) / 8) || 1;
|
|
var g = Math.floor(this._log10(l));
|
|
var a = Math.pow(10, g);
|
|
var m = l / a;
|
|
m = (m > 5 ? 10 : 5);
|
|
l = parseInt(m, 10) * a;
|
|
if (l > Math.abs(r)) {
|
|
h = (r < 0 ? -l : 0)
|
|
} else {
|
|
var s = Math.abs(r);
|
|
var q = Math.floor(this._log10(s));
|
|
var o = s / Math.pow(10, q);
|
|
h = Math.ceil(o * 10) / 10 * Math.pow(10, q) - l;
|
|
if (s > 1 && l > 0.1) {
|
|
h = Math.ceil(h)
|
|
}
|
|
while (r < 0 ? h <= r : h >= r) {
|
|
h -= l
|
|
}
|
|
if (r < 0) {
|
|
h = -h - 2 * l
|
|
}
|
|
}
|
|
n = h;
|
|
while (n < c) {
|
|
n += l;
|
|
n = parseFloat((new Number(n)).toFixed(Math.abs(g)))
|
|
}
|
|
return {
|
|
start: h,
|
|
end: n,
|
|
step: l,
|
|
fixNum: Math.abs(g)
|
|
}
|
|
},
|
|
_getLimits: function(c, n) {
|
|
var o, m;
|
|
var l = ((arguments.length && c == "h") ? this._configXAxis : this._configYAxis);
|
|
n = n || "value";
|
|
if (l && (typeof l.end != "undefined") && (typeof l.start != "undefined") && l.step) {
|
|
o = parseFloat(l.end);
|
|
m = parseFloat(l.start)
|
|
} else {
|
|
o = this.max(this._series[0][n]);
|
|
m = (l && (typeof l.start != "undefined")) ? parseFloat(l.start) : this.min(this._series[0][n]);
|
|
if (this._series.length > 1) {
|
|
for (var h = 1; h < this._series.length; h++) {
|
|
var a = this.max(this._series[h][n]);
|
|
var g = this.min(this._series[h][n]);
|
|
if (a > o) {
|
|
o = a
|
|
}
|
|
if (g < m) {
|
|
m = g
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return {
|
|
max: o,
|
|
min: m
|
|
}
|
|
},
|
|
_log10: function(c) {
|
|
var a = "log";
|
|
return Math.floor((Math[a](c) / Math.LN10))
|
|
},
|
|
_drawXAxisLabel: function(c, m, l, a, h) {
|
|
if (!this._settings.xAxis) {
|
|
return
|
|
}
|
|
var g = this.canvases.x.renderTextAt(h, a, c, m - (h ? 2 : 0), this._settings.xAxis.template(l));
|
|
if (g) {
|
|
g.className += " dhx_axis_item_x"
|
|
}
|
|
},
|
|
_drawXAxisLine: function(c, a, h, g, l) {
|
|
if (!this._settings.xAxis || !this._settings.xAxis.lines) {
|
|
return
|
|
}
|
|
this._drawLine(c, a, h, a, g, this._settings.xAxis.lineColor.call(this, l), 1)
|
|
},
|
|
_drawLine: function(a, h, n, g, l, c, m) {
|
|
a.strokeStyle = c;
|
|
a.lineWidth = m;
|
|
a.beginPath();
|
|
a.moveTo(h, n);
|
|
a.lineTo(g, l);
|
|
a.stroke();
|
|
a.lineWidth = 1
|
|
},
|
|
_getRelativeValue: function(h, l) {
|
|
var g, a;
|
|
var c = 1;
|
|
if (l != h) {
|
|
g = l - h
|
|
} else {
|
|
g = h
|
|
}
|
|
return [g, c]
|
|
},
|
|
_rainbow: [
|
|
function(a) {
|
|
return "#FF" + dhtmlx.math.toHex(a / 2, 2) + "00"
|
|
},
|
|
function(a) {
|
|
return "#FF" + dhtmlx.math.toHex(a / 2 + 128, 2) + "00"
|
|
},
|
|
function(a) {
|
|
return "#" + dhtmlx.math.toHex(255 - a, 2) + "FF00"
|
|
},
|
|
function(a) {
|
|
return "#00FF" + dhtmlx.math.toHex(a, 2)
|
|
},
|
|
function(a) {
|
|
return "#00" + dhtmlx.math.toHex(255 - a, 2) + "FF"
|
|
},
|
|
function(a) {
|
|
return "#" + dhtmlx.math.toHex(a, 2) + "00FF"
|
|
}
|
|
],
|
|
addSeries: function(c) {
|
|
var a = this._settings;
|
|
this._settings = dhtmlx.extend({}, a);
|
|
this._parseSettings(c, {});
|
|
this._series.push(this._settings);
|
|
this._settings = a
|
|
},
|
|
_switchSerie: function(h, a) {
|
|
var g;
|
|
this._active_serie = a.getAttribute("userdata");
|
|
if (!this._series[this._active_serie]) {
|
|
return
|
|
}
|
|
for (var c = 0; c < this._series.length; c++) {
|
|
g = this._series[c].tooltip;
|
|
if (g) {
|
|
g.disable()
|
|
}
|
|
}
|
|
if (!a.getAttribute("disabled")) {
|
|
g = this._series[this._active_serie].tooltip;
|
|
if (g) {
|
|
g.enable()
|
|
}
|
|
}
|
|
},
|
|
hideSeries: function(a) {
|
|
this.canvases[a].hideCanvas();
|
|
if (this._settings.legend.values && this._settings.legend.values[a]) {
|
|
this._settings.legend.values[a].$hidden = true
|
|
}
|
|
this._drawLegend()
|
|
},
|
|
showSeries: function(a) {
|
|
this.canvases[a].showCanvas();
|
|
if (this._settings.legend.values && this._settings.legend.values[a]) {
|
|
delete this._settings.legend.values[a].$hidden
|
|
}
|
|
this._drawLegend()
|
|
},
|
|
_setBorderStyles: function(a, c) {
|
|
var h, g;
|
|
g = dhtmlx.math.toRgb(c);
|
|
h = dhtmlx.math.rgbToHsv(g[0], g[1], g[2]);
|
|
h[2] /= 2;
|
|
c = "rgb(" + dhtmlx.math.hsvToRgb(h[0], h[1], h[2]) + ")";
|
|
a.strokeStyle = c;
|
|
if (a.globalAlpha == 1) {
|
|
a.globalAlpha = 0.9
|
|
}
|
|
},
|
|
_drawLegend: function(h, c) {
|
|
var l, r, A, s, m, u, a, o = 0,
|
|
n = 0,
|
|
w, q, g, v;
|
|
h = h || [];
|
|
c = c || this._obj.offsetWidth;
|
|
w = this.canvases.legend.getCanvas();
|
|
r = this._settings.legend;
|
|
a = (this._settings.legend.layout != "x" ? "width:" + r.width + "px" : "");
|
|
if (this.legendObj) {
|
|
this.legendObj.innerHTML = "";
|
|
this.legendObj.parentNode.removeChild(this.legendObj)
|
|
}
|
|
this.canvases.legend.clearCanvas(true);
|
|
A = dhtmlx.html.create("DIV", {
|
|
"class": "dhx_chart_legend",
|
|
style: "left:" + o + "px; top:" + n + "px;" + a
|
|
}, "");
|
|
if (r.padding) {
|
|
A.style.padding = r.padding + "px"
|
|
}
|
|
this.legendObj = A;
|
|
this._obj.appendChild(A);
|
|
m = [];
|
|
if (!r.values) {
|
|
for (l = 0; l < h.length; l++) {
|
|
m.push(this._drawLegendText(A, r.template(h[l])))
|
|
}
|
|
} else {
|
|
for (l = 0; l < r.values.length; l++) {
|
|
m.push(this._drawLegendText(A, r.values[l].text, (typeof r.values[l].id != "undefined" ? typeof r.values[l].id : l), r.values[l].$hidden))
|
|
}
|
|
}
|
|
u = A.offsetWidth;
|
|
s = A.offsetHeight;
|
|
if (u < this._obj.offsetWidth) {
|
|
if (r.layout == "x" && r.align == "center") {
|
|
o = (this._obj.offsetWidth - u) / 2
|
|
}
|
|
if (r.align == "right") {
|
|
o = this._obj.offsetWidth - u
|
|
}
|
|
if (r.margin && r.align != "center") {
|
|
o += (r.align == "left" ? 1 : -1) * r.margin
|
|
}
|
|
}
|
|
if (s < this._obj.offsetHeight) {
|
|
if (r.valign == "middle" && r.align != "center" && r.layout != "x") {
|
|
n = (this._obj.offsetHeight - s) / 2
|
|
} else {
|
|
if (r.valign == "bottom") {
|
|
n = this._obj.offsetHeight - s
|
|
}
|
|
} if (r.margin && r.valign != "middle") {
|
|
n += (r.valign == "top" ? 1 : -1) * r.margin
|
|
}
|
|
}
|
|
A.style.left = o + "px";
|
|
A.style.top = n + "px";
|
|
w.save();
|
|
for (l = 0; l < m.length; l++) {
|
|
v = m[l];
|
|
if (r.values && r.values[l].$hidden) {
|
|
g = true;
|
|
q = (r.values[l].disableColor ? r.values[l].disableColor : "#d9d9d9")
|
|
} else {
|
|
g = false;
|
|
q = (r.values ? r.values[l].color : this._settings.color.call(this, h[l]))
|
|
}
|
|
this._drawLegendMarker(w, v.offsetLeft + o, v.offsetTop + n, q, v.offsetHeight, g, l)
|
|
}
|
|
w.restore();
|
|
m = null
|
|
},
|
|
_drawLegendText: function(a, l, c, h) {
|
|
var g = "";
|
|
if (this._settings.legend.layout == "x") {
|
|
g = "float:left;"
|
|
}
|
|
var m = dhtmlx.html.create("DIV", {
|
|
style: g + "padding-left:" + (10 + this._settings.legend.marker.width) + "px",
|
|
"class": "dhx_chart_legend_item" + (h ? " hidden" : "")
|
|
}, l);
|
|
if (arguments.length > 2) {
|
|
m.setAttribute("series_id", c)
|
|
}
|
|
a.appendChild(m);
|
|
return m
|
|
},
|
|
_drawLegendMarker: function(C, u, s, l, A, m, o) {
|
|
var c = [];
|
|
var n = this._settings.legend.marker;
|
|
var w = this._settings.legend.values;
|
|
var r = (w && w[o].markerType ? w[o].markerType : n.type);
|
|
if (l) {
|
|
C.fillStyle = l;
|
|
C.strokeStyle = this._getDarkenColor(l, 0.75)
|
|
}
|
|
C.beginPath();
|
|
if (r == "round" || !n.radius) {
|
|
C.lineWidth = n.height;
|
|
C.lineCap = r;
|
|
u += C.lineWidth / 2 + 5;
|
|
s += A / 2;
|
|
C.moveTo(u, s);
|
|
var a = u + n.width - n.height + 1;
|
|
C.lineTo(a, s)
|
|
} else {
|
|
if (r == "item") {
|
|
if (this._settings.line && this._settings.view != "scatter" && !this._settings.disableLines) {
|
|
C.beginPath();
|
|
C.lineWidth = this._series[o].line.width;
|
|
C.strokeStyle = m ? l : this._series[o].line.color.call(this, {});
|
|
var g = u + 5;
|
|
var v = s + A / 2;
|
|
C.moveTo(g, v);
|
|
var a = g + n.width;
|
|
C.lineTo(a, v);
|
|
C.stroke()
|
|
}
|
|
var h = this._series[o].item;
|
|
var q = parseInt(h.radius.call(this, {}), 10) || 0;
|
|
if (q) {
|
|
C.beginPath();
|
|
if (m) {
|
|
C.lineWidth = h.borderWidth;
|
|
C.strokeStyle = l;
|
|
C.fillStyle = l
|
|
} else {
|
|
C.lineWidth = h.borderWidth;
|
|
C.fillStyle = h.color.call(this, {});
|
|
C.strokeStyle = h.borderColor.call(this, {});
|
|
C.globalAlpha = h.alpha.call(this, {})
|
|
}
|
|
C.beginPath();
|
|
u += n.width / 2 + 5;
|
|
s += A / 2;
|
|
this._strokeChartItem(C, u, s, q + 1, h.type);
|
|
C.fill();
|
|
C.stroke()
|
|
}
|
|
C.globalAlpha = 1
|
|
} else {
|
|
C.lineWidth = 1;
|
|
u += 5;
|
|
s += parseInt(A / 2 - n.height / 2, 10);
|
|
c = [
|
|
[u + n.radius, s + n.radius, n.radius, Math.PI, 3 * Math.PI / 2, false],
|
|
[u + n.width - n.radius, s],
|
|
[u + n.width - n.radius, s + n.radius, n.radius, -Math.PI / 2, 0, false],
|
|
[u + n.width, s + n.height - n.radius],
|
|
[u + n.width - n.radius, s + n.height - n.radius, n.radius, 0, Math.PI / 2, false],
|
|
[u + n.radius, s + n.height],
|
|
[u + n.radius, s + n.height - n.radius, n.radius, Math.PI / 2, Math.PI, false],
|
|
[u, s + n.radius]
|
|
];
|
|
this._path(C, c)
|
|
}
|
|
}
|
|
C.stroke();
|
|
C.fill()
|
|
},
|
|
_getDarkenColor: function(a, h) {
|
|
var g, c;
|
|
c = dhtmlx.math.toRgb(a);
|
|
g = dhtmlx.math.rgbToHsv(c[0], c[1], c[2]);
|
|
g[2] = g[2] * h;
|
|
return "rgb(" + dhtmlx.math.hsvToRgb(g[0], g[1], g[2]) + ")"
|
|
},
|
|
_getChartBounds: function(a, n) {
|
|
var q, g, o, c;
|
|
q = this._settings.padding.left;
|
|
g = this._settings.padding.top;
|
|
o = a - this._settings.padding.right;
|
|
c = n - this._settings.padding.bottom;
|
|
if (this._settings.legend) {
|
|
var l = this._settings.legend;
|
|
var m = this._settings.legend.width;
|
|
var h = this._settings.legend.height;
|
|
if (l.layout == "x") {
|
|
if (l.valign == "center") {
|
|
if (l.align == "right") {
|
|
o -= m
|
|
} else {
|
|
if (l.align == "left") {
|
|
q += m
|
|
}
|
|
}
|
|
} else {
|
|
if (l.valign == "bottom") {
|
|
c -= h
|
|
} else {
|
|
g += h
|
|
}
|
|
}
|
|
} else {
|
|
if (l.align == "right") {
|
|
o -= m
|
|
} else {
|
|
if (l.align == "left") {
|
|
q += m
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return {
|
|
start: {
|
|
x: q,
|
|
y: g
|
|
},
|
|
end: {
|
|
x: o,
|
|
y: c
|
|
}
|
|
}
|
|
},
|
|
_getStackedLimits: function(l) {
|
|
var c, a, m, h, g;
|
|
if (this._settings.yAxis && (typeof this._settings.yAxis.end != "undefined") && (typeof this._settings.yAxis.start != "undefined") && this._settings.yAxis.step) {
|
|
m = parseFloat(this._settings.yAxis.end);
|
|
h = parseFloat(this._settings.yAxis.start)
|
|
} else {
|
|
for (c = 0; c < l.length; c++) {
|
|
l[c].$sum = 0;
|
|
l[c].$min = Infinity;
|
|
for (a = 0; a < this._series.length; a++) {
|
|
g = parseFloat(this._series[a].value(l[c]) || 0);
|
|
if (isNaN(g)) {
|
|
continue
|
|
}
|
|
if (this._series[a].view.toLowerCase().indexOf("stacked") != -1) {
|
|
l[c].$sum += g
|
|
}
|
|
if (g < l[c].$min) {
|
|
l[c].$min = g
|
|
}
|
|
}
|
|
}
|
|
m = -Infinity;
|
|
h = Infinity;
|
|
for (c = 0; c < l.length; c++) {
|
|
if (l[c].$sum > m) {
|
|
m = l[c].$sum
|
|
}
|
|
if (l[c].$min < h) {
|
|
h = l[c].$min
|
|
}
|
|
}
|
|
if (h > 0) {
|
|
h = 0
|
|
}
|
|
}
|
|
return {
|
|
max: m,
|
|
min: h
|
|
}
|
|
},
|
|
_setBarGradient: function(w, c, s, a, q, o, h, g) {
|
|
var r, l, n, m, v, u;
|
|
if (o == "light") {
|
|
if (g == "x") {
|
|
r = w.createLinearGradient(c, s, a, s)
|
|
} else {
|
|
r = w.createLinearGradient(c, s, c, q)
|
|
}
|
|
u = [
|
|
[0, "#FFFFFF"],
|
|
[0.9, h],
|
|
[1, h]
|
|
];
|
|
l = 2
|
|
} else {
|
|
if (o == "falling" || o == "rising") {
|
|
if (g == "x") {
|
|
r = w.createLinearGradient(c, s, a, s)
|
|
} else {
|
|
r = w.createLinearGradient(c, s, c, q)
|
|
}
|
|
n = dhtmlx.math.toRgb(h);
|
|
m = dhtmlx.math.rgbToHsv(n[0], n[1], n[2]);
|
|
m[1] *= 1 / 2;
|
|
v = "rgb(" + dhtmlx.math.hsvToRgb(m[0], m[1], m[2]) + ")";
|
|
if (o == "falling") {
|
|
u = [
|
|
[0, v],
|
|
[0.7, h],
|
|
[1, h]
|
|
]
|
|
} else {
|
|
if (o == "rising") {
|
|
u = [
|
|
[0, h],
|
|
[0.3, h],
|
|
[1, v]
|
|
]
|
|
}
|
|
}
|
|
l = 0
|
|
} else {
|
|
w.globalAlpha = 0.37;
|
|
l = 0;
|
|
if (g == "x") {
|
|
r = w.createLinearGradient(c, q, c, s)
|
|
} else {
|
|
r = w.createLinearGradient(c, s, a, s)
|
|
}
|
|
u = [
|
|
[0, "#9d9d9d"],
|
|
[0.3, "#e8e8e8"],
|
|
[0.45, "#ffffff"],
|
|
[0.55, "#ffffff"],
|
|
[0.7, "#e8e8e8"],
|
|
[1, "#9d9d9d"]
|
|
]
|
|
}
|
|
}
|
|
this._gradient(r, u);
|
|
return {
|
|
gradient: r,
|
|
offset: l
|
|
}
|
|
},
|
|
_getPositionByAngle: function(g, c, l, h) {
|
|
g *= (-1);
|
|
c = c + Math.cos(g) * h;
|
|
l = l - Math.sin(g) * h;
|
|
return {
|
|
x: c,
|
|
y: l
|
|
}
|
|
},
|
|
_gradient: function(g, c) {
|
|
for (var a = 0; a < c.length; a++) {
|
|
g.addColorStop(c[a][0], c[a][1])
|
|
}
|
|
},
|
|
_path: function(a, g) {
|
|
var c, h;
|
|
for (c = 0; c < g.length; c++) {
|
|
h = (c ? "lineTo" : "moveTo");
|
|
if (g[c].length > 2) {
|
|
h = "arc"
|
|
}
|
|
a[h].apply(a, g[c])
|
|
}
|
|
},
|
|
_circle: function(c, a, h, g) {
|
|
c.arc(a, h, g, Math.PI * 2, true)
|
|
},
|
|
_addMapRect: function(h, l, a, g, c) {
|
|
h.addRect(l, [a[0].x - g.x, a[0].y - g.y, a[1].x - g.x, a[1].y - g.y], c)
|
|
}
|
|
};
|
|
dhtmlx.compat("layout");
|
|
dhtmlx.ui.pager = function(a) {
|
|
this.name = "Pager";
|
|
if (dhtmlx.assert_enabled()) {
|
|
this._assert()
|
|
}
|
|
dhtmlx.extend(this, dhtmlx.Settings);
|
|
this._parseContainer(a, "dhx_pager");
|
|
dhtmlx.extend(this, dhtmlx.EventSystem);
|
|
dhtmlx.extend(this, dhtmlx.SingleRender);
|
|
dhtmlx.extend(this, dhtmlx.MouseEvents);
|
|
this._parseSettings(a, {
|
|
size: 10,
|
|
page: -1,
|
|
group: 5,
|
|
count: 0,
|
|
type: "default"
|
|
});
|
|
this.data = this._settings;
|
|
this.refresh()
|
|
};
|
|
dhtmlx.ui.pager.prototype = {
|
|
_id: "dhx_p_id",
|
|
on_click: {
|
|
dhx_pager_item: function(a, c) {
|
|
this.select(c)
|
|
}
|
|
},
|
|
select: function(a) {
|
|
switch (a) {
|
|
case "next":
|
|
a = this._settings.page + 1;
|
|
break;
|
|
case "prev":
|
|
a = this._settings.page - 1;
|
|
break;
|
|
case "first":
|
|
a = 0;
|
|
break;
|
|
case "last":
|
|
a = this._settings.limit - 1;
|
|
break;
|
|
default:
|
|
break
|
|
}
|
|
if (a < 0) {
|
|
a = 0
|
|
}
|
|
if (a >= this.data.limit) {
|
|
a = this.data.limit - 1
|
|
}
|
|
if (this.callEvent("onBeforePageChange", [this._settings.page, a])) {
|
|
this.data.page = a * 1;
|
|
this.refresh();
|
|
this.callEvent("onAfterPageChange", [a])
|
|
}
|
|
},
|
|
types: {
|
|
"default": {
|
|
template: dhtmlx.Template.fromHTML("{common.pages()}"),
|
|
pages: function(g) {
|
|
var c = "";
|
|
if (g.page == -1) {
|
|
return ""
|
|
}
|
|
g.min = g.page - Math.round((g.group - 1) / 2);
|
|
g.max = g.min + g.group - 1;
|
|
if (g.min < 0) {
|
|
g.max += g.min * (-1);
|
|
g.min = 0
|
|
}
|
|
if (g.max >= g.limit) {
|
|
g.min -= Math.min(g.min, g.max - g.limit + 1);
|
|
g.max = g.limit - 1
|
|
}
|
|
for (var a = (g.min || 0); a <= g.max; a++) {
|
|
c += this.button({
|
|
id: a,
|
|
index: (a + 1),
|
|
selected: (a == g.page ? "_selected" : "")
|
|
})
|
|
}
|
|
return c
|
|
},
|
|
page: function(a) {
|
|
return a.page + 1
|
|
},
|
|
first: function() {
|
|
return this.button({
|
|
id: "first",
|
|
index: " << ",
|
|
selected: ""
|
|
})
|
|
},
|
|
last: function() {
|
|
return this.button({
|
|
id: "last",
|
|
index: " >> ",
|
|
selected: ""
|
|
})
|
|
},
|
|
prev: function() {
|
|
return this.button({
|
|
id: "prev",
|
|
index: "<",
|
|
selected: ""
|
|
})
|
|
},
|
|
next: function() {
|
|
return this.button({
|
|
id: "next",
|
|
index: ">",
|
|
selected: ""
|
|
})
|
|
},
|
|
button: dhtmlx.Template.fromHTML("<div dhx_p_id='{obj.id}' class='dhx_pager_item{obj.selected}'>{obj.index}</div>")
|
|
}
|
|
},
|
|
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("<div>"),
|
|
template_item_end: dhtmlx.Template.fromHTML("</div>")
|
|
};
|
|
dhtmlx.DataProcessor = {
|
|
_dp_init: function(c) {
|
|
var a = "_methods";
|
|
c[a] = ["setItemStyle", "", "changeId", "remove"];
|
|
this.attachEvent("onAfterAdd", function(g) {
|
|
c.setUpdated(g, true, "inserted")
|
|
});
|
|
this.data.attachEvent("onStoreLoad", dhtmlx.bind(function(h, g) {
|
|
if (h.getUserData) {
|
|
h.getUserData(g, this._userdata)
|
|
}
|
|
}, this));
|
|
this.attachEvent("onBeforeDelete", function(h) {
|
|
if (c._silent_mode) {
|
|
return true
|
|
}
|
|
var g = c.getState(h);
|
|
if (g == "inserted") {
|
|
c.setUpdated(h, false);
|
|
return true
|
|
}
|
|
if (g == "deleted") {
|
|
return false
|
|
}
|
|
if (g == "true_deleted") {
|
|
return true
|
|
}
|
|
c.setUpdated(h, true, "deleted");
|
|
return false
|
|
});
|
|
this.attachEvent("onAfterEditStop", function(g) {
|
|
c.setUpdated(g, true, "updated")
|
|
});
|
|
this.attachEvent("onBindUpdate", function(g) {
|
|
window.setTimeout(function() {
|
|
c.setUpdated(g.id, true, "updated")
|
|
}, 1)
|
|
});
|
|
a = "_getRowData";
|
|
c[a] = function(n, g) {
|
|
var l = this.obj.data.get(n);
|
|
var m = {};
|
|
for (var h in l) {
|
|
if (h.indexOf("_") === 0) {
|
|
continue
|
|
}
|
|
m[h] = l[h]
|
|
}
|
|
return m
|
|
};
|
|
a = "_clearUpdateFlag";
|
|
c[a] = function() {};
|
|
this._userdata = {};
|
|
c.attachEvent("insertCallback", this._dp_callback);
|
|
c.attachEvent("updateCallback", this._dp_callback);
|
|
c.attachEvent("deleteCallback", function(g, h) {
|
|
this.obj.setUserData(h, this.action_param, "true_deleted");
|
|
this.obj.remove(h)
|
|
});
|
|
dhtmlx.compat("dataProcessor", c)
|
|
},
|
|
_dp_callback: function(a, c) {
|
|
this.obj.data.set(c, dhtmlx.DataDriver.xml.getDetails(a.firstChild));
|
|
this.obj.data.refresh(c)
|
|
},
|
|
setItemStyle: function(g, a) {
|
|
var c = this._locateHTML(g);
|
|
if (c) {
|
|
c.style.cssText += ";" + a
|
|
}
|
|
},
|
|
changeId: function(c, a) {
|
|
this.data.changeId(c, a);
|
|
this.refresh()
|
|
},
|
|
setUserData: function(g, a, c) {
|
|
if (g) {
|
|
this.data.get(g)[a] = c
|
|
} else {
|
|
this._userdata[a] = c
|
|
}
|
|
},
|
|
getUserData: function(c, a) {
|
|
return c ? this.data.get(c)[a] : this._userdata[a]
|
|
}
|
|
};
|
|
(function() {
|
|
var a = "_dp_init";
|
|
dhtmlx.DataProcessor[a] = dhtmlx.DataProcessor._dp_init
|
|
})();
|
|
dhtmlx.compat.dnd = function() {
|
|
if (window.dhtmlDragAndDropObject) {
|
|
var o = "_dragged";
|
|
var h = dhtmlDragAndDropObject.prototype.checkLanding;
|
|
dhtmlDragAndDropObject.prototype.checkLanding = function(r, s, q) {
|
|
h.apply(this, arguments);
|
|
if (!q) {
|
|
var u = dhtmlx.DragControl._drag_context = dhtmlx.DragControl._drag_context || {};
|
|
if (!u.from) {
|
|
u.from = this.dragStartObject
|
|
}
|
|
dhtmlx.DragControl._checkLand(r, s, true)
|
|
}
|
|
};
|
|
var c = dhtmlDragAndDropObject.prototype.stopDrag;
|
|
dhtmlDragAndDropObject.prototype.stopDrag = function(s, q, r) {
|
|
if (!r) {
|
|
if (dhtmlx.DragControl._last) {
|
|
dhtmlx.DragControl._active = n.dragStartNode;
|
|
dhtmlx.DragControl._stopDrag(s, true)
|
|
}
|
|
}
|
|
c.apply(this, arguments)
|
|
};
|
|
var n = new dhtmlDragAndDropObject();
|
|
var l = dhtmlx.DragControl._startDrag;
|
|
dhtmlx.DragControl._startDrag = function() {
|
|
l.apply(this, arguments);
|
|
var u = dhtmlx.DragControl._drag_context;
|
|
if (!u) {
|
|
return
|
|
}
|
|
var s = [];
|
|
var r = [];
|
|
for (var q = 0; q < u.source.length; q++) {
|
|
s[q] = {
|
|
idd: u.source[q]
|
|
};
|
|
r.push(u.source[q])
|
|
}
|
|
n.dragStartNode = {
|
|
parentNode: {},
|
|
parentObject: {
|
|
idd: s,
|
|
id: (r.length == 1 ? r[0] : r),
|
|
treeNod: {
|
|
object: u.from
|
|
}
|
|
}
|
|
};
|
|
n.dragStartNode.parentObject.treeNod[o] = s;
|
|
n.dragStartObject = u.from
|
|
};
|
|
var m = dhtmlx.DragControl._checkLand;
|
|
dhtmlx.DragControl._checkLand = function(r, s, q) {
|
|
m.apply(this, arguments);
|
|
if (!this._last && !q) {
|
|
r = n.checkLanding(r, s, true)
|
|
}
|
|
};
|
|
var a = dhtmlx.DragControl._stopDrag;
|
|
dhtmlx.DragControl._stopDrag = function(r, q) {
|
|
a.apply(this, arguments);
|
|
if (n.lastLanding && !q) {
|
|
n.stopDrag(r, false, true)
|
|
}
|
|
};
|
|
var g = dhtmlx.DragControl.getMaster;
|
|
dhtmlx.DragControl.getMaster = function(r) {
|
|
var s = null;
|
|
if (r) {
|
|
s = g.apply(this, arguments)
|
|
}
|
|
if (!s) {
|
|
s = n.dragStartObject;
|
|
var u = [];
|
|
var v = s[o];
|
|
for (var q = 0; q < v.length; q++) {
|
|
u.push(v[q].idd || v[q].id)
|
|
}
|
|
dhtmlx.DragControl._drag_context.source = u
|
|
}
|
|
return s
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.DataMove = {
|
|
_init: function() {
|
|
dhtmlx.assert(this.data, "DataMove :: Component doesn't have DataStore")
|
|
},
|
|
copy: function(c, l, a, h) {
|
|
var g = this.get(c);
|
|
if (!g) {
|
|
dhtmlx.log("Warning", "Incorrect ID in DataMove::copy");
|
|
return
|
|
}
|
|
if (a) {
|
|
dhtmlx.assert(a.externalData, "DataMove :: External object doesn't support operation");
|
|
g = a.externalData(g)
|
|
}
|
|
a = a || this;
|
|
return a.add(a.externalData(g, h), l)
|
|
},
|
|
move: function(g, n, c, m) {
|
|
if (g instanceof Array) {
|
|
for (var h = 0; h < g.length; h++) {
|
|
var a = (c || this).indexById(this.move(g[h], n, c, dhtmlx.uid()));
|
|
if (g[h + 1]) {
|
|
n = a + (this.indexById(g[h + 1]) < a ? 0 : 1)
|
|
}
|
|
}
|
|
return
|
|
}
|
|
nid = g;
|
|
if (n < 0) {
|
|
dhtmlx.log("Info", "DataMove::move - moving outside of bounds is ignored");
|
|
return
|
|
}
|
|
var l = this.get(g);
|
|
if (!l) {
|
|
dhtmlx.log("Warning", "Incorrect ID in DataMove::move");
|
|
return
|
|
}
|
|
if (!c || c == this) {
|
|
this.data.move(this.indexById(g), n)
|
|
} else {
|
|
dhtmlx.assert(c.externalData, "DataMove :: External object doesn't support operation");
|
|
nid = c.add(c.externalData(l, m), n);
|
|
this.remove(g)
|
|
}
|
|
return nid
|
|
},
|
|
moveUp: function(c, a) {
|
|
return this.move(c, this.indexById(c) - (a || 1))
|
|
},
|
|
moveDown: function(c, a) {
|
|
return this.moveUp(c, (a || 1) * -1)
|
|
},
|
|
moveTop: function(a) {
|
|
return this.move(a, 0)
|
|
},
|
|
moveBottom: function(a) {
|
|
return this.move(a, this.data.dataCount() - 1)
|
|
},
|
|
externalData: function(a, g) {
|
|
var c = dhtmlx.extend({}, a);
|
|
c.id = g || dhtmlx.uid();
|
|
c.$selected = c.$template = null;
|
|
return c
|
|
}
|
|
};
|
|
dhtmlx.DragControl = {
|
|
_drag_masters: dhtmlx.toArray(["dummy"]),
|
|
addDrop: function(c, g, a) {
|
|
c = dhtmlx.toNode(c);
|
|
c.dhx_drop = this._getCtrl(g);
|
|
if (a) {
|
|
c.dhx_master = true
|
|
}
|
|
},
|
|
_getCtrl: function(c) {
|
|
c = c || dhtmlx.DragControl;
|
|
var a = this._drag_masters.find(c);
|
|
if (a < 0) {
|
|
a = this._drag_masters.length;
|
|
this._drag_masters.push(c)
|
|
}
|
|
return a
|
|
},
|
|
addDrag: function(a, c) {
|
|
a = dhtmlx.toNode(a);
|
|
a.dhx_drag = this._getCtrl(c);
|
|
dhtmlx.event(a, "mousedown", this._preStart, a)
|
|
},
|
|
_preStart: function(a) {
|
|
if (dhtmlx.DragControl._active) {
|
|
dhtmlx.DragControl._preStartFalse();
|
|
dhtmlx.DragControl.destroyDrag()
|
|
}
|
|
dhtmlx.DragControl._active = this;
|
|
dhtmlx.DragControl._start_pos = {
|
|
x: a.pageX,
|
|
y: a.pageY
|
|
};
|
|
dhtmlx.DragControl._dhx_drag_mm = dhtmlx.event(document.body, "mousemove", dhtmlx.DragControl._startDrag);
|
|
dhtmlx.DragControl._dhx_drag_mu = dhtmlx.event(document.body, "mouseup", dhtmlx.DragControl._preStartFalse);
|
|
dhtmlx.DragControl._dhx_drag_sc = dhtmlx.event(this, "scroll", dhtmlx.DragControl._preStartFalse);
|
|
a.cancelBubble = true;
|
|
return false
|
|
},
|
|
_preStartFalse: function(a) {
|
|
dhtmlx.DragControl._dhx_drag_mm = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mm);
|
|
dhtmlx.DragControl._dhx_drag_mu = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mu);
|
|
dhtmlx.DragControl._dhx_drag_sc = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_sc)
|
|
},
|
|
_startDrag: function(a) {
|
|
var c = {
|
|
x: a.pageX,
|
|
y: a.pageY
|
|
};
|
|
if (Math.abs(c.x - dhtmlx.DragControl._start_pos.x) < 5 && Math.abs(c.y - dhtmlx.DragControl._start_pos.y) < 5) {
|
|
return
|
|
}
|
|
dhtmlx.DragControl._preStartFalse();
|
|
if (!dhtmlx.DragControl.createDrag(a)) {
|
|
return
|
|
}
|
|
dhtmlx.DragControl.sendSignal("start");
|
|
dhtmlx.DragControl._dhx_drag_mm = dhtmlx.event(document.body, "mousemove", dhtmlx.DragControl._moveDrag);
|
|
dhtmlx.DragControl._dhx_drag_mu = dhtmlx.event(document.body, "mouseup", dhtmlx.DragControl._stopDrag);
|
|
dhtmlx.DragControl._moveDrag(a)
|
|
},
|
|
_stopDrag: function(a) {
|
|
dhtmlx.DragControl._dhx_drag_mm = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mm);
|
|
dhtmlx.DragControl._dhx_drag_mu = dhtmlx.eventRemove(dhtmlx.DragControl._dhx_drag_mu);
|
|
if (dhtmlx.DragControl._last) {
|
|
dhtmlx.DragControl.onDrop(dhtmlx.DragControl._active, dhtmlx.DragControl._last, this._landing, a);
|
|
dhtmlx.DragControl.onDragOut(dhtmlx.DragControl._active, dhtmlx.DragControl._last, null, a)
|
|
}
|
|
dhtmlx.DragControl.destroyDrag();
|
|
dhtmlx.DragControl.sendSignal("stop")
|
|
},
|
|
_moveDrag: function(a) {
|
|
var c = dhtmlx.html.pos(a);
|
|
dhtmlx.DragControl._html.style.top = c.y + dhtmlx.DragControl.top + "px";
|
|
dhtmlx.DragControl._html.style.left = c.x + dhtmlx.DragControl.left + "px";
|
|
if (dhtmlx.DragControl._skip) {
|
|
dhtmlx.DragControl._skip = false
|
|
} else {
|
|
dhtmlx.DragControl._checkLand((a.srcElement || a.target), a)
|
|
}
|
|
a.cancelBubble = true;
|
|
return false
|
|
},
|
|
_checkLand: function(a, c) {
|
|
while (a && a.tagName != "BODY") {
|
|
if (a.dhx_drop) {
|
|
if (this._last && (this._last != a || a.dhx_master)) {
|
|
this.onDragOut(this._active, this._last, a, c)
|
|
}
|
|
if (!this._last || this._last != a || a.dhx_master) {
|
|
this._last = null;
|
|
this._landing = this.onDragIn(dhtmlx.DragControl._active, a, c);
|
|
if (this._landing) {
|
|
this._last = a
|
|
}
|
|
return
|
|
}
|
|
return
|
|
}
|
|
a = a.parentNode
|
|
}
|
|
if (this._last) {
|
|
this._last = this._landing = this.onDragOut(this._active, this._last, null, c)
|
|
}
|
|
},
|
|
sendSignal: function(a) {
|
|
dhtmlx.DragControl.active = (a == "start")
|
|
},
|
|
getMaster: function(a) {
|
|
return this._drag_masters[a.dhx_drag || a.dhx_drop]
|
|
},
|
|
getContext: function(a) {
|
|
return this._drag_context
|
|
},
|
|
createDrag: function(l) {
|
|
var g = dhtmlx.DragControl._active;
|
|
var h = this._drag_masters[g.dhx_drag];
|
|
var c;
|
|
if (h.onDragCreate) {
|
|
c = h.onDragCreate(g, l);
|
|
c.style.position = "absolute";
|
|
c.style.zIndex = dhtmlx.zIndex.drag;
|
|
c.onmousemove = dhtmlx.DragControl._skip_mark
|
|
} else {
|
|
var m = dhtmlx.DragControl.onDrag(g, l);
|
|
if (!m) {
|
|
return false
|
|
}
|
|
var c = document.createElement("DIV");
|
|
c.innerHTML = m;
|
|
c.className = "dhx_drag_zone";
|
|
c.onmousemove = dhtmlx.DragControl._skip_mark;
|
|
document.body.appendChild(c)
|
|
}
|
|
dhtmlx.DragControl._html = c;
|
|
return true
|
|
},
|
|
_skip_mark: function() {
|
|
dhtmlx.DragControl._skip = true
|
|
},
|
|
destroyDrag: function() {
|
|
var c = dhtmlx.DragControl._active;
|
|
var g = this._drag_masters[c.dhx_drag];
|
|
if (g && g.onDragDestroy) {
|
|
g.onDragDestroy(c, dhtmlx.DragControl._html)
|
|
} else {
|
|
dhtmlx.html.remove(dhtmlx.DragControl._html)
|
|
}
|
|
dhtmlx.DragControl._landing = dhtmlx.DragControl._active = dhtmlx.DragControl._last = dhtmlx.DragControl._html = null
|
|
},
|
|
top: 5,
|
|
left: 5,
|
|
onDragIn: function(g, c, h) {
|
|
var a = this._drag_masters[c.dhx_drop];
|
|
if (a.onDragIn && a != this) {
|
|
return a.onDragIn(g, c, h)
|
|
}
|
|
c.className = c.className + " dhx_drop_zone";
|
|
return c
|
|
},
|
|
onDragOut: function(g, c, l, h) {
|
|
var a = this._drag_masters[c.dhx_drop];
|
|
if (a.onDragOut && a != this) {
|
|
return a.onDragOut(g, c, l, h)
|
|
}
|
|
c.className = c.className.replace("dhx_drop_zone", "");
|
|
return null
|
|
},
|
|
onDrop: function(g, c, l, h) {
|
|
var a = this._drag_masters[c.dhx_drop];
|
|
dhtmlx.DragControl._drag_context.from = dhtmlx.DragControl.getMaster(g);
|
|
if (a.onDrop && a != this) {
|
|
return a.onDrop(g, c, l, h)
|
|
}
|
|
c.appendChild(g)
|
|
},
|
|
onDrag: function(c, g) {
|
|
var a = this._drag_masters[c.dhx_drag];
|
|
if (a.onDrag && a != this) {
|
|
return a.onDrag(c, g)
|
|
}
|
|
dhtmlx.DragControl._drag_context = {
|
|
source: c,
|
|
from: c
|
|
};
|
|
return "<div style='" + c.style.cssText + "'>" + c.innerHTML + "</div>"
|
|
}
|
|
};
|
|
dhtmlx.DragItem = {
|
|
_init: function() {
|
|
dhtmlx.assert(this.move, "DragItem :: Component doesn't have DataMove interface");
|
|
dhtmlx.assert(this.locate, "DragItem :: Component doesn't have RenderStack interface");
|
|
dhtmlx.assert(dhtmlx.DragControl, "DragItem :: DragControl is not included");
|
|
if (!this._settings || this._settings.drag) {
|
|
dhtmlx.DragItem._initHandlers(this)
|
|
} else {
|
|
if (this._settings) {
|
|
this.drag_setter = function(a) {
|
|
if (a) {
|
|
this._initHandlers(this);
|
|
delete this.drag_setter
|
|
}
|
|
return a
|
|
}
|
|
}
|
|
} if (this.dragMarker) {
|
|
this.attachEvent("onBeforeDragIn", this.dragMarker);
|
|
this.attachEvent("onDragOut", this.dragMarker)
|
|
}
|
|
},
|
|
_initHandlers: function(a) {
|
|
dhtmlx.DragControl.addDrop(a._obj, a, true);
|
|
dhtmlx.DragControl.addDrag(a._obj, a)
|
|
},
|
|
onDragIn: function(h, g, l) {
|
|
var n = this.locate(l) || null;
|
|
var c = dhtmlx.DragControl._drag_context;
|
|
var m = dhtmlx.DragControl.getMaster(h);
|
|
var a = (this._locateHTML(n) || this._obj);
|
|
if (a == dhtmlx.DragControl._landing) {
|
|
return a
|
|
}
|
|
c.target = n;
|
|
c.to = m;
|
|
if (!this.callEvent("onBeforeDragIn", [c, l])) {
|
|
c.id = null;
|
|
return null
|
|
}
|
|
dhtmlx.html.addCss(a, "dhx_drag_over");
|
|
return a
|
|
},
|
|
onDragOut: function(h, g, o, l) {
|
|
var m = this.locate(l) || null;
|
|
if (o != this._dataobj) {
|
|
m = null
|
|
}
|
|
var c = (this._locateHTML(m) || (o ? dhtmlx.DragControl.getMaster(o)._obj : window.undefined));
|
|
if (c == dhtmlx.DragControl._landing) {
|
|
return null
|
|
}
|
|
var a = dhtmlx.DragControl._drag_context;
|
|
dhtmlx.html.removeCss(dhtmlx.DragControl._landing, "dhx_drag_over");
|
|
a.target = a.to = null;
|
|
this.callEvent("onDragOut", [a, l]);
|
|
return null
|
|
},
|
|
onDrop: function(g, c, l, h) {
|
|
var a = dhtmlx.DragControl._drag_context;
|
|
a.to = this;
|
|
a.index = a.target ? this.indexById(a.target) : this.dataCount();
|
|
a.new_id = dhtmlx.uid();
|
|
if (!this.callEvent("onBeforeDrop", [a, h])) {
|
|
return
|
|
}
|
|
if (a.from == a.to) {
|
|
this.move(a.source, a.index)
|
|
} else {
|
|
if (a.from) {
|
|
a.from.move(a.source, a.index, a.to, a.new_id)
|
|
} else {
|
|
dhtmlx.error("Unsopported d-n-d combination")
|
|
}
|
|
}
|
|
this.callEvent("onAfterDrop", [a, h])
|
|
},
|
|
onDrag: function(g, l) {
|
|
var m = this.locate(l);
|
|
var h = [m];
|
|
if (m) {
|
|
if (this.getSelected) {
|
|
var c = this.getSelected();
|
|
if (dhtmlx.PowerArray.find.call(c, m) != -1) {
|
|
h = c
|
|
}
|
|
}
|
|
var a = dhtmlx.DragControl._drag_context = {
|
|
source: h,
|
|
start: m
|
|
};
|
|
a.from = this;
|
|
if (this.callEvent("onBeforeDrag", [a, l])) {
|
|
return a.html || this._toHTML(this.get(m))
|
|
}
|
|
}
|
|
return null
|
|
}
|
|
};
|
|
dhtmlx.EditAbility = {
|
|
_init: function(a) {
|
|
this._edit_id = null;
|
|
this._edit_bind = null;
|
|
dhtmlx.assert(this.data, "EditAbility :: Component doesn't have DataStore");
|
|
dhtmlx.assert(this._locateHTML, "EditAbility :: Component doesn't have RenderStack");
|
|
this.attachEvent("onEditKeyPress", function(g, h, c) {
|
|
if (g == 13 && !c) {
|
|
this.stopEdit()
|
|
} else {
|
|
if (g == 27) {
|
|
this.stopEdit(true)
|
|
}
|
|
}
|
|
});
|
|
this.attachEvent("onBeforeRender", function() {
|
|
this.stopEdit()
|
|
})
|
|
},
|
|
isEdit: function() {
|
|
return this._edit_id
|
|
},
|
|
edit: function(c) {
|
|
if (this.stopEdit(false, c)) {
|
|
if (!this.callEvent("onBeforeEditStart", [c])) {
|
|
return
|
|
}
|
|
var a = this.data.get(c);
|
|
if (a.$template) {
|
|
return
|
|
}
|
|
a.$template = "edit";
|
|
this.data.refresh(c);
|
|
this._edit_id = c;
|
|
this._save_binding(c);
|
|
this._edit_bind(true, a);
|
|
this.callEvent("onAfterEditStart", [c])
|
|
}
|
|
},
|
|
stopEdit: function(g, l) {
|
|
if (!this._edit_id) {
|
|
return true
|
|
}
|
|
if (this._edit_id == l) {
|
|
return false
|
|
}
|
|
var a = {};
|
|
if (!g) {
|
|
this._edit_bind(false, a)
|
|
} else {
|
|
a = null
|
|
} if (!this.callEvent("onBeforeEditStop", [this._edit_id, a])) {
|
|
return false
|
|
}
|
|
var c = this.data.get(this._edit_id);
|
|
c.$template = null;
|
|
if (!g) {
|
|
this._edit_bind(false, c)
|
|
}
|
|
var h = this._edit_id;
|
|
this._edit_bind = this._edit_id = null;
|
|
this.data.refresh(h);
|
|
this.callEvent("onAfterEditStop", [h, a]);
|
|
return true
|
|
},
|
|
_save_binding: function(o) {
|
|
var a = this._locateHTML(o);
|
|
var g = "";
|
|
var m = "";
|
|
var l = [];
|
|
if (a) {
|
|
var h = a.getElementsByTagName("*");
|
|
var n = "";
|
|
for (var c = 0; c < h.length; c++) {
|
|
if (h[c].nodeType == 1 && (n = h[c].getAttribute("bind"))) {
|
|
g += "els[" + l.length + "].value=" + n + ";";
|
|
m += n + "=els[" + l.length + "].value;";
|
|
l.push(h[c]);
|
|
h[c].className += " dhx_allow_selection";
|
|
h[c].onselectstart = this._block_native
|
|
}
|
|
}
|
|
h = null
|
|
}
|
|
g = Function("obj", "els", g);
|
|
m = Function("obj", "els", m);
|
|
this._edit_bind = function(r, q) {
|
|
if (r) {
|
|
g(q, l);
|
|
if (l.length && l[0].select) {
|
|
l[0].select()
|
|
}
|
|
} else {
|
|
m(q, l)
|
|
}
|
|
}
|
|
},
|
|
_block_native: function(a) {
|
|
(a || event).cancelBubble = true;
|
|
return true
|
|
}
|
|
};
|
|
dhtmlx.SelectionModel = {
|
|
_init: function() {
|
|
this._selected = dhtmlx.toArray();
|
|
dhtmlx.assert(this.data, "SelectionModel :: Component doesn't have DataStore");
|
|
this.data.attachEvent("onStoreUpdated", dhtmlx.bind(this._data_updated, this));
|
|
this.data.attachEvent("onStoreLoad", dhtmlx.bind(this._data_loaded, this));
|
|
this.data.attachEvent("onAfterFilter", dhtmlx.bind(this._data_filtered, this));
|
|
this.data.attachEvent("onIdChange", dhtmlx.bind(this._id_changed, this))
|
|
},
|
|
_id_changed: function(g, a) {
|
|
for (var c = this._selected.length - 1; c >= 0; c--) {
|
|
if (this._selected[c] == g) {
|
|
this._selected[c] = a
|
|
}
|
|
}
|
|
},
|
|
_data_filtered: function() {
|
|
for (var a = this._selected.length - 1; a >= 0; a--) {
|
|
if (this.data.indexById(this._selected[a]) < 0) {
|
|
var g = this._selected[a]
|
|
}
|
|
var c = this.item(g);
|
|
if (c) {
|
|
delete c.$selected
|
|
}
|
|
this._selected.splice(a, 1);
|
|
this.callEvent("onSelectChange", [g])
|
|
}
|
|
},
|
|
_data_updated: function(g, c, a) {
|
|
if (a == "delete") {
|
|
this._selected.remove(g)
|
|
} else {
|
|
if (!this.data.dataCount() && !this.data._filter_order) {
|
|
this._selected = dhtmlx.toArray()
|
|
}
|
|
}
|
|
},
|
|
_data_loaded: function() {
|
|
if (this._settings.select) {
|
|
this.data.each(function(a) {
|
|
if (a.$selected) {
|
|
this.select(a.id)
|
|
}
|
|
}, this)
|
|
}
|
|
},
|
|
_select_mark: function(g, c, a) {
|
|
if (!a && !this.callEvent("onBeforeSelect", [g, c])) {
|
|
return false
|
|
}
|
|
this.data.item(g).$selected = c;
|
|
if (a) {
|
|
a.push(g)
|
|
} else {
|
|
if (c) {
|
|
this._selected.push(g)
|
|
} else {
|
|
this._selected.remove(g)
|
|
}
|
|
this._refresh_selection(g)
|
|
}
|
|
return true
|
|
},
|
|
select: function(h, g, a) {
|
|
if (!h) {
|
|
return this.selectAll()
|
|
}
|
|
if (h instanceof Array) {
|
|
for (var c = 0; c < h.length; c++) {
|
|
this.select(h[c], g, a)
|
|
}
|
|
return
|
|
}
|
|
if (!this.data.exists(h)) {
|
|
dhtmlx.error("Incorrect id in select command: " + h);
|
|
return
|
|
}
|
|
if (a && this._selected.length) {
|
|
return this.selectAll(this._selected[this._selected.length - 1], h)
|
|
}
|
|
if (!g && (this._selected.length != 1 || this._selected[0] != h)) {
|
|
this._silent_selection = true;
|
|
this.unselectAll();
|
|
this._silent_selection = false
|
|
}
|
|
if (this.isSelected(h)) {
|
|
if (g) {
|
|
this.unselect(h)
|
|
}
|
|
return
|
|
}
|
|
if (this._select_mark(h, true)) {
|
|
this.callEvent("onAfterSelect", [h])
|
|
}
|
|
},
|
|
unselect: function(a) {
|
|
if (!a) {
|
|
return this.unselectAll()
|
|
}
|
|
if (!this.isSelected(a)) {
|
|
return
|
|
}
|
|
this._select_mark(a, false)
|
|
},
|
|
selectAll: function(h, g) {
|
|
var a;
|
|
var c = [];
|
|
if (h || g) {
|
|
a = this.data.getRange(h || null, g || null)
|
|
} else {
|
|
a = this.data.getRange()
|
|
}
|
|
a.each(function(l) {
|
|
var m = this.data.item(l.id);
|
|
if (!m.$selected) {
|
|
this._selected.push(l.id);
|
|
this._select_mark(l.id, true, c)
|
|
}
|
|
return l.id
|
|
}, this);
|
|
this._refresh_selection(c)
|
|
},
|
|
unselectAll: function() {
|
|
var a = [];
|
|
this._selected.each(function(c) {
|
|
this._select_mark(c, false, a)
|
|
}, this);
|
|
this._selected = dhtmlx.toArray();
|
|
this._refresh_selection(a)
|
|
},
|
|
isSelected: function(a) {
|
|
return this._selected.find(a) != -1
|
|
},
|
|
getSelected: function(a) {
|
|
switch (this._selected.length) {
|
|
case 0:
|
|
return a ? [] : "";
|
|
case 1:
|
|
return a ? [this._selected[0]] : this._selected[0];
|
|
default:
|
|
return ([].concat(this._selected))
|
|
}
|
|
},
|
|
_is_mass_selection: function(a) {
|
|
return a.length > 100 || a.length > this.data.dataCount / 2
|
|
},
|
|
_refresh_selection: function(c) {
|
|
if (typeof c != "object") {
|
|
c = [c]
|
|
}
|
|
if (!c.length) {
|
|
return
|
|
}
|
|
if (this._is_mass_selection(c)) {
|
|
this.data.refresh()
|
|
} else {
|
|
for (var a = 0; a < c.length; a++) {
|
|
this.render(c[a], this.data.item(c[a]), "update")
|
|
}
|
|
} if (!this._silent_selection) {
|
|
this.callEvent("onSelectChange", [c])
|
|
}
|
|
}
|
|
};
|
|
dhtmlx.RenderStack = {
|
|
_init: function() {
|
|
dhtmlx.assert(this.data, "RenderStack :: Component doesn't have DataStore");
|
|
dhtmlx.assert(dhtmlx.Template, "dhtmlx.Template :: dhtmlx.Template is not accessible");
|
|
this._html = document.createElement("DIV")
|
|
},
|
|
_toHTML: function(a) {
|
|
dhtmlx.assert((!a.$template || this.type["template_" + a.$template]), "RenderStack :: Unknown template: " + a.$template);
|
|
this.callEvent("onItemRender", [a]);
|
|
return this.type._item_start(a, this.type) + (a.$template ? this.type["template_" + a.$template] : this.type.template)(a, this.type) + this.type._item_end
|
|
},
|
|
_toHTMLObject: function(a) {
|
|
this._html.innerHTML = this._toHTML(a);
|
|
return this._html.firstChild
|
|
},
|
|
_locateHTML: function(a) {
|
|
if (this._htmlmap) {
|
|
return this._htmlmap[a]
|
|
}
|
|
this._htmlmap = {};
|
|
var g = this._dataobj.childNodes;
|
|
for (var c = 0; c < g.length; c++) {
|
|
var h = g[c].getAttribute(this._id);
|
|
if (h) {
|
|
this._htmlmap[h] = g[c]
|
|
}
|
|
}
|
|
return this._locateHTML(a)
|
|
},
|
|
locate: function(a) {
|
|
return dhtmlx.html.locate(a, this._id)
|
|
},
|
|
show: function(c) {
|
|
var a = this._locateHTML(c);
|
|
if (a) {
|
|
this._dataobj.scrollTop = a.offsetTop - this._dataobj.offsetTop
|
|
}
|
|
},
|
|
render: function(m, h, g, l) {
|
|
if (m) {
|
|
var a = this._locateHTML(m);
|
|
switch (g) {
|
|
case "update":
|
|
if (!a) {
|
|
return
|
|
}
|
|
var c = this._htmlmap[m] = this._toHTMLObject(h);
|
|
dhtmlx.html.insertBefore(c, a);
|
|
dhtmlx.html.remove(a);
|
|
break;
|
|
case "delete":
|
|
if (!a) {
|
|
return
|
|
}
|
|
dhtmlx.html.remove(a);
|
|
delete this._htmlmap[m];
|
|
break;
|
|
case "add":
|
|
var c = this._htmlmap[m] = this._toHTMLObject(h);
|
|
dhtmlx.html.insertBefore(c, this._locateHTML(this.data.next(m)), this._dataobj);
|
|
break;
|
|
case "move":
|
|
this.render(m, h, "delete");
|
|
this.render(m, h, "add");
|
|
break;
|
|
default:
|
|
dhtmlx.error("Unknown render command: " + g);
|
|
break
|
|
}
|
|
} else {
|
|
if (this.callEvent("onBeforeRender", [this.data])) {
|
|
this._dataobj.innerHTML = this.data.getRange().map(this._toHTML, this).join("");
|
|
this._htmlmap = null
|
|
}
|
|
}
|
|
this.callEvent("onAfterRender", [])
|
|
},
|
|
pager_setter: function(c) {
|
|
this.attachEvent("onBeforeRender", function() {
|
|
var h = this._settings.pager._settings;
|
|
if (h.page == -1) {
|
|
return false
|
|
}
|
|
this.data.min = h.page * h.size;
|
|
this.data.max = (h.page + 1) * h.size - 1;
|
|
return true
|
|
});
|
|
var a = new dhtmlx.ui.pager(c);
|
|
var g = dhtmlx.bind(function() {
|
|
this.data.refresh()
|
|
}, this);
|
|
a.attachEvent("onRefresh", g);
|
|
this.data.attachEvent("onStoreUpdated", function(l) {
|
|
var h = this.dataCount();
|
|
if (h != a._settings.count) {
|
|
a._settings.count = h;
|
|
if (a._settings.page == -1) {
|
|
a._settings.page = 0
|
|
}
|
|
a.refresh()
|
|
}
|
|
});
|
|
return a
|
|
},
|
|
height_setter: function(a) {
|
|
if (a == "auto") {
|
|
this.attachEvent("onAfterRender", this._correct_height);
|
|
dhtmlx.event(window, "resize", dhtmlx.bind(this._correct_height, this))
|
|
}
|
|
return a
|
|
},
|
|
_correct_height: function() {
|
|
this._dataobj.style.overflow = "hidden";
|
|
this._dataobj.style.height = "1px";
|
|
var a = this._dataobj.scrollHeight;
|
|
this._dataobj.style.height = a + "px";
|
|
if (dhtmlx._isFF) {
|
|
var c = this._dataobj.scrollHeight;
|
|
if (c != a) {
|
|
this._dataobj.style.height = c + "px"
|
|
}
|
|
}
|
|
this._obj.style.height = this._dataobj.style.height
|
|
},
|
|
_getDimension: function() {
|
|
var a = this.type;
|
|
var c = (a.border || 0) + (a.padding || 0) * 2 + (a.margin || 0) * 2;
|
|
return {
|
|
x: a.width + c,
|
|
y: a.height + c
|
|
}
|
|
},
|
|
x_count_setter: function(c) {
|
|
var g = this._getDimension();
|
|
var a = dhtmlx.$customScroll ? 0 : 18;
|
|
this._dataobj.style.width = g.x * c + (this._settings.height != "auto" ? a : 0) + "px";
|
|
return c
|
|
},
|
|
y_count_setter: function(a) {
|
|
var c = this._getDimension();
|
|
this._dataobj.style.height = c.y * a + "px";
|
|
return a
|
|
}
|
|
};
|
|
dhtmlx.VirtualRenderStack = {
|
|
_init: function() {
|
|
dhtmlx.assert(this.render, "VirtualRenderStack :: Object must use RenderStack first");
|
|
this._htmlmap = {};
|
|
this._dataobj.style.overflowY = "scroll";
|
|
dhtmlx.event(this._dataobj, "scroll", dhtmlx.bind(this._render_visible_rows, this));
|
|
dhtmlx.event(window, "resize", dhtmlx.bind(function() {
|
|
this.render()
|
|
}, this));
|
|
this.data._unrendered_area = [];
|
|
this.data.getIndexRange = this._getIndexRange
|
|
},
|
|
_locateHTML: function(a) {
|
|
return this._htmlmap[a]
|
|
},
|
|
show: function(g) {
|
|
range = this._getVisibleRange();
|
|
var c = this.data.indexById(g);
|
|
var a = Math.floor(c / range._dx) * range._y;
|
|
this._dataobj.scrollTop = a
|
|
},
|
|
_getIndexRange: function(l, h) {
|
|
if (h !== 0) {
|
|
h = Math.min((h || Infinity), this.dataCount() - 1)
|
|
}
|
|
var a = dhtmlx.toArray();
|
|
for (var c = (l || 0); c <= h; c++) {
|
|
var g = this.item(this.order[c]);
|
|
if (this.order.length > c) {
|
|
if (!g) {
|
|
this.order[c] = dhtmlx.uid();
|
|
g = {
|
|
id: this.order[c],
|
|
$template: "loading"
|
|
};
|
|
this._unrendered_area.push(this.order[c])
|
|
} else {
|
|
if (g.$template == "loading") {
|
|
this._unrendered_area.push(this.order[c])
|
|
}
|
|
}
|
|
a.push(g)
|
|
}
|
|
}
|
|
return a
|
|
},
|
|
render: function(m, h, g, l) {
|
|
if (m) {
|
|
var a = this._locateHTML(m);
|
|
switch (g) {
|
|
case "update":
|
|
if (!a) {
|
|
return
|
|
}
|
|
var c = this._htmlmap[m] = this._toHTMLObject(h);
|
|
dhtmlx.html.insertBefore(c, a);
|
|
dhtmlx.html.remove(a);
|
|
break;
|
|
default:
|
|
this._render_delayed();
|
|
break
|
|
}
|
|
} else {
|
|
if (this.callEvent("onBeforeRender", [this.data])) {
|
|
this._htmlmap = {};
|
|
this._render_visible_rows(null, true);
|
|
this._wait_for_render = false;
|
|
this.callEvent("onAfterRender", [])
|
|
}
|
|
}
|
|
},
|
|
_render_delayed: function() {
|
|
if (this._wait_for_render) {
|
|
return
|
|
}
|
|
this._wait_for_render = true;
|
|
window.setTimeout(dhtmlx.bind(function() {
|
|
this.render()
|
|
}, this), 1)
|
|
},
|
|
_create_placeholder: function(a) {
|
|
var c = document.createElement("DIV");
|
|
c.style.cssText = "height:" + a + "px; width:100%; overflow:hidden;";
|
|
return c
|
|
},
|
|
_render_visible_rows: function(A, E) {
|
|
this.data._unrendered_area = [];
|
|
var y = this._getVisibleRange();
|
|
if (!this._dataobj.firstChild || E) {
|
|
this._dataobj.innerHTML = "";
|
|
this._dataobj.appendChild(this._create_placeholder(y._max));
|
|
this._htmlrows = [this._dataobj.firstChild]
|
|
}
|
|
var l = Math.max(y._from, 0);
|
|
var x = (this.data.max || this.data.max === 0) ? this.data.max : Infinity;
|
|
while (l <= y._height) {
|
|
while (this._htmlrows[l] && this._htmlrows[l]._filled && l <= y._height) {
|
|
l++
|
|
}
|
|
if (l > y._height) {
|
|
break
|
|
}
|
|
var o = l;
|
|
while (!this._htmlrows[o]) {
|
|
o--
|
|
}
|
|
var a = this._htmlrows[o];
|
|
var g = l * y._dx + (this.data.min || 0);
|
|
if (g > x) {
|
|
break
|
|
}
|
|
var m = Math.min(g + y._dx - 1, x);
|
|
var r = this._create_placeholder(y._y);
|
|
var n = this.data.getIndexRange(g, m);
|
|
if (!n.length) {
|
|
break
|
|
}
|
|
r.innerHTML = n.map(this._toHTML, this).join("");
|
|
for (var v = 0; v < n.length; v++) {
|
|
this._htmlmap[this.data.idByIndex(g + v)] = r.childNodes[v]
|
|
}
|
|
var w = parseInt(a.style.height, 10);
|
|
var D = (l - o) * y._y;
|
|
var u = (w - D - y._y);
|
|
dhtmlx.html.insertBefore(r, D ? a.nextSibling : a, this._dataobj);
|
|
this._htmlrows[l] = r;
|
|
r._filled = true;
|
|
if (D <= 0 && u > 0) {
|
|
a.style.height = u + "px";
|
|
this._htmlrows[l + 1] = a
|
|
} else {
|
|
if (D < 0) {
|
|
dhtmlx.html.remove(a)
|
|
} else {
|
|
a.style.height = D + "px"
|
|
} if (u > 0) {
|
|
var q = this._htmlrows[l + 1] = this._create_placeholder(u);
|
|
dhtmlx.html.insertBefore(q, r.nextSibling, this._dataobj)
|
|
}
|
|
}
|
|
l++
|
|
}
|
|
if (this.data._unrendered_area.length) {
|
|
var s = this.indexById(this.data._unrendered_area[0]);
|
|
var c = this.indexById(this.data._unrendered_area.pop()) + 1;
|
|
if (c > s) {
|
|
if (!this.callEvent("onDataRequest", [s, c - s])) {
|
|
return false
|
|
}
|
|
dhtmlx.assert(this.data.feed, "Data feed is missed");
|
|
this.data.feed.call(this, s, c - s)
|
|
}
|
|
}
|
|
if (dhtmlx._isIE) {
|
|
var C = this._getVisibleRange();
|
|
if (C._from != y._from) {
|
|
this._render_visible_rows()
|
|
}
|
|
}
|
|
},
|
|
_getVisibleRange: function() {
|
|
var c = dhtmlx.$customScroll ? 0 : 18;
|
|
var n = this._dataobj.scrollTop;
|
|
var a = Math.max(this._dataobj.scrollWidth, this._dataobj.offsetWidth) - c;
|
|
var o = this._dataobj.offsetHeight;
|
|
var r = this.type;
|
|
var h = this._getDimension();
|
|
var s = Math.floor(a / h.x) || 1;
|
|
var g = Math.floor(n / h.y);
|
|
var q = Math.ceil((o + n) / h.y) - 1;
|
|
var l = this.data.max ? (this.data.max - this.data.min) : this.data.dataCount();
|
|
var m = Math.ceil(l / s) * h.y;
|
|
return {
|
|
_from: g,
|
|
_height: q,
|
|
_top: n,
|
|
_max: m,
|
|
_y: h.y,
|
|
_dx: s
|
|
}
|
|
}
|
|
};
|
|
dhtmlXDataView = function(a) {
|
|
this.name = "DataView";
|
|
this.version = "3.0";
|
|
if (dhtmlx.assert_enabled()) {
|
|
this._assert()
|
|
}
|
|
dhtmlx.extend(this, dhtmlx.Settings);
|
|
this._parseContainer(a, "dhx_dataview");
|
|
dhtmlx.extend(this, dhtmlx.AtomDataLoader);
|
|
dhtmlx.extend(this, dhtmlx.DataLoader);
|
|
dhtmlx.extend(this, dhtmlx.EventSystem);
|
|
dhtmlx.extend(this, dhtmlx.RenderStack);
|
|
dhtmlx.extend(this, dhtmlx.SelectionModel);
|
|
dhtmlx.extend(this, dhtmlx.MouseEvents);
|
|
dhtmlx.extend(this, dhtmlx.KeyEvents);
|
|
dhtmlx.extend(this, dhtmlx.EditAbility);
|
|
dhtmlx.extend(this, dhtmlx.DataMove);
|
|
dhtmlx.extend(this, dhtmlx.DragItem);
|
|
dhtmlx.extend(this, dhtmlx.DataProcessor);
|
|
dhtmlx.extend(this, dhtmlx.AutoTooltip);
|
|
dhtmlx.extend(this, dhtmlx.Destruction);
|
|
this.data.attachEvent("onStoreUpdated", dhtmlx.bind(function() {
|
|
this.render.apply(this, arguments)
|
|
}, this));
|
|
this._parseSettings(a, {
|
|
drag: false,
|
|
edit: false,
|
|
select: "multiselect",
|
|
type: "default"
|
|
});
|
|
if (this._settings.height != "auto" && !this._settings.renderAll) {
|
|
dhtmlx.extend(this, dhtmlx.VirtualRenderStack)
|
|
}
|
|
this.data.provideApi(this, true);
|
|
if (dhtmlx.$customScroll) {
|
|
dhtmlx.CustomScroll.enable(this)
|
|
}
|
|
};
|
|
dhtmlXDataView.prototype = {
|
|
bind: function() {
|
|
dhx.BaseBind.legacyBind.apply(this, arguments)
|
|
},
|
|
sync: function() {
|
|
dhx.BaseBind.legacySync.apply(this, arguments)
|
|
},
|
|
dragMarker: function(g, l) {
|
|
var h = this._locateHTML(g.target);
|
|
if (this.type.drag_marker) {
|
|
if (this._drag_marker) {
|
|
this._drag_marker.style.backgroundImage = "";
|
|
this._drag_marker.style.backgroundRepeat = ""
|
|
}
|
|
if (h) {
|
|
h.style.backgroundImage = "url(" + (dhtmlx.image_path || "") + this.type.drag_marker + ")";
|
|
h.style.backgroundRepeat = "no-repeat";
|
|
this._drag_marker = h
|
|
}
|
|
}
|
|
if (h && this._settings.auto_scroll) {
|
|
var a = h.offsetTop;
|
|
var m = h.offsetHeight;
|
|
var c = this._obj.scrollTop;
|
|
var n = this._obj.offsetHeight;
|
|
if (a - m >= 0 && a - m * 0.75 < c) {
|
|
c = Math.max(a - m, 0)
|
|
} else {
|
|
if (a + m / 0.75 > c + n) {
|
|
c = c + m
|
|
}
|
|
}
|
|
this._obj.scrollTop = c
|
|
}
|
|
return true
|
|
},
|
|
_id: "dhx_f_id",
|
|
on_click: {
|
|
dhx_dataview_item: function(a, c) {
|
|
if (this.stopEdit(false, c)) {
|
|
if (this._settings.select) {
|
|
if (this._settings.select == "multiselect") {
|
|
this.select(c, a.ctrlKey, a.shiftKey)
|
|
} else {
|
|
this.select(c)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
on_dblclick: {
|
|
dhx_dataview_item: function(a, c) {
|
|
if (this._settings.edit) {
|
|
this.edit(c)
|
|
}
|
|
}
|
|
},
|
|
on_mouse_move: {},
|
|
types: {
|
|
"default": {
|
|
css: "default",
|
|
template: dhtmlx.Template.fromHTML("<div style='padding:10px; white-space:nowrap; overflow:hidden;'>{obj.text}</div>"),
|
|
template_edit: dhtmlx.Template.fromHTML("<div style='padding:10px; white-space:nowrap; overflow:hidden;'><textarea style='width:100%; height:100%;' bind='obj.text'></textarea></div>"),
|
|
template_loading: dhtmlx.Template.fromHTML("<div style='padding:10px; white-space:nowrap; overflow:hidden;'>Loading...</div>"),
|
|
width: 210,
|
|
height: 115,
|
|
margin: 0,
|
|
padding: 10,
|
|
border: 1
|
|
}
|
|
},
|
|
template_item_start: dhtmlx.Template.fromHTML("<div dhx_f_id='{-obj.id}' class='dhx_dataview_item dhx_dataview_{obj.css}_item{-obj.$selected?_selected:}' style='width:{obj.width}px; height:{obj.height}px; padding:{obj.padding}px; margin:{obj.margin}px; float:left; overflow:hidden;'>"),
|
|
template_item_end: dhtmlx.Template.fromHTML("</div>")
|
|
};
|
|
dhtmlx.compat("layout");
|
|
|
|
function xmlPointer(a) {
|
|
this.d = a
|
|
}
|
|
xmlPointer.prototype = {
|
|
text: function() {
|
|
if (!_isFF) {
|
|
return this.d.xml
|
|
}
|
|
var a = new XMLSerializer();
|
|
return a.serializeToString(this.d)
|
|
},
|
|
get: function(a) {
|
|
return this.d.getAttribute(a)
|
|
},
|
|
exists: function() {
|
|
return !!this.d
|
|
},
|
|
content: function() {
|
|
return this.d.firstChild ? (this.d.firstChild.wholeText || this.d.firstChild.data) : ""
|
|
},
|
|
each: function(h, n, m, l) {
|
|
var g = this.d.childNodes;
|
|
var o = new xmlPointer();
|
|
if (g.length) {
|
|
for (l = l || 0; l < g.length; l++) {
|
|
if (g[l].tagName == h) {
|
|
o.d = g[l];
|
|
if (n.apply(m, [o, l]) == -1) {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
get_all: function() {
|
|
var g = {};
|
|
var c = this.d.attributes;
|
|
for (var h = 0; h < c.length; h++) {
|
|
g[c[h].name] = c[h].value
|
|
}
|
|
return g
|
|
},
|
|
sub: function(h) {
|
|
var g = this.d.childNodes;
|
|
var m = new xmlPointer();
|
|
if (g.length) {
|
|
for (var l = 0; l < g.length; l++) {
|
|
if (g[l].tagName == h) {
|
|
m.d = g[l];
|
|
return m
|
|
}
|
|
}
|
|
}
|
|
},
|
|
up: function(a) {
|
|
return new xmlPointer(this.d.parentNode)
|
|
},
|
|
set: function(a, c) {
|
|
this.d.setAttribute(a, c)
|
|
},
|
|
clone: function(a) {
|
|
return new xmlPointer(this.d)
|
|
},
|
|
sub_exists: function(g) {
|
|
var c = this.d.childNodes;
|
|
if (c.length) {
|
|
for (var h = 0; h < c.length; h++) {
|
|
if (c[h].tagName == g) {
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
return false
|
|
},
|
|
through: function(g, n, r, l, s) {
|
|
var o = this.d.childNodes;
|
|
if (o.length) {
|
|
for (var h = 0; h < o.length; h++) {
|
|
if (o[h].tagName == g && o[h].getAttribute(n) != null && o[h].getAttribute(n) != "" && (!r || o[h].getAttribute(n) == r)) {
|
|
var m = new xmlPointer(o[h]);
|
|
l.apply(s, [m, h])
|
|
}
|
|
var q = this.d;
|
|
this.d = o[h];
|
|
this.through(g, n, r, l, s);
|
|
this.d = q
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
function dhtmlXTreeObject(m, h, c, a) {
|
|
if (_isIE) {
|
|
try {
|
|
document.execCommand("BackgroundImageCache", false, true)
|
|
} catch (l) {}
|
|
}
|
|
if (typeof(m) != "object") {
|
|
this.parentObject = document.getElementById(m)
|
|
} else {
|
|
this.parentObject = m
|
|
}
|
|
this.parentObject.style.overflow = "hidden";
|
|
this._itim_dg = true;
|
|
this.dlmtr = ",";
|
|
this.dropLower = false;
|
|
this.enableIEImageFix();
|
|
this.xmlstate = 0;
|
|
this.mytype = "tree";
|
|
this.smcheck = true;
|
|
this.width = h;
|
|
this.height = c;
|
|
this.rootId = a;
|
|
this.childCalc = null;
|
|
this.def_img_x = "18px";
|
|
this.def_img_y = "18px";
|
|
this.def_line_img_x = "18px";
|
|
this.def_line_img_y = "24px";
|
|
this._dragged = new Array();
|
|
this._selected = new Array();
|
|
this.style_pointer = "pointer";
|
|
this._aimgs = true;
|
|
this.htmlcA = " [";
|
|
this.htmlcB = "]";
|
|
this.lWin = window;
|
|
this.cMenu = 0;
|
|
this.mlitems = 0;
|
|
this.iconURL = "";
|
|
this.dadmode = 0;
|
|
this.slowParse = false;
|
|
this.autoScroll = true;
|
|
this.hfMode = 0;
|
|
this.nodeCut = new Array();
|
|
this.XMLsource = 0;
|
|
this.XMLloadingWarning = 0;
|
|
this._idpull = {};
|
|
this._pullSize = 0;
|
|
this.treeLinesOn = true;
|
|
this.tscheck = false;
|
|
this.timgen = true;
|
|
this.dpcpy = false;
|
|
this._ld_id = null;
|
|
this._oie_onXLE = [];
|
|
this.imPath = window.dhx_globalImgPath || "";
|
|
this.checkArray = new Array("iconUncheckAll.gif", "iconCheckAll.gif", "iconCheckGray.gif", "iconUncheckDis.gif", "iconCheckDis.gif", "iconCheckDis.gif");
|
|
this.radioArray = new Array("radio_off.gif", "radio_on.gif", "radio_on.gif", "radio_off.gif", "radio_on.gif", "radio_on.gif");
|
|
this.lineArray = new Array("line2.gif", "line3.gif", "line4.gif", "blank.gif", "blank.gif", "line1.gif");
|
|
this.minusArray = new Array("minus2.gif", "minus3.gif", "minus4.gif", "minus.gif", "minus5.gif");
|
|
this.plusArray = new Array("plus2.gif", "plus3.gif", "plus4.gif", "plus.gif", "plus5.gif");
|
|
this.imageArray = new Array("leaf.gif", "folderOpen.gif", "folderClosed.gif");
|
|
this.cutImg = new Array(0, 0, 0);
|
|
this.cutImage = "but_cut.gif";
|
|
dhtmlxEventable(this);
|
|
this.dragger = new dhtmlDragAndDropObject();
|
|
this.htmlNode = new dhtmlXTreeItemObject(this.rootId, "", 0, this);
|
|
this.htmlNode.htmlNode.childNodes[0].childNodes[0].style.display = "none";
|
|
this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[0].className = "hiddenRow";
|
|
this.allTree = this._createSelf();
|
|
this.allTree.appendChild(this.htmlNode.htmlNode);
|
|
if (dhtmlx.$customScroll) {
|
|
dhtmlx.CustomScroll.enable(this)
|
|
}
|
|
if (_isFF) {
|
|
this.allTree.childNodes[0].width = "100%";
|
|
this.allTree.childNodes[0].style.overflow = "hidden"
|
|
}
|
|
var g = this;
|
|
this.allTree.onselectstart = new Function("return false;");
|
|
if (_isMacOS) {
|
|
this.allTree.oncontextmenu = function(n) {
|
|
return g._doContClick(n || window.event, true)
|
|
}
|
|
}
|
|
this.allTree.onmousedown = function(n) {
|
|
return g._doContClick(n || window.event)
|
|
};
|
|
this.XMLLoader = new dtmlXMLLoaderObject(this._parseXMLTree, this, true, this.no_cashe);
|
|
if (_isIE) {
|
|
this.preventIECashing(true)
|
|
}
|
|
this.selectionBar = document.createElement("DIV");
|
|
this.selectionBar.className = "selectionBar";
|
|
this.selectionBar.innerHTML = " ";
|
|
this.selectionBar.style.display = "none";
|
|
this.allTree.appendChild(this.selectionBar);
|
|
if (window.addEventListener) {
|
|
window.addEventListener("unload", function() {
|
|
try {
|
|
g.destructor()
|
|
} catch (n) {}
|
|
}, false)
|
|
}
|
|
if (window.attachEvent) {
|
|
window.attachEvent("onunload", function() {
|
|
try {
|
|
g.destructor()
|
|
} catch (n) {}
|
|
})
|
|
}
|
|
this.setImagesPath = this.setImagePath;
|
|
this.setIconsPath = this.setIconPath;
|
|
if (dhtmlx.image_path) {
|
|
this.setImagePath(dhtmlx.image_path)
|
|
}
|
|
if (dhtmlx.skin) {
|
|
this.setSkin(dhtmlx.skin)
|
|
}
|
|
return this
|
|
}
|
|
dhtmlXTreeObject.prototype.setDataMode = function(a) {
|
|
this._datamode = a
|
|
};
|
|
dhtmlXTreeObject.prototype._doContClick = function(n, a) {
|
|
if (!a && n.button != 2) {
|
|
if (this._acMenu) {
|
|
if (this._acMenu.hideContextMenu) {
|
|
this._acMenu.hideContextMenu()
|
|
} else {
|
|
this.cMenu._contextEnd()
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
var c = (_isIE ? n.srcElement : n.target);
|
|
while ((c) && (c.tagName != "BODY")) {
|
|
if (c.parentObject) {
|
|
break
|
|
}
|
|
c = c.parentNode
|
|
}
|
|
if ((!c) || (!c.parentObject)) {
|
|
return true
|
|
}
|
|
var l = c.parentObject;
|
|
if (!this.callEvent("onRightClick", [l.id, n])) {
|
|
(n.srcElement || n.target).oncontextmenu = function(r) {
|
|
(r || event).cancelBubble = true;
|
|
return false
|
|
}
|
|
}
|
|
this._acMenu = (l.cMenu || this.cMenu);
|
|
if (this._acMenu) {
|
|
if (!(this.callEvent("onBeforeContextMenu", [l.id]))) {
|
|
return true
|
|
}
|
|
if (!_isMacOS) {
|
|
(n.srcElement || n.target).oncontextmenu = function(r) {
|
|
(r || event).cancelBubble = true;
|
|
return false
|
|
}
|
|
}
|
|
if (this._acMenu.showContextMenu) {
|
|
var h = window.document.documentElement;
|
|
var g = window.document.body;
|
|
var o = new Array((h.scrollLeft || g.scrollLeft), (h.scrollTop || g.scrollTop));
|
|
if (_isIE) {
|
|
var q = n.clientX + o[0];
|
|
var m = n.clientY + o[1]
|
|
} else {
|
|
var q = n.pageX;
|
|
var m = n.pageY
|
|
}
|
|
this._acMenu.showContextMenu(q - 1, m - 1);
|
|
this.contextID = l.id;
|
|
n.cancelBubble = true;
|
|
this._acMenu._skip_hide = true
|
|
} else {
|
|
c.contextMenuId = l.id;
|
|
c.contextMenu = this._acMenu;
|
|
c.a = this._acMenu._contextStart;
|
|
c.a(c, n);
|
|
c.a = null
|
|
}
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXTreeObject.prototype.enableIEImageFix = function(a) {
|
|
if (!a) {
|
|
this._getImg = function(c) {
|
|
return document.createElement((c == this.rootId) ? "div" : "img")
|
|
};
|
|
this._setSrc = function(g, c) {
|
|
g.src = c
|
|
};
|
|
this._getSrc = function(c) {
|
|
return c.src
|
|
}
|
|
} else {
|
|
this._getImg = function() {
|
|
var c = document.createElement("DIV");
|
|
c.innerHTML = " ";
|
|
c.className = "dhx_bg_img_fix";
|
|
return c
|
|
};
|
|
this._setSrc = function(g, c) {
|
|
g.style.backgroundImage = "url(" + c + ")"
|
|
};
|
|
this._getSrc = function(c) {
|
|
var g = c.style.backgroundImage;
|
|
return g.substr(4, g.length - 5).replace(/(^")|("$)/g, "")
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.destructor = function() {
|
|
for (var c in this._idpull) {
|
|
var g = this._idpull[c];
|
|
if (!g) {
|
|
continue
|
|
}
|
|
g.parentObject = null;
|
|
g.treeNod = null;
|
|
g.childNodes = null;
|
|
g.span = null;
|
|
g.tr.nodem = null;
|
|
g.tr = null;
|
|
g.htmlNode.objBelong = null;
|
|
g.htmlNode = null;
|
|
this._idpull[c] = null
|
|
}
|
|
this.parentObject.innerHTML = "";
|
|
if (this.XMLLoader) {
|
|
this.XMLLoader.destructor()
|
|
}
|
|
this.allTree.onselectstart = null;
|
|
this.allTree.oncontextmenu = null;
|
|
this.allTree.onmousedown = null;
|
|
for (var c in this) {
|
|
this[c] = null
|
|
}
|
|
};
|
|
|
|
function cObject() {
|
|
return this
|
|
}
|
|
cObject.prototype = new Object;
|
|
cObject.prototype.clone = function() {
|
|
function a() {}
|
|
a.prototype = this;
|
|
return new a()
|
|
};
|
|
|
|
function dhtmlXTreeItemObject(m, c, g, a, h, l) {
|
|
this.htmlNode = "";
|
|
this.acolor = "";
|
|
this.scolor = "";
|
|
this.tr = 0;
|
|
this.childsCount = 0;
|
|
this.tempDOMM = 0;
|
|
this.tempDOMU = 0;
|
|
this.dragSpan = 0;
|
|
this.dragMove = 0;
|
|
this.span = 0;
|
|
this.closeble = 1;
|
|
this.childNodes = new Array();
|
|
this.userData = new cObject();
|
|
this.checkstate = 0;
|
|
this.treeNod = a;
|
|
this.label = c;
|
|
this.parentObject = g;
|
|
this.actionHandler = h;
|
|
this.images = new Array(a.imageArray[0], a.imageArray[1], a.imageArray[2]);
|
|
this.id = a._globalIdStorageAdd(m, this);
|
|
if (this.treeNod.checkBoxOff) {
|
|
this.htmlNode = this.treeNod._createItem(1, this, l)
|
|
} else {
|
|
this.htmlNode = this.treeNod._createItem(0, this, l)
|
|
}
|
|
this.htmlNode.objBelong = this;
|
|
return this
|
|
}
|
|
dhtmlXTreeObject.prototype._globalIdStorageAdd = function(c, a) {
|
|
if (this._globalIdStorageFind(c, 1, 1)) {
|
|
c = c + "_" + (new Date()).valueOf();
|
|
return this._globalIdStorageAdd(c, a)
|
|
}
|
|
this._idpull[c] = a;
|
|
this._pullSize++;
|
|
return c
|
|
};
|
|
dhtmlXTreeObject.prototype._globalIdStorageSub = function(a) {
|
|
if (this._idpull[a]) {
|
|
this._unselectItem(this._idpull[a]);
|
|
this._idpull[a] = null;
|
|
this._pullSize--
|
|
}
|
|
if ((this._locker) && (this._locker[a])) {
|
|
this._locker[a] = false
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._globalIdStorageFind = function(m, a, g, h) {
|
|
var l = this._idpull[m];
|
|
if (l) {
|
|
if ((l.unParsed) && (!g)) {
|
|
this.reParse(l, 0)
|
|
}
|
|
if (this._srnd && !l.htmlNode) {
|
|
this._buildSRND(l, g)
|
|
}
|
|
if ((h) && (this._edsbpsA)) {
|
|
for (var c = 0; c < this._edsbpsA.length; c++) {
|
|
if (this._edsbpsA[c][2] == m) {
|
|
dhtmlxError.throwError("getItem", "Requested item still in parsing process.", m);
|
|
return null
|
|
}
|
|
}
|
|
}
|
|
return l
|
|
}
|
|
if ((this.slowParse) && (m != 0) && (!a)) {
|
|
return this.preParse(m)
|
|
} else {
|
|
return null
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._getSubItemsXML = function(a) {
|
|
var c = [];
|
|
a.each("item", function(g) {
|
|
c.push(g.get("id"))
|
|
}, this);
|
|
return c.join(this.dlmtr)
|
|
};
|
|
dhtmlXTreeObject.prototype.enableSmartXMLParsing = function(a) {
|
|
this.slowParse = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.findXML = function(c, a, g) {};
|
|
dhtmlXTreeObject.prototype._getAllCheckedXML = function(c, a, h) {
|
|
var g = [];
|
|
if (h == 2) {
|
|
c.through("item", "checked", -1, function(l) {
|
|
g.push(l.get("id"))
|
|
}, this)
|
|
}
|
|
if (h == 1) {
|
|
c.through("item", "id", null, function(l) {
|
|
if (l.get("checked") && (l.get("checked") != -1)) {
|
|
g.push(l.get("id"))
|
|
}
|
|
}, this)
|
|
}
|
|
if (h == 0) {
|
|
c.through("item", "id", null, function(l) {
|
|
if (!l.get("checked") || l.get("checked") == 0) {
|
|
g.push(l.get("id"))
|
|
}
|
|
}, this)
|
|
}
|
|
if (g.length) {
|
|
return a + (a ? this.dlmtr : "") + g.join(this.dlmtr)
|
|
}
|
|
if (a) {
|
|
return a
|
|
} else {
|
|
return ""
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._setSubCheckedXML = function(a, c) {
|
|
var g = a ? "1" : "";
|
|
c.through("item", "id", null, function(h) {
|
|
if (!h.get("disabled") || h.get("disabled") == 0) {
|
|
h.set("checked", g)
|
|
}
|
|
}, this)
|
|
};
|
|
dhtmlXTreeObject.prototype._getAllScraggyItemsXML = function(g, a) {
|
|
var h = [];
|
|
var c = function(l) {
|
|
if (!l.sub_exists("item")) {
|
|
h.push(l.get("id"))
|
|
} else {
|
|
l.each("item", c, this)
|
|
}
|
|
};
|
|
c(g);
|
|
return h.join(",")
|
|
};
|
|
dhtmlXTreeObject.prototype._getAllFatItemsXML = function(g, a) {
|
|
var h = [];
|
|
var c = function(l) {
|
|
if (!l.sub_exists("item")) {
|
|
return
|
|
}
|
|
h.push(l.get("id"));
|
|
l.each("item", c, this)
|
|
};
|
|
c(g);
|
|
return h.join(",")
|
|
};
|
|
dhtmlXTreeObject.prototype._getAllSubItemsXML = function(g, c, a) {
|
|
var c = [];
|
|
a.through("item", "id", null, function(h) {
|
|
c.push(h.get("id"))
|
|
}, this);
|
|
return c.join(",")
|
|
};
|
|
dhtmlXTreeObject.prototype.reParse = function(g) {
|
|
var m = this;
|
|
if (!this.parsCount) {
|
|
m.callEvent("onXLS", [m, g.id])
|
|
}
|
|
this.xmlstate = 1;
|
|
var h = g.unParsed;
|
|
g.unParsed = 0;
|
|
this.XMLloadingWarning = 1;
|
|
var a = this.parsingOn;
|
|
var o = this.waitUpdateXML;
|
|
var q = this.parsedArray;
|
|
this.parsedArray = new Array();
|
|
this.waitUpdateXML = false;
|
|
this.parsingOn = g.id;
|
|
this.parsedArray = new Array();
|
|
this.setCheckList = "";
|
|
this._parse(h, g.id, 2);
|
|
var r = this.setCheckList.split(this.dlmtr);
|
|
for (var l = 0; l < this.parsedArray.length; l++) {
|
|
g.htmlNode.childNodes[0].appendChild(this.parsedArray[l])
|
|
}
|
|
if (h.get("order") && h.get("order") != "none") {
|
|
this._reorderBranch(g, h.get("order"), true)
|
|
}
|
|
this.oldsmcheck = this.smcheck;
|
|
this.smcheck = false;
|
|
for (var c = 0; c < r.length; c++) {
|
|
if (r[c]) {
|
|
this.setCheck(r[c], 1)
|
|
}
|
|
}
|
|
this.smcheck = this.oldsmcheck;
|
|
this.parsingOn = a;
|
|
this.waitUpdateXML = o;
|
|
this.parsedArray = q;
|
|
this.XMLloadingWarning = 0;
|
|
this._redrawFrom(this, g);
|
|
if (this._srnd && !g._sready) {
|
|
this.prepareSR(g.id)
|
|
}
|
|
this.xmlstate = 0;
|
|
return true
|
|
};
|
|
dhtmlXTreeObject.prototype.preParse = function(c) {
|
|
if (!c || !this._p) {
|
|
return null
|
|
}
|
|
var a = false;
|
|
this._p.clone().through("item", "id", c, function(h) {
|
|
this._globalIdStorageFind(h.up().get("id"));
|
|
return a = true
|
|
}, this);
|
|
if (a) {
|
|
var g = this._globalIdStorageFind(c, true, false);
|
|
if (!g) {
|
|
dhtmlxError.throwError("getItem", "The item " + c + " not operable. Seems you have non-unique|incorrect IDs in tree's XML.", c)
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXTreeObject.prototype._escape = function(a) {
|
|
switch (this.utfesc) {
|
|
case "none":
|
|
return a;
|
|
break;
|
|
case "utf8":
|
|
return encodeURIComponent(a);
|
|
break;
|
|
default:
|
|
return escape(a);
|
|
break
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._drawNewTr = function(l, g) {
|
|
var h = document.createElement("tr");
|
|
var c = document.createElement("td");
|
|
var a = document.createElement("td");
|
|
c.appendChild(document.createTextNode(" "));
|
|
a.colSpan = 3;
|
|
a.appendChild(l);
|
|
h.appendChild(c);
|
|
h.appendChild(a);
|
|
return h
|
|
};
|
|
dhtmlXTreeObject.prototype.loadXMLString = function(g, c) {
|
|
var a = this;
|
|
if (!this.parsCount) {
|
|
this.callEvent("onXLS", [a, null])
|
|
}
|
|
this.xmlstate = 1;
|
|
if (c) {
|
|
this.XMLLoader.waitCall = c
|
|
}
|
|
this.XMLLoader.loadXMLString(g)
|
|
};
|
|
dhtmlXTreeObject.prototype.loadXML = function(a, g) {
|
|
if (this._datamode && this._datamode != "xml") {
|
|
return this["load" + this._datamode.toUpperCase()](a, g)
|
|
}
|
|
var c = this;
|
|
if (!this.parsCount) {
|
|
this.callEvent("onXLS", [c, this._ld_id])
|
|
}
|
|
this._ld_id = null;
|
|
this.xmlstate = 1;
|
|
this.XMLLoader = new dtmlXMLLoaderObject(this._parseXMLTree, this, true, this.no_cashe);
|
|
if (g) {
|
|
this.XMLLoader.waitCall = g
|
|
}
|
|
this.XMLLoader.loadXML(a)
|
|
};
|
|
dhtmlXTreeObject.prototype._attachChildNode = function(o, m, h, q, E, D, C, r, g, v, w) {
|
|
if (v && v.parentObject) {
|
|
o = v.parentObject
|
|
}
|
|
if (((o.XMLload == 0) && (this.XMLsource)) && (!this.XMLloadingWarning)) {
|
|
o.XMLload = 1;
|
|
this._loadDynXML(o.id)
|
|
}
|
|
var s = o.childsCount;
|
|
var F = o.childNodes;
|
|
if (w && w.tr.previousSibling) {
|
|
if (w.tr.previousSibling.previousSibling) {
|
|
v = w.tr.previousSibling.nodem
|
|
} else {
|
|
r = r.replace("TOP", "") + ",TOP"
|
|
}
|
|
}
|
|
if (v) {
|
|
var l, A;
|
|
for (l = 0; l < s; l++) {
|
|
if (F[l] == v) {
|
|
for (A = s; A != l; A--) {
|
|
F[1 + A] = F[A]
|
|
}
|
|
break
|
|
}
|
|
}
|
|
l++;
|
|
s = l
|
|
}
|
|
if (r) {
|
|
var x = r.split(",");
|
|
for (var y = 0; y < x.length; y++) {
|
|
switch (x[y]) {
|
|
case "TOP":
|
|
if (o.childsCount > 0) {
|
|
v = new Object;
|
|
v.tr = o.childNodes[0].tr.previousSibling
|
|
}
|
|
o._has_top = true;
|
|
for (l = s; l > 0; l--) {
|
|
F[l] = F[l - 1]
|
|
}
|
|
s = 0;
|
|
break
|
|
}
|
|
}
|
|
}
|
|
var u;
|
|
if (!(u = this._idpull[m]) || u.span != -1) {
|
|
u = F[s] = new dhtmlXTreeItemObject(m, h, o, this, q, 1);
|
|
m = F[s].id;
|
|
o.childsCount++
|
|
}
|
|
if (!u.htmlNode) {
|
|
u.label = h;
|
|
u.htmlNode = this._createItem((this.checkBoxOff ? 1 : 0), u);
|
|
u.htmlNode.objBelong = u
|
|
}
|
|
if (E) {
|
|
u.images[0] = E
|
|
}
|
|
if (D) {
|
|
u.images[1] = D
|
|
}
|
|
if (C) {
|
|
u.images[2] = C
|
|
}
|
|
var c = this._drawNewTr(u.htmlNode);
|
|
if ((this.XMLloadingWarning) || (this._hAdI)) {
|
|
u.htmlNode.parentNode.parentNode.style.display = "none"
|
|
}
|
|
if ((v) && v.tr && (v.tr.nextSibling)) {
|
|
o.htmlNode.childNodes[0].insertBefore(c, v.tr.nextSibling)
|
|
} else {
|
|
if (this.parsingOn == o.id) {
|
|
this.parsedArray[this.parsedArray.length] = c
|
|
} else {
|
|
o.htmlNode.childNodes[0].appendChild(c)
|
|
}
|
|
} if ((v) && (!v.span)) {
|
|
v = null
|
|
}
|
|
if (this.XMLsource) {
|
|
if ((g) && (g != 0)) {
|
|
u.XMLload = 0
|
|
} else {
|
|
u.XMLload = 1
|
|
}
|
|
}
|
|
u.tr = c;
|
|
c.nodem = u;
|
|
if (o.itemId == 0) {
|
|
c.childNodes[0].className = "hiddenRow"
|
|
}
|
|
if ((o._r_logic) || (this._frbtr)) {
|
|
this._setSrc(u.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0], this.imPath + this.radioArray[0])
|
|
}
|
|
if (r) {
|
|
var x = r.split(",");
|
|
for (var y = 0; y < x.length; y++) {
|
|
switch (x[y]) {
|
|
case "SELECT":
|
|
this.selectItem(m, false);
|
|
break;
|
|
case "CALL":
|
|
this.selectItem(m, true);
|
|
break;
|
|
case "CHILD":
|
|
u.XMLload = 0;
|
|
break;
|
|
case "CHECKED":
|
|
if (this.XMLloadingWarning) {
|
|
this.setCheckList += this.dlmtr + m
|
|
} else {
|
|
this.setCheck(m, 1)
|
|
}
|
|
break;
|
|
case "HCHECKED":
|
|
this._setCheck(u, "unsure");
|
|
break;
|
|
case "OPEN":
|
|
u.openMe = 1;
|
|
break
|
|
}
|
|
}
|
|
}
|
|
if (!this.XMLloadingWarning) {
|
|
if ((this._getOpenState(o) < 0) && (!this._hAdI)) {
|
|
this.openItem(o.id)
|
|
}
|
|
if (v) {
|
|
this._correctPlus(v);
|
|
this._correctLine(v)
|
|
}
|
|
this._correctPlus(o);
|
|
this._correctLine(o);
|
|
this._correctPlus(u);
|
|
if (o.childsCount >= 2) {
|
|
this._correctPlus(F[o.childsCount - 2]);
|
|
this._correctLine(F[o.childsCount - 2])
|
|
}
|
|
if (o.childsCount != 2) {
|
|
this._correctPlus(F[0])
|
|
}
|
|
if (this.tscheck) {
|
|
this._correctCheckStates(o)
|
|
}
|
|
if (this._onradh) {
|
|
if (this.xmlstate == 1) {
|
|
var a = this.onXLE;
|
|
this.onXLE = function(n) {
|
|
this._onradh(m);
|
|
if (a) {
|
|
a(n)
|
|
}
|
|
}
|
|
} else {
|
|
this._onradh(m)
|
|
}
|
|
}
|
|
}
|
|
return u
|
|
};
|
|
dhtmlXTreeObject.prototype.enableContextMenu = function(a) {
|
|
if (a) {
|
|
this.cMenu = a
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.setItemContextMenu = function(m, h) {
|
|
var a = m.toString().split(this.dlmtr);
|
|
for (var g = 0; g < a.length; g++) {
|
|
var c = this._globalIdStorageFind(a[g]);
|
|
if (!c) {
|
|
continue
|
|
}
|
|
c.cMenu = h
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.insertNewItem = function(h, o, r, g, n, m, l, c, a) {
|
|
var s = this._globalIdStorageFind(h);
|
|
if (!s) {
|
|
return (-1)
|
|
}
|
|
var q = this._attachChildNode(s, o, r, g, n, m, l, c, a);
|
|
if (!this._idpull[this.rootId].XMLload) {
|
|
this._idpull[this.rootId].XMLload = 1
|
|
}
|
|
if ((!this.XMLloadingWarning) && (this.childCalc)) {
|
|
this._fixChildCountLabel(s)
|
|
}
|
|
return q
|
|
};
|
|
dhtmlXTreeObject.prototype.insertNewChild = function(h, o, q, g, n, m, l, c, a) {
|
|
return this.insertNewItem(h, o, q, g, n, m, l, c, a)
|
|
};
|
|
dhtmlXTreeObject.prototype._parseXMLTree = function(h, g, o, n, l) {
|
|
var m = new xmlPointer(l.getXMLTopNode("tree"));
|
|
h._parse(m);
|
|
h._p = m
|
|
};
|
|
dhtmlXTreeObject.prototype._parseItem = function(m, r, l, o) {
|
|
var g;
|
|
if (this._srnd && (!this._idpull[g = m.get("id")] || !this._idpull[g].span)) {
|
|
this._addItemSRND(r.id, g, m);
|
|
return
|
|
}
|
|
var n = m.get_all();
|
|
if ((typeof(this.waitUpdateXML) == "object") && (!this.waitUpdateXML[n.id])) {
|
|
this._parse(m, n.id, 1);
|
|
return
|
|
}
|
|
if ((n.text === null) || (typeof(n.text) == "undefined")) {
|
|
n.text = m.sub("itemtext");
|
|
if (n.text) {
|
|
n.text = n.text.content()
|
|
}
|
|
}
|
|
var u = [];
|
|
if (n.select) {
|
|
u.push("SELECT")
|
|
}
|
|
if (n.top) {
|
|
u.push("TOP")
|
|
}
|
|
if (n.call) {
|
|
this.nodeAskingCall = n.id
|
|
}
|
|
if (n.checked == -1) {
|
|
u.push("HCHECKED")
|
|
} else {
|
|
if (n.checked) {
|
|
u.push("CHECKED")
|
|
}
|
|
} if (n.open) {
|
|
u.push("OPEN")
|
|
}
|
|
if (this.waitUpdateXML) {
|
|
if (this._globalIdStorageFind(n.id)) {
|
|
var q = this.updateItem(n.id, n.text, n.im0, n.im1, n.im2, n.checked, n.child)
|
|
} else {
|
|
if (this.npl == 0) {
|
|
u.push("TOP")
|
|
} else {
|
|
l = r.childNodes[this.npl]
|
|
}
|
|
var q = this._attachChildNode(r, n.id, n.text, 0, n.im0, n.im1, n.im2, u.join(","), n.child, 0, l);
|
|
n.id = q.id;
|
|
l = null
|
|
}
|
|
} else {
|
|
var q = this._attachChildNode(r, n.id, n.text, 0, n.im0, n.im1, n.im2, u.join(","), n.child, (o || 0), l)
|
|
} if (n.tooltip) {
|
|
q.span.parentNode.parentNode.title = n.tooltip
|
|
}
|
|
if (n.style) {
|
|
if (q.span.style.cssText) {
|
|
q.span.style.cssText += (";" + n.style)
|
|
} else {
|
|
q.span.setAttribute("style", q.span.getAttribute("style") + "; " + n.style)
|
|
}
|
|
}
|
|
if (n.radio) {
|
|
q._r_logic = true
|
|
}
|
|
if (n.nocheckbox) {
|
|
var s = q.span.parentNode.previousSibling.previousSibling;
|
|
s.style.display = "none";
|
|
q.nocheckbox = true
|
|
}
|
|
if (n.disabled) {
|
|
if (n.checked != null) {
|
|
this._setCheck(q, n.checked)
|
|
}
|
|
this.disableCheckbox(q, 1)
|
|
}
|
|
q._acc = n.child || 0;
|
|
if (this.parserExtension) {
|
|
this.parserExtension._parseExtension.call(this, m, n, (r ? r.id : 0))
|
|
}
|
|
this.setItemColor(q, n.aCol, n.sCol);
|
|
if (n.locked == "1") {
|
|
this.lockItem(q.id, true, true)
|
|
}
|
|
if ((n.imwidth) || (n.imheight)) {
|
|
this.setIconSize(n.imwidth, n.imheight, q)
|
|
}
|
|
if ((n.closeable == "0") || (n.closeable == "1")) {
|
|
this.setItemCloseable(q, n.closeable)
|
|
}
|
|
var h = "";
|
|
if (n.topoffset) {
|
|
this.setItemTopOffset(q, n.topoffset)
|
|
}
|
|
if ((!this.slowParse) || (typeof(this.waitUpdateXML) == "object")) {
|
|
if (m.sub_exists("item")) {
|
|
h = this._parse(m, n.id, 1)
|
|
}
|
|
} else {
|
|
if ((!q.childsCount) && m.sub_exists("item")) {
|
|
q.unParsed = m.clone()
|
|
}
|
|
m.each("userdata", function(a) {
|
|
this.setUserData(n.id, a.get("name"), a.content())
|
|
}, this)
|
|
} if (h != "") {
|
|
this.nodeAskingCall = h
|
|
}
|
|
m.each("userdata", function(a) {
|
|
this.setUserData(m.get("id"), a.get("name"), a.content())
|
|
}, this)
|
|
};
|
|
dhtmlXTreeObject.prototype._parse = function(g, m, a, c) {
|
|
if (this._srnd && !this.parentObject.offsetHeight) {
|
|
var w = this;
|
|
return window.setTimeout(function() {
|
|
w._parse(g, m, a, c)
|
|
}, 100)
|
|
}
|
|
if (!g.exists()) {
|
|
return
|
|
}
|
|
this.skipLock = true;
|
|
if (!m) {
|
|
m = g.get("id");
|
|
var u = g.get("dhx_security");
|
|
if (u) {
|
|
dhtmlx.security_key = u
|
|
}
|
|
if (g.get("radio")) {
|
|
this.htmlNode._r_logic = true
|
|
}
|
|
this.parsingOn = m;
|
|
this.parsedArray = new Array();
|
|
this.setCheckList = "";
|
|
this.nodeAskingCall = ""
|
|
}
|
|
var v = this._globalIdStorageFind(m);
|
|
if (!v) {
|
|
return dhtmlxError.throwError("DataStructure", "XML refers to not existing parent")
|
|
}
|
|
this.parsCount = this.parsCount ? (this.parsCount + 1) : 1;
|
|
this.XMLloadingWarning = 1;
|
|
if ((v.childsCount) && (!c) && (!this._edsbps) && (!v._has_top)) {
|
|
var o = 0
|
|
} else {
|
|
var o = 0
|
|
}
|
|
this.npl = 0;
|
|
g.each("item", function(x, n) {
|
|
v.XMLload = 1;
|
|
this._parseItem(x, v, 0, o);
|
|
if ((this._edsbps) && (this.npl == this._edsbpsC)) {
|
|
this._distributedStart(g, n + 1, m, a, v.childsCount);
|
|
return -1
|
|
}
|
|
this.npl++
|
|
}, this, c);
|
|
if (!a) {
|
|
g.each("userdata", function(n) {
|
|
this.setUserData(g.get("id"), n.get("name"), n.content())
|
|
}, this);
|
|
v.XMLload = 1;
|
|
if (this.waitUpdateXML) {
|
|
this.waitUpdateXML = false;
|
|
for (var l = v.childsCount - 1; l >= 0; l--) {
|
|
if (v.childNodes[l]._dmark) {
|
|
this.deleteItem(v.childNodes[l].id)
|
|
}
|
|
}
|
|
}
|
|
var r = this._globalIdStorageFind(this.parsingOn);
|
|
for (var l = 0; l < this.parsedArray.length; l++) {
|
|
v.htmlNode.childNodes[0].appendChild(this.parsedArray[l])
|
|
}
|
|
this.parsedArray = [];
|
|
this.lastLoadedXMLId = m;
|
|
this.XMLloadingWarning = 0;
|
|
var s = this.setCheckList.split(this.dlmtr);
|
|
for (var h = 0; h < s.length; h++) {
|
|
if (s[h]) {
|
|
this.setCheck(s[h], 1)
|
|
}
|
|
}
|
|
if ((this.XMLsource) && (this.tscheck) && (this.smcheck) && (v.id != this.rootId)) {
|
|
if (v.checkstate === 0) {
|
|
this._setSubChecked(0, v)
|
|
} else {
|
|
if (v.checkstate === 1) {
|
|
this._setSubChecked(1, v)
|
|
}
|
|
}
|
|
}
|
|
this._redrawFrom(this, null, c);
|
|
if (g.get("order") && g.get("order") != "none") {
|
|
this._reorderBranch(v, g.get("order"), true)
|
|
}
|
|
if (this.nodeAskingCall != "") {
|
|
this.callEvent("onClick", [this.nodeAskingCall, this.getSelectedItemId()])
|
|
}
|
|
if (this._branchUpdate) {
|
|
this._branchUpdateNext(g)
|
|
}
|
|
}
|
|
if (this.parsCount == 1) {
|
|
this.parsingOn = null;
|
|
if (this._srnd && v.id != this.rootId) {
|
|
this.prepareSR(v.id);
|
|
if (this.XMLsource) {
|
|
this.openItem(v.id)
|
|
}
|
|
}
|
|
g.through("item", "open", null, function(n) {
|
|
this.openItem(n.get("id"))
|
|
}, this);
|
|
if ((!this._edsbps) || (!this._edsbpsA.length)) {
|
|
var q = this;
|
|
window.setTimeout(function() {
|
|
q.callEvent("onXLE", [q, m])
|
|
}, 1);
|
|
this.xmlstate = 0
|
|
}
|
|
this.skipLock = false
|
|
}
|
|
this.parsCount--;
|
|
var q = this;
|
|
if (this._edsbps) {
|
|
window.setTimeout(function() {
|
|
q._distributedStep(m)
|
|
}, this._edsbpsD)
|
|
}
|
|
if (!a && this.onXLE) {
|
|
this.onXLE(this, m)
|
|
}
|
|
return this.nodeAskingCall
|
|
};
|
|
dhtmlXTreeObject.prototype._branchUpdateNext = function(a) {
|
|
a.each("item", function(h) {
|
|
var g = h.get("id");
|
|
if (this._idpull[g] && (!this._idpull[g].XMLload)) {
|
|
return
|
|
}
|
|
this._branchUpdate++;
|
|
this.smartRefreshItem(h.get("id"), h)
|
|
}, this);
|
|
this._branchUpdate--
|
|
};
|
|
dhtmlXTreeObject.prototype.checkUserData = function(c, g) {
|
|
if ((c.nodeType == 1) && (c.tagName == "userdata")) {
|
|
var a = c.getAttribute("name");
|
|
if ((a) && (c.childNodes[0])) {
|
|
this.setUserData(g, a, c.childNodes[0].data)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._redrawFrom = function(o, c, n, g) {
|
|
if (!c) {
|
|
var l = o._globalIdStorageFind(o.lastLoadedXMLId);
|
|
o.lastLoadedXMLId = -1;
|
|
if (!l) {
|
|
return 0
|
|
}
|
|
} else {
|
|
l = c
|
|
}
|
|
var m = 0;
|
|
for (var h = (n ? n - 1 : 0); h < l.childsCount; h++) {
|
|
if ((!this._branchUpdate) || (this._getOpenState(l) == 1)) {
|
|
if ((!c) || (g == 1)) {
|
|
l.childNodes[h].htmlNode.parentNode.parentNode.style.display = ""
|
|
}
|
|
}
|
|
if (l.childNodes[h].openMe == 1) {
|
|
this._openItem(l.childNodes[h]);
|
|
l.childNodes[h].openMe = 0
|
|
}
|
|
o._redrawFrom(o, l.childNodes[h]);
|
|
if (this.childCalc != null) {
|
|
if ((l.childNodes[h].unParsed) || ((!l.childNodes[h].XMLload) && (this.XMLsource))) {
|
|
if (l.childNodes[h]._acc) {
|
|
l.childNodes[h].span.innerHTML = l.childNodes[h].label + this.htmlcA + l.childNodes[h]._acc + this.htmlcB
|
|
} else {
|
|
l.childNodes[h].span.innerHTML = l.childNodes[h].label
|
|
}
|
|
}
|
|
if ((l.childNodes[h].childNodes.length) && (this.childCalc)) {
|
|
if (this.childCalc == 1) {
|
|
l.childNodes[h].span.innerHTML = l.childNodes[h].label + this.htmlcA + l.childNodes[h].childsCount + this.htmlcB
|
|
}
|
|
if (this.childCalc == 2) {
|
|
var a = l.childNodes[h].childsCount - (l.childNodes[h].pureChilds || 0);
|
|
if (a) {
|
|
l.childNodes[h].span.innerHTML = l.childNodes[h].label + this.htmlcA + a + this.htmlcB
|
|
}
|
|
if (l.pureChilds) {
|
|
l.pureChilds++
|
|
} else {
|
|
l.pureChilds = 1
|
|
}
|
|
}
|
|
if (this.childCalc == 3) {
|
|
l.childNodes[h].span.innerHTML = l.childNodes[h].label + this.htmlcA + l.childNodes[h]._acc + this.htmlcB
|
|
}
|
|
if (this.childCalc == 4) {
|
|
var a = l.childNodes[h]._acc;
|
|
if (a) {
|
|
l.childNodes[h].span.innerHTML = l.childNodes[h].label + this.htmlcA + a + this.htmlcB
|
|
}
|
|
}
|
|
} else {
|
|
if (this.childCalc == 4) {
|
|
m++
|
|
}
|
|
}
|
|
m += l.childNodes[h]._acc;
|
|
if (this.childCalc == 3) {
|
|
m++
|
|
}
|
|
}
|
|
}
|
|
if ((!l.unParsed) && ((l.XMLload) || (!this.XMLsource))) {
|
|
l._acc = m
|
|
}
|
|
o._correctLine(l);
|
|
o._correctPlus(l);
|
|
if ((this.childCalc) && (!c)) {
|
|
o._fixChildCountLabel(l)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._createSelf = function() {
|
|
var a = document.createElement("div");
|
|
a.className = "containerTableStyle";
|
|
a.style.width = this.width;
|
|
a.style.height = this.height;
|
|
this.parentObject.appendChild(a);
|
|
return a
|
|
};
|
|
dhtmlXTreeObject.prototype._xcloseAll = function(c) {
|
|
if (c.unParsed) {
|
|
return
|
|
}
|
|
if (this.rootId != c.id) {
|
|
if (!c.htmlNode) {
|
|
return
|
|
}
|
|
var h = c.htmlNode.childNodes[0].childNodes;
|
|
var a = h.length;
|
|
for (var g = 1; g < a; g++) {
|
|
h[g].style.display = "none"
|
|
}
|
|
this._correctPlus(c)
|
|
}
|
|
for (var g = 0; g < c.childsCount; g++) {
|
|
if (c.childNodes[g].childsCount) {
|
|
this._xcloseAll(c.childNodes[g])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._xopenAll = function(a) {
|
|
this._HideShow(a, 2);
|
|
for (var c = 0; c < a.childsCount; c++) {
|
|
this._xopenAll(a.childNodes[c])
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._correctPlus = function(c) {
|
|
if (!c.htmlNode) {
|
|
return
|
|
}
|
|
var g = c.htmlNode.childNodes[0].childNodes[0].childNodes[0].lastChild;
|
|
var l = c.htmlNode.childNodes[0].childNodes[0].childNodes[2].childNodes[0];
|
|
var a = this.lineArray;
|
|
if ((this.XMLsource) && (!c.XMLload)) {
|
|
var a = this.plusArray;
|
|
this._setSrc(l, this.iconURL + c.images[2]);
|
|
if (this._txtimg) {
|
|
return (g.innerHTML = "[+]")
|
|
}
|
|
} else {
|
|
if ((c.childsCount) || (c.unParsed)) {
|
|
if ((c.htmlNode.childNodes[0].childNodes[1]) && (c.htmlNode.childNodes[0].childNodes[1].style.display != "none")) {
|
|
if (!c.wsign) {
|
|
var a = this.minusArray
|
|
}
|
|
this._setSrc(l, this.iconURL + c.images[1]);
|
|
if (this._txtimg) {
|
|
return (g.innerHTML = "[-]")
|
|
}
|
|
} else {
|
|
if (!c.wsign) {
|
|
var a = this.plusArray
|
|
}
|
|
this._setSrc(l, this.iconURL + c.images[2]);
|
|
if (this._txtimg) {
|
|
return (g.innerHTML = "[+]")
|
|
}
|
|
}
|
|
} else {
|
|
this._setSrc(l, this.iconURL + c.images[0])
|
|
}
|
|
}
|
|
var h = 2;
|
|
if (!c.treeNod.treeLinesOn) {
|
|
this._setSrc(g, this.imPath + a[3])
|
|
} else {
|
|
if (c.parentObject) {
|
|
h = this._getCountStatus(c.id, c.parentObject)
|
|
}
|
|
this._setSrc(g, this.imPath + a[h])
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._correctLine = function(c) {
|
|
if (!c.htmlNode) {
|
|
return
|
|
}
|
|
var a = c.parentObject;
|
|
if (a) {
|
|
if ((this._getLineStatus(c.id, a) == 0) || (!this.treeLinesOn)) {
|
|
for (var g = 1; g <= c.childsCount; g++) {
|
|
if (!c.htmlNode.childNodes[0].childNodes[g]) {
|
|
break
|
|
}
|
|
c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundImage = "";
|
|
c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundRepeat = ""
|
|
}
|
|
} else {
|
|
for (var g = 1; g <= c.childsCount; g++) {
|
|
if (!c.htmlNode.childNodes[0].childNodes[g]) {
|
|
break
|
|
}
|
|
c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundImage = "url(" + this.imPath + this.lineArray[5] + ")";
|
|
c.htmlNode.childNodes[0].childNodes[g].childNodes[0].style.backgroundRepeat = "repeat-y"
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._getCountStatus = function(c, a) {
|
|
if (a.childsCount <= 1) {
|
|
if (a.id == this.rootId) {
|
|
return 4
|
|
} else {
|
|
return 0
|
|
}
|
|
}
|
|
if (a.childNodes[0].id == c) {
|
|
if (a.id == this.rootId) {
|
|
return 2
|
|
} else {
|
|
return 1
|
|
}
|
|
}
|
|
if (a.childNodes[a.childsCount - 1].id == c) {
|
|
return 0
|
|
}
|
|
return 1
|
|
};
|
|
dhtmlXTreeObject.prototype._getLineStatus = function(c, a) {
|
|
if (a.childNodes[a.childsCount - 1].id == c) {
|
|
return 0
|
|
}
|
|
return 1
|
|
};
|
|
dhtmlXTreeObject.prototype._HideShow = function(c, l) {
|
|
if ((this.XMLsource) && (!c.XMLload)) {
|
|
if (l == 1) {
|
|
return
|
|
}
|
|
c.XMLload = 1;
|
|
this._loadDynXML(c.id);
|
|
return
|
|
}
|
|
if (c.unParsed) {
|
|
this.reParse(c)
|
|
}
|
|
var h = c.htmlNode.childNodes[0].childNodes;
|
|
var a = h.length;
|
|
if (a > 1) {
|
|
if (((h[1].style.display != "none") || (l == 1)) && (l != 2)) {
|
|
this.allTree.childNodes[0].border = "1";
|
|
this.allTree.childNodes[0].border = "0";
|
|
nodestyle = "none"
|
|
} else {
|
|
nodestyle = ""
|
|
}
|
|
for (var g = 1; g < a; g++) {
|
|
h[g].style.display = nodestyle
|
|
}
|
|
}
|
|
this._correctPlus(c)
|
|
};
|
|
dhtmlXTreeObject.prototype._getOpenState = function(a) {
|
|
if (!a.htmlNode) {
|
|
return 0
|
|
}
|
|
var c = a.htmlNode.childNodes[0].childNodes;
|
|
if (c.length <= 1) {
|
|
return 0
|
|
}
|
|
if (c[1].style.display != "none") {
|
|
return 1
|
|
} else {
|
|
return -1
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.onRowClick2 = function() {
|
|
var a = this.parentObject.treeNod;
|
|
if (!a.callEvent("onDblClick", [this.parentObject.id, a])) {
|
|
return false
|
|
}
|
|
if ((this.parentObject.closeble) && (this.parentObject.closeble != "0")) {
|
|
a._HideShow(this.parentObject)
|
|
} else {
|
|
a._HideShow(this.parentObject, 2)
|
|
} if (a.checkEvent("onOpenEnd")) {
|
|
if (!a.xmlstate) {
|
|
a.callEvent("onOpenEnd", [this.parentObject.id, a._getOpenState(this.parentObject)])
|
|
} else {
|
|
a._oie_onXLE.push(a.onXLE);
|
|
a.onXLE = a._epnFHe
|
|
}
|
|
}
|
|
return false
|
|
};
|
|
dhtmlXTreeObject.prototype.onRowClick = function() {
|
|
var a = this.parentObject.treeNod;
|
|
if (!a.callEvent("onOpenStart", [this.parentObject.id, a._getOpenState(this.parentObject)])) {
|
|
return 0
|
|
}
|
|
if ((this.parentObject.closeble) && (this.parentObject.closeble != "0")) {
|
|
a._HideShow(this.parentObject)
|
|
} else {
|
|
a._HideShow(this.parentObject, 2)
|
|
} if (a.checkEvent("onOpenEnd")) {
|
|
if (!a.xmlstate) {
|
|
a.callEvent("onOpenEnd", [this.parentObject.id, a._getOpenState(this.parentObject)])
|
|
} else {
|
|
a._oie_onXLE.push(a.onXLE);
|
|
a.onXLE = a._epnFHe
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._epnFHe = function(c, g, a) {
|
|
if (g != this.rootId) {
|
|
this.callEvent("onOpenEnd", [g, c.getOpenState(g)])
|
|
}
|
|
c.onXLE = c._oie_onXLE.pop();
|
|
if (!a && !c._oie_onXLE.length) {
|
|
if (c.onXLE) {
|
|
c.onXLE(c, g)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.onRowClickDown = function(c) {
|
|
c = c || window.event;
|
|
var a = this.parentObject.treeNod;
|
|
a._selectItem(this.parentObject, c)
|
|
};
|
|
dhtmlXTreeObject.prototype.getSelectedItemId = function() {
|
|
var c = new Array();
|
|
for (var a = 0; a < this._selected.length; a++) {
|
|
c[a] = this._selected[a].id
|
|
}
|
|
return (c.join(this.dlmtr))
|
|
};
|
|
dhtmlXTreeObject.prototype._selectItem = function(m, n) {
|
|
if (this.checkEvent("onSelect")) {
|
|
this._onSSCFold = this.getSelectedItemId()
|
|
}
|
|
if ((!this._amsel) || (!n) || ((!n.ctrlKey) && (!n.metaKey) && (!n.shiftKey))) {
|
|
this._unselectItems()
|
|
}
|
|
if ((m.i_sel) && (this._amsel) && (n) && (n.ctrlKey || n.metaKey)) {
|
|
this._unselectItem(m)
|
|
} else {
|
|
if ((!m.i_sel) && ((!this._amselS) || (this._selected.length == 0) || (this._selected[0].parentObject == m.parentObject))) {
|
|
if ((this._amsel) && (n) && (n.shiftKey) && (this._selected.length != 0) && (this._selected[this._selected.length - 1].parentObject == m.parentObject)) {
|
|
var h = this._getIndex(this._selected[this._selected.length - 1]);
|
|
var g = this._getIndex(m);
|
|
if (g < h) {
|
|
var q = h;
|
|
h = g;
|
|
g = q
|
|
}
|
|
for (var l = h; l <= g; l++) {
|
|
if (!m.parentObject.childNodes[l].i_sel) {
|
|
this._markItem(m.parentObject.childNodes[l])
|
|
}
|
|
}
|
|
} else {
|
|
this._markItem(m)
|
|
}
|
|
}
|
|
} if (this.checkEvent("onSelect")) {
|
|
var o = this.getSelectedItemId();
|
|
if (o != this._onSSCFold) {
|
|
this.callEvent("onSelect", [o])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._markItem = function(a) {
|
|
if (a.scolor) {
|
|
a.span.style.color = a.scolor
|
|
}
|
|
a.span.className = "selectedTreeRow";
|
|
a.i_sel = true;
|
|
this._selected[this._selected.length] = a
|
|
};
|
|
dhtmlXTreeObject.prototype.getIndexById = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return null
|
|
}
|
|
return this._getIndex(a)
|
|
};
|
|
dhtmlXTreeObject.prototype._getIndex = function(a) {
|
|
var g = a.parentObject;
|
|
for (var c = 0; c < g.childsCount; c++) {
|
|
if (g.childNodes[c] == a) {
|
|
return c
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._unselectItem = function(c) {
|
|
if ((c) && (c.i_sel)) {
|
|
c.span.className = "standartTreeRow";
|
|
if (c.acolor) {
|
|
c.span.style.color = c.acolor
|
|
}
|
|
c.i_sel = false;
|
|
for (var a = 0; a < this._selected.length; a++) {
|
|
if (!this._selected[a].i_sel) {
|
|
this._selected.splice(a, 1);
|
|
break
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._unselectItems = function() {
|
|
for (var a = 0; a < this._selected.length; a++) {
|
|
var c = this._selected[a];
|
|
c.span.className = "standartTreeRow";
|
|
if (c.acolor) {
|
|
c.span.style.color = c.acolor
|
|
}
|
|
c.i_sel = false
|
|
}
|
|
this._selected = new Array()
|
|
};
|
|
dhtmlXTreeObject.prototype.onRowSelect = function(h, g, m) {
|
|
h = h || window.event;
|
|
var c = this.parentObject;
|
|
if (g) {
|
|
c = g.parentObject
|
|
}
|
|
var a = c.treeNod;
|
|
var l = a.getSelectedItemId();
|
|
if ((!h) || (!h.skipUnSel)) {
|
|
a._selectItem(c, h)
|
|
}
|
|
if (!m) {
|
|
if (c.actionHandler) {
|
|
c.actionHandler(c.id, l)
|
|
} else {
|
|
a.callEvent("onClick", [c.id, l])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._correctCheckStates = function(l) {
|
|
if (!this.tscheck) {
|
|
return
|
|
}
|
|
if (!l) {
|
|
return
|
|
}
|
|
if (l.id == this.rootId) {
|
|
return
|
|
}
|
|
var g = l.childNodes;
|
|
var c = 0;
|
|
var a = 0;
|
|
if (l.childsCount == 0) {
|
|
return
|
|
}
|
|
for (var h = 0; h < l.childsCount; h++) {
|
|
if (g[h].dscheck) {
|
|
continue
|
|
}
|
|
if (g[h].checkstate == 0) {
|
|
c = 1
|
|
} else {
|
|
if (g[h].checkstate == 1) {
|
|
a = 1
|
|
} else {
|
|
c = 1;
|
|
a = 1;
|
|
break
|
|
}
|
|
}
|
|
}
|
|
if ((c) && (a)) {
|
|
this._setCheck(l, "unsure")
|
|
} else {
|
|
if (c) {
|
|
this._setCheck(l, false)
|
|
} else {
|
|
this._setCheck(l, true)
|
|
}
|
|
}
|
|
this._correctCheckStates(l.parentObject)
|
|
};
|
|
dhtmlXTreeObject.prototype.onCheckBoxClick = function(a) {
|
|
if (!this.treeNod.callEvent("onBeforeCheck", [this.parentObject.id, this.parentObject.checkstate])) {
|
|
return
|
|
}
|
|
if (this.parentObject.dscheck) {
|
|
return true
|
|
}
|
|
if (this.treeNod.tscheck) {
|
|
if (this.parentObject.checkstate == 1) {
|
|
this.treeNod._setSubChecked(false, this.parentObject)
|
|
} else {
|
|
this.treeNod._setSubChecked(true, this.parentObject)
|
|
}
|
|
} else {
|
|
if (this.parentObject.checkstate == 1) {
|
|
this.treeNod._setCheck(this.parentObject, false)
|
|
} else {
|
|
this.treeNod._setCheck(this.parentObject, true)
|
|
}
|
|
}
|
|
this.treeNod._correctCheckStates(this.parentObject.parentObject);
|
|
return this.treeNod.callEvent("onCheck", [this.parentObject.id, this.parentObject.checkstate])
|
|
};
|
|
dhtmlXTreeObject.prototype._createItem = function(u, s, o) {
|
|
var v = document.createElement("table");
|
|
v.cellSpacing = 0;
|
|
v.cellPadding = 0;
|
|
v.border = 0;
|
|
if (this.hfMode) {
|
|
v.style.tableLayout = "fixed"
|
|
}
|
|
v.style.margin = 0;
|
|
v.style.padding = 0;
|
|
var n = document.createElement("tbody");
|
|
var r = document.createElement("tr");
|
|
var h = document.createElement("td");
|
|
h.className = "standartTreeImage";
|
|
if (this._txtimg) {
|
|
var l = document.createElement("div");
|
|
h.appendChild(l);
|
|
l.className = "dhx_tree_textSign"
|
|
} else {
|
|
var l = this._getImg(s.id);
|
|
l.border = "0";
|
|
if (l.tagName == "IMG") {
|
|
l.align = "absmiddle"
|
|
}
|
|
h.appendChild(l);
|
|
l.style.padding = 0;
|
|
l.style.margin = 0;
|
|
l.style.width = this.def_line_img_x;
|
|
l.style.height = this.def_line_img_y
|
|
}
|
|
var g = document.createElement("td");
|
|
var q = this._getImg(this.cBROf ? this.rootId : s.id);
|
|
q.checked = 0;
|
|
this._setSrc(q, this.imPath + this.checkArray[0]);
|
|
q.style.width = "18px";
|
|
q.style.height = "18px";
|
|
if (!u) {
|
|
g.style.display = "none"
|
|
}
|
|
g.appendChild(q);
|
|
if ((!this.cBROf) && (q.tagName == "IMG")) {
|
|
q.align = "absmiddle"
|
|
}
|
|
q.onclick = this.onCheckBoxClick;
|
|
q.treeNod = this;
|
|
q.parentObject = s;
|
|
if (!window._KHTMLrv) {
|
|
g.width = "20px"
|
|
} else {
|
|
g.width = "16px"
|
|
}
|
|
var c = document.createElement("td");
|
|
c.className = "standartTreeImage";
|
|
var m = this._getImg(this.timgen ? s.id : this.rootId);
|
|
m.onmousedown = this._preventNsDrag;
|
|
m.ondragstart = this._preventNsDrag;
|
|
m.border = "0";
|
|
if (this._aimgs) {
|
|
m.parentObject = s;
|
|
if (m.tagName == "IMG") {
|
|
m.align = "absmiddle"
|
|
}
|
|
m.onclick = this.onRowSelect
|
|
}
|
|
if (!o) {
|
|
this._setSrc(m, this.iconURL + this.imageArray[0])
|
|
}
|
|
c.appendChild(m);
|
|
m.style.padding = 0;
|
|
m.style.margin = 0;
|
|
if (this.timgen) {
|
|
c.style.width = m.style.width = this.def_img_x;
|
|
m.style.height = this.def_img_y
|
|
} else {
|
|
m.style.width = "0px";
|
|
m.style.height = "0px";
|
|
if (_isOpera || window._KHTMLrv) {
|
|
c.style.display = "none"
|
|
}
|
|
}
|
|
var a = document.createElement("td");
|
|
a.className = "standartTreeRow";
|
|
s.span = document.createElement("span");
|
|
s.span.className = "standartTreeRow";
|
|
if (this.mlitems) {
|
|
s.span.style.width = this.mlitems;
|
|
s.span.style.display = "block"
|
|
} else {
|
|
a.noWrap = true
|
|
} if (_isIE && _isIE > 7) {
|
|
a.style.width = "999999px"
|
|
} else {
|
|
if (!window._KHTMLrv) {
|
|
a.style.width = "100%"
|
|
}
|
|
}
|
|
s.span.innerHTML = s.label;
|
|
a.appendChild(s.span);
|
|
a.parentObject = s;
|
|
h.parentObject = s;
|
|
a.onclick = this.onRowSelect;
|
|
h.onclick = this.onRowClick;
|
|
a.ondblclick = this.onRowClick2;
|
|
if (this.ettip) {
|
|
r.title = s.label
|
|
}
|
|
if (this.dragAndDropOff) {
|
|
if (this._aimgs) {
|
|
this.dragger.addDraggableItem(c, this);
|
|
c.parentObject = s
|
|
}
|
|
this.dragger.addDraggableItem(a, this)
|
|
}
|
|
s.span.style.paddingLeft = "5px";
|
|
s.span.style.paddingRight = "5px";
|
|
a.style.verticalAlign = "";
|
|
a.style.fontSize = "10pt";
|
|
a.style.cursor = this.style_pointer;
|
|
r.appendChild(h);
|
|
r.appendChild(g);
|
|
r.appendChild(c);
|
|
r.appendChild(a);
|
|
n.appendChild(r);
|
|
v.appendChild(n);
|
|
if (this.ehlt || this.checkEvent("onMouseIn") || this.checkEvent("onMouseOut")) {
|
|
r.onmousemove = this._itemMouseIn;
|
|
r[(_isIE) ? "onmouseleave" : "onmouseout"] = this._itemMouseOut
|
|
}
|
|
return v
|
|
};
|
|
dhtmlXTreeObject.prototype.setImagePath = function(a) {
|
|
this.imPath = a;
|
|
this.iconURL = a
|
|
};
|
|
dhtmlXTreeObject.prototype.setIconPath = function(a) {
|
|
this.iconURL = a
|
|
};
|
|
dhtmlXTreeObject.prototype._getLeafCount = function(h) {
|
|
var g = 0;
|
|
for (var c = 0; c < h.childsCount; c++) {
|
|
if (h.childNodes[c].childsCount == 0) {
|
|
g++
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXTreeObject.prototype._getChildCounterValue = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
if ((a.unParsed) || ((!a.XMLload) && (this.XMLsource))) {
|
|
return a._acc
|
|
}
|
|
switch (this.childCalc) {
|
|
case 1:
|
|
return a.childsCount;
|
|
break;
|
|
case 2:
|
|
return this._getLeafCount(a);
|
|
break;
|
|
case 3:
|
|
return a._acc;
|
|
break;
|
|
case 4:
|
|
return a._acc;
|
|
break
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._fixChildCountLabel = function(m, h) {
|
|
if (this.childCalc == null) {
|
|
return
|
|
}
|
|
if ((m.unParsed) || ((!m.XMLload) && (this.XMLsource))) {
|
|
if (m._acc) {
|
|
m.span.innerHTML = m.label + this.htmlcA + m._acc + this.htmlcB
|
|
} else {
|
|
m.span.innerHTML = m.label
|
|
}
|
|
return
|
|
}
|
|
switch (this.childCalc) {
|
|
case 1:
|
|
if (m.childsCount != 0) {
|
|
m.span.innerHTML = m.label + this.htmlcA + m.childsCount + this.htmlcB
|
|
} else {
|
|
m.span.innerHTML = m.label
|
|
}
|
|
break;
|
|
case 2:
|
|
var l = this._getLeafCount(m);
|
|
if (l != 0) {
|
|
m.span.innerHTML = m.label + this.htmlcA + l + this.htmlcB
|
|
} else {
|
|
m.span.innerHTML = m.label
|
|
}
|
|
break;
|
|
case 3:
|
|
if (m.childsCount != 0) {
|
|
var g = 0;
|
|
for (var c = 0; c < m.childsCount; c++) {
|
|
if (!m.childNodes[c]._acc) {
|
|
m.childNodes[c]._acc = 0
|
|
}
|
|
g += m.childNodes[c]._acc * 1
|
|
}
|
|
g += m.childsCount * 1;
|
|
m.span.innerHTML = m.label + this.htmlcA + g + this.htmlcB;
|
|
m._acc = g
|
|
} else {
|
|
m.span.innerHTML = m.label;
|
|
m._acc = 0
|
|
} if ((m.parentObject) && (m.parentObject != this.htmlNode)) {
|
|
this._fixChildCountLabel(m.parentObject)
|
|
}
|
|
break;
|
|
case 4:
|
|
if (m.childsCount != 0) {
|
|
var g = 0;
|
|
for (var c = 0; c < m.childsCount; c++) {
|
|
if (!m.childNodes[c]._acc) {
|
|
m.childNodes[c]._acc = 1
|
|
}
|
|
g += m.childNodes[c]._acc * 1
|
|
}
|
|
m.span.innerHTML = m.label + this.htmlcA + g + this.htmlcB;
|
|
m._acc = g
|
|
} else {
|
|
m.span.innerHTML = m.label;
|
|
m._acc = 1
|
|
} if ((m.parentObject) && (m.parentObject != this.htmlNode)) {
|
|
this._fixChildCountLabel(m.parentObject)
|
|
}
|
|
break
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.setChildCalcMode = function(a) {
|
|
switch (a) {
|
|
case "child":
|
|
this.childCalc = 1;
|
|
break;
|
|
case "leafs":
|
|
this.childCalc = 2;
|
|
break;
|
|
case "childrec":
|
|
this.childCalc = 3;
|
|
break;
|
|
case "leafsrec":
|
|
this.childCalc = 4;
|
|
break;
|
|
case "disabled":
|
|
this.childCalc = null;
|
|
break;
|
|
default:
|
|
this.childCalc = 4
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.setChildCalcHTML = function(c, a) {
|
|
this.htmlcA = c;
|
|
this.htmlcB = a
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnRightClickHandler = function(a) {
|
|
this.attachEvent("onRightClick", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnClickHandler = function(a) {
|
|
this.attachEvent("onClick", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnSelectStateChange = function(a) {
|
|
this.attachEvent("onSelect", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setXMLAutoLoading = function(a) {
|
|
this.XMLsource = a
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnCheckHandler = function(a) {
|
|
this.attachEvent("onCheck", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnOpenHandler = function(a) {
|
|
this.attachEvent("onOpenStart", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnOpenStartHandler = function(a) {
|
|
this.attachEvent("onOpenStart", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnOpenEndHandler = function(a) {
|
|
this.attachEvent("onOpenEnd", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnDblClickHandler = function(a) {
|
|
this.attachEvent("onDblClick", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.openAllItems = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
this._xopenAll(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.getOpenState = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return ""
|
|
}
|
|
return this._getOpenState(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.closeAllItems = function(c) {
|
|
if (c === window.undefined) {
|
|
c = this.rootId
|
|
}
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
this._xcloseAll(a);
|
|
this.allTree.childNodes[0].border = "1";
|
|
this.allTree.childNodes[0].border = "0"
|
|
};
|
|
dhtmlXTreeObject.prototype.setUserData = function(h, c, g) {
|
|
var a = this._globalIdStorageFind(h, 0, true);
|
|
if (!a) {
|
|
return
|
|
}
|
|
if (c == "hint") {
|
|
a.htmlNode.childNodes[0].childNodes[0].title = g
|
|
}
|
|
if (typeof(a.userData["t_" + c]) == "undefined") {
|
|
if (!a._userdatalist) {
|
|
a._userdatalist = c
|
|
} else {
|
|
a._userdatalist += "," + c
|
|
}
|
|
}
|
|
a.userData["t_" + c] = g
|
|
};
|
|
dhtmlXTreeObject.prototype.getUserData = function(g, c) {
|
|
var a = this._globalIdStorageFind(g, 0, true);
|
|
if (!a) {
|
|
return
|
|
}
|
|
return a.userData["t_" + c]
|
|
};
|
|
dhtmlXTreeObject.prototype.getItemColor = function(g) {
|
|
var a = this._globalIdStorageFind(g);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
var c = new Object();
|
|
if (a.acolor) {
|
|
c.acolor = a.acolor
|
|
}
|
|
if (a.scolor) {
|
|
c.scolor = a.scolor
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXTreeObject.prototype.setItemColor = function(g, c, h) {
|
|
if ((g) && (g.span)) {
|
|
var a = g
|
|
} else {
|
|
var a = this._globalIdStorageFind(g)
|
|
} if (!a) {
|
|
return 0
|
|
} else {
|
|
if (a.i_sel) {
|
|
if (h) {
|
|
a.span.style.color = h
|
|
}
|
|
} else {
|
|
if (c) {
|
|
a.span.style.color = c
|
|
}
|
|
} if (h) {
|
|
a.scolor = h
|
|
}
|
|
if (c) {
|
|
a.acolor = c
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.getItemText = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
return (a.htmlNode.childNodes[0].childNodes[0].childNodes[3].childNodes[0].innerHTML)
|
|
};
|
|
dhtmlXTreeObject.prototype.getParentId = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if ((!a) || (!a.parentObject)) {
|
|
return ""
|
|
}
|
|
return a.parentObject.id
|
|
};
|
|
dhtmlXTreeObject.prototype.changeItemId = function(c, g) {
|
|
if (c == g) {
|
|
return
|
|
}
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
a.id = g;
|
|
a.span.contextMenuId = g;
|
|
this._idpull[g] = this._idpull[c];
|
|
delete this._idpull[c]
|
|
};
|
|
dhtmlXTreeObject.prototype.doCut = function() {
|
|
if (this.nodeCut) {
|
|
this.clearCut()
|
|
}
|
|
this.nodeCut = (new Array()).concat(this._selected);
|
|
for (var a = 0; a < this.nodeCut.length; a++) {
|
|
var c = this.nodeCut[a];
|
|
c._cimgs = new Array();
|
|
c._cimgs[0] = c.images[0];
|
|
c._cimgs[1] = c.images[1];
|
|
c._cimgs[2] = c.images[2];
|
|
c.images[0] = c.images[1] = c.images[2] = this.cutImage;
|
|
this._correctPlus(c)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.doPaste = function(g) {
|
|
var a = this._globalIdStorageFind(g);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
for (var c = 0; c < this.nodeCut.length; c++) {
|
|
if (this._checkPNodes(a, this.nodeCut[c])) {
|
|
continue
|
|
}
|
|
this._moveNode(this.nodeCut[c], a)
|
|
}
|
|
this.clearCut()
|
|
};
|
|
dhtmlXTreeObject.prototype.clearCut = function() {
|
|
for (var a = 0; a < this.nodeCut.length; a++) {
|
|
var c = this.nodeCut[a];
|
|
c.images[0] = c._cimgs[0];
|
|
c.images[1] = c._cimgs[1];
|
|
c.images[2] = c._cimgs[2];
|
|
this._correctPlus(c)
|
|
}
|
|
this.nodeCut = new Array()
|
|
};
|
|
dhtmlXTreeObject.prototype._moveNode = function(a, c) {
|
|
var m = this.dadmodec;
|
|
if (m == 1) {
|
|
var l = c;
|
|
if (this.dadmodefix < 0) {
|
|
while (true) {
|
|
l = this._getPrevNode(l);
|
|
if ((l == -1)) {
|
|
l = this.htmlNode;
|
|
break
|
|
}
|
|
if ((l.tr == 0) || (l.tr.style.display == "") || (!l.parentObject)) {
|
|
break
|
|
}
|
|
}
|
|
var h = l;
|
|
var g = c
|
|
} else {
|
|
if ((l.tr) && (l.tr.nextSibling) && (l.tr.nextSibling.nodem) && (this._getOpenState(l) < 1)) {
|
|
l = l.tr.nextSibling.nodem
|
|
} else {
|
|
l = this._getNextNode(l);
|
|
if ((l == -1)) {
|
|
l = this.htmlNode
|
|
}
|
|
}
|
|
var g = l;
|
|
var h = c
|
|
} if (this._getNodeLevel(h, 0) > this._getNodeLevel(g, 0)) {
|
|
if (!this.dropLower) {
|
|
return this._moveNodeTo(a, h.parentObject)
|
|
} else {
|
|
if (g.id != this.rootId) {
|
|
return this._moveNodeTo(a, g.parentObject, g)
|
|
} else {
|
|
return this._moveNodeTo(a, this.htmlNode, null)
|
|
}
|
|
}
|
|
} else {
|
|
return this._moveNodeTo(a, g.parentObject, g)
|
|
}
|
|
} else {
|
|
return this._moveNodeTo(a, c)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._fixNodesCollection = function(o, m) {
|
|
var c = 0;
|
|
var h = 0;
|
|
var n = o.childNodes;
|
|
var a = o.childsCount - 1;
|
|
if (m == n[a]) {
|
|
return
|
|
}
|
|
for (var l = 0; l < a; l++) {
|
|
if (n[l] == n[a]) {
|
|
n[l] = n[l + 1];
|
|
n[l + 1] = n[a]
|
|
}
|
|
}
|
|
for (var l = 0; l < a + 1; l++) {
|
|
if (c) {
|
|
var g = n[l];
|
|
n[l] = c;
|
|
c = g
|
|
} else {
|
|
if (n[l] == m) {
|
|
c = n[l];
|
|
n[l] = n[a]
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._recreateBranch = function(m, o, l, a) {
|
|
var c;
|
|
var q = "";
|
|
if (l) {
|
|
for (c = 0; c < o.childsCount; c++) {
|
|
if (o.childNodes[c] == l) {
|
|
break
|
|
}
|
|
}
|
|
if (c != 0) {
|
|
l = o.childNodes[c - 1]
|
|
} else {
|
|
q = "TOP";
|
|
l = ""
|
|
}
|
|
}
|
|
var g = this._onradh;
|
|
this._onradh = null;
|
|
var n = this._attachChildNode(o, m.id, m.label, 0, m.images[0], m.images[1], m.images[2], q, 0, l);
|
|
n._userdatalist = m._userdatalist;
|
|
n.userData = m.userData.clone();
|
|
if (m._attrs) {
|
|
n._attrs = {};
|
|
for (var h in m._attrs) {
|
|
n._attrs[h] = m._attrs[h]
|
|
}
|
|
}
|
|
n.XMLload = m.XMLload;
|
|
if (g) {
|
|
this._onradh = g;
|
|
this._onradh(n.id)
|
|
}
|
|
if (m.treeNod.dpcpy) {
|
|
m.treeNod._globalIdStorageFind(m.id)
|
|
} else {
|
|
n.unParsed = m.unParsed
|
|
}
|
|
this._correctPlus(n);
|
|
for (var c = 0; c < m.childsCount; c++) {
|
|
this._recreateBranch(m.childNodes[c], n, 0, 1)
|
|
}
|
|
if ((!a) && (this.childCalc)) {
|
|
this._redrawFrom(this, o)
|
|
}
|
|
return n
|
|
};
|
|
dhtmlXTreeObject.prototype._moveNodeTo = function(u, w, s) {
|
|
if (u.treeNod._nonTrivialNode) {
|
|
return u.treeNod._nonTrivialNode(this, w, s, u)
|
|
}
|
|
if (this._checkPNodes(w, u)) {
|
|
return false
|
|
}
|
|
if (w.mytype) {
|
|
var n = (u.treeNod.lWin != w.lWin)
|
|
} else {
|
|
var n = (u.treeNod.lWin != w.treeNod.lWin)
|
|
} if (!this.callEvent("onDrag", [u.id, w.id, (s ? s.id : null), u.treeNod, w.treeNod])) {
|
|
return false
|
|
}
|
|
if ((w.XMLload == 0) && (this.XMLsource)) {
|
|
w.XMLload = 1;
|
|
this._loadDynXML(w.id)
|
|
}
|
|
this.openItem(w.id);
|
|
var g = u.treeNod;
|
|
var q = u.parentObject.childsCount;
|
|
var r = u.parentObject;
|
|
if ((n) || (g.dpcpy)) {
|
|
var h = u.id;
|
|
u = this._recreateBranch(u, w, s);
|
|
if (!g.dpcpy) {
|
|
g.deleteItem(h)
|
|
}
|
|
} else {
|
|
var l = w.childsCount;
|
|
var v = w.childNodes;
|
|
if (l == 0) {
|
|
w._open = true
|
|
}
|
|
g._unselectItem(u);
|
|
v[l] = u;
|
|
u.treeNod = w.treeNod;
|
|
w.childsCount++;
|
|
var o = this._drawNewTr(v[l].htmlNode);
|
|
if (!s) {
|
|
w.htmlNode.childNodes[0].appendChild(o);
|
|
if (this.dadmode == 1) {
|
|
this._fixNodesCollection(w, s)
|
|
}
|
|
} else {
|
|
w.htmlNode.childNodes[0].insertBefore(o, s.tr);
|
|
this._fixNodesCollection(w, s);
|
|
v = w.childNodes
|
|
}
|
|
} if ((!g.dpcpy) && (!n)) {
|
|
var a = u.tr;
|
|
if ((document.all) && (navigator.appVersion.search(/MSIE\ 5\.0/gi) != -1)) {
|
|
window.setTimeout(function() {
|
|
a.parentNode.removeChild(a)
|
|
}, 250)
|
|
} else {
|
|
u.parentObject.htmlNode.childNodes[0].removeChild(u.tr)
|
|
} if ((!s) || (w != u.parentObject)) {
|
|
for (var m = 0; m < r.childsCount; m++) {
|
|
if (r.childNodes[m].id == u.id) {
|
|
r.childNodes[m] = 0;
|
|
break
|
|
}
|
|
}
|
|
} else {
|
|
r.childNodes[r.childsCount - 1] = 0
|
|
}
|
|
g._compressChildList(r.childsCount, r.childNodes);
|
|
r.childsCount--
|
|
}
|
|
if ((!n) && (!g.dpcpy)) {
|
|
u.tr = o;
|
|
o.nodem = u;
|
|
u.parentObject = w;
|
|
if (g != w.treeNod) {
|
|
if (u.treeNod._registerBranch(u, g)) {
|
|
return
|
|
}
|
|
this._clearStyles(u);
|
|
this._redrawFrom(this, u.parentObject);
|
|
if (this._onradh) {
|
|
this._onradh(u.id)
|
|
}
|
|
}
|
|
this._correctPlus(w);
|
|
this._correctLine(w);
|
|
this._correctLine(u);
|
|
this._correctPlus(u);
|
|
if (s) {
|
|
this._correctPlus(s)
|
|
} else {
|
|
if (w.childsCount >= 2) {
|
|
this._correctPlus(v[w.childsCount - 2]);
|
|
this._correctLine(v[w.childsCount - 2])
|
|
}
|
|
}
|
|
this._correctPlus(v[w.childsCount - 1]);
|
|
if (this.tscheck) {
|
|
this._correctCheckStates(w)
|
|
}
|
|
if (g.tscheck) {
|
|
g._correctCheckStates(r)
|
|
}
|
|
}
|
|
if (q > 1) {
|
|
g._correctPlus(r.childNodes[q - 2]);
|
|
g._correctLine(r.childNodes[q - 2])
|
|
}
|
|
g._correctPlus(r);
|
|
g._correctLine(r);
|
|
this._fixChildCountLabel(w);
|
|
g._fixChildCountLabel(r);
|
|
this.callEvent("onDrop", [u.id, w.id, (s ? s.id : null), g, w.treeNod]);
|
|
return u.id
|
|
};
|
|
dhtmlXTreeObject.prototype._clearStyles = function(a) {
|
|
if (!a.htmlNode) {
|
|
return
|
|
}
|
|
var h = a.htmlNode.childNodes[0].childNodes[0].childNodes[1];
|
|
var c = h.nextSibling.nextSibling;
|
|
a.span.innerHTML = a.label;
|
|
a.i_sel = false;
|
|
if (a._aimgs) {
|
|
this.dragger.removeDraggableItem(h.nextSibling)
|
|
}
|
|
if (this.checkBoxOff) {
|
|
h.childNodes[0].style.display = "";
|
|
h.childNodes[0].onclick = this.onCheckBoxClick;
|
|
this._setSrc(h.childNodes[0], this.imPath + this.checkArray[a.checkstate])
|
|
} else {
|
|
h.style.display = "none"
|
|
}
|
|
h.childNodes[0].treeNod = this;
|
|
this.dragger.removeDraggableItem(c);
|
|
if (this.dragAndDropOff) {
|
|
this.dragger.addDraggableItem(c, this)
|
|
}
|
|
if (this._aimgs) {
|
|
this.dragger.addDraggableItem(h.nextSibling, this)
|
|
}
|
|
c.childNodes[0].className = "standartTreeRow";
|
|
c.onclick = this.onRowSelect;
|
|
c.ondblclick = this.onRowClick2;
|
|
h.previousSibling.onclick = this.onRowClick;
|
|
this._correctLine(a);
|
|
this._correctPlus(a);
|
|
for (var g = 0; g < a.childsCount; g++) {
|
|
this._clearStyles(a.childNodes[g])
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._registerBranch = function(c, a) {
|
|
if (a) {
|
|
a._globalIdStorageSub(c.id)
|
|
}
|
|
c.id = this._globalIdStorageAdd(c.id, c);
|
|
c.treeNod = this;
|
|
for (var g = 0; g < c.childsCount; g++) {
|
|
this._registerBranch(c.childNodes[g], a)
|
|
}
|
|
return 0
|
|
};
|
|
dhtmlXTreeObject.prototype.enableThreeStateCheckboxes = function(a) {
|
|
this.tscheck = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnMouseInHandler = function(a) {
|
|
this.ehlt = true;
|
|
this.attachEvent("onMouseIn", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnMouseOutHandler = function(a) {
|
|
this.ehlt = true;
|
|
this.attachEvent("onMouseOut", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.enableMercyDrag = function(a) {
|
|
this.dpcpy = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.enableTreeImages = function(a) {
|
|
this.timgen = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.enableFixedMode = function(a) {
|
|
this.hfMode = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.enableCheckBoxes = function(c, a) {
|
|
this.checkBoxOff = convertStringToBoolean(c);
|
|
this.cBROf = (!(this.checkBoxOff || convertStringToBoolean(a)))
|
|
};
|
|
dhtmlXTreeObject.prototype.setStdImages = function(a, g, c) {
|
|
this.imageArray[0] = a;
|
|
this.imageArray[1] = g;
|
|
this.imageArray[2] = c
|
|
};
|
|
dhtmlXTreeObject.prototype.enableTreeLines = function(a) {
|
|
this.treeLinesOn = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setImageArrays = function(h, a, m, l, g, c) {
|
|
switch (h) {
|
|
case "plus":
|
|
this.plusArray[0] = a;
|
|
this.plusArray[1] = m;
|
|
this.plusArray[2] = l;
|
|
this.plusArray[3] = g;
|
|
this.plusArray[4] = c;
|
|
break;
|
|
case "minus":
|
|
this.minusArray[0] = a;
|
|
this.minusArray[1] = m;
|
|
this.minusArray[2] = l;
|
|
this.minusArray[3] = g;
|
|
this.minusArray[4] = c;
|
|
break
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.openItem = function(c) {
|
|
this.skipLock = true;
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return 0
|
|
} else {
|
|
return this._openItem(a)
|
|
}
|
|
this.skipLock = false
|
|
};
|
|
dhtmlXTreeObject.prototype._openItem = function(a) {
|
|
var c = this._getOpenState(a);
|
|
if ((c < 0) || (((this.XMLsource) && (!a.XMLload)))) {
|
|
if (!this.callEvent("onOpenStart", [a.id, c])) {
|
|
return 0
|
|
}
|
|
this._HideShow(a, 2);
|
|
if (this.checkEvent("onOpenEnd")) {
|
|
if (this.onXLE == this._epnFHe) {
|
|
this._epnFHe(this, a.id, true)
|
|
}
|
|
if (!this.xmlstate || !this.XMLsource) {
|
|
this.callEvent("onOpenEnd", [a.id, this._getOpenState(a)])
|
|
} else {
|
|
this._oie_onXLE.push(this.onXLE);
|
|
this.onXLE = this._epnFHe
|
|
}
|
|
}
|
|
} else {
|
|
if (this._srnd) {
|
|
this._HideShow(a, 2)
|
|
}
|
|
} if (a.parentObject && !this._skip_open_parent) {
|
|
this._openItem(a.parentObject)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.closeItem = function(c) {
|
|
if (this.rootId == c) {
|
|
return 0
|
|
}
|
|
this.skipLock = true;
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
if (a.closeble) {
|
|
this._HideShow(a, 1)
|
|
}
|
|
this.skipLock = false
|
|
};
|
|
dhtmlXTreeObject.prototype.getLevel = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
return this._getNodeLevel(a, 0)
|
|
};
|
|
dhtmlXTreeObject.prototype.setItemCloseable = function(g, a) {
|
|
a = convertStringToBoolean(a);
|
|
if ((g) && (g.span)) {
|
|
var c = g
|
|
} else {
|
|
var c = this._globalIdStorageFind(g)
|
|
} if (!c) {
|
|
return 0
|
|
}
|
|
c.closeble = a
|
|
};
|
|
dhtmlXTreeObject.prototype._getNodeLevel = function(a, c) {
|
|
if (a.parentObject) {
|
|
return this._getNodeLevel(a.parentObject, c + 1)
|
|
}
|
|
return (c)
|
|
};
|
|
dhtmlXTreeObject.prototype.hasChildren = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return 0
|
|
} else {
|
|
if ((this.XMLsource) && (!a.XMLload)) {
|
|
return true
|
|
} else {
|
|
return a.childsCount
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._getLeafCount = function(h) {
|
|
var g = 0;
|
|
for (var c = 0; c < h.childsCount; c++) {
|
|
if (h.childNodes[c].childsCount == 0) {
|
|
g++
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXTreeObject.prototype.setItemText = function(h, g, c) {
|
|
var a = this._globalIdStorageFind(h);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
a.label = g;
|
|
a.span.innerHTML = g;
|
|
if (this.childCalc) {
|
|
this._fixChildCountLabel(a)
|
|
}
|
|
a.span.parentNode.parentNode.title = c || ""
|
|
};
|
|
dhtmlXTreeObject.prototype.getItemTooltip = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return ""
|
|
}
|
|
return (a.span.parentNode.parentNode._dhx_title || a.span.parentNode.parentNode.title || "")
|
|
};
|
|
dhtmlXTreeObject.prototype.refreshItem = function(c) {
|
|
if (!c) {
|
|
c = this.rootId
|
|
}
|
|
var a = this._globalIdStorageFind(c);
|
|
this.deleteChildItems(c);
|
|
this._loadDynXML(c)
|
|
};
|
|
dhtmlXTreeObject.prototype.setItemImage2 = function(h, a, l, g) {
|
|
var c = this._globalIdStorageFind(h);
|
|
if (!c) {
|
|
return 0
|
|
}
|
|
c.images[1] = l;
|
|
c.images[2] = g;
|
|
c.images[0] = a;
|
|
this._correctPlus(c)
|
|
};
|
|
dhtmlXTreeObject.prototype.setItemImage = function(g, a, h) {
|
|
var c = this._globalIdStorageFind(g);
|
|
if (!c) {
|
|
return 0
|
|
}
|
|
if (h) {
|
|
c.images[1] = a;
|
|
c.images[2] = h
|
|
} else {
|
|
c.images[0] = a
|
|
}
|
|
this._correctPlus(c)
|
|
};
|
|
dhtmlXTreeObject.prototype.getSubItems = function(g) {
|
|
var a = this._globalIdStorageFind(g, 0, 1);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
if (a.unParsed) {
|
|
return (this._getSubItemsXML(a.unParsed))
|
|
}
|
|
var c = "";
|
|
for (i = 0; i < a.childsCount; i++) {
|
|
if (!c) {
|
|
c = "" + a.childNodes[i].id
|
|
} else {
|
|
c += this.dlmtr + a.childNodes[i].id
|
|
}
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXTreeObject.prototype._getAllScraggyItems = function(g) {
|
|
var h = "";
|
|
for (var c = 0; c < g.childsCount; c++) {
|
|
if ((g.childNodes[c].unParsed) || (g.childNodes[c].childsCount > 0)) {
|
|
if (g.childNodes[c].unParsed) {
|
|
var a = this._getAllScraggyItemsXML(g.childNodes[c].unParsed, 1)
|
|
} else {
|
|
var a = this._getAllScraggyItems(g.childNodes[c])
|
|
} if (a) {
|
|
if (h) {
|
|
h += this.dlmtr + a
|
|
} else {
|
|
h = a
|
|
}
|
|
}
|
|
} else {
|
|
if (!h) {
|
|
h = "" + g.childNodes[c].id
|
|
} else {
|
|
h += this.dlmtr + g.childNodes[c].id
|
|
}
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXTreeObject.prototype._getAllFatItems = function(g) {
|
|
var h = "";
|
|
for (var c = 0; c < g.childsCount; c++) {
|
|
if ((g.childNodes[c].unParsed) || (g.childNodes[c].childsCount > 0)) {
|
|
if (!h) {
|
|
h = "" + g.childNodes[c].id
|
|
} else {
|
|
h += this.dlmtr + g.childNodes[c].id
|
|
} if (g.childNodes[c].unParsed) {
|
|
var a = this._getAllFatItemsXML(g.childNodes[c].unParsed, 1)
|
|
} else {
|
|
var a = this._getAllFatItems(g.childNodes[c])
|
|
} if (a) {
|
|
h += this.dlmtr + a
|
|
}
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXTreeObject.prototype._getAllSubItems = function(m, l, h) {
|
|
if (h) {
|
|
c = h
|
|
} else {
|
|
var c = this._globalIdStorageFind(m)
|
|
} if (!c) {
|
|
return 0
|
|
}
|
|
l = "";
|
|
for (var g = 0; g < c.childsCount; g++) {
|
|
if (!l) {
|
|
l = "" + c.childNodes[g].id
|
|
} else {
|
|
l += this.dlmtr + c.childNodes[g].id
|
|
}
|
|
var a = this._getAllSubItems(0, l, c.childNodes[g]);
|
|
if (a) {
|
|
l += this.dlmtr + a
|
|
}
|
|
}
|
|
if (c.unParsed) {
|
|
l = this._getAllSubItemsXML(m, l, c.unParsed)
|
|
}
|
|
return l
|
|
};
|
|
dhtmlXTreeObject.prototype.selectItem = function(h, g, c) {
|
|
g = convertStringToBoolean(g);
|
|
var a = this._globalIdStorageFind(h);
|
|
if ((!a) || (!a.parentObject)) {
|
|
return 0
|
|
}
|
|
if (this.XMLloadingWarning) {
|
|
a.parentObject.openMe = 1
|
|
} else {
|
|
this._openItem(a.parentObject)
|
|
}
|
|
var l = null;
|
|
if (c) {
|
|
l = new Object;
|
|
l.ctrlKey = true;
|
|
if (a.i_sel) {
|
|
l.skipUnSel = true
|
|
}
|
|
}
|
|
if (g) {
|
|
this.onRowSelect(l, a.htmlNode.childNodes[0].childNodes[0].childNodes[3], false)
|
|
} else {
|
|
this.onRowSelect(l, a.htmlNode.childNodes[0].childNodes[0].childNodes[3], true)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.getSelectedItemText = function() {
|
|
var c = new Array();
|
|
for (var a = 0; a < this._selected.length; a++) {
|
|
c[a] = this._selected[a].span.innerHTML
|
|
}
|
|
return (c.join(this.dlmtr))
|
|
};
|
|
dhtmlXTreeObject.prototype._compressChildList = function(a, g) {
|
|
a--;
|
|
for (var c = 0; c < a; c++) {
|
|
if (g[c] == 0) {
|
|
g[c] = g[c + 1];
|
|
g[c + 1] = 0
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._deleteNode = function(n, l, q) {
|
|
if ((!l) || (!l.parentObject)) {
|
|
return 0
|
|
}
|
|
var a = 0;
|
|
var c = 0;
|
|
if (l.tr.nextSibling) {
|
|
a = l.tr.nextSibling.nodem
|
|
}
|
|
if (l.tr.previousSibling) {
|
|
c = l.tr.previousSibling.nodem
|
|
}
|
|
var m = l.parentObject;
|
|
var g = m.childsCount;
|
|
var o = m.childNodes;
|
|
for (var h = 0; h < g; h++) {
|
|
if (o[h].id == n) {
|
|
if (!q) {
|
|
m.htmlNode.childNodes[0].removeChild(o[h].tr)
|
|
}
|
|
o[h] = 0;
|
|
break
|
|
}
|
|
}
|
|
this._compressChildList(g, o);
|
|
if (!q) {
|
|
m.childsCount--
|
|
}
|
|
if (a) {
|
|
this._correctPlus(a);
|
|
this._correctLine(a)
|
|
}
|
|
if (c) {
|
|
this._correctPlus(c);
|
|
this._correctLine(c)
|
|
}
|
|
if (this.tscheck) {
|
|
this._correctCheckStates(m)
|
|
}
|
|
if (!q) {
|
|
this._globalIdStorageRecSub(l)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.setCheck = function(g, c) {
|
|
var a = this._globalIdStorageFind(g, 0, 1);
|
|
if (!a) {
|
|
return
|
|
}
|
|
if (c === "unsure") {
|
|
this._setCheck(a, c)
|
|
} else {
|
|
c = convertStringToBoolean(c);
|
|
if ((this.tscheck) && (this.smcheck)) {
|
|
this._setSubChecked(c, a)
|
|
} else {
|
|
this._setCheck(a, c)
|
|
}
|
|
} if (this.smcheck) {
|
|
this._correctCheckStates(a.parentObject)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._setCheck = function(a, g) {
|
|
if (!a) {
|
|
return
|
|
}
|
|
if (((a.parentObject._r_logic) || (this._frbtr)) && (g)) {
|
|
if (this._frbtrs) {
|
|
if (this._frbtrL) {
|
|
this.setCheck(this._frbtrL.id, 0)
|
|
}
|
|
this._frbtrL = a
|
|
} else {
|
|
for (var c = 0; c < a.parentObject.childsCount; c++) {
|
|
this._setCheck(a.parentObject.childNodes[c], 0)
|
|
}
|
|
}
|
|
}
|
|
var h = a.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];
|
|
if (g == "unsure") {
|
|
a.checkstate = 2
|
|
} else {
|
|
if (g) {
|
|
a.checkstate = 1
|
|
} else {
|
|
a.checkstate = 0
|
|
}
|
|
} if (a.dscheck) {
|
|
a.checkstate = a.dscheck
|
|
}
|
|
this._setSrc(h, this.imPath + ((a.parentObject._r_logic || this._frbtr) ? this.radioArray : this.checkArray)[a.checkstate])
|
|
};
|
|
dhtmlXTreeObject.prototype.setSubChecked = function(g, c) {
|
|
var a = this._globalIdStorageFind(g);
|
|
this._setSubChecked(c, a);
|
|
this._correctCheckStates(a.parentObject)
|
|
};
|
|
dhtmlXTreeObject.prototype._setSubChecked = function(g, a) {
|
|
g = convertStringToBoolean(g);
|
|
if (!a) {
|
|
return
|
|
}
|
|
if (((a.parentObject._r_logic) || (this._frbtr)) && (g)) {
|
|
for (var c = 0; c < a.parentObject.childsCount; c++) {
|
|
this._setSubChecked(0, a.parentObject.childNodes[c])
|
|
}
|
|
}
|
|
if (a.unParsed) {
|
|
this._setSubCheckedXML(g, a.unParsed)
|
|
}
|
|
if (a._r_logic || this._frbtr) {
|
|
this._setSubChecked(g, a.childNodes[0])
|
|
} else {
|
|
for (var c = 0; c < a.childsCount; c++) {
|
|
this._setSubChecked(g, a.childNodes[c])
|
|
}
|
|
}
|
|
var h = a.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];
|
|
if (g) {
|
|
a.checkstate = 1
|
|
} else {
|
|
a.checkstate = 0
|
|
} if (a.dscheck) {
|
|
a.checkstate = a.dscheck
|
|
}
|
|
this._setSrc(h, this.imPath + ((a.parentObject._r_logic || this._frbtr) ? this.radioArray : this.checkArray)[a.checkstate])
|
|
};
|
|
dhtmlXTreeObject.prototype.isItemChecked = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return
|
|
}
|
|
return a.checkstate
|
|
};
|
|
dhtmlXTreeObject.prototype.deleteChildItems = function(h) {
|
|
var a = this._globalIdStorageFind(h);
|
|
if (!a) {
|
|
return
|
|
}
|
|
var c = a.childsCount;
|
|
for (var g = 0; g < c; g++) {
|
|
this._deleteNode(a.childNodes[0].id, a.childNodes[0])
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.deleteItem = function(g, a) {
|
|
if ((!this._onrdlh) || (this._onrdlh(g))) {
|
|
var c = this._deleteItem(g, a);
|
|
if (c) {
|
|
this._fixChildCountLabel(c)
|
|
}
|
|
}
|
|
this.allTree.childNodes[0].border = "1";
|
|
this.allTree.childNodes[0].border = "0"
|
|
};
|
|
dhtmlXTreeObject.prototype._deleteItem = function(m, c, l) {
|
|
c = convertStringToBoolean(c);
|
|
var a = this._globalIdStorageFind(m);
|
|
if (!a) {
|
|
return
|
|
}
|
|
var g = this.getParentId(m);
|
|
var h = a.parentObject;
|
|
this._deleteNode(m, a, l);
|
|
if (this._editCell && this._editCell.id == m) {
|
|
this._editCell = null
|
|
}
|
|
this._correctPlus(h);
|
|
this._correctLine(h);
|
|
if ((c) && (g != this.rootId)) {
|
|
this.selectItem(g, 1)
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXTreeObject.prototype._globalIdStorageRecSub = function(a) {
|
|
for (var c = 0; c < a.childsCount; c++) {
|
|
this._globalIdStorageRecSub(a.childNodes[c]);
|
|
this._globalIdStorageSub(a.childNodes[c].id)
|
|
}
|
|
this._globalIdStorageSub(a.id);
|
|
var g = a;
|
|
g.span = null;
|
|
g.tr.nodem = null;
|
|
g.tr = null;
|
|
g.htmlNode = null
|
|
};
|
|
dhtmlXTreeObject.prototype.insertNewNext = function(o, s, r, g, m, l, h, c, a) {
|
|
var n = this._globalIdStorageFind(o);
|
|
if ((!n) || (!n.parentObject)) {
|
|
return (0)
|
|
}
|
|
var q = this._attachChildNode(0, s, r, g, m, l, h, c, a, n);
|
|
if ((!this.XMLloadingWarning) && (this.childCalc)) {
|
|
this._fixChildCountLabel(n.parentObject)
|
|
}
|
|
return q
|
|
};
|
|
dhtmlXTreeObject.prototype.getItemIdByIndex = function(g, a) {
|
|
var c = this._globalIdStorageFind(g);
|
|
if ((!c) || (a >= c.childsCount)) {
|
|
return null
|
|
}
|
|
return c.childNodes[a].id
|
|
};
|
|
dhtmlXTreeObject.prototype.getChildItemIdByIndex = function(g, a) {
|
|
var c = this._globalIdStorageFind(g);
|
|
if ((!c) || (a >= c.childsCount)) {
|
|
return null
|
|
}
|
|
return c.childNodes[a].id
|
|
};
|
|
dhtmlXTreeObject.prototype.setDragHandler = function(a) {
|
|
this.attachEvent("onDrag", a)
|
|
};
|
|
dhtmlXTreeObject.prototype._clearMove = function() {
|
|
if (this._lastMark) {
|
|
this._lastMark.className = this._lastMark.className.replace(/dragAndDropRow/g, "");
|
|
this._lastMark = null
|
|
}
|
|
this.selectionBar.style.display = "none";
|
|
this.allTree.className = this.allTree.className.replace(" selectionBox", "")
|
|
};
|
|
dhtmlXTreeObject.prototype.enableDragAndDrop = function(c, a) {
|
|
if (c == "temporary_disabled") {
|
|
this.dADTempOff = false;
|
|
c = true
|
|
} else {
|
|
this.dADTempOff = true
|
|
}
|
|
this.dragAndDropOff = convertStringToBoolean(c);
|
|
if (this.dragAndDropOff) {
|
|
this.dragger.addDragLanding(this.allTree, this)
|
|
}
|
|
if (arguments.length > 1) {
|
|
this._ddronr = (!convertStringToBoolean(a))
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._setMove = function(l, g, n) {
|
|
if (l.parentObject.span) {
|
|
var h = getAbsoluteTop(l);
|
|
var c = getAbsoluteTop(this.allTree) - this.allTree.scrollTop;
|
|
this.dadmodec = this.dadmode;
|
|
this.dadmodefix = 0;
|
|
if (this.dadmode == 2) {
|
|
var m = n - h + (document.body.scrollTop || document.documentElement.scrollTop) - 2 - l.offsetHeight / 2;
|
|
if ((Math.abs(m) - l.offsetHeight / 6) > 0) {
|
|
this.dadmodec = 1;
|
|
if (m < 0) {
|
|
this.dadmodefix = 0 - l.offsetHeight
|
|
}
|
|
} else {
|
|
this.dadmodec = 0
|
|
}
|
|
}
|
|
if (this.dadmodec == 0) {
|
|
var a = l.parentObject.span;
|
|
a.className += " dragAndDropRow";
|
|
this._lastMark = a
|
|
} else {
|
|
this._clearMove();
|
|
this.selectionBar.style.top = (h - c + ((parseInt(l.parentObject.span.parentNode.previousSibling.childNodes[0].style.height) || 18) - 1) + this.dadmodefix) + "px";
|
|
this.selectionBar.style.left = "5px";
|
|
if (this.allTree.offsetWidth > 20) {
|
|
this.selectionBar.style.width = (this.allTree.offsetWidth - (_isFF ? 30 : 25)) + "px"
|
|
}
|
|
this.selectionBar.style.display = ""
|
|
}
|
|
this._autoScroll(null, h, c)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._autoScroll = function(g, c, a) {
|
|
if (this.autoScroll) {
|
|
if (g) {
|
|
c = getAbsoluteTop(g);
|
|
a = getAbsoluteTop(this.allTree) - this.allTree.scrollTop
|
|
}
|
|
if ((c - a - parseInt(this.allTree.scrollTop)) > (parseInt(this.allTree.offsetHeight) - 50)) {
|
|
this.allTree.scrollTop = parseInt(this.allTree.scrollTop) + 20
|
|
}
|
|
if ((c - a) < (parseInt(this.allTree.scrollTop) + 30)) {
|
|
this.allTree.scrollTop = parseInt(this.allTree.scrollTop) - 20
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._createDragNode = function(l, h) {
|
|
if (!this.dADTempOff) {
|
|
return null
|
|
}
|
|
var g = l.parentObject;
|
|
if (!this.callEvent("onBeforeDrag", [g.id, h])) {
|
|
return null
|
|
}
|
|
if (!g.i_sel) {
|
|
this._selectItem(g, h)
|
|
}
|
|
this._checkMSelectionLogic();
|
|
var c = document.createElement("div");
|
|
var m = new Array();
|
|
if (this._itim_dg) {
|
|
for (var a = 0; a < this._selected.length; a++) {
|
|
m[a] = "<table cellspacing='0' cellpadding='0'><tr><td><img width='18px' height='18px' src='" + this._getSrc(this._selected[a].span.parentNode.previousSibling.childNodes[0]) + "'></td><td>" + this._selected[a].span.innerHTML + "</td></tr></table>"
|
|
}
|
|
} else {
|
|
m = this.getSelectedItemText().split(this.dlmtr)
|
|
}
|
|
c.innerHTML = m.join("");
|
|
c.style.position = "absolute";
|
|
c.className = "dragSpanDiv";
|
|
this._dragged = (new Array()).concat(this._selected);
|
|
return c
|
|
};
|
|
dhtmlXTreeObject.prototype._focusNode = function(a) {
|
|
var c = getAbsoluteTop(a.htmlNode) - getAbsoluteTop(this.allTree);
|
|
if ((c > (this.allTree.offsetHeight - 30)) || (c < 0)) {
|
|
this.allTree.scrollTop = c + this.allTree.scrollTop
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._preventNsDrag = function(a) {
|
|
if ((a) && (a.preventDefault)) {
|
|
a.preventDefault();
|
|
return false
|
|
}
|
|
return false
|
|
};
|
|
dhtmlXTreeObject.prototype._drag = function(n, o, a) {
|
|
if (this._autoOpenTimer) {
|
|
clearTimeout(this._autoOpenTimer)
|
|
}
|
|
if (!a.parentObject) {
|
|
a = this.htmlNode.htmlNode.childNodes[0].childNodes[0].childNodes[1].childNodes[0];
|
|
this.dadmodec = 0
|
|
}
|
|
this._clearMove();
|
|
var m = n.parentObject.treeNod;
|
|
if ((m) && (m._clearMove)) {
|
|
m._clearMove("")
|
|
}
|
|
if ((!this.dragMove) || (this.dragMove())) {
|
|
if ((!m) || (!m._clearMove) || (!m._dragged)) {
|
|
var h = new Array(n.parentObject)
|
|
} else {
|
|
var h = m._dragged
|
|
}
|
|
var c = a.parentObject;
|
|
for (var l = 0; l < h.length; l++) {
|
|
var g = this._moveNode(h[l], c);
|
|
if ((this.dadmodec) && (g !== false)) {
|
|
c = this._globalIdStorageFind(g, true, true)
|
|
}
|
|
if ((g) && (!this._sADnD)) {
|
|
this.selectItem(g, 0, 1)
|
|
}
|
|
}
|
|
}
|
|
if (m) {
|
|
m._dragged = new Array()
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._dragIn = function(m, h, a, o) {
|
|
if (!this.dADTempOff) {
|
|
return 0
|
|
}
|
|
var n = h.parentObject;
|
|
var c = m.parentObject;
|
|
if ((!c) && (this._ddronr)) {
|
|
return
|
|
}
|
|
if (!this.callEvent("onDragIn", [n.id, c ? c.id : null, n.treeNod, this])) {
|
|
if (c) {
|
|
this._autoScroll(m)
|
|
}
|
|
return 0
|
|
}
|
|
if (!c) {
|
|
this.allTree.className += " selectionBox"
|
|
} else {
|
|
if (n.childNodes == null) {
|
|
this._setMove(m, a, o);
|
|
return m
|
|
}
|
|
var l = n.treeNod;
|
|
for (var g = 0; g < l._dragged.length; g++) {
|
|
if (this._checkPNodes(c, l._dragged[g])) {
|
|
this._autoScroll(m);
|
|
return 0
|
|
}
|
|
}
|
|
this.selectionBar.parentNode.removeChild(this.selectionBar);
|
|
c.span.parentNode.appendChild(this.selectionBar);
|
|
this._setMove(m, a, o);
|
|
if (this._getOpenState(c) <= 0) {
|
|
this._autoOpenId = c.id;
|
|
this._autoOpenTimer = window.setTimeout(new callerFunction(this._autoOpenItem, this), 1000)
|
|
}
|
|
}
|
|
return m
|
|
};
|
|
dhtmlXTreeObject.prototype._autoOpenItem = function(c, a) {
|
|
a.openItem(a._autoOpenId)
|
|
};
|
|
dhtmlXTreeObject.prototype._dragOut = function(a) {
|
|
this._clearMove();
|
|
if (this._autoOpenTimer) {
|
|
clearTimeout(this._autoOpenTimer)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._getNextNode = function(a, c) {
|
|
if ((!c) && (a.childsCount)) {
|
|
return a.childNodes[0]
|
|
}
|
|
if (a == this.htmlNode) {
|
|
return -1
|
|
}
|
|
if ((a.tr) && (a.tr.nextSibling) && (a.tr.nextSibling.nodem)) {
|
|
return a.tr.nextSibling.nodem
|
|
}
|
|
return this._getNextNode(a.parentObject, true)
|
|
};
|
|
dhtmlXTreeObject.prototype._lastChild = function(a) {
|
|
if (a.childsCount) {
|
|
return this._lastChild(a.childNodes[a.childsCount - 1])
|
|
} else {
|
|
return a
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._getPrevNode = function(a, c) {
|
|
if ((a.tr) && (a.tr.previousSibling) && (a.tr.previousSibling.nodem)) {
|
|
return this._lastChild(a.tr.previousSibling.nodem)
|
|
}
|
|
if (a.parentObject) {
|
|
return a.parentObject
|
|
} else {
|
|
return -1
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.findItem = function(a, g, c) {
|
|
var h = this._findNodeByLabel(a, g, (c ? this.htmlNode : null));
|
|
if (h) {
|
|
this.selectItem(h.id, true);
|
|
this._focusNode(h);
|
|
return h.id
|
|
} else {
|
|
return null
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.findItemIdByLabel = function(a, g, c) {
|
|
var h = this._findNodeByLabel(a, g, (c ? this.htmlNode : null));
|
|
if (h) {
|
|
return h.id
|
|
} else {
|
|
return null
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.findStrInXML = function(c, g, l) {
|
|
if (!c.childNodes && c.item) {
|
|
return this.findStrInJSON(c, g, l)
|
|
}
|
|
if (!c.childNodes) {
|
|
return false
|
|
}
|
|
for (var a = 0; a < c.childNodes.length; a++) {
|
|
if (c.childNodes[a].nodeType == 1) {
|
|
var h = c.childNodes[a].getAttribute(g);
|
|
if (!h && c.childNodes[a].tagName == "itemtext") {
|
|
h = c.childNodes[a].firstChild.data
|
|
}
|
|
if ((h) && (h.toLowerCase().search(l) != -1)) {
|
|
return true
|
|
}
|
|
if (this.findStrInXML(c.childNodes[a], g, l)) {
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
return false
|
|
};
|
|
dhtmlXTreeObject.prototype.findStrInJSON = function(c, g, l) {
|
|
for (var a = 0; a < c.item.length; a++) {
|
|
var h = c.item[a].text;
|
|
if ((h) && (h.toLowerCase().search(l) != -1)) {
|
|
return true
|
|
}
|
|
if (c.item[a].item && this.findStrInJSON(c.item[a], g, l)) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
};
|
|
dhtmlXTreeObject.prototype._findNodeByLabel = function(a, l, h) {
|
|
var a = a.replace(new RegExp("^( )+"), "").replace(new RegExp("( )+$"), "");
|
|
a = new RegExp(a.replace(/([\^\.\?\*\+\\\[\]\(\)]{1})/gi, "\\$1").replace(/ /gi, ".*"), "gi");
|
|
if (!h) {
|
|
h = this._selected[0];
|
|
if (!h) {
|
|
h = this.htmlNode
|
|
}
|
|
}
|
|
var c = h;
|
|
if (!l) {
|
|
if ((h.unParsed) && (this.findStrInXML(h.unParsed.d, "text", a))) {
|
|
this.reParse(h)
|
|
}
|
|
h = this._getNextNode(c);
|
|
if (h == -1) {
|
|
h = this.htmlNode.childNodes[0]
|
|
}
|
|
} else {
|
|
var g = this._getPrevNode(c);
|
|
if (g == -1) {
|
|
g = this._lastChild(this.htmlNode)
|
|
}
|
|
if ((g.unParsed) && (this.findStrInXML(g.unParsed.d, "text", a))) {
|
|
this.reParse(g);
|
|
h = this._getPrevNode(c)
|
|
} else {
|
|
h = g
|
|
} if (h == -1) {
|
|
h = this._lastChild(this.htmlNode)
|
|
}
|
|
}
|
|
while ((h) && (h != c)) {
|
|
if ((h.label) && (h.label.search(a) != -1)) {
|
|
return (h)
|
|
}
|
|
if (!l) {
|
|
if (h == -1) {
|
|
if (c == this.htmlNode) {
|
|
break
|
|
}
|
|
h = this.htmlNode.childNodes[0]
|
|
}
|
|
if ((h.unParsed) && (this.findStrInXML(h.unParsed.d, "text", a))) {
|
|
this.reParse(h)
|
|
}
|
|
h = this._getNextNode(h);
|
|
if (h == -1) {
|
|
h = this.htmlNode
|
|
}
|
|
} else {
|
|
var g = this._getPrevNode(h);
|
|
if (g == -1) {
|
|
g = this._lastChild(this.htmlNode)
|
|
}
|
|
if ((g.unParsed) && (this.findStrInXML(g.unParsed.d, "text", a))) {
|
|
this.reParse(g);
|
|
h = this._getPrevNode(h)
|
|
} else {
|
|
h = g
|
|
} if (h == -1) {
|
|
h = this._lastChild(this.htmlNode)
|
|
}
|
|
}
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXTreeObject.prototype.moveItem = function(o, c, q, a) {
|
|
var l = this._globalIdStorageFind(o);
|
|
if (!l) {
|
|
return (0)
|
|
}
|
|
var m = null;
|
|
switch (c) {
|
|
case "right":
|
|
alert("Not supported yet");
|
|
break;
|
|
case "item_child":
|
|
var g = (a || this)._globalIdStorageFind(q);
|
|
if (!g) {
|
|
return (0)
|
|
}
|
|
m = (a || this)._moveNodeTo(l, g, 0);
|
|
break;
|
|
case "item_sibling":
|
|
var g = (a || this)._globalIdStorageFind(q);
|
|
if (!g) {
|
|
return (0)
|
|
}
|
|
m = (a || this)._moveNodeTo(l, g.parentObject, g);
|
|
break;
|
|
case "item_sibling_next":
|
|
var g = (a || this)._globalIdStorageFind(q);
|
|
if (!g) {
|
|
return (0)
|
|
}
|
|
if ((g.tr) && (g.tr.nextSibling) && (g.tr.nextSibling.nodem)) {
|
|
m = (a || this)._moveNodeTo(l, g.parentObject, g.tr.nextSibling.nodem)
|
|
} else {
|
|
m = (a || this)._moveNodeTo(l, g.parentObject)
|
|
}
|
|
break;
|
|
case "left":
|
|
if (l.parentObject.parentObject) {
|
|
m = this._moveNodeTo(l, l.parentObject.parentObject, l.parentObject)
|
|
}
|
|
break;
|
|
case "up":
|
|
var n = this._getPrevNode(l);
|
|
if ((n == -1) || (!n.parentObject)) {
|
|
return null
|
|
}
|
|
m = this._moveNodeTo(l, n.parentObject, n);
|
|
break;
|
|
case "up_strict":
|
|
var n = this._getIndex(l);
|
|
if (n != 0) {
|
|
m = this._moveNodeTo(l, l.parentObject, l.parentObject.childNodes[n - 1])
|
|
}
|
|
break;
|
|
case "down_strict":
|
|
var n = this._getIndex(l);
|
|
var h = l.parentObject.childsCount - 2;
|
|
if (n == h) {
|
|
m = this._moveNodeTo(l, l.parentObject)
|
|
} else {
|
|
if (n < h) {
|
|
m = this._moveNodeTo(l, l.parentObject, l.parentObject.childNodes[n + 2])
|
|
}
|
|
}
|
|
break;
|
|
case "down":
|
|
var n = this._getNextNode(this._lastChild(l));
|
|
if ((n == -1) || (!n.parentObject)) {
|
|
return
|
|
}
|
|
if (n.parentObject == l.parentObject) {
|
|
var n = this._getNextNode(n)
|
|
}
|
|
if (n == -1) {
|
|
m = this._moveNodeTo(l, l.parentObject)
|
|
} else {
|
|
if ((n == -1) || (!n.parentObject)) {
|
|
return
|
|
}
|
|
m = this._moveNodeTo(l, n.parentObject, n)
|
|
}
|
|
break
|
|
}
|
|
if (_isIE && _isIE < 8) {
|
|
this.allTree.childNodes[0].border = "1";
|
|
this.allTree.childNodes[0].border = "0"
|
|
}
|
|
return m
|
|
};
|
|
dhtmlXTreeObject.prototype.setDragBehavior = function(c, a) {
|
|
this._sADnD = (!convertStringToBoolean(a));
|
|
switch (c) {
|
|
case "child":
|
|
this.dadmode = 0;
|
|
break;
|
|
case "sibling":
|
|
this.dadmode = 1;
|
|
break;
|
|
case "complex":
|
|
this.dadmode = 2;
|
|
break
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._loadDynXML = function(g, c) {
|
|
c = c || this.XMLsource;
|
|
var a = (new Date()).valueOf();
|
|
this._ld_id = g;
|
|
if (this.xmlalb == "function") {
|
|
if (c) {
|
|
c(this._escape(g))
|
|
}
|
|
} else {
|
|
if (this.xmlalb == "name") {
|
|
this.loadXML(c + this._escape(g))
|
|
} else {
|
|
if (this.xmlalb == "xmlname") {
|
|
this.loadXML(c + this._escape(g) + ".xml?uid=" + a)
|
|
} else {
|
|
this.loadXML(c + getUrlSymbol(c) + "uid=" + a + "&id=" + this._escape(g))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.enableMultiselection = function(c, a) {
|
|
this._amsel = convertStringToBoolean(c);
|
|
this._amselS = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype._checkMSelectionLogic = function() {
|
|
var g = new Array();
|
|
for (var c = 0; c < this._selected.length; c++) {
|
|
for (var a = 0; a < this._selected.length; a++) {
|
|
if ((c != a) && (this._checkPNodes(this._selected[a], this._selected[c]))) {
|
|
g[g.length] = this._selected[a]
|
|
}
|
|
}
|
|
}
|
|
for (var c = 0; c < g.length; c++) {
|
|
this._unselectItem(g[c])
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._checkPNodes = function(c, a) {
|
|
if (this._dcheckf) {
|
|
return false
|
|
}
|
|
if (a == c) {
|
|
return 1
|
|
}
|
|
if (c.parentObject) {
|
|
return this._checkPNodes(c.parentObject, a)
|
|
} else {
|
|
return 0
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.disableDropCheck = function(a) {
|
|
this._dcheckf = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.enableDistributedParsing = function(g, c, a) {
|
|
this._edsbps = convertStringToBoolean(g);
|
|
this._edsbpsA = new Array();
|
|
this._edsbpsC = c || 10;
|
|
this._edsbpsD = a || 250
|
|
};
|
|
dhtmlXTreeObject.prototype.getDistributedParsingState = function() {
|
|
return (!((!this._edsbpsA) || (!this._edsbpsA.length)))
|
|
};
|
|
dhtmlXTreeObject.prototype.getItemParsingState = function(g) {
|
|
var c = this._globalIdStorageFind(g, true, true);
|
|
if (!c) {
|
|
return 0
|
|
}
|
|
if (this._edsbpsA) {
|
|
for (var a = 0; a < this._edsbpsA.length; a++) {
|
|
if (this._edsbpsA[a][2] == g) {
|
|
return -1
|
|
}
|
|
}
|
|
}
|
|
return 1
|
|
};
|
|
dhtmlXTreeObject.prototype._distributedStart = function(c, l, h, g, a) {
|
|
if (!this._edsbpsA) {
|
|
this._edsbpsA = new Array()
|
|
}
|
|
this._edsbpsA[this._edsbpsA.length] = [c, l, h, g, a]
|
|
};
|
|
dhtmlXTreeObject.prototype._distributedStep = function(h) {
|
|
var c = this;
|
|
if ((!this._edsbpsA) || (!this._edsbpsA.length)) {
|
|
c.XMLloadingWarning = 0;
|
|
return
|
|
}
|
|
var l = this._edsbpsA[0];
|
|
this.parsedArray = new Array();
|
|
this._parse(l[0], l[2], l[3], l[1]);
|
|
var a = this._globalIdStorageFind(l[2]);
|
|
this._redrawFrom(this, a, l[4], this._getOpenState(a));
|
|
var g = this.setCheckList.split(this.dlmtr);
|
|
for (var m = 0; m < g.length; m++) {
|
|
if (g[m]) {
|
|
this.setCheck(g[m], 1)
|
|
}
|
|
}
|
|
this._edsbpsA = (new Array()).concat(this._edsbpsA.slice(1));
|
|
if ((!this._edsbpsA.length)) {
|
|
window.setTimeout(function() {
|
|
if (c.onXLE) {
|
|
c.onXLE(c, h)
|
|
}
|
|
c.callEvent("onXLE", [c, h])
|
|
}, 1);
|
|
c.xmlstate = 0
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.enableTextSigns = function(a) {
|
|
this._txtimg = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.preventIECaching = function(a) {
|
|
this.no_cashe = convertStringToBoolean(a);
|
|
this.XMLLoader.rSeed = this.no_cashe
|
|
};
|
|
dhtmlXTreeObject.prototype.preventIECashing = dhtmlXTreeObject.prototype.preventIECaching;
|
|
dhtmlXTreeObject.prototype.disableCheckbox = function(g, c) {
|
|
if (typeof(g) != "object") {
|
|
var a = this._globalIdStorageFind(g, 0, 1)
|
|
} else {
|
|
var a = g
|
|
} if (!a) {
|
|
return
|
|
}
|
|
a.dscheck = convertStringToBoolean(c) ? (((a.checkstate || 0) % 3) + 3) : ((a.checkstate > 2) ? (a.checkstate - 3) : a.checkstate);
|
|
this._setCheck(a);
|
|
if (a.dscheck < 3) {
|
|
a.dscheck = false
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.smartRefreshBranch = function(c, a) {
|
|
this._branchUpdate = 1;
|
|
this.smartRefreshItem(c, a)
|
|
};
|
|
dhtmlXTreeObject.prototype.smartRefreshItem = function(h, g) {
|
|
var a = this._globalIdStorageFind(h);
|
|
for (var c = 0; c < a.childsCount; c++) {
|
|
a.childNodes[c]._dmark = true
|
|
}
|
|
this.waitUpdateXML = true;
|
|
if (g && g.exists) {
|
|
this._parse(g, h)
|
|
} else {
|
|
this._loadDynXML(h, g)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.refreshItems = function(c, g) {
|
|
var h = c.toString().split(this.dlmtr);
|
|
this.waitUpdateXML = new Array();
|
|
for (var a = 0; a < h.length; a++) {
|
|
this.waitUpdateXML[h[a]] = true
|
|
}
|
|
this.loadXML((g || this.XMLsource) + getUrlSymbol(g || this.XMLsource) + "ids=" + this._escape(c))
|
|
};
|
|
dhtmlXTreeObject.prototype.updateItem = function(n, m, h, g, c, l, o) {
|
|
var a = this._globalIdStorageFind(n);
|
|
a.userData = new cObject();
|
|
if (m) {
|
|
a.label = m
|
|
}
|
|
a.images = new Array(h || this.imageArray[0], g || this.imageArray[1], c || this.imageArray[2]);
|
|
this.setItemText(n, m);
|
|
if (l) {
|
|
this._setCheck(a, true)
|
|
}
|
|
if (o == "1" && !this.hasChildren(n)) {
|
|
a.XMLload = 0
|
|
}
|
|
this._correctPlus(a);
|
|
a._dmark = false;
|
|
return a
|
|
};
|
|
dhtmlXTreeObject.prototype.setDropHandler = function(a) {
|
|
this.attachEvent("onDrop", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnLoadingStart = function(a) {
|
|
this.attachEvent("onXLS", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnLoadingEnd = function(a) {
|
|
this.attachEvent("onXLE", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setXMLAutoLoadingBehaviour = function(a) {
|
|
this.xmlalb = a
|
|
};
|
|
dhtmlXTreeObject.prototype.enableSmartCheckboxes = function(a) {
|
|
this.smcheck = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.getXMLState = function() {
|
|
return (this.xmlstate == 1)
|
|
};
|
|
dhtmlXTreeObject.prototype.setItemTopOffset = function(m, h) {
|
|
var g;
|
|
if (typeof(m) != "object") {
|
|
g = this._globalIdStorageFind(m)
|
|
} else {
|
|
g = m
|
|
}
|
|
var l = g.span.parentNode.parentNode;
|
|
g.span.style.paddingBottom = "1px";
|
|
for (var c = 0; c < l.childNodes.length; c++) {
|
|
if (c != 0) {
|
|
if (_isIE) {
|
|
l.childNodes[c].style.height = "18px";
|
|
l.childNodes[c].style.paddingTop = parseInt(h) + "px"
|
|
} else {
|
|
l.childNodes[c].style.height = 18 + parseInt(h) + "px"
|
|
}
|
|
} else {
|
|
var a = l.childNodes[c].firstChild;
|
|
if (l.childNodes[c].firstChild.tagName != "DIV") {
|
|
a = document.createElement("DIV");
|
|
l.childNodes[c].insertBefore(a, l.childNodes[c].firstChild)
|
|
}
|
|
a.style.height = parseInt(h) + "px";
|
|
if ((g.parentObject.id != this.rootId || g.parentObject.childNodes[0] != g) && this.treeLinesOn) {
|
|
a.style.backgroundImage = "url(" + this.imPath + this.lineArray[5] + ")"
|
|
}
|
|
a.innerHTML = " ";
|
|
a.style.overflow = "hidden";
|
|
if (parseInt(h) == 0) {
|
|
l.childNodes[c].removeChild(a)
|
|
}
|
|
} if (!_isIE) {
|
|
l.childNodes[c].style.verticalAlign = "bottom"
|
|
}
|
|
if (_isIE) {
|
|
this.allTree.childNodes[0].border = "1";
|
|
this.allTree.childNodes[0].border = "0"
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.setIconSize = function(h, c, l) {
|
|
if (l) {
|
|
if ((l) && (l.span)) {
|
|
var a = l
|
|
} else {
|
|
var a = this._globalIdStorageFind(l)
|
|
} if (!a) {
|
|
return (0)
|
|
}
|
|
var g = a.span.parentNode.previousSibling.childNodes[0];
|
|
if (h) {
|
|
g.style.width = h;
|
|
if (window._KHTMLrv) {
|
|
g.parentNode.style.width = h
|
|
}
|
|
}
|
|
if (c) {
|
|
g.style.height = c;
|
|
if (window._KHTMLrv) {
|
|
g.parentNode.style.height = c
|
|
}
|
|
}
|
|
} else {
|
|
this.def_img_x = h;
|
|
this.def_img_y = c
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.getItemImage = function(l, h, c) {
|
|
var g = this._globalIdStorageFind(l);
|
|
if (!g) {
|
|
return ""
|
|
}
|
|
var a = g.images[h || 0];
|
|
if (c) {
|
|
a = this.iconURL + a
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXTreeObject.prototype.enableRadioButtons = function(h, g) {
|
|
if (arguments.length == 1) {
|
|
this._frbtr = convertStringToBoolean(h);
|
|
this.checkBoxOff = this.checkBoxOff || this._frbtr;
|
|
return
|
|
}
|
|
var c = this._globalIdStorageFind(h);
|
|
if (!c) {
|
|
return ""
|
|
}
|
|
g = convertStringToBoolean(g);
|
|
if ((g) && (!c._r_logic)) {
|
|
c._r_logic = true;
|
|
for (var a = 0; a < c.childsCount; a++) {
|
|
this._setCheck(c.childNodes[a], c.childNodes[a].checkstate)
|
|
}
|
|
}
|
|
if ((!g) && (c._r_logic)) {
|
|
c._r_logic = false;
|
|
for (var a = 0; a < c.childsCount; a++) {
|
|
this._setCheck(c.childNodes[a], c.childNodes[a].checkstate)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.enableSingleRadioMode = function(a) {
|
|
this._frbtrs = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.openOnItemAdded = function(a) {
|
|
this._hAdI = !convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.openOnItemAdding = function(a) {
|
|
this._hAdI = !convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.enableMultiLineItems = function(a) {
|
|
if (a === true) {
|
|
this.mlitems = "100%"
|
|
} else {
|
|
this.mlitems = a
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.enableAutoTooltips = function(a) {
|
|
this.ettip = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.clearSelection = function(a) {
|
|
if (a) {
|
|
this._unselectItem(this._globalIdStorageFind(a))
|
|
} else {
|
|
this._unselectItems()
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.showItemSign = function(h, c) {
|
|
var a = this._globalIdStorageFind(h);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
var g = a.span.parentNode.previousSibling.previousSibling.previousSibling;
|
|
if (!convertStringToBoolean(c)) {
|
|
this._openItem(a);
|
|
a.closeble = false;
|
|
a.wsign = true
|
|
} else {
|
|
a.closeble = true;
|
|
a.wsign = false
|
|
}
|
|
this._correctPlus(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.showItemCheckbox = function(l, h) {
|
|
if (!l) {
|
|
for (var c in this._idpull) {
|
|
this.showItemCheckbox(this._idpull[c], h)
|
|
}
|
|
}
|
|
if (typeof(l) != "object") {
|
|
l = this._globalIdStorageFind(l, 0, 0)
|
|
}
|
|
if (!l) {
|
|
return 0
|
|
}
|
|
l.nocheckbox = !convertStringToBoolean(h);
|
|
var g = l.span.parentNode.previousSibling.previousSibling.childNodes[0];
|
|
g.parentNode.style.display = (!l.nocheckbox) ? "" : "none"
|
|
};
|
|
dhtmlXTreeObject.prototype.setListDelimeter = function(a) {
|
|
this.dlmtr = a
|
|
};
|
|
dhtmlXTreeObject.prototype.setEscapingMode = function(a) {
|
|
this.utfesc = a
|
|
};
|
|
dhtmlXTreeObject.prototype.enableHighlighting = function(a) {
|
|
this.ehlt = true;
|
|
this.ehlta = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype._itemMouseOut = function() {
|
|
var c = this.childNodes[3].parentObject;
|
|
var a = c.treeNod;
|
|
a.callEvent("onMouseOut", [c.id]);
|
|
if (c.id == a._l_onMSI) {
|
|
a._l_onMSI = null
|
|
}
|
|
if (!a.ehlta) {
|
|
return
|
|
}
|
|
c.span.className = c.span.className.replace("_lor", "")
|
|
};
|
|
dhtmlXTreeObject.prototype._itemMouseIn = function() {
|
|
var c = this.childNodes[3].parentObject;
|
|
var a = c.treeNod;
|
|
if (a._l_onMSI != c.id) {
|
|
a.callEvent("onMouseIn", [c.id])
|
|
}
|
|
a._l_onMSI = c.id;
|
|
if (!a.ehlta) {
|
|
return
|
|
}
|
|
c.span.className = c.span.className.replace("_lor", "");
|
|
c.span.className = c.span.className.replace(/((standart|selected)TreeRow)/, "$1_lor")
|
|
};
|
|
dhtmlXTreeObject.prototype.enableActiveImages = function(a) {
|
|
this._aimgs = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.focusItem = function(c) {
|
|
var a = this._globalIdStorageFind(c);
|
|
if (!a) {
|
|
return (0)
|
|
}
|
|
this._focusNode(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.getAllSubItems = function(a) {
|
|
return this._getAllSubItems(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.getAllChildless = function() {
|
|
return this._getAllScraggyItems(this.htmlNode)
|
|
};
|
|
dhtmlXTreeObject.prototype.getAllLeafs = dhtmlXTreeObject.prototype.getAllChildless;
|
|
dhtmlXTreeObject.prototype._getAllScraggyItems = function(g) {
|
|
var h = "";
|
|
for (var c = 0; c < g.childsCount; c++) {
|
|
if ((g.childNodes[c].unParsed) || (g.childNodes[c].childsCount > 0)) {
|
|
if (g.childNodes[c].unParsed) {
|
|
var a = this._getAllScraggyItemsXML(g.childNodes[c].unParsed, 1)
|
|
} else {
|
|
var a = this._getAllScraggyItems(g.childNodes[c])
|
|
} if (a) {
|
|
if (h) {
|
|
h += this.dlmtr + a
|
|
} else {
|
|
h = a
|
|
}
|
|
}
|
|
} else {
|
|
if (!h) {
|
|
h = "" + g.childNodes[c].id
|
|
} else {
|
|
h += this.dlmtr + g.childNodes[c].id
|
|
}
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXTreeObject.prototype._getAllFatItems = function(g) {
|
|
var h = "";
|
|
for (var c = 0; c < g.childsCount; c++) {
|
|
if ((g.childNodes[c].unParsed) || (g.childNodes[c].childsCount > 0)) {
|
|
if (!h) {
|
|
h = "" + g.childNodes[c].id
|
|
} else {
|
|
h += this.dlmtr + g.childNodes[c].id
|
|
} if (g.childNodes[c].unParsed) {
|
|
var a = this._getAllFatItemsXML(g.childNodes[c].unParsed, 1)
|
|
} else {
|
|
var a = this._getAllFatItems(g.childNodes[c])
|
|
} if (a) {
|
|
h += this.dlmtr + a
|
|
}
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXTreeObject.prototype.getAllItemsWithKids = function() {
|
|
return this._getAllFatItems(this.htmlNode)
|
|
};
|
|
dhtmlXTreeObject.prototype.getAllFatItems = dhtmlXTreeObject.prototype.getAllItemsWithKids;
|
|
dhtmlXTreeObject.prototype.getAllChecked = function() {
|
|
return this._getAllChecked("", "", 1)
|
|
};
|
|
dhtmlXTreeObject.prototype.getAllUnchecked = function(a) {
|
|
if (a) {
|
|
a = this._globalIdStorageFind(a)
|
|
}
|
|
return this._getAllChecked(a, "", 0)
|
|
};
|
|
dhtmlXTreeObject.prototype.getAllPartiallyChecked = function() {
|
|
return this._getAllChecked("", "", 2)
|
|
};
|
|
dhtmlXTreeObject.prototype.getAllCheckedBranches = function() {
|
|
var a = [this._getAllChecked("", "", 1)];
|
|
var c = this._getAllChecked("", "", 2);
|
|
if (c) {
|
|
a.push(c)
|
|
}
|
|
return a.join(this.dlmtr)
|
|
};
|
|
dhtmlXTreeObject.prototype._getAllChecked = function(h, g, l) {
|
|
if (!h) {
|
|
h = this.htmlNode
|
|
}
|
|
if (h.checkstate == l) {
|
|
if (!h.nocheckbox) {
|
|
if (g) {
|
|
g += this.dlmtr + h.id
|
|
} else {
|
|
g = "" + h.id
|
|
}
|
|
}
|
|
}
|
|
var a = h.childsCount;
|
|
for (var c = 0; c < a; c++) {
|
|
g = this._getAllChecked(h.childNodes[c], g, l)
|
|
}
|
|
if (h.unParsed) {
|
|
g = this._getAllCheckedXML(h.unParsed, g, l)
|
|
}
|
|
if (g) {
|
|
return g
|
|
} else {
|
|
return ""
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.setItemStyle = function(h, g, c) {
|
|
var c = c || false;
|
|
var a = this._globalIdStorageFind(h);
|
|
if (!a) {
|
|
return 0
|
|
}
|
|
if (!a.span.style.cssText) {
|
|
a.span.setAttribute("style", a.span.getAttribute("style") + "; " + g)
|
|
} else {
|
|
a.span.style.cssText = c ? g : a.span.style.cssText + ";" + g
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.enableImageDrag = function(a) {
|
|
this._itim_dg = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnDragIn = function(a) {
|
|
this.attachEvent("onDragIn", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.enableDragAndDropScrolling = function(a) {
|
|
this.autoScroll = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setSkin = function(a) {
|
|
var c = this.parentObject.className.replace(/dhxtree_[^ ]*/gi, "");
|
|
this.parentObject.className = c + " dhxtree_" + a;
|
|
if (a == "dhx_terrace" || a == "dhx_web") {
|
|
this.enableTreeLines(false)
|
|
}
|
|
};
|
|
(function() {
|
|
dhtmlx.extend_api("dhtmlXTreeObject", {
|
|
_init: function(a) {
|
|
return [a.parent, (a.width || "100%"), (a.height || "100%"), (a.root_id || 0)]
|
|
},
|
|
auto_save_selection: "enableAutoSavingSelected",
|
|
auto_tooltip: "enableAutoTooltips",
|
|
checkbox: "enableCheckBoxes",
|
|
checkbox_3_state: "enableThreeStateCheckboxes",
|
|
checkbox_smart: "enableSmartCheckboxes",
|
|
context_menu: "enableContextMenu",
|
|
distributed_parsing: "enableDistributedParsing",
|
|
drag: "enableDragAndDrop",
|
|
drag_copy: "enableMercyDrag",
|
|
drag_image: "enableImageDrag",
|
|
drag_scroll: "enableDragAndDropScrolling",
|
|
editor: "enableItemEditor",
|
|
hover: "enableHighlighting",
|
|
images: "enableTreeImages",
|
|
image_fix: "enableIEImageFix",
|
|
image_path: "setImagePath",
|
|
lines: "enableTreeLines",
|
|
loading_item: "enableLoadingItem",
|
|
multiline: "enableMultiLineItems",
|
|
multiselect: "enableMultiselection",
|
|
navigation: "enableKeyboardNavigation",
|
|
radio: "enableRadioButtons",
|
|
radio_single: "enableSingleRadioMode",
|
|
rtl: "enableRTL",
|
|
search: "enableKeySearch",
|
|
smart_parsing: "enableSmartXMLParsing",
|
|
smart_rendering: "enableSmartRendering",
|
|
text_icons: "enableTextSigns",
|
|
xml: "loadXML",
|
|
skin: "setSkin"
|
|
}, {})
|
|
})();
|
|
dhtmlXTreeObject.prototype._dp_init = function(a) {
|
|
a.attachEvent("insertCallback", function(h, m, c) {
|
|
var g = this._loader.doXPath(".//item", h);
|
|
var l = g[0].getAttribute("text");
|
|
this.obj.insertNewItem(c, m, l, 0, 0, 0, 0, "CHILD")
|
|
});
|
|
a.attachEvent("updateCallback", function(h, m, c) {
|
|
var g = this._loader.doXPath(".//item", h);
|
|
var l = g[0].getAttribute("text");
|
|
this.obj.setItemText(m, l);
|
|
if (this.obj.getParentId(m) != c) {
|
|
this.obj.moveItem(m, "item_child", c)
|
|
}
|
|
this.setUpdated(m, true, "updated")
|
|
});
|
|
a.attachEvent("deleteCallback", function(g, h, c) {
|
|
this.obj.setUserData(h, this.action_param, "true_deleted");
|
|
this.obj.deleteItem(h, false)
|
|
});
|
|
a._methods = ["setItemStyle", "", "changeItemId", "deleteItem"];
|
|
this.attachEvent("onEdit", function(c, g) {
|
|
if (c == 3) {
|
|
a.setUpdated(g, true)
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onDrop", function(m, l, h, g, c) {
|
|
if (g == c) {
|
|
a.setUpdated(m, true)
|
|
}
|
|
});
|
|
this._onrdlh = function(c) {
|
|
var g = a.getState(c);
|
|
if (g == "inserted") {
|
|
a.set_invalid(c, false);
|
|
a.setUpdated(c, false);
|
|
return true
|
|
}
|
|
if (g == "true_deleted") {
|
|
a.setUpdated(c, false);
|
|
return true
|
|
}
|
|
a.setUpdated(c, true, "deleted");
|
|
return false
|
|
};
|
|
this._onradh = function(c) {
|
|
a.setUpdated(c, true, "inserted")
|
|
};
|
|
a._getRowData = function(l) {
|
|
var h = {};
|
|
var m = this.obj._globalIdStorageFind(l);
|
|
var g = m.parentObject;
|
|
var c = 0;
|
|
for (c = 0; c < g.childsCount; c++) {
|
|
if (g.childNodes[c] == m) {
|
|
break
|
|
}
|
|
}
|
|
h.tr_id = m.id;
|
|
h.tr_pid = g.id;
|
|
h.tr_order = c;
|
|
h.tr_text = m.span.innerHTML;
|
|
g = (m._userdatalist || "").split(",");
|
|
for (c = 0; c < g.length; c++) {
|
|
h[g[c]] = m.userData["t_" + g[c]]
|
|
}
|
|
return h
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.makeDraggable = function(c, a) {
|
|
if (typeof(c) != "object") {
|
|
c = document.getElementById(c)
|
|
}
|
|
dragger = new dhtmlDragAndDropObject();
|
|
dropper = new dhx_dragSomethingInTree();
|
|
dragger.addDraggableItem(c, dropper);
|
|
c.dragLanding = null;
|
|
c.ondragstart = dropper._preventNsDrag;
|
|
c.onselectstart = new Function("return false;");
|
|
c.parentObject = new Object;
|
|
c.parentObject.img = c;
|
|
c.parentObject.treeNod = dropper;
|
|
dropper._customDrop = a
|
|
};
|
|
dhtmlXTreeObject.prototype.makeDragable = dhtmlXTreeObject.prototype.makeDraggable;
|
|
dhtmlXTreeObject.prototype.makeAllDraggable = function(c) {
|
|
var g = document.getElementsByTagName("div");
|
|
for (var a = 0; a < g.length; a++) {
|
|
if (g[a].getAttribute("dragInDhtmlXTree")) {
|
|
this.makeDragable(g[a], c)
|
|
}
|
|
}
|
|
};
|
|
|
|
function dhx_dragSomethingInTree() {
|
|
this.lWin = window;
|
|
this._createDragNode = function(c) {
|
|
var a = document.createElement("div");
|
|
a.style.position = "absolute";
|
|
a.innerHTML = (c.innerHTML || c.value);
|
|
a.className = "dragSpanDiv";
|
|
return a
|
|
};
|
|
this._preventNsDrag = function(a) {
|
|
(a || window.event).cancelBubble = true;
|
|
if ((a) && (a.preventDefault)) {
|
|
a.preventDefault();
|
|
return false
|
|
}
|
|
return false
|
|
};
|
|
this._nonTrivialNode = function(c, g, a, h) {
|
|
if (this._customDrop) {
|
|
return this._customDrop(c, h.img.id, g.id, a ? a.id : null)
|
|
}
|
|
var l = (h.img.getAttribute("image") || "");
|
|
var n = h.img.id || "new";
|
|
var m = (h.img.getAttribute("text") || (_isIE ? h.img.innerText : h.img.textContent));
|
|
c[a ? "insertNewNext" : "insertNewItem"](a ? a.id : g.id, n, m, "", l, l, l)
|
|
}
|
|
}
|
|
dhtmlXTreeObject.prototype.enableItemEditor = function(a) {
|
|
this._eItEd = convertStringToBoolean(a);
|
|
if (!this._eItEdFlag) {
|
|
this._edn_click_IE = true;
|
|
this._edn_dblclick = true;
|
|
this._ie_aFunc = this.aFunc;
|
|
this._ie_dblclickFuncHandler = this.dblclickFuncHandler;
|
|
this.setOnDblClickHandler(function(g, c) {
|
|
if (this._edn_dblclick) {
|
|
this._editItem(g, c)
|
|
}
|
|
return true
|
|
});
|
|
this.setOnClickHandler(function(g, c) {
|
|
this._stopEditItem(g, c);
|
|
if ((this.ed_hist_clcik == g) && (this._edn_click_IE)) {
|
|
this._editItem(g, c)
|
|
}
|
|
this.ed_hist_clcik = g;
|
|
return true
|
|
});
|
|
this._eItEdFlag = true
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.setOnEditHandler = function(a) {
|
|
this.attachEvent("onEdit", a)
|
|
};
|
|
dhtmlXTreeObject.prototype.setEditStartAction = function(a, c) {
|
|
this._edn_click_IE = convertStringToBoolean(a);
|
|
this._edn_dblclick = convertStringToBoolean(c)
|
|
};
|
|
dhtmlXTreeObject.prototype._stopEdit = function(c, m) {
|
|
if (this._editCell) {
|
|
this.dADTempOff = this.dADTempOffEd;
|
|
if (this._editCell.id != c) {
|
|
var h = true;
|
|
if (!m) {
|
|
h = this.callEvent("onEdit", [2, this._editCell.id, this, this._editCell.span.childNodes[0].value])
|
|
} else {
|
|
h = false;
|
|
this.callEvent("onEditCancel", [this._editCell.id, this._editCell._oldValue])
|
|
} if (h === true) {
|
|
h = this._editCell.span.childNodes[0].value
|
|
} else {
|
|
if (h === false) {
|
|
h = this._editCell._oldValue
|
|
}
|
|
}
|
|
var l = (h != this._editCell._oldValue);
|
|
this._editCell.span.innerHTML = h;
|
|
this._editCell.label = this._editCell.span.innerHTML;
|
|
var g = this._editCell.i_sel ? "selectedTreeRow" : "standartTreeRow";
|
|
this._editCell.span.className = g;
|
|
this._editCell.span.parentNode.className = "standartTreeRow";
|
|
this._editCell.span.style.paddingRight = this._editCell.span.style.paddingLeft = "5px";
|
|
this._editCell.span.onclick = this._editCell.span.ondblclick = function() {};
|
|
var n = this._editCell.id;
|
|
if (this.childCalc) {
|
|
this._fixChildCountLabel(this._editCell)
|
|
}
|
|
this._editCell = null;
|
|
if (!m) {
|
|
this.callEvent("onEdit", [3, n, this, l])
|
|
}
|
|
if (this._enblkbrd) {
|
|
this.parentObject.lastChild.focus();
|
|
this.parentObject.lastChild.focus()
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._stopEditItem = function(c, a) {
|
|
this._stopEdit(c)
|
|
};
|
|
dhtmlXTreeObject.prototype.stopEdit = function(a) {
|
|
if (this._editCell) {
|
|
this._stopEdit(this._editCell.id + "_non", a)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.editItem = function(a) {
|
|
this._editItem(a, this)
|
|
};
|
|
dhtmlXTreeObject.prototype._editItem = function(l, a) {
|
|
if (this._eItEd) {
|
|
this._stopEdit();
|
|
var g = this._globalIdStorageFind(l);
|
|
if (!g) {
|
|
return
|
|
}
|
|
var h = this.callEvent("onEdit", [0, l, this, g.span.innerHTML]);
|
|
if (h === true) {
|
|
h = (typeof g.span.innerText != "undefined" ? g.span.innerText : g.span.textContent)
|
|
} else {
|
|
if (h === false) {
|
|
return
|
|
}
|
|
}
|
|
this.dADTempOffEd = this.dADTempOff;
|
|
this.dADTempOff = false;
|
|
this._editCell = g;
|
|
g._oldValue = h;
|
|
g.span.innerHTML = "<input type='text' class='intreeeditRow' />";
|
|
g.span.style.paddingRight = g.span.style.paddingLeft = "0px";
|
|
g.span.onclick = g.span.ondblclick = function(m) {
|
|
(m || event).cancelBubble = true
|
|
};
|
|
g.span.childNodes[0].value = h;
|
|
g.span.childNodes[0].onselectstart = function(m) {
|
|
(m || event).cancelBubble = true;
|
|
return true
|
|
};
|
|
g.span.childNodes[0].onmousedown = function(m) {
|
|
(m || event).cancelBubble = true;
|
|
return true
|
|
};
|
|
g.span.childNodes[0].focus();
|
|
g.span.childNodes[0].focus();
|
|
g.span.onclick = function(m) {
|
|
(m || event).cancelBubble = true;
|
|
return false
|
|
};
|
|
g.span.className = "";
|
|
g.span.parentNode.className = "";
|
|
var c = this;
|
|
g.span.childNodes[0].onkeydown = function(m) {
|
|
if (!m) {
|
|
m = window.event
|
|
}
|
|
if (m.keyCode == 13) {
|
|
m.cancelBubble = true;
|
|
c._stopEdit(window.undefined)
|
|
} else {
|
|
if (m.keyCode == 27) {
|
|
c._stopEdit(window.undefined, true)
|
|
}
|
|
}(m || event).cancelBubble = true
|
|
};
|
|
this.callEvent("onEdit", [1, l, this])
|
|
}
|
|
};
|
|
|
|
function jsonPointer(c, a) {
|
|
this.d = c;
|
|
this.dp = a
|
|
}
|
|
jsonPointer.prototype = {
|
|
text: function() {
|
|
var a = function(l) {
|
|
var h = [];
|
|
for (var g = 0; g < l.length; g++) {
|
|
h.push("{" + c(l[g]) + "}")
|
|
}
|
|
return h.join(",")
|
|
};
|
|
var c = function(l) {
|
|
var h = [];
|
|
for (var g in l) {
|
|
if (typeof(l[g]) == "object") {
|
|
if (g.length) {
|
|
h.push('"' + g + '":[' + a(l[g]) + "]")
|
|
} else {
|
|
h.push('"' + g + '":{' + c(l[g]) + "}")
|
|
}
|
|
} else {
|
|
h.push('"' + g + '":"' + l[g] + '"')
|
|
}
|
|
}
|
|
return h.join(",")
|
|
};
|
|
return "{" + c(this.d) + "}"
|
|
},
|
|
get: function(a) {
|
|
return this.d[a]
|
|
},
|
|
exists: function() {
|
|
return !!this.d
|
|
},
|
|
content: function() {
|
|
return this.d.content
|
|
},
|
|
each: function(h, n, m) {
|
|
var g = this.d[h];
|
|
var o = new jsonPointer();
|
|
if (g) {
|
|
for (var l = 0; l < g.length; l++) {
|
|
o.d = g[l];
|
|
n.apply(m, [o, l])
|
|
}
|
|
}
|
|
},
|
|
get_all: function() {
|
|
return this.d
|
|
},
|
|
sub: function(a) {
|
|
return new jsonPointer(this.d[a], this.d)
|
|
},
|
|
sub_exists: function(a) {
|
|
return !!this.d[a]
|
|
},
|
|
each_x: function(h, o, n, m, l) {
|
|
var g = this.d[h];
|
|
var q = new jsonPointer(0, this.d);
|
|
if (g) {
|
|
for (l = l || 0; l < g.length; l++) {
|
|
if (g[l][o]) {
|
|
q.d = g[l];
|
|
if (n.apply(m, [q, l]) == -1) {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
up: function(a) {
|
|
return new jsonPointer(this.dp, this.d)
|
|
},
|
|
set: function(a, c) {
|
|
this.d[a] = c
|
|
},
|
|
clone: function(a) {
|
|
return new jsonPointer(this.d, this.dp)
|
|
},
|
|
through: function(g, n, r, l, s) {
|
|
var o = this.d[g];
|
|
if (o.length) {
|
|
for (var h = 0; h < o.length; h++) {
|
|
if (o[h][n] != null && o[h][n] != "" && (!r || o[h][n] == r)) {
|
|
var m = new jsonPointer(o[h], this.d);
|
|
l.apply(s, [m, h])
|
|
}
|
|
var q = this.d;
|
|
this.d = o[h];
|
|
if (this.sub_exists(g)) {
|
|
this.through(g, n, r, l, s)
|
|
}
|
|
this.d = q
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.loadJSArrayFile = function(file, afterCall) {
|
|
if (!this.parsCount) {
|
|
this.callEvent("onXLS", [this, this._ld_id])
|
|
}
|
|
this._ld_id = null;
|
|
this.xmlstate = 1;
|
|
var that = this;
|
|
this.XMLLoader = new dtmlXMLLoaderObject(function() {
|
|
eval("var z=" + arguments[4].xmlDoc.responseText);
|
|
that.loadJSArray(z)
|
|
}, this, true, this.no_cashe);
|
|
if (afterCall) {
|
|
this.XMLLoader.waitCall = afterCall
|
|
}
|
|
this.XMLLoader.loadXML(file)
|
|
};
|
|
dhtmlXTreeObject.prototype.loadCSV = function(a, g) {
|
|
if (!this.parsCount) {
|
|
this.callEvent("onXLS", [this, this._ld_id])
|
|
}
|
|
this._ld_id = null;
|
|
this.xmlstate = 1;
|
|
var c = this;
|
|
this.XMLLoader = new dtmlXMLLoaderObject(function() {
|
|
c.loadCSVString(arguments[4].xmlDoc.responseText)
|
|
}, this, true, this.no_cashe);
|
|
if (g) {
|
|
this.XMLLoader.waitCall = g
|
|
}
|
|
this.XMLLoader.loadXML(a)
|
|
};
|
|
dhtmlXTreeObject.prototype.loadJSArray = function(a, h) {
|
|
var m = [];
|
|
for (var c = 0; c < a.length; c++) {
|
|
if (!m[a[c][1]]) {
|
|
m[a[c][1]] = []
|
|
}
|
|
m[a[c][1]].push({
|
|
id: a[c][0],
|
|
text: a[c][2]
|
|
})
|
|
}
|
|
var l = {
|
|
id: this.rootId
|
|
};
|
|
var g = function(q, o) {
|
|
if (m[q.id]) {
|
|
q.item = m[q.id];
|
|
for (var n = 0; n < q.item.length; n++) {
|
|
o(q.item[n], o)
|
|
}
|
|
}
|
|
};
|
|
g(l, g);
|
|
this.loadJSONObject(l, h)
|
|
};
|
|
dhtmlXTreeObject.prototype.loadCSVString = function(a, m) {
|
|
var o = [];
|
|
var c = a.split("\n");
|
|
for (var h = 0; h < c.length; h++) {
|
|
var g = c[h].split(",");
|
|
if (!o[g[1]]) {
|
|
o[g[1]] = []
|
|
}
|
|
o[g[1]].push({
|
|
id: g[0],
|
|
text: g[2]
|
|
})
|
|
}
|
|
var n = {
|
|
id: this.rootId
|
|
};
|
|
var l = function(s, r) {
|
|
if (o[s.id]) {
|
|
s.item = o[s.id];
|
|
for (var q = 0; q < s.item.length; q++) {
|
|
r(s.item[q], r)
|
|
}
|
|
}
|
|
};
|
|
l(n, l);
|
|
this.loadJSONObject(n, m)
|
|
};
|
|
dhtmlXTreeObject.prototype.loadJSONObject = function(a, c) {
|
|
if (!this.parsCount) {
|
|
this.callEvent("onXLS", [this, null])
|
|
}
|
|
this.xmlstate = 1;
|
|
var g = new jsonPointer(a);
|
|
this._parse(g);
|
|
this._p = g;
|
|
if (c) {
|
|
c()
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.loadJSON = function(file, afterCall) {
|
|
if (!this.parsCount) {
|
|
this.callEvent("onXLS", [this, this._ld_id])
|
|
}
|
|
this._ld_id = null;
|
|
this.xmlstate = 1;
|
|
var that = this;
|
|
this.XMLLoader = new dtmlXMLLoaderObject(function() {
|
|
try {
|
|
eval("var t=" + arguments[4].xmlDoc.responseText)
|
|
} catch (e) {
|
|
dhtmlxError.throwError("LoadXML", "Incorrect JSON", [(arguments[4].xmlDoc), this]);
|
|
return
|
|
}
|
|
var p = new jsonPointer(t);
|
|
that._parse(p);
|
|
that._p = p
|
|
}, this, true, this.no_cashe);
|
|
if (afterCall) {
|
|
this.XMLLoader.waitCall = afterCall
|
|
}
|
|
this.XMLLoader.loadXML(file)
|
|
};
|
|
dhtmlXTreeObject.prototype.serializeTreeToJSON = function() {
|
|
var a = ['{"id":"' + this.rootId + '", "item":['];
|
|
var g = [];
|
|
for (var c = 0; c < this.htmlNode.childsCount; c++) {
|
|
g.push(this._serializeItemJSON(this.htmlNode.childNodes[c]))
|
|
}
|
|
a.push(g.join(","));
|
|
a.push("]}");
|
|
return a.join("")
|
|
};
|
|
dhtmlXTreeObject.prototype._serializeItemJSON = function(n) {
|
|
var a = [];
|
|
if (n.unParsed) {
|
|
return (n.unParsed.text())
|
|
}
|
|
if (this._selected.length) {
|
|
var g = this._selected[0].id
|
|
} else {
|
|
g = ""
|
|
}
|
|
var m = n.span.innerHTML;
|
|
m = m.replace(/\"/g, '\\"', m);
|
|
if (!this._xfullXML) {
|
|
a.push('{ "id":"' + n.id + '", ' + (this._getOpenState(n) == 1 ? ' "open":"1", ' : "") + (g == n.id ? ' "select":"1",' : "") + ' "text":"' + m + '"' + (((this.XMLsource) && (n.XMLload == 0)) ? ', "child":"1" ' : ""))
|
|
} else {
|
|
a.push('{ "id":"' + n.id + '", ' + (this._getOpenState(n) == 1 ? ' "open":"1", ' : "") + (g == n.id ? ' "select":"1",' : "") + ' "text":"' + m + '", "im0":"' + n.images[0] + '", "im1":"' + n.images[1] + '", "im2":"' + n.images[2] + '" ' + (n.acolor ? (', "aCol":"' + n.acolor + '" ') : "") + (n.scolor ? (', "sCol":"' + n.scolor + '" ') : "") + (n.checkstate == 1 ? ', "checked":"1" ' : (n.checkstate == 2 ? ', "checked":"-1"' : "")) + (n.closeable ? ', "closeable":"1" ' : "") + (((this.XMLsource) && (n.XMLload == 0)) ? ', "child":"1" ' : ""))
|
|
} if ((this._xuserData) && (n._userdatalist)) {
|
|
a.push(', "userdata":[');
|
|
var l = n._userdatalist.split(",");
|
|
var h = [];
|
|
for (var c = 0; c < l.length; c++) {
|
|
h.push('{ "name":"' + l[c] + '" , "content":"' + n.userData["t_" + l[c]] + '" }')
|
|
}
|
|
a.push(h.join(","));
|
|
a.push("]")
|
|
}
|
|
if (n.childsCount) {
|
|
a.push(', "item":[');
|
|
var h = [];
|
|
for (var c = 0; c < n.childsCount; c++) {
|
|
h.push(this._serializeItemJSON(n.childNodes[c]))
|
|
}
|
|
a.push(h.join(","));
|
|
a.push("]\n")
|
|
}
|
|
a.push("}\n");
|
|
return a.join("")
|
|
};
|
|
|
|
function dhtmlXTreeFromHTML(obj) {
|
|
if (typeof(obj) != "object") {
|
|
obj = document.getElementById(obj)
|
|
}
|
|
var n = obj;
|
|
var id = n.id;
|
|
var cont = "";
|
|
for (var j = 0; j < obj.childNodes.length; j++) {
|
|
if (obj.childNodes[j].nodeType == "1") {
|
|
if (obj.childNodes[j].tagName == "XMP") {
|
|
var cHead = obj.childNodes[j];
|
|
for (var m = 0; m < cHead.childNodes.length; m++) {
|
|
cont += cHead.childNodes[m].data
|
|
}
|
|
} else {
|
|
if (obj.childNodes[j].tagName.toLowerCase() == "ul") {
|
|
cont = dhx_li2trees(obj.childNodes[j], new Array(), 0)
|
|
}
|
|
}
|
|
break
|
|
}
|
|
}
|
|
obj.innerHTML = "";
|
|
var t = new dhtmlXTreeObject(obj, "100%", "100%", 0);
|
|
var z_all = new Array();
|
|
for (b in t) {
|
|
z_all[b.toLowerCase()] = b
|
|
}
|
|
var atr = obj.attributes;
|
|
for (var a = 0; a < atr.length; a++) {
|
|
if ((atr[a].name.indexOf("set") == 0) || (atr[a].name.indexOf("enable") == 0)) {
|
|
var an = atr[a].name;
|
|
if (!t[an]) {
|
|
an = z_all[atr[a].name]
|
|
}
|
|
t[an].apply(t, atr[a].value.split(","))
|
|
}
|
|
}
|
|
if (typeof(cont) == "object") {
|
|
t.XMLloadingWarning = 1;
|
|
for (var i = 0; i < cont.length; i++) {
|
|
var n = t.insertNewItem(cont[i][0], cont[i][3], cont[i][1]);
|
|
if (cont[i][2]) {
|
|
t._setCheck(n, cont[i][2])
|
|
}
|
|
}
|
|
t.XMLloadingWarning = 0;
|
|
t.lastLoadedXMLId = 0;
|
|
t._redrawFrom(t)
|
|
} else {
|
|
t.loadXMLString("<tree id='0'>" + cont + "</tree>")
|
|
}
|
|
window[id] = t;
|
|
var oninit = obj.getAttribute("oninit");
|
|
if (oninit) {
|
|
eval(oninit)
|
|
}
|
|
return t
|
|
}
|
|
|
|
function dhx_init_trees() {
|
|
var c = document.getElementsByTagName("div");
|
|
for (var a = 0; a < c.length; a++) {
|
|
if (c[a].className == "dhtmlxTree") {
|
|
dhtmlXTreeFromHTML(c[a])
|
|
}
|
|
}
|
|
}
|
|
|
|
function dhx_li2trees(s, m, g) {
|
|
for (var n = 0; n < s.childNodes.length; n++) {
|
|
var r = s.childNodes[n];
|
|
if ((r.nodeType == 1) && (r.tagName.toLowerCase() == "li")) {
|
|
var q = "";
|
|
var o = null;
|
|
var a = r.getAttribute("checked");
|
|
for (var l = 0; l < r.childNodes.length; l++) {
|
|
var h = r.childNodes[l];
|
|
if (h.nodeType == 3) {
|
|
q += h.data
|
|
} else {
|
|
if (h.tagName.toLowerCase() != "ul") {
|
|
q += dhx_outer_html(h)
|
|
} else {
|
|
o = h
|
|
}
|
|
}
|
|
}
|
|
m[m.length] = [g, q, a, (r.id || (m.length + 1))];
|
|
if (o) {
|
|
m = dhx_li2trees(o, m, (r.id || m.length))
|
|
}
|
|
}
|
|
}
|
|
return m
|
|
}
|
|
|
|
function dhx_outer_html(c) {
|
|
if (c.outerHTML) {
|
|
return c.outerHTML
|
|
}
|
|
var a = document.createElement("DIV");
|
|
a.appendChild(c.cloneNode(true));
|
|
a = a.innerHTML;
|
|
return a
|
|
}
|
|
if (window.addEventListener) {
|
|
window.addEventListener("load", dhx_init_trees, false)
|
|
} else {
|
|
if (window.attachEvent) {
|
|
window.attachEvent("onload", dhx_init_trees)
|
|
}
|
|
}
|
|
dhtmlXTreeObject.prototype.parserExtension = {
|
|
_parseExtension: function(h, c, g) {
|
|
this._idpull[c.id]._attrs = c
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.getAttribute = function(g, a) {
|
|
this._globalIdStorageFind(g);
|
|
var c = this._idpull[g]._attrs;
|
|
return c ? c[a] : window.undefined
|
|
};
|
|
dhtmlXTreeObject.prototype.setAttribute = function(h, a, g) {
|
|
this._globalIdStorageFind(h);
|
|
var c = (this._idpull[h]._attrs) || {};
|
|
c[a] = g;
|
|
this._idpull[h]._attrs = c
|
|
};
|
|
dhtmlXTreeObject.prototype.enableKeyboardNavigation = function(g) {
|
|
this._enblkbrd = convertStringToBoolean(g);
|
|
if (this._enblkbrd) {
|
|
if (_isFF) {
|
|
var c = window.getComputedStyle(this.parentObject, null)["position"];
|
|
if ((c != "absolute") && (c != "relative")) {
|
|
this.parentObject.style.position = "relative"
|
|
}
|
|
}
|
|
this._navKeys = [
|
|
["up", 38],
|
|
["down", 40],
|
|
["open", 39],
|
|
["close", 37],
|
|
["call", 13],
|
|
["edit", 113]
|
|
];
|
|
var a = this;
|
|
var c = document.createElement("INPUT");
|
|
c.className = "a_dhx_hidden_input";
|
|
c.autocomplete = "off";
|
|
if (window._KHTMLrv) {
|
|
c.style.color = "white"
|
|
}
|
|
this.parentObject.appendChild(c);
|
|
this.parentObject[_isOpera ? "onkeypress" : "onkeydown"] = function(h) {
|
|
if (a.callEvent("onKeyPress", [(h || window.event).keyCode, (h || window.event)])) {
|
|
return a._onKeyDown(h || window.event)
|
|
}
|
|
};
|
|
this.parentObject.onclick = function(h) {
|
|
if (_isFF || _isIE) {
|
|
c.select()
|
|
}
|
|
if (window._KHTMLrv || _isOpera) {
|
|
c.focus()
|
|
}
|
|
}
|
|
} else {
|
|
this.parentObject.onkeydown = null
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._onKeyDown = function(g) {
|
|
if (window.globalActiveDHTMLGridObject && globalActiveDHTMLGridObject.isActive) {
|
|
return true
|
|
}
|
|
var a = this;
|
|
for (var c = 0; c < this._navKeys.length; c++) {
|
|
if (this._navKeys[c][1] == g.keyCode) {
|
|
this["_onkey_" + this._navKeys[c][0]].apply(this, [this.getSelectedItemId()]);
|
|
if (g.preventDefault) {
|
|
g.preventDefault()
|
|
}(g || event).cancelBubble = true;
|
|
return false
|
|
}
|
|
}
|
|
if (this._textSearch) {
|
|
return this._searchItemByKey(g)
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXTreeObject.prototype._onkey_up = function(g) {
|
|
var a = this._globalIdStorageFind(g);
|
|
if (!a) {
|
|
return
|
|
}
|
|
var c = this._getPrevVisibleNode(a);
|
|
if (c.id == this.rootId) {
|
|
return
|
|
}
|
|
this.focusItem(c.id);
|
|
this.selectItem(c.id, false)
|
|
};
|
|
dhtmlXTreeObject.prototype._onkey_down = function(g) {
|
|
var a = this._globalIdStorageFind(g);
|
|
if (!a) {
|
|
return
|
|
}
|
|
var c = this._getNextVisibleNode(a);
|
|
if (c.id == this.rootId) {
|
|
return
|
|
}
|
|
this.focusItem(c.id);
|
|
this.selectItem(c.id, false)
|
|
};
|
|
dhtmlXTreeObject.prototype._onkey_open = function(a) {
|
|
this.openItem(a)
|
|
};
|
|
dhtmlXTreeObject.prototype._onkey_close = function(a) {
|
|
this.closeItem(a)
|
|
};
|
|
dhtmlXTreeObject.prototype._onkey_call = function(a) {
|
|
if (this.stopEdit) {
|
|
this.stopEdit();
|
|
this.parentObject.lastChild.focus();
|
|
this.parentObject.lastChild.focus();
|
|
this.selectItem(a, true)
|
|
} else {
|
|
this.selectItem(this.getSelectedItemId(), true)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._onkey_edit = function(a) {
|
|
if (this.editItem) {
|
|
this.editItem(a)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._getNextVisibleNode = function(a, c) {
|
|
if ((!c) && (this._getOpenState(a) > 0)) {
|
|
return a.childNodes[0]
|
|
}
|
|
if ((a.tr) && (a.tr.nextSibling) && (a.tr.nextSibling.nodem)) {
|
|
return a.tr.nextSibling.nodem
|
|
}
|
|
if (a.parentObject) {
|
|
return this._getNextVisibleNode(a.parentObject, 1)
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXTreeObject.prototype._getPrevVisibleNode = function(a) {
|
|
if ((a.tr) && (a.tr.previousSibling) && (a.tr.previousSibling.nodem)) {
|
|
return this._lastVisibleChild(a.tr.previousSibling.nodem)
|
|
}
|
|
if (a.parentObject) {
|
|
return a.parentObject
|
|
} else {
|
|
return a
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._lastVisibleChild = function(a) {
|
|
if (this._getOpenState(a) > 0) {
|
|
return this._lastVisibleChild(a.childNodes[a.childsCount - 1])
|
|
} else {
|
|
return a
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._searchItemByKey = function(c) {
|
|
if (c.keyCode == 8) {
|
|
this._textSearchString = "";
|
|
return true
|
|
}
|
|
var a = String.fromCharCode(c.keyCode).toUpperCase();
|
|
if (a.match(/[A-Z,a-z,0-9\ ]/)) {
|
|
this._textSearchString += a;
|
|
this._textSearchInProgress = true;
|
|
if (!(this.getSelectedItemText() || "").match(RegExp("^" + this._textSearchString, "i"))) {
|
|
this.findItem(this._textSearchString, 0)
|
|
}
|
|
this._textSearchInProgress = false;
|
|
if (c.preventDefault) {
|
|
c.preventDefault()
|
|
}(c || event).cancelBubble = true;
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXTreeObject.prototype.assignKeys = function(a) {
|
|
this._navKeys = a
|
|
};
|
|
dhtmlXTreeObject.prototype.enableKeySearch = function(c) {
|
|
this._textSearch = convertStringToBoolean(c);
|
|
if (!this._textSearch) {
|
|
return
|
|
}
|
|
this._textSearchString = "";
|
|
var a = this;
|
|
this._markItem2 = this._markItem;
|
|
this._markItem = function(g) {
|
|
if (!a._textSearchInProgress) {
|
|
a._textSearchString = ""
|
|
}
|
|
a._markItem2(g)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.enableLoadingItem = function(a) {
|
|
this.attachEvent("onXLS", this._showFakeItem);
|
|
this.attachEvent("onXLE", this._hideFakeItem);
|
|
this._tfi_text = a || "Loading..."
|
|
};
|
|
dhtmlXTreeObject.prototype._showFakeItem = function(a, g) {
|
|
if ((g === null) || (this._globalIdStorageFind("fake_load_xml_" + g))) {
|
|
return
|
|
}
|
|
var c = this.XMLsource;
|
|
this.XMLsource = null;
|
|
this.insertNewItem(g, "fake_load_xml_" + g, this._tfi_text);
|
|
this.XMLsource = c
|
|
};
|
|
dhtmlXTreeObject.prototype._hideFakeItem = function(a, c) {
|
|
if (c === null) {
|
|
return
|
|
}
|
|
this.deleteItem("fake_load_xml_" + c)
|
|
};
|
|
dhtmlXTreeObject.prototype.isLocked = function(a) {
|
|
if (!this._locker) {
|
|
this._init_lock()
|
|
}
|
|
return (this._locker[a] == true)
|
|
};
|
|
dhtmlXTreeObject.prototype._lockItem = function(a, l, c) {
|
|
if (!this._locker) {
|
|
this._init_lock()
|
|
}
|
|
if (l) {
|
|
if (this._locker[a.id] == true) {
|
|
return
|
|
}
|
|
this._locker[a.id] = true;
|
|
a.bIm0 = a.images[0];
|
|
a.bIm1 = a.images[1];
|
|
a.bIm2 = a.images[2];
|
|
a.images[0] = this.lico0;
|
|
a.images[1] = this.lico1;
|
|
a.images[2] = this.lico2;
|
|
var h = a.span.parentNode;
|
|
var g = h.previousSibling;
|
|
this.dragger.removeDraggableItem(h);
|
|
this.dragger.removeDraggableItem(g)
|
|
} else {
|
|
if (this._locker[a.id] != true) {
|
|
return
|
|
}
|
|
this._locker[a.id] = false;
|
|
a.images[0] = a.bIm0;
|
|
a.images[1] = a.bIm1;
|
|
a.images[2] = a.bIm2;
|
|
var h = a.span.parentNode;
|
|
var g = h.previousSibling;
|
|
this.dragger.addDraggableItem(h, this);
|
|
this.dragger.addDraggableItem(g, this)
|
|
} if (!c) {
|
|
this._correctPlus(a)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.lockItem = function(g, c) {
|
|
if (!this._locker) {
|
|
this._init_lock()
|
|
}
|
|
this._lockOn = false;
|
|
var a = this._globalIdStorageFind(g);
|
|
this._lockOn = true;
|
|
this._lockItem(a, convertStringToBoolean(c))
|
|
};
|
|
dhtmlXTreeObject.prototype.setLockedIcons = function(g, c, a) {
|
|
if (!this._locker) {
|
|
this._init_lock()
|
|
}
|
|
this.lico0 = g;
|
|
this.lico1 = c;
|
|
this.lico2 = a
|
|
};
|
|
dhtmlXTreeObject.prototype._init_lock = function() {
|
|
this._locker = new Array();
|
|
this._locker_count = "0";
|
|
this._lockOn = true;
|
|
this._globalIdStorageFindA = this._globalIdStorageFind;
|
|
this._globalIdStorageFind = this._lockIdFind;
|
|
if (this._serializeItem) {
|
|
this._serializeItemA = this._serializeItem;
|
|
this._serializeItem = this._serializeLockItem;
|
|
this._serializeTreeA = this.serializeTree;
|
|
this.serializeTree = this._serializeLockTree
|
|
}
|
|
this.setLockedIcons(this.imageArray[0], this.imageArray[1], this.imageArray[2])
|
|
};
|
|
dhtmlXTreeObject.prototype._lockIdFind = function(g, a, c) {
|
|
if (!this.skipLock) {
|
|
if ((!c) && (this._lockOn == true) && (this._locker[g] == true)) {
|
|
return null
|
|
}
|
|
}
|
|
return this._globalIdStorageFindA(g, a, c)
|
|
};
|
|
dhtmlXTreeObject.prototype._serializeLockItem = function(a) {
|
|
if (this._locker[a.id] == true) {
|
|
return ""
|
|
}
|
|
return this._serializeItemA(a)
|
|
};
|
|
dhtmlXTreeObject.prototype._serializeLockTree = function() {
|
|
var a = this._serializeTreeA();
|
|
return a.replace(/<item[^>]+locked\=\"1\"[^>]+\/>/g, "")
|
|
};
|
|
dhtmlXTreeObject.prototype._moveNodeToA = dhtmlXTreeObject.prototype._moveNodeTo;
|
|
dhtmlXTreeObject.prototype._moveNodeTo = function(a, g, c) {
|
|
if ((g.treeNod.isLocked) && (g.treeNod.isLocked(g.id))) {
|
|
return false
|
|
}
|
|
return this._moveNodeToA(a, g, c)
|
|
};
|
|
dhtmlXTreeObject.prototype.lockTree = function(a) {
|
|
if (convertStringToBoolean(a)) {
|
|
this._initTreeLocker()
|
|
} else {
|
|
if (this._TreeLocker) {
|
|
this._TreeLocker.parentNode.removeChild(this._TreeLocker);
|
|
this._TreeLocker = null
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._initTreeLocker = function(a) {
|
|
if (this._TreeLocker) {
|
|
return
|
|
}
|
|
this.parentObject.style.overflow = "hidden";
|
|
if (this.parentObject.style.position != "absolute") {
|
|
this.parentObject.style.position = "relative"
|
|
}
|
|
var c = document.createElement("div");
|
|
c.style.position = "absolute";
|
|
c.style.left = "0px";
|
|
c.style.top = "0px";
|
|
c.className = "dhx_tree_opacity";
|
|
c.style.width = this.allTree.offsetWidth + "px";
|
|
c.style.backgroundColor = "#FFFFFF";
|
|
c.style.height = this.allTree.offsetHeight + "px";
|
|
this._TreeLocker = c;
|
|
this.parentObject.appendChild(this._TreeLocker)
|
|
};
|
|
dhtmlXTreeObject.prototype.enableRTL = function(c) {
|
|
var a = convertStringToBoolean(c);
|
|
if (((a) && (!this.rtlMode)) || ((!a) && (this.rtlMode))) {
|
|
this.rtlMode = a;
|
|
this._switchToRTL(this.rtlMode)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._switchToRTL = function(a) {
|
|
if (a) {
|
|
this.allTree.className = this._ltr_line = this.lineArray;
|
|
this._ltr_min = this.minusArray;
|
|
this._ltr_plus = this.plusArray;
|
|
this.lineArray = new Array("line2_rtl.gif", "line3_rtl.gif", "line4_rtl.gif", "blank.gif", "blank.gif", "line1_rtl.gif");
|
|
this.minusArray = new Array("minus2_rtl.gif", "minus3_rtl.gif", "minus4_rtl.gif", "minus.gif", "minus5_rtl.gif");
|
|
this.plusArray = new Array("plus2_rtl.gif", "plus3_rtl.gif", "plus4_rtl.gif", "plus.gif", "plus5_rtl.gif");
|
|
this.allTree.className = "containerTableStyleRTL"
|
|
} else {
|
|
this.allTree.className = "containerTableStyle";
|
|
this.lineArray = this._ltr_line;
|
|
this.minusArray = this._ltr_min;
|
|
this.plusArray = this._ltr_plus
|
|
} if (this.htmlNode.childsCount) {
|
|
this._redrawFrom(this, this.htmlNode)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.sortTree = function(h, c, g) {
|
|
var a = this._globalIdStorageFind(h);
|
|
if (!a) {
|
|
return false
|
|
}
|
|
this._reorderBranch(a, (c.toString().toLowerCase() == "asc"), convertStringToBoolean(g))
|
|
};
|
|
dhtmlXTreeObject.prototype.setCustomSortFunction = function(a) {
|
|
this._csfunca = a
|
|
};
|
|
dhtmlXTreeObject.prototype._reorderBranch = function(o, c, q) {
|
|
var a = [];
|
|
var n = o.childsCount;
|
|
if (!n) {
|
|
return
|
|
}
|
|
var l = o.childNodes[0].tr.parentNode;
|
|
for (var h = 0; h < n; h++) {
|
|
a[h] = o.childNodes[h];
|
|
l.removeChild(a[h].tr)
|
|
}
|
|
var g = this;
|
|
if (c == 1) {
|
|
if (this._csfunca) {
|
|
a.sort(function(r, m) {
|
|
return g._csfunca(r.id, m.id)
|
|
})
|
|
} else {
|
|
a.sort(function(r, m) {
|
|
return ((r.span.innerHTML.toUpperCase() > m.span.innerHTML.toUpperCase()) ? 1 : ((r.span.innerHTML.toUpperCase() == m.span.innerHTML.toUpperCase()) ? 0 : -1))
|
|
})
|
|
}
|
|
} else {
|
|
if (this._csfunca) {
|
|
a.sort(function(r, m) {
|
|
return g._csfunca(m.id, r.id)
|
|
})
|
|
} else {
|
|
a.sort(function(r, m) {
|
|
return ((r.span.innerHTML.toUpperCase() < m.span.innerHTML.toUpperCase()) ? 1 : ((r.span.innerHTML.toUpperCase() == m.span.innerHTML.toUpperCase()) ? 0 : -1))
|
|
})
|
|
}
|
|
}
|
|
for (var h = 0; h < n; h++) {
|
|
l.appendChild(a[h].tr);
|
|
o.childNodes[h] = a[h];
|
|
if ((q) && (a[h].unParsed)) {
|
|
a[h].unParsed.set("order", c ? 1 : -1)
|
|
} else {
|
|
if ((q) && (a[h].childsCount)) {
|
|
this._reorderBranch(a[h], c, q)
|
|
}
|
|
}
|
|
}
|
|
for (var h = 0; h < n; h++) {
|
|
this._correctPlus(a[h]);
|
|
this._correctLine(a[h])
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._reorderXMLBranch = function(n) {
|
|
var o = n.getAttribute("order");
|
|
if (o == "none") {
|
|
return
|
|
}
|
|
var c = (o == 1);
|
|
var l = n.childNodes.length;
|
|
if (!l) {
|
|
return
|
|
}
|
|
var a = new Array();
|
|
var g = 0;
|
|
for (var h = 0; h < l; h++) {
|
|
if (n.childNodes[h].nodeType == 1) {
|
|
a[g] = n.childNodes[h];
|
|
g++
|
|
}
|
|
}
|
|
for (var h = l - 1; h != 0; h--) {
|
|
n.removeChild(n.childNodes[h])
|
|
}
|
|
if (c) {
|
|
a.sort(function(q, m) {
|
|
return ((q.getAttribute("text") > m.getAttribute("text")) ? 1 : ((q.getAttribute("text") == m.getAttribute("text")) ? 0 : -1))
|
|
})
|
|
} else {
|
|
a.sort(function(q, m) {
|
|
return ((q.getAttribute("text") < m.getAttribute("text")) ? 1 : ((q.getAttribute("text") == m.getAttribute("text")) ? 0 : -1))
|
|
})
|
|
}
|
|
for (var h = 0; h < g; h++) {
|
|
a[h].setAttribute("order", o);
|
|
n.appendChild(a[h])
|
|
}
|
|
n.setAttribute("order", "none")
|
|
};
|
|
dhtmlXTreeObject.prototype._serEnts = [
|
|
["&", "&"],
|
|
["<", "<"],
|
|
[">", ">"]
|
|
];
|
|
dhtmlXTreeObject.prototype.registerXMLEntity = function(a, c) {
|
|
this._serEnts[this._serEnts.length] = [a, c, new RegExp(a, "g")]
|
|
};
|
|
dhtmlXTreeObject.prototype.setSerializationLevel = function(a, c, l, m, g) {
|
|
this._xuserData = convertStringToBoolean(a);
|
|
this._xfullXML = convertStringToBoolean(c);
|
|
this._dtd = g;
|
|
this._xescapeEntities = convertStringToBoolean(l);
|
|
if (convertStringToBoolean(m)) {
|
|
this._apreUC = "<![CDATA[";
|
|
this._apstUC = "]]>"
|
|
} else {}
|
|
for (var h = 0; h < this._serEnts.length; h++) {
|
|
this._serEnts[h][2] = new RegExp(this._serEnts[h][0], "g")
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.serializeTree = function() {
|
|
if (this.stopEdit) {
|
|
this.stopEdit()
|
|
}
|
|
this._apreUC = this._apreUC || "";
|
|
this._apstUC = this._apstUC || "";
|
|
var a = '<?xml version="1.0"?>';
|
|
if (this._dtd) {
|
|
a += '<!DOCTYPE tree SYSTEM "' + this._dtd + '">'
|
|
}
|
|
a += '<tree id="' + this.rootId + '">';
|
|
if ((this._xuserData) && (this._idpull[this.rootId]._userdatalist)) {
|
|
var g = this._idpull[this.rootId]._userdatalist.split(",");
|
|
for (var c = 0; c < g.length; c++) {
|
|
a += '<userdata name="' + g[c] + '">' + this._apreUC + this._idpull[this.rootId].userData["t_" + g[c]] + this._apstUC + "</userdata>"
|
|
}
|
|
}
|
|
for (var c = 0; c < this.htmlNode.childsCount; c++) {
|
|
a += this._serializeItem(this.htmlNode.childNodes[c])
|
|
}
|
|
a += "</tree>";
|
|
return a
|
|
};
|
|
dhtmlXTreeObject.prototype._serializeItem = function(n) {
|
|
if (n.unParsed) {
|
|
if (document.all) {
|
|
return n.unParsed.d.xml
|
|
} else {
|
|
var a = new XMLSerializer();
|
|
return a.serializeToString(n.unParsed.d)
|
|
}
|
|
}
|
|
var c = "";
|
|
if (this._selected.length) {
|
|
var h = this._selected[0].id
|
|
} else {
|
|
h = '"'
|
|
}
|
|
var m = n.span.innerHTML;
|
|
if (this._xescapeEntities) {
|
|
for (var g = 0; g < this._serEnts.length; g++) {
|
|
m = m.replace(this._serEnts[g][2], this._serEnts[g][1])
|
|
}
|
|
}
|
|
if (!this._xfullXML) {
|
|
c = '<item id="' + n.id + '" ' + (this._getOpenState(n) == 1 ? ' open="1" ' : "") + (h == n.id ? ' select="1"' : "") + ' text="' + m + '"' + (((this.XMLsource) && (n.XMLload == 0)) ? ' child="1" ' : "") + ">"
|
|
} else {
|
|
c = '<item id="' + n.id + '" ' + (this._getOpenState(n) == 1 ? ' open="1" ' : "") + (h == n.id ? ' select="1"' : "") + ' text="' + m + '" im0="' + n.images[0] + '" im1="' + n.images[1] + '" im2="' + n.images[2] + '" ' + (n.acolor ? ('aCol="' + n.acolor + '" ') : "") + (n.scolor ? ('sCol="' + n.scolor + '" ') : "") + (n.checkstate == 1 ? 'checked="1" ' : (n.checkstate == 2 ? 'checked="-1"' : "")) + (n.closeable ? 'closeable="1" ' : "") + (((this.XMLsource) && (n.XMLload == 0)) ? ' child="1" ' : "") + ">"
|
|
} if ((this._xuserData) && (n._userdatalist)) {
|
|
var l = n._userdatalist.split(",");
|
|
for (var g = 0; g < l.length; g++) {
|
|
c += '<userdata name="' + l[g] + '">' + this._apreUC + n.userData["t_" + l[g]] + this._apstUC + "</userdata>"
|
|
}
|
|
}
|
|
for (var g = 0; g < n.childsCount; g++) {
|
|
c += this._serializeItem(n.childNodes[g])
|
|
}
|
|
c += "</item>";
|
|
return c
|
|
};
|
|
dhtmlXTreeObject.prototype.saveSelectedItem = function(c, a) {
|
|
c = c || "";
|
|
this.setCookie("treeStateSelected" + c, this.getSelectedItemId(), a)
|
|
};
|
|
dhtmlXTreeObject.prototype.restoreSelectedItem = function(a) {
|
|
a = a || "";
|
|
var c = this.getCookie("treeStateSelected" + a);
|
|
this.selectItem(c, false)
|
|
};
|
|
dhtmlXTreeObject.prototype.enableAutoSavingSelected = function(a, c) {
|
|
this.assMode = convertStringToBoolean(a);
|
|
if ((this.assMode) && (!this.oldOnSelect)) {
|
|
this.oldOnSelect = this.onRowSelect;
|
|
this.onRowSelect = function(h, g, l) {
|
|
if (!g) {
|
|
g = this
|
|
}
|
|
g.parentObject.treeNod.oldOnSelect(h, g, l);
|
|
if (g.parentObject.treeNod.assMode) {
|
|
g.parentObject.treeNod.saveSelectedItem(g.parentObject.treeNod.assCookieName)
|
|
}
|
|
}
|
|
}
|
|
this.assCookieName = c
|
|
};
|
|
dhtmlXTreeObject.prototype.saveState = function(g, c) {
|
|
var l = this._escape(this.serializeTree());
|
|
var a = 4000;
|
|
if (l.length > a) {
|
|
if (navigator.appName.indexOf("Microsoft") != -1) {
|
|
return false
|
|
}
|
|
this.setCookie("treeStatex" + g, Math.ceil(l.length / a));
|
|
for (var h = 0; h < Math.ceil(l.length / a); h++) {
|
|
this.setCookie("treeStatex" + g + "x" + h, l.substr(h * a, a), c)
|
|
}
|
|
} else {
|
|
this.setCookie("treeStatex" + g, l, c)
|
|
}
|
|
var l = this.getCookie("treeStatex" + g);
|
|
if (!l) {
|
|
this.setCookie("treeStatex" + g, "", c);
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXTreeObject.prototype.loadState = function(a) {
|
|
var h = this.getCookie("treeStatex" + a);
|
|
if (!h) {
|
|
return false
|
|
}
|
|
if (h.length) {
|
|
if (h.toString().length < 4) {
|
|
var g = "";
|
|
for (var c = 0; c < h; c++) {
|
|
g += this.getCookie("treeStatex" + a + "x" + c)
|
|
}
|
|
h = g
|
|
}
|
|
this.loadXMLString((this.utfesc == "utf8") ? decodeURI(h) : unescape(h))
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXTreeObject.prototype.setCookie = function(c, g, a) {
|
|
var h = c + "=" + g + (a ? ("; " + a) : "");
|
|
document.cookie = h
|
|
};
|
|
dhtmlXTreeObject.prototype.getCookie = function(c) {
|
|
var g = c + "=";
|
|
if (document.cookie.length > 0) {
|
|
var h = document.cookie.indexOf(g);
|
|
if (h != -1) {
|
|
h += g.length;
|
|
var a = document.cookie.indexOf(";", h);
|
|
if (a == -1) {
|
|
a = document.cookie.length
|
|
}
|
|
return document.cookie.substring(h, a)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.saveOpenStates = function(c, a) {
|
|
var h = [];
|
|
for (var g = 0; g < this.htmlNode.childsCount; g++) {
|
|
h = h.concat(this._collectOpenStates(this.htmlNode.childNodes[g]))
|
|
}
|
|
h = h.join(this.dlmtr);
|
|
this.setCookie("treeOpenStatex" + c, h, a)
|
|
};
|
|
dhtmlXTreeObject.prototype.loadOpenStates = function(c) {
|
|
for (var g = 0; g < this.htmlNode.childsCount; g++) {
|
|
this._xcloseAll(this.htmlNode.childNodes[g])
|
|
}
|
|
this.allTree.childNodes[0].border = "1";
|
|
this.allTree.childNodes[0].border = "0";
|
|
var l = getCookie("treeOpenStatex" + c);
|
|
if (l) {
|
|
var a = l.split(this.dlmtr);
|
|
for (var g = 0; g < a.length; g++) {
|
|
var h = this._globalIdStorageFind(a[g]);
|
|
if (h) {
|
|
if ((this.XMLsource) && (!h.XMLload) && (h.id != this.rootId)) {
|
|
this._delayedLoad(h, "loadOpenStates('" + c + "')");
|
|
return
|
|
} else {
|
|
this.openItem(a[g])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.callEvent("onAllOpenDynamic", [])
|
|
};
|
|
dhtmlXTreeObject.prototype._delayedLoad = function(c, a) {
|
|
this.afterLoadMethod = a;
|
|
this.onLoadReserve = this.onXLE;
|
|
this.onXLE = this._delayedLoadStep2;
|
|
this._loadDynXML(c.id)
|
|
};
|
|
dhtmlXTreeObject.prototype._delayedLoadStep2 = function(tree) {
|
|
tree.onXLE = tree.onLoadReserve;
|
|
window.setTimeout(function() {
|
|
dhtmlx.temp = tree;
|
|
eval("dhtmlx.temp." + tree.afterLoadMethod)
|
|
}, 100);
|
|
if (tree.onXLE) {
|
|
tree.onXLE(tree)
|
|
}
|
|
tree.callEvent("onXLE", [tree])
|
|
};
|
|
dhtmlXTreeObject.prototype._collectOpenStates = function(c) {
|
|
var g = [];
|
|
if (this._getOpenState(c) == 1) {
|
|
g.push(c.id);
|
|
for (var a = 0; a < c.childsCount; a++) {
|
|
g = g.concat(this._collectOpenStates(c.childNodes[a]))
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
|
|
function setCookie(a, c) {
|
|
document.cookie = a + "=" + c
|
|
}
|
|
|
|
function getCookie(c) {
|
|
var g = c + "=";
|
|
if (document.cookie.length > 0) {
|
|
var h = document.cookie.indexOf(g);
|
|
if (h != -1) {
|
|
h += g.length;
|
|
var a = document.cookie.indexOf(";", h);
|
|
if (a == -1) {
|
|
a = document.cookie.length
|
|
}
|
|
return (document.cookie.substring(h, a))
|
|
}
|
|
}
|
|
}
|
|
dhtmlXTreeObject.prototype.openAllItemsDynamic = function(a) {
|
|
this.ClosedElem = new Array();
|
|
this.G_node = null;
|
|
var c = this._globalIdStorageFind(a || this.rootId);
|
|
if (c.id != this.rootId && this.getOpenState(c.id) != 0) {
|
|
this.openItem(a)
|
|
}
|
|
this._openAllNodeChilds(c, 0);
|
|
if (this.ClosedElem.length > 0) {
|
|
this.onLoadReserve = this.onXLE;
|
|
this.onXLE = this._loadAndOpen;
|
|
this._loadAndOpen(this)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._openAllNodeChilds = function(c) {
|
|
if ((c.XMLload == 0) || (c.unParsed)) {
|
|
this.ClosedElem.push(c)
|
|
}
|
|
for (var a = 0; a < c.childsCount; a++) {
|
|
if (this._getOpenState(c.childNodes[a]) < 0) {
|
|
this._HideShow(c.childNodes[a], 2)
|
|
}
|
|
if (c.childNodes[a].childsCount > 0) {
|
|
this._openAllNodeChilds(c.childNodes[a])
|
|
}
|
|
if ((c.childNodes[a].XMLload == 0) || (c.childNodes[a].unParsed)) {
|
|
this.ClosedElem.push(c.childNodes[a])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._loadAndOpen = function(a) {
|
|
if (a.G_node) {
|
|
a._openItem(a.G_node);
|
|
a._openAllNodeChilds(a.G_node);
|
|
a.G_node = null
|
|
}
|
|
if (a.ClosedElem.length > 0) {
|
|
a.G_node = a.ClosedElem.shift()
|
|
}
|
|
if (a.G_node) {
|
|
if (a.G_node.unParsed) {
|
|
a.reParse(a.G_node)
|
|
} else {
|
|
window.setTimeout(function() {
|
|
a._loadDynXML(a.G_node.id)
|
|
}, 100)
|
|
}
|
|
} else {
|
|
a.onXLE = a.onLoadReserve;
|
|
if (a.onXLE) {
|
|
a.onXLE(a)
|
|
}
|
|
a.callEvent("onAllOpenDynamic", [a])
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.openItemsDynamic = function(c, a) {
|
|
if (this.onXLE == this._stepOpen) {
|
|
return
|
|
}
|
|
this._opnItmsDnmcFlg = convertStringToBoolean(a);
|
|
this.onLoadReserve = this.onXLE;
|
|
this.onXLE = this._stepOpen;
|
|
this.ClosedElem = c.split(",").reverse();
|
|
this._stepOpen(this)
|
|
};
|
|
dhtmlXTreeObject.prototype._stepOpen = function(c) {
|
|
if (!c.ClosedElem.length) {
|
|
c.onXLE = c.onLoadReserve;
|
|
if (c._opnItmsDnmcFlg) {
|
|
c.selectItem(c.G_node, true)
|
|
}
|
|
if ((c.onXLE) && (arguments[1])) {
|
|
c.onXLE.apply(c, arguments)
|
|
}
|
|
c.callEvent("onOpenDynamicEnd", []);
|
|
return
|
|
}
|
|
c.G_node = c.ClosedElem.pop();
|
|
c.skipLock = true;
|
|
var a = c._globalIdStorageFind(c.G_node);
|
|
if (a) {
|
|
if (a.XMLload === 0) {
|
|
c.openItem(c.G_node)
|
|
} else {
|
|
c.openItem(c.G_node);
|
|
c._stepOpen(c)
|
|
}
|
|
}
|
|
c.skipLock = false
|
|
};
|
|
var globalActiveDHTMLGridObject;
|
|
String.prototype._dhx_trim = function() {
|
|
return this.replace(/ /g, " ").replace(/(^[ \t]*)|([ \t]*$)/g, "")
|
|
};
|
|
|
|
function dhtmlxArray(a) {
|
|
return dhtmlXHeir((a || new Array()), dhtmlxArray._master)
|
|
}
|
|
dhtmlxArray._master = {
|
|
_dhx_find: function(c) {
|
|
for (var a = 0; a < this.length; a++) {
|
|
if (c == this[a]) {
|
|
return a
|
|
}
|
|
}
|
|
return -1
|
|
},
|
|
_dhx_insertAt: function(g, c) {
|
|
this[this.length] = null;
|
|
for (var a = this.length - 1; a >= g; a--) {
|
|
this[a] = this[a - 1]
|
|
}
|
|
this[g] = c
|
|
},
|
|
_dhx_removeAt: function(a) {
|
|
this.splice(a, 1)
|
|
},
|
|
_dhx_swapItems: function(a, g) {
|
|
var c = this[a];
|
|
this[a] = this[g];
|
|
this[g] = c
|
|
}
|
|
};
|
|
|
|
function dhtmlXGridObject(id) {
|
|
if (_isIE) {
|
|
try {
|
|
document.execCommand("BackgroundImageCache", false, true)
|
|
} catch (e) {}
|
|
}
|
|
if (id) {
|
|
if (typeof(id) == "object") {
|
|
this.entBox = id;
|
|
if (!this.entBox.id) {
|
|
this.entBox.id = "cgrid2_" + this.uid()
|
|
}
|
|
} else {
|
|
this.entBox = document.getElementById(id)
|
|
}
|
|
} else {
|
|
this.entBox = document.createElement("DIV");
|
|
this.entBox.id = "cgrid2_" + this.uid()
|
|
}
|
|
this.entBox.innerHTML = "";
|
|
dhtmlxEventable(this);
|
|
var self = this;
|
|
this._wcorr = 0;
|
|
this.fontWidth = 7;
|
|
this.cell = null;
|
|
this.row = null;
|
|
this.iconURL = "";
|
|
this.editor = null;
|
|
this._f2kE = true;
|
|
this._dclE = true;
|
|
this.combos = new Array(0);
|
|
this.defVal = new Array(0);
|
|
this.rowsAr = {};
|
|
this.rowsBuffer = dhtmlxArray();
|
|
this.rowsCol = dhtmlxArray();
|
|
this._data_cache = {};
|
|
this._ecache = {};
|
|
this._ud_enabled = true;
|
|
this.xmlLoader = new dtmlXMLLoaderObject(this.doLoadDetails, this, true, this.no_cashe);
|
|
this._maskArr = [];
|
|
this.selectedRows = dhtmlxArray();
|
|
this.UserData = {};
|
|
this._sizeFix = this._borderFix = 0;
|
|
this.entBox.className += " gridbox";
|
|
this.entBox.style.width = this.entBox.getAttribute("width") || (window.getComputedStyle ? (this.entBox.style.width || window.getComputedStyle(this.entBox, null)["width"]) : (this.entBox.currentStyle ? this.entBox.currentStyle.width : this.entBox.style.width || 0)) || "100%";
|
|
this.entBox.style.height = this.entBox.getAttribute("height") || (window.getComputedStyle ? (this.entBox.style.height || window.getComputedStyle(this.entBox, null)["height"]) : (this.entBox.currentStyle ? this.entBox.currentStyle.height : this.entBox.style.height || 0)) || "100%";
|
|
this.entBox.style.cursor = "default";
|
|
this.entBox.onselectstart = function() {
|
|
return false
|
|
};
|
|
var t_creator = function(name) {
|
|
var t = document.createElement("TABLE");
|
|
t.cellSpacing = t.cellPadding = 0;
|
|
t.style.cssText = "width:100%;table-layout:fixed;";
|
|
t.className = name.substr(2);
|
|
return t
|
|
};
|
|
this.obj = t_creator("c_obj");
|
|
this.hdr = t_creator("c_hdr");
|
|
this.hdr.style.marginRight = "20px";
|
|
this.hdr.style.paddingRight = "20px";
|
|
this.objBox = document.createElement("DIV");
|
|
this.objBox.style.width = "100%";
|
|
this.objBox.style.overflow = "auto";
|
|
this.objBox.appendChild(this.obj);
|
|
this.objBox.className = "objbox";
|
|
if (dhtmlx.$customScroll) {
|
|
dhtmlx.CustomScroll.enable(this)
|
|
}
|
|
this.hdrBox = document.createElement("DIV");
|
|
this.hdrBox.style.width = "100%";
|
|
this.hdrBox.style.height = "25px";
|
|
this.hdrBox.style.overflow = "hidden";
|
|
this.hdrBox.className = "xhdr";
|
|
this.preloadImagesAr = new Array(0);
|
|
this.sortImg = document.createElement("DIV");
|
|
this.sortImg.style.display = "none";
|
|
this.hdrBox.appendChild(this.sortImg);
|
|
this.hdrBox.appendChild(this.hdr);
|
|
this.hdrBox.style.position = "relative";
|
|
this.entBox.appendChild(this.hdrBox);
|
|
this.entBox.appendChild(this.objBox);
|
|
this.entBox.grid = this;
|
|
this.objBox.grid = this;
|
|
this.hdrBox.grid = this;
|
|
this.obj.grid = this;
|
|
this.hdr.grid = this;
|
|
this.cellWidthPX = [];
|
|
this.cellWidthPC = [];
|
|
this.cellWidthType = this.entBox.cellwidthtype || "px";
|
|
this.delim = this.entBox.delimiter || ",";
|
|
this._csvDelim = ",";
|
|
this.hdrLabels = [];
|
|
this.columnIds = [];
|
|
this.columnColor = [];
|
|
this._hrrar = [];
|
|
this.cellType = dhtmlxArray();
|
|
this.cellAlign = [];
|
|
this.initCellWidth = [];
|
|
this.fldSort = [];
|
|
this._srdh = (_isIE && (document.compatMode != "BackCompat") ? 22 : 20);
|
|
this.imgURL = window.dhx_globalImgPath || "";
|
|
this.isActive = false;
|
|
this.isEditable = true;
|
|
this.useImagesInHeader = false;
|
|
this.pagingOn = false;
|
|
this.rowsBufferOutSize = 0;
|
|
dhtmlxEvent(window, "unload", function() {
|
|
try {
|
|
if (self.destructor) {
|
|
self.destructor()
|
|
}
|
|
} catch (e) {}
|
|
});
|
|
this.setSkin = function(name) {
|
|
this.skin_name = name;
|
|
if (this._imgURL) {
|
|
this.setImagePath(this._imgURL)
|
|
}
|
|
var classname = this.entBox.className.split(" gridbox")[0];
|
|
this.entBox.className = classname + " gridbox gridbox_" + name + (_isIE ? " isIE" : " isModern");
|
|
this.skin_h_correction = 0;
|
|
this.enableAlterCss("ev_" + name, "odd_" + name, this.isTreeGrid());
|
|
this._fixAlterCss();
|
|
switch (name) {
|
|
case "clear":
|
|
this._topMb = document.createElement("DIV");
|
|
this._topMb.className = "topMumba";
|
|
this._topMb.innerHTML = "<img style='left:0px' src='" + this.imgURL + "skinC_top_left.gif'><img style='right:20px' src='" + this.imgURL + "skinC_top_right.gif'>";
|
|
this.entBox.appendChild(this._topMb);
|
|
this._botMb = document.createElement("DIV");
|
|
this._botMb.className = "bottomMumba";
|
|
this._botMb.innerHTML = "<img style='left:0px' src='" + this.imgURL + "skinD_bottom_left.gif'><img style='right:20px' src='" + this.imgURL + "skinD_bottom_right.gif'>";
|
|
this.entBox.appendChild(this._botMb);
|
|
if (this.entBox.style.position != "absolute") {
|
|
this.entBox.style.position = "relative"
|
|
}
|
|
this.skin_h_correction = 20;
|
|
break;
|
|
case "dhx_terrace":
|
|
this._srdh = 33;
|
|
this.forceDivInHeader = true;
|
|
break;
|
|
case "dhx_skyblue":
|
|
case "dhx_web":
|
|
case "glassy_blue":
|
|
case "dhx_black":
|
|
case "dhx_blue":
|
|
case "modern":
|
|
case "light":
|
|
this._srdh = 29;
|
|
this.forceDivInHeader = true;
|
|
break;
|
|
case "xp":
|
|
this.forceDivInHeader = true;
|
|
if ((_isIE) && (document.compatMode != "BackCompat")) {
|
|
this._srdh = 26
|
|
} else {
|
|
this._srdh = 22
|
|
}
|
|
break;
|
|
case "mt":
|
|
if ((_isIE) && (document.compatMode != "BackCompat")) {
|
|
this._srdh = 26
|
|
} else {
|
|
this._srdh = 22
|
|
}
|
|
break;
|
|
case "gray":
|
|
if ((_isIE) && (document.compatMode != "BackCompat")) {
|
|
this._srdh = 22
|
|
}
|
|
break;
|
|
case "sbdark":
|
|
break
|
|
}
|
|
if (_isIE && this.hdr) {
|
|
var d = this.hdr.parentNode;
|
|
d.removeChild(this.hdr);
|
|
d.appendChild(this.hdr)
|
|
}
|
|
this.setSizes()
|
|
};
|
|
if (_isIE) {
|
|
this.preventIECaching(true)
|
|
}
|
|
if (window.dhtmlDragAndDropObject) {
|
|
this.dragger = new dhtmlDragAndDropObject()
|
|
}
|
|
this._doOnScroll = function(e, mode) {
|
|
this.callEvent("onScroll", [this.objBox.scrollLeft, this.objBox.scrollTop]);
|
|
this.doOnScroll(e, mode)
|
|
};
|
|
this.doOnScroll = function(e, mode) {
|
|
this.hdrBox.scrollLeft = this.objBox.scrollLeft;
|
|
if (this.ftr) {
|
|
this.ftr.parentNode.scrollLeft = this.objBox.scrollLeft
|
|
}
|
|
if (mode) {
|
|
return
|
|
}
|
|
if (this._srnd) {
|
|
if (this._dLoadTimer) {
|
|
window.clearTimeout(this._dLoadTimer)
|
|
}
|
|
this._dLoadTimer = window.setTimeout(function() {
|
|
if (self._update_srnd_view) {
|
|
self._update_srnd_view()
|
|
}
|
|
}, 100)
|
|
}
|
|
};
|
|
this.attachToObject = function(obj) {
|
|
obj.appendChild(this.globalBox ? this.globalBox : this.entBox);
|
|
this.setSizes()
|
|
};
|
|
this.init = function(fl) {
|
|
if ((this.isTreeGrid()) && (!this._h2)) {
|
|
this._h2 = new dhtmlxHierarchy();
|
|
if ((this._fake) && (!this._realfake)) {
|
|
this._fake._h2 = this._h2
|
|
}
|
|
this._tgc = {
|
|
imgURL: null
|
|
}
|
|
}
|
|
if (!this._hstyles) {
|
|
return
|
|
}
|
|
if (!this.skin_name) {
|
|
this.setSkin("dhx_skyblue")
|
|
}
|
|
this.editStop();
|
|
this.lastClicked = null;
|
|
this.resized = null;
|
|
this.fldSorted = this.r_fldSorted = null;
|
|
this.cellWidthPX = [];
|
|
this.cellWidthPC = [];
|
|
if (this.hdr.rows.length > 0) {
|
|
var temp = this.xmlFileUrl;
|
|
this.clearAll(true);
|
|
this.xmlFileUrl = temp
|
|
}
|
|
var hdrRow = this.hdr.insertRow(0);
|
|
for (var i = 0; i < this.hdrLabels.length; i++) {
|
|
hdrRow.appendChild(document.createElement("TH"));
|
|
hdrRow.childNodes[i]._cellIndex = i;
|
|
hdrRow.childNodes[i].style.height = "0px"
|
|
}
|
|
if (_isIE && _isIE < 8 && document.body.style.msTouchAction == this.undefined) {
|
|
hdrRow.style.position = "absolute"
|
|
} else {
|
|
hdrRow.style.height = "auto"
|
|
}
|
|
var hdrRow = this.hdr.insertRow(_isKHTML ? 2 : 1);
|
|
hdrRow._childIndexes = new Array();
|
|
var col_ex = 0;
|
|
for (var i = 0; i < this.hdrLabels.length; i++) {
|
|
hdrRow._childIndexes[i] = i - col_ex;
|
|
if ((this.hdrLabels[i] == this.splitSign) && (i != 0)) {
|
|
if (_isKHTML) {
|
|
hdrRow.insertCell(i - col_ex)
|
|
}
|
|
hdrRow.cells[i - col_ex - 1].colSpan = (hdrRow.cells[i - col_ex - 1].colSpan || 1) + 1;
|
|
hdrRow.childNodes[i - col_ex - 1]._cellIndex++;
|
|
col_ex++;
|
|
hdrRow._childIndexes[i] = i - col_ex;
|
|
continue
|
|
}
|
|
hdrRow.insertCell(i - col_ex);
|
|
hdrRow.childNodes[i - col_ex]._cellIndex = i;
|
|
hdrRow.childNodes[i - col_ex]._cellIndexS = i;
|
|
this.setColumnLabel(i, this.hdrLabels[i])
|
|
}
|
|
if (col_ex == 0) {
|
|
hdrRow._childIndexes = null
|
|
}
|
|
this._cCount = this.hdrLabels.length;
|
|
if (_isIE) {
|
|
window.setTimeout(function() {
|
|
if (self.setSizes) {
|
|
self.setSizes()
|
|
}
|
|
}, 1)
|
|
}
|
|
if (!this.obj.firstChild) {
|
|
this.obj.appendChild(document.createElement("TBODY"))
|
|
}
|
|
var tar = this.obj.firstChild;
|
|
if (!tar.firstChild) {
|
|
tar.appendChild(document.createElement("TR"));
|
|
tar = tar.firstChild;
|
|
if (_isIE && _isIE < 8 && document.body.style.msTouchAction == this.undefined) {
|
|
tar.style.position = "absolute"
|
|
} else {
|
|
tar.style.height = "auto"
|
|
}
|
|
for (var i = 0; i < this.hdrLabels.length; i++) {
|
|
tar.appendChild(document.createElement("TH"));
|
|
tar.childNodes[i].style.height = "0px"
|
|
}
|
|
}
|
|
this._c_order = null;
|
|
if (this.multiLine != true) {
|
|
this.obj.className += " row20px"
|
|
}
|
|
this.sortImg.style.position = "absolute";
|
|
this.sortImg.style.display = "none";
|
|
this.sortImg.className = "dhxgrid_sort_desc";
|
|
this.sortImg.defLeft = 0;
|
|
if (this.noHeader) {
|
|
this.hdrBox.style.display = "none"
|
|
} else {
|
|
this.noHeader = false
|
|
} if (this._ivizcol) {
|
|
this.setColHidden()
|
|
}
|
|
this.attachHeader();
|
|
this.attachHeader(0, 0, "_aFoot");
|
|
this.setSizes();
|
|
if (fl) {
|
|
this.parseXML()
|
|
}
|
|
this.obj.scrollTop = 0;
|
|
if (this.dragAndDropOff) {
|
|
this.dragger.addDragLanding(this.entBox, this)
|
|
}
|
|
if (this._initDrF) {
|
|
this._initD()
|
|
}
|
|
if (this._init_point) {
|
|
this._init_point()
|
|
}
|
|
};
|
|
this.setColumnSizes = function(gridWidth) {
|
|
var summ = 0;
|
|
var fcols = [];
|
|
var fix = 0;
|
|
for (var i = 0; i < this._cCount; i++) {
|
|
if ((this.initCellWidth[i] == "*") && !this._hrrar[i]) {
|
|
this._awdth = false;
|
|
fcols.push(i);
|
|
continue
|
|
}
|
|
if (this.cellWidthType == "%") {
|
|
if (typeof this.cellWidthPC[i] == "undefined") {
|
|
this.cellWidthPC[i] = this.initCellWidth[i]
|
|
}
|
|
var cwidth = (gridWidth * this.cellWidthPC[i] / 100) || 0;
|
|
if (fix > 0.5) {
|
|
cwidth++;
|
|
fix--
|
|
}
|
|
var rwidth = this.cellWidthPX[i] = Math.floor(cwidth);
|
|
var fix = fix + cwidth - rwidth
|
|
} else {
|
|
if (typeof this.cellWidthPX[i] == "undefined") {
|
|
this.cellWidthPX[i] = this.initCellWidth[i]
|
|
}
|
|
} if (!this._hrrar[i]) {
|
|
summ += this.cellWidthPX[i] * 1
|
|
}
|
|
}
|
|
if (fcols.length) {
|
|
var ms = Math.floor((gridWidth - summ) / fcols.length);
|
|
if (ms < 0) {
|
|
ms = 1
|
|
}
|
|
for (var i = 0; i < fcols.length; i++) {
|
|
var next = Math.max((this._drsclmW ? (this._drsclmW[fcols[i]] || 0) : 0), ms);
|
|
this.cellWidthPX[fcols[i]] = next;
|
|
summ += next
|
|
}
|
|
if (gridWidth > summ) {
|
|
var last = fcols[fcols.length - 1];
|
|
this.cellWidthPX[last] = this.cellWidthPX[last] + (gridWidth - summ);
|
|
summ = gridWidth
|
|
}
|
|
this._setAutoResize()
|
|
}
|
|
this.obj.style.width = summ + "px";
|
|
this.hdr.style.width = summ + "px";
|
|
if (this.ftr) {
|
|
this.ftr.style.width = summ + "px"
|
|
}
|
|
this.chngCellWidth();
|
|
return summ
|
|
};
|
|
this.setSizes = function() {
|
|
if ((!this.hdr.rows[0])) {
|
|
return
|
|
}
|
|
var quirks = this.quirks = (_isIE && document.compatMode == "BackCompat");
|
|
var outerBorder = (this.entBox.offsetWidth - this.entBox.clientWidth) / 2;
|
|
if (!this.dontSetSizes) {
|
|
if (this.globalBox) {
|
|
var splitOuterBorder = (this.globalBox.offsetWidth - this.globalBox.clientWidth) / 2;
|
|
if (this._delta_x && !this._realfake) {
|
|
var ow = this.globalBox.clientWidth;
|
|
this.globalBox.style.width = this._delta_x;
|
|
this.entBox.style.width = Math.max(0, (this.globalBox.clientWidth + (quirks ? splitOuterBorder * 2 : 0)) - this._fake.entBox.clientWidth) + "px";
|
|
if (ow != this.globalBox.clientWidth) {
|
|
this._fake._correctSplit(this._fake.entBox.clientWidth)
|
|
}
|
|
}
|
|
if (this._delta_y && !this._realfake) {
|
|
this.globalBox.style.height = this._delta_y;
|
|
this.entBox.style.overflow = this._fake.entBox.style.overflow = "hidden";
|
|
this.entBox.style.height = this._fake.entBox.style.height = this.globalBox.clientHeight + (quirks ? splitOuterBorder * 2 : 0) + "px"
|
|
}
|
|
} else {
|
|
if (this._delta_x) {
|
|
if (this.entBox.parentNode && this.entBox.parentNode.tagName == "TD") {
|
|
this.entBox.style.width = "1px";
|
|
this.entBox.style.width = parseInt(this._delta_x) * this.entBox.parentNode.clientWidth / 100 - outerBorder * 2 + "px"
|
|
} else {
|
|
this.entBox.style.width = this._delta_x
|
|
}
|
|
}
|
|
if (this._delta_y) {
|
|
this.entBox.style.height = this._delta_y
|
|
}
|
|
}
|
|
}
|
|
window.clearTimeout(this._sizeTime);
|
|
if (!this.entBox.offsetWidth && (!this.globalBox || !this.globalBox.offsetWidth)) {
|
|
this._sizeTime = window.setTimeout(function() {
|
|
if (self.setSizes) {
|
|
self.setSizes()
|
|
}
|
|
}, 250);
|
|
return
|
|
}
|
|
var border_x = ((!this._wthB) && ((this.entBox.cmp || this._delta_x) && (this.skin_name || "").indexOf("dhx") == 0 && !quirks) ? 2 : 0);
|
|
var border_y = ((!this._wthB) && ((this.entBox.cmp || this._delta_y) && (this.skin_name || "").indexOf("dhx") == 0 && !quirks) ? 2 : 0);
|
|
if (this._sizeFix) {
|
|
border_x -= this._sizeFix;
|
|
border_y -= this._sizeFix
|
|
}
|
|
var isVScroll = this.parentGrid ? false : (this.objBox.scrollHeight > this.objBox.offsetHeight);
|
|
var scrfix = dhtmlx.$customScroll ? 0 : 18;
|
|
var gridWidth = this.entBox.clientWidth - (this.skin_h_correction || 0) * (quirks ? 0 : 1) - border_x;
|
|
var gridWidthActive = this.entBox.clientWidth - (this.skin_h_correction || 0) - border_x;
|
|
var gridHeight = this.entBox.clientHeight - border_y;
|
|
var summ = this.setColumnSizes(gridWidthActive - (isVScroll ? scrfix : 0) - (this._correction_x || 0));
|
|
var isHScroll = this.parentGrid ? false : ((this.objBox.scrollWidth > this.objBox.offsetWidth) || (this.objBox.style.overflowX == "scroll"));
|
|
var headerHeight = this.hdr.clientHeight;
|
|
var footerHeight = this.ftr ? this.ftr.clientHeight : 0;
|
|
var newWidth = gridWidth;
|
|
var newHeight = gridHeight - headerHeight - footerHeight;
|
|
if (this._awdth && this._awdth[0] && this._awdth[1] == 99999) {
|
|
isHScroll = 0
|
|
}
|
|
if (this._ahgr) {
|
|
if (this._ahgrMA) {
|
|
newHeight = this.entBox.parentNode.clientHeight - headerHeight - footerHeight
|
|
} else {
|
|
newHeight = this.obj.offsetHeight + (isHScroll ? scrfix : 0) + (this._correction_y || 0)
|
|
} if (this._ahgrM) {
|
|
if (this._ahgrF) {
|
|
newHeight = Math.min(this._ahgrM, newHeight + headerHeight + footerHeight) - headerHeight - footerHeight
|
|
} else {
|
|
newHeight = Math.min(this._ahgrM, newHeight)
|
|
}
|
|
}
|
|
if (isVScroll && newHeight >= this.obj.scrollHeight + (isHScroll ? scrfix : 0)) {
|
|
isVScroll = false;
|
|
this.setColumnSizes(gridWidthActive - (this._correction_x || 0))
|
|
}
|
|
}
|
|
if ((this._awdth) && (this._awdth[0])) {
|
|
if (this.cellWidthType == "%") {
|
|
this.cellWidthType = "px"
|
|
}
|
|
if (this._fake) {
|
|
summ += this._fake.entBox.clientWidth
|
|
}
|
|
var newWidth = Math.min(Math.max(summ + (isVScroll ? scrfix : 0), this._awdth[2]), this._awdth[1]) + (this._correction_x || 0);
|
|
this.objBox.style.overflowX = (!isVScroll && this.objBox.scrollWidth <= newWidth) ? "hidden" : "auto";
|
|
if (this._fake) {
|
|
newWidth -= this._fake.entBox.clientWidth
|
|
}
|
|
}
|
|
newHeight = Math.max(0, newHeight);
|
|
this._ff_size_delta = (this._ff_size_delta == 0.1) ? 0.2 : 0.1;
|
|
if (!_isFF) {
|
|
this._ff_size_delta = 0
|
|
}
|
|
if (!this.dontSetSizes) {
|
|
this.entBox.style.width = Math.max(0, newWidth + (quirks ? 2 : 0) * outerBorder + this._ff_size_delta) + "px";
|
|
this.entBox.style.height = newHeight + (quirks ? 2 : 0) * outerBorder + headerHeight + footerHeight + "px"
|
|
}
|
|
this.objBox.style.height = newHeight + ((quirks && !isVScroll) ? 2 : 0) * outerBorder + "px";
|
|
this.hdrBox.style.height = headerHeight + "px";
|
|
if (newHeight != gridHeight) {
|
|
this.doOnScroll(0, !this._srnd)
|
|
}
|
|
var ext = this["setSizes_" + this.skin_name];
|
|
if (ext) {
|
|
ext.call(this)
|
|
}
|
|
this.setSortImgPos();
|
|
if (headerHeight != this.hdr.clientHeight && this._ahgr) {
|
|
this.setSizes()
|
|
}
|
|
this.callEvent("onSetSizes", [])
|
|
};
|
|
this.setSizes_clear = function() {
|
|
var y = this.hdr.offsetHeight;
|
|
var x = this.entBox.offsetWidth;
|
|
var y2 = y + this.objBox.offsetHeight;
|
|
this._topMb.style.top = (y || 0) + "px";
|
|
this._topMb.style.width = (x + 20) + "px";
|
|
this._botMb.style.top = (y2 - 3) + "px";
|
|
this._botMb.style.width = (x + 20) + "px"
|
|
};
|
|
this.chngCellWidth = function() {
|
|
if ((_isOpera) && (this.ftr)) {
|
|
this.ftr.width = this.objBox.scrollWidth + "px"
|
|
}
|
|
var l = this._cCount;
|
|
for (var i = 0; i < l; i++) {
|
|
this.hdr.rows[0].cells[i].style.width = this.cellWidthPX[i] + "px";
|
|
this.obj.rows[0].childNodes[i].style.width = this.cellWidthPX[i] + "px";
|
|
if (this.ftr) {
|
|
this.ftr.rows[0].cells[i].style.width = this.cellWidthPX[i] + "px"
|
|
}
|
|
}
|
|
};
|
|
this.setDelimiter = function(delim) {
|
|
this.delim = delim
|
|
};
|
|
this.setInitWidthsP = function(wp) {
|
|
this.cellWidthType = "%";
|
|
this.initCellWidth = wp.split(this.delim.replace(/px/gi, ""));
|
|
if (!arguments[1]) {
|
|
this._setAutoResize()
|
|
}
|
|
};
|
|
this._setAutoResize = function() {
|
|
if (this._realfake) {
|
|
return
|
|
}
|
|
var el = window;
|
|
var self = this;
|
|
dhtmlxEvent(window, "resize", function() {
|
|
window.clearTimeout(self._resize_timer);
|
|
if (self._setAutoResize) {
|
|
self._resize_timer = window.setTimeout(function() {
|
|
if (self.setSizes) {
|
|
self.setSizes()
|
|
}
|
|
if (self._fake) {
|
|
self._fake._correctSplit()
|
|
}
|
|
}, 100)
|
|
}
|
|
})
|
|
};
|
|
this.setInitWidths = function(wp) {
|
|
this.cellWidthType = "px";
|
|
this.initCellWidth = wp.split(this.delim);
|
|
if (_isFF) {
|
|
for (var i = 0; i < this.initCellWidth.length; i++) {
|
|
if (this.initCellWidth[i] != "*") {
|
|
this.initCellWidth[i] = parseInt(this.initCellWidth[i])
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.enableMultiline = function(state) {
|
|
this.multiLine = convertStringToBoolean(state)
|
|
};
|
|
this.enableMultiselect = function(state) {
|
|
this.selMultiRows = convertStringToBoolean(state)
|
|
};
|
|
this.setImagePath = function(path) {
|
|
this._imgURL = path;
|
|
this.imgURL = path + "dhxgrid_" + (this.skin_name || "dhx_skyblue").replace("dhx_", "") + "/";
|
|
this.iconTree = this.imgURL + "tree/"
|
|
};
|
|
this.setImagesPath = this.setImagePath;
|
|
this.setIconPath = function(path) {
|
|
this.iconURL = path
|
|
};
|
|
this.setIconsPath = this.setIconPath;
|
|
this.changeCursorState = function(ev) {
|
|
var el = ev.target || ev.srcElement;
|
|
if (el.tagName != "TD") {
|
|
el = this.getFirstParentOfType(el, "TD")
|
|
}
|
|
if (!el) {
|
|
return
|
|
}
|
|
if ((el.tagName == "TD") && (this._drsclmn) && (!this._drsclmn[el._cellIndex])) {
|
|
return el.style.cursor = "default"
|
|
}
|
|
var check = (ev.layerX || 0) + (((!_isIE) && (ev.target.tagName == "DIV")) ? el.offsetLeft : 0);
|
|
if ((el.offsetWidth - (ev.offsetX || (parseInt(this.getPosition(el, this.hdrBox)) - check) * -1)) < (_isOpera ? 20 : 10)) {
|
|
el.style.cursor = "E-resize"
|
|
} else {
|
|
el.style.cursor = "default"
|
|
} if (_isOpera) {
|
|
this.hdrBox.scrollLeft = this.objBox.scrollLeft
|
|
}
|
|
};
|
|
this.startColResize = function(ev) {
|
|
if (this.resized) {
|
|
this.stopColResize()
|
|
}
|
|
this.resized = null;
|
|
var el = ev.target || ev.srcElement;
|
|
if (el.tagName != "TD") {
|
|
el = this.getFirstParentOfType(el, "TD")
|
|
}
|
|
var x = ev.clientX;
|
|
var tabW = this.hdr.offsetWidth;
|
|
var startW = parseInt(el.offsetWidth);
|
|
if (el.tagName == "TD" && el.style.cursor != "default") {
|
|
if ((this._drsclmn) && (!this._drsclmn[el._cellIndex])) {
|
|
return
|
|
}
|
|
self._old_d_mm = document.body.onmousemove;
|
|
self._old_d_mu = document.body.onmouseup;
|
|
document.body.onmousemove = function(e) {
|
|
if (self) {
|
|
self.doColResize(e || window.event, el, startW, x, tabW)
|
|
}
|
|
};
|
|
document.body.onmouseup = function() {
|
|
if (self) {
|
|
self.stopColResize()
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.stopColResize = function() {
|
|
document.body.onmousemove = self._old_d_mm || "";
|
|
document.body.onmouseup = self._old_d_mu || "";
|
|
this.setSizes();
|
|
this.doOnScroll(0, 1);
|
|
this.callEvent("onResizeEnd", [this])
|
|
};
|
|
this.doColResize = function(ev, el, startW, x, tabW) {
|
|
el.style.cursor = "E-resize";
|
|
this.resized = el;
|
|
var fcolW = startW + (ev.clientX - x);
|
|
var wtabW = tabW + (ev.clientX - x);
|
|
if (!(this.callEvent("onResize", [el._cellIndex, fcolW, this]))) {
|
|
return
|
|
}
|
|
if (_isIE) {
|
|
this.objBox.scrollLeft = this.hdrBox.scrollLeft
|
|
}
|
|
if (el.colSpan > 1) {
|
|
var a_sizes = new Array();
|
|
for (var i = 0; i < el.colSpan; i++) {
|
|
a_sizes[i] = Math.round(fcolW * this.hdr.rows[0].childNodes[el._cellIndexS + i].offsetWidth / el.offsetWidth)
|
|
}
|
|
for (var i = 0; i < el.colSpan; i++) {
|
|
this._setColumnSizeR(el._cellIndexS + i * 1, a_sizes[i])
|
|
}
|
|
} else {
|
|
this._setColumnSizeR(el._cellIndex, fcolW)
|
|
}
|
|
this.doOnScroll(0, 1);
|
|
this.setSizes();
|
|
if (this._fake && this._awdth) {
|
|
this._fake._correctSplit()
|
|
}
|
|
};
|
|
this._setColumnSizeR = function(ind, fcolW) {
|
|
if (fcolW > ((this._drsclmW && !this._notresize) ? (this._drsclmW[ind] || 10) : 10)) {
|
|
this.obj.rows[0].childNodes[ind].style.width = fcolW + "px";
|
|
this.hdr.rows[0].childNodes[ind].style.width = fcolW + "px";
|
|
if (this.ftr) {
|
|
this.ftr.rows[0].childNodes[ind].style.width = fcolW + "px"
|
|
}
|
|
if (this.cellWidthType == "px") {
|
|
this.cellWidthPX[ind] = fcolW
|
|
} else {
|
|
var gridWidth = parseInt(this.entBox.offsetWidth);
|
|
if (this.objBox.scrollHeight > this.objBox.offsetHeight) {
|
|
gridWidth -= 17
|
|
}
|
|
var pcWidth = Math.round(fcolW / gridWidth * 100);
|
|
this.cellWidthPC[ind] = pcWidth
|
|
} if (this.sortImg.style.display != "none") {
|
|
this.setSortImgPos()
|
|
}
|
|
}
|
|
};
|
|
this.setSortImgState = function(state, ind, order, row) {
|
|
order = (order || "asc").toLowerCase();
|
|
if (!convertStringToBoolean(state)) {
|
|
this.sortImg.style.display = "none";
|
|
this.fldSorted = this.r_fldSorted = null;
|
|
return
|
|
}
|
|
if (order == "asc") {
|
|
this.sortImg.className = "dhxgrid_sort_asc"
|
|
} else {
|
|
this.sortImg.className = "dhxgrid_sort_desc"
|
|
}
|
|
this.sortImg.style.display = "";
|
|
this.fldSorted = this.hdr.rows[0].childNodes[ind];
|
|
var r = this.hdr.rows[row || 1];
|
|
if (!r) {
|
|
return
|
|
}
|
|
for (var i = 0; i < r.childNodes.length; i++) {
|
|
if (r.childNodes[i]._cellIndexS == ind) {
|
|
this.r_fldSorted = r.childNodes[i];
|
|
return this.setSortImgPos()
|
|
}
|
|
}
|
|
return this.setSortImgState(state, ind, order, (row || 1) + 1)
|
|
};
|
|
this.setSortImgPos = function(ind, mode, hRowInd, el) {
|
|
if (this._hrrar && this._hrrar[this.r_fldSorted ? this.r_fldSorted._cellIndex : ind]) {
|
|
return
|
|
}
|
|
if (!el) {
|
|
if (!ind) {
|
|
var el = this.r_fldSorted
|
|
} else {
|
|
var el = this.hdr.rows[hRowInd || 0].cells[ind]
|
|
}
|
|
}
|
|
if (el != null) {
|
|
var pos = this.getPosition(el, this.hdrBox);
|
|
var wdth = el.offsetWidth;
|
|
this.sortImg.style.left = Number(pos[0] + wdth - 13) + "px";
|
|
this.sortImg.defLeft = parseInt(this.sortImg.style.left);
|
|
this.sortImg.style.top = Number(pos[1] + 5) + "px";
|
|
if ((!this.useImagesInHeader) && (!mode)) {
|
|
this.sortImg.style.display = "inline"
|
|
}
|
|
this.sortImg.style.left = this.sortImg.defLeft + "px"
|
|
}
|
|
};
|
|
this.setActive = function(fl) {
|
|
if (arguments.length == 0) {
|
|
var fl = true
|
|
}
|
|
if (fl == true) {
|
|
if (globalActiveDHTMLGridObject && (globalActiveDHTMLGridObject != this)) {
|
|
globalActiveDHTMLGridObject.editStop();
|
|
globalActiveDHTMLGridObject.callEvent("onBlur", [globalActiveDHTMLGridObject])
|
|
}
|
|
globalActiveDHTMLGridObject = this;
|
|
this.isActive = true
|
|
} else {
|
|
this.isActive = false;
|
|
this.callEvent("onBlur", [this])
|
|
}
|
|
};
|
|
this._doClick = function(ev) {
|
|
var selMethod = 0;
|
|
var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD");
|
|
if (!el || !el.parentNode || !el.parentNode.idd) {
|
|
return
|
|
}
|
|
var fl = true;
|
|
if (this.markedCells) {
|
|
var markMethod = 0;
|
|
if (ev.shiftKey || ev.metaKey) {
|
|
markMethod = 1
|
|
}
|
|
if (ev.ctrlKey) {
|
|
markMethod = 2
|
|
}
|
|
this.doMark(el, markMethod);
|
|
return true
|
|
}
|
|
if (this.selMultiRows != false) {
|
|
if (ev.shiftKey && this.row != null && this.selectedRows.length) {
|
|
selMethod = 1
|
|
}
|
|
if (ev.ctrlKey || ev.metaKey) {
|
|
selMethod = 2
|
|
}
|
|
}
|
|
this.doClick(el, fl, selMethod, false)
|
|
};
|
|
this._doContClick = function(ev) {
|
|
var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD");
|
|
if ((!el) || (typeof(el.parentNode.idd) == "undefined")) {
|
|
this.callEvent("onEmptyClick", [ev]);
|
|
return true
|
|
}
|
|
if (ev.button == 2 || (_isMacOS && ev.ctrlKey)) {
|
|
if (!this.callEvent("onRightClick", [el.parentNode.idd, el._cellIndex, ev])) {
|
|
var z = function(e) {
|
|
(e || event).cancelBubble = true;
|
|
return false
|
|
};
|
|
(ev.srcElement || ev.target).oncontextmenu = z;
|
|
return z(ev)
|
|
}
|
|
if (this._ctmndx) {
|
|
if (!(this.callEvent("onBeforeContextMenu", [el.parentNode.idd, el._cellIndex, this]))) {
|
|
return true
|
|
}
|
|
if (_isIE) {
|
|
ev.srcElement.oncontextmenu = function() {
|
|
event.cancelBubble = true;
|
|
return false
|
|
}
|
|
}
|
|
if (this._ctmndx.showContextMenu) {
|
|
var dEl0 = window.document.documentElement;
|
|
var dEl1 = window.document.body;
|
|
var corrector = new Array((dEl0.scrollLeft || dEl1.scrollLeft), (dEl0.scrollTop || dEl1.scrollTop));
|
|
if (_isIE) {
|
|
var x = ev.clientX + corrector[0];
|
|
var y = ev.clientY + corrector[1]
|
|
} else {
|
|
var x = ev.pageX;
|
|
var y = ev.pageY
|
|
}
|
|
this._ctmndx.showContextMenu(x - 1, y - 1);
|
|
this.contextID = this._ctmndx.contextMenuZoneId = el.parentNode.idd + "_" + el._cellIndex;
|
|
this._ctmndx._skip_hide = true
|
|
} else {
|
|
el.contextMenuId = el.parentNode.idd + "_" + el._cellIndex;
|
|
el.contextMenu = this._ctmndx;
|
|
el.a = this._ctmndx._contextStart;
|
|
el.a(el, ev);
|
|
el.a = null
|
|
}
|
|
ev.cancelBubble = true;
|
|
return false
|
|
}
|
|
} else {
|
|
if (this._ctmndx) {
|
|
if (this._ctmndx.hideContextMenu) {
|
|
this._ctmndx.hideContextMenu()
|
|
} else {
|
|
this._ctmndx._contextEnd()
|
|
}
|
|
}
|
|
}
|
|
return true
|
|
};
|
|
this.doClick = function(el, fl, selMethod, show) {
|
|
if (!this.selMultiRows) {
|
|
selMethod = 0
|
|
}
|
|
var psid = this.row ? this.row.idd : 0;
|
|
this.setActive(true);
|
|
if (!selMethod) {
|
|
selMethod = 0
|
|
}
|
|
if (this.cell != null) {
|
|
this.cell.className = this.cell.className.replace(/cellselected/g, "")
|
|
}
|
|
if (el.tagName == "TD") {
|
|
if (this.checkEvent("onSelectStateChanged")) {
|
|
var initial = this.getSelectedId()
|
|
}
|
|
var prow = this.row;
|
|
if (selMethod == 1) {
|
|
var elRowIndex = this.rowsCol._dhx_find(el.parentNode);
|
|
var lcRowIndex = this.rowsCol._dhx_find(this.lastClicked);
|
|
if (elRowIndex > lcRowIndex) {
|
|
var strt = lcRowIndex;
|
|
var end = elRowIndex
|
|
} else {
|
|
var strt = elRowIndex;
|
|
var end = lcRowIndex
|
|
}
|
|
for (var i = 0; i < this.rowsCol.length; i++) {
|
|
if ((i >= strt && i <= end)) {
|
|
if (this.rowsCol[i] && (!this.rowsCol[i]._sRow)) {
|
|
if (this.rowsCol[i].className.indexOf("rowselected") == -1 && (this._realfake || this.callEvent("onBeforeSelect", [this.rowsCol[i].idd, psid, el._cellIndex]))) {
|
|
this.rowsCol[i].className += " rowselected";
|
|
this.selectedRows[this.selectedRows.length] = this.rowsCol[i]
|
|
}
|
|
} else {
|
|
this.clearSelection();
|
|
return this.doClick(el, fl, 0, show)
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (selMethod == 2) {
|
|
if (el.parentNode.className.indexOf("rowselected") != -1) {
|
|
el.parentNode.className = el.parentNode.className.replace(/rowselected/g, "");
|
|
this.selectedRows._dhx_removeAt(this.selectedRows._dhx_find(el.parentNode));
|
|
var skipRowSelection = true;
|
|
show = false
|
|
}
|
|
}
|
|
}
|
|
this.editStop();
|
|
if (typeof(el.parentNode.idd) == "undefined") {
|
|
return true
|
|
}
|
|
if ((!skipRowSelection) && (!el.parentNode._sRow)) {
|
|
if (this._realfake || this.callEvent("onBeforeSelect", [el.parentNode.idd, psid, el._cellIndex])) {
|
|
if (this.getSelectedRowId() != el.parentNode.idd) {
|
|
if (selMethod == 0) {
|
|
this.clearSelection()
|
|
}
|
|
this.cell = el;
|
|
if ((prow == el.parentNode) && (this._chRRS)) {
|
|
fl = false
|
|
}
|
|
this.row = el.parentNode;
|
|
this.row.className += " rowselected";
|
|
if (this.selectedRows._dhx_find(this.row) == -1) {
|
|
this.selectedRows[this.selectedRows.length] = this.row
|
|
}
|
|
} else {
|
|
this.cell = el;
|
|
this.row = el.parentNode
|
|
}
|
|
} else {
|
|
fl = false
|
|
}
|
|
}
|
|
if (this.cell && this.cell.parentNode.className.indexOf("rowselected") != -1) {
|
|
this.cell.className = this.cell.className.replace(/cellselected/g, "") + " cellselected"
|
|
}
|
|
if (selMethod != 1) {
|
|
if (!this.row) {
|
|
return
|
|
}
|
|
}
|
|
this.lastClicked = el.parentNode;
|
|
var rid = this.row.idd;
|
|
var cid = this.cell;
|
|
if (fl && typeof(rid) != "undefined" && cid && !skipRowSelection) {
|
|
self.onRowSelectTime = setTimeout(function() {
|
|
if (self.callEvent) {
|
|
self.callEvent("onRowSelect", [rid, cid._cellIndex])
|
|
}
|
|
}, 100)
|
|
} else {
|
|
this.callEvent("onRowSelectRSOnly", [rid])
|
|
} if (this.checkEvent("onSelectStateChanged")) {
|
|
var afinal = this.getSelectedId();
|
|
if (initial != afinal) {
|
|
this.callEvent("onSelectStateChanged", [afinal, initial])
|
|
}
|
|
}
|
|
}
|
|
this.isActive = true;
|
|
if (show !== false && this.cell && this.cell.parentNode.idd) {
|
|
this.moveToVisible(this.cell)
|
|
}
|
|
};
|
|
this.selectAll = function() {
|
|
this.clearSelection();
|
|
var coll = this.rowsBuffer;
|
|
if (this.pagingOn) {
|
|
coll = this.rowsCol
|
|
}
|
|
for (var i = 0; i < coll.length; i++) {
|
|
this.render_row(i).className += " rowselected"
|
|
}
|
|
this.selectedRows = dhtmlxArray([].concat(coll));
|
|
if (this.selectedRows.length) {
|
|
this.row = this.selectedRows[0];
|
|
this.cell = this.row.cells[0]
|
|
}
|
|
if ((this._fake) && (!this._realfake)) {
|
|
this._fake.selectAll()
|
|
}
|
|
};
|
|
this.selectCell = function(r, cInd, fl, preserve, edit, show) {
|
|
if (!fl) {
|
|
fl = false
|
|
}
|
|
if (typeof(r) != "object") {
|
|
r = this.render_row(r)
|
|
}
|
|
if (!r || r == -1) {
|
|
return null
|
|
}
|
|
if (r._childIndexes) {
|
|
var c = r.childNodes[r._childIndexes[cInd]]
|
|
} else {
|
|
var c = r.childNodes[cInd]
|
|
} if (!c) {
|
|
c = r.childNodes[0]
|
|
}
|
|
if (!this.markedCells) {
|
|
if (preserve) {
|
|
this.doClick(c, fl, 3, show)
|
|
} else {
|
|
this.doClick(c, fl, 0, show)
|
|
}
|
|
} else {
|
|
this.doMark(c, preserve ? 2 : 0)
|
|
} if (edit) {
|
|
this.editCell()
|
|
}
|
|
};
|
|
this.moveToVisible = function(cell_obj, onlyVScroll) {
|
|
if (this.pagingOn) {
|
|
var newPage = Math.floor(this.getRowIndex(cell_obj.parentNode.idd) / this.rowsBufferOutSize) + 1;
|
|
if (newPage != this.currentPage) {
|
|
this.changePage(newPage)
|
|
}
|
|
}
|
|
try {
|
|
if (cell_obj.offsetHeight) {
|
|
var distance = cell_obj.offsetLeft + cell_obj.offsetWidth + 20;
|
|
var scrollLeft = 0;
|
|
if (distance > (this.objBox.offsetWidth + this.objBox.scrollLeft)) {
|
|
if (cell_obj.offsetLeft > this.objBox.scrollLeft) {
|
|
scrollLeft = cell_obj.offsetLeft - (this.objBox.offsetWidth - cell_obj.offsetWidth) + 5
|
|
}
|
|
} else {
|
|
if (cell_obj.offsetLeft < this.objBox.scrollLeft) {
|
|
distance -= cell_obj.offsetWidth * 2 / 3;
|
|
if (distance < this.objBox.scrollLeft) {
|
|
scrollLeft = cell_obj.offsetLeft - 5
|
|
}
|
|
}
|
|
} if ((scrollLeft) && (!onlyVScroll)) {
|
|
this.objBox.scrollLeft = scrollLeft
|
|
}
|
|
}
|
|
if (!cell_obj.offsetHeight) {
|
|
var mask = this._realfake ? this._fake.rowsAr[cell_obj.parentNode.idd] : cell_obj.parentNode;
|
|
distance = this.rowsBuffer._dhx_find(mask) * this._srdh
|
|
} else {
|
|
distance = cell_obj.offsetTop
|
|
}
|
|
var distancemax = distance + cell_obj.offsetHeight + 38;
|
|
if (distancemax > (this.objBox.offsetHeight + this.objBox.scrollTop)) {
|
|
var scrollTop = distance
|
|
} else {
|
|
if (distance < this.objBox.scrollTop) {
|
|
var scrollTop = distance - 5
|
|
}
|
|
} if (scrollTop) {
|
|
this.objBox.scrollTop = scrollTop
|
|
}
|
|
} catch (er) {}
|
|
};
|
|
this.editCell = function() {
|
|
if (this.editor && this.cell == this.editor.cell) {
|
|
return
|
|
}
|
|
this.editStop();
|
|
if ((this.isEditable != true) || (!this.cell)) {
|
|
return false
|
|
}
|
|
var c = this.cell;
|
|
if (c.parentNode._locked) {
|
|
return false
|
|
}
|
|
this.editor = this.cells4(c);
|
|
if (this.editor != null) {
|
|
if (this.editor.isDisabled()) {
|
|
this.editor = null;
|
|
return false
|
|
}
|
|
if (this.callEvent("onEditCell", [0, this.row.idd, this.cell._cellIndex]) != false && this.editor.edit) {
|
|
this._Opera_stop = (new Date).valueOf();
|
|
c.className += " editable";
|
|
this.editor.edit();
|
|
this.callEvent("onEditCell", [1, this.row.idd, this.cell._cellIndex])
|
|
} else {
|
|
this.editor = null
|
|
}
|
|
}
|
|
};
|
|
this.editStop = function(mode) {
|
|
if (_isOpera) {
|
|
if (this._Opera_stop) {
|
|
if ((this._Opera_stop * 1 + 50) > (new Date).valueOf()) {
|
|
return
|
|
}
|
|
this._Opera_stop = null
|
|
}
|
|
}
|
|
if (this.editor && this.editor != null) {
|
|
this.editor.cell.className = this.editor.cell.className.replace("editable", "");
|
|
if (mode) {
|
|
var t = this.editor.val;
|
|
this.editor.detach();
|
|
this.editor.setValue(t);
|
|
this.editor = null;
|
|
this.callEvent("onEditCancel", [this.row.idd, this.cell._cellIndex, t]);
|
|
return
|
|
}
|
|
if (this.editor.detach()) {
|
|
this.cell.wasChanged = true
|
|
}
|
|
var g = this.editor;
|
|
this.editor = null;
|
|
var z = this.callEvent("onEditCell", [2, this.row.idd, this.cell._cellIndex, g.getValue(), g.val]);
|
|
if ((typeof(z) == "string") || (typeof(z) == "number")) {
|
|
g[g.setImage ? "setLabel" : "setValue"](z)
|
|
} else {
|
|
if (!z) {
|
|
g[g.setImage ? "setLabel" : "setValue"](g.val)
|
|
}
|
|
} if (this._ahgr && this.multiLine) {
|
|
this.setSizes()
|
|
}
|
|
}
|
|
};
|
|
this._nextRowCell = function(row, dir, pos) {
|
|
row = this._nextRow((this._groups ? this.rowsCol : this.rowsBuffer)._dhx_find(row), dir);
|
|
if (!row) {
|
|
return null
|
|
}
|
|
return row.childNodes[row._childIndexes ? row._childIndexes[pos] : pos]
|
|
};
|
|
this._getNextCell = function(acell, dir, i) {
|
|
acell = acell || this.cell;
|
|
var arow = acell.parentNode;
|
|
if (this._tabOrder) {
|
|
i = this._tabOrder[acell._cellIndex];
|
|
if (typeof i != "undefined") {
|
|
if (i < 0) {
|
|
acell = this._nextRowCell(arow, dir, Math.abs(i) - 1)
|
|
} else {
|
|
acell = arow.childNodes[i]
|
|
}
|
|
}
|
|
} else {
|
|
var i = acell._cellIndex + dir;
|
|
if (i >= 0 && i < this._cCount) {
|
|
if (arow._childIndexes) {
|
|
i = arow._childIndexes[acell._cellIndex] + dir
|
|
}
|
|
acell = arow.childNodes[i]
|
|
} else {
|
|
acell = this._nextRowCell(arow, dir, (dir == 1 ? 0 : (this._cCount - 1)))
|
|
}
|
|
} if (!acell) {
|
|
if ((dir == 1) && this.tabEnd) {
|
|
this.tabEnd.focus();
|
|
this.tabEnd.focus();
|
|
this.setActive(false)
|
|
}
|
|
if ((dir == -1) && this.tabStart) {
|
|
this.tabStart.focus();
|
|
this.tabStart.focus();
|
|
this.setActive(false)
|
|
}
|
|
return null
|
|
}
|
|
if (acell.style.display != "none" && (!this.smartTabOrder || !this.cells(acell.parentNode.idd, acell._cellIndex).isDisabled())) {
|
|
return acell
|
|
}
|
|
return this._getNextCell(acell, dir)
|
|
};
|
|
this._nextRow = function(ind, dir) {
|
|
var r = this.render_row(ind + dir);
|
|
if (!r || r == -1) {
|
|
return null
|
|
}
|
|
if (r && r.style.display == "none") {
|
|
return this._nextRow(ind + dir, dir)
|
|
}
|
|
return r
|
|
};
|
|
this.scrollPage = function(dir) {
|
|
if (!this.rowsBuffer.length) {
|
|
return
|
|
}
|
|
var master = this._realfake ? this._fake : this;
|
|
var new_ind = Math.floor((master._r_select || this.getRowIndex(this.row.idd) || 0) + (dir) * this.objBox.offsetHeight / (this._srdh || 20));
|
|
if (new_ind < 0) {
|
|
new_ind = 0
|
|
}
|
|
if (new_ind >= this.rowsBuffer.length) {
|
|
new_ind = this.rowsBuffer.length - 1
|
|
}
|
|
if (this._srnd && !this.rowsBuffer[new_ind]) {
|
|
this.objBox.scrollTop += Math.floor((dir) * this.objBox.offsetHeight / (this._srdh || 20)) * (this._srdh || 20);
|
|
if (this._fake) {
|
|
this._fake.objBox.scrollTop = this.objBox.scrollTop
|
|
}
|
|
master._r_select = new_ind
|
|
} else {
|
|
this.selectCell(new_ind, this.cell._cellIndex, true, false, false, (this.multiLine || this._srnd));
|
|
if (!this.multiLine && !this._srnd && !this._realfake) {
|
|
this.objBox.scrollTop = this.getRowById(this.getRowId(new_ind)).offsetTop;
|
|
if (this._fake) {
|
|
this._fake.objBox.scrollTop = this.objBox.scrollTop
|
|
}
|
|
}
|
|
master._r_select = null
|
|
}
|
|
};
|
|
this.doKey = function(ev) {
|
|
if (!ev) {
|
|
return true
|
|
}
|
|
if ((ev.target || ev.srcElement).value !== window.undefined) {
|
|
var zx = (ev.target || ev.srcElement);
|
|
if ((!zx.parentNode) || (zx.parentNode.className.indexOf("editable") == -1)) {
|
|
return true
|
|
}
|
|
}
|
|
if ((globalActiveDHTMLGridObject) && (this != globalActiveDHTMLGridObject)) {
|
|
return globalActiveDHTMLGridObject.doKey(ev)
|
|
}
|
|
if (this.isActive == false) {
|
|
return true
|
|
}
|
|
if (this._htkebl) {
|
|
return true
|
|
}
|
|
if (!this.callEvent("onKeyPress", [ev.keyCode, ev.ctrlKey, ev.shiftKey, ev])) {
|
|
return false
|
|
}
|
|
var code = "k" + ev.keyCode + "_" + (ev.ctrlKey ? 1 : 0) + "_" + (ev.shiftKey ? 1 : 0);
|
|
if (this.cell) {
|
|
if (this._key_events[code]) {
|
|
if (false === this._key_events[code].call(this)) {
|
|
return true
|
|
}
|
|
if (ev.preventDefault) {
|
|
ev.preventDefault()
|
|
}
|
|
ev.cancelBubble = true;
|
|
return false
|
|
}
|
|
if (this._key_events.k_other) {
|
|
this._key_events.k_other.call(this, ev)
|
|
}
|
|
}
|
|
return true
|
|
};
|
|
this.selectRow = function(r, fl, preserve, show) {
|
|
if (typeof(r) != "object") {
|
|
r = this.render_row(r)
|
|
}
|
|
this.selectCell(r, 0, fl, preserve, false, show)
|
|
};
|
|
this.wasDblClicked = function(ev) {
|
|
var el = this.getFirstParentOfType(_isIE ? ev.srcElement : ev.target, "TD");
|
|
if (el) {
|
|
var rowId = el.parentNode.idd;
|
|
return this.callEvent("onRowDblClicked", [rowId, el._cellIndex, ev])
|
|
}
|
|
};
|
|
this._onHeaderClick = function(e, el) {
|
|
var that = this.grid;
|
|
el = el || that.getFirstParentOfType(_isIE ? event.srcElement : e.target, "TD");
|
|
if (this.grid.resized == null) {
|
|
if (!(this.grid.callEvent("onHeaderClick", [el._cellIndexS, (e || window.event)]))) {
|
|
return false
|
|
}
|
|
that.sortField(el._cellIndexS, false, el)
|
|
}
|
|
this.grid.resized = null
|
|
};
|
|
this.deleteSelectedRows = function() {
|
|
var num = this.selectedRows.length;
|
|
if (num == 0) {
|
|
return
|
|
}
|
|
var tmpAr = this.selectedRows;
|
|
this.selectedRows = dhtmlxArray();
|
|
for (var i = num - 1; i >= 0; i--) {
|
|
var node = tmpAr[i];
|
|
if (!this.deleteRow(node.idd, node)) {
|
|
this.selectedRows[this.selectedRows.length] = node
|
|
} else {
|
|
if (node == this.row) {
|
|
var ind = i
|
|
}
|
|
}
|
|
}
|
|
if (ind) {
|
|
try {
|
|
if (ind + 1 > this.rowsCol.length) {
|
|
ind--
|
|
}
|
|
this.selectCell(ind, 0, true)
|
|
} catch (er) {
|
|
this.row = null;
|
|
this.cell = null
|
|
}
|
|
}
|
|
};
|
|
this.getSelectedRowId = function() {
|
|
var selAr = new Array(0);
|
|
var uni = {};
|
|
for (var i = 0; i < this.selectedRows.length; i++) {
|
|
var id = this.selectedRows[i].idd;
|
|
if (uni[id]) {
|
|
continue
|
|
}
|
|
selAr[selAr.length] = id;
|
|
uni[id] = true
|
|
}
|
|
if (selAr.length == 0) {
|
|
return null
|
|
} else {
|
|
return selAr.join(this.delim)
|
|
}
|
|
};
|
|
this.getSelectedCellIndex = function() {
|
|
if (this.cell != null) {
|
|
return this.cell._cellIndex
|
|
} else {
|
|
return -1
|
|
}
|
|
};
|
|
this.getColWidth = function(ind) {
|
|
return parseInt(this.cellWidthPX[ind])
|
|
};
|
|
this.setColWidth = function(ind, value) {
|
|
if (value == "*") {
|
|
this.initCellWidth[ind] = "*"
|
|
} else {
|
|
if (this._hrrar[ind]) {
|
|
return
|
|
}
|
|
if (this.cellWidthType == "px") {
|
|
this.cellWidthPX[ind] = parseInt(value)
|
|
} else {
|
|
this.cellWidthPC[ind] = parseInt(value)
|
|
}
|
|
}
|
|
this.setSizes()
|
|
};
|
|
this.getRowIndex = function(row_id) {
|
|
for (var i = 0; i < this.rowsBuffer.length; i++) {
|
|
if (this.rowsBuffer[i] && this.rowsBuffer[i].idd == row_id) {
|
|
return i
|
|
}
|
|
}
|
|
return -1
|
|
};
|
|
this.getRowId = function(ind) {
|
|
return this.rowsBuffer[ind] ? this.rowsBuffer[ind].idd : this.undefined
|
|
};
|
|
this.setRowId = function(ind, row_id) {
|
|
this.changeRowId(this.getRowId(ind), row_id)
|
|
};
|
|
this.changeRowId = function(oldRowId, newRowId) {
|
|
if (oldRowId == newRowId) {
|
|
return
|
|
}
|
|
var row = this.rowsAr[oldRowId];
|
|
row.idd = newRowId;
|
|
if (this.UserData[oldRowId]) {
|
|
this.UserData[newRowId] = this.UserData[oldRowId];
|
|
this.UserData[oldRowId] = null
|
|
}
|
|
if (this._h2 && this._h2.get[oldRowId]) {
|
|
this._h2.get[newRowId] = this._h2.get[oldRowId];
|
|
this._h2.get[newRowId].id = newRowId;
|
|
delete this._h2.get[oldRowId]
|
|
}
|
|
this.rowsAr[oldRowId] = null;
|
|
this.rowsAr[newRowId] = row;
|
|
for (var i = 0; i < row.childNodes.length; i++) {
|
|
if (row.childNodes[i]._code) {
|
|
row.childNodes[i]._code = this._compileSCL(row.childNodes[i]._val, row.childNodes[i])
|
|
}
|
|
}
|
|
if (this._mat_links && this._mat_links[oldRowId]) {
|
|
var a = this._mat_links[oldRowId];
|
|
delete this._mat_links[oldRowId];
|
|
for (var c in a) {
|
|
for (var i = 0; i < a[c].length; i++) {
|
|
this._compileSCL(a[c][i].original, a[c][i])
|
|
}
|
|
}
|
|
}
|
|
this.callEvent("onRowIdChange", [oldRowId, newRowId])
|
|
};
|
|
this.setColumnIds = function(ids) {
|
|
this.columnIds = ids.split(this.delim)
|
|
};
|
|
this.setColumnId = function(ind, id) {
|
|
this.columnIds[ind] = id
|
|
};
|
|
this.getColIndexById = function(id) {
|
|
for (var i = 0; i < this.columnIds.length; i++) {
|
|
if (this.columnIds[i] == id) {
|
|
return i
|
|
}
|
|
}
|
|
};
|
|
this.getColumnId = function(cin) {
|
|
return this.columnIds[cin]
|
|
};
|
|
this.getColumnLabel = function(cin, ind, hdr) {
|
|
var z = (hdr || this.hdr).rows[(ind || 0) + 1];
|
|
for (var i = 0; i < z.cells.length; i++) {
|
|
if (z.cells[i]._cellIndexS == cin) {
|
|
return (_isIE ? z.cells[i].innerText : z.cells[i].textContent)
|
|
}
|
|
}
|
|
return ""
|
|
};
|
|
this.getColLabel = this.getColumnLabel;
|
|
this.getFooterLabel = function(cin, ind) {
|
|
return this.getColumnLabel(cin, ind, this.ftr)
|
|
};
|
|
this.setRowTextBold = function(row_id) {
|
|
var r = this.getRowById(row_id);
|
|
if (r) {
|
|
r.style.fontWeight = "bold"
|
|
}
|
|
};
|
|
this.setRowTextStyle = function(row_id, styleString) {
|
|
var r = this.getRowById(row_id);
|
|
if (!r) {
|
|
return
|
|
}
|
|
for (var i = 0; i < r.childNodes.length; i++) {
|
|
var pfix = r.childNodes[i]._attrs.style || "";
|
|
if ((this._hrrar) && (this._hrrar[i])) {
|
|
pfix = "display:none;"
|
|
}
|
|
if (_isIE) {
|
|
r.childNodes[i].style.cssText = pfix + "width:" + r.childNodes[i].style.width + ";" + styleString
|
|
} else {
|
|
r.childNodes[i].style.cssText = pfix + "width:" + r.childNodes[i].style.width + ";" + styleString
|
|
}
|
|
}
|
|
};
|
|
this.setRowColor = function(row_id, color) {
|
|
var r = this.getRowById(row_id);
|
|
for (var i = 0; i < r.childNodes.length; i++) {
|
|
r.childNodes[i].bgColor = color
|
|
}
|
|
};
|
|
this.setCellTextStyle = function(row_id, ind, styleString) {
|
|
var r = this.getRowById(row_id);
|
|
if (!r) {
|
|
return
|
|
}
|
|
var cell = r.childNodes[r._childIndexes ? r._childIndexes[ind] : ind];
|
|
if (!cell) {
|
|
return
|
|
}
|
|
var pfix = "";
|
|
if ((this._hrrar) && (this._hrrar[ind])) {
|
|
pfix = "display:none;"
|
|
}
|
|
if (_isIE) {
|
|
cell.style.cssText = pfix + "width:" + cell.style.width + ";" + styleString
|
|
} else {
|
|
cell.style.cssText = pfix + "width:" + cell.style.width + ";" + styleString
|
|
}
|
|
};
|
|
this.setRowTextNormal = function(row_id) {
|
|
var r = this.getRowById(row_id);
|
|
if (r) {
|
|
r.style.fontWeight = "normal"
|
|
}
|
|
};
|
|
this.doesRowExist = function(row_id) {
|
|
if (this.getRowById(row_id) != null) {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
};
|
|
this.getColumnsNum = function() {
|
|
return this._cCount
|
|
};
|
|
this.moveRowUp = function(row_id) {
|
|
var r = this.getRowById(row_id);
|
|
if (this.isTreeGrid()) {
|
|
return this.moveRowUDTG(row_id, -1)
|
|
}
|
|
var rInd = this.rowsCol._dhx_find(r);
|
|
if ((r.previousSibling) && (rInd != 0)) {
|
|
r.parentNode.insertBefore(r, r.previousSibling);
|
|
this.rowsCol._dhx_swapItems(rInd, rInd - 1);
|
|
this.setSizes();
|
|
var bInd = this.rowsBuffer._dhx_find(r);
|
|
this.rowsBuffer._dhx_swapItems(bInd, bInd - 1);
|
|
if (this._cssEven) {
|
|
this._fixAlterCss(rInd - 1)
|
|
}
|
|
}
|
|
};
|
|
this.moveRowDown = function(row_id) {
|
|
var r = this.getRowById(row_id);
|
|
if (this.isTreeGrid()) {
|
|
return this.moveRowUDTG(row_id, 1)
|
|
}
|
|
var rInd = this.rowsCol._dhx_find(r);
|
|
if (r.nextSibling) {
|
|
this.rowsCol._dhx_swapItems(rInd, rInd + 1);
|
|
if (r.nextSibling.nextSibling) {
|
|
r.parentNode.insertBefore(r, r.nextSibling.nextSibling)
|
|
} else {
|
|
r.parentNode.appendChild(r)
|
|
}
|
|
this.setSizes();
|
|
var bInd = this.rowsBuffer._dhx_find(r);
|
|
this.rowsBuffer._dhx_swapItems(bInd, bInd + 1);
|
|
if (this._cssEven) {
|
|
this._fixAlterCss(rInd)
|
|
}
|
|
}
|
|
};
|
|
this.getCombo = function(col_ind) {
|
|
if (!this.combos[col_ind]) {
|
|
this.combos[col_ind] = new dhtmlXGridComboObject()
|
|
}
|
|
return this.combos[col_ind]
|
|
};
|
|
this.setUserData = function(row_id, name, value) {
|
|
if (!row_id) {
|
|
row_id = "gridglobaluserdata"
|
|
}
|
|
if (!this.UserData[row_id]) {
|
|
this.UserData[row_id] = new Hashtable()
|
|
}
|
|
this.UserData[row_id].put(name, value)
|
|
};
|
|
this.getUserData = function(row_id, name) {
|
|
if (!row_id) {
|
|
row_id = "gridglobaluserdata"
|
|
}
|
|
this.getRowById(row_id);
|
|
var z = this.UserData[row_id];
|
|
return (z ? z.get(name) : "")
|
|
};
|
|
this.setEditable = function(fl) {
|
|
this.isEditable = convertStringToBoolean(fl)
|
|
};
|
|
this.selectRowById = function(row_id, multiFL, show, call) {
|
|
if (!call) {
|
|
call = false
|
|
}
|
|
this.selectCell(this.getRowById(row_id), 0, call, multiFL, false, show)
|
|
};
|
|
this.clearSelection = function() {
|
|
this.editStop();
|
|
for (var i = 0; i < this.selectedRows.length; i++) {
|
|
var r = this.rowsAr[this.selectedRows[i].idd];
|
|
if (r) {
|
|
r.className = r.className.replace(/rowselected/g, "")
|
|
}
|
|
}
|
|
this.selectedRows = dhtmlxArray();
|
|
this.row = null;
|
|
if (this.cell != null) {
|
|
this.cell.className = this.cell.className.replace(/cellselected/g, "");
|
|
this.cell = null
|
|
}
|
|
this.callEvent("onSelectionCleared", [])
|
|
};
|
|
this.copyRowContent = function(from_row_id, to_row_id) {
|
|
var frRow = this.getRowById(from_row_id);
|
|
if (!this.isTreeGrid()) {
|
|
for (var i = 0; i < frRow.cells.length; i++) {
|
|
this.cells(to_row_id, i).setValue(this.cells(from_row_id, i).getValue())
|
|
}
|
|
} else {
|
|
this._copyTreeGridRowContent(frRow, from_row_id, to_row_id)
|
|
} if (!_isIE) {
|
|
this.getRowById(from_row_id).cells[0].height = frRow.cells[0].offsetHeight
|
|
}
|
|
};
|
|
this.setFooterLabel = function(c, label, ind) {
|
|
return this.setColumnLabel(c, label, ind, this.ftr)
|
|
};
|
|
this.setColumnLabel = function(c, label, ind, hdr) {
|
|
var z = (hdr || this.hdr).rows[ind || 1];
|
|
var col = (z._childIndexes ? z._childIndexes[c] : c);
|
|
if (!z.cells[col]) {
|
|
return
|
|
}
|
|
if (!this.useImagesInHeader) {
|
|
var hdrHTML = "<div class='hdrcell'>";
|
|
if (label.indexOf("img:[") != -1) {
|
|
var imUrl = label.replace(/.*\[([^>]+)\].*/, "$1");
|
|
label = label.substr(label.indexOf("]") + 1, label.length);
|
|
hdrHTML += "<img width='18px' height='18px' align='absmiddle' src='" + imUrl + "' hspace='2'>"
|
|
}
|
|
hdrHTML += label;
|
|
hdrHTML += "</div>";
|
|
z.cells[col].innerHTML = hdrHTML;
|
|
if (this._hstyles[col]) {
|
|
z.cells[col].style.cssText = this._hstyles[col]
|
|
}
|
|
} else {
|
|
z.cells[col].style.textAlign = "left";
|
|
z.cells[col].innerHTML = "<img src='" + label + "'>";
|
|
var a = new Image();
|
|
a.src = "" + label.replace(/(\.[a-z]+)/, ".des$1");
|
|
this.preloadImagesAr[this.preloadImagesAr.length] = a;
|
|
var b = new Image();
|
|
b.src = "" + label.replace(/(\.[a-z]+)/, ".asc$1");
|
|
this.preloadImagesAr[this.preloadImagesAr.length] = b
|
|
} if ((label || "").indexOf("#") != -1) {
|
|
var t = label.match(/(^|{)#([^}]+)(}|$)/);
|
|
if (t) {
|
|
var tn = "_in_header_" + t[2];
|
|
if (this[tn]) {
|
|
this[tn]((this.forceDivInHeader ? z.cells[col].firstChild : z.cells[col]), col, label.split(t[0]))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.setColLabel = function(a, b, ind, c) {
|
|
return this.setColumnLabel(a, b, (ind || 0) + 1, c)
|
|
};
|
|
this.clearAll = function(header) {
|
|
if (!this.obj.rows[0]) {
|
|
return
|
|
}
|
|
if (this._h2) {
|
|
this._h2 = new dhtmlxHierarchy();
|
|
if (this._fake) {
|
|
if (this._realfake) {
|
|
this._h2 = this._fake._h2
|
|
} else {
|
|
this._fake._h2 = this._h2
|
|
}
|
|
}
|
|
}
|
|
this.limit = this._limitC = 0;
|
|
this.editStop(true);
|
|
if (this._dLoadTimer) {
|
|
window.clearTimeout(this._dLoadTimer)
|
|
}
|
|
if (this._dload) {
|
|
this.objBox.scrollTop = 0;
|
|
this.limit = this._limitC || 0;
|
|
this._initDrF = true
|
|
}
|
|
var len = this.rowsCol.length;
|
|
len = this.obj.rows.length;
|
|
for (var i = len - 1; i > 0; i--) {
|
|
var t_r = this.obj.rows[i];
|
|
t_r.parentNode.removeChild(t_r)
|
|
}
|
|
if (header) {
|
|
this._master_row = null;
|
|
this.obj.rows[0].parentNode.removeChild(this.obj.rows[0]);
|
|
for (var i = this.hdr.rows.length - 1; i >= 0; i--) {
|
|
var t_r = this.hdr.rows[i];
|
|
t_r.parentNode.removeChild(t_r)
|
|
}
|
|
if (this.ftr) {
|
|
this.ftr.parentNode.removeChild(this.ftr);
|
|
this.ftr = null
|
|
}
|
|
this._aHead = this.ftr = this.cellWidth = this._aFoot = null;
|
|
this.cellType = dhtmlxArray();
|
|
this._hrrar = [];
|
|
this.columnIds = [];
|
|
this.combos = [];
|
|
this._strangeParams = [];
|
|
this.defVal = [];
|
|
this._ivizcol = null
|
|
}
|
|
this.row = null;
|
|
this.cell = null;
|
|
this.rowsCol = dhtmlxArray();
|
|
this.rowsAr = {};
|
|
this._RaSeCol = [];
|
|
this.rowsBuffer = dhtmlxArray();
|
|
this.UserData = [];
|
|
this.selectedRows = dhtmlxArray();
|
|
if (this.pagingOn || this._srnd) {
|
|
this.xmlFileUrl = ""
|
|
}
|
|
if (this.pagingOn) {
|
|
this.changePage(1)
|
|
}
|
|
if (this._contextCallTimer) {
|
|
window.clearTimeout(this._contextCallTimer)
|
|
}
|
|
if (this._sst) {
|
|
this.enableStableSorting(true)
|
|
}
|
|
this._fillers = this.undefined;
|
|
this.setSortImgState(false);
|
|
this.setSizes();
|
|
this.callEvent("onClearAll", [])
|
|
};
|
|
this.sortField = function(ind, repeatFl, r_el) {
|
|
if (this.getRowsNum() == 0) {
|
|
return false
|
|
}
|
|
var el = this.hdr.rows[0].cells[ind];
|
|
if (!el) {
|
|
return
|
|
}
|
|
if (el.tagName == "TH" && (this.fldSort.length - 1) >= el._cellIndex && this.fldSort[el._cellIndex] != "na") {
|
|
var data = this.getSortingState();
|
|
var sortType = (data[0] == ind && data[1] == "asc") ? "des" : "asc";
|
|
if (!this.callEvent("onBeforeSorting", [ind, this.fldSort[ind], sortType])) {
|
|
return
|
|
}
|
|
this.sortImg.className = "dhxgrid_sort_" + (sortType == "asc" ? "asc" : "desc");
|
|
if (this.useImagesInHeader) {
|
|
var cel = this.hdr.rows[1].cells[el._cellIndex].firstChild;
|
|
if (this.fldSorted != null) {
|
|
var celT = this.hdr.rows[1].cells[this.fldSorted._cellIndex].firstChild;
|
|
celT.src = celT.src.replace(/(\.asc\.)|(\.des\.)/, ".")
|
|
}
|
|
cel.src = cel.src.replace(/(\.[a-z]+)$/, "." + sortType + "$1")
|
|
}
|
|
this.sortRows(el._cellIndex, this.fldSort[el._cellIndex], sortType);
|
|
this.fldSorted = el;
|
|
this.r_fldSorted = r_el;
|
|
var c = this.hdr.rows[1];
|
|
var c = r_el.parentNode;
|
|
var real_el = c._childIndexes ? c._childIndexes[el._cellIndex] : el._cellIndex;
|
|
this.setSortImgPos(false, false, false, r_el)
|
|
}
|
|
};
|
|
this.setCustomSorting = function(func, col) {
|
|
if (!this._customSorts) {
|
|
this._customSorts = new Array()
|
|
}
|
|
this._customSorts[col] = (typeof(func) == "string") ? eval(func) : func;
|
|
this.fldSort[col] = "cus"
|
|
};
|
|
this.enableHeaderImages = function(fl) {
|
|
this.useImagesInHeader = fl
|
|
};
|
|
this.setHeader = function(hdrStr, splitSign, styles) {
|
|
if (typeof(hdrStr) != "object") {
|
|
var arLab = this._eSplit(hdrStr)
|
|
} else {
|
|
arLab = [].concat(hdrStr)
|
|
}
|
|
var arWdth = new Array(0);
|
|
var arTyp = new dhtmlxArray(0);
|
|
var arAlg = new Array(0);
|
|
var arVAlg = new Array(0);
|
|
var arSrt = new Array(0);
|
|
for (var i = 0; i < arLab.length; i++) {
|
|
arWdth[arWdth.length] = Math.round(100 / arLab.length);
|
|
arTyp[arTyp.length] = "ed";
|
|
arAlg[arAlg.length] = "left";
|
|
arVAlg[arVAlg.length] = "middle";
|
|
arSrt[arSrt.length] = "na"
|
|
}
|
|
this.splitSign = splitSign || "#cspan";
|
|
this.hdrLabels = arLab;
|
|
this.cellWidth = arWdth;
|
|
if (!this.initCellWidth.length) {
|
|
this.setInitWidthsP(arWdth.join(this.delim), true)
|
|
}
|
|
this.cellType = arTyp;
|
|
this.cellAlign = arAlg;
|
|
this.cellVAlign = arVAlg;
|
|
this.fldSort = arSrt;
|
|
this._hstyles = styles || []
|
|
};
|
|
this._eSplit = function(str) {
|
|
if (![].push) {
|
|
return str.split(this.delim)
|
|
}
|
|
var a = "r" + (new Date()).valueOf();
|
|
var z = this.delim.replace(/([\|\+\*\^])/g, "\\$1");
|
|
return (str || "").replace(RegExp(z, "g"), a).replace(RegExp("\\\\" + a, "g"), this.delim).split(a)
|
|
};
|
|
this.getColType = function(cInd) {
|
|
return this.cellType[cInd]
|
|
};
|
|
this.getColTypeById = function(cID) {
|
|
return this.cellType[this.getColIndexById(cID)]
|
|
};
|
|
this.setColTypes = function(typeStr) {
|
|
this.cellType = dhtmlxArray(typeStr.split(this.delim));
|
|
this._strangeParams = new Array();
|
|
for (var i = 0; i < this.cellType.length; i++) {
|
|
if ((this.cellType[i].indexOf("[") != -1)) {
|
|
var z = this.cellType[i].split(/[\[\]]+/g);
|
|
this.cellType[i] = z[0];
|
|
this.defVal[i] = z[1];
|
|
if (z[1].indexOf("=") == 0) {
|
|
this.cellType[i] = "math";
|
|
this._strangeParams[i] = z[0]
|
|
}
|
|
}
|
|
if (!window["eXcell_" + this.cellType[i]]) {
|
|
dhtmlxError.throwError("Configuration", "Incorrect cell type: " + this.cellType[i], [this, this.cellType[i]])
|
|
}
|
|
}
|
|
};
|
|
this.setColSorting = function(sortStr) {
|
|
this.fldSort = sortStr.split(this.delim);
|
|
var check = {
|
|
str: 1,
|
|
"int": 1,
|
|
date: 1
|
|
};
|
|
for (var i = 0; i < this.fldSort.length; i++) {
|
|
if ((!check[this.fldSort[i]]) && (typeof(window[this.fldSort[i]]) == "function")) {
|
|
if (!this._customSorts) {
|
|
this._customSorts = new Array()
|
|
}
|
|
this._customSorts[i] = window[this.fldSort[i]];
|
|
this.fldSort[i] = "cus"
|
|
}
|
|
}
|
|
};
|
|
this.setColAlign = function(alStr) {
|
|
this.cellAlign = alStr.split(this.delim);
|
|
for (var i = 0; i < this.cellAlign.length; i++) {
|
|
this.cellAlign[i] = this.cellAlign[i]._dhx_trim()
|
|
}
|
|
};
|
|
this.setColVAlign = function(valStr) {
|
|
this.cellVAlign = valStr.split(this.delim)
|
|
};
|
|
this.setNoHeader = function(fl) {
|
|
this.noHeader = convertStringToBoolean(fl)
|
|
};
|
|
this.showRow = function(rowID) {
|
|
this.getRowById(rowID);
|
|
if (this._h2) {
|
|
this.openItem(this._h2.get[rowID].parent.id)
|
|
}
|
|
var c = this.getRowById(rowID).childNodes[0];
|
|
while (c && c.style.display == "none") {
|
|
c = c.nextSibling
|
|
}
|
|
if (c) {
|
|
this.moveToVisible(c, true)
|
|
}
|
|
};
|
|
this.setStyle = function(ss_header, ss_grid, ss_selCell, ss_selRow) {
|
|
this.ssModifier = [ss_header, ss_grid, ss_selCell, ss_selCell, ss_selRow];
|
|
var prefs = ["#" + this.entBox.id + " table.hdr td", "#" + this.entBox.id + " table.obj td", "#" + this.entBox.id + " table.obj tr.rowselected td.cellselected", "#" + this.entBox.id + " table.obj td.cellselected", "#" + this.entBox.id + " table.obj tr.rowselected td"];
|
|
var index = 0;
|
|
while (!_isIE) {
|
|
try {
|
|
var temp = document.styleSheets[index].cssRules.length
|
|
} catch (e) {
|
|
index++;
|
|
continue
|
|
}
|
|
break
|
|
}
|
|
for (var i = 0; i < prefs.length; i++) {
|
|
if (this.ssModifier[i]) {
|
|
if (_isIE) {
|
|
document.styleSheets[0].addRule(prefs[i], this.ssModifier[i])
|
|
} else {
|
|
document.styleSheets[index].insertRule(prefs[i] + (" { " + this.ssModifier[i] + " }"), document.styleSheets[index].cssRules.length)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.setColumnColor = function(clr) {
|
|
this.columnColor = clr.split(this.delim)
|
|
};
|
|
this.enableAlterCss = function(cssE, cssU, perLevel, levelUnique) {
|
|
if (cssE || cssU) {
|
|
this.attachEvent("onGridReconstructed", function() {
|
|
this._fixAlterCss();
|
|
if (this._fake) {
|
|
this._fake._fixAlterCss()
|
|
}
|
|
})
|
|
}
|
|
this._cssSP = perLevel;
|
|
this._cssSU = levelUnique;
|
|
this._cssEven = cssE;
|
|
this._cssUnEven = cssU
|
|
};
|
|
this._fixAlterCss = function(ind) {
|
|
if (this._h2 && (this._cssSP || this._cssSU)) {
|
|
return this._fixAlterCssTGR(ind)
|
|
}
|
|
if (!this._cssEven && !this._cssUnEven) {
|
|
return
|
|
}
|
|
ind = ind || 0;
|
|
var j = ind;
|
|
for (var i = ind; i < this.rowsCol.length; i++) {
|
|
if (!this.rowsCol[i]) {
|
|
continue
|
|
}
|
|
if (this.rowsCol[i].style.display != "none") {
|
|
if (this.rowsCol[i]._cntr) {
|
|
j = 1;
|
|
continue
|
|
}
|
|
if (this.rowsCol[i].className.indexOf("rowselected") != -1) {
|
|
if (j % 2 == 1) {
|
|
this.rowsCol[i].className = this._cssUnEven + " rowselected " + (this.rowsCol[i]._css || "")
|
|
} else {
|
|
this.rowsCol[i].className = this._cssEven + " rowselected " + (this.rowsCol[i]._css || "")
|
|
}
|
|
} else {
|
|
if (j % 2 == 1) {
|
|
this.rowsCol[i].className = this._cssUnEven + " " + (this.rowsCol[i]._css || "")
|
|
} else {
|
|
this.rowsCol[i].className = this._cssEven + " " + (this.rowsCol[i]._css || "")
|
|
}
|
|
}
|
|
j++
|
|
}
|
|
}
|
|
};
|
|
this.clearChangedState = function() {
|
|
for (var i = 0; i < this.rowsCol.length; i++) {
|
|
var row = this.rowsCol[i];
|
|
if (row && row.childNodes) {
|
|
var cols = row.childNodes.length;
|
|
for (var j = 0; j < cols; j++) {
|
|
row.childNodes[j].wasChanged = false
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.getChangedRows = function(and_added) {
|
|
var res = new Array();
|
|
this.forEachRow(function(id) {
|
|
var row = this.rowsAr[id];
|
|
if (row.tagName != "TR") {
|
|
return
|
|
}
|
|
var cols = row.childNodes.length;
|
|
if (and_added && row._added) {
|
|
res[res.length] = row.idd
|
|
} else {
|
|
for (var j = 0; j < cols; j++) {
|
|
if (row.childNodes[j].wasChanged) {
|
|
res[res.length] = row.idd;
|
|
break
|
|
}
|
|
}
|
|
}
|
|
});
|
|
return res.join(this.delim)
|
|
};
|
|
this._sUDa = false;
|
|
this._sAll = false;
|
|
this.setSerializationLevel = function(userData, fullXML, config, changedAttr, onlyChanged, asCDATA) {
|
|
this._sUDa = userData;
|
|
this._sAll = fullXML;
|
|
this._sConfig = config;
|
|
this._chAttr = changedAttr;
|
|
this._onlChAttr = onlyChanged;
|
|
this._asCDATA = asCDATA
|
|
};
|
|
this.setSerializableColumns = function(list) {
|
|
if (!list) {
|
|
this._srClmn = null;
|
|
return
|
|
}
|
|
this._srClmn = (list || "").split(",");
|
|
for (var i = 0; i < this._srClmn.length; i++) {
|
|
this._srClmn[i] = convertStringToBoolean(this._srClmn[i])
|
|
}
|
|
};
|
|
this._serialise = function(rCol, inner, closed) {
|
|
this.editStop();
|
|
var out = [];
|
|
var close = "</" + this.xml.s_row + ">";
|
|
if (this.isTreeGrid()) {
|
|
this._h2.forEachChildF(0, function(el) {
|
|
var temp = this._serializeRow(this.render_row_tree(-1, el.id));
|
|
out.push(temp);
|
|
if (temp) {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
}, this, function() {
|
|
out.push(close)
|
|
})
|
|
} else {
|
|
for (var i = 0; i < this.rowsBuffer.length; i++) {
|
|
if (this.rowsBuffer[i]) {
|
|
if (this._chAttr && this.rowsBuffer[i]._locator) {
|
|
continue
|
|
}
|
|
var temp = this._serializeRow(this.render_row(i));
|
|
out.push(temp);
|
|
if (temp) {
|
|
out.push(close)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return [out.join("")]
|
|
};
|
|
this._serializeRow = function(r, i) {
|
|
var out = [];
|
|
var ra = this.xml.row_attrs;
|
|
var ca = this.xml.cell_attrs;
|
|
out.push("<" + this.xml.s_row);
|
|
out.push(" id='" + r.idd + "'");
|
|
if ((this._sAll) && this.selectedRows._dhx_find(r) != -1) {
|
|
out.push(" selected='1'")
|
|
}
|
|
if (this._h2 && this._h2.get[r.idd].state == "minus") {
|
|
out.push(" open='1'")
|
|
}
|
|
if (ra.length) {
|
|
for (var i = 0; i < ra.length; i++) {
|
|
out.push(" " + ra[i] + "='" + r._attrs[ra[i]] + "'")
|
|
}
|
|
}
|
|
out.push(">");
|
|
if (this._sUDa && this.UserData[r.idd]) {
|
|
keysAr = this.UserData[r.idd].getKeys();
|
|
for (var ii = 0; ii < keysAr.length; ii++) {
|
|
out.push("<userdata name='" + keysAr[ii] + "'>" + (this._asCDATA ? "<![CDATA[" : "") + this.UserData[r.idd].get(keysAr[ii]) + (this._asCDATA ? "]]>" : "") + "</userdata>")
|
|
}
|
|
}
|
|
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("<cell");
|
|
if (ca.length) {
|
|
for (var i = 0; i < ca.length; i++) {
|
|
out.push(" " + ca[i] + "='" + zx.cell._attrs[ca[i]] + "'")
|
|
}
|
|
}
|
|
zxVal = zx[this._agetm]();
|
|
if (this._asCDATA) {
|
|
zxVal = "<![CDATA[" + zxVal + "]]>"
|
|
}
|
|
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 + "</cell>")
|
|
} else {
|
|
out.push(">" + zxVal + "</cell>")
|
|
} if ((this._ecspn) && (zx.cell.colSpan)) {
|
|
for (var u = 0; u < zx.cell.colSpan - 1; u++) {
|
|
out.push("<cell/>");
|
|
jj++
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ((this._onlChAttr) && (!changeFl) && (!r._added)) {
|
|
return ""
|
|
}
|
|
return out.join("")
|
|
};
|
|
this._serialiseConfig = function() {
|
|
var out = "<head>";
|
|
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 += "<column width='" + this.getColWidth(i) + "' align='" + this.cellAlign[i] + "' type='" + this.cellType[i] + "' sort='" + (sort || "na") + "' color='" + this.columnColor[i] + "'" + (this.columnIds[i] ? (" id='" + this.columnIds[i] + "'") : "") + ">";
|
|
if (this._asCDATA) {
|
|
out += "<![CDATA[" + this.getHeaderCol(i) + "]]>"
|
|
} else {
|
|
out += this.getHeaderCol(i)
|
|
}
|
|
var z = this.getCombo(i);
|
|
if (z) {
|
|
for (var j = 0; j < z.keys.length; j++) {
|
|
out += "<option value='" + z.keys[j] + "'>" + z.values[j] + "</option>"
|
|
}
|
|
}
|
|
out += "</column>"
|
|
}
|
|
return out += "</head>"
|
|
};
|
|
this.serialize = function() {
|
|
var out = '<?xml version="1.0"?><rows>';
|
|
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 += "<userdata name='" + keysAr[i] + "'>" + this.UserData.gridglobaluserdata.get(keysAr[i]) + "</userdata>"
|
|
}
|
|
}
|
|
if (this._sConfig) {
|
|
out += this._serialiseConfig()
|
|
}
|
|
out += this._serialise();
|
|
out += "</rows>";
|
|
return out
|
|
};
|
|
this.getPosition = function(oNode, pNode) {
|
|
if (!pNode) {
|
|
var pos = getOffset(oNode);
|
|
return [pos.left, pos.top]
|
|
}
|
|
pNode = pNode || document.body;
|
|
var oCurrentNode = oNode;
|
|
var iLeft = 0;
|
|
var iTop = 0;
|
|
while ((oCurrentNode) && (oCurrentNode != pNode)) {
|
|
iLeft += oCurrentNode.offsetLeft - oCurrentNode.scrollLeft;
|
|
iTop += oCurrentNode.offsetTop - oCurrentNode.scrollTop;
|
|
oCurrentNode = oCurrentNode.offsetParent
|
|
}
|
|
if (pNode == document.body) {
|
|
if (_isIE) {
|
|
iTop += document.body.offsetTop || document.documentElement.offsetTop;
|
|
iLeft += document.body.offsetLeft || document.documentElement.offsetLeft
|
|
} else {
|
|
if (!_isFF) {
|
|
iLeft += document.body.offsetLeft;
|
|
iTop += document.body.offsetTop
|
|
}
|
|
}
|
|
}
|
|
return [iLeft, iTop]
|
|
};
|
|
this.getFirstParentOfType = function(obj, tag) {
|
|
while (obj && obj.tagName != tag && obj.tagName != "BODY") {
|
|
obj = obj.parentNode
|
|
}
|
|
return obj
|
|
};
|
|
this.objBox.onscroll = function() {
|
|
this.grid._doOnScroll()
|
|
};
|
|
this.objBox.ontouchend = function() {
|
|
this.hdrBox.scrollLeft = this.objBox.scrollLeft
|
|
};
|
|
this.hdrBox.onscroll = function() {
|
|
if (this._try_header_sync) {
|
|
return
|
|
}
|
|
this._try_header_sync = true;
|
|
if (Math.abs(this.grid.objBox.scrollLeft - this.scrollLeft) > 1) {
|
|
this.grid.objBox.scrollLeft = this.scrollLeft
|
|
}
|
|
this._try_header_sync = false
|
|
};
|
|
if ((!_isOpera) || (_OperaRv > 8.5)) {
|
|
this.hdr.onmousemove = function(e) {
|
|
this.grid.changeCursorState(e || window.event)
|
|
};
|
|
this.hdr.onmousedown = function(e) {
|
|
return this.grid.startColResize(e || window.event)
|
|
}
|
|
}
|
|
this.obj.onmousemove = this._drawTooltip;
|
|
this.objBox.onclick = function(e) {
|
|
(e || event).cancelBubble = true
|
|
};
|
|
this.obj.onclick = function(e) {
|
|
this.grid._doClick(e || window.event);
|
|
if (this.grid._sclE) {
|
|
this.grid.editCell(e || window.event)
|
|
} else {
|
|
this.grid.editStop()
|
|
}(e || event).cancelBubble = true
|
|
};
|
|
if (_isMacOS) {
|
|
this.entBox.oncontextmenu = function(e) {
|
|
e.cancelBubble = true;
|
|
if (e.preventDefault) {
|
|
e.preventDefault()
|
|
} else {
|
|
e.returnValue = false
|
|
}
|
|
var that = this.grid;
|
|
if (that._realfake) {
|
|
that = that._fake
|
|
}
|
|
return that._doContClick(e || window.event)
|
|
}
|
|
} else {
|
|
this.entBox.onmousedown = function(e) {
|
|
return this.grid._doContClick(e || window.event)
|
|
};
|
|
this.entBox.oncontextmenu = function(e) {
|
|
if (this.grid._ctmndx) {
|
|
(e || event).cancelBubble = true
|
|
}
|
|
return !this.grid._ctmndx
|
|
}
|
|
}
|
|
this.obj.ondblclick = function(e) {
|
|
if (!this.grid.wasDblClicked(e || window.event)) {
|
|
return false
|
|
}
|
|
if (this.grid._dclE) {
|
|
var row = this.grid.getFirstParentOfType((_isIE ? event.srcElement : e.target), "TR");
|
|
if (row == this.grid.row) {
|
|
this.grid.editCell(e || window.event)
|
|
}
|
|
}(e || event).cancelBubble = true;
|
|
if (_isOpera) {
|
|
return false
|
|
}
|
|
};
|
|
this.hdr.onclick = this._onHeaderClick;
|
|
this.sortImg.onclick = function() {
|
|
self._onHeaderClick.apply({
|
|
grid: self
|
|
}, [null, self.r_fldSorted])
|
|
};
|
|
this.hdr.ondblclick = this._onHeaderDblClick;
|
|
if (!document.body._dhtmlxgrid_onkeydown) {
|
|
dhtmlxEvent(document, "keydown", function(e) {
|
|
if (globalActiveDHTMLGridObject) {
|
|
return globalActiveDHTMLGridObject.doKey(e || window.event)
|
|
}
|
|
});
|
|
document.body._dhtmlxgrid_onkeydown = true
|
|
}
|
|
dhtmlxEvent(document.body, "click", function() {
|
|
if (self.editStop) {
|
|
self.editStop()
|
|
}
|
|
if (self.isActive) {
|
|
self.setActive(false)
|
|
}
|
|
});
|
|
if (this.entBox.style.height.toString().indexOf("%") != -1) {
|
|
this._delta_y = this.entBox.style.height
|
|
}
|
|
if (this.entBox.style.width.toString().indexOf("%") != -1) {
|
|
this._delta_x = this.entBox.style.width
|
|
}
|
|
if (this._delta_x || this._delta_y) {
|
|
this._setAutoResize()
|
|
}
|
|
this.setColHidden = this.setColumnsVisibility;
|
|
this.enableCollSpan = this.enableColSpan;
|
|
this.setMultiselect = this.enableMultiselect;
|
|
this.setMultiLine = this.enableMultiline;
|
|
this.deleteSelectedItem = this.deleteSelectedRows;
|
|
this.getSelectedId = this.getSelectedRowId;
|
|
this.getHeaderCol = this.getColumnLabel;
|
|
this.isItemExists = this.doesRowExist;
|
|
this.getColumnCount = this.getColumnsNum;
|
|
this.setSelectedRow = this.selectRowById;
|
|
this.setHeaderCol = this.setColumnLabel;
|
|
this.preventIECashing = this.preventIECaching;
|
|
this.enableAutoHeigth = this.enableAutoHeight;
|
|
this.getUID = this.uid;
|
|
if (dhtmlx.image_path) {
|
|
this.setImagePath(dhtmlx.image_path)
|
|
}
|
|
if (dhtmlx.skin) {
|
|
this.setSkin(dhtmlx.skin)
|
|
}
|
|
return this
|
|
}
|
|
dhtmlXGridObject.prototype = {
|
|
getRowAttribute: function(c, a) {
|
|
return this.getRowById(c)._attrs[a]
|
|
},
|
|
setRowAttribute: function(g, a, c) {
|
|
this.getRowById(g)._attrs[a] = c
|
|
},
|
|
isTreeGrid: function() {
|
|
return (this.cellType._dhx_find("tree") != -1)
|
|
},
|
|
setRowHidden: function(m, g) {
|
|
var c = convertStringToBoolean(g);
|
|
var l = this.getRowById(m);
|
|
if (!l) {
|
|
return
|
|
}
|
|
if (l.expand === "") {
|
|
this.collapseKids(l)
|
|
}
|
|
if ((g) && (l.style.display != "none")) {
|
|
l.style.display = "none";
|
|
var h = this.selectedRows._dhx_find(l);
|
|
if (h != -1) {
|
|
l.className = l.className.replace("rowselected", "");
|
|
for (var a = 0; a < l.childNodes.length; a++) {
|
|
l.childNodes[a].className = l.childNodes[a].className.replace(/cellselected/g, "")
|
|
}
|
|
this.selectedRows._dhx_removeAt(h)
|
|
}
|
|
this.callEvent("onGridReconstructed", [])
|
|
}
|
|
if ((!g) && (l.style.display == "none")) {
|
|
l.style.display = "";
|
|
this.callEvent("onGridReconstructed", [])
|
|
}
|
|
this.callEvent("onRowHide", [m, g]);
|
|
this.setSizes()
|
|
},
|
|
setColumnHidden: function(g, c) {
|
|
if (!this.hdr.rows.length) {
|
|
if (!this._ivizcol) {
|
|
this._ivizcol = []
|
|
}
|
|
return this._ivizcol[g] = c
|
|
}
|
|
if ((this.fldSorted) && (this.fldSorted.cellIndex == g) && (c)) {
|
|
this.sortImg.style.display = "none"
|
|
}
|
|
var a = convertStringToBoolean(c);
|
|
if (a) {
|
|
if (!this._hrrar) {
|
|
this._hrrar = new Array()
|
|
} else {
|
|
if (this._hrrar[g]) {
|
|
return
|
|
}
|
|
}
|
|
this._hrrar[g] = "display:none;";
|
|
this._hideShowColumn(g, "none")
|
|
} else {
|
|
if ((!this._hrrar) || (!this._hrrar[g])) {
|
|
return
|
|
}
|
|
this._hrrar[g] = "";
|
|
this._hideShowColumn(g, "")
|
|
} if ((this.fldSorted) && (this.fldSorted.cellIndex == g) && (!c)) {
|
|
this.sortImg.style.display = "inline"
|
|
}
|
|
this.setSortImgPos();
|
|
this.callEvent("onColumnHidden", [g, c])
|
|
},
|
|
isColumnHidden: function(a) {
|
|
if ((this._hrrar) && (this._hrrar[a])) {
|
|
return true
|
|
}
|
|
return false
|
|
},
|
|
setColumnsVisibility: function(c) {
|
|
if (c) {
|
|
this._ivizcol = c.split(this.delim)
|
|
}
|
|
if (this.hdr.rows.length && this._ivizcol) {
|
|
for (var a = 0; a < this._ivizcol.length; a++) {
|
|
this.setColumnHidden(a, this._ivizcol[a])
|
|
}
|
|
}
|
|
},
|
|
_fixHiddenRowsAll: function(o, g, a, c, m) {
|
|
m = m || "_cellIndex";
|
|
var n = o.rows.length;
|
|
for (var l = 0; l < n; l++) {
|
|
var q = o.rows[l].childNodes;
|
|
if (q.length != this._cCount) {
|
|
for (var h = 0; h < q.length; h++) {
|
|
if (q[h][m] == g) {
|
|
q[h].style[a] = c;
|
|
break
|
|
}
|
|
}
|
|
} else {
|
|
q[g].style[a] = c
|
|
}
|
|
}
|
|
},
|
|
_hideShowColumn: function(l, h) {
|
|
var a = l;
|
|
if (this.hdr.rows[1] && (this.hdr.rows[1]._childIndexes) && (this.hdr.rows[1]._childIndexes[l] != l)) {
|
|
a = this.hdr.rows[1]._childIndexes[l]
|
|
}
|
|
if (h == "none") {
|
|
this.hdr.rows[0].cells[l]._oldWidth = this.hdr.rows[0].cells[l].style.width || (this.initCellWidth[l] + "px");
|
|
this.hdr.rows[0].cells[l]._oldWidthP = this.cellWidthPC[l];
|
|
this.obj.rows[0].cells[l].style.width = "0px";
|
|
var c = {
|
|
rows: [this.obj.rows[0]]
|
|
};
|
|
this.forEachRow(function(m) {
|
|
if (this.rowsAr[m].tagName == "TR") {
|
|
c.rows.push(this.rowsAr[m])
|
|
}
|
|
});
|
|
this._fixHiddenRowsAll(c, l, "display", "none");
|
|
if (this.isTreeGrid()) {
|
|
this._fixHiddenRowsAllTG(l, "none")
|
|
}
|
|
if ((_isOpera && _OperaRv < 9) || _isKHTML || (_isFF)) {
|
|
this._fixHiddenRowsAll(this.hdr, l, "display", "none", "_cellIndexS")
|
|
}
|
|
if (this.ftr) {
|
|
this._fixHiddenRowsAll(this.ftr.childNodes[0], l, "display", "none")
|
|
}
|
|
this._fixHiddenRowsAll(this.hdr, l, "whiteSpace", "nowrap", "_cellIndexS");
|
|
if (!this.cellWidthPX.length && !this.cellWidthPC.length) {
|
|
this.cellWidthPX = [].concat(this.initCellWidth)
|
|
}
|
|
if (this.cellWidthPX[l]) {
|
|
this.cellWidthPX[l] = 0
|
|
}
|
|
if (this.cellWidthPC[l]) {
|
|
this.cellWidthPC[l] = 0
|
|
}
|
|
} else {
|
|
if (this.hdr.rows[0].cells[l]._oldWidth) {
|
|
var g = this.hdr.rows[0].cells[l];
|
|
if (_isOpera || _isKHTML || (_isFF)) {
|
|
this._fixHiddenRowsAll(this.hdr, l, "display", "", "_cellIndexS")
|
|
}
|
|
if (this.ftr) {
|
|
this._fixHiddenRowsAll(this.ftr.childNodes[0], l, "display", "")
|
|
}
|
|
var c = {
|
|
rows: [this.obj.rows[0]]
|
|
};
|
|
this.forEachRow(function(m) {
|
|
if (this.rowsAr[m].tagName == "TR") {
|
|
c.rows.push(this.rowsAr[m])
|
|
}
|
|
});
|
|
this._fixHiddenRowsAll(c, l, "display", "");
|
|
if (this.isTreeGrid()) {
|
|
this._fixHiddenRowsAllTG(l, "")
|
|
}
|
|
this._fixHiddenRowsAll(this.hdr, l, "whiteSpace", "normal", "_cellIndexS");
|
|
if (g._oldWidthP) {
|
|
this.cellWidthPC[l] = g._oldWidthP
|
|
}
|
|
if (g._oldWidth) {
|
|
this.cellWidthPX[l] = parseInt(g._oldWidth)
|
|
}
|
|
}
|
|
}
|
|
this.setSizes();
|
|
if ((!_isIE) && (!_isFF)) {
|
|
this.obj.border = 1;
|
|
this.obj.border = 0
|
|
}
|
|
},
|
|
enableColSpan: function(a) {
|
|
this._ecspn = convertStringToBoolean(a)
|
|
},
|
|
enableRowsHover: function(c, a) {
|
|
this._unsetRowHover(false, true);
|
|
this._hvrCss = a;
|
|
if (convertStringToBoolean(c)) {
|
|
if (!this._elmnh) {
|
|
this.obj._honmousemove = this.obj.onmousemove;
|
|
this.obj.onmousemove = this._setRowHover;
|
|
if (_isIE) {
|
|
this.obj.onmouseleave = this._unsetRowHover
|
|
} else {
|
|
this.obj.onmouseout = this._unsetRowHover
|
|
}
|
|
this._elmnh = true
|
|
}
|
|
} else {
|
|
if (this._elmnh) {
|
|
this.obj.onmousemove = this.obj._honmousemove;
|
|
if (_isIE) {
|
|
this.obj.onmouseleave = null
|
|
} else {
|
|
this.obj.onmouseout = null
|
|
}
|
|
this._elmnh = false
|
|
}
|
|
}
|
|
},
|
|
enableEditEvents: function(c, g, a) {
|
|
this._sclE = convertStringToBoolean(c);
|
|
this._dclE = convertStringToBoolean(g);
|
|
this._f2kE = convertStringToBoolean(a)
|
|
},
|
|
enableLightMouseNavigation: function(a) {
|
|
if (convertStringToBoolean(a)) {
|
|
if (!this._elmn) {
|
|
this.entBox._onclick = this.entBox.onclick;
|
|
this.entBox.onclick = function() {
|
|
return true
|
|
};
|
|
this.obj._onclick = this.obj.onclick;
|
|
this.obj.onclick = function(g) {
|
|
var h = this.grid.getFirstParentOfType(g ? g.target : event.srcElement, "TD");
|
|
if (!h) {
|
|
return
|
|
}
|
|
this.grid.editStop();
|
|
this.grid.doClick(h);
|
|
this.grid.editCell();
|
|
(g || event).cancelBubble = true
|
|
};
|
|
this.obj._onmousemove = this.obj.onmousemove;
|
|
this.obj.onmousemove = this._autoMoveSelect;
|
|
this._elmn = true
|
|
}
|
|
} else {
|
|
if (this._elmn) {
|
|
this.entBox.onclick = this.entBox._onclick;
|
|
this.obj.onclick = this.obj._onclick;
|
|
this.obj.onmousemove = this.obj._onmousemove;
|
|
this._elmn = false
|
|
}
|
|
}
|
|
},
|
|
_unsetRowHover: function(g, h) {
|
|
if (h) {
|
|
that = this
|
|
} else {
|
|
that = this.grid
|
|
} if ((that._lahRw) && (that._lahRw != h)) {
|
|
for (var a = 0; a < that._lahRw.childNodes.length; a++) {
|
|
that._lahRw.childNodes[a].className = that._lahRw.childNodes[a].className.replace(that._hvrCss, "")
|
|
}
|
|
that._lahRw = null
|
|
}
|
|
},
|
|
_setRowHover: function(g) {
|
|
var h = this.grid.getFirstParentOfType(g ? g.target : event.srcElement, "TD");
|
|
if (h && h.parentNode != this.grid._lahRw) {
|
|
this.grid._unsetRowHover(0, h);
|
|
h = h.parentNode;
|
|
if (!h.idd || h.idd == "__filler__") {
|
|
return
|
|
}
|
|
for (var a = 0; a < h.childNodes.length; a++) {
|
|
h.childNodes[a].className += " " + this.grid._hvrCss
|
|
}
|
|
this.grid._lahRw = h
|
|
}
|
|
this._honmousemove(g)
|
|
},
|
|
_autoMoveSelect: function(a) {
|
|
if (!this.grid.editor) {
|
|
var g = this.grid.getFirstParentOfType(a ? a.target : event.srcElement, "TD");
|
|
if (g.parentNode.idd) {
|
|
this.grid.doClick(g, true, 0)
|
|
}
|
|
}
|
|
this._onmousemove(a)
|
|
},
|
|
enableDistributedParsing: function(g, a, c) {
|
|
if (convertStringToBoolean(g)) {
|
|
this._ads_count = a || 10;
|
|
this._ads_time = c || 250
|
|
} else {
|
|
this._ads_count = 0
|
|
}
|
|
},
|
|
destructor: function() {
|
|
this.editStop(true);
|
|
if (this._sizeTime) {
|
|
this._sizeTime = window.clearTimeout(this._sizeTime)
|
|
}
|
|
this.entBox.className = (this.entBox.className || "").replace(/gridbox.*/, "");
|
|
if (this.formInputs) {
|
|
for (var g = 0; g < this.formInputs.length; g++) {
|
|
this.parentForm.removeChild(this.formInputs[g])
|
|
}
|
|
}
|
|
var c;
|
|
this.xmlLoader = this.xmlLoader.destructor();
|
|
for (var g = 0; g < this.rowsCol.length; g++) {
|
|
if (this.rowsCol[g]) {
|
|
this.rowsCol[g].grid = null
|
|
}
|
|
}
|
|
for (g in this.rowsAr) {
|
|
if (this.rowsAr[g]) {
|
|
this.rowsAr[g] = null
|
|
}
|
|
}
|
|
this.rowsCol = new dhtmlxArray();
|
|
this.rowsAr = {};
|
|
this.entBox.innerHTML = "";
|
|
var h = function() {};
|
|
this.entBox.onclick = this.entBox.onmousedown = this.entBox.onbeforeactivate = this.entBox.onbeforedeactivate = this.entBox.onbeforedeactivate = this.entBox.onselectstart = h;
|
|
this.setSizes = this._update_srnd_view = this.callEvent = h;
|
|
this.entBox.grid = this.objBox.grid = this.hdrBox.grid = this.obj.grid = this.hdr.grid = null;
|
|
if (this._fake) {
|
|
this.globalBox.innerHTML = "";
|
|
this._fake.setSizes = this._fake._update_srnd_view = this._fake.callEvent = h;
|
|
this.globalBox.onclick = this.globalBox.onmousedown = this.globalBox.onbeforeactivate = this.globalBox.onbeforedeactivate = this.globalBox.onbeforedeactivate = this.globalBox.onselectstart = h
|
|
}
|
|
for (c in this) {
|
|
if ((this[c]) && (this[c].m_obj)) {
|
|
this[c].m_obj = null
|
|
}
|
|
this[c] = null
|
|
}
|
|
if (this == globalActiveDHTMLGridObject) {
|
|
globalActiveDHTMLGridObject = null
|
|
}
|
|
return null
|
|
},
|
|
getSortingState: function() {
|
|
var a = new Array();
|
|
if (this.fldSorted) {
|
|
a[0] = this.fldSorted._cellIndex;
|
|
a[1] = (this.sortImg.className == "dhxgrid_sort_desc" ? "des" : "asc")
|
|
}
|
|
return a
|
|
},
|
|
enableAutoHeight: function(g, c, a) {
|
|
this._ahgr = convertStringToBoolean(g);
|
|
this._ahgrF = convertStringToBoolean(a);
|
|
this._ahgrM = c || null;
|
|
if (arguments.length == 1) {
|
|
this.objBox.style.overflowY = g ? "hidden" : "auto"
|
|
}
|
|
if (c == "auto") {
|
|
this._ahgrM = null;
|
|
this._ahgrMA = true;
|
|
this._setAutoResize()
|
|
}
|
|
},
|
|
enableStableSorting: function(a) {
|
|
this._sst = convertStringToBoolean(a);
|
|
this.rowsCol.stablesort = function(m) {
|
|
var l = this.length - 1;
|
|
for (var h = 0; h < this.length - 1; h++) {
|
|
for (var g = 0; g < l; g++) {
|
|
if (m(this[g], this[g + 1]) > 0) {
|
|
var c = this[g];
|
|
this[g] = this[g + 1];
|
|
this[g + 1] = c
|
|
}
|
|
}
|
|
l--
|
|
}
|
|
}
|
|
},
|
|
enableKeyboardSupport: function(a) {
|
|
this._htkebl = !convertStringToBoolean(a)
|
|
},
|
|
enableContextMenu: function(a) {
|
|
this._ctmndx = a
|
|
},
|
|
setScrollbarWidthCorrection: function(a) {},
|
|
enableTooltips: function(c) {
|
|
this._enbTts = c.split(",");
|
|
for (var a = 0; a < this._enbTts.length; a++) {
|
|
this._enbTts[a] = convertStringToBoolean(this._enbTts[a])
|
|
}
|
|
},
|
|
enableResizing: function(c) {
|
|
this._drsclmn = c.split(",");
|
|
for (var a = 0; a < this._drsclmn.length; a++) {
|
|
this._drsclmn[a] = convertStringToBoolean(this._drsclmn[a])
|
|
}
|
|
},
|
|
setColumnMinWidth: function(a, c) {
|
|
if (arguments.length == 2) {
|
|
if (!this._drsclmW) {
|
|
this._drsclmW = new Array()
|
|
}
|
|
this._drsclmW[c] = a
|
|
} else {
|
|
this._drsclmW = a.split(",")
|
|
}
|
|
},
|
|
enableCellIds: function(a) {
|
|
this._enbCid = convertStringToBoolean(a)
|
|
},
|
|
lockRow: function(a, g) {
|
|
var c = this.getRowById(a);
|
|
if (c) {
|
|
c._locked = convertStringToBoolean(g);
|
|
if ((this.cell) && (this.cell.parentNode.idd == a)) {
|
|
this.editStop()
|
|
}
|
|
}
|
|
},
|
|
_getRowArray: function(l) {
|
|
var h = new Array();
|
|
for (var g = 0; g < l.childNodes.length; g++) {
|
|
var c = this.cells3(l, g);
|
|
h[g] = c.getValue()
|
|
}
|
|
return h
|
|
},
|
|
setDateFormat: function(c, a) {
|
|
this._dtmask = c;
|
|
this._dtmask_inc = a
|
|
},
|
|
setNumberFormat: function(o, g, l, n) {
|
|
var h = o.replace(/[^0\,\.]*/g, "");
|
|
var a = h.indexOf(".");
|
|
if (a > -1) {
|
|
a = h.length - a - 1
|
|
}
|
|
var c = h.indexOf(",");
|
|
if (c > -1) {
|
|
c = h.length - a - 2 - c
|
|
}
|
|
if (typeof l != "string") {
|
|
l = this.i18n.decimal_separator
|
|
}
|
|
if (typeof n != "string") {
|
|
n = this.i18n.group_separator
|
|
}
|
|
var q = o.split(h)[0];
|
|
var m = o.split(h)[1];
|
|
this._maskArr[g] = [a, c, q, m, l, n]
|
|
},
|
|
_aplNFb: function(l, h) {
|
|
var c = this._maskArr[h];
|
|
if (!c) {
|
|
return l
|
|
}
|
|
var g = parseFloat(l.toString().replace(/[^0-9]*/g, ""));
|
|
if (l.toString().substr(0, 1) == "-") {
|
|
g = g * -1
|
|
}
|
|
if (c[0] > 0) {
|
|
g = g / Math.pow(10, c[0])
|
|
}
|
|
return g
|
|
},
|
|
_aplNF: function(m, l) {
|
|
var g = this._maskArr[l];
|
|
if (!g) {
|
|
return m
|
|
}
|
|
var n = (parseFloat(m) < 0 ? "-" : "") + g[2];
|
|
m = Math.abs(Math.round(parseFloat(m) * Math.pow(10, g[0] > 0 ? g[0] : 0))).toString();
|
|
m = (m.length < g[0] ? Math.pow(10, g[0] + 1 - m.length).toString().substr(1, g[0] + 1) + m.toString() : m).split("").reverse();
|
|
m[g[0]] = (m[g[0]] || "0") + g[4];
|
|
if (g[1] > 0) {
|
|
for (var h = (g[0] > 0 ? 0 : 1) + g[0] + g[1]; h < m.length; h += g[1]) {
|
|
m[h] += g[5]
|
|
}
|
|
}
|
|
return n + m.reverse().join("") + g[3]
|
|
},
|
|
_launchCommands: function(a) {
|
|
for (var h = 0; h < a.length; h++) {
|
|
var g = new Array();
|
|
for (var c = 0; c < a[h].childNodes.length; c++) {
|
|
if (a[h].childNodes[c].nodeType == 1) {
|
|
g[g.length] = a[h].childNodes[c].firstChild.data
|
|
}
|
|
}
|
|
this[a[h].getAttribute("command")].apply(this, g)
|
|
}
|
|
},
|
|
_parseHead: function(l) {
|
|
var h = this.xmlLoader.doXPath("./head", l);
|
|
if (h.length) {
|
|
var m = this.xmlLoader.doXPath("./column", h[0]);
|
|
var n = this.xmlLoader.doXPath("./settings", h[0]);
|
|
var C = "setInitWidths";
|
|
var w = false;
|
|
if (n[0]) {
|
|
for (var o = 0; o < n[0].childNodes.length; o++) {
|
|
switch (n[0].childNodes[o].tagName) {
|
|
case "colwidth":
|
|
if (n[0].childNodes[o].firstChild && n[0].childNodes[o].firstChild.data == "%") {
|
|
C = "setInitWidthsP"
|
|
}
|
|
break;
|
|
case "splitat":
|
|
w = (n[0].childNodes[o].firstChild ? n[0].childNodes[o].firstChild.data : false);
|
|
break
|
|
}
|
|
}
|
|
}
|
|
this._launchCommands(this.xmlLoader.doXPath("./beforeInit/call", h[0]));
|
|
if (m.length > 0) {
|
|
if (this.hdr.rows.length > 0) {
|
|
this.clearAll(true)
|
|
}
|
|
var a = [
|
|
[],
|
|
[],
|
|
[],
|
|
[],
|
|
[],
|
|
[],
|
|
[],
|
|
[],
|
|
[]
|
|
];
|
|
var v = ["", "width", "type", "align", "sort", "color", "format", "hidden", "id"];
|
|
var u = ["", C, "setColTypes", "setColAlign", "setColSorting", "setColumnColor", "", "", "setColumnIds"];
|
|
for (var A = 0; A < m.length; A++) {
|
|
for (var y = 1; y < v.length; y++) {
|
|
a[y].push(m[A].getAttribute(v[y]))
|
|
}
|
|
a[0].push((m[A].firstChild ? m[A].firstChild.data : "").replace(/^\s*((\s\S)*.+)\s*$/gi, "$1"))
|
|
}
|
|
this.setHeader(a[0]);
|
|
for (var A = 0; A < u.length; A++) {
|
|
if (u[A]) {
|
|
this[u[A]](a[A].join(this.delim))
|
|
}
|
|
}
|
|
for (var A = 0; A < m.length; A++) {
|
|
if ((this.cellType[A].indexOf("co") == 0) || (this.cellType[A] == "clist")) {
|
|
var q = this.xmlLoader.doXPath("./option", m[A]);
|
|
if (q.length) {
|
|
var x = new Array();
|
|
if (this.cellType[A] == "clist") {
|
|
for (var y = 0; y < q.length; y++) {
|
|
x[x.length] = q[y].firstChild ? q[y].firstChild.data : ""
|
|
}
|
|
this.registerCList(A, x)
|
|
} else {
|
|
var D = this.getCombo(A);
|
|
for (var y = 0; y < q.length; y++) {
|
|
D.put(q[y].getAttribute("value"), q[y].firstChild ? q[y].firstChild.data : "")
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (a[6][A]) {
|
|
if ((this.cellType[A].toLowerCase().indexOf("calendar") != -1) || (this.fldSort[A] == "date")) {
|
|
this.setDateFormat(a[6][A])
|
|
} else {
|
|
this.setNumberFormat(a[6][A], A)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.init();
|
|
var g = a[7].join(this.delim);
|
|
if (this.setColHidden && g.replace(/,/g, "") != "") {
|
|
this.setColHidden(g)
|
|
}
|
|
if ((w) && (this.splitAt)) {
|
|
this.splitAt(w)
|
|
}
|
|
}
|
|
this._launchCommands(this.xmlLoader.doXPath("./afterInit/call", h[0]))
|
|
}
|
|
var c = this.xmlLoader.doXPath("//rows/userdata", l);
|
|
if (c.length > 0) {
|
|
if (!this.UserData.gridglobaluserdata) {
|
|
this.UserData.gridglobaluserdata = new Hashtable()
|
|
}
|
|
for (var y = 0; y < c.length; y++) {
|
|
var E = "";
|
|
for (var r = 0; r < c[y].childNodes.length; r++) {
|
|
E += c[y].childNodes[r].nodeValue
|
|
}
|
|
this.UserData.gridglobaluserdata.put(c[y].getAttribute("name"), E)
|
|
}
|
|
}
|
|
},
|
|
getCheckedRows: function(a) {
|
|
var c = new Array();
|
|
this.forEachRowA(function(h) {
|
|
var g = this.cells(h, a);
|
|
if (g.changeState && g.getValue() != 0) {
|
|
c.push(h)
|
|
}
|
|
}, true);
|
|
return c.join(",")
|
|
},
|
|
checkAll: function() {
|
|
var c = arguments.length ? arguments[0] : 1;
|
|
for (var a = 0; a < this.getColumnsNum(); a++) {
|
|
if (this.getColType(a) == "ch") {
|
|
this.setCheckedRows(a, c)
|
|
}
|
|
}
|
|
},
|
|
uncheckAll: function() {
|
|
this.checkAll(0)
|
|
},
|
|
setCheckedRows: function(c, a) {
|
|
this.forEachRowA(function(g) {
|
|
if (this.cells(g, c).isCheckbox()) {
|
|
this.cells(g, c).setValue(a)
|
|
}
|
|
})
|
|
},
|
|
_drawTooltip: function(l) {
|
|
var m = this.grid.getFirstParentOfType(l ? l.target : event.srcElement, "TD");
|
|
if (!m || ((this.grid.editor) && (this.grid.editor.cell == m))) {
|
|
return true
|
|
}
|
|
var h = m.parentNode;
|
|
if (!h.idd || h.idd == "__filler__") {
|
|
return
|
|
}
|
|
var g = (l ? l.target : event.srcElement);
|
|
if (h.idd == window.unknown) {
|
|
return true
|
|
}
|
|
if (!this.grid.callEvent("onMouseOver", [h.idd, m._cellIndex, (l || window.event)])) {
|
|
return true
|
|
}
|
|
if ((this.grid._enbTts) && (!this.grid._enbTts[m._cellIndex])) {
|
|
if (g.title) {
|
|
g.title = ""
|
|
}
|
|
return true
|
|
}
|
|
if (m._cellIndex >= this.grid._cCount) {
|
|
return
|
|
}
|
|
var a = this.grid.cells3(h, m._cellIndex);
|
|
if (!a || !a.cell || !a.cell._attrs) {
|
|
return
|
|
}
|
|
if (g._title) {
|
|
a.cell.title = ""
|
|
}
|
|
if (!a.cell._attrs.title) {
|
|
g._title = true
|
|
}
|
|
if (a) {
|
|
g.title = a.cell._attrs.title || (a.getTitle ? a.getTitle() : (a.getValue() || "").toString().replace(/<[^>]*>/gi, ""))
|
|
}
|
|
return true
|
|
},
|
|
enableCellWidthCorrection: function(a) {
|
|
if (_isFF) {
|
|
this._wcorr = parseInt(a)
|
|
}
|
|
},
|
|
getAllRowIds: function(g) {
|
|
var a = [];
|
|
for (var c = 0; c < this.rowsBuffer.length; c++) {
|
|
if (this.rowsBuffer[c]) {
|
|
a.push(this.rowsBuffer[c].idd)
|
|
}
|
|
}
|
|
return a.join(g || this.delim)
|
|
},
|
|
getAllItemIds: function() {
|
|
return this.getAllRowIds()
|
|
},
|
|
setColspan: function(g, x, h) {
|
|
if (!this._ecspn) {
|
|
return
|
|
}
|
|
var a = this.getRowById(g);
|
|
if ((a._childIndexes) && (a.childNodes[a._childIndexes[x]])) {
|
|
var q = a._childIndexes[x];
|
|
var l = a.childNodes[q];
|
|
var o = l.colSpan;
|
|
l.colSpan = 1;
|
|
if ((o) && (o != 1)) {
|
|
for (var u = 1; u < o; u++) {
|
|
var w = document.createElement("TD");
|
|
if (l.nextSibling) {
|
|
a.insertBefore(w, l.nextSibling)
|
|
} else {
|
|
a.appendChild(w)
|
|
}
|
|
a._childIndexes[x + u] = q + u;
|
|
w._cellIndex = x + u;
|
|
w.style.textAlign = this.cellAlign[u];
|
|
w.style.verticalAlign = this.cellVAlign[u];
|
|
l = w;
|
|
this.cells3(a, x + u).setValue("")
|
|
}
|
|
}
|
|
for (var v = x * 1 + 1 * o; v < a._childIndexes.length; v++) {
|
|
a._childIndexes[v] += (o - 1) * 1
|
|
}
|
|
}
|
|
if ((h) && (h > 1)) {
|
|
if (a._childIndexes) {
|
|
var q = a._childIndexes[x]
|
|
} else {
|
|
var q = x;
|
|
a._childIndexes = new Array();
|
|
for (var v = 0; v < a.childNodes.length; v++) {
|
|
a._childIndexes[v] = v
|
|
}
|
|
}
|
|
a.childNodes[q].colSpan = h;
|
|
for (var v = 1; v < h; v++) {
|
|
a._childIndexes[a.childNodes[q + 1]._cellIndex] = q;
|
|
a.removeChild(a.childNodes[q + 1])
|
|
}
|
|
var s = a.childNodes[a._childIndexes[x]]._cellIndex;
|
|
for (var v = s * 1 + 1 * h; v < a._childIndexes.length; v++) {
|
|
a._childIndexes[v] -= (h - 1)
|
|
}
|
|
}
|
|
},
|
|
preventIECaching: function(a) {
|
|
this.no_cashe = convertStringToBoolean(a);
|
|
this.xmlLoader.rSeed = this.no_cashe
|
|
},
|
|
enableColumnAutoSize: function(a) {
|
|
this._eCAS = convertStringToBoolean(a)
|
|
},
|
|
_onHeaderDblClick: function(g) {
|
|
var c = this.grid;
|
|
var a = c.getFirstParentOfType(_isIE ? event.srcElement : g.target, "TD");
|
|
if (!c._eCAS) {
|
|
return false
|
|
}
|
|
c.adjustColumnSize(a._cellIndexS)
|
|
},
|
|
adjustColumnSize: function(q, c) {
|
|
if (this._hrrar && this._hrrar[q]) {
|
|
return
|
|
}
|
|
this._notresize = true;
|
|
var g = 0;
|
|
this._setColumnSizeR(q, 20);
|
|
for (var n = 1; n < this.hdr.rows.length; n++) {
|
|
var s = this.hdr.rows[n];
|
|
s = s.childNodes[(s._childIndexes) ? s._childIndexes[q] : q];
|
|
if ((s) && ((!s.colSpan) || (s.colSpan < 2)) && s._cellIndex == q) {
|
|
if ((s.childNodes[0]) && (s.childNodes[0].className == "hdrcell")) {
|
|
s = s.childNodes[0]
|
|
}
|
|
g = Math.max(g, s.scrollWidth)
|
|
}
|
|
}
|
|
var h = this.obj.rows.length;
|
|
var r = 0;
|
|
var v = this.cellType._dhx_find("tree");
|
|
for (var o = 1; o < h; o++) {
|
|
var u = this.obj.rows[o];
|
|
if (!this.rowsAr[u.idd]) {
|
|
continue
|
|
}
|
|
if (u._childIndexes && u._childIndexes[q] != q || !u.childNodes[q]) {
|
|
continue
|
|
}
|
|
r = (u.childNodes[q].innerText || u.childNodes[q].textContent || "").length * this.fontWidth;
|
|
if (this._h2 && q == v) {
|
|
r += this._h2.get[u.idd].level * 22
|
|
}
|
|
if (r > g) {
|
|
g = r
|
|
}
|
|
}
|
|
g += 20 + (c || 0);
|
|
this._setColumnSizeR(q, g);
|
|
this._notresize = false;
|
|
this.setSizes()
|
|
},
|
|
detachHeader: function(a, g) {
|
|
g = g || this.hdr;
|
|
var c = g.rows[a + 1];
|
|
if (c) {
|
|
c.parentNode.removeChild(c)
|
|
}
|
|
this.setSizes()
|
|
},
|
|
detachFooter: function(a) {
|
|
this.detachHeader(a, this.ftr)
|
|
},
|
|
attachHeader: function(a, h, c) {
|
|
if (typeof(a) == "string") {
|
|
a = this._eSplit(a)
|
|
}
|
|
if (typeof(h) == "string") {
|
|
h = h.split(this.delim)
|
|
}
|
|
c = c || "_aHead";
|
|
if (this.hdr.rows.length) {
|
|
if (a) {
|
|
this._createHRow([a, h], this[(c == "_aHead") ? "hdr" : "ftr"])
|
|
} else {
|
|
if (this[c]) {
|
|
for (var g = 0; g < this[c].length; g++) {
|
|
this.attachHeader.apply(this, this[c][g])
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (!this[c]) {
|
|
this[c] = new Array()
|
|
}
|
|
this[c][this[c].length] = [a, h, c]
|
|
}
|
|
},
|
|
_createHRow: function(g, r) {
|
|
if (!r) {
|
|
if (this.entBox.style.position != "absolute") {
|
|
this.entBox.style.position = "relative"
|
|
}
|
|
var n = document.createElement("DIV");
|
|
n.className = "c_ftr".substr(2);
|
|
this.entBox.appendChild(n);
|
|
var v = document.createElement("TABLE");
|
|
v.cellPadding = v.cellSpacing = 0;
|
|
if (!_isIE || _isIE == 8) {
|
|
v.width = "100%";
|
|
v.style.paddingRight = "20px"
|
|
}
|
|
v.style.marginRight = "20px";
|
|
v.style.tableLayout = "fixed";
|
|
n.appendChild(v);
|
|
v.appendChild(document.createElement("TBODY"));
|
|
this.ftr = r = v;
|
|
var m = v.insertRow(0);
|
|
var a = ((this.hdrLabels.length <= 1) ? g[0].length : this.hdrLabels.length);
|
|
for (var h = 0; h < a; h++) {
|
|
m.appendChild(document.createElement("TH"));
|
|
m.childNodes[h]._cellIndex = h
|
|
}
|
|
if (_isIE && _isIE < 8) {
|
|
m.style.position = "absolute"
|
|
} else {
|
|
m.style.height = "auto"
|
|
}
|
|
}
|
|
var l = g[1];
|
|
var n = document.createElement("TR");
|
|
r.rows[0].parentNode.appendChild(n);
|
|
for (var h = 0; h < g[0].length; h++) {
|
|
if (g[0][h] == "#cspan") {
|
|
var o = n.cells[n.cells.length - 1];
|
|
o.colSpan = (o.colSpan || 1) + 1;
|
|
continue
|
|
}
|
|
if ((g[0][h] == "#rspan") && (r.rows.length > 1)) {
|
|
var y = r.rows.length - 2;
|
|
var x = false;
|
|
var o = null;
|
|
while (!x) {
|
|
var o = r.rows[y];
|
|
for (var c = 0; c < o.cells.length; c++) {
|
|
if (o.cells[c]._cellIndex == h) {
|
|
x = c + 1;
|
|
break
|
|
}
|
|
}
|
|
y--
|
|
}
|
|
o = o.cells[x - 1];
|
|
o.rowSpan = (o.rowSpan || 1) + 1;
|
|
continue
|
|
}
|
|
var q = document.createElement("TD");
|
|
q._cellIndex = q._cellIndexS = h;
|
|
if (this._hrrar && this._hrrar[h] && !_isIE) {
|
|
q.style.display = "none"
|
|
}
|
|
if (typeof g[0][h] == "object") {
|
|
q.appendChild(g[0][h])
|
|
} else {
|
|
if (this.forceDivInHeader) {
|
|
q.innerHTML = "<div class='hdrcell'>" + (g[0][h] || " ") + "</div>"
|
|
} else {
|
|
q.innerHTML = (g[0][h] || " ")
|
|
} if ((g[0][h] || "").indexOf("#") != -1) {
|
|
var v = g[0][h].match(/(^|{)#([^}]+)(}|$)/);
|
|
if (v) {
|
|
var s = "_in_header_" + v[2];
|
|
if (this[s]) {
|
|
this[s]((this.forceDivInHeader ? q.firstChild : q), h, g[0][h].split(v[0]))
|
|
}
|
|
}
|
|
}
|
|
} if (l) {
|
|
q.style.cssText = l[h]
|
|
}
|
|
n.appendChild(q)
|
|
}
|
|
var u = r;
|
|
if (_isKHTML) {
|
|
if (r._kTimer) {
|
|
window.clearTimeout(r._kTimer)
|
|
}
|
|
r._kTimer = window.setTimeout(function() {
|
|
r.rows[1].style.display = "none";
|
|
window.setTimeout(function() {
|
|
r.rows[1].style.display = ""
|
|
}, 1)
|
|
}, 500)
|
|
}
|
|
},
|
|
attachFooter: function(a, c) {
|
|
this.attachHeader(a, c, "_aFoot")
|
|
},
|
|
setCellExcellType: function(g, a, c) {
|
|
this.changeCellType(this.getRowById(g), a, c)
|
|
},
|
|
changeCellType: function(g, h, c) {
|
|
c = c || this.cellType[h];
|
|
var l = this.cells3(g, h);
|
|
var a = l.getValue();
|
|
l.cell._cellType = c;
|
|
var l = this.cells3(g, h);
|
|
l.setValue(a)
|
|
},
|
|
setRowExcellType: function(g, c) {
|
|
var h = this.rowsAr[g];
|
|
for (var a = 0; a < h.childNodes.length; a++) {
|
|
this.changeCellType(h, a, c)
|
|
}
|
|
},
|
|
setColumnExcellType: function(a, g) {
|
|
for (var c = 0; c < this.rowsBuffer.length; c++) {
|
|
if (this.rowsBuffer[c] && this.rowsBuffer[c].tagName == "TR") {
|
|
this.changeCellType(this.rowsBuffer[c], a, g)
|
|
}
|
|
}
|
|
if (this.cellType[a] == "math") {
|
|
this._strangeParams[c] = g
|
|
} else {
|
|
this.cellType[a] = g
|
|
}
|
|
},
|
|
forEachRow: function(g) {
|
|
for (var c in this.rowsAr) {
|
|
if (this.rowsAr[c] && this.rowsAr[c].idd) {
|
|
g.apply(this, [this.rowsAr[c].idd])
|
|
}
|
|
}
|
|
},
|
|
forEachRowA: function(g) {
|
|
for (var c = 0; c < this.rowsBuffer.length; c++) {
|
|
if (this.rowsBuffer[c]) {
|
|
g.call(this, this.render_row(c).idd)
|
|
}
|
|
}
|
|
},
|
|
forEachCell: function(g, c) {
|
|
var h = this.getRowById(g);
|
|
if (!h) {
|
|
return
|
|
}
|
|
for (var a = 0; a < this._cCount; a++) {
|
|
c(this.cells3(h, a), a)
|
|
}
|
|
},
|
|
enableAutoWidth: function(g, a, c) {
|
|
this._awdth = [convertStringToBoolean(g), parseInt(a || 99999), parseInt(c || 0)];
|
|
if (arguments.length == 1) {
|
|
this.objBox.style.overflowX = g ? "hidden" : "auto"
|
|
}
|
|
},
|
|
updateFromXML: function(a, h, c, g) {
|
|
if (typeof h == "undefined") {
|
|
h = true
|
|
}
|
|
this._refresh_mode = [true, h, c];
|
|
this.load(a, g)
|
|
},
|
|
_refreshFromXML: function(h) {
|
|
if (this._f_rowsBuffer) {
|
|
this.filterBy(0, "")
|
|
}
|
|
reset = false;
|
|
if (window.eXcell_tree) {
|
|
eXcell_tree.prototype.setValueX = eXcell_tree.prototype.setValue;
|
|
eXcell_tree.prototype.setValue = function(u) {
|
|
var s = this.grid._h2.get[this.cell.parentNode.idd];
|
|
if (s && this.cell.parentNode.valTag) {
|
|
this.setLabel(u)
|
|
} else {
|
|
this.setValueX(u)
|
|
}
|
|
}
|
|
}
|
|
var r = this.cellType._dhx_find("tree");
|
|
h.getXMLTopNode("rows");
|
|
var l = h.doXPath("//rows")[0].getAttribute("parent") || 0;
|
|
var n = {};
|
|
if (this._refresh_mode[2]) {
|
|
if (r != -1) {
|
|
this._h2.forEachChild(l, function(s) {
|
|
n[s.id] = true
|
|
}, this)
|
|
} else {
|
|
this.forEachRow(function(s) {
|
|
n[s] = true
|
|
})
|
|
}
|
|
}
|
|
var q = h.doXPath("//row");
|
|
for (var g = 0; g < q.length; g++) {
|
|
var o = q[g];
|
|
var a = o.getAttribute("id");
|
|
n[a] = false;
|
|
var l = o.parentNode.getAttribute("id") || l;
|
|
if (this.rowsAr[a] && this.rowsAr[a].tagName != "TR") {
|
|
if (this._h2) {
|
|
this._h2.get[a].buff.data = o
|
|
} else {
|
|
this.rowsBuffer[this.getRowIndex(a)].data = o
|
|
}
|
|
this.rowsAr[a] = o
|
|
} else {
|
|
if (this.rowsAr[a]) {
|
|
this._process_xml_row(this.rowsAr[a], o, -1);
|
|
this._postRowProcessing(this.rowsAr[a], true);
|
|
if (this._fake && this._fake.rowsAr[a]) {
|
|
this._fake._process_xml_row(this._fake.rowsAr[a], o, -1)
|
|
}
|
|
} else {
|
|
if (this._refresh_mode[1]) {
|
|
var m = {
|
|
idd: a,
|
|
data: o,
|
|
_parser: this._process_xml_row,
|
|
_locator: this._get_xml_data
|
|
};
|
|
var c = this.rowsBuffer.length;
|
|
if (this._refresh_mode[1] == "top") {
|
|
this.rowsBuffer.unshift(m);
|
|
c = 0
|
|
} else {
|
|
this.rowsBuffer.push(m)
|
|
} if (this._h2) {
|
|
reset = true;
|
|
(this._h2.add(a, (o.parentNode.getAttribute("id") || o.parentNode.getAttribute("parent")))).buff = this.rowsBuffer[this.rowsBuffer.length - 1]
|
|
} else {
|
|
if (this._srnd) {
|
|
reset = true
|
|
}
|
|
}
|
|
this.rowsAr[a] = o;
|
|
o = this.render_row(c);
|
|
this._insertRowAt(o, c ? -1 : 0)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this._refresh_mode[2]) {
|
|
for (a in n) {
|
|
if (n[a] && this.rowsAr[a]) {
|
|
this.deleteRow(a)
|
|
}
|
|
}
|
|
}
|
|
this._refresh_mode = null;
|
|
if (window.eXcell_tree) {
|
|
eXcell_tree.prototype.setValue = eXcell_tree.prototype.setValueX
|
|
}
|
|
if (reset) {
|
|
if (this._h2) {
|
|
this._renderSort()
|
|
} else {
|
|
this.render_dataset()
|
|
}
|
|
}
|
|
if (this._f_rowsBuffer) {
|
|
this._f_rowsBuffer = null;
|
|
this.filterByAll()
|
|
}
|
|
},
|
|
getCustomCombo: function(g, c) {
|
|
var a = this.cells(g, c).cell;
|
|
if (!a._combo) {
|
|
a._combo = new dhtmlXGridComboObject()
|
|
}
|
|
return a._combo
|
|
},
|
|
setTabOrder: function(c) {
|
|
var h = c.split(this.delim);
|
|
this._tabOrder = [];
|
|
var a = this._cCount || c.length;
|
|
for (var g = 0; g < a; g++) {
|
|
h[g] = {
|
|
c: parseInt(h[g]),
|
|
ind: g
|
|
}
|
|
}
|
|
h.sort(function(m, l) {
|
|
return (m.c > l.c ? 1 : -1)
|
|
});
|
|
for (var g = 0; g < a; g++) {
|
|
if (!h[g + 1] || (typeof h[g].c == "undefined")) {
|
|
this._tabOrder[h[g].ind] = (h[0].ind + 1) * -1
|
|
} else {
|
|
this._tabOrder[h[g].ind] = h[g + 1].ind
|
|
}
|
|
}
|
|
},
|
|
i18n: {
|
|
loading: "Loading",
|
|
decimal_separator: ".",
|
|
group_separator: ","
|
|
},
|
|
_key_events: {
|
|
k13_1_0: function() {
|
|
var a = this.rowsCol._dhx_find(this.row);
|
|
this.selectCell(this.rowsCol[a + 1], this.cell._cellIndex, true)
|
|
},
|
|
k13_0_1: function() {
|
|
var a = this.rowsCol._dhx_find(this.row);
|
|
this.selectCell(this.rowsCol[a - 1], this.cell._cellIndex, true)
|
|
},
|
|
k13_0_0: function() {
|
|
this.editStop();
|
|
this.callEvent("onEnter", [(this.row ? this.row.idd : null), (this.cell ? this.cell._cellIndex : null)]);
|
|
this._still_active = true
|
|
},
|
|
k9_0_0: function() {
|
|
this.editStop();
|
|
if (!this.callEvent("onTab", [true])) {
|
|
return true
|
|
}
|
|
var a = this._getNextCell(null, 1);
|
|
if (a) {
|
|
this.selectCell(a.parentNode, a._cellIndex, (this.row != a.parentNode), false, true);
|
|
this._still_active = true
|
|
}
|
|
},
|
|
k9_0_1: function() {
|
|
this.editStop();
|
|
if (!this.callEvent("onTab", [false])) {
|
|
return false
|
|
}
|
|
var a = this._getNextCell(null, -1);
|
|
if (a) {
|
|
this.selectCell(a.parentNode, a._cellIndex, (this.row != a.parentNode), false, true);
|
|
this._still_active = true
|
|
}
|
|
},
|
|
k113_0_0: function() {
|
|
if (this._f2kE) {
|
|
this.editCell()
|
|
}
|
|
},
|
|
k32_0_0: function() {
|
|
var a = this.cells4(this.cell);
|
|
if (!a.changeState || (a.changeState() === false)) {
|
|
return false
|
|
}
|
|
},
|
|
k27_0_0: function() {
|
|
this.editStop(true)
|
|
},
|
|
k33_0_0: function() {
|
|
if (this.pagingOn) {
|
|
this.changePage(this.currentPage - 1)
|
|
} else {
|
|
this.scrollPage(-1)
|
|
}
|
|
},
|
|
k34_0_0: function() {
|
|
if (this.pagingOn) {
|
|
this.changePage(this.currentPage + 1)
|
|
} else {
|
|
this.scrollPage(1)
|
|
}
|
|
},
|
|
k37_0_0: function() {
|
|
if (!this.editor && this.isTreeGrid()) {
|
|
this.collapseKids(this.row)
|
|
} else {
|
|
return false
|
|
}
|
|
},
|
|
k39_0_0: function() {
|
|
if (!this.editor && this.isTreeGrid()) {
|
|
this.expandKids(this.row)
|
|
} else {
|
|
return false
|
|
}
|
|
},
|
|
k40_0_0: function() {
|
|
var c = this._realfake ? this._fake : this;
|
|
if (this.editor && this.editor.combo) {
|
|
this.editor.shiftNext()
|
|
} else {
|
|
if (!this.row.idd) {
|
|
return
|
|
}
|
|
var a = Math.max((c._r_select || 0), this.getRowIndex(this.row.idd));
|
|
var g = this._nextRow(a, 1);
|
|
if (g) {
|
|
c._r_select = null;
|
|
this.selectCell(g, this.cell._cellIndex, true);
|
|
if (c.pagingOn) {
|
|
c.showRow(g.idd)
|
|
}
|
|
} else {
|
|
if (!this.callEvent("onLastRow", [])) {
|
|
return false
|
|
}
|
|
this._key_events.k34_0_0.apply(this, []);
|
|
if (this.pagingOn && this.rowsCol[a + 1]) {
|
|
this.selectCell(a + 1, 0, true)
|
|
}
|
|
}
|
|
}
|
|
this._still_active = true
|
|
},
|
|
k38_0_0: function() {
|
|
var c = this._realfake ? this._fake : this;
|
|
if (this.editor && this.editor.combo) {
|
|
this.editor.shiftPrev()
|
|
} else {
|
|
if (!this.row.idd) {
|
|
return
|
|
}
|
|
var a = this.getRowIndex(this.row.idd) + 1;
|
|
if (a != -1 && (!this.pagingOn || (a != 1))) {
|
|
var g = this._nextRow(a - 1, -1);
|
|
this.selectCell(g, this.cell._cellIndex, true);
|
|
if (c.pagingOn && g) {
|
|
c.showRow(g.idd)
|
|
}
|
|
} else {
|
|
this._key_events.k33_0_0.apply(this, [])
|
|
}
|
|
}
|
|
this._still_active = true
|
|
}
|
|
},
|
|
_build_master_row: function() {
|
|
var g = document.createElement("DIV");
|
|
var c = ["<table><tr>"];
|
|
for (var a = 0; a < this._cCount; a++) {
|
|
c.push("<td></td>")
|
|
}
|
|
c.push("</tr></table>");
|
|
g.innerHTML = c.join("");
|
|
this._master_row = g.firstChild.rows[0]
|
|
},
|
|
_prepareRow: function(a) {
|
|
if (!this._master_row) {
|
|
this._build_master_row()
|
|
}
|
|
var g = this._master_row.cloneNode(true);
|
|
for (var c = 0; c < g.childNodes.length; c++) {
|
|
g.childNodes[c]._cellIndex = c;
|
|
if (this._enbCid) {
|
|
g.childNodes[c].id = "c_" + a + "_" + c
|
|
}
|
|
if (this.dragAndDropOff) {
|
|
this.dragger.addDraggableItem(g.childNodes[c], this)
|
|
}
|
|
}
|
|
g.idd = a;
|
|
g.grid = this;
|
|
return g
|
|
},
|
|
_process_jsarray_row: function(c, g) {
|
|
c._attrs = {};
|
|
for (var a = 0; a < c.childNodes.length; a++) {
|
|
c.childNodes[a]._attrs = {}
|
|
}
|
|
this._fillRow(c, (this._c_order ? this._swapColumns(g) : g));
|
|
return c
|
|
},
|
|
_get_jsarray_data: function(c, a) {
|
|
return c[a]
|
|
},
|
|
_process_json_row: function(a, c) {
|
|
c = this._c_order ? this._swapColumns(c.data) : c.data;
|
|
return this._process_some_row(a, c)
|
|
},
|
|
_process_some_row: function(c, g) {
|
|
c._attrs = {};
|
|
for (var a = 0; a < c.childNodes.length; a++) {
|
|
c.childNodes[a]._attrs = {}
|
|
}
|
|
this._fillRow(c, g);
|
|
return c
|
|
},
|
|
_get_json_data: function(c, a) {
|
|
return c.data[a]
|
|
},
|
|
_process_js_row: function(g, h) {
|
|
var a = [];
|
|
for (var c = 0; c < this.columnIds.length; c++) {
|
|
a[c] = h[this.columnIds[c]];
|
|
if (!a[c] && a[c] !== 0) {
|
|
a[c] = ""
|
|
}
|
|
}
|
|
this._process_some_row(g, a);
|
|
g._attrs = h;
|
|
return g
|
|
},
|
|
_get_js_data: function(c, a) {
|
|
return c[this.columnIds[a]]
|
|
},
|
|
_process_csv_row: function(c, g) {
|
|
c._attrs = {};
|
|
for (var a = 0; a < c.childNodes.length; a++) {
|
|
c.childNodes[a]._attrs = {}
|
|
}
|
|
this._fillRow(c, (this._c_order ? this._swapColumns(g.split(this.csv.cell)) : g.split(this.csv.cell)));
|
|
return c
|
|
},
|
|
_get_csv_data: function(c, a) {
|
|
return c.split(this.csv.cell)[a]
|
|
},
|
|
_process_store_row: function(l, h) {
|
|
var a = [];
|
|
for (var g = 0; g < this.columnIds.length; g++) {
|
|
a[g] = h[this.columnIds[g]]
|
|
}
|
|
for (var c = 0; c < l.childNodes.length; c++) {
|
|
l.childNodes[c]._attrs = {}
|
|
}
|
|
l._attrs = h;
|
|
this._fillRow(l, a)
|
|
},
|
|
_process_xml_row: function(a, m) {
|
|
var u = this.xmlLoader.doXPath(this.xml.cell, m);
|
|
var q = [];
|
|
a._attrs = this._xml_attrs(m);
|
|
if (this._ud_enabled) {
|
|
var s = this.xmlLoader.doXPath("./userdata", m);
|
|
for (var l = s.length - 1; l >= 0; l--) {
|
|
var o = "";
|
|
for (var g = 0; g < s[l].childNodes.length; g++) {
|
|
o += s[l].childNodes[g].nodeValue
|
|
}
|
|
this.setUserData(a.idd, s[l].getAttribute("name"), o)
|
|
}
|
|
}
|
|
for (var g = 0; g < u.length; g++) {
|
|
var h = u[this._c_order ? this._c_order[g] : g];
|
|
if (!h) {
|
|
continue
|
|
}
|
|
var c = a._childIndexes ? a._childIndexes[g] : g;
|
|
var n = h.getAttribute("type");
|
|
if (a.childNodes[c]) {
|
|
if (n) {
|
|
a.childNodes[c]._cellType = n
|
|
}
|
|
a.childNodes[c]._attrs = this._xml_attrs(h)
|
|
}
|
|
if (!h.getAttribute("xmlcontent")) {
|
|
if (h.firstChild) {
|
|
h = h.firstChild.data
|
|
} else {
|
|
h = ""
|
|
}
|
|
}
|
|
q.push(h)
|
|
}
|
|
for (g < u.length; g < a.childNodes.length; g++) {
|
|
a.childNodes[g]._attrs = {}
|
|
}
|
|
if (a.parentNode && a.parentNode.tagName == "row") {
|
|
a._attrs.parent = a.parentNode.getAttribute("idd")
|
|
}
|
|
this._fillRow(a, q);
|
|
return a
|
|
},
|
|
_get_xml_data: function(c, a) {
|
|
c = c.firstChild;
|
|
while (true) {
|
|
if (!c) {
|
|
return ""
|
|
}
|
|
if (c.tagName == "cell") {
|
|
a--
|
|
}
|
|
if (a < 0) {
|
|
break
|
|
}
|
|
c = c.nextSibling
|
|
}
|
|
return (c.firstChild ? c.firstChild.data : "")
|
|
},
|
|
_fillRow: function(h, m) {
|
|
if (this.editor) {
|
|
this.editStop()
|
|
}
|
|
for (var c = 0; c < h.childNodes.length; c++) {
|
|
if ((c < m.length) || (this.defVal[c])) {
|
|
var g = h.childNodes[c]._cellIndex;
|
|
var l = m[g];
|
|
var a = this.cells4(h.childNodes[c]);
|
|
if ((this.defVal[g]) && ((l == "") || (typeof(l) == "undefined"))) {
|
|
l = this.defVal[g]
|
|
}
|
|
if (a) {
|
|
a.setValue(l)
|
|
}
|
|
} else {
|
|
h.childNodes[c].innerHTML = " ";
|
|
h.childNodes[c]._clearCell = true
|
|
}
|
|
}
|
|
return h
|
|
},
|
|
_postRowProcessing: function(m, o) {
|
|
if (m._attrs["class"]) {
|
|
m._css = m.className = m._attrs["class"]
|
|
}
|
|
if (m._attrs.locked) {
|
|
m._locked = true
|
|
}
|
|
if (m._attrs.bgColor) {
|
|
m.bgColor = m._attrs.bgColor
|
|
}
|
|
var n = 0;
|
|
for (var g = 0; g < m.childNodes.length; g++) {
|
|
var q = m.childNodes[g];
|
|
var l = q._cellIndex;
|
|
var h = q._attrs.style || m._attrs.style;
|
|
if (h) {
|
|
q.style.cssText += ";" + h
|
|
}
|
|
if (q._attrs["class"]) {
|
|
q.className = q._attrs["class"]
|
|
}
|
|
h = q._attrs.align || this.cellAlign[l];
|
|
if (h) {
|
|
q.align = h
|
|
}
|
|
q.vAlign = q._attrs.valign || this.cellVAlign[l];
|
|
var a = q._attrs.bgColor || this.columnColor[l];
|
|
if (a) {
|
|
q.bgColor = a
|
|
}
|
|
if (q._attrs.colspan && !o) {
|
|
this.setColspan(m.idd, g + n, q._attrs.colspan);
|
|
n += (q._attrs.colspan - 1)
|
|
}
|
|
if (this._hrrar && this._hrrar[l] && !o) {
|
|
q.style.display = "none"
|
|
}
|
|
}
|
|
this.callEvent("onRowCreated", [m.idd, m, null])
|
|
},
|
|
load: function(a, g, c) {
|
|
this.callEvent("onXLS", [this]);
|
|
if (arguments.length == 2 && typeof g != "function") {
|
|
c = g;
|
|
g = null
|
|
}
|
|
c = c || "xml";
|
|
if (!this.xmlFileUrl) {
|
|
this.xmlFileUrl = a
|
|
}
|
|
this._data_type = c;
|
|
this.xmlLoader = new dtmlXMLLoaderObject(this.doLoadDetails, this, true, this.no_cashe);
|
|
this.xmlLoader.onloadAction = function(m, h, o, n, l) {
|
|
if (!m.callEvent) {
|
|
return
|
|
}
|
|
l = m["_process_" + c](l);
|
|
if (!m._contextCallTimer) {
|
|
m.callEvent("onXLE", [m, 0, 0, l])
|
|
}
|
|
if (g) {
|
|
g();
|
|
g = null
|
|
}
|
|
};
|
|
this.xmlLoader.loadXML(a)
|
|
},
|
|
loadXMLString: function(g, c) {
|
|
var a = new dtmlXMLLoaderObject(function() {});
|
|
a.loadXMLString(g);
|
|
this.parse(a, c, "xml")
|
|
},
|
|
loadXML: function(a, c) {
|
|
this.load(a, c, "xml")
|
|
},
|
|
parse: function(g, c, a) {
|
|
if (arguments.length == 2 && typeof c != "function") {
|
|
a = c;
|
|
c = null
|
|
}
|
|
a = a || "xml";
|
|
this._data_type = a;
|
|
g = this["_process_" + a](g);
|
|
if (!this._contextCallTimer) {
|
|
this.callEvent("onXLE", [this, 0, 0, g])
|
|
}
|
|
if (c) {
|
|
c()
|
|
}
|
|
},
|
|
xml: {
|
|
top: "rows",
|
|
row: "./row",
|
|
cell: "./cell",
|
|
s_row: "row",
|
|
s_cell: "cell",
|
|
row_attrs: [],
|
|
cell_attrs: []
|
|
},
|
|
csv: {
|
|
row: "\n",
|
|
cell: ","
|
|
},
|
|
_xml_attrs: function(c) {
|
|
var g = {};
|
|
if (c.attributes.length) {
|
|
for (var a = 0; a < c.attributes.length; a++) {
|
|
g[c.attributes[a].name] = c.attributes[a].value
|
|
}
|
|
}
|
|
return g
|
|
},
|
|
_process_xml: function(l) {
|
|
if (!l.doXPath) {
|
|
var s = new dtmlXMLLoaderObject(function() {});
|
|
if (typeof l == "string") {
|
|
s.loadXMLString(l)
|
|
} else {
|
|
if (l.responseXML) {
|
|
s.xmlDoc = l
|
|
} else {
|
|
s.xmlDoc = {}
|
|
}
|
|
s.xmlDoc.responseXML = l
|
|
}
|
|
l = s
|
|
}
|
|
if (this._refresh_mode) {
|
|
return this._refreshFromXML(l)
|
|
}
|
|
this._parsing = true;
|
|
var o = l.getXMLTopNode(this.xml.top);
|
|
if (o.tagName != this.xml.top) {
|
|
return
|
|
}
|
|
var r = o.getAttribute("dhx_security");
|
|
if (r) {
|
|
dhtmlx.security_key = r
|
|
}
|
|
this._parseHead(o);
|
|
var u = l.doXPath(this.xml.row, o);
|
|
var n = parseInt(l.doXPath("//" + this.xml.top)[0].getAttribute("pos") || 0);
|
|
var q = parseInt(l.doXPath("//" + this.xml.top)[0].getAttribute("total_count") || 0);
|
|
var q = Math.min(q, 32000000 / this._srdh);
|
|
var m = false;
|
|
if (q && q != this.rowsBuffer.length) {
|
|
if (!this.rowsBuffer[q - 1]) {
|
|
if (this.rowsBuffer.length) {
|
|
m = true
|
|
}
|
|
this.rowsBuffer[q - 1] = null
|
|
}
|
|
if (q < this.rowsBuffer.length) {
|
|
this.rowsBuffer.splice(q, this.rowsBuffer.length - q);
|
|
m = true
|
|
}
|
|
}
|
|
if (this.isTreeGrid()) {
|
|
return this._process_tree_xml(l)
|
|
}
|
|
for (var c = 0; c < u.length; c++) {
|
|
if (this.rowsBuffer[c + n]) {
|
|
continue
|
|
}
|
|
var a = u[c].getAttribute("id") || (c + n + 1);
|
|
this.rowsBuffer[c + n] = {
|
|
idd: a,
|
|
data: u[c],
|
|
_parser: this._process_xml_row,
|
|
_locator: this._get_xml_data
|
|
};
|
|
this.rowsAr[a] = u[c]
|
|
}
|
|
this.callEvent("onDataReady", []);
|
|
if (m && this._srnd) {
|
|
var g = this.objBox.scrollTop;
|
|
this._reset_view();
|
|
this.objBox.scrollTop = g
|
|
} else {
|
|
this.render_dataset()
|
|
}
|
|
this._parsing = false;
|
|
return l.xmlDoc.responseXML ? l.xmlDoc.responseXML : l.xmlDoc
|
|
},
|
|
_process_jsarray: function(data) {
|
|
this._parsing = true;
|
|
if (data && data.xmlDoc) {
|
|
eval("dhtmlx.temp=" + data.xmlDoc.responseText + ";");
|
|
data = dhtmlx.temp
|
|
}
|
|
for (var i = 0; i < data.length; i++) {
|
|
var id = i + 1;
|
|
this.rowsBuffer.push({
|
|
idd: id,
|
|
data: data[i],
|
|
_parser: this._process_jsarray_row,
|
|
_locator: this._get_jsarray_data
|
|
});
|
|
this.rowsAr[id] = data[i]
|
|
}
|
|
this.render_dataset();
|
|
this._parsing = false
|
|
},
|
|
_process_csv: function(h) {
|
|
this._parsing = true;
|
|
if (h.xmlDoc) {
|
|
h = h.xmlDoc.responseText
|
|
}
|
|
h = h.replace(/\r/g, "");
|
|
h = h.split(this.csv.row);
|
|
if (this._csvHdr) {
|
|
this.clearAll();
|
|
var g = h.splice(0, 1)[0].split(this.csv.cell);
|
|
if (!this._csvAID) {
|
|
g.splice(0, 1)
|
|
}
|
|
this.setHeader(g.join(this.delim));
|
|
this.init()
|
|
}
|
|
for (var c = 0; c < h.length; c++) {
|
|
if (!h[c] && c == h.length - 1) {
|
|
continue
|
|
}
|
|
if (this._csvAID) {
|
|
var l = c + 1;
|
|
this.rowsBuffer.push({
|
|
idd: l,
|
|
data: h[c],
|
|
_parser: this._process_csv_row,
|
|
_locator: this._get_csv_data
|
|
})
|
|
} else {
|
|
var a = h[c].split(this.csv.cell);
|
|
var l = a.splice(0, 1)[0];
|
|
this.rowsBuffer.push({
|
|
idd: l,
|
|
data: a,
|
|
_parser: this._process_jsarray_row,
|
|
_locator: this._get_jsarray_data
|
|
})
|
|
}
|
|
this.rowsAr[l] = h[c]
|
|
}
|
|
this.render_dataset();
|
|
this._parsing = false
|
|
},
|
|
_process_js: function(a) {
|
|
return this._process_json(a, "js")
|
|
},
|
|
_process_json: function(data, mode) {
|
|
this._parsing = true;
|
|
if (data && data.xmlDoc) {
|
|
eval("dhtmlx.temp=" + data.xmlDoc.responseText + ";");
|
|
data = dhtmlx.temp
|
|
}
|
|
if (mode == "js") {
|
|
if (data.data) {
|
|
data = data.data
|
|
}
|
|
for (var i = 0; i < data.length; i++) {
|
|
var row = data[i];
|
|
var id = row.id || (i + 1);
|
|
this.rowsBuffer.push({
|
|
idd: id,
|
|
data: row,
|
|
_parser: this._process_js_row,
|
|
_locator: this._get_js_data
|
|
});
|
|
this.rowsAr[id] = data[i]
|
|
}
|
|
} else {
|
|
for (var i = 0; i < data.rows.length; i++) {
|
|
var id = data.rows[i].id;
|
|
this.rowsBuffer.push({
|
|
idd: id,
|
|
data: data.rows[i],
|
|
_parser: this._process_json_row,
|
|
_locator: this._get_json_data
|
|
});
|
|
this.rowsAr[id] = data.rows[i]
|
|
}
|
|
} if (data.dhx_security) {
|
|
dhtmlx.security_key = data.dhx_security
|
|
}
|
|
this.render_dataset();
|
|
this._parsing = false
|
|
},
|
|
render_dataset: function(h, a) {
|
|
if (this._srnd) {
|
|
if (this._fillers) {
|
|
return this._update_srnd_view()
|
|
}
|
|
a = Math.min((this._get_view_size() + (this._srnd_pr || 0)), this.rowsBuffer.length)
|
|
}
|
|
if (this.pagingOn) {
|
|
h = Math.max((h || 0), (this.currentPage - 1) * this.rowsBufferOutSize);
|
|
a = Math.min(this.currentPage * this.rowsBufferOutSize, this.rowsBuffer.length)
|
|
} else {
|
|
h = h || 0;
|
|
a = a || this.rowsBuffer.length
|
|
}
|
|
for (var g = h; g < a; g++) {
|
|
var m = this.render_row(g);
|
|
if (m == -1) {
|
|
if (this.xmlFileUrl) {
|
|
if (this.callEvent("onDynXLS", [g, (this._dpref ? this._dpref : (a - g))])) {
|
|
this.load(this.xmlFileUrl + getUrlSymbol(this.xmlFileUrl) + "posStart=" + g + "&count=" + (this._dpref ? this._dpref : (a - g)), this._data_type)
|
|
}
|
|
}
|
|
a = g;
|
|
break
|
|
}
|
|
if (!m.parentNode || !m.parentNode.tagName) {
|
|
this._insertRowAt(m, g);
|
|
if (m._attrs.selected || m._attrs.select) {
|
|
this.selectRow(m, m._attrs.call ? true : false, true);
|
|
m._attrs.selected = m._attrs.select = null
|
|
}
|
|
}
|
|
if (this._ads_count && g - h == this._ads_count) {
|
|
var l = this;
|
|
this._context_parsing = this._context_parsing || this._parsing;
|
|
return this._contextCallTimer = window.setTimeout(function() {
|
|
l._contextCallTimer = null;
|
|
l.render_dataset(g, a);
|
|
if (!l._contextCallTimer) {
|
|
if (l._context_parsing) {
|
|
l.callEvent("onXLE", [])
|
|
} else {
|
|
l._fixAlterCss()
|
|
}
|
|
l.callEvent("onDistributedEnd", []);
|
|
l._context_parsing = false
|
|
}
|
|
}, this._ads_time)
|
|
}
|
|
}
|
|
if (this._ads_count && g == a) {
|
|
this.callEvent("onDistributedEnd", [])
|
|
}
|
|
if (this._srnd && !this._fillers) {
|
|
var c = this.rowsBuffer.length - a;
|
|
this._fillers = [];
|
|
if (this._fake) {
|
|
this._fake._fillers = []
|
|
}
|
|
while (c > 0) {
|
|
var o = (_isIE || window._FFrv) ? Math.min(c, 50000) : c;
|
|
var n = this._add_filler(a, o);
|
|
if (n) {
|
|
this._fillers.push(n)
|
|
}
|
|
c -= o;
|
|
a += o
|
|
}
|
|
}
|
|
this.setSizes()
|
|
},
|
|
render_row: function(c) {
|
|
if (!this.rowsBuffer[c]) {
|
|
return -1
|
|
}
|
|
if (this.rowsBuffer[c]._parser) {
|
|
var a = this.rowsBuffer[c];
|
|
if (this.rowsAr[a.idd] && this.rowsAr[a.idd].tagName == "TR") {
|
|
return this.rowsBuffer[c] = this.rowsAr[a.idd]
|
|
}
|
|
var g = this._prepareRow(a.idd);
|
|
this.rowsBuffer[c] = g;
|
|
this.rowsAr[a.idd] = g;
|
|
a._parser.call(this, g, a.data);
|
|
this._postRowProcessing(g);
|
|
return g
|
|
}
|
|
return this.rowsBuffer[c]
|
|
},
|
|
_get_cell_value: function(c, a, g) {
|
|
if (c._locator) {
|
|
if (this._c_order) {
|
|
a = this._c_order[a]
|
|
}
|
|
return c._locator.call(this, c.data, a)
|
|
}
|
|
return this.cells3(c, a)[g ? g : "getValue"]()
|
|
},
|
|
sortRows: function(g, m, c) {
|
|
this.editStop();
|
|
c = (c || "asc").toLowerCase();
|
|
m = (m || this.fldSort[g]);
|
|
g = g || 0;
|
|
if (this.isTreeGrid()) {
|
|
this.sortTreeRows(g, m, c)
|
|
} else {
|
|
var a = {};
|
|
var l = this.cellType[g];
|
|
var n = "getValue";
|
|
if (l == "link") {
|
|
n = "getContent"
|
|
}
|
|
if (l == "dhxCalendar" || l == "dhxCalendarA") {
|
|
n = "getDate"
|
|
}
|
|
for (var h = 0; h < this.rowsBuffer.length; h++) {
|
|
a[this.rowsBuffer[h].idd] = this._get_cell_value(this.rowsBuffer[h], g, n)
|
|
}
|
|
this._sortRows(g, m, c, a)
|
|
}
|
|
this.callEvent("onAfterSorting", [g, m, c])
|
|
},
|
|
_sortCore: function(g, m, c, a, l) {
|
|
var h = "sort";
|
|
if (this._sst) {
|
|
l.stablesort = this.rowsCol.stablesort;
|
|
h = "stablesort"
|
|
}
|
|
if (m.length > 4) {
|
|
m = window[m]
|
|
}
|
|
if (m == "cus") {
|
|
var n = this._customSorts[g];
|
|
l[h](function(q, o) {
|
|
return n(a[q.idd], a[o.idd], c, q.idd, o.idd)
|
|
})
|
|
} else {
|
|
if (typeof(m) == "function") {
|
|
l[h](function(q, o) {
|
|
return m(a[q.idd], a[o.idd], c, q.idd, o.idd)
|
|
})
|
|
} else {
|
|
if (m == "str") {
|
|
l[h](function(q, o) {
|
|
if (c == "asc") {
|
|
return a[q.idd] > a[o.idd] ? 1 : (a[q.idd] < a[o.idd] ? -1 : 0)
|
|
} else {
|
|
return a[q.idd] < a[o.idd] ? 1 : (a[q.idd] > a[o.idd] ? -1 : 0)
|
|
}
|
|
})
|
|
} else {
|
|
if (m == "int") {
|
|
l[h](function(r, q) {
|
|
var o = parseFloat(a[r.idd]);
|
|
o = isNaN(o) ? -99999999999999 : o;
|
|
var s = parseFloat(a[q.idd]);
|
|
s = isNaN(s) ? -99999999999999 : s;
|
|
if (c == "asc") {
|
|
return o - s
|
|
} else {
|
|
return s - o
|
|
}
|
|
})
|
|
} else {
|
|
if (m == "date") {
|
|
l[h](function(r, q) {
|
|
var o = Date.parse(a[r.idd]) || (Date.parse("01/01/1900"));
|
|
var s = Date.parse(a[q.idd]) || (Date.parse("01/01/1900"));
|
|
if (c == "asc") {
|
|
return o - s
|
|
} else {
|
|
return s - o
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
_sortRows: function(g, h, c, a) {
|
|
this._sortCore(g, h, c, a, this.rowsBuffer);
|
|
this._reset_view();
|
|
this.callEvent("onGridReconstructed", [])
|
|
},
|
|
_reset_view: function(g) {
|
|
if (!this.obj.rows[0]) {
|
|
return
|
|
}
|
|
if (this._lahRw) {
|
|
this._unsetRowHover(0, true)
|
|
}
|
|
this.callEvent("onResetView", []);
|
|
var a = this.obj.rows[0].parentNode;
|
|
var h = a.removeChild(a.childNodes[0], true);
|
|
if (_isKHTML) {
|
|
for (var c = a.parentNode.childNodes.length - 1; c >= 0; c--) {
|
|
if (a.parentNode.childNodes[c].tagName == "TR") {
|
|
a.parentNode.removeChild(a.parentNode.childNodes[c], true)
|
|
}
|
|
}
|
|
} else {
|
|
if (_isIE) {
|
|
for (var c = a.childNodes.length - 1; c >= 0; c--) {
|
|
a.childNodes[c].removeNode(true)
|
|
}
|
|
} else {
|
|
a.innerHTML = ""
|
|
}
|
|
}
|
|
a.appendChild(h);
|
|
this.rowsCol = dhtmlxArray();
|
|
if (this._sst) {
|
|
this.enableStableSorting(true)
|
|
}
|
|
this._fillers = this.undefined;
|
|
if (!g) {
|
|
if (_isIE && this._srnd) {
|
|
this.render_dataset()
|
|
} else {
|
|
this.render_dataset()
|
|
}
|
|
}
|
|
},
|
|
deleteRow: function(c, h) {
|
|
if (!h) {
|
|
h = this.getRowById(c)
|
|
}
|
|
if (!h) {
|
|
return
|
|
}
|
|
this.editStop();
|
|
if (!this._realfake) {
|
|
if (this.callEvent("onBeforeRowDeleted", [c]) == false) {
|
|
return false
|
|
}
|
|
}
|
|
var a = 0;
|
|
if (this.cellType._dhx_find("tree") != -1 && !this._realfake) {
|
|
a = this._h2.get[c].parent.id;
|
|
this._removeTrGrRow(h)
|
|
} else {
|
|
if (h.parentNode) {
|
|
h.parentNode.removeChild(h)
|
|
}
|
|
var m = this.rowsCol._dhx_find(h);
|
|
if (m != -1) {
|
|
this.rowsCol._dhx_removeAt(m)
|
|
}
|
|
for (var g = 0; g < this.rowsBuffer.length; g++) {
|
|
if (this.rowsBuffer[g] && this.rowsBuffer[g].idd == c) {
|
|
this.rowsBuffer._dhx_removeAt(g);
|
|
m = g;
|
|
break
|
|
}
|
|
}
|
|
}
|
|
this.rowsAr[c] = null;
|
|
for (var g = 0; g < this.selectedRows.length; g++) {
|
|
if (this.selectedRows[g].idd == c) {
|
|
this.selectedRows._dhx_removeAt(g)
|
|
}
|
|
}
|
|
if (this._srnd) {
|
|
for (var g = 0; g < this._fillers.length; g++) {
|
|
var l = this._fillers[g];
|
|
if (!l) {
|
|
continue
|
|
}
|
|
if (l[0] >= m) {
|
|
this._update_fillers(g, 0, -1)
|
|
} else {
|
|
if (l[0] + l[1] > m) {
|
|
this._update_fillers(g, -1, 0)
|
|
}
|
|
}
|
|
}
|
|
this._update_srnd_view()
|
|
}
|
|
if (this.pagingOn) {
|
|
this.changePage()
|
|
}
|
|
if (!this._realfake) {
|
|
this.callEvent("onAfterRowDeleted", [c, a])
|
|
}
|
|
this.callEvent("onGridReconstructed", []);
|
|
if (this._ahgr) {
|
|
this.setSizes()
|
|
}
|
|
return true
|
|
},
|
|
_addRow: function(m, n, c) {
|
|
if (c == -1 || typeof c == "undefined") {
|
|
c = this.rowsBuffer.length
|
|
}
|
|
if (typeof n == "string") {
|
|
n = n.split(this.delim)
|
|
}
|
|
var o = this._prepareRow(m);
|
|
o._attrs = {};
|
|
for (var g = 0; g < o.childNodes.length; g++) {
|
|
o.childNodes[g]._attrs = {}
|
|
}
|
|
this.rowsAr[o.idd] = o;
|
|
if (this._h2) {
|
|
this._h2.get[o.idd].buff = o
|
|
}
|
|
this._fillRow(o, n);
|
|
this._postRowProcessing(o);
|
|
if (this._skipInsert) {
|
|
this._skipInsert = false;
|
|
return this.rowsAr[o.idd] = o
|
|
}
|
|
if (this.pagingOn) {
|
|
this.rowsBuffer._dhx_insertAt(c, o);
|
|
this.rowsAr[o.idd] = o;
|
|
return o
|
|
}
|
|
if (this._fillers) {
|
|
this.rowsCol._dhx_insertAt(c, null);
|
|
this.rowsBuffer._dhx_insertAt(c, o);
|
|
if (this._fake) {
|
|
this._fake.rowsCol._dhx_insertAt(c, null)
|
|
}
|
|
this.rowsAr[o.idd] = o;
|
|
var q = false;
|
|
for (var h = 0; h < this._fillers.length; h++) {
|
|
var l = this._fillers[h];
|
|
if (l && l[0] <= c && (l[0] + l[1]) >= c) {
|
|
l[1] = l[1] + 1;
|
|
var a = l[2].firstChild.style.height = parseInt(l[2].firstChild.style.height) + this._srdh + "px";
|
|
q = true;
|
|
if (this._fake) {
|
|
this._fake._fillers[h][1]++;
|
|
this._fake._fillers[h][2].firstChild.style.height = a
|
|
}
|
|
}
|
|
if (l && l[0] > c) {
|
|
l[0] = l[0] + 1;
|
|
if (this._fake) {
|
|
this._fake._fillers[h][0]++
|
|
}
|
|
}
|
|
}
|
|
if (!q) {
|
|
this._fillers.push(this._add_filler(c, 1, (c == 0 ? {
|
|
parentNode: this.obj.rows[0].parentNode,
|
|
nextSibling: (this.rowsCol[1])
|
|
} : this.rowsCol[c - 1])))
|
|
}
|
|
return o
|
|
}
|
|
this.rowsBuffer._dhx_insertAt(c, o);
|
|
return this._insertRowAt(o, c)
|
|
},
|
|
addRow: function(a, h, g) {
|
|
var c = this._addRow(a, h, g);
|
|
if (!this.dragContext) {
|
|
this.callEvent("onRowAdded", [a])
|
|
}
|
|
if (this.pagingOn) {
|
|
this.changePage(this.currentPage)
|
|
}
|
|
if (this._srnd) {
|
|
this._update_srnd_view()
|
|
}
|
|
c._added = true;
|
|
if (this._ahgr) {
|
|
this.setSizes()
|
|
}
|
|
this.callEvent("onGridReconstructed", []);
|
|
return c
|
|
},
|
|
_insertRowAt: function(g, h, c) {
|
|
this.rowsAr[g.idd] = g;
|
|
if (this._skipInsert) {
|
|
this._skipInsert = false;
|
|
return g
|
|
}
|
|
if ((h < 0) || ((!h) && (parseInt(h) !== 0))) {
|
|
h = this.rowsCol.length
|
|
} else {
|
|
if (h > this.rowsCol.length) {
|
|
h = this.rowsCol.length
|
|
}
|
|
} if (this._cssEven) {
|
|
var a = g.className.replace(this._cssUnEven, "");
|
|
if ((this._cssSP ? this.getLevel(g.idd) : h) % 2 == 1) {
|
|
g.className = a + " " + this._cssUnEven + (this._cssSU ? (" " + this._cssUnEven + "_" + this.getLevel(g.idd)) : "")
|
|
} else {
|
|
g.className = a + " " + this._cssEven + (this._cssSU ? (" " + this._cssEven + "_" + this.getLevel(g.idd)) : "")
|
|
}
|
|
}
|
|
if (!c) {
|
|
if ((h == (this.obj.rows.length - 1)) || (!this.rowsCol[h])) {
|
|
if (_isKHTML) {
|
|
this.obj.appendChild(g)
|
|
} else {
|
|
this.obj.firstChild.appendChild(g)
|
|
}
|
|
} else {
|
|
this.rowsCol[h].parentNode.insertBefore(g, this.rowsCol[h])
|
|
}
|
|
}
|
|
this.rowsCol._dhx_insertAt(h, g);
|
|
this.callEvent("onRowInserted", [g, h]);
|
|
return g
|
|
},
|
|
getRowById: function(g) {
|
|
var c = this.rowsAr[g];
|
|
if (c) {
|
|
if (c.tagName != "TR") {
|
|
for (var a = 0; a < this.rowsBuffer.length; a++) {
|
|
if (this.rowsBuffer[a] && this.rowsBuffer[a].idd == g) {
|
|
return this.render_row(a)
|
|
}
|
|
}
|
|
if (this._h2) {
|
|
return this.render_row(null, c.idd)
|
|
}
|
|
}
|
|
return c
|
|
}
|
|
return null
|
|
},
|
|
cellById: function(c, a) {
|
|
return this.cells(c, a)
|
|
},
|
|
cells: function(h, g) {
|
|
if (arguments.length == 0) {
|
|
return this.cells4(this.cell)
|
|
} else {
|
|
var l = this.getRowById(h)
|
|
}
|
|
var a = (l._childIndexes ? l.childNodes[l._childIndexes[g]] : l.childNodes[g]);
|
|
if (!a && l._childIndexes) {
|
|
a = l.firstChild || {}
|
|
}
|
|
return this.cells4(a)
|
|
},
|
|
cellByIndex: function(c, a) {
|
|
return this.cells2(c, a)
|
|
},
|
|
cells2: function(h, g) {
|
|
var l = this.render_row(h);
|
|
var a = (l._childIndexes ? l.childNodes[l._childIndexes[g]] : l.childNodes[g]);
|
|
if (!a && l._childIndexes) {
|
|
a = l.firstChild || {}
|
|
}
|
|
return this.cells4(a)
|
|
},
|
|
cells3: function(g, c) {
|
|
var a = (g._childIndexes ? g.childNodes[g._childIndexes[c]] : g.childNodes[c]);
|
|
return this.cells4(a)
|
|
},
|
|
cells4: function(a) {
|
|
var c = window["eXcell_" + (a._cellType || this.cellType[a._cellIndex])];
|
|
if (c) {
|
|
return new c(a)
|
|
}
|
|
},
|
|
cells5: function(a, g) {
|
|
var g = g || (a._cellType || this.cellType[a._cellIndex]);
|
|
if (!this._ecache[g]) {
|
|
if (!window["eXcell_" + g]) {
|
|
var c = eXcell_ro
|
|
} else {
|
|
var c = window["eXcell_" + g]
|
|
}
|
|
this._ecache[g] = new c(a)
|
|
}
|
|
this._ecache[g].cell = a;
|
|
return this._ecache[g]
|
|
},
|
|
dma: function(a) {
|
|
if (!this._ecache) {
|
|
this._ecache = {}
|
|
}
|
|
if (a && !this._dma) {
|
|
this._dma = this.cells4;
|
|
this.cells4 = this.cells5
|
|
} else {
|
|
if (!a && this._dma) {
|
|
this.cells4 = this._dma;
|
|
this._dma = null
|
|
}
|
|
}
|
|
},
|
|
getRowsNum: function() {
|
|
return this.rowsBuffer.length
|
|
},
|
|
enableEditTabOnly: function(a) {
|
|
if (arguments.length > 0) {
|
|
this.smartTabOrder = convertStringToBoolean(a)
|
|
} else {
|
|
this.smartTabOrder = true
|
|
}
|
|
},
|
|
setExternalTabOrder: function(l, a) {
|
|
var c = this;
|
|
this.tabStart = (typeof(l) == "object") ? l : document.getElementById(l);
|
|
var g = this.tabStart.onkeydown;
|
|
this.tabStart.onkeydown = function(n) {
|
|
if (g) {
|
|
g.call(this, n)
|
|
}
|
|
var m = (n || window.event);
|
|
if (m.keyCode == 9 && !m.shiftKey) {
|
|
m.cancelBubble = true;
|
|
c.selectCell(0, 0, 0, 0, 1);
|
|
if (c.smartTabOrder && c.cells2(0, 0).isDisabled()) {
|
|
c._key_events.k9_0_0.call(c)
|
|
}
|
|
this.blur();
|
|
return false
|
|
}
|
|
};
|
|
if (_isOpera) {
|
|
this.tabStart.onkeypress = this.tabStart.onkeydown
|
|
}
|
|
this.tabEnd = (typeof(a) == "object") ? a : document.getElementById(a);
|
|
var h = this.tabEnd.onkeydown;
|
|
this.tabEnd.onkeydown = this.tabEnd.onkeypress = function(n) {
|
|
if (h) {
|
|
h.call(this, n)
|
|
}
|
|
var m = (n || window.event);
|
|
if (m.keyCode == 9 && m.shiftKey) {
|
|
m.cancelBubble = true;
|
|
c.selectCell((c.getRowsNum() - 1), (c.getColumnCount() - 1), 0, 0, 1);
|
|
if (c.smartTabOrder && c.cells2((c.getRowsNum() - 1), (c.getColumnCount() - 1)).isDisabled()) {
|
|
c._key_events.k9_0_1.call(c)
|
|
}
|
|
this.blur();
|
|
return false
|
|
}
|
|
};
|
|
if (_isOpera) {
|
|
this.tabEnd.onkeypress = this.tabEnd.onkeydown
|
|
}
|
|
},
|
|
uid: function() {
|
|
if (!this._ui_seed) {
|
|
this._ui_seed = (new Date()).valueOf()
|
|
}
|
|
return this._ui_seed++
|
|
},
|
|
clearAndLoad: function() {
|
|
var a = this._pgn_skin;
|
|
this._pgn_skin = null;
|
|
this.clearAll();
|
|
this._pgn_skin = a;
|
|
this.load.apply(this, arguments)
|
|
},
|
|
getStateOfView: function() {
|
|
if (this.pagingOn) {
|
|
var a = (this.currentPage - 1) * this.rowsBufferOutSize;
|
|
return [this.currentPage, a, Math.min(a + this.rowsBufferOutSize, this.rowsBuffer.length), this.rowsBuffer.length]
|
|
}
|
|
return [Math.floor(this.objBox.scrollTop / this._srdh), Math.ceil(parseInt(this.objBox.offsetHeight) / this._srdh), this.rowsBuffer.length]
|
|
}
|
|
};
|
|
(function() {
|
|
function h(n, o) {
|
|
this[n] = o
|
|
}
|
|
|
|
function m(n, o) {
|
|
this[n].call(this, o)
|
|
}
|
|
|
|
function g(n, o) {
|
|
this[n].call(this, o.join(this.delim))
|
|
}
|
|
|
|
function a(n, r) {
|
|
for (var q = 0; q < r.length; q++) {
|
|
if (typeof r[q] == "object") {
|
|
var s = this.getCombo(q);
|
|
for (var o in r[q]) {
|
|
s.put(o, r[q][o])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function l(n, w, r) {
|
|
var y = 1;
|
|
var v = [];
|
|
|
|
function x(C, A, D) {
|
|
if (!v[A]) {
|
|
v[A] = []
|
|
}
|
|
if (typeof D == "object") {
|
|
D.toString = function() {
|
|
return this.text
|
|
}
|
|
}
|
|
v[A][C] = D
|
|
}
|
|
for (var s = 0; s < w.length; s++) {
|
|
if (typeof(w[s]) == "object" && w[s].length) {
|
|
for (var q = 0; q < w[s].length; q++) {
|
|
x(s, q, w[s][q])
|
|
}
|
|
} else {
|
|
x(s, 0, w[s])
|
|
}
|
|
}
|
|
for (var s = 0; s < v.length; s++) {
|
|
for (var q = 0; q < v[0].length; q++) {
|
|
var u = v[s][q];
|
|
v[s][q] = (u || "").toString() || " ";
|
|
if (u && u.colspan) {
|
|
for (var o = 1; o < u.colspan; o++) {
|
|
x(q + o, s, "#cspan")
|
|
}
|
|
}
|
|
if (u && u.rowspan) {
|
|
for (var o = 1; o < u.rowspan; o++) {
|
|
x(q, s + o, "#rspan")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.setHeader(v[0]);
|
|
for (var s = 1; s < v.length; s++) {
|
|
this.attachHeader(v[s])
|
|
}
|
|
}
|
|
var c = [{
|
|
name: "label",
|
|
def: " ",
|
|
operation: "setHeader",
|
|
type: l
|
|
}, {
|
|
name: "id",
|
|
def: "",
|
|
operation: "columnIds",
|
|
type: h
|
|
}, {
|
|
name: "width",
|
|
def: "*",
|
|
operation: "setInitWidths",
|
|
type: g
|
|
}, {
|
|
name: "align",
|
|
def: "left",
|
|
operation: "cellAlign",
|
|
type: h
|
|
}, {
|
|
name: "valign",
|
|
def: "middle",
|
|
operation: "cellVAlign",
|
|
type: h
|
|
}, {
|
|
name: "sort",
|
|
def: "na",
|
|
operation: "fldSort",
|
|
type: h
|
|
}, {
|
|
name: "type",
|
|
def: "ro",
|
|
operation: "setColTypes",
|
|
type: g
|
|
}, {
|
|
name: "options",
|
|
def: "",
|
|
operation: "",
|
|
type: a
|
|
}];
|
|
dhtmlx.extend_api("dhtmlXGridObject", {
|
|
_init: function(n) {
|
|
return [n.parent]
|
|
},
|
|
image_path: "setImagePath",
|
|
columns: "columns",
|
|
rows: "rows",
|
|
headers: "headers",
|
|
skin: "setSkin",
|
|
smart_rendering: "enableSmartRendering",
|
|
css: "enableAlterCss",
|
|
auto_height: "enableAutoHeight",
|
|
save_hidden: "enableAutoHiddenColumnsSaving",
|
|
save_cookie: "enableAutoSaving",
|
|
save_size: "enableAutoSizeSaving",
|
|
auto_width: "enableAutoWidth",
|
|
block_selection: "enableBlockSelection",
|
|
csv_id: "enableCSVAutoID",
|
|
csv_header: "enableCSVHeader",
|
|
cell_ids: "enableCellIds",
|
|
colspan: "enableColSpan",
|
|
column_move: "enableColumnMove",
|
|
context_menu: "enableContextMenu",
|
|
distributed: "enableDistributedParsing",
|
|
drag: "enableDragAndDrop",
|
|
drag_order: "enableDragOrder",
|
|
tabulation: "enableEditTabOnly",
|
|
header_images: "enableHeaderImages",
|
|
header_menu: "enableHeaderMenu",
|
|
keymap: "enableKeyboardSupport",
|
|
mouse_navigation: "enableLightMouseNavigation",
|
|
markers: "enableMarkedCells",
|
|
math_editing: "enableMathEditing",
|
|
math_serialization: "enableMathSerialization",
|
|
drag_copy: "enableMercyDrag",
|
|
multiline: "enableMultiline",
|
|
multiselect: "enableMultiselect",
|
|
save_column_order: "enableOrderSaving",
|
|
hover: "enableRowsHover",
|
|
rowspan: "enableRowspan",
|
|
smart: "enableSmartRendering",
|
|
save_sorting: "enableSortingSaving",
|
|
stable_sorting: "enableStableSorting",
|
|
undo: "enableUndoRedo",
|
|
csv_cell: "setCSVDelimiter",
|
|
date_format: "setDateFormat",
|
|
drag_behavior: "setDragBehavior",
|
|
editable: "setEditable",
|
|
without_header: "setNoHeader",
|
|
submit_changed: "submitOnlyChanged",
|
|
submit_serialization: "submitSerialization",
|
|
submit_selected: "submitOnlySelected",
|
|
submit_id: "submitOnlyRowID",
|
|
xml: "load"
|
|
}, {
|
|
columns: function(s) {
|
|
for (var n = 0; n < c.length; n++) {
|
|
var r = [];
|
|
for (var o = 0; o < s.length; o++) {
|
|
r[o] = s[o][c[n].name] || c[n].def
|
|
}
|
|
var q = c[n].type || m;
|
|
q.call(this, c[n].operation, r, s)
|
|
}
|
|
this.init()
|
|
},
|
|
rows: function(n) {},
|
|
headers: function(o) {
|
|
for (var n = 0; n < o.length; n++) {
|
|
this.attachHeader(o[n])
|
|
}
|
|
}
|
|
})
|
|
})();
|
|
dhtmlXGridObject.prototype._dp_init = function(a) {
|
|
a.attachEvent("insertCallback", function(c, h) {
|
|
if (this.obj._h2) {
|
|
this.obj.addRow(h, g, null, parent)
|
|
} else {
|
|
this.obj.addRow(h, [], 0)
|
|
}
|
|
var g = this.obj.getRowById(h);
|
|
if (g) {
|
|
this.obj._process_xml_row(g, c.firstChild);
|
|
this.obj._postRowProcessing(g)
|
|
}
|
|
});
|
|
a.attachEvent("updateCallback", function(c, h) {
|
|
var g = this.obj.getRowById(h);
|
|
if (g) {
|
|
this.obj._process_xml_row(g, c.firstChild);
|
|
this.obj._postRowProcessing(g)
|
|
}
|
|
});
|
|
a.attachEvent("deleteCallback", function(c, g) {
|
|
this.obj.setUserData(g, this.action_param, "true_deleted");
|
|
this.obj.deleteRow(g)
|
|
});
|
|
a._methods = ["setRowTextStyle", "setCellTextStyle", "changeRowId", "deleteRow"];
|
|
this.attachEvent("onEditCell", function(h, l, g) {
|
|
if (a._columns && !a._columns[g]) {
|
|
return true
|
|
}
|
|
var c = this.cells(l, g);
|
|
if (h == 1) {
|
|
if (c.isCheckbox()) {
|
|
a.setUpdated(l, true)
|
|
}
|
|
} else {
|
|
if (h == 2) {
|
|
if (c.wasChanged()) {
|
|
a.setUpdated(l, true)
|
|
}
|
|
}
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onRowPaste", function(c) {
|
|
a.setUpdated(c, true)
|
|
});
|
|
this.attachEvent("onUndo", function(c) {
|
|
a.setUpdated(c, true)
|
|
});
|
|
this.attachEvent("onRowIdChange", function(h, c) {
|
|
var g = a.findRow(h);
|
|
if (g < a.updatedRows.length) {
|
|
a.updatedRows[g] = c
|
|
}
|
|
});
|
|
this.attachEvent("onSelectStateChanged", function(c) {
|
|
if (a.updateMode == "row") {
|
|
a.sendData()
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onEnter", function(g, c) {
|
|
if (a.updateMode == "row") {
|
|
a.sendData()
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onBeforeRowDeleted", function(c) {
|
|
if (!this.rowsAr[c]) {
|
|
return true
|
|
}
|
|
if (this.dragContext && a.dnd) {
|
|
window.setTimeout(function() {
|
|
a.setUpdated(c, true)
|
|
}, 1);
|
|
return true
|
|
}
|
|
var g = a.getState(c);
|
|
if (this._h2) {
|
|
this._h2.forEachChild(c, function(h) {
|
|
a.setUpdated(h.id, false);
|
|
a.markRow(h.id, true, "deleted")
|
|
}, this)
|
|
}
|
|
if (g == "inserted") {
|
|
a.set_invalid(c, false);
|
|
a.setUpdated(c, false);
|
|
return true
|
|
}
|
|
if (g == "deleted") {
|
|
return false
|
|
}
|
|
if (g == "true_deleted") {
|
|
a.setUpdated(c, false);
|
|
return true
|
|
}
|
|
a.setUpdated(c, true, "deleted");
|
|
return false
|
|
});
|
|
this.attachEvent("onBindUpdate", function(c) {
|
|
if (typeof c == "object") {
|
|
c = c.id
|
|
}
|
|
a.setUpdated(c, true)
|
|
});
|
|
this.attachEvent("onRowAdded", function(c) {
|
|
if (this.dragContext && a.dnd) {
|
|
return true
|
|
}
|
|
a.setUpdated(c, true, "inserted");
|
|
return true
|
|
});
|
|
a._getRowData = function(h, u) {
|
|
var n = [];
|
|
n.gr_id = h;
|
|
if (this.obj.isTreeGrid()) {
|
|
n.gr_pid = this.obj.getParentId(h)
|
|
}
|
|
var g = this.obj.getRowById(h);
|
|
for (var o = 0; o < this.obj._cCount; o++) {
|
|
if (this.obj._c_order) {
|
|
var q = this.obj._c_order[o]
|
|
} else {
|
|
var q = o
|
|
}
|
|
var s = this.obj.cells(g.idd, o);
|
|
if (this._changed && !s.wasChanged()) {
|
|
continue
|
|
}
|
|
if (this._endnm) {
|
|
n[this.obj.getColumnId(o)] = s.getValue()
|
|
} else {
|
|
n["c" + q] = s.getValue()
|
|
}
|
|
}
|
|
var l = this.obj.UserData[h];
|
|
if (l) {
|
|
for (var m = 0; m < l.keys.length; m++) {
|
|
if (l.keys[m] && l.keys[m].indexOf("__") != 0) {
|
|
n[l.keys[m]] = l.values[m]
|
|
}
|
|
}
|
|
}
|
|
var l = this.obj.UserData.gridglobaluserdata;
|
|
if (l) {
|
|
for (var m = 0; m < l.keys.length; m++) {
|
|
n[l.keys[m]] = l.values[m]
|
|
}
|
|
}
|
|
return n
|
|
};
|
|
a._clearUpdateFlag = function(g) {
|
|
var h = this.obj.getRowById(g);
|
|
if (h) {
|
|
for (var c = 0; c < this.obj._cCount; c++) {
|
|
this.obj.cells(g, c).cell.wasChanged = false
|
|
}
|
|
}
|
|
};
|
|
a.checkBeforeUpdate = function(m) {
|
|
var l = true;
|
|
var c = [];
|
|
for (var h = 0; h < this.obj._cCount; h++) {
|
|
if (this.mandatoryFields[h]) {
|
|
var g = this.mandatoryFields[h].call(this.obj, this.obj.cells(m, h).getValue(), m, h);
|
|
if (typeof g == "string") {
|
|
this.messages.push(g);
|
|
l = false
|
|
} else {
|
|
l &= g;
|
|
c[h] = !g
|
|
}
|
|
}
|
|
}
|
|
if (!l) {
|
|
this.set_invalid(m, "invalid", c);
|
|
this.setUpdated(m, false)
|
|
}
|
|
return l
|
|
}
|
|
};
|
|
|
|
function dhtmlXGridCellObject(a) {
|
|
this.destructor = function() {
|
|
this.cell.obj = null;
|
|
this.cell = null;
|
|
this.grid = null;
|
|
this.base = null;
|
|
return null
|
|
};
|
|
this.cell = a;
|
|
this.getValue = function() {
|
|
if ((this.cell.firstChild) && (this.cell.firstChild.tagName == "TEXTAREA")) {
|
|
return this.cell.firstChild.value
|
|
} else {
|
|
return this.cell.innerHTML._dhx_trim()
|
|
}
|
|
};
|
|
this.getMathValue = function() {
|
|
if (this.cell.original) {
|
|
return this.cell.original
|
|
} else {
|
|
return this.getValue()
|
|
}
|
|
};
|
|
this.getFont = function() {
|
|
arOut = new Array(3);
|
|
if (this.cell.style.fontFamily) {
|
|
arOut[0] = this.cell.style.fontFamily
|
|
}
|
|
if (this.cell.style.fontWeight == "bold" || this.cell.parentNode.style.fontWeight == "bold") {
|
|
arOut[1] = "bold"
|
|
}
|
|
if (this.cell.style.fontStyle == "italic" || this.cell.parentNode.style.fontWeight == "italic") {
|
|
arOut[1] += "italic"
|
|
}
|
|
if (this.cell.style.fontSize) {
|
|
arOut[2] = this.cell.style.fontSize
|
|
} else {
|
|
arOut[2] = ""
|
|
}
|
|
return arOut.join("-")
|
|
};
|
|
this.getTextColor = function() {
|
|
if (this.cell.style.color) {
|
|
return this.cell.style.color
|
|
} else {
|
|
return "#000000"
|
|
}
|
|
};
|
|
this.getBgColor = function() {
|
|
if (this.cell.bgColor) {
|
|
return this.cell.bgColor
|
|
} else {
|
|
return "#FFFFFF"
|
|
}
|
|
};
|
|
this.getHorAlign = function() {
|
|
if (this.cell.style.textAlign) {
|
|
return this.cell.style.textAlign
|
|
} else {
|
|
if (this.cell.style.textAlign) {
|
|
return this.cell.style.textAlign
|
|
} else {
|
|
return "left"
|
|
}
|
|
}
|
|
};
|
|
this.getWidth = function() {
|
|
return this.cell.scrollWidth
|
|
};
|
|
this.setFont = function(c) {
|
|
fntAr = c.split("-");
|
|
this.cell.style.fontFamily = fntAr[0];
|
|
this.cell.style.fontSize = fntAr[fntAr.length - 1];
|
|
if (fntAr.length == 3) {
|
|
if (/bold/.test(fntAr[1])) {
|
|
this.cell.style.fontWeight = "bold"
|
|
}
|
|
if (/italic/.test(fntAr[1])) {
|
|
this.cell.style.fontStyle = "italic"
|
|
}
|
|
if (/underline/.test(fntAr[1])) {
|
|
this.cell.style.textDecoration = "underline"
|
|
}
|
|
}
|
|
};
|
|
this.setTextColor = function(c) {
|
|
this.cell.style.color = c
|
|
};
|
|
this.setBgColor = function(c) {
|
|
if (c == "") {
|
|
c = null
|
|
}
|
|
this.cell.bgColor = c
|
|
};
|
|
this.setHorAlign = function(c) {
|
|
if (c.length == 1) {
|
|
if (c == "c") {
|
|
this.cell.style.textAlign = "center"
|
|
} else {
|
|
if (c == "l") {
|
|
this.cell.style.textAlign = "left"
|
|
} else {
|
|
this.cell.style.textAlign = "right"
|
|
}
|
|
}
|
|
} else {
|
|
this.cell.style.textAlign = c
|
|
}
|
|
};
|
|
this.wasChanged = function() {
|
|
if (this.cell.wasChanged) {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
};
|
|
this.isCheckbox = function() {
|
|
var c = this.cell.firstChild;
|
|
if (c && c.tagName == "INPUT") {
|
|
type = c.type;
|
|
if (type == "radio" || type == "checkbox") {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
} else {
|
|
return false
|
|
}
|
|
};
|
|
this.isChecked = function() {
|
|
if (this.isCheckbox()) {
|
|
return this.cell.firstChild.checked
|
|
}
|
|
};
|
|
this.isDisabled = function() {
|
|
return this.cell._disabled
|
|
};
|
|
this.setChecked = function(c) {
|
|
if (this.isCheckbox()) {
|
|
if (c != "true" && c != 1) {
|
|
c = false
|
|
}
|
|
this.cell.firstChild.checked = c
|
|
}
|
|
};
|
|
this.setDisabled = function(c) {
|
|
if (c != "true" && c != 1) {
|
|
c = false
|
|
}
|
|
if (this.isCheckbox()) {
|
|
this.cell.firstChild.disabled = c;
|
|
if (this.disabledF) {
|
|
this.disabledF(c)
|
|
}
|
|
}
|
|
this.cell._disabled = c
|
|
}
|
|
}
|
|
dhtmlXGridCellObject.prototype = {
|
|
getAttribute: function(a) {
|
|
return this.cell._attrs[a]
|
|
},
|
|
setAttribute: function(a, c) {
|
|
this.cell._attrs[a] = c
|
|
},
|
|
getInput: function() {
|
|
if (this.obj && (this.obj.tagName == "INPUT" || this.obj.tagName == "TEXTAREA")) {
|
|
return this.obj
|
|
}
|
|
var a = (this.obj || this.cell).getElementsByTagName("TEXTAREA");
|
|
if (!a.length) {
|
|
a = (this.obj || this.cell).getElementsByTagName("INPUT")
|
|
}
|
|
return a[0]
|
|
}
|
|
};
|
|
dhtmlXGridCellObject.prototype.setValue = function(a) {
|
|
if ((typeof(a) != "number") && (!a || a.toString()._dhx_trim() == "")) {
|
|
a = " ";
|
|
this.cell._clearCell = true
|
|
} else {
|
|
this.cell._clearCell = false
|
|
}
|
|
this.setCValue(a)
|
|
};
|
|
dhtmlXGridCellObject.prototype.getTitle = function() {
|
|
return (_isIE ? this.cell.innerText : this.cell.textContent)
|
|
};
|
|
dhtmlXGridCellObject.prototype.setCValue = function(c, a) {
|
|
this.cell.innerHTML = c;
|
|
this.grid.callEvent("onCellChanged", [this.cell.parentNode.idd, this.cell._cellIndex, (arguments.length > 1 ? a : c)])
|
|
};
|
|
dhtmlXGridCellObject.prototype.setCTxtValue = function(a) {
|
|
this.cell.innerHTML = "";
|
|
this.cell.appendChild(document.createTextNode(a));
|
|
this.grid.callEvent("onCellChanged", [this.cell.parentNode.idd, this.cell._cellIndex, a])
|
|
};
|
|
dhtmlXGridCellObject.prototype.setLabel = function(a) {
|
|
this.cell.innerHTML = a
|
|
};
|
|
dhtmlXGridCellObject.prototype.getMath = function() {
|
|
if (this._val) {
|
|
return this.val
|
|
} else {
|
|
return this.getValue()
|
|
}
|
|
};
|
|
|
|
function eXcell() {
|
|
this.obj = null;
|
|
this.val = null;
|
|
this.changeState = function() {
|
|
return false
|
|
};
|
|
this.edit = function() {
|
|
this.val = this.getValue()
|
|
};
|
|
this.detach = function() {
|
|
return false
|
|
};
|
|
this.getPosition = function(h) {
|
|
var a = h;
|
|
var g = 0;
|
|
var c = 0;
|
|
while (a.tagName != "BODY") {
|
|
g += a.offsetLeft;
|
|
c += a.offsetTop;
|
|
a = a.offsetParent
|
|
}
|
|
return new Array(g, c)
|
|
}
|
|
}
|
|
eXcell.prototype = new dhtmlXGridCellObject;
|
|
|
|
function eXcell_ed(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
}
|
|
this.edit = function() {
|
|
this.cell.atag = ((!this.grid.multiLine) && (_isKHTML || _isMacOS || _isFF)) ? "INPUT" : "TEXTAREA";
|
|
this.val = this.getValue();
|
|
this.obj = document.createElement(this.cell.atag);
|
|
this.obj.setAttribute("autocomplete", "off");
|
|
this.obj.style.height = (this.cell.offsetHeight - (_isIE ? 4 : 4)) + "px";
|
|
this.obj.className = "dhx_combo_edit";
|
|
this.obj.wrap = "soft";
|
|
this.obj.style.textAlign = this.cell.style.textAlign;
|
|
this.obj.onclick = function(c) {
|
|
(c || event).cancelBubble = true
|
|
};
|
|
this.obj.onmousedown = function(c) {
|
|
(c || event).cancelBubble = true
|
|
};
|
|
this.obj.value = this.val;
|
|
this.cell.innerHTML = "";
|
|
this.cell.appendChild(this.obj);
|
|
this.obj.onselectstart = function(c) {
|
|
if (!c) {
|
|
c = event
|
|
}
|
|
c.cancelBubble = true;
|
|
return true
|
|
};
|
|
if (_isIE) {
|
|
this.obj.focus();
|
|
this.obj.blur()
|
|
}
|
|
this.obj.focus()
|
|
};
|
|
this.getValue = function() {
|
|
if ((this.cell.firstChild) && ((this.cell.atag) && (this.cell.firstChild.tagName == this.cell.atag))) {
|
|
return this.cell.firstChild.value
|
|
}
|
|
if (this.cell._clearCell) {
|
|
return ""
|
|
}
|
|
return this.cell.innerHTML.toString()._dhx_trim()
|
|
};
|
|
this.detach = function() {
|
|
this.setValue(this.obj.value);
|
|
return this.val != this.getValue()
|
|
}
|
|
}
|
|
eXcell_ed.prototype = new eXcell;
|
|
|
|
function eXcell_edtxt(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
}
|
|
this.getValue = function() {
|
|
if ((this.cell.firstChild) && ((this.cell.atag) && (this.cell.firstChild.tagName == this.cell.atag))) {
|
|
return this.cell.firstChild.value
|
|
}
|
|
if (this.cell._clearCell) {
|
|
return ""
|
|
}
|
|
return (_isIE ? this.cell.innerText : this.cell.textContent)
|
|
};
|
|
this.setValue = function(c) {
|
|
if (!c || c.toString()._dhx_trim() == "") {
|
|
c = " ";
|
|
this.cell._clearCell = true
|
|
} else {
|
|
this.cell._clearCell = false
|
|
}
|
|
this.setCTxtValue(c)
|
|
}
|
|
}
|
|
eXcell_edtxt.prototype = new eXcell_ed;
|
|
|
|
function eXcell_edn(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
}
|
|
this.getValue = function() {
|
|
if ((this.cell.firstChild) && (this.cell.firstChild.tagName == "TEXTAREA")) {
|
|
return this.cell.firstChild.value
|
|
}
|
|
if (this.cell._clearCell) {
|
|
return ""
|
|
}
|
|
return this.cell._orig_value || this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(), this.cell._cellIndex)
|
|
};
|
|
this.detach = function() {
|
|
var c = this.obj.value;
|
|
this.setValue(c);
|
|
return this.val != this.getValue()
|
|
}
|
|
}
|
|
eXcell_edn.prototype = new eXcell_ed;
|
|
eXcell_edn.prototype.setValue = function(a) {
|
|
if (!a || a.toString()._dhx_trim() == "") {
|
|
this.cell._clearCell = true;
|
|
return this.setCValue(" ", 0)
|
|
} else {
|
|
this.cell._clearCell = false;
|
|
this.cell._orig_value = a
|
|
}
|
|
this.setCValue(this.grid._aplNF(a, this.cell._cellIndex), a)
|
|
};
|
|
|
|
function eXcell_ch(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
}
|
|
this.disabledF = function(c) {
|
|
if ((c == true) || (c == 1)) {
|
|
this.cell.innerHTML = this.cell.innerHTML.replace("item_chk0.", "item_chk0_dis.").replace("item_chk1.", "item_chk1_dis.")
|
|
} else {
|
|
this.cell.innerHTML = this.cell.innerHTML.replace("item_chk0_dis.", "item_chk0.").replace("item_chk1_dis.", "item_chk1.")
|
|
}
|
|
};
|
|
this.changeState = function(c) {
|
|
if (c === true && !this.grid.isActive) {
|
|
if (window.globalActiveDHTMLGridObject != null && window.globalActiveDHTMLGridObject != this.grid && window.globalActiveDHTMLGridObject.isActive) {
|
|
window.globalActiveDHTMLGridObject.setActive(false)
|
|
}
|
|
this.grid.setActive(true)
|
|
}
|
|
if ((!this.grid.isEditable) || (this.cell.parentNode._locked) || (this.isDisabled())) {
|
|
return
|
|
}
|
|
if (this.grid.callEvent("onEditCell", [0, this.cell.parentNode.idd, this.cell._cellIndex])) {
|
|
this.val = this.getValue();
|
|
if (this.val == "1") {
|
|
this.setValue("0")
|
|
} else {
|
|
this.setValue("1")
|
|
}
|
|
this.cell.wasChanged = true;
|
|
this.grid.callEvent("onEditCell", [1, this.cell.parentNode.idd, this.cell._cellIndex]);
|
|
this.grid.callEvent("onCheckbox", [this.cell.parentNode.idd, this.cell._cellIndex, (this.val != "1")]);
|
|
this.grid.callEvent("onCheck", [this.cell.parentNode.idd, this.cell._cellIndex, (this.val != "1")])
|
|
} else {
|
|
this.editor = null
|
|
}
|
|
};
|
|
this.getValue = function() {
|
|
return this.cell.chstate ? this.cell.chstate.toString() : "0"
|
|
};
|
|
this.isCheckbox = function() {
|
|
return true
|
|
};
|
|
this.isChecked = function() {
|
|
if (this.getValue() == "1") {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
};
|
|
this.setChecked = function(c) {
|
|
this.setValue(c.toString())
|
|
};
|
|
this.detach = function() {
|
|
return this.val != this.getValue()
|
|
};
|
|
this.edit = null
|
|
}
|
|
eXcell_ch.prototype = new eXcell;
|
|
eXcell_ch.prototype.setValue = function(c) {
|
|
this.cell.style.verticalAlign = "middle";
|
|
if (c) {
|
|
c = c.toString()._dhx_trim();
|
|
if ((c == "false") || (c == "0")) {
|
|
c = ""
|
|
}
|
|
}
|
|
if (c) {
|
|
c = "1";
|
|
this.cell.chstate = "1"
|
|
} else {
|
|
c = "0";
|
|
this.cell.chstate = "0"
|
|
}
|
|
var a = this;
|
|
this.setCValue("<img src='" + this.grid.imgURL + "item_chk" + c + ".gif' onclick='new eXcell_ch(this.parentNode).changeState(true); (arguments[0]||event).cancelBubble=true; '>", this.cell.chstate)
|
|
};
|
|
|
|
function eXcell_ra(a) {
|
|
this.base = eXcell_ch;
|
|
this.base(a);
|
|
this.grid = a.parentNode.grid;
|
|
this.disabledF = function(c) {
|
|
if ((c == true) || (c == 1)) {
|
|
this.cell.innerHTML = this.cell.innerHTML.replace("radio_chk0.", "radio_chk0_dis.").replace("radio_chk1.", "radio_chk1_dis.")
|
|
} else {
|
|
this.cell.innerHTML = this.cell.innerHTML.replace("radio_chk0_dis.", "radio_chk0.").replace("radio_chk1_dis.", "radio_chk1.")
|
|
}
|
|
};
|
|
this.changeState = function(c) {
|
|
if (c === false && this.getValue() == 1) {
|
|
return
|
|
}
|
|
if ((!this.grid.isEditable) || (this.cell.parentNode._locked) || (this.isDisabled())) {
|
|
return
|
|
}
|
|
if (this.grid.callEvent("onEditCell", [0, this.cell.parentNode.idd, this.cell._cellIndex]) != false) {
|
|
this.val = this.getValue();
|
|
if (this.val == "1") {
|
|
this.setValue("0")
|
|
} else {
|
|
this.setValue("1")
|
|
}
|
|
this.cell.wasChanged = true;
|
|
this.grid.callEvent("onEditCell", [1, this.cell.parentNode.idd, this.cell._cellIndex]);
|
|
this.grid.callEvent("onCheckbox", [this.cell.parentNode.idd, this.cell._cellIndex, (this.val != "1")]);
|
|
this.grid.callEvent("onCheck", [this.cell.parentNode.idd, this.cell._cellIndex, (this.val != "1")])
|
|
} else {
|
|
this.editor = null
|
|
}
|
|
};
|
|
this.edit = null
|
|
}
|
|
eXcell_ra.prototype = new eXcell_ch;
|
|
eXcell_ra.prototype.setValue = function(c) {
|
|
this.cell.style.verticalAlign = "middle";
|
|
if (c) {
|
|
c = c.toString()._dhx_trim();
|
|
if ((c == "false") || (c == "0")) {
|
|
c = ""
|
|
}
|
|
}
|
|
if (c) {
|
|
if (!this.grid._RaSeCol) {
|
|
this.grid._RaSeCol = []
|
|
}
|
|
if (this.grid._RaSeCol[this.cell._cellIndex]) {
|
|
var a = this.grid.cells4(this.grid._RaSeCol[this.cell._cellIndex]);
|
|
a.setValue("0");
|
|
if (this.grid.rowsAr[a.cell.parentNode.idd]) {
|
|
this.grid.callEvent("onEditCell", [1, a.cell.parentNode.idd, a.cell._cellIndex])
|
|
}
|
|
}
|
|
this.grid._RaSeCol[this.cell._cellIndex] = this.cell;
|
|
c = "1";
|
|
this.cell.chstate = "1"
|
|
} else {
|
|
c = "0";
|
|
this.cell.chstate = "0"
|
|
}
|
|
this.setCValue("<img src='" + this.grid.imgURL + "radio_chk" + c + ".gif' onclick='new eXcell_ra(this.parentNode).changeState(false);'>", this.cell.chstate)
|
|
};
|
|
|
|
function eXcell_txt(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
}
|
|
this.edit = function() {
|
|
this.val = this.getValue();
|
|
this.obj = document.createElement("TEXTAREA");
|
|
this.obj.className = "dhx_textarea";
|
|
this.obj.onclick = function(l) {
|
|
(l || event).cancelBubble = true
|
|
};
|
|
var g = this.grid.getPosition(this.cell);
|
|
this.obj.value = this.val;
|
|
this.obj.style.display = "";
|
|
this.obj.style.textAlign = this.cell.style.textAlign;
|
|
if (_isFF) {
|
|
var c = document.createElement("DIV");
|
|
c.appendChild(this.obj);
|
|
c.style.overflow = "auto";
|
|
c.className = "dhx_textarea";
|
|
this.obj.style.margin = "0px 0px 0px 0px";
|
|
this.obj.style.border = "0px";
|
|
this.obj = c
|
|
}
|
|
document.body.appendChild(this.obj);
|
|
if (_isOpera) {
|
|
this.obj.onkeypress = function(l) {
|
|
if (l.keyCode == 9) {
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
this.obj.onkeydown = function(m) {
|
|
var l = (m || event);
|
|
if (l.keyCode == 9) {
|
|
globalActiveDHTMLGridObject.entBox.focus();
|
|
globalActiveDHTMLGridObject.doKey({
|
|
keyCode: l.keyCode,
|
|
shiftKey: l.shiftKey,
|
|
srcElement: "0"
|
|
});
|
|
return false
|
|
}
|
|
};
|
|
this.obj.style.left = g[0] + "px";
|
|
this.obj.style.top = g[1] + this.cell.offsetHeight + "px";
|
|
if (this.cell.offsetWidth < 200) {
|
|
var h = 200
|
|
} else {
|
|
var h = this.cell.offsetWidth
|
|
}
|
|
this.obj.style.width = h + (_isFF ? 18 : 16) + "px";
|
|
if (_isFF) {
|
|
this.obj.firstChild.style.width = parseInt(this.obj.style.width) + "px";
|
|
this.obj.firstChild.style.height = this.obj.offsetHeight - 3 + "px"
|
|
}
|
|
if (_isIE) {
|
|
this.obj.select();
|
|
this.obj.value = this.obj.value
|
|
}
|
|
if (_isFF) {
|
|
this.obj.firstChild.focus()
|
|
} else {
|
|
this.obj.focus()
|
|
}
|
|
};
|
|
this.detach = function() {
|
|
var c = "";
|
|
if (_isFF) {
|
|
c = this.obj.firstChild.value
|
|
} else {
|
|
c = this.obj.value
|
|
} if (c == "") {
|
|
this.cell._clearCell = true
|
|
} else {
|
|
this.cell._clearCell = false
|
|
}
|
|
this.setValue(c);
|
|
document.body.removeChild(this.obj);
|
|
this.obj = null;
|
|
return this.val != this.getValue()
|
|
};
|
|
this.getValue = function() {
|
|
if (this.obj) {
|
|
if (_isFF) {
|
|
return this.obj.firstChild.value
|
|
} else {
|
|
return this.obj.value
|
|
}
|
|
}
|
|
if (this.cell._clearCell) {
|
|
return ""
|
|
}
|
|
if (typeof this.cell._brval != "undefined") {
|
|
return this.cell._brval
|
|
}
|
|
if ((!this.grid.multiLine)) {
|
|
return this.cell._brval || this.cell.innerHTML
|
|
} else {
|
|
return this.cell._brval || this.cell.innerHTML.replace(/<br[^>]*>/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, "<br/>"), a)
|
|
}
|
|
};
|
|
|
|
function eXcell_co(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
this.combo = (this.cell._combo || this.grid.getCombo(this.cell._cellIndex));
|
|
this.editable = true
|
|
}
|
|
this.shiftNext = function() {
|
|
var c = this.list.options[this.list.selectedIndex + 1];
|
|
if (c) {
|
|
c.selected = true
|
|
}
|
|
this.obj.value = this.list.options[this.list.selectedIndex].text;
|
|
return true
|
|
};
|
|
this.shiftPrev = function() {
|
|
if (this.list.selectedIndex != 0) {
|
|
var c = this.list.options[this.list.selectedIndex - 1];
|
|
if (c) {
|
|
c.selected = true
|
|
}
|
|
this.obj.value = this.list.options[this.list.selectedIndex].text
|
|
}
|
|
return true
|
|
};
|
|
this.edit = function() {
|
|
this.val = this.getValue();
|
|
this.text = this.getText()._dhx_trim();
|
|
var h = this.grid.getPosition(this.cell);
|
|
this.obj = document.createElement("TEXTAREA");
|
|
this.obj.className = "dhx_combo_edit";
|
|
this.obj.style.height = (this.cell.offsetHeight - 4) + "px";
|
|
this.obj.wrap = "soft";
|
|
this.obj.style.textAlign = this.cell.style.textAlign;
|
|
this.obj.onclick = function(q) {
|
|
(q || event).cancelBubble = true
|
|
};
|
|
this.obj.onmousedown = function(q) {
|
|
(q || event).cancelBubble = true
|
|
};
|
|
this.obj.value = this.text;
|
|
this.obj.onselectstart = function(q) {
|
|
if (!q) {
|
|
q = event
|
|
}
|
|
q.cancelBubble = true;
|
|
return true
|
|
};
|
|
var m = this;
|
|
this.obj.onkeyup = function(s) {
|
|
var r = (s || event).keyCode;
|
|
if (r == 38 || r == 40 || r == 9) {
|
|
return
|
|
}
|
|
var u = this.readonly ? String.fromCharCode(r) : this.value;
|
|
var v = m.list.options;
|
|
for (var q = 0; q < v.length; q++) {
|
|
if (v[q].text.indexOf(u) == 0) {
|
|
return v[q].selected = true
|
|
}
|
|
}
|
|
};
|
|
this.list = document.createElement("SELECT");
|
|
this.list.className = "dhx_combo_select";
|
|
this.list.style.width = this.cell.offsetWidth + "px";
|
|
this.list.style.left = h[0] + "px";
|
|
this.list.style.top = h[1] + this.cell.offsetHeight + "px";
|
|
this.list.onclick = function(s) {
|
|
var r = s || window.event;
|
|
var q = r.target || r.srcElement;
|
|
if (q.tagName == "OPTION") {
|
|
q = q.parentNode
|
|
}
|
|
m.editable = false;
|
|
m.grid.editStop();
|
|
r.cancelBubble = true
|
|
};
|
|
var c = this.combo.getKeys();
|
|
var l = false;
|
|
var o = 0;
|
|
for (var g = 0; g < c.length; g++) {
|
|
var n = this.combo.get(c[g]);
|
|
this.list.options[this.list.options.length] = new Option(n, c[g]);
|
|
if (c[g] == this.val) {
|
|
o = this.list.options.length - 1;
|
|
l = true
|
|
}
|
|
}
|
|
if (l == false) {
|
|
this.list.options[this.list.options.length] = new Option(this.text, this.val === null ? "" : this.val);
|
|
o = this.list.options.length - 1
|
|
}
|
|
document.body.appendChild(this.list);
|
|
this.list.size = "6";
|
|
this.cstate = 1;
|
|
if (this.editable) {
|
|
this.cell.innerHTML = ""
|
|
} else {
|
|
this.obj.style.width = "1px";
|
|
this.obj.style.height = "1px"
|
|
}
|
|
this.cell.appendChild(this.obj);
|
|
this.list.options[o].selected = true;
|
|
if ((!_isFF) || (this.editable)) {
|
|
this.obj.focus();
|
|
this.obj.focus()
|
|
}
|
|
if (!this.editable) {
|
|
this.obj.style.visibility = "hidden";
|
|
this.list.focus();
|
|
this.list.onkeydown = function(q) {
|
|
q = q || window.event;
|
|
m.grid.setActive(true);
|
|
if (q.keyCode < 30) {
|
|
return m.grid.doKey({
|
|
target: m.cell,
|
|
keyCode: q.keyCode,
|
|
shiftKey: q.shiftKey,
|
|
ctrlKey: q.ctrlKey
|
|
})
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.getValue = function() {
|
|
return ((this.cell.combo_value == window.undefined) ? "" : this.cell.combo_value)
|
|
};
|
|
this.detach = function() {
|
|
if (this.val != this.getValue()) {
|
|
this.cell.wasChanged = true
|
|
}
|
|
if (this.list.parentNode != null) {
|
|
if (this.editable) {
|
|
var c = this.list.options[this.list.selectedIndex];
|
|
if (c && c.text == this.obj.value) {
|
|
this.setValue(this.list.value)
|
|
} else {
|
|
var g = (this.cell._combo || this.grid.getCombo(this.cell._cellIndex));
|
|
var h = g.values._dhx_find(this.obj.value);
|
|
if (h != -1) {
|
|
this.setValue(g.keys[h])
|
|
} else {
|
|
this.setValue(this.cell.combo_value = this.obj.value)
|
|
}
|
|
}
|
|
} else {
|
|
this.setValue(this.list.value)
|
|
}
|
|
}
|
|
if (this.list.parentNode) {
|
|
this.list.parentNode.removeChild(this.list)
|
|
}
|
|
if (this.obj.parentNode) {
|
|
this.obj.parentNode.removeChild(this.obj)
|
|
}
|
|
return this.val != this.getValue()
|
|
}
|
|
}
|
|
eXcell_co.prototype = new eXcell;
|
|
eXcell_co.prototype.getText = function() {
|
|
return this.cell.innerHTML
|
|
};
|
|
eXcell_co.prototype.setValue = function(h) {
|
|
if (typeof(h) == "object") {
|
|
var g = this.grid.xmlLoader.doXPath("./option", h);
|
|
if (g.length) {
|
|
this.cell._combo = new dhtmlXGridComboObject()
|
|
}
|
|
for (var c = 0; c < g.length; c++) {
|
|
this.cell._combo.put(g[c].getAttribute("value"), g[c].firstChild ? g[c].firstChild.data : "")
|
|
}
|
|
h = h.firstChild.data
|
|
}
|
|
if ((h || "").toString()._dhx_trim() == "") {
|
|
h = null
|
|
}
|
|
this.cell.combo_value = h;
|
|
if (h !== null) {
|
|
var a = (this.cell._combo || this.grid.getCombo(this.cell._cellIndex)).get(h);
|
|
this.setCValue(a === null ? h : a, h)
|
|
} else {
|
|
this.setCValue(" ", h)
|
|
}
|
|
};
|
|
|
|
function eXcell_coro(a) {
|
|
this.base = eXcell_co;
|
|
this.base(a);
|
|
this.editable = false
|
|
}
|
|
eXcell_coro.prototype = new eXcell_co;
|
|
|
|
function eXcell_cotxt(a) {
|
|
this.base = eXcell_co;
|
|
this.base(a)
|
|
}
|
|
eXcell_cotxt.prototype = new eXcell_co;
|
|
eXcell_cotxt.prototype.getText = function() {
|
|
return (_isIE ? this.cell.innerText : this.cell.textContent)
|
|
};
|
|
eXcell_cotxt.prototype.setValue = function(g) {
|
|
if (typeof(g) == "object") {
|
|
var c = this.grid.xmlLoader.doXPath("./option", g);
|
|
if (c.length) {
|
|
this.cell._combo = new dhtmlXGridComboObject()
|
|
}
|
|
for (var a = 0; a < c.length; a++) {
|
|
this.cell._combo.put(c[a].getAttribute("value"), c[a].firstChild ? c[a].firstChild.data : "")
|
|
}
|
|
g = g.firstChild.data
|
|
}
|
|
if ((g || "").toString()._dhx_trim() == "") {
|
|
g = null
|
|
}
|
|
if (g !== null) {
|
|
this.setCTxtValue((this.cell._combo || this.grid.getCombo(this.cell._cellIndex)).get(g) || g, g)
|
|
} else {
|
|
this.setCTxtValue(" ", g)
|
|
}
|
|
this.cell.combo_value = g
|
|
};
|
|
|
|
function eXcell_corotxt(a) {
|
|
this.base = eXcell_co;
|
|
this.base(a);
|
|
this.editable = false
|
|
}
|
|
eXcell_corotxt.prototype = new eXcell_cotxt;
|
|
|
|
function eXcell_cp(a) {
|
|
try {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
} catch (c) {}
|
|
this.edit = function() {
|
|
this.val = this.getValue();
|
|
this.obj = document.createElement("SPAN");
|
|
this.obj.style.border = "1px solid black";
|
|
this.obj.style.position = "absolute";
|
|
var g = this.grid.getPosition(this.cell);
|
|
this.colorPanel(4, this.obj);
|
|
document.body.appendChild(this.obj);
|
|
this.obj.style.left = g[0] + "px";
|
|
this.obj.style.zIndex = 1000;
|
|
this.obj.style.top = g[1] + this.cell.offsetHeight + "px"
|
|
};
|
|
this.toolDNum = function(g) {
|
|
if (g.length == 1) {
|
|
g = "0" + g
|
|
}
|
|
return g
|
|
};
|
|
this.colorPanel = function(s, w) {
|
|
var o = document.createElement("TABLE");
|
|
w.appendChild(o);
|
|
o.cellSpacing = 0;
|
|
o.editor_obj = this;
|
|
o.style.cursor = "default";
|
|
o.onclick = function(y) {
|
|
var x = y || window.event;
|
|
var n = x.target || x.srcElement;
|
|
var r = n.parentNode.parentNode.parentNode.editor_obj;
|
|
r.setValue(n._bg);
|
|
r.grid.editStop()
|
|
};
|
|
var l = 256 / s;
|
|
for (var m = 0; m <= (256 / l); m++) {
|
|
var g = o.insertRow(m);
|
|
for (var q = 0; q <= (256 / l); q++) {
|
|
for (var h = 0; h <= (256 / l); h++) {
|
|
R = new Number(l * m) - (m == 0 ? 0 : 1);
|
|
G = new Number(l * q) - (q == 0 ? 0 : 1);
|
|
B = new Number(l * h) - (h == 0 ? 0 : 1);
|
|
var v = this.toolDNum(R.toString(16)) + "" + this.toolDNum(G.toString(16)) + "" + this.toolDNum(B.toString(16));
|
|
var u = g.insertCell(q);
|
|
u.width = "10px";
|
|
u.innerHTML = " ";
|
|
u.title = v.toUpperCase();
|
|
u.style.backgroundColor = "#" + v;
|
|
u._bg = "#" + v;
|
|
if (this.val != null && "#" + v.toUpperCase() == this.val.toUpperCase()) {
|
|
u.style.border = "2px solid white"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.getValue = function() {
|
|
return this.cell.firstChild._bg || ""
|
|
};
|
|
this.getRed = function() {
|
|
return Number(parseInt(this.getValue().substr(1, 2), 16))
|
|
};
|
|
this.getGreen = function() {
|
|
return Number(parseInt(this.getValue().substr(3, 2), 16))
|
|
};
|
|
this.getBlue = function() {
|
|
return Number(parseInt(this.getValue().substr(5, 2), 16))
|
|
};
|
|
this.detach = function() {
|
|
if (this.obj.offsetParent != null) {
|
|
document.body.removeChild(this.obj)
|
|
}
|
|
return this.val != this.getValue()
|
|
}
|
|
}
|
|
eXcell_cp.prototype = new eXcell;
|
|
eXcell_cp.prototype.setValue = function(a) {
|
|
this.setCValue("<div style='width:100%;height:" + ((this.grid.multiLine ? this.cell.offsetHeight - 2 : 16)) + ";background-color:" + (a || "") + ";border:0px;'> </div>", a);
|
|
this.cell.firstChild._bg = a
|
|
};
|
|
|
|
function eXcell_img(a) {
|
|
try {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
} catch (c) {}
|
|
this.getValue = function() {
|
|
if (this.cell.firstChild.tagName == "IMG") {
|
|
return this.cell.firstChild.src + (this.cell.titFl != null ? "^" + this.cell._brval : "")
|
|
} else {
|
|
if (this.cell.firstChild.tagName == "A") {
|
|
var g = this.cell.firstChild.firstChild.src + (this.cell.titFl != null ? "^" + this.cell._brval : "");
|
|
g += "^" + this.cell.lnk;
|
|
if (this.cell.trg) {
|
|
g += "^" + this.cell.trg
|
|
}
|
|
return g
|
|
}
|
|
}
|
|
};
|
|
this.isDisabled = function() {
|
|
return true
|
|
}
|
|
}
|
|
eXcell_img.prototype = new eXcell;
|
|
eXcell_img.prototype.getTitle = function() {
|
|
return this.cell._brval
|
|
};
|
|
eXcell_img.prototype.setValue = function(g) {
|
|
var c = g;
|
|
if ((g || "").indexOf("^") != -1) {
|
|
var a = g.split("^");
|
|
g = a[0];
|
|
c = this.cell._attrs.title || a[1];
|
|
if (a.length > 2) {
|
|
this.cell.lnk = a[2];
|
|
if (a[3]) {
|
|
this.cell.trg = a[3]
|
|
}
|
|
}
|
|
this.cell.titFl = "1"
|
|
}
|
|
this.setCValue("<img src='" + this.grid.iconURL + (g || "")._dhx_trim() + "' border='0'>", g);
|
|
if (this.cell.lnk) {
|
|
this.cell.innerHTML = "<a href='" + this.cell.lnk + "' target='" + this.cell.trg + "'>" + this.cell.innerHTML + "</a>"
|
|
}
|
|
this.cell._brval = c
|
|
};
|
|
|
|
function eXcell_price(a) {
|
|
this.base = eXcell_ed;
|
|
this.base(a);
|
|
this.getValue = function() {
|
|
if (this.cell.childNodes.length > 1) {
|
|
return this.cell.childNodes[1].innerHTML.toString()._dhx_trim()
|
|
} else {
|
|
return "0"
|
|
}
|
|
}
|
|
}
|
|
eXcell_price.prototype = new eXcell_ed;
|
|
eXcell_price.prototype.setValue = function(c) {
|
|
if (isNaN(parseFloat(c))) {
|
|
c = this.val || 0
|
|
}
|
|
var a = "green";
|
|
if (c < 0) {
|
|
a = "red"
|
|
}
|
|
this.setCValue("<span>$</span><span style='padding-right:2px;color:" + a + ";'>" + c + "</span>", c)
|
|
};
|
|
|
|
function eXcell_dyn(a) {
|
|
this.base = eXcell_ed;
|
|
this.base(a);
|
|
this.getValue = function() {
|
|
return this.cell.firstChild.childNodes[1].innerHTML.toString()._dhx_trim()
|
|
}
|
|
}
|
|
eXcell_dyn.prototype = new eXcell_ed;
|
|
eXcell_dyn.prototype.setValue = function(g) {
|
|
if (!g || isNaN(Number(g))) {
|
|
if (g !== "") {
|
|
g = 0
|
|
}
|
|
}
|
|
if (g > 0) {
|
|
var c = "green";
|
|
var a = "dyn_up.gif"
|
|
} else {
|
|
if (g == 0) {
|
|
var c = "black";
|
|
var a = "dyn_.gif"
|
|
} else {
|
|
var c = "red";
|
|
var a = "dyn_down.gif"
|
|
}
|
|
}
|
|
this.setCValue("<div style='position:relative;padding-right:2px; width:100%;overflow:hidden; white-space:nowrap;'><img src='" + this.grid.imgURL + "" + a + "' height='15' style='position:absolute;top:0px;left:0px;'><span style=' padding-left:20px; width:100%;color:" + c + ";'>" + g + "</span></div>", g)
|
|
};
|
|
|
|
function eXcell_ro(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
}
|
|
this.edit = function() {};
|
|
this.isDisabled = function() {
|
|
return true
|
|
};
|
|
this.getValue = function() {
|
|
return this.cell._clearCell ? "" : this.cell.innerHTML.toString()._dhx_trim()
|
|
}
|
|
}
|
|
eXcell_ro.prototype = new eXcell;
|
|
window.eXcell_hidden = function(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
}
|
|
this.edit = function() {};
|
|
this.isDisabled = function() {
|
|
return true
|
|
};
|
|
this.getValue = function() {
|
|
return this.cell.val
|
|
}
|
|
};
|
|
eXcell_hidden.prototype = new eXcell;
|
|
eXcell_hidden.prototype.setValue = function(a) {
|
|
this.cell.val = a
|
|
};
|
|
|
|
function eXcell_ron(a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
this.edit = function() {};
|
|
this.isDisabled = function() {
|
|
return true
|
|
};
|
|
this.getValue = function() {
|
|
return this.cell._clearCell ? "" : this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(), this.cell._cellIndex).toString()
|
|
}
|
|
}
|
|
eXcell_ron.prototype = new eXcell;
|
|
eXcell_ron.prototype.setValue = function(a) {
|
|
if (a === 0) {} else {
|
|
if (!a || a.toString()._dhx_trim() == "") {
|
|
this.setCValue(" ");
|
|
return this.cell._clearCell = true
|
|
}
|
|
}
|
|
this.cell._clearCell = false;
|
|
this.setCValue(a ? this.grid._aplNF(a, this.cell._cellIndex) : "0")
|
|
};
|
|
|
|
function eXcell_rotxt(a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
this.edit = function() {};
|
|
this.isDisabled = function() {
|
|
return true
|
|
};
|
|
this.setValue = function(c) {
|
|
if (!c) {
|
|
c = " ";
|
|
this.cell._clearCell = true
|
|
} else {
|
|
this.cell._clearCell = false
|
|
}
|
|
this.setCTxtValue(c)
|
|
};
|
|
this.getValue = function() {
|
|
if (this.cell._clearCell) {
|
|
return ""
|
|
}
|
|
return (_isIE ? this.cell.innerText : this.cell.textContent)
|
|
}
|
|
}
|
|
eXcell_rotxt.prototype = new eXcell;
|
|
|
|
function dhtmlXGridComboObject() {
|
|
this.keys = new dhtmlxArray();
|
|
this.values = new dhtmlxArray();
|
|
this.put = function(c, g) {
|
|
for (var a = 0; a < this.keys.length; a++) {
|
|
if (this.keys[a] == c) {
|
|
this.values[a] = g;
|
|
return true
|
|
}
|
|
}
|
|
this.values[this.values.length] = g;
|
|
this.keys[this.keys.length] = c
|
|
};
|
|
this.get = function(c) {
|
|
for (var a = 0; a < this.keys.length; a++) {
|
|
if (this.keys[a] == c) {
|
|
return this.values[a]
|
|
}
|
|
}
|
|
return null
|
|
};
|
|
this.clear = function() {
|
|
this.keys = new dhtmlxArray();
|
|
this.values = new dhtmlxArray()
|
|
};
|
|
this.remove = function(c) {
|
|
for (var a = 0; a < this.keys.length; a++) {
|
|
if (this.keys[a] == c) {
|
|
this.keys._dhx_removeAt(a);
|
|
this.values._dhx_removeAt(a);
|
|
return true
|
|
}
|
|
}
|
|
};
|
|
this.size = function() {
|
|
var a = 0;
|
|
for (var c = 0; c < this.keys.length; c++) {
|
|
if (this.keys[c] != null) {
|
|
a++
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
this.getKeys = function() {
|
|
var a = new Array(0);
|
|
for (var c = 0; c < this.keys.length; c++) {
|
|
if (this.keys[c] != null) {
|
|
a[a.length] = this.keys[c]
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
this.save = function() {
|
|
this._save = new Array();
|
|
for (var a = 0; a < this.keys.length; a++) {
|
|
this._save[a] = [this.keys[a], this.values[a]]
|
|
}
|
|
};
|
|
this.restore = function() {
|
|
if (this._save) {
|
|
this.keys[a] = new Array();
|
|
this.values[a] = new Array();
|
|
for (var a = 0; a < this._save.length; a++) {
|
|
this.keys[a] = this._save[a][0];
|
|
this.values[a] = this._save[a][1]
|
|
}
|
|
}
|
|
};
|
|
return this
|
|
}
|
|
|
|
function Hashtable() {
|
|
this.keys = new dhtmlxArray();
|
|
this.values = new dhtmlxArray();
|
|
return this
|
|
}
|
|
Hashtable.prototype = new dhtmlXGridComboObject;
|
|
dhtmlXGridObject.prototype.enableDragAndDrop = function(a) {
|
|
if (a == "temporary_disabled") {
|
|
this.dADTempOff = false;
|
|
a = true
|
|
} else {
|
|
this.dADTempOff = true
|
|
}
|
|
this.dragAndDropOff = convertStringToBoolean(a);
|
|
this._drag_validate = true;
|
|
if (a) {
|
|
this.objBox.ondragstart = function(c) {
|
|
(c || event).cancelBubble = true;
|
|
return false
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.setDragBehavior = function(a) {
|
|
this.dadmodec = this.dadmodefix = 0;
|
|
switch (a) {
|
|
case "child":
|
|
this.dadmode = 0;
|
|
this._sbmod = false;
|
|
break;
|
|
case "sibling":
|
|
this.dadmode = 1;
|
|
this._sbmod = false;
|
|
break;
|
|
case "sibling-next":
|
|
this.dadmode = 1;
|
|
this._sbmod = true;
|
|
break;
|
|
case "complex":
|
|
this.dadmode = 2;
|
|
this._sbmod = false;
|
|
break;
|
|
case "complex-next":
|
|
this.dadmode = 2;
|
|
this._sbmod = true;
|
|
break
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.enableDragOrder = function(a) {
|
|
this._dndorder = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype._checkParent = function(h, c) {
|
|
var g = this._h2.get[h.idd].parent;
|
|
if (!g.parent) {
|
|
return
|
|
}
|
|
for (var a = 0; a < c.length; a++) {
|
|
if (c[a] == g.id) {
|
|
return true
|
|
}
|
|
}
|
|
return this._checkParent(this.rowsAr[g.id], c)
|
|
};
|
|
dhtmlXGridObject.prototype._createDragNode = function(g, h) {
|
|
this.editStop();
|
|
if (window.dhtmlDragAndDrop.dragNode) {
|
|
return null
|
|
}
|
|
if (!this.dADTempOff) {
|
|
return null
|
|
}
|
|
g.parentObject = new Object();
|
|
g.parentObject.treeNod = this;
|
|
var o = this.callEvent("onBeforeDrag", [g.parentNode.idd, g._cellIndex, h]);
|
|
if (!o) {
|
|
return null
|
|
}
|
|
var l = new Array();
|
|
l = this.getSelectedId();
|
|
l = (((l) && (l != "")) ? l.split(this.delim) : []);
|
|
var m = false;
|
|
for (var c = 0; c < l.length; c++) {
|
|
if (l[c] == g.parentNode.idd) {
|
|
m = true
|
|
}
|
|
}
|
|
if (!m) {
|
|
this.selectRow(this.rowsAr[g.parentNode.idd], false, h.ctrlKey, false);
|
|
if (!h.ctrlKey) {
|
|
l = []
|
|
}
|
|
l[this.selMultiRows ? l.length : 0] = g.parentNode.idd
|
|
}
|
|
if (this.isTreeGrid()) {
|
|
for (var c = l.length - 1; c >= 0; c--) {
|
|
if (this._checkParent(this.rowsAr[l[c]], l)) {
|
|
l.splice(c, 1)
|
|
}
|
|
}
|
|
}
|
|
var q = this;
|
|
if (l.length && this._dndorder) {
|
|
l.sort(function(s, r) {
|
|
return (q.rowsAr[s].rowIndex > q.rowsAr[r].rowIndex ? 1 : -1)
|
|
})
|
|
}
|
|
var a = this.getFirstParentOfType(_isIE ? h.srcElement : h.target, "TD");
|
|
if (a) {
|
|
this._dndExtra = a._cellIndex
|
|
}
|
|
this._dragged = new Array();
|
|
for (var c = 0; c < l.length; c++) {
|
|
if (this.rowsAr[l[c]]) {
|
|
this._dragged[this._dragged.length] = this.rowsAr[l[c]];
|
|
this.rowsAr[l[c]].treeNod = this
|
|
}
|
|
}
|
|
g.parentObject.parentNode = g.parentNode;
|
|
var n = document.createElement("div");
|
|
n.innerHTML = (o !== true ? o : this.rowToDragElement(g.parentNode.idd));
|
|
n.style.position = "absolute";
|
|
n.className = "dragSpanDiv";
|
|
return n
|
|
};
|
|
dhtmlXGridObject.prototype._createSdrgc = function() {
|
|
this._sdrgc = document.createElement("DIV");
|
|
this._sdrgc.innerHTML = " ";
|
|
this._sdrgc.className = "gridDragLine";
|
|
this.objBox.appendChild(this._sdrgc)
|
|
};
|
|
|
|
function dragContext(w, v, u, s, r, q, n, o, m, g) {
|
|
this.source = w || "grid";
|
|
this.target = v || "grid";
|
|
this.mode = u || "move";
|
|
this.dropmode = s || "child";
|
|
this.sid = r || 0;
|
|
this.tid = q;
|
|
this.sobj = n || null;
|
|
this.tobj = o || null;
|
|
this.sExtra = m || null;
|
|
this.tExtra = g || null;
|
|
return this
|
|
}
|
|
dragContext.prototype.valid = function() {
|
|
if (this.sobj != this.tobj) {
|
|
return true
|
|
}
|
|
if (this.sid == this.tid) {
|
|
return false
|
|
}
|
|
if (this.target == "treeGrid") {
|
|
var a = this.tid;
|
|
while (a = this.tobj.getParentId(a)) {
|
|
if (this.sid == a) {
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
return true
|
|
};
|
|
dragContext.prototype.close = function() {
|
|
this.sobj = null;
|
|
this.tobj = null
|
|
};
|
|
dragContext.prototype.copy = function() {
|
|
return new dragContext(this.source, this.target, this.mode, this.dropmode, this.sid, this.tid, this.sobj, this.tobj, this.sExtra, this.tExtra)
|
|
};
|
|
dragContext.prototype.set = function(g, c) {
|
|
this[g] = c;
|
|
return this
|
|
};
|
|
dragContext.prototype.uid = function(g, c) {
|
|
this.nid = this.sid;
|
|
while (this.tobj.rowsAr[this.nid]) {
|
|
this.nid = this.nid + ((new Date()).valueOf())
|
|
}
|
|
return this
|
|
};
|
|
dragContext.prototype.data = function() {
|
|
if (this.sobj == this.tobj) {
|
|
return this.sobj._getRowArray(this.sobj.rowsAr[this.sid])
|
|
}
|
|
if (this.source == "tree") {
|
|
return this.tobj.treeToGridElement(this.sobj, this.sid, this.tid)
|
|
} else {
|
|
return this.tobj.gridToGrid(this.sid, this.sobj, this.tobj)
|
|
}
|
|
};
|
|
dragContext.prototype.attrs = function() {
|
|
if (this.source == "tree") {
|
|
return {}
|
|
} else {
|
|
return this.sobj.rowsAr[this.sid]._attrs
|
|
}
|
|
};
|
|
dragContext.prototype.childs = function() {
|
|
if (this.source == "treeGrid") {
|
|
return this.sobj._h2.get[this.sid]._xml_await ? this.sobj._h2.get[this.sid].has_kids : null
|
|
}
|
|
return null
|
|
};
|
|
dragContext.prototype.pid = function() {
|
|
if (!this.tid) {
|
|
return 0
|
|
}
|
|
if (!this.tobj._h2) {
|
|
return 0
|
|
}
|
|
if (this.target == "treeGrid") {
|
|
if (this.dropmode == "child") {
|
|
return this.tid
|
|
} else {
|
|
var c = this.tobj.rowsAr[this.tid];
|
|
var a = this.tobj._h2.get[c.idd].parent.id;
|
|
if ((this.alfa) && (this.tobj._sbmod) && (c.nextSibling)) {
|
|
var g = this.tobj._h2.get[c.nextSibling.idd].parent.id;
|
|
if (g == this.tid) {
|
|
return this.tid
|
|
}
|
|
if (g != a) {
|
|
return g
|
|
}
|
|
}
|
|
return a
|
|
}
|
|
}
|
|
};
|
|
dragContext.prototype.ind = function() {
|
|
if (this.tid == window.unknown) {
|
|
return this.tobj.rowsBuffer.length
|
|
}
|
|
if (this.target == "treeGrid") {
|
|
if (this.dropmode == "child") {
|
|
this.tobj.openItem(this.tid)
|
|
} else {
|
|
this.tobj.openItem(this.tobj.getParentId(this.tid))
|
|
}
|
|
}
|
|
var a = this.tobj.rowsBuffer._dhx_find(this.tobj.rowsAr[this.tid]);
|
|
if ((this.alfa) && (this.tobj._sbmod) && (this.dropmode == "sibling")) {
|
|
var c = this.tobj.rowsAr[this.tid];
|
|
if ((c.nextSibling) && (this._h2.get[c.nextSibling.idd].parent.id == this.tid)) {
|
|
return a + 1
|
|
}
|
|
}
|
|
return (a + 1 + ((this.target == "treeGrid" && a >= 0 && this.tobj._h2.get[this.tobj.rowsBuffer[a].idd].state == "minus") ? this.tobj._getOpenLenght(this.tobj.rowsBuffer[a].idd, 0) : 0))
|
|
};
|
|
dragContext.prototype.img = function() {
|
|
if ((this.target != "grid") && (this.sobj._h2)) {
|
|
return this.sobj.getItemImage(this.sid)
|
|
} else {
|
|
return null
|
|
}
|
|
};
|
|
dragContext.prototype.slist = function() {
|
|
var c = new Array();
|
|
for (var a = 0; a < this.sid.length; a++) {
|
|
c[c.length] = this.sid[a][(this.source == "tree") ? "id" : "idd"]
|
|
}
|
|
return c.join(",")
|
|
};
|
|
dhtmlXGridObject.prototype._drag = function(s, l, r, u) {
|
|
if (this._realfake) {
|
|
return this._fake._drag()
|
|
}
|
|
var q = (this.lastLanding);
|
|
if (this._autoOpenTimer) {
|
|
window.clearTimeout(this._autoOpenTimer)
|
|
}
|
|
var h = r.parentNode;
|
|
var g = s.parentObject;
|
|
if (!h.idd) {
|
|
h.grid = this;
|
|
this.dadmodefix = 0
|
|
}
|
|
var o = new dragContext(0, 0, 0, ((h.grid.dadmode == 1 || h.grid.dadmodec) ? "sibling" : "child"));
|
|
if (g && g.childNodes) {
|
|
o.set("source", "tree").set("sobj", g.treeNod).set("sid", o.sobj._dragged)
|
|
} else {
|
|
if (!g) {
|
|
return true
|
|
}
|
|
if (g.treeNod.isTreeGrid && g.treeNod.isTreeGrid()) {
|
|
o.set("source", "treeGrid")
|
|
}
|
|
o.set("sobj", g.treeNod).set("sid", o.sobj._dragged)
|
|
} if (h.grid.isTreeGrid()) {
|
|
o.set("target", "treeGrid")
|
|
} else {
|
|
o.set("dropmode", "sibling")
|
|
}
|
|
o.set("tobj", h.grid).set("tid", h.idd);
|
|
if (((o.tobj.dadmode == 2) && (o.tobj.dadmodec == 1)) && (o.tobj.dadmodefix < 0)) {
|
|
if (o.tobj.obj.rows[1].idd != o.tid) {
|
|
o.tid = h.previousSibling.idd
|
|
} else {
|
|
o.tid = 0
|
|
}
|
|
}
|
|
var a = this.getFirstParentOfType(u, "TD");
|
|
if (a) {
|
|
o.set("tExtra", a._cellIndex)
|
|
}
|
|
if (a) {
|
|
o.set("sExtra", o.sobj._dndExtra)
|
|
}
|
|
if (o.sobj.dpcpy) {
|
|
o.set("mode", "copy")
|
|
}
|
|
if (o.tobj._realfake) {
|
|
o.tobj = o.tobj._fake
|
|
}
|
|
if (o.sobj._realfake) {
|
|
o.sobj = o.sobj._fake
|
|
}
|
|
o.tobj._clearMove();
|
|
if (g && g.treeNod && g.treeNod._nonTrivialRow) {
|
|
g.treeNod._nonTrivialRow(this, o.tid, o.dropmode, g)
|
|
} else {
|
|
o.tobj.dragContext = o;
|
|
if (!o.tobj.callEvent("onDrag", [o.slist(), o.tid, o.sobj, o.tobj, o.sExtra, o.tExtra])) {
|
|
return o.tobj.dragContext = null
|
|
}
|
|
var v = new Array();
|
|
if (typeof(o.sid) == "object") {
|
|
var n = o.copy();
|
|
for (var m = 0; m < o.sid.length; m++) {
|
|
if (!n.set("alfa", (!m)).set("sid", o.sid[m][(o.source == "tree" ? "id" : "idd")]).valid()) {
|
|
continue
|
|
}
|
|
n.tobj._dragRoutine(n);
|
|
if (n.target == "treeGrid" && n.dropmode == "child") {
|
|
n.tobj.openItem(n.tid)
|
|
}
|
|
v[v.length] = n.nid;
|
|
n.set("dropmode", "sibling").set("tid", n.nid)
|
|
}
|
|
n.close()
|
|
} else {
|
|
o.tobj._dragRoutine(o)
|
|
} if (o.tobj.laterLink) {
|
|
o.tobj.laterLink()
|
|
}
|
|
o.tobj.callEvent("onDrop", [o.slist(), o.tid, v.join(","), o.sobj, o.tobj, o.sExtra, o.tExtra])
|
|
}
|
|
o.tobj.dragContext = null;
|
|
o.close()
|
|
};
|
|
dhtmlXGridObject.prototype._dragRoutine = function(s) {
|
|
if ((s.sobj == s.tobj) && (s.source == "grid") && (s.mode == "move") && !this._fake) {
|
|
if (s.sobj._dndProblematic) {
|
|
return
|
|
}
|
|
var q = s.sobj.rowsAr[s.sid];
|
|
var r = s.sobj.rowsCol._dhx_find(q);
|
|
s.sobj.rowsCol._dhx_removeAt(s.sobj.rowsCol._dhx_find(q));
|
|
s.sobj.rowsBuffer._dhx_removeAt(s.sobj.rowsBuffer._dhx_find(q));
|
|
s.sobj.rowsBuffer._dhx_insertAt(s.ind(), q);
|
|
if (s.tobj._fake) {
|
|
s.tobj._fake.rowsCol._dhx_removeAt(r);
|
|
var u = s.tobj._fake.rowsAr[s.sid];
|
|
u.parentNode.removeChild(u)
|
|
}
|
|
s.sobj._insertRowAt(q, s.ind());
|
|
s.nid = s.sid;
|
|
s.sobj.callEvent("onGridReconstructed", []);
|
|
return
|
|
}
|
|
var o;
|
|
if (this._h2 && typeof s.tid != "undefined" && s.dropmode == "sibling" && (this._sbmod || s.tid)) {
|
|
if (s.alfa && this._sbmod && this._h2.get[s.tid].childs.length) {
|
|
this.openItem(s.tid);
|
|
o = s.uid().tobj.addRowBefore(s.nid, s.data(), this._h2.get[s.tid].childs[0].id, s.img(), s.childs())
|
|
} else {
|
|
o = s.uid().tobj.addRowAfter(s.nid, s.data(), s.tid, s.img(), s.childs())
|
|
}
|
|
} else {
|
|
o = s.uid().tobj.addRow(s.nid, s.data(), s.ind(), s.pid(), s.img(), s.childs())
|
|
}
|
|
o._attrs = s.attrs();
|
|
if (s.source == "tree") {
|
|
this.callEvent("onRowAdded", [s.nid]);
|
|
var a = s.sobj._globalIdStorageFind(s.sid);
|
|
if (a.childsCount) {
|
|
var n = s.copy().set("tid", s.nid).set("dropmode", s.target == "grid" ? "sibling" : "child");
|
|
for (var h = 0; h < a.childsCount; h++) {
|
|
s.tobj._dragRoutine(n.set("sid", a.childNodes[h].id));
|
|
if (s.mode == "move") {
|
|
h--
|
|
}
|
|
}
|
|
n.close()
|
|
}
|
|
} else {
|
|
s.tobj._copyUserData(s);
|
|
this.callEvent("onRowAdded", [s.nid]);
|
|
if ((s.source == "treeGrid")) {
|
|
if (s.sobj == s.tobj) {
|
|
o._xml = s.sobj.rowsAr[s.sid]._xml
|
|
}
|
|
var m = s.sobj._h2.get[s.sid];
|
|
if ((m) && (m.childs.length)) {
|
|
var n = s.copy().set("tid", s.nid);
|
|
if (s.target == "grid") {
|
|
n.set("dropmode", "sibling")
|
|
} else {
|
|
n.tobj.openItem(s.tid);
|
|
n.set("dropmode", "child")
|
|
}
|
|
var g = m.childs.length;
|
|
for (var h = 0; h < g; h++) {
|
|
s.sobj.render_row_tree(null, m.childs[h].id);
|
|
s.tobj._dragRoutine(n.set("sid", m.childs[h].id));
|
|
if (g != m.childs.length) {
|
|
h--;
|
|
g = m.childs.length
|
|
}
|
|
}
|
|
n.close()
|
|
}
|
|
}
|
|
} if (s.mode == "move") {
|
|
s.sobj[(s.source == "tree") ? "deleteItem" : "deleteRow"](s.sid);
|
|
if ((s.sobj == s.tobj) && (!s.tobj.rowsAr[s.sid])) {
|
|
s.tobj.changeRowId(s.nid, s.sid);
|
|
s.nid = s.sid
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.gridToGrid = function(h, a, g) {
|
|
var l = new Array();
|
|
for (var c = 0; c < a.hdr.rows[0].cells.length; c++) {
|
|
l[c] = a.cells(h, c).getValue()
|
|
}
|
|
return l
|
|
};
|
|
dhtmlXGridObject.prototype.checkParentLine = function(a, c) {
|
|
if ((!this._h2) || (!c) || (!a)) {
|
|
return false
|
|
}
|
|
if (a.id == c) {
|
|
return true
|
|
} else {
|
|
return this.checkParentLine(a.parent, c)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._dragIn = function(l, g, c, m) {
|
|
if (!this.dADTempOff) {
|
|
return 0
|
|
}
|
|
var a = this.isTreeGrid();
|
|
var h = g.parentNode.idd ? g.parentNode : g.parentObject;
|
|
if (this._drag_validate) {
|
|
if (l.parentNode == g.parentNode) {
|
|
return 0
|
|
}
|
|
if ((a) && (this == h.grid) && ((this.checkParentLine(this._h2.get[l.parentNode.idd], g.parentNode.idd)))) {
|
|
return 0
|
|
}
|
|
}
|
|
if (!this.callEvent("onDragIn", [h.idd || h.id, l.parentNode.idd, h.grid || h.treeNod, (l.grid || l.parentNode.grid)])) {
|
|
return this._setMove(l, c, m, true)
|
|
}
|
|
this._setMove(l, c, m);
|
|
if ((a) && (l.parentNode.expand != "")) {
|
|
this._autoOpenTimer = window.setTimeout(new callerFunction(this._autoOpenItem, this), 1000);
|
|
this._autoOpenId = l.parentNode.idd
|
|
} else {
|
|
if (this._autoOpenTimer) {
|
|
window.clearTimeout(this._autoOpenTimer)
|
|
}
|
|
}
|
|
return l
|
|
};
|
|
dhtmlXGridObject.prototype._autoOpenItem = function(a, c) {
|
|
c.openItem(c._autoOpenId)
|
|
};
|
|
dhtmlXGridObject.prototype._dragOut = function(c) {
|
|
this._clearMove();
|
|
var a = c.parentNode.parentObject ? c.parentObject.id : c.parentNode.idd;
|
|
this.callEvent("onDragOut", [a]);
|
|
if (this._autoOpenTimer) {
|
|
window.clearTimeout(this._autoOpenTimer)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._setMove = function(m, c, o, l) {
|
|
if (!m.parentNode.idd) {
|
|
return
|
|
}
|
|
var g = getAbsoluteTop(m);
|
|
var a = getAbsoluteTop(this.objBox);
|
|
if ((g - a) > (parseInt(this.objBox.offsetHeight) - 50)) {
|
|
this.objBox.scrollTop = parseInt(this.objBox.scrollTop) + 20
|
|
}
|
|
if ((g - a + parseInt(this.objBox.scrollTop)) < (parseInt(this.objBox.scrollTop) + 30)) {
|
|
this.objBox.scrollTop = parseInt(this.objBox.scrollTop) - 20
|
|
}
|
|
if (l) {
|
|
return 0
|
|
}
|
|
if (this.dadmode == 2) {
|
|
var n = o - g + (document.body.scrollTop || document.documentElement.scrollTop) - 2 - m.offsetHeight / 2;
|
|
if ((Math.abs(n) - m.offsetHeight / 6) > 0) {
|
|
this.dadmodec = 1;
|
|
if (n < 0) {
|
|
this.dadmodefix = -1
|
|
} else {
|
|
this.dadmodefix = 1
|
|
}
|
|
} else {
|
|
this.dadmodec = 0
|
|
}
|
|
} else {
|
|
this.dadmodec = this.dadmode
|
|
} if (this.dadmodec) {
|
|
if (!this._sdrgc) {
|
|
this._createSdrgc()
|
|
}
|
|
this._sdrgc.style.display = "block";
|
|
this._sdrgc.style.top = g - a + parseInt(this.objBox.scrollTop) + ((this.dadmodefix >= 0) ? m.offsetHeight : 0) + "px"
|
|
} else {
|
|
this._llSelD = m;
|
|
if (m.parentNode.tagName == "TR") {
|
|
for (var h = 0; h < m.parentNode.childNodes.length; h++) {
|
|
var n = m.parentNode.childNodes[h];
|
|
n._bgCol = n.style.backgroundColor;
|
|
n.style.backgroundColor = "#FFCCCC"
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._clearMove = function() {
|
|
if (this._sdrgc) {
|
|
this._sdrgc.style.display = "none"
|
|
}
|
|
if ((this._llSelD) && (this._llSelD.parentNode.tagName == "TR")) {
|
|
var c = this._llSelD.parentNode.childNodes;
|
|
for (var a = 0; a < c.length; a++) {
|
|
c[a].style.backgroundColor = c[a]._bgCol
|
|
}
|
|
}
|
|
this._llSelD = null
|
|
};
|
|
dhtmlXGridObject.prototype.rowToDragElement = function(a) {
|
|
var c = this.cells(a, 0).getValue();
|
|
return c
|
|
};
|
|
dhtmlXGridObject.prototype._copyUserData = function(h) {
|
|
if (!h.tobj.UserData[h.nid] || h.tobj != h.sobj) {
|
|
h.tobj.UserData[h.nid] = new Hashtable()
|
|
} else {
|
|
return
|
|
}
|
|
var g = h.sobj.UserData[h.sid];
|
|
var a = h.tobj.UserData[h.nid];
|
|
if (g) {
|
|
a.keys = a.keys.concat(g.keys);
|
|
a.values = a.values.concat(g.values)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.moveRow = function(g, h, a, c) {
|
|
switch (h) {
|
|
case "row_sibling":
|
|
this.moveRowTo(g, a, "move", "sibling", this, c);
|
|
break;
|
|
case "up":
|
|
this.moveRowUp(g);
|
|
break;
|
|
case "down":
|
|
this.moveRowDown(g);
|
|
break
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._nonTrivialNode = function(s, r, n, o, g) {
|
|
if ((s.callEvent) && (!g)) {
|
|
if (!s.callEvent("onDrag", [o.idd, r.id, (n ? n.id : null), this, s])) {
|
|
return false
|
|
}
|
|
}
|
|
var q = o.idd;
|
|
var a = q;
|
|
while (s._idpull[a]) {
|
|
a += (new Date()).getMilliseconds().toString()
|
|
}
|
|
var l = (this.isTreeGrid() ? this.getItemImage(q) : "");
|
|
if (n) {
|
|
for (h = 0; h < r.childsCount; h++) {
|
|
if (r.childNodes[h] == n) {
|
|
break
|
|
}
|
|
}
|
|
if (h != 0) {
|
|
n = r.childNodes[h - 1]
|
|
} else {
|
|
st = "TOP";
|
|
n = ""
|
|
}
|
|
}
|
|
var c = s._attachChildNode(r, a, this.gridToTreeElement(s, a, q), "", l, l, l, "", "", n);
|
|
if (this._h2) {
|
|
var m = this._h2.get[q];
|
|
if (m.childs.length) {
|
|
for (var h = 0; h < m.childs.length; h++) {
|
|
this._nonTrivialNode(s, c, 0, this.rowsAr[m.childs[h].id], 1);
|
|
if (!this.dpcpy) {
|
|
h--
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!this.dpcpy) {
|
|
this.deleteRow(q)
|
|
}
|
|
if ((s.callEvent) && (!g)) {
|
|
s.callEvent("onDrop", [a, r.id, (n ? n.id : null), this, s])
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.gridToTreeElement = function(c, g, a) {
|
|
return this.cells(a, 0).getValue()
|
|
};
|
|
dhtmlXGridObject.prototype.treeToGridElement = function(h, l, a) {
|
|
var c = new Array();
|
|
var m = this.cellType._dhx_find("tree");
|
|
if (m == -1) {
|
|
m = 0
|
|
}
|
|
for (var g = 0; g < this.getColumnCount(); g++) {
|
|
c[c.length] = (g != m) ? (h.getUserData(l, this.getColumnId(g)) || "") : h.getItemText(l)
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXGridObject.prototype.moveRowTo = function(h, g, n, m, a, l) {
|
|
var o = new dragContext((a || this).isTreeGrid() ? "treeGrid" : "grid", (l || this).isTreeGrid() ? "treeGrid" : "grid", n, m || "sibling", h, g, a || this, l || this);
|
|
o.tobj._dragRoutine(o);
|
|
o.close();
|
|
return o.nid
|
|
};
|
|
dhtmlXGridObject.prototype.enableMercyDrag = function(a) {
|
|
this.dpcpy = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype.toPDF = function(h, r, w, u, o, C) {
|
|
var l = {
|
|
row: this.getSelectedRowId(),
|
|
col: this.getSelectedCellIndex()
|
|
};
|
|
if (l.row === null || l.col === -1) {
|
|
l = false
|
|
} else {
|
|
var c = this.cells(l.row, l.col).cell;
|
|
c.parentNode.className = c.parentNode.className.replace(" rowselected", "");
|
|
c.className = c.className.replace(" cellselected", "");
|
|
l.el = c
|
|
}
|
|
r = r || "color";
|
|
var x = r == "full_color";
|
|
var a = this;
|
|
a._asCDATA = true;
|
|
if (typeof(C) === "undefined") {
|
|
this.target = ' target="_blank"'
|
|
} else {
|
|
this.target = C
|
|
}
|
|
eXcell_ch.prototype.getContent = function() {
|
|
return this.getValue()
|
|
};
|
|
eXcell_ra.prototype.getContent = function() {
|
|
return this.getValue()
|
|
};
|
|
|
|
function A(F) {
|
|
var M = [];
|
|
for (var K = 1; K < a.hdr.rows.length; K++) {
|
|
M[K] = [];
|
|
for (var J = 0; J < a._cCount; J++) {
|
|
var O = a.hdr.rows[K].childNodes[J];
|
|
if (!M[K][J]) {
|
|
M[K][J] = [0, 0]
|
|
}
|
|
if (O) {
|
|
M[K][O._cellIndexS] = [O.colSpan, O.rowSpan]
|
|
}
|
|
}
|
|
}
|
|
var L = "<rows profile='" + F + "'";
|
|
if (w) {
|
|
L += " header='" + w + "'"
|
|
}
|
|
if (u) {
|
|
L += " footer='" + u + "'"
|
|
}
|
|
L += "><head>" + a._serialiseExportConfig(M).replace(/^<head/, "<columns").replace(/head>$/, "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 += "<column" + P + "><![CDATA[" + E + "]]></column>"
|
|
}
|
|
if (D != a._cCount) {
|
|
L += "\n<columns>" + N + "</columns>"
|
|
}
|
|
}
|
|
L += "</head>\n";
|
|
L += q();
|
|
return L
|
|
}
|
|
|
|
function g() {
|
|
var D = [];
|
|
if (o) {
|
|
for (var E = 0; E < o.length; E++) {
|
|
D.push(v(a.getRowIndex(o[E])))
|
|
}
|
|
} else {
|
|
for (var E = 0; E < a.getRowsNum(); E++) {
|
|
D.push(v(E))
|
|
}
|
|
}
|
|
return D.join("\n")
|
|
}
|
|
|
|
function q() {
|
|
var F = ["<foot>"];
|
|
if (!a.ftr) {
|
|
return ""
|
|
}
|
|
for (var H = 1; H < a.ftr.rows.length; H++) {
|
|
F.push("<columns>");
|
|
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("<column" + I + "><![CDATA[" + J + "]]></column>")
|
|
}
|
|
F.push("</columns>")
|
|
}
|
|
F.push("</foot>");
|
|
return F.join("\n")
|
|
}
|
|
|
|
function n(E, D) {
|
|
return (window.getComputedStyle ? (window.getComputedStyle(E, null)[D]) : (E.currentStyle ? E.currentStyle[D] : null)) || ""
|
|
}
|
|
|
|
function v(H) {
|
|
if (!a.rowsBuffer[H]) {
|
|
return ""
|
|
}
|
|
var D = a.render_row(H);
|
|
if (D.style.display == "none") {
|
|
return ""
|
|
}
|
|
var E = a.isTreeGrid() ? ' level="' + a.getLevel(D.idd) + '"' : "";
|
|
var L = "<row" + E + ">";
|
|
for (var J = 0; J < a._cCount; J++) {
|
|
if (((!a._srClmn) || (a._srClmn[J])) && (!a._hrrar[J] || (a._fake && J < a._fake.hdrLabels.length))) {
|
|
var P = a.cells(D.idd, J);
|
|
if (x) {
|
|
var I = n(P.cell, "color");
|
|
var O = n(P.cell, "backgroundColor");
|
|
var N = n(P.cell, "font-weight") || n(P.cell, "fontWeight");
|
|
var K = n(P.cell, "font-style") || n(P.cell, "fontStyle");
|
|
var M = n(P.cell, "text-align") || n(P.cell, "textAlign");
|
|
var F = n(P.cell, "font-family") || n(P.cell, "fontFamily");
|
|
if (O == "transparent" || O == "rgba(0, 0, 0, 0)") {
|
|
O = "rgb(255,255,255)"
|
|
}
|
|
L += "<cell bgColor='" + O + "' textColor='" + I + "' bold='" + N + "' italic='" + K + "' align='" + M + "' font='" + F + "'>"
|
|
} else {
|
|
L += "<cell>"
|
|
}
|
|
L += "<![CDATA[" + (P.getContent ? P.getContent() : P.getTitle()) + "]]></cell>"
|
|
}
|
|
}
|
|
return L + "</row>"
|
|
}
|
|
|
|
function s() {
|
|
var D = "</rows>";
|
|
return D
|
|
}
|
|
var y = document.createElement("div");
|
|
y.style.display = "none";
|
|
document.body.appendChild(y);
|
|
var m = "form_" + a.uid();
|
|
y.innerHTML = '<form id="' + m + '" method="post" action="' + h + '" accept-charset="utf-8" enctype="application/x-www-form-urlencoded"' + this.target + '><input type="hidden" name="grid_xml" id="grid_xml"/> </form>';
|
|
document.getElementById(m).firstChild.value = encodeURIComponent(A(r).replace("\u2013", "-") + g() + s());
|
|
document.getElementById(m).submit();
|
|
y.parentNode.removeChild(y);
|
|
a = null;
|
|
if (l) {
|
|
l.el.parentNode.className += " rowselected";
|
|
l.el.className += " cellselected"
|
|
}
|
|
l = null
|
|
};
|
|
dhtmlXGridObject.prototype._serialiseExportConfig = function(m) {
|
|
function l(r) {
|
|
if (typeof(r) !== "string") {
|
|
return r
|
|
}
|
|
r = r.replace(/&/g, "&");
|
|
r = r.replace(/"/g, """);
|
|
r = r.replace(/'/g, "'");
|
|
r = r.replace(/</g, "<");
|
|
r = r.replace(/>/g, ">");
|
|
return r
|
|
}
|
|
var c = "<head>";
|
|
for (var g = 0; g < this.hdr.rows[0].cells.length; g++) {
|
|
if (this._srClmn && !this._srClmn[g]) {
|
|
continue
|
|
}
|
|
if (this._hrrar[g] && (!this._fake || g >= this._fake.hdrLabels.length)) {
|
|
continue
|
|
}
|
|
var h = this.fldSort[g];
|
|
if (h == "cus") {
|
|
h = this._customSorts[g].toString();
|
|
h = h.replace(/function[\ ]*/, "").replace(/\([^\f]*/, "")
|
|
}
|
|
var q = m[1][g];
|
|
var n = ((q[1] && q[1] > 1) ? ' rowspan="' + q[1] + '" ' : "") + ((q[0] && q[0] > 1) ? ' colspan="' + q[0] + '" ' : "");
|
|
c += "<column " + n + " width='" + this.getColWidth(g) + "' align='" + this.cellAlign[g] + "' type='" + this.cellType[g] + "' hidden='" + ((this.isColumnHidden && this.isColumnHidden(g)) ? "true" : "false") + "' sort='" + (h || "na") + "' color='" + (this.columnColor[g] || "") + "'" + (this.columnIds[g] ? (" id='" + this.columnIds[g] + "'") : "") + ">";
|
|
if (this._asCDATA) {
|
|
c += "<![CDATA[" + this.getHeaderCol(g) + "]]>"
|
|
} else {
|
|
c += this.getHeaderCol(g)
|
|
}
|
|
var o = this.combos[g] ? this.getCombo(g) : null;
|
|
if (o) {
|
|
for (var a = 0; a < o.keys.length; a++) {
|
|
c += "<option value='" + l(o.keys[a]) + "'><![CDATA[" + o.values[a] + "]]></option>"
|
|
}
|
|
}
|
|
c += "</column>"
|
|
}
|
|
return c += "</head>"
|
|
};
|
|
if (window.eXcell_sub_row_grid) {
|
|
window.eXcell_sub_row_grid.prototype.getContent = function() {
|
|
return ""
|
|
}
|
|
}
|
|
dhtmlXGridObject.prototype.toExcel = function(a, h, n, m, c) {
|
|
if (!document.getElementById("ifr")) {
|
|
var l = document.createElement("iframe");
|
|
l.style.display = "none";
|
|
l.setAttribute("name", "dhx_export_iframe");
|
|
l.setAttribute("src", "");
|
|
l.setAttribute("id", "dhx_export_iframe");
|
|
document.body.appendChild(l)
|
|
}
|
|
var g = ' target="dhx_export_iframe"';
|
|
this.toPDF(a, h, n, m, c, g)
|
|
};
|
|
dhtmlXGridObject.prototype.filterBy = function(g, h, c) {
|
|
if (this.isTreeGrid()) {
|
|
return this.filterTreeBy(g, h, c)
|
|
}
|
|
if (this._f_rowsBuffer) {
|
|
if (!c) {
|
|
this.rowsBuffer = dhtmlxArray([].concat(this._f_rowsBuffer));
|
|
if (this._fake) {
|
|
this._fake.rowsBuffer = this.rowsBuffer
|
|
}
|
|
}
|
|
} else {
|
|
this._f_rowsBuffer = [].concat(this.rowsBuffer)
|
|
} if (!this.rowsBuffer.length) {
|
|
return
|
|
}
|
|
var l = true;
|
|
this.dma(true);
|
|
if (typeof(g) == "object") {
|
|
for (var a = 0; a < h.length; a++) {
|
|
this._filterA(g[a], h[a])
|
|
}
|
|
} else {
|
|
this._filterA(g, h)
|
|
}
|
|
this.dma(false);
|
|
if (this.pagingOn && this.rowsBuffer.length / this.rowsBufferOutSize < (this.currentPage - 1)) {
|
|
this.changePage(0)
|
|
}
|
|
this._reset_view();
|
|
this.callEvent("onGridReconstructed", [])
|
|
};
|
|
dhtmlXGridObject.prototype._filterA = function(c, g) {
|
|
if (g == "") {
|
|
return
|
|
}
|
|
var h = true;
|
|
if (typeof(g) == "function") {
|
|
h = false
|
|
} else {
|
|
g = (g || "").toString().toLowerCase()
|
|
} if (!this.rowsBuffer.length) {
|
|
return
|
|
}
|
|
for (var a = this.rowsBuffer.length - 1; a >= 0; a--) {
|
|
if (h ? (this._get_cell_value(this.rowsBuffer[a], c).toString().toLowerCase().indexOf(g) == -1) : (!g.call(this, this._get_cell_value(this.rowsBuffer[a], c), this.rowsBuffer[a].idd))) {
|
|
this.rowsBuffer.splice(a, 1)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.getFilterElement = function(a) {
|
|
if (!this.filters) {
|
|
return
|
|
}
|
|
for (var c = 0; c < this.filters.length; c++) {
|
|
if (this.filters[c][1] == a) {
|
|
return (this.filters[c][0].combo || this.filters[c][0])
|
|
}
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXGridObject.prototype.collectValues = function(h) {
|
|
var r = this.callEvent("onCollectValues", [h]);
|
|
if (r !== true) {
|
|
return r
|
|
}
|
|
if (this.isTreeGrid()) {
|
|
return this.collectTreeValues(h)
|
|
}
|
|
this.dma(true);
|
|
this._build_m_order();
|
|
h = this._m_order ? this._m_order[h] : h;
|
|
var o = {};
|
|
var m = [];
|
|
var g = this._f_rowsBuffer || this.rowsBuffer;
|
|
for (var l = 0; l < g.length; l++) {
|
|
var a = this._get_cell_value(g[l], h);
|
|
if (a && (!g[l]._childIndexes || g[l]._childIndexes[h] != g[l]._childIndexes[h - 1])) {
|
|
o[a] = true
|
|
}
|
|
}
|
|
this.dma(false);
|
|
var q = (this.combos[h] || (this._col_combos ? this._col_combos[h] : false));
|
|
for (var n in o) {
|
|
if (o[n] === true) {
|
|
if (q) {
|
|
if (q.get && q.get(n)) {
|
|
n = q.get(n)
|
|
} else {
|
|
if (q.getOption && q.getOption(n)) {
|
|
n = q.getOption(n).text
|
|
}
|
|
}
|
|
}
|
|
m.push(n)
|
|
}
|
|
}
|
|
return m.sort()
|
|
};
|
|
dhtmlXGridObject.prototype._build_m_order = function() {
|
|
if (this._c_order) {
|
|
this._m_order = [];
|
|
for (var a = 0; a < this._c_order.length; a++) {
|
|
this._m_order[this._c_order[a]] = a
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.filterByAll = function() {
|
|
var g = [];
|
|
var c = [];
|
|
this._build_m_order();
|
|
for (var h = 0; h < this.filters.length; h++) {
|
|
var m = this._m_order ? this._m_order[this.filters[h][1]] : this.filters[h][1];
|
|
if (m >= this._cCount) {
|
|
continue
|
|
}
|
|
c.push(m);
|
|
var n = this.filters[h][0].old_value = this.filters[h][0].value;
|
|
if (this.filters[h][0]._filter) {
|
|
n = this.filters[h][0]._filter()
|
|
}
|
|
var l;
|
|
if (typeof n != "function" && (l = (this.combos[m] || (this._col_combos ? this._col_combos[m] : false)))) {
|
|
if (l.values) {
|
|
m = l.values._dhx_find(n);
|
|
n = (m == -1) ? n : l.keys[m]
|
|
} else {
|
|
if (l.getOptionByLabel) {
|
|
n = (l.getOptionByLabel(n) ? l.getOptionByLabel(n).value : n)
|
|
}
|
|
}
|
|
}
|
|
g.push(n)
|
|
}
|
|
if (!this.callEvent("onFilterStart", [c, g])) {
|
|
return
|
|
}
|
|
this.filterBy(c, g);
|
|
if (this._cssEven) {
|
|
this._fixAlterCss()
|
|
}
|
|
this.callEvent("onFilterEnd", [this.filters]);
|
|
if (this._f_rowsBuffer && this.rowsBuffer.length == this._f_rowsBuffer.length) {
|
|
this._f_rowsBuffer = null
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.makeFilter = function(l, g, c) {
|
|
if (!this.filters) {
|
|
this.filters = []
|
|
}
|
|
if (typeof(l) != "object") {
|
|
l = document.getElementById(l)
|
|
}
|
|
if (!l) {
|
|
return
|
|
}
|
|
var a = this;
|
|
if (!l.style.width) {
|
|
l.style.width = "90%"
|
|
}
|
|
if (l.tagName == "SELECT") {
|
|
this.filters.push([l, g]);
|
|
this._loadSelectOptins(l, g);
|
|
l.onchange = function() {
|
|
a.filterByAll()
|
|
};
|
|
if (_isIE) {
|
|
l.style.marginTop = "1px"
|
|
}
|
|
this.attachEvent("onEditCell", function(n, m, o) {
|
|
this._build_m_order();
|
|
if (n == 2 && this.filters && (this._m_order ? (o == this._m_order[g]) : (o == g))) {
|
|
this._loadSelectOptins(l, g)
|
|
}
|
|
return true
|
|
})
|
|
} else {
|
|
if (l.tagName == "INPUT") {
|
|
this.filters.push([l, g]);
|
|
l.old_value = l.value = "";
|
|
l.onkeydown = function() {
|
|
if (this._timer) {
|
|
window.clearTimeout(this._timer)
|
|
}
|
|
this._timer = window.setTimeout(function() {
|
|
if (l.value != l.old_value) {
|
|
a.filterByAll();
|
|
l.old_value = l.value
|
|
}
|
|
}, 500)
|
|
}
|
|
} else {
|
|
if (l.tagName == "DIV" && l.className == "combo") {
|
|
this.filters.push([l, g]);
|
|
l.style.padding = "0px";
|
|
l.style.margin = "0px";
|
|
if (!window.dhx_globalImgPath) {
|
|
window.dhx_globalImgPath = this.imgURL
|
|
}
|
|
var h = new dhtmlXCombo(l, "_filter", "90%");
|
|
h.filterSelfA = h.filterSelf;
|
|
h.filterSelf = function() {
|
|
if (this.getSelectedIndex() == 0) {
|
|
this.setComboText("")
|
|
}
|
|
this.filterSelfA.apply(this, arguments);
|
|
this.optionsArr[0].hide(false)
|
|
};
|
|
h.enableFilteringMode(true);
|
|
l.combo = h;
|
|
l.value = "";
|
|
this._loadComboOptins(l, g);
|
|
h.attachEvent("onChange", function() {
|
|
l.value = h.getSelectedValue();
|
|
if (l.value === null) {
|
|
l.value = ""
|
|
}
|
|
a.filterByAll()
|
|
})
|
|
}
|
|
}
|
|
} if (l.parentNode) {
|
|
l.parentNode.className += " filter"
|
|
}
|
|
this._filters_ready()
|
|
};
|
|
dhtmlXGridObject.prototype.findCell = function(m, n, h, l) {
|
|
var l = l || (function(q, o) {
|
|
return o.toString().toLowerCase().indexOf(q) != -1
|
|
});
|
|
if (l === true) {
|
|
l = function(q, o) {
|
|
return o.toString().toLowerCase() == q
|
|
}
|
|
}
|
|
var g = new Array();
|
|
m = m.toString().toLowerCase();
|
|
if (typeof h != "number") {
|
|
h = h ? 1 : 0
|
|
}
|
|
if (!this.rowsBuffer.length) {
|
|
return g
|
|
}
|
|
for (var c = (n || 0); c < this._cCount; c++) {
|
|
if (this._h2) {
|
|
this._h2.forEachChild(0, function(o) {
|
|
if (h && g.length == h) {
|
|
return g
|
|
}
|
|
if (l(m, this._get_cell_value(o.buff, c))) {
|
|
g.push([o.id, c])
|
|
}
|
|
}, this)
|
|
} else {
|
|
for (var a = 0; a < this.rowsBuffer.length; a++) {
|
|
if (l(m, this._get_cell_value(this.rowsBuffer[a], c))) {
|
|
g.push([this.rowsBuffer[a].idd, c]);
|
|
if (h && g.length == h) {
|
|
return g
|
|
}
|
|
}
|
|
}
|
|
} if (typeof(n) != "undefined") {
|
|
return g
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXGridObject.prototype.makeSearch = function(h, g, a) {
|
|
if (typeof(h) != "object") {
|
|
h = document.getElementById(h)
|
|
}
|
|
if (!h) {
|
|
return
|
|
}
|
|
var c = this;
|
|
if (h.tagName == "INPUT") {
|
|
h.onkeypress = function() {
|
|
if (this._timer) {
|
|
window.clearTimeout(this._timer)
|
|
}
|
|
this._timer = window.setTimeout(function() {
|
|
if (h.value == "") {
|
|
return
|
|
}
|
|
var l = c.findCell(h.value, g, true, a);
|
|
if (l.length) {
|
|
if (c._h2) {
|
|
c.openItem(l[0][0])
|
|
}
|
|
c.selectCell(c.getRowIndex(l[0][0]), (g || 0))
|
|
}
|
|
}, 500)
|
|
}
|
|
}
|
|
if (h.parentNode) {
|
|
h.parentNode.className += " filter"
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._loadSelectOptins = function(m, o) {
|
|
var a = this.collectValues(o);
|
|
var g = m.value;
|
|
m.innerHTML = "";
|
|
m.options[0] = new Option("", "");
|
|
var n = this._filter_tr ? this._filter_tr[o] : null;
|
|
for (var h = 0; h < a.length; h++) {
|
|
m.options[m.options.length] = new Option(n ? n(a[h]) : a[h], a[h])
|
|
}
|
|
m.value = g
|
|
};
|
|
dhtmlXGridObject.prototype.setSelectFilterLabel = function(c, a) {
|
|
if (!this._filter_tr) {
|
|
this._filter_tr = []
|
|
}
|
|
this._filter_tr[c] = a
|
|
};
|
|
dhtmlXGridObject.prototype._loadComboOptins = function(h, n) {
|
|
if (!h.combo) {
|
|
return
|
|
}
|
|
var a = this.collectValues(n);
|
|
h.combo.clearAll();
|
|
var m = [
|
|
["", ""]
|
|
];
|
|
for (var g = 0; g < a.length; g++) {
|
|
m.push([a[g], a[g]])
|
|
}
|
|
h.combo.addOption(m)
|
|
};
|
|
dhtmlXGridObject.prototype.refreshFilters = function() {
|
|
if (!this.filters) {
|
|
return
|
|
}
|
|
for (var a = 0; a < this.filters.length; a++) {
|
|
switch (this.filters[a][0].tagName.toLowerCase()) {
|
|
case "input":
|
|
break;
|
|
case "select":
|
|
this._loadSelectOptins.apply(this, this.filters[a]);
|
|
break;
|
|
case "div":
|
|
this._loadComboOptins.apply(this, this.filters[a]);
|
|
break
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._filters_ready = function(c, a) {
|
|
this.attachEvent("onXLE", this.refreshFilters);
|
|
this.attachEvent("onRowCreated", function(l, h) {
|
|
if (this._f_rowsBuffer) {
|
|
for (var g = 0; g < this._f_rowsBuffer.length; g++) {
|
|
if (this._f_rowsBuffer[g].idd == l) {
|
|
return this._f_rowsBuffer[g] = h
|
|
}
|
|
}
|
|
}
|
|
});
|
|
this.attachEvent("onClearAll", function() {
|
|
this._f_rowsBuffer = null;
|
|
if (!this.hdr.rows.length) {
|
|
this.filters = []
|
|
}
|
|
});
|
|
this.attachEvent("onSetSizes", this._filters_resize_combo);
|
|
this.attachEvent("onResize", this._filters_resize_combo);
|
|
this._filters_ready = function() {}
|
|
};
|
|
dhtmlXGridObject.prototype._filters_resize_combo = function() {
|
|
if (!this.filters) {
|
|
return
|
|
}
|
|
for (var a = 0; a < this.filters.length; a++) {
|
|
if (this.filters[a][0].combo != null) {
|
|
this.filters[a][0].combo.setSize(Math.round(this.filters[a][0].offsetWidth * 90 / 100))
|
|
}
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_text_filter = function(c, a) {
|
|
c.innerHTML = "<input type='text'>";
|
|
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 = "<input type='text'>";
|
|
c.onclick = c.onmousedown = function(g) {
|
|
(g || event).cancelBubble = true;
|
|
return true
|
|
};
|
|
c.onselectstart = function() {
|
|
return (event.cancelBubble = true)
|
|
};
|
|
this.makeFilter(c.firstChild, a);
|
|
c.firstChild._filter = function() {
|
|
if (c.firstChild.value == "") {
|
|
return ""
|
|
}
|
|
return function(g) {
|
|
return (g.toString().toLowerCase().indexOf(c.firstChild.value.toLowerCase()) == 0)
|
|
}
|
|
};
|
|
this._filters_ready()
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_select_filter = function(c, a) {
|
|
c.innerHTML = "<select></select>";
|
|
c.onclick = function(g) {
|
|
(g || event).cancelBubble = true;
|
|
return false
|
|
};
|
|
this.makeFilter(c.firstChild, a)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_select_filter_strict = function(g, c) {
|
|
g.innerHTML = "<select style='width:90%; font-size:8pt; font-family:Tahoma;'></select>";
|
|
g.onclick = function(h) {
|
|
(h || event).cancelBubble = true;
|
|
return false
|
|
};
|
|
this.makeFilter(g.firstChild, c);
|
|
var a = this.combos;
|
|
g.firstChild._filter = function() {
|
|
var h = g.firstChild.value;
|
|
if (!h) {
|
|
return ""
|
|
}
|
|
if (a[c]) {
|
|
h = a[c].keys[a[c].values._dhx_find(h)]
|
|
}
|
|
h = h.toLowerCase();
|
|
return function(l) {
|
|
return (l.toString().toLowerCase() == h)
|
|
}
|
|
};
|
|
this._filters_ready()
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_combo_filter = function(c, a) {
|
|
c.innerHTML = "<div style='width:100%; padding-left:2px; overflow:hidden; ' class='combo'></div>";
|
|
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 = "<input type='text' style='width:90%; '>";
|
|
c.onclick = c.onmousedown = function(g) {
|
|
(g || event).cancelBubble = true;
|
|
return true
|
|
};
|
|
c.onselectstart = function() {
|
|
return (event.cancelBubble = true)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_text_search = function(g, c, a) {
|
|
this._search_common(g, c);
|
|
this.makeSearch(g.firstChild, c)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_text_search_strict = function(c, a) {
|
|
this._search_common(c, a);
|
|
this.makeSearch(c.firstChild, a, true)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_numeric_filter = function(c, a) {
|
|
this._in_header_text_filter.call(this, c, a);
|
|
c.firstChild._filter = function() {
|
|
var g = this.value;
|
|
var l;
|
|
var n = "==";
|
|
var h = parseFloat(g.replace("=", ""));
|
|
var m = null;
|
|
if (g) {
|
|
if (g.indexOf("..") != -1) {
|
|
g = g.split("..");
|
|
h = parseFloat(g[0]);
|
|
m = parseFloat(g[1]);
|
|
return function(o) {
|
|
if (o >= h && o <= m) {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
}
|
|
l = g.match(/>=|<=|>|</);
|
|
if (l) {
|
|
n = l[0];
|
|
h = parseFloat(g.replace(n, ""))
|
|
}
|
|
return Function("v", " if (v " + n + " " + h + " ) return true; return false;")
|
|
}
|
|
return ""
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_master_checkbox = function(h, g, l) {
|
|
h.innerHTML = l[0] + "<input type='checkbox' />" + l[1];
|
|
var a = this;
|
|
h.getElementsByTagName("input")[0].onclick = function(m) {
|
|
a._build_m_order();
|
|
var c = a._m_order ? a._m_order[g] : g;
|
|
var n = this.checked ? 1 : 0;
|
|
a.forEachRowA(function(q) {
|
|
var o = this.cells(q, c);
|
|
if (o.isCheckbox()) {
|
|
o.setValue(n);
|
|
o.cell.wasChanged = true
|
|
}
|
|
this.callEvent("onEditCell", [1, q, c, n]);
|
|
this.callEvent("onCheckbox", [q, c, n])
|
|
});
|
|
(m || event).cancelBubble = true
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_total = function(g, a, l) {
|
|
var h = function() {
|
|
var o = 0;
|
|
this._build_m_order();
|
|
var n = this._m_order ? this._m_order[a] : a;
|
|
for (var m = 0; m < this.rowsBuffer.length; m++) {
|
|
var c = parseFloat(this._get_cell_value(this.rowsBuffer[m], n));
|
|
o += isNaN(c) ? 0 : c
|
|
}
|
|
return this._maskArr[n] ? this._aplNF(o, n) : (Math.round(o * 100) / 100)
|
|
};
|
|
this._stat_in_header(g, h, a, l, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_multi_total = function(l, h, q) {
|
|
var o = q[1].split(":");
|
|
q[1] = "";
|
|
for (var g = 0; g < o.length; g++) {
|
|
o[g] = parseInt(o[g])
|
|
}
|
|
var m = function() {
|
|
var u = 0;
|
|
for (var s = 0; s < this.rowsBuffer.length; s++) {
|
|
var r = 1;
|
|
for (var c = 0; c < o.length; c++) {
|
|
r *= parseFloat(this._get_cell_value(this.rowsBuffer[s], o[c]))
|
|
}
|
|
u += isNaN(r) ? 0 : r
|
|
}
|
|
return this._maskArr[h] ? this._aplNF(u, h) : (Math.round(u * 100) / 100)
|
|
};
|
|
var a = [];
|
|
for (var n = 0; n < o.length; n++) {
|
|
a[o[n]] = true
|
|
}
|
|
this._stat_in_header(l, m, a, q, q)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_max = function(g, a, l) {
|
|
var h = function() {
|
|
this._build_m_order();
|
|
var m = this._m_order ? this._m_order[a] : a;
|
|
var n = -999999999;
|
|
if (this.getRowsNum() == 0) {
|
|
return " "
|
|
}
|
|
for (var c = 0; c < this.rowsBuffer.length; c++) {
|
|
n = Math.max(n, parseFloat(this._get_cell_value(this.rowsBuffer[c], m)))
|
|
}
|
|
return this._maskArr[a] ? this._aplNF(n, a) : n
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_min = function(g, a, l) {
|
|
var h = function() {
|
|
this._build_m_order();
|
|
var m = this._m_order ? this._m_order[a] : a;
|
|
var n = 999999999;
|
|
if (this.getRowsNum() == 0) {
|
|
return " "
|
|
}
|
|
for (var c = 0; c < this.rowsBuffer.length; c++) {
|
|
n = Math.min(n, parseFloat(this._get_cell_value(this.rowsBuffer[c], m)))
|
|
}
|
|
return this._maskArr[a] ? this._aplNF(n, a) : n
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_average = function(g, a, l) {
|
|
var h = function() {
|
|
this._build_m_order();
|
|
var n = this._m_order ? this._m_order[a] : a;
|
|
var q = 0;
|
|
var o = 0;
|
|
if (this.getRowsNum() == 0) {
|
|
return " "
|
|
}
|
|
for (var m = 0; m < this.rowsBuffer.length; m++) {
|
|
var c = parseFloat(this._get_cell_value(this.rowsBuffer[m], n));
|
|
q += isNaN(c) ? 0 : c;
|
|
o++
|
|
}
|
|
return this._maskArr[a] ? this._aplNF(q / o, a) : (Math.round(q / o * 100) / 100)
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_count = function(g, a, l) {
|
|
var h = function() {
|
|
return this.getRowsNum()
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._stat_in_header = function(g, h, a, n) {
|
|
var l = this;
|
|
var m = function() {
|
|
this.dma(true);
|
|
g.innerHTML = (n[0] ? n[0] : "") + h.call(this) + (n[1] ? n[1] : "");
|
|
this.dma(false);
|
|
this.callEvent("onStatReady", [])
|
|
};
|
|
if (!this._stat_events) {
|
|
this._stat_events = [];
|
|
this.attachEvent("onClearAll", function() {
|
|
if (!this.hdr.rows[1]) {
|
|
for (var o = 0; o < this._stat_events.length; o++) {
|
|
for (var c = 0; c < 4; c++) {
|
|
this.detachEvent(this._stat_events[o][c])
|
|
}
|
|
}
|
|
this._stat_events = []
|
|
}
|
|
})
|
|
}
|
|
this._stat_events.push([this.attachEvent("onGridReconstructed", m), this.attachEvent("onXLE", m), this.attachEvent("onFilterEnd", m), this.attachEvent("onEditCell", function(c, q, o) {
|
|
if (c == 2 && (o == a || (a && a[o]))) {
|
|
m.call(this)
|
|
}
|
|
return true
|
|
})]);
|
|
g.innerHTML = ""
|
|
};
|
|
dhtmlXGridObject.prototype.loadCSVFile = function(c, a) {
|
|
this.load(c, a, "csv")
|
|
};
|
|
dhtmlXGridObject.prototype.enableCSVAutoID = function(a) {
|
|
this._csvAID = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype.enableCSVHeader = function(a) {
|
|
this._csvHdr = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype.setCSVDelimiter = function(a) {
|
|
this.csv.cell = a
|
|
};
|
|
dhtmlXGridObject.prototype._csvAID = true;
|
|
dhtmlXGridObject.prototype.loadCSVString = function(a) {
|
|
this.parse(a, "csv")
|
|
};
|
|
dhtmlXGridObject.prototype.serializeToCSV = function(o) {
|
|
this.editStop();
|
|
if (this._mathSerialization) {
|
|
this._agetm = "getMathValue"
|
|
} else {
|
|
if (this._strictText || o) {
|
|
this._agetm = "getTitle"
|
|
} else {
|
|
this._agetm = "getValue"
|
|
}
|
|
}
|
|
var m = [];
|
|
if (this._csvHdr) {
|
|
for (var l = 1; l < this.hdr.rows.length; l++) {
|
|
var c = [];
|
|
for (var n = 0; n < this._cCount; n++) {
|
|
if ((!this._srClmn) || (this._srClmn[n])) {
|
|
c.push(this.getColumnLabel(n, l - 1))
|
|
}
|
|
}
|
|
m.push(this.csvParser.str(c, this.csv.cell, this.csv.row))
|
|
}
|
|
}
|
|
var n = 0;
|
|
var h = this.rowsBuffer.length;
|
|
for (n; n < h; n++) {
|
|
var g = this._serializeRowToCVS(null, n);
|
|
if (g != "") {
|
|
m.push(g)
|
|
}
|
|
}
|
|
return this.csvParser.block(m, this.csv.row)
|
|
};
|
|
dhtmlXGridObject.prototype._serializeRowToCVS = function(a, q, g, n) {
|
|
var o = new Array();
|
|
if (!a) {
|
|
a = this.render_row(q);
|
|
if (this._fake && !this._fake.rowsAr[a.idd]) {
|
|
this._fake.render_row(q)
|
|
}
|
|
}
|
|
if (!this._csvAID) {
|
|
o[o.length] = a.idd
|
|
}
|
|
g = g || 0;
|
|
n = n || this._cCount;
|
|
var v = false;
|
|
var h = g;
|
|
while (a.childNodes[g]._cellIndex > h && g) {
|
|
g--
|
|
}
|
|
for (var s = g; h < n; s++) {
|
|
if (!a.childNodes[s]) {
|
|
break
|
|
}
|
|
var c = a.childNodes[s]._cellIndex;
|
|
if (((!this._srClmn) || (this._srClmn[c])) && (!this._serialize_visible || !this._hrrar[c])) {
|
|
var l = a.childNodes[s];
|
|
var m = this.cells(a.idd, c);
|
|
while (h != c) {
|
|
h++;
|
|
o.push("");
|
|
if (h >= n) {
|
|
break
|
|
}
|
|
}
|
|
if (h >= n) {
|
|
break
|
|
}
|
|
h++;
|
|
if (m.cell) {
|
|
zxVal = m[this._agetm]()
|
|
} else {
|
|
zxVal = ""
|
|
} if ((this._chAttr) && (m.wasChanged())) {
|
|
v = true
|
|
}
|
|
o[o.length] = ((zxVal === null) ? "" : zxVal);
|
|
if (this._ecspn && l.colSpan && l.colSpan > 1) {
|
|
l = l.colSpan - 1;
|
|
for (var w = 0; w < l; w++) {
|
|
o[o.length] = "";
|
|
h++
|
|
}
|
|
}
|
|
} else {
|
|
h++
|
|
}
|
|
}
|
|
if ((this._onlChAttr) && (!v)) {
|
|
return ""
|
|
}
|
|
return this.csvParser.str(o, this.csv.cell, this.csv.row)
|
|
};
|
|
dhtmlXGridObject.prototype.toClipBoard = function(a) {
|
|
if (window.clipboardData) {
|
|
window.clipboardData.setData("Text", a)
|
|
} else {
|
|
(new Clipboard()).copy(a)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.fromClipBoard = function() {
|
|
if (window.clipboardData) {
|
|
return window.clipboardData.getData("Text")
|
|
} else {
|
|
return (new Clipboard()).paste()
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.cellToClipboard = function(g, c) {
|
|
if ((!g) || (!c)) {
|
|
if (!this.selectedRows[0]) {
|
|
return
|
|
}
|
|
g = this.selectedRows[0].idd;
|
|
c = this.cell._cellIndex
|
|
}
|
|
var a = this.cells(g, c);
|
|
this.toClipBoard(((a.getLabel ? a.getLabel() : a.getValue()) || "").toString())
|
|
};
|
|
dhtmlXGridObject.prototype.updateCellFromClipboard = function(g, c) {
|
|
if ((!g) || (!c)) {
|
|
if (!this.selectedRows[0]) {
|
|
return
|
|
}
|
|
g = this.selectedRows[0].idd;
|
|
c = this.cell._cellIndex
|
|
}
|
|
var a = this.cells(g, c);
|
|
a[a.setImage ? "setLabel" : "setValue"](this.fromClipBoard())
|
|
};
|
|
dhtmlXGridObject.prototype.rowToClipboard = function(h) {
|
|
var a = "";
|
|
if (this._mathSerialization) {
|
|
this._agetm = "getMathValue"
|
|
} else {
|
|
if (this._strictText) {
|
|
this._agetm = "getTitle"
|
|
} else {
|
|
this._agetm = "getValue"
|
|
}
|
|
}
|
|
this._serialize_visible = true;
|
|
if (h) {
|
|
a = this._serializeRowToCVS(this.getRowById(h))
|
|
} else {
|
|
var g = [];
|
|
for (var c = 0; c < this.selectedRows.length; c++) {
|
|
g[g.length] = this._serializeRowToCVS(this.selectedRows[c]);
|
|
a = this.csvParser.block(g, this.csv.row)
|
|
}
|
|
}
|
|
this._serialize_visible = false;
|
|
this.toClipBoard(a)
|
|
};
|
|
dhtmlXGridObject.prototype.updateRowFromClipboard = function(l) {
|
|
var a = this.fromClipBoard();
|
|
if (!a) {
|
|
return
|
|
}
|
|
if (l) {
|
|
var h = this.getRowById(l)
|
|
} else {
|
|
var h = this.selectedRows[0]
|
|
} if (!h) {
|
|
return
|
|
}
|
|
var m = this.csvParser;
|
|
a = m.unblock(a, this.csv.cell, this.csv.row)[0];
|
|
if (!this._csvAID) {
|
|
a.splice(0, 1)
|
|
}
|
|
for (var g = 0; g < a.length; g++) {
|
|
var c = this.cells3(h, g);
|
|
c[c.setImage ? "setLabel" : "setValue"](a[g])
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.csvParser = {
|
|
block: function(a, c) {
|
|
return a.join(c)
|
|
},
|
|
unblock: function(m, a, l) {
|
|
var h = (m || "").split(l);
|
|
for (var c = 0; c < h.length; c++) {
|
|
h[c] = (h[c] || "").split(a)
|
|
}
|
|
var g = h.length - 1;
|
|
if (h[g].length == 1 && h[g][0] == "") {
|
|
h.splice(g, 1)
|
|
}
|
|
return h
|
|
},
|
|
str: function(c, a, g) {
|
|
return c.join(a)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.csvExtParser = {
|
|
_quote: RegExp('"', "g"),
|
|
_quote_esc: RegExp('\\\\"', "g"),
|
|
block: function(a, c) {
|
|
return a.join(c)
|
|
},
|
|
unblock: function(o, s, v) {
|
|
var g = [
|
|
[]
|
|
];
|
|
var c = 0;
|
|
if (!o) {
|
|
return g
|
|
}
|
|
var q = /^[ ]*"/;
|
|
var n = /"[ ]*$/;
|
|
var a = new RegExp(".*" + v + ".*$");
|
|
var l = o.split(s);
|
|
for (var h = 0; h < l.length; h++) {
|
|
if (l[h].match(q)) {
|
|
var u = l[h].replace(q, "");
|
|
while (!l[h].match(n)) {
|
|
h++;
|
|
u += l[h]
|
|
}
|
|
g[c].push(u.replace(n, "").replace(this._quote_esc, '"'))
|
|
} else {
|
|
if (l[h].match(a)) {
|
|
var m = l[h].indexOf(v);
|
|
g[c].push(l[h].substr(0, m));
|
|
c++;
|
|
g[c] = [];
|
|
l[h] = l[h].substr(m + 1);
|
|
h--
|
|
} else {
|
|
if (l[h] || h != l.length - 1) {
|
|
g[c].push(l[h])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var r = g.length - 1;
|
|
if (r > 0 && !g[r].length) {
|
|
g.splice(r, 1)
|
|
}
|
|
return g
|
|
},
|
|
str: function(g, a, h) {
|
|
for (var c = 0; c < g.length; c++) {
|
|
g[c] = '"' + g[c].replace(this._quote, '\\"') + '"'
|
|
}
|
|
return g.join(a)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.addRowFromClipboard = function() {
|
|
var a = this.fromClipBoard();
|
|
if (!a) {
|
|
return
|
|
}
|
|
var g = this.csvParser.unblock(a, this.csv.cell, this.csv.row);
|
|
for (var c = 0; c < g.length; c++) {
|
|
if (g[c]) {
|
|
a = g[c];
|
|
if (!a.length) {
|
|
continue
|
|
}
|
|
if (this._csvAID) {
|
|
this.addRow(this.getRowsNum() + 2, a)
|
|
} else {
|
|
if (this.rowsAr[a[0]]) {
|
|
a[0] = this.uid()
|
|
}
|
|
this.addRow(a[0], a.slice(1))
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.gridToClipboard = function() {
|
|
this.toClipBoard(this.serializeToCSV())
|
|
};
|
|
dhtmlXGridObject.prototype.gridFromClipboard = function() {
|
|
var a = this.fromClipBoard();
|
|
if (!a) {
|
|
return
|
|
}
|
|
this.loadCSVString(a)
|
|
};
|
|
dhtmlXGridObject.prototype.getXLS = function(n) {
|
|
if (!this.xslform) {
|
|
this.xslform = document.createElement("FORM");
|
|
this.xslform.action = (n || "") + "xls.php";
|
|
this.xslform.method = "post";
|
|
this.xslform.target = (_isIE ? "_blank" : "");
|
|
document.body.appendChild(this.xslform);
|
|
var m = document.createElement("INPUT");
|
|
m.type = "hidden";
|
|
m.name = "csv";
|
|
this.xslform.appendChild(m);
|
|
var h = document.createElement("INPUT");
|
|
h.type = "hidden";
|
|
h.name = "csv_header";
|
|
this.xslform.appendChild(h)
|
|
}
|
|
var o = this.serializeToCSV();
|
|
this.xslform.childNodes[0].value = o;
|
|
var g = [];
|
|
var a = this._cCount;
|
|
for (var c = 0; c < a; c++) {
|
|
g.push(this.getHeaderCol(c))
|
|
}
|
|
g = g.join(",");
|
|
this.xslform.childNodes[1].value = g;
|
|
this.xslform.submit()
|
|
};
|
|
dhtmlXGridObject.prototype.printView = function(s, g) {
|
|
var q = "<style>TD { font-family:Arial; text-align:center; padding-left:2px;padding-right:2px; } \n td.filter input, td.filter select { display:none; } \n </style>";
|
|
var C = null;
|
|
if (this._fake) {
|
|
C = [].concat(this._hrrar);
|
|
for (var A = 0; A < this._fake._cCount; A++) {
|
|
this._hrrar[A] = null
|
|
}
|
|
}
|
|
q += "<base href='" + document.location.href + "'></base>";
|
|
if (!this.parentGrid) {
|
|
q += (s || "")
|
|
}
|
|
q += '<table width="100%" border="2px" cellpadding="0" cellspacing="0">';
|
|
var r = Math.max(this.rowsBuffer.length, this.rowsCol.length);
|
|
var o = this._cCount;
|
|
var u = this._printWidth();
|
|
q += '<tr class="header_row_1">';
|
|
for (var A = 0; A < o; A++) {
|
|
if (this._hrrar && this._hrrar[A]) {
|
|
continue
|
|
}
|
|
var l = this.hdr.rows[1].cells[this.hdr.rows[1]._childIndexes ? this.hdr.rows[1]._childIndexes[parseInt(A)] : A];
|
|
var a = (l.colSpan || 1);
|
|
var H = (l.rowSpan || 1);
|
|
for (var y = 1; y < a; y++) {
|
|
u[A] += u[y]
|
|
}
|
|
q += '<td rowspan="' + H + '" width="' + u[A] + '%" style="background-color:lightgrey;" colspan="' + a + '">' + this.getHeaderCol(A) + "</td>";
|
|
A += a - 1
|
|
}
|
|
q += "</tr>";
|
|
for (var A = 2; A < this.hdr.rows.length; A++) {
|
|
if (_isIE) {
|
|
q += "<tr style='background-color:lightgrey' class='header_row_" + A + "'>";
|
|
var h = this.hdr.rows[A].childNodes;
|
|
for (var y = 0; y < h.length; y++) {
|
|
if (!this._hrrar || !this._hrrar[h[y]._cellIndex]) {
|
|
q += h[y].outerHTML
|
|
}
|
|
}
|
|
q += "</tr>"
|
|
} else {
|
|
q += "<tr class='header_row_" + A + "' style='background-color:lightgrey'>" + (this._fake ? this._fake.hdr.rows[A].innerHTML : "") + this.hdr.rows[A].innerHTML + "</tr>"
|
|
}
|
|
}
|
|
for (var A = 0; A < r; A++) {
|
|
q += "<tr>";
|
|
if (this.rowsCol[A] && this.rowsCol[A]._cntr) {
|
|
q += this.rowsCol[A].innerHTML.replace(/<img[^>]*>/gi, "") + "</tr>";
|
|
continue
|
|
}
|
|
if (this.rowsCol[A] && this.rowsCol[A].style.display == "none") {
|
|
continue
|
|
}
|
|
var n;
|
|
if (this.rowsCol[A]) {
|
|
n = this.rowsCol[A].idd
|
|
} else {
|
|
if (this.rowsBuffer[A]) {
|
|
n = this.rowsBuffer[A].idd
|
|
} else {
|
|
continue
|
|
}
|
|
}
|
|
for (var y = 0; y < o; y++) {
|
|
if (this._hrrar && this._hrrar[y]) {
|
|
continue
|
|
}
|
|
if (this.rowsAr[n] && this.rowsAr[n].tagName == "TR") {
|
|
var F = this.cells(n, y);
|
|
if (F._setState) {
|
|
var v = ""
|
|
} else {
|
|
if (F.getContent) {
|
|
v = F.getContent()
|
|
} else {
|
|
if (F.getImage || F.combo) {
|
|
var v = F.cell.innerHTML
|
|
} else {
|
|
var v = F.getValue()
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
var v = this._get_cell_value(this.rowsBuffer[A], y)
|
|
}
|
|
var w = this.columnColor[y] ? "background-color:" + this.columnColor[y] + ";" : "";
|
|
var x = this.cellAlign[y] ? "text-align:" + this.cellAlign[y] + ";" : "";
|
|
var D = F.getAttribute("colspan");
|
|
q += '<td style="' + w + x + '" ' + (D ? 'colSpan="' + D + '"' : "") + ">" + (v === "" ? " " : v) + "</td>";
|
|
if (D) {
|
|
y += D - 1
|
|
}
|
|
}
|
|
q += "</tr>";
|
|
if (this.rowsCol[A] && this.rowsCol[A]._expanded) {
|
|
var m = this.cells4(this.rowsCol[A]._expanded.ctrl);
|
|
if (m.getSubGrid) {
|
|
q += '<tr><td colspan="' + o + '">' + m.getSubGrid().printView() + "</td></tr>"
|
|
} else {
|
|
q += '<tr><td colspan="' + o + '">' + this.rowsCol[A]._expanded.innerHTML + "</td></tr>"
|
|
}
|
|
}
|
|
}
|
|
if (this.ftr) {
|
|
for (var A = 1; A < this.ftr.childNodes[0].rows.length; A++) {
|
|
q += "<tr style='background-color:lightgrey'>" + ((this._fake) ? this._fake.ftr.childNodes[0].rows[A].innerHTML : "") + this.ftr.childNodes[0].rows[A].innerHTML + "</tr>"
|
|
}
|
|
}
|
|
q += "</table>";
|
|
if (this.parentGrid) {
|
|
return q
|
|
}
|
|
q += (g || "");
|
|
var E = window.open("", "_blank");
|
|
E.document.write(q);
|
|
E.document.write("<script>window.onerror=function(){return true;}<\/script>");
|
|
E.document.close();
|
|
if (this._fake) {
|
|
this._hrrar = C
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._printWidth = function() {
|
|
var l = [];
|
|
var h = 0;
|
|
for (var g = 0; g < this._cCount; g++) {
|
|
var a = this.getColWidth(g);
|
|
l.push(a);
|
|
h += a
|
|
}
|
|
var n = [];
|
|
var c = 0;
|
|
for (var g = 0; g < l.length; g++) {
|
|
var m = Math.floor((l[g] / h) * 100);
|
|
c += m;
|
|
n.push(m)
|
|
}
|
|
n[n.length - 1] += 100 - c;
|
|
return n
|
|
};
|
|
if (!window.clipboardData) {
|
|
window.clipboardData = {
|
|
_make: function() {
|
|
var c = Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
|
|
if (!c) {
|
|
return null
|
|
}
|
|
var a = Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
|
|
if (!a) {
|
|
return null
|
|
}
|
|
a.addDataFlavor("text/unicode");
|
|
var g = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
|
|
this._p = [c, a, g];
|
|
return true
|
|
},
|
|
setData: function(a, h) {
|
|
try {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
|
|
} catch (g) {
|
|
dhtmlxError.throwError("Clipboard", "Access to clipboard denied", [a, h]);
|
|
return ""
|
|
}
|
|
if (!this._make()) {
|
|
return false
|
|
}
|
|
this._p[2].data = h;
|
|
this._p[1].setTransferData("text/unicode", this._p[2], h.length * 2);
|
|
var c = Components.interfaces.nsIClipboard;
|
|
this._p[0].setData(this._p[1], null, c.kGlobalClipboard)
|
|
},
|
|
getData: function(a) {
|
|
try {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")
|
|
} catch (g) {
|
|
dhtmlxError.throwError("Clipboard", "Access to clipboard denied", [a]);
|
|
return ""
|
|
}
|
|
if (!this._make()) {
|
|
return false
|
|
}
|
|
this._p[0].getData(this._p[1], this._p[0].kGlobalClipboard);
|
|
var c = new Object();
|
|
var h = new Object();
|
|
try {
|
|
this._p[1].getTransferData("text/unicode", h, c)
|
|
} catch (g) {
|
|
return ""
|
|
}
|
|
if (h) {
|
|
h = h.value.QueryInterface(Components.interfaces.nsISupportsString)
|
|
}
|
|
if (h) {
|
|
return h.data.substring(0, c.value / 2)
|
|
}
|
|
return ""
|
|
}
|
|
}
|
|
}
|
|
dhtmlXGridObject.prototype.enableBlockSelection = function(g) {
|
|
if (typeof this._bs_mode == "undefined") {
|
|
var a = this;
|
|
this.obj.onmousedown = function(h) {
|
|
if (a._bs_mode) {
|
|
a._OnSelectionStart((h || event), this)
|
|
}
|
|
return true
|
|
};
|
|
this._CSVRowDelimiter = this.csv.row;
|
|
this.attachEvent("onResize", function() {
|
|
a._HideSelection();
|
|
return true
|
|
});
|
|
this.attachEvent("onGridReconstructed", function() {
|
|
a._HideSelection();
|
|
return true
|
|
});
|
|
this.attachEvent("onFilterEnd", this._HideSelection)
|
|
}
|
|
if (g === false) {
|
|
this._bs_mode = false;
|
|
return this._HideSelection()
|
|
} else {
|
|
this._bs_mode = true
|
|
}
|
|
var c = this._clip_area = document.createElement("textarea");
|
|
c.style.cssText = "position:absolute; width:1px; height:1px; overflow:hidden; color:transparent; background-color:transparent; bottom:1px; right:1px; border:none;";
|
|
c.onkeydown = function(h) {
|
|
h = h || event;
|
|
if (h.keyCode == 86 && (h.ctrlKey || h.metaKey)) {
|
|
a.pasteBlockFromClipboard()
|
|
}
|
|
};
|
|
document.body.insertBefore(this._clip_area, document.body.firstChild);
|
|
dhtmlxEvent(this.entBox, "click", function() {
|
|
if (!a.editor) {
|
|
a._clip_area.select()
|
|
}
|
|
})
|
|
};
|
|
dhtmlXGridObject.prototype.forceLabelSelection = function(a) {
|
|
this._strictText = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype._OnSelectionStart = function(g, h) {
|
|
var c = this;
|
|
if (g.button == 2) {
|
|
return
|
|
}
|
|
var l = g.srcElement || g.target;
|
|
if (this.editor) {
|
|
if (l.tagName && (l.tagName == "INPUT" || l.tagName == "TEXTAREA")) {
|
|
return
|
|
}
|
|
this.editStop()
|
|
}
|
|
c.setActive(true);
|
|
var n = this.getPosition(this.obj);
|
|
var a = g.clientX - n[0] + (document.body.scrollLeft || (document.documentElement ? document.documentElement.scrollLeft : 0));
|
|
var m = g.clientY - n[1] + (document.body.scrollTop || (document.documentElement ? document.documentElement.scrollTop : 0));
|
|
this._CreateSelection(a - 4, m - 4);
|
|
if (l == this._selectionObj) {
|
|
this._HideSelection();
|
|
this._startSelectionCell = null
|
|
} else {
|
|
while (l && (!l.tagName || l.tagName.toLowerCase() != "td")) {
|
|
l = l.parentNode
|
|
}
|
|
this._startSelectionCell = l
|
|
} if (this._startSelectionCell) {
|
|
if (!this.callEvent("onBeforeBlockSelected", [this._startSelectionCell.parentNode.idd, this._startSelectionCell._cellIndex])) {
|
|
return this._startSelectionCell = null
|
|
}
|
|
}
|
|
this.obj.onmousedown = null;
|
|
this.obj[_isIE ? "onmouseleave" : "onmouseout"] = function(o) {
|
|
if (c._blsTimer) {
|
|
window.clearTimeout(c._blsTimer)
|
|
}
|
|
};
|
|
this.obj.onmmold = this.obj.onmousemove;
|
|
this._init_pos = [a, m];
|
|
this._selectionObj.onmousemove = this.obj.onmousemove = function(o) {
|
|
o = o || g;
|
|
if (o.preventDefault) {
|
|
o.preventDefault()
|
|
} else {
|
|
o.returnValue = false
|
|
}
|
|
c._OnSelectionMove(o)
|
|
};
|
|
this._oldDMP = document.body.onmouseup;
|
|
document.body.onmouseup = function(o) {
|
|
o = o || g;
|
|
c._OnSelectionStop(o, this);
|
|
return true
|
|
};
|
|
this.callEvent("onBeforeBlockSelection", []);
|
|
document.body.onselectstart = function() {
|
|
return false
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._getCellByPos = function(a, h) {
|
|
a = a;
|
|
if (this._fake) {
|
|
a += this._fake.objBox.scrollWidth
|
|
}
|
|
h = h;
|
|
var c = 0;
|
|
for (var g = 0; g < this.obj.rows.length; g++) {
|
|
h -= this.obj.rows[g].offsetHeight;
|
|
if (h <= 0) {
|
|
c = this.obj.rows[g];
|
|
break
|
|
}
|
|
}
|
|
if (!c || !c.idd) {
|
|
return null
|
|
}
|
|
for (var g = 0; g < this._cCount; g++) {
|
|
a -= this.getColWidth(g);
|
|
if (a <= 0) {
|
|
while (true) {
|
|
if (c._childIndexes && c._childIndexes[g + 1] == c._childIndexes[g]) {
|
|
c = c.previousSibling
|
|
} else {
|
|
return this.cells(c.idd, g).cell
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXGridObject.prototype._OnSelectionMove = function(h) {
|
|
var x = this;
|
|
this._ShowSelection();
|
|
var s = this.getPosition(this.obj);
|
|
var n = h.clientX - s[0] + (document.body.scrollLeft || (document.documentElement ? document.documentElement.scrollLeft : 0));
|
|
var m = h.clientY - s[1] + (document.body.scrollTop || (document.documentElement ? document.documentElement.scrollTop : 0));
|
|
if ((Math.abs(this._init_pos[0] - n) < 5) && (Math.abs(this._init_pos[1] - m) < 5)) {
|
|
return this._HideSelection()
|
|
}
|
|
var v = this._endSelectionCell;
|
|
if (this._startSelectionCell == null) {
|
|
this._endSelectionCell = this._startSelectionCell = this.getFirstParentOfType(h.srcElement || h.target, "TD")
|
|
} else {
|
|
if (h.srcElement || h.target) {
|
|
if ((h.srcElement || h.target).className == "dhtmlxGrid_selection") {
|
|
this._endSelectionCell = (this._getCellByPos(n, m) || this._endSelectionCell)
|
|
} else {
|
|
var w = this.getFirstParentOfType(h.srcElement || h.target, "TD");
|
|
if (w.parentNode.idd) {
|
|
this._endSelectionCell = w
|
|
}
|
|
}
|
|
}
|
|
} if (this._endSelectionCell) {
|
|
if (!this.callEvent("onBeforeBlockSelected", [this._endSelectionCell.parentNode.idd, this._endSelectionCell._cellIndex])) {
|
|
this._endSelectionCell = v
|
|
}
|
|
}
|
|
var l = this.objBox.scrollLeft + this.objBox.clientWidth;
|
|
var c = this.objBox.scrollTop + this.objBox.clientHeight;
|
|
var q = this.objBox.scrollLeft;
|
|
var o = this.objBox.scrollTop;
|
|
var g = false;
|
|
if (this._blsTimer) {
|
|
window.clearTimeout(this._blsTimer)
|
|
}
|
|
if (n + 20 >= l) {
|
|
this.objBox.scrollLeft = this.objBox.scrollLeft + 20;
|
|
g = true
|
|
} else {
|
|
if (n - 20 < q) {
|
|
this.objBox.scrollLeft = this.objBox.scrollLeft - 20;
|
|
g = true
|
|
}
|
|
} if (m + 20 >= c && !this._realfake) {
|
|
this.objBox.scrollTop = this.objBox.scrollTop + 20;
|
|
g = true
|
|
} else {
|
|
if (m - 20 < o && !this._realfake) {
|
|
this.objBox.scrollTop = this.objBox.scrollTop - 20;
|
|
g = true
|
|
}
|
|
}
|
|
this._selectionArea = this._RedrawSelectionPos(this._startSelectionCell, this._endSelectionCell);
|
|
if (g) {
|
|
var u = h.clientX;
|
|
var r = h.clientY;
|
|
this._blsTimer = window.setTimeout(function() {
|
|
x._OnSelectionMove({
|
|
clientX: u,
|
|
clientY: r
|
|
})
|
|
}, 100)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._OnSelectionStop = function(c) {
|
|
var a = this;
|
|
if (this._blsTimer) {
|
|
window.clearTimeout(this._blsTimer)
|
|
}
|
|
this.obj.onmousedown = function(h) {
|
|
if (a._bs_mode) {
|
|
a._OnSelectionStart((h || c), this)
|
|
}
|
|
return true
|
|
};
|
|
this.obj.onmousemove = this.obj.onmmold || null;
|
|
this._selectionObj.onmousemove = null;
|
|
document.body.onmouseup = this._oldDMP || null;
|
|
if (parseInt(this._selectionObj.style.width) < 2 && parseInt(this._selectionObj.style.height) < 2) {
|
|
this._HideSelection()
|
|
} else {
|
|
var g = this.getFirstParentOfType(c.srcElement || c.target, "TD");
|
|
if ((!g) || (!g.parentNode.idd)) {
|
|
g = this._endSelectionCell
|
|
}
|
|
while (g && (!g.tagName || g.tagName.toLowerCase() != "td")) {
|
|
g = g.parentNode
|
|
}
|
|
if (!g) {
|
|
return this._HideSelection()
|
|
}
|
|
this._stopSelectionCell = g;
|
|
this._selectionArea = this._RedrawSelectionPos(this._startSelectionCell, this._stopSelectionCell);
|
|
this.callEvent("onBlockSelected", [])
|
|
}
|
|
document.body.onselectstart = function() {}
|
|
};
|
|
dhtmlXGridObject.prototype._RedrawSelectionPos = function(u, n) {
|
|
var r = {};
|
|
r.LeftTopCol = u._cellIndex;
|
|
r.LeftTopRow = this.getRowIndex(u.parentNode.idd);
|
|
r.RightBottomCol = n._cellIndex;
|
|
r.RightBottomRow = this.getRowIndex(n.parentNode.idd);
|
|
var h = u.offsetWidth;
|
|
var g = u.offsetHeight;
|
|
u = this.getPosition(u, this.obj);
|
|
var v = n.offsetWidth;
|
|
var o = n.offsetHeight;
|
|
n = this.getPosition(n, this.obj);
|
|
if (u[0] < n[0]) {
|
|
var l = u[0];
|
|
var m = n[0] + v
|
|
} else {
|
|
var q = r.RightBottomCol;
|
|
r.RightBottomCol = r.LeftTopCol;
|
|
r.LeftTopCol = q;
|
|
var l = n[0];
|
|
var m = u[0] + h
|
|
} if (u[1] < n[1]) {
|
|
var s = u[1];
|
|
var a = n[1] + o
|
|
} else {
|
|
var q = r.RightBottomRow;
|
|
r.RightBottomRow = r.LeftTopRow;
|
|
r.LeftTopRow = q;
|
|
var s = n[1];
|
|
var a = u[1] + g
|
|
}
|
|
var w = m - l;
|
|
var c = a - s;
|
|
this._selectionObj.style.left = l + "px";
|
|
this._selectionObj.style.top = s + "px";
|
|
this._selectionObj.style.width = w + "px";
|
|
this._selectionObj.style.height = c + "px";
|
|
return r
|
|
};
|
|
dhtmlXGridObject.prototype._CreateSelection = function(a, g) {
|
|
if (this._selectionObj == null) {
|
|
var c = document.createElement("div");
|
|
c.style.position = "absolute";
|
|
c.style.display = "none";
|
|
c.className = "dhtmlxGrid_selection";
|
|
this._selectionObj = c;
|
|
this._selectionObj.onmousedown = function(h) {
|
|
h = h || event;
|
|
if (h.button == 2 || (_isMacOS && h.ctrlKey)) {
|
|
return this.parentNode.grid.callEvent("onBlockRightClick", ["BLOCK", h])
|
|
}
|
|
};
|
|
this._selectionObj.oncontextmenu = function(h) {
|
|
(h || event).cancelBubble = true;
|
|
return false
|
|
};
|
|
this.objBox.appendChild(this._selectionObj)
|
|
}
|
|
this._selectionObj.style.width = "0px";
|
|
this._selectionObj.style.height = "0px";
|
|
this._selectionObj.style.left = a + "px";
|
|
this._selectionObj.style.top = g + "px";
|
|
this._selectionObj.startX = a;
|
|
this._selectionObj.startY = g
|
|
};
|
|
dhtmlXGridObject.prototype._ShowSelection = function() {
|
|
if (this._selectionObj) {
|
|
this._selectionObj.style.display = ""
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._HideSelection = function() {
|
|
if (this._selectionObj) {
|
|
this._selectionObj.style.display = "none"
|
|
}
|
|
this._selectionArea = null;
|
|
this._clip_area.value = "";
|
|
this._clip_area.blur()
|
|
};
|
|
dhtmlXGridObject.prototype.copyBlockToClipboard = function() {
|
|
if (this._selectionArea != null) {
|
|
var g = new Array();
|
|
if (this._mathSerialization) {
|
|
this._agetm = "getMathValue"
|
|
} else {
|
|
if (this._strictText) {
|
|
this._agetm = "getTitle"
|
|
} else {
|
|
this._agetm = "getValue"
|
|
}
|
|
}
|
|
this._serialize_visible = true;
|
|
for (var a = this._selectionArea.LeftTopRow; a <= this._selectionArea.RightBottomRow; a++) {
|
|
var c = this._serializeRowToCVS(this.rowsBuffer[a], null, this._selectionArea.LeftTopCol, this._selectionArea.RightBottomCol + 1);
|
|
if (!this._csvAID) {
|
|
g[g.length] = c.substr(c.indexOf(this.csv.cell) + 1)
|
|
} else {
|
|
g[g.length] = c
|
|
}
|
|
}
|
|
g = g.join(this._CSVRowDelimiter);
|
|
this._clip_area.value = g;
|
|
this._clip_area.select();
|
|
this._serialize_visible = false
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.pasteBlockFromClipboard = function() {
|
|
this._clip_area.select();
|
|
var a = this;
|
|
window.setTimeout(function() {
|
|
a._pasteBlockFromClipboard();
|
|
a = null
|
|
}, 1)
|
|
};
|
|
dhtmlXGridObject.prototype._pasteBlockFromClipboard = function() {
|
|
var o = this._clip_area.value;
|
|
if (this._selectionArea != null) {
|
|
var w = this._selectionArea.LeftTopRow;
|
|
var a = this._selectionArea.LeftTopCol
|
|
} else {
|
|
if (this.cell != null && !this.editor) {
|
|
var w = this.getRowIndex(this.cell.parentNode.idd);
|
|
var a = this.cell._cellIndex
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
o = this.csvParser.unblock(o, this.csv.cell, this.csv.row);
|
|
var q = w + o.length;
|
|
var u = a + o[0].length;
|
|
if (u > this._cCount) {
|
|
u = this._cCount
|
|
}
|
|
var h = 0;
|
|
for (var r = w; r < q; r++) {
|
|
var x = this.render_row(r);
|
|
if (x == -1) {
|
|
continue
|
|
}
|
|
var g = 0;
|
|
for (var m = a; m < u; m++) {
|
|
if (this._hrrar[m]) {
|
|
u = Math.max(u + 1, this._cCount);
|
|
continue
|
|
}
|
|
var s = this.cells3(x, m);
|
|
if (s.isDisabled()) {
|
|
g++;
|
|
continue
|
|
}
|
|
if (this._onEditUndoRedo) {
|
|
this._onEditUndoRedo(2, x.idd, m, o[h][g], s.getValue())
|
|
}
|
|
if (s.combo) {
|
|
var v = s.combo.values;
|
|
for (var c = 0; c < v.length; c++) {
|
|
if (o[h][g] == v[c]) {
|
|
s.setValue(s.combo.keys[c]);
|
|
v = null;
|
|
break
|
|
}
|
|
}
|
|
if (v != null && s.editable) {
|
|
s.setValue(o[h][g++])
|
|
} else {
|
|
g++
|
|
}
|
|
} else {
|
|
s[s.setImage ? "setLabel" : "setValue"](o[h][g++])
|
|
}
|
|
s.cell.wasChanged = true
|
|
}
|
|
this.callEvent("onRowPaste", [x.idd]);
|
|
h++
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.getSelectedBlock = function() {
|
|
if (this._selectionArea) {
|
|
return this._selectionArea
|
|
} else {
|
|
if (this.getSelectedRowId() !== null) {
|
|
return {
|
|
LeftTopRow: this.getSelectedRowId(),
|
|
LeftTopCol: this.getSelectedCellIndex(),
|
|
RightBottomRow: this.getSelectedRowId(),
|
|
RightBottomCol: this.getSelectedCellIndex()
|
|
}
|
|
} else {
|
|
return null
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.enableSmartRendering = function(g, c, a) {
|
|
if (arguments.length > 2) {
|
|
if (c && !this.rowsBuffer[c - 1]) {
|
|
this.rowsBuffer[c - 1] = 0
|
|
}
|
|
c = a
|
|
}
|
|
this._srnd = convertStringToBoolean(g);
|
|
this._srdh = this._srdh || 20;
|
|
this._dpref = c || 0
|
|
};
|
|
dhtmlXGridObject.prototype.enablePreRendering = function(a) {
|
|
this._srnd_pr = parseInt(a || 50)
|
|
};
|
|
dhtmlXGridObject.prototype.forceFullLoading = function(a, l) {
|
|
for (var g = 0; g < this.rowsBuffer.length; g++) {
|
|
if (!this.rowsBuffer[g]) {
|
|
var h = a || (this.rowsBuffer.length - g);
|
|
if (this.callEvent("onDynXLS", [g, h])) {
|
|
var c = this;
|
|
this.load(this.xmlFileUrl + getUrlSymbol(this.xmlFileUrl) + "posStart=" + g + "&count=" + h, function() {
|
|
window.setTimeout(function() {
|
|
c.forceFullLoading(a, l)
|
|
}, 100)
|
|
}, this._data_type)
|
|
}
|
|
return
|
|
}
|
|
}
|
|
if (l) {
|
|
l.call(this)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.setAwaitedRowHeight = function(a) {
|
|
this._srdh = parseInt(a)
|
|
};
|
|
dhtmlXGridObject.prototype._get_view_size = function() {
|
|
return Math.floor(parseInt(this.entBox.offsetHeight) / this._srdh) + 2
|
|
};
|
|
dhtmlXGridObject.prototype._add_filler = function(n, a, c, h) {
|
|
if (!a) {
|
|
return null
|
|
}
|
|
var m = "__filler__";
|
|
var l = this._prepareRow(m);
|
|
l.firstChild.style.width = "1px";
|
|
for (var g = 1; g < l.childNodes.length; g++) {
|
|
l.childNodes[g].style.display = "none"
|
|
}
|
|
l.firstChild.style.height = a * this._srdh + "px";
|
|
c = c || this.rowsCol[n];
|
|
if (c && c.nextSibling) {
|
|
c.parentNode.insertBefore(l, c.nextSibling)
|
|
} else {
|
|
if (_isKHTML) {
|
|
this.obj.appendChild(l)
|
|
} else {
|
|
this.obj.rows[0].parentNode.appendChild(l)
|
|
}
|
|
}
|
|
this.callEvent("onAddFiller", [n, a, l, c, h]);
|
|
return [n, a, l]
|
|
};
|
|
dhtmlXGridObject.prototype._update_srnd_view = function() {
|
|
var m = Math.floor(this.objBox.scrollTop / this._srdh);
|
|
var c = m + this._get_view_size();
|
|
if (this.multiLine) {
|
|
var n = this.objBox.scrollTop;
|
|
m = 0;
|
|
while (n > 0) {
|
|
n -= this.rowsCol[m] ? this.rowsCol[m].offsetHeight : this._srdh;
|
|
m++
|
|
}
|
|
c = m + this._get_view_size();
|
|
if (m > 0) {
|
|
m--
|
|
}
|
|
}
|
|
c += (this._srnd_pr || 0);
|
|
if (c > this.rowsBuffer.length) {
|
|
c = this.rowsBuffer.length
|
|
}
|
|
for (var h = m; h < c; h++) {
|
|
if (!this.rowsCol[h]) {
|
|
var l = this._add_from_buffer(h);
|
|
if (l == -1) {
|
|
if (this.xmlFileUrl) {
|
|
if (this._dpref && this.rowsBuffer[c - 1]) {
|
|
var g = this._dpref ? this._dpref : (c - h);
|
|
var a = Math.max(0, Math.min(h, c - this._dpref));
|
|
this._current_load = [a, c - a]
|
|
} else {
|
|
this._current_load = [h, (this._dpref ? this._dpref : (c - h))]
|
|
} if (this.callEvent("onDynXLS", this._current_load)) {
|
|
this.load(this.xmlFileUrl + getUrlSymbol(this.xmlFileUrl) + "posStart=" + this._current_load[0] + "&count=" + this._current_load[1], this._data_type)
|
|
}
|
|
}
|
|
return
|
|
} else {
|
|
if (this._tgle) {
|
|
this._updateLine(this._h2.get[this.rowsBuffer[h].idd], this.rowsBuffer[h]);
|
|
this._updateParentLine(this._h2.get[this.rowsBuffer[h].idd], this.rowsBuffer[h])
|
|
}
|
|
if (h && h == (this._realfake ? this._fake : this)["_r_select"]) {
|
|
this.selectCell(h, this.cell ? this.cell._cellIndex : 0, true)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this._fake && !this._realfake && this.multiLine) {
|
|
this._fake.objBox.scrollTop = this.objBox.scrollTop
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._add_from_buffer = function(h) {
|
|
var l = this.render_row(h);
|
|
if (l == -1) {
|
|
return -1
|
|
}
|
|
if (l._attrs.selected || l._attrs.select) {
|
|
this.selectRow(l, false, true);
|
|
l._attrs.selected = l._attrs.select = null
|
|
}
|
|
if (!this._cssSP) {
|
|
if (this._cssEven && h % 2 == 0) {
|
|
l.className = this._cssEven + ((l.className.indexOf("rowselected") != -1) ? " rowselected " : " ") + (l._css || "")
|
|
} else {
|
|
if (this._cssUnEven && h % 2 == 1) {
|
|
l.className = this._cssUnEven + ((l.className.indexOf("rowselected") != -1) ? " rowselected " : " ") + (l._css || "")
|
|
}
|
|
}
|
|
} else {
|
|
if (this._h2) {
|
|
var a = this._h2.get[l.idd];
|
|
l.className += " " + ((a.level % 2) ? (this._cssUnEven + " " + this._cssUnEven) : (this._cssEven + " " + this._cssEven)) + "_" + a.level + (this.rowsAr[a.id]._css || "")
|
|
}
|
|
}
|
|
for (var c = 0; c < this._fillers.length; c++) {
|
|
var g = this._fillers[c];
|
|
if (g && g[0] <= h && (g[0] + g[1]) > h) {
|
|
var m = h - g[0];
|
|
if (m == 0) {
|
|
this._insert_before(h, l, g[2]);
|
|
this._update_fillers(c, -1, 1)
|
|
} else {
|
|
if (m == g[1] - 1) {
|
|
this._insert_after(h, l, g[2]);
|
|
this._update_fillers(c, -1, 0)
|
|
} else {
|
|
this._fillers.push(this._add_filler(h + 1, g[1] - m - 1, g[2], 1));
|
|
this._insert_after(h, l, g[2]);
|
|
this._update_fillers(c, -g[1] + m, 0)
|
|
}
|
|
}
|
|
return
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._update_fillers = function(g, a, h) {
|
|
var c = this._fillers[g];
|
|
c[1] = c[1] + a;
|
|
c[0] = c[0] + h;
|
|
if (!c[1]) {
|
|
this.callEvent("onRemoveFiller", [c[2]]);
|
|
c[2].parentNode.removeChild(c[2]);
|
|
this._fillers.splice(g, 1)
|
|
} else {
|
|
c[2].firstChild.style.height = parseFloat(c[2].firstChild.style.height) + a * this._srdh + "px";
|
|
this.callEvent("onUpdateFiller", [c[2]])
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._insert_before = function(c, g, a) {
|
|
a.parentNode.insertBefore(g, a);
|
|
this.rowsCol[c] = g;
|
|
this.callEvent("onRowInserted", [g, null, a, "before"])
|
|
};
|
|
dhtmlXGridObject.prototype._insert_after = function(c, g, a) {
|
|
if (a.nextSibling) {
|
|
a.parentNode.insertBefore(g, a.nextSibling)
|
|
} else {
|
|
a.parentNode.appendChild(g)
|
|
}
|
|
this.rowsCol[c] = g;
|
|
this.callEvent("onRowInserted", [g, null, a, "after"])
|
|
};
|
|
dhtmlxValidation = function() {};
|
|
dhtmlxValidation.prototype = {
|
|
trackInput: function(g, h, c, a) {
|
|
dhtmlxEvent(g, "keyup", function(l) {
|
|
if (dhtmlxValidation._timer) {
|
|
window.clearTimeout(dhtmlxValidation._timer);
|
|
dhtmlxValidation._timer = null
|
|
}
|
|
dhtmlxValidation._timer = window.setTimeout(function() {
|
|
if (!dhtmlxValidation.checkInput(g, h)) {
|
|
if (!c || c(g, g.value, h)) {
|
|
g.className += " dhtmlx_live_validation_error"
|
|
}
|
|
} else {
|
|
g.className = g.className.replace(/[ ]*dhtmlx_live_validation_error/g, "");
|
|
if (a) {
|
|
a(g, g.value, h)
|
|
}
|
|
}
|
|
}, 250)
|
|
})
|
|
},
|
|
checkInput: function(a, c) {
|
|
return this.checkValue(a.value, c)
|
|
},
|
|
checkValue: function(g, h) {
|
|
if (typeof h == "string") {
|
|
h = h.split(",")
|
|
}
|
|
var a = true;
|
|
for (var c = 0; c < h.length; c++) {
|
|
if (!this["is" + h[c]]) {
|
|
alert("Incorrect validation rule: " + h[c])
|
|
} else {
|
|
a = a && this["is" + h[c]](g)
|
|
}
|
|
}
|
|
return a
|
|
},
|
|
isEmpty: function(a) {
|
|
return a == ""
|
|
},
|
|
isNotEmpty: function(a) {
|
|
return (a instanceof Array ? a.length > 0 : !a == "")
|
|
},
|
|
isValidBoolean: function(a) {
|
|
return !!a.toString().match(/^(0|1|true|false)$/)
|
|
},
|
|
isValidEmail: function(a) {
|
|
return !!a.toString().match(/(^[a-z0-9]([0-9a-z\-_\.]*)@([0-9a-z_\-\.]*)([.][a-z]{3})$)|(^[a-z]([0-9a-z_\.\-]*)@([0-9a-z_\-\.]*)(\.[a-z]{2,4})$)/i)
|
|
},
|
|
isValidInteger: function(a) {
|
|
return !!a.toString().match(/(^-?\d+$)/)
|
|
},
|
|
isValidNumeric: function(a) {
|
|
return !!a.toString().match(/(^-?\d\d*[\.|,]\d*$)|(^-?\d\d*$)|(^-?[\.|,]\d\d*$)/)
|
|
},
|
|
isValidAplhaNumeric: function(a) {
|
|
return !!a.toString().match(/^[_\-a-z0-9]+$/gi)
|
|
},
|
|
isValidDatetime: function(c) {
|
|
var a = c.toString().match(/^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/);
|
|
return a && !! (a[1] <= 9999 && a[2] <= 12 && a[3] <= 31 && a[4] <= 59 && a[5] <= 59 && a[6] <= 59) || false
|
|
},
|
|
isValidDate: function(a) {
|
|
var c = a.toString().match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
return c && !! (c[1] <= 9999 && c[2] <= 12 && c[3] <= 31) || false
|
|
},
|
|
isValidTime: function(c) {
|
|
var a = c.toString().match(/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/);
|
|
return a && !! (a[1] <= 24 && a[2] <= 59 && a[3] <= 59) || false
|
|
},
|
|
isValidIPv4: function(a) {
|
|
var c = a.toString().match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
return c && !! (c[1] <= 255 && c[2] <= 255 && c[3] <= 255 && c[4] <= 255) || false
|
|
},
|
|
isValidCurrency: function(a) {
|
|
return a.toString().match(/^\$?\s?\d+?([\.,\,]?\d+)?\s?\$?$/) && true || false
|
|
},
|
|
isValidSSN: function(a) {
|
|
return a.toString().match(/^\d{3}\-?\d{2}\-?\d{4}$/) && true || false
|
|
},
|
|
isValidSIN: function(a) {
|
|
return a.toString().match(/^\d{9}$/) && true || false
|
|
}
|
|
};
|
|
dhtmlxValidation = new dhtmlxValidation();
|
|
dhtmlXGridObject.prototype.enableValidation = function(c, a) {
|
|
c = convertStringToBoolean(c);
|
|
if (c) {
|
|
this._validators = {
|
|
data: []
|
|
}
|
|
} else {
|
|
this._validators = false
|
|
} if (arguments.length > 1) {
|
|
this._validators._live = a
|
|
}
|
|
if (!this._validators._event) {
|
|
this._validators._event = this.attachEvent("onEditCell", this.validationEvent)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.setColValidators = function(a) {
|
|
if (!this._validators) {
|
|
this.enableValidation(true)
|
|
}
|
|
if (typeof a == "string") {
|
|
a = a.split(this.delim)
|
|
}
|
|
this._validators.data = a
|
|
};
|
|
dhtmlXGridObject.prototype.validationEvent = function(m, c, h, g, o) {
|
|
var q = this._validators;
|
|
if (!q) {
|
|
return true
|
|
}
|
|
var n = (q.data[h] || this.cells(c, h).getAttribute("validate")) || "";
|
|
if (m == 1 && n) {
|
|
var l = this.editor || (this._fake || {}).editor;
|
|
if (!l) {
|
|
return true
|
|
}
|
|
l.cell.className = l.cell.className.replace(/[ ]*dhtmlx_validation_error/g, "");
|
|
if (q._live) {
|
|
var a = this;
|
|
dhtmlxValidation.trackInput(l.getInput(), n, function(r, s, u) {
|
|
return a.callEvent("onLiveValidationError", [c, h, s, r, u])
|
|
}, function(r, s, u) {
|
|
return a.callEvent("onLiveValidationCorrect", [c, h, s, r, u])
|
|
})
|
|
}
|
|
}
|
|
if (m == 2) {
|
|
this.validateCell(c, h, n, g)
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXGridObject.prototype.validateCell = function(n, l, m, h) {
|
|
m = m || (this._validators.data[l] || this.cells(n, l).getAttribute("validate"));
|
|
h = h || this.cells(n, l).getValue();
|
|
if (!m) {
|
|
return
|
|
}
|
|
var c = this.cells(n, l).cell;
|
|
var a = true;
|
|
if (typeof m == "string") {
|
|
m = m.split(this.delim)
|
|
}
|
|
for (var g = 0; g < m.length; g++) {
|
|
if (!dhtmlxValidation.checkValue(h, m[g])) {
|
|
if (this.callEvent("onValidationError", [n, l, h, m[g]])) {
|
|
c.className += " dhtmlx_validation_error"
|
|
}
|
|
a = false
|
|
}
|
|
}
|
|
if (a) {
|
|
this.callEvent("onValidationCorrect", [n, l, h, m]);
|
|
c.className = c.className.replace(/[ ]*dhtmlx_validation_error/g, "")
|
|
}
|
|
return a
|
|
};
|
|
|
|
function eXcell_stree(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
if (!this.grid._sub_trees) {
|
|
return
|
|
}
|
|
this._sub = this.grid._sub_trees[a._cellIndex];
|
|
if (!this._sub) {
|
|
return
|
|
}
|
|
this._sub = this._sub[0]
|
|
}
|
|
this.getValue = function() {
|
|
return this.cell._val
|
|
};
|
|
this.setValue = function(c) {
|
|
this.cell._val = c;
|
|
c = this._sub.getItemText(this.cell._val);
|
|
this.setCValue((c || " "), c)
|
|
};
|
|
this.edit = function() {
|
|
this._sub.parentObject.style.display = "block";
|
|
var g = this.grid.getPosition(this.cell);
|
|
this._sub.parentObject.style.top = g[1] + "px";
|
|
this._sub.parentObject.style.left = g[0] + "px";
|
|
this._sub.parentObject.style.position = "absolute";
|
|
var c = this.grid.editStop;
|
|
this.grid.editStop = function() {};
|
|
this.grid.editStop = c
|
|
};
|
|
this.detach = function() {
|
|
this._sub.parentObject.style.display = "none";
|
|
if (this.grid._sub_id != null) {
|
|
var c = this.cell._val;
|
|
this.setValue(this._sub.getSelectedItemId());
|
|
this.grid._sub_id = null;
|
|
return this.cell._val != c
|
|
}
|
|
}
|
|
}
|
|
eXcell_stree.prototype = new eXcell;
|
|
dhtmlXGridObject.prototype.setSubTree = function(a, c) {
|
|
if (!this._sub_trees) {
|
|
this._sub_trees = []
|
|
}
|
|
this._sub_trees[c] = [a];
|
|
a.parentObject.style.display = "none";
|
|
var g = this;
|
|
a.parentObject.onclick = function(h) {
|
|
(h || window.event).cancelBubble = true;
|
|
return false
|
|
};
|
|
a.ev_onDblClick = null;
|
|
a.attachEvent("onDblClick", function(h) {
|
|
g._sub_id = h;
|
|
g.editStop();
|
|
return true
|
|
});
|
|
a._chRRS = true
|
|
};
|
|
|
|
function eXcell_link(a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
this.isDisabled = function() {
|
|
return true
|
|
};
|
|
this.edit = function() {};
|
|
this.getValue = function() {
|
|
if (this.cell.firstChild.getAttribute) {
|
|
var c = this.cell.firstChild.getAttribute("target");
|
|
return this.cell.firstChild.innerHTML + "^" + this.cell.firstChild.getAttribute("href") + (c ? ("^" + c) : "")
|
|
} else {
|
|
return ""
|
|
}
|
|
};
|
|
this.setValue = function(g) {
|
|
if ((typeof(g) != "number") && (!g || g.toString()._dhx_trim() == "")) {
|
|
this.setCValue(" ", c);
|
|
return (this.cell._clearCell = true)
|
|
}
|
|
var c = g.split("^");
|
|
if (c.length == 1) {
|
|
c[1] = ""
|
|
} else {
|
|
if (c.length > 1) {
|
|
c[1] = "href='" + c[1] + "'";
|
|
if (c.length == 3) {
|
|
c[1] += " target='" + c[2] + "'"
|
|
} else {
|
|
c[1] += " target='_blank'"
|
|
}
|
|
}
|
|
}
|
|
this.setCValue("<a " + c[1] + " onclick='(_isIE?event:arguments[0]).cancelBubble = true;'>" + c[0] + "</a>", c)
|
|
}
|
|
}
|
|
eXcell_link.prototype = new eXcell;
|
|
eXcell_link.prototype.getTitle = function() {
|
|
var a = this.cell.firstChild;
|
|
return ((a && a.tagName) ? a.getAttribute("href") : "")
|
|
};
|
|
eXcell_link.prototype.getContent = function() {
|
|
var a = this.cell.firstChild;
|
|
return ((a && a.tagName) ? a.innerHTML : "")
|
|
};
|
|
|
|
function eXcell_grid(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
if (!this.grid._sub_grids) {
|
|
return
|
|
}
|
|
this._sub = this.grid._sub_grids[a._cellIndex];
|
|
if (!this._sub) {
|
|
return
|
|
}
|
|
this._sindex = this._sub[1];
|
|
this._sub = this._sub[0]
|
|
}
|
|
this.getValue = function() {
|
|
return this.cell.val
|
|
};
|
|
this.setValue = function(c) {
|
|
this.cell.val = c;
|
|
if (this._sub.getRowById(c)) {
|
|
c = this._sub.cells(c, this._sindex);
|
|
if (c) {
|
|
c = c.getValue()
|
|
} else {
|
|
c = ""
|
|
}
|
|
}
|
|
this.setCValue((c || " "), c)
|
|
};
|
|
this.edit = function() {
|
|
this.val = this.cell.val;
|
|
this._sub.entBox.style.display = "block";
|
|
var g = this.grid.getPosition(this.cell);
|
|
this._sub.entBox.style.top = g[1] + "px";
|
|
this._sub.entBox.style.left = g[0] + "px";
|
|
this._sub.entBox.style.position = "absolute";
|
|
this._sub.setSizes();
|
|
var c = this.grid.editStop;
|
|
this.grid.editStop = function() {};
|
|
if (this._sub.getRowById(this.cell.val)) {
|
|
this._sub.setSelectedRow(this.cell.val)
|
|
}
|
|
this._sub.setActive(true);
|
|
this.grid.editStop = c
|
|
};
|
|
this.detach = function() {
|
|
var c = this.cell.val;
|
|
this._sub.entBox.style.display = "none";
|
|
if (this._sub.getSelectedId() === null) {
|
|
return false
|
|
}
|
|
this.setValue(this._sub.getSelectedId());
|
|
this.grid.setActive(true);
|
|
return this.cell.val != c
|
|
}
|
|
}
|
|
eXcell_grid.prototype = new eXcell;
|
|
dhtmlXGridObject.prototype.setSubGrid = function(c, a, h) {
|
|
if (!this._sub_grids) {
|
|
this._sub_grids = []
|
|
}
|
|
this._sub_grids[a] = [c, h];
|
|
c.entBox.style.display = "none";
|
|
var g = this;
|
|
c.attachEvent("onRowSelect", function(l) {
|
|
g.editStop();
|
|
return true
|
|
});
|
|
c._chRRS = false
|
|
};
|
|
|
|
function eXcell_dhxCalendar(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
if (!this.grid._grid_calendarA) {
|
|
var g = this.grid._grid_calendarA = new dhtmlxCalendarObject();
|
|
this.grid.callEvent("onDhxCalendarCreated", [g]);
|
|
var c = this.grid;
|
|
g.attachEvent("onClick", function() {
|
|
this._last_operation_calendar = true;
|
|
window.setTimeout(function() {
|
|
c.editStop()
|
|
}, 1);
|
|
return true
|
|
});
|
|
var h = function(l) {
|
|
(l || event).cancelBubble = true
|
|
};
|
|
dhtmlxEvent(g.base, "click", h);
|
|
g = null
|
|
}
|
|
}
|
|
}
|
|
eXcell_dhxCalendar.prototype = new eXcell;
|
|
eXcell_dhxCalendar.prototype.edit = function() {
|
|
var c = this.grid.getPosition(this.cell);
|
|
this.grid._grid_calendarA._show(false, false);
|
|
this.grid._grid_calendarA.setPosition(c[0], c[1] + this.cell.offsetHeight);
|
|
this.grid._grid_calendarA._last_operation_calendar = false;
|
|
this.grid.callEvent("onCalendarShow", [this.grid._grid_calendarA, this.cell.parentNode.idd, this.cell._cellIndex]);
|
|
this.cell._cediton = true;
|
|
this.val = this.cell.val;
|
|
this._val = this.cell.innerHTML;
|
|
var a = this.grid._grid_calendarA.draw;
|
|
this.grid._grid_calendarA.draw = function() {};
|
|
this.grid._grid_calendarA.setDateFormat((this.grid._dtmask || "%d/%m/%Y"));
|
|
this.grid._grid_calendarA.setDate(this.val || (new Date()));
|
|
this.grid._grid_calendarA.draw = a
|
|
};
|
|
eXcell_dhxCalendar.prototype.getDate = function() {
|
|
if (this.cell.val) {
|
|
return this.cell.val
|
|
}
|
|
return null
|
|
};
|
|
eXcell_dhxCalendar.prototype.getValue = function() {
|
|
if (this.cell._clearCell) {
|
|
return ""
|
|
}
|
|
if (this.grid._dtmask_inc && this.cell.val) {
|
|
return this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask_inc, this.cell.val).toString()
|
|
}
|
|
return this.cell.innerHTML.toString()._dhx_trim()
|
|
};
|
|
eXcell_dhxCalendar.prototype.detach = function() {
|
|
if (!this.grid._grid_calendarA) {
|
|
return
|
|
}
|
|
this.grid._grid_calendarA.hide();
|
|
if (this.cell._cediton) {
|
|
this.cell._cediton = false
|
|
} else {
|
|
return
|
|
} if (this.grid._grid_calendarA._last_operation_calendar) {
|
|
var g = this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask || "%d/%m/%Y"));
|
|
var c = this.grid._grid_calendarA.getDate();
|
|
this.cell.val = new Date(c);
|
|
this.setCValue(g, c);
|
|
this.cell._clearCell = !g;
|
|
var a = this.val;
|
|
this.val = this._val;
|
|
return (this.cell.val.valueOf() != a)
|
|
}
|
|
return false
|
|
};
|
|
eXcell_dhxCalendar.prototype.setValue = function(a) {
|
|
if (a && typeof a == "object") {
|
|
this.cell.val = a;
|
|
this.cell._clearCell = false;
|
|
this.setCValue(this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask || "%d/%m/%Y"), a).toString(), this.cell.val);
|
|
return
|
|
}
|
|
if (!a || a.toString()._dhx_trim() == "") {
|
|
a = " ";
|
|
this.cell._clearCell = true;
|
|
this.cell.val = ""
|
|
} else {
|
|
this.cell._clearCell = false;
|
|
this.cell.val = new Date(this.grid._grid_calendarA.setFormatedDate((this.grid._dtmask_inc || this.grid._dtmask || "%d/%m/%Y"), a.toString(), null, true));
|
|
if (this.grid._dtmask_inc) {
|
|
a = this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask || "%d/%m/%Y"), this.cell.val)
|
|
}
|
|
} if ((this.cell.val == "NaN") || (this.cell.val == "Invalid Date")) {
|
|
this.cell._clearCell = true;
|
|
this.cell.val = new Date();
|
|
this.setCValue(" ", 0)
|
|
} else {
|
|
this.setCValue((a || "").toString(), this.cell.val)
|
|
}
|
|
};
|
|
|
|
function eXcell_dhxCalendarA(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
if (!this.grid._grid_calendarA) {
|
|
var g = this.grid._grid_calendarA = new dhtmlxCalendarObject();
|
|
this.grid.callEvent("onDhxCalendarCreated", [g]);
|
|
var c = this.grid;
|
|
g.attachEvent("onClick", function() {
|
|
this._last_operation_calendar = true;
|
|
window.setTimeout(function() {
|
|
c.editStop()
|
|
}, 1);
|
|
return true
|
|
});
|
|
var h = function(l) {
|
|
(l || event).cancelBubble = true
|
|
};
|
|
dhtmlxEvent(g.base, "click", h)
|
|
}
|
|
}
|
|
}
|
|
eXcell_dhxCalendarA.prototype = new eXcell;
|
|
eXcell_dhxCalendarA.prototype.edit = function() {
|
|
var c = this.grid.getPosition(this.cell);
|
|
this.grid._grid_calendarA._show(false, false);
|
|
this.grid._grid_calendarA.setPosition(c[0] * 1 + this.cell.offsetWidth, c[1] * 1);
|
|
this.grid.callEvent("onCalendarShow", [this.grid._grid_calendarA, this.cell.parentNode.idd, this.cell._cellIndex]);
|
|
this.grid._grid_calendarA._last_operation_calendar = false;
|
|
this.cell._cediton = true;
|
|
this.val = this.cell.val;
|
|
this._val = this.cell.innerHTML;
|
|
var a = this.grid._grid_calendarA.draw;
|
|
this.grid._grid_calendarA.draw = function() {};
|
|
this.grid._grid_calendarA.setDateFormat((this.grid._dtmask || "%d/%m/%Y"));
|
|
this.grid._grid_calendarA.setDate(this.val);
|
|
this.grid._grid_calendarA.draw = a;
|
|
this.cell.atag = ((!this.grid.multiLine) && (_isKHTML || _isMacOS || _isFF)) ? "INPUT" : "TEXTAREA";
|
|
this.obj = document.createElement(this.cell.atag);
|
|
this.obj.style.height = (this.cell.offsetHeight - (_isIE ? 4 : 2)) + "px";
|
|
this.obj.className = "dhx_combo_edit";
|
|
this.obj.wrap = "soft";
|
|
this.obj.style.textAlign = this.cell.align;
|
|
this.obj.onclick = function(g) {
|
|
(g || event).cancelBubble = true
|
|
};
|
|
this.obj.onmousedown = function(g) {
|
|
(g || event).cancelBubble = true
|
|
};
|
|
this.obj.value = this.getValue();
|
|
this.cell.innerHTML = "";
|
|
this.cell.appendChild(this.obj);
|
|
if (window.dhx4.isIE) {
|
|
this.obj.style.overflow = "visible";
|
|
if ((this.grid.multiLine) && (this.obj.offsetHeight >= 18) && (this.obj.offsetHeight < 40)) {
|
|
this.obj.style.height = "36px";
|
|
this.obj.style.overflow = "scroll"
|
|
}
|
|
}
|
|
this.obj.onselectstart = function(g) {
|
|
if (!g) {
|
|
g = event
|
|
}
|
|
g.cancelBubble = true;
|
|
return true
|
|
};
|
|
this.obj.focus();
|
|
this.obj.focus()
|
|
};
|
|
eXcell_dhxCalendarA.prototype.getDate = function() {
|
|
if (this.cell.val) {
|
|
return this.cell.val
|
|
}
|
|
return null
|
|
};
|
|
eXcell_dhxCalendarA.prototype.getValue = function() {
|
|
if (this.cell._clearCell) {
|
|
return ""
|
|
}
|
|
if (this.grid._dtmask_inc && this.cell.val) {
|
|
return this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask_inc, this.cell.val).toString()
|
|
}
|
|
return this.cell.innerHTML.toString()._dhx_trim()
|
|
};
|
|
eXcell_dhxCalendarA.prototype.detach = function() {
|
|
if (!this.grid._grid_calendarA) {
|
|
return
|
|
}
|
|
this.grid._grid_calendarA.hide();
|
|
if (this.cell._cediton) {
|
|
this.cell._cediton = false
|
|
} else {
|
|
return
|
|
} if (this.grid._grid_calendarA._last_operation_calendar) {
|
|
this.grid._grid_calendarA._last_operation_calendar = false;
|
|
var g = this.grid._grid_calendarA.getFormatedDate(this.grid._dtmask || "%d/%m/%Y");
|
|
var c = this.grid._grid_calendarA.getDate();
|
|
this.cell.val = new Date(c);
|
|
this.setCValue(g, c);
|
|
this.cell._clearCell = !g;
|
|
var a = this.val;
|
|
this.val = this._val;
|
|
return (this.cell.val.valueOf() != (a | "").valueOf())
|
|
}
|
|
this.setValue(this.obj.value);
|
|
var a = this.val;
|
|
this.val = this._val;
|
|
return (this.cell.val.valueOf() != (a || "").valueOf())
|
|
};
|
|
eXcell_dhxCalendarA.prototype.setValue = function(a) {
|
|
if (a && typeof a == "object") {
|
|
this.cell.val = a;
|
|
this.cell._clearCell = false;
|
|
this.setCValue(this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask || "%d/%m/%Y"), a).toString(), this.cell.val);
|
|
return
|
|
}
|
|
if (!a || a.toString()._dhx_trim() == "") {
|
|
a = " ";
|
|
this.cell._clearCell = true;
|
|
this.cell.val = ""
|
|
} else {
|
|
this.cell._clearCell = false;
|
|
this.cell.val = new Date(this.grid._grid_calendarA.setFormatedDate((this.grid._dtmask_inc || this.grid._dtmask || "%d/%m/%Y"), a.toString(), null, true));
|
|
if (this.grid._dtmask_inc) {
|
|
a = this.grid._grid_calendarA.getFormatedDate((this.grid._dtmask || "%d/%m/%Y"), this.cell.val)
|
|
}
|
|
} if ((this.cell.val == "NaN") || (this.cell.val == "Invalid Date")) {
|
|
this.cell.val = new Date();
|
|
this.cell._clearCell = true;
|
|
this.setCValue(" ", 0)
|
|
} else {
|
|
this.setCValue((a || "").toString(), this.cell.val)
|
|
}
|
|
};
|
|
|
|
function eXcell_cntr(a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
if (!this.grid._ex_cntr_ready && !this._realfake) {
|
|
this.grid._ex_cntr_ready = true;
|
|
if (this.grid._h2) {
|
|
this.grid.attachEvent("onOpenEn", function(g) {
|
|
this.resetCounter(a._cellIndex)
|
|
})
|
|
}
|
|
var c = function() {
|
|
var g = this;
|
|
window.setTimeout(function() {
|
|
if (!g.resetCounter) {
|
|
return
|
|
}
|
|
if (g._fake && !g._realfake && a._cellIndex < g._fake._cCount) {
|
|
g._fake.resetCounter(a._cellIndex)
|
|
} else {
|
|
g.resetCounter(a._cellIndex)
|
|
}
|
|
}, 1);
|
|
return true
|
|
};
|
|
this.grid.attachEvent("onBeforeSorting", c);
|
|
this.grid.attachEvent("onFilterEnd", c)
|
|
}
|
|
this.edit = function() {};
|
|
this.getValue = function() {
|
|
return this.cell.innerHTML
|
|
};
|
|
this.setValue = function(h) {
|
|
this.cell.style.paddingRight = "2px";
|
|
var g = this.cell;
|
|
window.setTimeout(function() {
|
|
if (!g.parentNode) {
|
|
return
|
|
}
|
|
var l = g.parentNode.rowIndex;
|
|
if (g.parentNode.grid.currentPage || l < 0 || g.parentNode.grid._srnd) {
|
|
l = g.parentNode.grid.rowsBuffer._dhx_find(g.parentNode) + 1
|
|
}
|
|
if (l <= 0) {
|
|
return
|
|
}
|
|
g.innerHTML = l;
|
|
if (g.parentNode.grid._fake && g._cellIndex < g.parentNode.grid._fake._cCount && g.parentNode.grid._fake.rowsAr[g.parentNode.idd]) {
|
|
g.parentNode.grid._fake.cells(g.parentNode.idd, g._cellIndex).setCValue(l)
|
|
}
|
|
g = null
|
|
}, 100)
|
|
}
|
|
}
|
|
dhtmlXGridObject.prototype.resetCounter = function(c) {
|
|
if (this._fake && !this._realfake && c < this._fake._cCount) {
|
|
this._fake.resetCounter(c, this.currentPage)
|
|
}
|
|
var a = arguments[0] || 0;
|
|
if (this.currentPage) {
|
|
a = (this.currentPage - 1) * this.rowsBufferOutSize
|
|
}
|
|
for (a = 0; a < this.rowsBuffer.length; a++) {
|
|
if (this.rowsBuffer[a] && this.rowsBuffer[a].tagName == "TR" && this.rowsAr[this.rowsBuffer[a].idd]) {
|
|
this.rowsAr[this.rowsBuffer[a].idd].childNodes[c].innerHTML = a + 1
|
|
}
|
|
}
|
|
};
|
|
eXcell_cntr.prototype = new eXcell;
|
|
|
|
function eXcell_acheck(a) {
|
|
try {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
this.cell.obj = this
|
|
} catch (c) {}
|
|
this.changeState = function() {
|
|
if ((!this.grid.isEditable) || (this.cell.parentNode._locked) || (this.isDisabled())) {
|
|
return
|
|
}
|
|
if (this.grid.callEvent("onEditCell", [0, this.cell.parentNode.idd, this.cell._cellIndex]) != false) {
|
|
this.val = this.getValue();
|
|
if (this.val == "1") {
|
|
this.setValue("<checkbox state='false'>")
|
|
} else {
|
|
this.setValue("<checkbox state='true'>")
|
|
}
|
|
this.cell.wasChanged = true;
|
|
this.grid.callEvent("onEditCell", [1, this.cell.parentNode.idd, this.cell._cellIndex]);
|
|
this.grid.callEvent("onCheck", [this.cell.parentNode.idd, this.cell._cellIndex, (this.val != "1")]);
|
|
this.grid.callEvent("onCheckbox", [this.cell.parentNode.idd, this.cell._cellIndex, (this.val != "1")])
|
|
} else {
|
|
this.editor = null
|
|
}
|
|
};
|
|
this.getValue = function() {
|
|
try {
|
|
return this.cell.chstate.toString()
|
|
} catch (g) {
|
|
return null
|
|
}
|
|
};
|
|
this.isCheckbox = function() {
|
|
return true
|
|
};
|
|
this.isChecked = function() {
|
|
if (this.getValue() == "1") {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
};
|
|
this.setChecked = function(g) {
|
|
this.setValue(g.toString())
|
|
};
|
|
this.detach = function() {
|
|
return this.val != this.getValue()
|
|
};
|
|
this.drawCurrentState = function() {
|
|
if (this.cell.chstate == 1) {
|
|
return "<div onclick='(new eXcell_acheck(this.parentNode)).changeState(); (arguments[0]||event).cancelBubble=true;' style='cursor:pointer; font-weight:bold; text-align:center; '><span style='height:8px; width:8px; background:green; display:inline-block;'></span> Yes</div>"
|
|
} else {
|
|
return "<div onclick='(new eXcell_acheck(this.parentNode)).changeState(); (arguments[0]||event).cancelBubble=true;' style='cursor:pointer; text-align:center; '><span style='height:8px; width:8px; background:red; display:inline-block;'></span> No</div>"
|
|
}
|
|
}
|
|
}
|
|
eXcell_acheck.prototype = new eXcell;
|
|
eXcell_acheck.prototype.setValue = function(c) {
|
|
c = (c || "").toString();
|
|
if (c.indexOf("1") != -1 || c.indexOf("true") != -1) {
|
|
c = "1";
|
|
this.cell.chstate = "1"
|
|
} else {
|
|
c = "0";
|
|
this.cell.chstate = "0"
|
|
}
|
|
var a = this;
|
|
this.setCValue(this.drawCurrentState(), this.cell.chstate)
|
|
};
|
|
|
|
function eXcell_context(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid;
|
|
if (!this.grid._sub_context) {
|
|
return
|
|
}
|
|
this._sub = this.grid._sub_context[a._cellIndex];
|
|
if (!this._sub) {
|
|
return
|
|
}
|
|
this._sindex = this._sub[1];
|
|
this._sub = this._sub[0]
|
|
}
|
|
this.getValue = function() {
|
|
return _isIE ? this.cell.innerText : this.cell.textContent
|
|
};
|
|
this.setValue = function(g) {
|
|
this.cell._val = g;
|
|
var c = this._sub.itemPull[this._sub.idPrefix + this.cell._val];
|
|
g = c ? c.title : g;
|
|
this.setCValue((g || " "), g)
|
|
};
|
|
this.edit = function() {
|
|
var g = this.grid.getPosition(this.cell);
|
|
this._sub.showContextMenu(g[0] + this.cell.offsetWidth, g[1]);
|
|
var c = this.grid.editStop;
|
|
this.grid.editStop = function() {};
|
|
this.grid.editStop = c
|
|
};
|
|
this.detach = function() {
|
|
if (this.grid._sub_id != null) {
|
|
var c = this.cell._val;
|
|
this.setValue(this.grid._sub_id);
|
|
this.grid._sub_id = null;
|
|
return this.cell._val != c
|
|
}
|
|
this._sub.hideContextMenu()
|
|
}
|
|
}
|
|
eXcell_context.prototype = new eXcell;
|
|
dhtmlXGridObject.prototype.setSubContext = function(a, c, h) {
|
|
var g = this;
|
|
a.attachEvent("onClick", function(m, l) {
|
|
g._sub_id = m;
|
|
g.editStop();
|
|
a.hideContextMenu();
|
|
return true
|
|
});
|
|
if (!this._sub_context) {
|
|
this._sub_context = []
|
|
}
|
|
this._sub_context[c] = [a, h];
|
|
a.hideContextMenu()
|
|
};
|
|
|
|
function dhtmlXGridFromTable(obj, init) {
|
|
if (typeof(obj) != "object") {
|
|
obj = document.getElementById(obj)
|
|
}
|
|
var w = document.createElement("DIV");
|
|
w.setAttribute("width", obj.getAttribute("gridWidth") || (obj.offsetWidth ? (obj.offsetWidth + "px") : 0) || (window.getComputedStyle ? window.getComputedStyle(obj, null)["width"] : (obj.currentStyle ? obj.currentStyle.width : 0)));
|
|
w.setAttribute("height", obj.getAttribute("gridHeight") || (obj.offsetHeight ? (obj.offsetHeight + "px") : 0) || (window.getComputedStyle ? window.getComputedStyle(obj, null)["height"] : (obj.currentStyle ? obj.currentStyle.height : 0)));
|
|
w.className = obj.className;
|
|
obj.className = "";
|
|
if (obj.id) {
|
|
w.id = obj.id
|
|
}
|
|
var mr = obj;
|
|
var drag = obj.getAttribute("dragAndDrop");
|
|
mr.parentNode.insertBefore(w, mr);
|
|
var f = mr.getAttribute("name") || ("name_" + (new Date()).valueOf());
|
|
var windowf = new dhtmlXGridObject(w);
|
|
window[f] = windowf;
|
|
var acs = mr.getAttribute("onbeforeinit");
|
|
var acs2 = mr.getAttribute("oninit");
|
|
if (acs) {
|
|
eval(acs)
|
|
}
|
|
windowf.setImagePath(windowf.imgURL || (mr.getAttribute("imgpath") || mr.getAttribute("image_path") || ""));
|
|
var skin = mr.getAttribute("skin");
|
|
if (skin) {
|
|
windowf.setSkin(skin)
|
|
}
|
|
if (init) {
|
|
init(windowf)
|
|
}
|
|
var hrow = mr.rows[0];
|
|
var za = "";
|
|
var zb = "";
|
|
var zc = "";
|
|
var zd = "";
|
|
var ze = "";
|
|
for (var i = 0; i < hrow.cells.length; i++) {
|
|
za += (za ? "," : "") + hrow.cells[i].innerHTML;
|
|
var width = hrow.cells[i].getAttribute("width") || hrow.cells[i].offsetWidth || (window.getComputedStyle ? window.getComputedStyle(hrow.cells[i], null)["width"] : (hrow.cells[i].currentStyle ? hrow.cells[i].currentStyle.width : 0));
|
|
zb += (zb ? "," : "") + (width == "*" ? width : parseInt(width));
|
|
zc += (zc ? "," : "") + (hrow.cells[i].getAttribute("align") || "left");
|
|
zd += (zd ? "," : "") + (hrow.cells[i].getAttribute("type") || "ed");
|
|
ze += (ze ? "," : "") + (hrow.cells[i].getAttribute("sort") || "str");
|
|
var f_a = hrow.cells[i].getAttribute("format");
|
|
if (f_a) {
|
|
if (hrow.cells[i].getAttribute("type").toLowerCase().indexOf("calendar") != -1) {
|
|
windowf._dtmask = f_a
|
|
} else {
|
|
windowf.setNumberFormat(f_a, i)
|
|
}
|
|
}
|
|
}
|
|
windowf.setHeader(za);
|
|
windowf.setInitWidths(zb);
|
|
windowf.setColAlign(zc);
|
|
windowf.setColTypes(zd);
|
|
windowf.setColSorting(ze);
|
|
if (obj.getAttribute("gridHeight") == "auto") {
|
|
windowf.enableAutoHeigth(true)
|
|
}
|
|
if (obj.getAttribute("multiline")) {
|
|
windowf.enableMultiline(true)
|
|
}
|
|
var lmn = mr.getAttribute("lightnavigation");
|
|
if (lmn) {
|
|
windowf.enableLightMouseNavigation(lmn)
|
|
}
|
|
var evr = mr.getAttribute("evenrow");
|
|
var uevr = mr.getAttribute("unevenrow");
|
|
if (evr || uevr) {
|
|
windowf.enableAlterCss(evr, uevr)
|
|
}
|
|
if (drag) {
|
|
windowf.enableDragAndDrop(true)
|
|
}
|
|
windowf.init();
|
|
if (obj.getAttribute("split")) {
|
|
windowf.splitAt(obj.getAttribute("split"))
|
|
}
|
|
windowf._process_inner_html(mr, 1);
|
|
if (acs2) {
|
|
eval(acs2)
|
|
}
|
|
if (obj.parentNode && obj.parentNode.removeChild) {
|
|
obj.parentNode.removeChild(obj)
|
|
}
|
|
return windowf
|
|
}
|
|
dhtmlXGridObject.prototype._process_html = function(c) {
|
|
if (c.tagName && c.tagName == "TABLE") {
|
|
return this._process_inner_html(c, 0)
|
|
}
|
|
var a = document.createElement("DIV");
|
|
a.innerHTML = c.xmlDoc.responseText;
|
|
var g = a.getElementsByTagName("TABLE")[0];
|
|
this._process_inner_html(g, 0)
|
|
};
|
|
dhtmlXGridObject.prototype._process_inner_html = function(g, l) {
|
|
var c = g.rows.length;
|
|
for (var a = l; a < c; a++) {
|
|
var h = g.rows[a].getAttribute("id") || a;
|
|
this.rowsBuffer.push({
|
|
idd: h,
|
|
data: g.rows[a],
|
|
_parser: this._process_html_row,
|
|
_locator: this._get_html_data
|
|
})
|
|
}
|
|
this.render_dataset();
|
|
this.setSizes()
|
|
};
|
|
dhtmlXGridObject.prototype._process_html_row = function(o, l) {
|
|
var n = l.getElementsByTagName("TD");
|
|
var c = [];
|
|
o._attrs = this._xml_attrs(l);
|
|
for (var h = 0; h < n.length; h++) {
|
|
var m = n[h];
|
|
var a = m.getAttribute("type");
|
|
if (o.childNodes[h]) {
|
|
if (a) {
|
|
o.childNodes[h]._cellType = a
|
|
}
|
|
o.childNodes[h]._attrs = this._xml_attrs(n[h])
|
|
}
|
|
if (m.firstChild) {
|
|
c.push(m.innerHTML)
|
|
} else {
|
|
c.push("")
|
|
} if (m.colSpan > 1) {
|
|
o.childNodes[h]._attrs.colspan = m.colSpan;
|
|
for (var g = 1; g < m.colSpan; g++) {
|
|
c.push("")
|
|
}
|
|
}
|
|
}
|
|
for (h < n.length; h < o.childNodes.length; h++) {
|
|
o.childNodes[h]._attrs = {}
|
|
}
|
|
this._fillRow(o, (this._c_order ? this._swapColumns(c) : c));
|
|
return o
|
|
};
|
|
dhtmlXGridObject.prototype._get_html_data = function(c, a) {
|
|
c = c.firstChild;
|
|
while (true) {
|
|
if (!c) {
|
|
return ""
|
|
}
|
|
if (c.tagName == "TD") {
|
|
a--
|
|
}
|
|
if (a < 0) {
|
|
break
|
|
}
|
|
c = c.nextSibling
|
|
}
|
|
return (c.firstChild ? c.firstChild.data : "")
|
|
};
|
|
dhtmlxEvent(window, "load", function() {
|
|
var g = document.getElementsByTagName("table");
|
|
for (var c = 0; c < g.length; c++) {
|
|
if (g[c].className == "dhtmlxGrid") {
|
|
dhtmlXGridFromTable(g[c])
|
|
}
|
|
}
|
|
});
|
|
dhtmlXGridObject.prototype._process_xmlA = function(a) {
|
|
if (!a.doXPath) {
|
|
var g = new dtmlXMLLoaderObject(function() {});
|
|
if (typeof a == "string") {
|
|
g.loadXMLString(a)
|
|
} else {
|
|
if (a.responseXML) {
|
|
g.xmlDoc = a
|
|
} else {
|
|
g.xmlDoc = {}
|
|
}
|
|
g.xmlDoc.responseXML = a
|
|
}
|
|
a = g
|
|
}
|
|
this._parsing = true;
|
|
var n = a.getXMLTopNode(this.xml.top);
|
|
this._parseHead(n);
|
|
var m = a.doXPath(this.xml.row, n);
|
|
var l = parseInt(a.doXPath("//" + this.xml.top)[0].getAttribute("pos") || 0);
|
|
var h = parseInt(a.doXPath("//" + this.xml.top)[0].getAttribute("total_count") || 0);
|
|
if (h && !this.rowsBuffer[h - 1]) {
|
|
this.rowsBuffer[h - 1] = null
|
|
}
|
|
if (this.isTreeGrid()) {
|
|
this._get_xml_data = this._get_xml_dataA;
|
|
this._process_xml_row = this._process_xml_rowA;
|
|
return this._process_tree_xml(a)
|
|
}
|
|
for (var c = 0; c < m.length; c++) {
|
|
if (this.rowsBuffer[c + l]) {
|
|
continue
|
|
}
|
|
var o = m[c].getAttribute("id") || this.uid();
|
|
this.rowsBuffer[c + l] = {
|
|
idd: o,
|
|
data: m[c],
|
|
_parser: this._process_xml_rowA,
|
|
_locator: this._get_xml_dataA
|
|
};
|
|
this.rowsAr[o] = m[c]
|
|
}
|
|
this.render_dataset();
|
|
this._parsing = false;
|
|
return a.xmlDoc.responseXML ? a.xmlDoc.responseXML : a.xmlDoc
|
|
};
|
|
dhtmlXGridObject.prototype._process_xmlB = function(a) {
|
|
if (!a.doXPath) {
|
|
var g = new dtmlXMLLoaderObject(function() {});
|
|
if (typeof a == "string") {
|
|
g.loadXMLString(a)
|
|
} else {
|
|
if (a.responseXML) {
|
|
g.xmlDoc = a
|
|
} else {
|
|
g.xmlDoc = {}
|
|
}
|
|
g.xmlDoc.responseXML = a
|
|
}
|
|
a = g
|
|
}
|
|
this._parsing = true;
|
|
var n = a.getXMLTopNode(this.xml.top);
|
|
this._parseHead(n);
|
|
var m = a.doXPath(this.xml.row, n);
|
|
var l = parseInt(a.doXPath("//" + this.xml.top)[0].getAttribute("pos") || 0);
|
|
var h = parseInt(a.doXPath("//" + this.xml.top)[0].getAttribute("total_count") || 0);
|
|
if (h && !this.rowsBuffer[h - 1]) {
|
|
this.rowsBuffer[h - 1] = null
|
|
}
|
|
if (this.isTreeGrid()) {
|
|
this._get_xml_data = this._get_xml_dataB;
|
|
this._process_xml_row = this._process_xml_rowB;
|
|
return this._process_tree_xml(a)
|
|
}
|
|
for (var c = 0; c < m.length; c++) {
|
|
if (this.rowsBuffer[c + l]) {
|
|
continue
|
|
}
|
|
var o = m[c].getAttribute("id") || this.uid();
|
|
this.rowsBuffer[c + l] = {
|
|
idd: o,
|
|
data: m[c],
|
|
_parser: this._process_xml_rowB,
|
|
_locator: this._get_xml_dataB
|
|
};
|
|
this.rowsAr[o] = m[c]
|
|
}
|
|
this.render_dataset();
|
|
this._parsing = false;
|
|
return a.xmlDoc.responseXML ? a.xmlDoc.responseXML : a.xmlDoc
|
|
};
|
|
dhtmlXGridObject.prototype._process_xml_rowA = function(l, g) {
|
|
var a = [];
|
|
l._attrs = this._xml_attrs(g);
|
|
for (var c = 0; c < this.columnIds.length; c++) {
|
|
var m = this.columnIds[c];
|
|
var h = l._attrs[m] || "";
|
|
if (l.childNodes[c]) {
|
|
l.childNodes[c]._attrs = {}
|
|
}
|
|
a.push(h)
|
|
}
|
|
this._fillRow(l, (this._c_order ? this._swapColumns(a) : a));
|
|
return l
|
|
};
|
|
dhtmlXGridObject.prototype._get_xml_dataA = function(c, a) {
|
|
return c.getAttribute(this.getColumnId(a))
|
|
};
|
|
dhtmlXGridObject.prototype._process_xml_rowB = function(a, l) {
|
|
var o = [];
|
|
a._attrs = this._xml_attrs(l);
|
|
if (this._ud_enabled) {
|
|
var q = this.xmlLoader.doXPath("./userdata", l);
|
|
for (var g = q.length - 1; g >= 0; g--) {
|
|
this.setUserData(q[g].getAttribute("name"), q[g].firstChild ? q[g].firstChild.data : "")
|
|
}
|
|
}
|
|
for (var n = 0; n < l.childNodes.length; n++) {
|
|
var h = l.childNodes[n];
|
|
if (!h.tagName) {
|
|
continue
|
|
}
|
|
var c = this.getColIndexById(h.tagName);
|
|
if (isNaN(c)) {
|
|
continue
|
|
}
|
|
var m = h.getAttribute("type");
|
|
if (m) {
|
|
a.childNodes[c]._cellType = m
|
|
}
|
|
a.childNodes[c]._attrs = this._xml_attrs(h);
|
|
if (h.getAttribute("xmlcontent")) {} else {
|
|
if (h.firstChild) {
|
|
h = h.firstChild.data
|
|
} else {
|
|
h = ""
|
|
}
|
|
}
|
|
o[c] = h
|
|
}
|
|
for (var g = 0; g < a.childNodes.length; g++) {
|
|
if (!a.childNodes[g]._attrs) {
|
|
a.childNodes[g]._attrs = {}
|
|
}
|
|
}
|
|
this._fillRow(a, (this._c_order ? this._swapColumns(o) : o));
|
|
return a
|
|
};
|
|
dhtmlXGridObject.prototype._get_xml_dataB = function(c, a) {
|
|
var g = this.getColumnId(a);
|
|
c = c.firstChild;
|
|
while (true) {
|
|
if (!c) {
|
|
return ""
|
|
}
|
|
if (c.tagName == g) {
|
|
return (c.firstChild ? c.firstChild.data : "")
|
|
}
|
|
c = c.nextSibling
|
|
}
|
|
return ""
|
|
};
|
|
dhtmlXGridObject.prototype.startFastOperations = function() {
|
|
this._disF = ["setSizes", "callEvent", "_fixAlterCss", "cells4", "forEachRow", "_correctMonolite"];
|
|
this._disA = [];
|
|
for (var a = this._disF.length - 1; a >= 0; a--) {
|
|
this._disA[a] = this[this._disF[a]];
|
|
this[this._disF[a]] = function() {
|
|
return true
|
|
}
|
|
}
|
|
this._cellCache = [];
|
|
this.cells4 = function(g) {
|
|
var h = this._cellCache[g._cellIndex];
|
|
if (!h) {
|
|
h = this._cellCache[g._cellIndex] = this._disA[3].apply(this, [g]);
|
|
h.destructor = function() {
|
|
return true
|
|
};
|
|
h.setCValue = function(c) {
|
|
h.cell.innerHTML = c
|
|
}
|
|
}
|
|
h.cell = g;
|
|
h.combo = g._combo || this.combos[g._cellIndex];
|
|
return h
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.stopFastOperations = function() {
|
|
if (!this._disF) {
|
|
return
|
|
}
|
|
for (var a = this._disF.length - 1; a >= 0; a--) {
|
|
this[this._disF[a]] = this._disA[a]
|
|
}
|
|
if (this._correctMonolite) {
|
|
this._correctMonolite()
|
|
}
|
|
this.setSizes();
|
|
this.callEvent("onGridReconstructed", [])
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_number_filter = function(g, c) {
|
|
this._in_header_text_filter.call(this, g, c);
|
|
var a = this;
|
|
g.firstChild._filter = function() {
|
|
var h = a._get_filters(this.value, "num");
|
|
return function(n) {
|
|
var l = h.length > 0 ? false : true;
|
|
for (var m = 0; m < h.length; m++) {
|
|
l = l || h[m](n)
|
|
}
|
|
return l
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_string_filter = function(g, c) {
|
|
this._in_header_text_filter.call(this, g, c);
|
|
var a = this;
|
|
g.firstChild._filter = function() {
|
|
var h = a._get_filters(this.value, "str");
|
|
return function(n) {
|
|
var l = h.length > 0 ? false : true;
|
|
for (var m = 0; m < h.length; m++) {
|
|
l = l || h[m](n)
|
|
}
|
|
return l
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._get_filters = function(m, g) {
|
|
var a = m.split(",");
|
|
var h = [];
|
|
for (var c = 0; c < a.length; c++) {
|
|
if (a[c] == "") {
|
|
continue
|
|
}
|
|
var l = this["_get_" + g + "_filter"](a[c]);
|
|
h.push(l)
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXGridObject.prototype._get_str_filter = function(c) {
|
|
if (c == "null" || c == "empty") {
|
|
return new Function("value", 'if (value == null || value == "") return true; return false;')
|
|
}
|
|
if (c == "!null" || c == "!empty") {
|
|
return new Function("value", 'if (value == null || value == "") return false; return true;')
|
|
}
|
|
if (c.substr(0, 1) === "!") {
|
|
var a = c.substr(1);
|
|
return new Function("value", 'if (value !== "' + a + '") return true; return false;')
|
|
}
|
|
if (c.substr(0, 1) === "~") {
|
|
var a = c.substr(1);
|
|
return new Function("value", 'if (value.indexOf("' + a + '") !== -1) return true; return false;')
|
|
}
|
|
if (c.substr(0, 1) === "^" && c.substr(c.length - 1, 1) === "&") {
|
|
c = "=" + c.substr(1, c.length - 2)
|
|
}
|
|
if (c.substr(0, 1) === "^") {
|
|
var a = c.substr(1);
|
|
return new Function("value", "if (value.substr(0, " + a.length + ') === "' + a + '") return true; return false;')
|
|
}
|
|
if (c.substr(c.length - 1, 1) === "&") {
|
|
var a = c.substr(0, c.length - 1);
|
|
return new Function("value", "if (value.substr(value.length - " + a.length + ') === "' + a + '") return true; return false;')
|
|
}
|
|
if (c.substr(0, 1) === "=") {
|
|
var a = c.substr(1)
|
|
} else {
|
|
var a = c
|
|
}
|
|
return new Function("value", 'if (value === "' + a + '") return true; return false;')
|
|
};
|
|
dhtmlXGridObject.prototype._get_num_filter = function(l) {
|
|
if (l == "null" || l == "empty") {
|
|
return new Function("value", 'if (value == null || value == "") return true; return false;')
|
|
}
|
|
if (l == "!null" || l == "!empty") {
|
|
return new Function("value", 'if (value == null || value == "") return false; return true;')
|
|
}
|
|
var a = l.split("..");
|
|
if (a.length == 2) {
|
|
var m = parseFloat(a[0]);
|
|
var h = parseFloat(a[1]);
|
|
return new Function("value", "if (value >= " + m + " && value <= " + h + ") return true; return false;")
|
|
}
|
|
var g = l.match(/<>|>=|<=|>|<|=/);
|
|
if (g) {
|
|
var n = g[0];
|
|
var c = parseFloat(l.replace(n, ""))
|
|
} else {
|
|
var n = "==";
|
|
c = parseFloat(l)
|
|
} if (n == "<>") {
|
|
n = "!="
|
|
}
|
|
if (n == "=") {
|
|
n = "=="
|
|
}
|
|
return new Function("value", " if (value " + n + " " + c + " ) return true; return false;")
|
|
};
|
|
dhtmlXGridObject.prototype.attachHeaderA = dhtmlXGridObject.prototype.attachHeader;
|
|
dhtmlXGridObject.prototype.attachHeader = function() {
|
|
this.attachHeaderA.apply(this, arguments);
|
|
if (this._realfake) {
|
|
return true
|
|
}
|
|
this.formAutoSubmit();
|
|
if (typeof(this.FormSubmitOnlyChanged) == "undefined") {
|
|
this.submitOnlyChanged(true)
|
|
}
|
|
if (typeof(this._submitAR) == "undefined") {
|
|
this.submitAddedRows(true)
|
|
}
|
|
var a = this;
|
|
this._added_rows = [];
|
|
this._deleted_rows = [];
|
|
this.attachEvent("onRowAdded", function(c) {
|
|
a._added_rows.push(c);
|
|
a.forEachCell(c, function(g) {
|
|
g.cell.wasChanged = true
|
|
});
|
|
return true
|
|
});
|
|
this.attachEvent("onBeforeRowDeleted", function(c) {
|
|
a._deleted_rows.push(c);
|
|
return true
|
|
});
|
|
this.attachHeader = this.attachHeaderA
|
|
};
|
|
dhtmlXGridObject.prototype.formAutoSubmit = function() {
|
|
this.parentForm = this.detectParentFormPresent();
|
|
if (this.parentForm === false) {
|
|
return false
|
|
}
|
|
if (this.formEventAttached) {
|
|
return
|
|
}
|
|
this.formInputs = new Array();
|
|
var a = this;
|
|
dhtmlxEvent(this.parentForm, "submit", function() {
|
|
if (a.entBox) {
|
|
a.parentFormOnSubmit()
|
|
}
|
|
});
|
|
this.formEventAttached = true
|
|
};
|
|
dhtmlXGridObject.prototype.parentFormOnSubmit = function() {
|
|
this.formCreateInputCollection();
|
|
if (!this.callEvent("onBeforeFormSubmit", [])) {
|
|
return false
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.submitOnlyChanged = function(a) {
|
|
this.FormSubmitOnlyChanged = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype.submitColumns = function(a) {
|
|
if (typeof a == "string") {
|
|
a = a.split(this.delim)
|
|
}
|
|
this._submit_cols = a
|
|
};
|
|
dhtmlXGridObject.prototype.setFieldName = function(a) {
|
|
a = a.replace(/\{GRID_ID\}/g, "'+a1+'");
|
|
a = a.replace(/\{ROW_ID\}/g, "'+a2+'");
|
|
a = a.replace(/\{ROW_INDEX\}/g, "'+this.getRowIndex(a2)+'");
|
|
a = a.replace(/\{COLUMN_INDEX\}/g, "'+a3+'");
|
|
a = a.replace(/\{COLUMN_ID\}/g, "'+this.getColumnId(a3)+'");
|
|
this._input_mask = Function("a1", "a2", "a3", "return '" + a + "';")
|
|
};
|
|
dhtmlXGridObject.prototype.submitSerialization = function(a) {
|
|
this.FormSubmitSerialization = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype.submitAddedRows = function(a) {
|
|
this._submitAR = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype.submitOnlySelected = function(a) {
|
|
this.FormSubmitOnlySelected = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype.submitOnlyRowID = function(a) {
|
|
this.FormSubmitOnlyRowID = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype.createFormInput = function(c, g) {
|
|
var a = document.createElement("input");
|
|
a.type = "hidden";
|
|
if (this._input_mask && (typeof c != "string")) {
|
|
a.name = this._input_mask.apply(this, c)
|
|
} else {
|
|
a.name = ((this.globalBox || this.entBox).id || "dhtmlXGrid") + "_" + c
|
|
}
|
|
a.value = g;
|
|
this.parentForm.appendChild(a);
|
|
this.formInputs.push(a)
|
|
};
|
|
dhtmlXGridObject.prototype.createFormInputRow = function(g) {
|
|
var h = (this.globalBox || this.entBox).id;
|
|
for (var c = 0; c < this._cCount; c++) {
|
|
var a = this.cells3(g, c);
|
|
if (((!this.FormSubmitOnlyChanged) || a.wasChanged()) && (!this._submit_cols || this._submit_cols[c])) {
|
|
this.createFormInput(this._input_mask ? [h, g.idd, c] : (g.idd + "_" + c), a.getValue())
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.formCreateInputCollection = function() {
|
|
if (this.parentForm == false) {
|
|
return false
|
|
}
|
|
for (var a = 0; a < this.formInputs.length; a++) {
|
|
this.parentForm.removeChild(this.formInputs[a])
|
|
}
|
|
this.formInputs = new Array();
|
|
if (this.FormSubmitSerialization) {
|
|
this.createFormInput("serialized", this.serialize())
|
|
} else {
|
|
if (this.FormSubmitOnlySelected) {
|
|
if (this.FormSubmitOnlyRowID) {
|
|
this.createFormInput("selected", this.getSelectedId())
|
|
} else {
|
|
for (var a = 0; a < this.selectedRows.length; a++) {
|
|
this.createFormInputRow(this.selectedRows[a])
|
|
}
|
|
}
|
|
} else {
|
|
if (this._submitAR) {
|
|
if (this._added_rows.length) {
|
|
this.createFormInput("rowsadded", this._added_rows.join(","))
|
|
}
|
|
if (this._deleted_rows.length) {
|
|
this.createFormInput("rowsdeleted", this._deleted_rows.join(","))
|
|
}
|
|
}
|
|
this.forEachRow(function(c) {
|
|
this.getRowById(c);
|
|
this.createFormInputRow(this.rowsAr[c])
|
|
})
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.detectParentFormPresent = function() {
|
|
var a = false;
|
|
var c = this.entBox;
|
|
while (c && c.tagName && c != document.body) {
|
|
if (c.tagName.toLowerCase() == "form") {
|
|
a = c;
|
|
break
|
|
} else {
|
|
c = c.parentNode
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXGridObject.prototype.unGroup = function() {
|
|
if (!this._groups) {
|
|
return
|
|
}
|
|
this._dndProblematic = false;
|
|
delete this._groups;
|
|
delete this._gIndex;
|
|
if (this._fake) {
|
|
this._mirror_rowsCol()
|
|
}
|
|
this.forEachRow(function(a) {
|
|
this.rowsAr[a].style.display = ""
|
|
});
|
|
this._reset_view();
|
|
this.callEvent("onGridReconstructed", []);
|
|
this.callEvent("onUnGroup", [])
|
|
};
|
|
dhtmlXGridObject.prototype._mirror_rowsCol = function() {
|
|
this._fake._groups = this._groups;
|
|
this._fake._gIndex = this._gIndex;
|
|
this.rowsBuffer = dhtmlxArray();
|
|
for (var a = 0; a < this.rowsCol.length; a++) {
|
|
if (!this.rowsCol[a]._cntr) {
|
|
this.rowsBuffer.push(this.rowsCol[a])
|
|
}
|
|
}
|
|
this._fake.rowsBuffer = dhtmlxArray();
|
|
for (var a = 0; a < this._fake.rowsCol.length; a++) {
|
|
if (!this._fake.rowsCol[a]._cntr) {
|
|
this._fake.rowsBuffer.push(this._fake.rowsCol[a])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.groupBy = function(n, h) {
|
|
if (this._groups) {
|
|
this.unGroup()
|
|
}
|
|
this._dndProblematic = true;
|
|
this._groups = {};
|
|
if (!h) {
|
|
h = ["#title"];
|
|
for (var l = 1; l < this._cCount; l++) {
|
|
h.push("#cspan")
|
|
}
|
|
}
|
|
this._gmask = document.createElement("TR");
|
|
this._gmask.origin = h;
|
|
var m, g = 0;
|
|
for (var l = 0; l < h.length; l++) {
|
|
if (h[l] == "#cspan") {
|
|
m.colSpan = (parseInt(m.colSpan) || 1) + 1
|
|
} else {
|
|
m = document.createElement("TD");
|
|
m._cellIndex = l;
|
|
if (this._hrrar[l]) {
|
|
m.style.display = "none"
|
|
}
|
|
m.className = "group_row";
|
|
m.innerHTML = " ";
|
|
if (h[l] == "#title") {
|
|
this._gmask._title = g
|
|
} else {
|
|
m.align = this.cellAlign[l] || "left"
|
|
}
|
|
this._gmask.appendChild(m);
|
|
if (h[l].indexOf("#stat") == 0) {
|
|
this._gmask._math = true;
|
|
m._counter = [this["_g_" + h[l].replace("#", "")], l, g]
|
|
}
|
|
g++
|
|
}
|
|
}
|
|
for (var c in this._groups) {
|
|
this._groups[c] = this.undefined
|
|
}
|
|
this._gIndex = n;
|
|
if (this._fake && !this._realfake) {
|
|
this._fake._groups = [];
|
|
this._fake._gIndex = this._gIndex
|
|
}
|
|
this._nextRow = function(q, a) {
|
|
var o = this.rowsCol[q + a];
|
|
if (o && (o.style.display == "none" || o._cntr)) {
|
|
return this._nextRow(q + a, a)
|
|
}
|
|
return o
|
|
};
|
|
if (!this.__sortRowsBG) {
|
|
this._key_events = dhtmlXHeir({}, this._key_events);
|
|
this._key_events.k38_0_0 = function() {
|
|
if (this.editor && this.editor.combo) {
|
|
this.editor.shiftPrev()
|
|
} else {
|
|
var a = this.row.rowIndex;
|
|
if (!a) {
|
|
return
|
|
}
|
|
var o = this._nextRow(a - 1, -1);
|
|
if (o) {
|
|
this.selectCell(o, this.cell._cellIndex, true)
|
|
}
|
|
}
|
|
};
|
|
this._key_events.k13_1_0 = this._key_events.k13_0_1 = function() {};
|
|
this._key_events.k40_0_0 = function() {
|
|
if (this.editor && this.editor.combo) {
|
|
this.editor.shiftNext()
|
|
} else {
|
|
var a = this.row.rowIndex;
|
|
if (!a) {
|
|
return
|
|
}
|
|
var o = this._nextRow(a - 1, 1);
|
|
if (o) {
|
|
this.selectCell(o, this.cell._cellIndex, true)
|
|
}
|
|
}
|
|
};
|
|
this.attachEvent("onFilterStart", function() {
|
|
if (this._groups) {
|
|
this._groups = this.undefined
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onFilterEnd", function() {
|
|
if (typeof this._gIndex != "undefined") {
|
|
this.groupBy(this._gIndex, this._gmask.origin)
|
|
}
|
|
});
|
|
this.sortRows_bg = this.sortRows;
|
|
this.sortRows = function(q, o, a) {
|
|
if (typeof(this._groups) == "undefined") {
|
|
return this.sortRows_bg.apply(this, arguments)
|
|
}
|
|
this.callEvent("onBeforeSorting", [q, (o || "str"), (a || "asc")])
|
|
};
|
|
this.attachEvent("onBeforeSorting", function(q, o, a) {
|
|
if (typeof(this._groups) == "undefined") {
|
|
return true
|
|
}
|
|
if (q == this._gIndex) {
|
|
this._sortByGroup(q, o, a)
|
|
} else {
|
|
this._sortInGroup(q, o, a)
|
|
}
|
|
this.setSortImgState(true, q, a);
|
|
if (this._fake) {
|
|
this._mirror_rowsCol();
|
|
this._fake._groups = [];
|
|
this._fake._reset_view()
|
|
}
|
|
this.setSortImgState(true, q, a);
|
|
this.callEvent("onAfterSorting", [q, o, a]);
|
|
return false
|
|
});
|
|
this.attachEvent("onClearAll", function() {
|
|
this.unGroup()
|
|
});
|
|
this.attachEvent("onBeforeRowDeleted", function(q) {
|
|
if (!this._groups) {
|
|
return true
|
|
}
|
|
if (!this.rowsAr[q]) {
|
|
return true
|
|
}
|
|
var o = this.cells(q, this._gIndex).getValue();
|
|
if (o === "") {
|
|
o = " "
|
|
}
|
|
var a = this._groups[o];
|
|
this._dec_group(a);
|
|
return true
|
|
});
|
|
this.attachEvent("onAfterRowDeleted", function(a) {
|
|
this.updateGroups()
|
|
});
|
|
this.attachEvent("onCheckbox", function(q, a, o) {
|
|
this.callEvent("onEditCell", [2, q, a, (o ? 1 : 0), (o ? 0 : 1)])
|
|
});
|
|
this.attachEvent("onXLE", this.updateGroups);
|
|
this.attachEvent("onColumnHidden", this.hideGroupColumn);
|
|
this.attachEvent("onEditCell", function(C, s, y, x, D) {
|
|
if (!this._groups) {
|
|
return true
|
|
}
|
|
if (C == 2 && x != D && y == this._gIndex) {
|
|
if (D === "") {
|
|
D = " "
|
|
}
|
|
this._dec_group(this._groups[D]);
|
|
var a = this.rowsAr[s];
|
|
var A = this.rowsCol._dhx_find(a);
|
|
var v = this._inc_group(x);
|
|
var w = this.rowsCol[v];
|
|
if (a == w) {
|
|
w = w.nextSibling
|
|
}
|
|
var q = a.parentNode;
|
|
var u = a.rowIndex;
|
|
q.removeChild(a);
|
|
if (w) {
|
|
q.insertBefore(a, w)
|
|
} else {
|
|
q.appendChild(a)
|
|
}
|
|
this.rowsCol._dhx_insertAt(v, a);
|
|
if (v < A) {
|
|
A++
|
|
}
|
|
this.rowsCol._dhx_removeAt(A, a);
|
|
this._fixAlterCss()
|
|
} else {
|
|
if (C == 2 && x != D) {
|
|
this.updateGroups();
|
|
this._updateGroupView(this._groups[this.cells(s, this._gIndex).getValue() || " "])
|
|
}
|
|
}
|
|
return true
|
|
});
|
|
this.__sortRowsBG = true
|
|
}
|
|
this._groupExisting();
|
|
if (this._hrrar) {
|
|
for (var l = 0; l < this._hrrar.length; l++) {
|
|
if (this._hrrar[l]) {
|
|
this.hideGroupColumn(l, true)
|
|
}
|
|
}
|
|
}
|
|
this.callEvent("onGroup", []);
|
|
if (this._ahgr || this._awdth) {
|
|
this.setSizes()
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._sortInGroup = function(g, o, h) {
|
|
var q = this._groups_get();
|
|
q.reverse();
|
|
for (var m = 0; m < q.length; m++) {
|
|
var n = q[m]._cntr._childs;
|
|
var r = {};
|
|
for (var l = 0; l < n.length; l++) {
|
|
var s = this.cells3(n[l], g);
|
|
r[n[l].idd] = s.getDate ? s.getDate() : s.getValue()
|
|
}
|
|
this._sortCore(g, o, h, r, n)
|
|
}
|
|
this._groups_put(q);
|
|
this.setSizes();
|
|
this.callEvent("onGridReconstructed", [])
|
|
};
|
|
dhtmlXGridObject.prototype._sortByGroup = function(l, n, g) {
|
|
var c = this._groups_get();
|
|
var h = [];
|
|
for (var m = 0; m < c.length; m++) {
|
|
c[m].idd = "_sort_" + m;
|
|
h["_sort_" + m] = c[m]._cntr.text
|
|
}
|
|
this._sortCore(l, n, g, h, c);
|
|
this._groups_put(c);
|
|
this.callEvent("onGridReconstructed", []);
|
|
this.setSizes()
|
|
};
|
|
dhtmlXGridObject.prototype._inc_group = function(l, g, a) {
|
|
if (l === "") {
|
|
l = " "
|
|
}
|
|
if (!this._groups[l]) {
|
|
this._groups[l] = {
|
|
text: l,
|
|
row: this._addPseudoRow(),
|
|
count: 0,
|
|
state: g ? "plus" : "minus"
|
|
}
|
|
}
|
|
var h = this._groups[l];
|
|
h.row._cntr = h;
|
|
var c = this.rowsCol._dhx_find(h.row) + h.count + 1;
|
|
h.count++;
|
|
if (!a) {
|
|
this._updateGroupView(h);
|
|
this.updateGroups()
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXGridObject.prototype._dec_group = function(a) {
|
|
if (!a) {
|
|
return
|
|
}
|
|
a.count--;
|
|
if (a.count == 0) {
|
|
a.row.parentNode.removeChild(a.row);
|
|
this.rowsCol._dhx_removeAt(this.rowsCol._dhx_find(a.row));
|
|
delete this._groups[a.text]
|
|
} else {
|
|
this._updateGroupView(a)
|
|
} if (this._fake && !this._realfake) {
|
|
this._fake._dec_group(this._fake._groups[a.text])
|
|
}
|
|
this.updateGroups();
|
|
return true
|
|
};
|
|
dhtmlXGridObject.prototype._insertRowAt_gA = dhtmlXGridObject.prototype._insertRowAt;
|
|
dhtmlXGridObject.prototype._insertRowAt = function(g, h, c) {
|
|
if (typeof(this._groups) != "undefined") {
|
|
if (this._realfake) {
|
|
var l = this._fake._bfs_cells(g.idd, this._gIndex).getValue()
|
|
} else {
|
|
if (this._bfs_cells3) {
|
|
var l = this._bfs_cells3(g, this._gIndex).getValue()
|
|
} else {
|
|
var l = this.cells3(g, this._gIndex).getValue()
|
|
}
|
|
} if (!l) {
|
|
l = " "
|
|
}
|
|
h = this._inc_group(l, g.style.display == "none")
|
|
}
|
|
var a = this._insertRowAt_gA(g, h, c);
|
|
if (typeof(this._groups) != "undefined") {
|
|
this.expandGroup(l);
|
|
this._updateGroupView(this._groups[l]);
|
|
this.updateGroups()
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXGridObject.prototype._updateGroupView = function(g) {
|
|
if (this._fake && !this._realfake) {
|
|
return g.row.firstChild.innerHTML = " "
|
|
}
|
|
var a = this._gmask || this._fake._gmask;
|
|
var c = "<img style='margin-bottom:-4px' src='" + this.imgURL + g.state + ".gif'> ";
|
|
if (this.customGroupFormat) {
|
|
c += this.customGroupFormat(g.text, g.count)
|
|
} else {
|
|
c += g.text + " ( " + g.count + " ) "
|
|
}
|
|
g.row.childNodes[a._title].innerHTML = c
|
|
};
|
|
dhtmlXGridObject.prototype._addPseudoRow = function(l) {
|
|
var a = this._gmask || this._fake._gmask;
|
|
var h = a.cloneNode(true);
|
|
for (var c = 0; c < h.childNodes.length; c++) {
|
|
h.childNodes[c]._cellIndex = a.childNodes[c]._cellIndex;
|
|
if (this._realfake) {
|
|
h.childNodes[c].style.display = ""
|
|
}
|
|
}
|
|
var g = this;
|
|
h.onclick = function(m) {
|
|
if (!g.callEvent("onGroupClick", [this._cntr.text])) {
|
|
return
|
|
}
|
|
if (g._fake && g._realfake) {
|
|
g._fake._switchGroupState(g._fake._groups[this._cntr.text].row)
|
|
} else {
|
|
g._switchGroupState(this)
|
|
}(m || event).cancelBubble = "true"
|
|
};
|
|
h.ondblclick = function(m) {
|
|
(m || event).cancelBubble = "true"
|
|
};
|
|
if (!l) {
|
|
if (_isKHTML) {
|
|
this.obj.appendChild(h)
|
|
} else {
|
|
this.obj.firstChild.appendChild(h)
|
|
}
|
|
this.rowsCol.push(h)
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXGridObject.prototype._groups_get = function() {
|
|
var c = [];
|
|
this._temp_par = this.obj.parentNode;
|
|
this._temp_par.removeChild(this.obj);
|
|
var g = [];
|
|
for (var h = this.rowsCol.length - 1; h >= 0; h--) {
|
|
if (this.rowsCol[h]._cntr) {
|
|
this.rowsCol[h]._cntr._childs = g;
|
|
g = [];
|
|
c.push(this.rowsCol[h])
|
|
} else {
|
|
g.push(this.rowsCol[h])
|
|
}
|
|
this.rowsCol[h].parentNode.removeChild(this.rowsCol[h])
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXGridObject.prototype._groups_put = function(a) {
|
|
var l = this.rowsCol.stablesort;
|
|
this.rowsCol = new dhtmlxArray(0);
|
|
this.rowsCol.stablesort = l;
|
|
for (var h = 0; h < a.length; h++) {
|
|
var g = a[h]._cntr;
|
|
this.obj.firstChild.appendChild(g.row);
|
|
this.rowsCol.push(g.row);
|
|
g.row.idd = null;
|
|
for (var c = 0; c < g._childs.length; c++) {
|
|
this.obj.firstChild.appendChild(g._childs[c]);
|
|
this.rowsCol.push(g._childs[c])
|
|
}
|
|
delete g._childs
|
|
}
|
|
this._temp_par.appendChild(this.obj)
|
|
};
|
|
dhtmlXGridObject.prototype._groupExisting = function(c) {
|
|
if (!this.getRowsNum()) {
|
|
return
|
|
}
|
|
var c = [];
|
|
this._temp_par = this.obj.parentNode;
|
|
this._temp_par.removeChild(this.obj);
|
|
var g = [];
|
|
var h = this.rowsCol.length;
|
|
for (var l = 0; l < h; l++) {
|
|
var n = this.cells4(this.rowsCol[l].childNodes[this._gIndex]).getValue();
|
|
this.rowsCol[l].style.display = "";
|
|
if (!n) {
|
|
n = " "
|
|
}
|
|
if (!this._groups[n]) {
|
|
this._groups[n] = {
|
|
text: n,
|
|
row: this._addPseudoRow(true),
|
|
count: 0,
|
|
state: "minus"
|
|
};
|
|
var m = this._groups[n];
|
|
m.row._cntr = m;
|
|
this._groups[n]._childs = [];
|
|
c.push(m.row)
|
|
}
|
|
this._groups[n].count++;
|
|
this._groups[n]._childs.push(this.rowsCol[l]);
|
|
this.rowsCol[l].parentNode.removeChild(this.rowsCol[l])
|
|
}
|
|
for (var l = 0; l < c.length; l++) {
|
|
this._updateGroupView(c[l]._cntr)
|
|
}
|
|
this._groups_put(c);
|
|
if (this._fake && !this._realfake) {
|
|
this._mirror_rowsCol();
|
|
this._fake._groups = [];
|
|
this._fake._reset_view()
|
|
}
|
|
this.callEvent("onGridReconstructed", []);
|
|
this.updateGroups()
|
|
};
|
|
dhtmlXGridObject.prototype._switchGroupState = function(h) {
|
|
var g = h._cntr;
|
|
if (this._fake && !this._realfake) {
|
|
g.state = this._fake._groups[h._cntr.text].row._cntr.state;
|
|
this._fake._switchGroupState(this._fake._groups[h._cntr.text].row)
|
|
}
|
|
var c = this.rowsCol._dhx_find(g.row) + 1;
|
|
g.state = g.state == "minus" ? "plus" : "minus";
|
|
var a = g.state == "plus" ? "none" : "";
|
|
while (this.rowsCol[c] && !this.rowsCol[c]._cntr) {
|
|
this.rowsCol[c].style.display = a;
|
|
c++
|
|
}
|
|
this._updateGroupView(g);
|
|
this.callEvent("onGroupStateChanged", [g.text, (g.state == "minus")]);
|
|
this.setSizes()
|
|
};
|
|
dhtmlXGridObject.prototype.expandGroup = function(a) {
|
|
if (this._groups[a].state == "plus") {
|
|
this._switchGroupState(this._groups[a].row)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.collapseGroup = function(a) {
|
|
if (this._groups[a].state == "minus") {
|
|
this._switchGroupState(this._groups[a].row)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.expandAllGroups = function() {
|
|
for (var a in this._groups) {
|
|
if (this._groups[a] && this._groups[a].state == "plus") {
|
|
this._switchGroupState(this._groups[a].row)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.collapseAllGroups = function() {
|
|
for (var a in this._groups) {
|
|
if (this._groups[a] && this._groups[a].state == "minus") {
|
|
this._switchGroupState(this._groups[a].row)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.hideGroupColumn = function(m, l) {
|
|
if (this._fake) {
|
|
return
|
|
}
|
|
var h = -1;
|
|
var n = this._gmask.childNodes;
|
|
for (var g = 0; g < n.length; g++) {
|
|
if (n[g]._cellIndex == m) {
|
|
h = g;
|
|
break
|
|
}
|
|
}
|
|
if (h == -1) {
|
|
return
|
|
}
|
|
for (var c in this._groups) {
|
|
this._groups[c].row.childNodes[h].style.display = l ? "none" : ""
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.groupStat = function(c, h, g) {
|
|
g = this["_g_" + (g || "stat_total")];
|
|
var l = 0;
|
|
var a = 0;
|
|
this.forEachRowInGroup(c, function(m) {
|
|
l = g(l, this.cells(m, h).getValue() * 1, a);
|
|
a++
|
|
});
|
|
return l
|
|
};
|
|
dhtmlXGridObject.prototype.forEachRowInGroup = function(a, h) {
|
|
var l = this._groups[a].row.nextSibling;
|
|
if (l) {
|
|
while (l && !l._cntr) {
|
|
h.call(this, l.idd);
|
|
l = l.nextSibling
|
|
}
|
|
} else {
|
|
var g = this._groups[a]._childs;
|
|
if (g) {
|
|
for (var c = 0; c < g.length; c++) {
|
|
h.call(this, g[c].idd)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.updateGroups = function() {
|
|
if (!this._gmask || !this._gmask._math || this._parsing) {
|
|
return
|
|
}
|
|
var c = this._gmask.childNodes;
|
|
for (var a = 0; a < c.length; a++) {
|
|
if (c[a]._counter) {
|
|
this._b_processing.apply(this, c[a]._counter)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._b_processing = function(g, n, m) {
|
|
var o = 0,
|
|
h = 0;
|
|
if (!this._ecache[this.cellType[n]]) {
|
|
this.cells5({
|
|
parentNode: {
|
|
grid: this
|
|
}
|
|
}, this.cellType[n])
|
|
}
|
|
for (var l = this.rowsCol.length - 1; l >= 0; l--) {
|
|
if (!this.rowsCol[l]._cntr) {
|
|
o = g(o, this.cells3(this.rowsCol[l], n).getValue() * 1, h);
|
|
h++
|
|
} else {
|
|
this.cells5(this.rowsCol[l].childNodes[m], this.cellType[n]).setValue(o);
|
|
h = o = 0
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._g_stat_total = function(h, g, a) {
|
|
return h + g
|
|
};
|
|
dhtmlXGridObject.prototype._g_stat_min = function(h, g, a) {
|
|
if (!a) {
|
|
h = Infinity
|
|
}
|
|
return Math.min(h, g)
|
|
};
|
|
dhtmlXGridObject.prototype._g_stat_max = function(h, g, a) {
|
|
if (!a) {
|
|
h = -Infinity
|
|
}
|
|
return Math.max(h, g)
|
|
};
|
|
dhtmlXGridObject.prototype._g_stat_average = function(h, g, a) {
|
|
return (h * a + g) / (a + 1)
|
|
};
|
|
dhtmlXGridObject.prototype._g_stat_count = function(h, g, a) {
|
|
return h++
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_collapse = function(l, h, o) {
|
|
var a = l.tagName == "TD" ? l : l.parentNode;
|
|
h = a._cellIndexS;
|
|
if (!this._column_groups) {
|
|
this._column_groups = []
|
|
}
|
|
var n = o[1].split(":");
|
|
var n = o[1].split(":");
|
|
n = [n.shift(), n.join(":")];
|
|
var m = parseInt(n[0]);
|
|
l.innerHTML = o[0] + "<img src='" + this.imgURL + "minus.gif' style='padding-right:10px;height:16px'/><span style='position:relative; top:-6px;'>" + (n[1] || "") + "<span>";
|
|
l.style.paddingBottom = "0px";
|
|
var g = this;
|
|
this._column_groups[h] = l.getElementsByTagName("IMG")[0];
|
|
this._column_groups[h].onclick = function(q) {
|
|
(q || event).cancelBubble = true;
|
|
this._cstate = !this._cstate;
|
|
for (var c = h + 1; c < (h + m); c++) {
|
|
g.setColumnHidden(c, this._cstate)
|
|
}
|
|
if (this._cstate) {
|
|
if (a.colSpan && a.colSpan > 0) {
|
|
a._exp_colspan = a.colSpan;
|
|
var u = Math.max(1, a.colSpan - m);
|
|
if (!_isFF) {
|
|
for (var r = 0; r < a.colSpan - u; r++) {
|
|
var s = document.createElement("TD");
|
|
if (a.nextSibling) {
|
|
a.parentNode.insertBefore(s, a.nextSibling)
|
|
} else {
|
|
a.parentNode.appendChild(s)
|
|
}
|
|
}
|
|
}
|
|
a.colSpan = u
|
|
}
|
|
g.callEvent("onColumnCollapse", [h, this._cstate])
|
|
} else {
|
|
if (a._exp_colspan) {
|
|
a.colSpan = a._exp_colspan;
|
|
if (!_isFF) {
|
|
for (var r = 1; r < a._exp_colspan; r++) {
|
|
a.parentNode.removeChild(a.nextSibling)
|
|
}
|
|
}
|
|
g.callEvent("onColumnCollapse", [h, this._cstate])
|
|
}
|
|
}
|
|
this.src = g.imgURL + (this._cstate ? "plus.gif" : "minus.gif");
|
|
if (g.sortImg.style.display != "none") {
|
|
g.setSortImgPos()
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.collapseColumns = function(a) {
|
|
if (!this._column_groups[a] || this._column_groups[a]._cstate) {
|
|
return
|
|
}
|
|
this._column_groups[a].onclick({})
|
|
};
|
|
dhtmlXGridObject.prototype.expandColumns = function(a) {
|
|
if (!this._column_groups[a] || !this._column_groups[a]._cstate) {
|
|
return
|
|
}
|
|
this._column_groups[a].onclick({})
|
|
};
|
|
dhtmlXGridObject.prototype.enableHeaderMenu = function(a) {
|
|
if (typeof a == "string") {
|
|
a = a.split(",")
|
|
}
|
|
this._hm_config = a;
|
|
var c = this;
|
|
this.attachEvent("onInit", function() {
|
|
this.hdr.oncontextmenu = function(g) {
|
|
return c._doHContClick(g || window.event)
|
|
};
|
|
this.startColResizeA = this.startColResize;
|
|
this.startColResize = function(g) {
|
|
if (g.button == 2 || (_isMacOS && g.ctrlKey)) {
|
|
return this._doHContClick(g)
|
|
}
|
|
return this.startColResizeA(g)
|
|
};
|
|
this._chm_ooc = this.obj.onclick;
|
|
this._chm_hoc = this.hdr.onclick;
|
|
this.hdr.onclick = function(g) {
|
|
if (g && (g.button == 2 || (_isMacOS && g.ctrlKey))) {
|
|
return false
|
|
}
|
|
c._showHContext(false);
|
|
return c._chm_hoc.apply(this, arguments)
|
|
};
|
|
this.obj.onclick = function() {
|
|
c._showHContext(false);
|
|
return c._chm_ooc.apply(this, arguments)
|
|
}
|
|
});
|
|
dhtmlxEvent(document.body, "click", function() {
|
|
if (c._hContext) {
|
|
c._showHContext(false)
|
|
}
|
|
});
|
|
if (this.hdr.rows.length) {
|
|
this.callEvent("onInit", [])
|
|
}
|
|
this.enableHeaderMenu = function() {}
|
|
};
|
|
dhtmlXGridObject.prototype._doHContClick = function(c) {
|
|
function a(h) {
|
|
if (h.pageX || h.pageY) {
|
|
return {
|
|
x: h.pageX,
|
|
y: h.pageY
|
|
}
|
|
}
|
|
var l = ((_isIE) && (document.compatMode != "BackCompat")) ? document.documentElement : document.body;
|
|
return {
|
|
x: h.clientX + l.scrollLeft - l.clientLeft,
|
|
y: h.clientY + l.scrollTop - l.clientTop
|
|
}
|
|
}
|
|
this._createHContext();
|
|
var g = a(c);
|
|
this._showHContext(true, g.x, g.y);
|
|
c[_isIE ? "srcElement" : "target"].oncontextmenu = function(h) {
|
|
(h || event).cancelBubble = true;
|
|
return false
|
|
};
|
|
c.cancelBubble = true;
|
|
if (c.preventDefault) {
|
|
c.preventDefault()
|
|
}
|
|
return false
|
|
};
|
|
dhtmlXGridObject.prototype._createHContext = function() {
|
|
if (this._hContext) {
|
|
return this._hContext
|
|
}
|
|
var q = document.createElement("DIV");
|
|
q.oncontextmenu = function(a) {
|
|
(a || event).cancelBubble = true;
|
|
return false
|
|
};
|
|
q.onclick = function(a) {
|
|
(a || event).cancelBubble = true;
|
|
return true
|
|
};
|
|
q.className = "dhx_header_cmenu";
|
|
q.style.width = q.style.height = "5px";
|
|
q.style.display = "none";
|
|
var g = [];
|
|
var h = 0;
|
|
if (this._fake) {
|
|
h = this._fake._cCount
|
|
}
|
|
var n = h;
|
|
for (var h; h < this.hdr.rows[1].cells.length; h++) {
|
|
var r = this.hdr.rows[1].cells[h];
|
|
if (!this._hm_config || (this._hm_config[h] && this._hm_config[h] != "false")) {
|
|
if (r.firstChild && r.firstChild.tagName == "DIV") {
|
|
var o = r.firstChild.innerHTML
|
|
} else {
|
|
var o = r.innerHTML
|
|
}
|
|
o = o.replace(/<[^>]*>/gi, "");
|
|
g.push("<div class='dhx_header_cmenu_item'><input type='checkbox' column='" + n + "' len='" + (r.colSpan || 1) + "' checked='true' />" + o + "</div>")
|
|
}
|
|
n += (r.colSpan || 1)
|
|
}
|
|
q.innerHTML = g.join("");
|
|
var l = this;
|
|
var m = function() {
|
|
var s = this.getAttribute("column");
|
|
if (!this.checked && !l._checkLast(s)) {
|
|
return this.checked = true
|
|
}
|
|
if (l._realfake) {
|
|
l = l._fake
|
|
}
|
|
for (var a = 0; a < this.getAttribute("len"); a++) {
|
|
l.setColumnHidden((s * 1 + a * 1), !this.checked)
|
|
}
|
|
if (this.checked && l.getColWidth(s) == 0) {
|
|
l.adjustColumnSize(s)
|
|
}
|
|
};
|
|
for (var h = 0; h < q.childNodes.length; h++) {
|
|
q.childNodes[h].firstChild.onclick = m
|
|
}
|
|
document.body.insertBefore(q, document.body.firstChild);
|
|
this._hContext = q;
|
|
q.style.position = "absolute";
|
|
q.style.zIndex = 999;
|
|
q.style.width = "auto";
|
|
q.style.height = "auto";
|
|
q.style.display = "block"
|
|
};
|
|
dhtmlXGridObject.prototype._checkLast = function(c) {
|
|
for (var a = 0; a < this._cCount; a++) {
|
|
if ((!this._hrrar || !this._hrrar[a]) && (a != c)) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
};
|
|
dhtmlXGridObject.prototype._updateHContext = function() {
|
|
for (var g = 0; g < this._hContext.childNodes.length; g++) {
|
|
var h = this._hContext.childNodes[g].firstChild;
|
|
var a = h.getAttribute("column");
|
|
if (this.isColumnHidden(a) || (this.getColWidth(a) == 0)) {
|
|
h.checked = false
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._showHContext = function(c, a, g) {
|
|
if (c && this.enableColumnMove) {
|
|
this._hContext.parentNode.removeChild(this._hContext);
|
|
this._hContext = null
|
|
}
|
|
this._createHContext();
|
|
this._hContext.style.display = (c ? "block" : "none");
|
|
if (c) {
|
|
this._updateHContext(true);
|
|
this._hContext.style.left = a + "px";
|
|
this._hContext.style.top = g + "px"
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._process_json_row = function(l, m) {
|
|
l._attrs = m;
|
|
for (var g = 0; g < l.childNodes.length; g++) {
|
|
l.childNodes[g]._attrs = {}
|
|
}
|
|
if (m.userdata) {
|
|
for (var c in m.userdata) {
|
|
this.setUserData(l.idd, c, m.userdata[c])
|
|
}
|
|
}
|
|
m = this._c_order ? this._swapColumns(m.data) : m.data;
|
|
for (var h = 0; h < m.length; h++) {
|
|
if (typeof m[h] == "object" && m[h] != null) {
|
|
l.childNodes[h]._attrs = m[h];
|
|
if (m[h].type) {
|
|
l.childNodes[h]._cellType = m[h].type
|
|
}
|
|
m[h] = m[h].value
|
|
}
|
|
}
|
|
this._fillRow(l, m);
|
|
return l
|
|
};
|
|
dhtmlXGridObject.prototype._process_js_row = function(m, n) {
|
|
m._attrs = n;
|
|
for (var h = 0; h < m.childNodes.length; h++) {
|
|
m.childNodes[h]._attrs = {}
|
|
}
|
|
if (n.userdata) {
|
|
for (var g in n.userdata) {
|
|
this.setUserData(m.idd, g, n.userdata[g])
|
|
}
|
|
}
|
|
var c = [];
|
|
for (var l = 0; l < this.columnIds.length; l++) {
|
|
c[l] = n[this.columnIds[l]];
|
|
if (typeof c[l] == "object" && c[l] != null) {
|
|
m.childNodes[l]._attrs = c[l];
|
|
if (c[l].type) {
|
|
m.childNodes[l]._cellType = c[l].type
|
|
}
|
|
c[l] = c[l].value
|
|
}
|
|
if (!c[l] && c[l] !== 0) {
|
|
c[l] = ""
|
|
}
|
|
}
|
|
this._fillRow(m, c);
|
|
return m
|
|
};
|
|
dhtmlXGridObject.prototype.updateFromJSON = function(a, h, c, g) {
|
|
if (typeof h == "undefined") {
|
|
h = true
|
|
}
|
|
this._refresh_mode = [true, h, c];
|
|
this.load(a, g, "json")
|
|
}, dhtmlXGridObject.prototype._refreshFromJSON = 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 = g.parent || 0;
|
|
var n = {};
|
|
if (this._refresh_mode[2]) {
|
|
if (r != -1) {
|
|
this._h2.forEachChild(l, function(s) {
|
|
n[s.id] = true
|
|
}, this)
|
|
} else {
|
|
this.forEachRow(function(s) {
|
|
n[s] = true
|
|
})
|
|
}
|
|
}
|
|
var q = g.rows;
|
|
for (var h = 0; h < q.length; h++) {
|
|
var o = q[h];
|
|
var a = o.id;
|
|
n[a] = false;
|
|
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_json_row(this.rowsAr[a], o, -1);
|
|
this._postRowProcessing(this.rowsAr[a], true)
|
|
} else {
|
|
if (this._refresh_mode[1]) {
|
|
var m = {
|
|
idd: a,
|
|
data: o,
|
|
_parser: this._process_json_row,
|
|
_locator: this._get_json_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, l)).buff = this.rowsBuffer[this.rowsBuffer.length - 1]
|
|
}
|
|
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) {
|
|
this._renderSort()
|
|
}
|
|
if (this._f_rowsBuffer) {
|
|
this._f_rowsBuffer = null;
|
|
this.filterByAll()
|
|
}
|
|
}, dhtmlXGridObject.prototype._process_js = function(a) {
|
|
return this._process_json(a, "js")
|
|
}, dhtmlXGridObject.prototype._process_json = function(data, mode) {
|
|
this._parsing = true;
|
|
try {
|
|
if (data && data.xmlDoc) {
|
|
eval("dhtmlx.temp=" + data.xmlDoc.responseText + ";");
|
|
data = dhtmlx.temp
|
|
} else {
|
|
if (typeof data == "string") {
|
|
eval("dhtmlx.temp=" + data + ";");
|
|
data = dhtmlx.temp
|
|
}
|
|
}
|
|
} catch (e) {
|
|
dhtmlxError.throwError("LoadXML", "Incorrect JSON", [(data.xmlDoc || data), this]);
|
|
data = {
|
|
rows: []
|
|
}
|
|
}
|
|
if (this._refresh_mode) {
|
|
return this._refreshFromJSON(data)
|
|
}
|
|
var cr = parseInt(data.pos || 0);
|
|
var total = parseInt(data.total_count || 0);
|
|
var reset = false;
|
|
if (total) {
|
|
if (!this.rowsBuffer[total - 1]) {
|
|
if (this.rowsBuffer.length) {
|
|
reset = true
|
|
}
|
|
this.rowsBuffer[total - 1] = null
|
|
}
|
|
if (total < this.rowsBuffer.length) {
|
|
this.rowsBuffer.splice(total, this.rowsBuffer.length - total);
|
|
reset = true
|
|
}
|
|
}
|
|
for (var key in data) {
|
|
if (key != "rows") {
|
|
this.setUserData("", key, data[key])
|
|
}
|
|
}
|
|
if (mode == "js" && data.collections) {
|
|
for (var colkey in data.collections) {
|
|
var index = this.getColIndexById(colkey);
|
|
var colrecs = data.collections[colkey];
|
|
if (index !== window.undefined) {
|
|
if (this.cellType[index] == "clist") {
|
|
colplaindata = [];
|
|
for (var j = 0; j < colrecs.length; j++) {
|
|
colplaindata.push(colrecs[j].label)
|
|
}
|
|
this.registerCList(index, colplaindata)
|
|
} else {
|
|
var combo = this.getCombo(index);
|
|
for (var j = 0; j < colrecs.length; j++) {
|
|
combo.put(colrecs[j].value, colrecs[j].label)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this.isTreeGrid()) {
|
|
return this._process_tree_json(data, null, null, mode)
|
|
}
|
|
if (mode == "js") {
|
|
if (data.data) {
|
|
data = data.data
|
|
}
|
|
for (var i = 0; i < data.length; i++) {
|
|
if (this.rowsBuffer[i + cr]) {
|
|
continue
|
|
}
|
|
var row = data[i];
|
|
var id = row.id || (i + 1);
|
|
this.rowsBuffer[i + cr] = {
|
|
idd: id,
|
|
data: row,
|
|
_parser: this._process_js_row,
|
|
_locator: this._get_js_data
|
|
};
|
|
this.rowsAr[id] = data[i]
|
|
}
|
|
} else {
|
|
for (var i = 0; i < data.rows.length; i++) {
|
|
if (this.rowsBuffer[i + cr]) {
|
|
continue
|
|
}
|
|
var id = data.rows[i].id;
|
|
this.rowsBuffer[i + cr] = {
|
|
idd: id,
|
|
data: data.rows[i],
|
|
_parser: this._process_json_row,
|
|
_locator: this._get_json_data
|
|
};
|
|
this.rowsAr[id] = data.rows[i]
|
|
}
|
|
} if (reset && this._srnd) {
|
|
var h = this.objBox.scrollTop;
|
|
this._reset_view();
|
|
this.objBox.scrollTop = h
|
|
} else {
|
|
this.render_dataset()
|
|
}
|
|
this._parsing = false
|
|
};
|
|
dhtmlXGridObject.prototype._get_json_data = function(c, a) {
|
|
if (typeof c.data[a] == "object") {
|
|
return c.data[a].value
|
|
} else {
|
|
return c.data[a]
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._process_tree_json = function(h, l, c, n) {
|
|
this._parsing = true;
|
|
var a = false;
|
|
if (!l) {
|
|
this.render_row = this.render_row_tree;
|
|
a = true;
|
|
l = h;
|
|
c = l.parent || 0;
|
|
if (c == "0") {
|
|
c = 0
|
|
}
|
|
if (!this._h2) {
|
|
this._h2 = new dhtmlxHierarchy()
|
|
}
|
|
if (this._fake) {
|
|
this._fake._h2 = this._h2
|
|
}
|
|
}
|
|
if (n == "js") {
|
|
if (l.data && !c) {
|
|
h = l.data
|
|
}
|
|
if (l.rows) {
|
|
l = l.rows
|
|
}
|
|
for (var g = 0; g < l.length; g++) {
|
|
var o = l[g].id;
|
|
var m = this._h2.add(o, c);
|
|
m.buff = {
|
|
idd: o,
|
|
data: l[g],
|
|
_parser: this._process_js_row,
|
|
_locator: this._get_js_data
|
|
};
|
|
if (l[g].open) {
|
|
m.state = "minus"
|
|
}
|
|
this.rowsAr[o] = m.buff;
|
|
this._process_tree_json(l[g], l[g], o, n)
|
|
}
|
|
} else {
|
|
if (l.rows) {
|
|
for (var g = 0; g < l.rows.length; g++) {
|
|
var o = l.rows[g].id;
|
|
var m = this._h2.add(o, c);
|
|
m.buff = {
|
|
idd: o,
|
|
data: l.rows[g],
|
|
_parser: this._process_json_row,
|
|
_locator: this._get_json_data
|
|
};
|
|
if (l.rows[g].open) {
|
|
m.state = "minus"
|
|
}
|
|
this.rowsAr[o] = m.buff;
|
|
this._process_tree_json(l.rows[g], l.rows[g], o, n)
|
|
}
|
|
}
|
|
} if (a) {
|
|
if (c != 0) {
|
|
this._h2.change(c, "state", "minus")
|
|
}
|
|
this._updateTGRState(this._h2.get[c]);
|
|
this._h2_to_buff();
|
|
if (c != 0 && (this._srnd || this.pagingOn)) {
|
|
this._renderSort()
|
|
} else {
|
|
this.render_dataset()
|
|
} if (this._slowParse === false) {
|
|
this.forEachRow(function(q) {
|
|
this.render_row_tree(0, q)
|
|
})
|
|
}
|
|
this._parsing = false;
|
|
if (c != 0 && !this._srnd) {
|
|
this.callEvent("onOpenEnd", [c, 1])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.enableMarkedCells = function(a) {
|
|
this.markedRowsArr = new dhtmlxArray(0);
|
|
this.markedCellsArr = new Array(0);
|
|
this.lastMarkedRow = null;
|
|
this.lastMarkedColumn = null;
|
|
this.markedCells = true;
|
|
this.lastMarkMethod = 0;
|
|
if (arguments.length > 0) {
|
|
if (!convertStringToBoolean(a)) {
|
|
this.markedCells = false
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.doMark = function(g, n) {
|
|
var m = g.parentNode.idd;
|
|
this.setActive(true);
|
|
if (!m) {
|
|
return
|
|
}
|
|
this.editStop();
|
|
this.cell = g;
|
|
this.row = g.parentNode;
|
|
var q = g._cellIndex;
|
|
if (!n) {
|
|
n = 0
|
|
}
|
|
if (n == 0) {
|
|
this.unmarkAll()
|
|
} else {
|
|
if (n == 1) {
|
|
if (this.lastMarkedRow) {
|
|
var c = Math.min(this.getRowIndex(m), this.getRowIndex(this.lastMarkedRow));
|
|
var o = Math.max(this.getRowIndex(m), this.getRowIndex(this.lastMarkedRow));
|
|
var a = Math.min(q, this.lastMarkedColumn);
|
|
var r = Math.max(q, this.lastMarkedColumn);
|
|
for (var l = c; l < o + 1; l++) {
|
|
for (var h = a; h < r + 1; h++) {
|
|
this.mark(this.getRowId(l), h, true)
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (n == 2) {
|
|
if (this.markedRowsArr._dhx_find(m) != -1) {
|
|
for (var s = 0; s < this.markedCellsArr[m].length; s++) {
|
|
if (this.markedCellsArr[m][s] == q) {
|
|
this.mark(m, q, false);
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} if (!this.markedCellsArr[m]) {
|
|
this.markedCellsArr[m] = new dhtmlxArray(0)
|
|
}
|
|
if (n != 1) {
|
|
this.mark(m, q)
|
|
}
|
|
this.moveToVisible(this.cells(m, q).cell);
|
|
this.lastMarkedRow = m;
|
|
this.lastMarkedColumn = q;
|
|
this.lastMarkMethod = n
|
|
};
|
|
dhtmlXGridObject.prototype.mark = function(g, c, h) {
|
|
if (arguments.length > 2) {
|
|
if (!convertStringToBoolean(h)) {
|
|
this.cells(g, c).cell.className = this.cells(g, c).cell.className.replace(/cellselected/g, "");
|
|
if (this.markedRowsArr._dhx_find(g) != -1) {
|
|
var a = this.markedCellsArr[g]._dhx_find(c);
|
|
if (a != -1) {
|
|
this.markedCellsArr[g]._dhx_removeAt(a);
|
|
if (this.markedCellsArr[g].length == 0) {
|
|
this.markedRowsArr._dhx_removeAt(this.markedRowsArr._dhx_find(g))
|
|
}
|
|
this.callEvent("onCellUnMarked", [g, c])
|
|
}
|
|
}
|
|
return true
|
|
}
|
|
}
|
|
this.cells(g, c).cell.className += " cellselected";
|
|
if (this.markedRowsArr._dhx_find(g) == -1) {
|
|
this.markedRowsArr[this.markedRowsArr.length] = g
|
|
}
|
|
if (!this.markedCellsArr[g]) {
|
|
this.markedCellsArr[g] = new dhtmlxArray(0)
|
|
}
|
|
if (this.markedCellsArr[g]._dhx_find(c) == -1) {
|
|
this.markedCellsArr[g][this.markedCellsArr[g].length] = c;
|
|
this.callEvent("onCellMarked", [g, c])
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.unmarkAll = function() {
|
|
if (this.markedRowsArr) {
|
|
for (var a = 0; a < this.markedRowsArr.length; a++) {
|
|
var g = this.markedRowsArr[a];
|
|
if (this.rowsAr[g]) {
|
|
for (var c = 0; c < this.markedCellsArr[g].length; c++) {
|
|
this.callEvent("onCellUnMarked", [g, this.markedCellsArr[g][c]]);
|
|
this.cells(g, this.markedCellsArr[g][c]).cell.className = this.cells(g, this.markedCellsArr[g][c]).cell.className.replace(/cellselected/g, "")
|
|
}
|
|
}
|
|
}
|
|
this.markedRowsArr = new dhtmlxArray(0);
|
|
this.markedCellsArr = new Array(0)
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXGridObject.prototype.getMarked = function() {
|
|
var g = new Array();
|
|
if (this.markedRowsArr) {
|
|
for (var a = 0; a < this.markedRowsArr.length; a++) {
|
|
var h = this.markedRowsArr[a];
|
|
for (var c = 0; c < this.markedCellsArr[h].length; c++) {
|
|
g[g.length] = [h, this.markedCellsArr[h][c]]
|
|
}
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
|
|
function eXcell_math(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
}
|
|
this.edit = function() {
|
|
this.grid.editor = new eXcell_ed(this.cell);
|
|
this.grid.editor.fix_self = true;
|
|
this.grid.editor.getValue = this.cell.original ? (function() {
|
|
return this.cell.original
|
|
}) : this.getValue;
|
|
this.grid.editor.setValue = this.setValue;
|
|
this.grid.editor.edit()
|
|
};
|
|
this.isDisabled = function() {
|
|
return !this.grid._mathEdit
|
|
};
|
|
this.setValue = function(c) {
|
|
c = this.grid._compileSCL(c, this.cell, this.fix_self);
|
|
if (this.grid._strangeParams[this.cell._cellIndex]) {
|
|
this.grid.cells5(this.cell, this.grid._strangeParams[this.cell._cellIndex]).setValue(c)
|
|
} else {
|
|
this.setCValue(c);
|
|
this.cell._clearCell = false
|
|
}
|
|
};
|
|
this.getValue = function() {
|
|
if (this.grid._strangeParams[this.cell._cellIndex]) {
|
|
return this.grid.cells5(this.cell, this.grid._strangeParams[this.cell._cellIndex]).getValue()
|
|
}
|
|
return this.cell.innerHTML
|
|
}
|
|
}
|
|
eXcell_math.prototype = new eXcell;
|
|
dhtmlXGridObject.prototype._init_point_bm = dhtmlXGridObject.prototype._init_point;
|
|
dhtmlXGridObject.prototype._init_point = function() {
|
|
this._mat_links = {};
|
|
this._aggregators = [];
|
|
this.attachEvent("onClearAll", function() {
|
|
this._mat_links = {};
|
|
this._aggregators = []
|
|
});
|
|
this.attachEvent("onCellChanged", function(m, l) {
|
|
if (this._mat_links[m]) {
|
|
var a = this._mat_links[m][l];
|
|
if (a) {
|
|
for (var h = 0; h < a.length; h++) {
|
|
if (a[h].parentNode) {
|
|
this.cells5(a[h]).setValue(this._calcSCL(a[h]))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!this._parsing && this._aggregators[l]) {
|
|
var g = this._h2.get[m].parent.id;
|
|
if (g != 0) {
|
|
var c = this.cells(g, l);
|
|
c.setValue(this._calcSCL(c.cell))
|
|
}
|
|
}
|
|
});
|
|
this.attachEvent("onAfterRowDeleted", function(h, c) {
|
|
if (c != 0) {
|
|
if (!this._parsing && this._aggregators.length) {
|
|
for (var g = 0; g < this._aggregators.length; g++) {
|
|
if (this._aggregators[g]) {
|
|
var a = this.cells(c, g);
|
|
a.setValue(this._calcSCL(a.cell))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onXLE", function() {
|
|
for (var a = 0; a < this._aggregators.length; a++) {
|
|
if (this._aggregators[a]) {
|
|
this._h2.forEachChild(0, function(g) {
|
|
if (g.childs.length != 0) {
|
|
var c = this.cells(g.id, a);
|
|
c.setValue(this._calcSCL(c.cell))
|
|
}
|
|
}, this)
|
|
}
|
|
}
|
|
});
|
|
this._init_point = this._init_point_bm;
|
|
if (this._init_point) {
|
|
this._init_point()
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.enableMathSerialization = function(a) {
|
|
this._mathSerialization = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype.setMathRound = function(a) {
|
|
this._roundDl = a;
|
|
this._roundD = Math.pow(10, a)
|
|
};
|
|
dhtmlXGridObject.prototype.enableMathEditing = function(a) {
|
|
this._mathEdit = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype._calcSCL = function(cell) {
|
|
if (!cell._code) {
|
|
return this.cells5(cell).getValue()
|
|
}
|
|
try {
|
|
dhtmlx.agrid = this;
|
|
var z = eval(cell._code)
|
|
} catch (e) {
|
|
return ("#SCL")
|
|
}
|
|
if (this._roundD) {
|
|
var pre = Math.abs(z) < 1 ? "0" : "";
|
|
if (z < 0) {
|
|
pre = "-" + pre
|
|
}
|
|
z = Math.round(Math.abs(z) * this._roundD).toString();
|
|
if (z == 0) {
|
|
return 0
|
|
}
|
|
if (this._roundDl > 0) {
|
|
var n = z.length - this._roundDl;
|
|
if (n < 0) {
|
|
z = ("000000000" + z).substring(9 + n);
|
|
n = 0
|
|
}
|
|
return (pre + z.substring(0, n) + "." + z.substring(n, z.length))
|
|
}
|
|
return pre + z
|
|
}
|
|
return z
|
|
};
|
|
dhtmlXGridObject.prototype._countTotal = function(m, c) {
|
|
var a = 0;
|
|
var l = this._h2.get[m];
|
|
for (var g = 0; g < l.childs.length; g++) {
|
|
if (!l.childs[g].buff) {
|
|
return a
|
|
}
|
|
if (l.childs[g].buff._parser) {
|
|
this._h2.forEachChild(m, function(n) {
|
|
if (n.childs.length == 0) {
|
|
var o = parseFloat(this._get_cell_value(n.buff, c), 10);
|
|
if (o) {
|
|
a += o
|
|
}
|
|
}
|
|
}, this);
|
|
return a
|
|
}
|
|
var h = parseFloat(this._get_cell_value(l.childs[g].buff, c), 10);
|
|
if (h) {
|
|
a += h
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXGridObject.prototype._compileSCL = function(g, c, a) {
|
|
if (g === null || g === window.undefined) {
|
|
return g
|
|
}
|
|
g = g.toString();
|
|
if (g.indexOf("=") != 0 || !c.parentNode) {
|
|
this._reLink([], c);
|
|
if (a) {
|
|
c._code = c.original = null
|
|
}
|
|
return g
|
|
}
|
|
c.original = g;
|
|
var m = null;
|
|
g = g.replace("=", "");
|
|
if (g.indexOf("sum") != -1) {
|
|
g = g.replace("sum", "(dhtmlx.agrid._countTotal('" + c.parentNode.idd + "'," + c._cellIndex + "))");
|
|
if (!this._aggregators) {
|
|
this._aggregators = []
|
|
}
|
|
this._aggregators[c._cellIndex] = "sum";
|
|
c._code = g;
|
|
return this._parsing ? "" : this._calcSCL(c)
|
|
}
|
|
if (g.indexOf("[[") != -1) {
|
|
var l = /(\[\[([^\,]*)\,([^\]]*)]\])/g;
|
|
dhtmlx.agrid = this;
|
|
m = m || (new Array());
|
|
g = g.replace(l, function(o, n, r, q) {
|
|
if (r == "-") {
|
|
r = c.parentNode.idd
|
|
}
|
|
if (r.indexOf("#") == 0) {
|
|
r = dhtmlx.agrid.getRowId(r.replace("#", ""))
|
|
}
|
|
m[m.length] = [r, q];
|
|
return '(parseFloat(dhtmlx.agrid.cells("' + r + '",' + q + ").getValue(),10))"
|
|
})
|
|
}
|
|
if (g.indexOf(":") != -1) {
|
|
var l = /:(\w+)/g;
|
|
dhtmlx.agrid = this;
|
|
var h = c.parentNode.idd;
|
|
m = m || (new Array());
|
|
g = g.replace(l, function(o, n, r, q) {
|
|
m[m.length] = [h, dhtmlx.agrid.getColIndexById(n)];
|
|
return '(parseFloat(dhtmlx.agrid.cells("' + h + '",dhtmlx.agrid.getColIndexById("' + n + '")).getValue(),10))'
|
|
})
|
|
} else {
|
|
var l = /c([0-9]+)/g;
|
|
dhtmlx.agrid = this;
|
|
var h = c.parentNode.idd;
|
|
m = m || (new Array());
|
|
g = g.replace(l, function(o, n, r, q) {
|
|
m[m.length] = [h, n];
|
|
return '(parseFloat(dhtmlx.agrid.cells("' + h + '",' + n + ").getValue(),10))"
|
|
})
|
|
}
|
|
this._reLink(m, c);
|
|
c._code = g;
|
|
return this._calcSCL(c)
|
|
};
|
|
dhtmlXGridObject.prototype._reLink = function(c, a) {
|
|
if (!c.length) {
|
|
return
|
|
}
|
|
for (var h = 0; h < c.length; h++) {
|
|
if (!this._mat_links[c[h][0]]) {
|
|
this._mat_links[c[h][0]] = {}
|
|
}
|
|
var g = this._mat_links[c[h][0]];
|
|
if (!g[c[h][1]]) {
|
|
g[c[h][1]] = []
|
|
}
|
|
g[c[h][1]].push(a)
|
|
}
|
|
};
|
|
if (_isKHTML) {
|
|
(function() {
|
|
var a = String.prototype.replace;
|
|
String.prototype.replace = function(r, g) {
|
|
if (typeof g != "function") {
|
|
return a.apply(this, arguments)
|
|
}
|
|
var l = "" + this;
|
|
var o = g;
|
|
if (!(r instanceof RegExp)) {
|
|
var n = l.indexOf(r);
|
|
return (n == -1 ? l : a.apply(l, [r, o(r, n, l)]))
|
|
}
|
|
var c = r;
|
|
var s = [];
|
|
var m = c.lastIndex;
|
|
var q;
|
|
while ((q = c.exec(l)) != null) {
|
|
var n = q.index;
|
|
var h = q.concat(n, l);
|
|
s.push(l.slice(m, n), o.apply(null, h).toString());
|
|
if (!c.global) {
|
|
m += RegExp.lastMatch.length;
|
|
break
|
|
} else {
|
|
m = c.lastIndex
|
|
}
|
|
}
|
|
s.push(l.slice(m));
|
|
return s.join("")
|
|
}
|
|
})()
|
|
}
|
|
dhtmlXGridObject.prototype.insertColumn = function(g, o, r, a, n, q, u, c, l) {
|
|
g = parseInt(g);
|
|
if (g > this._cCount) {
|
|
g = this._cCount
|
|
}
|
|
if (!this._cMod) {
|
|
this._cMod = this._cCount
|
|
}
|
|
this._processAllArrays(this._cCount, g - 1, [(o || " "), (a || 100), (r || "ed"), (q || "left"), (u || ""), (n || "na"), (l || ""), "", this._cMod, (a || 100)]);
|
|
this._processAllRows("_addColInRow", g);
|
|
if (typeof(o) == "object") {
|
|
for (var m = 1; m < this.hdr.rows.length; m++) {
|
|
if (o[m - 1] == "#rspan") {
|
|
var w = m - 1;
|
|
var v = false;
|
|
var s = null;
|
|
while (!v) {
|
|
var s = this.hdr.rows[w];
|
|
for (var h = 0; h < s.cells.length; h++) {
|
|
if (s.cells[h]._cellIndex == g) {
|
|
v = h;
|
|
break
|
|
}
|
|
}
|
|
w--
|
|
}
|
|
this.hdr.rows[w + 1].cells[h].rowSpan = (this.hdr.rows[w].cells[h].rowSpan || 1) + 1
|
|
} else {
|
|
this.setHeaderCol(g, (o[m - 1] || " "), m)
|
|
}
|
|
}
|
|
} else {
|
|
this.setHeaderCol(g, (o || " "))
|
|
}
|
|
this.hdr.rows[0].cells[g];
|
|
this._cCount++;
|
|
this._cMod++;
|
|
this._master_row = null;
|
|
this.setSizes()
|
|
};
|
|
dhtmlXGridObject.prototype.deleteColumn = function(a) {
|
|
a = parseInt(a);
|
|
if (this._cCount == 0) {
|
|
return
|
|
}
|
|
if (!this._cMod) {
|
|
this._cMod = this._cCount
|
|
}
|
|
if (a >= this._cCount) {
|
|
return
|
|
}
|
|
this._processAllArrays(a, this._cCount - 1, [null, null, null, null, null, null, null, null, null, null, null]);
|
|
this._processAllRows("_deleteColInRow", a);
|
|
this._cCount--;
|
|
this._master_row = null;
|
|
this.setSizes()
|
|
};
|
|
dhtmlXGridObject.prototype._processAllRows = function(l, a, c) {
|
|
this[l](this.obj.rows[0], a, c, 0);
|
|
var h = this.hdr.rows.length;
|
|
for (var g = 0; g < h; g++) {
|
|
this[l](this.hdr.rows[g], a, c, g)
|
|
}
|
|
if (this.ftr) {
|
|
var h = this.ftr.firstChild.rows.length;
|
|
for (var g = 0; g < h; g++) {
|
|
this[l](this.ftr.firstChild.rows[g], a, c, g)
|
|
}
|
|
}
|
|
this.forEachRow(function(m) {
|
|
if (this.rowsAr[m] && this.rowsAr[m].tagName == "TR") {
|
|
this[l](this.rowsAr[m], a, c, -1)
|
|
}
|
|
})
|
|
};
|
|
dhtmlXGridObject.prototype._processAllArrays = function(r, a, q) {
|
|
var m = ["hdrLabels", "initCellWidth", "cellType", "cellAlign", "cellVAlign", "fldSort", "columnColor", "_hrrar", "_c_order"];
|
|
if (this.cellWidthPX.length) {
|
|
m.push("cellWidthPX")
|
|
}
|
|
if (this.cellWidthPC.length) {
|
|
m.push("cellWidthPC")
|
|
}
|
|
if (this._col_combos) {
|
|
m.push("_col_combos")
|
|
}
|
|
if (this._mCols) {
|
|
m[m.length] = "_mCols"
|
|
}
|
|
if (this.columnIds) {
|
|
m[m.length] = "columnIds"
|
|
}
|
|
if (this._maskArr) {
|
|
m.push("_maskArr")
|
|
}
|
|
if (this._drsclmW) {
|
|
m.push("_drsclmW")
|
|
}
|
|
if (this._RaSeCol) {
|
|
m.push("_RaSeCol")
|
|
}
|
|
if (this._hm_config) {
|
|
m.push("_hm_config")
|
|
}
|
|
if (this._drsclmn) {
|
|
m.push("_drsclmn")
|
|
}
|
|
if (this.clists) {
|
|
m.push("clists")
|
|
}
|
|
if (this._validators && this._validators.data) {
|
|
m.push(this._validators.data)
|
|
}
|
|
m.push("combos");
|
|
if (this._customSorts) {
|
|
m.push("_customSorts")
|
|
}
|
|
if (this._aggregators) {
|
|
m.push("_aggregators")
|
|
}
|
|
var o = (r <= a);
|
|
if (!this._c_order) {
|
|
this._c_order = new Array();
|
|
var g = this._cCount;
|
|
for (var n = 0; n < g; n++) {
|
|
this._c_order[n] = n
|
|
}
|
|
}
|
|
for (var n = 0; n < m.length; n++) {
|
|
var s = this[m[n]] || m[n];
|
|
if (s) {
|
|
if (o) {
|
|
var c = s[r];
|
|
for (var h = r; h < a; h++) {
|
|
s[h] = s[h + 1]
|
|
}
|
|
s[a] = c
|
|
} else {
|
|
var c = s[r];
|
|
for (var h = r; h > (a + 1); h--) {
|
|
s[h] = s[h - 1]
|
|
}
|
|
s[a + 1] = c
|
|
} if (q) {
|
|
s[a + (o ? 0 : 1)] = q[n]
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.moveColumn = function(a, c) {
|
|
c--;
|
|
a = parseInt(a);
|
|
c = parseInt(c);
|
|
if (c < a) {
|
|
var g = c + 1
|
|
} else {
|
|
var g = c
|
|
} if (!this.callEvent("onBeforeCMove", [a, g])) {
|
|
return false
|
|
}
|
|
if (a == g) {
|
|
return
|
|
}
|
|
this.editStop();
|
|
this._processAllRows("_moveColInRow", a, c);
|
|
this._processAllArrays(a, c);
|
|
if (this.fldSorted) {
|
|
this.setSortImgPos(this.fldSorted._cellIndex)
|
|
}
|
|
this.callEvent("onAfterCMove", [a, g])
|
|
};
|
|
dhtmlXGridObject.prototype._swapColumns = function(c) {
|
|
var g = new Array();
|
|
for (var a = 0; a < this._cCount; a++) {
|
|
var h = c[this._c_order[a]];
|
|
if (typeof(h) == "undefined") {
|
|
h = ""
|
|
}
|
|
g[a] = h
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXGridObject.prototype._moveColInRow = function(m, a, g) {
|
|
var n = m.childNodes[a];
|
|
var l = m.childNodes[g + 1];
|
|
if (!n) {
|
|
return
|
|
}
|
|
if (l) {
|
|
m.insertBefore(n, l)
|
|
} else {
|
|
m.appendChild(n)
|
|
}
|
|
for (var h = 0; h < m.childNodes.length; h++) {
|
|
m.childNodes[h]._cellIndex = m.childNodes[h]._cellIndexS = h
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._addColInRow = function(o, m, a, h) {
|
|
var l = m;
|
|
if (o._childIndexes) {
|
|
if (o._childIndexes[m - 1] == o._childIndexes[m] || !o.childNodes[o._childIndexes[m - 1]]) {
|
|
for (var g = o._childIndexes.length; g >= m; g--) {
|
|
o._childIndexes[g] = g ? (o._childIndexes[g - 1] + 1) : 0
|
|
}
|
|
o._childIndexes[m]--
|
|
} else {
|
|
for (var g = o._childIndexes.length; g >= m; g--) {
|
|
o._childIndexes[g] = g ? (o._childIndexes[g - 1] + 1) : 0
|
|
}
|
|
}
|
|
var l = o._childIndexes[m]
|
|
}
|
|
var q = o.childNodes[l];
|
|
var n = document.createElement((h) ? "TD" : "TH");
|
|
if (h) {
|
|
n._attrs = {}
|
|
} else {
|
|
n.style.width = (parseInt(this.cellWidthPX[m]) || "100") + "px"
|
|
} if (q) {
|
|
o.insertBefore(n, q)
|
|
} else {
|
|
o.appendChild(n)
|
|
} if (this.dragAndDropOff && o.idd) {
|
|
this.dragger.addDraggableItem(o.childNodes[l], this)
|
|
}
|
|
for (var g = l + 1; g < o.childNodes.length; g++) {
|
|
o.childNodes[g]._cellIndex = o.childNodes[g]._cellIndexS = o.childNodes[g]._cellIndex + 1
|
|
}
|
|
if (o.childNodes[l]) {
|
|
o.childNodes[l]._cellIndex = o.childNodes[l]._cellIndexS = m
|
|
}
|
|
if (o.idd || typeof(o.idd) != "undefined") {
|
|
this.cells3(o, m).setValue("");
|
|
n.align = this.cellAlign[m];
|
|
n.style.verticalAlign = this.cellVAlign[m];
|
|
n.bgColor = this.columnColor[m]
|
|
} else {
|
|
if (n.tagName == "TD") {
|
|
if (!o.idd && this.forceDivInHeader) {
|
|
n.innerHTML = "<div class='hdrcell'> </div>"
|
|
} else {
|
|
n.innerHTML = " "
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._deleteColInRow = function(o, n) {
|
|
var g = n;
|
|
if (o._childIndexes) {
|
|
n = o._childIndexes[n]
|
|
}
|
|
var q = o.childNodes[n];
|
|
if (!q) {
|
|
return
|
|
}
|
|
if (q.colSpan && q.colSpan > 1 && q.parentNode.idd) {
|
|
var l = q.colSpan - 1;
|
|
var a = this.cells4(q).getValue();
|
|
this.setColspan(q.parentNode.idd, q._cellIndex, 1);
|
|
if (l > 1) {
|
|
var m = q._cellIndex * 1;
|
|
this.setColspan(q.parentNode.idd, m + 1, l);
|
|
this.cells(q.parentNode.idd, q._cellIndex * 1 + 1).setValue(a);
|
|
o._childIndexes.splice(m, 1);
|
|
for (var h = m; h < o._childIndexes.length; h++) {
|
|
o._childIndexes[h] -= 1
|
|
}
|
|
}
|
|
} else {
|
|
if (o._childIndexes) {
|
|
o._childIndexes.splice(g, 1);
|
|
for (var h = g; h < o._childIndexes.length; h++) {
|
|
o._childIndexes[h]--
|
|
}
|
|
}
|
|
} if (q) {
|
|
o.removeChild(q)
|
|
}
|
|
for (var h = n; h < o.childNodes.length; h++) {
|
|
o.childNodes[h]._cellIndex = o.childNodes[h]._cellIndexS = o.childNodes[h]._cellIndex - 1
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.enableColumnMove = function(c, a) {
|
|
this._mCol = convertStringToBoolean(c);
|
|
if (typeof(a) != "undefined") {
|
|
this._mCols = a.split(",")
|
|
}
|
|
if (!this._mmevTrue) {
|
|
dhtmlxEvent(this.hdr, "mousedown", this._startColumnMove);
|
|
dhtmlxEvent(document.body, "mousemove", this._onColumnMove);
|
|
dhtmlxEvent(document.body, "mouseup", this._stopColumnMove);
|
|
this._mmevTrue = true
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._startColumnMove = function(h) {
|
|
h = h || event;
|
|
var g = h.target || h.srcElement;
|
|
var a = g;
|
|
while (a.tagName != "TABLE") {
|
|
a = a.parentNode
|
|
}
|
|
var c = a.grid;
|
|
if (!c) {
|
|
return
|
|
}
|
|
c.setActive();
|
|
if (!c._mCol || h.button == 2) {
|
|
return
|
|
}
|
|
g = c.getFirstParentOfType(g, "TD");
|
|
if (g.style.cursor != "default") {
|
|
return true
|
|
}
|
|
if ((c) && (!c._colInMove)) {
|
|
c.resized = null;
|
|
if ((!c._mCols) || (c._mCols[g._cellIndex] == "true")) {
|
|
c._colInMove = g._cellIndex + 1
|
|
}
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXGridObject.prototype._onColumnMove = function(l) {
|
|
l = l || event;
|
|
var a = window.globalActiveDHTMLGridObject;
|
|
if ((a) && (a._colInMove)) {
|
|
if (a._showHContext) {
|
|
a._showHContext(false)
|
|
}
|
|
if (typeof(a._colInMove) != "object") {
|
|
var m = document.createElement("DIV");
|
|
m._aIndex = (a._colInMove - 1);
|
|
m._bIndex = null;
|
|
m.innerHTML = a.getHeaderCol(m._aIndex);
|
|
m.className = "dhx_dragColDiv";
|
|
m.style.position = "absolute";
|
|
document.body.appendChild(m);
|
|
a._colInMove = m
|
|
}
|
|
var h = [];
|
|
h[0] = (document.body.scrollLeft || document.documentElement.scrollLeft);
|
|
h[1] = (document.body.scrollTop || document.documentElement.scrollTop);
|
|
a._colInMove.style.left = l.clientX + h[0] + 8 + "px";
|
|
a._colInMove.style.top = l.clientY + h[1] + 8 + "px";
|
|
var c = l.target || l.srcElement;
|
|
while ((c) && (typeof(c._cellIndexS) == "undefined")) {
|
|
c = c.parentNode
|
|
}
|
|
if (a._colInMove._oldHe) {
|
|
a._colInMove._oldHe.className = a._colInMove._oldHe.className.replace(/columnTarget(L|R)/g, "");
|
|
a._colInMove._oldHe = null;
|
|
a._colInMove._bIndex = null
|
|
}
|
|
if (c) {
|
|
if (a.hdr.rows[1]._childIndexes) {
|
|
var g = a.hdr.rows[1].cells[a.hdr.rows[1]._childIndexes[c._cellIndexS]]
|
|
} else {
|
|
var g = a.hdr.rows[1].cells[c._cellIndexS]
|
|
}
|
|
var m = l.clientX - (getAbsoluteLeft(g) - a.hdrBox.scrollLeft);
|
|
if (m / g.offsetWidth > 0.5) {
|
|
g.className += " columnTargetR";
|
|
a._colInMove._bIndex = c._cellIndexS
|
|
} else {
|
|
g.className += " columnTargetL";
|
|
a._colInMove._bIndex = c._cellIndexS - 1
|
|
} if (g.offsetLeft < (a.objBox.scrollLeft + 20)) {
|
|
a.objBox.scrollLeft = Math.max(0, g.offsetLeft - 20)
|
|
}
|
|
if ((g.offsetLeft + g.offsetWidth - a.objBox.scrollLeft) > (a.objBox.offsetWidth - 20)) {
|
|
a.objBox.scrollLeft = Math.min(a.objBox.scrollLeft + g.offsetWidth + 20, a.objBox.scrollWidth - a.objBox.offsetWidth)
|
|
}
|
|
a._colInMove._oldHe = g
|
|
}
|
|
l.cancelBubble = true;
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXGridObject.prototype._stopColumnMove = function(c) {
|
|
c = c || event;
|
|
var a = window.globalActiveDHTMLGridObject;
|
|
if ((a) && (a._colInMove)) {
|
|
if (typeof(a._colInMove) == "object") {
|
|
a._colInMove.parentNode.removeChild(a._colInMove);
|
|
if (a._colInMove._bIndex != null) {
|
|
a.moveColumn(a._colInMove._aIndex, a._colInMove._bIndex + 1)
|
|
}
|
|
if (a._colInMove._oldHe) {
|
|
a._colInMove._oldHe.className = a._colInMove._oldHe.className.replace(/columnTarget(L|R)/g, "")
|
|
}
|
|
a._colInMove._oldHe = null;
|
|
a._colInMove.grid = null;
|
|
a.resized = true
|
|
}
|
|
a._colInMove = 0
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXGridObject.prototype.mouseOverHeader = function(c) {
|
|
var a = this;
|
|
dhtmlxEvent(this.hdr, "mousemove", function(h) {
|
|
h = h || window.event;
|
|
var g = h.target || h.srcElement;
|
|
if (g.tagName != "TD") {
|
|
g = a.getFirstParentOfType(g, "TD")
|
|
}
|
|
if (g && (typeof(g._cellIndex) != "undefined")) {
|
|
c(g.parentNode.rowIndex, g._cellIndex)
|
|
}
|
|
})
|
|
};
|
|
dhtmlXGridObject.prototype.mouseOver = function(c) {
|
|
var a = this;
|
|
dhtmlxEvent(this.obj, "mousemove", function(h) {
|
|
h = h || window.event;
|
|
var g = h.target || h.srcElement;
|
|
if (g.tagName != "TD") {
|
|
g = a.getFirstParentOfType(g, "TD")
|
|
}
|
|
if (g && (typeof(g._cellIndex) != "undefined")) {
|
|
c(g.parentNode.rowIndex, g._cellIndex)
|
|
}
|
|
})
|
|
};
|
|
dhtmlXGridObject.prototype.enablePaging = function(m, h, c, l, a, g) {
|
|
this._pgn_parentObj = typeof(l) == "string" ? document.getElementById(l) : l;
|
|
this._pgn_recInfoParentObj = typeof(g) == "string" ? document.getElementById(g) : g;
|
|
this.pagingOn = m;
|
|
this.showRecInfo = a;
|
|
this.rowsBufferOutSize = parseInt(h);
|
|
this.currentPage = 1;
|
|
this.pagesInGroup = parseInt(c);
|
|
this._init_pgn_events();
|
|
this.setPagingSkin("default")
|
|
};
|
|
dhtmlXGridObject.prototype.setXMLAutoLoading = function(a, c) {
|
|
this.xmlFileUrl = a;
|
|
this._dpref = c
|
|
};
|
|
dhtmlXGridObject.prototype.changePageRelative = function(a) {
|
|
this.changePage(this.currentPage + a)
|
|
};
|
|
dhtmlXGridObject.prototype.changePage = function(a) {
|
|
if (arguments.length == 0) {
|
|
a = this.currentPage || 0
|
|
}
|
|
a = parseInt(a);
|
|
a = Math.max(1, Math.min(a, Math.ceil(this.rowsBuffer.length / this.rowsBufferOutSize)));
|
|
if (!this.callEvent("onBeforePageChanged", [this.currentPage, a])) {
|
|
return
|
|
}
|
|
this.currentPage = parseInt(a);
|
|
this._reset_view();
|
|
this._fixAlterCss();
|
|
this.callEvent("onPageChanged", this.getStateOfView())
|
|
};
|
|
dhtmlXGridObject.prototype.setPagingSkin = function(a) {
|
|
this._pgn_skin = this["_pgn_" + a];
|
|
if (a == "toolbar") {
|
|
this._pgn_skin_tlb = arguments[1]
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.setPagingTemplates = function(g, c) {
|
|
this._pgn_templateA = this._pgn_template_compile(g);
|
|
this._pgn_templateB = this._pgn_template_compile(c);
|
|
this._page_skin_update()
|
|
};
|
|
dhtmlXGridObject.prototype._page_skin_update = function(a) {
|
|
if (!this.pagesInGroup) {
|
|
this.pagesInGroup = Math.ceil(Math.min(5, this.rowsBuffer.length / this.rowsBufferOutSize))
|
|
}
|
|
var c = Math.ceil(this.rowsBuffer.length / this.rowsBufferOutSize);
|
|
if (c && c < this.currentPage) {
|
|
return this.changePage(c)
|
|
}
|
|
if (this.pagingOn && this._pgn_skin) {
|
|
this._pgn_skin.apply(this, this.getStateOfView())
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._init_pgn_events = function(a) {
|
|
this.attachEvent("onXLE", this._page_skin_update);
|
|
this.attachEvent("onClearAll", this._page_skin_update);
|
|
this.attachEvent("onPageChanged", this._page_skin_update);
|
|
this.attachEvent("onGridReconstructed", this._page_skin_update);
|
|
this._init_pgn_events = function() {}
|
|
};
|
|
dhtmlXGridObject.prototype._pgn_default = function(g, h, a) {
|
|
if (!this.pagingBlock) {
|
|
this.pagingBlock = document.createElement("DIV");
|
|
this.pagingBlock.className = "pagingBlock";
|
|
this.recordInfoBlock = document.createElement("SPAN");
|
|
this.recordInfoBlock.className = "recordsInfoBlock";
|
|
if (!this._pgn_parentObj) {
|
|
return
|
|
}
|
|
this._pgn_parentObj.appendChild(this.pagingBlock);
|
|
if (this._pgn_recInfoParentObj && this.showRecInfo) {
|
|
this._pgn_recInfoParentObj.appendChild(this.recordInfoBlock)
|
|
}
|
|
if (!this._pgn_templateA) {
|
|
this._pgn_templateA = this._pgn_template_compile("[prevpages:<: ] [currentpages:, ] [nextpages:>: ]");
|
|
this._pgn_templateB = this._pgn_template_compile("Results <b>[from]-[to]</b> of <b>[total]</b>")
|
|
}
|
|
}
|
|
var c = this.getStateOfView();
|
|
this.pagingBlock.innerHTML = this._pgn_templateA.apply(this, c);
|
|
this.recordInfoBlock.innerHTML = this._pgn_templateB.apply(this, c);
|
|
this._pgn_template_active(this.pagingBlock);
|
|
this._pgn_template_active(this.recordInfoBlock);
|
|
this.callEvent("onPaging", [])
|
|
};
|
|
dhtmlXGridObject.prototype._pgn_block = function(c) {
|
|
var l = Math.floor((this.currentPage - 1) / this.pagesInGroup) * this.pagesInGroup;
|
|
var a = Math.min(Math.ceil(this.rowsBuffer.length / this.rowsBufferOutSize), l + this.pagesInGroup);
|
|
var h = [];
|
|
for (var g = l + 1; g <= a; g++) {
|
|
if (g == this.currentPage) {
|
|
h.push("<a class='dhx_not_active'><b>" + g + "</b></a>")
|
|
} else {
|
|
h.push("<a onclick='this.grid.changePage(" + g + "); return false;'>" + g + "</a>")
|
|
}
|
|
}
|
|
return h.join(c)
|
|
};
|
|
dhtmlXGridObject.prototype._pgn_link = function(h, c, g) {
|
|
if (h == "prevpages" || h == "prev") {
|
|
if (this.currentPage == 1) {
|
|
return g
|
|
}
|
|
return "<a onclick='this.grid.changePageRelative(-1*" + (h == "prev" ? "1" : "this.grid.pagesInGroup") + "); return false;'>" + c + "</a>"
|
|
}
|
|
if (h == "nextpages" || h == "next") {
|
|
if (this.rowsBuffer.length / this.rowsBufferOutSize <= this.currentPage) {
|
|
return g
|
|
}
|
|
if (this.rowsBuffer.length / (this.rowsBufferOutSize * (h == "next" ? "1" : this.pagesInGroup)) <= 1) {
|
|
return g
|
|
}
|
|
return "<a onclick='this.grid.changePageRelative(" + (h == "next" ? "1" : "this.grid.pagesInGroup") + "); return false;'>" + c + "</a>"
|
|
}
|
|
if (h == "current") {
|
|
var a = this.currentPage + (c ? parseInt(c) : 0);
|
|
if (a < 1 || Math.ceil(this.rowsBuffer.length / this.rowsBufferOutSize) < a) {
|
|
return g
|
|
}
|
|
return "<a " + (a == this.currentPage ? "class='dhx_active_page_link' " : "") + "onclick='this.grid.changePage(" + a + "); return false;'>" + a + "</a>"
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXGridObject.prototype._pgn_template_active = function(g) {
|
|
var a = g.getElementsByTagName("A");
|
|
if (a) {
|
|
for (var c = 0; c < a.length; c++) {
|
|
a[c].grid = this
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._pgn_template_compile = function(a) {
|
|
a = a.replace(/\[([^\]]*)\]/g, function(g, c) {
|
|
c = c.split(":");
|
|
switch (c[0]) {
|
|
case "from":
|
|
return '"+(arguments[1]*1+(arguments[2]*1?1:0))+"';
|
|
case "total":
|
|
return '"+arguments[3]+"';
|
|
case "to":
|
|
return '"+arguments[2]+"';
|
|
case "current":
|
|
case "prev":
|
|
case "next":
|
|
case "prevpages":
|
|
case "nextpages":
|
|
return "\"+this._pgn_link('" + c[0] + "','" + c[1] + "','" + c[2] + "')+\"";
|
|
case "currentpages":
|
|
return "\"+this._pgn_block('" + c[1] + "')+\""
|
|
}
|
|
});
|
|
return new Function('return "' + a + '";')
|
|
};
|
|
dhtmlXGridObject.prototype.i18n.paging = {
|
|
results: "Results",
|
|
records: "Records from ",
|
|
to: " to ",
|
|
page: "Page ",
|
|
perpage: "rows per page",
|
|
first: "To first Page",
|
|
previous: "Previous Page",
|
|
found: "Found records",
|
|
next: "Next Page",
|
|
last: "To last Page",
|
|
of: " of ",
|
|
notfound: "No Records Found"
|
|
};
|
|
dhtmlXGridObject.prototype.setPagingWTMode = function(a, c, g, h) {
|
|
this._WTDef = [a, c, g, h]
|
|
};
|
|
dhtmlXGridObject.prototype._pgn_bricks = function(o, a, g) {
|
|
var l = (this.skin_name || "").split("_")[1];
|
|
var c = "";
|
|
if (l == "light" || l == "modern" || l == "skyblue") {
|
|
c = "_" + l
|
|
}
|
|
this.pagerElAr = new Array();
|
|
this.pagerElAr.pagerCont = document.createElement("DIV");
|
|
this.pagerElAr.pagerBord = document.createElement("DIV");
|
|
this.pagerElAr.pagerLine = document.createElement("DIV");
|
|
this.pagerElAr.pagerBox = document.createElement("DIV");
|
|
this.pagerElAr.pagerInfo = document.createElement("DIV");
|
|
this.pagerElAr.pagerInfoBox = document.createElement("DIV");
|
|
var n = (this.globalBox || this.objBox);
|
|
this.pagerElAr.pagerCont.style.width = n.clientWidth + "px";
|
|
this.pagerElAr.pagerCont.style.overflow = "hidden";
|
|
this.pagerElAr.pagerCont.style.clear = "both";
|
|
this.pagerElAr.pagerBord.className = "dhx_pbox" + c;
|
|
this.pagerElAr.pagerLine.className = "dhx_pline" + c;
|
|
this.pagerElAr.pagerBox.style.clear = "both";
|
|
this.pagerElAr.pagerInfo.className = "dhx_pager_info" + c;
|
|
this.pagerElAr.pagerCont.appendChild(this.pagerElAr.pagerBord);
|
|
this.pagerElAr.pagerCont.appendChild(this.pagerElAr.pagerLine);
|
|
this.pagerElAr.pagerCont.appendChild(this.pagerElAr.pagerInfo);
|
|
this.pagerElAr.pagerLine.appendChild(this.pagerElAr.pagerBox);
|
|
this.pagerElAr.pagerInfo.appendChild(this.pagerElAr.pagerInfoBox);
|
|
this._pgn_parentObj.innerHTML = "";
|
|
this._pgn_parentObj.appendChild(this.pagerElAr.pagerCont);
|
|
if (this.rowsBuffer.length > 0) {
|
|
var m = 20;
|
|
var u = 22;
|
|
if (o > this.pagesInGroup) {
|
|
var r = document.createElement("DIV");
|
|
var q = document.createElement("DIV");
|
|
r.className = "dhx_page" + c;
|
|
q.innerHTML = "←";
|
|
r.appendChild(q);
|
|
this.pagerElAr.pagerBox.appendChild(r);
|
|
var s = this;
|
|
r.pgnum = (Math.ceil(o / this.pagesInGroup) - 1) * this.pagesInGroup;
|
|
r.onclick = function() {
|
|
s.changePage(this.pgnum)
|
|
};
|
|
m += u
|
|
}
|
|
for (var h = 1; h <= this.pagesInGroup; h++) {
|
|
var r = document.createElement("DIV");
|
|
var q = document.createElement("DIV");
|
|
r.className = "dhx_page" + c;
|
|
pageNumber = ((Math.ceil(o / this.pagesInGroup) - 1) * this.pagesInGroup) + h;
|
|
if (pageNumber > Math.ceil(this.rowsBuffer.length / this.rowsBufferOutSize)) {
|
|
break
|
|
}
|
|
q.innerHTML = pageNumber;
|
|
r.appendChild(q);
|
|
if (o == pageNumber) {
|
|
r.className += " dhx_page_active" + c;
|
|
q.className = "dhx_page_active" + c
|
|
} else {
|
|
var s = this;
|
|
r.pgnum = pageNumber;
|
|
r.onclick = function() {
|
|
s.changePage(this.pgnum)
|
|
}
|
|
}
|
|
m += (parseInt(u / 3) * pageNumber.toString().length) + 15;
|
|
q.style.width = (parseInt(u / 3) * pageNumber.toString().length) + 8 + "px";
|
|
this.pagerElAr.pagerBox.appendChild(r)
|
|
}
|
|
if (Math.ceil(o / this.pagesInGroup) * this.pagesInGroup < Math.ceil(this.rowsBuffer.length / this.rowsBufferOutSize)) {
|
|
var r = document.createElement("DIV");
|
|
var q = document.createElement("DIV");
|
|
r.className = "dhx_page" + c;
|
|
q.innerHTML = "→";
|
|
r.appendChild(q);
|
|
this.pagerElAr.pagerBox.appendChild(r);
|
|
var s = this;
|
|
r.pgnum = (Math.ceil(o / this.pagesInGroup) * this.pagesInGroup) + 1;
|
|
r.onclick = function() {
|
|
s.changePage(this.pgnum)
|
|
};
|
|
m += u
|
|
}
|
|
this.pagerElAr.pagerLine.style.width = m + "px"
|
|
}
|
|
if (this.rowsBuffer.length > 0 && this.showRecInfo) {
|
|
this.pagerElAr.pagerInfoBox.innerHTML = this.i18n.paging.records + (a + 1) + this.i18n.paging.to + g + this.i18n.paging.of + this.rowsBuffer.length
|
|
} else {
|
|
if (this.rowsBuffer.length == 0) {
|
|
this.pagerElAr.pagerLine.parentNode.removeChild(this.pagerElAr.pagerLine);
|
|
this.pagerElAr.pagerInfoBox.innerHTML = this.i18n.paging.notfound
|
|
}
|
|
}
|
|
this.pagerElAr.pagerBox.appendChild(document.createElement("SPAN")).innerHTML = " ";
|
|
this.pagerElAr.pagerBord.appendChild(document.createElement("SPAN")).innerHTML = " ";
|
|
this.pagerElAr.pagerCont.appendChild(document.createElement("SPAN")).innerHTML = " ";
|
|
this.callEvent("onPaging", [])
|
|
};
|
|
dhtmlXGridObject.prototype._pgn_toolbar = function(m, n, c) {
|
|
if (!this.aToolBar) {
|
|
this.aToolBar = this._pgn_createToolBar()
|
|
}
|
|
var l = Math.ceil(this.rowsBuffer.length / this.rowsBufferOutSize);
|
|
if (this._WTDef[0]) {
|
|
this.aToolBar.enableItem("right");
|
|
this.aToolBar.enableItem("rightabs");
|
|
this.aToolBar.enableItem("left");
|
|
this.aToolBar.enableItem("leftabs");
|
|
if (this.currentPage >= l) {
|
|
this.aToolBar.disableItem("right");
|
|
this.aToolBar.disableItem("rightabs")
|
|
}
|
|
if (this.currentPage == 1) {
|
|
this.aToolBar.disableItem("left");
|
|
this.aToolBar.disableItem("leftabs")
|
|
}
|
|
}
|
|
if (this._WTDef[2]) {
|
|
var h = this;
|
|
this.aToolBar.forEachListOption("pages", function(o) {
|
|
h.aToolBar.removeListOption("pages", o)
|
|
});
|
|
var a = {
|
|
dhx_skyblue: 4,
|
|
dhx_web: 0,
|
|
dhx_terrace: 14
|
|
}[this.aToolBar.conf.skin];
|
|
for (var g = 0; g < l; g++) {
|
|
this.aToolBar.addListOption("pages", "pages_" + (g + 1), NaN, "button", "<span style='padding: 0px " + a + "px 0px 0px;'>" + this.i18n.paging.page + (g + 1) + "</span>", "paging_page.gif")
|
|
}
|
|
this.aToolBar.setItemText("pages", this.i18n.paging.page + m)
|
|
}
|
|
if (this._WTDef[1]) {
|
|
if (!this.getRowsNum()) {
|
|
this.aToolBar.setItemText("results", this.i18n.paging.notfound)
|
|
} else {
|
|
this.aToolBar.setItemText("results", "<div style='width:100%; text-align:center'>" + this.i18n.paging.records + (n + 1) + this.i18n.paging.to + c + "</div>")
|
|
}
|
|
}
|
|
if (this._WTDef[3]) {
|
|
this.aToolBar.setItemText("perpagenum", this.rowsBufferOutSize.toString() + " " + this.i18n.paging.perpage)
|
|
}
|
|
this.callEvent("onPaging", [])
|
|
};
|
|
dhtmlXGridObject.prototype._pgn_createToolBar = function() {
|
|
this.aToolBar = new dhtmlXToolbarObject({
|
|
parent: this._pgn_parentObj,
|
|
skin: (this._pgn_skin_tlb || this.skin_name),
|
|
icons_path: this.imgURL
|
|
});
|
|
if (!this._WTDef) {
|
|
this.setPagingWTMode(true, true, true, true)
|
|
}
|
|
var h = this;
|
|
this.aToolBar.attachEvent("onClick", function(l) {
|
|
l = l.split("_");
|
|
switch (l[0]) {
|
|
case "leftabs":
|
|
h.changePage(1);
|
|
break;
|
|
case "left":
|
|
h.changePage(h.currentPage - 1);
|
|
break;
|
|
case "rightabs":
|
|
h.changePage(99999);
|
|
break;
|
|
case "right":
|
|
h.changePage(h.currentPage + 1);
|
|
break;
|
|
case "perpagenum":
|
|
if (l[1] === this.undefined) {
|
|
return
|
|
}
|
|
h.rowsBufferOutSize = parseInt(l[1]);
|
|
h.changePage();
|
|
h.aToolBar.setItemText("perpagenum", l[1] + " " + h.i18n.paging.perpage);
|
|
break;
|
|
case "pages":
|
|
if (l[1] === this.undefined) {
|
|
return
|
|
}
|
|
h.changePage(l[1]);
|
|
h.aToolBar.setItemText("pages", h.i18n.paging.page + l[1]);
|
|
break
|
|
}
|
|
});
|
|
if (this._WTDef[0]) {
|
|
this.aToolBar.addButton("leftabs", NaN, null, "ar_left_abs.gif", "ar_left_abs_dis.gif");
|
|
this.aToolBar.addButton("left", NaN, null, "ar_left.gif", "ar_left_dis.gif")
|
|
}
|
|
if (this._WTDef[1]) {
|
|
this.aToolBar.addText("results", NaN, this.i18n.paging.results);
|
|
this.aToolBar.setWidth("results", "150");
|
|
this.aToolBar.disableItem("results")
|
|
}
|
|
if (this._WTDef[0]) {
|
|
this.aToolBar.addButton("right", NaN, null, "ar_right.gif", "ar_right_dis.gif");
|
|
this.aToolBar.addButton("rightabs", NaN, null, "ar_right_abs.gif", "ar_right_abs_dis.gif")
|
|
}
|
|
if (this._WTDef[2]) {
|
|
if (this.aToolBar.conf.skin == "dhx_terrace") {
|
|
this.aToolBar.addSeparator()
|
|
}
|
|
this.aToolBar.addButtonSelect("pages", NaN, "select page", [], "paging_pages.gif", null, false, true)
|
|
}
|
|
var a;
|
|
if (a = this._WTDef[3]) {
|
|
if (this.aToolBar.conf.skin == "dhx_terrace") {
|
|
this.aToolBar.addSeparator()
|
|
}
|
|
this.aToolBar.addButtonSelect("perpagenum", NaN, "select size", [], "paging_rows.gif", null, false, true);
|
|
if (typeof a != "object") {
|
|
a = [5, 10, 15, 20, 25, 30]
|
|
}
|
|
var c = {
|
|
dhx_skyblue: 4,
|
|
dhx_web: 0,
|
|
dhx_terrace: 18
|
|
}[this.aToolBar.conf.skin];
|
|
for (var g = 0; g < a.length; g++) {
|
|
this.aToolBar.addListOption("perpagenum", "perpagenum_" + a[g], NaN, "button", "<span style='padding: 0px " + c + "px 0px 0px;'>" + a[g] + " " + this.i18n.paging.perpage + "</span>", "paging_page.gif")
|
|
}
|
|
}
|
|
return this.aToolBar
|
|
};
|
|
dhtmlXGridObject.prototype.post = function(a, c, h, g) {
|
|
this.callEvent("onXLS", [this]);
|
|
if (arguments.length == 3 && typeof h != "function") {
|
|
g = h;
|
|
h = null
|
|
}
|
|
g = g || "xml";
|
|
c = c || "";
|
|
if (!this.xmlFileUrl) {
|
|
this.xmlFileUrl = a
|
|
}
|
|
this._data_type = g;
|
|
this.xmlLoader.onloadAction = function(n, l, q, o, m) {
|
|
m = n["_process_" + g](m);
|
|
if (!n._contextCallTimer) {
|
|
n.callEvent("onXLE", [n, 0, 0, m])
|
|
}
|
|
if (h) {
|
|
h();
|
|
h = null
|
|
}
|
|
};
|
|
this.xmlLoader.loadXML(a, true, c)
|
|
};
|
|
dhtmlXGridObject.prototype.setRowspan = function(s, v, l) {
|
|
var u = this[this._bfs_cells ? "_bfs_cells" : "cells"](s, v).cell;
|
|
var a = this.rowsAr[s];
|
|
if (u.rowSpan && u.rowSpan != 1) {
|
|
var m = a.nextSibling;
|
|
for (var o = 1; o < u.rowSpan; o++) {
|
|
var n = m.childNodes[m._childIndexes[u._cellIndex + 1]];
|
|
var g = document.createElement("TD");
|
|
g.innerHTML = " ";
|
|
g._cellIndex = u._cellIndex;
|
|
g._clearCell = true;
|
|
if (n) {
|
|
n.parentNode.insertBefore(g, n)
|
|
} else {
|
|
m.parentNode.appendChild(g)
|
|
}
|
|
this._shiftIndexes(m, u._cellIndex, -1);
|
|
m = m.nextSibling
|
|
}
|
|
}
|
|
u.rowSpan = l;
|
|
if (!this._h2) {
|
|
a = a.nextSibling || this.rowsCol[this.rowsCol._dhx_find(a) + 1]
|
|
} else {
|
|
a = this.rowsAr[this._h2.get[a.idd].parent.childs[this._h2.get[a.idd].index + 1].id]
|
|
}
|
|
var h = [];
|
|
for (var o = 1; o < l; o++) {
|
|
var q = null;
|
|
if (this._fake && !this._realfake) {
|
|
q = this._bfs_cells3(a, v).cell
|
|
} else {
|
|
q = this.cells3(a, v).cell
|
|
}
|
|
this._shiftIndexes(a, u._cellIndex, 1);
|
|
if (q) {
|
|
q.parentNode.removeChild(q)
|
|
}
|
|
h.push(a);
|
|
if (!this._h2) {
|
|
a = a.nextSibling || this.rowsCol[this.rowsCol._dhx_find(a) + 1]
|
|
} else {
|
|
var a = this._h2.get[a.idd].parent.childs[this._h2.get[a.idd].index + 1];
|
|
if (a) {
|
|
a = this.rowsAr[a.id]
|
|
}
|
|
}
|
|
}
|
|
this.rowsAr[s]._rowSpan = this.rowsAr[s]._rowSpan || {};
|
|
this.rowsAr[s]._rowSpan[v] = h;
|
|
if (this._fake && !this._realfake && v < this._fake._cCount) {
|
|
this._fake.setRowspan(s, v, l)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._shiftIndexes = function(a, h, c) {
|
|
if (!a._childIndexes) {
|
|
a._childIndexes = new Array();
|
|
for (var g = 0; g < a.childNodes.length; g++) {
|
|
a._childIndexes[g] = g
|
|
}
|
|
}
|
|
for (var g = 0; g < a._childIndexes.length; g++) {
|
|
if (g > h) {
|
|
a._childIndexes[g] = a._childIndexes[g] - c
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.enableRowspan = function() {
|
|
this._erspan = true;
|
|
this.enableRowspan = function() {};
|
|
this.attachEvent("onAfterSorting", function() {
|
|
if (this._dload) {
|
|
return
|
|
}
|
|
for (var l = 1; l < this.obj.rows.length; l++) {
|
|
if (this.obj.rows[l]._rowSpan) {
|
|
var a = this.obj.rows[l];
|
|
for (var m in a._rowSpan) {
|
|
var q = a;
|
|
var c = q._rowSpan[m];
|
|
for (var g = 0; g < c.length; g++) {
|
|
if (q.nextSibling) {
|
|
q.parentNode.insertBefore(c[g], q.nextSibling)
|
|
} else {
|
|
q.parentNode.appendChild(c[g])
|
|
} if (this._fake) {
|
|
var h = this._fake.rowsAr[q.idd];
|
|
var n = this._fake.rowsAr[c[g].idd];
|
|
if (h.nextSibling) {
|
|
h.parentNode.insertBefore(n, h.nextSibling)
|
|
} else {
|
|
h.parentNode.appendChild(n)
|
|
}
|
|
this._correctRowHeight(q.idd)
|
|
}
|
|
q = q.nextSibling
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var o = this.rowsCol.stablesort;
|
|
this.rowsCol = new dhtmlxArray();
|
|
this.rowsCol.stablesort = o;
|
|
for (var l = 1; l < this.obj.rows.length; l++) {
|
|
this.rowsCol.push(this.obj.rows[l])
|
|
}
|
|
});
|
|
this.attachEvent("onXLE", function(h, g, r, m) {
|
|
for (var n = 0; n < this.rowsBuffer.length; n++) {
|
|
var q = this.render_row(n);
|
|
var o = q.childNodes;
|
|
for (var l = 0; l < o.length; l++) {
|
|
if (o[l]._attrs.rowspan) {
|
|
this.setRowspan(q.idd, l, o[l]._attrs.rowspan)
|
|
}
|
|
}
|
|
}
|
|
})
|
|
};
|
|
dhtmlXGridObject.prototype._init_point_bspl = dhtmlXGridObject.prototype._init_point;
|
|
dhtmlXGridObject.prototype._init_point = function() {
|
|
if (this._split_later) {
|
|
this.splitAt(this._split_later)
|
|
}
|
|
this._init_point = this._init_point_bspl;
|
|
if (this._init_point) {
|
|
this._init_point()
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.splitAt = function(l) {
|
|
if (!this.obj.rows[0]) {
|
|
return this._split_later = l
|
|
}
|
|
l = parseInt(l);
|
|
var a = document.createElement("DIV");
|
|
this.entBox.appendChild(a);
|
|
var m = document.createElement("DIV");
|
|
this.entBox.appendChild(m);
|
|
for (var q = this.entBox.childNodes.length - 3; q >= 0; q--) {
|
|
m.insertBefore(this.entBox.childNodes[q], m.firstChild)
|
|
}
|
|
this.entBox.style.position = "relative";
|
|
this.globalBox = this.entBox;
|
|
this.entBox = m;
|
|
m.grid = this;
|
|
a.style.cssText += "border:0px solid red !important;";
|
|
m.style.cssText += "border:0px solid red !important;";
|
|
m.style.top = "0px";
|
|
m.style.position = "absolute";
|
|
a.style.position = "absolute";
|
|
a.style.top = "0px";
|
|
a.style.left = "0px";
|
|
a.style.zIndex = 11;
|
|
m.style.height = a.style.height = this.globalBox.clientHeight;
|
|
this._fake = new dhtmlXGridObject(a);
|
|
this.globalBox = this._fake.globalBox = this.globalBox;
|
|
this._fake._fake = this;
|
|
this._fake._realfake = true;
|
|
this._treeC = this.cellType._dhx_find("tree");
|
|
this._fake.delim = this.delim;
|
|
this._fake.customGroupFormat = this.customGroupFormat;
|
|
this._fake.setImagesPath(this._imgURL);
|
|
this._fake.iconURL = this.iconURL;
|
|
this._fake._customSorts = this._customSorts;
|
|
this._fake.noHeader = this.noHeader;
|
|
this._fake._enbTts = this._enbTts;
|
|
this._fake._htkebl = this._htkebl;
|
|
this._fake.clists = this.clists;
|
|
this._fake.fldSort = new Array();
|
|
this._fake.selMultiRows = this.selMultiRows;
|
|
this._fake.multiLine = this.multiLine;
|
|
if (this.multiLine || this._erspan) {
|
|
this.attachEvent("onCellChanged", this._correctRowHeight);
|
|
this.attachEvent("onRowAdded", this._correctRowHeight);
|
|
var y = function() {
|
|
this.forEachRow(function(C) {
|
|
this._correctRowHeight(C)
|
|
})
|
|
};
|
|
this.attachEvent("onPageChanged", y);
|
|
this.attachEvent("onXLE", y);
|
|
this.attachEvent("onResizeEnd", y);
|
|
if (!this._ads_count) {
|
|
this.attachEvent("onAfterSorting", y)
|
|
}
|
|
if (this._srnd) {
|
|
this.attachEvent("onFilterEnd", y)
|
|
}
|
|
this.attachEvent("onDistributedEnd", y)
|
|
}
|
|
this.attachEvent("onGridReconstructed", function() {
|
|
this._fake.objBox.scrollTop = this.objBox.scrollTop
|
|
});
|
|
this._fake.loadedKidsHash = this.loadedKidsHash;
|
|
if (this._h2) {
|
|
this._fake._h2 = this._h2
|
|
}
|
|
this._fake._dInc = this._dInc;
|
|
var x = [
|
|
[],
|
|
[],
|
|
[],
|
|
[],
|
|
[],
|
|
[],
|
|
[]
|
|
];
|
|
var o = ["hdrLabels", "initCellWidth", "cellType", "cellAlign", "cellVAlign", "fldSort", "columnColor"];
|
|
var v = ["setHeader", "setInitWidths", "setColTypes", "setColAlign", "setColVAlign", "setColSorting", "setColumnColor"];
|
|
this._fake.callEvent = function() {
|
|
var C = true;
|
|
this._fake._split_event = true;
|
|
var D = (arguments[0] == "onScroll");
|
|
if (arguments[0] == "onGridReconstructed" || D) {
|
|
this._fake.callEvent.apply(this, arguments)
|
|
}
|
|
if (!D) {
|
|
C = this._fake.callEvent.apply(this._fake, arguments)
|
|
}
|
|
this._fake._split_event = false;
|
|
return C
|
|
};
|
|
if (this._elmn) {
|
|
this._fake.enableLightMouseNavigation(true)
|
|
}
|
|
if (this.__cssEven || this._cssUnEven) {
|
|
this._fake.attachEvent("onGridReconstructed", function() {
|
|
this._fixAlterCss()
|
|
})
|
|
}
|
|
this._fake._cssEven = this._cssEven;
|
|
this._fake._cssUnEven = this._cssUnEven;
|
|
this._fake._cssSP = this._cssSP;
|
|
this._fake.isEditable = this.isEditable;
|
|
this._fake._edtc = this._edtc;
|
|
if (this._sst) {
|
|
this._fake.enableStableSorting(true)
|
|
}
|
|
this._fake._sclE = this._sclE;
|
|
this._fake._dclE = this._dclE;
|
|
this._fake._f2kE = this._f2kE;
|
|
this._fake._maskArr = this._maskArr;
|
|
this._fake._dtmask = this._dtmask;
|
|
this._fake.combos = this.combos;
|
|
var g = 0;
|
|
var s = this.globalBox.offsetWidth;
|
|
for (var q = 0; q < l; q++) {
|
|
for (var n = 0; n < o.length; n++) {
|
|
if (this[o[n]]) {
|
|
x[n][q] = this[o[n]][q]
|
|
}
|
|
if (typeof x[n][q] == "string") {
|
|
x[n][q] = x[n][q].replace(new RegExp("\\" + this.delim, "g"), "\\" + this.delim)
|
|
}
|
|
}
|
|
if (_isFF) {
|
|
x[1][q] = x[1][q] * 1
|
|
}
|
|
if (this.cellWidthType == "%") {
|
|
x[1][q] = Math.round(parseInt(this[o[1]][q]) * s / 100);
|
|
g += x[1][q]
|
|
} else {
|
|
g += parseInt(this[o[1]][q])
|
|
}
|
|
this.setColumnHidden(q, true)
|
|
}
|
|
for (var n = 0; n < o.length; n++) {
|
|
var w = x[n].join(this.delim);
|
|
if (v[n] != "setHeader") {
|
|
if (w != "") {
|
|
this._fake[v[n]](w)
|
|
}
|
|
} else {
|
|
this._fake[v[n]](w, null, this._hstyles)
|
|
}
|
|
}
|
|
this._fake._strangeParams = this._strangeParams;
|
|
this._fake._drsclmn = this._drsclmn;
|
|
g = Math.min(this.globalBox.offsetWidth, g);
|
|
m.style.left = g + "px";
|
|
a.style.width = g + "px";
|
|
m.style.width = Math.max(this.globalBox.offsetWidth - g, 0);
|
|
if (this._ecspn) {
|
|
this._fake._ecspn = true
|
|
}
|
|
this._fake.init();
|
|
if (this.dragAndDropOff) {
|
|
this.dragger.addDragLanding(this._fake.entBox, this)
|
|
}
|
|
this._fake.objBox.style.overflow = "hidden";
|
|
if (!dhtmlx.$customScroll) {
|
|
this._fake.objBox.style.overflowX = "scroll"
|
|
} else {
|
|
this._fake.objBox._custom_scroll_mode = ""
|
|
}
|
|
this._fake._srdh = this._srdh || 20;
|
|
this._fake._srnd = this._srnd;
|
|
var A = this;
|
|
|
|
function u(E) {
|
|
var D = E.wheelDelta / -40;
|
|
if (E.wheelDelta === window.undefined) {
|
|
D = E.detail
|
|
}
|
|
var C = A.objBox;
|
|
C.scrollTop += D * 40;
|
|
if (E.preventDefault) {
|
|
E.preventDefault()
|
|
}
|
|
}
|
|
dhtmlxEvent(this._fake.objBox, "mousewheel", u);
|
|
dhtmlxEvent(this._fake.objBox, "DOMMouseScroll", u);
|
|
|
|
function c(D, C) {
|
|
C.style.whiteSpace = "";
|
|
var H = C.nextSibling;
|
|
var E = C.parentNode;
|
|
D.parentNode.insertBefore(C, D);
|
|
if (!H) {
|
|
E.appendChild(D)
|
|
} else {
|
|
E.insertBefore(D, H)
|
|
}
|
|
var F = D.style.display;
|
|
D.style.display = C.style.display;
|
|
C.style.display = F
|
|
}
|
|
|
|
function h(K, S, L, D) {
|
|
var E = (new Array(l)).join(this.delim);
|
|
var M = [];
|
|
if (K == 2) {
|
|
for (var I = 0; I < l; I++) {
|
|
var C = S[K - 1].cells[S[K - 1]._childIndexes ? S[K - 1]._childIndexes[I] : I];
|
|
if (C.rowSpan && C.rowSpan > 1) {
|
|
M[C._cellIndex] = C.rowSpan - 1;
|
|
D[K - 1].cells[D[K - 1]._childIndexes ? D[K - 1]._childIndexes[I] : I].rowSpan = C.rowSpan;
|
|
C.rowSpan = 1
|
|
}
|
|
}
|
|
}
|
|
for (K; K < S.length; K++) {
|
|
this._fake.attachHeader(E, null, L);
|
|
D = D || this._fake.ftr.childNodes[0].rows;
|
|
var P = l;
|
|
var F = 0;
|
|
for (var J = 0; J < P; J++) {
|
|
if (M[J]) {
|
|
M[J] = M[J] - 1;
|
|
if (_isIE || (_isFF && _FFrv >= 1.9) || _isOpera) {
|
|
var H = document.createElement("TD");
|
|
if (_isFF) {
|
|
H.style.display = "none"
|
|
}
|
|
S[K].insertBefore(H, S[K].cells[0])
|
|
}
|
|
F++;
|
|
continue
|
|
}
|
|
var O = D[K].cells[J - F];
|
|
var N = S[K].cells[J - (_isIE ? 0 : F)];
|
|
var Q = N.rowSpan;
|
|
c(O, N);
|
|
if (Q > 1) {
|
|
M[J] = Q - 1;
|
|
N.rowSpan = Q
|
|
}
|
|
if (D[K].cells[J].colSpan > 1) {
|
|
S[K].cells[J].colSpan = D[K].cells[J].colSpan;
|
|
P -= D[K].cells[J].colSpan - 1;
|
|
for (var I = 1; I < D[K].cells[J].colSpan; I++) {
|
|
D[K].removeChild(D[K].cells[J + 1])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this.hdr.rows.length > 2) {
|
|
h.call(this, 2, this.hdr.rows, "_aHead", this._fake.hdr.rows)
|
|
}
|
|
if (this.ftr) {
|
|
h.call(this, 1, this.ftr.childNodes[0].rows, "_aFoot");
|
|
this._fake.ftr.parentNode.style.bottom = (_isFF ? 2 : 1) + "px"
|
|
}
|
|
if (this.saveSizeToCookie) {
|
|
this.saveSizeToCookie = function(D, C) {
|
|
if (this._realfake) {
|
|
return this._fake.saveSizeToCookie.apply(this._fake, arguments)
|
|
}
|
|
if (!D) {
|
|
D = this.entBox.id
|
|
}
|
|
var F = new Array();
|
|
var H = "cellWidthPX";
|
|
for (var E = 0; E < this[H].length; E++) {
|
|
if (E < l) {
|
|
F[E] = this._fake[H][E]
|
|
} else {
|
|
F[E] = this[H][E]
|
|
}
|
|
}
|
|
F = F.join(",");
|
|
this.setCookie(D, C, 0, F);
|
|
var F = (this.initCellWidth || (new Array)).join(",");
|
|
this.setCookie(D, C, 1, F);
|
|
return true
|
|
};
|
|
this.loadSizeFromCookie = function(C) {
|
|
if (!C) {
|
|
C = this.entBox.id
|
|
}
|
|
var H = this._getCookie(C, 1);
|
|
if (!H) {
|
|
return
|
|
}
|
|
this.initCellWidth = H.split(",");
|
|
var H = this._getCookie(C, 0);
|
|
var I = "cellWidthPX";
|
|
this.cellWidthType = "px";
|
|
var E = 0;
|
|
if ((H) && (H.length)) {
|
|
H = H.split(",");
|
|
for (var D = 0; D < H.length; D++) {
|
|
if (D < l) {
|
|
this._fake[I][D] = H[D];
|
|
E += H[D] * 1
|
|
} else {
|
|
this[I][D] = H[D]
|
|
}
|
|
}
|
|
}
|
|
this._fake.entBox.style.width = E + "px";
|
|
this._fake.objBox.style.width = E + "px";
|
|
var F = this.globalBox.childNodes[1];
|
|
F.style.left = E - (_isFF ? 0 : 0) + "px";
|
|
if (this.ftr) {
|
|
this.ftr.style.left = E - (_isFF ? 0 : 0) + "px"
|
|
}
|
|
F.style.width = this.globalBox.offsetWidth - E + "px";
|
|
this.setSizes();
|
|
return true
|
|
};
|
|
this._fake.onRSE = this.onRSE
|
|
}
|
|
this.setCellTextStyleA = this.setCellTextStyle;
|
|
this.setCellTextStyle = function(D, E, C) {
|
|
if (E < l) {
|
|
this._fake.setCellTextStyle(D, E, C)
|
|
}
|
|
this.setCellTextStyleA(D, E, C)
|
|
};
|
|
this.setRowTextBoldA = this.setRowTextBold;
|
|
this.setRowTextBold = function(C) {
|
|
this.setRowTextBoldA(C);
|
|
this._fake.setRowTextBold(C)
|
|
};
|
|
this.setRowColorA = this.setRowColor;
|
|
this.setRowColor = function(D, C) {
|
|
this.setRowColorA(D, C);
|
|
this._fake.setRowColor(D, C)
|
|
};
|
|
this.setRowHiddenA = this.setRowHidden;
|
|
this.setRowHidden = function(D, C) {
|
|
this.setRowHiddenA(D, C);
|
|
this._fake.setRowHidden(D, C)
|
|
};
|
|
this.setRowTextNormalA = this.setRowTextNormal;
|
|
this.setRowTextNormal = function(C) {
|
|
this.setRowTextNormalA(C);
|
|
this._fake.setRowTextNormal(C)
|
|
};
|
|
this.getChangedRows = function(E) {
|
|
var C = new Array();
|
|
|
|
function D(H) {
|
|
for (var F = 0; F < H.childNodes.length; F++) {
|
|
if (H.childNodes[F].wasChanged) {
|
|
return C[C.length] = H.idd
|
|
}
|
|
}
|
|
}
|
|
this.forEachRow(function(I) {
|
|
var H = this.rowsAr[I];
|
|
var F = this._fake.rowsAr[I];
|
|
if (H.tagName != "TR" || !F || F.tagName != "TR") {
|
|
return
|
|
}
|
|
if (E && H._added) {
|
|
C[C.length] = H.idd
|
|
} else {
|
|
if (!D(H)) {
|
|
D(F)
|
|
}
|
|
}
|
|
});
|
|
return C.join(this.delim)
|
|
};
|
|
this.setRowTextStyleA = this.setRowTextStyle;
|
|
this.setRowTextStyle = function(D, C) {
|
|
this.setRowTextStyleA(D, C);
|
|
if (this._fake.rowsAr[D]) {
|
|
this._fake.setRowTextStyle(D, C)
|
|
}
|
|
};
|
|
this.lockRowA = this.lockRow;
|
|
this.lockRow = function(D, C) {
|
|
this.lockRowA(D, C);
|
|
this._fake.lockRow(D, C)
|
|
};
|
|
this.getColWidth = function(C) {
|
|
if (C < l) {
|
|
return parseInt(this._fake.cellWidthPX[C])
|
|
} else {
|
|
return parseInt(this.cellWidthPX[C])
|
|
}
|
|
};
|
|
this.getColumnLabel = function(C) {
|
|
return this._fake.getColumnLabel.apply(((C < l) ? this._fake : this), arguments)
|
|
};
|
|
this.setColWidthA = this._fake.setColWidthA = this.setColWidth;
|
|
this.setColWidth = function(C, D) {
|
|
C = C * 1;
|
|
if (C < l) {
|
|
this._fake.setColWidthA(C, D)
|
|
} else {
|
|
this.setColWidthA(C, D)
|
|
} if ((C + 1) <= l) {
|
|
this._fake._correctSplit(Math.min(this._fake.objBox.offsetWidth, this._fake.obj.offsetWidth))
|
|
}
|
|
};
|
|
this.adjustColumnSizeA = this.adjustColumnSize;
|
|
this.setColumnLabelA = this.setColumnLabel;
|
|
this.setColumnLabel = function(D, C, H, F) {
|
|
var E = this;
|
|
if (D < l) {
|
|
E = this._fake
|
|
}
|
|
return this.setColumnLabelA.apply(E, [D, C, H, F])
|
|
};
|
|
this.adjustColumnSize = function(C, D) {
|
|
if (C < l) {
|
|
if (_isIE) {
|
|
this._fake.obj.style.tableLayout = ""
|
|
}
|
|
this._fake.adjustColumnSize(C, D);
|
|
if (_isIE) {
|
|
this._fake.obj.style.tableLayout = "fixed"
|
|
}
|
|
this._fake._correctSplit()
|
|
} else {
|
|
return this.adjustColumnSizeA(C, D)
|
|
}
|
|
};
|
|
var r = "cells";
|
|
this._bfs_cells = this[r];
|
|
this[r] = function() {
|
|
if (arguments[1] < l) {
|
|
return this._fake.cells.apply(this._fake, arguments)
|
|
} else {
|
|
return this._bfs_cells.apply(this, arguments)
|
|
}
|
|
};
|
|
this._bfs_isColumnHidden = this.isColumnHidden;
|
|
this.isColumnHidden = function() {
|
|
if (parseInt(arguments[0]) < l) {
|
|
return this._fake.isColumnHidden.apply(this._fake, arguments)
|
|
} else {
|
|
return this._bfs_isColumnHidden.apply(this, arguments)
|
|
}
|
|
};
|
|
this._bfs_setColumnHidden = this.setColumnHidden;
|
|
this.setColumnHidden = function() {
|
|
if (parseInt(arguments[0]) < l) {
|
|
this._fake.setColumnHidden.apply(this._fake, arguments);
|
|
return this._fake._correctSplit()
|
|
} else {
|
|
return this._bfs_setColumnHidden.apply(this, arguments)
|
|
}
|
|
};
|
|
var r = "cells2";
|
|
this._bfs_cells2 = this[r];
|
|
this[r] = function() {
|
|
if (arguments[1] < l) {
|
|
return this._fake.cells2.apply(this._fake, arguments)
|
|
} else {
|
|
return this._bfs_cells2.apply(this, arguments)
|
|
}
|
|
};
|
|
var r = "cells3";
|
|
this._bfs_cells3 = this[r];
|
|
this[r] = function(D, C) {
|
|
if (arguments[1] < l && this._fake.rowsAr[arguments[0].idd]) {
|
|
if (this._fake.rowsAr[D.idd] && this._fake.rowsAr[D.idd].childNodes.length == 0) {
|
|
return this._bfs_cells3.apply(this, arguments)
|
|
}
|
|
arguments[0] = arguments[0].idd;
|
|
return this._fake.cells.apply(this._fake, arguments)
|
|
} else {
|
|
return this._bfs_cells3.apply(this, arguments)
|
|
}
|
|
};
|
|
var r = "changeRowId";
|
|
this._bfs_changeRowId = this[r];
|
|
this[r] = function() {
|
|
this._bfs_changeRowId.apply(this, arguments);
|
|
if (this._fake.rowsAr[arguments[0]]) {
|
|
this._fake.changeRowId.apply(this._fake, arguments)
|
|
}
|
|
};
|
|
this._fake.getRowById = function(E) {
|
|
var D = this.rowsAr[E];
|
|
if (!D && this._fake.rowsAr[E]) {
|
|
D = this._fake.getRowById(E)
|
|
}
|
|
if (D) {
|
|
if (D.tagName != "TR") {
|
|
for (var C = 0; C < this.rowsBuffer.length; C++) {
|
|
if (this.rowsBuffer[C] && this.rowsBuffer[C].idd == E) {
|
|
return this.render_row(C)
|
|
}
|
|
}
|
|
if (this._h2) {
|
|
return this.render_row(null, D.idd)
|
|
}
|
|
}
|
|
return D
|
|
}
|
|
return null
|
|
};
|
|
if (this.collapseKids) {
|
|
this._fake._bfs_collapseKids = this.collapseKids;
|
|
this._fake.collapseKids = function() {
|
|
return this._fake.collapseKids.apply(this._fake, [this._fake.rowsAr[arguments[0].idd]])
|
|
};
|
|
this["_bfs_collapseKids"] = this.collapseKids;
|
|
this["collapseKids"] = function() {
|
|
var C = this["_bfs_collapseKids"].apply(this, arguments);
|
|
this._fake._h2syncModel();
|
|
if (!this._cssSP) {
|
|
this._fake._fixAlterCss()
|
|
}
|
|
};
|
|
this._fake._bfs_expandKids = this.expandKids;
|
|
this._fake.expandKids = function() {
|
|
this._fake.expandKids.apply(this._fake, [this._fake.rowsAr[arguments[0].idd]]);
|
|
if (!this._cssSP) {
|
|
this._fake._fixAlterCss()
|
|
}
|
|
};
|
|
this["_bfs_expandAll"] = this.expandAll;
|
|
this["expandAll"] = function() {
|
|
this._bfs_expandAll();
|
|
this._fake._h2syncModel();
|
|
if (!this._cssSP) {
|
|
this._fake._fixAlterCss()
|
|
}
|
|
};
|
|
this["_bfs_collapseAll"] = this.collapseAll;
|
|
this["collapseAll"] = function() {
|
|
this._bfs_collapseAll();
|
|
this._fake._h2syncModel();
|
|
if (!this._cssSP) {
|
|
this._fake._fixAlterCss()
|
|
}
|
|
};
|
|
this["_bfs_expandKids"] = this.expandKids;
|
|
this["expandKids"] = function() {
|
|
var C = this["_bfs_expandKids"].apply(this, arguments);
|
|
this._fake._h2syncModel();
|
|
if (!this._cssSP) {
|
|
this._fake._fixAlterCss()
|
|
}
|
|
};
|
|
this._fake._h2syncModel = function() {
|
|
if (this._fake.pagingOn) {
|
|
this._fake._renderSort()
|
|
} else {
|
|
this._renderSort()
|
|
}
|
|
};
|
|
this._updateTGRState = function(C) {
|
|
return this._fake._updateTGRState(C)
|
|
}
|
|
}
|
|
if (this._elmnh) {
|
|
this._setRowHoverA = this._fake._setRowHoverA = this._setRowHover;
|
|
this._unsetRowHoverA = this._fake._unsetRowHoverA = this._unsetRowHover;
|
|
this._setRowHover = this._fake._setRowHover = function() {
|
|
var C = this.grid;
|
|
C._setRowHoverA.apply(this, arguments);
|
|
var D = (_isIE ? event.srcElement : arguments[0].target);
|
|
D = C._fake.rowsAr[C.getFirstParentOfType(D, "TD").parentNode.idd];
|
|
if (D) {
|
|
C._fake._setRowHoverA.apply(C._fake.obj, [{
|
|
target: D.childNodes[0]
|
|
},
|
|
arguments[1]
|
|
])
|
|
}
|
|
};
|
|
this._unsetRowHover = this._fake._unsetRowHover = function() {
|
|
if (arguments[1]) {
|
|
var C = this
|
|
} else {
|
|
var C = this.grid
|
|
}
|
|
C._unsetRowHoverA.apply(this, arguments);
|
|
C._fake._unsetRowHoverA.apply(C._fake.obj, arguments)
|
|
};
|
|
this._fake.enableRowsHover(true, this._hvrCss);
|
|
this.enableRowsHover(false);
|
|
this.enableRowsHover(true, this._fake._hvrCss)
|
|
}
|
|
this._updateTGRState = function(C) {
|
|
if (!C.update || C.id == 0) {
|
|
return
|
|
}
|
|
if (this.rowsAr[C.id].imgTag) {
|
|
this.rowsAr[C.id].imgTag.src = this.iconTree + C.state + ".gif"
|
|
}
|
|
if (this._fake.rowsAr[C.id] && this._fake.rowsAr[C.id].imgTag) {
|
|
this._fake.rowsAr[C.id].imgTag.src = this.iconTree + C.state + ".gif"
|
|
}
|
|
C.update = false
|
|
};
|
|
this.copy_row = function(H) {
|
|
var C = H.cloneNode(true);
|
|
C._skipInsert = H._skipInsert;
|
|
var I = l;
|
|
C._attrs = {};
|
|
C._css = H._css;
|
|
if (this._ecspn) {
|
|
I = 0;
|
|
for (var F = 0;
|
|
(I < C.childNodes.length && F < l); F += (C.childNodes[I].colSpan || 1)) {
|
|
I++
|
|
}
|
|
}
|
|
while (C.childNodes.length > I) {
|
|
C.removeChild(C.childNodes[C.childNodes.length - 1])
|
|
}
|
|
var E = I;
|
|
for (var F = 0; F < E; F++) {
|
|
if (this.dragAndDropOff) {
|
|
this.dragger.addDraggableItem(C.childNodes[F], this)
|
|
}
|
|
C.childNodes[F].style.display = (this._fake._hrrar ? (this._fake._hrrar[F] ? "none" : "") : "");
|
|
C.childNodes[F]._cellIndex = F;
|
|
C.childNodes[F].combo_value = arguments[0].childNodes[F].combo_value;
|
|
C.childNodes[F]._clearCell = arguments[0].childNodes[F]._clearCell;
|
|
C.childNodes[F]._cellType = arguments[0].childNodes[F]._cellType;
|
|
C.childNodes[F]._brval = arguments[0].childNodes[F]._brval;
|
|
C.childNodes[F].val = arguments[0].childNodes[F].val;
|
|
C.childNodes[F]._attrs = arguments[0].childNodes[F]._attrs;
|
|
C.childNodes[F].chstate = arguments[0].childNodes[F].chstate;
|
|
if (H._attrs.style) {
|
|
C.childNodes[F].style.cssText += ";" + H._attrs.style
|
|
}
|
|
if (C.childNodes[F].colSpan > 1) {
|
|
this._childIndexes = this._fake._childIndexes
|
|
}
|
|
}
|
|
if (this._h2 && this._treeC < l) {
|
|
var D = this._h2.get[arguments[0].idd];
|
|
C.imgTag = C.childNodes[this._treeC].childNodes[0].childNodes[D.level];
|
|
C.valTag = C.childNodes[this._treeC].childNodes[0].childNodes[D.level + 2]
|
|
}
|
|
C.idd = H.idd;
|
|
C.grid = this._fake;
|
|
return C
|
|
};
|
|
var r = "_insertRowAt";
|
|
this._bfs_insertRowAt = this[r];
|
|
this[r] = function() {
|
|
var D = this["_bfs_insertRowAt"].apply(this, arguments);
|
|
arguments[0] = this.copy_row(arguments[0]);
|
|
var C = this._fake._insertRowAt.apply(this._fake, arguments);
|
|
if (D._fhd) {
|
|
C.parentNode.removeChild(C);
|
|
this._fake.rowsCol._dhx_removeAt(this._fake.rowsCol._dhx_find(C));
|
|
D._fhd = false
|
|
}
|
|
return D
|
|
};
|
|
this._bfs_setSizes = this.setSizes;
|
|
this.setSizes = function() {
|
|
if (this._notresize) {
|
|
return
|
|
}
|
|
this._bfs_setSizes(this, arguments);
|
|
this.sync_headers();
|
|
if (this.sync_scroll() && this._ahgr) {
|
|
this.setSizes()
|
|
}
|
|
var C = this.dontSetSizes ? (this.entBox.offsetHeight + "px") : this.entBox.style.height;
|
|
this._fake.entBox.style.height = C;
|
|
this._fake.objBox.style.height = this.objBox.style.height;
|
|
this._fake.hdrBox.style.height = this.hdrBox.style.height;
|
|
this._fake.objBox.scrollTop = this.objBox.scrollTop;
|
|
this._fake.setColumnSizes(this._fake.entBox.clientWidth);
|
|
this.globalBox.style.width = parseInt(this.entBox.style.width) + parseInt(this._fake.entBox.style.width);
|
|
if (!this.dontSetSizes) {
|
|
this.globalBox.style.height = C
|
|
}
|
|
};
|
|
this.sync_scroll = this._fake.sync_scroll = function(D) {
|
|
var C = this.objBox.style.overflowX;
|
|
if (this.obj.offsetWidth <= this.objBox.offsetWidth) {
|
|
if (!D) {
|
|
return this._fake.sync_scroll(true)
|
|
}
|
|
this.objBox.style.overflowX = "hidden";
|
|
this._fake.objBox.style.overflowX = "hidden"
|
|
} else {
|
|
if (!dhtmlx.$customScroll) {
|
|
this.objBox.style.overflowX = "scroll";
|
|
this._fake.objBox.style.overflowX = "scroll"
|
|
}
|
|
}
|
|
return C != this.objBox.style.overflowX
|
|
};
|
|
this.sync_headers = this._fake.sync_headers = function() {
|
|
if (this.noHeader || (this._fake.hdr.scrollHeight == this.hdr.offsetHeight)) {
|
|
return
|
|
}
|
|
for (var D = 1; D < this.hdr.rows.length; D++) {
|
|
var F = l;
|
|
while (!this.hdr.rows[D].childNodes[F]) {
|
|
F--
|
|
}
|
|
var C = Math.min(this.hdr.rows[D].childNodes[F].scrollHeight + 2, this.hdr.rows[D].scrollHeight);
|
|
var E = this._fake.hdr.rows[D].scrollHeight;
|
|
if (C != E) {
|
|
this._fake.hdr.rows[D].style.height = this.hdr.rows[D].style.height = Math.max(C, E) + "px"
|
|
}
|
|
if (window._KHTMLrv) {
|
|
this._fake.hdr.rows[D].childNodes[0].style.height = this.hdr.rows[D].childNodes[F].style.height = Math.max(C, E) + "px"
|
|
}
|
|
}
|
|
this._fake.sync_headers
|
|
};
|
|
this._fake._bfs_setSizes = this._fake.setSizes;
|
|
this._fake.setSizes = function() {
|
|
if (this._fake._notresize) {
|
|
return
|
|
}
|
|
this._fake.setSizes()
|
|
};
|
|
var r = "_doOnScroll";
|
|
this._bfs__doOnScroll = this[r];
|
|
this[r] = function() {
|
|
this._bfs__doOnScroll.apply(this, arguments);
|
|
this._fake.objBox.scrollTop = this.objBox.scrollTop;
|
|
this._fake._doOnScroll.apply(this._fake, arguments)
|
|
};
|
|
var r = "selectAll";
|
|
this._bfs__selectAll = this[r];
|
|
this[r] = function() {
|
|
this._bfs__selectAll.apply(this, arguments);
|
|
this._bfs__selectAll.apply(this._fake, arguments)
|
|
};
|
|
var r = "doClick";
|
|
this._bfs_doClick = this[r];
|
|
this[r] = function() {
|
|
this["_bfs_doClick"].apply(this, arguments);
|
|
if (arguments[0].tagName == "TD") {
|
|
var C = (arguments[0]._cellIndex >= l);
|
|
if (!arguments[0].parentNode.idd) {
|
|
return
|
|
}
|
|
if (!C) {
|
|
arguments[0].className = arguments[0].className.replace(/cellselected/g, "")
|
|
}
|
|
if (!this._fake.rowsAr[arguments[0].parentNode.idd]) {
|
|
this._fake.render_row(this.getRowIndex(arguments[0].parentNode.idd))
|
|
}
|
|
arguments[0] = this._fake.cells(arguments[0].parentNode.idd, (C ? 0 : arguments[0]._cellIndex)).cell;
|
|
if (C) {
|
|
this._fake.cell = null
|
|
}
|
|
this._fake._bfs_doClick.apply(this._fake, arguments);
|
|
if (C) {
|
|
this._fake.cell = this.cell
|
|
} else {
|
|
this.cell = this._fake.cell
|
|
} if (this._fake.onRowSelectTime) {
|
|
clearTimeout(this._fake.onRowSelectTime)
|
|
}
|
|
if (C) {
|
|
arguments[0].className = arguments[0].className.replace(/cellselected/g, "");
|
|
globalActiveDHTMLGridObject = this;
|
|
this._fake.cell = this.cell
|
|
} else {
|
|
this.objBox.scrollTop = this._fake.objBox.scrollTop
|
|
}
|
|
}
|
|
};
|
|
this._fake._bfs_doClick = this._fake[r];
|
|
this._fake[r] = function() {
|
|
this["_bfs_doClick"].apply(this, arguments);
|
|
if (arguments[0].tagName == "TD") {
|
|
var C = (arguments[0]._cellIndex < l);
|
|
if (!arguments[0].parentNode.idd) {
|
|
return
|
|
}
|
|
arguments[0] = this._fake._bfs_cells(arguments[0].parentNode.idd, (C ? l : arguments[0]._cellIndex)).cell;
|
|
this._fake.cell = null;
|
|
this._fake._bfs_doClick.apply(this._fake, arguments);
|
|
this._fake.cell = this.cell;
|
|
if (this._fake.onRowSelectTime) {
|
|
clearTimeout(this._fake.onRowSelectTime)
|
|
}
|
|
if (C) {
|
|
arguments[0].className = arguments[0].className.replace(/cellselected/g, "");
|
|
globalActiveDHTMLGridObject = this;
|
|
this._fake.cell = this.cell;
|
|
this._fake.objBox.scrollTop = this.objBox.scrollTop
|
|
}
|
|
}
|
|
};
|
|
this.clearSelectionA = this.clearSelection;
|
|
this.clearSelection = function(C) {
|
|
if (C) {
|
|
this._fake.clearSelection()
|
|
}
|
|
this.clearSelectionA()
|
|
};
|
|
this.moveRowUpA = this.moveRowUp;
|
|
this.moveRowUp = function(C) {
|
|
if (!this._h2) {
|
|
this._fake.moveRowUp(C)
|
|
}
|
|
this.moveRowUpA(C);
|
|
if (this._h2) {
|
|
this._fake._h2syncModel()
|
|
}
|
|
};
|
|
this.moveRowDownA = this.moveRowDown;
|
|
this.moveRowDown = function(C) {
|
|
if (!this._h2) {
|
|
this._fake.moveRowDown(C)
|
|
}
|
|
this.moveRowDownA(C);
|
|
if (this._h2) {
|
|
this._fake._h2syncModel()
|
|
}
|
|
};
|
|
this._fake.getUserData = function() {
|
|
return this._fake.getUserData.apply(this._fake, arguments)
|
|
};
|
|
this._fake.setUserData = function() {
|
|
return this._fake.setUserData.apply(this._fake, arguments)
|
|
};
|
|
this.getSortingStateA = this.getSortingState;
|
|
this.getSortingState = function() {
|
|
var C = this.getSortingStateA();
|
|
if (C.length != 0) {
|
|
return C
|
|
}
|
|
return this._fake.getSortingState()
|
|
};
|
|
this.setSortImgStateA = this._fake.setSortImgStateA = this.setSortImgState;
|
|
this.setSortImgState = function(D, C, F, E) {
|
|
this.setSortImgStateA(D, C, F, E);
|
|
if (C * 1 < l) {
|
|
this._fake.setSortImgStateA(D, C, F, E);
|
|
this.setSortImgStateA(false)
|
|
} else {
|
|
this._fake.setSortImgStateA(false)
|
|
}
|
|
};
|
|
this._fake.doColResizeA = this._fake.doColResize;
|
|
this._fake.doColResize = function(H, F, E, C, J) {
|
|
var D = -1;
|
|
var I = 0;
|
|
if (arguments[1]._cellIndex == (l - 1)) {
|
|
D = this._initalSplR + (H.clientX - C);
|
|
if (!this._initalSplF) {
|
|
this._initalSplF = arguments[3] + this.objBox.scrollWidth - this.objBox.offsetWidth
|
|
}
|
|
if (this.objBox.scrollWidth == this.objBox.offsetWidth && (this._fake.alter_split_resize || (H.clientX - C) > 0)) {
|
|
arguments[3] = (this._initalSplF || arguments[3]);
|
|
I = this.doColResizeA.apply(this, arguments)
|
|
} else {
|
|
I = this.doColResizeA.apply(this, arguments)
|
|
}
|
|
} else {
|
|
if (this.obj.offsetWidth < this.entBox.offsetWidth) {
|
|
D = this.obj.offsetWidth
|
|
}
|
|
I = this.doColResizeA.apply(this, arguments)
|
|
}
|
|
this._correctSplit(D);
|
|
this.resized = this._fake.resized = 1;
|
|
return I
|
|
};
|
|
this._fake.changeCursorState = function(E) {
|
|
var D = E.target || E.srcElement;
|
|
if (D.tagName != "TD") {
|
|
D = this.getFirstParentOfType(D, "TD")
|
|
}
|
|
if ((D.tagName == "TD") && (this._drsclmn) && (!this._drsclmn[D._cellIndex])) {
|
|
return
|
|
}
|
|
var C = (E.layerX || 0) + (((!_isIE) && (E.target.tagName == "DIV")) ? D.offsetLeft : 0);
|
|
var F = parseInt(this.getPosition(D, this.hdrBox));
|
|
if (((D.offsetWidth - (E.offsetX || (F - C) * -1)) < (_isOpera ? 20 : 10)) || ((this.entBox.offsetWidth - (E.offsetX ? (E.offsetX + D.offsetLeft) : C) + this.objBox.scrollLeft - 0) < (_isOpera ? 20 : 10))) {
|
|
D.style.cursor = "E-resize"
|
|
} else {
|
|
D.style.cursor = "default"
|
|
} if (_isOpera) {
|
|
this.hdrBox.scrollLeft = this.objBox.scrollLeft
|
|
}
|
|
};
|
|
this._fake.startColResizeA = this._fake.startColResize;
|
|
this._fake.startColResize = function(D) {
|
|
var E = this.startColResizeA(D);
|
|
this._initalSplR = this.entBox.offsetWidth;
|
|
this._initalSplF = null;
|
|
if (this.entBox.onmousemove) {
|
|
var C = this.entBox.parentNode;
|
|
if (C._aggrid) {
|
|
return E
|
|
}
|
|
C._aggrid = C.grid;
|
|
C.grid = this;
|
|
this.entBox.parentNode.onmousemove = this.entBox.onmousemove;
|
|
this.entBox.onmousemove = null
|
|
}
|
|
return E
|
|
};
|
|
this._fake.stopColResizeA = this._fake.stopColResize;
|
|
this._fake.stopColResize = function(D) {
|
|
if (this.entBox.parentNode.onmousemove) {
|
|
var C = this.entBox.parentNode;
|
|
C.grid = C._aggrid;
|
|
C._aggrid = null;
|
|
this.entBox.onmousemove = this.entBox.parentNode.onmousemove;
|
|
this.entBox.parentNode.onmousemove = null;
|
|
if (this.obj.offsetWidth < this.entBox.offsetWidth) {
|
|
this._correctSplit(this.obj.offsetWidth)
|
|
}
|
|
}
|
|
return this.stopColResizeA(D)
|
|
};
|
|
this.doKeyA = this.doKey;
|
|
this._fake.doKeyA = this._fake.doKey;
|
|
this._fake.doKey = this.doKey = function(E) {
|
|
if (!E) {
|
|
return true
|
|
}
|
|
if (this._htkebl) {
|
|
return true
|
|
}
|
|
if ((E.target || E.srcElement).value !== window.undefined) {
|
|
var C = (E.target || E.srcElement);
|
|
if ((!C.parentNode) || (C.parentNode.className.indexOf("editable") == -1)) {
|
|
return true
|
|
}
|
|
}
|
|
switch (E.keyCode) {
|
|
case 9:
|
|
if (!E.shiftKey) {
|
|
if (this._realfake) {
|
|
if ((this.cell) && (this.cell._cellIndex == (l - 1))) {
|
|
if (E.preventDefault) {
|
|
E.preventDefault()
|
|
}
|
|
var D = l;
|
|
while (this._fake._hrrar && this._fake._hrrar[D]) {
|
|
D++
|
|
}
|
|
this._fake.selectCell(this._fake.getRowIndex(this.cell.parentNode.idd), D, false, false, true);
|
|
return false
|
|
} else {
|
|
var F = this.doKeyA(E)
|
|
}
|
|
globalActiveDHTMLGridObject = this;
|
|
return F
|
|
} else {
|
|
if (this.cell) {
|
|
var D = this.cell._cellIndex + 1;
|
|
while (this.rowsCol[0].childNodes[D] && this.rowsCol[0].childNodes[D].style.display == "none") {
|
|
D++
|
|
}
|
|
if (D == this.rowsCol[0].childNodes.length) {
|
|
if (E.preventDefault) {
|
|
E.preventDefault()
|
|
}
|
|
var F = this.rowsBuffer[this.getRowIndex(this.cell.parentNode.idd) + 1];
|
|
if (F) {
|
|
this.showRow(F.idd);
|
|
this._fake.selectCell(this._fake.getRowIndex(F.idd), 0, false, false, true);
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
return this.doKeyA(E)
|
|
}
|
|
} else {
|
|
if (this._realfake) {
|
|
if ((this.cell) && (this.cell._cellIndex == 0)) {
|
|
if (E.preventDefault) {
|
|
E.preventDefault()
|
|
}
|
|
var F = this._fake.rowsBuffer[this._fake.getRowIndex(this.cell.parentNode.idd) - 1];
|
|
if (F) {
|
|
this._fake.showRow(F.idd);
|
|
var D = this._fake._cCount - 1;
|
|
while (F.childNodes[D].style.display == "none") {
|
|
D--
|
|
}
|
|
this._fake.selectCell(this._fake.getRowIndex(F.idd), D, false, false, true)
|
|
}
|
|
return false
|
|
} else {
|
|
return this.doKeyA(E)
|
|
}
|
|
} else {
|
|
if ((this.cell) && (this.cell._cellIndex == l)) {
|
|
if (E.preventDefault) {
|
|
E.preventDefault()
|
|
}
|
|
this._fake.selectCell(this.getRowIndex(this.cell.parentNode.idd), l - 1, false, false, true);
|
|
return false
|
|
} else {
|
|
return this.doKeyA(E)
|
|
}
|
|
}
|
|
}
|
|
break
|
|
}
|
|
return this.doKeyA(E)
|
|
};
|
|
this.editCellA = this.editCell;
|
|
this.editCell = function() {
|
|
if (this.cell && this.cell.parentNode.grid != this) {
|
|
return this._fake.editCell()
|
|
}
|
|
return this.editCellA()
|
|
};
|
|
this.deleteRowA = this.deleteRow;
|
|
this.deleteRow = function(C, D) {
|
|
if (this.deleteRowA(C, D) === false) {
|
|
return false
|
|
}
|
|
if (this._fake.rowsAr[C]) {
|
|
this._fake.deleteRow(C)
|
|
}
|
|
};
|
|
this.clearAllA = this.clearAll;
|
|
this.clearAll = function() {
|
|
this.clearAllA();
|
|
this._fake.clearAll()
|
|
};
|
|
this.editStopA = this.editStop;
|
|
this.editStop = function(C) {
|
|
if (this._fake.editor) {
|
|
this._fake.editStop(C)
|
|
} else {
|
|
this.editStopA(C)
|
|
}
|
|
};
|
|
this.attachEvent("onAfterSorting", function(D, C, E) {
|
|
if (D >= l) {
|
|
this._fake.setSortImgState(false)
|
|
}
|
|
});
|
|
this._fake.sortField = function(D, C, F) {
|
|
this._fake.sortField.call(this._fake, D, C, this._fake.hdr.rows[0].cells[D]);
|
|
if (this.fldSort[D] != "na" && this._fake.fldSorted) {
|
|
var E = this._fake.getSortingState()[1];
|
|
this._fake.setSortImgState(false);
|
|
this.setSortImgState(true, arguments[0], E)
|
|
}
|
|
};
|
|
this.sortTreeRowsA = this.sortTreeRows;
|
|
this._fake.sortTreeRowsA = this._fake.sortTreeRows;
|
|
this.sortTreeRows = this._fake.sortTreeRows = function(E, F, C, D) {
|
|
if (this._realfake) {
|
|
return this._fake.sortTreeRows(E, F, C, D)
|
|
}
|
|
this.sortTreeRowsA(E, F, C, D);
|
|
this._fake._h2syncModel();
|
|
this._fake.setSortImgStateA(false);
|
|
this._fake.fldSorted = null
|
|
};
|
|
this._fake._fillers = [];
|
|
this._fake.rowsBuffer = this.rowsBuffer;
|
|
this.attachEvent("onClearAll", function() {
|
|
this._fake.rowsBuffer = this.rowsBuffer
|
|
});
|
|
this._add_filler_s = this._add_filler;
|
|
this._add_filler = function(D, C, H, E) {
|
|
if (!this._fake._fillers) {
|
|
this._fake._fillers = []
|
|
}
|
|
if (this._realfake || !E) {
|
|
var F;
|
|
if (H || !this._fake._fillers.length) {
|
|
if (H && H.idd) {
|
|
F = this._fake.rowsAr[H.idd]
|
|
} else {
|
|
if (H && H.nextSibling) {
|
|
F = {};
|
|
F.nextSibling = this._fake.rowsAr[H.nextSibling.idd];
|
|
F.parentNode = F.nextSibling.parentNode
|
|
}
|
|
}
|
|
this._fake._fillers.push(this._fake._add_filler(D, C, F))
|
|
}
|
|
}
|
|
return this._add_filler_s.apply(this, arguments)
|
|
};
|
|
this._add_from_buffer_s = this._add_from_buffer;
|
|
this._add_from_buffer = function() {
|
|
var C = this._add_from_buffer_s.apply(this, arguments);
|
|
if (C != -1) {
|
|
this._fake._add_from_buffer.apply(this._fake, arguments);
|
|
if (this.multiLine) {
|
|
this._correctRowHeight(this.rowsBuffer[arguments[0]].idd)
|
|
}
|
|
}
|
|
return C
|
|
};
|
|
this._fake.render_row = function(C) {
|
|
var D = this._fake.render_row(C);
|
|
if (D == -1) {
|
|
return -1
|
|
}
|
|
if (D) {
|
|
return this.rowsAr[D.idd] = this.rowsAr[D.idd] || this._fake.copy_row(D)
|
|
}
|
|
return null
|
|
};
|
|
this._reset_view_s = this._reset_view;
|
|
this._reset_view = function() {
|
|
this._fake._reset_view(true);
|
|
this._fake._fillers = [];
|
|
this._reset_view_s()
|
|
};
|
|
this.moveColumn_s = this.moveColumn;
|
|
this.moveColumn = function(D, C) {
|
|
if (C >= l) {
|
|
return this.moveColumn_s(D, C)
|
|
}
|
|
};
|
|
this.attachEvent("onCellChanged", function(H, E, F) {
|
|
if (this._split_event && E < l && this.rowsAr[H]) {
|
|
var C = this._fake.rowsAr[H];
|
|
if (!C) {
|
|
return
|
|
}
|
|
if (C._childIndexes) {
|
|
C = C.childNodes[C._childIndexes[E]]
|
|
} else {
|
|
C = C.childNodes[E]
|
|
}
|
|
var D = this.rowsAr[H].childNodes[E];
|
|
if (D._treeCell && D.firstChild.lastChild) {
|
|
D.firstChild.lastChild.innerHTML = F
|
|
} else {
|
|
D.innerHTML = C.innerHTML
|
|
}
|
|
D._clearCell = false;
|
|
D.combo_value = C.combo_value;
|
|
D.chstate = C.chstate
|
|
}
|
|
});
|
|
this._fake.combos = this.combos;
|
|
this.setSizes();
|
|
if (this.rowsBuffer[0]) {
|
|
this._reset_view()
|
|
}
|
|
this.attachEvent("onXLE", function() {
|
|
this._fake._correctSplit()
|
|
});
|
|
this._fake._correctSplit()
|
|
};
|
|
dhtmlXGridObject.prototype._correctSplit = function(c) {
|
|
c = c || (this.obj.scrollWidth - this.objBox.scrollLeft);
|
|
c = Math.min(this.globalBox.offsetWidth, c);
|
|
if (c > -1) {
|
|
this.entBox.style.width = c + "px";
|
|
this.objBox.style.width = c + "px";
|
|
var h = (this.globalBox.offsetWidth - this.globalBox.clientWidth) / 2;
|
|
this._fake.entBox.style.left = c + "px";
|
|
this._fake.entBox.style.width = Math.max(0, this.globalBox.offsetWidth - c - (this.quirks ? 0 : 2) * h) + "px";
|
|
if (this._fake.ftr) {
|
|
this._fake.ftr.parentNode.style.width = this._fake.entBox.style.width
|
|
}
|
|
if (_isIE) {
|
|
var g = _isIE && !window.xmlHttpRequest;
|
|
var h = (this.globalBox.offsetWidth - this.globalBox.clientWidth);
|
|
this._fake.hdrBox.style.width = this._fake.objBox.style.width = Math.max(0, this.globalBox.offsetWidth - (g ? h : 0) - c) + "px"
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._correctRowHeight = function(q, n) {
|
|
if (!this.rowsAr[q] || !this._fake.rowsAr[q]) {
|
|
return
|
|
}
|
|
var m = this.rowsAr[q].offsetHeight;
|
|
var g = this._fake.rowsAr[q].offsetHeight;
|
|
var a = Math.max(m, g);
|
|
if (!a) {
|
|
return
|
|
}
|
|
this.rowsAr[q].style.height = this._fake.rowsAr[q].style.height = a + "px";
|
|
if (window._KHTMLrv) {
|
|
var c = this._fake._cCount;
|
|
var o;
|
|
while (!o && c >= 0) {
|
|
o = this.rowsAr[q].childNodes[c];
|
|
c -= 1
|
|
}
|
|
var l = this._fake.rowsAr[q].firstChild;
|
|
if (o && l) {
|
|
o.style.height = l.style.height = a + "px"
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.enableAutoSizeSaving = function(c, a) {
|
|
this.attachEvent("onResizeEnd", function() {
|
|
this.saveSizeToCookie(c, a)
|
|
})
|
|
};
|
|
dhtmlXGridObject.prototype.saveOpenStates = function(c, a) {
|
|
if (!c) {
|
|
c = this.entBox.id
|
|
}
|
|
var g = [];
|
|
this._h2.forEachChild(0, function(l) {
|
|
if (l.state == "minus") {
|
|
g.push(l.id)
|
|
}
|
|
});
|
|
var h = "gridOpen" + (c || "") + "=" + g.join("|") + (a ? ("; " + a) : "");
|
|
document.cookie = h
|
|
};
|
|
dhtmlXGridObject.prototype.loadOpenStates = function(g, a) {
|
|
var l = this.getCookie(g, "gridOpen");
|
|
if (!l) {
|
|
return
|
|
}
|
|
l = l.split("|");
|
|
for (var h = 0; h < l.length; h++) {
|
|
var c = this.getParentId(l[h]);
|
|
if (!this.getOpenState(c)) {
|
|
continue
|
|
}
|
|
this.openItem(l[h])
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.enableAutoHiddenColumnsSaving = function(c, a) {
|
|
this.attachEvent("onColumnHidden", function() {
|
|
this.saveHiddenColumnsToCookie(c, a)
|
|
})
|
|
};
|
|
dhtmlXGridObject.prototype.enableSortingSaving = function(c, a) {
|
|
this.attachEvent("onBeforeSorting", function() {
|
|
var g = this;
|
|
window.setTimeout(function() {
|
|
g.saveSortingToCookie(c, a)
|
|
}, 1);
|
|
return true
|
|
})
|
|
};
|
|
dhtmlXGridObject.prototype.enableOrderSaving = function(c, a) {
|
|
this.attachEvent("onAfterCMove", function() {
|
|
this.saveOrderToCookie(c, a);
|
|
this.saveSizeToCookie(c, a)
|
|
})
|
|
};
|
|
dhtmlXGridObject.prototype.enableAutoSaving = function(c, a) {
|
|
this.enableOrderSaving(c, a);
|
|
this.enableAutoSizeSaving(c, a);
|
|
this.enableSortingSaving(c, a)
|
|
};
|
|
dhtmlXGridObject.prototype.saveSizeToCookie = function(c, a) {
|
|
if (this.cellWidthType == "px") {
|
|
var h = this.cellWidthPX.join(",")
|
|
} else {
|
|
var h = this.cellWidthPC.join(",")
|
|
}
|
|
var g = (this.initCellWidth || (new Array)).join(",");
|
|
this.setCookie(c, a, 0, h);
|
|
this.setCookie(c, a, 1, g)
|
|
};
|
|
dhtmlXGridObject.prototype.saveHiddenColumnsToCookie = function(c, a) {
|
|
var h = [].concat(this._hrrar || []);
|
|
if (this._fake && this._fake._hrrar) {
|
|
for (var g = 0; g < this._fake._cCount; g++) {
|
|
h[g] = this._fake._hrrar[g] ? "1" : ""
|
|
}
|
|
}
|
|
this.setCookie(c, a, 4, h.join(",").replace(/display:none;/g, "1"))
|
|
};
|
|
dhtmlXGridObject.prototype.loadHiddenColumnsFromCookie = function(c) {
|
|
var h = this._getCookie(c, 4);
|
|
var a = (h || "").split(",");
|
|
for (var g = 0; g < this._cCount; g++) {
|
|
this.setColumnHidden(g, (a[g] ? true : false))
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.saveSortingToCookie = function(c, a) {
|
|
this.setCookie(c, a, 2, (this.getSortingState() || []).join(","))
|
|
};
|
|
dhtmlXGridObject.prototype.loadSortingFromCookie = function(a) {
|
|
var c = this._getCookie(a, 2);
|
|
c = (c || "").split(",");
|
|
if (c.length > 1 && c[0] < this._cCount) {
|
|
this.sortRows(c[0], null, c[1]);
|
|
this.setSortImgState(true, c[0], c[1])
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.saveOrderToCookie = function(g, a) {
|
|
if (!this._c_order) {
|
|
this._c_order = [];
|
|
var c = this._cCount;
|
|
for (var h = 0; h < c; h++) {
|
|
this._c_order[h] = h
|
|
}
|
|
}
|
|
this.setCookie(g, a, 3, ((this._c_order || []).slice(0, this._cCount)).join(","));
|
|
this.saveSortingToCookie()
|
|
};
|
|
dhtmlXGridObject.prototype.loadOrderFromCookie = function(c) {
|
|
var l = this._getCookie(c, 3);
|
|
l = (l || "").split(",");
|
|
if (l.length > 1 && l.length <= this._cCount) {
|
|
for (var h = 0; h < l.length; h++) {
|
|
if ((!this._c_order && l[h] != h) || (this._c_order && l[h] != this._c_order[h])) {
|
|
var g = l[h];
|
|
if (this._c_order) {
|
|
for (var a = 0; a < this._c_order.length; a++) {
|
|
if (this._c_order[a] == l[h]) {
|
|
g = a;
|
|
break
|
|
}
|
|
}
|
|
}
|
|
this.moveColumn(g * 1, h)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.loadSizeFromCookie = function(a) {
|
|
var g = this._getCookie(a, 1);
|
|
if (g) {
|
|
this.initCellWidth = g.split(",")
|
|
}
|
|
var g = this._getCookie(a, 0);
|
|
if ((g) && (g.length)) {
|
|
if (!this._fake && this._hrrar) {
|
|
for (var c = 0; c < g.length; c++) {
|
|
if (this._hrrar[c]) {
|
|
g[c] = 0
|
|
}
|
|
}
|
|
}
|
|
if (this.cellWidthType == "px") {
|
|
this.cellWidthPX = g.split(",")
|
|
} else {
|
|
this.cellWidthPC = g.split(",")
|
|
}
|
|
}
|
|
this.setSizes();
|
|
return true
|
|
};
|
|
dhtmlXGridObject.prototype.clearConfigCookie = function(a) {
|
|
if (!a) {
|
|
a = this.entBox.id
|
|
}
|
|
var c = "gridSettings" + a + "=||||";
|
|
document.cookie = c
|
|
};
|
|
dhtmlXGridObject.prototype.clearSizeCookie = dhtmlXGridObject.prototype.clearConfigCookie;
|
|
dhtmlXGridObject.prototype.setCookie = function(c, a, m, h) {
|
|
if (!c) {
|
|
c = this.entBox.id
|
|
}
|
|
var g = this.getCookie(c);
|
|
g = (g || "||||").split("|");
|
|
g[m] = h;
|
|
var l = "gridSettings" + c + "=" + g.join("|").replace(/,/g, "-") + (a ? ("; " + a) : "");
|
|
document.cookie = l
|
|
};
|
|
dhtmlXGridObject.prototype.getCookie = function(c, h) {
|
|
if (!c) {
|
|
c = this.entBox.id
|
|
}
|
|
c = (h || "gridSettings") + c;
|
|
var g = c + "=";
|
|
if (document.cookie.length > 0) {
|
|
var l = document.cookie.indexOf(g);
|
|
if (l != -1) {
|
|
l += g.length;
|
|
var a = document.cookie.indexOf(";", l);
|
|
if (a == -1) {
|
|
a = document.cookie.length
|
|
}
|
|
return document.cookie.substring(l, a)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._getCookie = function(a, c) {
|
|
return ((this.getCookie(a) || "||||").replace(/-/g, ",").split("|"))[c]
|
|
};
|
|
dhtmlXGridObject.prototype.enableUndoRedo = function() {
|
|
var c = this;
|
|
var g = function() {
|
|
return c._onEditUndoRedo.apply(c, arguments)
|
|
};
|
|
this.attachEvent("onEditCell", g);
|
|
var a = function(l, h, m) {
|
|
return c._onEditUndoRedo.apply(c, [2, l, h, (m ? 1 : 0), (m ? 0 : 1)])
|
|
};
|
|
this.attachEvent("onCheckbox", a);
|
|
this._IsUndoRedoEnabled = true;
|
|
this._UndoRedoData = [];
|
|
this._UndoRedoPos = -1
|
|
};
|
|
dhtmlXGridObject.prototype.disableUndoRedo = function() {
|
|
this._IsUndoRedoEnabled = false;
|
|
this._UndoRedoData = [];
|
|
this._UndoRedoPos = -1
|
|
};
|
|
dhtmlXGridObject.prototype._onEditUndoRedo = function(g, c, m, h, a) {
|
|
if (this._IsUndoRedoEnabled && g == 2 && a != h) {
|
|
if (this._UndoRedoPos !== -1 && this._UndoRedoPos != (this._UndoRedoData.length - 1)) {
|
|
this._UndoRedoData = this._UndoRedoData.slice(0, this._UndoRedoPos + 1)
|
|
} else {
|
|
if (this._UndoRedoPos === -1 && this._UndoRedoData.length > 0) {
|
|
this._UndoRedoData = []
|
|
}
|
|
}
|
|
var l = {
|
|
old_value: a,
|
|
new_value: h,
|
|
row_id: c,
|
|
cell_index: m
|
|
};
|
|
this._UndoRedoData.push(l);
|
|
this._UndoRedoPos++
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXGridObject.prototype.doUndo = function() {
|
|
if (this._UndoRedoPos === -1) {
|
|
return false
|
|
}
|
|
var a = this._UndoRedoData[this._UndoRedoPos--];
|
|
var g = this.cells(a.row_id, a.cell_index);
|
|
if (this.getColType(a.cell_index) == "tree") {
|
|
g.setLabel(a.old_value)
|
|
} else {
|
|
g.setValue(a.old_value)
|
|
}
|
|
this.callEvent("onUndo", [a.row_id])
|
|
};
|
|
dhtmlXGridObject.prototype.doRedo = function() {
|
|
if (this._UndoRedoPos == this._UndoRedoData.length - 1) {
|
|
return false
|
|
}
|
|
var a = this._UndoRedoData[++this._UndoRedoPos];
|
|
this.cells(a.row_id, a.cell_index).setValue(a.new_value);
|
|
this.callEvent("onUndo", [a.row_id])
|
|
};
|
|
dhtmlXGridObject.prototype.getRedo = function() {
|
|
if (this._UndoRedoPos == this._UndoRedoData.length - 1) {
|
|
return []
|
|
}
|
|
return this._UndoRedoData.slice(this._UndoRedoPos + 1)
|
|
};
|
|
dhtmlXGridObject.prototype.getUndo = function() {
|
|
if (this._UndoRedoPos == -1) {
|
|
return []
|
|
}
|
|
return this._UndoRedoData.slice(0, this._UndoRedoPos + 1)
|
|
};
|
|
|
|
function eXcell_time(a) {
|
|
this.base = eXcell_ed;
|
|
this.base(a);
|
|
this.getValue = function() {
|
|
return this.cell.innerHTML.toString()
|
|
};
|
|
this.setValue = function(m) {
|
|
var l = new RegExp(" ", "i");
|
|
m = m.replace(l, ":");
|
|
if ((m == "")) {
|
|
m = "00:00"
|
|
} else {
|
|
var l = new RegExp("[a-zA-Z]", "i");
|
|
var h = m.match(l);
|
|
if (h) {
|
|
m = "00:00"
|
|
} else {
|
|
var l = new RegExp("[0-9]+[\\.\\/;\\-,_\\]\\[\\?\\: ][0-9]+", "i");
|
|
var h = m.search(l);
|
|
if (h != -1) {
|
|
var l = new RegExp("[\\./\\;\\-\\,\\_\\]\\[ \\?]", "i");
|
|
m = m.replace(l, ":")
|
|
} else {
|
|
var l = new RegExp("[^0-9]", "i");
|
|
res1 = m.search(l);
|
|
if (h = m.match(l)) {
|
|
m = "00:00"
|
|
} else {
|
|
if (m.length == 1) {
|
|
m = "00:0" + m
|
|
} else {
|
|
if (parseInt(m) < 60) {
|
|
m = "00:" + m
|
|
} else {
|
|
if (m.length < 5) {
|
|
var g = parseInt(m);
|
|
var c = Math.floor(g / 60);
|
|
g = g - 60 * c;
|
|
var c = c.toString();
|
|
var g = g.toString();
|
|
while (c.length < 2) {
|
|
c = "0" + c
|
|
}
|
|
while (g.length < 2) {
|
|
g = "0" + g
|
|
}
|
|
m = c + ":" + g
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.cell.innerHTML = m
|
|
}
|
|
}
|
|
eXcell_time.prototype = new eXcell_ed;
|
|
|
|
function eXcell_sub_row(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
}
|
|
this.getValue = function() {
|
|
return this.grid.getUserData(this.cell.parentNode.idd, "__sub_row")
|
|
};
|
|
this._setState = function(c, g) {
|
|
(g || this.cell).innerHTML = "<img src='" + this.grid.imgURL + c + "' width='18' height='18' />";
|
|
(g || this.cell).firstChild.onclick = this.grid._expandMonolite
|
|
};
|
|
this.open = function() {
|
|
this.cell.firstChild.onclick(null, true)
|
|
};
|
|
this.close = function() {
|
|
this.cell.firstChild.onclick(null, false, true)
|
|
};
|
|
this.isOpen = function() {
|
|
return !!this.cell.parentNode._expanded
|
|
};
|
|
this.setValue = function(c) {
|
|
if (c) {
|
|
this.grid.setUserData(this.cell.parentNode.idd, "__sub_row", c)
|
|
}
|
|
this._setState(c ? "plus.gif" : "blank.gif")
|
|
};
|
|
this.setContent = function(c) {
|
|
if (this.cell.parentNode._expanded) {
|
|
this.cell.parentNode._expanded.innerHTML = c;
|
|
this.resize()
|
|
} else {
|
|
this.cell._previous_content = null;
|
|
this.setValue(c);
|
|
this.cell._sub_row_type = null
|
|
}
|
|
};
|
|
this.resize = function() {
|
|
this.grid._detectHeight(this.cell.parentNode._expanded, this.cell, this.cell.parentNode._expanded.scrollHeight)
|
|
}, this.isDisabled = function() {
|
|
return true
|
|
};
|
|
this.getTitle = function() {
|
|
return this.grid.getUserData(this.cell.parentNode.idd, "__sub_row") ? "click to expand|collapse" : ""
|
|
}
|
|
}
|
|
eXcell_sub_row.prototype = new eXcell;
|
|
|
|
function eXcell_sub_row_ajax(a) {
|
|
this.base = eXcell_sub_row;
|
|
this.base(a);
|
|
this.setValue = function(c) {
|
|
if (c) {
|
|
this.grid.setUserData(this.cell.parentNode.idd, "__sub_row", c)
|
|
}
|
|
this.cell._sub_row_type = "ajax";
|
|
this.cell._previous_content = null;
|
|
this._setState(c ? "plus.gif" : "blank.gif")
|
|
}
|
|
}
|
|
eXcell_sub_row_ajax.prototype = new eXcell_sub_row;
|
|
|
|
function eXcell_sub_row_grid(a) {
|
|
this.base = eXcell_sub_row;
|
|
this.base(a);
|
|
this.setValue = function(c) {
|
|
if (c) {
|
|
this.grid.setUserData(this.cell.parentNode.idd, "__sub_row", c)
|
|
}
|
|
this.cell._sub_row_type = "grid";
|
|
this._setState(c ? "plus.gif" : "blank.gif")
|
|
};
|
|
this.getSubGrid = function() {
|
|
if (!a._sub_grid) {
|
|
return null
|
|
}
|
|
return a._sub_grid
|
|
}
|
|
}
|
|
eXcell_sub_row_grid.prototype = new eXcell_sub_row;
|
|
dhtmlXGridObject.prototype._expandMonolite = function(a, u, m) {
|
|
var g = this.parentNode;
|
|
var v = g.parentNode;
|
|
var q = v.grid;
|
|
if (a || window.event) {
|
|
if (!m && !v._expanded) {
|
|
q.editStop()
|
|
}(a || event).cancelBubble = true
|
|
}
|
|
var s = q.getUserData(v.idd, "__sub_row");
|
|
if (!q._sub_row_editor) {
|
|
q._sub_row_editor = new eXcell_sub_row(g)
|
|
}
|
|
if (!s) {
|
|
return
|
|
}
|
|
if (v._expanded && !u) {
|
|
q._sub_row_editor._setState("plus.gif", g);
|
|
g._previous_content = v._expanded;
|
|
q.objBox.removeChild(v._expanded);
|
|
v._expanded = false;
|
|
v.style.height = (v.oldHeight || 20) + "px";
|
|
g.style.height = (v.oldHeight || 20) + "px";
|
|
if (q._fake) {
|
|
q._fake.rowsAr[v.idd].style.height = (v.oldHeight || 20) + "px"
|
|
}
|
|
for (var l = 0; l < v.cells.length; l++) {
|
|
v.cells[l].style.verticalAlign = "middle";
|
|
v.cells[l].style.paddingTop = "0px"
|
|
}
|
|
delete q._flow[v.idd];
|
|
q._correctMonolite();
|
|
v._expanded.ctrl = null
|
|
} else {
|
|
if (!v._expanded && !m) {
|
|
q._sub_row_editor._setState("minus.gif", g);
|
|
v.oldHeight = g.offsetHeight;
|
|
if (g._previous_content) {
|
|
var r = g._previous_content;
|
|
r.ctrl = g;
|
|
q.objBox.appendChild(r);
|
|
q._detectHeight(r, g, parseInt(r.style.height))
|
|
} else {
|
|
var r = document.createElement("DIV");
|
|
r.ctrl = g;
|
|
if (g._sub_row_type) {
|
|
q._sub_row_render[g._sub_row_type](q, r, g, s)
|
|
} else {
|
|
r.innerHTML = s
|
|
}
|
|
r.style.cssText = "position:absolute; left:0px; top:0px; overflow:auto; font-family:Tahoma; font-size:8pt; margin-top:2px; margin-left:4px;";
|
|
r.className = "dhx_sub_row";
|
|
q.objBox.appendChild(r);
|
|
q._detectHeight(r, g)
|
|
} if (!q._flow) {
|
|
q.attachEvent("onGridReconstructed", function() {
|
|
if ((this.pagingOn && !this.parentGrid) || this._srnd) {
|
|
this._collapsMonolite()
|
|
} else {
|
|
this._correctMonolite()
|
|
}
|
|
});
|
|
q.attachEvent("onResizeEnd", function() {
|
|
this._correctMonolite(true)
|
|
});
|
|
q.attachEvent("onAfterCMove", function() {
|
|
this._correctMonolite(true)
|
|
});
|
|
q.attachEvent("onDrop", function() {
|
|
this._correctMonolite(true)
|
|
});
|
|
q.attachEvent("onBeforePageChanged", function() {
|
|
this._collapsMonolite();
|
|
return true
|
|
});
|
|
q.attachEvent("onGroupStateChanged", function() {
|
|
this._correctMonolite();
|
|
return true
|
|
});
|
|
q.attachEvent("onFilterEnd", function() {
|
|
this._collapsMonolite()
|
|
});
|
|
q.attachEvent("onUnGroup", function() {
|
|
this._collapsMonolite()
|
|
});
|
|
q.attachEvent("onPageChanged", function() {
|
|
this._collapsMonolite()
|
|
});
|
|
q.attachEvent("onXLE", function() {
|
|
this._collapsMonolite()
|
|
});
|
|
q.attachEvent("onClearAll", function() {
|
|
for (var c in this._flow) {
|
|
if (this._flow[c] && this._flow[c].parentNode) {
|
|
this._flow[c].parentNode.removeChild(this._flow[c])
|
|
}
|
|
}
|
|
this._flow = []
|
|
});
|
|
q.attachEvent("onEditCell", function(w, n, x) {
|
|
if ((w !== 2) && this._flow[n] && this.cellType[x] != "ch" && this.cellType[x] != "ra") {
|
|
this._expandMonolite.apply(this._flow[n].ctrl.firstChild, [0, false, true])
|
|
}
|
|
return true
|
|
});
|
|
q.attachEvent("onCellChanged", function(x, n) {
|
|
if (!this._flow[x]) {
|
|
return
|
|
}
|
|
var w = this.cells(x, n).cell;
|
|
w.style.verticalAlign = "top";
|
|
w.style.paddingTop = "3px"
|
|
});
|
|
q._flow = []
|
|
}
|
|
q._flow[v.idd] = r;
|
|
q._correctMonolite();
|
|
var o = q._srdh > 30 ? 11 : 3;
|
|
if (q.multiLine) {
|
|
o = 0
|
|
}
|
|
for (var l = 0; l < v.cells.length; l++) {
|
|
v.cells[l].style.verticalAlign = "top";
|
|
v.cells[l].style.paddingTop = o + "px"
|
|
}
|
|
if (q._fake) {
|
|
var h = q._fake.rowsAr[v.idd];
|
|
for (var l = 0; l < h.cells.length; l++) {
|
|
h.cells[l].style.verticalAlign = "top";
|
|
h.cells[l].style.paddingTop = o + "px"
|
|
}
|
|
}
|
|
g.style.paddingTop = (o - 1) + "px";
|
|
v._expanded = r
|
|
}
|
|
} if (q._ahgr) {
|
|
q.setSizes()
|
|
}
|
|
if (q.parentGrid) {
|
|
q.callEvent("onGridReconstructed", [])
|
|
}
|
|
q.callEvent("onSubRowOpen", [v.idd, ( !! v._expanded)])
|
|
};
|
|
dhtmlXGridObject.prototype._sub_row_render = {
|
|
ajax: function(that, d, td, c) {
|
|
d.innerHTML = "Loading...";
|
|
var xml = new dtmlXMLLoaderObject(function() {
|
|
d.innerHTML = xml.xmlDoc.responseText;
|
|
var z = xml.xmlDoc.responseText.match(/<script[^>]*>([^\f]+?)<\/script>/g);
|
|
if (z) {
|
|
for (var i = 0; i < z.length; i++) {
|
|
eval(z[i].replace(/<([\/]{0,1})s[^>]*>/g, ""))
|
|
}
|
|
}
|
|
that._detectHeight(d, td);
|
|
that._correctMonolite();
|
|
that.setUserData(td.parentNode.idd, "__sub_row", xml.xmlDoc.responseText);
|
|
td._sub_row_type = null;
|
|
if (that._ahgr) {
|
|
that.setSizes()
|
|
}
|
|
that.callEvent("onSubAjaxLoad", [td.parentNode.idd, xml.xmlDoc.responseText])
|
|
}, this, true, true);
|
|
xml.loadXML(c)
|
|
},
|
|
grid: function(a, g, l, h) {
|
|
l._sub_grid = new dhtmlXGridObject(g);
|
|
if (a.skin_name) {
|
|
l._sub_grid.setSkin(a.skin_name)
|
|
}
|
|
l._sub_grid.parentGrid = a;
|
|
l._sub_grid.imgURL = a.imgURL;
|
|
l._sub_grid.iconURL = a.iconURL;
|
|
l._sub_grid.enableAutoHeight(true);
|
|
l._sub_grid._delta_x = l._sub_grid._delta_y = null;
|
|
l._sub_grid.attachEvent("onGridReconstructed", function() {
|
|
a._detectHeight(g, l, l._sub_grid.objBox.scrollHeight + l._sub_grid.hdr.offsetHeight + (this.ftr ? this.ftr.offsetHeight : 0));
|
|
a._correctMonolite();
|
|
this.setSizes();
|
|
if (a.parentGrid) {
|
|
a.callEvent("onGridReconstructed", [])
|
|
}
|
|
});
|
|
if (!a.callEvent("onSubGridCreated", [l._sub_grid, l.parentNode.idd, l._cellIndex, h])) {
|
|
l._sub_grid.objBox.style.overflow = "hidden";
|
|
l._sub_row_type = null
|
|
} else {
|
|
l._sub_grid.loadXML(h, function() {
|
|
a._detectHeight(g, l, l._sub_grid.objBox.scrollHeight + l._sub_grid.hdr.offsetHeight + (l._sub_grid.ftr ? l._sub_grid.ftr.offsetHeight : 0));
|
|
l._sub_grid.objBox.style.overflow = "hidden";
|
|
a._correctMonolite();
|
|
l._sub_row_type = null;
|
|
if (!a.callEvent("onSubGridLoaded", [l._sub_grid, l.parentNode.idd, l._cellIndex, h])) {
|
|
return
|
|
}
|
|
if (a._ahgr) {
|
|
a.setSizes()
|
|
}
|
|
})
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._detectHeight = function(n, o, c) {
|
|
var a = o.offsetLeft + o.offsetWidth;
|
|
n.style.left = a + "px";
|
|
n.style.width = Math.max(0, o.parentNode.offsetWidth - a - 4) + "px";
|
|
var c = c || n.scrollHeight;
|
|
n.style.overflow = "hidden";
|
|
n.style.height = c + "px";
|
|
var m = o.parentNode;
|
|
o.parentNode.style.height = (m.oldHeight || 20) + 3 + c * 1 + "px";
|
|
o.style.height = (m.oldHeight || 20) + 3 + c * 1 + "px";
|
|
if (this._fake) {
|
|
var g = this._fake.rowsAr[o.parentNode.idd];
|
|
g.style.height = (m.oldHeight || 20) + 3 + c * 1 + "px"
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._correctMonolite = function(h) {
|
|
if (this._in_correction) {
|
|
return
|
|
}
|
|
this._in_correction = true;
|
|
for (var g in this._flow) {
|
|
if (this._flow[g] && this._flow[g].tagName == "DIV") {
|
|
if (this.rowsAr[g]) {
|
|
if (this.rowsAr[g].style.display == "none") {
|
|
this.cells4(this._flow[g].ctrl).close();
|
|
continue
|
|
}
|
|
this._flow[g].style.top = this.rowsAr[g].offsetTop + (this.rowsAr[g].oldHeight || 20) + "px";
|
|
if (h) {
|
|
var c = this._flow[g].ctrl.offsetLeft + this._flow[g].ctrl.offsetWidth;
|
|
this._flow[g].style.left = c + "px";
|
|
this._flow[g].style.width = this.rowsAr[g].offsetWidth - c - 4 + "px"
|
|
}
|
|
} else {
|
|
this._flow[g].ctrl = null;
|
|
this.objBox.removeChild(this._flow[g]);
|
|
delete this._flow[g]
|
|
}
|
|
}
|
|
}
|
|
this._in_correction = false
|
|
};
|
|
dhtmlXGridObject.prototype._collapsMonolite = function() {
|
|
for (var c in this._flow) {
|
|
if (this._flow[c] && this._flow[c].tagName == "DIV") {
|
|
if (this.rowsAr[c]) {
|
|
this.cells4(this._flow[c].ctrl).close()
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
function eXcell_ra_str(a) {
|
|
if (a) {
|
|
this.base = eXcell_ra;
|
|
this.base(a);
|
|
this.grid = a.parentNode.grid
|
|
}
|
|
}
|
|
eXcell_ra_str.prototype = new eXcell_ch;
|
|
eXcell_ra_str.prototype.setValue = function(g) {
|
|
this.cell.style.verticalAlign = "middle";
|
|
if (g) {
|
|
g = g.toString()._dhx_trim();
|
|
if ((g == "false") || (g == "0")) {
|
|
g = ""
|
|
}
|
|
}
|
|
if (g) {
|
|
if (this.grid.rowsAr[this.cell.parentNode.idd]) {
|
|
for (var c = 0; c < this.grid._cCount; c++) {
|
|
if (c !== this.cell._cellIndex) {
|
|
var a = this.grid.cells(this.cell.parentNode.idd, c);
|
|
if ((a.cell._cellType || this.grid.cellType[a.cell._cellIndex]) != "ra_str") {
|
|
continue
|
|
}
|
|
if (a.getValue()) {
|
|
a.setValue("0")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
g = "1";
|
|
this.cell.chstate = "1"
|
|
} else {
|
|
g = "0";
|
|
this.cell.chstate = "0"
|
|
}
|
|
this.setCValue("<img src='" + this.grid.imgURL + "radio_chk" + g + ".gif' onclick='new eXcell_ra_str(this.parentNode).changeState()'>", this.cell.chstate)
|
|
};
|
|
dhtmlXGridObject.prototype._init_point_bcg = dhtmlXGridObject.prototype._init_point;
|
|
dhtmlXGridObject.prototype._init_point = function() {
|
|
if (!window.dhx_globalImgPath) {
|
|
window.dhx_globalImgPath = this.imgURL
|
|
}
|
|
this._col_combos = [];
|
|
for (var a = 0; a < this._cCount; a++) {
|
|
if (this.cellType[a].indexOf("combo") == 0) {
|
|
this._col_combos[a] = eXcell_combo.prototype.initCombo.call({
|
|
grid: this
|
|
}, a)
|
|
}
|
|
}
|
|
if (!this._loading_handler_set) {
|
|
this._loading_handler_set = this.attachEvent("onXLE", function(h, g, m, l) {
|
|
eXcell_combo.prototype.fillColumnCombos(this, l);
|
|
this.detachEvent(this._loading_handler_set);
|
|
this._loading_handler_set = null
|
|
})
|
|
}
|
|
if (this._init_point_bcg) {
|
|
this._init_point_bcg()
|
|
}
|
|
};
|
|
|
|
function eXcell_combo(a) {
|
|
if (!a) {
|
|
return
|
|
}
|
|
this.cell = a;
|
|
this.grid = a.parentNode.grid;
|
|
this._combo_pre = "";
|
|
this.edit = function() {
|
|
if (!window.dhx_globalImgPath) {
|
|
window.dhx_globalImgPath = this.grid.imgURL
|
|
}
|
|
this.val = this.getValue();
|
|
var c = this.getText();
|
|
if (this.cell._clearCell) {
|
|
c = ""
|
|
}
|
|
this.cell.innerHTML = "";
|
|
if (!this.cell._brval) {
|
|
this.combo = (this.grid._realfake ? this.grid._fake : this.grid)._col_combos[this.cell._cellIndex]
|
|
} else {
|
|
this.combo = this.cell._brval
|
|
}
|
|
this.cell.appendChild(this.combo.DOMParent);
|
|
this.combo.DOMParent.style.margin = "0";
|
|
this.combo.DOMelem_input.focus();
|
|
this.combo.setSize(this.cell.offsetWidth - 2);
|
|
if (!this.combo._xml) {
|
|
if (this.combo.getIndexByValue(this.cell.combo_value) != -1) {
|
|
this.combo.selectOption(this.combo.getIndexByValue(this.cell.combo_value))
|
|
} else {
|
|
if (this.combo.getOptionByLabel(c)) {
|
|
this.combo.selectOption(this.combo.getIndexByValue(this.combo.getOptionByLabel(c).value))
|
|
} else {
|
|
this.combo.setComboText(c)
|
|
}
|
|
}
|
|
} else {
|
|
this.combo.setComboText(c)
|
|
}
|
|
this.combo.openSelect()
|
|
};
|
|
this.selectComboOption = function(g, c) {
|
|
c.selectOption(c.getIndexByValue(c.getOptionByLabel(g).value))
|
|
};
|
|
this.getValue = function(c) {
|
|
return this.cell.combo_value || ""
|
|
};
|
|
this.getText = function(g) {
|
|
var h = this.cell;
|
|
if (this._combo_pre == "" && h.childNodes[1]) {
|
|
h = h.childNodes[1]
|
|
} else {
|
|
h.childNodes[0].childNodes[1]
|
|
}
|
|
return (_isIE ? h.innerText : h.textContent)
|
|
};
|
|
this.setValue = function(l) {
|
|
if (typeof(l) == "object") {
|
|
this.cell._brval = this.initCombo();
|
|
var g = this.cell._cellIndex;
|
|
var h = this.cell.parentNode.idd;
|
|
if (!l.firstChild) {
|
|
this.cell.combo_value = " ";
|
|
this.cell._clearCell = true
|
|
} else {
|
|
this.cell.combo_value = l.firstChild.data
|
|
}
|
|
this.setComboOptions(this.cell._brval, l, this.grid, g, h)
|
|
} else {
|
|
this.cell.combo_value = l;
|
|
var c = null;
|
|
if ((c = this.cell._brval) && (typeof(this.cell._brval) == "object")) {
|
|
l = (c.getOption(l) || {}).text || l
|
|
} else {
|
|
if (c = this.grid._col_combos[this.cell._cellIndex] || ((this.grid._fake) && (c = this.grid._fake._col_combos[this.cell._cellIndex]))) {
|
|
l = (c.getOption(l) || {}).text || l
|
|
}
|
|
} if ((l || "").toString()._dhx_trim() == "") {
|
|
l = null
|
|
}
|
|
if (l !== null) {
|
|
this.setComboCValue(l)
|
|
} else {
|
|
this.setComboCValue(" ", "");
|
|
this.cell._clearCell = true
|
|
}
|
|
}
|
|
};
|
|
this.detach = function() {
|
|
this.cell.removeChild(this.combo.DOMParent);
|
|
var c = this.cell.combo_value;
|
|
if (!this.combo.getComboText() || this.combo.getComboText().toString()._dhx_trim() == "") {
|
|
this.setComboCValue(" ");
|
|
this.cell._clearCell = true
|
|
} else {
|
|
this.setComboCValue(this.combo.getComboText().replace(/\&/g, "&").replace(/</g, "<").replace(/>/g, ">"), this.combo.getActualValue());
|
|
this.cell._clearCell = false
|
|
}
|
|
this.combo._confirmSelect();
|
|
this.cell.combo_value = this.combo.getActualValue();
|
|
this.combo.closeAll();
|
|
this.grid._still_active = true;
|
|
this.grid.setActive(1);
|
|
return c != this.cell.combo_value
|
|
}
|
|
}
|
|
eXcell_combo.prototype = new eXcell;
|
|
eXcell_combo_v = function(a) {
|
|
var c = new eXcell_combo(a);
|
|
c._combo_pre = "<img src='" + (window.dhx_globalImgPath ? window.dhx_globalImgPath : this.grid.imgURL) + "combo_select" + (dhtmlx.skin ? "_" + dhtmlx.skin : "") + ".gif' class='dhxgrid_combo_icon'/>";
|
|
return c
|
|
};
|
|
eXcell_combo.prototype.initCombo = function(c) {
|
|
var a = document.createElement("DIV");
|
|
var h = this.grid.defVal[arguments.length ? c : this.cell._cellIndex];
|
|
var l = new dhtmlXCombo(a, "combo", 0, h);
|
|
this.grid.defVal[arguments.length ? c : this.cell._cellIndex] = "";
|
|
l.DOMelem.className += " dhxcombo_in_grid";
|
|
var g = this.grid;
|
|
l.DOMelem.onselectstart = function() {
|
|
event.cancelBubble = true;
|
|
return true
|
|
};
|
|
l.attachEvent("onKeyPressed", function(m) {
|
|
if (m == 13 || m == 27) {
|
|
g.editStop();
|
|
if (g._fake) {
|
|
g._fake.editStop()
|
|
}
|
|
}
|
|
});
|
|
dhtmlxEvent(l.DOMlist, "click", function() {
|
|
g.editStop();
|
|
if (g._fake) {
|
|
g._fake.editStop()
|
|
}
|
|
});
|
|
return l
|
|
};
|
|
eXcell_combo.prototype.fillColumnCombos = function(g, a) {
|
|
if (!a) {
|
|
return
|
|
}
|
|
g.combo_columns = g.combo_columns || [];
|
|
columns = g.xmlLoader.doXPath("//column", a);
|
|
for (var c = 0; c < columns.length; c++) {
|
|
if ((columns[c].getAttribute("type") || "").indexOf("combo") == 0) {
|
|
g.combo_columns[g.combo_columns.length] = c;
|
|
this.setComboOptions(g._col_combos[c], columns[c], g, c)
|
|
}
|
|
}
|
|
};
|
|
eXcell_combo.prototype.setComboCValue = function(g, c) {
|
|
if (this._combo_pre != "") {
|
|
var a = (this.cell.offsetHeight ? this.cell.offsetHeight + "px" : 0);
|
|
g = "<div style='width:100%;position:relative;height:100%;overflow:hidden;'>" + this._combo_pre + "<span>" + g + "</span></div>"
|
|
}
|
|
if (arguments.length > 1) {
|
|
this.setCValue(g, c)
|
|
} else {
|
|
this.setCValue(g)
|
|
}
|
|
};
|
|
eXcell_combo.prototype.setComboOptions = function(m, n, g, r, u) {
|
|
if (window.dhx4.s2b(n.getAttribute("xmlcontent"))) {
|
|
if (!n.getAttribute("source")) {
|
|
options = n.childNodes;
|
|
var a = [];
|
|
for (var o = 0; o < options.length; o++) {
|
|
if (options[o].tagName == "option") {
|
|
var h = options[o].firstChild ? options[o].firstChild.data : "";
|
|
a[a.length] = [options[o].getAttribute("value"), h]
|
|
}
|
|
}
|
|
m.addOption(a);
|
|
if (arguments.length == 4) {
|
|
g.forEachRowA(function(w) {
|
|
var v = g.cells(w, r);
|
|
if (!v.cell._brval && !v.cell._cellType && (v.cell._cellIndex == r)) {
|
|
if (v.cell.combo_value == "") {
|
|
v.setComboCValue(" ", "")
|
|
} else {
|
|
if (!m.getOption(v.cell.combo_value)) {
|
|
v.setComboCValue(v.cell.combo_value)
|
|
} else {
|
|
v.setComboCValue(m.getOption(v.cell.combo_value).text)
|
|
}
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
var s = (this.cell) ? this : g.cells(u, r);
|
|
if (n.getAttribute("text")) {
|
|
if (n.getAttribute("text")._dhx_trim() == "") {
|
|
s.setComboCValue(" ", "")
|
|
} else {
|
|
s.setComboCValue(n.getAttribute("text"))
|
|
}
|
|
} else {
|
|
if ((!s.cell.combo_value) || (s.cell.combo_value._dhx_trim() == "")) {
|
|
s.setComboCValue(" ", "")
|
|
} else {
|
|
if (!m.getOption(s.cell.combo_value)) {
|
|
s.setComboCValue(s.cell.combo_value)
|
|
} else {
|
|
s.setComboCValue(m.getOption(s.cell.combo_value).text)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (n.getAttribute("source")) {
|
|
if (n.getAttribute("auto") && window.dhx4.s2b(n.getAttribute("auto"))) {
|
|
if (n.getAttribute("xmlcontent")) {
|
|
var s = (this.cell) ? this : g.cells(u, r);
|
|
if (n.getAttribute("text")) {
|
|
s.setComboCValue(n.getAttribute("text"))
|
|
}
|
|
} else {
|
|
g.forEachRowA(function(y) {
|
|
var x = g.cells(y, r);
|
|
if (!x.cell._brval && !x.cell._cellType) {
|
|
var w = x.cell.combo_value.toString();
|
|
if (w.indexOf("^") != -1) {
|
|
var v = w.split("^");
|
|
x.cell.combo_value = v[0];
|
|
x.setComboCValue(v[1])
|
|
}
|
|
}
|
|
})
|
|
}
|
|
m.enableFilteringMode(true, n.getAttribute("source"), window.dhx4.s2b(n.getAttribute("cache") || true), window.dhx4.s2b(n.getAttribute("sub") || false))
|
|
} else {
|
|
var q = this;
|
|
var l = arguments.length;
|
|
m.load(n.getAttribute("source"), function() {
|
|
if (l == 4) {
|
|
g.forEachRow(function(x) {
|
|
var w = g.cells(x, r);
|
|
if (!w.cell._brval && !w.cell._cellType) {
|
|
if (m.getOption(w.cell.combo_value)) {
|
|
w.setComboCValue(m.getOption(w.cell.combo_value).text)
|
|
} else {
|
|
if ((w.cell.combo_value || "").toString()._dhx_trim() == "") {
|
|
w.setComboCValue(" ", "");
|
|
w.cell._clearCell = true
|
|
} else {
|
|
w.setComboCValue(w.cell.combo_value)
|
|
}
|
|
}
|
|
}
|
|
})
|
|
} else {
|
|
var v = g.cells(u, r);
|
|
if (m.getOption(v.cell.combo_value)) {
|
|
v.setComboCValue(m.getOption(v.cell.combo_value).text)
|
|
} else {
|
|
v.setComboCValue(v.cell.combo_value)
|
|
}
|
|
}
|
|
})
|
|
}
|
|
}
|
|
if (!n.getAttribute("auto") || !window.dhx4.s2b(n.getAttribute("auto"))) {
|
|
if (n.getAttribute("editable") && !window.dhx4.s2b(n.getAttribute("editable"))) {
|
|
m.readonly(true)
|
|
}
|
|
if (n.getAttribute("filter") && window.dhx4.s2b(n.getAttribute("filter"))) {
|
|
m.enableFilteringMode(true)
|
|
}
|
|
}
|
|
};
|
|
eXcell_combo.prototype.getCellCombo = function() {
|
|
if (this.cell._brval) {
|
|
return this.cell._brval
|
|
}
|
|
this.cell._brval = this.initCombo();
|
|
return this.cell._brval
|
|
};
|
|
eXcell_combo.prototype.refreshCell = function() {
|
|
this.setValue(this.getValue())
|
|
};
|
|
dhtmlXGridObject.prototype.getColumnCombo = function(a) {
|
|
if (this._col_combos && this._col_combos[a]) {
|
|
return this._col_combos[a]
|
|
}
|
|
if (!this._col_combos) {
|
|
this._col_combos = []
|
|
}
|
|
this._col_combos[a] = eXcell_combo.prototype.initCombo.call({
|
|
grid: this
|
|
}, a);
|
|
return this._col_combos[a]
|
|
};
|
|
dhtmlXGridObject.prototype.refreshComboColumn = function(a) {
|
|
this.forEachRow(function(c) {
|
|
if (this.cells(c, a).refreshCell) {
|
|
this.cells(c, a).refreshCell()
|
|
}
|
|
})
|
|
};
|
|
|
|
function eXcell_clist(a) {
|
|
try {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
} catch (c) {}
|
|
this.edit = function() {
|
|
this.val = this.getValue();
|
|
var h = (this.cell._combo || this.grid.clists[this.cell._cellIndex]);
|
|
if (!h) {
|
|
return
|
|
}
|
|
this.obj = document.createElement("DIV");
|
|
var g = this.val.split(",");
|
|
var q = "";
|
|
for (var n = 0; n < h.length; n++) {
|
|
var o = false;
|
|
for (var l = 0; l < g.length; l++) {
|
|
if (h[n] == g[l]) {
|
|
o = true
|
|
}
|
|
}
|
|
if (o) {
|
|
q += "<div><input type='checkbox' id='dhx_clist_" + n + "' checked='true' /><label for='dhx_clist_" + n + "'>" + h[n] + "</label></div>"
|
|
} else {
|
|
q += "<div><input type='checkbox' id='dhx_clist_" + n + "'/><label for='dhx_clist_" + n + "'>" + h[n] + "</label></div>"
|
|
}
|
|
}
|
|
q += "<div><input type='button' value='" + (this.grid.applyButtonText || "Apply") + "' style='width:100px; font-size:8pt;' onclick='this.parentNode.parentNode.editor.grid.editStop();'/></div>";
|
|
this.obj.editor = this;
|
|
this.obj.innerHTML = q;
|
|
document.body.appendChild(this.obj);
|
|
this.obj.style.position = "absolute";
|
|
this.obj.className = "dhx_clist";
|
|
this.obj.onclick = function(r) {
|
|
(r || event).cancelBubble = true;
|
|
return true
|
|
};
|
|
var m = this.grid.getPosition(this.cell);
|
|
this.obj.style.left = m[0] + "px";
|
|
this.obj.style.top = m[1] + this.cell.offsetHeight + "px";
|
|
this.obj.getValue = function() {
|
|
var s = "";
|
|
for (var r = 0; r < this.childNodes.length - 1; r++) {
|
|
if (this.childNodes[r].childNodes[0].checked) {
|
|
if (s) {
|
|
s += ","
|
|
}
|
|
s += this.childNodes[r].childNodes[1].innerHTML
|
|
}
|
|
}
|
|
return s.replace(/&/g, "&")
|
|
}
|
|
};
|
|
this.getValue = function() {
|
|
if (this.cell._clearCell) {
|
|
return ""
|
|
}
|
|
return this.cell.innerHTML.toString()._dhx_trim().replace(/&/g, "&")
|
|
};
|
|
this.detach = function(g) {
|
|
if (this.obj) {
|
|
this.setValue(this.obj.getValue());
|
|
this.obj.editor = null;
|
|
this.obj.parentNode.removeChild(this.obj);
|
|
this.obj = null
|
|
}
|
|
return this.val != this.getValue()
|
|
}
|
|
}
|
|
eXcell_clist.prototype = new eXcell;
|
|
eXcell_clist.prototype.setValue = function(g) {
|
|
if (typeof(g) == "object") {
|
|
var c = this.grid.xmlLoader.doXPath("./option", g);
|
|
if (c.length) {
|
|
this.cell._combo = []
|
|
}
|
|
for (var a = 0; a < c.length; a++) {
|
|
this.cell._combo.push(c[a].firstChild ? c[a].firstChild.data : "")
|
|
}
|
|
g = g.firstChild.data
|
|
}
|
|
if (g === "" || g === this.undefined) {
|
|
this.setCTxtValue(" ", g);
|
|
this.cell._clearCell = true
|
|
} else {
|
|
this.setCTxtValue(g);
|
|
this.cell._clearCell = false
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.registerCList = function(a, c) {
|
|
if (!this.clists) {
|
|
this.clists = new Array()
|
|
}
|
|
if (typeof(c) != "object") {
|
|
c = c.split(",")
|
|
}
|
|
this.clists[a] = c
|
|
};
|
|
|
|
function eXcell_calck(a) {
|
|
try {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
} catch (c) {}
|
|
this.edit = function() {
|
|
this.val = this.getValue();
|
|
var g = this.grid.getPosition(this.cell);
|
|
this.obj = new calcX(g[0], g[1] + this.cell.offsetHeight, this, this.val)
|
|
};
|
|
this.getValue = function() {
|
|
return this.grid._aplNFb(this.cell.innerHTML.toString()._dhx_trim(), this.cell._cellIndex)
|
|
};
|
|
this.detach = function() {
|
|
if (this.obj) {
|
|
this.setValue(this.obj.inputZone.value);
|
|
this.obj.removeSelf()
|
|
}
|
|
this.obj = null;
|
|
return this.val != this.getValue()
|
|
}
|
|
}
|
|
eXcell_calck.prototype = new eXcell;
|
|
eXcell_calck.prototype.setValue = function(a) {
|
|
if (!a || a.toString()._dhx_trim() == "") {
|
|
a = "0"
|
|
}
|
|
this.setCValue(this.grid._aplNF(a, this.cell._cellIndex), a)
|
|
};
|
|
|
|
function calcX(left, top, onReturnSub, val) {
|
|
this.top = top || 0;
|
|
this.left = left || 0;
|
|
this.onReturnSub = onReturnSub || null;
|
|
this.operandA = 0;
|
|
this.operandB = 0;
|
|
this.operatorA = "";
|
|
this.state = 0;
|
|
this.dotState = 0;
|
|
this.calckGo = function() {
|
|
return (eval(this.operandA + "*1" + this.operatorA + this.operandB + "*1"))
|
|
};
|
|
this.isNumeric = function(str) {
|
|
return ((str.search(/[^1234567890]/gi) == -1) ? (true) : (false))
|
|
};
|
|
this.isOperation = function(str) {
|
|
return ((str.search(/[^\+\*\-\/]/gi) == -1) ? (true) : (false))
|
|
};
|
|
this.onCalcKey = function(e) {
|
|
that = this.calk;
|
|
var z = this.innerHTML;
|
|
var rZone = that.inputZone;
|
|
if (((that.state == 0) || (that.state == 2)) && (that.isNumeric(z))) {
|
|
if (rZone.value != "0") {
|
|
rZone.value += z
|
|
} else {
|
|
rZone.value = z
|
|
}
|
|
}
|
|
if ((((that.state == 0) || (that.state == 2)) && (z == ".")) && (that.dotState == 0)) {
|
|
that.dotState = 1;
|
|
rZone.value += z
|
|
}
|
|
if ((z == "C")) {
|
|
rZone.value = 0;
|
|
that.dotState = 0;
|
|
that.state = 0
|
|
}
|
|
if ((that.state == 0) && (that.isOperation(z))) {
|
|
that.operatorA = z;
|
|
that.operandA = rZone.value;
|
|
that.state = 1
|
|
}
|
|
if ((that.state == 2) && (that.isOperation(z))) {
|
|
that.operandB = rZone.value;
|
|
rZone.value = that.calckGo();
|
|
that.operatorA = z;
|
|
that.operandA = rZone.value;
|
|
that.state = 1
|
|
}
|
|
if ((that.state == 2) && (z == "=")) {
|
|
that.operandB = rZone.value;
|
|
rZone.value = that.calckGo();
|
|
that.operatorA = z;
|
|
that.operandA = rZone.value;
|
|
that.state = 3
|
|
}
|
|
if ((that.state == 1) && (that.isNumeric(z))) {
|
|
rZone.value = z;
|
|
that.state = 2;
|
|
that.dotState = 0
|
|
}
|
|
if ((that.state == 3) && (that.isNumeric(z))) {
|
|
rZone.value = z;
|
|
that.state = 0
|
|
}
|
|
if ((that.state == 3) && (that.isOperation(z))) {
|
|
that.operatorA = z;
|
|
that.operandA = rZone.value;
|
|
that.state = 1
|
|
}
|
|
if (z == "e") {
|
|
rZone.value = Math.E;
|
|
if (that.state == 1) {
|
|
that.state = 2
|
|
}
|
|
that.dotState = 0
|
|
}
|
|
if (z == "p") {
|
|
rZone.value = Math.PI;
|
|
if (that.state == 1) {
|
|
that.state = 2
|
|
}
|
|
that.dotState = 0
|
|
}
|
|
if (z == "Off") {
|
|
that.topNod.parentNode.removeChild(that.topNod)
|
|
}
|
|
if (e || event) {
|
|
(e || event).cancelBubble = true
|
|
}
|
|
};
|
|
this.sendResult = function() {
|
|
that = this.calk;
|
|
if (that.state == 2) {
|
|
var rZone = that.inputZone;
|
|
that.operandB = rZone.value;
|
|
rZone.value = that.calckGo();
|
|
that.operatorA = z;
|
|
that.operandA = rZone.value;
|
|
that.state = 3
|
|
}
|
|
var z = that.inputZone.value;
|
|
that.topNod.parentNode.removeChild(that.topNod);
|
|
that.onReturnSub.grid.editStop(false)
|
|
};
|
|
this.removeSelf = function() {
|
|
if (this.topNod.parentNode) {
|
|
this.topNod.parentNode.removeChild(this.topNod)
|
|
}
|
|
};
|
|
this.keyDown = function() {
|
|
this.className = "calcPressed"
|
|
};
|
|
this.keyUp = function() {
|
|
this.className = "calcButton"
|
|
};
|
|
this.init_table = function() {
|
|
var table = this.topNod.childNodes[0];
|
|
if ((!table) || (table.tagName != "TABLE")) {
|
|
return
|
|
}
|
|
for (i = 1; i < table.childNodes[0].childNodes.length; i++) {
|
|
for (j = 0; j < table.childNodes[0].childNodes[i].childNodes.length; j++) {
|
|
table.childNodes[0].childNodes[i].childNodes[j].onclick = this.onCalcKey;
|
|
table.childNodes[0].childNodes[i].childNodes[j].onmousedown = this.keyDown;
|
|
table.childNodes[0].childNodes[i].childNodes[j].onmouseout = this.keyUp;
|
|
table.childNodes[0].childNodes[i].childNodes[j].onmouseup = this.keyUp;
|
|
table.childNodes[0].childNodes[i].childNodes[j].calk = this
|
|
}
|
|
}
|
|
this.inputZone = this.topNod.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0];
|
|
if (this.onReturnSub) {
|
|
this.topNod.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[1].onclick = this.sendResult;
|
|
this.topNod.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[1].calk = this
|
|
} else {
|
|
this.topNod.childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[0].childNodes[1].innerHTML = ""
|
|
}
|
|
};
|
|
this.drawSelf = function() {
|
|
var div = document.createElement("div");
|
|
div.className = "calcTable";
|
|
div.style.position = "absolute";
|
|
div.style.top = this.top + "px";
|
|
div.style.left = this.left + "px";
|
|
div.innerHTML = "<table cellspacing='0' id='calc_01' class='calcTable'><tr><td colspan='4'><table cellpadding='1' cellspacing='0' width='100%'><tr><td width='100%' style='overflow:hidden;'><input style='width:100%' class='calcInput' value='0' align='right' readonly='true' style='text-align:right'></td><td class='calkSubmit'>=</td></tr></table></td></tr><tr><td class='calcButton' width='25%'>Off</td><td class='calcButton' width='25%'>p</td><td class='calcButton' width='25%'>e</td><td class='calcButton' width='25%'>/</td></tr><tr><td class='calcButton'>7</td><td class='calcButton'>8</td><td class='calcButton'>9</td><td class='calcButton'>*</td></tr><tr><td class='calcButton'>4</td><td class='calcButton'>5</td><td class='calcButton'>6</td><td class='calcButton'>+</td></tr><tr><td class='calcButton'>1</td><td class='calcButton'>2</td><td class='calcButton'>3</td><td class='calcButton'>-</td></tr><tr><td class='calcButton'>0</td><td class='calcButton'>.</td><td class='calcButton'>C</td><td class='calcButton'>=</td></tr></table>";
|
|
div.onclick = function(e) {
|
|
(e || event).cancelBubble = true
|
|
};
|
|
document.body.appendChild(div);
|
|
this.topNod = div
|
|
};
|
|
this.drawSelf();
|
|
this.init_table();
|
|
if (val) {
|
|
var rZone = this.inputZone;
|
|
rZone.value = val * 1;
|
|
this.operandA = val * 1;
|
|
this.state = 3
|
|
}
|
|
return this
|
|
}
|
|
dhtmlXGridObject.prototype._updateTGRState = function(a) {
|
|
if (!a.update || a.id == 0) {
|
|
return
|
|
}
|
|
if (this.rowsAr[a.id].imgTag) {
|
|
this.rowsAr[a.id].imgTag.src = this.iconTree + a.state + ".gif"
|
|
}
|
|
a.update = false
|
|
};
|
|
dhtmlXGridObject.prototype.doExpand = function(c) {
|
|
this.editStop();
|
|
var g = c.parentNode.parentNode.parentNode;
|
|
var a = this._h2.get[g.idd];
|
|
if (!this.callEvent("onOpen", [g.idd, (a.state == "plus" ? -1 : 1)])) {
|
|
return
|
|
}
|
|
if (a.state == "plus") {
|
|
this.expandKids(g)
|
|
} else {
|
|
if ((a.state == "minus") && (!a._closeable)) {
|
|
this.collapseKids(g)
|
|
}
|
|
}
|
|
};
|
|
|
|
function dhtmlxHierarchy() {
|
|
var a = {
|
|
id: 0,
|
|
childs: [],
|
|
level: -1,
|
|
parent: null,
|
|
index: 0,
|
|
state: dhtmlXGridObject._emptyLineImg
|
|
};
|
|
this.order = [a];
|
|
this.get = {
|
|
"0": a
|
|
};
|
|
this.swap = function(g, c) {
|
|
var h = g.parent;
|
|
var l = g.index;
|
|
h.childs[l] = c;
|
|
h.childs[c.index] = g;
|
|
g.index = c.index;
|
|
c.index = l
|
|
};
|
|
this.forEachChildF = function(n, c, l, g) {
|
|
var m = this.get[n];
|
|
for (var h = 0; h < m.childs.length; h++) {
|
|
if (!c.apply((l || this), [m.childs[h]])) {
|
|
continue
|
|
}
|
|
if (m.childs[h].childs.length) {
|
|
this.forEachChildF(m.childs[h].id, c, l, g)
|
|
}
|
|
if (g) {
|
|
g.call((l || this), m.childs[h])
|
|
}
|
|
}
|
|
};
|
|
this.forEachChild = function(m, c, h) {
|
|
var l = this.get[m];
|
|
for (var g = 0; g < l.childs.length; g++) {
|
|
c.apply((h || this), [l.childs[g]]);
|
|
if (l.childs[g].childs.length) {
|
|
this.forEachChild(l.childs[g].id, c, h)
|
|
}
|
|
}
|
|
};
|
|
this.change = function(l, c, h) {
|
|
var g = this.get[l];
|
|
if (g[c] == h) {
|
|
return
|
|
}
|
|
g[c] = h;
|
|
g.update = true
|
|
};
|
|
this.add = function(g, c) {
|
|
return this.addAfter(g, c)
|
|
};
|
|
this.addAfter = function(q, o, h, g) {
|
|
var n = this.get[o || 0];
|
|
if (h) {
|
|
var m = this.get[h].index + (g ? 0 : 1)
|
|
} else {
|
|
var m = n.childs.length
|
|
}
|
|
var c = {
|
|
id: q,
|
|
childs: [],
|
|
level: n.level + 1,
|
|
parent: n,
|
|
index: m,
|
|
state: dhtmlXGridObject._emptyLineImg
|
|
};
|
|
if (n.state == dhtmlXGridObject._emptyLineImg) {
|
|
this.change(o, "state", (o == 0 ? "minus" : "plus"))
|
|
}
|
|
if (h) {
|
|
for (var l = m; l < n.childs.length; l++) {
|
|
n.childs[l].index++
|
|
}
|
|
n.childs = n.childs.slice(0, m).concat([c]).concat(n.childs.slice(m, n.childs.length))
|
|
} else {
|
|
n.childs.push(c)
|
|
}
|
|
this.get[q] = c;
|
|
return c
|
|
};
|
|
this.addBefore = function(h, g, c) {
|
|
return this.addAfter(h, g, c, true)
|
|
};
|
|
this.remove = function(h) {
|
|
var g = this.get[h || 0];
|
|
for (var c = 0; c < g.childs.length; c++) {
|
|
this.deleteAll(g.childs[c].id)
|
|
}
|
|
g.childs = [];
|
|
g.parent.childs = g.parent.childs.slice(0, g.index).concat(g.parent.childs.slice(g.index + 1));
|
|
for (var c = g.index; c < g.parent.childs.length; c++) {
|
|
g.parent.childs[c].index--
|
|
}
|
|
delete this.get[h]
|
|
};
|
|
this.deleteAll = function(h) {
|
|
var g = this.get[h || 0];
|
|
for (var c = 0; c < g.childs.length; c++) {
|
|
this.deleteAll(g.childs[c].id)
|
|
}
|
|
g.childs = [];
|
|
delete this.get[h]
|
|
};
|
|
return this
|
|
}
|
|
dhtmlXGridObject.prototype._getOpenLenght = function(h, g) {
|
|
var c = this._h2.get[h].childs;
|
|
g += c.length;
|
|
for (var a = 0; a < c.length; a++) {
|
|
if (c[a].childs.length && c[a].state == "minus") {
|
|
g += this._getOpenLenght(c[a].id, 0)
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXGridObject.prototype.collapseKids = function(g) {
|
|
var h = this._h2.get[g.idd];
|
|
if (h.state != "minus") {
|
|
return
|
|
}
|
|
if (!this.callEvent("onOpenStart", [g.idd, 1])) {
|
|
return
|
|
}
|
|
var l = g.rowIndex;
|
|
if (l < 0) {
|
|
l = this.rowsCol._dhx_find(g) + 1
|
|
}
|
|
this._h2.change(h.id, "state", "plus");
|
|
this._updateTGRState(h);
|
|
if (this._srnd || this.pagingOn) {
|
|
this._h2_to_buff();
|
|
this._renderSort()
|
|
} else {
|
|
var a = this._getOpenLenght(this.rowsCol[l - 1].idd, 0);
|
|
for (var c = 0; c < a; c++) {
|
|
this.rowsCol[l + c].parentNode.removeChild(this.rowsCol[l + c])
|
|
}
|
|
this.rowsCol.splice(l, a)
|
|
}
|
|
this.callEvent("onGridReconstructed", []);
|
|
this.setSizes();
|
|
this._h2_to_buff();
|
|
this.callEvent("onOpenEnd", [g.idd, -1])
|
|
};
|
|
dhtmlXGridObject.prototype._massInsert = function(a, g, h, q) {
|
|
var l = [];
|
|
var o = (_isKHTML ? this.obj : this.obj.rows[0].parentNode);
|
|
this._h2_to_buff();
|
|
if (this._srnd || this.pagingOn) {
|
|
return this._renderSort()
|
|
}
|
|
var n = this._getOpenLenght(a.id, 0);
|
|
for (var m = 0; m < n; m++) {
|
|
var c = this.render_row(h + m);
|
|
if (g) {
|
|
g.parentNode.insertBefore(c, g)
|
|
} else {
|
|
o.appendChild(c)
|
|
}
|
|
l.push(c)
|
|
}
|
|
this.rowsCol = dhtmlxArray(this.rowsCol.slice(0, h).concat(l).concat(this.rowsCol.slice(h)));
|
|
return a.childs.length + l.length
|
|
};
|
|
dhtmlXGridObject.prototype.expandKids = function(c, l) {
|
|
var g = this._h2.get[c.idd];
|
|
if ((!g.childs.length) && (!g._xml_await)) {
|
|
return
|
|
}
|
|
if (g.state != "plus") {
|
|
return
|
|
}
|
|
if (!g._loading && !l) {
|
|
if (!this.callEvent("onOpenStart", [g.id, -1])) {
|
|
return
|
|
}
|
|
}
|
|
var h = this.getRowIndex(g.id) + 1;
|
|
if (g.childs.length) {
|
|
g._loading = false;
|
|
this._h2.change(g.id, "state", "minus");
|
|
this._updateTGRState(g);
|
|
var a = this._massInsert(g, this.rowsCol[h], h);
|
|
this.callEvent("onGridReconstructed", [])
|
|
} else {
|
|
if (g._xml_await) {
|
|
g._loading = true;
|
|
if (this.callEvent("onDynXLS", [g.id])) {
|
|
this.load(this.kidsXmlFile + "" + (this.kidsXmlFile.indexOf("?") != -1 ? "&" : "?") + "id=" + encodeURIComponent(g.id), this._data_type)
|
|
}
|
|
}
|
|
}
|
|
this.setSizes();
|
|
if (!g._loading) {
|
|
this.callEvent("onOpenEnd", [g.id, 1])
|
|
}
|
|
this._fixAlterCss()
|
|
};
|
|
dhtmlXGridObject.prototype.kidsXmlFile = "";
|
|
dhtmlXGridObject.prototype.sortTreeRows = function(h, l, a) {
|
|
var m = "getValue";
|
|
if (this.cells5({
|
|
parentNode: {
|
|
grid: this
|
|
}
|
|
}, this.getColType(h)).getDate) {
|
|
m = "getDate";
|
|
l = "str"
|
|
}
|
|
this.forEachRow(function(s) {
|
|
var r = this._h2.get[s];
|
|
if (!r) {
|
|
return
|
|
}
|
|
var q = this._get_cell_value(r.buff, h, m);
|
|
if (l == "int") {
|
|
r._sort = parseFloat(q);
|
|
r._sort = isNaN(r._sort) ? -99999999999999 : r._sort
|
|
} else {
|
|
r._sort = q
|
|
}
|
|
});
|
|
var g = this;
|
|
var o = 1;
|
|
var n = -1;
|
|
if (a == "des") {
|
|
o = -1;
|
|
n = 1
|
|
}
|
|
var c = null;
|
|
if (typeof l == "function") {
|
|
c = function(r, q) {
|
|
return l(r._sort, q._sort, a, r.id, q.id)
|
|
}
|
|
} else {
|
|
if (l == "cus") {
|
|
c = function(r, q) {
|
|
return g._customSorts[h](r._sort, q._sort, a, r.id, q.id)
|
|
}
|
|
}
|
|
if (l == "str") {
|
|
c = function(r, q) {
|
|
return (r._sort < q._sort ? n : (r._sort == q._sort ? 0 : o))
|
|
}
|
|
}
|
|
if (l == "int") {
|
|
c = function(r, q) {
|
|
return (r._sort < q._sort ? n : (r._sort == q._sort ? 0 : o))
|
|
}
|
|
}
|
|
if (l == "date") {
|
|
c = function(r, q) {
|
|
return (Date.parse(new Date(r._sort || "01/01/1900")) - Date.parse(new Date(q._sort || "01/01/1900"))) * o
|
|
}
|
|
}
|
|
}
|
|
this._sortTreeRows(c, 0);
|
|
this._renderSort(0, true);
|
|
this.callEvent("onGridReconstructed", [])
|
|
};
|
|
dhtmlXGridObject.prototype._sortTreeRows = function(a, h) {
|
|
var c = this._h2.get[h].childs;
|
|
if (this.rowsCol.stablesort) {
|
|
this.rowsCol.stablesort.call(c, a)
|
|
} else {
|
|
c.sort(a)
|
|
}
|
|
for (var g = 0; g < c.length; g++) {
|
|
if (c[g].childs.length) {
|
|
this._sortTreeRows(a, c[g].id)
|
|
}
|
|
c[g].index = g
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._renderSort = function(g, c) {
|
|
this._h2_to_buff();
|
|
var a = this.objBox.scrollTop;
|
|
this._reset_view();
|
|
this.objBox.scrollTop = a
|
|
};
|
|
dhtmlXGridObject.prototype._fixAlterCssTGR = function() {
|
|
if (!this._realfake) {
|
|
this._h2.forEachChild(0, function(a) {
|
|
if (a.buff.tagName == "TR") {
|
|
var c = (this._cssSP ? (a.level % 2) : (a.index % 2)) ? this._cssUnEven : this._cssEven;
|
|
this.rowsAr[a.id].className = (c + (this._cssSU ? (" " + c + "_" + a.level) : "")) + " " + (this.rowsAr[a.id]._css || "") + ((this.rowsAr[a.id].className.indexOf("rowselected") != -1) ? " rowselected" : "")
|
|
}
|
|
}, this)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.moveRowUDTG = function(c, l) {
|
|
var o = this._h2.get[c];
|
|
var g = o.parent.childs[o.index + l];
|
|
if ((!g) || (g.parent != o.parent)) {
|
|
return
|
|
}
|
|
var a = [o.state, g.state];
|
|
this.collapseKids(this.rowsAr[o.id]);
|
|
this.collapseKids(this.rowsAr[g.id]);
|
|
var h = this.rowsCol._dhx_find(this.rowsAr[c]);
|
|
var n = this.rowsBuffer._dhx_find(this.rowsAr[c]);
|
|
var q = this.obj.rows[0].parentNode.removeChild(this.rowsCol[h]);
|
|
var m = this.rowsCol[h + ((l == 1) ? 2 : l)];
|
|
if (m) {
|
|
m.parentNode.insertBefore(q, m)
|
|
} else {
|
|
this.obj.rows[0].parentNode.appendChild(q)
|
|
}
|
|
this.rowsCol._dhx_swapItems(h, h + l);
|
|
this.rowsBuffer._dhx_swapItems(n, n + l);
|
|
this._h2.swap(g, o);
|
|
if (a[0] == "minus") {
|
|
this.expandKids(this.rowsAr[o.id])
|
|
}
|
|
if (a[1] == "minus") {
|
|
this.expandKids(this.rowsAr[g.id])
|
|
}
|
|
this._fixAlterCss(Math.min(h, h + l))
|
|
};
|
|
|
|
function eXcell_tree(a) {
|
|
if (a) {
|
|
this.cell = a;
|
|
this.grid = this.cell.parentNode.grid
|
|
}
|
|
this.isDisabled = function() {
|
|
return this.cell._disabled || this.grid._edtc
|
|
};
|
|
this.edit = function() {
|
|
if ((this.er) || (this.grid._edtc)) {
|
|
return
|
|
}
|
|
this.er = this.cell.parentNode.valTag;
|
|
this.val = this.getLabel();
|
|
this.cell.atag = ((!this.grid.multiLine) && (_isKHTML || _isMacOS || _isFF)) ? "INPUT" : "TEXTAREA";
|
|
this.er.innerHTML = "<" + this.cell.atag + " class='dhx_combo_edit' type='text' style='height:" + (this.cell.offsetHeight - 4) + "px;line-height:" + (this.cell.offsetHeight - 6) + "px; width:100%; border:0px; margin:0px; padding:0px; overflow:hidden;'></" + this.cell.atag + ">";
|
|
this.er.childNodes[0].onmousedown = function(c) {
|
|
(c || event).cancelBubble = true
|
|
};
|
|
this.er.childNodes[0].onselectstart = function(c) {
|
|
if (!c) {
|
|
c = event
|
|
}
|
|
c.cancelBubble = true;
|
|
return true
|
|
};
|
|
this.er.className += " editable";
|
|
this.er.firstChild.onclick = function(c) {
|
|
(c || event).cancelBubble = true
|
|
};
|
|
this.er.firstChild.value = this.val;
|
|
this.obj = this.er.firstChild;
|
|
this.er.firstChild.style.width = Math.max(0, this.cell.offsetWidth - this.er.offsetLeft - 2) + "px";
|
|
this.er.firstChild.focus();
|
|
if (_isIE) {
|
|
this.er.firstChild.focus()
|
|
}
|
|
};
|
|
this.detach = function() {
|
|
if (!this.er) {
|
|
return
|
|
}
|
|
this.setLabel(this.er.firstChild.value);
|
|
this.er.className = this.er.className.replace("editable", "");
|
|
var c = (this.val != this.er.innerHTML);
|
|
this.obj = this.er = null;
|
|
return (c)
|
|
};
|
|
this.getValue = function() {
|
|
return this.getLabel()
|
|
};
|
|
this.setImage = function(c) {
|
|
this.cell.parentNode.imgTag.nextSibling.src = this.grid.iconURL + c;
|
|
this.grid._h2.get[this.cell.parentNode.idd].image = c
|
|
};
|
|
this.getImage = function() {
|
|
return this.grid._h2.get[this.cell.parentNode.idd].image
|
|
};
|
|
this.setLabel = function(c) {
|
|
this.setValueA(c)
|
|
};
|
|
this.getLabel = function(c) {
|
|
return this.cell.parentNode.valTag.innerHTML
|
|
}
|
|
}
|
|
eXcell_tree.prototype = new eXcell;
|
|
eXcell_tree.prototype.setValueA = function(a) {
|
|
this.cell.parentNode.valTag.innerHTML = a;
|
|
this.grid.callEvent("onCellChanged", [this.cell.parentNode.idd, this.cell._cellIndex, a])
|
|
};
|
|
eXcell_tree.prototype.setValue = function(a) {
|
|
if (this.cell.parentNode.imgTag) {
|
|
return this.setLabel(a)
|
|
}
|
|
if ((this.grid._tgc.iconTree == null) || (this.grid._tgc.iconTree != this.grid.iconTree)) {
|
|
var l = {};
|
|
l.spacer = "<img src='" + this.grid.iconTree + "blank.gif' align='top' class='space'>";
|
|
l.imst = "<img style='margin-top:-2px;' src='" + this.grid.iconTree;
|
|
l.imsti = "<img style='padding-top:2px;' src='" + (this.grid.iconURL || this.grid.iconTree);
|
|
l.imact = "' align='top' onclick='this." + (_isKHTML ? "" : "parentNode.") + "parentNode.parentNode.parentNode.parentNode.grid.doExpand(this);event.cancelBubble=true;'>";
|
|
l.plus = l.imst + "plus.gif" + l.imact;
|
|
l.minus = l.imst + "minus.gif" + l.imact;
|
|
l.blank = l.imst + "blank.gif" + l.imact;
|
|
l.start = "<div class='treegrid_cell' style='overflow:hidden; white-space : nowrap; line-height:23px; height:" + (_isIE ? 21 : 23) + "px;'>";
|
|
l.itemim = "' align='top' " + (this.grid._img_height ? (' height="' + this.grid._img_height + '"') : "") + (this.grid._img_width ? (' width="' + this.grid._img_width + '"') : "") + " ><span id='nodeval'>";
|
|
l.close = "</span></div>";
|
|
this.grid._tgc = l
|
|
}
|
|
var m = this.grid._h2;
|
|
var l = this.grid._tgc;
|
|
var h = this.cell.parentNode.idd;
|
|
var n = this.grid._h2.get[h];
|
|
if (this.grid.kidsXmlFile || this.grid._slowParse) {
|
|
n.has_kids = (n.has_kids || (this.cell.parentNode._attrs.xmlkids && (n.state != "minus")));
|
|
n._xml_await = !! n.has_kids
|
|
}
|
|
n.image = n.image || (this.cell._attrs.image || "leaf.gif");
|
|
n.label = a;
|
|
var g = [l.start];
|
|
for (var c = 0; c < n.level; c++) {
|
|
g.push(l.spacer)
|
|
}
|
|
if (n.has_kids) {
|
|
g.push(l.plus);
|
|
n.state = "plus"
|
|
} else {
|
|
g.push(l.imst + n.state + ".gif" + l.imact)
|
|
}
|
|
g.push(l.imsti);
|
|
g.push(n.image);
|
|
g.push(l.itemim);
|
|
g.push(n.label);
|
|
g.push(l.close);
|
|
this.cell.innerHTML = g.join("");
|
|
this.cell._treeCell = true;
|
|
this.cell.parentNode.imgTag = this.cell.childNodes[0].childNodes[n.level];
|
|
this.cell.parentNode.valTag = this.cell.childNodes[0].childNodes[n.level + 2];
|
|
if (_isKHTML) {
|
|
this.cell.vAlign = "top"
|
|
}
|
|
if (n.parent.id != 0 && n.parent.state == "plus") {
|
|
this.grid._updateTGRState(n.parent, false);
|
|
this.cell.parentNode._skipInsert = true
|
|
}
|
|
this.grid.callEvent("onCellChanged", [h, this.cell._cellIndex, a])
|
|
};
|
|
dhtmlXGridObject.prototype._process_tree_xml = function(l, n, m) {
|
|
this._parsing = true;
|
|
var g = false;
|
|
if (!n) {
|
|
this.render_row = this.render_row_tree;
|
|
g = true;
|
|
n = l.getXMLTopNode(this.xml.top);
|
|
m = n.getAttribute("parent") || 0;
|
|
if (m == "0") {
|
|
m = 0
|
|
}
|
|
if (!this._h2) {
|
|
this._h2 = new dhtmlxHierarchy()
|
|
}
|
|
if (this._fake) {
|
|
this._fake._h2 = this._h2
|
|
}
|
|
}
|
|
var q = l.doXPath(this.xml.row, n);
|
|
this._open = this._open || [];
|
|
for (var h = 0; h < q.length; h++) {
|
|
var c = q[h].getAttribute("id");
|
|
if (!c) {
|
|
c = this.uid();
|
|
q[h].setAttribute("id", c)
|
|
}
|
|
var o = this._h2.add(c, m);
|
|
o.buff = {
|
|
idd: c,
|
|
data: q[h],
|
|
_parser: this._process_xml_row,
|
|
_locator: this._get_xml_data
|
|
};
|
|
if (q[h].getAttribute("open")) {
|
|
o.state = "minus";
|
|
this._open.push(c)
|
|
}
|
|
this.rowsAr[c] = o.buff;
|
|
this._process_tree_xml(l, q[h], c)
|
|
}
|
|
if (g) {
|
|
if (!q.length) {
|
|
this._h2.change(m, "state", dhtmlXGridObject._emptyLineImg)
|
|
} else {
|
|
if (m != 0 && !this._srnd) {
|
|
this._h2.change(m, "state", "minus")
|
|
}
|
|
}
|
|
for (var h = 0; h < this._open.length; h++) {
|
|
var a = this._h2.get[this._open[h]];
|
|
if (!a.childs.length) {
|
|
a.state = dhtmlXGridObject._emptyLineImg
|
|
}
|
|
}
|
|
this._updateTGRState(this._h2.get[m]);
|
|
this._h2_to_buff();
|
|
if (m != 0 && this._srnd) {
|
|
this.openItem(m)
|
|
} else {
|
|
if (this.pagingOn) {
|
|
this._renderSort()
|
|
} else {
|
|
this.render_dataset()
|
|
}
|
|
} if (this.kidsXmlFile) {
|
|
for (var h = 0; h < this._open.length; h++) {
|
|
var a = this._h2.get[this._open[h]];
|
|
if (a._xml_await) {
|
|
this.expandKids({
|
|
idd: a.id
|
|
})
|
|
}
|
|
}
|
|
}
|
|
this._open = [];
|
|
if (this._slowParse === false) {
|
|
this.forEachRow(function(r) {
|
|
this.render_row_tree(0, r)
|
|
})
|
|
}
|
|
this._parsing = false;
|
|
if (m != 0 && !this._srnd) {
|
|
this.callEvent("onOpenEnd", [m, 1])
|
|
}
|
|
}
|
|
return l.xmlDoc.responseXML ? l.xmlDoc.responseXML : l.xmlDoc
|
|
};
|
|
dhtmlXGridObject.prototype._h2_to_buff = function(c) {
|
|
if (!c) {
|
|
c = this._h2.get[0];
|
|
this.rowsBuffer = new dhtmlxArray();
|
|
if (this._fake && !this._realfake) {
|
|
this._fake.rowsBuffer = this.rowsBuffer
|
|
}
|
|
}
|
|
for (var a = 0; a < c.childs.length; a++) {
|
|
this.rowsBuffer.push(c.childs[a].buff);
|
|
if (c.childs[a].state == "minus") {
|
|
this._h2_to_buff(c.childs[a])
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.render_row_tree = function(c, h) {
|
|
if (h) {
|
|
var a = this._h2.get[h];
|
|
a = a ? a.buff : a
|
|
} else {
|
|
var a = this.rowsBuffer[c]
|
|
} if (!a) {
|
|
return -1
|
|
}
|
|
if (a._parser) {
|
|
if (this.rowsAr[a.idd] && this.rowsAr[a.idd].tagName == "TR") {
|
|
return this._h2.get[a.idd].buff = this.rowsBuffer[c] = this.rowsAr[a.idd]
|
|
}
|
|
var g = this._prepareRow(a.idd);
|
|
this.rowsAr[a.idd] = g;
|
|
if (!h) {
|
|
this.rowsBuffer[c] = g
|
|
}
|
|
this._h2.get[a.idd].buff = g;
|
|
a._parser.call(this, g, a.data);
|
|
this._postRowProcessing(g);
|
|
return g
|
|
}
|
|
return a
|
|
};
|
|
dhtmlXGridObject.prototype._removeTrGrRow = function(h, c) {
|
|
if (c) {
|
|
this._h2.forEachChild(c.id, function(m) {
|
|
this._removeTrGrRow(null, m);
|
|
delete this.rowsAr[m.id]
|
|
}, this);
|
|
return
|
|
}
|
|
var l = this.getRowIndex(h.idd);
|
|
var c = this._h2.get[h.idd];
|
|
if (l != -1 && l !== this.undefined) {
|
|
var a = 1;
|
|
if (c && c.state == "minus") {
|
|
a += this._getOpenLenght(c.id, 0)
|
|
}
|
|
for (var g = 0; g < a; g++) {
|
|
if (this.rowsCol[g + l]) {
|
|
this.rowsCol[g + l].parentNode.removeChild(this.rowsCol[g + l])
|
|
}
|
|
}
|
|
if (this._fake) {
|
|
for (var g = 0; g < a; g++) {
|
|
if (this._fake.rowsCol[g + l]) {
|
|
this._fake.rowsCol[g + l].parentNode.removeChild(this._fake.rowsCol[g + l])
|
|
}
|
|
}
|
|
if (a > 1) {
|
|
this._fake.rowsCol.splice(l + 1, a - 1)
|
|
}
|
|
}
|
|
this.rowsCol.splice(l, a);
|
|
this.rowsBuffer.splice(l, a)
|
|
}
|
|
if (!c) {
|
|
return
|
|
}
|
|
this._removeTrGrRow(null, c);
|
|
delete this.rowsAr[c.id];
|
|
if (c.parent.childs.length == 1) {
|
|
this._h2.change(c.parent.id, "state", dhtmlXGridObject._emptyLineImg);
|
|
this._updateTGRState(c.parent)
|
|
}
|
|
this._h2.remove(c.id)
|
|
};
|
|
dhtmlXGridObject.prototype.openItem = function(c) {
|
|
var g = this._h2.get[c || 0];
|
|
var a = this.getRowById(c || 0);
|
|
if (!a) {
|
|
return
|
|
}
|
|
if (g.parent && g.parent.id != 0) {
|
|
this.openItem(g.parent.id)
|
|
}
|
|
this.expandKids(a)
|
|
};
|
|
dhtmlXGridObject.prototype._addRowClassic = dhtmlXGridObject.prototype.addRow;
|
|
dhtmlXGridObject.prototype.addRow = function(c, n, l, h, a, o) {
|
|
if (!this._h2) {
|
|
return this._addRowClassic(c, n, l)
|
|
}
|
|
h = h || 0;
|
|
var g = this.cellType._dhx_find("tree");
|
|
if (typeof(n) == "string") {
|
|
n = n.split(this.delim)
|
|
}
|
|
var m = this._h2.get[c];
|
|
if (!m) {
|
|
if (h == 0) {
|
|
l = this.rowsBuffer.length
|
|
} else {
|
|
l = this.getRowIndex(h) + 1;
|
|
if (this._h2.get[h].state == "minus") {
|
|
l += this._getOpenLenght(h, 0)
|
|
} else {
|
|
this._skipInsert = true
|
|
}
|
|
}
|
|
}
|
|
m = m || this._h2.add(c, h);
|
|
m.image = a;
|
|
m.has_kids = o;
|
|
return m.buff = this._addRowClassic(c, n, l)
|
|
};
|
|
dhtmlXGridObject.prototype.addRowBefore = function(g, m, h, c, o) {
|
|
var n = this.rowsAr[h];
|
|
if (!n) {
|
|
return
|
|
}
|
|
if (!this._h2) {
|
|
return this.addRow(g, m, this.getRowIndex(h))
|
|
}
|
|
var a = this._h2.get[h].parent.id;
|
|
var l = this.getRowIndex(h);
|
|
if (l == -1) {
|
|
this._skipInsert = true
|
|
}
|
|
this._h2.addBefore(g, a, h);
|
|
return this.addRow(g, m, l, this._h2.get[h].parent.id, c, o)
|
|
};
|
|
dhtmlXGridObject.prototype.addRowAfter = function(g, m, h, c, o) {
|
|
var n = this.rowsAr[h];
|
|
if (!n) {
|
|
return
|
|
}
|
|
if (!this._h2) {
|
|
return this.addRow(g, m, this.getRowIndex(h) + 1)
|
|
}
|
|
var a = this._h2.get[h].parent.id;
|
|
var l = this.getRowIndex(h);
|
|
if (l == -1) {
|
|
this._skipInsert = true
|
|
}
|
|
if (this._h2.get[h].state == "minus") {
|
|
l += this._getOpenLenght(h, 0) + 1
|
|
} else {
|
|
l++
|
|
}
|
|
this._h2.addAfter(g, a, h);
|
|
return this.addRow(g, m, l, a, c, o)
|
|
};
|
|
dhtmlXGridObject.prototype.enableSmartXMLParsing = function(a) {
|
|
this._slowParse = convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype._copyTreeGridRowContent = function(a, c, g) {
|
|
var h = this.cellType._dhx_find("tree");
|
|
for (i = 0; i < a.cells.length; i++) {
|
|
if (i != h) {
|
|
this.cells(g, i).setValue(this.cells(c, i).getValue())
|
|
} else {
|
|
this.cells(g, i).setValueA(this.cells(c, i).getValue())
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.closeItem = function(c) {
|
|
var a = this.getRowById(c);
|
|
if (!a) {
|
|
return
|
|
}
|
|
this.collapseKids(a)
|
|
};
|
|
dhtmlXGridObject.prototype.deleteChildItems = function(a) {
|
|
var c = this._h2.get[a];
|
|
if (!c) {
|
|
return
|
|
}
|
|
while (c.childs.length) {
|
|
this.deleteRow(c.childs[0].id)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.getAllSubItems = function(c) {
|
|
var h = [];
|
|
var g = this._h2.get[c || 0];
|
|
if (g) {
|
|
for (var a = 0; a < g.childs.length; a++) {
|
|
h.push(g.childs[a].id);
|
|
if (g.childs[a].childs.length) {
|
|
h = h.concat(this.getAllSubItems(g.childs[a].id).split(this.delim))
|
|
}
|
|
}
|
|
}
|
|
return h.join(this.delim)
|
|
};
|
|
dhtmlXGridObject.prototype.getChildItemIdByIndex = function(c, a) {
|
|
var g = this._h2.get[c || 0];
|
|
if (!g) {
|
|
return null
|
|
}
|
|
return (g.childs[a] ? g.childs[a].id : null)
|
|
};
|
|
dhtmlXGridObject.prototype.getItemText = function(a) {
|
|
return this.cells(a, this.cellType._dhx_find("tree")).getLabel()
|
|
};
|
|
dhtmlXGridObject.prototype.getOpenState = function(a) {
|
|
var c = this._h2.get[a || 0];
|
|
if (!c) {
|
|
return
|
|
}
|
|
if (c.state == "minus") {
|
|
return true
|
|
}
|
|
return false
|
|
};
|
|
dhtmlXGridObject.prototype.getParentId = function(a) {
|
|
var c = this._h2.get[a || 0];
|
|
if ((!c) || (!c.parent)) {
|
|
return null
|
|
}
|
|
return c.parent.id
|
|
};
|
|
dhtmlXGridObject.prototype.getSubItems = function(c) {
|
|
var h = [];
|
|
var g = this._h2.get[c || 0];
|
|
if (g) {
|
|
for (var a = 0; a < g.childs.length; a++) {
|
|
h.push(g.childs[a].id)
|
|
}
|
|
}
|
|
return h.join(this.delim)
|
|
};
|
|
dhtmlXGridObject.prototype.expandAll = function(a) {
|
|
this._renderAllExpand(a || 0);
|
|
this._h2_to_buff();
|
|
this._reset_view();
|
|
this.setSizes();
|
|
this.callEvent("onGridReconstructed", []);
|
|
if (this._redrawLines) {
|
|
this._redrawLines()
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._renderAllExpand = function(g) {
|
|
var a = this._h2.get[g].childs;
|
|
for (var c = 0; c < a.length; c++) {
|
|
if (a[c].childs.length) {
|
|
this._h2.change(a[c].id, "state", "minus");
|
|
this._updateTGRState(a[c]);
|
|
this._renderAllExpand(a[c].id)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.collapseAll = function(a) {
|
|
this._h2.forEachChild((a || 0), function(c) {
|
|
if (c && c.state == "minus") {
|
|
c.state = "plus";
|
|
c.update = true;
|
|
this._updateTGRState(c)
|
|
}
|
|
}, this);
|
|
this._h2_to_buff();
|
|
this._reset_view();
|
|
this.setSizes();
|
|
this.callEvent("onGridReconstructed", []);
|
|
if (this._redrawLines) {
|
|
this._redrawLines()
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.hasChildren = function(c) {
|
|
var a = this._h2.get[c];
|
|
if (a && a.childs.length) {
|
|
return a.childs.length
|
|
}
|
|
if (a._xml_await) {
|
|
return -1
|
|
}
|
|
return 0
|
|
};
|
|
dhtmlXGridObject.prototype.setItemCloseable = function(g, c) {
|
|
var a = this._h2.get[g];
|
|
if (!a) {
|
|
return
|
|
}
|
|
a._closeable = (!convertStringToBoolean(c))
|
|
};
|
|
dhtmlXGridObject.prototype.setItemText = function(a, c) {
|
|
return this.cells(a, this.cellType._dhx_find("tree")).setLabel(c)
|
|
};
|
|
dhtmlXGridObject.prototype.setItemImage = function(c, a) {
|
|
this._h2.get[c].image = a;
|
|
this.rowsAr[c].imgTag.nextSibling.src = (this.iconURL || "") + a
|
|
};
|
|
dhtmlXGridObject.prototype.getItemImage = function(a) {
|
|
this.getRowById(a);
|
|
return this._h2.get[a].image
|
|
};
|
|
dhtmlXGridObject.prototype.setImageSize = function(c, a) {
|
|
this._img_width = c;
|
|
this._img_height = a
|
|
};
|
|
dhtmlXGridObject.prototype._getRowImage = function(a) {
|
|
return this._h2.get[a.idd].image
|
|
};
|
|
dhtmlXGridObject.prototype.setOnOpenStartHandler = function(a) {
|
|
this.attachEvent("onOpenStart", a)
|
|
};
|
|
dhtmlXGridObject.prototype.setOnOpenEndHandler = function(a) {
|
|
this.attachEvent("onOpenEnd", a)
|
|
};
|
|
dhtmlXGridObject.prototype.enableTreeCellEdit = function(a) {
|
|
this._edtc = !convertStringToBoolean(a)
|
|
};
|
|
dhtmlXGridObject.prototype.getLevel = function(a) {
|
|
var c = this._h2.get[a || 0];
|
|
if (!c) {
|
|
return -1
|
|
}
|
|
return c.level
|
|
};
|
|
dhtmlXGridObject.prototype._fixHiddenRowsAllTG = function(c, a) {
|
|
for (i in this.rowsAr) {
|
|
if ((this.rowsAr[i]) && (this.rowsAr[i].childNodes)) {
|
|
this.rowsAr[i].childNodes[c].style.display = a
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject._emptyLineImg = "blank";
|
|
dhtmlXGridObject.prototype._updateLine = function(g, c) {
|
|
c = c || this.rowsAr[g.id];
|
|
if (!c) {
|
|
return
|
|
}
|
|
var a = c.imgTag;
|
|
if (!a) {
|
|
return
|
|
}
|
|
if (g.state == "blank") {
|
|
return a.src = this.iconTree + "blank.gif"
|
|
}
|
|
var h = 1;
|
|
if (g.index == 0) {
|
|
if (g.level == 0) {
|
|
if ((g.parent.childs.length - 1) > g.index) {
|
|
h = 3
|
|
} else {
|
|
h = 1
|
|
}
|
|
} else {
|
|
if ((g.parent.childs.length - 1) > g.index) {
|
|
h = 3
|
|
} else {
|
|
h = 2
|
|
}
|
|
}
|
|
} else {
|
|
if ((g.parent.childs.length - 1) > g.index) {
|
|
h = 3
|
|
} else {
|
|
h = 2
|
|
}
|
|
}
|
|
a.src = this.iconTree + g.state + h + ".gif"
|
|
};
|
|
dhtmlXGridObject.prototype._updateParentLine = function(h, g) {
|
|
g = g || this.rowsAr[h.id];
|
|
if (!g) {
|
|
return
|
|
}
|
|
var a = g.imgTag;
|
|
if (!a) {
|
|
return
|
|
}
|
|
for (var c = h.level; c > 0; c--) {
|
|
if (h.id == 0) {
|
|
break
|
|
}
|
|
a = a.previousSibling;
|
|
h = h.parent;
|
|
if ((h.parent.childs.length - 1) > h.index) {
|
|
a.src = this.iconTree + "line1.gif"
|
|
} else {
|
|
a.src = this.iconTree + "blank.gif"
|
|
}
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._renderSortA = dhtmlXGridObject.prototype._renderSort;
|
|
dhtmlXGridObject.prototype._renderSort = function() {
|
|
this._renderSortA.apply(this, arguments);
|
|
this._redrawLines(0)
|
|
};
|
|
dhtmlXGridObject.prototype._redrawLines = function(a) {
|
|
if (this._tgle) {
|
|
this._h2.forEachChild((a || 0), function(c) {
|
|
this._updateLine(c);
|
|
this._updateParentLine(c)
|
|
}, this)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.enableTreeGridLines = function() {
|
|
dhtmlXGridObject._emptyLineImg = "line";
|
|
this._updateTGRState = function(c, a) {
|
|
if (a || !c.update || c.id == 0) {
|
|
return
|
|
}
|
|
if (this._tgle) {
|
|
this._updateLine(c, this.rowsAr[c.id])
|
|
}
|
|
c.update = false
|
|
};
|
|
this._tgle = true;
|
|
this.attachEvent("onXLE", function(g, c, h) {
|
|
this._redrawLines(h)
|
|
});
|
|
this.attachEvent("onOpenEnd", function(a) {
|
|
this._redrawLines(a)
|
|
});
|
|
this.attachEvent("onRowAdded", function(c) {
|
|
var a = this._h2.get[c];
|
|
this._updateLine(a);
|
|
this._updateParentLine(a);
|
|
if (a.index < (a.parent.childs.length - 1)) {
|
|
a = a.parent.childs[a.index + 1];
|
|
this._updateLine(a);
|
|
this._updateParentLine(a)
|
|
} else {
|
|
if (a.index != 0) {
|
|
a = a.parent.childs[a.index - 1];
|
|
this._updateLine(a);
|
|
this._updateParentLine(a);
|
|
if (a.childs.length) {
|
|
this._h2.forEachChild(a.id, function(g) {
|
|
this._updateParentLine(g)
|
|
}, this)
|
|
}
|
|
}
|
|
}
|
|
});
|
|
this.attachEvent("onOpen", function(h, c) {
|
|
if (c) {
|
|
var g = this._h2.get[h];
|
|
for (var a = 0; a < g.childs.length; a++) {
|
|
this._updateParentLine(g.childs[a])
|
|
}
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onBeforeRowDeleted", function(h) {
|
|
var c = this;
|
|
var g = this._h2.get[h];
|
|
var a = null;
|
|
if (g.index != 0) {
|
|
a = g.parent.childs[g.index - 1]
|
|
}
|
|
g = g.parent;
|
|
window.setTimeout(function() {
|
|
g = c._h2.get[g.id];
|
|
if (!g) {
|
|
return
|
|
}
|
|
c._updateLine(g);
|
|
c._updateParentLine(g);
|
|
if (a) {
|
|
c._updateLine(a);
|
|
if (a.state == "minus") {
|
|
c._h2.forEachChild(a.id, function(l) {
|
|
c._updateParentLine(l)
|
|
}, c)
|
|
}
|
|
}
|
|
}, 1);
|
|
return true
|
|
})
|
|
};
|
|
dhtmlXGridObject.prototype.setFiltrationLevel = function(g, a, c) {
|
|
this._tr_strfltr = g;
|
|
this._tr_fltr_c = a;
|
|
this._tr_fltr_d = c;
|
|
this.refreshFilters()
|
|
};
|
|
dhtmlXGridObject.prototype.filterTreeBy = function(h, l, g) {
|
|
var a = this._h2;
|
|
if (typeof this._tr_strfltr == "undefined") {
|
|
this._tr_strfltr = -1
|
|
}
|
|
if (this._f_rowsBuffer) {
|
|
if (!g) {
|
|
this._h2 = this._f_rowsBuffer;
|
|
if (this._fake) {
|
|
this._fake._h2 = this._h2
|
|
}
|
|
}
|
|
} else {
|
|
this._f_rowsBuffer = this._h2
|
|
}
|
|
var m = true;
|
|
this.dma(true);
|
|
this._fbf = {};
|
|
if (typeof(h) == "object") {
|
|
for (var c = 0; c < l.length; c++) {
|
|
this._filterTreeA(h[c], l[c])
|
|
}
|
|
} else {
|
|
this._filterTreeA(h, l)
|
|
}
|
|
this._fbf = null;
|
|
this.dma(false);
|
|
this._fix_filtered_images(this._h2, a);
|
|
this._renderSort();
|
|
this.callEvent("onGridReconstructed", [])
|
|
};
|
|
dhtmlXGridObject.prototype._filterTreeA = function(g, q) {
|
|
if (q == "") {
|
|
return
|
|
}
|
|
var n = true;
|
|
if (typeof(q) == "function") {
|
|
n = false
|
|
} else {
|
|
q = (q || "").toString().toLowerCase()
|
|
}
|
|
var c = function(w, v, u) {
|
|
var x = u.get[w.parent.id];
|
|
if (!x) {
|
|
x = c(w.parent, v, u)
|
|
}
|
|
var u = r.get[w.id];
|
|
if (!u) {
|
|
u = {
|
|
id: w.id,
|
|
childs: [],
|
|
level: w.level,
|
|
parent: x,
|
|
index: x.childs.length,
|
|
image: w.image,
|
|
state: w.state,
|
|
buff: w.buff,
|
|
has_kids: w.has_kids,
|
|
_xml_await: w._xml_await
|
|
};
|
|
x.childs.push(u);
|
|
r.get[u.id] = u
|
|
}
|
|
return u
|
|
};
|
|
var o = this._fbf;
|
|
var r = new dhtmlxHierarchy();
|
|
var a;
|
|
var l = this._tr_strfltr;
|
|
var m = this;
|
|
var h = function(u) {
|
|
for (var s = 0; s < u.childs.length; s++) {
|
|
m.temp(u.childs[s])
|
|
}
|
|
};
|
|
switch (l.toString()) {
|
|
case "-2":
|
|
a = function(s) {
|
|
if (o[s.id]) {
|
|
return false
|
|
}
|
|
h(s);
|
|
return true
|
|
};
|
|
break;
|
|
case "-1":
|
|
a = function(s) {
|
|
return !s.childs.length
|
|
};
|
|
break;
|
|
default:
|
|
a = function(s) {
|
|
return l == s.level
|
|
};
|
|
break
|
|
}
|
|
this.temp = function(s) {
|
|
if (s.id != 0 && a(s)) {
|
|
if (n ? (this._get_cell_value(s.buff, g).toString().toLowerCase().indexOf(q) == -1) : (!q(this._get_cell_value(s.buff, g), s.id))) {
|
|
o[s.id] = true;
|
|
if (this._tr_fltr_c) {
|
|
c(s.parent, this._h2, r)
|
|
}
|
|
return false
|
|
} else {
|
|
c(s, this._h2, r);
|
|
if (s.childs && l != -2) {
|
|
this._h2.forEachChild(s.id, function(u) {
|
|
c(u, this._h2, r)
|
|
}, this)
|
|
}
|
|
return true
|
|
}
|
|
} else {
|
|
if (this._tr_fltr_d && this._tr_strfltr > s.level && s.id != 0) {
|
|
c(s, this._h2, r)
|
|
}
|
|
h(s)
|
|
}
|
|
};
|
|
this.temp(this._h2.get[0]);
|
|
this._h2 = r;
|
|
if (this._fake) {
|
|
this._fake._h2 = this._h2
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._fix_filtered_images = function(c, a) {
|
|
c.forEachChild(0, function(g) {
|
|
if (!g.childs.length && !g.has_kids) {
|
|
if (g.state != dhtmlXGridObject._emptyLineImg) {
|
|
g.state = dhtmlXGridObject._emptyLineImg;
|
|
g.update = true;
|
|
this._updateTGRState(g)
|
|
}
|
|
} else {
|
|
if (g.buff.tagName == "TR") {
|
|
var h = a.get[g.id];
|
|
if (h && h.state != dhtmlXGridObject._emptyLineImg) {
|
|
g.state = h.state
|
|
}
|
|
g.update = true;
|
|
this._updateTGRState(g)
|
|
}
|
|
}
|
|
}, this)
|
|
};
|
|
dhtmlXGridObject.prototype.collectTreeValues = function(g) {
|
|
if (typeof this._tr_strfltr == "undefined") {
|
|
this._tr_strfltr = -1
|
|
}
|
|
this.dma(true);
|
|
this._build_m_order();
|
|
g = this._m_order ? this._m_order[g] : g;
|
|
var n = {};
|
|
var l = [];
|
|
var a = this._f_rowsBuffer || this._h2;
|
|
a.forEachChild(0, function(c) {
|
|
if (this._tr_strfltr == -2 || (this._tr_strfltr == -1 && !c.childs.length) || (this._tr_strfltr == c.level)) {
|
|
var o = this._get_cell_value(c.buff, g);
|
|
if (o) {
|
|
n[o] = true
|
|
}
|
|
}
|
|
}, this);
|
|
this.dma(false);
|
|
var h = this.combos[g];
|
|
for (var m in n) {
|
|
if (n[m] === true) {
|
|
l.push(h ? (h.get(m) || m) : m)
|
|
}
|
|
}
|
|
return l.sort()
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_total = function(g, a, l) {
|
|
var h = function() {
|
|
var m = 0;
|
|
this._build_m_order();
|
|
var c = this._m_order ? this._m_order[a] : a;
|
|
this._h2.forEachChild(0, function(o) {
|
|
var n = parseFloat(this._get_cell_value((o.buff || this.rowsAr[o.id]), c));
|
|
m += isNaN(n) ? 0 : n
|
|
}, this);
|
|
return this._maskArr[a] ? this._aplNF(m, a) : (Math.round(m * 100) / 100)
|
|
};
|
|
this._stat_in_header(g, h, a, l, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_total_leaf = function(g, a, l) {
|
|
var h = function() {
|
|
var m = 0;
|
|
this._build_m_order();
|
|
var c = this._m_order ? this._m_order[a] : a;
|
|
this._h2.forEachChild(0, function(o) {
|
|
if (o.childs.length) {
|
|
return
|
|
}
|
|
var n = parseFloat(this._get_cell_value((o.buff || this.rowsAr[o.id]), c));
|
|
m += isNaN(n) ? 0 : n
|
|
}, this);
|
|
return this._maskArr[a] ? this._aplNF(m, a) : (Math.round(m * 100) / 100)
|
|
};
|
|
this._stat_in_header(g, h, a, l, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_multi_total = function(g, a, m) {
|
|
var l = m[1].split(":");
|
|
m[1] = "";
|
|
var h = function() {
|
|
var c = 0;
|
|
this._h2.forEachChild(0, function(o) {
|
|
var n = parseFloat(this._get_cell_value((o.buff || this.rowsAr[o.id]), l[0])) * parseFloat(this._get_cell_value((o.buff || this.rowsAr[o.id]), l[1]));
|
|
c += isNaN(n) ? 0 : n
|
|
}, this);
|
|
return this._maskArr[a] ? this._aplNF(c, a) : (Math.round(c * 100) / 100)
|
|
};
|
|
this._stat_in_header(g, h, a, m, m)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_multi_total_leaf = function(g, a, m) {
|
|
var l = m[1].split(":");
|
|
m[1] = "";
|
|
var h = function() {
|
|
var c = 0;
|
|
this._h2.forEachChild(0, function(o) {
|
|
if (o.childs.length) {
|
|
return
|
|
}
|
|
var n = parseFloat(this._get_cell_value((o.buff || this.rowsAr[o.id]), l[0])) * parseFloat(this._get_cell_value((o.buff || this.rowsAr[o.id]), l[1]));
|
|
c += isNaN(n) ? 0 : n
|
|
}, this);
|
|
return this._maskArr[a] ? this._aplNF(c, a) : (Math.round(c * 100) / 100)
|
|
};
|
|
this._stat_in_header(g, h, a, m, m)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_max = function(g, a, l) {
|
|
var h = function() {
|
|
var m = -999999999;
|
|
this._build_m_order();
|
|
var c = this._m_order ? this._m_order[a] : a;
|
|
if (this.getRowsNum() == 0) {
|
|
return ""
|
|
}
|
|
this._h2.forEachChild(0, function(n) {
|
|
var o = parseFloat(this._get_cell_value((n.buff || this.rowsAr[n.id]), c));
|
|
if (!isNaN(o)) {
|
|
m = Math.max(m, o)
|
|
}
|
|
}, this);
|
|
return this._maskArr[a] ? this._aplNF(m, a) : m
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_min = function(g, a, l) {
|
|
var h = function() {
|
|
var m = 999999999;
|
|
this._build_m_order();
|
|
var c = this._m_order ? this._m_order[a] : a;
|
|
if (this.getRowsNum() == 0) {
|
|
return ""
|
|
}
|
|
this._h2.forEachChild(0, function(n) {
|
|
var o = parseFloat(this._get_cell_value((n.buff || this.rowsAr[n.id]), c));
|
|
if (!isNaN(o)) {
|
|
m = Math.min(m, o)
|
|
}
|
|
}, this);
|
|
return this._maskArr[a] ? this._aplNF(m, a) : m
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_average = function(g, a, l) {
|
|
var h = function() {
|
|
var n = 0;
|
|
var m = 0;
|
|
this._build_m_order();
|
|
var c = this._m_order ? this._m_order[a] : a;
|
|
this._h2.forEachChild(0, function(q) {
|
|
var o = parseFloat(this._get_cell_value((q.buff || this.rowsAr[q.id]), c));
|
|
n += isNaN(o) ? 0 : o;
|
|
m++
|
|
}, this);
|
|
return this._maskArr[a] ? this._aplNF(n, a) : (Math.round(n / m * 100) / 100)
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_max_leaf = function(g, a, l) {
|
|
var h = function() {
|
|
var m = -999999999;
|
|
this._build_m_order();
|
|
var c = this._m_order ? this._m_order[a] : a;
|
|
if (this.getRowsNum() == 0) {
|
|
return ""
|
|
}
|
|
this._h2.forEachChild(0, function(n) {
|
|
if (n.childs.length) {
|
|
return
|
|
}
|
|
var o = parseFloat(this._get_cell_value((n.buff || this.rowsAr[n.id]), c));
|
|
if (!isNaN(o)) {
|
|
m = Math.max(m, o)
|
|
}
|
|
}, this);
|
|
return this._maskArr[a] ? this._aplNF(m, a) : m
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_min_leaf = function(g, a, l) {
|
|
var h = function() {
|
|
var m = 999999999;
|
|
this._build_m_order();
|
|
var c = this._m_order ? this._m_order[a] : a;
|
|
if (this.getRowsNum() == 0) {
|
|
return ""
|
|
}
|
|
this._h2.forEachChild(0, function(n) {
|
|
if (n.childs.length) {
|
|
return
|
|
}
|
|
var o = parseFloat(this._get_cell_value((n.buff || this.rowsAr[n.id]), c));
|
|
if (!isNaN(o)) {
|
|
m = Math.min(m, o)
|
|
}
|
|
}, this);
|
|
return this._maskArr[a] ? this._aplNF(m, a) : m
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_average_leaf = function(g, a, l) {
|
|
var h = function() {
|
|
var n = 0;
|
|
var m = 0;
|
|
this._build_m_order();
|
|
var c = this._m_order ? this._m_order[a] : a;
|
|
this._h2.forEachChild(0, function(q) {
|
|
if (q.childs.length) {
|
|
return
|
|
}
|
|
var o = parseFloat(this._get_cell_value((q.buff || this.rowsAr[q.id]), c));
|
|
n += isNaN(o) ? 0 : o;
|
|
m++
|
|
}, this);
|
|
return this._maskArr[a] ? this._aplNF(n, a) : (Math.round(n / m * 100) / 100)
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_count = function(g, a, l) {
|
|
var h = function() {
|
|
var c = 0;
|
|
this._h2.forEachChild(0, function(m) {
|
|
c++
|
|
}, this);
|
|
return c
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._in_header_stat_tree_count_leaf = function(g, a, l) {
|
|
var h = function() {
|
|
var c = 0;
|
|
this._h2.forEachChild(0, function(m) {
|
|
if (!m.childs.length) {
|
|
c++
|
|
}
|
|
}, this);
|
|
return c
|
|
};
|
|
this._stat_in_header(g, h, a, l)
|
|
};
|
|
dhtmlXGridObject.prototype._stat_in_header = function(g, h, a, n) {
|
|
var l = this;
|
|
var m = function() {
|
|
this.dma(true);
|
|
g.innerHTML = (n[0] ? n[0] : "") + h.call(this) + (n[1] ? n[1] : "");
|
|
this.dma(false);
|
|
this.callEvent("onStatReady", [])
|
|
};
|
|
if (!this._stat_events) {
|
|
this._stat_events = [];
|
|
this.attachEvent("onClearAll", function() {
|
|
if (!this.hdr.rows[1]) {
|
|
for (var o = 0; o < this._stat_events.length; o++) {
|
|
for (var c = 0; c < 4; c++) {
|
|
this.detachEvent(this._stat_events[o][c])
|
|
}
|
|
}
|
|
this._stat_events = []
|
|
}
|
|
})
|
|
}
|
|
this._stat_events.push([this.attachEvent("onGridReconstructed", m), this.attachEvent("onXLE", m), this.attachEvent("onFilterEnd", m), this.attachEvent("onEditCell", function(c, q, o) {
|
|
if (c == 2 && o == a) {
|
|
m.call(this)
|
|
}
|
|
return true
|
|
})]);
|
|
g.innerHTML = ""
|
|
};
|
|
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
|
|
}
|
|
}
|
|
};
|
|
|
|
function dhtmlXForm(l, h, m) {
|
|
this.idef = {
|
|
position: "label-left",
|
|
labelWidth: "auto",
|
|
labelHeight: "auto",
|
|
inputWidth: "auto",
|
|
inputHeight: "auto",
|
|
labelAlign: "left",
|
|
noteWidth: "auto",
|
|
offsetTop: 0,
|
|
offsetLeft: 0,
|
|
blockOffset: 20
|
|
};
|
|
this.idef_const = {
|
|
offsetNested: 20
|
|
};
|
|
this.apos_css = {
|
|
"label-left": "dhxform_item_label_left",
|
|
"label-right": "dhxform_item_label_right",
|
|
"label-top": "dhxform_item_label_top",
|
|
"label-bottom": "dhxform_item_label_bottom",
|
|
absolute: "dhxform_item_absolute"
|
|
};
|
|
this.align_css = {
|
|
left: "dhxform_label_align_left",
|
|
center: "dhxform_label_align_center",
|
|
right: "dhxform_label_align_right"
|
|
};
|
|
var g = this;
|
|
this.setSkin = function(a) {
|
|
this.skin = a;
|
|
this.cont.className = "dhxform_obj_" + this.skin;
|
|
this.cont.style.fontSize = (a == "dhx_terrace" ? "13px" : "12px");
|
|
this._updateBlocks();
|
|
this.forEachItem(function(o) {
|
|
var n = g.getItemType(o);
|
|
if (typeof(g.items[n]) != "undefined" && typeof(g.items[n].setSkin) == "function") {
|
|
g.doWithItem(o, "setSkin", a)
|
|
}
|
|
})
|
|
};
|
|
this.skin = (m || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhx_form") || "dhx_skyblue");
|
|
this.separator = ",";
|
|
this.live_validate = false;
|
|
this._type = "checkbox";
|
|
this._rGroup = "default";
|
|
this._idIndex = {};
|
|
this._indexId = [];
|
|
this.cont = (typeof(l) == "object" ? l : document.getElementById(l));
|
|
if (!l._isNestedForm) {
|
|
this._parentForm = true;
|
|
this.cont.style.fontSize = (this.skin == "dhx_terrace" ? "13px" : "12px");
|
|
this.cont.className = "dhxform_obj_" + this.skin;
|
|
this.setFontSize = function(a) {
|
|
this.cont.style.fontSize = a;
|
|
this._updateBlocks()
|
|
};
|
|
this.getForm = function() {
|
|
return this
|
|
};
|
|
this.cont.onkeypress = function(n) {
|
|
n = (n || event);
|
|
if (n.keyCode == 13) {
|
|
var a = (n.target || n.srcElement);
|
|
if (typeof(a.tagName) != "undefined" && String(a.tagName).toLowerCase() == "textarea" && !n.ctrlKey) {
|
|
return
|
|
}
|
|
g.callEvent("onEnter", [])
|
|
}
|
|
}
|
|
}
|
|
this.b_index = null;
|
|
this.base = [];
|
|
this._prepare = function(v, x) {
|
|
if (this.b_index == null) {
|
|
this.b_index = 0
|
|
} else {
|
|
this.b_index++
|
|
}
|
|
var o = null;
|
|
var n = null;
|
|
if (x != null) {
|
|
if (x < 0) {
|
|
x = 0
|
|
}
|
|
var s = 0;
|
|
for (var a = 0; a < this.cont.childNodes.length; a++) {
|
|
for (var u = 0; u < this.cont.childNodes[a].childNodes.length; u++) {
|
|
if (n == null && this.cont.childNodes[a].childNodes[u]._isNestedForm != true) {
|
|
if (s == x) {
|
|
o = this.cont.childNodes[a].nextSibling;
|
|
n = this.cont.childNodes[a].childNodes[u]
|
|
}
|
|
s++
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.base[this.b_index] = document.createElement("DIV");
|
|
this.base[this.b_index].className = "dhxform_base";
|
|
if (typeof(v) != "undefined") {
|
|
this.base[this.b_index].style.cssText += " margin-left:" + v + "px!important;"
|
|
}
|
|
if (o != null) {
|
|
this.cont.insertBefore(this.base[this.b_index], o);
|
|
o = null
|
|
} else {
|
|
this.cont.appendChild(this.base[this.b_index])
|
|
} if (n != null) {
|
|
while (n != null) {
|
|
var r = n;
|
|
n = n.nextSibling;
|
|
this.base[this.b_index].appendChild(r);
|
|
r = null
|
|
}
|
|
}
|
|
};
|
|
this.setSizes = function() {};
|
|
this._mergeSettings = function(v) {
|
|
var o = -1;
|
|
var r = {
|
|
type: "settings"
|
|
};
|
|
for (var n in this.idef) {
|
|
r[n] = this.idef[n]
|
|
}
|
|
for (var s = 0; s < v.length; s++) {
|
|
if (typeof(v[s]) != "undefined" && v[s].type == "settings") {
|
|
for (var n in v[s]) {
|
|
r[n] = v[s][n]
|
|
}
|
|
o = s
|
|
}
|
|
}
|
|
v[o >= 0 ? o : v.length] = r;
|
|
return v
|
|
};
|
|
this._genStr = function(a) {
|
|
var n = "";
|
|
var r = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
for (var o = 0; o < a; o++) {
|
|
n += r.charAt(Math.floor(Math.random() * r.length))
|
|
}
|
|
return n
|
|
};
|
|
this.idPrefix = "dhxForm_" + this._genStr(12) + "_";
|
|
this._rId = (this._parentForm ? this._genStr(12) + "_" : l._rId);
|
|
this.objPull = {};
|
|
this.itemPull = {};
|
|
this._ic = 0;
|
|
this._addItem = function(F, s, y, v, D, H, C) {
|
|
if (this.items[F]._index) {
|
|
this.getForm()._indexId.push(s);
|
|
this.getForm()._idIndex[s] = {
|
|
ind: this.getForm()._indexId.length - 1
|
|
}
|
|
}
|
|
if (!F) {
|
|
F = this._type
|
|
}
|
|
if (F == "list" && D != null && this.itemPull[this.idPrefix + D] != null && typeof(this.itemPull[this.idPrefix + D]._addSubListNode) == "function") {
|
|
var E = this.itemPull[this.idPrefix + D]._addSubListNode()
|
|
} else {
|
|
if (F == "newcolumn") {
|
|
var E = {}
|
|
} else {
|
|
var u = this.base[this.b_index];
|
|
var n = null;
|
|
if (typeof(H) != "undefined" && !isNaN(H) && F != "list") {
|
|
H = Math.max(parseInt(H), 0) + 1;
|
|
for (var J = 0; J < this.cont.childNodes.length; J++) {
|
|
for (var o = 0; o < this.cont.childNodes[J].childNodes.length; o++) {
|
|
if (n == null && this.cont.childNodes[J].childNodes[o]._isNestedForm != true) {
|
|
H--;
|
|
if (H == 0) {
|
|
n = this.cont.childNodes[J].childNodes[o];
|
|
u = this.cont.childNodes[J]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (F == "list") {
|
|
for (var I in this.itemPull) {
|
|
if (I == this.idPrefix + s) {
|
|
n = this.itemPull[I].nextSibling;
|
|
if (this.itemPull[I]._listBase != null && this.itemPull[I]._listBase.length > 0) {
|
|
n = this.itemPull[I]._listBase[this.itemPull[I]._listBase.length - 1]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var E = document.createElement("DIV");
|
|
if (C == true && n != null) {
|
|
n = n.nextSibling
|
|
}
|
|
if (n != null) {
|
|
u.insertBefore(E, n)
|
|
} else {
|
|
u.appendChild(E)
|
|
}
|
|
}
|
|
}
|
|
E._idd = s;
|
|
E._rId = this._rId;
|
|
if (typeof(E.style) != "undefined") {
|
|
if (typeof(y.offsetLeft) == "undefined" && this.idef.offsetLeft > 0) {
|
|
y.offsetLeft = this.idef.offsetLeft
|
|
}
|
|
if (typeof(y.offsetTop) == "undefined" && this.idef.offsetTop > 0) {
|
|
y.offsetTop = this.idef.offsetTop
|
|
}
|
|
var x = "";
|
|
if (typeof(y.offsetLeft) != "undefined") {
|
|
x += " padding-left:" + y.offsetLeft + "px!important;"
|
|
}
|
|
if (typeof(y.offsetTop) != "undefined") {
|
|
x += " padding-top:" + y.offsetTop + "px!important;"
|
|
}
|
|
E.style.cssText += x
|
|
}
|
|
if (F == "block") {
|
|
if (isNaN(y.blockOffset)) {
|
|
y.blockOffset = this.idef.blockOffset
|
|
}
|
|
}
|
|
if (F == "list") {
|
|
if (typeof(E._ofsNested) == "undefined") {
|
|
E._ofsNested = this.idef_const.offsetNested
|
|
}
|
|
if (v != null) {
|
|
E._sId = v
|
|
}
|
|
var A = this.items[F].render(E, this.skin);
|
|
if (!this.itemPull[this.idPrefix + s]._listObj) {
|
|
this.itemPull[this.idPrefix + s]._listObj = []
|
|
}
|
|
if (!this.itemPull[this.idPrefix + s]._list) {
|
|
this.itemPull[this.idPrefix + s]._list = []
|
|
}
|
|
if (!this.itemPull[this.idPrefix + s]._listBase) {
|
|
this.itemPull[this.idPrefix + s]._listBase = []
|
|
}(this.itemPull[this.idPrefix + s]._listObj).push(A[0]);
|
|
(this.itemPull[this.idPrefix + s]._list).push(A[1]);
|
|
(this.itemPull[this.idPrefix + s]._listBase).push(E);
|
|
A[1].checkEvent = function(a) {
|
|
return g.checkEvent(a)
|
|
};
|
|
A[1].callEvent = function(a, q) {
|
|
return g.callEvent(a, q)
|
|
};
|
|
A[1].getForm = function() {
|
|
return g.getForm()
|
|
};
|
|
A[1]._initObj(this._mergeSettings(y));
|
|
if (E._inBlcok) {
|
|
E.className += " in_block"
|
|
}
|
|
return A[1]
|
|
}
|
|
if (F == "newcolumn") {
|
|
this._prepare(y.offset, H);
|
|
return
|
|
}
|
|
if (F == "label" && this._ic++ == 0) {
|
|
y._isTopmost = true
|
|
}
|
|
y.position = this.apos_css[(!y.position || !this.apos_css[y.position] ? this.idef.position : y.position)];
|
|
E.className = y.position + (typeof(y.className) == "string" ? " " + y.className : "");
|
|
if (!y.labelWidth) {
|
|
y.labelWidth = this.idef.labelWidth
|
|
}
|
|
if (!y.labelHeight) {
|
|
y.labelHeight = this.idef.labelHeight
|
|
}
|
|
if (typeof(y.wrap) != "undefined") {
|
|
y.wrap = window.dhx4.s2b(y.wrap)
|
|
}
|
|
y.labelAlign = (this.align_css[y.labelAlign] ? this.align_css[y.labelAlign] : this.align_css[this.idef.labelAlign]);
|
|
y.inputWidth = (y.width ? y.width : (y.inputWidth ? y.inputWidth : this.idef.inputWidth));
|
|
if (!y.inputHeight) {
|
|
y.inputHeight = this.idef.inputHeight
|
|
}
|
|
if (typeof(y.note) != "undefined") {
|
|
if (y.note.length != null && y.note[0] != null) {
|
|
y.note = y.note[0]
|
|
}
|
|
if (typeof(y.note.width) == "undefined") {
|
|
y.note.width = this.idef.noteWidth
|
|
}
|
|
if (y.note.width == "auto") {
|
|
y.note.width = y.inputWidth
|
|
}
|
|
}
|
|
E.checkEvent = function(a) {
|
|
return g.checkEvent(a)
|
|
};
|
|
E.callEvent = function(a, q) {
|
|
return g.callEvent(a, q)
|
|
};
|
|
E.getForm = function() {
|
|
return g.getForm()
|
|
};
|
|
E._autoCheck = function(a) {
|
|
g._autoCheck(a)
|
|
};
|
|
if (typeof(y.readonly) == "string") {
|
|
y.readonly = window.dhx4.s2b(y.readonly)
|
|
}
|
|
if (typeof(y.autoStart) == "string") {
|
|
y.autoStart = window.dhx4.s2b(y.autoStart)
|
|
}
|
|
if (typeof(y.autoRemove) == "string") {
|
|
y.autoRemove = window.dhx4.s2b(y.autoRemove)
|
|
}
|
|
if (typeof(y.titleScreen) == "string") {
|
|
y.titleScreen = window.dhx4.s2b(y.titleScreen)
|
|
}
|
|
if (typeof(y.info) == "string") {
|
|
y.info = window.dhx4.s2b(y.info)
|
|
}
|
|
if (typeof(y.hidden) == "string") {
|
|
y.hidden = window.dhx4.s2b(y.hidden)
|
|
}
|
|
if (typeof(y.checked) == "string") {
|
|
y.checked = window.dhx4.s2b(y.checked)
|
|
}
|
|
if (typeof(y.userdata) != "undefined") {
|
|
for (var I in y.userdata) {
|
|
this.getForm().setUserData(s, I, y.userdata[I])
|
|
}
|
|
}
|
|
if (y.validate) {
|
|
if (typeof(y.validate != "undefined") && (typeof(y.validate) == "function" || typeof(window[y.validate]) == "function")) {
|
|
E._validate = [y.validate]
|
|
} else {
|
|
E._validate = String(y.validate).split(this.separator)
|
|
}
|
|
}
|
|
if (typeof(y.required) != "undefined") {
|
|
if (typeof(y.required) == "string") {
|
|
y.required = window.dhx4.s2b(y.required)
|
|
}
|
|
E._required = (y.required == true)
|
|
}
|
|
if (E._required) {
|
|
if (!E._validate) {
|
|
E._validate = []
|
|
}
|
|
var r = false;
|
|
for (o = 0; o < E._validate.length; o++) {
|
|
r = (r || (E._validate[o] == "NotEmpty"))
|
|
}
|
|
if (!r) {
|
|
E._validate.push("NotEmpty")
|
|
}
|
|
}
|
|
E._ll = (y.position == this.apos_css["label-left"] || y.position == this.apos_css["label-top"]);
|
|
this.objPull[this.idPrefix + s] = this.items[F].render(E, y);
|
|
this.itemPull[this.idPrefix + s] = E
|
|
};
|
|
this._initObj = function(s, o) {
|
|
if (typeof(s.data) != "undefined") {
|
|
var u = null;
|
|
if (typeof(o) != "undefined") {
|
|
u = o.match(/(\?|\&)id\=([a-z0-9_\-]*)/i);
|
|
if (u != null && u[0] != null) {
|
|
u = u[0].split("=")[1]
|
|
}
|
|
}
|
|
if (this.callEvent("onBeforeDataLoad", [u, window.dhx4._copyObj(s.data)]) === true) {
|
|
this.formId = u;
|
|
this._last_load_data = s;
|
|
this.setFormData(s.data);
|
|
this.resetDataProcessor("updated")
|
|
}
|
|
return
|
|
}
|
|
this._prepare();
|
|
for (var r = 0; r < s.length; r++) {
|
|
if (typeof(s[r]) != "undefined" && s[r].type == "settings") {
|
|
for (var n in s[r]) {
|
|
this.idef[n] = s[r][n]
|
|
}
|
|
}
|
|
}
|
|
for (var r = 0; r < s.length; r++) {
|
|
this._prepareItem(s[r])
|
|
}
|
|
this._autoCheck()
|
|
};
|
|
this._prepareItem = function(r, v, q) {
|
|
var o = (r != null && r.type != null ? r.type : "");
|
|
if (this.items[o]) {
|
|
if (!r.name) {
|
|
r.name = this._genStr(12)
|
|
}
|
|
var u = r.name;
|
|
if (this.objPull[this.idPrefix + u] != null || o == "radio") {
|
|
u = this._genStr(12)
|
|
}
|
|
var s = r;
|
|
s.label = s.label || "";
|
|
s.value = s.value;
|
|
s.checked = window.dhx4.s2b(s.checked);
|
|
s.disabled = window.dhx4.s2b(s.disabled);
|
|
s.name = s.name || this._genStr(12);
|
|
s.options = s.options || [];
|
|
s.rows = s.rows || "none";
|
|
s.uid = this._genStr(12);
|
|
this._addItem(o, u, s, null, null, v, q);
|
|
v = null;
|
|
if (this._parentEnabled === false) {
|
|
this._disableItem(u)
|
|
}
|
|
for (var n = 0; n < s.options.length; n++) {
|
|
if (s.options[n].list != null) {
|
|
if (!s.options[n].value) {
|
|
s.options[n].value = this._genStr()
|
|
}
|
|
var a = this._addItem("list", u, s.options[n].list, s.options[n].value, null);
|
|
a._subSelect = true;
|
|
a._subSelectId = s.options[n].value
|
|
}
|
|
}
|
|
if (r.list != null) {
|
|
if (!r.listParent) {
|
|
r.listParent = s.name
|
|
}
|
|
var a = this._addItem("list", u, r.list, null, r.listParent)
|
|
}
|
|
}
|
|
};
|
|
this._xmlSubItems = {
|
|
item: "list",
|
|
option: "options",
|
|
note: "note",
|
|
userdata: "_userdata"
|
|
};
|
|
this._xmlToObject = function(C, n) {
|
|
if (typeof(n) == "undefined") {
|
|
n = true
|
|
}
|
|
if (n) {
|
|
var E = C.getElementsByTagName("items");
|
|
E = (E != null && E[0] != null ? E[0] : null);
|
|
var o = C.getElementsByTagName("data");
|
|
o = (o != null && o[0] != null ? o[0] : null)
|
|
} else {
|
|
E = C
|
|
}
|
|
var A = (n ? [] : {});
|
|
if (E != null) {
|
|
for (var s = 0; s < E.childNodes.length; s++) {
|
|
if (typeof(E.childNodes[s].tagName) != "undefined") {
|
|
var u = E.childNodes[s].tagName;
|
|
if (this._xmlSubItems[u] != null) {
|
|
var v = this._xmlSubItems[u];
|
|
if (typeof(A[v]) == "undefined") {
|
|
A[v] = []
|
|
}
|
|
var y = {};
|
|
for (var J = 0; J < E.childNodes[s].attributes.length; J++) {
|
|
var F = E.childNodes[s].attributes[J].name;
|
|
var D = E.childNodes[s].attributes[J].value;
|
|
y[F] = D
|
|
}
|
|
if (v == "note") {
|
|
y.text = E.childNodes[s].firstChild.nodeValue
|
|
}
|
|
if (v == "_userdata") {
|
|
y.value = E.childNodes[s].firstChild.nodeValue
|
|
}
|
|
var x = this._xmlToObject(E.childNodes[s], false);
|
|
for (var H in x) {
|
|
if (H == "_userdata") {
|
|
if (!y.userdata) {
|
|
y.userdata = {}
|
|
}
|
|
for (var J = 0; J < x[H].length; J++) {
|
|
y.userdata[x[H][J].name] = x[H][J].value
|
|
}
|
|
} else {
|
|
y[H] = x[H]
|
|
}
|
|
}
|
|
if (n) {
|
|
A.push(y)
|
|
} else {
|
|
A[v].push(y)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (o != null) {
|
|
A = {
|
|
data: {}
|
|
};
|
|
for (var s = 0; s < o.childNodes.length; s++) {
|
|
if (typeof(o.childNodes[s].tagName) != "undefined") {
|
|
var r = o.childNodes[s].tagName;
|
|
var I = (o.childNodes[s].firstChild != null ? o.childNodes[s].firstChild.nodeValue : "");
|
|
A.data[r] = I
|
|
}
|
|
}
|
|
}
|
|
return A
|
|
};
|
|
this._autoCheck = function(u) {
|
|
if (this._locked === true) {
|
|
u = false
|
|
} else {
|
|
if (typeof(u) == "undefined") {
|
|
u = true
|
|
}
|
|
}
|
|
for (var r in this.itemPull) {
|
|
var x = (u && (this.itemPull[r]._udis !== true));
|
|
this[x ? "_enableItem" : "_disableItem"](this.itemPull[r]._idd);
|
|
if (this.getForm()._idIndex[this.itemPull[r]._idd] != null) {
|
|
this.getForm()._idIndex[this.itemPull[r]._idd].enabled = x
|
|
}
|
|
var o = (x && (typeof(this.itemPull[r]._checked) == "boolean" ? this.itemPull[r]._checked : true));
|
|
if (this.itemPull[r]._list) {
|
|
for (var A = 0; A < this.itemPull[r]._list.length; A++) {
|
|
var y = true;
|
|
if (this.itemPull[r]._list[A]._subSelect == true) {
|
|
y = false;
|
|
var s = this.getItemValue(this.itemPull[r]._idd);
|
|
if (!(typeof(s) == "object" && typeof(s.length) == "number")) {
|
|
s = [s]
|
|
}
|
|
for (var n = 0; n < s.length; n++) {
|
|
y = (s[n] == this.itemPull[r]._list[A]._subSelectId) || y
|
|
}
|
|
this.itemPull[r]._listObj[A][y ? "show" : "hide"](this.itemPull[r]._listBase[A])
|
|
}
|
|
this.itemPull[r]._list[A]._autoCheck(o && y)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.doWithItem = function(r, n, y, x, w, v) {
|
|
if (typeof(r) == "object") {
|
|
var C = r[0];
|
|
var A = r[1];
|
|
var D = null;
|
|
var u = null;
|
|
for (var s in this.itemPull) {
|
|
if ((this.itemPull[s]._value == A || A === null) && this.itemPull[s]._group == C) {
|
|
return this.objPull[s][n](this.itemPull[s], y, x, w, v)
|
|
}
|
|
if (this.itemPull[s]._list != null && !u) {
|
|
for (var o = 0; o < this.itemPull[s]._list.length; o++) {
|
|
u = this.itemPull[s]._list[o].doWithItem(r, n, y, x, w)
|
|
}
|
|
}
|
|
}
|
|
if (u != null) {
|
|
return u
|
|
} else {
|
|
if (n == "getType") {
|
|
return this.doWithItem(r[0], "getType")
|
|
}
|
|
}
|
|
} else {
|
|
if (!this.itemPull[this.idPrefix + r]) {
|
|
var u = null;
|
|
for (var s in this.itemPull) {
|
|
if (this.itemPull[s]._list && !u) {
|
|
for (var o = 0; o < this.itemPull[s]._list.length; o++) {
|
|
if (u == null) {
|
|
u = this.itemPull[s]._list[o].doWithItem(r, n, y, x, w, v)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return u
|
|
} else {
|
|
return this.objPull[this.idPrefix + r][n](this.itemPull[this.idPrefix + r], y, x, w, v)
|
|
}
|
|
}
|
|
};
|
|
this._removeItem = function(n, a) {
|
|
if (a != null) {
|
|
n = this.doWithItem([n, a], "destruct")
|
|
} else {
|
|
this.doWithItem(n, "destruct")
|
|
}
|
|
this._clearItemData(n)
|
|
};
|
|
this._clearItemData = function(r) {
|
|
if (this.itemPull[this.idPrefix + r]) {
|
|
r = this.idPrefix + r;
|
|
try {
|
|
this.objPull[r] = null;
|
|
this.itemPull[r] = null;
|
|
delete this.objPull[r];
|
|
delete this.itemPull[r]
|
|
} catch (o) {}
|
|
} else {
|
|
for (var a in this.itemPull) {
|
|
if (this.itemPull[a]._list) {
|
|
for (var n = 0; n < this.itemPull[a]._list.length; n++) {
|
|
this.itemPull[a]._list[n]._clearItemData(r)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.isItem = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
return this.doWithItem(n, "isExist")
|
|
};
|
|
this.getItemType = function(n, a) {
|
|
n = [n, (a || null)];
|
|
return this.doWithItem(n, "getType")
|
|
};
|
|
this.forEachItem = function(o) {
|
|
for (var n in this.objPull) {
|
|
if (this.objPull[n].t == "radio") {
|
|
o(this.itemPull[n]._group, this.itemPull[n]._value)
|
|
} else {
|
|
o(String(n).replace(this.idPrefix, ""))
|
|
} if (this.itemPull[n]._list) {
|
|
for (var r = 0; r < this.itemPull[n]._list.length; r++) {
|
|
this.itemPull[n]._list[r].forEachItem(o)
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.setItemLabel = function(o, a, n) {
|
|
if (n != null) {
|
|
o = [o, a]
|
|
} else {
|
|
n = a
|
|
}
|
|
this.doWithItem(o, "setText", n)
|
|
};
|
|
this.getItemLabel = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
return this.doWithItem(n, "getText")
|
|
};
|
|
this._enableItem = function(a) {
|
|
this.doWithItem(a, "enable")
|
|
};
|
|
this._disableItem = function(a) {
|
|
this.doWithItem(a, "disable")
|
|
};
|
|
this._isItemEnabled = function(a) {
|
|
return this.doWithItem(a, "isEnabled")
|
|
};
|
|
this.checkItem = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
this.doWithItem(n, "check");
|
|
this._autoCheck()
|
|
};
|
|
this.uncheckItem = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
this.doWithItem(n, "unCheck");
|
|
this._autoCheck()
|
|
};
|
|
this.isItemChecked = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
return this.doWithItem(n, "isChecked")
|
|
};
|
|
this.getCheckedValue = function(a) {
|
|
return this.doWithItem([a, null], "getChecked")
|
|
};
|
|
this._getRGroup = function(v, u) {
|
|
for (var n in this.itemPull) {
|
|
if (this.itemPull[n]._group == v && (u == null || this.itemPull[n]._value == u)) {
|
|
return this.itemPull[n]._idd
|
|
}
|
|
if (this.itemPull[n]._list != null) {
|
|
for (var s = 0; s < this.itemPull[n]._list.length; s++) {
|
|
var o = this.itemPull[n]._list[s]._getRGroup(v, u);
|
|
if (o != null) {
|
|
return o
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null
|
|
};
|
|
this.setItemValue = function(n, a) {
|
|
if (this.getItemType(n) == "radio") {
|
|
if (this._getRGroup(n, a) != null) {
|
|
this.checkItem(n, a)
|
|
} else {
|
|
this.uncheckItem(n, this.getCheckedValue(n))
|
|
}
|
|
return null
|
|
}
|
|
return this.doWithItem(n, "setValue", a)
|
|
};
|
|
this.getItemValue = function(n, a) {
|
|
if (this.getItemType(n) == "radio") {
|
|
return this.getCheckedValue(n)
|
|
}
|
|
return this.doWithItem(n, "getValue", a)
|
|
};
|
|
this.updateValues = function() {
|
|
this._updateValues()
|
|
};
|
|
this.showItem = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
this.doWithItem(n, "show")
|
|
};
|
|
this.hideItem = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
this.doWithItem(n, "hide")
|
|
};
|
|
this.isItemHidden = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
return this.doWithItem(n, "isHidden")
|
|
};
|
|
this.getOptions = function(a) {
|
|
return this.doWithItem(a, "getOptions")
|
|
};
|
|
this.setItemWidth = function(n, a) {
|
|
this.doWithItem(n, "setWidth", a)
|
|
};
|
|
this.getItemWidth = function(a) {
|
|
return this.doWithItem(a, "getWidth")
|
|
};
|
|
this.setItemHeight = function(n, a) {
|
|
this.doWithItem(n, "setHeight", a)
|
|
};
|
|
this.setItemFocus = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
this.doWithItem(n, "setFocus")
|
|
};
|
|
this._updateValues = function() {
|
|
for (var n in this.itemPull) {
|
|
if (this.objPull[n] && typeof(this.objPull[n].updateValue) == "function") {
|
|
this.objPull[n].updateValue(this.itemPull[n])
|
|
}
|
|
if (this.itemPull[n]._list) {
|
|
for (var o = 0; o < this.itemPull[n]._list.length; o++) {
|
|
this.itemPull[n]._list[o]._updateValues()
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this._getItemByName = function(u) {
|
|
for (var n in this.itemPull) {
|
|
if (this.itemPull[n]._idd == u) {
|
|
return this.itemPull[n]
|
|
}
|
|
if (this.itemPull[n]._list != null) {
|
|
for (var s = 0; s < this.itemPull[n]._list.length; s++) {
|
|
var o = this.itemPull[n]._list[s]._getItemByName(u);
|
|
if (o != null) {
|
|
return o
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null
|
|
};
|
|
this._resetValidateCss = function(a) {
|
|
a.className = (a.className).replace(a._vcss, "");
|
|
a._vcss = null
|
|
};
|
|
this.setValidateCss = function(a, q, o) {
|
|
var n = this[this.getItemType(a) == "radio" ? "_getRGroup" : "_getItemByName"](a);
|
|
if (!n) {
|
|
return
|
|
}
|
|
if (n._vcss != null) {
|
|
this._resetValidateCss(n)
|
|
}
|
|
n._vcss = (typeof(o) == "string" ? o : "validate_" + (q === true ? "ok" : "error"));
|
|
n.className += " " + n._vcss
|
|
};
|
|
this.resetValidateCss = function(o) {
|
|
for (var n in this.itemPull) {
|
|
if (this.itemPull[n]._vcss != null) {
|
|
this._resetValidateCss(this.itemPull[n])
|
|
}
|
|
if (this.itemPull[n]._list != null) {
|
|
for (var r = 0; r < this.itemPull[n]._list.length; r++) {
|
|
this.itemPull[n]._list[r].resetValidateCss()
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.validate = function(n) {
|
|
if (this.callEvent("onBeforeValidate", []) == false) {
|
|
return
|
|
}
|
|
var a = true;
|
|
this.forEachItem(function(q, r) {
|
|
if (typeof(r) != "undefined") {
|
|
q = [q, r]
|
|
}
|
|
var o = g.doWithItem(q, "_validate");
|
|
if (typeof(o) != "boolean") {
|
|
o = true
|
|
}
|
|
a = o && a
|
|
});
|
|
this.callEvent("onAfterValidate", [a]);
|
|
return a
|
|
};
|
|
this.validateItem = function(a, n) {
|
|
if (typeof(n) != "undefined") {
|
|
a = [a, n]
|
|
}
|
|
return this.doWithItem(a, "_validate")
|
|
};
|
|
this.enableLiveValidation = function(a) {
|
|
this.live_validate = (a == true)
|
|
};
|
|
this.setReadonly = function(n, a) {
|
|
this.doWithItem(n, "setReadonly", a)
|
|
};
|
|
this.isReadonly = function(a) {
|
|
return this.doWithItem(a, "isReadonly")
|
|
};
|
|
this.getFirstActive = function(n) {
|
|
for (var r = 0; r < this._indexId.length; r++) {
|
|
var a = true;
|
|
if (n == true) {
|
|
var o = this.getItemType(this._indexId[r]);
|
|
if (!dhtmlXForm.prototype.items[o].setFocus) {
|
|
a = false
|
|
}
|
|
}
|
|
if (a && this._idIndex[this._indexId[r]].enabled) {
|
|
return this._indexId[r]
|
|
}
|
|
}
|
|
return null
|
|
};
|
|
this.setFocusOnFirstActive = function() {
|
|
var a = this.getFirstActive(true);
|
|
if (a != null) {
|
|
this.setItemFocus(a)
|
|
}
|
|
};
|
|
this.enableItem = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
this.doWithItem(n, "userEnable");
|
|
this._autoCheck()
|
|
};
|
|
this.disableItem = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
this.doWithItem(n, "userDisable");
|
|
this._autoCheck()
|
|
};
|
|
this.isItemEnabled = function(n, a) {
|
|
if (a != null) {
|
|
n = [n, a]
|
|
}
|
|
return this.doWithItem(n, "isUserEnabled")
|
|
};
|
|
this.clear = function() {
|
|
var n = {};
|
|
this.formId = (new Date()).valueOf();
|
|
this.resetDataProcessor("inserted");
|
|
for (var o in this.itemPull) {
|
|
var r = this.itemPull[o]._idd;
|
|
if (this.itemPull[o]._type == "ch") {
|
|
this.uncheckItem(r)
|
|
}
|
|
if (this.itemPull[o]._type in {
|
|
ta: 1,
|
|
editor: 1,
|
|
calendar: 1,
|
|
pw: 1,
|
|
hd: 1
|
|
}) {
|
|
this.setItemValue(r, "")
|
|
}
|
|
if (this.itemPull[o]._type == "combo") {
|
|
this.itemPull[o]._apiChange = true;
|
|
var w = this.getCombo(r);
|
|
w.selectOption(0);
|
|
w = null;
|
|
this.itemPull[o]._apiChange = false
|
|
}
|
|
if (this.itemPull[o]._type == "se") {
|
|
var u = this.getOptions(r);
|
|
if (u.length > 0) {
|
|
u[0].selected = true
|
|
}
|
|
}
|
|
if (this.itemPull[o]._type == "ra") {
|
|
var s = this.itemPull[o]._group;
|
|
if (!n[s]) {
|
|
this.checkItem(s, this.doWithItem(r, "_getFirstValue"));
|
|
n[s] = true
|
|
}
|
|
}
|
|
if (this.itemPull[o]._list) {
|
|
for (var v = 0; v < this.itemPull[o]._list.length; v++) {
|
|
this.itemPull[o]._list[v].clear()
|
|
}
|
|
}
|
|
if (this["setFormData_" + this.itemPull[o]._type]) {
|
|
this["setFormData_" + this.itemPull[o]._type](r, "")
|
|
}
|
|
}
|
|
n = null;
|
|
if (this._parentForm) {
|
|
this._autoCheck()
|
|
}
|
|
this.resetValidateCss()
|
|
};
|
|
this.unload = function() {
|
|
window.dhx4._enableDataLoading(this, null, null, null, "clear");
|
|
window.dhx4._eventable(this, "clear");
|
|
for (var n in this.objPull) {
|
|
this._removeItem(String(n).replace(this.idPrefix, ""))
|
|
}
|
|
if (this._ccTm) {
|
|
window.clearTimeout(this._ccTm)
|
|
}
|
|
this._formLS = null;
|
|
for (var o = 0; o < this.base.length; o++) {
|
|
while (this.base[o].childNodes.length > 0) {
|
|
this.base[o].removeChild(this.base[o].childNodes[0])
|
|
}
|
|
if (this.base[o].parentNode) {
|
|
this.base[o].parentNode.removeChild(this.base[o])
|
|
}
|
|
this.base[o] = null
|
|
}
|
|
this.base = null;
|
|
this.cont.onkeypress = null;
|
|
this.cont.className = "";
|
|
this.cont = null;
|
|
for (var n in this) {
|
|
this[n] = null
|
|
}
|
|
g = null
|
|
};
|
|
for (var c in this.items) {
|
|
this.items[c].t = c;
|
|
if (typeof(this.items[c]._index) == "undefined") {
|
|
this.items[c]._index = true
|
|
}
|
|
if (!this.items[c].show) {
|
|
this.items[c].show = function(a) {
|
|
a.style.display = "";
|
|
if (a._listObj) {
|
|
for (var n = 0; n < a._listObj.length; n++) {
|
|
a._listObj[n].show(a._listBase[n])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!this.items[c].hide) {
|
|
this.items[c].hide = function(a) {
|
|
a.style.display = "none";
|
|
if (a._listObj) {
|
|
for (var n = 0; n < a._listObj.length; n++) {
|
|
a._listObj[n].hide(a._listBase[n])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!this.items[c].isHidden) {
|
|
this.items[c].isHidden = function(a) {
|
|
return (a.style.display == "none")
|
|
}
|
|
}
|
|
if (!this.items[c].userEnable) {
|
|
this.items[c].userEnable = function(a) {
|
|
a._udis = false
|
|
}
|
|
}
|
|
if (!this.items[c].userDisable) {
|
|
this.items[c].userDisable = function(a) {
|
|
a._udis = true
|
|
}
|
|
}
|
|
if (!this.items[c].isUserEnabled) {
|
|
this.items[c].isUserEnabled = function(a) {
|
|
return (a._udis !== true)
|
|
}
|
|
}
|
|
if (!this.items[c].getType) {
|
|
this.items[c].getType = function() {
|
|
return this.t
|
|
}
|
|
}
|
|
if (!this.items[c].isExist) {
|
|
this.items[c].isExist = function() {
|
|
return true
|
|
}
|
|
}
|
|
if (!this.items[c]._validate) {
|
|
this.items[c]._validate = function(o) {
|
|
if (!o._validate || !o._enabled) {
|
|
return true
|
|
}
|
|
if (o._type == "ch") {
|
|
var w = (this.isChecked(o) ? this.getValue(o) : 0)
|
|
} else {
|
|
var w = this.getValue(o)
|
|
}
|
|
var n = true;
|
|
for (var u = 0; u < o._validate.length; u++) {
|
|
var a = "is" + o._validate[u];
|
|
if ((w == null || w.length == 0) && a != "isNotEmpty" && o._type != "container") {} else {
|
|
var s = dhtmlxValidation[a];
|
|
if (o._type == "container" && typeof(s) == "function") {
|
|
s = function() {
|
|
return true
|
|
}
|
|
}
|
|
if (typeof(s) != "function" && typeof(o._validate[u]) == "function") {
|
|
s = o._validate[u]
|
|
}
|
|
if (typeof(s) != "function" && typeof(window[o._validate[u]]) == "function") {
|
|
s = window[o._validate[u]]
|
|
}
|
|
n = ((typeof(s) == "function" ? s(w, o._idd) : new RegExp(o._validate[u]).test(w)) && n);
|
|
s = null
|
|
}
|
|
}
|
|
if (!(o.callEvent("onValidate" + (n ? "Success" : "Error"), [o._idd, w, n]) === false)) {
|
|
o.getForm().setValidateCss(o._idd, n)
|
|
}
|
|
return n
|
|
}
|
|
}
|
|
}
|
|
this._locked = false;
|
|
this._doLock = function(n) {
|
|
var a = (n === true ? true : false);
|
|
if (this._locked == a) {
|
|
return
|
|
} else {
|
|
this._locked = a
|
|
}
|
|
this._autoCheck(!this._locked)
|
|
};
|
|
this.lock = function() {
|
|
this._doLock(true)
|
|
};
|
|
this.unlock = function() {
|
|
this._doLock(false)
|
|
};
|
|
this.isLocked = function() {
|
|
return this._locked
|
|
};
|
|
this.setNumberFormat = function(q, n, a, o) {
|
|
return this.doWithItem(q, "setNumberFormat", n, a, o)
|
|
};
|
|
window.dhx4._enableDataLoading(this, "_initObj", "_xmlToObject", "items", {
|
|
struct: true,
|
|
data: true
|
|
});
|
|
window.dhx4._eventable(this);
|
|
this.attachEvent("_onButtonClick", function(a, n) {
|
|
this.callEvent("onButtonClick", [a, n])
|
|
});
|
|
this._updateBlocks = function() {
|
|
this.forEachItem(function(a) {
|
|
if (g.getItemType(a) == "block" || g.getItemType(a) == "combo") {
|
|
g.doWithItem(a, "_setCss", g.skin, g.cont.style.fontSize)
|
|
}
|
|
})
|
|
};
|
|
this._isObj = function(a) {
|
|
return (a != null && typeof(a) == "object" && typeof(a.length) == "undefined")
|
|
};
|
|
this._copyObj = function(q) {
|
|
if (this._isObj(q)) {
|
|
var o = {};
|
|
for (var n in q) {
|
|
if (typeof(q[n]) == "object" && q[n] != null) {
|
|
o[n] = this._copyObj(q[n])
|
|
} else {
|
|
o[n] = q[n]
|
|
}
|
|
}
|
|
} else {
|
|
var o = [];
|
|
for (var n = 0; n < q.length; n++) {
|
|
if (typeof(q[n]) == "object" && q[n] != null) {
|
|
o[n] = this._copyObj(q[n])
|
|
} else {
|
|
o[n] = q[n]
|
|
}
|
|
}
|
|
}
|
|
return o
|
|
};
|
|
if (h != null && typeof(h) == "object") {
|
|
this._initObj(this._copyObj(h))
|
|
}
|
|
if (this._parentForm) {
|
|
this._updateBlocks()
|
|
}
|
|
this._ccActive = false;
|
|
this._ccTm = null;
|
|
return this
|
|
}
|
|
dhtmlXForm.prototype.getInput = function(a) {
|
|
return this.doWithItem(a, "getInput")
|
|
};
|
|
dhtmlXForm.prototype.getSelect = function(a) {
|
|
return this.doWithItem(a, "getSelect")
|
|
};
|
|
dhtmlXForm.prototype.items = {};
|
|
dhtmlXForm.prototype.items.checkbox = {
|
|
render: function(a, c) {
|
|
a._type = "ch";
|
|
a._enabled = true;
|
|
a._checked = false;
|
|
a._value = (typeof(c.value) == "undefined" ? null : String(c.value));
|
|
a._ro = (c.readonly == true);
|
|
if (c._autoInputWidth !== false) {
|
|
c.inputWidth = 14
|
|
}
|
|
this.doAddLabel(a, c);
|
|
this.doAddInput(a, c, "INPUT", "TEXT", true, true, "dhxform_textarea");
|
|
a.childNodes[a._ll ? 1 : 0].className += " dhxform_img_node";
|
|
var g = document.createElement("DIV");
|
|
g.className = "dhxform_img chbx0";
|
|
a.appendChild(g);
|
|
if (!isNaN(c.inputLeft)) {
|
|
a.childNodes[a._ll ? 1 : 0].style.left = parseInt(c.inputLeft) + "px"
|
|
}
|
|
if (!isNaN(c.inputTop)) {
|
|
a.childNodes[a._ll ? 1 : 0].style.top = parseInt(c.inputTop) + "px"
|
|
}
|
|
a.childNodes[a._ll ? 1 : 0].appendChild(g);
|
|
a.childNodes[a._ll ? 1 : 0].firstChild.value = String(c.value);
|
|
a._updateImgNode = function(l, m) {
|
|
var h = l.childNodes[l._ll ? 1 : 0].lastChild;
|
|
h.className = (m ? "dhxform_actv_c" : "dhxform_img") + " " + (l._checked ? "chbx1" : "chbx0");
|
|
l = h = null
|
|
};
|
|
a._doOnFocus = function(h) {
|
|
h.getForm().callEvent("onFocus", [h._idd])
|
|
};
|
|
a._doOnBlur = function(h) {
|
|
h.getForm().callEvent("onBlur", [h._idd])
|
|
};
|
|
a._doOnKeyUpDown = function(l, h) {
|
|
this.callEvent(l, [this.childNodes[this._ll ? 0 : 1].childNodes[0], h, this._idd])
|
|
};
|
|
if (c.checked == true) {
|
|
this.check(a)
|
|
}
|
|
if (c.hidden == true) {
|
|
this.hide(a)
|
|
}
|
|
if (c.disabled == true) {
|
|
this.userDisable(a)
|
|
}
|
|
this.doAttachEvents(a);
|
|
return this
|
|
},
|
|
destruct: function(a) {
|
|
a._doOnFocus = a._doOnBlur = a._updateImgNode = null;
|
|
this.doUnloadNestedLists(a);
|
|
this.doDestruct(a)
|
|
},
|
|
doAddLabel: function(c, g) {
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhxform_label " + g.labelAlign;
|
|
if (g.wrap == true) {
|
|
a.style.whiteSpace = "normal"
|
|
}
|
|
if (c._ll) {
|
|
c.insertBefore(a, c.firstChild)
|
|
} else {
|
|
c.appendChild(a)
|
|
} if (typeof(g.tooltip) != "undefined") {
|
|
a.title = g.tooltip
|
|
}
|
|
a.innerHTML = "<div class='dhxform_label_nav_link' onfocus='if(this.parentNode.parentNode._updateImgNode)this.parentNode.parentNode._updateImgNode(this.parentNode.parentNode,true);this.parentNode.parentNode._doOnFocus(this.parentNode.parentNode);' onblur='if(this.parentNode.parentNode._updateImgNode)this.parentNode.parentNode._updateImgNode(this.parentNode.parentNode,false);this.parentNode.parentNode._doOnBlur(this.parentNode.parentNode);' onkeypress='var e=event||window.arguments[0];if(e.keyCode==32||e.charCode==32){e.cancelBubble=true;if(e.preventDefault)e.preventDefault();else e.returnValue=false;_dhxForm_doClick(this,\"mousedown\");return false;}' onkeyup='var e=event||window.arguments[0];this.parentNode.parentNode._doOnKeyUpDown(\"onKeyUp\",e);' onkeydown='var e=event||window.arguments[0];this.parentNode.parentNode._doOnKeyUpDown(\"onKeyDown\",e);' " + (window.dhx4.isIPad ? "ontouchstart='var e=event;e.preventDefault();_dhxForm_doClick(this,\"mousedown\");' " : "") + "role='link' tabindex='0'>" + g.label + (g.info ? "<span class='dhxform_info'>[?]</span>" : "") + (c._required ? "<span class='dhxform_item_required'>*</span>" : "") + "</div>";
|
|
if (!isNaN(g.labelWidth)) {
|
|
a.firstChild.style.width = parseInt(g.labelWidth) + "px"
|
|
}
|
|
if (!isNaN(g.labelHeight)) {
|
|
a.firstChild.style.height = parseInt(g.labelHeight) + "px"
|
|
}
|
|
if (!isNaN(g.labelLeft)) {
|
|
a.style.left = parseInt(g.labelLeft) + "px"
|
|
}
|
|
if (!isNaN(g.labelTop)) {
|
|
a.style.top = parseInt(g.labelTop) + "px"
|
|
}
|
|
},
|
|
doAddInput: function(y, h, c, q, r, l, m) {
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhxform_control";
|
|
if (y._ll) {
|
|
y.appendChild(a)
|
|
} else {
|
|
y.insertBefore(a, y.firstChild)
|
|
}
|
|
var x = document.createElement(c);
|
|
x.className = m;
|
|
x.name = y._idd;
|
|
x._idd = y._idd;
|
|
x.id = h.uid;
|
|
if (typeof(q) == "string") {
|
|
x.type = q
|
|
}
|
|
if (c == "INPUT" || c == "TEXTAREA") {
|
|
x.onkeyup = function(u) {
|
|
u = u || event;
|
|
y.callEvent("onKeyUp", [this, u, this._idd])
|
|
};
|
|
x.onkeydown = function(u) {
|
|
u = u || event;
|
|
y.callEvent("onKeyDown", [this, u, this._idd])
|
|
}
|
|
}
|
|
a.appendChild(x);
|
|
if (h.readonly) {
|
|
this.setReadonly(y, true)
|
|
}
|
|
if (h.hidden == true) {
|
|
this.hide(y)
|
|
}
|
|
if (h.disabled == true) {
|
|
this.userDisable(y)
|
|
}
|
|
if (r) {
|
|
if (!isNaN(h.inputLeft)) {
|
|
a.style.left = parseInt(h.inputLeft) + "px"
|
|
}
|
|
if (!isNaN(h.inputTop)) {
|
|
a.style.top = parseInt(h.inputTop) + "px"
|
|
}
|
|
}
|
|
var v = "";
|
|
var n = false;
|
|
if (l) {
|
|
if (!isNaN(h.inputWidth)) {
|
|
v += "width:" + parseInt(h.inputWidth) + "px;";
|
|
n = true
|
|
}
|
|
if (!isNaN(h.inputHeight)) {
|
|
v += "height:" + parseInt(h.inputHeight) + "px;"
|
|
}
|
|
}
|
|
if (typeof(h.style) == "string") {
|
|
v += h.style
|
|
}
|
|
x.style.cssText = v;
|
|
if (h.maxLength) {
|
|
x.setAttribute("maxLength", h.maxLength)
|
|
}
|
|
if (h.connector) {
|
|
x.setAttribute("connector", h.connector)
|
|
}
|
|
if (n && {
|
|
input: 1,
|
|
password: 1,
|
|
select: 1,
|
|
calendar: 1,
|
|
colorpicker: 1
|
|
}[this.t]) {
|
|
if (dhtmlXForm.prototype.items[this.t]._dim == null) {
|
|
var s = parseInt(x.style.width);
|
|
var g = (dhx4.isFF || dhx4.isIE ? x.offsetWidth : x.clientWidth);
|
|
dhtmlXForm.prototype.items[this.t]._dim = g - s
|
|
}
|
|
x.style.width = parseInt(x.style.width) - dhtmlXForm.prototype.items[this.t]._dim + "px"
|
|
}
|
|
if (typeof(h.note) == "object") {
|
|
var o = document.createElement("DIV");
|
|
o.className = "dhxform_note";
|
|
o.style.width = (isNaN(h.note.width) ? x.offsetWidth : parseInt(h.note.width)) + "px";
|
|
o._w = h.note.width;
|
|
o.innerHTML = h.note.text;
|
|
a.appendChild(o);
|
|
o = null
|
|
}
|
|
},
|
|
doUnloadNestedLists: function(a) {
|
|
if (!a._list) {
|
|
return
|
|
}
|
|
for (var c = 0; c < a._list.length; c++) {
|
|
a._list[c].unload();
|
|
a._list[c] = null;
|
|
a._listObj[c] = null;
|
|
a._listBase[c].parentNode.removeChild(a._listBase[c]);
|
|
a._listBase[c] = null
|
|
}
|
|
a._list = null;
|
|
a._listObj = null;
|
|
a._listBase = null
|
|
},
|
|
doDestruct: function(a) {
|
|
a.callEvent = null;
|
|
a.checkEvent = null;
|
|
a.getForm = null;
|
|
a._autoCheck = null;
|
|
a._checked = null;
|
|
a._enabled = null;
|
|
a._idd = null;
|
|
a._type = null;
|
|
a._value = null;
|
|
a._group = null;
|
|
a.onselectstart = null;
|
|
a.childNodes[a._ll ? 1 : 0].onmousedown = null;
|
|
a.childNodes[a._ll ? 1 : 0].ontouchstart = null;
|
|
a.childNodes[a._ll ? 0 : 1].onmousedown = null;
|
|
a.childNodes[a._ll ? 0 : 1].ontouchstart = null;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].onfocus = null;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].onblur = null;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].onkeypress = null;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].onkeyup = null;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].onkeydown = null;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].onmousedown = null;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].ontouchstart = null;
|
|
a.childNodes[a._ll ? 0 : 1].removeChild(a.childNodes[a._ll ? 0 : 1].childNodes[0]);
|
|
while (a.childNodes.length > 0) {
|
|
a.removeChild(a.childNodes[0])
|
|
}
|
|
a.parentNode.removeChild(a);
|
|
a = null
|
|
},
|
|
doAttachEvents: function(c) {
|
|
var a = this;
|
|
c.childNodes[c._ll ? 1 : 0][window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(h) {
|
|
h = h || event;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
}
|
|
var g = (h.target || h.srcElement);
|
|
if (!this.parentNode._enabled || this.parentNode._ro || (typeof(g.className) != "undefined" && g.className == "dhxform_note")) {
|
|
h.cancelBubble = true;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.returnValue = false
|
|
}
|
|
return false
|
|
}
|
|
a.doClick(this.parentNode)
|
|
};
|
|
c.childNodes[c._ll ? 0 : 1].childNodes[0][window.dhx4.isIPad ? "ontouchstart" : "onmousedown"] = function(h) {
|
|
h = h || event;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
}
|
|
if (!this.parentNode.parentNode._enabled) {
|
|
h.cancelBubble = true;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.returnValue = false
|
|
}
|
|
return false
|
|
}
|
|
var g = h.target || h.srcElement;
|
|
if (typeof(g.className) != "undefined" && g.className == "dhxform_info") {
|
|
this.parentNode.parentNode.callEvent("onInfo", [this.parentNode.parentNode._idd]);
|
|
h.cancelBubble = true;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.returnValue = false
|
|
}
|
|
return false
|
|
}
|
|
a.doClick(this.parentNode.parentNode)
|
|
}
|
|
},
|
|
doClick: function(a) {
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].focus();
|
|
if (!a._enabled || a._ro) {
|
|
return
|
|
}
|
|
if (a.checkEvent("onBeforeChange")) {
|
|
if (a.callEvent("onBeforeChange", [a._idd, a._value, a._checked]) !== true) {
|
|
return
|
|
}
|
|
}
|
|
this.setChecked(a, !a._checked);
|
|
a._autoCheck();
|
|
a.callEvent("onChange", [a._idd, a._value, a._checked])
|
|
},
|
|
doCheckValue: function(a) {
|
|
if (a._checked && a._enabled) {
|
|
a.childNodes[a._ll ? 1 : 0].firstChild.name = String(a._idd);
|
|
a.childNodes[a._ll ? 1 : 0].firstChild.value = this.getValue(a)
|
|
} else {
|
|
a.childNodes[a._ll ? 1 : 0].firstChild.name = "";
|
|
a.childNodes[a._ll ? 1 : 0].firstChild.value = ""
|
|
}
|
|
},
|
|
setChecked: function(a, c) {
|
|
a._checked = (c === true ? true : false);
|
|
a.childNodes[a._ll ? 1 : 0].lastChild.className = a.childNodes[a._ll ? 1 : 0].lastChild.className.replace(/chbx[0-1]{1}/gi, "") + (a._checked ? " chbx1" : " chbx0");
|
|
this.doCheckValue(a)
|
|
},
|
|
check: function(a) {
|
|
this.setChecked(a, true)
|
|
},
|
|
unCheck: function(a) {
|
|
this.setChecked(a, false)
|
|
},
|
|
isChecked: function(a) {
|
|
return a._checked
|
|
},
|
|
enable: function(a) {
|
|
if (String(a.className).search("disabled") >= 0) {
|
|
a.className = String(a.className).replace(/disabled/gi, "")
|
|
}
|
|
a._enabled = true;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].tabIndex = 0;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].removeAttribute("disabled");
|
|
this.doCheckValue(a)
|
|
},
|
|
disable: function(a) {
|
|
if (String(a.className).search("disabled") < 0) {
|
|
a.className += " disabled"
|
|
}
|
|
a._enabled = false;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].tabIndex = -1;
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].setAttribute("disabled", "true");
|
|
this.doCheckValue(a)
|
|
},
|
|
isEnabled: function(a) {
|
|
return a._enabled
|
|
},
|
|
setText: function(a, c) {
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].innerHTML = c + (a._required ? "<span class='dhxform_item_required'>*</span>" : "")
|
|
},
|
|
getText: function(a) {
|
|
return a.childNodes[a._ll ? 0 : 1].childNodes[0].innerHTML.replace(/<span class=\"dhxform_item_required\">[^<]*<\/span>/g, "")
|
|
},
|
|
setValue: function(a, c) {
|
|
this.setChecked(a, (c === true || parseInt(c) == 1 || c == "true" || a._value === c))
|
|
},
|
|
getValue: function(a, c) {
|
|
if (c == "realvalue") {
|
|
return a._value
|
|
}
|
|
return ((typeof(a._value) == "undefined" || a._value == null) ? (a._checked ? 1 : 0) : a._value)
|
|
},
|
|
setReadonly: function(a, c) {
|
|
a._ro = (c === true)
|
|
},
|
|
isReadonly: function(a) {
|
|
return a._ro
|
|
},
|
|
setFocus: function(a) {
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].focus()
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.items.radio = {
|
|
input: {},
|
|
r: {},
|
|
firstValue: {},
|
|
render: function(g, h, c) {
|
|
g._type = "ra";
|
|
g._enabled = true;
|
|
g._checked = false;
|
|
g._group = h.name;
|
|
g._value = h.value;
|
|
g._uid = c;
|
|
g._ro = (h.readonly == true);
|
|
g._rName = g._rId + g._group;
|
|
this.r[g._idd] = g;
|
|
h.inputWidth = 14;
|
|
this.doAddLabel(g, h);
|
|
this.doAddInput(g, h, "INPUT", "TEXT", true, true, "dhxform_textarea");
|
|
g.childNodes[g._ll ? 1 : 0].className += " dhxform_img_node";
|
|
var l = document.createElement("DIV");
|
|
l.className = "dhxform_img rdbt0";
|
|
g.appendChild(l);
|
|
if (!isNaN(h.inputLeft)) {
|
|
g.childNodes[g._ll ? 1 : 0].style.left = parseInt(h.inputLeft) + "px"
|
|
}
|
|
if (!isNaN(h.inputTop)) {
|
|
g.childNodes[g._ll ? 1 : 0].style.top = parseInt(h.inputTop) + "px"
|
|
}
|
|
g.childNodes[g._ll ? 1 : 0].appendChild(l);
|
|
g.childNodes[g._ll ? 1 : 0].firstChild.name = "";
|
|
g.childNodes[g._ll ? 1 : 0].firstChild.value = "";
|
|
g._updateImgNode = function(n, o) {
|
|
var m = n.childNodes[n._ll ? 1 : 0].lastChild;
|
|
m.className = (o ? "dhxform_actv_r" : "dhxform_img") + " " + (n._checked ? "rdbt1" : "rdbt0");
|
|
n = m = null
|
|
};
|
|
g._doOnFocus = function(m) {
|
|
m.getForm().callEvent("onFocus", [m._group, m._value])
|
|
};
|
|
g._doOnBlur = function(m) {
|
|
m.getForm().callEvent("onBlur", [m._group, m._value])
|
|
};
|
|
g._doOnKeyUpDown = function(n, m) {
|
|
this.callEvent(n, [this.childNodes[this._ll ? 0 : 1].childNodes[0], m, this._group, this._value])
|
|
};
|
|
if (this.input[g._rName] == null) {
|
|
var a = document.createElement("INPUT");
|
|
a.type = "HIDDEN";
|
|
a.name = h.name;
|
|
a.firstValue = g._value;
|
|
g.appendChild(a);
|
|
this.input[g._rName] = a
|
|
}
|
|
if (!this.firstValue[g._rName]) {
|
|
this.firstValue[g._rName] = h.value
|
|
}
|
|
if (h.checked == true) {
|
|
this.check(g)
|
|
}
|
|
if (h.hidden == true) {
|
|
this.hide(g)
|
|
}
|
|
if (h.disabled == true) {
|
|
this.userDisable(g)
|
|
}
|
|
this.doAttachEvents(g);
|
|
return this
|
|
},
|
|
destruct: function(h, l) {
|
|
if (h.lastChild == this.input[h._rName]) {
|
|
var g = false;
|
|
for (var c in this.r) {
|
|
if (!g && this.r[c]._group == h._group && this.r[c]._idd != h._idd) {
|
|
this.r[c].appendChild(this.input[h._rName]);
|
|
g = true
|
|
}
|
|
}
|
|
if (!g) {
|
|
this.input[h._rName].parentNode.removeChild(this.input[h._rName]);
|
|
this.input[h._rName] = null;
|
|
this.firstValue[h._rName] = null
|
|
}
|
|
}
|
|
var m = h._idd;
|
|
h._doOnFocus = h._doOnBlur = h._updateImgNode = null;
|
|
this.doUnloadNestedLists(h);
|
|
this.doDestruct(h);
|
|
return m
|
|
},
|
|
doClick: function(c) {
|
|
c.childNodes[c._ll ? 0 : 1].childNodes[0].focus();
|
|
if (!(c._enabled && !c._checked)) {
|
|
return
|
|
}
|
|
if (c._ro) {
|
|
return
|
|
}
|
|
var a = [c._group, c._value, true];
|
|
if (c.checkEvent("onBeforeChange")) {
|
|
if (c.callEvent("onBeforeChange", a) !== true) {
|
|
return
|
|
}
|
|
}
|
|
this.setChecked(c, true);
|
|
c.getForm()._autoCheck();
|
|
c.callEvent("onChange", a)
|
|
},
|
|
doCheckValue: function(g) {
|
|
var h = null;
|
|
for (var c in this.r) {
|
|
if (this.r[c]._checked && this.r[c]._group == g._group && this.r[c]._rId == g._rId) {
|
|
h = this.r[c]._value
|
|
}
|
|
}
|
|
if (h != null && this.r[c]._enabled) {
|
|
this.input[g._rName].name = String(g._group);
|
|
this.input[g._rName].value = h
|
|
} else {
|
|
this.input[g._rName].name = "";
|
|
this.input[g._rName].value = ""
|
|
}
|
|
this.input[g._rName]._value = h
|
|
},
|
|
setChecked: function(l, m) {
|
|
m = (m === true);
|
|
for (var c in this.r) {
|
|
if (this.r[c]._group == l._group && this.r[c]._rId == l._rId) {
|
|
var h = false;
|
|
if (this.r[c]._idd == l._idd) {
|
|
if (this.r[c]._checked != m) {
|
|
this.r[c]._checked = m;
|
|
h = true
|
|
}
|
|
} else {
|
|
if (this.r[c]._checked) {
|
|
this.r[c]._checked = false;
|
|
h = true
|
|
}
|
|
} if (h) {
|
|
var g = this.r[c].childNodes[this.r[c]._ll ? 1 : 0].childNodes[1];
|
|
g.className = g.className.replace(/rdbt[0-1]{1}/gi, "") + (this.r[c]._checked ? " rdbt1" : " rdbt0");
|
|
g = null
|
|
}
|
|
}
|
|
}
|
|
this.doCheckValue(l)
|
|
},
|
|
getChecked: function(a) {
|
|
return this.input[a._rName]._value
|
|
},
|
|
_getFirstValue: function(a) {
|
|
return this.firstValue[a._rName]
|
|
},
|
|
_getId: function(a) {
|
|
return a._idd
|
|
},
|
|
setValue: function(a, c) {}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doAddLabel: 1,
|
|
doAddInput: 1,
|
|
doDestruct: 1,
|
|
doUnloadNestedLists: 1,
|
|
doAttachEvents: 1,
|
|
check: 1,
|
|
unCheck: 1,
|
|
isChecked: 1,
|
|
enable: 1,
|
|
disable: 1,
|
|
isEnabled: 1,
|
|
setText: 1,
|
|
getText: 1,
|
|
getValue: 1,
|
|
setReadonly: 1,
|
|
isReadonly: 1,
|
|
setFocus: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.radio[c] = dhtmlXForm.prototype.items.checkbox[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.select = {
|
|
render: function(a, c) {
|
|
a._type = "se";
|
|
a._enabled = true;
|
|
a._value = null;
|
|
a._newValue = null;
|
|
if (window.dhx4.isFF || window.dhx4.isIE && typeof(c.inputWidth) == "number") {
|
|
c.inputWidth = Number(c.inputWidth)
|
|
}
|
|
this.doAddLabel(a, c);
|
|
this.doAddInput(a, c, "SELECT", null, true, true, "dhxform_select");
|
|
this.doAttachEvents(a);
|
|
this.doLoadOpts(a, c);
|
|
if (c.connector != null) {
|
|
this.doLoadOptsConnector(a, c.connector)
|
|
}
|
|
if (typeof(c.value) != "undefined" && c.value != null) {
|
|
this.setValue(a, c.value)
|
|
}
|
|
return this
|
|
},
|
|
destruct: function(a) {
|
|
this.doUnloadNestedLists(a);
|
|
a.callEvent = null;
|
|
a.checkEvent = null;
|
|
a.getForm = null;
|
|
a._autoCheck = null;
|
|
a._enabled = null;
|
|
a._idd = null;
|
|
a._type = null;
|
|
a._value = null;
|
|
a._newValue = null;
|
|
a.onselectstart = null;
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].onclick = null;
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].onkeydown = null;
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].onchange = null;
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].onfocus = null;
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].onblur = null;
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].onkeyup = null;
|
|
a.childNodes[a._ll ? 1 : 0].removeChild(a.childNodes[a._ll ? 1 : 0].childNodes[0]);
|
|
while (a.childNodes.length > 0) {
|
|
a.removeChild(a.childNodes[0])
|
|
}
|
|
a.parentNode.removeChild(a);
|
|
a = null
|
|
},
|
|
doAddLabel: function(c, g) {
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhxform_label " + g.labelAlign;
|
|
a.innerHTML = "<label for='" + g.uid + "'>" + g.label + (g.info ? "<span class='dhxform_info'>[?]</span>" : "") + (c._required ? "<span class='dhxform_item_required'>*</span>" : "") + "</label>";
|
|
if (g.wrap == true) {
|
|
a.style.whiteSpace = "normal"
|
|
}
|
|
if (typeof(g.tooltip) != "undefined") {
|
|
a.title = g.tooltip
|
|
}
|
|
c.appendChild(a);
|
|
if (typeof(g.label) == "undefined" || g.label == null || g.label.length == 0) {
|
|
a.style.display = "none"
|
|
}
|
|
if (!isNaN(g.labelWidth)) {
|
|
a.style.width = parseInt(g.labelWidth) + "px"
|
|
}
|
|
if (!isNaN(g.labelHeight)) {
|
|
a.style.height = parseInt(g.labelHeight) + "px"
|
|
}
|
|
if (!isNaN(g.labelLeft)) {
|
|
a.style.left = parseInt(g.labelLeft) + "px"
|
|
}
|
|
if (!isNaN(g.labelTop)) {
|
|
a.style.top = parseInt(g.labelTop) + "px"
|
|
}
|
|
if (g.info) {
|
|
a.onclick = function(l) {
|
|
l = l || event;
|
|
var h = l.target || l.srcElement;
|
|
if (typeof(h.className) != "undefined" && h.className == "dhxform_info") {
|
|
this.parentNode.callEvent("onInfo", [this.parentNode._idd]);
|
|
l.cancelBubble = true;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
},
|
|
doAttachEvents: function(g) {
|
|
var a = g.childNodes[g._ll ? 1 : 0].childNodes[0];
|
|
var c = this;
|
|
a.onclick = function() {
|
|
c.doOnChange(this)
|
|
};
|
|
a.onkeydown = function(h) {
|
|
h = h || event;
|
|
c.doOnChange(this);
|
|
this.parentNode.parentNode.callEvent("onKeyDown", [this, h, this.parentNode.parentNode._idd])
|
|
};
|
|
a.onchange = function() {
|
|
c.doOnChange(this)
|
|
};
|
|
a.onkeyup = function(h) {
|
|
h = h || event;
|
|
this.parentNode.parentNode.callEvent("onKeyUp", [this, h, this.parentNode.parentNode._idd])
|
|
};
|
|
a = null;
|
|
this.doAttachChangeLS(g)
|
|
},
|
|
doAttachChangeLS: function(c) {
|
|
var a = c.childNodes[c._ll ? 1 : 0].childNodes[0];
|
|
a.onfocus = function() {
|
|
var g = this.parentNode.parentNode;
|
|
g.getForm()._ccActivate(g._idd, this, g.getForm().getItemValue(g._idd, true));
|
|
g.getForm().callEvent("onFocus", [g._idd]);
|
|
g = null
|
|
};
|
|
a.onblur = function() {
|
|
var g = this.parentNode.parentNode;
|
|
g.getForm()._ccDeactivate(g._idd);
|
|
g.getForm().callEvent("onBlur", [g._idd]);
|
|
g = null
|
|
};
|
|
a = null
|
|
},
|
|
doValidate: function(a) {
|
|
if (a.getForm().live_validate) {
|
|
this._validate(a)
|
|
}
|
|
},
|
|
doLoadOpts: function(n, l, r) {
|
|
var o = n.childNodes[n._ll ? 1 : 0].childNodes[0];
|
|
var a = l.options;
|
|
var h = false;
|
|
for (var c = 0; c < a.length; c++) {
|
|
var m = a[c].text || a[c].label;
|
|
if (!m || typeof(m) == "undefined") {
|
|
m = ""
|
|
}
|
|
var g = new Option(m, a[c].value);
|
|
if (typeof(a[c].img_src) == "string") {
|
|
g.setAttribute("img_src", a[c].img_src)
|
|
}
|
|
o.options.add(g);
|
|
if (typeof(a[c].selected) != "undefined" && window.dhx4.s2b(a[c].selected) == true) {
|
|
g.selected = true;
|
|
n._value = a[c].value;
|
|
h = true
|
|
}
|
|
if (typeof(a[c].checked) != "undefined" && window.dhx4.s2b(a[c].checked) == true) {
|
|
g.setAttribute("checked", "1")
|
|
}
|
|
if (typeof(a[c].img) != "undefined") {
|
|
g.setAttribute("img", a[c].img)
|
|
}
|
|
if (typeof(a[c].img_dis) != "undefined") {
|
|
g.setAttribute("img_dis", a[c].img_dis)
|
|
}
|
|
}
|
|
if (!h && o.selectedIndex >= 0) {
|
|
n._value = o.options[o.selectedIndex].value
|
|
}
|
|
if (r === true) {
|
|
n.callEvent("onOptionsLoaded", [n._idd])
|
|
}
|
|
this._checkNoteWidth(n)
|
|
},
|
|
doLoadOptsConnector: function(g, a) {
|
|
var c = this;
|
|
g._connector_working = true;
|
|
window.dhx4.ajax.get(a, function(n) {
|
|
n = n.xmlDoc.responseXML;
|
|
if (n == null) {
|
|
return
|
|
}
|
|
var h = n.getElementsByTagName("data");
|
|
if (h == null || h[0] == null) {
|
|
return
|
|
}
|
|
h = h[0];
|
|
var m = [];
|
|
for (var o = 0; o < h.childNodes.length; o++) {
|
|
if (typeof(h.childNodes[o].tagName) != "undefined" && String(h.childNodes[o].tagName).toLowerCase() == "item") {
|
|
var l = h.childNodes[o];
|
|
m.push({
|
|
label: l.getAttribute("label"),
|
|
value: l.getAttribute("value"),
|
|
selected: (l.getAttribute("selected") != null)
|
|
});
|
|
l = null
|
|
}
|
|
}
|
|
c.doLoadOpts(g, {
|
|
options: m
|
|
}, true);
|
|
g._connector_working = false;
|
|
if (g._connector_value != null) {
|
|
c.setValue(g, g._connector_value);
|
|
g._connector_value = null
|
|
}
|
|
c = g = null
|
|
})
|
|
},
|
|
doOnChange: function(g) {
|
|
var a = g.parentNode.parentNode;
|
|
a._newValue = (g.selectedIndex >= 0 ? g.options[g.selectedIndex].value : null);
|
|
if (a._newValue != a._value) {
|
|
if (a.checkEvent("onBeforeChange")) {
|
|
if (a.callEvent("onBeforeChange", [a._idd, a._value, a._newValue]) !== true) {
|
|
for (var c = 0; c < g.options.length; c++) {
|
|
if (g.options[c].value == a._value) {
|
|
g.options[c].selected = true
|
|
}
|
|
}
|
|
return
|
|
}
|
|
}
|
|
a._value = a._newValue;
|
|
a.callEvent("onChange", [a._idd, a._value]);
|
|
if (a._type == "se" && a.getForm().live_validate) {
|
|
this._validate(a)
|
|
}
|
|
}
|
|
a._autoCheck()
|
|
},
|
|
setText: function(a, c) {
|
|
if (!c) {
|
|
c = ""
|
|
}
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].innerHTML = c + (a._required ? "<span class='dhxform_item_required'>*</span>" : "");
|
|
a.childNodes[a._ll ? 0 : 1].style.display = (c.length == 0 || c == null ? "none" : "")
|
|
},
|
|
getText: function(a) {
|
|
return a.childNodes[a._ll ? 0 : 1].childNodes[0].innerHTML.replace(/<span class=\"dhxform_item_required\">[^<]*<\/span>/g, "")
|
|
},
|
|
enable: function(a) {
|
|
if (String(a.className).search("disabled") >= 0) {
|
|
a.className = String(a.className).replace(/disabled/gi, "")
|
|
}
|
|
a._enabled = true;
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].removeAttribute("disabled")
|
|
},
|
|
disable: function(a) {
|
|
if (String(a.className).search("disabled") < 0) {
|
|
a.className += " disabled"
|
|
}
|
|
a._enabled = false;
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].setAttribute("disabled", true)
|
|
},
|
|
getOptions: function(a) {
|
|
return a.childNodes[a._ll ? 1 : 0].childNodes[0].options
|
|
},
|
|
setValue: function(c, h) {
|
|
if (c._connector_working) {
|
|
c._connector_value = h;
|
|
return
|
|
}
|
|
var a = this.getOptions(c);
|
|
for (var g = 0; g < a.length; g++) {
|
|
if (a[g].value == h) {
|
|
a[g].selected = true;
|
|
c._value = a[g].value
|
|
}
|
|
}
|
|
if (c._list != null && c._list.length > 0) {
|
|
c.getForm()._autoCheck()
|
|
}
|
|
c.getForm()._ccReload(c._idd, c._value)
|
|
},
|
|
getValue: function(g) {
|
|
var a = -1;
|
|
var c = this.getOptions(g);
|
|
for (var h = 0; h < c.length; h++) {
|
|
if (c[h].selected) {
|
|
a = c[h].value
|
|
}
|
|
}
|
|
return a
|
|
},
|
|
setWidth: function(c, a) {
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].style.width = a + "px"
|
|
},
|
|
getSelect: function(a) {
|
|
return a.childNodes[a._ll ? 1 : 0].childNodes[0]
|
|
},
|
|
setFocus: function(a) {
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].focus()
|
|
},
|
|
_checkNoteWidth: function(c) {
|
|
var a;
|
|
if (c.childNodes[c._ll ? 1 : 0].childNodes[1] != null) {
|
|
a = c.childNodes[c._ll ? 1 : 0].childNodes[1];
|
|
if (a.className != null && a.className.search(/dhxform_note/gi) >= 0 && a._w == "auto") {
|
|
a.style.width = c.childNodes[c._ll ? 1 : 0].childNodes[0].offsetWidth + "px"
|
|
}
|
|
}
|
|
a = null
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doAddInput: 1,
|
|
doUnloadNestedLists: 1,
|
|
isEnabled: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.select[c] = dhtmlXForm.prototype.items.checkbox[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.multiselect = {
|
|
doLoadOpts: function(h, m, n) {
|
|
var c = h.childNodes[h._ll ? 1 : 0].childNodes[0];
|
|
c.multiple = true;
|
|
if (!isNaN(m.size)) {
|
|
c.size = Number(m.size)
|
|
}
|
|
h._value = [];
|
|
h._newValue = [];
|
|
var g = m.options;
|
|
for (var l = 0; l < g.length; l++) {
|
|
var a = new Option(g[l].text || g[l].label, g[l].value);
|
|
c.options.add(a);
|
|
if (g[l].selected == true || g[l].selected == "true") {
|
|
a.selected = true;
|
|
h._value.push(g[l].value)
|
|
}
|
|
}
|
|
if (n === true) {
|
|
h.callEvent("onOptionsLoaded", [h._idd])
|
|
}
|
|
this._checkNoteWidth(h)
|
|
},
|
|
doAttachEvents: function(g) {
|
|
var a = g.childNodes[g._ll ? 1 : 0].childNodes[0];
|
|
var c = this;
|
|
a.onfocus = function() {
|
|
c.doOnChange(this);
|
|
var h = this.parentNode.parentNode;
|
|
h.getForm().callEvent("onFocus", [h._idd]);
|
|
h = null
|
|
};
|
|
a.onblur = function() {
|
|
c.doOnChange(this);
|
|
var h = this.parentNode.parentNode;
|
|
h.getForm().callEvent("onBlur", [h._idd]);
|
|
h = null
|
|
};
|
|
a.onclick = function() {
|
|
c.doOnChange(this);
|
|
var h = this.parentNode.parentNode;
|
|
h._autoCheck();
|
|
h = null
|
|
}
|
|
},
|
|
doOnChange: function(h) {
|
|
var c = h.parentNode.parentNode;
|
|
c._newValue = [];
|
|
for (var g = 0; g < h.options.length; g++) {
|
|
if (h.options[g].selected) {
|
|
c._newValue.push(h.options[g].value)
|
|
}
|
|
}
|
|
if ((c._value).sort().toString() != (c._newValue).sort().toString()) {
|
|
if (c.checkEvent("onBeforeChange")) {
|
|
if (c.callEvent("onBeforeChange", [c._idd, c._value, c._newValue]) !== true) {
|
|
var a = {};
|
|
for (var g = 0; g < c._value.length; g++) {
|
|
a[c._value[g]] = true
|
|
}
|
|
for (var g = 0; g < h.options.length; g++) {
|
|
h.options[g].selected = (a[h.options[g].value] == true)
|
|
}
|
|
a = null;
|
|
return
|
|
}
|
|
}
|
|
c._value = [];
|
|
for (var g = 0; g < c._newValue.length; g++) {
|
|
c._value.push(c._newValue[g])
|
|
}
|
|
c.callEvent("onChange", [c._idd, c._value])
|
|
}
|
|
c._autoCheck()
|
|
},
|
|
setValue: function(g, l) {
|
|
var a = {};
|
|
if (typeof(l) == "string") {
|
|
l = l.split(",")
|
|
}
|
|
if (typeof(l) != "object") {
|
|
l = [l]
|
|
}
|
|
for (var h = 0; h < l.length; h++) {
|
|
a[l[h]] = true
|
|
}
|
|
var c = this.getOptions(g);
|
|
for (var h = 0; h < c.length; h++) {
|
|
c[h].selected = (a[c[h].value] == true)
|
|
}
|
|
g._autoCheck()
|
|
},
|
|
getValue: function(g) {
|
|
var a = [];
|
|
var c = this.getOptions(g);
|
|
for (var h = 0; h < c.length; h++) {
|
|
if (c[h].selected) {
|
|
a.push(c[h].value)
|
|
}
|
|
}
|
|
return a
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in dhtmlXForm.prototype.items.select) {
|
|
if (!dhtmlXForm.prototype.items.multiselect[c]) {
|
|
dhtmlXForm.prototype.items.multiselect[c] = dhtmlXForm.prototype.items.select[c]
|
|
}
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.input = {
|
|
render: function(m, n) {
|
|
var l = (!isNaN(n.rows));
|
|
m._type = "ta";
|
|
m._enabled = true;
|
|
this.doAddLabel(m, n);
|
|
this.doAddInput(m, n, (l ? "TEXTAREA" : "INPUT"), (l ? null : "TEXT"), true, true, "dhxform_textarea");
|
|
this.doAttachEvents(m);
|
|
if (l) {
|
|
m.childNodes[m._ll ? 1 : 0].childNodes[0].rows = Number(n.rows) + (window.dhx4.isIE6 ? 1 : 0)
|
|
}
|
|
if (typeof(n.numberFormat) != "undefined") {
|
|
var h, g = null,
|
|
o = null;
|
|
if (typeof(n.numberFormat) != "string") {
|
|
h = n.numberFormat[0];
|
|
g = n.numberFormat[1] || null;
|
|
o = n.numberFormat[2] || null
|
|
} else {
|
|
h = n.numberFormat;
|
|
if (typeof(n.groupSep) == "string") {
|
|
g = n.groupSep
|
|
}
|
|
if (typeof(n.decSep) == "string") {
|
|
o = n.decSep
|
|
}
|
|
}
|
|
this.setNumberFormat(m, h, g, o, false)
|
|
}
|
|
this.setValue(m, n.value);
|
|
return this
|
|
},
|
|
doAttachEvents: function(c) {
|
|
var a = this;
|
|
if (c._type == "ta" || c._type == "se" || c._type == "pw") {
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].onfocus = function() {
|
|
var g = this.parentNode.parentNode;
|
|
if (g._df != null) {
|
|
this.value = g._value || ""
|
|
}
|
|
g.getForm()._ccActivate(g._idd, this, this.value);
|
|
g.getForm().callEvent("onFocus", [g._idd]);
|
|
g = null
|
|
}
|
|
}
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].onblur = function() {
|
|
var g = this.parentNode.parentNode;
|
|
g.getForm()._ccDeactivate(g._idd);
|
|
a.updateValue(g, true);
|
|
if (g.getForm().live_validate) {
|
|
a._validate(g)
|
|
}
|
|
g.getForm().callEvent("onBlur", [g._idd]);
|
|
g = null
|
|
}
|
|
},
|
|
updateValue: function(g, a) {
|
|
var h = g.childNodes[g._ll ? 1 : 0].childNodes[0].value;
|
|
if (!a && g._df != null && h == this._getFmtValue(g, h)) {
|
|
return
|
|
}
|
|
var c = this;
|
|
if (g._value != h) {
|
|
if (g.checkEvent("onBeforeChange")) {
|
|
if (g.callEvent("onBeforeChange", [g._idd, g._value, h]) !== true) {
|
|
if (g._df != null) {
|
|
c.setValue(g, g._value)
|
|
} else {
|
|
g.childNodes[g._ll ? 1 : 0].childNodes[0].value = g._value
|
|
}
|
|
return
|
|
}
|
|
}
|
|
if (g._df != null) {
|
|
c.setValue(g, h)
|
|
} else {
|
|
g._value = h
|
|
}
|
|
g.callEvent("onChange", [g._idd, h]);
|
|
return
|
|
}
|
|
if (g._df != null) {
|
|
this.setValue(g, g._value)
|
|
}
|
|
},
|
|
setValue: function(g, h) {
|
|
g._value = (typeof(h) != "undefined" && h != null ? h : "");
|
|
var c = (String(g._value) || "");
|
|
var a = g.childNodes[g._ll ? 1 : 0].childNodes[0];
|
|
if (g._df != null && typeof(this._getFmtValue) == "function") {
|
|
c = this._getFmtValue(g, c)
|
|
}
|
|
if (a.value != c) {
|
|
a.value = c;
|
|
g.getForm()._ccReload(g._idd, c)
|
|
}
|
|
a = null
|
|
},
|
|
getValue: function(a) {
|
|
var c = a.getForm();
|
|
if (c._formLS && c._formLS[a._idd] != null) {
|
|
this.updateValue(a)
|
|
}
|
|
c = null;
|
|
return (typeof(a._value) != "undefined" && a._value != null ? a._value : "")
|
|
},
|
|
setReadonly: function(a, c) {
|
|
a._ro = (c === true);
|
|
if (a._ro) {
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].setAttribute("readOnly", "true")
|
|
} else {
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].removeAttribute("readOnly")
|
|
}
|
|
},
|
|
isReadonly: function(a) {
|
|
if (!a._ro) {
|
|
a._ro = false
|
|
}
|
|
return a._ro
|
|
},
|
|
getInput: function(a) {
|
|
return a.childNodes[a._ll ? 1 : 0].childNodes[0]
|
|
},
|
|
setNumberFormat: function(l, n, h, o, c) {
|
|
if (typeof(c) != "boolean") {
|
|
c = true
|
|
}
|
|
if (n == "") {
|
|
l._df = null;
|
|
if (c) {
|
|
this.setValue(l, l._value)
|
|
}
|
|
return true
|
|
}
|
|
if (typeof(n) != "string") {
|
|
return
|
|
}
|
|
var a = n.match(/^([^\.\,0-9]*)([0\.\,]*)([^\.\,0-9]*)/);
|
|
if (a == null || a.length != 4) {
|
|
return false
|
|
}
|
|
l._df = {
|
|
i_len: false,
|
|
i_sep: (typeof(h) == "string" ? h : ","),
|
|
d_len: false,
|
|
d_sep: (typeof(o) == "string" ? o : "."),
|
|
s_bef: (typeof(a[1]) == "string" ? a[1] : ""),
|
|
s_aft: (typeof(a[3]) == "string" ? a[3] : "")
|
|
};
|
|
var m = a[2].split(".");
|
|
if (m[1] != null) {
|
|
l._df.d_len = m[1].length
|
|
}
|
|
var g = m[0].split(",");
|
|
if (g.length > 1) {
|
|
l._df.i_len = g[g.length - 1].length
|
|
}
|
|
if (c) {
|
|
this.setValue(l, l._value)
|
|
}
|
|
return true
|
|
},
|
|
_getFmtValue: function(item, v) {
|
|
var r = v.match(/^(-)?([0-9]{1,})(\.([0-9]{1,}))?$/);
|
|
if (r != null && r.length == 5) {
|
|
var v0 = "";
|
|
if (r[1] != null) {
|
|
v0 += r[1]
|
|
}
|
|
v0 += item._df.s_bef;
|
|
if (item._df.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 == item._df.i_len && q > 0) {
|
|
v1 = item._df.i_sep + v1;
|
|
i = 0
|
|
}
|
|
}
|
|
v0 += v1
|
|
} else {
|
|
v0 += r[2]
|
|
} if (item._df.d_len !== false) {
|
|
if (r[4] == null) {
|
|
r[4] = ""
|
|
}
|
|
while (r[4].length < item._df.d_len) {
|
|
r[4] += "0"
|
|
}
|
|
eval("dhx4.temp = new RegExp(/\\d{" + item._df.d_len + "}/);");
|
|
var t1 = (r[4]).match(dhx4.temp);
|
|
if (t1 != null) {
|
|
v0 += item._df.d_sep + t1
|
|
}
|
|
dhx4.temp = t1 = null
|
|
}
|
|
v0 += item._df.s_aft;
|
|
return v0
|
|
}
|
|
return v
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doAddLabel: 1,
|
|
doAddInput: 1,
|
|
destruct: 1,
|
|
doUnloadNestedLists: 1,
|
|
setText: 1,
|
|
getText: 1,
|
|
enable: 1,
|
|
disable: 1,
|
|
isEnabled: 1,
|
|
setWidth: 1,
|
|
setFocus: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.input[c] = dhtmlXForm.prototype.items.select[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.password = {
|
|
render: function(a, c) {
|
|
a._type = "pw";
|
|
a._enabled = true;
|
|
this.doAddLabel(a, c);
|
|
this.doAddInput(a, c, "INPUT", "PASSWORD", true, true, "dhxform_textarea");
|
|
this.doAttachEvents(a);
|
|
this.setValue(a, c.value);
|
|
return this
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doAddLabel: 1,
|
|
doAddInput: 1,
|
|
doAttachEvents: 1,
|
|
destruct: 1,
|
|
doUnloadNestedLists: 1,
|
|
setText: 1,
|
|
getText: 1,
|
|
setValue: 1,
|
|
getValue: 1,
|
|
updateValue: 1,
|
|
enable: 1,
|
|
disable: 1,
|
|
isEnabled: 1,
|
|
setWidth: 1,
|
|
setReadonly: 1,
|
|
isReadonly: 1,
|
|
setFocus: 1,
|
|
getInput: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.password[c] = dhtmlXForm.prototype.items.input[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.file = {
|
|
render: function(g, h) {
|
|
g._type = "fl";
|
|
g._enabled = true;
|
|
this.doAddLabel(g, h);
|
|
this.doAddInput(g, h, "INPUT", "FILE", true, false, "dhxform_textarea");
|
|
var a = g.childNodes[g._ll ? 1 : 0].childNodes[0];
|
|
var c = this;
|
|
a.onfocus = function() {
|
|
var l = this.parentNode.parentNode;
|
|
l.getForm().callEvent("onFocus", [l._idd]);
|
|
l = null
|
|
};
|
|
a.onblur = function() {
|
|
var l = this.parentNode.parentNode;
|
|
if (l.getForm().live_validate) {
|
|
c._validate(l)
|
|
}
|
|
l.getForm().callEvent("onBlur", [l._idd]);
|
|
l = null
|
|
};
|
|
a = null;
|
|
g.childNodes[g._ll ? 1 : 0].childNodes[0].onchange = function() {
|
|
g.callEvent("onChange", [g._idd, this.value])
|
|
};
|
|
return this
|
|
},
|
|
setValue: function() {},
|
|
getValue: function(a) {
|
|
return a.childNodes[a._ll ? 1 : 0].childNodes[0].value
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doAddLabel: 1,
|
|
doAddInput: 1,
|
|
destruct: 1,
|
|
doUnloadNestedLists: 1,
|
|
setText: 1,
|
|
getText: 1,
|
|
enable: 1,
|
|
disable: 1,
|
|
isEnabled: 1,
|
|
setWidth: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.file[c] = dhtmlXForm.prototype.items.input[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.label = {
|
|
_index: false,
|
|
render: function(c, g) {
|
|
c._type = "lb";
|
|
c._enabled = true;
|
|
c._checked = true;
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhxform_txt_label2" + (g._isTopmost ? " topmost" : "");
|
|
a.innerHTML = g.label;
|
|
c.appendChild(a);
|
|
if (g.hidden == true) {
|
|
this.hide(c)
|
|
}
|
|
if (g.disabled == true) {
|
|
this.userDisable(c)
|
|
}
|
|
if (!isNaN(g.labelWidth)) {
|
|
a.style.width = parseInt(g.labelWidth) + "px"
|
|
}
|
|
if (!isNaN(g.labelHeight)) {
|
|
a.style.height = parseInt(g.labelHeight) + "px"
|
|
}
|
|
if (!isNaN(g.labelLeft)) {
|
|
a.style.left = parseInt(g.labelLeft) + "px"
|
|
}
|
|
if (!isNaN(g.labelTop)) {
|
|
a.style.top = parseInt(g.labelTop) + "px"
|
|
}
|
|
return this
|
|
},
|
|
destruct: function(a) {
|
|
this.doUnloadNestedLists(a);
|
|
a._autoCheck = null;
|
|
a._enabled = null;
|
|
a._type = null;
|
|
a.callEvent = null;
|
|
a.checkEvent = null;
|
|
a.getForm = null;
|
|
a.onselectstart = null;
|
|
a.parentNode.removeChild(a);
|
|
a = null
|
|
},
|
|
enable: function(a) {
|
|
if (String(a.className).search("disabled") >= 0) {
|
|
a.className = String(a.className).replace(/disabled/gi, "")
|
|
}
|
|
a._enabled = true
|
|
},
|
|
disable: function(a) {
|
|
if (String(a.className).search("disabled") < 0) {
|
|
a.className += " disabled"
|
|
}
|
|
a._enabled = false
|
|
},
|
|
setText: function(a, c) {
|
|
a.firstChild.innerHTML = c
|
|
},
|
|
getText: function(a) {
|
|
return a.firstChild.innerHTML
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doUnloadNestedLists: 1,
|
|
isEnabled: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.label[c] = dhtmlXForm.prototype.items.checkbox[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.button = {
|
|
render: function(g, h) {
|
|
g._type = "bt";
|
|
g._enabled = true;
|
|
g._name = h.name;
|
|
g.className = String(g.className).replace("item_label_top", "item_label_left").replace("item_label_right", "item_label_left");
|
|
if (!isNaN(h.width)) {
|
|
var a = Math.max(h.width, 10)
|
|
}
|
|
var c = (typeof(a) != "undefined");
|
|
g._doOnKeyUpDown = function(m, l) {
|
|
this.callEvent(m, [this.childNodes[0].childNodes[0], l, this._idd])
|
|
};
|
|
g.innerHTML = '<div class="dhxform_btn" role="link" tabindex="0" dir="ltr"><div class="dhxform_btn_txt" ' + (c ? ' style="width:' + a + 'px;"' : "") + ">" + h.value + "</div></div>";
|
|
if (!isNaN(h.inputLeft)) {
|
|
g.childNodes[0].style.left = parseInt(h.inputLeft) + "px"
|
|
}
|
|
if (!isNaN(h.inputTop)) {
|
|
g.childNodes[0].style.top = parseInt(h.inputTop) + "px"
|
|
}
|
|
if (h.hidden == true) {
|
|
this.hide(g)
|
|
}
|
|
if (h.disabled == true) {
|
|
this.userDisable(g)
|
|
}
|
|
if (typeof(h.tooltip) != "undefined") {
|
|
g.firstChild.title = h.tooltip
|
|
}
|
|
g.onselectstart = function(l) {
|
|
l = l || event;
|
|
l.cancelBubble = true;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
g.firstChild.onselectstart = function(l) {
|
|
l = l || event;
|
|
l.cancelBubble = true;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
g.firstChild.onkeypress = function(l) {
|
|
l = l || event;
|
|
if ((l.keyCode == 32 || l.charCode == 32 || l.keyCode == 13 || l.charCode == 13) && !this.parentNode._busy) {
|
|
this.parentNode._busy = true;
|
|
l.cancelBubble = true;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
_dhxForm_doClick(this.childNodes[0], ["mousedown", "mouseup"]);
|
|
return false
|
|
}
|
|
};
|
|
g.firstChild.ontouchstart = function() {
|
|
e = e || event;
|
|
e.preventDefault();
|
|
if (!this.parentNode._busy) {
|
|
this.parentNode._busy = true;
|
|
_dhxForm_doClick(this.childNodes[0], ["mousedown", "mouseup"])
|
|
}
|
|
};
|
|
g.firstChild.onfocus = function() {
|
|
this.parentNode._doOnFocus(this.parentNode)
|
|
};
|
|
g.firstChild.onblur = function() {
|
|
_dhxForm_doClick(this.childNodes[0], "mouseout");
|
|
this.parentNode._doOnBlur(this.parentNode)
|
|
};
|
|
g.firstChild.onkeyup = function(l) {
|
|
this.parentNode._doOnKeyUpDown("onKeyUp", l || event)
|
|
};
|
|
g.firstChild.onkeydown = function(l) {
|
|
this.parentNode._doOnKeyUpDown("onKeyDown", l || event)
|
|
};
|
|
g.firstChild.onmouseover = function() {
|
|
var l = this.parentNode;
|
|
if (!l._enabled) {
|
|
return
|
|
}
|
|
this._isOver = true;
|
|
this.className = "dhxform_btn dhxform_btn_over";
|
|
l = null
|
|
};
|
|
g.firstChild.onmouseout = function() {
|
|
var l = this.parentNode;
|
|
if (!l._enabled) {
|
|
return
|
|
}
|
|
this.className = "dhxform_btn";
|
|
this._allowClick = false;
|
|
this._pressed = false;
|
|
this._isOver = false;
|
|
l = null
|
|
};
|
|
g.firstChild.onmousedown = function(m) {
|
|
m = m || event;
|
|
if (m.button >= 2) {
|
|
return
|
|
}
|
|
if (this._pressed) {
|
|
return
|
|
}
|
|
var l = this.parentNode;
|
|
if (!l._enabled) {
|
|
return
|
|
}
|
|
this.className = "dhxform_btn dhxform_btn_pressed";
|
|
this._allowClick = true;
|
|
this._pressed = true;
|
|
l = null
|
|
};
|
|
g.firstChild.onmouseup = function(m) {
|
|
m = m || event;
|
|
if (m.button >= 2) {
|
|
return
|
|
}
|
|
if (!this._pressed) {
|
|
return
|
|
}
|
|
var l = this.parentNode;
|
|
if (!l._enabled) {
|
|
return
|
|
}
|
|
l._busy = false;
|
|
this.className = "dhxform_btn" + (this._isOver ? " dhxform_btn_over" : "");
|
|
if (this._pressed && this._allowClick) {
|
|
l.callEvent("_onButtonClick", [l._name, l._cmd])
|
|
}
|
|
this._allowClick = false;
|
|
this._pressed = false;
|
|
l = null
|
|
};
|
|
g._doOnFocus = function(l) {
|
|
l.getForm().callEvent("onFocus", [l._idd])
|
|
};
|
|
g._doOnBlur = function(l) {
|
|
l.getForm().callEvent("onBlur", [l._idd])
|
|
};
|
|
return this
|
|
},
|
|
destruct: function(a) {
|
|
this.doUnloadNestedLists(a);
|
|
a.callEvent = null;
|
|
a.checkEvent = null;
|
|
a.getForm = null;
|
|
a._autoCheck = null;
|
|
a._type = null;
|
|
a._enabled = null;
|
|
a._cmd = null;
|
|
a._name = null;
|
|
a._doOnFocus = null;
|
|
a._doOnBlur = null;
|
|
a._doOnKeyUpDown = null;
|
|
a.onselectstart = null;
|
|
a.firstChild.onselectstart = null;
|
|
a.firstChild.onkeypress = null;
|
|
a.firstChild.ontouchstart = null;
|
|
a.firstChild.onfocus = null;
|
|
a.firstChild.onblur = null;
|
|
a.firstChild.onkeyup = null;
|
|
a.firstChild.onkeydown = null;
|
|
a.firstChild.onmouseover = null;
|
|
a.firstChild.onmouseout = null;
|
|
a.firstChild.onmousedown = null;
|
|
a.firstChild.onmouseup = null;
|
|
while (a.childNodes.length > 0) {
|
|
a.removeChild(a.childNodes[0])
|
|
}
|
|
a.parentNode.removeChild(a);
|
|
a = null
|
|
},
|
|
enable: function(a) {
|
|
if (String(a.className).search("disabled") >= 0) {
|
|
a.className = String(a.className).replace(/disabled/gi, "")
|
|
}
|
|
a._enabled = true;
|
|
a.childNodes[0].removeAttribute("disabled");
|
|
a.childNodes[0].setAttribute("role", "link");
|
|
a.childNodes[0].setAttribute("tabIndex", "0")
|
|
},
|
|
disable: function(a) {
|
|
if (String(a.className).search("disabled") < 0) {
|
|
a.className += " disabled"
|
|
}
|
|
a._enabled = false;
|
|
a.childNodes[0].setAttribute("disabled", "true");
|
|
a.childNodes[0].removeAttribute("role");
|
|
a.childNodes[0].removeAttribute("tabIndex")
|
|
},
|
|
setText: function(a, c) {
|
|
a.childNodes[0].childNodes[0].innerHTML = c
|
|
},
|
|
getText: function(a) {
|
|
return a.childNodes[0].childNodes[0].innerHTML
|
|
},
|
|
setFocus: function(a) {
|
|
a.childNodes[0].focus()
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doUnloadNestedLists: 1,
|
|
isEnabled: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.button[c] = dhtmlXForm.prototype.items.checkbox[c]
|
|
}
|
|
})();
|
|
|
|
// === Asan 2016-03-13 20:08pm
|
|
dhtmlXForm.prototype.getButton = function(name) {
|
|
return this.doWithItem(name, "getButton");
|
|
};
|
|
dhtmlXForm.prototype.items.button.getButton = function(item) {
|
|
return item;
|
|
};
|
|
function dhtmlXclickButton(name) {
|
|
_dhxForm_doClick(myForm.getButton(name).childNodes[0].childNodes[0],["mousedown","mouseup"])
|
|
};
|
|
// ================================
|
|
dhtmlXForm.prototype.items.hidden = {
|
|
_index: false,
|
|
render: function(c, g) {
|
|
c.style.display = "none";
|
|
c._name = g.name;
|
|
c._type = "hd";
|
|
c._enabled = true;
|
|
var a = document.createElement("INPUT");
|
|
a.type = "HIDDEN";
|
|
a.name = g.name;
|
|
a.value = (g.value || "");
|
|
c.appendChild(a);
|
|
return this
|
|
},
|
|
destruct: function(a) {
|
|
this.doUnloadNestedLists(a);
|
|
while (a.childNodes.length > 0) {
|
|
a.removeChild(a.childNodes[0])
|
|
}
|
|
a._autoCheck = null;
|
|
a._name = null;
|
|
a._type = null;
|
|
a._enabled = null;
|
|
a.onselectstart = null;
|
|
a.callEvent = null;
|
|
a.checkEvent = null;
|
|
a.getForm = null;
|
|
a.parentNode.removeChild(a);
|
|
a = null
|
|
},
|
|
enable: function(a) {
|
|
a._enabled = true;
|
|
a.childNodes[0].setAttribute("name", a._name)
|
|
},
|
|
disable: function(a) {
|
|
a._enabled = false;
|
|
a.childNodes[0].removeAttribute("name")
|
|
},
|
|
show: function() {},
|
|
hide: function() {},
|
|
isHidden: function() {
|
|
return true
|
|
},
|
|
setValue: function(a, c) {
|
|
a.childNodes[0].value = c
|
|
},
|
|
getValue: function(a) {
|
|
return a.childNodes[0].value
|
|
},
|
|
getInput: function(a) {
|
|
return a.childNodes[0]
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doUnloadNestedLists: 1,
|
|
isEnabled: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.hidden[c] = dhtmlXForm.prototype.items.checkbox[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.list = {
|
|
_index: false,
|
|
render: function(a, c) {
|
|
a._type = "list";
|
|
a._enabled = true;
|
|
a._isNestedForm = true;
|
|
a.style.paddingLeft = a._ofsNested + "px";
|
|
a.className = "dhxform_base_nested" + (a._custom_css || "");
|
|
return [this, new dhtmlXForm(a, null, c)]
|
|
},
|
|
destruct: function(a) {}
|
|
};
|
|
dhtmlXForm.prototype.items.fieldset = {
|
|
_index: false,
|
|
render: function(c, h) {
|
|
c._type = "fs";
|
|
if (typeof(parseInt(h.inputWidth)) == "number") {}
|
|
c._width = h.width;
|
|
c._enabled = true;
|
|
c._checked = true;
|
|
c.className = "fs_" + h.position + (typeof(h.className) == "string" ? " " + h.className : "");
|
|
var g = document.createElement("FIELDSET");
|
|
g.className = "dhxform_fs";
|
|
var l = String(h.labelAlign).replace("align_", "");
|
|
g.innerHTML = "<legend class='fs_legend' align='" + l + "' style='text-align:" + l + "'>" + h.label + "</legend>";
|
|
c.appendChild(g);
|
|
if (!isNaN(h.inputLeft)) {
|
|
g.style.left = parseInt(h.inputLeft) + "px"
|
|
}
|
|
if (!isNaN(h.inputTop)) {
|
|
g.style.top = parseInt(h.inputTop) + "px"
|
|
}
|
|
if (h.inputWidth != "auto") {
|
|
if (!isNaN(h.inputWidth)) {
|
|
g.style.width = parseInt(h.inputWidth) + "px";
|
|
var a = parseInt(g.style.width);
|
|
if (g.offsetWidth > a) {
|
|
g.style.width = a + (a - g.offsetWidth) + "px"
|
|
}
|
|
}
|
|
}
|
|
c._addSubListNode = function() {
|
|
var m = document.createElement("DIV");
|
|
m._custom_css = " dhxform_fs_nested";
|
|
this.childNodes[0].appendChild(m);
|
|
return m
|
|
};
|
|
if (h.hidden == true) {
|
|
this.hide(c)
|
|
}
|
|
if (h.disabled == true) {
|
|
this.userDisable(c)
|
|
}
|
|
return this
|
|
},
|
|
destruct: function(a) {
|
|
this.doUnloadNestedLists(a);
|
|
a._checked = null;
|
|
a._enabled = null;
|
|
a._idd = null;
|
|
a._type = null;
|
|
a._width = null;
|
|
a.onselectstart = null;
|
|
a._addSubListNode = null;
|
|
a._autoCheck = null;
|
|
a.callEvent = null;
|
|
a.checkEvent = null;
|
|
a.getForm = null;
|
|
while (a.childNodes.length > 0) {
|
|
a.removeChild(a.childNodes[0])
|
|
}
|
|
a.parentNode.removeChild(a);
|
|
a = null
|
|
},
|
|
setText: function(a, c) {
|
|
a.childNodes[0].childNodes[0].innerHTML = c
|
|
},
|
|
getText: function(a) {
|
|
return a.childNodes[0].childNodes[0].innerHTML
|
|
},
|
|
enable: function(a) {
|
|
a._enabled = true;
|
|
if (String(a.className).search("disabled") >= 0) {
|
|
a.className = String(a.className).replace(/disabled/gi, "")
|
|
}
|
|
},
|
|
disable: function(a) {
|
|
a._enabled = false;
|
|
if (String(a.className).search("disabled") < 0) {
|
|
a.className += " disabled"
|
|
}
|
|
},
|
|
setWidth: function(c, a) {
|
|
c.childNodes[0].style.width = a + "px";
|
|
c._width = a
|
|
},
|
|
getWidth: function(a) {
|
|
return a._width
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doUnloadNestedLists: 1,
|
|
isEnabled: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.fieldset[c] = dhtmlXForm.prototype.items.checkbox[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.block = {
|
|
_index: false,
|
|
render: function(c, g) {
|
|
c._type = "bl";
|
|
c._width = g.width;
|
|
c._enabled = true;
|
|
c._checked = true;
|
|
c.className = "block_" + g.position + (typeof(g.className) == "string" ? " " + g.className : "");
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhxform_obj_" + c.getForm().skin + " dhxform_block";
|
|
a.style.fontSize = c.getForm().cont.style.fontSize;
|
|
if (g.style) {
|
|
a.style.cssText = g.style
|
|
}
|
|
if (typeof(g.id) != "undefined") {
|
|
a.id = g.id
|
|
}
|
|
c.appendChild(a);
|
|
if (!isNaN(g.inputLeft)) {
|
|
a.style.left = parseInt(g.inputLeft) + "px"
|
|
}
|
|
if (!isNaN(g.inputTop)) {
|
|
a.style.top = parseInt(g.inputTop) + "px"
|
|
}
|
|
if (g.inputWidth != "auto") {
|
|
if (!isNaN(g.inputWidth)) {
|
|
a.style.width = parseInt(g.inputWidth) + "px"
|
|
}
|
|
}
|
|
if (!isNaN(g.blockOffset)) {
|
|
c._ofsNested = g.blockOffset
|
|
}
|
|
c._addSubListNode = function() {
|
|
var h = document.createElement("DIV");
|
|
h._inBlcok = true;
|
|
if (typeof(this._ofsNested) != "undefined") {
|
|
h._ofsNested = this._ofsNested
|
|
}
|
|
this.childNodes[0].appendChild(h);
|
|
return h
|
|
};
|
|
if (g.hidden == true) {
|
|
this.hide(c)
|
|
}
|
|
if (g.disabled == true) {
|
|
this.userDisable(c)
|
|
}
|
|
return this
|
|
},
|
|
_setCss: function(a, g, c) {
|
|
a.firstChild.className = "dhxform_obj_" + g + " dhxform_block";
|
|
a.firstChild.style.fontSize = c
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
enable: 1,
|
|
disable: 1,
|
|
isEnabled: 1,
|
|
setWidth: 1,
|
|
getWidth: 1,
|
|
doUnloadNestedLists: 1,
|
|
destruct: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.block[c] = dhtmlXForm.prototype.items.fieldset[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.newcolumn = {
|
|
_index: false
|
|
};
|
|
dhtmlXForm.prototype.items.template = {
|
|
render: function(c, g) {
|
|
var a = (!isNaN(g.rows));
|
|
c._type = "tp";
|
|
c._enabled = true;
|
|
if (g.format) {
|
|
if (typeof(g.format) == "function") {
|
|
c.format = g.format
|
|
}
|
|
if (typeof(window[g.format]) == "function") {
|
|
c.format = window[g.format]
|
|
}
|
|
}
|
|
if (!c.format) {
|
|
c.format = function(h, l) {
|
|
return l
|
|
}
|
|
}
|
|
this.doAddLabel(c, g);
|
|
this.doAddInput(c, g, "DIV", null, true, true, "dhxform_item_template");
|
|
c._value = (g.value || "");
|
|
c.childNodes[1].childNodes[0].innerHTML = c.format(c._idd, c._value);
|
|
return this
|
|
},
|
|
setValue: function(a, c) {
|
|
a._value = c;
|
|
a.childNodes[1].childNodes[0].innerHTML = a.format(a._idd, a._value)
|
|
},
|
|
getValue: function(a) {
|
|
return a._value
|
|
},
|
|
enable: function(a) {
|
|
if (String(a.className).search("disabled") >= 0) {
|
|
a.className = String(a.className).replace(/disabled/gi, "")
|
|
}
|
|
a._enabled = true
|
|
},
|
|
disable: function(a) {
|
|
if (String(a.className).search("disabled") < 0) {
|
|
a.className += " disabled"
|
|
}
|
|
a._enabled = false
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doAddLabel: 1,
|
|
doAddInput: 1,
|
|
destruct: 1,
|
|
doUnloadNestedLists: 1,
|
|
setText: 1,
|
|
getText: 1,
|
|
isEnabled: 1,
|
|
setWidth: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.template[c] = dhtmlXForm.prototype.items.select[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype._ulToObject = function(l, r) {
|
|
var m = [];
|
|
for (var c = 0; c < l.childNodes.length; c++) {
|
|
if (String(l.childNodes[c].tagName || "").toLowerCase() == "li") {
|
|
var g = {};
|
|
var u = l.childNodes[c];
|
|
for (var s = 0; s < r.length; s++) {
|
|
if (u.getAttribute(r[s]) != null) {
|
|
g[String(r[s]).replace("ftype", "type")] = u.getAttribute(r[s])
|
|
}
|
|
}
|
|
if (!g.label) {
|
|
try {
|
|
g.label = u.firstChild.nodeValue
|
|
} catch (o) {}
|
|
}
|
|
var h = u.getElementsByTagName("UL");
|
|
if (h[0] != null) {
|
|
g[(g.type == "select" ? "options" : "list")] = dhtmlXForm.prototype._ulToObject(h[0], r)
|
|
}
|
|
for (var s = 0; s < u.childNodes.length; s++) {
|
|
if (String(u.childNodes[s].tagName || "").toLowerCase() == "userdata") {
|
|
if (!g.userdata) {
|
|
g.userdata = {}
|
|
}
|
|
g.userdata[u.childNodes[s].getAttribute("name")] = u.childNodes[s].firstChild.nodeValue
|
|
}
|
|
}
|
|
m[m.length] = g
|
|
}
|
|
if (String(l.childNodes[c].tagName || "").toLowerCase() == "div") {
|
|
var g = {};
|
|
g.type = "label";
|
|
try {
|
|
g.label = l.childNodes[c].firstChild.nodeValue
|
|
} catch (o) {}
|
|
m[m.length] = g
|
|
}
|
|
}
|
|
return m
|
|
};
|
|
dhtmlXForm.prototype.setUserData = function(l, g, h, a) {
|
|
if (typeof(a) != "undefined") {
|
|
var c = this.doWithItem([l, g], "_getId");
|
|
if (c != null) {
|
|
l = c;
|
|
g = h;
|
|
h = a
|
|
}
|
|
}
|
|
if (!this._userdata) {
|
|
this._userdata = {}
|
|
}
|
|
this._userdata[l] = (this._userdata[l] || {});
|
|
this._userdata[l][g] = h
|
|
};
|
|
dhtmlXForm.prototype.getUserData = function(h, g, a) {
|
|
if (typeof(a) != "undefined") {
|
|
var c = this.doWithItem([h, g], "_getId");
|
|
if (c != null) {
|
|
h = c;
|
|
g = a
|
|
}
|
|
}
|
|
if (this._userdata != null && typeof(this._userdata[h]) != "undefined" && typeof(this._userdata[h][g]) != "undefined") {
|
|
return this._userdata[h][g]
|
|
}
|
|
return ""
|
|
};
|
|
dhtmlXForm.prototype.setRTL = function(a) {
|
|
this._rtl = (a === true ? true : false);
|
|
if (this._rtl) {
|
|
if (String(this.cont).search(/dhxform_rtl/gi) < 0) {
|
|
this.cont.className += " dhxform_rtl"
|
|
}
|
|
} else {
|
|
if (String(this.cont).search(/dhxform_rtl/gi) >= 0) {
|
|
this.cont.className = String(this.cont.className).replace(/dhxform_rtl/gi, "")
|
|
}
|
|
}
|
|
};
|
|
_dhxForm_doClick = function(h, c) {
|
|
if (typeof(c) == "object") {
|
|
var a = c[1];
|
|
c = c[0]
|
|
}
|
|
if (document.createEvent) {
|
|
var g = document.createEvent("MouseEvents");
|
|
g.initEvent(c, true, false);
|
|
h.dispatchEvent(g)
|
|
} else {
|
|
if (document.createEventObject) {
|
|
var g = document.createEventObject();
|
|
g.button = 1;
|
|
h.fireEvent("on" + c, g)
|
|
}
|
|
} if (a) {
|
|
window.setTimeout(function() {
|
|
_dhxForm_doClick(h, a)
|
|
}, 100)
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.setFormData = function(g) {
|
|
for (var c in g) {
|
|
var h = this.getItemType(c);
|
|
switch (h) {
|
|
case "checkbox":
|
|
this[g[c] == true || parseInt(g[c]) == 1 || g[c] == "true" || g[c] == this.getItemValue(c, "realvalue") ? "checkItem" : "uncheckItem"](c);
|
|
break;
|
|
case "radio":
|
|
this.checkItem(c, g[c]);
|
|
break;
|
|
case "input":
|
|
case "textarea":
|
|
case "password":
|
|
case "select":
|
|
case "multiselect":
|
|
case "hidden":
|
|
case "template":
|
|
case "combo":
|
|
case "calendar":
|
|
case "colorpicker":
|
|
case "editor":
|
|
this.setItemValue(c, g[c]);
|
|
break;
|
|
default:
|
|
if (this["setFormData_" + h]) {
|
|
this["setFormData_" + h](c, g[c])
|
|
} else {
|
|
if (!this.hId) {
|
|
this.hId = this._genStr(12)
|
|
}
|
|
this.setUserData(this.hId, c, g[c])
|
|
}
|
|
break
|
|
}
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.getFormData = function(w, m) {
|
|
var c = {};
|
|
var s = this;
|
|
for (var v in this.itemPull) {
|
|
var o = this.itemPull[v]._idd;
|
|
var x = this.itemPull[v]._type;
|
|
if (x == "ch") {
|
|
c[o] = (this.isItemChecked(o) ? this.getItemValue(o) : 0)
|
|
}
|
|
if (x == "ra" && !c[this.itemPull[v]._group]) {
|
|
c[this.itemPull[v]._group] = this.getCheckedValue(this.itemPull[v]._group)
|
|
}
|
|
if (x in {
|
|
se: 1,
|
|
ta: 1,
|
|
pw: 1,
|
|
hd: 1,
|
|
tp: 1,
|
|
fl: 1,
|
|
calendar: 1,
|
|
combo: 1,
|
|
editor: 1,
|
|
colorpicker: 1
|
|
}) {
|
|
c[o] = this.getItemValue(o, w)
|
|
}
|
|
if (this["getFormData_" + x]) {
|
|
c[o] = this["getFormData_" + x](o)
|
|
}
|
|
if (x == "up") {
|
|
var l = this.getItemValue(o);
|
|
for (var h in l) {
|
|
c[h] = l[h]
|
|
}
|
|
}
|
|
if (this.itemPull[v]._list) {
|
|
for (var g = 0; g < this.itemPull[v]._list.length; g++) {
|
|
var n = this.itemPull[v]._list[g].getFormData(w, m);
|
|
for (var u in n) {
|
|
c[u] = n[u]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (!m && this.hId && this._userdata[this.hId]) {
|
|
for (var v in this._userdata[this.hId]) {
|
|
if (!c[v]) {
|
|
c[v] = this._userdata[this.hId][v]
|
|
}
|
|
}
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXForm.prototype.adjustParentSize = function() {
|
|
var l = 0;
|
|
var h = -1;
|
|
for (var m = 0; m < this.base.length; m++) {
|
|
l += this.base[m].firstChild.offsetWidth;
|
|
if (this.base[m].offsetHeight > h) {
|
|
h = this.base[m].offsetHeight
|
|
}
|
|
}
|
|
var g = false;
|
|
try {
|
|
g = (this.cont.parentNode.parentNode.parentNode.parentNode._isCell == true);
|
|
if (g) {
|
|
var a = this.cont.parentNode.parentNode.parentNode.parentNode
|
|
}
|
|
} catch (n) {}
|
|
if (g && typeof(a) != "undefined") {
|
|
if (l > 0) {
|
|
a.setWidth(l + 10)
|
|
}
|
|
if (h > 0) {
|
|
a.setHeight(h + a.firstChild.firstChild.offsetHeight + 5)
|
|
}
|
|
g = a = null;
|
|
return
|
|
}
|
|
var c = false;
|
|
try {
|
|
c = (this.cont.parentNode.parentNode.parentNode._isWindow == true);
|
|
if (c) {
|
|
var o = this.cont.parentNode.parentNode;
|
|
if (typeof(o.callEvent) == "function") {
|
|
this.cont.style.display = "none";
|
|
o.callEvent("_setCellSize", [l + 15, h + 15]);
|
|
this.cont.style.display = ""
|
|
}
|
|
}
|
|
} catch (n) {}
|
|
};
|
|
dhtmlXForm.prototype.reset = function() {
|
|
if (this.callEvent("onBeforeReset", [this.formId, this.getFormData()])) {
|
|
if (this._last_load_data) {
|
|
this.setFormData(this._last_load_data)
|
|
}
|
|
this.callEvent("onAfterReset", [this.formId])
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.send = function(c, n, o, h) {
|
|
if (typeof n == "function") {
|
|
o = n;
|
|
n = "post"
|
|
} else {
|
|
n = (n == "get" ? "get" : "post")
|
|
} if (h !== true && !this.validate()) {
|
|
return
|
|
}
|
|
var m = this.getFormData(true);
|
|
var l = [];
|
|
for (var g in m) {
|
|
l.push(g + "=" + encodeURIComponent(m[g]))
|
|
}
|
|
var a = function(q) {
|
|
if (o) {
|
|
o.call(this, q, q.xmlDoc.responseText)
|
|
}
|
|
};
|
|
if (n == "get") {
|
|
window.dhx4.ajax.get(c + (c.indexOf("?") == -1 ? "?" : "&") + l.join("&"), a)
|
|
} else {
|
|
window.dhx4.ajax.post(c, l.join("&"), a)
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.save = function(a, c) {};
|
|
dhtmlXForm.prototype.dummy = function() {};
|
|
dhtmlXForm.prototype._changeFormId = function(c, a) {
|
|
this.formId = a
|
|
};
|
|
dhtmlXForm.prototype._dp_init = function(a) {
|
|
a._methods = ["dummy", "dummy", "_changeFormId", "dummy"];
|
|
a._getRowData = function(h, c) {
|
|
var g = this.obj.getFormData(true);
|
|
g[this.action_param] = this.obj.getUserData(h, this.action_param);
|
|
return g
|
|
};
|
|
a._clearUpdateFlag = function() {};
|
|
a.attachEvent("onAfterUpdate", function(g, h, l, c) {
|
|
if (h == "inserted" || h == "updated") {
|
|
this.obj.resetDataProcessor("updated");
|
|
this.obj._last_load_data = this.obj.getFormData(true)
|
|
}
|
|
this.obj.callEvent("onAfterSave", [this.obj.formId, c]);
|
|
return true
|
|
});
|
|
a.autoUpdate = false;
|
|
a.setTransactionMode("POST", true);
|
|
this.dp = a;
|
|
this.formId = (new Date()).valueOf();
|
|
this.resetDataProcessor("inserted");
|
|
this.save = function() {
|
|
if (!this.callEvent("onBeforeSave", [this.formId, this.getFormData()])) {
|
|
return
|
|
}
|
|
if (!this.validate()) {
|
|
return
|
|
}
|
|
a.sendData()
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.resetDataProcessor = function(a) {
|
|
if (!this.dp) {
|
|
return
|
|
}
|
|
this.dp.updatedRows = [];
|
|
this.dp._in_progress = [];
|
|
this.dp.setUpdated(this.formId, true, a)
|
|
};
|
|
dhtmlXForm.prototype._ccActivate = function(g, a, c) {
|
|
if (!this._formLS) {
|
|
this._formLS = {}
|
|
}
|
|
if (!this._formLS[g]) {
|
|
this._formLS[g] = {
|
|
input: a,
|
|
value: c
|
|
}
|
|
}
|
|
if (!this._ccActive) {
|
|
this._ccActive = true;
|
|
this._ccDo()
|
|
}
|
|
a = null
|
|
};
|
|
dhtmlXForm.prototype._ccDeactivate = function(a) {
|
|
if (this._ccTm) {
|
|
window.clearTimeout(this._ccTm)
|
|
}
|
|
this._ccActive = false;
|
|
if (this._formLS != null && this._formLS[a] != null) {
|
|
this._formLS[a].input = null;
|
|
this._formLS[a] = null;
|
|
delete this._formLS[a]
|
|
}
|
|
};
|
|
dhtmlXForm.prototype._ccDo = function() {
|
|
if (this._ccTm) {
|
|
window.clearTimeout(this._ccTm)
|
|
}
|
|
for (var c in this._formLS) {
|
|
var l = this._formLS[c].input;
|
|
if (String(l.tagName).toLowerCase() == "select") {
|
|
var g = "";
|
|
if (l.selectedIndex >= 0 && l.selectedIndex < l.options.length) {
|
|
g = l.options[l.selectedIndex].value
|
|
}
|
|
} else {
|
|
var g = l.value
|
|
} if (g != this._formLS[c].value) {
|
|
this._formLS[c].value = g;
|
|
this.callEvent("onInputChange", [l._idd, g, this])
|
|
}
|
|
l = null
|
|
}
|
|
if (this._ccActive) {
|
|
var h = this;
|
|
this._ccTm = window.setTimeout(function() {
|
|
h._ccDo();
|
|
h = null
|
|
}, 100)
|
|
}
|
|
};
|
|
dhtmlXForm.prototype._ccReload = function(c, a) {
|
|
if (this._formLS && this._formLS[c]) {
|
|
this._formLS[c].value = a
|
|
}
|
|
};
|
|
dhtmlXForm.prototype._autoload = function() {
|
|
var c = ["ftype", "name", "value", "label", "check", "checked", "disabled", "text", "rows", "select", "selected", "width", "style", "className", "labelWidth", "labelHeight", "labelLeft", "labelTop", "inputWidth", "inputHeight", "inputLeft", "inputTop", "position", "size"];
|
|
var g = document.getElementsByTagName("UL");
|
|
var h = [];
|
|
for (var n = 0; n < g.length; n++) {
|
|
if (g[n].className == "dhtmlxForm") {
|
|
var m = document.createElement("DIV");
|
|
h[h.length] = {
|
|
nodeUL: g[n],
|
|
nodeForm: m,
|
|
data: dhtmlXForm.prototype._ulToObject(g[n], c),
|
|
name: (g[n].getAttribute("name") || null)
|
|
}
|
|
}
|
|
}
|
|
for (var n = 0; n < h.length; n++) {
|
|
h[n].nodeUL.parentNode.insertBefore(h[n].nodeForm, h[n].nodeUL);
|
|
var o = new dhtmlXForm(h[n].nodeForm, h[n].data);
|
|
if (h[n].name !== null) {
|
|
window[h[n].name] = o
|
|
}
|
|
var l = (h[n].nodeUL.getAttribute("oninit") || null);
|
|
h[n].nodeUL.parentNode.removeChild(h[n].nodeUL);
|
|
h[n].nodeUL = null;
|
|
h[n].nodeForm = null;
|
|
h[n].data = null;
|
|
h[n] = null;
|
|
if (l) {
|
|
if (typeof(l) == "function") {
|
|
l()
|
|
} else {
|
|
if (typeof(window[l]) == "function") {
|
|
window[l]()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("load", dhtmlXForm.prototype._autoload, false)
|
|
} else {
|
|
window.detachEvent("onload", dhtmlXForm.prototype._autoload)
|
|
}
|
|
};
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.addEventListener("load", dhtmlXForm.prototype._autoload, false)
|
|
} else {
|
|
window.attachEvent("onload", dhtmlXForm.prototype._autoload)
|
|
} if (!window.dhtmlxValidation) {
|
|
dhtmlxValidation = function() {};
|
|
dhtmlxValidation.prototype = {
|
|
isEmpty: function(a) {
|
|
return a == ""
|
|
},
|
|
isNotEmpty: function(a) {
|
|
return (a instanceof Array ? a.length > 0 : !a == "")
|
|
},
|
|
isValidBoolean: function(a) {
|
|
return !!a.toString().match(/^(0|1|true|false)$/)
|
|
},
|
|
isValidEmail: function(a) {
|
|
return !!a.toString().match(/(^[a-z0-9]([0-9a-z\-_\.]*)@([0-9a-z_\-\.]*)([.][a-z]{3})$)|(^[a-z]([0-9a-z_\.\-]*)@([0-9a-z_\-\.]*)(\.[a-z]{2,4})$)/i)
|
|
},
|
|
isValidInteger: function(a) {
|
|
return !!a.toString().match(/(^-?\d+$)/)
|
|
},
|
|
isValidNumeric: function(a) {
|
|
return !!a.toString().match(/(^-?\d\d*[\.|,]\d*$)|(^-?\d\d*$)|(^-?[\.|,]\d\d*$)/)
|
|
},
|
|
isValidAplhaNumeric: function(a) {
|
|
return !!a.toString().match(/^[_\-a-z0-9]+$/gi)
|
|
},
|
|
isValidDatetime: function(c) {
|
|
var a = c.toString().match(/^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/);
|
|
return a && !! (a[1] <= 9999 && a[2] <= 12 && a[3] <= 31 && a[4] <= 59 && a[5] <= 59 && a[6] <= 59) || false
|
|
},
|
|
isValidDate: function(a) {
|
|
var c = a.toString().match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
return c && !! (c[1] <= 9999 && c[2] <= 12 && c[3] <= 31) || false
|
|
},
|
|
isValidTime: function(c) {
|
|
var a = c.toString().match(/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/);
|
|
return a && !! (a[1] <= 24 && a[2] <= 59 && a[3] <= 59) || false
|
|
},
|
|
isValidIPv4: function(a) {
|
|
var c = a.toString().match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
return c && !! (c[1] <= 255 && c[2] <= 255 && c[3] <= 255 && c[4] <= 255) || false
|
|
},
|
|
isValidCurrency: function(a) {
|
|
return a.toString().match(/^\$?\s?\d+?([\.,\,]?\d+)?\s?\$?$/) && true || false
|
|
},
|
|
isValidSSN: function(a) {
|
|
return a.toString().match(/^\d{3}\-?\d{2}\-?\d{4}$/) && true || false
|
|
},
|
|
isValidSIN: function(a) {
|
|
return a.toString().match(/^\d{9}$/) && true || false
|
|
}
|
|
};
|
|
dhtmlxValidation = new dhtmlxValidation()
|
|
}
|
|
dhtmlXForm.prototype.addItem = function(g, a, m, h) {
|
|
var c = null;
|
|
if (g instanceof Array) {
|
|
c = g[1];
|
|
g = g[0]
|
|
}
|
|
var l = null;
|
|
if (g != null) {
|
|
var l = this._getParentForm(g, c);
|
|
if (l != null) {
|
|
if (l.item._list == null) {
|
|
if (!a.listParent) {
|
|
a.listParent = l.item._idd
|
|
}
|
|
l.form._addItem("list", l.item._idd, [a], null, l.item._idd, m, h)
|
|
} else {
|
|
l.item._list[0].addItem(null, a, m, h)
|
|
}
|
|
l.form = l.item = null;
|
|
l = null;
|
|
this._autoCheck();
|
|
return
|
|
}
|
|
}
|
|
this._prepareItem(a, m, h);
|
|
this._autoCheck()
|
|
};
|
|
dhtmlXForm.prototype.removeItem = function(c, a) {
|
|
this._removeItem(c, a)
|
|
};
|
|
dhtmlXForm.prototype.removeColumn = function(n, m, h, g) {
|
|
var r = null;
|
|
if (n instanceof Array) {
|
|
r = n[1];
|
|
n = n[0]
|
|
}
|
|
if (n != null) {
|
|
var l = this._getParentForm(n, r);
|
|
if (l != null) {
|
|
if (l.item._list != null && l.item._list[0] != null) {
|
|
l.item._list[0].removeColumn(null, m, h, g)
|
|
}
|
|
l.form = l.item = null;
|
|
l = null
|
|
}
|
|
return
|
|
}
|
|
m = Math.min(Math.max(m, 0), this.cont.childNodes.length - 1);
|
|
if (this.cont.childNodes.length == 1) {
|
|
if (h == true) {
|
|
this._removeItemsInColumn(this.cont.childNodes[m])
|
|
}
|
|
} else {
|
|
if (h == true) {
|
|
this._removeItemsInColumn(this.cont.childNodes[m])
|
|
} else {
|
|
if (!g) {
|
|
var a = m - 1;
|
|
if (a < 0) {
|
|
a = m + 1
|
|
}
|
|
} else {
|
|
var a = m + 1;
|
|
if (a > this.cont.childNodes.length - 1) {
|
|
a = m - 1
|
|
}
|
|
}
|
|
while (this.cont.childNodes[m].childNodes.length > 0) {
|
|
this.cont.childNodes[a].appendChild(this.cont.childNodes[m].childNodes[0])
|
|
}
|
|
}
|
|
var o = [];
|
|
for (var c = 0; c < this.base.length; c++) {
|
|
if (this.cont.childNodes[m] != this.base[c]) {
|
|
o.push(this.base[c])
|
|
}
|
|
}
|
|
this.base = o;
|
|
this.cont.removeChild(this.cont.childNodes[m]);
|
|
this.b_index--;
|
|
o = null
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.getColumnNode = function(g, c) {
|
|
var h = null;
|
|
var a = null;
|
|
if (g instanceof Array) {
|
|
a = g[1];
|
|
g = g[0]
|
|
}
|
|
if (g != null) {
|
|
var l = this._getParentForm(g, a);
|
|
if (l != null) {
|
|
if (l.item._list != null && l.item._list[0] != null && h == null) {
|
|
h = l.item._list[0].getColumnNode(null, c)
|
|
}
|
|
l.form = l.item = null;
|
|
l = null
|
|
}
|
|
return h
|
|
}
|
|
if (c < 0 || c > this.cont.childNodes.length - 1) {
|
|
return null
|
|
}
|
|
return this.cont.childNodes[c]
|
|
};
|
|
dhtmlXForm.prototype._removeItemsInColumn = function(h) {
|
|
var a = [];
|
|
for (var g = 0; g < h.childNodes.length; g++) {
|
|
var c = h.childNodes[g];
|
|
if (c._idd != null && c._type != null) {
|
|
a.push([c._idd, (c._type == "ra" ? c._value : null)])
|
|
}
|
|
c = null
|
|
}
|
|
for (var g = 0; g < a.length; g++) {
|
|
this.removeItem(a[g][0], a[g][1])
|
|
}
|
|
};
|
|
dhtmlXForm.prototype._getParentForm = function(m, l) {
|
|
if (this.itemPull[this.idPrefix + m] != null) {
|
|
return {
|
|
form: this,
|
|
item: this.itemPull[this.idPrefix + m]
|
|
}
|
|
}
|
|
for (var c in this.itemPull) {
|
|
if (this.itemPull[c]._type == "ra" && this.itemPull[c]._group == m && this.itemPull[c]._value == l) {
|
|
return {
|
|
form: this,
|
|
item: this.itemPull[c]
|
|
}
|
|
}
|
|
}
|
|
var h = null;
|
|
for (var c in this.itemPull) {
|
|
if (!h && this.itemPull[c]._list != null) {
|
|
for (var g = 0; g < this.itemPull[c]._list.length; g++) {
|
|
if (!h) {
|
|
h = this.itemPull[c]._list[g]._getParentForm(m, l)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return h
|
|
};
|
|
(function() {
|
|
for (var c in dhtmlXForm.prototype.items) {
|
|
if (!dhtmlXForm.prototype.items[c]._getItemNode) {
|
|
dhtmlXForm.prototype.items[c]._getItemNode = function(a) {
|
|
return a
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype._getItemNode = function(c, a) {
|
|
if (a != null) {
|
|
c = [c, a]
|
|
}
|
|
return this.doWithItem(c, "_getItemNode")
|
|
};
|
|
dhtmlXForm.prototype.setRequired = function(o, m, l) {
|
|
if (typeof(l) == "undefined") {
|
|
l = m
|
|
} else {
|
|
o = [o, m]
|
|
}
|
|
var g = this._getItemNode(o);
|
|
if (!g) {
|
|
return
|
|
}
|
|
l = window.dhx4.s2b(l);
|
|
g._required = (l == true);
|
|
if (g._required) {
|
|
if (!g._validate) {
|
|
g._validate = []
|
|
}
|
|
var c = false;
|
|
for (var h = 0; h < g._validate.length; h++) {
|
|
c = (g._validate[h] == "NotEmpty" || c)
|
|
}
|
|
if (!c) {
|
|
g._validate.push("NotEmpty")
|
|
}
|
|
var n = g.childNodes[g._ll ? 0 : 1].childNodes[0];
|
|
if (!(n.lastChild && n.lastChild.className && n.lastChild.className.search(/required/) >= 0)) {
|
|
var a = document.createElement("SPAN");
|
|
a.className = "dhxform_item_required";
|
|
a.innerHTML = "*";
|
|
n.appendChild(a);
|
|
a = n = null
|
|
}
|
|
} else {
|
|
if (g._validate != null) {
|
|
var c = g._validate;
|
|
g._validate = [];
|
|
for (var h = 0; h < c.length; h++) {
|
|
if (c[h] != "NotEmpty") {
|
|
g._validate.push(c[h])
|
|
}
|
|
}
|
|
if (g._validate.length == 0) {
|
|
g._validate = null
|
|
}
|
|
}
|
|
var n = g.childNodes[g._ll ? 0 : 1].childNodes[0];
|
|
if (n.lastChild && n.lastChild.className && n.lastChild.className.search(/required/) >= 0) {
|
|
n.removeChild(n.lastChild);
|
|
n = null
|
|
}
|
|
}
|
|
this._resetValidateCss(g);
|
|
g = null
|
|
};
|
|
dhtmlXForm.prototype.setNote = function(l, g, a) {
|
|
if (typeof(a) == "undefined") {
|
|
a = g
|
|
} else {
|
|
l = [l, g]
|
|
}
|
|
var c = this._getItemNode(l);
|
|
if (!c) {
|
|
return
|
|
}
|
|
var h = this._getNoteNode(c);
|
|
if (!h) {
|
|
if (!a.width) {
|
|
a.width = c.childNodes[c._ll ? 1 : 0].childNodes[0].offsetWidth
|
|
}
|
|
h = document.createElement("DIV");
|
|
h.className = "dhxform_note";
|
|
if ({
|
|
ch: 1,
|
|
ra: 1
|
|
}[c._type]) {
|
|
c.childNodes[c._ll ? 1 : 0].insertBefore(h, c.childNodes[c._ll ? 1 : 0].lastChild)
|
|
} else {
|
|
c.childNodes[c._ll ? 1 : 0].appendChild(h)
|
|
}
|
|
}
|
|
h.innerHTML = a.text;
|
|
if (a.width != null) {
|
|
h.style.width = a.width + "px";
|
|
h._w = a.width
|
|
}
|
|
h = null
|
|
};
|
|
dhtmlXForm.prototype.clearNote = function(h, c) {
|
|
if (typeof(c) != "undefined") {
|
|
h = [h, c]
|
|
}
|
|
var a = this._getItemNode(h);
|
|
if (!a) {
|
|
return
|
|
}
|
|
var g = this._getNoteNode(a);
|
|
if (g != null) {
|
|
g.parentNode.removeChild(g);
|
|
g = null
|
|
}
|
|
};
|
|
dhtmlXForm.prototype._getNoteNode = function(a) {
|
|
var g = null;
|
|
for (var c = 0; c < a.childNodes[a._ll ? 1 : 0].childNodes.length; c++) {
|
|
if (String(a.childNodes[a._ll ? 1 : 0].childNodes[c].className).search(/dhxform_note/) >= 0) {
|
|
g = a.childNodes[a._ll ? 1 : 0].childNodes[c]
|
|
}
|
|
}
|
|
a = null;
|
|
return g
|
|
};
|
|
dhtmlXForm.prototype.setValidation = function(m, h, l) {
|
|
if (typeof(note) == "undefined") {
|
|
l = h
|
|
} else {
|
|
m = [m, h]
|
|
}
|
|
var c = this._getItemNode(m);
|
|
if (!c) {
|
|
return
|
|
}
|
|
if (c._validate != null) {
|
|
for (var g = 0; g < c._validate.length; g++) {
|
|
c._validate[g] = null
|
|
}
|
|
}
|
|
c._validate = [];
|
|
if (typeof(l) == "function" || typeof(window[l]) == "function") {
|
|
c._validate = [l]
|
|
} else {
|
|
c._validate = String(l).split(this.separator)
|
|
} if (c._required) {
|
|
var a = false;
|
|
for (var g = 0; g < c._validate.length; g++) {
|
|
a = (c._validate[g] == "NotEmpty" || a)
|
|
}
|
|
if (!a) {
|
|
c._validate.push("NotEmpty")
|
|
}
|
|
}
|
|
c = null
|
|
};
|
|
dhtmlXForm.prototype.clearValidation = function(h, g) {
|
|
if (typeof(g) != "undefined") {
|
|
h = [h, g]
|
|
}
|
|
var a = this._getItemNode(h);
|
|
if (!a) {
|
|
return
|
|
}
|
|
if (a._validate != null) {
|
|
for (var c = 0; c < a._validate.length; c++) {
|
|
a._validate[c] = null
|
|
}
|
|
}
|
|
a._validate = a._required ? ["NotEmpty"] : null;
|
|
a = null
|
|
};
|
|
dhtmlXForm.prototype.reloadOptions = function(a, m) {
|
|
var c = this.getItemType(a);
|
|
if (!{
|
|
select: 1,
|
|
multiselect: 1,
|
|
combo: 1
|
|
}[c]) {
|
|
return
|
|
}
|
|
if (c == "select" || c == "multiselect") {
|
|
var h = this.getOptions(a);
|
|
while (h.length > 0) {
|
|
h.remove(0)
|
|
}
|
|
h.length = 0;
|
|
h = null;
|
|
if (typeof(m) == "string") {
|
|
this.doWithItem(a, "doLoadOptsConnector", m)
|
|
} else {
|
|
if (m instanceof Array) {
|
|
this.doWithItem(a, "doLoadOpts", {
|
|
options: m
|
|
})
|
|
}
|
|
}
|
|
}
|
|
if (c == "combo") {
|
|
var n = this.getCombo(a);
|
|
n.clearAll();
|
|
n.setComboValue("");
|
|
if (typeof(m) == "string") {
|
|
this.doWithItem(a, "doLoadOptsConnector", m)
|
|
} else {
|
|
if (m instanceof Array) {
|
|
var g = null;
|
|
for (var l = 0; l < m.length; l++) {
|
|
if (window.dhx4.s2b(m[l].selected)) {
|
|
g = m[l].value
|
|
}
|
|
}
|
|
n.addOption(m);
|
|
if (g != null) {
|
|
this.setItemValue(a, g)
|
|
}
|
|
n = null
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.setTooltip = function(m, l, h) {
|
|
if (typeof(h) == "undefined") {
|
|
h = l
|
|
} else {
|
|
m = [m, l]
|
|
}
|
|
var c = this._getItemNode(m);
|
|
if (!c) {
|
|
return
|
|
}
|
|
var a = null;
|
|
if (c.childNodes.length == 1) {
|
|
a = c.childNodes[0]
|
|
} else {
|
|
for (var g = 0; g < c.childNodes.length; g++) {
|
|
if (c.childNodes[g].className != null && c.childNodes[g].className.search("dhxform_label") >= 0) {
|
|
a = c.childNodes[g]
|
|
}
|
|
}
|
|
} if (a != null) {
|
|
if (h == null || h.length == 0) {
|
|
a.removeAttribute("title")
|
|
} else {
|
|
a.title = h
|
|
}
|
|
}
|
|
a = null
|
|
};
|
|
dhtmlXForm.prototype.saveBackup = function() {
|
|
if (!this._backup) {
|
|
this._backup = {};
|
|
this._backupId = new Date().getTime()
|
|
}
|
|
this._backup[++this._backupId] = this.getFormData();
|
|
return this._backupId
|
|
};
|
|
dhtmlXForm.prototype.restoreBackup = function(a) {
|
|
if (this._backup != null && this._backup[a] != null) {
|
|
this.setFormData(this._backup[a])
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.clearBackup = function(a) {
|
|
if (this._backup != null && this._backup[a] != null) {
|
|
this._backup[a] = null;
|
|
delete this._backup[a]
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.items.combo = {
|
|
render: function(c, g) {
|
|
c._type = "combo";
|
|
c._enabled = true;
|
|
c._value = null;
|
|
c._newValue = null;
|
|
this.doAddLabel(c, g);
|
|
this.doAddInput(c, g, "SELECT", null, true, true, "dhxform_select");
|
|
this.doAttachEvents(c);
|
|
this.doLoadOpts(c, g);
|
|
c.onselectstart = function(h) {
|
|
return true
|
|
};
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].setAttribute("mode", g.comboType || "");
|
|
if (g.comboImagePath) {
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].setAttribute("imagePath", g.comboImagePath)
|
|
}
|
|
if (g.comboDefaultImage) {
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].setAttribute("defaultImage", g.comboDefaultImage)
|
|
}
|
|
if (g.comboDefaultImageDis) {
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].setAttribute("defaultImageDis", g.comboDefaultImageDis)
|
|
}
|
|
c._combo = new dhtmlXComboFromSelect(c.childNodes[c._ll ? 1 : 0].childNodes[0]);
|
|
c._combo.setSkin(c.getForm().skin);
|
|
c._combo._currentComboValue = c._combo.getSelectedValue();
|
|
c._combo.getInput().id = g.uid;
|
|
var a = this;
|
|
c._combo.attachEvent("onChange", function() {
|
|
a.doOnChange(this)
|
|
});
|
|
if (g.connector) {
|
|
this.doLoadOptsConnector(c, g.connector)
|
|
}
|
|
if (g.filtering) {
|
|
c._combo.enableFilteringMode(true)
|
|
} else {
|
|
if (g.serverFiltering) {
|
|
c._combo.enableFilteringMode(true, g.serverFiltering, g.filterCache, g.filterSubLoad)
|
|
}
|
|
} if (g.readonly == true) {
|
|
this.setReadonly(c, true)
|
|
}
|
|
if (g.style) {
|
|
c._combo.DOMelem_input.style.cssText += g.style
|
|
}
|
|
c._combo.attachEvent("onFocus", function() {
|
|
var h = this.cont.parentNode.parentNode;
|
|
var l = h.getForm();
|
|
if (l.skin == "dhx_terrace" && this.cont.className.search(/combo_in_focus/) < 0) {
|
|
this.cont.className += " combo_in_focus"
|
|
}
|
|
l.callEvent("onFocus", [h._idd]);
|
|
l = h = null
|
|
});
|
|
c._combo.attachEvent("onBlur", function() {
|
|
var h = this.cont.parentNode.parentNode;
|
|
var l = h.getForm();
|
|
if (l.skin == "dhx_terrace" && this.cont.className.search(/combo_in_focus/) >= 0) {
|
|
this.cont.className = this.cont.className.replace(/\s{0,}combo_in_focus/gi, "")
|
|
}
|
|
l.callEvent("onBlur", [h._idd]);
|
|
l = h = null
|
|
});
|
|
return this
|
|
},
|
|
destruct: function(a) {
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].onchange = null;
|
|
a._combo._currentComboValue = null;
|
|
a._combo.unload();
|
|
a._combo = null;
|
|
a._apiChange = null;
|
|
this.d2(a);
|
|
a = null
|
|
},
|
|
doAttachEvents: function(c) {
|
|
var a = this;
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].onchange = function() {
|
|
a.doOnChange(this);
|
|
a.doValidate(this.DOMParent.parentNode.parentNode)
|
|
}
|
|
},
|
|
doValidate: function(a) {
|
|
if (a.getForm().hot_validate) {
|
|
this._validate(a)
|
|
}
|
|
},
|
|
doOnChange: function(c) {
|
|
var a = c.base.parentNode.parentNode.parentNode;
|
|
if (a._apiChange) {
|
|
return
|
|
}
|
|
c._newComboValue = c.getSelectedValue();
|
|
if (c._newComboValue != c._currentComboValue) {
|
|
if (a.checkEvent("onBeforeChange")) {
|
|
if (a.callEvent("onBeforeChange", [a._idd, c._currentComboValue, c._newComboValue]) !== true) {
|
|
window.setTimeout(function() {
|
|
c.setComboValue(c._currentComboValue)
|
|
}, 1);
|
|
return false
|
|
}
|
|
}
|
|
c._currentComboValue = c._newComboValue;
|
|
a.callEvent("onChange", [a._idd, c._currentComboValue])
|
|
}
|
|
a._autoCheck(a._enabled)
|
|
},
|
|
doLoadOptsConnector: function(h, a) {
|
|
var g = this;
|
|
var c = h;
|
|
h._connector_working = true;
|
|
h._apiChange = true;
|
|
h._combo.load(a, function() {
|
|
c.callEvent("onOptionsLoaded", [c._idd]);
|
|
c._connector_working = false;
|
|
if (c._connector_value != null) {
|
|
g.setValue(c, c._connector_value);
|
|
c._connector_value = null
|
|
}
|
|
c._apiChange = false;
|
|
g = c = null
|
|
})
|
|
},
|
|
enable: function(a) {
|
|
if (String(a.className).search("disabled") >= 0) {
|
|
a.className = String(a.className).replace(/disabled/gi, "")
|
|
}
|
|
a._enabled = true;
|
|
a._combo.enable()
|
|
},
|
|
disable: function(a) {
|
|
if (String(a.className).search("disabled") < 0) {
|
|
a.className += " disabled"
|
|
}
|
|
a._enabled = false;
|
|
a._combo.disable()
|
|
},
|
|
getCombo: function(a) {
|
|
return a._combo
|
|
},
|
|
setValue: function(a, c) {
|
|
if (a._connector_working) {
|
|
a._connector_value = c;
|
|
return
|
|
}
|
|
a._apiChange = true;
|
|
a._combo.setComboValue(c);
|
|
a._combo._currentComboValue = a._combo.getActualValue();
|
|
a._apiChange = false
|
|
},
|
|
getValue: function(a) {
|
|
return a._combo.getActualValue()
|
|
},
|
|
setWidth: function(c, a) {
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].style.width = a + "px"
|
|
},
|
|
setReadonly: function(a, c) {
|
|
if (!a._combo) {
|
|
return
|
|
}
|
|
a._combo_ro = c;
|
|
a._combo.readonly(a._combo_ro)
|
|
},
|
|
isReadonly: function(a, c) {
|
|
return a._combo_ro || false
|
|
},
|
|
setFocus: function(a) {
|
|
if (a._enabled) {
|
|
a._combo.setFocus()
|
|
}
|
|
},
|
|
_setCss: function(a, g, c) {
|
|
a._combo.setFontSize(c, c)
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doAddLabel: 1,
|
|
doAddInput: 1,
|
|
doLoadOpts: 1,
|
|
doUnloadNestedLists: 1,
|
|
setText: 1,
|
|
getText: 1,
|
|
isEnabled: 1,
|
|
_checkNoteWidth: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.combo[c] = dhtmlXForm.prototype.items.select[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.combo.d2 = dhtmlXForm.prototype.items.select.destruct;
|
|
dhtmlXForm.prototype.getCombo = function(a) {
|
|
return this.doWithItem(a, "getCombo")
|
|
};
|
|
dhtmlXForm.prototype.items.calendar = {
|
|
render: function(g, l) {
|
|
var c = this;
|
|
g._type = "calendar";
|
|
g._enabled = true;
|
|
var m = navigator.userAgent;
|
|
var a = (m.indexOf("MSIE 6.0") >= 0 || m.indexOf("MSIE 7.0") >= 0 || m.indexOf("MSIE 8.0") >= 0);
|
|
this.doAddLabel(g, l);
|
|
this.doAddInput(g, l, "INPUT", "TEXT", true, true, "dhxform_textarea calendar");
|
|
this.doAttachChangeLS(g);
|
|
if (a) {
|
|
g.childNodes[g._ll ? 1 : 0].childNodes[0].onfocus2 = g.childNodes[g._ll ? 1 : 0].childNodes[0].onfocus;
|
|
g.childNodes[g._ll ? 1 : 0].childNodes[0].onfocus = function() {
|
|
if (this._skipOnFocus == true) {
|
|
this._skipOnFocus = false;
|
|
return
|
|
}
|
|
this.onfocus2.apply(this, arguments)
|
|
}
|
|
}
|
|
g.childNodes[g._ll ? 1 : 0].childNodes[0]._idd = g._idd;
|
|
g.childNodes[g._ll ? 1 : 0].childNodes[0].onblur = function() {
|
|
var n = this.parentNode.parentNode;
|
|
if (n._c.base._formMouseDown) {
|
|
n._c.base._formMouseDown = false;
|
|
this._skipOnFocus = true;
|
|
this.focus();
|
|
this.value = this.value;
|
|
n = null;
|
|
return true
|
|
}
|
|
var o = n.getForm();
|
|
o._ccDeactivate(n._idd);
|
|
c.checkEnteredValue(this.parentNode.parentNode);
|
|
if (o.live_validate) {
|
|
c._validate(n)
|
|
}
|
|
o.callEvent("onBlur", [n._idd]);
|
|
o = n = null
|
|
};
|
|
g._f = (l.dateFormat || null);
|
|
g._f0 = (l.serverDateFormat || g._f);
|
|
var h = g.getForm();
|
|
g._c = new dhtmlXCalendarObject(g.childNodes[g._ll ? 1 : 0].childNodes[0], l.skin || h.skin || "dhx_skyblue");
|
|
g._c._nullInInput = true;
|
|
g._c.enableListener(g.childNodes[g._ll ? 1 : 0].childNodes[0]);
|
|
if (g._f != null) {
|
|
g._c.setDateFormat(g._f)
|
|
}
|
|
if (!window.dhx4.s2b(l.enableTime)) {
|
|
g._c.hideTime()
|
|
}
|
|
if (window.dhx4.s2b(l.showWeekNumbers)) {
|
|
g._c.showWeekNumbers()
|
|
}
|
|
if (!isNaN(l.weekStart)) {
|
|
g._c.setWeekStartDay(l.weekStart)
|
|
}
|
|
if (typeof(l.calendarPosition) != "undefined") {
|
|
g._c.setPosition(l.calendarPosition)
|
|
}
|
|
if (l.minutesInterval != null) {
|
|
g._c.setMinutesInterval(l.minutesInterval)
|
|
}
|
|
g._c._itemIdd = g._idd;
|
|
g._c.attachEvent("onBeforeChange", function(n) {
|
|
if (g._value != n) {
|
|
if (g.checkEvent("onBeforeChange")) {
|
|
if (g.callEvent("onBeforeChange", [g._idd, g._value, n]) !== true) {
|
|
return false
|
|
}
|
|
}
|
|
g._tempValue = g._value = n;
|
|
c.setValue(g, n, false);
|
|
g.callEvent("onChange", [this._itemIdd, g._value])
|
|
}
|
|
return true
|
|
});
|
|
g._c.attachEvent("onClick", function() {
|
|
g._tempValue = null
|
|
});
|
|
if (a) {
|
|
g._c.base.onmousedown = function() {
|
|
this._formMouseDown = true;
|
|
return false
|
|
}
|
|
}
|
|
this.setValue(g, l.value);
|
|
h = null;
|
|
return this
|
|
},
|
|
getCalendar: function(a) {
|
|
return a._c
|
|
},
|
|
setSkin: function(a, c) {
|
|
a._c.setSkin(c)
|
|
},
|
|
setValue: function(c, g, a) {
|
|
if (!g || g == null || typeof(g) == "undefined" || g == "") {
|
|
c._value = null;
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].value = ""
|
|
} else {
|
|
c._value = (g instanceof Date ? g : c._c._strToDate(g, c._f0 || c._c._dateFormat));
|
|
c.childNodes[c._ll ? 1 : 0].childNodes[0].value = c._c._dateToStr(c._value, c._f || c._c._dateFormat)
|
|
} if (a !== false) {
|
|
c._c.setDate(c._value)
|
|
}
|
|
},
|
|
getValue: function(c, a) {
|
|
var g = c._tempValue || c._c.getDate();
|
|
if (a === true && g == null) {
|
|
return ""
|
|
}
|
|
return (a === true ? c._c._dateToStr(g, c._f0 || c._c._dateFormat) : g)
|
|
},
|
|
setDateFormat: function(c, a, g) {
|
|
c._f = a;
|
|
c._f0 = (g || c._f);
|
|
c._c.setDateFormat(c._f);
|
|
this.setValue(c, this.getValue(c))
|
|
},
|
|
destruct: function(a) {
|
|
a._c.disableListener(a.childNodes[a._ll ? 1 : 0].childNodes[0]);
|
|
a._c.unload();
|
|
a._c = null;
|
|
try {
|
|
delete a._c
|
|
} catch (c) {}
|
|
a._f = null;
|
|
try {
|
|
delete a._f
|
|
} catch (c) {}
|
|
a._f0 = null;
|
|
try {
|
|
delete a._f0
|
|
} catch (c) {}
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0]._idd = null;
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0].onblur = null;
|
|
this.d2(a);
|
|
a = null
|
|
},
|
|
checkEnteredValue: function(a) {
|
|
this.setValue(a, a._c.getDate())
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doAddLabel: 1,
|
|
doAddInput: 1,
|
|
doUnloadNestedLists: 1,
|
|
setText: 1,
|
|
getText: 1,
|
|
enable: 1,
|
|
disable: 1,
|
|
isEnabled: 1,
|
|
setWidth: 1,
|
|
setReadonly: 1,
|
|
isReadonly: 1,
|
|
setFocus: 1,
|
|
getInput: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.calendar[c] = dhtmlXForm.prototype.items.input[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.calendar.doAttachChangeLS = dhtmlXForm.prototype.items.select.doAttachChangeLS;
|
|
dhtmlXForm.prototype.items.calendar.d2 = dhtmlXForm.prototype.items.input.destruct;
|
|
dhtmlXForm.prototype.getCalendar = function(a) {
|
|
return this.doWithItem(a, "getCalendar")
|
|
};
|
|
dhtmlXForm.prototype.setCalendarDateFormat = function(c, a, g) {
|
|
this.doWithItem(c, "setDateFormat", a, g)
|
|
};
|
|
dhtmlXForm.prototype.items.btn2state = {
|
|
setChecked: function(a, c) {
|
|
a._checked = (c === true ? true : false);
|
|
a.childNodes[a._ll ? 1 : 0].lastChild.className = "dhxform_img " + a._cssName + "_" + (a._checked ? "1" : "0");
|
|
this.doCheckValue(a)
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in dhtmlXForm.prototype.items.checkbox) {
|
|
if (!dhtmlXForm.prototype.items.btn2state[c]) {
|
|
dhtmlXForm.prototype.items.btn2state[c] = dhtmlXForm.prototype.items.checkbox[c]
|
|
}
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.btn2state.render2 = dhtmlXForm.prototype.items.btn2state.render;
|
|
dhtmlXForm.prototype.items.btn2state.render = function(a, c) {
|
|
c._autoInputWidth = false;
|
|
this.render2(a, c);
|
|
a._type = "btn2state";
|
|
a._cssName = (typeof(c.cssName) == "undefined" ? "btn2state" : c.cssName);
|
|
a._updateImgNode = function() {};
|
|
a._doOnFocus = function() {
|
|
a.getForm().callEvent("onFocus", [a._idd])
|
|
};
|
|
a._doOnBlur = function() {
|
|
a.getForm().callEvent("onBlur", [a._idd])
|
|
};
|
|
a._doOnKeyUpDown = function(h, g, l) {
|
|
this.callEvent(h, [this.childNodes[this._ll ? 0 : 1].childNodes[0], g, this._idd])
|
|
};
|
|
this.setChecked(a, a._checked);
|
|
return this
|
|
};
|
|
dhtmlXForm.prototype.setFormData_btn2state = function(a, c) {
|
|
this[c == true || parseInt(c) == 1 || c == "true" || c == this.getItemValue(a) ? "checkItem" : "uncheckItem"](a)
|
|
};
|
|
dhtmlXForm.prototype.getFormData_btn2state = function(a) {
|
|
return (this.isItemChecked(a) ? this.getItemValue(a) : 0)
|
|
};
|
|
dhtmlXForm.prototype.items.colorpicker = {
|
|
colorpicker: {},
|
|
render: function(g, h) {
|
|
var c = this;
|
|
g._type = "colorpicker";
|
|
g._enabled = true;
|
|
this.doAddLabel(g, h);
|
|
this.doAddInput(g, h, "INPUT", "TEXT", true, true, "dhxform_textarea");
|
|
g._value = (h.value || "");
|
|
g.childNodes[g._ll ? 1 : 0].childNodes[0].value = g._value;
|
|
var a = {
|
|
input: g.childNodes[g._ll ? 1 : 0].childNodes[0],
|
|
custom_colors: (window.dhx4.s2b(h.enableCustomColors) == true),
|
|
skin: g.getForm().skin
|
|
};
|
|
this.colorpicker[g._idd] = new dhtmlXColorPicker(a);
|
|
this.colorpicker[g._idd]._nodes[0].valueColor = null;
|
|
this.colorpicker[g._idd].base.className += " dhtmlxcp_in_form";
|
|
if (typeof(h.customColors) != "undefined") {
|
|
this.colorpicker[g._idd].setCustomColors(h.customColors)
|
|
}
|
|
this.colorpicker[g._idd].attachEvent("onSelect", function(l) {
|
|
if (g._value != l) {
|
|
if (g.checkEvent("onBeforeChange")) {
|
|
if (g.callEvent("onBeforeChange", [g._idd, g._value, l]) !== true) {
|
|
g.childNodes[g._ll ? 1 : 0].childNodes[0].value = g._value;
|
|
return
|
|
}
|
|
}
|
|
g._value = l;
|
|
c.setValue(g, l);
|
|
g.callEvent("onChange", [g._idd, g._value])
|
|
}
|
|
});
|
|
this.colorpicker[g._idd].attachEvent("onHide", function(l) {
|
|
var m = g.childNodes[g._ll ? 1 : 0].childNodes[0];
|
|
if (m.value != g._value) {
|
|
m.value = g._value
|
|
}
|
|
m = null
|
|
});
|
|
g.childNodes[g._ll ? 1 : 0].childNodes[0]._idd = g._idd;
|
|
return this
|
|
},
|
|
getColorPicker: function(a) {
|
|
return this.colorpicker[a._idd]
|
|
},
|
|
destruct: function(a) {
|
|
if (this.colorpicker[a._idd].unload) {
|
|
this.colorpicker[a._idd].unload()
|
|
}
|
|
this.colorpicker[a._idd] = null;
|
|
try {
|
|
delete this.colorpicker[a._idd]
|
|
} catch (c) {}
|
|
a.childNodes[a._ll ? 1 : 0].childNodes[0]._idd = null;
|
|
this.d2(a);
|
|
a = null
|
|
},
|
|
setSkin: function(a, c) {
|
|
this.colorpicker[a._idd].setSkin(c)
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doAddLabel: 1,
|
|
doAddInput: 1,
|
|
doUnloadNestedLists: 1,
|
|
setText: 1,
|
|
getText: 1,
|
|
enable: 1,
|
|
disable: 1,
|
|
isEnabled: 1,
|
|
setWidth: 1,
|
|
setReadonly: 1,
|
|
isReadonly: 1,
|
|
setValue: 1,
|
|
getValue: 1,
|
|
updateValue: 1,
|
|
setFocus: 1,
|
|
getInput: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.colorpicker[c] = dhtmlXForm.prototype.items.input[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.colorpicker.d2 = dhtmlXForm.prototype.items.input.destruct;
|
|
dhtmlXForm.prototype.getColorPicker = function(a) {
|
|
return this.doWithItem(a, "getColorPicker")
|
|
};
|
|
dhtmlXForm.prototype.items.container = {
|
|
render: function(a, c) {
|
|
a._type = "container";
|
|
a._enabled = true;
|
|
this.doAddLabel(a, c);
|
|
this.doAddInput(a, c, "DIV", null, true, true, "dhxform_container");
|
|
return this
|
|
},
|
|
getContainer: function(a) {
|
|
return a.childNodes[a._ll ? 1 : 0].childNodes[0]
|
|
},
|
|
enable: function(a) {
|
|
a._enabled = true;
|
|
if (String(a.className).search("disabled") >= 0) {
|
|
a.className = String(a.className).replace(/disabled/gi, "")
|
|
}
|
|
a.callEvent("onEnable", [a._idd])
|
|
},
|
|
disable: function(a) {
|
|
a._enabled = false;
|
|
if (String(a.className).search("disabled") < 0) {
|
|
a.className += " disabled"
|
|
}
|
|
a.callEvent("onDisable", [a._idd])
|
|
},
|
|
doAttachEvents: function() {},
|
|
setValue: function() {},
|
|
getValue: function() {
|
|
return null
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.getContainer = function(a) {
|
|
return this.doWithItem(a, "getContainer")
|
|
};
|
|
(function() {
|
|
for (var c in dhtmlXForm.prototype.items.input) {
|
|
if (!dhtmlXForm.prototype.items.container[c]) {
|
|
dhtmlXForm.prototype.items.container[c] = dhtmlXForm.prototype.items.input[c]
|
|
}
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.editor = {
|
|
editor: {},
|
|
render: function(g, h) {
|
|
var a = (!isNaN(h.rows));
|
|
g._type = "editor";
|
|
g._enabled = true;
|
|
this.doAddLabel(g, h);
|
|
this.doAddInput(g, h, "DIV", null, true, true, "dhxform_item_template");
|
|
g._value = (h.value || "");
|
|
var c = this;
|
|
this.editor[g._idd] = new dhtmlXEditor({
|
|
parent: g.childNodes[g._ll ? 1 : 0].childNodes[0],
|
|
content: g._value
|
|
});
|
|
this.editor[g._idd].attachEvent("onAccess", function(m, n) {
|
|
g.callEvent("_onBeforeEditorAccess", []);
|
|
_dhxForm_doClick(document.body, "click");
|
|
if (m == "blur") {
|
|
c.doOnBlur(g, this);
|
|
g.callEvent("onBlur", [g._idd]);
|
|
if (g.getForm().skin == "dhx_terrace") {
|
|
var l = g.childNodes[g._ll ? 1 : 0].className;
|
|
if (l.indexOf("dhxeditor_focus") >= 0) {
|
|
g.childNodes[g._ll ? 1 : 0].className = (l).replace(/\s{0,}dhxeditor_focus/gi, "")
|
|
}
|
|
}
|
|
} else {
|
|
g.callEvent("onEditorAccess", [g._idd, m, n, this, g.getForm()]);
|
|
g.callEvent("onFocus", [g._idd]);
|
|
if (g.getForm().skin == "dhx_terrace") {
|
|
var l = g.childNodes[g._ll ? 1 : 0].className;
|
|
if (l.indexOf("dhxeditor_focus") == -1) {
|
|
g.childNodes[g._ll ? 1 : 0].className += " dhxeditor_focus"
|
|
}
|
|
}
|
|
}
|
|
});
|
|
this.editor[g._idd].attachEvent("onToolbarClick", function(l) {
|
|
g.callEvent("onEditorToolbarClick", [g._idd, l, this, g.getForm()])
|
|
});
|
|
if (h.readonly) {
|
|
this.setReadonly(g, true)
|
|
}
|
|
g.childNodes[g._ll ? 0 : 1].childNodes[0].removeAttribute("for");
|
|
g.childNodes[g._ll ? 0 : 1].childNodes[0].onclick = function() {
|
|
c.editor[g._idd]._focus()
|
|
};
|
|
return this
|
|
},
|
|
doOnBlur: function(g, c) {
|
|
var a = c.getContent();
|
|
if (g._value != a) {
|
|
if (g.checkEvent("onBeforeChange")) {
|
|
if (g.callEvent("onBeforeChange", [g._idd, g._value, a]) !== true) {
|
|
c.setContent(g._value);
|
|
return
|
|
}
|
|
}
|
|
g._value = a;
|
|
g.callEvent("onChange", [g._idd, a])
|
|
}
|
|
},
|
|
setValue: function(a, c) {
|
|
if (a._value == c) {
|
|
return
|
|
}
|
|
a._value = c;
|
|
this.editor[a._idd].setContent(a._value)
|
|
},
|
|
getValue: function(a) {
|
|
a._value = this.editor[a._idd].getContent();
|
|
return a._value
|
|
},
|
|
enable: function(a) {
|
|
this.editor[a._idd].setReadonly(false);
|
|
this.doEn(a)
|
|
},
|
|
disable: function(a) {
|
|
this.editor[a._idd].setReadonly(true);
|
|
this.doDis(a)
|
|
},
|
|
setReadonly: function(a, c) {
|
|
this.editor[a._idd].setReadonly(c)
|
|
},
|
|
getEditor: function(a) {
|
|
return (this.editor[a._idd] || null)
|
|
},
|
|
destruct: function(a) {
|
|
a.childNodes[a._ll ? 0 : 1].childNodes[0].onclick = null;
|
|
this.editor[a._idd].unload();
|
|
this.editor[a._idd] = null;
|
|
this.d2(a);
|
|
a = null
|
|
},
|
|
setFocus: function(a) {
|
|
this.editor[a._idd]._focus()
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doAddLabel: 1,
|
|
doAddInput: 1,
|
|
doUnloadNestedLists: 1,
|
|
setText: 1,
|
|
getText: 1,
|
|
setWidth: 1,
|
|
isEnabled: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.editor[c] = dhtmlXForm.prototype.items.template[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.items.editor.d2 = dhtmlXForm.prototype.items.select.destruct;
|
|
dhtmlXForm.prototype.items.editor.doEn = dhtmlXForm.prototype.items.select.enable;
|
|
dhtmlXForm.prototype.items.editor.doDis = dhtmlXForm.prototype.items.select.disable;
|
|
dhtmlXForm.prototype.getEditor = function(a) {
|
|
return this.doWithItem(a, "getEditor")
|
|
};
|
|
dhtmlXForm.prototype.items.upload = {
|
|
render: function(c, g) {
|
|
c._type = "up";
|
|
c._enabled = true;
|
|
c._checked = true;
|
|
c.className = g.position + (typeof(g.className) == "string" ? " " + g.className : "");
|
|
var a = document.createElement("DIV");
|
|
c.appendChild(a);
|
|
if (!isNaN(g.inputLeft)) {
|
|
c.style.left = parseInt(g.inputLeft) + "px"
|
|
}
|
|
if (!isNaN(g.inputTop)) {
|
|
c.style.top = parseInt(g.inputTop) + "px"
|
|
}
|
|
if (g.inputWidth != "auto") {
|
|
if (!isNaN(g.inputWidth)) {
|
|
a.style.width = parseInt(g.inputWidth) + "px"
|
|
}
|
|
}
|
|
c._uploader = new dhtmlXFileUploader(a, g.swfPath || "", g.swfUrl || "", g.mode || null, g.swfLogs, g.slXap || "", g.slUrl || "", g.slLogs || "", g.multiple);
|
|
c._uploader.setURL(g.url || "");
|
|
c._uploader.callEvent = c.callEvent;
|
|
if (typeof(g.autoStart) != "undefined") {
|
|
c._uploader.setAutoStart(g.autoStart)
|
|
}
|
|
if (typeof(g.autoRemove) != "undefined") {
|
|
c._uploader.setAutoRemove(g.autoRemove)
|
|
}
|
|
if (typeof(g.titleScreen) != "undefined") {
|
|
c._uploader.enableTitleScreen(g.titleScreen)
|
|
}
|
|
if (typeof(g.titleText) != "undefined") {
|
|
c._uploader.setTitleText(g.titleText)
|
|
}
|
|
if (g.hidden == true) {
|
|
this.hide(c)
|
|
}
|
|
if (g.disabled == true) {
|
|
this.userDisable(c)
|
|
}
|
|
if (!(g.inputHeight == "auto" || parseInt(g.inputHeight) == NaN)) {
|
|
c._uploader.p_files.style.height = parseInt(g.inputHeight) + "px"
|
|
}
|
|
return this
|
|
},
|
|
destruct: function(a) {
|
|
this.doUnloadNestedLists(a);
|
|
a._uploader.callEvent = null;
|
|
a._uploader.unload();
|
|
a._uploader = null;
|
|
a._checked = null;
|
|
a._enabled = null;
|
|
a._idd = null;
|
|
a._type = null;
|
|
a.onselectstart = null;
|
|
a._autoCheck = null;
|
|
a.callEvent = null;
|
|
a.checkEvent = null;
|
|
a.getForm = null;
|
|
while (a.childNodes.length > 0) {
|
|
a.removeChild(a.childNodes[0])
|
|
}
|
|
a.parentNode.removeChild(a);
|
|
a = null
|
|
},
|
|
setText: function(a, c) {},
|
|
getText: function(a) {},
|
|
enable: function(a) {
|
|
a._enabled = true;
|
|
if (String(a.className).search("disabled") >= 0) {
|
|
a.className = String(a.className).replace(/disabled/gi, "")
|
|
}
|
|
a._uploader.enable()
|
|
},
|
|
disable: function(a) {
|
|
a._enabled = false;
|
|
if (String(a.className).search("disabled") < 0) {
|
|
a.className += " disabled"
|
|
}
|
|
a._uploader.disable()
|
|
},
|
|
setWidth: function(c, a) {
|
|
c.childNodes[0].style.width = a + "px";
|
|
c._width = a
|
|
},
|
|
getWidth: function(a) {
|
|
return a._width || parseInt(a.childNodes[0].style.width)
|
|
},
|
|
setValue: function(a) {
|
|
a._uploader.clear()
|
|
},
|
|
getValue: function(m) {
|
|
var h = m._uploader.getData();
|
|
var l = {};
|
|
var g = 0;
|
|
for (var c in h) {
|
|
l[m._idd + "_r_" + g] = h[c].realName;
|
|
l[m._idd + "_s_" + g] = h[c].serverName;
|
|
g++
|
|
}
|
|
l[m._idd + "_count"] = g;
|
|
return l
|
|
},
|
|
getUploader: function(a) {
|
|
return a._uploader
|
|
},
|
|
getStatus: function(a) {
|
|
return a._uploader.getStatus()
|
|
}
|
|
};
|
|
(function() {
|
|
for (var c in {
|
|
doUnloadNestedLists: 1,
|
|
isEnabled: 1
|
|
}) {
|
|
dhtmlXForm.prototype.items.upload[c] = dhtmlXForm.prototype.items.checkbox[c]
|
|
}
|
|
})();
|
|
dhtmlXForm.prototype.setFormData_upload = function(a) {
|
|
this.doWithItem(a, "setValue")
|
|
};
|
|
dhtmlXForm.prototype.getUploader = function(a) {
|
|
return this.doWithItem(a, "getUploader")
|
|
};
|
|
dhtmlXForm.prototype.getUploaderStatus = function(a) {
|
|
return this.doWithItem(a, "getStatus")
|
|
};
|
|
|
|
function dhtmlXFileUploader(p, swfPath, swfUrl, mode, swfLogs, slXap, slUrl, slLogs, multiple) {
|
|
var that = this;
|
|
if (typeof(mode) == "string" && typeof(this[mode]) == "function") {
|
|
this.engine = mode
|
|
} else {
|
|
this.engine = "html4";
|
|
var k = null;
|
|
if (typeof(window.FormData) != "undefined" && typeof(window.XMLHttpRequest) != "undefined") {
|
|
k = new XMLHttpRequest();
|
|
if (typeof(k.upload) == "undefined") {
|
|
k = null
|
|
}
|
|
}
|
|
if (k != null) {
|
|
this.engine = "html5"
|
|
} else {
|
|
if (typeof(window.swfobject) != "undefined" || k === false) {
|
|
var k = swfobject.getFlashPlayerVersion();
|
|
if (k.major >= 10) {
|
|
this.engine = "flash"
|
|
}
|
|
} else {
|
|
this._sl_v = this.getSLVersion();
|
|
if (this._sl_v) {
|
|
this.engine = "sl"
|
|
}
|
|
}
|
|
}
|
|
k = null
|
|
} if (typeof(p) == "string") {
|
|
p = document.getElementById(p)
|
|
}
|
|
this._upload_mp = (typeof(multiple) != "undefined" ? multiple == true : true);
|
|
this._upload_dnd = true;
|
|
this._swf_file_url = swfPath || "";
|
|
this._swf_upolad_url = swfUrl || "";
|
|
this._swf_logs = swfLogs;
|
|
this._sl_xap = slXap;
|
|
this._sl_upload_url = slUrl;
|
|
this._sl_logs = slLogs;
|
|
this.p = document.createElement("DIV");
|
|
this.p.className += " dhx_file_uploader";
|
|
p.appendChild(this.p);
|
|
this.p_files = document.createElement("DIV");
|
|
this.p_files.className = "dhx_upload_files";
|
|
this.p.appendChild(this.p_files);
|
|
this.p_controls = document.createElement("DIV");
|
|
this.p_controls.className = "dhx_upload_controls";
|
|
this.p.appendChild(this.p_controls);
|
|
this._files = {};
|
|
this._items = {};
|
|
this._data = {};
|
|
this._autoStart = false;
|
|
this._autoRemove = false;
|
|
this._titleScreen = true;
|
|
this._enabled = true;
|
|
this._uploaded_count = 0;
|
|
this._initToolbar = function() {
|
|
this.b_opts = {
|
|
info: {
|
|
onclick: null
|
|
},
|
|
browse: {
|
|
onclick: null,
|
|
tooltip: "Browse"
|
|
},
|
|
upload: {
|
|
onclick: function() {
|
|
if (!that._enabled) {
|
|
return
|
|
}
|
|
if (!that._uploading) {
|
|
that._uploadStart()
|
|
}
|
|
},
|
|
tooltip: "Upload"
|
|
},
|
|
cancel: {
|
|
onclick: function() {
|
|
if (!that._enabled) {
|
|
return
|
|
}
|
|
that._uploadStop();
|
|
that._switchButton(false)
|
|
},
|
|
tooltip: "Stop"
|
|
},
|
|
clear: {
|
|
onclick: function() {
|
|
if (!that._enabled) {
|
|
return
|
|
}
|
|
that.clear()
|
|
},
|
|
tooltip: "Clear list"
|
|
}
|
|
};
|
|
this.buttons = {};
|
|
for (var a in this.b_opts) {
|
|
//if(a!=='browse')
|
|
//{
|
|
var k = document.createElement("DIV");
|
|
k.innerHTML = " ";
|
|
k.className = "dhx_file_uploader_button button_" + a;
|
|
k.onclick = this.b_opts[a].onclick;
|
|
if (this.b_opts[a].tooltip) {
|
|
k.title = this.b_opts[a].tooltip
|
|
}
|
|
this.p_controls.appendChild(k);
|
|
this.buttons[a] = k;
|
|
k = null
|
|
//}
|
|
}
|
|
this.buttons.cancel.style.display = "none"
|
|
};
|
|
this._readableSize = function(t) {
|
|
var i = false;
|
|
var b = ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb"];
|
|
for (var q = 0; q < b.length; q++) {
|
|
if (t > 1024) {
|
|
t = t / 1024
|
|
} else {
|
|
if (i === false) {
|
|
i = q
|
|
}
|
|
}
|
|
}
|
|
if (i === false) {
|
|
i = b.length - 1
|
|
}
|
|
return Math.round(t * 100) / 100 + " " + b[i]
|
|
};
|
|
this._beforeAddFileToList = function(name, size) {
|
|
return (this.callEvent("onBeforeFileAdd", [name, size]) === true)
|
|
};
|
|
this._addFileToList = function(id, name, size, state, progress) {
|
|
this._checkTitleScreen();
|
|
var t = document.createElement("DIV");
|
|
t._idd = id;
|
|
t.className = "dhx_file dhx_file_" + state;
|
|
t.innerHTML = "<div class='dhx_file_param dhx_file_name'> </div><div class='dhx_file_param dhx_file_progress'>" + progress + "%</div><div class='dhx_file_param dhx_file_delete' title='Remove from list'> </div>";
|
|
this.p_files.appendChild(t);
|
|
t.childNodes[0].style.width = t.offsetWidth - 127 + "px";
|
|
this._items[id] = t;
|
|
this._updateFileNameSize(id);
|
|
t.childNodes[2].onclick = function() {
|
|
if (!that._enabled) {
|
|
return
|
|
}
|
|
var id = this.parentNode._idd;
|
|
that._removeFileFromQueue(id)
|
|
};
|
|
this.callEvent("onFileAdd", [name])
|
|
};
|
|
this._removeFileFromList = function(id) {
|
|
if (!this._items[id]) {
|
|
return
|
|
}
|
|
this._items[id].childNodes[2].onclick = null;
|
|
this._items[id].parentNode.removeChild(this._items[id]);
|
|
this._items[id] = null;
|
|
delete this._items[id];
|
|
if (this._data[id]) {
|
|
this._data[id] = null;
|
|
delete this._data[id]
|
|
}
|
|
this._checkTitleScreen()
|
|
};
|
|
this._updateFileNameSize = function(id) {
|
|
this._items[id].childNodes[0].innerHTML = this._files[id].name + (!isNaN(this._files[id].size) ? " (" + this._readableSize(this._files[id].size) + ")" : " ");
|
|
this._items[id].childNodes[0].title = this._files[id].name + (!isNaN(this._files[id].size) ? " (" + this._readableSize(this._files[id].size) + ")" : "")
|
|
};
|
|
this._updateFileInList = function(id, state, progress) {
|
|
if (!this._items[id]) {
|
|
return
|
|
}
|
|
this._items[id].className = "dhx_file dhx_file_" + state;
|
|
this._updateProgress(id, state, progress);
|
|
this._updateFileNameSize(id)
|
|
};
|
|
this._updateProgress = function(id, state, progress) {
|
|
if (state == "uploading" && progress < 100 && this._progress_type == "loader") {
|
|
this._items[id].childNodes[1].className = "dhx_file_param dhx_file_uploading";
|
|
this._items[id].childNodes[1].innerHTML = " "
|
|
} else {
|
|
this._items[id].childNodes[1].className = "dhx_file_param dhx_file_progress";
|
|
this._items[id].childNodes[1].innerHTML = progress + "%"
|
|
}
|
|
this._updateFileNameSize(id)
|
|
};
|
|
this._removeFilesByState = function(state) {
|
|
for (var a in this._files) {
|
|
if (state === true || this._files[a].state == state) {
|
|
this._removeFileFromQueue(a)
|
|
}
|
|
}
|
|
};
|
|
this._switchButton = function(state) {
|
|
if (state == true) {
|
|
this.buttons.upload.style.display = "none";
|
|
this.buttons.cancel.style.display = ""
|
|
} else {
|
|
var t = this._uploaded_count;
|
|
this.buttons.upload.style.display = "";
|
|
this.buttons.cancel.style.display = "none";
|
|
this._uploaded_count = 0;
|
|
if (t > 0) {
|
|
this.callEvent("onUploadComplete", [t])
|
|
}
|
|
}
|
|
};
|
|
this._uploadStart = function() {
|
|
this._switchButton(true);
|
|
if (!this._uploading) {
|
|
for (var a in this._files) {
|
|
if (this._files[a].state == "fail") {
|
|
this._files[a].state = "added";
|
|
this._updateFileInList(a, "added", 0)
|
|
}
|
|
}
|
|
}
|
|
this._uploading = true;
|
|
var t = false;
|
|
for (var a in this._files) {
|
|
if (!t && [this._files[a].state] == "added") {
|
|
t = true;
|
|
this._files[a].state = "uploading";
|
|
this._updateFileInList(a, "uploading", 0);
|
|
this._doUploadFile(a)
|
|
}
|
|
}
|
|
if (!t) {
|
|
this._uploading = false;
|
|
this._switchButton(false)
|
|
}
|
|
};
|
|
this._onUploadSuccess = function(id, serverName, r, extra) {
|
|
if (typeof(r) != "undefined" && this.engine == "flash") {
|
|
dhx4.temp = null;
|
|
try {
|
|
eval("dhx4.temp=" + r.data)
|
|
} catch (e) {
|
|
dhx4.temp = null
|
|
}
|
|
var t = dhx4.temp;
|
|
dhx4.temp = null;
|
|
if (t != null && t.state == true && t.name != null) {
|
|
serverName = t.name;
|
|
if (t.extra != null) {
|
|
extra = t.extra
|
|
}
|
|
} else {
|
|
this._onUploadFail(id, (t != null && t.extra != null ? t.extra : null));
|
|
return
|
|
}
|
|
}
|
|
this._uploaded_count++;
|
|
this._data[id] = {
|
|
realName: this._files[id].name,
|
|
serverName: serverName
|
|
};
|
|
this._files[id].state = "uploaded";
|
|
this._updateFileInList(id, "uploaded", 100);
|
|
this.callEvent("onUploadFile", [this._files[id].name, serverName, extra]);
|
|
if (this._autoRemove) {
|
|
this._removeFileFromQueue(id)
|
|
}
|
|
if (this._uploading) {
|
|
this._uploadStart()
|
|
}
|
|
};
|
|
this._onUploadFail = function(id, extra) {
|
|
this._files[id].state = "fail";
|
|
this._updateFileInList(id, "fail", 0);
|
|
this.callEvent("onUploadFail", [this._files[id].name, extra]);
|
|
if (this._uploading) {
|
|
this._uploadStart()
|
|
}
|
|
};
|
|
this._onUploadAbort = function(id) {
|
|
this._uploading = false;
|
|
this._files[id].state = "added";
|
|
this._updateFileInList(id, "added", 0);
|
|
this.callEvent("onUploadCancel", [this._files[id].name])
|
|
};
|
|
this._checkTitleScreen = function() {
|
|
var k = 0;
|
|
for (var a in this._files) {
|
|
k++
|
|
}
|
|
if (k == 0 && this.p.className.search("dhx_file_uploader_title") < 0 && this._titleScreen) {
|
|
this.p.className += " dhx_file_uploader_title";
|
|
this.buttons.info.innerHTML = this._titleText;
|
|
this.buttons.info.style.width = Math.max(this.p_controls.offsetWidth - 134, 0) + "px"
|
|
}
|
|
if ((k > 0 || !this._titleScreen) && this.p.className.search("dhx_file_uploader_title") >= 0) {
|
|
this.p.className = this.p.className.replace(/dhx_file_uploader_title/g, "");
|
|
this.buttons.info.innerHTML = ""
|
|
}
|
|
};
|
|
this.callEvent = function() {};
|
|
this.upload = function() {
|
|
if (!this._uploading) {
|
|
this._uploadStart()
|
|
}
|
|
};
|
|
this.setAutoStart = function(state) {
|
|
this._autoStart = (state == true)
|
|
};
|
|
this.setAutoRemove = function(state) {
|
|
this._autoRemove = (state == true)
|
|
};
|
|
this.enableTitleScreen = function(state) {
|
|
this._titleScreen = (state == true);
|
|
this._checkTitleScreen()
|
|
};
|
|
this.setTitleText = function(text) {
|
|
this._titleText = text;
|
|
if (this.p.className.search("dhx_file_uploader_title") >= 0) {
|
|
this.buttons.info.innerHTML = this._titleText
|
|
}
|
|
};
|
|
this.setURL = function(url) {
|
|
this._url = url
|
|
};
|
|
this.setSWFURL = function(url) {
|
|
this._swf_upolad_url = url
|
|
};
|
|
this.enable = function() {
|
|
this._enabled = true;
|
|
this.p_files.className = "dhx_upload_files";
|
|
this.p_controls.className = "dhx_upload_controls"
|
|
};
|
|
this.disable = function() {
|
|
this._enabled = false;
|
|
this.p_files.className = "dhx_upload_files dhx_uploader_dis";
|
|
this.p_controls.className = "dhx_upload_controls dhx_uploader_dis"
|
|
};
|
|
this.getStatus = function() {
|
|
var t = 0;
|
|
for (var a in this._files) {
|
|
if (this._files[a].state != "uploaded") {
|
|
return -1
|
|
}
|
|
t = 1
|
|
}
|
|
return t
|
|
};
|
|
this.getData = function() {
|
|
return this._data
|
|
};
|
|
this.clear = function() {
|
|
if (this.callEvent("onBeforeClear", []) !== true) {
|
|
return
|
|
}
|
|
if (this._uploading) {
|
|
that._uploadStop()
|
|
}
|
|
that._switchButton(false);
|
|
that._removeFilesByState(true);
|
|
this.callEvent("onClear", [])
|
|
};
|
|
this.unload = function() {
|
|
this._removeFilesByState(true);
|
|
this._data = null;
|
|
this._files = null;
|
|
this._items = null;
|
|
this._unloadEngine();
|
|
for (var a in this.buttons) {
|
|
this.buttons[a].onclick = null;
|
|
this.buttons[a].parentNode.removeChild(this.buttons[a]);
|
|
this.buttons[a] = null;
|
|
delete this.buttons[a]
|
|
}
|
|
this.buttons = null;
|
|
for (var a in this.b_opts) {
|
|
this.b_opts[a].onclick = null;
|
|
this.b_opts[a] = null;
|
|
delete this.b_opts[a]
|
|
}
|
|
this.b_opts = null;
|
|
this.p_controls.parentNode.removeChild(this.p_controls);
|
|
this.p_files.parentNode.removeChild(this.p_files);
|
|
this.p.className = this.p.className.replace(/dhx_file_uploader_title/gi, "").replace(/dhx_file_uploader/gi, "");
|
|
for (var a in this) {
|
|
this[a] = null
|
|
}
|
|
that = a = null
|
|
};
|
|
var e = new this[this.engine]();
|
|
for (var a in e) {
|
|
this[a] = e[a];
|
|
e[a] = null
|
|
}
|
|
a = e = p = null;
|
|
this._initToolbar();
|
|
this._initEngine();
|
|
this._checkTitleScreen();
|
|
return this
|
|
}
|
|
dhtmlXFileUploader.prototype.html5 = function() {};
|
|
dhtmlXFileUploader.prototype.html5.prototype = {
|
|
_initEngine: function() {
|
|
var c = this;
|
|
this.buttons.browse.onclick = function() {
|
|
if (c._enabled) {
|
|
c.f.click()
|
|
}
|
|
};
|
|
this._progress_type = "percentage";
|
|
var a = window.navigator.userAgent;
|
|
if (a.match(/Windows/gi) != null && a.match(/AppleWebKit/gi) != null && a.match(/Safari/gi) != null) {
|
|
if (a.match(/Version\/5\.1\.5/gi)) {
|
|
this._upload_mp = false
|
|
}
|
|
if (a.match(/Version\/5\.1[^\.\d{1,}]/gi)) {
|
|
this._upload_dnd = false
|
|
}
|
|
if (a.match(/Version\/5\.1\.1/gi)) {
|
|
this._upload_mp = false;
|
|
this._upload_dnd = false
|
|
}
|
|
if (a.match(/Version\/5\.1\.2/gi)) {
|
|
this._upload_dnd = false
|
|
}
|
|
if (a.match(/Version\/5\.1\.7/gi)) {
|
|
this._upload_mp = false
|
|
}
|
|
}
|
|
this._addFileInput();
|
|
if (this._upload_dnd) {
|
|
this.p.ondragenter = function(g) {
|
|
if (!g.dataTransfer) {
|
|
return
|
|
}
|
|
g.stopPropagation();
|
|
g.preventDefault()
|
|
};
|
|
this.p.ondragover = function(g) {
|
|
if (!g.dataTransfer) {
|
|
return
|
|
}
|
|
g.stopPropagation();
|
|
g.preventDefault()
|
|
};
|
|
this.p.ondrop = function(g) {
|
|
if (!g.dataTransfer) {
|
|
return
|
|
}
|
|
g.stopPropagation();
|
|
g.preventDefault();
|
|
if (c._enabled) {
|
|
c._parseFilesInInput(g.dataTransfer.files)
|
|
}
|
|
};
|
|
this._titleText = "Drag-n-Drop files here or<br>click to select files for upload."
|
|
} else {
|
|
this._titleText = "Click to select files for upload."
|
|
}
|
|
},
|
|
_addFileInput: function() {
|
|
if (this.f != null) {
|
|
this.f.onchange = null;
|
|
this.f.parentNode.removeChild(this.f);
|
|
this.f = null
|
|
}
|
|
var a = this;
|
|
this.f = document.createElement("INPUT");
|
|
this.f.type = "file";
|
|
if (this._upload_mp) {
|
|
this.f.multiple = "1"
|
|
}
|
|
this.f.className = "dhx_uploader_input";
|
|
this.p_controls.appendChild(this.f);
|
|
this.f.onchange = function() {
|
|
a._parseFilesInInput(this.files);
|
|
if (window.dhx4.isOpera) {
|
|
a._addFileInput()
|
|
} else {
|
|
this.value = ""
|
|
}
|
|
}
|
|
},
|
|
_doUploadFile: function(id) {
|
|
var that = this;
|
|
if (!this._loader) {
|
|
this._loader = new XMLHttpRequest();
|
|
this._loader.upload.onprogress = function(e) {
|
|
if (that._files[this._idd].state == "uploading") {
|
|
that._updateFileInList(this._idd, "uploading", Math.round(e.loaded * 100 / e.total))
|
|
}
|
|
};
|
|
this._loader.onload = function(e) {
|
|
dhx4.temp = null;
|
|
try {
|
|
eval("dhx4.temp=" + this.responseText)
|
|
} catch (e) {}
|
|
var r = dhx4.temp;
|
|
dhx4.temp = null;
|
|
if (typeof(r) == "object" && r != null && typeof(r.state) != "undefined" && r.state == true) {
|
|
that._onUploadSuccess(this.upload._idd, r.name, null, r.extra);
|
|
r = null
|
|
} else {
|
|
that._onUploadFail(this.upload._idd, (r != null && r.extra != null ? r.extra : null))
|
|
}
|
|
};
|
|
this._loader.onerror = function(e) {
|
|
that._onUploadFail(this.upload._idd)
|
|
};
|
|
this._loader.onabort = function(e) {
|
|
that._onUploadAbort(this.upload._idd)
|
|
}
|
|
}
|
|
this._loader.upload._idd = id;
|
|
var form = new FormData();
|
|
form.append("file", this._files[id].file);
|
|
this._loader.open("POST", this._url + (String(this._url).indexOf("?") < 0 ? "?" : "&") + "mode=html5&dhxr" + new Date().getTime(), true);
|
|
this._loader.setRequestHeader("X-Requested-With", "XMLHttpRequest");
|
|
this._loader.send(form)
|
|
},
|
|
_uploadStop: function() {
|
|
if (!this._uploading || !this._loader) {
|
|
return
|
|
}
|
|
this._loader.abort()
|
|
},
|
|
_parseFilesInInput: function(c) {
|
|
for (var a = 0; a < c.length; a++) {
|
|
this._addFileToQueue(c[a])
|
|
}
|
|
},
|
|
_addFileToQueue: function(a) {
|
|
if (!this._beforeAddFileToList(a.name, a.size)) {
|
|
return
|
|
}
|
|
var c = (a._idd || window.dhx4.newId());
|
|
this._files[c] = {
|
|
file: a,
|
|
name: a.name,
|
|
size: a.size,
|
|
state: "added"
|
|
};
|
|
this._addFileToList(c, a.name, a.size, "added", 0);
|
|
if (this._autoStart && !this._uploading) {
|
|
this._uploadStart(true)
|
|
}
|
|
},
|
|
_removeFileFromQueue: function(h) {
|
|
if (!this._files[h]) {
|
|
return
|
|
}
|
|
var c = this._files[h].name;
|
|
var g = (this._data != null && this._data[h] != null ? this._data[h].serverName : null);
|
|
if (this.callEvent("onBeforeFileRemove", [c, g]) !== true) {
|
|
return
|
|
}
|
|
var a = false;
|
|
if (this._uploading && h == this._loader.upload._idd && this._files[h].state == "uploading") {
|
|
this._uploadStop();
|
|
a = true
|
|
}
|
|
this._files[h].file = null;
|
|
this._files[h].name = null;
|
|
this._files[h].size = null;
|
|
this._files[h].state = null;
|
|
this._files[h] = null;
|
|
delete this._files[h];
|
|
this._removeFileFromList(h);
|
|
this.callEvent("onFileRemove", [c, g]);
|
|
if (a) {
|
|
this._uploadStart()
|
|
}
|
|
},
|
|
_unloadEngine: function() {
|
|
this.buttons.browse.onclick = null;
|
|
this.f.onchange = null;
|
|
this.f.parentNode.removeChild(this.f);
|
|
this.f = null;
|
|
this.p.ondragenter = null;
|
|
this.p.ondragover = null;
|
|
this.p.ondrop = null;
|
|
if (this._loader) {
|
|
this._loader.upload.onprogress = null;
|
|
this._loader.onload = null;
|
|
this._loader.onerror = null;
|
|
this._loader.onabort = null;
|
|
this._loader.upload._idd = null;
|
|
this._loader = null
|
|
}
|
|
this._initEngine = null;
|
|
this._doUploadFile = null;
|
|
this._uploadStop = null;
|
|
this._parseFilesInInput = null;
|
|
this._addFileToQueue = null;
|
|
this._removeFileFromQueue = null;
|
|
this._unloadEngine = null
|
|
}
|
|
};
|
|
dhtmlXFileUploader.prototype.html4 = function() {};
|
|
dhtmlXFileUploader.prototype.html4.prototype = {
|
|
_initEngine: function() {
|
|
this._addForm();
|
|
this._progress_type = "loader";
|
|
this._titleText = "Click button<br>to select files for upload."
|
|
},
|
|
_addForm: function() {
|
|
var a = this;
|
|
var g = window.dhx4.newId();
|
|
if (!this.k) {
|
|
this.k = document.createElement("DIV");
|
|
this.k.className = "dhx_file_form_cont";
|
|
this.buttons.browse.appendChild(this.k);
|
|
this.fr_name = "dhx_file_" + window.dhx4.newId();
|
|
this.k.innerHTML = '<iframe name="' + this.fr_name + '" style="height:0px;width:0px;" frameBorder="0"></iframe>';
|
|
this.fr = this.k.firstChild;
|
|
if (window.navigator.userAgent.indexOf("MSIE") >= 0) {
|
|
this.fr.onreadystatechange = function() {
|
|
if (this.readyState == "complete") {
|
|
a._onLoad()
|
|
}
|
|
}
|
|
} else {
|
|
this.fr.onload = function() {
|
|
a._onLoad()
|
|
}
|
|
}
|
|
}
|
|
var c = document.createElement("DIV");
|
|
c.innerHTML = "<form method='POST' enctype='multipart/form-data' target='" + this.fr_name + "' class='dhx_file_form' name='dhx_file_form_" + window.dhx4.newId() + "'><input type='hidden' name='mode' value='html4'><input type='hidden' name='uid' value='" + g + "'><input type='file' name='file' class='dhx_file_input'></form>";
|
|
this.k.appendChild(c);
|
|
c.firstChild.lastChild._idd = g;
|
|
c.firstChild.lastChild.onchange = function() {
|
|
if (!a._beforeAddFileToList(this.value, null)) {
|
|
return
|
|
}
|
|
a._addFileToQueue(this);
|
|
this.onchange = null;
|
|
this.parentNode.parentNode.style.display = "none";
|
|
a._addForm()
|
|
};
|
|
c = null
|
|
},
|
|
_onLoad: function() {
|
|
if (this._uploading) {
|
|
dhx4.temp = null;
|
|
try {
|
|
eval("dhx4.temp=" + this.fr.contentWindow.document.body.innerHTML)
|
|
} catch (e) {}
|
|
var r = dhx4.temp;
|
|
dhx4.temp = null;
|
|
if (typeof(r) == "object" && r != null) {
|
|
if (typeof(r.state) != "undefined") {
|
|
if (r.state == "cancelled") {
|
|
this._onUploadAbort(this.fr._idd);
|
|
r = null;
|
|
return
|
|
} else {
|
|
if (r.state == true) {
|
|
if (typeof(r.size) != "undefined" && !isNaN(r.size)) {
|
|
this._files[this.fr._idd].size = r.size
|
|
}
|
|
this._onUploadSuccess(this.fr._idd, r.name, null, r.extra);
|
|
r = null;
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this._onUploadFail(this.fr._idd, (r != null && r.extra != null ? r.extra : null))
|
|
}
|
|
},
|
|
_addFileToQueue: function(c) {
|
|
var a = c.value.match(/[^\\\/]*$/g);
|
|
if (a[0] != null) {
|
|
a = a[0]
|
|
} else {
|
|
a = c.value
|
|
}
|
|
this._files[c._idd] = {
|
|
name: a,
|
|
form: c.parentNode,
|
|
node: c.parentNode.parentNode,
|
|
input: c,
|
|
state: "added"
|
|
};
|
|
this._addFileToList(c._idd, c.value, false, "added", 0);
|
|
if (this._autoStart && !this._uploading) {
|
|
this._uploadStart(true)
|
|
}
|
|
},
|
|
_removeFileFromQueue: function(g) {
|
|
var a = this._files[g].name;
|
|
var c = (this._data != null && this._data[g] != null ? this._data[g].serverName : null);
|
|
if (this.callEvent("onBeforeFileRemove", [a, c]) !== true) {
|
|
return
|
|
}
|
|
this._files[g].input.onchange = null;
|
|
this._files[g].form.removeChild(this._files[g].input);
|
|
this._files[g].node.removeChild(this._files[g].form);
|
|
this._files[g].node.parentNode.removeChild(this._files[g].node);
|
|
this._files[g].input = null;
|
|
this._files[g].name = null;
|
|
this._files[g].form = null;
|
|
this._files[g].node = null;
|
|
this._files[g].size = null;
|
|
this._files[g].state = null;
|
|
this._files[g] = null;
|
|
delete this._files[g];
|
|
this._removeFileFromList(g);
|
|
this.callEvent("onFileRemove", [a, c])
|
|
},
|
|
_doUploadFile: function(a) {
|
|
this.fr._idd = a;
|
|
this._files[a].form.action = this._url;
|
|
this._files[a].form.submit()
|
|
},
|
|
_uploadStop: function() {
|
|
if (!this._uploading) {
|
|
return
|
|
}
|
|
this.fr.contentWindow.location.href = (this._url) + (this._url.indexOf("?") < 0 ? "?" : "&") + "mode=html4&action=cancel&dhxr" + new Date().getTime()
|
|
},
|
|
_unloadEngine: function() {
|
|
if (this.k) {
|
|
this.fr_name = null;
|
|
this.fr.onreadystatechange = null;
|
|
this.fr.onload = null;
|
|
this.fr.parentNode.removeChild(this.fr);
|
|
this.fr = null;
|
|
this.k.firstChild.firstChild.lastChild.onchange = null;
|
|
this.k.parentNode.removeChild(this.k);
|
|
this.k = null
|
|
}
|
|
this._initEngine = null;
|
|
this._addForm = null;
|
|
this._onLoad = null;
|
|
this._addFileToQueue = null;
|
|
this._removeFileFromQueue = null;
|
|
this._doUploadFile = null;
|
|
this._uploadStop = null;
|
|
this._unloadEngine = null
|
|
}
|
|
};
|
|
dhtmlXFileUploader.prototype.flash = function() {};
|
|
dhtmlXFileUploader.prototype.flash.prototype = {
|
|
_initEngine: function() {
|
|
if (!window.dhtmlXFileUploaderSWFObjects) {
|
|
window.dhtmlXFileUploaderSWFObjects = {
|
|
items: {},
|
|
callEvent: function(l, g, h) {
|
|
return window.dhtmlXFileUploaderSWFObjects.items[l].uploader[g].apply(window.dhtmlXFileUploaderSWFObjects.items[l].uploader, h)
|
|
}
|
|
}
|
|
}
|
|
var c = this;
|
|
this._swf_obj_id = "dhtmlXFileUploaderSWFObject_" + window.dhx4.newId();
|
|
this._swf_file_url = this._swf_file_url + (this._swf_file_url.indexOf("?") >= 0 ? "&" : "?") + "dhxr" + new Date().getTime();
|
|
this.buttons.browse.innerHTML = "<div id='" + this._swf_obj_id + "' style='width:100%;height:100%;'></div>";
|
|
swfobject.embedSWF(this._swf_file_url, this._swf_obj_id, "100%", "100%", "9", null, {
|
|
ID: this._swf_obj_id,
|
|
enableLogs: this._swf_logs
|
|
}, {
|
|
wmode: "transparent"
|
|
});
|
|
var a = swfobject.getFlashPlayerVersion();
|
|
this._titleText = "Engine successfuly inited<br>Flash Player: " + a.major + "." + a.minor + "." + a.release;
|
|
this._progress_type = "percentage";
|
|
window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id] = {
|
|
id: this._swf_obj_id,
|
|
uploader: this
|
|
}
|
|
},
|
|
_beforeAddFileToQueue: function(a, c) {
|
|
return (this.callEvent("onBeforeFileAdd", [a, c]) === true)
|
|
},
|
|
_addFileToQueue: function(h, c, g) {
|
|
if (window.dhx4.isIE) {
|
|
var a = document.createElement("INPUT");
|
|
a.type = "TEXT";
|
|
a.style.position = "absolute";
|
|
a.style.left = "0px";
|
|
a.style.top = window.dhx4.absTop(this.buttons.browse) + "px";
|
|
a.style.width = "10px";
|
|
document.body.appendChild(a);
|
|
a.focus();
|
|
document.body.removeChild(a);
|
|
a = null
|
|
}
|
|
this._files[h] = {
|
|
name: c,
|
|
size: g,
|
|
state: "added"
|
|
};
|
|
this._addFileToList(h, c, g, "added", 0);
|
|
if (this._autoStart && !this._uploading) {
|
|
this._uploadStart(true)
|
|
}
|
|
},
|
|
_removeFileFromQueue: function(h) {
|
|
if (!this._files[h]) {
|
|
return
|
|
}
|
|
var c = this._files[h].name;
|
|
var g = (this._data != null && this._data[h] != null ? this._data[h].serverName : null);
|
|
if (this.callEvent("onBeforeFileRemove", [c, g]) !== true) {
|
|
return
|
|
}
|
|
var a = false;
|
|
if (this._uploading && this._files[h].state == "uploading") {
|
|
this._uploadStop();
|
|
a = true
|
|
}
|
|
swfobject.getObjectById(this._swf_obj_id).removeFileById(h);
|
|
this._files[h].name = null;
|
|
this._files[h].size = null;
|
|
this._files[h].state = null;
|
|
this._files[h] = null;
|
|
delete this._files[h];
|
|
this._removeFileFromList(h);
|
|
this.callEvent("onFileRemove", [c, g]);
|
|
if (a) {
|
|
this._uploadStart()
|
|
}
|
|
},
|
|
_doUploadFile: function(a) {
|
|
swfobject.getObjectById(this._swf_obj_id).upload(a, this._swf_upolad_url)
|
|
},
|
|
_uploadStop: function(g) {
|
|
for (var c in this._files) {
|
|
if (this._files[c].state == "uploading") {
|
|
swfobject.getObjectById(this._swf_obj_id).uploadStop(c)
|
|
}
|
|
}
|
|
},
|
|
_unloadEngine: function() {
|
|
if (window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id]) {
|
|
window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id].id = null;
|
|
window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id].uploader = null;
|
|
window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id] = null;
|
|
delete window.dhtmlXFileUploaderSWFObjects.items[this._swf_obj_id]
|
|
}
|
|
this._swf_obj_id = null;
|
|
this._initEngine = null;
|
|
this._addFileToQueue = null;
|
|
this._removeFileFromQueue = null;
|
|
this._doUploadFile = null;
|
|
this._uploadStop = null;
|
|
this._unloadEngine = null
|
|
}
|
|
};
|
|
dhtmlXFileUploader.prototype.sl = function() {};
|
|
dhtmlXFileUploader.prototype.sl.prototype = {
|
|
_initEngine: function() {
|
|
if (typeof(this._sl_v) == "undefined") {
|
|
this._sl_v = this.getSLVersion()
|
|
}
|
|
if (!window.dhtmlXFileUploaderSLObjects) {
|
|
window.dhtmlXFileUploaderSLObjects = {
|
|
items: {},
|
|
callEvent: function(g, a, c) {
|
|
window.dhtmlXFileUploaderSLObjects.items[g].uploader[a].apply(window.dhtmlXFileUploaderSLObjects.items[g].uploader, c)
|
|
}
|
|
}
|
|
}
|
|
this._sl_obj_id = "dhtmlXFileUploaderSLObject_" + window.dhx4.newId();
|
|
if (this._sl_v != false) {
|
|
this._titleText = "Engine successfuly inited<br>Silverlight version: " + this._sl_v[0] + "." + this._sl_v[1];
|
|
this.buttons.browse.innerHTML = '<div style="width:100%;height:100%;"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="100%" height="100%" id="' + this._sl_obj_id + '"><param name="source" value="' + this._sl_xap + '"/><param name="background" value="Transparent"/><param name="windowless" value="true"/><param name="initParams" value="SLID=' + this._sl_obj_id + ",LOGS=" + this._sl_logs + '"/><param name="minRuntimeVersion" value="5.0"/></object></div>'
|
|
} else {
|
|
this._titleText = "Silverlight plugin not found<br>or version less than 4.0";
|
|
this.buttons.browse.style.cursor = "wait";
|
|
this.buttons.browse.title = ""
|
|
}
|
|
this._progress_type = "percentage";
|
|
window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id] = {
|
|
id: this._sl_obj_id,
|
|
uploader: this
|
|
}
|
|
},
|
|
_addFileToQueue: function(g, a, c) {
|
|
this._files[g] = {
|
|
name: a,
|
|
size: c,
|
|
state: "added"
|
|
};
|
|
this._addFileToList(g, a, c, "added", 0);
|
|
if (this._autoStart && !this._uploading) {
|
|
this._uploadStart(true)
|
|
}
|
|
},
|
|
_removeFileFromQueue: function(c) {
|
|
if (!this._files[c]) {
|
|
return
|
|
}
|
|
var a = false;
|
|
if (this._uploading && this._files[c].state == "uploading") {
|
|
this._uploadStop();
|
|
a = true
|
|
}
|
|
document.getElementById([this._sl_obj_id]).Content.a.removeFileById(c);
|
|
this._files[c].name = null;
|
|
this._files[c].size = null;
|
|
this._files[c].state = null;
|
|
this._files[c] = null;
|
|
delete this._files[c];
|
|
this._removeFileFromList(c);
|
|
if (a) {
|
|
this._uploadStart()
|
|
}
|
|
},
|
|
_doUploadFile: function(a) {
|
|
document.getElementById(this._sl_obj_id).Content.a.upload(a, this._sl_upload_url, "&mode=sl&dhxr" + new Date().getTime())
|
|
},
|
|
_uploadStop: function(g) {
|
|
this._uploading = false;
|
|
for (var c in this._files) {
|
|
if (this._files[c].state == "uploading") {
|
|
document.getElementById(this._sl_obj_id).Content.a.uploadStop(c)
|
|
}
|
|
}
|
|
},
|
|
_unloadEngine: function() {
|
|
if (window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]) {
|
|
window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id].id = null;
|
|
window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id].uploader = null;
|
|
window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id] = null;
|
|
delete window.dhtmlXFileUploaderSLObjects.items[this._sl_obj_id]
|
|
}
|
|
this._sl_obj_id = null;
|
|
this._initEngine = null;
|
|
this._addFileToQueue = null;
|
|
this._removeFileFromQueue = null;
|
|
this._doUploadFile = null;
|
|
this._uploadStop = null;
|
|
this._unloadEngine = null
|
|
}
|
|
};
|
|
dhtmlXFileUploader.prototype.setSLURL = function(a) {
|
|
this._sl_upload_url = a
|
|
};
|
|
dhtmlXFileUploader.prototype.getSLVersion = function() {
|
|
var a = false;
|
|
if (window.dhx4.isIE) {
|
|
try {
|
|
var c = new ActiveXObject("AgControl.AgControl");
|
|
if (c != null) {
|
|
var l = 4,
|
|
h = 0;
|
|
while (c.isVersionSupported([l, h].join("."))) {
|
|
a = [l, h];
|
|
if (++h > 9) {
|
|
l++;
|
|
h = 0
|
|
}
|
|
}
|
|
}
|
|
c = null
|
|
} catch (g) {}
|
|
} else {
|
|
if (navigator.plugins["Silverlight Plug-In"] != null) {
|
|
a = navigator.plugins["Silverlight Plug-In"].description.split(".")
|
|
}
|
|
}
|
|
return a
|
|
};
|
|
|
|
function dhtmlXAccordion(l, n) {
|
|
var h = this;
|
|
var g = window.dhx4.transDetect();
|
|
this.conf = {
|
|
skin: (n || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxacc") || "dhx_skyblue"),
|
|
icons_path: "",
|
|
multi_mode: false,
|
|
last_opened: null,
|
|
on_active_id: null,
|
|
on_active_click: false,
|
|
size_changed: true,
|
|
def_height: 90,
|
|
total_count: 0,
|
|
hiden_count: 0,
|
|
base_w: null,
|
|
fs_mode: false,
|
|
fs_tm: null,
|
|
fs_base_ofs: {
|
|
w: 2,
|
|
h: 2
|
|
}
|
|
};
|
|
this.conf.tr = {
|
|
prop: g.transProp,
|
|
ev: g.transEv,
|
|
height_open: "height 0.2s cubic-bezier(0.25,0.1,0.25,1)",
|
|
height_close: "height 0.18s cubic-bezier(0.25,0.1,0.25,1)",
|
|
op_open: "opacity 0.16s ease-in",
|
|
op_close: "opacity 0.2s ease-out",
|
|
op_v_open: "1",
|
|
op_v_close: "0.4",
|
|
dnd_top: "top 0.16s"
|
|
};
|
|
this.ofs = {
|
|
m: {},
|
|
s: {},
|
|
def: {
|
|
m: {
|
|
left: 0,
|
|
right: 0,
|
|
first: 0,
|
|
between: 8
|
|
},
|
|
s: {
|
|
left: 0,
|
|
right: 0,
|
|
first: 0,
|
|
between: -1,
|
|
last: 0
|
|
}
|
|
},
|
|
base: {
|
|
s: {},
|
|
m: {}
|
|
},
|
|
skin: {
|
|
dhx_web: {
|
|
s: {
|
|
between: 3
|
|
},
|
|
m: {
|
|
between: 3
|
|
}
|
|
},
|
|
dhx_terrace: {
|
|
m: {
|
|
between: 12,
|
|
left: 0,
|
|
right: 0
|
|
}
|
|
}
|
|
}
|
|
};
|
|
if (navigator.userAgent.indexOf("MSIE") >= 0 || navigator.userAgent.indexOf("Trident") >= 0) {
|
|
this.conf.tr.height_open = this.conf.tr.height_close
|
|
} else {
|
|
this.conf.tr.height_open = this.conf.tr.height_close
|
|
}
|
|
var m = null;
|
|
if (typeof(l) == "object" && !l.tagName) {
|
|
m = {};
|
|
for (var c in l) {
|
|
m[c] = l[c];
|
|
l[c] = null
|
|
}
|
|
l = m.parent;
|
|
m.parent = null
|
|
}
|
|
if (l == document.body) {
|
|
document.documentElement.className += " dhxacc_fullscreen";
|
|
document.body.className += " dhxacc_fullscreen";
|
|
this.conf.fs_mode = true;
|
|
this.base = document.createElement("DIV");
|
|
this.base.className = "dhxacc_base_" + this.conf.skin;
|
|
this.base.style.position = "absolute";
|
|
this.base.style.left = this.conf.fs_base_ofs.w + "px";
|
|
this.base.style.top = this.conf.fs_base_ofs.h + "px";
|
|
document.body.appendChild(this.base)
|
|
} else {
|
|
this.base = (typeof(l) == "string" ? document.getElementById(l) : l);
|
|
l = null;
|
|
this.base.className += " dhxacc_base_" + this.conf.skin;
|
|
while (this.base.childNodes.length > 0) {
|
|
this.base.removeChild(this.base.lastChild)
|
|
}
|
|
} if (this.base._ofs != null) {
|
|
for (var o in this.ofs.base) {
|
|
if (this.base._ofs[o] != null) {
|
|
for (var c in this.base._ofs[o]) {
|
|
this.ofs.base[o][c] = this.base._ofs[o][c]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this._applyOffsets = function() {
|
|
for (var v in this.ofs.def) {
|
|
var s = this.ofs.def[v];
|
|
var u = (this.ofs.skin[this.conf.skin] != null && this.ofs.skin[this.conf.skin][v] != null ? this.ofs.skin[this.conf.skin][v] : null);
|
|
var r = (this.base._ofs != null ? this.base._ofs[v] : null);
|
|
for (var q in s) {
|
|
if (u != null && u[q] != null) {
|
|
this.ofs[v][q] = u[q]
|
|
} else {
|
|
if (r != null && r[q] != null) {
|
|
this.ofs[v][q] = r[q]
|
|
} else {
|
|
this.ofs[v][q] = s[q]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this._applyOffsets();
|
|
this.t = {};
|
|
this.addItem = function(x, w, r, q, v) {
|
|
if (x == null) {
|
|
x = "a" + window.dhx4.newId()
|
|
}
|
|
while (this.t[x] != null) {
|
|
x = "a" + window.dhx4.newId()
|
|
}
|
|
var a = new dhtmlXAccordionCell(x, this);
|
|
a.conf.skin = this.conf.skin;
|
|
a.setText(w);
|
|
if (v != null) {
|
|
a.setIcon(v)
|
|
}
|
|
a.cell._accId = x;
|
|
a.cell.childNodes[a.conf.idx.hdr].onselectstart = function(y) {
|
|
y = y || event;
|
|
if (y.preventDefault) {
|
|
y.preventDefault()
|
|
} else {
|
|
y.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
a.cell.childNodes[a.conf.idx.hdr].onclick = function(A) {
|
|
A = A || event;
|
|
if (A.preventDefault) {
|
|
A.preventDefault()
|
|
} else {
|
|
A.returnValue = false
|
|
} if (h._dnd != null && h._dnd.ofs == true) {
|
|
return
|
|
}
|
|
var y = (A.target || A.srcElement);
|
|
var C = null;
|
|
while (y._accId != this && C == null) {
|
|
if (y._accId != null) {
|
|
C = y._accId
|
|
} else {
|
|
y = y.parentNode
|
|
}
|
|
}
|
|
if (C != null) {
|
|
h._hdrClick(C)
|
|
}
|
|
};
|
|
this.t[x] = {
|
|
cell: a
|
|
};
|
|
this.conf.total_count++;
|
|
if (this.conf.multi_mode) {
|
|
if (typeof(r) == "undefined") {
|
|
r = true
|
|
}
|
|
this.base.appendChild(a.cell);
|
|
a.conf.opened = (r == true);
|
|
if (typeof(q) == "undefined" || q == null || q == "*") {
|
|
if (q == "*") {
|
|
a.conf.h_auto = true
|
|
}
|
|
q = this.conf.def_height
|
|
} else {
|
|
q = Math.max(parseInt(q), 30)
|
|
}
|
|
a._setSize(this.ofs.m.left, 0, this.conf.base_w || this._getAvailItemWidth(), a.conf.opened ? q : a._getHdrHeight());
|
|
a.cell.style.marginTop = (a.cell == this.base.firstChild ? this.ofs.m.first : this.ofs.m.between) + "px";
|
|
if (r != true) {
|
|
a.conf.size.h = q;
|
|
a._adjustCell();
|
|
a.cell.className += " dhx_cell_closed"
|
|
}
|
|
this._adjustOpened();
|
|
if (this._dnd != null) {
|
|
this._dndAttachEvent(x)
|
|
}
|
|
} else {
|
|
r = (this.conf.last_opened == null ? true : window.dhx4.s2b(r));
|
|
var u = this._updateCellsHeight();
|
|
if (this.conf.last_opened != null) {
|
|
if (r) {
|
|
this._closeItem(this.conf.last_opened, false)
|
|
} else {
|
|
var s = this.t[this.conf.last_opened].cell;
|
|
s._setSize(s.conf.size.x, s.conf.size.y, s.conf.size.w, u);
|
|
s = null
|
|
}
|
|
}
|
|
this.base.appendChild(a.cell);
|
|
a.conf.opened = r;
|
|
a.cell.style.marginTop = String(a.cell == this.base.firstChild ? this.ofs.s.first : this.ofs.s.between) + "px";
|
|
a._setSize(this.ofs.s.left, 0, this.conf.base_w || this._getAvailItemWidth(), r ? u : a._getHdrHeight());
|
|
if (r) {
|
|
this.conf.last_opened = x
|
|
} else {
|
|
a.conf.size.h = u;
|
|
a._adjustCell();
|
|
a.cell.className += " dhx_cell_closed"
|
|
}
|
|
}
|
|
a = null;
|
|
return this.t[x].cell
|
|
};
|
|
this.removeItem = function(a) {
|
|
if (!this.t[a]) {
|
|
return
|
|
}
|
|
if (this.conf.last_opened == a) {
|
|
this.conf.last_opened = null
|
|
}
|
|
if (this.conf.on_active_id == a) {
|
|
this.conf.on_active_id = null
|
|
}
|
|
if (this._dnd != null) {
|
|
this._dndClearCell(a)
|
|
}
|
|
this.conf.total_count--;
|
|
if (!this.conf.multi_mode && !this.t[a].cell.conf.visible) {
|
|
this.conf.hiden_count--
|
|
}
|
|
this.t[a].cell._unload();
|
|
this.t[a].cell = null;
|
|
this.t[a] = null;
|
|
delete this.t[a];
|
|
if (!this.conf.unloading) {
|
|
if (!this.conf.multi_mode) {
|
|
this._updateCellsMargin()
|
|
}
|
|
this.setSizes()
|
|
}
|
|
};
|
|
this.cells = function(a) {
|
|
return this.t[a].cell
|
|
};
|
|
this.enableMultiMode = function(a, q) {
|
|
this.conf.multi_mode = true;
|
|
if (!isNaN(q)) {
|
|
this.conf.def_height = q
|
|
}
|
|
if (a == "auto" || a == "scroll") {
|
|
this.base.style.overflowX = "hidden";
|
|
this.base.style.overflowY = a
|
|
} else {
|
|
this.base.style.overflow = "visible"
|
|
}
|
|
};
|
|
this.forEachItem = function(r) {
|
|
for (var q in this.t) {
|
|
if (typeof(r) == "function") {
|
|
r.apply(this, [this.t[q].cell])
|
|
} else {
|
|
if (typeof(r) == "string" && typeof(window[r]) == "function") {
|
|
window[r].apply(this, [this.t[q].cell])
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this._openItem = function(q, a) {
|
|
if (typeof(a) == "undefined") {
|
|
a = true
|
|
}
|
|
if (this.t[q].cell.conf.opened == false) {
|
|
if (this.conf.multi_mode) {
|
|
this.t[q].cell._open(a)
|
|
} else {
|
|
if (this.conf.tr.prop == false) {
|
|
if (this.conf.last_opened != null) {
|
|
this.t[this.conf.last_opened].cell._close(false)
|
|
}
|
|
this.t[q].cell._open(false);
|
|
this.conf.last_opened = q
|
|
} else {
|
|
this.conf.on_active_id = q;
|
|
this.t[q].cell._open(a);
|
|
if (this.conf.last_opened != null) {
|
|
this.t[this.conf.last_opened].cell._close(a)
|
|
}
|
|
this.conf.last_opened = q
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this._closeItem = function(q, a) {
|
|
if (typeof(a) == "undefined") {
|
|
a = true
|
|
}
|
|
if (this.t[q].cell.conf.opened == true) {
|
|
this.t[q].cell._close(a);
|
|
this.conf.last_opened = null
|
|
}
|
|
};
|
|
this._adjustOpened = function() {
|
|
if (this.conf.multi_mode == true) {
|
|
if (this._openCache == null) {
|
|
var u = this._getDynData();
|
|
for (var r in u) {
|
|
this.t[r].cell.conf.size.h = u[r];
|
|
this.t[r].cell.cell.style.height = u[r] + "px"
|
|
}
|
|
} else {
|
|
var v = false;
|
|
for (var r in this._openCache) {
|
|
v = (v || this._openCache[r])
|
|
}
|
|
if (v == true) {
|
|
return
|
|
}
|
|
this._openCache = this._openId = null
|
|
}
|
|
var q = this._getAvailItemWidth();
|
|
for (var r in this.t) {
|
|
var s = true;
|
|
if (q == this.t[r].cell.conf.size.w && (this._openMode == "close" || this.t[r].cell.conf.opened == false)) {
|
|
s = false
|
|
}
|
|
if (s) {
|
|
this.t[r].cell._setWidth(q)
|
|
}
|
|
}
|
|
this._openMode = null
|
|
} else {
|
|
if (this.conf.last_opened != null) {
|
|
var w = this.conf.last_opened;
|
|
this.t[w].cell._setSize(this.t[w].cell.conf.size.x, this.t[w].cell.conf.size.y, this.t[w].cell.conf.size.w, this.t[w].cell.conf.size.h)
|
|
}
|
|
}
|
|
};
|
|
this._getDynData = function(E, D) {
|
|
if (typeof(E) == "undefined" || E == null) {
|
|
E = {}
|
|
}
|
|
if (typeof(D) == "undefined" || D == null) {
|
|
D = {}
|
|
}
|
|
var x = {};
|
|
var C = 0;
|
|
var w = 0;
|
|
var u = 0;
|
|
for (var r = 0; r < this.base.childNodes.length; r++) {
|
|
var s = this.base.childNodes[r]._accId;
|
|
var H = this.t[s].cell;
|
|
if (H.conf.visible == true) {
|
|
var y = this.ofs.m[u == 0 ? "first" : "between"];
|
|
if (E[s] == true || D[s] == true || (H.conf.opened == true && H.conf.h_auto == true)) {
|
|
if (D[s] == true) {
|
|
var A = H._getHdrHeight();
|
|
x[s] = A;
|
|
w += A + y
|
|
} else {
|
|
if (H.conf.h_auto == true) {
|
|
x[s] = true;
|
|
w += y;
|
|
C++
|
|
} else {
|
|
if (E[s] == true) {
|
|
x[s] = H.conf.size.h;
|
|
w += H.conf.size.h + y
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
w += H.cell.offsetHeight + y
|
|
}
|
|
u++
|
|
}
|
|
H = null
|
|
}
|
|
if (C > 0) {
|
|
var v = this.base.offsetHeight - w;
|
|
var w = Math.floor(v / C);
|
|
for (var F in x) {
|
|
if (x[F] == true) {
|
|
if (C > 1) {
|
|
v -= w
|
|
} else {
|
|
w = v
|
|
}
|
|
x[F] = w;
|
|
C--
|
|
}
|
|
}
|
|
}
|
|
return x
|
|
};
|
|
this._adjustBase = function() {
|
|
if (this.conf.fs_mode) {
|
|
this.base.style.width = document.body.offsetWidth - this.conf.fs_base_ofs.w * 2 + "px";
|
|
this.base.style.height = document.body.offsetHeight - this.conf.fs_base_ofs.h * 2 + "px"
|
|
}
|
|
};
|
|
this.setSizes = function() {
|
|
this._adjustBase();
|
|
if (this.conf.multi_mode == true) {
|
|
this._adjustOpened()
|
|
} else {
|
|
this.conf.base_w = null;
|
|
var r = this._updateCellsHeight();
|
|
for (var q in this.t) {
|
|
this.t[q].cell._setSize(this.ofs.s.left, 0, this.conf.base_w || this._getAvailItemWidth(), this.t[q].cell.conf.opened ? r : this.t[q].cell._getHdrHeight());
|
|
if (!this.t[q].cell.conf.opened) {
|
|
this.t[q].cell.conf.size.h = r;
|
|
this.t[q].cell._adjustCell()
|
|
}
|
|
}
|
|
this.conf.size_changed = true
|
|
}
|
|
};
|
|
this.setSkin = function(r) {
|
|
this.base.className = String(this.base.className).replace(new RegExp("\\s{1,}dhxacc_base_" + this.conf.skin + "\\s{0,}$"), " dhxacc_base_" + r);
|
|
this.conf.skin = r;
|
|
for (var q in this.t) {
|
|
this.t[q].cell.conf.cells_cont = null;
|
|
this.t[q].cell.conf.skin = this.conf.skin
|
|
}
|
|
this._applyOffsets();
|
|
this._updateCellsMargin();
|
|
this.setSizes()
|
|
};
|
|
this.setIconsPath = function(a) {
|
|
this.conf.icons_path = a
|
|
};
|
|
this._getAvailItemWidth = function() {
|
|
var q = this.ofs[(this.conf.multi_mode ? "m" : "s")];
|
|
var a = Math.max(this.base.clientWidth - q.left - q.right, 10);
|
|
this.conf.base_w = a;
|
|
q = null;
|
|
return a
|
|
};
|
|
this._updateCellsHeight = function() {
|
|
if (this.conf.multi_mode == true) {
|
|
return
|
|
}
|
|
var s = this.conf.total_count - this.conf.hiden_count;
|
|
var u = this.base.offsetHeight - this.ofs.s.last;
|
|
if (s == 0) {
|
|
return u
|
|
}
|
|
var w = false;
|
|
for (var v = 0; v < this.base.childNodes.length; v++) {
|
|
if (w == false) {
|
|
var x = this.base.childNodes[v]._accId;
|
|
if (this.t[x].cell.conf.visible) {
|
|
u -= this.t[x].cell._getHdrHeight() * (s - 1);
|
|
w = true
|
|
}
|
|
}
|
|
}
|
|
u -= (s - 1) * this.ofs.s.between + this.ofs.s.first;
|
|
for (var r in this.t) {
|
|
if (this.t[r].cell.conf.size != null) {
|
|
this.t[r].cell.conf.size.h = u;
|
|
this.t[r].cell._adjustCell()
|
|
}
|
|
}
|
|
return u
|
|
};
|
|
this._updateCellsMargin = function() {
|
|
var a = 0;
|
|
for (var r = 0; r < this.base.childNodes.length; r++) {
|
|
var s = this.base.childNodes[r]._accId;
|
|
if (this.t[s].cell.conf.visible) {
|
|
this.t[s].cell.cell.style.marginTop = String(this.ofs[this.conf.multi_mode ? "m" : "s"][a++ == 0 ? "first" : "between"]) + "px"
|
|
}
|
|
}
|
|
};
|
|
this._hdrClick = function(q) {
|
|
if (!this.conf.multi_mode && this.t[q].cell.conf.opened) {
|
|
return
|
|
}
|
|
var a = this.t[q].cell.conf.opened;
|
|
if (this.callEvent("onBeforeActive", [q, (a ? false : true)]) !== true) {
|
|
return
|
|
}
|
|
this.conf.on_active_click = true;
|
|
this[a ? "_closeItem" : "_openItem"](q);
|
|
if (this.conf.multi_mode && this.conf.tr.prop == false) {
|
|
this._adjustOpened()
|
|
}
|
|
};
|
|
this.unload = function() {
|
|
this.conf.unloading = true;
|
|
for (var q in this.t) {
|
|
this.removeItem(q)
|
|
}
|
|
this.t = null;
|
|
if (typeof(this._unloadDND) == "function") {
|
|
this._unloadDND()
|
|
}
|
|
if (this.conf.fs_mode) {
|
|
if (this.conf.fs_tm) {
|
|
window.clearTimeout(this.conf.fs_tm)
|
|
}
|
|
if (window.addEventListener) {
|
|
window.removeEventListener("resize", this._doOnResizeStart, false)
|
|
} else {
|
|
window.detachEvent("onresize", this._doOnResizeStart)
|
|
}
|
|
this._doOnResizeStart = null;
|
|
this._doOnResizeEnd = null;
|
|
this.conf.fs_tm = null
|
|
}
|
|
if (this.dhxWins) {
|
|
this.dhxWins.unload();
|
|
this.dhxWins = null
|
|
}
|
|
window.dhx4._eventable(this, "clear");
|
|
window.dhx4._enableDataLoading(this, null, null, null, "clear");
|
|
this.base.className = String(this.base.className).replace(new RegExp("\\s{1,}dhxacc_base_" + this.conf.skin + "\\s{0,}$"), "");
|
|
this.base = null;
|
|
this.ofs = this.conf = null;
|
|
for (var q in this) {
|
|
this[q] = null
|
|
}
|
|
h = null
|
|
};
|
|
this.setOffset = function(a) {
|
|
this.ofs.s.between = a;
|
|
this.ofs.m.between = a;
|
|
this._updateCellsMargin();
|
|
this.setSizes()
|
|
};
|
|
this._initObj = function(r) {
|
|
if (r.skin != null) {
|
|
this.setSkin(r.skin)
|
|
}
|
|
if (window.dhx4.s2b(r.multi_mode)) {
|
|
this.enableMultiMode()
|
|
}
|
|
if (r.icons_path != null) {
|
|
this.setIconsPath(r.icons_path)
|
|
}
|
|
if (r.icon_path != null) {
|
|
this.setIconsPath(r.icon_path)
|
|
}
|
|
if (r.items != null) {
|
|
for (var a = 0; a < r.items.length; a++) {
|
|
this.addItem(r.items[a].id, r.items[a].text, r.items[a].open, r.items[a].height, r.items[a].icon || r.items[a].img)
|
|
}
|
|
}
|
|
if (window.dhx4.s2b(r.dnd) == true && typeof(this.enableDND) == "function") {
|
|
this.enableDND()
|
|
}
|
|
};
|
|
this._xmlToObj = function(v) {
|
|
var s = {
|
|
items: []
|
|
};
|
|
var a = v.getElementsByTagName("accordion")[0];
|
|
if (a.getAttribute("skin") != null) {
|
|
s.skin = a.getAttribute("skin")
|
|
}
|
|
if (a.getAttribute("mode") == "multi") {
|
|
s.multi_mode = true
|
|
}
|
|
if (a.getAttribute("multiMode") != null) {
|
|
s.multi_mode = window.dhx4.s2b(a.getAttribute("multiMode"))
|
|
}
|
|
if (a.getAttribute("iconsPath") != null) {
|
|
s.icons_path = a.getAttribute("iconsPath")
|
|
}
|
|
for (var u = 0; u < a.childNodes.length; u++) {
|
|
var w = a.childNodes[u];
|
|
if (typeof(w.tagName) != "undefined" && String(w.tagName).toLowerCase() == "cell") {
|
|
var r = {};
|
|
if (w.getAttribute("id") != null) {
|
|
r.id = w.getAttribute("id")
|
|
}
|
|
if (w.getAttribute("icon") != null) {
|
|
r.icon = w.getAttribute("icon")
|
|
}
|
|
if (w.getAttribute("height") != null) {
|
|
r.height = w.getAttribute("height")
|
|
}
|
|
if (w.getAttribute("open") != null) {
|
|
r.open = window.dhx4.s2b(w.getAttribute("open"))
|
|
}
|
|
r.text = w.firstChild.nodeValue;
|
|
s.items.push(r)
|
|
}
|
|
w = null
|
|
}
|
|
return s
|
|
};
|
|
window.dhx4._enableDataLoading(this, "_initObj", "_xmlToObj", "accordion", {
|
|
struct: true
|
|
});
|
|
window.dhx4._eventable(this);
|
|
this._callMainEvent = function(q, a) {
|
|
return this.callEvent(q, a)
|
|
};
|
|
this.attachEvent("onActive", function(a) {
|
|
if (this.t[a].cell.dataObj != null && this.t[a].cell.dataType == "editor") {
|
|
this.t[a].cell.dataObj._prepareContent(true)
|
|
}
|
|
if (this.t[a].cell.conf.opened == true) {
|
|
this.t[a].cell._adjustProgress()
|
|
}
|
|
});
|
|
if (this.conf.fs_mode) {
|
|
this._adjustBase();
|
|
this.conf.fs_tm = null;
|
|
this._doOnResizeStart = function() {
|
|
if (h.conf.fs_tm) {
|
|
window.clearTimeout(h.conf.fs_tm)
|
|
}
|
|
h.conf.fs_tm = window.setTimeout(h._doOnResizeEnd, 200)
|
|
};
|
|
this._doOnResizeEnd = function() {
|
|
h.setSizes()
|
|
};
|
|
if (window.addEventListener) {
|
|
window.addEventListener("resize", this._doOnResizeStart, false)
|
|
} else {
|
|
window.attachEvent("onresize", this._doOnResizeStart)
|
|
}
|
|
}
|
|
if (typeof(window.dhtmlXWindows) == "function") {
|
|
this.dhxWins = new dhtmlXWindows();
|
|
this.dhxWins.setSkin(this.conf.skin)
|
|
}
|
|
if (m != null) {
|
|
this._initObj(m);
|
|
m = null
|
|
}
|
|
return this
|
|
}
|
|
|
|
function dhtmlXAccordionCell(h, g) {
|
|
dhtmlXCellObject.apply(this, [h, "_acc"]);
|
|
this.acc = g;
|
|
this.conf.visible = true;
|
|
this.conf.docked = true;
|
|
this.attachEvent("_onCellUnload", function() {
|
|
this._trDetachEv();
|
|
this._unloadDocking();
|
|
this.acc = null;
|
|
this.cell._accObj = null;
|
|
this.cell.childNodes[this.conf.idx.hdr].onselectstart = null;
|
|
this.cell.childNodes[this.conf.idx.hdr].onclick = null;
|
|
this._initHeader = null;
|
|
this._getHdrHeight = null;
|
|
this._setWidth = null;
|
|
this._adjustCell = null;
|
|
this._open = null;
|
|
this._close = null;
|
|
this._isOpened = null;
|
|
this._trInitEv = null;
|
|
this._trAttachEv = null;
|
|
this._trDetachEv = null;
|
|
this._trOnEnd = null;
|
|
this._onActiveCall = null;
|
|
this.setText = null;
|
|
this.getText = null;
|
|
this.setIcon = null;
|
|
this.clearIcon = null;
|
|
this.show = null;
|
|
this.hide = null;
|
|
this.isVisible = null;
|
|
this.setHeight = null;
|
|
this.moveOnTop = null
|
|
});
|
|
this.attachEvent("_onContentLoaded", function() {
|
|
this.acc._callMainEvent("onContentLoaded", arguments)
|
|
});
|
|
this._initHeader();
|
|
this.conf.tr = {};
|
|
for (var c in this.acc.conf.tr) {
|
|
this.conf.tr[c] = this.acc.conf.tr[c]
|
|
}
|
|
if (this.conf.tr.prop != false) {
|
|
this.attachEvent("_onIdxUpdated", function() {
|
|
this._cellSetOpacity((this.conf.opened ? "open" : "close"), false)
|
|
})
|
|
}
|
|
this.open = function() {
|
|
this.acc._openItem(this._idd)
|
|
};
|
|
this.close = function() {
|
|
this.acc._closeItem(this._idd)
|
|
};
|
|
this._setWidth = function(a) {
|
|
if (a != this.conf.size.w) {
|
|
this.conf.size.w = a;
|
|
this.cell.style.width = a + "px"
|
|
}
|
|
this._adjustCell()
|
|
};
|
|
this._adjustCell = function() {
|
|
this._adjustCont();
|
|
if (this.dataObj != null && typeof(this.dataObj.setSizes) == "function") {
|
|
this.dataObj.setSizes()
|
|
}
|
|
};
|
|
this._initDocking();
|
|
return this
|
|
}
|
|
dhtmlXAccordionCell.prototype = new dhtmlXCellObject();
|
|
dhtmlXAccordionCell.prototype._initHeader = function() {
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhx_cell_hdr";
|
|
a.innerHTML = "<div class='dhx_cell_hdr_text'></div><div class='dhx_cell_hdr_arrow'></div>";
|
|
this.cell.insertBefore(a, this.cell.childNodes[this.conf.idx.cont]);
|
|
a = null;
|
|
this.conf.ofs_nodes.t._getHdrHeight = "func";
|
|
this.conf.hdr = {
|
|
visible: true
|
|
};
|
|
this.conf.idx_data.hdr = "dhx_cell_hdr";
|
|
this._updateIdx()
|
|
};
|
|
dhtmlXAccordionCell.prototype._getHdrHeight = function() {
|
|
return this.cell.childNodes[this.conf.idx.hdr].offsetHeight
|
|
};
|
|
dhtmlXAccordionCell.prototype.setText = function(a) {
|
|
this.conf.text = a;
|
|
this.cell.childNodes[this.conf.idx.hdr].firstChild.innerHTML = "<span>" + a + "</span>"
|
|
};
|
|
dhtmlXAccordionCell.prototype.getText = function() {
|
|
return this.conf.text
|
|
};
|
|
dhtmlXAccordionCell.prototype.setIcon = function(g) {
|
|
var c = this.cell.childNodes[this.conf.idx.hdr];
|
|
if (c.firstChild.className != "dhx_cell_hdr_icon") {
|
|
c.firstChild.className += " dhx_cell_hdr_icon";
|
|
var a = document.createElement("IMG");
|
|
a.className = "dhx_cell_hdr_icon";
|
|
c.insertBefore(a, c.firstChild);
|
|
a = null
|
|
}
|
|
c.firstChild.src = this.acc.conf.icons_path + g;
|
|
c = null
|
|
};
|
|
dhtmlXAccordionCell.prototype.clearIcon = function() {
|
|
var a = this.cell.childNodes[this.conf.idx.hdr];
|
|
if (a.firstChild.className == "dhx_cell_hdr_icon") {
|
|
a.removeChild(a.firstChild);
|
|
a.firstChild.className = String(a.firstChild.className).replace(/\s{1,}dhx_cell_hdr_icon/gi, "")
|
|
}
|
|
a = null
|
|
};
|
|
dhtmlXAccordionCell.prototype._open = function(c) {
|
|
var l = {};
|
|
if (this.acc.conf.multi_mode) {
|
|
var h = {};
|
|
h[this._idd] = true;
|
|
l = this.acc._getDynData(h);
|
|
this.acc._openId = this._idd;
|
|
this.acc._openCache = {};
|
|
this.acc._openMode = "open"
|
|
} else {
|
|
l[this._idd] = this.conf.size.h
|
|
}
|
|
for (var g in l) {
|
|
if (this.acc._openCache != null) {
|
|
this.acc._openCache[g] = true
|
|
}
|
|
var m = this.acc.t[g].cell;
|
|
m.cell.className = String(m.cell.className).replace(/\s{1,}dhx_cell_closed/gi, "");
|
|
m.conf.opened = true;
|
|
m._trInitEv("open", c);
|
|
m.conf.size.h = l[g];
|
|
m.cell.style.height = m.conf.size.h + "px";
|
|
m = null
|
|
}
|
|
if (this.conf.tr.prop == false) {
|
|
this.acc._openId = this.acc._openCache = this.acc._openMode = null;
|
|
this._onActiveCall(true)
|
|
}
|
|
};
|
|
dhtmlXAccordionCell.prototype._close = function(c) {
|
|
var h = {};
|
|
if (this.acc.conf.multi_mode) {
|
|
var l = {};
|
|
l[this._idd] = true;
|
|
h = this.acc._getDynData(null, l);
|
|
this.acc._openId = this._idd;
|
|
this.acc._openCache = {};
|
|
this.acc._openMode = "close"
|
|
} else {
|
|
h[this._idd] = this._getHdrHeight()
|
|
}
|
|
for (var g in h) {
|
|
var m = this.acc.t[g].cell;
|
|
if (this.acc._openCache != null) {
|
|
this.acc._openCache[g] = true
|
|
}
|
|
if (g == this._idd) {
|
|
m.cell.className += " dhx_cell_closed";
|
|
m.conf.opened = false;
|
|
m._trInitEv("close", c)
|
|
} else {
|
|
m.conf.size.h = h[g];
|
|
m._adjustCell();
|
|
m._trInitEv("open", c)
|
|
}
|
|
m.cell.style.height = h[g] + "px";
|
|
m = null
|
|
}
|
|
if (this.conf.tr.prop == false) {
|
|
this.acc._openId = this.acc._openCache = this.acc._openMode = null;
|
|
this._onActiveCall(false)
|
|
}
|
|
};
|
|
dhtmlXAccordionCell.prototype.isOpened = function() {
|
|
return (this.conf.opened == true)
|
|
};
|
|
dhtmlXAccordionCell.prototype._trInitEv = function(c, a) {
|
|
if (this.conf.tr.prop == false) {
|
|
return
|
|
}
|
|
this._trAttachEv();
|
|
if (!this.cell._accObj) {
|
|
this.cell._accObj = this.acc
|
|
}
|
|
if (a) {
|
|
this.cell.style[this.conf.tr.prop] = this.conf.tr["height_" + c]
|
|
}
|
|
this._cellSetOpacity(c, a)
|
|
};
|
|
dhtmlXAccordionCell.prototype._trAttachEv = function() {
|
|
if (!this.conf.tr.ev_attached) {
|
|
this.cell._trProp = this.conf.tr.prop;
|
|
this.cell.addEventListener(this.conf.tr.ev, this._trOnEnd, false);
|
|
this.conf.tr.ev_attached = true
|
|
}
|
|
};
|
|
dhtmlXAccordionCell.prototype._trDetachEv = function() {
|
|
if (this.conf.tr.ev_attached) {
|
|
this.cell.addEventListener(this.conf.tr.ev, this._trOnEnd, false);
|
|
this.conf.tr.ev_attached = false
|
|
}
|
|
};
|
|
dhtmlXAccordionCell.prototype._trOnEnd = function(a) {
|
|
if (a.stopPropagation) {
|
|
a.stopPropagation()
|
|
}
|
|
if (a.propertyName == "height") {
|
|
this.style[this._trProp] = "";
|
|
if (this._accObj.conf.multi_mode) {
|
|
if (this._accObj._openCache != null) {
|
|
this._accObj._openCache[this._accId] = false
|
|
}
|
|
this._accObj._adjustOpened()
|
|
}
|
|
if (this._accObj.conf.on_active_click == true) {
|
|
if (this._accObj.conf.multi_mode) {
|
|
this._accObj._callMainEvent("onActive", [this._accId, this._accObj.t[this._accId].cell.conf.opened]);
|
|
this._accObj.conf.on_active_click = false
|
|
} else {
|
|
this._accObj._callMainEvent("onActive", [this._accObj.conf.on_active_id, true]);
|
|
this._accObj.conf.on_active_id = null;
|
|
this._accObj.conf.on_active_click = false
|
|
}
|
|
}
|
|
this._accObj = null
|
|
}
|
|
};
|
|
dhtmlXAccordionCell.prototype._cellSetOpacity = function(h, c) {
|
|
for (var g in this.conf.idx) {
|
|
if ({
|
|
hdr: true,
|
|
pr1: true,
|
|
pr2: true
|
|
}[g] != true) {
|
|
if (c) {
|
|
this.cell.childNodes[this.conf.idx[g]].style[this.conf.tr.prop] = this.conf.tr["op_" + h]
|
|
}
|
|
this.cell.childNodes[this.conf.idx[g]].style.opacity = this.conf.tr["op_v_" + h]
|
|
}
|
|
}
|
|
};
|
|
dhtmlXAccordionCell.prototype._onActiveCall = function(a) {
|
|
if (this.acc.conf.on_active_click == false) {
|
|
return
|
|
}
|
|
if (this.acc.conf.multi_mode == true) {
|
|
this.acc._callMainEvent("onActive", [this._idd, this.conf.opened]);
|
|
this.acc.conf.on_active_click = false
|
|
} else {
|
|
if (a == true) {
|
|
this.acc._callMainEvent("onActive", [this._idd, true]);
|
|
this.acc.conf.on_active_click = false
|
|
}
|
|
}
|
|
};
|
|
dhtmlXAccordionCell.prototype.show = function() {
|
|
if (this.conf.visible) {
|
|
return
|
|
}
|
|
if (this.conf.docked == false) {
|
|
this.dock();
|
|
return
|
|
}
|
|
this.cell.style.display = "";
|
|
this.conf.visible = true;
|
|
if (!this.acc.conf.multi_mode) {
|
|
this.acc.conf.hiden_count--;
|
|
this.acc._updateCellsHeight();
|
|
this.acc._updateCellsMargin()
|
|
}
|
|
if (this.acc.conf.size_changed) {
|
|
this.acc.setSizes();
|
|
this.acc.conf.size_changed = false
|
|
} else {
|
|
this.acc._adjustOpened()
|
|
}
|
|
};
|
|
dhtmlXAccordionCell.prototype.hide = function() {
|
|
if (!this.conf.visible) {
|
|
return
|
|
}
|
|
if (!this.acc.conf.multi_mode && this.conf.opened) {
|
|
this._close(false);
|
|
this.acc.conf.last_opened = null
|
|
}
|
|
this.cell.style.display = "none";
|
|
this.conf.visible = false;
|
|
if (!this.acc.conf.multi_mode) {
|
|
this.acc.conf.hiden_count++;
|
|
this.acc._updateCellsHeight();
|
|
this.acc._updateCellsMargin()
|
|
}
|
|
this.acc._adjustOpened()
|
|
};
|
|
dhtmlXAccordionCell.prototype.isVisible = function() {
|
|
return (this.conf.visible == true)
|
|
};
|
|
dhtmlXAccordionCell.prototype.setHeight = function(a) {
|
|
if (!this.acc.conf.multi_mode) {
|
|
return
|
|
}
|
|
if (a == "*") {
|
|
this.conf.h_auto = true
|
|
} else {
|
|
this.conf.h_auto = false;
|
|
this.conf.size.h = a
|
|
} if (this.conf.opened) {
|
|
if (a != "*") {
|
|
this.cell.style.height = a + "px"
|
|
}
|
|
this.acc._adjustOpened()
|
|
}
|
|
};
|
|
dhtmlXAccordionCell.prototype.moveOnTop = function() {
|
|
if (this.cell.parentNode.firstChild == this.cell) {
|
|
return
|
|
}
|
|
this.cell.parentNode.insertBefore(this.cell, this.cell.parentNode.firstChild);
|
|
this.acc._updateCellsMargin()
|
|
};
|
|
dhtmlXAccordionCell.prototype._initDocking = function() {
|
|
var a = this;
|
|
this.dock = function() {
|
|
if (this.acc.dhxWins == null || this.conf.docked == true) {
|
|
return
|
|
}
|
|
var c = this.acc.dhxWins.window(this._idd);
|
|
c.close();
|
|
this._attachFromCell(c);
|
|
this.conf.docked = true;
|
|
this.show();
|
|
if (this.conf.dock_opened) {
|
|
this.open()
|
|
}
|
|
c = null;
|
|
this.acc._callMainEvent("onDock", [this._idd])
|
|
};
|
|
this.undock = function(c, n, l, m) {
|
|
if (this.acc.dhxWins == null || this.conf.docked == false) {
|
|
return
|
|
}
|
|
this.conf.dock_opened = this.conf.opened;
|
|
if (this.acc.dhxWins.window(this._idd) != null) {
|
|
var g = this.acc.dhxWins.window(this._idd);
|
|
g.show()
|
|
} else {
|
|
if (c == null) {
|
|
c = 20
|
|
}
|
|
if (n == null) {
|
|
n = 20
|
|
}
|
|
if (l == null) {
|
|
l = 320
|
|
}
|
|
if (m == null) {
|
|
m = 200
|
|
}
|
|
var g = this.acc.dhxWins.createWindow(this._idd, c, n, l, m);
|
|
g.button("close").hide();
|
|
g.addUserButton("dock", 99, "Dock");
|
|
g.button("dock").show();
|
|
g.button("dock").attachEvent("onClick", this._doOnDockClick);
|
|
g.setText(this.getText());
|
|
g.attachEvent("onClose", this._doOnDockWinClose)
|
|
}
|
|
this.conf.docked = false;
|
|
this.hide();
|
|
g._attachFromCell(this);
|
|
g = null;
|
|
this.acc._callMainEvent("onUnDock", [this._idd])
|
|
};
|
|
this._doOnDockClick = function() {
|
|
a.dock()
|
|
};
|
|
this._doOnDockWinClose = function(c) {
|
|
c.hide();
|
|
return false
|
|
};
|
|
this._unloadDocking = function() {
|
|
a = null
|
|
}
|
|
};
|
|
dhtmlXAccordion.prototype.enableDND = function() {
|
|
if (this.conf.multi_mode == false || this._dnd != null) {
|
|
return
|
|
}
|
|
var g = this;
|
|
this._dnd = {
|
|
tr_count: 0,
|
|
tr_items: {}
|
|
};
|
|
this._dndAttachEvent = function(h) {
|
|
var a = this.t[h].cell;
|
|
if (a.conf.dnd_inited != true) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.cell.childNodes[a.conf.idx.hdr].addEventListener("mousedown", this._dndOnMouseDown, false)
|
|
} else {
|
|
a.cell.childNodes[a.conf.idx.hdr].attachEvent("onmousedown", this._dndOnMouseDown)
|
|
}
|
|
a.conf.dnd_inited = true
|
|
}
|
|
a = null
|
|
};
|
|
this._dndDetachEvent = function(h) {
|
|
var a = this.t[h].cell;
|
|
if (a.conf.dnd_inited == true) {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
a.cell.childNodes[a.conf.idx.hdr].removeEventListener("mousedown", this._dndOnMouseDown, false)
|
|
} else {
|
|
a.cell.childNodes[a.conf.idx.hdr].detachEvent("onmousedown", this._dndOnMouseDown)
|
|
}
|
|
a.conf.dnd_inited = false
|
|
}
|
|
a = null
|
|
};
|
|
this._dndOnMouseDown = function(h) {
|
|
h = h || event;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
}
|
|
var a = (h.target || h.srcElement);
|
|
while (a != null && a.parentNode != g.base) {
|
|
a = a.parentNode
|
|
}
|
|
if (a != null) {
|
|
g._dndDragStart(h, a)
|
|
}
|
|
a = null
|
|
};
|
|
this._dndDragStart = function(m, h) {
|
|
if (this._dnd.tr_waiting == true) {
|
|
return
|
|
}
|
|
this._dnd.dragObj = h;
|
|
this._dnd.dy = m.clientY;
|
|
var a = 0;
|
|
for (var l = 0; l < this._dnd.dragObj.parentNode.childNodes.length; l++) {
|
|
this._dnd.dragObj.parentNode.childNodes[l]._ind = l;
|
|
if (this._dnd.dragObj.parentNode.childNodes[l] == this._dnd.dragObj) {
|
|
this._dnd.dragObj._k0 = a;
|
|
if (l > 0) {
|
|
this._dnd.dragObj._k0 += this.ofs.m.between - this.ofs.m.first
|
|
}
|
|
a = 0
|
|
} else {
|
|
a += this._dnd.dragObj.parentNode.childNodes[l].offsetHeight + parseInt(this._dnd.dragObj.parentNode.childNodes[l].style.marginTop)
|
|
}
|
|
}
|
|
this._dnd.dragObj._k1 = a;
|
|
this._dnd.h = this._dnd.dragObj.offsetHeight;
|
|
this._dnd.ofs = false
|
|
};
|
|
this._dndDoDrag = function(v) {
|
|
if (!this._dnd.dragObj) {
|
|
return
|
|
}
|
|
if (this._dnd.tr_waiting == true) {
|
|
return
|
|
}
|
|
var n = v.clientY - this._dnd.dy;
|
|
if (this._dnd.ofs == false && Math.abs(n) > 5) {
|
|
this._dnd.dragObj.className += " acc_cell_dragged";
|
|
this._dnd.ofs = true
|
|
}
|
|
if (n < 0) {
|
|
if (n < -this._dnd.dragObj._k0) {
|
|
n = -this._dnd.dragObj._k0
|
|
}
|
|
} else {
|
|
if (n > this._dnd.dragObj._k1) {
|
|
n = this._dnd.dragObj._k1
|
|
}
|
|
}
|
|
this._dnd.dragObj.style.top = n + "px";
|
|
var u = v.clientY - this._dnd.dy;
|
|
var m = 0;
|
|
var h = 0;
|
|
for (var o = this._dnd.dragObj._ind + 1; o <= this._dnd.dragObj.parentNode.lastChild._ind; o++) {
|
|
var a = this._dnd.dragObj.parentNode.childNodes[o].offsetHeight;
|
|
if (u > m + a * 2 / 3) {
|
|
h++
|
|
}
|
|
m += a
|
|
}
|
|
var l = this._dnd.dragObj.nextSibling;
|
|
var o = 0;
|
|
while (l != null) {
|
|
if (++o <= h && l != null) {
|
|
if (!l._ontop) {
|
|
if (l._tm) {
|
|
window.clearTimeout(l._tm)
|
|
}
|
|
this._dndAnim(l, false, parseInt(l.style.top || 0), -this._dnd.h - this.ofs.m.between);
|
|
l._ontop = true
|
|
}
|
|
} else {
|
|
if (l._ontop) {
|
|
if (l._tm) {
|
|
window.clearTimeout(l._tm)
|
|
}
|
|
this._dndAnim(l, true, parseInt(l.style.top || 0), 0);
|
|
l._ontop = false
|
|
}
|
|
}
|
|
l = l.nextSibling
|
|
}
|
|
var u = this._dnd.dy - v.clientY;
|
|
var m = 0;
|
|
var h = 0;
|
|
for (var o = this._dnd.dragObj._ind - 1; o >= this._dnd.dragObj.parentNode.firstChild._ind; o--) {
|
|
var a = this._dnd.dragObj.parentNode.childNodes[o].offsetHeight;
|
|
if (u > m + a * 2 / 3) {
|
|
h++
|
|
}
|
|
m += a
|
|
}
|
|
var l = this._dnd.dragObj.previousSibling;
|
|
var o = 0;
|
|
while (l != null) {
|
|
if (++o <= h && l != null) {
|
|
if (!l._onbottom) {
|
|
if (l._tm) {
|
|
window.clearTimeout(l._tm)
|
|
}
|
|
this._dndAnim(l, true, parseInt(l.style.top || 0), this._dnd.h + this.ofs.m.between);
|
|
l._onbottom = true
|
|
}
|
|
} else {
|
|
if (l._onbottom) {
|
|
if (l._tm) {
|
|
window.clearTimeout(l._tm)
|
|
}
|
|
this._dndAnim(l, false, parseInt(l.style.top), 0);
|
|
l._onbottom = false
|
|
}
|
|
}
|
|
l = l.previousSibling
|
|
}
|
|
};
|
|
this._dndDragStop = function(r, n) {
|
|
if (n) {} else {
|
|
if (this._dnd.tr_count > 0) {
|
|
this._dnd.tr_waiting = true;
|
|
return
|
|
}
|
|
} if (!this._dnd.dragObj) {
|
|
return
|
|
}
|
|
this._dnd.dragObj.className = String(this._dnd.dragObj.className).replace(/\s{0,}acc_cell_dragged/gi, "");
|
|
this._dnd.dragObj.style.top = "0px";
|
|
var o = false;
|
|
for (var m = 0; m < this._dnd.dragObj.parentNode.childNodes.length; m++) {
|
|
var l = this._dnd.dragObj.parentNode.childNodes[m];
|
|
if (l != this._dnd.dragObj) {
|
|
if (l._tm) {
|
|
window.clearTimeout(l._tm)
|
|
}
|
|
l.style.top = "0px";
|
|
if (l._ontop && ((l.nextSibling != null && l.nextSibling._ontop != true) || !l.nextSibling)) {
|
|
o = (l.nextSibling || null)
|
|
}
|
|
if (l._onbottom && ((l.previousSibling != null && l.previousSibling._onbottom != true) || !l.previousSibling)) {
|
|
o = l
|
|
}
|
|
}
|
|
l = null
|
|
}
|
|
for (var m = 0; m < this._dnd.dragObj.parentNode.childNodes.length; m++) {
|
|
this._dnd.dragObj.parentNode.childNodes[m]._ontop = null;
|
|
this._dnd.dragObj.parentNode.childNodes[m]._onbottom = null
|
|
}
|
|
if (o !== false) {
|
|
if (o == null) {
|
|
this._dnd.dragObj.parentNode.appendChild(this._dnd.dragObj)
|
|
} else {
|
|
this._dnd.dragObj.parentNode.insertBefore(this._dnd.dragObj, o)
|
|
}
|
|
}
|
|
var u = this._dnd.dragObj._accId;
|
|
var h = this._dnd.dragObj._ind;
|
|
var a = h;
|
|
for (var m = 0; m < this._dnd.dragObj.parentNode.childNodes.length; m++) {
|
|
if (this._dnd.dragObj.parentNode.childNodes[m] == this._dnd.dragObj) {
|
|
a = m
|
|
}
|
|
}
|
|
this._dnd.dragObj = null;
|
|
this._dnd.tr_waiting = false;
|
|
this._updateCellsMargin();
|
|
if (h != a) {
|
|
this.setSizes();
|
|
this.callEvent("onDrop", [u, h, a])
|
|
}
|
|
};
|
|
this._dndAnim = function(n, a, m, l) {
|
|
if (this.conf.tr.prop != false) {
|
|
if (!n._dnd_ev) {
|
|
n._dnd_ev = true;
|
|
n._dnd_tr_prop = this.conf.tr.prop;
|
|
n.addEventListener(this.conf.tr.ev, this._dndOnTrEnd, false)
|
|
}
|
|
if (this._dnd.tr_items[n._accId] != true) {
|
|
this._dnd.tr_items[n._accId] = true;
|
|
this._dnd.tr_count++
|
|
}
|
|
n.style[this.conf.tr.prop] = this.conf.tr.dnd_top;
|
|
n.style.top = l + "px";
|
|
return
|
|
}
|
|
var h = false;
|
|
if (a) {
|
|
m += 5;
|
|
if (m >= l) {
|
|
m = l;
|
|
h = true
|
|
}
|
|
} else {
|
|
m -= 5;
|
|
if (m <= l) {
|
|
m = l;
|
|
h = true
|
|
}
|
|
}
|
|
n.style.top = m + "px";
|
|
if (n._tm) {
|
|
window.clearTimeout(n._tm)
|
|
}
|
|
if (!h) {
|
|
n._tm = window.setTimeout(function() {
|
|
g._dndAnim(n, a, m, l)
|
|
}, 5)
|
|
} else {
|
|
n._tm = null
|
|
}
|
|
};
|
|
this._dndOnTrEnd = function(a) {
|
|
if (a.stopPropagation) {
|
|
a.stopPropagation()
|
|
}
|
|
if (a.propertyName == "top") {
|
|
if (g._dnd.tr_items[this._accId] == true) {
|
|
g._dnd.tr_count--;
|
|
g._dnd.tr_items[this._accId] = false
|
|
}
|
|
this.style[this._dnd_tr_prop] = "";
|
|
if (g._dnd.tr_count == 0 && g._dnd.tr_waiting == true) {
|
|
g._dndDragStop(null, true)
|
|
}
|
|
}
|
|
};
|
|
this._dndOnMouseMove = function(a) {
|
|
g._dndDoDrag(a || event)
|
|
};
|
|
this._dndOnMouseUp = function(a) {
|
|
g._dndDragStop(a || event)
|
|
};
|
|
if (window.addEventListener) {
|
|
document.body.addEventListener("mousemove", this._dndOnMouseMove, false);
|
|
document.body.addEventListener("mouseup", this._dndOnMouseUp, false)
|
|
} else {
|
|
document.body.attachEvent("onmousemove", this._dndOnMouseMove, false);
|
|
document.body.attachEvent("onmouseup", this._dndOnMouseUp, false)
|
|
}
|
|
this._dndClearCell = function(a) {
|
|
if (this.t[a].cell.cell._dnd_ev) {
|
|
this.t[a].cell.cell.addEventListener(this.conf.tr.ev, this._dndOnTrEnd, false)
|
|
}
|
|
this._dndDetachEvent(a)
|
|
};
|
|
this._unloadDND = function() {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
document.body.removeEventListener("mousemove", this._dndOnMouseMove, false);
|
|
document.body.removeEventListener("mouseup", this._dndOnMouseUp, false)
|
|
} else {
|
|
document.body.detachEvent("onmousemove", this._dndOnMouseMove, false);
|
|
document.body.detachEvent("onmouseup", this._dndOnMouseUp, false)
|
|
}
|
|
for (var h in this) {
|
|
if (String(h).indexOf("_dnd") == 0 && typeof(this[h]) == "function") {
|
|
this[h] = null
|
|
}
|
|
}
|
|
this._dnd = null;
|
|
g = null
|
|
};
|
|
for (var c in this.t) {
|
|
this._dndAttachEvent(c)
|
|
}
|
|
};
|
|
|
|
function dhtmlXLayoutObject(g, r, x) {
|
|
var v = null;
|
|
if (g != null && typeof(g) == "object" && typeof(g.tagName) == "undefined" && g._isCell != true) {
|
|
v = {};
|
|
if (g.autosize != null) {
|
|
v.autosize = g.autosize
|
|
}
|
|
if (g.cells != null) {
|
|
v.cells = g.cells
|
|
}
|
|
if (g.pattern != null) {
|
|
r = g.pattern
|
|
}
|
|
if (g.skin != null) {
|
|
x = g.skin
|
|
}
|
|
if (g.offsets != null) {
|
|
v.offsets = g.offsets
|
|
}
|
|
g = g.parent
|
|
}
|
|
if (g == document.body) {
|
|
this.base = g
|
|
} else {
|
|
if (typeof(g) == "string") {
|
|
this.base = document.getElementById(g)
|
|
} else {
|
|
if (g._isCell == true) {
|
|
var o = (typeof(v) != "undefined" && v != null ? v : {});
|
|
if (o.pattern == null && r != null) {
|
|
o.pattern = r
|
|
}
|
|
if (o.skin == null && x != null) {
|
|
o.skin = x
|
|
}
|
|
var m = g.attachLayout(o);
|
|
return m
|
|
}
|
|
this.base = g
|
|
}
|
|
} if (this.base != document.body) {
|
|
while (this.base.childNodes.length > 0) {
|
|
this.base.removeChild(this.base.lastChild)
|
|
}
|
|
}
|
|
this.cdata = {};
|
|
this.conf = {
|
|
skin: (x || window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxlayout") || "dhx_skyblue"),
|
|
hh: 20,
|
|
progress: false,
|
|
autosize: "b",
|
|
nextCell: {
|
|
a: "b",
|
|
b: "a"
|
|
},
|
|
ofs: {
|
|
t: 0,
|
|
b: 0,
|
|
l: 0,
|
|
r: 0
|
|
},
|
|
ofs_nodes: {
|
|
t: {},
|
|
b: {}
|
|
},
|
|
inited: false,
|
|
b_size: {
|
|
w: -1,
|
|
h: -1
|
|
}
|
|
};
|
|
this.conf.sw = this._detectSW();
|
|
if (true || this.base._isParentCell !== true) {
|
|
this.base.className += " dhxlayout_base_" + this.conf.skin
|
|
}
|
|
if (this.base == document.body) {
|
|
var h = {
|
|
dhx_skyblue: {
|
|
t: 2,
|
|
b: 2,
|
|
l: 2,
|
|
r: 2
|
|
},
|
|
dhx_web: {
|
|
t: 8,
|
|
b: 8,
|
|
l: 8,
|
|
r: 8
|
|
},
|
|
dhx_terrace: {
|
|
t: 9,
|
|
b: 9,
|
|
l: 8,
|
|
r: 8
|
|
}
|
|
};
|
|
this.conf.ofs = (h[this.conf.skin] != null ? h[this.conf.skin] : h.dhx_skyblue)
|
|
}
|
|
if (v != null && v.offsets != null) {
|
|
this.setOffsets(v.offsets)
|
|
} else {
|
|
if (this.base._ofs != null) {
|
|
this.setOffsets(this.base._ofs);
|
|
this.base._ofs = null;
|
|
delete this.base._ofs
|
|
}
|
|
}
|
|
this.dataNodes = {};
|
|
var n = this;
|
|
this._getLayout = function() {
|
|
return this
|
|
};
|
|
this.mainInst = (g._layoutMainInst != null ? g._layoutMainInst : null);
|
|
this._getMainInst = function() {
|
|
if (this.mainInst != null) {
|
|
return this.mainInst._getMainInst()
|
|
}
|
|
return this
|
|
};
|
|
this._init = function(C) {
|
|
var A = (typeof(C) == "string" ? this.tplData[C] : C);
|
|
this.conf.mode = A.mode;
|
|
if (this.conf.mode == "c") {
|
|
this.cdata.a = new dhtmlXLayoutCell("a", this)
|
|
} else {
|
|
this.cdata.a = new dhtmlXLayoutCell("a", this);
|
|
this.cdata.b = new dhtmlXLayoutCell("b", this)
|
|
}
|
|
for (var y in this.cdata) {
|
|
this.base.appendChild(this.cdata[y].cell);
|
|
this.cdata[y].conf.init = {
|
|
w: 0.5,
|
|
h: 0.5
|
|
}
|
|
}
|
|
if (this.conf.mode != "c") {
|
|
var q = this._getMainInst();
|
|
if (q.conf.sep_idx == null) {
|
|
q.conf.sep_idx = 1
|
|
} else {
|
|
q.conf.sep_idx++
|
|
}
|
|
this.sep = new dhtmlXLayoutSepObject(this.conf.mode, q.conf.sep_idx);
|
|
this.base.appendChild(this.sep.sep);
|
|
this.sep._getLayout = function() {
|
|
return n._getLayout()
|
|
};
|
|
q = null
|
|
}
|
|
if (A.cells != null) {
|
|
for (var y in A.cells) {
|
|
if (A.cells[y].width != null) {
|
|
this.cdata[y].conf.init.w = A.cells[y].width
|
|
}
|
|
if (A.cells[y].height != null) {
|
|
this.cdata[y].conf.init.h = A.cells[y].height
|
|
}
|
|
if (A.cells[y].name != null) {
|
|
this.cdata[y].conf.name = A.cells[y].name;
|
|
this.cdata[y].setText(A.cells[y].name)
|
|
}
|
|
if (A.cells[y].fsize != null) {
|
|
this.cdata[y].conf.fsize = A.cells[y].fsize
|
|
}
|
|
}
|
|
}
|
|
this.setSizes();
|
|
for (var y in this.cdata) {
|
|
this.cdata[y].conf.init = {}
|
|
}
|
|
if (A.cells != null) {
|
|
for (var y in A.cells) {
|
|
if (A.cells[y].layout != null) {
|
|
this.cdata[y].dataNested = true;
|
|
this.cdata[y]._layoutMainInst = this;
|
|
this.cdata[y].attachLayout({
|
|
pattern: A.cells[y].layout
|
|
});
|
|
this.cdata[y]._layoutMainInst = null
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.setSizes = function(O, D, N, F) {
|
|
var q = (this.conf.inited == true && this._getMainInst() == this && this.checkEvent("onResizeFinish") == true ? {} : false);
|
|
var T = this.conf.ofs.t;
|
|
for (var V in this.conf.ofs_nodes.t) {
|
|
T += (this.conf.ofs_nodes.t[V] == true ? this.dataNodes[V].offsetHeight : 0)
|
|
}
|
|
var C = this.conf.ofs.b;
|
|
for (var V in this.conf.ofs_nodes.b) {
|
|
C += (this.conf.ofs_nodes.b[V] == true ? this.dataNodes[V].offsetHeight : 0)
|
|
}
|
|
var L = this.conf.ofs.l;
|
|
var K = this.conf.ofs.r;
|
|
var y = this.base.offsetWidth;
|
|
var E = this.base.offsetHeight;
|
|
if (this.conf.mode == "c") {
|
|
var I = K;
|
|
var H = T;
|
|
var J = y - L - K;
|
|
var S = E - T - C;
|
|
this.cdata.a._setSize(I, H, J, S, O, N, F);
|
|
this.callEvent("_onSetSizes", []);
|
|
if (q && (!(this.conf.b_size.w == y && this.conf.b_size.h == E))) {
|
|
this._callMainEvent("onResizeFinish", [])
|
|
}
|
|
this.conf.b_size = {
|
|
w: y,
|
|
h: E
|
|
};
|
|
return
|
|
}
|
|
if (typeof(D) == "undefined") {
|
|
var M = (this.conf.mode == "v" ? "w" : "h");
|
|
D = this.conf.autosize;
|
|
if (this.cdata.a.conf.collapsed) {
|
|
D = "b"
|
|
} else {
|
|
if (this.cdata.b.conf.collapsed) {
|
|
D = "a"
|
|
} else {
|
|
if (O == "a" || O == "b") {
|
|
D = this.conf.nextCell[O]
|
|
}
|
|
}
|
|
}
|
|
} else {} if (this.conf.mode == "v") {
|
|
if (D == "a") {
|
|
if (this.cdata.b.conf.init.w != null) {
|
|
var U = Math.round(y * this.cdata.b.conf.init.w - this.conf.sw / 2) - K
|
|
} else {
|
|
var U = this.cdata.b.conf.size.w
|
|
}
|
|
var Q = y - U - K;
|
|
var P = T;
|
|
var A = E - T - C;
|
|
var I = L;
|
|
var H = P;
|
|
var J = Q - I - this.conf.sw;
|
|
var S = A
|
|
} else {
|
|
var I = L;
|
|
var H = T;
|
|
if (this.cdata.a.conf.init.w != null) {
|
|
var J = Math.round(y * this.cdata.a.conf.init.w - this.conf.sw / 2) - I
|
|
} else {
|
|
var J = this.cdata.a.conf.size.w
|
|
}
|
|
var S = E - H - C;
|
|
var Q = I + J + this.conf.sw;
|
|
var P = H;
|
|
var U = y - Q - K;
|
|
var A = S
|
|
}
|
|
this.cdata.a._setSize(I, H, J, S, O, N, F);
|
|
this.cdata.b._setSize(Q, P, U, A, O, N, F);
|
|
this.sep._setSize(I + J, H, this.conf.sw, S)
|
|
} else {
|
|
if (D == "a") {
|
|
if (this.cdata.b.conf.init.h != null) {
|
|
var A = Math.round((E - T) * this.cdata.b.conf.init.h - this.conf.sw / 2)
|
|
} else {
|
|
var A = this.cdata.b.conf.size.h
|
|
}
|
|
var Q = L;
|
|
var P = E - C - A;
|
|
var U = y - Q - K;
|
|
var I = Q;
|
|
var H = T;
|
|
var J = U;
|
|
var S = P - H - this.conf.sw
|
|
} else {
|
|
var I = L;
|
|
var H = T;
|
|
var J = y - I - K;
|
|
if (this.cdata.a.conf.init.h != null) {
|
|
var S = Math.round((E - T) * this.cdata.a.conf.init.h - this.conf.sw / 2)
|
|
} else {
|
|
var S = this.cdata.a.conf.size.h
|
|
}
|
|
var Q = I;
|
|
var P = H + S + this.conf.sw;
|
|
var U = J;
|
|
var A = E - P - C
|
|
}
|
|
this.cdata.a._setSize(I, H, J, S, O, N, F);
|
|
this.cdata.b._setSize(Q, P, U, A, O, N, F);
|
|
this.sep._setSize(I, H + S, J, this.conf.sw)
|
|
}
|
|
this.callEvent("_onSetSizes", []);
|
|
if (q && (!(this.conf.b_size.w == y && this.conf.b_size.h == E))) {
|
|
this._callMainEvent("onResizeFinish", [])
|
|
}
|
|
this.conf.b_size = {
|
|
w: y,
|
|
h: E
|
|
}
|
|
};
|
|
this._getAvailWidth = function() {
|
|
var C = [];
|
|
for (var F = 0; F < this.conf.as_cells.h.length; F++) {
|
|
var y = this.cells(this.conf.as_cells.h[F]);
|
|
var D = y.layout;
|
|
var A = D.conf.autosize;
|
|
if (y.conf.collapsed) {
|
|
y = D.cdata[D.conf.nextCell[y._idd]];
|
|
A = D.conf.nextCell[A]
|
|
}
|
|
C.push(Math.max(0, y.getWidth() - y._getMinWidth(A)));
|
|
D = y = null
|
|
}
|
|
var E = (C.length > 0 ? Math.min.apply(window, C) : 0);
|
|
return this.base.offsetWidth - E
|
|
};
|
|
this._getAvailHeight = function() {
|
|
var D = [];
|
|
for (var F = 0; F < this.conf.as_cells.v.length; F++) {
|
|
var y = this.cells(this.conf.as_cells.v[F]);
|
|
var C = y.layout;
|
|
var A = C.conf.autosize;
|
|
if (y.conf.collapsed) {
|
|
y = C.cdata[C.conf.nextCell[y._idd]];
|
|
A = C.conf.nextCell[A]
|
|
}
|
|
D.push(Math.max(0, y.getHeight() - y._getHdrHeight() - y._getMinHeight(A)));
|
|
C = y = null
|
|
}
|
|
var E = Math.min.apply(window, D);
|
|
return this.base.offsetHeight - E
|
|
};
|
|
this.setSkin = function(a) {
|
|
this.base.className = this.base.className.replace(new RegExp("dhxlayout_dhx_" + this.conf.skin, "gi"), "dhxlayout_dhx_" + a);
|
|
this.conf.skin = a
|
|
};
|
|
this.unload = function() {
|
|
this.conf.unloading = true;
|
|
this.mainInst = null;
|
|
this.parentLayout = null;
|
|
this._mtbUnload();
|
|
this.detachHeader();
|
|
this.detachFooter();
|
|
window.dhx4._eventable(this, "clear");
|
|
var A = new RegExp("s{0,}dhxlayout_base_" + this.conf.skin, "gi");
|
|
this.base.className = this.base.className.replace(A, "");
|
|
if (this.items != null) {
|
|
for (var C = 0; C < this.items.length; C++) {
|
|
this.items[C] = null
|
|
}
|
|
this.items = null
|
|
}
|
|
if (this.conf.fs_mode == true) {
|
|
if (window.addEventListener) {
|
|
window.removeEventListener("resize", this._doOnResizeStart, false)
|
|
} else {
|
|
window.detachEvent("onresize", this._doOnResizeStart)
|
|
}
|
|
}
|
|
if (this.dhxWins != null) {
|
|
this.dhxWins.unload();
|
|
this.dhxWins = null
|
|
}
|
|
if (this.sep != null) {
|
|
this.sep._unload();
|
|
this.sep = null
|
|
}
|
|
for (var y in this.cdata) {
|
|
this.cdata[y]._unload()
|
|
}
|
|
this.base = null;
|
|
for (var y in this) {
|
|
this[y] = null
|
|
}
|
|
n = null
|
|
};
|
|
this._getWindowMinDimension = function(A) {
|
|
var a = n._getAvailWidth() + 7 + 7;
|
|
var y = n._getAvailHeight() + 7 + 31;
|
|
var q = {
|
|
w: Math.max(a, 200),
|
|
h: Math.max(y, 140)
|
|
};
|
|
A = null;
|
|
return q
|
|
};
|
|
if (this.base == document.body) {
|
|
this.conf.fs_mode = true;
|
|
this._tmTime = null;
|
|
this._doOnResizeStart = function() {
|
|
window.clearTimeout(n._tmTime);
|
|
n._tmTime = window.setTimeout(n._doOnResizeEnd, 200)
|
|
};
|
|
this._doOnResizeEnd = function() {
|
|
n.setSizes()
|
|
};
|
|
if (window.addEventListener) {
|
|
window.addEventListener("resize", this._doOnResizeStart, false)
|
|
} else {
|
|
window.attachEvent("onresize", this._doOnResizeStart)
|
|
}
|
|
}
|
|
window.dhx4._eventable(this);
|
|
this._callMainEvent = function(q, a) {
|
|
return this.callEvent(q, a)
|
|
};
|
|
this._init(r || "3E");
|
|
var s = this._availAutoSize[r];
|
|
if (s != null) {
|
|
this.conf.pattern = r;
|
|
this.setAutoSize(s.h[s.h.length - 1], s.v[s.v.length - 1])
|
|
}
|
|
if (typeof(window.dhtmlXWindows) == "function") {
|
|
this.dhxWins = new dhtmlXWindows();
|
|
this.dhxWins.setSkin(this.conf.skin)
|
|
}
|
|
this.conf.inited = true;
|
|
if (this == this._getMainInst()) {
|
|
var u = 0;
|
|
this.items = [];
|
|
this.forEachItem(function(a) {
|
|
n.items.push(a);
|
|
a.conf.index = u++
|
|
})
|
|
}
|
|
if (this == this._getMainInst() && v != null) {
|
|
if (v.autosize != null) {
|
|
this.setAutoSize.apply(this, v.autosize)
|
|
}
|
|
if (v.cells != null) {
|
|
for (var c = 0; c < v.cells.length; c++) {
|
|
var l = v.cells[c];
|
|
var w = this.cells(l.id);
|
|
if (l.width) {
|
|
w.setWidth(l.width)
|
|
}
|
|
if (l.height) {
|
|
w.setHeight(l.height)
|
|
}
|
|
if (l.text) {
|
|
w.setText(l.text)
|
|
}
|
|
if (l.collapsed_text) {
|
|
w.setCollapsedText(l.collapsed_text)
|
|
}
|
|
if (l.collapse) {
|
|
w.collapse()
|
|
}
|
|
if (l.fix_size) {
|
|
w.fixSize(l.fix_size[0], l.fix_size[1])
|
|
}
|
|
if (typeof(l.header) != "undefined" && window.dhx4.s2b(l.header) == false) {
|
|
w.hideHeader()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
v = null;
|
|
return this
|
|
}
|
|
dhtmlXLayoutObject.prototype.cells = function(h) {
|
|
for (var c in this.cdata) {
|
|
if (this.cdata[c].conf.name == h) {
|
|
return this.cdata[c]
|
|
}
|
|
if (this.cdata[c].dataType == "layout" && this.cdata[c].dataNested == true && this.cdata[c].dataObj != null) {
|
|
var g = this.cdata[c].dataObj.cells(h);
|
|
if (g != null) {
|
|
return g
|
|
}
|
|
}
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXLayoutObject.prototype.forEachItem = function(h, g) {
|
|
if (typeof(h) != "function") {
|
|
return
|
|
}
|
|
if (typeof(g) == "undefined") {
|
|
g = this
|
|
}
|
|
for (var c in this.cdata) {
|
|
if (typeof(this.cdata[c].conf.name) != "undefined") {
|
|
h.apply(g, [this.cdata[c]])
|
|
}
|
|
if (this.cdata[c].dataType == "layout" && this.cdata[c].dataNested == true && this.cdata[c].dataObj != null) {
|
|
this.cdata[c].dataObj.forEachItem(h, g)
|
|
}
|
|
}
|
|
g = null
|
|
};
|
|
dhtmlXLayoutObject.prototype._forEachSep = function(h, g) {
|
|
if (typeof(h) != "function") {
|
|
return
|
|
}
|
|
if (typeof(g) == "undefined") {
|
|
g = this
|
|
}
|
|
if (this.sep != null) {
|
|
h.apply(g, [this.sep])
|
|
}
|
|
for (var c in this.cdata) {
|
|
if (this.cdata[c].dataType == "layout" && this.cdata[c].dataNested == true && this.cdata[c].dataObj != null) {
|
|
this.cdata[c].dataObj._forEachSep(h, g)
|
|
}
|
|
}
|
|
g = null
|
|
};
|
|
dhtmlXLayoutObject.prototype.setOffsets = function(l) {
|
|
var h = false;
|
|
for (var c in l) {
|
|
var g = c.charAt(0);
|
|
if (typeof(this.conf.ofs[g]) != "undefined" && !isNaN(l[c])) {
|
|
this.conf.ofs[g] = parseInt(l[c]);
|
|
h = true
|
|
}
|
|
}
|
|
if (typeof(this.setSizes) == "function" && h == true) {
|
|
this.setSizes()
|
|
}
|
|
};
|
|
dhtmlXLayoutObject.prototype._detectSW = function() {
|
|
if (dhtmlXLayoutObject.prototype._confGlob.sw == null) {
|
|
dhtmlXLayoutObject.prototype._confGlob.sw = {}
|
|
}
|
|
if (dhtmlXLayoutObject.prototype._confGlob.sw[this.conf.skin] == null) {
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhxlayout_sep_sw_" + this.conf.skin;
|
|
if (document.body.firstChild != null) {
|
|
document.body.insertBefore(a, document.body.firstChild)
|
|
} else {
|
|
document.body.appendChild(a)
|
|
}
|
|
dhtmlXLayoutObject.prototype._confGlob.sw[this.conf.skin] = a.offsetWidth;
|
|
document.body.removeChild(a);
|
|
a = null
|
|
}
|
|
return dhtmlXLayoutObject.prototype._confGlob.sw[this.conf.skin]
|
|
};
|
|
dhtmlXLayoutObject.prototype._confGlob = {};
|
|
dhtmlXLayoutObject.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 = "dhxlayout_hdr_attached";
|
|
this.dataNodes.haObj.style.height = (a || c.offsetHeight) + "px";
|
|
this.base.insertBefore(this.dataNodes.haObj, this.dataNodes.menuObj || this.dataNodes.toolbarObj || this.cdata.a.cell);
|
|
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()
|
|
};
|
|
dhtmlXLayoutObject.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()
|
|
}
|
|
};
|
|
dhtmlXLayoutObject.prototype.attachFooter = function(g, a) {
|
|
if (this.dataNodes.faObj != null) {
|
|
return
|
|
}
|
|
if (typeof(g) != "object") {
|
|
g = document.getElementById(g)
|
|
}
|
|
this.dataNodes.faObj = document.createElement("DIV");
|
|
this.dataNodes.faObj.className = "dhxlayout_ftr_attached";
|
|
this.dataNodes.faObj.style.height = (a || g.offsetHeight) + "px";
|
|
var c = (this.dataNodes.sbObj || (this.conf.pattern == "1C" ? this.cdata.a : this.sep.sep));
|
|
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.t + "px";
|
|
this.dataNodes.faObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"
|
|
});
|
|
this.dataNodes.faObj.appendChild(g);
|
|
g.style.visibility = "visible";
|
|
c = g = null;
|
|
this.conf.ofs_nodes.b.faObj = true;
|
|
this.setSizes()
|
|
};
|
|
dhtmlXLayoutObject.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()
|
|
}
|
|
};
|
|
dhtmlXLayoutObject.prototype.attachMenu = function(a) {
|
|
if (this.dataNodes.menu != null) {
|
|
return
|
|
}
|
|
this.dataNodes.menuObj = document.createElement("DIV");
|
|
this.dataNodes.menuObj.className = "dhxlayout_menu";
|
|
this.base.insertBefore(this.dataNodes.menuObj, this.dataNodes.toolbarObj || this.dataNodes.ribbonObj || this.cdata.a.cell);
|
|
if (typeof(a) != "object" || a == null) {
|
|
a = {}
|
|
}
|
|
a.skin = this.conf.skin;
|
|
a.parent = this.dataNodes.menuObj;
|
|
this.dataNodes.menu = new dhtmlXMenuObject(a);
|
|
this.dataNodes.menuEv = this.attachEvent("_onSetSizes", function() {
|
|
if (this.dataNodes.menuObj.style.display == "none") {
|
|
return
|
|
}
|
|
this.dataNodes.menuObj.style.left = this.conf.ofs.l + "px";
|
|
this.dataNodes.menuObj.style.marginTop = (this.dataNodes.haObj != null ? 0 : this.conf.ofs.t) + "px";
|
|
this.dataNodes.menuObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"
|
|
});
|
|
this.conf.ofs_nodes.t.menuObj = true;
|
|
this.setSizes();
|
|
a.parnt = null;
|
|
a = null;
|
|
return this.dataNodes.menu
|
|
};
|
|
dhtmlXLayoutObject.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()
|
|
}
|
|
};
|
|
dhtmlXLayoutObject.prototype.attachToolbar = function(a) {
|
|
if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) {
|
|
return
|
|
}
|
|
this.dataNodes.toolbarObj = document.createElement("DIV");
|
|
this.dataNodes.toolbarObj.className = "dhxlayout_toolbar";
|
|
this.base.insertBefore(this.dataNodes.toolbarObj, this.cdata.a.cell);
|
|
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
|
|
};
|
|
dhtmlXLayoutObject.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()
|
|
}
|
|
};
|
|
dhtmlXLayoutObject.prototype.attachRibbon = function(a) {
|
|
if (!(this.dataNodes.ribbon == null && this.dataNodes.toolbar == null)) {
|
|
return
|
|
}
|
|
this.dataNodes.ribbonObj = document.createElement("DIV");
|
|
this.dataNodes.ribbonObj.className = "dhxlayout_ribbon";
|
|
this.base.insertBefore(this.dataNodes.ribbonObj, this.cdata.a.cell);
|
|
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
|
|
};
|
|
dhtmlXLayoutObject.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()
|
|
}
|
|
};
|
|
dhtmlXLayoutObject.prototype.attachStatusBar = function(a) {
|
|
if (this.dataNodes.sbObj) {
|
|
return
|
|
}
|
|
if (typeof(a) == "undefined") {
|
|
a = {}
|
|
}
|
|
this.dataNodes.sbObj = document.createElement("DIV");
|
|
this.dataNodes.sbObj.className = "dhxlayout_statusbar";
|
|
if (this.dataNodes.faObj != null) {
|
|
this.base.insertBefore(this.dataNodes.sbObj, this.dataNodes.faObj)
|
|
} else {
|
|
if (this.sep == null || this.base.lastChild == this.sep.sep) {
|
|
this.base.appendChild(this.dataNodes.sbObj)
|
|
} else {
|
|
this.base.insertBefore(this.dataNodes.sbObj, this.sep.sep.nextSibling)
|
|
}
|
|
}
|
|
this.dataNodes.sbObj.innerHTML = "<div class='dhxcont_statusbar'>" + (typeof(a.text) == "string" && a.text.length > 0 ? a.text : " ") + "</div>";
|
|
if (typeof(a.height) == "number") {
|
|
this.dataNodes.sbObj.firstChild.style.height = this.dataNodes.sbObj.firstChild.style.lineHeight = a.height + "px"
|
|
}
|
|
this.dataNodes.sbObj.setText = function(c) {
|
|
this.childNodes[0].innerHTML = c
|
|
};
|
|
this.dataNodes.sbObj.getText = function() {
|
|
return this.childNodes[0].innerHTML
|
|
};
|
|
this.dataNodes.sbObj.onselectstart = function(c) {
|
|
return false
|
|
};
|
|
this.dataNodes.sbEv = this.attachEvent("_onSetSizes", function() {
|
|
if (this.dataNodes.sbObj.style.display == "none") {
|
|
return
|
|
}
|
|
this.dataNodes.sbObj.style.left = this.conf.ofs.l + "px";
|
|
this.dataNodes.sbObj.style.bottom = (this.dataNodes.faObj != null ? this.dataNodes.faObj.offsetHeight : 0) + this.conf.ofs.t + "px";
|
|
this.dataNodes.sbObj.style.width = this.base.offsetWidth - this.conf.ofs.l - this.conf.ofs.r + "px"
|
|
});
|
|
this.conf.ofs_nodes.b.sbObj = true;
|
|
this.setSizes();
|
|
return this.dataNodes.sbObj
|
|
};
|
|
dhtmlXLayoutObject.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()
|
|
}
|
|
};
|
|
dhtmlXLayoutObject.prototype.showMenu = function() {
|
|
this._mtbShowHide("menuObj", "")
|
|
};
|
|
dhtmlXLayoutObject.prototype.hideMenu = function() {
|
|
this._mtbShowHide("menuObj", "none")
|
|
};
|
|
dhtmlXLayoutObject.prototype.showToolbar = function() {
|
|
this._mtbShowHide("toolbarObj", "")
|
|
};
|
|
dhtmlXLayoutObject.prototype.hideToolbar = function() {
|
|
this._mtbShowHide("toolbarObj", "none")
|
|
};
|
|
dhtmlXLayoutObject.prototype.showRibbon = function() {
|
|
this._mtbShowHide("ribbonObj", "")
|
|
};
|
|
dhtmlXLayoutObject.prototype.hideRibbon = function() {
|
|
this._mtbShowHide("ribbonObj", "none")
|
|
};
|
|
dhtmlXLayoutObject.prototype.showStatusBar = function() {
|
|
this._mtbShowHide("sbObj", "")
|
|
};
|
|
dhtmlXLayoutObject.prototype.hideStatusBar = function() {
|
|
this._mtbShowHide("sbObj", "none")
|
|
};
|
|
dhtmlXLayoutObject.prototype._mtbShowHide = function(c, a) {
|
|
if (this.dataNodes[c] == null) {
|
|
return
|
|
}
|
|
this.dataNodes[c].style.display = a;
|
|
this.setSizes()
|
|
};
|
|
dhtmlXLayoutObject.prototype._mtbUnload = function(c, a) {
|
|
this.detachMenu();
|
|
this.detachToolbar();
|
|
this.detachStatusBar();
|
|
this.detachRibbon()
|
|
};
|
|
dhtmlXLayoutObject.prototype.getAttachedMenu = function() {
|
|
return this.dataNodes.menu
|
|
};
|
|
dhtmlXLayoutObject.prototype.getAttachedToolbar = function() {
|
|
return this.dataNodes.toolbar
|
|
};
|
|
dhtmlXLayoutObject.prototype.getAttachedRibbon = function() {
|
|
return this.dataNodes.ribbon
|
|
};
|
|
dhtmlXLayoutObject.prototype.getAttachedStatusBar = function() {
|
|
return this.dataNodes.sbObj
|
|
};
|
|
dhtmlXLayoutObject.prototype.progressOn = function() {
|
|
if (this.conf.progress) {
|
|
return
|
|
}
|
|
this.conf.progress = true;
|
|
var c = document.createElement("DIV");
|
|
c.className = "dhxlayout_progress";
|
|
this.base.appendChild(c);
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhxlayout_progress_img";
|
|
this.base.appendChild(a);
|
|
c = a = null
|
|
};
|
|
dhtmlXLayoutObject.prototype.progressOff = function() {
|
|
if (!this.conf.progress) {
|
|
return
|
|
}
|
|
var h = {
|
|
dhxlayout_progress: true,
|
|
dhxlayout_progress_img: true
|
|
};
|
|
for (var g = 0; g < this.base.childNodes.length; g++) {
|
|
if (typeof(this.base.childNodes[g].className) != "undefined" && h[this.base.childNodes[g].className] == true) {
|
|
h[this.base.childNodes[g].className] = this.base.childNodes[g]
|
|
}
|
|
}
|
|
for (var c in h) {
|
|
if (h[c] != true) {
|
|
this.base.removeChild(h[c])
|
|
}
|
|
h[c] = null
|
|
}
|
|
this.conf.progress = false;
|
|
h = null
|
|
};
|
|
dhtmlXLayoutObject.prototype.listPatterns = function() {
|
|
var g = [];
|
|
for (var c in this.tplData) {
|
|
g.push(c)
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXLayoutObject.prototype.listAutoSizes = function() {
|
|
var h = (this.conf.as_cells != null ? (this.conf.as_cells.h).join(";") : "");
|
|
var g = (this.conf.as_cells != null ? (this.conf.as_cells.v).join(";") : "");
|
|
var c = this._availAutoSize[this.conf.pattern].h;
|
|
var a = this._availAutoSize[this.conf.pattern].v;
|
|
return [h, g, c, a]
|
|
};
|
|
dhtmlXLayoutObject.prototype._getCellsNames = function(h) {
|
|
var l = {};
|
|
if (this.cdata[h].conf.name != null) {
|
|
l[this.cdata[h].conf.name] = true
|
|
}
|
|
if (this.cdata[h].dataType == "layout" && this.cdata[h].dataObj != null && this.cdata[h].dataObj.mainInst == this) {
|
|
var c = this.cdata[h].dataObj._getCellsNames("a");
|
|
var m = this.cdata[h].dataObj._getCellsNames("b");
|
|
for (var g in c) {
|
|
l[g] = c[g]
|
|
}
|
|
for (var g in m) {
|
|
l[g] = m[g]
|
|
}
|
|
}
|
|
return l
|
|
};
|
|
dhtmlXLayoutObject.prototype.setAutoSize = function(c, r, u) {
|
|
if (u !== true) {
|
|
var w = this.listAutoSizes();
|
|
if (w[0] == c && w[1] == r) {
|
|
return
|
|
}
|
|
var o = false;
|
|
var n = false;
|
|
for (var g = 0; g < w[2].length; g++) {
|
|
o = o || w[2][g] == c
|
|
}
|
|
for (var g = 0; g < w[3].length; g++) {
|
|
n = n || w[3][g] == r
|
|
}
|
|
if (!o || !n) {
|
|
return
|
|
}
|
|
}
|
|
this.conf.as_cells = {
|
|
h: c.split(";"),
|
|
v: r.split(";")
|
|
};
|
|
var h = (this.conf.mode == "v" ? "h" : "v");
|
|
for (var v in this.cdata) {
|
|
var l = this._getCellsNames(v);
|
|
var x = false;
|
|
for (var g = 0; g < this.conf.as_cells[h].length; g++) {
|
|
x = x || l[this.conf.as_cells[h][g]]
|
|
}
|
|
if (x) {
|
|
this.conf.autosize = v
|
|
}
|
|
if (this.cdata[v].dataType == "layout" && this.cdata[v].dataObj != null) {
|
|
this.cdata[v].dataObj.setAutoSize(c, r, true)
|
|
}
|
|
}
|
|
};
|
|
dhtmlXLayoutObject.prototype.tplData = {
|
|
"1C": {
|
|
mode: "c",
|
|
cells: {
|
|
a: {
|
|
name: "a"
|
|
}
|
|
}
|
|
},
|
|
"2E": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
name: "b",
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"2U": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"3E": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
v: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"3W": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"3J": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"3L": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"3T": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 2,
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 2,
|
|
v: 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"3U": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
h: 2,
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 2,
|
|
v: 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4H": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: 3
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: 3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4I": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 3,
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 3,
|
|
v: [1, 2]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
v: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4T": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: 2,
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
h: [2, 3],
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 3,
|
|
v: 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4U": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: 2,
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: [2, 3],
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 3,
|
|
v: 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4E": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 4,
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
v: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
v: 3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4W": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
width: 1 / 4,
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
h: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4A": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
width: 1 / 3,
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
h: [1, 3]
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4L": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 2,
|
|
v: 3
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 2,
|
|
v: 3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4J": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 3,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 3,
|
|
v: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4F": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
height: 1 / 3,
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
h: 2,
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 2,
|
|
v: 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
v: [1, 3]
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
v: 3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4G": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 1,
|
|
v: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 1,
|
|
v: 3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"4C": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 1,
|
|
v: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 1,
|
|
v: 3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"5H": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
width: 1 / 3,
|
|
name: "a",
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: 3
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: 4
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
h: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"5I": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
height: 1 / 3,
|
|
name: "a",
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: 3,
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
h: [3, 4],
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 4,
|
|
v: [1, 2]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
v: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"5U": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
width: 1 / 4,
|
|
fsize: {
|
|
h: 2,
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: [2, 3],
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
h: [3, 4],
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 4,
|
|
v: 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"5E": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 5,
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
height: 1 / 4,
|
|
fsize: {
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
v: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
fsize: {
|
|
v: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
v: 4
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"5W": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
width: 1 / 5,
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
width: 1 / 4,
|
|
fsize: {
|
|
h: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
fsize: {
|
|
h: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
h: 4
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"5K": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 1,
|
|
v: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 1,
|
|
v: 3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 1,
|
|
v: 4
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
h: 1,
|
|
v: 4
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"5S": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: 1,
|
|
v: 3
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 1,
|
|
v: [3, 2]
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
h: 1,
|
|
v: 4
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"5G": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
width: 1 / 3,
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: 1,
|
|
v: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 1,
|
|
v: 3
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
fsize: {
|
|
h: [1, 4]
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
h: 4
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"5C": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
width: 2 / 3,
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
h: 2
|
|
}
|
|
},
|
|
b: {
|
|
name: "b",
|
|
fsize: {
|
|
h: [2, 1]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: 1,
|
|
v: 3
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 1,
|
|
v: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
h: 1,
|
|
v: 4
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"6H": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
width: 1 / 3,
|
|
name: "a",
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
height: 1 / 4,
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: 3
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: [4, 5]
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: 5
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "f",
|
|
fsize: {
|
|
h: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"6I": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
height: 1 / 3,
|
|
name: "a",
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
width: 1 / 4,
|
|
fsize: {
|
|
h: 3,
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: [3, 4],
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
fsize: {
|
|
h: [4, 5],
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
h: 5,
|
|
v: [1, 2]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "f",
|
|
fsize: {
|
|
v: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"6A": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 5,
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
height: 1 / 4,
|
|
fsize: {
|
|
h: 1,
|
|
v: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: 1,
|
|
v: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 1,
|
|
v: [4, 5]
|
|
}
|
|
},
|
|
b: {
|
|
name: "e",
|
|
fsize: {
|
|
h: 1,
|
|
v: 5
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "f",
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"6C": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
height: 1 / 5,
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
height: 1 / 4,
|
|
fsize: {
|
|
h: 1,
|
|
v: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: 1,
|
|
v: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "e",
|
|
fsize: {
|
|
h: 1,
|
|
v: [4, 5]
|
|
}
|
|
},
|
|
b: {
|
|
name: "f",
|
|
fsize: {
|
|
h: 1,
|
|
v: 5
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"6J": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
width: 1 / 3,
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 4,
|
|
fsize: {
|
|
h: 1,
|
|
v: 2
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: 1,
|
|
v: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
fsize: {
|
|
h: 1,
|
|
v: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
name: "d",
|
|
fsize: {
|
|
h: 1,
|
|
v: 4
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "e",
|
|
fsize: {
|
|
h: [1, 5]
|
|
}
|
|
},
|
|
b: {
|
|
name: "f",
|
|
fsize: {
|
|
h: 5
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"6E": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
fsize: {
|
|
h: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
height: 1 / 4,
|
|
fsize: {
|
|
h: 2,
|
|
v: 3
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: 2,
|
|
v: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "e",
|
|
fsize: {
|
|
h: 2,
|
|
v: [4, 5]
|
|
}
|
|
},
|
|
b: {
|
|
name: "f",
|
|
fsize: {
|
|
h: 2,
|
|
v: 5
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"6W": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
width: 1 / 6,
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
width: 1 / 5,
|
|
fsize: {
|
|
h: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
width: 1 / 4,
|
|
fsize: {
|
|
h: [2, 3]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "e",
|
|
fsize: {
|
|
h: [4, 5]
|
|
}
|
|
},
|
|
b: {
|
|
name: "f",
|
|
fsize: {
|
|
h: 5
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"7H": {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
height: 1 / 5,
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: 3
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
height: 1 / 4,
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: [3, 4]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: [4, 5]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "e",
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: [5, 6]
|
|
}
|
|
},
|
|
b: {
|
|
name: "f",
|
|
fsize: {
|
|
h: [1, 2],
|
|
v: 6
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "g",
|
|
fsize: {
|
|
h: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"7I": {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
name: "a",
|
|
height: 1 / 3,
|
|
fsize: {
|
|
v: 1
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "h",
|
|
cells: {
|
|
a: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "b",
|
|
width: 1 / 5,
|
|
fsize: {
|
|
h: 3,
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "c",
|
|
width: 1 / 4,
|
|
fsize: {
|
|
h: [3, 4],
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "d",
|
|
width: 1 / 3,
|
|
fsize: {
|
|
h: [4, 5],
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
layout: {
|
|
mode: "v",
|
|
cells: {
|
|
a: {
|
|
name: "e",
|
|
fsize: {
|
|
h: [5, 6],
|
|
v: [1, 2]
|
|
}
|
|
},
|
|
b: {
|
|
name: "f",
|
|
fsize: {
|
|
h: 6,
|
|
v: [1, 2]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
b: {
|
|
name: "g",
|
|
fsize: {
|
|
v: 2
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhtmlXLayoutObject.prototype._availAutoSize = {
|
|
"1C": {
|
|
h: ["a"],
|
|
v: ["a"]
|
|
},
|
|
"2E": {
|
|
h: ["a;b"],
|
|
v: ["a", "b"]
|
|
},
|
|
"2U": {
|
|
h: ["a", "b"],
|
|
v: ["a;b"]
|
|
},
|
|
"3E": {
|
|
h: ["a;b;c"],
|
|
v: ["a", "b", "c"]
|
|
},
|
|
"3W": {
|
|
h: ["a", "b", "c"],
|
|
v: ["a;b;c"]
|
|
},
|
|
"3J": {
|
|
h: ["a;c", "b"],
|
|
v: ["a;b", "b;c"]
|
|
},
|
|
"3L": {
|
|
h: ["a", "b;c"],
|
|
v: ["a;b", "a;c"]
|
|
},
|
|
"3T": {
|
|
h: ["a;b", "a;c"],
|
|
v: ["a", "b;c"]
|
|
},
|
|
"3U": {
|
|
h: ["a;c", "b;c"],
|
|
v: ["a;b", "c"]
|
|
},
|
|
"4H": {
|
|
h: ["a", "b;c", "d"],
|
|
v: ["a;b;d", "a;c;d"]
|
|
},
|
|
"4I": {
|
|
h: ["a;b;d", "a;c;d"],
|
|
v: ["a", "b;c", "d"]
|
|
},
|
|
"4T": {
|
|
h: ["a;b", "a;c", "a;d"],
|
|
v: ["a", "b;c;d"]
|
|
},
|
|
"4U": {
|
|
h: ["a;d", "b;d", "c;d"],
|
|
v: ["a;b;c", "d"]
|
|
},
|
|
"4E": {
|
|
h: ["a;b;c;d"],
|
|
v: ["a", "b", "c", "d"]
|
|
},
|
|
"4W": {
|
|
h: ["a", "b", "c", "d"],
|
|
v: ["a;b;c;d"]
|
|
},
|
|
"4A": {
|
|
h: ["a;b", "c", "d"],
|
|
v: ["a;c;d", "b;c;d"]
|
|
},
|
|
"4L": {
|
|
h: ["a", "b", "c;d"],
|
|
v: ["a;b;c", "a;b;d"]
|
|
},
|
|
"4J": {
|
|
h: ["a;b;c", "a;b;d"],
|
|
v: ["a", "b", "c;d"]
|
|
},
|
|
"4F": {
|
|
h: ["a;c;d", "b;c;d"],
|
|
v: ["a;b", "c", "d"]
|
|
},
|
|
"4G": {
|
|
h: ["a;b;c", "d"],
|
|
v: ["a;d", "b;d", "c;d"]
|
|
},
|
|
"4C": {
|
|
h: ["a", "b;c;d"],
|
|
v: ["a;b", "a;c", "a;d"]
|
|
},
|
|
"5H": {
|
|
h: ["a", "b;c;d", "e"],
|
|
v: ["a;b;e", "a;c;e", "a;d;e"]
|
|
},
|
|
"5I": {
|
|
h: ["a;b;e", "a;c;e", "a;d;e"],
|
|
v: ["a", "b;c;d", "e"]
|
|
},
|
|
"5U": {
|
|
h: ["a;e", "b;e", "c;e", "d;e"],
|
|
v: ["a;b;c;d", "e"]
|
|
},
|
|
"5E": {
|
|
h: ["a;b;c;d;e"],
|
|
v: ["a", "b", "c", "d", "e"]
|
|
},
|
|
"5W": {
|
|
h: ["a", "b", "c", "d", "e"],
|
|
v: ["a;b;c;d;e"]
|
|
},
|
|
"5K": {
|
|
h: ["a;b;c", "d;e"],
|
|
v: ["a;d", "b;d", "c;d", "a;e", "b;e", "c;e"]
|
|
},
|
|
"5S": {
|
|
h: ["a;b", "c;d;e"],
|
|
v: ["a;c", "a;d", "a;e", "b;c", "b;d", "b;e"]
|
|
},
|
|
"5G": {
|
|
h: ["a;b;c", "d", "e"],
|
|
v: ["a;d;e", "b;d;e", "c;d;e"]
|
|
},
|
|
"5C": {
|
|
h: ["a", "b", "c;d;e"],
|
|
v: ["a;b;c", "a;b;d", "a;b;e"]
|
|
},
|
|
"6H": {
|
|
h: ["a", "b;c;d;e", "f"],
|
|
v: ["a;b;f", "a;c;f", "a;d;f", "a;e;f"]
|
|
},
|
|
"6I": {
|
|
h: ["a;b;f", "a;c;f", "a;d;f", "a;e;f"],
|
|
v: ["a", "b;c;d;e", "f"]
|
|
},
|
|
"6A": {
|
|
h: ["a;b;c;d;e", "f"],
|
|
v: ["a;f", "b;f", "c;f", "d;f", "e;f"]
|
|
},
|
|
"6C": {
|
|
h: ["a", "b;c;d;e;f"],
|
|
v: ["a;b", "a;c", "a;d", "a;e", "a;f"]
|
|
},
|
|
"6J": {
|
|
h: ["a;b;c;d", "e", "f"],
|
|
v: ["a;e;f", "b;e;f", "c;e;f", "d;e;f"]
|
|
},
|
|
"6E": {
|
|
h: ["a", "b", "c;d;e;f"],
|
|
v: ["a;b;c", "a;b;d", "a;b;e", "a;b;f"]
|
|
},
|
|
"6W": {
|
|
h: ["a", "b", "c", "d", "e", "f"],
|
|
v: ["a;b;c;d;e;f"]
|
|
},
|
|
"7H": {
|
|
h: ["a", "b;c;d;e;f", "g"],
|
|
v: ["a;b;g", "a;c;g", "a;d;g", "a;e;g", "a;f;g"]
|
|
},
|
|
"7I": {
|
|
h: ["a;b;g", "a;c;g", "a;d;g", "a;e;g", "a;f;g"],
|
|
v: ["a", "b;c;d;e;f", "g"]
|
|
}
|
|
};
|
|
|
|
function dhtmlXLayoutSepObject(g, a) {
|
|
var c = this;
|
|
this.conf = {
|
|
mode: g,
|
|
idx: a,
|
|
blocked: false,
|
|
locked: false
|
|
};
|
|
this._isLayoutSep = true;
|
|
this.sep = document.createElement("DIV");
|
|
this.sep.className = "dhxlayout_sep";
|
|
this._btnLeft = (window.dhx4.isIE && !window.addEventListener ? 1 : 0);
|
|
if (window.dhx4.isIE) {
|
|
this.sep.onselectstart = function() {
|
|
return false
|
|
}
|
|
}
|
|
this.sep.className = "dhxlayout_sep dhxlayout_sep_resize_" + this.conf.mode;
|
|
this._setSize = function(l, o, m, n) {
|
|
this.sep.style.left = l + "px";
|
|
this.sep.style.top = o + "px";
|
|
this.sep.style.width = m + "px";
|
|
this.sep.style.height = n + "px"
|
|
};
|
|
this._lockSep = function(h) {
|
|
this.conf.locked = (h == true);
|
|
this._blockSep()
|
|
};
|
|
this._blockSep = function() {
|
|
var h = this._getLayout();
|
|
var l = h.cdata.a.conf.collapsed || h.cdata.b.conf.collapsed || this.conf.locked;
|
|
h = null;
|
|
if (this.conf.blocked == l) {
|
|
return
|
|
}
|
|
this.sep.className = "dhxlayout_sep" + (l ? "" : " dhxlayout_sep_resize_" + this.conf.mode);
|
|
this.conf.blocked = l
|
|
};
|
|
this._beforeResize = function(l) {
|
|
if (this.conf.blocked) {
|
|
return
|
|
}
|
|
if (this.conf.resize != null && this.conf.resize.active == true) {
|
|
return
|
|
}
|
|
if (l.button !== this._btnLeft) {
|
|
return
|
|
}
|
|
var h = this._getLayout();
|
|
this.conf.resize = {
|
|
sx: l.clientX,
|
|
sy: l.clientY,
|
|
tx: l.layerX,
|
|
ty: l.layerY,
|
|
sep_x: parseInt(this.sep.style.left),
|
|
sep_y: parseInt(this.sep.style.top),
|
|
min_wa: h.cdata.a._getAvailWidth("a"),
|
|
min_wb: h.cdata.b._getAvailWidth("b"),
|
|
min_ha: h.cdata.a._getAvailHeight("a"),
|
|
min_hb: h.cdata.b._getAvailHeight("b")
|
|
};
|
|
this.conf.resize.nx = this.conf.resize.sep_x;
|
|
this.conf.resize.ny = this.conf.resize.sep_y;
|
|
if (window.addEventListener) {
|
|
document.body.addEventListener("mousemove", this._doOnMouseMove, false);
|
|
document.body.addEventListener("mouseup", this._doOnMouseUp, false)
|
|
} else {
|
|
document.body.attachEvent("onmousemove", this._doOnMouseMove);
|
|
document.body.attachEvent("onmouseup", this._doOnMouseUp)
|
|
}
|
|
h = null
|
|
};
|
|
this._onResize = function(l) {
|
|
if (!this.conf.resize.active) {
|
|
this._initResizeArea();
|
|
this.conf.resize.active = true
|
|
}
|
|
if (this.conf.mode == "v") {
|
|
var h = this.conf.resize.sx - l.clientX;
|
|
this.conf.resize.nx = this.conf.resize.sep_x - h;
|
|
if (this.conf.resize.nx > this.conf.resize.sep_x + this.conf.resize.min_wb) {
|
|
this.conf.resize.nx = this.conf.resize.sep_x + this.conf.resize.min_wb
|
|
} else {
|
|
if (this.conf.resize.nx < this.conf.resize.sep_x - this.conf.resize.min_wa) {
|
|
this.conf.resize.nx = this.conf.resize.sep_x - this.conf.resize.min_wa
|
|
}
|
|
}
|
|
this.r_sep.style.left = this.conf.resize.nx + "px"
|
|
} else {
|
|
var h = this.conf.resize.sy - l.clientY;
|
|
this.conf.resize.ny = this.conf.resize.sep_y - h;
|
|
if (this.conf.resize.ny > this.conf.resize.sep_y + this.conf.resize.min_hb) {
|
|
this.conf.resize.ny = this.conf.resize.sep_y + this.conf.resize.min_hb
|
|
} else {
|
|
if (this.conf.resize.ny < this.conf.resize.sep_y - this.conf.resize.min_ha) {
|
|
this.conf.resize.ny = this.conf.resize.sep_y - this.conf.resize.min_ha
|
|
}
|
|
}
|
|
this.r_sep.style.top = this.conf.resize.ny + "px"
|
|
}
|
|
};
|
|
this._afterResize = function(r) {
|
|
if (window.addEventListener) {
|
|
document.body.removeEventListener("mousemove", this._doOnMouseMove, false);
|
|
document.body.removeEventListener("mouseup", this._doOnMouseUp, false)
|
|
} else {
|
|
document.body.detachEvent("onmousemove", this._doOnMouseMove);
|
|
document.body.detachEvent("onmouseup", this._doOnMouseUp)
|
|
} if (!this.conf.resize.active) {
|
|
this.conf.resize = null;
|
|
return
|
|
}
|
|
if (r.button !== this._btnLeft) {
|
|
return
|
|
}
|
|
var n = this._getLayout();
|
|
var l = n._getMainInst();
|
|
var o = (l.checkEvent("onPanelResizeFinish") == true ? {} : false);
|
|
if (o !== false) {
|
|
l.forEachItem(function(u) {
|
|
o[u.conf.name] = {
|
|
w: u.conf.size.w,
|
|
h: u.conf.size.h
|
|
};
|
|
u = null
|
|
})
|
|
}
|
|
var m = this.conf.resize.nx - this.conf.resize.sep_x;
|
|
var h = this.conf.resize.ny - this.conf.resize.sep_y;
|
|
n.cdata.a._setSize(n.cdata.a.conf.size.x, n.cdata.a.conf.size.y, n.cdata.a.conf.size.w + m, n.cdata.a.conf.size.h + h, "a");
|
|
n.cdata.b._setSize(n.cdata.b.conf.size.x + m, n.cdata.b.conf.size.y + h, n.cdata.b.conf.size.w - m, n.cdata.b.conf.size.h - h, "b");
|
|
this._setSize(parseInt(this.r_sep.style.left), parseInt(this.r_sep.style.top), parseInt(this.r_sep.style.width), parseInt(this.r_sep.style.height));
|
|
if (window.dhx4.isIE) {
|
|
var s = this;
|
|
window.setTimeout(function() {
|
|
s._removeResizeArea();
|
|
s = null
|
|
}, 1)
|
|
} else {
|
|
this._removeResizeArea()
|
|
} if (o !== false) {
|
|
var q = [];
|
|
l.forEachItem(function(u) {
|
|
var v = o[u.conf.name];
|
|
if (!(v.w == u.conf.size.w && v.h == u.conf.size.h)) {
|
|
q.push(u.conf.name)
|
|
}
|
|
u = null
|
|
});
|
|
l._callMainEvent("onPanelResizeFinish", [q])
|
|
}
|
|
l = n = null;
|
|
this.conf.resize.active = false;
|
|
this.conf.resize = null
|
|
};
|
|
this._initResizeArea = function() {
|
|
if (!this.r_sep) {
|
|
this.r_sep = document.createElement("DIV");
|
|
this.r_sep.className = "dhxlayout_resize_sep";
|
|
this.r_sep.style.left = this.sep.style.left;
|
|
this.r_sep.style.top = this.sep.style.top;
|
|
this.r_sep.style.width = this.sep.style.width;
|
|
this.r_sep.style.height = this.sep.style.height;
|
|
this.sep.parentNode.appendChild(this.r_sep);
|
|
if (window.dhx4.isIE) {
|
|
this.r_sep.onselectstart = function() {
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
if (!this.r_area) {
|
|
this.r_area = document.createElement("DIV");
|
|
this.r_area.className = "dhxlayout_resize_area";
|
|
this.sep.parentNode.appendChild(this.r_area);
|
|
if (window.dhx4.isIE) {
|
|
this.r_area.onselectstart = function() {
|
|
return false
|
|
}
|
|
}
|
|
if (this.conf.mode == "v") {
|
|
var l = parseInt(this.r_sep.style.left) - this.conf.resize.min_wa;
|
|
var o = parseInt(this.r_sep.style.top);
|
|
var m = this.conf.resize.min_wa + this.conf.resize.min_wb + parseInt(this.r_sep.style.width);
|
|
var n = parseInt(this.r_sep.style.height)
|
|
} else {
|
|
var l = parseInt(this.r_sep.style.left);
|
|
var o = parseInt(this.r_sep.style.top) - this.conf.resize.min_ha;
|
|
var m = parseInt(this.r_sep.style.width);
|
|
var n = this.conf.resize.min_ha + this.conf.resize.min_hb + parseInt(this.r_sep.style.height)
|
|
}
|
|
this.r_area.style.left = l + "px";
|
|
this.r_area.style.top = o + "px";
|
|
if (!dhtmlXLayoutObject.prototype._confGlob.reszieCover) {
|
|
dhtmlXLayoutObject.prototype._confGlob.reszieCover = {};
|
|
this.r_area.style.width = m + "px";
|
|
this.r_area.style.height = n + "px";
|
|
dhtmlXLayoutObject.prototype._confGlob.reszieCover.w = parseInt(this.r_area.style.width) - this.r_area.offsetWidth;
|
|
dhtmlXLayoutObject.prototype._confGlob.reszieCover.h = parseInt(this.r_area.style.height) - this.r_area.offsetHeight
|
|
}
|
|
this.r_area.style.width = m + dhtmlXLayoutObject.prototype._confGlob.reszieCover.w + "px";
|
|
this.r_area.style.height = n + dhtmlXLayoutObject.prototype._confGlob.reszieCover.h + "px"
|
|
}
|
|
document.body.className += " dhxlayout_resize_" + this.conf.mode
|
|
};
|
|
this._removeResizeArea = function() {
|
|
this.r_sep.onselectstart = null;
|
|
this.r_sep.parentNode.removeChild(this.r_sep);
|
|
this.r_sep = null;
|
|
this.r_area.onselectstart = null;
|
|
this.r_area.parentNode.removeChild(this.r_area);
|
|
this.r_area = null;
|
|
document.body.className = String(document.body.className).replace(/\s{0,}dhxlayout_resize_[vh]/gi, "")
|
|
};
|
|
this._doOnMouseDown = function(h) {
|
|
h = h || event;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.cancelBubble = true
|
|
}
|
|
c._beforeResize(h)
|
|
};
|
|
this._doOnMouseMove = function(h) {
|
|
h = h || event;
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.cancelBubble = true
|
|
}
|
|
c._onResize(h)
|
|
};
|
|
this._doOnMouseUp = function(h) {
|
|
h = h || event;
|
|
c._afterResize(h)
|
|
};
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.sep.addEventListener("mousedown", this._doOnMouseDown, false)
|
|
} else {
|
|
this.sep.attachEvent("onmousedown", this._doOnMouseDown)
|
|
}
|
|
this._unload = function() {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.sep.removeEventListener("mousedown", this._doOnMouseDown, false)
|
|
} else {
|
|
this.sep.detachEvent("onmousedown", this._doOnMouseDown)
|
|
}
|
|
this.sep.parentNode.removeChild(this.sep);
|
|
this.sep = null;
|
|
for (var h in this) {
|
|
this[h] = null
|
|
}
|
|
c = null
|
|
};
|
|
return this
|
|
}
|
|
window.dhtmlXLayoutCell = function(h, g) {
|
|
dhtmlXCellObject.apply(this, [h, "_layout"]);
|
|
var c = this;
|
|
this.layout = g;
|
|
this.conf.skin = this.layout.conf.skin;
|
|
this.conf.mode = this.layout.conf.mode;
|
|
this.conf.collapsed = false;
|
|
this.conf.fixed = {
|
|
w: false,
|
|
h: false
|
|
};
|
|
this.conf.docked = true;
|
|
this.attachEvent("_onCellUnload", function() {
|
|
this.cell.childNodes[this.conf.idx.hdr].ondblclick = null;
|
|
this._unloadDocking();
|
|
this.layout = null;
|
|
c = null
|
|
});
|
|
this._hdrInit();
|
|
this.cell.childNodes[this.conf.idx.hdr].ondblclick = function() {
|
|
var l = c.layout._getMainInst();
|
|
l._callMainEvent("onDblClick", [c.conf.name]);
|
|
l = null
|
|
};
|
|
this.attachEvent("_onContentLoaded", function() {
|
|
var l = this.layout._getMainInst();
|
|
l._callMainEvent("onContentLoaded", [this.conf.name]);
|
|
l = null
|
|
});
|
|
if (this.conf.mode != "c") {
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhxlayout_arrow dhxlayout_arrow_" + this.conf.mode + this._idd;
|
|
this.cell.childNodes[this.conf.idx.hdr].appendChild(a);
|
|
a.onclick = function(l) {
|
|
if (c.conf.collapsed) {
|
|
c.expand()
|
|
} else {
|
|
c.collapse()
|
|
}
|
|
};
|
|
a = null
|
|
}
|
|
this._initDocking();
|
|
return this
|
|
};
|
|
dhtmlXLayoutCell.prototype = new dhtmlXCellObject();
|
|
dhtmlXLayoutCell.prototype.getId = function() {
|
|
return this.conf.name
|
|
};
|
|
dhtmlXLayoutCell.prototype._initDocking = function() {
|
|
var a = this;
|
|
this.dock = function() {
|
|
var g = this.layout._getMainInst();
|
|
if (g.dhxWins == null || this.conf.docked) {
|
|
g = null;
|
|
return
|
|
}
|
|
var c = g.dhxWins.window(this.conf.name);
|
|
c.close();
|
|
this._attachFromCell(c);
|
|
this.conf.docked = true;
|
|
if (!this.conf.dock_collapsed) {
|
|
this.expand()
|
|
}
|
|
g._callMainEvent("onDock", [this.conf.name]);
|
|
g = c = null
|
|
};
|
|
this.undock = function(c, o, m, n) {
|
|
var l = this.layout._getMainInst();
|
|
if (l.dhxWins == null || this.conf.docked == false) {
|
|
l = null;
|
|
return
|
|
}
|
|
this.conf.dock_collapsed = this.conf.collapsed;
|
|
if (!this.conf.collapsed) {
|
|
this.collapse()
|
|
}
|
|
if (l.dhxWins.window(this.conf.name) != null) {
|
|
var g = l.dhxWins.window(this.conf.name);
|
|
g.show()
|
|
} else {
|
|
if (c == null) {
|
|
c = 20
|
|
}
|
|
if (o == null) {
|
|
o = 20
|
|
}
|
|
if (m == null) {
|
|
m = 320
|
|
}
|
|
if (n == null) {
|
|
n = 200
|
|
}
|
|
var g = l.dhxWins.createWindow(this.conf.name, c, o, m, n);
|
|
g.button("close").hide();
|
|
g.addUserButton("dock", 99, "Dock");
|
|
g.button("dock").show();
|
|
g.button("dock").attachEvent("onClick", this._doOnDockClick);
|
|
g.setText(this.getText());
|
|
g.attachEvent("onClose", this._doOnDockWinClose)
|
|
}
|
|
this.conf.docked = false;
|
|
g._attachFromCell(this);
|
|
l._callMainEvent("onUnDock", [this.conf.name]);
|
|
l = g = null
|
|
};
|
|
this._doOnDockClick = function() {
|
|
a.dock()
|
|
};
|
|
this._doOnDockWinClose = function(c) {
|
|
c.hide();
|
|
return false
|
|
};
|
|
this._unloadDocking = function() {
|
|
a = null
|
|
}
|
|
};
|
|
dhtmlXLayoutCell.prototype._hdrInit = function() {
|
|
var c = "";
|
|
if (window.dhx4.isIE) {
|
|
if (navigator.userAgent.indexOf("MSIE 8.0") != -1) {
|
|
c = " dhx_cell_hdr_text_ie8"
|
|
} else {
|
|
if (navigator.userAgent.indexOf("MSIE 7.0") != -1) {
|
|
c = " dhx_cell_hdr_text_ie7"
|
|
} else {
|
|
if (navigator.userAgent.indexOf("MSIE 6.0") != -1) {
|
|
c = " dhx_cell_hdr_text_ie6"
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
if (window.dhx4.isChrome) {
|
|
c = " dhx_cell_hdr_text_chrome"
|
|
}
|
|
}
|
|
var a = document.createElement("DIV");
|
|
a.className = "dhx_cell_hdr";
|
|
a.innerHTML = "<div class='dhx_cell_hdr_text" + c + "'></div>";
|
|
this.cell.insertBefore(a, this.cell.childNodes[this.conf.idx.cont]);
|
|
a = null;
|
|
this.conf.ofs_nodes.t._getHdrHeight = "func";
|
|
this.conf.hdr = {
|
|
visible: true
|
|
};
|
|
this.conf.idx_data.hdr = "dhx_cell_hdr";
|
|
this._updateIdx();
|
|
this.attachEvent("_onSetSize", this._hdrOnSetSize);
|
|
this.attachEvent("_onBorderChange", this._hdrOnBorderChange);
|
|
this.attachEvent("_onViewSave", this._hdrOnViewSave);
|
|
this.attachEvent("_onViewRestore", this._hdrOnViewRestore)
|
|
};
|
|
dhtmlXLayoutCell.prototype.showHeader = function(a) {
|
|
if (this.conf.hdr.visible || this.conf.collapsed) {
|
|
return
|
|
}
|
|
if (this.conf.hdr.w_saved > this._getAvailWidth() || this.conf.hdr.h_saved > this._getAvailHeight()) {
|
|
return
|
|
}
|
|
this.conf.hdr.w_saved = this.conf.hdr.h_saved = null;
|
|
this.conf.hdr.visible = true;
|
|
this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_hdr";
|
|
if (a !== true) {
|
|
this._adjustCont(this._idd)
|
|
}
|
|
};
|
|
dhtmlXLayoutCell.prototype.hideHeader = function(a) {
|
|
if (!this.conf.hdr.visible || this.conf.collapsed) {
|
|
return
|
|
}
|
|
this.conf.hdr.w_saved = this._getMinWidth();
|
|
this.conf.hdr.h_saved = this._getMinHeight();
|
|
this.conf.hdr.visible = false;
|
|
this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_hdr dhx_cell_hdr_hidden";
|
|
this._hdrUpdBorder();
|
|
this._mtbUpdBorder();
|
|
if (a !== true) {
|
|
this._adjustCont(this._idd)
|
|
}
|
|
};
|
|
dhtmlXLayoutCell.prototype.isHeaderVisible = function() {
|
|
return (this.conf.hdr.visible == true)
|
|
};
|
|
dhtmlXLayoutCell.prototype.showArrow = function() {
|
|
this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display = ""
|
|
};
|
|
dhtmlXLayoutCell.prototype.hideArrow = function() {
|
|
this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display = "none"
|
|
};
|
|
dhtmlXLayoutCell.prototype.isArrowVisible = function() {
|
|
return (this.cell.childNodes[this.conf.idx.hdr].childNodes[1].style.display == "")
|
|
};
|
|
dhtmlXLayoutCell.prototype.setText = function(a) {
|
|
this.conf.hdr.text = a;
|
|
this._hdrUpdText()
|
|
};
|
|
dhtmlXLayoutCell.prototype.getText = function() {
|
|
return this.conf.hdr.text
|
|
};
|
|
dhtmlXLayoutCell.prototype.setCollapsedText = function(a) {
|
|
this.conf.hdr.text_collapsed = a;
|
|
this._hdrUpdText()
|
|
};
|
|
dhtmlXLayoutCell.prototype.getCollapsedText = function() {
|
|
return (this.conf.hdr.text_collapsed != null ? this.conf.hdr.text_collapsed : this.conf.hdr.text)
|
|
};
|
|
dhtmlXLayoutCell.prototype._hdrUpdText = function() {
|
|
var a = (this.conf.collapsed == true && this.conf.hdr.text_collapsed != null ? this.conf.hdr.text_collapsed : this.conf.hdr.text);
|
|
this.cell.childNodes[this.conf.idx.hdr].firstChild.innerHTML = "<span>" + a + "</span>"
|
|
};
|
|
dhtmlXLayoutCell.prototype._hdrUpdBorder = function() {
|
|
if (this.conf.borders == true) {
|
|
this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_hdr" + (this.conf.hdr.visible ? "" : " dhx_cell_hdr_hidden")
|
|
} else {
|
|
if (!this.conf.hdr.visible) {
|
|
this.cell.childNodes[this.conf.idx.hdr].className = "dhx_cell_hdr dhx_cell_hdr_hidden_no_borders"
|
|
}
|
|
}
|
|
};
|
|
dhtmlXLayoutCell.prototype._hdrOnSetSize = function() {
|
|
if (this.conf.collapsed && this.conf.mode == "v") {
|
|
this._fitHdr()
|
|
}
|
|
};
|
|
dhtmlXLayoutCell.prototype._hdrOnBorderChange = function() {
|
|
this.hideHeader(true);
|
|
this._hdrUpdBorder()
|
|
};
|
|
dhtmlXLayoutCell.prototype._hdrOnViewSave = function(a) {
|
|
this.views[a].hdr_vis = this.conf.hdr.visible
|
|
};
|
|
dhtmlXLayoutCell.prototype._hdrOnViewRestore = function(a) {
|
|
if (this.conf.hdr.visible != this.views[a].hdr_vis) {
|
|
this[this.views[a].hdr_vis ? "showHeader" : "hideHeader"](true)
|
|
}
|
|
this.views[a].hdr_vis = null;
|
|
delete this.views[a].hdr_vis
|
|
};
|
|
dhtmlXLayoutCell.prototype._getHdrHeight = function(a) {
|
|
if (this.conf.collapsed && this.conf.mode == "v" && a !== true) {
|
|
return 27
|
|
}
|
|
return this.cell.childNodes[this.conf.idx.hdr].offsetHeight
|
|
};
|
|
dhtmlXLayoutCell.prototype._fitHdr = function() {
|
|
if (this.conf.collapsed) {
|
|
if (typeof(dhtmlXLayoutObject.prototype._confGlob.hdrColH) == "undefined") {
|
|
this.cell.childNodes[this.conf.idx.hdr].style.height = this.cell.offsetHeight + "px";
|
|
dhtmlXLayoutObject.prototype._confGlob.hdrColH = parseInt(this.cell.childNodes[this.conf.idx.hdr].style.height) - this._getHdrHeight(true)
|
|
}
|
|
this.cell.childNodes[this.conf.idx.hdr].style.height = this.cell.offsetHeight + dhtmlXLayoutObject.prototype._confGlob.hdrColH + "px"
|
|
} else {
|
|
this.cell.childNodes[this.conf.idx.hdr].style.height = null
|
|
}
|
|
};
|
|
dhtmlXLayoutCell.prototype.expand = function(n) {
|
|
if (!this.conf.collapsed) {
|
|
return true
|
|
}
|
|
var g = this.layout;
|
|
if (this.conf.mode == "v") {
|
|
var m = (n ? g.conf.hh : g.cdata[g.conf.nextCell[this._idd]]._getMinWidth(this._idd));
|
|
var h = g.base.offsetWidth - g.conf.sw;
|
|
if (m + this.conf.size.w_avl > h) {
|
|
g = null;
|
|
return false
|
|
}
|
|
} else {
|
|
var l = (n ? g.conf.hh : g.cdata[g.conf.nextCell[this._idd]]._getMinHeight(this._idd) + g.cdata[g.conf.nextCell[this._idd]]._getHdrHeight());
|
|
var c = g.base.offsetHeight - g.conf.sw;
|
|
if (l + this.conf.size.h_avl > c) {
|
|
g = null;
|
|
return false
|
|
}
|
|
} if (this.conf.docked == false) {
|
|
this.dock();
|
|
return
|
|
}
|
|
this.cell.className = String(this.cell.className).replace(/\s{0,}dhxlayout_collapsed_[hv]/gi, "");
|
|
this.conf.collapsed = false;
|
|
if (this.conf.mode == "v") {
|
|
this.conf.size.w = Math.min(h - m, this.conf.size.w_saved);
|
|
this.conf.size.w_saved = this.conf.size.w_avl = null
|
|
} else {
|
|
this.conf.size.h = Math.min(c - l, this.conf.size.h_saved);
|
|
this.conf.size.h_saved = this.conf.size.h_avl = null
|
|
} if (this.conf.mode == "v") {
|
|
this._fitHdr()
|
|
}
|
|
g.setSizes(g.conf.nextCell[this._idd], g.conf.nextCell[this._idd], n == true, "expand");
|
|
g.sep._blockSep();
|
|
g = null;
|
|
this._hdrUpdText();
|
|
var a = this.layout._getMainInst();
|
|
a._callMainEvent("onExpand", [this.conf.name]);
|
|
a = null;
|
|
return true
|
|
};
|
|
dhtmlXLayoutCell.prototype.collapse = function() {
|
|
if (this.conf.collapsed) {
|
|
return false
|
|
}
|
|
var c = this.layout;
|
|
if (c.cdata[c.conf.nextCell[this._idd]].expand(true) == false) {
|
|
return false
|
|
}
|
|
if (this.conf.mode == "v") {
|
|
this.conf.size.w_saved = this.conf.size.w;
|
|
this.conf.size.w_avl = this._getMinWidth(this._idd)
|
|
} else {
|
|
this.conf.size.h_saved = this.conf.size.h;
|
|
this.conf.size.h_avl = this._getMinHeight(this._idd) + this._getHdrHeight()
|
|
}
|
|
this.cell.className += " dhxlayout_collapsed_" + this.conf.mode;
|
|
this.conf.collapsed = true;
|
|
if (this.conf.mode == "v") {
|
|
this.conf.size.w = c.conf.hh
|
|
} else {
|
|
this.conf.size.h = this._getHdrHeight()
|
|
}
|
|
c.setSizes(c.conf.nextCell[this._idd], c.conf.nextCell[this._idd], false, "collapse");
|
|
c.sep._blockSep();
|
|
c = null;
|
|
this._hdrUpdText();
|
|
var a = this.layout._getMainInst();
|
|
a._callMainEvent("onCollapse", [this.conf.name]);
|
|
a = null;
|
|
return true
|
|
};
|
|
dhtmlXLayoutCell.prototype.isCollapsed = function() {
|
|
return (this.conf.collapsed == true)
|
|
};
|
|
dhtmlXLayoutCell.prototype._getMinWidth = function(c) {
|
|
if (this.dataType == "layout" && this.dataObj != null) {
|
|
if (this.dataObj.conf.pattern == "1C") {
|
|
return this.dataObj.cdata.a._getMinWidth(c)
|
|
} else {
|
|
if (this.dataObj.conf.mode == "v") {
|
|
var a = c;
|
|
if (this.dataObj.cdata[a].conf.collapsed) {
|
|
a = this.dataObj.conf.nextCell[a]
|
|
}
|
|
return this.dataObj.cdata[a]._getMinWidth(c) + this.dataObj.cdata[this.dataObj.conf.nextCell[a]]._getWidth() + this.dataObj.conf.sw
|
|
} else {
|
|
return Math.max(this.dataObj.cdata.a._getMinWidth(c), this.dataObj.cdata.b._getMinWidth(c))
|
|
}
|
|
}
|
|
}
|
|
return 26
|
|
};
|
|
dhtmlXLayoutCell.prototype._getMinHeight = function(g) {
|
|
var c = 26;
|
|
if (this.conf.idx.menu != null) {
|
|
c += this.cell.childNodes[this.conf.idx.menu].offsetHeight
|
|
}
|
|
if (this.dataType == "layout" && this.dataObj != null) {
|
|
if (this.dataObj.conf.pattern == "1C") {
|
|
return this.dataObj.cdata.a._getMinHeight(g)
|
|
} else {
|
|
if (this.dataObj.conf.mode == "h") {
|
|
var a = g;
|
|
if (this.dataObj.cdata[a].conf.collapsed) {
|
|
a = this.dataObj.conf.nextCell[a]
|
|
}
|
|
return this.dataObj.cdata[a]._getMinHeight(g) + this.dataObj.cdata[a]._getHdrHeight() + this.dataObj.cdata[this.dataObj.conf.nextCell[a]]._getHeight() + this.dataObj.conf.sw
|
|
} else {
|
|
return Math.max(this.dataObj.cdata.a._getMinHeight(g) + this.dataObj.cdata.a._getHdrHeight(), this.dataObj.cdata.b._getMinHeight(g) + this.dataObj.cdata.b._getHdrHeight())
|
|
}
|
|
}
|
|
}
|
|
return c
|
|
};
|
|
dhtmlXLayoutCell.prototype._getAvailWidth = function(g) {
|
|
if (this.dataType == "layout" && this.dataObj != null) {
|
|
if (this.dataObj.conf.pattern == "1C") {
|
|
return this.dataObj.cdata.a._getAvailWidth(g)
|
|
} else {
|
|
if (this.dataObj.conf.mode == "v") {
|
|
var a = (this.dataObj.cdata.a.conf.collapsed == true);
|
|
var c = (this.dataObj.cdata.b.conf.collapsed == true);
|
|
if (g == "a") {
|
|
return this.dataObj.cdata[c ? "a" : "b"]._getAvailWidth(g)
|
|
} else {
|
|
return this.dataObj.cdata[a ? "b" : "a"]._getAvailWidth(g)
|
|
}
|
|
} else {
|
|
return Math.min(this.dataObj.cdata.a._getAvailWidth(g), this.dataObj.cdata.b._getAvailWidth(g))
|
|
}
|
|
}
|
|
}
|
|
return this.cell.offsetWidth - this._getMinWidth()
|
|
};
|
|
dhtmlXLayoutCell.prototype._getAvailHeight = function(h) {
|
|
if (this.dataType == "layout" && this.dataObj != null) {
|
|
if (this.dataObj.conf.pattern == "1C") {
|
|
return this.dataObj.cdata.a._getAvailHeight(h)
|
|
} else {
|
|
if (this.dataObj.conf.mode == "h") {
|
|
var c = (this.dataObj.cdata.a.conf.collapsed == true);
|
|
var g = (this.dataObj.cdata.b.conf.collapsed == true);
|
|
if (h == "a") {
|
|
return this.dataObj.cdata[g ? "a" : "b"]._getAvailHeight(h)
|
|
} else {
|
|
return this.dataObj.cdata[c ? "b" : "a"]._getAvailHeight(h)
|
|
}
|
|
} else {
|
|
return Math.min(this.dataObj.cdata.a._getAvailHeight(h), this.dataObj.cdata.b._getAvailHeight(h))
|
|
}
|
|
}
|
|
}
|
|
var a = this._getHdrHeight();
|
|
if (this.conf.mode == "v" && this.conf.collapsed) {
|
|
a = this.conf.hh
|
|
}
|
|
return this.cell.offsetHeight - a - this._getMinHeight()
|
|
};
|
|
dhtmlXLayoutCell.prototype.setWidth = function(h) {
|
|
if (this.conf.mode == "v") {
|
|
if (this.conf.collapsed) {
|
|
return
|
|
}
|
|
var l = this.layout;
|
|
var m = l.cdata[l.conf.nextCell[this._idd]];
|
|
if (m.conf.collapsed) {
|
|
h = h + l.conf.sw + m._getWidth();
|
|
n = l = m = null;
|
|
return
|
|
}
|
|
var g = this._getMinWidth(this._idd);
|
|
var o = l.base.offsetWidth - m._getMinWidth(this._idd) - l.conf.sw;
|
|
h = Math.max(g, Math.min(h, o));
|
|
this.conf.size.w = h;
|
|
l.setSizes(m._idd, m._idd);
|
|
l = m = null
|
|
} else {
|
|
if (this.layout == null || this.layout.parentLayout == null) {
|
|
return
|
|
}
|
|
var n = this.layout.parentLayout;
|
|
var l = this.layout;
|
|
var m = l.cdata[l.conf.nextCell[this._idd]];
|
|
for (var c in n.cdata) {
|
|
if (n.cdata[c].dataObj == l) {
|
|
n.cdata[c].setWidth(h)
|
|
}
|
|
}
|
|
n = l = null
|
|
}
|
|
};
|
|
dhtmlXLayoutCell.prototype.setHeight = function(o) {
|
|
if (this.conf.mode == "h") {
|
|
if (this.conf.collapsed) {
|
|
return
|
|
}
|
|
var l = this.layout;
|
|
var n = l.cdata[l.conf.nextCell[this._idd]];
|
|
if (n.conf.collapsed) {
|
|
o = o + l.conf.sw + n._getHeight();
|
|
var q = (this.layout != null && this.layout.parentLayout != null ? this.layout.parentLayout : null);
|
|
if (q != null) {
|
|
for (var c in q.cdata) {
|
|
if (q.cdata[c].dataObj == l) {
|
|
q.cdata[c].setHeight(o)
|
|
}
|
|
}
|
|
}
|
|
q = l = n = null;
|
|
return
|
|
}
|
|
var m = this._getMinHeight(this._idd) + this._getHdrHeight();
|
|
var g = l.base.offsetHeight - n._getMinHeight(this._idd) - n._getHdrHeight() - l.conf.sw;
|
|
o = Math.max(m, Math.min(o, g));
|
|
this.conf.size.h = o;
|
|
l.setSizes(n._idd, n._idd);
|
|
l = n = null
|
|
} else {
|
|
if (this.layout == null || this.layout.parentLayout == null) {
|
|
return
|
|
}
|
|
var q = this.layout.parentLayout;
|
|
var l = this.layout;
|
|
var n = l.cdata[l.conf.nextCell[this._idd]];
|
|
for (var c in q.cdata) {
|
|
if (q.cdata[c].dataObj == l) {
|
|
q.cdata[c].setHeight(o)
|
|
}
|
|
}
|
|
q = l = null
|
|
}
|
|
};
|
|
dhtmlXLayoutCell.prototype.getWidth = function() {
|
|
return this.conf.size.w
|
|
};
|
|
dhtmlXLayoutCell.prototype.getHeight = function() {
|
|
return this.conf.size.h
|
|
};
|
|
dhtmlXLayoutCell.prototype.fixSize = function(c, l) {
|
|
this.conf.fixed.w = window.dhx4.s2b(c);
|
|
this.conf.fixed.h = window.dhx4.s2b(l);
|
|
var a = this.layout._getMainInst();
|
|
var g = {};
|
|
a.forEachItem(function(h) {
|
|
if (h.conf.fsize != null) {
|
|
var r = h.getId();
|
|
var o = {
|
|
h: (h.conf.fixed.w == true),
|
|
v: (h.conf.fixed.h == true)
|
|
};
|
|
for (var m in o) {
|
|
if (o[m] == true && h.conf.fsize[m] != null) {
|
|
if (!(h.conf.fsize[m] instanceof Array)) {
|
|
h.conf.fsize[m] = [h.conf.fsize[m]]
|
|
}
|
|
for (var n = 0; n < h.conf.fsize[m].length; n++) {
|
|
g[h.conf.fsize[m][n]] = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
h = null
|
|
});
|
|
a._forEachSep(function(h) {
|
|
h._lockSep(g[h.conf.idx] == true);
|
|
h = null
|
|
});
|
|
a = null
|
|
};
|
|
|
|
function dhtmlXTabBar(c, l) {
|
|
var g = this;
|
|
this.conf = {
|
|
skin: (window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxtabbar") || "dhx_skyblue"),
|
|
fullScreen: false,
|
|
fullScreenResize: false,
|
|
lastActive: null,
|
|
closeButton: false,
|
|
align: "left",
|
|
tabsMode: (l == "bottom" ? "bottom" : "top"),
|
|
contZone: true,
|
|
transSpeed: "0.15s",
|
|
baseOfs: {
|
|
w: 2,
|
|
h: 2
|
|
},
|
|
tabsOfs: 1,
|
|
tabsTop: 0,
|
|
autoload: {}
|
|
};
|
|
var h;
|
|
if (c != null && typeof(c) == "object" && typeof(c.tagName) == "undefined") {
|
|
h = c.parent;
|
|
if (typeof(c.skin) != "undefined") {
|
|
this.conf.skin = c.skin
|
|
}
|
|
if (typeof(c.mode) != "undefined") {
|
|
this.conf.tabsMode = (c.mode == "bottom" ? "bottom" : "top")
|
|
}
|
|
if (typeof(c.align) != "undefined") {
|
|
this.conf.align = (c.align == "right" ? "right" : "left")
|
|
}
|
|
if (typeof(c.close_button) != "undefined") {
|
|
this.conf.closeButton = window.dhx4.s2b(c.close_button)
|
|
}
|
|
if (typeof(c.content_zone) != "undefined") {
|
|
this.conf.contZone = window.dhx4.s2b(c.content_zone)
|
|
}
|
|
if (typeof(c.xml) != "undefined") {
|
|
this.conf.autoload.xml = c.xml
|
|
}
|
|
if (typeof(c.json) != "undefined") {
|
|
this.conf.autoload.xml = c.json
|
|
}
|
|
if (typeof(c.tabs) != "undefined") {
|
|
this.conf.autoload.tabs = c.tabs
|
|
}
|
|
if (typeof(c.onload) != "undefined") {
|
|
this.conf.autoload.tabs = c.tabs
|
|
}
|
|
} else {
|
|
h = c
|
|
} if (h == document.body) {
|
|
document.documentElement.className += " dhxtabbar_fullscreen";
|
|
document.body.className += " dhxtabbar_fullscreen";
|
|
this.conf.fullScreen = true;
|
|
this.base = document.createElement("DIV");
|
|
this.base.className = "dhxtabbar_base_" + this.conf.skin;
|
|
this.base.style.position = "absolute";
|
|
this.base.style.left = this.conf.baseOfs.w + "px";
|
|
this.base.style.top = this.conf.baseOfs.h + "px";
|
|
document.body.appendChild(this.base)
|
|
} else {
|
|
this.base = (typeof(h) == "string" ? document.getElementById(h) : h);
|
|
h = null;
|
|
this.base.className += " dhxtabbar_base_" + this.conf.skin
|
|
} if (this.base._ofs != null && this.base._ofs.t != null) {
|
|
this.conf.tabsTop = this.base._ofs.t
|
|
}
|
|
this.tabsMode = document.createElement("DIV");
|
|
this.tabsMode.className = "dhxtabbar_tabs_" + this.conf.tabsMode;
|
|
this.base.appendChild(this.tabsMode);
|
|
this.tabsArea = document.createElement("DIV");
|
|
this.tabsArea.className = "dhxtabbar_tabs dhxtabbar_tabs_" + this.conf.tabsMode;
|
|
this.tabsArea.innerHTML = "<div class='dhxtabbar_tabs_ar_left'><div class='dhxtabbar_arrow_img'></div></div><div class='dhxtabbar_tabs_base'><div class='dhxtabbar_tabs_cont_" + this.conf.align + "'><div class='dhxtabbar_tabs_line'></div></div></div><div class='dhxtabbar_tabs_ar_right'><div class='dhxtabbar_arrow_img'></div></div>";
|
|
if (this.conf.tabsMode == "top") {
|
|
this.tabsArea.style.top = this.conf.tabsTop + "px"
|
|
}
|
|
this.tabsMode.appendChild(this.tabsArea);
|
|
this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align] = "0px";
|
|
this.tabsArea.childNodes[0].onclick = function() {
|
|
if (g.conf.align == "left") {
|
|
g._moveTabs(1)
|
|
} else {
|
|
g._moveTabs(-1)
|
|
}
|
|
};
|
|
this.tabsArea.childNodes[2].onclick = function() {
|
|
if (g.conf.align == "left") {
|
|
g._moveTabs(-1)
|
|
} else {
|
|
g._moveTabs(1)
|
|
}
|
|
};
|
|
this._onTabsAreaClick = function(m) {
|
|
return this._callMainEvent("onTabClose", [m])
|
|
};
|
|
this.tabsArea.onclick = function(n) {
|
|
n = n || event;
|
|
var m = (n.target || n.srcElement);
|
|
while (m != null) {
|
|
if (typeof(m._tabCloseId) != "undefined") {
|
|
if (g._onTabsAreaClick(m._tabCloseId) !== true) {
|
|
return
|
|
}
|
|
g.t[m._tabCloseId].conf.remove = true;
|
|
g._hideTab(m._tabCloseId);
|
|
m = null
|
|
} else {
|
|
if (typeof(m._tabId) != "undefined") {
|
|
g._doOnClick(m._tabId);
|
|
m = null
|
|
}
|
|
} if (m != null) {
|
|
m = m.parentNode;
|
|
if (m == this) {
|
|
m = null
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.tabsArea.onselectstart = function(m) {
|
|
m = m || event;
|
|
if (m.preventDefault) {
|
|
m.preventDefault()
|
|
} else {
|
|
m.returnValue = false
|
|
}
|
|
};
|
|
this._doOnClick = function(m) {
|
|
this.callEvent("onTabClick", [m, this.conf.lastActive]);
|
|
if (this.t[m].conf.enabled) {
|
|
this._setTabActive(m)
|
|
}
|
|
};
|
|
this.t = {};
|
|
this.addTab = function(m, v, o, s, r, w) {
|
|
if (typeof(w) != "boolean") {
|
|
w = (this.conf.closeButton == true)
|
|
}
|
|
r = window.dhx4.s2b(r);
|
|
var q = document.createElement("DIV");
|
|
q.className = "dhxtabbar_tab";
|
|
q.innerHTML = "<div class='dhxtabbar_tab_text" + (w ? " dhxtabbar_tab_text_close" : "") + "'>" + v + "</div>" + (w ? "<div class='dhxtabbar_tab_close'></div>" : "");
|
|
q._tabId = m;
|
|
if (w) {
|
|
q.childNodes[1]._tabCloseId = m
|
|
}
|
|
var n = this.tabsArea.childNodes[1].firstChild;
|
|
if (s != null && s + 1 > 0 && s + 1 < n.childNodes.length) {
|
|
n.insertBefore(q, n.childNodes[s + 1])
|
|
} else {
|
|
n.appendChild(q)
|
|
}
|
|
var x = false;
|
|
if (typeof(o) == "undefined" || o == null || o == "*") {
|
|
o = this._getLabelWidth(v, w);
|
|
x = true
|
|
} else {
|
|
o = parseInt(o)
|
|
}
|
|
q.style.width = o + "px";
|
|
var u = new dhtmlXTabBarCell(m, this);
|
|
this.tabsMode.appendChild(u.cell);
|
|
this.t[m] = {
|
|
tab: q,
|
|
cell: u,
|
|
conf: {
|
|
text: v,
|
|
visible: true,
|
|
active: false,
|
|
enabled: true,
|
|
close: w,
|
|
width: o,
|
|
autowidth: x
|
|
}
|
|
};
|
|
n = u = null;
|
|
if (r) {
|
|
this._setTabActive(m)
|
|
} else {
|
|
this._adjustCell(m)
|
|
}
|
|
};
|
|
this.setSizes = function() {
|
|
if (this.conf.fullScreen) {
|
|
this.base.style.width = document.body.offsetWidth - this.conf.baseOfs.w * 2 + "px";
|
|
this.base.style.height = document.body.offsetHeight - this.conf.baseOfs.h * 2 + "px"
|
|
}
|
|
if (this.conf.tabsAreaOfs == null) {
|
|
this.tabsArea.style.width = this.base.offsetWidth + "px";
|
|
this.conf.tabsAreaOfs = parseInt(this.tabsArea.style.width) - this.tabsArea.offsetWidth
|
|
}
|
|
this.tabsArea.style.width = this.base.offsetWidth + this.conf.tabsAreaOfs + "px";
|
|
this.tabsArea.childNodes[1].style.left = this.tabsArea.childNodes[0].offsetWidth - 1 + "px";
|
|
this.tabsArea.childNodes[1].style.width = Math.max(0, this.tabsArea.offsetWidth - this.tabsArea.childNodes[0].offsetWidth - this.tabsArea.childNodes[2].offsetWidth) + 1 + "px";
|
|
this._adjustCell(this.conf.lastActive);
|
|
this._adjustTabs()
|
|
};
|
|
this._adjustCell = function(q) {
|
|
if (!this.conf.contZone || q == null) {
|
|
return
|
|
}
|
|
var o = (this.conf.tabsMode == "top" ? this.tabsArea.offsetHeight : 0) + this.conf.tabsTop;
|
|
var n = this.base.offsetHeight - this.tabsArea.offsetHeight - this.conf.tabsTop;
|
|
var m = this.t[q].cell.dataType;
|
|
if (this.conf.skin == "dhx_skyblue" && (m == "layout" || m == "tabbar" || m == "acc")) {
|
|
if (this.conf.tabsMode == "top") {
|
|
o = o - 1
|
|
}
|
|
n = n + 1
|
|
}
|
|
if (q != this.conf.lastActive) {
|
|
o = -5000;
|
|
this.t[q].cell.cell.style.visibility = "hidden";
|
|
this.t[q].cell.cell.style.zIndex = 0
|
|
}
|
|
this.t[q].cell._setSize(0, o, this.base.offsetWidth, n)
|
|
};
|
|
this.setTabsMode = function(m) {
|
|
this.conf.tabsMode = (m == "bottom" ? "bottom" : "top");
|
|
this.tabsMode.className = "dhxtabbar_tabs_" + this.conf.tabsMode;
|
|
this.setSizes()
|
|
};
|
|
this._tabCss = function(r, o) {
|
|
var m = this.t[r].conf.active;
|
|
var q = !this.t[r].conf.enabled;
|
|
var n = !this.t[r].conf.visible;
|
|
return "dhxtabbar_tab" + (n ? " dhxtabbar_tab_hidden" : (m || q ? " dhxtabbar_tab" + (m ? "_actv" : "") + (q ? "_dis" : "") : ""))
|
|
};
|
|
this._getLabelWidth = function(o, n) {
|
|
if (!this.tabsTextTest) {
|
|
this.tabsTextTest = document.createElement("SPAN");
|
|
this.tabsTextTest.className = "dhxtabbar_tabs_text_test_" + this.conf.skin
|
|
}
|
|
document.body.appendChild(this.tabsTextTest);
|
|
this.tabsTextTest.innerHTML = o;
|
|
var m = this.tabsTextTest.offsetWidth;
|
|
m += (this.conf.skin == "dhx_terrace" ? 44 : 35);
|
|
m += (n ? (this.conf.skin == "dhx_terrace" ? 14 : 9) : 0);
|
|
document.body.removeChild(this.tabsTextTest);
|
|
return m
|
|
};
|
|
this._adjustTabs = function() {
|
|
var s = this.tabsArea.childNodes[1];
|
|
if (s.offsetWidth < 5) {
|
|
s = null;
|
|
return
|
|
}
|
|
var m = parseInt(s.childNodes[0].style[this.conf.align]);
|
|
var o = null;
|
|
for (var r = 0; r < s.childNodes[0].childNodes.length; r++) {
|
|
var u = s.childNodes[0].childNodes[r]._tabId;
|
|
if (u != null && this.t[u].conf.visible) {
|
|
var n = this.t[u].tab.offsetWidth - this.conf.tabsOfs;
|
|
if (this.t[u].conf.active) {
|
|
if (m < 0 || s.offsetWidth < n) {
|
|
o = {
|
|
d: 1,
|
|
id: u
|
|
}
|
|
} else {
|
|
if (m + n > s.offsetWidth) {
|
|
o = {
|
|
d: -1,
|
|
id: u
|
|
}
|
|
}
|
|
}
|
|
}
|
|
m += n
|
|
}
|
|
}
|
|
if (o != null) {
|
|
this._moveTabs(o.d, o.id)
|
|
} else {
|
|
if (s.offsetWidth > m + 1) {
|
|
s.childNodes[0].style[this.conf.align] = Math.min(0, parseInt(s.childNodes[0].style[this.conf.align]) + (s.offsetWidth - m)) + "px"
|
|
}
|
|
}
|
|
s = o = null
|
|
};
|
|
this._moveTabs = function(y, r) {
|
|
var o = this.tabsArea.childNodes[1].childNodes[0];
|
|
var v = 0;
|
|
var A = [];
|
|
var D = null;
|
|
for (var m = 0; m < o.childNodes.length; m++) {
|
|
var n = o.childNodes[m]._tabId;
|
|
if (n != null && this.t[n].conf.visible) {
|
|
A.push({
|
|
id: n,
|
|
w: this.t[n].tab.offsetWidth - this.conf.tabsOfs,
|
|
ind: v
|
|
});
|
|
if (n == r) {
|
|
D = v
|
|
}
|
|
v++
|
|
}
|
|
}
|
|
var C = parseInt(this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align]);
|
|
var u = this.tabsArea.offsetWidth - this.tabsArea.childNodes[0].offsetWidth - this.tabsArea.childNodes[2].offsetWidth;
|
|
var w = null;
|
|
var s = null;
|
|
for (var m = 0; m < A.length; m++) {
|
|
A[m].x = C;
|
|
if (w == null && C >= 0 && C + A[m].w > 0) {
|
|
w = A[m]
|
|
}
|
|
if (C < u && C + A[m].w <= u) {
|
|
s = A[m]
|
|
}
|
|
C += A[m].w
|
|
}
|
|
if (D != null) {
|
|
var E = A[D]
|
|
} else {
|
|
var E = null;
|
|
if (y > 0) {
|
|
if (w == null) {
|
|
if (A.length > 0) {
|
|
E = A[A.length - 1]
|
|
}
|
|
} else {
|
|
if (w.ind > 0 && A.length >= w.ind) {
|
|
E = A[w.ind - 1]
|
|
}
|
|
}
|
|
} else {
|
|
if (s == null) {
|
|
if (A.length > 0) {
|
|
E = A[0]
|
|
}
|
|
} else {
|
|
if (A.length > s.ind) {
|
|
E = A[s.ind + 1]
|
|
}
|
|
}
|
|
}
|
|
} if (E != null) {
|
|
if (y > 0) {
|
|
if (C < u) {
|
|
o.style[this.conf.align] = Math.min(0, parseInt(o.style[this.conf.align]) + (u - C)) + "px"
|
|
} else {
|
|
o.style[this.conf.align] = parseInt(o.style[this.conf.align]) - E.x + "px"
|
|
}
|
|
} else {
|
|
o.style[this.conf.align] = parseInt(o.style[this.conf.align]) - E.x + u - E.w + "px"
|
|
}
|
|
}
|
|
o = E = A = null
|
|
};
|
|
this._getNextVisible = function(n, m) {
|
|
return this._getNearVisible(n, m, "next")
|
|
};
|
|
this._getPrevVisible = function(n, m) {
|
|
return this._getNearVisible(n, m, "previous")
|
|
};
|
|
this._getFirstVisible = function() {
|
|
return this._getNearVisible(null, false, "first")
|
|
};
|
|
this._getNearVisible = function(s, o, r) {
|
|
if (r == "first") {
|
|
var q = this.tabsArea.childNodes[1].childNodes[0].childNodes[1];
|
|
r = "next"
|
|
} else {
|
|
if (s == null || this.t[s] == null) {
|
|
return (o ? this._getFirstVisible() : null)
|
|
}
|
|
var q = this.t[s].tab[r + "Sibling"]
|
|
}
|
|
var n = null;
|
|
while (q != null && n == null) {
|
|
var m = q._tabId;
|
|
if (m != null && n == null && this.t[m].conf.visible) {
|
|
n = m
|
|
} else {
|
|
q = q[r + "Sibling"]
|
|
}
|
|
}
|
|
q = null;
|
|
return n
|
|
};
|
|
this._showTab = function(n, m) {
|
|
if (!this.t[n] || this.t[n].conf.visible || this.t[n].conf.transActv) {
|
|
return
|
|
}
|
|
if (this.conf.transProp !== false) {
|
|
this.t[n].conf.transActv = true;
|
|
this.t[n].conf.transMode = "show";
|
|
this.t[n].conf.transProp = this.conf.transProp;
|
|
this.t[n].conf.transActvId = (m ? n : null);
|
|
if (!this.t[n].conf.transEv) {
|
|
this.t[n].tab.addEventListener(this.conf.transEv, this._doOnTrEnd);
|
|
this.t[n].conf.transEv = true
|
|
}
|
|
this.t[n].conf.visible = true;
|
|
this.t[n].tab.className = this._tabCss(n);
|
|
this.t[n].tab.style[this.conf.transProp] = this.conf.transValueWidth;
|
|
this.t[n].tab.style.width = this.t[n].conf.width + "px"
|
|
} else {
|
|
this.t[n].conf.visible = true;
|
|
this.t[n].tab.style.display = "";
|
|
if (m) {
|
|
this._setTabActive(n)
|
|
} else {
|
|
this._adjustTabs()
|
|
}
|
|
}
|
|
};
|
|
this._hideTab = function(s, m) {
|
|
if (!this.t[s] || !this.t[s].conf.visible || this.t[s].conf.transActv) {
|
|
return
|
|
}
|
|
var n = false;
|
|
if (this.conf.lastActive == s) {
|
|
this.conf.lastActive = null;
|
|
this.t[s].conf.active = false;
|
|
this.t[s].tab.className = this._tabCss(s);
|
|
n = true
|
|
}
|
|
var q = this._getPrevVisible(s);
|
|
var o = this._getNextVisible(s);
|
|
var r = (n && m !== false ? (m == true ? null : m) || o || q : null);
|
|
if (this.conf.transProp !== false) {
|
|
this.t[s].conf.transActv = true;
|
|
this.t[s].conf.transMode = "hide";
|
|
this.t[s].conf.transProp = this.conf.transProp;
|
|
this.t[s].conf.transActvId = r;
|
|
this.t[s].conf.visible = false;
|
|
if (!this.t[s].conf.transEv) {
|
|
this.t[s].tab.addEventListener(this.conf.transEv, this._doOnTrEnd);
|
|
this.t[s].conf.transEv = true
|
|
}
|
|
this.t[s].tab.style.visibility = "hidden";
|
|
this.t[s].tab.className = g._tabCss(s);
|
|
this.t[s].tab.style[this.conf.transProp] = this.conf.transValueWidth;
|
|
this.t[s].tab.style.width = "0px"
|
|
} else {
|
|
this.t[s].tab.style.display = "none";
|
|
this.t[s].conf.visible = false;
|
|
if (this.conf.contZone) {
|
|
this.t[s].cell.cell.style.visibility = "hidden";
|
|
this.t[s].cell.cell.style.top = "-5000px"
|
|
}
|
|
if (r != null) {
|
|
this._setTabActive(r)
|
|
}
|
|
this._adjustTabs();
|
|
if (this.t[s].conf.remove) {
|
|
this._removeTab(s)
|
|
}
|
|
}
|
|
};
|
|
this._isTabVisible = function(m) {
|
|
return (this.t[m].conf.visible == true)
|
|
};
|
|
this._doOnTrEnd = function() {
|
|
var o = this._tabId;
|
|
if (g.t[o] == null) {
|
|
return
|
|
}
|
|
var m = g.t[o];
|
|
var n = m.conf.transActvId;
|
|
if (m.conf.transMode == "hide") {
|
|
if (m.conf.remove) {
|
|
g._removeTab(o)
|
|
} else {
|
|
m.tab.style[m.conf.transProp] = "";
|
|
if (g.conf.contZone) {
|
|
m.cell.cell.style.visibility = "hidden";
|
|
m.cell.cell.style.top = "-5000px"
|
|
}
|
|
m.conf.transActv = false
|
|
}
|
|
} else {
|
|
if (m.conf.transMode == "show") {
|
|
m.tab.style[m.conf.transProp] = "";
|
|
m.tab.style.visibility = "visible";
|
|
m.conf.transMode = null;
|
|
m.conf.transActv = false
|
|
}
|
|
} if (n != null) {
|
|
g._setTabActive(n)
|
|
} else {
|
|
g._adjustTabs()
|
|
}
|
|
m = null
|
|
};
|
|
this.enableTabCloseButton = function(m) {
|
|
this.conf.closeButton = window.dhx4.s2b(m)
|
|
};
|
|
this.unload = function() {
|
|
this.clearAll();
|
|
this.t = null;
|
|
if (this.conf.fullScreen) {
|
|
if (window.addEventListener) {
|
|
window.removeEventListener("resize", this._doOnResizeStart, false)
|
|
} else {
|
|
window.detachEvent("onresize", this._doOnResizeStart)
|
|
}
|
|
this._doOnResizeStart = null;
|
|
this._doOnResizeEnd = null
|
|
}
|
|
if (this.tabsTextTest != null) {
|
|
if (this.tabsTextTest.parentNode) {
|
|
this.tabsTextTest.parentNode.removeChild(this.tabsTextTest)
|
|
}
|
|
this.tabsTextTest = null
|
|
}
|
|
window.dhx4._eventable(this, "clear");
|
|
window.dhx4._enableDataLoading(this, null, null, null, "clear");
|
|
this.tabsArea.childNodes[0].onclick = null;
|
|
this.tabsArea.childNodes[2].onclick = null;
|
|
this.tabsArea.onclick = null;
|
|
this.tabsArea.onselectstart = null;
|
|
this.tabsArea.parentNode.removeChild(this.tabsArea);
|
|
this.tabsArea = null;
|
|
this.tabsMode.parentNode.removeChild(this.tabsMode);
|
|
this.tabsMode = null;
|
|
if (this.conf.fullScreen) {
|
|
this.base.parentNode.removeChild(this.base);
|
|
document.documentElement.className = document.documentElement.className.replace("dhxtabbar_fullscreen", "");
|
|
document.body.className = document.body.className.replace("dhxtabbar_fullscreen", "")
|
|
} else {
|
|
this.base.className = this.base.className.replace("dhxtabbar_base_" + this.conf.skin, "")
|
|
}
|
|
this.base = null;
|
|
for (var m in this) {
|
|
this[m] = null
|
|
}
|
|
g = null
|
|
};
|
|
this.enableContentZone = function(m) {
|
|
this.conf.contZone = (m == true)
|
|
};
|
|
this.setSkin = function(n) {
|
|
this.base.className = this.base.className.replace(new RegExp("dhxtabbar_base_" + this.conf.skin), "dhxtabbar_base_" + n);
|
|
this.conf.skin = n;
|
|
if (this.tabsTextTest != null) {
|
|
this.tabsTextTest.className = "dhxtabbar_tabs_text_test_" + this.conf.skin
|
|
}
|
|
for (var m in this.t) {
|
|
this.t[m].cell._resetSizeState();
|
|
if (this.t[m].conf.autowidth == true) {
|
|
this.t[m].conf.width = this._getLabelWidth(this.t[m].conf.text, this.t[m].conf.close);
|
|
if (this.t[m].conf.visible) {
|
|
this.t[m].tab.style.width = this.t[m].conf.width + "px"
|
|
}
|
|
}
|
|
}
|
|
this.conf.tabsAreaOfs = null;
|
|
this._fixTabsOfs();
|
|
this.setSizes()
|
|
};
|
|
this.setAlign = function(m) {
|
|
m = (m == "left" ? "left" : "right");
|
|
if (m == this.conf.align) {
|
|
this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align] = "0px";
|
|
return
|
|
}
|
|
if (this.conf.transProp !== false) {
|
|
this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp] = ""
|
|
}
|
|
this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align] = "";
|
|
this.conf.align = m;
|
|
this.tabsArea.childNodes[1].childNodes[0].className = "dhxtabbar_tabs_cont_" + this.conf.align;
|
|
this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align] = "0px";
|
|
if (this.conf.transProp !== false) {
|
|
this.conf.transValuePos = this.conf.align + " " + this.conf.transSpeed;
|
|
this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp] = this.conf.transValuePos
|
|
}
|
|
};
|
|
this._initObj = function(r) {
|
|
this.clearAll();
|
|
var m = false;
|
|
if (r.settings != null) {
|
|
if (r.settings.skin != null) {
|
|
this.setSkin(r.settings.skin)
|
|
}
|
|
if (r.settings.closeButton != null) {
|
|
this.enableTabCloseButton(window.dhx4.s2b(r.settings.closeButton))
|
|
}
|
|
if (r.settings.align != null) {
|
|
this.setAlign(r.settings.align)
|
|
}
|
|
if (r.settings.hrefmode == "ajax" || r.settings.hrefmode == "ajax-html") {
|
|
m = true
|
|
}
|
|
}
|
|
if (r.tabs != null) {
|
|
for (var o = 0; o < r.tabs.length; o++) {
|
|
var n = r.tabs[o];
|
|
if (typeof(n.id) == "undefined") {
|
|
n.id = window.dhx4.newId()
|
|
}
|
|
if (!isNaN(parseInt(n.width))) {
|
|
n.width = parseInt(n.width)
|
|
} else {
|
|
n.width = null
|
|
}
|
|
this.addTab(n.id, n.text || n.label || "", n.width, n.index, window.dhx4.s2b(n.selected) || window.dhx4.s2b(n.active), n.close);
|
|
if (n.content != null) {
|
|
this.cells(n.id).attachHTMLString(n.content)
|
|
}
|
|
if (n.href != null) {
|
|
this.cells(n.id).attachURL(n.href, m)
|
|
}
|
|
if (typeof(n.enabled) != "undefined" && window.dhx4.s2b(n.enabled) == false) {
|
|
this.tabs(n.id).disable()
|
|
} else {
|
|
if (typeof(n.disabled) != "undefined" && window.dhx4.s2b(n.disabled) == true) {
|
|
this.tabs(n.id).disable()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this._xmlToObj = function(u) {
|
|
var s = {
|
|
settings: {},
|
|
tabs: []
|
|
};
|
|
var m = u.getElementsByTagName("tabbar")[0];
|
|
if (m != null) {
|
|
for (var v in {
|
|
skin: 1,
|
|
align: 1,
|
|
closeButton: 1,
|
|
hrefmode: 1
|
|
}) {
|
|
if (m.getAttribute(v) != null) {
|
|
s.settings[v] = m.getAttribute(v)
|
|
}
|
|
}
|
|
var y = m.getElementsByTagName("tab");
|
|
for (var n = 0; n < y.length; n++) {
|
|
var o = {
|
|
text: (y[n].firstChild.nodeValue || "")
|
|
};
|
|
for (var v in {
|
|
id: 1,
|
|
width: 1,
|
|
close: 1,
|
|
selected: 1,
|
|
active: 1,
|
|
enabled: 1,
|
|
disabled: 1,
|
|
href: 1
|
|
}) {
|
|
if (y[n].getAttribute(v) != null) {
|
|
o[v] = y[n].getAttribute(v)
|
|
}
|
|
}
|
|
var A = y[n].getElementsByTagName("content")[0];
|
|
if (A != null) {
|
|
o.content = "";
|
|
for (var x = 0; x < A.childNodes.length; x++) {
|
|
o.content += (A.childNodes[x].nodeValue || "")
|
|
}
|
|
}
|
|
s.tabs.push(o)
|
|
}
|
|
}
|
|
return s
|
|
};
|
|
dhx4._enableDataLoading(this, "_initObj", "_xmlToObj", "tabbar", {
|
|
struct: true
|
|
});
|
|
var a = window.dhx4.transDetect();
|
|
this.conf.transProp = a.transProp;
|
|
this.conf.transEv = a.transEv;
|
|
this.conf.transValueWidth = "width " + this.conf.transSpeed;
|
|
a = null;
|
|
if (this.conf.transProp !== false) {
|
|
this.conf.transValuePos = this.conf.align + " " + this.conf.transSpeed;
|
|
this.tabsArea.childNodes[1].childNodes[0].style[this.conf.transProp] = this.conf.transValuePos
|
|
}
|
|
this._initFullScreenResize = function() {
|
|
if (this.conf.fullScreenResize) {
|
|
return
|
|
}
|
|
this.conf.tmResize = null;
|
|
this._doOnResizeStart = function() {
|
|
window.clearTimeout(g.conf.tmResize);
|
|
g.conf.tmResize = window.setTimeout(g._doOnResizeEnd, 200)
|
|
};
|
|
this._doOnResizeEnd = function() {
|
|
g.setSizes()
|
|
};
|
|
if (window.addEventListener) {
|
|
window.addEventListener("resize", this._doOnResizeStart, false)
|
|
} else {
|
|
window.attachEvent("onresize", this._doOnResizeStart)
|
|
}
|
|
this.conf.fullScreenResize = true
|
|
};
|
|
if (this.conf.fullScreen) {
|
|
this._initFullScreenResize()
|
|
}
|
|
this._callMainEvent = function(n, m) {
|
|
return this.callEvent(n, m)
|
|
};
|
|
window.dhx4._eventable(this);
|
|
if (this.conf.autoload.json != null) {
|
|
this.loadStruct(this.conf.autoload.json, this.conf.autoload.onload)
|
|
} else {
|
|
if (this.conf.autoload.xml != null) {
|
|
this.loadStruct(this.conf.autoload.xml, this.conf.autoload.onload)
|
|
} else {
|
|
if (this.conf.autoload.tabs != null) {
|
|
this.loadStruct({
|
|
tabs: this.conf.autoload.tabs
|
|
})
|
|
}
|
|
}
|
|
}
|
|
this._fixTabsOfs();
|
|
this.setSizes();
|
|
return this
|
|
}
|
|
dhtmlXTabBar.prototype._fixTabsOfs = function(a) {};
|
|
dhtmlXTabBar.prototype.cells = dhtmlXTabBar.prototype.tabs = function(a) {
|
|
if (this.t[a]) {
|
|
return this.t[a].cell
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXTabBar.prototype.getAllTabs = function() {
|
|
var g = [];
|
|
for (var c in this.t) {
|
|
g.push(c)
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXTabBar.prototype._setTabActive = function(c, a) {
|
|
if (!this.t[c] || !this.t[c].conf.visible || this.t[c].conf.active) {
|
|
return
|
|
}
|
|
if (typeof(a) == "undefined") {
|
|
a = true
|
|
}
|
|
if (a == true && this.callEvent("onSelect", [c, this.conf.lastActive]) !== true) {
|
|
return
|
|
}
|
|
this.setTabInActive();
|
|
this.t[c].conf.active = true;
|
|
if (this.conf.contZone) {
|
|
this.t[c].cell.cell.style.visibility = "visible";
|
|
this.t[c].cell.cell.style.top = "0px";
|
|
this.t[c].cell.cell.style.zIndex = 1
|
|
}
|
|
this.t[c].tab.className = this._tabCss(c);
|
|
this.conf.lastActive = c;
|
|
this.setSizes()
|
|
};
|
|
dhtmlXTabBar.prototype.setTabInActive = function() {
|
|
if (this.conf.lastActive && this.t[this.conf.lastActive]) {
|
|
this.t[this.conf.lastActive].conf.active = false;
|
|
if (this.conf.contZone) {
|
|
this.t[this.conf.lastActive].cell.cell.style.visibility = "hidden";
|
|
this.t[this.conf.lastActive].cell.cell.style.top = "-5000px";
|
|
this.t[this.conf.lastActive].cell.cell.style.zIndex = 0
|
|
}
|
|
this.t[this.conf.lastActive].tab.className = this._tabCss(this.conf.lastActive);
|
|
this.conf.lastActive = null
|
|
}
|
|
};
|
|
dhtmlXTabBar.prototype._isTabActive = function(a) {
|
|
return (a == this.conf.lastActive && this.conf.lastActive != null)
|
|
};
|
|
dhtmlXTabBar.prototype.getActiveTab = function() {
|
|
return this.conf.lastActive
|
|
};
|
|
dhtmlXTabBar.prototype.goToNextTab = function() {
|
|
var a = this._getNextVisible(this.conf.lastActive, true);
|
|
if (a != null) {
|
|
this._setTabActive(a)
|
|
}
|
|
};
|
|
dhtmlXTabBar.prototype.goToPrevTab = function() {
|
|
var a = this._getPrevVisible(this.conf.lastActive, true);
|
|
if (a != null) {
|
|
this._setTabActive(a)
|
|
}
|
|
};
|
|
dhtmlXTabBar.prototype._enableTab = function(c, a) {
|
|
if (!this.t[c] || this.t[c].conf.enabled) {
|
|
return
|
|
}
|
|
this.t[c].conf.enabled = true;
|
|
this.t[c].tab.className = this._tabCss(c);
|
|
if (a == true) {
|
|
this._setTabActive(c)
|
|
}
|
|
};
|
|
dhtmlXTabBar.prototype._disableTab = function(c, a) {
|
|
if (!this.t[c] || !this.t[c].conf.enabled) {
|
|
return
|
|
}
|
|
this.t[c].conf.enabled = false;
|
|
this.t[c].tab.className = this._tabCss(c);
|
|
if (a !== false && this.conf.lastActive == c) {
|
|
if (a == true) {
|
|
a = this._getNextVisible(c) || this._getPrevVisible(c)
|
|
}
|
|
this._setTabActive(a)
|
|
}
|
|
};
|
|
dhtmlXTabBar.prototype._isTabEnabled = function(a) {
|
|
return (this.t[a] != null && this.t[a].conf.enabled == true)
|
|
};
|
|
dhtmlXTabBar.prototype._setTabText = function(h, g, c) {
|
|
if (!this.t[h]) {
|
|
return
|
|
}
|
|
var a = false;
|
|
if (typeof(c) == "undefined" || c == null) {
|
|
c = this._getLabelWidth(g, this.t[h].conf.close);
|
|
a = true
|
|
}
|
|
this.t[h].tab.style.width = c + "px";
|
|
this.t[h].tab.childNodes[0].innerHTML = g;
|
|
this.t[h].conf.text = g;
|
|
this.t[h].conf.width = c;
|
|
this.t[h].conf.autowidth = a
|
|
};
|
|
dhtmlXTabBar.prototype._getTabText = function(a) {
|
|
if (!this.t[a]) {
|
|
return null
|
|
}
|
|
return this.t[a].conf.text
|
|
};
|
|
dhtmlXTabBar.prototype._removeTab = function(o, g, m) {
|
|
if (!this.t[o]) {
|
|
return
|
|
}
|
|
if (m != true && this.t[o].conf.remove != true) {
|
|
this.t[o].conf.remove = true;
|
|
this._hideTab(o, g);
|
|
return
|
|
}
|
|
if (typeof(g) == "undefined") {
|
|
g = true
|
|
}
|
|
var h = this._getNextVisible(o);
|
|
var l = this._getPrevVisible(o);
|
|
if (this.t[o].conf.transEv == true) {
|
|
this.t[o].tab.removeEventListener(this.conf.transEv, this._doOnTrEnd);
|
|
this.t[o].conf.transEv = false
|
|
}
|
|
for (var c in this.t[o].conf) {
|
|
this.t[o].conf[c] = null
|
|
}
|
|
this.t[o].conf = null;
|
|
delete this.t[o].conf;
|
|
this.t[o].cell._unload();
|
|
this.t[o].cell = null;
|
|
this.t[o].tab.parentNode.removeChild(this.t[o].tab);
|
|
this.t[o].tab = null;
|
|
this.t[o] = null;
|
|
delete this.t[o];
|
|
if (this.conf.lastActive == o && g != false) {
|
|
this.conf.lastActive = null;
|
|
var n = (g == true ? (h || l || this._getFirstVisible()) : g);
|
|
if (n != null) {
|
|
this._setTabActive(n)
|
|
}
|
|
} else {
|
|
if (m != true) {
|
|
this._adjustTabs()
|
|
}
|
|
}
|
|
};
|
|
dhtmlXTabBar.prototype.clearAll = function() {
|
|
for (var c in this.t) {
|
|
this._removeTab(c, false, true)
|
|
}
|
|
this.tabsArea.childNodes[1].childNodes[0].style[this.conf.align] = "0px"
|
|
};
|
|
dhtmlXTabBar.prototype.moveTab = function(g, a) {
|
|
if (!this.t[g] || a < 0) {
|
|
return
|
|
}
|
|
a += 1;
|
|
var c = this.tabsArea.childNodes[1].firstChild;
|
|
if (c.childNodes[a] != this.t[g].tab) {
|
|
c.removeChild(this.t[g].tab);
|
|
if (a >= c.childNodes.length) {
|
|
c.appendChild(this.t[g].tab)
|
|
} else {
|
|
c.insertBefore(this.t[g].tab, c.childNodes[a])
|
|
}
|
|
}
|
|
c = null
|
|
};
|
|
dhtmlXTabBar.prototype._getIndex = function(h) {
|
|
var a = -1;
|
|
var g = this.tabsArea.childNodes[1].firstChild;
|
|
for (var c = 1; c < g.childNodes.length; c++) {
|
|
if (g.childNodes[c]._tabId == h) {
|
|
a = c - 1
|
|
}
|
|
}
|
|
g = null;
|
|
return a
|
|
};
|
|
dhtmlXTabBar.prototype.getNumberOfTabs = function(h) {
|
|
var g = 0;
|
|
for (var c in this.t) {
|
|
g += (h != true ? 1 : (this.t[c].conf.visible == true ? 1 : 0))
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXTabBar.prototype.forEachCell = dhtmlXTabBar.prototype.forEachTab = function(g) {
|
|
for (var c in this.t) {
|
|
g.apply(window, [this.t[c].cell])
|
|
}
|
|
};
|
|
dhtmlXTabBar.prototype.enableAutoReSize = function() {
|
|
this._initFullScreenResize()
|
|
};
|
|
window.dhtmlXTabBarCell = function(h, g) {
|
|
dhtmlXCellObject.apply(this, [h, "_tabbar"]);
|
|
this.tabbar = g;
|
|
this.conf.skin = this.tabbar.conf.skin;
|
|
this.conf.tabbar_funcs = {
|
|
show: "_showTab",
|
|
hide: "_hideTab",
|
|
isVisible: "_isTabVisible",
|
|
enable: "_enableTab",
|
|
disable: "_disableTab",
|
|
isEnabled: "_isTabEnabled",
|
|
getIndex: "_getIndex",
|
|
getText: "_getTabText",
|
|
setText: "_setTabText",
|
|
setActive: "_setTabActive",
|
|
isActive: "_isTabActive",
|
|
close: "_removeTab"
|
|
};
|
|
this._tabbarCall = function(a) {
|
|
return function() {
|
|
var l = [this._idd];
|
|
for (var m = 0; m < arguments.length; m++) {
|
|
l.push(arguments[m])
|
|
}
|
|
return this.tabbar[a].apply(this.tabbar, l)
|
|
}
|
|
};
|
|
for (var c in this.conf.tabbar_funcs) {
|
|
this[c] = this._tabbarCall(this.conf.tabbar_funcs[c])
|
|
}
|
|
this.attachEvent("_onCellUnload", function() {
|
|
this.tabbar = null;
|
|
for (var l in this.conf.tabbar_funcs) {
|
|
this[l] = null;
|
|
this.conf.tabbar_funcs[l] = null
|
|
}
|
|
this.conf.tabbar_funcs = null
|
|
});
|
|
this.attachEvent("_onContentLoaded", function() {
|
|
this.tabbar._callMainEvent("onContentLoaded", arguments);
|
|
this.tabbar._callMainEvent("onTabContentLoaded", arguments)
|
|
});
|
|
this.attachEvent("_onContentAttach", function() {
|
|
this.tabbar._adjustCell(this.tabbar.conf.lastActive)
|
|
})
|
|
};
|
|
window.dhtmlXTabBarCell.prototype = new dhtmlXCellObject();
|
|
|
|
function dhtmlXTabBarInitFromHTML() {
|
|
var z = document.getElementsByTagName("div");
|
|
for (var i = 0; i < z.length; i++) {
|
|
if (z[i].className.indexOf("dhtmlxTabBar") != -1) {
|
|
var conf = {
|
|
settings: {},
|
|
tabs: []
|
|
};
|
|
var n = z[i];
|
|
var id = n.id;
|
|
n.className = "";
|
|
var k = new Array();
|
|
for (var j = 0; j < n.childNodes.length; j++) {
|
|
if (n.childNodes[j].tagName && n.childNodes[j].tagName != "!") {
|
|
k[k.length] = n.childNodes[j]
|
|
}
|
|
}
|
|
var skin = n.getAttribute("skin");
|
|
if (skin != null) {
|
|
conf.settings.skin = skin
|
|
}
|
|
var w = new dhtmlXTabBar({
|
|
parent: id,
|
|
mode: n.getAttribute("mode")
|
|
});
|
|
window[id] = w;
|
|
acs = n.getAttribute("onbeforeinit");
|
|
if (acs) {
|
|
eval(acs)
|
|
}
|
|
align = n.getAttribute("align");
|
|
if (align) {
|
|
conf.settings.align = align
|
|
}
|
|
var cont = {};
|
|
for (var j = 0; j < k.length; j++) {
|
|
var m = k[j];
|
|
var tab = {
|
|
id: m.id,
|
|
text: m.getAttribute("name"),
|
|
width: m.getAttribute("width"),
|
|
selected: m.getAttribute("selected"),
|
|
active: m.getAttribute("active"),
|
|
close: m.getAttribute("close")
|
|
};
|
|
var href = m.getAttribute("href");
|
|
if (href) {
|
|
cont[m.id] = {
|
|
href: href
|
|
}
|
|
} else {
|
|
cont[m.id] = {
|
|
cont: m
|
|
}
|
|
}
|
|
conf.tabs.push(tab)
|
|
}
|
|
w.loadStruct(conf);
|
|
for (var a in cont) {
|
|
if (cont[a].href) {
|
|
w.cells(a).attachURL(cont[a].href);
|
|
cont[a].href = null
|
|
} else {
|
|
w.cells(a).attachObject(cont[a].cont);
|
|
if (cont[a].cont.style.display == "none") {
|
|
cont[a].cont.style.display = ""
|
|
}
|
|
cont[a].cont = null
|
|
}
|
|
cont[a] = null
|
|
}
|
|
var selId = n.getAttribute("select");
|
|
if (selId != null) {
|
|
w.tabs(selId).setActive()
|
|
} else {
|
|
if (w.getActiveTab() == null) {
|
|
var v = w._getFirstVisible();
|
|
if (v != null) {
|
|
w.cells(v).setActive()
|
|
}
|
|
}
|
|
}
|
|
acs = n.getAttribute("oninit");
|
|
if (acs) {
|
|
eval(acs)
|
|
}
|
|
}
|
|
}
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("load", dhtmlXTabBarInitFromHTML, false)
|
|
} else {
|
|
window.detachEvent("onload", dhtmlXTabBarInitFromHTML)
|
|
}
|
|
}
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.addEventListener("load", dhtmlXTabBarInitFromHTML, false)
|
|
} else {
|
|
window.attachEvent("onload", dhtmlXTabBarInitFromHTML)
|
|
}
|
|
|
|
function dhtmlXWindows(o) {
|
|
var m = this;
|
|
var h = {};
|
|
if (typeof(o) != "undefined") {
|
|
for (var g in o) {
|
|
h[g] = o[g]
|
|
}
|
|
}
|
|
o = null;
|
|
this.conf = {
|
|
skin: window.dhx4.skin || (typeof(dhtmlx) != "undefined" ? dhtmlx.skin : null) || window.dhx4.skinDetect("dhxwins") || "dhx_skyblue",
|
|
vp_pos_ofs: 20,
|
|
vp_custom: false,
|
|
ofs_w: null,
|
|
ofs_h: null,
|
|
button_last: null,
|
|
dblclick_tm: 300,
|
|
dblclick_last: null,
|
|
dblclick_id: null,
|
|
dblclick_mode: "minmax",
|
|
dblclick_active: false,
|
|
dblclick_ev: (navigator.userAgent.indexOf("MSIE 6.0") >= 0 || navigator.userAgent.indexOf("MSIE 7.0") >= 0 || navigator.userAgent.indexOf("MSIE 8.0") >= 0),
|
|
fr_cover: (navigator.userAgent.indexOf("MSIE 6.0") >= 0)
|
|
};
|
|
var c = window.dhx4.transDetect();
|
|
this.conf.tr = {
|
|
prop: c.transProp,
|
|
ev: c.transEv,
|
|
height_open: "height 0.2s cubic-bezier(0.25,0.1,0.25,1)",
|
|
height_close: "height 0.18s cubic-bezier(0.25,0.1,0.25,1)",
|
|
op_open: "opacity 0.16s ease-in",
|
|
op_close: "opacity 0.2s ease-out",
|
|
op_v_open: "1",
|
|
op_v_close: "0.4"
|
|
};
|
|
if (!h.viewport) {
|
|
this.attachViewportTo(document.body)
|
|
} else {
|
|
if (h.viewport.object != null) {
|
|
this.attachViewportTo(h.viewport.object)
|
|
} else {
|
|
if (h.viewport.left != null && h.viewport.top != null && h.viewport.width != null && h.viewport.height != null) {
|
|
this.setViewport(h.viewport.left, h.viewport.top, h.viewport.width, h.viewport.height, h.viewport.parent)
|
|
} else {
|
|
this.attachViewportTo(document.body)
|
|
}
|
|
}
|
|
}
|
|
this.w = {};
|
|
this.createWindow = function(s, H, E, u, J) {
|
|
var q = {};
|
|
if (arguments.length == 1 && typeof(s) == "object") {
|
|
q = s
|
|
} else {
|
|
q.id = s;
|
|
q.left = H;
|
|
q.top = E;
|
|
q.width = u;
|
|
q.height = J;
|
|
if (typeof(q.id) == "undefined" || q.id == null) {
|
|
q.id = window.dhx4.newId()
|
|
}
|
|
while (this.w[q.id] != null) {
|
|
q.id = window.dhx4.newId()
|
|
}
|
|
} if (q.left == null) {
|
|
q.left = 0
|
|
}
|
|
if (q.top == null) {
|
|
q.top = 0
|
|
}
|
|
q.move = (q.move != null && window.dhx4.s2b(q.move) == false ? false : (q.deny_move != null && window.dhx4.s2b(q.deny_move) == true ? false : true));
|
|
q.park = (q.park != null && window.dhx4.s2b(q.park) == false ? false : (q.deny_park != null && window.dhx4.s2b(q.deny_park) == true ? false : true));
|
|
q.resize = (q.resize != null && window.dhx4.s2b(q.resize) == false ? false : (q.deny_resize != null && window.dhx4.s2b(q.deny_resize) == true ? false : true));
|
|
q.keep_in_viewport = (q.keep_in_viewport != null && window.dhx4.s2b(q.keep_in_viewport));
|
|
q.modal = (q.modal != null && window.dhx4.s2b(q.modal));
|
|
q.center = (q.center != null && window.dhx4.s2b(q.center));
|
|
q.text = (q.text != null ? q.text : (q.caption != null ? q.caption : "dhtmlxWindow"));
|
|
q.header = (!(q.header != null && window.dhx4.s2b(q.header) == false));
|
|
var K = document.createElement("DIV");
|
|
K.className = "dhxwin_active";
|
|
K.style.viosibility = "hidden";
|
|
this.vp.appendChild(K);
|
|
K._isWindow = true;
|
|
K._idd = q.id;
|
|
var A = document.createElement("DIV");
|
|
A.className = "dhxwin_hdr";
|
|
A.style.zIndex = 0;
|
|
A.innerHTML = "<div class='dhxwin_icon'></div><div class='dhxwin_text'><div class='dhxwin_text_inside'>" + q.text + "</div></div><div class='dhxwin_btns'></div>";
|
|
K.appendChild(A);
|
|
A.onselectstart = function(a) {
|
|
a = a || event;
|
|
if (a.preventDefault) {
|
|
a.preventDefault()
|
|
} else {
|
|
a.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
A.oncontextmenu = function(a) {
|
|
a = a || event;
|
|
a.cancelBubble = true;
|
|
return false
|
|
};
|
|
A._isWinHdr = true;
|
|
A.firstChild._isWinIcon = true;
|
|
var v = document.createElement("DIV");
|
|
v.className = "dhxwin_brd";
|
|
K.appendChild(v);
|
|
var D = document.createElement("DIV");
|
|
D.className = "dhxwin_fr_cover";
|
|
D.innerHTML = "<iframe class='dhxwin_fr_cover_inner' frameborder='0' border='0' style='background-color:#e8f1ff'></iframe><div class='dhxwin_fr_cover_inner' style='background-color:#e8f1ff'></div>";
|
|
K.appendChild(D);
|
|
this.w[q.id] = {
|
|
win: K,
|
|
hdr: A,
|
|
brd: v,
|
|
fr_cover: D,
|
|
b: {},
|
|
conf: {
|
|
z_id: window.dhx4.newId(),
|
|
actv: false,
|
|
modal: false,
|
|
maxed: false,
|
|
parked: false,
|
|
sticked: false,
|
|
visible: true,
|
|
header: true,
|
|
text: q.text,
|
|
keep_in_vp: q.keep_in_viewport,
|
|
allow_move: q.move,
|
|
allow_park: q.park,
|
|
allow_resize: q.resize,
|
|
max_w: null,
|
|
max_h: null,
|
|
min_w: 80,
|
|
min_h: 80
|
|
}
|
|
};
|
|
var w = {
|
|
help: {
|
|
title: "Help",
|
|
visible: false
|
|
},
|
|
stick: {
|
|
title: "Stick",
|
|
visible: false
|
|
},
|
|
park: {
|
|
title: "Park",
|
|
visible: true
|
|
},
|
|
minmax: {
|
|
title: "Min/Max",
|
|
visible: true
|
|
},
|
|
close: {
|
|
title: "Close",
|
|
visible: true
|
|
}
|
|
};
|
|
for (var F in w) {
|
|
var C = new dhtmlXWindowsButton(this, q.id, F, w[F].title, false);
|
|
if (w[F].visible == false) {
|
|
C.hide()
|
|
}
|
|
A.lastChild.appendChild(C.button);
|
|
this.w[q.id].b[F] = C;
|
|
C = null
|
|
}
|
|
this._winAdjustTitle(q.id);
|
|
this.w[q.id].win.style.zIndex = window.dhx4.zim.reserve(this.w[q.id].conf.z_id);
|
|
var I = new dhtmlXWindowsCell(q.id, this);
|
|
this.w[q.id].win.insertBefore(I.cell, D);
|
|
this.w[q.id].cell = I;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.w[q.id].win.addEventListener("mousedown", this._winOnMouseDown, false);
|
|
this.w[q.id].win.addEventListener("mouseup", this._winOnMouseDown, false);
|
|
if (this.conf.dblclick_ev) {
|
|
this.w[q.id].win.addEventListener("dblclick", this._winOnMouseDown, false)
|
|
}
|
|
} else {
|
|
this.w[q.id].win.attachEvent("onmousedown", this._winOnMouseDown);
|
|
this.w[q.id].win.attachEvent("onmouseup", this._winOnMouseDown);
|
|
if (this.conf.dblclick_ev) {
|
|
this.w[q.id].win.attachEvent("ondblclick", this._winOnMouseDown)
|
|
}
|
|
}
|
|
this._winInitFRM(q.id);
|
|
this._winSetPosition(q.id, q.left, q.top);
|
|
this._winSetSize(q.id, q.width, q.height);
|
|
this._winMakeActive(q.id);
|
|
if (q.center == true) {
|
|
this.w[q.id].cell.center()
|
|
}
|
|
if (q.modal == true) {
|
|
this.w[q.id].cell.setModal(true)
|
|
}
|
|
if (q.header == false) {
|
|
this.w[q.id].cell.hideHeader()
|
|
}
|
|
f = K = A = v = D = I = null;
|
|
return this.w[q.id].cell
|
|
};
|
|
this._winOnMouseDown = function(r) {
|
|
r = r || event;
|
|
var a = r.target || r.srcElement;
|
|
var q = {
|
|
press_type: r.type
|
|
};
|
|
while (a != null && a._isWindow != true) {
|
|
if (typeof(a.className) != "undefined" && q.mode == null) {
|
|
if (typeof(a._buttonName) != "undefined") {
|
|
q.mode = "button";
|
|
q.button_name = a._buttonName
|
|
} else {
|
|
if (a._isWinHdr == true) {
|
|
q.mode = "hdr"
|
|
} else {
|
|
if (a._isWinIcon == true) {
|
|
q.mode = "icon"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
a = a.parentNode
|
|
}
|
|
if (q.mode == null) {
|
|
q.mode = "win"
|
|
}
|
|
q.id = (a != null && a._isWindow == true ? a._idd : null);
|
|
a = null;
|
|
if (q.id != null) {
|
|
m.callEvent("_winMouseDown", [r, q])
|
|
}
|
|
};
|
|
this._winOnParkTrans = function(q) {
|
|
if (q.stopPropagation) {
|
|
q.stopPropagation()
|
|
}
|
|
var a = m.w[this._idd];
|
|
if (q.propertyName == "opacity") {
|
|
m._winCellClearOpacity(this._idd)
|
|
}
|
|
if (q.propertyName == "height" && a.conf.tr_mode == "park") {
|
|
if (a.conf.tr_mode == "park") {
|
|
a.win.style[m.conf.tr.prop] = "";
|
|
if (!a.conf.parked) {
|
|
m._winAdjustCell(this._idd);
|
|
m._callMainEvent("onParkDown", this._idd);
|
|
if (a.conf.keep_in_vp) {
|
|
m._winAdjustPosition(this._idd, a.conf.x, a.conf.y)
|
|
}
|
|
} else {
|
|
a.hdr.style.zIndex = 3;
|
|
m._callMainEvent("onParkUp", this._idd)
|
|
}
|
|
}
|
|
}
|
|
a = null
|
|
};
|
|
this.unload = function() {
|
|
this.conf.unloading = true;
|
|
if (this._dndInitModule) {
|
|
this._dndUnloadModule()
|
|
}
|
|
for (var q in this.w) {
|
|
this._winClose(q)
|
|
}
|
|
this.w = null;
|
|
if (this.cm != null && typeof(this._unloadContextMenu) == "function") {
|
|
this._unloadContextMenu()
|
|
}
|
|
window.dhx4._eventable(this, "clear");
|
|
this.attachViewportTo(null);
|
|
for (var q in this.conf) {
|
|
this.conf[q] = null;
|
|
delete this.conf[q]
|
|
}
|
|
for (var q in this) {
|
|
this[q] = null
|
|
}
|
|
m = q = null
|
|
};
|
|
window.dhx4._eventable(this);
|
|
this.attachEvent("_winMouseDown", this._winMouseDownHandler);
|
|
if (this._dndInitModule) {
|
|
this._dndInitModule()
|
|
}
|
|
if (h.wins != null) {
|
|
for (var n = 0; n < h.wins.length; n++) {
|
|
var l = h.wins[n];
|
|
this.createWindow(l)
|
|
}
|
|
}
|
|
h = null;
|
|
return this
|
|
}
|
|
dhtmlXWindows.prototype.forEachWindow = function(g) {
|
|
for (var c in this.w) {
|
|
g.apply(window, [this.w[c].cell])
|
|
}
|
|
};
|
|
dhtmlXWindows.prototype.window = function(a) {
|
|
if (this.w[a] != null) {
|
|
return this.w[a].cell
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXWindows.prototype.isWindow = function(a) {
|
|
return (this.w[a] != null)
|
|
};
|
|
dhtmlXWindows.prototype.findByText = function(h) {
|
|
var g = [];
|
|
for (var c in this.w) {
|
|
if ((this.w[c].cell.getText()).indexOf(String(h)) >= 0) {
|
|
g.push(this.w[c])
|
|
}
|
|
}
|
|
return g
|
|
};
|
|
dhtmlXWindows.prototype.setSkin = function(g) {
|
|
if (g == this.conf.skin) {
|
|
return
|
|
}
|
|
if (this.vp != null) {
|
|
this.vp.className = String(this.vp.className).replace("dhxwins_vp_" + this.conf.skin, " dhxwins_vp_" + g)
|
|
}
|
|
for (var c in this.w) {
|
|
this.w[c].cell._resetSizeState();
|
|
this._winAdjustCell(c);
|
|
this._winAdjustTitle(c)
|
|
}
|
|
this.conf.skin = g
|
|
};
|
|
dhtmlXWindows.prototype.getBottommostWindow = function() {
|
|
return this._getTopBottomWin(false)
|
|
};
|
|
dhtmlXWindows.prototype.getTopmostWindow = function() {
|
|
return this._getTopBottomWin(true)
|
|
};
|
|
dhtmlXWindows.prototype._getTopBottomWin = function(l) {
|
|
var h = null;
|
|
for (var c in this.w) {
|
|
if (this.w[c].conf.visible) {
|
|
var g = false;
|
|
if (h != null) {
|
|
g = h.z > this.w[c].win.style.zIndex;
|
|
if (l) {
|
|
g = !g
|
|
}
|
|
}
|
|
if (h == null || g) {
|
|
h = {
|
|
id: c,
|
|
z: this.w[c].win.style.zIndex
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return (h ? h.id : null)
|
|
};
|
|
dhtmlXWindows.prototype._winMakeActive = function(g, l) {
|
|
if (g != null && l !== true && this.w[g].conf.actv == true) {
|
|
return
|
|
}
|
|
var x = [];
|
|
var r = [{
|
|
name: "modal",
|
|
value: true
|
|
}, {
|
|
name: "sticked",
|
|
value: true
|
|
}, {
|
|
name: "sticked",
|
|
value: false
|
|
}];
|
|
var o = {};
|
|
for (var c = 0; c < r.length; c++) {
|
|
var n = r[c].name;
|
|
var h = r[c].value;
|
|
var y = [];
|
|
for (var u in this.w) {
|
|
var v = this.w[u];
|
|
if (o[u] == null && v.conf[n] === h && v.conf.visible == true) {
|
|
if (g != u) {
|
|
window.dhx4.zim.clear(v.conf.z_id);
|
|
y.push([u, Number(v.win.style.zIndex)]);
|
|
o[u] = true
|
|
}
|
|
}
|
|
v = null
|
|
}
|
|
y.sort(function(w, q) {
|
|
return (w[1] < q[1] ? 1 : -1)
|
|
});
|
|
if (g != null && this.w[g].conf[n] === h && o[g] == null) {
|
|
window.dhx4.zim.clear(this.w[g].conf.z_id);
|
|
var m = [
|
|
[g, Number(this.w[g].win.style.zIndex)]
|
|
];
|
|
y = m.concat(y);
|
|
o[g] = true
|
|
}
|
|
x = x.concat(y)
|
|
}
|
|
for (var c = x.length - 1; c >= 0; c--) {
|
|
var u = x[c][0];
|
|
var v = this.w[u];
|
|
v.win.style.zIndex = window.dhx4.zim.reserve(v.conf.z_id);
|
|
if (v.conf.modal && this.mcover != null) {
|
|
for (var s in this.mcover) {
|
|
this.mcover[s].style.zIndex = v.win.style.zIndex
|
|
}
|
|
}
|
|
this._winAdjustFRMZIndex(u);
|
|
if (g == null && c == 0) {
|
|
g = u
|
|
}
|
|
v.conf.actv = (g == u);
|
|
v.win.className = (v.conf.actv ? "dhxwin_active" : "dhxwin_inactive");
|
|
v = null
|
|
}
|
|
if (g != null && this.conf.last_active != g) {
|
|
this._callMainEvent("onFocus", g)
|
|
}
|
|
this.conf.last_active = g
|
|
};
|
|
dhtmlXWindows.prototype.attachViewportTo = function(g) {
|
|
if (this.conf.vp_custom) {
|
|
while (this.vp.childNodes.length > 0) {
|
|
this.vp.removeChild(this.vp.lastChild)
|
|
}
|
|
this.vp.parentNode.removeChild(this.vp);
|
|
this.vp = null
|
|
} else {
|
|
if (this.vp != null) {
|
|
this.vp.className = String(this.vp.className).replace(new RegExp("\\s{1,}dhxwins_vp_" + this.conf.skin), "")
|
|
}
|
|
} if (g == null) {
|
|
this.vp = null
|
|
} else {
|
|
this.vp = (typeof(g) == "string" ? document.getElementById(g) : g);
|
|
this.vp.className += " dhxwins_vp_" + this.conf.skin;
|
|
g = null;
|
|
for (var c in this.w) {
|
|
this.vp.appendChild(this.w[c].win)
|
|
}
|
|
this.conf.vp_custom = false
|
|
} if (this.vp == document.body) {
|
|
document.body.style.position = "static";
|
|
}
|
|
};
|
|
dhtmlXWindows.prototype.setViewport = function(c, m, h, a, l) {
|
|
var g = document.createElement("DIV");
|
|
g.style.position = "absolute";
|
|
g.style.left = c + "px";
|
|
g.style.top = m + "px";
|
|
g.style.width = h + "px";
|
|
g.style.height = a + "px";
|
|
if (typeof(l) == "undefined" || l == null) {
|
|
l = document.body
|
|
} else {
|
|
if (typeof(l) == "string") {
|
|
l = document.getElementById(l)
|
|
}
|
|
}
|
|
l.appendChild(g);
|
|
this.attachViewportTo(g);
|
|
this.conf.vp_custom = true;
|
|
l = g = null
|
|
};
|
|
dhtmlXWindows.prototype._winSetPosition = function(h, a, g) {
|
|
var c = this.w[h];
|
|
if (c.conf.maxed) {
|
|
c.conf.lastMX += (a - c.conf.x);
|
|
c.conf.lastMY += (g - c.conf.y)
|
|
}
|
|
c.conf.x = a;
|
|
c.conf.y = g;
|
|
c.win.style.left = c.conf.x + "px";
|
|
c.win.style.top = c.conf.y + "px";
|
|
this._winAdjustFRMPosition(h);
|
|
c = null
|
|
};
|
|
dhtmlXWindows.prototype._winAdjustPosition = function(n, c, m) {
|
|
var g = this.w[n];
|
|
if (typeof(c) == "undefined") {
|
|
c = g.conf.x
|
|
}
|
|
if (typeof(m) == "undefined") {
|
|
m = g.conf.y
|
|
}
|
|
var a = (g.conf.keep_in_vp ? 0 : -g.conf.w + this.conf.vp_pos_ofs);
|
|
var l = (g.conf.keep_in_vp ? this.vp.clientWidth - g.conf.w : this.vp.clientWidth - this.conf.vp_pos_ofs);
|
|
if (c < a) {
|
|
c = a
|
|
} else {
|
|
if (c > l) {
|
|
c = l
|
|
}
|
|
}
|
|
var h = (g.conf.keep_in_vp ? this.vp.clientHeight - g.conf.h : this.vp.clientHeight - this.conf.vp_pos_ofs);
|
|
if (m < 0) {
|
|
m = 0
|
|
} else {
|
|
if (m > h) {
|
|
m = h
|
|
}
|
|
} if (c != g.conf.x || m != g.conf.y) {
|
|
this._winSetPosition(n, c, m)
|
|
}
|
|
g = null
|
|
};
|
|
dhtmlXWindows.prototype._winSetSize = function(o, m, g, n, c) {
|
|
var h = this.w[o];
|
|
var a = (m != null ? m : h.conf.w);
|
|
var l = (g != null ? g : h.conf.h);
|
|
if (this.conf.ofs_w == null) {
|
|
h.win.style.width = a + "px";
|
|
h.win.style.height = l + "px";
|
|
this.conf.ofs_w = h.win.offsetWidth - a;
|
|
this.conf.ofs_h = h.win.offsetHeight - l
|
|
}
|
|
if (h.conf.min_w != null && a < h.conf.min_w) {
|
|
a = h.conf.min_w
|
|
}
|
|
if (h.conf.max_w != null && a > h.conf.max_w) {
|
|
a = h.conf.max_w
|
|
}
|
|
if (!h.conf.parked && h.conf.min_h != null && l < h.conf.min_h) {
|
|
l = h.conf.min_h
|
|
}
|
|
if (h.conf.max_h != null && l > h.conf.max_h) {
|
|
l = h.conf.max_h
|
|
}
|
|
if (h.conf.keep_in_vp) {
|
|
if (a > this.vp.clientWidth) {
|
|
a = this.vp.clientWidth
|
|
}
|
|
if (l > this.vp.clientHeight) {
|
|
l = this.vp.clientHeight
|
|
}
|
|
}
|
|
h.win.style.width = a - this.conf.ofs_w + "px";
|
|
h.win.style.height = l - this.conf.ofs_h + "px";
|
|
h.conf.w = a;
|
|
h.conf.h = l;
|
|
this._winAdjustFRMSize(o);
|
|
if (c) {
|
|
this._winAdjustPosition(o, h.conf.x, h.conf.y)
|
|
}
|
|
if (!h.conf.parked && n != true) {
|
|
this._winAdjustCell(o)
|
|
}
|
|
h = null
|
|
};
|
|
dhtmlXWindows.prototype._winMinmax = function(l, g) {
|
|
if (typeof(g) != "undefined" && this.w[l].conf.maxed == g) {
|
|
return
|
|
}
|
|
if (this.w[l].conf.allow_resize == false) {
|
|
return
|
|
}
|
|
var c = this.w[l];
|
|
if (c.conf.parked) {
|
|
this._winPark(l, false)
|
|
}
|
|
if (c.conf.maxed) {
|
|
this._winSetSize(l, c.conf.lastMW, c.conf.lastMH);
|
|
this._winAdjustPosition(l, c.conf.lastMX, c.conf.lastMY);
|
|
c.conf.maxed = false
|
|
} else {
|
|
var a = 0;
|
|
var h = 0;
|
|
if (c.conf.max_w != null) {
|
|
a = c.conf.x + Math.round(c.conf.w - c.conf.max_w) / 2
|
|
}
|
|
if (c.conf.max_h != null) {
|
|
h = Math.max(c.conf.y + Math.round(c.conf.h - c.conf.max_h) / 2, 0)
|
|
}
|
|
c.conf.lastMX = c.conf.x;
|
|
c.conf.lastMY = c.conf.y;
|
|
c.conf.lastMW = c.conf.w;
|
|
c.conf.lastMH = c.conf.h;
|
|
this._winSetSize(l, this.vp.clientWidth, this.vp.clientHeight);
|
|
this._winAdjustPosition(l, a, h);
|
|
c.conf.maxed = true
|
|
}
|
|
c.b.minmax.setCss(c.conf.maxed ? "minmaxed" : "minmax");
|
|
if (c.conf.maxed) {
|
|
this._callMainEvent("onMaximize", l)
|
|
} else {
|
|
this._callMainEvent("onMinimize", l)
|
|
}
|
|
c = null
|
|
};
|
|
dhtmlXWindows.prototype._winShow = function(c, a) {
|
|
if (this.w[c].conf.visible == true) {
|
|
return
|
|
}
|
|
this.w[c].win.style.display = "";
|
|
this.w[c].conf.visible = true;
|
|
if (a == true || this.conf.last_active == null) {
|
|
this._winMakeActive(c, true)
|
|
}
|
|
this._callMainEvent("onShow", c)
|
|
};
|
|
dhtmlXWindows.prototype._winHide = function(c, a) {
|
|
if (this.w[c].conf.visible == false) {
|
|
return
|
|
}
|
|
this.w[c].win.style.display = "none";
|
|
this.w[c].conf.visible = false;
|
|
if (this.w[c].conf.actv) {
|
|
this.w[c].conf.actv = false;
|
|
this.w[c].win.className = "dhxwin_inactive";
|
|
this._winMakeActive(null, true)
|
|
}
|
|
this._callMainEvent("onHide", c)
|
|
};
|
|
dhtmlXWindows.prototype._winPark = function(g, a) {
|
|
if (this.w[g].conf.allow_park == false) {
|
|
return
|
|
}
|
|
if (this.w[g].conf.header == false) {
|
|
return
|
|
}
|
|
var c = this.w[g];
|
|
if (a == true && this.conf.tr.prop !== false) {
|
|
c.win.style[this.conf.tr.prop] = this.conf.tr[c.conf.parked ? "height_open" : "height_close"];
|
|
if (!c.conf.tr_ev) {
|
|
c.win.addEventListener(this.conf.tr.ev, this._winOnParkTrans, false);
|
|
c.conf.tr_ev = true
|
|
}
|
|
}
|
|
if (c.conf.parked) {
|
|
c.hdr.className = String(c.hdr.className).replace(/\s{1,}dhxwin_hdr_parked/gi, "");
|
|
c.hdr.style.zIndex = 0;
|
|
c.conf.parked = false;
|
|
c.conf.tr_mode = "park";
|
|
this._winCellSetOpacity(g, "open", a);
|
|
this._winSetSize(g, c.conf.w, c.conf.lastPH, (a == true && this.conf.tr.prop !== false));
|
|
if (!(a == true && this.conf.tr.prop !== false)) {
|
|
this._callMainEvent("onParkDown", g);
|
|
if (c.conf.keep_in_vp) {
|
|
this._winAdjustPosition(g, c.conf.x, c.conf.y)
|
|
}
|
|
}
|
|
} else {
|
|
c.conf.lastPH = c.conf.h;
|
|
c.hdr.className += " dhxwin_hdr_parked";
|
|
if (a == false || this.conf.tr.prop == false) {
|
|
c.hdr.style.zIndex = 3
|
|
}
|
|
c.conf.parked = true;
|
|
c.conf.tr_mode = "park";
|
|
this._winCellSetOpacity(g, "close", a);
|
|
this._winSetSize(g, c.conf.w, c.hdr.offsetHeight + this.conf.ofs_h, (a == true && this.conf.tr.prop !== false));
|
|
if (!(a == true && this.conf.tr.prop !== false)) {
|
|
this._callMainEvent("onParkUp", g)
|
|
}
|
|
}
|
|
c = null
|
|
};
|
|
dhtmlXWindows.prototype._winCellSetOpacity = function(n, m, g, l) {
|
|
var c = this.w[n].cell;
|
|
for (var h in c.conf.idx) {
|
|
if ({
|
|
pr1: true,
|
|
pr2: true
|
|
}[h] != true) {
|
|
if (g == true && this.conf.tr.prop != false) {
|
|
c.cell.childNodes[c.conf.idx[h]].style[this.conf.tr.prop] = this.conf.tr["op_" + m]
|
|
}
|
|
c.cell.childNodes[c.conf.idx[h]].style.opacity = this.conf.tr["op_v_" + m]
|
|
}
|
|
}
|
|
c = null
|
|
};
|
|
dhtmlXWindows.prototype._winCellClearOpacity = function(h) {
|
|
var c = this.w[h].cell;
|
|
for (var g in c.conf.idx) {
|
|
if ({
|
|
pr1: true,
|
|
pr2: true
|
|
}[g] != true) {
|
|
if (this.conf.tr.prop != false) {
|
|
c.cell.childNodes[c.conf.idx[g]].style[this.conf.tr.prop] = ""
|
|
}
|
|
}
|
|
}
|
|
c = null
|
|
};
|
|
dhtmlXWindows.prototype._winStick = function(c, a) {
|
|
if (typeof(a) != "undefined" && this.w[c].conf.sticked == a) {
|
|
return
|
|
}
|
|
this.w[c].conf.sticked = !this.w[c].conf.sticked;
|
|
this.w[c].b.stick.setCss(this.w[c].conf.sticked ? "sticked" : "stick");
|
|
this._winMakeActive(this.conf.last_active, true);
|
|
if (this.w[c].conf.sticked) {
|
|
this._callMainEvent("onStick", c)
|
|
} else {
|
|
this._callMainEvent("onUnStick", c)
|
|
}
|
|
};
|
|
dhtmlXWindows.prototype._winClose = function(h) {
|
|
if (this._callMainEvent("onClose", h) !== true && this.conf.unloading != true) {
|
|
return
|
|
}
|
|
var g = this.w[h];
|
|
if (g.conf.fs_mode) {
|
|
g.cell.setToFullScreen(false)
|
|
}
|
|
if (g.conf.modal) {
|
|
this._winSetModal(h, false)
|
|
}
|
|
window.dhx4.zim.clear(g.conf.z_id);
|
|
if (this.cm != null && this.cm.icon[h] != null) {
|
|
this._detachContextMenu("icon", h, null)
|
|
}
|
|
if (typeof(window.addEventListener) == "function") {
|
|
g.win.removeEventListener("mousedown", this._winOnMouseDown, false);
|
|
if (this.conf.dblclick_ev) {
|
|
g.win.removeEventListener("dblclick", this._winOnMouseDown, false)
|
|
}
|
|
} else {
|
|
g.win.detachEvent("onmousedown", this._winOnMouseDown);
|
|
if (this.conf.dblclick_ev) {
|
|
g.win.attachEvent("ondblclick", this._winOnMouseDown)
|
|
}
|
|
}
|
|
for (var c in g.b) {
|
|
this._winRemoveButton(h, c, true)
|
|
}
|
|
g.b = null;
|
|
g.cell._unload();
|
|
g.cell = null;
|
|
g.brd.parentNode.removeChild(g.brd);
|
|
g.brd = null;
|
|
if (g.fr_cover != null) {
|
|
g.fr_cover.parentNode.removeChild(g.fr_cover);
|
|
g.fr_cover = null
|
|
}
|
|
if (g.fr_m_cover != null) {
|
|
g.fr_m_cover.parentNode.removeChild(g.fr_m_cover);
|
|
g.fr_m_cover = null
|
|
}
|
|
g.hdr._isWinHdr = true;
|
|
g.hdr.firstChild._isWinIcon = true;
|
|
g.hdr.onselectstart = null;
|
|
g.hdr.parentNode.removeChild(g.hdr);
|
|
g.hdr = null;
|
|
for (var c in g.conf) {
|
|
g.conf[c] = null;
|
|
delete g.conf[c]
|
|
}
|
|
g.conf = null;
|
|
g.win._idd = null;
|
|
g.win._isWindow = null;
|
|
g.win.parentNode.removeChild(g.win);
|
|
g.win = null;
|
|
g = null;
|
|
this.w[h] = null;
|
|
delete this.w[h];
|
|
if (!this.conf.unloading) {
|
|
this._winMakeActive(null, true)
|
|
}
|
|
};
|
|
dhtmlXWindows.prototype._winSetModal = function(n, h, m) {
|
|
if (this.w[n].conf.modal == h) {
|
|
return
|
|
}
|
|
if (typeof(m) == "undefined") {
|
|
m = true
|
|
}
|
|
var g = this.w[n];
|
|
if (h == true && g.conf.modal == false) {
|
|
if (this.conf.last_modal != null) {
|
|
this._winSetModal(this.conf.last_modal, false, false)
|
|
}
|
|
if (this.mcover == null) {
|
|
var l = document.createElement("DIV");
|
|
l.className = "dhxwins_mcover";
|
|
this.vp.insertBefore(l, g.fr_m_cover || g.win);
|
|
this.mcover = {
|
|
d: l
|
|
};
|
|
if (this.conf.fr_cover) {
|
|
this.mcover.f = document.createElement("IFRAME");
|
|
this.mcover.f.className = "dhxwins_mcover";
|
|
this.mcover.f.border = 0;
|
|
this.mcover.f.frameBorder = 0;
|
|
this.vp.insertBefore(this.mcover.f, l)
|
|
}
|
|
l = null
|
|
} else {
|
|
if (this.mcover.d.nextSibling != (g.fr_m_cover || g.win)) {
|
|
this.vp.insertBefore(this.mcover.d, g.fr_m_cover || g.win);
|
|
if (this.mcover.f != null) {
|
|
this.vp.insertBefore(this.mcover.f, this.mcover.d)
|
|
}
|
|
}
|
|
}
|
|
g.conf.modal = true;
|
|
this.conf.last_modal = n;
|
|
this._winMakeActive(n, true)
|
|
} else {
|
|
if (h == false && g.conf.modal == true) {
|
|
g.conf.modal = false;
|
|
this.conf.last_modal = null;
|
|
if (m && this.mcover != null) {
|
|
for (var c in this.mcover) {
|
|
this.vp.removeChild(this.mcover[c]);
|
|
this.mcover[c] = null
|
|
}
|
|
this.mcover = null
|
|
}
|
|
}
|
|
}
|
|
g = null
|
|
};
|
|
dhtmlXWindows.prototype._winMouseDownHandler = function(g, c) {
|
|
var a = g.target || g.srcElement;
|
|
if (g.button >= 2) {
|
|
return
|
|
}
|
|
if (c.mode == "button") {
|
|
if (c.press_type == "mousedown") {
|
|
this.conf.button_last = c.button_name
|
|
} else {
|
|
if (c.press_type == "mouseup" && c.button_name == this.conf.button_last) {
|
|
this.conf.button_last = null;
|
|
if (this._winButtonClick(c.id, c.button_name, g) !== true) {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if ((c.press_type == "mousedown" || c.press_type == "dblclick") && c.mode == "hdr") {
|
|
this.conf.dblclick_active = false;
|
|
if (this.conf.dblclick_ev == true) {
|
|
if (c.press_type == "dblclick") {
|
|
this.conf.dblclick_active = true
|
|
}
|
|
} else {
|
|
if (this.conf.dblclick_last == null) {
|
|
this.conf.dblclick_last = new Date().getTime();
|
|
this.dblclick_id = c.id
|
|
} else {
|
|
var a = new Date().getTime();
|
|
if (this.conf.dblclick_last + this.conf.dblclick_tm > a && this.dblclick_id == c.id) {
|
|
this.conf.dblclick_active = true;
|
|
this.conf.dblclick_last = null;
|
|
this.dblclick_id = null
|
|
} else {
|
|
this.conf.dblclick_last = a;
|
|
this.dblclick_id = c.id
|
|
}
|
|
}
|
|
} if (this.conf.dblclick_active) {
|
|
this._winDoHeaderDblClick(c.id);
|
|
return
|
|
}
|
|
}
|
|
if (c.press_type == "mousedown") {
|
|
this._winMakeActive(c.id)
|
|
}
|
|
};
|
|
dhtmlXWindows.prototype._winDoHeaderDblClick = function(a) {
|
|
if (this.conf.dblclick_mode == "minmax") {
|
|
this._winMinmax(a);
|
|
return
|
|
}
|
|
if (this.conf.dblclick_mode == "park") {
|
|
this._winPark(a, true);
|
|
return
|
|
}
|
|
if (typeof(this.conf.dblclick_mode) == "function") {
|
|
this.conf.dblclick_mode.apply(window, [a]);
|
|
return
|
|
}
|
|
if (typeof(window[this.conf.dblclick_mode]) == "function") {
|
|
window[this.conf.dblclick_mode].apply(window, [a]);
|
|
return
|
|
}
|
|
};
|
|
dhtmlXWindows.prototype._winAdjustCell = function(c) {
|
|
var r = this.w[c];
|
|
var q = 1;
|
|
var o = (r.conf.header ? r.hdr.offsetHeight : 1);
|
|
var h = r.win.clientWidth - 2;
|
|
var s = r.win.clientHeight - o - 1;
|
|
r.brd.style.left = q + "px";
|
|
r.brd.style.top = o + "px";
|
|
if (r.conf.brd == null) {
|
|
r.brd.style.width = h + "px";
|
|
r.brd.style.height = s + "px";
|
|
r.conf.brd = {
|
|
w: h - r.brd.offsetWidth,
|
|
h: s - r.brd.offsetHeight
|
|
}
|
|
}
|
|
r.brd.style.width = h + r.conf.brd.w + "px";
|
|
r.brd.style.height = s + r.conf.brd.h + "px";
|
|
var g = 5;
|
|
var a = 1 + g;
|
|
var n = (r.conf.header ? o : o + g);
|
|
var l = r.brd.clientWidth;
|
|
var m = r.brd.clientHeight;
|
|
r.cell._setSize(a, n, l, m);
|
|
r.fr_cover.style.left = a + "px";
|
|
r.fr_cover.style.top = n + "px";
|
|
r.fr_cover.style.width = l + "px";
|
|
r.fr_cover.style.height = m + "px";
|
|
r = null
|
|
};
|
|
dhtmlXWindows.prototype._winAdjustTitle = function(h) {
|
|
var a = this.w[h].hdr.childNodes[0];
|
|
var g = this.w[h].hdr.childNodes[1];
|
|
var c = this.w[h].hdr.childNodes[2];
|
|
g.style.paddingLeft = a.offsetWidth + 12 + "px";
|
|
g.style.paddingRight = c.offsetWidth + 10 + "px";
|
|
g = c = a = null
|
|
};
|
|
dhtmlXWindows.prototype._callMainEvent = function(c, h) {
|
|
var a = this.w[h];
|
|
if (a.cell.checkEvent(c)) {
|
|
var g = a.cell._callMainEvent(c, [a.cell])
|
|
} else {
|
|
var g = this.callEvent(c, [a.cell])
|
|
}
|
|
a = null;
|
|
return g
|
|
};
|
|
dhtmlXWindows.prototype._winInitFRM = function(g) {
|
|
if (this.conf.fr_cover != true) {
|
|
return
|
|
}
|
|
var a = this.w[g];
|
|
var c = document.createElement("IFRAME");
|
|
c.className = "dhxwin_main_fr_cover";
|
|
c.border = 0;
|
|
c.frameBorder = 0;
|
|
c.style.zIndex = a.win.style.zIndex;
|
|
a.win.parentNode.insertBefore(c, a.win);
|
|
a.fr_m_cover = c;
|
|
c = null
|
|
};
|
|
dhtmlXWindows.prototype._winAdjustFRMSize = function(c) {
|
|
var a = this.w[c];
|
|
if (a.fr_m_cover != null) {
|
|
a.fr_m_cover.style.width = a.conf.w + "px";
|
|
a.fr_m_cover.style.height = a.conf.h + "px"
|
|
}
|
|
a = null
|
|
};
|
|
dhtmlXWindows.prototype._winAdjustFRMPosition = function(c) {
|
|
var a = this.w[c];
|
|
if (a.fr_m_cover != null) {
|
|
a.fr_m_cover.style.left = a.win.style.left;
|
|
a.fr_m_cover.style.top = a.win.style.top
|
|
}
|
|
a = null
|
|
};
|
|
dhtmlXWindows.prototype._winAdjustFRMZIndex = function(c) {
|
|
var a = this.w[c];
|
|
if (a.fr_m_cover != null) {
|
|
a.fr_m_cover.style.zIndex = a.win.style.zIndex
|
|
}
|
|
a = null
|
|
};
|
|
|
|
function dhtmlXWindowsCell(l, h) {
|
|
dhtmlXCellObject.apply(this, [l, "_wins"]);
|
|
this.wins = h;
|
|
this.cell._winId = l;
|
|
this.conf.skin = this.wins.conf.skin;
|
|
this.attachEvent("_onCellUnload", function() {
|
|
if (this._unloadResize) {
|
|
this._unloadResize()
|
|
}
|
|
window.dhx4._eventable(this.cell, "clear");
|
|
this.cell._winId = null;
|
|
this.wins = null;
|
|
this.setText = null;
|
|
this.getText = null;
|
|
this.allowMove = null;
|
|
this.denyMove = null;
|
|
this.isMovable = null;
|
|
this.allowResize = null;
|
|
this.denyResize = null;
|
|
this.isResizable = null;
|
|
this.maximize = null;
|
|
this.minimize = null;
|
|
this.isMaximized = null;
|
|
this.setPosition = null;
|
|
this.getPosition = null;
|
|
this.adjustPosition = null;
|
|
this.park = null;
|
|
this.isParked = null;
|
|
this.allowPark = null;
|
|
this.denyPark = null;
|
|
this.isParkable = null;
|
|
this.show = null;
|
|
this.hide = null;
|
|
this.isHidden = null;
|
|
this.stick = null;
|
|
this.unstick = null;
|
|
this.isSticked = null;
|
|
this.setDimension = null;
|
|
this.getDimension = null;
|
|
this.setMinDimension = null;
|
|
this.getMinDimension = null;
|
|
this.setMaxDimension = null;
|
|
this.getMaxDimension = null;
|
|
this.keepInViewport = null;
|
|
this.center = null;
|
|
this.centerOnScreen = null;
|
|
this.bringToTop = null;
|
|
this.bringToBottom = null;
|
|
this.isOnTop = null;
|
|
this.isOnBottom = null;
|
|
this.showHeader = null;
|
|
this.hideHeader = null;
|
|
this.setModal = null;
|
|
this.isModal = null;
|
|
this.close = null;
|
|
this._adjustByCont = null;
|
|
this.button = null;
|
|
this.addUserButton = null;
|
|
this.removeUserButton = null;
|
|
g = null
|
|
});
|
|
this.attachEvent("_onContentLoaded", function() {
|
|
this.wins._callMainEvent("onContentLoaded", this._idd)
|
|
});
|
|
this.attachEvent("_onContentMouseDown", function(m, a) {
|
|
this.wins.callEvent("_winMouseDown", [a, {
|
|
id: m,
|
|
mode: "win"
|
|
}])
|
|
});
|
|
this._callMainEvent = function(m, a) {
|
|
return this.callEvent(m, a)
|
|
};
|
|
this.conf.tr = {};
|
|
for (var c in this.wins.conf.tr) {
|
|
this.conf.tr[c] = this.wins.conf.tr[c]
|
|
}
|
|
if (this.conf.tr.prop != false) {}
|
|
if (this._initResize) {
|
|
this._initResize()
|
|
}
|
|
window.dhx4._eventable(this.cell);
|
|
var g = this;
|
|
this.cell.attachEvent("_setCellSize", function(a, o) {
|
|
var m = g.wins.w[this._winId].conf.w - g.conf.size.w;
|
|
var n = g.wins.w[this._winId].conf.h - g.conf.size.h;
|
|
g.setDimension(a + m, o + n)
|
|
});
|
|
return this
|
|
}
|
|
dhtmlXWindowsCell.prototype = new dhtmlXCellObject();
|
|
dhtmlXWindowsCell.prototype.setText = function(a) {
|
|
this.wins.w[this._idd].conf.text = a;
|
|
this.wins.w[this._idd].hdr.childNodes[1].firstChild.innerHTML = a
|
|
};
|
|
dhtmlXWindowsCell.prototype.getText = function() {
|
|
return this.wins.w[this._idd].conf.text
|
|
};
|
|
dhtmlXWindowsCell.prototype.allowMove = function() {
|
|
this.wins.w[this._idd].conf.allow_move = true
|
|
};
|
|
dhtmlXWindowsCell.prototype.denyMove = function() {
|
|
this.wins.w[this._idd].conf.allow_move = false
|
|
};
|
|
dhtmlXWindowsCell.prototype.isMovable = function() {
|
|
return (this.wins.w[this._idd].conf.allow_move == true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.allowResize = function() {
|
|
this.wins.w[this._idd].conf.allow_resize = true;
|
|
this.wins.w[this._idd].b.minmax.enable()
|
|
};
|
|
dhtmlXWindowsCell.prototype.denyResize = function() {
|
|
this.wins.w[this._idd].conf.allow_resize = false;
|
|
this.wins.w[this._idd].b.minmax.disable()
|
|
};
|
|
dhtmlXWindowsCell.prototype.isResizable = function() {
|
|
return (this.wins.w[this._idd].conf.allow_resize == true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.maximize = function() {
|
|
this.wins._winMinmax(this._idd, true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.minimize = function() {
|
|
this.wins._winMinmax(this._idd, false)
|
|
};
|
|
dhtmlXWindowsCell.prototype.isMaximized = function() {
|
|
return (this.wins.w[this._idd].conf.maxed == true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.setPosition = function(a, c) {
|
|
this.wins._winSetPosition(this._idd, a, c)
|
|
};
|
|
dhtmlXWindowsCell.prototype.getPosition = function() {
|
|
var a = this.wins.w[this._idd];
|
|
var c = [a.conf.x, a.conf.y];
|
|
a = null;
|
|
return c
|
|
};
|
|
dhtmlXWindowsCell.prototype.adjustPosition = function() {
|
|
this.wins._winAdjustPosition(this._idd)
|
|
};
|
|
dhtmlXWindowsCell.prototype.park = function() {
|
|
this.wins._winPark(this._idd, true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.isParked = function() {
|
|
return (this.wins.w[this._idd].conf.parked == true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.allowPark = function() {
|
|
this.wins.w[this._idd].conf.allow_park = true;
|
|
this.wins.w[this._idd].b.park.enable()
|
|
};
|
|
dhtmlXWindowsCell.prototype.denyPark = function() {
|
|
this.wins.w[this._idd].conf.allow_park = false;
|
|
this.wins.w[this._idd].b.park.disable()
|
|
};
|
|
dhtmlXWindowsCell.prototype.isParkable = function() {
|
|
return (this.wins.w[this._idd].conf.allow_park == true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.show = function(a) {
|
|
this.wins._winShow(this._idd, window.dhx4.s2b(a))
|
|
};
|
|
dhtmlXWindowsCell.prototype.hide = function() {
|
|
this.wins._winHide(this._idd)
|
|
};
|
|
dhtmlXWindowsCell.prototype.isHidden = function() {
|
|
return (this.wins.w[this._idd].conf.visible != true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.stick = function() {
|
|
this.wins._winStick(this._idd, true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.unstick = function() {
|
|
this.wins._winStick(this._idd, false)
|
|
};
|
|
dhtmlXWindowsCell.prototype.isSticked = function() {
|
|
return (this.wins.w[this._idd].conf.sticked == true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.setDimension = function(g, a) {
|
|
var c = this.wins.w[this._idd];
|
|
if (c.conf.parked) {
|
|
this.wins._winPark(this._idd, false)
|
|
}
|
|
if (c.conf.maxed) {
|
|
if (g != null) {
|
|
c.conf.lastMW = g
|
|
}
|
|
if (a != null) {
|
|
c.conf.lastMH = a
|
|
}
|
|
this.wins._winMinmax(this._idd)
|
|
} else {
|
|
this.wins._winSetSize(this._idd, g, a, false, true)
|
|
}
|
|
c = null
|
|
};
|
|
dhtmlXWindowsCell.prototype.getDimension = function() {
|
|
var a = this.wins.w[this._idd];
|
|
var c = [a.conf.w, a.conf.h];
|
|
a = null;
|
|
return c
|
|
};
|
|
dhtmlXWindowsCell.prototype.setMinDimension = function(g, a) {
|
|
var c = this.wins.w[this._idd];
|
|
c.conf.min_w = g;
|
|
c.conf.min_h = a;
|
|
this.wins._winSetSize(this._idd, c.conf.w, c.conf.h);
|
|
c = null
|
|
};
|
|
dhtmlXWindowsCell.prototype.getMinDimension = function() {
|
|
var a = this.wins.w[this._idd];
|
|
var c = [a.conf.min_w, a.conf.min_h];
|
|
a = null;
|
|
return c
|
|
};
|
|
dhtmlXWindowsCell.prototype.setMaxDimension = function(g, a) {
|
|
var c = this.wins.w[this._idd];
|
|
c.conf.max_w = g;
|
|
c.conf.max_h = a;
|
|
this.wins._winSetSize(this._idd, c.conf.w, c.conf.h);
|
|
c = null
|
|
};
|
|
dhtmlXWindowsCell.prototype.getMaxDimension = function() {
|
|
var a = this.wins.w[this._idd];
|
|
var c = [a.conf.max_w, a.conf.max_h];
|
|
a = null;
|
|
return c
|
|
};
|
|
dhtmlXWindowsCell.prototype.keepInViewport = function(a) {
|
|
this.wins.w[this._idd].conf.keep_in_vp = window.dhx4.s2b(a)
|
|
};
|
|
dhtmlXWindowsCell.prototype.center = function() {
|
|
var g = this.wins.vp;
|
|
var c = this.wins.w[this._idd];
|
|
var a = Math.round((g.clientWidth - c.conf.w) / 2);
|
|
var h = Math.round((g.clientHeight - c.conf.h) / 2);
|
|
this.wins._winSetPosition(this._idd, a, h);
|
|
g = c = null
|
|
};
|
|
dhtmlXWindowsCell.prototype.centerOnScreen = function() {
|
|
var c = this.wins.w[this._idd];
|
|
var m = window.dhx4.screenDim();
|
|
var l = window.dhx4.absLeft(this.wins.vp);
|
|
var h = window.dhx4.absTop(this.wins.vp);
|
|
var g = this.wins.vp.parentNode;
|
|
while (g != null) {
|
|
if (g.scrollLeft) {
|
|
l = l - g.scrollLeft
|
|
}
|
|
if (g.scrollTop) {
|
|
h = h - g.scrollTop
|
|
}
|
|
g = g.parentNode
|
|
}
|
|
var a = Math.round((m.right - m.left - c.conf.w) / 2);
|
|
var n = Math.round((m.bottom - m.top - c.conf.h) / 2);
|
|
this.wins._winAdjustPosition(this._idd, a - l, n - h);
|
|
d = c = null
|
|
};
|
|
dhtmlXWindowsCell.prototype.bringToTop = function() {
|
|
this.wins._winMakeActive(this._idd, true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.bringToBottom = function() {
|
|
var a = (this.wins.w[this._idd].conf.actv ? null : this.wins.conf.last_active);
|
|
window.dhx4.zim.clear(this.wins.w[this._idd].conf.z_id);
|
|
this.wins.w[this._idd].win.style.zIndex = 0;
|
|
this.wins._winMakeActive(a, true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.isOnTop = function() {
|
|
return (this.wins.w[this._idd].conf.actv == true)
|
|
};
|
|
dhtmlXWindowsCell.prototype.isOnBottom = function() {
|
|
var g = {
|
|
id: null,
|
|
z: +Infinity
|
|
};
|
|
for (var c in this.wins.w) {
|
|
if (this.wins.w[c].conf.visible && this.wins.w[c].win.style.zIndex < g.z) {
|
|
g.id = c;
|
|
g.z = this.wins.w[c].win.style.zIndex
|
|
}
|
|
}
|
|
return (g.id == this._idd)
|
|
};
|
|
dhtmlXWindowsCell.prototype.showHeader = function() {
|
|
var a = this.wins.w[this._idd];
|
|
if (a.conf.header == false) {
|
|
a.hdr.className = String(a.hdr.className).replace(/\s{0,}dhxwin_hdr_hidden/gi, "");
|
|
a.brd.className = String(a.brd.className).replace(/\s{0,}dhxwin_hdr_hidden/gi, "");
|
|
this.conf.cells_cont = null;
|
|
a.conf.brd = null;
|
|
a.conf.header = true;
|
|
this.wins._winAdjustCell(this._idd)
|
|
}
|
|
a = null
|
|
};
|
|
dhtmlXWindowsCell.prototype.hideHeader = function() {
|
|
var a = this.wins.w[this._idd];
|
|
if (a.conf.header == true) {
|
|
if (a.conf.parked) {
|
|
this.wins._winPark(this._idd, false)
|
|
}
|
|
a.hdr.className += " dhxwin_hdr_hidden";
|
|
a.brd.className += " dhxwin_hdr_hidden";
|
|
this.conf.cells_cont = null;
|
|
a.conf.brd = null;
|
|
a.conf.header = false;
|
|
this.wins._winAdjustCell(this._idd)
|
|
}
|
|
a = null
|
|
};
|
|
dhtmlXWindowsCell.prototype.setModal = function(a) {
|
|
this.wins._winSetModal(this._idd, window.dhx4.s2b(a))
|
|
};
|
|
dhtmlXWindowsCell.prototype.isModal = function() {
|
|
return (this.wins.w[this._idd].conf.modal == true)
|
|
};
|
|
dhtmlXWindowsCell.prototype._adjustByCont = function(a, c) {
|
|
a += this.wins.w[this._idd].conf.w - this.conf.size.w;
|
|
c += this.wins.w[this._idd].conf.h - this.conf.size.h;
|
|
this.wins._winSetSize(this._idd, a, c)
|
|
};
|
|
dhtmlXWindowsCell.prototype.close = function() {
|
|
this.wins._winClose(this._idd)
|
|
};
|
|
dhtmlXWindowsCell.prototype.setIconCss = function(a) {
|
|
this.wins.w[this._idd].hdr.firstChild.className = "dhxwin_icon " + a;
|
|
this.wins._winAdjustTitle(this._idd)
|
|
};
|
|
dhtmlXWindowsCell.prototype.setToFullScreen = function(c) {
|
|
c = window.dhx4.s2b(c);
|
|
var a = this.wins.w[this._idd];
|
|
if (a.conf.fs_mode == c) {
|
|
a = null;
|
|
return
|
|
}
|
|
if (this.wins.fsn == null) {
|
|
this.wins.fsn = document.createElement("DIV");
|
|
this.wins.fsn.className = this.wins.vp.className + " dhxwins_vp_fs";
|
|
document.body.appendChild(this.wins.fsn)
|
|
}
|
|
if (c) {
|
|
this.wins.fsn.appendChild(a.win);
|
|
this.maximize();
|
|
this.hideHeader()
|
|
} else {
|
|
this.wins.vp.appendChild(a.win);
|
|
this.minimize();
|
|
this.showHeader();
|
|
if (this.wins.fsn.childNodes.length == 0) {
|
|
this.wins.fsn.parentNode.removeChild(this.wins.fsn);
|
|
this.wins.fsn = null
|
|
}
|
|
}
|
|
a.conf.fs_mode = c;
|
|
a = null
|
|
};
|
|
dhtmlXWindowsCell.prototype.button = function(a) {
|
|
if (a == "minmax1" || a == "minmax2") {
|
|
a = "minmax"
|
|
}
|
|
return this.wins.w[this._idd].b[a]
|
|
};
|
|
dhtmlXWindowsCell.prototype.addUserButton = function(o, m, g) {
|
|
var a = new dhtmlXWindowsButton(this.wins, this._idd, o, g, true);
|
|
var l = null;
|
|
var c = this.wins.w[this._idd].hdr.lastChild;
|
|
if (isNaN(m)) {
|
|
m = 0
|
|
} else {
|
|
if (m < 0) {
|
|
m = 0
|
|
}
|
|
} if (c.childNodes[m] != null) {
|
|
l = c.childNodes[m]
|
|
}
|
|
if (l != null) {
|
|
c.insertBefore(a.button, l)
|
|
} else {
|
|
c.appendChild(a.button)
|
|
}
|
|
this.wins.w[this._idd].b[o] = a;
|
|
a = l = c = null;
|
|
this.wins._winAdjustTitle(this._idd)
|
|
};
|
|
dhtmlXWindowsCell.prototype.removeUserButton = function(a) {
|
|
if (this.wins.w[this._idd].b[a] == null || this.wins.w[this._idd].b[a].conf.custom != true) {
|
|
return
|
|
}
|
|
this.wins._winRemoveButton(this._idd, a)
|
|
};
|
|
window.dhtmlXWindowsButton = function(l, c, a, h, g) {
|
|
this.conf = {
|
|
wins: l,
|
|
winId: c,
|
|
name: a,
|
|
enabled: true,
|
|
visible: true,
|
|
custom: true
|
|
};
|
|
this.button = document.createElement("DIV");
|
|
this.button._buttonName = a;
|
|
this.button.title = h;
|
|
this.enable = function() {
|
|
this.conf.enabled = true;
|
|
this.setCss(this.conf.css)
|
|
};
|
|
this.disable = function() {
|
|
this.conf.enabled = false;
|
|
this.setCss(this.conf.css)
|
|
};
|
|
this.isEnabled = function() {
|
|
return (this.conf.enabled == true)
|
|
};
|
|
this.show = function() {
|
|
this.button.style.display = "";
|
|
this.conf.visible = true;
|
|
this.conf.wins._winAdjustTitle(this.conf.winId)
|
|
};
|
|
this.hide = function() {
|
|
this.button.style.display = "none";
|
|
this.conf.visible = false;
|
|
this.conf.wins._winAdjustTitle(this.conf.winId)
|
|
};
|
|
this.isHidden = function() {
|
|
return (this.conf.visible == false)
|
|
};
|
|
this.setCss = function(n) {
|
|
this.conf.css = n;
|
|
var m = (this.conf.enabled ? "" : "_dis");
|
|
this.button.className = "dhxwin_button" + m + " dhxwin_button_" + this.conf.css + m
|
|
};
|
|
this._doOnClick = function(m) {
|
|
return this.callEvent("onClick", [this.conf.wins.w[this.conf.winId].cell, this])
|
|
};
|
|
this.unload = function(m) {
|
|
dhx4._eventable(this, "clear");
|
|
this.button._buttonName = null;
|
|
this.button.parentNode.removeChild(this.button);
|
|
if (this.conf.wins.cm != null && this.conf.wins.cm.button[this.conf.winId] != null && this.conf.wins.cm.button[this.conf.winId][this.conf.name] != null) {
|
|
this.conf.wins._detachContextMenu("button", this.conf.winId, this.conf.name)
|
|
}
|
|
this.button = null;
|
|
this.enable = null;
|
|
this.disable = null;
|
|
this.isEnabled = null;
|
|
this.show = null;
|
|
this.hide = null;
|
|
this.isHidden = null;
|
|
this.setCss = null;
|
|
this.unload = null;
|
|
if (m != true) {
|
|
this.conf.wins._winAdjustTitle(this.conf.winId)
|
|
}
|
|
this.conf.wins = null;
|
|
this.conf.winId = null;
|
|
this.conf = null
|
|
};
|
|
this.setCss(a);
|
|
dhx4._eventable(this);
|
|
return this
|
|
};
|
|
dhtmlXWindows.prototype._winButtonClick = function(g, a, c) {
|
|
if (!this.w[g].b[a].isEnabled()) {
|
|
return true
|
|
}
|
|
if (this.w[g].b[a]._doOnClick() !== true) {
|
|
return
|
|
}
|
|
if (a == "help") {
|
|
this._callMainEvent("onHelp", g)
|
|
}
|
|
if (a == "park") {
|
|
this._winPark(g, true)
|
|
}
|
|
if (a == "minmax") {
|
|
this._winMinmax(g)
|
|
}
|
|
if (a == "stick") {
|
|
this._winStick(g);
|
|
return false
|
|
}
|
|
if (a == "close") {
|
|
this._winClose(g);
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXWindows.prototype._winRemoveButton = function(g, a, c) {
|
|
this.w[g].b[a].unload(c);
|
|
this.w[g].b[a] = null;
|
|
delete this.w[g].b[a]
|
|
};
|
|
dhtmlXWindows.prototype._dndInitModule = function() {
|
|
var a = this;
|
|
this._dndOnMouseDown = function(h, l) {
|
|
if (a.conf.dblclick_active) {
|
|
return
|
|
}
|
|
if (h.preventDefault) {
|
|
h.preventDefault()
|
|
} else {
|
|
h.returnValue = false
|
|
}
|
|
a.conf.dnd = {
|
|
id: l,
|
|
x: h.clientX,
|
|
y: h.clientY,
|
|
ready: true,
|
|
css: false,
|
|
tr: null,
|
|
mode: "def",
|
|
moved: false
|
|
};
|
|
if (a.w[l].conf.keep_in_vp) {
|
|
a.conf.dnd.minX = 0;
|
|
a.conf.dnd.maxX = a.vp.clientWidth - a.w[l].conf.w;
|
|
a.conf.dnd.minY = 0;
|
|
a.conf.dnd.maxY = a.vp.clientHeight - a.w[l].conf.h
|
|
} else {
|
|
a.conf.dnd.minX = -a.w[l].conf.w + a.conf.vp_pos_ofs;
|
|
a.conf.dnd.maxX = a.vp.clientWidth - a.conf.vp_pos_ofs;
|
|
a.conf.dnd.minY = 0;
|
|
a.conf.dnd.maxY = a.vp.clientHeight - a.conf.vp_pos_ofs
|
|
}
|
|
var c = ["MozTransform", "WebkitTransform", "OTransform", "msTransform", "transform"];
|
|
for (var g = 0; g < c.length; g++) {
|
|
if (document.documentElement.style[c[g]] != null && a.conf.dnd.tr == null) {
|
|
a.conf.dnd.tr = c[g];
|
|
a.conf.dnd.mode = "tr"
|
|
}
|
|
}
|
|
if (a.conf.dnd.mode == "tr") {
|
|
a.w[l].win.style[a.conf.dnd.tr] = "translate(0px,0px)"
|
|
}
|
|
a._dndInitEvents()
|
|
};
|
|
this._dndOnMouseMove = function(l) {
|
|
l = l || event;
|
|
if (l.preventDefault) {
|
|
l.preventDefault()
|
|
} else {
|
|
l.returnValue = false
|
|
}
|
|
var h = a.conf.dnd;
|
|
var g = a.w[h.id];
|
|
if (!h.css) {
|
|
g.win.className += " dhxwin_dnd";
|
|
g.fr_cover.className += " dhxwin_fr_cover_dnd";
|
|
a.vp.className += " dhxwins_vp_dnd";
|
|
h.css = true
|
|
}
|
|
var c = l.clientX - h.x;
|
|
var m = l.clientY - h.y;
|
|
h.newX = g.conf.x + c;
|
|
h.newY = g.conf.y + m;
|
|
if (h.mode == "tr") {
|
|
h.newX = Math.min(Math.max(h.newX, h.minX), h.maxX);
|
|
c = h.newX - g.conf.x;
|
|
h.newY = Math.min(Math.max(h.newY, h.minY), h.maxY);
|
|
m = h.newY - g.conf.y;
|
|
g.win.style[h.tr] = "translate(" + c + "px," + m + "px)"
|
|
} else {
|
|
if (h.newX < h.minX || h.newX > h.maxX) {
|
|
h.newX = Math.min(Math.max(h.newX, h.minX), h.maxX)
|
|
} else {
|
|
h.x = l.clientX
|
|
} if (h.newY < h.minY || h.newY > h.maxY) {
|
|
h.newY = Math.min(Math.max(h.newY, h.minY), h.maxY)
|
|
} else {
|
|
h.y = l.clientY
|
|
}
|
|
a._winSetPosition(h.id, h.newX, h.newY)
|
|
}
|
|
h.moved = true;
|
|
g = h = null
|
|
};
|
|
this._dndOnMouseUp = function() {
|
|
if (a.conf.dnd != null) {
|
|
var g = a.conf.dnd;
|
|
var c = a.w[g.id];
|
|
if (g.newX != null) {
|
|
if (g.mode == "tr") {
|
|
a._winSetPosition(g.id, g.newX, g.newY);
|
|
c.win.style[g.tr] = "translate(0px,0px)"
|
|
}
|
|
}
|
|
if (g.css) {
|
|
c.win.className = String(c.win.className).replace(/\s{0,}dhxwin_dnd/gi, "");
|
|
c.fr_cover.className = String(c.fr_cover.className).replace(/\s{0,}dhxwin_fr_cover_dnd/gi, "");
|
|
a.vp.className = String(a.vp.className).replace(/\s{0,}dhxwins_vp_dnd/gi, "")
|
|
}
|
|
a._dndUnloadEvents();
|
|
if (g.moved) {
|
|
a._callMainEvent("onMoveFinish", g.id)
|
|
}
|
|
c = g = a.conf.dnd = null
|
|
}
|
|
};
|
|
this._dndOnSelectStart = function(c) {
|
|
c = c || event;
|
|
if (c.preventDefault) {
|
|
c.preventDefault()
|
|
} else {
|
|
c.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
this._dndInitEvents = function() {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.addEventListener("mousemove", this._dndOnMouseMove, false);
|
|
window.addEventListener("mouseup", this._dndOnMouseUp, false);
|
|
window.addEventListener("selectstart", this._dndOnSelectStart, false)
|
|
} else {
|
|
document.body.attachEvent("onmousemove", this._dndOnMouseMove);
|
|
document.body.attachEvent("onmouseup", this._dndOnMouseUp);
|
|
document.body.attachEvent("onselectstart", this._dndOnSelectStart)
|
|
}
|
|
};
|
|
this._dndUnloadEvents = function() {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("mousemove", this._dndOnMouseMove, false);
|
|
window.removeEventListener("mouseup", this._dndOnMouseUp, false);
|
|
window.removeEventListener("selectstart", this._dndOnSelectStart, false)
|
|
} else {
|
|
document.body.detachEvent("onmousemove", this._dndOnMouseMove);
|
|
document.body.detachEvent("onmouseup", this._dndOnMouseUp);
|
|
document.body.detachEvent("onselectstart", this._dndOnSelectStart)
|
|
}
|
|
};
|
|
this._dndUnloadModule = function() {
|
|
this.detachEvent(this.conf.dnd_evid);
|
|
this.conf.dnd_evid = null;
|
|
this._dndOnMouseDown = null;
|
|
this._dndOnMouseMove = null;
|
|
this._dndOnMouseUp = null;
|
|
this._dndOnSelectStart = null;
|
|
this._dndInitEvents = null;
|
|
this._dndUnloadEvents = null;
|
|
this._dndInitModule = null;
|
|
this._dndUnloadModule = null;
|
|
a = null
|
|
};
|
|
this.conf.dnd_evid = this.attachEvent("_winMouseDown", function(g, c) {
|
|
if (g.button >= 2) {
|
|
return
|
|
}
|
|
if (!(c.mode == "hdr" && g.type == "mousedown" && this.w[c.id].conf.allow_move == true)) {
|
|
return
|
|
}
|
|
if (this.w[c.id].conf.maxed && this.w[c.id].conf.max_w == null && this.w[c.id].conf.max_h == null) {
|
|
return
|
|
}
|
|
if (g.preventDefault) {
|
|
g.preventDefault()
|
|
} else {
|
|
g.returnValue = false
|
|
}
|
|
this._dndOnMouseDown(g, c.id);
|
|
return false
|
|
})
|
|
};
|
|
dhtmlXWindowsCell.prototype._initResize = function() {
|
|
var a = this;
|
|
var c = navigator.userAgent;
|
|
this.conf.resize = {
|
|
b_width: 6,
|
|
c_type: (c.indexOf("MSIE 10.0") > 0 || c.indexOf("MSIE 9.0") > 0 || c.indexOf("MSIE 8.0") > 0 || c.indexOf("MSIE 7.0") > 0 || c.indexOf("MSIE 6.0") > 0)
|
|
};
|
|
this._rOnCellMouseMove = function(n) {
|
|
if (a.wins.conf.resize_actv == true || a.wins.w[a._idd].conf.allow_resize == false || a.conf.progress == true || a.wins.w[a._idd].conf.maxed == true || a.wins.w[a._idd].conf.fs_mode == true) {
|
|
var l = a.wins.w[a._idd].brd;
|
|
if (l.style.cursor != "default") {
|
|
l.style.cursor = "default"
|
|
}
|
|
l = null;
|
|
return
|
|
}
|
|
n = n || event;
|
|
var v = a.wins.w[a._idd].brd;
|
|
var g = a.conf.resize;
|
|
var q = (a.wins.w[a._idd].conf.header == false);
|
|
var s = n.clientX;
|
|
var o = n.clientY;
|
|
var h = window.dhx4.absLeft(v);
|
|
var u = window.dhx4.absTop(v);
|
|
var m = "";
|
|
if (s <= h + g.b_width) {
|
|
m = "w"
|
|
} else {
|
|
if (s >= h + v.offsetWidth - g.b_width) {
|
|
m = "e"
|
|
}
|
|
} if (o >= u + v.offsetHeight - g.b_width) {
|
|
m = "s" + m
|
|
} else {
|
|
if (q && o <= u + g.b_width) {
|
|
m = "n" + m
|
|
}
|
|
} if (m == "") {
|
|
m = false
|
|
}
|
|
if (g.mode != m) {
|
|
g.mode = m;
|
|
if (m == false) {
|
|
v.style.cursor = "default"
|
|
} else {
|
|
v.style.cursor = m + "-resize"
|
|
}
|
|
}
|
|
v = g = null
|
|
};
|
|
this._rOnCellMouseDown = function(m) {
|
|
if (a.conf.resize.mode == false) {
|
|
return
|
|
}
|
|
if (a.conf.progress == true) {
|
|
return
|
|
}
|
|
if (a.wins.w[a._idd].conf.allow_resize == false) {
|
|
return
|
|
}
|
|
if (a.wins.w[a._idd].conf.fs_mode == true) {
|
|
return
|
|
}
|
|
if (m.preventDefault) {
|
|
m.preventDefault()
|
|
} else {
|
|
m.returnValue = false
|
|
}
|
|
var g = a.wins.w[a._idd];
|
|
var l = a.conf.resize;
|
|
a.wins.conf.resize_actv = true;
|
|
l.min_w = g.conf.min_w;
|
|
l.min_h = g.conf.min_h;
|
|
l.max_w = g.conf.max_w || +Infinity;
|
|
l.max_h = g.conf.max_h || +Infinity;
|
|
if (g.cell.dataType == "layout" && g.cell.dataObj != null && typeof(g.cell.dataObj._getWindowMinDimension) == "function") {
|
|
var h = g.cell.dataObj._getWindowMinDimension(g.cell);
|
|
l.min_w = Math.max(h.w, l.min_w);
|
|
l.min_h = Math.max(h.h, l.min_h)
|
|
}
|
|
l.vp_l = a.wins.conf.vp_pos_ofs;
|
|
l.vp_r = a.wins.vp.clientWidth - a.wins.conf.vp_pos_ofs;
|
|
l.vp_b = a.wins.vp.clientHeight - a.wins.conf.vp_pos_ofs;
|
|
l.x = m.clientX;
|
|
l.y = m.clientY;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.addEventListener("mousemove", a._rOnWinMouseMove, false);
|
|
window.addEventListener("mouseup", a._rOnWinMouseUp, false);
|
|
window.addEventListener("selectstart", a._rOnSelectStart, false)
|
|
} else {
|
|
document.body.attachEvent("onmousemove", a._rOnWinMouseMove);
|
|
document.body.attachEvent("onmouseup", a._rOnWinMouseUp);
|
|
document.body.attachEvent("onselectstart", a._rOnSelectStart)
|
|
}
|
|
l.resized = false;
|
|
l.vp_cursor = a.wins.vp.style.cursor;
|
|
a.wins.vp.style.cursor = l.mode + "-resize";
|
|
g = l = null
|
|
};
|
|
this._rOnWinMouseMove = function(m) {
|
|
m = m || event;
|
|
var h = a.wins.w[a._idd];
|
|
var l = a.conf.resize;
|
|
if (!l.resized) {
|
|
h.fr_cover.className += " dhxwin_fr_cover_resize";
|
|
l.resized = true
|
|
}
|
|
var g = m.clientX - l.x;
|
|
var n = m.clientY - l.y;
|
|
if (l.mode.indexOf("e") >= 0) {
|
|
l.rw = Math.min(Math.max(h.conf.w + g, l.min_w), l.max_w);
|
|
l.rx = null;
|
|
if (h.conf.x + l.rw < l.vp_l) {
|
|
l.rw = l.vp_l - h.conf.x
|
|
} else {
|
|
if (h.conf.x + l.rw > a.wins.vp.clientWidth) {
|
|
l.rw = a.wins.vp.clientWidth - h.conf.x
|
|
}
|
|
}
|
|
} else {
|
|
if (l.mode.indexOf("w") >= 0) {
|
|
l.rw = Math.min(Math.max(h.conf.w - g, l.min_w), l.max_w);
|
|
l.rx = h.conf.x + h.conf.w - l.rw;
|
|
if (l.rx < 0) {
|
|
l.rw = l.rw + l.rx;
|
|
l.rx = 0
|
|
} else {
|
|
if (l.rx > l.vp_r) {
|
|
l.rw = l.rw - l.vp_r;
|
|
l.rx = l.vp_r
|
|
}
|
|
}
|
|
}
|
|
} if (l.mode.indexOf("s") >= 0) {
|
|
l.rh = Math.min(Math.max(h.conf.h + n, l.min_h), l.max_h);
|
|
l.ry = null;
|
|
if (h.conf.y + l.rh > a.wins.vp.clientHeight) {
|
|
l.rh = a.wins.vp.clientHeight - h.conf.y
|
|
}
|
|
} else {
|
|
if (l.mode.indexOf("n") >= 0) {
|
|
l.rh = Math.min(Math.max(h.conf.h - n, l.min_h), l.max_h);
|
|
l.ry = h.conf.y + h.conf.h - l.rh;
|
|
if (l.ry < 0) {
|
|
l.rh = l.rh + l.ry;
|
|
l.ry = 0
|
|
} else {
|
|
if (l.ry > l.vp_b) {
|
|
l.rh = l.rh - l.vp_b;
|
|
l.ry = l.vp_b
|
|
}
|
|
}
|
|
}
|
|
}
|
|
a._rAdjustSizer();
|
|
h = l = null
|
|
};
|
|
this._rOnWinMouseUp = function() {
|
|
var h = a.conf.resize;
|
|
var g = a.wins.w[a._idd];
|
|
a.wins.conf.resize_actv = false;
|
|
a.wins.vp.style.cursor = h.vp_cursor;
|
|
g.fr_cover.className = String(g.fr_cover.className).replace(/\s{0,}dhxwin_fr_cover_resize/gi, "");
|
|
if (h.resized) {
|
|
a.wins._winSetSize(a._idd, h.rw, h.rh);
|
|
if (h.rx == null) {
|
|
h.rx = g.conf.x
|
|
}
|
|
if (h.ry == null) {
|
|
h.ry = g.conf.y
|
|
}
|
|
if (h.rx != g.conf.x || h.ry != g.conf.y) {
|
|
a.wins._winSetPosition(a._idd, h.rx, h.ry)
|
|
}
|
|
}
|
|
if (h.obj != null) {
|
|
h.obj.parentNode.removeChild(h.obj);
|
|
h.obj = null
|
|
}
|
|
if (h.objFR != null) {
|
|
h.objFR.parentNode.removeChild(h.objFR);
|
|
h.objFR = null
|
|
}
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("mousemove", a._rOnWinMouseMove, false);
|
|
window.removeEventListener("mouseup", a._rOnWinMouseUp, false);
|
|
window.removeEventListener("selectstart", a._rOnSelectStart, false)
|
|
} else {
|
|
document.body.detachEvent("onmousemove", a._rOnWinMouseMove);
|
|
document.body.detachEvent("onmouseup", a._rOnWinMouseUp);
|
|
document.body.detachEvent("onselectstart", a._rOnSelectStart)
|
|
} if (h.resized) {
|
|
if (a.dataType == "layout" && a.dataObj != null) {
|
|
a.dataObj.callEvent("onResize", [])
|
|
}
|
|
a.wins._callMainEvent("onResizeFinish", a._idd)
|
|
}
|
|
h.mode = "";
|
|
g = h = null
|
|
};
|
|
this._rOnSelectStart = function(g) {
|
|
g = g || event;
|
|
if (g.preventDefault) {
|
|
g.preventDefault()
|
|
} else {
|
|
g.returnValue = false
|
|
}
|
|
return false
|
|
};
|
|
this._rInitSizer = function() {
|
|
var h = a.conf.resize;
|
|
var g = a.wins.w[a._idd];
|
|
h.obj = document.createElement("DIV");
|
|
h.obj.className = "dhxwin_resize";
|
|
h.obj.style.zIndex = g.win.style.zIndex;
|
|
h.obj.style.cursor = h.mode + "-resize";
|
|
a.wins.vp.appendChild(h.obj);
|
|
if (a.wins.conf.fr_cover == true) {
|
|
h.objFR = document.createElement("IFRAME");
|
|
h.objFR.className = "dhxwin_resize_fr_cover";
|
|
h.objFR.style.zIndex = h.obj.style.zIndex;
|
|
a.wins.vp.insertBefore(h.objFR, h.obj)
|
|
}
|
|
h.rx = g.conf.x;
|
|
h.ry = g.conf.y;
|
|
h.rw = g.conf.w;
|
|
h.rh = g.conf.h;
|
|
h = null
|
|
};
|
|
this._rAdjustSizer = function() {
|
|
var g = a.conf.resize;
|
|
if (!g.obj) {
|
|
this._rInitSizer()
|
|
}
|
|
g.obj.style.width = g.rw + "px";
|
|
g.obj.style.height = g.rh + "px";
|
|
if (g.rx != null) {
|
|
g.obj.style.left = g.rx + "px"
|
|
}
|
|
if (g.ry != null) {
|
|
g.obj.style.top = g.ry + "px"
|
|
}
|
|
if (g.objFR != null) {
|
|
g.objFR.style.width = g.obj.style.width;
|
|
g.objFR.style.height = g.obj.style.height;
|
|
if (g.rx != null) {
|
|
g.objFR.style.left = g.obj.style.left
|
|
}
|
|
if (g.ry != null) {
|
|
g.objFR.style.top = g.obj.style.top
|
|
}
|
|
}
|
|
g = null
|
|
};
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.wins.w[this._idd].brd.addEventListener("mousemove", this._rOnCellMouseMove, false);
|
|
this.wins.w[this._idd].brd.addEventListener("mousedown", this._rOnCellMouseDown, false)
|
|
} else {
|
|
this.wins.w[this._idd].brd.attachEvent("onmousemove", this._rOnCellMouseMove);
|
|
this.wins.w[this._idd].brd.attachEvent("onmousedown", this._rOnCellMouseDown)
|
|
}
|
|
this._unloadResize = function() {
|
|
if (typeof(window.addEventListener) == "function") {
|
|
this.wins.w[this._idd].brd.removeEventListener("mousemove", this._rOnCellMouseMove, false);
|
|
this.wins.w[this._idd].brd.removeEventListener("mousedown", this._rOnCellMouseDown, false)
|
|
} else {
|
|
this.wins.w[this._idd].brd.detachEvent("onmousemove", this._rOnCellMouseMove);
|
|
this.wins.w[this._idd].brd.detachEvent("onmousedown", this._rOnCellMouseDown)
|
|
}
|
|
this._initResize = null;
|
|
this._rOnCellMouseMove = null;
|
|
this._rOnCellMouseDown = null;
|
|
this._rOnWinMouseMove = null;
|
|
this._rOnWinMouseUp = null;
|
|
this._rOnSelectStart = null;
|
|
this._rInitSizer = null;
|
|
this._rAdjustSizer = null;
|
|
this._unloadResize = null;
|
|
this.conf.resize = null;
|
|
a = null
|
|
}
|
|
};
|
|
dhtmlXWindows.prototype.attachContextMenu = function(a) {
|
|
return this._renderContextMenu("icon", null, null, a)
|
|
};
|
|
dhtmlXWindows.prototype.getContextMenu = function() {
|
|
if (this.cm != null && this.cm.global != null) {
|
|
return this.cm.global
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXWindows.prototype.detachContextMenu = function() {
|
|
this._detachContextMenu("icon", null, null)
|
|
};
|
|
dhtmlXWindowsCell.prototype.attachContextMenu = function(a) {
|
|
return this.wins._renderContextMenu("icon", this._idd, null, a)
|
|
};
|
|
dhtmlXWindowsCell.prototype.getContextMenu = function() {
|
|
if (this.wins.cm != null && this.wins.cm.icon[this._idd] != null) {
|
|
return this.wins.cm.icon[this._idd]
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXWindowsCell.prototype.detachContextMenu = function() {
|
|
this.wins._detachContextMenu("icon", this._idd, null)
|
|
};
|
|
dhtmlXWindowsButton.prototype.attachContextMenu = function(a) {
|
|
return this.conf.wins._renderContextMenu("button", this.conf.winId, this.conf.name, a)
|
|
};
|
|
dhtmlXWindowsButton.prototype.getContextMenu = function() {
|
|
if (this.conf.wins.cm == null || this.conf.wins.cm.button[this.conf.winId] == null) {
|
|
return null
|
|
}
|
|
if (this.conf.wins.cm.button[this.conf.winId][this.conf.name] != null) {
|
|
return this.conf.wins.cm.button[this.conf.winId][this.conf.name]
|
|
}
|
|
return null
|
|
};
|
|
dhtmlXWindowsButton.prototype.detachContextMenu = function() {
|
|
this.conf.wins._detachContextMenu("button", this.conf.winId, this.conf.name)
|
|
};
|
|
dhtmlXWindows.prototype._renderContextMenu = function(n, m, g, c) {
|
|
var h = this;
|
|
var a = false;
|
|
if (this.cm == null) {
|
|
this.cm = {
|
|
global: null,
|
|
icon: {},
|
|
button: {}
|
|
};
|
|
a = true
|
|
}
|
|
if (m == null) {
|
|
if (this.cm.global != null) {
|
|
return
|
|
}
|
|
} else {
|
|
if (n == "icon") {
|
|
if (this.cm.icon[m] != null) {
|
|
return
|
|
}
|
|
} else {
|
|
if (n == "button") {
|
|
if (this.cm.button[m] != null && this.cm.button[m][g] != null) {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
} if (c == null) {
|
|
c = {}
|
|
}
|
|
c.parent = null;
|
|
c.context = true;
|
|
var l = new dhtmlXMenuObject(c);
|
|
l.setAutoHideMode(false);
|
|
l.attachEvent("onShow", function() {
|
|
this.conf.wins_menu_open = true
|
|
});
|
|
l.attachEvent("onHide", function() {
|
|
this.conf.wins_menu_open = false;
|
|
h.conf.opened_menu = null
|
|
});
|
|
if (m == null) {
|
|
this.cm.global = l
|
|
} else {
|
|
if (n == "icon") {
|
|
this.cm.icon[m] = l
|
|
} else {
|
|
if (n == "button") {
|
|
if (this.cm.button[m] == null) {
|
|
this.cm.button[m] = {}
|
|
}
|
|
this.cm.button[m][g] = l
|
|
}
|
|
}
|
|
} if (a) {
|
|
this._showContextMenu = function(s, r) {
|
|
if (s.button >= 2) {
|
|
return
|
|
}
|
|
if (r.mode == "icon" && r.id != null && r.press_type == "mousedown") {
|
|
var u = this.cm.icon[r.id] || this.cm.global;
|
|
if (u == null) {
|
|
return
|
|
}
|
|
s.cancelBubble = true;
|
|
var q = this.w[r.id].hdr.firstChild;
|
|
if (u.conf.wins_menu_open && this.conf.opened_menu == r.id) {
|
|
u.hideContextMenu()
|
|
} else {
|
|
this._hideContextMenu();
|
|
u.showContextMenu(window.dhx4.absLeft(q), window.dhx4.absTop(q) + q.offsetHeight);
|
|
this.conf.opened_menu = r.id
|
|
}
|
|
u = q = null
|
|
}
|
|
if (r.mode == "button" && r.id != null && r.press_type == "mousedown") {
|
|
if (this.cm.button[r.id] == null || this.cm.button[r.id][r.button_name] == null) {
|
|
return
|
|
}
|
|
s.cancelBubble = true;
|
|
this.conf.button_last = null;
|
|
var u = this.cm.button[r.id][r.button_name];
|
|
var o = this.w[r.id].b[r.button_name].button;
|
|
if (u.conf.wins_menu_open && this.conf.opened_menu == r.id) {
|
|
u.hideContextMenu()
|
|
} else {
|
|
this._hideContextMenu();
|
|
u.showContextMenu(window.dhx4.absLeft(o), window.dhx4.absTop(o) + o.offsetHeight);
|
|
this.conf.opened_menu = r.id
|
|
}
|
|
u = o = null
|
|
}
|
|
};
|
|
this._hideContextMenu = function(u) {
|
|
if (u != null) {
|
|
u = u || event;
|
|
if (u.type == "keydown" && u.keyCode != 27) {
|
|
return
|
|
}
|
|
var s = u.target || u.srcElement;
|
|
var q = true;
|
|
while (s != null && q == true) {
|
|
if (s.className != null && s.className.search(/SubLevelArea_Polygon/) >= 0) {
|
|
q = false
|
|
} else {
|
|
s = s.parentNode
|
|
}
|
|
}
|
|
}
|
|
if (q || u == null) {
|
|
if (h.cm.global != null) {
|
|
h.cm.global.hideContextMenu()
|
|
}
|
|
for (var r in h.cm.icon) {
|
|
if (h.cm.icon[r] != null) {
|
|
h.cm.icon[r].hideContextMenu()
|
|
}
|
|
}
|
|
for (var r in h.cm.button) {
|
|
for (var o in h.cm.button[r]) {
|
|
if (h.cm.button[r][o] != null) {
|
|
h.cm.button[r][o].hideContextMenu()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this._detachContextMenu = function(r, q, o) {
|
|
if (this.cm == null) {
|
|
return
|
|
}
|
|
if (q == null) {
|
|
if (this.cm.global != null) {
|
|
this.cm.global.unload();
|
|
this.cm.global = null
|
|
}
|
|
} else {
|
|
if (r == "icon") {
|
|
if (this.cm.icon[q] != null) {
|
|
this.cm.icon[q].unload();
|
|
this.cm.icon[q] = null
|
|
}
|
|
} else {
|
|
if (r == "button") {
|
|
if (this.cm.button[q] != null && this.cm.button[q][o] != null) {
|
|
this.cm.button[q][o].unload();
|
|
this.cm.button[q][o] = null
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
this.attachEvent("_winMouseDown", this._showContextMenu);
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.addEventListener("mousedown", this._hideContextMenu, false);
|
|
window.addEventListener("keydown", this._hideContextMenu, false)
|
|
} else {
|
|
document.body.attachEvent("onmousedown", this._hideContextMenu);
|
|
document.body.attachEvent("onkeydown", this._hideContextMenu)
|
|
}
|
|
this._unloadContextMenu = function() {
|
|
this._detachContextMenu("icon", null, null);
|
|
this.cm = null;
|
|
if (typeof(window.addEventListener) == "function") {
|
|
window.removeEventListener("mousedown", this._hideContextMenu, false);
|
|
window.removeEventListener("keydown", this._hideContextMenu, false)
|
|
} else {
|
|
document.body.detachEvent("onmousedown", this._hideContextMenu);
|
|
document.body.detachEvent("onkeydown", this._hideContextMenu)
|
|
}
|
|
h = null
|
|
}
|
|
}
|
|
return l
|
|
};
|
|
if (!window.dhx) {
|
|
dhx = {}
|
|
}
|
|
dhx.assert = function(c, a) {
|
|
if (!c) {
|
|
dhx.assert_error(a)
|
|
}
|
|
};
|
|
dhx.assert_error = function(message) {
|
|
dhx.log("error", message);
|
|
if (dhx.message && typeof message == "string") {
|
|
dhx.message({
|
|
type: "debug",
|
|
text: message,
|
|
expire: -1
|
|
})
|
|
}
|
|
if (dhx.debug !== false) {
|
|
eval("debugger;")
|
|
}
|
|
};
|
|
dhx.assert_core_ready = function() {
|
|
if (window.dhx_on_core_ready) {
|
|
dhx_on_core_ready()
|
|
}
|
|
};
|
|
dhx.version = "3.0";
|
|
dhx.codebase = "./";
|
|
dhx.name = "Core";
|
|
dhx.clone = function(c) {
|
|
var a = dhx.clone._function;
|
|
a.prototype = c;
|
|
return new a()
|
|
};
|
|
dhx.clone._function = function() {};
|
|
dhx.extend = function(g, c, a) {
|
|
dhx.assert(g, "Invalid mixing target");
|
|
dhx.assert(c, "Invalid mixing source");
|
|
if (g._dhx_proto_wait) {
|
|
dhx.PowerArray.insertAt.call(g._dhx_proto_wait, c, 1);
|
|
return g
|
|
}
|
|
for (var h in c) {
|
|
if (!g[h] || a) {
|
|
g[h] = c[h]
|
|
}
|
|
}
|
|
if (c.defaults) {
|
|
dhx.extend(g.defaults, c.defaults)
|
|
}
|
|
if (c.$init) {
|
|
c.$init.call(g)
|
|
}
|
|
return g
|
|
};
|
|
dhx.copy = function(a) {
|
|
dhx.assert(a, "Invalid mixing target");
|
|
if (arguments.length > 1) {
|
|
var c = arguments[0];
|
|
a = arguments[1]
|
|
} else {
|
|
var c = (dhx.isArray(a) ? [] : {})
|
|
}
|
|
for (var g in a) {
|
|
if (a[g] && typeof a[g] == "object" && !dhx.isDate(a[g])) {
|
|
c[g] = (dhx.isArray(a[g]) ? [] : {});
|
|
dhx.copy(c[g], a[g])
|
|
} else {
|
|
c[g] = a[g]
|
|
}
|
|
}
|
|
return c
|
|
};
|
|
dhx.single = function(g) {
|
|
var a = null;
|
|
var c = function(h) {
|
|
if (!a) {
|
|
a = new g({})
|
|
}
|
|
if (a._reinit) {
|
|
a._reinit.apply(a, arguments)
|
|
}
|
|
return a
|
|
};
|
|
return c
|
|
};
|
|
dhx.protoUI = function() {
|
|
if (dhx.debug_proto) {
|
|
dhx.log("UI registered: " + arguments[0].name)
|
|
}
|
|
var g = arguments;
|
|
var a = g[0].name;
|
|
var c = function(l) {
|
|
if (!c) {
|
|
return dhx.ui[a].prototype
|
|
}
|
|
var n = c._dhx_proto_wait;
|
|
if (n) {
|
|
var m = [n[0]];
|
|
for (var h = 1; h < n.length; h++) {
|
|
m[h] = n[h];
|
|
if (m[h]._dhx_proto_wait) {
|
|
m[h] = m[h].call(dhx, m[h].name)
|
|
}
|
|
if (m[h].prototype && m[h].prototype.name) {
|
|
dhx.ui[m[h].prototype.name] = m[h]
|
|
}
|
|
}
|
|
dhx.ui[a] = dhx.proto.apply(dhx, m);
|
|
if (c._dhx_type_wait) {
|
|
for (var h = 0; h < c._dhx_type_wait.length; h++) {
|
|
dhx.Type(dhx.ui[a], c._dhx_type_wait[h])
|
|
}
|
|
}
|
|
c = n = null
|
|
}
|
|
if (this != dhx) {
|
|
return new dhx.ui[a](l)
|
|
} else {
|
|
return dhx.ui[a]
|
|
}
|
|
};
|
|
c._dhx_proto_wait = Array.prototype.slice.call(arguments, 0);
|
|
return dhx.ui[a] = c
|
|
};
|
|
dhx.proto = function() {
|
|
if (dhx.debug_proto) {
|
|
dhx.log("Proto chain:" + arguments[0].name + "[" + arguments.length + "]")
|
|
}
|
|
var m = arguments;
|
|
var l = m[0];
|
|
var c = !! l.$init;
|
|
var o = [];
|
|
dhx.assert(l, "Invalid mixing target");
|
|
for (var h = m.length - 1; h > 0; h--) {
|
|
dhx.assert(m[h], "Invalid mixing source");
|
|
if (typeof m[h] == "function") {
|
|
m[h] = m[h].prototype
|
|
}
|
|
if (m[h].$init) {
|
|
o.push(m[h].$init)
|
|
}
|
|
if (m[h].defaults) {
|
|
var g = m[h].defaults;
|
|
if (!l.defaults) {
|
|
l.defaults = {}
|
|
}
|
|
for (var a in g) {
|
|
if (dhx.isUndefined(l.defaults[a])) {
|
|
l.defaults[a] = g[a]
|
|
}
|
|
}
|
|
}
|
|
if (m[h].type && l.type) {
|
|
for (var a in m[h].type) {
|
|
if (!l.type[a]) {
|
|
l.type[a] = m[h].type[a]
|
|
}
|
|
}
|
|
}
|
|
for (var n in m[h]) {
|
|
if (!l[n]) {
|
|
l[n] = m[h][n]
|
|
}
|
|
}
|
|
}
|
|
if (c) {
|
|
o.push(l.$init)
|
|
}
|
|
l.$init = function() {
|
|
for (var r = 0; r < o.length; r++) {
|
|
o[r].apply(this, arguments)
|
|
}
|
|
};
|
|
var q = function(r) {
|
|
this.$ready = [];
|
|
dhx.assert(this.$init, "object without init method");
|
|
this.$init(r);
|
|
if (this._parseSettings) {
|
|
this._parseSettings(r, this.defaults)
|
|
}
|
|
for (var s = 0; s < this.$ready.length; s++) {
|
|
this.$ready[s].call(this)
|
|
}
|
|
};
|
|
q.prototype = l;
|
|
l = m = null;
|
|
return q
|
|
};
|
|
dhx.bind = function(c, a) {
|
|
return function() {
|
|
return c.apply(a, arguments)
|
|
}
|
|
};
|
|
dhx.require = function(c, o, n) {
|
|
if (typeof c != "string") {
|
|
var m = c.length || 0;
|
|
var l = o;
|
|
if (!m) {
|
|
for (var a in c) {
|
|
m++
|
|
}
|
|
o = function() {
|
|
m--;
|
|
if (m === 0) {
|
|
l.apply(this, arguments)
|
|
}
|
|
};
|
|
for (var a in c) {
|
|
dhx.require(a, o, n)
|
|
}
|
|
} else {
|
|
o = function() {
|
|
if (m) {
|
|
m--;
|
|
dhx.require(c[c.length - m - 1], o, n)
|
|
} else {
|
|
return l.apply(this, arguments)
|
|
}
|
|
};
|
|
o()
|
|
}
|
|
return
|
|
}
|
|
if (dhx._modules[c] !== true) {
|
|
if (c.substr(-4) == ".css") {
|
|
var h = dhx.html.create("LINK", {
|
|
type: "text/css",
|
|
rel: "stylesheet",
|
|
href: dhx.codebase + c
|
|
});
|
|
document.head.appendChild(h);
|
|
if (o) {
|
|
o.call(n || window)
|
|
}
|
|
return
|
|
}
|
|
var g = arguments[4];
|
|
if (!o) {
|
|
dhx.exec(dhx.ajax().sync().get(dhx.codebase + c).responseText);
|
|
dhx._modules[c] = true
|
|
} else {
|
|
if (!dhx._modules[c]) {
|
|
dhx._modules[c] = [
|
|
[o, n]
|
|
];
|
|
dhx.ajax(dhx.codebase + c, function(s) {
|
|
dhx.exec(s);
|
|
var r = dhx._modules[c];
|
|
dhx._modules[c] = true;
|
|
for (var q = 0; q < r.length; q++) {
|
|
r[q][0].call(r[q][1] || window, !q)
|
|
}
|
|
})
|
|
} else {
|
|
dhx._modules[c].push([o, n])
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhx._modules = {};
|
|
dhx.exec = function(code) {
|
|
if (window.execScript) {
|
|
window.execScript(code)
|
|
} else {
|
|
window.eval(code)
|
|
}
|
|
};
|
|
dhx.wrap = function(c, a) {
|
|
if (!c) {
|
|
return a
|
|
}
|
|
return function() {
|
|
var g = c.apply(this, arguments);
|
|
a.apply(this, arguments);
|
|
return g
|
|
}
|
|
};
|
|
dhx.isUndefined = function(c) {
|
|
return typeof c == "undefined"
|
|
};
|
|
dhx.delay = function(h, c, g, a) {
|
|
return window.setTimeout(function() {
|
|
var l = h.apply(c, (g || []));
|
|
h = c = g = null;
|
|
return l
|
|
}, a || 1)
|
|
};
|
|
dhx.uid = function() {
|
|
if (!this._seed) {
|
|
this._seed = (new Date).valueOf()
|
|
}
|
|
this._seed++;
|
|
return this._seed
|
|
};
|
|
dhx.toNode = function(a) {
|
|
if (typeof a == "string") {
|
|
return document.getElementById(a)
|
|
}
|
|
return a
|
|
};
|
|
dhx.toArray = function(a) {
|
|
return dhx.extend((a || []), dhx.PowerArray, true)
|
|
};
|
|
dhx.toFunctor = function(str) {
|
|
return (typeof(str) == "string") ? eval(str) : str
|
|
};
|
|
dhx.isArray = function(a) {
|
|
return Array.isArray ? Array.isArray(a) : (Object.prototype.toString.call(a) === "[object Array]")
|
|
};
|
|
dhx.isDate = function(a) {
|
|
return a instanceof Date
|
|
};
|
|
dhx._events = {};
|
|
dhx.event = function(h, g, a, c) {
|
|
h = dhx.toNode(h);
|
|
var l = dhx.uid();
|
|
if (c) {
|
|
a = dhx.bind(a, c)
|
|
}
|
|
dhx._events[l] = [h, g, a];
|
|
if (h.addEventListener) {
|
|
h.addEventListener(g, a, false)
|
|
} else {
|
|
if (h.attachEvent) {
|
|
h.attachEvent("on" + g, a)
|
|
}
|
|
}
|
|
return l
|
|
};
|
|
dhx.eventRemove = function(c) {
|
|
if (!c) {
|
|
return
|
|
}
|
|
dhx.assert(this._events[c], "Removing non-existing event");
|
|
var a = dhx._events[c];
|
|
if (a[0].removeEventListener) {
|
|
a[0].removeEventListener(a[1], a[2], false)
|
|
} else {
|
|
if (a[0].detachEvent) {
|
|
a[0].detachEvent("on" + a[1], a[2])
|
|
}
|
|
}
|
|
delete this._events[c]
|
|
};
|
|
dhx.log = function(c, g, a) {
|
|
if (arguments.length == 1) {
|
|
g = c;
|
|
c = "log"
|
|
}
|
|
if (window.console && console.log) {
|
|
c = c.toLowerCase();
|
|
if (window.console[c]) {
|
|
window.console[c](g || "unknown error")
|
|
} else {
|
|
window.console.log(c + ": " + g)
|
|
} if (a) {
|
|
window.console.log(a)
|
|
}
|
|
}
|
|
};
|
|
dhx.log_full_time = function(a) {
|
|
dhx._start_time_log = new Date();
|
|
dhx.log("Timing start [" + a + "]");
|
|
window.setTimeout(function() {
|
|
var c = new Date();
|
|
dhx.log("Timing end [" + a + "]:" + (c.valueOf() - dhx._start_time_log.valueOf()) / 1000 + "s")
|
|
}, 1)
|
|
};
|
|
dhx.log_time = function(a) {
|
|
var g = "_start_time_log" + a;
|
|
if (!dhx[g]) {
|
|
dhx[g] = new Date();
|
|
dhx.log("Info", "Timing start [" + a + "]")
|
|
} else {
|
|
var c = new Date();
|
|
dhx.log("Info", "Timing end [" + a + "]:" + (c.valueOf() - dhx[g].valueOf()) / 1000 + "s");
|
|
dhx[g] = null
|
|
}
|
|
};
|
|
dhx.debug_code = function(a) {
|
|
a.call(dhx)
|
|
};
|
|
dhx.EventSystem = {
|
|
$init: function() {
|
|
if (!this._evs_events) {
|
|
this._evs_events = {};
|
|
this._evs_handlers = {};
|
|
this._evs_map = {}
|
|
}
|
|
},
|
|
blockEvent: function() {
|
|
this._evs_events._block = true
|
|
},
|
|
unblockEvent: function() {
|
|
this._evs_events._block = false
|
|
},
|
|
mapEvent: function(a) {
|
|
dhx.extend(this._evs_map, a, true)
|
|
},
|
|
on_setter: function(a) {
|
|
if (a) {
|
|
for (var c in a) {
|
|
if (typeof a[c] == "function") {
|
|
this.attachEvent(c, a[c])
|
|
}
|
|
}
|
|
}
|
|
},
|
|
callEvent: function(g, l) {
|
|
if (this._evs_events._block) {
|
|
return true
|
|
}
|
|
g = g.toLowerCase();
|
|
var h = this._evs_events[g.toLowerCase()];
|
|
var a = true;
|
|
if (dhx.debug) {
|
|
dhx.log("info", "[" + this.name + "] event:" + g, l)
|
|
}
|
|
if (h) {
|
|
for (var c = 0; c < h.length; c++) {
|
|
if (h[c].apply(this, (l || [])) === false) {
|
|
a = false
|
|
}
|
|
}
|
|
}
|
|
if (this._evs_map[g] && !this._evs_map[g].callEvent(g, l)) {
|
|
a = false
|
|
}
|
|
return a
|
|
},
|
|
attachEvent: function(c, a, h) {
|
|
dhx.assert(a, "Invalid event handler for " + c);
|
|
c = c.toLowerCase();
|
|
h = h || dhx.uid();
|
|
a = dhx.toFunctor(a);
|
|
var g = this._evs_events[c] || dhx.toArray();
|
|
g.push(a);
|
|
this._evs_events[c] = g;
|
|
this._evs_handlers[h] = {
|
|
f: a,
|
|
t: c
|
|
};
|
|
return h
|
|
},
|
|
detachEvent: function(h) {
|
|
if (!this._evs_handlers[h]) {
|
|
return
|
|
}
|
|
var c = this._evs_handlers[h].t;
|
|
var a = this._evs_handlers[h].f;
|
|
var g = this._evs_events[c];
|
|
g.remove(a);
|
|
delete this._evs_handlers[h]
|
|
},
|
|
hasEvent: function(a) {
|
|
a = a.toLowerCase();
|
|
return this._evs_events[a] ? true : false
|
|
}
|
|
};
|
|
dhx.extend(dhx, dhx.EventSystem);
|
|
dhx.PowerArray = {
|
|
removeAt: function(c, a) {
|
|
if (c >= 0) {
|
|
this.splice(c, (a || 1))
|
|
}
|
|
},
|
|
remove: function(a) {
|
|
this.removeAt(this.find(a))
|
|
},
|
|
insertAt: function(c, g) {
|
|
if (!g && g !== 0) {
|
|
this.push(c)
|
|
} else {
|
|
var a = this.splice(g, (this.length - g));
|
|
this[g] = c;
|
|
this.push.apply(this, a)
|
|
}
|
|
},
|
|
find: function(c) {
|
|
for (var a = 0; a < this.length; a++) {
|
|
if (c == this[a]) {
|
|
return a
|
|
}
|
|
}
|
|
return -1
|
|
},
|
|
each: function(a, g) {
|
|
for (var c = 0; c < this.length; c++) {
|
|
a.call((g || this), this[c])
|
|
}
|
|
},
|
|
map: function(a, g) {
|
|
for (var c = 0; c < this.length; c++) {
|
|
this[c] = a.call((g || this), this[c])
|
|
}
|
|
return this
|
|
},
|
|
filter: function(a, g) {
|
|
for (var c = 0; c < this.length; c++) {
|
|
if (!a.call((g || this), this[c])) {
|
|
this.splice(c, 1);
|
|
c--
|
|
}
|
|
}
|
|
return this
|
|
}
|
|
};
|
|
dhx.env = {};
|
|
(function() {
|
|
if (navigator.userAgent.indexOf("Mobile") != -1) {
|
|
dhx.env.mobile = true
|
|
}
|
|
if (dhx.env.mobile || navigator.userAgent.indexOf("iPad") != -1 || navigator.userAgent.indexOf("Android") != -1) {
|
|
dhx.env.touch = true
|
|
}
|
|
if (navigator.userAgent.indexOf("Opera") != -1) {
|
|
dhx.env.isOpera = true
|
|
} else {
|
|
dhx.env.isIE = !! document.all;
|
|
dhx.env.isFF = !document.all;
|
|
dhx.env.isWebKit = (navigator.userAgent.indexOf("KHTML") != -1);
|
|
dhx.env.isSafari = dhx.env.isWebKit && (navigator.userAgent.indexOf("Mac") != -1)
|
|
} if (navigator.userAgent.toLowerCase().indexOf("android") != -1) {
|
|
dhx.env.isAndroid = true
|
|
}
|
|
dhx.env.transform = false;
|
|
dhx.env.transition = false;
|
|
var g = {};
|
|
g.names = ["transform", "transition"];
|
|
g.transform = ["transform", "WebkitTransform", "MozTransform", "OTransform", "msTransform"];
|
|
g.transition = ["transition", "WebkitTransition", "MozTransition", "OTransition", "msTransition"];
|
|
var n = document.createElement("DIV");
|
|
for (var l = 0; l < g.names.length; l++) {
|
|
var h = g[g.names[l]];
|
|
for (var c = 0; c < h.length; c++) {
|
|
if (typeof n.style[h[c]] != "undefined") {
|
|
dhx.env[g.names[l]] = h[c];
|
|
break
|
|
}
|
|
}
|
|
}
|
|
n.style[dhx.env.transform] = "translate3d(0,0,0)";
|
|
dhx.env.translate = (n.style[dhx.env.transform]) ? "translate3d" : "translate";
|
|
var m = "";
|
|
var a = false;
|
|
if (dhx.env.isOpera) {
|
|
m = "-o-";
|
|
a = "O"
|
|
}
|
|
if (dhx.env.isFF) {
|
|
m = "-Moz-"
|
|
}
|
|
if (dhx.env.isWebKit) {
|
|
m = "-webkit-"
|
|
}
|
|
if (dhx.env.isIE) {
|
|
m = "-ms-"
|
|
}
|
|
dhx.env.transformCSSPrefix = m;
|
|
dhx.env.transformPrefix = a || (dhx.env.transformCSSPrefix.replace(/-/gi, ""));
|
|
dhx.env.transitionEnd = ((dhx.env.transformCSSPrefix == "-Moz-") ? "transitionend" : (dhx.env.transformPrefix + "TransitionEnd"))
|
|
})();
|
|
dhx.env.svg = (function() {
|
|
return document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")
|
|
})();
|
|
dhx.html = {
|
|
_native_on_selectstart: 0,
|
|
denySelect: function() {
|
|
if (!dhx._native_on_selectstart) {
|
|
dhx._native_on_selectstart = document.onselectstart
|
|
}
|
|
document.onselectstart = dhx.html.stopEvent
|
|
},
|
|
allowSelect: function() {
|
|
if (dhx._native_on_selectstart !== 0) {
|
|
document.onselectstart = dhx._native_on_selectstart || null
|
|
}
|
|
dhx._native_on_selectstart = 0
|
|
},
|
|
index: function(c) {
|
|
var a = 0;
|
|
while (c = c.previousSibling) {
|
|
a++
|
|
}
|
|
return a
|
|
},
|
|
_style_cache: {},
|
|
createCss: function(g) {
|
|
var h = "";
|
|
for (var c in g) {
|
|
h += c + ":" + g[c] + ";"
|
|
}
|
|
var a = this._style_cache[h];
|
|
if (!a) {
|
|
a = "s" + dhx.uid();
|
|
this.addStyle("." + a + "{" + h + "}");
|
|
this._style_cache[h] = a
|
|
}
|
|
return a
|
|
},
|
|
addStyle: function(c) {
|
|
var a = document.createElement("style");
|
|
a.setAttribute("type", "text/css");
|
|
a.setAttribute("media", "screen");
|
|
if (a.styleSheet) {
|
|
a.styleSheet.cssText = c
|
|
} else {
|
|
a.appendChild(document.createTextNode(c))
|
|
}
|
|
document.getElementsByTagName("head")[0].appendChild(a)
|
|
},
|
|
create: function(c, a, g) {
|
|
a = a || {};
|
|
var h = document.createElement(c);
|
|
for (var l in a) {
|
|
h.setAttribute(l, a[l])
|
|
}
|
|
if (a.style) {
|
|
h.style.cssText = a.style
|
|
}
|
|
if (a["class"]) {
|
|
h.className = a["class"]
|
|
}
|
|
if (g) {
|
|
h.innerHTML = g
|
|
}
|
|
return h
|
|
},
|
|
getValue: function(a) {
|
|
a = dhx.toNode(a);
|
|
if (!a) {
|
|
return ""
|
|
}
|
|
return dhx.isUndefined(a.value) ? a.innerHTML : a.value
|
|
},
|
|
remove: function(c) {
|
|
if (c instanceof Array) {
|
|
for (var a = 0; a < c.length; a++) {
|
|
this.remove(c[a])
|
|
}
|
|
} else {
|
|
if (c && c.parentNode) {
|
|
c.parentNode.removeChild(c)
|
|
}
|
|
}
|
|
},
|
|
insertBefore: function(c, g, a) {
|
|
if (!c) {
|
|
return
|
|
}
|
|
if (g && g.parentNode) {
|
|
g.parentNode.insertBefore(c, g)
|
|
} else {
|
|
a.appendChild(c)
|
|
}
|
|
},
|
|
locate: function(c, h) {
|
|
if (c.tagName) {
|
|
var a = c
|
|
} else {
|
|
c = c || event;
|
|
var a = c.target || c.srcElement
|
|
}
|
|
while (a) {
|
|
if (a.getAttribute) {
|
|
var g = a.getAttribute(h);
|
|
if (g) {
|
|
return g
|
|
}
|
|
}
|
|
a = a.parentNode
|
|
}
|
|
return null
|
|
},
|
|
offset: function(h) {
|
|
if (h.getBoundingClientRect) {
|
|
var n = h.getBoundingClientRect();
|
|
var o = document.body;
|
|
var c = document.documentElement;
|
|
var a = window.pageYOffset || c.scrollTop || o.scrollTop;
|
|
var l = window.pageXOffset || c.scrollLeft || o.scrollLeft;
|
|
var m = c.clientTop || o.clientTop || 0;
|
|
var q = c.clientLeft || o.clientLeft || 0;
|
|
var r = n.top + a - m;
|
|
var g = n.left + l - q;
|
|
return {
|
|
y: Math.round(r),
|
|
x: Math.round(g)
|
|
}
|
|
} else {
|
|
var r = 0,
|
|
g = 0;
|
|
while (h) {
|
|
r = r + parseInt(h.offsetTop, 10);
|
|
g = g + parseInt(h.offsetLeft, 10);
|
|
h = h.offsetParent
|
|
}
|
|
return {
|
|
y: r,
|
|
x: g
|
|
}
|
|
}
|
|
},
|
|
posRelative: function(a) {
|
|
a = a || event;
|
|
if (!dhx.isUndefined(a.offsetX)) {
|
|
return {
|
|
x: a.offsetX,
|
|
y: a.offsetY
|
|
}
|
|
} else {
|
|
return {
|
|
x: a.layerX,
|
|
y: a.layerY
|
|
}
|
|
}
|
|
},
|
|
pos: function(a) {
|
|
a = a || event;
|
|
if (a.pageX || a.pageY) {
|
|
return {
|
|
x: a.pageX,
|
|
y: a.pageY
|
|
}
|
|
}
|
|
var c = ((dhx.env.isIE) && (document.compatMode != "BackCompat")) ? document.documentElement : document.body;
|
|
return {
|
|
x: a.clientX + c.scrollLeft - c.clientLeft,
|
|
y: a.clientY + c.scrollTop - c.clientTop
|
|
}
|
|
},
|
|
preventEvent: function(a) {
|
|
if (a && a.preventDefault) {
|
|
a.preventDefault()
|
|
}
|
|
return dhx.html.stopEvent(a)
|
|
},
|
|
stopEvent: function(a) {
|
|
(a || event).cancelBubble = true;
|
|
return false
|
|
},
|
|
addCss: function(c, a) {
|
|
c.className += " " + a
|
|
},
|
|
removeCss: function(c, a) {
|
|
c.className = c.className.replace(RegExp(" " + a, "g"), "")
|
|
}
|
|
};
|
|
dhx.ready = function(a) {
|
|
if (this._ready) {
|
|
a.call()
|
|
} else {
|
|
this._ready_code.push(a)
|
|
}
|
|
};
|
|
dhx._ready_code = [];
|
|
(function() {
|
|
var a = document.getElementsByTagName("SCRIPT");
|
|
dhx.assert(a.length, "Can't locate codebase");
|
|
if (a.length) {
|
|
a = (a[a.length - 1].getAttribute("src") || "").split("/");
|
|
a.splice(a.length - 1, 1);
|
|
dhx.codebase = a.slice(0, a.length).join("/") + "/"
|
|
}
|
|
dhx.event(window, "load", function() {
|
|
dhx.callEvent("onReady", []);
|
|
dhx.delay(function() {
|
|
dhx._ready = true;
|
|
for (var c = 0; c < dhx._ready_code.length; c++) {
|
|
dhx._ready_code[c].call()
|
|
}
|
|
dhx._ready_code = []
|
|
})
|
|
})
|
|
})();
|
|
dhx.locale = dhx.locale || {};
|
|
dhx.assert_core_ready();
|
|
dhx.ready(function() {
|
|
dhx.event(document.body, "click", function(a) {
|
|
dhx.callEvent("onClick", [a || event])
|
|
})
|
|
});
|
|
(function() {
|
|
var g = {};
|
|
var c = new RegExp("(\\r\\n|\\n)", "g");
|
|
var a = new RegExp('(\\")', "g");
|
|
dhx.Template = function(l) {
|
|
if (typeof l == "function") {
|
|
return l
|
|
}
|
|
if (g[l]) {
|
|
return g[l]
|
|
}
|
|
l = (l || "").toString();
|
|
if (l.indexOf("->") != -1) {
|
|
l = l.split("->");
|
|
switch (l[0]) {
|
|
case "html":
|
|
l = dhx.html.getValue(l[1]);
|
|
break;
|
|
case "http":
|
|
l = new dhx.ajax().sync().get(l[1], {
|
|
uid: dhx.uid()
|
|
}).responseText;
|
|
break;
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
l = (l || "").toString();
|
|
l = l.replace(c, "\\n");
|
|
l = l.replace(a, '\\"');
|
|
l = l.replace(/\{obj\.([^}?]+)\?([^:]*):([^}]*)\}/g, '"+(obj.$1?"$2":"$3")+"');
|
|
l = l.replace(/\{common\.([^}\(]*)\}/g, "\"+(common.$1||'')+\"");
|
|
l = l.replace(/\{common\.([^\}\(]*)\(\)\}/g, '"+(common.$1?common.$1.apply(this, arguments):"")+"');
|
|
l = l.replace(/\{obj\.([^}]*)\}/g, '"+(obj.$1)+"');
|
|
l = l.replace("{obj}", '"+obj+"');
|
|
l = l.replace(/#([^#'";, ]+)#/gi, '"+(obj.$1)+"');
|
|
try {
|
|
g[l] = Function("obj", "common", 'return "' + l + '";')
|
|
} catch (h) {
|
|
dhx.assert_error("Invalid template:" + l)
|
|
}
|
|
return g[l]
|
|
};
|
|
dhx.Template.empty = function() {
|
|
return ""
|
|
};
|
|
dhx.Template.bind = function(h) {
|
|
return dhx.bind(dhx.Template(h), this)
|
|
};
|
|
dhx.Type = function(o, n) {
|
|
if (o._dhx_proto_wait) {
|
|
if (!o._dhx_type_wait) {
|
|
o._dhx_type_wait = []
|
|
}
|
|
o._dhx_type_wait.push(n);
|
|
return
|
|
}
|
|
if (typeof o == "function") {
|
|
o = o.prototype
|
|
}
|
|
if (!o.types) {
|
|
o.types = {
|
|
"default": o.type
|
|
};
|
|
o.type.name = "default"
|
|
}
|
|
var h = n.name;
|
|
var m = o.type;
|
|
if (h) {
|
|
m = o.types[h] = dhx.clone(n.baseType ? o.types[n.baseType] : o.type)
|
|
}
|
|
for (var l in n) {
|
|
if (l.indexOf("template") === 0) {
|
|
m[l] = dhx.Template(n[l])
|
|
} else {
|
|
m[l] = n[l]
|
|
}
|
|
}
|
|
return h
|
|
}
|
|
})();
|
|
dhx.Settings = {
|
|
$init: function() {
|
|
this._settings = this.config = {}
|
|
},
|
|
define: function(c, a) {
|
|
if (typeof c == "object") {
|
|
return this._parseSeetingColl(c)
|
|
}
|
|
return this._define(c, a)
|
|
},
|
|
_define: function(c, a) {
|
|
var g = this[c + "_setter"];
|
|
return this._settings[c] = g ? g.call(this, a, c) : a
|
|
},
|
|
_parseSeetingColl: function(g) {
|
|
if (g) {
|
|
for (var c in g) {
|
|
this._define(c, g[c])
|
|
}
|
|
}
|
|
},
|
|
_parseSettings: function(g, a) {
|
|
var c = {};
|
|
if (a) {
|
|
c = dhx.extend(c, a)
|
|
}
|
|
if (typeof g == "object" && !g.tagName) {
|
|
dhx.extend(c, g, true)
|
|
}
|
|
this._parseSeetingColl(c)
|
|
},
|
|
_mergeSettings: function(a, g) {
|
|
for (var c in g) {
|
|
switch (typeof a[c]) {
|
|
case "object":
|
|
a[c] = this._mergeSettings((a[c] || {}), g[c]);
|
|
break;
|
|
case "undefined":
|
|
a[c] = g[c];
|
|
break;
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
return a
|
|
},
|
|
debug_freid_c_id: true,
|
|
debug_freid_a_name: true
|
|
};
|
|
dhx.ajax = function(a, c, g) {
|
|
if (arguments.length !== 0) {
|
|
var h = new dhx.ajax();
|
|
if (g) {
|
|
h.master = g
|
|
}
|
|
return h.get(a, null, c)
|
|
}
|
|
if (!this.getXHR) {
|
|
return new dhx.ajax()
|
|
}
|
|
return this
|
|
};
|
|
dhx.ajax.count = 0;
|
|
dhx.ajax.prototype = {
|
|
master: null,
|
|
getXHR: function() {
|
|
if (dhx.env.isIE) {
|
|
return new ActiveXObject("Microsoft.xmlHTTP")
|
|
} else {
|
|
return new XMLHttpRequest()
|
|
}
|
|
},
|
|
send: function(l, q, n) {
|
|
var c = this.getXHR();
|
|
if (!dhx.isArray(n)) {
|
|
n = [n]
|
|
}
|
|
if (typeof q == "object") {
|
|
var m = [];
|
|
for (var g in q) {
|
|
var o = q[g];
|
|
if (o === null || o === dhx.undefined) {
|
|
o = ""
|
|
}
|
|
m.push(g + "=" + encodeURIComponent(o))
|
|
}
|
|
q = m.join("&")
|
|
}
|
|
if (q && this.request === "GET") {
|
|
l = l + (l.indexOf("?") != -1 ? "&" : "?") + q;
|
|
q = null
|
|
}
|
|
c.open(this.request, l, !this._sync);
|
|
if (this.request === "POST") {
|
|
c.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
|
|
}
|
|
var h = this;
|
|
c.onreadystatechange = function() {
|
|
if (!c.readyState || c.readyState == 4) {
|
|
if (dhx.debug_time) {
|
|
dhx.log_full_time("data_loading")
|
|
}
|
|
dhx.ajax.count++;
|
|
if (n && h) {
|
|
for (var a = 0; a < n.length; a++) {
|
|
if (n[a]) {
|
|
var r = (n[a].success || n[a]);
|
|
if (c.status >= 400 || (!c.status && !c.responseText)) {
|
|
r = n[a].error
|
|
}
|
|
if (r) {
|
|
r.call((h.master || h), c.responseText, c.responseXML, c)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (h) {
|
|
h.master = null
|
|
}
|
|
n = h = null
|
|
}
|
|
};
|
|
c.send(q || null);
|
|
return c
|
|
},
|
|
get: function(a, g, c) {
|
|
if (arguments.length == 2) {
|
|
c = g;
|
|
g = null
|
|
}
|
|
this.request = "GET";
|
|
return this.send(a, g, c)
|
|
},
|
|
post: function(a, g, c) {
|
|
this.request = "POST";
|
|
return this.send(a, g, c)
|
|
},
|
|
put: function(a, g, c) {
|
|
this.request = "PUT";
|
|
return this.send(a, g, c)
|
|
},
|
|
del: function(a, g, c) {
|
|
this.request = "DELETE";
|
|
return this.send(a, g, c)
|
|
},
|
|
sync: function() {
|
|
this._sync = true;
|
|
return this
|
|
},
|
|
bind: function(a) {
|
|
this.master = a;
|
|
return this
|
|
}
|
|
};
|
|
dhx.send = function(g, c, n, m) {
|
|
var h = dhx.html.create("FORM", {
|
|
target: (m || "_self"),
|
|
action: g,
|
|
method: (n || "POST")
|
|
}, "");
|
|
for (var a in c) {
|
|
var l = dhx.html.create("INPUT", {
|
|
type: "hidden",
|
|
name: a,
|
|
value: c[a]
|
|
}, "");
|
|
h.appendChild(l)
|
|
}
|
|
h.style.display = "none";
|
|
document.body.appendChild(h);
|
|
h.submit();
|
|
document.body.removeChild(h)
|
|
};
|
|
dhx.AtomDataLoader = {
|
|
$init: function(a) {
|
|
this.data = {};
|
|
if (a) {
|
|
this._settings.datatype = a.datatype || "json";
|
|
this.$ready.push(this._load_when_ready)
|
|
}
|
|
},
|
|
_load_when_ready: function() {
|
|
this._ready_for_data = true;
|
|
if (this._settings.url) {
|
|
this.url_setter(this._settings.url)
|
|
}
|
|
if (this._settings.data) {
|
|
this.data_setter(this._settings.data)
|
|
}
|
|
},
|
|
url_setter: function(a) {
|
|
if (!this._ready_for_data) {
|
|
return a
|
|
}
|
|
this.load(a, this._settings.datatype);
|
|
return a
|
|
},
|
|
data_setter: function(a) {
|
|
if (!this._ready_for_data) {
|
|
return a
|
|
}
|
|
this.parse(a, this._settings.datatype);
|
|
return true
|
|
},
|
|
debug_freid_c_datatype: true,
|
|
debug_freid_c_dataFeed: true,
|
|
load: function(a, c) {
|
|
if (a.$proxy) {
|
|
a.load(this, typeof c == "string" ? c : "json");
|
|
return
|
|
}
|
|
this.callEvent("onXLS", []);
|
|
if (typeof c == "string") {
|
|
this.data.driver = dhx.DataDriver[c];
|
|
c = arguments[2]
|
|
} else {
|
|
if (!this.data.driver) {
|
|
this.data.driver = dhx.DataDriver.json
|
|
}
|
|
}
|
|
var g = [{
|
|
success: this._onLoad,
|
|
error: this._onLoadError
|
|
}];
|
|
if (c) {
|
|
if (dhx.isArray(c)) {
|
|
g.push.apply(g, c)
|
|
} else {
|
|
g.push(c)
|
|
}
|
|
}
|
|
return dhx.ajax(a, g, this)
|
|
},
|
|
parse: function(c, a) {
|
|
this.callEvent("onXLS", []);
|
|
this.data.driver = dhx.DataDriver[a || "json"];
|
|
this._onLoad(c, null)
|
|
},
|
|
_onLoad: function(n, c, a, g) {
|
|
var l = this.data.driver;
|
|
var h = l.toObject(n, c);
|
|
if (h) {
|
|
var m = l.getRecords(h)[0];
|
|
this.data = (l ? l.getDetails(m) : n)
|
|
} else {
|
|
this._onLoadError(n, c, a)
|
|
}
|
|
this.callEvent("onXLE", [])
|
|
},
|
|
_onLoadError: function(g, a, c) {
|
|
this.callEvent("onXLE", []);
|
|
this.callEvent("onLoadError", arguments);
|
|
dhx.callEvent("onLoadError", [g, a, c, this])
|
|
},
|
|
_check_data_feed: function(c) {
|
|
if (!this._settings.dataFeed || this._ignore_feed || !c) {
|
|
return true
|
|
}
|
|
var a = this._settings.dataFeed;
|
|
if (typeof a == "function") {
|
|
return a.call(this, (c.id || c), c)
|
|
}
|
|
a = a + (a.indexOf("?") == -1 ? "?" : "&") + "action=get&id=" + encodeURIComponent(c.id || c);
|
|
this.callEvent("onXLS", []);
|
|
dhx.ajax(a, function(m, h, g) {
|
|
this._ignore_feed = true;
|
|
var l = dhx.DataDriver.toObject(m, h);
|
|
if (l) {
|
|
this.setValues(l.getDetails(l.getRecords()[0]))
|
|
} else {
|
|
this._onLoadError(m, h, g)
|
|
}
|
|
this._ignore_feed = false;
|
|
this.callEvent("onXLE", [])
|
|
}, this);
|
|
return false
|
|
}
|
|
};
|
|
dhx.DataDriver = {};
|
|
dhx.DataDriver.json = {
|
|
toObject: function(data) {
|
|
if (!data) {
|
|
data = "[]"
|
|
}
|
|
if (typeof data == "string") {
|
|
try {
|
|
eval("dhx.temp=" + data)
|
|
} catch (e) {
|
|
dhx.assert_error(e);
|
|
return null
|
|
}
|
|
data = dhx.temp
|
|
}
|
|
if (data.data) {
|
|
var t = data.data.config = {};
|
|
for (var key in data) {
|
|
if (key != "data") {
|
|
t[key] = data[key]
|
|
}
|
|
}
|
|
data = data.data
|
|
}
|
|
return data
|
|
},
|
|
getRecords: function(a) {
|
|
if (a && !dhx.isArray(a)) {
|
|
return [a]
|
|
}
|
|
return a
|
|
},
|
|
getDetails: function(a) {
|
|
if (typeof a == "string") {
|
|
return {
|
|
id: dhx.uid(),
|
|
value: a
|
|
}
|
|
}
|
|
return a
|
|
},
|
|
getInfo: function(c) {
|
|
var a = c.config;
|
|
if (!a) {
|
|
return {}
|
|
}
|
|
return {
|
|
_size: (a.total_count || 0),
|
|
_from: (a.pos || 0),
|
|
_parent: (a.parent || 0),
|
|
_config: (a.config),
|
|
_key: (a.dhx_security)
|
|
}
|
|
},
|
|
child: "data"
|
|
};
|
|
dhx.DataDriver.html = {
|
|
toObject: function(c) {
|
|
if (typeof c == "string") {
|
|
var a = null;
|
|
if (c.indexOf("<") == -1) {
|
|
a = dhx.toNode(c)
|
|
}
|
|
if (!a) {
|
|
a = document.createElement("DIV");
|
|
a.innerHTML = c
|
|
}
|
|
return a.getElementsByTagName(this.tag)
|
|
}
|
|
return c
|
|
},
|
|
getRecords: function(c) {
|
|
var g = [];
|
|
for (var a = 0; a < c.childNodes.length; a++) {
|
|
var h = c.childNodes[a];
|
|
if (h.nodeType == 1) {
|
|
g.push(h)
|
|
}
|
|
}
|
|
return g
|
|
},
|
|
getDetails: function(a) {
|
|
return dhx.DataDriver.xml.tagToObject(a)
|
|
},
|
|
getInfo: function(a) {
|
|
return {
|
|
_size: 0,
|
|
_from: 0
|
|
}
|
|
},
|
|
tag: "LI"
|
|
};
|
|
dhx.DataDriver.jsarray = {
|
|
toObject: function(data) {
|
|
if (typeof data == "string") {
|
|
eval("dhx.temp=" + data);
|
|
return dhx.temp
|
|
}
|
|
return data
|
|
},
|
|
getRecords: function(a) {
|
|
return a
|
|
},
|
|
getDetails: function(g) {
|
|
var a = {};
|
|
for (var c = 0; c < g.length; c++) {
|
|
a["data" + c] = g[c]
|
|
}
|
|
return a
|
|
},
|
|
getInfo: function(a) {
|
|
return {
|
|
_size: 0,
|
|
_from: 0
|
|
}
|
|
}
|
|
};
|
|
dhx.DataDriver.csv = {
|
|
toObject: function(a) {
|
|
return a
|
|
},
|
|
getRecords: function(a) {
|
|
return a.split(this.row)
|
|
},
|
|
getDetails: function(g) {
|
|
g = this.stringToArray(g);
|
|
var a = {};
|
|
for (var c = 0; c < g.length; c++) {
|
|
a["data" + c] = g[c]
|
|
}
|
|
return a
|
|
},
|
|
getInfo: function(a) {
|
|
return {
|
|
_size: 0,
|
|
_from: 0
|
|
}
|
|
},
|
|
stringToArray: function(c) {
|
|
c = c.split(this.cell);
|
|
for (var a = 0; a < c.length; a++) {
|
|
c[a] = c[a].replace(/^[ \t\n\r]*(\"|)/g, "").replace(/(\"|)[ \t\n\r]*$/g, "")
|
|
}
|
|
return c
|
|
},
|
|
row: "\n",
|
|
cell: ","
|
|
};
|
|
dhx.DataDriver.xml = {
|
|
_isValidXML: function(a) {
|
|
if (!a || !a.documentElement) {
|
|
return null
|
|
}
|
|
if (a.getElementsByTagName("parsererror").length) {
|
|
return null
|
|
}
|
|
return a
|
|
},
|
|
toObject: function(g, a) {
|
|
if (this._isValidXML(c)) {
|
|
return c
|
|
}
|
|
if (typeof g == "string") {
|
|
var c = this.fromString(g.replace(/^[\s]+/, ""))
|
|
} else {
|
|
c = g
|
|
} if (this._isValidXML(c)) {
|
|
return c
|
|
}
|
|
return null
|
|
},
|
|
getRecords: function(a) {
|
|
return this.xpath(a, this.records)
|
|
},
|
|
records: "/*/item",
|
|
child: "item",
|
|
config: "/*/config",
|
|
getDetails: function(a) {
|
|
return this.tagToObject(a, {})
|
|
},
|
|
getInfo: function(c) {
|
|
var a = this.xpath(c, this.config);
|
|
if (a.length) {
|
|
a = this.assignTypes(this.tagToObject(a[0], {}))
|
|
} else {
|
|
a = null
|
|
}
|
|
return {
|
|
_size: (c.documentElement.getAttribute("total_count") || 0),
|
|
_from: (c.documentElement.getAttribute("pos") || 0),
|
|
_parent: (c.documentElement.getAttribute("parent") || 0),
|
|
_config: a,
|
|
_key: (c.documentElement.getAttribute("dhx_security") || null)
|
|
}
|
|
},
|
|
xpath: function(h, 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)
|
|
}
|
|
}
|
|
},
|
|
assignTypes: function(c) {
|
|
for (var a in c) {
|
|
var g = c[a];
|
|
if (typeof g == "object") {
|
|
this.assignTypes(g)
|
|
} else {
|
|
if (typeof g == "string") {
|
|
if (g === "") {
|
|
continue
|
|
}
|
|
if (g == "true") {
|
|
c[a] = true
|
|
} else {
|
|
if (g == "false") {
|
|
c[a] = false
|
|
} else {
|
|
if (g == g * 1) {
|
|
c[a] = c[a] * 1
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return c
|
|
},
|
|
tagToObject: function(g, q) {
|
|
q = q || {};
|
|
var l = false;
|
|
var h = g.attributes;
|
|
if (h && h.length) {
|
|
for (var n = 0; n < h.length; n++) {
|
|
q[h[n].name] = h[n].value
|
|
}
|
|
l = true
|
|
}
|
|
var c = g.childNodes;
|
|
var o = {};
|
|
for (var n = 0; n < c.length; n++) {
|
|
if (c[n].nodeType == 1) {
|
|
var m = c[n].tagName;
|
|
if (typeof q[m] != "undefined") {
|
|
if (!dhx.isArray(q[m])) {
|
|
q[m] = [q[m]]
|
|
}
|
|
q[m].push(this.tagToObject(c[n], {}))
|
|
} else {
|
|
q[c[n].tagName] = this.tagToObject(c[n], {})
|
|
}
|
|
l = true
|
|
}
|
|
}
|
|
if (!l) {
|
|
return this.nodeValue(g)
|
|
}
|
|
q.value = q.value || this.nodeValue(g);
|
|
return q
|
|
},
|
|
nodeValue: function(a) {
|
|
if (a.firstChild) {
|
|
return a.firstChild.data
|
|
}
|
|
return ""
|
|
},
|
|
fromString: function(g) {
|
|
try {
|
|
if (window.DOMParser) {
|
|
return (new DOMParser()).parseFromString(g, "text/xml")
|
|
}
|
|
if (window.ActiveXObject) {
|
|
var a = new ActiveXObject("Microsoft.xmlDOM");
|
|
a.loadXML(g);
|
|
return a
|
|
}
|
|
} catch (c) {
|
|
dhx.assert_error(c);
|
|
return null
|
|
}
|
|
dhx.assert_error("Load from xml string is not supported")
|
|
}
|
|
};
|
|
dhx.DataLoader = dhx.proto({
|
|
$init: function(a) {
|
|
a = a || "";
|
|
this._ajax_queue = dhx.toArray();
|
|
this.data = new dhx.DataStore();
|
|
this.data.attachEvent("onClearAll", dhx.bind(this._call_onclearall, this));
|
|
this.data.attachEvent("onServerConfig", dhx.bind(this._call_on_config, this));
|
|
this.data.feed = this._feed
|
|
},
|
|
_feed: function(g, a, c) {
|
|
if (this._load_count) {
|
|
return this._load_count = [g, a, c]
|
|
} else {
|
|
this._load_count = true
|
|
}
|
|
this._feed_last = [g, a];
|
|
this._feed_common.call(this, g, a, c)
|
|
},
|
|
_feed_common: function(h, c, g) {
|
|
var a = this.data.url;
|
|
if (h < 0) {
|
|
h = 0
|
|
}
|
|
this.load(a + ((a.indexOf("?") == -1) ? "?" : "&") + (this.dataCount() ? ("continue=true&") : "") + "start=" + h + "&count=" + c, [this._feed_callback, g])
|
|
},
|
|
_feed_callback: function() {
|
|
var a = this._load_count;
|
|
var c = this._feed_last;
|
|
this._load_count = false;
|
|
if (typeof a == "object" && (a[0] != c[0] || a[1] != c[1])) {
|
|
this.data.feed.apply(this, a)
|
|
}
|
|
},
|
|
load: function(a, c) {
|
|
var g = dhx.AtomDataLoader.load.apply(this, arguments);
|
|
this._ajax_queue.push(g);
|
|
if (!this.data.url) {
|
|
this.data.url = a
|
|
}
|
|
},
|
|
loadNext: function(g, l, h, c, a) {
|
|
if (this._settings.datathrottle && !a) {
|
|
if (this._throttle_request) {
|
|
window.clearTimeout(this._throttle_request)
|
|
}
|
|
this._throttle_request = dhx.delay(function() {
|
|
this.loadNext(g, l, h, c, true)
|
|
}, this, 0, this._settings.datathrottle);
|
|
return
|
|
}
|
|
if (!l && l !== 0) {
|
|
l = this.dataCount()
|
|
}
|
|
this.data.url = this.data.url || c;
|
|
if (this.callEvent("onDataRequest", [l, g, h, c]) && this.data.url) {
|
|
this.data.feed.call(this, l, g, h)
|
|
}
|
|
},
|
|
_maybe_loading_already: function(c, g) {
|
|
var a = this._feed_last;
|
|
if (this._load_count && a) {
|
|
if (a[0] <= g && (a[1] + a[0] >= c + g)) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
},
|
|
_onLoad: function(h, c, a) {
|
|
this._ajax_queue.remove(a);
|
|
var g = this.data.driver.toObject(h, c);
|
|
if (g) {
|
|
this.data._parse(g)
|
|
} else {
|
|
return this._onLoadError(h, c, a)
|
|
}
|
|
this._call_onready();
|
|
this.callEvent("onXLE", [])
|
|
},
|
|
removeMissed_setter: function(a) {
|
|
return this.data._removeMissed = a
|
|
},
|
|
scheme_setter: function(a) {
|
|
this.data.scheme(a)
|
|
},
|
|
dataFeed_setter: function(a) {
|
|
this.data.attachEvent("onBeforeFilter", dhx.bind(function(n, m) {
|
|
if (this._settings.dataFeed) {
|
|
var l = {};
|
|
if (!n && !m) {
|
|
return
|
|
}
|
|
if (typeof n == "function") {
|
|
if (!m) {
|
|
return
|
|
}
|
|
n(m, l)
|
|
} else {
|
|
l = {
|
|
text: m
|
|
}
|
|
}
|
|
this.clearAll();
|
|
var c = this._settings.dataFeed;
|
|
var h = [];
|
|
if (typeof c == "function") {
|
|
return c.call(this, m, l)
|
|
}
|
|
for (var g in l) {
|
|
h.push("dhx_filter[" + g + "]=" + encodeURIComponent(l[g]))
|
|
}
|
|
this.load(c + (c.indexOf("?") < 0 ? "?" : "&") + h.join("&"), this._settings.datatype);
|
|
return false
|
|
}
|
|
}, this));
|
|
return a
|
|
},
|
|
debug_freid_c_ready: true,
|
|
debug_freid_c_datathrottle: true,
|
|
_call_onready: function() {
|
|
if (this._settings.ready && !this._ready_was_used) {
|
|
var a = dhx.toFunctor(this._settings.ready);
|
|
if (a) {
|
|
dhx.delay(a, this, arguments)
|
|
}
|
|
this._ready_was_used = true
|
|
}
|
|
},
|
|
_call_onclearall: function() {
|
|
for (var a = 0; a < this._ajax_queue.length; a++) {
|
|
this._ajax_queue[a].abort()
|
|
}
|
|
this._ajax_queue = dhx.toArray()
|
|
},
|
|
_call_on_config: function(a) {
|
|
this._parseSeetingColl(a)
|
|
}
|
|
}, dhx.AtomDataLoader);
|
|
dhx.DataStore = function() {
|
|
this.name = "DataStore";
|
|
dhx.extend(this, dhx.EventSystem);
|
|
this.setDriver("json");
|
|
this.pull = {};
|
|
this.order = dhx.toArray();
|
|
this._marks = {}
|
|
};
|
|
dhx.DataStore.prototype = {
|
|
setDriver: function(a) {
|
|
dhx.assert(dhx.DataDriver[a], "incorrect DataDriver");
|
|
this.driver = dhx.DataDriver[a]
|
|
},
|
|
_parse: function(g, a) {
|
|
this.callEvent("onParse", [this.driver, g]);
|
|
if (this._filter_order) {
|
|
this.filter()
|
|
}
|
|
var h = this.driver.getInfo(g);
|
|
if (h._key) {
|
|
dhx.securityKey = h._key
|
|
}
|
|
if (h._config) {
|
|
this.callEvent("onServerConfig", [h._config])
|
|
}
|
|
var c = this.driver.getRecords(g);
|
|
this._inner_parse(h, c);
|
|
if (this._scheme_group && this._group_processing) {
|
|
this._group_processing(this._scheme_group)
|
|
}
|
|
if (this._scheme_sort) {
|
|
this.blockEvent();
|
|
this.sort(this._scheme_sort);
|
|
this.unblockEvent()
|
|
}
|
|
this.callEvent("onStoreLoad", [this.driver, g]);
|
|
this.refresh()
|
|
},
|
|
_inner_parse: function(c, n) {
|
|
var q = (c._from || 0) * 1;
|
|
var m = true;
|
|
var o = false;
|
|
if (q === 0 && this.order[0]) {
|
|
if (this._removeMissed) {
|
|
o = {};
|
|
for (var h = 0; h < this.order.length; h++) {
|
|
o[this.order[h]] = true
|
|
}
|
|
}
|
|
m = false;
|
|
q = this.order.length
|
|
}
|
|
var g = 0;
|
|
for (var h = 0; h < n.length; h++) {
|
|
var r = this.driver.getDetails(n[h]);
|
|
var a = this.id(r);
|
|
if (!this.pull[a]) {
|
|
this.order[g + q] = a;
|
|
g++
|
|
} else {
|
|
if (m && this.order[g + q]) {
|
|
g++
|
|
}
|
|
} if (this.pull[a]) {
|
|
dhx.extend(this.pull[a], r, true);
|
|
if (this._scheme_update) {
|
|
this._scheme_update(this.pull[a])
|
|
}
|
|
if (o) {
|
|
delete o[a]
|
|
}
|
|
} else {
|
|
this.pull[a] = r;
|
|
if (this._scheme_init) {
|
|
this._scheme_init(r)
|
|
}
|
|
}
|
|
}
|
|
if (o) {
|
|
this.blockEvent();
|
|
for (var l in o) {
|
|
this.remove(l)
|
|
}
|
|
this.unblockEvent()
|
|
}
|
|
if (!this.order[c._size - 1]) {
|
|
this.order[c._size - 1] = dhx.undefined
|
|
}
|
|
},
|
|
id: function(a) {
|
|
return a.id || (a.id = dhx.uid())
|
|
},
|
|
changeId: function(c, a) {
|
|
if (this.pull[c]) {
|
|
this.pull[a] = this.pull[c]
|
|
}
|
|
this.pull[a].id = a;
|
|
this.order[this.order.find(c)] = a;
|
|
if (this._filter_order) {
|
|
this._filter_order[this._filter_order.find(c)] = a
|
|
}
|
|
if (this._marks[c]) {
|
|
this._marks[a] = this._marks[c];
|
|
delete this._marks[c]
|
|
}
|
|
this.callEvent("onIdChange", [c, a]);
|
|
if (this._render_change_id) {
|
|
this._render_change_id(c, a)
|
|
}
|
|
delete this.pull[c]
|
|
},
|
|
item: function(a) {
|
|
return this.pull[a]
|
|
},
|
|
update: function(c, a) {
|
|
if (dhx.isUndefined(a)) {
|
|
a = this.item(c)
|
|
}
|
|
if (this._scheme_update) {
|
|
this._scheme_update(a)
|
|
}
|
|
if (this.callEvent("onBeforeUpdate", [c, a]) === false) {
|
|
return false
|
|
}
|
|
this.pull[c] = a;
|
|
this.callEvent("onStoreUpdated", [c, a, "update"])
|
|
},
|
|
refresh: function(a) {
|
|
if (this._skip_refresh) {
|
|
return
|
|
}
|
|
if (a) {
|
|
this.callEvent("onStoreUpdated", [a, this.pull[a], "paint"])
|
|
} else {
|
|
this.callEvent("onStoreUpdated", [null, null, null])
|
|
}
|
|
},
|
|
silent: function(c, a) {
|
|
this._skip_refresh = true;
|
|
c.call(a || this);
|
|
this._skip_refresh = false
|
|
},
|
|
getRange: function(h, g) {
|
|
if (h) {
|
|
h = this.indexById(h)
|
|
} else {
|
|
h = (this.$min || this.startOffset) || 0
|
|
} if (g) {
|
|
g = this.indexById(g)
|
|
} else {
|
|
g = Math.min(((this.$max || this.endOffset) || Infinity), (this.dataCount() - 1));
|
|
if (g < 0) {
|
|
g = 0
|
|
}
|
|
} if (h > g) {
|
|
var c = g;
|
|
g = h;
|
|
h = c
|
|
}
|
|
return this.getIndexRange(h, g)
|
|
},
|
|
getIndexRange: function(h, g) {
|
|
g = Math.min((g || Infinity), this.dataCount() - 1);
|
|
var a = dhx.toArray();
|
|
for (var c = (h || 0); c <= g; c++) {
|
|
a.push(this.item(this.order[c]))
|
|
}
|
|
return a
|
|
},
|
|
dataCount: function() {
|
|
return this.order.length
|
|
},
|
|
exists: function(a) {
|
|
return !!(this.pull[a])
|
|
},
|
|
move: function(a, h) {
|
|
dhx.assert(a >= 0 && h >= 0, "DataStore::move", "Incorrect indexes");
|
|
var g = this.idByIndex(a);
|
|
var c = this.item(g);
|
|
this.order.removeAt(a);
|
|
this.order.insertAt(g, Math.min(this.order.length, h));
|
|
this.callEvent("onStoreUpdated", [g, c, "move"])
|
|
},
|
|
scheme: function(a) {
|
|
this._scheme = {};
|
|
this._scheme_init = a.$init;
|
|
this._scheme_update = a.$update;
|
|
this._scheme_serialize = a.$serialize;
|
|
this._scheme_group = a.$group;
|
|
this._scheme_sort = a.$sort;
|
|
for (var c in a) {
|
|
if (c.substr(0, 1) != "$") {
|
|
this._scheme[c] = a[c]
|
|
}
|
|
}
|
|
},
|
|
sync: function(h, g, a) {
|
|
if (typeof h == "string") {
|
|
h = $$("source")
|
|
}
|
|
if (typeof g != "function") {
|
|
a = g;
|
|
g = null
|
|
}
|
|
if (dhx.debug_bind) {
|
|
this.debug_sync_master = h;
|
|
dhx.log("[sync] " + this.debug_bind_master.name + "@" + this.debug_bind_master._settings.id + " <= " + this.debug_sync_master.name + "@" + this.debug_sync_master._settings.id)
|
|
}
|
|
this._backbone_source = false;
|
|
if (h.name != "DataStore") {
|
|
if (h.data && h.data.name == "DataStore") {
|
|
h = h.data
|
|
} else {
|
|
this._backbone_source = true
|
|
}
|
|
}
|
|
var c = dhx.bind(function(o, l, n) {
|
|
if (this._backbone_source) {
|
|
if (!o) {
|
|
return
|
|
}
|
|
if (o.indexOf("change") === 0) {
|
|
if (o == "change") {
|
|
this.pull[l.id] = l.attributes;
|
|
this.refresh(l.id);
|
|
return
|
|
} else {
|
|
return
|
|
}
|
|
}
|
|
if (o == "reset") {
|
|
n = l
|
|
}
|
|
this.order = [];
|
|
this.pull = {};
|
|
this._filter_order = null;
|
|
for (var m = 0; m < n.models.length; m++) {
|
|
var q = n.models[m].id;
|
|
this.order.push(q);
|
|
this.pull[q] = n.models[m].attributes
|
|
}
|
|
} else {
|
|
this._filter_order = null;
|
|
this.order = dhx.toArray([].concat(h.order));
|
|
this.pull = h.pull
|
|
} if (g) {
|
|
this.silent(g)
|
|
}
|
|
if (this._on_sync) {
|
|
this._on_sync()
|
|
}
|
|
if (dhx.debug_bind) {
|
|
dhx.log("[sync:request] " + this.debug_sync_master.name + "@" + this.debug_sync_master._settings.id + " <= " + this.debug_bind_master.name + "@" + this.debug_bind_master._settings.id)
|
|
}
|
|
this.callEvent("onSyncApply", []);
|
|
if (!a) {
|
|
this.refresh()
|
|
} else {
|
|
a = false
|
|
}
|
|
}, this);
|
|
if (this._backbone_source) {
|
|
h.bind("all", c)
|
|
} else {
|
|
this._sync_events = [h.attachEvent("onStoreUpdated", c), h.attachEvent("onIdChange", dhx.bind(function(l, m) {
|
|
this.changeId(l, m)
|
|
}, this))]
|
|
}
|
|
c()
|
|
},
|
|
add: function(m, c) {
|
|
if (this._scheme) {
|
|
for (var g in this._scheme) {
|
|
if (dhx.isUndefined(m[g])) {
|
|
m[g] = this._scheme[g]
|
|
}
|
|
}
|
|
}
|
|
if (this._scheme_init) {
|
|
this._scheme_init(m)
|
|
}
|
|
var n = this.id(m);
|
|
var a = arguments[2] || this.order;
|
|
var l = a.length;
|
|
if (dhx.isUndefined(c) || c < 0) {
|
|
c = l
|
|
}
|
|
if (c > l) {
|
|
dhx.log("Warning", "DataStore:add", "Index of out of bounds");
|
|
c = Math.min(a.length, c)
|
|
}
|
|
if (this.callEvent("onBeforeAdd", [n, m, c]) === false) {
|
|
return false
|
|
}
|
|
dhx.assert(!this.exists(n), "Not unique ID");
|
|
this.pull[n] = m;
|
|
a.insertAt(n, c);
|
|
if (this._filter_order) {
|
|
var h = this._filter_order.length;
|
|
if (!c && this.order.length) {
|
|
h = 0
|
|
}
|
|
this._filter_order.insertAt(n, h)
|
|
}
|
|
this.callEvent("onAfterAdd", [n, c]);
|
|
this.callEvent("onStoreUpdated", [n, m, "add"]);
|
|
return n
|
|
},
|
|
remove: function(g) {
|
|
if (dhx.isArray(g)) {
|
|
for (var a = 0; a < g.length; a++) {
|
|
this.remove(g[a])
|
|
}
|
|
return
|
|
}
|
|
if (this.callEvent("onBeforeDelete", [g]) === false) {
|
|
return false
|
|
}
|
|
dhx.assert(this.exists(g), "Not existing ID in remove command" + g);
|
|
var c = this.item(g);
|
|
this.order.remove(g);
|
|
if (this._filter_order) {
|
|
this._filter_order.remove(g)
|
|
}
|
|
delete this.pull[g];
|
|
if (this._marks[g]) {
|
|
delete this._marks[g]
|
|
}
|
|
this.callEvent("onAfterDelete", [g]);
|
|
this.callEvent("onStoreUpdated", [g, c, "delete"])
|
|
},
|
|
clearAll: function() {
|
|
this.pull = {};
|
|
this.order = dhx.toArray();
|
|
this._filter_order = this.url = null;
|
|
this.callEvent("onClearAll", []);
|
|
this.refresh()
|
|
},
|
|
idByIndex: function(a) {
|
|
if (a >= this.order.length || a < 0) {
|
|
dhx.log("Warning", "DataStore::idByIndex Incorrect index")
|
|
}
|
|
return this.order[a]
|
|
},
|
|
indexById: function(c) {
|
|
var a = this.order.find(c);
|
|
if (!this.pull[c]) {
|
|
dhx.log("Warning", "DataStore::indexById Non-existing ID: " + c)
|
|
}
|
|
return a
|
|
},
|
|
next: function(c, a) {
|
|
return this.order[this.indexById(c) + (a || 1)]
|
|
},
|
|
first: function() {
|
|
return this.order[0]
|
|
},
|
|
last: function() {
|
|
return this.order[this.order.length - 1]
|
|
},
|
|
previous: function(c, a) {
|
|
return this.order[this.indexById(c) - (a || 1)]
|
|
},
|
|
sort: function(l, c, a) {
|
|
var g = l;
|
|
if (typeof l == "function") {
|
|
g = {
|
|
as: l,
|
|
dir: c
|
|
}
|
|
} else {
|
|
if (typeof l == "string") {
|
|
g = {
|
|
by: l.replace(/#/g, ""),
|
|
dir: c,
|
|
as: a
|
|
}
|
|
}
|
|
}
|
|
var h = [g.by, g.dir, g.as];
|
|
if (!this.callEvent("onBeforeSort", h)) {
|
|
return
|
|
}
|
|
this._sort_core(g);
|
|
this.refresh();
|
|
this.callEvent("onAfterSort", h)
|
|
},
|
|
_sort_core: function(a) {
|
|
if (this.order.length) {
|
|
var g = this._sort._create(a);
|
|
var c = this.getRange(this.first(), this.last());
|
|
c.sort(g);
|
|
this.order = c.map(function(h) {
|
|
dhx.assert(h, "Client sorting can't be used with dynamic loading");
|
|
return this.id(h)
|
|
}, this)
|
|
}
|
|
},
|
|
_filter_reset: function(a) {
|
|
if (this._filter_order && !a) {
|
|
this.order = this._filter_order;
|
|
delete this._filter_order
|
|
}
|
|
},
|
|
_filter_core: function(g, l, c) {
|
|
var h = dhx.toArray();
|
|
for (var a = 0; a < this.order.length; a++) {
|
|
var m = this.order[a];
|
|
if (g(this.item(m), l)) {
|
|
h.push(m)
|
|
}
|
|
}
|
|
if (!c || !this._filter_order) {
|
|
this._filter_order = this.order
|
|
}
|
|
this.order = h
|
|
},
|
|
filter: function(h, g, a) {
|
|
if (!this.callEvent("onBeforeFilter", [h, g])) {
|
|
return
|
|
}
|
|
this._filter_reset(a);
|
|
if (!this.order.length) {
|
|
return
|
|
}
|
|
if (h) {
|
|
var c = h;
|
|
g = g || "";
|
|
if (typeof h == "string") {
|
|
h = h.replace(/#/g, "");
|
|
if (typeof g == "function") {
|
|
c = function(l) {
|
|
return g(l[h])
|
|
}
|
|
} else {
|
|
g = g.toString().toLowerCase();
|
|
c = function(m, l) {
|
|
dhx.assert(m, "Client side filtering can't be used with dynamic loading");
|
|
return (m[h] || "").toString().toLowerCase().indexOf(l) != -1
|
|
}
|
|
}
|
|
}
|
|
this._filter_core(c, g, a, this._filterMode)
|
|
}
|
|
this.refresh();
|
|
this.callEvent("onAfterFilter", [])
|
|
},
|
|
each: function(g, c) {
|
|
for (var a = 0; a < this.order.length; a++) {
|
|
g.call((c || this), this.item(this.order[a]))
|
|
}
|
|
},
|
|
_methodPush: function(a, c) {
|
|
return function() {
|
|
return a[c].apply(a, arguments)
|
|
}
|
|
},
|
|
addMark: function(l, h, a, c) {
|
|
var g = this._marks[l] || {};
|
|
this._marks[l] = g;
|
|
if (!g[h]) {
|
|
g[h] = c || true;
|
|
if (a) {
|
|
this.item(l).$css = (this.item(l).$css || "") + " " + h;
|
|
this.refresh(l)
|
|
}
|
|
}
|
|
return g[h]
|
|
},
|
|
removeMark: function(l, h, a) {
|
|
var g = this._marks[l];
|
|
if (g && g[h]) {
|
|
delete g[h]
|
|
}
|
|
if (a) {
|
|
var c = this.item(l).$css;
|
|
if (c) {
|
|
this.item(l).$css = c.replace(h, "");
|
|
this.refresh(l)
|
|
}
|
|
}
|
|
},
|
|
hasMark: function(g, c) {
|
|
var a = this._marks[g];
|
|
return (a && a[c])
|
|
},
|
|
provideApi: function(h, c) {
|
|
this.debug_bind_master = h;
|
|
if (c) {
|
|
this.mapEvent({
|
|
onbeforesort: h,
|
|
onaftersort: h,
|
|
onbeforeadd: h,
|
|
onafteradd: h,
|
|
onbeforedelete: h,
|
|
onafterdelete: h,
|
|
onbeforeupdate: h
|
|
})
|
|
}
|
|
var g = ["sort", "add", "remove", "exists", "idByIndex", "indexById", "item", "update", "refresh", "dataCount", "filter", "next", "previous", "clearAll", "first", "last", "serialize", "sync", "addMark", "removeMark", "hasMark"];
|
|
for (var a = 0; a < g.length; a++) {
|
|
h[g[a]] = this._methodPush(this, g[a])
|
|
}
|
|
},
|
|
serialize: function() {
|
|
var h = this.order;
|
|
var a = [];
|
|
for (var c = 0; c < h.length; c++) {
|
|
var g = this.pull[h[c]];
|
|
if (this._scheme_serialize) {
|
|
g = this._scheme_serialize(g);
|
|
if (g === false) {
|
|
continue
|
|
}
|
|
}
|
|
a.push(g)
|
|
}
|
|
return a
|
|
},
|
|
_sort: {
|
|
_create: function(a) {
|
|
return this._dir(a.dir, this._by(a.by, a.as))
|
|
},
|
|
_as: {
|
|
date: function(g, c) {
|
|
g = g - 0;
|
|
c = c - 0;
|
|
return g > c ? 1 : (g < c ? -1 : 0)
|
|
},
|
|
"int": function(g, c) {
|
|
g = g * 1;
|
|
c = c * 1;
|
|
return g > c ? 1 : (g < c ? -1 : 0)
|
|
},
|
|
string_strict: function(g, c) {
|
|
g = g.toString();
|
|
c = c.toString();
|
|
return g > c ? 1 : (g < c ? -1 : 0)
|
|
},
|
|
string: function(g, c) {
|
|
if (!c) {
|
|
return 1
|
|
}
|
|
if (!g) {
|
|
return -1
|
|
}
|
|
g = g.toString().toLowerCase();
|
|
c = c.toString().toLowerCase();
|
|
return g > c ? 1 : (g < c ? -1 : 0)
|
|
}
|
|
},
|
|
_by: function(c, a) {
|
|
if (!c) {
|
|
return a
|
|
}
|
|
if (typeof a != "function") {
|
|
a = this._as[a || "string"]
|
|
}
|
|
dhx.assert(a, "Invalid sorting method");
|
|
return function(h, g) {
|
|
return a(h[c], g[c])
|
|
}
|
|
},
|
|
_dir: function(c, a) {
|
|
if (c == "asc" || !c) {
|
|
return a
|
|
}
|
|
return function(h, g) {
|
|
return a(h, g) * -1
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhx.BaseBind = {
|
|
debug_freid_ignore: {
|
|
id: true
|
|
},
|
|
bind: function(l, h, g) {
|
|
if (typeof l == "string") {
|
|
l = dhx.ui.get(l)
|
|
}
|
|
if (l._initBindSource) {
|
|
l._initBindSource()
|
|
}
|
|
if (this._initBindSource) {
|
|
this._initBindSource()
|
|
}
|
|
if (!l.getBindData) {
|
|
dhx.extend(l, dhx.BindSource)
|
|
}
|
|
if (!this._bind_ready) {
|
|
var m = this.render;
|
|
if (this.filter) {
|
|
var c = this._settings.id;
|
|
this.data._on_sync = function() {
|
|
l._bind_updated[c] = false
|
|
}
|
|
}
|
|
this.render = function() {
|
|
if (this._in_bind_processing) {
|
|
return
|
|
}
|
|
this._in_bind_processing = true;
|
|
var n = this.callEvent("onBindRequest");
|
|
this._in_bind_processing = false;
|
|
return m.apply(this, ((n === false) ? arguments : []))
|
|
};
|
|
if (this.getValue || this.getValues) {
|
|
this.save = function() {
|
|
if (this.validate && !this.validate()) {
|
|
return
|
|
}
|
|
l.setBindData((this.getValue ? this.getValue : this.getValues()), this._settings.id)
|
|
}
|
|
}
|
|
this._bind_ready = true
|
|
}
|
|
l.addBind(this._settings.id, h, g);
|
|
if (dhx.debug_bind) {
|
|
dhx.log("[bind] " + this.name + "@" + this._settings.id + " <= " + l.name + "@" + l._settings.id)
|
|
}
|
|
var a = this._settings.id;
|
|
this.attachEvent(this.touchable ? "onAfterRender" : "onBindRequest", function() {
|
|
return l.getBindData(a)
|
|
});
|
|
if (!this._settings.dataFeed && this.loadNext) {
|
|
this.data.attachEvent("onStoreLoad", function() {
|
|
l._bind_updated[a] = false
|
|
})
|
|
}
|
|
if (this.isVisible(this._settings.id)) {
|
|
this.refresh()
|
|
}
|
|
},
|
|
_unbind: function(g) {
|
|
g.removeBind(this._settings.id);
|
|
var c = (this._sync_events || (this.data ? this.data._sync_events : 0));
|
|
if (c && g.data) {
|
|
for (var a = 0; a < c.length; a++) {
|
|
g.data.detachEvent(c[a])
|
|
}
|
|
}
|
|
}
|
|
};
|
|
dhx.BindSource = {
|
|
$init: function() {
|
|
this._bind_hash = {};
|
|
this._bind_updated = {};
|
|
this._ignore_binds = {};
|
|
this._bind_specific_rules(this)
|
|
},
|
|
saveBatch: function(a) {
|
|
this._do_not_update_binds = true;
|
|
a.call(this);
|
|
this._do_not_update_binds = false;
|
|
this._update_binds()
|
|
},
|
|
setBindData: function(c, a) {
|
|
if (a) {
|
|
this._ignore_binds[a] = true
|
|
}
|
|
if (dhx.debug_bind) {
|
|
dhx.log("[bind:save] " + this.name + "@" + this._settings.id + " <= @" + a)
|
|
}
|
|
if (this.setValue) {
|
|
this.setValue(c)
|
|
} else {
|
|
if (this.setValues) {
|
|
this.setValues(c)
|
|
} else {
|
|
var g = this.getCursor();
|
|
if (g) {
|
|
c = dhx.extend(this.item(g), c, true);
|
|
this.update(g, c)
|
|
}
|
|
}
|
|
}
|
|
this.callEvent("onBindUpdate", [c, a]);
|
|
if (this.save) {
|
|
this.save()
|
|
}
|
|
if (a) {
|
|
this._ignore_binds[a] = false
|
|
}
|
|
},
|
|
getBindData: function(a, g) {
|
|
if (this._bind_updated[a]) {
|
|
return false
|
|
}
|
|
var c = dhx.ui.get(a);
|
|
if (c.isVisible(c._settings.id)) {
|
|
this._bind_updated[a] = true;
|
|
if (dhx.debug_bind) {
|
|
dhx.log("[bind:request] " + this.name + "@" + this._settings.id + " => " + c.name + "@" + c._settings.id)
|
|
}
|
|
this._bind_update(c, this._bind_hash[a][0], this._bind_hash[a][1]);
|
|
if (g && c.filter) {
|
|
c.refresh()
|
|
}
|
|
}
|
|
},
|
|
addBind: function(a, g, c) {
|
|
this._bind_hash[a] = [g, c]
|
|
},
|
|
removeBind: function(a) {
|
|
delete this._bind_hash[a];
|
|
delete this._bind_updated[a];
|
|
delete this._ignore_binds[a]
|
|
},
|
|
_bind_specific_rules: function(a) {
|
|
if (a.filter) {
|
|
dhx.extend(this, dhx.CollectionBind)
|
|
} else {
|
|
if (a.setValue) {
|
|
dhx.extend(this, dhx.ValueBind)
|
|
} else {
|
|
dhx.extend(this, dhx.RecordBind)
|
|
}
|
|
}
|
|
},
|
|
_update_binds: function() {
|
|
if (!this._do_not_update_binds) {
|
|
for (var a in this._bind_hash) {
|
|
if (this._ignore_binds[a]) {
|
|
continue
|
|
}
|
|
this._bind_updated[a] = false;
|
|
this.getBindData(a, true)
|
|
}
|
|
}
|
|
},
|
|
_bind_update_common: function(g, c, a) {
|
|
if (g.setValue) {
|
|
g.setValue(a ? a[c] : a)
|
|
} else {
|
|
if (!g.filter) {
|
|
if (!a && g.clear) {
|
|
g.clear()
|
|
} else {
|
|
if (g._check_data_feed(a)) {
|
|
g.setValues(dhx.clone(a))
|
|
}
|
|
}
|
|
} else {
|
|
g.data.silent(function() {
|
|
this.filter(c, a)
|
|
})
|
|
}
|
|
}
|
|
g.callEvent("onBindApply", [a, c, this])
|
|
}
|
|
};
|
|
dhx.DataValue = dhx.proto({
|
|
name: "DataValue",
|
|
isVisible: function() {
|
|
return true
|
|
},
|
|
$init: function(a) {
|
|
this.data = "" || a;
|
|
var c = (a && a.id) ? a.id : dhx.uid();
|
|
this._settings = {
|
|
id: c
|
|
};
|
|
dhx.ui.views[c] = this
|
|
},
|
|
setValue: function(a) {
|
|
this.data = a;
|
|
this.callEvent("onChange", [a])
|
|
},
|
|
getValue: function() {
|
|
return this.data
|
|
},
|
|
refresh: function() {
|
|
this.callEvent("onBindRequest")
|
|
}
|
|
}, dhx.EventSystem, dhx.BaseBind);
|
|
dhx.DataRecord = dhx.proto({
|
|
name: "DataRecord",
|
|
isVisible: function() {
|
|
return true
|
|
},
|
|
$init: function(a) {
|
|
this.data = a || {};
|
|
var c = (a && a.id) ? a.id : dhx.uid();
|
|
this._settings = {
|
|
id: c
|
|
};
|
|
dhx.ui.views[c] = this
|
|
},
|
|
getValues: function() {
|
|
return this.data
|
|
},
|
|
setValues: function(a) {
|
|
this.data = a;
|
|
this.callEvent("onChange", [a])
|
|
},
|
|
refresh: function() {
|
|
this.callEvent("onBindRequest")
|
|
}
|
|
}, dhx.EventSystem, dhx.BaseBind, dhx.AtomDataLoader, dhx.Settings);
|
|
dhx.DataCollection = dhx.proto({
|
|
name: "DataCollection",
|
|
isVisible: function() {
|
|
if (!this.data.order.length && !this.data._filter_order && !this._settings.dataFeed) {
|
|
return false
|
|
}
|
|
return true
|
|
},
|
|
$init: function(a) {
|
|
this.data.provideApi(this, true);
|
|
var c = (a && a.id) ? a.id : dhx.uid();
|
|
this._settings.id = c;
|
|
dhx.ui.views[c] = this;
|
|
this.data.attachEvent("onStoreLoad", dhx.bind(function() {
|
|
this.callEvent("onBindRequest", [])
|
|
}, this))
|
|
},
|
|
refresh: function() {
|
|
this.callEvent("onBindRequest", [])
|
|
}
|
|
}, dhx.DataLoader, dhx.EventSystem, dhx.BaseBind, dhx.Settings);
|
|
dhx.ValueBind = {
|
|
$init: function() {
|
|
this.attachEvent("onChange", this._update_binds)
|
|
},
|
|
_bind_update: function(l, h, g) {
|
|
var c = this.getValue() || "";
|
|
if (g) {
|
|
c = g(c)
|
|
}
|
|
if (l.setValue) {
|
|
l.setValue(c)
|
|
} else {
|
|
if (!l.filter) {
|
|
var a = {};
|
|
a[h] = c;
|
|
if (l._check_data_feed(c)) {
|
|
l.setValues(a)
|
|
}
|
|
} else {
|
|
l.data.silent(function() {
|
|
this.filter(h, c)
|
|
})
|
|
}
|
|
}
|
|
l.callEvent("onBindApply", [c, h, this])
|
|
}
|
|
};
|
|
dhx.RecordBind = {
|
|
$init: function() {
|
|
this.attachEvent("onChange", this._update_binds)
|
|
},
|
|
_bind_update: function(g, c) {
|
|
var a = this.getValues() || null;
|
|
this._bind_update_common(g, c, a)
|
|
}
|
|
};
|
|
dhx.CollectionBind = {
|
|
$init: function() {
|
|
this._cursor = null;
|
|
this.attachEvent("onSelectChange", function(c) {
|
|
var a = this.getSelected();
|
|
this.setCursor(a ? (a.id || a) : null)
|
|
});
|
|
this.attachEvent("onAfterCursorChange", this._update_binds);
|
|
this.data.attachEvent("onStoreUpdated", dhx.bind(function(g, a, c) {
|
|
if (g && g == this.getCursor() && c != "paint") {
|
|
this._update_binds()
|
|
}
|
|
}, this));
|
|
this.data.attachEvent("onClearAll", dhx.bind(function() {
|
|
this._cursor = null
|
|
}, this));
|
|
this.data.attachEvent("onIdChange", dhx.bind(function(c, a) {
|
|
if (this._cursor == c) {
|
|
this._cursor = a
|
|
}
|
|
}, this))
|
|
},
|
|
setCursor: function(a) {
|
|
if (a == this._cursor || (a !== null && !this.item(a))) {
|
|
return
|
|
}
|
|
this.callEvent("onBeforeCursorChange", [this._cursor]);
|
|
this._cursor = a;
|
|
this.callEvent("onAfterCursorChange", [a])
|
|
},
|
|
getCursor: function() {
|
|
return this._cursor
|
|
},
|
|
_bind_update: function(g, c) {
|
|
var a = this.item(this.getCursor()) || this._settings.defaultData || null;
|
|
this._bind_update_common(g, c, a)
|
|
}
|
|
};
|
|
if (!dhx.ui) {
|
|
dhx.ui = {}
|
|
}
|
|
if (!dhx.ui.views) {
|
|
dhx.ui.views = {};
|
|
dhx.ui.get = function(a) {
|
|
if (a._settings) {
|
|
return a
|
|
}
|
|
return dhx.ui.views[a]
|
|
}
|
|
}
|
|
dhtmlXDataStore = function(c) {
|
|
var g = new dhx.DataCollection(c);
|
|
var a = "_dp_init";
|
|
g[a] = function(l) {
|
|
var h = "_methods";
|
|
l[h] = ["dummy", "dummy", "changeId", "dummy"];
|
|
this.data._old_names = {
|
|
add: "inserted",
|
|
update: "updated",
|
|
"delete": "deleted"
|
|
};
|
|
this.data.attachEvent("onStoreUpdated", function(o, m, n) {
|
|
if (o && !l._silent) {
|
|
l.setUpdated(o, true, this._old_names[n])
|
|
}
|
|
});
|
|
h = "_getRowData";
|
|
l[h] = function(r, m) {
|
|
var o = this.obj.data.item(r);
|
|
var q = {
|
|
id: r
|
|
};
|
|
q[this.action_param] = this.obj.getUserData(r);
|
|
if (o) {
|
|
for (var n in o) {
|
|
q[n] = o[n]
|
|
}
|
|
}
|
|
return q
|
|
};
|
|
this.changeId = function(n, m) {
|
|
this.data.changeId(n, m);
|
|
l._silent = true;
|
|
this.data.callEvent("onStoreUpdated", [m, this.item(m), "update"]);
|
|
l._silent = false
|
|
};
|
|
h = "_clearUpdateFlag";
|
|
l[h] = function() {};
|
|
this._userdata = {}
|
|
};
|
|
g.dummy = function() {};
|
|
g.setUserData = function(m, h, l) {
|
|
this._userdata[m] = l
|
|
};
|
|
g.getUserData = function(l, h) {
|
|
return this._userdata[l]
|
|
};
|
|
g.dataFeed = function(h) {
|
|
this.define("dataFeed", h)
|
|
};
|
|
dhx.extend(g, dhx.BindSource);
|
|
return g
|
|
};
|
|
if (window.dhtmlXDataView) {
|
|
dhtmlXDataView.prototype._initBindSource = function() {
|
|
this.isVisible = function() {
|
|
if (!this.data.order.length && !this.data._filter_order && !this._settings.dataFeed) {
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
var a = "_settings";
|
|
this._settings = this._settings || this[a];
|
|
if (!this._settings.id) {
|
|
this._settings.id = dhx.uid()
|
|
}
|
|
this.unbind = dhx.BaseBind.unbind;
|
|
this.unsync = dhx.BaseBind.unsync;
|
|
dhx.ui.views[this._settings.id] = this
|
|
}
|
|
}
|
|
if (window.dhtmlXChart) {
|
|
dhtmlXChart.prototype._initBindSource = function() {
|
|
this.isVisible = function() {
|
|
if (!this.data.order.length && !this.data._filtered_state && !this._settings.dataFeed) {
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
var a = "_settings";
|
|
this._settings = this._settings || this[a];
|
|
if (!this._settings.id) {
|
|
this._settings.id = dhx.uid()
|
|
}
|
|
this.unbind = dhx.BaseBind.unbind;
|
|
this.unsync = dhx.BaseBind.unsync;
|
|
dhx.ui.views[this._settings.id] = this
|
|
}
|
|
}
|
|
dhx.BaseBind.unsync = function(a) {
|
|
return dhx.BaseBind._unbind.call(this, a)
|
|
};
|
|
dhx.BaseBind.unbind = function(a) {
|
|
return dhx.BaseBind._unbind.call(this, a)
|
|
};
|
|
dhx.BaseBind.legacyBind = function() {
|
|
return dhx.BaseBind.bind.apply(this, arguments)
|
|
};
|
|
dhx.BaseBind.legacySync = function(a, c) {
|
|
if (this._initBindSource) {
|
|
this._initBindSource()
|
|
}
|
|
if (a._initBindSource) {
|
|
a._initBindSource()
|
|
}
|
|
this.attachEvent("onAfterEditStop", function(g) {
|
|
this.save(g);
|
|
return true
|
|
});
|
|
this.attachEvent("onDataRequest", function(l, h) {
|
|
for (var g = l; g < l + h; g++) {
|
|
if (!a.data.order[g]) {
|
|
a.loadNext(h, l);
|
|
return false
|
|
}
|
|
}
|
|
});
|
|
this.save = function(m) {
|
|
if (!m) {
|
|
m = this.getCursor()
|
|
}
|
|
var l = this.item(m);
|
|
var g = a.item(m);
|
|
for (var h in l) {
|
|
if (h.indexOf("$") !== 0) {
|
|
g[h] = l[h]
|
|
}
|
|
}
|
|
a.refresh(m)
|
|
};
|
|
if (a && a.name == "DataCollection") {
|
|
return a.data.sync.apply(this.data, arguments)
|
|
} else {
|
|
return this.data.sync.apply(this.data, arguments)
|
|
}
|
|
};
|
|
if (window.dhtmlXForm) {
|
|
dhtmlXForm.prototype.bind = function(a) {
|
|
dhx.BaseBind.bind.apply(this, arguments);
|
|
a.getBindData(this._settings.id)
|
|
};
|
|
dhtmlXForm.prototype.unbind = function(a) {
|
|
dhx.BaseBind._unbind.call(this, a)
|
|
};
|
|
dhtmlXForm.prototype._initBindSource = function() {
|
|
if (dhx.isUndefined(this._settings)) {
|
|
this._settings = {
|
|
id: dhx.uid(),
|
|
dataFeed: this._server_feed
|
|
};
|
|
dhx.ui.views[this._settings.id] = this
|
|
}
|
|
};
|
|
dhtmlXForm.prototype._check_data_feed = function(c) {
|
|
if (!this._settings.dataFeed || this._ignore_feed || !c) {
|
|
return true
|
|
}
|
|
var a = this._settings.dataFeed;
|
|
if (typeof a == "function") {
|
|
return a.call(this, (c.id || c), c)
|
|
}
|
|
a = a + (a.indexOf("?") == -1 ? "?" : "&") + "action=get&id=" + encodeURIComponent(c.id || c);
|
|
this.load(a);
|
|
return false
|
|
};
|
|
dhtmlXForm.prototype.setValues = dhtmlXForm.prototype.setFormData;
|
|
dhtmlXForm.prototype.getValues = function() {
|
|
return this.getFormData(false, true)
|
|
};
|
|
dhtmlXForm.prototype.dataFeed = function(a) {
|
|
if (this._settings) {
|
|
this._settings.dataFeed = a
|
|
} else {
|
|
this._server_feed = a
|
|
}
|
|
};
|
|
dhtmlXForm.prototype.refresh = dhtmlXForm.prototype.isVisible = function(a) {
|
|
return true
|
|
}
|
|
}
|
|
if (window.scheduler) {
|
|
if (!window.Scheduler) {
|
|
window.Scheduler = {}
|
|
}
|
|
Scheduler.$syncFactory = function(a) {
|
|
a.sync = function(g, l) {
|
|
if (this._initBindSource) {
|
|
this._initBindSource()
|
|
}
|
|
if (g._initBindSource) {
|
|
g._initBindSource()
|
|
}
|
|
var h = "_process_loading";
|
|
var c = function(r) {
|
|
a.clearAll();
|
|
var m = g.data.order;
|
|
var q = g.data.pull;
|
|
var n = [];
|
|
for (var o = 0; o < m.length; o++) {
|
|
if (l && l.copy) {
|
|
n[o] = dhx.clone(q[m[o]])
|
|
} else {
|
|
n[o] = q[m[o]]
|
|
}
|
|
}
|
|
a[h](n)
|
|
};
|
|
this.save = function(o) {
|
|
if (!o) {
|
|
o = this.getCursor()
|
|
}
|
|
var n = this.item(o);
|
|
var m = g.item(o);
|
|
if (this.callEvent("onStoreSave", [o, n, m])) {
|
|
dhx.extend(g.item(o), n, true);
|
|
g.update(o)
|
|
}
|
|
};
|
|
this.item = function(m) {
|
|
return this.getEvent(m)
|
|
};
|
|
this._sync_events = [g.data.attachEvent("onStoreUpdated", function(o, m, n) {
|
|
c.call(this)
|
|
}), g.data.attachEvent("onIdChange", function(n, m) {
|
|
combo.changeOptionId(n, m)
|
|
})];
|
|
this.attachEvent("onEventChanged", function(m) {
|
|
this.save(m)
|
|
});
|
|
this.attachEvent("onEventAdded", function(n, m) {
|
|
if (!g.data.pull[n]) {
|
|
g.add(m)
|
|
}
|
|
});
|
|
this.attachEvent("onEventDeleted", function(m) {
|
|
if (g.data.pull[m]) {
|
|
g.remove(m)
|
|
}
|
|
});
|
|
c()
|
|
};
|
|
a.unsync = function(c) {
|
|
dhx.BaseBind._unbind.call(this, c)
|
|
};
|
|
a._initBindSource = function() {
|
|
if (!this._settings) {
|
|
this._settings = {
|
|
id: dhx.uid()
|
|
}
|
|
}
|
|
}
|
|
};
|
|
Scheduler.$syncFactory(window.scheduler)
|
|
}
|
|
if (window.dhtmlXCombo) {
|
|
dhtmlXCombo.prototype.bind = function() {
|
|
dhx.BaseBind.bind.apply(this, arguments)
|
|
};
|
|
dhtmlXCombo.unbind = function(a) {
|
|
dhx.BaseBind._unbind.call(this, a)
|
|
};
|
|
dhtmlXCombo.unsync = function(a) {
|
|
dhx.BaseBind._unbind.call(this, a)
|
|
};
|
|
dhtmlXCombo.prototype.dataFeed = function(a) {
|
|
if (this._settings) {
|
|
this._settings.dataFeed = a
|
|
} else {
|
|
this._server_feed = a
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.sync = function(c, h) {
|
|
if (this._initBindSource) {
|
|
this._initBindSource()
|
|
}
|
|
if (c._initBindSource) {
|
|
c._initBindSource()
|
|
}
|
|
var g = this;
|
|
var a = function(l) {
|
|
g.clearAll();
|
|
g.addOption(this.serialize())
|
|
};
|
|
this._sync_events = [c.data.attachEvent("onStoreUpdated", function(n, l, m) {
|
|
a.call(this)
|
|
}), c.data.attachEvent("onIdChange", function(m, l) {
|
|
g.changeOptionId(m, l)
|
|
})];
|
|
a.call(c)
|
|
};
|
|
dhtmlXCombo.prototype._initBindSource = function() {
|
|
if (dhx.isUndefined(this._settings)) {
|
|
this._settings = {
|
|
id: dhx.uid(),
|
|
dataFeed: this._server_feed
|
|
};
|
|
dhx.ui.views[this._settings.id] = this;
|
|
this.data = {
|
|
silent: dhx.bind(function(a) {
|
|
a.call(this)
|
|
}, this)
|
|
};
|
|
dhtmlxEventable(this.data);
|
|
this.attachEvent("onChange", function() {
|
|
this.callEvent("onSelectChange", [this.getSelectedValue()])
|
|
});
|
|
this.attachEvent("onXLE", function() {
|
|
this.callEvent("onBindRequest", [])
|
|
})
|
|
}
|
|
};
|
|
dhtmlXCombo.prototype.item = function(a) {
|
|
return this.getOption(a)
|
|
};
|
|
dhtmlXCombo.prototype.getSelected = function() {
|
|
return this.getSelectedValue()
|
|
};
|
|
dhtmlXCombo.prototype.isVisible = function() {
|
|
if (!this.optionsArr.length && !this._settings.dataFeed) {
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXCombo.prototype.refresh = function() {
|
|
this.render(true)
|
|
};
|
|
dhtmlXCombo.prototype.filter = function(c, a) {
|
|
alert("not implemented")
|
|
}
|
|
}
|
|
if (window.dhtmlXGridObject) {
|
|
dhtmlXGridObject.prototype.bind = function(a, g, c) {
|
|
dhx.BaseBind.bind.apply(this, arguments)
|
|
};
|
|
dhtmlXGridObject.prototype.unbind = function(a) {
|
|
dhx.BaseBind._unbind.call(this, a)
|
|
};
|
|
dhtmlXGridObject.prototype.unsync = function(a) {
|
|
dhx.BaseBind._unbind.call(this, a)
|
|
};
|
|
dhtmlXGridObject.prototype.dataFeed = function(a) {
|
|
if (this._settings) {
|
|
this._settings.dataFeed = a
|
|
} else {
|
|
this._server_feed = a
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.sync = function(a, q) {
|
|
if (this._initBindSource) {
|
|
this._initBindSource()
|
|
}
|
|
if (a._initBindSource) {
|
|
a._initBindSource()
|
|
}
|
|
var c = this;
|
|
var o = "_parsing";
|
|
var g = "_parser";
|
|
var m = "_locator";
|
|
var h = "_process_store_row";
|
|
var n = "_get_store_data";
|
|
this.save = function(r) {
|
|
if (!r) {
|
|
r = this.getCursor()
|
|
}
|
|
dhx.extend(a.item(r), this.item(r), true);
|
|
a.update(r)
|
|
};
|
|
var l = function(x) {
|
|
var u = c.getCursor ? c.getCursor() : null;
|
|
var w = 0;
|
|
if (c._legacy_ignore_next) {
|
|
w = c._legacy_ignore_next;
|
|
c._legacy_ignore_next = false
|
|
} else {
|
|
c.clearAll()
|
|
}
|
|
var s = this.dataCount();
|
|
if (s) {
|
|
c[o] = true;
|
|
for (var r = w; r < s; r++) {
|
|
var v = this.order[r];
|
|
if (!v) {
|
|
continue
|
|
}
|
|
if (w && c.rowsBuffer[r]) {
|
|
continue
|
|
}
|
|
c.rowsBuffer[r] = {
|
|
idd: v,
|
|
data: this.pull[v]
|
|
};
|
|
c.rowsBuffer[r][g] = c[h];
|
|
c.rowsBuffer[r][m] = c[n];
|
|
c.rowsAr[v] = this.pull[v]
|
|
}
|
|
if (!c.rowsBuffer[s - 1]) {
|
|
c.rowsBuffer[s - 1] = dhtmlx.undefined;
|
|
c.xmlFileUrl = c.xmlFileUrl || this.url
|
|
}
|
|
if (c.pagingOn) {
|
|
c.changePage()
|
|
} else {
|
|
if (c._srnd && c._fillers) {
|
|
c._update_srnd_view()
|
|
} else {
|
|
c.render_dataset();
|
|
c.callEvent("onXLE", [])
|
|
}
|
|
}
|
|
c[o] = false
|
|
}
|
|
if (u && c.setCursor) {
|
|
c.setCursor(c.rowsAr[u] ? u : null)
|
|
}
|
|
};
|
|
this._sync_events = [a.data.attachEvent("onStoreUpdated", function(u, r, s) {
|
|
if (s == "delete") {
|
|
c.deleteRow(u);
|
|
c.data.callEvent("onStoreUpdated", [u, r, s])
|
|
} else {
|
|
if (s == "update") {
|
|
c.callEvent("onSyncUpdate", [r, s]);
|
|
c.update(u, r);
|
|
c.data.callEvent("onStoreUpdated", [u, r, s])
|
|
} else {
|
|
if (s == "add") {
|
|
c.callEvent("onSyncUpdate", [r, s]);
|
|
c.add(u, r, this.indexById(u));
|
|
c.data.callEvent("onStoreUpdated", [u, r, s])
|
|
} else {
|
|
l.call(this)
|
|
}
|
|
}
|
|
}
|
|
}), a.data.attachEvent("onStoreLoad", function(s, r) {
|
|
c.xmlFileUrl = a.data.url;
|
|
c._legacy_ignore_next = s.getInfo(r)._from
|
|
}), a.data.attachEvent("onIdChange", function(s, r) {
|
|
c.changeRowId(s, r)
|
|
})];
|
|
c.attachEvent("onDynXLS", function(u, s) {
|
|
for (var r = u; r < u + s; r++) {
|
|
if (!a.data.order[r]) {
|
|
a.loadNext(s, u);
|
|
return false
|
|
}
|
|
}
|
|
c._legacy_ignore_next = u;
|
|
l.call(a.data)
|
|
});
|
|
l.call(a.data);
|
|
c.attachEvent("onEditCell", function(r, w, u, s, v) {
|
|
if (r == 2 && s != v) {
|
|
this.save(w)
|
|
}
|
|
return true
|
|
});
|
|
c.attachEvent("onClearAll", function() {
|
|
var r = "_f_rowsBuffer";
|
|
this[r] = null
|
|
});
|
|
if (q && q.sort) {
|
|
c.attachEvent("onBeforeSorting", function(u, s, r) {
|
|
if (s == "connector") {
|
|
return false
|
|
}
|
|
var v = this.getColumnId(u);
|
|
a.sort("#" + v + "#", (r == "asc" ? "asc" : "desc"), (s == "int" ? s : "string"));
|
|
c.setSortImgState(true, u, r);
|
|
return false
|
|
})
|
|
}
|
|
if (q && q.filter) {
|
|
c.attachEvent("onFilterStart", function(u, r) {
|
|
var s = "_con_f_used";
|
|
if (c[s] && c[s].length) {
|
|
return false
|
|
}
|
|
a.data.silent(function() {
|
|
a.filter();
|
|
for (var v = 0; v < u.length; v++) {
|
|
if (r[v] == "") {
|
|
continue
|
|
}
|
|
var w = c.getColumnId(u[v]);
|
|
a.filter("#" + w + "#", r[v], v != 0)
|
|
}
|
|
});
|
|
a.refresh();
|
|
return false
|
|
});
|
|
c.collectValues = function(r) {
|
|
var s = this.getColumnId(r);
|
|
return (function(w) {
|
|
var u = [];
|
|
var v = {};
|
|
this.data.each(function(y) {
|
|
var x = y[w];
|
|
if (!v[x]) {
|
|
v[x] = true;
|
|
u.push(x)
|
|
}
|
|
});
|
|
u.sort();
|
|
return u
|
|
}).call(a, s)
|
|
}
|
|
}
|
|
if (q && q.select) {
|
|
c.attachEvent("onRowSelect", function(r) {
|
|
a.setCursor(r)
|
|
})
|
|
}
|
|
c.clearAndLoad = function(r) {
|
|
a.clearAll();
|
|
a.load(r)
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype._initBindSource = function() {
|
|
if (dhx.isUndefined(this._settings)) {
|
|
this._settings = {
|
|
id: dhx.uid(),
|
|
dataFeed: this._server_feed
|
|
};
|
|
dhx.ui.views[this._settings.id] = this;
|
|
this.data = {
|
|
silent: dhx.bind(function(g) {
|
|
g.call(this)
|
|
}, this)
|
|
};
|
|
dhtmlxEventable(this.data);
|
|
var a = "_cCount";
|
|
for (var c = 0; c < this[a]; c++) {
|
|
if (!this.columnIds[c]) {
|
|
this.columnIds[c] = "cell" + c
|
|
}
|
|
}
|
|
this.attachEvent("onSelectStateChanged", function(g) {
|
|
this.callEvent("onSelectChange", [g])
|
|
});
|
|
this.attachEvent("onSelectionCleared", function() {
|
|
this.callEvent("onSelectChange", [null])
|
|
});
|
|
this.attachEvent("onEditCell", function(g, h) {
|
|
if (g === 2 && this.getCursor) {
|
|
if (h && h == this.getCursor()) {
|
|
this._update_binds()
|
|
}
|
|
}
|
|
return true
|
|
});
|
|
this.attachEvent("onXLE", function() {
|
|
this.callEvent("onBindRequest", [])
|
|
})
|
|
}
|
|
};
|
|
dhtmlXGridObject.prototype.item = function(m) {
|
|
if (m === null) {
|
|
return null
|
|
}
|
|
var l = this.getRowById(m);
|
|
if (!l) {
|
|
return null
|
|
}
|
|
var a = "_attrs";
|
|
var h = dhx.copy(l[a]);
|
|
h.id = m;
|
|
var g = this.getColumnsNum();
|
|
for (var c = 0; c < g; c++) {
|
|
h[this.columnIds[c]] = this.cells(m, c).getValue()
|
|
}
|
|
return h
|
|
};
|
|
dhtmlXGridObject.prototype.update = function(m, l) {
|
|
for (var h = 0; h < this.columnIds.length; h++) {
|
|
var g = this.columnIds[h];
|
|
if (!dhx.isUndefined(l[g])) {
|
|
this.cells(m, h).setValue(l[g])
|
|
}
|
|
}
|
|
var c = "_attrs";
|
|
var a = this.getRowById(m)[c];
|
|
for (var g in l) {
|
|
a[g] = l[g]
|
|
}
|
|
this.callEvent("onBindUpdate", [m])
|
|
};
|
|
dhtmlXGridObject.prototype.add = function(n, m, g) {
|
|
var a = [];
|
|
for (var l = 0; l < this.columnIds.length; l++) {
|
|
var h = this.columnIds[l];
|
|
a[l] = dhx.isUndefined(m[h]) ? "" : m[h]
|
|
}
|
|
this.addRow(n, a, g);
|
|
var c = "_attrs";
|
|
this.getRowById(n)[c] = dhx.copy(m)
|
|
};
|
|
dhtmlXGridObject.prototype.getSelected = function() {
|
|
return this.getSelectedRowId()
|
|
};
|
|
dhtmlXGridObject.prototype.isVisible = function() {
|
|
var a = "_f_rowsBuffer";
|
|
if (!this.rowsBuffer.length && !this[a] && !this._settings.dataFeed) {
|
|
return false
|
|
}
|
|
return true
|
|
};
|
|
dhtmlXGridObject.prototype.refresh = function() {
|
|
this.render_dataset()
|
|
};
|
|
dhtmlXGridObject.prototype.filter = function(m, l) {
|
|
if (this._settings.dataFeed) {
|
|
var h = {};
|
|
if (!m && !l) {
|
|
return
|
|
}
|
|
if (typeof m == "function") {
|
|
if (!l) {
|
|
return
|
|
}
|
|
m(l, h)
|
|
} else {
|
|
if (dhx.isUndefined(m)) {
|
|
h = l
|
|
} else {
|
|
h[m] = l
|
|
}
|
|
}
|
|
this.clearAll();
|
|
var a = this._settings.dataFeed;
|
|
if (typeof a == "function") {
|
|
return a.call(this, l, h)
|
|
}
|
|
var g = [];
|
|
for (var c in h) {
|
|
g.push("dhx_filter[" + c + "]=" + encodeURIComponent(h[c]))
|
|
}
|
|
this.load(a + (a.indexOf("?") < 0 ? "?" : "&") + g.join("&"));
|
|
return false
|
|
}
|
|
if (l === null) {
|
|
return this.filterBy(0, function() {
|
|
return false
|
|
})
|
|
}
|
|
this.filterBy(0, function(n, o) {
|
|
return m.call(this, o, l)
|
|
})
|
|
}
|
|
}
|
|
if (window.dhtmlXTreeObject) {
|
|
dhtmlXTreeObject.prototype.bind = function() {
|
|
dhx.BaseBind.bind.apply(this, arguments)
|
|
};
|
|
dhtmlXTreeObject.prototype.unbind = function(a) {
|
|
dhx.BaseBind._unbind.call(this, a)
|
|
};
|
|
dhtmlXTreeObject.prototype.dataFeed = function(a) {
|
|
if (this._settings) {
|
|
this._settings.dataFeed = a
|
|
} else {
|
|
this._server_feed = a
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype._initBindSource = function() {
|
|
if (dhx.isUndefined(this._settings)) {
|
|
this._settings = {
|
|
id: dhx.uid(),
|
|
dataFeed: this._server_feed
|
|
};
|
|
dhx.ui.views[this._settings.id] = this;
|
|
this.data = {
|
|
silent: dhx.bind(function(a) {
|
|
a.call(this)
|
|
}, this)
|
|
};
|
|
dhtmlxEventable(this.data);
|
|
this.attachEvent("onSelect", function(a) {
|
|
this.callEvent("onSelectChange", [a])
|
|
});
|
|
this.attachEvent("onEdit", function(a, c) {
|
|
if (a === 2) {
|
|
if (c && c == this.getCursor()) {
|
|
this._update_binds()
|
|
}
|
|
}
|
|
return true
|
|
})
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.item = function(a) {
|
|
if (a === null) {
|
|
return null
|
|
}
|
|
return {
|
|
id: a,
|
|
text: this.getItemText(a)
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.getSelected = function() {
|
|
return this.getSelectedItemId()
|
|
};
|
|
dhtmlXTreeObject.prototype.isVisible = function() {
|
|
return true
|
|
};
|
|
dhtmlXTreeObject.prototype.refresh = function() {};
|
|
dhtmlXTreeObject.prototype.filter = function(m, l) {
|
|
if (this._settings.dataFeed) {
|
|
var h = {};
|
|
if (!m && !l) {
|
|
return
|
|
}
|
|
if (typeof m == "function") {
|
|
if (!l) {
|
|
return
|
|
}
|
|
m(l, h)
|
|
} else {
|
|
if (dhx.isUndefined(m)) {
|
|
h = l
|
|
} else {
|
|
h[m] = l
|
|
}
|
|
}
|
|
this.deleteChildItems(0);
|
|
var a = this._settings.dataFeed;
|
|
if (typeof a == "function") {
|
|
return a.call(this, [(data.id || data), data])
|
|
}
|
|
var g = [];
|
|
for (var c in h) {
|
|
g.push("dhx_filter[" + c + "]=" + encodeURIComponent(h[c]))
|
|
}
|
|
this.loadXML(a + (a.indexOf("?") < 0 ? "?" : "&") + g.join("&"));
|
|
return false
|
|
}
|
|
};
|
|
dhtmlXTreeObject.prototype.update = function(c, a) {
|
|
if (!dhx.isUndefined(a.text)) {
|
|
this.setItemText(c, a.text)
|
|
}
|
|
}
|
|
}
|
|
if (!window.dhtmlx) {
|
|
window.dhtmlx = {}
|
|
}(function() {
|
|
var r = null;
|
|
|
|
function u(A, x) {
|
|
var y = A.callback;
|
|
s(false);
|
|
A.box.parentNode.removeChild(A.box);
|
|
r = A.box = null;
|
|
if (y) {
|
|
y(x)
|
|
}
|
|
}
|
|
|
|
function a(y) {
|
|
if (r) {
|
|
y = y || event;
|
|
var x = y.which || event.keyCode;
|
|
if (dhtmlx.message.keyboard) {
|
|
if (x == 13 || x == 32) {
|
|
u(r, true)
|
|
}
|
|
if (x == 27) {
|
|
u(r, false)
|
|
}
|
|
}
|
|
if (y.preventDefault) {
|
|
y.preventDefault()
|
|
}
|
|
return !(y.cancelBubble = true)
|
|
}
|
|
}
|
|
if (document.attachEvent) {
|
|
document.attachEvent("onkeydown", a)
|
|
} else {
|
|
document.addEventListener("keydown", a, true)
|
|
}
|
|
|
|
function s(y) {
|
|
if (!s.cover) {
|
|
s.cover = document.createElement("DIV");
|
|
s.cover.onkeydown = a;
|
|
s.cover.className = "dhx_modal_cover";
|
|
document.body.appendChild(s.cover)
|
|
}
|
|
var x = document.body.scrollHeight;
|
|
s.cover.style.display = y ? "inline-block" : "none"
|
|
}
|
|
|
|
function m(y, x) {
|
|
return "<div class='dhtmlx_popup_button' result='" + x + "' ><div>" + y + "</div></div>"
|
|
}
|
|
|
|
function g(y) {
|
|
if (!v.area) {
|
|
v.area = document.createElement("DIV");
|
|
v.area.className = "dhtmlx_message_area";
|
|
v.area.style[v.position] = "5px";
|
|
document.body.appendChild(v.area)
|
|
}
|
|
v.hide(y.id);
|
|
var x = document.createElement("DIV");
|
|
x.innerHTML = "<div>" + y.text + "</div>";
|
|
x.className = "dhtmlx-info dhtmlx-" + y.type;
|
|
x.onclick = function() {
|
|
v.hide(y.id);
|
|
y = null
|
|
};
|
|
if (v.position == "bottom" && v.area.firstChild) {
|
|
v.area.insertBefore(x, v.area.firstChild)
|
|
} else {
|
|
v.area.appendChild(x)
|
|
} if (y.expire > 0) {
|
|
v.timers[y.id] = window.setTimeout(function() {
|
|
v.hide(y.id)
|
|
}, y.expire)
|
|
}
|
|
v.pull[y.id] = x;
|
|
x = null;
|
|
return y.id
|
|
}
|
|
|
|
function n(y, C, F) {
|
|
var E = document.createElement("DIV");
|
|
E.className = " dhtmlx_modal_box dhtmlx-" + y.type;
|
|
E.setAttribute("dhxbox", 1);
|
|
var x = "";
|
|
if (y.width) {
|
|
E.style.width = y.width
|
|
}
|
|
if (y.height) {
|
|
E.style.height = y.height
|
|
}
|
|
if (y.title) {
|
|
x += '<div class="dhtmlx_popup_title">' + y.title + "</div>"
|
|
}
|
|
x += '<div class="dhtmlx_popup_text"><span>' + (y.content ? "" : y.text) + '</span></div><div class="dhtmlx_popup_controls">';
|
|
if (C) {
|
|
x += m(y.ok || "OK", true)
|
|
}
|
|
if (F) {
|
|
x += m(y.cancel || "Cancel", false)
|
|
}
|
|
if (y.buttons) {
|
|
for (var A = 0; A < y.buttons.length; A++) {
|
|
x += m(y.buttons[A], A)
|
|
}
|
|
}
|
|
x += "</div>";
|
|
E.innerHTML = x;
|
|
if (y.content) {
|
|
var D = y.content;
|
|
if (typeof D == "string") {
|
|
D = document.getElementById(D)
|
|
}
|
|
if (D.style.display == "none") {
|
|
D.style.display = ""
|
|
}
|
|
E.childNodes[y.title ? 1 : 0].appendChild(D)
|
|
}
|
|
E.onclick = function(J) {
|
|
J = J || event;
|
|
var I = J.target || J.srcElement;
|
|
if (!I.className) {
|
|
I = I.parentNode
|
|
}
|
|
if (I.className == "dhtmlx_popup_button") {
|
|
var H = I.getAttribute("result");
|
|
H = (H == "true") || (H == "false" ? false : H);
|
|
u(y, H)
|
|
}
|
|
};
|
|
y.box = E;
|
|
if (C || F) {
|
|
r = y
|
|
}
|
|
return E
|
|
}
|
|
|
|
function w(C, D, F) {
|
|
var E = C.tagName ? C : n(C, D, F);
|
|
if (!C.hidden) {
|
|
s(true)
|
|
}
|
|
document.body.appendChild(E);
|
|
var A = C.left || Math.abs(Math.floor(((window.innerWidth || document.documentElement.offsetWidth) - E.offsetWidth) / 2));
|
|
var H = C.top || Math.abs(Math.floor(((window.innerHeight || document.documentElement.offsetHeight) - E.offsetHeight) / 2));
|
|
if (C.position == "top") {
|
|
E.style.top = "-3px"
|
|
} else {
|
|
E.style.top = H + "px"
|
|
}
|
|
E.style.left = A + "px";
|
|
E.onkeydown = a;
|
|
E.focus();
|
|
if (C.hidden) {
|
|
dhtmlx.modalbox.hide(E)
|
|
}
|
|
return E
|
|
}
|
|
|
|
function q(x) {
|
|
return w(x, true, false)
|
|
}
|
|
|
|
function c(x) {
|
|
return w(x, true, true)
|
|
}
|
|
|
|
function l(x) {
|
|
return w(x)
|
|
}
|
|
|
|
function o(y, x, A) {
|
|
if (typeof y != "object") {
|
|
if (typeof x == "function") {
|
|
A = x;
|
|
x = ""
|
|
}
|
|
y = {
|
|
text: y,
|
|
type: x,
|
|
callback: A
|
|
}
|
|
}
|
|
return y
|
|
}
|
|
|
|
function h(A, y, x, C) {
|
|
if (typeof A != "object") {
|
|
A = {
|
|
text: A,
|
|
type: y,
|
|
expire: x,
|
|
id: C
|
|
}
|
|
}
|
|
A.id = A.id || v.uid();
|
|
A.expire = A.expire || v.expire;
|
|
return A
|
|
}
|
|
dhtmlx.alert = function() {
|
|
var x = o.apply(this, arguments);
|
|
x.type = x.type || "confirm";
|
|
return q(x)
|
|
};
|
|
dhtmlx.confirm = function() {
|
|
var x = o.apply(this, arguments);
|
|
x.type = x.type || "alert";
|
|
return c(x)
|
|
};
|
|
dhtmlx.modalbox = function() {
|
|
var x = o.apply(this, arguments);
|
|
x.type = x.type || "alert";
|
|
return l(x)
|
|
};
|
|
dhtmlx.modalbox.hide = function(x) {
|
|
while (x && x.getAttribute && !x.getAttribute("dhxbox")) {
|
|
x = x.parentNode
|
|
}
|
|
if (x) {
|
|
x.parentNode.removeChild(x);
|
|
s(false)
|
|
}
|
|
};
|
|
var v = dhtmlx.message = function(C, A, y, D) {
|
|
C = h.apply(this, arguments);
|
|
C.type = C.type || "info";
|
|
var x = C.type.split("-")[0];
|
|
switch (x) {
|
|
case "alert":
|
|
return q(C);
|
|
case "confirm":
|
|
return c(C);
|
|
case "modalbox":
|
|
return l(C);
|
|
default:
|
|
return g(C);
|
|
break
|
|
}
|
|
};
|
|
v.seed = (new Date()).valueOf();
|
|
v.uid = function() {
|
|
return v.seed++
|
|
};
|
|
v.expire = 4000;
|
|
v.keyboard = true;
|
|
v.position = "top";
|
|
v.pull = {};
|
|
v.timers = {};
|
|
v.hideAll = function() {
|
|
for (var x in v.pull) {
|
|
v.hide(x)
|
|
}
|
|
};
|
|
v.hide = function(y) {
|
|
var x = v.pull[y];
|
|
if (x && x.parentNode) {
|
|
window.setTimeout(function() {
|
|
x.parentNode.removeChild(x);
|
|
x = null
|
|
}, 2000);
|
|
x.className += " hidden";
|
|
if (v.timers[y]) {
|
|
window.clearTimeout(v.timers[y])
|
|
}
|
|
delete v.pull[y]
|
|
}
|
|
}
|
|
})();
|