Index: typo3/sysext/sv/reports/tx_sv_report.css =================================================================== --- typo3/sysext/sv/reports/tx_sv_report.css (revision 9382) +++ typo3/sysext/sv/reports/tx_sv_report.css (working copy) @@ -5,10 +5,25 @@ vertical-align: middle; } -.tx_sv_reportlist .bgColor2 td { - text-align: left; - font-weight: bold; - color: #fff; +.tx_sv_reportlist td.typo3-message { + vertical-align: top; +} + +.tx_sv_reportlist td.cell { + background-image: none; + padding: 3px; + border-left: none; + border-right: none; +} + +.tx_sv_reportlist td.first-cell { + background-image: none; + padding: 3px; + border-right: none; +} + +.tx_sv_reportlist td.last-cell { + border-left: none; } .service-header { Index: typo3/sysext/sv/reports/class.tx_sv_reports_serviceslist.php =================================================================== --- typo3/sysext/sv/reports/class.tx_sv_reports_serviceslist.php (revision 9382) +++ typo3/sysext/sv/reports/class.tx_sv_reports_serviceslist.php (working copy) @@ -27,27 +27,28 @@ * This class provides a report displaying a list of all installed services * Code inspired by EXT:dam/lib/class.tx_dam_svlist.php by René Fritz * - * @author François Suter - * @package TYPO3 - * @subpackage sv + * @author François Suter + * @package TYPO3 + * @subpackage sv * * $Id$ */ class tx_sv_reports_ServicesList implements tx_reports_Report { + /** * Back-reference to the calling reports module * - * @var tx_reports_Module $reportObject + * @var tx_reports_Module $reportsModule */ - protected $reportObject; + protected $reportsModule; /** * Constructor for class tx_sv_reports_ServicesList * * @param tx_reports_Module Back-reference to the calling reports module */ - public function __construct(tx_reports_Module $reportObject) { - $this->reportObject = $reportObject; + public function __construct(tx_reports_Module $reportsModule) { + $this->reportsModule = $reportsModule; $GLOBALS['LANG']->includeLLFile('EXT:sv/reports/locallang.xml'); } @@ -60,22 +61,33 @@ $content = ''; // Add custom stylesheet - $this->reportObject->doc->getPageRenderer()->addCssFile(t3lib_extMgm::extRelPath('sv') . 'reports/tx_sv_report.css'); - // Start assembling content - $content .= '

' + $this->reportsModule->doc->getPageRenderer()->addCssFile( + t3lib_extMgm::extRelPath('sv') . 'reports/tx_sv_report.css' + ); + + $content .= $this->renderHelp(); + $content .= $this->reportsModule->doc->spacer(10); + $content .= $this->renderServicesList(); + $content .= $this->reportsModule->doc->spacer(20); + $content .= $this->renderExecutablesSearchPathList(); + + return $content; + } + + /** + * Renders the help comments at the top of the module. + * + * @return string The help content for this module. + */ + protected function renderHelp() { + $help .= '

' . $GLOBALS['LANG']->getLL('report_explanation') . '

'; - $content .= '

' + $help .= '

' . $GLOBALS['LANG']->getLL('externals_explanation') . '

'; - // Get list of installed services - $content .= $this->displayServiceList(); - // Get list of binaries search paths - $content .= $this->reportObject->doc->spacer(10); - $content .= $this->displaySearchPaths(); - - return $content; + return $help; } /** @@ -83,89 +95,150 @@ * * @return string HTML to display */ - protected function displayServiceList() { - $content = ''; + protected function renderServicesList() { + $servicesList = ''; $services = $this->getInstalledServices(); - $content .= ''; + foreach ($services as $serviceType => $installedServices) { - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - foreach ($installedServices as $serviceKey => $serviceInfo) { - $content .= ''; - $cellContent = '

' . $serviceInfo['title'] . ' (' . $serviceInfo['extKey'] . ': ' . $serviceKey . ')

'; - if (!empty($serviceInfo['description'])) { - $cellContent .= '

' . $serviceInfo['description']. '

'; - } - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $class = 'typo3-message message-error'; - $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:no'); - if (t3lib_extmgm::findService($serviceKey, '*')) { - $class = 'typo3-message message-ok'; - $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes'); - } - $content .= ''; - $content .= ''; - } + $servicesList .= $this->renderServiceTypeList($serviceType, $installedServices); } - $content .= '
'; - $content .= '

' . sprintf($GLOBALS['LANG']->getLL('service_type'), $serviceType) . '

'; - $content .= '
' . $GLOBALS['LANG']->getLL('service') . '' . $GLOBALS['LANG']->getLL('priority') . '' . $GLOBALS['LANG']->getLL('quality') . '' . $GLOBALS['LANG']->getLL('subtypes') . '' . $GLOBALS['LANG']->getLL('os') . '' . $GLOBALS['LANG']->getLL('externals') . '' . $GLOBALS['LANG']->getLL('available') . '
' . $cellContent . '' . $serviceInfo['priority'] . '' . $serviceInfo['quality'] . '' . ((empty($serviceInfo['serviceSubTypes'])) ? '-' : implode(', ', $serviceInfo['serviceSubTypes'])) . '' . ((empty($serviceInfo['os'])) ? $GLOBALS['LANG']->getLL('any') : $serviceInfo['os']) . '' . ((empty($serviceInfo['exec'])) ? '-' : $serviceInfo['exec']) . '' . $message . '
'; - return $content; + + return $servicesList; + } + + /** + * Renders the services list for a single service type. + * + * @param string $serviceType the service type to render the installed services list for. + * @return string Service list as HTML for one service type. + */ + protected function renderServiceTypeList($serviceType, $services) { + $header = '

' . sprintf( + $GLOBALS['LANG']->getLL('service_type'), + $serviceType + ) . '

'; + + $serviceList .= ' + + + + + + + + + + '; + + foreach ($services as $serviceKey => $serviceInformation) { + $serviceList .= $this->renderServiceRow($serviceKey, $serviceInformation); + } + + $serviceList .= ' +
' . $GLOBALS['LANG']->getLL('service') . '' . $GLOBALS['LANG']->getLL('priority') . '' . $GLOBALS['LANG']->getLL('quality') . '' . $GLOBALS['LANG']->getLL('subtypes') . '' . $GLOBALS['LANG']->getLL('os') . '' . $GLOBALS['LANG']->getLL('externals') . '' . $GLOBALS['LANG']->getLL('available') . '
+ '; + + return $header . $serviceList; } /** - * This method assembles a list of all defined search paths + * Renders a single service's row. + * + * @param string $sericeKey The service key to access the service. + * @param array $serviceInformation registration information of the service. + * @return string HTML row for the service. + */ + protected function renderServiceRow($serviceKey, $serviceInformation) { + $serviceDescription = ' +

+ ' . $serviceInformation['title'] . ' (' . $serviceInformation['extKey'] . ': ' . $serviceKey . ') +

'; + if (!empty($serviceInformation['description'])) { + $serviceDescription .= '

' . $serviceInformation['description']. '

'; + } + + $sericeSubtypes = empty($serviceInformation['serviceSubTypes']) ? + '-' : + implode(', ', $serviceInformation['serviceSubTypes']); + + $serviceOperatingSystem = empty($serviceInformation['os']) ? + $GLOBALS['LANG']->getLL('any') : + $serviceInformation['os']; + + $serviceRequiredExecutables = empty($serviceInformation['exec']) ? + '-' : + $serviceInformation['exec']; + + $serviceAvailabilityClass = 'typo3-message message-error'; + $serviceAvailable = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:no'); + if (t3lib_extmgm::findService($serviceKey, '*')) { + $serviceAvailabilityClass = 'typo3-message message-ok'; + $serviceAvailable = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes'); + } + + $serviceRow = ' + + ' . $serviceDescription . ' + ' . $serviceInformation['priority'] . ' + ' . $serviceInformation['quality'] . ' + ' . $sericeSubtypes . ' + ' . $serviceOperatingSystem . ' + ' . $serviceRequiredExecutables . ' + ' . $serviceAvailable . ' + '; + + return $serviceRow; + } + + /** + * This method assembles a list of all defined executables search paths * * @return string HTML to display */ - protected function displaySearchPaths() { - $content = '

' . $GLOBALS['LANG']->getLL('search_paths') . '

'; - $searchPaths = t3lib_exec::getPaths(true); + protected function renderExecutablesSearchPathList() { + $searchPaths = t3lib_exec::getPaths(TRUE); + + $content = '

' . $GLOBALS['LANG']->getLL('search_paths') . '

'; + if (count($searchPaths) == 0) { $content .= '

' . $GLOBALS['LANG']->getLL('no_search_paths') . '

'; } else { - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; - $content .= ''; + $content .= ' +
' . $GLOBALS['LANG']->getLL('path') . '' . $GLOBALS['LANG']->getLL('valid') . '
+ + + + + + + '; + foreach ($searchPaths as $path => $isValid) { - $content .= ''; - $content .= ''; - $class = 'typo3-message message-error'; - $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:no'); + $pathAccessibleClass = 'typo3-message message-error'; + $pathAccessible = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:no'); if ($isValid) { - $class = 'typo3-message message-ok'; - $message = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes'); + $pathAccessibleClass = 'typo3-message message-ok'; + $pathAccessible = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_common.xml:yes'); } - $content .= ''; - $content .= ''; + + $content .= ' + + + + '; } - $content .= ''; - $content .= '
' . $GLOBALS['LANG']->getLL('path') . '' . $GLOBALS['LANG']->getLL('valid') . '
' . t3lib_div::fixWindowsFilePath($path) . '' . $message . '
' . t3lib_div::fixWindowsFilePath($path) . '' . $pathAccessible . '
'; + + $content .= ' + + '; } + return $content; } /** * This method filters the $T3_SERVICES global array to return a relevant, - * ordered list of installed services + * ordered list of installed services. * * Every installed service appears twice in $T3_SERVICES: once as a service key * for a given service type, and once a service type all by itself @@ -179,28 +252,30 @@ protected function getInstalledServices() { $filteredServices = array(); - // Loop on all installed services foreach ($GLOBALS['T3_SERVICES'] as $serviceType => $serviceList) { // If the (first) key of the service list is not the same as the service type, // it's a "true" service type. Keep it and sort it. if (key($serviceList) !== $serviceType) { - uasort($serviceList, array('tx_sv_reports_ServicesList', 'sortServices')); + uasort($serviceList, array($this, 'sortServices')); $filteredServices[$serviceType] = $serviceList; } } + return $filteredServices; } /** - * Utility method used to sort services according to their priority and quality + * Utility method used to sort services according to their priority and + * quality. * * @param array First service to compare * @param array Second service to compare * * @return integer 1, 0 or -1 if a is smaller, equal or greater than b, respectively */ - public function sortServices(array $a, array $b) { + protected function sortServices(array $a, array $b) { $result = 0; + // If priorities are the same, test quality if ($a['priority'] == $b['priority']) { if ($a['quality'] != $b['quality']) { @@ -213,6 +288,7 @@ // thus it must be marked as smaller $result = ($a['priority'] > $b['priority']) ? -1 : 1; } + return $result; } }