From dacb7c85aa7654c70f97c9bd4dc80a52913d842a Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sun, 2 May 2021 08:19:09 +0200 Subject: [PATCH] Minor gui fixes Signed-off-by: Janos SUTO --- webui/system/misc.php | 31 ++++++++++++++++++- .../theme/default/templates/search/helper.tpl | 8 ++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/webui/system/misc.php b/webui/system/misc.php index ae356ed2..ca9598e5 100644 --- a/webui/system/misc.php +++ b/webui/system/misc.php @@ -1,5 +1,10 @@ $length ? substr($what, 0, $length) . "..." : $what; + if($length < 1) { return ''; } + + if(strlen($what) <= $length) { return $what; } + + $arr = preg_split("/\s/", $what); + $s = ''; + + $i = 0; + foreach($arr as $a) { + if($i == 0) { + if($length > 0 && strlen($a) > $length) { + return substr($a, 0, $length) . '...'; + } + } + + if(strlen($s) + strlen($a) <= $length) { + $s .= $a . ' '; + } else { + break; + } + + $i++; + } + + return $s . '...'; } diff --git a/webui/view/theme/default/templates/search/helper.tpl b/webui/view/theme/default/templates/search/helper.tpl index f02d19ed..dfeaec96 100644 --- a/webui/view/theme/default/templates/search/helper.tpl +++ b/webui/view/theme/default/templates/search/helper.tpl @@ -43,7 +43,7 @@ - + checked="checked" class="restorebox" /> @@ -67,7 +67,7 @@ - + checked="checked" class="restorebox" onclick="Piler.toggle_bulk_check('2');" /> @@ -106,7 +106,7 @@ - + @@ -135,7 +135,7 @@   get("sphx_query")) { ?> - ', 5);">sphinx + ', 5);">sphinx