From 571b5d2f8526e9c45e99dba8af0e818d1d6b0ab5 Mon Sep 17 00:00:00 2001 From: Luca Date: Mon, 12 Feb 2024 18:13:39 +0100 Subject: [PATCH] Aggiunte skin light per tema --- ajax_dataload.php | 6 +++++- lib/util.php | 12 +++++++++++- modules/utenti/add.php | 2 +- modules/utenti/edit.php | 13 ++++++++++++- src/HTMLBuilder/Manager/FileManager.php | 2 +- 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/ajax_dataload.php b/ajax_dataload.php index 0fd9df8b7..af1e598ab 100755 --- a/ajax_dataload.php +++ b/ajax_dataload.php @@ -113,7 +113,11 @@ if (!empty($query)) { $column = []; if (!empty($r['_bg_'])) { - $column['data-background'] = $r['_bg_']; + if (preg_match('/-light$/', $r['_bg_'])) { + $column['data-background'] = substr($r['_bg_'], 0, -6); // Remove the "-light" suffix from the word + }else{ + $column['data-background'] = $r['_bg_']; + } } // Allineamento diff --git a/lib/util.php b/lib/util.php index ef21d9142..1b3336505 100755 --- a/lib/util.php +++ b/lib/util.php @@ -461,7 +461,17 @@ if (!function_exists('color_inverse')) { return '#000'; } } else { - return '#000'; + switch ($start_colour) { + case 'black': + return 'white'; + case 'blue': + return 'white'; + case 'purple': + return 'white'; + // Aggiungere altri casi per colori specifici + default: + return '#000'; // Se il colore non è specificato, restituisce il colore originale + } } } } diff --git a/modules/utenti/add.php b/modules/utenti/add.php index 5e161160f..ed2332461 100755 --- a/modules/utenti/add.php +++ b/modules/utenti/add.php @@ -28,7 +28,7 @@ include_once __DIR__.'/../../core.php'; {[ "type": "text", "label": "", "name": "nome", "required": 1, "validation": "gruppo", "help": "" ]}
- {[ "type": "select", "label": "", "name": "theme", "values": "list=\"\": \"\",\"black\": \"\",\"red\": \"\",\"blue\": \"\",\"green\": \"\",\"yellow\": \"\",\"purple\": \"\"", "value": "$theme$" ]} + {[ "type": "select", "label": "", "name": "theme", "values": "list=\"\": \"\",\"black-light\": \"\",\"black\": \"\",\"red-light\": \"\",\"red\": \"\",\"blue-light\": \"\",\"blue\": \"\",\"green-light\": \"\",\"green\": \"\",\"yellow-light\": \"\",\"yellow\": \"\",\"purple-light\": \"\",\"purple\": \"\"", "value": "$theme$" ]}
{["type":"select", "label":"", "name":"id_module_start", "ajax-source":"moduli_gruppo", "placeholder":"" ]} diff --git a/modules/utenti/edit.php b/modules/utenti/edit.php index 4c325854a..013f5cc99 100755 --- a/modules/utenti/edit.php +++ b/modules/utenti/edit.php @@ -35,7 +35,7 @@ echo ' {["type":"select", "label":"'.tr('Modulo iniziale').'", "name":"id_module_start", "ajax-source":"moduli_gruppo", "select-options": '.json_encode(['idgruppo' => $record['id']]).', "placeholder":"'.tr('Modulo iniziale').'", "value":"'.$record['id_module_start'].'" ]}
- {["type":"select", "label":"'.tr('Tema').'", "name":"theme", "values":"list=\"\": \"'.tr('Predefinito').'\",\"black\": \"'.tr('Nero').'\",\"red\": \"'.tr('Rosso').'\",\"blue\": \"'.tr('Blu').'\",\"green\": \"'.tr('Verde').'\",\"yellow\": \"'.tr('Giallo').'\",\"purple\": \"'.tr('Viola').'\" ", "value":"'.$record['theme'].'" ]} + {["type":"select", "label":"'.tr('Tema').'", "name":"theme", "values":"list=\"\": \"'.tr('Predefinito').'\",\"black-light\": \"'.tr('Bianco').'\",\"black\": \"'.tr('Nero').'\",\"red-light\": \"'.tr('Rosso chiaro').'\",\"red\": \"'.tr('Rosso').'\",\"blue-light\": \"'.tr('Blu chiaro').'\",\"blue\": \"'.tr('Blu').'\",\"green-light\": \"'.tr('Verde chiaro').'\",\"green\": \"'.tr('Verde').'\",\"yellow-light\": \"'.tr('Giallo chiaro').'\",\"yellow\": \"'.tr('Giallo').'\",\"purple-light\": \"'.tr('Viola chiaro').'\",\"purple\": \"'.tr('Viola').'\" ", "value":"'.$record['theme'].'" ]}

'; @@ -279,12 +279,23 @@ function update_permissions(id, value, color){ ); } +var mySkins=["skin-blue","skin-black","skin-red","skin-yellow","skin-purple","skin-green","skin-blue-light","skin-black-light","skin-red-light","skin-yellow-light","skin-purple-light","skin-green-light"]; + +function changeSkin(cls){ + $.each(mySkins,function(i){ + $("body").removeClass(mySkins[i]) + }); + $("body").addClass("skin-"+cls); + return false; +} + $("#id_module_start").change(function(){ update_id_module_start($(this).val()); }); $("#theme").change(function(){ update_theme($(this).val()); + changeSkin($(this).val()); }); function update_id_module_start(value){ diff --git a/src/HTMLBuilder/Manager/FileManager.php b/src/HTMLBuilder/Manager/FileManager.php index f807b4731..eeb8956e0 100755 --- a/src/HTMLBuilder/Manager/FileManager.php +++ b/src/HTMLBuilder/Manager/FileManager.php @@ -151,7 +151,7 @@ class FileManager implements ManagerInterface '.$file->name.' - ('.$file->extension.')'.((!empty($file->size)) ? ' ('.FileSystem::formatBytes($file->size).')' : '').' '.(((setting('Logo stampe') == $file->filename) || (setting('Filigrana stampe') == $file->filename)) ? '' : '').''.' + ('.$file->extension.')'.((!empty($file->size)) ? ' ('.FileSystem::formatBytes($file->size).')' : '').' '.(((setting('Logo stampe') == $file->filename) || (setting('Filigrana stampe') == $file->filename)) ? '✔️' : '').''.' '.timestampFormat($file['created_at']).'