diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index b441c93b1a2..ddcf8eb62d8 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -220,7 +220,8 @@ if ($type == 'directory')
if ($module == 'medias')
{
$relativepath=GETPOST('file','alpha');
- $upload_dir = $dolibarr_main_data_root.'/medias/'.$relativepath;
+ if ($relativepath && $relativepath!= '/') $relativepath.='/';
+ $upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath;
}
else
{
@@ -245,7 +246,11 @@ if ($type == 'directory')
$textifempty = $langs->trans('NoFileFound');
}
- else if ($section === '0') $textifempty='
'.$langs->trans("DirNotSynchronizedSyncFirst").'
';
+ else if ($section === '0')
+ {
+ if ($module == 'ecm') $textifempty='
'.$langs->trans("DirNotSynchronizedSyncFirst").'
';
+ else $textifempty = $langs->trans('NoFileFound');
+ }
else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection"));
if ($module == 'medias')
diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php
index 2390e163239..9d0908953c6 100644
--- a/htdocs/core/ajax/ajaxdirtree.php
+++ b/htdocs/core/ajax/ajaxdirtree.php
@@ -164,7 +164,7 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE
{
if (empty($val['fullrelativename'])) // If we did not find entry into database, but found a directory (dol_is_dir was ok at previous test)
{
- $val['fullrelativename']=$file;
+ $val['fullrelativename']=(($selecteddir && $selecteddir != '/')?$selecteddir.'/':'').$file;
$val['id']=0;
$val['label']=$file;
$val['description']='';
@@ -205,19 +205,22 @@ if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE
//print ' | ';
// Info
- print '';
- $userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0;
- $userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
- $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].' ';
- $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMSectionManual").' ';
- $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$userstatic->getNomUrl(1, '', false, 1).' ';
- $htmltooltip.=''.$langs->trans("ECMCreationDate").': '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).' ';
- $htmltooltip.=''.$langs->trans("Description").': '.$val['description'].' ';
- $htmltooltip.=''.$langs->trans("ECMNbOfFilesInDir").': '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).' ';
- if ($nboffilesinsubdir > 0) $htmltooltip.=''.$langs->trans("ECMNbOfFilesInSubDir").': '.$nboffilesinsubdir;
- else $htmltooltip.=''.$langs->trans("ECMNbOfSubDir").': '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).' ';
- print $form->textwithpicto('',$htmltooltip,1,"info");
- print " | ";
+ if ($modulepart == 'ecm')
+ {
+ print '';
+ $userstatic->id=isset($val['fk_user_c'])?$val['fk_user_c']:0;
+ $userstatic->lastname=isset($val['login_c'])?$val['login_c']:0;
+ $htmltooltip=''.$langs->trans("ECMSection").': '.$val['label'].' ';
+ $htmltooltip=''.$langs->trans("Type").': '.$langs->trans("ECMSectionManual").' ';
+ $htmltooltip.=''.$langs->trans("ECMCreationUser").': '.$userstatic->getNomUrl(1, '', false, 1).' ';
+ $htmltooltip.=''.$langs->trans("ECMCreationDate").': '.(isset($val['date_c'])?dol_print_date($val['date_c'],"dayhour"):$langs->trans("NeedRefresh")).' ';
+ $htmltooltip.=''.$langs->trans("Description").': '.$val['description'].' ';
+ $htmltooltip.=''.$langs->trans("ECMNbOfFilesInDir").': '.((isset($val['cachenbofdoc']) && $val['cachenbofdoc'] >= 0)?$val['cachenbofdoc']:$langs->trans("NeedRefresh")).' ';
+ if ($nboffilesinsubdir > 0) $htmltooltip.=''.$langs->trans("ECMNbOfFilesInSubDir").': '.$nboffilesinsubdir;
+ else $htmltooltip.=''.$langs->trans("ECMNbOfSubDir").': '.($nbofsubdir >= 0 ? $nbofsubdir : $langs->trans("NeedRefresh")).' ';
+ print $form->textwithpicto('',$htmltooltip,1,"info");
+ print " | ";
+ }
print "\n";
print '';
diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php
index 135f7061adb..56f9b692e94 100644
--- a/htdocs/ecm/index.php
+++ b/htdocs/ecm/index.php
@@ -334,6 +334,7 @@ dol_fiche_head($head, 'index', $langs->trans("ECMArea").' - '.$langs->trans("ECM
// Add filemanager component
+$module='ecm';
include DOL_DOCUMENT_ROOT.'/ecm/tpl/filemanager.tpl.php';
diff --git a/htdocs/ecm/tpl/filemanager.tpl.php b/htdocs/ecm/tpl/filemanager.tpl.php
index 84d73a42540..e80e9fd3e83 100644
--- a/htdocs/ecm/tpl/filemanager.tpl.php
+++ b/htdocs/ecm/tpl/filemanager.tpl.php
@@ -55,11 +55,13 @@ else
print '
';
print '';
}
-$url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'§ion='.$section:'')));
-print '';
-print '
';
-print '';
-
+if ($module == 'ecm')
+{
+ $url=((! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':($_SERVER["PHP_SELF"].'?action=refreshmanual'.($module?'&module='.$module:'').($section?'§ion='.$section:'')));
+ print '';
+ print '
';
+ print '';
+}
// Start "Add new file" area
$nameforformuserfile = 'formuserfileecm';