fixed/added page level docblock

This commit is contained in:
Sebastian Mendel
2007-03-20 10:32:13 +00:00
parent b948e16584
commit 374abd5173
171 changed files with 1092 additions and 454 deletions

View File

@@ -1,7 +1,12 @@
/*
$Id$
@author Ivan A Kirillov (Ivan.A.Kirillov@gmail.com)
*/
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @version $Id$
* @author Ivan A Kirillov (Ivan.A.Kirillov@gmail.com)
*/
/**
*
*/
var dx, dy, dy2;
var cur_click;
var sm_x = 2, sm_y = 2; // update in Main()
@@ -32,10 +37,10 @@ var old_class;
//---------------------------------------------------------------------------------------------------------------------------
//window.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
//window.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
//---CROSS
document.onmousedown = MouseDown;
document.onmouseup = MouseUp;
document.onmousedown = MouseDown;
document.onmouseup = MouseUp;
document.onmousemove = MouseMove;
isIE = document.all && !window.opera;
@@ -43,15 +48,15 @@ isNN = !document.all && document.getElementById;
isN4 = document.layers;
if (isIE) {
window.onscroll = General_scroll;
window.onscroll = General_scroll;
document.onselectstart = function () {return false;};
}
//document.onmouseup = function(){General_scroll_end();}
function MouseDown(e)
{
if (cur_click != null)
{
function MouseDown(e)
{
if (cur_click != null)
{
offsetx=isIE ? event.clientX + document.body.scrollLeft : e.pageX;
offsety=isIE ? event.clientY + document.body.scrollTop : e.pageY;
dx = offsetx - parseInt(cur_click.style.left);
@@ -61,58 +66,58 @@ function MouseDown(e)
/*
var left = parseInt(cur_click.style.left);
var top = parseInt(cur_click.style.top);
dx = e.pageX - left;
dx = e.pageX - left;
dy = e.pageY - top;
alert(" dx = " + dx + " dy = " +dy);*/
cur_click.style.zIndex = 2;
cur_click.style.zIndex = 2;
}
if(layer_menu_cur_click)
{
offsetx=isIE ? event.clientX + document.body.scrollLeft: e.pageX;
dx = offsetx - parseInt(document.getElementById("layer_menu").style.width);
dx = offsetx - parseInt(document.getElementById("layer_menu").style.width);
}
}
}
function MouseMove(e)
{
//Glob_X = e.pageX;
{
//Glob_X = e.pageX;
//Glob_Y = e.pageY;
Glob_X = isIE ? event.clientX + document.body.scrollLeft: e.pageX;
Glob_X = isIE ? event.clientX + document.body.scrollLeft: e.pageX;
Glob_Y = isIE ? event.clientY + document.body.scrollTop: e.pageY;
// mouseX= (bw.ns4||bw.ns6)? e.pageX: bw.ie&&bw.win&&!bw.ie4? (event.clientX-2)+document.body.scrollLeft : event.clientX+document.body.scrollLeft;
//mouseY= (bw.ns4||bw.ns6)? e.pageY: bw.ie&&bw.win&&!bw.ie4? (event.clientY-2)+document.body.scrollTop : event.clientY+document.body.scrollTop;
//window.status = "X = "+ Glob_X + " Y = "+ Glob_Y;
var mGx, mGy;
if (cur_click != null)
if (cur_click != null)
{
mGx = Glob_X - dx;
mGy = Glob_Y - dy;
mGx = mGx > 0 ? mGx : 0;
mGy = mGy > 0 ? mGy : 0;
if(ON_grid)
{
mGx = mGx % step < step / 2 ? mGx - mGx % step : mGx - mGx % step + step;
mGy = mGy % step < step / 2 ? mGy - mGy % step : mGy - mGy % step + step;
}
cur_click.style.left = mGx;
cur_click.style.top = mGy;
}
if (ON_relation || ON_display_field)
if (ON_relation || ON_display_field)
{
document.getElementById('hint').style.left = Glob_X + 20;
document.getElementById('hint').style.top = Glob_Y + 20;
}
if(layer_menu_cur_click)
{
{
document.getElementById("layer_menu").style.width = Glob_X - dx>=150?Glob_X - dx:150;
//document.getElementById("layer_menu").style.height = Glob_Y - dy>=200?Glob_Y - dy:200;
//document.getElementById("id_scroll_tab").style.height = Glob_Y - dy2;
@@ -121,15 +126,15 @@ function MouseMove(e)
function MouseUp(e)
{
if (cur_click != null)
{
if (cur_click != null)
{
document.getElementById("canvas").style.visibility = 'visible';
Re_load();
Re_load();
cur_click.style.zIndex = 1;
cur_click = null;
cur_click = null;
}
layer_menu_cur_click=0;
//window.releaseEvents(Event.MOUSEMOVE);
//window.releaseEvents(Event.MOUSEMOVE);
}
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
@@ -147,7 +152,7 @@ function Canvas_pos()
canvas_height = document.getElementById('canvas').height = osn_tab_height - 3;
if(isIE)
{
{
document.getElementById('canvas').style.width = (osn_tab_width - 3)?(osn_tab_width - 3):0;
document.getElementById('canvas').style.height = (osn_tab_height - 3)?(osn_tab_height - 3):0;
}
@@ -162,7 +167,7 @@ function Osn_tab_pos()
function Main()
{ //alert( document.getElementById('osn_tab').offsetTop);
//---CROSS
//---CROSS
if(isIE)
{
document.getElementById('top_menu').style.position = 'absolute';
@@ -172,13 +177,13 @@ function Main()
document.getElementById("layer_menu").style.top = -1000; //fast scroll
sm_x += document.getElementById('osn_tab').offsetLeft;
sm_y += document.getElementById('osn_tab').offsetTop;
Osn_tab_pos();
Canvas_pos();
Osn_tab_pos();
Canvas_pos();
Small_tab_refresh();
Re_load();
id_hint = document.getElementById('hint');
if (isIE) {
General_scroll();
General_scroll();
}
}
@@ -188,7 +193,7 @@ function Rezize_osn_tab()
{
var max_X = max_Y = 0;
for (key in j_tabs)
{
{
k_x = parseInt(document.getElementById(key).style.left) + document.getElementById(key).offsetWidth;
k_y = parseInt(document.getElementById(key).style.top) + document.getElementById(key).offsetHeight;
max_X = max_X < k_x ? k_x : max_X;
@@ -203,18 +208,18 @@ function Rezize_osn_tab()
//--------------------------------------------------------------------------------------
function Re_load()
function Re_load()
{
Rezize_osn_tab();
var n;
var a = new Array();
Clear();
for (K in contr)
for (K in contr)
for (key in contr[K]) // contr name
for (key2 in contr[K][key]) // table name
for (key3 in contr[K][key][key2]) // field name
{
if(!document.getElementById("check_vis_"+key2).checked ||
{
if(!document.getElementById("check_vis_"+key2).checked ||
!document.getElementById("check_vis_"+contr[K][key][key2][key3][0]).checked) continue; // if hide
var x1_left = document.getElementById(key2).offsetLeft+1;
var x1_right = x1_left + document.getElementById(key2).offsetWidth;
@@ -232,15 +237,15 @@ function Re_load()
// alert(key2+"."+key3);
var y1 = document.getElementById(key2).offsetTop + document.getElementById(key2+"."+key3).offsetTop + height_field;
// alert(1);
var y2 = document.getElementById(contr[K][key][key2][key3][0]).offsetTop +
var y2 = document.getElementById(contr[K][key][key2][key3][0]).offsetTop +
document.getElementById(contr[K][key][key2][key3][0]+"."+contr[K][key][key2][key3][1]).offsetTop + height_field;
Line0(x1-sm_x,y1-sm_y,x2-sm_x,y2-sm_y,"rgba(0,100,150,1)");
}
}
function Line(x1,y1,x2,y2,color_line)
{
function Line(x1,y1,x2,y2,color_line)
{
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.strokeStyle = color_line;
@@ -248,7 +253,7 @@ function Line(x1,y1,x2,y2,color_line)
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.stroke();
ctx.stroke();
}
function Line0(x1,y1,x2,y2,color_line)
@@ -259,33 +264,33 @@ function Line0(x1,y1,x2,y2,color_line)
Line3(x1,y1,x2,y2,color_line);
}
function Line2(x1,y1,x2,y2,color_line)
function Line2(x1,y1,x2,y2,color_line)
{
var x1_ = x1;
var x2_ = x2;
Circle(x1,y1,3,3,"rgba(0,0,255,1)");
Rect(x2-1,y2-2,4,4,"rgba(0,0,255,1)");
if(s_right)
if(s_right)
{
x1_ += sm_add; x2_ += sm_add;
}
else if(s_left)
else if(s_left)
{
x1_ -= sm_add; x2_ -= sm_add;
}
else
if(x1 < x2) { x1_ += sm_add; x2_ -= sm_add; }
else { x1_ -= sm_add; x2_ += sm_add; }
Line(x1,y1,x1_,y1,color_line);
Line(x2,y2,x2_,y2,color_line);
Line(x1_,y1,x2_,y2,color_line);
}
function Line3(x1,y1,x2,y2,color_line)
function Line3(x1,y1,x2,y2,color_line)
{
var x1_ = x1;
var x2_ = x2;
@@ -293,50 +298,50 @@ function Line3(x1,y1,x2,y2,color_line)
Rect(x2-1,y2-2,4,4,"rgba(0,0,255,1)");
var x_s = (x1+x2)/2;
if(s_right)
if(s_right)
{
if(x1 < x2) { x1_ += x2 - x1 + sm_add; x2_ += sm_add; }
else { x2_ += x1 - x2 + sm_add; x1_ += sm_add; }
Line(x1,y1,x1_,y1,color_line);
Line(x2,y2,x2_,y2,color_line);
Line(x1_,y1,x2_,y2,color_line);
return 0;
}
if(s_left)
if(s_left)
{
if(x1 < x2) { x2_ -= x2 - x1 + sm_add; x1_ -= sm_add; }
else { x1_ -= x1 - x2 + sm_add; x2_ -= sm_add; }
Line(x1,y1,x1_,y1,color_line);
Line(x2,y2,x2_,y2,color_line);
Line(x1_,y1,x2_,y2,color_line);
return 0;
}
Line(x1,y1,x_s,y1,color_line);
Line(x_s,y2,x2,y2,color_line);
Line(x_s,y1,x_s,y2,color_line);
}
function Circle(x,y,r,w,color)
{
var ctx = document.getElementById('canvas').getContext('2d');
ctx.beginPath();
function Circle(x,y,r,w,color)
{
var ctx = document.getElementById('canvas').getContext('2d');
ctx.beginPath();
ctx.moveTo(x, y);
ctx.lineWidth = w;
ctx.strokeStyle = color;
ctx.arc(x, y, r, 0, 2*Math.PI, true);
ctx.stroke();
}
ctx.arc(x, y, r, 0, 2*Math.PI, true);
ctx.stroke();
}
function Clear()
function Clear()
{
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas_width, canvas_height);
}
function Rect(x1,y1,w,h,color)
{
var ctx = document.getElementById('canvas').getContext('2d');
@@ -354,7 +359,7 @@ function Save(url) // (del?) no for pdf
document.getElementById('t_v['+key+']').value=document.getElementById('_|_tbody_'+key).style.display=='none'?0:1;
document.getElementById('t_h['+key+']').value=document.getElementById('check_vis_'+key).checked?1:0;
}
document.form1.action = url;
document.form1.action = url;
document.form1.submit();
}
@@ -383,14 +388,14 @@ function Grid()
if(!ON_grid ) {
ON_grid = 1;
document.getElementById('grid_button').className = 'M_butt_Selected_down';//'#FFEE99';gray #AAAAAA
if(isIE) { // correct for IE
document.getElementById('grid_button').className = 'M_butt_Selected_down_IE';
}
}
else {
document.getElementById('grid_button').className = 'M_butt';
ON_grid = 0;
ON_grid = 0;
}
}
@@ -399,13 +404,13 @@ function Angular_direct()
if(ON_angular_direct ) {
ON_angular_direct = 0;
document.getElementById('angular_direct_button').className = 'M_butt_Selected_down';//'#FFEE99';gray #AAAAAA
if(isIE) { // correct for IE
document.getElementById('angular_direct_button').className = 'M_butt_Selected_down_IE';
}
}
else {
ON_angular_direct = 1;
ON_angular_direct = 1;
document.getElementById('angular_direct_button').className = 'M_butt';
}
Re_load();
@@ -413,7 +418,7 @@ function Angular_direct()
//+++++++++++++++++++++++++++++++++++++++++++++++++++++ RELATION ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function Start_relation()
{
if(ON_display_field) return;
if(ON_display_field) return;
if(!ON_relation )
{
@@ -422,7 +427,7 @@ function Start_relation()
document.getElementById('hint').innerHTML = LangSelectReferencedKey;
document.getElementById('hint').style.visibility = "visible";
document.getElementById('rel_button').className = 'M_butt_Selected_down';//'#FFEE99';gray #AAAAAA
if(isIE) { // correct for IE
document.getElementById('rel_button').className = 'M_butt_Selected_down_IE';
}
@@ -432,8 +437,8 @@ function Start_relation()
document.getElementById('hint').innerHTML = "";
document.getElementById('hint').style.visibility = "hidden";
document.getElementById('rel_button').className = 'M_butt';
click_field = 0;
ON_relation = 0;
click_field = 0;
ON_relation = 0;
}
}
@@ -449,17 +454,17 @@ function Click_field(T,f,PK) // table field
link_relation = "T1=" + T + "&F1=" + f;
document.getElementById('hint').innerHTML = LangSelectForeignKey;
}
else
else
{
Start_relation(); // hidden hint...
if(j_tabs[db+'.'+T]!='INNODB' || !PK ) document.getElementById('InnoDB_relation').style.display='none';
document.getElementById('layer_new_relation').style.left = Glob_X - (document.getElementById('layer_new_relation').offsetWidth>>1);
document.getElementById('layer_new_relation').style.top = Glob_Y - document.getElementById('layer_new_relation').offsetHeight - 10;
document.getElementById('layer_new_relation').style.visibility = "visible";
link_relation += '&T2=' + T + '&F2=' + f;
link_relation += '&T2=' + T + '&F2=' + f;
}
}
if(ON_display_field)
{
if(display_field[T] == f) // if is display field
@@ -472,7 +477,7 @@ function Click_field(T,f,PK) // table field
//n = 0;for(k in display_field)n++;alert(n);
}
else
{
{
old_class = 'tab_field_3';
if(display_field[T])
{
@@ -496,7 +501,7 @@ function New_relation()
link_relation += '&db=' + db + '&token=' + token + '&die_save_pos=0';
link_relation += '&on_delete=' + document.getElementById('on_delete').value + '&on_update=' + document.getElementById('on_update').value;
link_relation += Get_url_pos();
//alert(link_relation);
makeRequest('pmd_relation_new.php', link_relation);
}
@@ -529,7 +534,7 @@ function Small_tab_all(id_this) // max/min all tables
id_this.src="pmd/images/rightarrow1.png";
}
else
{
{
for (key in j_tabs)
if(document.getElementById('_|_hide_tbody_'+key).innerHTML!="v")
Small_tab(key,0);
@@ -550,7 +555,7 @@ function Small_tab_invert() // invert max/min all tables
Re_load();
}
function Small_tab_refresh()
function Small_tab_refresh()
{
for (key in j_tabs)
if(document.getElementById('_|_hide_tbody_'+key).innerHTML!="v")
@@ -560,7 +565,7 @@ function Small_tab_refresh()
}
}
function Small_tab(t,re_load)
function Small_tab(t,re_load)
{
var id = document.getElementById('_|_tbody_'+t);
var id_this = document.getElementById('_|_hide_tbody_'+t);
@@ -574,7 +579,7 @@ function Small_tab(t,re_load)
id.style.display = 'none';
id_this.innerHTML = '>';
}
else
else
{
id.style.display = '';
id_this.innerHTML = 'v';
@@ -592,7 +597,7 @@ function Select_tab(t)
//----------
var id_t = document.getElementById(t);
window.scrollTo( parseInt(id_t.style.left)-300, parseInt(id_t.style.top)-300 );
setTimeout(function(){document.getElementById('_|_zag_'+t).className = 'tab_zag';},800);
}
//-----------------------------------------------------------------------------------------------------------------
@@ -607,8 +612,8 @@ function Canvas_click(id)
for (key in contr[K])
for (key2 in contr[K][key])
for (key3 in contr[K][key][key2])
{
if(!document.getElementById("check_vis_"+key2).checked ||
{
if(!document.getElementById("check_vis_"+key2).checked ||
!document.getElementById("check_vis_"+contr[K][key][key2][key3][0]).checked) continue; // if hide
var x1_left = document.getElementById(key2).offsetLeft + 1;//document.getElementById(key2+"."+key3).offsetLeft;
var x1_right = x1_left + document.getElementById(key2).offsetWidth;
@@ -623,20 +628,20 @@ function Canvas_click(id)
if(n==2){ x1 = x1_right+sm_s; x2 = x2_left-sm_s; if(x1>x2)n=0;}
if(n==3){ x1 = x1_right+sm_s; x2 = x2_right+sm_s; s_right = 1; }
if(n==0){ x1 = x1_left-sm_s; x2 = x2_left-sm_s; s_left = 1; }
var y1 = document.getElementById(key2).offsetTop + document.getElementById(key2+"."+key3).offsetTop + height_field;
var y2 = document.getElementById(contr[K][key][key2][key3][0]).offsetTop +
var y2 = document.getElementById(contr[K][key][key2][key3][0]).offsetTop +
document.getElementById(contr[K][key][key2][key3][0]+"."+contr[K][key][key2][key3][1]).offsetTop + height_field;
if( !selected && Glob_X > x1-10 && Glob_X < x1+10 && Glob_Y > y1-7 && Glob_Y < y1+7)
{
Line0(x1-sm_x,y1-sm_y,x2-sm_x,y2-sm_y,"rgba(255,0,0,1)");
selected = 1; // Rect(x1-sm_x,y1-sm_y,10,10,"rgba(0,255,0,1)");
relation_name = key; //
Key0=contr[K][key][key2][key3][0]; Key1=contr[K][key][key2][key3][1];
Line0(x1-sm_x,y1-sm_y,x2-sm_x,y2-sm_y,"rgba(255,0,0,1)");
selected = 1; // Rect(x1-sm_x,y1-sm_y,10,10,"rgba(0,255,0,1)");
relation_name = key; //
Key0=contr[K][key][key2][key3][0]; Key1=contr[K][key][key2][key3][1];
Key2 = key2; Key3 = key3;
Key = K;
}
else
}
else
Line0(x1-sm_x,y1-sm_y,x2-sm_x,y2-sm_y,"rgba(0,100,150,1)");
}
if( selected ) // select relations
@@ -668,11 +673,11 @@ function Hide_tab_all(id_this) // max/min all tables
if(id_this.alt == 'v') { id_this.alt='>';id_this.src="pmd/images/rightarrow1.png"; }
else { id_this.alt='v';id_this.src="pmd/images/downarrow1.png"; }
var E = document.form1;
for (i=0;i<E.elements.length;i++)
for (i=0;i<E.elements.length;i++)
if(E.elements[i].type=="checkbox" && E.elements[i].id.substring( 0 , 10) == 'check_vis_')
{
if(id_this.alt == 'v') { E.elements[i].checked = true; document.getElementById(E.elements[i].value).style.visibility = 'visible';}
else { E.elements[i].checked = false; document.getElementById(E.elements[i].value).style.visibility = 'hidden';}
if(id_this.alt == 'v') { E.elements[i].checked = true; document.getElementById(E.elements[i].value).style.visibility = 'visible';}
else { E.elements[i].checked = false; document.getElementById(E.elements[i].value).style.visibility = 'hidden';}
}
Re_load();
}
@@ -685,39 +690,39 @@ function in_array_k(x,m)
return b;
}
function No_have_constr(id_this)
function No_have_constr(id_this)
{
var a = new Array();
for (K in contr)
for (K in contr)
for (key in contr[K]) // contr name
for (key2 in contr[K][key]) // table name
for (key3 in contr[K][key][key2]) // field name
a[key2]=a[contr[K][key][key2][key3][0]]=1; // exist constr
if(id_this.alt == 'v') { id_this.alt='>';id_this.src="pmd/images/rightarrow2.png"; }
else { id_this.alt='v';id_this.src="pmd/images/downarrow2.png"; }
var E = document.form1;
for (i=0;i<E.elements.length;i++)
for (i=0;i<E.elements.length;i++)
if(E.elements[i].type=="checkbox" && E.elements[i].id.substring(0, 10) == 'check_vis_')
{
if(!in_array_k(E.elements[i].value,a))
if(id_this.alt == 'v')
{ E.elements[i].checked = true; document.getElementById(E.elements[i].value).style.visibility = 'visible';}
else { E.elements[i].checked = false; document.getElementById(E.elements[i].value).style.visibility = 'hidden';}
if(id_this.alt == 'v')
{ E.elements[i].checked = true; document.getElementById(E.elements[i].value).style.visibility = 'visible';}
else { E.elements[i].checked = false; document.getElementById(E.elements[i].value).style.visibility = 'hidden';}
}
}
function Help()
{
var WinHelp =
var WinHelp =
window.open("pmd_help.php","wind1", "top=200,left=400,width=300,height=200,resizable=yes,scrollbars=yes,menubar=no");
}
function PDF_save()
{
// var WinPDF =
// var WinPDF =
// window.open("pmd_pdf.php?token="+token+"&db="+db,"wind1", "top=200,left=200,width=200,height=100,resizable=yes,scrollbars=yes,menubar=no");
Save('pmd_pdf.php?token='+token+'&db='+db);
}
@@ -737,7 +742,7 @@ function General_scroll()
timeoutID = setTimeout
(
function()
{
{
document.getElementById('top_menu').style.left = document.body.scrollLeft;
document.getElementById('top_menu').style.top = document.body.scrollTop;
document.getElementById('layer_menu').style.left = document.body.scrollLeft;
@@ -745,11 +750,11 @@ function General_scroll()
}
,200
);
}
}
/*
function General_scroll_end()
{
{
// document.getElementById('layer_menu').style.left = document.body.scrollLeft;
// document.getElementById('layer_menu').style.top = document.body.scrollTop + document.getElementById('top_menu').offsetHeight;
//if(isIE)
@@ -772,7 +777,7 @@ function Show_left_menu(id_this) // max/min all tables
if(isIE) General_scroll();
}
else
{
{
document.getElementById("layer_menu").style.top = -1000; //fast scroll
document.getElementById("layer_menu").style.visibility = 'hidden';
id_this.alt = "v";
@@ -781,7 +786,7 @@ function Show_left_menu(id_this) // max/min all tables
}
//----------------------------------------------------------------------------------------
function Top_menu_right(id_this)
{
{
if(id_this.alt==">")
{
document.getElementById('top_menu').style.marginLeft = document.getElementById('top_menu').offsetWidth; // = 350
@@ -789,11 +794,11 @@ function Top_menu_right(id_this)
id_this.src="pmd/images/2leftarrow_m.png";
}
else
{
{
document.getElementById('top_menu').style.marginLeft = 0;
id_this.alt = ">";
id_this.src="pmd/images/2rightarrow_m.png";
}
}
}
//----------------------------------------------------------------------------------------
function Start_display_field()
@@ -815,6 +820,6 @@ function Start_display_field()
document.getElementById('hint').innerHTML = "";
document.getElementById('hint').style.visibility = "hidden";
document.getElementById('display_field_button').className = 'M_butt';
ON_display_field = 0;
ON_display_field = 0;
}
}