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