diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 7b29159b227..a987f16a8c7 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -104,8 +104,10 @@ if (!isset($mode) || $mode != 'noajax') { // For ajax call $upload_dir = $rootdirfordoc.'/'.$relativepath; } -if (empty($url)) { - if (GETPOSTISSET('website')) { +if (empty($url)) { // autoset $url but it is better to have it defined before into filemanager.tpl.php (not possible when in auto tree) + if (!empty($module) && $module == 'medias' && !GETPOST('website')) { + $url = DOL_URL_ROOT.'/ecm/index_medias.php'; + } elseif (GETPOSTISSET('website')) { $url = DOL_URL_ROOT.'/website/index.php'; } else { $url = DOL_URL_ROOT.'/ecm/index.php'; @@ -315,7 +317,7 @@ if ($type == 'directory') { $upload_dir = $dolibarr_main_data_root.'/'.$module.'/'.$relativepath; if (GETPOSTISSET('website') || GETPOSTISSET('file_manager')) { $param .= '&file_manager=1'; - if (!preg_match('/website=/', $param)) { + if (!preg_match('/website=/', $param) && GETPOST('website', 'alpha')) { $param .= '&website='.urlencode(GETPOST('website', 'alpha')); } if (!preg_match('/pageid=/', $param)) { diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c6b6c3b4c20..bc06d1517dc 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1138,7 +1138,7 @@ class FormFile if ($disablecrop == -1) { $disablecrop = 1; - // Values here must be supported by the photo_resize.php page. + // Values here must be supported by the photos_resize.php page. if (in_array($modulepart, array('bank', 'bom', 'expensereport', 'facture', 'facture_fournisseur', 'holiday', 'medias', 'member', 'mrp', 'project', 'product', 'produit', 'propal', 'service', 'societe', 'tax', 'tax-vat', 'ticket', 'user'))) { $disablecrop = 0; } @@ -1448,10 +1448,15 @@ class FormFile // Link to resize $moreparaminurl = ''; if (!empty($object->id) && $object->id > 0) { - $moreparaminurl = '&id='.$object->id; + $moreparaminurl .= '&id='.$object->id; } elseif (GETPOST('website', 'alpha')) { - $moreparaminurl = '&website='.GETPOST('website', 'alpha'); + $moreparaminurl .= '&website='.GETPOST('website', 'alpha'); } + // Set the backtourl + if ($modulepart == 'medias' && !GETPOST('website')) { + $moreparaminurl .= '&backtourl='.urlencode(DOL_URL_ROOT.'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.'§ion_dir='.$relativepath); + } + //var_dump($moreparaminurl); print ''.img_picto($langs->trans("ResizeOrCrop"), 'resize', 'class="paddingrightonly"').''; } } @@ -1461,6 +1466,7 @@ class FormFile print ''.img_edit('default', 0, 'class="paddingrightonly"').''; } } + // Output link to delete file if ($permonobject) { $useajax = 1; if (!empty($conf->dol_use_jmobile)) { @@ -1494,8 +1500,8 @@ class FormFile } else { print '