From 32d74adf205d5126c48c23e7a85ae856114f9ae1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 24 Feb 2020 21:18:49 +0100 Subject: [PATCH] NEW Truncate columns names when too long and show full title as popup --- htdocs/admin/const.php | 10 +++++----- htdocs/core/lib/functions.lib.php | 19 ++++++++++++++++--- htdocs/main.inc.php | 2 +- htdocs/theme/eldy/global.inc.php | 6 ++++++ 4 files changed, 28 insertions(+), 9 deletions(-) diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index baeac243ce0..c4fa1e9240f 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -201,14 +201,14 @@ print '
'; print ''; print ''; print getTitleFieldOfList('Name', 0, $_SERVER['PHP_SELF'], 'name', '', $param, '', $sortfield, $sortorder, '')."\n"; -print ''; -print ''; -print getTitleFieldOfList('DateModificationShort', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center')."\n"; +print getTitleFieldOfList("Value", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); +print getTitleFieldOfList("Comment", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); +print getTitleFieldOfList('DateModificationShort', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; if (! empty($conf->multicompany->enabled) && !$user->entity) { - print getTitleFieldOfList('Entity', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center')."\n"; + print getTitleFieldOfList('Entity', 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; } -print ''; +print getTitleFieldOfList("Action", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center '); print "\n"; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 1375df9d0b6..0c93f8d01d1 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4086,11 +4086,22 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin $tmpfield = explode(',', $field); $field1 = trim($tmpfield[0]); // If $field is 'd.datep,d.id', it becomes 'd.datep' + if (empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE)) { + $prefix = 'wrapcolumntitle '.$prefix; + } //var_dump('field='.$field.' field1='.$field1.' sortfield='.$sortfield.' sortfield1='.$sortfield1); // If field is used as sort criteria we use a specific css class liste_titre_sel // Example if (sortfield,field)=("nom","xxx.nom") or (sortfield,field)=("nom","nom") - if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./", "", $field1))) $out .= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '.$moreattrib.'>'; - else $out .= '<'.$tag.' class="'.$prefix.'liste_titre" '.$moreattrib.'>'; + if ($field1 && ($sortfield1 == $field1 || $sortfield1 == preg_replace("/^[^\.]+\./", "", $field1))) { + $out .= '<'.$tag.' class="'.$prefix.'liste_titre_sel" '.$moreattrib; + $out .= (empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : ''); + $out .= '>'; + } + else { + $out .= '<'.$tag.' class="'.$prefix.'liste_titre" '.$moreattrib; + $out .= (empty($conf->global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : ''); + $out .= '>'; + } if (empty($thead) && $field && empty($disablesortlink)) // If this is a sort field { @@ -4123,7 +4134,9 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin } } $sortordertouseinlink = preg_replace('/,$/', '', $sortordertouseinlink); - $out .= ''; + $out .= 'global->MAIN_DISABLE_WRAPPING_ON_COLUMN_TITLE) ? ' title="'.dol_escape_htmltag($langs->trans($name)).'"' : ''); + $out .= '>'; } if ($tooltip) $out .= $form->textwithpicto($langs->trans($name), $langs->trans($tooltip)); diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 8765b73a53a..ef09674f8aa 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1863,7 +1863,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '') diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index f6eb3dd324a..4d5f3991a3f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -124,6 +124,12 @@ select.vmenusearchselectcombo { background-color: unset; } +th.wrapcolumntitle.liste_titre.right, td.wrapcolumntitle.liste_titre.right { + overflow: hidden; + white-space: nowrap; + max-width: 120px; + text-overflow: ellipsis; +} .liste_titre input[name=month_date_when], .liste_titre input[name=monthvalid], .liste_titre input[name=search_ordermonth], .liste_titre input[name=search_deliverymonth], .liste_titre input[name=search_smonth], .liste_titre input[name=search_month], .liste_titre input[name=search_emonth], .liste_titre input[name=smonth], .liste_titre input[name=month], .liste_titre select[name=month], .liste_titre input[name=month_lim], .liste_titre input[name=month_start], .liste_titre input[name=month_end], .liste_titre input[name=month_create],
'.$langs->trans("Value").''.$langs->trans("Comment").''.$langs->trans("Action").'