[ task #1036 ] Normalized usage of setEventMessage instead of

dol_htmloutput_mesg
This commit is contained in:
simnandez 2013-08-20 09:28:23 +02:00
parent fa5f09d6e0
commit 9741b49b75
2 changed files with 33 additions and 51 deletions

View File

@ -5,7 +5,7 @@
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -65,11 +65,11 @@ if ($action == 'update' || $action == 'add')
if (! $error) if (! $error)
{ {
$mesg = '<div class="ok">'.$langs->trans("SetupSaved").'</div>'; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = '<div class="error">'.$langs->trans("Error").'</div>'; setEventMessage($langs->trans("Error"),'errors');
} }
} }
@ -99,7 +99,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if (! isValidEmail($email)) if (! isValidEmail($email))
{ {
$langs->load("errors"); $langs->load("errors");
$mesg='<div class="error">'.$langs->trans("ErrorBadEMail",$email).'</div>'; setEventMessage($langs->trans("ErrorBadEMail",$email),'errors');
} }
else else
{ {
@ -118,11 +118,11 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
$mesg='<div class="error">'.$mailmanspip->error.'</div>'; setEventMessage($mailmanspip->error,'errors');
} }
else else
{ {
$mesg='MailmanCreationSuccess'; setEventMessage($langs->trans("MailmanCreationSuccess"));
} }
} }
if ($action == 'testunsubscribe') if ($action == 'testunsubscribe')
@ -131,11 +131,11 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && ! empty($con
if ($result < 0) if ($result < 0)
{ {
$error++; $error++;
$mesg='<div class="error">'.$mailmanspip->error.'</div>'; setEventMessage($mailmanspip->error,'errors');
} }
else else
{ {
$mesg='MailmanDeletionSuccess'; setEventMessage($langs->trans("MailmanDeletionSuccess"));
} }
} }
} }
@ -154,15 +154,10 @@ llxHeader('',$langs->trans("MailmanSpipSetup"),$help_url);
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'setup'); print_fiche_titre($langs->trans("MailmanSpipSetup"),$linkback,'setup');
$head = mailmanspip_admin_prepare_head(); $head = mailmanspip_admin_prepare_head();
dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user');
dol_htmloutput_mesg($mesg);
$var=!$var; $var=!$var;
if (! empty($conf->global->ADHERENT_USE_MAILMAN)) if (! empty($conf->global->ADHERENT_USE_MAILMAN))
{ {

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -46,7 +47,6 @@ $substitutionarrayfortest=array(
complete_substitutions_array($substitutionarrayfortest, $langs); complete_substitutions_array($substitutionarrayfortest, $langs);
$action=GETPOST('action'); $action=GETPOST('action');
$message='';
/* /*
@ -126,14 +126,6 @@ if (! empty($_POST['removedfile']) || ! empty($_POST['removedfilehtml']))
if ($_POST['removedfilehtml'] || $action='sendhtml') $action='testhtml'; if ($_POST['removedfilehtml'] || $action='sendhtml') $action='testhtml';
} }
/*
* Cancel
*/
if (($action == 'send' || $action == 'sendhtml') && GETPOST('cancel'))
{
$message='';
}
/* /*
* Send mail * Send mail
*/ */
@ -141,9 +133,6 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE
{ {
$error=0; $error=0;
$email_from=''; $email_from='';
if (! empty($_POST["fromname"])) $email_from=$_POST["fromname"].' '; if (! empty($_POST["fromname"])) $email_from=$_POST["fromname"].' ';
if (! empty($_POST["frommail"])) $email_from.='<'.$_POST["frommail"].'>'; if (! empty($_POST["frommail"])) $email_from.='<'.$_POST["frommail"].'>';
@ -172,13 +161,13 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE
if (empty($_POST["frommail"])) if (empty($_POST["frommail"]))
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")),'errors');
$action='test'; $action='test';
$error++; $error++;
} }
if (empty($sendto)) if (empty($sendto))
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTo")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTo")),'errors');
$action='test'; $action='test';
$error++; $error++;
} }
@ -212,11 +201,11 @@ if (($action == 'send' || $action == 'sendhtml') && ! GETPOST('addfile') && ! GE
if ($result) if ($result)
{ {
$message='<div class="ok">'.$langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)).'</div>'; setEventMessage($langs->trans("MailSuccessfulySent",$mailfile->getValidAddress($email_from,2),$mailfile->getValidAddress($sendto,2)));
} }
else else
{ {
$message='<div class="error">'.$langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result.'</div>'; setEventMessage($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result,'errors');
} }
$action=''; $action='';
@ -253,8 +242,6 @@ print_fiche_titre($langs->trans("EMailsSetup"),'','setup');
print $langs->trans("EMailsDesc")."<br>\n"; print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n"; print "<br>\n";
dol_htmloutput_mesg($message);
// List of sending methods // List of sending methods
$listofmethods=array(); $listofmethods=array();
$listofmethods['mail']='PHP mail function'; $listofmethods['mail']='PHP mail function';