diff --git a/application/menunode.class.inc.php b/application/menunode.class.inc.php index f1612fe06..19f4b7fd2 100644 --- a/application/menunode.class.inc.php +++ b/application/menunode.class.inc.php @@ -641,13 +641,20 @@ class OQLMenuNode extends MenuNode * @param integer $iAllowedResults Expected "rights" for the action: either UR_ALLOWED_YES, UR_ALLOWED_NO, UR_ALLOWED_DEPENDS or a mix of them... * @return MenuNode */ - public function __construct($sMenuId, $sOQL, $iParentIndex, $fRank = 0, $bSearch = false, $sEnableClass = null, $iActionCode = null, $iAllowedResults = UR_ALLOWED_YES, $sEnableStimulus = null, $bSearchFormOpen = true) + public function __construct($sMenuId, $sOQL, $iParentIndex, $fRank = 0, $bSearch = false, $sEnableClass = null, $iActionCode = null, $iAllowedResults = UR_ALLOWED_YES, $sEnableStimulus = null, $bSearchFormOpen = null) { parent::__construct($sMenuId, $iParentIndex, $fRank, $sEnableClass, $iActionCode, $iAllowedResults, $sEnableStimulus); $this->sPageTitle = "Menu:$sMenuId+"; $this->sOQL = $sOQL; $this->bSearch = $bSearch; - $this->bSearchFormOpen = $bSearchFormOpen; + if ($bSearchFormOpen == null) + { + $this->bSearchFormOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open'); + } + else + { + $this->bSearchFormOpen = $bSearchFormOpen; + } $this->m_aParams = array(); $this->aReflectionProperties['oql'] = $sOQL; $this->aReflectionProperties['do_search'] = $bSearch; diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index a430dface..574e91e17 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -328,9 +328,10 @@ EOF $aParams = array(); $oFilter = new DBObjectSearch($this->sTargetClass); } + $bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open'); $oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode); $oBlock = new DisplayBlock($oFilter, 'search', false, $aParams); - $sHTML .= $oBlock->GetDisplay($oPage, $this->iId, array('open' => true, 'currentId' => $this->iId)); + $sHTML .= $oBlock->GetDisplay($oPage, $this->iId, array('open' => $bOpen, 'currentId' => $this->iId)); $sHTML .= "
iId}\" OnSubmit=\"return oACWidget_{$this->iId}.DoOk();\">\n"; $sHTML .= "
iId}\" style=\"vertical-align:top;background: #fff;height:100%;overflow:auto;padding:0;border:0;\">\n"; $sHTML .= "

".Dict::S('UI:Message:EmptyList:UseSearchForm')."

\n"; diff --git a/application/ui.linksdirectwidget.class.inc.php b/application/ui.linksdirectwidget.class.inc.php index e96817b9d..9860f9501 100644 --- a/application/ui.linksdirectwidget.class.inc.php +++ b/application/ui.linksdirectwidget.class.inc.php @@ -262,8 +262,9 @@ class UILinksWidgetDirect { $this->SetSearchDefaultFromContext($oCurrentObj, $oFilter); } + $bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open'); $oBlock = new DisplayBlock($oFilter, 'search', false); - $sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}", array('open' => true)); + $sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}", array('open' => $bOpen)); $sHtml .= "sInputid}\">\n"; $sHtml .= "
sInputid}\" style=\"vertical-align:top;background: #fff;height:100%;overflow:auto;padding:0;border:0;\">\n"; $sHtml .= "

".Dict::S('UI:Message:EmptyList:UseSearchForm')."

\n"; diff --git a/application/ui.linkswidget.class.inc.php b/application/ui.linkswidget.class.inc.php index 84e21e5a3..ce6545619 100644 --- a/application/ui.linkswidget.class.inc.php +++ b/application/ui.linkswidget.class.inc.php @@ -356,11 +356,12 @@ EOF public function GetObjectPickerDialog($oPage, $oCurrentObj) { + $bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open'); $sHtml = "
\n"; $oFilter = new DBObjectSearch($this->m_sRemoteClass); $this->SetSearchDefaultFromContext($oCurrentObj, $oFilter); $oBlock = new DisplayBlock($oFilter, 'search', false); - $sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}", array('open' => true)); + $sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}", array('open' => $bOpen)); $sHtml .= "m_sAttCode}{$this->m_sNameSuffix}\" OnSubmit=\"return oWidget{$this->m_iInputId}.DoAddObjects(this.id);\">\n"; $sHtml .= "
m_sAttCode}{$this->m_sNameSuffix}\" style=\"vertical-align:top;background: #fff;height:100%;overflow:auto;padding:0;border:0;\">\n"; $sHtml .= "

".Dict::S('UI:Message:EmptyList:UseSearchForm')."

\n"; diff --git a/core/config.class.inc.php b/core/config.class.inc.php index 846192090..05dc55c58 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -914,6 +914,14 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ), + 'legacy_search_drawer_open' => array( + 'type' => 'bool', + 'description' => 'Whether or not to display the "search drawer" open by default as in previous versions of iTop.', + 'default' => false, + 'value' => '', + 'source_of_value' => '', + 'show_in_conf_sample' => false, + ), ); public function IsProperty($sPropCode) diff --git a/setup/compiler.class.inc.php b/setup/compiler.class.inc.php index 8018f15f2..45fd244b7 100644 --- a/setup/compiler.class.inc.php +++ b/setup/compiler.class.inc.php @@ -1773,7 +1773,21 @@ EOF; case 'OQLMenuNode': $sOQL = self::QuoteForPHP($oMenu->GetChildText('oql')); $bSearch = ($oMenu->GetChildText('do_search') == '1') ? 'true' : 'false'; - $sSearchFormOpen = ($oMenu->GetChildText('search_form_open') == '1') ? 'true' : 'false'; + $sSearchFormOpenXML = $oMenu->GetChildText('search_form_open'); + switch($sSearchFormOpenXML) + { + case '1': + $sSearchFormOpen = 'true'; + break; + + case '0': + $sSearchFormOpen = 'false'; + break; + + default: + $sSearchFormOpen = 'null'; // Actual open/close status depend on the config + } + $sSearchFormOpen = ($oMenu->GetChildText('search_form_open') == '') ? 'null' : 'false'; $sNewMenu = "new OQLMenuNode('$sMenuId', $sOQL, $sParentSpec, $fRank, $bSearch, $sSearchFormOpen);"; break;