1 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * @author Ivan A Kirillov (Ivan.A.Kirillov@gmail.com)
5 * @package phpMyAdmin-Designer
14 var sm_x
= 2, sm_y
= 2;
21 var ON_display_field
= 0;
22 // relation_style: 0 - angular 1 - direct
23 var ON_angular_direct
= 1;
25 var link_relation
= "";
28 var canvas_height
= 0;
29 var osn_tab_width
= 0;
30 var osn_tab_height
= 0;
34 var layer_menu_cur_click
= 0;
38 //------------------------------------------------------------------------------
39 //------------------------------------------------------------------------------
40 //------------------------------------------------------------------------------
43 //window.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
45 document
.onmousedown
= MouseDown
;
46 document
.onmouseup
= MouseUp
;
47 document
.onmousemove
= MouseMove
;
49 var isIE
= document
.all
&& !window
.opera
;
50 var isNN
= !document
.all
&& document
.getElementById
;
51 var isN4
= document
.layers
;
54 window
.onscroll
= General_scroll
;
55 document
.onselectstart = function () {return false;};
58 //document.onmouseup = function(){General_scroll_end();}
62 if (cur_click
!= null) {
63 offsetx
= isIE
? event
.clientX
+ document
.body
.scrollLeft
: e
.pageX
;
64 offsety
= isIE
? event
.clientY
+ document
.body
.scrollTop
: e
.pageY
;
65 dx
= offsetx
- parseInt(cur_click
.style
.left
);
66 dy
= offsety
- parseInt(cur_click
.style
.top
);
67 //alert(" dx = " + dx + " dy = " +dy);
68 document
.getElementById("canvas").style
.visibility
= 'hidden';
70 var left = parseInt(cur_click.style.left);
71 var top = parseInt(cur_click.style.top);
75 alert(" dx = " + dx + " dy = " +dy);
77 cur_click
.style
.zIndex
= 2;
79 if (layer_menu_cur_click
) {
80 offsetx
= isIE
? event
.clientX
+ document
.body
.scrollLeft
: e
.pageX
;
81 dx
= offsetx
- parseInt(document
.getElementById("layer_menu").style
.width
);
89 Glob_X
= isIE
? event
.clientX
+ document
.body
.scrollLeft
: e
.pageX
;
90 Glob_Y
= isIE
? event
.clientY
+ document
.body
.scrollTop
: e
.pageY
;
92 //mouseX = (bw.ns4||bw.ns6)? e.pageX: bw.ie&&bw.win&&!bw.ie4? (event.clientX-2)+document.body.scrollLeft : event.clientX+document.body.scrollLeft;
93 //mouseY = (bw.ns4||bw.ns6)? e.pageY: bw.ie&&bw.win&&!bw.ie4? (event.clientY-2)+document.body.scrollTop : event.clientY+document.body.scrollTop;
95 //window.status = "X = "+ Glob_X + " Y = "+ Glob_Y;
97 if (cur_click
!= null) {
98 var mGx
= Glob_X
- dx
;
99 var mGy
= Glob_Y
- dy
;
100 mGx
= mGx
> 0 ? mGx
: 0;
101 mGy
= mGy
> 0 ? mGy
: 0;
104 mGx
= mGx
% step
< step
/ 2 ? mGx
- mGx
% step
: mGx
- mGx
% step
+ step
;
105 mGy
= mGy
% step
< step
/ 2 ? mGy
- mGy
% step
: mGy
- mGy
% step
+ step
;
108 cur_click
.style
.left
= mGx
+ 'px';
109 cur_click
.style
.top
= mGy
+ 'px';
112 if (ON_relation
|| ON_display_field
) {
113 document
.getElementById('hint').style
.left
= (Glob_X
+ 20) + 'px';
114 document
.getElementById('hint').style
.top
= (Glob_Y
+ 20) + 'px';
117 if (layer_menu_cur_click
) {
118 document
.getElementById("layer_menu").style
.width
= ((Glob_X
- dx
) >= 150 ? Glob_X
- dx
: 150) + 'px';
119 //document.getElementById("layer_menu").style.height = Glob_Y - dy>=200?Glob_Y - dy:200;
120 //document.getElementById("id_scroll_tab").style.height = Glob_Y - dy2;
126 if (cur_click
!= null) {
127 document
.getElementById("canvas").style
.visibility
= 'visible';
129 cur_click
.style
.zIndex
= 1;
132 layer_menu_cur_click
= 0;
133 //window.releaseEvents(Event.MOUSEMOVE);
135 //------------------------------------------------------------------------------
136 //------------------------------------------------------------------------------
137 //------------------------------------------------------------------------------
142 // return s.substring(0,s.length-2)*1; //re = /(\d+)\w*/; newstr = str.replace(re, "$1");
145 function Canvas_pos()
147 canvas_width
= document
.getElementById('canvas').width
= osn_tab_width
- 3;
148 canvas_height
= document
.getElementById('canvas').height
= osn_tab_height
- 3;
151 document
.getElementById('canvas').style
.width
= ((osn_tab_width
- 3)?(osn_tab_width
- 3):0) + 'px';
152 document
.getElementById('canvas').style
.height
= ((osn_tab_height
- 3)?(osn_tab_height
- 3):0) + 'px';
156 function Osn_tab_pos()
158 osn_tab_width
= parseInt(document
.getElementById('osn_tab').style
.width
);
159 osn_tab_height
= parseInt(document
.getElementById('osn_tab').style
.height
);
165 //alert( document.getElementById('osn_tab').offsetTop);
168 document
.getElementById('top_menu').style
.position
= 'absolute';
169 document
.getElementById('layer_menu').style
.position
= 'absolute';
172 document
.getElementById("layer_menu").style
.top
= -1000 + 'px'; //fast scroll
173 sm_x
+= document
.getElementById('osn_tab').offsetLeft
;
174 sm_y
+= document
.getElementById('osn_tab').offsetTop
;
179 id_hint
= document
.getElementById('hint');
186 //-------------------------------- new -----------------------------------------
187 function Rezize_osn_tab()
191 for (key
in j_tabs
) {
192 var k_x
= parseInt(document
.getElementById(key
).style
.left
) + document
.getElementById(key
).offsetWidth
;
193 var k_y
= parseInt(document
.getElementById(key
).style
.top
) + document
.getElementById(key
).offsetHeight
;
194 max_X
= max_X
< k_x
? k_x
: max_X
;
195 max_Y
= max_Y
< k_y
? k_y
: max_Y
;
198 osn_tab_width
= max_X
+ 50;
199 osn_tab_height
= max_Y
+ 50;
201 document
.getElementById('osn_tab').style
.width
= osn_tab_width
+ 'px';
202 document
.getElementById('osn_tab').style
.height
= osn_tab_height
+ 'px';
204 //------------------------------------------------------------------------------
207 * refreshes display, must be called after state changes
218 for (key
in contr
[K
]) // contr name
219 for (key2
in contr
[K
][key
]) // table name
220 for (key3
in contr
[K
][key
][key2
]) // field name
222 if (!document
.getElementById("check_vis_" + key2
).checked
||
223 !document
.getElementById("check_vis_" + contr
[K
][key
][key2
][key3
][0]).checked
) {
227 var x1_left
= document
.getElementById(key2
).offsetLeft
+1;
228 var x1_right
= x1_left
+ document
.getElementById(key2
).offsetWidth
;
229 var x2_left
= document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetLeft
;
230 var x2_right
= x2_left
+ document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetWidth
;
231 a
[0] = Math
.abs(x1_left
- x2_left
);
232 a
[1] = Math
.abs(x1_left
- x2_right
);
233 a
[2] = Math
.abs(x1_right
- x2_left
);
234 a
[3] = Math
.abs(x1_right
- x2_right
);
235 n
= s_left
= s_right
= 0;
236 for (var i
= 1; i
< 4; i
++) {
243 x2
= x2_right
+ sm_s
;
249 x1
= x1_right
+ sm_s
;
256 x1
= x1_right
+ sm_s
;
257 x2
= x2_right
+ sm_s
;
265 //alert(key2 + "." + key3);
267 var row_offset_top
= 0;
268 //alert('id_tbody_' + key2);
269 //alert(document.getElementById('id_hide_tbody_' + key2));
270 var tab_hide_button
= document
.getElementById('id_hide_tbody_' + key2
);
272 //alert(tab_hide_button.innerHTML);
273 if (tab_hide_button
.innerHTML
== 'v') {
274 row_offset_top
= document
.getElementById(key2
+ "." + key3
).offsetTop
;
277 var y1
= document
.getElementById(key2
).offsetTop
283 var tab_hide_button
= document
.getElementById('id_hide_tbody_' + contr
[K
][key
][key2
][key3
][0]);
284 if (tab_hide_button
.innerHTML
== 'v') {
285 row_offset_top
= document
.getElementById(contr
[K
][key
][key2
][key3
][0]
286 + '.' + contr
[K
][key
][key2
][key3
][1]).offsetTop
;
290 document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetTop
294 //alert(y1 + ' - ' + key2 + "." + key3);
295 Line0(x1
- sm_x
, y1
- sm_y
, x2
- sm_x
, y2
- sm_y
, "rgba(0,100,150,1)");
300 * draws a line from x1:y1 to x2:y2 with color
302 function Line(x1
, y1
, x2
, y2
, color_line
)
304 var canvas
= document
.getElementById("canvas");
305 var ctx
= canvas
.getContext("2d");
306 ctx
.strokeStyle
= color_line
;
315 * draws a relation/constraint line, whether angular or not
317 function Line0(x1
, y1
, x2
, y2
, color_line
)
319 Circle(x1
, y1
, 3, 3, "rgba(0,0,255,1)");
320 Rect(x2
- 1, y2
- 2, 4, 4, "rgba(0,0,255,1)");
322 if (ON_angular_direct
) {
323 Line2(x1
, y1
, x2
, y2
, color_line
);
325 Line3(x1
, y1
, x2
, y2
, color_line
);
330 * draws a angualr relation/constraint line
332 function Line2(x1
, y1
, x2
, y2
, color_line
)
343 } else if (x1
< x2
) {
351 Line(x1
, y1
, x1_
, y1
, color_line
);
352 Line(x2
, y2
, x2_
, y2
, color_line
);
353 Line(x1_
, y1
, x2_
, y2
, color_line
);
357 * draws a relation/constraint line
359 function Line3(x1
, y1
, x2
, y2
, color_line
)
366 x1_
+= x2
- x1
+ sm_add
;
369 x2_
+= x1
- x2
+ sm_add
;
373 Line(x1
, y1
, x1_
, y1
, color_line
);
374 Line(x2
, y2
, x2_
, y2
, color_line
);
375 Line(x1_
, y1
, x2_
, y2
, color_line
);
380 x2_
-= x2
- x1
+ sm_add
;
383 x1_
-= x1
- x2
+ sm_add
;
387 Line(x1
, y1
, x1_
, y1
, color_line
);
388 Line(x2
, y2
, x2_
, y2
, color_line
);
389 Line(x1_
, y1
, x2_
, y2
, color_line
);
393 var x_s
= (x1
+ x2
) / 2;
394 Line(x1
, y1
, x_s
, y1
, color_line
);
395 Line(x_s
, y2
, x2
, y2
, color_line
);
396 Line(x_s
, y1
, x_s
, y2
, color_line
);
399 function Circle(x
, y
, r
, w
, color
)
401 var ctx
= document
.getElementById('canvas').getContext('2d');
405 ctx
.strokeStyle
= color
;
406 ctx
.arc(x
, y
, r
, 0, 2 * Math
.PI
, true);
412 var canvas
= document
.getElementById("canvas");
413 var ctx
= canvas
.getContext("2d");
414 ctx
.clearRect(0, 0, canvas_width
, canvas_height
);
417 function Rect(x1
, y1
, w
, h
, color
)
419 var ctx
= document
.getElementById('canvas').getContext('2d');
420 ctx
.fillStyle
= color
;
421 ctx
.fillRect(x1
, y1
, w
, h
);
424 //------------------------------ SAVE ------------------------------------------
425 function Save(url
) // (del?) no for pdf
427 for (key
in j_tabs
) {
428 document
.getElementById('t_x_' + key
+ '_').value
= parseInt(document
.getElementById(key
).style
.left
);
429 document
.getElementById('t_y_' + key
+ '_').value
= parseInt(document
.getElementById(key
).style
.top
);
430 document
.getElementById('t_v_' + key
+ '_').value
= document
.getElementById('id_tbody_' + key
).style
.display
== 'none' ? 0 : 1;
431 document
.getElementById('t_h_' + key
+ '_').value
= document
.getElementById('check_vis_' + key
).checked
? 1 : 0;
433 document
.form1
.action
= url
;
434 document
.form1
.submit();
437 function Get_url_pos()
440 for (key
in j_tabs
) {
441 poststr
+= '&t_x[' + key
+ ']=' + parseInt(document
.getElementById(key
).style
.left
);
442 poststr
+= '&t_y[' + key
+ ']=' + parseInt(document
.getElementById(key
).style
.top
);
443 poststr
+= '&t_v[' + key
+ ']=' + (document
.getElementById('id_tbody_' + key
).style
.display
== 'none' ? 0 : 1);
444 poststr
+= '&t_h[' + key
+ ']=' + (document
.getElementById('check_vis_' + key
).checked
? 1 : 0);
451 var poststr
= 'IS_AJAX=1&server='+server
+'&db=' + db
+ '&token=' + token
+ '&die_save_pos=1';
452 poststr
+= Get_url_pos();
453 makeRequest('pmd_save_pos.php', poststr
);
460 document
.getElementById('grid_button').className
= 'M_butt_Selected_down';
462 document
.getElementById('grid_button').className
= 'M_butt';
467 function Angular_direct()
469 if (ON_angular_direct
) {
470 ON_angular_direct
= 0;
471 document
.getElementById('angular_direct_button').className
= 'M_butt_Selected_down';
473 ON_angular_direct
= 1;
474 document
.getElementById('angular_direct_button').className
= 'M_butt';
478 //++++++++++++++++++++++++++++++ RELATION ++++++++++++++++++++++++++++++++++++++
479 function Start_relation()
481 if (ON_display_field
) {
486 document
.getElementById('InnoDB_relation').style
.display
= '';
488 document
.getElementById('hint').innerHTML
= LangSelectReferencedKey
;
489 document
.getElementById('hint').style
.visibility
= "visible";
490 document
.getElementById('rel_button').className
= 'M_butt_Selected_down';
492 document
.getElementById('hint').innerHTML
= "";
493 document
.getElementById('hint').style
.visibility
= "hidden";
494 document
.getElementById('rel_button').className
= 'M_butt';
500 function Click_field(T
, f
, PK
) // table field
504 //.style.display=='none' .style.visibility = "hidden"
506 alert(LangPleaseSelectPrimaryOrUniqueKey
);
509 if (j_tabs
[db
+ '.' + T
] != 'INNODB') {
510 document
.getElementById('InnoDB_relation').style
.display
= 'none';
513 link_relation
= "T1=" + T
+ "&F1=" + f
;
514 document
.getElementById('hint').innerHTML
= LangSelectForeignKey
;
516 Start_relation(); // hidden hint...
517 if (j_tabs
[db
+ '.' + T
] != 'INNODB' || !PK
) {
518 document
.getElementById('InnoDB_relation').style
.display
= 'none';
520 var left
= Glob_X
- (document
.getElementById('layer_new_relation').offsetWidth
>>1);
521 document
.getElementById('layer_new_relation').style
.left
= left
+ 'px';
522 var top
= Glob_Y
- document
.getElementById('layer_new_relation').offsetHeight
- 10;
523 document
.getElementById('layer_new_relation').style
.top
= top
+ 'px';
524 document
.getElementById('layer_new_relation').style
.visibility
= "visible";
525 link_relation
+= '&T2=' + T
+ '&F2=' + f
;
529 if (ON_display_field
) {
530 // if is display field
531 if (display_field
[T
] == f
) {
533 //s = '';for(k in display_field)s += k + ' = ' + display_field[k] + ',';alert(s);
534 old_class
= 'tab_field';
535 //display_field.splice(T, 1);
536 delete display_field
[T
];
537 //s = '';for(k in display_field)s += k + ' = ' + display_field[k] + ', ';alert(s);
538 //n = 0;for(k in display_field)n++;alert(n);
540 old_class
= 'tab_field_3';
541 if (display_field
[T
]) {
542 document
.getElementById('id_tr_' + T
+ '.' + display_field
[T
]).className
= 'tab_field';
543 //display_field.splice(T, 1);
544 delete display_field
[T
];
546 display_field
[T
] = f
;
548 ON_display_field
= 0;
549 document
.getElementById('hint').innerHTML
= "";
550 document
.getElementById('hint').style
.visibility
= "hidden";
551 document
.getElementById('display_field_button').className
= 'M_butt';
552 makeRequest('pmd_display_field.php', 'T=' + T
+ '&F=' + f
+ '&server=' + server
+ '&db=' + db
+ '&token=' + token
);
556 function New_relation()
558 document
.getElementById('layer_new_relation').style
.visibility
= 'hidden';
559 link_relation
+= '&server=' + server
+ '&db=' + db
+ '&token=' + token
+ '&die_save_pos=0';
560 link_relation
+= '&on_delete=' + document
.getElementById('on_delete').value
+ '&on_update=' + document
.getElementById('on_update').value
;
561 link_relation
+= Get_url_pos();
563 //alert(link_relation);
564 makeRequest('pmd_relation_new.php', link_relation
);
567 //-------------------------- create tables -------------------------------------
569 function Start_table_new()
571 window
.location
.href
= 'db_operations.php?server=' + server
+ '&db=' + db
+ '&token=' + token
;
574 function Start_tab_upd(table
)
576 window
.location
.href
= 'tbl_structure.php?server=' + server
+ '&db=' + db
+ '&token=' + token
+ '&table=' + table
;
578 //--------------------------- hide tables --------------------------------------
580 function Small_tab_all(id_this
) // max/min all tables
582 if (id_this
.alt
== "v") {
583 for (key
in j_tabs
) {
584 if (document
.getElementById('id_hide_tbody_'+key
).innerHTML
== "v") {
589 id_this
.src
= "pmd/images/rightarrow1.png";
591 for (key
in j_tabs
) {
592 if (document
.getElementById('id_hide_tbody_'+key
).innerHTML
!= "v") {
597 id_this
.src
= "pmd/images/downarrow1.png";
602 function Small_tab_invert() // invert max/min all tables
604 for (key
in j_tabs
) {
610 function Small_tab_refresh()
612 for (key
in j_tabs
) {
613 if(document
.getElementById('id_hide_tbody_'+key
).innerHTML
!= "v") {
620 function Small_tab(t
, re_load
)
622 var id
= document
.getElementById('id_tbody_' + t
);
623 var id_this
= document
.getElementById('id_hide_tbody_' + t
);
624 var id_t
= document
.getElementById(t
);
626 id_t
.style
.width
= id_t
.offsetWidth
+ 'px';
627 if (id_this
.innerHTML
== "v") {
629 id
.style
.display
= 'none';
630 id_this
.innerHTML
= '>';
632 id
.style
.display
= '';
633 id_this
.innerHTML
= 'v';
639 //------------------------------------------------------------------------------
640 function Select_tab(t
)
642 var id_zag
= document
.getElementById('id_zag_' + t
);
643 if (id_zag
.className
!= 'tab_zag_3') {
644 document
.getElementById('id_zag_' + t
).className
= 'tab_zag_2';
646 document
.getElementById('id_zag_' + t
).className
= 'tab_zag';
649 var id_t
= document
.getElementById(t
);
650 window
.scrollTo(parseInt(id_t
.style
.left
) - 300, parseInt(id_t
.style
.top
) - 300);
652 setTimeout(function(){document
.getElementById('id_zag_' + t
).className
= 'tab_zag';}, 800);
654 //------------------------------------------------------------------------------
656 function Canvas_click(id
)
659 var relation_name
= 0;
662 var Key0
, Key1
, Key2
, Key3
, Key
, x1
, x2
;
665 for (key
in contr
[K
])
666 for (key2
in contr
[K
][key
])
667 for (key3
in contr
[K
][key
][key2
]) {
668 if (!document
.getElementById("check_vis_"+key2
).checked
||
669 !document
.getElementById("check_vis_"+contr
[K
][key
][key2
][key3
][0]).checked
) continue; // if hide
670 var x1_left
= document
.getElementById(key2
).offsetLeft
+ 1;//document.getElementById(key2+"."+key3).offsetLeft;
671 var x1_right
= x1_left
+ document
.getElementById(key2
).offsetWidth
;
672 var x2_left
= document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetLeft
;//+document.getElementById(contr[K][key2][key3][0]+"."+contr[K][key2][key3][1]).offsetLeft
673 var x2_right
= x2_left
+ document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetWidth
;
674 a
[0] = Math
.abs(x1_left
- x2_left
);
675 a
[1] = Math
.abs(x1_left
- x2_right
);
676 a
[2] = Math
.abs(x1_right
- x2_left
);
677 a
[3] = Math
.abs(x1_right
- x2_right
);
678 n
= s_left
= s_right
= 0;
679 for (var i
= 1; i
< 4; i
++) {
686 x2
= x2_right
+ sm_s
;
692 x1
= x1_right
+ sm_s
;
699 x1
= x1_right
+ sm_s
;
700 x2
= x2_right
+ sm_s
;
709 var y1
= document
.getElementById(key2
).offsetTop
+ document
.getElementById(key2
+"."+key3
).offsetTop
+ height_field
;
710 var y2
= document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetTop
+
711 document
.getElementById(contr
[K
][key
][key2
][key3
][0]+"."+contr
[K
][key
][key2
][key3
][1]).offsetTop
+ height_field
;
712 if (!selected
&& Glob_X
> x1
- 10 && Glob_X
< x1
+ 10 && Glob_Y
> y1
- 7 && Glob_Y
< y1
+ 7) {
713 Line0(x1
- sm_x
, y1
- sm_y
, x2
- sm_x
, y2
- sm_y
, "rgba(255,0,0,1)");
714 selected
= 1; // Rect(x1-sm_x,y1-sm_y,10,10,"rgba(0,255,0,1)");
715 relation_name
= key
; //
716 Key0
= contr
[K
][key
][key2
][key3
][0];
717 Key1
= contr
[K
][key
][key2
][key3
][1];
718 Key2
= key2
; Key3
= key3
;
721 Line0(x1
- sm_x
, y1
- sm_y
, x2
- sm_x
, y2
- sm_y
, "rgba(0,100,150,1)");
726 //alert(Key0+' - '+Key1+' - '+Key2+' - '+Key3);
727 var left
= Glob_X
- (document
.getElementById('layer_upd_relation').offsetWidth
>>1);
728 document
.getElementById('layer_upd_relation').style
.left
= left
+ 'px';
729 var top
= Glob_Y
- document
.getElementById('layer_upd_relation').offsetHeight
- 10;
730 document
.getElementById('layer_upd_relation').style
.top
= top
+ 'px';
731 document
.getElementById('layer_upd_relation').style
.visibility
= 'visible';
732 link_relation
= 'T1=' + Key0
+ '&F1=' + Key1
+ '&T2=' + Key2
+ '&F2=' + Key3
+ '&K=' + Key
;
736 function Upd_relation()
738 document
.getElementById('layer_upd_relation').style
.visibility
= 'hidden';
739 link_relation
+= '&server=' + server
+ '&db=' + db
+ '&token=' + token
+ '&die_save_pos=0';
740 link_relation
+= Get_url_pos();
741 makeRequest('pmd_relation_upd.php', link_relation
);
744 function VisibleTab(id
, t_n
)
747 document
.getElementById(t_n
).style
.visibility
= 'visible';
749 document
.getElementById(t_n
).style
.visibility
= 'hidden';
754 function Hide_tab_all(id_this
) // max/min all tables
756 if (id_this
.alt
== 'v') {
758 id_this
.src
= "pmd/images/rightarrow1.png";
761 id_this
.src
= "pmd/images/downarrow1.png";
763 var E
= document
.form1
;
764 for (i
= 0; i
< E
.elements
.length
; i
++) {
765 if (E
.elements
[i
].type
== "checkbox" && E
.elements
[i
].id
.substring(0, 10) == 'check_vis_') {
766 if (id_this
.alt
== 'v') {
767 E
.elements
[i
].checked
= true;
768 document
.getElementById(E
.elements
[i
].value
).style
.visibility
= 'visible';
770 E
.elements
[i
].checked
= false;
771 document
.getElementById(E
.elements
[i
].value
).style
.visibility
= 'hidden';
778 function in_array_k(x
, m
)
790 function No_have_constr(id_this
)
794 for (key
in contr
[K
]) // contr name
795 for (key2
in contr
[K
][key
]) // table name
796 for (key3
in contr
[K
][key
][key2
]) // field name
797 a
[key2
] = a
[contr
[K
][key
][key2
][key3
][0]] = 1; // exist constr
800 if (id_this
.alt
== 'v') {
802 id_this
.src
= "pmd/images/rightarrow2.png";
805 id_this
.src
= "pmd/images/downarrow2.png";
807 var E
= document
.form1
;
808 for (i
= 0; i
< E
.elements
.length
; i
++) {
809 if (E
.elements
[i
].type
== "checkbox" && E
.elements
[i
].id
.substring(0, 10) == 'check_vis_')
811 if (!in_array_k(E
.elements
[i
].value
, a
))
812 if (id_this
.alt
== 'v') {
813 E
.elements
[i
].checked
= true;
814 document
.getElementById(E
.elements
[i
].value
).style
.visibility
= 'visible';
816 E
.elements
[i
].checked
= false;
817 document
.getElementById(E
.elements
[i
].value
).style
.visibility
= 'hidden';
825 var WinHelp
= window
.open("pmd_help.php", "wind1", "top=200,left=400,width=300,height=200,resizable=yes,scrollbars=yes,menubar=no");
831 // window.open("pmd_pdf.php?token="+token+"&db="+db,"wind1", "top=200,left=200,width=200,height=100,resizable=yes,scrollbars=yes,menubar=no");
832 Save('pmd_pdf.php?server=' + server
+ '&token=' + token
+ '&db=' + db
);
835 function General_scroll()
838 if (!document.getElementById('show_relation_olways').checked) {
839 document.getElementById("canvas").style.visibility = 'hidden';
840 clearTimeout(timeoutID);
841 timeoutID = setTimeout(General_scroll_end, 500);
845 clearTimeout(timeoutID
);
846 timeoutID
= setTimeout
850 document
.getElementById('top_menu').style
.left
= document
.body
.scrollLeft
+ 'px';
851 document
.getElementById('top_menu').style
.top
= document
.body
.scrollTop
+ 'px';
852 document
.getElementById('layer_menu').style
.left
= document
.body
.scrollLeft
+ 'px';
853 document
.getElementById('layer_menu').style
.top
= (document
.body
.scrollTop
+ document
.getElementById('top_menu').offsetHeight
) + 'px';
860 function General_scroll_end()
862 document.getElementById('layer_menu').style.left = document.body.scrollLeft;
863 document.getElementById('layer_menu').style.top = document.body.scrollTop + document.getElementById('top_menu').offsetHeight;
865 document.getElementById('layer_menu').style.left = document.body.scrollLeft;
866 document.getElementById('layer_menu').style.top = document.body.scrollTop + document.getElementById('top_menu').offsetHeight;
868 document.getElementById("canvas").style.visibility = 'visible';
872 function Show_left_menu(id_this
) // max/min all tables
874 if (id_this
.alt
== "v") {
875 document
.getElementById("layer_menu").style
.top
= document
.getElementById('top_menu').offsetHeight
+ 'px';
876 document
.getElementById("layer_menu").style
.visibility
= 'visible';
878 id_this
.src
= "pmd/images/uparrow2_m.png";
883 document
.getElementById("layer_menu").style
.top
= -1000 + 'px'; //fast scroll
884 document
.getElementById("layer_menu").style
.visibility
= 'hidden';
886 id_this
.src
= "pmd/images/downarrow2_m.png";
889 //------------------------------------------------------------------------------
890 function Top_menu_right(id_this
)
892 if (id_this
.alt
== ">") {
893 document
.getElementById('top_menu').style
.marginLeft
= document
.getElementById('top_menu').offsetWidth
+ 'px'; // = 350
895 id_this
.src
= "pmd/images/2leftarrow_m.png";
897 document
.getElementById('top_menu').style
.marginLeft
= 0;
899 id_this
.src
= "pmd/images/2rightarrow_m.png";
902 //------------------------------------------------------------------------------
903 function Start_display_field()
908 if (!ON_display_field
) {
909 ON_display_field
= 1;
910 document
.getElementById('hint').innerHTML
= LangChangeDisplay
;
911 document
.getElementById('hint').style
.visibility
= "visible";
912 document
.getElementById('display_field_button').className
= 'M_butt_Selected_down';//'#FFEE99';gray #AAAAAA
914 if (isIE
) { // correct for IE
915 document
.getElementById('display_field_button').className
= 'M_butt_Selected_down_IE';
918 document
.getElementById('hint').innerHTML
= "";
919 document
.getElementById('hint').style
.visibility
= "hidden";
920 document
.getElementById('display_field_button').className
= 'M_butt';
921 ON_display_field
= 0;