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