Bug #86362

Inserted images are not allways ordered alphabetically

Added by Claude Unterleitner about 2 years ago. Updated 7 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2018-09-24
Due date:
% Done:

100%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When adding more than 40 images at once in a content element text/media which have already been saved on the (linux) server, the original alphabetical ordering is not always kept: Randomly one or more images are added somewhere between the other images ignoring the original superior alphabetical ordering of mostly all other images. Trying to insert the images several times leads to completely different positions of the wrong sorted images (90 to 95 % of the images are correctly ordered).

Paradoxically in my tries, I had two times testet first a correct order when trying from a linux (Ubuntu) operation system, but when then trying it from a windows client system, the ordering was not correct as described, and when then retrying from the linux operation system again, the ordering there was also not correct when adding this huge amount of images. So it has perhaps to do with a kind of caching?


Related issues

Related to TYPO3 Core - Feature #59341: Provide progress indicator while image-processing FAL uploads Closed 2014-06-04

Associated revisions

Revision 26120660 (diff)
Added by Andreas Fernandez 7 months ago

[BUGFIX] Keep order of selection on importing assets

If assets get imported via mass selection in the Element Browser, the
order of the items is now kept. Since this requires interframe
communication, the Inline Control Container now sends a postMessage to
the Element Browser.

When the import process starts, the first asset of the selection gets
imported. After the import, the postMessage is intercepted and the next
asset get imported, until the queue is empty. As this could be a rather
lenghty process, a progress bar is rendered at the top of the file
table.

To get a more fitting naming, all previously used action names used in
postMessages have been renamed from `typo3:foreignRelation:inserted` to
`typo3:foreignRelation:insert`.

As a drive-by fix, the server is not spammed with n request anymore due
to queueing.

Resolves: #86362
Resolves: #59341
Releases: master
Change-Id: Ib9e3ee8d943582874a0a73632968f8660b169b42
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63838
Tested-by: Susanne Moog <>
Tested-by: TYPO3com <>
Tested-by: Daniel Goerz <>
Reviewed-by: Susanne Moog <>
Reviewed-by: Daniel Goerz <>

History

#1 Updated by Claude Unterleitner about 2 years ago

  • Subject changed from Inserted images are not allwas ordered alphbetically to Inserted images are not allwas ordered alphabetically

#2 Updated by Bernd Wilke about 2 years ago

do you use Drag&Drop?

windows priorizes the file/item where you dragged (mousedown) the selection and inserts them first. sometimes the order of marking the items is used. In this way it is an error of windows and TYPO3 can not do anything.

#3 Updated by Claude Unterleitner almost 2 years ago

thank you for your answer. And no, I don't use drag&drop.

#4 Updated by Claude Unterleitner almost 2 years ago

  • Subject changed from Inserted images are not allwas ordered alphabetically to Inserted images are not allways ordered alphabetically

#5 Updated by Susanne Moog 8 months ago

  • Status changed from New to Needs Feedback

The order is not alphabetic because why should it be? ordering of images in an element is done via dragging images in the correct order. When uploading multiple files at once, multiple requests start at the same time and every image gets added once it is uploaded completely. The requests are started in the order given (which depends on the operating system and on whether or not drag and drop is used), but depending on the size and connection speed, they may finish at very different times.

#6 Updated by Claude Unterleitner 8 months ago

@Susanne:
Thank you for your answer. First of all, I'm not speaking from the uploading process but from the process when adding images to a content element text/media. I think this process is independent from the operating system, or not?

My background: One of my clients, a big bicycle association with several regional sub units (called "Kreisverbände"), has many photo galleries of bicycle tours on his website where the ordering of the photos is important (should always be from begin of a tour to the end). When uploading 50 or more photos, it's very annoying for the editors (most of them are working voluntary), when they always have to correct the order of the photos after adding them to a content element text/media. Surely I could try an image gallery plugin but I always prefer to use core methods because it's easier to understand for the editors.

Another solution would be to use the file list content element, because the files can be ordered by title, but I think it's originally thought for listing download links and not for creating a photo gallery...

#7 Updated by Claude Unterleitner 8 months ago

  • TYPO3 Version changed from 8 to 9

tested with TYPO3 V8 and V9

#8 Updated by Andreas Fernandez 7 months ago

  • Status changed from Needs Feedback to Accepted

The problem here is that the images are associated with an inline element, each element is created via a separate AJAX call which creates such timing issues. I currently have no clue how to solve this in a sane way.

#9 Updated by Susanne Moog 7 months ago

Claude Unterleitner wrote:

Another solution would be to use the file list content element, because the files can be ordered by title, but I think it's originally thought for listing download links and not for creating a photo gallery...

Thanks for your answer.

One way to go could be to add the functionality from the files element (or the bootstrap package) to allow adding file collections / folders and sorting to the images / media elements.

I don't exactly see a solution for the ajax requests as Andy stated, however the use case is very valid and we should have a solution.

#10 Updated by Gerrit Code Review 7 months ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63838

#11 Updated by Susanne Moog 7 months ago

Ok, so I was kind of curious and wanted to try my suggestion, I did the following:

Changed the TypoScript of the image content element to:

tt_content.image {
         10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
         10 {
             references.fieldName = image
+            collections.field = file_collections
+            sorting.field = filelink_sorting
+            sorting.direction.field = filelink_sorting_direction
         }
}

Changed showitem of GallerySettings to

--- a/typo3/sysext/frontend/Configuration/TCA/tt_content.php
+++ b/typo3/sysext/frontend/Configuration/TCA/tt_content.php
@@ -1924,7 +1924,12 @@ return [
             'label' => 'LLL:EXT:frontend/Resources/Private/Language/Database.xlf:tt_content.palette.gallerySettings',
             'showitem' => '
                 imageorient;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:imageorient_formlabel,
-                imagecols;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:imagecols_formlabel
+                imagecols;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:imagecols_formlabel,
+                --linebreak--,
+                file_collections;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:file_collections.ALT.uploads_formlabel,
+                --linebreak--,
+                filelink_sorting,
+                filelink_sorting_direction,
             ',
         ],

(both can be achieved in a site extension with TypoScript and TCA overrides).

Now I can select file collections and sorting options and the frontend renders them as if I added the images one-by-one. So until the patch from Andy is done, you can use this very easily (and it might even be easier in the long run, as editors can organize their pictures in a folder and "just" select that folder and a sorting).

#12 Updated by Gerrit Code Review 7 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63838

#13 Updated by Gerrit Code Review 7 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63838

#14 Updated by Gerrit Code Review 7 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63838

#15 Updated by Susanne Moog 7 months ago

  • Related to Feature #59341: Provide progress indicator while image-processing FAL uploads added

#16 Updated by Andreas Fernandez 7 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#17 Updated by Benni Mack 7 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF