From c6762dbb03b2ae2e56f22862c16408009e6be0b9 Mon Sep 17 00:00:00 2001 From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch> Date: Tue, 13 Dec 2022 16:46:36 +0100 Subject: [PATCH] uupdate colors; add badge --- public_html/pages/component.php | 64 ++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/public_html/pages/component.php b/public_html/pages/component.php index f849389..71ecbfa 100644 --- a/public_html/pages/component.php +++ b/public_html/pages/component.php @@ -8,21 +8,37 @@ $sComponent=(isset($_GET['id']) ? preg_replace('/[^a-z]/', '', $_GET['id']) : '' $aPresets=[ - 'yesno'=>[ - ''=>'no value', - '0'=>'no', - '1'=>'yes', + 'colors'=>[ + // https://adminlte.io/themes/v3/pages/UI/general.html + ''=>'no value', + 'indigo'=>'indigo', + 'lightblue'=>'', + 'navy'=>'', + 'purple'=>'', + 'fuchsia'=>'', + 'pink'=>'', + 'maroon'=>'', + 'orange'=>'', + 'lime'=>'', + 'teal'=>'', + 'olive'=>'', + + 'black'=>'black', + 'dark'=>'dark gray', + 'gray'=>'gray', + 'light'=>'light gray', ], + 'type'=>[ ''=>'no value', 'danger'=>'red', - 'dark'=>'dark gray', - 'gray'=>'gray', 'info'=>'aqua', 'primary'=>'blue', 'secondary'=>'gray', 'success'=>'green', 'warning'=>'yellow', + 'dark'=>'dark gray', + 'gray'=>'gray', ], 'shadow'=>[ ''=>'no value', @@ -30,7 +46,13 @@ $aPresets=[ 'small'=>'small', 'regular'=>'regular', 'large'=>'large' - ] + ], + // for keys: dismissable + 'yesno'=>[ + ''=>'no value', + '0'=>'no', + '1'=>'yes', + ], ]; // ---------------------------------------------------------------------- @@ -45,10 +67,25 @@ $aComponents=[ 'method'=>'getAlert', 'params'=>[ - 'type' =>['select'=>$aPresets['type'], 'default'=>'warning'], - 'dismissible' =>['select'=>$aPresets['yesno'], 'default'=>''], - 'title'=>['default'=>' I need your attention'], - 'text'=>['default'=>'Please check it. Maybe there is something wrong here.'], + 'type' => ['select'=>$aPresets['type'], 'default'=>'warning'], + 'dismissible' => ['select'=>$aPresets['yesno'], 'default'=>''], + 'title' => ['default'=>'I need your attention'], + 'text' => ['default'=>'Please check it. Maybe there is something wrong here.'], + ] + ], + // ------------------------------------------------------------ + 'badge'=>[ + 'label'=>'Badge', + 'description'=>'Tiny additional info; mostly as counter', + 'method'=>'getBadge', + + 'params'=>[ + 'type' => ['select'=>$aPresets['type'], 'default'=>'danger'], + 'bgcolor' => ['select'=>$aPresets['colors'], 'default'=>''], + 'class' => ['default'=>''], + 'id' => ['default'=>''], + 'title' => ['default'=>'Errors: 5'], + 'text' => ['default'=>'5'], ] ], // ------------------------------------------------------------ @@ -100,8 +137,9 @@ if(!isset($aComponents[$sComponent])){ ? $aParam['default'] : '' )); - $aWidgetOptions[$sOptionkey]=$sValue; - + if($sValue!==''){ + $aWidgetOptions[$sOptionkey]=$sValue; + } if (isset($aParam['select'])){ foreach($aParam['select'] as $sSelectItem=>$sLabel){ // $sInput.='<option value="'.$sSelectItem.'">'.($sSelectItem ? $sSelectItem : '-- none --').'</option>'; -- GitLab