From: Alexander Ebert Date: Tue, 14 May 2013 22:47:26 +0000 (+0200) Subject: Fixed selection of multiple optional packages X-Git-Tag: 2.0.0_Beta_1~186 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c001b4575143d36bb773fbb1252dfe4580c34f9c;p=GitHub%2FWoltLab%2FWCF.git Fixed selection of multiple optional packages --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index e4522d6f67..04f3d7cee0 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -579,7 +579,30 @@ WCF.ACP.Package.Installation = Class.extend({ return false; } - $additionalData[$inputElement.attr('name')] = $inputElement.val(); + var $name = $inputElement.attr('name'); + if ($name.match(/(.*)\[([^[]*)\]$/)) { + $name = RegExp.$1; + $key = RegExp.$2; + + if ($additionalData[$name] === undefined) { + if ($key) { + $additionalData[$name] = { }; + } + else { + $additionalData[$name] = [ ]; + } + } + + if ($key) { + $additionalData[$key] = $inputElement.val(); + } + else { + $additionalData[$key].push($inputElement.val()); + } + } + else { + $additionalData[$name] = $inputElement.val(); + } }); this._executeStep(data.step, data.node, $additionalData); diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php index 532c23453f..23621d1632 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php @@ -646,7 +646,7 @@ class PackageInstallationDispatcher { foreach ($packages as $package) { $optionalPackage = new MultipleSelectionFormElement($container); - $optionalPackage->setName('optionalPackages'); + $optionalPackage->setName('optionalPackages[]'); $optionalPackage->setLabel($package['packageName']); $optionalPackage->setValue($package['package']);