From: Alexander Ebert Date: Mon, 14 Nov 2011 18:39:37 +0000 (+0100) Subject: Work-around for wcfAJAXDialog via AJAXProxy X-Git-Tag: 2.0.0_Beta_1~1591^2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6b3fd5ce784a1b50a377d5c834fbd6d4b2535f7d;p=GitHub%2FWoltLab%2FWCF.git Work-around for wcfAJAXDialog via AJAXProxy --- diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 8aa22c5c00..be9614fb13 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -3311,9 +3311,11 @@ $.widget('ui.wcfAJAXDialog', $.ui.dialog, { _createDialog: function(data) { data.ignoreTemplate = true; this.element.data('responseData', data); + + // work-around for AJAXProxy's different return values this.element.wcfGrow({ - content: data.template, + content: this._getResponseValue('template'), parent: this.element.parent('.ui-dialog') }, { duration: 600, @@ -3330,7 +3332,7 @@ $.widget('ui.wcfAJAXDialog', $.ui.dialog, { this._callbackExecuted = true; this.element.removeClass('overlayLoading'); - this.element.html(this.element.data('responseData').template); + this.element.html(this._getResponseValue('template')); if (this.options.ajax.success) { this.options.ajax.success(); @@ -3338,6 +3340,32 @@ $.widget('ui.wcfAJAXDialog', $.ui.dialog, { }, this) }); }, + + /** + * Returns specific AJAX response value. + * + * @param string key + * @return mixed + */ + _getResponseValue: function(key) { + var $data = this.element.data('responseData'); + + // no response data stored + if (!$data) { + return null; + } + + // AJAXProxy + if ($data.returnValues[key]) { + return $data.returnValues[key]; + } + // PackageInstallation + else if ($data[key]) { + return $data[key]; + } + + return null; + }, /** * Redraws dialog, should be executed everytime content is changed.