From a32ed0a7265d066f120b81655dd4d5b1e82e67aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20N=C3=A4gler?= <typo3@naegler.net> Date: Thu, 13 Nov 2014 22:26:24 +0100 Subject: [PATCH] [BUGFIX] Fix broken HTML in FormEngine A lot of HTML output in FormEngine is broken, because of missing spaces. This patch add the missing spaces. Resolves: #62937 Releases: master Change-Id: Iec2c25f9b913da87aaa5d06e0a77dd257e58e1f9 Reviewed-on: http://review.typo3.org/34131 Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl> Reviewed-by: Oliver Hader <oliver.hader@typo3.org> Reviewed-by: Felix Kopp <felix-source@phorax.com> Tested-by: Felix Kopp <felix-source@phorax.com> --- .../Classes/Form/Element/CheckboxElement.php | 4 ++-- .../backend/Classes/Form/Element/InlineElement.php | 2 +- .../backend/Classes/Form/Element/RadioElement.php | 2 +- .../backend/Classes/Form/Element/SelectElement.php | 14 +++++++------- typo3/sysext/backend/Classes/Form/FormEngine.php | 2 +- .../backend/Classes/Template/DocumentTemplate.php | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php b/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php index 8305f1ae20cb..64abaaed9fb7 100644 --- a/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/CheckboxElement.php @@ -73,7 +73,7 @@ class CheckboxElement extends AbstractFormElement { $checkboxName = $additionalInformation['itemFormElName'] . '_' . $c; $checkboxId = $additionalInformation['itemFormElID'] . '_' . $c; $item .= '<td nowrap="nowrap"><input type="checkbox" ' . $this->formEngine->insertDefStyle('check') - . 'value="1" name="' . $checkboxName . '" ' . $checkboxParameters . $disabled . 'id="' . $checkboxId . '" />' + . ' value="1" name="' . $checkboxName . '" ' . $checkboxParameters . $disabled . ' id="' . $checkboxId . '" />' . '<label for="' . $checkboxId . '">' . htmlspecialchars($selectedItem[0]) . '</label> ' . '</td>'; if ($c % $cols + 1 == $cols) { @@ -102,7 +102,7 @@ class CheckboxElement extends AbstractFormElement { ); $checkboxName = $additionalInformation['itemFormElName'] . '_' . $c; $checkboxId = $additionalInformation['itemFormElID'] . '_' . $c; - $item .= ($c > 0 ? '<br />' : '') . '<input type="checkbox"' . $this->formEngine->insertDefStyle('check') + $item .= ($c > 0 ? '<br />' : '') . '<input type="checkbox" ' . $this->formEngine->insertDefStyle('check') . ' value="1" name="' . $checkboxName . '"' . $checkboxParameters . $additionalInformation['onFocus'] . $disabled . ' id="' . $checkboxId . '" /> ' . '<label for="' . $checkboxId . '">' . htmlspecialchars($selectedItem[0]) . '</label>'; diff --git a/typo3/sysext/backend/Classes/Form/Element/InlineElement.php b/typo3/sysext/backend/Classes/Form/Element/InlineElement.php index 9a506df79324..f09e8feb7fc0 100644 --- a/typo3/sysext/backend/Classes/Form/Element/InlineElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/InlineElement.php @@ -842,7 +842,7 @@ class InlineElement { $size = $conf['autoSizeMax'] ? MathUtility::forceIntegerInRange(count($selItems) + 1, MathUtility::forceIntegerInRange($size, 1), $conf['autoSizeMax']) : $size; $onChange = 'return inline.importNewRecord(\'' . $this->inlineNames['object'] . self::Structure_Separator . $conf['foreign_table'] . '\')'; $item = ' - <select id="' . $this->inlineNames['object'] . self::Structure_Separator . $conf['foreign_table'] . '_selector"' . $this->fObj->insertDefStyle('select') . ($size ? ' size="' . $size . '"' : '') . ' onchange="' . htmlspecialchars($onChange) . '"' . $PA['onFocus'] . $selector_itemListStyle . ($conf['foreign_unique'] ? ' isunique="isunique"' : '') . '> + <select id="' . $this->inlineNames['object'] . self::Structure_Separator . $conf['foreign_table'] . '_selector" ' . $this->fObj->insertDefStyle('select') . ($size ? ' size="' . $size . '"' : '') . ' onchange="' . htmlspecialchars($onChange) . '"' . $PA['onFocus'] . $selector_itemListStyle . ($conf['foreign_unique'] ? ' isunique="isunique"' : '') . '> ' . implode(' ', $opt) . ' </select>'; diff --git a/typo3/sysext/backend/Classes/Form/Element/RadioElement.php b/typo3/sysext/backend/Classes/Form/Element/RadioElement.php index 82c9338953e0..d3ab13ef8bdb 100644 --- a/typo3/sysext/backend/Classes/Form/Element/RadioElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/RadioElement.php @@ -54,7 +54,7 @@ class RadioElement extends AbstractFormElement { $radioId = $additionalInformation['itemFormElID'] . '_' . $checkbox; $radioOnClick = implode('', $additionalInformation['fieldChangeFunc']); $radioChecked = (string)$selectedItem[1] === (string)$additionalInformation['itemFormElValue'] ? ' checked="checked"' : ''; - $item .= '<input type="radio"' . $this->formEngine->insertDefStyle('radio') . ' name="' . $additionalInformation['itemFormElName'] + $item .= '<input type="radio" ' . $this->formEngine->insertDefStyle('radio') . ' name="' . $additionalInformation['itemFormElName'] . '" value="' . htmlspecialchars($selectedItem[1]) . '" onclick="' . htmlspecialchars($radioOnClick) . '"' . $radioChecked . $additionalInformation['onFocus'] . $disabled . ' id="' . $radioId . '" /> <label for="' . $radioId . '">' . htmlspecialchars($selectedItem[0]) . '</label> diff --git a/typo3/sysext/backend/Classes/Form/Element/SelectElement.php b/typo3/sysext/backend/Classes/Form/Element/SelectElement.php index 50d5b3c23d8d..cbd325accd64 100644 --- a/typo3/sysext/backend/Classes/Form/Element/SelectElement.php +++ b/typo3/sysext/backend/Classes/Form/Element/SelectElement.php @@ -179,7 +179,7 @@ class SelectElement extends AbstractFormElement { $multiSelectId = str_replace('.', '', uniqid('tceforms-multiselect-', TRUE)); $itemsToSelect = ' <select data-relatedfieldname="' . htmlspecialchars($PA['itemFormElName']) . '" data-exclusivevalues="' - . htmlspecialchars($config['exclusiveKeys']) . '" id="' . $multiSelectId . '" name="' . $PA['itemFormElName'] . '_sel"' + . htmlspecialchars($config['exclusiveKeys']) . '" id="' . $multiSelectId . '" name="' . $PA['itemFormElName'] . '_sel" ' . $this->formEngine->insertDefStyle('select', 'tceforms-multiselect tceforms-itemstoselect t3-form-select-itemstoselect') . ($size ? ' size="' . $size . '"' : '') . ' onchange="' . htmlspecialchars($sOnChange) . '"' . $PA['onFocus'] . $selector_itemListStyle . '> @@ -473,7 +473,7 @@ class SelectElement extends AbstractFormElement { if ($config['iconsInOptionTags']) { $classesForSelectTag[] = 'icon-select'; } - $item .= '<select' . $selectedStyle . ' id="' . str_replace('.', '', uniqid('tceforms-select-', TRUE)) . '" name="' . $PA['itemFormElName'] . '"' . $this->formEngine->insertDefStyle('select', implode(' ', $classesForSelectTag)) . ($size ? ' size="' . $size . '"' : '') . ' onchange="' . htmlspecialchars($sOnChange) . '"' . $PA['onFocus'] . $disabled . '>'; + $item .= '<select' . $selectedStyle . ' id="' . str_replace('.', '', uniqid('tceforms-select-', TRUE)) . '" name="' . $PA['itemFormElName'] . '" ' . $this->formEngine->insertDefStyle('select', implode(' ', $classesForSelectTag)) . ($size ? ' size="' . $size . '"' : '') . ' onchange="' . htmlspecialchars($sOnChange) . '"' . $PA['onFocus'] . $disabled . '>'; $item .= implode('', $opt); $item .= '</select>'; // Create icon table: @@ -593,7 +593,7 @@ class SelectElement extends AbstractFormElement { $tRows[] = ' <tr id="' . $rowId . '" class="' . ($sM ? 'c-selectedItem' : 'c-unselectedItem') . '" onclick="' . htmlspecialchars($onClick) . '" style="cursor: pointer;"> - <td class="c-checkbox"><input type="checkbox"' . $this->formEngine->insertDefStyle('check') + <td class="c-checkbox"><input type="checkbox" ' . $this->formEngine->insertDefStyle('check') . ' name="' . htmlspecialchars(($PA['itemFormElName'] . '[' . $c . ']')) . '" value="' . htmlspecialchars($p[1]) . '"' . $sM . ' onclick="' . htmlspecialchars($sOnChange) . '"' . $PA['onFocus'] . ' /></td> @@ -610,7 +610,7 @@ class SelectElement extends AbstractFormElement { // Compile <checkboxes> tag: array_unshift($tRows, ' <tr class="c-invalidItem"> - <td class="c-checkbox"><input type="checkbox"' . $this->formEngine->insertDefStyle('check') + <td class="c-checkbox"><input type="checkbox" ' . $this->formEngine->insertDefStyle('check') . ' name="' . htmlspecialchars(($PA['itemFormElName'] . '[' . $c . ']')) . '" value="' . htmlspecialchars($theNoMatchValue) . '" checked="checked" onclick="' . htmlspecialchars($sOnChange) . '"' . $PA['onFocus'] . $disabled . ' /></td> @@ -715,10 +715,10 @@ class SelectElement extends AbstractFormElement { $size = $config['autoSizeMax'] ? MathUtility::forceIntegerInRange(count($selItems) + 1, MathUtility::forceIntegerInRange($size, 1), $config['autoSizeMax']) : $size; - $selectBox = '<select id="' . str_replace('.', '', uniqid($cssPrefix, TRUE)) . '" name="' . $PA['itemFormElName'] . '[]"' - . $this->formEngine->insertDefStyle('select', $cssPrefix) . ($size ? ' size="' . $size . '"' : '') + $selectBox = '<select id="' . str_replace('.', '', uniqid($cssPrefix, TRUE)) . '" name="' . $PA['itemFormElName'] . '[]" ' + . $this->formEngine->insertDefStyle('select', $cssPrefix) . ($size ? ' size="' . $size . '" ' : '') . ' multiple="multiple" onchange="' . htmlspecialchars($sOnChange) . '"' . $PA['onFocus'] - . $selector_itemListStyle . $disabled . '> + . ' ' . $selector_itemListStyle . $disabled . '> ' . implode(' ', $opt) . ' </select>'; diff --git a/typo3/sysext/backend/Classes/Form/FormEngine.php b/typo3/sysext/backend/Classes/Form/FormEngine.php index e4e51af00508..6c61e5502fea 100644 --- a/typo3/sysext/backend/Classes/Form/FormEngine.php +++ b/typo3/sysext/backend/Classes/Form/FormEngine.php @@ -2291,7 +2291,7 @@ class FormEngine { if (!$selector) { $isMultiple = $params['maxitems'] != 1 && $params['size'] != 1; $selector = '<select id="' . str_replace('.', '', uniqid('tceforms-multiselect-', TRUE)) . '" ' - . ($params['noList'] ? 'style="display: none"' : 'size="' . $sSize . '"' . $this->insertDefStyle('group', 'tceforms-multiselect')) + . ($params['noList'] ? 'style="display: none"' : 'size="' . $sSize . '" ' . $this->insertDefStyle('group', 'tceforms-multiselect')) . ($isMultiple ? ' multiple="multiple"' : '') . ' name="' . $fName . '_list" ' . $onFocus . $params['style'] . $disabled . '>' . implode('', $opt) . '</select>'; diff --git a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php index 15a4d5762e4b..8d0870bc9798 100644 --- a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php +++ b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php @@ -508,7 +508,7 @@ function jumpToUrl(URL) { if ($returnTagParameters) { return $tagParameters; } else { - return '<a href="#"' . GeneralUtility::implodeAttributes($tagParameters) . '>' . $content . '</a>'; + return '<a href="#" ' . GeneralUtility::implodeAttributes($tagParameters) . '>' . $content . '</a>'; } } -- GitLab