diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 28f78e22ef434626a535532b757b30f555ae0f2a..52411613e0b8957b2d84e766a08f063fbf2a0ee6 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 e80ff8008dfc7909b45eea04e8fb5dd3fb4adb22..44b6a8adcd7d52587d998808493100f9dffca701 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1115,6 +1115,7 @@ class FormFile print "</td>\n"; print '<td align="right" width="80px">'.dol_print_size($file['size'],1,1).'</td>'; print '<td align="center" width="130px">'.dol_print_date($file['date'],"dayhour","tzuser").'</td>'; + // Preview if (empty($useinecm)) { @@ -1420,6 +1421,13 @@ class FormFile print '<td>'; 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 '</td>'; print '<td>'; //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 '</a>'; + + print $this->getDocumentsLink($modulepart, $filename, $filedir); + print "</td>\n"; print '<td align="right">'.dol_print_size($file['size'],1,1).'</td>'; print '<td align="center">'.dol_print_date($file['date'],"dayhour").'</td>'; print '<td align="right">'; - if (! empty($useinecm)) print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart; - if ($forcedownload) print '&attachment=1'; - print '&file='.urlencode($relativefile).'">'; - print img_view().'</a> '; + //if (! empty($useinecm)) print '<a data-ajax="false" href="'.DOL_URL_ROOT.'/document.php?modulepart='.$modulepart; + //if ($forcedownload) print '&attachment=1'; + //print '&file='.urlencode($relativefile).'">'; + //print img_view().'</a> '; //if ($permtodelete) print '<a href="'.$url.'?id='.$object->id.'§ion='.$_REQUEST["section"].'&action=delete&urlfile='.urlencode($file['name']).'">'.img_delete().'</a>'; //else print ' '; print "</td></tr>\n"; diff --git a/htdocs/ecm/docfile.php b/htdocs/ecm/docfile.php index 9a0ca16f6627c9bed1711e7e35519c5c8d069cf8..3b6455fe4a97101af13c8d7234a08731a0703dfa 100644 --- a/htdocs/ecm/docfile.php +++ b/htdocs/ecm/docfile.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2008-2016 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2008-2017 Laurent Destailleur <eldy@users.sourceforge.net> * * 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='<div class="error">'.$langs->trans('ErrorFailToRenameFile',$oldfile,$newfile).'</div>'; + 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."<br>"; } - - // Actions buttons print '<div class="tabsAction">'; if ($user->rights->ecm->setup) { print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=edit§ion='.$section.'&urlfile='.urlencode($urlfile).'">'.$langs->trans('Edit').'</a>'; + + print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=cancel§ion='.$section.'&urlfile='.urlencode($urlfile).'&backtourl='.urlencode($backtourl).'">'.$langs->trans('Cancel').'</a>'; } /* if ($user->rights->ecm->setup)