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)) if (! empty($groupslist))
{ {
$var=true;
foreach($groupslist as $group) foreach($groupslist as $group)
{ {
@ -2360,8 +2358,6 @@ else
$genallowed = $user->rights->user->user->creer; $genallowed = $user->rights->user->user->creer;
$delallowed = $user->rights->user->user->supprimer; $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); $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 // Show links to link elements

View File

@ -37,8 +37,9 @@ class UserGroup extends CommonObject
public $element='usergroup'; public $element='usergroup';
public $table_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 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 public $entity; // Entity of group
/** /**
* @deprecated * @deprecated
* @see name * @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 * Retourne chaine DN complete dans l'annuaire LDAP pour l'objet
* *

View File

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

View File

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

View File

@ -82,16 +82,16 @@ llxHeader('',$langs->trans("Permissions"));
if ($id) if ($id)
{ {
$fgroup = new Usergroup($db); $object = new Usergroup($db);
$fgroup->fetch($id); $object->fetch($id);
$fgroup->getrights(); $object->getrights();
/* /*
* Affichage onglets * Affichage onglets
*/ */
$head = group_prepare_head($fgroup); $head = group_prepare_head($object);
$title = $langs->trans("Group"); $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 // Charge les modules soumis a permissions
$modules = array(); $modules = array();
@ -127,7 +127,7 @@ if ($id)
// Load all permissions // Load all permissions
if ($objMod->rights_class) 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); $ret=$objMod->insert_permissions(0, $entity);
$modules[$objMod->rights_class]=$objMod; $modules[$objMod->rights_class]=$objMod;
} }
@ -150,7 +150,7 @@ if ($id)
{ {
if (empty($conf->multicompany->transverse_mode)) if (empty($conf->multicompany->transverse_mode))
{ {
$sql.= " AND r.entity = ".$fgroup->entity; $sql.= " AND r.entity = ".$object->entity;
} }
else else
{ {
@ -162,7 +162,7 @@ if ($id)
$sql.= " AND r.entity IN (0,".$conf->entity.")"; $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); $result=$db->query($sql);
@ -184,31 +184,30 @@ if ($id)
} }
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 * Ecran ajout/suppression permission
*/ */
print '<table class="border" width="100%">'; 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 // Nom
print '<tr><td width="25%">'.$langs->trans("Name").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Name").'</td>';
print '<td colspan="2">'.$fgroup->name.''; print '<td colspan="2">'.$object->name.'';
if (! $fgroup->entity) if (! $object->entity)
{ {
print img_picto($langs->trans("GlobalGroup"),'redstar'); print img_picto($langs->trans("GlobalGroup"),'redstar');
} }
print "</td></tr>\n"; print "</td></tr>\n";
// Note // Note
print '<tr><td width="25%" class="tdtop">'.$langs->trans("Note").'</td>'; print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td class="valeur">'.dol_htmlentitiesbr($fgroup->note).'</td>'; print '<td class="valeur">'.dol_htmlentitiesbr($object->note).'</td>';
print "</tr>\n"; print "</tr>\n";
print '</table><br>'; print '</table><br>';
@ -230,7 +229,7 @@ if ($id)
{ {
if (empty($conf->multicompany->transverse_mode)) if (empty($conf->multicompany->transverse_mode))
{ {
$sql.= " AND r.entity = ".$fgroup->entity; $sql.= " AND r.entity = ".$object->entity;
} }
else else
{ {
@ -280,9 +279,9 @@ if ($id)
print '<td class="nowrap">'.img_object('',$picto).' '.$objMod->getName(); print '<td class="nowrap">'.img_object('',$picto).' '.$objMod->getName();
print '<a name="'.$objMod->getName().'">&nbsp;</a></td>'; print '<a name="'.$objMod->getName().'">&nbsp;</a></td>';
print '<td align="center" class="nowrap">'; 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 '/';
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>';
print '<td colspan="2">&nbsp;</td>'; print '<td colspan="2">&nbsp;</td>';
print '</tr>'; print '</tr>';
@ -299,7 +298,7 @@ if ($id)
// Own permission by group // Own permission by group
if ($caneditperms) 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 '<td align="center">';
print img_picto($langs->trans("Active"),'tick'); print img_picto($langs->trans("Active"),'tick');
@ -310,7 +309,7 @@ if ($id)
// Do not own permission // Do not own permission
if ($caneditperms) 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>'; print '<td>&nbsp</td>';
} }
@ -324,6 +323,10 @@ if ($id)
} }
} }
print '</table>'; print '</table>';
print '</div>';
dol_fiche_end();
} }
llxFooter(); llxFooter();