mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 00:02:17 +02:00
N°1386 - Advanced Search: Navigation in list - Browse this list - back from run_query
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023 Combodo SARL
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Base\Component\DataTable;
|
||||
|
||||
|
||||
use ApplicationContext;
|
||||
use Combodo\iTop\Application\UI\Base\Layout\UIContentBlock;
|
||||
use Combodo\iTop\Application\UI\Base\tJSRefreshCallback;
|
||||
use DataTableConfig;
|
||||
|
||||
/**
|
||||
* Class DataTableBasket
|
||||
*
|
||||
* @package Combodo\iTop\Application\UI\Base\Component\DataTableBasket
|
||||
* @since 3.1.0
|
||||
*/
|
||||
class DataTableBasket extends UIContentBlock
|
||||
{
|
||||
// Overloaded constants
|
||||
public const BLOCK_CODE = 'ibo-datatable-basket';
|
||||
|
||||
public const DEFAULT_JS_ON_READY_TEMPLATE_REL_PATH = 'base/components/datatable/basket';
|
||||
|
||||
protected $sPostedFieldsForBackUrl;
|
||||
|
||||
|
||||
/**
|
||||
* Panel constructor.
|
||||
*
|
||||
*/
|
||||
public function __construct(array $aPostedFieldsForBackUrl = [], ?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->sPostedFieldsForBackUrl = json_encode($aPostedFieldsForBackUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetPostedFieldsForBackUrl(): string
|
||||
{
|
||||
return $this->sPostedFieldsForBackUrl;
|
||||
}
|
||||
}
|
||||
@@ -899,10 +899,18 @@ JS;
|
||||
return $oTable;
|
||||
}
|
||||
|
||||
public static function MakeParamForBasket(array $aPostedFields)
|
||||
{
|
||||
$oBlock = new DataTableBasket($aPostedFields);
|
||||
|
||||
return $oBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public static function GetAllowedParams(): array
|
||||
public
|
||||
static function GetAllowedParams(): array
|
||||
{
|
||||
return [
|
||||
'surround_with_panel',
|
||||
@@ -953,4 +961,5 @@ JS;
|
||||
/** Don't provide the standard object creation feature */
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -53,6 +53,7 @@ class Navigation extends UIContentBlock
|
||||
protected $sFilter;
|
||||
protected $sBackUrl;
|
||||
protected $sClass;
|
||||
protected $sPostedFields;
|
||||
|
||||
/**
|
||||
* Panel constructor.
|
||||
@@ -62,7 +63,7 @@ class Navigation extends UIContentBlock
|
||||
* @param string $sColorScheme Color scheme code such as "success", "failure", "active", ... {@see css/backoffice/components/_panel.scss}
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct(string $sClass, int $iIdx, array $aList, string $sFilter, string $sBackUrl, ?string $sId = null)
|
||||
public function __construct(string $sClass, int $iIdx, array $aList, string $sFilter, string $sBackUrl, string $sPostedFieldsForBackUrl = "", ?string $sId = null)
|
||||
{
|
||||
parent::__construct($sId);
|
||||
$this->iCount = count($aList);
|
||||
@@ -82,6 +83,7 @@ class Navigation extends UIContentBlock
|
||||
$this->iIdNext = $aList[$iIdx + 1];
|
||||
$this->iIdLast = $aList[$this->iCount - 1];
|
||||
}
|
||||
$this->sPostedFields = $sPostedFieldsForBackUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +91,15 @@ class Navigation extends UIContentBlock
|
||||
*/
|
||||
public function GetIdx(): int
|
||||
{
|
||||
return $this->iIdx+1;
|
||||
return $this->iIdx + 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function GetPostedFields(): string
|
||||
{
|
||||
return $this->sPostedFields;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,7 +48,7 @@ class NavigationUIBlockFactory extends AbstractUIBlockFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Component\Panel\Panel
|
||||
*/
|
||||
public static function MakeStandard($oObject, string $sFilter, array $aList = [], string $sBackUrl = '')
|
||||
public static function MakeStandard($oObject, string $sFilter, array $aList = [], string $sBackUrl = '', $sPostedFieldsForBackUrl = "")
|
||||
{
|
||||
if ($sFilter != null && count($aList) === 0) {
|
||||
$oFilter = DBObjectSearch::FromOQL($sFilter);
|
||||
@@ -60,7 +60,7 @@ class NavigationUIBlockFactory extends AbstractUIBlockFactory
|
||||
}
|
||||
|
||||
$iIdx = array_search($oObject->GetKey(), $aList);
|
||||
$oNavigationBlock = new Navigation(get_class($oObject), $iIdx, $aList, $sFilter, $sBackUrl);
|
||||
$oNavigationBlock = new Navigation(get_class($oObject), $iIdx, $aList, $sFilter, $sBackUrl, $sPostedFieldsForBackUrl);
|
||||
|
||||
return $oNavigationBlock;
|
||||
}
|
||||
|
||||
@@ -55,19 +55,20 @@ class PageContentFactory
|
||||
* @param string $sBasketFilter filter to find list of objects in basket
|
||||
* @param array $aBasketList list of id of objects in basket
|
||||
* @param string $sBackUrl url to go back to list of ojects in basket
|
||||
* @param string $sPostedFieldsForBackUrl fields to post for come back to main page
|
||||
*
|
||||
* @param \DBObject $oObject
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Base\Layout\PageContent\PageContentWithSideContent
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public static function MakeForObjectDetails(DBObject $oObject, string $sMode = cmdbAbstractObject::DEFAULT_DISPLAY_MODE, $sBasketFilter = null, $aBasketList = [], $sBackUrl = null)
|
||||
public static function MakeForObjectDetails(DBObject $oObject, string $sMode = cmdbAbstractObject::DEFAULT_DISPLAY_MODE, $sBasketFilter = null, $aBasketList = [], $sBackUrl = null, $sPostedFieldsForBackUrl = "")
|
||||
{
|
||||
$oLayout = new PageContentWithSideContent();
|
||||
|
||||
|
||||
if ($sBasketFilter != null) {
|
||||
$oNavigationBlock = NavigationUIBlockFactory::MakeStandard($oObject, $sBasketFilter, $aBasketList, $sBackUrl);
|
||||
$oNavigationBlock = NavigationUIBlockFactory::MakeStandard($oObject, $sBasketFilter, $aBasketList, $sBackUrl, $sPostedFieldsForBackUrl);
|
||||
if ($oNavigationBlock != null) {
|
||||
$oLayout->AddSubBlock($oNavigationBlock);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user