diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 9fde21d24de..7a1f2101ee7 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -77,7 +77,7 @@ class FormFile * @param string $htmlname Name and id of HTML form ('formuserfile' by default, 'formuserfileecm' when used to upload a file in ECM) * @param string $accept Specifies the types of files accepted (This is not a security check but an user interface facility. eg '.pdf,image/*' or '.png,.jpg' or 'video/*') * @param string $sectiondir If upload must be done inside a particular directory (if sectiondir defined, sectionid must not be) - * @param int $usewithoutform 0=Default, 1=Disable
and style to use in existing area + * @param int $usewithoutform 0=Default, 1=Disable and to use in existing form area, 2=Disable the tag only * @param int $capture 1=Add tag capture="capture" to force use of micro or video recording to generate file. When setting this to 1, you must also provide a value for $accept. * @param int $disablemulti 0=Default, 1=Disable multiple file upload * @param int $nooutput 0=Output result with print, 1=Return result @@ -129,6 +129,8 @@ class FormFile $url .= (strpos($url, '?') === false ? '?' : '&').'uploadform=1'; $out .= ''."\n"; + } + if (empty($usewithoutform) || $usewithoutform == 2) { $out .= ''."\n"; $out .= ''."\n"; $out .= ''."\n"; diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 41e7c937d6a..57a95c48ece 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -16,6 +16,7 @@ * * Output code for the filemanager * $module must be defined ('ecm', 'medias', ...) + * $formalreadyopen can be set to 1 to avoid to open the to submit files a second time */ // Protection to avoid direct call of template @@ -145,7 +146,7 @@ if ((!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE print ''."\n"; include_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; $formfile = new FormFile($db); - print $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section ? $section : -1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir, 0, 0, 0, 1); + print $formfile->form_attach_new_file($_SERVER["PHP_SELF"], 'none', 0, ($section ? $section : -1), $permtoupload, 48, null, '', 0, '', 0, $nameforformuserfile, '', $sectiondir, empty($formalreadyopen) ? 0 : $formalreadyopen, 0, 0, 1); } else { print ' '; } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 531a4a11d9f..aa2b357a794 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2506,7 +2506,8 @@ $moreheadjs .= ''."\n"; llxHeader($moreheadcss.$moreheadjs, $langs->trans("WebsiteSetup"), $helpurl, '', 0, 0, $arrayofjs, $arrayofcss, '', '', ''."\n".'
'); print "\n"; -print ''; +print ''."\n"; +print ''; print ''; print ''; @@ -4043,6 +4044,7 @@ if ($action == 'editfile' || $action == 'file_manager' || $action == 'convertimg $module = 'medias'; + $formalreadyopen = 2; // So the form to submit a new file will not be opened another time inside the core/tpl/filemanager.tpl.php if (empty($url)) { $url = DOL_URL_ROOT.'/website/index.php'; // Must be an url without param }