1 | /**
|
---|
2 | * @desc: constructor, creates dhtmlxlayout panel
|
---|
3 | * @pseudonym: td
|
---|
4 | * @type: public
|
---|
5 | */
|
---|
6 | function dhtmlXLayoutPanel(){
|
---|
7 |
|
---|
8 | }
|
---|
9 |
|
---|
10 | /**
|
---|
11 | * @desc: constructor, creats a new dhtmlXLayout object
|
---|
12 | * @param: base - object/object id, document.body or dhtmlxWindow - the layout will be attached to it
|
---|
13 | * @param: view - layout's pattern
|
---|
14 | * @param: skin - skin
|
---|
15 | * @type: public
|
---|
16 | */
|
---|
17 | function dhtmlXLayoutObject(base, view, skin) {
|
---|
18 |
|
---|
19 | if (!dhtmlXContainer) {
|
---|
20 | alert("dhtmlxcontainer.js is missed on the page");
|
---|
21 | return;
|
---|
22 | }
|
---|
23 |
|
---|
24 | // 1. object/objectId - window without borders
|
---|
25 | // 2. document.body - fullscreened window
|
---|
26 | // 3. window object - simple attach
|
---|
27 |
|
---|
28 | var that = this;
|
---|
29 |
|
---|
30 | this._autodetectSkin = function() {
|
---|
31 | var t = document.createElement("DIV");
|
---|
32 | t.className = "dhxlayout_skin_detect";
|
---|
33 | if (document.body.childNodes.length > 0) document.body.insertBefore(t, document.body.childNodes[0]); else document.body.appendChild(t);
|
---|
34 | var w = t.offsetWidth;
|
---|
35 | document.body.removeChild(t);
|
---|
36 | t = null;
|
---|
37 | if (w == 199) return "dhx_skyblue";
|
---|
38 | if (w == 299) return "dhx_blue";
|
---|
39 | if (w == 399) return "dhx_black";
|
---|
40 | return "dhx_skyblue";
|
---|
41 | }
|
---|
42 |
|
---|
43 | this.skin = (skin!=null?skin:this._autodetectSkin());
|
---|
44 |
|
---|
45 | this.setSkin = function(skin) {
|
---|
46 | if (!this.skinParams[skin]) return;
|
---|
47 | this.skin = skin;
|
---|
48 | // params
|
---|
49 | this._CPanelHeight = this.skinParams[this.skin]["cpanel_height"];
|
---|
50 | this._collapsedW = this.skinParams[this.skin]["cpanel_collapsed_width"];
|
---|
51 | this._collapsedH = this.skinParams[this.skin]["cpanel_collapsed_height"];
|
---|
52 | // classes
|
---|
53 | this.tpl.className = "dhtmlxLayoutPolyContainer_"+this.skin+(this._r?" dhxlayout_rtl":"");
|
---|
54 | this.sizer.className = "dhxLayout_Sizer_"+this.skin;
|
---|
55 | // windows
|
---|
56 | if (this.dhxWins) this.dhxWins.setSkin(this.skin);
|
---|
57 | // progress
|
---|
58 | // container
|
---|
59 | for (var a in this.polyObj) this.polyObj[a].skin = this.skin;
|
---|
60 | this.base.skin = this.skin;
|
---|
61 | // icons
|
---|
62 | this._fixIcons();
|
---|
63 | // cells
|
---|
64 | this.setSizes();
|
---|
65 | }
|
---|
66 |
|
---|
67 | this._dblClickTM = 200;
|
---|
68 |
|
---|
69 | this._mTop = 0;
|
---|
70 | this._mBottom = 0;
|
---|
71 |
|
---|
72 | if (typeof(base) == "string") { base = document.getElementById(base); }
|
---|
73 |
|
---|
74 | // check if window/layout
|
---|
75 | if ((base._isWindow == true || base._isCell) && !this.base) {
|
---|
76 | if (base._isCell && base.attachLayout) return base.attachLayout(view, skin);
|
---|
77 | // window init
|
---|
78 | if (base.isWindow) return base.attachLayout(view, skin);
|
---|
79 | // attach to window init
|
---|
80 | // layout init
|
---|
81 | this.base = base;
|
---|
82 | }
|
---|
83 | // fulscreen init hide scrolls
|
---|
84 | if (base == document.body && !this.base) {
|
---|
85 | document.body.style.overflow = "hidden";
|
---|
86 | }
|
---|
87 | // object init
|
---|
88 | if ((typeof(base) == "object" || base == document.body) && !this.base) {
|
---|
89 | var contObj = document.createElement("DIV");
|
---|
90 | contObj.className = "dhxcont_global_layout_area";
|
---|
91 |
|
---|
92 | base.appendChild(contObj);
|
---|
93 | base._isLayout = true;
|
---|
94 |
|
---|
95 | this.cont = new dhtmlXContainer(base);
|
---|
96 | this.cont.setContent(contObj);
|
---|
97 |
|
---|
98 | if (base == document.body) {
|
---|
99 | // 2px default margins
|
---|
100 | if (this.skin == "dhx_skyblue") {
|
---|
101 | this.cont.obj._offsetTop = 2;
|
---|
102 | this.cont.obj._offsetLeft = 2;
|
---|
103 | this.cont.obj._offsetHeight = -4;
|
---|
104 | this.cont.obj._offsetWidth = -4;
|
---|
105 | }
|
---|
106 | document.body.className += " dhxlayout_fullscreened";
|
---|
107 | }
|
---|
108 |
|
---|
109 | base.adjustContent(base, this._mTop, null, null, this._mBottom);
|
---|
110 | // this.base = contObj.childNodes[0];
|
---|
111 | this.base = document.createElement("DIV");
|
---|
112 | //this.base.id = "dhxLayoutObj_"+this._genStr(12);
|
---|
113 | this.base.style.overflow = "hidden";
|
---|
114 | this.base.style.position = "absolute";
|
---|
115 | // this._sizerML = 1;
|
---|
116 | // this._sizerMT = 1;
|
---|
117 | /*
|
---|
118 | this.base.style.left = "1px";
|
---|
119 | this.base.style.top = "1px";
|
---|
120 | this.base.style.width = parseInt(contObj.childNodes[0].style.width)-2+"px"; //parseInt(this.dhxcont.childNodes[0].style.width)-2+"px";
|
---|
121 | this.base.style.height = parseInt(contObj.childNodes[0].style.height)-2+"px"; //parseInt(this.dhxcont.childNodes[0].style.height)-2+"px";
|
---|
122 |
|
---|
123 | this._baseWFix = -2;
|
---|
124 | this._baseHFix = -2;
|
---|
125 | */
|
---|
126 | this.base.style.left = "0px";
|
---|
127 | this.base.style.top = "0px";
|
---|
128 | this.base.style.width = contObj.childNodes[0].style.width;
|
---|
129 | this.base.style.height = contObj.childNodes[0].style.height;
|
---|
130 |
|
---|
131 | contObj.childNodes[0].appendChild(this.base);
|
---|
132 |
|
---|
133 | if (base == document.body) {
|
---|
134 |
|
---|
135 | // this._sizerML = 0;
|
---|
136 | // this._sizerMT = 0;
|
---|
137 |
|
---|
138 | this._tmTime = null;
|
---|
139 | this._doOnResizeStart = function() {
|
---|
140 | window.clearTimeout(this._tmTime);
|
---|
141 | this._tmTime = window.setTimeout(function(){that._doOnResizeEnd();},200);
|
---|
142 | }
|
---|
143 | this._doOnResizeEnd = function() {
|
---|
144 | var dim = this._defineWindowMinDimension(this.base, true);
|
---|
145 | document.body.setMinContentSize(dim[1], dim[2]);
|
---|
146 | document.body.adjustContent(document.body, 0);
|
---|
147 | this.setSizes(false);
|
---|
148 | }
|
---|
149 |
|
---|
150 | if (_isIE) {
|
---|
151 | window.attachEvent("onresize", that._doOnResizeStart);
|
---|
152 | } else {
|
---|
153 | window.addEventListener("resize", that._doOnResizeStart, false);
|
---|
154 | }
|
---|
155 | // dhtmlxEvent(window, "resize", that._doOnResizeStart);
|
---|
156 | }
|
---|
157 |
|
---|
158 | }
|
---|
159 |
|
---|
160 | this.items = new Array();
|
---|
161 | /**
|
---|
162 | * @desc: returns cell's object by cell's id
|
---|
163 | * @param: id - cell's id
|
---|
164 | * @type: public
|
---|
165 | */
|
---|
166 | this.cells = function(id) {
|
---|
167 | if (this.polyObj[id] != null) { return this.polyObj[id]; }
|
---|
168 | return null;
|
---|
169 | }
|
---|
170 | /**
|
---|
171 | * @desc: returns cell's id by index
|
---|
172 | * @param: ind - cell's index
|
---|
173 | * @type: public
|
---|
174 | */
|
---|
175 | this.getIdByIndex = function(ind) {
|
---|
176 | if (ind < 0) return null;
|
---|
177 | if (ind >= this.items.length) return null;
|
---|
178 | // return this.items[ind]._link;
|
---|
179 | return this.items[ind]._idd;
|
---|
180 | }
|
---|
181 | /**
|
---|
182 | * @desc: returns cell's index by id
|
---|
183 | * @param: id - cell's id
|
---|
184 | * @type: public
|
---|
185 | */
|
---|
186 | this.getIndexById = function(id) {
|
---|
187 | if (this.cells(id) != null) return this.cells(id).getIndex();
|
---|
188 | return null;
|
---|
189 | }
|
---|
190 |
|
---|
191 | // this.base = base; // (typeof(base)=="object"?base:document.getElementById(base));
|
---|
192 | // needed for windows
|
---|
193 | this.imagePath = dhtmlx.image_path||"codebase/imgs/";
|
---|
194 | /**
|
---|
195 | * @desc: set path to images
|
---|
196 | * @param: path - path on hard disk
|
---|
197 | * @type: public
|
---|
198 | */
|
---|
199 | this.setImagePath = function(path) {
|
---|
200 | this.imagePath = path;
|
---|
201 | }
|
---|
202 |
|
---|
203 | // if (parentWindow != null) { this._parentWindow = parentWindow; }
|
---|
204 |
|
---|
205 | this.polyObj = {};
|
---|
206 | this.sepHor = new Array();
|
---|
207 | this.sepVer = new Array();
|
---|
208 |
|
---|
209 | this._layoutView = (view!=null?String(view).toUpperCase():"3E");
|
---|
210 |
|
---|
211 | this._minWidth = 40;
|
---|
212 | this._minHeight = 40;
|
---|
213 | //
|
---|
214 | this._CPanelBtnsWidth = 32;
|
---|
215 | //
|
---|
216 | // this._collapsedW = 7;//20;
|
---|
217 | // this._collapsedH = (_isFF?7:8);//(_isFF?20:22);
|
---|
218 |
|
---|
219 | this.skinParams = { "glassy_blue" : {"hor_sep_height": 4, "ver_sep_width": 4, "cpanel_height": 23, "cpanel_collapsed_width": 7, "cpanel_collapsed_height": (_isFF?7:8)},
|
---|
220 | "glassy_caramel" : {"hor_sep_height": 4, "ver_sep_width": 4, "cpanel_height": 23, "cpanel_collapsed_width": 7, "cpanel_collapsed_height": (_isFF?7:8)},
|
---|
221 | "glassy_greenapple" : {"hor_sep_height": 4, "ver_sep_width": 4, "cpanel_height": 23, "cpanel_collapsed_width": 7, "cpanel_collapsed_height": (_isFF?7:8)},
|
---|
222 | "glassy_rainy" : {"hor_sep_height": 4, "ver_sep_width": 4, "cpanel_height": 23, "cpanel_collapsed_width": 7, "cpanel_collapsed_height": (_isFF?7:8)},
|
---|
223 | "glassy_raspberries": {"hor_sep_height": 4, "ver_sep_width": 4, "cpanel_height": 23, "cpanel_collapsed_width": 7, "cpanel_collapsed_height": (_isFF?7:8)},
|
---|
224 | "glassy_yellow" : {"hor_sep_height": 4, "ver_sep_width": 4, "cpanel_height": 23, "cpanel_collapsed_width": 7, "cpanel_collapsed_height": (_isFF?7:8)},
|
---|
225 |
|
---|
226 |
|
---|
227 | "aqua_dark" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 24, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
228 | "aqua_orange" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 24, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
229 | "aqua_sky" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 24, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
230 |
|
---|
231 | "clear_blue" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 26, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
232 | "clear_green" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 26, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
233 | "clear_silver" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 26, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
234 |
|
---|
235 | "modern_black" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 31, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
236 | "modern_blue" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 31, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
237 | "modern_red" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 31, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
238 |
|
---|
239 | "dhx_black" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 34, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
240 | "dhx_blue" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 34, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
241 | "dhx_skyblue" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 26, "cpanel_collapsed_width": 18, "cpanel_collapsed_height": 18},
|
---|
242 |
|
---|
243 | "standard" : {"hor_sep_height": 5, "ver_sep_width": 5, "cpanel_height": 28, "cpanel_collapsed_width": 20, "cpanel_collapsed_height": (_isFF?20:22)}
|
---|
244 | };
|
---|
245 | // ff - 34,18
|
---|
246 | // ie - 34,18
|
---|
247 | // safari - 34,18
|
---|
248 | // opera ?
|
---|
249 | this._CPanelHeight = this.skinParams[this.skin]["cpanel_height"];
|
---|
250 | this._collapsedW = this.skinParams[this.skin]["cpanel_collapsed_width"];
|
---|
251 | this._collapsedH = this.skinParams[this.skin]["cpanel_collapsed_height"];
|
---|
252 | //
|
---|
253 | this.tpl = document.createElement("TABLE");
|
---|
254 | this.tpl.dir = "ltr";
|
---|
255 | this.tpl.className = "dhtmlxLayoutPolyContainer_"+this.skin;
|
---|
256 | this.tpl.cellSpacing = 0;
|
---|
257 | this.tpl.cellPadding = 0;
|
---|
258 | var bd = document.createElement("TBODY");
|
---|
259 | this.tpl.appendChild(bd);
|
---|
260 | this.tpl.border = 0;
|
---|
261 | //
|
---|
262 | this.tplSizes = {};
|
---|
263 | this._effects = { "collapse": false, "resize": false, "highlight": true };
|
---|
264 |
|
---|
265 | this.sizer = document.createElement("DIV");
|
---|
266 | this.sizer.className = "dhxLayout_Sizer_"+this.skin;
|
---|
267 | this.sizer.style.display = "none";
|
---|
268 | document.body.appendChild(this.sizer);
|
---|
269 |
|
---|
270 | this._attachSizer = function(obj) {
|
---|
271 | that.sizer.style.left = getAbsoluteLeft(obj)+"px";
|
---|
272 | that.sizer.style.top = getAbsoluteTop(obj)+"px";
|
---|
273 | that.sizer.style.width = obj.offsetWidth+"px";
|
---|
274 | that.sizer.style.height = obj.offsetHeight+"px";
|
---|
275 | if (that._sizerML != null) that.sizer.style.marginLeft = that._sizerML+"px";
|
---|
276 | if (that._sizerMT != null) that.sizer.style.marginTop = that._sizerMT+"px";
|
---|
277 | that.sizer.style.display = "";
|
---|
278 | that.sizer.className = "dhxLayout_Sizer_"+that.skin;
|
---|
279 | if (obj._dir != null) { that.sizer.className += " "+(obj._dir=="hor"?"dhxCursorNResize":"dhxCursorWResize"); }
|
---|
280 | }
|
---|
281 |
|
---|
282 | /**
|
---|
283 | * @desc: returns array with available layout patterns
|
---|
284 | * @type: public
|
---|
285 | */
|
---|
286 | this.listViews = function() {
|
---|
287 | var views = new Array();
|
---|
288 | for (var a in this.tplData) { views[views.length] = a; }
|
---|
289 | return views;
|
---|
290 | }
|
---|
291 | this._init = function() {
|
---|
292 | this.obj = document.createElement("DIV");
|
---|
293 | this.obj.className = "dhtmlxLayoutObject";
|
---|
294 | this.base.appendChild(this.obj);
|
---|
295 | this.obj.appendChild(this.tpl);
|
---|
296 | this.w = this.obj.offsetWidth;
|
---|
297 | this.h = this.obj.offsetHeight;
|
---|
298 | //
|
---|
299 | this._xmlLoader.loadXMLString(this.tplData[this._layoutView]!=null?this.tplData[this._layoutView]:this.tplData["3E"]);
|
---|
300 | this._initWindows();
|
---|
301 | }
|
---|
302 |
|
---|
303 | this._autoHor = new Array();
|
---|
304 | this._autoVer = new Array();
|
---|
305 | // minimal dimension for parent window
|
---|
306 | this._dimension = new Array(320, 200);
|
---|
307 | this._rowsRatio = 100;
|
---|
308 | this._colsRatio = 100;
|
---|
309 | //
|
---|
310 | this._xmlParser = function() {
|
---|
311 | var tableDataH = new Array();
|
---|
312 | var tableDataV = new Array();
|
---|
313 | var tableSeps = {};
|
---|
314 | //
|
---|
315 | var root = this.getXMLTopNode("layout");
|
---|
316 | for (var q=0; q<root.childNodes.length; q++) {
|
---|
317 | if (root.childNodes[q].tagName == "row") {
|
---|
318 | var row = root.childNodes[q];
|
---|
319 | var tr = document.createElement("TR");
|
---|
320 | // tr._collapse = new Array();
|
---|
321 | that.tpl.childNodes[0].appendChild(tr);
|
---|
322 | for (var w=0; w<row.childNodes.length; w++) {
|
---|
323 | if (row.childNodes[w].tagName == "cell") {
|
---|
324 |
|
---|
325 | var cell = row.childNodes[w];
|
---|
326 | var td = document.createElement("TD");
|
---|
327 | td._dir = "null";
|
---|
328 | if (cell.getAttribute("obj") != null) {
|
---|
329 |
|
---|
330 | var obj = cell.getAttribute("obj");
|
---|
331 |
|
---|
332 | var wh = String(cell.getAttribute("wh")).split(",");
|
---|
333 | // check width
|
---|
334 | var f = isNaN(wh[0]);
|
---|
335 | var tdW = (isNaN(wh[0])?parseInt(that.polyObj[wh[0]].style.width):0);
|
---|
336 | for (var q1=0; q1<tableDataH.length; q1++) {
|
---|
337 | for (var w1=0; w1<tableDataH[q1].length; w1++) {
|
---|
338 | if (tableDataH[q1][w1] == obj) {
|
---|
339 | if (!f) {
|
---|
340 | f = true;
|
---|
341 | var mw = that.base.offsetWidth - tableSeps[obj][0]*that.skinParams[that.skin]["ver_sep_width"];
|
---|
342 | for (var r=0; r<tableDataH[q1].length; r++) { if (!isNaN(tableDataH[q1][r])) { mw -= tableDataH[q1][r]; wh[0] -= 1; } }
|
---|
343 | tdW = Math.ceil(mw/wh[0]);
|
---|
344 | }
|
---|
345 | tableDataH[q1][w1] = tdW;
|
---|
346 | }
|
---|
347 | }
|
---|
348 | }
|
---|
349 | td.style.width = tdW+"px";
|
---|
350 |
|
---|
351 | // check height
|
---|
352 | var f = isNaN(wh[1]);
|
---|
353 | var tdH = (isNaN(wh[1])?parseInt(that.polyObj[wh[1]].style.height):0);
|
---|
354 | for (var q1=0; q1<tableDataV.length; q1++) {
|
---|
355 | for (var w1=0; w1<tableDataV[q1].length; w1++) {
|
---|
356 | if (tableDataV[q1][w1] == obj) {
|
---|
357 | if (!f) {
|
---|
358 | f = true;
|
---|
359 | var mh = that.base.offsetHeight - tableSeps[obj][1]*that.skinParams[that.skin]["hor_sep_height"];
|
---|
360 | for (var r=0; r<tableDataV.length; r++) { if (!isNaN(tableDataV[r][w1])) { mh -= tableDataV[r][w1]; wh[1] -= 1; } }
|
---|
361 | tdH = Math.ceil(mh/wh[1]);
|
---|
362 | }
|
---|
363 | tableDataV[q1][w1] = tdH;
|
---|
364 | }
|
---|
365 | }
|
---|
366 | }
|
---|
367 | td.style.height = tdH+"px";
|
---|
368 | //
|
---|
369 | td.className = "dhtmlxLayoutSinglePoly";
|
---|
370 | td.innerHTML = "";//"<div class='dhtmlxPolyInnerContainer'> </div>";
|
---|
371 | td._minW = (cell.getAttribute("minWidth") != null ? Number(cell.getAttribute("minWidth")):that._minWidth);
|
---|
372 | td._minH = (cell.getAttribute("minHeight") != null ? Number(cell.getAttribute("minHeight")):that._minHeight);
|
---|
373 | td._initCPanel = (cell.getAttribute("cpanel") != null ? (cell.getAttribute("cpanel")=="false"?false:true):true);
|
---|
374 | td._resize = cell.getAttribute("resize");
|
---|
375 | // init width/height
|
---|
376 | // if (cell.getAttribute("width") != null) { td.style.width = cell.getAttribute("width"); }
|
---|
377 | // if (cell.getAttribute("height") != null) { td.style.height = cell.getAttribute("height"); }
|
---|
378 |
|
---|
379 | // td._initW = (cell.getAttribute("width")!=null?cell.getAttribute("width"):"*");
|
---|
380 | // td._initH = (cell.getAttribute("height")!=null?cell.getAttribute("height"):"*");
|
---|
381 | var rd = String(cell.getAttribute("neighbors")).split(";");
|
---|
382 | for (var e=0; e<rd.length; e++) { var p = String(rd[e]).split(","); if (p.length > 1) { rd[e] = p; } }
|
---|
383 | td._rowData = rd;
|
---|
384 | that.polyObj[obj] = td;
|
---|
385 | }
|
---|
386 | if (cell.getAttribute("sep") != null) {
|
---|
387 | var sep = cell.getAttribute("sep");
|
---|
388 | if (sep == "hor") {
|
---|
389 | td.className = "dhtmlxLayoutPolySplitterHor";
|
---|
390 | td._dir = "hor";
|
---|
391 | // top side
|
---|
392 | var top = cell.getAttribute("top").split(";");
|
---|
393 | for (var e=0; e<top.length; e++) { var p = String(top[e]).split(","); if (p.length > 1) { top[e] = p; } }
|
---|
394 | td._top = top;
|
---|
395 | // bottom side
|
---|
396 | var bottom = cell.getAttribute("bottom").split(";");
|
---|
397 | for (var e=0; e<bottom.length; e++) { var p = String(bottom[e]).split(","); if (p.length > 1) { bottom[e] = p; } }
|
---|
398 | td._bottom = bottom;
|
---|
399 | that.sepHor[that.sepHor.length] = td;
|
---|
400 | } else {
|
---|
401 | td.className = "dhtmlxLayoutPolySplitterVer";
|
---|
402 | td._dir = "ver";
|
---|
403 | // left side
|
---|
404 | var left = cell.getAttribute("left").split(";");
|
---|
405 | for (var e=0; e<left.length; e++) { var p = String(left[e]).split(","); if (p.length > 1) { left[e] = p; } }
|
---|
406 | td._left = left;
|
---|
407 | // right side
|
---|
408 | var right = cell.getAttribute("right").split(";");
|
---|
409 | for (var e=0; e<right.length; e++) { var p = String(right[e]).split(","); if (p.length > 1) { right[e] = p; } }
|
---|
410 | td._right = right;
|
---|
411 | that.sepVer[that.sepVer.length] = td;
|
---|
412 | }
|
---|
413 | td._dblClick = cell.getAttribute("dblclick");
|
---|
414 | td._isSep = true;
|
---|
415 | td.innerHTML = " ";
|
---|
416 | }
|
---|
417 | if (cell.getAttribute("colspan") != null) { td.colSpan = cell.getAttribute("colspan"); }
|
---|
418 | if (cell.getAttribute("rowspan") != null) { td.rowSpan = cell.getAttribute("rowspan"); }
|
---|
419 | tr.appendChild(td);
|
---|
420 | }
|
---|
421 | }
|
---|
422 | }
|
---|
423 | // autosize data
|
---|
424 | if (root.childNodes[q].tagName == "autosize") {
|
---|
425 | that._autoHor = (root.childNodes[q].getAttribute("hor")).split(";");
|
---|
426 | that._autoVer = (root.childNodes[q].getAttribute("ver")).split(";");
|
---|
427 | that._totalCols = root.childNodes[q].getAttribute("cols");
|
---|
428 | that._totalRows = root.childNodes[q].getAttribute("rows");
|
---|
429 | that._dimension[0] = that._totalCols * that._colsRatio;
|
---|
430 | that._dimension[1] = that._totalRows * that._rowsRatio;
|
---|
431 | }
|
---|
432 | // table layout data (needed for init sizes)
|
---|
433 | if (root.childNodes[q].tagName == "table") {
|
---|
434 | var data = root.childNodes[q].getAttribute("data");
|
---|
435 | var r = String(data).split(";");
|
---|
436 | for (var q1=0; q1<r.length; q1++) {
|
---|
437 | tableDataH[q1] = new Array();
|
---|
438 | tableDataV[q1] = new Array();
|
---|
439 | var c = String(r[q1]).split(",");
|
---|
440 | for (var w1=0; w1<c.length; w1++) {
|
---|
441 | tableDataH[q1][w1] = c[w1];
|
---|
442 | tableDataV[q1][w1] = c[w1];
|
---|
443 | if (tableSeps[c[w1]] == null) { tableSeps[c[w1]] = new Array(0, 0); }
|
---|
444 | }
|
---|
445 | }
|
---|
446 | // define seps count
|
---|
447 | for (var a in tableSeps) {
|
---|
448 | var f = false;
|
---|
449 | for (var q1=0; q1<tableDataH.length; q1++) {
|
---|
450 | for (var w1=0; w1<tableDataH[q1].length; w1++) {
|
---|
451 | if (tableDataH[q1][w1] == a && !f) {
|
---|
452 | f = true;
|
---|
453 | for (var e1=0; e1<tableDataH[q1].length; e1++) { if (tableDataH[q1][e1]!=a) tableSeps[a][0]++; }
|
---|
454 | for (var e1=0; e1<tableDataH.length; e1++) { if (tableDataH[e1][w1]!=a) tableSeps[a][1]++; }
|
---|
455 | }
|
---|
456 | }
|
---|
457 | }
|
---|
458 | }
|
---|
459 | }
|
---|
460 | }
|
---|
461 | tableDataH = null;
|
---|
462 | tableDataV = null;
|
---|
463 | that._buildSurface();
|
---|
464 | this.destructor();
|
---|
465 | }
|
---|
466 | this._xmlLoader = new dtmlXMLLoaderObject(this._xmlParser, window);
|
---|
467 | /**
|
---|
468 | * @desc: returns array with available autosize settings
|
---|
469 | * @type: public
|
---|
470 | */
|
---|
471 | this.listAutoSizes = function() {
|
---|
472 | var hor = this._availAutoSize[this._layoutView+"_hor"];
|
---|
473 | var ver = this._availAutoSize[this._layoutView+"_ver"];
|
---|
474 | var currentHor = (this._autoHor).join(";");
|
---|
475 | var currentVer = (this._autoVer).join(";");
|
---|
476 | return new Array(currentHor, currentVer, hor, ver);
|
---|
477 | }
|
---|
478 | /**
|
---|
479 | * @desc: sets autosize for the layout
|
---|
480 | * @param: hor - cells that will be autosized horizontally
|
---|
481 | * @param: ver - cells that will be autosized vertically
|
---|
482 | * @type: public
|
---|
483 | */
|
---|
484 | this.setAutoSize = function(hor, ver) {
|
---|
485 | if (hor != null) {
|
---|
486 | var allow = false;
|
---|
487 | var data = this._availAutoSize[this._layoutView+"_hor"];
|
---|
488 | for (var q=0; q<data.length; q++) { allow = allow || (data[q] == hor); }
|
---|
489 | if (allow == true) { this._autoHor = hor.split(";"); }
|
---|
490 | }
|
---|
491 | if (ver != null) {
|
---|
492 | var allow = false;
|
---|
493 | var data = this._availAutoSize[this._layoutView+"_ver"];
|
---|
494 | for (var q=0; q<data.length; q++) { allow = allow || (data[q] == ver); }
|
---|
495 | if (allow == true) { this._autoVer = ver.split(";"); }
|
---|
496 | }
|
---|
497 | }
|
---|
498 | this._buildSurface = function() {
|
---|
499 |
|
---|
500 | for (var r=0; r<this.tpl.childNodes[0].childNodes.length; r++) {
|
---|
501 | var tr = this.tpl.childNodes[0].childNodes[r];
|
---|
502 | for (var c=0; c<tr.childNodes.length; c++) {
|
---|
503 | var td = tr.childNodes[c];
|
---|
504 | var that = this;
|
---|
505 | if (!td._isSep) {
|
---|
506 | // td._isLayoutCell = true;
|
---|
507 | td._isCell = true;
|
---|
508 | td.skin = this.skin;
|
---|
509 | /**
|
---|
510 | * @desc: returns cell's id
|
---|
511 | * @type: public
|
---|
512 | */
|
---|
513 | td.getId = function() {
|
---|
514 | return this._idd;
|
---|
515 | }
|
---|
516 | /**
|
---|
517 | * @desc: returns cell's index
|
---|
518 | * @type: public
|
---|
519 | */
|
---|
520 | td.getIndex = function() {
|
---|
521 | return this._ind;
|
---|
522 | }
|
---|
523 | /**
|
---|
524 | * @desc: shows a header
|
---|
525 | * @type: public
|
---|
526 | */
|
---|
527 | td.showHeader = function() {
|
---|
528 | that.showPanel(this._idd);
|
---|
529 | }
|
---|
530 | /**
|
---|
531 | * @desc: hides a header
|
---|
532 | * @type: public
|
---|
533 | */
|
---|
534 | td.hideHeader = function() {
|
---|
535 | that.hidePanel(this._idd);
|
---|
536 | }
|
---|
537 | /**
|
---|
538 | * @desc: returns true if a header is visible
|
---|
539 | * @type: public
|
---|
540 | */
|
---|
541 | td.isHeaderVisible = function() {
|
---|
542 | return that.isPanelVisible(this._idd);
|
---|
543 | }
|
---|
544 | /**
|
---|
545 | * @desc: set header's text
|
---|
546 | * @param: text - new header's text
|
---|
547 | * @type: public
|
---|
548 | */
|
---|
549 | td.setText = function(text) {
|
---|
550 | that.setText(this._idd, text);
|
---|
551 | }
|
---|
552 | /**
|
---|
553 | * @desc: returns header's text
|
---|
554 | * @type: public
|
---|
555 | */
|
---|
556 | td.getText = function() {
|
---|
557 | return that.getText(this._idd);
|
---|
558 | }
|
---|
559 | /**
|
---|
560 | * @desc: expands a cell
|
---|
561 | * @type: public
|
---|
562 | */
|
---|
563 | td.expand = function() {
|
---|
564 | if (!that._isCollapsed(this._idd)) return;
|
---|
565 | that._expand(this._idd, "hide");
|
---|
566 | }
|
---|
567 | /**
|
---|
568 | * @desc: collapses a cell
|
---|
569 | * @type: public
|
---|
570 | */
|
---|
571 | td.collapse = function() {
|
---|
572 | if (that._isCollapsed(this._idd)) return;
|
---|
573 | that._collapse(this._idd, "hide");
|
---|
574 | }
|
---|
575 | /**
|
---|
576 | * @desc: return true if a cell is collapsed
|
---|
577 | * @type: public
|
---|
578 | */
|
---|
579 | td.isCollapsed = function() {
|
---|
580 | return that._isCollapsed(this._idd);
|
---|
581 | }
|
---|
582 | /**
|
---|
583 | * @desc: docks a cell from a window
|
---|
584 | * @type: public
|
---|
585 | */
|
---|
586 | td.dock = function() {
|
---|
587 | if (!that._isCollapsed(this._idd)) return;
|
---|
588 | that._expand(this._idd, "dock");
|
---|
589 | that.dockWindow(this._idd);
|
---|
590 | }
|
---|
591 | /**
|
---|
592 | * @desc: undocks a cell to a window
|
---|
593 | * @type: public
|
---|
594 | */
|
---|
595 | td.undock = function() {
|
---|
596 | if (that._isCollapsed(this._idd)) return;
|
---|
597 | that.unDockWindow(this._idd);
|
---|
598 | that._collapse(this._idd, "dock");
|
---|
599 | }
|
---|
600 | /**
|
---|
601 | * @desc: sets cell's width
|
---|
602 | * @param: width
|
---|
603 | * @type: public
|
---|
604 | */
|
---|
605 | td.setWidth = function(width) {
|
---|
606 | if (!Number(width)) return;
|
---|
607 | that._setWidth(this._idd, width);
|
---|
608 | }
|
---|
609 | /**
|
---|
610 | * @desc: returns cell's width
|
---|
611 | * @type: public
|
---|
612 | */
|
---|
613 | td.getWidth = function() {
|
---|
614 | return parseInt(this.style.width);
|
---|
615 | }
|
---|
616 | /**
|
---|
617 | * @desc: sets cell's height
|
---|
618 | * @param: height
|
---|
619 | * @type: public
|
---|
620 | */
|
---|
621 | td.setHeight = function(height) {
|
---|
622 | if (!Number(height)) return;
|
---|
623 | that._setHeight(this._idd, height);
|
---|
624 | }
|
---|
625 | /**
|
---|
626 | * @desc: returns cell's height
|
---|
627 | * @type: public
|
---|
628 | */
|
---|
629 | td.getHeight = function() {
|
---|
630 | return parseInt(this.style.height);
|
---|
631 | }
|
---|
632 | /**
|
---|
633 | * @desc: fixes cell's size (block resize)
|
---|
634 | * @param: width - true/false
|
---|
635 | * @param: height - true/false
|
---|
636 | * @type: public
|
---|
637 | */
|
---|
638 | td.fixSize = function(width, height) {
|
---|
639 | that._fixSize(this._idd, width, height);
|
---|
640 | }
|
---|
641 | /**
|
---|
642 | * @desc: shows progress indicator for cell
|
---|
643 | * @type: public
|
---|
644 | */
|
---|
645 | td.progressOn = function() {
|
---|
646 | that._progressControl(this._idd, true);
|
---|
647 | }
|
---|
648 | /**
|
---|
649 | * @desc: hides progress indicator for cell
|
---|
650 | * @type: public
|
---|
651 | */
|
---|
652 | td.progressOff = function() {
|
---|
653 | that._progressControl(this._idd, false);
|
---|
654 | }
|
---|
655 |
|
---|
656 |
|
---|
657 | td._doOnAttachMenu = function() {
|
---|
658 | this.adjustContent(this.childNodes[0], (this._noHeader?0:that.skinParams[that.skin]["cpanel_height"]));
|
---|
659 | this.updateNestedObjects();
|
---|
660 | }
|
---|
661 | td._doOnAttachToolbar = function() {
|
---|
662 | this.adjustContent(this.childNodes[0], (this._noHeader?0:that.skinParams[that.skin]["cpanel_height"]));
|
---|
663 | this.updateNestedObjects();
|
---|
664 | }
|
---|
665 | td._doOnAttachStatusBar = function() {
|
---|
666 | this.adjustContent(this.childNodes[0], (this._noHeader?0:that.skinParams[that.skin]["cpanel_height"]));
|
---|
667 | this.updateNestedObjects();
|
---|
668 | }
|
---|
669 | td._doOnAttachURL = function(addIFrameEvents) {
|
---|
670 | that._doOnAttachURL(this._idd, addIFrameEvents);
|
---|
671 | }
|
---|
672 |
|
---|
673 | }
|
---|
674 | //
|
---|
675 | if (td._dir == "ver") {
|
---|
676 | td.onselectstart = function(e) { e = e||event; e.returnValue = false; }
|
---|
677 | td.onmousedown = function(e) {
|
---|
678 | e = e||event;
|
---|
679 | if (!this._lastClick) {
|
---|
680 | this._lastClick = new Date().getTime();
|
---|
681 | } else {
|
---|
682 | var t = this._lastClick;
|
---|
683 | this._lastClick = new Date().getTime();
|
---|
684 | if (t + that._dblClickTM >= this._lastClick) {
|
---|
685 | if (that._doOnDoubleClick(this) === true) return;
|
---|
686 | }
|
---|
687 | }
|
---|
688 | var p = that._findDockCellsVer(this);
|
---|
689 | that._resAreaData = new Array();
|
---|
690 | if (p[0] != null && p[1] != null) {
|
---|
691 | if (String(document.body.className).search("dhxCursorWResize") == -1) { document.body.className += " dhxCursorWResize"; }
|
---|
692 | that._resObj = this;
|
---|
693 | that._anyExpL = p[0];
|
---|
694 | that._anyExpR = p[1];
|
---|
695 | that._collectResAreaData(p);
|
---|
696 | that._resX = e.clientX;
|
---|
697 | // sizmple resize
|
---|
698 | if (that._effects["resize"] == false) {
|
---|
699 | that._attachSizer(this);
|
---|
700 | that.sizer._leftXStart = parseInt(that.sizer.style.left);
|
---|
701 | // getting neares objects
|
---|
702 | var objLeft = that.polyObj[that._anyExpL[0]];
|
---|
703 | that._resXMaxWidthLeft = parseInt(objLeft.style.width)-that._minWidth;
|
---|
704 | var objRight = that.polyObj[that._anyExpR[0]];
|
---|
705 | that._resXMaxWidthRight = parseInt(objRight.style.width)-that._minWidth;
|
---|
706 | // checking alternative min width in attached layout case
|
---|
707 | if (that._alterSizes.length > 0) {
|
---|
708 | for (var q=0; q<that._alterSizes.length; q++) {
|
---|
709 | for (var w=0; w<that._anyExpL.length; w++) {
|
---|
710 | if (that._alterSizes[q][0] == that._anyExpL[w]) {
|
---|
711 | var newVal = that._resXMaxWidthLeft = parseInt(objLeft.style.width)-that._alterSizes[q][1];
|
---|
712 | if (newVal < that._resXMaxWidthLeft) { that._resXMaxWidthLeft = newVal; }
|
---|
713 | }
|
---|
714 | }
|
---|
715 | for (var w=0; w<that._anyExpR.length; w++) {
|
---|
716 | if (that._alterSizes[q][0] == that._anyExpR[w]) {
|
---|
717 | newVal = parseInt(objRight.style.width)-that._alterSizes[q][1];
|
---|
718 | if (newVal < that._resXMaxWidthRight) { that._resXMaxWidthRight = newVal; }
|
---|
719 | }
|
---|
720 | }
|
---|
721 | }
|
---|
722 | }
|
---|
723 | that._resXStart = that._resX;
|
---|
724 | }
|
---|
725 | //
|
---|
726 | that._resFunc = that._resizeVer;
|
---|
727 | that._showCovers();
|
---|
728 | }
|
---|
729 | }
|
---|
730 | td.onmouseup = function() {
|
---|
731 | if (that._effects["resize"] == true) {
|
---|
732 | that._resizeStop();
|
---|
733 | that._anyExpL = null;
|
---|
734 | that._anyExpR = null;
|
---|
735 | }
|
---|
736 | }
|
---|
737 | }
|
---|
738 | if (td._dir == "hor") {
|
---|
739 | td.onselectstart = function(e) { e = e||event; e.returnValue = false; }
|
---|
740 | td.onmousedown = function(e) {
|
---|
741 | e = e||event;
|
---|
742 | if (!this._lastClick) {
|
---|
743 | this._lastClick = new Date().getTime();
|
---|
744 | } else {
|
---|
745 | var t = this._lastClick;
|
---|
746 | this._lastClick = new Date().getTime();
|
---|
747 | if (t + that._dblClickTM >= this._lastClick) {
|
---|
748 | if (that._doOnDoubleClick(this) === true) return;
|
---|
749 | }
|
---|
750 | }
|
---|
751 | var p = that._findDockCellsHor(this);
|
---|
752 | that._resAreaData = new Array();
|
---|
753 | if (p[0] != null && p[1] != null) {
|
---|
754 | if (String(document.body.className).search("dhxCursorNResize") == -1) { document.body.className += " dhxCursorNResize"; }
|
---|
755 |
|
---|
756 | that._resObj = this;
|
---|
757 | that._anyExpT = p[0];
|
---|
758 | that._anyExpB = p[1];
|
---|
759 | that._collectResAreaData(p);
|
---|
760 | that._resY = e.clientY;
|
---|
761 | // sizmple resize
|
---|
762 | if (that._effects["resize"] == false) {
|
---|
763 | that._attachSizer(this);
|
---|
764 | that.sizer._topYStart = parseInt(that.sizer.style.top);
|
---|
765 | // getting neares objects
|
---|
766 | var objTop = that.polyObj[that._anyExpT[0]];
|
---|
767 | that._resYMaxHeightTop = parseInt(objTop.style.height)-that._minHeight;
|
---|
768 | var objBottom = that.polyObj[that._anyExpB[0]];
|
---|
769 | that._resYMaxHeightBottom = parseInt(objBottom.style.height)-that._minHeight;
|
---|
770 | // checking alternative min height in attached layout case
|
---|
771 | if (that._alterSizes.length > 0) {
|
---|
772 | for (var q=0; q<that._alterSizes.length; q++) {
|
---|
773 | for (var w=0; w<that._anyExpT.length; w++) {
|
---|
774 | if (that._alterSizes[q][0] == that._anyExpT[w]) {
|
---|
775 | var newVal = parseInt(objTop.style.height)-that._alterSizes[q][2]-(objTop.childNodes[0].style.display!="none"?that.skinParams[that.skin]["cpanel_height"]:0);
|
---|
776 | if (newVal < that._resYMaxHeightTop) { that._resYMaxHeightTop = newVal; }
|
---|
777 | }
|
---|
778 | }
|
---|
779 | for (var w=0; w<that._anyExpB.length; w++) {
|
---|
780 | if (that._alterSizes[q][0] == that._anyExpB[w]) {
|
---|
781 | var newVal = parseInt(objBottom.style.height)-that._alterSizes[q][2]-(objBottom.childNodes[0].style.display!="none"?that.skinParams[that.skin]["cpanel_height"]:0);
|
---|
782 | if (newVal < that._resYMaxHeightBottom) { that._resYMaxHeightBottom = newVal; }
|
---|
783 | }
|
---|
784 | }
|
---|
785 | }
|
---|
786 | }
|
---|
787 | that._resYStart = that._resY;
|
---|
788 | }
|
---|
789 | //
|
---|
790 | that._resFunc = that._resizeHor;
|
---|
791 | that._showCovers();
|
---|
792 | }
|
---|
793 | }
|
---|
794 | td.onmouseup = function() {
|
---|
795 | if (that._effects["resize"] == true) {
|
---|
796 | that._resizeStop();
|
---|
797 | that._anyExpT = null;
|
---|
798 | that._anyExpB = null;
|
---|
799 | }
|
---|
800 | }
|
---|
801 | }
|
---|
802 | }
|
---|
803 | }
|
---|
804 |
|
---|
805 | for (var a in this.polyObj) {
|
---|
806 |
|
---|
807 | this.polyObj[a]._collapsed = false;
|
---|
808 | this.polyObj[a]._idd = a;
|
---|
809 | this.polyObj[a]._ind = this.items.length;
|
---|
810 | this.items[this.items.length] = this.polyObj[a];
|
---|
811 |
|
---|
812 | var nod = document.createElement("DIV");
|
---|
813 | nod.style.position = "relative";
|
---|
814 |
|
---|
815 | nod.style.left = "0px";
|
---|
816 | nod.style.top = "0px";
|
---|
817 | nod.style.width = this.polyObj[a].style.width;
|
---|
818 | nod.style.height = this.polyObj[a].style.height;
|
---|
819 | nod.style.overflow = "hidden";
|
---|
820 | this.polyObj[a].appendChild(nod);
|
---|
821 |
|
---|
822 | //
|
---|
823 | var bar = document.createElement("DIV");
|
---|
824 | bar._dockCell = a;
|
---|
825 | bar._resize = this.polyObj[a]._resize;
|
---|
826 | bar.className = "dhtmlxPolyInfoBar";
|
---|
827 | bar.innerHTML = "<div class='dhtmlxInfoBarLabel'>"+a+"</div>"+
|
---|
828 | "<div class='dhtmlxInfoBarButtonsFake'><div class='dhtmlxInfoBarButtonsFake2'></div></div>"+
|
---|
829 | "<div class='dhtmlxInfoButtonDock' title='Dock'></div>"+
|
---|
830 | "<div class='dhtmlxInfoButtonUnDock' style='display: none;' title='UnDock'></div>"+
|
---|
831 | "<div class='dhtmlxInfoButtonShowHide_"+bar._resize+"' title='Collapse'></div>"+
|
---|
832 | "<div class='dhtmlxLineL'></div>"+
|
---|
833 | "<div class='dhtmlxLineR'></div>";
|
---|
834 | if (this.polyObj[a]._initCPanel == true) {
|
---|
835 | bar._h = this._CPanelHeight;
|
---|
836 | bar.style.display = "";
|
---|
837 | } else {
|
---|
838 | bar._h = 0;
|
---|
839 | bar.style.display = "none";
|
---|
840 | }
|
---|
841 |
|
---|
842 | this.polyObj[a].childNodes[0].appendChild(bar);
|
---|
843 | //
|
---|
844 | bar.ondblclick = function() {
|
---|
845 | that.callEvent("onDblClick", [this._dockCell]);
|
---|
846 | }
|
---|
847 | bar.childNodes[4].onclick = function() { // show/hide
|
---|
848 | var pId = this.parentNode._dockCell;
|
---|
849 | if (that._isCollapsed(pId)) { that._expand(pId, "hide"); } else { that._collapse(pId, "hide"); }
|
---|
850 | }
|
---|
851 |
|
---|
852 | for (var r=0; r<bar.childNodes.length; r++) {
|
---|
853 | bar.childNodes[r].onselectstart = function(e) { e = e||event; e.returnValue = false; }
|
---|
854 | }
|
---|
855 |
|
---|
856 | var contObj = document.createElement("DIV");
|
---|
857 | contObj.className = "dhxcont_global_content_area";
|
---|
858 | this.polyObj[a].childNodes[0].appendChild(contObj);
|
---|
859 |
|
---|
860 | var cont = new dhtmlXContainer(this.polyObj[a]);
|
---|
861 | cont.setContent(contObj);
|
---|
862 | this.polyObj[a].adjustContent(this.polyObj[a].childNodes[0], this.skinParams[this.skin]["cpanel_height"]);
|
---|
863 | }
|
---|
864 | this._fixIcons();
|
---|
865 | }
|
---|
866 |
|
---|
867 | this._resX = null;
|
---|
868 | this._resY = null;
|
---|
869 | this._resObj = null;
|
---|
870 | this._resFunc = null;
|
---|
871 | //
|
---|
872 | // optimized resize
|
---|
873 | this._anyExpL = null;
|
---|
874 | this._anyExpR = null;
|
---|
875 | this._anyExpT = null;
|
---|
876 | this._anyExpB = null;
|
---|
877 | //
|
---|
878 | this._expand = function(pId, mode) {
|
---|
879 | this._doExpand(this.polyObj[pId]._resize, pId, this.polyObj[pId]._rowData, mode);
|
---|
880 | }
|
---|
881 | this._collapse = function(pId, mode) {
|
---|
882 | if (this._isCollapsed(pId)) return;
|
---|
883 | // save dimension
|
---|
884 | this.polyObj[pId]._savedW = parseInt(this.polyObj[pId].style.width);
|
---|
885 | this.polyObj[pId]._savedH = parseInt(this.polyObj[pId].style.height);
|
---|
886 | // collapsing
|
---|
887 | this._doCollapse(this.polyObj[pId]._resize, pId, this.polyObj[pId]._rowData, mode);
|
---|
888 | }
|
---|
889 | this._isCollapsed = function(pId) {
|
---|
890 | return this.polyObj[pId]._collapsed;
|
---|
891 | }
|
---|
892 | // used to get alternative width/height for resising cell (in case of attached layout)
|
---|
893 | this._checkAlterMinSize = function(data) {
|
---|
894 | this._alterSizes = new Array();
|
---|
895 | for (var q=0; q<data.length; q++) {
|
---|
896 | for (var w=0; w<data[q].length; w++) {
|
---|
897 | // check attache layout's dimension
|
---|
898 | if (this.polyObj[data[q][w]].layout != null) {
|
---|
899 | var dims = this.polyObj[data[q][w]].layout._defineWindowMinDimension(this.polyObj[data[q][w]], true);
|
---|
900 | dims[0] = data[q][w];
|
---|
901 | this._alterSizes[this._alterSizes.length] = dims;
|
---|
902 | }
|
---|
903 | /* // orig
|
---|
904 | var win = this.polyObj[data[q][w]].window;
|
---|
905 | if (win.layout != null) {
|
---|
906 | var dims = win.layout._defineWindowMinDimension(win, true);
|
---|
907 | dims[0] = data[q][w];
|
---|
908 | this._alterSizes[this._alterSizes.length] = dims;
|
---|
909 | }
|
---|
910 | */
|
---|
911 | }
|
---|
912 | }
|
---|
913 | }
|
---|
914 | //
|
---|
915 | this._findDockCellsVer = function(resObj) {
|
---|
916 | var res = new Array(null, null);
|
---|
917 | if (resObj == null) { return res; }
|
---|
918 | // find nearest expanded on the left side
|
---|
919 | var anyExpL = null;
|
---|
920 | for (var q=resObj._left.length-1; q>=0; q--) {
|
---|
921 | if (anyExpL == null) {
|
---|
922 | if (typeof(resObj._left[q]) == "object") {
|
---|
923 | var isBlocked = false;
|
---|
924 | for (var w=0; w<resObj._left[q].length; w++) { isBlocked = isBlocked || (this.polyObj[resObj._left[q][w]]._isBlockedWidth||false); }
|
---|
925 | if (!isBlocked) { anyExpL = resObj._left[q]; }
|
---|
926 | } else if(this.polyObj[resObj._left[q]]._collapsed == false) {
|
---|
927 | if (!this.polyObj[resObj._left[q]]._isBlockedWidth) { anyExpL = resObj._left[q]; }
|
---|
928 | }
|
---|
929 | }
|
---|
930 | }
|
---|
931 | // find nearest expanded on the right side
|
---|
932 | var anyExpR = null;
|
---|
933 | for (var q=0; q<resObj._right.length; q++) {
|
---|
934 | if (anyExpR == null) {
|
---|
935 | if (typeof(resObj._right[q]) == "object") {
|
---|
936 | var isBlocked = false;
|
---|
937 | for (var w=0; w<resObj._right[q].length; w++) { isBlocked = isBlocked || (this.polyObj[resObj._right[q][w]]._isBlockedWidth||false); }
|
---|
938 | if (!isBlocked) { anyExpR = resObj._right[q]; }
|
---|
939 | } else if(this.polyObj[resObj._right[q]]._collapsed == false) {
|
---|
940 | if (!this.polyObj[resObj._right[q]]._isBlockedWidth) { anyExpR = resObj._right[q]; }
|
---|
941 | }
|
---|
942 | }
|
---|
943 | }
|
---|
944 | // nothing to resize
|
---|
945 | if (anyExpL == null || anyExpR == null) { return res; }
|
---|
946 | // convert to array if needed
|
---|
947 | if (typeof(anyExpL) == "string") { anyExpL = new Array(anyExpL); }
|
---|
948 | if (typeof(anyExpR) == "string") { anyExpR = new Array(anyExpR); }
|
---|
949 | //
|
---|
950 | res[0] = anyExpL;
|
---|
951 | res[1] = anyExpR;
|
---|
952 | // checking alter size in case of attached layout
|
---|
953 | this._checkAlterMinSize(res);
|
---|
954 | this._minWLAlter = 0;
|
---|
955 | this._minWRAlter = 0;
|
---|
956 | if (this._alterSizes.length > 0 && this._effects["resize"] == true) {
|
---|
957 | var objL = new Array();
|
---|
958 | var objR = new Array();
|
---|
959 | for (var q=0; q<anyExpL.length; q++) { objL[q] = this.polyObj[anyExpL[q]]; }
|
---|
960 | for (var q=0; q<anyExpR.length; q++) { objR[q] = this.polyObj[anyExpR[q]]; }
|
---|
961 | for (var q=0; q<objL.length; q++) { for (var w=0; w<this._alterSizes.length; w++) { if (this._alterSizes[w][0] == objL[q]._idd && this._minWLAlter < this._alterSizes[w][1]) { this._minWLAlter = this._alterSizes[w][1]; } } }
|
---|
962 | for (var q=0; q<objR.length; q++) { for (var w=0; w<this._alterSizes.length; w++) { if (this._alterSizes[w][0] == objR[q]._idd && this._maxWRAlter < this._alterSizes[w][1]) { this._minWRAlter = this._alterSizes[w][1]; } } }
|
---|
963 | }
|
---|
964 | return res;
|
---|
965 | }
|
---|
966 | //
|
---|
967 | this._findDockCellsHor = function(resObj) {
|
---|
968 | var res = new Array(null, null);
|
---|
969 | if (resObj == null) { return res; }
|
---|
970 | // find nearest expanded on the top side
|
---|
971 | var anyExpT = null;
|
---|
972 | for (var q=resObj._top.length-1; q>=0; q--) {
|
---|
973 | if (anyExpT == null) {
|
---|
974 | if (typeof(resObj._top[q]) == "object") {
|
---|
975 | var isBlocked = false;
|
---|
976 | for (var w=0; w<resObj._top[q].length; w++) { isBlocked = isBlocked || (this.polyObj[resObj._top[q][w]]._isBlockedHeight||false); }
|
---|
977 | if (!isBlocked) { anyExpT = resObj._top[q]; }
|
---|
978 | } else if(this.polyObj[resObj._top[q]]._collapsed == false) {
|
---|
979 | if (!this.polyObj[resObj._top[q]]._isBlockedHeight) { anyExpT = resObj._top[q]; }
|
---|
980 | }
|
---|
981 | }
|
---|
982 | }
|
---|
983 | // find nearest expanded on the bottom side
|
---|
984 | var anyExpB = null;
|
---|
985 | for (var q=0; q<resObj._bottom.length; q++) {
|
---|
986 | if (anyExpB == null) {
|
---|
987 | if (typeof(resObj._bottom[q]) == "object") {
|
---|
988 | var isBlocked = false;
|
---|
989 | for (var w=0; w<resObj._bottom[q].length; w++) { isBlocked = isBlocked || (this.polyObj[resObj._bottom[q][w]]._isBlockedHeight||false); }
|
---|
990 | if (!isBlocked) { anyExpB = resObj._bottom[q]; }
|
---|
991 | } else if(this.polyObj[resObj._bottom[q]]._collapsed == false) {
|
---|
992 | if (!this.polyObj[resObj._bottom[q]]._isBlockedHeight) { anyExpB = resObj._bottom[q]; }
|
---|
993 | }
|
---|
994 | }
|
---|
995 | }
|
---|
996 | // nothing to resize
|
---|
997 | if (anyExpT == null || anyExpB == null) { return res; }
|
---|
998 | // convert to array if needed
|
---|
999 | if (typeof(anyExpT) == "string") { anyExpT = new Array(anyExpT); }
|
---|
1000 | if (typeof(anyExpB) == "string") { anyExpB = new Array(anyExpB); }
|
---|
1001 | //
|
---|
1002 | res[0] = anyExpT;
|
---|
1003 | res[1] = anyExpB;
|
---|
1004 | // checking alter size in case of attached layout
|
---|
1005 | this._checkAlterMinSize(res);
|
---|
1006 | this._minHTAlter = 0;
|
---|
1007 | this._minHBAlter = 0;
|
---|
1008 | if (this._alterSizes.length > 0 && this._effects["resize"] == true) {
|
---|
1009 | var objT = new Array();
|
---|
1010 | var objB = new Array();
|
---|
1011 | for (var q=0; q<anyExpT.length; q++) { objT[q] = this.polyObj[anyExpT[q]]; }
|
---|
1012 | for (var q=0; q<anyExpB.length; q++) { objB[q] = this.polyObj[anyExpB[q]]; }
|
---|
1013 | for (var q=0; q<objT.length; q++) { for (var w=0; w<this._alterSizes.length; w++) { if (this._alterSizes[w][0] == objT[q]._idd && this._minHTAlter < this._alterSizes[w][2]) { this._minHTAlter = this._alterSizes[w][2]; } } }
|
---|
1014 | for (var q=0; q<objB.length; q++) { for (var w=0; w<this._alterSizes.length; w++) { if (this._alterSizes[w][0] == objB[q]._idd && this._minHBAlter < this._alterSizes[w][2]) { this._minHBAlter = this._alterSizes[w][2]; } } }
|
---|
1015 | }
|
---|
1016 | //
|
---|
1017 | return res;
|
---|
1018 | }
|
---|
1019 | //
|
---|
1020 | this._resizeVer = function(e) {
|
---|
1021 | if (this._resObj == null || this._anyExpL == null || this._anyExpR == null) return;
|
---|
1022 | // simple resize
|
---|
1023 | if (this._effects["resize"] == false) {
|
---|
1024 | this._resX = e.clientX;
|
---|
1025 | var offsetX = e.clientX - this._resXStart;
|
---|
1026 | if (-offsetX > this._resXMaxWidthLeft && offsetX < 0) { offsetX = -this._resXMaxWidthLeft; this._resX = offsetX+this._resXStart; }
|
---|
1027 | if (offsetX > this._resXMaxWidthRight && offsetX > 0) { offsetX = this._resXMaxWidthRight; this._resX = offsetX+this._resXStart; }
|
---|
1028 | this.sizer.style.left = this.sizer._leftXStart+offsetX+"px";
|
---|
1029 | return;
|
---|
1030 | }
|
---|
1031 | // console.log(this._resObj._leftXStart);
|
---|
1032 | //
|
---|
1033 | var anyExpL = this._anyExpL;
|
---|
1034 | var anyExpR = this._anyExpR;
|
---|
1035 | // resize items
|
---|
1036 | var newX = e.clientX;
|
---|
1037 | var offsetX = e.clientX - that._resX;
|
---|
1038 | //
|
---|
1039 | var objL = new Array();
|
---|
1040 | var objR = new Array();
|
---|
1041 | for (var q=0; q<anyExpL.length; q++) { objL[q] = this.polyObj[anyExpL[q]]; }
|
---|
1042 | for (var q=0; q<anyExpR.length; q++) { objR[q] = this.polyObj[anyExpR[q]]; }
|
---|
1043 | //
|
---|
1044 | var wL = parseInt(objL[0].style.width);
|
---|
1045 | var wR = parseInt(objR[0].style.width);
|
---|
1046 | //
|
---|
1047 | if (offsetX < 0) {
|
---|
1048 | var newWL = wL + offsetX;
|
---|
1049 | if (newWL > objL[0]._minW && newWL > this._minWLAlter) {
|
---|
1050 | var newWR = wR + wL - newWL;
|
---|
1051 | for (var q=0; q<objL.length; q++) this._setW(objL[q], newWL);
|
---|
1052 | for (var q=0; q<objR.length; q++) this._setW(objR[q], newWR);
|
---|
1053 | this._resX = newX;
|
---|
1054 | }
|
---|
1055 | } else if (offsetX > 0) {
|
---|
1056 | var newWR = wR - offsetX;
|
---|
1057 | if (newWR > objR[0]._minW && newWR > this._minWRAlter) {
|
---|
1058 | var newWL = wL + wR - newWR;
|
---|
1059 | for (var q=0; q<objL.length; q++) this._setW(objL[q], newWL);
|
---|
1060 | for (var q=0; q<objR.length; q++) this._setW(objR[q], newWR);
|
---|
1061 | this._resX = newX;
|
---|
1062 | }
|
---|
1063 | }
|
---|
1064 | }
|
---|
1065 | this._resizeHor = function(e) {
|
---|
1066 | if (this._resObj == null || this._anyExpT == null || this._anyExpB == null) return;
|
---|
1067 | // simple resize
|
---|
1068 | if (this._effects["resize"] == false) {
|
---|
1069 | this._resY = e.clientY;
|
---|
1070 | var offsetY = e.clientY - this._resYStart;
|
---|
1071 | if (-offsetY > this._resYMaxHeightTop && offsetY < 0) { offsetY = -this._resYMaxHeightTop; this._resY = offsetY + this._resYStart; }
|
---|
1072 | if (offsetY > this._resYMaxHeightBottom && offsetY > 0) { offsetY = this._resYMaxHeightBottom; this._resY = offsetY + this._resYStart; }
|
---|
1073 | this.sizer.style.top = this.sizer._topYStart+offsetY+"px";
|
---|
1074 | return;
|
---|
1075 | }
|
---|
1076 | //
|
---|
1077 | var anyExpT = this._anyExpT;
|
---|
1078 | var anyExpB = this._anyExpB;
|
---|
1079 | // resize items
|
---|
1080 | var newY = e.clientY;
|
---|
1081 | var offsetY = e.clientY - that._resY;
|
---|
1082 | //
|
---|
1083 | var objT = new Array();
|
---|
1084 | var objB = new Array();
|
---|
1085 | for (var q=0; q<anyExpT.length; q++) { objT[q] = this.polyObj[anyExpT[q]]; }
|
---|
1086 | for (var q=0; q<anyExpB.length; q++) { objB[q] = this.polyObj[anyExpB[q]]; }
|
---|
1087 | //
|
---|
1088 | var hT = parseInt(objT[0].style.height);
|
---|
1089 | var hB = parseInt(objB[0].style.height);
|
---|
1090 | //
|
---|
1091 | if (offsetY < 0) {
|
---|
1092 | var newHT = hT + offsetY;
|
---|
1093 | if (newHT > objT[0]._minH + this._minHTAlter) {
|
---|
1094 | var newHB = hB + hT - newHT;
|
---|
1095 | for (var q=0; q<objT.length; q++) this._setH(objT[q], newHT);
|
---|
1096 | for (var q=0; q<objB.length; q++) this._setH(objB[q], newHB);
|
---|
1097 | this._resY = newY;
|
---|
1098 | }
|
---|
1099 | } else if (offsetY > 0) {
|
---|
1100 | var newHB = hB - offsetY;
|
---|
1101 | if (newHB > objB[0]._minH + this._minHBAlter) {
|
---|
1102 | var newHT = hT + hB - newHB;
|
---|
1103 | for (var q=0; q<objT.length; q++) this._setH(objT[q], newHT);
|
---|
1104 | for (var q=0; q<objB.length; q++) this._setH(objB[q], newHB);
|
---|
1105 | this._resY = newY;
|
---|
1106 | }
|
---|
1107 | }
|
---|
1108 | }
|
---|
1109 |
|
---|
1110 | this._resizeStop = function() {
|
---|
1111 | var p = document.body.className;
|
---|
1112 | if (p.search("dhxCursorWResize") !== -1 || p.search("dhxCursorNResize") !== -1) {
|
---|
1113 | document.body.className = String(document.body.className).replace(/dhxCursorWResize/g,"").replace(/dhxCursorNResize/g,"");
|
---|
1114 | }
|
---|
1115 | if (this._resObj == null) return;
|
---|
1116 | // simple resize
|
---|
1117 | if (this._effects["resize"] == false) {
|
---|
1118 | this.sizer.style.display = "none";
|
---|
1119 | if (this._resObj._dir == "hor") {
|
---|
1120 | var objTop = (typeof(this._anyExpT[0])=="object"?this._anyExpT[0][0]:this._anyExpT[0]);
|
---|
1121 | var offsetY = this._resY-this._resYStart;
|
---|
1122 | var newH = parseInt(this.polyObj[objTop].style.height)+offsetY;
|
---|
1123 | this._setHeight(objTop, newH);
|
---|
1124 | } else {
|
---|
1125 | var objLeft = (typeof(this._anyExpL[0])=="object"?this._anyExpL[0][0]:this._anyExpL[0]);
|
---|
1126 | var offsetX = this._resX-this._resXStart;
|
---|
1127 | var newW = parseInt(this.polyObj[objLeft].style.width)+offsetX;
|
---|
1128 | this._setWidth(objLeft, newW);
|
---|
1129 | }
|
---|
1130 | // get used cells
|
---|
1131 | var objs = {};
|
---|
1132 | var parseData = function(data) { for (var a in data) { if (typeof(data[a])=="object") { parseData(data[a]); } objs[data[a]] = true; } }
|
---|
1133 | parseData(this._anyExpT);
|
---|
1134 | parseData(this._anyExpB);
|
---|
1135 | parseData(this._anyExpL);
|
---|
1136 | parseData(this._anyExpR);
|
---|
1137 | var ids = new Array();
|
---|
1138 | for (var a in objs) { ids[ids.length] = a; }
|
---|
1139 |
|
---|
1140 | // fix inner content
|
---|
1141 | if (typeof(this._anyExpT) == "object" && this._anyExpT != null) { this.updateNestedObjectsArray(this._anyExpT); this._anyExpT = null; }
|
---|
1142 | if (typeof(this._anyExpB) == "object" && this._anyExpB != null) { this.updateNestedObjectsArray(this._anyExpB); this._anyExpB = null; }
|
---|
1143 | if (typeof(this._anyExpL) == "object" && this._anyExpL != null) { this.updateNestedObjectsArray(this._anyExpL); this._anyExpL = null; }
|
---|
1144 | if (typeof(this._anyExpR) == "object" && this._anyExpR != null) { this.updateNestedObjectsArray(this._anyExpR); this._anyExpR = null; }
|
---|
1145 |
|
---|
1146 | // clear data
|
---|
1147 | this._resObj = null;
|
---|
1148 | this._resFunc = null;
|
---|
1149 | this._hideCovers();
|
---|
1150 | //
|
---|
1151 | this.callEvent("onPanelResizeFinish", [ids]);
|
---|
1152 | //
|
---|
1153 | return;
|
---|
1154 | }
|
---|
1155 | // resize effect
|
---|
1156 | var poly = new Array();
|
---|
1157 | if (this._resObj._left != null) { for (var q=0; q<this._resObj._left.length; q++) { poly[poly.length] = this._resObj._left[q]; } }
|
---|
1158 | if (this._resObj._right != null) { for (var q=0; q<this._resObj._right.length; q++) { poly[poly.length] = this._resObj._right[q]; } }
|
---|
1159 | if (this._resObj._top != null) { for (var q=0; q<this._resObj._top.length; q++) { poly[poly.length] = this._resObj._top[q]; } }
|
---|
1160 | if (this._resObj._bottom != null) { for (var q=0; q<this._resObj._bottom.length; q++) { poly[poly.length] = this._resObj._bottom[q]; } }
|
---|
1161 | this._resFunc = null;
|
---|
1162 | this._resObj = null;
|
---|
1163 | this._hideCovers();
|
---|
1164 |
|
---|
1165 | var cells = new Array();
|
---|
1166 | for (var q=0; q<poly.length; q++) {
|
---|
1167 | if (typeof(poly[q]) == "object") {
|
---|
1168 | for (var w=0; w<poly[q].length; w++) { cells[cells.length] = this.polyObj[poly[q][w]]; }
|
---|
1169 | } else {
|
---|
1170 | cells[cells.length] = this.polyObj[poly[q]];
|
---|
1171 | }
|
---|
1172 | }
|
---|
1173 | for (var q=0; q<cells.length; q++) cells[q].updateNestedObjects();
|
---|
1174 | //
|
---|
1175 | this.callEvent("onPanelResizeFinish", []);
|
---|
1176 | }
|
---|
1177 | this._showCovers = function() {
|
---|
1178 | for (var a in this.polyObj) { if (this._effects["highlight"] && this._isResizable(a)) { this.polyObj[a].showCoverBlocker(); } }
|
---|
1179 | }
|
---|
1180 | this._hideCovers = function() {
|
---|
1181 | for (var a in this.polyObj) { this.polyObj[a].hideCoverBlocker(); }
|
---|
1182 | }
|
---|
1183 | this._isResizable = function(pId) {
|
---|
1184 | var need = false;
|
---|
1185 | for (var q=0; q<this._resAreaData.length; q++) { need = need || (this._resAreaData[q] == pId); }
|
---|
1186 | return need;
|
---|
1187 | }
|
---|
1188 | this._collectResAreaData = function(obj) {
|
---|
1189 | for (var q=0; q<obj.length; q++) {
|
---|
1190 | if (typeof(obj[q]) == "string") {
|
---|
1191 | this._resAreaData[this._resAreaData.length] = obj[q];
|
---|
1192 | } else if (typeof(obj[q]) == "object") {
|
---|
1193 | this._collectResAreaData(obj[q]);
|
---|
1194 | }
|
---|
1195 | }
|
---|
1196 | }
|
---|
1197 | this._doOnDoubleClick = function(sep) {
|
---|
1198 | if (sep._dblClick == null) return;
|
---|
1199 | if (this.polyObj[sep._dblClick] == null) return;
|
---|
1200 | // header check
|
---|
1201 | if (this.polyObj[sep._dblClick]._noHeader) return;
|
---|
1202 | // show/hide
|
---|
1203 | var obj = this.polyObj[sep._dblClick];
|
---|
1204 | if (obj.childNodes[0].style.display == "none") return;
|
---|
1205 | if (obj._collapsed == true) {
|
---|
1206 | //
|
---|
1207 | this._doExpand(obj._resize, sep._dblClick, obj._rowData, "hide");
|
---|
1208 | } else {
|
---|
1209 | // save dimension
|
---|
1210 | obj._savedW = parseInt(obj.style.width);
|
---|
1211 | obj._savedH = parseInt(obj.style.height);
|
---|
1212 | //
|
---|
1213 | this._doCollapse(obj._resize, sep._dblClick, obj._rowData, "hide");
|
---|
1214 | }
|
---|
1215 | return true;
|
---|
1216 | }
|
---|
1217 | // events
|
---|
1218 | this._doOnSelectStart = function(e) {
|
---|
1219 | e = e||event;
|
---|
1220 | if (that._resObj != null) e.returnValue = false;
|
---|
1221 | }
|
---|
1222 | this._doOnMouseMove = function(e) {
|
---|
1223 | e = e||event;
|
---|
1224 | if (that._resObj != null && that._resFunc != null) that._resFunc(e);
|
---|
1225 | }
|
---|
1226 | this._doOnMouseUp = function() {
|
---|
1227 | that._resizeStop();
|
---|
1228 | }
|
---|
1229 | if (_isIE) {
|
---|
1230 | document.body.attachEvent("onselectstart", that._doOnSelectStart);
|
---|
1231 | document.body.attachEvent("onmousemove", that._doOnMouseMove);
|
---|
1232 | document.body.attachEvent("onmouseup", that._doOnMouseUp);
|
---|
1233 | } else {
|
---|
1234 | document.body.addEventListener("mousemove", that._doOnMouseMove, false);
|
---|
1235 | document.body.addEventListener("mouseup", that._doOnMouseUp, false);
|
---|
1236 | }
|
---|
1237 | /*
|
---|
1238 | if (_isIE) {
|
---|
1239 | document.body.attachEvent("onselectstart", function(){});
|
---|
1240 | document.body.attachEvent("onmousemove", function(e){ e = e||event; if (that._resObj != null && that._resFunc != null) { that._resFunc(e); } }, false);
|
---|
1241 | document.body.attachEvent("onmouseup", function(){ that._resizeStop(); });
|
---|
1242 | } else {
|
---|
1243 | document.body.addEventListener("mousemove", function(e){ e = e||event; if (that._resObj != null && that._resFunc != null) { that._resFunc(e); } }, false);
|
---|
1244 | document.body.addEventListener("mouseup", function(){ that._resizeStop(); }, false);
|
---|
1245 | }
|
---|
1246 | */
|
---|
1247 | //
|
---|
1248 | this._doExpand = function(dir, pId, rowData, mode) { // dir=hor|ver
|
---|
1249 | // console.log("expand", mode)
|
---|
1250 | if (rowData.length <= 1) return;
|
---|
1251 | var ind = -1;
|
---|
1252 | for (var q=0; q<rowData.length; q++) { if (rowData[q] == pId) { ind = q; } }
|
---|
1253 | if (ind == -1) return;
|
---|
1254 | // go to the right/bottom
|
---|
1255 | var anyExp = null;
|
---|
1256 | for (var q=ind+1; q<rowData.length; q++) {
|
---|
1257 | if (anyExp == null) {
|
---|
1258 | if (typeof(rowData[q]) == "string") { if (this.polyObj[rowData[q]]._collapsed == false) { anyExp = rowData[q]; } } else { anyExp = rowData[q]; }
|
---|
1259 | }
|
---|
1260 | }
|
---|
1261 | // go to the left/top
|
---|
1262 | if (anyExp == null) {
|
---|
1263 | for (var q=ind-1; q>=0; q--) {
|
---|
1264 | if (anyExp == null) {
|
---|
1265 | if (typeof(rowData[q]) == "string") { if (this.polyObj[rowData[q]]._collapsed == false) { anyExp = rowData[q]; } } else { anyExp = rowData[q]; }
|
---|
1266 | }
|
---|
1267 | }
|
---|
1268 | }
|
---|
1269 | if (anyExp == null) return;
|
---|
1270 | //
|
---|
1271 | if (typeof(anyExp) != "object") { anyExp = new Array(anyExp); }
|
---|
1272 | if (dir == "hor") {
|
---|
1273 |
|
---|
1274 | var availSpace = parseInt(this.polyObj[anyExp[0]].style.width) - this._minWidth;
|
---|
1275 | var maxSize = this.polyObj[pId]._savedW;
|
---|
1276 | if (maxSize > availSpace) { maxSize = availSpace; }
|
---|
1277 | if (maxSize < this._minWidth) return;
|
---|
1278 | var step = Math.round(maxSize/3);
|
---|
1279 |
|
---|
1280 | // var maxSize = Math.round(parseInt(this.polyObj[anyExp[0]].style.width)/2);
|
---|
1281 | // var step = Math.round(this.polyObj[anyExp[0]].offsetWidth/24);
|
---|
1282 | } else {
|
---|
1283 |
|
---|
1284 | var availSpace = parseInt(this.polyObj[anyExp[0]].style.height) - this._minHeight;
|
---|
1285 | var maxSize = this.polyObj[pId]._savedH;
|
---|
1286 | if (maxSize > availSpace) { maxSize = availSpace; }
|
---|
1287 | if (maxSize < this._minHeight) return;
|
---|
1288 | var step = Math.round(maxSize/3);
|
---|
1289 |
|
---|
1290 | // var maxSize = Math.round(parseInt(this.polyObj[anyExp[0]].style.height)/2);
|
---|
1291 | // var step = Math.round(this.polyObj[anyExp[0]].offsetHeight/16);
|
---|
1292 | }
|
---|
1293 |
|
---|
1294 | // do expanding
|
---|
1295 | this.polyObj[pId].childNodes[0].childNodes[1].style.display = "";
|
---|
1296 | this.polyObj[pId].childNodes[0].childNodes[0].className = "dhtmlxPolyInfoBar";
|
---|
1297 | // icons
|
---|
1298 | this.polyObj[pId].childNodes[0].childNodes[0].childNodes[1].style.display = "";
|
---|
1299 | this.polyObj[pId].childNodes[0].childNodes[0].childNodes[2].style.display = "";
|
---|
1300 | //this.polyObj[pId].childNodes[0].childNodes[3].style.display = "";
|
---|
1301 | this.polyObj[pId].childNodes[0].childNodes[0].childNodes[4].style.display = "";
|
---|
1302 |
|
---|
1303 |
|
---|
1304 | //
|
---|
1305 | var obj2 = new Array();
|
---|
1306 | for (var q=0; q<anyExp.length; q++) { obj2[q] = this.polyObj[anyExp[q]]; }
|
---|
1307 | //
|
---|
1308 | // tabbar special mode
|
---|
1309 | if (this.polyObj[pId].className == "dhtmlxLayoutSinglePolyTabbarCollapsed") {
|
---|
1310 | this.polyObj[pId].className = "dhtmlxLayoutSinglePolyTabbar";
|
---|
1311 | }
|
---|
1312 | // console.log(dir, maxSize, this.polyObj[pId]._savedW, this.polyObj[pId]._savedH)
|
---|
1313 | this._expandEffect(this.polyObj[pId], obj2, maxSize, mode, (this._effects["collapse"]==true?step:1000000), dir);
|
---|
1314 | //
|
---|
1315 | }
|
---|
1316 | this._doCollapse = function(dir, pId, rowData, mode) { // dir=hor|ver
|
---|
1317 | // console.log("collapse", mode)
|
---|
1318 | if (rowData.length <= 1) return;
|
---|
1319 | var ind = -1;
|
---|
1320 | for (var q=0; q<rowData.length; q++) { if (rowData[q] == pId) { ind = q; } }
|
---|
1321 | if (ind == -1) return;
|
---|
1322 | // go to the right
|
---|
1323 | var anyExp = null;
|
---|
1324 | for (var q=ind+1; q<rowData.length; q++) {
|
---|
1325 | if (anyExp == null) {
|
---|
1326 | if (typeof(rowData[q]) == "string") { if (this.polyObj[rowData[q]]._collapsed == false) { anyExp = rowData[q]; } } else { anyExp = rowData[q]; }
|
---|
1327 | }
|
---|
1328 | }
|
---|
1329 | // go to the left
|
---|
1330 | if (anyExp == null) {
|
---|
1331 | for (var q=ind-1; q>=0; q--) {
|
---|
1332 | if (anyExp == null) {
|
---|
1333 | if (typeof(rowData[q]) == "string") { if (this.polyObj[rowData[q]]._collapsed == false) { anyExp = rowData[q]; } } else { anyExp = rowData[q]; }
|
---|
1334 | }
|
---|
1335 | }
|
---|
1336 | }
|
---|
1337 | if (anyExp == null) {
|
---|
1338 | if (rowData[ind+1] != null) { anyExp = rowData[ind+1]; }
|
---|
1339 | }
|
---|
1340 | // check first collapsed on the left for expanding
|
---|
1341 | if (anyExp == null) {
|
---|
1342 | if (ind-1 >= 0) {
|
---|
1343 | if (rowData[ind-1] != null) { anyExp = rowData[ind-1]; }
|
---|
1344 | }
|
---|
1345 | }
|
---|
1346 | // do collapsing
|
---|
1347 | if (anyExp != null) {
|
---|
1348 |
|
---|
1349 | if (typeof(anyExp) != "object") {
|
---|
1350 |
|
---|
1351 | if (this.polyObj[anyExp]._collapsed == true) {
|
---|
1352 | this.polyObj[anyExp].childNodes[0].childNodes[1].style.display = "";
|
---|
1353 | this.polyObj[anyExp]._collapsed = false;
|
---|
1354 | this.polyObj[anyExp].childNodes[0].childNodes[0].className = "dhtmlxPolyInfoBar";
|
---|
1355 | this.polyObj[anyExp].childNodes[0].childNodes[0].childNodes[1].style.display = "";
|
---|
1356 | this.polyObj[anyExp].childNodes[0].childNodes[0].childNodes[4].title = "Collapse";
|
---|
1357 | this.polyObj[anyExp].childNodes[0].childNodes[0].childNodes[2].style.display = "";
|
---|
1358 | this.polyObj[anyExp].childNodes[0].childNodes[0].childNodes[3].style.display = "none";
|
---|
1359 | this.polyObj[anyExp].childNodes[0].childNodes[0].childNodes[4].style.display = "";
|
---|
1360 | //
|
---|
1361 | // undock expanding window
|
---|
1362 | /*
|
---|
1363 | var wId = this.polyObj[anyExp].childNodes[0]._win;
|
---|
1364 | var win = this.dhxWins.window(wId);
|
---|
1365 | if (!win._isDocked) { this.dockWindow(anyExp, wId); }
|
---|
1366 | */
|
---|
1367 |
|
---|
1368 | // dock undocked window
|
---|
1369 | if (this.polyObj[anyExp]._isUnDocked === true) { this.dockWindow(anyExp); }
|
---|
1370 |
|
---|
1371 | //
|
---|
1372 | // console.log("need to undock "+this.polyObj[anyExp].childNodes[0]._win)
|
---|
1373 | //
|
---|
1374 | // tabbar special mode
|
---|
1375 | if (this.polyObj[anyExp].className == "dhtmlxLayoutSinglePolyTabbarCollapsed") {
|
---|
1376 | this.polyObj[anyExp].className = "dhtmlxLayoutSinglePolyTabbar";
|
---|
1377 | }
|
---|
1378 | // show/hide splitter images
|
---|
1379 | this._fixSplitters();
|
---|
1380 | // check icons
|
---|
1381 | this._fixIcons();
|
---|
1382 | // event
|
---|
1383 | this.callEvent("onExpand", [anyExp]);
|
---|
1384 | }
|
---|
1385 |
|
---|
1386 | anyExp = new Array(anyExp);
|
---|
1387 | }
|
---|
1388 | var obj2 = new Array();
|
---|
1389 | for (var q=0; q<anyExp.length; q++) { obj2[q] = this.polyObj[anyExp[q]]; }
|
---|
1390 | //
|
---|
1391 | if (dir == "hor") {
|
---|
1392 | var step = Math.round(Math.max(this.polyObj[pId].offsetWidth, this.polyObj[anyExp[0]].offsetWidth)/3);
|
---|
1393 | } else {
|
---|
1394 | var step = Math.round(Math.max(this.polyObj[pId].offsetHeight, this.polyObj[anyExp[0]].offsetHeight)/3);
|
---|
1395 | }
|
---|
1396 |
|
---|
1397 | this.polyObj[pId].childNodes[0].childNodes[1].style.display = "none";
|
---|
1398 | //
|
---|
1399 | this._collapseEffect(this.polyObj[pId], obj2, mode, (this._effects["collapse"]==true?step:1000000), dir);
|
---|
1400 | }
|
---|
1401 | }
|
---|
1402 |
|
---|
1403 | /**
|
---|
1404 | * @desc: sets effect
|
---|
1405 | * @param: efName - effect's name
|
---|
1406 | * @param: efValue - true/false
|
---|
1407 | * @type: public
|
---|
1408 | */
|
---|
1409 | this.setEffect = function(efName, efValue) {
|
---|
1410 | if (this._effects[efName] != null && typeof(efValue) == "boolean") {
|
---|
1411 | this._effects[efName] = efValue;
|
---|
1412 | }
|
---|
1413 | }
|
---|
1414 | /**
|
---|
1415 | * @desc: returns true if the effect is enabled
|
---|
1416 | * @param: efName - effect name
|
---|
1417 | * @param: efValue - true/false
|
---|
1418 | * @type: public
|
---|
1419 | */
|
---|
1420 | this.getEffect = function(efName) {
|
---|
1421 | if (this._effects[efName] != null) { return this._effects[efName]; }
|
---|
1422 | return null;
|
---|
1423 | }
|
---|
1424 |
|
---|
1425 | this._expandEffect = function(obj, obj2, maxSize, mode, step, dir) {
|
---|
1426 | //
|
---|
1427 | if (dir == "hor") {
|
---|
1428 | var s = parseInt(obj.style.width);
|
---|
1429 | var s2 = parseInt(obj2[0].style.width);
|
---|
1430 | } else {
|
---|
1431 | var s = parseInt(obj.style.height);
|
---|
1432 | var s2 = parseInt(obj2[0].style.height);
|
---|
1433 | }
|
---|
1434 | var newS = s + step;
|
---|
1435 | if (newS > maxSize) { newS = maxSize; }
|
---|
1436 | //
|
---|
1437 | if (dir == "hor") {
|
---|
1438 | obj.style.width = newS+"px";
|
---|
1439 | obj.childNodes[0].style.width = obj.style.width;
|
---|
1440 | // obj.childNodes[1].style.width = newS+"px";
|
---|
1441 | } else {
|
---|
1442 | obj.style.height = newS+"px";
|
---|
1443 | obj.childNodes[0].style.height = obj.style.height;
|
---|
1444 | // obj.childNodes[1].style.height = newS-obj.childNodes[0]._h+"px";
|
---|
1445 | }
|
---|
1446 | obj.adjustContent(obj.childNodes[0], (obj._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));
|
---|
1447 | //
|
---|
1448 | for (var q=0; q<obj2.length; q++) {
|
---|
1449 | if (dir == "hor") {
|
---|
1450 | obj2[q].style.width = s2+s-newS+"px";
|
---|
1451 | obj2[q].childNodes[0].style.width = obj2[q].style.width;
|
---|
1452 | // obj2[q].childNodes[1].style.width = s2+s-newS+"px";
|
---|
1453 | } else {
|
---|
1454 | obj2[q].style.height = s2+s-newS+"px";
|
---|
1455 | obj2[q].childNodes[0].style.height = obj2[q].style.height;
|
---|
1456 | // obj2[q].childNodes[1].style.height = s2+s-newS-obj2[q].childNodes[0]._h+"px";
|
---|
1457 | }
|
---|
1458 | obj2[q].adjustContent(obj2[q].childNodes[0], (obj2[q]._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));
|
---|
1459 | }
|
---|
1460 | //
|
---|
1461 | if (newS != maxSize) {
|
---|
1462 | window.setTimeout(function(){that._expandEffect(obj, obj2, maxSize, mode, step, dir);}, 4);
|
---|
1463 | } else {
|
---|
1464 | obj._collapsed = false;
|
---|
1465 | // dock expanding window
|
---|
1466 | /*
|
---|
1467 | var wId = obj.childNodes[0]._win;
|
---|
1468 | var win = this.dhxWins.window(wId);
|
---|
1469 | if (!win._isDocked) { this.dockWindow(obj._idd, wId); }
|
---|
1470 | */
|
---|
1471 | //
|
---|
1472 | // sizing grid/tabbar
|
---|
1473 | for (var q=0; q<obj2.length; q++) { obj2[q].updateNestedObjects(); }
|
---|
1474 | this.polyObj[obj._idd].updateNestedObjects();
|
---|
1475 |
|
---|
1476 | this.polyObj[obj._idd].childNodes[0].childNodes[0].childNodes[4].title = "Collapse";
|
---|
1477 | //
|
---|
1478 | // show/hide splitter images
|
---|
1479 | this._fixSplitters();
|
---|
1480 | // check icons
|
---|
1481 | this._fixIcons();
|
---|
1482 | // event
|
---|
1483 | this.callEvent("onExpand", [obj._idd]);
|
---|
1484 | }
|
---|
1485 | }
|
---|
1486 | this._collapseEffect = function(obj, obj2, mode, step, dir) {
|
---|
1487 | //
|
---|
1488 | if (dir == "hor") {
|
---|
1489 | var s = parseInt(obj.style.width);
|
---|
1490 | var s2 = parseInt(obj2[0].style.width);
|
---|
1491 | } else {
|
---|
1492 | var s = parseInt(obj.style.height);
|
---|
1493 | var s2 = parseInt(obj2[0].style.height);
|
---|
1494 | }
|
---|
1495 | var newS = s - step;
|
---|
1496 | if (dir == "hor") {
|
---|
1497 | if (newS < this._collapsedW) { newS = this._collapsedW; }
|
---|
1498 | obj.style.width = newS+"px";
|
---|
1499 | obj.childNodes[0].style.width = obj.style.width;
|
---|
1500 | //obj.childNodes[1].style.width = newS+"px";
|
---|
1501 | } else {
|
---|
1502 | if (newS < this._collapsedH) { newS = this._collapsedH; }
|
---|
1503 | obj.style.height = newS+"px";
|
---|
1504 | obj.childNodes[0].style.height = obj.style.height;
|
---|
1505 | //var p = newS-obj.childNodes[0]._h;
|
---|
1506 | //if (p < 0) { p = 0; }
|
---|
1507 | //obj.childNodes[1].style.height = p+"px";
|
---|
1508 | }
|
---|
1509 | // obj.adjustContent(obj.childNodes[0], this.skinParams[this.skin]["cpanel_height"]);
|
---|
1510 | //
|
---|
1511 |
|
---|
1512 | for (var q=0; q<obj2.length; q++) {
|
---|
1513 | if (dir == "hor") {
|
---|
1514 | obj2[q].style.width = s2+(s-newS)+"px";
|
---|
1515 | obj2[q].childNodes[0].style.width = obj2[q].style.width;
|
---|
1516 | // obj2[q].adjustContent(obj2[q].childNodes[0], this.skinParams[this.skin]["cpanel_height"]);
|
---|
1517 | // obj2[q].childNodes[1].style.width = s2+(s-newS)+"px";
|
---|
1518 | } else {
|
---|
1519 | obj2[q].style.height = s2+(s-newS)+"px";
|
---|
1520 | obj2[q].childNodes[0].style.height = obj2[q].style.height;
|
---|
1521 | // obj2[q].adjustContent(obj2[q].childNodes[0], this.skinParams[this.skin]["cpanel_height"]);
|
---|
1522 | //this.polyObj[anyExpL[q]].adjustContent(this.polyObj[anyExpL[q]].childNodes[0], this.skinParams[this.skin]["cpanel_height"]);
|
---|
1523 | // obj2[q].childNodes[1].style.height = s2+(s-newS)-obj2[q].childNodes[0]._h+"px";
|
---|
1524 | }
|
---|
1525 | obj2[q].adjustContent(obj2[q].childNodes[0], (obj2[q]._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));
|
---|
1526 | }
|
---|
1527 |
|
---|
1528 | //
|
---|
1529 | if ((newS > this._collapsedW && dir == "hor") || (newS > this._collapsedH && dir == "ver")) {
|
---|
1530 | window.setTimeout(function(){that._collapseEffect(obj, obj2, mode, step, dir);}, 4);
|
---|
1531 | } else {
|
---|
1532 | for (var q=0; q<obj2.length; q++) {
|
---|
1533 | if (dir == "hor") {
|
---|
1534 | obj2[q].style.width = s2+(s-newS)+"px";
|
---|
1535 | obj2[q].childNodes[0].style.width = obj2[q].style.width;
|
---|
1536 | } else {
|
---|
1537 | //obj2[q].style.height = s2+(s-newS)-obj2[q].childNodes[0]._h+"px";
|
---|
1538 | obj2[q].style.height = s2+(s-newS)+"px";
|
---|
1539 | obj2[q].childNodes[0].style.height = obj2[q].style.height;
|
---|
1540 | }
|
---|
1541 | obj2[q].adjustContent(obj2[q].childNodes[0], (obj2[q]._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));
|
---|
1542 | }
|
---|
1543 | // finish collapsing
|
---|
1544 | obj._collapsed = true;
|
---|
1545 | // obj.childNodes[1].style.display = "none";
|
---|
1546 | if (dir == "hor") {
|
---|
1547 | obj.childNodes[0].childNodes[0].className = "dhtmlxPolyInfoBarCollapsedVer";
|
---|
1548 | } else {
|
---|
1549 | obj.childNodes[0].childNodes[0].className = "dhtmlxPolyInfoBarCollapsedHor";
|
---|
1550 | }
|
---|
1551 | // sizing components
|
---|
1552 | for (var q=0; q<obj2.length; q++) { obj2[q].updateNestedObjects(); }
|
---|
1553 | // icons
|
---|
1554 | if (mode == "hide") {
|
---|
1555 | obj.childNodes[0].childNodes[0].childNodes[1].style.display = "";
|
---|
1556 | obj.childNodes[0].childNodes[0].childNodes[2].style.display = "none";
|
---|
1557 | obj.childNodes[0].childNodes[0].childNodes[3].style.display = "none";
|
---|
1558 | obj.childNodes[0].childNodes[0].childNodes[4].style.display = "";
|
---|
1559 | } else {
|
---|
1560 | obj.childNodes[0].childNodes[0].childNodes[1].style.display = "";
|
---|
1561 | obj.childNodes[0].childNodes[0].childNodes[2].style.display = "";
|
---|
1562 | obj.childNodes[0].childNodes[0].childNodes[3].style.display = "none";
|
---|
1563 | obj.childNodes[0].childNodes[0].childNodes[4].style.display = "none";
|
---|
1564 | }
|
---|
1565 | // tabbar special mode
|
---|
1566 | if (obj.className == "dhtmlxLayoutSinglePolyTabbar") {
|
---|
1567 | obj.className = "dhtmlxLayoutSinglePolyTabbarCollapsed";
|
---|
1568 | }
|
---|
1569 | this.polyObj[obj._idd].childNodes[0].childNodes[0].childNodes[4].title = "Expand";
|
---|
1570 | // show/hide splitter images
|
---|
1571 | this._fixSplitters();
|
---|
1572 | // check icons
|
---|
1573 | this._fixIcons();
|
---|
1574 | // events
|
---|
1575 | this.callEvent("onCollapse", [obj._idd]);
|
---|
1576 | }
|
---|
1577 | }
|
---|
1578 |
|
---|
1579 | this._setW = function(cellObj, w) {
|
---|
1580 | cellObj.style.width = w + "px";
|
---|
1581 | cellObj.childNodes[0].style.width = cellObj.style.width;
|
---|
1582 | cellObj.adjustContent(cellObj.childNodes[0], (cellObj._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));
|
---|
1583 | }
|
---|
1584 | this._setH = function(cellObj, h) {
|
---|
1585 | cellObj.style.height = h + "px";
|
---|
1586 | cellObj.childNodes[0].style.height = cellObj.style.height;
|
---|
1587 | cellObj.adjustContent(cellObj.childNodes[0], (cellObj._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));
|
---|
1588 | }
|
---|
1589 | this._setWidth = function(pId, width) {
|
---|
1590 | if (this.polyObj[pId] == null) return;
|
---|
1591 | if (!Number(width)) return;
|
---|
1592 | var sep = null;
|
---|
1593 | //
|
---|
1594 | for (var q=0; q<this.sepVer.length; q++) {
|
---|
1595 | var p = this.sepVer[q]._left;
|
---|
1596 | if (p[p.length-1] == pId) {
|
---|
1597 | sep = new Array(this.sepVer[q], "left");
|
---|
1598 | } else if (typeof(p[p.length-1]) == "object") {
|
---|
1599 | var k = p[p.length-1];
|
---|
1600 | for (var e=0; e<k.length; e++) { if (k[e] == pId) { sep = new Array(this.sepVer[q], "left"); } }
|
---|
1601 | }
|
---|
1602 | //
|
---|
1603 | var p = this.sepVer[q]._right;
|
---|
1604 | if (p[0] == pId) {
|
---|
1605 | sep = new Array(this.sepVer[q], "right");
|
---|
1606 | } else if (typeof(p[0]) == "object") {
|
---|
1607 | var k = p[0];
|
---|
1608 | for (var e=0; e<k.length; e++) { if (k[e] == pId) { sep = new Array(this.sepVer[q], "right"); } }
|
---|
1609 | }
|
---|
1610 | }
|
---|
1611 | if (sep != null) {
|
---|
1612 | // allow resizing
|
---|
1613 | var set = this._findDockCellsVer(sep[0]);
|
---|
1614 | var anyExpL = set[0];
|
---|
1615 | var anyExpR = set[1];
|
---|
1616 | if (anyExpL == null || anyExpR == null) return;
|
---|
1617 | var sumSize = parseInt(this.polyObj[anyExpL[0]].style.width) + parseInt(this.polyObj[anyExpR[0]].style.width);
|
---|
1618 | if (width < this._minWidth) { width = this._minWidth; } else if (width > sumSize - this._minWidth) { width = sumSize - this._minWidth; }
|
---|
1619 | var width2 = sumSize - width;
|
---|
1620 | //
|
---|
1621 | for (var q=0; q<anyExpL.length; q++) {
|
---|
1622 | this._setW(this.polyObj[anyExpL[q]],(sep[1]=="left"?width:width2));
|
---|
1623 | this.polyObj[anyExpL[q]].updateNestedObjects();
|
---|
1624 | }
|
---|
1625 | for (var q=0; q<anyExpR.length; q++) {
|
---|
1626 | this._setW(this.polyObj[anyExpR[q]],(sep[1]=="right"?width:width2));
|
---|
1627 | this.polyObj[anyExpR[q]].updateNestedObjects();
|
---|
1628 | }
|
---|
1629 | }
|
---|
1630 | }
|
---|
1631 | this._setHeight = function(pId, height) {
|
---|
1632 | if (this.polyObj[pId] == null) return;
|
---|
1633 | if (!Number(height)) return;
|
---|
1634 | var sep = null;
|
---|
1635 | //
|
---|
1636 | for (var q=0; q<this.sepHor.length; q++) {
|
---|
1637 | var p = this.sepHor[q]._top;
|
---|
1638 | if (p[p.length-1] == pId) {
|
---|
1639 | sep = new Array(this.sepHor[q], "top");
|
---|
1640 | } else if (typeof(p[p.length-1]) == "object") {
|
---|
1641 | var k = p[p.length-1];
|
---|
1642 | for (var e=0; e<k.length; e++) { if (k[e] == pId) { sep = new Array(this.sepHor[q], "top"); } }
|
---|
1643 | }
|
---|
1644 | //
|
---|
1645 | var p = this.sepHor[q]._bottom;
|
---|
1646 | if (p[0] == pId) {
|
---|
1647 | sep = new Array(this.sepHor[q], "bottom");
|
---|
1648 | } else if (typeof(p[0]) == "object") {
|
---|
1649 | var k = p[0];
|
---|
1650 | for (var e=0; e<k.length; e++) { if (k[e] == pId) { sep = new Array(this.sepHor[q], "bottom"); } }
|
---|
1651 | }
|
---|
1652 | }
|
---|
1653 | if (sep != null) {
|
---|
1654 | // allow resizing
|
---|
1655 | var set = this._findDockCellsHor(sep[0]);
|
---|
1656 | var anyExpT = set[0];
|
---|
1657 | var anyExpB = set[1];
|
---|
1658 | if (anyExpT == null || anyExpB == null) return;
|
---|
1659 | var sumSize = parseInt(this.polyObj[anyExpT[0]].style.height) + parseInt(this.polyObj[anyExpB[0]].style.height);
|
---|
1660 | if (height < this._minHeight) { height = this._minHeight; } else if (height > sumSize - this._minHeight) { height = sumSize - this._minHeight; }
|
---|
1661 | var height2 = sumSize - height;
|
---|
1662 | //
|
---|
1663 | for (var q=0; q<anyExpT.length; q++) {
|
---|
1664 | this._setH(this.polyObj[anyExpT[q]],(sep[1]=="top"?height:height2));
|
---|
1665 | this.polyObj[anyExpT[q]].updateNestedObjects();
|
---|
1666 | }
|
---|
1667 | for (var q=0; q<anyExpB.length; q++) {
|
---|
1668 | this._setH(this.polyObj[anyExpB[q]],(sep[1]=="bottom"?height:height2));
|
---|
1669 | this.polyObj[anyExpB[q]].updateNestedObjects();
|
---|
1670 | }
|
---|
1671 | }
|
---|
1672 | }
|
---|
1673 | this.updateNestedObjectsArray = function(obj) {
|
---|
1674 | for (var q=0; q<obj.length; q++) {
|
---|
1675 | if (typeof(obj[q])=="object") {
|
---|
1676 | this.updateNestedObjectsArray(obj[q]);
|
---|
1677 | } else {
|
---|
1678 | this.polyObj[obj[q]].updateNestedObjects();
|
---|
1679 | }
|
---|
1680 | }
|
---|
1681 | }
|
---|
1682 | this.dockWindow = function(id) {
|
---|
1683 | if (!this.dhxWins) return;
|
---|
1684 | if (!this.dhxWins.window(this.dhxWinsIdPrefix+id)) return;
|
---|
1685 | this.dhxWins.window(this.dhxWinsIdPrefix+id).close();
|
---|
1686 | this.dhxWins.window(this.dhxWinsIdPrefix+id).moveContentTo(this.polyObj[id]);
|
---|
1687 | this.polyObj[id]._isUnDocked = false;
|
---|
1688 | this.callEvent("onDock", [id]);
|
---|
1689 | }
|
---|
1690 | this.unDockWindow = function(id) {
|
---|
1691 | this._initWindows(id);
|
---|
1692 | this.polyObj[id].moveContentTo(this.dhxWins.window(this.dhxWinsIdPrefix+id));
|
---|
1693 | this.polyObj[id]._isUnDocked = true;
|
---|
1694 | this.callEvent("onUnDock", [id]);
|
---|
1695 | }
|
---|
1696 |
|
---|
1697 | this._initWindows = function(id) {
|
---|
1698 | if (!window.dhtmlXWindows) return;
|
---|
1699 | if (!this.dhxWins) {
|
---|
1700 | this.dhxWins = new dhtmlXWindows();
|
---|
1701 | this.dhxWins.setSkin(this.skin);
|
---|
1702 | this.dhxWins.setImagePath(this.imagePath);
|
---|
1703 | this.dhxWinsIdPrefix = "";//this.cont.obj._genStr(12);
|
---|
1704 | if (!id) return;
|
---|
1705 | }
|
---|
1706 | var idd = this.dhxWinsIdPrefix+id;
|
---|
1707 | if (!this.dhxWins.window(idd)) {
|
---|
1708 | var self = this;
|
---|
1709 | var w1 = this.dhxWins.createWindow(idd, 20, 20, 320, 200);
|
---|
1710 | w1.setText(this.polyObj[id].getText());
|
---|
1711 | w1.button("close").hide();
|
---|
1712 | w1.attachEvent("onClose", function(win){win.hide();});
|
---|
1713 | w1.addUserButton("dock", 99, "Dock", "dock");
|
---|
1714 | w1.button("dock").attachEvent("onClick", function(win){self.polyObj[id].dock();});
|
---|
1715 | w1.dockedCell = this.polyObj[id];
|
---|
1716 | } else {
|
---|
1717 | this.dhxWins.window(idd).show();
|
---|
1718 | }
|
---|
1719 | }
|
---|
1720 |
|
---|
1721 | this.isPanelVisible = function(pId) {
|
---|
1722 | return (!this.polyObj[pId]._noHeader);
|
---|
1723 | }
|
---|
1724 | this.showPanel = function(pId) {
|
---|
1725 | if (this.polyObj[pId] == null) return;
|
---|
1726 | if (this.polyObj[pId]._collapsed == true) return;
|
---|
1727 | var bar = this.polyObj[pId].childNodes[0].childNodes[0];
|
---|
1728 | /*
|
---|
1729 | if (bar._tabbarMode == -2) {
|
---|
1730 | this.dhxWins.window(bar._win).tabbar._tabZone.style.display='';
|
---|
1731 | this.dhxWins.window(bar._win).tabbar.adjustOuterSize();
|
---|
1732 | return bar._tabbarMode = -1;
|
---|
1733 | }
|
---|
1734 | if (bar._tabbarMode == -1) return;
|
---|
1735 | */
|
---|
1736 | //bar._h = this._CPanelHeight;
|
---|
1737 | //this.polyObj[pId].childNodes[1].style.height = parseInt(this.polyObj[pId].style.height) - bar._h + "px";
|
---|
1738 | bar.style.display = "";
|
---|
1739 | this.polyObj[pId]._noHeader = false;
|
---|
1740 | this.polyObj[pId].adjustContent(this.polyObj[pId].childNodes[0], this.skinParams[this.skin]["cpanel_height"]);
|
---|
1741 | this.polyObj[pId].updateNestedObjects();
|
---|
1742 | }
|
---|
1743 | this.hidePanel = function(pId) {
|
---|
1744 | if (this.polyObj[pId] == null) return;
|
---|
1745 | if (this.polyObj[pId]._collapsed == true) return;
|
---|
1746 | var bar = this.polyObj[pId].childNodes[0].childNodes[0];
|
---|
1747 | /*
|
---|
1748 | if (typeof bar._tabbarMode == "undefined") {
|
---|
1749 | bar.style.display = "none";
|
---|
1750 | } else {
|
---|
1751 | if (bar._tabbarMode===true) {
|
---|
1752 | this.polyObj[pId].childNodes[1].style.position = "absolute";
|
---|
1753 | bar._tabbarMode = -1;
|
---|
1754 | } else if (bar._tabbarMode == -1) {
|
---|
1755 | this.dhxWins.window(bar._win).tabbar._tabZone.style.display='none'
|
---|
1756 | this.dhxWins.window(bar._win).tabbar.adjustOuterSize();
|
---|
1757 | bar._tabbarMode = -2;
|
---|
1758 | }
|
---|
1759 | }
|
---|
1760 | */
|
---|
1761 |
|
---|
1762 | bar.style.display = "none";
|
---|
1763 |
|
---|
1764 | // bar._h = 0;
|
---|
1765 | this.polyObj[pId]._noHeader = true;
|
---|
1766 | this.polyObj[pId].adjustContent(this.polyObj[pId].childNodes[0], 0);
|
---|
1767 | this.polyObj[pId].updateNestedObjects();
|
---|
1768 | }
|
---|
1769 | this.setText = function(pId, text) {
|
---|
1770 | this._changeCPanelText(pId, text);
|
---|
1771 | // this.dhxWins.window("w"+pId).setText(text);
|
---|
1772 | }
|
---|
1773 | this.getText = function(pId) {
|
---|
1774 | return this.polyObj[pId].childNodes[0].childNodes[0].childNodes[0].innerHTML;
|
---|
1775 | }
|
---|
1776 | this._changeCPanelText = function(pId, text) {
|
---|
1777 | var layout = that;
|
---|
1778 | if (layout.polyObj[pId] == null) return;
|
---|
1779 | layout.polyObj[pId].childNodes[0].childNodes[0].childNodes[0].innerHTML = text;
|
---|
1780 | if (that.dhxWins != null) {
|
---|
1781 | if (that.dhxWins.window(that.dhxWinsIdPrefix+pId) != null) {
|
---|
1782 | that.dhxWins.window(that.dhxWinsIdPrefix+pId).setText(text);
|
---|
1783 | }
|
---|
1784 | }
|
---|
1785 | }
|
---|
1786 | /**
|
---|
1787 | * @desc: iterator, calls a user-defined function n-times
|
---|
1788 | * @param: handler - user-defined function, passed cell's object as an argument
|
---|
1789 | * @type: public
|
---|
1790 | */
|
---|
1791 | this.forEachItem = function(handler) {
|
---|
1792 | for (var q=0; q<this.items.length; q++) {
|
---|
1793 | handler(this.items[q]);//, this.items[q]._idd, this.items[q]._ind);
|
---|
1794 | }
|
---|
1795 | }
|
---|
1796 | this._fixPositionInWin = function(w, h) {
|
---|
1797 | this.base.style.width = w+"px";
|
---|
1798 | this.base.style.height = h+"px";
|
---|
1799 | }
|
---|
1800 | /**
|
---|
1801 | * @desc: attaches a dhtmlxMenu to the whole container
|
---|
1802 | * @type: public
|
---|
1803 | */
|
---|
1804 | this.attachMenu = function() {
|
---|
1805 | if (this.base._isWindow) {
|
---|
1806 | // layout attached into window
|
---|
1807 | this.menu = this.base._window.attachMenu();
|
---|
1808 | } else {
|
---|
1809 | // layout attached to object
|
---|
1810 | this.cont.obj.skin = this.skin;
|
---|
1811 | this.menu = this.cont.obj.attachMenu();
|
---|
1812 | this.cont.obj.adjustContent(this.cont.obj, 0);
|
---|
1813 | this.setSizes();
|
---|
1814 | }
|
---|
1815 | return this.menu;
|
---|
1816 | }
|
---|
1817 | /**
|
---|
1818 | * @desc: detaches a dhtmlxMenu from the whole container
|
---|
1819 | * @type: public
|
---|
1820 | */
|
---|
1821 | this.detachMenu = function() {
|
---|
1822 | if (!this.menu) return;
|
---|
1823 | this.cont.obj.detachMenu();
|
---|
1824 | this.setSizes();
|
---|
1825 | this.menu = null;
|
---|
1826 | }
|
---|
1827 | /**
|
---|
1828 | * @desc: shows dhtmlxMenu on the whole container
|
---|
1829 | * @type: public
|
---|
1830 | */
|
---|
1831 | this.showMenu = function() {
|
---|
1832 | if (!this.menu) return;
|
---|
1833 | this.cont.obj.showMenu();
|
---|
1834 | this.setSizes();
|
---|
1835 | }
|
---|
1836 | /**
|
---|
1837 | * @desc: hides dhtmlxMenu on the whole container
|
---|
1838 | * @type: public
|
---|
1839 | */
|
---|
1840 | this.hideMenu = function() {
|
---|
1841 | if (!this.menu) return;
|
---|
1842 | this.cont.obj.hideMenu();
|
---|
1843 | this.setSizes();
|
---|
1844 | }
|
---|
1845 | /**
|
---|
1846 | * @desc: attaches a dhtmlxToolbar to the whole container
|
---|
1847 | * @type: public
|
---|
1848 | */
|
---|
1849 | this.attachToolbar = function() {
|
---|
1850 | if (this.base._isWindow) {
|
---|
1851 | // layout attached into window
|
---|
1852 | this.toolbar = this.base._window.attachToolbar();
|
---|
1853 | } else {
|
---|
1854 | // layout attached to object
|
---|
1855 | this.cont.obj.skin = this.skin;
|
---|
1856 | this.toolbar = this.cont.obj.attachToolbar();
|
---|
1857 | this.cont.obj.adjustContent(this.cont.obj, 0);
|
---|
1858 | this.setSizes();
|
---|
1859 | }
|
---|
1860 | return this.toolbar;
|
---|
1861 | }
|
---|
1862 | /**
|
---|
1863 | * @desc: detaches a dhtmlxToolbar from the whole container
|
---|
1864 | * @type: public
|
---|
1865 | */
|
---|
1866 | this.detachToolbar = function() {
|
---|
1867 | if (!this.toolbar) return;
|
---|
1868 | this.cont.obj.detachToolbar();
|
---|
1869 | this.setSizes();
|
---|
1870 | this.toolbar = null;
|
---|
1871 | }
|
---|
1872 | /**
|
---|
1873 | * @desc: shows dhtmlxToolbar on the whole container
|
---|
1874 | * @type: public
|
---|
1875 | */
|
---|
1876 | this.showToolbar = function() {
|
---|
1877 | if (!this.toolbar) return;
|
---|
1878 | this.cont.obj.showToolbar();
|
---|
1879 | this.setSizes();
|
---|
1880 | }
|
---|
1881 | /**
|
---|
1882 | * @desc: hides dhtmlxToolbar on the whole container
|
---|
1883 | * @type: public
|
---|
1884 | */
|
---|
1885 | this.hideToolbar = function() {
|
---|
1886 | if (!this.toolbar) return;
|
---|
1887 | this.cont.obj.hideToolbar();
|
---|
1888 | this.setSizes();
|
---|
1889 | }
|
---|
1890 | /**
|
---|
1891 | * @desc: attaches a status bar to the whole container
|
---|
1892 | * @type: public
|
---|
1893 | */
|
---|
1894 | this.attachStatusBar = function() {
|
---|
1895 | if (this.base._isWindow) {
|
---|
1896 | // layout attached into window
|
---|
1897 | this.statusbar = this.base._window.attachStatusBar();
|
---|
1898 | } else {
|
---|
1899 | // layout attached to object
|
---|
1900 | this.statusbar = this.cont.obj.attachStatusBar();
|
---|
1901 | this.cont.obj.adjustContent(this.cont.obj, 0);
|
---|
1902 | this.setSizes();
|
---|
1903 | }
|
---|
1904 | return this.statusbar;
|
---|
1905 | }
|
---|
1906 | /**
|
---|
1907 | * @desc: detaches a status bar from the whole container
|
---|
1908 | * @type: public
|
---|
1909 | */
|
---|
1910 | this.detachStatusBar = function() {
|
---|
1911 | if (!this.sb) return;
|
---|
1912 | this.cont.obj.detachStatusBar();
|
---|
1913 | this.setSizes();
|
---|
1914 | this.sb = null;
|
---|
1915 | }
|
---|
1916 | /**
|
---|
1917 | * @desc: shows status bar on the whole container
|
---|
1918 | * @type: public
|
---|
1919 | */
|
---|
1920 | this.showStatusBar = function() {
|
---|
1921 | if (!this.sb) return;
|
---|
1922 | this.cont.obj.showStatusBar();
|
---|
1923 | this.setSizes();
|
---|
1924 | }
|
---|
1925 | /**
|
---|
1926 | * @desc: hides status bar on the whole container
|
---|
1927 | * @type: public
|
---|
1928 | */
|
---|
1929 | this.hideStatusBar = function() {
|
---|
1930 | if (!this.sb) return;
|
---|
1931 | this.cont.obj.hideStatusBar();
|
---|
1932 | this.setSizes();
|
---|
1933 | }
|
---|
1934 | /**
|
---|
1935 | * @desc: hides status bar indicator for full layout
|
---|
1936 | * @type: public
|
---|
1937 | */
|
---|
1938 | this.progressOn = function() {
|
---|
1939 | this._progressControlGlobal(true);
|
---|
1940 | }
|
---|
1941 | /**
|
---|
1942 | * @desc: hides progress indicator for full layout
|
---|
1943 | * @type: public
|
---|
1944 | */
|
---|
1945 | this.progressOff = function() {
|
---|
1946 | this._progressControlGlobal(false);
|
---|
1947 | }
|
---|
1948 | this._progressControl = function(id, state) {
|
---|
1949 | if (this.polyObj[id] == null) return;
|
---|
1950 | if (this.polyObj[id]._progressCover == null) {
|
---|
1951 | // console.log(this.polyObj[id].childNodes[0])
|
---|
1952 |
|
---|
1953 | var p1 = document.createElement("DIV");
|
---|
1954 | p1.className = "dhtmlxLayoutPolyProgress";
|
---|
1955 | this.polyObj[id].childNodes[0].appendChild(p1);
|
---|
1956 |
|
---|
1957 | var p2 = document.createElement("DIV");
|
---|
1958 | p2.className = "dhtmlxLayoutPolyProgressBGIMG";
|
---|
1959 | this.polyObj[id].childNodes[0].appendChild(p2);
|
---|
1960 |
|
---|
1961 | this.polyObj[id]._progressCover = new Array(p1,p2);
|
---|
1962 | /*
|
---|
1963 | var pObj = this.polyObj[id].childNodes[0].childNodes[1];
|
---|
1964 | var p1 = document.createElement("DIV");
|
---|
1965 | p1.className = "dhtmlxLayoutPolyProgress";
|
---|
1966 | pObj.insertBefore(p1, pObj.childNodes[pObj.childNodes.length-1]);
|
---|
1967 | //
|
---|
1968 | var p2 = document.createElement("DIV");
|
---|
1969 | p2.className = "dhtmlxLayoutPolyProgressBGIMG";
|
---|
1970 | pObj.insertBefore(p2, pObj.childNodes[pObj.childNodes.length-1]);
|
---|
1971 | //
|
---|
1972 | this.polyObj[id]._progressCover = new Array(p1,p2);
|
---|
1973 | */
|
---|
1974 | }
|
---|
1975 | // return;
|
---|
1976 | this.polyObj[id]._progressCover[0].style.display = (state==true?"":"none");
|
---|
1977 | this.polyObj[id]._progressCover[1].style.display = this.polyObj[id]._progressCover[0].style.display;
|
---|
1978 | }
|
---|
1979 | this._progressControlGlobal = function(state) {
|
---|
1980 | if (this._progressCover == null) {
|
---|
1981 | var p1 = document.createElement("DIV");
|
---|
1982 | p1.className = "dhtmlxLayoutPolyProgressGlobal_"+this.skin;
|
---|
1983 | this.obj.appendChild(p1);
|
---|
1984 | var p2 = document.createElement("DIV");
|
---|
1985 | p2.className = "dhtmlxLayoutPolyProgressBGIMGGlobal_"+this.skin;
|
---|
1986 | this.obj.appendChild(p2);
|
---|
1987 | this._progressCover = new Array(p1,p2);
|
---|
1988 | }
|
---|
1989 | this._progressCover[0].style.display = (state==true?"":"none");
|
---|
1990 | this._progressCover[1].style.display = this._progressCover[0].style.display;
|
---|
1991 | }
|
---|
1992 | // static sizes
|
---|
1993 | this._fixSize = function(pId, width, height) {
|
---|
1994 | if (this.polyObj[pId] == null) return;
|
---|
1995 | this.polyObj[pId]._isBlockedWidth = width;
|
---|
1996 | this.polyObj[pId]._isBlockedHeight = height;
|
---|
1997 | this._fixSplitters();
|
---|
1998 | }
|
---|
1999 | this._fixSplitters = function() {
|
---|
2000 | // vertical splitters
|
---|
2001 | // console.log(this.sepVer)
|
---|
2002 | for (var q=0; q<this.sepVer.length; q++) {
|
---|
2003 | var data = this._findDockCellsVer(this.sepVer[q]);
|
---|
2004 | // console.log(data)
|
---|
2005 | if (data[0] == null || data[1] == null) {
|
---|
2006 | if (this.sepVer[q].className != "dhtmlxLayoutPolySplitterVerInactive") { this.sepVer[q].className = "dhtmlxLayoutPolySplitterVerInactive"; }
|
---|
2007 | } else {
|
---|
2008 | if (this.sepVer[q].className != "dhtmlxLayoutPolySplitterVer") { this.sepVer[q].className = "dhtmlxLayoutPolySplitterVer"; }
|
---|
2009 | }
|
---|
2010 | }
|
---|
2011 | // horizontal splitters
|
---|
2012 | for (var q=0; q<this.sepHor.length; q++) {
|
---|
2013 | var data = this._findDockCellsHor(this.sepHor[q]);
|
---|
2014 | if (data[0] == null || data[1] == null) {
|
---|
2015 | if (this.sepHor[q].className != "dhtmlxLayoutPolySplitterHorInactive") { this.sepHor[q].className = "dhtmlxLayoutPolySplitterHorInactive"; }
|
---|
2016 | } else {
|
---|
2017 | if (this.sepHor[q].className != "dhtmlxLayoutPolySplitterHor") { this.sepHor[q].className = "dhtmlxLayoutPolySplitterHor"; }
|
---|
2018 | }
|
---|
2019 | }
|
---|
2020 | }
|
---|
2021 | this._fixIcons = function() {
|
---|
2022 | for (var a in this.polyObj) {
|
---|
2023 | // 1. get cell index in _rowData
|
---|
2024 | var data = this.polyObj[a]._rowData;
|
---|
2025 | var cps = this.polyObj[a]._collapsed;
|
---|
2026 | var idx = -1;
|
---|
2027 | for (var q=0; q<data.length; q++) {
|
---|
2028 | if (typeof(data[q]) == "object") {
|
---|
2029 | // nothing there?
|
---|
2030 | } else {
|
---|
2031 | if (data[q] == a) { idx = q; }
|
---|
2032 | }
|
---|
2033 | }
|
---|
2034 | // 2. search first expanded item next to the right, then to the left of the collapsed cell
|
---|
2035 | var newIcon = null;
|
---|
2036 | if (idx != -1) {
|
---|
2037 | // to the right
|
---|
2038 | for (var q=idx+1; q<data.length; q++) {
|
---|
2039 | if (typeof(data[q]) == "object") {
|
---|
2040 | newIcon = (this.polyObj[a]._resize=="ver"?(cps?"b":"t"):(cps?"r":"l"));
|
---|
2041 | } else if (this.polyObj[data[q]]._collapsed == false) {
|
---|
2042 | newIcon = (this.polyObj[a]._resize=="ver"?(cps?"b":"t"):(cps?"r":"l"));
|
---|
2043 | }
|
---|
2044 | }
|
---|
2045 | if (newIcon == null && idx >= 1) {
|
---|
2046 | // to the left
|
---|
2047 | for (var q=idx-1; q>=0; q--) {
|
---|
2048 | if (typeof(data[q]) == "object") {
|
---|
2049 | newIcon = (this.polyObj[a]._resize=="ver"?(cps?"t":"b"):(cps?"l":"r"));
|
---|
2050 | } else if (this.polyObj[data[q]]._collapsed == false) {
|
---|
2051 | newIcon = (this.polyObj[a]._resize=="ver"?(cps?"t":"b"):(cps?"l":"r"));
|
---|
2052 | }
|
---|
2053 | }
|
---|
2054 | }
|
---|
2055 | }
|
---|
2056 | // 3. update icon
|
---|
2057 | if (newIcon != null) {
|
---|
2058 | var dir = this.polyObj[a]._resize;
|
---|
2059 | this.polyObj[a].childNodes[0].childNodes[0].childNodes[4].className = "dhtmlxInfoButtonShowHide_"+dir+" dhxLayoutButton_"+this.skin+"_"+dir+(this.polyObj[a]._collapsed?"2":"1")+newIcon;
|
---|
2060 | }
|
---|
2061 | }
|
---|
2062 | }
|
---|
2063 |
|
---|
2064 | /* RESIZE IN WINDOWS */
|
---|
2065 | this._defineWindowMinDimension = function(win, inLayout) {
|
---|
2066 | if (inLayout == true) {
|
---|
2067 | var dim = new Array();
|
---|
2068 | dim[0] = parseInt(win.style.width);
|
---|
2069 | dim[1] = parseInt(win.style.height);
|
---|
2070 | } else {
|
---|
2071 | var dim = win.getDimension();
|
---|
2072 | if (dim[0] == "100%") { dim[0] = win.offsetWidth; }
|
---|
2073 | if (dim[1] == "100%") { dim[1] = win.offsetHeight; }
|
---|
2074 | }
|
---|
2075 | // console.log("dim",dim)
|
---|
2076 | // getting cells which will touched by resize
|
---|
2077 | var hor = that._getNearestParents("hor");
|
---|
2078 | var ver = that._getNearestParents("ver");
|
---|
2079 | // console.log(hor,ver)
|
---|
2080 | //
|
---|
2081 |
|
---|
2082 | if (!inLayout) {
|
---|
2083 | // window-based init, checking cells if any layout attached
|
---|
2084 | var resH = new Array();
|
---|
2085 | var resV = new Array();
|
---|
2086 | for (var a in hor) { resH[resH.length] = a; }
|
---|
2087 | for (var a in ver) { resV[resV.length] = a; }
|
---|
2088 | that._checkAlterMinSize(new Array(resH, resV));
|
---|
2089 | // calculating new avail width/height
|
---|
2090 | var hor2 = {};
|
---|
2091 | var ver2 = {};
|
---|
2092 | for (var q=0; q<that._alterSizes.length; q++) {
|
---|
2093 | var a = that._alterSizes[q][0];
|
---|
2094 | var w = that._alterSizes[q][1];
|
---|
2095 | var h = that._alterSizes[q][2];
|
---|
2096 | if (hor2[a] == null) { hor2[a] = w; } else { if (w > hor2[a]) { hor2[a] = w; } }
|
---|
2097 | if (ver2[a] == null) { ver2[a] = h; } else { if (h > ver2[a]) { ver2[a] = h; } }
|
---|
2098 | }
|
---|
2099 | for (var a in hor) { if (hor2[a] != null) { hor[a] = hor[a]-hor2[a]+that._minWidth; } }
|
---|
2100 | for (var a in ver) { if (ver2[a] != null) { ver[a] = ver[a]-ver2[a]+that._minHeight-(that.polyObj[a].childNodes[0].style.display!="none"?that.skinParams[that.skin]["cpanel_height"]:0); } }
|
---|
2101 | // console.log("1>", resH, hor, hor2)
|
---|
2102 | }
|
---|
2103 |
|
---|
2104 | // 1. detect available minimal width
|
---|
2105 | var minWidth = 65536;
|
---|
2106 | for (var a in hor) { if (hor[a] < minWidth) { minWidth = hor[a]; } }
|
---|
2107 | // console.log(minWidth)
|
---|
2108 | minWidth = minWidth - that._minWidth;
|
---|
2109 | minWidth = dim[0] - minWidth;
|
---|
2110 | if (minWidth < that._dimension[0] && !inLayout) { minWidth = that._dimension[0]; }
|
---|
2111 | // 2. detect available minimal height
|
---|
2112 | var minHeight = 65536;
|
---|
2113 | for (var a in ver) { if (ver[a] < minHeight) { minHeight = ver[a]; } }
|
---|
2114 | minHeight = minHeight - that._minHeight;
|
---|
2115 | minHeight = dim[1] - minHeight;
|
---|
2116 | if (minHeight < that._dimension[1] && !inLayout) { minHeight = that._dimension[1]; }
|
---|
2117 | // 3. set min dimension to window
|
---|
2118 | // console.log(minWidth, minHeight)
|
---|
2119 | if (inLayout == true) {
|
---|
2120 | return new Array("", minWidth, minHeight);
|
---|
2121 | } else {
|
---|
2122 | win.setMinDimension(minWidth, minHeight);
|
---|
2123 | }
|
---|
2124 | }
|
---|
2125 | this._getNearestParents = function(resize) {
|
---|
2126 | var data = (resize=="hor"?this._autoHor:this._autoVer);
|
---|
2127 | var pool = {};
|
---|
2128 | for (var q=0; q<data.length; q++) {
|
---|
2129 | var id = data[q];
|
---|
2130 | if (this.polyObj[id]._collapsed == true && this.polyObj[id]._resize == resize) {
|
---|
2131 | // search neares parents for object
|
---|
2132 | var rowData = this.polyObj[id]._rowData;
|
---|
2133 | var e = -1;
|
---|
2134 | for (var w=0; w<rowData.length; w++) { if (typeof(rowData[w]) == "object") { e = w; } else { if (rowData[w] == id) e = w; } }
|
---|
2135 | var r = e;
|
---|
2136 | id = null;
|
---|
2137 | if (e > 0) { for (var w=e-1; w>=0; w--) { if (typeof(rowData[w]) == "object") { id = rowData[w]; } else { if (this.polyObj[rowData[w]]._collapsed == false && id == null) { id = rowData[w]; } } } }
|
---|
2138 | if (id == null) { for (var w=r; w<rowData.length; w++) { if (typeof(rowData[w]) == "object") { id = rowData[w]; } else { if (this.polyObj[rowData[w]]._collapsed == false && id == null) { id = rowData[w]; } } } }
|
---|
2139 | }
|
---|
2140 | if (id != null) {
|
---|
2141 | if (typeof(id) == "string") { id = new Array(id); }
|
---|
2142 | for (var w=0; w<id.length; w++) {
|
---|
2143 | pool[id[w]] = parseInt(resize=="hor"?this.polyObj[id[w]].style.width:this.polyObj[id[w]].style.height);
|
---|
2144 | }
|
---|
2145 | }
|
---|
2146 | }
|
---|
2147 |
|
---|
2148 | // console.log(resize, pool)
|
---|
2149 |
|
---|
2150 | return pool;
|
---|
2151 | }
|
---|
2152 |
|
---|
2153 | /**
|
---|
2154 | * @desc: sets outer size for the container in case of a window-based initialization
|
---|
2155 | * @type: public
|
---|
2156 | */
|
---|
2157 | this.setSizes = function(skipAdjust) {
|
---|
2158 |
|
---|
2159 | if (this.cont && skipAdjust !== false) this.cont.obj.adjustContent(this.cont.obj, this._mTop, null, null, this._mBottom);
|
---|
2160 |
|
---|
2161 | var xw = this.base.offsetParent.offsetWidth-this.base.offsetWidth+(this._baseWFix!=null?this._baseWFix:0);
|
---|
2162 | var xh = this.base.offsetParent.offsetHeight-this.base.offsetHeight+(this._baseHFix!=null?this._baseHFix:0);
|
---|
2163 |
|
---|
2164 | this.base.style.width = parseInt(this.base.style.width)+xw+"px";
|
---|
2165 | this.base.style.height = parseInt(this.base.style.height)+xh+"px";
|
---|
2166 |
|
---|
2167 | var both = {};
|
---|
2168 | for (var a in this._getNearestParents("hor")) {
|
---|
2169 | this.polyObj[a].style.width = Math.max(0,parseInt(this.polyObj[a].style.width)+xw)+"px";
|
---|
2170 | this.polyObj[a].childNodes[0].style.width = this.polyObj[a].style.width;
|
---|
2171 | both[a] = 1;
|
---|
2172 | }
|
---|
2173 | for (var a in this._getNearestParents("ver")) {
|
---|
2174 | this.polyObj[a].style.height = Math.max(0,parseInt(this.polyObj[a].style.height)+xh)+"px";
|
---|
2175 | this.polyObj[a].childNodes[0].style.height = this.polyObj[a].style.height;
|
---|
2176 | both[a] = 1;
|
---|
2177 | }
|
---|
2178 | for (var a in both) {
|
---|
2179 | this.polyObj[a].adjustContent(this.polyObj[a].childNodes[0], (this.polyObj[a]._noHeader?0:this.skinParams[this.skin]["cpanel_height"]));
|
---|
2180 | this.polyObj[a].updateNestedObjects();
|
---|
2181 | }
|
---|
2182 | this.callEvent("onResizeFinish", []);
|
---|
2183 | return;
|
---|
2184 |
|
---|
2185 | }
|
---|
2186 |
|
---|
2187 | dhtmlxEventable(this);
|
---|
2188 | this._init();
|
---|
2189 | }
|
---|
2190 | dhtmlXLayoutObject.prototype.unload = function(removeParent) {
|
---|
2191 |
|
---|
2192 | // unload cells
|
---|
2193 | for (var a in this.polyObj) {
|
---|
2194 |
|
---|
2195 | // cell's main td container
|
---|
2196 | var p = this.polyObj[a];
|
---|
2197 | p._isCell = null;
|
---|
2198 | p.skin = null;
|
---|
2199 | p.getId = null;
|
---|
2200 | p.getIndex = null;
|
---|
2201 | p.showHeader = null;
|
---|
2202 | p.hideHeader = null;
|
---|
2203 | p.isHeaderVisible = null;
|
---|
2204 | p.setText = null;
|
---|
2205 | p.getText = null;
|
---|
2206 | p.expand = null;
|
---|
2207 | p.collapse = null;
|
---|
2208 | p.isCollapsed = null;
|
---|
2209 | p.dock = null;
|
---|
2210 | p.undock = null;
|
---|
2211 | p.setWidth = null;
|
---|
2212 | p.getWidth = null;
|
---|
2213 | p.setHeight = null;
|
---|
2214 | p.getHeight = null;
|
---|
2215 | p.fixSize = null;
|
---|
2216 | p.progressOn = null;
|
---|
2217 | p.progressOff = null;
|
---|
2218 | p._doOnAttachMenu = null;
|
---|
2219 | p._doOnAttachToolbar = null;
|
---|
2220 | p._doOnAttachStatusBar = null;
|
---|
2221 | p._collapsed = null;
|
---|
2222 | p._idd = null;
|
---|
2223 | p._ind = null;
|
---|
2224 | p._rowData = null;
|
---|
2225 | p.ondblclick = null;
|
---|
2226 |
|
---|
2227 | // cell's header
|
---|
2228 | var bar = p.childNodes[0].childNodes[0];
|
---|
2229 | bar.className = "";
|
---|
2230 | bar._dockCell = null;
|
---|
2231 | bar._resize = null;
|
---|
2232 | bar._h = null;
|
---|
2233 | bar.ondblclick = null;
|
---|
2234 | bar.childNodes[4].onclick = null;
|
---|
2235 | for (var r=0; r<bar.childNodes.length; r++) bar.childNodes[r].onselectstart = null;
|
---|
2236 | while (bar.childNodes.length > 0) bar.removeChild(bar.childNodes[0]);
|
---|
2237 | bar.parentNode.removeChild(bar);
|
---|
2238 |
|
---|
2239 | // cell's content
|
---|
2240 | p._dhxContDestruct();
|
---|
2241 | p._dhxContDestruct = null;
|
---|
2242 | p.childNodes[0].removeChild(p.childNodes[0].childNodes[0]);
|
---|
2243 | p.removeChild(p.childNodes[0]);
|
---|
2244 | p.parentNode.removeChild(p);
|
---|
2245 |
|
---|
2246 | p = null;
|
---|
2247 | }
|
---|
2248 | for (var a in this.polyObj) this.polyObj[a] = null;
|
---|
2249 | for (var q=0; q<this.items.length; q++) this.items[q] = null;
|
---|
2250 | this.polyObj = null;
|
---|
2251 | this.items = null;
|
---|
2252 |
|
---|
2253 | // clear tds/trs
|
---|
2254 | var t = this.tpl.childNodes[0]; // tbody
|
---|
2255 | while (t.childNodes.length > 0) {
|
---|
2256 | while (t.childNodes[0].childNodes.length > 0) {
|
---|
2257 | var r = t.childNodes[0].childNodes[0]; // sep's td
|
---|
2258 | r._top = null;
|
---|
2259 | r._bottom = null;
|
---|
2260 | r._left = null;
|
---|
2261 | r._right = null;
|
---|
2262 | r._dblClick = null;
|
---|
2263 | r._isSep = null;
|
---|
2264 | r._dir = null;
|
---|
2265 | r.ondblclick = null;
|
---|
2266 | r.onmousedown = null;
|
---|
2267 | r.onmouseup = null;
|
---|
2268 | r.onselectstart = null;
|
---|
2269 | while (r.childNodes.length > 0) r.removeChild(r.childNodes[0]);
|
---|
2270 | r.parentNode.removeChild(r);
|
---|
2271 | r = null;
|
---|
2272 | }
|
---|
2273 | t.removeChild(t.childNodes[0]);
|
---|
2274 | }
|
---|
2275 | t.parentNode.removeChild(t);
|
---|
2276 | t = null;
|
---|
2277 | this.tpl.parentNode.removeChild(this.tpl);
|
---|
2278 | this.tpl = null;
|
---|
2279 | for (var a in this.sepHor) this.sepHor[a] = null;
|
---|
2280 | for (var a in this.sepVer) this.sepVer[a] = null;
|
---|
2281 | this.sepHor = null;
|
---|
2282 | this.sepVer = null;
|
---|
2283 |
|
---|
2284 | // clear data
|
---|
2285 | this._autoHor = null;
|
---|
2286 | this._autoVer = null;
|
---|
2287 | this._availAutoSize = null;
|
---|
2288 | this._dimension = null;
|
---|
2289 | this._effects = null;
|
---|
2290 | this._layoutView = null;
|
---|
2291 | this._mBottom = null;
|
---|
2292 | this._mTop = null;
|
---|
2293 | this._minWidth = null;
|
---|
2294 | this._minHeight = null;
|
---|
2295 | this._resFunc = null;
|
---|
2296 | this._resObj = null;
|
---|
2297 | this._resX = null;
|
---|
2298 | this._resY = null;
|
---|
2299 | this._rowsRatio = null;
|
---|
2300 | this._totalCols = null;
|
---|
2301 | this._totalRows = null;
|
---|
2302 | this._xmlLoader = null;
|
---|
2303 | this.w = null;
|
---|
2304 | this.h = null;
|
---|
2305 | this.imagePath = null;
|
---|
2306 | this.skin = null;
|
---|
2307 | this.skinParams = null;
|
---|
2308 | this.tplData = null;
|
---|
2309 | this.tplSizes = null;
|
---|
2310 |
|
---|
2311 | /*
|
---|
2312 | // will unload with container
|
---|
2313 | if (this.menu) this.menu.unload();
|
---|
2314 | if (this.toolbar) this.toolbar.unload();
|
---|
2315 | if (this.statusbar) this.statusbar.unload();
|
---|
2316 | this.menu = null;
|
---|
2317 | this.toolbar = null;
|
---|
2318 | this.statusbar = null;
|
---|
2319 | */
|
---|
2320 |
|
---|
2321 | if (this.sizer.parentNode) this.sizer.parentNode.removeChild(this.sizer);
|
---|
2322 | this.sizer = null;
|
---|
2323 |
|
---|
2324 | this._alterSizes = null;
|
---|
2325 | this._attachSizer = null;
|
---|
2326 | this._buildSurface = null;
|
---|
2327 | this._changeCPanelText = null;
|
---|
2328 | this._checkAlterMinSize = null;
|
---|
2329 | this._collapse = null;
|
---|
2330 | this._collapseEffect = null;
|
---|
2331 | this._collectResAreaData = null;
|
---|
2332 | this._defineWindowMinDimension = null;
|
---|
2333 | this._doCollapse = null;
|
---|
2334 | this._doExpand = null;
|
---|
2335 | this._expand = null;
|
---|
2336 | this._expandEffect = null;
|
---|
2337 | this._findDockCellsHor = null;
|
---|
2338 | this._findDockCellsVer = null;
|
---|
2339 | this._fixIcons = null;
|
---|
2340 | this._fixPositionInWin = null;
|
---|
2341 | this._fixSize = null;
|
---|
2342 | this._fixSplitters = null;
|
---|
2343 | this._getNearestParents = null;
|
---|
2344 | this._hideCovers = null;
|
---|
2345 | this._init = null;
|
---|
2346 | this._initWindows = null;
|
---|
2347 | this._isCollapsed = null;
|
---|
2348 | this._isResizable = null;
|
---|
2349 | this._progressControl = null;
|
---|
2350 | this._progressControlGlobal = null;
|
---|
2351 | this._resizeHor = null;
|
---|
2352 | this._resizeStop = null;
|
---|
2353 | this._resizeVer = null;
|
---|
2354 | this._resAreaData = null;
|
---|
2355 | this._setH = null;
|
---|
2356 | this._setHeight = null;
|
---|
2357 | this._setW = null;
|
---|
2358 | this._setWidth = null;
|
---|
2359 | this._showCovers = null;
|
---|
2360 | this._xmlParser = null;
|
---|
2361 | this.attachEvent = null;
|
---|
2362 | this.attachMenu = null;
|
---|
2363 | this.attachStatusBar = null;
|
---|
2364 | this.attachToolbar = null;
|
---|
2365 | this.callEvent = null;
|
---|
2366 | this.cells = null;
|
---|
2367 | this.checkEvent = null;
|
---|
2368 | this.detachEvent = null;
|
---|
2369 | this.dockWindow = null;
|
---|
2370 | this.eventCatcher = null;
|
---|
2371 | this.forEachItem = null;
|
---|
2372 | this.getEffect = null;
|
---|
2373 | this.getIdByIndex = null;
|
---|
2374 | this.getIndexById = null;
|
---|
2375 | this.getText = null;
|
---|
2376 | this.hidePanel = null;
|
---|
2377 | this.isPanelVisible = null;
|
---|
2378 | this.listAutoSizes = null;
|
---|
2379 | this.listViews = null;
|
---|
2380 | this.progressOff = null;
|
---|
2381 | this.progressOn = null;
|
---|
2382 | this.setAutoSize = null;
|
---|
2383 | this.setEffect = null;
|
---|
2384 | this.setImagePath = null;
|
---|
2385 | this.setSizes = null;
|
---|
2386 | this.setSkin = null;
|
---|
2387 | this.setText = null;
|
---|
2388 | this.showPanel = null;
|
---|
2389 | this.unDockWindow = null;
|
---|
2390 | this.unload = null;
|
---|
2391 | this.updateNestedObjectsArray = null;
|
---|
2392 |
|
---|
2393 |
|
---|
2394 | if (this.obj) {
|
---|
2395 | this.obj.parentNode.removeChild(this.obj);
|
---|
2396 | this.obj = null;
|
---|
2397 | }
|
---|
2398 |
|
---|
2399 | if (this.base) {
|
---|
2400 | if (this.base == document.body) {
|
---|
2401 |
|
---|
2402 | } else {
|
---|
2403 | this.base.parentNode.removeChild(this.base);
|
---|
2404 | this.base = null;
|
---|
2405 | }
|
---|
2406 | }
|
---|
2407 |
|
---|
2408 | if (this.cont) {
|
---|
2409 | this.cont.obj._dhxContDestruct();
|
---|
2410 | this.cont.obj._dhxContDestruct = null;
|
---|
2411 | if (this.cont.dhxcont.parentNode) this.cont.dhxcont.parentNode.removeChild(this.cont.dhxcont);
|
---|
2412 | this.cont.dhxcont = null;
|
---|
2413 | this.cont.setContent = null;
|
---|
2414 | if (this.cont.obj.parentNode && removeParent === true) this.cont.obj.parentNode.removeChild(this.cont.obj);
|
---|
2415 | this.cont.obj = null;
|
---|
2416 | this.cont = null;
|
---|
2417 | }
|
---|
2418 |
|
---|
2419 | // windows if any
|
---|
2420 | if (this.dhxWins) {
|
---|
2421 | this.dhxWins.unload();
|
---|
2422 | this.dhxWins = null;
|
---|
2423 | }
|
---|
2424 |
|
---|
2425 | // document.body init, remove events
|
---|
2426 | if (this._doOnResizeStart) {
|
---|
2427 | if (_isIE) { window.detachEvent("onresize", this._doOnResizeStart); } else { window.removeEventListener("resize", this._doOnResizeStart, false); }
|
---|
2428 | this._doOnResizeStart = null;
|
---|
2429 | this._doOnResizeEnd = null;
|
---|
2430 | this._tmTime = null;
|
---|
2431 | }
|
---|
2432 |
|
---|
2433 | // remove body events
|
---|
2434 | if (_isIE) {
|
---|
2435 | document.body.detachEvent("onselectstart", this._doOnSelectStart);
|
---|
2436 | document.body.detachEvent("onmousemove", this._doOnMouseMove);
|
---|
2437 | document.body.detachEvent("onmouseup", this._doOnMouseUp);
|
---|
2438 | } else {
|
---|
2439 | document.body.removeEventListener("mousemove", this._doOnMouseMove, false);
|
---|
2440 | document.body.removeEventListener("mouseup", this._doOnMouseUp, false);
|
---|
2441 | }
|
---|
2442 | this._doOnSelectStart = null;
|
---|
2443 | this._doOnMouseMove = null;
|
---|
2444 | this._doOnMouseUp = null;
|
---|
2445 |
|
---|
2446 | // main link
|
---|
2447 | that = null;
|
---|
2448 | }
|
---|
2449 | // templates
|
---|
2450 | dhtmlXLayoutObject.prototype.tplData = {
|
---|
2451 | "1C": '<layout><autosize hor="a" ver="a" rows="1" cols="1"/><table data="a"/><row><cell obj="a" wh="1,1" resize="ver" neighbors="a"/></row></layout>',
|
---|
2452 | "2E": '<layout><autosize hor="a;b" ver="b" rows="2" cols="1"/><table data="a;b"/><row><cell obj="a" wh="1,2" resize="ver" neighbors="a;b"/></row><row sep="true"><cell sep="hor" top="a" bottom="b" dblclick="a"/></row><row><cell obj="b" wh="1,2" resize="ver" neighbors="a;b"/></row></layout>',
|
---|
2453 | "2U": '<layout><autosize hor="b" ver="a;b" rows="1" cols="2"/><table data="a,b"/><row><cell obj="a" wh="2,1" resize="hor" neighbors="a;b"/><cell sep="ver" left="a" right="b"/><cell obj="b" wh="2,1" resize="hor" neighbors="a;b"/></row></layout>',
|
---|
2454 | // ---------------------------------------------------------------------------------------------------------------------------------------
|
---|
2455 | "3E": '<layout><autosize hor="a;b;c" ver="c" rows="3" cols="1"/><table data="a;b;c"/><row><cell obj="a" wh="1,3" resize="ver" neighbors="a;b;c"/></row><row sep="yes"><cell sep="hor" top="a" bottom="b;c" dblclick="a"/></row><row><cell obj="b" wh="1,3" resize="ver" neighbors="a;b;c"/></row><row sep="yes"><cell sep="hor" top="a;b" bottom="c" dblclick="b"/></row><row><cell obj="c" wh="1,3" resize="ver" neighbors="a;b;c"/></row></layout>',
|
---|
2456 | "3W": '<layout><autosize hor="c" ver="a;b;c" rows="1" cols="3"/><table data="a,b,c"/><row><cell obj="a" wh="3,1" resize="hor" neighbors="a;b;c"/><cell sep="ver" left="a" right="b;c" dblclick="a"/><cell obj="b" wh="3,1" resize="hor" neighbors="a;b;c"/><cell sep="ver" left="a;b" right="c" dblclick="b"/><cell obj="c" wh="3,1" resize="hor" neighbors="a;b;c"/></row></layout>',
|
---|
2457 | "3J": '<layout><autosize hor="b" ver="b;c" rows="2" cols="2"/><table data="a,b;c,b"/><row><cell obj="a" wh="2,2" resize="ver" neighbors="a;c"/><cell sep="ver" left="a,c" right="b" dblclick="b" rowspan="3"/><cell obj="b" wh="2,1" resize="hor" neighbors="a,c;b" rowspan="3"/></row><row sep="yes"><cell sep="hor" top="a" bottom="c" dblclick="a"/></row><row><cell obj="c" wh="2,2" resize="ver" neighbors="a;c"/></row></layout>',
|
---|
2458 | "3T": '<layout><autosize hor="a;c" ver="b;c" rows="2" cols="2"/><table data="a,a;b,c"/><row><cell obj="a" wh="1,2" resize="ver" neighbors="a;b,c" colspan="3"/></row><row sep="true"><cell sep="hor" top="a" bottom="b,c" dblclick="a" colspan="3"/></row><row><cell obj="b" wh="2,2" resize="hor" neighbors="b;c"/><cell sep="ver" left="b" right="c" dblclick="b"/><cell obj="c" wh="2,2" resize="hor" neighbors="b;c"/></row></layout>',
|
---|
2459 | "3L": '<layout><autosize hor="b;c" ver="a;c" rows="2" cols="2"/><table data="a,b;a,c"/><row><cell obj="a" wh="2,1" resize="hor" neighbors="a;b,c" rowspan="3"/><cell sep="ver" left="a" right="b,c" dblclick="a" rowspan="3"/><cell obj="b" wh="2,2" resize="ver" neighbors="b;c"/></row><row sep="true"><cell sep="hor" top="b" dblclick="b" bottom="c"/></row><row><cell obj="c" wh="b,2" resize="ver" neighbors="b;c"/></row></layout>',
|
---|
2460 | "3U": '<layout><autosize hor="b;c" ver="c" rows="2" cols="2"/><table data="a,b;c,c"/><row><cell obj="a" wh="2,2" resize="hor" neighbors="a;b"/><cell sep="ver" left="a" right="b" dblclick="a"/><cell obj="b" wh="2,2" resize="hor" neighbors="a;b"/></row><row sep="true"><cell sep="hor" top="a,b" bottom="c" dblclick="c" colspan="3"/></row><row><cell obj="c" wh="1,2" resize="ver" neighbors="a,b;c" colspan="3"/></row></layout>',
|
---|
2461 | // ---------------------------------------------------------------------------------------------------------------------------------------
|
---|
2462 | "4H": '<layout><autosize hor="d" ver="a;c;d" rows="2" cols="3"/><table data="a,b,d;a,c,d"/><row><cell obj="a" wh="3,1" resize="hor" neighbors="a;b,c;d" rowspan="3"/><cell sep="ver" left="a" right="b,c;d" dblclick="a" rowspan="3"/><cell obj="b" wh="3,2" resize="ver" neighbors="b;c"/><cell sep="ver" left="a;b,c" right="d" dblclick="d" rowspan="3"/><cell obj="d" wh="3,1" resize="hor" neighbors="a;b,c;d" rowspan="3"/></row><row sep="true"><cell sep="hor" top="b" dblclick="b" bottom="c"/></row><row><cell obj="c" wh="3,2" resize="ver" neighbors="b;c"/></row></layout>',
|
---|
2463 | "4I": '<layout><autosize hor="a;c;d" ver="d" rows="3" cols="2"/><table data="a,a;b,c;d,d"/><row><cell obj="a" wh="1,3" resize="ver" neighbors="a;b,c;d" colspan="3"/></row><row sep="true"><cell sep="hor" top="a" bottom="b,c;d" dblclick="a" colspan="3"/></row><row><cell obj="b" wh="2,3" resize="hor" neighbors="b;c"/><cell sep="ver" left="b" dblclick="b" right="c"/><cell obj="c" wh="2,3" resize="hor" neighbors="b;c"/></row><row sep="true"><cell sep="hor" top="a;b,c" bottom="d" dblclick="d" colspan="3"/></row><row><cell obj="d" wh="1,3" resize="ver" neighbors="a;b,c;d" colspan="3"/></row></layout>',
|
---|
2464 | "4T": '<layout><autosize hor="a;d" ver="b;c;d" rows="2" cols="3"/><table data="a,a,a;b,c,d"/><row><cell obj="a" wh="1,2" resize="ver" neighbors="a;b,c,d" colspan="5"/></row><row sep="true"><cell sep="hor" top="a" bottom="b,c,d" dblclick="a" colspan="5"/></row><row><cell obj="b" wh="3,2" resize="hor" neighbors="b;c;d"/><cell sep="ver" left="b" right="c;d" dblclick="b"/><cell obj="c" wh="3,2" resize="hor" neighbors="b;c;d"/><cell sep="ver" left="b;c" right="d" dblclick="c"/><cell obj="d" wh="3,2" resize="hor" neighbors="b;c;d"/></row></layout>',
|
---|
2465 | "4U": '<layout><autosize hor="c;d" ver="d" rows="2" cols="3"/><table data="a,b,c;d,d,d"/><row><cell obj="a" wh="3,2" resize="hor" neighbors="a;b;c"/><cell sep="ver" left="a" right="b;c" dblclick="a"/><cell obj="b" wh="3,2" resize="hor" neighbors="a;b;c"/><cell sep="ver" left="a;b" right="c" dblclick="b"/><cell obj="c" wh="3,2" resize="hor" neighbors="a;b;c"/></row><row sep="true"><cell sep="hor" top="a,b,c" bottom="d" dblclick="d" colspan="5"/></row><row><cell obj="d" wh="1,2" resize="ver" neighbors="a,b,c;d" colspan="5"/></row></layout>',
|
---|
2466 | // ---------------------------------------------------------------------------------------------------------------------------------------
|
---|
2467 | "5H": '<layout><autosize hor="b;c;d" ver="a;c;e" rows="3" cols="3"/><table data="a,b,e;a,c,e;a,d,e"/><row><cell obj="a" wh="3,1" resize="hor" neighbors="a;b,c,d" rowspan="5"/><cell sep="ver" left="a" right="b,c,d;e" dblclick="a" rowspan="5"/><cell obj="b" wh="3,3" resize="ver" neighbors="b;c;d"/><cell sep="ver" left="a;b,c,d" right="e" dblclick="e" rowspan="5"/><cell obj="e" wh="3,1" resize="hor" neighbors="b,c,d;e" rowspan="5"/></row><row sep="true"><cell sep="hor" top="b" dblclick="b" bottom="c;d"/></row><row><cell obj="c" wh="3,3" resize="ver" neighbors="b;c;d"/></row><row sep="true"><cell sep="hor" top="b;c" dblclick="c" bottom="d"/></row><row><cell obj="d" wh="3,3" resize="ver" neighbors="b;c;d"/></row></layout>',
|
---|
2468 | "5I": '<layout><autosize hor="a;d;e" ver="e" rows="3" cols="3"/><table data="a,a,a;b,c,d;e,e,e"/><row><cell obj="a" wh="1,3" resize="ver" neighbors="a;b,c,d;e" colspan="5"/></row><row sep="match"><cell sep="hor" top="a" bottom="b,c,d;e" dblclick="a" colspan="5"/></row><row><cell obj="b" wh="3,3" resize="hor" neighbors="b;c;d"/><cell sep="ver" left="b" right="c;d" dblclick="b"/><cell obj="c" wh="3,3" resize="hor" neighbors="b;c;d"/><cell sep="ver" left="b;c" right="d" dblclick="c"/><cell obj="d" wh="3,3" resize="hor" neighbors="b;c;d"/></row><row sep="match"><cell sep="hor" top="a;b,c,d" bottom="e" dblclick="e" colspan="5"/></row><row><cell obj="e" wh="1,3" resize="ver" neighbors="a;b,c,d;e" colspan="5"/></row></layout>',
|
---|
2469 | // ---------------------------------------------------------------------------------------------------------------------------------------
|
---|
2470 | "6I": '<layout><autosize hor="a;e;f" ver="f" rows="3" cols="4"/><table data="a,a,a,a;b,c,d,e;f,f,f,f"/><row><cell obj="a" wh="1,3" resize="ver" neighbors="a;b,c,d,e;f" colspan="7"/></row><row sep="true"><cell sep="hor" top="a" bottom="b,c,d,e;f" dblclick="a" colspan="7"/></row><row><cell obj="b" wh="4,3" resize="hor" neighbors="b;c;d;e"/><cell sep="ver" left="b" right="c;d;e" dblclick="b"/><cell obj="c" wh="4,3" resize="hor" neighbors="b;c;d;e"/><cell sep="ver" left="b;c" right="d;e" dblclick="c"/><cell obj="d" wh="4,3" resize="hor" neighbors="b;c;d;e"/><cell sep="ver" left="b;c;d" right="e" dblclick="d"/><cell obj="e" wh="4,3" resize="hor" neighbors="b;c;d;e"/></row><row sep="true"><cell sep="hor" top="a;b,c,d,e" bottom="f" dblclick="f" colspan="7"/></row><row><cell obj="f" wh="1,3" resize="ver" neighbors="a;b,c,d,e;f" colspan="7"/></row></layout>'
|
---|
2471 | };
|
---|
2472 | // autosize data
|
---|
2473 | dhtmlXLayoutObject.prototype._availAutoSize = {
|
---|
2474 | "1C_hor": new Array("a"),
|
---|
2475 | "1C_ver": new Array("a"),
|
---|
2476 | "2E_hor": new Array("a;b"),
|
---|
2477 | "2E_ver": new Array("a", "b"),
|
---|
2478 | "2U_hor": new Array("a", "b"),
|
---|
2479 | "2U_ver": new Array("a;b"),
|
---|
2480 | "3E_hor": new Array("a;b;c"),
|
---|
2481 | "3E_ver": new Array("a", "b", "c"),
|
---|
2482 | "3W_hor": new Array("a", "b", "c"),
|
---|
2483 | "3W_ver": new Array("a;b;c"),
|
---|
2484 | "3J_hor": new Array("a;c", "b"),
|
---|
2485 | "3J_ver": new Array("a;b", "c;b"),
|
---|
2486 | "3T_hor": new Array("a;b", "a;c"),
|
---|
2487 | "3T_ver": new Array("a", "b;c"),
|
---|
2488 | "3L_hor": new Array("a", "b;c"),
|
---|
2489 | "3L_ver": new Array("a;b", "a;c"),
|
---|
2490 | "3U_hor": new Array("a;c", "b;c"),
|
---|
2491 | "3U_ver": new Array("a;b", "c"),
|
---|
2492 | "4H_hor": new Array("a", "b;c", "d"),
|
---|
2493 | "4H_ver": new Array("a;b;d", "a;c;d"),
|
---|
2494 | "4I_hor": new Array("a;b;d", "a;c;d"),
|
---|
2495 | "4I_ver": new Array("a", "b;c", "d"),
|
---|
2496 | "4T_hor": new Array("a;b", "a;c", "a;d"),
|
---|
2497 | "4T_ver": new Array("a", "b;c;d"),
|
---|
2498 | "4U_hor": new Array("a;d", "b;d", "c;d"),
|
---|
2499 | "4U_ver": new Array("a;b;c", "d"),
|
---|
2500 | "5H_hor": new Array("a", "b;c;d", "e"),
|
---|
2501 | "5H_ver": new Array("a;b;e", "a;c;e", "a;d;e"),
|
---|
2502 | "5I_hor": new Array("a;b;e", "a;c;e", "a;d;e"),
|
---|
2503 | "5I_ver": new Array("a", "b;c;d", "e"),
|
---|
2504 | "6I_hor": new Array("a;b;f", "a;c;f", "a;d;f", "a;e;f"),
|
---|
2505 | "6I_ver": new Array("a", "b;c;d;e", "f")
|
---|
2506 | };
|
---|
2507 |
|
---|
2508 | // collapsed text
|
---|
2509 | dhtmlXLayoutObject.prototype.setCollapsedText = function(cell, text) {
|
---|
2510 | if (!this.polyObj[cell]) return;
|
---|
2511 | var p;
|
---|
2512 | var bar = dhxLayout.polyObj[cell].childNodes[0].childNodes[0];
|
---|
2513 | if (bar.childNodes[bar.childNodes.length-1]._ct === true) {
|
---|
2514 | var p = bar.childNodes[bar.childNodes.length-1];
|
---|
2515 | } else {
|
---|
2516 | var p = document.createElement("DIV");
|
---|
2517 | p._ct = true;
|
---|
2518 | p.className = "dhtmlxInfoBarLabel_collapsed_"+this.polyObj[cell]._resize;
|
---|
2519 | bar.appendChild(p);
|
---|
2520 | }
|
---|
2521 | p.innerHTML = text;
|
---|
2522 | bar = null;
|
---|
2523 | };
|
---|
2524 |
|
---|
2525 | dhtmlXLayoutObject.prototype._doOnAttachURL = function(id, addIFrameEvents) {
|
---|
2526 | if (!addIFrameEvents) {
|
---|
2527 | // just call onContentLoaded
|
---|
2528 | this.callEvent("onContentLoaded", [id]);
|
---|
2529 | return;
|
---|
2530 | }
|
---|
2531 | // attach events into iframe
|
---|
2532 | var t = this;
|
---|
2533 | var f = this.cells(id)._frame;
|
---|
2534 | if (_isIE) {
|
---|
2535 | f.onreadystatechange = function(a) {
|
---|
2536 | if (f.readyState == "complete") try {t.callEvent("onContentLoaded",[id]);}catch(e){}
|
---|
2537 | }
|
---|
2538 | } else {
|
---|
2539 | f.onload = function() {
|
---|
2540 | t.callEvent("onContentLoaded",[id]);
|
---|
2541 | }
|
---|
2542 | }
|
---|
2543 | };
|
---|
2544 |
|
---|
2545 | //layout
|
---|
2546 |
|
---|
2547 | (function(){
|
---|
2548 | dhtmlx.extend_api("dhtmlXLayoutObject",{
|
---|
2549 | _init:function(obj){
|
---|
2550 | return [obj.parent, obj.pattern, obj.skin];
|
---|
2551 | },
|
---|
2552 | image_path:"setImagePath",
|
---|
2553 | effect:"_effect",
|
---|
2554 | cells:"_cells",
|
---|
2555 | autosize:"_autosize"
|
---|
2556 | },{
|
---|
2557 | _cells:function(arr){
|
---|
2558 | for (var q=0; q<arr.length; q++) {
|
---|
2559 | var data = arr[q];
|
---|
2560 | var cell = this.cells(data.id);
|
---|
2561 | if (cell) {
|
---|
2562 | if (data.height) cell.setHeight(data.height);
|
---|
2563 | if (data.width) cell.setWidth(data.width);
|
---|
2564 | if (data.text) cell.setText(data.text);
|
---|
2565 | if (data.collapse) cell.collapse();
|
---|
2566 | if (data.fix_size) cell.fixSize(data.fix_size[0], data.fix_size[1]);
|
---|
2567 | if (data.header === false) cell.hideHeader();
|
---|
2568 |
|
---|
2569 | }
|
---|
2570 | }
|
---|
2571 | },
|
---|
2572 | _autosize:function(arr){
|
---|
2573 | this.setAutoSize(arr[0],arr[1]);
|
---|
2574 | },
|
---|
2575 | _effect:function(data){
|
---|
2576 | if (data.collapse) this.setEffect("collapse", data.collapse);
|
---|
2577 | if (data.resize) this.setEffect("resize", data.resize);
|
---|
2578 | if (data.highlight) this.setEffect("highlight", data.highlight);
|
---|
2579 | }
|
---|
2580 | });
|
---|
2581 | })();
|
---|