2006-07-04 Ernesto Baschny <ernst@cron-it.de>
authorErnesto Baschny <ernst@cron-it.de>
Mon, 10 Jul 2006 17:21:35 +0000 (17:21 +0000)
committerErnesto Baschny <ernst@cron-it.de>
Mon, 10 Jul 2006 17:21:35 +0000 (17:21 +0000)
* Fixed bug #3005: captionSplit.cObject functionality in IMGTEXT is back as documented. But marked as "deprecated".
* Fixed bug #3258: rendering issues in CSS styled IMGTEXT with noRows setting fixed.
* Fixed bug #3416: first caption was being doubled with "renderMethod=table".

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@1616 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/sysext/cms/tslib/class.tslib_content.php
typo3/sysext/css_styled_content/pi1/class.tx_cssstyledcontent_pi1.php
typo3/sysext/css_styled_content/static/setup.txt

index 535f766..18d8c3d 100755 (executable)
@@ -768,9 +768,19 @@ class tslib_cObj {
 
                                // initialisation
                        $caption='';
+                       $captionArray = array();
                        if (!$conf['captionSplit'] && !$conf['imageTextSplit'] && is_array($conf['caption.']))  {
                                $caption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'),$conf['caption.']);     // global caption, no splitting
                        }
+                       if ($conf['captionSplit'] && $conf['captionSplit.']['cObject']) {
+                               $legacyCaptionSplit = 1;
+                               $capSplit = $this->stdWrap($conf['captionSplit.']['token'], $conf['captionSplit.']['token.']);
+                               if (!$capSplit) {$capSplit=chr(10);}
+                               $captionArray = explode($capSplit, $this->cObjGetSingle($conf['captionSplit.']['cObject'], $conf['captionSplit.']['cObject.'], 'captionSplit.cObject'));
+                               while (list($ca_key, $ca_val) = each($captionArray))    {
+                                       $captionArray[$ca_key] = $this->stdWrap(trim($captionArray[$ca_key]), $conf['captionSplit.']['stdWrap.']);
+                               }
+                       }
 
                        $tablecode='';
                        $position=$this->stdWrap($conf['textPos'],$conf['textPos.']);
@@ -883,6 +893,7 @@ class tslib_cObj {
                        $origImages=array();
                        for($a=0;$a<$imgCount;$a++)     {
                                $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
+                               $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a;
 
                                $imgKey = $a+$imgStart;
                                $totalImagePath = $imgPath.$imgs[$imgKey];
@@ -1054,11 +1065,14 @@ class tslib_cObj {
                                        for ($a=0;$a<$rowCount_temp;$a++)       {       // Looping through the rows IF "noRows" is set. "noRows"  means that the rows of images is not rendered by physical table rows but images are all in one column and spaced apart with clear-gifs. This loop is only one time if "noRows" is not set.
                                                $GLOBALS['TSFE']->register['IMAGE_NUM'] = $imgIndex;    // register previous imgIndex
                                                $imgIndex = $index+$a*$colCount_temp;
+                                               $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $imgIndex;
                                                if ($imgsTag[$imgIndex])        {
                                                        if ($rowspacing && $noRows && $a) {             // Puts distance between the images IF "noRows" is set and this is the first iteration of the loop
                                                                $tablecode.= '<img src="'.$GLOBALS['TSFE']->absRefPrefix.'clear.gif" width="1" height="'.$rowspacing.'" alt="" title="" /><br />';
                                                        }
-                                                       if ($conf['captionSplit'] || $conf['imageTextSplit'])   {
+                                                       if ($legacyCaptionSplit)        {
+                                                               $thisCaption = $captionArray[$imgIndex];
+                                                       } else if ($conf['captionSplit'] || $conf['imageTextSplit'])    {
                                                                $thisCaption = $this->stdWrap($this->cObjGet($conf['caption.'], 'caption.'), $conf['caption.']);
                                                        }
                                                        $imageHTML = $imgsTag[$imgIndex].'<br />';
index 7969fcf..5e3bb22 100755 (executable)
@@ -555,6 +555,7 @@ class tx_cssstyledcontent_pi1 extends tslib_pibase {
                        $totalImagePath = $imgPath.$imgs[$imgKey];
 
                        $GLOBALS['TSFE']->register['IMAGE_NUM'] = $a;
+                       $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $a;
                        $GLOBALS['TSFE']->register['ORIG_FILENAME'] = $totalImagePath;
 
                        $this->cObj->data[$this->cObj->currentValKey] = $totalImagePath;
@@ -687,12 +688,14 @@ class tx_cssstyledcontent_pi1 extends tslib_pibase {
                $images = '';
                for ($c = 0; $c < $imageWrapCols; $c++) {
                        $tmpColspacing = $colspacing;
-                       if (($c==$imageWrapCols-1 && $imagePosition==2) || ($c==0 && $imagePosition==1)) {
+                       if (($c==$imageWrapCols-1 && $imagePosition==2) || ($c==0 && ($imagePosition==1||$imagePosition==0))) {
+                                       // Do not add spacing after column if we are first column (left) or last column (center/right)
                                $tmpColspacing = 0;
                        }
-                       $GLOBALS['TSFE']->register['columnwidth'] = $columnWidths[$c] + $tmpColspacing + $border*($borderSpace+$borderThickness)*2;
+
                        $thisImages = '';
                        $allRows = '';
+                       $maxImageSpace = 0;
                        for ($i = $c; $i<count($imgsTag); $i=$i+$imageWrapCols) {
                                $colPos = $i%$colCount;
                                if ($separateRows && $colPos == 0) {
@@ -700,12 +703,16 @@ class tx_cssstyledcontent_pi1 extends tslib_pibase {
                                }
 
                                        // Render one image
+                               $imageSpace = $origImages[$i][0] + $border*($borderSpace+$borderThickness)*2;
                                $GLOBALS['TSFE']->register['IMAGE_NUM'] = $i;
+                               $GLOBALS['TSFE']->register['IMAGE_NUM_CURRENT'] = $i;
                                $GLOBALS['TSFE']->register['ORIG_FILENAME'] = $origImages[$i]['origFile'];
                                $GLOBALS['TSFE']->register['imagewidth'] = $origImages[$i][0];
-                               $GLOBALS['TSFE']->register['imagespace'] = $origImages[$i][0] + $border*($borderSpace+$borderThickness)*2;
+                               $GLOBALS['TSFE']->register['imagespace'] = $imageSpace;
                                $GLOBALS['TSFE']->register['imageheight'] = $origImages[$i][1];
-
+                               if ($imageSpace > $maxImageSpace)       {
+                                       $maxImageSpace = $imageSpace;
+                               }
                                $thisImage = '';
                                $thisImage .= $this->cObj->stdWrap($imgsTag[$i], $conf['imgTagStdWrap.']);
 
@@ -730,6 +737,7 @@ class tx_cssstyledcontent_pi1 extends tslib_pibase {
                                } else {
                                        $allRows .= $thisImage;
                                }
+                               $GLOBALS['TSFE']->register['columnwidth'] = $maxImageSpace + $tmpColspacing;
                                if ($separateRows && ($colPos == ($colCount-1) || $i+1==count($imgsTag)))       {
                                        // Close this row at the end (colCount), or the last row at the final end
                                        $allRows .= $this->cObj->stdWrap($thisRow, $conf['imageRowStdWrap.']);
index 7875f9d..2ca7039 100755 (executable)
@@ -369,11 +369,11 @@ tt_content.image.20 {
 
                        enable.field = image_zoom
                        enable.ifEmpty.typolink.parameter.field = image_link
-                       enable.ifEmpty.typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM
+                       enable.ifEmpty.typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
                        enable.ifEmpty.typolink.returnLast = url
 
                        typolink.parameter.field = image_link
-                       typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM
+                       typolink.parameter.listNum.stdWrap.data = register : IMAGE_NUM_CURRENT
                        typolink.target = {$styles.content.links.target}
                        typolink.extTarget = {$styles.content.links.extTarget}
                }
@@ -383,7 +383,7 @@ tt_content.image.20 {
                        field = altText
                        split.token.char = 10
                        split.token.if.isTrue = {$styles.content.imgtext.imageTextSplit}
-                       split.returnKey.data = register : IMAGE_NUM
+                       split.returnKey.data = register : IMAGE_NUM_CURRENT
                }
 
                titleText < .altText
@@ -423,7 +423,7 @@ tt_content.image.20 {
                        wrapAlign.field = imagecaption_position
                        split.token.char = 10
                        split.token.if.isPositive = {$styles.content.imgtext.imageTextSplit} + {$styles.content.imgtext.captionSplit}
-                       split.returnKey.data = register : IMAGE_NUM
+                       split.returnKey.data = register : IMAGE_NUM_CURRENT
                }
        }
        # captionSplit is deprecated, use imageTextSplit instead