From 74f036c7686f7a3d54cddbb4760af5f93b538f29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 24 Jun 2006 13:38:00 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Les=20liste=20des=20documents=20sont=20t?= =?UTF-8?q?ri=E9es=20par=20date=20d=E9croissante?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/html.form.class.php | 83 ++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 44 deletions(-) diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 47cea45c5fe..89bb2bac258 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -2515,50 +2515,45 @@ class Form print ''; } - // Affiche lignes - if (is_dir($filedir)) - { - $handle=opendir($filedir); - while (($file = readdir($handle))!==false) - { - // Si fichier non lisible ou mauvaise extension, on passe au suivant - if (! is_readable($filedir."/".$file) || - eregi('\.meta$',$file) || - eregi('\.$',$file) - ) continue; - - if (! $headershown) - { - // Affiche en-tete tableau - $headershown=1; - - print_titre($langs->trans("Documents")); - print ''; - } - + // Recupe liste des fichiers + $file_list=dolibarr_dir_list($filedir,'files',0,'','\.meta$','date',SORT_DESC); + + // Affiche en-tete tableau si non deja affiché + if (sizeof($file_list) && ! $headershown) + { + $headershown=1; + + print_titre($langs->trans("Documents")); + print '
'; + } + + // Boucle sur chaque ligne trouvée + foreach($file_list as $i => $file) + { + // Défini chemin relatif par rapport au module pour lien download - $relativepath=$filename."/".$file; - if ($modulepart == 'don') { $relativepath = get_exdir($filename).$file; } - if ($modulepart == 'export') { $relativepath = $file; } + $relativepath=$filename."/".$file["name"]; + if ($modulepart == 'don') { $relativepath = get_exdir($filename).$file["name"]; } + if ($modulepart == 'export') { $relativepath = $file["name"]; } // Défini le type MIME du document - if (eregi('\.([^\.]+)$',$file,$reg)) $extension=$reg[1]; + if (eregi('\.([^\.]+)$',$file["name"],$reg)) $extension=$reg[1]; $mimetype=strtoupper($extension); if ($extension == 'pdf') $mimetype='PDF'; if ($extension == 'html') $mimetype='HTML'; - if (eregi('\-detail\.pdf',$file)) $mimetype='PDF Détaillé'; + if (eregi('\-detail\.pdf',$file["name"])) $mimetype='PDF Détaillé'; print ""; // Affiche colonne type MIME print ''; // Affiche nom fichier avec lien download - print ''; // Affiche taille fichier - print ''; + print ''; // Affiche date fichier - print ''; + print ''; if ($delallowed) { @@ -2568,21 +2563,21 @@ class Form print ''; $i++; - } - } - - if ($headershown) - { - // Affiche pied du tableau - print "
'.$mimetype.''.$file.''; + print ''.$file["name"].''; print ''.filesize($filedir."/".$file). ' bytes'.filesize($filedir."/".$file["name"]). ' bytes'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).''.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file["name"])).'
\n"; - if ($genallowed) - { - print ''; - } - } - - return $i; -} + } + + + if ($headershown) + { + // Affiche pied du tableau + print "\n"; + if ($genallowed) + { + print ''; + } + } + + return $i; + } }