Commit 65a3c381 authored by Benjamin Kott's avatar Benjamin Kott Committed by Wouter Wolters
Browse files

[!!!][TASK] This is FormEngine

The patch brings responsive layout for FormEngine and its
elements. It fixes a couple of issues along the way,
escpecially DatePicker and palettes field are aligned in
a better way and wizard icons look much better.

Adjustments:
- Change datepicker to work directly on input without wrapper
- Change clearableJs to bootstrap
- Change dyntabs to bootstrap classes
- Change fixed-font to text-monospace
- Port CheckboxElement to boostrap
- Port GroupElement to bootstrap
- Port InputElement to bootstrap
- Port Irre/Inline to bootstrap
- Port Flexform to bootstrap
- Port Palettes to bootstrap
- Port RadioElements to bootstrap
- Port TextElement to bootstrap
- Port NoneElement to bootstrap

Removes:
- Unused change image javascript removed

Deprecations:
- cssClassTypeElementPrefix not used anymore
- maxTextareaWidth not used anymore
- paletteFieldTemplate not used anymore
- palFieldTemplateHeader not used anymore
- wizard config _PADDING
- wizard config _DISTANCE
- wrapOpenPalette not used anymore
- wrapPaletteField not used anymore
- formWidth not used anymore
- formWidthAsArray not used anymore
- addUserTemplateMarkers not used anymore

Releases: master
Resolves: #64762
Change-Id: I04ce24e63d2395fe25f7d5a314f5868882b2cd74
Reviewed-on: http://review.typo3.org/35951


Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Mathias Schreiber's avatarMathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber's avatarMathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: default avatarMichael Oehlhof <typo3@oehlhof.de>
Tested-by: default avatarMichael Oehlhof <typo3@oehlhof.de>
Reviewed-by: default avatarFrederic Gaus <gaus@flagbit.de>
Tested-by: default avatarFrederic Gaus <gaus@flagbit.de>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent a3ead2f4
......@@ -42,63 +42,55 @@
if (!$input.data('clearable')) {
$input.data('clearable', 'loaded');
var $inputFieldWithValue = $input;
// the hidden field that holds the real data, used in FormEngine
if ($input.next('input[type=hidden]').length) {
$inputFieldWithValue = $input.next('input[type=hidden]');
}
// Wrap it with a div and add a span that is the trigger for
// clearing.
$input.wrap('<div class="t3-clearable-wrapper"/>');
$input.after('<span class="t3-icon t3-icon-actions t3-icon-actions-input t3-icon-input-clear t3-input-clearer"/>');
$input.addClass('t3-clearable');
$input.wrap('<div class="form-control-clearable" />');
$input.after('<button class="close"><span class="fa fa-times" /></button>');
$input.addClass('t3js-clearable');
var $wrapper = $input.parent();
var $clearer = $input.next();
// Add some data to the wrapper indicating if it is currently being
// hovered or not.
$input.data('isHovering', false);
$wrapper.hover(function() {
$input.data('isHovering', true);
}, function() {
$input.data('isHovering', false);
});
// Register a listener the various events triggering the clearer to
// be shown or hidden.
var handler = function() {
var value = $inputFieldWithValue.val();
$element = $(this);
if ($element.next('input[type=hidden]').length) {
$element = $element.next('input[type=hidden]');
}
var value = $element.val();
var hasEmptyValue = (value.length === 0);
if (value == "0" && $inputFieldWithValue.closest('.date').length) {
if (value === "0" && $element.closest('.t3js-datetimepicker').length) {
hasEmptyValue = true;
}
// only show the clearing button if the value is set, or if the value is not "0" on a datetime field
if ($input.data('isHovering') && !hasEmptyValue) {
if (!hasEmptyValue) {
$clearer.show();
} else {
$clearer.hide();
}
};
$wrapper.on('mouseover mouseout', handler);
$input.on('keypress', handler);
$input.on('keyup', handler);
$input.on('mouseenter', handler);
$input.on('change', handler);
$input.on('initialize', handler);
// The actual clearing action. Focus the input element afterwards,
// the user probably wants to type into it after clearing.
$clearer.click(function() {
$input.val('').change().focus();
handler();
$clearer.click(function(e) {
e.preventDefault();
$input.val('').change();
if (!$input.hasClass("t3js-datetimepicker")) {
$input.focus();
}
$input.trigger('keyup');
if ('function' === typeof(settings.onClear)) {
settings.onClear.call($input.get());
}
});
// Initialize the clearer icon
handler();
$input.trigger('initialize');
}
});
};
......
......@@ -160,7 +160,7 @@ class EditFileController {
// Edit textarea:
$code .= '
<div id="c-edit">
<textarea rows="30" name="file[editfile][0][data]" wrap="off"' . $this->doc->formWidth(48, TRUE, 'width:98%;height:80%') . ' class="fixed-font enable-tab">' . GeneralUtility::formatForTextarea($fileContent) . '</textarea>
<textarea rows="30" name="file[editfile][0][data]" wrap="off"' . $this->doc->formWidth(48, TRUE, 'width:98%;height:80%') . ' class="text-monospace enable-tab">' . GeneralUtility::formatForTextarea($fileContent) . '</textarea>
<input type="hidden" name="file[editfile][0][target]" value="' . $this->fileObject->getUid() . '" />
<input type="hidden" name="redirect" value="' . htmlspecialchars($hValue) . '" />
' . \TYPO3\CMS\Backend\Form\FormEngine::getHiddenTokenField('tceAction') . '
......
......@@ -497,26 +497,26 @@ class PageLayoutController {
if (DTM_array[idBase]) {
for(cnt = 0; cnt < DTM_array[idBase].length ; cnt++) {
if (DTM_array[idBase][cnt] != idBase+"-"+index) {
document.getElementById(DTM_array[idBase][cnt]+"-DIV").style.display = "none";
document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
document.getElementById(DTM_array[idBase][cnt]+"-DIV").className = "tab-pane";
document.getElementById(DTM_array[idBase][cnt]+"-MENU").attributes.getNamedItem("class").value = "tab";
}
}
}
// Showing one:
if (document.getElementById(idBase+"-"+index+"-DIV")) {
if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
if (doToogle && document.getElementById(idBase+"-"+index+"-DIV").className === "tab-pane active") {
document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane";
if(DTM_origClass=="") {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "tab";
} else {
DTM_origClass = "tab";
}
top.DTM_currentTabs[idBase] = -1;
} else {
document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane active";
if(DTM_origClass=="") {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "active";
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "active";
} else {
DTM_origClass = "active";
}
......@@ -528,17 +528,17 @@ class PageLayoutController {
// Showing one:
if (document.getElementById(idBase+"-"+index+"-DIV")) {
if (document.getElementById(idBase+"-"+index+"-DIV").style.display == "block") {
document.getElementById(idBase+"-"+index+"-DIV").style.display = "none";
document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane";
if(isInit) {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "tab";
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "tab";
} else {
DTM_origClass = "tab";
}
top.DTM_currentTabs[idBase+"-"+index] = 0;
} else {
document.getElementById(idBase+"-"+index+"-DIV").style.display = "block";
document.getElementById(idBase+"-"+index+"-DIV").className = "tab-pane active";
if(isInit) {
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").nodeValue = "active";
document.getElementById(idBase+"-"+index+"-MENU").attributes.getNamedItem("class").value = "active";
} else {
DTM_origClass = "active";
}
......@@ -546,16 +546,6 @@ class PageLayoutController {
}
}
}
function DTM_mouseOver(obj) { //
DTM_origClass = obj.attributes.getNamedItem(\'class\').nodeValue;
obj.attributes.getNamedItem(\'class\').nodeValue += "_over";
}
function DTM_mouseOut(obj) { //
obj.attributes.getNamedItem(\'class\').nodeValue = DTM_origClass;
DTM_origClass = "";
}
');
// Setting doc-header
$this->doc->form = '<form action="' . htmlspecialchars(
......
......@@ -25,11 +25,6 @@ use TYPO3\CMS\Lang\LanguageService;
*/
abstract class AbstractFormElement {
/**
* @var string A CSS class name prefix for all element types, single elements add their type to this string
*/
protected $cssClassTypeElementPrefix = 't3-formengine-field-';
/**
* @var FormEngine
*/
......
......@@ -159,7 +159,6 @@ class CheckboxElement extends AbstractFormElement {
<label>
<input type="checkbox"
value="1"
class="' . $this->cssClassTypeElementPrefix . 'check"
name="' . $checkboxName . '"
' . $checkboxParameters . '
' . $additionalInformation['onFocus'] . '
......
......@@ -175,8 +175,7 @@ class FlexElement extends AbstractFormElement {
$this->formEngine->pushToDynNestedStack('tab', $tabIdentString . '-' . (count($tabParts) + 1));
}
// Render flexform:
$tRows = $this->getSingleField_typeFlex_draw($dataStruct['ROOT']['el'], $editData['data'][$sheet][$lang], $table, $field, $row, $additionalInformation, '[data][' . $sheet . '][' . $lang . ']');
$sheetContent = '<div class="typo3-TCEforms-flexForm t3-form-flexform">' . $tRows . '</div>';
$sheetContent = $this->getSingleField_typeFlex_draw($dataStruct['ROOT']['el'], $editData['data'][$sheet][$lang], $table, $field, $row, $additionalInformation, '[data][' . $sheet . '][' . $lang . ']');
// Pop the sheet level tab from DynNestedStack
if (is_array($dataStructArray['sheets'])) {
$this->formEngine->popFromDynNestedStack('tab', $tabIdentString . '-' . (count($tabParts) + 1));
......@@ -534,12 +533,20 @@ class FlexElement extends AbstractFormElement {
// possible linebreaks in the label through xml: \n => <br/>, usage of nl2br()
// not possible, so it's done through str_replace
$processedTitle = str_replace('\\n', '<br />', $theTitle);
$tRows[] = '<div class="t3-form-field-container t3-form-field-container-flex">'
. '<div class="t3-form-field-label t3-form-field-label-flex">' . $languageIcon
. BackendUtility::wrapInHelp($PA['_cshKey'], $key, $processedTitle) . '</div>
<div class="t3-form-field t3-form-field-flex">' . $theFormEl . $defInfo
. $this->renderVDEFDiff($editData[$key], $vDEFkey) . '</div>
</div>';
$tRows[] = '
<div class="form-section">
<div class="form-group t3js-formengine-palette-field">
<label class="t3js-formengine-label">
' . $languageIcon . '
' . BackendUtility::wrapInHelp($PA['_cshKey'], $key, $processedTitle) . '
</label>
<div class="t3js-formengine-field-item">
' . $theFormEl . '
' . $defInfo . '
' . $this->renderVDEFDiff($editData[$key], $vDEFkey) . '
</div>
</div>
</div>';
}
}
if (count($tRows)) {
......
......@@ -38,30 +38,40 @@ class GroupElement extends AbstractFormElement {
* @return string The HTML code for the TCEform field
*/
public function render($table, $field, $row, &$additionalInformation) {
$config = $additionalInformation['fieldConf']['config'];
$show_thumbs = $config['show_thumbs'];
$size = isset($config['size']) ? (int)$config['size'] : 5;
$size = isset($config['size']) ? (int)$config['size'] : $this->formEngine->minimumInputWidth;
$maxitems = MathUtility::forceIntegerInRange($config['maxitems'], 0);
if (!$maxitems) {
$maxitems = 100000;
}
$minitems = MathUtility::forceIntegerInRange($config['minitems'], 0);
$allowed = trim($config['allowed']);
$disallowed = trim($config['disallowed']);
$item = '';
$disabled = '';
if ($this->isRenderReadonly() || $config['readOnly']) {
$disabled = ' disabled="disabled"';
}
$item .= '<input type="hidden" name="' . $additionalInformation['itemFormElName'] . '_mul" value="' . ($config['multiple'] ? 1 : 0) . '"' . $disabled . ' />';
$this->formEngine->registerRequiredProperty('range', $additionalInformation['itemFormElName'], array($minitems, $maxitems, 'imgName' => $table . '_' . $row['uid'] . '_' . $field));
$info = '';
// "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist.
$specConf = BackendUtility::getSpecConfParts($additionalInformation['extra'], $additionalInformation['fieldConf']['defaultExtras']);
$thumbnails = array();
$allowed = GeneralUtility::trimExplode(',', $config['allowed'], TRUE);
$disallowed = GeneralUtility::trimExplode(',', $config['disallowed'], TRUE);
$disabled = ($this->isRenderReadonly() || $config['readOnly']);
$info = array();
$additionalInformation['itemFormElID_file'] = $additionalInformation['itemFormElID'] . '_files';
// whether the list and delete controls should be disabled
$noList = isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'list');
$noDelete = isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'delete');
// "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist.
$specConf = BackendUtility::getSpecConfParts($additionalInformation['extra'], $additionalInformation['fieldConf']['defaultExtras']);
// Register properties in requiredFields and requiredElements
$this->formEngine->registerRequiredProperty(
'range',
$additionalInformation['itemFormElName'],
array(
$minitems,
$maxitems,
'imgName' => $table . '_' . $row['uid'] . '_' . $field
)
);
// if maxitems==1 then automatically replace the current item (in list and file selector)
if ($maxitems === 1) {
$this->formEngine->additionalJS_post[] = 'TBE_EDITOR.clearBeforeSettingFormValueFromBrowseWin[\'' . $additionalInformation['itemFormElName'] . '\'] = {
......@@ -74,6 +84,9 @@ class GroupElement extends AbstractFormElement {
$additionalInformation['fieldChangeFunc']['TBE_EDITOR_fieldChanged'] = 'setFormValueManipulate(\'' . $additionalInformation['itemFormElName']
. '\', \'RemoveFirstIfFull\', \'' . $maxitems . '\'); ' . $additionalInformation['fieldChangeFunc']['TBE_EDITOR_fieldChanged'];
}
$item = '<input type="hidden" name="' . $additionalInformation['itemFormElName'] . '_mul" value="' . ($config['multiple'] ? 1 : 0) . '"' . $disabled . ' />';
// Acting according to either "file" or "db" type:
switch ((string)$config['internal_type']) {
case 'file_reference':
......@@ -81,24 +94,8 @@ class GroupElement extends AbstractFormElement {
// Fall through
case 'file':
// Creating string showing allowed types:
$tempFT = GeneralUtility::trimExplode(',', $allowed, TRUE);
if (!count($tempFT)) {
$info .= '*';
}
foreach ($tempFT as $ext) {
if ($ext) {
$info .= strtoupper($ext) . ' ';
}
}
// Creating string, showing disallowed types:
$tempFT_dis = GeneralUtility::trimExplode(',', $disallowed, TRUE);
if (count($tempFT_dis)) {
$info .= '<br />';
}
foreach ($tempFT_dis as $ext) {
if ($ext) {
$info .= '-' . strtoupper($ext) . ' ';
}
if (!count($allowed)) {
$allowed = array('*');
}
// Making the array of file items:
$itemArray = GeneralUtility::trimExplode(',', $additionalInformation['itemFormElValue'], TRUE);
......@@ -113,7 +110,6 @@ class GroupElement extends AbstractFormElement {
$fileItem = $fileUid . '|' . $fileLabel;
}
// Showing thumbnails:
$thumbsnail = '';
if ($show_thumbs) {
$imgs = array();
foreach ($itemArray as $imgRead) {
......@@ -122,30 +118,39 @@ class GroupElement extends AbstractFormElement {
// FAL icon production
if (MathUtility::canBeInterpretedAsInteger($imgP[0])) {
$fileObject = $fileFactory->getFileObject($imgP[0]);
if ($fileObject->isMissing()) {
$flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
$imgs[] = $flashMessage->render();
$thumbnails[] = array(
'message' => \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject)->render()
);
} elseif (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileObject->getExtension())) {
$imageUrl = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array())->getPublicUrl(TRUE);
$imgTag = '<img src="' . $imageUrl . '" alt="' . htmlspecialchars($fileObject->getName()) . '" />';
$imgs[] = '<span class="nobr">' . $imgTag . htmlspecialchars($fileObject->getName()) . '</span>';
$thumbnails[] = array(
'name' => htmlspecialchars($fileObject->getName()),
'image' => $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array())->getPublicUrl(TRUE)
);
} else {
// Icon
$imgTag = IconUtility::getSpriteIconForResource($fileObject, array('title' => $fileObject->getName()));
$imgs[] = '<span class="nobr">' . $imgTag . htmlspecialchars($fileObject->getName()) . '</span>';
$thumbnails[] = array(
'name' => htmlspecialchars($fileObject->getName()),
'image' => IconUtility::getSpriteIconForResource($fileObject, array('title' => $fileObject->getName()))
);
}
} else {
$rowCopy = array();
$rowCopy[$field] = $imgPath;
$thumbnailCode = '';
try {
$thumbnailCode = BackendUtility::thumbCode(
$rowCopy, $table, $field, $this->formEngine->backPath, 'thumbs.php',
$config['uploadfolder'], 0, ' align="middle"'
$thumbnails[] = array(
'name' => $imgPath,
'image' => BackendUtility::thumbCode(
$rowCopy,
$table,
$field,
$this->formEngine->backPath,
'thumbs.php',
$config['uploadfolder'],
0,
' align="middle"'
)
);
$thumbnailCode = '<span class="nobr">' . $thumbnailCode . $imgPath . '</span>';
} catch (\Exception $exception) {
/** @var $flashMessage FlashMessage */
$message = $exception->getMessage();
......@@ -157,33 +162,41 @@ class GroupElement extends AbstractFormElement {
$flashMessageService = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessageService::class);
$defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier();
$defaultFlashMessageQueue->enqueue($flashMessage);
$logMessage = $message . ' (' . $table . ':' . $row['uid'] . ')';
GeneralUtility::sysLog($logMessage, 'core', GeneralUtility::SYSLOG_SEVERITY_WARNING);
}
$imgs[] = $thumbnailCode;
}
}
$thumbsnail = implode('<br />', $imgs);
}
// Creating the element:
$params = array(
'size' => $size,
'allowed' => $allowed,
'disallowed' => $disallowed,
'dontShowMoveIcons' => $maxitems <= 1,
'autoSizeMax' => MathUtility::forceIntegerInRange($config['autoSizeMax'], 0),
'maxitems' => $maxitems,
'style' => isset($config['selectedListStyle'])
? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
: ' style="' . $this->formEngine->defaultMultipleSelectorStyle . '"',
'info' => $info,
'thumbnails' => $thumbsnail,
'thumbnails' => $thumbnails,
'readOnly' => $disabled,
'noBrowser' => $noList || isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'browser'),
'noList' => $noList,
'noDelete' => $noDelete
);
$item .= $this->formEngine->dbFileIcons($additionalInformation['itemFormElName'], 'file', implode(',', $tempFT), $itemArray, '', $params, $additionalInformation['onFocus'], '', '', '', $config);
$item .= $this->formEngine->dbFileIcons(
$additionalInformation['itemFormElName'],
'file',
implode(',', $allowed),
$itemArray,
'',
$params,
$additionalInformation['onFocus'],
'',
'',
'',
$config);
if (!$disabled && !(isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'upload'))) {
// Adding the upload field:
if ($this->formEngine->edit_docModuleUpload && $config['uploadfolder']) {
......@@ -194,9 +207,13 @@ class GroupElement extends AbstractFormElement {
$multipleAttribute = ' multiple="multiple"';
$multipleFilenameSuffix = '[]';
}
$item .= '<div id="' . $additionalInformation['itemFormElID_file'] . '"><input type="file"' . $multipleAttribute
. ' name="' . $additionalInformation['itemFormElName_file'] . $multipleFilenameSuffix . '" size="35" onchange="'
. implode('', $additionalInformation['fieldChangeFunc']) . '" /></div>';
$item .= '
<div id="' . $additionalInformation['itemFormElID_file'] . '">
<input type="file"' . $multipleAttribute . '
name="' . $additionalInformation['itemFormElName_file'] . $multipleFilenameSuffix . '"
size="35" onchange="' . implode('', $additionalInformation['fieldChangeFunc']) . '"
/>
</div>';
}
}
break;
......@@ -213,34 +230,45 @@ class GroupElement extends AbstractFormElement {
'style' => isset($config['selectedListStyle'])
? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
: ' style="' . $this->formEngine->defaultMultipleSelectorStyle . '"',
'info' => $info,
'readOnly' => $disabled,
'noBrowser' => $noList || isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'browser'),
'noList' => $noList
);
$item .= $this->formEngine->dbFileIcons($additionalInformation['itemFormElName'], 'folder', '', $itemArray, '', $params, $additionalInformation['onFocus']);
$item .= $this->formEngine->dbFileIcons(
$additionalInformation['itemFormElName'],
'folder',
'',
$itemArray,
'',
$params,
$additionalInformation['onFocus']
);
break;
case 'db':
// If the element is of the internal type "db":
// Creating string showing allowed types:
$tempFT = GeneralUtility::trimExplode(',', $allowed, TRUE);
$onlySingleTableAllowed = FALSE;
$languageService = $this->getLanguageService();
if (trim($tempFT[0]) === '*') {
$info .= '<span class="nobr">' . htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.allTables')) . '</span><br />';
} elseif ($tempFT) {
$onlySingleTableAllowed = count($tempFT) == 1;
foreach ($tempFT as $theT) {
$aOnClick = 'setFormValueOpenBrowser(\'db\', \'' . ($additionalInformation['itemFormElName'] . '|||' . $theT) . '\'); return false;';
$info .= '<span class="nobr">
<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">'
. IconUtility::getSpriteIconForRecord($theT, array())
. htmlspecialchars($languageService->sL($GLOBALS['TCA'][$theT]['ctrl']['title'])) . '</a></span><br />';
if ($allowed[0] === '*') {
$allowedTables = array(
'name' => htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:labels.allTables'))
);
} elseif ($allowed) {
$onlySingleTableAllowed = count($allowed) == 1;
$allowedTables = array();
foreach ($allowed as $allowedTable) {
$allowedTables[] = array(
'name' => htmlspecialchars($languageService->sL($GLOBALS['TCA'][$allowedTable]['ctrl']['title'])),
'icon' => IconUtility::getSpriteIconForRecord($allowedTable, array()),
'onClick' => 'setFormValueOpenBrowser(\'db\', \'' . ($additionalInformation['itemFormElName'] . '|||' . $allowedTable) . '\'); return false;'
);
}
}
$perms_clause = $this->getBackendUserAuthentication()->getPagePermsClause(1);
$itemArray = array();
$imgs = array();
// Thumbnails:
$temp_itemArray = GeneralUtility::trimExplode(',', $additionalInformation['itemFormElValue'], TRUE);
foreach ($temp_itemArray as $dbRead) {
......@@ -253,17 +281,15 @@ class GroupElement extends AbstractFormElement {
$itemArray[] = array('table' => $this_table, 'id' => $this_uid);
if (!$disabled && $show_thumbs) {
$rr = BackendUtility::getRecordWSOL($this_table, $this_uid);
$imgs[] = '<span class="nobr">' . $this->formEngine->getClickMenu(IconUtility::getSpriteIconForRecord($this_table, $rr, array(
'style' => 'vertical-align:top',
'title' => htmlspecialchars((BackendUtility::getRecordPath($rr['pid'], $perms_clause, 15) . ' [UID: ' . $rr['uid'] . ']'))
)), $this_table, $this_uid) . '&nbsp;' . BackendUtility::getRecordTitle($this_table, $rr, TRUE)
. ' <span class="typo3-dimmed"><em>[' . $rr['uid'] . ']</em></span>' . '</span>';
$thumbnails[] = array(
'name' => BackendUtility::getRecordTitle($this_table, $rr, TRUE),
'image' => IconUtility::getSpriteIconForRecord($this_table, $rr),
'path' => BackendUtility::getRecordPath($rr['pid'], $perms_clause, 15),
'uid' => $rr['uid'],
'table' => $this_table
);
}
}
$thumbsnail = '';
if (!$disabled && $show_thumbs) {
$thumbsnail = implode('<br />', $imgs);
}
// Creating the element:
$params = array(
'size' => $size,
......@@ -274,18 +300,43 @@ class GroupElement extends AbstractFormElement {
? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
: ' style="' . $this->formEngine->defaultMultipleSelectorStyle . '"',
'info' => $info,
'thumbnails' => $thumbsnail,
'allowedTables' => $allowedTables,
'thumbnails' => $thumbnails,
'readOnly' => $disabled,
'noBrowser' => $noList || isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'browser'),
'noList' => $noList
);
$item .= $this->formEngine->dbFileIcons($additionalInformation['itemFormElName'], 'db', implode(',', $tempFT), $itemArray, '', $params, $additionalInformation['onFocus'], $table, $field, $row['uid'], $config);
$item .= $this->formEngine->dbFileIcons(
$additionalInformation['itemFormElName'],
'db',
implode(',', $allowed),
$itemArray,
'',
$params,
$additionalInformation['onFocus'],
$table,
$field,
$row['uid'],
$config
);
break;
}
// Wizards:
$altItem = '<input type="hidden" name="' . $additionalInformation['itemFormElName'] . '" value="' . htmlspecialchars($additionalInformation['itemFormElValue']) . '" />';
if (!$disabled) {
$item = $this->formEngine->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $additionalInformation, $additionalInformation['itemFormElName'], $specConf);
$item = $this->formEngine->renderWizards(
array(
$item,
$altItem
),
$config['wizards'],
$table,
$row,
$field,
$additionalInformation,
$additionalInformation['itemFormElName'],
$specConf
);