[TASK] Cleanup of Template module 75/33175/3
authorGeorg Ringer <georg.ringer@gmail.com>
Mon, 6 Oct 2014 19:10:55 +0000 (21:10 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 7 Oct 2014 18:15:08 +0000 (20:15 +0200)
* Remove rendering with tables in "Template Analyzer"
* Remove button "Set Conditions" in "TypoScript Object Browser"
  if no conditions are available.

Resolves: #62063
Releases: master
Change-Id: I326c1bdacfb52883d2872002c09eb826f4f6703e
Reviewed-on: http://review.typo3.org/33175
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/tstemplate/Classes/Controller/TemplateAnalyzerModuleFunctionController.php
typo3/sysext/tstemplate/Classes/Controller/TypoScriptTemplateObjectBrowserModuleFunctionController.php

index 5184ec3..52217af 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Tstemplate\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+
 /**
  * TypoScript template analyzer
  *
@@ -130,99 +132,83 @@ class TemplateAnalyzerModuleFunctionController extends \TYPO3\CMS\Backend\Module
                        'id' => $GLOBALS['SOBE']->id,
                        'template' => 'all'
                );
-               $aHref = \TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('web_ts', $urlParameters);
+               $aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
                $completeLink = '<p><a href="' . htmlspecialchars($aHref) . '" class="t3-button">' . $GLOBALS['LANG']->getLL('viewCompleteTS', TRUE) . '</a></p>';
                $theOutput .= $this->pObj->doc->spacer(5);
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('completeTS', TRUE), $completeLink, 0, 1);
                $theOutput .= $this->pObj->doc->spacer(15);
                // Output options
                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions', TRUE), '', FALSE, TRUE);
-               $addParams = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') ? '&template=' . \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') : '';
+
+               $template = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template');
+               $addParams = $template ? '&template=' . $template : '';
                $theOutput .= '<div class="tst-analyzer-options">' .
                        '<div class="checkbox"><label for="checkTs_analyzer_checkLinenum">' .
-                               \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkLinenum]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], '', $addParams, 'id="checkTs_analyzer_checkLinenum"') .
+                               BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkLinenum]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], '', $addParams, 'id="checkTs_analyzer_checkLinenum"') .
                                $GLOBALS['LANG']->getLL('lineNumbers', TRUE) .
                        '</label></div>' .
                        '<div class="checkbox"><label for="checkTs_analyzer_checkSyntax">' .
-                               \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkSyntax]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], '', $addParams, 'id="checkTs_analyzer_checkSyntax"') .
+                               BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkSyntax]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], '', $addParams, 'id="checkTs_analyzer_checkSyntax"') .
                                $GLOBALS['LANG']->getLL('syntaxHighlight', TRUE) . '</label> ' .
                        '</label></div>';
                if (!$this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax']) {
                        $theOutput .=
                                '<div class="checkbox"><label for="checkTs_analyzer_checkComments">' .
-                                       \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkComments]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], '', $addParams, 'id="checkTs_analyzer_checkComments"') .
+                                       BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkComments]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], '', $addParams, 'id="checkTs_analyzer_checkComments"') .
                                        $GLOBALS['LANG']->getLL('comments', TRUE) .
                                '</label></div>' .
                                '<div class="checkbox"><label for="checkTs_analyzer_checkCrop">' .
-                                       \TYPO3\CMS\Backend\Utility\BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkCrop]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], '', $addParams, 'id="checkTs_analyzer_checkCrop"') .
+                                       BackendUtility::getFuncCheck($this->pObj->id, 'SET[ts_analyzer_checkCrop]', $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], '', $addParams, 'id="checkTs_analyzer_checkCrop"') .
                                        $GLOBALS['LANG']->getLL('cropLines', TRUE) .
                                '</label></div>';
                }
                $theOutput .=  '</div>';
                $theOutput .= $this->pObj->doc->spacer(25);
-               // Output Constants
-               if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template')) {
+
+               if ($template) {
+                       // Output Constants
                        $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('constants', TRUE), '', 0, 1);
                        $theOutput .= $this->pObj->doc->sectionEnd();
-                       $theOutput .= '
-                               <table class="t3-table ts-typoscript">
-                       ';
-                       // Don't know why -2 and not 0... :-) But works.
+
                        $GLOBALS['tmpl']->ext_lineNumberOffset = 0;
                        $GLOBALS['tmpl']->ext_lineNumberOffset_mode = 'const';
                        foreach ($GLOBALS['tmpl']->constants as $key => $val) {
                                $currentTemplateId = $GLOBALS['tmpl']->hierarchyInfo[$key]['templateID'];
-                               if ($currentTemplateId == \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') || \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') == 'all') {
+                               if ($currentTemplateId == $template || $template === 'all') {
                                        $theOutput .= '
-                                               <tr>
-                                                       <td><strong>' . htmlspecialchars($GLOBALS['tmpl']->hierarchyInfo[$key]['title']) . '</strong></td>
-                                               </tr>
-                                               <tr>
-                                                       <td>
-                                                               <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td nowrap="nowrap">' . $GLOBALS['tmpl']->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], 0) . '</td></tr></table>
-                                                       </td>
-                                               </tr>
+                                               <h3>' . htmlspecialchars($GLOBALS['tmpl']->hierarchyInfo[$key]['title']) . '</h3>
+                                               <div class="nowrap">' .
+                                                       $GLOBALS['tmpl']->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], 0) .
+                                               '</div>
                                        ';
-                                       if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') != 'all') {
+                                       if ($template !== 'all') {
                                                break;
                                        }
                                }
                                $GLOBALS['tmpl']->ext_lineNumberOffset += count(explode(LF, $val)) + 1;
                        }
-                       $theOutput .= '
-                               </table>
-                       ';
-               }
-               // Output setup
-               if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template')) {
+
+                       // Output Setup
                        $theOutput .= $this->pObj->doc->spacer(15);
                        $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('setup', TRUE), '', 0, 1);
                        $theOutput .= $this->pObj->doc->sectionEnd();
-                       $theOutput .= '
-                               <table class="t3-table ts-typoscript">
-                       ';
                        $GLOBALS['tmpl']->ext_lineNumberOffset = 0;
                        $GLOBALS['tmpl']->ext_lineNumberOffset_mode = 'setup';
                        foreach ($GLOBALS['tmpl']->config as $key => $val) {
                                $currentTemplateId = $GLOBALS['tmpl']->hierarchyInfo[$key]['templateID'];
-                               if ($currentTemplateId == \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') || \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') == 'all') {
+                               if ($currentTemplateId == $template || $template == 'all') {
                                        $theOutput .= '
-                                               <tr>
-                                                       <td><strong>' . htmlspecialchars($GLOBALS['tmpl']->hierarchyInfo[$key]['title']) . '</strong></td></tr>
-                                               <tr>
-                                                       <td><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td nowrap="nowrap">' . $GLOBALS['tmpl']->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], 0) . '</td></tr></table>
-                                                       </td>
-                                               </tr>
+                                               <h3>' . htmlspecialchars($GLOBALS['tmpl']->hierarchyInfo[$key]['title']) . '</h3>
+                                               <div class="nowrap">' .
+                                                       $GLOBALS['tmpl']->ext_outputTS(array($val), $this->pObj->MOD_SETTINGS['ts_analyzer_checkLinenum'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkComments'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkCrop'], $this->pObj->MOD_SETTINGS['ts_analyzer_checkSyntax'], 0) .
+                                               '</div>
                                        ';
-                                       if (\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('template') != 'all') {
+                                       if ($template !== 'all') {
                                                break;
                                        }
                                }
                                $GLOBALS['tmpl']->ext_lineNumberOffset += count(explode(LF, $val)) + 1;
                        }
-                       $theOutput .= '
-                               </table>
-                       ';
                }
                return $theOutput;
        }
index 055e4d6..8f8fa91 100644 (file)
@@ -439,7 +439,7 @@ class TypoScriptTemplateObjectBrowserModuleFunctionController extends \TYPO3\CMS
                        $menu .= '</div>';
                        $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('displayOptions'), '<nobr>' . $menu . '</nobr>', 0, 1);
                        // Conditions:
-                       if (is_array($tmpl->sections)) {
+                       if (is_array($tmpl->sections) && !empty($tmpl->sections)) {
                                $theOutput .= $this->pObj->doc->section($GLOBALS['LANG']->getLL('conditions'), '', 0, 1);
                                $out = '';
                                foreach ($tmpl->sections as $key => $val) {