Look and feel v6

This commit is contained in:
Laurent Destailleur 2017-05-09 10:19:39 +02:00
parent 9fe28c9b2c
commit 63259295c6
5 changed files with 93 additions and 79 deletions

View File

@ -1716,8 +1716,6 @@ else
*/
if (! empty($groupslist))
{
$var=true;
foreach($groupslist as $group)
{
@ -2360,8 +2358,6 @@ else
$genallowed = $user->rights->user->user->creer;
$delallowed = $user->rights->user->user->supprimer;
$var = true;
$somethingshown = $formfile->show_documents('user', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
// Show links to link elements

View File

@ -37,8 +37,9 @@ class UserGroup extends CommonObject
public $element='usergroup';
public $table_element='usergroup';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto='group';
public $entity; // Entity of group
/**
* @deprecated
* @see name
@ -744,6 +745,31 @@ class UserGroup extends CommonObject
}
/**
* Return label of status of user (active, inactive)
*
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function getLibStatut($mode=0)
{
return $this->LibStatut(0,$mode);
}
/**
* Renvoi le libelle d'un statut donne
*
* @param int $statut Id statut
* @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto
* @return string Label of status
*/
function LibStatut($statut,$mode=0)
{
global $langs;
$langs->load('users');
return '';
}
/**
* Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
*

View File

@ -314,19 +314,17 @@ else
if ($action != 'edit')
{
dol_fiche_head($head, 'group', $title, 0, 'group');
dol_fiche_head($head, 'group', $title, -1, 'group');
print '<table class="border" width="100%">';
// Ref
print '<tr><td class="titlefield">'.$langs->trans("Ref").'</td>';
print '<td>';
print $form->showrefnav($object,'id','',$user->rights->user->user->lire || $user->admin);
print '</td>';
print '</tr>';
dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Name
print '<tr><td>'.$langs->trans("Name").'</td>';
print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
print '<td class="valeur">'.$object->name;
if (empty($object->entity))
{
@ -357,7 +355,8 @@ else
}
print "</table>\n";
print '</div>';
dol_fiche_end();
@ -377,11 +376,8 @@ else
}
print "</div>\n";
print "<br>\n";
/*
* Liste des utilisateurs dans le groupe
*/
// List users in group
print load_fiche_titre($langs->trans("ListOfUsersInGroup"),'','');
@ -450,8 +446,6 @@ else
if (! empty($object->members))
{
$var=True;
foreach($object->members as $useringroup)
{
@ -513,17 +507,11 @@ else
$genallowed = $user->rights->user->user->creer;
$delallowed = $user->rights->user->user->supprimer;
$var = true;
$somethingshown = $formfile->show_documents('usergroup', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang);
// Linked object block
$somethingshown = $form->showLinkedObjectBlock($object);
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object);
if ($linktoelem) print '<br>'.$linktoelem;
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, null);
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';

View File

@ -45,9 +45,9 @@ $action = GETPOST('action', 'alpha');
$socid=0;
if ($user->societe_id > 0) $socid = $user->societe_id;
$fgroup = new Usergroup($db);
$fgroup->fetch($id);
$fgroup->getrights();
$object = new Usergroup($db);
$object->fetch($id);
$object->getrights();
/*
@ -61,12 +61,12 @@ if ($action == 'dolibarr2ldap')
$ldap=new Ldap();
$result=$ldap->connect_bind();
$info=$fgroup->_load_ldap_info();
$info=$object->_load_ldap_info();
// Get a gid number for objectclass PosixGroup
if(in_array('posixGroup',$info['objectclass']))
$info['gidNumber'] = $ldap->getNextGroupGid();
$dn=$fgroup->_load_ldap_dn($info);
$dn=$object->_load_ldap_dn($info);
$olddn=$dn; // We can say that old dn = dn as we force synchro
$result=$ldap->update($dn,$info,$user,$olddn);
@ -93,23 +93,21 @@ llxHeader();
$form = new Form($db);
$head = group_prepare_head($fgroup);
$head = group_prepare_head($object);
dol_fiche_head($head, 'ldap', $langs->trans("Group"), 0, 'group');
dol_fiche_head($head, 'ldap', $langs->trans("Group"), -1, 'group');
dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="25%">'.$langs->trans("Ref").'</td>';
print '<td colspan="2">';
print $form->showrefnav($fgroup,'id','',$canreadperms);
print '</td>';
print '</tr>';
// Name
print '<tr><td width="25%">'.$langs->trans("Name").'</td>';
print '<td width="75%" class="valeur">'.$fgroup->name;
if (!$fgroup->entity)
print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
print '<td class="valeur">'.$object->name;
if (!$object->entity)
{
print img_picto($langs->trans("GlobalGroup"),'redstar');
}
@ -117,7 +115,7 @@ print "</td></tr>\n";
// Note
print '<tr><td width="25%" class="tdtop">'.$langs->trans("Note").'</td>';
print '<td class="valeur">'.nl2br($fgroup->note).'&nbsp;</td>';
print '<td class="valeur">'.nl2br($object->note).'&nbsp;</td>';
print "</tr>\n";
$langs->load("admin");
@ -137,6 +135,9 @@ print "</table>\n";
print '</div>';
dol_fiche_end();
/*
* Barre d'actions
*/
@ -145,7 +146,7 @@ print '<div class="tabsAction">';
if ($conf->global->LDAP_SYNCHRO_ACTIVE == 'dolibarr2ldap')
{
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$fgroup->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?id='.$object->id.'&amp;action=dolibarr2ldap">'.$langs->trans("ForceSynchronize").'</a>';
}
print "</div>\n";
@ -169,9 +170,9 @@ $ldap=new Ldap();
$result=$ldap->connect_bind();
if ($result > 0)
{
$info=$fgroup->_load_ldap_info();
$dn=$fgroup->_load_ldap_dn($info,1);
$search = "(".$fgroup->_load_ldap_dn($info,2).")";
$info=$object->_load_ldap_info();
$dn=$object->_load_ldap_dn($info,1);
$search = "(".$object->_load_ldap_dn($info,2).")";
$records = $ldap->getAttribute($dn,$search);
//var_dump($records);

View File

@ -82,16 +82,16 @@ llxHeader('',$langs->trans("Permissions"));
if ($id)
{
$fgroup = new Usergroup($db);
$fgroup->fetch($id);
$fgroup->getrights();
$object = new Usergroup($db);
$object->fetch($id);
$object->getrights();
/*
* Affichage onglets
*/
$head = group_prepare_head($fgroup);
$head = group_prepare_head($object);
$title = $langs->trans("Group");
dol_fiche_head($head, 'rights', $title, 0, 'group');
dol_fiche_head($head, 'rights', $title, -1, 'group');
// Charge les modules soumis a permissions
$modules = array();
@ -127,7 +127,7 @@ if ($id)
// Load all permissions
if ($objMod->rights_class)
{
$entity=((! empty($conf->multicompany->enabled) && ! empty($fgroup->entity)) ? $fgroup->entity : null);
$entity=((! empty($conf->multicompany->enabled) && ! empty($object->entity)) ? $object->entity : null);
$ret=$objMod->insert_permissions(0, $entity);
$modules[$objMod->rights_class]=$objMod;
}
@ -150,7 +150,7 @@ if ($id)
{
if (empty($conf->multicompany->transverse_mode))
{
$sql.= " AND r.entity = ".$fgroup->entity;
$sql.= " AND r.entity = ".$object->entity;
}
else
{
@ -162,7 +162,7 @@ if ($id)
$sql.= " AND r.entity IN (0,".$conf->entity.")";
}
$sql.= " AND ugr.fk_usergroup = ".$fgroup->id;
$sql.= " AND ugr.fk_usergroup = ".$object->id;
$result=$db->query($sql);
@ -183,32 +183,31 @@ if ($id)
dol_print_error($db);
}
dol_banner_tab($object,'id','',$user->rights->user->user->lire || $user->admin);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';
/*
* Ecran ajout/suppression permission
*/
print '<table class="border" width="100%">';
// Ref
print '<tr><td width="25%">'.$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%">'.$langs->trans("Name").'</td>';
print '<td colspan="2">'.$fgroup->name.'';
if (! $fgroup->entity)
print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
print '<td colspan="2">'.$object->name.'';
if (! $object->entity)
{
print img_picto($langs->trans("GlobalGroup"),'redstar');
}
print "</td></tr>\n";
// Note
print '<tr><td width="25%" class="tdtop">'.$langs->trans("Note").'</td>';
print '<td class="valeur">'.dol_htmlentitiesbr($fgroup->note).'</td>';
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td class="valeur">'.dol_htmlentitiesbr($object->note).'</td>';
print "</tr>\n";
print '</table><br>';
@ -230,7 +229,7 @@ if ($id)
{
if (empty($conf->multicompany->transverse_mode))
{
$sql.= " AND r.entity = ".$fgroup->entity;
$sql.= " AND r.entity = ".$object->entity;
}
else
{
@ -280,9 +279,9 @@ if ($id)
print '<td class="nowrap">'.img_object('',$picto).' '.$objMod->getName();
print '<a name="'.$objMod->getName().'">&nbsp;</a></td>';
print '<td align="center" class="nowrap">';
print '<a title='.$langs->trans("All").' alt='.$langs->trans("All").' href="perms.php?id='.$fgroup->id.'&amp;action=addrights&amp;module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("All")."</a>";
print '<a title='.$langs->trans("All").' alt='.$langs->trans("All").' href="perms.php?id='.$object->id.'&amp;action=addrights&amp;module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("All")."</a>";
print '/';
print '<a title='.$langs->trans("None").' alt='.$langs->trans("None").' href="perms.php?id='.$fgroup->id.'&amp;action=delrights&amp;module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("None")."</a>";
print '<a title='.$langs->trans("None").' alt='.$langs->trans("None").' href="perms.php?id='.$object->id.'&amp;action=delrights&amp;module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("None")."</a>";
print '</td>';
print '<td colspan="2">&nbsp;</td>';
print '</tr>';
@ -299,7 +298,7 @@ if ($id)
// Own permission by group
if ($caneditperms)
{
print '<td align="center"><a class="reposition" href="perms.php?id='.$fgroup->id.'&amp;action=delrights&amp;rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
print '<td align="center"><a class="reposition" href="perms.php?id='.$object->id.'&amp;action=delrights&amp;rights='.$obj->id.'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
}
print '<td align="center">';
print img_picto($langs->trans("Active"),'tick');
@ -310,7 +309,7 @@ if ($id)
// Do not own permission
if ($caneditperms)
{
print '<td align="center"><a class="reposition" href="perms.php?id='.$fgroup->id.'&amp;action=addrights&amp;rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).'</a></td>';
print '<td align="center"><a class="reposition" href="perms.php?id='.$object->id.'&amp;action=addrights&amp;rights='.$obj->id.'">'.img_edit_add($langs->trans("Add")).'</a></td>';
}
print '<td>&nbsp</td>';
}
@ -324,6 +323,10 @@ if ($id)
}
}
print '</table>';
print '</div>';
dol_fiche_end();
}
llxFooter();