Commit 57966021 authored by Benni Mack's avatar Benni Mack Committed by Stefan Neufeind
Browse files

[TASK] Adapt FormEngine translated records to Bootstrap

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's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: default avatarStefan Neufeind <typo3.neufeind@speedpartner.de>
parent 32bc02d7
......@@ -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>';
......
......@@ -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']) {
......
......@@ -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)) {
......
......@@ -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 */
......
......@@ -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 {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment