mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°4836 Better fix by adding AjaxPage::SetOutputDataOnly()
This commit is contained in:
@@ -1060,7 +1060,8 @@ EOF
|
||||
$iCol = utils::ReadParam("iCol");
|
||||
$sDashletIdOrig = utils::ReadParam("dashletid");
|
||||
$sFinalDashletId = Dashboard::GetDashletUniqueId($bIsCustomized, $sDashboardDivId, $iRow, $iCol, $sDashletIdOrig);
|
||||
$oPage = new DownloadPage('');
|
||||
$oPage = new AjaxPage('');
|
||||
$oPage->SetOutputDataOnly(true);
|
||||
$oPage->add($sFinalDashletId);
|
||||
break;
|
||||
|
||||
|
||||
@@ -25,10 +25,17 @@ class AjaxPage extends WebPage implements iTabbedPage
|
||||
/** @var string */
|
||||
private $sPromiseId;
|
||||
|
||||
/**
|
||||
* @var bool if false will also output extra JS & CSS
|
||||
* @since 3.0.1 3.1.0 N°4836 Introduce this new option to AjaxPage, as sometimes we only need to return a simple string
|
||||
*/
|
||||
protected $bOutputDataOnly = false;
|
||||
|
||||
/**
|
||||
* constructor for the web page
|
||||
*
|
||||
* @param string $s_title Not used
|
||||
* @param bool $bOutputExtraResources if true will output also JS & CSS resources
|
||||
*/
|
||||
function __construct($s_title)
|
||||
{
|
||||
@@ -50,6 +57,21 @@ class AjaxPage extends WebPage implements iTabbedPage
|
||||
$oKpi->ComputeStats(get_class($this).' creation', 'AjaxPage');
|
||||
}
|
||||
|
||||
/**
|
||||
* @see static::$bOutputDataOnly
|
||||
* @param bool $bFlag
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @since 3.0.1 3.1.0 N°4836 Method creation : sometimes we only want to output a simple string
|
||||
*/
|
||||
public function SetOutputDataOnly(bool $bFlag)
|
||||
{
|
||||
$this->bOutputDataOnly = $bFlag;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
* @throws \Exception
|
||||
@@ -162,18 +184,19 @@ class AjaxPage extends WebPage implements iTabbedPage
|
||||
header($s_header);
|
||||
}
|
||||
|
||||
// Prepare internal parts (js files, css files, js snippets, css snippets, ...)
|
||||
// - Generate necessary dict. files
|
||||
if ($this->bAddJSDict) {
|
||||
$this->output_dict_entries();
|
||||
if (false === $this->bOutputDataOnly) {
|
||||
// Prepare internal parts (js files, css files, js snippets, css snippets, ...)
|
||||
// - Generate necessary dict. files
|
||||
if ($this->bAddJSDict) {
|
||||
$this->output_dict_entries();
|
||||
}
|
||||
|
||||
ConsoleBlockRenderer::AddCssJsToPage($this, $this->oContentLayout);
|
||||
|
||||
$this->outputCollapsibleSectionInit();
|
||||
}
|
||||
|
||||
ConsoleBlockRenderer::AddCssJsToPage($this, $this->oContentLayout);
|
||||
|
||||
// Render the blocks
|
||||
|
||||
$this->outputCollapsibleSectionInit();
|
||||
|
||||
$aData = [];
|
||||
$aData['oLayout'] = $this->oContentLayout;
|
||||
$aData['aDeferredBlocks'] = $this->GetDeferredBlocks($this->oContentLayout);
|
||||
|
||||
Reference in New Issue
Block a user