designer: support for MSIE 6 and various fixes

This commit is contained in:
Marc Delisle
2007-01-02 14:39:22 +00:00
parent 6ac319f159
commit af31d1e079
131 changed files with 737 additions and 507 deletions

View File

@@ -48,12 +48,13 @@ function alertContents()
}
if (http_request.readyState == 2 ) document.getElementById("layer_action").innerHTML = 'Loaded';
if (http_request.readyState == 3 ) document.getElementById("layer_action").innerHTML = 'Loading 99%';
if (http_request.readyState == 4)
if (http_request.readyState == 4 )
{
if (http_request.status == 200)
{
xmldoc = http_request.responseXML;
textdoc = http_request.responseText;
textdoc = http_request.responseText;
//alert(textdoc);
xmldoc = http_request.responseXML;
PrintXML();
document.getElementById("layer_action").style.visibility = 'hidden';
}
@@ -67,7 +68,7 @@ function alertContents()
function PrintXML()
{
var root = xmldoc.getElementsByTagName('root').item(0); //root
//alert(xmldoc.getElementsByTagName('root').item(1));
if(root==null) // if error
{
myWin=window.open('','Report','width=400, height=250, resizable=1, scrollbars=1, status=1');
@@ -79,27 +80,30 @@ function PrintXML()
{
//alert(xmldoc.getElementsByTagName('root')[0]);
//alert(root.attributes[0].nodeValue);
if(root.attributes['act'].nodeValue == 'save_pos')
alert(root.attributes['return'].nodeValue);
if(root.attributes['act'].nodeValue == 'relation_upd')
//alert(xmldoc.getElementsByTagName('root')[0].attributes[0].nodeValue);
//xmldoc.getElementsByTagName('root')[0].getAttribute("act")
if(root.getAttribute('act') == 'save_pos')
alert(strLang[root.getAttribute('return')]);
if(root.getAttribute('act') == 'relation_upd')
{
alert(root.attributes['return'].nodeValue);
if(root.attributes['b'].nodeValue=='1')
alert(strLang[root.getAttribute('return')]);
if(root.getAttribute('b')=='1')
{
contr.splice(root.attributes['K'].nodeValue, 1);
contr.splice(root.getAttribute('K'), 1);
Re_load();
}
}
if(root.attributes['act'].nodeValue == 'relation_new')
if(root.getAttribute('act') == 'relation_new')
{
alert(root.attributes['return'].nodeValue);
if(root.attributes['b'].nodeValue=='1')
alert(strLang[root.getAttribute('return')]);
if(root.getAttribute('b')=='1')
{
var i = contr.length;
var t1 = root.attributes['DB1'].nodeValue + '.' + root.attributes['T1'].nodeValue;
var f1 = root.attributes['F1'].nodeValue;
var t2 = root.attributes['DB2'].nodeValue + '.' + root.attributes['T2'].nodeValue;
var f2 = root.attributes['F2'].nodeValue;
var t1 = root.getAttribute('DB1') + '.' + root.getAttribute('T1');
var f1 = root.getAttribute('F1');
var t2 = root.getAttribute('DB2') + '.' + root.getAttribute('T2');
var f2 = root.getAttribute('F2');
contr[i] = new Array();
contr[i][''] = new Array();
contr[i][''][t2] = new Array();

141
pmd/scripts/iecanvas.js Normal file
View File

@@ -0,0 +1,141 @@
if (!window.all) // if IE
{
document.attachEvent("onreadystatechange", // document load
function ()
{
if (document.readyState == "complete")
{
var el = document.getElementById("canvas");
var outerHTML = el.outerHTML;
var newEl = document.createElement(outerHTML);
el.parentNode.replaceChild(newEl, el);
el = newEl;
el.getContext = function () {
if (this.cont) return this.cont;
return this.cont = new PMD_2D(this);
};
el.style.width = el.attributes.width.nodeValue + "px";
el.style.height = el.attributes.height.nodeValue + "px";
}
}
);
//*****************************************************************************************************
function convert_style(str) {
var m = Array();
m = str.match(/.*\((\d*),(\d*),(\d*),(\d*)\)/);
for(var i = 1; i<=3; i++ )
m[i] = (m[i]*1).toString(16).length < 2 ? '0' + (m[i]*1).toString(16) : (m[i]*1).toString(16);
return ['#' + m[1] + m[2] + m[3], 1];
}
//------------------------------------------------------------------------------
function PMD_2D(th) {
this.element_ = th;
this.pmd_arr = Array();
this.strokeStyle;
this.fillStyle;
this.lineWidth;
this.closePath = function() {
this.pmd_arr.push({type: "close"});
}
this.clearRect = function() {
this.element_.innerHTML = "";
this.pmd_arr = [];
}
this.beginPath = function() {
this.pmd_arr = [];
}
this.moveTo = function(aX, aY) {
this.pmd_arr.push({type: "moveTo", x: aX, y: aY});
}
this.lineTo = function(aX, aY) {
this.pmd_arr.push({type: "lineTo", x: aX, y: aY});
}
this.arc = function(aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise) {
if (!aClockwise) {
var t = aStartAngle;
aStartAngle = aEndAngle;
aEndAngle = t;
}
var xStart = aX + (Math.cos(aStartAngle) * aRadius);
var yStart = aY + (Math.sin(aStartAngle) * aRadius);
var xEnd = aX + (Math.cos(aEndAngle) * aRadius);
var yEnd = aY + (Math.sin(aEndAngle) * aRadius);
this.pmd_arr.push({type: "arc", x: aX, y: aY,
radius: aRadius, xStart: xStart, yStart: yStart, xEnd: xEnd, yEnd: yEnd});
}
this.rect = function(aX, aY, aW, aH) {
this.moveTo(aX, aY);
this.lineTo(aX + aW, aY);
this.lineTo(aX + aW, aY + aH);
this.lineTo(aX, aY + aH);
this.closePath();
}
this.fillRect = function(aX, aY, aW, aH) {
this.beginPath();
this.moveTo(aX, aY);
this.lineTo(aX + aW, aY);
this.lineTo(aX + aW, aY + aH);
this.lineTo(aX, aY + aH);
this.closePath();
this.stroke(true);
}
this.stroke = function(aFill) {
var Str = Array();
var a = convert_style(aFill ? this.fillStyle : this.strokeStyle);
var color = a[0];
Str.push('<v:shape',
' fillcolor="', color, '"',
' filled="', Boolean(aFill), '"',
' style="position:absolute;width:10;height:10;"',
' coordorigin="0 0" coordsize="10 10"',
' stroked="', !aFill, '"',
' strokeweight="', this.lineWidth, '"',
' strokecolor="', color, '"',
' path="');
for (var i = 0; i < this.pmd_arr.length; i++) {
var p = this.pmd_arr[i];
if (p.type == "moveTo") {
Str.push(" m ");
Str.push(Math.floor(p.x), ",",Math.floor(p.y));
} else if (p.type == "lineTo") {
Str.push(" l ");
Str.push(Math.floor(p.x), ",",Math.floor(p.y));
} else if (p.type == "close") {
Str.push(" x ");
} else if (p.type == "arc") {
Str.push(" ar ");
Str.push(Math.floor(p.x - p.radius), ",",
Math.floor(p.y - p.radius), " ",
Math.floor(p.x + p.radius), ",",
Math.floor(p.y + p.radius), " ",
Math.floor(p.xStart), ",", Math.floor(p.yStart), " ",
Math.floor(p.xEnd), ",", Math.floor(p.yEnd));
}
}
Str.push(' ">');
Str.push("</v:shape>");
this.element_.insertAdjacentHTML("beforeEnd", Str.join(""));
this.pmd_arr = Array();
}
};
}

View File

@@ -23,80 +23,77 @@ var Glob_X, Glob_Y;
var relation_style = 0;
var timeoutID;
var layer_menu_cur_click = 0;
window.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
window.onmousedown = MouseDown;
window.onmouseup = MouseUp;
window.onmousemove = MouseMove;
window.onscroll = function(){General_scroll();}
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
//window.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP);
//---CROSS
document.onmousedown = MouseDown;
document.onmouseup = MouseUp;
document.onmousemove = MouseMove;
isIE = document.all && !window.opera;
isNN = !document.all && document.getElementById;
isN4 = document.layers;
if(isIE) window.onscroll = General_scroll;
//document.onmouseup = function(){General_scroll_end();}
function ToInt(s)
{
return s.substring(0,s.length-2)*1; //re = /(\d+)\w*/; newstr = str.replace(re, "$1");
}
function Canvas_pos()
{
canvas_width = document.getElementById('canvas').width = osn_tab_width - 3;
canvas_height = document.getElementById('canvas').height = osn_tab_height - 3;
}
function Osn_tab_pos()
{
osn_tab_width = ToInt(document.getElementById('osn_tab').style.width);
osn_tab_height = ToInt(document.getElementById('osn_tab').style.height);
}
function Main()
{ //alert( document.getElementById('osn_tab').offsetTop);
document.getElementById("layer_menu").style.top = -1000;
sm_x += document.getElementById('osn_tab').offsetLeft;
sm_y += document.getElementById('osn_tab').offsetTop;
Osn_tab_pos();
Canvas_pos();
Small_tab_refresh();
Re_load();
id_hint = document.getElementById('hint');
General_scroll();
}
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);
dy = offsety - parseInt(cur_click.style.top);
//alert(" dx = " + dx + " dy = " +dy);
document.getElementById("canvas").style.visibility = 'hidden';
var left = ToInt(cur_click.style.left);
var top = ToInt(cur_click.style.top);
/*
var left = parseInt(cur_click.style.left);
var top = parseInt(cur_click.style.top);
dx = e.pageX - left;
dy = e.pageY - top;
cur_click.style.zIndex = 2;
alert(" dx = " + dx + " dy = " +dy);*/
cur_click.style.zIndex = 2;
}
if(layer_menu_cur_click)
{
dx = e.pageX - ToInt(document.getElementById("layer_menu").style.width);
//dy = e.pageY - ToInt(document.getElementById("layer_menu").style.height);
//dy2 = e.pageY - ToInt(document.getElementById("id_scroll_tab").style.height);
offsetx=isIE ? event.clientX + document.body.scrollLeft: e.pageX;
dx = offsetx - parseInt(document.getElementById("layer_menu").style.width);
}
}
function MouseMove(e)
{
Glob_X = e.pageX;
Glob_Y = e.pageY;
//Glob_X = e.pageX;
//Glob_Y = e.pageY;
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;
if (cur_click != null)
{
if((e.pageX - dx)>0)
cur_click.style.left = e.pageX - dx;
if((e.pageY - dy)>0)
cur_click.style.top = e.pageY - dy;
if((Glob_X - dx)>0)
cur_click.style.left = Glob_X - dx;
if((Glob_Y - dy)>0)
cur_click.style.top = Glob_Y - dy;
}
if (ON_relation)
{
document.getElementById('hint').style.left = e.pageX + 20;
document.getElementById('hint').style.top = e.pageY + 20;
document.getElementById('hint').style.left = Glob_X + 20;
document.getElementById('hint').style.top = Glob_Y + 20;
}
if(layer_menu_cur_click)
@@ -104,7 +101,6 @@ function MouseMove(e)
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;
}
}
@@ -118,7 +114,55 @@ function MouseUp(e)
cur_click = null;
}
layer_menu_cur_click=0;
window.releaseEvents(Event.MOUSEMOVE);
//window.releaseEvents(Event.MOUSEMOVE);
}
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------------------------------
//function ToInt(s)
//{
// return s.substring(0,s.length-2)*1; //re = /(\d+)\w*/; newstr = str.replace(re, "$1");
//}
function Canvas_pos()
{
canvas_width = document.getElementById('canvas').width = osn_tab_width - 3;
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;
}
}
function Osn_tab_pos()
{
osn_tab_width = parseInt(document.getElementById('osn_tab').style.width);
osn_tab_height = parseInt(document.getElementById('osn_tab').style.height);
}
function Main()
{ //alert( document.getElementById('osn_tab').offsetTop);
//---CROSS
if(isIE)
{
document.getElementById('top_menu').style.position = 'absolute';
document.getElementById('layer_menu').style.position = 'absolute';
}
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();
Small_tab_refresh();
Re_load();
id_hint = document.getElementById('hint');
General_scroll();
}
@@ -128,8 +172,8 @@ function Rezize_osn_tab()
var max_X = max_Y = 0;
for (key in j_tabs)
{
k_x = ToInt(document.getElementById(key).style.left) + document.getElementById(key).offsetWidth;
k_y = ToInt(document.getElementById(key).style.top) + document.getElementById(key).offsetHeight;
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;
max_Y = max_Y < k_y ? k_y : max_Y;
}
@@ -168,16 +212,18 @@ function Re_load()
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; }
// 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 +
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)
{
{
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.strokeStyle = color_line;
@@ -285,8 +331,8 @@ function Save(url) // (del?) no for pdf
{
for (key in j_tabs)
{
document.getElementById('t_x['+key+']').value=ToInt(document.getElementById(key).style.left);
document.getElementById('t_y['+key+']').value=ToInt(document.getElementById(key).style.top);
document.getElementById('t_x['+key+']').value=parseInt(document.getElementById(key).style.left);
document.getElementById('t_y['+key+']').value=parseInt(document.getElementById(key).style.top);
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;
}
@@ -299,8 +345,8 @@ function Get_url_pos()
var poststr = '';
for (key in j_tabs)
{
poststr += '&t_x['+key+']=' + ToInt(document.getElementById(key).style.left);
poststr += '&t_y['+key+']=' + ToInt(document.getElementById(key).style.top);
poststr += '&t_x['+key+']=' + parseInt(document.getElementById(key).style.left);
poststr += '&t_y['+key+']=' + parseInt(document.getElementById(key).style.top);
poststr += '&t_v['+key+']=' + (document.getElementById('_|_tbody_'+key).style.display == 'none' ? 0 : 1);
poststr += '&t_h['+key+']=' + (document.getElementById('check_vis_'+key).checked ? 1 : 0);
}
@@ -323,12 +369,16 @@ 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';
}
}
else
{
document.getElementById('hint').innerHTML = "";
document.getElementById('hint').style.visibility = "hidden";
document.getElementById('rel_button').className = 'M_butt_Selected';
document.getElementById('rel_button').className = 'M_butt';
click_field = 0;
ON_relation = 0;
}
@@ -364,6 +414,8 @@ 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);
}
@@ -382,6 +434,10 @@ function Start_tab_upd(table)
function Small_tab_all(id_this) // max/min all tables
{
if(isIE) {
alert(LangIEnotSupport);
return;
}
if(id_this.alt=="v")
{
for (key in j_tabs)
@@ -403,6 +459,10 @@ function Small_tab_all(id_this) // max/min all tables
function Small_tab_invert() // invert max/min all tables
{
if(isIE) {
alert(LangIEnotSupport);
return;
}
for (key in j_tabs)
Small_tab(key,0);
Re_load();
@@ -427,6 +487,8 @@ function Small_tab(t,re_load)
id_t.style.width = id_t.offsetWidth;
if(id_this.innerHTML=="v")
{
//---CROSS
if(isIE) return; //IE not supported
id.style.display = 'none';
id_this.innerHTML = '>';
}
@@ -442,9 +504,14 @@ function Select_tab(t)
{
var id_zag = document.getElementById('_|_zag_'+t);
if(id_zag.className != 'tab_zag_3')
document.getElementById('_|_zag_'+t).className = 'tab_zag_3';
document.getElementById('_|_zag_'+t).className = 'tab_zag_2';
else
document.getElementById('_|_zag_'+t).className = 'tab_zag';
//----------
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);
}
//-----------------------------------------------------------------------------------------------------------------
@@ -576,20 +643,41 @@ function PDF_save()
function General_scroll()
{
/*
if(!document.getElementById('show_relation_olways').checked)
{
document.getElementById("canvas").style.visibility = 'hidden';
clearTimeout(timeoutID);
timeoutID = setTimeout(General_scroll_end,500);
}
}*/
//if(timeoutID)
clearTimeout(timeoutID);
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;
document.getElementById('layer_menu').style.top = document.body.scrollTop + document.getElementById('top_menu').offsetHeight;
}
,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;
// 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)
//{
// document.getElementById('layer_menu').style.left = document.body.scrollLeft;
// document.getElementById('layer_menu').style.top = document.body.scrollTop + document.getElementById('top_menu').offsetHeight;
//}
document.getElementById("canvas").style.visibility = 'visible';
}
*/
function Show_left_menu(id_this) // max/min all tables
{
@@ -599,10 +687,11 @@ function Show_left_menu(id_this) // max/min all tables
document.getElementById("layer_menu").style.visibility = 'visible';
id_this.alt = ">";
id_this.src="pmd/images/uparrow2_m.png";
if(isIE) General_scroll();
}
else
{
document.getElementById("layer_menu").style.top = -1000;
document.getElementById("layer_menu").style.top = -1000; //fast scroll
document.getElementById("layer_menu").style.visibility = 'hidden';
id_this.alt = "v";
id_this.src="pmd/images/downarrow2_m.png";