dhxmvp
Version:
A complete boilerplate for building online, offline and syncable MVP Single Page Applications using DHTMLX.
1,372 lines (1,371 loc) • 2.2 MB
JavaScript
/*
Product Name: dhtmlxSuite
Version: 5.0
Edition: Standard
License: content of this file is covered by GPL. Usage outside GPL terms is prohibited. To obtain Commercial or Enterprise license contact sales@dhtmlx.com
Copyright UAB Dinamenta http://www.dhtmlx.com
*/
if (typeof(window.dhx) == "undefined") {
window.dhx = window.dhx4 = {
version: "5.0",
skin: null,
skinDetect: function(a) {
return {
10: "dhx_skyblue",
20: "dhx_web",
30: "dhx_terrace",
40: "material"
}[this.readFromCss(a + "_skin_detect")] || null
},
readFromCss: function(e, g, h) {
var c = document.createElement("DIV");
c.className = e;
if (document.body.firstChild != null) {
document.body.insertBefore(c, document.body.firstChild)
} else {
document.body.appendChild(c)
}
if (typeof(h) == "string") {
c.innerHTML = h
}
var a = c[g || "offsetWidth"];
c.parentNode.removeChild(c);
c = null;
return a
},
lastId: 1,
newId: function() {
return this.lastId++
},
zim: {
data: {},
step: 5,
first: function() {
return 100
},
last: function() {
var e = this.first();
for (var c in this.data) {
e = Math.max(e, this.data[c])
}
return e
},
reserve: function(a) {
this.data[a] = this.last() + this.step;
return this.data[a]
},
clear: function(a) {
if (this.data[a] != null) {
this.data[a] = null;
delete this.data[a]
}
}
},
s2b: function(a) {
if (typeof(a) == "string") {
a = a.toLowerCase()
}
return (a == true || a == 1 || a == "true" || a == "1" || a == "yes" || a == "y" || a == "on")
},
s2j: function(s) {
var obj = null;
dhx4.temp = null;
try {
eval("dhx4.temp=" + s)
} catch (e) {
dhx4.temp = null
}
obj = dhx4.temp;
dhx4.temp = null;
return obj
},
absLeft: function(a) {
if (typeof(a) == "string") {
a = document.getElementById(a)
}
return this.getOffset(a).left
},
absTop: function(a) {
if (typeof(a) == "string") {
a = document.getElementById(a)
}
return this.getOffset(a).top
},
_aOfs: function(a) {
var e = 0,
c = 0;
while (a) {
e = e + parseInt(a.offsetTop);
c = c + parseInt(a.offsetLeft);
a = a.offsetParent
}
return {
top: e,
left: c
}
},
_aOfsRect: function(g) {
var l = g.getBoundingClientRect();
var m = document.body;
var c = document.documentElement;
var a = window.pageYOffset || c.scrollTop || m.scrollTop;
var h = window.pageXOffset || c.scrollLeft || m.scrollLeft;
var j = c.clientTop || m.clientTop || 0;
var n = c.clientLeft || m.clientLeft || 0;
var o = l.top + a - j;
var e = l.left + h - n;
return {
top: Math.round(o),
left: Math.round(e)
}
},
getOffset: function(a) {
if (a.getBoundingClientRect) {
return this._aOfsRect(a)
} else {
return this._aOfs(a)
}
},
_isObj: function(a) {
return (a != null && typeof(a) == "object" && typeof(a.length) == "undefined")
},
_copyObj: function(g) {
if (this._isObj(g)) {
var e = {};
for (var c in g) {
if (typeof(g[c]) == "object" && g[c] != null) {
e[c] = this._copyObj(g[c])
} else {
e[c] = g[c]
}
}
} else {
var e = [];
for (var c = 0; c < g.length; c++) {
if (typeof(g[c]) == "object" && g[c] != null) {
e[c] = this._copyObj(g[c])
} else {
e[c] = g[c]
}
}
}
return e
},
screenDim: function() {
var a = (navigator.userAgent.indexOf("MSIE") >= 0);
var c = {};
c.left = document.body.scrollLeft;
c.right = c.left + (window.innerWidth || document.body.clientWidth);
c.top = Math.max((a ? document.documentElement : document.getElementsByTagName("html")[0]).scrollTop, document.body.scrollTop);
c.bottom = c.top + (a ? Math.max(document.documentElement.clientHeight || 0, document.documentElement.offsetHeight || 0) : window.innerHeight);
return c
},
selectTextRange: function(h, l, c) {
h = (typeof(h) == "string" ? document.getElementById(h) : h);
var a = h.value.length;
l = Math.max(Math.min(l, a), 0);
c = Math.min(c, a);
if (h.setSelectionRange) {
try {
h.setSelectionRange(l, c)
} catch (j) {}
} else {
if (h.createTextRange) {
var g = h.createTextRange();
g.moveStart("character", l);
g.moveEnd("character", c - a);
try {
g.select()
} catch (j) {}
}
}
},
transData: null,
transDetect: function() {
if (this.transData == null) {
this.transData = {
transProp: false,
transEv: null
};
var e = {
MozTransition: "transitionend",
WebkitTransition: "webkitTransitionEnd",
OTransition: "oTransitionEnd",
msTransition: "transitionend",
transition: "transitionend"
};
for (var c in e) {
if (this.transData.transProp == false && document.documentElement.style[c] != null) {
this.transData.transProp = c;
this.transData.transEv = e[c]
}
}
e = null
}
return this.transData
},
_xmlNodeValue: function(a) {
var e = "";
for (var c = 0; c < a.childNodes.length; c++) {
e += (a.childNodes[c].nodeValue != null ? a.childNodes[c].nodeValue.toString().replace(/^[\n\r\s]{0,}/, "").replace(/[\n\r\s]{0,}$/, "") : "")
}
return e
}
};
window.dhx4.isIE = (navigator.userAgent.indexOf("MSIE") >= 0 || navigator.userAgent.indexOf("Trident") >= 0);
window.dhx4.isIE6 = (window.XMLHttpRequest == null && navigator.userAgent.indexOf("MSIE") >= 0);
window.dhx4.isIE7 = (navigator.userAgent.indexOf("MSIE 7.0") >= 0 && navigator.userAgent.indexOf("Trident") < 0);
window.dhx4.isIE8 = (navigator.userAgent.indexOf("MSIE 8.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0);
window.dhx4.isIE9 = (navigator.userAgent.indexOf("MSIE 9.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0);
window.dhx4.isIE10 = (navigator.userAgent.indexOf("MSIE 10.0") >= 0 && navigator.userAgent.indexOf("Trident") >= 0 && window.navigator.pointerEnabled != true);
window.dhx4.isIE11 = (navigator.userAgent.indexOf("Trident") >= 0 && window.navigator.pointerEnabled == true);
window.dhx4.isEdge = (navigator.userAgent.indexOf("Edge") >= 0);
window.dhx4.isOpera = (navigator.userAgent.indexOf("Opera") >= 0);
window.dhx4.isChrome = (navigator.userAgent.indexOf("Chrome") >= 0) && !window.dhx4.isEdge;
window.dhx4.isKHTML = (navigator.userAgent.indexOf("Safari") >= 0 || navigator.userAgent.indexOf("Konqueror") >= 0) && !window.dhx4.isEdge;
window.dhx4.isFF = (navigator.userAgent.indexOf("Firefox") >= 0);
window.dhx4.isIPad = (navigator.userAgent.search(/iPad/gi) >= 0);
window.dhx4.dnd = {
evs: {},
p_en: ((window.dhx4.isIE || window.dhx4.isEdge) && (window.navigator.pointerEnabled || window.navigator.msPointerEnabled)),
_mTouch: function(a) {
return (window.dhx4.isIE10 && a.pointerType == a.MSPOINTER_TYPE_MOUSE || window.dhx4.isIE11 && a.pointerType == "mouse" || window.dhx4.isEdge && a.pointerType == "mouse")
},
_touchOn: function(a) {
if (a == null) {
a = document.body
}
a.style.touchAction = a.style.msTouchAction = "";
a = null
},
_touchOff: function(a) {
if (a == null) {
a = document.body
}
a.style.touchAction = a.style.msTouchAction = "none";
a = null
}
};
if (window.navigator.pointerEnabled == true) {
window.dhx4.dnd.evs = {
start: "pointerdown",
move: "pointermove",
end: "pointerup"
}
} else {
if (window.navigator.msPointerEnabled == true) {
window.dhx4.dnd.evs = {
start: "MSPointerDown",
move: "MSPointerMove",
end: "MSPointerUp"
}
} else {
if (typeof(window.addEventListener) != "undefined") {
window.dhx4.dnd.evs = {
start: "touchstart",
move: "touchmove",
end: "touchend"
}
}
}
}
}
if (typeof(window.dhx4.template) == "undefined") {
window.dhx4.trim = function(a) {
return String(a).replace(/^\s{1,}/, "").replace(/\s{1,}$/, "")
};
window.dhx4.template = function(c, e, a) {
return c.replace(/#([a-z0-9_-]{1,})(\|([^#]*))?#/gi, function() {
var l = arguments[1];
var j = window.dhx4.trim(arguments[3]);
var m = null;
var h = [e[l]];
if (j.length > 0) {
j = j.split(":");
var g = [];
for (var n = 0; n < j.length; n++) {
if (n > 0 && g[g.length - 1].match(/\\$/) != null) {
g[g.length - 1] = g[g.length - 1].replace(/\\$/, "") + ":" + j[n]
} else {
g.push(j[n])
}
}
m = g[0];
for (var n = 1; n < g.length; n++) {
h.push(g[n])
}
}
if (typeof(m) == "string" && typeof(window.dhx4.template[m]) == "function") {
return window.dhx4.template[m].apply(window.dhx4.template, h)
}
if (l.length > 0 && typeof(e[l]) != "undefined") {
if (a == true) {
return window.dhx4.trim(e[l])
}
return String(e[l])
}
return ""
})
};
window.dhx4.template.date = function(a, c) {
if (a != null) {
if (a instanceof Date) {
return window.dhx4.date2str(a, c)
} else {
a = a.toString();
if (a.match(/^\d*$/) != null) {
return window.dhx4.date2str(new Date(parseInt(a)), c)
}
return a
}
}
return ""
};
window.dhx4.template.maxlength = function(c, a) {
return String(c).substr(0, a)
};
window.dhx4.template.number_format = function(g, h, e, a) {
var c = window.dhx4.template._parseFmt(h, e, a);
if (c == false) {
return g
}
return window.dhx4.template._getFmtValue(g, c)
};
window.dhx4.template.lowercase = function(a) {
if (typeof(a) == "undefined" || a == null) {
a = ""
}
return String(a).toLowerCase()
};
window.dhx4.template.uppercase = function(a) {
if (typeof(a) == "undefined" || a == null) {
a = ""
}
return String(a).toUpperCase()
};
window.dhx4.template._parseFmt = function(l, e, a) {
var g = l.match(/^([^\.\,0-9]*)([0\.\,]*)([^\.\,0-9]*)/);
if (g == null || g.length != 4) {
return false
}
var c = {
i_len: false,
i_sep: (typeof(e) == "string" ? e : ","),
d_len: false,
d_sep: (typeof(a) == "string" ? a : "."),
s_bef: (typeof(g[1]) == "string" ? g[1] : ""),
s_aft: (typeof(g[3]) == "string" ? g[3] : "")
};
var j = g[2].split(".");
if (j[1] != null) {
c.d_len = j[1].length
}
var h = j[0].split(",");
if (h.length > 1) {
c.i_len = h[h.length - 1].length
}
return c
};
window.dhx4.template._getFmtValue = function(value, fmt) {
var r = String(value).match(/^(-)?([0-9]{1,})(\.([0-9]{1,}))?$/);
if (r != null && r.length == 5) {
var v0 = "";
if (r[1] != null) {
v0 += r[1]
}
v0 += fmt.s_bef;
if (fmt.i_len !== false) {
var i = 0;
var v1 = "";
for (var q = r[2].length - 1; q >= 0; q--) {
v1 = "" + r[2].charAt(q) + v1;
if (++i == fmt.i_len && q > 0) {
v1 = fmt.i_sep + v1;
i = 0
}
}
v0 += v1
} else {
v0 += r[2]
}
if (fmt.d_len !== false) {
if (r[4] == null) {
r[4] = ""
}
while (r[4].length < fmt.d_len) {
r[4] += "0"
}
eval("dhx4.temp = new RegExp(/\\d{" + fmt.d_len + "}/);");
var t1 = (r[4]).match(dhx4.temp);
if (t1 != null) {
v0 += fmt.d_sep + t1
}
dhx4.temp = t1 = null
}
v0 += fmt.s_aft;
return v0
}
return value
}
}
if (typeof(window.dhx4.dateLang) == "undefined") {
window.dhx4.dateLang = "en";
window.dhx4.dateStrings = {
en: {
monthFullName: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthShortName: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
dayFullName: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"],
dayShortName: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]
}
};
window.dhx4.dateFormat = {
en: "%Y-%m-%d"
};
window.dhx4.date2str = function(j, g, a) {
if (g == null || typeof(g) == "undefined") {
g = window.dhx4.dateFormat[window.dhx4.dateLang]
}
if (a == null || typeof(a) == "undefined") {
a = window.dhx4.dateStrings[window.dhx4.dateLang]
}
if (j instanceof Date) {
var h = function(l) {
return (String(l).length == 1 ? "0" + String(l) : l)
};
var c = function(n) {
switch (n) {
case "%d":
return h(j.getDate());
case "%j":
return j.getDate();
case "%D":
return a.dayShortName[j.getDay()];
case "%l":
return a.dayFullName[j.getDay()];
case "%m":
return h(j.getMonth() + 1);
case "%n":
return j.getMonth() + 1;
case "%M":
return a.monthShortName[j.getMonth()];
case "%F":
return a.monthFullName[j.getMonth()];
case "%y":
return h(j.getYear() % 100);
case "%Y":
return j.getFullYear();
case "%g":
return (j.getHours() + 11) % 12 + 1;
case "%h":
return h((j.getHours() + 11) % 12 + 1);
case "%G":
return j.getHours();
case "%H":
return h(j.getHours());
case "%i":
return h(j.getMinutes());
case "%s":
return h(j.getSeconds());
case "%a":
return (j.getHours() > 11 ? "pm" : "am");
case "%A":
return (j.getHours() > 11 ? "PM" : "AM");
case "%%":
return "%";
case "%u":
return j.getMilliseconds();
case "%P":
if (window.dhx4.temp_calendar != null && window.dhx4.temp_calendar.tz != null) {
return window.dhx4.temp_calendar.tz
}
var r = j.getTimezoneOffset();
var o = Math.abs(Math.floor(r / 60));
var l = Math.abs(r) - o * 60;
return (r > 0 ? "-" : "+") + h(o) + ":" + h(l);
default:
return n
}
};
var e = String(g || window.dhx4.dateFormat).replace(/%[a-zA-Z]/g, c)
}
return (e || String(j))
};
window.dhx4.str2date = function(j, y, D) {
if (y == null || typeof(y) == "undefined") {
y = window.dhx4.dateFormat[window.dhx4.dateLang]
}
if (D == null || typeof(D) == "undefined") {
D = window.dhx4.dateStrings[window.dhx4.dateLang]
}
y = y.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\\:|]/g, "\\$&");
var C = [];
var n = [];
y = y.replace(/%[a-z]/gi, function(e) {
switch (e) {
case "%d":
case "%m":
case "%y":
case "%h":
case "%H":
case "%i":
case "%s":
n.push(e);
return "(\\d{2})";
case "%D":
case "%l":
case "%M":
case "%F":
n.push(e);
return "([a-zéûä\u0430-\u044F\u0451]{1,})";
case "%j":
case "%n":
case "%g":
case "%G":
n.push(e);
return "(\\d{1,2})";
case "%Y":
n.push(e);
return "(\\d{4})";
case "%a":
n.push(e);
return "([a|p]m)";
case "%A":
n.push(e);
return "([A|P]M)";
case "%u":
n.push(e);
return "(\\d{1,6})";
case "%P":
n.push(e);
return "([+-]\\d{1,2}:\\d{1,2})"
}
return e
});
var E = new RegExp(y, "i");
var o = j.match(E);
if (o == null || o.length - 1 != n.length) {
return "Invalid Date"
}
for (var c = 1; c < o.length; c++) {
C.push(o[c])
}
var g = {
"%y": 1,
"%Y": 1,
"%n": 2,
"%m": 2,
"%M": 2,
"%F": 2,
"%d": 3,
"%j": 3,
"%a": 4,
"%A": 4,
"%H": 5,
"%G": 5,
"%h": 5,
"%g": 5,
"%i": 6,
"%s": 7,
"%u": 7,
"%P": 7
};
var s = {};
var m = {};
for (var c = 0; c < n.length; c++) {
if (typeof(g[n[c]]) != "undefined") {
var h = g[n[c]];
if (!s[h]) {
s[h] = [];
m[h] = []
}
s[h].push(C[c]);
m[h].push(n[c])
}
}
C = [];
n = [];
for (var c = 1; c <= 7; c++) {
if (s[c] != null) {
for (var x = 0; x < s[c].length; x++) {
C.push(s[c][x]);
n.push(m[c][x])
}
}
}
var a = new Date();
a.setDate(1);
a.setHours(0);
a.setMinutes(0);
a.setSeconds(0);
a.setMilliseconds(0);
var u = function(v, e) {
for (var r = 0; r < e.length; r++) {
if (e[r].toLowerCase() == v) {
return r
}
}
return -1
};
for (var c = 0; c < C.length; c++) {
switch (n[c]) {
case "%d":
case "%j":
case "%n":
case "%m":
case "%Y":
case "%H":
case "%G":
case "%i":
case "%s":
case "%u":
if (!isNaN(C[c])) {
a[{
"%d": "setDate",
"%j": "setDate",
"%n": "setMonth",
"%m": "setMonth",
"%Y": "setFullYear",
"%H": "setHours",
"%G": "setHours",
"%i": "setMinutes",
"%s": "setSeconds",
"%u": "setMilliseconds"
}[n[c]]](Number(C[c]) + (n[c] == "%m" || n[c] == "%n" ? -1 : 0))
}
break;
case "%M":
case "%F":
var l = u(C[c].toLowerCase(), D[{
"%M": "monthShortName",
"%F": "monthFullName"
}[n[c]]]);
if (l >= 0) {
a.setMonth(l)
}
break;
case "%y":
if (!isNaN(C[c])) {
var A = Number(C[c]);
a.setFullYear(A + (A > 50 ? 1900 : 2000))
}
break;
case "%g":
case "%h":
if (!isNaN(C[c])) {
var A = Number(C[c]);
if (A <= 12 && A >= 0) {
a.setHours(A + (u("pm", C) >= 0 ? (A == 12 ? 0 : 12) : (A == 12 ? -12 : 0)))
}
}
break;
case "%P":
if (window.dhx4.temp_calendar != null) {
window.dhx4.temp_calendar.tz = C[c]
}
break
}
}
return a
}
}
if (typeof(window.dhx4.ajax) == "undefined") {
window.dhx4.ajax = {
cache: false,
method: "get",
parse: function(a) {
if (typeof a !== "string") {
return a
}
a = a.replace(/^[\s]+/, "");
if (window.DOMParser && !dhx4.isIE) {
var c = (new window.DOMParser()).parseFromString(a, "text/xml")
} else {
if (window.ActiveXObject !== window.undefined) {
var c = new window.ActiveXObject("Microsoft.XMLDOM");
c.async = "false";
c.loadXML(a)
}
}
return c
},
xmltop: function(a, h, g) {
if (typeof h.status == "undefined" || h.status < 400) {
xml = (!h.responseXML) ? dhx4.ajax.parse(h.responseText || h) : (h.responseXML || h);
if (xml && xml.documentElement !== null) {
try {
if (!xml.getElementsByTagName("parsererror").length) {
return xml.getElementsByTagName(a)[0]
}
} catch (c) {}
}
}
if (g !== -1) {
dhx4.callEvent("onLoadXMLError", ["Incorrect XML", arguments[1], g])
}
return document.createElement("DIV")
},
xpath: function(g, a) {
if (!a.nodeName) {
a = a.responseXML || a
}
if (dhx4.isIE) {
try {
return a.selectNodes(g) || []
} catch (j) {
return []
}
} else {
var h = [];
var l;
var c = (a.ownerDocument || a).evaluate(g, a, null, XPathResult.ANY_TYPE, null);
while (l = c.iterateNext()) {
h.push(l)
}
return h
}
},
query: function(a) {
dhx4.ajax._call((a.method || "GET"), a.url, a.data || "", (a.async || true), a.callback, null, a.headers)
},
get: function(a, c) {
return this._call("GET", a, null, true, c)
},
getSync: function(a) {
return this._call("GET", a, null, false)
},
put: function(c, a, e) {
return this._call("PUT", c, a, true, e)
},
del: function(c, a, e) {
return this._call("DELETE", c, a, true, e)
},
post: function(c, a, e) {
if (arguments.length == 1) {
a = ""
} else {
if (arguments.length == 2 && (typeof(a) == "function" || typeof(window[a]) == "function")) {
e = a;
a = ""
} else {
a = String(a)
}
}
return this._call("POST", c, a, true, e)
},
postSync: function(c, a) {
a = (a == null ? "" : String(a));
return this._call("POST", c, a, false)
},
getLong: function(a, c) {
this._call("GET", a, null, true, c, {
url: a
})
},
postLong: function(c, a, e) {
if (arguments.length == 2 && (typeof(a) == "function" || typeof(window[a]))) {
e = a;
a = ""
}
this._call("POST", c, a, true, e, {
url: c,
postData: a
})
},
_call: function(a, c, e, h, l, o, g) {
var n = (window.XMLHttpRequest && !dhx4.isIE ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"));
var j = (navigator.userAgent.match(/AppleWebKit/) != null && navigator.userAgent.match(/Qt/) != null && navigator.userAgent.match(/Safari/) != null);
if (h == true) {
n.onreadystatechange = function() {
if ((n.readyState == 4) || (j == true && n.readyState == 3)) {
if (n.status != 200 || n.responseText == "") {
if (!dhx4.callEvent("onAjaxError", [{
xmlDoc: n,
filePath: c,
async: h
}])) {
return
}
}
window.setTimeout(function() {
if (typeof(l) == "function") {
l.apply(window, [{
xmlDoc: n,
filePath: c,
async: h
}])
}
if (o != null) {
if (typeof(o.postData) != "undefined") {
dhx4.ajax.postLong(o.url, o.postData, l)
} else {
dhx4.ajax.getLong(o.url, l)
}
}
l = null;
n = null
}, 1)
}
}
}
if (a == "GET") {
c += this._dhxr(c)
}
n.open(a, c, h);
if (g != null) {
for (var m in g) {
n.setRequestHeader(m, g[m])
}
} else {
if (a == "POST" || a == "PUT" || a == "DELETE") {
n.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
} else {
if (a == "GET") {
e = null
}
}
}
n.setRequestHeader("X-Requested-With", "XMLHttpRequest");
n.send(e);
if (h != true) {
if ((n.readyState == 4) || (j == true && n.readyState == 3)) {
if (n.status != 200 || n.responseText == "") {
dhx4.callEvent("onAjaxError", [{
xmlDoc: n,
filePath: c,
async: h
}])
}
}
}
return {
xmlDoc: n,
filePath: c,
async: h
}
},
_dhxr: function(a, c) {
if (this.cache != true) {
if (a.match(/^[\?\&]$/) == null) {
a = (a.indexOf("?") >= 0 ? "&" : "?")
}
if (typeof(c) == "undefined") {
c = true
}
return a + "dhxr" + new Date().getTime() + (c == true ? "=1" : "")
}
return ""
}
}
}
if (typeof(window.dhx4._enableDataLoading) == "undefined") {
window.dhx4._enableDataLoading = function(l, e, j, h, m) {
if (m == "clear") {
for (var c in l._dhxdataload) {
l._dhxdataload[c] = null;
delete l._dhxdataload[c]
}
l._loadData = null;
l._dhxdataload = null;
l.load = null;
l.loadStruct = null;
l = null;
return
}
l._dhxdataload = {
initObj: e,
xmlToJson: j,
xmlRootTag: h,
onBeforeXLS: null
};
l._loadData = function(u, v, w) {
if (arguments.length == 2) {
w = v;
v = null
}
var s = null;
if (arguments.length == 3) {
w = arguments[2]
}
if (typeof(u) == "string") {
var r = u.replace(/^\s{1,}/, "").replace(/\s{1,}$/, "");
var A = new RegExp("^<" + this._dhxdataload.xmlRootTag);
if (A.test(r.replace(/^<\?xml[^\?]*\?>\s*/, ""))) {
s = dhx4.ajax.parse(u);
if (s != null) {
s = this[this._dhxdataload.xmlToJson].apply(this, [s])
}
}
if (s == null && (r.match(/^[\s\S]*{[.\s\S]*}[\s\S]*$/) != null || r.match(/^[\s\S]*\[[.\s\S]*\][\s\S]*$/) != null)) {
s = dhx4.s2j(r)
}
if (s == null) {
this.callEvent("onXLS", []);
var o = [];
if (typeof(this._dhxdataload.onBeforeXLS) == "function") {
var r = this._dhxdataload.onBeforeXLS.apply(this, [u]);
if (r != null && typeof(r) == "object") {
if (r.url != null) {
u = r.url
}
if (r.params != null) {
for (var x in r.params) {
o.push(x + "=" + encodeURIComponent(r.params[x]))
}
}
}
}
var y = this;
var n = function(a) {
var C = null;
if ((a.xmlDoc.getResponseHeader("Content-Type") || "").search(/xml/gi) >= 0 || (a.xmlDoc.responseText.replace(/^\s{1,}/, "")).match(/^</) != null) {
C = y[y._dhxdataload.xmlToJson].apply(y, [a.xmlDoc.responseXML])
} else {
C = dhx4.s2j(a.xmlDoc.responseText)
}
if (C != null) {
y[y._dhxdataload.initObj].apply(y, [C, u])
}
y.callEvent("onXLE", []);
if (w != null) {
if (typeof(w) == "function") {
w.apply(y, [])
} else {
if (typeof(window[w]) == "function") {
window[w].apply(y, [])
}
}
}
n = w = null;
C = a = y = null
};
o = o.join("&") + (typeof(v) == "string" ? "&" + v : "");
if (dhx4.ajax.method == "post") {
dhx4.ajax.post(u, o, n)
} else {
if (dhx4.ajax.method == "get") {
dhx4.ajax.get(u + (o.length > 0 ? (u.indexOf("?") > 0 ? "&" : "?") + o : ""), n)
}
}
return
}
} else {
if (typeof(u.documentElement) == "object" || (typeof(u.tagName) != "undefined" && typeof(u.getElementsByTagName) != "undefined" && u.getElementsByTagName(this._dhxdataload.xmlRootTag).length > 0)) {
s = this[this._dhxdataload.xmlToJson].apply(this, [u])
} else {
s = window.dhx4._copyObj(u)
}
}
if (s != null) {
this[this._dhxdataload.initObj].apply(this, [s])
}
if (w != null) {
if (typeof(w) == "function") {
w.apply(this, [])
} else {
if (typeof(window[w]) == "function") {
window[w].apply(this, [])
}
}
w = null
}
};
if (m != null) {
var g = {
struct: "loadStruct",
data: "load"
};
for (var c in m) {
if (m[c] == true) {
l[g[c]] = function() {
return this._loadData.apply(this, arguments)
}
}
}
}
l = null
}
}
if (typeof(window.dhx4._eventable) == "undefined") {
window.dhx4._eventable = function(a, c) {
if (c == "clear") {
a.detachAllEvents();
a.dhxevs = null;
a.attachEvent = null;
a.detachEvent = null;
a.checkEvent = null;
a.callEvent = null;
a.detachAllEvents = null;
a = null;
return
}
a.dhxevs = {
data: {}
};
a.attachEvent = function(e, h) {
e = String(e).toLowerCase();
if (!this.dhxevs.data[e]) {
this.dhxevs.data[e] = {}
}
var g = window.dhx4.newId();
this.dhxevs.data[e][g] = h;
return g
};
a.detachEvent = function(j) {
for (var g in this.dhxevs.data) {
var h = 0;
for (var e in this.dhxevs.data[g]) {
if (e == j) {
this.dhxevs.data[g][e] = null;
delete this.dhxevs.data[g][e]
} else {
h++
}
}
if (h == 0) {
this.dhxevs.data[g] = null;
delete this.dhxevs.data[g]
}
}
};
a.checkEvent = function(e) {
e = String(e).toLowerCase();
return (this.dhxevs.data[e] != null)
};
a.callEvent = function(g, j) {
g = String(g).toLowerCase();
if (this.dhxevs.data[g] == null) {
return true
}
var h = true;
for (var e in this.dhxevs.data[g]) {
h = this.dhxevs.data[g][e].apply(this, j) && h
}
return h
};
a.detachAllEvents = function() {
for (var g in this.dhxevs.data) {
for (var e in this.dhxevs.data[g]) {
this.dhxevs.data[g][e] = null;
delete this.dhxevs.data[g][e]
}
this.dhxevs.data[g] = null;
delete this.dhxevs.data[g]
}
};
a = null
};
dhx4._eventable(dhx4)
}
if (!window.dhtmlxValidation) {
dhtmlxValidation = function() {};
dhtmlxValidation.prototype = {
isEmpty: function(a) {
return a == ""
},
isNotEmpty: function(a) {
return (a instanceof Array ? a.length > 0 : !a == "")
},
isValidBoolean: function(a) {
return !!a.toString().match(/^(0|1|true|false)$/)
},
isValidEmail: function(a) {
return !!a.toString().match(/(^[a-z0-9]([0-9a-z\-_\.]*)@([0-9a-z_\-\.]*)([.][a-z]{3})$)|(^[a-z]([0-9a-z_\.\-]*)@([0-9a-z_\-\.]*)(\.[a-z]{2,5})$)/i)
},
isValidInteger: function(a) {
return !!a.toString().match(/(^-?\d+$)/)
},
isValidNumeric: function(a) {
return !!a.toString().match(/(^-?\d\d*[\.|,]\d*$)|(^-?\d\d*$)|(^-?[\.|,]\d\d*$)/)
},
isValidAplhaNumeric: function(a) {
return !!a.toString().match(/^[_\-a-z0-9]+$/gi)
},
isValidDatetime: function(c) {
var a = c.toString().match(/^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2}):(\d{2})$/);
return a && !!(a[1] <= 9999 && a[2] <= 12 && a[3] <= 31 && a[4] <= 59 && a[5] <= 59 && a[6] <= 59) || false
},
isValidDate: function(a) {
var c = a.toString().match(/^(\d{4})-(\d{2})-(\d{2})$/);
return c && !!(c[1] <= 9999 && c[2] <= 12 && c[3] <= 31) || false
},
isValidTime: function(c) {
var a = c.toString().match(/^(\d{1,2}):(\d{1,2}):(\d{1,2})$/);
return a && !!(a[1] <= 24 && a[2] <= 59 && a[3] <= 59) || false
},
isValidIPv4: function(a) {
var c = a.toString().match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
return c && !!(c[1] <= 255 && c[2] <= 255 && c[3] <= 255 && c[4] <= 255) || false
},
isValidCurrency: function(a) {
return a.toString().match(/^\$?\s?\d+?([\.,\,]?\d+)?\s?\$?$/) && true || false
},
isValidSSN: function(a) {
return a.toString().match(/^\d{3}\-?\d{2}\-?\d{4}$/) && true || false
},
isValidSIN: function(a) {
return a.toString().match(/^\d{9}$/) && true || false
}
};
dhtmlxValidation = new dhtmlxValidation()
}
if (typeof(window.dhtmlx) == "undefined") {
window.dhtmlx = {
extend: function(e, c) {
for (var g in c) {
if (!e[g]) {
e[g] = c[g]
}
}
return e
},
extend_api: function(a, g, e) {
var c = window[a];
if (!c) {
return
}
window[a] = function(l) {
if (l && typeof l == "object" && !l.tagName) {
var j = c.apply(this, (g._init ? g._init(l) : arguments));
for (var h in dhtmlx) {
if (g[h]) {
this[g[h]](dhtmlx[h])
}
}
for (var h in l) {
if (g[h]) {
this[g[h]](l[h])
} else {
if (h.indexOf("on") === 0) {
this.attachEvent(h, l[h])
}
}
}
} else {
var j = c.apply(this, arguments)
}
if (g._patch) {
g._patch(this)
}
return j || this
};
window[a].prototype = c.prototype;
if (e) {
dhtmlx.extend(window[a].prototype, e)
}
},
url: function(a) {
if (a.indexOf("?") != -1) {
return "&"
} else {
return "?"
}
}
}
}
function dhtmlDragAndDropObject() {
if (window.dhtmlDragAndDrop) {
return window.dhtmlDragAndDrop
}
this.lastLanding = 0;
this.dragNode = 0;
this.dragStartNode = 0;
this.dragStartObject = 0;
this.tempDOMU = null;
this.tempDOMM = null;
this.waitDrag = 0;
window.dhtmlDragAndDrop = this;
return this
}
dhtmlDragAndDropObject.prototype.removeDraggableItem = function(a) {
a.onmousedown = null;
a.dragStarter = null;
a.dragLanding = null
};
dhtmlDragAndDropObject.prototype.addDraggableItem = function(a, c) {
a.onmousedown = this.preCreateDragCopy;
a.dragStarter = c;
this.addDragLanding(a, c)
};
dhtmlDragAndDropObject.prototype.addDragLanding = function(a, c) {
a.dragLanding = c
};
dhtmlDragAndDropObject.prototype.preCreateDragCopy = function(a) {
if ((a || window.event) && (a || event).button == 2) {
return
}
if (window.dhtmlDragAndDrop.waitDrag) {
window.dhtmlDragAndDrop.waitDrag = 0;
document.body.onmouseup = window.dhtmlDragAndDrop.tempDOMU;
document.body.onmousemove = window.dhtmlDragAndDrop.tempDOMM;
return false
}
if (window.dhtmlDragAndDrop.dragNode) {
window.dhtmlDragAndDrop.stopDrag(a)
}
window.dhtmlDragAndDrop.waitDrag = 1;
window.dhtmlDragAndDrop.tempDOMU = document.body.onmouseup;
window.dhtmlDragAndDrop.tempDOMM = document.body.onmousemove;
window.dhtmlDragAndDrop.dragStartNode = this;
window.dhtmlDragAndDrop.dragStartObject = this.dragStarter;
document.body.onmouseup = window.dhtmlDragAndDrop.preCreateDragCopy;
document.body.onmousemove = window.dhtmlDragAndDrop.callDrag;
window.dhtmlDragAndDrop.downtime = new Date().valueOf();
if ((a) && (a.preventDefault)) {
a.preventDefault();
return false
}
return false
};
dhtmlDragAndDropObject.prototype.callDrag = function(g) {
if (!g) {
g = window.event
}
dragger = window.dhtmlDragAndDrop;
if ((new Date()).valueOf() - dragger.downtime < 100) {
return
}
if (!dragger.dragNode) {
if (dragger.waitDrag) {
dragger.dragNode = dragger.dragStartObject._createDragNode(dragger.dragStartNode, g);
if (!dragger.dragNode) {
return dragger.stopDrag()
}
dragger.dragNode.onselectstart = function() {
return false
};
dragger.gldragNode = dragger.dragNode;
document.body.appendChild(dragger.dragNode);
document.body.onmouseup = dragger.stopDrag;
dragger.waitDrag = 0;
dragger.dragNode.pWindow = window;
dragger.initFrameRoute()
} else {
return dragger.stopDrag(g, true)
}
}
if (dragger.dragNode.parentNode != window.document.body && dragger.gldragNode) {
var a = dragger.gldragNode;
if (dragger.gldragNode.old) {
a = dragger.gldragNode.old
}
a.parentNode.removeChild(a);
var c = dragger.dragNode.pWindow;
if (a.pWindow && a.pWindow.dhtmlDragAndDrop.lastLanding) {
a.pWindow.dhtmlDragAndDrop.lastLanding.dragLanding._dragOut(a.pWindow.dhtmlDragAndDrop.lastLanding)
}
if (_isIE) {
var j = document.createElement("Div");
j.innerHTML = dragger.dragNode.outerHTML;
dragger.dragNode = j.childNodes[0]
} else {
dragger.dragNode = dragger.dragNode.cloneNode(true)
}
dragger.dragNode.pWindow = window;
dragger.gldragNode.old = dragger.dragNode;
document.body.appendChild(dragger.dragNode);
c.dhtmlDragAndDrop.dragNode = dragger.dragNode
}
dragger.dragNode.style.left = g.clientX + 15 + (dragger.fx ? dragger.fx * (-1) : 0) + (document.body.scrollLeft || document.documentElement.scrollLeft) + "px";
dragger.dragNode.style.top = g.clientY + 3 + (dragger.fy ? dragger.fy * (-1) : 0) + (document.body.scrollTop || document.documentElement.scrollTop) + "px";
if (!g.srcElement) {
var h = g.target
} else {
h = g.srcElement
}
dragger.checkLanding(h, g)
};
dhtmlDragAndDropObject.prototype.calculateFramePosition = function(h) {
if (window.name) {
var e = parent.frames[window.name].frameElement.offsetParent;
var g = 0;
var c = 0;
while (e) {
g += e.offsetLeft;
c += e.offsetTop;
e = e.offsetParent
}
if ((parent.dhtmlDragAndDrop)) {
var a = parent.dhtmlDragAndDrop.calculateFramePosition(1);
g += a.split("_")[0] * 1;
c += a.split("_")[1] * 1
}
if (h) {
return g + "_" + c
} else {
this.fx = g
}
this.fy = c
}
return "0_0"
};
dhtmlDragAndDropObject.prototype.checkLanding = function(c, a) {
if ((c) && (c.dragLanding)) {
if (this.lastLanding) {
this.lastLanding.dragLanding._dragOut(this.lastLanding)
}
this.lastLanding = c;
this.lastLanding = this.lastLanding.dragLanding._dragIn(this.lastLanding, this.dragStartNode, a.clientX, a.clientY, a);
this.lastLanding_scr = (_isIE ? a.srcElement : a.target)
} else {
if ((c) && (c.tagName != "BODY")) {
this.checkLanding(c.parentNode, a)
} else {
if (this.lastLanding) {
this.lastLanding.dragLanding._dragOut(this.lastLanding, a.clientX, a.clientY, a)
}
this.lastLanding = 0;
if (this._onNotFound) {
this._onNotFound()
}
}
}
};
dhtmlDragAndDropObject.prototype.stopDrag = function(c, g) {
dragger = window.dhtmlDragAndDrop;
if (!g) {
dragger.stopFrameRoute();
var a = dragger.lastLanding;
dragger.lastLanding = null;
if (a) {
a.dragLanding._drag(dragger.dragStartNode, dragger.dragStartObject, a, (_isIE ? event.srcElement : c.target))
}
}
dragger.lastLanding = null;
if ((dragger.dragNode) && (dragger.dragNode.parentNode == document.body)) {
dragger.dragNode.parentNode.removeChild(dragger.dragNode)
}
dragger.dragNode = 0;
dragger.gldragNode = 0;
dragger.fx = 0;
dragger.fy = 0;
dragger.dragStartNode = 0;
dragger.dragStartObject = 0;
document.body.onmouseup = dragger.tempDOMU;
document.body.onmousemove = dragger.tempDOMM;
dragger.tempDOMU = null;
dragger.tempDOMM = null;
dragger.waitDrag = 0
};
dhtmlDragAndDropObject.prototype.stopFrameRoute = function(g) {
if (g) {
window.dhtmlDragAndDrop.stopDrag(1, 1)
}
for (var a = 0; a < window.frames.length; a++) {
try {
if ((window.frames[a] != g) && (window.frames[a].dhtmlDragAndDrop)) {
window.frames[a].dhtmlDragAndDrop.stopFrameRoute(window)
}
} catch (c) {}
}
try {
if ((parent.dhtmlDragAndDrop) && (parent != window) && (parent != g)) {
parent.dhtmlDragAndDrop.stopFrameRoute(window)
}
} catch (c) {}
};
dhtmlDragAndDropObject.prototype.initFrameRoute = function(g, h) {
if (g) {
window.dhtmlDragAndDrop.preCreateDragCopy();
window.dhtmlDragAndDrop.dragStartNode = g.dhtmlDragAndDrop.dragStartNode;
window.dhtmlDragAndDrop.dragStartObject = g.dhtmlDragAndDrop.dragStartObject;
window.dhtmlDragAndDrop.dragNode = g.dhtmlD