Fixed bug #12464: Reports: Sorting of status collections wrongly relied on localized...
authorFrancois Suter <francois.suter@typo3.org>
Sat, 14 Nov 2009 11:38:33 +0000 (11:38 +0000)
committerFrancois Suter <francois.suter@typo3.org>
Sat, 14 Nov 2009 11:38:33 +0000 (11:38 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@6415 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/sysext/install/ext_tables.php
typo3/sysext/reports/reports/class.tx_reports_reports_status.php
typo3/sysext/reports/reports/locallang.xml

index d480186..dc9c680 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-11-14  Francois Suter  <francois@typo3.org>
+
+       * Fixed bug #12464: Reports: Sorting of status collections wrongly relied on localized strings
+
 2009-11-14  Tobias Liebig <mail_typo3@etobi.de>
 
        * Fixed bug #12522: t3editor/codecompletion: tsref properties get listed twice when they are defined
index e6c46ff..64412a2 100755 (executable)
@@ -4,7 +4,7 @@ if (!defined ('TYPO3_MODE'))    die ('Access denied.');
 if (TYPO3_MODE=='BE') {
        t3lib_extMgm::addModule('tools', 'install', '', t3lib_extMgm::extPath($_EXTKEY) . 'mod/');
 
-       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['_install'] = 'tx_install_report_InstallStatus';
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['reports']['tx_reports']['status']['providers']['typo3'] = 'tx_install_report_InstallStatus';
 }
 
 ?>
\ No newline at end of file
index 7dc3730..1f8abbc 100644 (file)
@@ -53,14 +53,7 @@ class tx_reports_reports_Status implements tx_reports_Report {
                $content = '';
 
                foreach ($this->statusProviders as $statusProviderId => $statusProvider) {
-                       if (strcmp(substr($statusProviderId, 0, 4), 'LLL:')) {
-                               $providerLabel = $GLOBALS['LANG']->getLL('status_' . $statusProviderId);
-                       } else {
-                                       // label from extension
-                               $providerLabel = $GLOBALS['LANG']->sL($statusProviderId);
-                       }
-                       $provider = $providerLabel ? $providerLabel : $statusProviderId;
-                       $status[$provider] = $statusProvider->getStatus();
+                       $status[$statusProviderId] = $statusProvider->getStatus();
                }
 
                $content .= '<p class="help">'
@@ -150,28 +143,47 @@ class tx_reports_reports_Status implements tx_reports_Report {
        }
 
        /**
-        * sorts the status providers (alphabetically and adds "_install" provider at the beginning)
+        * Sorts the status providers (alphabetically and puts primary status providers at the beginning)
         *
         * @param   array   A collection of statuses (with providers)
         * @return  array   The collection of statuses sorted by provider (beginning with provider "_install")
         */
        protected function sortStatusProviders(array $statusCollection) {
-               $systemStatus = array(
-                       'TYPO3 System'  => $statusCollection['Installation'],
-                       'System'        => $statusCollection['System'],
-                       'Security'      => $statusCollection['security'],
-                       'Configuration' => $statusCollection['configuration'],
+                       // Extract the primary status collections, i.e. the status groups
+                       // that must appear on top of the status report
+                       // Change their keys to localized collection titles
+               $primaryStatuses = array(
+                       $GLOBALS['LANG']->getLL('status_typo3')         => $statusCollection['typo3'],
+                       $GLOBALS['LANG']->getLL('status_system')        => $statusCollection['system'],
+                       $GLOBALS['LANG']->getLL('status_security')      => $statusCollection['security'],
+                       $GLOBALS['LANG']->getLL('status_configuration') => $statusCollection['configuration']
                );
                unset(
-                       $statusCollection['Installation'],
-                       $statusCollection['System'],
+                       $statusCollection['typo3'],
+                       $statusCollection['system'],
                        $statusCollection['security'],
                        $statusCollection['configuration']
                );
-               ksort($statusCollection);
-               $statusCollection = array_merge($systemStatus, $statusCollection);
+                       // Assemble list of secondary status collections with left-over collections
+                       // Change their keys using localized labels if available
+               $secondaryStatuses = array();
+               foreach ($statusCollection as $statusProviderId => $collection) {
+                       $label = '';
+                       if (strpos($statusProviderId, 'LLL:') === 0) {
+                                       // Label provided by extension
+                               $label = $GLOBALS['LANG']->sL($statusProviderId);
+                       } else {
+                                       // Generic label
+                               $label = $GLOBALS['LANG']->getLL('status_' . $statusProviderId);
+                       }
+                       $providerLabel = (empty($label)) ? $statusProviderId : $label;
+                       $secondaryStatuses[$providerLabel] = $collection;
+               }
+                       // Sort the secondary status collections alphabetically
+               ksort($secondaryStatuses);
+               $orderedStatusCollection = array_merge($primaryStatuses, $secondaryStatuses);
 
-               return $statusCollection;
+               return $orderedStatusCollection;
        }
 
        /**
index 17d9484..52ac107 100644 (file)
                        <label index="status_connectionFailed">Connection Failed</label>
                        <label index="status_updateComplete">Update Complete</label>
                        <label index="status_updateIncomplete">Update Incomplete</label>
-                       <label index="status__install">Installation</label>
+                       <label index="status_typo3">TYPO3 System</label>
                        <label index="status_system">System</label>
+                       <label index="status_security">Security</label>
+                       <label index="status_configuration">Configuration</label>
                </languageKey>
        </data>
 </T3locallang>
\ No newline at end of file