[BUGFIX] Element browser: importing a selection of images does not work 60/36960/2
authorStanislas Rolland <typo3@sjbr.ca>
Mon, 16 Feb 2015 21:13:44 +0000 (16:13 -0500)
committerMarkus Klein <klein.t3@reelworx.at>
Tue, 24 Feb 2015 11:00:34 +0000 (12:00 +0100)
When using the element browser wizard to import a selection of images
into an images or text+images content element, the list of uid's of
images to import is malformed and insertion fails.

Releases: master
Resolves: #65109
Change-Id: Ib32043507ef0dd6969c60d57738eaf16f2597192
Reviewed-on: http://review.typo3.org/36960
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Andy Grunwald <andygrunwald@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Frans Saris <franssaris@gmail.com>
Tested-by: Markus Klein <klein.t3@reelworx.at>
typo3/sysext/backend/Resources/Public/JavaScript/BrowseLinks.js
typo3/sysext/backend/Resources/Public/JavaScript/jsfunc.inline.js

index c888fb1..34457a9 100644 (file)
@@ -44,14 +44,13 @@ define('TYPO3/CMS/Backend/BrowseLinks', ['jquery'], function ($) {
                },
                insertElementMultiple: function(list) {
                        var uidList = [];
-                       list.each(function(index) {
-                               if (typeof BrowseLinks.elements[index] !== undefined) {
-                                       var element = BrowseLinks.elements[index];
+                       for (var i = 0, n = list.length; i < n; i++) {
+                               if (typeof BrowseLinks.elements[list[i]] !== undefined) {
+                                       var element = BrowseLinks.elements[list[i]];
                                        uidList.push(element.uid);
                                }
-                       });
+                       }
                        insertMultiple('sys_file', uidList);
-                       return true;
                }
        };
 
index 9dd63d3..6b61c3f 100644 (file)
@@ -273,7 +273,7 @@ var inline = {
                                                head.appendChild(element);
                                                processedCount++;
                                        }
-                                       json.headData.shift();
+                                       delete(json.headData[index]);
                                }
                        });
                }
@@ -352,7 +352,7 @@ var inline = {
        },
 
        importElementMultiple: function (objectId, table, uidArray, type) {
-               uidArray.each(function (uid) {
+               TYPO3.jQuery.each(uidArray, function (index, uid) {
                        inline.delayedImportElement(objectId, table, uid, type);
                });
        },
@@ -587,14 +587,16 @@ var inline = {
                var result = false;
                TYPO3.jQuery.each(haystack, function (index, element) {
                        if (element.nodeName.toUpperCase() == needle.name) {
-                               var attributesCount = $H(needle.attributes).keys().length;
+                               var attributesCount = Object.keys(needle.attributes).length;
                                var attributesFound = 0;
-                               $H(needle.attributes).each(function (attribute) {
-                                       if (element.getAttribute && element.getAttribute(attribute.key) == attribute.value) {
-                                               attributesFound++;
+                               if (element.getAttribute) {
+                                       for (var attribute in needle.attributes) {
+                                               if (needle.attributes.hasOwnProperty(attribute) && element.getAttribute(attribute.key) === attribute.value) {
+                                                       attributesFound++;
+                                               }
                                        }
-                               });
-                               if (attributesFound == attributesCount) {
+                               }
+                               if (attributesFound === attributesCount) {
                                        result = true;
                                        return true;
                                }