mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-24 11:08:45 +02:00
N°3649 - Activity panel: Work on multiple caselogs edition at once
This commit is contained in:
@@ -10,6 +10,7 @@ use Combodo\iTop\Application\UI\Base\Component\Input\RichText\RichText;
|
||||
use Combodo\iTop\Application\UI\Base\Component\PopoverMenu\PopoverMenu;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\UIBlock;
|
||||
use DBObject;
|
||||
|
||||
/**
|
||||
* Class CaseLogEntryForm
|
||||
@@ -34,6 +35,10 @@ class CaseLogEntryForm extends UIContentBlock
|
||||
/** @var string */
|
||||
public const DEFAULT_SUBMIT_MODE = self::ENUM_SUBMIT_MODE_AUTONOMOUS;
|
||||
|
||||
/** @var DBObject Object hosting the case log attribute */
|
||||
protected $oObject;
|
||||
/** @var string Attribute code of the case log in $oObject */
|
||||
protected $sAttCode;
|
||||
/**
|
||||
* @var string Whether the form can send data on its own or if it's bridged with its host object form
|
||||
* @see static::ENUM_SUBMIT_MODE_XXX
|
||||
@@ -51,15 +56,54 @@ class CaseLogEntryForm extends UIContentBlock
|
||||
/**
|
||||
* CaseLogEntryForm constructor.
|
||||
*
|
||||
* @param null $sId
|
||||
* @param \DBObject $oObject
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($sId = null)
|
||||
public function __construct(DBObject $oObject, string $sAttCode, string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->oObject = $oObject;
|
||||
$this->sAttCode = $sAttCode;
|
||||
$this->sSubmitMode = static::DEFAULT_SUBMIT_MODE;
|
||||
$this->SetTextInput(new RichText());
|
||||
$this->aMainActionButtons = [];
|
||||
$this->aExtraActionButtons = [];
|
||||
$this->InitTextInput();
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses static::$oObject
|
||||
* @return \DBObject
|
||||
*/
|
||||
public function GetObject(): DBObject
|
||||
{
|
||||
return $this->oObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses static::$oObject
|
||||
* @return string The class of $oObject
|
||||
*/
|
||||
public function GetObjectClass(): string
|
||||
{
|
||||
return get_class($this->oObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses static::$oObject
|
||||
* @return string The ID of $oObject
|
||||
*/
|
||||
public function GetObjectId(): string
|
||||
{
|
||||
return $this->oObject->GetKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses static::$sAttCode
|
||||
* @return string
|
||||
*/
|
||||
public function GetAttCode(): string
|
||||
{
|
||||
return $this->sAttCode;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,6 +188,16 @@ class CaseLogEntryForm extends UIContentBlock
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @uses $oTextInput
|
||||
* @return $this
|
||||
*/
|
||||
protected function InitTextInput()
|
||||
{
|
||||
$this->oTextInput = new RichText();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Combodo\iTop\Application\UI\Base\UIBlock[]
|
||||
*/
|
||||
|
||||
@@ -34,7 +34,7 @@ class CaseLogEntryFormFactory
|
||||
{
|
||||
public static function MakeForCaselogTab(DBObject $oObject, string $sCaseLogAttCode, string $sObjectMode = cmdbAbstractObject::DEFAULT_OBJECT_MODE)
|
||||
{
|
||||
$oCaseLogEntryForm = new CaseLogEntryForm();
|
||||
$oCaseLogEntryForm = new CaseLogEntryForm($oObject, $sCaseLogAttCode);
|
||||
$oCaseLogEntryForm->SetSubmitModeFromHostObjectMode($sObjectMode)
|
||||
->AddMainActionButtons(static::PrepareCancelButton())
|
||||
->AddMainActionButtons(static::PrepareSaveButton())
|
||||
|
||||
Reference in New Issue
Block a user