N°3573 - Migrate backoffice pages to new UIBlock system : System Information

This commit is contained in:
Eric
2021-04-09 09:45:23 +02:00
parent deed948f54
commit d594f28ed9
9 changed files with 133 additions and 63 deletions

View File

@@ -35,7 +35,7 @@ class Alert extends UIContentBlock
// Overloaded constants
public const BLOCK_CODE = 'ibo-alert';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/alert/layout';
public const DEFAULT_JS_TEMPLATE_REL_PATH = 'base/components/alert/layout';
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'base/components/alert/layout';
public const DEFAULT_JS_FILES_REL_PATH = [
'js/components/alert.js',
];

View File

@@ -42,12 +42,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
* Make a basis Panel component
*
* @param string $sTitle
* @param string|null $sSubTitle
*
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
*/
public static function MakeNeutral(string $sTitle)
public static function MakeNeutral(string $sTitle, string $sSubTitle = null)
{
$oPanel = new Panel($sTitle);
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColor(Panel::ENUM_COLOR_NEUTRAL);
return $oPanel;
@@ -57,12 +61,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
* Make a Panel component for informational messages
*
* @param string $sTitle
* @param string|null $sSubTitle
*
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
*/
public static function MakeForInformation(string $sTitle)
public static function MakeForInformation(string $sTitle, string $sSubTitle = null)
{
$oPanel = new Panel($sTitle);
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColor(Panel::ENUM_COLOR_INFORMATION);
return $oPanel;
@@ -72,12 +80,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
* Make a Panel component for successful messages
*
* @param string $sTitle
* @param string|null $sSubTitle
*
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
*/
public static function MakeForSuccess(string $sTitle)
public static function MakeForSuccess(string $sTitle, string $sSubTitle = null)
{
$oPanel = new Panel($sTitle);
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColor(Panel::ENUM_COLOR_SUCCESS);
return $oPanel;
@@ -87,12 +99,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
* Make a Panel component for warning messages
*
* @param string $sTitle
* @param string|null $sSubTitle
*
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
*/
public static function MakeForWarning(string $sTitle)
public static function MakeForWarning(string $sTitle, string $sSubTitle = null)
{
$oPanel = new Panel($sTitle);
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColor(Panel::ENUM_COLOR_WARNING);
return $oPanel;
@@ -102,12 +118,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
* Make a Panel component for danger messages
*
* @param string $sTitle
* @param string|null $sSubTitle
*
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
*/
public static function MakeForDanger(string $sTitle)
public static function MakeForDanger(string $sTitle, string $sSubTitle = null)
{
$oPanel = new Panel($sTitle);
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColor(Panel::ENUM_COLOR_DANGER);
return $oPanel;
@@ -117,12 +137,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
* Make a Panel component for failure messages
*
* @param string $sTitle
* @param string|null $sSubTitle
*
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
*/
public static function MakeForFailure(string $sTitle)
public static function MakeForFailure(string $sTitle, string $sSubTitle = null)
{
$oPanel = new Panel($sTitle);
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColor(Panel::ENUM_COLOR_FAILURE);
return $oPanel;
@@ -132,12 +156,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
* Make a Panel component with primary color scheme
*
* @param string $sTitle
* @param string|null $sSubTitle
*
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
*/
public static function MakeWithBrandingPrimaryColor(string $sTitle)
public static function MakeWithBrandingPrimaryColor(string $sTitle, string $sSubTitle = null)
{
$oPanel = new Panel($sTitle);
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColor(Panel::ENUM_COLOR_PRIMARY);
return $oPanel;
@@ -147,12 +175,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
* Make a Panel component with secondary color scheme
*
* @param string $sTitle
* @param string|null $sSubTitle
*
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
*/
public static function MakeWithBrandingSecondaryColor(string $sTitle)
public static function MakeWithBrandingSecondaryColor(string $sTitle, string $sSubTitle = null)
{
$oPanel = new Panel($sTitle);
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColor(Panel::ENUM_COLOR_SECONDARY);
return $oPanel;
@@ -163,12 +195,16 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
*
* @param string $sClass Class of the object the panel is for
* @param string $sTitle
* @param string|null $sSubTitle
*
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
*/
public static function MakeForClass(string $sClass, string $sTitle)
public static function MakeForClass(string $sClass, string $sTitle, string $sSubTitle = null)
{
$oPanel = new Panel($sTitle);
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColorFromClass($sClass);
return $oPanel;

View File

@@ -8,7 +8,7 @@ namespace Combodo\iTop\Application\UI\Base\Layout\MultiColumn;
use Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column\Column;
use Combodo\iTop\Application\UI\Base\UIBlock;
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
/**
* Class MultiColumn
@@ -17,20 +17,18 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
* @internal
* @since 3.0.0
*/
class MultiColumn extends UIBlock {
class MultiColumn extends UIContentBlock
{
// Overloaded constants
public const BLOCK_CODE = 'ibo-multi-column';
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/layouts/multi-column/layout';
/** @var \Combodo\iTop\Application\UI\Base\Layout\MultiColumn\Column\Column[] */
protected $aColumns;
/**
* @inheritDoc
*/
public function __construct(?string $sId = null) {
public function __construct(?string $sId = null)
{
parent::__construct($sId);
$this->aColumns = [];
}
/**
@@ -38,32 +36,10 @@ class MultiColumn extends UIBlock {
*
* @return $this
*/
public function AddColumn(Column $oColumn) {
$this->aColumns[] = $oColumn;
public function AddColumn(Column $oColumn)
{
$this->AddSubBlock($oColumn);
return $this;
}
/**
* Remove the column of $iIndex index.
* Note that if the column does not exists, it proceeds silently.
*
* @param int $iIndex
*
* @return $this
*/
public function RemoveColumn(int $iIndex) {
if (isset($this->aColumns[$iIndex])) {
unset($this->aColumns[$iIndex]);
}
return $this;
}
/**
* @inheritDoc
*/
public function GetSubBlocks() {
return $this->aColumns;
}
}