From bd152ba00e0a26bb9a270e5d7bc924fe42d0aac3 Mon Sep 17 00:00:00 2001 From: "Willy \"Linty" Date: Tue, 5 Dec 2023 17:27:17 +0100 Subject: [PATCH] fixes #2054 avoid exceeding box limits for album directory name --- admin/cat_modify.php | 21 +++++++++++++++++++- admin/themes/default/template/cat_modify.tpl | 12 ++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/admin/cat_modify.php b/admin/cat_modify.php index 7cf9fc2ba..4c88147fd 100644 --- a/admin/cat_modify.php +++ b/admin/cat_modify.php @@ -83,6 +83,22 @@ SELECT galleries_url return $row['galleries_url']; } +function get_min_local_dir($local_dir) +{ + $full_dir = explode('/', $local_dir); + if (count($full_dir) <= 3) + { + return $local_dir; + } + else + { + $start = $full_dir[0] . '/' . $full_dir[1]; + $end = end($full_dir); + $concat = $start . '/…/' . $end; + return $concat; + } +} + // +-----------------------------------------------------------------------+ // | Check Access and exit when user status is not ok | // +-----------------------------------------------------------------------+ @@ -315,11 +331,14 @@ $template->assign(array( if (!$category['is_virtual']) { $category['cat_full_dir'] = get_complete_dir($_GET['cat_id']); + $category_full_dir = preg_replace('/\/$/', '', $category['cat_full_dir']); $template->assign( array( - 'CAT_FULL_DIR' => preg_replace('/\/$/', '', $category['cat_full_dir']) + 'CAT_FULL_DIR' => $category_full_dir ) ); + $template->assign('CAT_DIR_NAME', basename($category_full_dir)); + $template->assign('CAT_MIN_DIR', get_min_local_dir($category_full_dir)); if ($conf['enable_synchronization']) { diff --git a/admin/themes/default/template/cat_modify.tpl b/admin/themes/default/template/cat_modify.tpl index c9280cac2..28fe01f17 100644 --- a/admin/themes/default/template/cat_modify.tpl +++ b/admin/themes/default/template/cat_modify.tpl @@ -104,7 +104,8 @@ str_root = '{'Root'|@translate}'; {if isset($U_SYNC) }
{'Directory'} - {$CAT_FULL_DIR} + {$CAT_DIR_NAME} + {$CAT_MIN_DIR}
{/if} @@ -274,4 +275,13 @@ str_root = '{'Root'|@translate}'; .warnings { display: none; } + +.directory { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} +.cat-modify-infos .cat-modify-info-content.directory::first-letter { + text-transform: none; +} \ No newline at end of file