fix tooltip

This commit is contained in:
Frédéric FRANCE 2023-02-05 17:04:26 +01:00
parent 8b6bb4161c
commit 6e07cee3fc
3 changed files with 46 additions and 40 deletions

View File

@ -1638,26 +1638,27 @@ class Categorie extends CommonObject
$forced_color = 'categtextblack';
}
}
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam ? '?'.$moreparam : ''));
$classfortooltip = 'classfortooltip';
$dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
];
$link .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"';
$link .= ' class="classforajaxtooltip '.$forced_color.'">';
} else {
$link .= '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip '.$forced_color.'">';
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
$label = $langs->trans('Loading');
}
$link = '<a href="'.DOL_URL_ROOT.'/categories/viewcat.php?id='.$this->id.'&type='.$this->type.$moreparam.'&backtopage='.urlencode($_SERVER['PHP_SELF'].($moreparam ? '?'.$moreparam : ''));
$link .= '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.' '.$forced_color.'">';
$linkend = '</a>';
$picto = 'category';
if ($withpicto) {
$result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
$result .= ($link.img_object($label, $picto, $dataparams.' class="'.$classfortooltip.'"').$linkend);
}
if ($withpicto && $withpicto != 2) {
$result .= ' ';

View File

@ -1514,23 +1514,25 @@ class Contact extends CommonObject
$url .= $moreparam;
$linkclose = "";
$classfortooltip = 'classfortooltip';
$dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
];
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
$label = $langs->trans('Loading');
}
if (empty($notooltip)) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("ShowContact");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
'option' => $option,
];
$linkclose .= ' data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"';
$linkclose .= ' class="classforajaxtooltip'.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
}
$linkstart = '<a href="'.$url.'"';
@ -1538,7 +1540,7 @@ class Contact extends CommonObject
$linkend = '</a>';
if ($option == 'xxx') {
$linkstart = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkstart = '<a href="'.DOL_URL_ROOT.'/contact/card.php?id='.$this->id.$moreparam.'"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.'">';
$linkend = '</a>';
}
@ -1547,7 +1549,7 @@ class Contact extends CommonObject
if ($withpicto < 0) {
$result .= '<!-- picto photo user --><span class="nopadding userimg'.($morecss ? ' '.$morecss : '').'">'.Form::showphoto('contact', $this, 0, 0, 0, 'userphoto'.($withpicto == -3 ? 'small' : ''), 'mini', 0, 1).'</span>';
} else {
$result .= img_object(($notooltip ? '' : $label), ( $this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
$result .= img_object(($notooltip ? '' : $label), ( $this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
}
if ($withpicto != 2 && $withpicto != -2) {

View File

@ -2072,31 +2072,32 @@ class Contrat extends CommonObject
}
$linkclose = '';
$classfortooltip = 'classfortooltip';
$dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
];
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
$label = $langs->trans('Loading');
}
if (empty($notooltip) && $user->rights->contrat->lire) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("ShowContract");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->id,
'objecttype' => $this->element,
];
$linkclose .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"';
$linkclose .= ' class="classforajaxtooltip"';
} else {
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= ' class="classfortooltip"';
}
$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose .= $dataparams.' class="'.$classfortooltip.'"';
}
$linkstart = '<a href="'.$url.'"';
$linkstart .= $linkclose.'>';
$linkend = '</a>';
$result .= $linkstart;
if ($withpicto) {
$result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
$result .= img_object(($notooltip ? '' : $label), $this->picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : $dataparams.' class="'.(($withpicto != 2) ? 'paddingright ' : '').$classfortooltip.'"'), 0, 0, $notooltip ? 0 : 1);
}
if ($withpicto != 2) {
$result .= ($this->ref ? $this->ref : $this->id);
@ -3152,17 +3153,19 @@ class ContratLigne extends CommonObjectLine
if (empty($label)) {
$label = $this->description;
}
$link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat;
$classfortooltip = 'classfortooltip';
$dataparams = '';
if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
$params = [
'id' => $this->fk_contrat,
'objecttype' => $this->element,
];
$link .= '" data-params='.json_encode($params).' title="' . $langs->trans('Loading') . '"';
$link .= ' class="classforajaxtooltip"';
} else {
$link = '" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$classfortooltip = 'classforajaxtooltip';
$dataparams = ' data-params='.json_encode($params);
$label = $langs->trans('Loading');
}
$link = '<a href="'.DOL_URL_ROOT.'/contrat/card.php?id='.$this->fk_contrat;
$link = '"'.$dataparams.' title="'.dol_escape_htmltag($label, 1).'" class="'.$classfortooltip.'">';
$linkend = '</a>';
$picto = 'service';
@ -3171,7 +3174,7 @@ class ContratLigne extends CommonObjectLine
}
if ($withpicto) {
$result .= ($link.img_object($label, $picto, 'class="classfortooltip"').$linkend);
$result .= ($link.img_object($label, $picto, $dataparams.' class="'.$classfortooltip.'"').$linkend);
}
if ($withpicto && $withpicto != 2) {
$result .= ' ';