Index: branches/5.2.x/core/admin_templates/js/ajax.js =================================================================== diff -u -N -r15539 -r15857 --- branches/5.2.x/core/admin_templates/js/ajax.js (.../ajax.js) (revision 15539) +++ branches/5.2.x/core/admin_templates/js/ajax.js (.../ajax.js) (revision 15857) @@ -14,7 +14,7 @@ // Main AJAX classs function Request() {} -Request.timeout = 60000; //60 seconds +Request.timeout = 60 * 1000; // 60 seconds Request.method = 'GET'; Request.headers = {}; Request.params = null; @@ -239,7 +239,7 @@ this.BusyRequest = false; this.LastResponceTime = this.GetMicroTime(); this.ProgressPercent = 0; // progress percent - this.ProgressTime = new Array(); + this.ProgressTime = []; this.Query(); } @@ -253,38 +253,38 @@ } AjaxProgressBar.prototype.Query = function() { -// prompt('requestinng', this.URL); - Request.makeRequest(this.URL, this.BusyRequest, '', this.successCallback, this.errorCallback, '', this); -} + var $me = this; -// return time needed for progress to finish -AjaxProgressBar.prototype.GetEstimatedTime = function() { - return Math.ceil((100 - this.ProgressPercent) * Math.sum(this.ProgressTime) / this.ProgressPercent); -} + $.ajaxSetup({cache: false}); -AjaxProgressBar.prototype.successCallback = function($request, $params, $object) { - var $responce = $request.responseText; - var $match_redirect = new RegExp('^#redirect#(.*?)($|\\s.*)').exec($responce); - if ($match_redirect != null) { - $object.showProgress(100); - // redirect to external template requested - window.location.href = $match_redirect[1]; - return false; - } + $.get( + this.URL, + function ($response) { + var $match_redirect = new RegExp('^#redirect#(.*?)($|\\s.*)').exec($response); - if (isNaN(parseFloat($responce))) { - // error message received, otherwise $responce should be number - alert($responce); - return ; - } + if ( $match_redirect != null ) { + $me.showProgress(100); + // redirect to external template requested + window.location.assign($match_redirect[1]); + return; + } - if ($object.showProgress($responce)) { - $object.Query(); - } + if ( isNaN(parseFloat($response)) ) { + // error message received, otherwise $response should be number + alert($response); + return; + } + + if ( $me.showProgress($response) ) { + $me.Query(); + } + } + ); } -AjaxProgressBar.prototype.errorCallback = function($request, $params, $object) { - alert('AJAX Error; class: AjaxProgressBar; ' + Request.getErrorHtml($request)); +// return time needed for progress to finish +AjaxProgressBar.prototype.GetEstimatedTime = function() { + return Math.ceil((100 - this.ProgressPercent) * Math.sum(this.ProgressTime) / this.ProgressPercent); } AjaxProgressBar.prototype.FormatTime = function ($seconds) {