From: Alexander Ebert Date: Fri, 7 Oct 2011 16:57:48 +0000 (+0200) Subject: Fixed various JS-API errors X-Git-Tag: 2.0.0_Beta_1~1718^2~8 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3c87a1b15356058a7d6f79826a31c8811a41464f;p=GitHub%2FWoltLab%2FWCF.git Fixed various JS-API errors Form element values were included in POST-requests, even if they were not checked (violating intended behavior). Furthermore inner template content is now properly purged if the next step would evaluate as 'success'. --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index c66b32d886..ed4f2aa87e 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -205,14 +205,16 @@ WCF.ACP.PackageInstallation.prototype = { // handle success if ($data.step == 'success') { - var $id = WCF.getRandomID(); - $('#packageInstallationInnerContent').append('
'); - - $('#' + $id).click($.proxy(function() { - window.location.href = "index.php?page=PackageList" + SID_ARG_2ND; - }, this)); - - $('#packageInstallationInnerContentContainer').wcfBlindIn(); + this._purgeTemplateContent(function() { + var $id = WCF.getRandomID(); + $('#packageInstallationInnerContent').append('
'); + + $('#' + $id).click($.proxy(function() { + window.location.href = "index.php?page=PackageList" + SID_ARG_2ND; + }, this)); + + $('#packageInstallationInnerContentContainer').wcfBlindIn(); + }); return; } @@ -240,7 +242,11 @@ WCF.ACP.PackageInstallation.prototype = { // collect form values var $additionalData = {}; $('#packageInstallationInnerContent').find('input').each(function(index, inputElement) { - $additionalData[$(inputElement).attr('name')] = $(inputElement).attr('value'); + var $inputElement = $(inputElement); + + if ($inputElement.is(':checked')) { + $additionalData[$inputElement.attr('name')] = $inputElement.val(); + } }); this._executeStep($data.step, $data.node, $additionalData); @@ -254,22 +260,31 @@ WCF.ACP.PackageInstallation.prototype = { } // purge content + this._purgeTemplateContent($.proxy(function() { + // execute next step + if ($data.step && $data.node) { + this._executeStep($data.step, $data.node); + } + }, this)); + }, + + /** + * Purges template content. + * + * @param function callback + */ + _purgeTemplateContent: function(callback) { if ($('#packageInstallationInnerContent').children().length > 1) { $('#packageInstallationInnerContentContainer').wcfBlindOut('down', $.proxy(function() { $('#packageInstallationInnerContent').empty(); this._dialog.wcfDialog('redraw'); - // execute next step - if ($data.step && $data.node) { - this._executeStep($data.step, $data.node); - } + // execute callback + callback(); }, this)); } else { - // execute next step - if ($data.step && $data.node) { - this._executeStep($data.step, $data.node); - } + callback(); } },