/**
	 * (non-PHPdoc)
	 * @see classes/preview/tx_templavoila_preview_type_text#render_previewContent($row, $table, $output, $alreadyRendered, $ref)
	 */
	public function render_previewContent ($row, $table, $output, $alreadyRendered, &$ref) {

		$this->parentObj = $ref;

		$uploadDir = $GLOBALS['TCA']['tt_content']['columns']['image']['config']['internal_type'] == 'file_reference' ? '' : NULL;

		$thumbnail = '<strong>'.$GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel('tt_content','image'),1).'</strong><br />';
		$thumbnail .= t3lib_BEfunc::thumbCode($row, 'tt_content', 'image', $ref->doc->backPath, '', $uploadDir);

		$label = $this->getPreviewLabel();
		$data = $this->getPreviewData($row);

		if ($ref->currentElementBelongsToCurrentPage) {
			$text = $ref->link_edit('<strong>'. $label .'</strong> ' . $data ,'tt_content',$row['uid']);
		} else {
			$text = '<strong>'. $label .'</strong> ' . $data;
		}

		return '
		<table>
			<tr>
				<td valign="top">' . $text . '</td>
				<td valign="top">' . $thumbnail . '</td>
			</tr>
		</table>';
	}
 /**
  * (non-PHPdoc)
  * @see classes/preview/tx_templavoila_preview_type_text#render_previewContent($row, $table, $output, $alreadyRendered, $ref)
  */
 public function render_previewContent($row, $table, $output, $alreadyRendered, &$ref)
 {
     $label = $this->getPreviewLabel();
     if ($ref->currentElementBelongsToCurrentPage) {
         $text = $ref->link_edit('<strong>' . $label . '</strong>', 'tt_content', $row['uid']);
     } else {
         $text = '<strong>' . $label . '</strong>';
     }
     $text .= t3lib_BEfunc::thumbCode($row, 'tt_content', 'image', $ref->doc->backPath);
     return $text;
 }
    /**
     * Create visual difference view of two records. Using t3lib_diff library
     *
     * @param	string		Table name
     * @param	array		New version record (green)
     * @param	array		Old version record (red)
     * @return	array		Array with two keys (0/1) with HTML content / percentage integer (if -1, then it means N/A) indicating amount of change
     */
    function createDiffView($table, $diff_1_record, $diff_2_record)
    {
        global $TCA, $LANG;
        // Initialize:
        $pctChange = 'N/A';
        // Check that records are arrays:
        if (is_array($diff_1_record) && is_array($diff_2_record)) {
            // Load full table description and initialize diff-object:
            t3lib_div::loadTCA($table);
            $t3lib_diff_Obj = t3lib_div::makeInstance('t3lib_diff');
            // Add header row:
            $tRows = array();
            $tRows[] = '
				<tr class="bgColor5 tableheader">
					<td>' . $LANG->getLL('diffview_label_field_name') . '</td>
					<td width="98%" nowrap="nowrap">' . $LANG->getLL('diffview_label_colored_diff_view') . '</td>
				</tr>
			';
            // Initialize variables to pick up string lengths in:
            $allStrLen = 0;
            $diffStrLen = 0;
            // Traversing the first record and process all fields which are editable:
            foreach ($diff_1_record as $fN => $fV) {
                if ($TCA[$table]['columns'][$fN] && $TCA[$table]['columns'][$fN]['config']['type'] != 'passthrough' && !t3lib_div::inList('t3ver_label', $fN)) {
                    // Check if it is files:
                    $isFiles = FALSE;
                    if (strcmp(trim($diff_1_record[$fN]), trim($diff_2_record[$fN])) && $TCA[$table]['columns'][$fN]['config']['type'] == 'group' && $TCA[$table]['columns'][$fN]['config']['internal_type'] == 'file') {
                        // Initialize:
                        $uploadFolder = $TCA[$table]['columns'][$fN]['config']['uploadfolder'];
                        $files1 = array_flip(t3lib_div::trimExplode(',', $diff_1_record[$fN], 1));
                        $files2 = array_flip(t3lib_div::trimExplode(',', $diff_2_record[$fN], 1));
                        // Traverse filenames and read their md5 sum:
                        foreach ($files1 as $filename => $tmp) {
                            $files1[$filename] = @is_file(PATH_site . $uploadFolder . '/' . $filename) ? md5(t3lib_div::getUrl(PATH_site . $uploadFolder . '/' . $filename)) : $filename;
                        }
                        foreach ($files2 as $filename => $tmp) {
                            $files2[$filename] = @is_file(PATH_site . $uploadFolder . '/' . $filename) ? md5(t3lib_div::getUrl(PATH_site . $uploadFolder . '/' . $filename)) : $filename;
                        }
                        // Implode MD5 sums and set flag:
                        $diff_1_record[$fN] = implode(' ', $files1);
                        $diff_2_record[$fN] = implode(' ', $files2);
                        $isFiles = TRUE;
                    }
                    // If there is a change of value:
                    if (strcmp(trim($diff_1_record[$fN]), trim($diff_2_record[$fN]))) {
                        // Get the best visual presentation of the value and present that:
                        $val1 = t3lib_BEfunc::getProcessedValue($table, $fN, $diff_2_record[$fN], 0, 1);
                        $val2 = t3lib_BEfunc::getProcessedValue($table, $fN, $diff_1_record[$fN], 0, 1);
                        // Make diff result and record string lenghts:
                        $diffres = $t3lib_diff_Obj->makeDiffDisplay($val1, $val2, $isFiles ? 'div' : 'span');
                        $diffStrLen .= $t3lib_diff_Obj->differenceLgd;
                        $allStrLen .= strlen($val1 . $val2);
                        // If the compared values were files, substituted MD5 hashes:
                        if ($isFiles) {
                            $allFiles = array_merge($files1, $files2);
                            foreach ($allFiles as $filename => $token) {
                                if (strlen($token) == 32 && strstr($diffres, $token)) {
                                    $filename = t3lib_BEfunc::thumbCode(array($fN => $filename), $table, $fN, $this->doc->backPath) . $filename;
                                    $diffres = str_replace($token, $filename, $diffres);
                                }
                            }
                        }
                        ############# new hook for post processing of DAM images
                        if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/user/ws/class.wslib_gui.php']['postProcessDiffView'])) {
                            foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/mod/user/ws/class.wslib_gui.php']['postProcessDiffView'] as $classRef) {
                                $hookObject =& t3lib_div::getUserObj($classRef);
                                if (method_exists($hookObject, 'postProcessDiffView')) {
                                    $diffres = $hookObject->postProcessDiffView($table, $fN, $diff_2_record, $diff_1_record, $diffres, $this);
                                }
                            }
                        }
                        #############
                        // Add table row with result:
                        $tRows[] = '
							<tr class="bgColor4">
								<td>' . htmlspecialchars($GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($table, $fN))) . '</td>
								<td width="98%">' . $diffres . '</td>
							</tr>
						';
                    } else {
                        // Add string lengths even if value matched - in this was the change percentage is not high if only a single field is changed:
                        $allStrLen += strlen($diff_1_record[$fN] . $diff_2_record[$fN]);
                    }
                }
            }
            // Calculate final change percentage:
            $pctChange = $allStrLen ? ceil($diffStrLen * 100 / $allStrLen) : -1;
            // Create visual representation of result:
            if (count($tRows) > 1) {
                $content .= '<table border="0" cellpadding="1" cellspacing="1" class="diffTable">' . implode('', $tRows) . '</table>';
            } else {
                $content .= '<span class="nobr">' . $this->doc->icons(1) . $LANG->getLL('diffview_complete_match') . '</span>';
            }
        } else {
            $content .= $this->doc->icons(3) . $LANG->getLL('diffview_cannot_find_records');
        }
        // Return value:
        return array($content, $pctChange);
    }
 /**
  * Create thumbnail code for record/field
  *
  * @param	array		Record array
  * @param	string		Table (record is from)
  * @param	string		Field name for which thumbsnail are to be rendered.
  * @return	string		HTML for thumbnails, if any.
  */
 function thumbCode($row, $table, $field)
 {
     #TODO		$file = tx_dam::path_makeAbsolute($row['file_path']).$row['file_name'];
     return t3lib_BEfunc::thumbCode($row, $table, $field, $this->backPath, $this->thumbScript);
 }
예제 #5
0
파일: index.php 프로젝트: rod86/t3sandbox
 /**
  * Merge the datastructure and the related content into a proper tree-structure
  *
  * @param array $fieldData
  * @param string $table
  * @param integer $uid
  * @param string $vKey
  * @return array
  */
 function render_previewSubData($fieldData, $table, $uid, $vKey)
 {
     if (!is_array($fieldData)) {
         return;
     }
     $result = '';
     foreach ($fieldData as $fieldKey => $fieldValue) {
         if (isset($fieldValue['config']['tx_templavoila']['preview']) && $fieldValue['config']['tx_templavoila']['preview'] == 'disable') {
             continue;
         }
         if ($fieldValue['config']['type'] == 'array') {
             if (isset($fieldValue['data']['el'])) {
                 if ($fieldValue['config']['section']) {
                     $result .= '<strong>';
                     $label = $fieldValue['config']['TCEforms']['label'] ? $fieldValue['config']['TCEforms']['label'] : $fieldValue['config']['tx_templavoila']['title'];
                     $result .= $this->localizedFFLabel($label, 1);
                     $result .= '</strong>';
                     $result .= '<ul>';
                     foreach ($fieldValue['data']['el'] as $i => $sub) {
                         $data = $this->render_previewSubData($sub, $table, $uid, $vKey);
                         if ($data) {
                             $result .= '<li>' . $data . '</li>';
                         }
                     }
                     $result .= '</ul>';
                 } else {
                     $result .= $this->render_previewSubData($fieldValue['data']['el'], $table, $uid, $vKey);
                 }
             }
         } else {
             $label = $data = '';
             if (isset($fieldValue['config']['TCEforms']['config']['type']) && $fieldValue['config']['TCEforms']['config']['type'] == 'group') {
                 if ($fieldValue['config']['TCEforms']['config']['internal_type'] == 'file') {
                     // Render preview for images:
                     $thumbnail = t3lib_BEfunc::thumbCode(array('dummyFieldName' => $fieldValue['data'][$vKey]), '', 'dummyFieldName', $this->doc->backPath, '', $fieldValue['config']['TCEforms']['config']['uploadfolder']);
                     if (isset($fieldValue['config']['TCEforms']['label'])) {
                         $label = $this->localizedFFLabel($fieldValue['config']['TCEforms']['label'], 1);
                     }
                     $data = $thumbnail;
                 }
             } else {
                 if (isset($fieldValue['config']['TCEforms']['config']['type']) && $fieldValue['config']['TCEforms']['config']['type'] != '') {
                     // Render for everything else:
                     if (isset($fieldValue['config']['TCEforms']['label'])) {
                         $label = $this->localizedFFLabel($fieldValue['config']['TCEforms']['label'], 1);
                     }
                     $data = !$fieldValue['data'][$vKey] ? '' : $this->link_edit(htmlspecialchars(t3lib_div::fixed_lgd_cs(strip_tags($fieldValue['data'][$vKey]), 200)), $table, $uid);
                 } else {
                     // @todo no idea what we should to here
                 }
             }
             if ($label && $data) {
                 $result .= '<strong>' . $label . '</strong> ' . $data . '<br />';
             }
         }
     }
     return $result;
 }
 /**
  * Renders HTML table with all available template resources/files in the current rootline that could be copied
  *
  * @param	integer		$id: The uid of the current page
  * @param	integer		$template_uid: The uid of the template record to be rendered (only if more than one template on the current page)
  * @return	string		HTML table with all available template resources/files in the current rootline that could be copied
  */
 function resourceListForCopy($id, $template_uid)
 {
     global $tmpl;
     $sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
     $rootLine = $sys_page->getRootLine($id);
     $tmpl->runThroughTemplates($rootLine, $template_uid);
     // This generates the constants/config + hierarchy info for the template.
     $theResources = t3lib_div::trimExplode(',', $tmpl->resources, 1);
     foreach ($theResources as $k => $v) {
         $fI = pathinfo($v);
         if (t3lib_div::inList($this->pObj->textExtensions, strtolower($fI['extension']))) {
             $path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $v;
             $thumb = t3lib_BEfunc::thumbCode(array('resources' => $v), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
             $out .= '<tr><td' . $bgcol . ' nowrap>' . $v . '&nbsp;&nbsp;</td><td' . $bgcol . ' nowrap>&nbsp;' . t3lib_div::formatSize(@filesize($path)) . '&nbsp;</td><td' . $bgcol . '>' . trim($thumb) . '</td><td><input type="Checkbox" name="data[makecopy_resource][' . $k . ']" value="' . htmlspecialchars($v) . '"></td></tr>';
         }
     }
     $out = $out ? '<table border=0 cellpadding=0 cellspacing=0>' . $out . '</table>' : '';
     return $out;
 }
    /**
     * This functions returns the HTML-code that creates the editor-layout of the module.
     *
     * @param	[type]		$theConstants: ...
     * @param	[type]		$category: ...
     * @return	[type]		...
     */
    function ext_printFields($theConstants, $category)
    {
        reset($theConstants);
        $output = '<script type="text/javascript" src="' . $GLOBALS['BACK_PATH'] . 'js/constantEditor.js"></script>
		';
        $subcat = '';
        if (is_array($this->categories[$category])) {
            $help = $this->helpConfig;
            $this->rArr = explode(',', $this->setup['resources'] . ',' . implode($this->dirResources, ','));
            if (!$this->doNotSortCategoriesBeforeMakingForm) {
                asort($this->categories[$category]);
            }
            foreach ($this->categories[$category] as $name => $type) {
                $params = $theConstants[$name];
                if (is_array($params)) {
                    if ($subcat != $params['subcat_name']) {
                        $subcat = $params['subcat_name'];
                        $subcat_name = $params['subcat_name'] ? $this->subCategories[$params['subcat_name']][0] : 'Others';
                        $output .= '<h2 class="typo3-tstemplate-ceditor-subcat">' . $subcat_name . '</h2>';
                    }
                    $label = $GLOBALS['LANG']->sL($params['label']);
                    $label_parts = explode(':', $label, 2);
                    if (count($label_parts) == 2) {
                        $head = trim($label_parts[0]);
                        $body = trim($label_parts[1]);
                    } else {
                        $head = trim($label_parts[0]);
                        $body = '';
                    }
                    if (strlen($head) > 35) {
                        if (!$body) {
                            $body = $head;
                        }
                        $head = t3lib_div::fixed_lgd_cs($head, 35);
                    }
                    $typeDat = $this->ext_getTypeData($params['type']);
                    $checked = '';
                    $p_field = '';
                    $raname = substr(md5($params['name']), 0, 10);
                    $aname = '\'' . $raname . '\'';
                    list($fN, $fV, $params) = $this->ext_fNandV($params);
                    switch ($typeDat['type']) {
                        case 'int':
                        case 'int+':
                            $p_field = '<input id="' . $fN . '" type="text" name="' . $fN . '" value="' . $fV . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(5) . ' onChange="uFormUrl(' . $aname . ')" />';
                            if ($typeDat['paramstr']) {
                                $p_field .= ' Range: ' . $typeDat['paramstr'];
                            } elseif ($typeDat['type'] == 'int+') {
                                $p_field .= ' Range: 0 - ';
                            } else {
                                $p_field .= ' (Integer)';
                            }
                            break;
                        case 'color':
                            $colorNames = explode(',', ',' . $this->HTMLcolorList);
                            $p_field = '';
                            foreach ($colorNames as $val) {
                                $sel = '';
                                if ($val == strtolower($params['value'])) {
                                    $sel = ' selected';
                                }
                                $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $val . '</option>';
                            }
                            $p_field = '<select id="select-' . $fN . '" rel="' . $fN . '" name="C' . $fN . '" class="typo3-tstemplate-ceditor-color-select" onChange="uFormUrl(' . $aname . ');">' . $p_field . '</select>';
                            $p_field .= '<input type="text" id="input-' . $fN . '" rel="' . $fN . '" name="' . $fN . '" class="typo3-tstemplate-ceditor-color-input" value="' . $fV . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(7) . ' onChange="uFormUrl(' . $aname . ')" />';
                            break;
                        case 'wrap':
                            $wArr = explode('|', $fV);
                            $p_field = '<input type="text" id="' . $fN . '" name="' . $fN . '" value="' . $wArr[0] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(29) . ' onChange="uFormUrl(' . $aname . ')" />';
                            $p_field .= ' | ';
                            $p_field .= '<input type="text" name="W' . $fN . '" value="' . $wArr[1] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(15) . ' onChange="uFormUrl(' . $aname . ')" />';
                            break;
                        case 'offset':
                            $wArr = explode(',', $fV);
                            $labels = t3lib_div::trimExplode(',', $typeDat['paramstr']);
                            $p_field = ($labels[0] ? $labels[0] : 'x') . ':<input type="text" name="' . $fN . '" value="' . $wArr[0] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />';
                            $p_field .= ' , ';
                            $p_field .= ($labels[1] ? $labels[1] : 'y') . ':<input type="text" name="W' . $fN . '" value="' . $wArr[1] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />';
                            for ($aa = 2; $aa < count($labels); $aa++) {
                                if ($labels[$aa]) {
                                    $p_field .= ' , ' . $labels[$aa] . ':<input type="text" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth(4) . ' onChange="uFormUrl(' . $aname . ')" />';
                                } else {
                                    $p_field .= '<input type="hidden" name="W' . $aa . $fN . '" value="' . $wArr[$aa] . '" />';
                                }
                            }
                            break;
                        case 'options':
                            if (is_array($typeDat['params'])) {
                                $p_field = '';
                                foreach ($typeDat['params'] as $val) {
                                    $vParts = explode('=', $val, 2);
                                    $label = $vParts[0];
                                    $val = isset($vParts[1]) ? $vParts[1] : $vParts[0];
                                    // option tag:
                                    $sel = '';
                                    if ($val == $params['value']) {
                                        $sel = ' selected';
                                    }
                                    $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $GLOBALS['LANG']->sL($label) . '</option>';
                                }
                                $p_field = '<select id="' . $fN . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
                            }
                            break;
                        case 'boolean':
                            $p_field = '<input type="hidden" name="' . $fN . '" value="0" />';
                            $sel = '';
                            if ($fV) {
                                $sel = ' checked';
                            }
                            $p_field .= '<input id="' . $fN . '" type="checkbox" name="' . $fN . '" value="' . ($typeDat['paramstr'] ? $typeDat['paramstr'] : 1) . '"' . $sel . ' onClick="uFormUrl(' . $aname . ')" />';
                            break;
                        case 'comment':
                            $p_field = '<input type="hidden" name="' . $fN . '" value="#" />';
                            $sel = '';
                            if (!$fV) {
                                $sel = ' checked';
                            }
                            $p_field .= '<input id="' . $fN . '" type="checkbox" name="' . $fN . '" value=""' . $sel . ' onClick="uFormUrl(' . $aname . ')" />';
                            break;
                        case 'file':
                            $p_field = '<option value=""></option>';
                            $theImage = '';
                            $selectThisFile = $this->extractFromResources($this->setup['resources'], $params['value']);
                            if ($params['value'] && !$selectThisFile) {
                                if (in_array($params['value'], $this->dirResources)) {
                                    $selectThisFile = $params['value'];
                                }
                            }
                            // extensionlist
                            $extList = $typeDat['paramstr'];
                            $p_field = '<option value="">(' . $extList . ')</option>';
                            if ($extList == 'IMAGE_EXT') {
                                $extList = $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'];
                            }
                            reset($this->rArr);
                            $onlineResourceFlag = $this->ext_defaultOnlineResourceFlag;
                            foreach ($this->rArr as $c => $val) {
                                $val = trim($val);
                                $fI = t3lib_div::split_fileref($val);
                                if ($val && (!$extList || t3lib_div::inList($extList, $fI['fileext']))) {
                                    if ($onlineResourceFlag <= 0 && strstr($fI['path'], $GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'])) {
                                        if ($onlineResourceFlag < 0) {
                                            $p_field .= '<option value=""></option>';
                                        }
                                        $p_field .= '<option value="">__' . $fI['path'] . '__:</option>';
                                        $onlineResourceFlag = 1;
                                    }
                                    $dims = $this->resourceDimensions[$val];
                                    $sel = '';
                                    // Check if $params['value'] is in the list of resources.
                                    if ($selectThisFile && $selectThisFile == $val) {
                                        $sel = ' selected';
                                        if ($onlineResourceFlag <= 0) {
                                            $theImage = t3lib_BEfunc::thumbCode(array('resources' => $selectThisFile), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
                                        } else {
                                            $theImage = t3lib_BEfunc::thumbCode(array('resources' => $fI['file']), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '', $fI['path']);
                                        }
                                    }
                                    if ($onlineResourceFlag <= 0) {
                                        $onlineResourceFlag--;
                                        // Value is set with a *
                                        $val = $this->ext_setStar($val);
                                        $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $val . $dims . '</option>';
                                    } else {
                                        $p_field .= '<option value="' . htmlspecialchars($val) . '"' . $sel . '>' . $fI['file'] . $dims . '</option>';
                                    }
                                }
                            }
                            if (trim($params['value']) && !$selectThisFile) {
                                $val = $params['value'];
                                $p_field .= '<option value=""></option>';
                                $p_field .= '<option value="' . htmlspecialchars($val) . '" selected>' . $val . '</option>';
                            }
                            $p_field = '<select id="' . $fN . '" name="' . $fN . '" onChange="uFormUrl(' . $aname . ')">' . $p_field . '</select>';
                            $p_field .= $theImage;
                            if (!$this->ext_noCEUploadAndCopying) {
                                // Copy a resource
                                $copyFile = $this->extractFromResources($this->setup['resources'], $params['value']);
                                if (!$copyFile) {
                                    if ($params['value']) {
                                        $copyFile = PATH_site . $this->ext_detectAndFixExtensionPrefix($params['value']);
                                    }
                                } else {
                                    $copyFile = '';
                                }
                                if ($copyFile && @is_file($copyFile)) {
                                    $p_field .= '<img src="clear.gif" width="20" ' . 'height="1" alt="" />' . t3lib_iconWorks::getSpriteIcon('actions-edit-copy') . '<input type="checkbox" ' . 'name="_copyResource[' . $params['name'] . ']" value="' . htmlspecialchars($copyFile) . '" onclick="uFormUrl(' . $aname . ');if (this.checked && !confirm(\'' . t3lib_div::slashJS(htmlspecialchars(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_tsparser.xml:tsparser_ext.make_copy'), $params['value']))) . '\')) this.checked=false;" />';
                                }
                                // Upload?
                                $p_field .= '<br />';
                                $p_field .= '<input id="' . $fN . '" type="file" name="upload_' . $fN . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth() . ' onChange="uFormUrl(' . $aname . ')" size="50" />';
                            }
                            break;
                        case 'user':
                            $userFunction = $typeDat['paramstr'];
                            $userFunctionParams = array('fieldName' => $fN, 'fieldValue' => $fV);
                            $p_field = t3lib_div::callUserFunction($userFunction, $userFunctionParams, $this, '');
                            break;
                        case 'small':
                        default:
                            $fwidth = $typeDat['type'] == 'small' ? 10 : 46;
                            $p_field = '<input id="' . $fN . '" type="text" name="' . $fN . '" value="' . $fV . '"' . $GLOBALS['TBE_TEMPLATE']->formWidth($fwidth) . ' onChange="uFormUrl(' . $aname . ')" />';
                            break;
                    }
                    // Define default names and IDs
                    $userTyposcriptID = 'userTS-' . $params['name'];
                    $defaultTyposcriptID = 'defaultTS-' . $params['name'];
                    $checkboxName = 'check[' . $params['name'] . ']';
                    $checkboxID = $checkboxName;
                    // Handle type=color specially
                    if ($typeDat['type'] == 'color' && substr($params['value'], 0, 2) != '{$') {
                        $color = '<div id="colorbox-' . $fN . '" class="typo3-tstemplate-ceditor-colorblock" style="background-color:' . $params['value'] . ';">&nbsp;</div>';
                    } else {
                        $color = '';
                    }
                    if (!$this->ext_dontCheckIssetValues) {
                        /* Set the default styling options */
                        if (isset($this->objReg[$params['name']])) {
                            $checkboxValue = 'checked';
                            $userTyposcriptStyle = '';
                            $defaultTyposcriptStyle = 'style="display:none;"';
                        } else {
                            $checkboxValue = '';
                            $userTyposcriptStyle = 'style="display:none;"';
                            $defaultTyposcriptStyle = '';
                        }
                        $deleteIconHTML = t3lib_iconWorks::getSpriteIcon('actions-edit-undo', array('class' => "typo3-tstemplate-ceditor-control undoIcon", 'alt' => "Revert to default Constant", 'title' => "Revert to default Constant", 'rel' => $params['name']));
                        $editIconHTML = t3lib_iconWorks::getSpriteIcon('actions-document-open', array('class' => "typo3-tstemplate-ceditor-control editIcon", 'alt' => "Edit this Constant", 'title' => "Edit this Constant", 'rel' => $params['name']));
                        $constantCheckbox = '<input type="hidden" name="' . $checkboxName . '" id="' . $checkboxID . '" value="' . $checkboxValue . '"/>';
                        // If there's no default value for the field, use a static label.
                        if (!$params['default_value']) {
                            $params['default_value'] = '[Empty]';
                        }
                        $constantDefaultRow = '<div class="typo3-tstemplate-ceditor-row" id="' . $defaultTyposcriptID . '" ' . $defaultTyposcriptStyle . '>' . $editIconHTML . htmlspecialchars($params['default_value']) . $color . '</div>';
                    }
                    $constantEditRow = '<div class="typo3-tstemplate-ceditor-row" id="' . $userTyposcriptID . '" ' . $userTyposcriptStyle . '>' . $deleteIconHTML . $p_field . $color . '</div>';
                    $constantLabel = '<dt class="typo3-tstemplate-ceditor-label">' . htmlspecialchars($head) . '</dt>';
                    $constantName = '<dt class="typo3-dimmed">[' . $params['name'] . ']</dt>';
                    $constantDescription = $body ? '<dd>' . htmlspecialchars($body) . '</dd>' : '';
                    $constantData = '<dd>' . $constantCheckbox . $constantEditRow . $constantDefaultRow . '</dd>';
                    $output .= '<a name="' . $raname . '"></a>' . $help['constants'][$params['name']];
                    $output .= '<dl class="typo3-tstemplate-ceditor-constant">' . $constantLabel . $constantName . $constantDescription . $constantData . '</dl>';
                } else {
                    debug('Error. Constant did not exist. Should not happen.');
                }
            }
        }
        return $output;
    }
예제 #8
0
 /**
  * Fetch futher information to current selected worspace record.
  *
  * @param object $parameter
  * @return array $data
  */
 public function getRowDetails($parameter)
 {
     global $TCA, $BE_USER;
     $diffReturnArray = array();
     $liveReturnArray = array();
     $t3lib_diff = t3lib_div::makeInstance('t3lib_diff');
     $stagesService = t3lib_div::makeInstance('Tx_Workspaces_Service_Stages');
     $liveRecord = t3lib_BEfunc::getRecord($parameter->table, $parameter->t3ver_oid);
     $versionRecord = t3lib_BEfunc::getRecord($parameter->table, $parameter->uid);
     $icon_Live = t3lib_iconWorks::mapRecordTypeToSpriteIconClass($parameter->table, $liveRecord);
     $icon_Workspace = t3lib_iconWorks::mapRecordTypeToSpriteIconClass($parameter->table, $versionRecord);
     $stagePosition = $stagesService->getPositionOfCurrentStage($parameter->stage);
     $fieldsOfRecords = array_keys($liveRecord);
     // get field list from TCA configuration, if available
     if ($TCA[$parameter->table]) {
         if ($TCA[$parameter->table]['interface']['showRecordFieldList']) {
             $fieldsOfRecords = $TCA[$parameter->table]['interface']['showRecordFieldList'];
             $fieldsOfRecords = t3lib_div::trimExplode(',', $fieldsOfRecords, 1);
         }
     }
     foreach ($fieldsOfRecords as $fieldName) {
         // check for exclude fields
         if ($GLOBALS['BE_USER']->isAdmin() || $TCA[$parameter->table]['columns'][$fieldName]['exclude'] == 0 || t3lib_div::inList($BE_USER->groupData['non_exclude_fields'], $parameter->table . ':' . $fieldName)) {
             // call diff class only if there is a difference
             if (strcmp($liveRecord[$fieldName], $versionRecord[$fieldName]) !== 0) {
                 // Select the human readable values before diff
                 $liveRecord[$fieldName] = t3lib_BEfunc::getProcessedValue($parameter->table, $fieldName, $liveRecord[$fieldName], 0, 1);
                 $versionRecord[$fieldName] = t3lib_BEfunc::getProcessedValue($parameter->table, $fieldName, $versionRecord[$fieldName], 0, 1);
                 $fieldTitle = $GLOBALS['LANG']->sL(t3lib_BEfunc::getItemLabel($parameter->table, $fieldName));
                 if ($TCA[$parameter->table]['columns'][$fieldName]['config']['type'] == 'group' && $TCA[$parameter->table]['columns'][$fieldName]['config']['internal_type'] == 'file') {
                     $versionThumb = t3lib_BEfunc::thumbCode($versionRecord, $parameter->table, $fieldName, '');
                     $liveThumb = t3lib_BEfunc::thumbCode($liveRecord, $parameter->table, $fieldName, '');
                     $diffReturnArray[] = array('label' => $fieldTitle, 'content' => $versionThumb);
                     $liveReturnArray[] = array('label' => $fieldTitle, 'content' => $liveThumb);
                 } else {
                     $diffReturnArray[] = array('label' => $fieldTitle, 'content' => $t3lib_diff->makeDiffDisplay($liveRecord[$fieldName], $versionRecord[$fieldName]));
                     $liveReturnArray[] = array('label' => $fieldTitle, 'content' => $liveRecord[$fieldName]);
                 }
             }
         }
     }
     $commentsForRecord = $this->getCommentsForRecord($parameter->uid, $parameter->table);
     return array('total' => 1, 'data' => array(array('diff' => $diffReturnArray, 'live_record' => $liveReturnArray, 'path_Live' => $parameter->path_Live, 'label_Stage' => $parameter->label_Stage, 'stage_position' => $stagePosition['position'], 'stage_count' => $stagePosition['count'], 'comments' => $commentsForRecord, 'icon_Live' => $icon_Live, 'icon_Workspace' => $icon_Workspace)));
 }
 /**
  * Rendering preview output of a field value which is not shown as a form field but just outputted.
  *
  * @param	string		The value to output
  * @param	array		Configuration for field.
  * @param	string		Name of field.
  * @return	 string		HTML formatted output
  */
 function previewFieldValue($value, $config, $field = '')
 {
     if ($config['config']['type'] === 'group' && ($config['config']['internal_type'] === 'file' || $config['config']['internal_type'] === 'file_reference')) {
         // Ignore uploadfolder if internal_type is file_reference
         if ($config['config']['internal_type'] === 'file_reference') {
             $config['config']['uploadfolder'] = '';
         }
         $show_thumbs = TRUE;
         $table = 'tt_content';
         // Making the array of file items:
         $itemArray = t3lib_div::trimExplode(',', $value, 1);
         // Showing thumbnails:
         $thumbsnail = '';
         if ($show_thumbs) {
             $imgs = array();
             foreach ($itemArray as $imgRead) {
                 $imgP = explode('|', $imgRead);
                 $imgPath = rawurldecode($imgP[0]);
                 $rowCopy = array();
                 $rowCopy[$field] = $imgPath;
                 // Icon + clickmenu:
                 $absFilePath = t3lib_div::getFileAbsFileName($config['config']['uploadfolder'] ? $config['config']['uploadfolder'] . '/' . $imgPath : $imgPath);
                 $fileInformation = pathinfo($imgPath);
                 $fileIcon = t3lib_iconWorks::getSpriteIconForFile($imgPath, array('title' => htmlspecialchars($fileInformation['basename'] . ($absFilePath && @is_file($absFilePath) ? ' (' . t3lib_div::formatSize(filesize($absFilePath)) . 'bytes)' : ' - FILE NOT FOUND!'))));
                 $imgs[] = '<span class="nobr">' . t3lib_BEfunc::thumbCode($rowCopy, $table, $field, $this->backPath, 'thumbs.php', $config['config']['uploadfolder'], 0, ' align="middle"') . ($absFilePath ? $this->getClickMenu($fileIcon, $absFilePath) : $fileIcon) . $imgPath . '</span>';
             }
             $thumbsnail = implode('<br />', $imgs);
         }
         return $thumbsnail;
     } else {
         return nl2br(htmlspecialchars($value));
     }
 }
 /**
  * Adds content to all data fields in $out array
  *
  * @param	array		Array of fields to display. Each field name has a special feature which is that the field name can be specified as more field names. Eg. "field1,field2;field3". Field 2 and 3 will be shown in the same cell of the table separated by <br /> while field1 will have its own cell.
  * @param	string		Table name
  * @param	array		Record array
  * @param	array		Array to which the data is added
  * @param	[type]		$noEdit: ...
  * @return	array		$out array returned after processing.
  * @see makeOrdinaryList()
  */
 function dataFields($fieldArr, $table, $row, $out = array(), $noEdit = FALSE)
 {
     global $TCA;
     // Check table validity:
     if ($TCA[$table]) {
         t3lib_div::loadTCA($table);
         $thumbsCol = $TCA[$table]['ctrl']['thumbnail'];
         $url = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 'index.php';
         $thumbsize = $this->lTSprop['imageSize'];
         // Traverse fields:
         foreach ($fieldArr as $fieldName) {
             if ($TCA[$table]['columns'][$fieldName]) {
                 // Each field has its own cell (if configured in TCA)
                 if ($fieldName == $thumbsCol) {
                     // If the column is a thumbnail column:
                     if ($this->thumbs) {
                         $val = t3lib_BEfunc::thumbCode($row, $table, $fieldName, $this->backPath, $this->thumbScript, NULL, 0, '', $thumbsize);
                     } else {
                         $val = str_replace(',', ', ', basename($row[$fieldName]));
                     }
                 } else {
                     // ... otherwise just render the output:
                     $val = nl2br(htmlspecialchars(trim(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table, $fieldName, $row[$fieldName], 0, 0, 0, $row['uid']), 250))));
                     if ($this->lTSprop['clickTitleMode'] == 'view') {
                         if ($this->singlePid) {
                             $val = $this->linkSingleView($url, $val, $row['uid']);
                         }
                     } elseif ($this->lTSprop['clickTitleMode'] == 'edit') {
                         if (!$noEdit) {
                             $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
                             $lTitle = ' title="' . $GLOBALS['LANG']->getLL('edit', 1) . '"';
                             $val = '<a href="#" onclick="' . htmlspecialchars(t3lib_BEfunc::editOnClick($params, $this->backPath, $this->returnUrl)) . '"' . $lTitle . '>' . $val . '</a>';
                         }
                     }
                 }
                 $out[$fieldName] = $val;
             } else {
                 // Each field is separated by <br /> and shown in the same cell (If not a TCA field, then explode the field name with ";" and check each value there as a TCA configured field)
                 $theFields = explode(';', $fieldName);
                 // Traverse fields, separated by ";" (displayed in a single cell).
                 foreach ($theFields as $fName2) {
                     if ($TCA[$table]['columns'][$fName2]) {
                         $out[$fieldName] .= '<b>' . $GLOBALS['LANG']->sL($TCA[$table]['columns'][$fName2]['label'], 1) . '</b>' . '&nbsp;&nbsp;' . htmlspecialchars(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getProcessedValue($table, $fName2, $row[$fName2], 0, 0, 0, $row['uid']), 25)) . '<br />';
                     }
                 }
             }
             // If no value, add a nbsp.
             if (!$out[$fieldName]) {
                 $out[$fieldName] = '&nbsp;';
             }
             // Wrap in dimmed-span tags if record is "disabled"
             if ($this->isDisabled($table, $row)) {
                 $out[$fieldName] = $GLOBALS['TBE_TEMPLATE']->dfw($out[$fieldName]);
             }
         }
     }
     return $out;
 }
 /**
  * Returns an HTMLized preview of a certain content element. If you'd like to register a new content type, you can easily use the hook
  * provided at the beginning of the function.
  *
  * @param	array		$row: The row of tt_content containing the content element record.
  * @return	string		HTML preview content
  * @access protected
  * @see		getContentTree(), render_localizationInfoTable()
  */
 function render_previewContent($row)
 {
     global $TYPO3_CONF_VARS, $LANG, $LANGPLUGIN, $TCA;
     $hookObjectsArr = $this->hooks_prepareObjectsArray('renderPreviewContentClass');
     $alreadyRendered = FALSE;
     $output = '';
     // ELIO@GOSIGN 13/08/09: For LFEditor Link
     $langFile = '';
     // Hook: renderPreviewContent_preProcess. Set 'alreadyRendered' to true if you provided a preview content for the current cType !
     reset($hookObjectsArr);
     while (list(, $hookObj) = each($hookObjectsArr)) {
         if (method_exists($hookObj, 'renderPreviewContent_preProcess')) {
             $output .= $hookObj->renderPreviewContent_preProcess($row, 'tt_content', $alreadyRendered, $this);
         }
     }
     if (!$alreadyRendered) {
         // Preview content for non-flexible content elements:
         switch ($row['CType']) {
             case 'table':
                 //	Table
                 $output = '<strong>' . $LANG->getLL($row['CType'] . '.field.text', 1) . '</strong>: <br />' . nl2br($row['bodytext']) . '<br />' . $this->getPiName($LANGPLUGIN->getLL('common_6_title'));
                 break;
             case 'splash':
                 //	Textbox
                 $thumbnail = '<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'image'), 1) . '</strong><br />';
                 $thumbnail .= t3lib_BEfunc::thumbCode($row, 'tt_content', 'image', $this->doc->backPath);
                 $text = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'bodytext'), 1) . '</strong> ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['bodytext'])), 2000)), 'tt_content', $row['uid']);
                 $output = '<table><tr><td valign="top">' . $text . '</td><td valign="top">' . $thumbnail . '</td></tr></table>' . '<br />';
                 break;
             case 'list':
                 //	Insert Plugin
                 switch ($row['list_type']) {
                     case '9':
                         $html = $this->getTTNews($row);
                         break;
                     case 'rwe_feuseradmin_pi1':
                         $html = '<strong>' . $LANG->getLL($row['list_type'] . '.field.hinweis', 1) . '</strong>: <br />' . $LANG->getLL($row['list_type'] . '.field.hinweis.content', 1) . '<br />' . $this->getPiName($LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type'])));
                         break;
                     case 'th_mailformplus_pi1':
                         $html = '<strong>' . $LANG->getLL($row['list_type'] . '.field.hinweis', 1) . '</strong>: <br />' . $LANG->getLL($row['list_type'] . '.field.hinweis.content', 1) . '<br />' . '<br /><br /><strong style="margin:2px;padding:2px;border:1px solid #bfbfbf; background-color:#FFFFFF;">' . $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type'])) . '</strong><br /><br />';
                         // ELIO@GOSIGN 13/08/09 START
                         // LFE-Link: we have to set the langfile like this for this plugin
                         $typoscript = $this->loadTS($row['pid']);
                         $langFile = $typoscript->setup['plugin.']['tx_thmailformplus_pi1.']['langFile'];
                         // ELIO@GOSIGN 13/08/09 END
                         break;
                 }
                 if ($html) {
                     $output = $this->link_edit($html, 'tt_content', $row['uid']) . '<br />';
                 } else {
                     $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'list_type')) . '</strong> ' . htmlspecialchars($LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type']))) . ' &ndash; ' . htmlspecialchars($extraInfo ? $extraInfo : $row['list_type']), 'tt_content', $row['uid']) . '<br />';
                 }
                 break;
             case 'div':
                 //	Divider
             //	Divider
             case 'templavoila_pi1':
                 //	Flexible Content Element: Rendered directly in getContentTree*()
                 switch ($row['tx_templavoila_to']) {
                     default:
                         // Render the Rest Flexform Elements
                         $html = $this->renderFlex($row);
                         break;
                 }
                 $output = $html;
                 break;
             default:
                 // Render the Rest CType Elements
                 $output = $this->renderPi($row);
         }
     }
     // ELIO@GOSIGN 13/08/09 START
     // Add LFEditor link
     if ($row['CType'] == 'list' && !empty($row['list_type'])) {
         //  if this is a plugin
         $output .= $this->addLFEditLink($row['list_type'], $langFile);
     } elseif ($row['CType'] != 'list') {
         // if this is a normal CType
         $output .= $this->addLFEditLink($row['CType'], $langFile);
     }
     // ELIO@GOSIGN 13/08/09 END
     return $output;
 }
예제 #12
0
 /**
  * Returns an HTMLized preview of a certain content element. If you'd like to register a new content type, you can easily use the hook
  * provided at the beginning of the function.
  *
  * @param	array		$row: The row of tt_content containing the content element record.
  * @return	string		HTML preview content
  * @access protected
  * @see		getContentTree(), render_localizationInfoTable()
  */
 function render_previewContent($row)
 {
     global $TYPO3_CONF_VARS, $LANG;
     $hookObjectsArr = $this->hooks_prepareObjectsArray('renderPreviewContentClass');
     $alreadyRendered = FALSE;
     $output = '';
     // Hook: renderPreviewContent_preProcess. Set 'alreadyRendered' to true if you provided a preview content for the current cType !
     reset($hookObjectsArr);
     while (list(, $hookObj) = each($hookObjectsArr)) {
         if (method_exists($hookObj, 'renderPreviewContent_preProcess')) {
             $output .= $hookObj->renderPreviewContent_preProcess($row, 'tt_content', $alreadyRendered, $this);
         }
     }
     if (!$alreadyRendered) {
         // Preview content for non-flexible content elements:
         switch ($row['CType']) {
             case 'text':
                 //	Text
             //	Text
             case 'table':
                 //	Table
             //	Table
             case 'mailform':
                 //	Form
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'bodytext'), 1) . '</strong> ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['bodytext'])), 2000)), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'image':
                 //	Image
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'image'), 1) . '</strong><br /> ', 'tt_content', $row['uid']) . t3lib_BEfunc::thumbCode($row, 'tt_content', 'image', $this->doc->backPath) . '<br />';
                 break;
             case 'textpic':
                 //	Text w/image
             //	Text w/image
             case 'splash':
                 //	Textbox
                 $thumbnail = '<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'image'), 1) . '</strong><br />';
                 $thumbnail .= t3lib_BEfunc::thumbCode($row, 'tt_content', 'image', $this->doc->backPath);
                 $text = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'bodytext'), 1) . '</strong> ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['bodytext'])), 2000)), 'tt_content', $row['uid']);
                 $output = '<table><tr><td valign="top">' . $text . '</td><td valign="top">' . $thumbnail . '</td></tr></table>' . '<br />';
                 break;
             case 'bullets':
                 //	Bullets
                 $htmlBullets = '';
                 $bulletsArr = explode("\n", t3lib_div::fixed_lgd_cs($row['bodytext'], 2000));
                 if (is_array($bulletsArr)) {
                     foreach ($bulletsArr as $listItem) {
                         $htmlBullets .= htmlspecialchars(trim(strip_tags($listItem))) . '<br />';
                     }
                 }
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'bodytext'), 1) . '</strong><br />' . $htmlBullets, 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'uploads':
                 //	Filelinks
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'media'), 1) . '</strong><br />' . str_replace(',', '<br />', htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['media'])), 2000))), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'multimedia':
                 //	Multimedia
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'multimedia'), 1) . '</strong><br />' . str_replace(',', '<br />', htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['multimedia'])), 2000))), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'menu':
                 //	Menu / Sitemap
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'menu_type')) . '</strong> ' . $LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'menu_type', $row['menu_type'])) . '<br />' . '<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'pages')) . '</strong> ' . $row['pages'], 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'list':
                 //	Insert Plugin
                 $extraInfo = $this->render_previewContent_extraPluginInfo($row);
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'list_type')) . '</strong> ' . htmlspecialchars($LANG->sL(t3lib_BEfunc::getLabelFromItemlist('tt_content', 'list_type', $row['list_type']))) . ' &ndash; ' . htmlspecialchars($extraInfo ? $extraInfo : $row['list_type']), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'html':
                 //	HTML
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'bodytext'), 1) . '</strong> ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(trim($row['bodytext']), 2000)), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'header':
                 // Header
                 $output = $this->link_edit('<strong>' . $LANG->sL(t3lib_BEfunc::getItemLabel('tt_content', 'header'), 1) . '</strong> ' . htmlspecialchars(t3lib_div::fixed_lgd_cs(trim(strip_tags($row['header'])), 2000)), 'tt_content', $row['uid']) . '<br />';
                 break;
             case 'search':
                 //	Search Box
             //	Search Box
             case 'login':
                 //	Login Box
             //	Login Box
             case 'shortcut':
                 //	Insert records
             //	Insert records
             case 'div':
                 //	Divider
             //	Divider
             case 'templavoila_pi1':
                 //	Flexible Content Element: Rendered directly in getContentTree*()
                 break;
             default:
                 // return CType name for unhandled CType
                 $output = '<strong>' . htmlspecialchars($row['CType']) . '</strong><br />';
         }
     }
     return $output;
 }
예제 #13
0
 /**
  * Render different label for media elements
  *
  * @param array $params configuration
  * @return void
  */
 public function getUserLabelMedia(array &$params)
 {
     $ll = 'LLL:EXT:news/Resources/Private/Language/locallang_db.xml:';
     $title = $typeInfo = $additionalHtmlContent = '';
     $type = $GLOBALS['LANG']->sL($ll . 'tx_news_domain_model_media.type.I.' . $params['row']['type']);
     // Add additional info based on type
     switch ((int) $params['row']['type']) {
         // Image
         case Tx_News_Domain_Model_Media::MEDIA_TYPE_IMAGE:
             $typeInfo .= $this->getTitleFromFields('title,alt,caption,image', $params['row']);
             if (!empty($params['row']['image'])) {
                 $params['row']['image'] = $this->splitFileName($params['row']['image']);
                 $additionalHtmlContent = '<br />' . t3lib_BEfunc::thumbCode($params['row'], 'tx_news_domain_model_media', 'image', $GLOBALS['BACK_PATH'], '', NULL, 0, '', '', FALSE);
             }
             break;
             // Audio & Video
         // Audio & Video
         case Tx_News_Domain_Model_Media::MEDIA_TYPE_MULTIMEDIA:
             $typeInfo .= $this->getTitleFromFields('caption,multimedia', $params['row']);
             break;
             // HTML
         // HTML
         case Tx_News_Domain_Model_Media::MEDIA_TYPE_HTML:
             // Don't show html value as this could get a XSS
             $typeInfo .= $params['row']['caption'];
             break;
             // DAM
         // DAM
         case Tx_News_Domain_Model_Media::MEDIA_TYPE_DAM:
             if (intval($params['row']['uid']) > 0) {
                 $config = $GLOBALS['TCA'][$params['table']]['columns']['dam']['config'];
                 $damItems = tx_dam_db::getReferencedFiles($params['table'], $params['row']['uid'], $config['MM_match_fields'], $config['MM'], 'tx_dam.*');
                 if (is_array($damItems['rows'])) {
                     $item = array_shift($damItems['rows']);
                     $typeInfo = $this->getTitleFromFields('title,file_name', $item);
                 }
             }
             break;
         default:
             $typeInfo .= $params['row']['caption'];
     }
     $title = !empty($typeInfo) ? $type . ': ' . $typeInfo : $type;
     $title = htmlspecialchars($title) . $additionalHtmlContent;
     // Hook to modify the label, especially useful when using custom media relations
     if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['mediaLabel'])) {
         $params = array('params' => $params, 'title' => $title);
         foreach ($GLOBALS['TYPO3_CONF_VARS']['EXT']['news']['mediaLabel'] as $reference) {
             $title = t3lib_div::callUserFunction($reference, $params, $this);
         }
     }
     // Preview
     if ($params['row']['showinpreview']) {
         $label = htmlspecialchars($GLOBALS['LANG']->sL($ll . 'tx_news_domain_model_media.show'));
         $icon = '../' . t3lib_extMgm::siteRelPath('news') . 'Resources/Public/Icons/preview.gif';
         $title .= ' <img title="' . $label . '" src="' . $icon . '" />';
     }
     // Show the [No title] if empty
     if (empty($title)) {
         $title = t3lib_befunc::getNoRecordTitle(TRUE);
     }
     $params['title'] = $title;
 }