From 761ece3125000fec1827c02d3b6b296bceecdc63 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Mon, 3 Apr 2017 16:59:22 +0200
Subject: [PATCH] Remove $maxfilenamelength replace with auto overflow.

---
 htdocs/core/class/html.formfile.class.php | 24 +++++++++++------------
 htdocs/theme/eldy/style.css.php           |  2 +-
 htdocs/theme/md/style.css.php             |  2 +-
 3 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 1dfb5a08855..258c2c9c962 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -229,7 +229,7 @@ class FormFile
      *      @param      integer				$allowgenifempty	Show warning if no model activated
      *      @param      integer				$forcenomultilang	Do not show language option (even if MAIN_MULTILANGS defined)
      *      @param      int					$iconPDF            Show only PDF icon with link (1/0)
-     * 		@param		int					$maxfilenamelength	Max length for filename shown
+     * 		@param		int					$notused	        Not used
      * 		@param		integer				$noform				Do not output html form tags
      * 		@param		string				$param				More param on http links
      * 		@param		string				$title				Title to show on top of form
@@ -238,10 +238,10 @@ class FormFile
      * 		@return		int										<0 if KO, number of shown files if OK
      *      @deprecated                                         Use print xxx->showdocuments() instead.
      */
-    function show_documents($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='')
+    function show_documents($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='')
     {
         $this->numoffiles=0;
-        print $this->showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$maxfilenamelength,$noform,$param,$title,$buttonlabel,$codelang);
+        print $this->showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed,$modelselected,$allowgenifempty,$forcenomultilang,$iconPDF,$notused,$noform,$param,$title,$buttonlabel,$codelang);
         return $this->numoffiles;
     }
 
@@ -259,7 +259,7 @@ class FormFile
      *      @param      integer				$allowgenifempty	Allow generation even if list of template ($genallowed) is empty (show however a warning)
      *      @param      integer				$forcenomultilang	Do not show language option (even if MAIN_MULTILANGS defined)
      *      @param      int					$iconPDF            Deprecated, see getDocumentsLink
-     * 		@param		int					$maxfilenamelength	Max length for filename shown
+     * 		@param		int					$notused	        Not used
      * 		@param		integer				$noform				Do not output html form tags
      * 		@param		string				$param				More param on http links
      * 		@param		string				$title				Title to show on top of form
@@ -269,7 +269,7 @@ class FormFile
      *      @param      Object              $object             Object when method is called from an object card.
      * 		@return		string              					Output string with HTML array of documents (might be empty string)
      */
-    function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='',$object=null)
+    function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='',$object=null)
     {
 		// Deprecation warning
 		if (0 !== $iconPDF) {
@@ -297,7 +297,6 @@ class FormFile
         $hookmanager->initHooks(array('formfile'));
         $forname='builddoc';
         $out='';
-        $var=true;
 
         $headershown=0;
         $showempty=0;
@@ -691,27 +690,26 @@ class FormFile
 			{
 				foreach($file_list as $file)
 				{
-					$var=!$var;
-
 					// Define relative path for download link (depends on module)
 					$relativepath=$file["name"];										// Cas general
                     if ($modulesubdir) $relativepath=$modulesubdir."/".$file["name"];	// Cas propal, facture...
 					if ($modulepart == 'export') $relativepath = $file["name"];			// Other case
 
-					$out.= "<tr ".$bc[$var].">";
+					$out.= '<tr class="oddeven">';
 
 					$documenturl = DOL_URL_ROOT.'/document.php';
 					if (isset($conf->global->DOL_URL_ROOT_DOCUMENT_PHP)) $documenturl=$conf->global->DOL_URL_ROOT_DOCUMENT_PHP;
 					
 					// Show file name with link to download
-					$out.= '<td class="nowrap">';
-					$out.= '<a data-ajax="false" href="'.$documenturl.'?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).($param?'&'.$param:'').'"';
+					$out.= '<td class="tdoverflowmax300">';
+                    $tmp = $this->showPreview($file,$modulepart,$relativepath);
+                    $out.= ($tmp?$tmp.' ':'');
+					$out.= '<a href="'.$documenturl.'?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).($param?'&'.$param:'').'"';
 					$mime=dol_mimetype($relativepath,'',0);
 					if (preg_match('/text/',$mime)) $out.= ' target="_blank"';
 					$out.= ' target="_blank">';
-					$out.= img_mime($file["name"],$langs->trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength);
+					$out.= img_mime($file["name"],$langs->trans("File").': '.$file["name"]).' '.$file["name"];
 					$out.= '</a>'."\n";
-                    $out.= $this->showPreview($file,$modulepart,$relativepath);
 					$out.= '</td>';
 
 					// Show file size
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index e270cc3b030..dac7cf43f5e 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -1068,7 +1068,7 @@ div.nopadding {
 .pictowarning, .pictopreview {
     padding-<?php echo $left; ?>: 3px;
 }
-.pictoedit, .pictowarning, .pictopreview, .pictodelete {
+.pictoedit, .pictowarning, .pictodelete {
     vertical-align: text-bottom;
 }
 .colorthumb {
diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php
index 6885bfad144..f4b38d08012 100644
--- a/htdocs/theme/md/style.css.php
+++ b/htdocs/theme/md/style.css.php
@@ -1112,7 +1112,7 @@ table.noborder tr.liste_titre td {
 .pictowarning, .pictopreview {
     padding-<?php echo $left; ?>: 3px;
 }
-.pictoedit, .pictowarning, .pictopreview, .pictodelete {
+.pictoedit, .pictowarning, .pictodelete {
     vertical-align: text-bottom;
 }
 .colorthumb {
-- 
GitLab