From 88b5594af31f54bed54d0c89e61930f78c48404e Mon Sep 17 00:00:00 2001 From: kamel Date: Wed, 31 Aug 2022 09:59:24 +0200 Subject: [PATCH] FIX: Preview button position on documents list (case when the file is too long) --- htdocs/core/class/html.formfile.class.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 349b05416aa..6fe10788c54 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -850,6 +850,7 @@ class FormFile // Show file name with link to download $out .= ''; + $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param, 'paddingright')."\n"; $out .= 'trans("File").': '.$file["name"]); $out .= dol_trunc($file["name"], 150); - $out .= ''."\n"; - $out .= $this->showPreview($file, $modulepart, $relativepath, 0, $param); + $out .= ''; $out .= ''; // Show file size @@ -1307,6 +1307,11 @@ class FormFile // File name print ''; + // Preview link + if (!$editline) { + print $this->showPreview($file, $modulepart, $filepath, 0, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity), 'paddingright') . "\n"; + } + // Show file name with link to download //print "XX".$file['name']; //$file['name'] must be utf8 print '\n"; @@ -2097,9 +2098,10 @@ class FormFile * @param string $relativepath Relative path of docs * @param integer $ruleforpicto Rule for picto: 0=Use the generic preview picto, 1=Use the picto of mime type of file) * @param string $param More param on http links + * @param string $moreclass Add more class to class style * @return string $out Output string with HTML */ - public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '') + public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '', $moreclass = '') { global $langs, $conf; @@ -2107,7 +2109,7 @@ class FormFile if ($conf->browser->layout != 'phone' && !empty($conf->use_javascript_ajax)) { $urladvancedpreview = getAdvancedPreviewUrl($modulepart, $relativepath, 1, $param); // Return if a file is qualified for preview. if (count($urladvancedpreview)) { - $out .= ''; + $out .= ''; //$out.= ''; if (empty($ruleforpicto)) { //$out.= img_picto($langs->trans('Preview').' '.$file['name'], 'detail');