/** * Returns a linked image-tag for thumbnail(s)/fileicons/truetype-font-previews from a database row with a list of image files in a field * All $TYPO3_CONF_VARS['GFX']['imagefile_ext'] extension are made to thumbnails + ttf file (renders font-example) * Thumbsnails are linked to the show_item.php script which will display further details. * Usage: 7 * * @param array $row is the database row from the table, $table. * @param string Table name for $row (present in TCA) * @param string $field is pointing to the field with the list of image files * @param string Back path prefix for image tag src="" field * @param string Optional: $thumbScript os by default 'thumbs.php' if you don't set it otherwise * @param string Optional: $uploaddir is the directory relative to PATH_site where the image files from the $field value is found (Is by default set to the entry in $TCA for that field! so you don't have to!) * @param boolean If set, uploaddir is NOT prepended with "../" * @param string Optional: $tparams is additional attributes for the image tags * @param integer Optional: $size is [w]x[h] of the thumbnail. 56 is default. * @return string Thumbnail image tag. */ public static function thumbCode($row, $table, $field, $backPath, $thumbScript = '', $uploaddir = NULL, $abs = 0, $tparams = '', $size = '') { global $TCA; // Load table. t3lib_div::loadTCA($table); // Find uploaddir automatically $uploaddir = is_null($uploaddir) ? $TCA[$table]['columns'][$field]['config']['uploadfolder'] : $uploaddir; $uploaddir = preg_replace('#/$#', '', $uploaddir); // Set thumbs-script: if (!$GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails']) { $thumbScript = 'gfx/notfound_thumb.gif'; } elseif (!$thumbScript) { $thumbScript = 'thumbs.php'; } // Check and parse the size parameter $sizeParts = array(); if ($size = trim($size)) { $sizeParts = explode('x', $size . 'x' . $size); if (!intval($sizeParts[0])) { $size = ''; } } // Traverse files: $thumbs = explode(',', $row[$field]); $thumbData = ''; foreach ($thumbs as $theFile) { if (trim($theFile)) { $fI = t3lib_div::split_fileref($theFile); $ext = $fI['fileext']; // New 190201 start $max = 0; if (t3lib_div::inList('gif,jpg,png', $ext)) { $imgInfo = @getimagesize(PATH_site . $uploaddir . '/' . $theFile); if (is_array($imgInfo)) { $max = max($imgInfo[0], $imgInfo[1]); } } // use the original image if it's size fits to the thumbnail size if ($max && $max <= (count($sizeParts) && max($sizeParts) ? max($sizeParts) : 56)) { $theFile = $url = ($abs ? '' : '../') . ($uploaddir ? $uploaddir . '/' : '') . trim($theFile); $onClick = 'top.launchView(\'' . $theFile . '\',\'\',\'' . $backPath . '\');return false;'; $thumbData .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '"><img src="' . $backPath . $url . '" ' . $imgInfo[3] . ' hspace="2" border="0" title="' . trim($url) . '"' . $tparams . ' alt="" /></a> '; // New 190201 stop } elseif ($ext == 'ttf' || t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $ext)) { $theFile_abs = PATH_site . ($uploaddir ? $uploaddir . '/' : '') . trim($theFile); $theFile = ($abs ? '' : '../') . ($uploaddir ? $uploaddir . '/' : '') . trim($theFile); if (!is_readable($theFile_abs)) { $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.file_missing_text') . ' <abbr title="' . $theFile_abs . '">' . $theFile . '</abbr>', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:warning.file_missing'), t3lib_FlashMessage::ERROR); $thumbData .= $flashMessage->render(); continue; } $check = basename($theFile_abs) . ':' . filemtime($theFile_abs) . ':' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']; $params = '&file=' . rawurlencode($theFile); $params .= $size ? '&size=' . $size : ''; $params .= '&md5sum=' . t3lib_div::shortMD5($check); $url = $thumbScript . '?&dummy=' . $GLOBALS['EXEC_TIME'] . $params; $onClick = 'top.launchView(\'' . $theFile . '\',\'\',\'' . $backPath . '\');return false;'; $thumbData .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '"><img src="' . htmlspecialchars($backPath . $url) . '" hspace="2" border="0" title="' . trim($theFile) . '"' . $tparams . ' alt="" /></a> '; } else { // Icon $theFile_abs = PATH_site . ($uploaddir ? $uploaddir . '/' : '') . trim($theFile); $theFile = ($abs ? '' : '../') . ($uploaddir ? $uploaddir . '/' : '') . trim($theFile); $fileIcon = t3lib_iconWorks::getSpriteIconForFile(strtolower($ext), array('title' => htmlspecialchars(trim($theFile)))); $check = basename($theFile_abs) . ':' . filemtime($theFile_abs) . ':' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']; $params = '&file=' . rawurlencode($theFile); $params .= $size ? '&size=' . $size : ''; $params .= '&md5sum=' . t3lib_div::shortMD5($check); $url = $thumbScript . '?&dummy=' . $GLOBALS['EXEC_TIME'] . $params; $onClick = 'top.launchView(\'' . $theFile . '\',\'\',\'' . $backPath . '\');return false;'; $thumbData .= '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $fileIcon . '</a> '; } } } return $thumbData; }
/** * Main function. Will generate the information to display for the item set internally. * * @param string <a> tag closing/returning. * @return void */ function renderFileInfo($returnLinkTag) { // Initialize object to work on the image: $imgObj = t3lib_div::makeInstance('t3lib_stdGraphic'); $imgObj->init(); $imgObj->mayScaleUp = 0; $imgObj->absPrefix = PATH_site; // Read Image Dimensions (returns false if file was not an image type, otherwise dimensions in an array) $imgInfo = ''; $imgInfo = $imgObj->getImageDimensions($this->file); // File information $fI = t3lib_div::split_fileref($this->file); $ext = $fI['fileext']; $code = ''; // Setting header: $fileName = t3lib_iconWorks::getSpriteIconForFile($ext) . '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.file', TRUE) . ':</strong> ' . $fI['file']; if (t3lib_div::isFirstPartOfStr($this->file, PATH_site)) { $code .= '<a href="../' . substr($this->file, strlen(PATH_site)) . '" target="_blank">' . $fileName . '</a>'; } else { $code .= $fileName; } $code .= ' <strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.filesize') . ':</strong> ' . t3lib_div::formatSize(@filesize($this->file)) . '<br /> '; if (is_array($imgInfo)) { $code .= '<strong>' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.dimensions') . ':</strong> ' . $imgInfo[0] . 'x' . $imgInfo[1] . ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.pixels'); } $this->content .= $this->doc->section('', $code); $this->content .= $this->doc->divider(2); // If the file was an image...: if (is_array($imgInfo)) { $imgInfo = $imgObj->imageMagickConvert($this->file, 'web', '346', '200m', '', '', '', 1); $imgInfo[3] = '../' . substr($imgInfo[3], strlen(PATH_site)); $code = '<br /> <div align="center">' . $returnLinkTag . $imgObj->imgTag($imgInfo) . '</a></div>'; $this->content .= $this->doc->section('', $code); } else { $this->content .= $this->doc->spacer(10); $lowerFilename = strtolower($this->file); // Archive files: if (TYPO3_OS != 'WIN' && !$GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function']) { if ($ext == 'zip') { $code = ''; $t = array(); t3lib_utility_Command::exec('unzip -l ' . $this->file, $t); if (is_array($t)) { reset($t); next($t); next($t); next($t); while (list(, $val) = each($t)) { $parts = explode(' ', trim($val), 7); $code .= ' ' . $parts[6] . '<br />'; } $code = ' <span class="nobr">' . $code . ' </span> <br /><br />'; } $this->content .= $this->doc->section('', $code); } elseif ($ext == 'tar' || $ext == 'tgz' || substr($lowerFilename, -6) == 'tar.gz' || substr($lowerFilename, -5) == 'tar.z') { $code = ''; if ($ext == 'tar') { $compr = ''; } else { $compr = 'z'; } $t = array(); t3lib_utility_Command::exec('tar t' . $compr . 'f ' . $this->file, $t); if (is_array($t)) { foreach ($t as $val) { $code .= ' ' . $val . '<br />'; } $code .= ' -------<br/> ' . count($t) . ' ' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.files'); $code = ' <span class="nobr">' . $code . ' </span> <br /><br />'; } $this->content .= $this->doc->section('', $code); } } elseif ($GLOBALS['TYPO3_CONF_VARS']['BE']['disable_exec_function']) { $this->content .= $this->doc->section('', $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.cannotDisplayArchive')); } // Font files: if ($ext == 'ttf') { $thumbScript = 'thumbs.php'; $check = basename($this->file) . ':' . filemtime($this->file) . ':' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey']; $params = '&file=' . rawurlencode($this->file); $params .= '&md5sum=' . t3lib_div::shortMD5($check); $url = $thumbScript . '?&dummy=' . $GLOBALS['EXEC_TIME'] . $params; $thumb = '<br /> <div align="center">' . $returnLinkTag . '<img src="' . htmlspecialchars($url) . '" border="0" title="' . htmlspecialchars(trim($this->file)) . '" alt="" /></a></div>'; $this->content .= $this->doc->section('', $thumb); } } // References: $this->content .= $this->doc->section($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:show_item.php.referencesToThisItem'), $this->makeRef('_FILE', $this->file)); }
/** * Print the content on a pad. Called from ->printClipboard() * * @param string Pad reference * @return array Array with table rows for the clipboard. * @access private */ function printContentFromTab($pad) { global $TBE_TEMPLATE; $lines = array(); if (is_array($this->clipData[$pad]['el'])) { foreach ($this->clipData[$pad]['el'] as $k => $v) { if ($v) { list($table, $uid) = explode('|', $k); $bgColClass = $table == '_FILE' && $this->fileMode || $table != '_FILE' && !$this->fileMode ? 'bgColor4-20' : 'bgColor4'; if ($table == '_FILE') { // Rendering files/directories on the clipboard: if (file_exists($v) && t3lib_div::isAllowedAbsPath($v)) { $fI = pathinfo($v); $icon = is_dir($v) ? 'folder.gif' : t3lib_BEfunc::getFileIcon(strtolower($fI['extension'])); $size = ' (' . t3lib_div::formatSize(filesize($v)) . 'bytes)'; $icon = t3lib_iconWorks::getSpriteIconForFile(is_dir($v) ? 'folder' : strtolower($fI['extension']), array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars($fI['basename'] . $size))); $thumb = $this->clipData['_setThumb'] ? t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fI['extension']) ? t3lib_BEfunc::getThumbNail($this->backPath . 'thumbs.php', $v, ' vspace="4"') : '' : ''; $lines[] = ' <tr> <td class="' . $bgColClass . '">' . $icon . '</td> <td class="' . $bgColClass . '" nowrap="nowrap" width="95%"> ' . $this->linkItemText(htmlspecialchars(t3lib_div::fixed_lgd_cs(basename($v), $GLOBALS['BE_USER']->uc['titleLen'])), $v) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . ' ' . ($thumb ? '<br />' . $thumb : '') . '</td> <td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $v . '\', \'\'); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl('_FILE', t3lib_div::shortmd5($v))) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td> </tr>'; } else { // If the file did not exist (or is illegal) then it is removed from the clipboard immediately: unset($this->clipData[$pad]['el'][$k]); $this->changed = 1; } } else { // Rendering records: $rec = t3lib_BEfunc::getRecordWSOL($table, $uid); if (is_array($rec)) { $lines[] = ' <tr> <td class="' . $bgColClass . '">' . $this->linkItemText(t3lib_iconWorks::getSpriteIconForRecord($table, $rec, array('style' => 'margin: 0 20px;', 'title' => htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($rec, $table)))), $rec, $table) . '</td> <td class="' . $bgColClass . '" nowrap="nowrap" width="95%"> ' . $this->linkItemText(htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table, $rec), $GLOBALS['BE_USER']->uc['titleLen'])), $rec, $table) . ($pad == 'normal' ? ' <strong>(' . ($this->clipData['normal']['mode'] == 'copy' ? $this->clLabel('copy', 'cm') : $this->clLabel('cut', 'cm')) . ')</strong>' : '') . ' </td> <td class="' . $bgColClass . '" align="center" nowrap="nowrap">' . '<a href="#" onclick="' . htmlspecialchars('top.launchView(\'' . $table . '\', \'' . intval($uid) . '\'); return false;') . '">' . t3lib_iconWorks::getSpriteIcon('actions-document-info', array('title' => $this->clLabel('info', 'cm'))) . '</a>' . '<a href="' . htmlspecialchars($this->removeUrl($table, $uid)) . '#clip_head">' . t3lib_iconWorks::getSpriteIcon('actions-selection-delete', array('title' => $this->clLabel('removeItem'))) . '</a>' . '</td> </tr>'; $localizationData = $this->getLocalizations($table, $rec, $bgColClass, $pad); if ($localizationData) { $lines[] = $localizationData; } } else { unset($this->clipData[$pad]['el'][$k]); $this->changed = 1; } } } } } if (!count($lines)) { $lines[] = ' <tr> <td class="bgColor4"><img src="clear.gif" width="56" height="1" alt="" /></td> <td colspan="2" class="bgColor4" nowrap="nowrap" width="95%"> <em>(' . $this->clLabel('clipNoEl') . ')</em> </td> </tr>'; } $this->endClipboard(); return $lines; }
/** * Rendering preview output of a field value which is not shown as a form field but just outputted. * * @param string The value to output * @param array Configuration for field. * @param string Name of field. * @return string HTML formatted output */ function previewFieldValue($value, $config, $field = '') { if ($config['config']['type'] === 'group' && ($config['config']['internal_type'] === 'file' || $config['config']['internal_type'] === 'file_reference')) { // Ignore uploadfolder if internal_type is file_reference if ($config['config']['internal_type'] === 'file_reference') { $config['config']['uploadfolder'] = ''; } $show_thumbs = TRUE; $table = 'tt_content'; // Making the array of file items: $itemArray = t3lib_div::trimExplode(',', $value, 1); // Showing thumbnails: $thumbsnail = ''; if ($show_thumbs) { $imgs = array(); foreach ($itemArray as $imgRead) { $imgP = explode('|', $imgRead); $imgPath = rawurldecode($imgP[0]); $rowCopy = array(); $rowCopy[$field] = $imgPath; // Icon + clickmenu: $absFilePath = t3lib_div::getFileAbsFileName($config['config']['uploadfolder'] ? $config['config']['uploadfolder'] . '/' . $imgPath : $imgPath); $fileInformation = pathinfo($imgPath); $fileIcon = t3lib_iconWorks::getSpriteIconForFile($imgPath, array('title' => htmlspecialchars($fileInformation['basename'] . ($absFilePath && @is_file($absFilePath) ? ' (' . t3lib_div::formatSize(filesize($absFilePath)) . 'bytes)' : ' - FILE NOT FOUND!')))); $imgs[] = '<span class="nobr">' . t3lib_BEfunc::thumbCode($rowCopy, $table, $field, $this->backPath, 'thumbs.php', $config['config']['uploadfolder'], 0, ' align="middle"') . ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon) . $imgPath . '</span>'; } $thumbsnail = implode('<br />', $imgs); } return $thumbsnail; } else { return nl2br(htmlspecialchars($value)); } }
/** * Make 1st level clickmenu: * * @param string The absolute path * @return string HTML content */ function printFileClickMenu($path) { $menuItems = array(); if (file_exists($path) && t3lib_div::isAllowedAbsPath($path)) { $fI = pathinfo($path); $size = ' (' . t3lib_div::formatSize(filesize($path)) . 'bytes)'; $icon = t3lib_iconWorks::getSpriteIconForFile(is_dir($path) ? 'folder' : strtolower($fI['extension']), array('class' => 'absmiddle', 'title' => htmlspecialchars($fI['basename'] . $size))); // edit if (!in_array('edit', $this->disabledItems) && is_file($path) && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'], $fI['extension'])) { $menuItems['edit'] = $this->FILE_launch($path, 'file_edit.php', 'edit', 'edit_file.gif'); } // rename if (!in_array('rename', $this->disabledItems)) { $menuItems['rename'] = $this->FILE_launch($path, 'file_rename.php', 'rename', 'rename.gif'); } // upload if (!in_array('upload', $this->disabledItems) && is_dir($path)) { $menuItems['upload'] = $this->FILE_upload($path); } // new if (!in_array('new', $this->disabledItems) && is_dir($path)) { $menuItems['new'] = $this->FILE_launch($path, 'file_newfolder.php', 'new', 'new_file.gif'); } // info if (!in_array('info', $this->disabledItems)) { $menuItems['info'] = $this->DB_info($path, ''); } $menuItems[] = 'spacer'; // copy: if (!in_array('copy', $this->disabledItems)) { $menuItems['copy'] = $this->FILE_copycut($path, 'copy'); } // cut: if (!in_array('cut', $this->disabledItems)) { $menuItems['cut'] = $this->FILE_copycut($path, 'cut'); } // Paste: $elFromAllTables = count($this->clipObj->elFromTable('_FILE')); if (!in_array('paste', $this->disabledItems) && $elFromAllTables && is_dir($path)) { $elArr = $this->clipObj->elFromTable('_FILE'); reset($elArr); $selItem = current($elArr); $elInfo = array(basename($selItem), basename($path), $this->clipObj->currentMode()); $menuItems['pasteinto'] = $this->FILE_paste($path, $selItem, $elInfo); } $menuItems[] = 'spacer'; // delete: if (!in_array('delete', $this->disabledItems)) { $menuItems['delete'] = $this->FILE_delete($path); } } // Adding external elements to the menuItems array $menuItems = $this->processingByExtClassArray($menuItems, $path, 0); // Processing by external functions? $menuItems = $this->externalProcessingOfFileMenuItems($menuItems); // Return the printed elements: return $this->printItems($menuItems, $icon . basename($path)); }
/** * Generation of TCEform elements of the type "group" * This will render a selectorbox into which elements from either the file system or database can be inserted. Relations. * * @param string The table name of the record * @param string The field name which this element is supposed to edit * @param array The record data array where the value(s) for the field can be found * @param array An array with additional configuration options. * @return string The HTML code for the TCEform field */ function getSingleField_typeGroup($table, $field, $row, &$PA) { // Init: $config = $PA['fieldConf']['config']; $internal_type = $config['internal_type']; $show_thumbs = $config['show_thumbs']; $size = intval($config['size']); $maxitems = t3lib_div::intInRange($config['maxitems'], 0); if (!$maxitems) { $maxitems = 100000; } $minitems = t3lib_div::intInRange($config['minitems'], 0); $allowed = trim($config['allowed']); $disallowed = trim($config['disallowed']); $disabled = ''; if ($this->renderReadonly || $config['readOnly']) { $disabled = ' disabled="disabled"'; } $item .= '<input type="hidden" name="' . $PA['itemFormElName'] . '_mul" value="' . ($config['multiple'] ? 1 : 0) . '"' . $disabled . ' />'; $this->registerRequiredProperty('range', $PA['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. See http://typo3.org/documentation/document-library/doc_core_api/Wizards_Configuratio/. $specConf = $this->getSpecConfFromString($PA['extra'], $PA['fieldConf']['defaultExtras']); // Acting according to either "file" or "db" type: switch ((string) $config['internal_type']) { case 'file_reference': $config['uploadfolder'] = ''; // Fall through // Fall through case 'file': // If the element is of the internal type "file": // Creating string showing allowed types: $tempFT = t3lib_div::trimExplode(',', $allowed, 1); if (!count($tempFT)) { $info .= '*'; } foreach ($tempFT as $ext) { if ($ext) { $info .= strtoupper($ext) . ' '; } } // Creating string, showing disallowed types: $tempFT_dis = t3lib_div::trimExplode(',', $disallowed, 1); if (count($tempFT_dis)) { $info .= '<br />'; } foreach ($tempFT_dis as $ext) { if ($ext) { $info .= '-' . strtoupper($ext) . ' '; } } // Making the array of file items: $itemArray = t3lib_div::trimExplode(',', $PA['itemFormElValue'], 1); // Showing thumbnails: $thumbsnail = ''; if ($show_thumbs) { $imgs = array(); foreach ($itemArray as $imgRead) { $imgP = explode('|', $imgRead); $imgPath = rawurldecode($imgP[0]); $rowCopy = array(); $rowCopy[$field] = $imgPath; // Icon + clickmenu: $absFilePath = t3lib_div::getFileAbsFileName($config['uploadfolder'] ? $config['uploadfolder'] . '/' . $imgPath : $imgPath); $fI = pathinfo($imgPath); $fileIcon = t3lib_iconWorks::getSpriteIconForFile(strtolower($fI['extension']), array('title' => htmlspecialchars($fI['basename'] . ($absFilePath && @is_file($absFilePath) ? ' (' . t3lib_div::formatSize(filesize($absFilePath)) . 'bytes)' : ' - FILE NOT FOUND!')))); $imgs[] = '<span class="nobr">' . t3lib_BEfunc::thumbCode($rowCopy, $table, $field, $this->backPath, 'thumbs.php', $config['uploadfolder'], 0, ' align="middle"') . ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon) . $imgPath . '</span>'; } $thumbsnail = implode('<br />', $imgs); } // Creating the element: $noList = isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'list'); $params = array('size' => $size, 'dontShowMoveIcons' => $maxitems <= 1, 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'], 0), 'maxitems' => $maxitems, 'style' => isset($config['selectedListStyle']) ? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"' : ' style="' . $this->defaultMultipleSelectorStyle . '"', 'info' => $info, 'thumbnails' => $thumbsnail, 'readOnly' => $disabled, 'noBrowser' => $noList || isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'browser'), 'noList' => $noList); $item .= $this->dbFileIcons($PA['itemFormElName'], 'file', implode(',', $tempFT), $itemArray, '', $params, $PA['onFocus']); if (!$disabled && !(isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'upload'))) { // Adding the upload field: if ($this->edit_docModuleUpload && $config['uploadfolder']) { $item .= '<input type="file" name="' . $PA['itemFormElName_file'] . '"' . $this->formWidth() . ' size="60" onchange="' . implode('', $PA['fieldChangeFunc']) . '" />'; } } break; case 'folder': // If the element is of the internal type "folder": // array of folder items: $itemArray = t3lib_div::trimExplode(',', $PA['itemFormElValue'], 1); // Creating the element: $noList = isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'list'); $params = array('size' => $size, 'dontShowMoveIcons' => $maxitems <= 1, 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'], 0), 'maxitems' => $maxitems, 'style' => isset($config['selectedListStyle']) ? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"' : ' style="' . $this->defaultMultipleSelectorStyle . '"', 'info' => $info, 'readOnly' => $disabled, 'noBrowser' => $noList || isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'browser'), 'noList' => $noList); $item .= $this->dbFileIcons($PA['itemFormElName'], 'folder', '', $itemArray, '', $params, $PA['onFocus']); break; case 'db': // If the element is of the internal type "db": // Creating string showing allowed types: $tempFT = t3lib_div::trimExplode(',', $allowed, true); if (!strcmp(trim($tempFT[0]), '*')) { $onlySingleTableAllowed = false; $info .= '<span class="nobr"> ' . htmlspecialchars($this->getLL('l_allTables')) . '</span><br />'; } elseif ($tempFT) { $onlySingleTableAllowed = count($tempFT) == 1; foreach ($tempFT as $theT) { $info .= '<span class="nobr"> ' . t3lib_iconWorks::getSpriteIconForRecord($theT, array()) . htmlspecialchars($this->sL($GLOBALS['TCA'][$theT]['ctrl']['title'])) . '</span><br />'; } } $perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1); $itemArray = array(); $imgs = array(); // Thumbnails: $temp_itemArray = t3lib_div::trimExplode(',', $PA['itemFormElValue'], 1); foreach ($temp_itemArray as $dbRead) { $recordParts = explode('|', $dbRead); list($this_table, $this_uid) = t3lib_BEfunc::splitTable_Uid($recordParts[0]); // For the case that no table was found and only a single table is defined to be allowed, use that one: if (!$this_table && $onlySingleTableAllowed) { $this_table = $allowed; } $itemArray[] = array('table' => $this_table, 'id' => $this_uid); if (!$disabled && $show_thumbs) { $rr = t3lib_BEfunc::getRecordWSOL($this_table, $this_uid); $imgs[] = '<span class="nobr">' . $this->getClickMenu(t3lib_iconWorks::getSpriteIconForRecord($this_table, $rr, array('style' => 'vertical-align:top', 'title' => htmlspecialchars(t3lib_BEfunc::getRecordPath($rr['pid'], $perms_clause, 15) . ' [UID: ' . $rr['uid'] . ']"'))), $this_table, $this_uid) . ' ' . t3lib_BEfunc::getRecordTitle($this_table, $rr, TRUE) . ' <span class="typo3-dimmed"><em>[' . $rr['uid'] . ']</em></span>' . '</span>'; } } $thumbsnail = ''; if (!$disabled && $show_thumbs) { $thumbsnail = implode('<br />', $imgs); } // Creating the element: $noList = isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'list'); $params = array('size' => $size, 'dontShowMoveIcons' => $maxitems <= 1, 'autoSizeMax' => t3lib_div::intInRange($config['autoSizeMax'], 0), 'maxitems' => $maxitems, 'style' => isset($config['selectedListStyle']) ? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"' : ' style="' . $this->defaultMultipleSelectorStyle . '"', 'info' => $info, 'thumbnails' => $thumbsnail, 'readOnly' => $disabled, 'noBrowser' => $noList || isset($config['disable_controls']) && t3lib_div::inList($config['disable_controls'], 'browser'), 'noList' => $noList); $item .= $this->dbFileIcons($PA['itemFormElName'], 'db', implode(',', $tempFT), $itemArray, '', $params, $PA['onFocus'], $table, $field, $row['uid']); break; } // Wizards: $altItem = '<input type="hidden" name="' . $PA['itemFormElName'] . '" value="' . htmlspecialchars($PA['itemFormElValue']) . '" />'; if (!$disabled) { $item = $this->renderWizards(array($item, $altItem), $config['wizards'], $table, $row, $field, $PA, $PA['itemFormElName'], $specConf); } return $item; }