diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index 476b34b4aa..2f070a0f15 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -652,16 +652,21 @@ class DisplayBlock if (isset($aExtraParams['update_history']) && true == $aExtraParams['update_history']) { + $sSearchFilter = $this->m_oSet->GetFilter()->serialize(); + // Limit the size of the URL (N°1585 - request uri too long) + if (strlen($sSearchFilter) < SERVER_MAX_URL_LENGTH) + { + $seventAttachedData = json_encode(array( + 'filter' => $sSearchFilter, + 'breadcrumb_id' => "ui-search-".$this->m_oSet->GetClass(), + 'breadcrumb_label' => MetaModel::GetName($this->m_oSet->GetClass()), + 'breadcrumb_max_count' => utils::GetConfig()->Get('breadcrumb.max_count'), + 'breadcrumb_instance_id' => MetaModel::GetConfig()->GetItopInstanceid(), + 'breadcrumb_icon' => utils::GetAbsoluteUrlAppRoot().'images/breadcrumb-search.png' + )); - $seventAttachedData = json_encode(array( - 'filter' => $this->m_oSet->GetFilter()->serialize(), - 'breadcrumb_id' => "ui-search-".$this->m_oSet->GetClass(), - 'breadcrumb_label' => MetaModel::GetName($this->m_oSet->GetClass()), - 'breadcrumb_max_count' => utils::GetConfig()->Get('breadcrumb.max_count'), - 'breadcrumb_instance_id'=> MetaModel::GetConfig()->GetItopInstanceid(), - 'breadcrumb_icon' => utils::GetAbsoluteUrlAppRoot().'images/breadcrumb-search.png' - )); - $oPage->add_ready_script("$('body').trigger('update_history.itop', [$seventAttachedData])"); + $oPage->add_ready_script("$('body').trigger('update_history.itop', [$seventAttachedData])"); + } } } break; diff --git a/application/utils.inc.php b/application/utils.inc.php index f8cc9ed96e..68b3c165d7 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -36,6 +36,8 @@ define('ITOP_DEFAULT_CONFIG_FILE', APPCONF.ITOP_DEFAULT_ENV.'/'.ITOP_CONFIG_FILE define('SERVER_NAME_PLACEHOLDER', '$SERVER_NAME$'); +define('SERVER_MAX_URL_LENGTH', 2048); + class FileUploadException extends Exception { } @@ -1023,12 +1025,16 @@ class utils $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/tabularfieldsselector.js'); $oPage->add_linked_script(utils::GetAbsoluteUrlAppRoot().'js/jquery.dragtable.js'); $oPage->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().'css/dragtable.css'); - - $aResult = array( - new SeparatorPopupMenuItem(), + + $aResult = array(); + if (strlen($sUrl) < SERVER_MAX_URL_LENGTH) + { + $aResult[] = new SeparatorPopupMenuItem(); // Static menus: Email this page, CSV Export & Add to Dashboard - new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), "mailto:?body=".urlencode($sUrl).' '), // Add an extra space to make it work in Outlook - ); + $aResult[] = new URLPopupMenuItem('UI:Menu:EMail', Dict::S('UI:Menu:EMail'), + "mailto:?body=".urlencode($sUrl).' ' // Add an extra space to make it work in Outlook + ); + } if (UserRights::IsActionAllowed($param->GetFilter()->GetClass(), UR_ACTION_BULK_READ, $param) != UR_ALLOWED_NO) { diff --git a/js/search/search_form_handler.js b/js/search/search_form_handler.js index ec32d43fee..f297c352a3 100644 --- a/js/search/search_form_handler.js +++ b/js/search/search_form_handler.js @@ -180,17 +180,11 @@ $(function() $('body').on('update_history.itop', function(oEvent, oData) { - // if (me.element.parents('.ui-dialog').length != 0) - // { - // //search form in modal are forbidden to update history! - // return; - // } - - if ($('.ui-dialog:visible :itop-search_form_handler').length != 0) - { - //if a modal containing a search form is visible then the history update event come from it, whe do not want to update the history in this case! because search form in modal are forbidden to update history! - return; - } + if (me.element.parents('.ui-dialog').length !== 0) + { + //search form in modal are forbidden to update history! + return; + } var sNewUrl = GetAbsoluteUrlAppRoot()+'pages/UI.php?operation=search'; sNewUrl = sNewUrl + '&filter='+oData['filter']; @@ -1016,6 +1010,10 @@ $(function() } } $.extend(oListParams, this.options.list_params); + if (me.element.parents('.ui-dialog').length !== 0) + { + oListParams.update_history = false; + } oData.list_params = JSON.stringify(oListParams); if (true === bAbortIfNoChange)