Minor esthetical change and fix
This commit is contained in:
parent
871a987e7a
commit
4220aa58eb
@ -47,14 +47,14 @@ $action=isset($_GET["action"])?$_GET["action"]:$_POST["action"];
|
||||
*/
|
||||
if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
|
||||
{
|
||||
if($caneditperms){
|
||||
$editgroup = new Usergroup($db, $_GET["id"]);
|
||||
$editgroup->fetch($_GET["id"]);
|
||||
$editgroup->delete();
|
||||
Header("Location: index.php");
|
||||
}else{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||
}
|
||||
if($caneditperms){
|
||||
$editgroup = new Usergroup($db, $_GET["id"]);
|
||||
$editgroup->fetch($_GET["id"]);
|
||||
$editgroup->delete();
|
||||
Header("Location: index.php");
|
||||
}else{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -62,97 +62,97 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == "yes")
|
||||
*/
|
||||
if ($_POST["action"] == 'add')
|
||||
{
|
||||
if($caneditperms){
|
||||
$message="";
|
||||
if (! $_POST["nom"]) {
|
||||
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
|
||||
$action="create"; // Go back to create page
|
||||
}
|
||||
if($caneditperms){
|
||||
$message="";
|
||||
if (! $_POST["nom"]) {
|
||||
$message='<div class="error">'.$langs->trans("NameNotDefined").'</div>';
|
||||
$action="create"; // Go back to create page
|
||||
}
|
||||
|
||||
if (! $message) {
|
||||
$editgroup = new UserGroup($db,0);
|
||||
if (! $message) {
|
||||
$editgroup = new UserGroup($db,0);
|
||||
|
||||
$editgroup->nom = trim($_POST["nom"]);
|
||||
$editgroup->note = trim($_POST["note"]);
|
||||
$editgroup->nom = trim($_POST["nom"]);
|
||||
$editgroup->note = trim($_POST["note"]);
|
||||
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$id = $editgroup->create();
|
||||
$id = $editgroup->create();
|
||||
|
||||
if ($id > 0)
|
||||
{
|
||||
$db->commit();
|
||||
if ($id > 0)
|
||||
{
|
||||
$db->commit();
|
||||
|
||||
Header("Location: fiche.php?id=".$editgroup->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$db->rollback();
|
||||
$message='<div class="error">'.$langs->trans("ErrorGroupAlreadyExists",$editgroup->nom).'</div>';
|
||||
$action="create"; // Go back to create page
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||
}
|
||||
Header("Location: fiche.php?id=".$editgroup->id);
|
||||
}
|
||||
else
|
||||
{
|
||||
$langs->load("errors");
|
||||
$db->rollback();
|
||||
$message='<div class="error">'.$langs->trans("ErrorGroupAlreadyExists",$editgroup->nom).'</div>';
|
||||
$action="create"; // Go back to create page
|
||||
}
|
||||
}
|
||||
}else{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'adduser')
|
||||
{
|
||||
if($caneditperms){
|
||||
if ($_POST["user"])
|
||||
{
|
||||
$edituser = new User($db, $_POST["user"]);
|
||||
$edituser->SetInGroup($_GET["id"]);
|
||||
if($caneditperms){
|
||||
if ($_POST["user"])
|
||||
{
|
||||
$edituser = new User($db, $_POST["user"]);
|
||||
$edituser->SetInGroup($_GET["id"]);
|
||||
|
||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||
}
|
||||
}else{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||
}
|
||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||
}
|
||||
}else{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_GET["action"] == 'removeuser')
|
||||
{
|
||||
if($caneditperms){
|
||||
if ($_GET["user"])
|
||||
{
|
||||
$edituser = new User($db, $_GET["user"]);
|
||||
$edituser->RemoveFromGroup($_GET["id"]);
|
||||
if($caneditperms){
|
||||
if ($_GET["user"])
|
||||
{
|
||||
$edituser = new User($db, $_GET["user"]);
|
||||
$edituser->RemoveFromGroup($_GET["id"]);
|
||||
|
||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||
}
|
||||
}else{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||
}
|
||||
Header("Location: fiche.php?id=".$_GET["id"]);
|
||||
}
|
||||
}else{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($_POST["action"] == 'update')
|
||||
{
|
||||
if($caneditperms){
|
||||
$message="";
|
||||
if($caneditperms){
|
||||
$message="";
|
||||
|
||||
$db->begin();
|
||||
$db->begin();
|
||||
|
||||
$editgroup = new Usergroup($db, $_GET["id"]);
|
||||
$editgroup->fetch($_GET["id"]);
|
||||
$editgroup = new Usergroup($db, $_GET["id"]);
|
||||
$editgroup->fetch($_GET["id"]);
|
||||
|
||||
$editgroup->nom = $_POST["group"];
|
||||
$editgroup->note = $_POST["note"];
|
||||
$editgroup->nom = $_POST["group"];
|
||||
$editgroup->note = $_POST["note"];
|
||||
|
||||
$ret=$editgroup->update();
|
||||
$ret=$editgroup->update();
|
||||
|
||||
if ($ret >= 0) {
|
||||
$message.='<div class="ok">'.$langs->trans("GroupModified").'</div>';
|
||||
$db->commit();
|
||||
} else {
|
||||
$message.='<div class="error">'.$editgroup->error.'</div>';
|
||||
$db->rollback;
|
||||
}
|
||||
}else{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||
}
|
||||
if ($ret >= 0) {
|
||||
$message.='<div class="ok">'.$langs->trans("GroupModified").'</div>';
|
||||
$db->commit();
|
||||
} else {
|
||||
$message.='<div class="error">'.$editgroup->error.'</div>';
|
||||
$db->rollback;
|
||||
}
|
||||
}else{
|
||||
$message = '<div class="error">'.$langs->trans('ErrorForbidden').'</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -169,20 +169,20 @@ $html = new Form($db);
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print_fiche_titre($langs->trans("NewGroup"));
|
||||
print "<br>";
|
||||
print_fiche_titre($langs->trans("NewGroup"));
|
||||
print "<br>";
|
||||
|
||||
if ($message) { print $message."<br>"; }
|
||||
if ($message) { print $message."<br>"; }
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr>".'<td valign="top">'.$langs->trans("Name").'</td>';
|
||||
print '<td class="valeur"><input size="30" type="text" name="nom" value=""></td></tr>';
|
||||
print "<tr>".'<td valign="top">'.$langs->trans("Name").'</td>';
|
||||
print '<td class="valeur"><input size="30" type="text" name="nom" value=""></td></tr>';
|
||||
|
||||
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
|
||||
print "<tr>".'<td valign="top">'.$langs->trans("Note").'</td><td>';
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
@ -194,11 +194,11 @@ if ($action == 'create')
|
||||
print '<textarea class="flat" name="note" rows="'.ROWS_8.'" cols="90">';
|
||||
print '</textarea>';
|
||||
}
|
||||
print "</textarea></td></tr>\n";
|
||||
print "</textarea></td></tr>\n";
|
||||
|
||||
print "<tr>".'<td align="center" colspan="2"><input class="button" value="'.$langs->trans("CreateGroup").'" type="submit"></td></tr>';
|
||||
print "</table>\n";
|
||||
print "</form>";
|
||||
print "<tr>".'<td align="center" colspan="2"><input class="button" value="'.$langs->trans("CreateGroup").'" type="submit"></td></tr>';
|
||||
print "</table>\n";
|
||||
print "</form>";
|
||||
}
|
||||
|
||||
|
||||
@ -210,225 +210,225 @@ if ($action == 'create')
|
||||
else
|
||||
{
|
||||
if ($_GET["id"] )
|
||||
{
|
||||
$group = new UserGroup($db);
|
||||
$group->fetch($_GET["id"]);
|
||||
{
|
||||
$group = new UserGroup($db);
|
||||
$group->fetch($_GET["id"]);
|
||||
|
||||
/*
|
||||
* Affichage onglets
|
||||
*/
|
||||
$head = group_prepare_head($group);
|
||||
$title = $langs->trans("Group");
|
||||
if (!$group->entity) $title = $langs->trans("GlobalGroup");
|
||||
if (! $group->entity) $title = $langs->trans("GlobalGroup");
|
||||
|
||||
dol_fiche_head($head, 'group', $title.": ".$group->nom);
|
||||
dol_fiche_head($head, 'group', $title);
|
||||
|
||||
|
||||
/*
|
||||
* Confirmation suppression
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$html = new Form($db);
|
||||
$html->form_confirm("fiche.php?id=$group->id",$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$group->name),"confirm_delete");
|
||||
}
|
||||
/*
|
||||
* Confirmation suppression
|
||||
*/
|
||||
if ($action == 'delete')
|
||||
{
|
||||
$html = new Form($db);
|
||||
$html->form_confirm("fiche.php?id=$group->id",$langs->trans("DeleteAGroup"),$langs->trans("ConfirmDeleteGroup",$group->name),"confirm_delete");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Fiche en mode visu
|
||||
*/
|
||||
/*
|
||||
* Fiche en mode visu
|
||||
*/
|
||||
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
if ($action != 'edit')
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $html->showrefnav($group,'id','',$user->rights->user->user->lire || $user->admin);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Nom
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
|
||||
print '<td width="75%" class="valeur">'.$group->nom;
|
||||
if (!$group->entity)
|
||||
{
|
||||
print img_redstar($langs->trans("GlobalGroup"));
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
// Ref
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $html->showrefnav($group,'id','',$user->rights->user->user->lire || $user->admin);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Note
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
||||
print '<td class="valeur">'.nl2br($group->note).' </td>';
|
||||
print "</tr>\n";
|
||||
print "</table>\n";
|
||||
// Name
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
|
||||
print '<td width="75%" class="valeur">'.$group->nom;
|
||||
if (!$group->entity)
|
||||
{
|
||||
print img_redstar($langs->trans("GlobalGroup"));
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</div>';
|
||||
// Note
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
||||
print '<td class="valeur">'.nl2br($group->note).' </td>';
|
||||
print "</tr>\n";
|
||||
print "</table>\n";
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
print '</div>';
|
||||
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$group->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($candisableperms)
|
||||
{
|
||||
print '<a class="butActionDelete" href="fiche.php?action=delete&id='.$group->id.'">'.$langs->trans("DeleteGroup").'</a>';
|
||||
}
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$group->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
print "<br>\n";
|
||||
if ($candisableperms)
|
||||
{
|
||||
print '<a class="butActionDelete" href="fiche.php?action=delete&id='.$group->id.'">'.$langs->trans("DeleteGroup").'</a>';
|
||||
}
|
||||
|
||||
print "</div>\n";
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
if ($message) { print $message."<br>"; }
|
||||
|
||||
|
||||
/*
|
||||
* Liste des utilisateurs dans le groupe
|
||||
*/
|
||||
/*
|
||||
* Liste des utilisateurs dans le groupe
|
||||
*/
|
||||
|
||||
print_fiche_titre($langs->trans("ListOfUsersInGroup"),'','');
|
||||
print_fiche_titre($langs->trans("ListOfUsersInGroup"),'','');
|
||||
|
||||
// On sélectionne les users qui ne sont pas déjà dans le groupe
|
||||
$uss = array();
|
||||
// On sélectionne les users qui ne sont pas déjà dans le groupe
|
||||
$uss = array();
|
||||
|
||||
$sql = "SELECT u.rowid, u.login, u.name, u.firstname, u.admin";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
$sql.= " ORDER BY u.name";
|
||||
$sql = "SELECT u.rowid, u.login, u.name, u.firstname, u.admin";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE u.entity IN (0,".$conf->entity.")";
|
||||
$sql.= " ORDER BY u.name";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
$uss[$obj->rowid] = ucfirst(stripslashes($obj->name)).' '.ucfirst(stripslashes($obj->firstname));
|
||||
if ($obj->login) $uss[$obj->rowid].=' ('.$obj->login.')';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
$uss[$obj->rowid] = ucfirst(stripslashes($obj->name)).' '.ucfirst(stripslashes($obj->firstname));
|
||||
if ($obj->login) $uss[$obj->rowid].=' ('.$obj->login.')';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
if ($caneditperms)
|
||||
{
|
||||
$form = new Form($db);
|
||||
print '<form action="fiche.php?id='.$group->id.'" method="post">'."\n";
|
||||
print '<input type="hidden" name="action" value="adduser">';
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
// print '<tr class="liste_titre"><td width="25%">'.$langs->trans("NonAffectedUsers").'</td>'."\n";
|
||||
print '<tr class="liste_titre"><td class="liste_titre" width="25%">'.$langs->trans("UsersToAdd").'</td>'."\n";
|
||||
print '<td>';
|
||||
print $form->select_array("user",$uss,'',1);
|
||||
print ' ';
|
||||
print '<input type="submit" class=button value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>'."\n";
|
||||
print '</table></form>'."\n";
|
||||
print '<br>';
|
||||
}
|
||||
if ($caneditperms)
|
||||
{
|
||||
$form = new Form($db);
|
||||
print '<form action="fiche.php?id='.$group->id.'" method="post">'."\n";
|
||||
print '<input type="hidden" name="action" value="adduser">';
|
||||
print '<table class="noborder" width="100%">'."\n";
|
||||
// print '<tr class="liste_titre"><td width="25%">'.$langs->trans("NonAffectedUsers").'</td>'."\n";
|
||||
print '<tr class="liste_titre"><td class="liste_titre" width="25%">'.$langs->trans("UsersToAdd").'</td>'."\n";
|
||||
print '<td>';
|
||||
print $form->select_array("user",$uss,'',1);
|
||||
print ' ';
|
||||
print '<input type="submit" class=button value="'.$langs->trans("Add").'">';
|
||||
print '</td></tr>'."\n";
|
||||
print '</table></form>'."\n";
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
/*
|
||||
* Membres du groupe
|
||||
*/
|
||||
$sql = "SELECT u.rowid, u.login, u.name, u.firstname, u.admin, u.entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql.= " WHERE ug.fk_user = u.rowid";
|
||||
$sql.= " AND ug.fk_usergroup = ".$group->id;
|
||||
$sql.= " ORDER BY u.name";
|
||||
/*
|
||||
* Membres du groupe
|
||||
*/
|
||||
$sql = "SELECT u.rowid, u.login, u.name, u.firstname, u.admin, u.entity";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."user as u,";
|
||||
$sql.= " ".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql.= " WHERE ug.fk_user = u.rowid";
|
||||
$sql.= " AND ug.fk_usergroup = ".$group->id;
|
||||
$sql.= " ORDER BY u.name";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Login").'</td>';
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Lastname").'</td>';
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Firstname").'</td>';
|
||||
print '<td> </td>';
|
||||
print "<td> </td></tr>\n";
|
||||
if ($num) {
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Login").'</td>';
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Lastname").'</td>';
|
||||
print '<td class="liste_titre" width="25%">'.$langs->trans("Firstname").'</td>';
|
||||
print '<td> </td>';
|
||||
print "<td> </td></tr>\n";
|
||||
if ($num) {
|
||||
$var=True;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.'</a>';
|
||||
if ($obj->admin && !$obj->entity)
|
||||
{
|
||||
print img_redstar($langs->trans("SuperAdministrator"));
|
||||
}
|
||||
else if ($obj->admin)
|
||||
{
|
||||
print img_picto($langs->trans("Administrator"),'star');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.ucfirst(stripslashes($obj->name)).'</td>';
|
||||
print '<td>'.ucfirst(stripslashes($obj->firstname)).'</td>';
|
||||
print '<td> </td><td>';
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/user/fiche.php?id='.$obj->rowid.'">'.img_object($langs->trans("ShowUser"),"user").' '.$obj->login.'</a>';
|
||||
if ($obj->admin && !$obj->entity)
|
||||
{
|
||||
print img_redstar($langs->trans("SuperAdministrator"));
|
||||
}
|
||||
else if ($obj->admin)
|
||||
{
|
||||
print img_picto($langs->trans("Administrator"),'star');
|
||||
}
|
||||
print '</td>';
|
||||
print '<td>'.ucfirst(stripslashes($obj->name)).'</td>';
|
||||
print '<td>'.ucfirst(stripslashes($obj->firstname)).'</td>';
|
||||
print '<td> </td><td>';
|
||||
|
||||
if ($user->admin)
|
||||
{
|
||||
if ($user->admin)
|
||||
{
|
||||
|
||||
print '<a href="fiche.php?id='.$group->id.'&action=removeuser&user='.$obj->rowid.'">';
|
||||
print img_delete($langs->trans("RemoveFromGroup"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print "-";
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan=2>'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
print "<br>";
|
||||
$db->free($result);
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
print '<a href="fiche.php?id='.$group->id.'&action=removeuser&user='.$obj->rowid.'">';
|
||||
print img_delete($langs->trans("RemoveFromGroup"));
|
||||
}
|
||||
else
|
||||
{
|
||||
print "-";
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td colspan=2>'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print "</table>";
|
||||
print "<br>";
|
||||
$db->free($result);
|
||||
}
|
||||
else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Fiche en mode edition
|
||||
*/
|
||||
if ($_GET["action"] == 'edit' && $caneditperms)
|
||||
{
|
||||
print '<form action="fiche.php?id='.$group->id.'" method="post" name="updategroup" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
/*
|
||||
* Fiche en mode edition
|
||||
*/
|
||||
if ($_GET["action"] == 'edit' && $caneditperms)
|
||||
{
|
||||
print '<form action="fiche.php?id='.$group->id.'" method="post" name="updategroup" enctype="multipart/form-data">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
|
||||
print '<td width="75%" class="valeur"><input size="15" type="text" name="group" value="'.$group->nom.'">';
|
||||
if (!$group->entity)
|
||||
{
|
||||
print img_redstar($langs->trans("GlobalGroup"));
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
||||
print '<td class="valeur">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
|
||||
print '<td width="75%" class="valeur"><input size="15" type="text" name="group" value="'.$group->nom.'">';
|
||||
if (!$group->entity)
|
||||
{
|
||||
print img_redstar($langs->trans("GlobalGroup"));
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
||||
print '<td class="valeur">';
|
||||
if ($conf->fckeditor->enabled && $conf->global->FCKEDITOR_ENABLE_USER)
|
||||
{
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
|
||||
@ -442,15 +442,15 @@ else
|
||||
print '</textarea>';
|
||||
}
|
||||
print '</td>';
|
||||
print "</tr>\n";
|
||||
print '<tr><td align="center" colspan="2"><input class="button" value="'.$langs->trans("Save").'" type="submit"></td></tr>';
|
||||
print "</table>\n";
|
||||
print '</form>';
|
||||
print "</tr>\n";
|
||||
print '<tr><td align="center" colspan="2"><input class="button" value="'.$langs->trans("Save").'" type="submit"></td></tr>';
|
||||
print "</table>\n";
|
||||
print '</form>';
|
||||
|
||||
print '</div>';
|
||||
}
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$db->close();
|
||||
|
||||
@ -62,7 +62,7 @@ $fgroup->getrights();
|
||||
*/
|
||||
$head = group_prepare_head($fgroup);
|
||||
|
||||
dol_fiche_head($head, 'ldap', $langs->trans("Group").": ".$fgroup->nom);
|
||||
dol_fiche_head($head, 'ldap', $langs->trans("Group"));
|
||||
|
||||
|
||||
|
||||
@ -71,10 +71,21 @@ dol_fiche_head($head, 'ldap', $langs->trans("Group").": ".$fgroup->nom);
|
||||
*/
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Nom
|
||||
// Ref
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showrefnav($fgroup,'id','',$user->rights->user->group->lire || $user->admin);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Name
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
|
||||
print '<td width="75%" class="valeur">'.$fgroup->nom.'</td>';
|
||||
print "</tr>\n";
|
||||
print '<td width="75%" class="valeur">'.$fgroup->nom;
|
||||
if (!$fgroup->entity)
|
||||
{
|
||||
print img_redstar($langs->trans("GlobalGroup"));
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
|
||||
// Note
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||
*
|
||||
@ -21,19 +21,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/user/group/perms.php
|
||||
\brief Onglet user et permissions de la fiche utilisateur
|
||||
\version $Id$
|
||||
*/
|
||||
* \file htdocs/user/group/perms.php
|
||||
* \brief Onglet user et permissions de la fiche utilisateur
|
||||
* \version $Id$
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php");
|
||||
|
||||
$langs->load("users");
|
||||
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$module=isset($_GET["module"])?$_GET["module"]:$_POST["module"];
|
||||
|
||||
// Defini si peux modifier utilisateurs et permisssions
|
||||
@ -62,6 +59,8 @@ if ($_GET["action"] == 'delrights' && $caneditperms)
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
llxHeader('',$langs->trans("Permissions"));
|
||||
|
||||
if ($_GET["id"])
|
||||
@ -77,38 +76,47 @@ if ($_GET["id"])
|
||||
$title = $langs->trans("Group");
|
||||
if (!$fgroup->entity) $title = $langs->trans("GlobalGroup");
|
||||
|
||||
dol_fiche_head($head, 'rights', $title.": ".$fgroup->nom);
|
||||
dol_fiche_head($head, 'rights', $title);
|
||||
|
||||
|
||||
$db->begin();
|
||||
|
||||
// Charge les modules soumis a permissions
|
||||
$dir = DOL_DOCUMENT_ROOT . "/includes/modules/";
|
||||
$handle=opendir($dir);
|
||||
$modules = array();
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
|
||||
{
|
||||
$modName = substr($file, 0, strlen($file) - 10);
|
||||
foreach ($conf->dol_document_root as $dirroot)
|
||||
{
|
||||
$dir = $dirroot . "/includes/modules/";
|
||||
|
||||
if ($modName)
|
||||
{
|
||||
include_once("../../includes/modules/$file");
|
||||
$objMod = new $modName($db);
|
||||
if ($objMod->rights_class) {
|
||||
// Load modules attributes in arrays (name, numero, orders) from dir directory
|
||||
//print $dir."\n<br>";
|
||||
$handle=@opendir($dir);
|
||||
if ($handle)
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, strlen($file) - 10) == '.class.php')
|
||||
{
|
||||
$modName = substr($file, 0, strlen($file) - 10);
|
||||
|
||||
$ret=$objMod->insert_permissions();
|
||||
if ($modName)
|
||||
{
|
||||
include_once($dir."/".$file);
|
||||
$objMod = new $modName($db);
|
||||
if ($objMod->rights_class) {
|
||||
|
||||
$ret=$objMod->insert_permissions();
|
||||
|
||||
$modules[$objMod->rights_class]=$objMod;
|
||||
//print "modules[".$objMod->rights_class."]=$objMod;";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$modules[$objMod->rights_class]=$objMod;
|
||||
//print "modules[".$objMod->rights_class."]=$objMod;";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$db->commit();
|
||||
|
||||
|
||||
// Lecture des droits groupes
|
||||
$permsgroup = array();
|
||||
|
||||
@ -144,32 +152,32 @@ if ($_GET["id"])
|
||||
*/
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="2">';
|
||||
print $form->showrefnav($fgroup,'id','',$user->rights->user->user->lire || $user->admin);
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
|
||||
// Nom
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Name").'</td>';
|
||||
print '<td colspan="2">'.$fgroup->nom.'';
|
||||
if (!$obj->entity)
|
||||
if (! $fgroup->entity)
|
||||
{
|
||||
print img_redstar($langs->trans("GlobalGroup"));
|
||||
}
|
||||
print "</td></tr>\n";
|
||||
|
||||
|
||||
// Note
|
||||
print '<tr><td width="25%" valign="top">'.$langs->trans("Note").'</td>';
|
||||
print '<td class="valeur">'.nl2br($fgroup->note).' </td>';
|
||||
print '<td class="valeur">'.nl2br($fgroup->note).'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
|
||||
if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));
|
||||
|
||||
|
||||
print '<table width="100%" class="noborder">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Module").'</td>';
|
||||
@ -195,7 +203,7 @@ if ($_GET["id"])
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore
|
||||
if (! $modules[$obj->module])
|
||||
if (! $modules[$obj->module])
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
@ -209,12 +217,12 @@ if ($_GET["id"])
|
||||
// Rupture détectée, on récupère objMod
|
||||
$objMod = $modules[$obj->module];
|
||||
$picto=($objMod->picto?$objMod->picto:'generic');
|
||||
|
||||
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<tr '. $bc[$var].'>';
|
||||
print '<td nowrap="nowrap">'.img_object('',$picto).' '.$objMod->getName();
|
||||
print '<a name="'.$objMod->getName().'"> </a></td>';
|
||||
print '<a name="'.$objMod->getName().'"> </a></td>';
|
||||
print '<td align="center" nowrap="nowrap">';
|
||||
print '<a title='.$langs->trans("All").' alt='.$langs->trans("All").' href="perms.php?id='.$fgroup->id.'&action=addrights&module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("All")."</a>";
|
||||
print '/';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user