[BUGFIX] Image besides text uses wrong margin 63/17363/4 master
authorLorenz Ulrich <lorenz.ulrich@visol.ch>
Fri, 4 Jan 2013 10:37:16 +0000 (11:37 +0100)
committerLorenz Ulrich <lorenz.ulrich@visol.ch>
Fri, 8 Mar 2013 13:24:14 +0000 (14:24 +0100)
dam_ttcontent uses a copy of the the CSS Styles Content rendering class
to display content. It must be adjusted to a bugfix added in #36541.

Change-Id: Icf066794c0b562a23dfc169dd423bb3380277ff1
Fixes: #44291
Releases: 1.3
Reviewed-on: https://review.typo3.org/17363
Reviewed-by: Rico Sonntag
Tested-by: Rico Sonntag
Reviewed-by: Lorenz Ulrich
Tested-by: Lorenz Ulrich
pi_cssstyledcontent/class.tx_damttcontent_pi1.php

index 58f142f..4344c2c 100755 (executable)
@@ -205,7 +205,7 @@ class tx_damttcontent_pi1 extends tx_cssstyledcontent_pi1 {
 
                $borderColor = $borderColor?$borderColor:'black';
                $borderThickness = $borderThickness?$borderThickness:1;
-               $borderSpace = (($conf['borderSpace']&&$border) ? intval($conf['borderSpace']) : 0);
+               $borderSpace = (($conf['borderSpace'] && $border) ? intval($conf['borderSpace']) : 0);
 
                        // Generate cols
                $cols = intval($this->pObj->cObj->stdWrap($conf['cols'],$conf['cols.']));
@@ -235,22 +235,6 @@ class tx_damttcontent_pi1 extends tx_cssstyledcontent_pi1 {
                        }
                }
 
-                       // Set the margin for image + text, no wrap always to avoid multiple stylesheets
-               if ($accessibilityMode) {
-                       $noWrapMargin = (integer) (($maxWInText ? $maxWInText : $fiftyPercentWidthInText) +
-                               intval($this->pObj->cObj->stdWrap($conf['textMargin'],$conf['textMargin.'])));
-
-                       $this->addPageStyle(
-                               '.csc-textpic-intext-right-nowrap .csc-textpic-text',
-                               'margin-right: ' . $noWrapMargin . 'px;'
-                       );
-
-                       $this->addPageStyle(
-                               '.csc-textpic-intext-left-nowrap .csc-textpic-text',
-                               'margin-left: ' . $noWrapMargin . 'px;'
-                       );
-               }
-
                        // max usuable width for images (without spacers and borders)
                $netW = $maxW - $colspacing * ($colCount - 1) - $colCount * $border * ($borderThickness + $borderSpace) * 2;
 
@@ -440,7 +424,7 @@ class tx_damttcontent_pi1 extends tx_cssstyledcontent_pi1 {
                if (!is_array($conf['editIcons.'])) {
                        $conf['editIcons.'] = array();
                }
-               $editIconsHTML = $conf['editIcons']&&$GLOBALS['TSFE']->beUserLogin ? $this->pObj->cObj->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
+                $editIconsHTML = $conf['editIcons'] && $GLOBALS['TSFE']->beUserLogin ? $this->pObj->cObj->editIcons('',$conf['editIcons'],$conf['editIcons.']) : '';
 
                        // If noRows, we need multiple imagecolumn wraps
                $imageWrapCols = 1;
@@ -627,6 +611,45 @@ class tx_damttcontent_pi1 extends tx_cssstyledcontent_pi1 {
                                $classes[] = $addClasses;
                        }
 
+                       // Set the margin for image + text, no wrap always to avoid multiple stylesheets
+                       $noWrapMargin = (integer) (($maxWInText ? $maxWInText : $fiftyPercentWidthInText) +
+                               intval($this->pObj->cObj->stdWrap($conf['textMargin'],$conf['textMargin.']
+                       )));
+
+                       $this->addPageStyle(
+                               '.csc-textpic-intext-right-nowrap .csc-textpic-text',
+                               'margin-right: ' . $noWrapMargin . 'px;'
+                       );
+
+                       $this->addPageStyle(
+                               '.csc-textpic-intext-left-nowrap .csc-textpic-text',
+                               'margin-left: ' . $noWrapMargin . 'px;'
+                       );
+
+                               // Beside Text where the image block width is not equal to maxW
+                       if ($contentPosition == 24 && $maxW != $imageBlockWidth) {
+                               $noWrapMargin = $imageBlockWidth + $textMargin;
+
+                                       // Beside Text, Right
+                               if ($imagePosition == 1) {
+                                       $this->addPageStyle(
+                                               '.csc-textpic-intext-right-nowrap-' . $noWrapMargin . ' .csc-textpic-text',
+                                               'margin-right: ' . $noWrapMargin . 'px;'
+                                       );
+
+                                       $classes[] = 'csc-textpic-intext-right-nowrap-' . $noWrapMargin;
+
+                                       // Beside Text, Left
+                               } elseif ($imagePosition == 2) {
+                                       $this->addPageStyle(
+                                               '.csc-textpic-intext-left-nowrap-' . $noWrapMargin . ' .csc-textpic-text',
+                                               'margin-left: ' . $noWrapMargin . 'px;'
+                                       );
+
+                                       $classes[] = 'csc-textpic-intext-left-nowrap-' . $noWrapMargin;
+                               }
+                       }
+
                        if ($classes) {
                                $class = ' ' . implode(' ', $classes);
                        }