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->sOQL = $sOQL;
$this->bSearch = $bSearch;
if ($bSearchFormOpen == null)
{
$this->bSearchFormOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
}
else
{
$this->bSearchFormOpen = $bSearchFormOpen;
}
$this->bSearchFormOpen = $bSearchFormOpen;
$this->m_aParams = array();
$this->aReflectionProperties['oql'] = $sOQL;
$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');
$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->Display($oPage, 0);
}

View File

@@ -341,13 +341,11 @@ 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(
'menu' => false,
'open' => $bOpen,
'currentId' => $this->iId,
'table_id' => "dr_{$this->iId}",
'table_inner_id' => "{$this->iId}_results",

View File

@@ -331,11 +331,9 @@ class UILinksWidgetDirect
$aArgs = array_merge($oCurrentObj->ToArgs('this'), $oFilter->GetInternalParams());
$oFilter->SetInternalParams($aArgs);
}
$bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
$oBlock = new DisplayBlock($oFilter, 'search', false);
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}",
array(
'open' => $bOpen,
'result_list_outer_selector' => "SearchResultsToAdd_{$this->sInputid}",
'table_id' => "add_{$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())
{
$bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
$sHtml = "<div class=\"wizContainer\" style=\"vertical-align:top;\">\n";
$oAlreadyLinkedFilter = new DBObjectSearch($this->m_sRemoteClass);
@@ -421,7 +420,6 @@ EOF
$oBlock = new DisplayBlock($oFilter, 'search', false);
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}",
array(
'open' => $bOpen,
'menu' => false,
'result_list_outer_selector' => "SearchResultsToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}",
'table_id' => 'add_'.$this->m_sAttCode,

View File

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

View File

@@ -1053,14 +1053,6 @@ 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,
),
'obsolescence.show_obsolete_data' => array(
'type' => 'bool',
'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);
$oSearch = new DBObjectSearch($sClass);
$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
$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 $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)
{

View File

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

View File

@@ -84,6 +84,15 @@ class SearchForm
{
$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');
if (!empty($sJson))
@@ -124,7 +133,7 @@ class SearchForm
$sClassesCombo = MetaModel::GetName($sClassName);
}
$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 .= "<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";
@@ -173,11 +182,8 @@ class SearchForm
{
$aListParams['table_inner_id'] = "table_inner_id_{$sSearchFormId}";
}
$bOpen = false;
if (isset($aExtraParams['open']))
{
$bOpen = $aExtraParams['open'];
}
$sDebug = utils::ReadParam('debug', 'false', false, 'parameter');
if ($sDebug == 'true')