mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
N°3685 - Front-end performances: Add conf. param. to include deprecated JS/CSS files back if necessary
This commit is contained in:
@@ -1149,6 +1149,22 @@ class Config
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => true,
|
||||
],
|
||||
'compatibility.include_deprecated_js_files' => [
|
||||
'type' => 'bool',
|
||||
'description' => 'Include the deprecated JS files to ease usage of not migrated extensions',
|
||||
'default' => false,
|
||||
'value' => false,
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'compatibility.include_deprecated_css_files' => [
|
||||
'type' => 'bool',
|
||||
'description' => 'Include the deprecated CSS files to ease usage of not migrated extensions',
|
||||
'default' => false,
|
||||
'value' => false,
|
||||
'source_of_value' => '',
|
||||
'show_in_conf_sample' => false,
|
||||
],
|
||||
'navigation_menu.show_menus_count' => [
|
||||
'type' => 'bool',
|
||||
'description' => 'Display count badges for OQL menu entries',
|
||||
|
||||
@@ -60,6 +60,16 @@ class WebPage implements Page
|
||||
*/
|
||||
public const ENUM_SESSION_MESSAGE_SEVERITY_ERROR = 'error';
|
||||
|
||||
/**
|
||||
* @var array Script linked (externals) to the page through URIs, which were deprecated but can be added back if necessary {@see "compatibility.include_deprecated_js_files" conf. param.}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
protected const COMPATIBILITY_LINKED_SCRIPTS_REL_PATH = [];
|
||||
/**
|
||||
* @var array Stylesheets linked (externals) to the page through URIs, which were deprecated but can be added back if necessary {@see "compatibility.include_deprecated_css_files" conf. param.}
|
||||
* @since 3.0.0
|
||||
*/
|
||||
protected const COMPATIBILITY_LINKED_STYLESHEETS_REL_PATH = [];
|
||||
|
||||
/**
|
||||
* @var string
|
||||
@@ -150,9 +160,11 @@ class WebPage implements Page
|
||||
$this->InitializeInitScripts();
|
||||
$this->InitializeReadyScripts();
|
||||
$this->InitializeLinkedScripts();
|
||||
$this->InitializeCompatibilityLinkedScripts();
|
||||
$this->InitializeDictEntries();
|
||||
$this->InitializeStyles();
|
||||
$this->InitializeLinkedStylesheets();
|
||||
$this->InitializeCompatibilityLinkedStylesheets();
|
||||
$this->a_headers = [];
|
||||
$this->a_base = ['href' => '', 'target' => ''];
|
||||
$this->iNextId = 0;
|
||||
@@ -684,6 +696,33 @@ class WebPage implements Page
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize compatibility linked scripts for the page
|
||||
*
|
||||
* @throws \ConfigException
|
||||
* @throws \CoreException
|
||||
* @since 3.0.0
|
||||
*/
|
||||
protected function InitializeCompatibilityLinkedScripts(): void
|
||||
{
|
||||
$bIncludeDeprecatedFiles = utils::GetConfig()->Get('compatibility.include_deprecated_js_files');
|
||||
if ($bIncludeDeprecatedFiles === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add ancestors files
|
||||
foreach (array_reverse(class_parents(static::class)) as $sParentClass) {
|
||||
foreach ($sParentClass::COMPATIBILITY_LINKED_SCRIPTS_REL_PATH as $sJSFile) {
|
||||
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().$sJSFile);
|
||||
}
|
||||
}
|
||||
|
||||
// Add current class files
|
||||
foreach (static::COMPATIBILITY_LINKED_SCRIPTS_REL_PATH as $sJSFile) {
|
||||
$this->add_linked_script(utils::GetAbsoluteUrlAppRoot().$sJSFile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty both dict. entries and dict. entries prefixes for the page
|
||||
*
|
||||
@@ -851,6 +890,33 @@ JS;
|
||||
$this->a_linked_stylesheets[$s_linked_stylesheet] = array('link' => $s_linked_stylesheet, 'condition' => $s_condition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize compatibility linked stylesheets for the page
|
||||
*
|
||||
* @throws \ConfigException
|
||||
* @throws \CoreException
|
||||
* @since 3.0.0
|
||||
*/
|
||||
protected function InitializeCompatibilityLinkedStylesheets(): void
|
||||
{
|
||||
$bIncludeDeprecatedFiles = utils::GetConfig()->Get('compatibility.include_deprecated_css_files');
|
||||
if ($bIncludeDeprecatedFiles === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add ancestors files
|
||||
foreach (array_reverse(class_parents(static::class)) as $sParentClass) {
|
||||
foreach ($sParentClass::COMPATIBILITY_LINKED_STYLESHEETS_REL_PATH as $sCSSFile) {
|
||||
$this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().$sCSSFile);
|
||||
}
|
||||
}
|
||||
|
||||
// Add current class files
|
||||
foreach (static::COMPATIBILITY_LINKED_STYLESHEETS_REL_PATH as $sCSSFile) {
|
||||
$this->add_linked_stylesheet(utils::GetAbsoluteUrlAppRoot().$sCSSFile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sSaasRelPath
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user