Merge remote-tracking branch 'origin/support/3.0' into develop

This commit is contained in:
Eric Espie
2022-03-03 10:23:38 +01:00
54 changed files with 631 additions and 901 deletions

View File

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