diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php
index 2389a681000..e2ad29b8562 100644
--- a/htdocs/core/ajax/ajaxdirpreview.php
+++ b/htdocs/core/ajax/ajaxdirpreview.php
@@ -213,30 +213,42 @@ if ($type == 'directory')
$textifempty = $langs->trans('NoFileFound');
}
else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection"));
-
+
$formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname,'',$url);
}
}
-if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))
+
+if ($section)
{
- if ($section)
- {
- $param.=($param?'?':'').(preg_replace('/^&/','',$param));
+ $useajax=1;
+ if (! empty($conf->dol_use_jmobile)) $useajax=0;
+ if (empty($conf->use_javascript_ajax)) $useajax=0;
+ if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0;
- require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
- $useglobalvars=1;
- $form = new Form($db);
- $formquestion=array('urlfile'=>array('type'=>'hidden','value'=>'','name'=>'urlfile'));
- print $form->formconfirm($url,$langs->trans("DeleteFile"),$langs->trans("ConfirmDeleteFile"),'confirm_deletefile',$formquestion,"no",'deletefile');
+ $param.=($param?'?':'').(preg_replace('/^&/','',$param));
- // Enable jquery handlers on new generated HTML objects
- print ''."\n";
- }
+ if ($useajax || $action == 'delete')
+ {
+ $urlfile='';
+ if ($action == 'delete') $urlfile=GETPOST('urlfile');
+
+ require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+ $useglobalvars=1;
+ $form = new Form($db);
+ $formquestion=array('urlfile'=>array('type'=>'hidden','value'=>$urlfile,'name'=>'urlfile'));
+ print $form->formconfirm($url,$langs->trans("DeleteFile"),$langs->trans("ConfirmDeleteFile"),'confirm_deletefile',$formquestion,"no",($useajax?'deletefile':0));
+ }
+
+ if ($useajax)
+ {
+ // Enable jquery handlers on new generated HTML objects
+ print ''."\n";
+ }
}
// Close db if mode is not noajax
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 0559c7b56da..9c0968436d3 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -813,7 +813,12 @@ class FormFile
else
$filepath=$file['name'];
*/
- print ''.img_delete().'';
+ $useajax=1;
+ if (! empty($conf->dol_use_jmobile)) $useajax=0;
+ if (empty($conf->use_javascript_ajax)) $useajax=0;
+ if (! empty($conf->global->MAIN_ECM_DISABLE_JS)) $useajax=0;
+
+ print ''.img_delete().'';
}
else print ' ';
print "";