dhtmlxcontainer.js 43 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207
  1. //v.2.6 build 100722
  2. /*
  3. Copyright DHTMLX LTD. http://www.dhtmlx.com
  4. To use this component please contact sales@dhtmlx.com to obtain license
  5. */
  6. /*
  7. Change log:
  8. --02-14-2014--
  9. *change all window border from "#a4bed4 1px solid" to ""
  10. */
  11. function dhtmlXContainer(obj) {
  12. var that = this;
  13. this.obj = obj;
  14. this.dhxcont = null;
  15. this.st = document.createElement("DIV");
  16. this.st.style.position = "absolute";
  17. this.st.style.left = "-200px";
  18. this.st.style.top = "0px";
  19. this.st.style.width = "100px";
  20. this.st.style.height = "1px";
  21. this.st.style.visibility = "hidden";
  22. this.st.style.overflow = "hidden";
  23. document.body.insertBefore(this.st, document.body.childNodes[0]);
  24. this.obj._getSt = function() {
  25. // return this.st object, needed for content moving
  26. return that.st;
  27. }
  28. this.obj.dv = "def"; // default
  29. this.obj.av = this.obj.dv; // active for usage
  30. this.obj.cv = this.obj.av; // current opened
  31. this.obj.vs = {}; // all
  32. this.obj.vs[this.obj.av] = {};
  33. this.obj.view = function(name) {
  34. if (!this.vs[name]) {
  35. this.vs[name] = {};
  36. this.vs[name].dhxcont = this.vs[this.dv].dhxcont;
  37. var mainCont = document.createElement("DIV");
  38. mainCont.style.position = "relative";
  39. mainCont.style.left = "0px";
  40. mainCont.style.width = "200px";
  41. mainCont.style.height = "200px";
  42. mainCont.style.overflow = "hidden";
  43. that.st.appendChild(mainCont);
  44. this.vs[name].dhxcont.mainCont[name] = mainCont;
  45. }
  46. this.avt = this.av;
  47. this.av = name;
  48. return this;
  49. }
  50. this.obj.setActive = function() {
  51. if (!this.vs[this.av]) return;
  52. this.cv = this.av;
  53. // detach current content
  54. if (this.vs[this.avt].dhxcont == this.vs[this.avt].dhxcont.mainCont[this.avt].parentNode) {
  55. that.st.appendChild(this.vs[this.avt].dhxcont.mainCont[this.avt]);
  56. if (this.vs[this.avt].menu) that.st.appendChild(document.getElementById(this.vs[this.avt].menuId));
  57. if (this.vs[this.avt].toolbar) that.st.appendChild(document.getElementById(this.vs[this.avt].toolbarId));
  58. if (this.vs[this.avt].sb) that.st.appendChild(document.getElementById(this.vs[this.avt].sbId));
  59. }
  60. // adjust content
  61. if (this._isCell) {
  62. //this.adjustContent(this.childNodes[0], (this._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));
  63. }
  64. //this.vs[this.av].dhxcont.mainCont[this.av].style.width = this.vs[this.av].dhxcont.mainCont[this.avt].style.width;
  65. //this.vs[this.av].dhxcont.mainCont[this.av].style.height = this.vs[this.av].dhxcont.mainCont[this.avt].style.height;
  66. if (this.vs[this.av].dhxcont != this.vs[this.av].dhxcont.mainCont[this.av].parentNode) {
  67. this.vs[this.av].dhxcont.insertBefore(this.vs[this.av].dhxcont.mainCont[this.av],this.vs[this.av].dhxcont.childNodes[this.vs[this.av].dhxcont.childNodes.length-1]);
  68. if (this.vs[this.av].menu) this.vs[this.av].dhxcont.insertBefore(document.getElementById(this.vs[this.av].menuId), this.vs[this.av].dhxcont.childNodes[0]);
  69. if (this.vs[this.av].toolbar) this.vs[this.av].dhxcont.insertBefore(document.getElementById(this.vs[this.av].toolbarId), this.vs[this.av].dhxcont.childNodes[(this.vs[this.av].menu?1:0)]);
  70. if (this.vs[this.av].sb) this.vs[this.av].dhxcont.insertBefore(document.getElementById(this.vs[this.av].sbId), this.vs[this.av].dhxcont.childNodes[this.vs[this.av].dhxcont.childNodes.length-1]);
  71. }
  72. if (this._doOnResize) this._doOnResize();
  73. this.avt = null;
  74. }
  75. this.obj._viewRestore = function() {
  76. var t = this.av;
  77. if (this.avt) { this.av = this.avt; this.avt = null; }
  78. return t;
  79. }
  80. this.setContent = function(data) {
  81. /*
  82. this.dhxcont = data;
  83. this.dhxcont.innerHTML = "<div style='position: relative; left: 0px; top: 0px; overflow: hidden;'></div>"+
  84. "<div class='dhxcont_content_blocker' style='display: none;'></div>";
  85. this.dhxcont.mainCont = this.dhxcont.childNodes[0];
  86. this.obj.vs[this.obj.av].dhxcont = this.dhxcont;
  87. */
  88. this.obj.vs[this.obj.av].dhxcont = data;
  89. this.obj._init();
  90. }
  91. this.obj._init = function() {
  92. this.vs[this.av].dhxcont.innerHTML = "<div ida='dhxMainCont' style='position: relative; left: 0px; top: 0px; overflow: hidden;'></div>"+
  93. "<div ida='dhxContBlocker' class='dhxcont_content_blocker' style='display: none;'></div>";
  94. this.vs[this.av].dhxcont.mainCont = {};
  95. this.vs[this.av].dhxcont.mainCont[this.av] = this.vs[this.av].dhxcont.childNodes[0];
  96. }
  97. this.obj._genStr = function(w) {
  98. var s = ""; var z = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  99. for (var q=0; q<w; q++) s += z.charAt(Math.round(Math.random() * (z.length-1)));
  100. return s;
  101. }
  102. this.obj.setMinContentSize = function(w, h) {
  103. this.vs[this.av]._minDataSizeW = w;
  104. this.vs[this.av]._minDataSizeH = h;
  105. }
  106. this.obj._setPadding = function(p, altCss) {
  107. if (typeof(p) == "object") {
  108. this._offsetTop = p[0];
  109. this._offsetLeft = p[1];
  110. this._offsetWidth = p[2];
  111. this._offsetHeight = p[3];
  112. } else {
  113. this._offsetTop = p;
  114. this._offsetLeft = p;
  115. this._offsetWidth = -p*2;
  116. this._offsetHeight = -p*2;
  117. }
  118. this.vs[this.av].dhxcont.className = "dhxcont_global_content_area "+(altCss||"");
  119. }
  120. this.obj.moveContentTo = function(cont) {
  121. // move dhtmlx components
  122. for (var a in this.vs) {
  123. cont.view(a).setActive();
  124. var pref = null;
  125. if (this.vs[a].grid) pref = "grid";
  126. if (this.vs[a].tree) pref = "tree";
  127. if (this.vs[a].tabbar) pref = "tabbar";
  128. if (this.vs[a].folders) pref = "folders";
  129. if (this.vs[a].layout) pref = "layout";
  130. if (pref != null) {
  131. cont.view(a).attachObject(this.vs[a][pref+"Id"]);
  132. cont.vs[a][pref] = this.vs[a][pref];
  133. cont.vs[a][pref+"Id"] = this.vs[a][pref+"Id"];
  134. cont.vs[a][pref+"Obj"] = this.vs[a][pref+"Obj"];
  135. this.vs[a][pref] = null;
  136. this.vs[a][pref+"Id"] = null;
  137. this.vs[a][pref+"Obj"] = null;
  138. }
  139. if (this.vs[a]._frame) {
  140. cont.vs[a]._frame = this.vs[a]._frame;
  141. this.vs[a]._frame = null;
  142. }
  143. if (this.vs[a].menu != null) {
  144. if (cont.cv == cont.av) {
  145. cont.vs[cont.av].dhxcont.insertBefore(document.getElementById(this.vs[a].menuId), cont.vs[cont.av].dhxcont.childNodes[0]);
  146. } else {
  147. cont._getSt().appendChild(document.getElementById(this.vs[a].menuId));
  148. }
  149. cont.vs[a].menu = this.vs[a].menu;
  150. cont.vs[a].menuId = this.vs[a].menuId;
  151. cont.vs[a].menuHeight = this.vs[a].menuHeight;
  152. this.vs[a].menu = null;
  153. this.vs[a].menuId = null;
  154. this.vs[a].menuHeight = null;
  155. if (this.cv == this.av && this._doOnAttachMenu) this._doOnAttachMenu("unload");
  156. if (cont.cv == cont.av && cont._doOnAttachMenu) cont._doOnAttachMenu("move");
  157. }
  158. if (this.vs[a].toolbar != null) {
  159. if (cont.cv == cont.av) {
  160. cont.vs[cont.av].dhxcont.insertBefore(document.getElementById(this.vs[a].toolbarId), cont.vs[cont.av].dhxcont.childNodes[(cont.vs[cont.av].menu!=null?1:0)]);
  161. } else {
  162. cont._getSt().appendChild(document.getElementById(this.vs[a].toolbarId));
  163. }
  164. cont.vs[a].toolbar = this.vs[a].toolbar;
  165. cont.vs[a].toolbarId = this.vs[a].toolbarId;
  166. cont.vs[a].toolbarHeight = this.vs[a].toolbarHeight;
  167. this.vs[a].toolbar = null;
  168. this.vs[a].toolbarId = null;
  169. this.vs[a].toolbarHeight = null;
  170. if (this.cv == this.av && this._doOnAttachToolbar) this._doOnAttachToolbar("unload");
  171. if (cont.cv == cont.av && cont._doOnAttachToolbar) cont._doOnAttachToolbar("move");
  172. }
  173. if (this.vs[a].sb != null) {
  174. if (cont.cv == cont.av) {
  175. cont.vs[cont.av].dhxcont.insertBefore(document.getElementById(this.vs[a].sbId), cont.vs[cont.av].dhxcont.childNodes[cont.vs[cont.av].dhxcont.childNodes.length-1]);
  176. } else {
  177. cont._getSt().appendChild(document.getElementById(this.vs[a].sbId));
  178. }
  179. cont.vs[a].sb = this.vs[a].sb;
  180. cont.vs[a].sbId = this.vs[a].sbId;
  181. cont.vs[a].sbHeight = this.vs[a].sbHeight;
  182. this.vs[a].sb = null;
  183. this.vs[a].sbId = null;
  184. this.vs[a].sbHeight = null;
  185. if (this.cv == this.av && this._doOnAttachStatusBar) this._doOnAttachStatusBar("unload");
  186. if (cont.cv == cont.av && cont._doOnAttachStatusBar) cont._doOnAttachStatusBar("move");
  187. }
  188. var objA = this.vs[a].dhxcont.mainCont[a];
  189. var objB = cont.vs[a].dhxcont.mainCont[a];
  190. while (objA.childNodes.length > 0) objB.appendChild(objA.childNodes[0]);
  191. //this.vs[a] = null;
  192. }
  193. cont.view(this.av).setActive();
  194. }
  195. this.obj.adjustContent = function(parentObj, offsetTop, marginTop, notCalcWidth, offsetBottom) {
  196. this.vs[this.av].dhxcont.style.left = (this._offsetLeft||0)+"px";
  197. this.vs[this.av].dhxcont.style.top = (this._offsetTop||0)+offsetTop+"px";
  198. //
  199. var cw = parentObj.clientWidth+(this._offsetWidth||0);
  200. if (notCalcWidth !== true) this.vs[this.av].dhxcont.style.width = Math.max(0, cw)+"px";
  201. if (notCalcWidth !== true) if (this.vs[this.av].dhxcont.offsetWidth > cw) this.vs[this.av].dhxcont.style.width = Math.max(0, cw*2-this.vs[this.av].dhxcont.offsetWidth)+"px";
  202. //
  203. var ch = parentObj.clientHeight+(this._offsetHeight||0);
  204. this.vs[this.av].dhxcont.style.height = Math.max(0, ch-offsetTop)+(marginTop!=null?marginTop:0)+"px";
  205. if (this.vs[this.av].dhxcont.offsetHeight > ch - offsetTop) this.vs[this.av].dhxcont.style.height = Math.max(0, (ch-offsetTop)*2-this.vs[this.av].dhxcont.offsetHeight)+"px";
  206. if (offsetBottom) if (!isNaN(offsetBottom)) this.vs[this.av].dhxcont.style.height = Math.max(0, parseInt(this.vs[this.av].dhxcont.style.height)-offsetBottom)+"px";
  207. // main window content
  208. if (this.vs[this.av]._minDataSizeH != null) {
  209. // height for menu/toolbar/status bar should be included
  210. if (parseInt(this.vs[this.av].dhxcont.style.height) < this.vs[this.av]._minDataSizeH) this.vs[this.av].dhxcont.style.height = this.vs[this.av]._minDataSizeH+"px";
  211. }
  212. if (this.vs[this.av]._minDataSizeW != null) {
  213. if (parseInt(this.vs[this.av].dhxcont.style.width) < this.vs[this.av]._minDataSizeW) this.vs[this.av].dhxcont.style.width = this.vs[this.av]._minDataSizeW+"px";
  214. }
  215. if (notCalcWidth !== true) {
  216. this.vs[this.av].dhxcont.mainCont[this.av].style.width = this.vs[this.av].dhxcont.clientWidth+"px";
  217. // allow border to this.dhxcont.mainCont
  218. if (this.vs[this.av].dhxcont.mainCont[this.av].offsetWidth > this.vs[this.av].dhxcont.clientWidth) this.vs[this.av].dhxcont.mainCont[this.av].style.width = Math.max(0, this.vs[this.av].dhxcont.clientWidth*2-this.vs[this.av].dhxcont.mainCont[this.av].offsetWidth)+"px";
  219. }
  220. var menuOffset = (this.vs[this.av].menu!=null?(!this.vs[this.av].menuHidden?this.vs[this.av].menuHeight:0):0);
  221. var toolbarOffset = (this.vs[this.av].toolbar!=null?(!this.vs[this.av].toolbarHidden?this.vs[this.av].toolbarHeight:0):0);
  222. var statusOffset = (this.vs[this.av].sb!=null?(!this.vs[this.av].sbHidden?this.vs[this.av].sbHeight:0):0);
  223. // allow border to this.dhxcont.mainCont
  224. this.vs[this.av].dhxcont.mainCont[this.av].style.height = this.vs[this.av].dhxcont.clientHeight+"px";
  225. if (this.vs[this.av].dhxcont.mainCont[this.av].offsetHeight > this.vs[this.av].dhxcont.clientHeight) this.vs[this.av].dhxcont.mainCont[this.av].style.height = Math.max(0, this.vs[this.av].dhxcont.clientHeight*2-this.vs[this.av].dhxcont.mainCont[this.av].offsetHeight)+"px";
  226. this.vs[this.av].dhxcont.mainCont[this.av].style.height = Math.max(0, parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)-menuOffset-toolbarOffset-statusOffset)+"px";
  227. }
  228. this.obj.coverBlocker = function() {
  229. return this.vs[this.av].dhxcont.childNodes[this.vs[this.av].dhxcont.childNodes.length-1];
  230. }
  231. this.obj.showCoverBlocker = function() {
  232. this.coverBlocker().style.display = "";
  233. }
  234. this.obj.hideCoverBlocker = function() {
  235. this.coverBlocker().style.display = "none";
  236. }
  237. this.obj.updateNestedObjects = function() {
  238. if (this.vs[this.av].grid) { this.vs[this.av].grid.setSizes(); }
  239. if (this.vs[this.av].sched) { this.vs[this.av].sched.setSizes(); }
  240. if (this.vs[this.av].tabbar) {
  241. this.vs[this.av].tabbar.adjustOuterSize();
  242. }
  243. if (this.vs[this.av].folders) { this.vs[this.av].folders.setSizes(); }
  244. if (this.vs[this.av].editor) {
  245. if (!_isIE) this.vs[this.av].editor._prepareContent(true);
  246. this.vs[this.av].editor.setSizes();
  247. }
  248. //if (_isOpera) { var t = this; window.setTimeout(function(){t.editor.adjustSize();},10); } else { this.vs[this.av].editor.adjustSize(); } }
  249. if (this.vs[this.av].layout) {
  250. if (this.vs[this.av]._isAcc && this.vs[this.av].skin == "dhx_skyblue") {
  251. this.vs[this.av].layoutObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+2+"px";
  252. this.vs[this.av].layoutObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+2+"px";
  253. } else {
  254. this.vs[this.av].layoutObj.style.width = this.vs[this.av].dhxcont.mainCont[this.av].style.width;
  255. this.vs[this.av].layoutObj.style.height = this.vs[this.av].dhxcont.mainCont[this.av].style.height;
  256. }
  257. this.vs[this.av].layout.setSizes();
  258. }
  259. if (this.vs[this.av].accordion != null) {
  260. if (this.vs[this.av].skin == "dhx_web") {
  261. this.vs[this.av].accordionObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+"px";
  262. this.vs[this.av].accordionObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+"px";
  263. } else {
  264. this.vs[this.av].accordionObj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+2+"px";
  265. this.vs[this.av].accordionObj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+2+"px";
  266. }
  267. this.vs[this.av].accordion.setSizes();
  268. }
  269. // docked layout's cell
  270. if (this.vs[this.av].dockedCell) { this.vs[this.av].dockedCell.updateNestedObjects(); }
  271. /*
  272. if (win.accordion != null) { win.accordion.setSizes(); }
  273. if (win.layout != null) { win.layout.setSizes(win); }
  274. */
  275. if (this.vs[this.av].form) this.vs[this.av].form.setSizes();
  276. }
  277. /**
  278. * @desc: attaches a status bar to a window
  279. * @type: public
  280. */
  281. this.obj.attachStatusBar = function() {
  282. if (this.vs[this.av].sb) return;
  283. var sbObj = document.createElement("DIV");
  284. if (this._isCell) {
  285. sbObj.className = "dhxcont_sb_container_layoutcell";
  286. } else {
  287. sbObj.className = "dhxcont_sb_container";
  288. }
  289. sbObj.id = "sbobj_"+this._genStr(12);
  290. sbObj.innerHTML = "<div class='dhxcont_statusbar'></div>";
  291. if (this.cv == this.av) this.vs[this.av].dhxcont.insertBefore(sbObj, this.vs[this.av].dhxcont.childNodes[this.vs[this.av].dhxcont.childNodes.length-1]); else that.st.appendChild(sbObj);
  292. sbObj.setText = function(text) { this.childNodes[0].innerHTML = text; }
  293. sbObj.getText = function() { return this.childNodes[0].innerHTML; }
  294. sbObj.onselectstart = function(e) { e=e||event; e.returnValue=false; return false; }
  295. this.vs[this.av].sb = sbObj;
  296. this.vs[this.av].sbHeight = (this.skin=="dhx_web"?41:(this.skin=="dhx_skyblue"?23:sbObj.offsetHeight));
  297. this.vs[this.av].sbId = sbObj.id;
  298. if (this._doOnAttachStatusBar) this._doOnAttachStatusBar("init");
  299. this.adjust();
  300. return this.vs[this._viewRestore()].sb;
  301. }
  302. /**
  303. * @desc: detaches a status bar from a window
  304. * @type: public
  305. */
  306. this.obj.detachStatusBar = function() {
  307. if (!this.vs[this.av].sb) return;
  308. this.vs[this.av].sb.setText = null;
  309. this.vs[this.av].sb.getText = null;
  310. this.vs[this.av].sb.onselectstart = null;
  311. this.vs[this.av].sb.parentNode.removeChild(this.vs[this.av].sb);
  312. this.vs[this.av].sb = null;
  313. this.vs[this.av].sbHeight = null;
  314. this.vs[this.av].sbId = null;
  315. this._viewRestore();
  316. if (this._doOnAttachStatusBar) this._doOnAttachStatusBar("unload");
  317. }
  318. this.obj.getFrame = function(){
  319. return this.getView()._frame;
  320. };
  321. this.obj.getView = function(name){
  322. return this.vs[name||this.av];
  323. };
  324. /**
  325. * @desc: attaches a dhtmlxMenu to a window
  326. * @type: public
  327. */
  328. this.obj.attachMenu = function(skin) {
  329. if (this.vs[this.av].menu) return;
  330. var menuObj = document.createElement("DIV");
  331. menuObj.style.position = "relative";
  332. menuObj.style.overflow = "hidden";
  333. menuObj.id = "dhxmenu_"+this._genStr(12);
  334. if (this.cv == this.av) this.vs[this.av].dhxcont.insertBefore(menuObj, this.vs[this.av].dhxcont.childNodes[0]); else that.st.appendChild(menuObj);
  335. this.vs[this.av].menu = new dhtmlXMenuObject(menuObj.id, (skin||this.skin));
  336. this.vs[this.av].menuHeight = (this.skin=="dhx_web"?29:menuObj.offsetHeight);
  337. this.vs[this.av].menuId = menuObj.id;
  338. if (this._doOnAttachMenu) this._doOnAttachMenu("init");
  339. this.adjust();
  340. return this.vs[this._viewRestore()].menu;
  341. }
  342. /**
  343. * @desc: detaches a dhtmlxMenu from a window
  344. * @type: public
  345. */
  346. this.obj.detachMenu = function() {
  347. if (!this.vs[this.av].menu) return;
  348. var menuObj = document.getElementById(this.vs[this.av].menuId);
  349. this.vs[this.av].menu.unload();
  350. this.vs[this.av].menu = null;
  351. this.vs[this.av].menuId = null;
  352. this.vs[this.av].menuHeight = null;
  353. menuObj.parentNode.removeChild(menuObj);
  354. menuObj = null;
  355. this._viewRestore();
  356. if (this._doOnAttachMenu) this._doOnAttachMenu("unload");
  357. }
  358. /**
  359. * @desc: attaches a dhtmlxToolbar to a window
  360. * @type: public
  361. */
  362. this.obj.attachToolbar = function(skin) {
  363. if (this.vs[this.av].toolbar) return;
  364. var toolbarObj = document.createElement("DIV");
  365. toolbarObj.style.position = "relative";
  366. toolbarObj.style.overflow = "hidden";
  367. toolbarObj.id = "dhxtoolbar_"+this._genStr(12);
  368. if (this.cv == this.av) this.vs[this.av].dhxcont.insertBefore(toolbarObj, this.vs[this.av].dhxcont.childNodes[(this.vs[this.av].menu!=null?1:0)]); else that.st.appendChild(toolbarObj);
  369. this.vs[this.av].toolbar = new dhtmlXToolbarObject(toolbarObj.id, (skin||this.skin));
  370. this.vs[this.av].toolbarHeight = (this.skin=="dhx_web"?41:toolbarObj.offsetHeight+(this._isLayout&&this.skin=="dhx_skyblue"?2:0));
  371. this.vs[this.av].toolbarId = toolbarObj.id;
  372. if (this._doOnAttachToolbar) this._doOnAttachToolbar("init");
  373. this.adjust();
  374. return this.vs[this._viewRestore()].toolbar;
  375. }
  376. /**
  377. * @desc: detaches a dhtmlxToolbar from a window
  378. * @type: public
  379. */
  380. this.obj.detachToolbar = function() {
  381. if (!this.vs[this.av].toolbar) return;
  382. var toolbarObj = document.getElementById(this.vs[this.av].toolbarId);
  383. this.vs[this.av].toolbar.unload();
  384. this.vs[this.av].toolbar = null;
  385. this.vs[this.av].toolbarId = null;
  386. this.vs[this.av].toolbarHeight = null;
  387. toolbarObj.parentNode.removeChild(toolbarObj);
  388. toolbarObj = null;
  389. this._viewRestore();
  390. if (this._doOnAttachToolbar) this._doOnAttachToolbar("unload");
  391. }
  392. /**
  393. * @desc: attaches a dhtmlxGrid to a window
  394. * @type: public
  395. */
  396. this.obj.attachGrid = function() {
  397. if (this._isWindow && this.skin == "dhx_skyblue") {
  398. this.vs[this.av].dhxcont.mainCont[this.av].style.border = "";//#a4bed4 1px solid
  399. this._redraw();
  400. }
  401. var obj = document.createElement("DIV");
  402. obj.id = "dhxGridObj_"+this._genStr(12);
  403. obj.style.width = "100%";
  404. obj.style.height = "100%";
  405. obj.cmp = "grid";
  406. document.body.appendChild(obj);
  407. this.attachObject(obj.id, false, true);
  408. this.vs[this.av].grid = new dhtmlXGridObject(obj.id);
  409. this.vs[this.av].grid.setSkin(this.skin);
  410. if (this.skin != "dhx_web") {
  411. this.vs[this.av].grid.entBox.style.border = "0px solid white";
  412. this.vs[this.av].grid._sizeFix=0;
  413. }
  414. this.vs[this.av].gridId = obj.id;
  415. this.vs[this.av].gridObj = obj;
  416. return this.vs[this._viewRestore()].grid;
  417. }
  418. /**
  419. * @desc: attaches a dhtmlxScheduler to a window
  420. * @type: public
  421. */
  422. this.obj.attachScheduler = function(day,mode) {
  423. var obj = document.createElement("DIV");
  424. obj.id = "dhxSchedObj_"+this._genStr(12);
  425. obj.innerHTML = '<div id="'+obj.id+'" class="dhx_cal_container" style="width:100%; height:100%;"><div class="dhx_cal_navline"><div class="dhx_cal_prev_button">&nbsp;</div><div class="dhx_cal_next_button">&nbsp;</div><div class="dhx_cal_today_button"></div><div class="dhx_cal_date"></div><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></div><div class="dhx_cal_header"></div><div class="dhx_cal_data"></div></div>';
  426. document.body.appendChild(obj.firstChild);
  427. this.attachObject(obj.id, false, true);
  428. this.vs[this.av].sched = scheduler;
  429. this.vs[this.av].schedId = obj.id;
  430. scheduler.setSizes = scheduler.update_view;
  431. scheduler.destructor=function(){};
  432. scheduler.init(obj.id,day,mode);
  433. return this.vs[this._viewRestore()].sched;
  434. }
  435. /**
  436. * @desc: attaches a dhtmlxTree to a window
  437. * @param: rootId - not mandatory, tree super root, see dhtmlxTree documentation for details
  438. * @type: public
  439. */
  440. this.obj.attachTree = function(rootId) {
  441. if (this._isWindow && this.skin == "dhx_skyblue") {
  442. this.vs[this.av].dhxcont.mainCont[this.av].style.border = "";
  443. this._redraw();
  444. }
  445. var obj = document.createElement("DIV");
  446. obj.id = "dhxTreeObj_"+this._genStr(12);
  447. obj.style.width = "100%";
  448. obj.style.height = "100%";
  449. obj.cmp = "tree";
  450. document.body.appendChild(obj);
  451. this.attachObject(obj.id, false, true);
  452. this.vs[this.av].tree = new dhtmlXTreeObject(obj.id, "100%", "100%", (rootId||0));
  453. this.vs[this.av].tree.setSkin(this.skin);
  454. // this.tree.allTree.style.paddingTop = "2px";
  455. this.vs[this.av].tree.allTree.childNodes[0].style.marginTop = "2px";
  456. this.vs[this.av].tree.allTree.childNodes[0].style.marginBottom = "2px";
  457. this.vs[this.av].treeId = obj.id;
  458. this.vs[this.av].treeObj = obj;
  459. return this.vs[this._viewRestore()].tree;
  460. }
  461. /**
  462. * @desc: attaches a dhtmlxTabbar to a window
  463. * @type: public
  464. */
  465. this.obj.attachTabbar = function(mode) {
  466. if (this._isWindow && this.skin == "dhx_skyblue") {
  467. this.vs[this.av].dhxcont.style.border = "none";
  468. this.setDimension(this.w, this.h);
  469. }
  470. var obj = document.createElement("DIV");
  471. obj.id = "dhxTabbarObj_"+this._genStr(12);
  472. obj.style.width = "100%";
  473. obj.style.height = "100%";
  474. obj.style.overflow = "hidden";
  475. obj.cmp = "tabbar";
  476. document.body.appendChild(obj);
  477. this.attachObject(obj.id, false, true);
  478. // manage dockcell if exists
  479. if (this.className == "dhtmlxLayoutSinglePoly") this.hideHeader();
  480. //
  481. this.vs[this.av].tabbar = new dhtmlXTabBar(obj.id, mode||"top", 20);
  482. if (!this._isWindow) this.vs[this.av].tabbar._s.expand = true;
  483. this.vs[this.av].tabbar.setSkin(this.skin);
  484. this.vs[this.av].tabbar.adjustOuterSize();
  485. this.vs[this.av].tabbarId = obj.id;
  486. this.vs[this.av].tabbarObj = obj;
  487. return this.vs[this._viewRestore()].tabbar;
  488. }
  489. /**
  490. * @desc: attaches a dhtmlxFolders to a window
  491. * @type: public
  492. */
  493. this.obj.attachFolders = function() {
  494. if (this._isWindow && this.skin == "dhx_skyblue") {
  495. this.vs[this.av].dhxcont.mainCont[this.av].style.border = "";
  496. this._redraw();
  497. }
  498. var obj = document.createElement("DIV");
  499. obj.id = "dhxFoldersObj_"+this._genStr(12);
  500. obj.style.width = "100%";
  501. obj.style.height = "100%";
  502. obj.style.overflow = "hidden";
  503. obj.cmp = "folders";
  504. document.body.appendChild(obj);
  505. this.attachObject(obj.id, false, true);
  506. this.vs[this.av].folders = new dhtmlxFolders(obj.id);
  507. this.vs[this.av].folders.setSizes();
  508. this.vs[this.av].foldersId = obj.id;
  509. this.vs[this.av].foldersObj = obj;
  510. return this.vs[this._viewRestore()].folders;
  511. }
  512. /**
  513. * @desc: attaches a dhtmlxAccordion to a window
  514. * @type: public
  515. */
  516. this.obj.attachAccordion = function() {
  517. if (this._isWindow && this.skin == "dhx_skyblue") {
  518. this.vs[this.av].dhxcont.mainCont[this.av].style.border = "";
  519. this._redraw();
  520. }
  521. var obj = document.createElement("DIV");
  522. obj.id = "dhxAccordionObj_"+this._genStr(12);
  523. if (this.skin == "dhx_web") {
  524. obj.style.left = "0px";
  525. obj.style.top = "0px";
  526. obj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+"px";
  527. obj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+"px";
  528. } else {
  529. obj.style.left = "-1px";
  530. obj.style.top = "-1px";
  531. obj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+2+"px";
  532. obj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+2+"px";
  533. }
  534. //
  535. obj.style.position = "relative";
  536. obj.cmp = "accordion";
  537. document.body.appendChild(obj);
  538. this.attachObject(obj.id, false, true);
  539. this.vs[this.av].accordion = new dhtmlXAccordion(obj.id, this.skin);
  540. this.vs[this.av].accordion.setSizes();
  541. this.vs[this.av].accordionId = obj.id;
  542. this.vs[this.av].accordionObj = obj;
  543. return this.vs[this._viewRestore()].accordion;
  544. }
  545. /**
  546. * @desc: attaches a dhtmlxLayout to a window
  547. * @param: view - layout's pattern
  548. * @param: skin - layout's skin
  549. * @type: public
  550. */
  551. this.obj.attachLayout = function(view, skin) {
  552. // attach layout to layout
  553. if (this._isCell && this.skin == "dhx_skyblue") {
  554. this.hideHeader();
  555. this.vs[this.av].dhxcont.style.border = "0px solid white";
  556. this.adjustContent(this.childNodes[0], 0);
  557. }
  558. if (this._isCell && this.skin == "dhx_web") {
  559. this.hideHeader();
  560. }
  561. var obj = document.createElement("DIV");
  562. obj.id = "dhxLayoutObj_"+this._genStr(12);
  563. obj.style.overflow = "hidden";
  564. obj.style.position = "absolute";
  565. obj.style.left = "0px";
  566. obj.style.top = "0px";
  567. obj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+"px";
  568. obj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+"px";
  569. if (this._isAcc && this.skin == "dhx_skyblue") {
  570. obj.style.left = "-1px";
  571. obj.style.top = "-1px";
  572. obj.style.width = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.width)+2+"px";
  573. obj.style.height = parseInt(this.vs[this.av].dhxcont.mainCont[this.av].style.height)+2+"px";
  574. }
  575. // needed for layout's init
  576. obj.dhxContExists = true;
  577. obj.cmp = "layout";
  578. document.body.appendChild(obj);
  579. this.attachObject(obj.id, false, true);
  580. this.vs[this.av].layout = new dhtmlXLayoutObject(obj, view, (skin||this.skin));
  581. // window/layout events configuration
  582. if (this._isWindow) this.attachEvent("_onBeforeTryResize", this.vs[this.av].layout._defineWindowMinDimension);
  583. this.vs[this.av].layoutId = obj.id;
  584. this.vs[this.av].layoutObj = obj;
  585. // this.adjust();
  586. return this.vs[this._viewRestore()].layout;
  587. }
  588. /**
  589. * @desc: attaches a dhtmlxEditor to a window
  590. * @param: skin - not mandatory, editor's skin
  591. * @type: public
  592. */
  593. this.obj.attachEditor = function(skin) {
  594. if (this._isWindow && this.skin == "dhx_skyblue") {
  595. this.vs[this.av].dhxcont.mainCont[this.av].style.border = "";
  596. this._redraw();
  597. }
  598. var obj = document.createElement("DIV");
  599. obj.id = "dhxEditorObj_"+this._genStr(12);
  600. obj.style.position = "relative";
  601. obj.style.display = "none";
  602. obj.style.overflow = "hidden";
  603. obj.style.width = "100%";
  604. obj.style.height = "100%";
  605. obj.cmp = "editor";
  606. document.body.appendChild(obj);
  607. //
  608. this.attachObject(obj.id, false, true);
  609. //
  610. this.vs[this.av].editor = new dhtmlXEditor(obj.id, this.skin);
  611. this.vs[this.av].editorId = obj.id;
  612. this.vs[this.av].editorObj = obj;
  613. return this.vs[this._viewRestore()].editor;
  614. }
  615. this.obj.attachMap = function(opts) {
  616. var obj = document.createElement("DIV");
  617. obj.id = "GMapsObj_"+this._genStr(12);
  618. obj.style.position = "relative";
  619. obj.style.display = "none";
  620. obj.style.overflow = "hidden";
  621. obj.style.width = "100%";
  622. obj.style.height = "100%";
  623. obj.cmp = "gmaps";
  624. document.body.appendChild(obj);
  625. this.attachObject(obj.id, false, true);
  626. if (!opts) opts = {center: new google.maps.LatLng(40.719837,-73.992348), zoom: 11, mapTypeId: google.maps.MapTypeId.ROADMAP};
  627. this.vs[this.av].gmaps = new google.maps.Map(obj, opts);
  628. return this.vs[this.av].gmaps;
  629. }
  630. /**
  631. * @desc: attaches an object into a window
  632. * @param: obj - object or object id
  633. * @param: autoSize - set true to adjust a window to object's dimension
  634. * @type: public
  635. */
  636. this.obj.attachObject = function(obj, autoSize, localCall) {
  637. if (typeof(obj) == "string") obj = document.getElementById(obj);
  638. if (autoSize) {
  639. obj.style.visibility = "hidden";
  640. obj.style.display = "";
  641. var objW = obj.offsetWidth;
  642. var objH = obj.offsetHeight;
  643. }
  644. this._attachContent("obj", obj);
  645. if (autoSize && this._isWindow) {
  646. obj.style.visibility = "visible";
  647. this._adjustToContent(objW, objH);
  648. /* this._engineAdjustWindowToContent(this, objW, objH); */
  649. }
  650. if (!localCall) this._viewRestore();
  651. }
  652. /**
  653. *
  654. *
  655. */
  656. this.obj.detachObject = function(remove, moveTo) {
  657. // detach dhtmlx components
  658. var p = null;
  659. var pObj = null;
  660. var t = ["tree","grid","layout","tabbar","accordion","folders"];
  661. for (var q=0; q<t.length; q++) {
  662. if (this.vs[this.av][t[q]]) {
  663. p = this.vs[this.av][t[q]];
  664. pObj = this.vs[this.av][t[q]+"Obj"];
  665. if (remove) {
  666. if (p.unload) p.unload();
  667. if (p.destructor) p.destructor();
  668. while (pObj.childNodes.length > 0) pObj.removeChild(pObj.childNodes[0]);
  669. pObj.parentNode.removeChild(pObj);
  670. pObj = null;
  671. p = null;
  672. } else {
  673. document.body.appendChild(pObj);
  674. pObj.style.display = "none";
  675. }
  676. this.vs[this.av][t[q]] = null;
  677. this.vs[this.av][t[q]+"Id"] = null;
  678. this.vs[this.av][t[q]+"Obj"] = null;
  679. }
  680. }
  681. if (p != null && pObj != null) return new Array(p, pObj);
  682. // detach any other content
  683. if (remove && this.vs[this.av]._frame) {
  684. this._detachURLEvents();
  685. this.vs[this.av]._frame = null;
  686. }
  687. var objA = this.vs[this.av].dhxcont.mainCont[this.av];
  688. while (objA.childNodes.length > 0) {
  689. if (remove == true) {
  690. // add frame events removing
  691. objA.removeChild(objA.childNodes[0]);
  692. } else {
  693. var obj = objA.childNodes[0];
  694. if (moveTo != null) {
  695. if (typeof(moveTo) != "object") moveTo = document.getElementById(moveTo);
  696. moveTo.appendChild(obj);
  697. } else {
  698. document.body.appendChild(obj);
  699. }
  700. obj.style.display = "none";
  701. }
  702. }
  703. }
  704. /**
  705. * @desc: appends an object into a window
  706. * @param: obj - object or object id
  707. * @type: public
  708. */
  709. this.obj.appendObject = function(obj) {
  710. if (typeof(obj) == "string") { obj = document.getElementById(obj); }
  711. this._attachContent("obj", obj, true);
  712. }
  713. /**
  714. * @desc: attaches an html string as an object into a window
  715. * @param: str - html string
  716. * @type: public
  717. */
  718. this.obj.attachHTMLString = function(str) {
  719. this._attachContent("str", str);
  720. var z=str.match(/<script[^>]*>[^\f]*?<\/script>/g)||[];
  721. for (var i=0; i<z.length; i++){
  722. var s=z[i].replace(/<([\/]{0,1})script[^>]*>/g,"")
  723. if (window.execScript) window.execScript(s);
  724. else window.eval(s);
  725. }
  726. }
  727. /**
  728. * @desc: attaches an url into a window
  729. * @param: url
  730. * @param: ajax - loads an url with ajax
  731. * @type: public
  732. */
  733. this.obj.attachURL = function(url, ajax) {
  734. this._attachContent((ajax==true?"urlajax":"url"), url, false);
  735. this._viewRestore();
  736. }
  737. this.obj.adjust = function() {
  738. if (this.skin == "dhx_skyblue") {
  739. if (this.vs[this.av].menu) {
  740. if (this._isWindow || this._isLayout) {
  741. this.vs[this.av].menu._topLevelOffsetLeft = 0;
  742. document.getElementById(this.vs[this.av].menuId).style.height = "26px";
  743. this.vs[this.av].menuHeight = document.getElementById(this.vs[this.av].menuId).offsetHeight;
  744. if (this._doOnAttachMenu) this._doOnAttachMenu("show");
  745. }
  746. if (this._isCell) {
  747. document.getElementById(this.vs[this.av].menuId).className += " in_layoutcell";
  748. // document.getElementById(this.menuId).style.height = "25px";
  749. this.vs[this.av].menuHeight = 25;
  750. }
  751. if (this._isAcc) {
  752. document.getElementById(this.vs[this.av].menuId).className += " in_acccell";
  753. // document.getElementById(this.menuId).style.height = "25px";
  754. this.vs[this.av].menuHeight = 25;
  755. }
  756. if (this._doOnAttachMenu) this._doOnAttachMenu("adjust");
  757. }
  758. if (this.vs[this.av].toolbar) {
  759. if (this._isWindow || this._isLayout) {
  760. document.getElementById(this.vs[this.av].toolbarId).style.height = "29px";
  761. this.vs[this.av].toolbarHeight = document.getElementById(this.vs[this.av].toolbarId).offsetHeight;
  762. if (this._doOnAttachToolbar) this._doOnAttachToolbar("show");
  763. }
  764. if (this._isCell) {
  765. document.getElementById(this.vs[this.av].toolbarId).className += " in_layoutcell";
  766. }
  767. if (this._isAcc) {
  768. document.getElementById(this.vs[this.av].toolbarId).className += " in_acccell";
  769. }
  770. }
  771. }
  772. if (this.skin == "dhx_web") {
  773. }
  774. }
  775. // attach content obj|url
  776. this.obj._attachContent = function(type, obj, append) {
  777. // clear old content
  778. if (append !== true) {
  779. if (this.vs[this.av]._frame) {
  780. this._detachURLEvents();
  781. this.vs[this.av]._frame = null;
  782. }
  783. while (this.vs[this.av].dhxcont.mainCont[this.av].childNodes.length > 0) this.vs[this.av].dhxcont.mainCont[this.av].removeChild(this.vs[this.av].dhxcont.mainCont[this.av].childNodes[0]);
  784. }
  785. // attach
  786. if (type == "url") {
  787. if (this._isWindow && obj.cmp == null && this.skin == "dhx_skyblue") {
  788. this.vs[this.av].dhxcont.mainCont[this.av].style.border = "";
  789. this._redraw();
  790. }
  791. var fr = document.createElement("IFRAME");
  792. fr.allowfullscreen=true;
  793. fr.frameBorder = 0;
  794. fr.border = 0;
  795. fr.allowfullscreen=true;
  796. fr.style.width = "100%";
  797. fr.style.height = "100%";
  798. fr.setAttribute("src","javascript:false;");
  799. this.vs[this.av].dhxcont.mainCont[this.av].appendChild(fr);
  800. fr.src = obj;
  801. fr.wdDialogId=this.idd;//for ie
  802. if(fr.dataset){//for chrome
  803. fr.dataset['wdDialogId'] = this.idd;
  804. }
  805. // ?? this._frame = fr;
  806. this.vs[this.av]._frame = fr;
  807. this._attachURLEvents();
  808. } else if (type == "urlajax") {
  809. if (this._isWindow && obj.cmp == null && this.skin == "dhx_skyblue") {
  810. this.vs[this.av].dhxcont.mainCont[this.av].style.border = "";//
  811. this.vs[this.av].dhxcont.mainCont[this.av].style.backgroundColor = "#FFFFFF";
  812. this._redraw();
  813. }
  814. var t = this;
  815. var xmlParser = function(){
  816. t.attachHTMLString(this.xmlDoc.responseText, this);
  817. //if (t._doOnAttachURL) t._doOnAttachURL(false);
  818. if (t._doOnFrameContentLoaded) t._doOnFrameContentLoaded();
  819. this.destructor();
  820. }
  821. var xmlLoader = new dtmlXMLLoaderObject(xmlParser, window);
  822. xmlLoader.dhxWindowObject = this;
  823. xmlLoader.loadXML(obj);
  824. } else if (type == "obj") {
  825. if (this._isWindow && obj.cmp == null && this.skin == "dhx_skyblue") {
  826. this.vs[this.av].dhxcont.mainCont[this.av].style.border = "";
  827. this.vs[this.av].dhxcont.mainCont[this.av].style.backgroundColor = "#FFFFFF";
  828. this._redraw();
  829. }
  830. this.vs[this.av].dhxcont._frame = null;
  831. this.vs[this.av].dhxcont.mainCont[this.av].appendChild(obj);
  832. // this._engineGetWindowContent(win).style.overflow = (append===true?"auto":"hidden");
  833. // win._content.childNodes[2].appendChild(obj);
  834. this.vs[this.av].dhxcont.mainCont[this.av].style.overflow = (append===true?"auto":"hidden");
  835. obj.style.display = "";
  836. } else if (type == "str") {
  837. if (this._isWindow && obj.cmp == null && this.skin == "dhx_skyblue") {
  838. this.vs[this.av].dhxcont.mainCont[this.av].style.border = "";
  839. this.vs[this.av].dhxcont.mainCont[this.av].style.backgroundColor = "#FFFFFF";
  840. this._redraw();
  841. }
  842. this.vs[this.av].dhxcont._frame = null;
  843. this.vs[this.av].dhxcont.mainCont[this.av].innerHTML = obj;
  844. }
  845. }
  846. this.obj._attachURLEvents = function() {
  847. var t = this;
  848. var fr = this.vs[this.av]._frame;
  849. if (_isIE) {
  850. fr.onreadystatechange = function(a) {
  851. if (fr.readyState == "complete") {
  852. try {fr.contentWindow.document.body.onmousedown=function(){if(t._doOnFrameMouseDown)t._doOnFrameMouseDown();};}catch(e){};
  853. try{if(t._doOnFrameContentLoaded)t._doOnFrameContentLoaded();}catch(e){};
  854. }
  855. }
  856. } else {
  857. fr.onload = function() {
  858. try{fr.contentWindow.onmousedown=function(){if(t._doOnFrameMouseDown)t._doOnFrameMouseDown();};}catch(e){};
  859. try{if(t._doOnFrameContentLoaded)t._doOnFrameContentLoaded();}catch(e){};
  860. }
  861. }
  862. }
  863. this.obj._detachURLEvents = function() {
  864. if (_isIE) {
  865. try {
  866. this.vs[this.av]._frame.onreadystatechange = null;
  867. this.vs[this.av]._frame.contentWindow.document.body.onmousedown = null;
  868. this.vs[this.av]._frame.onload = null;
  869. } catch(e) {};
  870. } else {
  871. try {
  872. this.vs[this.av]._frame.contentWindow.onmousedown = null;
  873. this.vs[this.av]._frame.onload = null;
  874. } catch(e) {};
  875. }
  876. }
  877. this.obj.showMenu = function() {
  878. if (!(this.vs[this.av].menu && this.vs[this.av].menuId)) return;
  879. if (document.getElementById(this.vs[this.av].menuId).style.display != "none") return;
  880. this.vs[this.av].menuHidden = false;
  881. if (this._doOnAttachMenu) this._doOnAttachMenu("show");
  882. document.getElementById(this.vs[this.av].menuId).style.display = "";
  883. this._viewRestore();
  884. }
  885. this.obj.hideMenu = function() {
  886. if (!(this.vs[this.av].menu && this.vs[this.av].menuId)) return;
  887. if (document.getElementById(this.vs[this.av].menuId).style.display == "none") return;
  888. document.getElementById(this.vs[this.av].menuId).style.display = "none";
  889. this.vs[this.av].menuHidden = true;
  890. if (this._doOnAttachMenu) this._doOnAttachMenu("hide");
  891. this._viewRestore();
  892. }
  893. this.obj.showToolbar = function() {
  894. if (!(this.vs[this.av].toolbar && this.vs[this.av].toolbarId)) return;
  895. if (document.getElementById(this.vs[this.av].toolbarId).style.display != "none") return;
  896. this.vs[this.av].toolbarHidden = false;
  897. if (this._doOnAttachToolbar) this._doOnAttachToolbar("show");
  898. document.getElementById(this.vs[this.av].toolbarId).style.display = "";
  899. this._viewRestore();
  900. }
  901. this.obj.hideToolbar = function() {
  902. if (!(this.vs[this.av].toolbar && this.vs[this.av].toolbarId)) return;
  903. if (document.getElementById(this.vs[this.av].toolbarId).style.display == "none") return;
  904. this.vs[this.av].toolbarHidden = true;
  905. document.getElementById(this.vs[this.av].toolbarId).style.display = "none";
  906. if (this._doOnAttachToolbar) this._doOnAttachToolbar("hide");
  907. this._viewRestore();
  908. }
  909. this.obj.showStatusBar = function() {
  910. if (!(this.vs[this.av].sb && this.vs[this.av].sbId)) return;
  911. if (document.getElementById(this.vs[this.av].sbId).style.display != "none") return;
  912. this.vs[this.av].sbHidden = false;
  913. if (this._doOnAttachStatusBar) this._doOnAttachStatusBar("show");
  914. document.getElementById(this.vs[this.av].sbId).style.display = "";
  915. this._viewRestore();
  916. }
  917. this.obj.hideStatusBar = function() {
  918. if (!(this.vs[this.av].sb && this.vs[this.av].sbId)) return;
  919. if (document.getElementById(this.vs[this.av].sbId).style.display == "none") return;
  920. this.vs[this.av].sbHidden = true;
  921. document.getElementById(this.vs[this.av].sbId).style.display = "none";
  922. if (this._doOnAttachStatusBar) this._doOnAttachStatusBar("hide");
  923. this._viewRestore();
  924. }
  925. this.obj._dhxContDestruct = function() {
  926. // clear attached objects
  927. var av = this.av;
  928. for (var a in this.vs) {
  929. this.av = a;
  930. // menu, toolbar, status
  931. this.detachMenu();
  932. this.detachToolbar();
  933. this.detachStatusBar();
  934. // remove any attached object or dhtmlx component
  935. this.detachObject(true);
  936. this.vs[a].dhxcont.mainCont[a].parentNode.removeChild(this.vs[a].dhxcont.mainCont[a]);
  937. this.vs[a].dhxcont.mainCont[a] = null;
  938. }
  939. this.vs[this.dv].dhxcont.mainCont = null;
  940. this.vs[this.dv].dhxcont.parentNode.removeChild(this.vs[this.dv].dhxcont);
  941. for (var a in this.vs) this.vs[a].dhxcont = null;
  942. this.vs = null;
  943. this.attachMenu = null;
  944. this.attachToolbar = null;
  945. this.attachStatusBar = null;
  946. this.detachMenu = null;
  947. this.detachToolbar = null;
  948. this.detachStatusBar = null;
  949. this.showMenu = null;
  950. this.showToolbar = null;
  951. this.showStatusBar = null;
  952. this.hideMenu = null;
  953. this.hideToolbar = null;
  954. this.hideStatusBar = null;
  955. this.attachGrid = null;
  956. this.attachScheduler = null;
  957. this.attachTree = null;
  958. this.attachTabbar = null;
  959. this.attachFolders = null;
  960. this.attachAccordion = null;
  961. this.attachLayout = null;
  962. this.attachEditor = null;
  963. this.attachObject = null;
  964. this.detachObject = null;
  965. this.appendObject = null;
  966. this.attachHTMLString = null;
  967. this.attachURL = null;
  968. this.view = null;
  969. this.show = null;
  970. this.adjust = null;
  971. this.setMinContentSize = null;
  972. this.moveContentTo = null;
  973. this.adjustContent = null;
  974. this.coverBlocker = null;
  975. this.showCoverBlocker = null;
  976. this.hideCoverBlocker = null;
  977. this.updateNestedObjects = null;
  978. this._attachContent = null;
  979. this._attachURLEvents = null;
  980. this._detachURLEvents = null;
  981. this._viewRestore = null;
  982. this._setPadding = null;
  983. this._init = null;
  984. this._genStr = null;
  985. this._dhxContDestruct = null;
  986. that.st.parentNode.removeChild(that.st);
  987. that.st = null;
  988. that.setContent = null;
  989. that.dhxcont = null; // no more used at all?
  990. that.obj = null;
  991. that = null;
  992. // remove attached components
  993. /*
  994. for (var a in this.vs) {
  995. if (this.vs[a].layout) this.vs[a].layout.unlaod();
  996. if (this.vs[a].accordion) this.vs[a].accordion.unlaod();
  997. if (this.vs[a].sched) this.vs[a].sched.destructor();
  998. this.vs[a].layout = null;
  999. this.vs[a].accordion = null;
  1000. this.vs[a].sched = null;
  1001. }
  1002. */
  1003. // extended functionality
  1004. if (dhtmlx.detaches) for (var a in dhtmlx.detaches) dhtmlx.detaches[a](this);
  1005. }
  1006. // extended functionality
  1007. if (dhtmlx.attaches) for (var a in dhtmlx.attaches) this.obj[a] = dhtmlx.attaches[a];
  1008. }