"Search Drawer" is closed by default, unless the configuration parameter "legacy_search_drawer" is set to "true".

SVN:trunk[4232]
This commit is contained in:
Denis Flaven
2016-06-21 10:20:20 +00:00
parent a0d16b868e
commit fa2c234a43
6 changed files with 38 additions and 6 deletions

View File

@@ -641,13 +641,20 @@ class OQLMenuNode extends MenuNode
* @param integer $iAllowedResults Expected "rights" for the action: either UR_ALLOWED_YES, UR_ALLOWED_NO, UR_ALLOWED_DEPENDS or a mix of them...
* @return MenuNode
*/
public function __construct($sMenuId, $sOQL, $iParentIndex, $fRank = 0, $bSearch = false, $sEnableClass = null, $iActionCode = null, $iAllowedResults = UR_ALLOWED_YES, $sEnableStimulus = null, $bSearchFormOpen = true)
public function __construct($sMenuId, $sOQL, $iParentIndex, $fRank = 0, $bSearch = false, $sEnableClass = null, $iActionCode = null, $iAllowedResults = UR_ALLOWED_YES, $sEnableStimulus = null, $bSearchFormOpen = null)
{
parent::__construct($sMenuId, $iParentIndex, $fRank, $sEnableClass, $iActionCode, $iAllowedResults, $sEnableStimulus);
$this->sPageTitle = "Menu:$sMenuId+";
$this->sOQL = $sOQL;
$this->bSearch = $bSearch;
$this->bSearchFormOpen = $bSearchFormOpen;
if ($bSearchFormOpen == null)
{
$this->bSearchFormOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
}
else
{
$this->bSearchFormOpen = $bSearchFormOpen;
}
$this->m_aParams = array();
$this->aReflectionProperties['oql'] = $sOQL;
$this->aReflectionProperties['do_search'] = $bSearch;

View File

@@ -328,9 +328,10 @@ 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('open' => true, 'currentId' => $this->iId));
$sHTML .= $oBlock->GetDisplay($oPage, $this->iId, array('open' => $bOpen, 'currentId' => $this->iId));
$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

@@ -262,8 +262,9 @@ class UILinksWidgetDirect
{
$this->SetSearchDefaultFromContext($oCurrentObj, $oFilter);
}
$bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
$oBlock = new DisplayBlock($oFilter, 'search', false);
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}", array('open' => true));
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->sInputid}", array('open' => $bOpen));
$sHtml .= "<form id=\"ObjectsAddForm_{$this->sInputid}\">\n";
$sHtml .= "<div id=\"SearchResultsToAdd_{$this->sInputid}\" 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

@@ -356,11 +356,12 @@ EOF
public function GetObjectPickerDialog($oPage, $oCurrentObj)
{
$bOpen = MetaModel::GetConfig()->Get('legacy_search_drawer_open');
$sHtml = "<div class=\"wizContainer\" style=\"vertical-align:top;\">\n";
$oFilter = new DBObjectSearch($this->m_sRemoteClass);
$this->SetSearchDefaultFromContext($oCurrentObj, $oFilter);
$oBlock = new DisplayBlock($oFilter, 'search', false);
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}", array('open' => true));
$sHtml .= $oBlock->GetDisplay($oPage, "SearchFormToAdd_{$this->m_sAttCode}{$this->m_sNameSuffix}", array('open' => $bOpen));
$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

@@ -914,6 +914,14 @@ 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,
),
);
public function IsProperty($sPropCode)

View File

@@ -1773,7 +1773,21 @@ EOF;
case 'OQLMenuNode':
$sOQL = self::QuoteForPHP($oMenu->GetChildText('oql'));
$bSearch = ($oMenu->GetChildText('do_search') == '1') ? 'true' : 'false';
$sSearchFormOpen = ($oMenu->GetChildText('search_form_open') == '1') ? 'true' : 'false';
$sSearchFormOpenXML = $oMenu->GetChildText('search_form_open');
switch($sSearchFormOpenXML)
{
case '1':
$sSearchFormOpen = 'true';
break;
case '0':
$sSearchFormOpen = 'false';
break;
default:
$sSearchFormOpen = 'null'; // Actual open/close status depend on the config
}
$sSearchFormOpen = ($oMenu->GetChildText('search_form_open') == '') ? 'null' : 'false';
$sNewMenu = "new OQLMenuNode('$sMenuId', $sOQL, $sParentSpec, $fRank, $bSearch, $sSearchFormOpen);";
break;