mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-12 23:14:18 +01:00
History display enhancement: whenever a new case log entry is added, display its content in the history. The display is truncated at a configurable max length. The user can expand/collapse the truncated text, entry per entry. The text is not truncated when printing.
SVN:trunk[3759]
This commit is contained in:
@@ -619,7 +619,27 @@ class CMDBChangeOpSetAttributeCaseLog extends CMDBChangeOpSetAttribute
|
||||
// The attribute was renamed or removed from the object ?
|
||||
$sAttName = $this->Get('attcode');
|
||||
}
|
||||
$sResult = Dict::Format('Change:AttName_EntryAdded', $sAttName);
|
||||
$oObj = $oMonoObjectSet->Fetch();
|
||||
$oCaseLog = $oObj->Get($this->Get('attcode'));
|
||||
$iMaxVisibleLength = MetaModel::getConfig()->Get('max_history_case_log_entry_length', 0);
|
||||
$sTextEntry = str_replace(array("\r\n", "\n", "\r"), "<br/>", htmlentities($oCaseLog->GetEntryAt($this->Get('lastentry')), ENT_QUOTES, 'UTF-8'));
|
||||
if (($iMaxVisibleLength > 0) && (strlen($sTextEntry) > $iMaxVisibleLength))
|
||||
{
|
||||
if (function_exists('mb_strcut'))
|
||||
{
|
||||
// Safe with multi-byte strings
|
||||
$sBefore = mb_strcut($sTextEntry, 0, $iMaxVisibleLength);
|
||||
$sAfter = mb_strcut($sTextEntry, $iMaxVisibleLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Let's hpe we have no multi-byte characters around the cuttting point...
|
||||
$sBefore = substr($sTextEntry, 0, $iMaxVisibleLength);
|
||||
$sAfter = substr($sTextEntry, $iMaxVisibleLength);
|
||||
}
|
||||
$sTextEntry = '<span class="case-log-history-entry">'.$sBefore.'<span class="case-log-history-entry-end">'.$sAfter.'<span class="case-log-history-entry-toggle ui-icon ui-icon-circle-minus"></span></span><span class="case-log-history-entry-more">...<span class="case-log-history-entry-toggle ui-icon ui-icon-circle-plus"></span></span></span>';
|
||||
}
|
||||
$sResult = Dict::Format('Change:AttName_EntryAdded', $sAttName, $sTextEntry);
|
||||
}
|
||||
return $sResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user