mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-25 11:38:44 +02:00
Dashlet form in new dashboard layout (suite)
This commit is contained in:
@@ -12,6 +12,8 @@ use Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\Dashboard\DashboardLayout as DashboardLayoutUIBlock;
|
||||
use Combodo\iTop\Application\WebPage\iTopWebPage;
|
||||
use Combodo\iTop\Application\WebPage\WebPage;
|
||||
use Combodo\iTop\PropertyType\PropertyTypeDesign;
|
||||
use Combodo\iTop\Service\DependencyInjection\ServiceLocator;
|
||||
|
||||
require_once(APPROOT.'application/dashboardlayout.class.inc.php');
|
||||
require_once(APPROOT.'application/dashlet.class.inc.php');
|
||||
@@ -68,7 +70,7 @@ abstract class Dashboard
|
||||
{
|
||||
$this->aCells = []; // reset the content of the dashboard
|
||||
set_error_handler(['Dashboard', 'ErrorHandler']);
|
||||
$oDoc = new DOMDocument();
|
||||
$oDoc = new PropertyTypeDesign();
|
||||
$oDoc->loadXML($sXml);
|
||||
restore_error_handler();
|
||||
$this->FromDOMDocument($oDoc);
|
||||
@@ -215,6 +217,7 @@ abstract class Dashboard
|
||||
$this->ToDOMNode($oMainNode);
|
||||
|
||||
$sXml = $oDoc->saveXML();
|
||||
|
||||
return $sXml;
|
||||
}
|
||||
|
||||
@@ -640,6 +643,7 @@ JS
|
||||
$iNewId = max($iNewId, (int)$oDashlet->GetID());
|
||||
}
|
||||
}
|
||||
|
||||
return $iNewId + 1;
|
||||
}
|
||||
|
||||
@@ -674,6 +678,7 @@ JS
|
||||
if (is_subclass_of($sType, 'Dashlet')) {
|
||||
return $sType;
|
||||
}
|
||||
|
||||
return 'DashletUnknown';
|
||||
}
|
||||
|
||||
@@ -726,6 +731,7 @@ class RuntimeDashboard extends Dashboard
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->oMetaModel = new ModelReflectionRuntime();
|
||||
ServiceLocator::GetInstance()->RegisterService('ModelReflection', $this->oMetaModel);
|
||||
$this->bCustomized = false;
|
||||
}
|
||||
|
||||
@@ -740,6 +746,7 @@ class RuntimeDashboard extends Dashboard
|
||||
|
||||
/**
|
||||
* @param bool $bCustomized
|
||||
*
|
||||
* @since 2.7.0
|
||||
*/
|
||||
public function SetCustomFlag($bCustomized)
|
||||
@@ -784,6 +791,7 @@ class RuntimeDashboard extends Dashboard
|
||||
utils::PushArchiveMode(false);
|
||||
$oUserDashboard->DBWrite();
|
||||
utils::PopArchiveMode();
|
||||
|
||||
return $bIsNew;
|
||||
}
|
||||
|
||||
@@ -1059,7 +1067,8 @@ JS
|
||||
$oUDSet = new DBObjectSet($oUDSearch);
|
||||
|
||||
return ($oUDSet->Count() > 0);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1630,10 +1639,12 @@ JS
|
||||
try {
|
||||
$oFilter = $oDashlet->GetDBSearch($aExtraParams);
|
||||
$aClassAliases = $oFilter->GetSelectedClasses();
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
//on error, return default value
|
||||
return null;
|
||||
}
|
||||
|
||||
return DataTableSettings::GetAppUserPreferenceKey($aClassAliases, $sDataTableId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
|
||||
}
|
||||
$idx++;
|
||||
}
|
||||
|
||||
return $aDashlets;
|
||||
}
|
||||
|
||||
@@ -94,6 +95,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
|
||||
}
|
||||
$idx++;
|
||||
}
|
||||
|
||||
return $aCells;
|
||||
|
||||
}
|
||||
@@ -135,7 +137,7 @@ abstract class DashboardLayoutMultiCol extends DashboardLayout
|
||||
/** @var \Dashlet $oDashlet */
|
||||
foreach ($aDashlets as $oDashlet) {
|
||||
if ($oDashlet::IsVisible()) {
|
||||
$oDashboardGrid->AddDashlet($oDashlet->DoRender($oPage, $bEditMode, true /* bEnclosingDiv */, $aExtraParams), $oDashlet->GetID(), get_class($oDashlet));
|
||||
$oDashboardGrid->AddDashlet($oDashlet->DoRender($oPage, $bEditMode, true /* bEnclosingDiv */, $aExtraParams), $oDashlet->GetID(), get_class($oDashlet), $oDashlet->GetNormalizedProperties());
|
||||
//$oDashboardColumn->AddUIBlock($oDashlet->DoRender($oPage, $bEditMode, true /* bEnclosingDiv */, $aExtraParams));
|
||||
}
|
||||
}
|
||||
@@ -186,6 +188,7 @@ class DashboardLayoutOneCol extends DashboardLayoutMultiCol
|
||||
parent::__construct();
|
||||
$this->iNbCols = 1;
|
||||
}
|
||||
|
||||
public static function GetInfo()
|
||||
{
|
||||
return [
|
||||
@@ -203,6 +206,7 @@ class DashboardLayoutTwoCols extends DashboardLayoutMultiCol
|
||||
parent::__construct();
|
||||
$this->iNbCols = 2;
|
||||
}
|
||||
|
||||
public static function GetInfo()
|
||||
{
|
||||
return [
|
||||
@@ -220,6 +224,7 @@ class DashboardLayoutThreeCols extends DashboardLayoutMultiCol
|
||||
parent::__construct();
|
||||
$this->iNbCols = 3;
|
||||
}
|
||||
|
||||
public static function GetInfo()
|
||||
{
|
||||
return [
|
||||
|
||||
@@ -25,6 +25,8 @@ use Combodo\iTop\Application\UI\Base\Component\Panel\PanelUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\iUIBlock;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Combodo\iTop\Application\WebPage\WebPage;
|
||||
use Combodo\iTop\DesignElement;
|
||||
use Combodo\iTop\PropertyType\Serializer\XMLSerializer;
|
||||
|
||||
require_once(APPROOT.'application/forms.class.inc.php');
|
||||
|
||||
@@ -46,6 +48,7 @@ abstract class Dashlet
|
||||
protected $aProperties; // array of {property => value}
|
||||
protected $aCSSClasses;
|
||||
protected $sDashletType;
|
||||
private $aNormalizedProperties = null; // array of properties from serialized form
|
||||
|
||||
/**
|
||||
* Dashlet constructor.
|
||||
@@ -90,6 +93,7 @@ abstract class Dashlet
|
||||
$ret = $sValue;
|
||||
settype($ret, $sRefType);
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
@@ -108,6 +112,7 @@ abstract class Dashlet
|
||||
} else {
|
||||
$sRet = (string)$value;
|
||||
}
|
||||
|
||||
return $sRet;
|
||||
}
|
||||
|
||||
@@ -116,10 +121,12 @@ abstract class Dashlet
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \DOMElement $oDOMNode
|
||||
*/
|
||||
public function FromDOMNode($oDOMNode)
|
||||
public function FromDOMNode(DesignElement $oDOMNode)
|
||||
{
|
||||
/* @var DesignElement $oDOMNode */
|
||||
$this->aNormalizedProperties = XMLSerializer::GetInstance()->Unserialize($oDOMNode, get_class($this), 'Dashlet');
|
||||
|
||||
foreach ($this->aProperties as $sProperty => $value) {
|
||||
$oPropNode = $oDOMNode->getElementsByTagName($sProperty)->item(0);
|
||||
if ($oPropNode != null) {
|
||||
@@ -150,6 +157,7 @@ abstract class Dashlet
|
||||
protected function PropertyFromDOMNode($oDOMNode, $sProperty)
|
||||
{
|
||||
$res = $this->Str2Prop($sProperty, $oDOMNode->textContent);
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
@@ -246,17 +254,20 @@ abstract class Dashlet
|
||||
$oBlock = $this->RenderNoData($oPage, $bEditMode, $aExtraParams);
|
||||
}
|
||||
$oDashletContainer->AddSubBlock($oBlock);
|
||||
} catch (UnknownClassOqlException $e) {
|
||||
}
|
||||
catch (UnknownClassOqlException $e) {
|
||||
// Maybe the class is part of a non-installed module, fail silently
|
||||
// Except in Edit mode
|
||||
if ($bEditMode) {
|
||||
$oDashletContainer->AddCSSClass("dashlet-content");
|
||||
$oDashletContainer->AddHtml('<h2>'.$e->GetUserFriendlyDescription().'</h2>');
|
||||
}
|
||||
} catch (OqlException $e) {
|
||||
}
|
||||
catch (OqlException $e) {
|
||||
$oDashletContainer->AddCSSClass("dashlet-content");
|
||||
$oDashletContainer->AddHtml('<p>'.utils::HtmlEntities($e->GetUserFriendlyDescription()).'</p>');
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$oDashletContainer->AddCSSClass("dashlet-content");
|
||||
$oDashletContainer->AddHtml('<p>'.$e->getMessage().'</p>');
|
||||
}
|
||||
@@ -342,6 +353,7 @@ EOF
|
||||
}
|
||||
}
|
||||
$this->OnUpdate();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -477,9 +489,11 @@ EOF
|
||||
}
|
||||
}
|
||||
asort($aGroupBy);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
// Fallback in case of OQL problem
|
||||
}
|
||||
|
||||
return $aGroupBy;
|
||||
}
|
||||
|
||||
@@ -498,6 +512,11 @@ EOF
|
||||
{
|
||||
$this->sDashletType = $sDashletType;
|
||||
}
|
||||
|
||||
public function GetNormalizedProperties(): ?array
|
||||
{
|
||||
return $this->aNormalizedProperties;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -635,6 +654,7 @@ class DashletUnknown extends Dashlet
|
||||
if (isset($aInfo['configuration']) && empty($this->sOriginalDashletXML)) {
|
||||
$this->sOriginalDashletXML = $aInfo['configuration'];
|
||||
}
|
||||
|
||||
return parent::GetForm($aInfo);
|
||||
}
|
||||
|
||||
@@ -663,6 +683,7 @@ class DashletUnknown extends Dashlet
|
||||
if ($bHasSubProperties) {
|
||||
$sTmp = $oDOMNode->ownerDocument->saveXML($oDOMNode, LIBXML_NOENT);
|
||||
$sTmp = trim(preg_replace("/(<".$oDOMNode->tagName."[^>]*>|<\/".$oDOMNode->tagName.">)/", "", $sTmp));
|
||||
|
||||
return $sTmp;
|
||||
} else {
|
||||
return parent::PropertyFromDOMNode($oDOMNode, $sProperty);
|
||||
@@ -693,6 +714,7 @@ class DashletUnknown extends Dashlet
|
||||
public function Update($aValues, $aUpdatedFields)
|
||||
{
|
||||
$this->FromParams($aValues);
|
||||
|
||||
// OnUpdate() already done in FromParams()
|
||||
return $this;
|
||||
}
|
||||
@@ -735,6 +757,7 @@ class DashletProxy extends DashletUnknown
|
||||
// This should never be called.
|
||||
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
|
||||
$oDashletContainer->AddHtml('<div>This dashlet is not supposed to be rendered as it is just a proxy for third-party widgets.</div>');
|
||||
|
||||
return $oDashletContainer;
|
||||
}
|
||||
|
||||
@@ -757,6 +780,7 @@ class DashletProxy extends DashletUnknown
|
||||
$sHtml .= '<div class="dashlet-pxy-text">'.$sExplainText.'</div>';
|
||||
|
||||
$oDashletContainer->AddHtml($sHtml);
|
||||
|
||||
return $oDashletContainer;
|
||||
}
|
||||
|
||||
@@ -995,7 +1019,7 @@ HTML;
|
||||
'min_height' => 1,
|
||||
'min_width' => 2,
|
||||
'preferred_width' => 4,
|
||||
'preferred_height' => 3
|
||||
'preferred_height' => 3,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1087,7 +1111,8 @@ abstract class DashletGroupBy extends Dashlet
|
||||
$oQuery = $this->oModelReflection->GetQuery($sQuery);
|
||||
$this->sClass = $oQuery->GetClass();
|
||||
$sClassAlias = $oQuery->GetClassAlias();
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
// Invalid query, let the user edit the dashlet/dashboard anyhow
|
||||
$this->sClass = null;
|
||||
$sClassAlias = '';
|
||||
@@ -1310,6 +1335,7 @@ abstract class DashletGroupBy extends Dashlet
|
||||
$aDisplayValues[] = ['label' => 'c', 'value' => 456];
|
||||
}
|
||||
}
|
||||
|
||||
return $aDisplayValues;
|
||||
}
|
||||
|
||||
@@ -1320,6 +1346,7 @@ abstract class DashletGroupBy extends Dashlet
|
||||
{
|
||||
$oDashletContainer = new DashletContainer(null, ['dashlet-content']);
|
||||
$oDashletContainer->AddHtml('error!');
|
||||
|
||||
return $oDashletContainer;
|
||||
}
|
||||
|
||||
@@ -1344,7 +1371,8 @@ abstract class DashletGroupBy extends Dashlet
|
||||
$oField = new DesignerComboField('group_by', Dict::S('UI:DashletGroupBy:Prop-GroupBy'), $this->aProperties['group_by']);
|
||||
$oField->SetMandatory();
|
||||
$oField->SetAllowedValues($aGroupBy);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$oField = new DesignerTextField('group_by', Dict::S('UI:DashletGroupBy:Prop-GroupBy'), $this->aProperties['group_by']);
|
||||
$oField->SetReadOnly();
|
||||
$aGroupBy = [];
|
||||
@@ -1422,9 +1450,11 @@ abstract class DashletGroupBy extends Dashlet
|
||||
if (is_null($this->sClass)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
$this->aProperties['group_by'] => $this->oModelReflection->GetLabel($this->sClass, $this->aProperties['group_by']),
|
||||
'_itop_'.$this->aProperties['aggregation_function'].'_' => Dict::S('UI:GroupBy:'.$this->aProperties['aggregation_function'])];
|
||||
'_itop_'.$this->aProperties['aggregation_function'].'_' => Dict::S('UI:GroupBy:'.$this->aProperties['aggregation_function']),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1472,7 +1502,8 @@ abstract class DashletGroupBy extends Dashlet
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
// In case the OQL is bad
|
||||
}
|
||||
|
||||
@@ -1499,7 +1530,8 @@ abstract class DashletGroupBy extends Dashlet
|
||||
// wrong but not necessary - unset($aUpdatedFields['group_by']);
|
||||
$this->aProperties['group_by'] = '';
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->bFormRedrawNeeded = true;
|
||||
}
|
||||
}
|
||||
@@ -1531,6 +1563,7 @@ abstract class DashletGroupBy extends Dashlet
|
||||
$oDashlet->bRedrawNeeded = true;
|
||||
$oDashlet->bFormRedrawNeeded = true;
|
||||
}
|
||||
|
||||
return $oDashlet;
|
||||
}
|
||||
|
||||
@@ -1610,7 +1643,7 @@ class DashletGroupByPie extends DashletGroupBy
|
||||
'min_height' => 2,
|
||||
'min_width' => 2,
|
||||
'preferred_width' => 3,
|
||||
'preferred_height' => 3
|
||||
'preferred_height' => 3,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1710,7 +1743,7 @@ class DashletGroupByBars extends DashletGroupBy
|
||||
'min_height' => 2,
|
||||
'min_width' => 2,
|
||||
'preferred_width' => 3,
|
||||
'preferred_height' => 3
|
||||
'preferred_height' => 3,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1814,7 +1847,7 @@ class DashletGroupByTable extends DashletGroupBy
|
||||
'min_height' => 2,
|
||||
'min_width' => 2,
|
||||
'preferred_width' => 3,
|
||||
'preferred_height' => 3
|
||||
'preferred_height' => 3,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -1913,6 +1946,7 @@ class DashletHeaderStatic extends Dashlet
|
||||
{
|
||||
if ($sProperty == 'icon') {
|
||||
$oIconField = $this->oModelReflection->GetIconSelectionField('icon');
|
||||
|
||||
return $oIconField->ValueFromDOMNode($oDOMNode);
|
||||
} else {
|
||||
return parent::PropertyFromDOMNode($oDOMNode, $sProperty);
|
||||
@@ -1944,7 +1978,7 @@ class DashletHeaderStatic extends Dashlet
|
||||
'min_height' => 1,
|
||||
'min_width' => 3,
|
||||
'preferred_width' => 3,
|
||||
'preferred_height' => 1
|
||||
'preferred_height' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1990,6 +2024,7 @@ class DashletHeaderDynamic extends Dashlet
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $aValues;
|
||||
}
|
||||
|
||||
@@ -2082,7 +2117,8 @@ class DashletHeaderDynamic extends Dashlet
|
||||
foreach ($aValues as $sValue) {
|
||||
$aValueLabels[] = $this->oModelReflection->GetValueLabel($sClass, $sGroupBy, $sValue);
|
||||
}
|
||||
} catch (UnknownClassOqlException $e) {
|
||||
}
|
||||
catch (UnknownClassOqlException $e) {
|
||||
$aValueLabels[] = $e->GetUserFriendlyDescription();
|
||||
$aValues[] = 1;
|
||||
}
|
||||
@@ -2159,7 +2195,8 @@ class DashletHeaderDynamic extends Dashlet
|
||||
$oField = new DesignerComboField('group_by', Dict::S('UI:DashletHeaderDynamic:Prop-GroupBy'), $this->aProperties['group_by']);
|
||||
$oField->SetMandatory();
|
||||
$oField->SetAllowedValues($aGroupBy);
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$oField = new DesignerTextField('group_by', Dict::S('UI:DashletHeaderDynamic:Prop-GroupBy'), $this->aProperties['group_by']);
|
||||
$oField->SetReadOnly();
|
||||
}
|
||||
@@ -2197,7 +2234,8 @@ class DashletHeaderDynamic extends Dashlet
|
||||
$this->aProperties['group_by'] = '';
|
||||
$this->aProperties['values'] = [];
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->bFormRedrawNeeded = true;
|
||||
}
|
||||
}
|
||||
@@ -2205,6 +2243,7 @@ class DashletHeaderDynamic extends Dashlet
|
||||
$this->bFormRedrawNeeded = true;
|
||||
$this->aProperties['values'] = [];
|
||||
}
|
||||
|
||||
return parent::Update($aValues, $aUpdatedFields);
|
||||
}
|
||||
|
||||
@@ -2215,6 +2254,7 @@ class DashletHeaderDynamic extends Dashlet
|
||||
{
|
||||
if ($sProperty == 'icon') {
|
||||
$oIconField = $this->oModelReflection->GetIconSelectionField('icon');
|
||||
|
||||
return $oIconField->ValueFromDOMNode($oDOMNode);
|
||||
} else {
|
||||
return parent::PropertyFromDOMNode($oDOMNode, $sProperty);
|
||||
@@ -2246,7 +2286,7 @@ class DashletHeaderDynamic extends Dashlet
|
||||
'min_height' => 1,
|
||||
'min_width' => 2,
|
||||
'preferred_width' => 4,
|
||||
'preferred_height' => 3
|
||||
'preferred_height' => 3,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -2359,7 +2399,7 @@ HTML;
|
||||
'min_height' => 1,
|
||||
'min_width' => 2,
|
||||
'preferred_width' => 2,
|
||||
'preferred_height' => 2
|
||||
'preferred_height' => 2,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ class IboDashboard extends HTMLElement {
|
||||
const sNewDashletUrl = GetAbsoluteUrlAppRoot() + '/pages/UI.php?route=dashboard.new_dashlet&dashlet_class='+encodeURIComponent(sDashletClass);
|
||||
fetch(sNewDashletUrl)
|
||||
.then(async data => {
|
||||
|
||||
const sDashletId = this.oGrid.AddDashlet(await data.text(), aDashletOptions);
|
||||
|
||||
// TODO 3.3 Either open the dashlet form right away, or just enter edit mode
|
||||
|
||||
@@ -2,27 +2,32 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Dashlet;
|
||||
|
||||
class DashletWrapper extends UIBlock {
|
||||
class DashletWrapper extends UIBlock
|
||||
{
|
||||
public const BLOCK_CODE = 'ibo-dashlet-wrapper';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/dashlet/dashlet-wrapper';
|
||||
|
||||
protected $oDashlet;
|
||||
protected DashletContainer $oDashletContainer;
|
||||
protected $sDashletClass;
|
||||
protected $sDashletId;
|
||||
private array $aFormViewData;
|
||||
|
||||
public function __construct($oDashlet, ?string $sDashletId = null, ?string $sDashletClass = null) {
|
||||
public function __construct($oDashlet, string $sDashletClass, ?string $sDashletId = null, array $aFormViewData = [])
|
||||
{
|
||||
parent::__construct(null);
|
||||
|
||||
$this->oDashlet = $oDashlet;
|
||||
$this->oDashletContainer = $oDashlet;
|
||||
$this->sDashletId = $sDashletId;
|
||||
$this->sDashletClass = $sDashletClass;
|
||||
$this->aFormViewData = $aFormViewData;
|
||||
}
|
||||
|
||||
public function GetDashlet() {
|
||||
return $this->oDashlet;
|
||||
public function GetDashlet()
|
||||
{
|
||||
return $this->oDashletContainer;
|
||||
}
|
||||
|
||||
public function GetDashletId(): ?string
|
||||
@@ -48,4 +53,9 @@ class DashletWrapper extends UIBlock {
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function GetFormViewData()
|
||||
{
|
||||
return $this->aFormViewData;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,8 +53,9 @@ class DashboardGrid extends UIBlock
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function AddDashlet(UIBlock $oDashlet, ?string $sDashletId = null, ?string $sDashletClass = null): DashboardGrid {
|
||||
$oWrapper = new DashletWrapper($oDashlet, $sDashletId, $sDashletClass);
|
||||
public function AddDashlet(UIBlock $oDashlet, string $sDashletId, string $sDashletClass, array $aFormViewData): DashboardGrid
|
||||
{
|
||||
$oWrapper = new DashletWrapper($oDashlet, $sDashletClass, $sDashletId, $aFormViewData);
|
||||
$oSlot = new DashboardGridSlot(null, $oWrapper);
|
||||
$this->AddSlot($oSlot);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class DashboardController extends AbstractController
|
||||
|
||||
if ($oDashletBlock instanceof iUIBlock) {
|
||||
// Wrap the dashlet
|
||||
$oDashletWrapper = new DashletWrapper($oDashletBlock, $oDashlet->GetID(), $sDashletClass);
|
||||
$oDashletWrapper = new DashletWrapper($oDashletBlock, $sDashletClass, $oDashlet->GetID());
|
||||
$oPage->AddUiBlock($oDashletWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,9 @@ class XMLSerializer
|
||||
|
||||
public function Unserialize(DesignElement $oDOMNode, string $sId, string $sType): mixed
|
||||
{
|
||||
return null;
|
||||
$sPropertyTypeXML = PropertyTypeCompiler::GetInstance()->GetXMLContent($sId, $sType);
|
||||
|
||||
return $this->UnserializeForPropertyType($oDOMNode, $sPropertyTypeXML);
|
||||
}
|
||||
|
||||
public function SerializeForPropertyType(mixed $value, DesignElement $oParentNode, string $sPropertyTypeXML): void
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<ibo-dashlet class="grid-stack-item-content aa" data-dashlet-type="{{ oUIBlock.GetDashletClass() }}" data-dashlet-id="{{ oUIBlock.GetDashletId() }}">
|
||||
<ibo-dashlet class="grid-stack-item-content aa" data-dashlet-type="{{ oUIBlock.GetDashletClass() }}" data-dashlet-id="{{ oUIBlock.GetDashletId() }}" data-form-view-data="{{ oUIBlock.GetFormViewData()|json_encode }}">
|
||||
<div class="ibo-dashlet--actions">
|
||||
<button class="ibo-dashlet--action ibo-dashlet--action--edit ibo-button ibo-is-alternative ibo-is-neutral"
|
||||
title="Edit dashlet"
|
||||
|
||||
Reference in New Issue
Block a user