public function postProcessDiffView($table, $fieldName, $recordOld, $recordNew, $currentDiff, $parentObject)
 {
     $diffView = $currentDiff;
     if ($table == 'tt_content' && $fieldName == 'tx_damttcontent_files' && $this->needsPostProcessing($recordOld, $recordNew)) {
         $filesOld = tx_dam_db::getReferencedFiles('tt_content', $recordOld['uid'], $this->fileFieldConfiguration['MM_match_fields'], $this->fileFieldConfiguration['MM'], 'tx_dam.*');
         $filesNew = tx_dam_db::getReferencedFiles('tt_content', $recordNew['uid'], $this->fileFieldConfiguration['MM_match_fields'], $this->fileFieldConfiguration['MM'], 'tx_dam.*');
         // building a string represemtation of the fields that can then
         // be sent to t3lib_diff, also collect the files to replace later
         $fieldContentOld = array();
         $placeholders = array();
         foreach ($filesOld['rows'] as $damFile) {
             $fieldContentOld[] = 'tx_dam:' . $damFile['uid'];
             $placeholders['tx_dam:' . $damFile['uid']] = $damFile;
         }
         $fieldContentOld = implode(' ', $fieldContentOld);
         $fieldContentNew = array();
         foreach ($filesNew['rows'] as $damFile) {
             $fieldContentNew[] = 'tx_dam:' . $damFile['uid'];
             $placeholders['tx_dam:' . $damFile['uid']] = $damFile;
         }
         $fieldContentNew = implode(' ', $fieldContentNew);
         // create the diff
         $diff = t3lib_div::makeInstance('t3lib_diff');
         $fieldDiff = $diff->makeDiffDisplay($fieldContentOld, $fieldContentNew, 'div');
         // replace placeholders with thumbnail and title
         foreach ($placeholders as $placeholder => $damFile) {
             $thumbnail = tx_dam_guiFunc::thumbnail($damFile);
             $replacement = $thumbnail . ' ' . $damFile['title'];
             $fieldDiff = str_replace($placeholder, $replacement, $fieldDiff);
         }
         $diffView = $fieldDiff;
     }
     return $diffView;
 }
 /**
  * Creates thumbnail of dam items
  *
  * @param	array			$row current tt_content record
  * @return	string			html of thumbnails
  */
 protected function renderDamItems(array $damItems)
 {
     $itemContent = '';
     foreach ($damItems as $damItem) {
         $caption = tx_dam_guiFunc::meta_compileInfoData($damItem, '_caption:truncate:100', 'value-string');
         $thumb = tx_dam_guiFunc::thumbnail($damItem);
         $thumb = '<div style="float:left;width:56px;overflow:auto;margin:2px 5px 2px 0" title="' . htmlspecialchars($caption) . '">' . $thumb . '</div>';
         $itemContent .= $thumb;
     }
     if ($itemContent != '') {
         $itemContent = '<div style="clear:left;overflow:hidden">' . $itemContent . '</div>';
     }
     return $itemContent;
 }
 /**
  * Transformation handler: 'txdam_media' / direction: "rte"
  * Processing linked images from database content going into the RTE.
  * Processing includes converting the src attribute to an absolute URL.
  *
  * @param	string		Content input
  * @return	string		Content output
  */
 function transform_rte($value, &$pObj)
 {
     // Split content by the TYPO3 pseudo tag "<media>":
     $blockSplit = $pObj->splitIntoBlock('media', $value, 1);
     foreach ($blockSplit as $k => $v) {
         $error = '';
         if ($k % 2) {
             // block:
             $tagCode = t3lib_div::unQuoteFilenames(trim(substr($pObj->getFirstTag($v), 0, -1)), true);
             $link_param = $tagCode[1];
             $href = '';
             $useDAMColumn = FALSE;
             // Checking if the id-parameter is int and get meta data
             if (t3lib_div::testInt($link_param)) {
                 $meta = tx_dam::meta_getDataByUid($link_param);
             }
             if (is_array($meta)) {
                 $href = tx_dam::file_url($meta);
                 if (!$tagCode[4]) {
                     require_once PATH_txdam . 'lib/class.tx_dam_guifunc.php';
                     $displayItems = '';
                     if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'usedamcolumn') && $pObj->thisConfig['buttons.']['link.']['media.']['properties.']['title.']['useDAMColumn']) {
                         $displayItems = $pObj->thisConfig['buttons.']['link.']['media.']['properties.']['title.']['useDAMColumn.']['displayItems'] ? $pObj->thisConfig['buttons.']['link.']['media.']['properties.']['title.']['useDAMColumn.']['displayItems'] : '';
                         $useDAMColumn = TRUE;
                     }
                     $tagCode[4] = tx_dam_guiFunc::meta_compileHoverText($meta, $displayItems, ', ');
                 }
             } else {
                 $href = $link_param;
                 $error = 'No media file found: ' . $link_param;
             }
             // Setting the A-tag:
             $bTag = '<a href="' . htmlspecialchars($href) . '" txdam="' . htmlspecialchars($link_param) . '"' . ($tagCode[2] && $tagCode[2] != '-' ? ' target="' . htmlspecialchars($tagCode[2]) . '"' : '') . ($tagCode[3] && $tagCode[3] != '-' ? ' class="' . htmlspecialchars($tagCode[3]) . '"' : '') . ($tagCode[4] ? ' title="' . htmlspecialchars($tagCode[4]) . '"' : '') . ($useDAMColumn ? ' usedamcolumn="true"' : '') . ($error ? ' rteerror="' . htmlspecialchars($error) . '" style="background-color: yellow; border:2px red solid; color: black;"' : '') . '>';
             $eTag = '</a>';
             $blockSplit[$k] = $bTag . $this->transform_rte($pObj->removeFirstAndLastTag($blockSplit[$k]), $pObj) . $eTag;
         }
     }
     $value = implode('', $blockSplit);
     return $value;
 }
    /**
     * Rendering the upload file form fields
     *
     * @return	string		HTML content
     */
    function renderForm()
    {
        global $BACK_PATH, $LANG;
        $id = $this->meta['uid'];
        $path = tx_dam::path_makeAbsolute($this->meta['file_path']);
        $content = '';
        $msg = array();
        $this->pObj->markers['FOLDER_INFO'] = '[' . $this->file['file_path'] . ']:' . $this->file['file_name'];
        $msg[] = tx_dam_guiFunc::getRecordInfoHeaderExtra($this->meta);
        $msg[] = '&nbsp;';
        $msg[] = '
				<input type="file" name="upload_' . $id . '"' . $this->pObj->doc->formWidth(35) . ' size="45" />
				<input type="hidden" name="data[upload][' . $id . '][target]" value="' . htmlspecialchars($path) . '" />
				<input type="hidden" name="data[upload][' . $id . '][data]" value="' . $id . '" />';
        if (tx_dam::config_checkValueEnabled('mod.txdamM1_SHARED.displayExtraButtons', 1)) {
            $buttons = '
				<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:file_upload.php.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/savedok.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:file_upload.php.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;
    }
    /**
     * Making the formfields for renaming
     *
     * @return	string		HTML content
     */
    function renderForm()
    {
        global $BACK_PATH, $LANG;
        $content = '';
        $msg = array();
        $this->pObj->markers['FOLDER_INFO'] = tx_dam_guiFunc::getFolderInfoBar($this->folder);
        $msg[] = '&nbsp;';
        $msg[] = $LANG->getLL('foldername', 1);
        $msg[] = '<input' . $GLOBALS['SOBE']->doc->formWidth(20) . ' type="text" name="data[new_name]" value="' . htmlspecialchars($this->pObj->data['new_name'] ? $this->pObj->data['new_name'] : $this->folder['dir_name']) . '">';
        if (tx_dam::config_checkValueEnabled('mod.txdamM1_SHARED.displayExtraButtons', 1)) {
            $buttons = '
				<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:file_rename.php.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/savedok.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:file_rename.php.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);
        $content .= '<input type="hidden" name="folder" value="' . htmlspecialchars($this->folder['dir_path_absolute']) . '" />';
        return $content;
    }
    /**
     * Draws the preview content for a content element
     *
     * @param	string		Content element
     * @param	boolean		Set if the RTE link can be created.
     * @return	string		HTML
     */
    function tt_content_drawItem($row, $isRTE = FALSE)
    {
        global $TCA;
        $out = '';
        $outHeader = '';
        // Make header:
        if ($row['header'] && $row['header_layout'] != 100) {
            $infoArr = array();
            $this->getProcessedValue('tt_content', 'header_position,header_layout,header_link', $row, $infoArr);
            $outHeader = ($row['date'] ? htmlspecialchars($this->itemLabels['date'] . ' ' . t3lib_BEfunc::date($row['date'])) . '<br />' : '') . $this->infoGif($infoArr) . '<b>' . $this->linkEditContent($this->renderText($row['header']), $row) . '</b><br />';
        }
        // Make content:
        $infoArr = array();
        switch ($row['CType']) {
            case 'header':
                if ($row['subheader']) {
                    $this->getProcessedValue('tt_content', 'layout', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['subheader']), $row) . '<br />';
                }
                break;
            case 'text':
            case 'textpic':
            case 'image':
                if ($row['CType'] == 'text' || $row['CType'] == 'textpic') {
                    if ($row['bodytext']) {
                        $this->getProcessedValue('tt_content', 'text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
                        $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                    }
                }
                if ($row['CType'] == 'textpic' || $row['CType'] == 'image') {
                    if ($row['image']) {
                        $infoArr = array();
                        $this->getProcessedValue('tt_content', 'imageorient,imagecols,image_noRows,imageborder,imageheight,image_link,image_zoom,image_compression,image_effects,image_frames', $row, $infoArr);
                        $out .= $this->infoGif($infoArr) . $this->thumbCode($row, 'tt_content', 'image') . '<br />';
                        if ($row['imagecaption']) {
                            $infoArr = array();
                            $this->getProcessedValue('tt_content', 'imagecaption_position', $row, $infoArr);
                            $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
                        }
                    }
                    ###########
                    if ($row['tx_damttcontent_files']) {
                        require_once PATH_txdam . 'lib/class.tx_dam_image.php';
                        require_once PATH_txdam . 'lib/class.tx_dam_tcefunc.php';
                        require_once PATH_txdam . 'lib/class.tx_dam_guifunc.php';
                        $config = $TCA['tt_content']['columns']['tx_damttcontent_files']['config'];
                        if ($GLOBALS['BE_USER']->workspace !== 0) {
                            $workspaceRecord = t3lib_BEfunc::getWorkspaceVersionOfRecord($GLOBALS['BE_USER']->workspace, 'tt_content', $row['uid']);
                            if ($workspaceRecord) {
                                $row = $workspaceRecord;
                            }
                        }
                        $filesArray = tx_dam_db::getReferencedFiles('tt_content', $row['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*');
                        foreach ($filesArray['rows'] as $rowDAM) {
                            $caption = tx_dam_guiFunc::meta_compileInfoData($rowDAM, '_caption:truncate:100', 'value-string');
                            #$imgAttributes['title'] = tx_dam_guiFunc::meta_compileHoverText($rowDAM);
                            #$thumb = tx_dam_image::previewImgTag($rowDAM, '', $imgAttributes);
                            $thumb = tx_dam_guiFunc::thumbnail($rowDAM);
                            $thumb = '<div style="float:left;width:56px; overflow:auto; margin: 2px 5px 2px 0; padding: 5px; background-color:#fff; border:solid 1px #ccc;">' . $thumb . '</div>';
                            $thumb = '<div>' . $thumb . $caption . '</div><div style="clear:both"></div>';
                            $out .= $thumb;
                        }
                    }
                    #############
                }
                break;
            case 'bullets':
                if ($row['bodytext']) {
                    $this->getProcessedValue('tt_content', 'layout,text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'table':
                if ($row['bodytext']) {
                    $this->getProcessedValue('tt_content', 'table_bgColor,table_border,table_cellspacing,cols,layout,text_align,text_face,text_size,text_color,text_properties', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'uploads':
                if ($row['media']) {
                    $this->getProcessedValue('tt_content', 'media,select_key,layout,filelink_size,table_bgColor,table_border,table_cellspacing', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'multimedia':
                if ($row['multimedia']) {
                    $out .= $this->renderText($row['multimedia']) . '<br />';
                    $out .= $this->renderText($row['parameters']) . '<br />';
                }
                break;
            case 'mailform':
                if ($row['bodytext']) {
                    $this->getProcessedValue('tt_content', 'pages,subheader', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
            case 'splash':
                if ($row['bodytext']) {
                    $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                if ($row['image']) {
                    $infoArr = array();
                    $this->getProcessedValue('tt_content', 'imagewidth', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->thumbCode($row, 'tt_content', 'image') . '<br />';
                }
                break;
            case 'menu':
                if ($row['pages']) {
                    $this->getProcessedValue('tt_content', 'menu_type', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($row['pages'], $row) . '<br />';
                }
                break;
            case 'shortcut':
                if ($row['records']) {
                    $this->getProcessedValue('tt_content', 'layout', $row, $infoArr);
                    $out .= $this->infoGif($infoArr) . $this->linkEditContent($row['shortcut'], $row) . '<br />';
                }
                break;
            case 'list':
                $this->getProcessedValue('tt_content', 'layout', $row, $infoArr);
                $out .= $this->infoGif($infoArr) . $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content', 'list_type'), 1) . ' ' . $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type']), 1) . '<br />';
                $out .= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content', 'select_key'), 1) . ' ' . $row['select_key'] . '<br />';
                $infoArr = array();
                $this->getProcessedValue('tt_content', 'recursive', $row, $infoArr);
                $out .= $this->infoGif($infoArr) . $GLOBALS['LANG']->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'pages', $row['pages']), 1) . '<br />';
                break;
            case 'script':
                $out .= $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content', 'select_key'), 1) . ' ' . $row['select_key'] . '<br />';
                $out .= '<br />' . $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                $out .= '<br />' . $this->linkEditContent($this->renderText($row['imagecaption']), $row) . '<br />';
                break;
            default:
                if ($row['bodytext']) {
                    $out .= $this->linkEditContent($this->renderText($row['bodytext']), $row) . '<br />';
                }
                break;
        }
        // Wrap span-tags:
        $out = '
			<span class="exampleContent">' . $out . '</span>';
        // Add header:
        $out = $outHeader . $out;
        // Add RTE button:
        if ($isRTE) {
            $out .= $this->linkRTEbutton($row);
        }
        // Return values:
        if ($this->isDisabled('tt_content', $row)) {
            return $GLOBALS['TBE_TEMPLATE']->dfw($out);
        } else {
            return $out;
        }
    }
 /**
  * Creates a list of uploaded files
  *
  * @param	array		$log: ...
  * @return	string		HTML content
  */
 function getUploadedFileList($files)
 {
     global $BACK_PATH, $LANG;
     $content = '';
     // init table layout
     $tableLayout = array('table' => array('<table border="0" cellpadding="1" cellspacing="1" id="typo3-filelist">', '</table>'), 'defRow' => array('tr' => array('<tr>', '</tr>'), 'defCol' => array('<td valign="middle" class="bgColor4">', '</td>'), '990' => array('<td valign="middle" class="bgColor4">', '</td>'), '996' => array('<td valign="middle" class="bgColor5">', '</td>')), '0' => array('tr' => array('<tr class="c-headLine">', '</tr>'), 'defCol' => array('<td valign="middle" class="c-headLine">', '</td>'), '2' => array('<td valign="middle" class="c-headLine" style="width:165px;">', '</td>')));
     $table = array();
     $tr = 0;
     // header
     $td = 0;
     $table[$tr][$td++] = '&nbsp;';
     $table[$tr][$td++] = '&nbsp;';
     $table[$tr][$td++] = $LANG->getLL('c_file');
     $table[$tr][$td++] = $LANG->getLL('c_fileext');
     $table[$tr][$td++] = $LANG->getLL('c_tstamp');
     $table[$tr][$td++] = $LANG->getLL('c_size');
     # $table[$tr][$td++] = $LANG->getLL('c_rw');
     $table[$tr][$td++] = '&nbsp;';
     if (is_object($this->ebObj) && !$this->rteMode) {
         $table[$tr][$td++] = '&nbsp;';
     }
     $addAllJS = '';
     foreach ($files as $item) {
         $tr++;
         $row = $item['meta'];
         $fileIcon = tx_dam::icon_getFileTypeImgTag($row, 'title="' . htmlspecialchars($row['file_type']) . '"');
         // Add row to table
         $td = 0;
         if ($row['uid']) {
             #$table[$tr][$td++] = $this->pObj->doc->icons(-1); // Ok;
             $table[$tr][$td++] = $this->enableBatchProcessing ? '<input type="checkbox" name="process_recs[]" value="' . $row['uid'] . '" />' : '';
             $table[$tr][$td++] = $fileIcon;
             // if upload is called from RTE, allow direct linking by a click on file name
             if ($this->rteMode && is_object($this->ebObj)) {
                 $row = $this->ebObj->enhanceItemArray($row, $this->ebObj->mode);
                 $onClick = 'return link_folder(' . t3lib_div::quoteJSvalue(t3lib_div::rawUrlEncodeFP(tx_dam::file_relativeSitePath($row['_ref_file_path']))) . ');';
                 $ATag_insert = '<a href="#" onclick="' . htmlspecialchars($onClick) . '"' . $titleAttrib . '>';
                 $table[$tr][$td++] = $ATag_insert . htmlspecialchars(t3lib_div::fixed_lgd_cs($row['file_name'], 30)) . '</a>';
             } else {
                 $table[$tr][$td++] = htmlspecialchars(t3lib_div::fixed_lgd_cs($row['file_name'], 30));
             }
             $table[$tr][$td++] = htmlspecialchars(strtoupper($row['file_type']));
             $table[$tr][$td++] = date($GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'], $row['file_ctime']);
             $table[$tr][$td++] = htmlspecialchars(t3lib_div::formatSize($row['file_size']));
             $table[$tr][$td++] = $this->pObj->btn_editRec_inNewWindow('tx_dam', $item['uid']);
             if (is_object($this->ebObj)) {
                 if (intval($row['uid']) && !$this->rteMode) {
                     $row = $this->ebObj->enhanceItemArray($row, $this->ebObj->mode);
                     $iconFile = tx_dam::icon_getFileType($row);
                     $titleAttrib = tx_dam_guiFunc::icon_getTitleAttribute($row);
                     // JS: insertElement(table, uid, type, filename, fpath, filetype, imagefile ,action, close)
                     $onClick_params = implode(', ', array("'" . $row['_ref_table'] . "'", "'" . $row['_ref_id'] . "'", "'" . $this->ebObj->mode . "'", t3lib_div::quoteJSvalue($row['file_name']), t3lib_div::quoteJSvalue($row['_ref_file_path']), "'" . $row['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 . '>';
                     $addAllJS .= 'insertElement(' . $onClick_params . '); ';
                     $table[$tr][$td++] = $ATag_add . '<img' . t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/plusbullet2.gif', 'width="18" height="16"') . ' title="' . $LANG->getLL('addToList', 1) . '" alt="" /></a>';
                 } elseif ($this->rteMode) {
                     continue;
                 } else {
                     $table[$tr][$td++] = '';
                 }
             }
         } else {
             // failure
             $table[$tr][$td++] = $this->pObj->doc->icons(2);
             // warning
             $table[$tr][$td++] = $fileIcon;
             $table[$tr][$td++] = htmlspecialchars(t3lib_div::fixed_lgd_cs($row['file_name'], 30));
             $table[$tr][$td++] = htmlspecialchars(strtoupper($row['file_type']));
             $table[$tr][$td++] = '';
             $table[$tr][$td++] = '';
             $table[$tr][$td++] = htmlspecialchars($this->getErrorMsgFromItem($item));
         }
     }
     // render table
     if ($tr) {
         $code = '';
         // folder_link expects a form named ltargetform to look for link settings, so we need this if it's called from RTE
         if ($this->rteMode) {
             $code .= '<form action="" name="ltargetform" id="ltargetform"></form>';
         }
         $code .= $this->pObj->doc->table($table, $tableLayout);
         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 style="margin:1em 0 1em 1em;"><span class="button"' . $titleAttrib . '>' . $ATag_add . $addIcon . $label . '</a></span></div>';
             $code = $code . $addAllButton;
         }
     } else {
         $code = false;
     }
     return $code;
 }
    /**
     * 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;
    }
 /**
  * Renders file usage field
  *
  * @param	array		$PA An array with additional configuration options.
  * @param	object		$fobj TCEForms object reference
  * @return	string		The HTML code for the TCEform field
  */
 function tx_dam_fileUsage($PA, $fobj)
 {
     return tx_dam_guiFunc::getReferencesTable($PA['row']['uid']);
 }
    /**
     * 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;
    }
    /**
     * Making the formfields for renaming
     *
     * @return	string		HTML content
     */
    function renderForm()
    {
        global $TCA, $BACK_PATH, $LANG, $TYPO3_CONF_VARS;
        $content = '';
        $msg = array();
        $this->pObj->markers['FOLDER_INFO'] = '[' . $this->file['file_path'] . ']:' . $this->file['file_name'];
        $msg[] = tx_dam_guiFunc::getRecordInfoHeaderExtra($this->meta);
        if ($this->meta['uid']) {
            $msg[] = $this->pObj->getFormInputField('title', $this->meta['title'], 30);
            $msg[] = $this->pObj->getFormInputField('file_name', $this->meta['file_name'], 30);
            $msg[] = $this->pObj->getFormInputField('file_dl_name', $this->meta['file_dl_name'], 30);
        } else {
            $msg[] = $this->pObj->getFormInputField('file_name', $this->meta['file_name'], 30);
        }
        if (tx_dam::config_checkValueEnabled('mod.txdamM1_SHARED.displayExtraButtons', 1)) {
            $buttons = '
				<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:file_rename.php.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/savedok.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:file_rename.php.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;
    }
Exemplo n.º 12
0
 /**
  * Returns meta data which might be processed.
  * That means some fields are known and will be substituted by other fields values if the requested field is empty.
  * Example if you request a caption but the field is empty you will get the description field value.
  * This function will be improved by time and the processing will be configurable.
  *
  * @param	string		$field Field name to get meta data from. These are database fields.
  * @param	array		$conf Additional configuration options for the field rendering (if supported for field)
  * @return	mixed		Meta data value.
  * @todo getContent(): more fields and user fields
  */
 function getContent($field, $conf = array())
 {
     global $TYPO3_CONF_VARS;
     require_once PATH_txdam . 'lib/class.tx_dam_guifunc.php';
     $content = '';
     $hsc = true;
     switch ($field) {
         case 'file_size':
             if (!$conf['format']) {
                 $conf['format'] = 'filesize';
             }
             $content = $this->getMetaInfo($field);
             break;
         case '__image_thumbnailImgTag':
             $content = tx_dam_image::previewImgTag($this->getMetaInfoArray(), $conf['size'], $conf['imgAttributes']);
             $hsc = false;
             break;
         case '__image_thumbnailImgUrl':
             $content = tx_dam_image::previewImgUrl($this->getMetaInfoArray(), $conf['size'], $conf['imgAttributes']);
             $hsc = false;
             break;
         case '__image_thumbnailImg':
             $content = tx_dam_image::preview($this->getMetaInfoArray(), $conf['size'], $conf['imgAttributes']);
             // This is an array - return directly
             return $content;
             break;
         case '__icon_fileTypeImgTag':
             $addAttrib = $conf['imgAttributes'];
             if ($conf['createTitleAttribute'] and strpos($addAttrib, 'title=') === false) {
                 $addAttrib .= tx_dam_guiFunc::icon_getTitleAttribute($this->getMetaInfoArray());
             }
             $content = tx_dam::icon_getFileTypeImgTag($this->getMetaInfoArray(), $conf['imgAttributes']);
             $hsc = false;
             break;
         case 'caption':
             $caption = $this->getMeta('caption');
             if (!$caption) {
                 $caption = $this->getMeta('description');
             }
             $content = $caption;
             break;
         case 'alt_text':
             $alt_text = $this->getMeta('alt_text');
             if (!$alt_text) {
                 $alt_text = $this->getMeta('title');
             }
             $content = $alt_text;
             break;
         case 'media_type':
             $content = tx_dam_guifunc::convert_mediaType($this->getMeta($field));
             break;
             // TODO set substitution rules externally
             // TODO allow user functions
         // TODO set substitution rules externally
         // TODO allow user functions
         default:
             $content = $this->getMetaInfo($field);
             break;
     }
     if ($conf['format'] and $content) {
         $content = tx_dam_guifunc::tools_formatValue($content, $conf['format'], $conf['formatConf']);
     }
     if ($conf['stdWrap.']) {
         $lcObj = t3lib_div::makeInstance('tslib_cObj');
         $lcObj->start($this->getMetaArray(), 'tx_dam');
         $content = $lcObj->stdWrap($content, $conf['stdWrap.']);
         $hsc = false;
     } else {
     }
     if (isset($conf['htmlSpecialChars']) and !$conf['htmlSpecialChars']) {
         $hsc = false;
     }
     if ($hsc or $conf['htmlSpecialChars']) {
         $content = htmlspecialchars($content);
     }
     return $content;
 }
    /**
     * Making the form for delete
     *
     * @return	string		HTML content
     */
    function renderForm()
    {
        global $BACK_PATH, $LANG, $TYPO3_CONF_VARS;
        $content = '';
        if (!$this->path_isEmpty($this->folder['dir_path_absolute']) and !tx_dam::access_checkFileOperation('deleteFolderRecursively')) {
            $content .= $GLOBALS['SOBE']->getMessageBox($LANG->getLL('actionDenied'), $LANG->getLL('tx_dam_cmd_folderdelete.messageRecursiveDenied', 1), $this->pObj->buttonBack(0), 2);
        } else {
            $msg = array();
            $this->pObj->markers['FOLDER_INFO'] = tx_dam_guiFunc::getFolderInfoBar($this->folder);
            $msg[] = '&nbsp;';
            if (!$this->path_isEmpty($this->folder['dir_path_absolute'])) {
                $msg[] = '<strong><span class="typo3-red">' . $LANG->getLL('labelWarning', 1) . '</span> ' . $LANG->getLL('tx_dam_cmd_folderdelete.messageRecursive', 1) . '</strong>';
            }
            $msg[] = sprintf($LANG->sL('LLL:EXT:lang/locallang_core.xml:mess.delete', 1), $this->folder['dir_path_relative']);
            if (tx_dam::config_checkValueEnabled('mod.txdamM1_SHARED.displayExtraButtons', 1)) {
                $buttons = '
					<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:cm.delete', 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/deletedok.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:cm.delete', 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);
            $content .= '<input type="hidden" name="folder" value="' . $this->folder['dir_path_absolute'] . '" />
					<input type="hidden" name="data[delete_confirmed]" value="1" />';
        }
        if (!$this->path_isEmpty($this->folder['dir_path_absolute'])) {
            $content .= $GLOBALS['SOBE']->doc->spacer(5);
            require_once PATH_txdam . 'lib/class.tx_dam_filebrowser.php';
            $filelist = t3lib_div::makeInstance('tx_dam_filebrowser');
            $filelisting = $filelist->getStaticFolderList($this->folder['dir_path_absolute'], false);
            $content .= $GLOBALS['SOBE']->doc->section($LANG->getLL('folder', 1), $filelisting, 0, 0, 0);
        }
        return $content;
    }
    /**
     * 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;
    }
 /**
  * Set the link title that may be derived from the DAM meta data
  *
  * @return	void
  */
 protected function setDAMTitle()
 {
     if (t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['rtehtmlarea']['plugins']['TYPO3Link']['additionalAttributes'], 'usedamcolumn') && $this->invokingObject->buttonConfig[$this->act . '.']['properties.']['title.']['useDAMColumn']) {
         $mediaId = $this->invokingObject->curUrlArray['txdam'];
         if ($mediaId) {
             // Checking if the id-parameter is int and get meta data
             if (t3lib_div::testInt($mediaId)) {
                 $meta = tx_dam::meta_getDataByUid($mediaId);
             }
             // Generating configured title from meta data
             if (is_array($meta)) {
                 require_once PATH_txdam . 'lib/class.tx_dam_guifunc.php';
                 $displayItems = $this->invokingObject->buttonConfig[$this->act . '.']['properties.']['title.']['useDAMColumn.']['displayItems'] ? $this->invokingObject->buttonConfig[$this->act . '.']['properties.']['title.']['useDAMColumn.']['displayItems'] : '';
                 $this->damTitle = tx_dam_guiFunc::meta_compileHoverText($meta, $displayItems, ', ');
             } else {
                 $this->damTitle = 'No media record found: ' . $mediaId;
             }
         }
     }
 }
 /**
  * Creates a file/folder listing.
  * The list does not include any actions (delete,rename,...) but can be used to show the files of a folder. Browsing through folders is deactivated
  *
  * @param	array		$pathInfo Path info array from tx_dam::path_compileInfo()
  * @param	boolean		$renderFolderInfoBar If set a header with the path will be rendered
  * @return	string		HTML output
  */
 function getStaticFolderList($pathInfo, $renderFolderInfoBar = true)
 {
     $content = '';
     $pathInfo = is_array($pathInfo) ? $pathInfo : tx_dam::path_compileInfo($pathInfo);
     $this->_filebrowser_makeDataList($pathInfo);
     $this->_filebrowser_makePreset();
     if ($renderFolderInfoBar) {
         $content .= '<div class="typo3-foldernavbar">' . tx_dam_guiFunc::getFolderInfoBar($pathInfo) . '</div>';
     }
     $content .= $this->getListTable();
     return $content;
 }
Exemplo n.º 17
0
 /**
  * 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']);
 }
 /**
  * Main function
  *
  * @return	string		HTML output
  */
 function main()
 {
     global $BE_USER, $LANG, $BACK_PATH, $TCA;
     $content = '';
     $table = 'tx_dam';
     t3lib_div::loadTCA($table);
     //
     // set language query
     //
     $this->langRows = $this->pObj->getLanguages($this->pObj->defaultPid);
     $this->langCurrent = intval($this->pObj->MOD_SETTINGS['tx_dam_list_langSelector']);
     if (!isset($this->langRows[$this->langCurrent])) {
         $this->langCurrent = $this->pObj->MOD_SETTINGS['tx_dam_list_langSelector'] = key($this->langRows);
     }
     $langQuery = '';
     $languageField = $TCA[$table]['ctrl']['languageField'];
     if ($this->langCurrent and $this->pObj->MOD_SETTINGS['tx_dam_list_langOverlay'] === 'exclusive') {
         // if ($this->langCurrent) { This works but create NULL columns for non-translated records so we need to use language overlay anyway
         $lgOvlFields = tx_dam_db::getLanguageOverlayFields($table, 'tx_dam_lgovl');
         $languageField = $TCA[$table]['ctrl']['languageField'];
         $transOrigPointerField = $TCA[$table]['ctrl']['transOrigPointerField'];
         $this->pObj->selection->setSelectionLanguage($this->langCurrent);
         $this->pObj->selection->qg->query['SELECT']['tx_dam as tx_dam_lgovl'] = implode(', ', $lgOvlFields) . ', tx_dam.uid as _dlg_uid, tx_dam.title as _dlg_title';
         $this->pObj->selection->qg->query['LEFT_JOIN']['tx_dam as tx_dam_lgovl'] = 'tx_dam.uid=tx_dam_lgovl.' . $transOrigPointerField;
         if ($this->pObj->MOD_SETTINGS['tx_dam_list_langOverlay'] === 'exclusive') {
             $this->pObj->selection->qg->query['WHERE']['WHERE']['tx_dam_lgovl.' . $languageField] = 'AND tx_dam_lgovl.' . $languageField . '=' . $this->langCurrent;
             $this->pObj->selection->qg->query['WHERE']['WHERE']['tx_dam_lgovl.deleted'] = 'AND tx_dam_lgovl.deleted=0';
         } else {
             $this->pObj->selection->qg->query['WHERE']['WHERE']['tx_dam_lgovl.' . $languageField] = 'AND (tx_dam_lgovl.' . $languageField . ' IN (' . $this->langCurrent . ',0,-1) )';
             $this->pObj->selection->qg->query['WHERE']['WHERE']['tx_dam_lgovl.deleted'] = 'AND (tx_dam_lgovl.sys_language_uid=1 OR tx_dam.sys_language_uid=0 )';
         }
     } else {
         $this->pObj->selection->qg->query['WHERE']['WHERE']['tx_dam.' . $languageField] = 'AND tx_dam.' . $languageField . ' IN (0,-1)';
     }
     //
     // set query and sorting
     //
     $allFields = tx_dam_db::getFieldListForUser($table);
     if ($this->pObj->MOD_SETTINGS['tx_dam_list_thumbs_sortField']) {
         if (in_array($this->pObj->MOD_SETTINGS['tx_dam_list_thumbs_sortField'], $allFields)) {
             $orderBy = 'tx_dam.' . $this->pObj->MOD_SETTINGS['tx_dam_list_thumbs_sortField'];
         }
     } else {
         $orderBy = $TCA[$table]['ctrl']['sortby'] ? $TCA[$table]['ctrl']['sortby'] : $TCA[$table]['ctrl']['default_sortby'];
         $orderBy = $GLOBALS['TYPO3_DB']->stripOrderBy($orderBy);
         $this->pObj->MOD_SETTINGS['tx_dam_list_thumbs_sortField'] = $orderBy;
     }
     if ($this->pObj->MOD_SETTINGS['tx_dam_list_thumbs_sortRev']) {
         $orderBy .= ' DESC';
     }
     $this->pObj->selection->qg->addOrderBy($orderBy);
     //
     // Use the current selection to create a query and count selected records
     //
     $this->pObj->selection->addSelectionToQuery();
     $this->pObj->selection->execSelectionQuery(TRUE);
     //
     // output header: info bar, result browser, ....
     //
     $content .= $this->pObj->guiItems->getOutput('header');
     $content .= $this->pObj->doc->spacer(10);
     // any records found?
     if ($this->pObj->selection->pointer->countTotal) {
         // TODO move to scbase (see tx_dam_browser too)
         if (is_array($allFields) && count($allFields)) {
             $fieldsSelItems = array();
             foreach ($allFields as $field => $title) {
                 $fL = is_array($TCA[$table]['columns'][$field]) ? preg_replace('#:$#', '', $GLOBALS['LANG']->sL($TCA[$table]['columns'][$field]['label'])) : '[' . $field . ']';
                 $fieldsSelItems[$field] = t3lib_div::fixed_lgd_cs($fL, 15);
             }
             $sortingSelector = $GLOBALS['LANG']->sL('LLL:EXT:dam/lib/locallang.xml:labelSorting', 1) . ' ';
             $sortingSelector .= t3lib_befunc::getFuncMenu('', 'SET[tx_dam_list_thumbs_sortField]', $this->pObj->MOD_SETTINGS['tx_dam_list_thumbs_sortField'], $fieldsSelItems);
             if ($this->pObj->MOD_SETTINGS['tx_dam_list_thumbs_sortRev']) {
                 $href = t3lib_div::linkThisScript(array('SET[tx_dam_list_thumbs_sortRev]' => '0'));
                 $sortingSelector .= '<button name="SET[tx_dam_list_thumbs_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 {
                 $href = t3lib_div::linkThisScript(array('SET[tx_dam_list_thumbs_sortRev]' => '1'));
                 $sortingSelector .= '<button name="SET[tx_dam_list_thumbs_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 = '<form action="' . htmlspecialchars(t3lib_div::linkThisScript()) . '" method="post">' . $sortingSelector . '</form>';
         }
         $this->pObj->markers['LANGUAGE_SELECT'] = $this->pObj->languageSwitch($this->langRows, intval($this->pObj->MOD_SETTINGS['tx_dam_list_langSelector']));
         $content .= $this->pObj->contentLeftRight($sortingSelector, '');
         $content .= $this->pObj->doc->spacer(10);
         //
         // creates thumbnail list
         //
         // limit query for browsing
         $this->pObj->selection->addLimitToQuery();
         $res = $this->pObj->selection->execSelectionQuery();
         $showElements = array();
         if ($this->pObj->MOD_SETTINGS['tx_dam_list_thumbs_showTitle']) {
             $showElements[] = 'title';
         }
         if ($this->pObj->MOD_SETTINGS['tx_dam_list_thumbs_showInfo']) {
             $showElements[] = 'info';
         }
         if ($this->pObj->MOD_SETTINGS['tx_dam_list_thumbs_showIcons']) {
             $showElements[] = 'actions';
         }
         // extra CSS code for HTML header
         $this->pObj->doc->inDocStylesArray['tx_dam_SCbase_dia'] = tx_dam_guiFunc::getDiaStyles($this->diaSize, $this->diaMargin, 5);
         $code = '';
         //
         // init iterator for query
         //
         $conf = array('table' => 'tx_dam', 'countTotal' => $this->pObj->selection->pointer->countTotal);
         if ($this->langCurrent > 0 and $this->pObj->MOD_SETTINGS['tx_dam_list_langOverlay'] !== 'exclusive') {
             $dbIterator = new tx_dam_iterator_db_lang_ovl($res, $conf);
             $dbIterator->initLanguageOverlay($table, $this->pObj->MOD_SETTINGS['tx_dam_list_langSelector']);
         } else {
             $dbIterator = new tx_dam_iterator_db($res, $conf);
         }
         if ($dbIterator->count()) {
             while ($dbIterator->valid() and $dbIterator->currentPointer < $this->pObj->selection->pointer->itemsPerPage) {
                 $row = $dbIterator->current();
                 $onClick = $this->pObj->doc->wrapClickMenuOnIcon('', $table, $row['uid'], $listFr = 1, $addParams = '', $enDisItems = '', $returnOnClick = TRUE);
                 $actions = $this->getItemControl($row);
                 $code .= tx_dam_guiFunc::getDia($row, $this->diaSize, $this->diaMargin, $showElements, $onClick, true, $actions);
                 $dbIterator->next();
             }
         }
         $content .= $this->pObj->doc->spacer(5);
         $content .= $this->pObj->doc->section('', '<div style="line-height:' . ($this->diaSize + 7 + 8) . 'px;">' . $code . '</div><br style="clear:left" />', 0, 1);
     }
     return $content;
 }
 /**
  * Render statistics about indexed media types
  *
  * @return	string		HTML output
  */
 function statisticsMediaType($addFileTypes = true)
 {
     global $LANG;
     $content = '';
     // init table layout
     $tableLayout = array('table' => array('<table border="0" cellspacing="1" cellpadding="2" style="width:auto;">', '</table>'), '0' => array('tr' => array('<tr class="bgColor2">', '</tr>'), 'defCol' => array('<td align="center">', '</td>')), 'defRow' => array('tr' => array('<tr class="bgColor3-20">', '</tr>'), '1' => array('<td align="center">', '</td>'), '4' => array('<td align="right" style="padding-right:0.5em;">', '</td>'), '5' => array('<td align="right" style="padding-right:0.5em;">', '</td>'), 'defCol' => array('<td>', '</td>')));
     $table = array();
     $tr = 0;
     // add header row
     $table[$tr][] = '&nbsp';
     $table[$tr][] = $LANG->getLL('mediaTypes', 1);
     $table[$tr][] = '&nbsp';
     $table[$tr][] = '&nbsp';
     $table[$tr][] = 'Count';
     $table[$tr][] = 'Total';
     $totalCount = 0;
     foreach ($GLOBALS['T3_VAR']['ext']['dam']['media2code'] as $media_type) {
         $whereClauses = array();
         $whereClauses['media_type'] = 'media_type=' . $media_type;
         $rows = tx_dam_db::getDataWhere('COUNT(uid) as count', $whereClauses);
         reset($rows);
         $row = current($rows);
         $count = $row['count'];
         $totalCount += $count;
         $icon = tx_dam_guiFunc::icon_getMediaTypeImgTag(array('media_type' => $media_type), '', false);
         $mediaTypeName = tx_dam_guiFunc::convert_mediaType($media_type);
         // add row to table
         $tr++;
         $table[$tr][] = $icon;
         $table[$tr][] = '<strong>' . htmlspecialchars($mediaTypeName) . '</strong>';
         $table[$tr][] = '&nbsp;';
         $table[$tr][] = '&nbsp;';
         $table[$tr][] = '&nbsp;';
         $table[$tr][] = '<strong>' . $count . '</strong>';
         $tableLayout[$tr]['tr'] = array('<tr class="bgColor4">', '</tr>');
         if ($addFileTypes) {
             if ($contentFileTypes = $this->statisticsFileType($media_type)) {
                 foreach ($contentFileTypes as $fileTypeRow) {
                     // add row to table
                     $tr++;
                     $table[$tr][] = '&nbsp';
                     $table[$tr][] = '&nbsp';
                     $table[$tr][] = $fileTypeRow[0];
                     $table[$tr][] = $fileTypeRow[1];
                     $table[$tr][] = $fileTypeRow[2];
                     $table[$tr][] = '&nbsp';
                 }
             }
         }
         // add row to table
         $tr++;
         $table[$tr][] = '<span></span>';
         $table[$tr][] = '<span></span>';
         $table[$tr][] = '<span></span>';
         $table[$tr][] = '<span></span>';
         $table[$tr][] = '<span></span>';
         $table[$tr][] = '<span></span>';
         $tableLayout[$tr]['tr'] = array('<tr class="bgColor" style="height:0.5em;">', '</tr>');
     }
     // add row to table
     $tr++;
     $table[$tr][] = '&nbsp;';
     $table[$tr][] = '&nbsp;';
     $table[$tr][] = '&nbsp;';
     $table[$tr][] = '&nbsp;';
     $table[$tr][] = '&nbsp;';
     $table[$tr][] = '<strong>' . $totalCount . '</strong>';
     $tableLayout[$tr]['tr'] = array('<tr class="bgColor4-20">', '</tr>');
     $content .= $this->pObj->doc->table($table, $tableLayout);
     return $content;
 }
    /**
     * Making the formfields for folder creation
     *
     * @return	string		HTML content
     */
    function renderForm()
    {
        global $BACK_PATH, $LANG;
        $content = '';
        $msg = '<input type="hidden" name="redirect" value="' . htmlspecialchars($this->pObj->redirect) . '" />';
        $number = t3lib_div::intInRange(t3lib_div::_GP('number'), 1, 10);
        $GLOBALS['SOBE']->doc->JScode = $GLOBALS['SOBE']->doc->wrapScriptTags('
			function reload(a)	{	//
				if (!changed || (changed && confirm(' . $LANG->JScharCode($LANG->sL('LLL:EXT:lang/locallang_core.xml:mess.redraw')) . ')))	{
					var params = "&number="+a;
					document.location.href = "' . t3lib_div::linkThisScript() . '"+params;
				}
			}

			var changed = 0;
		');
        //$content .='</form><form action="'.$BACK_PATH.'tce_file.php" method="post" name="editform">';
        $this->pObj->markers['FOLDER_INFO'] = tx_dam_guiFunc::getFolderInfoBar($this->folder);
        // Making the selector box for the number of concurrent folder-creations
        $msg .= '
			<div id="c-select">
				<select name="number" onchange="reload(this.options[this.selectedIndex].value);">';
        for ($a = 1; $a <= $this->folderNumber; $a++) {
            $msg .= '
					<option value="' . $a . '"' . ($number == $a ? ' selected="selected"' : '') . '>' . $a . ' ' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:file_newfolder.php.folders', 1) . '</option>';
        }
        $msg .= '
				</select>
			</div>
			';
        // Making the number of new-folder boxes needed:
        $msg .= '
			<div id="c-createFolders">
			' . $LANG->getLL('foldername', 1) . '
		';
        for ($a = 0; $a < $number; $a++) {
            $msg .= '
					<div>' . ($number > 1 ? $a + 1 . '. ' : '') . '<input' . $GLOBALS['SOBE']->doc->formWidth(20) . ' type="text" name="file[newfolder][' . $a . '][data]" onchange="changed=true;" />
					<input type="hidden" name="file[newfolder][' . $a . '][target]" value="' . htmlspecialchars($this->folder['dir_path_absolute']) . '" /></div>
				';
        }
        $msg .= '
			</div>
		';
        $this->pObj->docHeaderButtons['SAVE'] = '<input class="c-inputButton" name="_savedok"' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/savedok.gif') . ' title="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:file_newfolder.php.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;
    }
    /**
     * Making the form for create file
     *
     * @return	string		HTML content
     */
    function renderForm($fileContent = '')
    {
        global $BE_USER, $LANG, $TYPO3_CONF_VARS;
        $content = '';
        $msg = array();
        $this->pObj->markers['FOLDER_INFO'] = tx_dam_guiFunc::getFolderInfoBar(tx_dam::path_compileInfo($this->pObj->media->pathAbsolute));
        $msg[] = '&nbsp;';
        $this->pObj->markers['FILE_INFO'] = $GLOBALS['LANG']->sL('LLL:EXT:dam/locallang_db.xml:tx_dam_item.file_name', 1) . ' <strong>' . htmlspecialchars($this->pObj->media->filename) . '</strong>';
        $msg[] = '&nbsp;';
        $msg[] = $GLOBALS['LANG']->getLL('tx_dam_cmd_filenew.text_content', 1);
        $msg[] = '<textarea rows="30" name="data[file_content]" wrap="off"' . $this->pObj->doc->formWidthText(48, 'width:99%;height:65%', 'off') . ' class="fixed-font enable-tab">' . t3lib_div::formatForTextarea($fileContent) . '</textarea>';
        $this->pObj->docHeaderButtons['SAVE'] = '<input class="c-inputButton" name="_savedok"' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/savedok.gif') . ' title="' . $GLOBALS['LANG']->getLL('labelCmdSave', 1) . '" height="16" type="image" width="16">';
        $this->pObj->docHeaderButtons['SAVE_CLOSE'] = '<input class="c-inputButton" name="_saveandclosedok"' . t3lib_iconWorks::skinImg($this->pObj->doc->backPath, 'gfx/saveandclosedok.gif') . ' title="' . $GLOBALS['LANG']->getLL('labelCmdSaveClose', 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>';
        if (tx_dam::config_checkValueEnabled('mod.txdamM1_SHARED.displayExtraButtons', 1)) {
            $buttons = '
				<input type="submit" name="save" value="' . $GLOBALS['LANG']->getLL('labelCmdSave', 1) . '" />
				<input type="submit" name="_saveandclosedok_x" value="' . $GLOBALS['LANG']->getLL('labelCmdSaveClose', 1) . '" />
				<input type="submit" value="' . $LANG->sL('LLL:EXT:lang/locallang_core.xml:labels.cancel', 1) . '" onclick="jumpBack(); return false;" />';
        }
        $content .= $GLOBALS['SOBE']->getMessageBox($GLOBALS['SOBE']->pageTitle, $msg, $buttons, 1);
        return $content;
    }
 /**
  * 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;
 }