source formating;

some uninitialized vars;
This commit is contained in:
Sebastian Mendel
2007-03-27 15:41:28 +00:00
parent 6d8aefd4d2
commit e67b47daa1
2 changed files with 764 additions and 692 deletions

View File

@@ -12,28 +12,28 @@ var http_request = false;
var xmldoc; var xmldoc;
var textdoc; var textdoc;
/**
*
*/
function makeRequest(url, parameters) function makeRequest(url, parameters)
{ {
http_request = false; http_request = false;
if (window.XMLHttpRequest) if (window.XMLHttpRequest) {
{ // Mozilla, Safari,... // Mozilla, Safari,...
http_request = new XMLHttpRequest(); http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) { http_request.overrideMimeType('text/xml'); } if (http_request.overrideMimeType) {
http_request.overrideMimeType('text/xml');
} }
else } else if (window.ActiveXObject) {
if (window.ActiveXObject) // IE
{ // IE
try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); } try { http_request = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) catch (e) {
{
try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); } try { http_request = new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e) {} catch (e) {}
} }
} }
if (!http_request) if (!http_request) {
{
alert('Giving up :( Cannot create an XMLHTTP instance'); alert('Giving up :( Cannot create an XMLHTTP instance');
return false; return false;
} }
@@ -44,69 +44,70 @@ function makeRequest(url, parameters)
http_request.setRequestHeader("Content-length", parameters.length); http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close"); http_request.setRequestHeader("Connection", "close");
http_request.send(parameters); http_request.send(parameters);
return true;
} }
/**
*
*/
function alertContents() function alertContents()
{ {
if (http_request.readyState == 1 ) if (http_request.readyState == 1) {
{
document.getElementById("layer_action").style.left = document.body.clientWidth + document.body.scrollLeft - 85; document.getElementById("layer_action").style.left = document.body.clientWidth + document.body.scrollLeft - 85;
document.getElementById("layer_action").style.top = document.body.scrollTop + 10; document.getElementById("layer_action").style.top = document.body.scrollTop + 10;
document.getElementById("layer_action").style.visibility = 'visible'; document.getElementById("layer_action").innerHTML = 'Loading...'; document.getElementById("layer_action").style.visibility = 'visible'; document.getElementById("layer_action").innerHTML = 'Loading...';
} }
if (http_request.readyState == 2 ) document.getElementById("layer_action").innerHTML = 'Loaded'; if (http_request.readyState == 2) {
if (http_request.readyState == 3 ) document.getElementById("layer_action").innerHTML = 'Loading 99%'; document.getElementById("layer_action").innerHTML = 'Loaded';
if (http_request.readyState == 4 ) }
{ if (http_request.readyState == 3) {
if (http_request.status == 200) document.getElementById("layer_action").innerHTML = 'Loading 99%';
{ }
if (http_request.readyState == 4) {
if (http_request.status == 200) {
textdoc = http_request.responseText; textdoc = http_request.responseText;
//alert(textdoc); //alert(textdoc);
xmldoc = http_request.responseXML; xmldoc = http_request.responseXML;
PrintXML(); PrintXML();
document.getElementById("layer_action").style.visibility = 'hidden'; document.getElementById("layer_action").style.visibility = 'hidden';
} } else {
else
{
alert('There was a problem with the request.'); alert('There was a problem with the request.');
} }
} }
} }
/**
*
*/
function PrintXML() function PrintXML()
{ {
var root = xmldoc.getElementsByTagName('root').item(0); //root var root = xmldoc.getElementsByTagName('root').item(0); //root
//alert(xmldoc.getElementsByTagName('root').item(1)); //alert(xmldoc.getElementsByTagName('root').item(1));
if(root==null) // if error if (root == null) {
{ // if error
myWin=window.open('','Report','width=400, height=250, resizable=1, scrollbars=1, status=1'); myWin=window.open('','Report','width=400, height=250, resizable=1, scrollbars=1, status=1');
var tmp = myWin.document; var tmp = myWin.document;
tmp.write(textdoc); tmp.write(textdoc);
tmp.close(); tmp.close();
} } else {
else
{
//alert(xmldoc.getElementsByTagName('root')[0]); //alert(xmldoc.getElementsByTagName('root')[0]);
//alert(root.attributes[0].nodeValue); //alert(root.attributes[0].nodeValue);
//alert(xmldoc.getElementsByTagName('root')[0].attributes[0].nodeValue); //alert(xmldoc.getElementsByTagName('root')[0].attributes[0].nodeValue);
//xmldoc.getElementsByTagName('root')[0].getAttribute("act") //xmldoc.getElementsByTagName('root')[0].getAttribute("act")
if(root.getAttribute('act') == 'save_pos') if (root.getAttribute('act') == 'save_pos') {
alert(strLang[root.getAttribute('return')]); alert(strLang[root.getAttribute('return')]);
if(root.getAttribute('act') == 'relation_upd') }
{ if (root.getAttribute('act') == 'relation_upd') {
alert(strLang[root.getAttribute('return')]); alert(strLang[root.getAttribute('return')]);
if(root.getAttribute('b')=='1') if (root.getAttribute('b') == '1') {
{
contr.splice(root.getAttribute('K'), 1); contr.splice(root.getAttribute('K'), 1);
Re_load(); Re_load();
} }
} }
if(root.getAttribute('act') == 'relation_new') if (root.getAttribute('act') == 'relation_new') {
{
alert(strLang[root.getAttribute('return')]); alert(strLang[root.getAttribute('return')]);
if(root.getAttribute('b')=='1') if (root.getAttribute('b') == '1') {
{
var i = contr.length; var i = contr.length;
var t1 = root.getAttribute('DB1') + '.' + root.getAttribute('T1'); var t1 = root.getAttribute('DB1') + '.' + root.getAttribute('T1');
var f1 = root.getAttribute('F1'); var f1 = root.getAttribute('F1');
@@ -123,7 +124,3 @@ function PrintXML()
} }
} }
} }

File diff suppressed because it is too large Load Diff