From d02fb69ca7452570e276afff411c99e7cdd1e49f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Espi=C3=A9?= Date: Fri, 9 Mar 2018 17:07:15 +0000 Subject: [PATCH] Advanced Search SVN:b1162[5407] --- application/ui.extkeywidget.class.inc.php | 2 +- application/ui.linkswidget.class.inc.php | 2 +- pages/ajax.searchform.php | 12 ++++++++++++ sources/application/search/searchform.class.inc.php | 11 +++++++++++ 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index 610367eb0..6a430e599 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -342,7 +342,7 @@ EOF $oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode); $oBlock = new DisplayBlock($oFilter, 'search', false, $aParams); $sHTML .= $oBlock->GetDisplay($oPage, $this->iId, - array('open' => $bOpen, 'currentId' => $this->iId, 'table_id' => "dr_{$this->iId}")); + array('open' => $bOpen, 'currentId' => $this->iId, 'table_id' => "dr_{$this->iId}", 'selection_mode' => true, 'selection_type' => 'single')); $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.linkswidget.class.inc.php b/application/ui.linkswidget.class.inc.php index 8b9718e71..9295c919b 100644 --- a/application/ui.linkswidget.class.inc.php +++ b/application/ui.linkswidget.class.inc.php @@ -395,7 +395,7 @@ EOF $this->SetSearchDefaultFromContext($oCurrentObj, $oFilter); $oBlock = new DisplayBlock($oFilter, 'search', false); $sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}", - array('open' => $bOpen, 'table_id' => "SearchResultsToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}")); + array('open' => $bOpen, 'table_id' => "SearchResultsToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}", 'selection_mode' => true)); $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/pages/ajax.searchform.php b/pages/ajax.searchform.php index 343a54e21..96253c3a1 100644 --- a/pages/ajax.searchform.php +++ b/pages/ajax.searchform.php @@ -53,6 +53,18 @@ try $oFilter = CriterionParser::Parse($aParams['base_oql'], $aParams['criterion']); $oDisplayBlock = new DisplayBlock($oFilter, 'list', false); + $sListParams = stripslashes(utils::ReadParam('list_params', '{}', false, 'raw_data')); + $aListParams = json_decode($sListParams, true); + + if (array_key_exists('selection_mode', $aListParams)) + { + $aExtraParams['selection_mode'] = $aListParams['selection_mode']; + } + if (array_key_exists('selection_type', $aListParams)) + { + $aExtraParams['selection_type'] = $aListParams['selection_type']; + } + $aExtraParams['display_limit'] = true; $aExtraParams['truncated'] = true; $aExtraParams['currentId'] = uniqid('ajax-search-form'); diff --git a/sources/application/search/searchform.class.inc.php b/sources/application/search/searchform.class.inc.php index 701c0a875..689e2d449 100644 --- a/sources/application/search/searchform.class.inc.php +++ b/sources/application/search/searchform.class.inc.php @@ -74,6 +74,16 @@ class SearchForm { $sRootClass = $sClassName; } + $aListParams = array(); + if (array_key_exists('selection_mode', $aExtraParams)) + { + $aListParams['selection_mode'] = $aExtraParams['selection_mode']; + } + if (array_key_exists('selection_type', $aExtraParams)) + { + $aListParams['selection_type'] = $aExtraParams['selection_type']; + } + $aSubClasses = MetaModel::GetSubclasses($sRootClass); if (count($aSubClasses) > 0) { @@ -120,6 +130,7 @@ class SearchForm 'criterion_outer_selector' => "#fs_{$sSearchFormId}_criterion_outer", 'result_list_outer_selector' => "#{$aExtraParams['table_id']}", 'endpoint' => utils::GetAbsoluteUrlAppRoot().'pages/ajax.searchform.php', + 'list_params' => $aListParams, 'search' => array( 'fields' => $aFields, 'criterion' => $aCriterion,