Skip to content

Commit

Permalink
NEW Truncate columns names when too long and show full title as popup
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Feb 24, 2020
1 parent 9d9429f commit 32d74ad
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
10 changes: 5 additions & 5 deletions htdocs/admin/const.php
Expand Up @@ -201,14 +201,14 @@
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";


Expand Down
19 changes: 16 additions & 3 deletions htdocs/core/lib/functions.lib.php
Expand Up @@ -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
{
Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion htdocs/main.inc.php
Expand Up @@ -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>
Expand Down
6 changes: 6 additions & 0 deletions htdocs/theme/eldy/global.inc.php
Expand Up @@ -124,6 +124,12 @@
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],
Expand Down

0 comments on commit 32d74ad

Please sign in to comment.