소스 검색

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

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@4232 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 9 년 전
부모
커밋
6188d09657

+ 9 - 2
application/menunode.class.inc.php

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

+ 2 - 1
application/ui.extkeywidget.class.inc.php

@@ -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";

+ 2 - 1
application/ui.linksdirectwidget.class.inc.php

@@ -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";

+ 2 - 1
application/ui.linkswidget.class.inc.php

@@ -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";

+ 8 - 0
core/config.class.inc.php

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

+ 15 - 1
setup/compiler.class.inc.php

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