[ 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 Benoit Mortier <benoit.mortier@opensides.be>
* 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
* 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 = '<div class="ok">'.$langs->trans("SetupSaved").'</div>';
}
else
{
$mesg = '<div class="error">'.$langs->trans("Error").'</div>';
}
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='<div class="error">'.$langs->trans("ErrorBadEMail",$email).'</div>';
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='<div class="error">'.$mailmanspip->error.'</div>';
}
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='<div class="error">'.$mailmanspip->error.'</div>';
}
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='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
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))
{

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* 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
* 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='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")).'</div>';
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")),'errors');
$action='test';
$error++;
}
if (empty($sendto))
{
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTo")).'</div>';
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='<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
{
$message='<div class="error">'.$langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result.'</div>';
setEventMessage($langs->trans("ResultKo").'<br>'.$mailfile->error.' '.$result,'errors');
}
$action='';
@ -253,8 +242,6 @@ print_fiche_titre($langs->trans("EMailsSetup"),'','setup');
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
dol_htmloutput_mesg($message);
// List of sending methods
$listofmethods=array();
$listofmethods['mail']='PHP mail function';