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