r2976 - in trunk: . pollen-business/src/main/java/org/chorem/pollen pollen-business/src/main/java/org/chorem/pollen/bean pollen-business/src/main/java/org/chorem/pollen/entity pollen-business/src/main/java/org/chorem/pollen/service pollen-business/src/main/resources/i18n pollen-business/src/main/xmi pollen-ui/src/main/java/org/chorem/pollen/ui/base pollen-ui/src/main/java/org/chorem/pollen/ui/components pollen-ui/src/main/java/org/chorem/pollen/ui/data pollen-ui/src/main/java/org/chorem/pol
Author: fdesbois Date: 2010-04-27 18:29:41 +0200 (Tue, 27 Apr 2010) New Revision: 2976 Log: - Add FormatBinding to manage message format: in tml files - Add EntityProperty to manage properties in TopiaQuery - Use last ToPIA and EUGene snapshot - Split page UserLists in two components : UserListsCreate and UserListsUpdate - Improve filter to use EntityProperty and UID (for PollAccount or Poll) Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBinding.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBindingFactory.java trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsCreate.tml trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties trunk/pollen-business/src/main/xmi/pollen.properties trunk/pollen-business/src/main/xmi/pollen.zargo trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserLists_fr.properties trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml trunk/pollen-ui/src/main/webapp/css/lists.css trunk/pollen-ui/src/main/webapp/user/UserLists.tml trunk/pom.xml Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/PollenBusinessException.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -46,7 +46,10 @@ /** Exception when password is not valid for some user **/ USER_WRONG_PASSWORD(n_("pollen.exception.user_wrong_password")), /** Exception when stmp server is not available **/ - SMTP_NOT_AVAILABLE(n_("pollen.exception.smtp_not_available")); + SMTP_NOT_AVAILABLE(n_("pollen.exception.smtp_not_available")), + /** Exception when favorite list name is already defined for user **/ + FAVORITE_LIST_NAME_EXIST( + n_("pollen.exception.favorite_list_name_exist")); private String message; Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/bean/Filter.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -4,6 +4,8 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import org.apache.commons.lang.StringUtils; +import org.chorem.pollen.entity.EntityProperty; +import org.chorem.pollen.entity.PropertyUid; import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.topia.persistence.TopiaEntity; @@ -13,10 +15,7 @@ * Created: 23 avr. 2010 * * @author fdesbois - * @version $Revision$ - * - * Mise a jour: $Date$ - * par : $Author$ + * @since 2.0 */ public class Filter { @@ -26,6 +25,8 @@ protected String orderBy; + protected String uid; + private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this); @@ -35,6 +36,8 @@ public static final String PROPERTY_ORDER_BY = "orderBy"; + public static final String PROP_UID = "uid"; + /** * Get the value of startIndex * @@ -96,6 +99,26 @@ } /** + * Get the value of uid + * + * @return the value of uid + */ + public String getUid() { + return uid; + } + + /** + * Set the value of uid + * + * @param uid new value of uid + */ + public void setUid(String uid) { + String oldUid = this.uid; + this.uid = uid; + propertyChangeSupport.firePropertyChange(PROP_UID, oldUid, uid); + } + + /** * Add PropertyChangeListener. * * @param listener @@ -113,7 +136,26 @@ propertyChangeSupport.removePropertyChangeListener(listener); } + /** + * Prepare a query with filter : adding startIndex and endIndex as limit + * and orderBy if defined. + * + * @param query + * @see #prepareQuery(TopiaQuery, PropertyUid) + */ public void prepareQuery(TopiaQuery query) { + prepareQuery(query, null); + } + + /** + * Prepare a query with filter. The {@code property} is used + * to retrieve the name of UID property in case of filter using uid. + * + * @param query to prepare + * @param ordered if order is needed (using orderBy filter) + * @param property to provide UID property name (using uid filter) + */ + public void prepareQuery(TopiaQuery query, PropertyUid property) { // Add limits. Only startIndex do nothing. // startIndex + endIndex provides the limit if (startIndex != null && endIndex != null) { @@ -123,9 +165,11 @@ } else if (endIndex != null) { query.setMaxResults(endIndex); } - } - public void prepareQueryWithOrder(TopiaQuery query) { + if (StringUtils.isNotEmpty(uid) && property != null) { + query.add(property.namePropertyUid(), uid); + } + // Add order to the query, splitted by comma and trimmed using // {@link StringUtils#stripAll(String[])} if (orderBy != null) { @@ -136,8 +180,6 @@ } else { query.addOrderDesc(TopiaEntity.TOPIA_CREATE_DATE); } - - prepareQuery(query); } } Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -0,0 +1,80 @@ + +package org.chorem.pollen.entity; + +import org.nuiton.topia.framework.*; + +/** + * EntityProperty is used to simplify property concatenation in TopiaQuery. + * The usage is simple, the EntityProperty need a mainAlias which represents + * the entity in a TopiaQuery. Then the {@link #nameProperty(String)} + * is called to retrieve the correct property name used for the query. + * Exemple : + * <pre> + * BoatDAO dao = AppDAOHelper.getBoatDAO(topiaContext); + * + * // Property used in the query + * EntityProperty boatProperty = new EntityProperty("B"); + * + * // It's better to create the query with the property name + * TopiaQuery query = dao.createQuery(boatProperty.name()); + * + * // The property NAME of the boat need to be find equals to "ULUBERLU" + * query.add(boatProperty.nameProperty(Boat.NAME), "ULUBERLU"); + * + * // It's avoid doing this : + * query.add("B." + Boat.NAME, "ULUBERLU"); + * </pre> + * This last exemple is a simple case but for a more complex query with more + * than one entity, it's obvious that concatenation using + is not a good + * practice.<br /> + * You can also use this class as a superclass for each entity, ex : + * <pre> + * public class BoatProperty extends EntityProperty { + * + * public BoatProperty(String mainAlias) { + * super(mainAlias); + * } + * + * public String namePropertyName() { + * return nameProperty(Boat.NAME); + * } + * } + * </pre> + * + * Created: 14 avr. 2010 + * + * @author fdesbois <fdesbois@codelutin.com> + */ +public class EntityProperty { + + /** alias of the entity **/ + protected String mainAlias; + + public EntityProperty(String mainAlias) { + this.mainAlias = mainAlias; + } + + /** + * Name the entity as a property for a TopiaQuery. + * + * @return the entity name used as a TopiaQuery property + */ + public String name() { + return mainAlias; + } + + /** + * Name a property from the Entity for a TopiaQuery. + * + * @param propertyName to named in the TopiaQuery + * @return the property name used as a TopiaQuery property + */ + public String nameProperty(String propertyName) { + return TopiaQuery.getProperty(mainAlias, propertyName); + } + + @Override + public String toString() { + return name(); + } +} Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/EntityProperty.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -0,0 +1,27 @@ + +package org.chorem.pollen.entity; + +/** + * PollAccountImpl + * + * Created: 26 avr. 2010 + * + * @author fdesbois + */ +public class PollAccountImpl extends PollAccountAbstract { + + private static final long serialVersionUID = 1L; + + @Override + public PollAccount getChildByUId(String UId) { + if (child != null) { + for (PollAccount account : child) { + if (account.getUid().equals(UId)) { + return account; + } + } + } + return null; + } + +} Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountImpl.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -0,0 +1,27 @@ + +package org.chorem.pollen.entity; + +/** + * PollAccountProperty + * + * Created: 27 avr. 2010 + * + * @author fdesbois + * @since 2.0 + */ +public class PollAccountProperty extends EntityProperty implements PropertyUid { + + public PollAccountProperty(String mainAlias) { + super(mainAlias); + } + + @Override + public String namePropertyUid() { + return nameProperty(PollAccount.UID); + } + + public String namePropertyChild() { + return nameProperty(PollAccount.CHILD); + } + +} Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PollAccountProperty.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java (rev 0) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -0,0 +1,15 @@ + +package org.chorem.pollen.entity; + +/** + * PropertyUid + * + * Created: 27 avr. 2010 + * + * @author fdesbois + * @since 2.0 + */ +public interface PropertyUid { + + String namePropertyUid(); +} Property changes on: trunk/pollen-business/src/main/java/org/chorem/pollen/entity/PropertyUid.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServicePollImpl.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -65,7 +65,7 @@ List<Object> errorArgs, Poll poll) throws TopiaException { errorArgs.add(poll.getTitle()); - errorArgs.add(poll.getUId()); + errorArgs.add(poll.getUid()); PollenDAOHelper.getPollDAO(transaction).create(poll); Modified: trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java =================================================================== --- trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-business/src/main/java/org/chorem/pollen/service/ServiceUserImpl.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -2,7 +2,6 @@ package org.chorem.pollen.service; import java.util.List; -import java.util.Locale; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -14,6 +13,9 @@ import org.chorem.pollen.PollenException; import org.chorem.pollen.bean.Filter; import org.chorem.pollen.entity.PollAccount; +import org.chorem.pollen.entity.PollAccountDAO; +import org.chorem.pollen.entity.PollAccountImpl; +import org.chorem.pollen.entity.PollAccountProperty; import org.chorem.pollen.entity.UserAccount; import org.chorem.pollen.entity.UserAccountDAO; import org.chorem.pollen.entity.UserAccountImpl; @@ -21,6 +23,7 @@ import org.nuiton.topia.TopiaException; import org.nuiton.topia.framework.TopiaQuery; import org.nuiton.topia.framework.TopiaQuery.Op; +import org.nuiton.util.beans.Binder; import org.nuiton.util.beans.BinderBuilder; import org.nuiton.util.beans.BinderProvider; @@ -39,13 +42,32 @@ private Log log = LogFactory.getLog(ServiceUserImpl.class); + private static final String BINDER_CONTEXT_FAVORITE_LIST = "favoriteList"; + private PollenContext context; public void setContext(PollenContext context) { this.context = context; prepareUserAccountBinder(); + prepareFavoriteListBinder(); } + @Override + protected TopiaContext beginTransaction() throws TopiaException { + return context.beginTransaction(); + } + + @Override + protected void treateError(TopiaContext transaction, Exception eee, + String message, Object... args) throws PollenException { + context.treateError(transaction, eee, message, args); + } + + @Override + protected void closeTransaction(TopiaContext transaction) { + context.closeTransaction(transaction); + } + protected void prepareUserAccountBinder() { BinderBuilder builder = new BinderBuilder(UserAccount.class, UserAccount.ADMIN, @@ -54,6 +76,14 @@ BinderProvider.registerBinder(builder); } + protected void prepareFavoriteListBinder() { + BinderBuilder builder = new BinderBuilder(PollAccount.class, + PollAccount.LIST, + PollAccount.NAME, + PollAccount.USER_ACCOUNT); + BinderProvider.registerBinder(builder, BINDER_CONTEXT_FAVORITE_LIST); + } + /** * Copy {@code source} user account to {@code destination} one. * The email is lower cased in the {@code destination} user account. @@ -72,22 +102,6 @@ } } - @Override - protected TopiaContext beginTransaction() throws TopiaException { - return context.beginTransaction(); - } - - @Override - protected void treateError(TopiaContext transaction, Exception eee, - String message, Object... args) throws PollenException { - context.treateError(transaction, eee, message, args); - } - - @Override - protected void closeTransaction(TopiaContext transaction) { - context.closeTransaction(transaction); - } - /** * Check if the {@code login} and {@code password} correspond to an * existing user. @@ -203,7 +217,6 @@ // Check email not exist checkEmailNotExist(dao, user.getEmail(), null); - // Execute create UserAccount newUser = dao.create(user.getLogin()); @@ -263,7 +276,7 @@ UserAccountDAO dao = PollenDAOHelper.getUserAccountDAO(transaction); TopiaQuery query = dao.createQuery(); - filter.prepareQueryWithOrder(query); + filter.prepareQuery(query); Map<String, UserAccount> results = dao.findAllMappedByQuery(query, UserAccount.LOGIN, String.class); @@ -284,15 +297,42 @@ } @Override - protected PollAccount executeGetNewList(TopiaContext transaction) - throws TopiaException { - throw new UnsupportedOperationException("Not supported yet."); + protected PollAccount executeGetNewList(UserAccount user) { + PollAccount result = new PollAccountImpl(); + result.setList(true); + result.setUserAccount(user); + return result; } @Override - protected void executeCreateUpdateList(TopiaContext transaction, - PollAccount list) throws TopiaException { - throw new UnsupportedOperationException("Not supported yet."); + protected void executeCreateFavoriteList(TopiaContext transaction, + PollAccount list) throws TopiaException, PollenBusinessException { + + PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction); + + // check favoriteList name exist for user + UserAccount user = list.getUserAccount(); + int count = dao.createQuery(). + add(PollAccount.LIST, true). + add(PollAccount.USER_ACCOUNT, user). + add(PollAccount.NAME, list.getName()). + executeCount(); + // existing list found + if (count > 0) { + throw new PollenBusinessException( + PollenExceptionType.FAVORITE_LIST_NAME_EXIST, + list.getName(), user.getDisplayName()); + } + + // Create unique Id for the new List + String UId = context.createPollenUrlId(); + PollAccount newList = dao.create(UId); + BinderProvider.getBinder(PollAccount.class, + BINDER_CONTEXT_FAVORITE_LIST). + copy(list, newList); + dao.update(newList); + + transaction.commitTransaction(); } @Override @@ -303,14 +343,24 @@ @Override protected List<PollAccount> executeGetFavoriteLists( - TopiaContext transaction) throws TopiaException { - throw new UnsupportedOperationException("Not supported yet."); + TopiaContext transaction, UserAccount user) throws TopiaException { + + PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction); + + TopiaQuery query = dao.createQuery(). + add(PollAccount.LIST, true). + add(PollAccount.USER_ACCOUNT, user); + + List<PollAccount> results = dao.findAllByQuery(query); + + return results; } @Override - protected PollAccount executeGetNewPerson(TopiaContext transaction, - UserAccount user) throws TopiaException { - throw new UnsupportedOperationException("Not supported yet."); + protected PollAccount executeGetNewAccount(TopiaContext transaction) + throws TopiaException { + PollAccount result = new PollAccountImpl(); + return result; } @Override @@ -320,4 +370,60 @@ throw new UnsupportedOperationException("Not supported yet."); } + @Override + protected Map<String, PollAccount> executeGetAccounts( + TopiaContext transaction, Filter filter) throws TopiaException { + + PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction); + + TopiaQuery query = createQueryFindAccountsByList(dao, filter); + + Map<String, PollAccount> results = dao.findAllMappedByQuery(query, + PollAccount.UID, String.class); + + return results; + } + + @Override + protected int executeGetNbAccounts(TopiaContext transaction, + Filter filter) throws TopiaException { + + PollAccountDAO dao = PollenDAOHelper.getPollAccountDAO(transaction); + + TopiaQuery query = createQueryFindAccountsByList(dao, filter); + + int result = query.executeCount(); + return result; + } + + /** + * Create a TopiaQuery to find all the accounts of a list with + * {@code filter} constraints (order, limit indexes, uid). + * + * @param dao used to create the query + * @param filter used to add constraint in the query + * @return the TopiaQuery created + * @see Filter#prepareQuery(TopiaQuery, boolean, PropertyUid) + */ + protected TopiaQuery createQueryFindAccountsByList(PollAccountDAO dao, + Filter filter) { + + // Property for account to find + PollAccountProperty accountProperty = new PollAccountProperty("A"); + // Property for list reference that contains the accounts + PollAccountProperty listProperty = new PollAccountProperty("L"); + + TopiaQuery query = dao.createQuery(accountProperty.name()); + query.addFrom(PollAccount.class, listProperty.name()); + query.addInElements(accountProperty.name(), + listProperty.namePropertyChild()); + // query.add("A IN elements(L." + PollAccount.CHILD + ")"); + + // Add constraints from filter, the listProperty is given to provide + // the name of its UID property. + filter.prepareQuery(query, listProperty); + + return query; + } + } Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties =================================================================== --- trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-business/src/main/resources/i18n/pollen-business-en_GB.properties 2010-04-27 16:29:41 UTC (rev 2976) @@ -35,13 +35,18 @@ pollen.error.serviceResults.importPoll= pollen.error.serviceUser.connect= pollen.error.serviceUser.createDefaultAdmin= +pollen.error.serviceUser.createFavoriteList= +pollen.error.serviceUser.createList= pollen.error.serviceUser.createUpdateList= pollen.error.serviceUser.createUpdateUser= pollen.error.serviceUser.createUser= pollen.error.serviceUser.deleteList= pollen.error.serviceUser.deleteUser= +pollen.error.serviceUser.getAccounts= pollen.error.serviceUser.getFavoriteLists= +pollen.error.serviceUser.getNbAccounts= pollen.error.serviceUser.getNbUsers= +pollen.error.serviceUser.getNewAccount= pollen.error.serviceUser.getNewList= pollen.error.serviceUser.getNewPerson= pollen.error.serviceUser.getNewUser= @@ -51,6 +56,7 @@ pollen.error.serviceVote.getVote= pollen.error.serviceVote.getVotesByPoll=Unable to load votes from poll with uid \= %1$s pollen.error.serviceVote.hasAlreadyVoted=Unable test vote existing for account with votingId \= %1$s and poll with uid \= %2$s +pollen.exception.favorite_list_name_exist= pollen.exception.load_configuration= pollen.exception.poll_not_exist=No such poll exists. Please make sure that you are using the correct link and copy it completely into your browser's address field. pollen.exception.smtp_not_available= Modified: trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties =================================================================== --- trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-business/src/main/resources/i18n/pollen-business-fr_FR.properties 2010-04-27 16:29:41 UTC (rev 2976) @@ -34,13 +34,18 @@ pollen.error.serviceResults.importPoll= pollen.error.serviceUser.connect=Impossible d'\u00E9tablir la connexion pour l'identifiant %1$s et le mot de passe encod\u00E9 %2$s pollen.error.serviceUser.createDefaultAdmin=Impossible de cr\u00E9er l'administrateur par d\u00E9faut \: %1$s (%2$s) +pollen.error.serviceUser.createFavoriteList= +pollen.error.serviceUser.createList= pollen.error.serviceUser.createUpdateList= pollen.error.serviceUser.createUpdateUser=Impossible de cr\u00E9er l'utilisateur '%1$s' <%2$s> (admin \= %$3b) pollen.error.serviceUser.createUser= pollen.error.serviceUser.deleteList= pollen.error.serviceUser.deleteUser= +pollen.error.serviceUser.getAccounts= pollen.error.serviceUser.getFavoriteLists= +pollen.error.serviceUser.getNbAccounts= pollen.error.serviceUser.getNbUsers= +pollen.error.serviceUser.getNewAccount= pollen.error.serviceUser.getNewList= pollen.error.serviceUser.getNewPerson= pollen.error.serviceUser.getNewUser=Impossible d'instancier un nouvel utilisateur. @@ -50,6 +55,7 @@ pollen.error.serviceVote.getVote= pollen.error.serviceVote.getVotesByPoll= pollen.error.serviceVote.hasAlreadyVoted= +pollen.exception.favorite_list_name_exist=La liste %1$s existe d\u00E9j\u00E0 pour l'utilisateur %2$s pollen.exception.load_configuration=La configuration n'a pas \u00E9t\u00E9 charg\u00E9e correctement \! Veuillez v\u00E9rifier le d\u00E9marrage de l'application. pollen.exception.poll_not_exist=Il n'y a pas de sondage \u00E0 cette adresse. Veuillez verifier que vous utilisez le lien correcte et copiez-le compl\u00E8tement dans le champ d'adresse de votre navigateur. pollen.exception.smtp_not_available=Impossible d'envoyer un email \u00E0 %1$s. Serveur smtp indisponible pour l'envoi d'email, veuillez contacter un administrateur. Modified: trunk/pollen-business/src/main/xmi/pollen.properties =================================================================== --- trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-business/src/main/xmi/pollen.properties 2010-04-27 16:29:41 UTC (rev 2976) @@ -5,4 +5,6 @@ model.tagvalue.exceptionClass=org.chorem.pollen.PollenException org.chorem.pollen.entity.UserAccount.attribute.login.tagvalue.naturalId=true -org.chorem.pollen.entity.UserAccount.attribute.email.tagvalue.unique=true \ No newline at end of file +org.chorem.pollen.entity.UserAccount.attribute.email.tagvalue.unique=true + +org.chorem.pollen.entity.PollAccount.attribute.uid.tagvalue.naturalId=true \ No newline at end of file Modified: trunk/pollen-business/src/main/xmi/pollen.zargo =================================================================== (Binary files differ) Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -3,7 +3,6 @@ import org.apache.tapestry5.annotations.Property; import org.apache.tapestry5.annotations.SessionState; -import org.apache.tapestry5.ioc.annotations.Inject; import org.chorem.pollen.entity.UserAccount; import org.chorem.pollen.ui.components.Border; @@ -58,6 +57,7 @@ * * @return the UserAccount corresponding to connected user */ + @Override public UserAccount getUserConnected() { return user; } @@ -76,6 +76,7 @@ * * @return true if connected user is defined. */ + @Override public boolean isUserConnected() { return userExists; } @@ -85,6 +86,7 @@ * * @return true if the connected user is an admin. */ + @Override public boolean isAdminConnected() { return isUserConnected() && user.getAdmin(); } @@ -94,6 +96,7 @@ * * @param message to display */ + @Override public void addInfo(String message) { getBorder().addInfo(message); } @@ -104,6 +107,7 @@ * * @param message to display */ + @Override public void addFatal(String message) { getBorder().addFatal(message); } @@ -113,6 +117,7 @@ * * @param message to display */ + @Override public void addError(String message) { getBorder().addError(message); } @@ -122,6 +127,7 @@ * * @return the current url of the page. */ + @Override public String getUrl() { return getBorder().getServerPath(); } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -1,6 +1,8 @@ package org.chorem.pollen.ui.base; +import org.chorem.pollen.entity.UserAccount; + /** * PollenPage * @@ -23,4 +25,54 @@ * @return true for display allowed */ boolean canDisplayPage(); + + /** + * Retrieve connected user from session. + * + * @return the user currently connected. + */ + public UserAccount getUserConnected(); + + /** + * Return true if a user is already connected to the application. + * + * @return true if connected user is defined. + */ + public boolean isUserConnected(); + + /** + * Return true if the connected user is an admin. + * + * @return true if the connected user is an admin. + */ + public boolean isAdminConnected(); + + /** + * Add an info {@code message} to display. + * + * @param message to display + */ + public void addInfo(String message) ; + + /** + * Add a fatal {@code message} to display. Only the fatal {@code message} + * will be displayed, not other elements in the page will be showed. + * + * @param message to display + */ + public void addFatal(String message); + + /** + * Add an error {@code message} to display. + * + * @param message to display + */ + public void addError(String message); + + /** + * Retrieve the current url of the page. + * + * @return the current url of the page. + */ + public String getUrl(); } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -193,10 +193,6 @@ */ void setupRender() { - // URL du site -// siteURL = "http://" + request.getHeader("host") + -// request.getContextPath() + "/"; - errorJs.addError(messages.get("errorJs")); // Logo Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -0,0 +1,96 @@ + +package org.chorem.pollen.ui.components; + +import org.apache.tapestry5.Field; +import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.InjectContainer; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.corelib.components.Form; +import org.apache.tapestry5.ioc.Messages; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.chorem.pollen.PollenBusinessException; +import org.chorem.pollen.PollenBusinessException.PollenExceptionType; +import org.chorem.pollen.entity.PollAccount; +import org.chorem.pollen.service.ServiceUser; +import org.chorem.pollen.ui.base.PollenPage; +import org.chorem.pollen.ui.services.PollenManager; +import org.slf4j.Logger; + +/** + * UserListsCreate + * + * Created: 27 avr. 2010 + * + * @author fdesbois + */ +public class UserListsCreate { + + /** Container **/ + @InjectContainer + private PollenPage page; + + /** Services injected **/ + @Inject + private Logger logger; + + @Inject + private Messages messages; + + @Inject + private PollenManager manager; + + @Inject + private ServiceUser serviceUser; + + /** Properties **/ + @Property + private PollAccount newFavoriteList; + + /** Components injected **/ + @InjectComponent + private Field listName; + + @InjectComponent + private Form createList; + + void setupRender() { + createList.clearErrors(); + } + + void onPrepareFromCreateList() { + if (newFavoriteList == null) { + if (logger.isDebugEnabled()) { + logger.debug("User connected : " + page.getUserConnected()); + } + newFavoriteList = serviceUser.getNewList(page.getUserConnected()); + } + } + + void onValidateFormFromCreateList() { + try { + serviceUser.createFavoriteList(newFavoriteList); + } catch (PollenBusinessException eee) { + String message = manager.getErrorMessage(eee, messages, logger); + + if (logger.isDebugEnabled()) { + logger.debug(message); + } + if (eee.getType().equals( + PollenExceptionType.FAVORITE_LIST_NAME_EXIST)) { + createList.recordError(listName, message); + } else { + createList.recordError(message); + } + } + } + + Object onSuccessFromCreateList() { + page.addInfo(messages.format("pollen.ui.list.create.success", + newFavoriteList.getName())); + return page; + } + + Object onFailureFromCreateList() { + return createList; + } +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsCreate.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -0,0 +1,104 @@ + +package org.chorem.pollen.ui.components; + +import java.util.List; +import org.apache.commons.lang.StringUtils; +import org.apache.tapestry5.ComponentResources; +import org.apache.tapestry5.ValidationException; +import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.Parameter; +import org.apache.tapestry5.annotations.Persist; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.corelib.components.Zone; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.chorem.pollen.entity.PollAccount; +import org.chorem.pollen.entity.PollAccountImpl; +import org.chorem.pollen.service.ServiceUser; +import org.chorem.pollen.ui.data.EvenOdd; +import org.slf4j.Logger; + +/** + * UserListsUpdate + * + * Created: 27 avr. 2010 + * + * @author fdesbois + * @version $Revision$ + * + * Mise a jour: $Date$ + * par : $Author$ + */ +public class UserListsUpdate { + + @Parameter(required = true) + @Property + private List<PollAccount> source; + + @Inject + private Logger logger; + + @Inject + private ComponentResources resources; + + @Inject + private ServiceUser serviceUser; + + @Persist + @Property + private PollAccount favoriteListSelected; + + private EvenOdd evenOdd; + + @Property + private PollAccount account; + + @Property + private PollAccount newAccount; + + @InjectComponent + private Zone updateZone; + + void setupRender() { + resources.discardPersistentFieldChanges(); + } + + public EvenOdd getEvenOdd() { + if (evenOdd == null) { + evenOdd = new EvenOdd(); + } + return evenOdd; + } + + public boolean canDisplayAccounts() { + return favoriteListSelected != null; + } + + void onActionFromRemoveAccount(String UId) { + PollAccount child = favoriteListSelected.getChildByUId(UId); + favoriteListSelected.removeChild(child); + } + + void onPrepareFromAddAccount() { + if (newAccount == null) { + // TEMP + newAccount = new PollAccountImpl(); + } + } + +// void onValidateFromEmail(String input) throws ValidationException { +// String test = StringUtils.lowerCase(input); +// for (PollAccount curr : favoriteListSelected.getChild()) { +// if (test.equals(curr.getEmail())) { +// throw new ValidationException("NOT ALLOWED"); +// } +// } +// } + + Object onSuccessFromAddAccount() { + favoriteListSelected.addChild(newAccount); + if (logger.isDebugEnabled()) { + logger.debug("Add account : " + newAccount); + } + return updateZone.getBody(); + } +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/UserListsUpdate.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/ChoiceField.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -64,7 +64,7 @@ setTextType(); break; case IMAGE: - setImageType(poll.getUId()); + setImageType(poll.getUid()); } } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CloseValidation.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -117,7 +117,7 @@ * @return l'identifiant. */ public String getAdminId() { - return poll.getUId() + ":" + creator.getUId(); + return poll.getUid() + ":" + creator.getUid(); } void onActivate() { Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/CreationValidation.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -113,7 +113,7 @@ * @return l'identifiant. */ public String getAdminId() { - return poll.getUId() + ":" + creator.getUId(); + return poll.getUid() + ":" + creator.getUid(); } void onActivate() { Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/ModificationValidation.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -115,7 +115,7 @@ public String getAdminId() { // FIXME : user PollUri - return poll.getUId() + ":" + creator.getUId(); + return poll.getUid() + ":" + creator.getUid(); } void onActivate() { Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/Results.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -490,7 +490,7 @@ userAllowed = true; } else if (id.split(":", 2).length == 2) { String creatorId = id.split(":", 2)[1]; - if (creatorId.equals(creator.getUId())) { + if (creatorId.equals(creator.getUid())) { userAllowed = true; } } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/poll/VoteForPoll.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -1097,7 +1097,7 @@ } if (pollAccount == null) { - pollAccount = serviceUser.getNewPerson(getUserConnected());//new PollAccountDTO(); + // pollAccount = serviceUser.getNewPerson(getUserConnected());//new PollAccountDTO(); // if (userExists) { // if (user.getFirstName() != null && user.getLastName() != null) { // pollAccount.setVotingId( Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -16,29 +16,24 @@ package org.chorem.pollen.ui.pages.user; +import java.util.List; -import org.apache.commons.fileupload.FileUploadException; import org.apache.tapestry5.BindingConstants; -import org.apache.tapestry5.ComponentResources; -import org.apache.tapestry5.annotations.Component; import org.apache.tapestry5.annotations.IncludeStylesheet; import org.apache.tapestry5.annotations.InjectComponent; import org.apache.tapestry5.annotations.Parameter; +import org.apache.tapestry5.annotations.Persist; import org.apache.tapestry5.annotations.Property; -import org.apache.tapestry5.annotations.Retain; -import org.apache.tapestry5.beaneditor.BeanModel; -import org.apache.tapestry5.corelib.components.Form; -import org.apache.tapestry5.corelib.components.Zone; import org.apache.tapestry5.ioc.Messages; import org.apache.tapestry5.ioc.annotations.Inject; -import org.apache.tapestry5.services.BeanModelSource; -import org.apache.tapestry5.upload.services.UploadedFile; import org.chorem.pollen.entity.PollAccount; +import org.chorem.pollen.service.ServiceUser; import org.chorem.pollen.ui.base.AbstractPollenPage; import org.chorem.pollen.ui.components.Border; -import org.chorem.pollen.ui.components.FeedBack; +import org.chorem.pollen.ui.data.AddressBar; import org.chorem.pollen.ui.data.EvenOdd; -import org.chorem.pollen.ui.data.AddressBarItem; +import org.chorem.pollen.ui.services.PollenManager; +import org.slf4j.Logger; /** * Classe de la page d'affichage des listes de votants favorites de @@ -46,6 +41,7 @@ * de s'identifier via un formulaire. * * @author rannou + * @author fdesbois <fdesbois@codelutin.com> * @version $Id$ */ @IncludeStylesheet("context:css/lists.css") @@ -54,129 +50,151 @@ @InjectComponent private Border border; + /** Page title from Messages **/ + @Parameter(defaultPrefix = BindingConstants.MESSAGE, + value = "pollen.page.UserLists.title") + @Property + private String title; + + @Inject + private ServiceUser serviceUser; + + private List<PollAccount> favoriteLists; + @Override public Border getBorder() { return border; } - /** Affichage des messages pour l'utilisateur */ - @Component(id = "feedback") - private FeedBack feedback; + @Override + public boolean isNeedAuthentification() { + return true; + } - /** - * Listes de favoris de l'utilisateur. - */ -// @Property -// private List<PersonListDTO> lists; + @Override + public boolean canDisplayPage() { + return isUserConnected(); + } + + public AddressBar getAddressBar() { + return AddressBar.newBar().appendCurrent(title); + } + public List<PollAccount> getFavoriteLists() { + if (favoriteLists == null) { + favoriteLists = serviceUser.getFavoriteLists(getUserConnected()); + } + return favoriteLists; + } + + +// // /** // * Liste de favoris sélectionnée. // */ // @Persist // @Property // private PersonListDTO selectedList; -// + // /** // * Nouvelle liste de favoris. // */ // @Property // private PersonListDTO newList; - - /** - * Compte courant (pour l'itération des votants de la liste). - */ - @SuppressWarnings("unused") - @Property - private PollAccount account; - - /** - * Nouveau compte. - */ - @Property - private PollAccount newAccount; - - /** - * Fichier CSV contenant une liste de votants. - */ - @Property - private UploadedFile accountsFile; - - /** - * URL de recherche LDAP pour une liste de votants. - */ - @Property - private String accountsUrl; - - /** - * Zone à rafraîchir. - */ - @InjectComponent - private Zone listsZone; - - /** - * Formulaire de création de liste. - */ - @Component - private Form createListForm; - - /** - * Formulaire de création de compte. - */ - @Component - private Form createAccountForm; - - /** - * Messages. - */ - @Inject - private Messages messages; - - /** - * Objet servant à changer la couleur à chaque ligne de la liste. - */ - @SuppressWarnings("unused") - @Property - private EvenOdd evenOdd; - - @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title") - @Property - private String title; - - @SuppressWarnings("unused") - @Property - private AddressBarItem[] address; - - /** - * Sert à créer listModel. - */ - @Inject - private BeanModelSource beanModelSource; - - /** - * Sert à passer les messages en paramètre de la création de listModel. - */ - @Inject - private ComponentResources componentResources; - - /** - * Modèle pour l'affichage de la liste des favoris. - */ - @SuppressWarnings("unchecked") - @Property - @Retain - private BeanModel listModel; - - /** Injection des services */ +// +// /** +// * Compte courant (pour l'itération des votants de la liste). +// */ +// @SuppressWarnings("unused") +// @Property +// private PollAccountDTO account; +// +// /** +// * Nouveau compte. +// */ +// @Property +// private PollAccountDTO newAccount; +// +// /** +// * Fichier CSV contenant une liste de votants. +// */ +// @Property +// private UploadedFile accountsFile; +// +// /** +// * URL de recherche LDAP pour une liste de votants. +// */ +// @Property +// private String accountsUrl; +// +// /** +// * Zone à rafraîchir. +// */ +// @InjectComponent +// private Zone listsZone; +// +// /** +// * Formulaire de création de liste. +// */ +// @Component +// private Form createListForm; +// +// /** +// * Formulaire de création de compte. +// */ +// @Component +// private Form createAccountForm; +// +// /** +// * Messages. +// */ // @Inject +// private Messages messages; +// +// /** +// * Objet servant à changer la couleur à chaque ligne de la liste. +// */ +// @SuppressWarnings("unused") +// +// @Parameter(defaultPrefix = BindingConstants.MESSAGE, value = "title") +// @Property +// private String title; +// +// @SuppressWarnings("unused") +// @Property +// private AddressBarItem[] address; +// +// /** +// * Sert à créer listModel. +// */ +// @Inject +// private BeanModelSource beanModelSource; +// +// /** +// * Sert à passer les messages en paramètre de la création de listModel. +// */ +// @Inject +// private ComponentResources componentResources; +// +// /** +// * Modèle pour l'affichage de la liste des favoris. +// */ +// @SuppressWarnings("unchecked") +// @Property +// @Retain +// private BeanModel listModel; +// +// /** Injection des services */ +// @Inject // private ServiceList serviceList; // @Inject // private ServicePollAccount servicePollAccount; - - /** - * Méthode appelée à la création d'une liste. - */ - Object onSuccessFromCreateListForm() { // +// /** +// * Méthode appelée à la création d'une liste. +// */ +// Object onSuccessFromCreateListForm() { +// // // Contrôle du nom de la liste // for (PersonListDTO list : lists) { // if (list.getName().equals(newList.getName())) { @@ -226,14 +244,14 @@ // selectedList = list; // } // } - - return this; - } - - /** - * Méthode appelée à la suppression d'une liste. - */ - Object onActionFromDeleteList() { +// +// return this; +// } +// +// /** +// * Méthode appelée à la suppression d'une liste. +// */ +// Object onActionFromDeleteList() { // if (selectedList != null) { // for (PersonListDTO dto : lists) { // if (dto.getId().equals(selectedList.getId())) { @@ -248,15 +266,15 @@ // } // } // selectedList = null; - return this; - } - - /** - * Méthode appelée à la création d'un compte. - */ - Object onSuccessFromCreateAccountForm() { - // TODO : use onValidateForm method : test return block, may be - // a problem between failure and success +// return this; +// } +// +// /** +// * Méthode appelée à la création d'un compte. +// */ +// Object onSuccessFromCreateAccountForm() { +// // TODO : use onValidateForm method : test return block, may be +// // a problem between failure and success // for (PollAccountDTO dto : selectedList.getPollAccounts()) { // if (dto.getVotingId().equals(newAccount.getVotingId())) { // createAccountForm.recordError(messages.format("accountExists", @@ -270,67 +288,42 @@ //// selectedList = serviceList.findPersonListById(selectedList.getId()); // serviceList.createAccountInPersonList(selectedList, account); // } - return listsZone.getBody(); - } - - /** - * Méthode appelée à la suppression d'un compte. - */ - Object onActionFromDeleteAccount(String accountId) { -// Iterator<PollAccountDTO> it = selectedList.getPollAccounts() -// .iterator(); -// while (it.hasNext()) { -// if (accountId.equals(it.next().getId())) { -// it.remove(); -// } -// } -// serviceList.updatePersonList(selectedList); -// servicePollAccount.deletePollAccount(accountId); -// selectedList = serviceList.findPersonListById(selectedList.getId()); +// return listsZone.getBody(); +// } +// +// /** +// * Méthode appelée à la suppression d'un compte. +// */ +// Object onActionFromDeleteAccount(String accountId) { +//// Iterator<PollAccountDTO> it = selectedList.getPollAccounts() +//// .iterator(); +//// while (it.hasNext()) { +//// if (accountId.equals(it.next().getId())) { +//// it.remove(); +//// } +//// } +//// serviceList.updatePersonList(selectedList); +//// servicePollAccount.deletePollAccount(accountId); +//// selectedList = serviceList.findPersonListById(selectedList.getId()); // serviceList.deleteAccountFromPersonList(selectedList, accountId); - return listsZone.getBody(); - } - - /** - * Récupération des exceptions du champs d'upload de fichier. - */ - Object onUploadException(FileUploadException ex) { - createListForm.recordError("Upload exception: " + ex.getMessage()); - return this; - } - +// return listsZone.getBody(); +// } +// +// /** +// * Récupération des exceptions du champs d'upload de fichier. +// */ +// Object onUploadException(FileUploadException ex) { +// createListForm.recordError("Upload exception: " + ex.getMessage()); +// return this; +// } +// // /** Retourne vrai s'il n'existe aucune liste */ // public boolean isListsNull() { -// return lists == null || lists.size() == 0; +// return CollectionUtils.isEmpty(lists); // } // // /** Retourne vrai si la liste sélectionnée est vide */ // public boolean isSelectedListNull() { // return selectedList == null; // } - - /** - * Méthode d'initialisation des listes de favoris. - */ - void onActivate() { - evenOdd = new EvenOdd(); -// if (userExists) { -// lists = serviceList.findPersonListByUser(user.getId()); -// } -// newList = new PersonListDTO(); -// newAccount = new PollAccountDTO(); - } - - /** - * Initialisation de l'affichage - */ - void setupRender() { - address = new AddressBarItem[] { new AddressBarItem("Pollen", "Index"), - new AddressBarItem(title, null) }; - - listModel = beanModelSource.createDisplayModel(PollAccount.class, - componentResources.getMessages()); - listModel.add("functions", null); - listModel.include("votingId", "email", "functions"); - } } \ No newline at end of file Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserPollsParticipated.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -77,7 +77,7 @@ // } // } // } - return poll.getUId(); + return poll.getUid(); } /** Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -13,10 +13,8 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - package org.chorem.pollen.ui.services; -import java.util.Locale; import org.apache.tapestry5.SymbolConstants; import org.apache.tapestry5.ioc.Configuration; import org.apache.tapestry5.ioc.MappedConfiguration; @@ -29,10 +27,11 @@ import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.services.ApplicationStateContribution; import org.apache.tapestry5.services.ApplicationStateCreator; +import org.apache.tapestry5.services.BindingFactory; +import org.apache.tapestry5.services.BindingSource; import org.apache.tapestry5.upload.services.UploadSymbols; import org.chorem.pollen.PollenContextImpl; import org.chorem.pollen.entity.UserAccount; -import org.chorem.pollen.entity.UserAccountImpl; import org.chorem.pollen.service.ServiceEmail; import org.chorem.pollen.service.ServiceEmailImpl; import org.chorem.pollen.service.ServicePoll; @@ -103,9 +102,9 @@ public static void contributeRegistryStartup( OrderedConfiguration<Runnable> configuration, ServiceUser serviceUser, - PollenManager manager, + PollenManager manager, RegistryShutdownHub shutdownHub) { - + if (logger.isInfoEnabled()) { logger.info("Execute contributeRegistryStartup"); } @@ -186,10 +185,10 @@ configuration.add( new CoercionTuple<String, PollUri>( - String.class, PollUri.class, coercion1)); + String.class, PollUri.class, coercion1)); configuration.add( new CoercionTuple<PollUri, String>( - PollUri.class, String.class, coercion2)); + PollUri.class, String.class, coercion2)); } /** @@ -204,16 +203,13 @@ // .getComponentResources().getMessages(); // return new BackgroundWorkerImpl(messages, servicePoll, context); // } - - /** * Used to instanciate SessionState UserAccount when session expires. * * @param configuration to add the ApplicationStateCreator. * @param serviceUser to instantiate user */ - public void contributeApplicationStateManager(MappedConfiguration<Class<?>, - ApplicationStateContribution> configuration, + public void contributeApplicationStateManager(MappedConfiguration<Class<?>, ApplicationStateContribution> configuration, final ServiceUser serviceUser) { if (logger.isInfoEnabled()) { logger.info("Execute contributeApplicationStateManager"); @@ -221,13 +217,20 @@ ApplicationStateCreator<UserAccount> creator = new ApplicationStateCreator<UserAccount>() { - @Override - public UserAccount create() { - return serviceUser.getNewUser(); - } - }; + @Override + public UserAccount create() { + return serviceUser.getNewUser(); + } + }; + configuration.add(UserAccount.class, new ApplicationStateContribution("session", creator)); } + + public static void contributeBindingSource( + MappedConfiguration<String, BindingFactory> configuration, + BindingSource bindingSource) { + configuration.add("format", new FormatBindingFactory(bindingSource)); + } } Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBinding.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBinding.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBinding.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -0,0 +1,72 @@ +package org.chorem.pollen.ui.services; + +import java.util.ArrayList; +import java.util.List; +import org.apache.tapestry5.Binding; +import org.apache.tapestry5.internal.bindings.AbstractBinding; +import org.apache.tapestry5.ioc.Location; +import org.apache.tapestry5.ioc.Messages; + +/** + * From <http://wiki.apache.org/tapestry/Tapestry5HowToAddMessageFormatBindingPrefix> + * + * Created: 27 avr. 2010 + * + * @author fdesbois + */ +public class FormatBinding extends AbstractBinding { + + private final Messages messages; + private final boolean invariant; + private final List<Binding> keyBindings; + private final List<Binding> valueBindings; + + public FormatBinding(Location location, Messages messages, boolean invariant, + ArrayList<Binding> keyBindings, List<Binding> valueBindings) { + super(location); + + this.messages = messages; + this.invariant = invariant; + this.keyBindings = keyBindings; + this.valueBindings = valueBindings; + } + + public FormatBinding(Location location, Messages messages, boolean invariant, ArrayList<Binding> keyBindings) { + super(location); + + this.messages = messages; + this.invariant = invariant; + this.keyBindings = keyBindings; + this.valueBindings = null; + } + + @Override + public Object get() { + String key = ""; + for (Binding keyBinding : keyBindings) { + key += keyBinding.get(); + } + + if (null == valueBindings) { + return messages.get(key); + } + + List<Object> values = new ArrayList<Object>(valueBindings.size()); + for (Binding valueBinding : valueBindings) { + values.add(valueBinding.get()); + } + + return messages.format(key, values.toArray()); + } + + @Override + public boolean isInvariant() { + return this.invariant; + } + + @SuppressWarnings("unchecked") + @Override + public Class<?> getBindingType() { + return String.class; + } +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBinding.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBindingFactory.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBindingFactory.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBindingFactory.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -0,0 +1,79 @@ +package org.chorem.pollen.ui.services; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.apache.tapestry5.Binding; +import org.apache.tapestry5.BindingConstants; +import org.apache.tapestry5.ComponentResources; +import org.apache.tapestry5.ioc.Location; +import org.apache.tapestry5.services.BindingFactory; +import org.apache.tapestry5.services.BindingSource; + +/** + * From <http://wiki.apache.org/tapestry/Tapestry5HowToAddMessageFormatBindingPrefix> + * + * Created: 27 avr. 2010 + * + * @author fdesbois + */ +public class FormatBindingFactory + implements BindingFactory { + + private static final String SEPARATOR = "="; + private static final String DELIMITER = ","; + private static final String KEY_PREFIX = BindingConstants.LITERAL; + private static final String VALUE_PREFIX = BindingConstants.PROP; + private final BindingSource bindingSource; + + public FormatBindingFactory(BindingSource bindingSource) { + this.bindingSource = bindingSource; + } + + @Override + public Binding newBinding(String description, ComponentResources container, ComponentResources component, + String expression, Location location) { + int separatorIndex = expression.indexOf(SEPARATOR); + + if (-1 == separatorIndex) { + List<String> keys = Arrays.asList(expression.split(DELIMITER)); + + ArrayList<Binding> keyBindings = createBindings(description, container, component, KEY_PREFIX, keys, location); + + boolean invariant = isInvariant(keyBindings); + return new FormatBinding(location, container.getMessages(), invariant, keyBindings); + } + + List<String> keys = Arrays.asList(expression.substring(0, separatorIndex).split(DELIMITER)); + ArrayList<Binding> keyBindings = createBindings(description, container, component, KEY_PREFIX, keys, location); + + List<String> values = Arrays.asList(expression.substring(separatorIndex + 1).split(DELIMITER)); + ArrayList<Binding> valueBindings = createBindings(description, container, component, VALUE_PREFIX, values, + location); + + boolean invariant = isInvariant(keyBindings) && isInvariant(valueBindings); + return new FormatBinding(location, container.getMessages(), invariant, keyBindings, valueBindings); + } + + private ArrayList<Binding> createBindings(String description, ComponentResources container, + ComponentResources component, String defaultPrefix, + List<String> expressions, Location location) { + ArrayList<Binding> bindings = new ArrayList<Binding>(expressions.size()); + + for (String expression : expressions) { + bindings.add(bindingSource.newBinding(description, container, component, defaultPrefix, expression, location)); + } + + return bindings; + } + + private boolean isInvariant(ArrayList<Binding> bindings) { + for (Binding binding : bindings) { + if (!binding.isInvariant()) { + return false; + } + } + + return true; + } +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/FormatBindingFactory.java ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/PollenManager.java 2010-04-27 16:29:41 UTC (rev 2976) @@ -33,7 +33,6 @@ import org.chorem.pollen.PollenContext; import org.chorem.pollen.PollenProperty; import org.chorem.pollen.service.ServiceUser; -import org.chorem.pollen.ui.base.PollenPage; import org.nuiton.util.ApplicationConfig; import org.slf4j.Logger; Modified: trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties =================================================================== --- trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-27 16:29:41 UTC (rev 2976) @@ -1,12 +1,16 @@ ############################ PAGES ############################################# pollen.page.AdminUsers.title=Gestion des utilisateurs +pollen.page.UserLists.title=Vos listes de votants ############################ EMAIL ############################################# pollen.email.userRegister.subject=[Pollen] Confirmation de cr\u00E9ation du compte %s pollen.email.userRegister.content=Bienvenue %1$s. Vous venez de cr\u00E9er un compte sur l'application de sondage en ligne Pollen.\n\nIdentifiant : %2$s\nMot de passe : %3$s\n\nVous pouvez d\u00E8s maintenant g\u00E9rer vos sondages en vous identifiant sur le site : \n%4$s ############################ GLOBAL ############################################ -pollen.ui.help.title=Aide +pollen.ui.tooltip.help=Aide +pollen.ui.button.add=Ajouter +pollen.ui.button.create=Cr\u00E9er +pollen.ui.button.ok=Ok ############################ USER ############################################## pollen.ui.user.register.autoConnection=Vous \u00EAtes maintenant connect\u00E9 avec l'identifiant %1$s. @@ -15,26 +19,38 @@ pollen.ui.user.update.success=Modification enregistr\u00E9e avec succ\u00E8s. pollen.ui.user.display.notConnected=Vous devez vous connecter pour acc\u00E9der \u00E0 cette page. pollen.ui.user.display.notAllowed=Vous n'avez pas les droits n\u00E9cessaires pour acc\u00E9der \u00E0 cette page. -pollen.ui.user.create=Ajouter pollen.ui.user.create.title=Cr\u00E9er un nouvel utilisateur pollen.ui.user.create.passwordGenerated=Le mot de passe du nouvel utilisateur a \u00E9t\u00E9 g\u00E9n\u00E9r\u00E9. pollen.ui.user.create.passwordSameAsLogin=Le mot de passe du nouvel utilisateur est le m\u00EAme que son identifiant. -pollen.ui.user.create.password.help=Si vous pr\u00E9cisez un email, un mot de passe sera g\u00E9n\u00E9r\u00E9 et envoy\u00E9 \u00E0 l'utilisateur. Sinon le mot de passe sera identique au login. +pollen.ui.user.create.passwordHelp=Si vous pr\u00E9cisez un email, un mot de passe sera g\u00E9n\u00E9r\u00E9 et envoy\u00E9 \u00E0 l'utilisateur. Sinon le mot de passe sera identique au login. pollen.ui.user.create.sendEmail=Un email a \u00E9t\u00E9 envoy\u00E9 au nouvel utilisateur %1$s \u00E0 l'adresse %2$s. pollen.ui.user.create.emailFailedShowPassword=Le mot de passe g\u00E9n\u00E9r\u00E9 est le suivant : %1$s pollen.ui.user.create.success=L'utilisateur %1$s a \u00E9t\u00E9 cr\u00E9\u00E9 avec succ\u00E8s. +pollen.ui.user.nbUsers=%1$d utilisateurs existants. pollen.ui.user.update.edit=Modifier cet utilisateur. pollen.ui.user.update.save=Enregistrer les modifications. pollen.ui.user.update.cancel=Annuler les changements. pollen.ui.user.delete=Supprimer cet utilisateur. pollen.ui.user.delete.confirmMessage=Etes-vous s\u00FBr de vouloir d\u00E9finitivement supprimer cet utilisateur ? +pollen.ui.list.create.title=Cr\u00E9er une nouvelle liste +pollen.ui.list.create.success=La liste %1$s a \u00E9t\u00E9 cr\u00E9\u00E9e avec succ\u00E8s. +pollen.ui.list.update.notSelected=Aucune liste s\u00E9lectionn\u00E9e. +pollen.ui.list.update.emptyList=Liste vide. Ajoutez des votants en saisissant leur nom et email. +pollen.ui.list.update.addAccount=Ajouter un nouvel utilisateur \u00E0 la liste # FORM:: user firstName-label=Pr\u00E9nom lastName-label=Nom login-label=Identifiant email-label=Email +email-regexp=^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$ +email-regexp-message=Adresse email invalide. +# FORM:: favorite list +listSelect-label= Liste +listName-label= Nom +name-label= Nom + ############################ CHOICE ############################################ pollen.ui.choice.delete.confirm=Etes-vous s\u00FBr de vouloir d\u00E9finitivement supprimer ce choix ? pollen.ui.choice.delete.title=Supprimer ce choix Added: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsCreate.tml =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsCreate.tml (rev 0) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsCreate.tml 2010-04-27 16:29:41 UTC (rev 2976) @@ -0,0 +1,34 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<body xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> + <t:zone t:id="createZone" t:update="show"> + <form t:type="form" t:id="createList" action="tapestry" t:zone="createZone"> + <div id="createListFormDiv"> + <t:errors/> + <fieldset> + <legend>${message:pollen.ui.list.create.title}</legend> + <div> + <label t:type="label" for="listName" />* : + <input t:type="textfield" t:id="listName" value="newFavoriteList.name" t:validate="required"/> + </div> + <!-- <div> + <t:label for="accountsFile" /> + <input t:type="upload" t:id="accountsFile" /> + <span t:type="ck/Tooltip" title="${message:help}" value="${message:accountsFile-help}" effect="appear"> + <img src="${asset:context:img/help.png}" alt="${message:help}"/> + </span> + </div> + <div> + <t:label for="accountsUrl" /> + <t:textfield t:id="accountsUrl" t:value="accountsUrl" /> + <span t:type="ck/Tooltip" title="${message:help}" value="${message:accountsUrl-help}" effect="appear"> + <img src="${asset:context:img/help.png}" alt="${message:help}"/> + </span> + </div>--> + <div class="buttons"> + <input t:type="submit" value="${message:pollen.ui.button.create}"/> + </div> + </fieldset> + </div> + </form> + </t:zone> +</body> Property changes on: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsCreate.tml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Added: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml (rev 0) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml 2010-04-27 16:29:41 UTC (rev 2976) @@ -0,0 +1,63 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<body xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> + <t:zone t:id="updateZone" show="show" update="show"> + + <form t:type="form" t:id="selectListForm" action="tapestry"> + <div> + ${message:listSelect-label}: + <select t:id="listSelect" t:type="ck/beanSelect" t:list="source" t:value="favoriteListSelected" + t:labelField="literal:name" t:valueField="literal:name" /> + <input t:type="submit" value="${message:pollen.ui.button.ok}"/> + </div> + </form> + + <t:if test="canDisplayAccounts()"> + <!-- Display all Accounts child of favoriteListSelected --> + <div t:type="grid" t:source="favoriteListSelected.child" t:row="account" + t:include="name, email, weight" t:add="actions" + t:rowsPerPage="20" t:rowClass="prop:evenodd.next" t:inPlace="true"> + <p:actionsCell> + <a t:type="actionlink" t:id="removeAccount" t:context="account.UId"> + <img src="${asset:context:img/delete.png}" alt="${message:pollen.ui.list.remove}"/> + </a> + </p:actionsCell> + <p:empty> + ${message:pollen.ui.list.update.emptyList} + </p:empty> + </div> + + <!-- Add a new PollAccount to favoriteListSelected --> + <form t:type="form" t:id="addAccount" t:zone="updateZone" action="tapestry"> + <table class="t-data-grid"> + <tr> + <td class="votingId"> + <input t:type="textfield" t:id="name" t:value="newAccount.name" t:validate="required" size="10"/> + </td> + <td class="email"> + <input t:type="textfield" t:id="email" t:value="newAccount.email" t:validate="email" size="15"/> + </td> + <td class="weight"> + <input t:type="textfield" t:id="weight" t:value="newAccount.weight" size="5"/> + </td> + <td class="functions"> + <input t:type="submit" value="${message:pollen.ui.button.add}" title="${message:pollen.ui.list.update.addAccount}"/> + </td> + </tr> + </table> + <t:errors/> + </form> + + <!-- Delete the favoriteListSelected --> +<!-- <p> + <a t:type="actionlink" t:id="deleteList"> + <img src="${asset:context:img/delete.png}" alt="Delete"/>${message:deleteList} + </a> + </p>--> + + <p:else> + ${message:pollen.ui.list.update.notSelected} + </p:else> + </t:if> + + </t:zone> +</body> Property changes on: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/UserListsUpdate.tml ___________________________________________________________________ Added: svn:keywords + "Author Date Id Revision HeadURL" Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserLists_fr.properties =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserLists_fr.properties 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/pages/user/UserLists_fr.properties 2010-04-27 16:29:41 UTC (rev 2976) @@ -1,31 +1,31 @@ -title=Vos listes de votants -accountExists=L'identifiant de vote %s existe d\u00E9j\u00E0 dans cette liste. -listExists=La liste %s existe d\u00E9j\u00E0. -invalidCsv=Le fichier %s n'est pas un fichier CSV. -noAccountCsv=Le fichier %s ne contient aucune entr\u00E9e valide. -noAccountLdap=L'URL %s ne permet pas d'obtenir d'entr\u00E9es valides. -noUser=Vous devez \u00EAtre identifi\u00E9 pour pouvoir acc\u00E9der \u00E0 vos listes de votants.\n Veuillez remplir le formulaire ci-dessous. -noList=Aucune liste s\u00E9lectionn\u00E9e. -emptyList=Liste vide. Ajoutez des votants en saisissant leur nom et email. -listSelect-label=Liste -listDeleted=La liste %s a \u00E9t\u00E9 supprim\u00E9e. -listNotDeleted=Erreur lors de la suppression de la liste %s. - -#list -votingId-label=Nom -votingId-required-message=Vous devez fournir un nom. -email-label=Em@il -email-regexp=^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$ -email-regexp-message=Adresse email invalide. -email-required-message=Vous devez fournir une adresse email. -functions-label=Fonctions -deleteList=Supprimer la liste - -#new list -createListLegend=Cr\u00E9er une nouvelle liste -listName-label=Nom * -listName-required-message=Vous devez fournir un nom. -accountsFile-label=Import CSV -accountsFile-help=Vous pouvez importer une liste \u00E0 partir d'un fichier CSV contenant un votant par ligne (nom, email) -accountsUrl-label=Import LDAP -accountsUrl-help=Vous pouvez importer une liste en utilisant une URL de recherche LDAP (ldap[s]://<hostname>:<port>/<base_dn>?<attributes>?<scope>?<filter>) Les entr\u00E9es doivent contenir les attributs cn et mail \ No newline at end of file +#title=Vos listes de votants +#accountExists=L'identifiant de vote %s existe d\u00E9j\u00E0 dans cette liste. +#listExists=La liste %s existe d\u00E9j\u00E0. +#invalidCsv=Le fichier %s n'est pas un fichier CSV. +#noAccountCsv=Le fichier %s ne contient aucune entr\u00E9e valide. +#noAccountLdap=L'URL %s ne permet pas d'obtenir d'entr\u00E9es valides. +#noUser=Vous devez \u00EAtre identifi\u00E9 pour pouvoir acc\u00E9der \u00E0 vos listes de votants.\n Veuillez remplir le formulaire ci-dessous. +#noList=Aucune liste s\u00E9lectionn\u00E9e. +#emptyList=Liste vide. Ajoutez des votants en saisissant leur nom et email. +#listSelect-label=Liste +#listDeleted=La liste %s a \u00E9t\u00E9 supprim\u00E9e. +#listNotDeleted=Erreur lors de la suppression de la liste %s. +# +##list +#votingId-label=Nom +#votingId-required-message=Vous devez fournir un nom. +#email-label=Em@il +#email-regexp=^([a-zA-Z0-9_.+-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$ +#email-regexp-message=Adresse email invalide. +#email-required-message=Vous devez fournir une adresse email. +#functions-label=Fonctions +#deleteList=Supprimer la liste +# +##new list +#createListLegend=Cr\u00E9er une nouvelle liste +#listName-label=Nom * +#listName-required-message=Vous devez fournir un nom. +#accountsFile-label=Import CSV +#accountsFile-help=Vous pouvez importer une liste \u00E0 partir d'un fichier CSV contenant un votant par ligne (nom, email) +#accountsUrl-label=Import LDAP +#accountsUrl-help=Vous pouvez importer une liste en utilisant une URL de recherche LDAP (ldap[s]://<hostname>:<port>/<base_dn>?<attributes>?<scope>?<filter>) Les entr\u00E9es doivent contenir les attributs cn et mail \ No newline at end of file Modified: trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml =================================================================== --- trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/webapp/admin/AdminUsers.tml 2010-04-27 16:29:41 UTC (rev 2976) @@ -3,7 +3,7 @@ xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> <h1 class="titleIndex">${title}</h1> - + <p class="center"><strong>${format:pollen.ui.user.nbUsers=accounts.availableRows}</strong></p> <t:zone t:id="usersZone" t:update="show"> <t:form t:id="usersForm" t:zone="usersZone"> <t:if t:test="accountEdited"> @@ -71,10 +71,10 @@ <input t:type="textfield" t:id="newLogin" value="newUser.login" t:validate="required" /> <label t:type="label" for="newEmail">${message:email-label}</label> : <input t:type="textfield" t:id="newEmail" value="newUser.email" t:validate="regexp" /> - <span t:type="ck/Tooltip" title="message:pollen.ui.help.title" t:value="message:pollen.ui.user.create.password.help" t:effect="appear"> + <span t:type="ck/Tooltip" title="message:pollen.ui.tooltip.help" t:value="message:pollen.ui.user.create.passwordHelp" t:effect="appear"> <img src="${asset:context:img/help.png}" alt="message:help"/> </span> - <input t:type="submit" value="${message:pollen.ui.user.create}" title="${message:pollen.ui.user.create.title}" /> + <input t:type="submit" value="${message:pollen.ui.button.add}" title="${message:pollen.ui.user.create.title}" /> </p> </form> </t:zone> Modified: trunk/pollen-ui/src/main/webapp/css/lists.css =================================================================== --- trunk/pollen-ui/src/main/webapp/css/lists.css 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/webapp/css/lists.css 2010-04-27 16:29:41 UTC (rev 2976) @@ -25,11 +25,11 @@ text-align: left; } -#createListFormDiv label { +/*#createListFormDiv label { display: block; width: 80px; float: left; -} +}*/ #createListForm div { margin-bottom: 10px; Modified: trunk/pollen-ui/src/main/webapp/user/UserLists.tml =================================================================== --- trunk/pollen-ui/src/main/webapp/user/UserLists.tml 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pollen-ui/src/main/webapp/user/UserLists.tml 2010-04-27 16:29:41 UTC (rev 2976) @@ -1,110 +1,15 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<t:border t:addressBar="addressBar" t:pageLogo="literal:Creation" t:pageTitle="prop:title" + xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> -<t:border t:address="address" t:pageLogo="literal:Creation" - xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> - - <t:feedback t:id="feedback"/> - <h1 class="titleCreation">${message:title}</h1> - <t:if test="userExists"> - <div id="listsDiv"> - - <t:unless test="listsNull"> - <t:zone t:id="listsZone" show="show" update="show"> - - - <!-- Sélection de la liste --> - <t:form id="selectListForm"> - <div> - ${message:listSelect-label}: - <select t:id="listSelect" t:type="ck/BeanSelect" t:list="lists" t:value="selectedList" - t:labelField="literal:name" t:valueField="literal:name" /> - <t:submit t:id="submitListsForm" t:value="${message:ok}"/> - </div> - </t:form> - - <t:if test="selectedListNull"> - ${message:noList} - <p:else> - + <h1 class="titleCreation">${title}</h1> + <div id="listsDiv"> - <!-- Affichage de la liste --> - <t:grid t:source="selectedList.pollAccounts" t:row="account" model="listModel" - t:rowsPerPage="10" t:pagerPosition="bottom" t:rowClass="prop:evenodd.next" t:inPlace="true"> - <p:functionsCell> - <t:actionlink t:id="deleteAccount" context="account.id" t:zone="listsZone"> - <img src="${asset:context:img/delete.png}" alt="${message:delete}"/> - </t:actionlink> - </p:functionsCell> - <p:empty> - ${message:emptyList} - </p:empty> - </t:grid> - - <!-- Création d'un compte --> - <t:form t:id="createAccountForm" t:zone="listsZone"> - <table class="t-data-grid"> - <tr> - <td class="votingId"> - <t:textfield t:id="votingId" t:value="newAccount.votingId" t:validate="required" size="10"/> - </td> - <td class="email"> - <t:textfield t:id="email" t:value="newAccount.email" t:validate="required,regexp" size="15"/> - </td> - <td class="functions"> - <t:submit t:id="submitCreateAccountForm" t:value="${message:add}"/> - </td> - </tr> - </table> - <t:errors/> - </t:form> - - <!-- Suppression de la liste --> - <t:actionlink t:id="deleteList"> - <img src="${asset:context:img/delete.png}"/>${message:deleteList} - </t:actionlink> - - </p:else> - </t:if> - - </t:zone> - </t:unless> - - - <!-- Création d'une liste --> - <t:form t:id="createListForm"> - <div id="createListFormDiv"> - <t:errors/> - <FieldSet> - <legend>${message:createListLegend}</legend> - <div> - <t:label for="listName" /> - <t:textfield t:id="listName" t:value="newList.name" t:validate="required"/> - </div> - <div> - <t:label for="accountsFile" /> - <input t:type="upload" t:id="accountsFile" /> - <span t:type="ck/Tooltip" title="${message:help}" value="${message:accountsFile-help}" effect="appear"> - <img src="${asset:context:img/help.png}" alt="${message:help}"/> - </span> - </div> - <div> - <t:label for="accountsUrl" /> - <t:textfield t:id="accountsUrl" t:value="accountsUrl" /> - <span t:type="ck/Tooltip" title="${message:help}" value="${message:accountsUrl-help}" effect="appear"> - <img src="${asset:context:img/help.png}" alt="${message:help}"/> - </span> - </div> - <div class="buttons"> - <t:submit t:id="submitCreateListForm" t:value="${message:create}"/> - </div> - </FieldSet> - </div> - </t:form> - + <t:if test="favoriteLists"> + <t:userListsUpdate t:source="favoriteLists" /> + </t:if> - </div> - <p:else> - <h4>${message:noUser}</h4> - <t:LoginComponent /> - </p:else> - </t:if> + <t:userListsCreate /> + + </div> </t:border> \ No newline at end of file Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-04-26 14:12:40 UTC (rev 2975) +++ trunk/pom.xml 2010-04-27 16:29:41 UTC (rev 2976) @@ -309,8 +309,8 @@ <!-- customized versions --> <!--javadoc.version>2.4</javadoc.version--> - <topia.version>2.3.3</topia.version> - <eugene.version>2.0.1</eugene.version> + <topia.version>2.4-SNAPSHOT</topia.version> + <eugene.version>2.0.2-SNAPSHOT</eugene.version> <i18n.version>1.2.1</i18n.version> <tapestry.version>5.1.0.5</tapestry.version> <nuiton-utils.version>1.2.2</nuiton-utils.version>
Le Tue, 27 Apr 2010 18:29:41 +0200 (CEST), fdesbois@users.chorem.org a écrit :
Add EntityProperty to manage properties in TopiaQuery
Euh je trouve ça un peu too much d'instancier des objets pour s'éviter de faire un monAlias.maProperty -- Tony Chemit -------------------- tél: +33 (0) 2 40 50 29 28 email: chemit@codelutin.com http://www.codelutin.com
participants (2)
-
fdesbois@users.chorem.org -
Tony Chemit