advanced search: removal of legacy_search_drawer_open

associated to this change, those wiki pages are altered : 
 - latest:admin:itop_configuration_file (`legacy_search_drawer_open` removal)
 - latest:customization:xml_reference (`search_form_open` default value changed)

SVN:trunk[5626]
This commit is contained in:
Bruno Da Silva
2018-04-06 12:06:20 +00:00
parent dbc0971b99
commit 6ca9f8ad31
9 changed files with 20 additions and 34 deletions

View File

@@ -824,14 +824,7 @@ class OQLMenuNode extends MenuNode
$this->sPageTitle = "Menu:$sMenuId+"; $this->sPageTitle = "Menu:$sMenuId+";
$this->sOQL = $sOQL; $this->sOQL = $sOQL;
$this->bSearch = $bSearch; $this->bSearch = $bSearch;
if ($bSearchFormOpen == null) $this->bSearchFormOpen = $bSearchFormOpen;
{
$this->bSearchFormOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
}
else
{
$this->bSearchFormOpen = $bSearchFormOpen;
}
$this->m_aParams = array(); $this->m_aParams = array();
$this->aReflectionProperties['oql'] = $sOQL; $this->aReflectionProperties['oql'] = $sOQL;
$this->aReflectionProperties['do_search'] = $bSearch; $this->aReflectionProperties['do_search'] = $bSearch;
@@ -966,7 +959,7 @@ class SearchMenuNode extends MenuNode
$oPage->SetBreadCrumbEntry("menu-".$this->sMenuId, $this->GetTitle(), '', '', utils::GetAbsoluteUrlAppRoot().'images/search.png'); $oPage->SetBreadCrumbEntry("menu-".$this->sMenuId, $this->GetTitle(), '', '', utils::GetAbsoluteUrlAppRoot().'images/search.png');
$oSearch = new DBObjectSearch($this->sClass); $oSearch = new DBObjectSearch($this->sClass);
$aParams = array_merge(array('open' => true, 'table_id' => 'Menu_'.utils::GetSafeId($this->GetMenuId())), $aExtraParams); $aParams = array_merge(array('table_id' => 'Menu_'.utils::GetSafeId($this->GetMenuId())), $aExtraParams);
$oBlock = new DisplayBlock($oSearch, 'search', false /* Asynchronous */, $aParams); $oBlock = new DisplayBlock($oSearch, 'search', false /* Asynchronous */, $aParams);
$oBlock->Display($oPage, 0); $oBlock->Display($oPage, 0);
} }

View File

@@ -341,13 +341,11 @@ EOF
$aParams = array(); $aParams = array();
$oFilter = new DBObjectSearch($this->sTargetClass); $oFilter = new DBObjectSearch($this->sTargetClass);
} }
$bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
$oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode); $oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode);
$oBlock = new DisplayBlock($oFilter, 'search', false, $aParams); $oBlock = new DisplayBlock($oFilter, 'search', false, $aParams);
$sHTML .= $oBlock->GetDisplay($oPage, $this->iId, $sHTML .= $oBlock->GetDisplay($oPage, $this->iId,
array( array(
'menu' => false, 'menu' => false,
'open' => $bOpen,
'currentId' => $this->iId, 'currentId' => $this->iId,
'table_id' => "dr_{$this->iId}", 'table_id' => "dr_{$this->iId}",
'table_inner_id' => "{$this->iId}_results", 'table_inner_id' => "{$this->iId}_results",

View File

@@ -331,11 +331,9 @@ class UILinksWidgetDirect
$aArgs = array_merge($oCurrentObj->ToArgs('this'), $oFilter->GetInternalParams()); $aArgs = array_merge($oCurrentObj->ToArgs('this'), $oFilter->GetInternalParams());
$oFilter->SetInternalParams($aArgs); $oFilter->SetInternalParams($aArgs);
} }
$bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
$oBlock = new DisplayBlock($oFilter, 'search', false); $oBlock = new DisplayBlock($oFilter, 'search', false);
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}", $sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}",
array( array(
'open' => $bOpen,
'result_list_outer_selector' => "SearchResultsToAdd_{$this->sInputid}", 'result_list_outer_selector' => "SearchResultsToAdd_{$this->sInputid}",
'table_id' => "add_{$this->sInputid}", 'table_id' => "add_{$this->sInputid}",
'table_inner_id' => "ResultsToAdd_{$this->sInputid}", 'table_inner_id' => "ResultsToAdd_{$this->sInputid}",

View File

@@ -395,7 +395,6 @@ EOF
*/ */
public function GetObjectPickerDialog($oPage, $oCurrentObj, $sJson, $aAlreadyLinkedIds = array(), $aPrefillFormParam = array()) public function GetObjectPickerDialog($oPage, $oCurrentObj, $sJson, $aAlreadyLinkedIds = array(), $aPrefillFormParam = array())
{ {
$bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
$sHtml = "<div class=\"wizContainer\" style=\"vertical-align:top;\">\n"; $sHtml = "<div class=\"wizContainer\" style=\"vertical-align:top;\">\n";
$oAlreadyLinkedFilter = new DBObjectSearch($this->m_sRemoteClass); $oAlreadyLinkedFilter = new DBObjectSearch($this->m_sRemoteClass);
@@ -421,7 +420,6 @@ EOF
$oBlock = new DisplayBlock($oFilter, 'search', false); $oBlock = new DisplayBlock($oFilter, 'search', false);
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}", $sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}",
array( array(
'open' => $bOpen,
'menu' => false, 'menu' => false,
'result_list_outer_selector' => "SearchResultsToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}", 'result_list_outer_selector' => "SearchResultsToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}",
'table_id' => 'add_'.$this->m_sAttCode, 'table_id' => 'add_'.$this->m_sAttCode,

View File

@@ -41,7 +41,6 @@ class UISearchFormForeignKeys
*/ */
public function ShowModalSearchForeignKeys($oPage, $sTitle) public function ShowModalSearchForeignKeys($oPage, $sTitle)
{ {
$bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
$sHtml = "<div class=\"wizContainer\" style=\"vertical-align:top;\">\n"; $sHtml = "<div class=\"wizContainer\" style=\"vertical-align:top;\">\n";
$oFilter = new DBObjectSearch($this->m_sRemoteClass); $oFilter = new DBObjectSearch($this->m_sRemoteClass);
@@ -49,7 +48,6 @@ class UISearchFormForeignKeys
$oBlock = new DisplayBlock($oFilter, 'search', false); $oBlock = new DisplayBlock($oFilter, 'search', false);
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_iInputId}", $sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_iInputId}",
array( array(
'open' => $bOpen,
'menu' => false, 'menu' => false,
'result_list_outer_selector' => "SearchResultsToAdd_{$this->m_iInputId}", 'result_list_outer_selector' => "SearchResultsToAdd_{$this->m_iInputId}",
'table_id' => "add_{$this->m_iInputId}", 'table_id' => "add_{$this->m_iInputId}",

View File

@@ -1053,14 +1053,6 @@ class Config
'source_of_value' => '', 'source_of_value' => '',
'show_in_conf_sample' => false, '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,
),
'obsolescence.show_obsolete_data' => array( 'obsolescence.show_obsolete_data' => array(
'type' => 'bool', 'type' => 'bool',
'description' => 'Default value for the user preference "show obsolete data"', 'description' => 'Default value for the user preference "show obsolete data"',

View File

@@ -130,7 +130,10 @@ function DisplayDetails($oP, $sClass, $oObj, $id)
$sClassLabel = MetaModel::GetName($sClass); $sClassLabel = MetaModel::GetName($sClass);
$oSearch = new DBObjectSearch($sClass); $oSearch = new DBObjectSearch($sClass);
$oBlock = new DisplayBlock($oSearch, 'search', false); $oBlock = new DisplayBlock($oSearch, 'search', false);
$oBlock->Display($oP, 0, array('table_id' => 'search-widget-results-outer')); $oBlock->Display($oP, 0, array(
'table_id' => 'search-widget-results-outer',
'open' => false,
));
// The object could be listed, check if it is actually allowed to view it // The object could be listed, check if it is actually allowed to view it
$oSet = CMDBObjectSet::FromObject($oObj); $oSet = CMDBObjectSet::FromObject($oObj);
@@ -194,7 +197,7 @@ function SetObjectBreadCrumbEntry(DBObject $oObj, WebPage $oPage)
* @param $bDoSearch bool True to display the search results below the search form * @param $bDoSearch bool True to display the search results below the search form
* @param $bSearchFormOpen bool True to display the search form fully expanded (only if $bSearchForm of course) * @param $bSearchFormOpen bool True to display the search form fully expanded (only if $bSearchForm of course)
*/ */
function DisplaySearchSet($oP, $oFilter, $bSearchForm = true, $sBaseClass = '', $sFormat = '', $bDoSearch = true, $bSearchFormOpen = false) function DisplaySearchSet($oP, $oFilter, $bSearchForm = true, $sBaseClass = '', $sFormat = '', $bDoSearch = true, $bSearchFormOpen = true)
{ {
if ($bSearchForm) if ($bSearchForm)
{ {

View File

@@ -1897,7 +1897,7 @@ EOF;
break; break;
default: default:
$sSearchFormOpen = 'null'; // Actual open/close status depend on the config $sSearchFormOpen = 'true';
} }
$sNewMenu = "new OQLMenuNode('$sMenuId', $sOQL, $sParentSpec, $fRank, $bSearch {$sOptionalEnableParams}, $sSearchFormOpen);"; $sNewMenu = "new OQLMenuNode('$sMenuId', $sOQL, $sParentSpec, $fRank, $bSearch {$sOptionalEnableParams}, $sSearchFormOpen);";
break; break;

View File

@@ -84,6 +84,15 @@ class SearchForm
{ {
$sRootClass = $sClassName; $sRootClass = $sClassName;
} }
//should the search be opend on load?
if (isset($aExtraParams['open']))
{
$bOpen = $aExtraParams['open'];
}
else
{
$bOpen = true;
}
$sJson = utils::ReadParam('json', '', false, 'raw_data'); $sJson = utils::ReadParam('json', '', false, 'raw_data');
if (!empty($sJson)) if (!empty($sJson))
@@ -124,7 +133,7 @@ class SearchForm
$sClassesCombo = MetaModel::GetName($sClassName); $sClassesCombo = MetaModel::GetName($sClassName);
} }
$sAction = (isset($aExtraParams['action'])) ? $aExtraParams['action'] : utils::GetAbsoluteUrlAppRoot().'pages/UI.php'; $sAction = (isset($aExtraParams['action'])) ? $aExtraParams['action'] : utils::GetAbsoluteUrlAppRoot().'pages/UI.php';
$sStyle = (isset($aExtraParams['open']) && ($aExtraParams['open'] == 'true')) ? '' : 'closed'; $sStyle = ($bOpen == 'true') ? '' : 'closed';
$sHtml .= "<form id=\"fs_{$sSearchFormId}\" action=\"{$sAction}\" class=\"{$sStyle}\">\n"; // Don't use $_SERVER['SCRIPT_NAME'] since the form may be called asynchronously (from ajax.php) $sHtml .= "<form id=\"fs_{$sSearchFormId}\" action=\"{$sAction}\" class=\"{$sStyle}\">\n"; // Don't use $_SERVER['SCRIPT_NAME'] since the form may be called asynchronously (from ajax.php)
$sHtml .= "<h2 class=\"sf_title\"><span class=\"sft_picto fa fa-search\"></span>" . Dict::Format('UI:SearchFor_Class_Objects', $sClassesCombo) . "<a class=\"sft_toggler fa fa-caret-down pull-right\" href=\"#\" title=\"" . Dict::S('UI:Search:Toggle') . "\"></a><a class=\"sft_refresh fa fa-search pull-right\" href=\"#\" title=\"" . Dict::S('UI:Button:Refresh') . "\"></a></h2>\n"; $sHtml .= "<h2 class=\"sf_title\"><span class=\"sft_picto fa fa-search\"></span>" . Dict::Format('UI:SearchFor_Class_Objects', $sClassesCombo) . "<a class=\"sft_toggler fa fa-caret-down pull-right\" href=\"#\" title=\"" . Dict::S('UI:Search:Toggle') . "\"></a><a class=\"sft_refresh fa fa-search pull-right\" href=\"#\" title=\"" . Dict::S('UI:Button:Refresh') . "\"></a></h2>\n";
$sHtml .= "<div id=\"fs_{$sSearchFormId}_message\" class=\"sf_message header_message\"></div>\n"; $sHtml .= "<div id=\"fs_{$sSearchFormId}_message\" class=\"sf_message header_message\"></div>\n";
@@ -173,11 +182,8 @@ class SearchForm
{ {
$aListParams['table_inner_id'] = "table_inner_id_{$sSearchFormId}"; $aListParams['table_inner_id'] = "table_inner_id_{$sSearchFormId}";
} }
$bOpen = false;
if (isset($aExtraParams['open']))
{
$bOpen = $aExtraParams['open'];
}
$sDebug = utils::ReadParam('debug', 'false', false, 'parameter'); $sDebug = utils::ReadParam('debug', 'false', false, 'parameter');
if ($sDebug == 'true') if ($sDebug == 'true')