Fix: The delete button into ecm module does not work when ajax disabled.
This commit is contained in:
parent
5b40eff0fa
commit
2d8214a940
@ -213,30 +213,42 @@ if ($type == 'directory')
|
|||||||
$textifempty = $langs->trans('NoFileFound');
|
$textifempty = $langs->trans('NoFileFound');
|
||||||
}
|
}
|
||||||
else $textifempty=($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection"));
|
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);
|
$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)
|
$useajax=1;
|
||||||
{
|
if (! empty($conf->dol_use_jmobile)) $useajax=0;
|
||||||
$param.=($param?'?':'').(preg_replace('/^&/','',$param));
|
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';
|
$param.=($param?'?':'').(preg_replace('/^&/','',$param));
|
||||||
$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');
|
|
||||||
|
|
||||||
// Enable jquery handlers on new generated HTML objects
|
if ($useajax || $action == 'delete')
|
||||||
print '<script type="text/javascript">'."\n";
|
{
|
||||||
print 'jQuery(document).ready(function() {'."\n";
|
$urlfile='';
|
||||||
print 'jQuery(".deletefilelink").click(function(e) { jQuery("#urlfile").val(jQuery(this).attr("rel")); jQuery("#dialog-confirm-deletefile").dialog("open"); return false; });'."\n";
|
if ($action == 'delete') $urlfile=GETPOST('urlfile');
|
||||||
print '});'."\n";
|
|
||||||
print '</script>'."\n";
|
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 '<script type="text/javascript">'."\n";
|
||||||
|
print 'jQuery(document).ready(function() {'."\n";
|
||||||
|
print 'jQuery(".deletefilelink").click(function(e) { jQuery("#urlfile").val(jQuery(this).attr("rel")); jQuery("#dialog-confirm-deletefile").dialog("open"); return false; });'."\n";
|
||||||
|
print '});'."\n";
|
||||||
|
print '</script>'."\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close db if mode is not noajax
|
// Close db if mode is not noajax
|
||||||
|
|||||||
@ -813,7 +813,12 @@ class FormFile
|
|||||||
else
|
else
|
||||||
$filepath=$file['name'];
|
$filepath=$file['name'];
|
||||||
*/
|
*/
|
||||||
print '<a href="'.(($useinecm && ! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))?'#':$url.'?action=delete&urlfile='.urlencode($filepath).$param).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
|
$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 '<a href="'.(($useinecm && $useajax)?'#':$url.'?action=delete&urlfile='.urlencode($filepath).$param).'" class="deletefilelink" rel="'.$filepath.'">'.img_delete().'</a>';
|
||||||
}
|
}
|
||||||
else print ' ';
|
else print ' ';
|
||||||
print "</td>";
|
print "</td>";
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user