function dhtmlXContainer(obj) {
var that = this;
this.obj = obj;
this.dhxcont = null;
this.setContent = function(data) {
this.dhxcont = data;
this.dhxcont.innerHTML = "
"+
"";
this.dhxcont.mainCont = this.dhxcont.childNodes[0];
this.obj.dhxcont = this.dhxcont;
}
this.obj._genStr = function(w) {
var s = ""; var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
for (var q=0; qbDim[0]?aDim[1]:null), (aDim[2]>bDim[1]?aDim[2]:null));
}
if (pref == "tabbar" && cont._isCell) cont.hideHeader();
cont.attachObject(this[pref+"Id"]);
cont[pref] = this[pref];
cont[pref+"Id"] = this[pref+"Id"];
cont[pref+"Obj"] = this[pref+"Obj"];
if (pref == "layout") {
cont.layout._baseWFix = -2;
cont.layout._baseHFix = -2;
// from layout to window, attach event
if (cont._isWindow) cont.attachEvent("_onBeforeTryResize", cont.layout._defineWindowMinDimension);
}
this[pref] = null;
this[pref+"Id"] = null;
this[pref+"Obj"] = null;
if (pref == "tabbar" && this._isCell) this.showHeader();
}
// menu/toolbar/statusbar should be after any object
if (this.menu != null) {
cont.dhxcont.insertBefore(document.getElementById(this.menuId), cont.dhxcont.childNodes[0]);
cont.menu = this.menu;
cont.menuId = this.menuId;
cont.menuHeight = this.menuHeight;
this.menu = null;
this.menuId = null;
this.menuHeight = null;
if (this._doOnAttachMenu) this._doOnAttachMenu("unload");
if (cont._doOnAttachMenu) cont._doOnAttachMenu("move");
}
if (this.toolbar != null) {
cont.dhxcont.insertBefore(document.getElementById(this.toolbarId), cont.dhxcont.childNodes[(cont.menu != null?1:0)]);
cont.toolbar = this.toolbar;
cont.toolbarId = this.toolbarId;
cont.toolbarHeight = this.toolbarHeight;
this.toolbar = null;
this.toolbarId = null;
this.toolbarHeight = null;
if (this._doOnAttachToolbar) this._doOnAttachToolbar("unload");
if (cont._doOnAttachToolbar) cont._doOnAttachToolbar("move");
}
if (this.sb != null) {
cont.dhxcont.insertBefore(document.getElementById(this.sbId), cont.dhxcont.childNodes[cont.dhxcont.childNodes.length-1]);
cont.sb = this.sb;
cont.sbId = this.sbId;
cont.sbHeight = this.sbHeight;
this.sb = null;
this.sbId = null;
this.sbHeight = null;
if (this._doOnAttachToolbar) this._doOnAttachToolbar("unload");
if (cont._doOnAttachToolbar) cont._doOnAttachToolbar("move");
}
// other objects
var objA = this.dhxcont.childNodes[0];
var objB = cont.dhxcont.childNodes[0];
while (objA.childNodes.length > 0) objB.appendChild(objA.childNodes[0]);
//
cont.updateNestedObjects();
}
this.obj.adjustContent = function(parentObj, offsetTop, marginTop, notCalcWidth, offsetBottom) {
this.dhxcont.style.left = (this._offsetLeft||0)+"px";
this.dhxcont.style.top = (this._offsetTop||0)+offsetTop+"px";
//
var cw = parentObj.clientWidth+(this._offsetWidth||0);
if (notCalcWidth !== true) this.dhxcont.style.width = Math.max(0, cw)+"px";
if (notCalcWidth !== true) if (this.dhxcont.offsetWidth > cw) this.dhxcont.style.width = Math.max(0, cw*2-this.dhxcont.offsetWidth)+"px";
//
var ch = parentObj.clientHeight+(this._offsetHeight||0);
this.dhxcont.style.height = Math.max(0, ch-offsetTop)+(marginTop!=null?marginTop:0)+"px";
if (this.dhxcont.offsetHeight > ch - offsetTop) this.dhxcont.style.height = Math.max(0, (ch-offsetTop)*2-this.dhxcont.offsetHeight)+"px";
if (offsetBottom) if (!isNaN(offsetBottom)) this.dhxcont.style.height = Math.max(0, parseInt(this.dhxcont.style.height)-offsetBottom)+"px";
// main window content
if (this._minDataSizeH != null) {
// height for menu/toolbar/status bar should be included
if (parseInt(this.dhxcont.style.height) < this._minDataSizeH) this.dhxcont.style.height = this._minDataSizeH+"px";
}
if (this._minDataSizeW != null) {
if (parseInt(this.dhxcont.style.width) < this._minDataSizeW) this.dhxcont.style.width = this._minDataSizeW+"px";
}
if (notCalcWidth !== true) {
this.dhxcont.mainCont.style.width = this.dhxcont.clientWidth+"px";
// allow border to this.dhxcont.mainCont
if (this.dhxcont.mainCont.offsetWidth > this.dhxcont.clientWidth) this.dhxcont.mainCont.style.width = Math.max(0, this.dhxcont.clientWidth*2-this.dhxcont.mainCont.offsetWidth)+"px";
}
var menuOffset = (this.menu!=null?(!this.menuHidden?this.menuHeight:0):0);
var toolbarOffset = (this.toolbar!=null?(!this.toolbarHidden?this.toolbarHeight:0):0);
var statusOffset = (this.sb!=null?(!this.sbHidden?this.sbHeight:0):0);
// allow border to this.dhxcont.mainCont
this.dhxcont.mainCont.style.height = this.dhxcont.clientHeight+"px";
if (this.dhxcont.mainCont.offsetHeight > this.dhxcont.clientHeight) this.dhxcont.mainCont.style.height = Math.max(0, this.dhxcont.clientHeight*2-this.dhxcont.mainCont.offsetHeight)+"px";
this.dhxcont.mainCont.style.height = Math.max(0, parseInt(this.dhxcont.mainCont.style.height)-menuOffset-toolbarOffset-statusOffset)+"px";
}
this.obj.coverBlocker = function() {
return this.dhxcont.childNodes[this.dhxcont.childNodes.length-1];
}
this.obj.showCoverBlocker = function() {
this.coverBlocker().style.display = "";
}
this.obj.hideCoverBlocker = function() {
this.coverBlocker().style.display = "none";
}
this.obj.updateNestedObjects = function() {
if (this.grid) { this.grid.setSizes(); }
if (this.tabbar) { this.tabbar.adjustOuterSize(); }
if (this.folders) { this.folders.setSizes(); }
if (this.editor) {
if (!_isIE) this.editor._prepareContent(true);
this.editor.setSizes();
}
//if (_isOpera) { var t = this; window.setTimeout(function(){t.editor.adjustSize();},10); } else { this.editor.adjustSize(); } }
if (this.layout) {
this.layoutObj.style.width = this.dhxcont.mainCont.style.width;
this.layoutObj.style.height = this.dhxcont.mainCont.style.height;
if (this._isAcc && this.skin == "dhx_skyblue") {
this.layoutObj.style.width = parseInt(this.dhxcont.mainCont.style.width)+2+"px";
this.layoutObj.style.height = parseInt(this.dhxcont.mainCont.style.height)+2+"px";
}
this.layout.setSizes();
}
if (this.accordion != null) {
this.accordionObj.style.width = parseInt(this.dhxcont.mainCont.style.width)+2+"px";
this.accordionObj.style.height = parseInt(this.dhxcont.mainCont.style.height)+2+"px";
this.accordion.setSizes();
}
// docked layout's cell
if (this.dockedCell) { this.dockedCell.updateNestedObjects(); }
/*
if (win.accordion != null) { win.accordion.setSizes(); }
if (win.layout != null) { win.layout.setSizes(win); }
*/
}
/**
* @desc: attaches a status bar to a window
* @type: public
*/
this.obj.attachStatusBar = function() {
var sbObj = document.createElement("DIV");
if (this._isCell) {
sbObj.className = "dhxcont_sb_container_layoutcell";
} else {
sbObj.className = "dhxcont_sb_container";
}
sbObj.id = "sbobj_"+this._genStr(12);
sbObj.innerHTML = "";
this.dhxcont.insertBefore(sbObj, this.dhxcont.childNodes[this.dhxcont.childNodes.length-1]);
sbObj.setText = function(text) { this.childNodes[0].innerHTML = text; }
sbObj.getText = function() { return this.childNodes[0].innerHTML; }
sbObj.onselectstart = function(e) { e=e||event; e.returnValue=false; return false; }
this.sb = sbObj;
this.sbHeight = sbObj.offsetHeight;
this.sbId = sbObj.id;
if (this._doOnAttachStatusBar) this._doOnAttachStatusBar("init");
this.adjust();
return this.sb;
}
/**
* @desc: detaches a status bar from a window
* @type: public
*/
this.obj.detachStatusBar = function() {
if (!this.sb) return;
this.sb.setText = null;
this.sb.getText = null;
this.sb.onselectstart = null;
this.sb.parentNode.removeChild(this.sb);
this.sb = null;
this.sbHeight = null;
this.sbId = null;
if (this._doOnAttachStatusBar) this._doOnAttachStatusBar("unload");
}
/**
* @desc: attaches a dhtmlxMenu to a window
* @type: public
*/
this.obj.attachMenu = function() {
var menuObj = document.createElement("DIV");
menuObj.style.position = "relative";
menuObj.style.overflow = "hidden";
menuObj.id = "dhxmenu_"+this._genStr(12);
this.dhxcont.insertBefore(menuObj, this.dhxcont.childNodes[0]);
this.menu = new dhtmlXMenuObject(menuObj.id, this.skin);
this.menuHeight = menuObj.offsetHeight;
this.menuId = menuObj.id;
if (this._doOnAttachMenu) this._doOnAttachMenu("init");
this.adjust();
return this.menu;
}
/**
* @desc: detaches a dhtmlxMenu from a window
* @type: public
*/
this.obj.detachMenu = function() {
if (!this.menu) return;
var menuObj = document.getElementById(this.menuId);
this.menu.unload();
this.menu = null;
this.menuId = null;
this.menuHeight = null;
menuObj.parentNode.removeChild(menuObj);
menuObj = null;
if (this._doOnAttachMenu) this._doOnAttachMenu("unload");
}
/**
* @desc: attaches a dhtmlxToolbar to a window
* @type: public
*/
this.obj.attachToolbar = function() {
var toolbarObj = document.createElement("DIV");
toolbarObj.style.position = "relative";
toolbarObj.style.overflow = "hidden";
toolbarObj.id = "dhxtoolbar_"+this._genStr(12);
this.dhxcont.insertBefore(toolbarObj, this.dhxcont.childNodes[(this.menu!=null?1:0)]);
this.toolbar = new dhtmlXToolbarObject(toolbarObj.id, this.skin);
this.toolbarHeight = toolbarObj.offsetHeight+(this._isLayout&&this.skin=="dhx_skyblue"?2:0);
this.toolbarId = toolbarObj.id;
if (this._doOnAttachToolbar) this._doOnAttachToolbar("init");
this.adjust();
return this.toolbar;
}
/**
* @desc: detaches a dhtmlxToolbar from a window
* @type: public
*/
this.obj.detachToolbar = function() {
if (!this.toolbar) return;
var toolbarObj = document.getElementById(this.toolbarId);
this.toolbar.unload();
this.toolbar = null;
this.toolbarId = null;
this.toolbarHeight = null;
toolbarObj.parentNode.removeChild(toolbarObj);
toolbarObj = null;
if (this._doOnAttachToolbar) this._doOnAttachToolbar("unload");
}
/**
* @desc: attaches a dhtmlxGrid to a window
* @type: public
*/
this.obj.attachGrid = function() {
if (this._isWindow && this.skin == "dhx_skyblue") {
this.dhxcont.mainCont.style.border = "#a4bed4 1px solid";
this._redraw();
}
var obj = document.createElement("DIV");
obj.id = "dhxGridObj_"+this._genStr(12);
obj.style.width = "100%";
obj.style.height = "100%";
obj.cmp = "grid";
document.body.appendChild(obj);
this.attachObject(obj.id);
this.grid = new dhtmlXGridObject(obj.id);
this.grid.setSkin(this.skin);
this.grid.entBox.style.border = "0px solid white";
this.grid._sizeFix=0;
this.gridId = obj.id;
this.gridObj = obj;
return this.grid;
}
/**
* @desc: attaches a dhtmlxScheduler to a window
* @type: public
*/
this.obj.attachScheduler = function(day,mode) {
var obj = document.createElement("DIV");
obj.innerHTML='';
document.body.appendChild(obj.firstChild);
this.attachObject("scheduler_here");
this.grid = scheduler;
scheduler.setSizes = scheduler.update_view;
scheduler.destructor=function(){};
scheduler.init("scheduler_here",day,mode);
//this.grid.entBox.style.border = "0px solid white";
return this.grid;
}
/**
* @desc: attaches a dhtmlxTree to a window
* @param: rootId - not mandatory, tree super root, see dhtmlxTree documentation for details
* @type: public
*/
this.obj.attachTree = function(rootId) {
if (this._isWindow && this.skin == "dhx_skyblue") {
this.dhxcont.mainCont.style.border = "#a4bed4 1px solid";
this._redraw();
}
var obj = document.createElement("DIV");
obj.id = "dhxTreeObj_"+this._genStr(12);
obj.style.width = "100%";
obj.style.height = "100%";
obj.cmp = "tree";
document.body.appendChild(obj);
this.attachObject(obj.id);
this.tree = new dhtmlXTreeObject(obj.id, "100%", "100%", (rootId||0));
this.tree.setSkin(this.skin);
// this.tree.allTree.style.paddingTop = "2px";
this.tree.allTree.childNodes[0].style.marginTop = "2px";
this.tree.allTree.childNodes[0].style.marginBottom = "2px";
this.treeId = obj.id;
this.treeObj = obj;
return this.tree;
}
/**
* @desc: attaches a dhtmlxTabbar to a window
* @type: public
*/
this.obj.attachTabbar = function(mode) {
if (this._isWindow && this.skin == "dhx_skyblue") {
this.dhxcont.style.border = "none";
this.setDimension(this.w, this.h);
}
var obj = document.createElement("DIV");
obj.id = "dhxTabbarObj_"+this._genStr(12);
obj.style.width = "100%";
obj.style.height = "100%";
obj.style.overflow = "hidden";
obj.cmp = "tabbar";
document.body.appendChild(obj);
this.attachObject(obj.id);
// manage dockcell if exists
/*
if (this._dockCell != null && that.dhxLayout != null) {
var dockCell = that.dhxLayout.polyObj[this._dockCell];
if (dockCell != null) {
dockCell.childNodes[0]._tabbarMode = true;
that.dhxLayout.hidePanel(this._dockCell);
dockCell.className = "dhtmlxLayoutSinglePolyTabbar";
// dockCell.childNodes[0]._h = -2;
// dockCell.childNodes[1].style.height = parseInt(dockCell.childNodes[1].style.height) - dockCell.childNodes[0]._h + "px";
// dockCell.className = "dhtmlxLayoutSinglePolyTabbar";
// fix panel
// that.dhxLayout._panelForTabs(this._dockCell);
}
}
*/
if (this.className == "dhtmlxLayoutSinglePoly") { this.hideHeader(); }
//
this.tabbar = new dhtmlXTabBar(obj.id, mode||"top", 20);
if (!this._isWindow)
this.tabbar._s.expand = true;
this.tabbar.setSkin(this.skin);
/*
if ((_isIE)&&(document.compatMode == "BackCompat")){
this.tabbar._lineAHeight=this.tabbar._lineA.style.height="6px";
this.tabbar._bFix=5;
} else{
this.tabbar._lineAHeight=this.tabbar._lineA.style.height="4px";
this.tabbar._bFix=4;
}
*/
//this.tabbar.setSkin("dhx_blue");
//this.tabbar.enableScroll(false)
//this.tabbar._conZone.style.borderWidth="0px";
//this.tabbar._EARS = true;
//this.tabbar.setMargin(-1)
//this.tabbar.setOffset(0)
this.tabbar.adjustOuterSize();
this.tabbarId = obj.id;
this.tabbarObj = obj;
return this.tabbar;
}
/**
* @desc: attaches a dhtmlxFolders to a window
* @type: public
*/
this.obj.attachFolders = function() {
if (this._isWindow && this.skin == "dhx_skyblue") {
this.dhxcont.mainCont.style.border = "#a4bed4 1px solid";
this._redraw();
}
var obj = document.createElement("DIV");
obj.id = "dhxFoldersObj_"+this._genStr(12);
obj.style.width = "100%";
obj.style.height = "100%";
obj.style.overflow = "hidden";
obj.cmp = "folders";
document.body.appendChild(obj);
this.attachObject(obj.id);
this.folders = new dhtmlxFolders(obj.id);
this.folders.setSizes();
this.foldersId = obj.id;
this.foldersObj = obj;
return this.folders;
}
/**
* @desc: attaches a dhtmlxAccordion to a window
* @type: public
*/
this.obj.attachAccordion = function() {
if (this._isWindow && this.skin == "dhx_skyblue") {
this.dhxcont.mainCont.style.border = "#a4bed4 1px solid";
this._redraw();
}
var obj = document.createElement("DIV");
obj.id = "dhxAccordionObj_"+this._genStr(12);
obj.style.left = "-1px";
obj.style.top = "-1px";
obj.style.width = parseInt(this.dhxcont.mainCont.style.width)+2+"px";
obj.style.height = parseInt(this.dhxcont.mainCont.style.height)+2+"px";
//
obj.style.position = "relative";
obj.cmp = "accordion";
document.body.appendChild(obj);
this.attachObject(obj.id);
this.accordion = new dhtmlXAccordion(obj.id, this.skin);
// win._content.childNodes[2].className += " dhtmlxAccordionAttached";
this.accordion.setSizes();
this.accordionId = obj.id;
this.accordionObj = obj;
return this.accordion;
}
/**
* @desc: attaches a dhtmlxLayout to a window
* @param: view - layout's pattern
* @param: skin - layout's skin
* @type: public
*/
this.obj.attachLayout = function(view, skin) {
// attach layout to layout
if (this._isCell && this.skin == "dhx_skyblue") {
this.hideHeader();
this.dhxcont.style.border = "0px solid white";
this.adjustContent(this.childNodes[0], 0);
}
var obj = document.createElement("DIV");
obj.id = "dhxLayoutObj_"+this._genStr(12);
obj.style.overflow = "hidden";
obj.style.position = "absolute";
obj.style.left = "0px";
obj.style.top = "0px";
obj.style.width = parseInt(this.dhxcont.mainCont.style.width)+"px";
obj.style.height = parseInt(this.dhxcont.mainCont.style.height)+"px";
if (this._isAcc && this.skin == "dhx_skyblue") {
obj.style.left = "-1px";
obj.style.top = "-1px";
obj.style.width = parseInt(this.dhxcont.mainCont.style.width)+2+"px";
obj.style.height = parseInt(this.dhxcont.mainCont.style.height)+2+"px";
}
// needed for layout's init
obj.dhxContExists = true;
obj.cmp = "layout";
document.body.appendChild(obj);
this.attachObject(obj.id);
this.layout = new dhtmlXLayoutObject(obj, view, this.skin);
// window/layout events configuration
if (this._isWindow) this.attachEvent("_onBeforeTryResize", this.layout._defineWindowMinDimension);
this.layoutId = obj.id;
this.layoutObj = obj;
// this.adjust();
return this.layout;
}
/**
* @desc: attaches a dhtmlxEditor to a window
* @param: skin - not mandatory, editor's skin
* @type: public
*/
this.obj.attachEditor = function(skin) {
if (this._isWindow && this.skin == "dhx_skyblue") {
this.dhxcont.mainCont.style.border = "#a4bed4 1px solid";
this._redraw();
}
var obj = document.createElement("DIV");
obj.id = "dhxEditorObj_"+this._genStr(12);
obj.style.position = "relative";
obj.style.display = "none";
obj.style.overflow = "hidden";
obj.style.width = "100%";
obj.style.height = "100%";
obj.cmp = "editor";
document.body.appendChild(obj);
//
this.attachObject(obj.id);
//
this.editor = new dhtmlXEditor(obj.id, this.skin);
this.editorId = obj.id;
this.editorObj = obj;
return this.editor;
}
/**
* @desc: attaches an object into a window
* @param: obj - object or object id
* @param: autoSize - set true to adjust a window to object's dimension
* @type: public
*/
this.obj.attachObject = function(obj, autoSize) {
if (typeof(obj) == "string") obj = document.getElementById(obj);
if (autoSize) {
obj.style.visibility = "hidden";
obj.style.display = "";
var objW = obj.offsetWidth;
var objH = obj.offsetHeight;
}
this._attachContent("obj", obj);
if (autoSize && this._isWindow) {
obj.style.visibility = "visible";
this._adjustToContent(objW, objH);
/* this._engineAdjustWindowToContent(this, objW, objH); */
}
}
/**
*
*
*/
this.obj.detachObject = function(remove) {
// detach dhtmlx components
var pref = null;
if (this.tree) pref = "tree";
if (this.grid) pref = "grid";
if (this.layout) pref = "layout";
if (this.tabbar) pref = "tabbar";
if (this.accordion) pref = "accordion";
if (this.folders) pref = "folders";
if (pref != null) {
var objHandler = null;
var objLink = null;
if (remove == true) {
// completely remove
if (this[pref].unload) this[pref].unload();
if (this[pref].destructor) this[pref].destructor();
while (this[pref+"Obj"].childNodes.length > 0) this[pref+"Obj"].removeChild(this[pref+"Obj"].childNodes[0]);
} else {
// attach to body
document.body.appendChild(this[pref+"Obj"]);
this[pref+"Obj"].style.display = "none";
objHandler = this[pref];
objLink = this[pref+"Obj"];
}
this[pref] = null;
this[pref+"Id"] = null;
this[pref+"Obj"] = null;
return new Array(objHandler, objLink);
}
// detach any other content
var objA = this.dhxcont.childNodes[0];
while (objA.childNodes.length > 0) {
if (remove == true) {
objA.removeChild(objA.childNodes[0]);
} else {
var obj = objA.childNodes[0];
document.body.appendChild(obj);
obj.style.display = "none";
}
}
}
/**
* @desc: appends an object into a window
* @param: obj - object or object id
* @type: public
*/
this.obj.appendObject = function(obj) {
if (typeof(obj) == "string") { obj = document.getElementById(obj); }
this._attachContent("obj", obj, true);
}
/**
* @desc: attaches an html string as an object into a window
* @param: str - html string
* @type: public
*/
this.obj.attachHTMLString = function(str) {
this._attachContent("str", str);
var z=str.match(/