From ad8904a4fb2711aeff50448ee97b390256c7f2d0 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Jul 2013 15:10:32 +0200 Subject: [PATCH] Can add a picto onto line of files list. --- htdocs/core/class/html.formfile.class.php | 63 +++++++++++------------ htdocs/core/lib/files.lib.php | 2 +- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8f725368f9c..fc87c58cdc4 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -184,8 +184,8 @@ class FormFile * Return a string to show the box with list of available documents for object. * This also set the property $this->numoffiles * - * @param string $modulepart propal, facture, facture_fourn, ... - * @param string $filename Sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete) + * @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule_temp', ...) + * @param string $filename Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if $filedir is already complete) * @param string $filedir Directory to scan * @param string $urlsource Url of origin page (for return) * @param int $genallowed Generation is allowed (1/0 or array list of templates) @@ -200,9 +200,10 @@ class FormFile * @param string $title Title to show on top of form * @param string $buttonlabel Label on submit button * @param string $codelang Default language code to use on lang combo box if multilang is enabled + * @param string $morepicto Add more HTML content into cell with picto * @return string Output string with HTML array of documents (might be empty string) */ - function showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') + function showdocuments($modulepart,$filename,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$maxfilenamelength=28,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='') { global $langs,$conf,$hookmanager; global $bc; @@ -220,7 +221,6 @@ class FormFile $out=''; $var=true; - //$filename = dol_sanitizeFileName($filename); //Must be sanitized before calling show_documents $headershown=0; $showempty=0; $i=0; @@ -231,7 +231,7 @@ class FormFile $out.= "\n".''."\n"; //print 'filedir='.$filedir; - // Affiche en-tete tableau + // Show table if ($genallowed) { $modellist=array(); @@ -390,19 +390,6 @@ class FormFile $buttonlabeltoshow=$buttonlabel; if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate'); - -// Keep this. Used for test with jmobile -/*print ' -
- -
-';*/ - if (empty($noform)) $out.= '
'; $out.= ''; $out.= ''; @@ -448,7 +435,8 @@ class FormFile $out.= ''; // Button - $out.= ''; + $addcolumforpicto=($delallowed || $printer || $morepicto); + $out.= ''; $genbutton = 'hooks['formfile']) { foreach($hookmanager->hooks['formfile'] as $module) @@ -524,22 +511,30 @@ class FormFile $date=(! empty($file['date'])?$file['date']:dol_filemtime($filedir."/".$file["name"])); $out.= ''.dol_print_date($date, 'dayhour').''; - if ($delallowed) + if ($delallowed || $printer || $morepicto) { $out.= ''; - $out.= ''.img_delete().''; - } - // Printer Icon - if ($printer) - { - $out.= ''; - $out.= ' '.img_printer().''; + if ($delallowed) + { + $out.= ''.img_picto($langs->trans("Delete"), 'delete.png').''; + //$out.=''; + } + if ($printer) + { + //$out.= ''; + $out.= ' '.img_picto($langs->trans("Print"),'printer.png').''; + } + if ($morepicto) + { + $out.=$morepicto; + } + $out.=''; } if (is_object($hookmanager)) { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 02cb6e663e2..e76705a1690 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1233,7 +1233,7 @@ function dol_most_recent_file($dir,$regexfilter='',$excludefilter=array('\.meta$ /** * Security check when accessing to a document (used by document.php, viewimage.php and webservices) * - * @param string $modulepart Module of document + * @param string $modulepart Module of document (module, module_user_temp, module_user or module_temp) * @param string $original_file Relative path with filename * @param string $entity Restrict onto entity * @param User $fuser User object (forced)