2
2
/*--------------------------------------------------------------------------------
4
4
----------------------------------------------------------------------------------*/
6
5
var AJAXQueue = new Array;
7
6
var AJAXServiceRunning=false;
8
7
var AJAXReturnfunction;
10
8
var httpAjax = false;
12
9
function getSVG(fileName){
13
10
paramstr="svgname="+escape(fileName);
14
11
AjaxService("SVG_TO_CANVAS_III.php",paramstr,"returnedSVG");
17
14
/*--------------------------------------------------------------------------------
23
20
Each service uses a different url and a different parameter layout.
25
22
----------------------------------------------------------------------------------*/
27
function AjaxService(servicename,serviceparam,returnfunction){
29
AJAXQueue.push(servicename);
30
AJAXQueue.push(serviceparam);
31
AJAXQueue.push(returnfunction);
33
if(!AJAXServiceRunning){
34
AJAXServiceRunning=true;
35
AJAXReturnfunction=AJAXQueue.pop();
36
var Aparam=AJAXQueue.pop();
37
var Aservice=AJAXQueue.pop();
38
AjaxServiceExec(Aservice,Aparam);
23
function AjaxService(servicename,serviceparam,returnfunction) {
24
AJAXQueue.push(servicename);
25
AJAXQueue.push(serviceparam);
26
AJAXQueue.push(returnfunction);
27
if( !AJAXServiceRunning ) {
28
AJAXServiceRunning = true;
29
AJAXReturnfunction = AJAXQueue.pop();
30
var Aparam = AJAXQueue.pop();
31
var Aservice = AJAXQueue.pop();
32
AjaxServiceExec( Aservice, Aparam );
42
36
/*--------------------------------------------------------------------------------
48
42
Each service uses a different url and a different parameter layout.
50
44
----------------------------------------------------------------------------------*/
52
function AjaxServiceExec(servicename,serviceparam){
54
// Parameters are set, initiate AJAX engine
55
if (window.XMLHttpRequest) {
56
httpAjax = new XMLHttpRequest();
57
if (httpAjax.overrideMimeType) {
58
httpAjax.overrideMimeType('text/xml');
60
}else if(window.ActiveXObject){
45
function AjaxServiceExec( servicename, serviceparam ) {
46
// Parameters are set, initiate AJAX engine
47
if( window.XMLHttpRequest ) {
48
httpAjax = new XMLHttpRequest();
49
if( httpAjax.overrideMimeType ) {
50
httpAjax.overrideMimeType( 'text/xml' );
52
} else if ( window.ActiveXObject ) {
62
httpAjax = new ActiveXObject("Msxml2.XMLHTTP");
65
httpAjax = new ActiveXObject("Microsoft.XMLHTTP");
67
alert("Couldn�t build an AJAX instance.");
73
// Send request to Server and initiate callback.
76
httpAjax.onreadystatechange = getPage;
78
alert("onreadystatechange didn�t go well!");
81
httpAjax.open('POST', servicename, true);
82
httpAjax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;");
84
alert("Couldn�t open url.");
87
httpAjax.send(serviceparam);
89
alert("Couldn�t send request.");
54
httpAjax = new ActiveXObject( "Msxml2.XMLHTTP" );
57
httpAjax = new ActiveXObject( "Microsoft.XMLHTTP" );
59
alert( "Couldn�t build an AJAX instance." );
64
// Send request to Server and initiate callback.
66
httpAjax.onreadystatechange = getPage;
69
alert( "onreadystatechange didn�t go well!" );
73
httpAjax.open( 'POST', servicename, true );
74
httpAjax.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded;" );
77
alert( "Couldn�t open url." );
81
httpAjax.send( serviceparam );
84
alert( "Couldn�t send request." );
97
90
/*--------------------------------------------------------------------------------
103
96
----------------------------------------------------------------------------------*/
107
99
if(httpAjax.readyState == 4){
109
str=httpAjax.responseText;
110
eval(AJAXReturnfunction+'(str);');
112
if(AJAXQueue.length>0){
113
AJAXReturnfunction=AJAXQueue.pop();
114
var Aparam=AJAXQueue.pop();
115
var Aservice=AJAXQueue.pop();
116
AjaxServiceExec(Aservice,Aparam);
118
AJAXServiceRunning=false;
100
tr = httpAjax.responseText;
101
eval( AJAXReturnfunction + '(str);' );
102
if( AJAXQueue.length > 0 ) {
103
AJAXReturnfunction = AJAXQueue.pop();
104
var Aparam = AJAXQueue.pop();
105
var Aservice = AJAXQueue.pop();
106
AjaxServiceExec( Aservice, Aparam );
108
AJAXServiceRunning = false;
123
112
// If any other ready state than prepared, do nothing!
117
function returnedSVG( htmltext ) {
118
var conto = document.getElementById( 'content' );
119
conto.innerHTML = htmltext;
120
str = 'var acanvas=document.getElementById("previewCanvas");acanvas.width=700;var c=acanvas.getContext("2d");' + htmltext;