[BUGFIX] Files get indexed twice
authorSteffen Ritter <info@rs-websystems.de>
Tue, 9 Oct 2012 13:07:31 +0000 (15:07 +0200)
committerAndreas Wolf <andreas.wolf@ikt-werk.de>
Wed, 10 Oct 2012 09:21:19 +0000 (11:21 +0200)
Files used within CSS Styled Content get indexed within
storage null again, since they are accessed via path
instead of file uid.

Change-Id: Ie529c6f9e853f429212265aa779a39086b4a652c
Fixes: #40669
Releases: 6.0
Reviewed-on: http://review.typo3.org/15439
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Mario Rimann
Reviewed-by: Andreas Wolf
Tested-by: Andreas Wolf
typo3/sysext/core/Classes/Resource/Service/FrontendContentAdapterService.php
typo3/sysext/css_styled_content/Classes/Controller/CssStyledContentController.php
typo3/sysext/css_styled_content/static/setup.txt

index e9662e2..474db2e 100644 (file)
@@ -45,7 +45,6 @@ class FrontendContentAdapterService {
                                'captions' => 'imagecaption',
                                'links' => 'image_link',
                                'alternativeTexts' => 'altText',
-                               'sysFileUids' => 'sysFileUids'
                        ),
                        'media' => array(
                                'paths' => 'media',
@@ -83,8 +82,10 @@ class FrontendContentAdapterService {
                                                'captions' => array(),
                                                'links' => array(),
                                                'alternativeTexts' => array(),
-                                               'sysFileUids' => array()
+                                               $migrateFieldName . '_fileUids' => array()
                                        );
+                                       $oldFieldNames[$migrateFieldName . '_fileUids'] = $migrateFieldName . '_fileUids';
+
                                        foreach ($files as $file) {
                                                /** @var $file \TYPO3\CMS\Core\Resource\FileReference */
                                                $fileFieldContents['paths'][] = '../../' . $file->getPublicUrl();
@@ -92,11 +93,11 @@ class FrontendContentAdapterService {
                                                $fileFieldContents['captions'][] = $file->getProperty('description');
                                                $fileFieldContents['links'][] = $file->getProperty('link');
                                                $fileFieldContents['alternativeTexts'][] = $file->getProperty('alternative');
-                                               $fileFieldContents['sysFileUids'][] = $file->getUid();
+                                               $fileFieldContents[$migrateFieldName .  '_fileUids'][] = $file->getOriginalFile()->getUid();
                                        }
                                        foreach ($oldFieldNames as $oldFieldType => $oldFieldName) {
                                                // For paths, make comma separated list
-                                               if ($oldFieldType === 'paths') {
+                                               if ($oldFieldType === 'paths' || substr($oldFieldType, -9) == '_fileUids') {
                                                        $fieldContents = implode(',', $fileFieldContents[$oldFieldType]);
                                                } else {
                                                        // For all other fields, separate by newline
@@ -114,4 +115,4 @@ class FrontendContentAdapterService {
 }
 
 
-?>
\ No newline at end of file
+?>
index 8546078..e0cf608 100644 (file)
@@ -610,7 +610,12 @@ class CssStyledContentController extends \TYPO3\CMS\Frontend\Plugin\AbstractPlug
                $rowIdx = 0;
                for ($a = 0; $a < $imgCount; $a++) {
                        $imgKey = $a + $imgStart;
-                       $totalImagePath = $imgPath . $imgs[$imgKey];
+                       // if the image cannot be interpreted as integer (therefore filename and no FAL id), add the image path
+                       if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($imgs[$imgKey])) {
+                               $totalImagePath = intval($imgs[$imgKey]);
+                       } else {
+                               $totalImagePath = $imgPath . $imgs[$imgKey];
+                       }
                        // register IMG_NUM is kept for backwards compatibility
                        $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgKey;
                        $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgKey;
index 53b9d29..09e4e70 100644 (file)
@@ -659,6 +659,7 @@ tt_content.image.20 {
 
        # Image source
        imgList.field = image
+       imgList.override.field = image_fileUids
        imgPath = uploads/pics/
 
        # Single image rendering