/**
     * Rendering the copy file form for a multiple items
     *
     * @return	string		HTML content
     */
    function renderFormMulti($items, $targetFolder)
    {
        global $BACK_PATH, $LANG, $TCA;
        $content = '';
        $references = 0;
        // FOLDER_INFO is missing due to missing param in current function - so we set it to nothing
        $this->pObj->markers['FOLDER_INFO'] = '';
        $titleNotExists = 'title="' . $GLOBALS['LANG']->getLL('fileNotExists', true) . '"';
        $iconNotExists = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], PATH_txdam_rel . 'i/error_h.gif', 'width="10" height="10"') . ' ' . $titleNotExists . ' valign="top" alt="" />';
        $referencedIcon = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], PATH_txdam_rel . 'i/is_referenced.gif', 'width="15" height="12"') . ' title="' . $LANG->getLL($this->langPrefix . 'messageReferencesUsed', 1) . '" alt="" />';
        // init table layout
        $tableLayout = array('table' => array('<table cellpadding="2" cellspacing="1" border="0" width="100%">', '</table>'), '0' => array('defCol' => array('<th nowrap="nowrap" class="bgColor5">', '</th>'), '0' => array('<th width="1%" class="bgColor5">', '</th>'), '1' => array('<th width="1%" class="bgColor5">', '</th>'), '3' => array('<th width="1%" class="bgColor5">', '</th>'), '4' => array('<th width="1%" class="bgColor5">', '</th>'), '5' => array('<th width="1%" class="bgColor5">', '</th>')), 'defRow' => array('defCol' => array('<td nowrap="nowrap" class="bgColor4">', '</td>'), '2' => array('<td class="bgColor4">', '</td>'), '3' => array('<td style="text-align:center" class="bgColor4">', '</td>'), '4' => array('<td style="padding:0 5px 0 5px" class="bgColor4">', '</td>'), '5' => array('<td style="text-align:center" class="bgColor4">', '</td>')));
        $cTable = array();
        $tr = 0;
        $td = 0;
        $cTable[$tr][$td++] = '&nbsp;';
        $cTable[$tr][$td++] = '&nbsp;';
        $cTable[$tr][$td++] = $LANG->sL($TCA['tx_dam']['columns']['title']['label'], 1);
        $cTable[$tr][$td++] = '&nbsp;';
        $cTable[$tr][$td++] = '&nbsp;';
        $cTable[$tr][$td++] = $LANG->sL($TCA['tx_dam']['columns']['file_path']['label'], 1);
        $tr++;
        foreach ($items as $id => $meta) {
            $filepath = tx_dam::file_absolutePath($meta);
            if ($meta['file_accessable']) {
                $checkbox = '<input type="checkbox" name="data[' . $this->copyOrMove . '][' . $id . '][data]" value="' . htmlspecialchars($filepath) . '"  checked="checked" />';
            } else {
                $checkbox = '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], PATH_txdam_rel . 'i/error_h.gif', 'width="10" height="10"') . ' title="' . $LANG->getLL('accessDenied', true) . '" alt="" />';
            }
            $title = $meta['title'] ? $meta['title'] : $meta['file_name'];
            $title = t3lib_div::fixed_lgd_cs($title, 50);
            $icon = tx_dam_guiFunc::icon_getFileTypeImgTag($meta, 'class="c-recicon"', false);
            if (!@file_exists($filepath)) {
                $icon .= $iconNotExists;
                $info = '';
            } else {
                $info = $GLOBALS['SOBE']->btn_infoFile($meta);
            }
            // Add row to table
            $td = 0;
            $cTable[$tr][$td++] = $checkbox;
            $cTable[$tr][$td++] = $icon;
            $cTable[$tr][$td++] = htmlspecialchars($title);
            $cTable[$tr][$td++] = htmlspecialchars(strtoupper($meta['file_type']));
            $cTable[$tr][$td++] = $info;
            $cTable[$tr][$td++] = htmlspecialchars(t3lib_div::fixed_lgd_cs($meta['file_path'], -15));
            $tr++;
        }
        $itemTable = $this->pObj->doc->table($cTable, $tableLayout);
        $targetFolderRel = tx_dam::path_makeRelative($targetFolder);
        $msg = array();
        $msg[] = '&nbsp;';
        $msg[] = $LANG->getLL('labelTargetFolder', 1) . ' <strong>' . htmlspecialchars($targetFolderRel) . '</strong>';
        $msg[] = '&nbsp;';
        $msg[] = htmlspecialchars(sprintf($LANG->getLL($this->langPrefix . 'message'), $targetFolderRel));
        $msg[] = '&nbsp;';
        $msg[] = $itemTable;
        $buttons = '
			<input type="hidden" name="data[' . $this->copyOrMove . '][' . $id . '][data]" value="' . htmlspecialchars($filepath) . '" />
			<input type="hidden" name="data[' . $this->copyOrMove . '][' . $id . '][target]" value="' . htmlspecialchars($targetFolder) . '" />';
        if (tx_dam::config_checkValueEnabled('mod.txdamM1_SHARED.displayExtraButtons', 1)) {
            if ($this->copyOrMove == 'copy') {
                $buttons .= '
					<input type="submit" value="' . $LANG->getLL('tx_dam_cmd_filecopy.submit', 1) . '" />
					<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.cancel', 1) . '" onclick="jumpBack(); return false;" />';
            } else {
                $buttons .= '
					<input type="submit" value="' . $LANG->getLL('tx_dam_cmd_filemove.submit', 1) . '" />
					<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.cancel', 1) . '" onclick="jumpBack(); return false;" />';
            }
        }
        $this->pObj->docHeaderButtons['SAVE'] = '<input class="c-inputButton" name="_savedok"' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/clip_copy.gif') . ' title="' . $LANG->getLL($this->langPrefix . 'submit', 1) . '" height="16" type="image" width="16">';
        $this->pObj->docHeaderButtons['CLOSE'] = '<a href="#" onclick="jumpBack(); return false;"><img' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/closedok.gif') . ' class="c-inputButton" title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.cancel', 1) . '" alt="" height="16" width="16"></a>';
        $content .= $GLOBALS['SOBE']->getMessageBox($GLOBALS['SOBE']->pageTitle, $msg, $buttons, 1);
        return $content;
    }
 /**
  * Returns a record icon with title and edit link
  *
  * @param	string		Table name (tt_content,...)
  * @param	array		Record array
  * @param	boolean		For pages records the rootline will be rendered
  * @return	string		Rendered icon
  */
 function getRecordInfoEditLink($refTable, $row, $showRootline = FALSE)
 {
     global $BACK_PATH, $LANG, $TCA;
     // Create record title or rootline for pages if option is selected
     if ($refTable === 'pages' and $showRootline) {
         $elementTitle = t3lib_BEfunc::getRecordPath($row['uid'], '1=1', 0);
         $elementTitle = t3lib_div::fixed_lgd_cs($elementTitle, -$BE_USER->uc['titleLen']);
     } else {
         $elementTitle = t3lib_BEfunc::getRecordTitle($refTable, $row, 1);
     }
     // Create icon for record
     if ($refTable === 'tx_dam') {
         $elementIcon = tx_dam_guiFunc::icon_getFileTypeImgTag($row, 'class="c-recicon" align="top"');
     } else {
         $iconAltText = t3lib_BEfunc::getRecordIconAltText($row, $refTable);
         // Prepend table description for non-pages tables
         if (!($refTable === 'pages')) {
             $iconAltText = htmlspecialchars($LANG->sl($TCA[$refTable]['ctrl']['title']) . ': ') . $iconAltText;
         }
         $elementIcon = t3lib_iconworks::getIconImage($refTable, $row, $BACK_PATH, 'class="c-recicon" align="top" title="' . $iconAltText . '"');
     }
     // Return item with edit link
     return tx_dam_SCbase::wrapLink_edit($elementIcon . $elementTitle, $refTable, $row['uid']);
 }
    /**
     * Render list of files.
     *
     * @param	array		List of files. See t3lib_div::getFilesInDir
     * @param	string		$mode EB mode: "db", "file", ...
     * @return	string		HTML output
     */
    function renderFileList($files, $mode = 'file', $act = '')
    {
        global $LANG, $BACK_PATH, $TCA, $TYPO3_CONF_VARS;
        $out = '';
        // sorting selector
        // TODO move to scbase (see tx_dam_list_thumbs too)
        $allFields = tx_dam_db::getFieldListForUser('tx_dam');
        if (is_array($allFields) && count($allFields)) {
            $fieldsSelItems = array();
            foreach ($allFields as $field => $title) {
                $fL = is_array($TCA['tx_dam']['columns'][$field]) ? preg_replace('#:$#', '', $GLOBALS['LANG']->sL($TCA['tx_dam']['columns'][$field]['label'])) : '[' . $field . ']';
                $fieldsSelItems[$field] = t3lib_div::fixed_lgd_cs($fL, 15);
            }
            $sortingSelector = '<label>' . $GLOBALS['LANG']->sL('LLL:EXT:dam/lib/locallang.xml:labelSorting', 1) . '</label> ';
            $sortingSelector .= t3lib_befunc::getFuncMenu($this->addParams, 'SET[txdam_sortField]', $this->damSC->MOD_SETTINGS['txdam_sortField'], $fieldsSelItems);
            if ($this->damSC->MOD_SETTINGS['txdam_sortRev']) {
                $params = (array) $this->addParams + array('SET[txdam_sortRev]' => '0');
                $href = t3lib_div::linkThisScript($params);
                $sortingSelector .= '<button name="SET[txdam_sortRev]" type="button" onclick="self.location.href=\'' . htmlspecialchars($href) . '\'">' . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/pil2up.gif', 'width="12" height="7"') . ' alt="" />' . '</button>';
            } else {
                $params = (array) $this->addParams + array('SET[txdam_sortRev]' => '1');
                $href = t3lib_div::linkThisScript($params);
                $sortingSelector .= '<button name="SET[txdam_sortRev]" type="button" onclick="self.location.href=\'' . htmlspecialchars($href) . '\'">' . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/pil2down.gif', 'width="12" height="7"') . ' alt="" />' . '</button>';
            }
            $sortingSelector = $this->getFormTag('', 'sortingSelector') . $sortingSelector . '</form>';
        }
        $out .= '<div id="medialistfunctions">';
        $out .= $this->getSelectionSelector();
        $out .= $this->getFormTag();
        $out .= $this->damSC->getSearchBox('simple', false, '', true);
        $out .= '</form>';
        $out .= $sortingSelector;
        $out .= '</div>';
        $out .= $this->doc->spacer(10);
        $out .= $this->damSC->getResultInfoBar();
        $out .= $this->doc->spacer(10);
        // Listing the files:
        if (is_array($files) and count($files)) {
            $displayThumbs = $this->displayThumbs();
            $dragdropImage = $mode == 'rte' && ($act == 'dragdrop' || $act == 'media_dragdrop');
            $addAllJS = '';
            $displayItems = '';
            if ($mode == 'rte' && $act == 'media') {
                if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'usedamcolumn') && $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn']) {
                    $displayItems = $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn.']['displayItems'] ? $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn.']['displayItems'] : '';
                }
            }
            // Traverse the file list:
            $lines = array();
            foreach ($files as $fI) {
                if (!$fI['__exists']) {
                    tx_dam::meta_updateStatus($fI);
                    continue;
                }
                // Create file icon:
                $iconFile = tx_dam::icon_getFileType($fI);
                $iconTag = tx_dam_guiFunc::icon_getFileTypeImgTag($fI);
                $iconAndFilename = $iconTag . htmlspecialchars(t3lib_div::fixed_lgd_cs($fI['file_title'], max($GLOBALS['BE_USER']->uc['titleLen'], 120)));
                // Create links for adding the file:
                if (strstr($fI['file_name_absolute'], ',') || strstr($fI['file_name_absolute'], '|')) {
                    // In case an invalid character is in the filepath, display error message:
                    $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'), ', |'));
                    $ATag_insert = '<a href="#" onclick="alert(' . $eMsg . ');return false;">';
                    // If filename is OK, just add it:
                } else {
                    // JS: insertElement(table, uid, type, filename, fpath, filetype, imagefile ,action, close)
                    $onClick_params = implode(', ', array("'" . $fI['_ref_table'] . "'", "'" . $fI['_ref_id'] . "'", "'" . $mode . "'", t3lib_div::quoteJSvalue($fI['file_name']), t3lib_div::quoteJSvalue($fI['_ref_file_path']), "'" . $fI['file_type'] . "'", "'" . $iconFile . "'"));
                    $titleAttrib = tx_dam_guiFunc::icon_getTitleAttribute($fI);
                    if ($mode === 'rte' and $act === 'media') {
                        $onClick = 'return link_folder(\'' . t3lib_div::rawUrlEncodeFP(tx_dam::file_relativeSitePath($fI['_ref_file_path'])) . '\');';
                        if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'txdam')) {
                            $onClick = 'browse_links_setAdditionalValue(\'txdam\', \'' . $fI['uid'] . '\');' . $onClick;
                        }
                        if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'usedamcolumn') && $this->thisConfig['buttons.']['link.'][$act . '.']['properties.']['title.']['useDAMColumn']) {
                            $damTitle = t3lib_div::quoteJSvalue(tx_dam_guiFunc::meta_compileHoverText($fI, $displayItems, ', '));
                            $onClick = 'if (document.getElementById(\'rtehtmlarea-dam-browse-links-useDAMColumn\') && document.getElementById(\'rtehtmlarea-dam-browse-links-useDAMColumn\').checked) { document.getElementById(\'rtehtmlarea-browse-links-anchor_title\').value = ' . $damTitle . '; }' . $onClick;
                        }
                        $ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                    } elseif (!$dragdropImage) {
                        $onClick = 'return insertElement(' . $onClick_params . ');';
                        $ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                        $addIcon = $ATag_add . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" /></a>';
                        $onClick = 'return insertElement(' . $onClick_params . ', \'\', 1);';
                        $ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                        $addAllJS .= $mode === 'rte' ? '' : 'insertElement(' . $onClick_params . '); ';
                    }
                }
                // Create link to showing details about the file in a window:
                if ($fI['__exists']) {
                    $infoOnClick = 'launchView(\'' . t3lib_div::rawUrlEncodeFP($fI['file_name_absolute']) . '\', \'\'); return false;';
                    $ATag_info = '<a href="#" onclick="' . htmlspecialchars($infoOnClick) . '">';
                    $info = $ATag_info . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $LANG->getLL('info', 1) . '" alt="" /> ' . $LANG->getLL('info', 1) . '</a>';
                    $info = '<span class="button">' . $info . '</span>';
                } else {
                    $info = '&nbsp;';
                }
                // Thumbnail/size generation:
                $clickThumb = '';
                if ($displayThumbs and is_file($fI['file_name_absolute']) and tx_dam_image::isPreviewPossible($fI)) {
                    $addAttrib = array();
                    $addAttrib['title'] = tx_dam_guiFunc::meta_compileHoverText($fI);
                    $clickThumb = tx_dam_image::previewImgTag($fI, '', $addAttrib);
                    $clickThumb = '<div class="clickThumb">' . $ATag_insert . $clickThumb . '</a>' . '</div>';
                } elseif ($displayThumbs) {
                    $clickThumb = '<div style="width:68px"></div>';
                }
                // Image for drag & drop replaces the thumbnail
                if ($dragdropImage and t3lib_div::inList($TYPO3_CONF_VARS['GFX']['imagefile_ext'], $fI['file_type']) and is_file($fI['file_name_absolute'])) {
                    if (t3lib_div::_GP('noLimit')) {
                        $maxW = 10000;
                        $maxH = 10000;
                    } else {
                        $maxW = 380;
                        $maxH = 500;
                    }
                    $IW = $fI['hpixels'];
                    $IH = $fI['vpixels'];
                    if ($IW > $maxW) {
                        $IH = ceil($IH / $IW * $maxW);
                        $IW = $maxW;
                    }
                    if ($IH > $maxH) {
                        $IW = ceil($IW / $IH * $maxH);
                        $IH = $maxH;
                    }
                    $clickThumb = '<img src="' . t3lib_div::getIndpEnv('TYPO3_SITE_URL') . substr($fI['file_name_absolute'], strlen(PATH_site)) . '" width="' . $IW . '" height="' . $IH . '"' . ($this->defaultClass ? ' class="' . $this->defaultClass . '"' : '') . ' alt="' . $fI['alt_text'] . '" title="' . $fI[$this->imgTitleDAMColumn] . '" txdam="' . $fI['uid'] . '" />';
                    $clickThumb = '<div class="clickThumb2">' . $clickThumb . '</div>';
                }
                // Show element:
                $lines[] = '
					<tr>
						<td valign="middle" class="bgColor4" nowrap="nowrap" style="min-width:20em">' . ($dragdropImage ? '' : $ATag_insert) . $iconAndFilename . '</a>' . '&nbsp;</td>
						<td valign="middle" class="bgColor4" width="1%">' . ($mode == 'rte' ? '' : $addIcon) . '</td>
						<td valign="middle" nowrap="nowrap" width="1%">' . $info . '</td>
					</tr>';
                $infoText = '';
                if ($this->getModSettings('extendedInfo')) {
                    $infoText = tx_dam_guiFunc::meta_compileInfoData($fI, 'file_name, file_size:filesize, _dimensions, caption:truncate:50, instructions', 'table');
                    $infoText = str_replace('<table>', '<table border="0" cellpadding="0" cellspacing="1">', $infoText);
                    $infoText = str_replace('<strong>', '<strong style="font-weight:normal;">', $infoText);
                    $infoText = str_replace('</td><td>', '</td><td class="bgColor-10">', $infoText);
                }
                if ($displayThumbs || $dragdropImage and $infoText) {
                    $lines[] = '
						<tr class="bgColor">
							<td valign="top" colspan="3">
							<table border="0" cellpadding="0" cellspacing="0"><tr>
								<td valign="top">' . $clickThumb . '</td>
								<td valign="top" style="padding-left:1em">' . $infoText . '</td></tr>
							</table>
							<div style="height:0.5em;"></div>
							</td>
						</tr>';
                } elseif ($clickThumb or $infoText) {
                    $lines[] = '
						<tr class="bgColor">
							<td valign="top" colspan="3" style="padding-left:22px">
							' . $clickThumb . $infoText . '
							<div style="height:0.5em;"></div>
							</td>
						</tr>';
                }
                $lines[] = '
						<tr>
							<td colspan="3"><div style="height:0.5em;"></div></td>
						</tr>';
            }
            // Wrap all the rows in table tags:
            $out .= '



		<!--
			File listing
		-->
				<table border="0" cellpadding="1" cellspacing="0" id="typo3-fileList">
					' . implode('', $lines) . '
				</table>';
        }
        if ($addAllJS) {
            $label = $LANG->getLL('eb_addAllToList', true);
            $titleAttrib = ' title="' . $label . '"';
            $onClick = $addAllJS . 'return true;';
            $ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
            $addIcon = $ATag_add . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' alt="" />';
            $addAllButton = '<div class="addAllButton"><span class="button"' . $titleAttrib . '>' . $ATag_add . $addIcon . $label . '</a></span></div>';
            $out = $out . $addAllButton;
        }
        $out .= $this->doc->spacer(20);
        $out .= $this->damSC->getResultInfoBar();
        // Return accumulated content for filelisting:
        return $out;
    }
    /**
     * Render list of files.
     *
     * @param	array		List of files. See t3lib_div::getFilesInDir
     * @param	string		$mode EB mode: "db", "file", ...
     * @return	string		HTML output
     */
    function renderFileList($files, $mode = 'file')
    {
        global $LANG, $BACK_PATH, $BE_USER, $TYPO3_CONF_VARS;
        $out = '';
        // Listing the files:
        if (is_array($files) and count($files)) {
            $displayThumbs = $this->displayThumbs();
            $displayImage = $this->act === 'dragdrop';
            // Traverse the file list:
            $lines = array();
            foreach ($files as $fI) {
                if (!$fI['__exists']) {
                    continue;
                }
                // Create file icon:
                $titleAttrib = tx_dam_guiFunc::icon_getTitleAttribute($fI);
                $iconFile = tx_dam::icon_getFileType($fI);
                $iconTag = tx_dam_guiFunc::icon_getFileTypeImgTag($fI);
                $iconAndFilename = $iconTag . htmlspecialchars(t3lib_div::fixed_lgd_cs($fI['file_title'], $BE_USER->uc['titleLen']));
                // Create links for adding the file:
                if (strstr($fI['file_name_absolute'], ',') || strstr($fI['file_name_absolute'], '|')) {
                    // In case an invalid character is in the filepath, display error message:
                    $eMsg = $LANG->JScharCode(sprintf($LANG->getLL('invalidChar'), ', |'));
                    $ATag_insert = '<a href="#" onclick="alert(' . $eMsg . ');return false;">';
                    // If filename is OK, just add it:
                } else {
                    // JS: insertElement(table, uid, type, filename, fpath, filetype, imagefile ,action, close)
                    $onClick_params = implode(', ', array("'" . $fI['_ref_table'] . "'", "'" . $fI['_ref_id'] . "'", "'" . $mode . "'", $this->quoteJSvalue($fI['file_name']), $this->quoteJSvalue($fI['_ref_file_path']), "'" . $fI['file_type'] . "'", "'" . $iconFile . "'"));
                    $onClick = 'return insertElement(' . $onClick_params . ');';
                    $ATag_add = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                    $onClick = 'return insertElement(' . $onClick_params . ', \'\', 1);';
                    $ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                }
                // Create link to showing details about the file in a window:
                if ($fI['__exists']) {
                    $Ahref = $BACK_PATH . 'show_item.php?table=' . rawurlencode($fI['file_name_absolute']) . '&returnUrl=' . rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'));
                    $ATag_info = '<a href="' . htmlspecialchars($Ahref) . '">';
                    $info = $ATag_info . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/zoom2.gif', 'width="12" height="12"') . ' title="' . $LANG->getLL('info', 1) . '" alt="" /> ' . $LANG->getLL('info', 1) . '</a>';
                } else {
                    $info = '&nbsp;';
                }
                // Thumbnail/size generation:
                $clickThumb = '';
                if (t3lib_div::inList($TYPO3_CONF_VARS['GFX']['imagefile_ext'], $fI['file_type']) and $displayThumbs and is_file($fI['file_name_absolute'])) {
                    $clickThumb = t3lib_BEfunc::getThumbNail($BACK_PATH . 'thumbs.php', $fI['file_path_absolute'] . $fI['file_name'], '');
                    $clickThumb = '<div style="width:56px; overflow:auto; padding: 5px; background-color:#fff; border:solid 1px #ccc;">' . $ATag_insert . $clickThumb . '</a>' . '</div>';
                } elseif ($displayThumbs) {
                    $clickThumb = '<div style="width:68px"></div>';
                }
                // Drag & drop image
                if ($displayImage and t3lib_div::inList($TYPO3_CONF_VARS['GFX']['imagefile_ext'], $fI['file_type']) and is_file($fI['file_name_absolute'])) {
                    if (t3lib_div::_GP('noLimit')) {
                        $maxW = 10000;
                        $maxH = 10000;
                    } else {
                        $maxW = 380;
                        $maxH = 500;
                    }
                    $IW = $fI['hpixels'];
                    $IH = $fI['vpixels'];
                    if ($IW > $maxW) {
                        $IH = ceil($IH / $IW * $maxW);
                        $IW = $maxW;
                    }
                    if ($IH > $maxH) {
                        $IW = ceil($IW / $IH * $maxH);
                        $IH = $maxH;
                    }
                    $clickThumb = '<img src="' . $this->siteUrl . substr($fI['file_name_absolute'], strlen(PATH_site)) . '" width="' . $IW . '" height="' . $IH . '"' . ($this->defaultClass ? ' class="' . $this->defaultClass . '"' : '') . ' alt="' . $fI['alt_text'] . '" title="' . $fI[$this->imgTitleDAMColumn] . '" />';
                    $clickThumb = '<div style="width:380px; overflow:auto; padding: 5px; background-color:#fff; border:solid 1px #ccc;">' . $clickThumb . '</div>';
                }
                // Show element:
                $lines[] = '
					<tr class="bgColor4">
						<td valign="top" nowrap="nowrap" style="min-width:20em">' . ($displayImage ? '' : $ATag_insert) . $iconAndFilename . '</a>' . '&nbsp;</td>
						<td valign="top" width="1%">' . ($displayImage ? '' : $ATag_add) . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" /></a></td>
						<td valign="top" nowrap="nowrap" width="1%">' . $info . '</td>
					</tr>';
                $infoText = '';
                if ($this->getModSettings('extendedInfo')) {
                    $infoText = tx_dam_guiFunc::meta_compileInfoData($fI, 'file_name, file_size:filesize, _dimensions, caption:truncate:50, instructions', 'table');
                    $infoText = str_replace('<table>', '<table border="0" cellpadding="0" cellspacing="1">', $infoText);
                    $infoText = str_replace('<strong>', '<strong style="font-weight:normal;">', $infoText);
                    $infoText = str_replace('</td><td>', '</td><td class="bgColor-10">', $infoText);
                }
                if ($displayThumbs || $displayImage and $infoText) {
                    $lines[] = '
						<tr class="bgColor">
							<td valign="top" colspan="3">
							<table border="0" cellpadding="0" cellspacing="0"><tr>
								<td valign="top">' . $clickThumb . '</td>
								<td valign="top" style="padding-left:1em">' . $infoText . '</td></tr>
							</table>
							<div style="height:0.5em;"></div>
							</td>
						</tr>';
                } elseif ($clickThumb or $infoText) {
                    $lines[] = '
						<tr class="bgColor">
							<td valign="top" colspan="3" style="padding-left:22px">
							' . $clickThumb . $infoText . '
							<div style="height:0.5em;"></div>
							</td>
						</tr>';
                }
                $lines[] = '
						<tr>
							<td colspan="3"><div style="height:0.5em;"></div></td>
						</tr>';
            }
            // Wrap all the rows in table tags:
            $out .= '



		<!--
			File listing
		-->
				<table cellpadding="0" cellspacing="0" id="typo3-fileList">
					' . implode('', $lines) . '
				</table>';
        }
        // Return accumulated content for filelisting:
        return $out;
    }
 /**
  * Returns a image-tag for thumbnail(s)
  * A file icon will be returned if no thumbnail is possible
  * If 'href' and/or 'onlick' is set as attributes a A tag will be wrapped around with these.
  *
  * @param	mixed		$fileInfo Is a file path or an array containing a file info from tx_dam::file_compileInfo().
  * @param	string		$size Optional: $size is [w]x[h] of the thumbnail. 56 is default.
  * @param	mixed		$imgAttributes Optional: is additional attributes for the image tags
  * @param	mixed		$iconAttributes Optional: additional attributes for the image tags for file icons
  * @param	string		$onClick Optional: If falso no A tag with onclick will be wrapped. If NULL top.launchView() will be used. If string it's value will be used as onclick value.
  * @param	boolean		$makeFileIcon If true a file icon will be returned if no thumbnail is possible
  * @return	string		Thumbnail image tag.
  */
 function image_thumbnailIconImgTag($fileInfo, $size = '', $imgAttributes = '', $iconAttributes = '', $makeFileIcon = TRUE)
 {
     $thumbnail = '';
     if (!is_array($imgAttributes)) {
         $imgAttributes = tx_dam_guifunc::tools_explodeAttributes($imgAttributes);
     }
     $href = $imgAttributes['href'];
     $onclick = $imgAttributes['onclick'];
     unset($imgAttributes['href']);
     unset($imgAttributes['onclick']);
     $thumbnail = tx_dam_image::previewImgTag($fileInfo, $size, $imgAttributes);
     if (!$thumbnail and $makeFileIcon) {
         if (!is_array($iconAttributes)) {
             $iconAttributes = tx_dam_guifunc::tools_explodeAttributes($iconAttributes);
         }
         $href = $iconAttributes['href'];
         $onclick = $iconAttributes['onclick'];
         unset($iconAttributes['href']);
         unset($iconAttributes['onclick']);
         $fileType = tx_dam::file_getType($fileInfo);
         $thumbnail = tx_dam_guiFunc::icon_getFileTypeImgTag($fileType, $iconAttributes);
     }
     if ($thumbnail and ($onclick or $href)) {
         $href = $href ? $href : '#';
         $thumbnail = '<a href="' . htmlspecialchars($href) . '" onclick="' . htmlspecialchars($onclick) . '">' . $thumbnail . '</a>';
     }
     return $thumbnail;
 }