From 0e146bf341f6258da700ba905f146e1c20c93103 Mon Sep 17 00:00:00 2001 From: acognet Date: Mon, 1 Mar 2021 15:39:01 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B03634=20-=20Feedback=20alpha=203.0=20:=20?= =?UTF-8?q?finish=20list=20-=20add=20menu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/layouts/tab-container/tab-container.js | 22 +++-------------- .../DataTable/DataTableUIBlockFactory.php | 24 +++++++++++++++---- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/js/layouts/tab-container/tab-container.js b/js/layouts/tab-container/tab-container.js index 38644ff2b..9a054a869 100644 --- a/js/layouts/tab-container/tab-container.js +++ b/js/layouts/tab-container/tab-container.js @@ -1,19 +1,6 @@ /* - * Copyright (C) 2013-2020 Combodo SARL - * - * This file is part of iTop. - * - * iTop is free software; you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * iTop is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License + * @copyright Copyright (C) 2010-2021 Combodo SARL + * @license http://opensource.org/licenses/AGPL-3.0 */ $(function() @@ -164,10 +151,7 @@ $(function() //Datatable are not displayed correctly when hidden $(oUI.newPanel).find('.dataTables_scrollBody > .ibo-datatable').each(function () { - if ($('#'+this.id).find('thead').is(':visible')) { - $('#'+this.id).DataTable().columns.adjust().draw(); - $('#'+this.id).find('thead').hide(); - } + $('#'+this.id).DataTable().columns.adjust().draw(); }); // Get the index of this tab. diff --git a/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php b/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php index 643e3199e..63f60f481 100644 --- a/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php +++ b/sources/application/UI/Base/Component/DataTable/DataTableUIBlockFactory.php @@ -1,6 +1,6 @@ GetJSRefresh()[0]; $oBlockMenu = $oMenuBlock->GetRenderContent($oPage, $aExtraParams, $sListId); } else { - $oBlockMenu = new UIContentBlock(); + $bToolkitMenu = true; + if (isset($aExtraParams['toolkit_menu'])) { + $bToolkitMenu = (bool)$aExtraParams['toolkit_menu']; + } + if (UserRights::IsPortalUser() || $oPage->IsPrintableVersion()) { + // Portal users have a limited access to data, for now they can only see what's configured for them + $bToolkitMenu = false; + } + if ($bToolkitMenu) { + $aExtraParams['selection_mode'] = true; + $oMenuBlock = new MenuBlock($oSet->GetFilter(), $sStyle); + $oBlockMenu = $oMenuBlock->GetRenderContent($oPage, $aExtraParams, $sListId); + } else { + $oBlockMenu = new UIContentBlock(); + } } if (!isset($aExtraParams['surround_with_panel']) || $aExtraParams['surround_with_panel']) { @@ -320,7 +334,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory 'class_alias' => $sClassAlias, 'attribute_code' => $sAttCode, 'attribute_type' => '_key_', - 'attribute_label' => Dict::S('Class:'.$sClassName), + 'attribute_label' => MetaModel::GetName($sClassName), 'render' => $sDisplayFunction, ]; @@ -328,7 +342,7 @@ class DataTableUIBlockFactory extends AbstractUIBlockFactory } else { $oAttDef = MetaModel::GetAttributeDef($sClassName, $sAttCode); $sAttDefClass = get_class($oAttDef); - $sAttLabel = MetaModel::GetLabel($sClassName, $sAttCode); + $sAttLabel = $oAttDef->GetLabel(); $aColumnDefinition[] = [ 'description' => $oAttDef->GetOrderByHint(), 'object_class' => $sClassName,