Index: branches/5.3.x/core/admin_templates/js/ajax.js =================================================================== diff -u -N -r15483 -r15677 --- branches/5.3.x/core/admin_templates/js/ajax.js (.../ajax.js) (revision 15483) +++ branches/5.3.x/core/admin_templates/js/ajax.js (.../ajax.js) (revision 15677) @@ -318,44 +318,35 @@ // AJAX PopupManager class function AjaxPopupManager($url) { this.URL = $url; - this.ResponceFunction = null; - this.PopupSizes = new Array(); + this.PopupSizes = []; } -AjaxPopupManager.prototype.GetSize = function ($template) { - if (this.ResponceFunction == null) { - alert ('Please define responce function first (type: '+typeof(this.ResponceFunction)+')'); +AjaxPopupManager.prototype.GetSize = function ($template, $callback) { + if ( $callback === undefined || !$.isFunction($callback) ) { + alert('Please specify callback'); } - if (!isset(this.PopupSizes[$template])) { - var $url = this.URL + '&type=GetPopupSize&template_name=' + $template; -// alert('from ajax: '+$url); - Request.makeRequest($url, this.BusyRequest, '', this.successCallback, this.errorCallback, ['GetSize', $template], this); + if ( !isset(this.PopupSizes[$template]) ) { + var $me = this; + + $.get( + this.URL, + { + 'events[adm]': 'OnGetPopupSize', + 'template_name': $template + }, + function ($popup_size) { + // store response to cache for future use + $me.PopupSizes[$template] = $popup_size; + $callback($popup_size); + } + ); } else { -// alert('from cache'); - this.ResponceFunction(this.PopupSizes[$template]); + $callback(this.PopupSizes[$template]); } -} +}; -AjaxPopupManager.prototype.successCallback = function($request, $params, $object) { - var $responce = $request.responseText; - - switch ($params[0]) { - case 'GetSize': - // store responce to cache for future use - $object.PopupSizes[ $params[1] ] = $responce; - break; - } - - $object.ResponceFunction($responce); - $object.ResponceFunction = null; // reset responce function -} - -AjaxPopupManager.prototype.errorCallback = function($request, $params, $object) { - alert('AJAX Error; class: AjaxPopupManager; ' + Request.getErrorHtml($request)); -} - // AJAX DropdownPreloader class function AjaxDropdownPreloader($url, $input_mask, $filter_field, $dependend_field, value, $has_empty) { this.URL = $url;