From 3139628dd8a70ea0b468d72d6ab72ac2fdbe9236 Mon Sep 17 00:00:00 2001 From: acognet Date: Thu, 5 Aug 2021 15:08:48 +0200 Subject: [PATCH] =?UTF-8?q?N=C2=B04007=20-=20When=20a=20search=20is=20on?= =?UTF-8?q?=20auto=20submit,=20auto=20submit=20it=20also=20on=20first=20di?= =?UTF-8?q?splay=20-=20new=20fix=20in=20order=20to=20avoid=20reload=20in?= =?UTF-8?q?=20case=20of=20OQLMenuNode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/menunode.class.inc.php | 30 ++++++++++++++++++++++++++++-- js/search/search_form_handler.js | 4 ++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/application/menunode.class.inc.php b/application/menunode.class.inc.php index 19890597a..b924a198c 100644 --- a/application/menunode.class.inc.php +++ b/application/menunode.class.inc.php @@ -1133,7 +1133,6 @@ class OQLMenuNode extends MenuNode $oBlock->Display($oPage, 0); } - //$oPage->add("

$sIcon ".utils::HtmlEntities(Dict::S($sTitle))."

"); $oPage->add("
"); $oTitle = TitleUIBlockFactory::MakeForPage($sTitle); $oPage->AddUiBlock($oTitle); @@ -1209,9 +1208,36 @@ class SearchMenuNode extends MenuNode $oPage->SetBreadCrumbEntry("menu-".$this->sMenuId, $this->GetTitle(), '', '', 'fas fa-search', iTopWebPage::ENUM_BREADCRUMB_ENTRY_ICON_TYPE_CSS_CLASSES); $oSearch = new DBObjectSearch($this->sClass); - $aParams = array_merge(array('table_id' => 'Menu_'.utils::GetSafeId($this->GetMenuId())), $aExtraParams); + $sUsageId = 'Menu_'.utils::GetSafeId($this->GetMenuId()); + $aParams = array_merge(array('table_id' =>$sUsageId), $aExtraParams); $oBlock = new DisplayBlock($oSearch, 'search', false /* Asynchronous */, $aParams); $oBlock->Display($oPage, 0); + + $bAutoSubmit = true; + $mSubmitParam = utils::GetConfig()->Get('search_manual_submit'); + if ($mSubmitParam !== false) + { + $bAutoSubmit = false; + } + else + { + $mSubmitParam = utils::GetConfig()->Get('high_cardinality_classes'); + if (is_array($mSubmitParam)) { + if (in_array( $oSearch->GetClass(), $mSubmitParam)) { + $bAutoSubmit = false; + } + } + } + if($bAutoSubmit) { + $oPage->add("
"); + + $aParams = array_merge(array('table_id' =>$sUsageId), $aExtraParams); + $oBlock = new DisplayBlock($oSearch, 'list', false /* Asynchronous */, $aParams); + $oBlock->Display($oPage, $sUsageId); + + $oPage->add("
"); + } + } } diff --git a/js/search/search_form_handler.js b/js/search/search_form_handler.js index b6cf7a595..a6d897fa6 100644 --- a/js/search/search_form_handler.js +++ b/js/search/search_form_handler.js @@ -127,10 +127,10 @@ $(function() }); // If auto submit is enabled, also submit on first display - if(this.options.auto_submit === true) + /*if(this.options.auto_submit === true) { this._submit(); - } + }*/ }, // called when created, and later when changing options