From b3c7a9ddd640d124894ec4e5caca0cd602340880 Mon Sep 17 00:00:00 2001 From: Stefan Darius <94108614+dariusstefan@users.noreply.github.com> Date: Tue, 13 Aug 2024 16:51:08 +0300 Subject: [PATCH] alias_mgm: auto-complete field in select form, when only one or zero values are available --- web/common/forms.php | 56 +++++++++++++------ .../alias_management/lib/functions.inc.php | 16 ++++++ .../user_management/lib/functions.inc.php | 16 ++++++ 3 files changed, 72 insertions(+), 16 deletions(-) diff --git a/web/common/forms.php b/web/common/forms.php index e15267696..e10e51edc 100755 --- a/web/common/forms.php +++ b/web/common/forms.php @@ -459,25 +459,49 @@ function form_generate_select($title,$tip,$id,$mlen,$val,$vals,$texts=null,$is_o if (!is_null($tip)) print("
? ".$tip." -
"); + "); print(" - -
- - -
-
+ + + + + +
"); + + $options_count = count($vals); + if ($options_count == 1 && !$is_optional) { + print(" "); + } else { + if ($options_count == 0) { + $text = $is_optional ? "Empty ..." : "No options available"; + + if (!$is_optional) { + print(" "); + } else { + print(" "); + } + } else { + print(" "); + } + } + + print(" +
+
"); } diff --git a/web/tools/users/alias_management/lib/functions.inc.php b/web/tools/users/alias_management/lib/functions.inc.php index d77cd6143..992a8749a 100755 --- a/web/tools/users/alias_management/lib/functions.inc.php +++ b/web/tools/users/alias_management/lib/functions.inc.php @@ -49,6 +49,14 @@ function print_domains($type,$value,$has_any) $temp =''; $end_index = sizeof($options); + if ($end_index == 0) + return; + + if ($end_index == 1) { + echo(''); + return; + } + echo(''); + return; + } ?> '); + return; + } + echo('