mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
Panel: Remove PanelEnhanced as the Panel now has all the necessary options
This commit is contained in:
@@ -2021,7 +2021,7 @@ class DashletHeaderDynamic extends Dashlet
|
||||
$sGroupBy = $this->aProperties['group_by'];
|
||||
|
||||
$oIconSelect = $this->oModelReflection->GetIconSelectionField('icon');
|
||||
$sIconPath = utils::HtmlEntities($oIconSelect->MakeFileUrl($sIcon));
|
||||
$sIconPath = $oIconSelect->MakeFileUrl($sIcon);
|
||||
|
||||
$aValues = $this->GetValues();
|
||||
if (count($aValues) > 0) {
|
||||
@@ -2043,8 +2043,6 @@ class DashletHeaderDynamic extends Dashlet
|
||||
);
|
||||
}
|
||||
|
||||
$oPanel = PanelUIBlockFactory::MakeEnhancedNeutral(Dict::S(str_replace('_', ':', $sTitle)), $sIconPath);
|
||||
|
||||
if (isset($aExtraParams['query_params'])) {
|
||||
$aQueryParams = $aExtraParams['query_params'];
|
||||
} elseif (isset($aExtraParams['this->class'])) {
|
||||
@@ -2055,7 +2053,10 @@ class DashletHeaderDynamic extends Dashlet
|
||||
}
|
||||
$oFilter = DBObjectSearch::FromOQL($sQuery, $aQueryParams);
|
||||
$sClass = $oFilter->GetClass();
|
||||
PanelUIBlockFactory::SetClassColor($sClass, $oPanel);
|
||||
|
||||
$oPanel = PanelUIBlockFactory::MakeNeutral(Dict::S(str_replace('_', ':', $sTitle)))
|
||||
->SetIcon($sIconPath)
|
||||
->SetColorFromClass($sClass);
|
||||
$oBlock = new DisplayBlock($oFilter, 'summary');
|
||||
$sBlockId = 'block_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occuring in the same DOM)
|
||||
$oBlock->DisplayIntoContentBlock($oPanel, $oPage, $sBlockId, array_merge($aExtraParams, $aParams));
|
||||
|
||||
@@ -174,28 +174,6 @@ $ibo-panel-colors: (
|
||||
color: $ibo-panel--title--color;
|
||||
@extend %ibo-font-ral-med-250;
|
||||
flex-grow: 1;
|
||||
|
||||
// TODO 3.0.0: Refactor this as it used by the enhanced panel which should be removed
|
||||
.ibo-panel--title-icon {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.ibo-panel--title-title {
|
||||
display: inline-block;
|
||||
@extend %ibo-font-ral-med-250;
|
||||
|
||||
.ibo-panel--title-title-title {
|
||||
}
|
||||
|
||||
.ibo-panel--title-title-subtitle {
|
||||
@extend .ibo-panel--subtitle;
|
||||
|
||||
a.summary {
|
||||
@extend %ibo-font-ral-nor-250;
|
||||
color: $ibo-panel--subtitle--color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.ibo-panel--subtitle {
|
||||
|
||||
@@ -36,7 +36,7 @@ $ibo-datamodel-viewer--schema--tooltip-top--padding: 3px !default;
|
||||
|
||||
.ibo-datamodel-viewer--details{
|
||||
flex-grow: 1;
|
||||
.ibo-panel--title .ibo-panel--title-title .ibo-panel--title-title-subtitle{
|
||||
.ibo-panel--subtitle{
|
||||
@extend %ibo-font-ral-nor-150;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -846,27 +846,24 @@ function DisplayClassDetails($oPage, $sClass, $sContext)
|
||||
{
|
||||
$aParentClasses[] = MakeClassHLink($sParentClass, $sContext);
|
||||
}
|
||||
if (count($aParentClasses) > 0)
|
||||
{
|
||||
$sParents = implode(' <i class="fas fa-arrow-right ibo-datamodel-viewer--parent--spacer"></i> ', $aParentClasses).' <i class="fas fa-arrow-right ibo-datamodel-viewer--parent--spacer"></i> '. MetaModel::GetName($sClass) . '('.$sClass.')';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count($aParentClasses) > 0) {
|
||||
$sParents = implode(' <i class="fas fa-arrow-right ibo-datamodel-viewer--parent--spacer"></i> ', $aParentClasses).' <i class="fas fa-arrow-right ibo-datamodel-viewer--parent--spacer"></i> '.MetaModel::GetName($sClass).'('.$sClass.')';
|
||||
} else {
|
||||
$sParents = '';
|
||||
}
|
||||
$sClassHierarchy = ("[<a href=\"schema.php?operation=list{$sContext}\">".Dict::S('UI:Schema:AllClasses')."</a>] $sParents");
|
||||
|
||||
$oEnchancedPanel = PanelUIBlockFactory::MakeEnhancedNeutral(MetaModel::GetName($sClass) . ' ('.$sClass.')' , MetaModel::GetClassIcon($sClass,false));
|
||||
$oPanel = PanelUIBlockFactory::MakeForClass($sClass, MetaModel::GetName($sClass).' ('.$sClass.')')
|
||||
->SetIcon(MetaModel::GetClassIcon($sClass, false));
|
||||
$sClassDescritpion = MetaModel::GetClassDescription($sClass);
|
||||
$oEnchancedPanelSubtitle = $oEnchancedPanel->GetSubTitleBlock();
|
||||
$oEnchancedPanelSubtitle->AddHtml($sClassHierarchy . ($sClassDescritpion == "" ? "" : ' - ' . $sClassDescritpion));
|
||||
if (MetaModel::IsAbstract($sClass))
|
||||
{
|
||||
$oEnchancedPanelSubtitle = $oPanel->GetSubTitleBlock();
|
||||
$oEnchancedPanelSubtitle->AddHtml($sClassHierarchy.($sClassDescritpion == "" ? "" : ' - '.$sClassDescritpion));
|
||||
if (MetaModel::IsAbstract($sClass)) {
|
||||
$oEnchancedPanelSubtitle->AddHtml(' - <i class="fas fa-lock" data-tooltip-content="'.Dict::S('UI:Schema:AbstractClass').'"></i>');
|
||||
}
|
||||
|
||||
$oPage->AddUiBlock($oEnchancedPanel);
|
||||
$oPage->AddTabContainer('details', '', $oEnchancedPanel);
|
||||
$oPage->AddUiBlock($oPanel);
|
||||
$oPage->AddTabContainer('details', '', $oPanel);
|
||||
$oPage->SetCurrentTabContainer('details');
|
||||
// List the attributes of the object
|
||||
$aForwardChangeTracking = MetaModel::GetTrackForwardExternalKeys($sClass);
|
||||
|
||||
@@ -25,6 +25,8 @@ use Combodo\iTop\Application\UI\Base\iUIBlock;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\iUIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\tUIContentAreas;
|
||||
use MetaModel;
|
||||
use ormStyle;
|
||||
|
||||
/**
|
||||
* Class Panel
|
||||
@@ -92,6 +94,8 @@ class Panel extends UIContentBlock
|
||||
|
||||
/** @var string DEFAULT_COLOR */
|
||||
public const DEFAULT_COLOR = self::ENUM_COLOR_NEUTRAL;
|
||||
/** @var string Default color for a panel displaying info about a datamodel class */
|
||||
public const DEFAULT_COLOR_FOR_CLASS = self::ENUM_COLOR_BLUE;
|
||||
/** @var null */
|
||||
public const DEFAULT_ICON_URL = null;
|
||||
/** @var string */
|
||||
@@ -244,6 +248,44 @@ class Panel extends UIContentBlock
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the panel's color from an ormStyle directly.
|
||||
*
|
||||
* Use cases:
|
||||
* - Display information about a datamodel class
|
||||
* - Display information about a particular enum value (linked objects)
|
||||
*
|
||||
* @param \ormStyle $oStyle
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetColorFromOrmStyle(ormStyle $oStyle)
|
||||
{
|
||||
$sColor = empty($oStyle->GetMainColor()) ? static::DEFAULT_COLOR : $oStyle->GetMainColor();
|
||||
$this->SetColor($sColor);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the panel's color to the one corresponding to the $sClass datamodel class
|
||||
*
|
||||
* @param string $sClass
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetColorFromClass(string $sClass)
|
||||
{
|
||||
$oStyle = MetaModel::GetClassStyle($sClass);
|
||||
if (empty($oStyle)) {
|
||||
$this->SetColor(static::DEFAULT_COLOR_FOR_CLASS);
|
||||
} else {
|
||||
$this->SetColorFromOrmStyle($oStyle);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see static::$oSubTitleBlock
|
||||
* @return bool
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2020 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Panel;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
class PanelEnhanced extends Panel
|
||||
{
|
||||
public const BLOCK_CODE = 'ibo-panel-enhanced';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/panel/panelenhanced';
|
||||
|
||||
/** @var UIContentBlock */
|
||||
protected $oSubTitleBlock;
|
||||
/** @var string */
|
||||
protected $sIconUrl;
|
||||
|
||||
/**
|
||||
* PanelEnhanced constructor.
|
||||
*
|
||||
* @param $sTitle
|
||||
* @param $sIconUrl
|
||||
*/
|
||||
public function __construct(string $sTitle, string $sIconUrl)
|
||||
{
|
||||
parent::__construct($sTitle);
|
||||
$this->oSubTitleBlock = new UIContentBlock();
|
||||
$this->sIconUrl = $sIconUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return UIContentBlock
|
||||
*/
|
||||
public function GetSubTitleBlock(): UIContentBlock
|
||||
{
|
||||
return $this->oSubTitleBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Combodo\iTop\Application\UI\Base\Layout\UIContentBlock $oSubTitleBlock
|
||||
*
|
||||
* @return PanelEnhanced
|
||||
*/
|
||||
public function SetSubTitleBlock(UIContentBlock $oSubTitleBlock): PanelEnhanced
|
||||
{
|
||||
$this->oSubTitleBlock = $oSubTitleBlock;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetIconUrl(): string
|
||||
{
|
||||
return $this->sIconUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sIconUrl
|
||||
*
|
||||
* @return PanelEnhanced
|
||||
*/
|
||||
public function SetIcon(string $sIconUrl): PanelEnhanced
|
||||
{
|
||||
$this->sIconUrl = $sIconUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -171,24 +171,7 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
public static function MakeForClass(string $sClass, string $sTitle)
|
||||
{
|
||||
$oPanel = new Panel($sTitle);
|
||||
self::SetClassColor($sClass, $oPanel);
|
||||
|
||||
return $oPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a basis Panel component
|
||||
*
|
||||
* @param string $sTitle
|
||||
* @param String $sIconUrl
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeEnhancedNeutral(string $sTitle, string $sIconUrl)
|
||||
{
|
||||
$oPanel = new PanelEnhanced($sTitle, $sIconUrl);
|
||||
// TODO 3.0.0: Change this to class color when done
|
||||
$oPanel->SetColor(Panel::ENUM_COLOR_BLUE);
|
||||
$oPanel->SetColorFromClass($sClass);
|
||||
|
||||
return $oPanel;
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
{# @copyright Copyright (C) 2010-2020 Combodo SARL #}
|
||||
{# @license http://opensource.org/licenses/AGPL-3.0 #}
|
||||
{% extends 'base/components/panel/layout.html.twig' %}
|
||||
|
||||
{% block iboPanelTitle %}
|
||||
<div class="ibo-panel--title-icon">
|
||||
{% if oUIBlock.GetIconUrl() != '' %}
|
||||
<img src="{{ oUIBlock.GetIconUrl() }}" alt="{{ oUIBlock.GetTitle() }}">
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="ibo-panel--title-title">
|
||||
<div class="ibo-panel--title-title-title">{{ oUIBlock.GetTitle() }}</div>
|
||||
<div class="ibo-panel--title-title-subtitle">
|
||||
{% for oSubBlock in oUIBlock.GetSubTitleBlock().GetSubBlocks() %}
|
||||
{{ render_block(oSubBlock, {aPage: aPage}) }}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user