1 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * @package phpMyAdmin-Designer
10 var http_request
= false;
17 function makeRequest(url
, parameters
)
20 if (window
.XMLHttpRequest
) {
21 // Mozilla, Safari,...
22 http_request
= new XMLHttpRequest();
23 if (http_request
.overrideMimeType
) {
24 http_request
.overrideMimeType('text/xml');
26 } else if (window
.ActiveXObject
) {
28 try { http_request
= new ActiveXObject("Msxml2.XMLHTTP"); }
30 try { http_request
= new ActiveXObject("Microsoft.XMLHTTP"); }
36 alert('Giving up :( Cannot create an XMLHTTP instance');
40 http_request
.onreadystatechange
= alertContents
;
41 http_request
.open('POST', url
, true);
42 http_request
.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
43 http_request
.setRequestHeader("Content-length", parameters
.length
);
44 http_request
.setRequestHeader("Connection", "close");
45 http_request
.send(parameters
);
52 function alertContents()
54 if (http_request
.readyState
== 1) {
55 document
.getElementById("layer_action").style
.left
= (document
.body
.clientWidth
+ document
.body
.scrollLeft
- 85) + 'px';
56 document
.getElementById("layer_action").style
.top
= (document
.body
.scrollTop
+ 10) + 'px';
57 document
.getElementById("layer_action").style
.visibility
= 'visible'; document
.getElementById("layer_action").innerHTML
= 'Loading...';
59 if (http_request
.readyState
== 2) {
60 document
.getElementById("layer_action").innerHTML
= 'Loaded';
62 if (http_request
.readyState
== 3) {
63 document
.getElementById("layer_action").innerHTML
= 'Loading 99%';
65 if (http_request
.readyState
== 4) {
66 if (http_request
.status
== 200) {
67 textdoc
= http_request
.responseText
;
69 xmldoc
= http_request
.responseXML
;
71 //document.getElementById("layer_action").style.visibility = 'hidden';
73 alert('There was a problem with the request.');
78 function layer_alert(text
)
80 document
.getElementById("layer_action").innerHTML
= text
;
81 document
.getElementById("layer_action").style
.left
= (document
.body
.clientWidth
+ document
.body
.scrollLeft
- 20 - document
.getElementById("layer_action").offsetWidth
) + 'px';
82 document
.getElementById("layer_action").style
.visibility
= 'visible';
83 setTimeout(function(){document
.getElementById("layer_action").style
.visibility
= 'hidden';}, 2000);
91 var root
= xmldoc
.getElementsByTagName('root').item(0); //root
92 //alert(xmldoc.getElementsByTagName('root').item(1));
95 myWin
=window
.open('','Report','width=400, height=250, resizable=1, scrollbars=1, status=1');
96 var tmp
= myWin
.document
;
100 //alert(xmldoc.getElementsByTagName('root')[0]);
101 //alert(root.attributes[0].nodeValue);
102 //alert(xmldoc.getElementsByTagName('root')[0].attributes[0].nodeValue);
103 //xmldoc.getElementsByTagName('root')[0].getAttribute("act")
105 if (root
.getAttribute('act') == 'save_pos') {
106 layer_alert(root
.getAttribute('return'));
108 if (root
.getAttribute('act') == 'relation_upd') {
109 layer_alert(root
.getAttribute('return'));
110 if (root
.getAttribute('b') == '1') {
111 contr
.splice(root
.getAttribute('K'), 1);
115 if (root
.getAttribute('act') == 'relation_new') {
116 layer_alert(root
.getAttribute('return'));
117 if (root
.getAttribute('b') == '1') {
118 var i
= contr
.length
;
119 var t1
= root
.getAttribute('DB1') + '.' + root
.getAttribute('T1');
120 var f1
= root
.getAttribute('F1');
121 var t2
= root
.getAttribute('DB2') + '.' + root
.getAttribute('T2');
122 var f2
= root
.getAttribute('F2');
123 contr
[i
] = new Array();
124 contr
[i
][''] = new Array();
125 contr
[i
][''][t2
] = new Array();
126 contr
[i
][''][t2
][f2
] = new Array();
127 contr
[i
][''][t2
][f2
][0] = t1
;
128 contr
[i
][''][t2
][f2
][1] = f1
;