Fix cancel in media filemanager

This commit is contained in:
Laurent Destailleur 2020-06-03 12:34:09 +02:00
parent 66df7fca41
commit 93320deddc
3 changed files with 12 additions and 7 deletions

View File

@ -1196,6 +1196,7 @@ class FormFile
{
print '</a>';
$section_dir = dirname(GETPOST('urlfile', 'alpha'));
if (! preg_match('/\/$/', $section_dir)) $section_dir.='/';
print '<input type="hidden" name="section_dir" value="'.$section_dir.'">';
print '<input type="hidden" name="renamefilefrom" value="'.dol_escape_htmltag($file['name']).'">';
print '<input type="text" name="renamefileto" class="quatrevingtpercent" value="'.dol_escape_htmltag($file['name']).'">';

View File

@ -255,7 +255,11 @@ if (empty($backtourl))
$backtourl = DOL_URL_ROOT."/compta/bank/account_statement_document.php?id=".$id.'&num='.urlencode($num).'&file='.urldecode($file);
} elseif (in_array($modulepart, array('bank'))) $backtourl = DOL_URL_ROOT."/compta/bank/document.php?id=".$id.'&file='.urldecode($file);
elseif (in_array($modulepart, array('mrp'))) $backtourl = DOL_URL_ROOT."/mrp/mo_document.php?id=".$id.'&file='.urldecode($file);
elseif (in_array($modulepart, array('medias'))) $backtourl = DOL_URL_ROOT."/website/index.php?action=file_manager&website=".$website."&file=".urldecode($file).'&preopend=image';
elseif (in_array($modulepart, array('medias'))) {
$section_dir = dirname($file);
if (! preg_match('/\/$/', $section_dir)) $section_dir.='/';
$backtourl = DOL_URL_ROOT."/website/index.php?action=file_manager&website=".$website.'&section_dir='.urlencode($section_dir);
}
// Generic case that should work for everybody else
else $backtourl = DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($file);
}

View File

@ -328,10 +328,7 @@ if (GETPOST('refreshsite', 'alpha') || GETPOST('refreshsite.x', 'alpha') || GETP
}
if (GETPOST('refreshpage', 'alpha') && !in_array($action, array('updatecss'))) $action = 'preview';
if ($action == 'renamefile') {
$action = 'file_manager'; // After actions_linkedfiles, if action were renamefile, we set it to 'file_manager'
}
if ($cancel && $action == 'file_manager') {
if ($cancel && $action == 'renamefile') {
$cancel = '';
}
@ -353,6 +350,10 @@ if ($sortorder) $backtopage .= '&sortorder='.$sortorder;
include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
$backtopage = $savbacktopage;
if ($action == 'renamefile') { // Must be after include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; If action were renamefile, we set it to 'file_manager'
$action = 'file_manager';
}
if ($action == 'seteditinline')
{
dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1);
@ -2450,8 +2451,7 @@ if (!GETPOST('hide_websitemenu'))
// Toolbar for pages
if ($websitekey && $websitekey != '-1' && !in_array($action, array('editcss', 'editmenu', 'importsite', 'file_manager', 'replacesite', 'replacesiteconfirm')))
if ($websitekey && $websitekey != '-1' && !in_array($action, array('editcss', 'editmenu', 'importsite', 'file_manager', 'replacesite', 'replacesiteconfirm')) && !$file_manager)
{
print '</div>'; // Close current websitebar to open a new one