mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°8673 - Avoid server overload when user access news page with a lot of unread news (#816)
This commit is contained in:
@@ -33,6 +33,10 @@ class UIContentBlock extends UIBlock implements iUIContentBlock
|
||||
protected $aDeferredBlocks;
|
||||
/** @var bool If set to true, the content block will have a surrounding <div> no matter its options / CSS classes / ... */
|
||||
protected $bHasForcedDiv;
|
||||
/** @var bool if set to true, the icon will be lazy loaded
|
||||
* @since 3.2.3
|
||||
*/
|
||||
protected bool $bHasLazyLoadIcon;
|
||||
|
||||
/**
|
||||
* UIContentBlock constructor.
|
||||
@@ -48,6 +52,7 @@ class UIContentBlock extends UIBlock implements iUIContentBlock
|
||||
$this->aSubBlocks = [];
|
||||
$this->aDeferredBlocks = [];
|
||||
$this->bHasForcedDiv = false;
|
||||
$this->bHasLazyLoadIcon = false;
|
||||
$this->SetCSSClasses($aContainerClasses);
|
||||
}
|
||||
|
||||
@@ -220,4 +225,24 @@ class UIContentBlock extends UIBlock implements iUIContentBlock
|
||||
$this->bHasForcedDiv = $bHasForcedDiv;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see static::$bHasLazyLoadIcon
|
||||
* @return bool
|
||||
*/
|
||||
public function HasLazyLoadIcon(): bool
|
||||
{
|
||||
return $this->bHasLazyLoadIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see static::$bHasLazyLoadIcon
|
||||
* @param bool $bLazyLoadIcon
|
||||
* @return $this
|
||||
*/
|
||||
public function SetHasLazyLoadIcon(bool $bLazyLoadIcon)
|
||||
{
|
||||
$this->bHasLazyLoadIcon = $bLazyLoadIcon;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,11 @@ use Combodo\iTop\Application\Branding;
|
||||
use Combodo\iTop\Application\TwigBase\Controller\Controller;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Button\Button;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\ButtonGroup\ButtonGroupUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\InputUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\Toggler;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Panel\Panel;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Panel\PanelUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu;
|
||||
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem\PopoverMenuItemFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Title\TitleUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\Object\ObjectSummary;
|
||||
@@ -29,13 +26,10 @@ use CoreException;
|
||||
use DBObjectSearch;
|
||||
use DBObjectSet;
|
||||
use Dict;
|
||||
use JSPopupMenuItem;
|
||||
use MetaModel;
|
||||
use SecurityException;
|
||||
use URLPopupMenuItem;
|
||||
use UserRights;
|
||||
use utils;
|
||||
use appUserPreferences;
|
||||
|
||||
/**
|
||||
* Class iTopNewsroomController
|
||||
@@ -376,6 +370,7 @@ JS
|
||||
$sReadColor = $oEvent->Get('read') === 'no' ? 'ibo-notifications--view-all--item--unread' : 'ibo-notifications--view-all--item--read';
|
||||
$sReadLabel = $oEvent->Get('read') === 'no' ? Dict::S('UI:Newsroom:iTopNotification:ViewAllPage:Unread:Label') : Dict::S('UI:Newsroom:iTopNotification:ViewAllPage:Read:Label');
|
||||
$oEventBlock = new ObjectSummary($oEvent);
|
||||
$oEventBlock->SetHasLazyLoadIcon(true);
|
||||
$oEventBlock->SetCSSColorClass($sReadColor);
|
||||
$oEventBlock->SetSubTitle($sReadLabel);
|
||||
$oEventBlock->SetClassLabel('');
|
||||
|
||||
Reference in New Issue
Block a user