[BUGFIX] Import Selection with TYPO3 Element Browser 44/39744/4
authorFrank Nägler <typo3@naegler.net>
Tue, 26 May 2015 14:07:56 +0000 (16:07 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Tue, 2 Jun 2015 21:19:27 +0000 (23:19 +0200)
This patch fixes the "Import Selection" link in the element browser.

Resolves: #47322
Releases: master, 6.2
Change-Id: Ic9b7ed37f0bd25d47e6b97036e1244b97b218f3b
Reviewed-on: http://review.typo3.org/39744
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/BrowseLinks.js
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php

index 34457a9..3aae828 100644 (file)
@@ -78,10 +78,17 @@ define('TYPO3/CMS/Backend/BrowseLinks', ['jquery'], function ($) {
                                                selectedItems.push(item.name);
                                        }
                                });
-                               if (selectedItems.length == 1) {
-                                       BrowseLinks.File.insertElement(selectedItems[0]);
-                               } else {
-                                       BrowseLinks.File.insertElementMultiple(selectedItems);
+                               if (selectedItems.length > 0) {
+                                       // The variable _hasActionMultipleCode is set in ElementBrowser.php.
+                                       // This is a workaround to get multiple selection working with
+                                       // IRRE and groups fields.
+                                       if (typeof _hasActionMultipleCode !== 'undefined' && _hasActionMultipleCode) {
+                                               BrowseLinks.File.insertElementMultiple(selectedItems);
+                                       } else {
+                                               for (var i = 0; i < selectedItems.length; i++) {
+                                                       BrowseLinks.File.insertElement(selectedItems[i]);
+                                               }
+                                       }
                                }
                                BrowseLinks.focusOpenerAndClose(true);
                        }
index 2e87795..d5d8f99 100644 (file)
@@ -768,6 +768,7 @@ class ElementBrowser {
                                }
                                return false;
                        }
+                       var _hasActionMultipleCode = ' . (!empty($JScodeActionMultiple) ? 'true' : 'false') . ';
                        function insertMultiple(table, uid) {
                                var type = "";
                                                ' . $JScodeActionMultiple . '