N°3123 : Improved JavaScript management in web pages and ajax pages

This commit is contained in:
acognet
2020-12-08 08:59:01 +01:00
parent 0808a76226
commit 5ccb12453a
11 changed files with 185 additions and 65 deletions

View File

@@ -18,6 +18,7 @@
*/
namespace Combodo\iTop\Application\UI\Base;
use Combodo\iTop\Application\UI\Base\UIException;
/**
@@ -29,6 +30,9 @@ namespace Combodo\iTop\Application\UI\Base;
* @since 3.0.0
*/
interface iUIBlock {
public const JS_TYPE_ON_INIT = "js";
public const JS_TYPE_LIVE = "live.js";
public const JS_TYPE_ON_READY = "ready.js";
/**
* Return the relative path (from <ITOP>/templates/) of the global template (HTML, JS, CSS) to use or null if it's not provided. Should not be used to often as JS/CSS files would be duplicated making the browser parsing time way longer.
*
@@ -46,9 +50,11 @@ interface iUIBlock {
/**
* Return the relative path (from <ITOP>/templates/) of the JS template to use or null if there is no inline JS to render
*
* @param string $sType javascript type only JS_TYPE_ON_INIT / JS_TYPE_ON_READY / JS_TYPE_LIVE
*
* @return string|null
*/
public function GetJsTemplateRelPath();
public function GetJsTemplateRelPath(string $sType) ;
/**
* Return an array of the relative paths (from <ITOP>/) of the JS files to use for the block itself