Advanced Search

SVN:b1162[5407]
This commit is contained in:
Eric Espié
2018-03-09 17:07:15 +00:00
parent 8cf4bc58a7
commit d02fb69ca7
4 changed files with 25 additions and 2 deletions

View File

@@ -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 .= "<form id=\"fr_{$this->iId}\" OnSubmit=\"return oACWidget_{$this->iId}.DoOk();\">\n";
$sHTML .= "<div id=\"dr_{$this->iId}\" style=\"vertical-align:top;background: #fff;height:100%;overflow:auto;padding:0;border:0;\">\n";
$sHTML .= "<div style=\"background: #fff; border:0; text-align:center; vertical-align:middle;\"><p>".Dict::S('UI:Message:EmptyList:UseSearchForm')."</p></div>\n";

View File

@@ -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 .= "<form id=\"ObjectsAddForm_{$this->m_sAttCode}{$this->m_sNameSuffix}\" OnSubmit=\"return oWidget{$this->m_iInputId}.DoAddObjects(this.id);\">\n";
$sHtml .= "<div id=\"SearchResultsToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}\" style=\"vertical-align:top;background: #fff;height:100%;overflow:auto;padding:0;border:0;\">\n";
$sHtml .= "<div style=\"background: #fff; border:0; text-align:center; vertical-align:middle;\"><p>".Dict::S('UI:Message:EmptyList:UseSearchForm')."</p></div>\n";

View File

@@ -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');

View File

@@ -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,