diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 81fe02719..555ba51f8 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -296,7 +296,8 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay 'object_id' => $this->GetKey(), 'menu' => true, 'default' => $aDefaults, - ); + 'table_id' => $sClass.'_'.$sAttCode, + ); $oBlock = new DisplayBlock($oFilter, 'list', false); $oBlock->Display($oPage, $sInputId, $aParams); @@ -341,7 +342,8 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay 'object_id' => $this->GetKey(), 'menu' => false, 'default' => $aDefaults, - ); + 'table_id' => $sClass.'_'.$sAttCode, + ); } else { @@ -357,6 +359,7 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay 'view_link' => false, 'menu' => false, 'display_limit' => true, // By default limit the list to speed up the initial load & display + 'table_id' => $sClass.'_'.$sAttCode, ); } $oPage->p(MetaModel::GetClassIcon($sTargetClass)." ".$oAttDef->GetDescription()); @@ -1369,6 +1372,12 @@ abstract class cmdbAbstractObject extends CMDBObject implements iDisplay } $sHtml .= "

\n"; $sHtml .= "

\n"; + if (isset($aExtraParams['table_id'])) + { + // Rename to avoid collisions... + $aExtraParams['_table_id_'] = $aExtraParams['table_id']; + unset($aExtraParams['table_id']); + } foreach($aExtraParams as $sName => $sValue) { $sHtml .= "\n"; diff --git a/application/dashlet.class.inc.php b/application/dashlet.class.inc.php index 4ac8fd842..05930d348 100644 --- a/application/dashlet.class.inc.php +++ b/application/dashlet.class.inc.php @@ -343,6 +343,7 @@ class DashletObjectList extends Dashlet $oBlock = new DisplayBlock($oFilter, 'list'); $aExtraParams = array( 'menu' => $sShowMenu, + 'table_id' => 'Dashlet'.$this->sId, ); $sBlockId = 'block_'.$this->sId.($bEditMode ? '_edit' : ''); // make a unique id (edition occuring in the same DOM) $oBlock->Display($oPage, $sBlockId, $aExtraParams); diff --git a/application/datatable.class.inc.php b/application/datatable.class.inc.php index 2ecd0bfa2..899716ae0 100644 --- a/application/datatable.class.inc.php +++ b/application/datatable.class.inc.php @@ -95,7 +95,7 @@ class DataTable $sToolkitMenu = $this->GetToolkitMenu($oPage, $aExtraParams); } $sDataTable = $this->GetHTMLTable($oPage, $aColumns, $sSelectMode, $iPageSize, $bViewLink, $aExtraParams); - $sConfigDlg = $this->GetTableConfigDlg($oPage, $aColumns, $bViewLink); + $sConfigDlg = $this->GetTableConfigDlg($oPage, $aColumns, $bViewLink, $iDefaultPageSize); $sHtml = "iListId}\" class=\"datatable\">\n"; $sHtml .= "\n"; @@ -244,7 +244,7 @@ EOF; return $sHtml; } - protected function GetTableConfigDlg(WebPage $oPage, $aColumns, $bViewLink) + protected function GetTableConfigDlg(WebPage $oPage, $aColumns, $bViewLink, $iDefaultPageSize) { $sHtml = "
iListId}\" style=\"display: none;\">"; $sHtml .= "
"; @@ -255,7 +255,7 @@ EOF; $sHtml .= " ".Dict::S('UI:UseSpecificSettings').""; $sHtml .= Dict::S('UI:ColumnsAndSortOrder').'
'; - $sHtml .= '

'.Dict::Format('UI:Display_X_ItemsPerPage', '').'

'; + $sHtml .= '

'.Dict::Format('UI:Display_X_ItemsPerPage', '').'

'; $sHtml .= ""; $sHtml .= "
"; $sSaveChecked = ($this->sTableId != null) ? 'checked' : ''; diff --git a/application/displayblock.class.inc.php b/application/displayblock.class.inc.php index fb880dfdf..5d47b3e6f 100644 --- a/application/displayblock.class.inc.php +++ b/application/displayblock.class.inc.php @@ -317,6 +317,15 @@ class DisplayBlock $this->AddCondition($sFilterCode, $condition); } } + if ($bDoSearch) + { + // Keep the table_id identifying this table if we're performing a search + $sTableId = utils::ReadParam('_table_id_', null, false, 'raw_data'); + if ($sTableId != null) + { + $aExtraParams['table_id'] = $sTableId; + } + } } $aOrderBy = array(); if (isset($aExtraParams['order_by'])) diff --git a/application/menunode.class.inc.php b/application/menunode.class.inc.php index 2722c6347..8089ae486 100644 --- a/application/menunode.class.inc.php +++ b/application/menunode.class.inc.php @@ -529,6 +529,7 @@ class TemplateMenuNode extends MenuNode $sTemplate = @file_get_contents($this->sTemplateFile); if ($sTemplate !== false) { + $aExtraParams['table_id'] = 'Menu_'.$this->GetMenuId(); $oTemplate = new DisplayTemplate($sTemplate); $oTemplate->Render($oPage, $aExtraParams); } @@ -605,31 +606,19 @@ class OQLMenuNode extends MenuNode { $sIcon = ''; } - // The standard template used for all such pages: a (closed) search form at the top and a list of results at the bottom - $sTemplate = ''; if ($this->bSearch) { - $sTemplate .= <<$this->sOQL -EOF; + $aParams = array_merge(array('open' => true, 'table_id' => 'Menu_'.$this->GetMenuId()), $aExtraParams); + $oBlock = new DisplayBlock($oSearch, 'search', false /* Asynchronous */, $aParams); + $oBlock->Display($oPage, 0); } - $sParams = ''; - if (!empty($this->m_aParams)) - { - $sParams = 'parameters="'; - foreach($this->m_aParams as $sName => $sValue) - { - $sParams .= $sName.':'.$sValue.';'; - } - $sParams .= '"'; - } - $sTemplate .= <<$sIcon$this->sPageTitle

-$this->sOQL -EOF; - $oTemplate = new DisplayTemplate($sTemplate); - $oTemplate->Render($oPage, $aExtraParams); + + $oPage->add("

$sIcon ".Dict::S($this->sPageTitle)."

"); + + $aParams = array_merge(array('table_id' => 'Menu_'.$this->GetMenuId()), $aExtraParams); + $oBlock = new DisplayBlock($oSearch, 'list', false /* Asynchronous */, $aParams); + $oBlock->Display($oPage, 1); } } /** @@ -662,12 +651,10 @@ class SearchMenuNode extends MenuNode public function RenderContent(WebPage $oPage, $aExtraParams = array()) { - // The standard template used for all such pages: an open search form at the top - $sTemplate = <<SELECT $this->sClass -EOF; - $oTemplate = new DisplayTemplate($sTemplate); - $oTemplate->Render($oPage, $aExtraParams); + $oSearch = new DBObjectSearch($this->sClass); + $aParams = array_merge(array('open' => true, 'table_id' => 'Menu_'.$this->GetMenuId()), $aExtraParams); + $oBlock = new DisplayBlock($oSearch, 'search', false /* Asynchronous */, $aParams); + $oBlock->Display($oPage, 0); } } diff --git a/application/ui.extkeywidget.class.inc.php b/application/ui.extkeywidget.class.inc.php index 5e3d6350f..ec538ca83 100644 --- a/application/ui.extkeywidget.class.inc.php +++ b/application/ui.extkeywidget.class.inc.php @@ -337,7 +337,7 @@ EOF $oFilter = DBObjectSearch::FromOQL($sFilter); $oFilter->SetModifierProperty('UserRightsGetSelectFilter', 'bSearchMode', $this->bSearchMode); $oBlock = new DisplayBlock($oFilter, 'list', false, array('query_params' => array('this' => $oObj))); - $oBlock->Display($oP, $this->iId.'_results', array('this' => $oObj, 'cssCount'=> '#count_'.$this->iId, 'menu' => false, 'selection_mode' => true, 'selection_type' => 'single')); // Don't display the 'Actions' menu on the results + $oBlock->Display($oP, $this->iId.'_results', array('this' => $oObj, 'cssCount'=> '#count_'.$this->iId, 'menu' => false, 'selection_mode' => true, 'selection_type' => 'single', 'table_id' => 'select_'.$this->sAttCode)); // Don't display the 'Actions' menu on the results } catch(MissingQueryArgument $e) { diff --git a/application/ui.linkswidget.class.inc.php b/application/ui.linkswidget.class.inc.php index 3d4511624..8f9c233ad 100644 --- a/application/ui.linkswidget.class.inc.php +++ b/application/ui.linkswidget.class.inc.php @@ -405,7 +405,7 @@ EOF } $oSet = new CMDBObjectSet($oFilter); $oBlock = new DisplayBlock($oFilter, 'list', false); - $oBlock->Display($oP, "ResultsToAdd_{$this->m_sAttCode}", array('menu' => false, 'cssCount'=> '#count_'.$this->m_sAttCode.$this->m_sNameSuffix , 'selection_mode' => true)); // Don't display the 'Actions' menu on the results + $oBlock->Display($oP, "ResultsToAdd_{$this->m_sAttCode}", array('menu' => false, 'cssCount'=> '#count_'.$this->m_sAttCode.$this->m_sNameSuffix , 'selection_mode' => true, 'table_id' => 'add_'.$this->m_sAttCode)); // Don't display the 'Actions' menu on the results } public function DoAddObjects(WebPage $oP, $oFullSetFilter, $oCurrentObj)
$sObjectsCount$sActionsMenu