From 2950c8a3366ef708c08414393d0a62700a723566 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Jul 2004 15:27:37 +0000 Subject: [PATCH] =?UTF-8?q?Trad:=20Traduction=20de=20la=20page=20de=20cr?= =?UTF-8?q?=E9ation=20des=20users=20et=20permissions.=20New:=20Mise=20en?= =?UTF-8?q?=20onglet=20des=202=20pages=20creation=20user=20et=20gestion=20?= =?UTF-8?q?permission=20user=20New:=20Ajout=20de=20la=20fonction=20yn()=20?= =?UTF-8?q?pour=20remplacer=20le=20tableau=20yn[]=20car=20le=20tableau=20n?= =?UTF-8?q?e=20peut=20pas=20g=E9rer=20le=20multilangue.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/admin/perms.php | 2 +- htdocs/langs/en_US/main.lang | 5 + htdocs/langs/en_US/other.lang | 3 +- htdocs/langs/en_US/users.lang | 11 ++ htdocs/langs/fr_FR/main.lang | 7 +- htdocs/langs/fr_FR/other.lang | 3 +- htdocs/langs/fr_FR/users.lang | 11 ++ htdocs/lib/functions.inc.php | 24 +++- htdocs/user/fiche.php | 252 +++++++++++++++++++--------------- 9 files changed, 193 insertions(+), 125 deletions(-) create mode 100755 htdocs/langs/en_US/users.lang create mode 100755 htdocs/langs/fr_FR/users.lang diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index d0a00dcbe51..4368d955457 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -78,7 +78,7 @@ if ($result) print ''; print ''; - print ''.img_edit_removed().''; + print ''.img_edit_remove().''; } else { diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 4afce836ad7..c919560dd8b 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -1,7 +1,9 @@ # Dolibarr language file - en_US - main charset="iso-8859-1" yes=yes +Yes=Yes no=no +No=No Home=Home Help=Help Activate=Activate @@ -31,6 +33,7 @@ Parameters=Parameters Value=Value Type=Type Note=Note +Description=Description Action=Action About=About WelcomeString=We are %s, and you are connected with name %s @@ -59,3 +62,5 @@ Total=Total TotalHT=Total HT TotalTTC=Total TTC Delta=Delta +Module=Module +Option=Option \ No newline at end of file diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 45a21923f46..5dc14d717f3 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -1,2 +1,3 @@ # Dolibarr language file - en_US - other -Calendar=Calendar \ No newline at end of file +Calendar=Calendar +LoginWebcal=Login for Webcalendar \ No newline at end of file diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang new file mode 100755 index 00000000000..f873d431942 --- /dev/null +++ b/htdocs/langs/en_US/users.lang @@ -0,0 +1,11 @@ +# Dolibarr language file - en_US - users +UserCard=User card +Permission=Permission +Permissions=Permissions +SendNewPassword=Send new password +AvailableRights=Available permissions +OwnedRights=Owned permissions +DisableUser=Disable user +NewUser=New user +CreateUser=Create user +LoginAlreadyExists=This login already exists \ No newline at end of file diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 313be4466ea..f469ebfa225 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -1,7 +1,9 @@ # Dolibarr language file - fr_FR - main charset="iso-8859-1" yes=oui +Yes=Oui no=non +No=Non Home=Accueil Help=Aide Activate=Activer @@ -31,6 +33,7 @@ Parameters=Param Value=Valeur Type=Type Note=Note +Description=Description Action=Action About=A propos WelcomeString=Nous sommes le %s, et vous êtes connectés sous le user %s @@ -58,4 +61,6 @@ Amount=Amount Total=Total TotalHT=Total HT TotalTTC=Total TTC -Delta=Ecart \ No newline at end of file +Delta=Ecart +Module=Module +Option=Option \ No newline at end of file diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index 1dcfb4aaab7..d6e13f246dd 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -1,2 +1,3 @@ # Dolibarr language file - fr_FR - other -Calendar=Calendrier \ No newline at end of file +Calendar=Calendrier +LoginWebcal=Login Webcalendar \ No newline at end of file diff --git a/htdocs/langs/fr_FR/users.lang b/htdocs/langs/fr_FR/users.lang new file mode 100755 index 00000000000..ca2dbbe3b6c --- /dev/null +++ b/htdocs/langs/fr_FR/users.lang @@ -0,0 +1,11 @@ +# Dolibarr language file - fr_FR - users +UserCard=Fiche utilisateur +Permission=Droit +Permissions=Droits +SendNewPassword=Envoyer nouveau mot de passe +AvailableRights=Permissions disponibles +OwnedRights=Permissions détendues +DisableUser=Désactiver utilisateur +NewUser=Nouvel utilisateur +CreateUser=Créer l'utilisateur +LoginAlreadyExists=Ce login existe déjà \ No newline at end of file diff --git a/htdocs/lib/functions.inc.php b/htdocs/lib/functions.inc.php index f8d3bd81ee7..4e620a0143d 100644 --- a/htdocs/lib/functions.inc.php +++ b/htdocs/lib/functions.inc.php @@ -33,8 +33,6 @@ Ensemble de fonctions de base de dolibarr sous forme d'include */ -$yn[0] = "non"; -$yn[1] = "oui"; /*! \brief envoi des messages dolibarr dans syslog @@ -297,7 +295,7 @@ function img_edit_add($alt = "default") /*! \brief Affiche logo - */ -function img_edit_removed($alt = "default") +function img_edit_remove($alt = "default") { if ($alt="default") { global $langs; @@ -527,7 +525,8 @@ function accessforbidden() function dolibarr_print_error($db='',$msg='') { - print "Dolibarr a détectée une erreur technique.
\n"; + global $langs; + print "Dolibarr a détecté une erreur technique.
\n"; print "Voici les informations qui pourront aider au diagnostique:

\n"; print "Serveur:".$_SERVER["SERVER_SOFTWARE"]."
\n";; @@ -1236,12 +1235,25 @@ function tva($euros, $taux=19.6) \param euros somme en euro \param taux taux de tva */ - function inctva($euros, $taux=1.196) { return sprintf("%01.2f",($euros * $taux)); } +/*! + \brief Renvoie oui ou non dans la langue choisie + \param yesno variable pour test si oui ou non + \param case Oui/Non ou oui/non +*/ +function yn($yesno, $case=1) { + global $langs; + if ($yesno == 0 || $yesno == 'no' || $yesno == 'false') + return $case?$langs->trans("No"):$langs->trans("no"); + if ($yesno == 1 || $yesno == 'yes' || $yesno == 'true') + return $case?$langs->trans("Yes"):$langs->trans("yes"); + return "unknown"; +} + /*! \brief fonction qui affiche des statistiques \param basename @@ -1250,8 +1262,6 @@ function inctva($euros, $taux=1.196) \param ftc \param jour */ - - function stat_print($basename,$bc1,$bc2,$ftc, $jour) { $db = pg_Connect("","","","","$basename"); diff --git a/htdocs/user/fiche.php b/htdocs/user/fiche.php index 33a44147665..c088dfcb64e 100644 --- a/htdocs/user/fiche.php +++ b/htdocs/user/fiche.php @@ -23,6 +23,9 @@ require("./pre.inc.php"); +$langs->load("users"); + + $form = new Form($db); $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"]; @@ -64,13 +67,19 @@ if ($_POST["action"] == 'add' && $user->admin) $id = $edituser->create(); - if (isset($_POST['password']) && $_POST['password']!='' ) - { - $edituser->password($_POST['password'],$conf->password_encrypted); + if ($id) { + if (isset($_POST['password']) && $_POST['password']!='' ) + { + $edituser->password($_POST['password'],$conf->password_encrypted); + } + + Header("Location: fiche.php?id=$id"); + } + else { + //dolibarr_print_error($db,$edituser->error()); + $message=$langs->trans("LoginAlreadyExists"); + $action="create"; // Go back to create page } - - Header("Location: fiche.php?id=$id"); - } if ($_POST["action"] == 'update' && $user->admin) @@ -120,26 +129,28 @@ llxHeader(); if ($action == 'create') { - print_titre('Nouvel utilisateur'); + print_titre($langs->trans("NewUser")); + + if ($message) { print $message."
"; } print '
'; print ''; print ''; - print ''; + print ''; print ''; - print "".''; + print "".''; print ''; - print "".''; + print "".''; print ''; - print "".''; + print "".''; print ''; - print "".''; + print "".''; print ''; print "".''; @@ -147,20 +158,23 @@ if ($action == 'create') $form->selectyesnonum('admin',0); print "\n"; - if (defined("MAIN_MODULE_WEBCALENDAR")) - { - print "".''; - print ''; - } - - print "".'".'\n"; - print "".''; + // Autres caractéristiques issus des autres modules + if ($conf->webcal->enabled) + { + print "".''; + print ''; + } + + print "".''; print ""; print "
Prénom
'.$langs->trans("FirstName").'
Nom
'.$langs->trans("LastName").'
Login
'.$langs->trans("Login").'
Password
'.$langs->trans("Password").'
Email
'.$langs->trans("EMail").'
Admin
Login Webcal
Note'; + print "
'.$langs->trans("Note").''; print "
'.$langs->trans("LoginWebcal").'
\n"; } + + /* ************************************************************************** */ /* */ /* Visu et edition */ @@ -173,38 +187,56 @@ else $fuser = new User($db, $_GET["id"]); $fuser->fetch(); + /* + * Affichage onglets + */ + + $h = 0; + + $head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?id='.$fuser->id; + $head[$h][1] = $langs->trans("UserCard"); + if ($_GET["action"] != 'perms') { $hselected=$h; } + $h++; + + if ($user->admin) + { + $head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?action=perms&id='.$fuser->id; + $head[$h][1] = $langs->trans("Permissions"); + if ($_GET["action"] == 'perms') { $hselected=$h; } + $h++; + } + + + dolibarr_fiche_head($head, $hselected, $fuser->nom." ".$fuser->prenom); + + /* * Confirmation suppression */ if ($action == 'delete') { - print_fiche_titre("Suppression fiche utilisateur",$message); - print '
'; - $html = new Form($db); $html->form_confirm("fiche.php?id=$fuser->id","Désactiver cet utilisateur","Etes-vous sûr de vouloir désactiver cet utilisateur ?","confirm_delete"); } + + if ($_GET["action"] == 'perms') { - print_fiche_titre("Permissions utilisateur",$message); - print '
'; + if ($message) { print "$message
"; } /* * Ecran ajout/suppression permission */ - print ''; + print '
'; - print ''; - print ''; - print ''; - print ''; // Droits existant print "".''; - print "".'
Nom'.$fuser->nom.'Prénom'.$fuser->prenom.'
'; print ''; - $sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r ORDER BY r.id ASC"; + print ''; + $sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r ORDER BY r.module, r.id ASC"; if ($db->query($sql)) { @@ -219,8 +251,10 @@ else $oldmod = $obj->module; $var = !$var; } - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; $i++; } @@ -231,8 +265,9 @@ else // Droits possédés print '
'.$langs->trans("AvailableRights").''.$langs->trans("Module").' 
'.$langs->trans("Add").''.$obj->libelle . ''.$obj->module . '
'.$obj->libelle . ''.$obj->module . ''.img_edit_add().'
'; + print ''; $sql = "SELECT r.id, r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r, ".MAIN_DB_PREFIX."user_rights as ur"; - $sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.id ASC"; + $sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.module, r.id ASC"; $var = True; if ($db->query($sql)) { @@ -247,55 +282,47 @@ else $var = !$var; } - print "'; - print ''; + print ""; + print ''; + print "'; + print ''; $i++; } } print '
 '.$langs->trans("OwnedRights").''.$langs->trans("Module").'
".$obj->libelle . ''.$obj->module . ''.img_delete().'
'.img_edit_remove().'".$obj->libelle . ''.$obj->module . '
'; print '
ok
'; } if ($_GET["action"] != 'perms' && $_GET["action"] != 'edit') { - /* - * Affichage onglet + * Fiche en mode visu */ - $h = 0; - - $head[$h][0] = DOL_URL_ROOT.'/user/fiche.php?id='.$fuser->id; - $head[$h][1] = "Fiche utilisateur"; - $h++; - - dolibarr_fiche_head($head, $hselected); - print ''; - print "".''; + print "".''; print ''; - print ''; + print ''; print ''; print "\n"; - print "".''; - print ''; - print ''; + print "".''; + print ''; + print ''; print ''; print "\n"; print "".''; - print ''; + print ''; print "\n"; if ($fuser->societe_id > 0) { $societe = new Societe($db); $societe->fetch($fuser->societe_id); - print "".''; + print "".''; print ''; print "\n"; } @@ -313,12 +340,12 @@ else print ''; print "\n"; - print "".''; + print "".''; print ''; print "\n"; // Autres caractéristiques issus des autres modules - if (defined("MAIN_MODULE_WEBCALENDAR")) + if ($conf->webcal->enabled) { print "".''; print ''; @@ -330,13 +357,39 @@ else print "\n"; + + /* + * Barre d'actions + * + */ + print '
'; + + if ($user->admin) + { + print ''.$langs->trans("Edit").''; + } + + if ($user->id == $id or $user->admin) + { + print ''.$langs->trans("SendNewPassword").''; + } + + if ($user->admin && $user->id <> $id) + { + print ''.$langs->trans("DisableUser").''; + } + + print "
\n"; + print "
\n"; + + /* * Droits */ print '
Nom
'.$langs->trans("LastName").''.$fuser->nom.'Prénom'.$langs->trans("FirstName").''.$fuser->prenom.'
Login'.$fuser->login.'Email
'.$langs->trans("Login").''.$fuser->login.''.$langs->trans("EMail").''.$fuser->email.'
Administrateur'.$yn[$fuser->admin].''.yn($fuser->admin).'
Société
'.$langs->trans("Company").''.$societe->nom.' 
Note
'.$langs->trans("Note").''.nl2br($fuser->note).' 
Webcal Login'.$fuser->webcal_login.' 
'; - print ''; + print ''; $sql = "SELECT r.libelle, r.module FROM ".MAIN_DB_PREFIX."rights_def as r, ".MAIN_DB_PREFIX."user_rights as ur"; - $sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.id ASC"; + $sql .= " WHERE ur.fk_id = r.id AND ur.fk_user = ".$fuser->id. " ORDER BY r.module, r.id ASC"; $var = True; if ($db->query($sql)) { @@ -358,35 +411,6 @@ else print "
DroitsModule
'.$langs->trans("Permissions").''.$langs->trans("Module").'
\n"; print "
\n"; - /* - * Barre d'actions - * - */ - print '
'; - - if ($user->admin) - { - print ''.$langs->trans("Edit").''; - } - - if ($user->id == $id or $user->admin) - { - print 'Envoyer nouveau mot de passe'; - } - - if ($user->admin) - { - print 'Permissions'; - } - - if ($user->admin && $user->id <> $id) - { - print 'Désactiver utilisateur'; - } - - print "
\n"; - print "
\n"; - } /* ************************************************************************** */ @@ -396,49 +420,49 @@ else /* ************************************************************************** */ if ($_GET["action"] == 'edit' && $user->admin) { - print_fiche_titre("Edition fiche utilisateur",$message); - print '
'; - print '
'; print ''; - print ''; + print '
'; - print "".''; + print "".''; print ''; - print "".''; + print "".''; print ''; - print "".''; + print "".''; print ''; - print "".''; + print "".''; print ''; - print "".''; - if ($fuser->societe_id > 0) - { - print ''; - } - else - { - print ''; - } - print "".''; - print ''; + print "".''; + if ($fuser->societe_id > 0) + { + print ''; + } + else + { + print ''; + } - print "".'"; - print "".''; - print ''; + // Autres caractéristiques issus des autres modules + print "".''; + print ''; + + print "".''; + print '
Nom
'.$langs->trans("LastName").'
Prénom
'.$langs->trans("FirstName").'
Login
'.$langs->trans("Login").'
Email
'.$langs->trans("EMail").'
Admin ?'; - print 'non'; - print '
'; - $form->selectyesnonum('admin',$fuser->admin); - print '
Login Webcal
'.$langs->trans("Admin").''; + print ''.$langs->trans("No"); + print '
'; + $form->selectyesnonum('admin',$fuser->admin); + print '
Note'; - print "
'.$langs->trans("LoginWebcal").'
'; + print ''; } }