From 8223485aee3f9c02a685453c5519205ea6c62a8b Mon Sep 17 00:00:00 2001 From: Rooty Date: Mon, 30 Oct 2023 23:48:08 +0100 Subject: [PATCH] Done #104. Autoload a coordination object css file when exists --- lib/package/package.template.php | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/lib/package/package.template.php b/lib/package/package.template.php index 323861f..c50660a 100755 --- a/lib/package/package.template.php +++ b/lib/package/package.template.php @@ -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; + } } }