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