N°3649 - Activity panel: Add concurrent lock mechanism

This commit is contained in:
Molkobain
2021-02-19 11:44:22 +01:00
parent c59301ebc6
commit 4d8930832e
10 changed files with 394 additions and 51 deletions

View File

@@ -216,6 +216,17 @@ class ActivityPanel extends UIBlock
return $this->sTransactionId;
}
/**
* @return bool True if the lock mechanism has to be enabled
* @uses \cmdbAbstractObject::ENUM_OBJECT_MODE_VIEW
* @uses static::HasAnEditableCaseLogTab()
* @uses "concurrent_lock_enabled" config. param.
*/
public function IsLockEnabled(): bool
{
return (cmdbAbstractObject::ENUM_OBJECT_MODE_VIEW === $this->sObjectMode) && (MetaModel::GetConfig()->Get('concurrent_lock_enabled')) && (true === $this->HasAnEditableCaseLogTab());
}
/**
* Set all entries at once.
*
@@ -645,9 +656,19 @@ class ActivityPanel extends UIBlock
public function GetDateTimeFormatForJSWidget()
{
$oDateTimeFormat = AttributeDateTime::GetFormat();
return $oDateTimeFormat->ToMomentJS();
}
/**
* @return string The endpoint for all "lock" related operations
* @throws \Exception
*/
public function GetLockEndpointForJSWidget(): string
{
return utils::GetAbsoluteUrlAppRoot().'pages/ajax.render.php';
}
/**
* @inheritdoc
*/
@@ -655,7 +676,7 @@ class ActivityPanel extends UIBlock
{
$aSubBlocks = array();
foreach($this->GetCaseLogTabsEntryForms() as $sCaseLogId => $oCaseLogEntryForm) {
foreach ($this->GetCaseLogTabsEntryForms() as $sCaseLogId => $oCaseLogEntryForm) {
$aSubBlocks[$oCaseLogEntryForm->GetId()] = $oCaseLogEntryForm;
}