diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index 0bf22d5829a..71274c4782b 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin - * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2011-2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,14 +63,14 @@ if ($action == 'update' || $action == 'add') if (! $res > 0) $error++; } - if (! $error) - { - $mesg = '
'.$langs->trans("SetupSaved").'
'; - } - else - { - $mesg = '
'.$langs->trans("Error").'
'; - } + if (! $error) + { + setEventMessage($langs->trans("SetupSaved")); + } + else + { + setEventMessage($langs->trans("Error"),'errors'); + } } // Action activation d'un sous module du module adherent @@ -99,7 +99,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con if (! isValidEmail($email)) { $langs->load("errors"); - $mesg='
'.$langs->trans("ErrorBadEMail",$email).'
'; + setEventMessage($langs->trans("ErrorBadEMail",$email),'errors'); } else { @@ -115,28 +115,28 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con if ($action == 'testsubscribe') { $result=$mailmanspip->add_to_mailman($object); - if ($result < 0) - { - $error++; - $mesg='
'.$mailmanspip->error.'
'; - } - else - { - $mesg='MailmanCreationSuccess'; - } + if ($result < 0) + { + $error++; + setEventMessage($mailmanspip->error,'errors'); + } + else + { + setEventMessage($langs->trans("MailmanCreationSuccess")); + } } if ($action == 'testunsubscribe') { $result=$mailmanspip->del_to_mailman($object); - if ($result < 0) - { - $error++; - $mesg='
'.$mailmanspip->error.'
'; - } - else - { - $mesg='MailmanDeletionSuccess'; - } + if ($result < 0) + { + $error++; + setEventMessage($mailmanspip->error,'errors'); + } + else + { + setEventMessage($langs->trans("MailmanDeletionSuccess")); + } } } } @@ -154,15 +154,10 @@ llxHeader('',$langs->trans("MailmanSpipSetup"),$help_url); $linkback=''.$langs->trans("BackToModuleList").''; print_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'setup'); - $head = mailmanspip_admin_prepare_head(); dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); - -dol_htmloutput_mesg($mesg); - - $var=!$var; if (! empty($conf->global->ADHERENT_USE_MAILMAN)) { diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index fc47a6b607e..ec3faca6625 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -1,6 +1,7 @@ * Copyright (C) 2009-2012 Regis Houssin + * Copyright (C) 2013 Juanjo Menent * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +47,6 @@ $substitutionarrayfortest=array( complete_substitutions_array($substitutionarrayfortest, $langs); $action=GETPOST('action'); -$message=''; /* @@ -126,14 +126,6 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml'])) if ($_POST['removedfilehtml'] || $action='sendhtml') $action='testhtml'; } -/* - * Cancel - */ -if (($action == 'send' || $action == 'sendhtml') && GETPOST('cancel')) -{ - $message=''; -} - /* * Send mail */ @@ -141,9 +133,6 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE { $error=0; - - - $email_from=''; if (! empty($_POST["fromname"])) $email_from=$_POST["fromname"].' '; if (! empty($_POST["frommail"])) $email_from.='<'.$_POST["frommail"].'>'; @@ -172,13 +161,13 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE if (empty($_POST["frommail"])) { - $message='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")),'errors'); $action='test'; $error++; } if (empty($sendto)) { - $message='
'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTo")).'
'; + setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTo")),'errors'); $action='test'; $error++; } @@ -212,11 +201,11 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE if ($result) { - $message='
'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)).'
'; + setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2))); } else { - $message='
'.$langs->trans("ResultKo").'
'.$mailfile->error.' '.$result.'
'; + setEventMessage($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result,'errors'); } $action=''; @@ -253,8 +242,6 @@ print_fiche_titre($langs->trans("EMailsSetup"),'','setup'); print $langs->trans("EMailsDesc")."
\n"; print "
\n"; -dol_htmloutput_mesg($message); - // List of sending methods $listofmethods=array(); $listofmethods['mail']='PHP mail function';