Done #104. Autoload a coordination object css file when exists

This commit is contained in:
Rooty 2023-10-30 23:48:08 +01:00
parent e4b844b1a4
commit 8223485aee

View File

@ -306,8 +306,13 @@ function mxPageHeaders($title, $keywords, $description, $classification, $author
function mxCallCss($arrayCallCss)
{
if ( $GLOBALS["SYSTEM_TEMPLATE"]->isMxBloc("CSSLOAD") && is_array($arrayCallCss) && count($arrayCallCss)>0 )
// if ( is_array($arrayCallCss) && count($arrayCallCss)>0 )
{
// Auto loading of custom ccs file located in coordination object
if(is_file($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className)."/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className).".css"))
{
$arrayCallCss[] = $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className)."/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className).".css";
}
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("CSSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/css.mxt");
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("CSSLOAD", "appe");
@ -315,7 +320,6 @@ function mxCallCss($arrayCallCss)
{
if( is_string( $arrayCallCss[$j]) )
{
// var_dump($arrayCallCss[$j]);
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocCSS".".hrefcss", $arrayCallCss[$j]);
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocCSS".".blocIntegrity", "delete");
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocCSS".".blocOrigin", "delete");
@ -331,9 +335,23 @@ function mxCallCss($arrayCallCss)
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
return true;
} else {
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("CSSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/css.mxt");
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("CSSLOAD", "delete");
return false;
// Auto loading of custom ccs file located in coordination object
if(is_file($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className)."/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className).".css"))
{
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("CSSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/css.mxt");
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("CSSLOAD", "appe");
$GLOBALS['SYSTEM_TEMPLATE']->MxText("blocCSS".".hrefcss", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_coordination/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className)."/".strtolower($GLOBALS["SYSTEM_CONTROL"]->className).".css");
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocCSS".".blocIntegrity", "delete");
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("blocCSS".".blocOrigin", "delete");
$GLOBALS["SYSTEM_TEMPLATE"]->WithMxPath("");
return true;
} else {
$GLOBALS["SYSTEM_TEMPLATE"]->MxBloc("CSSLOAD", "modify", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."headers/css.mxt");
$GLOBALS['SYSTEM_TEMPLATE']->MxBloc("CSSLOAD", "delete");
return false;
}
}
}