Fix: Link was to short

This commit is contained in:
Laurent Destailleur
2008-08-03 11:34:47 +00:00
parent 3153f3b717
commit 327c74d35d
3 changed files with 15 additions and 8 deletions

View File

@@ -50,6 +50,10 @@ if ($file && ! $what)
/*
* View
*/
llxHeader(); llxHeader();
$html=new Form($db); $html=new Form($db);
@@ -179,6 +183,7 @@ if ($what == 'mysql')
if ($compression == 'bz') $handle = bzopen($outputfile, 'r'); if ($compression == 'bz') $handle = bzopen($outputfile, 'r');
if ($hanlde) if ($hanlde)
{ {
print 'eeee';
$errormsg = fgets($handle,10); $errormsg = fgets($handle,10);
if ($compression == 'none') fclose($handle); if ($compression == 'none') fclose($handle);
if ($compression == 'gz') gzclose($handle); if ($compression == 'gz') gzclose($handle);
@@ -218,7 +223,7 @@ if ($what)
} }
} }
$result=$formfile->show_documents('systemtools','',DOL_DATA_ROOT.'/admin/temp',$_SERVER['PHP_SELF'],0,1); $result=$formfile->show_documents('systemtools','',DOL_DATA_ROOT.'/admin/temp',$_SERVER['PHP_SELF'],0,1,'',array(),0,0,48);
if ($result == 0) if ($result == 0)
{ {

View File

@@ -119,15 +119,16 @@ class FormFile
* \param modelliste Tableau des modeles possibles * \param modelliste Tableau des modeles possibles
* \param forcenomultilang N'affiche pas option langue meme si MAIN_MULTILANGS d<>fini * \param forcenomultilang N'affiche pas option langue meme si MAIN_MULTILANGS d<>fini
* \param iconPDF N'affiche que l'icone PDF avec le lien (1/0) * \param iconPDF N'affiche que l'icone PDF avec le lien (1/0)
* \param maxfilenamelength Max length for filename shown
* \remarks Le fichier de facture d<>taill<6C>e est de la forme * \remarks Le fichier de facture d<>taill<6C>e est de la forme
* REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse * REFFACTURE-XXXXXX-detail.pdf ou XXXXX est une forme diverse
* \return int <0 si ko, nbre de fichiers affich<63>s si ok * \return int <0 si ko, nbre de fichiers affich<63>s si ok
*/ */
function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0) function show_documents($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$modelliste=array(),$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28)
{ {
// filedir = conf->...dir_ouput."/".get_exdir(id) // filedir = conf->...dir_ouput."/".get_exdir(id)
include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php'); include_once(DOL_DOCUMENT_ROOT.'/lib/files.lib.php');
global $langs,$bc,$conf; global $langs,$bc,$conf;
$var=true; $var=true;
@@ -319,7 +320,7 @@ class FormFile
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).'">';
if (!$iconPDF) if (!$iconPDF)
{ {
print img_mime($file["name"]).' '.dolibarr_trunc($file["name"],28); print img_mime($file["name"],$langs->trans("File").': '.$file["name"]).' '.dolibarr_trunc($file["name"],$maxfilenamelength);
} }
else else
{ {
@@ -334,7 +335,7 @@ class FormFile
if ($delallowed) if ($delallowed)
{ {
print '<td><a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'&amp;urlsource='.urlencode($urlsource).'">'.img_delete().'</a></td>'; print '<td align="right"><a href="'.DOL_URL_ROOT.'/document.php?action=remove_file&amp;modulepart='.$modulepart.'&amp;file='.urlencode($relativepath).'&amp;urlsource='.urlencode($urlsource).'">'.img_delete().'</a></td>';
} }
if (!$iconPDF) print '</tr>'; if (!$iconPDF) print '</tr>';

View File

@@ -728,7 +728,7 @@ function dol_phone_link($phone,$option=0)
} }
/** /**
\brief Tronque une chaine a une taille donn<6E>e en ajoutant les points de suspension si cela d<>passe \brief Truncate a string to a particular length adding '...' if string larger than length
\param string String to truncate \param string String to truncate
\param size Max string size. 0 for no limit. \param size Max string size. 0 for no limit.
\param trunc Where to trunc: right, left, middle \param trunc Where to trunc: right, left, middle
@@ -1205,9 +1205,10 @@ function img_allow($allow)
/** /**
* \brief Show mime picto * \brief Show mime picto
* \param file Filename * \param file Filename
* \param alt Alternate text
* \return string Return img tag * \return string Return img tag
*/ */
function img_mime($file) function img_mime($file,$alt='')
{ {
$mime='other'; $mime='other';
if (eregi('\.pdf',$file)) { $mime='pdf'; } if (eregi('\.pdf',$file)) { $mime='pdf'; }
@@ -1220,7 +1221,7 @@ function img_mime($file)
if (eregi('\.(mp3|ogg|au)',$file)) $mime='audio'; if (eregi('\.(mp3|ogg|au)',$file)) $mime='audio';
if (eregi('\.(avi|mvw|divx|xvid)',$file)) $mime='video'; if (eregi('\.(avi|mvw|divx|xvid)',$file)) $mime='video';
if (eregi('\.(zip|rar|gz|tgz|z|cab)',$file)) $mime='archive'; if (eregi('\.(zip|rar|gz|tgz|z|cab)',$file)) $mime='archive';
$alt='Mime type: '.$mime; if (empty($alt)) $alt='Mime type: '.$mime;
$mime.='.png'; $mime.='.png';
return '<img src="'.DOL_URL_ROOT.'/theme/common/mime/'.$mime.'" border="0" alt="'.$alt.'" title="'.$alt.'">'; return '<img src="'.DOL_URL_ROOT.'/theme/common/mime/'.$mime.'" border="0" alt="'.$alt.'" title="'.$alt.'">';