diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 3d6bbbb78..bf7065db1 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -508,32 +508,6 @@ HTML return $aHeaderBlocks; } - /** - * Display history tab of an object - * - * @deprecated 3.0.0 will be removed in 3.1, see N°3824 - * - * @param bool $bEditMode - * @param int $iLimitCount - * @param int $iLimitStart - * - * @param \WebPage $oPage - * - * @throws \CoreException - * - */ - public function DisplayBareHistory(WebPage $oPage, $bEditMode = false, $iLimitCount = 0, $iLimitStart = 0) - { - DeprecatedCallsLog::NotifyDeprecatedPhpMethod(); - // history block (with as a tab) - $oHistoryFilter = new DBObjectSearch('CMDBChangeOp'); - $oHistoryFilter->AddCondition('objkey', $this->GetKey(), '='); - $oHistoryFilter->AddCondition('objclass', get_class($this), '='); - $oBlock = new HistoryBlock($oHistoryFilter, 'table', false); - $oBlock->SetLimit($iLimitCount, $iLimitStart); - $oBlock->Display($oPage, 'history'); - } - /** * Display properties tab of an object * @@ -1179,8 +1153,6 @@ HTML $oPage->SetCurrentTab('UI:PropertiesTab'); $this->DisplayBareProperties($oPage, $bEditMode); $this->DisplayBareRelations($oPage, $bEditMode); - // TODO 3.0.0: What to do with this? - //$this->DisplayBareHistory($oPage, $bEditMode); // Note: Adding the JS snippet which enables the image upload should have been done directly by the ActivityPanel which would have kept the independance principle // of the UIBlock. For now we keep it this way in order to move on and trace this known limitation in N°3736. diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 1c3a92a9f..dc682d766 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -1698,145 +1698,6 @@ JS } -/** - * Helper class to manage 'blocks' of HTML pieces that are parts of a page and contain some list of cmdb objects - * - * Each block is actually rendered as a
tag that can be rendered synchronously - * or as a piece of Javascript/JQuery/Ajax that will get its content from another page (ajax.render.php). - * The list of cmdbObjects to be displayed into the block is defined by a filter - * Right now the type of display is either: list, count or details - * - list produces a table listing the objects - * - count produces a paragraphs with a sentence saying 'cont' objects found - * - details display (as table) the details of each object found (best if only one) - * - * @deprecated 3.0.0 will be removed in 3.1, see N°3824 - */ -class HistoryBlock extends DisplayBlock -{ - protected $iLimitCount; - protected $iLimitStart; - - public function __construct(DBSearch $oFilter, $sStyle = 'list', $bAsynchronous = false, $aParams = array(), $oSet = null) - { - DeprecatedCallsLog::NotifyDeprecatedPhpMethod(); - parent::__construct($oFilter, $sStyle, $bAsynchronous, $aParams, $oSet); - $this->iLimitStart = 0; - $this->iLimitCount = 0; - } - - public function SetLimit($iCount, $iStart = 0) - { - $this->iLimitStart = $iStart; - $this->iLimitCount = $iCount; - } - - public function GetRenderContent(WebPage $oPage, array $aExtraParams = [], string $sId = null) - { - $sHtml = ''; - $bTruncated = false; - $oSet = new CMDBObjectSet($this->m_oFilter, array('date' => false)); - if (!$oPage->IsPrintableVersion()) { - if (($this->iLimitStart > 0) || ($this->iLimitCount > 0)) { - $oSet->SetLimit($this->iLimitCount, $this->iLimitStart); - if (($this->iLimitCount - $this->iLimitStart) < $oSet->Count()) { - $bTruncated = true; - } - } - } - $sHtml .= "\n"; - switch ($this->m_sStyle) { - case 'toggle': - // First the latest change that the user is allowed to see - do { - $oLatestChangeOp = $oSet->Fetch(); - } while (is_object($oLatestChangeOp) && ($oLatestChangeOp->GetDescription() == '')); - - if (is_object($oLatestChangeOp)) { - // There is one change in the list... only when the object has been created ! - $sDate = $oLatestChangeOp->GetAsHTML('date'); - $oChange = MetaModel::GetObject('CMDBChange', $oLatestChangeOp->Get('change')); - $sUserInfo = $oChange->GetAsHTML('userinfo'); - $sHtml .= $oPage->GetStartCollapsibleSection(Dict::Format('UI:History:LastModified_On_By', $sDate, $sUserInfo)); - $sHtml .= $this->GetHistoryTable($oPage, $oSet); - $sHtml .= $oPage->GetEndCollapsibleSection(); - } - break; - - case 'table': - default: - if ($bTruncated) - { - $sFilter = htmlentities($this->m_oFilter->serialize(), ENT_QUOTES, 'UTF-8'); - $sHtml .= '

'; - $sHtml .= Dict::Format('UI:TruncatedResults', $this->iLimitCount, $oSet->Count()); - $sHtml .= ' '; - $sHtml .= ''.Dict::S('UI:DisplayAll').''; - $sHtml .= $this->GetHistoryTable($oPage, $oSet); - $sHtml .= '

'; - $oPage->add_ready_script("$('#{$sId} table.listResults tr:last td').addClass('truncated');"); - } - else - { - $sHtml .= $this->GetHistoryTable($oPage, $oSet); - } - $oPage->add_ready_script(InlineImage::FixImagesWidth()); - - $oPage->add_ready_script("$('.case-log-history-entry-toggle').on('click', function () { $(this).closest('.case-log-history-entry').toggleClass('expanded');});"); - $oPage->add_ready_script( -<<'); - jMe.find('.history_truncated_toggler').on('click', function() { - jMe.toggleClass('history_entry_truncated'); - }); - } -}); -EOF - ); - } - return new Html($sHtml); - } - - protected function GetHistoryTable(WebPage $oPage, DBObjectSet $oSet) - { - $sHtml = ''; - // First the latest change that the user is allowed to see - $oSet->Rewind(); // Reset the pointer to the beginning of the set - $aChanges = array(); - while($oChangeOp = $oSet->Fetch()) - { - $sChangeDescription = $oChangeOp->GetDescription(); - if ($sChangeDescription != '') - { - // The change is visible for the current user - $changeId = $oChangeOp->Get('change'); - $aChanges[$changeId]['date'] = $oChangeOp->Get('date'); - $aChanges[$changeId]['userinfo'] = $oChangeOp->Get('userinfo'); - if (!isset($aChanges[$changeId]['log'])) - { - $aChanges[$changeId]['log'] = array(); - } - $aChanges[$changeId]['log'][] = $sChangeDescription; - } - } - $aAttribs = array('date' => array('label' => Dict::S('UI:History:Date'), 'description' => Dict::S('UI:History:Date+')), - 'userinfo' => array('label' => Dict::S('UI:History:User'), 'description' => Dict::S('UI:History:User+')), - 'log' => array('label' => Dict::S('UI:History:Changes') , 'description' => Dict::S('UI:History:Changes+')), - ); - $aValues = array(); - foreach($aChanges as $aChange) - { - $aValues[] = array('date' => AttributeDateTime::GetFormat()->Format($aChange['date']), 'userinfo' => htmlentities($aChange['userinfo'], ENT_QUOTES, 'UTF-8'), 'log' => ""); - } - $sHtml .= $oPage->GetTable($aAttribs, $aValues); - return $sHtml; - } -} - /** * Displays the 'Actions' menu for a given (list of) object(s) * The 'style' of the list (see constructor of DisplayBlock) can be either 'list' or 'details' diff --git a/application/template.class.inc.php b/application/template.class.inc.php index 41b30bfda..6c9a8566b 100644 --- a/application/template.class.inc.php +++ b/application/template.class.inc.php @@ -234,7 +234,6 @@ class DisplayTemplate $sTemplate = ' diff --git a/application/templates/audit_category.html b/application/templates/audit_category.html index 379c506c2..55f1ed6cc 100644 --- a/application/templates/audit_category.html +++ b/application/templates/audit_category.html @@ -1,7 +1,6 @@ SELECT $class$ WHERE id = $id$ diff --git a/js/utils.js b/js/utils.js index 1424d01c4..78907be06 100644 --- a/js/utils.js +++ b/js/utils.js @@ -583,18 +583,6 @@ function ExportInitButton(sSelector) { }); } -/** - * @deprecated 3.0.0 will be removed in 3.1, see N°3824 - */ -function DisplayHistory(sSelector, sFilter, iCount, iStart) { - $(sSelector).block(); - var oParams = {operation: 'history_from_filter', filter: sFilter, start: iStart, count: iCount}; - $.post(GetAbsoluteUrlAppRoot()+'pages/ajax.render.php', oParams, function (data) { - $(sSelector).html(data).unblock(); - } - ); -} - /** * @deprecated 3.0.0 N°4367 deprecated, use {@see CombodoSanitizer.EscapeHtml} instead * diff --git a/pages/ajax.render.php b/pages/ajax.render.php index 92a294296..784cf477c 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -1281,31 +1281,6 @@ JS AjaxRenderController::DisplayAboutBox($oPage); break; - /** @deprecated 3.0.0 Will be removed in 3.1, see N°3824 */ - case 'history': - $oPage->SetContentType('text/html'); - $id = (int)utils::ReadParam('id', 0); - $iStart = (int)utils::ReadParam('start', 0); - $iCount = (int)utils::ReadParam('count', MetaModel::GetConfig()->Get('max_history_length')); - $oObj = MetaModel::GetObject($sClass, $id); - $oObj->DisplayBareHistory($oPage, false, $iCount, $iStart); - //$oPage->add_ready_script("$('#history table.listResults').tableHover(); $('#history table.listResults').tablesorter( { - // widgets: ['myZebra', 'truncatedList']} );"); - break; - - /** @deprecated 3.0.0 Will be removed in 3.1, see N°3824 */ - case 'history_from_filter': - $oPage->SetContentType('text/html'); - $oHistoryFilter = DBSearch::unserialize($sFilter); - $iStart = (int)utils::ReadParam('start', 0); - $iCount = (int)utils::ReadParam('count', MetaModel::GetConfig()->Get('max_history_length')); - $oBlock = new HistoryBlock($oHistoryFilter, 'table', false); - $oBlock->SetLimit($iCount, $iStart); - $oBlock->Display($oPage, 'history'); - //$oPage->add_ready_script("$('#history table.listResults').tableHover(); $('#history table.listResults').tablesorter( { - // widgets: ['myZebra', 'truncatedList']} );"); - break; - case 'full_text_search': $aFullTextNeedles = utils::ReadParam('needles', array(), false, 'raw_data'); $sFullText = trim(implode(' ', $aFullTextNeedles));