diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php
index 81044ae3d..39a72d19f 100644
--- a/application/cmdbabstract.class.inc.php
+++ b/application/cmdbabstract.class.inc.php
@@ -10,6 +10,7 @@ use Combodo\iTop\Application\Search\SearchForm;
use Combodo\iTop\Application\UI\Base\Component\Alert\AlertUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\Button\Button;
use Combodo\iTop\Application\UI\Base\Component\Button\ButtonUIBlockFactory;
+use Combodo\iTop\Application\UI\Base\Component\CollapsibleSection\CollapsibleSection;
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableSettings;
use Combodo\iTop\Application\UI\Base\Component\DataTable\DataTableUIBlockFactory;
use Combodo\iTop\Application\UI\Base\Component\DataTable\StaticTable\StaticTable;
@@ -3239,6 +3240,12 @@ EOF
}
} else
{
+ if ($oAttDef instanceof \AttributeCaseLog) {
+ // Add JS file for display caselog
+ foreach (CollapsibleSection::DEFAULT_JS_FILES_REL_PATH as $sJSFile) {
+ $oPage->add_linked_script('../'.$sJSFile);
+ }
+ }
$aAllowedValues = MetaModel::GetAllowedValues_att($sClass, $sAttCode, $aArgs);
if (is_array($aAllowedValues) && count($aAllowedValues) == 1)
{
diff --git a/core/ormcaselog.class.inc.php b/core/ormcaselog.class.inc.php
index 11b58bc0c..994f12b12 100644
--- a/core/ormcaselog.class.inc.php
+++ b/core/ormcaselog.class.inc.php
@@ -16,6 +16,12 @@
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see
| '; // Use table-layout:fixed to force the with to be independent from the actual content
+ $oBlock = UIContentBlockUIBlockFactory::MakeStandard(null, ['ibo-caselog-list']);
$iPos = 0;
$aIndex = $this->m_aIndex;
if (($bEditMode) && (count($aIndex) > 0) && $this->m_bModified)
@@ -411,20 +417,16 @@ class ormCaseLog {
{
if (!$bPrintableVersion && ($index < count($aIndex) - CASELOG_VISIBLE_ITEMS))
{
- $sOpen = '';
- $sDisplay = 'style="display:none;"';
+ $bIsOpen = false;
}
else
{
- $sOpen = ' open';
- $sDisplay = '';
+ $bIsOpen = true;
}
$iPos += $aIndex[$index]['separator_length'];
$sTextEntry = substr($this->m_sLog, $iPos, $aIndex[$index]['text_length']);
- $sCSSClass= 'caselog_entry_html';
if (!array_key_exists('format', $aIndex[$index]) || ($aIndex[$index]['format'] == 'text'))
{
- $sCSSClass= 'caselog_entry';
$sTextEntry = str_replace(array("\r\n", "\n", "\r"), " ", htmlentities($sTextEntry, ENT_QUOTES, 'UTF-8')); if (!is_null($aTransfoHandler)) { @@ -441,7 +443,6 @@ class ormCaseLog { } $iPos += $aIndex[$index]['text_length']; - $sEntry = ' ';
// Workaround: PHP < 5.3 cannot unserialize correctly DateTime objects,
// therefore we have changed the format. To preserve the compatibility with existing
// installations of iTop, both format are allowed:
@@ -464,14 +465,11 @@ class ormCaseLog {
$sDate = '';
}
}
- $sEntry .= sprintf(Dict::S('UI:CaseLog:Header_Date_UserName'), $sDate, $aIndex[$index]['user_name']);
- $sEntry .= ' ';
- $sEntry .= '';
- $sEntry .= $sTextEntry;
- $sEntry .= ' ';
- $sHtml = $sHtml.$sEntry;
+ $oCollapsibleBlock = CollapsibleSectionUIBlockFactory::MakeStandard( sprintf(Dict::S('UI:CaseLog:Header_Date_UserName'), $sDate, $aIndex[$index]['user_name']));
+ $oCollapsibleBlock->AddSubBlock(new Html($sTextEntry));
+ $oCollapsibleBlock->SetOpenedByDefault($bIsOpen);
+ $oBlock->AddSubBlock($oCollapsibleBlock);
}
-
// Process the case of an eventual remainder (quick migration of AttributeText fields)
if ($iPos < (strlen($this->m_sLog) - 1))
{
@@ -485,32 +483,38 @@ class ormCaseLog {
if (count($this->m_aIndex) == 0)
{
- $sHtml .= '';
- $sHtml .= $sTextEntry;
- $sHtml .= ' ';
+ $oCollapsibleBlock = CollapsibleSectionUIBlockFactory::MakeStandard( '');
+ $oCollapsibleBlock->AddSubBlock(new Html($sTextEntry));
+ $oCollapsibleBlock->SetOpenedByDefault(true);
+ $oBlock->AddSubBlock($oCollapsibleBlock);
}
else
{
if (!$bPrintableVersion && (count($this->m_aIndex) - CASELOG_VISIBLE_ITEMS > 0))
{
- $sOpen = '';
- $sDisplay = 'style="display:none;"';
+ $bIsOpen = false;
}
else
{
- $sOpen = ' open';
- $sDisplay = '';
+ $bIsOpen = true;
}
- $sHtml .= '';
- $sHtml .= Dict::S('UI:CaseLog:InitialValue');
- $sHtml .= ' ';
- $sHtml .= '';
- $sHtml .= $sTextEntry;
- $sHtml .= ' ';
+ $oCollapsibleBlock = CollapsibleSectionUIBlockFactory::MakeStandard( Dict::S('UI:CaseLog:InitialValue'));
+ $oCollapsibleBlock->AddSubBlock(new Html($sTextEntry));
+ $oCollapsibleBlock->SetOpenedByDefault($bIsOpen);
}
}
- $sHtml .= ' |