[TASK] Cap counter of "Application Overview" 95/46595/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 2 Feb 2016 16:54:20 +0000 (17:54 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Thu, 11 Feb 2016 15:10:07 +0000 (16:10 +0100)
The issue counter of the "Application Overview" menu gets capped if
there are more than 99 issues by appending a "+" sign. This solves a
overflow issue if there are too many "unread" issues, that may occur
e.g. after creating a new admin user.

Change-Id: I285f930c79b1d56384affbbae77a196aaaa5b65e
Resolves: #73084
Releases: master, 7.6
Reviewed-on: https://review.typo3.org/46595
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/backend/Classes/Backend/ToolbarItems/SystemInformationToolbarItem.php
typo3/sysext/backend/Resources/Public/JavaScript/Toolbar/SystemInformationMenu.js

index b1892ae..b12489a 100644 (file)
@@ -86,6 +86,11 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
     protected $iconFactory;
 
     /**
+     * @var int
+     */
+    protected $maximumCountInBadge = 99;
+
+    /**
      * Constructor
      */
     public function __construct()
@@ -294,7 +299,7 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
         }
 
         // increase counter
-        if (isset($message['count'])) {
+        if (isset($message['count']) && $this->totalCount < $this->maximumCountInBadge) {
             $this->totalCount += (int)$message['count'];
         }
 
@@ -346,7 +351,7 @@ class SystemInformationToolbarItem implements ToolbarItemInterface
         $this->standaloneView->assignMultiple(array(
             'installToolUrl' => BackendUtility::getModuleUrl('system_InstallInstall'),
             'messages' => $this->systemMessages,
-            'count' => $this->totalCount,
+            'count' => $this->totalCount > $this->maximumCountInBadge ? $this->maximumCountInBadge . '+' : $this->totalCount,
             'severityBadgeClass' => $this->severityBadgeClass,
             'systemInformation' => $this->systemInformation
         ));
index cb595e5..9db9605 100644 (file)
@@ -81,7 +81,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Icons', 'TYPO3/CMS/Backend/Storage'], funct
                        count = $ul.data('count'),
                        badgeClass = $ul.data('severityclass');
 
-               SystemInformationMenu.elements.$counter.text(count).toggle(count > 0);
+               SystemInformationMenu.elements.$counter.text(count).toggle(parseInt(count) > 0);
                SystemInformationMenu.elements.$counter.removeClass();
 
                if (badgeClass !== '') {