From 2927a586068e8a0430748703093697edf3c27d33 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 2 Sep 2012 20:11:36 +0200 Subject: [PATCH] Fix: Some fix into ajax ecm. New: The cache for nb of files into a dir is now implemented. By default it is "not defined" and we refresh it when making a scan of a dir for all subdirs. --- htdocs/core/ajax/ajaxdirpreview.php | 4 +- htdocs/core/ajax/ajaxdirtree.php | 55 +++++++++++++------ htdocs/core/lib/treeview.lib.php | 3 +- htdocs/ecm/class/ecmdirectory.class.php | 14 ++--- htdocs/ecm/index.php | 9 +-- .../install/mysql/migration/3.2.0-3.3.0.sql | 1 + 6 files changed, 52 insertions(+), 34 deletions(-) diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 024e62dbf27..1460d87bfba 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -61,8 +61,8 @@ if (! isset($mode) || $mode != 'noajax') // For ajax call $result=$ecmdir->fetch($section); if (! $result > 0) { - dol_print_error($db,$ecmdir->error); - exit; + //dol_print_error($db,$ecmdir->error); + //exit; } } else // For no ajax call diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 9de59a527d1..21487924b91 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -78,7 +78,7 @@ $userstatic=new User($db); $form=new Form($db); $ecmdirstatic = new EcmDirectory($db); -// Load full tree. We will use it to define nbofsubdir and nboffilesinsubdir +// Load full tree from database. We will use it to define nbofsubdir and nboffilesinsubdir if (empty($sqltree)) $sqltree=$ecmdirstatic->get_full_arbo(0); // Try to find key into $sqltree @@ -93,13 +93,13 @@ foreach($sqltree as $keycursor => $val) } -if( file_exists($fullpathselecteddir) ) +if (file_exists($fullpathselecteddir)) { $files = @scandir($fullpathselecteddir); if ($files) { natcasesort($files); - if( count($files) > 2 ) /* The 2 accounts for . and .. */ + if ( count($files) > 2 ) /* The 2 accounts for . and .. */ { echo "