[FEATURE] Link errors in Template Object Browser to Template Analyzer
authorIngo Renner <ingo@typo3.org>
Sun, 19 Feb 2012 18:57:54 +0000 (19:57 +0100)
committerTolleiv Nietsch <info@tolleiv.de>
Mon, 20 Feb 2012 18:40:06 +0000 (19:40 +0100)
The Template Object Browser displays error messages about issues the
template parser found when parsing the TypoScript configuration. These
error messages include the line number where the error occured.

However, these numbers do not correspond to line numbers in TypoScript
records or files. The Template Ananlyzer however provides the "correct"
line numbers. A link to the Template Analyzer and the line number in
the overall TypoScript configuration helps to easily find the error.

Change-Id: If4773dce961aae7888638e694c87755a719a016d
Resolves: #34099
Releases: 4.7
Reviewed-on: http://review.typo3.org/9112
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Georg Ringer
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
t3lib/class.t3lib_tsparser_ext.php
typo3/sysext/tstemplate_objbrowser/class.tx_tstemplateobjbrowser.php
typo3/sysext/tstemplate_objbrowser/locallang.xlf

index 7e60483..8216b0f 100644 (file)
@@ -679,12 +679,12 @@ class t3lib_tsparser_ext extends t3lib_TStemplate {
        /**
         * [Describe function...]
         *
-        * @param       [type]          $ln: ...
+        * @param integer $lineNumber Line Number
         * @param       [type]          $str: ...
-        * @return      [type]          ...
+        * @return string
         */
-       function ext_lnBreakPointWrap($ln, $str) {
-               return '<a href="#" onClick="return brPoint(' . $ln . ',' . ($this->ext_lineNumberOffset_mode == "setup" ? 1 : 0) . ');">' . $str . '</a>';
+       function ext_lnBreakPointWrap($lineNumber, $str) {
+               return '<a href="#" id="line-' . $lineNumber . '" onClick="return brPoint(' . $lineNumber . ',' . ($this->ext_lineNumberOffset_mode == "setup" ? 1 : 0) . ');">' . $str . '</a>';
        }
 
        /**
index 65d63b2..21eb54a 100644 (file)
@@ -458,8 +458,17 @@ class tx_tstemplateobjbrowser extends t3lib_extobjbase {
                        $pEkey = ($bType=="setup"?"config":"constants");
                        if (count($tmpl->parserErrors[$pEkey])) {
                                $errMsg=array();
+                               $templateAnalyzerInstalled = t3lib_extMgm::isLoaded('tstemplate_analyzer');
+
                                foreach ($tmpl->parserErrors[$pEkey] as $inf) {
-                                       $errMsg[]=($inf[1]).": &nbsp; &nbsp;".$inf[0];
+                                       $errorLink = '';
+                                       if ($templateAnalyzerInstalled) {
+                                               $errorLink = ' <a href="index.php?id=' . $this->pObj->id . '&SET[function]=tx_tstemplateanalyzer&template=all&SET[ts_analyzer_checkLinenum]=1#line-' . $inf[2] . '">'
+                                                       . $GLOBALS['LANG']->getLL('errorShowDetails')
+                                                       . '</a>';
+                                       }
+
+                                       $errMsg[] = ($inf[1]) . ": &nbsp; &nbsp;" . $inf[0] . $errorLink;
                                }
                                $theOutput .= $this->pObj->doc->spacer(10);
 
index d1d8e87..d78b454 100644 (file)
@@ -93,6 +93,9 @@
                        <trans-unit id="errorsWarnings" xml:space="preserve">
                                <source>Errors and warnings</source>
                        </trans-unit>
+                       <trans-unit id="errorShowDetails" xml:space="preserve">
+                               <source>Show details</source>
+                       </trans-unit>
                        <trans-unit id="removeKey" xml:space="preserve">
                                <source>Remove key from OL</source>
                        </trans-unit>