diff --git a/htdocs/comm/mailing/fiche.php b/htdocs/comm/mailing/fiche.php index cd199701c44..db25741989d 100644 --- a/htdocs/comm/mailing/fiche.php +++ b/htdocs/comm/mailing/fiche.php @@ -1,6 +1,6 @@ - * Copyright (C) 2005-2011 Laurent Destailleur + * Copyright (C) 2005-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -112,9 +112,9 @@ if ($action == 'confirm_clone' && $confirm == 'yes') else { $mesg=$object->error; - $action=''; } } + $action=''; } // Action send emailing for everybody @@ -800,12 +800,12 @@ else array('type' => 'checkbox', 'name' => 'clone_receivers', 'label' => $langs->trans("CloneReceivers").' ('.$langs->trans("FeatureNotYetAvailable").')', 'value' => 0, 'disabled' => true) ); // Paiement incomplet. On demande si motif = escompte ou autre - $form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneEMailing'),$langs->trans('ConfirmCloneEMailing',$object->ref),'confirm_clone',$formquestion,'yes'); + $form->form_confirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneEMailing'),$langs->trans('ConfirmCloneEMailing',$object->ref),'confirm_clone',$formquestion,'yes',2,240); print '
'; } - if ($mesg) print $mesg; + dol_htmloutput_mesg($mesg); /* @@ -952,8 +952,10 @@ else * Mailing en mode edition */ - if ($mesg) print $mesg."
"; - if ($message) print $message."
"; + $mesgs=array(); + if ($mesg) $mesgs[]=$mesg; + if ($message) $message[]=$message; + dol_htmloutput_mesg('',$mesgs); print ''; diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 3304e85b637..b0f5c89f66d 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -148,13 +148,14 @@ if (! dol_is_dir($upload_dir)) print ''."\n"; print ''."\n"; +$param=''; // Dir if ($type == 'directory') { $formfile=new FormFile($db); - $param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:''); + $param.=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:''); $maxlengthname=40; // Right area @@ -242,12 +243,11 @@ if ($type == 'directory') } else // Manual area { - $relativepath=$ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; $filearray=dol_dir_list($upload_dir,"files",0,'',array('^\.','\.meta$','^temp$','^CVS$'),$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); - $param.='§ion='.$section; + if ($section) $param.='§ion='.$section; $textifempty=($section?$langs->trans("NoFileFound"):($showonrightsize=='featurenotyetavailable'?$langs->trans("FeatureNotYetAvailable"):$langs->trans("ECMSelectASection"))); $formfile->list_of_documents($filearray,'','ecm',$param,1,$relativepath,$user->rights->ecm->upload,1,$textifempty,$maxlengthname); @@ -255,14 +255,24 @@ if ($type == 'directory') } -if ((! isset($mode) || $mode != 'noajax') && empty($conf->global->MAIN_ECM_DISABLE_JS)) +if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { - // Enable jquery handlers on new generated HTML objects - print "\n".''."\n"; + if ($section) + { + require_once(DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'); + $form = new Form($db); + $formquestion=array('urlfile'=>array('type'=>'hidden','value'=>'','name'=>'urlfile')); + print $form->formconfirm(DOL_URL_ROOT.'/ecm/index.php'.($param?'?':'').(preg_replace('/^&/','',$param)),$langs->trans("DeleteFile"),$langs->trans("ConfirmDeleteFile"),'confirm_deletefile',$formquestion,"no",'deletefile'); - if (is_object($db)) $db->close(); + // Enable jquery handlers on new generated HTML objects + print ''."\n"; + } } +// Close db if mode is not noajax +if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close(); ?> diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 8582cb1a498..d7377fd0507 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2146,7 +2146,8 @@ class Form $more=''; $formconfirm=''; - $inputarray=array(); + $inputok=array(); + $inputko=array(); if (is_array($formquestion) && count($formquestion) > 0) { @@ -2207,13 +2208,16 @@ class Form $more.=$input['value']; $more.=''."\n"; } - if ($input['type'] != 'hidden') array_push($inputarray,$input['name']); + else if ($input['type'] == 'hidden') + { + $more.=''; + } } } $more.='
'."\n"; } - $formconfirm.= "\n\n"; + $formconfirm.= "\n\n"; if ($useajax && $conf->use_javascript_ajax) { @@ -2228,16 +2232,13 @@ class Form } $pageyes=$page.'&action='.$action.'&confirm=yes'; $pageno=($useajax == 2?$page.'&confirm=no':''); - // Add hidden fields + // Add input fields into list of fields to read during submit (inputok and inputko) if (is_array($formquestion)) { foreach ($formquestion as $key => $input) { - if ($input['type'] == 'hidden') - { - $pageyes.='&'.$input['name'].'='.urlencode($input['value']); - $pageno.=($useajax == 2?$page.'&'.$input['name'].'='.urlencode($input['value']):''); - } + array_push($inputok,$input['name']); + if ($input['inputko'] == 1) array_push($inputko,$input['name']); } } @@ -2247,13 +2248,15 @@ class Form $formconfirm.= img_help('','').' '.$question; $formconfirm.= ''."\n"; $formconfirm.= ''; @@ -2331,15 +2342,6 @@ class Form $formconfirm.= ''."\n"; - // Add hidden fields - if (is_array($formquestion)) - { - foreach ($formquestion as $key => $input) - { - if ($input['type'] == 'hidden') $formconfirm.= ''; - } - } - $formconfirm.= "\n"; $formconfirm.= '
'; } @@ -2903,7 +2905,7 @@ class Form function load_cache_vatrates($country_code) { global $langs; - + $num = count($this->cache_vatrates); if ($num > 0) return $num; // Cache deja charge diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index f144047f937..b6b47143a30 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -608,7 +608,7 @@ class FormFile // Delete or view link print ''; if ($useinecm) print ''.img_view().'   '; - if ($permtodelete) print ''.img_delete().''; + if ($permtodelete) print ''.img_delete().''; else print ' '; print ""; print "\n";