[FEATURE] Make use of .t3-table in EXT: tstemplate
[Packages/TYPO3.CMS.git] / typo3 / sysext / tstemplate / Classes / Controller / TypoScriptTemplateInformationModuleFunctionController.php
1 <?php
2 namespace TYPO3\CMS\Tstemplate\Controller;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2013 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29
30 use TYPO3\CMS\Core\Utility\GeneralUtility;
31 use TYPO3\CMS\Backend\Utility\BackendUtility;
32
33 /**
34 * This class displays the Info/Modify screen of the Web > Template module
35 *
36 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
37 */
38 class TypoScriptTemplateInformationModuleFunctionController extends \TYPO3\CMS\Backend\Module\AbstractFunctionModule {
39
40 /**
41 * Indicator for t3editor, whether data is stored
42 *
43 * @var boolean
44 */
45 public $tce_processed = FALSE;
46
47 /**
48 * Creates a row for a HTML table
49 *
50 * @param string $label The label to be shown (e.g. 'Title:', 'Sitetitle:')
51 * @param string $data The data/information to be shown (e.g. 'Template for my site')
52 * @param string $field The field/variable to be sent on clicking the edit icon (e.g. 'title', 'sitetitle')
53 * @return string A row for a HTML table
54 * @todo Define visibility
55 */
56 public function tableRow($label, $data, $field) {
57 $ret = '<tr><td>';
58 $urlParameters = array(
59 'id' => $this->pObj->id
60 );
61 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
62 $ret .= '<a href="' . htmlspecialchars(($aHref . '&e[' . $field . ']=1')) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:editField', TRUE))) . '<strong>' . $label . '</strong></a>';
63 $ret .= '</td><td width="80%" class="bgColor4">' . $data . '&nbsp;</td></tr>';
64 return $ret;
65 }
66
67 /**
68 * Renders HTML table with available template resources/files
69 *
70 * @param string $resources List of resources/files to be shown (e.g. 'file_01.txt,file.txt')
71 * @param boolean $func Whether to render functions like 'to top' or 'delete' for each resource (default: FALSE)
72 * @return string HTML table with available template resources/files
73 * @todo Define visibility
74 */
75 public function procesResources($resources, $func = FALSE) {
76 $arr = GeneralUtility::trimExplode(',', $resources . ',,', TRUE);
77 $out = '';
78 $bgcol = $func ? ' class="bgColor4"' : '';
79 foreach ($arr as $k => $v) {
80 $path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $v;
81 $functions = '';
82 if ($func) {
83 $functions = '<td bgcolor="red" nowrap="nowrap">' . $GLOBALS['LANG']->getLL('delete') . ' <input type="checkbox" name="data[remove_resource][' . $k . ']" value="' . htmlspecialchars($v) . '" /></td>';
84 $functions .= '<td' . $bgcol . ' nowrap="nowrap">' . $GLOBALS['LANG']->getLL('toTop') . ' <input type="checkbox" name="data[totop_resource][' . $k . ']" value="' . htmlspecialchars($v) . '" /></td>';
85 $functions .= '<td' . $bgcol . ' nowrap="nowrap">';
86 $fI = GeneralUtility::split_fileref($v);
87 if (GeneralUtility::inList($this->pObj->textExtensions, $fI['fileext'])) {
88 $urlParameters = array(
89 'id' => $this->pObj->id
90 );
91 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
92 $functions .= '<a href="' . htmlspecialchars(($aHref . '&e[file]=' . rawurlencode($v))) . '">' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xlf:editFile', TRUE))) . '</a>';
93 }
94 $functions .= '</td>';
95 }
96 $thumb = BackendUtility::thumbCode(array('resources' => $v), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
97 $out .= '<tr><td' . $bgcol . ' nowrap="nowrap">' . $v . '&nbsp;&nbsp;</td><td' . $bgcol . ' nowrap="nowrap">&nbsp;' . GeneralUtility::formatSize(@filesize($path)) . '&nbsp;</td>' . $functions . '<td' . $bgcol . '>' . trim($thumb) . '</td></tr>';
98 }
99 if ($out) {
100 if ($func) {
101 $out = '<table border="0" cellpadding="1" cellspacing="1" width="100%">' . $out . '</table>';
102 $out = '<table border="0" cellpadding="0" cellspacing="0">
103 <tr><td class="bgColor2">' . $out . '<img src="clear.gif" width="465px" height="1px"></td></tr>
104 </table>';
105 } else {
106 $out = '<table border="0" cellpadding="0" cellspacing="0">' . $out . '</table>';
107 }
108 }
109 return $out;
110 }
111
112 /**
113 * Renders HTML table with all available template resources/files in the current rootline that could be copied
114 *
115 * @param integer $id The uid of the current page
116 * @param integer $template_uid The uid of the template record to be rendered (only if more than one template on the current page)
117 * @return string HTML table with all available template resources/files in the current rootline that could be copied
118 * @todo Define visibility
119 */
120 public function resourceListForCopy($id, $template_uid) {
121 global $tmpl;
122 $sys_page = GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Page\\PageRepository');
123 $rootLine = $sys_page->getRootLine($id);
124 // This generates the constants/config + hierarchy info for the template.
125 $tmpl->runThroughTemplates($rootLine, $template_uid);
126 $theResources = GeneralUtility::trimExplode(',', $tmpl->resources, TRUE);
127 foreach ($theResources as $k => $v) {
128 $fI = pathinfo($v);
129 if (GeneralUtility::inList($this->pObj->textExtensions, strtolower($fI['extension']))) {
130 $path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $v;
131 $thumb = BackendUtility::thumbCode(array('resources' => $v), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
132 $out .= '<tr><td' . $bgcol . ' nowrap="nowrap">' . $v . '&nbsp;&nbsp;</td><td' . $bgcol . ' nowrap="nowrap">&nbsp;' . GeneralUtility::formatSize(@filesize($path)) . '&nbsp;</td><td' . $bgcol . '>' . trim($thumb) . '</td><td><input type="Checkbox" name="data[makecopy_resource][' . $k . ']" value="' . htmlspecialchars($v) . '"></td></tr>';
133 }
134 }
135 $out = $out ? '<table border="0" cellpadding="0" cellspacing="0">' . $out . '</table>' : '';
136 return $out;
137 }
138
139 /**
140 * Create an instance of \TYPO3\CMS\Core\TypoScript\ExtendedTemplateService in
141 * $GLOBALS['tmpl'] and looks for the first (visible) template
142 * record. If $template_uid was given and greater than zero, this record will be checked.
143 *
144 * @param integer $pageId The uid of the current page
145 * @param integer $template_uid: The uid of the template record to be rendered (only if more than one template on the current page)
146 * @return boolean Returns TRUE if a template record was found, otherwise FALSE
147 * @todo Define visibility
148 */
149 public function initialize_editor($pageId, $template_uid = 0) {
150 // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
151 global $tmpl, $tplRow, $theConstants;
152 // Defined global here!
153 $tmpl = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService');
154 // Do not log time-performance information
155 $tmpl->tt_track = 0;
156 $tmpl->init();
157 // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
158 $tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid);
159 if (is_array($tplRow)) {
160 $tplRow = $this->processTemplateRowAfterLoading($tplRow);
161 return TRUE;
162 }
163 return FALSE;
164 }
165
166 /**
167 * Process template row after loading
168 *
169 * @param array $tplRow Template row
170 * @return array Preprocessed template row
171 * @author Fabrizio Branca <typo3@fabrizio-branca.de>
172 * @todo Define visibility
173 */
174 public function processTemplateRowAfterLoading(array $tplRow) {
175 if ($this->pObj->MOD_SETTINGS['includeTypoScriptFileContent']) {
176 // Let the recursion detection counter start at 91, so that only 10 recursive calls will be resolved
177 // Otherwise the editor will be bloated with way to many lines making it hard the break the cyclic recursion.
178 $tplRow['config'] = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines($tplRow['config'], 91);
179 $tplRow['constants'] = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::checkIncludeLines($tplRow['constants'], 91);
180 }
181 return $tplRow;
182 }
183
184 /**
185 * Process template row before saving
186 *
187 * @param array $tplRow Template row
188 * @return array Preprocessed template row
189 * @author Fabrizio Branca <typo3@fabrizio-branca.de>
190 * @todo Define visibility
191 */
192 public function processTemplateRowBeforeSaving(array $tplRow) {
193 if ($this->pObj->MOD_SETTINGS['includeTypoScriptFileContent']) {
194 $tplRow = \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::extractIncludes_array($tplRow);
195 }
196 return $tplRow;
197 }
198
199 /**
200 * The main processing method if this class
201 *
202 * @return string Information of the template status or the taken actions as HTML string
203 * @todo Define visibility
204 */
205 public function main() {
206 global $BACK_PATH;
207 global $tmpl, $tplRow, $theConstants;
208 $GLOBALS['LANG']->includeLLFile('EXT:tstemplate/Resources/Private/Language/locallang_info.xlf');
209 $this->pObj->MOD_MENU['includeTypoScriptFileContent'] = TRUE;
210 $edit = $this->pObj->edit;
211 $e = $this->pObj->e;
212 // Checking for more than one template an if, set a menu...
213 $manyTemplatesMenu = $this->pObj->templateMenu();
214 $template_uid = 0;
215 if ($manyTemplatesMenu) {
216 $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
217 }
218 // Initialize
219 $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);
220 if ($existTemplate) {
221 $saveId = $tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid'];
222 }
223 // Create extension template
224 $newId = $this->pObj->createTemplate($this->pObj->id, $saveId);
225 if ($newId) {
226 // Switch to new template
227 $urlParameters = array(
228 'id' => $this->pObj->id,
229 'SET[templatesOnPage]' => $newId
230 );
231 $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
232 \TYPO3\CMS\Core\Utility\HttpUtility::redirect($aHref);
233 }
234 if ($existTemplate) {
235 // Update template ?
236 $POST = GeneralUtility::_POST();
237 if ($POST['submit'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['submit_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['submit_y']) || $POST['saveclose'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_y'])) {
238 // Set the data to be saved
239 $recData = array();
240 $alternativeFileName = array();
241 $tmp_upload_name = '';
242 // Set this to blank
243 $tmp_newresource_name = '';
244 if (is_array($POST['data'])) {
245 foreach ($POST['data'] as $field => $val) {
246 switch ($field) {
247 case 'constants':
248
249 case 'config':
250
251 case 'title':
252
253 case 'sitetitle':
254
255 case 'description':
256 $recData['sys_template'][$saveId][$field] = $val;
257 break;
258 }
259 }
260 }
261 if (count($recData)) {
262 $recData['sys_template'][$saveId] = $this->processTemplateRowBeforeSaving($recData['sys_template'][$saveId]);
263 // Create new tce-object
264 $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
265 $tce->stripslashes_values = 0;
266 $tce->alternativeFileName = $alternativeFileName;
267 // Initialize
268 $tce->start($recData, array());
269 // Saved the stuff
270 $tce->process_datamap();
271 // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
272 $tce->clear_cacheCmd('all');
273 // tce were processed successfully
274 $this->tce_processed = TRUE;
275 // re-read the template ...
276 $this->initialize_editor($this->pObj->id, $template_uid);
277 }
278 // If files has been edited:
279 if (is_array($edit)) {
280 if ($edit['filename'] && $tplRow['resources'] && GeneralUtility::inList($tplRow['resources'], $edit['filename'])) {
281 // Check if there are resources, and that the file is in the resourcelist.
282 $path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $edit['filename'];
283 $fI = GeneralUtility::split_fileref($edit['filename']);
284 if (@is_file($path) && GeneralUtility::getFileAbsFileName($path) && GeneralUtility::inList($this->pObj->textExtensions, $fI['fileext'])) {
285 // checks that have already been done.. Just to make sure
286 // @TODO: Check if the hardcorded value already has a config member, otherwise create one
287 // Checks that have already been done.. Just to make sure
288 if (filesize($path) < 30720) {
289 GeneralUtility::writeFile($path, $edit['file']);
290 $theOutput .= $this->pObj->doc->spacer(10);
291 $theOutput .= $this->pObj->doc->section('<font color=red>' . $GLOBALS['LANG']->getLL('fileChanged') . '</font>', sprintf($GLOBALS['LANG']->getLL('resourceUpdated'), $edit['filename']), 0, 0, 0, 1);
292 // Clear cache - the file has probably affected the template setup
293 // @TODO: Check if the edited file really had something to do with cached data and prevent this clearing if possible!
294 /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */
295 $tce = GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\DataHandling\\DataHandler');
296 $tce->stripslashes_values = 0;
297 $tce->start(array(), array());
298 $tce->clear_cacheCmd('all');
299 }
300 }
301 }
302 }
303 }
304 // Hook post updating template/TCE processing
305 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'])) {
306 $postTCEProcessingHook = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'];
307 if (is_array($postTCEProcessingHook)) {
308 $hookParameters = array(
309 'POST' => $POST,
310 'tce' => $tce
311 );
312 foreach ($postTCEProcessingHook as $hookFunction) {
313 GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
314 }
315 }
316 }
317 $content = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIconForRecord('sys_template', $tplRow, array('oncontextmenu' => "Clickmenu.show(
318 'sys_template', '" . $tplRow['uid'] . "', '1', '', '', ''); return false;", 'onclick' => "Clickmenu.show('sys_template', '" . $tplRow['uid'] . "', '1', '','', ''); return false;")) . '<strong>' . htmlspecialchars($tplRow['title']) . '</strong>' . htmlspecialchars((trim($tplRow['sitetitle']) ? ' (' . $tplRow['sitetitle'] . ')' : ''));
319 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('templateInformation'), $content, 0, 1);
320 if ($manyTemplatesMenu) {
321 $theOutput .= $this->pObj->doc->section('', $manyTemplatesMenu);
322 }
323 $theOutput .= $this->pObj->doc->spacer(10);
324 $numberOfRows = 35;
325 // If abort pressed, nothing should be edited:
326 if ($POST['abort'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['abort_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['abort_y']) || $POST['saveclose'] || \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_x']) && \TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($POST['saveclose_y'])) {
327 unset($e);
328 }
329 if ($e['title']) {
330 $outCode = '<input type="Text" name="data[title]" value="' . htmlspecialchars($tplRow['title']) . '"' . $this->pObj->doc->formWidth() . '>';
331 $outCode .= '<input type="Hidden" name="e[title]" value="1">';
332 $theOutput .= $this->pObj->doc->spacer(15);
333 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('title'), $outCode, TRUE);
334 }
335 if ($e['sitetitle']) {
336 $outCode = '<input type="Text" name="data[sitetitle]" value="' . htmlspecialchars($tplRow['sitetitle']) . '"' . $this->pObj->doc->formWidth() . '>';
337 $outCode .= '<input type="Hidden" name="e[sitetitle]" value="1">';
338 $theOutput .= $this->pObj->doc->spacer(15);
339 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('sitetitle'), $outCode, TRUE);
340 }
341 if ($e['description']) {
342 $outCode = '<textarea name="data[description]" rows="5" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, '', '') . '>' . GeneralUtility::formatForTextarea($tplRow['description']) . '</textarea>';
343 $outCode .= '<input type="Hidden" name="e[description]" value="1">';
344 $theOutput .= $this->pObj->doc->spacer(15);
345 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('description'), $outCode, TRUE);
346 }
347 if ($e['constants']) {
348 $outCode = '<textarea name="data[constants]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . GeneralUtility::formatForTextarea($tplRow['constants']) . '</textarea>';
349 $outCode .= '<input type="Hidden" name="e[constants]" value="1">';
350 // Display "Include TypoScript file content?" checkbox
351 $outCode .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[constants]=1', 'id="checkIncludeTypoScriptFileContent"');
352 $outCode .= '<label for="checkIncludeTypoScriptFileContent">' . $GLOBALS['LANG']->getLL('includeTypoScriptFileContent') . '</label><br />';
353 $theOutput .= $this->pObj->doc->spacer(15);
354 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants'), '', TRUE);
355 $theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
356 }
357 if ($e['file']) {
358 $path = PATH_site . $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'] . '/' . $e[file];
359 $fI = GeneralUtility::split_fileref($e[file]);
360 if (@is_file($path) && GeneralUtility::inList($this->pObj->textExtensions, $fI['fileext'])) {
361 if (filesize($path) < $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size'] * 1024) {
362 $fileContent = GeneralUtility::getUrl($path);
363 $outCode = $GLOBALS['LANG']->getLL('file') . ' <strong>' . $e[file] . '</strong><BR>';
364 $outCode .= '<textarea name="edit[file]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . GeneralUtility::formatForTextarea($fileContent) . '</textarea>';
365 $outCode .= '<input type="Hidden" name="edit[filename]" value="' . $e[file] . '">';
366 $outCode .= '<input type="Hidden" name="e[file]" value="' . htmlspecialchars($e[file]) . '">';
367 $theOutput .= $this->pObj->doc->spacer(15);
368 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editResource'), '');
369 $theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
370 } else {
371 $theOutput .= $this->pObj->doc->spacer(15);
372 $fileToBig = sprintf($GLOBALS['LANG']->getLL('filesizeExceeded'), $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size']);
373 $filesizeNotAllowed = sprintf($GLOBALS['LANG']->getLL('notAllowed'), $GLOBALS['TCA']['sys_template']['columns']['resources']['config']['max_size']);
374 $theOutput .= $this->pObj->doc->section('<font color=red>' . $fileToBig . '</font>', $filesizeNotAllowed, 0, 0, 0, 1);
375 }
376 }
377 }
378 if ($e['config']) {
379 $outCode = '<textarea name="data[config]" rows="' . $numberOfRows . '" wrap="off" class="fixed-font enable-tab"' . $this->pObj->doc->formWidthText(48, 'width:98%;height:70%', 'off') . ' class="fixed-font">' . GeneralUtility::formatForTextarea($tplRow['config']) . '</textarea>';
380 $outCode .= '<input type="Hidden" name="e[config]" value="1">';
381 // Display "Include TypoScript file content?" checkbox
382 $outCode .= BackendUtility::getFuncCheck($this->pObj->id, 'SET[includeTypoScriptFileContent]', $this->pObj->MOD_SETTINGS['includeTypoScriptFileContent'], '', '&e[config]=1', 'id="checkIncludeTypoScriptFileContent"');
383 $outCode .= '<label for="checkIncludeTypoScriptFileContent">' . $GLOBALS['LANG']->getLL('includeTypoScriptFileContent') . '</label><br />';
384 $theOutput .= $this->pObj->doc->spacer(15);
385 $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup'), '', TRUE);
386 $theOutput .= $this->pObj->doc->sectionEnd() . $outCode;
387 }
388 // Processing:
389 $outCode = '';
390 $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('title'), htmlspecialchars($tplRow['title']), 'title');
391 $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('sitetitle'), htmlspecialchars($tplRow['sitetitle']), 'sitetitle');
392 $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('description'), nl2br(htmlspecialchars($tplRow['description'])), 'description');
393 $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('constants'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[constants]) ? count(explode(LF, $tplRow[constants])) : 0), 'constants');
394 $outCode .= $this->tableRow($GLOBALS['LANG']->getLL('setup'), sprintf($GLOBALS['LANG']->getLL('editToView'), trim($tplRow[config]) ? count(explode(LF, $tplRow[config])) : 0), 'config');
395 $outCode = '<table class="t3-table">' . $outCode . '</table>';
396 // Edit all icon:
397 $outCode .= '<br /><a href="#" onClick="' . BackendUtility::editOnClick((rawurlencode('&createExtension=0') . '&amp;edit[sys_template][' . $tplRow['uid'] . ']=edit'), $BACK_PATH, '') . '"><strong>' . \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-open', array('title' => $GLOBALS['LANG']->getLL('editTemplateRecord'))) . $GLOBALS['LANG']->getLL('editTemplateRecord') . '</strong></a>';
398 $theOutput .= $this->pObj->doc->section('', $outCode);
399 // hook after compiling the output
400 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'])) {
401 $postOutputProcessingHook = &$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'];
402 if (is_array($postOutputProcessingHook)) {
403 $hookParameters = array(
404 'theOutput' => &$theOutput,
405 'POST' => $POST,
406 'e' => $e,
407 'tplRow' => $tplRow,
408 'numberOfRows' => $numberOfRows
409 );
410 foreach ($postOutputProcessingHook as $hookFunction) {
411 GeneralUtility::callUserFunction($hookFunction, $hookParameters, $this);
412 }
413 }
414 }
415 } else {
416 $theOutput .= $this->pObj->noTemplate(1);
417 }
418 return $theOutput;
419 }
420
421 }