Fix: Sub level of dir must not always be visible. So I added parameter

"showrelpart". Default value is old behaviour (only filenmae is
visible).
This commit is contained in:
Laurent Destailleur 2013-11-01 17:36:22 +01:00
parent 139ed68d6e
commit f8e3a3e38a

View File

@ -663,12 +663,13 @@ class FormFile
* @param int $permtodelete Permission to delete * @param int $permtodelete Permission to delete
* @param int $useinecm Change output for use in ecm module * @param int $useinecm Change output for use in ecm module
* @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined) * @param string $textifempty Text to show if filearray is empty ('NoFileFound' if not defined)
* @param int $maxlength Maximum length of file name shown * @param int $maxlength Maximum length of file name shown
* @param string $title Title before list * @param string $title Title before list
* @param string $url Full url to use for click links ('' = autodetect) * @param string $url Full url to use for click links ('' = autodetect)
* @param int $showrelpart 0=Show only filename (default), 1=Show first level 1 dir
* @return int <0 if KO, nb of files shown if OK * @return int <0 if KO, nb of files shown if OK
*/ */
function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='') function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permtodelete=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0)
{ {
global $user, $conf, $langs, $hookmanager; global $user, $conf, $langs, $hookmanager;
global $bc; global $bc;
@ -741,8 +742,7 @@ class FormFile
print '&file='.$filepath.'">'; print '&file='.$filepath.'">';
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' '; print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
if ($file['level1name'] <> $object->id) if ($showrelpart == 1) print $file['level1name'].'/';
print $file['level1name'].'/';
print dol_trunc($file['name'],$maxlength,'middle'); print dol_trunc($file['name'],$maxlength,'middle');
print '</a>'; print '</a>';
print "</td>\n"; print "</td>\n";