Rename Panel / Alert / Button color constants for something more accurate

Done now before their as used too widely. We are most likely to allow dev. to use custom colors soon, so we want to avoid confusing / renaming then. (iTop extensions have been verified, none had to be migrated)
This commit is contained in:
Molkobain
2021-09-26 01:26:09 +02:00
parent 7476b6d059
commit 21545da062
15 changed files with 140 additions and 141 deletions

View File

@@ -2783,7 +2783,7 @@ JS
case UR_ALLOWED_YES:
$oButton = ButtonUIBlockFactory::MakeForPrimaryAction($aStimuli[$sStimulusCode]->GetLabel(), 'next_action', $sStimulusCode, true);
$oButton->AddCSSClass('action');
$oButton->SetColor(Button::ENUM_COLOR_NEUTRAL);
$oButton->SetColor(Button::ENUM_COLOR_SCHEME_NEUTRAL);
$oToolbarButtons->AddSubBlock($oButton);
break;

View File

@@ -1447,7 +1447,7 @@ class DisplayableGraph extends SimpleGraph
$sSftShort = Dict::S('UI:ElementsDisplayed');
$sSearchToggle = Dict::S('UI:Search:Toggle');
$oP->add("<div class=\"not-printable\">\n");
$oUiSearchBlock = new Panel($sSftShort, [],Panel::ENUM_COLOR_CYAN, 'ds_flash');
$oUiSearchBlock = new Panel($sSftShort, [],Panel::ENUM_COLOR_SCHEME_CYAN, 'ds_flash');
$oUiSearchBlock->SetCSSClasses(["ibo-search-form-panel", "display_block"]);
$oUiSearchBlock->SetIsCollapsible(true);
$oUiHtmlBlock = new Combodo\iTop\Application\UI\Base\Component\Html\Html(

View File

@@ -366,7 +366,7 @@ JS
"btn_remove_".$iAttId);
$oButton->AddCSSClass('btn_hidden')
->SetOnClickJsCode("RemoveAttachment(".$iAttId.");")
->SetColor(Button::ENUM_COLOR_DESTRUCTIVE);
->SetColor(Button::ENUM_COLOR_SCHEME_DESTRUCTIVE);
return $oButton;
}

View File

@@ -392,7 +392,7 @@ try
continue;
}
$oAuditCategoryPanelBlock->SetColorFromSemantic($sClass);
$oAuditCategoryPanelBlock->SetColorFromColorSemantic($sClass);
$oAuditCategoryPanelBlock->AddCSSClass('ibo-audit--audit-category--panel');
$aData = [];
foreach($aResults as $aRow)

View File

@@ -42,43 +42,43 @@ class Alert extends UIContentBlock
];
// Specific constants
/** @var string ENUM_COLOR_PRIMARY */
public const ENUM_COLOR_PRIMARY = 'primary';
/** @var string ENUM_COLOR_SECONDARY */
public const ENUM_COLOR_SECONDARY = 'secondary';
/** @var string ENUM_COLOR_SCHEME_PRIMARY */
public const ENUM_COLOR_SCHEME_PRIMARY = 'primary';
/** @var string ENUM_COLOR_SCHEME_SECONDARY */
public const ENUM_COLOR_SCHEME_SECONDARY = 'secondary';
/** @var string ENUM_COLOR_NEUTRAL */
public const ENUM_COLOR_NEUTRAL = 'neutral';
/** @var string ENUM_COLOR_INFORMATION */
public const ENUM_COLOR_INFORMATION = 'information';
/** @var string ENUM_COLOR_SUCCESS */
public const ENUM_COLOR_SUCCESS = 'success';
/** @var string ENUM_COLOR_FAILURE */
public const ENUM_COLOR_FAILURE = 'failure';
/** @var string ENUM_COLOR_WARNING */
public const ENUM_COLOR_WARNING = 'warning';
/** @var string ENUM_COLOR_DANGER */
public const ENUM_COLOR_DANGER = 'danger';
/** @var string ENUM_COLOR_SCHEME_NEUTRAL */
public const ENUM_COLOR_SCHEME_NEUTRAL = 'neutral';
/** @var string ENUM_COLOR_SCHEME_INFORMATION */
public const ENUM_COLOR_SCHEME_INFORMATION = 'information';
/** @var string ENUM_COLOR_SCHEME_SUCCESS */
public const ENUM_COLOR_SCHEME_SUCCESS = 'success';
/** @var string ENUM_COLOR_SCHEME_FAILURE */
public const ENUM_COLOR_SCHEME_FAILURE = 'failure';
/** @var string ENUM_COLOR_SCHEME_WARNING */
public const ENUM_COLOR_SCHEME_WARNING = 'warning';
/** @var string ENUM_COLOR_SCHEME_DANGER */
public const ENUM_COLOR_SCHEME_DANGER = 'danger';
/** @var string ENUM_COLOR_GREY */
public const ENUM_COLOR_GREY = 'grey';
/** @var string ENUM_COLOR_BLUEGREY */
public const ENUM_COLOR_BLUEGREY = 'blue-grey';
/** @var string ENUM_COLOR_BLUE */
public const ENUM_COLOR_BLUE = 'blue';
/** @var string ENUM_COLOR_CYAN */
public const ENUM_COLOR_CYAN = 'cyan';
/** @var string ENUM_COLOR_GREEN */
public const ENUM_COLOR_GREEN = 'green';
/** @var string ENUM_COLOR_ORANGE */
public const ENUM_COLOR_ORANGE = 'orange';
/** @var string ENUM_COLOR_RED */
public const ENUM_COLOR_RED = 'red';
/** @var string ENUM_COLOR_PINK */
public const ENUM_COLOR_PINK = 'pink';
/** @var string ENUM_COLOR_SCHEME_GREY */
public const ENUM_COLOR_SCHEME_GREY = 'grey';
/** @var string ENUM_COLOR_SCHEME_BLUEGREY */
public const ENUM_COLOR_SCHEME_BLUEGREY = 'blue-grey';
/** @var string ENUM_COLOR_SCHEME_BLUE */
public const ENUM_COLOR_SCHEME_BLUE = 'blue';
/** @var string ENUM_COLOR_SCHEME_CYAN */
public const ENUM_COLOR_SCHEME_CYAN = 'cyan';
/** @var string ENUM_COLOR_SCHEME_GREEN */
public const ENUM_COLOR_SCHEME_GREEN = 'green';
/** @var string ENUM_COLOR_SCHEME_ORANGE */
public const ENUM_COLOR_SCHEME_ORANGE = 'orange';
/** @var string ENUM_COLOR_SCHEME_RED */
public const ENUM_COLOR_SCHEME_RED = 'red';
/** @var string ENUM_COLOR_SCHEME_PINK */
public const ENUM_COLOR_SCHEME_PINK = 'pink';
/** @var string DEFAULT_COLOR */
public const DEFAULT_COLOR = self::ENUM_COLOR_NEUTRAL;
/** @var string DEFAULT_COLOR_SCHEME */
public const DEFAULT_COLOR_SCHEME = self::ENUM_COLOR_SCHEME_NEUTRAL;
/** @var bool Default value for static::$bIsClosable */
public const DEFAULT_IS_CLOSABLE = true;
/** @var bool Default value for static::$bIsCollapsible */
@@ -106,14 +106,14 @@ class Alert extends UIContentBlock
*
* @param string $sTitle
* @param string $sContent
* @param string $sColor
* @param string $sColorScheme
* @param string|null $sId
*/
public function __construct(string $sTitle = '', string $sContent = '', string $sColor = self::DEFAULT_COLOR, ?string $sId = null)
public function __construct(string $sTitle = '', string $sContent = '', string $sColorScheme = self::DEFAULT_COLOR_SCHEME, ?string $sId = null)
{
parent::__construct($sId);
$this->sTitle = $sTitle;
$this->sColor = $sColor;
$this->sColor = $sColorScheme;
$this->bIsClosable = static::DEFAULT_IS_CLOSABLE;
$this->bIsCollapsible = static::DEFAULT_IS_COLLAPSIBLE;
$this->bIsOpenedByDefault = static::DEFAULT_IS_OPENED_BY_DEFAULT;

View File

@@ -46,7 +46,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
*/
public static function MakeNeutral(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_NEUTRAL, $sId);
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SCHEME_NEUTRAL, $sId);
}
/**
@@ -60,7 +60,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
*/
public static function MakeForInformation(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_INFORMATION, $sId);
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SCHEME_INFORMATION, $sId);
}
@@ -75,7 +75,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
*/
public static function MakeForSuccess(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SUCCESS, $sId);
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SCHEME_SUCCESS, $sId);
}
/**
@@ -89,7 +89,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
*/
public static function MakeForWarning(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_WARNING, $sId);
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SCHEME_WARNING, $sId);
}
/**
@@ -103,7 +103,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
*/
public static function MakeForDanger(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_DANGER, $sId);
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SCHEME_DANGER, $sId);
}
/**
@@ -117,7 +117,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
*/
public static function MakeForFailure(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_FAILURE, $sId);
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SCHEME_FAILURE, $sId);
}
/**
@@ -131,7 +131,7 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
*/
public static function MakeWithBrandingPrimaryColor(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_PRIMARY, $sId);
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SCHEME_PRIMARY, $sId);
}
/**
@@ -145,6 +145,6 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
*/
public static function MakeWithBrandingSecondaryColor(string $sTitle = '', string $sContent = '', ?string $sId = null)
{
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SECONDARY, $sId);
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SCHEME_SECONDARY, $sId);
}
}

View File

@@ -44,24 +44,24 @@ class Button extends UIBlock
/** @var string DEFAULT_ACTION_TYPE */
public const DEFAULT_ACTION_TYPE = self::ENUM_ACTION_TYPE_REGULAR;
/** @var string ENUM_COLOR_NEUTRAL */
public const ENUM_COLOR_NEUTRAL = 'neutral';
/** @var string ENUM_COLOR_VALIDATION */
public const ENUM_COLOR_VALIDATION = 'success';
/** @var string ENUM_COLOR_DESTRUCTIVE */
public const ENUM_COLOR_DESTRUCTIVE = 'danger';
/** @var string ENUM_COLOR_PRIMARY */
public const ENUM_COLOR_PRIMARY = 'primary';
/** @var string ENUM_COLOR_SECONDARY */
public const ENUM_COLOR_SECONDARY = 'secondary';
/** @var string ENUM_COLOR_GREEN */
public const ENUM_COLOR_GREEN = 'green';
/** @var string ENUM_COLOR_RED */
public const ENUM_COLOR_RED = 'red';
/** @var string ENUM_COLOR_CYAN */
public const ENUM_COLOR_CYAN = 'cyan';
/** @var string DEFAULT_COLOR */
public const DEFAULT_COLOR = self::ENUM_COLOR_NEUTRAL;
/** @var string ENUM_COLOR_SCHEME_NEUTRAL */
public const ENUM_COLOR_SCHEME_NEUTRAL = 'neutral';
/** @var string ENUM_COLOR_SCHEME_VALIDATION */
public const ENUM_COLOR_SCHEME_VALIDATION = 'success';
/** @var string ENUM_COLOR_SCHEME_DESTRUCTIVE */
public const ENUM_COLOR_SCHEME_DESTRUCTIVE = 'danger';
/** @var string ENUM_COLOR_SCHEME_PRIMARY */
public const ENUM_COLOR_SCHEME_PRIMARY = 'primary';
/** @var string ENUM_COLOR_SCHEME_SECONDARY */
public const ENUM_COLOR_SCHEME_SECONDARY = 'secondary';
/** @var string ENUM_COLOR_SCHEME_GREEN */
public const ENUM_COLOR_SCHEME_GREEN = 'green';
/** @var string ENUM_COLOR_SCHEME_RED */
public const ENUM_COLOR_SCHEME_RED = 'red';
/** @var string ENUM_COLOR_SCHEME_CYAN */
public const ENUM_COLOR_SCHEME_CYAN = 'cyan';
/** @var string DEFAULT_COLOR_SCHEME */
public const DEFAULT_COLOR_SCHEME = self::ENUM_COLOR_SCHEME_NEUTRAL;
/** @var string $sLabel */
protected $sLabel;
@@ -88,11 +88,11 @@ class Button extends UIBlock
* @param string $sTooltip
* @param string $sIconClass
* @param string $sActionType
* @param string $sColor
* @param string $sColorScheme
* @param string $sJsCode
* @param string $sOnClickJsCode
*/
public function __construct(string $sLabel, string $sId = null, string $sTooltip = '', string $sIconClass = '', string $sActionType = self::DEFAULT_ACTION_TYPE, string $sColor = self::DEFAULT_COLOR, string $sJsCode = '', string $sOnClickJsCode = '')
public function __construct(string $sLabel, string $sId = null, string $sTooltip = '', string $sIconClass = '', string $sActionType = self::DEFAULT_ACTION_TYPE, string $sColorScheme = self::DEFAULT_COLOR_SCHEME, string $sJsCode = '', string $sOnClickJsCode = '')
{
parent::__construct($sId);
@@ -100,7 +100,7 @@ class Button extends UIBlock
$this->sTooltip = $sTooltip;
$this->sIconClass = $sIconClass;
$this->sActionType = $sActionType;
$this->sColor = $sColor;
$this->sColor = $sColorScheme;
$this->sJsCode = $sJsCode;
$this->sOnClickJsCode = $sOnClickJsCode;
$this->aDataAttributes = ['role' => 'ibo-button'];
@@ -126,7 +126,6 @@ class Button extends UIBlock
return $this;
}
/**
* @return string
*/

View File

@@ -67,7 +67,7 @@ class ButtonJS extends Button
public function __construct(
string $sLabel, string $sId = null, string $sName = '', string $sValue = '', string $sType = self::DEFAULT_TYPE,
string $sTooltip = '', string $sIconClass = '',
string $sActionType = self::DEFAULT_ACTION_TYPE, string $sColor = self::DEFAULT_COLOR, string $sJsCode = '',
string $sActionType = self::DEFAULT_ACTION_TYPE, string $sColor = self::DEFAULT_COLOR_SCHEME, string $sJsCode = '',
string $sOnClickJsCode = ''
) {
parent::__construct( $sLabel,$sId, $sTooltip, $sIconClass,

View File

@@ -54,7 +54,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
{
$oButton = new ButtonJS($sLabel, $sId);
$oButton->SetActionType(Button::ENUM_ACTION_TYPE_REGULAR)
->SetColor(Button::ENUM_COLOR_NEUTRAL);
->SetColor(Button::ENUM_COLOR_SCHEME_NEUTRAL);
if (!empty($sName)) {
$oButton->SetName($sName);
@@ -81,7 +81,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
): Button {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_PRIMARY, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit, $sId);
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_PRIMARY, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit, $sId);
}
/**
@@ -102,7 +102,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
): Button {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SECONDARY, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit, $sId);
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_SECONDARY, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit, $sId);
}
/**
@@ -123,7 +123,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
): Button {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_VALIDATION, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit, $sId);
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_VALIDATION, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName, $bIsSubmit, $sId);
}
/**
@@ -145,7 +145,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
): Button {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName,
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName,
$bIsSubmit, $sId);
}
@@ -171,7 +171,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
): Button {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
}
@@ -194,7 +194,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
): Button {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_PRIMARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_PRIMARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
}
@@ -216,7 +216,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
): Button {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SECONDARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_SECONDARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
}
@@ -238,7 +238,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
): Button {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_VALIDATION, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_VALIDATION, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
}
@@ -260,7 +260,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
): Button {
return static::MakeForAction($sLabel, Button::ENUM_COLOR_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
}
@@ -285,7 +285,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
$sLabel = $sLabel ?? Dict::S('UI:Button:Cancel');
$sName = $sName ?? 'cancel';
return static::MakeForAction($sLabel, Button::ENUM_COLOR_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
}
@@ -307,7 +307,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
bool $bIsSubmit = false,
?string $sId = null
) {
$oButton = static::MakeForAction('', Button::ENUM_COLOR_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$oButton = static::MakeForAction('', Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
$bIsSubmit, $sId);
$oButton->SetIconClass($sIconClasses);
$oButton->SetTooltip($sTooltipText);
@@ -337,7 +337,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
$sTarget = ButtonURL::DEFAULT_TARGET;
}
$sType = empty($sIconClasses) ? Button::ENUM_ACTION_TYPE_REGULAR : Button::ENUM_ACTION_TYPE_ALTERNATIVE;
$oButton = static::MakeForLink($sLabel, $sURL,Button::ENUM_COLOR_NEUTRAL, $sType, $sTarget, $sId);
$oButton = static::MakeForLink($sLabel, $sURL,Button::ENUM_COLOR_SCHEME_NEUTRAL, $sType, $sTarget, $sId);
if (!empty($sIconClasses)) {
$oButton->SetIconClass($sIconClasses);
@@ -362,7 +362,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
if (empty($sTarget)) {
$sTarget = ButtonURL::DEFAULT_TARGET;
}
$oButton = static::MakeForLink('', $sURL,Button::ENUM_COLOR_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sTarget, $sId);
$oButton = static::MakeForLink('', $sURL,Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sTarget, $sId);
$oButton->SetIconClass($sIconClasses);
$oButton->SetTooltip($sTooltipText);
@@ -384,7 +384,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
?string $sId = null
) {
$oButton = static::MakeIconLink($sIconClasses, $sTooltipText, $sURL, $sTarget, $sId);
$oButton->SetColor(Button::ENUM_COLOR_DESTRUCTIVE);
$oButton->SetColor(Button::ENUM_COLOR_SCHEME_DESTRUCTIVE);
$oButton->SetTooltip($sTooltipText);
return $oButton;
}

View File

@@ -66,7 +66,7 @@ class ButtonURL extends Button
*/
public function __construct(
string $sLabel, string $sURL, string $sId = null, string $sTarget = self::DEFAULT_TARGET, string $sTooltip = '', string $sIconClass = '',
string $sActionType = self::DEFAULT_ACTION_TYPE, string $sColor = self::DEFAULT_COLOR, string $sJsCode = '',
string $sActionType = self::DEFAULT_ACTION_TYPE, string $sColor = self::DEFAULT_COLOR_SCHEME, string $sJsCode = '',
string $sOnClickJsCode = '')
{
parent::__construct($sLabel, $sId, $sTooltip, $sIconClass,

View File

@@ -53,40 +53,40 @@ class Panel extends UIContentBlock
];
// Specific constants
/** @var string ENUM_COLOR_PRIMARY */
public const ENUM_COLOR_PRIMARY = 'primary';
/** @var string ENUM_COLOR_SECONDARY */
public const ENUM_COLOR_SECONDARY = 'secondary';
/** @var string ENUM_COLOR_SCHEME_PRIMARY */
public const ENUM_COLOR_SCHEME_PRIMARY = 'primary';
/** @var string ENUM_COLOR_SCHEME_SECONDARY */
public const ENUM_COLOR_SCHEME_SECONDARY = 'secondary';
/** @var string ENUM_COLOR_NEUTRAL */
public const ENUM_COLOR_NEUTRAL = 'neutral';
/** @var string ENUM_COLOR_INFORMATION */
public const ENUM_COLOR_INFORMATION = 'information';
/** @var string ENUM_COLOR_SUCCESS */
public const ENUM_COLOR_SUCCESS = 'success';
/** @var string ENUM_COLOR_FAILURE */
public const ENUM_COLOR_FAILURE = 'failure';
/** @var string ENUM_COLOR_WARNING */
public const ENUM_COLOR_WARNING = 'warning';
/** @var string ENUM_COLOR_DANGER */
public const ENUM_COLOR_DANGER = 'danger';
/** @var string ENUM_COLOR_SCHEME_NEUTRAL */
public const ENUM_COLOR_SCHEME_NEUTRAL = 'neutral';
/** @var string ENUM_COLOR_SCHEME_INFORMATION */
public const ENUM_COLOR_SCHEME_INFORMATION = 'information';
/** @var string ENUM_COLOR_SCHEME_SUCCESS */
public const ENUM_COLOR_SCHEME_SUCCESS = 'success';
/** @var string ENUM_COLOR_SCHEME_FAILURE */
public const ENUM_COLOR_SCHEME_FAILURE = 'failure';
/** @var string ENUM_COLOR_SCHEME_WARNING */
public const ENUM_COLOR_SCHEME_WARNING = 'warning';
/** @var string ENUM_COLOR_SCHEME_DANGER */
public const ENUM_COLOR_SCHEME_DANGER = 'danger';
/** @var string ENUM_COLOR_GREY */
public const ENUM_COLOR_GREY = 'grey';
/** @var string ENUM_COLOR_BLUEGREY */
public const ENUM_COLOR_BLUEGREY = 'blue-grey';
/** @var string ENUM_COLOR_BLUE */
public const ENUM_COLOR_BLUE = 'blue';
/** @var string ENUM_COLOR_CYAN */
public const ENUM_COLOR_CYAN = 'cyan';
/** @var string ENUM_COLOR_GREEN */
public const ENUM_COLOR_GREEN = 'green';
/** @var string ENUM_COLOR_ORANGE */
public const ENUM_COLOR_ORANGE = 'orange';
/** @var string ENUM_COLOR_RED */
public const ENUM_COLOR_RED = 'red';
/** @var string ENUM_COLOR_PINK */
public const ENUM_COLOR_PINK = 'pink';
/** @var string ENUM_COLOR_SCHEME_GREY */
public const ENUM_COLOR_SCHEME_GREY = 'grey';
/** @var string ENUM_COLOR_SCHEME_BLUEGREY */
public const ENUM_COLOR_SCHEME_BLUEGREY = 'blue-grey';
/** @var string ENUM_COLOR_SCHEME_BLUE */
public const ENUM_COLOR_SCHEME_BLUE = 'blue';
/** @var string ENUM_COLOR_SCHEME_CYAN */
public const ENUM_COLOR_SCHEME_CYAN = 'cyan';
/** @var string ENUM_COLOR_SCHEME_GREEN */
public const ENUM_COLOR_SCHEME_GREEN = 'green';
/** @var string ENUM_COLOR_SCHEME_ORANGE */
public const ENUM_COLOR_SCHEME_ORANGE = 'orange';
/** @var string ENUM_COLOR_SCHEME_RED */
public const ENUM_COLOR_SCHEME_RED = 'red';
/** @var string ENUM_COLOR_SCHEME_PINK */
public const ENUM_COLOR_SCHEME_PINK = 'pink';
/** @var string ENUM_CONTENT_AREA_MAIN The main content area (panel body) */
public const ENUM_CONTENT_AREA_MAIN = 'main';
@@ -100,10 +100,10 @@ class Panel extends UIContentBlock
/** @var string Icon should cover all the space, best for icons with filled background */
public const ENUM_ICON_COVER_METHOD_COVER = 'cover';
/** @var string DEFAULT_COLOR */
public const DEFAULT_COLOR = self::ENUM_COLOR_NEUTRAL;
/** @var string DEFAULT_COLOR_SCHEME */
public const DEFAULT_COLOR_SCHEME = self::ENUM_COLOR_SCHEME_NEUTRAL;
/** @var string Default color for a panel displaying info about a datamodel class */
public const DEFAULT_COLOR_FOR_CLASS = self::ENUM_COLOR_BLUE;
public const DEFAULT_COLOR_SCHEME_FOR_CLASS = self::ENUM_COLOR_SCHEME_BLUE;
/** @var null */
public const DEFAULT_ICON_URL = null;
/** @var string */
@@ -138,10 +138,10 @@ class Panel extends UIContentBlock
*
* @param string $sTitle
* @param \Combodo\iTop\Application\UI\Base\iUIBlock[] $aSubBlocks
* @param string $sSemanticColor $sSemanticColor Semantic color code such as "success", "failure", "active", ... {@see css/backoffice/components/_panel.scss}
* @param string $sColorScheme Color scheme code such as "success", "failure", "active", ... {@see css/backoffice/components/_panel.scss}
* @param string|null $sId
*/
public function __construct(string $sTitle = '', array $aSubBlocks = [], string $sSemanticColor = self::DEFAULT_COLOR, ?string $sId = null)
public function __construct(string $sTitle = '', array $aSubBlocks = [], string $sColorScheme = self::DEFAULT_COLOR_SCHEME, ?string $sId = null)
{
parent::__construct($sId);
@@ -156,7 +156,7 @@ class Panel extends UIContentBlock
$this->sIconUrl = static::DEFAULT_ICON_URL;
$this->sIconCoverMethod = static::DEFAULT_ICON_COVER_METHOD;
$this->bIconAsMedallion = static::DEFAULT_ICON_AS_MEDALLION;
$this->SetColorFromSemantic($sSemanticColor);
$this->SetColorFromColorSemantic($sColorScheme);
$this->SetMainBlocks([]);
$this->SetToolBlocks([]);
$this->bIsCollapsible = false;
@@ -414,7 +414,7 @@ class Panel extends UIContentBlock
* @see static::$sCSSColorClass
* @return $this
*/
public function SetColorFromSemantic(string $sSemanticColor)
public function SetColorFromColorSemantic(string $sSemanticColor)
{
$this->SetCSSColorClass("ibo-is-$sSemanticColor");
@@ -435,7 +435,7 @@ class Panel extends UIContentBlock
public function SetColorFromOrmStyle(ormStyle $oStyle)
{
if (strlen($oStyle->GetStyleClass()) === 0) {
$this->SetColorFromSemantic(static::DEFAULT_COLOR);
$this->SetColorFromColorSemantic(static::DEFAULT_COLOR_SCHEME);
} else {
$this->SetCSSColorClass($oStyle->GetStyleClass());
}
@@ -458,7 +458,7 @@ class Panel extends UIContentBlock
{
$oStyle = MetaModel::GetClassStyle($sClass);
if (empty($oStyle)) {
$this->SetColorFromSemantic(static::DEFAULT_COLOR_FOR_CLASS);
$this->SetColorFromColorSemantic(static::DEFAULT_COLOR_SCHEME_FOR_CLASS);
} else {
$this->SetColorFromOrmStyle($oStyle);
}

View File

@@ -52,7 +52,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColorFromSemantic(Panel::ENUM_COLOR_NEUTRAL);
$oPanel->SetColorFromColorSemantic(Panel::ENUM_COLOR_SCHEME_NEUTRAL);
return $oPanel;
}
@@ -71,7 +71,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColorFromSemantic(Panel::ENUM_COLOR_INFORMATION);
$oPanel->SetColorFromColorSemantic(Panel::ENUM_COLOR_SCHEME_INFORMATION);
return $oPanel;
}
@@ -90,7 +90,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColorFromSemantic(Panel::ENUM_COLOR_SUCCESS);
$oPanel->SetColorFromColorSemantic(Panel::ENUM_COLOR_SCHEME_SUCCESS);
return $oPanel;
}
@@ -109,7 +109,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColorFromSemantic(Panel::ENUM_COLOR_WARNING);
$oPanel->SetColorFromColorSemantic(Panel::ENUM_COLOR_SCHEME_WARNING);
return $oPanel;
}
@@ -128,7 +128,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColorFromSemantic(Panel::ENUM_COLOR_DANGER);
$oPanel->SetColorFromColorSemantic(Panel::ENUM_COLOR_SCHEME_DANGER);
return $oPanel;
}
@@ -147,7 +147,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColorFromSemantic(Panel::ENUM_COLOR_FAILURE);
$oPanel->SetColorFromColorSemantic(Panel::ENUM_COLOR_SCHEME_FAILURE);
return $oPanel;
}
@@ -166,7 +166,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColorFromSemantic(Panel::ENUM_COLOR_PRIMARY);
$oPanel->SetColorFromColorSemantic(Panel::ENUM_COLOR_SCHEME_PRIMARY);
return $oPanel;
}
@@ -185,7 +185,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
if (!is_null($sSubTitle)) {
$oPanel->SetSubTitle($sSubTitle);
}
$oPanel->SetColorFromSemantic(Panel::ENUM_COLOR_SECONDARY);
$oPanel->SetColorFromColorSemantic(Panel::ENUM_COLOR_SCHEME_SECONDARY);
return $oPanel;
}

View File

@@ -87,7 +87,7 @@ class ObjectDetails extends Panel implements iKeyboardShortcut
$this->ComputeObjectName($oObject);
parent::__construct($this->sObjectName, [], static::DEFAULT_COLOR, $sId);
parent::__construct($this->sObjectName, [], static::DEFAULT_COLOR_SCHEME, $sId);
$this->SetColorFromClass($this->sClassName);
$this->ComputeIconUrl($oObject);

View File

@@ -176,7 +176,7 @@ class SearchForm
$oForm->SetAction($sAction);
$oForm->AddSubBlock(new Html(Dict::Format('UI:SearchFor_Class_Objects', $sClassesCombo)));
$oUiSearchBlock = new Panel('', [], Panel::ENUM_COLOR_CYAN, $sSearchFormId);
$oUiSearchBlock = new Panel('', [], Panel::ENUM_COLOR_SCHEME_CYAN, $sSearchFormId);
$oUiSearchBlock->SetCSSClasses(["ibo-search-form-panel", "display_block"])
->AddTitleBlock($oForm);
$oUiBlock->AddSubBlock($oUiSearchBlock);

View File

@@ -130,8 +130,8 @@ $oButtonsURLTitle = new Html('<h2 id="title-buttons">ButtonsURL examples</h2>');
$oPage->AddUiBlock($oButtonsURLTitle);
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeLinkNeutral('#', 'Link neutral'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeIconLink('fas fa-thumbs-up', 'Icon link button', '#'));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeLinkNeutral('#', 'Link primary')->SetColor(Button::ENUM_COLOR_PRIMARY));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeIconLink('fas fa-thumbs-up', 'Icon link button primary', '#')->SetColor(Button::ENUM_COLOR_PRIMARY));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeLinkNeutral('#', 'Link primary')->SetColor(Button::ENUM_COLOR_SCHEME_PRIMARY));
$oPageContentLayout->AddMainBlock(ButtonUIBlockFactory::MakeIconLink('fas fa-thumbs-up', 'Icon link button primary', '#')->SetColor(Button::ENUM_COLOR_SCHEME_PRIMARY));
$oPageContentLayout->AddMainBlock(new Html('<hr/>'));