';
// End top panel, toolbar
?>
formconfirm($_SERVER["PHP_SELF"].'?section='.$section, $langs->trans('DeleteSection'), $langs->trans('ConfirmDeleteSection', $ecmdir->label), 'confirm_deletesection', '', '', 1);
}
// End confirm
// Ask confirmation to build webp images
if ($action == 'confirmconvertimgwebp') {
$langs->load("ecm");
$section_dir=GETPOST('section_dir', 'alpha');
$section=GETPOST('section', 'alpha');
$form = new Form($db);
$formquestion['section_dir']=array('type'=>'hidden', 'value'=>$section_dir, 'name'=>'section_dir');
$formquestion['section']=array('type'=>'hidden', 'value'=>$section, 'name'=>'section');
if ($module == 'medias') {
$formquestion['website']=array('type'=>'hidden', 'value'=>$website->ref, 'name'=>'website');
}
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans('ConfirmImgWebpCreation'), $langs->trans('ConfirmGenerateImgWebp', $object->ref), 'convertimgwebp', $formquestion, "yes", 1);
$action = 'file_manager';
}
// Duplicate images into .webp
if ($action == 'convertimgwebp' && $permtoadd) {
if ($module == 'medias') {
$imagefolder = $conf->website->dir_output.'/'.$websitekey.'/medias/'.dol_sanitizePathName(GETPOST('section_dir', 'alpha'));
} else {
$imagefolder = $conf->ecm->dir_output.'/'.dol_sanitizePathName(GETPOST('section_dir', 'alpha'));
}
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$regeximgext = getListOfPossibleImageExt();
$filelist = dol_dir_list($imagefolder, "files", 0, $regeximgext);
$nbconverted = 0;
foreach ($filelist as $filename) {
$filepath = $filename['fullname'];
if (!(substr_compare($filepath, 'webp', -strlen('webp')) === 0)) {
if (image_format_supported($filepath) == 1) {
$filepathnoext = preg_replace("/\.[a-z0-9]+$/i", "", $filepath);
if (! dol_is_file($filepathnoext.'.webp')) { // If file does not exists yet
$result = dol_imageResizeOrCrop($filepath, 0, 0, 0, 0, 0, $filepathnoext.'.webp', 90);
if (!dol_is_file($result)) {
$error++;
setEventMessages($result, null, 'errors');
} else {
$nbconverted++;
}
}
}
}
if ($error) {
break;
}
}
if (!$error) {
setEventMessages($langs->trans('SucessConvertImgWebp'), null);
}
$action = 'file_manager';
}
if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg_match('/refresh/i', $action) || $action == 'delete') {
$langs->load("ecm");
print '
'."\n";
print ''."\n";
print ''."\n";
print '| ';
print ''.$langs->trans("ECMSections").'';
print ' |
';
$showonrightsize = '';
// Manual section
$htmltooltip = $langs->trans("ECMAreaDesc2a");
$htmltooltip .= '
'.$langs->trans("ECMAreaDesc2b");
if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) {
// Show the link to "Root"
if ($showroot) {
print ' |
';
}
print '| ';
// Show filemanager tree (will be filled by a call of ajax /ecm/tpl/enablefiletreeajax.tpl.php, later, that executes ajaxdirtree.php)
print '';
if ($action == 'deletefile') {
print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile');
}
print ' |
';
} else {
// Show filtree when ajax is disabled (rare)
print '| ';
$_POST['modulepart'] = $module;
$_POST['openeddir'] = GETPOST('openeddir');
$_POST['dir'] = empty($_POST['dir']) ? '/' : $_POST['dir'];
// Show filemanager tree (will be filled by direct include of ajaxdirtree.php in mode noajax, this will return all dir - all levels - to show)
print ' ';
// Variables that may be defined:
// $_GET['modulepart'], $_GET['openeddir'], $_GET['sortfield'], $_GET['sortorder']
// $_POST['dir']
$mode = 'noajax';
if (empty($url)) {
$url = DOL_URL_ROOT.'/ecm/index.php';
}
include DOL_DOCUMENT_ROOT.'/core/ajax/ajaxdirtree.php';
print ' ';
print ' |
';
}
print "
";
}
// End left panel
?>