Changeset 2618 for trunk/phpgwapi/js/expressoAjax/expressoAjax.js
- Timestamp:
- 04/22/10 16:37:22 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpgwapi/js/expressoAjax/expressoAjax.js
r2537 r2618 288 288 }; 289 289 290 //Create XMLHTTP object Method291 cConnector.prototype.createXMLHTTP = function ()292 {293 try294 {295 this.oxmlhttp = new XMLHttpRequest();296 this.oxmlhttp.overrideMimeType('text/xml');297 }298 catch (e)299 {300 try301 {302 this.oxmlhttp = new ActiveXObject('Msxml2.XMLHTTP');303 }304 catch (e1)305 {306 try307 {308 this.oxmlhttp = new ActiveXObject('Microsoft.XMLHTTP');309 }310 catch (e2)311 {312 this.oxmlhttp = null;313 };314 };315 };316 317 };318 319 290 // Request Constructor Connector 320 291 cConnector.prototype.newRequest = function (id, target, method, handler, data) 321 292 { 322 this.tid = id; 323 if (this.requests[id]) { 324 return false; 325 } 326 327 this.createXMLHTTP(); 328 var oxmlhttp = this.oxmlhttp; 329 var _thisObject = this; 330 331 if (! oxmlhttp) 332 return false; 333 334 this.requests[id] = oxmlhttp; 335 this.buildBar(); 336 this.showProgressBar(); 337 338 var sub_handler = function () 339 { 340 try 293 _connector.go( { 294 "access" : target, 295 "handler" : function( data ) 341 296 { 342 if (oxmlhttp.readyState == 4 ) 343 { 344 345 switch (oxmlhttp.status) 346 { 347 348 case 200: 349 if (typeof(handler) == 'function') 350 { 351 _thisObject.hideProgressBar(); 352 var data = _thisObject.unserialize(oxmlhttp.responseText); 353 if ( typeof data == 'undefined' ) 354 data = oxmlhttp.responseText; 355 // Verify user session 356 if(!_thisObject.verify_session(data)){ 357 delete _thisObject.requests[id]; 358 _thisObject.requests[id] = null; 359 return false; 360 } 361 if(debug_controller) { 362 document.getElementById("debug_controller").innerHTML += oxmlhttp.responseText; 363 document.getElementById("debug_controller").innerHTML += "<br>-------------------------------------------------------------------------------------<br>"; 364 } 365 handler(data); 366 _thisObject.addToCache(data?id+"&"+data:id,data); 367 delete _thisObject.requests[id]; 368 _thisObject.requests[id] = null; 369 } 370 371 break; 372 373 case 404: 374 375 alert(get_lang('Page Not Found!')); 376 break; 377 378 default: 379 }; 380 } 297 handler( expresso.connector.unserialize( data ) ); 381 298 } 382 catch (e) 383 { 384 _thisObject.hideProgressBar(); 385 if(debug_controller) 386 alert(e+"\n"+oxmlhttp.responseText); 387 // View Exception in Javascript Console 388 throw(e); 389 }; 390 391 }; 392 393 try 394 { 395 396 if (method == '' || method == 'GET') 397 { 398 oxmlhttp.open("GET",target,true); 399 if (typeof(handler) == 'function') 400 { 401 oxmlhttp.onreadystatechange = sub_handler; 402 oxmlhttp.send(null); 403 } 404 405 } 406 else if (method == 'POST') 407 { 408 oxmlhttp.open("POST",target, true); 409 oxmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); 410 if (typeof(handler) == 'function') 411 { 412 oxmlhttp.onreadystatechange = sub_handler; 413 oxmlhttp.send(data); 414 } 415 416 } 417 } 418 catch(e) 419 { 420 _thisObject.hideProgressBar(); 421 if(debug_controller) 422 alert(e); 423 // View Exception in Javascript Console 424 throw(e); 425 }; 426 427 return true; 299 } ); 428 300 }; 429 301 // Cancel Request Connector 430 302 cConnector.prototype.cancelRequest = function (){ 431 if (!this.requests[this.tid]){ 432 return false; 433 } 434 this.oxmlhttp.onreadystatechange = null; 435 this.requests[this.tid].abort(); 436 this.hideProgressBar(); 303 return false; 437 304 }; 438 305 //------------------------------------ END: Functions for Connector HTTPRequest -------------------------------------------------// … … 486 353 //------------------------------------ END: Functions for Progress Bar -------------------------------------------------// 487 354 // Default Controller File 488 var URL_DEFAULT = URL_SERVER +'/controller.php?action=';355 var URL_DEFAULT = URL_SERVER + "/controller.php?menuaction="; 489 356 // connector object 490 357 var _onmouseup = document.onmouseup; … … 561 428 return; 562 429 } 563 url = URL_DEFAULT + url;430 //url = URL_DEFAULT + url; 564 431 565 432 if (expresso.connector.queryConnectorCache(params?url+"&"+params:url,handler)) … … 623 490 }; 624 491 divUpload.innerHTML= "<iframe onload=\"cExecute('expressoMail1_2.functions.getReturnExecuteForm',"+form_handler+");\" style='display:"+(debug_controller ? "" : "none")+";width:"+(debug_controller ? 400 : 0)+";height:"+(debug_controller ? 400 : 0)+";' name='uploadFile'></iframe>"; 625 form.action = URL_ SERVER + "/controller.php";492 form.action = URL_DEFAULT + url; 626 493 form.target ="uploadFile"; 627 494 form.submit();
Note: See TracChangeset
for help on using the changeset viewer.