From a78774d2958ea905ebfa0a584dc636d211318945 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch> Date: Fri, 20 Sep 2024 09:38:26 +0200 Subject: [PATCH] add custom css if it exists --- inc_functions.php | 36 ++++++++++++++++++++++++------------ index.php | 9 ++++++--- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/inc_functions.php b/inc_functions.php index 0c261af..36deb0e 100644 --- a/inc_functions.php +++ b/inc_functions.php @@ -35,18 +35,6 @@ $L = new lang($aConfig['lang'] ?? 'en'); // functions // ---------------------------------------------------------------------- -/** - * Show a info or error message - * - * @param string $sLevel level: one of "info", "error" - * @param string $sMessage Message to show - * @return void - */ -function showMessage(string $sLevel, string $sMessage) -{ - echo "<div class=\"msg $sLevel\">$sMessage</div>"; -} - /** * Get a list of static links for browsers without javascript @@ -64,4 +52,28 @@ function getStaticlinks($aIdplist){ } +function getCustomCss() +{ + foreach([ + 'screen_custom.css' + ] as $sCustomCss ){ + if(file_exists($sCustomCss)){ + echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"$sCustomCss\" media=\"screen\" />"; + } + } +} + +/** + * Show a info or error message + * + * @param string $sLevel level: one of "info", "error" + * @param string $sMessage Message to show + * @return void + */ +function showMessage(string $sLevel, string $sMessage) +{ + echo "<div class=\"msg $sLevel\">$sMessage</div>"; +} + + // ---------------------------------------------------------------------- diff --git a/index.php b/index.php index b7c0799..3817c7d 100644 --- a/index.php +++ b/index.php @@ -23,7 +23,7 @@ 'source' => 'https://git-repo.iml.unibe.ch/iml-open-source/login-aai', 'docs' => 'https://os-docs.iml.unibe.ch/login-aai/', 'license' => 'GNU GPL 3.0', - 'version' => '0.4', + 'version' => '0.5', ]; ?><!DOCTYPE html> @@ -36,7 +36,10 @@ <title><?php echo $aConfig['title'] ?? 'AAI Login'; ?></title> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" /> - <link rel="stylesheet" type="text/css" href="login_aai.css" media="screen" /> + <link rel="stylesheet" type="text/css" href="screen.css" media="screen" /> + <link rel="stylesheet" type="text/css" href="<?php echo "mode/".$aConfig['mode']."/screen.css"; ?>" media="screen" /> + + <?php getCustomCss(); ?> </head> @@ -75,7 +78,7 @@ echo $aConfig['text-before'] ?? '' ; // --- show Organizations / IDPs with defined view - include "inc_mode_".$aConfig['mode'].".php"; + include "mode/".$aConfig['mode']."/index.php"; echo '</div>'; -- GitLab