mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°4007 - When a search is on auto submit, auto submit it also on first display - new fix in order to avoid reload in case of OQLMenuNode -add param in searchFormHandler
This commit is contained in:
@@ -192,6 +192,8 @@ class DisplayBlock
|
||||
/** string */
|
||||
'open',
|
||||
/** bool open by default the search */
|
||||
'submit_on_load',
|
||||
/** bool submit the search on loading page */
|
||||
'class', /** class name */
|
||||
'search_header_force_dropdown', /** Html for <select> to choose the class to search */
|
||||
'this',
|
||||
@@ -201,6 +203,8 @@ class DisplayBlock
|
||||
/** string search root class */
|
||||
'open',
|
||||
/** bool open the search panel by default */
|
||||
'submit_on_load',
|
||||
/** bool submit the search on loading page */
|
||||
'result_list_outer_selector',
|
||||
/** string js selector of the search result display */
|
||||
'search_header_force_dropdown',
|
||||
|
||||
@@ -1128,21 +1128,11 @@ class OQLMenuNode extends MenuNode
|
||||
//$sIcon = MetaModel::GetClassIcon($oSearch->GetClass(), false);
|
||||
|
||||
if ($bSearchPane) {
|
||||
$aParams = array_merge(array('open' => $bSearchOpen, 'table_id' => $sUsageId), $aExtraParams);
|
||||
$aParams = array_merge(['open' => $bSearchOpen, 'table_id' => $sUsageId, 'submit_on_load' => true], $aExtraParams);
|
||||
$oBlock = new DisplayBlock($oSearch, 'search', false /* Asynchronous */, $aParams);
|
||||
$oBlock->Display($oPage, 0);
|
||||
}
|
||||
|
||||
$oPage->add("<div class='sf_results_area' data-target='search_results'>");
|
||||
$oTitle = TitleUIBlockFactory::MakeForPage($sTitle);
|
||||
$oPage->AddUiBlock($oTitle);
|
||||
|
||||
$aParams = array_merge(array('table_id' => $sUsageId), $aExtraParams);
|
||||
$oBlock = new DisplayBlock($oSearch, 'list', false /* Asynchronous */, $aParams);
|
||||
$oBlock->Display($oPage, $sUsageId);
|
||||
|
||||
$oPage->add("</div>");
|
||||
|
||||
if ($bEnableBreadcrumb && ($oPage instanceof iTopWebPage)) {
|
||||
// Breadcrumb
|
||||
//$iCount = $oBlock->GetDisplayedCount();
|
||||
@@ -1212,32 +1202,6 @@ class SearchMenuNode extends MenuNode
|
||||
$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("<div class='sf_results_area' data-target='search_results'>");
|
||||
|
||||
$aParams = array_merge(array('table_id' =>$sUsageId), $aExtraParams);
|
||||
$oBlock = new DisplayBlock($oSearch, 'list', false /* Asynchronous */, $aParams);
|
||||
$oBlock->Display($oPage, $sUsageId);
|
||||
|
||||
$oPage->add("</div>");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ $(function()
|
||||
'endpoint': null,
|
||||
'init_opened': false,
|
||||
'auto_submit': true,
|
||||
'submit_on_load': false,
|
||||
'show_obsolete_data' : true,
|
||||
'search': {
|
||||
'base_oql': '',
|
||||
@@ -127,10 +128,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.options.submit_on_load === true)
|
||||
{
|
||||
this._submit();
|
||||
}*/
|
||||
}
|
||||
|
||||
},
|
||||
// called when created, and later when changing options
|
||||
|
||||
@@ -227,6 +227,7 @@ class SearchForm
|
||||
{
|
||||
$aListParams['table_inner_id'] = "table_inner_id_{$sSearchFormId}";
|
||||
}
|
||||
$bSubmitOnLoad = (isset($aExtraParams['submit_on_load'])) ? $aExtraParams['submit_on_load'] : false;
|
||||
|
||||
$sDebug = utils::ReadParam('debug', 'false', false, 'parameter');
|
||||
if ($sDebug == 'true')
|
||||
@@ -250,6 +251,7 @@ class SearchForm
|
||||
'data_config_list_selector' => "#{$aExtraParams['result_list_outer_selector']}",
|
||||
'endpoint' => utils::GetAbsoluteUrlAppRoot().'pages/ajax.searchform.php?'.$sContext,
|
||||
'init_opened' => $bOpen,
|
||||
'submit_on_load' => $bSubmitOnLoad,
|
||||
'auto_submit' => $bAutoSubmit,
|
||||
'list_params' => $aListParams,
|
||||
'show_obsolete_data' => $bShowObsoleteData,
|
||||
|
||||
Reference in New Issue
Block a user