diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 54918171a23..ccd1f8bee5e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -22,7 +22,7 @@ * \file htdocs/core/class/html.formfile.class.php * \ingroup core * \brief File of class to offer components to list and upload files - * \version $Id: html.formfile.class.php,v 1.44 2011/07/06 13:15:24 eldy Exp $ + * \version $Id: html.formfile.class.php,v 1.45 2011/07/06 17:44:56 eldy Exp $ */ @@ -186,9 +186,9 @@ class FormFile global $langs,$bc,$conf; $out=''; - $var=true; + // Clean paramaters if ($iconPDF == 1) { $genallowed = ''; @@ -196,13 +196,15 @@ class FormFile $modelselected = ''; $forcenomultilang=0; } - //$filename = dol_sanitizeFileName($filename); //Must be sanitized before calling show_documents $headershown=0; $showempty=0; $i=0; - $out.= "\n".''."\n"; + $titletoshow=$langs->trans("Documents"); + if (! empty($title)) $titletoshow=$title; + + $out.= "\n".''."\n"; //print 'filedir='.$filedir; // Affiche en-tete tableau @@ -388,7 +390,7 @@ class FormFile $out.= ''; $out.= ''; - $out.= '
'.$langs->trans("Documents").'
'; + $out.= '
'.$titletoshow.'
'; $out.= ''; $out.= ''; @@ -465,73 +467,73 @@ class FormFile } // Get list of files - $png = ''; - $filter = ''; - if ($iconPDF==1) + if ($filedir) { - $png = '\.png$'; - $filter = $filename.'.pdf'; + $png = ''; + $filter = ''; + if ($iconPDF==1) + { + $png = '\.png$'; + $filter = $filename.'.pdf'; + } + $file_list=dol_dir_list($filedir,'files',0,$filter,'\.meta$'.($png?'|'.$png:''),'date',SORT_DESC); + + // Affiche en-tete tableau si non deja affiche + if (sizeof($file_list) && ! $headershown && !$iconPDF) + { + $headershown=1; + $out.= '
'.$titletoshow.'
'; + $out.= '
'; + } + + // Loop on each file found + foreach($file_list as $file) + { + $var=!$var; + + // Define relative path for download link (depends on module) + $relativepath=$file["name"]; // Cas general + if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture... + // Autre cas + if ($modulepart == 'donation') { $relativepath = get_exdir($filename,2).$file["name"]; } + if ($modulepart == 'export') { $relativepath = $file["name"]; } + + if (!$iconPDF) $out.= ""; + + // Show file name with link to download + if (!$iconPDF) $out.= ''; + // Affiche taille fichier + if (!$iconPDF) $out.= ''; + // Affiche date fichier + if (!$iconPDF) $out.= ''; + + if ($delallowed) + { + $out.= ''; + } + + if (!$iconPDF) $out.= ''; + + $this->numoffiles++; + } } - $file_list=dol_dir_list($filedir,'files',0,$filter,'\.meta$'.($png?'|'.$png:''),'date',SORT_DESC); - - // Affiche en-tete tableau si non deja affiche - if (sizeof($file_list) && ! $headershown && !$iconPDF) - { - $headershown=1; - $titletoshow=$langs->trans("Documents"); - if (! empty($title)) $titletoshow=$title; - $out.= '
'.$titletoshow.'
'; - $out.= '
'; + $out.= 'trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength); + } + else + { + $out.= img_pdf($file["name"],2); + } + $out.= ''; + if (!$iconPDF) $out.= ''.dol_print_size(dol_filesize($filedir."/".$file["name"])).''.dol_print_date(dol_filemtime($filedir."/".$file["name"]),'dayhour').''.img_delete().'
'; - } - - // Loop on each file found - foreach($file_list as $file) - { - $var=!$var; - - // Define relative path for download link (depends on module) - $relativepath=$file["name"]; // Cas general - if ($filename) $relativepath=$filename."/".$file["name"]; // Cas propal, facture... - // Autre cas - if ($modulepart == 'donation') { $relativepath = get_exdir($filename,2).$file["name"]; } - if ($modulepart == 'export') { $relativepath = $file["name"]; } - - if (!$iconPDF) $out.= ""; - - // Show file name with link to download - if (!$iconPDF) $out.= ''; - // Affiche taille fichier - if (!$iconPDF) $out.= ''; - // Affiche date fichier - if (!$iconPDF) $out.= ''; - - if ($delallowed) - { - $out.= ''; - } - - if (!$iconPDF) $out.= ''; - - $this->numoffiles++; - } - if ($headershown) {
'; - $out.= 'trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength); - } - else - { - $out.= img_pdf($file["name"],2); - } - $out.= ''; - if (!$iconPDF) $out.= ''.dol_print_size(dol_filesize($filedir."/".$file["name"])).''.dol_print_date(dol_filemtime($filedir."/".$file["name"]),'dayhour').''.img_delete().'