Jean-Francois Leveque

Compile (WIP sur updateUser.xhtml et le reste de la transition User)

......@@ -29,6 +29,20 @@
</dependencyManagement>
<dependencies>
<!-- **** PREREQUIS MIGRATION **** -->
<!-- https://mvnrepository.com/artifact/org.omnifaces/omnifaces -->
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>2.5.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.primefaces/primefaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.0</version>
</dependency>
<!-- **** FRAMEWORK : JSF + CDI **** -->
......
package org.legrog.application;
import org.legrog.entities.Country;
import org.legrog.entities.CountryRepository;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
import javax.ejb.Stateless;
import javax.enterprise.inject.Alternative;
import javax.inject.Inject;
import java.util.List;
@Stateless
public class CountryServiceSpring implements CountryService {
@Inject
CountryRepository repository;
public void addCountry(Country country) {
repository.save(country);
}
public List<Country> getAllCountries() {
return repository.findAll();
}
}
package org.legrog.application;
import org.legrog.entities.Country;
import org.legrog.entities.DisplayNameMask;
import org.legrog.entities.UserRole;
import java.util.List;
public interface CountryService {
public interface SharedService {
void addCountry(Country country);
List<Country> getAllCountries();
}
List<DisplayNameMask> getAllDisplayNameMasks();
List<UserRole> getAvailableUserRoles();
}
\ No newline at end of file
......
package org.legrog.application;
import org.legrog.entities.*;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
import javax.ejb.Stateless;
import javax.inject.Inject;
import java.util.List;
import java.util.Vector;
@Stateless
public class SharedServiceSpring implements SharedService {
@Inject
CountryRepository countryRepository;
@Inject
UserRoleRepository userRoleRepository;
private List<DisplayNameMask> allDisplayNameMasks;
public void addCountry(Country country) {
countryRepository.save(country);
}
public List<Country> getAllCountries() {
return countryRepository.findAll();
}
public List<DisplayNameMask> getAllDisplayNameMasks() {
if (allDisplayNameMasks == null)
{
allDisplayNameMasks = new Vector<DisplayNameMask>(DisplayNameMask.values().length);
for (DisplayNameMask mask : DisplayNameMask.values())
{
allDisplayNameMasks.add(mask);
}
}
return allDisplayNameMasks;
}
public List<UserRole> getAvailableUserRoles() {
return userRoleRepository.findAll();
}
}
package org.legrog.entities;
/* DbMaskableEntity en v2, mais je pense le nouveau nom plus clair */
public interface DisplayNameConfigurable {
String getFirstName();
String getLastName();
String getNickName();
/* ScreenName en v2, mais je pense la nouveau nom plus clair */
String getDisplayName();
}
package org.legrog.entities;
/**
* This enumeration provide options for name masking of authors and users.
* Every {link org.roliste.data.DbMaskableEntity} provide first name, last name and nickname
* capabilities, that may be "masked", thus shown in some specific way depending on chosen
* NameMask.
*/
public enum DisplayNameMask
{
PRENOMNOM("Prénom Nom")
{
public String listMask(DisplayNameConfigurable person)
{
return NOMPRENOM.getDisplayName(person);
}
public String getDisplayName(DisplayNameConfigurable person)
{
StringBuilder sb = new StringBuilder();
if (person.getFirstName() != null)
{
sb.append(person.getFirstName());
}
if (person.getLastName() != null)
{
sb.append(' ');
sb.append(person.getLastName());
}
return sb.toString();
}
},
NOMPRENOM("Nom, Prénom")
{
public String listMask(DisplayNameConfigurable person)
{
return NOMPRENOM.getDisplayName(person);
}
public String getDisplayName(DisplayNameConfigurable person)
{
StringBuilder sb = new StringBuilder();
if (person.getLastName() != null)
{
sb.append(person.getLastName());
if (person.getFirstName() != null)
{
sb.append(", ");
sb.append(person.getFirstName());
}
}
else
{
sb.append("!Pas de nom");
}
return sb.toString();
}
},
PSEUDO("Pseudo")
{
public String listMask(DisplayNameConfigurable person)
{
return PSEUDO.getDisplayName(person);
}
public String getDisplayName(DisplayNameConfigurable person)
{
StringBuilder sb = new StringBuilder();
if (person.getNickName() != null)
{
sb.append(person.getNickName());
}
else
{
sb.append("!Pas de pseudo");
}
return sb.toString();
}
},
COMPLET("Prénom 'Pseudo' Nom")
{
public String listMask(DisplayNameConfigurable person)
{
return NOMPRENOM.getDisplayName(person);
}
public String getDisplayName(DisplayNameConfigurable person)
{
StringBuffer myResult = new StringBuffer();
if (person.getFirstName() != null)
{
myResult.append(person.getFirstName());
myResult.append(' ');
}
if ( person.getNickName() != null )
{
myResult.append('\'');
myResult.append(person.getNickName());
myResult.append('\'');
myResult.append(' ');
}
if (person.getLastName() != null)
{
myResult.append(person.getLastName());
}
return myResult.toString();
}
};
private final String symbol;
private DisplayNameMask(String symbol)
{
this.symbol = symbol;
}
public String getSymbol()
{
return symbol;
}
public String toString()
{
return symbol;
}
public abstract String getDisplayName(DisplayNameConfigurable person);
public abstract String listMask(DisplayNameConfigurable person);
}
\ No newline at end of file
......@@ -10,7 +10,7 @@ import java.util.*;
// TODO NameMask et DbMaskableEntity à traiter ensemble
@Entity
//@Table(name="utilisateur")
public class User /* extends org.roliste.data.DbTraceableEntity implements DbMaskableEntity, DbValidationEntity */ {
public class User /* extends org.roliste.data.DbTraceableEntity */ implements DisplayNameConfigurable /*, DbValidationEntity */ {
// @Column(name="ID_UTILISATEUR")
@Id
......@@ -40,7 +40,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas
/**
* The mask used for user name.
*/
// private NameMask _mask;
private DisplayNameMask displayNameMask;
/*
@Override
public String getUrlKey()
......@@ -50,21 +50,20 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas
*/
/**
* @return the user's name as desired. By default, return the complete name.
* @see org.roliste.data.db.NameMask#mask(org.roliste.data.DbMaskableEntity)
* see org.roliste.data.db.NameMask#mask(org.roliste.data.DbMaskableEntity)
*/
/*
public String getScreenName()
public String getDisplayName()
{
if (_mask != null)
return _mask.mask(this);
if (displayNameMask != null)
return displayNameMask.getDisplayName(this);
else
return NameMask.COMPLET.mask(this);
return DisplayNameMask.COMPLET.getDisplayName(this);
}
*/
/**
* Returns the user's name mask.
* @return the mask.
* @see #setNameMask(NameMask)
* see #setNameMask(NameMask)
* hibernate.property
* column="MASQUE_NOM_UTILISATEUR"
* access="property"
......@@ -72,21 +71,18 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas
* @hibernate.type
* name="org.roliste.data.util.NameMaskUserType"
*/
/*
public NameMask getNameMask() {
return _mask;
public DisplayNameMask getDisplayNameMask() {
return displayNameMask;
}
*/
/**
* Initializes the user's name mask.
* @param mask the new {@link org.roliste.data.db.NameMask}.
* @see #getNameMask()
* @param mask the new {link org.roliste.data.db.NameMask}.
* see #getNameMask()
*/
/*
public void setNameMask(NameMask mask) {
_mask = mask;
public void setDisplayNameMask(DisplayNameMask mask) {
mask = mask;
}
*/
// TODO Faire ailleurs les contrôles de chaîne vide sur : username, password, firstname, lastname, nickname, email, text
......@@ -111,7 +107,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas
private String lastName;
/**
* The user screen name.
* The user nick name.
*/
private String nickname;
......@@ -123,7 +119,8 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas
/**
* The {@link org.roliste.data.db.UserRole}s for this user.
*/
// private List<UserRole> _roles;
@ManyToMany
private List<UserRole> roles;
/**
* Retrieves the list of {@link UserRole}s for this user.
......@@ -134,7 +131,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas
* @see #setRoles(List)
* @see #addToRole(UserRole)
* @see #removeFromRole(UserRole)
* @hibernate.many-to-many
* hibernate.many-to-many
* column="ROLE_FK"
* class="org.roliste.data.db.UserRole"
* foreign-key="FK_UTILISATEURROLE_ROLEUTILISATEUR"
......@@ -148,28 +145,28 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas
* table="role_utilisateur"
* lazy="true"
*/
/*
public List<UserRole> getRoles() {
return _roles;
return roles;
}
*/
/**
* Lists the list of {@link UserRole}s for this user.
* @param roles the new {@link List} of {@link UserRole}s. Shall not be <code>null</code>.
* @throws NullPointerException if roles is <code>null</code>.
* @see #getRoles()
* @see #addToRole(UserRole)
* @see #removeFromRole(UserRole)
* see #addToRole(UserRole)
* see #removeFromRole(UserRole)
*/
/*
public void setRoles(List<UserRole> roles) {
if (roles == null)
{
throw new NullPointerException("Impossible d'affecter un ensemble nul aux r�les d'un utilisateur");
}
_roles = roles;
this.roles = roles;
}
*/
/**
* Add the user to a given {@link UserRole}s.
* @param role the new {@link UserRole}. Ignored if <code>null</code>.
......@@ -232,7 +229,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas
/**
* Presentation text.
*/
private String text;
private String presentation;
/**
* The {@link org.roliste.data.db.BookDetails}s in this user's collection.
......@@ -736,16 +733,16 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas
* length="2147483647"
*/
public String getPresentation() {
return text;
return presentation;
}
/**
* Initializes the HTML text presentation.
* @param text the new {@link String} HTML text.
* @param presentation the new {@link String} HTML text.
* @see #getPresentation()
*/
public void setPresentation(String text) {
this.text = text;
public void setPresentation(String presentation) {
this.presentation = presentation;
}
/**
......
package org.legrog.entities;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.*;
/**
* The database representation of a user role or group.
* A given {@link User} may be part of one or more {@link UserRole}.
* <br/>
* Warning: due to laziness of mapped objects, private attributes of all DB entities shall never be used directly.
* You shall always use the getter/setter methods.
* alias UserRole
*
*/
@Entity
// TODO évaluer extend v2
public class UserRole /* extends org.roliste.data.DbEntity */
{
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int userRoleId;
/**
* The role identifier.
*/
private String rolename;
/**
* The {@link User}s for this user role.
*/
@ManyToMany
private Set<User> users;
/**
* Builds a new and empty user role definition.
* All attributes are set to their default value.
* <br/>
* Needed by Hibernate for Java reflection.
*/
public UserRole() {
super();
rolename = null;
visible = true;
// no need to synchronize this
users = new HashSet<User>();
}
public int getUserRoleId() {
return userRoleId;
}
public void setUserRoleId(int userRoleId) {
this.userRoleId = userRoleId;
}
/**
* Returns the role identifier.
* @return the {@link String} identifier.
* @see #setRolename(String)
* hibernate.property
* column="NOM_ROLE"
* not-null="true"
* unique="true"
* access="property"
* length="50"
*/
public String getRolename() {
return rolename;
}
/**
* Initializes the role identifier.
* @param name the new {@link String} identifier.
* @see #getRolename()
*/
public void setRolename(String name) {
rolename = name;
}
/**
* The role validation status.
* A role may be temporarily deactivated.
*/
private boolean visible;
/**
* Indicates if the role is visible.
* If not, users should not be able to access the privileges
* they inherit from being part of this role.
* @return the visible flag.
* @see #setVisible(boolean)
* hibernate.property
* column="IND_VISIBLE"
* access="property"
*/
public boolean isVisible() {
return visible;
}
/**
* Initializes the user visible flag.
* @param visible the new flag value.
* @see #isVisible
*/
public void setVisible(boolean visible) {
this.visible = visible;
}
/**
* Retrieves the list of {@link User}s for this user role.
* SHALL be used as a read-only attribute. In particular, avoid
* using {@link Set#add(Object)} or {@link Set#remove(Object)} on
* the returned value without caution.
* @return a {@link Set} of {@link User}. May be <code>null</code>.
* @see #setUsers(Set)
* hibernate.many-to-many
* column="UTILISATEUR_FK"
* class="org.roliste.data.db.User"
* foreign-key="FK_UTILISATEURROLE_UTILISATEUR"
* hibernate.key
* column="ROLE_FK"
* not-null="true"
* foreign-key="FK_UTILISATEURROLE_ROLEUTILISATEUR"
* hibernate.set
* access="property"
* table="role_utilisateur"
* lazy="true"
* inverse="true"
*/
public Set<User> getUsers() {
return users;
}
/**
* Sets the list of {@link User}s for this user role.
* @param users the new {@link Set} of {@link User}s. May be
* <code>null</code> (we don't handle the relation from this side).
* @see #getUsers()
*/
protected void setUsers(Set<User> users) {
this.users = users;
}
/**
* Returns a string representation of this user role definition.
* @return a string representing this user role definition.
* hidden
*/
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("ID_ROLE=");
sb.append(getUserRoleId());
sb.append(" NOM_ROLE=");
sb.append(rolename);
sb.append(" IND_VISIBLE=");
sb.append(visible);
return sb.toString();
}
}
\ No newline at end of file
package org.legrog.entities;
import org.springframework.data.jpa.repository.JpaRepository;
public interface UserRoleRepository extends JpaRepository<UserRole, Integer> {
}
\ No newline at end of file
package org.legrog.presentation;
import org.legrog.application.CountryService;
import org.legrog.application.SharedService;
import org.legrog.entities.Country;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;
@Named
@RequestScoped
public class CountryBean {
public class AddCountryBean {
@Inject
private CountryService service;
private List<Country> countries;
private SharedService sharedService;
private String countryName;
public List<Country> getCountries() {
return countries;
}
public void setCountries(List<Country> countries) {
this.countries = countries;
}
public String getCountryName() {
return countryName;
}
......@@ -38,11 +27,8 @@ public class CountryBean {
{
Country country = new Country();
country.setCountryName(countryName);
service.addCountry(country);
sharedService.addCountry(country);
return "success";
}
public void onload() {
countries = service.getAllCountries();
}
}
......
package org.legrog.presentation;
import org.legrog.application.SharedService;
import org.legrog.application.UserService;
import org.legrog.entities.DisplayNameMask;
import org.legrog.entities.User;
import org.legrog.entities.UserRole;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;
@Named
@RequestScoped
public class AddUserBean {
@Inject
private UserService userService;
@Inject
private SharedService sharedService;
private int userId;
private String username;
private String firstName;
private String lastName;
private String nickName;
private DisplayNameMask displayNameMask;
private List<DisplayNameMask> allDisplayNameMasks;
private List<UserRole> availableUserRoles;
private String email;
private boolean anonymous;
private String password;
private List<UserRole> roles;
private String presentation;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String add()
{
User user = new User();
user.setUsername(username);
userService.addUser(user);
return "success";
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public DisplayNameMask getDisplayNameMask() {
return displayNameMask;
}
public void setDisplayNameMask(DisplayNameMask displayNameMask) {
this.displayNameMask = displayNameMask;
}
public List<DisplayNameMask> getAllDisplayNameMasks() {
return allDisplayNameMasks;
}
public void setAllDisplayNameMasks(List<DisplayNameMask> allDisplayNameMasks) {
this.allDisplayNameMasks = allDisplayNameMasks;
}
public int getUserId() {
return userId;
}
public void setUserId(int userId) {
this.userId = userId;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public boolean isAnonymous() {
return anonymous;
}
public void setAnonymous(boolean anonymous) {
this.anonymous = anonymous;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public List<UserRole> getRoles() {
return roles;
}
public void setRoles(List<UserRole> roles) {
this.roles = roles;
}
@PostConstruct
public void init() {
allDisplayNameMasks = sharedService.getAllDisplayNameMasks();
availableUserRoles = sharedService.getAvailableUserRoles();
}
public List<UserRole> getAvailableUserRoles() {
return availableUserRoles;
}
public void setAvailableUserRoles(List<UserRole> availableUserRoles) {
this.availableUserRoles = availableUserRoles;
}
public String getPresentation() {
return presentation;
}
public void setPresentation(String presentation) {
this.presentation = presentation;
}
}
package org.legrog.presentation;
import org.legrog.application.SharedService;
import org.legrog.entities.Country;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;
@Named
@RequestScoped
public class ListCountriesBean {
@Inject
private SharedService sharedService;
private List<Country> countries;
public List<Country> getCountries() {
return countries;
}
public void setCountries(List<Country> countries) {
this.countries = countries;
}
@PostConstruct
public void init() {
countries = sharedService.getAllCountries();
}
}
......@@ -3,18 +3,13 @@ package org.legrog.presentation;
import org.legrog.application.UserService;
import org.legrog.entities.User;
import javax.enterprise.context.RequestScoped;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.List;
@Named
@RequestScoped
public class UserBean {
public class ListUsersBean {
@Inject
private UserService service;
private String username;
private UserService userService;
private List<User> users;
......@@ -26,24 +21,9 @@ public class UserBean {
this.users = users;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String add()
{
User user = new User();
user.setUsername(username);
service.addUser(user);
return "success";
}
public void onload() {
users = service.getAllUsers();
@PostConstruct
public void init() {
users = userService.getAllUsers();
}
}
......
......@@ -37,7 +37,7 @@
</navigation-case>
<navigation-case>
<from-outcome>listUsers</from-outcome>
<to-view-id>/listUsers.xhtml</to-view-id>
<to-view-id>/listUsers_short.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
......@@ -53,7 +53,7 @@
<from-view-id>/addUser.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/listUsers.xhtml</to-view-id>
<to-view-id>/listUsers_short.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
......
......@@ -13,9 +13,9 @@
<h:panelGrid columns="2">
<h:outputText value='Nom du pays'/>
<h:inputText value='#{countryBean.countryName}'/>
<h:inputText value='#{addCountryBean.countryName}'/>
<h:outputText value='Add'/>
<h:commandButton action="#{countryBean.add}" value="Add"/>
<h:commandButton action="#{addCountryBean.add}" value="Add"/>
</h:panelGrid>
</h:form>
</body>
......
......@@ -13,9 +13,9 @@
<h:panelGrid columns="2">
<h:outputText value="Username de l'utilisateur"/>
<h:inputText value='#{userBean.username}'/>
<h:inputText value='#{addUserBean.username}'/>
<h:outputText value='Add'/>
<h:commandButton action="#{userBean.add}" value="Add"/>
<h:commandButton action="#{addUserBean.add}" value="Add"/>
</h:panelGrid>
</h:form>
</body>
......
......@@ -11,11 +11,8 @@
<h:outputText value="Menu principal"/>
</h:commandLink>
</h:form>
<f:metadata>
<f:event type="preRenderView" listener="#{countryBean.onload}" />
</f:metadata>
<ul>
<ui:repeat value="#{countryBean.countries}" var="country">
<ui:repeat value="#{listCountriesBean.countries}" var="country">
<li>#{country.countryName}</li>
</ui:repeat>
</ul>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<f:view>
<h:form>
<h:commandLink action="home">
<h:outputText value="Menu principal"/>
</h:commandLink>
</h:form>
<f:metadata>
<f:event type="preRenderView" listener="#{userBean.onload}" />
</f:metadata>
<ul>
<ui:repeat value="#{userBean.users}" var="user">
<li>#{user.username}</li>
</ui:repeat>
</ul>
</f:view>
</html>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="#{theme.template}">
<!-- content -->
<ui:define name="content">
<h2>Liste des utilisateurs</h2>
<p>
Liste des utilisateurs enregistrs sur le site. Un utilisateur peut tre "visible" ou non. Dans
le cas o il n'est pas visible, il lui est impossible de s'identifier sur le site. Au moment de
son enregistrement, par dfaut, il n'est pas visible : un systme de confirmation par courriel permet
de valider que l'adresse est correcte, et seulement ce moment l de le rendre visible. La cration
d'un utilisateur directement partir de la passerelle n'utilise pas ce systme de confirmation.
</p>
<h:form>
<div id="search" style="text-align:center;">
<h:panelGrid columns="3" styleClass="half">
<h:outputLabel for="searchString" value="Filtre" styleClass="req"/>
<h:inputText id="searchString" value="#{userListMgr.searchString}" styleClass="req"/>
<h:commandButton id="find" value="OK" action="#{userListMgr.find}" styleClass="lanceReq"><!--<s:defaultAction/>--></h:commandButton>
</h:panelGrid>
<h:outputText value="Pas d'lment respectant ce critre dans la base"
rendered="#{elementList.rowCount==0}"/>
</div>
<h:messages globalOnly="true" errorClass="errorMsg" infoClass="infoMsg"/>
<div id="listElements">
<h:commandLink styleClass="fRight acLink" action="#{userListMgr.goToCreate('user')}" >
<img src="/images/structure/vide.gif" class="icAddC" alt="" title="Crer un nouvel utilisateur" />
Nouvel Utilisateur
</h:commandLink>
<p:dataTable id="tableElements" rendered="#{elementList.rowCount>0}"
var="user" value="#{elementList}" rows="#{userListMgr.pageSize}"
styleClass="results" rowClasses="altRichRow,altRow">
<f:facet name="header">
<p:dataScroller for="tableElements"
stepControls="auto" boundaryControls="auto" fastControls="auto">
<f:facet name="first">Premiers</f:facet>
<f:facet name="last">Derniers</f:facet>
<f:facet name="fastforward">Suivants</f:facet>
<f:facet name="fastrewind">Prcdents</f:facet>
<f:facet name="pages" >&#160;</f:facet>
</p:dataScroller>
</f:facet>
<p:column rendered="#{s:hasRole('ADMINISTRATEUR')}">
<h:commandLink id="delete" onclick="return confirm('Voulez vous vraiment supprimer cet lment ?');" action="#{userListMgr.delete}">
<img src="/images/structure/vide.gif" class="icDel" alt="" title="Effacer" />
</h:commandLink>
</p:column>
<p:column rendered="#{s:hasRole('ADMINISTRATEUR')}">
<h:commandLink action="#{userListMgr.goToUpdate('user', user.pk)}">
<img src="/images/structure/vide.gif" class="icEdit" alt="" title="Modifier" />
</h:commandLink>
</p:column>
<p:column styleClass="third" sortBy="#{user.username}">
<f:facet name="header">Identifiant</f:facet>
<h:outputLink value="#{user.traceable.urlRewrite}">
<h:outputText value="#{user.username}" />
</h:outputLink>
</p:column>
<p:column styleClass="third" sortBy="#{user.firstName} #{user.lastName}">
<f:facet name="header">Nom</f:facet>
<h:outputLink value="#{user.traceable.urlRewrite}">
<h:outputText value="#{user.firstName} #{user.lastName}" />
</h:outputLink>
</p:column>
<p:column styleClass="third" sortBy="#{user.email}">
<f:facet name="header">Email</f:facet>
<h:outputText value="#{user.email}" />
</p:column>
<p:column>
<h:graphicImage value="/images/structure/dVert.gif" rendered="#{user.visible and user.activated}" title="Utilisateur activ" />
<h:graphicImage value="/images/structure/dOrange.gif" rendered="#{(not user.visible) and user.activated}" title="Utilisateur dsactiv" />
<h:graphicImage value="/images/structure/dRouge.gif" rendered="#{not user.activated}" title="Utilisateur non enregistr" />
</p:column>
<f:facet name="footer">
<h:commandLink action="#{userListMgr.goToCreate('user')}" value="Crer un nouvel utilisateur" >
</h:commandLink>
</f:facet>
</p:dataTable>
<p>
<h:commandLink action="#{userListMgr.goToCreate('user')}" value="Crer un nouvel utilisateur"
rendered="#{elementList.rowCount==0}">
</h:commandLink>
</p>
</div>
</h:form>
</ui:define>
<!-- sidebars -->
<ui:define name="sidebar">
<ui:include src="/includes/top-sidebar-admin.include"/>
</ui:define>
</ui:composition>
\ No newline at end of file
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<f:view>
<h:form>
<h:commandLink action="home">
<h:outputText value="Menu principal"/>
</h:commandLink>
</h:form>
<f:metadata>
<f:event type="preRenderView" listener="#{addUserBean.onload}" />
</f:metadata>
<ul>
<ui:repeat value="#{addUserBean.users}" var="user">
<li>#{user.username}</li>
</ui:repeat>
</ul>
</f:view>
</html>
This diff is collapsed. Click to expand it.