Fixed bug #12872: Use "strong" instead of "b": typo3/sysext/
[Packages/TYPO3.CMS.git] / typo3 / sysext / tstemplate_info / class.tx_tstemplateinfo.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2009 Kasper Skaarhoj (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 * [CLASS/FUNCTION INDEX of SCRIPT]
29 *
30 *
31 *
32 * 49: class tx_tstemplateinfo extends t3lib_extobjbase
33 * 63: function tableRow($label, $data, $field)
34 * 77: function procesResources($resources, $func=false)
35 * 117: function resourceListForCopy($id, $template_uid)
36 * 143: function initialize_editor($pageId, $template_uid=0)
37 * 160: function main()
38 *
39 * TOTAL FUNCTIONS: 5
40 * (This index is automatically created/updated by the extension "extdeveval")
41 *
42 */
43
44 $GLOBALS['LANG']->includeLLFile('EXT:tstemplate_info/locallang.xml');
45
46 /**
47 * This class displays the Info/Modify screen of the Web > Template module
48 *
49 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
50 *
51 * $Id$
52 */
53 class tx_tstemplateinfo extends t3lib_extobjbase {
54
55 public $tce_processed = false; // indicator for t3editor, whether data is stored
56
57 /**
58 * Creates a row for a HTML table
59 *
60 * @param string $label: The label to be shown (e.g. 'Title:', 'Sitetitle:')
61 * @param string $data: The data/information to be shown (e.g. 'Template for my site')
62 * @param string $field: The field/variable to be sent on clicking the edit icon (e.g. 'title', 'sitetitle')
63 * @return string A row for a HTML table
64 */
65 function tableRow($label, $data, $field) {
66 $ret = '<tr><td class="bgColor4" width="1%">';
67 $ret.= '<a href="index.php?id='.$this->pObj->id.'&e['.$field.']=1">'.t3lib_iconWorks::getSpriteIcon('actions-document-open',array("title"=> $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:editField', true))) . '</a>';
68 $ret.= '</td><td class="bgColor4" width="1%"><strong>'.$label.'&nbsp;&nbsp;</strong></td><td class="bgColor4" width="99%">'.$data.'&nbsp;</td></tr>';
69 return $ret;
70 }
71
72 /**
73 * Renders HTML table with available template resources/files
74 *
75 * @param string $resources: List of resources/files to be shown (e.g. 'file_01.txt,file.txt')
76 * @param boolean $func: Whether to render functions like 'to top' or 'delete' for each resource (default: false)
77 * @return string HTML table with available template resources/files
78 */
79 function procesResources($resources, $func=false) {
80 $arr = t3lib_div::trimExplode(',', $resources.',,', 1);
81 $out = '';
82 $bgcol = ($func ? ' class="bgColor4"' : '');
83 foreach ($arr as $k => $v) {
84 $path = PATH_site.$GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$v;
85 $functions = '';
86 if ($func) {
87 $functions = '<td bgcolor=red nowrap>' . $GLOBALS['LANG']->getLL('delete') . ' <input type="Checkbox" name="data[remove_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td>';
88 $functions.= '<td'.$bgcol.' nowrap>' . $GLOBALS['LANG']->getLL('toTop') . ' <input type="Checkbox" name="data[totop_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td>';
89 $functions.= '<td'.$bgcol.' nowrap>';
90 $fI = t3lib_div::split_fileref($v);
91 if (t3lib_div::inList($this->pObj->textExtensions,$fI['fileext'])) {
92 $functions.= '<a href="index.php?id='.$this->pObj->id.'&e[file]='.rawurlencode($v).'">'.t3lib_iconWorks::getSpriteIcon('actions-document-open',array('title'=> $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:editFile', true))) . '</a>';
93 }
94 $functions.= '</td>';
95 }
96 $thumb = t3lib_BEfunc::thumbCode(array('resources' => $v), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
97 $out.= '<tr><td'.$bgcol.' nowrap>'.$v.'&nbsp;&nbsp;</td><td'.$bgcol.' nowrap>&nbsp;'.t3lib_div::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=465 height=1></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 */
119 function resourceListForCopy($id, $template_uid) {
120 global $tmpl;
121 $sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
122 $rootLine = $sys_page->getRootLine($id);
123 $tmpl->runThroughTemplates($rootLine, $template_uid); // This generates the constants/config + hierarchy info for the template.
124 $theResources = t3lib_div::trimExplode(',', $tmpl->resources, 1);
125 foreach ($theResources as $k => $v) {
126 $fI = pathinfo($v);
127 if (t3lib_div::inList($this->pObj->textExtensions,strtolower($fI['extension']))) {
128 $path = PATH_site.$GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$v;
129 $thumb = t3lib_BEfunc::thumbCode(array('resources' => $v), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
130 $out.= '<tr><td'.$bgcol.' nowrap>'.$v.'&nbsp;&nbsp;</td><td'.$bgcol.' nowrap>&nbsp;'.t3lib_div::formatSize(@filesize($path)).'&nbsp;</td><td'.$bgcol.'>'.trim($thumb).'</td><td><input type="Checkbox" name="data[makecopy_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td></tr>';
131 }
132 }
133 $out = ($out ? '<table border=0 cellpadding=0 cellspacing=0>'.$out.'</table>' : '');
134 return $out;
135 }
136
137 /**
138 * Create an instance of t3lib_tsparser_ext in $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 $id: 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 */
145 function initialize_editor($pageId, $template_uid=0) {
146 // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
147 global $tmpl,$tplRow,$theConstants;
148
149 $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext'); // Defined global here!
150 $tmpl->tt_track = 0; // Do not log time-performance information
151 $tmpl->init();
152
153 $tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid); // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
154 return (is_array($tplRow) ? true : false);
155 }
156
157 /**
158 * The main processing method if this class
159 *
160 * @return string Information of the template status or the taken actions as HTML string
161 */
162 function main() {
163 global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
164 global $tmpl,$tplRow,$theConstants;
165
166 $edit = $this->pObj->edit;
167 $e = $this->pObj->e;
168
169 t3lib_div::loadTCA('sys_template');
170
171
172
173
174 // **************************
175 // Checking for more than one template an if, set a menu...
176 // **************************
177 $manyTemplatesMenu = $this->pObj->templateMenu();
178 $template_uid = 0;
179 if ($manyTemplatesMenu) {
180 $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
181 }
182
183
184 // **************************
185 // Initialize
186 // **************************
187 $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); // initialize
188
189 if ($existTemplate) {
190 $saveId = ($tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']);
191 }
192 // **************************
193 // Create extension template
194 // **************************
195 $newId = $this->pObj->createTemplate($this->pObj->id, $saveId);
196 if($newId) {
197 // switch to new template
198 t3lib_utility_Http::redirect('index.php?id=' . $this->pObj->id. '&SET[templatesOnPage]=' . $newId);
199 }
200
201 if ($existTemplate) {
202 // Update template ?
203 $POST = t3lib_div::_POST();
204 if ($POST['submit'] || (t3lib_div::testInt($POST['submit_x']) && t3lib_div::testInt($POST['submit_y']))
205 || $POST['saveclose'] || (t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y']))) {
206 // Set the data to be saved
207 $recData = array();
208 $alternativeFileName = array();
209 $resList = $tplRow['resources'];
210
211 $tmp_upload_name = '';
212 $tmp_newresource_name = ''; // Set this to blank
213
214 if (is_array($POST['data'])) {
215 foreach ($POST['data'] as $field => $val) {
216 switch ($field) {
217 case 'constants':
218 case 'config':
219 case 'title':
220 case 'sitetitle':
221 case 'description':
222 $recData['sys_template'][$saveId][$field] = $val;
223 break;
224 case 'resources':
225 $tmp_upload_name = t3lib_div::upload_to_tempfile($_FILES['resources']['tmp_name']); // If there is an uploaded file, move it for the sake of safe_mode.
226 if ($tmp_upload_name) {
227 if ($tmp_upload_name!='none' && $_FILES['resources']['name']) {
228 $alternativeFileName[$tmp_upload_name] = trim($_FILES['resources']['name']);
229 $resList = $tmp_upload_name.','.$resList;
230 }
231 }
232 break;
233 case 'new_resource':
234 $newName = trim(t3lib_div::_GP('new_resource'));
235 if ($newName) {
236 $newName.= '.'.t3lib_div::_GP('new_resource_ext');
237 $tmp_newresource_name = t3lib_div::tempnam('new_resource_');
238 $alternativeFileName[$tmp_newresource_name] = $newName;
239 $resList = $tmp_newresource_name.','.$resList;
240 }
241 break;
242 case 'makecopy_resource':
243 if (is_array($val)) {
244 $resList = ','.$resList.',';
245 foreach ($val as $k => $file) {
246 $tmp_name = PATH_site.$TCA['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$file;
247 $resList = $tmp_name.','.$resList;
248 }
249 }
250 break;
251 case 'remove_resource':
252 if (is_array($val)) {
253 $resList = ','.$resList.',';
254 foreach ($val as $k => $file) {
255 $resList = str_replace(','.$file.',', ',', $resList);
256 }
257 }
258 break;
259 case 'totop_resource':
260 if (is_array($val)) {
261 $resList = ','.$resList.',';
262 foreach ($val as $k => $file) {
263 $resList = str_replace(','.$file.',', ',', $resList);
264 $resList = ','.$file.$resList;
265 }
266 }
267 break;
268 }
269 }
270 }
271 $resList=implode(',', t3lib_div::trimExplode(',', $resList, 1));
272 if (strcmp($resList, $tplRow['resources'])) {
273 $recData['sys_template'][$saveId]['resources'] = $resList;
274 }
275 if (count($recData)) {
276 // Create new tce-object
277 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
278 $tce->stripslashes_values=0;
279 $tce->alternativeFileName = $alternativeFileName;
280 // Initialize
281 $tce->start($recData, array());
282 // Saved the stuff
283 $tce->process_datamap();
284 // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
285 $tce->clear_cacheCmd('all');
286
287 // tce were processed successfully
288 $this->tce_processed = true;
289
290 // re-read the template ...
291 $this->initialize_editor($this->pObj->id, $template_uid);
292 }
293
294 // Unlink any uploaded/new temp files there was:
295 t3lib_div::unlink_tempfile($tmp_upload_name);
296 t3lib_div::unlink_tempfile($tmp_newresource_name);
297
298 // If files has been edited:
299 if (is_array($edit)) {
300 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.
301 $path = PATH_site.$TCA['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$edit['filename'];
302 $fI = t3lib_div::split_fileref($edit['filename']);
303 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
304 // @TODO: Check if the hardcorded value already has a config member, otherwise create one
305 if (filesize($path) < 30720) { // checks that have already been done.. Just to make sure
306 t3lib_div::writeFile($path, $edit['file']);
307
308 $theOutput.= $this->pObj->doc->spacer(10);
309 $theOutput.= $this->pObj->doc->section(
310 '<font color=red>' . $GLOBALS['LANG']->getLL('fileChanged') . '</font>',
311 sprintf($GLOBALS['LANG']->getLL('resourceUpdated'), $edit['filename']),
312 0, 0, 0, 1
313 );
314
315 // Clear cache - the file has probably affected the template setup
316 // @TODO: Check if the edited file really had something to do with cached data and prevent this clearing if possible!
317 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
318 $tce->stripslashes_values = 0;
319 $tce->start(array(), array());
320 $tce->clear_cacheCmd('all');
321 }
322 }
323 }
324 }
325 }
326
327 // hook Post updating template/TCE processing
328 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'])) {
329 $postTCEProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'];
330 if (is_array($postTCEProcessingHook)) {
331 $hookParameters = array(
332 'POST' => $POST,
333 'tce' => $tce,
334 );
335 foreach ($postTCEProcessingHook as $hookFunction) {
336 t3lib_div::callUserFunction($hookFunction, $hookParameters, $this);
337 }
338 }
339 }
340
341 $theOutput.= $this->pObj->doc->spacer(5);
342 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('templateInformation'), t3lib_iconWorks::getSpriteIconForRecord('sys_template', $tplRow).'<strong>'.htmlspecialchars($tplRow['title']).'</strong>'.htmlspecialchars(trim($tplRow['sitetitle'])?' - ('.$tplRow['sitetitle'].')':''), 0, 1);
343 if ($manyTemplatesMenu) {
344 $theOutput.= $this->pObj->doc->section('', $manyTemplatesMenu);
345 $theOutput.= $this->pObj->doc->divider(5);
346 }
347
348 #$numberOfRows= t3lib_div::intInRange($this->pObj->MOD_SETTINGS["ts_template_editor_TArows"],0,150);
349 #if (!$numberOfRows)
350 $numberOfRows = 35;
351
352 // If abort pressed, nothing should be edited:
353 if ($POST['abort'] || (t3lib_div::testInt($POST['abort_x']) && t3lib_div::testInt($POST['abort_y']))
354 || $POST['saveclose'] || (t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y']))) {
355 unset($e);
356 }
357
358 if ($e['title']) {
359 $outCode = '<input type="Text" name="data[title]" value="'.htmlspecialchars($tplRow['title']).'"'.$this->pObj->doc->formWidth().'>';
360 $outCode.= '<input type="Hidden" name="e[title]" value="1">';
361 $theOutput.= $this->pObj->doc->spacer(15);
362 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('title'), $outCode);
363 }
364 if ($e['sitetitle']) {
365 $outCode = '<input type="Text" name="data[sitetitle]" value="'.htmlspecialchars($tplRow['sitetitle']).'"'.$this->pObj->doc->formWidth().'>';
366 $outCode.= '<input type="Hidden" name="e[sitetitle]" value="1">';
367 $theOutput.= $this->pObj->doc->spacer(15);
368 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('sitetitle'), $outCode);
369 }
370 if ($e['description']) {
371 $outCode = '<textarea name="data[description]" rows="5" class="fixed-font enable-tab"'.$this->pObj->doc->formWidthText(48, '', '').'>'.t3lib_div::formatForTextarea($tplRow['description']).'</textarea>';
372 $outCode.= '<input type="Hidden" name="e[description]" value="1">';
373 $theOutput.= $this->pObj->doc->spacer(15);
374 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('description'), $outCode);
375 }
376 if ($e['resources']) {
377 // Upload
378 $outCode = '<input type="File" name="resources"'.$this->pObj->doc->formWidth().' size="50">';
379 $outCode.= '<input type="Hidden" name="data[resources]" value="1">';
380 $outCode.= '<input type="Hidden" name="e[resources]" value="1">';
381 $outCode.= '<BR>' . $GLOBALS['LANG']->getLL('allowedExtensions') . ' <strong>' . $TCA['sys_template']['columns']['resources']['config']['allowed'] . '</strong>';
382 $outCode.= '<BR>' . $GLOBALS['LANG']->getLL('maxFilesize') . ' <strong>' . t3lib_div::formatSize($TCA['sys_template']['columns']['resources']['config']['max_size']*1024) . '</strong>';
383 $theOutput.= $this->pObj->doc->spacer(15);
384 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('uploadResource'), $outCode);
385
386 // New
387 $opt = explode(',', $this->pObj->textExtensions);
388 $optTags = '';
389 foreach ($opt as $extVal) {
390 $optTags.= '<option value="'.$extVal.'">.'.$extVal.'</option>';
391 }
392 $outCode = '<input type="text" name="new_resource"'.$this->pObj->doc->formWidth(20).'>
393 <select name="new_resource_ext">'.$optTags.'</select>';
394 $outCode.= '<input type="Hidden" name="data[new_resource]" value="1">';
395 $theOutput.= $this->pObj->doc->spacer(15);
396 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('newTextResource'), $outCode);
397
398 // Make copy
399 $rL = $this->resourceListForCopy($this->pObj->id, $template_uid);
400 if ($rL) {
401 $theOutput.= $this->pObj->doc->spacer(20);
402 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('copyResource'), $rL);
403 }
404
405 // Update resource list
406 $rL = $this->procesResources($tplRow['resources'], 1);
407 if ($rL) {
408 $theOutput.= $this->pObj->doc->spacer(20);
409 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('updateResourceList'), $rL);
410 }
411 }
412 if ($e['constants']) {
413 $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>';
414 $outCode.= '<input type="Hidden" name="e[constants]" value="1">';
415 $theOutput.= $this->pObj->doc->spacer(15);
416 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants'), '');
417 $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
418 }
419 if ($e['file']) {
420 $path = PATH_site.$TCA['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$e[file];
421
422 $fI = t3lib_div::split_fileref($e[file]);
423 if (@is_file($path) && t3lib_div::inList($this->pObj->textExtensions, $fI['fileext'])) {
424 if (filesize($path) < $TCA['sys_template']['columns']['resources']['config']['max_size']*1024) {
425 $fileContent = t3lib_div::getUrl($path);
426 $outCode = $GLOBALS['LANG']->getLL('file'). ' <strong>' . $e[file] . '</strong><BR>';
427 $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>';
428 $outCode.= '<input type="Hidden" name="edit[filename]" value="'.$e[file].'">';
429 $outCode.= '<input type="Hidden" name="e[file]" value="'.htmlspecialchars($e[file]).'">';
430 $theOutput.= $this->pObj->doc->spacer(15);
431 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editResource'), '');
432 $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
433 } else {
434 $theOutput.= $this->pObj->doc->spacer(15);
435 $fileToBig = sprintf($GLOBALS['LANG']->getLL('filesizeExceeded'), $TCA['sys_template']['columns']['resources']['config']['max_size']);
436 $filesizeNotAllowed = sprintf($GLOBALS['LANG']->getLL('notAllowed'), $TCA['sys_template']['columns']['resources']['config']['max_size']);
437 $theOutput.= $this->pObj->doc->section(
438 '<font color=red>' . $fileToBig . '</font>',
439 $filesizeNotAllowed,
440 0, 0, 0, 1
441 );
442 }
443 }
444 }
445 if ($e['config']) {
446 $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>';
447
448 if (t3lib_extMgm::isLoaded('tsconfig_help')) {
449 $url = $BACK_PATH.'wizard_tsconfig.php?mode=tsref';
450 $params = array(
451 'formName' => 'editForm',
452 'itemName' => 'data[config]',
453 );
454 $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>';
455 }
456
457 $outCode.= '<input type="Hidden" name="e[config]" value="1">';
458 $theOutput.= $this->pObj->doc->spacer(15);
459 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup'), '');
460 $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
461 }
462
463 // Processing:
464 $outCode = '';
465 $outCode.= $this->tableRow(
466 $GLOBALS['LANG']->getLL('title'),
467 htmlspecialchars($tplRow['title']),
468 'title'
469 );
470 $outCode.= $this->tableRow(
471 $GLOBALS['LANG']->getLL('sitetitle'),
472 htmlspecialchars($tplRow['sitetitle']),
473 'sitetitle'
474 );
475 $outCode.= $this->tableRow(
476 $GLOBALS['LANG']->getLL('description'),
477 nl2br(htmlspecialchars($tplRow['description'])),
478 'description'
479 );
480 $outCode.= $this->tableRow(
481 $GLOBALS['LANG']->getLL('resources'),
482 $this->procesResources($tplRow['resources']),
483 'resources'
484 );
485 $outCode.= $this->tableRow(
486 $GLOBALS['LANG']->getLL('constants'),
487 sprintf($GLOBALS['LANG']->getLL('editToView'), (trim($tplRow[constants]) ? count(explode(LF, $tplRow[constants])) : 0)),
488 'constants'
489 );
490 $outCode.= $this->tableRow(
491 $GLOBALS['LANG']->getLL('setup'),
492 sprintf($GLOBALS['LANG']->getLL('editToView'), (trim($tplRow[config]) ? count(explode(LF, $tplRow[config])) : 0)),
493 'config'
494 );
495 $outCode = '<table border=0 cellpadding=1 cellspacing=1 width="100%">'.$outCode.'</table>';
496
497 $outCode = '<table border=0 cellpadding=0 cellspacing=0>
498 <tr><td class="bgColor2">'.$outCode.'<img src=clear.gif width=465 height=1></td></tr>
499 </table>';
500
501 // Edit all icon:
502 $outCode.= '<br /><a href="#" onClick="' . t3lib_BEfunc::editOnClick(rawurlencode('&createExtension=0') .
503 '&amp;edit[sys_template][' . $tplRow['uid'] . ']=edit', $BACK_PATH, '') . '"><strong>' .
504 t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title'=>
505 $GLOBALS['LANG']->getLL('editTemplateRecord') )) . $GLOBALS['LANG']->getLL('editTemplateRecord') . '</strong></a>';
506 $theOutput.= $this->pObj->doc->spacer(25);
507 $theOutput.= $this->pObj->doc->section('', $outCode);
508
509
510 // hook after compiling the output
511 if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'])) {
512 $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'];
513 if (is_array($postOutputProcessingHook)) {
514 $hookParameters = array(
515 'theOutput' => &$theOutput,
516 'POST' => $POST,
517 'e' => $e,
518 'tplRow' => $tplRow,
519 'numberOfRows' => $numberOfRows
520 );
521 foreach ($postOutputProcessingHook as $hookFunction) {
522 t3lib_div::callUserFunction($hookFunction, $hookParameters, $this);
523 }
524 }
525 }
526
527 } else {
528 $theOutput.= $this->pObj->noTemplate(1);
529 }
530
531
532 return $theOutput;
533 }
534 }
535
536 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']) {
537 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']);
538 }
539
540 ?>