[TASK] Adapt FormEngine translated records to Bootstrap 00/34800/5
authorBenjamin Mack <benni@typo3.org>
Sun, 30 Nov 2014 01:41:11 +0000 (02:41 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Sun, 7 Dec 2014 15:26:56 +0000 (16:26 +0100)
When editing a translated record, a message
is shown of what is written in the original field.
Additionally, if the original record was modified
since the last change, a diff is shown. If an icon
is available then it is displayed.

The patch adapts the following things:

1. CSS classes are renamed in order to reflect
FormEngine and not old TCEForms namings.

2. If the original language does not have an icon
the label of the icon is shown again. This actually
a bug introduced when adapting sprites in FormEngine
and is now back to the original version.

3. Styling is adapted, also for the diff to use bootstrap
values.

Resolves: #63440
Releases: master
Change-Id: I314446e3e184dff26f52c70e37c6969c069728bd
Reviewed-on: http://review.typo3.org/34800
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/backend/Classes/Form/Element/FlexElement.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/core/Classes/Utility/DiffUtility.php
typo3/sysext/t3skin/Resources/Private/Styles/TYPO3/_element_tceforms.less
typo3/sysext/t3skin/Resources/Public/Css/visual/t3skin.css

index d7239ca..420bc60 100644 (file)
@@ -468,7 +468,7 @@ class FlexElement extends AbstractFormElement {
                                                                $theFormEl = $this->formEngine->getSingleField_SW($table, $field, $row, $fakePA);
                                                                $theTitle = htmlspecialchars($fakePA['fieldConf']['label']);
                                                                if (!in_array('DEF', $rotateLang)) {
-                                                                       $defInfo = '<div class="typo3-TCEforms-originalLanguageValue">'
+                                                                       $defInfo = '<div class="t3-form-original-language">'
                                                                                . $this->formEngine->getLanguageIcon($table, $row, 0)
                                                                                . $this->formEngine->previewFieldValue($editData[$key]['vDEF'], $fakePA['fieldConf'], $field)
                                                                                . '&nbsp;</div>';
@@ -478,7 +478,7 @@ class FlexElement extends AbstractFormElement {
                                                                if (!$PA['_noEditDEF']) {
                                                                        $prLang = $this->formEngine->getAdditionalPreviewLanguages();
                                                                        foreach ($prLang as $prL) {
-                                                                               $defInfo .= '<div class="typo3-TCEforms-originalLanguageValue">'
+                                                                               $defInfo .= '<div class="t3-form-original-language">'
                                                                                        . $this->formEngine->getLanguageIcon($table, $row, ('v' . $prL['ISOcode']))
                                                                                        . $this->formEngine->previewFieldValue($editData[$key][('v' . $prL['ISOcode'])], $fakePA['fieldConf'], $field)
                                                                                        . '&nbsp;</div>';
index bf34f62..1f30ed8 100644 (file)
@@ -2123,18 +2123,18 @@ class FormEngine {
                        // Don't show content if it's for IRRE child records:
                        if ($fieldConfig['config']['type'] != 'inline') {
                                if ($defaultLanguageValue !== '') {
-                                       $item .= '<div class="typo3-TCEforms-originalLanguageValue">' . $this->getLanguageIcon($table, $row, 0)
+                                       $item .= '<div class="t3-form-original-language">' . $this->getLanguageIcon($table, $row, 0)
                                                . $this->getMergeBehaviourIcon($fieldConfig['l10n_mode'])
-                                               . $this->previewFieldValue($defaultLanguageValue, $fieldConfig, $field) . '&nbsp;</div>';
+                                               . $this->previewFieldValue($defaultLanguageValue, $fieldConfig, $field) . '</div>';
                                }
                                $previewLanguages = $this->getAdditionalPreviewLanguages();
                                foreach ($previewLanguages as $previewLanguage) {
                                        $defaultLanguageValue = BackendUtility::getProcessedValue($table, $field, $this->additionalPreviewLanguageData[$table . ':' . $row['uid']][$previewLanguage['uid']][$field], 0, 1);
                                        if ($defaultLanguageValue !== '') {
-                                               $item .= '<div class="typo3-TCEforms-originalLanguageValue">'
+                                               $item .= '<div class="t3-form-original-language">'
                                                        . $this->getLanguageIcon($table, $row, ('v' . $previewLanguage['ISOcode']))
                                                        . $this->getMergeBehaviourIcon($fieldConfig['l10n_mode'])
-                                                       . $this->previewFieldValue($defaultLanguageValue, $fieldConfig, $field) . '&nbsp;</div>';
+                                                       . $this->previewFieldValue($defaultLanguageValue, $fieldConfig, $field) . '</div>';
                                        }
                                }
                        }
@@ -2170,8 +2170,10 @@ class FormEngine {
                                                BackendUtility::getProcessedValue($table, $field, $dLVal['old'][$field], 0, 1),
                                                BackendUtility::getProcessedValue($table, $field, $dLVal['new'][$field], 0, 1)
                                        );
-                                       $item .= '<div class="typo3-TCEforms-diffBox">' . '<div class="typo3-TCEforms-diffBox-header">'
-                                               . htmlspecialchars($this->getLL('l_changeInOrig')) . ':</div>' . $diffres . '</div>';
+                                       $item .= '<div class="t3-form-original-language-diff">
+                                               <div class="t3-form-original-language-diffheader">' . htmlspecialchars($this->getLL('l_changeInOrig')) . '</div>
+                                               <div class="t3-form-original-language-diffcontent">' . $diffres . '</div>
+                                       </div>';
                                }
                        }
                }
@@ -4327,7 +4329,7 @@ class FormEngine {
                        }
                }
                $out = '';
-               if ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon']) {
+               if ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon'] && $this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon'] != 'empty-empty') {
                        $out .= IconUtility::getSpriteIcon($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['flagIcon']);
                        $out .= '&nbsp;';
                } elseif ($this->cachedLanguageFlag[$mainKey][$sys_language_uid]['title']) {
index 805f7be..2da79cd 100644 (file)
@@ -95,10 +95,10 @@ class DiffUtility {
                                        $outString .= $this->addClearBuffer($clearBuffer);
                                        $clearBuffer = '';
                                        if (is_array($diffResArray[$a + 1]['old'])) {
-                                               $outString .= '<' . $wrapTag . ' class="diff-r">' . htmlspecialchars(implode(' ', $diffResArray[($a + 1)]['old'])) . '</' . $wrapTag . '> ';
+                                               $outString .= '<' . $wrapTag . ' class="text-danger">' . htmlspecialchars(implode(' ', $diffResArray[($a + 1)]['old'])) . '</' . $wrapTag . '> ';
                                        }
                                        if (is_array($diffResArray[$a + 1]['new'])) {
-                                               $outString .= '<' . $wrapTag . ' class="diff-g">' . htmlspecialchars(implode(' ', $diffResArray[($a + 1)]['new'])) . '</' . $wrapTag . '> ';
+                                               $outString .= '<' . $wrapTag . ' class="text-success">' . htmlspecialchars(implode(' ', $diffResArray[($a + 1)]['new'])) . '</' . $wrapTag . '> ';
                                        }
                                        $chInfParts = explode(',', $diffResArray[$a + 1]['changeInfo']);
                                        if ((string)$chInfParts[0] === (string)($a + 1)) {
index d752239..9eafa66 100644 (file)
@@ -754,19 +754,31 @@ select option.c-divider {
        text-transform: uppercase;
 }
 
-.typo3-TCEforms div.typo3-TCEforms-originalLanguageValue {
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+show text of default language under the translated input field
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+.t3-form-original-language {
        background-color: #dadada;
        border: 1px solid #c0c0c0;
+       padding: 2px;
+       font-size: 0.9em;
+       margin-top: 4px;
 }
 
-.typo3-TCEforms div.typo3-TCEforms-diffBox {
-       background-color: white;
-       border: 1px solid black;
+.t3-form-original-language-diff {
+       border: 1px solid #c0c0c0;
+       font-size: 0.9em;
+       margin-top: 4px;
 }
 
-.typo3-TCEforms div.typo3-TCEforms-diffBox-header {
-       background-color: red;
+.t3-form-original-language-diffheader {
+       .bg-danger();
        font-weight: bold;
+       padding: 2px;
+}
+
+.t3-form-original-language-diffcontent {
+       padding: 2px;
 }
 
 /* Default. Always used on main-palettes in the bottom of the forms */
index 3378854..7cc1e2d 100644 (file)
@@ -9958,17 +9958,31 @@ select option.c-divider {
   font-style: italic;
   text-transform: uppercase;
 }
-.typo3-TCEforms div.typo3-TCEforms-originalLanguageValue {
+/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+show text of default language under the translated input field
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
+.t3-form-original-language {
   background-color: #dadada;
   border: 1px solid #c0c0c0;
+  padding: 2px;
+  font-size: 0.9em;
+  margin-top: 4px;
 }
-.typo3-TCEforms div.typo3-TCEforms-diffBox {
-  background-color: white;
-  border: 1px solid black;
+.t3-form-original-language-diff {
+  border: 1px solid #c0c0c0;
+  font-size: 0.9em;
+  margin-top: 4px;
 }
-.typo3-TCEforms div.typo3-TCEforms-diffBox-header {
-  background-color: red;
+.t3-form-original-language-diffheader {
+  background-color: #efc7c7;
   font-weight: bold;
+  padding: 2px;
+}
+a.t3-form-original-language-diffheader:hover {
+  background-color: #e49f9f;
+}
+.t3-form-original-language-diffcontent {
+  padding: 2px;
 }
 /* Default. Always used on main-palettes in the bottom of the forms */
 .typo3-TCEforms .typo3-TCEforms-checkboxArray td {