class.tx_tstemplateinfo.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2010 Kasper Skaarhoj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * [CLASS/FUNCTION INDEX of SCRIPT]
00029  *
00030  *
00031  *
00032  *   49: class tx_tstemplateinfo extends t3lib_extobjbase
00033  *   63:     function tableRow($label, $data, $field)
00034  *   77:     function procesResources($resources, $func=false)
00035  *  117:     function resourceListForCopy($id, $template_uid)
00036  *  143:     function initialize_editor($pageId, $template_uid=0)
00037  *  160:     function main()
00038  *
00039  * TOTAL FUNCTIONS: 5
00040  * (This index is automatically created/updated by the extension "extdeveval")
00041  *
00042  */
00043 
00044 $GLOBALS['LANG']->includeLLFile('EXT:tstemplate_info/locallang.xml');
00045 
00046 /**
00047  * This class displays the Info/Modify screen of the Web > Template module
00048  *
00049  * @author  Kasper Skaarhoj <kasperYYYY@typo3.com>
00050  *
00051  * $Id: class.tx_tstemplateinfo.php 8145 2010-07-09 07:34:38Z steffenk $
00052  */
00053 class tx_tstemplateinfo extends t3lib_extobjbase {
00054 
00055     public $tce_processed = false;  // indicator for t3editor, whether data is stored
00056 
00057     /**
00058      * Creates a row for a HTML table
00059      *
00060      * @param   string      $label: The label to be shown (e.g. 'Title:', 'Sitetitle:')
00061      * @param   string      $data: The data/information to be shown (e.g. 'Template for my site')
00062      * @param   string      $field: The field/variable to be sent on clicking the edit icon (e.g. 'title', 'sitetitle')
00063      * @return  string      A row for a HTML table
00064      */
00065     function tableRow($label, $data, $field)    {
00066         $ret = '<tr><td>';
00067         $ret.= '<a href="index.php?id=' . $this->pObj->id . '&e[' . $field . ']=1">' .
00068             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>';
00069         $ret .= '</td><td width="80%" class="bgColor4">' . $data . '&nbsp;</td></tr>';
00070         return $ret;
00071     }
00072 
00073     /**
00074      * Renders HTML table with available template resources/files
00075      *
00076      * @param   string      $resources: List of  resources/files to be shown (e.g. 'file_01.txt,file.txt')
00077      * @param   boolean     $func: Whether to render functions like 'to top' or 'delete' for each resource (default: false)
00078      * @return  string      HTML table with available template resources/files
00079      */
00080     function procesResources($resources, $func=false)   {
00081         $arr = t3lib_div::trimExplode(',', $resources.',,', 1);
00082         $out = '';
00083         $bgcol = ($func ? ' class="bgColor4"' : '');
00084         foreach ($arr as $k => $v) {
00085             $path = PATH_site.$GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$v;
00086             $functions = '';
00087             if ($func)  {
00088                 $functions = '<td bgcolor=red nowrap>' . $GLOBALS['LANG']->getLL('delete') . ' <input type="Checkbox" name="data[remove_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td>';
00089                 $functions.= '<td'.$bgcol.' nowrap>' . $GLOBALS['LANG']->getLL('toTop') . ' <input type="Checkbox" name="data[totop_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td>';
00090                 $functions.= '<td'.$bgcol.' nowrap>';
00091                 $fI = t3lib_div::split_fileref($v);
00092                 if (t3lib_div::inList($this->pObj->textExtensions,$fI['fileext']))  {
00093                     $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>';
00094                 }
00095                 $functions.= '</td>';
00096             }
00097             $thumb = t3lib_BEfunc::thumbCode(array('resources' => $v), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
00098             $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>';
00099         }
00100         if ($out)   {
00101             if ($func)  {
00102                 $out = '<table border=0 cellpadding=1 cellspacing=1 width="100%">'.$out.'</table>';
00103                 $out = '<table border=0 cellpadding=0 cellspacing=0>
00104                     <tr><td class="bgColor2">'.$out.'<img src=clear.gif width=465 height=1></td></tr>
00105                 </table>';
00106             } else {
00107                 $out = '<table border=0 cellpadding=0 cellspacing=0>'.$out.'</table>';
00108             }
00109         }
00110         return $out;
00111     }
00112 
00113     /**
00114      * Renders HTML table with all available template resources/files in the current rootline that could be copied
00115      *
00116      * @param   integer     $id: The uid of the current page
00117      * @param   integer     $template_uid: The uid of the template record to be rendered (only if more than one template on the current page)
00118      * @return  string      HTML table with all available template resources/files in the current rootline that could be copied
00119      */
00120     function resourceListForCopy($id, $template_uid)    {
00121         global $tmpl;
00122         $sys_page = t3lib_div::makeInstance('t3lib_pageSelect');
00123         $rootLine = $sys_page->getRootLine($id);
00124         $tmpl->runThroughTemplates($rootLine, $template_uid);   // This generates the constants/config + hierarchy info for the template.
00125         $theResources = t3lib_div::trimExplode(',', $tmpl->resources, 1);
00126         foreach ($theResources as $k => $v) {
00127             $fI = pathinfo($v);
00128             if (t3lib_div::inList($this->pObj->textExtensions,strtolower($fI['extension'])))    {
00129                 $path = PATH_site.$GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$v;
00130                 $thumb = t3lib_BEfunc::thumbCode(array('resources' => $v), 'sys_template', 'resources', $GLOBALS['BACK_PATH'], '');
00131                 $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>';
00132             }
00133         }
00134         $out = ($out ? '<table border=0 cellpadding=0 cellspacing=0>'.$out.'</table>' : '');
00135         return $out;
00136     }
00137 
00138     /**
00139      * Create an instance of t3lib_tsparser_ext in $GLOBALS['tmpl'] and looks for the first (visible) template
00140      * record. If $template_uid was given and greater than zero, this record will be checked.
00141      *
00142      * @param   integer     $id: The uid of the current page
00143      * @param   integer     $template_uid: The uid of the template record to be rendered (only if more than one template on the current page)
00144      * @return  boolean     Returns true if a template record was found, otherwise false
00145      */
00146     function initialize_editor($pageId, $template_uid=0)    {
00147             // Initializes the module. Done in this function because we may need to re-initialize if data is submitted!
00148         global $tmpl,$tplRow,$theConstants;
00149 
00150         $tmpl = t3lib_div::makeInstance('t3lib_tsparser_ext');  // Defined global here!
00151         $tmpl->tt_track = 0;    // Do not log time-performance information
00152         $tmpl->init();
00153 
00154         $tplRow = $tmpl->ext_getFirstTemplate($pageId, $template_uid);  // Get the row of the first VISIBLE template of the page. whereclause like the frontend.
00155         return (is_array($tplRow) ? true : false);
00156     }
00157 
00158     /**
00159      * The main processing method if this class
00160      *
00161      * @return  string      Information of the template status or the taken actions as HTML string
00162      */
00163     function main() {
00164         global $SOBE,$BE_USER,$LANG,$BACK_PATH,$TCA_DESCR,$TCA,$CLIENT,$TYPO3_CONF_VARS;
00165         global $tmpl,$tplRow,$theConstants;
00166 
00167         $edit = $this->pObj->edit;
00168         $e = $this->pObj->e;
00169 
00170         t3lib_div::loadTCA('sys_template');
00171 
00172 
00173 
00174 
00175         // **************************
00176         // Checking for more than one template an if, set a menu...
00177         // **************************
00178         $manyTemplatesMenu = $this->pObj->templateMenu();
00179         $template_uid = 0;
00180         if ($manyTemplatesMenu) {
00181             $template_uid = $this->pObj->MOD_SETTINGS['templatesOnPage'];
00182         }
00183 
00184 
00185         // **************************
00186         // Initialize
00187         // **************************
00188         $existTemplate = $this->initialize_editor($this->pObj->id, $template_uid);      // initialize
00189 
00190         if ($existTemplate) {
00191             $saveId = ($tplRow['_ORIG_uid'] ? $tplRow['_ORIG_uid'] : $tplRow['uid']);
00192         }
00193         // **************************
00194         // Create extension template
00195         // **************************
00196         $newId = $this->pObj->createTemplate($this->pObj->id, $saveId);
00197         if($newId) {
00198             // switch to new template
00199             t3lib_utility_Http::redirect('index.php?id=' . $this->pObj->id. '&SET[templatesOnPage]=' . $newId);
00200         }
00201 
00202         if ($existTemplate) {
00203                 // Update template ?
00204             $POST = t3lib_div::_POST();
00205             if ($POST['submit'] || (t3lib_div::testInt($POST['submit_x']) && t3lib_div::testInt($POST['submit_y']))
00206                 || $POST['saveclose'] || (t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y']))) {
00207                     // Set the data to be saved
00208                 $recData = array();
00209                 $alternativeFileName = array();
00210                 $resList = $tplRow['resources'];
00211 
00212                 $tmp_upload_name = '';
00213                 $tmp_newresource_name = ''; // Set this to blank
00214 
00215                 if (is_array($POST['data']))    {
00216                     foreach ($POST['data'] as $field => $val) {
00217                         switch ($field) {
00218                             case 'constants':
00219                             case 'config':
00220                             case 'title':
00221                             case 'sitetitle':
00222                             case 'description':
00223                                 $recData['sys_template'][$saveId][$field] = $val;
00224                                 break;
00225                             case 'resources':
00226                                 $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.
00227                                 if ($tmp_upload_name)   {
00228                                     if ($tmp_upload_name!='none' && $_FILES['resources']['name'])   {
00229                                         $alternativeFileName[$tmp_upload_name] = trim($_FILES['resources']['name']);
00230                                         $resList = $tmp_upload_name.','.$resList;
00231                                     }
00232                                 }
00233                                 break;
00234                             case 'new_resource':
00235                                 $newName = trim(t3lib_div::_GP('new_resource'));
00236                                 if ($newName)   {
00237                                     $newName.= '.'.t3lib_div::_GP('new_resource_ext');
00238                                     $tmp_newresource_name = t3lib_div::tempnam('new_resource_');
00239                                     $alternativeFileName[$tmp_newresource_name] = $newName;
00240                                     $resList = $tmp_newresource_name.','.$resList;
00241                                 }
00242                                 break;
00243                             case 'makecopy_resource':
00244                                 if (is_array($val)) {
00245                                     $resList = ','.$resList.',';
00246                                     foreach ($val as $k => $file) {
00247                                         $tmp_name = PATH_site.$TCA['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$file;
00248                                         $resList = $tmp_name.','.$resList;
00249                                     }
00250                                 }
00251                                 break;
00252                             case 'remove_resource':
00253                                 if (is_array($val)) {
00254                                     $resList = ','.$resList.',';
00255                                     foreach ($val as $k => $file) {
00256                                         $resList = str_replace(','.$file.',', ',', $resList);
00257                                     }
00258                                 }
00259                                 break;
00260                             case 'totop_resource':
00261                                 if (is_array($val)) {
00262                                     $resList = ','.$resList.',';
00263                                     foreach ($val as $k => $file) {
00264                                         $resList = str_replace(','.$file.',', ',', $resList);
00265                                         $resList = ','.$file.$resList;
00266                                     }
00267                                 }
00268                                 break;
00269                         }
00270                     }
00271                 }
00272                 $resList=implode(',', t3lib_div::trimExplode(',', $resList, 1));
00273                 if (strcmp($resList, $tplRow['resources'])) {
00274                     $recData['sys_template'][$saveId]['resources'] = $resList;
00275                 }
00276                 if (count($recData))    {
00277                         // Create new  tce-object
00278                     $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00279                     $tce->stripslashes_values=0;
00280                     $tce->alternativeFileName = $alternativeFileName;
00281                         // Initialize
00282                     $tce->start($recData, array());
00283                         // Saved the stuff
00284                     $tce->process_datamap();
00285                         // Clear the cache (note: currently only admin-users can clear the cache in tce_main.php)
00286                     $tce->clear_cacheCmd('all');
00287 
00288                         // tce were processed successfully
00289                     $this->tce_processed = true;
00290 
00291                         // re-read the template ...
00292                     $this->initialize_editor($this->pObj->id, $template_uid);
00293                 }
00294 
00295                     // Unlink any uploaded/new temp files there was:
00296                 t3lib_div::unlink_tempfile($tmp_upload_name);
00297                 t3lib_div::unlink_tempfile($tmp_newresource_name);
00298 
00299                     // If files has been edited:
00300                 if (is_array($edit))        {
00301                     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.
00302                         $path = PATH_site.$TCA['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$edit['filename'];
00303                         $fI = t3lib_div::split_fileref($edit['filename']);
00304                         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
00305                                 // @TODO: Check if the hardcorded value already has a config member, otherwise create one
00306                             if (filesize($path) < 30720)    {   // checks that have already been done.. Just to make sure
00307                                 t3lib_div::writeFile($path, $edit['file']);
00308 
00309                                 $theOutput.= $this->pObj->doc->spacer(10);
00310                                 $theOutput.= $this->pObj->doc->section(
00311                                     '<font color=red>' . $GLOBALS['LANG']->getLL('fileChanged') . '</font>',
00312                                     sprintf($GLOBALS['LANG']->getLL('resourceUpdated'), $edit['filename']),
00313                                     0, 0, 0, 1
00314                                 );
00315 
00316                                     // Clear cache - the file has probably affected the template setup
00317                                     // @TODO: Check if the edited file really had something to do with cached data and prevent this clearing if possible!
00318                                 $tce = t3lib_div::makeInstance('t3lib_TCEmain');
00319                                 $tce->stripslashes_values = 0;
00320                                 $tce->start(array(), array());
00321                                 $tce->clear_cacheCmd('all');
00322                             }
00323                         }
00324                     }
00325                 }
00326             }
00327 
00328                 // hook Post updating template/TCE processing
00329             if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook']))   {
00330                 $postTCEProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postTCEProcessingHook'];
00331                 if (is_array($postTCEProcessingHook)) {
00332                     $hookParameters = array(
00333                         'POST'  => $POST,
00334                         'tce'   => $tce,
00335                     );
00336                     foreach ($postTCEProcessingHook as $hookFunction)   {
00337                         t3lib_div::callUserFunction($hookFunction, $hookParameters, $this);
00338                     }
00339                 }
00340             }
00341 
00342             $theOutput.= $this->pObj->doc->spacer(5);
00343             $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);
00344             if ($manyTemplatesMenu) {
00345                 $theOutput.= $this->pObj->doc->section('', $manyTemplatesMenu);
00346                 $theOutput.= $this->pObj->doc->divider(5);
00347             }
00348 
00349             #$numberOfRows= t3lib_div::intInRange($this->pObj->MOD_SETTINGS["ts_template_editor_TArows"],0,150);
00350             #if (!$numberOfRows)
00351             $numberOfRows = 35;
00352 
00353                 // If abort pressed, nothing should be edited:
00354             if ($POST['abort'] || (t3lib_div::testInt($POST['abort_x']) && t3lib_div::testInt($POST['abort_y']))
00355                 || $POST['saveclose'] || (t3lib_div::testInt($POST['saveclose_x']) && t3lib_div::testInt($POST['saveclose_y']))) {
00356                 unset($e);
00357             }
00358 
00359             if ($e['title'])    {
00360                 $outCode = '<input type="Text" name="data[title]" value="'.htmlspecialchars($tplRow['title']).'"'.$this->pObj->doc->formWidth().'>';
00361                 $outCode.= '<input type="Hidden" name="e[title]" value="1">';
00362                 $theOutput.= $this->pObj->doc->spacer(15);
00363                 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('title'), $outCode);
00364             }
00365             if ($e['sitetitle'])    {
00366                 $outCode = '<input type="Text" name="data[sitetitle]" value="'.htmlspecialchars($tplRow['sitetitle']).'"'.$this->pObj->doc->formWidth().'>';
00367                 $outCode.= '<input type="Hidden" name="e[sitetitle]" value="1">';
00368                 $theOutput.= $this->pObj->doc->spacer(15);
00369                 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('sitetitle'), $outCode);
00370             }
00371             if ($e['description'])  {
00372                 $outCode = '<textarea name="data[description]" rows="5" class="fixed-font enable-tab"'.$this->pObj->doc->formWidthText(48, '', '').'>'.t3lib_div::formatForTextarea($tplRow['description']).'</textarea>';
00373                 $outCode.= '<input type="Hidden" name="e[description]" value="1">';
00374                 $theOutput.= $this->pObj->doc->spacer(15);
00375                 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('description'), $outCode);
00376             }
00377             if ($e['resources'])    {
00378                     // Upload
00379                 $outCode = '<input type="File" name="resources"'.$this->pObj->doc->formWidth().' size="50">';
00380                 $outCode.= '<input type="Hidden" name="data[resources]" value="1">';
00381                 $outCode.= '<input type="Hidden" name="e[resources]" value="1">';
00382                 $outCode.= '<BR>' . $GLOBALS['LANG']->getLL('allowedExtensions') . ' <strong>' . $TCA['sys_template']['columns']['resources']['config']['allowed'] . '</strong>';
00383                 $outCode.= '<BR>' . $GLOBALS['LANG']->getLL('maxFilesize') . ' <strong>' . t3lib_div::formatSize($TCA['sys_template']['columns']['resources']['config']['max_size']*1024) . '</strong>';
00384                 $theOutput.= $this->pObj->doc->spacer(15);
00385                 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('uploadResource'), $outCode);
00386 
00387                     // New
00388                 $opt = explode(',', $this->pObj->textExtensions);
00389                 $optTags = '';
00390                 foreach ($opt as $extVal) {
00391                     $optTags.= '<option value="'.$extVal.'">.'.$extVal.'</option>';
00392                 }
00393                 $outCode = '<input type="text" name="new_resource"'.$this->pObj->doc->formWidth(20).'>
00394                     <select name="new_resource_ext">'.$optTags.'</select>';
00395                 $outCode.= '<input type="Hidden" name="data[new_resource]" value="1">';
00396                 $theOutput.= $this->pObj->doc->spacer(15);
00397                 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('newTextResource'), $outCode);
00398 
00399                     // Make copy
00400                 $rL = $this->resourceListForCopy($this->pObj->id, $template_uid);
00401                 if ($rL)    {
00402                     $theOutput.= $this->pObj->doc->spacer(20);
00403                     $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('copyResource'), $rL);
00404                 }
00405 
00406                     // Update resource list
00407                 $rL = $this->procesResources($tplRow['resources'], 1);
00408                 if ($rL)    {
00409                     $theOutput.= $this->pObj->doc->spacer(20);
00410                     $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('updateResourceList'), $rL);
00411                 }
00412             }
00413             if ($e['constants'])    {
00414                 $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>';
00415                 $outCode.= '<input type="Hidden" name="e[constants]" value="1">';
00416                 $theOutput.= $this->pObj->doc->spacer(15);
00417                 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants'), '');
00418                 $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
00419             }
00420             if ($e['file']) {
00421                 $path = PATH_site.$TCA['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$e[file];
00422 
00423                 $fI = t3lib_div::split_fileref($e[file]);
00424                 if (@is_file($path) && t3lib_div::inList($this->pObj->textExtensions, $fI['fileext']))  {
00425                     if (filesize($path) < $TCA['sys_template']['columns']['resources']['config']['max_size']*1024)  {
00426                         $fileContent = t3lib_div::getUrl($path);
00427                         $outCode = $GLOBALS['LANG']->getLL('file'). ' <strong>' . $e[file] . '</strong><BR>';
00428                         $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>';
00429                         $outCode.= '<input type="Hidden" name="edit[filename]" value="'.$e[file].'">';
00430                         $outCode.= '<input type="Hidden" name="e[file]" value="'.htmlspecialchars($e[file]).'">';
00431                         $theOutput.= $this->pObj->doc->spacer(15);
00432                         $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editResource'), '');
00433                         $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
00434                     } else {
00435                         $theOutput.= $this->pObj->doc->spacer(15);
00436                         $fileToBig = sprintf($GLOBALS['LANG']->getLL('filesizeExceeded'), $TCA['sys_template']['columns']['resources']['config']['max_size']);
00437                         $filesizeNotAllowed = sprintf($GLOBALS['LANG']->getLL('notAllowed'), $TCA['sys_template']['columns']['resources']['config']['max_size']);
00438                         $theOutput.= $this->pObj->doc->section(
00439                             '<font color=red>' . $fileToBig . '</font>',
00440                             $filesizeNotAllowed,
00441                             0, 0, 0, 1
00442                         );
00443                     }
00444                 }
00445             }
00446             if ($e['config'])   {
00447                 $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>';
00448 
00449                 if (t3lib_extMgm::isLoaded('tsconfig_help'))    {
00450                     $url = $BACK_PATH.'wizard_tsconfig.php?mode=tsref';
00451                     $params = array(
00452                         'formName' => 'editForm',
00453                         'itemName' => 'data[config]',
00454                     );
00455                     $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>';
00456                 }
00457 
00458                 $outCode.= '<input type="Hidden" name="e[config]" value="1">';
00459                 $theOutput.= $this->pObj->doc->spacer(15);
00460                 $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup'), '');
00461                 $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
00462             }
00463 
00464                 // Processing:
00465             $outCode = '';
00466             $outCode.= $this->tableRow(
00467                 $GLOBALS['LANG']->getLL('title'),
00468                 htmlspecialchars($tplRow['title']),
00469                 'title'
00470             );
00471             $outCode.= $this->tableRow(
00472                 $GLOBALS['LANG']->getLL('sitetitle'),
00473                 htmlspecialchars($tplRow['sitetitle']),
00474                 'sitetitle'
00475             );
00476             $outCode.= $this->tableRow(
00477                 $GLOBALS['LANG']->getLL('description'),
00478                 nl2br(htmlspecialchars($tplRow['description'])),
00479                 'description'
00480             );
00481             $outCode.= $this->tableRow(
00482                 $GLOBALS['LANG']->getLL('resources'),
00483                 $this->procesResources($tplRow['resources']),
00484                 'resources'
00485             );
00486             $outCode.= $this->tableRow(
00487                 $GLOBALS['LANG']->getLL('constants'),
00488                 sprintf($GLOBALS['LANG']->getLL('editToView'), (trim($tplRow[constants]) ? count(explode(LF, $tplRow[constants])) : 0)),
00489                 'constants'
00490             );
00491             $outCode.= $this->tableRow(
00492                 $GLOBALS['LANG']->getLL('setup'),
00493                 sprintf($GLOBALS['LANG']->getLL('editToView'), (trim($tplRow[config]) ? count(explode(LF, $tplRow[config])) : 0)),
00494                 'config'
00495             );
00496             $outCode = '<br /><br /><table class="t3-table-info">' . $outCode . '</table>';
00497 
00498                 // Edit all icon:
00499             $outCode.= '<br /><a href="#" onClick="' . t3lib_BEfunc::editOnClick(rawurlencode('&createExtension=0') .
00500                 '&amp;edit[sys_template][' . $tplRow['uid'] . ']=edit', $BACK_PATH, '') . '"><strong>' .
00501                 t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title'=>
00502                 $GLOBALS['LANG']->getLL('editTemplateRecord') ))  . $GLOBALS['LANG']->getLL('editTemplateRecord') . '</strong></a>';
00503             $theOutput.= $this->pObj->doc->section('', $outCode);
00504 
00505 
00506                 // hook after compiling the output
00507             if (isset($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook']))    {
00508                 $postOutputProcessingHook =& $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']['postOutputProcessingHook'];
00509                 if (is_array($postOutputProcessingHook)) {
00510                     $hookParameters = array(
00511                         'theOutput' => &$theOutput,
00512                         'POST'      => $POST,
00513                         'e'         => $e,
00514                         'tplRow'        => $tplRow,
00515                         'numberOfRows'      => $numberOfRows
00516                     );
00517                     foreach ($postOutputProcessingHook as $hookFunction)    {
00518                         t3lib_div::callUserFunction($hookFunction, $hookParameters, $this);
00519                     }
00520                 }
00521             }
00522 
00523         } else {
00524             $theOutput.= $this->pObj->noTemplate(1);
00525         }
00526 
00527 
00528         return $theOutput;
00529     }
00530 }
00531 
00532 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']) {
00533     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/tstemplate_info/class.tx_tstemplateinfo.php']);
00534 }
00535 
00536 ?>

Generated on Sat Jul 24 04:17:41 2010 for TYPO3 API by  doxygen 1.4.7