From 74c39a10a29c73b18b6ab759ad9aeb990454c07e Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Sun, 25 Mar 2012 22:47:37 +0200
Subject: [PATCH] Work on ajax ecm module

---
 htdocs/core/ajax/ajaxdirpreview.php       | 462 ++++++++--------------
 htdocs/core/ajax/ajaxdirtree.php          |  38 +-
 htdocs/core/class/html.formfile.class.php |  11 +-
 htdocs/core/lib/functions.lib.php         |   2 +-
 htdocs/ecm/index.php                      | 202 +++-------
 htdocs/theme/auguria/style.css.php        | 105 +++++
 htdocs/theme/bureau2crea/style.css.php    | 105 +++++
 htdocs/theme/cameleo/style.css.php        | 103 +++++
 htdocs/theme/eldy/style.css.php           |  93 +----
 9 files changed, 568 insertions(+), 553 deletions(-)

diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index a7ae78882d0..d2130845bf7 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -22,10 +22,10 @@
  */
 
 /**
- *	\file       htdocs/filemanager/ajaxshowpreview.php
- *  \brief      Service to return a HTML preview of a file
+ *	\file       htdocs/core/ajax/ajaxdirpreview.php
+ *  \brief      Service to return a HTML preview of a directory
  *  			Call of this service is made with URL:
- * 				ajaxpreview.php?action=preview&modulepart=repfichierconcerne&file=pathrelatifdufichier
+ * 				ajaxdirpreview.php?mode=nojs&action=preview&module=ecm&section=0&file=xxx
  */
 
 if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); // Disables token renewal
@@ -33,11 +33,45 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
 if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
 if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
 
-// C'est un wrapper, donc header vierge
-function llxHeader() { }
-
-require("../../main.inc.php");
-require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
+if (! isset($mode) || $mode != 'noajax')
+{
+    require_once("../../main.inc.php");
+    require_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
+    require_once(DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php');
+    require_once(DOL_DOCUMENT_ROOT."/ecm/class/ecmdirectory.class.php");
+
+    $action=GETPOST("action");
+    $file=urldecode(GETPOST('file'));
+    $section=GETPOST("section");
+    $module=GETPOST("module");
+    $urlsource=GETPOST("urlsource");
+
+    $upload_dir = dirname(str_replace("../","/", $conf->ecm->dir_output.'/'.$file));
+
+    $ecmdir = new EcmDirectory($db);
+    $result=$ecmdir->fetch($section);
+    if (! $result > 0)
+    {
+        dol_print_error($db,$ecmdir->error);
+        exit;
+    }
+}
+else
+{
+    $ecmdir = new EcmDirectory($db);
+    $relativepath='';
+    if ($section > 0)
+    {
+        $result=$ecmdir->fetch($section);
+        if (! $result > 0)
+        {
+            dol_print_error($db,$ecmdir->error);
+            exit;
+        }
+    }
+    $relativepath=$ecmdir->getRelativePath();
+    $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
+}
 
 // Load traductions files
 $langs->load("ecm");
@@ -47,371 +81,189 @@ $langs->load("other");
 // Security check
 if ($user->societe_id > 0) $socid = $user->societe_id;
 
-// Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP).
-$action=GETPOST("action");
-$file=urldecode(GETPOST('file'));
-$section=GETPOST("section");
-$module=GETPOST("module");
-$urlsource=GETPOST("urlsource");
-if (! $section)
-{
-    dol_print_error('',"ErrorSectionParamNotDefined");
-    exit;
-}
-
-// Suppression de la chaine de caractere ../ dans $original_file
-$original_file = str_replace("../","/", $file);
-$original_file_osencoded=dol_osencode($original_file);  // New file name encoded in OS encoding charset
+//print 'xxx'.$upload_dir;
 
 // Security:
 // On interdit les remontees de repertoire ainsi que les pipe dans
 // les noms de fichiers.
-if (preg_match('/\.\./',$original_file) || preg_match('/[<>|]/',$original_file))
+if (preg_match('/\.\./',$upload_dir) || preg_match('/[<>|]/',$upload_dir))
 {
-    dol_syslog("Refused to deliver file ".$original_file);
+    dol_syslog("Refused to deliver file ".$upload_dir);
     // Do no show plain path in shown error message
-    dol_print_error(0,$langs->trans("ErrorFileNameInvalid",$_GET["file"]));
+    dol_print_error(0,$langs->trans("ErrorFileNameInvalid",$upload_dir));
     exit;
 }
 
-// Load ecm object
-/*$ecmdir = new EcmDirectory($db);
- $result=$ecmdir->fetch(GETPOST("section"));
-if (! $result > 0)
-{
-dol_print_error($db,$ecmdir->error);
-exit;
-}
-$relativepath=$ecmdir->getRelativePath();
-$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
-*/
-
 
 
 /*
  * Action
  */
 
-if ($action == 'remove_file')   // Remove a file
+/*
+ if ($action == 'remove_file')   // Remove a file
 {
-    clearstatcache();
+clearstatcache();
 
-    dol_syslog(__FILE__." remove $original_file $urlsource", LOG_DEBUG);
+dol_syslog(__FILE__." remove $original_file $urlsource", LOG_DEBUG);
 
-    // This test should be useless. We keep it to find bug more easily
-    if (! file_exists($original_file_osencoded))
-    {
-        dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$_GET["file"]));
-        exit;
-    }
+// This test should be useless. We keep it to find bug more easily
+if (! file_exists($original_file_osencoded))
+{
+dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$_GET["file"]));
+exit;
+}
 
-    dol_delete_file($original_file);
+dol_delete_file($original_file);
 
-    dol_syslog(__FILE__." back to ".urldecode($urlsource), LOG_DEBUG);
+dol_syslog(__FILE__." back to ".urldecode($urlsource), LOG_DEBUG);
 
-    header("Location: ".urldecode($urlsource));
+header("Location: ".urldecode($urlsource));
 
-    return;
+return;
 }
-
+*/
 
 
 /*
  * View
  */
 
-// Ajout directives pour resoudre bug IE
-header('Cache-Control: Public, must-revalidate');
-header('Pragma: public');
-
-$filename = basename($original_file_osencoded);
-$sizeoffile = filesize($original_file_osencoded);
-
-if (dol_is_dir($original_file))
-{
-    $type='directory';
-}
-else
+if (! isset($mode) || $mode != 'noajax')
 {
-    // Define mime type
-    $type = 'application/octet-stream';
-    if (GETPOST("type") != 'auto') $type=$_GET["type"];
-    else $type=dol_mimetype($original_file,'text/plain');
-    //print 'X'.$type.'-'.$original_file;exit;
+    // Ajout directives pour resoudre bug IE
+    header('Cache-Control: Public, must-revalidate');
+    header('Pragma: public');
 }
 
-clearstatcache();
-
-// Output file on browser
-dol_syslog("document.php download $original_file $filename content-type=$type");
+$type='directory';
 
 // This test if file exists should be useless. We keep it to find bug more easily
-if (! file_exists($original_file_osencoded))
+if (! dol_is_dir($upload_dir))
 {
-    dol_print_error(0,$langs->trans("ErrorFileDoesNotExists",$original_file));
+    $langs->load("install");
+    dol_print_error(0,$langs->trans("ErrorDirDoesNotExists",$upload_dir));
     exit;
 }
 
 print '<!-- TYPE='.$type.' -->'."\n";
-print '<!-- SIZE='.$sizeoffile.' -->'."\n";
 print '<!-- Ajax page called with url '.$_SERVER["PHP_SELF"].'?'.$_SERVER["QUERY_STRING"].' -->'."\n";
 
-// Les drois sont ok et fichier trouve, et fichier texte, on l'envoie
-print '<b><font class="liste_titre">'.$langs->trans("Information").'</font></b><br>';
-print '<hr>';
 
 // Dir
 if ($type == 'directory')
 {
-    print '<table class="nobordernopadding">';
-    print '<tr><td>'.$langs->trans("Directory").':</td><td>&nbsp; <b><span class="fmvalue">'.$original_file.'</span></b></td></tr>';
-
-    //print $langs->trans("FullPath").': '.$original_file_osencoded.'<br>';
-    //print $langs->trans("Mime-type").': '.$type.'<br>';
-
-    $info=stat($original_file_osencoded);
-    //print '<br>'."\n";
-    //print $langs->trans("Owner").": ".$info['udi']."<br>\n";
-    //print $langs->trans("Group").": ".$info['gdi']."<br>\n";
-    //print $langs->trans("Size").": ".dol_print_size($info['size'])."<br>\n";
-    print '<tr><td>'.$langs->trans("DateLastAccess").':</td><td>&nbsp; <span class="fmvalue">'.dol_print_date($info['atime'],'%Y-%m-%d %H:%M:%S')."</span></td></tr>\n";
-    print '<tr><td>'.$langs->trans("DateLastChange").':</td><td>&nbsp; <span class="fmvalue">'.dol_print_date($info['mtime'],'%Y-%m-%d %H:%M:%S')."</span></td></tr>\n";
-    //print $langs->trans("Ctime").": ".$info['ctime']."<br>\n";
-    print '</table>'."\n";
-
-    print '<br><br>';
-    print '<b>'.$langs->trans("Content")."</b><br>\n";
-    print '<hr><br>';
-
-    print '<div class="filedirelem"><ul class="filedirelem">'."\n";
-
-    // Return content of dir
-    $dircontent=dol_dir_list($original_file,'all',0,'','','name',SORT_ASC,0);
-    foreach($dircontent as $key => $val)
+    $formfile=new FormFile($db);
+
+    $param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
+    $maxlengthname=40;
+
+    // Right area
+    if ($module == 'company')  // Auto area for suppliers invoices
     {
-        if (dol_is_dir($val['name'])) $mimeimg='other.png';
-        else $mimeimg=dol_mimetype($val['name'],'application/octet-stream',2);
-
-        print '<li class="filedirelem">';
-        print '<br><br>';
-        print '<img src="'.DOL_URL_ROOT.'/theme/common/mime/'.$mimeimg.'"><br>';
-        print dol_nl2br(dol_trunc($val['name'],24,'wrap'),1);
-        print '</li>'."\n";
-    }
+        $upload_dir = $conf->societe->dir_output;
+        $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
 
-    print '</ul></div>'."\n";
-}
-else {
-    print '<table class="nobordernopadding" width="100%">';
-    print '<tr><td>'.$langs->trans("File").':</td><td>&nbsp; <b><span class="fmvalue">'.$original_file.'</span></b></td></tr>';
-    print '<tr><td>'.$langs->trans("Mime-type").':</td><td>&nbsp; <span class="fmvalue">'.$type.'</span></td>';
-    print '<td align="right"><a href="'.dol_buildpath('/filemanager/document.php',1).'?modulepart=filemanager&id='.$id.'&rootpath='.$rootpath.'&file='.urlencode($original_file).'">'.$langs->trans("Download").'</a></td>';
-    print '</tr>';
-
-    $info=stat($original_file_osencoded);
-    //print '<br>'."\n";
-    //print $langs->trans("Owner").": ".$info['udi']."<br>\n";
-    //print $langs->trans("Group").": ".$info['gdi']."<br>\n";
-    print '<tr><td>'.$langs->trans("Size").':</td><td>&nbsp; <span class="fmvalue">'.dol_print_size($info['size'])."</span></td></tr>\n";
-    print '<tr><td>'.$langs->trans("DateLastAccess").':</td><td>&nbsp; <span class="fmvalue">'.dol_print_date($info['atime'],'%Y-%m-%d %H:%M:%S')."</span></td></tr>\n";
-    print '<tr><td>'.$langs->trans("DateLastChange").':</td><td>&nbsp; <span class="fmvalue">'.dol_print_date($info['mtime'],'%Y-%m-%d %H:%M:%S')."</span></td></tr>\n";
-    //print $langs->trans("Ctime").": ".$info['ctime']."<br>\n";
-    $sizearray=array();
-    if (preg_match('/image/i',$type))
+        $param.='&module='.$module;
+        $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
+
+        $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
+    }
+    else if ($module == 'invoice')  // Auto area for suppliers invoices
     {
-        require_once(DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php');
-        $sizearray=dol_getImageSize($original_file_osencoded);
-        print '<tr><td>'.$langs->trans("Width").':</td><td>&nbsp; <span class="fmvalue">'.$sizearray['width'].'px</span></td></tr>';
-        print '<tr><td>'.$langs->trans("Height").':</td><td>&nbsp; <span class="fmvalue">'.$sizearray['height'].'px</span></td></tr>';
+        $upload_dir = $conf->facture->dir_output;
+        $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+
+        $param.='&module='.$module;
+        $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
+
+        $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
     }
-    print '</table>'."\n";
+    else if ($module == 'invoice_supplier')  // Auto area for suppliers invoices
+    {
+        $relativepath='facture';
+        $upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
+        $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
 
-    // Flush content before preview generation
-    flush();    // This send all data to browser. Browser however may wait to have message complete or aborted before showing it.
+        $param.='&module='.$module;
+        $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
 
+        $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
+    }
+    else if ($module == 'propal')  // Auto area for customers orders
+    {
+        $upload_dir = $conf->propal->dir_output;
+        $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
 
-    // Preview
-    $preview=0;
-    if (preg_match('/text/i',$type))
+        $param.='&module='.$module;
+        $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
+
+        $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
+    }
+    else if ($module == 'order')  // Auto area for customers orders
     {
-        $minmem=64;        // Minimum of memory required to use Geshi (color syntax on text files)
-        $maxsize=65536;      // Max size of data to read for text preview
+        $upload_dir = $conf->commande->dir_output;
+        $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
 
-        // Define memmax (memory_limit in bytes)
-        $memmaxorig=@ini_get("memory_limit");
-        $memmax=@ini_get("memory_limit");
-        if ($memmaxorig != '')
-        {
-            preg_match('/([0-9]+)([a-zA-Z]*)/i',$memmax,$reg);
-            if ($reg[2])
-            {
-                if (strtoupper($reg[2]) == 'M') $memmax=$reg[1]*1024*1024;
-                if (strtoupper($reg[2]) == 'K') $memmax=$reg[1]*1024;
-            }
-        }
-        //print "memmax php=".$memmax;
+        $param.='&module='.$module;
+        $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
 
-        $out='';
-        $srclang=dol_mimetype($original_file,'text/plain',3);
+        $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
+    }
+    else if ($module == 'order_supplier')  // Auto area for suppliers orders
+    {
+        $relativepath='commande';
+        $upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
+        $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
 
-        if (preg_match('/html/i',$type))    // If HTML file
-        {
-            print '<br><br>';
-            print '<b>'.$langs->trans("Preview")."</b><br>\n";
-            print '<hr>';
+        $param.='&module='.$module;
+        $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
 
-            readfile($original_file_osencoded);
-            //$out=file_get_contents($original_file_osencoded);
-            //print $out;
-        }
-        else                                // If not a HTML file
-        {
-            $warn='';
-
-            // Check if we have enough memory for Geshi
-            if ($memmax < $minmem*1024*1024)
-            {
-                $warn=img_warning().' '.$langs->trans("NotEnoughMemoryForSyntaxColor");
-                $warn.=' (Have '.$memmax.' - Need '.$minmem.')';
-                $srclang='';    // We disable geshi
-            }
-
-            if (empty($conf->global->FILEMANAGER_DISABLE_COLORSYNTAXING))
-            {
-                $warn=' ('.$langs->trans("ColoringDisabled").')';
-                $srclang='';    // We disable geshi
-            }
-
-            // Try to detect srclang using first line
-            if ($type=='text/plain' && empty($srclang))    // Try to enhance MIME detection with first line content
-            {
-                $firstline=file_get_contents($original_file_osencoded,false,null,0,32);
-                $texts = preg_split("/((\r(?!\n))|((?<!\r)\n)|(\r\n))/", strtolower($firstline));
-                if (preg_match('/^#!.*\/bin\/(.*)$/',$texts[0],$reg))
-                {
-                    $converttogeshicode=array('ksh'=>'bash', 'sh'=>'bash', 'bash'=>'bash');
-                    $srclang=$converttogeshicode[$reg[1]]?$converttogeshicode[$reg[1]]:$reg[1];
-                    //print "ee".$srclang;
-                }
-            }
-            if ($srclang=='php') $srclang='php-brief';
-            //if ($srclang=='perl') $srclang='';              // Perl seems to be bugged
-
-            if (! empty($srclang))
-            {
-                print '<br><br>';
-                print '<b>'.$langs->trans("Preview")."</b> (".$srclang.")<br>\n";
-                print '<hr>';
-
-                // Translate with Geshi
-                include_once('includes/geshi/geshi.php');
-
-                $out=file_get_contents($original_file_osencoded,false,null,0,$maxsize);
-                if (! utf8_check($out)) { $isoutf='iso'; $out=utf8_encode($out); }
-
-                $geshi = new GeSHi($out, $srclang);
-                $geshi->enable_strict_mode(true);
-                $res='';
-                $res=$geshi->parse_code();
-
-                //print "zzzzzzzz";
-                print $res;
-            }
-            else
-            {
-                print '<br><br>';
-                print '<b>'.$langs->trans("Preview")."</b>";
-                if ($warn) print ' '.$warn;
-                print "<br>\n";
-                print '<hr>';
-
-                $maxlines=25;
-                $i=0;$more=0;
-                $handle = @fopen($original_file_osencoded, "r");
-                if ($handle)
-                {
-                    while (!feof($handle) && $i < $maxlines)
-                    {
-                        $buffer = fgets($handle, $maxsize);
-                        if (utf8_check($buffer)) $out.=$buffer."<br>\n";
-                        else $out.=utf8_encode($buffer)."<br>\n";
-                        $i++;
-                    }
-                    if (!feof($handle)) $more=1;
-                    fclose($handle);
-                }
-                else
-                {
-                    print '<div class="error">'.$langs->trans("ErrorFailedToOpenFile",$original_file).'</div>';
-                }
-
-                print $out;
-
-                print '<br>';
-
-                if ($more)
-                {
-                    print '<b>...'.$langs->trans("More").'...</b><br>'."\n";
-                }
-            }
-        }
-        $preview=1;
+        $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
     }
-    // Preview if image
-    if (preg_match('/image/i',$type))
+    else if ($module == 'contract')  // Auto area for suppliers invoices
     {
-        print '<br><br>';
-        print '<b>'.$langs->trans("Preview")."</b><br>\n";
-        print '<hr><br>';
+        $upload_dir = $conf->contrat->dir_output;
+        $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
 
+        $param.='&module='.$module;
+        $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
 
-        print '<center><img';
-        if (! empty($sizearray['width']) && $sizearray['width'] > 500) print ' width="500"';
-        print ' src="'.dol_buildpath('/filemanager/viewimage.php',1).'?modulepart=filemanager&file='.urlencode($original_file).'"></center>';
-        $preview=1;
+        $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
     }
-    // Preview if video
-    if (preg_match('/video/i',$type))
+    else if ($module == 'tax')  // Auto area for suppliers invoices
     {
-        $typecodec='';
-        if (preg_match('/ogg/i',$type))     $typecodec=' type=\'video/ogg; codecs="theora, vorbis"\'';  // This works with HTML5 video
-        //if (preg_match('/msvideo/i',$type)) $typecodec=' type=\'video/x-msvideo;\'';   // AVI
-        //if (preg_match('/webm/i',$type))    $typecodec=' type=\'video/webm; codecs="vp8, vorbis"\'';
-        //if (preg_match('/mp4/i',$type))     $typecodec=' type=\'video/mp4; codecs="avc1.42E01E, mp4a.40.2"\'';
+        $upload_dir = $conf->tax->dir_output;
+        $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
 
-        if ($typecodec)
-        {
-            print '<br><br>';
-            print '<b>'.$langs->trans("Preview")."</b><br>\n";
-            print '<hr><br>';
-
-            print '<center>';
-            print '<video id="movie" style="border: 1px solid #BBB;" width="320" height="240"';
-            print ' preload';
-            //print ' preload="none"';
-            print ' controls';
-            print '>';
-            print '<source src="'.dol_buildpath('/filemanager/viewimage.php',1).'?modulepart=filemanager&file='.urlencode($original_file).'&type='.urlencode($type).'"';
-            print $typecodec;
-            print ' />';
-            print '</video>';
-            print '</center>';
-            /*<video width="320" height="240"';
-            print ' src="'.dol_buildpath('/filemanager/viewimage.php',1).'?modulepart=filemanager&file='.urlencode($original_file).'"';
-            print '></center>';*/
-            $preview=1;
-        }
+        $param.='&module='.$module;
+        $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
+
+        $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
     }
-    // No preview
-    if (empty($preview))
+    else    // Manual area
     {
-        print '<br><br>';
-        print '<b>'.$langs->trans("Preview")."</b><br>\n";
-        print '<hr>';
 
-        print $langs->trans("PreviewNotAvailableForThisType");
+        $relativepath=$ecmdir->getRelativePath();
+        $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
+        $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','\.meta$','^temp$','^CVS$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
+
+        $param.='&section='.$section;
+        $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
+
+        $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
     }
+
+}
+
+if ((! isset($mode) || $mode != 'noajax') && ! empty($conf->global->MAIN_ECM_TRY_JS))
+{
+    // Enable jquery handlers on new generated HTML objects
+    print "\n".'<script type="text/javascript">'."\n";
+    print 'jQuery(".deletefilelink").click(function(e) { jQuery("#dialog-confirm-deletefile").dialog("open"); return false; });'."\n";
+    print '</script>'."\n";
+
+    if (is_object($db)) $db->close();
 }
 
-if (is_object($db)) $db->close();
 ?>
diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php
index f3b07de5a3c..e3f0f17850c 100644
--- a/htdocs/core/ajax/ajaxdirtree.php
+++ b/htdocs/core/ajax/ajaxdirtree.php
@@ -33,9 +33,6 @@ if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
 if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
 if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
 
-// C'est un wrapper, donc header vierge
-function llxHeader() { }
-
 $res=@include("../../main.inc.php");
 include_once(DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php');
 include_once(DOL_DOCUMENT_ROOT.'/core/lib/treeview.lib.php');
@@ -107,7 +104,7 @@ if( file_exists($fullpathselecteddir) )
     		echo "<ul class=\"ecmjqft\" style=\"display: none;\">\n";
 
     		// All dirs
-    		foreach( $files as $file )    // $file can be '.', '..', or 'My dir'
+    		foreach( $files as $file )    // $file can be '.', '..', or 'My dir' or 'My file'
     		{
     	        $nbofsubdir=0;
     	        $nboffilesinsubdir=0;
@@ -129,16 +126,16 @@ if( file_exists($fullpathselecteddir) )
 		        }
 
 		        //if (file_exists($fullpathselecteddir . $file) && $file != '.' && $file != '..' && is_dir($fullpathselecteddir . $file))
-    		    if ($file != '.' && $file != '..' && ($val['id'] >= 0 || dol_is_dir($fullpathselecteddir . $file)))
+    		    if ($file != '.' && $file != '..' && ((! empty($val['fullrelativename']) && $val['id'] >= 0) || dol_is_dir($fullpathselecteddir . $file)))
     		    {
     				print '<li class="directory collapsed">';
 
-    				print "<a class=\"fmdirlia jqft\" href=\"#\" rel=\"" . dol_escape_htmltag($file . '/') . "\"";
+    				print "<a class=\"fmdirlia jqft ecmjqft\" href=\"#\" rel=\"" . dol_escape_htmltag($val['fullrelativename'].'/') . "\" id=\"fmdirlia_id_".$val['id']."\"";
     				print " onClick=\"loadandshowpreview('".dol_escape_js($val['fullrelativename'])."',".$val['id'].")\">";
     				print dol_escape_htmltag($file);
     				print "</a>";
 
-    				print '<div style="float: right;">';
+    				print '<div class="ecmjqft">';
 
     				print '<table class="nobordernopadding"><tr>';
 
@@ -148,7 +145,7 @@ if( file_exists($fullpathselecteddir) )
 
     				// Nb of docs
     				print '<td align="right">';
-    				print $val['cachenbofdoc'];
+    				print isset($val['cachenbofdoc'])?$val['cachenbofdoc']:'&nbsp;';
     				print '</td>';
     				print '<td align="left">';
     				if ($nbofsubdir && $nboffilesinsubdir) print '<font color="#AAAAAA">+'.$nboffilesinsubdir.'</font> ';
@@ -173,7 +170,7 @@ if( file_exists($fullpathselecteddir) )
     				$htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.$val['cachenbofdoc'].'<br>';
     				if ($nbofsubdir) $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
     				else $htmltooltip.='<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.$nbofsubdir.'<br>';
-    				print $form->textwithpicto('',$htmltooltip,1,0);
+    				print $form->textwithpicto('',$htmltooltip,1,"info");
     				print "</td>";
 
     				print "</tr></table>\n";
@@ -184,25 +181,14 @@ if( file_exists($fullpathselecteddir) )
     			}
     		}
 
-    		// All files
-    		/*
-    		foreach( $files as $file )
-    		{
-    			if( file_exists($fullpathselecteddir . $file) && $file != '.' && $file != '..' && !is_dir($fullpathselecteddir . $file) )
-    			{
-    				$ext = preg_replace('/^.*\./', '', $file);
-    				print "<li class=\"file ext_".$ext."\">";
-    				print "<a class=\"fmfilelia jqft\" href=\"#\" rel=\"" . dol_escape_htmltag($selecteddir . $file) . "\">" . dol_escape_htmltag($file) . "</a>";
-    				print "</li>\n";
-    			}
-    		}
-			*/
-
-    		// Enable tooltips
+    		// Enable jquery handlers on new generated HTML objects
             print '<script type="text/javascript">';
             print 'jQuery(".classfortooltip").tipTip({ maxWidth: "600px", edgeOffset: 10, delay: 50, fadeIn: 50, fadeOut: 50});';
-            print 'jQuery(".fmdirlia").click(function(e) { jQuery("#userfile_section").val(jQuery(this).attr(\'rel\')); });';
-
+            print 'jQuery(".fmdirlia").click(function(e) {
+            			id=jQuery(this).attr(\'id\').substr(12);
+            			jQuery("#formuserfile_section_dir").val(jQuery(this).attr(\'rel\'));
+            			jQuery("#formuserfile_section_id").val(id);
+    				});';
             print '</script>';
 
     		echo "</ul>\n";
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index bbd1cc108b1..1eee2e85b70 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -78,8 +78,9 @@ class FormFile
             if (empty($title)) $title=$langs->trans("AttachANewFile");
             if ($title != 'none') print_titre($title);
 
-            print '<form name="userfile" action="'.$url.'" enctype="multipart/form-data" method="POST">';
-            print '<input type="hidden" id="userfile_section" name="section" value="'.$sectionid.'">';
+            print '<form name="formuserfile" action="'.$url.'" enctype="multipart/form-data" method="POST">';
+            print '<input type="hidden" id="formuserfile_section_dir" name="section_dir" value="">';
+            print '<input type="hidden" id="formuserfile_section_id"  name="section_id" value="'.$sectionid.'">';
             print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
 
             print '<table width="100%" class="nobordernopadding">';
@@ -87,7 +88,7 @@ class FormFile
 
             if (! empty($options)) print '<td>'.$options.'</td>';
 
-            print '<td valign="top" nowrap="nowrap">';
+            print '<td valign="middle" nowrap="nowrap">';
 
             $max=$conf->global->MAIN_UPLOAD_DOC;		// En Kb
             $maxphp=@ini_get('upload_max_filesize');	// En inconnu
@@ -605,8 +606,8 @@ class FormFile
                 }
                 // Delete or view link
                 print '<td align="right">';
-                if (! empty($useinecm)) print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'">'.img_view().'</a> &nbsp; ';
-                if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'&action=delete&urlfile='.urlencode($file['name']).$param.'">'.img_delete().'</a>';
+                if ($useinecm)     print '<a href="'.DOL_URL_ROOT.'/ecm/docfile.php?urlfile='.urlencode($file['name']).$param.'" class="editfilelink" rel="'.urlencode($file['name']).'">'.img_view().'</a> &nbsp; ';
+                if ($permtodelete) print '<a href="'.(($useinecm && ! empty($conf->global->MAIN_ECM_TRY_JS))?'#':$url.'?id='.$object->id.'&action=delete&urlfile='.urlencode($file['name']).$param).'" class="deletefilelink" rel="'.urlencode($file['name']).'">'.img_delete().'</a>';
                 else print '&nbsp;';
                 print "</td>";
                 print "</tr>\n";
diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php
index 814ffe64471..6fac13e0d36 100644
--- a/htdocs/core/lib/functions.lib.php
+++ b/htdocs/core/lib/functions.lib.php
@@ -33,7 +33,7 @@
 
 if (! function_exists('json_encode'))
 {
-    require_once(DOL_DOCUMENT_ROOT ."/core/lib/json.lib.php");
+    include_once(DOL_DOCUMENT_ROOT ."/core/lib/json.lib.php");
 }
 
 /**
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index eee4297fa32..54092313f36 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -49,12 +49,10 @@ $result = restrictedArea($user, 'ecm', 0);
 // Get parameters
 $socid=GETPOST('socid','int');
 $action=GETPOST("action");
-$section=GETPOST("section");
+$section=GETPOST("section")?GETPOST("section","int"):GETPOST("section_id","int");
 $module=GETPOST("module");
 if (! $section) $section=0;
 
-$upload_dir = $conf->ecm->dir_output.'/'.$section;
-
 $sortfield = GETPOST("sortfield",'alpha');
 $sortorder = GETPOST("sortorder",'alpha');
 $page = GETPOST("page",'int');
@@ -66,9 +64,9 @@ if (! $sortorder) $sortorder="ASC";
 if (! $sortfield) $sortfield="fullname";
 
 $ecmdir = new EcmDirectory($db);
-if (GETPOST("section"))
+if ($section)
 {
-	$result=$ecmdir->fetch(GETPOST("section"));
+	$result=$ecmdir->fetch($section);
 	if (! $result > 0)
 	{
 		dol_print_error($db,$ecmdir->error);
@@ -88,7 +86,10 @@ $userstatic = new User($db);
 // Upload file
 if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
 {
-	$relativepath=$ecmdir->getRelativePath();
+	// Define relativepath and upload_dir
+    $relativepath='';
+	if ($ecmdir->id) $relativepath=$ecmdir->getRelativePath();
+	else $relativepath=GETPOST('section_dir');
 	$upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
 
 	if (dol_mkdir($upload_dir) >= 0)
@@ -124,8 +125,10 @@ if (GETPOST("sendit") && ! empty($conf->global->MAIN_UPLOAD_DOC))
 	}
 }
 
+
+
 // Add directory
-if (GETPOST("action") == 'add' && $user->rights->ecm->setup)
+if ($action == 'add' && $user->rights->ecm->setup)
 {
 	$ecmdir->ref                = 'NOTUSEDYET';
 	$ecmdir->label              = GETPOST("label");
@@ -142,12 +145,14 @@ if (GETPOST("action") == 'add' && $user->rights->ecm->setup)
 		$mesg='<div class="error">Error '.$langs->trans($ecmdir->error).'</div>';
 		$action = "create";
 	}
+
+	clearstatcache();
 }
 
 // Remove file
-if (GETPOST('action') == 'confirm_deletefile' && GETPOST('confirm') == 'yes')
+if ($action == 'confirm_deletefile' && GETPOST('confirm') == 'yes')
 {
-	$result=$ecmdir->fetch(GETPOST("section"));
+	$result=$ecmdir->fetch($section);
 	if (! $result > 0)
 	{
 		dol_print_error($db,$ecmdir->error);
@@ -163,6 +168,8 @@ if (GETPOST('action') == 'confirm_deletefile' && GETPOST('confirm') == 'yes')
 
 	$result=$ecmdir->changeNbOfFiles('-');
 	$action='file_manager';
+
+	clearstatcache();
 }
 
 // Remove directory
@@ -170,11 +177,15 @@ if ($action == 'confirm_deletesection' && GETPOST('confirm') == 'yes')
 {
 	$result=$ecmdir->delete($user);
 	$mesg = '<div class="ok">'.$langs->trans("ECMSectionWasRemoved", $ecmdir->label).'</div>';
+
+    clearstatcache();
 }
 
 // Refresh directory view
 if ($action == 'refreshmanual')
 {
+    clearstatcache();
+
     $diroutputslash=str_replace('\\','/',$conf->ecm->dir_output);
     $diroutputslash.='/';
 
@@ -289,13 +300,10 @@ if ($action == 'refreshmanual')
  *	View
  */
 
-$userstatic = new User($db);
-$ecmdirstatic = new EcmDirectory($db);
-
 //print "xx".$_SESSION["dol_screenheight"];
 $maxheightwin=(isset($_SESSION["dol_screenheight"]) && $_SESSION["dol_screenheight"] > 500)?($_SESSION["dol_screenheight"]-166):660;
 $morejs=array();
-if (! empty($conf->global->MAIN_ECM_TRY_JS)) $morejs=array("/filemanager/includes/jqueryFileTree/jqueryFileTree.js");
+if (! empty($conf->global->MAIN_ECM_TRY_JS)) $morejs=array("/filemanager/includes/jqueryFileTree/jqueryFileTree.js");    // TODO Move lib into includes
 $moreheadcss="
 <!-- dol_screenheight=".$_SESSION["dol_screenheight"]." -->
 <style type=\"text/css\">
@@ -366,7 +374,7 @@ print "<br>\n";
 // Confirm remove file
 if ($action == 'delete')
 {
-	$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$_REQUEST["section"].'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile','','',1);
+	$ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$section.'&urlfile='.urlencode($_GET["urlfile"]), $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile','','',1);
 	if ($ret == 'html') print '<br>';
 }
 
@@ -402,9 +410,8 @@ else
     print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/folder-new.png">';
     print '</a>';
 }
-
 print '<a href="'.$_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&amp;module='.$module:'').($section?'&amp;section='.$section:'').'" class="toolbarbutton" title="'.dol_escape_htmltag($langs->trans('Refresh')).'">';
-//print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
+print '<img class="toolbarbutton" border="0" src="'.DOL_URL_ROOT.'/theme/common/view-refresh.png">';
 print '</a>';
 
 
@@ -429,7 +436,7 @@ else
 // Confirmation de la suppression d'une ligne categorie
 if ($action == 'delete_section')
 {
-    $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.urlencode($_GET["section"]), $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1);
+    $ret=$form->form_confirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection',$ecmdir->label), 'confirm_deletesection','','',1);
     if ($ret == 'html') print '<br>';
 }
 // End confirm
@@ -438,8 +445,6 @@ if ($action == 'delete_section')
 
 if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$action) || $action == 'delete')
 {
-
-
 	print '<table width="100%" class="nobordernopadding">';
 
 	print '<tr class="liste_titre">';
@@ -453,13 +458,17 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
     // Auto section
 	if (count($sectionauto))
 	{
+		$htmltooltip=$langs->trans("ECMAreaDesc2");
+
 		// Root title line (Automatic section)
 		print '<tr>';
 		print '<td>';
 		print '<table class="nobordernopadding"><tr class="nobordernopadding">';
 		print '<td align="left" width="24">';
 		print img_picto_common('','treemenu/base.gif');
-		print '</td><td align="left">'.$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionsAuto").')';
+		print '</td><td align="left">';
+		$txt=$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionsAuto").')';
+		print $form->textwithpicto($txt,$htmltooltip,1,0);
 		print '</td>';
 		print '</tr></table>';
 		print '</td>';
@@ -468,8 +477,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
 		print '<td align="right">&nbsp;</td>';
 		print '<td align="right">&nbsp;</td>';
 		print '<td align="center">';
-		$htmltooltip=$langs->trans("ECMAreaDesc2");
-		print $form->textwithpicto('',$htmltooltip,1,0);
+		//print $form->textwithpicto('',$htmltooltip,1,0);
 		print '</td>';
 		//print '<td align="right">'.$langs->trans("ECMNbOfDocsSmall").' <a href="'.$_SERVER["PHP_SELF"].'?action=refreshauto">'.img_picto($langs->trans("Refresh"),'refresh').'</a></td>';
 		print '</tr>';
@@ -533,7 +541,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
 				$htmltooltip='<b>'.$langs->trans("Type").'</b>: '.$langs->trans("ECMSectionAuto").'<br>';
 				$htmltooltip.='<b>'.$langs->trans("ECMCreationUser").'</b>: '.$langs->trans("ECMTypeAuto").'<br>';
 				$htmltooltip.='<b>'.$langs->trans("Description").'</b>: '.$val['desc'];
-				print $form->textwithpicto('',$htmltooltip,1,0);
+				print $form->textwithpicto('',$htmltooltip,1,"info");
 				print '</td>';
 
 				print "</tr>\n";
@@ -554,13 +562,17 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
 
 
 	// Manual section
+	$htmltooltip=$langs->trans("ECMAreaDesc2");
+
 
 	// Root of manual section
 	print '<tr><td>';
 	print '<table class="nobordernopadding"><tr class="nobordernopadding">';
 	print '<td align="left" width="24px">';
 	print img_picto_common('','treemenu/base.gif');
-	print '</td><td align="left">'.$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionsManual").')';
+	print '</td><td align="left">';
+	$txt=$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionsManual").')';
+	print $form->textwithpicto($txt,$htmltooltip,1,"info");
 	print '</td>';
 	print '</tr></table></td>';
 	print '<td align="right">';
@@ -570,8 +582,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
 	print '<td align="right">&nbsp;</td>';
 	print '<td align="right">&nbsp;</td>';
 	print '<td align="center">';
-	$htmltooltip=$langs->trans("ECMAreaDesc2");
-	print $form->textwithpicto('',$htmltooltip,1,0);
+	//print $form->textwithpicto('',$htmltooltip,1,"info");
 	print '</td>';
 	print '</tr>';
 
@@ -617,22 +628,24 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
 
 		jQuery(document).ready( function() {
     	    jQuery('#filetree').fileTree({ root: '<?php print dol_escape_js($openeddir); ?>',
-                     script: '<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?modulepart=ecm&openeddir='.urlencode($openeddir); ?>',
-                     folderEvent: 'click',
-                     multiFolder: false  },
-                     function(file) {
-                    	 jQuery("#mesg").hide();
-                    	 loadandshowpreview(file);
-               		 }
-               );
+            	script: '<?php echo DOL_URL_ROOT.'/core/ajax/ajaxdirtree.php?modulepart=ecm&openeddir='.urlencode($openeddir); ?>',
+                folderEvent: 'click',
+                multiFolder: false  },
+                function(file) {
+                	jQuery("#mesg").hide();
+                    loadandshowpreview(file,0);
+             	}
+            );
+
 		});
 
 	    </script>
 	    <?php
+
+	    print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile');
     }
     else
     {
-
     	// Load full tree
     	if (empty($sqltree)) $sqltree=$ecmdirstatic->get_full_arbo(0);
 
@@ -657,7 +670,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
     	$expandedsectionarray=array();
     	if (isset($_SESSION['dol_ecmexpandedsectionarray'])) $expandedsectionarray=explode(',',$_SESSION['dol_ecmexpandedsectionarray']);
 
-    	if ($section && $_GET['sectionexpand'] == 'true')
+    	if ($section && GETPOST('sectionexpand') == 'true')
     	{
     		// We add all sections that are parent of opened section
     		$pathtosection=explode('_',$fullpathselected);
@@ -670,7 +683,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
     		}
     		$_SESSION['dol_ecmexpandedsectionarray']=join(',',$expandedsectionarray);
     	}
-    	if ($section && $_GET['sectionexpand'] == 'false')
+    	if ($section && GETPOST('sectionexpand') == 'false')
     	{
     		// We removed all expanded sections that are child of the closed section
     		$oldexpandedsectionarray=$expandedsectionarray;
@@ -751,6 +764,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
     			if (! in_array($val['id'],$expandedsectionarray)) print img_picto($ecmdirstatic->ref,DOL_URL_ROOT.'/theme/common/treemenu/folder.gif','',1);
     			else print img_picto($ecmdirstatic->ref,DOL_URL_ROOT.'/theme/common/treemenu/folder-expanded.gif','',1);
     			print '</td>';
+
     			// Show link
     			print '<td valign="middle">';
     			if ($section == $val['id']) print ' <u>';
@@ -788,7 +802,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
     			$htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInDir").'</b>: '.$val['cachenbofdoc'].'<br>';
     			if ($nbofsubdir) $htmltooltip.='<b>'.$langs->trans("ECMNbOfFilesInSubDir").'</b>: '.$nboffilesinsubdir;
     			else $htmltooltip.='<b>'.$langs->trans("ECMNbOfSubDir").'</b>: '.$nbofsubdir.'<br>';
-    			print $form->textwithpicto('',$htmltooltip,1,0);
+    			print $form->textwithpicto('',$htmltooltip,1,"info");
     			print "</td>";
 
     			print "</tr>\n";
@@ -837,107 +851,11 @@ else
 // Start right panel
 
 
-
-$formfile=new FormFile($db);
-
-$param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
-$maxlengthname=40;
-
-// Right area
-if ($module == 'company')  // Auto area for suppliers invoices
-{
-    $upload_dir = $conf->societe->dir_output;
-    $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
-
-    $param.='&module='.$module;
-    $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
-
-    $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
-}
-else if ($module == 'invoice')  // Auto area for suppliers invoices
-{
-    $upload_dir = $conf->facture->dir_output;
-    $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
-
-    $param.='&module='.$module;
-    $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
-
-    $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
-}
-else if ($module == 'invoice_supplier')  // Auto area for suppliers invoices
-{
-    $relativepath='facture';
-    $upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
-    $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
-
-    $param.='&module='.$module;
-    $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
-
-    $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
-}
-else if ($module == 'propal')  // Auto area for customers orders
-{
-    $upload_dir = $conf->propal->dir_output;
-    $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
-
-    $param.='&module='.$module;
-    $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
-
-    $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
-}
-else if ($module == 'order')  // Auto area for customers orders
-{
-    $upload_dir = $conf->commande->dir_output;
-    $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
-
-    $param.='&module='.$module;
-    $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
-
-    $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
-}
-else if ($module == 'order_supplier')  // Auto area for suppliers orders
-{
-    $relativepath='commande';
-    $upload_dir = $conf->fournisseur->dir_output.'/'.$relativepath;
-    $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^payments$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
-
-    $param.='&module='.$module;
-    $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
-
-    $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
-}
-else if ($module == 'contract')  // Auto area for suppliers invoices
-{
-    $upload_dir = $conf->contrat->dir_output;
-    $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
-
-    $param.='&module='.$module;
-    $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
-
-    $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
-}
-else if ($module == 'tax')  // Auto area for suppliers invoices
-{
-    $upload_dir = $conf->tax->dir_output;
-    $filearray=dol_dir_list($upload_dir,"files",1,'',array('^SPECIMEN\.pdf$','^\.','\.meta$','^temp$','^CVS$','^thumbs$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
-
-    $param.='&module='.$module;
-    $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("NoFileFound")));
-
-    $formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
-}
-else    // Manual area
-{
-    $relativepath=$ecmdir->getRelativePath();
-    $upload_dir = $conf->ecm->dir_output.'/'.$relativepath;
-    $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','\.meta$','^temp$','^CVS$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
-
-    $param.='&section='.$section;
-    $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection")));
-
-    $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname);
-}
-
+//if (empty($conf->global->MAIN_ECM_TRY_JS))
+//{
+    $mode='noajax';
+    include_once(DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirpreview.php');
+//}
 
 
 // End right panel
@@ -946,7 +864,7 @@ if ($conf->use_javascript_ajax)
 ?>
 	</div>
     </div>
-    <div class="pane-in ecm-in-layout-south layout-padding">
+    <div class="pane-in ecm-in-layout-south layout-padding valignmiddle">
 <?php
 }
 else
@@ -958,11 +876,11 @@ else
 // Start Add new file area
 
 
-
 // To attach new file
 if (! empty($conf->global->MAIN_ECM_TRY_JS) || ! empty($section))
 {
-	$formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php', 'none', 0, $section, $user->rights->ecm->upload, 48);
+    $formfile=new FormFile($db);
+	$formfile->form_attach_new_file(DOL_URL_ROOT.'/ecm/index.php', 'none', 0, ($section?$section:-1), $user->rights->ecm->upload, 48);
 }
 else print '&nbsp;';
 
diff --git a/htdocs/theme/auguria/style.css.php b/htdocs/theme/auguria/style.css.php
index 052727dbd1b..69bfb5ca615 100644
--- a/htdocs/theme/auguria/style.css.php
+++ b/htdocs/theme/auguria/style.css.php
@@ -2054,6 +2054,111 @@ div.tdlineupdown {
 	white-space: nowrap;
 }
 
+
+
+/* ============================================================================== */
+/*  JSGantt                                                                       */
+/* ============================================================================== */
+
+div.scroll2 {
+	width: 582px !important;
+}
+
+
+/* ============================================================================== */
+/*  jFileTree                                                                     */
+/* ============================================================================== */
+
+.ecmfiletree {
+	width: 99%;
+	height: 99%;
+	background: #FFF;
+	padding-left: 2px;
+	font-weight: normal;
+}
+
+.fileview {
+	width: 99%;
+	height: 99%;
+	background: #FFF;
+	padding-left: 2px;
+	padding-top: 4px;
+	font-weight: normal;
+}
+
+div.filedirelem {
+    position: relative;
+    display: block;
+    text-decoration: none;
+}
+
+ul.filedirelem {
+    padding: 2px;
+    margin: 0 5px 5px 5px;
+}
+ul.filedirelem li {
+    list-style: none;
+    padding: 2px;
+    margin: 0 10px 20px 10px;
+    width: 160px;
+    height: 120px;
+    text-align: center;
+    display: block;
+    float: <?php print $left; ?>;
+    border: solid 1px #DDDDDD;
+}
+
+ui-layout-north {
+
+}
+
+ul.ecmjqft {
+	font-size: 11px;
+	line-height: 16px;
+	padding: 0px;
+	margin: 0px;
+	font-weight: normal;
+}
+
+ul.ecmjqft li {
+	list-style: none;
+	padding: 0px;
+	padding-left: 20px;
+	margin: 0px;
+	white-space: nowrap;
+	display: block;
+}
+
+ul.ecmjqft a {
+	line-height: 16px;
+	vertical-align: middle;
+	color: #333;
+	padding: 0px 0px;
+	font-weight:normal;
+	display: inline-block !important;
+/*	float: left;*/
+}
+ul.ecmjqft a:active {
+	font-weight: bold !important;
+}
+ul.ecmjqft a:hover {
+    text-decoration: underline;
+}
+div.ecmjqft {
+	vertical-align: middle;
+	display: inline-block !important;
+	text-align: right;
+	position:absolute;
+	right:8px;
+}
+
+/* Core Styles */
+.ecmjqft LI.directory { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2.png',1); ?>) left top no-repeat; }
+.ecmjqft LI.expanded { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2-expanded.png',1); ?>) left top no-repeat; }
+.ecmjqft LI.wait { font-weight:normal; background: url(<?php echo dol_buildpath('/theme/eldy/img/working.gif',1); ?>) left top no-repeat; }
+
+
+
 <?php
 if (is_object($db)) $db->close();
 ?>
\ No newline at end of file
diff --git a/htdocs/theme/bureau2crea/style.css.php b/htdocs/theme/bureau2crea/style.css.php
index 7378f5a17ff..eae9cbd3a5c 100644
--- a/htdocs/theme/bureau2crea/style.css.php
+++ b/htdocs/theme/bureau2crea/style.css.php
@@ -2308,6 +2308,111 @@ form.listactionsfilter input[type="submit"] {
 	margin: 2px 0px;
 }
 
+
+
+/* ============================================================================== */
+/*  JSGantt                                                                       */
+/* ============================================================================== */
+
+div.scroll2 {
+	width: 582px !important;
+}
+
+
+/* ============================================================================== */
+/*  jFileTree                                                                     */
+/* ============================================================================== */
+
+.ecmfiletree {
+	width: 99%;
+	height: 99%;
+	background: #FFF;
+	padding-left: 2px;
+	font-weight: normal;
+}
+
+.fileview {
+	width: 99%;
+	height: 99%;
+	background: #FFF;
+	padding-left: 2px;
+	padding-top: 4px;
+	font-weight: normal;
+}
+
+div.filedirelem {
+    position: relative;
+    display: block;
+    text-decoration: none;
+}
+
+ul.filedirelem {
+    padding: 2px;
+    margin: 0 5px 5px 5px;
+}
+ul.filedirelem li {
+    list-style: none;
+    padding: 2px;
+    margin: 0 10px 20px 10px;
+    width: 160px;
+    height: 120px;
+    text-align: center;
+    display: block;
+    float: <?php print $left; ?>;
+    border: solid 1px #DDDDDD;
+}
+
+ui-layout-north {
+
+}
+
+ul.ecmjqft {
+	font-size: 11px;
+	line-height: 16px;
+	padding: 0px;
+	margin: 0px;
+	font-weight: normal;
+}
+
+ul.ecmjqft li {
+	list-style: none;
+	padding: 0px;
+	padding-left: 20px;
+	margin: 0px;
+	white-space: nowrap;
+	display: block;
+}
+
+ul.ecmjqft a {
+	line-height: 16px;
+	vertical-align: middle;
+	color: #333;
+	padding: 0px 0px;
+	font-weight:normal;
+	display: inline-block !important;
+/*	float: left;*/
+}
+ul.ecmjqft a:active {
+	font-weight: bold !important;
+}
+ul.ecmjqft a:hover {
+    text-decoration: underline;
+}
+div.ecmjqft {
+	vertical-align: middle;
+	display: inline-block !important;
+	text-align: right;
+	position:absolute;
+	right:8px;
+}
+
+/* Core Styles */
+.ecmjqft LI.directory { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2.png',1); ?>) left top no-repeat; }
+.ecmjqft LI.expanded { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2-expanded.png',1); ?>) left top no-repeat; }
+.ecmjqft LI.wait { font-weight:normal; background: url(<?php echo dol_buildpath('/theme/eldy/img/working.gif',1); ?>) left top no-repeat; }
+
+
+
 <?php
 if (is_object($db)) $db->close();
 ?>
\ No newline at end of file
diff --git a/htdocs/theme/cameleo/style.css.php b/htdocs/theme/cameleo/style.css.php
index d6fde9b4aae..c084e25654c 100644
--- a/htdocs/theme/cameleo/style.css.php
+++ b/htdocs/theme/cameleo/style.css.php
@@ -2125,6 +2125,109 @@ div.table-val-border-col {
 }
 
 
+
+/* ============================================================================== */
+/*  JSGantt                                                                       */
+/* ============================================================================== */
+
+div.scroll2 {
+	width: 582px !important;
+}
+
+
+/* ============================================================================== */
+/*  jFileTree                                                                     */
+/* ============================================================================== */
+
+.ecmfiletree {
+	width: 99%;
+	height: 99%;
+	background: #FFF;
+	padding-left: 2px;
+	font-weight: normal;
+}
+
+.fileview {
+	width: 99%;
+	height: 99%;
+	background: #FFF;
+	padding-left: 2px;
+	padding-top: 4px;
+	font-weight: normal;
+}
+
+div.filedirelem {
+    position: relative;
+    display: block;
+    text-decoration: none;
+}
+
+ul.filedirelem {
+    padding: 2px;
+    margin: 0 5px 5px 5px;
+}
+ul.filedirelem li {
+    list-style: none;
+    padding: 2px;
+    margin: 0 10px 20px 10px;
+    width: 160px;
+    height: 120px;
+    text-align: center;
+    display: block;
+    float: <?php print $left; ?>;
+    border: solid 1px #DDDDDD;
+}
+
+ui-layout-north {
+
+}
+
+ul.ecmjqft {
+	font-size: 11px;
+	line-height: 16px;
+	padding: 0px;
+	margin: 0px;
+	font-weight: normal;
+}
+
+ul.ecmjqft li {
+	list-style: none;
+	padding: 0px;
+	padding-left: 20px;
+	margin: 0px;
+	white-space: nowrap;
+	display: block;
+}
+
+ul.ecmjqft a {
+	line-height: 16px;
+	vertical-align: middle;
+	color: #333;
+	padding: 0px 0px;
+	font-weight:normal;
+	display: inline-block !important;
+/*	float: left;*/
+}
+ul.ecmjqft a:active {
+	font-weight: bold !important;
+}
+ul.ecmjqft a:hover {
+    text-decoration: underline;
+}
+div.ecmjqft {
+	vertical-align: middle;
+	display: inline-block !important;
+	text-align: right;
+	position:absolute;
+	right:8px;
+}
+
+/* Core Styles */
+.ecmjqft LI.directory { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2.png',1); ?>) left top no-repeat; }
+.ecmjqft LI.expanded { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2-expanded.png',1); ?>) left top no-repeat; }
+.ecmjqft LI.wait { font-weight:normal; background: url(<?php echo dol_buildpath('/theme/cameleo/img/working.gif',1); ?>) left top no-repeat; }
+
+
 <?php
 if (is_object($db)) $db->close();
 ?>
diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php
index fdb85acc752..9f38b540279 100644
--- a/htdocs/theme/eldy/style.css.php
+++ b/htdocs/theme/eldy/style.css.php
@@ -256,6 +256,9 @@ th .button {
 	-webkit-border-radius:0px !important;
 	border-radius:0px !important;
 }
+.valignmiddle {
+	vertical-align: middle;
+}
 
 /* ============================================================================== */
 /* Styles to hide objects                                                         */
@@ -2296,9 +2299,8 @@ ui-layout-north {
 }
 
 ul.ecmjqft {
-	font-family: Verdana, sans-serif;
 	font-size: 11px;
-	line-height: 18px;
+	line-height: 16px;
 	padding: 0px;
 	margin: 0px;
 	font-weight: normal;
@@ -2310,93 +2312,36 @@ ul.ecmjqft li {
 	padding-left: 20px;
 	margin: 0px;
 	white-space: nowrap;
+	display: block;
 }
 
 ul.ecmjqft a {
+	line-height: 16px;
+	vertical-align: middle;
 	color: #333;
 	padding: 0px 0px;
 	font-weight:normal;
+	display: inline-block !important;
+/*	float: left;*/
 }
 ul.ecmjqft a:active {
 	font-weight: bold !important;
 }
-
 ul.ecmjqft a:hover {
     text-decoration: underline;
 }
+div.ecmjqft {
+	vertical-align: middle;
+	display: inline-block !important;
+	text-align: right;
+	position:absolute;
+	right:4px;
+}
 
 /* Core Styles */
-.ecmjqft LI.directory { font-weight:normal; background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/directory.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.expanded { font-weight:normal; background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/folder_open.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.file { font-weight:normal; background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/file.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.wait { font-weight:normal; background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/spinner.gif',1); ?>) left top no-repeat; }
-/* File Extensions*/
-.ecmjqft LI.ext_3gp { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/film.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_afp { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_afpa { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_asp { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_aspx { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_avi { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/film.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_bat { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/application.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_bmp { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/picture.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_c { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_cfm { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_cgi { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_com { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/application.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_cpp { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_css { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/css.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_doc { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/doc.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_exe { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/application.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_gif { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/picture.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_fla { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/flash.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_h { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_htm { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/html.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_html { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/html.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_jar { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/java.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_jpg { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/picture.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_jpeg { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/picture.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_js { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/script.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_lasso { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_log { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/txt.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_m4p { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/music.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_mov { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/film.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_mp3 { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/music.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_mp4 { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/film.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_mpg { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/film.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_mpeg { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/film.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_ogg { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/music.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_ogv { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/film.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_pcx { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/picture.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_pdf { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/pdf.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_php { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/php.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_png { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/picture.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_ppt { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/ppt.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_psd { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/psd.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_pl { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/script.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_py { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/script.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_rb { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/ruby.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_rbx { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/ruby.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_rhtml { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/ruby.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_rpm { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/linux.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_ruby { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/ruby.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_sql { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/db.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_swf { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/flash.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_tif { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/picture.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_tiff { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/picture.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_txt { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/txt.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_vb { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_wav { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/music.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_webm { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/film.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_wmv { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/film.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_xls { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/xls.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_xml { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/code.png',1); ?>) left top no-repeat; }
-.ecmjqft LI.ext_zip { background: url(<?php echo dol_buildpath('/filemanager/includes/jqueryFileTree/images/zip.png',1); ?>) left top no-repeat; }
-
-/* Right panel */
-
-.fmvalue {
-    color: #001166;
-}
+.ecmjqft LI.directory { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2.png',1); ?>) left top no-repeat; }
+.ecmjqft LI.expanded { font-weight:normal; background: url(<?php echo dol_buildpath($path.'/theme/common/treemenu/folder2-expanded.png',1); ?>) left top no-repeat; }
+.ecmjqft LI.wait { font-weight:normal; background: url(<?php echo dol_buildpath('/theme/eldy/img/working.gif',1); ?>) left top no-repeat; }
 
 
 
-- 
GitLab