mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 02:58:43 +02:00
N°2847 - Activity panel: Fix filtering on CMDBChangeOp entries
This commit is contained in:
@@ -43,9 +43,13 @@ class ActivityEntry extends UIBlock
|
||||
// Specific constants
|
||||
/** @var string DEFAULT_ORIGIN */
|
||||
const DEFAULT_ORIGIN = 'unknown';
|
||||
/** @var string DEFAULT_TYPE */
|
||||
const DEFAULT_TYPE = 'generic';
|
||||
/** @var string DEFAULT_DECORATION_CLASSES */
|
||||
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-mortar-pestle';
|
||||
|
||||
/** @var string $sType Type of entry, used for filtering (eg. caselog, edits, transition, ...) */
|
||||
protected $sType;
|
||||
/** @var string $sDecorationClasses CSS classes to use to decorate the entry */
|
||||
protected $sDecorationClasses;
|
||||
/** @var string $sContent Raw content of the entry itself (should not have been processed / escaped) */
|
||||
@@ -79,6 +83,7 @@ class ActivityEntry extends UIBlock
|
||||
{
|
||||
parent::__construct($sIdCode);
|
||||
|
||||
$this->SetType(static::DEFAULT_TYPE);
|
||||
$this->SetDecorationClasses(static::DEFAULT_DECORATION_CLASSES);
|
||||
$this->SetContent($sContent);
|
||||
$this->SetDateTime($oDateTime);
|
||||
@@ -86,6 +91,30 @@ class ActivityEntry extends UIBlock
|
||||
$this->SetOrigin(static::DEFAULT_ORIGIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the type of the entry (eg. case log, edits, transition, ...)
|
||||
*
|
||||
* @param string $sType
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function SetType($sType)
|
||||
{
|
||||
$this->sType = $sType;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of the entry (eg. caselog, edits, transition, ...)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function GetType()
|
||||
{
|
||||
return $this->sType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the CSS decoration classes
|
||||
*
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBCha
|
||||
|
||||
use AttributeDateTime;
|
||||
use Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\ActivityEntry;
|
||||
use Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\EditsEntry;
|
||||
use DateTime;
|
||||
use iCMDBChangeOp;
|
||||
|
||||
@@ -35,8 +36,10 @@ use iCMDBChangeOp;
|
||||
*/
|
||||
class CMDBChangeOpFactory
|
||||
{
|
||||
/** @var string DEFAULT_DECORATION_CLASSES Use to overload the decoration classes from the ActivityEntry */
|
||||
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-mortar-pestle';
|
||||
/** @var string DEFAULT_TYPE Used to overload the type from the ActivityEntry */
|
||||
const DEFAULT_TYPE = EditsEntry::DEFAULT_TYPE;
|
||||
/** @var string DEFAULT_DECORATION_CLASSES Used to overload the decoration classes from the ActivityEntry */
|
||||
const DEFAULT_DECORATION_CLASSES = ActivityEntry::DEFAULT_DECORATION_CLASSES;
|
||||
|
||||
/**
|
||||
* Make an ActivityEntry from the iCMDBChangeOp $oChangeOp
|
||||
@@ -53,7 +56,8 @@ class CMDBChangeOpFactory
|
||||
$sContent = $oChangeOp->GetDescription();
|
||||
|
||||
$oEntry = new ActivityEntry($oDateTime, $sAuthorFriendlyname, $sContent);
|
||||
$oEntry->SetDecorationClasses(static::DEFAULT_DECORATION_CLASSES);
|
||||
$oEntry->SetType(static::DEFAULT_TYPE)
|
||||
->SetDecorationClasses(static::DEFAULT_DECORATION_CLASSES);
|
||||
|
||||
return $oEntry;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,9 @@ class CaseLogEntry extends ActivityEntry
|
||||
const BLOCK_CODE = 'ibo-caselog-entry';
|
||||
const HTML_TEMPLATE_REL_PATH = 'layouts/activity-panel/activity-entry/caselog-entry';
|
||||
|
||||
const DEFAULT_TYPE = 'caselog';
|
||||
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-quote-left';
|
||||
|
||||
// Specific constants
|
||||
public const DEFAULT_CASELOG_RANK = 0;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ class EditsEntry extends ActivityEntry
|
||||
const BLOCK_CODE = 'ibo-edits-entry';
|
||||
const HTML_TEMPLATE_REL_PATH = 'layouts/activity-panel/activity-entry/edits-entry';
|
||||
|
||||
// Specific constants
|
||||
const DEFAULT_TYPE = 'edits';
|
||||
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-pen';
|
||||
|
||||
/** @var string $sObjectClass */
|
||||
|
||||
@@ -36,7 +36,7 @@ class TransitionEntry extends ActivityEntry
|
||||
const BLOCK_CODE = 'ibo-transition-entry';
|
||||
const HTML_TEMPLATE_REL_PATH = 'layouts/activity-panel/activity-entry/transition-entry';
|
||||
|
||||
// Specific constants
|
||||
const DEFAULT_TYPE = 'transition';
|
||||
const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-map-signs';
|
||||
|
||||
/** @var string $sOriginStateCode Code of the state before the transition */
|
||||
|
||||
Reference in New Issue
Block a user