Bug #56084
closedt3editor is not usable any more
100%
Description
Regression has been introduced in #55371
The actual problem of the change is the following:
- $ajaxObj->addContent('result', $this->fileData); + $fileData = array(); + foreach ($this->fileData as $action => $result) { + foreach ($result as $files) { + /** @var $file \TYPO3\CMS\Core\Resource\File */ + foreach ($files as $file) { + $fileData[$action][] = $file->toArray(); + } + } + } + $ajaxObj->addContent('result', $fileData);
Don't know what that should have fixed as there is not a single unit test for the change but if you save a file edited with t3editor in the list module, $this->fileData is as such:
array( 'editfile' => array( 0 => true ) )
This results in $files being true instead of array in the second foreach loop. So the third foreach loop will not be executed and therefore $fileData is an empty array.
Updated by Alexander Opitz about 11 years ago
- Assignee changed from Alexander Opitz to Alexander Schnitzler
Updated by Alexander Schnitzler about 11 years ago
- Assignee changed from Alexander Schnitzler to Frans Saris
Frans, can you please have a look at it?
Updated by Frans Saris about 11 years ago
Hi Alexander,
$fileData = array(); foreach ($this->fileData as $action => $result) { if ($action === 'upload') { foreach ($result as $files) { /** @var $file \TYPO3\CMS\Core\Resource\File */ foreach ($files as $file) { $fileData[$action][] = array_merge( $file->toArray(), array ( 'date' => BackendUtility::date($file->getModificationTime()), 'iconClasses' => \TYPO3\CMS\Backend\Utility\IconUtility::mapFileExtensionToSpriteIconClass($file->getExtension()), ) ); } } } else { $fileData[$action] = $result; } } $ajaxObj->addContent('result', $fileData);
This fixes the problem.
But I'm not sure if there are more 'actions' that return File objects like upload. When I made this change I search for other uses of the ajax api but couldn't find any. Do you know if there are more?
Updated by Alexander Schnitzler about 11 years ago
Thanks but that really feels wrong. An API should be consistent and clear and not handle several different cases with if, else, and multiple foreach loops.
Let's dig into it and find out where these calls are used and what for. What do you think?
Updated by Gerrit Code Review about 11 years 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/27739
Updated by Frans Saris about 11 years ago
The result set can have multiple results.
[delete][] = boolean
[copy][] = File | Folder
[move][] = File | Folder
[rename][] = File | Folder
[newfolder][] = Folder
[newfile][] = File
[editfile][] = boolean
[upload][][] = File
[unzip][] = boolean
I have changed the processAjaxRequest() so it loops through the result set and flattens the possible values.
Updated by Gerrit Code Review about 11 years 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/27739
Updated by Gerrit Code Review about 11 years 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/27739
Updated by Gerrit Code Review about 11 years 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/27739
Updated by Gerrit Code Review about 11 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27739
Updated by Markus Klein about 11 years ago
I don't get the problem. I can edit text files as usual in the filelist module.
Edit: Got the problem. It's about the Save button.
Updated by Gerrit Code Review about 11 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27739
Updated by Gerrit Code Review about 11 years ago
Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27739
Updated by Gerrit Code Review about 11 years ago
Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27739
Updated by Gerrit Code Review about 11 years ago
Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27739
Updated by Gerrit Code Review about 11 years ago
Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27739
Updated by Gerrit Code Review about 11 years ago
Patch set 1 for branch TYPO3_6-1 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/27863
Updated by Frans Saris about 11 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 6cc6c4f7ec9342ed26e55a8dee916c92a95bc71c.
Updated by Riccardo De Contardi over 7 years ago
- Status changed from Resolved to Closed