[ task #1036 ] Normalized usage of setEventMessage instead of

dol_htmloutput_mesg
This commit is contained in:
simnandez 2013-08-20 16:50:33 +02:00
parent db46bc88ca
commit b5e10a061b
9 changed files with 74 additions and 90 deletions

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2007 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
@ -37,9 +38,6 @@ if (!$user->admin) accessforbidden();
// Allow/Disallow change to clear passwords once passwords are crypted // Allow/Disallow change to clear passwords once passwords are crypted
$allow_disable_encryption=true; $allow_disable_encryption=true;
$mesg = '';
/* /*
* Actions * Actions
*/ */
@ -135,7 +133,7 @@ if ($action == 'activate_encryptdbpassconf')
} }
else else
{ {
$mesg='<div class="warning">'.$langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)).'</div>'; setEventMessage($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)),'warnings');
} }
} }
else if ($action == 'disable_encryptdbpassconf') else if ($action == 'disable_encryptdbpassconf')
@ -150,7 +148,7 @@ else if ($action == 'disable_encryptdbpassconf')
} }
else else
{ {
$mesg='<div class="warning">'.$langs->trans('InstrucToClearPass',$dolibarr_main_db_pass).'</div>'; setEventMessage($langs->trans('InstrucToClearPass',$dolibarr_main_db_pass),'warnings');
} }
} }
@ -179,8 +177,6 @@ llxHeader('',$langs->trans("Passwords"));
print_fiche_titre($langs->trans("SecuritySetup"),'','setup'); print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
dol_htmloutput_mesg($mesg);
print $langs->trans("GeneratedPasswordDesc")."<br>\n"; print $langs->trans("GeneratedPasswordDesc")."<br>\n";
print "<br>\n"; print "<br>\n";

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-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
@ -82,27 +83,27 @@ else if (preg_match('/del_(.*)/',$action,$reg))
else if ($action == 'MAIN_SESSION_TIMEOUT') else if ($action == 'MAIN_SESSION_TIMEOUT')
{ {
if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else setEventMessage($langs->trans("RecordModifiedSuccessfully"));
} }
else if ($action == 'MAIN_UPLOAD_DOC') else if ($action == 'MAIN_UPLOAD_DOC')
{ {
if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else setEventMessage($langs->trans("RecordModifiedSuccessfully"));
} }
else if ($action == 'MAIN_UMASK') else if ($action == 'MAIN_UMASK')
{ {
if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_UMASK", $_POST["MAIN_UMASK"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else setEventMessage($langs->trans("RecordModifiedSuccessfully"));
} }
else if ($action == 'MAIN_ANTIVIRUS_COMMAND') else if ($action == 'MAIN_ANTIVIRUS_COMMAND')
{ {
if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else setEventMessage($langs->trans("RecordModifiedSuccessfully"));
} }
else if ($action == 'MAIN_ANTIVIRUS_PARAM') else if ($action == 'MAIN_ANTIVIRUS_PARAM')
{ {
if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db); if (! dolibarr_set_const($db, "MAIN_ANTIVIRUS_PARAM", $_POST["MAIN_ANTIVIRUS_PARAM"],'chaine',0,'',$conf->entity)) dol_print_error($db);
else $mesg=$langs->trans("RecordModifiedSuccessfully"); else setEventMessage($langs->trans("RecordModifiedSuccessfully"));
} }
// Delete file // Delete file

View File

@ -1,6 +1,7 @@
<?php <?php
/* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2007-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2009 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
@ -87,25 +88,25 @@ if ($action == 'send' && ! $_POST['cancel'])
if (! empty($formsms->error)) if (! empty($formsms->error))
{ {
$message='<div class="error">'.$formsms->error.'</div>'; setEventMessage($formsms->error,'errors');
$action='test'; $action='test';
$error++; $error++;
} }
if (empty($body)) if (empty($body))
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("Message")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("Message")),'errors');
$action='test'; $action='test';
$error++; $error++;
} }
if (empty($smsfrom) || ! str_replace('+','',$smsfrom)) if (empty($smsfrom) || ! str_replace('+','',$smsfrom))
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsFrom")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsFrom")),'errors');
$action='test'; $action='test';
$error++; $error++;
} }
if (empty($sendto) || ! str_replace('+','',$sendto)) if (empty($sendto) || ! str_replace('+','',$sendto))
{ {
$message='<div class="error">'.$langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsTo")).'</div>'; setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentities("SmsTo")),'errors');
$action='test'; $action='test';
$error++; $error++;
} }
@ -122,11 +123,11 @@ if ($action == 'send' && ! $_POST['cancel'])
if ($result) if ($result)
{ {
$message='<div class="ok">'.$langs->trans("SmsSuccessfulySent",$smsfrom,$sendto).'</div>'; setEventMessage($langs->trans("SmsSuccessfulySent",$smsfrom,$sendto));
} }
else else
{ {
$message='<div class="error">'.$langs->trans("ResultKo").'<br>'.$smsfile->error.' '.$result.'</div>'; setEventMessage($langs->trans("ResultKo"),'errors');
} }
$action=''; $action='';
@ -151,8 +152,6 @@ print_fiche_titre($langs->trans("SmsSetup"),'','setup');
print $langs->trans("SmsDesc")."<br>\n"; print $langs->trans("SmsDesc")."<br>\n";
print "<br>\n"; print "<br>\n";
dol_htmloutput_mesg($message);
// List of sending methods // List of sending methods
$listofmethods=(is_array($conf->modules_parts['sms'])?$conf->modules_parts['sms']:array()); $listofmethods=(is_array($conf->modules_parts['sms'])?$conf->modules_parts['sms']:array());
asort($listofmethods); asort($listofmethods);

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
@ -70,11 +70,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');
} }
} }
@ -117,9 +117,6 @@ $head = mailmanspip_admin_prepare_head();
dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user');
dol_htmloutput_mesg($mesg);
/* /*
* Spip * Spip
*/ */

View File

@ -2,9 +2,9 @@
/* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2012-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro> * Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* *
* 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
@ -85,12 +85,12 @@ if($action)
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"),'errors');
} }
} }
@ -269,8 +269,6 @@ print "</td>\n";
print "</tr>\n"; print "</tr>\n";
print '</table>'; print '</table>';
dol_htmloutput_mesg($mesg);
$db->close(); $db->close();
llxFooter(); llxFooter();

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* 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) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -61,14 +61,14 @@ if ($action == 'updateMask')
if (! $res > 0) $error++; if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"),'errors');
} }
} }
if ($action == 'specimen') // For invoices if ($action == 'specimen') // For invoices
@ -106,13 +106,13 @@ if ($action == 'specimen') // For invoices
} }
else else
{ {
$mesg='<font class="error">'.$module->error.'</font>'; setEventMessage($module->error,'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
$mesg='<font class="error">'.$langs->trans("ErrorModuleNotFound").'</font>'; setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -172,14 +172,14 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT')
if (! $res > 0) $error++; if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"),'errors');
} }
} }
@ -467,8 +467,6 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
dol_htmloutput_mesg($mesg);
$db->close(); $db->close();
llxFooter(); llxFooter();
?> ?>

View File

@ -4,7 +4,7 @@
* Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2011 Regis Houssin <regis.houssin@capnetworks.com>
* 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) 2010-2012 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com> * Copyright (C) 2011-2013 Philippe Grand <philippe.grand@atoo-net.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -61,14 +61,14 @@ if ($action == 'updateMask')
if (! $res > 0) $error++; if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"),'errors');
} }
} }
else if ($action == 'specimen') // For orders else if ($action == 'specimen') // For orders
@ -106,13 +106,13 @@ else if ($action == 'specimen') // For orders
} }
else else
{ {
$mesg='<font class="error">'.$module->error.'</font>'; setEventMessage($module->error,'errors');
dol_syslog($module->error, LOG_ERR); dol_syslog($module->error, LOG_ERR);
} }
} }
else else
{ {
$mesg='<font class="error">'.$langs->trans("ErrorModuleNotFound").'</font>'; setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
} }
} }
@ -172,14 +172,14 @@ else if ($action == 'set_SUPPLIER_ORDER_FREE_TEXT')
if (! $res > 0) $error++; if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"),'errors');
} }
} }
@ -462,8 +462,6 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; print '</form>';
dol_htmloutput_mesg($mesg);
$db->close(); $db->close();
llxFooter(); llxFooter();
?> ?>

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* 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
@ -31,7 +32,7 @@ if (!$user->admin) accessforbidden();
$langs->load("admin"); $langs->load("admin");
$langs->load("other"); $langs->load("other");
$error=0; $mesg=''; $error=0;
$action = GETPOST("action"); $action = GETPOST("action");
$syslogModules = array(); $syslogModules = array();
@ -110,12 +111,12 @@ if ($action == 'set')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$db->rollback(); $db->rollback();
if (empty($mesg)) $mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"),'errors');
} }
} }
@ -129,12 +130,12 @@ if ($action == 'setlevel')
if (! $res > 0) $error++; if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"),'errors');
} }
} }
@ -249,8 +250,6 @@ print '</td></tr>';
print '</table>'; print '</table>';
print "</form>\n"; print "</form>\n";
dol_htmloutput_mesg($mesg);
llxFooter(); llxFooter();
$db->close(); $db->close();

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011-2012 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
@ -82,12 +82,12 @@ if ($action == 'settaxmode')
if (! $error) if (! $error)
{ {
$db->commit(); $db->commit();
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; setEventMessage($langs->trans("SetupSaved"));
} }
else else
{ {
$db->rollback(); $db->rollback();
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; setEventMessage($langs->trans("Error"),'errors');
} }
@ -208,8 +208,6 @@ else
print '</table>'; print '</table>';
} }
dol_htmloutput_mesg($mesg);
$db->close(); $db->close();
llxFooter(); llxFooter();