1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * @package phpMyAdmin-Designer
12 var sm_x
= 2, sm_y
= 2;
19 var ON_display_field
= 0;
20 // relation_style: 0 - angular 1 - direct
21 var ON_angular_direct
= 1;
23 var link_relation
= "";
26 var canvas_height
= 0;
27 var osn_tab_width
= 0;
28 var osn_tab_height
= 0;
32 var layer_menu_cur_click
= 0;
36 //------------------------------------------------------------------------------
37 //------------------------------------------------------------------------------
38 //------------------------------------------------------------------------------
41 //window.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
43 document
.onmousedown
= MouseDown
;
44 document
.onmouseup
= MouseUp
;
45 document
.onmousemove
= MouseMove
;
47 var isIE
= document
.all
&& !window
.opera
;
48 var isNN
= !document
.all
&& document
.getElementById
;
49 var isN4
= document
.layers
;
52 window
.onscroll
= General_scroll
;
53 document
.onselectstart = function () {return false;};
56 //document.onmouseup = function(){General_scroll_end();}
60 if (cur_click
!= null) {
61 offsetx
= isIE
? event
.clientX
+ document
.body
.scrollLeft
: e
.pageX
;
62 offsety
= isIE
? event
.clientY
+ document
.body
.scrollTop
: e
.pageY
;
63 dx
= offsetx
- parseInt(cur_click
.style
.left
);
64 dy
= offsety
- parseInt(cur_click
.style
.top
);
65 //alert(" dx = " + dx + " dy = " +dy);
66 document
.getElementById("canvas").style
.visibility
= 'hidden';
68 var left = parseInt(cur_click.style.left);
69 var top = parseInt(cur_click.style.top);
73 alert(" dx = " + dx + " dy = " +dy);
75 cur_click
.style
.zIndex
= 2;
77 if (layer_menu_cur_click
) {
78 offsetx
= isIE
? event
.clientX
+ document
.body
.scrollLeft
: e
.pageX
;
79 dx
= offsetx
- parseInt(document
.getElementById("layer_menu").style
.width
);
87 Glob_X
= isIE
? event
.clientX
+ document
.body
.scrollLeft
: e
.pageX
;
88 Glob_Y
= isIE
? event
.clientY
+ document
.body
.scrollTop
: e
.pageY
;
90 //mouseX = (bw.ns4||bw.ns6)? e.pageX: bw.ie&&bw.win&&!bw.ie4? (event.clientX-2)+document.body.scrollLeft : event.clientX+document.body.scrollLeft;
91 //mouseY = (bw.ns4||bw.ns6)? e.pageY: bw.ie&&bw.win&&!bw.ie4? (event.clientY-2)+document.body.scrollTop : event.clientY+document.body.scrollTop;
93 //window.status = "X = "+ Glob_X + " Y = "+ Glob_Y;
95 if (cur_click
!= null) {
96 var mGx
= Glob_X
- dx
;
97 var mGy
= Glob_Y
- dy
;
98 mGx
= mGx
> 0 ? mGx
: 0;
99 mGy
= mGy
> 0 ? mGy
: 0;
102 mGx
= mGx
% step
< step
/ 2 ? mGx
- mGx
% step
: mGx
- mGx
% step
+ step
;
103 mGy
= mGy
% step
< step
/ 2 ? mGy
- mGy
% step
: mGy
- mGy
% step
+ step
;
106 cur_click
.style
.left
= mGx
+ 'px';
107 cur_click
.style
.top
= mGy
+ 'px';
110 if (ON_relation
|| ON_display_field
) {
111 document
.getElementById('hint').style
.left
= (Glob_X
+ 20) + 'px';
112 document
.getElementById('hint').style
.top
= (Glob_Y
+ 20) + 'px';
115 if (layer_menu_cur_click
) {
116 document
.getElementById("layer_menu").style
.width
= ((Glob_X
- dx
) >= 150 ? Glob_X
- dx
: 150) + 'px';
117 //document.getElementById("layer_menu").style.height = Glob_Y - dy>=200?Glob_Y - dy:200;
118 //document.getElementById("id_scroll_tab").style.height = Glob_Y - dy2;
124 if (cur_click
!= null) {
125 document
.getElementById("canvas").style
.visibility
= 'visible';
127 cur_click
.style
.zIndex
= 1;
130 layer_menu_cur_click
= 0;
131 //window.releaseEvents(Event.MOUSEMOVE);
133 //------------------------------------------------------------------------------
134 //------------------------------------------------------------------------------
135 //------------------------------------------------------------------------------
140 // return s.substring(0,s.length-2)*1; //re = /(\d+)\w*/; newstr = str.replace(re, "$1");
143 function Canvas_pos()
145 canvas_width
= document
.getElementById('canvas').width
= osn_tab_width
- 3;
146 canvas_height
= document
.getElementById('canvas').height
= osn_tab_height
- 3;
149 document
.getElementById('canvas').style
.width
= ((osn_tab_width
- 3)?(osn_tab_width
- 3):0) + 'px';
150 document
.getElementById('canvas').style
.height
= ((osn_tab_height
- 3)?(osn_tab_height
- 3):0) + 'px';
154 function Osn_tab_pos()
156 osn_tab_width
= parseInt(document
.getElementById('osn_tab').style
.width
);
157 osn_tab_height
= parseInt(document
.getElementById('osn_tab').style
.height
);
163 //alert( document.getElementById('osn_tab').offsetTop);
166 document
.getElementById('top_menu').style
.position
= 'absolute';
167 document
.getElementById('layer_menu').style
.position
= 'absolute';
170 document
.getElementById("layer_menu").style
.top
= -1000 + 'px'; //fast scroll
171 sm_x
+= document
.getElementById('osn_tab').offsetLeft
;
172 sm_y
+= document
.getElementById('osn_tab').offsetTop
;
177 id_hint
= document
.getElementById('hint');
184 //-------------------------------- new -----------------------------------------
185 function Rezize_osn_tab()
189 for (key
in j_tabs
) {
190 var k_x
= parseInt(document
.getElementById(key
).style
.left
) + document
.getElementById(key
).offsetWidth
;
191 var k_y
= parseInt(document
.getElementById(key
).style
.top
) + document
.getElementById(key
).offsetHeight
;
192 max_X
= max_X
< k_x
? k_x
: max_X
;
193 max_Y
= max_Y
< k_y
? k_y
: max_Y
;
196 osn_tab_width
= max_X
+ 50;
197 osn_tab_height
= max_Y
+ 50;
199 document
.getElementById('osn_tab').style
.width
= osn_tab_width
+ 'px';
200 document
.getElementById('osn_tab').style
.height
= osn_tab_height
+ 'px';
202 //------------------------------------------------------------------------------
205 * refreshes display, must be called after state changes
216 for (key
in contr
[K
]) // contr name
217 for (key2
in contr
[K
][key
]) // table name
218 for (key3
in contr
[K
][key
][key2
]) // field name
220 if (!document
.getElementById("check_vis_" + key2
).checked
||
221 !document
.getElementById("check_vis_" + contr
[K
][key
][key2
][key3
][0]).checked
) {
225 var x1_left
= document
.getElementById(key2
).offsetLeft
+1;
226 var x1_right
= x1_left
+ document
.getElementById(key2
).offsetWidth
;
227 var x2_left
= document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetLeft
;
228 var x2_right
= x2_left
+ document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetWidth
;
229 a
[0] = Math
.abs(x1_left
- x2_left
);
230 a
[1] = Math
.abs(x1_left
- x2_right
);
231 a
[2] = Math
.abs(x1_right
- x2_left
);
232 a
[3] = Math
.abs(x1_right
- x2_right
);
233 n
= s_left
= s_right
= 0;
234 for (var i
= 1; i
< 4; i
++) {
241 x2
= x2_right
+ sm_s
;
247 x1
= x1_right
+ sm_s
;
254 x1
= x1_right
+ sm_s
;
255 x2
= x2_right
+ sm_s
;
263 //alert(key2 + "." + key3);
265 var row_offset_top
= 0;
266 //alert('id_tbody_' + key2);
267 //alert(document.getElementById('id_hide_tbody_' + key2));
268 var tab_hide_button
= document
.getElementById('id_hide_tbody_' + key2
);
270 //alert(tab_hide_button.innerHTML);
271 if (tab_hide_button
.innerHTML
== 'v') {
272 row_offset_top
= document
.getElementById(key2
+ "." + key3
).offsetTop
;
275 var y1
= document
.getElementById(key2
).offsetTop
281 var tab_hide_button
= document
.getElementById('id_hide_tbody_' + contr
[K
][key
][key2
][key3
][0]);
282 if (tab_hide_button
.innerHTML
== 'v') {
283 row_offset_top
= document
.getElementById(contr
[K
][key
][key2
][key3
][0]
284 + '.' + contr
[K
][key
][key2
][key3
][1]).offsetTop
;
288 document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetTop
292 //alert(y1 + ' - ' + key2 + "." + key3);
293 Line0(x1
- sm_x
, y1
- sm_y
, x2
- sm_x
, y2
- sm_y
, getColorByTarget( contr
[K
][key
][key2
][key3
][0]+'.'+contr
[K
][key
][key2
][key3
][1] ) );
298 * draws a line from x1:y1 to x2:y2 with color
300 function Line(x1
, y1
, x2
, y2
, color_line
)
302 var canvas
= document
.getElementById("canvas");
303 var ctx
= canvas
.getContext("2d");
304 ctx
.strokeStyle
= color_line
;
313 * draws a relation/constraint line, whether angular or not
315 function Line0(x1
, y1
, x2
, y2
, color_line
)
317 Circle(x1
, y1
, 3, 3, color_line
);
318 Rect(x2
- 1, y2
- 2, 4, 4, color_line
);
320 if (ON_angular_direct
) {
321 Line2(x1
, y1
, x2
, y2
, color_line
);
323 Line3(x1
, y1
, x2
, y2
, color_line
);
328 * draws a angualr relation/constraint line
330 function Line2(x1
, y1
, x2
, y2
, color_line
)
341 } else if (x1
< x2
) {
349 Line(x1
, y1
, x1_
, y1
, color_line
);
350 Line(x2
, y2
, x2_
, y2
, color_line
);
351 Line(x1_
, y1
, x2_
, y2
, color_line
);
355 * draws a relation/constraint line
357 function Line3(x1
, y1
, x2
, y2
, color_line
)
364 x1_
+= x2
- x1
+ sm_add
;
367 x2_
+= x1
- x2
+ sm_add
;
371 Line(x1
, y1
, x1_
, y1
, color_line
);
372 Line(x2
, y2
, x2_
, y2
, color_line
);
373 Line(x1_
, y1
, x2_
, y2
, color_line
);
378 x2_
-= x2
- x1
+ sm_add
;
381 x1_
-= x1
- x2
+ sm_add
;
385 Line(x1
, y1
, x1_
, y1
, color_line
);
386 Line(x2
, y2
, x2_
, y2
, color_line
);
387 Line(x1_
, y1
, x2_
, y2
, color_line
);
391 var x_s
= (x1
+ x2
) / 2;
392 Line(x1
, y1
, x_s
, y1
, color_line
);
393 Line(x_s
, y2
, x2
, y2
, color_line
);
394 Line(x_s
, y1
, x_s
, y2
, color_line
);
397 function Circle(x
, y
, r
, w
, color
)
399 var ctx
= document
.getElementById('canvas').getContext('2d');
403 ctx
.strokeStyle
= color
;
404 ctx
.arc(x
, y
, r
, 0, 2 * Math
.PI
, true);
410 var canvas
= document
.getElementById("canvas");
411 var ctx
= canvas
.getContext("2d");
412 ctx
.clearRect(0, 0, canvas_width
, canvas_height
);
415 function Rect(x1
, y1
, w
, h
, color
)
417 var ctx
= document
.getElementById('canvas').getContext('2d');
418 ctx
.fillStyle
= color
;
419 ctx
.fillRect(x1
, y1
, w
, h
);
422 //------------------------------ SAVE ------------------------------------------
423 function Save(url
) // (del?) no for pdf
425 for (key
in j_tabs
) {
426 document
.getElementById('t_x_' + key
+ '_').value
= parseInt(document
.getElementById(key
).style
.left
);
427 document
.getElementById('t_y_' + key
+ '_').value
= parseInt(document
.getElementById(key
).style
.top
);
428 document
.getElementById('t_v_' + key
+ '_').value
= document
.getElementById('id_tbody_' + key
).style
.display
== 'none' ? 0 : 1;
429 document
.getElementById('t_h_' + key
+ '_').value
= document
.getElementById('check_vis_' + key
).checked
? 1 : 0;
431 document
.form1
.action
= url
;
432 document
.form1
.submit();
435 function Get_url_pos()
438 for (key
in j_tabs
) {
439 poststr
+= '&t_x[' + key
+ ']=' + parseInt(document
.getElementById(key
).style
.left
);
440 poststr
+= '&t_y[' + key
+ ']=' + parseInt(document
.getElementById(key
).style
.top
);
441 poststr
+= '&t_v[' + key
+ ']=' + (document
.getElementById('id_tbody_' + key
).style
.display
== 'none' ? 0 : 1);
442 poststr
+= '&t_h[' + key
+ ']=' + (document
.getElementById('check_vis_' + key
).checked
? 1 : 0);
449 var poststr
= 'IS_AJAX=1&server='+server
+'&db=' + db
+ '&token=' + token
+ '&die_save_pos=1';
450 poststr
+= Get_url_pos();
451 makeRequest('pmd_save_pos.php', poststr
);
458 document
.getElementById('grid_button').className
= 'M_butt_Selected_down';
460 document
.getElementById('grid_button').className
= 'M_butt';
465 function Angular_direct()
467 if (ON_angular_direct
) {
468 ON_angular_direct
= 0;
469 document
.getElementById('angular_direct_button').className
= 'M_butt_Selected_down';
471 ON_angular_direct
= 1;
472 document
.getElementById('angular_direct_button').className
= 'M_butt';
476 //++++++++++++++++++++++++++++++ RELATION ++++++++++++++++++++++++++++++++++++++
477 function Start_relation()
479 if (ON_display_field
) {
484 document
.getElementById('foreign_relation').style
.display
= '';
486 document
.getElementById('hint').innerHTML
= PMA_messages
['strSelectReferencedKey'];
487 document
.getElementById('hint').style
.visibility
= "visible";
488 document
.getElementById('rel_button').className
= 'M_butt_Selected_down';
490 document
.getElementById('hint').innerHTML
= "";
491 document
.getElementById('hint').style
.visibility
= "hidden";
492 document
.getElementById('rel_button').className
= 'M_butt';
498 function Click_field(T
, f
, PK
) // table field
502 //.style.display=='none' .style.visibility = "hidden"
504 alert(PMA_messages
['strPleaseSelectPrimaryOrUniqueKey']);
507 if (j_tabs
[db
+ '.' + T
] != '1') {
508 document
.getElementById('foreign_relation').style
.display
= 'none';
511 link_relation
= "T1=" + T
+ "&F1=" + f
;
512 document
.getElementById('hint').innerHTML
= PMA_messages
['strSelectForeignKey'];
514 Start_relation(); // hidden hint...
515 if (j_tabs
[db
+ '.' + T
] != '1' || !PK
) {
516 document
.getElementById('foreign_relation').style
.display
= 'none';
518 var left
= Glob_X
- (document
.getElementById('layer_new_relation').offsetWidth
>>1);
519 document
.getElementById('layer_new_relation').style
.left
= left
+ 'px';
520 var top
= Glob_Y
- document
.getElementById('layer_new_relation').offsetHeight
- 10;
521 document
.getElementById('layer_new_relation').style
.top
= top
+ 'px';
522 document
.getElementById('layer_new_relation').style
.visibility
= "visible";
523 link_relation
+= '&T2=' + T
+ '&F2=' + f
;
527 if (ON_display_field
) {
528 // if is display field
529 if (display_field
[T
] == f
) {
531 //s = '';for(k in display_field)s += k + ' = ' + display_field[k] + ',';alert(s);
532 old_class
= 'tab_field';
533 //display_field.splice(T, 1);
534 delete display_field
[T
];
535 //s = '';for(k in display_field)s += k + ' = ' + display_field[k] + ', ';alert(s);
536 //n = 0;for(k in display_field)n++;alert(n);
538 old_class
= 'tab_field_3';
539 if (display_field
[T
]) {
540 document
.getElementById('id_tr_' + T
+ '.' + display_field
[T
]).className
= 'tab_field';
541 //display_field.splice(T, 1);
542 delete display_field
[T
];
544 display_field
[T
] = f
;
546 ON_display_field
= 0;
547 document
.getElementById('hint').innerHTML
= "";
548 document
.getElementById('hint').style
.visibility
= "hidden";
549 document
.getElementById('display_field_button').className
= 'M_butt';
550 makeRequest('pmd_display_field.php', 'T=' + T
+ '&F=' + f
+ '&server=' + server
+ '&db=' + db
+ '&token=' + token
);
554 function New_relation()
556 document
.getElementById('layer_new_relation').style
.visibility
= 'hidden';
557 link_relation
+= '&server=' + server
+ '&db=' + db
+ '&token=' + token
+ '&die_save_pos=0';
558 link_relation
+= '&on_delete=' + document
.getElementById('on_delete').value
+ '&on_update=' + document
.getElementById('on_update').value
;
559 link_relation
+= Get_url_pos();
561 //alert(link_relation);
562 makeRequest('pmd_relation_new.php', link_relation
);
565 //-------------------------- create tables -------------------------------------
567 function Start_table_new()
569 window
.location
.href
= 'db_operations.php?server=' + server
+ '&db=' + db
+ '&token=' + token
;
572 function Start_tab_upd(table
)
574 window
.location
.href
= 'tbl_structure.php?server=' + server
+ '&db=' + db
+ '&token=' + token
+ '&table=' + table
;
576 //--------------------------- hide tables --------------------------------------
578 function Small_tab_all(id_this
) // max/min all tables
580 if (id_this
.alt
== "v") {
581 for (key
in j_tabs
) {
582 if (document
.getElementById('id_hide_tbody_'+key
).innerHTML
== "v") {
587 id_this
.src
= "pmd/images/rightarrow1.png";
589 for (key
in j_tabs
) {
590 if (document
.getElementById('id_hide_tbody_'+key
).innerHTML
!= "v") {
595 id_this
.src
= "pmd/images/downarrow1.png";
600 function Small_tab_invert() // invert max/min all tables
602 for (key
in j_tabs
) {
608 function Small_tab_refresh()
610 for (key
in j_tabs
) {
611 if(document
.getElementById('id_hide_tbody_'+key
).innerHTML
!= "v") {
618 function Small_tab(t
, re_load
)
620 var id
= document
.getElementById('id_tbody_' + t
);
621 var id_this
= document
.getElementById('id_hide_tbody_' + t
);
622 var id_t
= document
.getElementById(t
);
624 id_t
.style
.width
= id_t
.offsetWidth
+ 'px';
625 if (id_this
.innerHTML
== "v") {
627 id
.style
.display
= 'none';
628 id_this
.innerHTML
= '>';
630 id
.style
.display
= '';
631 id_this
.innerHTML
= 'v';
637 //------------------------------------------------------------------------------
638 function Select_tab(t
)
640 var id_zag
= document
.getElementById('id_zag_' + t
);
641 if (id_zag
.className
!= 'tab_zag_3') {
642 document
.getElementById('id_zag_' + t
).className
= 'tab_zag_2';
644 document
.getElementById('id_zag_' + t
).className
= 'tab_zag';
647 var id_t
= document
.getElementById(t
);
648 window
.scrollTo(parseInt(id_t
.style
.left
) - 300, parseInt(id_t
.style
.top
) - 300);
650 setTimeout(function(){document
.getElementById('id_zag_' + t
).className
= 'tab_zag';}, 800);
652 //------------------------------------------------------------------------------
654 function Canvas_click(id
)
657 var relation_name
= 0;
660 var Key0
, Key1
, Key2
, Key3
, Key
, x1
, x2
;
663 for (key
in contr
[K
])
664 for (key2
in contr
[K
][key
])
665 for (key3
in contr
[K
][key
][key2
]) {
666 if (!document
.getElementById("check_vis_"+key2
).checked
||
667 !document
.getElementById("check_vis_"+contr
[K
][key
][key2
][key3
][0]).checked
) continue; // if hide
668 var x1_left
= document
.getElementById(key2
).offsetLeft
+ 1;//document.getElementById(key2+"."+key3).offsetLeft;
669 var x1_right
= x1_left
+ document
.getElementById(key2
).offsetWidth
;
670 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
671 var x2_right
= x2_left
+ document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetWidth
;
672 a
[0] = Math
.abs(x1_left
- x2_left
);
673 a
[1] = Math
.abs(x1_left
- x2_right
);
674 a
[2] = Math
.abs(x1_right
- x2_left
);
675 a
[3] = Math
.abs(x1_right
- x2_right
);
676 n
= s_left
= s_right
= 0;
677 for (var i
= 1; i
< 4; i
++) {
684 x2
= x2_right
+ sm_s
;
690 x1
= x1_right
+ sm_s
;
697 x1
= x1_right
+ sm_s
;
698 x2
= x2_right
+ sm_s
;
707 var y1
= document
.getElementById(key2
).offsetTop
+ document
.getElementById(key2
+"."+key3
).offsetTop
+ height_field
;
708 var y2
= document
.getElementById(contr
[K
][key
][key2
][key3
][0]).offsetTop
+
709 document
.getElementById(contr
[K
][key
][key2
][key3
][0]+"."+contr
[K
][key
][key2
][key3
][1]).offsetTop
+ height_field
;
710 if (!selected
&& Glob_X
> x1
- 10 && Glob_X
< x1
+ 10 && Glob_Y
> y1
- 7 && Glob_Y
< y1
+ 7) {
711 Line0(x1
- sm_x
, y1
- sm_y
, x2
- sm_x
, y2
- sm_y
, "rgba(255,0,0,1)");
712 selected
= 1; // Rect(x1-sm_x,y1-sm_y,10,10,"rgba(0,255,0,1)");
713 relation_name
= key
; //
714 Key0
= contr
[K
][key
][key2
][key3
][0];
715 Key1
= contr
[K
][key
][key2
][key3
][1];
716 Key2
= key2
; Key3
= key3
;
719 Line0(x1
- sm_x
, y1
- sm_y
, x2
- sm_x
, y2
- sm_y
, getColorByTarget( contr
[K
][key
][key2
][key3
][0]+'.'+contr
[K
][key
][key2
][key3
][1] ));
724 //alert(Key0+' - '+Key1+' - '+Key2+' - '+Key3);
725 var left
= Glob_X
- (document
.getElementById('layer_upd_relation').offsetWidth
>>1);
726 document
.getElementById('layer_upd_relation').style
.left
= left
+ 'px';
727 var top
= Glob_Y
- document
.getElementById('layer_upd_relation').offsetHeight
- 10;
728 document
.getElementById('layer_upd_relation').style
.top
= top
+ 'px';
729 document
.getElementById('layer_upd_relation').style
.visibility
= 'visible';
730 link_relation
= 'T1=' + Key0
+ '&F1=' + Key1
+ '&T2=' + Key2
+ '&F2=' + Key3
+ '&K=' + Key
;
734 function Upd_relation()
736 document
.getElementById('layer_upd_relation').style
.visibility
= 'hidden';
737 link_relation
+= '&server=' + server
+ '&db=' + db
+ '&token=' + token
+ '&die_save_pos=0';
738 link_relation
+= Get_url_pos();
739 makeRequest('pmd_relation_upd.php', link_relation
);
742 function VisibleTab(id
, t_n
)
745 document
.getElementById(t_n
).style
.visibility
= 'visible';
747 document
.getElementById(t_n
).style
.visibility
= 'hidden';
752 function Hide_tab_all(id_this
) // max/min all tables
754 if (id_this
.alt
== 'v') {
756 id_this
.src
= "pmd/images/rightarrow1.png";
759 id_this
.src
= "pmd/images/downarrow1.png";
761 var E
= document
.form1
;
762 for (i
= 0; i
< E
.elements
.length
; i
++) {
763 if (E
.elements
[i
].type
== "checkbox" && E
.elements
[i
].id
.substring(0, 10) == 'check_vis_') {
764 if (id_this
.alt
== 'v') {
765 E
.elements
[i
].checked
= true;
766 document
.getElementById(E
.elements
[i
].value
).style
.visibility
= 'visible';
768 E
.elements
[i
].checked
= false;
769 document
.getElementById(E
.elements
[i
].value
).style
.visibility
= 'hidden';
776 function in_array_k(x
, m
)
788 function No_have_constr(id_this
)
792 for (key
in contr
[K
]) // contr name
793 for (key2
in contr
[K
][key
]) // table name
794 for (key3
in contr
[K
][key
][key2
]) // field name
795 a
[key2
] = a
[contr
[K
][key
][key2
][key3
][0]] = 1; // exist constr
798 if (id_this
.alt
== 'v') {
800 id_this
.src
= "pmd/images/rightarrow2.png";
803 id_this
.src
= "pmd/images/downarrow2.png";
805 var E
= document
.form1
;
806 for (i
= 0; i
< E
.elements
.length
; i
++) {
807 if (E
.elements
[i
].type
== "checkbox" && E
.elements
[i
].id
.substring(0, 10) == 'check_vis_')
809 if (!in_array_k(E
.elements
[i
].value
, a
))
810 if (id_this
.alt
== 'v') {
811 E
.elements
[i
].checked
= true;
812 document
.getElementById(E
.elements
[i
].value
).style
.visibility
= 'visible';
814 E
.elements
[i
].checked
= false;
815 document
.getElementById(E
.elements
[i
].value
).style
.visibility
= 'hidden';
823 var WinHelp
= window
.open("pmd_help.php", "wind1", "top=200,left=400,width=300,height=200,resizable=yes,scrollbars=yes,menubar=no");
829 // window.open("pmd_pdf.php?token="+token+"&db="+db,"wind1", "top=200,left=200,width=200,height=100,resizable=yes,scrollbars=yes,menubar=no");
830 Save('pmd_pdf.php?server=' + server
+ '&token=' + token
+ '&db=' + db
);
833 function General_scroll()
836 if (!document.getElementById('show_relation_olways').checked) {
837 document.getElementById("canvas").style.visibility = 'hidden';
838 clearTimeout(timeoutID);
839 timeoutID = setTimeout(General_scroll_end, 500);
843 clearTimeout(timeoutID
);
844 timeoutID
= setTimeout
848 document
.getElementById('top_menu').style
.left
= document
.body
.scrollLeft
+ 'px';
849 document
.getElementById('top_menu').style
.top
= document
.body
.scrollTop
+ 'px';
850 document
.getElementById('layer_menu').style
.left
= document
.body
.scrollLeft
+ 'px';
851 document
.getElementById('layer_menu').style
.top
= (document
.body
.scrollTop
+ document
.getElementById('top_menu').offsetHeight
) + 'px';
858 function General_scroll_end()
860 document.getElementById('layer_menu').style.left = document.body.scrollLeft;
861 document.getElementById('layer_menu').style.top = document.body.scrollTop + document.getElementById('top_menu').offsetHeight;
863 document.getElementById('layer_menu').style.left = document.body.scrollLeft;
864 document.getElementById('layer_menu').style.top = document.body.scrollTop + document.getElementById('top_menu').offsetHeight;
866 document.getElementById("canvas").style.visibility = 'visible';
870 function Show_left_menu(id_this
) // max/min all tables
872 if (id_this
.alt
== "v") {
873 document
.getElementById("layer_menu").style
.top
= document
.getElementById('top_menu').offsetHeight
+ 'px';
874 document
.getElementById("layer_menu").style
.visibility
= 'visible';
876 id_this
.src
= "pmd/images/uparrow2_m.png";
881 document
.getElementById("layer_menu").style
.top
= -1000 + 'px'; //fast scroll
882 document
.getElementById("layer_menu").style
.visibility
= 'hidden';
884 id_this
.src
= "pmd/images/downarrow2_m.png";
887 //------------------------------------------------------------------------------
888 function Top_menu_right(id_this
)
890 if (id_this
.alt
== ">") {
891 document
.getElementById('top_menu').style
.marginLeft
= document
.getElementById('top_menu').offsetWidth
+ 'px'; // = 350
893 id_this
.src
= "pmd/images/2leftarrow_m.png";
895 document
.getElementById('top_menu').style
.marginLeft
= 0;
897 id_this
.src
= "pmd/images/2rightarrow_m.png";
900 //------------------------------------------------------------------------------
901 function Start_display_field()
906 if (!ON_display_field
) {
907 ON_display_field
= 1;
908 document
.getElementById('hint').innerHTML
= PMA_messages
['strChangeDisplay'];
909 document
.getElementById('hint').style
.visibility
= "visible";
910 document
.getElementById('display_field_button').className
= 'M_butt_Selected_down';//'#FFEE99';gray #AAAAAA
912 if (isIE
) { // correct for IE
913 document
.getElementById('display_field_button').className
= 'M_butt_Selected_down_IE';
916 document
.getElementById('hint').innerHTML
= "";
917 document
.getElementById('hint').style
.visibility
= "hidden";
918 document
.getElementById('display_field_button').className
= 'M_butt';
919 ON_display_field
= 0;
922 //------------------------------------------------------------------------------
923 var TargetColors
= new Array();
924 function getColorByTarget( target
)
926 var color
= ''; //"rgba(0,100,150,1)";
928 for (i
in TargetColors
)
929 if (TargetColors
[i
][0]==target
) {
930 color
= TargetColors
[i
][1];
937 var i
= TargetColors
.length
+1;
942 var color_case
= new Array(
950 var a
= color_case
[d
][0];
951 var b
= color_case
[d
][1];
952 var c
= color_case
[d
][2];
953 e
= (1 - (j
- 1) / 6);
955 var r
= Math
.round(a
* 200 * e
);
956 var g
= Math
.round(b
* 200 * e
);
957 var b
= Math
.round(c
* 200 * e
);
958 var color
= "rgba("+r
+","+g
+","+b
+",1)";
960 TargetColors
.push( new Array(target
, color
) );