diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index 28f78e22ef4..52411613e0b 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -192,6 +192,7 @@ if ($type == 'directory')
// Auto area for expense report
else if ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output;
+ // Automatic list
if (in_array($module, $automodules))
{
$param.='&module='.$module;
@@ -200,7 +201,7 @@ if ($type == 'directory')
$filearray=dol_dir_list($upload_dir,"files",1,'', $excludefiles, $sortfield, $sorting,1);
$formfile->list_of_autoecmfiles($upload_dir,$filearray,$module,$param,1,'',$user->rights->ecm->upload,1,$textifempty,$maxlengthname,$url);
}
- //Manual area
+ // Manual list
else
{
$relativepath=$ecmdir->getRelativePath();
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index e80ff8008df..44b6a8adcd7 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -1115,6 +1115,7 @@ class FormFile
print "\n";
print '
'.dol_print_size($file['size'],1,1).' | ';
print ''.dol_print_date($file['date'],"dayhour","tzuser").' | ';
+
// Preview
if (empty($useinecm))
{
@@ -1420,6 +1421,13 @@ class FormFile
print '';
if ($found > 0 && is_object($this->cache_objects[$modulepart.'_'.$id.'_'.$ref])) print $this->cache_objects[$modulepart.'_'.$id.'_'.$ref]->getNomUrl(1,'document');
else print $langs->trans("ObjectDeleted",($id?$id:$ref));
+
+ $filename=dol_sanitizeFileName($ref);
+ //$filedir=$conf->$modulepart->dir_output . '/' . dol_sanitizeFileName($obj->ref);
+ $filedir=$file['path'];
+ //$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
+ //print $formfile->getDocumentsLink($modulepart, $filename, $filedir);
+
print ' | ';
print '';
//print "XX".$file['name']; //$file['name'] must be utf8
@@ -1429,14 +1437,17 @@ class FormFile
print img_mime($file['name'],$file['name'].' ('.dol_print_size($file['size'],0,0).')').' ';
print dol_trunc($file['name'],$maxlength,'middle');
print '';
+
+ print $this->getDocumentsLink($modulepart, $filename, $filedir);
+
print " | \n";
print ''.dol_print_size($file['size'],1,1).' | ';
print ''.dol_print_date($file['date'],"dayhour").' | ';
print '';
- if (! empty($useinecm)) print '';
- print img_view().' ';
+ //if (! empty($useinecm)) print '';
+ //print img_view().' ';
//if ($permtodelete) print ''.img_delete().'';
//else print ' ';
print " | \n";
diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php
index 9a0ca16f662..3b6455fe4a9 100644
--- a/htdocs/ecm/docfile.php
+++ b/htdocs/ecm/docfile.php
@@ -1,5 +1,5 @@
+/* Copyright (C) 2008-2017 Laurent Destailleur
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -61,6 +61,8 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="label";
+$cancel=GETPOST('cancel');
+$action=GETPOST('action');
$section=GETPOST("section");
if (! $section)
{
@@ -107,8 +109,23 @@ if (! empty($_GET["fileid"]))
* Put here all code to do according to value of "action" parameter
********************************************************************/
+if ($action == 'cancel')
+{
+ $action ='';
+ if ($backtourl)
+ {
+ header("Location: ".$backtourl);
+ exit;
+ }
+ else
+ {
+ header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager§ion='.$section);
+ exit;
+ }
+}
+
// Rename file
-if (GETPOST('action') == 'update' && ! GETPOST('cancel'))
+if ($action == 'update')
{
$error=0;
@@ -131,7 +148,7 @@ if (GETPOST('action') == 'update' && ! GETPOST('cancel'))
if (! $result)
{
$langs->load('errors');
- $mesg=''.$langs->trans('ErrorFailToRenameFile',$oldfile,$newfile).'
';
+ setEventMessages($langs->trans('ErrorFailToRenameFile',$oldfile,$newfile), null, 'errors');
$error++;
}
}
@@ -279,16 +296,14 @@ if ($_GET['action'] == 'delete_file')
if ($_GET["action"] != 'edit')
{
-
- if ($mesg) { print $mesg."
"; }
-
-
// Actions buttons
print '