fixed bug #11379: TStemplate Info/Modify uses hardcoded texts (Thanx to Christopher...
authorRupert Germann <rupi@gmx.li>
Sat, 11 Jul 2009 10:51:03 +0000 (10:51 +0000)
committerRupert Germann <rupi@gmx.li>
Sat, 11 Jul 2009 10:51:03 +0000 (10:51 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5708 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/lang/locallang_common.xml
typo3/sysext/tstemplate_info/class.tx_tstemplateinfo.php
typo3/sysext/tstemplate_info/locallang.xml [new file with mode: 0644]

index 72e0976..813dc85 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-07-08  Rupert Germann  <rupi@gmx.li>
+
+       * fixed bug #11379: TStemplate Info/Modify uses hardcoded texts (Thanx to Christopher Stelmaszyk)
+
 2009-07-09  Martin Kutschker  <masi@typo3.org>
 
        * Fixed bug: same error message is used twice for different errors
index 0a880a8..63a7fce 100644 (file)
@@ -21,6 +21,8 @@
                        <label index="down">Down</label>
                        <label index="download">Download</label>
                        <label index="edit">Edit</label>
+                       <label index="editField">Edit field</label>
+                       <label index="editFile">Edit file</label>
                        <label index="enable">Enable</label>
                        <label index="file">File</label>
                        <label index="files">Files</label>
@@ -57,6 +59,7 @@
                        <label index="start">Start</label>
                        <label index="stop">Stop</label>
                        <label index="submit">Submit</label>
+                       <label index="tsRef">TSref reference</label>
                        <label index="up">Up</label>
                        <label index="upload">Upload</label>
                        <label index="user">User</label>
index 8fe0ba4..6875878 100644 (file)
@@ -44,6 +44,8 @@
  *
  */
 
+$GLOBALS['LANG']->includeLLFile('EXT:tstemplate_info/locallang.xml');
+
 class tx_tstemplateinfo extends t3lib_extobjbase {
 
        public $tce_processed = false;  // indicator for t3editor, whether data is stored
@@ -58,7 +60,7 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
         */
        function tableRow($label, $data, $field)        {
                $ret = '<tr><td class="bgColor4" width="1%">';
-               $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>';
+               $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="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:editField', true) . '"></a>';
                $ret.= '</td><td class="bgColor4" width="1%"><b>'.$label.'&nbsp;&nbsp;</b></td><td class="bgColor4" width="99%">'.$data.'&nbsp;</td></tr>';
                return $ret;
        }
@@ -78,12 +80,12 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
                        $path = PATH_site.$GLOBALS['TCA']['sys_template']['columns']['resources']['config']['uploadfolder'].'/'.$v;
                        $functions = '';
                        if ($func)      {
-                               $functions = '<td bgcolor=red nowrap>Delete: <input type="Checkbox" name="data[remove_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td>';
-                               $functions.= '<td'.$bgcol.' nowrap>To top: <input type="Checkbox" name="data[totop_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td>';
+                               $functions = '<td bgcolor=red nowrap>' . $GLOBALS['LANG']->getLL('delete', true) . ' <input type="Checkbox" name="data[remove_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td>';
+                               $functions.= '<td'.$bgcol.' nowrap>' . $GLOBALS['LANG']->getLL('toTop', true) . ' <input type="Checkbox" name="data[totop_resource]['.$k.']" value="'.htmlspecialchars($v).'"></td>';
                                $functions.= '<td'.$bgcol.' nowrap>';
                                $fI = t3lib_div::split_fileref($v);
                                if (t3lib_div::inList($this->pObj->textExtensions,$fI['fileext']))      {
-                                       $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>';
+                                       $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="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:editFile', true) . '"></a>';
                                }
                                $functions.= '</td>';
                        }
@@ -300,7 +302,11 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
                                                                t3lib_div::writeFile($path, $edit['file']);
 
                                                                $theOutput.= $this->pObj->doc->spacer(10);
-                                                               $theOutput.= $this->pObj->doc->section('<font color=red>FILE CHANGED</font>', "Resource '".$edit['filename']."' has been updated.", 0, 0, 0, 1);
+                                                               $theOutput.= $this->pObj->doc->section(
+                                                                       '<font color=red>' . $GLOBALS['LANG']->getLL('fileChanged', true) . '</font>',
+                                                                       sprintf($GLOBALS['LANG']->getLL('resourceUpdated', true), $edit['filename']),
+                                                                       0, 0, 0, 1
+                                                               );
 
                                                                        // Clear cache - the file has probably affected the template setup
                                                                        // @TODO: Check if the edited file really had something to do with cached data and prevent this clearing if possible!
@@ -329,7 +335,7 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
                        }
 
                        $theOutput.= $this->pObj->doc->spacer(5);
-                       $theOutput.= $this->pObj->doc->section('Template information:', '<img '.t3lib_iconWorks::skinImg($BACK_PATH, t3lib_iconWorks::getIcon('sys_template', $tplRow)).' align="top" /> <b>'.htmlspecialchars($tplRow['title']).'</b>'.htmlspecialchars(trim($tplRow['sitetitle'])?' - ('.$tplRow['sitetitle'].')':''), 0, 1);
+                       $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('templateInformation', true), '<img '.t3lib_iconWorks::skinImg($BACK_PATH, t3lib_iconWorks::getIcon('sys_template', $tplRow)).' align="top" /> <b>'.htmlspecialchars($tplRow['title']).'</b>'.htmlspecialchars(trim($tplRow['sitetitle'])?' - ('.$tplRow['sitetitle'].')':''), 0, 1);
                        if ($manyTemplatesMenu) {
                                $theOutput.= $this->pObj->doc->section('', $manyTemplatesMenu);
                                $theOutput.= $this->pObj->doc->divider(5);
@@ -349,29 +355,29 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
                                $outCode = '<input type="Text" name="data[title]" value="'.htmlspecialchars($tplRow['title']).'"'.$this->pObj->doc->formWidth().'>';
                                $outCode.= '<input type="Hidden" name="e[title]" value="1">';
                                $theOutput.= $this->pObj->doc->spacer(15);
-                               $theOutput.= $this->pObj->doc->section('Title:', $outCode);
+                               $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('title', true), $outCode);
                        }
                        if ($e['sitetitle'])    {
                                $outCode = '<input type="Text" name="data[sitetitle]" value="'.htmlspecialchars($tplRow['sitetitle']).'"'.$this->pObj->doc->formWidth().'>';
                                $outCode.= '<input type="Hidden" name="e[sitetitle]" value="1">';
                                $theOutput.= $this->pObj->doc->spacer(15);
-                               $theOutput.= $this->pObj->doc->section('Sitetitle:', $outCode);
+                               $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('sitetitle', true), $outCode);
                        }
                        if ($e['description'])  {
                                $outCode = '<textarea name="data[description]" rows="5" class="fixed-font enable-tab"'.$this->pObj->doc->formWidthText(48, '', '').'>'.t3lib_div::formatForTextarea($tplRow['description']).'</textarea>';
                                $outCode.= '<input type="Hidden" name="e[description]" value="1">';
                                $theOutput.= $this->pObj->doc->spacer(15);
-                               $theOutput.= $this->pObj->doc->section('Description:', $outCode);
+                               $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('description', true), $outCode);
                        }
                        if ($e['resources'])    {
                                        // Upload
                                $outCode = '<input type="File" name="resources"'.$this->pObj->doc->formWidth().' size="50">';
                                $outCode.= '<input type="Hidden" name="data[resources]" value="1">';
                                $outCode.= '<input type="Hidden" name="e[resources]" value="1">';
-                               $outCode.= '<BR>Allowed extensions: <b>'.$TCA['sys_template']['columns']['resources']['config']['allowed'].'</b>';
-                               $outCode.= '<BR>Max file size: <b>'.t3lib_div::formatSize($TCA['sys_template']['columns']['resources']['config']['max_size']*1024).'</b>';
+                               $outCode.= '<BR>' . $GLOBALS['LANG']->getLL('allowedExtensions', true) . ' <b>' . $TCA['sys_template']['columns']['resources']['config']['allowed'] . '</b>';
+                               $outCode.= '<BR>' . $GLOBALS['LANG']->getLL('maxFilesize', true) . ' <b>' . t3lib_div::formatSize($TCA['sys_template']['columns']['resources']['config']['max_size']*1024) . '</b>';
                                $theOutput.= $this->pObj->doc->spacer(15);
-                               $theOutput.= $this->pObj->doc->section('Upload resource:', $outCode);
+                               $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('uploadResource', true), $outCode);
 
                                        // New
                                $opt = explode(',', $this->pObj->textExtensions);
@@ -383,27 +389,27 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
                                        <select name="new_resource_ext">'.$optTags.'</select>';
                                $outCode.= '<input type="Hidden" name="data[new_resource]" value="1">';
                                $theOutput.= $this->pObj->doc->spacer(15);
-                               $theOutput.= $this->pObj->doc->section('New text resource (enter name):', $outCode);
+                               $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('newTextResource', true), $outCode);
 
                                        // Make copy
                                $rL = $this->resourceListForCopy($this->pObj->id, $template_uid);
                                if ($rL)        {
                                        $theOutput.= $this->pObj->doc->spacer(20);
-                                       $theOutput.= $this->pObj->doc->section('Make a copy of resource:', $rL);
+                                       $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('copyResource', true), $rL);
                                }
 
                                        // Update resource list
                                $rL = $this->procesResources($tplRow['resources'], 1);
                                if ($rL)        {
                                        $theOutput.= $this->pObj->doc->spacer(20);
-                                       $theOutput.= $this->pObj->doc->section('Update resource list:', $rL);
+                                       $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('updateResourceList', true), $rL);
                                }
                        }
                        if ($e['constants'])    {
                                $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>';
                                $outCode.= '<input type="Hidden" name="e[constants]" value="1">';
                                $theOutput.= $this->pObj->doc->spacer(15);
-                               $theOutput.= $this->pObj->doc->section('Constants:', '');
+                               $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants', true), '');
                                $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
                        }
                        if ($e['file']) {
@@ -413,18 +419,20 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
                                if (@is_file($path) && t3lib_div::inList($this->pObj->textExtensions, $fI['fileext']))  {
                                        if (filesize($path) < $TCA['sys_template']['columns']['resources']['config']['max_size']*1024)  {
                                                $fileContent = t3lib_div::getUrl($path);
-                                               $outCode = 'File: <b>'.$e[file].'</b><BR>';
+                                               $outCode = $GLOBALS['LANG']->getLL('file', true). ' <b>' . $e[file] . '</b><BR>';
                                                $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>';
                                                $outCode.= '<input type="Hidden" name="edit[filename]" value="'.$e[file].'">';
                                                $outCode.= '<input type="Hidden" name="e[file]" value="'.htmlspecialchars($e[file]).'">';
                                                $theOutput.= $this->pObj->doc->spacer(15);
-                                               $theOutput.= $this->pObj->doc->section('Edit Resource:', '');
+                                               $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('editResource', true), '');
                                                $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
                                        } else {
                                                $theOutput.= $this->pObj->doc->spacer(15);
+                                               $fileToBig = sprintf($GLOBALS['LANG']->getLL('filesizeExceeded', true), $TCA['sys_template']['columns']['resources']['config']['max_size']); 
+                                               $filesizeNotAllowed = sprintf($GLOBALS['LANG']->getLL('notAllowed', true), $TCA['sys_template']['columns']['resources']['config']['max_size']);
                                                $theOutput.= $this->pObj->doc->section(
-                                                       '<font color=red>Filesize exceeded '.$TCA['sys_template']['columns']['resources']['config']['max_size'].' Kbytes</font>',
-                                                       'Files larger than '.$TCA['sys_template']['columns']['resources']['config']['max_size'].' KByes are not allowed to be edited.',
+                                                       '<font color=red>' . $fileToBig . '</font>',
+                                                       $filesizeNotAllowed,
                                                        0, 0, 0, 1
                                                );
                                        }
@@ -439,23 +447,47 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
                                                'formName' => 'editForm',
                                                'itemName' => 'data[config]',
                                        );
-                                       $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>';
+                                       $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="' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:tsRef', true) . '"></a>';
                                }
 
                                $outCode.= '<input type="Hidden" name="e[config]" value="1">';
                                $theOutput.= $this->pObj->doc->spacer(15);
-                               $theOutput.= $this->pObj->doc->section('Setup:', '');
+                               $theOutput.= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup', true), '');
                                $theOutput.= $this->pObj->doc->sectionEnd().$outCode;
                        }
 
                                // Processing:
                        $outCode = '';
-                       $outCode.= $this->tableRow('Title:', htmlspecialchars($tplRow['title']), 'title');
-                       $outCode.= $this->tableRow('Sitetitle:', htmlspecialchars($tplRow['sitetitle']), 'sitetitle');
-                       $outCode.= $this->tableRow('Description:', nl2br(htmlspecialchars($tplRow['description'])), 'description');
-                       $outCode.= $this->tableRow('Resources:', $this->procesResources($tplRow['resources']), 'resources');
-                       $outCode.= $this->tableRow('Constants:', '(edit to view, '.(trim($tplRow[constants]) ? count(explode(chr(10), $tplRow[constants])) : 0).' lines)', 'constants');
-                       $outCode.= $this->tableRow('Setup:', '(edit to view, '.(trim($tplRow[config]) ? count(explode(chr(10), $tplRow[config])) : 0).' lines)', 'config');
+                       $outCode.= $this->tableRow(
+                               $GLOBALS['LANG']->getLL('title', true),
+                               htmlspecialchars($tplRow['title']),
+                               'title'
+                       );
+                       $outCode.= $this->tableRow(
+                               $GLOBALS['LANG']->getLL('sitetitle', true),
+                               htmlspecialchars($tplRow['sitetitle']),
+                               'sitetitle'
+                       );
+                       $outCode.= $this->tableRow(
+                               $GLOBALS['LANG']->getLL('description', true),
+                               nl2br(htmlspecialchars($tplRow['description'])),
+                               'description'
+                       );
+                       $outCode.= $this->tableRow(
+                               $GLOBALS['LANG']->getLL('resources', true),
+                               $this->procesResources($tplRow['resources']),
+                               'resources'
+                       );
+                       $outCode.= $this->tableRow(
+                               $GLOBALS['LANG']->getLL('constants', true),
+                               sprintf($GLOBALS['LANG']->getLL('editToView', true), (trim($tplRow[constants]) ? count(explode(chr(10), $tplRow[constants])) : 0)),
+                               'constants'
+                       );
+                       $outCode.= $this->tableRow(
+                               $GLOBALS['LANG']->getLL('setup', true),
+                               sprintf($GLOBALS['LANG']->getLL('editToView', true), (trim($tplRow[config]) ? count(explode(chr(10), $tplRow[config])) : 0)),
+                               'config'
+                       );
                        $outCode = '<table border=0 cellpadding=1 cellspacing=1 width="100%">'.$outCode.'</table>';
 
                        $outCode = '<table border=0 cellpadding=0 cellspacing=0>
@@ -463,7 +495,7 @@ class tx_tstemplateinfo extends t3lib_extobjbase {
                        </table>';
 
                                // Edit all icon:
-                       $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>';
+                       $outCode.= '<BR><a href="#" onClick="' . t3lib_BEfunc::editOnClick(rawurlencode('&createExtension=0') . '&edit[sys_template][' . $tplRow['uid'] . ']=edit', $BACK_PATH, '') . '"><strong>' . $GLOBALS['LANG']->getLL('editTemplateRecord', true) . '</strong></a>';
 
                        $theOutput.= $this->pObj->doc->spacer(25);
                        $theOutput.= $this->pObj->doc->section('', $outCode);
diff --git a/typo3/sysext/tstemplate_info/locallang.xml b/typo3/sysext/tstemplate_info/locallang.xml
new file mode 100644 (file)
index 0000000..1b7f146
--- /dev/null
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<T3locallang>
+       <meta type="array">
+               <description>Labels for template info</description>
+               <type>module</type>
+       </meta>
+       <data type="array">
+               <languageKey index="default" type="array">
+                       <label index="delete">Delete:</label>
+                       <label index="toTop">To top:</label>                    
+                       <label index="fileChanged">File changed</label>
+                       <label index="resourceUpdated">Resource '%s' has been updated.</label>
+                       <label index="templateInformation">Template information:</label>
+                       <label index="title">Title:</label>
+                       <label index="sitetitle">Sitetitle:</label>
+                       <label index="description">Description:</label>
+                       <label index="allowedExtensions">Allowed extensions:</label>
+                       <label index="maxFilesize">Max filesize:</label>
+                       <label index="uploadResource">Upload resource:</label>
+                       <label index="newTextResource">New text resource (enter name):</label>
+                       <label index="copyResource">Make a copy of resource:</label>
+                       <label index="updateResourceList">Update resource list:</label>
+                       <label index="constants">Constants:</label>
+                       <label index="file">File:</label>
+                       <label index="editResource">Edit Resource:</label>
+                       <label index="filesizeExceeded">Filesize exceeded %s KBytes</label>
+                       <label index="notAllowed">Files larger than %s KBytes are not allowed to be edited.</label>
+                       <label index="setup">Setup:</label>
+                       <label index="resources">Resources:</label>
+                       <label index="editToView">(edit to view, %s lines)</label>
+                       <label index="editTemplateRecord">Click here to edit the whole template record.</label>
+               </languageKey>
+       </data>
+</T3locallang>
\ No newline at end of file