NEW Truncate columns names when too long and show full title as popup

This commit is contained in:
Laurent Destailleur 2020-02-24 21:18:49 +01:00
parent 9d9429f66b
commit 32d74adf20
4 changed files with 28 additions and 9 deletions

View File

@ -201,14 +201,14 @@ print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print getTitleFieldOfList('Name', 0, $_SERVER['PHP_SELF'], 'name', '', $param, '', $sortfield, $sortorder, '')."\n";
print '<td>'.$langs->trans("Value").'</td>';
print '<td>'.$langs->trans("Comment").'</td>';
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 '<td class="center">'.$langs->trans("Action").'</td>';
print getTitleFieldOfList("Action", 0, $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'center ');
print "</tr>\n";

View File

@ -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 .= '<a class="reposition" href="'.$file.'?sortfield='.$field.'&sortorder='.$sortordertouseinlink.'&begin='.$begin.$options.'">';
$out .= '<a class="reposition" href="'.$file.'?sortfield='.$field.'&sortorder='.$sortordertouseinlink.'&begin='.$begin.$options.'"';
//$out .= (empty($conf->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));

View File

@ -1863,7 +1863,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="dropdown-toggle login-dropdown-a" data-toggle="dropdown">';
$btnUser .= $userImage;
if (empty($hideloginname)) {
$btnUser .= '<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>';
$btnUser .= '<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone paddingleft">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>';
}
$btnUser .= '
</a>

View File

@ -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],