Followup to #6087: Added missing labels localize.isLocalizable and localize.wasRemove...
[Packages/TYPO3.CMS.git] / typo3 / sysext / tstemplate_info / class.tx_tstemplateinfo.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2007 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 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
29 */
30 /**
31 * [CLASS/FUNCTION INDEX of SCRIPT]
32 *
33 *
34 *
35 * 49: class tx_tstemplateinfo extends t3lib_extobjbase
36 * 63: function tableRow($label, $data, $field)
37 * 77: function procesResources($resources, $func=false)
38 * 117: function resourceListForCopy($id, $template_uid)
39 * 143: function initialize_editor($pageId, $template_uid=0)
40 * 160: function main()
41 *
42 * TOTAL FUNCTIONS: 5
43 * (This index is automatically created/updated by the extension "extdeveval")
44 *
45 */
46
47 require_once(PATH_t3lib."class.t3lib_extobjbase.php");
48
49 class tx_tstemplateinfo extends t3lib_extobjbase {
50
51 /* <beta-code TYPO3 4.2-dev> */
52 private $tce_processed = false; // indicator for t3editor, whether data is stored
53 /* </beta-code> */
54
55 /**
56 * Creates a row for a HTML table
57 *
58 * @param string $label: The label to be shown (e.g. 'Title:', 'Sitetitle:')
59 * @param string $data: The data/information to be shown (e.g. 'Template for my site')
60 * @param string $field: The field/variable to be sent on clicking the edit icon (e.g. 'title', 'sitetitle')
61 * @return string A row for a HTML table
62 */
63 function tableRow($label, $data, $field) {
64 $ret = '<tr><td class="bgColor4" width="1%">';
65 $ret.= '<a href="index.php?id='.$this->pObj->id.'&e['.$field.']=1"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/edit2.gif').' width=11 height=12 hspace=3 border=0 title="Edit field"></a>';
66 $ret.= '</td><td class="bgColor4" width="1%"><b>'.$label.'&nbsp;&nbsp;</b></td><td class="bgColor4" width="99%">'.$data.'&nbsp;</td></tr>';
67 return $ret;
68 }
69
70 /**
71 * Renders HTML table with available template resources/files
72 *
73 * @param string $resources: List of resources/files to be shown (e.g. 'file_01.txt,file.txt')
74 * @param boolean $func: Whether to render functions like 'to top' or 'delete' for each resource (default: false)
75 * @return string HTML table with available template resources/files
76 */
77 function procesResources($resources, $func=false) {
78 $arr = t3lib_div::trimExplode(',', $resources.',,', 1);
79 $out = '';
80 $bgcol = ($func ? ' class="bgColor4"' : '');
81 foreach ($arr as $k => $v) {
82 $path = PATH_site.$GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$v;
83 $functions = '';
84 if ($func) {
85 $functions = '<td bgcolor=red nowrap>Delete: <input type="Checkbox" name="data[remove_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td>';
86 $functions.= '<td'.$bgcol.' nowrap>To top: <input type="Checkbox" name="data[totop_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td>';
87 $functions.= '<td'.$bgcol.' nowrap>';
88 $fI = t3lib_div::split_fileref($v);
89 if (t3lib_div::inList($this->pObj->textExtensions,$fI['fileext'])) {
90 $functions.= '<a href="index.php?id='.$this->pObj->id.'&e[file]='.rawurlencode($v).'"><img '.t3lib_iconWorks::skinImg($GLOBALS['BACK_PATH'], 'gfx/edit2.gif').' width=11 height=12 hspace=3 border=0 title="Edit file"></a>';
91 }
92 $functions.= '</td>';
93 }
94 $thumb = t3lib_BEfunc::thumbCode(array('resources' => $v), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
95 $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>';
96 }
97 if ($out) {
98 if ($func) {
99 $out = '<table border=0 cellpadding=1 cellspacing=1 width="100%">'.$out.'</table>';
100 $out = '<table border=0 cellpadding=0 cellspacing=0>
101 <tr><td class="bgColor2">'.$out.'<img src=clear.gif width=465 height=1></td></tr>
102 </table>';
103 } else {
104 $out = '<table border=0 cellpadding=0 cellspacing=0>'.$out.'</table>';
105 }
106 }
107 return $out;
108 }
109
110 /**
111 * Renders HTML table with all available template resources/files in the current rootline that could be copied
112 *
113 * @param integer $id: The uid of the current page
114 * @param integer $template_uid: The uid of the template record to be rendered (only if more than one template on the current page)
115 * @return string HTML table with all available template resources/files in the current rootline that could be copied
116 */
117 function resourceListForCopy($id, $template_uid) {
118 global $tmpl;
119 $sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
120 $rootLine = $sys_page->getRootLine($id);
121 $tmpl->runThroughTemplates($rootLine, $template_uid); // This generates the constants/config + hierarchy info for the template.
122 $theResources = t3lib_div::trimExplode(',', $tmpl->resources, 1);
123 foreach ($theResources as $k => $v) {
124 $fI = pathinfo($v);
125 if (t3lib_div::inList($this->pObj->textExtensions,strtolower($fI['extension']))) {
126 $path = PATH_site.$GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$v;
127 $thumb = t3lib_BEfunc::thumbCode(array('resources' => $v), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
128 $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>';
129 }
130 }
131 $out = ($out ? '<table border=0 cellpadding=0 cellspacing=0>'.$out.'</table>' : '');
132 return $out;
133 }
134
135 /**
136 * Create an instance of t3lib_tsparser_ext in $GLOBALS['tmpl'] and looks for the first (visible) template
137 * record. If $template_uid was given and greater than zero, this record will be checked.
138 *
139 * @param integer $id: The uid of the current page
140 * @param integer $template_uid: The uid of the template record to be rendered (only if more than one template on the current page)
141 * @return boolean Returns true if a template record was found, otherwise false
142 */
143 function initialize_editor($pageId, $template_uid=0) {
144 // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
145 global $tmpl,$tplRow,$theConstants;
146
147 $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext'); // Defined global here!
148 $tmpl->tt_track = 0; // Do not log time-performance information
149 $tmpl->init();
150
151 $tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid); // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
152 return (is_array($tplRow) ? true : false);
153 }
154
155 /**
156 * The main processing method if this class
157 *
158 * @return string Information of the template status or the taken actions as HTML string
159 */
160 function main() {
161 global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
162 global $tmpl,$tplRow,$theConstants;
163
164 $edit = $this->pObj->edit;
165 $e = $this->pObj->e;
166
167 t3lib_div::loadTCA('sys_template');
168
169 // **************************
170 // Create extension template
171 // **************************
172 $this->pObj->createTemplate($this->pObj->id);
173
174
175 // **************************
176 // Checking for more than one template an if, set a menu...
177 // **************************
178 $manyTemplatesMenu = $this->pObj->templateMenu();
179 $template_uid = 0;
180 if ($manyTemplatesMenu) {
181 $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
182 }
183
184
185 // **************************
186 // Initialize
187 // **************************
188 $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid); // initialize
189 if ($existTemplate) {
190 $saveId = ($tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']);
191
192 // Update template ?
193 $POST = t3lib_div::_POST();
194 if ($POST['submit']) {
195 require_once(PATH_t3lib.'class.t3lib_tcemain.php');
196 // Set the data to be saved
197 $recData = array();
198 $alternativeFileName = array();
199 $resList = $tplRow['resources'];
200
201 $tmp_upload_name = '';
202 $tmp_newresource_name = ''; // Set this to blank
203
204 if (is_array($POST['data'])) {
205 foreach ($POST['data'] as $field => $val) {
206 switch ($field) {
207 case 'constants':
208 case 'config':
209 case 'title':
210 case 'sitetitle':
211 case 'description':
212 $recData['sys_template'][$saveId][$field] = $val;
213 break;
214 case 'resources':
215 $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.
216 if ($tmp_upload_name) {
217 if ($tmp_upload_name!='none' && $_FILES['resources']['name']) {
218 $alternativeFileName[$tmp_upload_name] = trim($_FILES['resources']['name']);
219 $resList = $tmp_upload_name.','.$resList;
220 }
221 }
222 break;
223 case 'new_resource':
224 $newName = trim(t3lib_div::_GP('new_resource'));
225 if ($newName) {
226 $newName.= '.'.t3lib_div::_GP('new_resource_ext');
227 $tmp_newresource_name = t3lib_div::tempnam('new_resource_');
228 $alternativeFileName[$tmp_newresource_name] = $newName;
229 $resList = $tmp_newresource_name.','.$resList;
230 }
231 break;
232 case 'makecopy_resource':
233 if (is_array($val)) {
234 $resList = ','.$resList.',';
235 foreach ($val as $k => $file) {
236 $tmp_name = PATH_site.$TCA['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$file;
237 $resList = $tmp_name.','.$resList;
238 }
239 }
240 break;
241 case 'remove_resource':
242 if (is_array($val)) {
243 $resList = ','.$resList.',';
244 foreach ($val as $k => $file) {
245 $resList = str_replace(','.$file.',', ',', $resList);
246 }
247 }
248 break;
249 case 'totop_resource':
250 if (is_array($val)) {
251 $resList = ','.$resList.',';
252 foreach ($val as $k => $file) {
253 $resList = str_replace(','.$file.',', ',', $resList);
254 $resList = ','.$file.$resList;
255 }
256 }
257 break;
258 }
259 }
260 }
261 $resList=implode(',', t3lib_div::trimExplode(',', $resList, 1));
262 if (strcmp($resList, $tplRow['resources'])) {
263 $recData['sys_template'][$saveId]['resources'] = $resList;
264 }
265 if (count($recData)) {
266 // Create new tce-object
267 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
268 $tce->stripslashes_values=0;
269 $tce->alternativeFileName = $alternativeFileName;
270 // Initialize
271 $tce->start($recData, array());
272 // Saved the stuff
273 $tce->process_datamap();
274 // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
275 $tce->clear_cacheCmd('all');
276
277 /* <beta-code TYPO3 4.2-dev> */
278 $this->tce_processed = true;
279 /* </beta-code> */
280
281 // re-read the template ...
282 $this->initialize_editor($this->pObj->id, $template_uid);
283 }
284
285 // Unlink any uploaded/new temp files there was:
286 t3lib_div::unlink_tempfile($tmp_upload_name);
287 t3lib_div::unlink_tempfile($tmp_newresource_name);
288
289 // If files has been edited:
290 if (is_array($edit)) {
291 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.
292 $path = PATH_site.$TCA['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$edit['filename'];
293 $fI = t3lib_div::split_fileref($edit['filename']);
294 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
295 // @TODO: Check if the hardcorded value already has a config member, otherwise create one
296 if (filesize($path) < 30720) { // checks that have already been done.. Just to make sure
297 t3lib_div::writeFile($path, $edit['file']);
298
299 $theOutput.= $this->pObj->doc->spacer(10);
300 $theOutput.= $this->pObj->doc->section('<font color=red>FILE CHANGED</font>', "Resource '".$edit['filename']."' has been updated.", 0, 0, 0, 1);
301
302 // Clear cache - the file has probably affected the template setup
303 // @TODO: Check if the edited file really had something to do with cached data and prevent this clearing if possible!
304 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
305 $tce->stripslashes_values = 0;
306 $tce->start(array(), array());
307 $tce->clear_cacheCmd('all');
308 }
309 }
310 }
311 }
312 }
313
314 /* <beta-code TYPO3 4.2-dev> */
315
316 // if TSEditor is enabled and this POST request is an Ajax-Request
317 if(is_object($GLOBALS['T3_VAR']['t3editorObj'])
318 && $GLOBALS['T3_VAR']['t3editorObj']->isEnabled
319 && t3lib_div::_POST('submitAjax')) {
320
321 $GLOBALS['T3_VAR']['t3editorObj']->setBEUCdisableT3Editor(false);
322
323 // abort request here and return message
324 // @TODO: Json or other response here!?
325 if ($this->tce_processed) {
326 echo "OK";
327 } else {
328 echo "ERROR";
329 }
330 exit();
331 }
332
333 /* </beta-code> */
334
335 $theOutput.= $this->pObj->doc->spacer(5);
336 $theOutput.= $this->pObj->doc->section('Template information:', '<img src="'.$BACK_PATH.t3lib_iconWorks::getIcon('sys_template',$tplRow).'" width=18 height=16 align=top><b>'.htmlspecialchars($tplRow['title']).'</b>'.htmlspecialchars(trim($tplRow['sitetitle'])?' - ('.$tplRow['sitetitle'].')':''), 0, 1);
337 if ($manyTemplatesMenu) {
338 $theOutput.= $this->pObj->doc->section('', $manyTemplatesMenu);
339 $theOutput.= $this->pObj->doc->divider(5);
340 }
341
342 #$numberOfRows= t3lib_div::intInRange($this->pObj->MOD_SETTINGS["ts_template_editor_TArows"],0,150);
343 #if (!$numberOfRows)
344 $numberOfRows = 35;
345
346 // If abort pressed, nothing should be edited:
347 if (t3lib_div::_POST('abort')) {
348 unset($e);
349 }
350
351 if (is_array($e)) {
352 $theOutput.= $this->pObj->doc->section('', '<BR><input type="Submit" name="submit" value="Update"> <input type="Submit" name="abort" value="Cancel">');
353 }
354 if ($e['title']) {
355 $outCode = '<input type="Text" name="data[title]" value="'.htmlspecialchars($tplRow['title']).'"'.$this->pObj->doc->formWidth().'>';
356 $outCode.= '<input type="Hidden" name="e[title]" value="1">';
357 $theOutput.= $this->pObj->doc->spacer(15);
358 $theOutput.= $this->pObj->doc->section('Title:', $outCode);
359 }
360 if ($e['sitetitle']) {
361 $outCode = '<input type="Text" name="data[sitetitle]" value="'.htmlspecialchars($tplRow['sitetitle']).'"'.$this->pObj->doc->formWidth().'>';
362 $outCode.= '<input type="Hidden" name="e[sitetitle]" value="1">';
363 $theOutput.= $this->pObj->doc->spacer(15);
364 $theOutput.= $this->pObj->doc->section('Sitetitle:', $outCode);
365 }
366 if ($e['description']) {
367 $outCode = '<textarea name="data[description]" rows="5" class="fixed-font enable-tab"'.$this->pObj->doc->formWidthText(48, '', '').'>'.t3lib_div::formatForTextarea($tplRow['description']).'</textarea>';
368 $outCode.= '<input type="Hidden" name="e[description]" value="1">';
369 $theOutput.= $this->pObj->doc->spacer(15);
370 $theOutput.= $this->pObj->doc->section('Description:', $outCode);
371 }
372 if ($e['resources']) {
373 // Upload
374 $outCode = '<input type="File" name="resources"'.$this->pObj->doc->formWidth().' size="50">';
375 $outCode.= '<input type="Hidden" name="data[resources]" value="1">';
376 $outCode.= '<input type="Hidden" name="e[resources]" value="1">';
377 $outCode.= '<BR>Allowed extensions: <b>'.$TCA['sys_template']['columns']['resources']['config']['allowed'].'</b>';
378 $outCode.= '<BR>Max file size: <b>'.t3lib_div::formatSize($TCA['sys_template']['columns']['resources']['config']['max_size']*1024).'</b>';
379 $theOutput.= $this->pObj->doc->spacer(15);
380 $theOutput.= $this->pObj->doc->section('Upload resource:', $outCode);
381
382 // New
383 $opt = explode(',', $this->pObj->textExtensions);
384 $optTags = '';
385 foreach ($opt as $extVal) {
386 $optTags.= '<option value="'.$extVal.'">.'.$extVal.'</option>';
387 }
388 $outCode = '<input type="text" name="new_resource"'.$this->pObj->doc->formWidth(20).'>
389 <select name="new_resource_ext">'.$optTags.'</select>';
390 $outCode.= '<input type="Hidden" name="data[new_resource]" value="1">';
391 $theOutput.= $this->pObj->doc->spacer(15);
392 $theOutput.= $this->pObj->doc->section('New text resource (enter name):', $outCode);
393
394 // Make copy
395 $rL = $this->resourceListForCopy($this->pObj->id, $template_uid);
396 if ($rL) {
397 $theOutput.= $this->pObj->doc->spacer(20);
398 $theOutput.= $this->pObj->doc->section('Make a copy of resource:', $rL);
399 }
400
401 // Update resource list
402 $rL = $this->procesResources($tplRow['resources'], 1);
403 if ($rL) {
404 $theOutput.= $this->pObj->doc->spacer(20);
405 $theOutput.= $this->pObj->doc->section('Update resource list:', $rL);
406 }
407 }
408 if ($e['constants']) {
409 $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>';
410 $outCode.= '<input type="Hidden" name="e[constants]" value="1">';
411 $theOutput.= $this->pObj->doc->spacer(15);
412 $theOutput.= $this->pObj->doc->section('Constants:', '');
413 $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
414 }
415 if ($e['file']) {
416 $path = PATH_site.$TCA['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$e[file];
417
418 $fI = t3lib_div::split_fileref($e[file]);
419 if (@is_file($path) && t3lib_div::inList($this->pObj->textExtensions, $fI['fileext'])) {
420 if (filesize($path) < $TCA['sys_template']['columns']['resources']['config']['max_size']*1024) {
421 $fileContent = t3lib_div::getUrl($path);
422 $outCode = 'File: <b>'.$e[file].'</b><BR>';
423 $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>';
424 $outCode.= '<input type="Hidden" name="edit[filename]" value="'.$e[file].'">';
425 $outCode.= '<input type="Hidden" name="e[file]" value="'.htmlspecialchars($e[file]).'">';
426 $theOutput.= $this->pObj->doc->spacer(15);
427 $theOutput.= $this->pObj->doc->section('Edit Resource:', '');
428 $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
429 } else {
430 $theOutput.= $this->pObj->doc->spacer(15);
431 $theOutput.= $this->pObj->doc->section(
432 '<font color=red>Filesize exceeded '.$TCA['sys_template']['columns']['resources']['config']['max_size'].' Kbytes</font>',
433 'Files larger than '.$TCA['sys_template']['columns']['resources']['config']['max_size'].' KByes are not allowed to be edited.',
434 0, 0, 0, 1
435 );
436 }
437 }
438 }
439 if ($e['config']) {
440
441 /* <beta-code TYPO3 4.2-dev> */
442
443 if(is_object($GLOBALS['T3_VAR']['t3editorObj'])
444 && $GLOBALS['T3_VAR']['t3editorObj']->isEnabled) {
445 $outCode = $GLOBALS['T3_VAR']['t3editorObj']->getCodeEditor(
446 'data[config]', // name
447 'fixed-font', // class
448 t3lib_div::formatForTextarea($tplRow['config']), // content
449 'rows="'.$numberOfRows.'" wrap="off" '.$this->pObj->doc->formWidthText(48, 'width:98%;height:60%', 'off'),
450 'Template: '.htmlspecialchars($tplRow['title']).': Setup'
451 );
452 } else {
453 $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>';
454 }
455
456 /* </beta-code> */
457
458 /*
459 <original-code>
460 $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>';
461 </original-code>
462 */
463
464 if (t3lib_extMgm::isLoaded('tsconfig_help')) {
465 $url = $BACK_PATH.'wizard_tsconfig.php?mode=tsref';
466 $params = array(
467 'formName' => 'editForm',
468 'itemName' => 'data[config]',
469 );
470 $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;"><img '.t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/wizard_tsconfig.gif').' width="22" height="27" border="0" title="TSref reference"></a>';
471 }
472
473 $outCode.= '<input type="Hidden" name="e[config]" value="1">';
474 $theOutput.= $this->pObj->doc->spacer(15);
475 $theOutput.= $this->pObj->doc->section('Setup:', '');
476 $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
477 }
478 if (is_array($e)) {
479 $theOutput.=$this->pObj->doc->section('', '<BR><input type="Submit" name="submit" value="Update"> <input type="Submit" name="abort" value="Cancel">');
480 }
481
482 // Processing:
483 $outCode = '';
484 $outCode.= $this->tableRow('Title:', htmlspecialchars($tplRow['title']), 'title');
485 $outCode.= $this->tableRow('Sitetitle:', htmlspecialchars($tplRow['sitetitle']), 'sitetitle');
486 $outCode.= $this->tableRow('Description:', nl2br(htmlspecialchars($tplRow['description'])), 'description');
487 $outCode.= $this->tableRow('Resources:', $this->procesResources($tplRow['resources']), 'resources');
488 $outCode.= $this->tableRow('Constants:', '(edit to view, '.(trim($tplRow[constants]) ? count(explode(chr(10), $tplRow[constants])) : 0).' lines)', 'constants');
489 $outCode.= $this->tableRow('Setup:', '(edit to view, '.(trim($tplRow[config]) ? count(explode(chr(10), $tplRow[config])) : 0).' lines)', 'config');
490 $outCode = '<table border=0 cellpadding=1 cellspacing=1 width="100%">'.$outCode.'</table>';
491
492 $outCode = '<table border=0 cellpadding=0 cellspacing=0>
493 <tr><td class="bgColor2">'.$outCode.'<img src=clear.gif width=465 height=1></td></tr>
494 </table>';
495
496 // Edit all icon:
497 $outCode.= '<BR><a href="#" onClick="'.t3lib_BEfunc::editOnClick(rawurlencode('&createExtension=0').'&edit[sys_template]['.$tplRow['uid'].']=edit', $BACK_PATH, '').'"><strong>Click here to edit whole template record</strong></a>';
498
499 $theOutput.= $this->pObj->doc->spacer(25);
500 $theOutput.= $this->pObj->doc->section('', $outCode);
501
502 $theOutput.= $this->pObj->doc->spacer(10);
503 $theOutput.= $this->pObj->doc->section(
504 'Cache',
505 'Click here to <a href="index.php?id='.$this->pObj->id.'&clear_all_cache=1"><strong>clear all cache</strong></a>.<BR><br>Status: '.$this->pObj->getCountCacheTables(1),
506 0, 1
507 );
508 } else {
509 $theOutput.= $this->pObj->noTemplate(1);
510 }
511 return $theOutput;
512 }
513 }
514
515 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']) {
516 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']);
517 }
518
519 ?>