From c001b4575143d36bb773fbb1252dfe4580c34f9c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 15 May 2013 00:47:26 +0200 Subject: [PATCH] Fixed selection of multiple optional packages --- wcfsetup/install/files/acp/js/WCF.ACP.js | 25 ++++++++++++++++++- .../PackageInstallationDispatcher.class.php | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) 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']); -- 2.20.1