From efeedcad30b06db309c19d70945aeb3f589bed9a Mon Sep 17 00:00:00 2001 From: acognet Date: Wed, 31 Mar 2021 01:20:03 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B03868=20-=20"Error:=20Invalid=20filter=20?= =?UTF-8?q?parameter"=20on=20mass=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/cmdbabstract.class.inc.php | 27 ++++++++++++------- .../components/input/_input-select.scss | 8 +++++- pages/UI.php | 9 ++++--- .../components/datatable/layout.ready.js.twig | 10 ++++--- .../static/formtable/layout.ready.js.twig | 5 ++-- 5 files changed, 41 insertions(+), 18 deletions(-) diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 6531dae2d..4d975fd3e 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -2594,14 +2594,14 @@ JS $oPage->set_title(Dict::Format('UI:ModificationPageTitle_Object_Class', $this->GetRawName(), $sClassLabel)); // Set title will take care of the encoding } - $oToolbarTop = ToolbarUIBlockFactory::MakeStandard(null, ['ibo-toolbar-top']); + $oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null); $oCancelButton = ButtonUIBlockFactory::MakeForCancel(); $oCancelButton->AddCSSClasses(['action', 'cancel']); - $oToolbarTop->AddSubBlock($oCancelButton); + $oToolbarButtons->AddSubBlock($oCancelButton); $oApplyButton = ButtonUIBlockFactory::MakeForPrimaryAction($sApplyButton, null, null, true); $oApplyButton->AddCSSClass('action'); - $oToolbarTop->AddSubBlock($oApplyButton); + $oToolbarButtons->AddSubBlock($oApplyButton); $aTransitions = $this->EnumTransitions(); if (!isset($aExtraParams['custom_operation']) && count($aTransitions)) { @@ -2616,7 +2616,7 @@ JS $oButton = ButtonUIBlockFactory::MakeForPrimaryAction($aStimuli[$sStimulusCode]->GetLabel(), 'next_action', $sStimulusCode, true); $oButton->AddCSSClass('action'); $oButton->SetColor(Button::ENUM_COLOR_NEUTRAL); - $oToolbarTop->AddSubBlock($oButton); + $oToolbarButtons->AddSubBlock($oButton); break; default: @@ -2680,16 +2680,22 @@ EOF $oTitle = TitleUIBlockFactory::MakeForPageWithIcon($sTitle, $sClassIcon, Title::DEFAULT_ICON_COVER_METHOD, false); $oObjectDetails = PanelUIBlockFactory::MakeForClass(get_class($this), ''); $oObjectDetails->SetTitleBlock($oTitle); + $oToolbarButtons->AddCSSClass('ibo-toolbar--button'); } else { $oObjectDetails = ObjectFactory::MakeDetails($this, $sMode); + $oToolbarButtons->AddCSSClass('ibo-toolbar-top'); + $oObjectDetails->AddToolbarBlock($oToolbarButtons); } $oForm->AddSubBlock($oObjectDetails); + if (isset($aExtraParams['nbBulkObj'])) { + // if bulk modify buttons must be after object display + $oForm->AddSubBlock($oToolbarButtons); + } $oPage->AddTabContainer(OBJECT_PROPERTIES_TAB, $sPrefix, $oObjectDetails); $oPage->SetCurrentTabContainer(OBJECT_PROPERTIES_TAB); $oPage->SetCurrentTab('UI:PropertiesTab'); $oPage->p($sStatesSelection); - $oObjectDetails->AddToolbarBlock($oToolbarTop); $aFieldsMap = $this->DisplayBareProperties($oPage, true, $sPrefix, $aExtraParams); if (!is_array($aFieldsMap)) { @@ -4734,8 +4740,6 @@ EOF $oForm = FormUIBlockFactory::MakeStandard('')->SetAction($sFormAction); $oP->AddSubBlock($oForm); $oForm->AddSubBlock($oPanel); - $oToolbarTop = ToolbarUIBlockFactory::MakeStandard(null, ['ibo-toolbar-top']); - $oPanel->AddToolbarBlock($oToolbarTop); $oPanel->SetTitleBlock($oTitle); $oAppContext = new ApplicationContext(); @@ -4747,8 +4751,13 @@ EOF $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('class', $sClass)); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('preview_mode', 0)); $oForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('transaction_id', utils::GetNewTransactionId())); - $oToolbarTop->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'))->SetOnClickJsCode("window.location.href='$sCancelUrl'")); - $oToolbarTop->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:ModifyAll'), '', '', true)); + + $oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null); + $oToolbarButtons->AddCSSClass('ibo-toolbar--button'); + $oForm->AddSubBlock($oToolbarButtons); + $oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'))->SetOnClickJsCode("window.location.href='$sCancelUrl'")); + $oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:ModifyAll'), '', '', true)); + foreach ($_POST as $sKey => $value) { if (preg_match('/attr_(.+)/', $sKey, $aMatches)) { // Beware: some values (like durations) are passed as arrays diff --git a/css/backoffice/components/input/_input-select.scss b/css/backoffice/components/input/_input-select.scss index ef8f157c6..4c5920cfb 100644 --- a/css/backoffice/components/input/_input-select.scss +++ b/css/backoffice/components/input/_input-select.scss @@ -59,11 +59,17 @@ $ibo-input-select--action-button--padding-right: 2px !default; } .ibo-input-selectize { min-width: $ibo-input-select-selectize--value--min-midth !important; - >div{ + + > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + + > input { + background-color: unset; + border: unset; + } } .ibo-input-select-wrapper{ position:relative; diff --git a/pages/UI.php b/pages/UI.php index c652285e7..17ad97758 100644 --- a/pages/UI.php +++ b/pages/UI.php @@ -258,8 +258,11 @@ function DisplayMultipleSelectionForm(WebPage $oP, DBSearch $oFilter, string $sN //by default all the elements are selected $aExtraParams['selectionMode'] = 'negative'; $oForm->AddSubBlock($oDisplayBlock->GetDisplay($oP, 1, $aExtraParams)); - $oForm->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'), 'cancel')->SetOnClickJsCode('window.history.back()')); - $oForm->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Next'), 'next', Dict::S('UI:Button:Next'), true)); + $oToolbarButtons = ToolbarUIBlockFactory::MakeStandard(null); + $oToolbarButtons->AddCSSClass('ibo-toolbar--button'); + $oForm->AddSubBlock($oToolbarButtons); + $oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForCancel(Dict::S('UI:Button:Cancel'), 'cancel')->SetOnClickJsCode('window.history.back()')); + $oToolbarButtons->AddSubBlock(ButtonUIBlockFactory::MakeForPrimaryAction(Dict::S('UI:Button:Next'), 'next', Dict::S('UI:Button:Next'), true)); $oP->AddUiBlock($oForm); } @@ -1933,7 +1936,7 @@ class UI // Add user filter $oFilter->UpdateContextFromUser(); $oChecker = new ActionChecker($oFilter, UR_ACTION_BULK_MODIFY); - $oP->add("

".Dict::S('UI:ModifyAllPageTitle')."

\n"); + $oP->AddUiBlock(TitleUIBlockFactory::MakeForPage(Dict::S('UI:ModifyAllPageTitle'))); DisplayMultipleSelectionForm($oP, $oFilter, 'form_for_modify_all', $oChecker); } diff --git a/templates/base/components/datatable/layout.ready.js.twig b/templates/base/components/datatable/layout.ready.js.twig index 8387d7c22..42b96d079 100644 --- a/templates/base/components/datatable/layout.ready.js.twig +++ b/templates/base/components/datatable/layout.ready.js.twig @@ -82,16 +82,20 @@ var oTable{{ sListId }} = $('#{{ oUIBlock.GetId() }}').DataTable({ ordering: true, {% if oUIBlock.GetOption("select_mode") is not empty %} select: { - style: "{{ oUIBlock.GetOption("select_mode") }}" + style: "{% if oUIBlock.GetOption("select_mode") == "multiple" %}multi{% else %}single{% endif %}", + info: false }, rowCallback: function (oRow, oData) { if ($(this).closest('.ibo-panel--body').find('[name=selectionMode]').val() === "negative") { - if (oSelectedItems{{ sListId }}.indexOf(oData.id) === -1) { + if (oSelectedItems{{ sListId }}.indexOf(oData.id) === -1) + { $(oRow).select(); $(oRow).find('td:first-child input').prop('checked', true); } - } else { + } + else + { if (oSelectedItems{{ sListId }}.indexOf(oData.id) > -1) { $(oRow).select(); diff --git a/templates/base/components/datatable/static/formtable/layout.ready.js.twig b/templates/base/components/datatable/static/formtable/layout.ready.js.twig index 92b6b6c3a..ef838930b 100644 --- a/templates/base/components/datatable/static/formtable/layout.ready.js.twig +++ b/templates/base/components/datatable/static/formtable/layout.ready.js.twig @@ -11,9 +11,10 @@ var table{{ oUIBlock.GetId()|sanitize(constant('utils::ENUM_SANITIZATION_FILTER_ dom: "t", "order": [], {% if oUIBlock.GetOption("select_mode") is not empty %} - {% if oUIBlock.GetOption("select_mode") !="custom" %} + {% if oUIBlock.GetOption("select_mode") != "custom" %} select: { - style: "{{ oUIBlock.GetOption("select_mode") }}" + style: "{% if oUIBlock.GetOption("select_mode") == "multiple" %}multi{% else %}single{% endif %}", + info: false }, {% endif %} columnDefs: [