From 6b3fd5ce784a1b50a377d5c834fbd6d4b2535f7d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 14 Nov 2011 19:39:37 +0100 Subject: [PATCH] Work-around for wcfAJAXDialog via AJAXProxy --- wcfsetup/install/files/js/WCF.js | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) 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. -- 2.20.1