New: Text files are opend in a new tab.

This commit is contained in:
Laurent Destailleur 2010-11-13 21:47:00 +00:00
parent 10c65eddb7
commit f624d50f5b

View File

@ -410,7 +410,10 @@ class FormFile
// Show file name with link to download
if (!$iconPDF) print '<td nowrap="nowrap">';
print '<a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'">';
print '<a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'"';
$mime=dol_mimetype($relativepath,'',0);
if (preg_match('/text/',$mime)) print ' target="_blank"';
print '>';
if (!$iconPDF)
{
print img_mime($file["name"],$langs->trans("File").': '.$file["name"]).' '.dol_trunc($file["name"],$maxfilenamelength);