mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
Merge branch 'support/3.2' into develop
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base;
|
||||
|
||||
|
||||
/**
|
||||
* Class AbstractUIBlockFactory
|
||||
*
|
||||
@@ -46,4 +45,4 @@ abstract class AbstractUIBlockFactory implements iUIBlockFactory
|
||||
{
|
||||
return static::UI_BLOCK_CLASS_NAME;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Alert;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
@@ -254,10 +254,9 @@ class Alert extends UIContentBlock
|
||||
*/
|
||||
public function IsOpenedByDefault(): bool
|
||||
{
|
||||
if($this->IsCollapsible()) {
|
||||
if ($this->IsCollapsible()) {
|
||||
return $this->bIsOpenedByDefault;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -292,4 +291,4 @@ class Alert extends UIContentBlock
|
||||
return $this->sSectionStateStorageKey;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -158,4 +159,4 @@ class AlertUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
return new Alert($sTitle, $sContent, Alert::ENUM_COLOR_SCHEME_SECONDARY, $sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Breadcrumbs;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use MetaModel;
|
||||
use utils;
|
||||
@@ -90,8 +90,7 @@ class Breadcrumbs extends UIBlock
|
||||
$aJsWidgetOptions = [];
|
||||
|
||||
$iBreadCrumbMaxCount = utils::GetConfig()->Get('breadcrumb.max_count');
|
||||
if ($iBreadCrumbMaxCount > 1)
|
||||
{
|
||||
if ($iBreadCrumbMaxCount > 1) {
|
||||
$oConfig = MetaModel::GetConfig();
|
||||
$siTopInstanceId = $oConfig->GetItopInstanceid();
|
||||
|
||||
@@ -104,4 +103,4 @@ class Breadcrumbs extends UIBlock
|
||||
|
||||
return $aJsWidgetOptions;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Button;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ class Button extends UIBlock
|
||||
'js/components/button.js',
|
||||
];
|
||||
public const REQUIRES_ANCESTORS_DEFAULT_JS_FILES = true;
|
||||
|
||||
|
||||
// Specific constants
|
||||
/** @var string ENUM_ACTION_TYPE_REGULAR */
|
||||
public const ENUM_ACTION_TYPE_REGULAR = 'regular';
|
||||
@@ -271,4 +271,4 @@ class Button extends UIBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Button;
|
||||
|
||||
|
||||
/**
|
||||
* Class Button
|
||||
*
|
||||
@@ -66,19 +66,34 @@ class ButtonJS extends Button
|
||||
* @param string $sOnClickJsCode
|
||||
*/
|
||||
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_SCHEME, string $sJsCode = '',
|
||||
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_SCHEME,
|
||||
string $sJsCode = '',
|
||||
string $sOnClickJsCode = ''
|
||||
) {
|
||||
parent::__construct( $sLabel,$sId, $sTooltip, $sIconClass,
|
||||
$sActionType, $sColor, $sJsCode, $sOnClickJsCode);
|
||||
parent::__construct(
|
||||
$sLabel,
|
||||
$sId,
|
||||
$sTooltip,
|
||||
$sIconClass,
|
||||
$sActionType,
|
||||
$sColor,
|
||||
$sJsCode,
|
||||
$sOnClickJsCode
|
||||
);
|
||||
|
||||
$this->sName = $sName;
|
||||
$this->sValue = $sValue;
|
||||
$this->sType = $sType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -135,4 +150,4 @@ class ButtonJS extends Button
|
||||
$this->sValue = $sValue;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -149,8 +150,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_REGULAR, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_DESTRUCTIVE,
|
||||
Button::ENUM_ACTION_TYPE_REGULAR,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@@ -175,8 +183,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_NEUTRAL,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -198,8 +213,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_PRIMARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_PRIMARY,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -220,8 +242,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_SECONDARY, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_SECONDARY,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -242,8 +271,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_VALIDATION, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_VALIDATION,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -264,8 +300,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_DESTRUCTIVE, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_DESTRUCTIVE,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -289,8 +332,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
$sLabel = $sLabel ?? Dict::S('UI:Button:Cancel');
|
||||
$sName = $sName ?? 'cancel';
|
||||
|
||||
return static::MakeForAction($sLabel, Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
return static::MakeForAction(
|
||||
$sLabel,
|
||||
Button::ENUM_COLOR_SCHEME_NEUTRAL,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -311,8 +361,15 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
bool $bIsSubmit = false,
|
||||
?string $sId = null
|
||||
) {
|
||||
$oButton = static::MakeForAction('', Button::ENUM_COLOR_SCHEME_NEUTRAL, Button::ENUM_ACTION_TYPE_ALTERNATIVE, $sValue, $sName,
|
||||
$bIsSubmit, $sId);
|
||||
$oButton = static::MakeForAction(
|
||||
'',
|
||||
Button::ENUM_COLOR_SCHEME_NEUTRAL,
|
||||
Button::ENUM_ACTION_TYPE_ALTERNATIVE,
|
||||
$sValue,
|
||||
$sName,
|
||||
$bIsSubmit,
|
||||
$sId
|
||||
);
|
||||
$oButton->SetIconClass($sIconClasses);
|
||||
$oButton->SetTooltip($sTooltipText);
|
||||
|
||||
@@ -335,14 +392,17 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Button\Button
|
||||
*/
|
||||
public static function MakeLinkNeutral(
|
||||
string $sURL, ?string $sLabel = '', ?string $sIconClasses = null, ?string $sTarget = null,
|
||||
string $sURL,
|
||||
?string $sLabel = '',
|
||||
?string $sIconClasses = null,
|
||||
?string $sTarget = null,
|
||||
?string $sId = null
|
||||
) {
|
||||
if (empty($sTarget)) {
|
||||
$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_SCHEME_NEUTRAL, $sType, $sTarget, $sId);
|
||||
$oButton = static::MakeForLink($sLabel, $sURL, Button::ENUM_COLOR_SCHEME_NEUTRAL, $sType, $sTarget, $sId);
|
||||
|
||||
if (!empty($sIconClasses)) {
|
||||
$oButton->SetIconClass($sIconClasses);
|
||||
@@ -361,19 +421,22 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Button\ButtonURL
|
||||
*/
|
||||
public static function MakeIconLink(
|
||||
string $sIconClasses, string $sTooltipText, ?string $sURL = '', ?string $sTarget = null,
|
||||
string $sIconClasses,
|
||||
string $sTooltipText,
|
||||
?string $sURL = '',
|
||||
?string $sTarget = null,
|
||||
?string $sId = null
|
||||
) {
|
||||
if (empty($sTarget)) {
|
||||
$sTarget = ButtonURL::DEFAULT_TARGET;
|
||||
}
|
||||
$oButton = static::MakeForLink('', $sURL,Button::ENUM_COLOR_SCHEME_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);
|
||||
|
||||
return $oButton;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $sIconClasses
|
||||
* @param string $sTooltipText
|
||||
@@ -385,10 +448,14 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Button\Button
|
||||
*/
|
||||
public static function MakeDestructiveIconLink(
|
||||
string $sIconClasses, string $sTooltipText, ?string $sURL = null, ?string $sName = null, ?string $sTarget = null,
|
||||
string $sIconClasses,
|
||||
string $sTooltipText,
|
||||
?string $sURL = null,
|
||||
?string $sName = null,
|
||||
?string $sTarget = null,
|
||||
?string $sId = null
|
||||
) {
|
||||
$oButton = static::MakeIconLink($sIconClasses, $sTooltipText, $sURL, $sTarget, $sId);
|
||||
$oButton = static::MakeIconLink($sIconClasses, $sTooltipText, $sURL, $sTarget, $sId);
|
||||
$oButton->SetColor(Button::ENUM_COLOR_SCHEME_DESTRUCTIVE);
|
||||
$oButton->SetTooltip($sTooltipText);
|
||||
return $oButton;
|
||||
@@ -467,7 +534,7 @@ class ButtonUIBlockFactory extends AbstractUIBlockFactory
|
||||
$oButton = new ButtonURL($sLabel, $sURL, $sId, $sTarget);
|
||||
$oButton->SetActionType($sActionType)
|
||||
->SetColor($sColor);
|
||||
|
||||
|
||||
return $oButton;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Button;
|
||||
|
||||
|
||||
/**
|
||||
* Class Button
|
||||
*
|
||||
@@ -37,15 +37,14 @@ class ButtonURL extends Button
|
||||
/** @var string ENUM_TARGET_BLANK */
|
||||
public const ENUM_TARGET_BLANK = '_blank';
|
||||
/** @var string ENUM_TARGET_SELF */
|
||||
public const ENUM_TARGET_SELF= '_self';
|
||||
public const ENUM_TARGET_SELF = '_self';
|
||||
/** @var string ENUM_TARGET_PARENT */
|
||||
public const ENUM_TARGET_PARENT= '_parent';
|
||||
public const ENUM_TARGET_PARENT = '_parent';
|
||||
/** @var string ENUM_TARGET_TOP */
|
||||
public const ENUM_TARGET_TOP= '_top';
|
||||
public const ENUM_TARGET_TOP = '_top';
|
||||
/** @var string DEFAULT_TARGET */
|
||||
public const DEFAULT_TARGET = self::ENUM_TARGET_SELF;
|
||||
|
||||
|
||||
/** @var string */
|
||||
protected $sURL;
|
||||
/** @var string */
|
||||
@@ -66,12 +65,27 @@ class ButtonURL extends Button
|
||||
* @param string $sOnClickJsCode
|
||||
*/
|
||||
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_SCHEME, string $sJsCode = '',
|
||||
string $sOnClickJsCode = '')
|
||||
{
|
||||
parent::__construct($sLabel, $sId, $sTooltip, $sIconClass,
|
||||
$sActionType, $sColor, $sJsCode, $sOnClickJsCode);
|
||||
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_SCHEME,
|
||||
string $sJsCode = '',
|
||||
string $sOnClickJsCode = ''
|
||||
) {
|
||||
parent::__construct(
|
||||
$sLabel,
|
||||
$sId,
|
||||
$sTooltip,
|
||||
$sIconClass,
|
||||
$sActionType,
|
||||
$sColor,
|
||||
$sJsCode,
|
||||
$sOnClickJsCode
|
||||
);
|
||||
$this->sURL = $sURL;
|
||||
$this->sTarget = $sTarget;
|
||||
}
|
||||
@@ -86,7 +100,7 @@ class ButtonURL extends Button
|
||||
|
||||
/**
|
||||
* @param string $sURL
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetURL(string $sURL)
|
||||
@@ -105,7 +119,7 @@ class ButtonURL extends Button
|
||||
|
||||
/**
|
||||
* @param string $sTarget
|
||||
*
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetTarget(string $sTarget)
|
||||
@@ -113,4 +127,4 @@ class ButtonURL extends Button
|
||||
$this->sTarget = $sTarget;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\ButtonGroup;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\Button\Button;
|
||||
use Combodo\iTop\Application\UI\Base\iUIBlock;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
@@ -150,4 +150,4 @@ class ButtonGroup extends UIBlock
|
||||
{
|
||||
return array_merge($this->GetButtons(), $this->GetExtraBlocks());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -55,4 +56,4 @@ class ButtonGroupUIBlockFactory extends AbstractUIBlockFactory
|
||||
|
||||
return $oButtonGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\CollapsibleSection;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\tUIContentAreas;
|
||||
|
||||
@@ -99,4 +99,4 @@ class CollapsibleSection extends UIContentBlock
|
||||
{
|
||||
return $this->sSectionStateStorageKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\CollapsibleSection;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
/**
|
||||
@@ -36,4 +35,4 @@ class CollapsibleSectionUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
return new CollapsibleSection($sTitle, [], $sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\tJSRefreshCallback;
|
||||
use utils;
|
||||
|
||||
@@ -55,10 +54,14 @@ class DashletBadge extends DashletContainer
|
||||
* @param array $aRefreshParams
|
||||
*/
|
||||
public function __construct(
|
||||
string $sClassIconUrl, string $sHyperlink, string $iCount, string $sClassLabel, ?string $sCreateActionUrl = '',
|
||||
?string $sCreateActionLabel = '', array $aRefreshParams = []
|
||||
)
|
||||
{
|
||||
string $sClassIconUrl,
|
||||
string $sHyperlink,
|
||||
string $iCount,
|
||||
string $sClassLabel,
|
||||
?string $sCreateActionUrl = '',
|
||||
?string $sCreateActionLabel = '',
|
||||
array $aRefreshParams = []
|
||||
) {
|
||||
parent::__construct();
|
||||
|
||||
$this->sClassIconUrl = $sClassIconUrl;
|
||||
@@ -71,7 +74,6 @@ class DashletBadge extends DashletContainer
|
||||
$this->sClassDescription = '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -210,7 +212,7 @@ class DashletBadge extends DashletContainer
|
||||
public function SetClassDescription(string $sClassDescription)
|
||||
{
|
||||
$this->sClassDescription = $sClassDescription;
|
||||
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -236,4 +238,4 @@ class DashletBadge extends DashletContainer
|
||||
$('#".$this->sId."').unblock();";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
class DashletContainer extends UIContentBlock
|
||||
@@ -21,4 +20,4 @@ class DashletContainer extends UIContentBlock
|
||||
|
||||
$this->AddDataAttribute('role', static::BLOCK_CODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
/**
|
||||
* Class DashletFactory
|
||||
*
|
||||
@@ -33,4 +32,4 @@ class DashletFactory
|
||||
return new DashletPlainText($sText, $sId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
/**
|
||||
* Class DashletHeaderStatic
|
||||
*
|
||||
@@ -42,7 +41,6 @@ class DashletHeaderStatic extends DashletContainer
|
||||
$this->sIconUrl = $sIconUrl;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -82,4 +80,4 @@ class DashletHeaderStatic extends DashletContainer
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Dashlet;
|
||||
|
||||
|
||||
/**
|
||||
* Class DashletPlainText
|
||||
*
|
||||
@@ -56,4 +55,4 @@ class DashletPlainText extends DashletContainer
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\DataTable;
|
||||
|
||||
|
||||
use ApplicationContext;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\tJSRefreshCallback;
|
||||
@@ -63,7 +63,6 @@ class DataTable extends UIContentBlock
|
||||
|
||||
public const DEFAULT_ACTION_ROW_CONFIRMATION = true;
|
||||
|
||||
|
||||
/**
|
||||
* Panel constructor.
|
||||
*
|
||||
@@ -95,17 +94,14 @@ class DataTable extends UIContentBlock
|
||||
*/
|
||||
public function SetAjaxUrl(string $sAjaxUrl)
|
||||
{
|
||||
if (strlen($sAjaxUrl) > 0)
|
||||
{
|
||||
if (strlen($sAjaxUrl) > 0) {
|
||||
$oAppContext = new ApplicationContext();
|
||||
if(strpos ($sAjaxUrl,'?')) {
|
||||
if (strpos($sAjaxUrl, '?')) {
|
||||
$this->sAjaxUrl = $sAjaxUrl.$oAppContext->GetForLink(true);
|
||||
} else {
|
||||
$this->sAjaxUrl = $sAjaxUrl."?".$oAppContext->GetForLink();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->sAjaxUrl = $sAjaxUrl;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,4 +42,4 @@ class DataTableConfig extends UIContentBlock
|
||||
return $this->GetDataTable()->GetId();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,49 +23,49 @@ class DataTableSettings
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $aClassAliases;
|
||||
public $aClassAliases;
|
||||
/**
|
||||
* @var null|string
|
||||
*/
|
||||
public $sTableId;
|
||||
public $sTableId;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public $iDefaultPageSize;
|
||||
public $iDefaultPageSize;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $aColumns;
|
||||
public $aColumns;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $aSortOrder;
|
||||
|
||||
|
||||
/**
|
||||
* DataTableSettings constructor.
|
||||
*
|
||||
* @param $aClassAliases
|
||||
* @param null $sTableId
|
||||
*/
|
||||
public function __construct($aClassAliases, $sTableId = null)
|
||||
{
|
||||
$this->aClassAliases = $aClassAliases;
|
||||
$this->sTableId = $sTableId;
|
||||
$this->iDefaultPageSize = 10;
|
||||
$this->aColumns = array();
|
||||
}
|
||||
/**
|
||||
* DataTableSettings constructor.
|
||||
*
|
||||
* @param $aClassAliases
|
||||
* @param null $sTableId
|
||||
*/
|
||||
public function __construct($aClassAliases, $sTableId = null)
|
||||
{
|
||||
$this->aClassAliases = $aClassAliases;
|
||||
$this->sTableId = $sTableId;
|
||||
$this->iDefaultPageSize = 10;
|
||||
$this->aColumns = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public function __serialize() {
|
||||
public function __serialize()
|
||||
{
|
||||
return serialize([
|
||||
$this->aClassAliases,
|
||||
$this->sTableId,
|
||||
$this->iDefaultPageSize,
|
||||
$this->aColumns
|
||||
$this->aColumns,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -73,335 +73,343 @@ class DataTableSettings
|
||||
* @param $data
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public function __unserialize($data) {
|
||||
public function __unserialize($data)
|
||||
{
|
||||
list(
|
||||
$this->aClassAliases,
|
||||
$this->sTableId,
|
||||
$this->iDefaultPageSize,
|
||||
$this->aColumns
|
||||
) = unserialize($data);
|
||||
) = unserialize($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $iDefaultPageSize
|
||||
* @param $aSortOrder
|
||||
* @param $aColumns
|
||||
*/
|
||||
protected function Init($iDefaultPageSize, $aSortOrder, $aColumns)
|
||||
{
|
||||
$this->iDefaultPageSize = $iDefaultPageSize;
|
||||
$this->aColumns = $aColumns;
|
||||
$this->FixVisibleColumns();
|
||||
}
|
||||
/**
|
||||
* @param $iDefaultPageSize
|
||||
* @param $aSortOrder
|
||||
* @param $aColumns
|
||||
*/
|
||||
protected function Init($iDefaultPageSize, $aSortOrder, $aColumns)
|
||||
{
|
||||
$this->iDefaultPageSize = $iDefaultPageSize;
|
||||
$this->aColumns = $aColumns;
|
||||
$this->FixVisibleColumns();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
// Save only the 'visible' columns
|
||||
$aColumns = array();
|
||||
foreach ($this->aClassAliases as $sAlias => $sClass) {
|
||||
$aColumns[$sAlias] = array();
|
||||
if (isset($this->aColumns[$sAlias])) {
|
||||
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
|
||||
unset($aData['label']); // Don't save the display name
|
||||
unset($aData['alias']); // Don't save the alias (redundant)
|
||||
unset($aData['code']); // Don't save the code (redundant)
|
||||
if ($aData['checked']) {
|
||||
$aColumns[$sAlias][$sAttCode] = $aData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return serialize(
|
||||
array(
|
||||
'iDefaultPageSize' => $this->iDefaultPageSize,
|
||||
'aColumns' => $aColumns,
|
||||
)
|
||||
);
|
||||
}
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function serialize()
|
||||
{
|
||||
// Save only the 'visible' columns
|
||||
$aColumns = [];
|
||||
foreach ($this->aClassAliases as $sAlias => $sClass) {
|
||||
$aColumns[$sAlias] = [];
|
||||
if (isset($this->aColumns[$sAlias])) {
|
||||
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
|
||||
unset($aData['label']); // Don't save the display name
|
||||
unset($aData['alias']); // Don't save the alias (redundant)
|
||||
unset($aData['code']); // Don't save the code (redundant)
|
||||
if ($aData['checked']) {
|
||||
$aColumns[$sAlias][$sAttCode] = $aData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return serialize(
|
||||
[
|
||||
'iDefaultPageSize' => $this->iDefaultPageSize,
|
||||
'aColumns' => $aColumns,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sData
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function unserialize($sData)
|
||||
{
|
||||
$aData = unserialize($sData);
|
||||
$this->iDefaultPageSize = $aData['iDefaultPageSize'];
|
||||
$this->aColumns = $aData['aColumns'];
|
||||
foreach ($this->aClassAliases as $sAlias => $sClass) {
|
||||
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
|
||||
$aFieldData = false;
|
||||
if ($sAttCode == '_key_') {
|
||||
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, null, true /* bChecked */, $aData['sort']);
|
||||
} else if (MetaModel::isValidAttCode($sClass, $sAttCode)) {
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, $oAttDef, true /* bChecked */, $aData['sort']);
|
||||
}
|
||||
/**
|
||||
* @param string $sData
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function unserialize($sData)
|
||||
{
|
||||
$aData = unserialize($sData);
|
||||
$this->iDefaultPageSize = $aData['iDefaultPageSize'];
|
||||
$this->aColumns = $aData['aColumns'];
|
||||
foreach ($this->aClassAliases as $sAlias => $sClass) {
|
||||
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
|
||||
$aFieldData = false;
|
||||
if ($sAttCode == '_key_') {
|
||||
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, null, true /* bChecked */, $aData['sort']);
|
||||
} elseif (MetaModel::isValidAttCode($sClass, $sAttCode)) {
|
||||
$oAttDef = MetaModel::GetAttributeDef($sClass, $sAttCode);
|
||||
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, $oAttDef, true /* bChecked */, $aData['sort']);
|
||||
}
|
||||
|
||||
if ($aFieldData) {
|
||||
$this->aColumns[$sAlias][$sAttCode] = $aFieldData;
|
||||
} else {
|
||||
unset($this->aColumns[$sAlias][$sAttCode]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->FixVisibleColumns();
|
||||
}
|
||||
if ($aFieldData) {
|
||||
$this->aColumns[$sAlias][$sAttCode] = $aFieldData;
|
||||
} else {
|
||||
unset($this->aColumns[$sAlias][$sAttCode]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->FixVisibleColumns();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aClassAliases
|
||||
* @param $bViewLink
|
||||
* @param $aDefaultLists
|
||||
*
|
||||
* @return DataTableSettings
|
||||
* @throws \CoreException
|
||||
* @throws \DictExceptionMissingString
|
||||
*/
|
||||
public static function GetDataModelSettings($aClassAliases, $bViewLink, $aDefaultLists)
|
||||
{
|
||||
$oSettings = new DataTableSettings($aClassAliases);
|
||||
// Retrieve the class specific settings for each class/alias based on the 'list' ZList
|
||||
//TODO let the caller pass some other default settings (another Zlist, extre fields...)
|
||||
$aColumns = [];
|
||||
$aSortOrder = [];
|
||||
foreach ($aClassAliases as $sAlias => $sClass) {
|
||||
if ($aDefaultLists == null) {
|
||||
$aList = cmdbAbstractObject::FlattenZList(MetaModel::GetZListItems($sClass, 'list'));
|
||||
} else {
|
||||
$aList = $aDefaultLists[$sAlias];
|
||||
}
|
||||
/**
|
||||
* @param $aClassAliases
|
||||
* @param $bViewLink
|
||||
* @param $aDefaultLists
|
||||
*
|
||||
* @return DataTableSettings
|
||||
* @throws \CoreException
|
||||
* @throws \DictExceptionMissingString
|
||||
*/
|
||||
public static function GetDataModelSettings($aClassAliases, $bViewLink, $aDefaultLists)
|
||||
{
|
||||
$oSettings = new DataTableSettings($aClassAliases);
|
||||
// Retrieve the class specific settings for each class/alias based on the 'list' ZList
|
||||
//TODO let the caller pass some other default settings (another Zlist, extre fields...)
|
||||
$aColumns = [];
|
||||
$aSortOrder = [];
|
||||
foreach ($aClassAliases as $sAlias => $sClass) {
|
||||
if ($aDefaultLists == null) {
|
||||
$aList = cmdbAbstractObject::FlattenZList(MetaModel::GetZListItems($sClass, 'list'));
|
||||
} else {
|
||||
$aList = $aDefaultLists[$sAlias];
|
||||
}
|
||||
|
||||
$aSortOrder = MetaModel::GetOrderByDefault($sClass);
|
||||
if ($bViewLink) {
|
||||
$sSort = 'none';
|
||||
if (array_key_exists('friendlyname', $aSortOrder)) {
|
||||
$sSort = $aSortOrder['friendlyname'] ? 'asc' : 'desc';
|
||||
}
|
||||
$sNormalizedFName = MetaModel::NormalizeFieldSpec($sClass, 'friendlyname');
|
||||
if (array_key_exists($sNormalizedFName, $aSortOrder)) {
|
||||
$sSort = $aSortOrder[$sNormalizedFName] ? 'asc' : 'desc';
|
||||
}
|
||||
$aColumns[$sAlias]['_key_'] = $oSettings->GetFieldData($sAlias, '_key_', null, true /* bChecked */, $sSort);
|
||||
}
|
||||
$aSortOrder = MetaModel::GetOrderByDefault($sClass);
|
||||
if ($bViewLink) {
|
||||
$sSort = 'none';
|
||||
if (array_key_exists('friendlyname', $aSortOrder)) {
|
||||
$sSort = $aSortOrder['friendlyname'] ? 'asc' : 'desc';
|
||||
}
|
||||
$sNormalizedFName = MetaModel::NormalizeFieldSpec($sClass, 'friendlyname');
|
||||
if (array_key_exists($sNormalizedFName, $aSortOrder)) {
|
||||
$sSort = $aSortOrder[$sNormalizedFName] ? 'asc' : 'desc';
|
||||
}
|
||||
$aColumns[$sAlias]['_key_'] = $oSettings->GetFieldData($sAlias, '_key_', null, true /* bChecked */, $sSort);
|
||||
}
|
||||
|
||||
foreach ($aList as $sAttCode) {
|
||||
$sSort = 'none';
|
||||
if (array_key_exists($sAttCode, $aSortOrder)) {
|
||||
$sSort = $aSortOrder[$sAttCode] ? 'asc' : 'desc';
|
||||
}
|
||||
$oAttDef = Metamodel::GetAttributeDef($sClass, $sAttCode);
|
||||
$aFieldData = $oSettings->GetFieldData($sAlias, $sAttCode, $oAttDef, true /* bChecked */, $sSort);
|
||||
if ($aFieldData) $aColumns[$sAlias][$sAttCode] = $aFieldData;
|
||||
}
|
||||
}
|
||||
$iDefaultPageSize = appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit());
|
||||
$oSettings->Init($iDefaultPageSize, $aSortOrder, $aColumns);
|
||||
return $oSettings;
|
||||
}
|
||||
foreach ($aList as $sAttCode) {
|
||||
$sSort = 'none';
|
||||
if (array_key_exists($sAttCode, $aSortOrder)) {
|
||||
$sSort = $aSortOrder[$sAttCode] ? 'asc' : 'desc';
|
||||
}
|
||||
$oAttDef = Metamodel::GetAttributeDef($sClass, $sAttCode);
|
||||
$aFieldData = $oSettings->GetFieldData($sAlias, $sAttCode, $oAttDef, true /* bChecked */, $sSort);
|
||||
if ($aFieldData) {
|
||||
$aColumns[$sAlias][$sAttCode] = $aFieldData;
|
||||
}
|
||||
}
|
||||
}
|
||||
$iDefaultPageSize = appUserPreferences::GetPref('default_page_size', MetaModel::GetConfig()->GetMinDisplayLimit());
|
||||
$oSettings->Init($iDefaultPageSize, $aSortOrder, $aColumns);
|
||||
return $oSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \CoreException
|
||||
*/
|
||||
protected function FixVisibleColumns()
|
||||
{
|
||||
foreach ($this->aClassAliases as $sAlias => $sClass) {
|
||||
if (!isset($this->aColumns[$sAlias])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
|
||||
// Remove non-existent columns
|
||||
// TODO: check if the existing ones are still valid (in case their type changed)
|
||||
if (($sAttCode != '_key_') && (!MetaModel::IsValidAttCode($sClass, $sAttCode))) {
|
||||
unset($this->aColumns[$sAlias][$sAttCode]);
|
||||
}
|
||||
}
|
||||
$aList = MetaModel::ListAttributeDefs($sClass);
|
||||
/**
|
||||
* @throws \CoreException
|
||||
*/
|
||||
protected function FixVisibleColumns()
|
||||
{
|
||||
foreach ($this->aClassAliases as $sAlias => $sClass) {
|
||||
if (!isset($this->aColumns[$sAlias])) {
|
||||
continue;
|
||||
}
|
||||
foreach ($this->aColumns[$sAlias] as $sAttCode => $aData) {
|
||||
// Remove non-existent columns
|
||||
// TODO: check if the existing ones are still valid (in case their type changed)
|
||||
if (($sAttCode != '_key_') && (!MetaModel::IsValidAttCode($sClass, $sAttCode))) {
|
||||
unset($this->aColumns[$sAlias][$sAttCode]);
|
||||
}
|
||||
}
|
||||
$aList = MetaModel::ListAttributeDefs($sClass);
|
||||
|
||||
// Add the other (non visible ones), sorted in alphabetical order
|
||||
$aTempData = array();
|
||||
foreach ($aList as $sAttCode => $oAttDef) {
|
||||
if ((!array_key_exists($sAttCode, $this->aColumns[$sAlias])) && (!($oAttDef instanceof AttributeLinkedSet || $oAttDef instanceof AttributeDashboard))) {
|
||||
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, $oAttDef, false /* bChecked */, 'none');
|
||||
if ($aFieldData) $aTempData[$aFieldData['label']] = $aFieldData;
|
||||
}
|
||||
}
|
||||
ksort($aTempData);
|
||||
foreach ($aTempData as $sLabel => $aFieldData) {
|
||||
$this->aColumns[$sAlias][$aFieldData['code']] = $aFieldData;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add the other (non visible ones), sorted in alphabetical order
|
||||
$aTempData = [];
|
||||
foreach ($aList as $sAttCode => $oAttDef) {
|
||||
if ((!array_key_exists($sAttCode, $this->aColumns[$sAlias])) && (!($oAttDef instanceof AttributeLinkedSet || $oAttDef instanceof AttributeDashboard))) {
|
||||
$aFieldData = $this->GetFieldData($sAlias, $sAttCode, $oAttDef, false /* bChecked */, 'none');
|
||||
if ($aFieldData) {
|
||||
$aTempData[$aFieldData['label']] = $aFieldData;
|
||||
}
|
||||
}
|
||||
}
|
||||
ksort($aTempData);
|
||||
foreach ($aTempData as $sLabel => $aFieldData) {
|
||||
$this->aColumns[$sAlias][$aFieldData['code']] = $aFieldData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aClassAliases
|
||||
* @param null $sTableId
|
||||
* @param bool $bOnlyOnTable
|
||||
*
|
||||
* @return DataTableSettings|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
static public function GetTableSettings($aClassAliases, $sTableId = null, $bOnlyOnTable = false)
|
||||
{
|
||||
$pref = null;
|
||||
$oSettings = new DataTableSettings($aClassAliases, $sTableId);
|
||||
/**
|
||||
* @param $aClassAliases
|
||||
* @param null $sTableId
|
||||
* @param bool $bOnlyOnTable
|
||||
*
|
||||
* @return DataTableSettings|null
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function GetTableSettings($aClassAliases, $sTableId = null, $bOnlyOnTable = false)
|
||||
{
|
||||
$pref = null;
|
||||
$oSettings = new DataTableSettings($aClassAliases, $sTableId);
|
||||
|
||||
if ($sTableId != null) {
|
||||
// An identified table, let's fetch its own settings (if any)
|
||||
$pref = appUserPreferences::GetPref($oSettings->GetPrefsKey($sTableId), null);
|
||||
}
|
||||
if ($sTableId != null) {
|
||||
// An identified table, let's fetch its own settings (if any)
|
||||
$pref = appUserPreferences::GetPref($oSettings->GetPrefsKey($sTableId), null);
|
||||
}
|
||||
|
||||
if ($pref == null) {
|
||||
if (!$bOnlyOnTable) {
|
||||
// Try the global preferred values for this class / set of classes
|
||||
$pref = appUserPreferences::GetPref($oSettings->GetPrefsKey(null), null);
|
||||
}
|
||||
if ($pref == null) {
|
||||
// no such settings, use the default values provided by the data model
|
||||
return null;
|
||||
}
|
||||
}
|
||||
$oSettings->unserialize($pref);
|
||||
if ($pref == null) {
|
||||
if (!$bOnlyOnTable) {
|
||||
// Try the global preferred values for this class / set of classes
|
||||
$pref = appUserPreferences::GetPref($oSettings->GetPrefsKey(null), null);
|
||||
}
|
||||
if ($pref == null) {
|
||||
// no such settings, use the default values provided by the data model
|
||||
return null;
|
||||
}
|
||||
}
|
||||
$oSettings->unserialize($pref);
|
||||
|
||||
return $oSettings;
|
||||
}
|
||||
return $oSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function GetSortOrder()
|
||||
{
|
||||
$aSortOrder = array();
|
||||
foreach ($this->aColumns as $sAlias => $aColumns) {
|
||||
foreach ($aColumns as $aColumn) {
|
||||
if ($aColumn['sort'] != 'none') {
|
||||
$sCode = ($aColumn['code'] == '_key_') ? 'friendlyname' : $aColumn['code'];
|
||||
$aSortOrder[$sCode] = ($aColumn['sort'] == 'asc'); // true for ascending, false for descending
|
||||
}
|
||||
}
|
||||
break; // TODO: For now the Set object supports only sorting on the first class of the set
|
||||
}
|
||||
return $aSortOrder;
|
||||
}
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function GetSortOrder()
|
||||
{
|
||||
$aSortOrder = [];
|
||||
foreach ($this->aColumns as $sAlias => $aColumns) {
|
||||
foreach ($aColumns as $aColumn) {
|
||||
if ($aColumn['sort'] != 'none') {
|
||||
$sCode = ($aColumn['code'] == '_key_') ? 'friendlyname' : $aColumn['code'];
|
||||
$aSortOrder[$sCode] = ($aColumn['sort'] == 'asc'); // true for ascending, false for descending
|
||||
}
|
||||
}
|
||||
break; // TODO: For now the Set object supports only sorting on the first class of the set
|
||||
}
|
||||
return $aSortOrder;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $sTargetTableId
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function Save($sTargetTableId = null)
|
||||
{
|
||||
$sSaveId = is_null($sTargetTableId) ? $this->sTableId : $sTargetTableId;
|
||||
if ($sSaveId == null) return false; // Cannot save, the table is not identified, use SaveAsDefault instead
|
||||
/**
|
||||
* @param null $sTargetTableId
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function Save($sTargetTableId = null)
|
||||
{
|
||||
$sSaveId = is_null($sTargetTableId) ? $this->sTableId : $sTargetTableId;
|
||||
if ($sSaveId == null) {
|
||||
return false;
|
||||
} // Cannot save, the table is not identified, use SaveAsDefault instead
|
||||
|
||||
$sSettings = $this->serialize();
|
||||
appUserPreferences::SetPref($this->GetPrefsKey($sSaveId), $sSettings);
|
||||
return true;
|
||||
}
|
||||
$sSettings = $this->serialize();
|
||||
appUserPreferences::SetPref($this->GetPrefsKey($sSaveId), $sSettings);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function SaveAsDefault()
|
||||
{
|
||||
$sSettings = $this->serialize();
|
||||
appUserPreferences::SetPref($this->GetPrefsKey(null), $sSettings);
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function SaveAsDefault()
|
||||
{
|
||||
$sSettings = $this->serialize();
|
||||
appUserPreferences::SetPref($this->GetPrefsKey(null), $sSettings);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the preferences for this particular table
|
||||
* @param $bResetAll boolean If true,the settings for all tables of the same class(es)/alias(es) are reset
|
||||
*/
|
||||
public function ResetToDefault($bResetAll)
|
||||
{
|
||||
if (($this->sTableId == null) && (!$bResetAll)) {
|
||||
return false;
|
||||
} // Cannot reset, the table is not identified, use force $bResetAll instead
|
||||
if ($bResetAll) {
|
||||
// Turn the key into a suitable PCRE pattern
|
||||
$sKey = $this->GetPrefsKey(null);
|
||||
$sPattern = str_replace(['|'], ['\\|'], $sKey); // escape the | character
|
||||
$sPattern = '#^'.str_replace(['*'], ['.*'], $sPattern).'$#'; // Don't use slash as the delimiter since it's used in our key to delimit aliases
|
||||
appUserPreferences::UnsetPref($sPattern, true);
|
||||
} else {
|
||||
appUserPreferences::UnsetPref($this->GetPrefsKey($this->sTableId), false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the preferences for this particular table
|
||||
* @param $bResetAll boolean If true,the settings for all tables of the same class(es)/alias(es) are reset
|
||||
*/
|
||||
public function ResetToDefault($bResetAll)
|
||||
{
|
||||
if (($this->sTableId == null) && (!$bResetAll)) return false; // Cannot reset, the table is not identified, use force $bResetAll instead
|
||||
if ($bResetAll) {
|
||||
// Turn the key into a suitable PCRE pattern
|
||||
$sKey = $this->GetPrefsKey(null);
|
||||
$sPattern = str_replace(array('|'), array('\\|'), $sKey); // escape the | character
|
||||
$sPattern = '#^' . str_replace(array('*'), array('.*'), $sPattern) . '$#'; // Don't use slash as the delimiter since it's used in our key to delimit aliases
|
||||
appUserPreferences::UnsetPref($sPattern, true);
|
||||
} else {
|
||||
appUserPreferences::UnsetPref($this->GetPrefsKey($this->sTableId), false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @param null $sTableId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function GetPrefsKey($sTableId = null)
|
||||
{
|
||||
return static::GetAppUserPreferenceKey($this->aClassAliases, $sTableId);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param null $sTableId
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function GetPrefsKey($sTableId = null)
|
||||
{
|
||||
return static::GetAppUserPreferenceKey($this->aClassAliases, $sTableId);
|
||||
}
|
||||
public static function GetAppUserPreferenceKey($aClassAliases, $sTableId)
|
||||
{
|
||||
if ($sTableId === null) {
|
||||
$sTableId = '*';
|
||||
}
|
||||
|
||||
public static function GetAppUserPreferenceKey($aClassAliases, $sTableId)
|
||||
{
|
||||
if ($sTableId === null) {
|
||||
$sTableId = '*';
|
||||
}
|
||||
$aKeys = [];
|
||||
foreach ($aClassAliases as $sAlias => $sClass) {
|
||||
$aKeys[] = $sAlias.'-'.$sClass;
|
||||
}
|
||||
return implode('/', $aKeys).'|'.$sTableId;
|
||||
}
|
||||
|
||||
$aKeys = array();
|
||||
foreach ($aClassAliases as $sAlias => $sClass) {
|
||||
$aKeys[] = $sAlias . '-' . $sClass;
|
||||
}
|
||||
return implode('/', $aKeys) . '|' . $sTableId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sAlias
|
||||
* @param $sAttCode
|
||||
* @param $oAttDef
|
||||
* @param $bChecked
|
||||
* @param $sSort
|
||||
*
|
||||
* @return array|bool
|
||||
* @throws \CoreException
|
||||
* @throws \DictExceptionMissingString
|
||||
*/
|
||||
protected function GetFieldData($sAlias, $sAttCode, $oAttDef, $bChecked, $sSort)
|
||||
{
|
||||
$ret = false;
|
||||
if ($sAttCode == '_key_') {
|
||||
$sLabel = Dict::Format('UI:ExtKey_AsLink', MetaModel::GetName($this->aClassAliases[$sAlias]));
|
||||
$ret = array(
|
||||
'label' => $sLabel,
|
||||
'checked' => $bChecked,
|
||||
'disabled' => true,
|
||||
'alias' => $sAlias,
|
||||
'code' => $sAttCode,
|
||||
'sort' => $sSort,
|
||||
);
|
||||
} else if (!$oAttDef->IsLinkSet()) {
|
||||
$sLabel = $oAttDef->GetLabel();
|
||||
if ($oAttDef->IsExternalKey()) {
|
||||
$sLabel = Dict::Format('UI:ExtKey_AsLink', $oAttDef->GetLabel());
|
||||
} else if ($oAttDef->IsExternalField()) {
|
||||
if ($oAttDef->IsFriendlyName()) {
|
||||
$sLabel = Dict::Format('UI:ExtKey_AsFriendlyName', $oAttDef->GetLabel());
|
||||
} else {
|
||||
$oExtAttDef = $oAttDef->GetExtAttDef();
|
||||
$sLabel = Dict::Format('UI:ExtField_AsRemoteField', $oAttDef->GetLabel(), $oExtAttDef->GetLabel());
|
||||
}
|
||||
} elseif ($oAttDef instanceof AttributeFriendlyName) {
|
||||
$sLabel = Dict::Format('UI:ExtKey_AsFriendlyName', $oAttDef->GetLabel());
|
||||
}
|
||||
$ret = array(
|
||||
'label' => $sLabel,
|
||||
'checked' => $bChecked,
|
||||
'disabled' => false,
|
||||
'alias' => $sAlias,
|
||||
'code' => $sAttCode,
|
||||
'sort' => $sSort,
|
||||
);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param $sAlias
|
||||
* @param $sAttCode
|
||||
* @param $oAttDef
|
||||
* @param $bChecked
|
||||
* @param $sSort
|
||||
*
|
||||
* @return array|bool
|
||||
* @throws \CoreException
|
||||
* @throws \DictExceptionMissingString
|
||||
*/
|
||||
protected function GetFieldData($sAlias, $sAttCode, $oAttDef, $bChecked, $sSort)
|
||||
{
|
||||
$ret = false;
|
||||
if ($sAttCode == '_key_') {
|
||||
$sLabel = Dict::Format('UI:ExtKey_AsLink', MetaModel::GetName($this->aClassAliases[$sAlias]));
|
||||
$ret = [
|
||||
'label' => $sLabel,
|
||||
'checked' => $bChecked,
|
||||
'disabled' => true,
|
||||
'alias' => $sAlias,
|
||||
'code' => $sAttCode,
|
||||
'sort' => $sSort,
|
||||
];
|
||||
} elseif (!$oAttDef->IsLinkSet()) {
|
||||
$sLabel = $oAttDef->GetLabel();
|
||||
if ($oAttDef->IsExternalKey()) {
|
||||
$sLabel = Dict::Format('UI:ExtKey_AsLink', $oAttDef->GetLabel());
|
||||
} elseif ($oAttDef->IsExternalField()) {
|
||||
if ($oAttDef->IsFriendlyName()) {
|
||||
$sLabel = Dict::Format('UI:ExtKey_AsFriendlyName', $oAttDef->GetLabel());
|
||||
} else {
|
||||
$oExtAttDef = $oAttDef->GetExtAttDef();
|
||||
$sLabel = Dict::Format('UI:ExtField_AsRemoteField', $oAttDef->GetLabel(), $oExtAttDef->GetLabel());
|
||||
}
|
||||
} elseif ($oAttDef instanceof AttributeFriendlyName) {
|
||||
$sLabel = Dict::Format('UI:ExtKey_AsFriendlyName', $oAttDef->GetLabel());
|
||||
}
|
||||
$ret = [
|
||||
'label' => $sLabel,
|
||||
'checked' => $bChecked,
|
||||
'disabled' => false,
|
||||
'alias' => $sAlias,
|
||||
'code' => $sAttCode,
|
||||
'sort' => $sSort,
|
||||
];
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTable;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTableRow\FormTableRow;
|
||||
use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\StaticTable;
|
||||
use Combodo\iTop\Application\UI\Base\Component\DataTable\tTableRowActions;
|
||||
@@ -67,4 +67,4 @@ class FormTable extends StaticTable
|
||||
$this->aRows[] = $oRow;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\FormTableRow;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -136,4 +136,4 @@ class FormTableRow extends UIBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,4 +201,4 @@ class StaticTable extends UIContentBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -20,7 +21,7 @@ use Combodo\iTop\Application\UI\Base\Component\Dialog\DialogUIBlockFactory;
|
||||
trait tTableRowActions
|
||||
{
|
||||
/** @var bool static dialog initialized flag to avoid multiple html markups */
|
||||
static public bool $bDialogInitialized = false;
|
||||
public static bool $bDialogInitialized = false;
|
||||
|
||||
/**
|
||||
* @var $aRowActions array array of row actions
|
||||
@@ -81,4 +82,4 @@ trait tTableRowActions
|
||||
{
|
||||
return DataTableUIBlockFactory::MakeActionRowToolbarTemplate($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Field;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use utils;
|
||||
@@ -390,4 +390,4 @@ class Field extends UIContentBlock
|
||||
{
|
||||
return utils::IsNotNullOrEmptyString($this->GetDescription());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Field;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
@@ -150,4 +150,4 @@ class FieldUIBlockFactory extends AbstractUIBlockFactory
|
||||
return $oField;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\FieldBadge;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
/**
|
||||
@@ -23,4 +23,4 @@ class FieldBadge extends UIContentBlock
|
||||
{
|
||||
parent::__construct($sId, $aContainerClasses);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\FieldBadge;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
use ormStyle;
|
||||
use utils;
|
||||
@@ -62,4 +61,4 @@ class FieldBadgeUIBlockFactory extends AbstractUIBlockFactory
|
||||
$oBadge->AddHtml($sHtml);
|
||||
return $oBadge;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\FieldSet;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
/**
|
||||
@@ -42,5 +42,5 @@ class FieldSet extends UIContentBlock
|
||||
{
|
||||
return $this->sLegend;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\FieldSet;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
/**
|
||||
@@ -36,4 +35,4 @@ class FieldSetUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
return new FieldSet($sLegend, $sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Form;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
/**
|
||||
@@ -65,4 +65,4 @@ class Form extends UIContentBlock
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Form;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
/**
|
||||
@@ -35,4 +34,4 @@ class FormUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
return new Form($sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\GlobalSearch;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Combodo\iTop\Application\UI\Hook\iKeyboardShortcut;
|
||||
use MetaModel;
|
||||
@@ -183,4 +183,4 @@ class GlobalSearch extends UIBlock implements iKeyboardShortcut
|
||||
{
|
||||
return "[data-role='".static::BLOCK_CODE."']";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\GlobalSearch;
|
||||
|
||||
|
||||
/**
|
||||
* Class GlobalSearchFactory
|
||||
*
|
||||
@@ -45,4 +45,4 @@ class GlobalSearchFactory
|
||||
|
||||
return new GlobalSearch($aLastClasses, GlobalSearch::BLOCK_CODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\GlobalSearch;
|
||||
|
||||
|
||||
use appUserPreferences;
|
||||
use MetaModel;
|
||||
use utils;
|
||||
@@ -59,15 +59,13 @@ class GlobalSearchHelper
|
||||
];
|
||||
|
||||
// Set icon only when necessary
|
||||
if (!empty($sIconRelUrl))
|
||||
{
|
||||
if (!empty($sIconRelUrl)) {
|
||||
//Ensure URL is relative to limit space in the preferences and avoid broken links in case app_root_url changes
|
||||
$aNewEntry['icon_url'] = str_replace(utils::GetAbsoluteUrlAppRoot(), '', $sIconRelUrl);
|
||||
}
|
||||
|
||||
// Set label only when necessary to avoid unnecessary space filling of the preferences in the DB
|
||||
if(!empty($sLabelAsHtml))
|
||||
{
|
||||
if (!empty($sLabelAsHtml)) {
|
||||
$aNewEntry['label_html'] = $sLabelAsHtml;
|
||||
}
|
||||
|
||||
@@ -75,10 +73,8 @@ class GlobalSearchHelper
|
||||
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
|
||||
|
||||
// Remove same query from history to avoid duplicates
|
||||
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++)
|
||||
{
|
||||
if($aHistoryEntries[$iIdx]['query'] === $sQuery)
|
||||
{
|
||||
for ($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++) {
|
||||
if ($aHistoryEntries[$iIdx]['query'] === $sQuery) {
|
||||
unset($aHistoryEntries[$iIdx]);
|
||||
}
|
||||
}
|
||||
@@ -107,21 +103,21 @@ class GlobalSearchHelper
|
||||
$aHistoryEntries = appUserPreferences::GetPref(static::USER_PREF_CODE, []);
|
||||
static::TruncateHistory($aHistoryEntries);
|
||||
|
||||
for($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++){
|
||||
for ($iIdx = 0; $iIdx < count($aHistoryEntries); $iIdx++) {
|
||||
$sRawQuery = $aHistoryEntries[$iIdx]['query'];
|
||||
|
||||
// Make icon URL absolute
|
||||
if(isset($aHistoryEntries[$iIdx]['icon_url'])){
|
||||
if (isset($aHistoryEntries[$iIdx]['icon_url'])) {
|
||||
$aHistoryEntries[$iIdx]['icon_url'] = utils::GetAbsoluteUrlAppRoot().$aHistoryEntries[$iIdx]['icon_url'];
|
||||
}
|
||||
|
||||
// Add HTML label if missing
|
||||
if(!isset($aHistoryEntries[$iIdx]['label_html'])) {
|
||||
if (!isset($aHistoryEntries[$iIdx]['label_html'])) {
|
||||
$aHistoryEntries[$iIdx]['label_html'] = utils::EscapeHtml($sRawQuery);
|
||||
}
|
||||
|
||||
// Add URL
|
||||
if(!isset($aHistoryEntries[$iIdx]['target_url'])){
|
||||
if (!isset($aHistoryEntries[$iIdx]['target_url'])) {
|
||||
$aHistoryEntries[$iIdx]['target_url'] = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=full_text&text='.urlencode($sRawQuery);
|
||||
}
|
||||
}
|
||||
@@ -137,9 +133,8 @@ class GlobalSearchHelper
|
||||
protected static function TruncateHistory(array &$aHistoryEntries): void
|
||||
{
|
||||
$iMaxHistoryResults = (int) MetaModel::GetConfig()->Get('global_search.max_history_results');
|
||||
if(count($aHistoryEntries) > $iMaxHistoryResults)
|
||||
{
|
||||
if (count($aHistoryEntries) > $iMaxHistoryResults) {
|
||||
$aHistoryEntries = array_slice($aHistoryEntries, 0, $iMaxHistoryResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Html;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -87,4 +87,4 @@ class Html extends UIBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Html;
|
||||
|
||||
|
||||
/**
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Html
|
||||
* @since 3.0.0
|
||||
@@ -62,4 +62,4 @@ class HtmlFactory
|
||||
{
|
||||
return new Html('<div class="ibo-is-html-content">'.$sContent.'</div>');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -76,4 +76,4 @@ abstract class AbstractInput extends UIBlock
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input\FileSelect;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Dict;
|
||||
|
||||
@@ -103,5 +102,5 @@ class FileSelect extends UIBlock
|
||||
{
|
||||
return $this->bShowFilename;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input\FileSelect;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
/**
|
||||
@@ -36,4 +35,4 @@ class FileSelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
return new FileSelect($sName, $sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
||||
|
||||
|
||||
/**
|
||||
* Class Input
|
||||
*
|
||||
@@ -21,7 +21,7 @@ class Input extends AbstractInput
|
||||
public const INPUT_HIDDEN = 'hidden';
|
||||
|
||||
protected $bIsChecked = false;
|
||||
|
||||
|
||||
protected $bIsDisabled = false;
|
||||
protected $bIsReadonly = false;
|
||||
|
||||
@@ -128,4 +128,4 @@ class Input extends AbstractInput
|
||||
{
|
||||
return !is_null($this->sLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Field\Field;
|
||||
|
||||
@@ -78,10 +77,12 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Input\InputWithLabel
|
||||
*/
|
||||
public static function MakeForInputWithLabel(
|
||||
string $sLabel, string $sInputName, ?string $sInputValue = null,
|
||||
?string $sInputId = null, string $sInputType = 'type'
|
||||
)
|
||||
{
|
||||
string $sLabel,
|
||||
string $sInputName,
|
||||
?string $sInputValue = null,
|
||||
?string $sInputId = null,
|
||||
string $sInputType = 'type'
|
||||
) {
|
||||
$oInput = new Input($sInputId);
|
||||
$oInput->SetType($sInputType);
|
||||
$oInput->SetValue($sInputValue);
|
||||
@@ -109,4 +110,4 @@ class InputUIBlockFactory extends AbstractUIBlockFactory
|
||||
|
||||
return new InputWithLabel($sLabel, $oInput, $sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use utils;
|
||||
|
||||
@@ -142,4 +141,4 @@ class InputWithLabel extends UIBlock
|
||||
{
|
||||
return [$this->oInput->GetId() => $this->oInput];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input\RichText;
|
||||
|
||||
use Combodo\iTop\Application\Helper\CKEditorHelper;
|
||||
use Combodo\iTop\Application\Helper\WebResourcesHelper;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
@@ -83,7 +86,7 @@ class RichText extends UIBlock
|
||||
public function SetValue(?string $sValue)
|
||||
{
|
||||
$this->sValue = $sValue;
|
||||
if(is_array($this->aConfig)) {
|
||||
if (is_array($this->aConfig)) {
|
||||
$this->aConfig['detectChanges'] = ['initialValue' => $sValue];
|
||||
}
|
||||
|
||||
@@ -111,4 +114,4 @@ class RichText extends UIBlock
|
||||
{
|
||||
return $this->aConfig;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input\Select;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\tInputLabel;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
@@ -26,7 +25,6 @@ class Select extends UIContentBlock
|
||||
/** @var bool Allow multiple selection */
|
||||
protected $bIsMultiple = false;
|
||||
|
||||
|
||||
public function __construct(?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
@@ -95,4 +93,4 @@ class Select extends UIContentBlock
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input\Select;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
class SelectOption extends UIBlock
|
||||
@@ -80,8 +79,8 @@ class SelectOption extends UIBlock
|
||||
{
|
||||
$this->bSelected = $bSelected;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
@@ -101,4 +100,4 @@ class SelectOption extends UIBlock
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input\Select;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
/**
|
||||
@@ -45,4 +44,4 @@ class SelectOptionUIBlockFactory extends AbstractUIBlockFactory
|
||||
|
||||
return $oInput;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input\Select;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Input\Select\Select;
|
||||
|
||||
@@ -64,4 +63,4 @@ class SelectUIBlockFactory extends AbstractUIBlockFactory
|
||||
return $oInput;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -156,5 +157,4 @@ abstract class AbstractDataProvider implements iDataProvider
|
||||
return $this->GetType() === iDataProvider::TYPE_SIMPLE_PROVIDER;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -28,7 +29,7 @@ namespace Combodo\iTop\Application\UI\Base\Component\Input\Set\DataProvider;
|
||||
class AjaxDataProvider extends SimpleDataProvider
|
||||
{
|
||||
/** @var int DEFAULT_MAX_RESULTS maximum results fetched */
|
||||
const DEFAULT_MAX_RESULTS = 25;
|
||||
public const DEFAULT_MAX_RESULTS = 25;
|
||||
|
||||
/**
|
||||
* @see \Combodo\iTop\Service\Router\Router
|
||||
@@ -45,7 +46,6 @@ class AjaxDataProvider extends SimpleDataProvider
|
||||
/** @var int $iMaxResults Maximum entries */
|
||||
private int $iMaxResults = AjaxDataProvider::DEFAULT_MAX_RESULTS;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -166,4 +166,4 @@ class AjaxDataProvider extends SimpleDataProvider
|
||||
return $this->iMaxResults;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -27,7 +28,6 @@ namespace Combodo\iTop\Application\UI\Base\Component\Input\Set\DataProvider;
|
||||
*/
|
||||
class AjaxDataProviderForOQL extends AjaxDataProvider
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
@@ -62,4 +62,4 @@ class AjaxDataProviderForOQL extends AjaxDataProvider
|
||||
->SetDataSearchFields(['friendlyname', 'additional_field']);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -92,4 +93,4 @@ class SimpleDataProvider extends AbstractDataProvider
|
||||
|
||||
return array_values($aGroups);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -142,4 +143,4 @@ interface iDataProvider
|
||||
* @return $this
|
||||
*/
|
||||
public function SetTooltipField(string $sField): iDataProvider;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -54,7 +55,6 @@ class Set extends AbstractInput
|
||||
|
||||
private ?int $iMinItems;
|
||||
|
||||
|
||||
/** @var int|null $iMaxItem Maximum number of displayed options */
|
||||
private ?int $iMaxOptions;
|
||||
|
||||
@@ -608,4 +608,4 @@ class Set extends AbstractInput
|
||||
$this->bIsDisabled = $bIsDisabled;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -157,4 +158,4 @@ class SetUIBlockFactory extends AbstractUIBlockFactory
|
||||
|
||||
return $oSetUIBlock;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
||||
|
||||
|
||||
/**
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Input
|
||||
*/
|
||||
@@ -88,5 +88,4 @@ class TextArea extends AbstractInput
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,25 +7,23 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
||||
|
||||
|
||||
/**
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\Input
|
||||
* @since 3.2.0
|
||||
*/
|
||||
class Toggler extends Input {
|
||||
|
||||
class Toggler extends Input
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-toggler';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/input/input-toggler';
|
||||
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'base/components/input/input-toggler';
|
||||
|
||||
|
||||
public function __construct(?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->SetType('checkbox');
|
||||
}
|
||||
|
||||
|
||||
public function SetIsToggled(bool $bIsToggled): static
|
||||
{
|
||||
return $this->SetIsChecked($bIsToggled);
|
||||
@@ -34,4 +33,4 @@ class Toggler extends Input {
|
||||
{
|
||||
return $this->IsChecked();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Input;
|
||||
|
||||
use utils;
|
||||
@@ -122,4 +122,4 @@ trait tInputLabel
|
||||
{
|
||||
return utils::StrLen($this->sDescription) > 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\MedallionIcon;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -38,7 +38,7 @@ class MedallionIcon extends UIBlock
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->sImageUrl = $sImageUrl;
|
||||
$this->sIconClass= $sIconClass;
|
||||
$this->sIconClass = $sIconClass;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,7 +78,7 @@ class MedallionIcon extends UIBlock
|
||||
$this->sIconClass = $sIconClass;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -97,5 +97,5 @@ class MedallionIcon extends UIBlock
|
||||
$this->sDescription = $sDescription;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -56,4 +57,4 @@ class DoNotShowAgainOptionBlock extends UIContentBlock
|
||||
$oCheckBox->SetLabel(Dict::S('UI:UserPref:DoNotShowAgain'));
|
||||
$this->AddSubBlock($oCheckBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Panel;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\Html\Html;
|
||||
use Combodo\iTop\Application\UI\Base\iUIBlock;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\iUIContentBlock;
|
||||
@@ -518,7 +518,8 @@ class Panel extends UIContentBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetMainBlocks(array $aBlocks) {
|
||||
public function SetMainBlocks(array $aBlocks)
|
||||
{
|
||||
$this->SetContentAreaBlocks(static::ENUM_CONTENT_AREA_MAIN, $aBlocks);
|
||||
|
||||
return $this;
|
||||
@@ -530,7 +531,8 @@ class Panel extends UIContentBlock
|
||||
* @return \Combodo\iTop\Application\UI\Base\iUIBlock[]
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetMainBlocks(): array {
|
||||
public function GetMainBlocks(): array
|
||||
{
|
||||
return $this->GetContentAreaBlocks(static::ENUM_CONTENT_AREA_MAIN);
|
||||
}
|
||||
|
||||
@@ -586,7 +588,8 @@ class Panel extends UIContentBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetToolBlocks(array $aBlocks) {
|
||||
public function SetToolBlocks(array $aBlocks)
|
||||
{
|
||||
$this->SetContentAreaBlocks(static::ENUM_CONTENT_AREA_TOOLBAR, $aBlocks);
|
||||
|
||||
return $this;
|
||||
@@ -598,7 +601,8 @@ class Panel extends UIContentBlock
|
||||
* @return \Combodo\iTop\Application\UI\Base\iUIBlock[]
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetToolbarBlocks(): array {
|
||||
public function GetToolbarBlocks(): array
|
||||
{
|
||||
return $this->GetContentAreaBlocks(static::ENUM_CONTENT_AREA_TOOLBAR);
|
||||
}
|
||||
|
||||
@@ -654,7 +658,8 @@ class Panel extends UIContentBlock
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function AddHtml(string $sHtml) {
|
||||
public function AddHtml(string $sHtml)
|
||||
{
|
||||
$oBlock = new Html($sHtml);
|
||||
$this->AddMainBlock($oBlock);
|
||||
|
||||
@@ -666,7 +671,8 @@ class Panel extends UIContentBlock
|
||||
*
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function AddSubBlock(?iUIBlock $oSubBlock) {
|
||||
public function AddSubBlock(?iUIBlock $oSubBlock)
|
||||
{
|
||||
if ($oSubBlock) {
|
||||
$this->AddMainBlock($oSubBlock);
|
||||
}
|
||||
@@ -680,7 +686,8 @@ class Panel extends UIContentBlock
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function RemoveSubBlock(string $sId) {
|
||||
public function RemoveSubBlock(string $sId)
|
||||
{
|
||||
foreach ($this->GetContentAreas() as $oContentArea) {
|
||||
$oContentArea->RemoveSubBlock($sId);
|
||||
}
|
||||
@@ -695,7 +702,8 @@ class Panel extends UIContentBlock
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function HasSubBlock(string $sId): bool {
|
||||
public function HasSubBlock(string $sId): bool
|
||||
{
|
||||
foreach ($this->GetContentAreas() as $oContentArea) {
|
||||
if ($oContentArea->HasSubBlock($sId)) {
|
||||
return true;
|
||||
@@ -710,7 +718,8 @@ class Panel extends UIContentBlock
|
||||
*
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function GetSubBlock(string $sId): ?iUIBlock {
|
||||
public function GetSubBlock(string $sId): ?iUIBlock
|
||||
{
|
||||
foreach ($this->GetContentAreas() as $oContentArea) {
|
||||
$oSubBlock = $oContentArea->GetSubBlock($sId);
|
||||
if (!is_null($oSubBlock)) {
|
||||
@@ -727,7 +736,8 @@ class Panel extends UIContentBlock
|
||||
* @inheritDoc
|
||||
* @return $this|\Combodo\iTop\Application\UI\Base\Layout\iUIContentBlock
|
||||
*/
|
||||
public function SetSubBlocks(array $aSubBlocks): iUIContentBlock {
|
||||
public function SetSubBlocks(array $aSubBlocks): iUIContentBlock
|
||||
{
|
||||
$this->SetMainBlocks($aSubBlocks);
|
||||
|
||||
return $this;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -218,4 +219,4 @@ class PanelUIBlockFactory extends AbstractUIBlockFactory
|
||||
|
||||
return $oPanel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Pill;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
/**
|
||||
@@ -142,4 +141,4 @@ class Pill extends UIContentBlock
|
||||
{
|
||||
return !empty($this->sTooltip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Pill;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Helper\UIHelper;
|
||||
use MetaModel;
|
||||
|
||||
@@ -42,4 +41,4 @@ class PillFactory
|
||||
|
||||
return $oPill;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\NewsroomMenu;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu;
|
||||
|
||||
/**
|
||||
@@ -65,4 +65,4 @@ class NewsroomMenu extends PopoverMenu
|
||||
{
|
||||
return json_encode($this->aParams);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -62,17 +63,17 @@ class NewsroomMenuFactory
|
||||
*/
|
||||
protected static function PrepareParametersForNewsroomMenu()
|
||||
{
|
||||
$aProviderParams=[];
|
||||
$aProviderParams = [];
|
||||
$oUser = UserRights::GetUserObject();
|
||||
/** @var iNewsroomProvider[] $aProviders */
|
||||
$aProviders = InterfaceDiscovery::GetInstance()->FindItopClasses(iNewsroomProvider::class);
|
||||
foreach($aProviders as $cProvider) {
|
||||
foreach ($aProviders as $cProvider) {
|
||||
$oProvider = new $cProvider();
|
||||
$oConfig = MetaModel::GetConfig();
|
||||
$oProvider->SetConfig($oConfig);
|
||||
$bProviderEnabled = appUserPreferences::GetPref('newsroom_provider_'.get_class($oProvider), true);
|
||||
if ($bProviderEnabled && $oProvider->IsApplicable($oUser)) {
|
||||
$aProviderParams[] = array(
|
||||
$aProviderParams[] = [
|
||||
'label' => $oProvider->GetLabel(),
|
||||
'fetch_url' => $oProvider->GetFetchURL(),
|
||||
'target' => utils::StartsWith($oProvider->GetFetchURL(), $oConfig->Get('app_root_url')) ? '_self' : '_blank',
|
||||
@@ -80,25 +81,25 @@ class NewsroomMenuFactory
|
||||
'mark_all_as_read_url' => $oProvider->GetMarkAllAsReadURL(),
|
||||
'placeholders' => $oProvider->GetPlaceholders(),
|
||||
'ttl' => $oProvider->GetTTL(),
|
||||
);
|
||||
];
|
||||
}
|
||||
}
|
||||
$sImageUrl= 'fas fa-comment-dots';
|
||||
$sPlaceholderImageUrl= 'far fa-envelope';
|
||||
$aParams = array(
|
||||
$sImageUrl = 'fas fa-comment-dots';
|
||||
$sPlaceholderImageUrl = 'far fa-envelope';
|
||||
$aParams = [
|
||||
'image_icon' => $sImageUrl,
|
||||
'no_message_icon' => file_get_contents(APPROOT.'images/illustrations/undraw_social_serenity.svg'),
|
||||
'placeholder_image_icon' => $sPlaceholderImageUrl,
|
||||
'cache_uuid' => 'itop-newsroom-'.UserRights::GetUserId().'-'.md5(APPROOT),
|
||||
'providers' => $aProviderParams,
|
||||
'display_limit' => (int)appUserPreferences::GetPref('newsroom_display_size', 7),
|
||||
'labels' => array(
|
||||
'labels' => [
|
||||
'no_notification' => 'UI:Newsroom:NoNewMessage',
|
||||
'x_notifications' => 'UI:Newsroom:XNewMessage',
|
||||
'mark_all_as_read' => 'UI:Newsroom:MarkAllAsRead',
|
||||
'view_all' => 'UI:Newsroom:ViewAllMessages'
|
||||
),
|
||||
);
|
||||
'view_all' => 'UI:Newsroom:ViewAllMessages',
|
||||
],
|
||||
];
|
||||
return $aParams;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem\PopoverMenuItem;
|
||||
use Combodo\iTop\Application\UI\Base\iUIBlock;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
@@ -336,8 +336,7 @@ class PopoverMenu extends UIBlock
|
||||
*/
|
||||
public function AddSection(string $sId)
|
||||
{
|
||||
if (false === $this->HasSection($sId))
|
||||
{
|
||||
if (false === $this->HasSection($sId)) {
|
||||
$this->aSections[$sId] = [
|
||||
'aItems' => [],
|
||||
];
|
||||
@@ -357,8 +356,7 @@ class PopoverMenu extends UIBlock
|
||||
*/
|
||||
public function RemoveSection(string $sId)
|
||||
{
|
||||
if (true === $this->HasSection($sId))
|
||||
{
|
||||
if (true === $this->HasSection($sId)) {
|
||||
unset($this->aSections[$sId]);
|
||||
}
|
||||
|
||||
@@ -387,8 +385,7 @@ class PopoverMenu extends UIBlock
|
||||
*/
|
||||
public function ClearSection(string $sId)
|
||||
{
|
||||
if (false === $this->HasSection($sId))
|
||||
{
|
||||
if (false === $this->HasSection($sId)) {
|
||||
throw new Exception('Could not clear section "'.$sId.'" as it does not exist in the "'.$this->GetId().'" menu');
|
||||
}
|
||||
|
||||
@@ -448,13 +445,11 @@ class PopoverMenu extends UIBlock
|
||||
*/
|
||||
public function RemoveItem(string $sSectionId, string $sItemId)
|
||||
{
|
||||
if (false === $this->HasSection($sSectionId))
|
||||
{
|
||||
if (false === $this->HasSection($sSectionId)) {
|
||||
throw new Exception('Could not remove en item from the "'.$sSectionId.'" as it does not seem to exist in the "'.$this->GetId().'" menu.');
|
||||
}
|
||||
|
||||
if (array_key_exists($sItemId, $this->aSections[$sSectionId]['aItems']))
|
||||
{
|
||||
if (array_key_exists($sItemId, $this->aSections[$sSectionId]['aItems'])) {
|
||||
unset($this->aSections[$sSectionId]['aItems'][$sItemId]);
|
||||
}
|
||||
|
||||
@@ -472,7 +467,7 @@ class PopoverMenu extends UIBlock
|
||||
*/
|
||||
public function AddItems(string $sSectionId, array $aItems)
|
||||
{
|
||||
foreach($aItems as $oItem){
|
||||
foreach ($aItems as $oItem) {
|
||||
$this->AddItem($sSectionId, $oItem);
|
||||
}
|
||||
|
||||
@@ -525,12 +520,11 @@ class PopoverMenu extends UIBlock
|
||||
$aSubBlocks = [];
|
||||
|
||||
foreach ($this->aSections as $sSectionId => $aSectionData) {
|
||||
foreach($aSectionData['aItems'] as $sItemId => $oItem)
|
||||
{
|
||||
foreach ($aSectionData['aItems'] as $sItemId => $oItem) {
|
||||
$aSubBlocks[$sItemId] = $oItem;
|
||||
}
|
||||
}
|
||||
|
||||
return $aSubBlocks;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,8 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu;
|
||||
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem\PopoverMenuItemFactory;
|
||||
use Dict;
|
||||
use JSPopupMenuItem;
|
||||
@@ -80,7 +79,7 @@ class PopoverMenuFactory
|
||||
|
||||
return $oMenu;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the allowed portals items for the current user
|
||||
*
|
||||
@@ -89,10 +88,8 @@ class PopoverMenuFactory
|
||||
protected static function PrepareAllowedPortalsItemsForUserMenu()
|
||||
{
|
||||
$aItems = [];
|
||||
foreach (UserRights::GetAllowedPortals() as $aAllowedPortal)
|
||||
{
|
||||
if ($aAllowedPortal['id'] !== 'backoffice')
|
||||
{
|
||||
foreach (UserRights::GetAllowedPortals() as $aAllowedPortal) {
|
||||
if ($aAllowedPortal['id'] !== 'backoffice') {
|
||||
$oPopupMenuItem = new URLPopupMenuItem(
|
||||
'portal:'.$aAllowedPortal['id'],
|
||||
Dict::S($aAllowedPortal['label']),
|
||||
@@ -127,8 +124,7 @@ class PopoverMenuFactory
|
||||
);
|
||||
|
||||
// Archive mode
|
||||
if(true === utils::IsArchiveMode())
|
||||
{
|
||||
if (true === utils::IsArchiveMode()) {
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new JSPopupMenuItem(
|
||||
'UI:ArchiveModeOff',
|
||||
@@ -136,9 +132,7 @@ class PopoverMenuFactory
|
||||
'return ArchiveMode(false);'
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif(UserRights::CanBrowseArchive())
|
||||
{
|
||||
} elseif (UserRights::CanBrowseArchive()) {
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new JSPopupMenuItem(
|
||||
'UI:ArchiveModeOn',
|
||||
@@ -149,8 +143,7 @@ class PopoverMenuFactory
|
||||
}
|
||||
|
||||
// Logoff
|
||||
if(utils::CanLogOff())
|
||||
{
|
||||
if (utils::CanLogOff()) {
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new URLPopupMenuItem(
|
||||
'UI:LogOffMenu',
|
||||
@@ -161,8 +154,7 @@ class PopoverMenuFactory
|
||||
}
|
||||
|
||||
// Change password
|
||||
if (UserRights::CanChangePassword())
|
||||
{
|
||||
if (UserRights::CanChangePassword()) {
|
||||
$aItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItem(
|
||||
new URLPopupMenuItem(
|
||||
'UI:ChangePwdMenu',
|
||||
@@ -189,7 +181,7 @@ class PopoverMenuFactory
|
||||
utils::GetPopupMenuItemsBlock($oMenu, iPopupMenuExtension::MENU_USER_ACTIONS, null, $aOriginalItems);
|
||||
|
||||
$aTransformedItems = [];
|
||||
foreach($aOriginalItems as $sItemID => $aItemData) {
|
||||
foreach ($aOriginalItems as $sItemID => $aItemData) {
|
||||
$aTransformedItems[] = PopoverMenuItemFactory::MakeFromApplicationPopupMenuItemData($sItemID, $aItemData);
|
||||
}
|
||||
|
||||
@@ -273,4 +265,4 @@ class PopoverMenuFactory
|
||||
|
||||
return $oMenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem;
|
||||
|
||||
|
||||
use JSPopupMenuItem;
|
||||
|
||||
/**
|
||||
@@ -27,7 +27,7 @@ use JSPopupMenuItem;
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem
|
||||
* @property \JSPopupMenuItem $oPopupMenuItem
|
||||
* @property \JSPopupMenuItem $oPopupMenuItem
|
||||
* @since 3.0.0
|
||||
*/
|
||||
class JsPopoverMenuItem extends PopoverMenuItem
|
||||
@@ -63,4 +63,4 @@ class JsPopoverMenuItem extends PopoverMenuItem
|
||||
|
||||
return $aJsFiles;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem;
|
||||
|
||||
|
||||
use ApplicationPopupMenuItem;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use utils;
|
||||
@@ -106,7 +106,7 @@ class PopoverMenuItem extends UIBlock
|
||||
{
|
||||
return $this->oPopupMenuItem->GetCssClasses();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @uses oPopupMenuItem
|
||||
@@ -137,7 +137,7 @@ class PopoverMenuItem extends UIBlock
|
||||
{
|
||||
return $this->oPopupMenuItem->GetTooltip();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return $this
|
||||
* @uses oPopupMenuItem
|
||||
@@ -149,7 +149,6 @@ class PopoverMenuItem extends UIBlock
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @uses oPopupMenuItem
|
||||
@@ -160,5 +159,4 @@ class PopoverMenuItem extends UIBlock
|
||||
return $this->oPopupMenuItem->GetUID();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,8 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem;
|
||||
|
||||
|
||||
|
||||
use ApplicationPopupMenuItem;
|
||||
use JSPopupMenuItem;
|
||||
use SeparatorPopupMenuItem;
|
||||
@@ -46,14 +45,13 @@ class PopoverMenuItemFactory
|
||||
public static function MakeFromApplicationPopupMenuItem(ApplicationPopupMenuItem $oItem)
|
||||
{
|
||||
$sNamespace = 'Combodo\\iTop\\Application\\UI\\Base\\Component\\PopoverMenu\\PopoverMenuItem\\';
|
||||
switch(true)
|
||||
{
|
||||
switch (true) {
|
||||
case $oItem instanceof URLPopupMenuItem:
|
||||
$sTargetClass = 'UrlPopoverMenuItem';
|
||||
break;
|
||||
case $oItem instanceof JSPopupMenuItem:
|
||||
$sTargetClass = 'JsPopoverMenuItem';
|
||||
break;
|
||||
break;
|
||||
case $oItem instanceof SeparatorPopupMenuItem:
|
||||
$sTargetClass = 'SeparatorPopoverMenuItem';
|
||||
break;
|
||||
@@ -99,7 +97,8 @@ class PopoverMenuItemFactory
|
||||
new JSPopupMenuItem(
|
||||
$aRefactoredItem['uid'],
|
||||
$aRefactoredItem['label'],
|
||||
$aRefactoredItem['on_click'])
|
||||
$aRefactoredItem['on_click']
|
||||
)
|
||||
);
|
||||
} elseif (!empty($aRefactoredItem['url'])) {
|
||||
// URL
|
||||
@@ -108,7 +107,8 @@ class PopoverMenuItemFactory
|
||||
$aRefactoredItem['uid'],
|
||||
$aRefactoredItem['label'],
|
||||
$aRefactoredItem['url'],
|
||||
$aRefactoredItem['target'])
|
||||
$aRefactoredItem['target']
|
||||
)
|
||||
);
|
||||
} else {
|
||||
// Separator
|
||||
@@ -140,4 +140,4 @@ class PopoverMenuItemFactory
|
||||
{
|
||||
return new SeparatorPopoverMenuItem(new SeparatorPopupMenuItem());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem;
|
||||
|
||||
|
||||
/**
|
||||
* Class SeparatorPopoverMenuItem
|
||||
*
|
||||
@@ -33,4 +33,4 @@ class SeparatorPopoverMenuItem extends PopoverMenuItem
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-popover-menu--item-separator';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/popover-menu/item/mode_separator';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenuItem;
|
||||
|
||||
|
||||
/**
|
||||
* Class UrlPopoverMenuItem
|
||||
*
|
||||
@@ -41,7 +41,7 @@ class UrlPopoverMenuItem extends PopoverMenuItem
|
||||
{
|
||||
return $this->oPopupMenuItem->GetUrl();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see \URLPopupMenuItem::GetTarget()
|
||||
* @return string
|
||||
@@ -50,4 +50,4 @@ class UrlPopoverMenuItem extends PopoverMenuItem
|
||||
{
|
||||
return $this->oPopupMenuItem->GetTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\QuickCreate;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Combodo\iTop\Application\UI\Hook\iKeyboardShortcut;
|
||||
use MetaModel;
|
||||
@@ -81,7 +81,7 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->SetEndpoint(static::DEFAULT_ENDPOINT_REL_URL);
|
||||
$this->aAvailableClasses = $this->FilterAvailableClasses(UserRights::GetAllowedClasses(UR_ACTION_CREATE, array('bizmodel'), true));
|
||||
$this->aAvailableClasses = $this->FilterAvailableClasses(UserRights::GetAllowedClasses(UR_ACTION_CREATE, ['bizmodel'], true));
|
||||
$this->aLastClasses = $aLastClasses;
|
||||
$this->iMaxAutocompleteResults = (int) MetaModel::GetConfig()->Get('quick_create.max_autocomplete_results');
|
||||
$this->bShowHistory = (bool) MetaModel::GetConfig()->Get('quick_create.show_history');
|
||||
@@ -141,14 +141,14 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut
|
||||
{
|
||||
$aFilteredClasses = [];
|
||||
|
||||
foreach ($aClasses as $sClassName => $sClassLabel){
|
||||
foreach ($aClasses as $sClassName => $sClassLabel) {
|
||||
// Skip not derivating from cmdbAbstractObject
|
||||
if(false === is_a($sClassName, '\cmdbAbstractObject', true)) {
|
||||
if (false === is_a($sClassName, '\cmdbAbstractObject', true)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Skip n:n classes
|
||||
if(MetaModel::IsLinkClass($sClassName)) {
|
||||
if (MetaModel::IsLinkClass($sClassName)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -236,4 +236,4 @@ class QuickCreate extends UIBlock implements iKeyboardShortcut
|
||||
{
|
||||
return "[data-role='".static::BLOCK_CODE."']";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\QuickCreate;
|
||||
|
||||
|
||||
/**
|
||||
* Class QuickCreateFactory
|
||||
*
|
||||
@@ -44,4 +44,4 @@ class QuickCreateFactory
|
||||
|
||||
return new QuickCreate($aLastClasses, QuickCreate::BLOCK_CODE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Spinner;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -19,7 +19,7 @@ class Spinner extends UIBlock
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-spinner';
|
||||
public const DEFAULT_HTML_TEMPLATE_REL_PATH = 'base/components/spinner/layout';
|
||||
|
||||
|
||||
/* @var string Display size for inline element, rather small */
|
||||
public const ENUM_SPINNER_SIZE_INLINE = 'inline';
|
||||
/* @var string Display size for small element, displayed in a column */
|
||||
@@ -60,7 +60,7 @@ class Spinner extends UIBlock
|
||||
$this->sDescription = $sDescription;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
@@ -68,7 +68,7 @@ class Spinner extends UIBlock
|
||||
{
|
||||
return $this->sDescription !== '';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -86,4 +86,4 @@ class Spinner extends UIBlock
|
||||
$this->sSize = $sSize;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Spinner;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
/**
|
||||
@@ -50,7 +49,7 @@ class SpinnerUIBlockFactory extends AbstractUIBlockFactory
|
||||
$oSpinner->SetSize(Spinner::ENUM_SPINNER_SIZE_SMALL);
|
||||
return $oSpinner;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @api
|
||||
*
|
||||
@@ -80,4 +79,4 @@ class SpinnerUIBlockFactory extends AbstractUIBlockFactory
|
||||
$oSpinner->SetSize(Spinner::ENUM_SPINNER_SIZE_LARGE);
|
||||
return $oSpinner;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -61,4 +62,4 @@ class TemplateUIBlockFactory extends AbstractUIBlockFactory
|
||||
|
||||
return $oBlock;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Text;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -34,7 +34,6 @@ class Text extends UIBlock
|
||||
parent::__construct($sId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
@@ -43,4 +42,4 @@ class Text extends UIBlock
|
||||
return $this->sText;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Title;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
@@ -93,4 +93,4 @@ class Title extends UIContentBlock
|
||||
return $this->bIsMedallion;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Title;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Text\Text;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
@@ -50,10 +49,12 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Title\Title
|
||||
*/
|
||||
public static function MakeForPageWithIcon(
|
||||
string $sTitle, string $sIconUrl, string $sIconCoverMethod = Title::DEFAULT_ICON_COVER_METHOD, bool $bIsMedallion = true,
|
||||
string $sTitle,
|
||||
string $sIconUrl,
|
||||
string $sIconCoverMethod = Title::DEFAULT_ICON_COVER_METHOD,
|
||||
bool $bIsMedallion = true,
|
||||
?string $sId = null
|
||||
)
|
||||
{
|
||||
) {
|
||||
$oTitle = new Title(new Text($sTitle), 1, $sId);
|
||||
$oTitle->SetIcon($sIconUrl, $sIconCoverMethod, $bIsMedallion);
|
||||
|
||||
@@ -85,4 +86,4 @@ class TitleUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
return new Title($oTitle, $iLevel, $sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\Separator;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -23,4 +23,4 @@ use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
*/
|
||||
class AbstractSeparator extends UIBlock
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\Separator;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
use Combodo\iTop\Application\UI\Base\Component\Toolbar\Toolbar;
|
||||
|
||||
@@ -36,4 +35,4 @@ class ToolbarSeparatorUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
return new VerticalSeparator($sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\Separator;
|
||||
|
||||
|
||||
/**
|
||||
* Class ToolbarSpacer
|
||||
*
|
||||
@@ -28,4 +28,4 @@ class VerticalSeparator extends AbstractSeparator
|
||||
{
|
||||
parent::__construct($sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
|
||||
/**
|
||||
@@ -24,4 +24,4 @@ class Toolbar extends UIContentBlock
|
||||
{
|
||||
parent::__construct($sId, $aContainerClasses);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
@@ -6,7 +7,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarSpacer;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
|
||||
/**
|
||||
@@ -24,4 +24,4 @@ class ToolbarSpacer extends UIBlock
|
||||
{
|
||||
parent::__construct($sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar\ToolbarSpacer;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
/**
|
||||
@@ -35,4 +34,4 @@ class ToolbarSpacerUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
return new ToolbarSpacer($sId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2024 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\Toolbar;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Base\AbstractUIBlockFactory;
|
||||
|
||||
/**
|
||||
@@ -59,4 +58,4 @@ class ToolbarUIBlockFactory extends AbstractUIBlockFactory
|
||||
{
|
||||
return new Toolbar($sId, array_merge($aContainerClasses, ['ibo-toolbar--button']));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry;
|
||||
|
||||
|
||||
use AttributeDateTime;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use Combodo\iTop\Core\CMDBChange\CMDBChangeOrigin;
|
||||
@@ -335,7 +335,7 @@ class ActivityEntry extends UIBlock
|
||||
$sDecorationClasses = null;
|
||||
|
||||
// Note: We put fa-fw on all cases instead of just in the template as one of the cases could (in the future) not use FA icons. This will ensure that any use of the FA icons are always the same width.
|
||||
switch($this->GetOrigin()) {
|
||||
switch ($this->GetOrigin()) {
|
||||
case CMDBChangeOrigin::CSV_INTERACTIVE:
|
||||
case CMDBChangeOrigin::CSV_IMPORT:
|
||||
$sDecorationClasses = 'fas fa-fw fa-file-import';
|
||||
@@ -364,4 +364,4 @@ class ActivityEntry extends UIBlock
|
||||
|
||||
return $sDecorationClasses;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry;
|
||||
|
||||
|
||||
use AttributeDateTime;
|
||||
use CMDBChange;
|
||||
use CMDBChangeOp;
|
||||
@@ -83,7 +83,7 @@ class ActivityEntryFactory
|
||||
$oUser = MetaModel::GetObject('User', $aOrmEntry['user_id'], false, true);
|
||||
$sUserLogin = ($oUser === null) ? '' : $oUser->Get('login');
|
||||
|
||||
// We sanitize OrmEntry even if it's already sanitized: if the entry is somehow truncated or metadata are wrong we may break whole page DOM
|
||||
// We sanitize OrmEntry even if it's already sanitized: if the entry is somehow truncated or metadata are wrong we may break whole page DOM
|
||||
$oEntry = new CaseLogEntry(
|
||||
DateTime::createFromFormat(AttributeDateTime::GetInternalFormat(), $aOrmEntry['date']),
|
||||
$sUserLogin,
|
||||
@@ -154,4 +154,4 @@ class ActivityEntryFactory
|
||||
|
||||
return $sFactoryFqcn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
|
||||
|
||||
|
||||
/**
|
||||
* Class CMDBChangeOpAttachmentAddedFactory
|
||||
*
|
||||
@@ -31,4 +31,4 @@ namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CM
|
||||
class CMDBChangeOpAttachmentAddedFactory extends CMDBChangeOpFactory
|
||||
{
|
||||
public const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-paperclip';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
|
||||
|
||||
|
||||
/**
|
||||
* Class CMDBChangeOpAttachmentRemovedFactory
|
||||
*
|
||||
@@ -31,4 +31,4 @@ namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CM
|
||||
class CMDBChangeOpAttachmentRemovedFactory extends CMDBChangeOpFactory
|
||||
{
|
||||
public const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-unlink';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
|
||||
|
||||
|
||||
/**
|
||||
* Class CMDBChangeOpCreateFactory
|
||||
*
|
||||
@@ -28,6 +28,7 @@ namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CM
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class CMDBChangeOpCreateFactory extends CMDBChangeOpFactory {
|
||||
class CMDBChangeOpCreateFactory extends CMDBChangeOpFactory
|
||||
{
|
||||
public const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-seedling';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
|
||||
|
||||
|
||||
/**
|
||||
* Class CMDBChangeOpDeleteFactory
|
||||
*
|
||||
@@ -28,6 +28,7 @@ namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CM
|
||||
* @since 3.0.0
|
||||
* @internal
|
||||
*/
|
||||
class CMDBChangeOpDeleteFactory extends CMDBChangeOpFactory {
|
||||
class CMDBChangeOpDeleteFactory extends CMDBChangeOpFactory
|
||||
{
|
||||
public const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-trash';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
|
||||
|
||||
|
||||
use AttributeDateTime;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\ActivityEntry;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\EditsEntry;
|
||||
@@ -82,15 +82,13 @@ class CMDBChangeOpFactory
|
||||
// - Set login in the friendlyname as a fallback
|
||||
$sAuthorLogin = $oChangeOp->Get('userinfo');
|
||||
// - Try to find user login from its ID if present (since iTop 3.0.0)
|
||||
if(empty($iAuthorId) === false)
|
||||
{
|
||||
if (empty($iAuthorId) === false) {
|
||||
$oAuthor = MetaModel::GetObject('User', $iAuthorId, false, true);
|
||||
if(empty($oAuthor) === false)
|
||||
{
|
||||
if (empty($oAuthor) === false) {
|
||||
$sAuthorLogin = $oAuthor->Get('login');
|
||||
}
|
||||
}
|
||||
|
||||
return $sAuthorLogin;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
|
||||
|
||||
|
||||
use AttributeDateTime;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\EditsEntry;
|
||||
use DateTime;
|
||||
@@ -60,4 +60,4 @@ class CMDBChangeOpSetAttributeFactory extends CMDBChangeOpFactory
|
||||
|
||||
return $oEntry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
|
||||
|
||||
|
||||
use AttributeDateTime;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry\TransitionEntry;
|
||||
use DateTime;
|
||||
@@ -56,12 +56,10 @@ class CMDBChangeOpSetAttributeScalarFactory extends CMDBChangeOpSetAttributeFact
|
||||
$sTargetStateLabel = MetaModel::GetStateLabel($sHostObjectClass, $oChangeOp->Get('newvalue'));
|
||||
|
||||
$oEntry = new TransitionEntry($oDateTime, $sAuthorLogin, $sHostObjectClass, $sOriginStateLabel, $sTargetStateLabel);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$oEntry = parent::MakeFromCmdbChangeOp($oChangeOp);
|
||||
}
|
||||
|
||||
return $oEntry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry;
|
||||
|
||||
|
||||
use DateTime;
|
||||
use utils;
|
||||
|
||||
@@ -70,10 +70,10 @@ class CaseLogEntry extends ActivityEntry
|
||||
$this->sAttCode = $sAttCode;
|
||||
$this->SetCaseLogRank(static::DEFAULT_CASELOG_RANK);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the author and its information based on the $sAuthorLogin using parent call
|
||||
* If no parent call found no matching User, fallback on caselog author name and display it as foreign message
|
||||
* If no parent call found no matching User, fallback on caselog author name and display it as foreign message
|
||||
*
|
||||
* @param string $sAuthorLogin
|
||||
*
|
||||
@@ -84,13 +84,13 @@ class CaseLogEntry extends ActivityEntry
|
||||
public function SetAuthor(string $sAuthorLogin)
|
||||
{
|
||||
parent::SetAuthor($sAuthorLogin);
|
||||
|
||||
|
||||
// If no User was found in parent call
|
||||
if($this->sAuthorLogin === '') {
|
||||
if ($this->sAuthorLogin === '') {
|
||||
// Use caselog user_login info as friendlyname and compute its initials
|
||||
$this->sAuthorFriendlyname = $this->sAuthorName;
|
||||
$this->sAuthorInitials = utils::ToAcronym($this->sAuthorFriendlyname);
|
||||
|
||||
|
||||
// Reset Picture as we probably have default image
|
||||
$this->sAuthorPictureAbsUrl = null;
|
||||
// Reset bIsFromCurrentUser as UserRights often consider '' login as current user login
|
||||
@@ -132,4 +132,4 @@ class CaseLogEntry extends ActivityEntry
|
||||
{
|
||||
return $this->iCaseLogRank;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Copyright (C) 2013-2024 Combodo SAS
|
||||
*
|
||||
@@ -19,7 +20,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Layout\ActivityPanel\ActivityEntry;
|
||||
|
||||
|
||||
use DateTime;
|
||||
use Dict;
|
||||
use Exception;
|
||||
@@ -137,8 +137,7 @@ class EditsEntry extends ActivityEntry
|
||||
*/
|
||||
public function RemoveAttribute(string $sAttCode)
|
||||
{
|
||||
if (array_key_exists($sAttCode, $this->aAttributes))
|
||||
{
|
||||
if (array_key_exists($sAttCode, $this->aAttributes)) {
|
||||
unset($this->aAttributes[$sAttCode]);
|
||||
}
|
||||
|
||||
@@ -180,8 +179,7 @@ class EditsEntry extends ActivityEntry
|
||||
// We need the array to be indexed by numbers instead of being associative
|
||||
$aAttributesData = array_values($this->GetAttributes());
|
||||
$iAttributesCount = count($aAttributesData);
|
||||
switch($iAttributesCount)
|
||||
{
|
||||
switch ($iAttributesCount) {
|
||||
case 0:
|
||||
$sDescriptionAsHtml = '';
|
||||
break;
|
||||
@@ -204,8 +202,7 @@ class EditsEntry extends ActivityEntry
|
||||
$sFirstAttLabelAsHtml = '<span class="ibo-edits-entry--attribute-label" data-attribute-code="'.$aAttributesData[0]['code'].'">'.$aAttributesData[0]['label'].'</span>';
|
||||
$sSecondAttLabelAsHtml = '<span class="ibo-edits-entry--attribute-label" data-attribute-code="'.$aAttributesData[1]['code'].'">'.$aAttributesData[1]['label'].'</span>';
|
||||
|
||||
switch($iAttributesCount)
|
||||
{
|
||||
switch ($iAttributesCount) {
|
||||
case 2:
|
||||
$sDescriptionAsHtml = Dict::Format('Change:TwoAttributesChanged', $sFirstAttLabelAsHtml, $sSecondAttLabelAsHtml);
|
||||
break;
|
||||
@@ -222,4 +219,4 @@ class EditsEntry extends ActivityEntry
|
||||
|
||||
return $sDescriptionAsHtml;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user