Skip to content

Commit

Permalink
[BUGFIX] Use DataHandler localize in Localization Overview
Browse files Browse the repository at this point in the history
Instead of opening a multi-form-engine form when creating new
translations via translation overview the datahandler is called
upon to localize the pages.

This has the advantage that it
- works
- consistently as in page module
- keeps all types (page type changed in earlier versions)

Resolves: #83721
Resolves: #83720
Releases: master, 9.5
Change-Id: I39ec0f63dce5ddcd8d3f34c849367dc2c621f8bd
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62882
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
  • Loading branch information
susannemoog authored and ervaude committed Jan 14, 2020
1 parent 34a7946 commit f6bc124
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 14 deletions.
Expand Up @@ -325,7 +325,7 @@ protected function renderL10nTable(&$tree)
} else {
$status = GeneralUtility::hideIfNotTranslated($data['row']['l18n_cfg']) || GeneralUtility::hideIfDefaultLanguage($data['row']['l18n_cfg']) ? 'danger' : '';
$info = '<div class="btn-group"><label class="btn btn-default btn-checkbox">';
$info .= '<input type="checkbox" data-lang="' . $languageId . '" name="newOL[' . $languageId . '][' . $data['row']['uid'] . ']" value="1" />';
$info .= '<input type="checkbox" data-lang="' . $languageId . '" data-uid="' . (int)$data['row']['uid'] . '" name="newOL[' . $languageId . '][' . $data['row']['uid'] . ']" value="1" />';
$info .= '<span class="t3-icon fa"></span></label></div>';
$newOL_js[$languageId] .=
' +(document.webinfoForm['
Expand Down Expand Up @@ -396,18 +396,22 @@ protected function renderL10nTable(&$tree)
$editButton = '';
}
// Create new overlay records:
$params = '&columnsOnly=title,hidden,sys_language_uid&overrideVals[pages][sys_language_uid]=' . $languageId;
$onClick = BackendUtility::editOnClick($params);
if (!empty($newOL_js[$languageId])) {
$onClickArray = explode('?', $onClick, 2);
$lastElement = array_pop($onClickArray);
$onClickArray[] = '\'' . $newOL_js[$languageId] . ' + \'&' . $lastElement;
$onClick = implode('?', $onClickArray);
}
$newButton = '<a href="#" class="btn btn-default disabled t3js-language-new-' . $languageId . '" onclick="' . htmlspecialchars($onClick)
. '" title="' . $lang->sL(
'LLL:EXT:info/Resources/Private/Language/locallang_webinfo.xlf:lang_getlangsta_createNewTranslationHeaders'
) . '">' . $this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() . '</a>';
$createLink = (string)$uriBuilder->buildUriFromRoute('tce_db', [
'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI')
]);
$newButton = '<a href="' .
htmlspecialchars($createLink) .
'" data-edit-url="' .
htmlspecialchars($createLink) .
'" class="btn btn-default disabled t3js-language-new-' .
$languageId .
'" title="' .
$lang->sL(
'LLL:EXT:info/Resources/Private/Language/locallang_webinfo.xlf:lang_getlangsta_createNewTranslationHeaders'
) .
'">' .
$this->iconFactory->getIcon('actions-document-new', Icon::SIZE_SMALL)->render() .
'</a>';

$tCells[] = '<td class="btn-group">' . $editButton . $newButton . '</td>';
$tCells[] = '<td>&nbsp;</td>';
Expand Down
Expand Up @@ -33,6 +33,13 @@ class TranslationStatus {
const languageId = parseInt($me.data('lang'), 10);
const $newButton = $('.t3js-language-new-' + languageId);
const $selected = $('input[type="checkbox"][data-lang="' + languageId + '"]:checked');

const additionalArguments: string[] = [];
$selected.each((index: number, element: Element): void => {
additionalArguments.push('cmd[pages][' + (<HTMLInputElement>element).dataset.uid + '][localize]=' + languageId);
});
const updatedHref = $newButton.data('editUrl') + '&' + additionalArguments.join('&');
$newButton.attr('href', updatedHref);
$newButton.toggleClass('disabled', $selected.length === 0);
}
}
Expand Down
Expand Up @@ -10,4 +10,4 @@
*
* The TYPO3 project - inspiring people to share!
*/
define(["require","exports","jquery"],function(t,e,n){"use strict";return new(function(){function t(){this.registerEvents()}return t.prototype.registerEvents=function(){n('input[type="checkbox"][data-lang]').on("change",this.toggleNewButton)},t.prototype.toggleNewButton=function(t){var e=n(t.currentTarget),r=parseInt(e.data("lang"),10),o=n(".t3js-language-new-"+r),a=n('input[type="checkbox"][data-lang="'+r+'"]:checked');o.toggleClass("disabled",0===a.length)},t}())});
define(["require","exports","jquery"],function(t,e,n){"use strict";return new(function(){function t(){this.registerEvents()}return t.prototype.registerEvents=function(){n('input[type="checkbox"][data-lang]').on("change",this.toggleNewButton)},t.prototype.toggleNewButton=function(t){var e=n(t.currentTarget),a=parseInt(e.data("lang"),10),r=n(".t3js-language-new-"+a),o=n('input[type="checkbox"][data-lang="'+a+'"]:checked'),i=[];o.each(function(t,e){i.push("cmd[pages]["+e.dataset.uid+"][localize]="+a)});var u=r.data("editUrl")+"&"+i.join("&");r.attr("href",u),r.toggleClass("disabled",0===o.length)},t}())});

0 comments on commit f6bc124

Please sign in to comment.