diff --git a/dev/translation/ignore_translation_keys.lst b/dev/translation/ignore_translation_keys.lst
index dde64cf4b71d6..678efe4c096c1 100644
--- a/dev/translation/ignore_translation_keys.lst
+++ b/dev/translation/ignore_translation_keys.lst
@@ -442,6 +442,7 @@ Free
FreeLegalTextOnReceptions
FrequencyPer_
FromPublicEmail
+FullPathOrig
Function_getNextValue_InModuleNotWorking
Gantt
GeneratePDF
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 50aa901eea393..ce3c6f96804cf 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -3724,7 +3724,7 @@ public function getTooltipContentArray($params)
return ['optimize' => $langs->trans("Proposal")];
}
if ($user->hasRight('propal', 'lire')) {
- $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Proposal").'';
+ $datas['picto'] = img_picto('', $this->picto, '', 0, 0, 0, '', 'paddingrightonly').''.$langs->trans("Proposal").'';
if (isset($this->status)) {
$datas['status'] = ' '.$this->getLibStatut(5);
}
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index 2ee8d0153ed86..3e97bd8037262 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -3788,7 +3788,7 @@ public function getTooltipContentArray($params)
}
if ($user->hasRight('commande', 'lire')) {
- $datas['picto'] = img_picto('', $this->picto).' '.$langs->trans("Order").'';
+ $datas['picto'] = img_picto('', $this->picto, '', 0, 0, 0, '', 'paddingrightonly').''.$langs->trans("Order").'';
if (isset($this->statut)) {
$datas['status'] = ' '.$this->getLibStatut(5);
}
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 845c4eeb85305..5cdc77d733932 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -970,6 +970,9 @@ public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource,
$i = 0;
foreach ($file_list as $file) {
$i++;
+ require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php';
+ $ecmfile = new EcmFiles($this->db);
+ $ecmfile->fetch($file['rowid']);
// Define relative path for download link (depends on module)
$relativepath = (string) $file["name"]; // Cas general
@@ -996,21 +999,22 @@ public function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource,
} else {
$out .= '';
}
- $out .= 'trans("File").': '.$file["name"]);
- $out .= dol_trunc($file["name"], 150);
- $out .= '';
+ // $out .= 'trans("File").': '.$file["name"]);
+ // $out .= dol_trunc($file["name"], 150);
+ // $out .= '';
+ $out .= $ecmfile->getNomUrl(1, $modulepart, 0, 0, ' documentdownload');
$out .= ''."\n";
$out .= $imgpreview;
$out .= '';
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 70fb874e88944..b3484e37d2d92 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -13230,6 +13230,13 @@ function getElementProperties($elementType)
$classname = 'Ccountry';
$table_element = 'c_country';
$subelement = '';
+ } elseif ($elementType == 'ecmfiles') {
+ $module = 'ecm';
+ $classpath = 'ecm/class';
+ $classfile = 'ecmfiles';
+ $classname = 'Ecmfiles';
+ $table_element = 'ecmfiles';
+ $subelement = '';
} elseif ($elementType == 'knowledgerecord') {
$module = '';
$classpath = 'knowledgemanagement/class';
diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php
index 6b24005aea140..27b31001992d0 100644
--- a/htdocs/ecm/class/ecmdirectory.class.php
+++ b/htdocs/ecm/class/ecmdirectory.class.php
@@ -1,8 +1,8 @@
- * Copyright (C) 2008-2012 Regis Houssin
- * Copyright (C) 2024 Frédéric France
- * Copyright (C) 2024 MDW
+/* Copyright (C) 2007-2012 Laurent Destailleur
+ * Copyright (C) 2008-2012 Regis Houssin
+ * Copyright (C) 2024 Frédéric France
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -485,7 +485,7 @@ public function getNomUrl($withpicto = 0, $option = '', $max = 0, $more = '', $n
$result = '';
//$newref=str_replace('_',' ',$this->ref);
$newref = $this->ref;
- $label = $langs->trans("ShowECMSection").': '.$newref;
+ $label = img_picto('', $this->picto, '', 0, 0, 0, '', 'paddingrightonly') . $langs->trans("ShowECMSection") . ': ' . $newref;
$linkclose = '"'.($more ? ' '.$more : '').' title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkstart = '
* Copyright (C) 2018 Francis Appels
* Copyright (C) 2019-2024 Frédéric France
- * Copyright (C) 2024 MDW
+ * Copyright (C) 2024 MDW
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -903,11 +903,39 @@ public function updateAfterRename($olddir, $newdir)
$this->db->query($sql);
}
+ /**
+ * getTooltipContentArray
+ * @param array $params params to construct tooltip data
+ * @since v21
+ * @return array{picto?:string,ref?:string,gen_or_upload?:string}|array{optimize:string}
+ */
+ public function getTooltipContentArray($params)
+ {
+ global $conf, $langs, $user;
+
+ $langs->load('ecm');
+ $datas = [];
+ $nofetch = !empty($params['nofetch']);
+
+ if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
+ return ['optimize' => $langs->trans("ShowFile")];
+ }
+ $datas['picto'] = img_picto('', $this->picto, '', 0, 0, 0, '', 'paddingrightonly') . '' . $langs->trans("ShowFile") . '';
+ if (!empty($this->ref)) {
+ $datas['ref'] = '
'.$langs->trans('Ref').': '.$this->ref;
+ }
+ if (!empty($this->gen_or_uploaded)) {
+ $datas['gen_or_upload'] .= '
'.$langs->trans('GenOrUpload').': '.$this->gen_or_uploaded;
+ }
+
+ return $datas;
+ }
+
/**
* Return a link to the object card (with optionally the picto)
*
* @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
- * @param string $option On what the link point to
+ * @param string $option On what the link point to (propal, etc) module name
* @param int $notooltip 1=Disable tooltip
* @param int $maxlen Max length of visible user name
* @param string $morecss Add more css on link
@@ -915,9 +943,7 @@ public function updateAfterRename($olddir, $newdir)
*/
public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '')
{
- global $db, $conf, $langs;
- global $dolibarr_main_authentication, $dolibarr_main_demo;
- global $menumanager, $hookmanager;
+ global $conf, $hookmanager, $langs;
if (!empty($conf->dol_no_mouse_hover)) {
$notooltip = 1; // Force disable tooltips
@@ -925,35 +951,58 @@ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen
$result = '';
- $label = ''.$langs->trans("File").'';
- $label .= '
';
- $label .= ''.$langs->trans('Ref').': '.$this->ref;
+ $params = [
+ 'id' => $this->id,
+ 'objecttype' => $this->element,
+ 'option' => $option,
+ 'nofetch' => 1,
+ ];
+ $classfortooltip = 'classfortooltip';
+ $dataparams = '';
+ if (getDolGlobalInt('MAIN_ENABLE_AJAX_TOOLTIP')) {
+ $classfortooltip = 'classforajaxtooltip';
+ $dataparams = ' data-params="'.dol_escape_htmltag(json_encode($params)).'"';
+ $label = '';
+ } else {
+ $label = implode($this->getTooltipContentArray($params));
+ }
- $url = DOL_URL_ROOT.'/ecm/file_card.php?id='.$this->id;
+ if ($option) {
+ $url = DOL_URL_ROOT.'/document.php?modulepart='.$option.'&file='.urlencode(preg_replace('/[a-zA-Z]+\//', '', $this->filepath).'/'.$this->filename).'&entity='.$this->entity;
+ } else {
+ $url = DOL_URL_ROOT.'/ecm/file_card.php?id='.$this->id;
+ }
$linkclose = '';
if (empty($notooltip)) {
if (getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
- $label = $langs->trans("ShowProject");
+ $label = $langs->trans("ShowFile");
$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
}
- $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
- $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+ $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
+ $linkclose .= $dataparams.' class="'.$classfortooltip.' '.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
}
$linkstart = '';
$linkend = '';
if ($withpicto) {
- $result .= ($linkstart.img_object(($notooltip ? '' : $label), 'label', ($notooltip ? '' : 'class="classfortooltip"')).$linkend);
+ if (empty($this->filename)) {
+ $result .= ($linkstart.img_object(($notooltip ? '' : $label), 'label', ($notooltip ? '' : 'class="paddingright"')).$linkend);
+ } else {
+ $result .= ($linkstart.img_mime($this->filename, ($notooltip ? '' : $label), ($notooltip ? '' : 'class="paddingright"')).$linkend);
+ }
if ($withpicto != 2) {
$result .= ' ';
}
}
- $result .= $linkstart.$this->ref.$linkend;
+ $result .= $linkstart.$this->filename.$linkend;
global $action;
$hookmanager->initHooks(array($this->element . 'dao'));
@@ -964,6 +1013,7 @@ public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen
} else {
$result .= $hookmanager->resPrint;
}
+
return $result;
}
diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang
index 14b8229687c4b..3e87f385577ad 100644
--- a/htdocs/langs/en_US/ecm.lang
+++ b/htdocs/langs/en_US/ecm.lang
@@ -54,3 +54,6 @@ SucessConvertImgWebp=Images successfully duplicated
SucessConvertChosenImgWebp=Chosen image successfully duplicated
ECMDirName=Dir name
ECMParentDirectory=Parent directory
+ShowFile=Show file
+FullPathOrig=Full path origin
+GenOrUpload=File origin