Author: bleny Date: 2010-12-05 20:55:28 +0000 (Sun, 05 Dec 2010) New Revision: 821 Log: WIP, adding program in whole app ; dealing with connexion form and user administration Added: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/UserProfileForm.java trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/UserProfileForm.properties trunk/wao-ui/src/main/webapp/UserProfileForm.tml Removed: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/UserProfile.java trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/UserProfile.properties trunk/wao-ui/src/main/webapp/UserProfile.tml Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java trunk/wao-business/src/main/java/fr/ifremer/wao/bean/ObsProgram.java trunk/wao-business/src/main/java/fr/ifremer/wao/bean/UserRole.java trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceUserImpl.java trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties trunk/wao-business/src/test/java/fr/ifremer/wao/bean/UserRoleTest.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Connexion.java trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/Layout.tml trunk/wao-ui/src/main/webapp/Administration.tml trunk/wao-ui/src/main/webapp/Connexion.tml Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/PostgresMigrationCallback.java 2010-12-05 20:55:28 UTC (rev 821) @@ -35,7 +35,6 @@ import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; -import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; @@ -626,10 +625,10 @@ for (Object[] row : results) { String waoUserTopiaId = (String) row[0]; short role = (Short) row[1]; - short roleReadOnly = (Short) row[1]; + int roleReadOnly = (Integer) row[2]; - List<UserRole> readOnlyRoles = Arrays.asList(UserRole.toUserRoles(roleReadOnly)); - for (UserRole userRole : UserRole.toUserRoles(role)) { + List<UserRole> readOnlyRoles = codedRolesToUserRoles_1_7(roleReadOnly); + for (UserRole userRole : codedRolesToUserRoles_1_7(role)) { boolean canWrite = ! readOnlyRoles.contains(userRole); String sql = String.format("INSERT INTO UserProfile (topiaId, topiaVersion, topiaCreateDate, waoUser, obsProgramOrdinal, userRoleOrdinal, canWrite) " + Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/WaoMigrationCallBack.java 2010-12-05 20:55:28 UTC (rev 821) @@ -24,6 +24,7 @@ package fr.ifremer.wao; +import fr.ifremer.wao.bean.UserRole; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.nuiton.topia.TopiaException; @@ -368,6 +369,34 @@ return result; } + /** return an array of roles like when roles was stored as int in < 1.6 */ + protected List<UserRole> codedRolesToUserRoles_1_7(int codedRoles) { + List<UserRole> result = null; + switch (codedRoles) { + case 0 : result = Arrays.asList(); break; + case 1 : result = Arrays.asList(UserRole.ADMIN); break; + case 2 : result = Arrays.asList(UserRole.OBSERVER); break; + case 3 : result = Arrays.asList(UserRole.ADMIN,UserRole.OBSERVER); break; + case 4 : result = Arrays.asList(UserRole.COORDINATOR); break; + case 5 : result = Arrays.asList(UserRole.ADMIN,UserRole.COORDINATOR); break; + case 6 : result = Arrays.asList(UserRole.OBSERVER,UserRole.COORDINATOR); break; + case 7 : result = Arrays.asList(UserRole.ADMIN,UserRole.OBSERVER,UserRole.COORDINATOR); break; + case 8 : result = Arrays.asList(UserRole.GUEST); break; + case 9 : result = Arrays.asList(UserRole.ADMIN,UserRole.GUEST); break; + case 10 : result = Arrays.asList(UserRole.OBSERVER,UserRole.GUEST); break; + case 11 : result = Arrays.asList(UserRole.ADMIN,UserRole.OBSERVER,UserRole.GUEST); break; + case 12 : result = Arrays.asList(UserRole.COORDINATOR,UserRole.GUEST); break; + case 13 : result = Arrays.asList(UserRole.ADMIN,UserRole.COORDINATOR,UserRole.GUEST); break; + case 14 : result = Arrays.asList(UserRole.OBSERVER,UserRole.COORDINATOR,UserRole.GUEST); break; + case 15 : result = Arrays.asList(UserRole.ADMIN,UserRole.OBSERVER,UserRole.COORDINATOR,UserRole.GUEST); break; + } + + if (result == null && log.isErrorEnabled()) { + log.error("codedRoles value " + codedRoles + " has no sense"); + } + return result; + } + public void migrateTo_1_7(TopiaContextImplementor tx, boolean showSql, boolean showProgression) throws TopiaException { Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/ObsProgram.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/ObsProgram.java 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/ObsProgram.java 2010-12-05 20:55:28 UTC (rev 821) @@ -4,8 +4,8 @@ public enum ObsProgram { - OBSMER(ObsProgram.class.getName() + "OBSMER"), - OBSVENTE(ObsProgram.class.getName() + "OBSVENTE"); + OBSMER(ObsProgram.class.getName() + ".OBSMER"), + OBSVENTE(ObsProgram.class.getName() + ".OBSVENTE"); protected String label; Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/bean/UserRole.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/bean/UserRole.java 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/bean/UserRole.java 2010-12-05 20:55:28 UTC (rev 821) @@ -30,6 +30,8 @@ import java.util.HashSet; import java.util.Set; +import static org.nuiton.i18n.I18n._; + /** * Enumeration used as roles for {@link WaoUser}. Methods is available in WaoUser * to use this enum like a property of the entity. @@ -42,13 +44,13 @@ */ public enum UserRole { /** Admin role **/ - ADMIN(UserRole.class.getName() + "ADMIN"), + ADMIN(UserRole.class.getName() + ".ADMIN"), /** User/observer role **/ - OBSERVER(UserRole.class.getName() + "OBSERVER"), + OBSERVER(UserRole.class.getName() + ".OBSERVER"), /** Coordinator role **/ - COORDINATOR(UserRole.class.getName() + "COORDINATOR"), + COORDINATOR(UserRole.class.getName() + ".COORDINATOR"), /** Guest role **/ - GUEST(UserRole.class.getName() + "GUEST"); + GUEST(UserRole.class.getName() + ".GUEST"); static final int MAX_CODE = (int)Math.pow(values().length, 2) -1; @@ -59,7 +61,7 @@ } public String getLabel() { - return label; + return _(label); } @Deprecated @@ -138,4 +140,15 @@ } return null; } + + public static UserRole valueOfLabel(String label) { + for (UserRole userRole : values()) { + if (userRole.getLabel().equals(label)) { + return userRole; + } + } + return null; + } + + } Modified: trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceUserImpl.java =================================================================== --- trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceUserImpl.java 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-business/src/main/java/fr/ifremer/wao/service/ServiceUserImpl.java 2010-12-05 20:55:28 UTC (rev 821) @@ -222,6 +222,34 @@ user.setPassword(passwordEncoded); } + WaoQueryHelper.UserProfileProperty userProfileProperty = WaoQueryHelper.newUserProfileProperty(); + WaoQueryHelper.WaoUserProperty waoUserProperty = WaoQueryHelper.newWaoUserProperty(); + TopiaQuery query = dao.createQuery(waoUserProperty.$alias()) + .setSelect(userProfileProperty.$alias()) + .addJoin(waoUserProperty.userProfile(), userProfileProperty.$alias(), false) + .addEquals(waoUserProperty.$alias(), user); + if (log.isDebugEnabled()) { + log.debug("query to find old profiles for user is " + query); + } + + UserProfileDAO userProfileDAO = WaoDAOHelper.getUserProfileDAO(transaction); + List<UserProfile> oldProfiles = userProfileDAO.findAllByQuery(query); + + if (log.isDebugEnabled()) { + log.debug("profiles for user was " + oldProfiles); + } + for (UserProfile userProfile : oldProfiles) { + userProfileDAO.delete(userProfile); + } + + if (user.getUserProfile() != null) { + for (UserProfile userProfile : user.getUserProfile()) { + log.debug(userProfile + " to save : " + userProfile.getDescription()); + context.prepareTopiaId(UserProfile.class, userProfile); + userProfileDAO.update(userProfile); + } + } + dao.update(user); transaction.commitTransaction(); Modified: trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties =================================================================== --- trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-business/src/main/resources/i18n/wao-business-fr_FR.properties 2010-12-05 20:55:28 UTC (rev 821) @@ -1,3 +1,9 @@ +fr.ifremer.wao.bean.ObsProgram.OBSMER=ObsMer +fr.ifremer.wao.bean.ObsProgram.ObsDeb=ObsDeb +fr.ifremer.wao.bean.UserRole.ADMIN=Administrateur +fr.ifremer.wao.bean.UserRole.COORDINATOR=Coordinateur +fr.ifremer.wao.bean.UserRole.GUEST=Invit\u00E9 +fr.ifremer.wao.bean.UserRole.OBSERVER=Observateur fr.ifremer.wao.entity.FishingGearDCF.=Non sp\u00E9cifi\u00E9 fr.ifremer.wao.entity.FishingGearDCF.DRB=Dragues remorqu\u00E9es par bateau fr.ifremer.wao.entity.FishingGearDCF.DRH=Dragues \u00E0 main Modified: trunk/wao-business/src/test/java/fr/ifremer/wao/bean/UserRoleTest.java =================================================================== --- trunk/wao-business/src/test/java/fr/ifremer/wao/bean/UserRoleTest.java 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-business/src/test/java/fr/ifremer/wao/bean/UserRoleTest.java 2010-12-05 20:55:28 UTC (rev 821) @@ -116,4 +116,19 @@ Assert.assertEquals(expected, actual); } } + + @Test + public void showCodeToUserRole() { + for (int i = 0 ; i <= UserRole.MAX_CODE ; i ++) { + StringBuilder code = new StringBuilder(); + code.append("case " + i + " : result = Arrays.asList("); + + for (UserRole role : UserRole.toUserRoles(i)) { + code.append("UserRole." + role + ","); + } + code.append("); break;"); + + System.out.println(code.toString()); + } + } } Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Administration.java 2010-12-05 20:55:28 UTC (rev 821) @@ -36,6 +36,8 @@ import fr.ifremer.wao.entity.CompanyImpl; import fr.ifremer.wao.entity.Indicator; import fr.ifremer.wao.entity.IndicatorLevel; +import fr.ifremer.wao.entity.UserProfile; +import fr.ifremer.wao.entity.UserProfileImpl; import fr.ifremer.wao.entity.WaoUser; import fr.ifremer.wao.io.ImportResults; import fr.ifremer.wao.io.ImportResultsImpl; @@ -522,11 +524,16 @@ private SelectModel userRoleSelectModel; + private List<UserProfile> editedUserProfiles; + @Persist @Property private UserProfile profile; @Persist + private UserProfile editedProfile; + + @Persist @Property private boolean readOnly; @@ -539,6 +546,18 @@ @Property private boolean refreshUserRoleZone; + public UserProfile getEditedProfile() { + if (editedProfile == null) { + editedProfile = new UserProfileImpl(); + + // By default, rights has a scope on the same program as the current user is + // ie an user connected as an Admin of the ObsMer program can give rights + // only on the ObsMer program + editedProfile.setObsProgram(currentUser.getProfile().getObsProgram()); + } + return editedProfile; + } + public SelectModel getUserRoleSelectModel() { if (userRoleSelectModel == null) { List<OptionModel> options = new ArrayList<OptionModel>(); @@ -558,61 +577,51 @@ return new OptionModelImpl(role.getLabel(), role); } - public String getRoleReadOnly() { - /*String text = ""; - if (userEdited.isReadOnly(role)) { - text = "lecture seule"; - } - return text;*/ - return "not yet implemented"; - } - @Log void onChangeFromUserRole(String value) { - /* + // XXX 20101203 bleny, what if value="" ? field is not reset and can't + // be reset if (StringUtils.isNotEmpty(value)) { - userRole = UserRole.valueOf(value); - } else { - userRole = null; + getEditedProfile().setUserRole(UserRole.valueOf(value)); } - */ } @Log void onChangeFromReadOnly(boolean value) { - readOnly = value; + getEditedProfile().setCanWrite( ! value); } + public List<UserProfile> getEditedUserProfiles() { + if (editedUserProfiles == null) { + editedUserProfiles = new ArrayList<UserProfile>(getUserEdited().getUserProfile()); + getUserEdited().setUserProfile(editedUserProfiles); + } + return editedUserProfiles; + } + @Log Object onActionFromAddRole() { - /* - if (log.isDebugEnabled()) { - log.debug("Add userRole : " + userRole + - " (readOnly=" + readOnly + ")"); + if (getEditedProfile() != null && getEditedProfile().getUserRole() != null) { + if (log.isDebugEnabled()) { + log.debug("Add user profile : " + getEditedProfile().getDescription()); + } + getEditedUserProfiles().add(getEditedProfile()); } - if (userRole != null) { - userEdited.addUserRole(userRole, readOnly); - } // Reset fields - userRole = null; + editedProfile = null; readOnly = false; // Refresh the zone refreshUserRoleZone = true; return userRoleZone; - */ - return null; } @Log Object onActionFromRemoveRole(int roleIndex) { - /* - UserRole roleToRemove = userEdited.getUserRoles().get(roleIndex); - userEdited.removeUserRole(roleToRemove); + getEditedUserProfiles().remove(roleIndex); + // Refresh the zone refreshUserRoleZone = true; return userRoleZone; - */ - return null; } /*********************** INDICATORS AND LEVELS ****************************/ Modified: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Connexion.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Connexion.java 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/Connexion.java 2010-12-05 20:55:28 UTC (rev 821) @@ -120,7 +120,7 @@ * with user roles list. Two type of errors can be catch during connection : * <ul> * <li>BAD_CONNECTION : login or password are not corresponding, forgetPassword - * can be used by user</li> + * can be used by user</li> n = dev _ password = * <li>ILLEGAL_CONNECTION : user is not active anymore</li> * </ul> */ @@ -241,7 +241,7 @@ } } - private SelectModel roleSelectModel; + private SelectModel profileSelectModel; @Property private UserProfile userProfile; @@ -252,7 +252,7 @@ * * @return the SelectModel for user roles */ - public SelectModel getRoleSelectModel() { + public SelectModel getProfileSelectModel() { if (serviceAuthentication.existConnectedUser()) { WaoUser user = serviceAuthentication.getConnectedUser().getUser(); @@ -265,11 +265,11 @@ OptionModel option = new OptionModelImpl(profile.getDescription(), profile); options.add(option); } - roleSelectModel = new SelectModelImpl(null, options); - } else if (roleSelectModel == null) { - roleSelectModel = new SelectModelImpl(new OptionModelImpl(null)); + profileSelectModel = new SelectModelImpl(null, options); + } else if (profileSelectModel == null) { + profileSelectModel = new SelectModelImpl(new OptionModelImpl(null)); } - return roleSelectModel; + return profileSelectModel; } /** Deleted: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/UserProfile.java =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/UserProfile.java 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/UserProfile.java 2010-12-05 20:55:28 UTC (rev 821) @@ -1,106 +0,0 @@ -/* - * #%L - * Wao :: Web Interface - * - * $Id$ - * $HeadURL$ - * %% - * Copyright (C) 2009 - 2010 Ifremer - * %% - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * #L% - */ - -package fr.ifremer.wao.ui.pages; - -import fr.ifremer.wao.WaoBusinessException; -import fr.ifremer.wao.WaoBusinessException.Type; -import fr.ifremer.wao.WaoException; -import fr.ifremer.wao.bean.ConnectedUser; -import fr.ifremer.wao.entity.WaoUser; -import fr.ifremer.wao.service.ServiceUser; -import fr.ifremer.wao.ui.components.Layout; -import fr.ifremer.wao.ui.data.RequiresAuthentication; -import org.apache.commons.lang.StringUtils; -import org.apache.tapestry5.annotations.IncludeStylesheet; -import org.apache.tapestry5.annotations.InjectComponent; -import org.apache.tapestry5.annotations.Property; -import org.apache.tapestry5.annotations.SessionState; -import org.apache.tapestry5.corelib.components.BeanEditForm; -import org.apache.tapestry5.ioc.annotations.Inject; - -/** - * UserProfile - * - * Created: 10 nov. 2009 - * - * @author fdesbois <fdesbois at codelutin.com> - */ - at RequiresAuthentication - at IncludeStylesheet("context:css/userProfile.css") -public class UserProfile { - - @Inject - private ServiceUser serviceUser; - - @InjectComponent - private Layout layout; - - @SessionState - private ConnectedUser user; - - private WaoUser userEditable; - - @InjectComponent - private BeanEditForm userForm; - - @Property - private String password; - - @Property - private String password2; - - public WaoUser getUserEditable() { - if (userEditable == null) { - userEditable = user.getUser(); - } - return userEditable; - } - - void onSuccessFromUserForm() throws WaoException { - - if (password != null && !password.equals(password2)) { - userForm.recordError("Les deux password ne sont pas identiques, vérifiez la saisie !"); - } else { - try { - if (!StringUtils.isEmpty(password)) { - userEditable.setPassword(password); - userEditable.setPasswordChanged(true); - } - serviceUser.createUpdateUser(userEditable, false); - layout.addInfo("Modifications enregistrées avec succès !"); - } catch (WaoBusinessException eee) { - if (eee.getType().equals(Type.SMTP_NOT_FOUND)) { - layout.addInfo("Modifications enregistrées avec succès !"); - layout.addInfo(eee.getMessage()); - } else { - userForm.recordError(eee.getMessage()); - } - } - } - } - - - -} Copied: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/UserProfileForm.java (from rev 819, trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/UserProfile.java) =================================================================== --- trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/UserProfileForm.java (rev 0) +++ trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/UserProfileForm.java 2010-12-05 20:55:28 UTC (rev 821) @@ -0,0 +1,106 @@ +/* + * #%L + * Wao :: Web Interface + * + * $Id$ + * $HeadURL$ + * %% + * Copyright (C) 2009 - 2010 Ifremer + * %% + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * #L% + */ + +package fr.ifremer.wao.ui.pages; + +import fr.ifremer.wao.WaoBusinessException; +import fr.ifremer.wao.WaoBusinessException.Type; +import fr.ifremer.wao.WaoException; +import fr.ifremer.wao.bean.ConnectedUser; +import fr.ifremer.wao.entity.WaoUser; +import fr.ifremer.wao.service.ServiceUser; +import fr.ifremer.wao.ui.components.Layout; +import fr.ifremer.wao.ui.data.RequiresAuthentication; +import org.apache.commons.lang.StringUtils; +import org.apache.tapestry5.annotations.IncludeStylesheet; +import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.annotations.SessionState; +import org.apache.tapestry5.corelib.components.BeanEditForm; +import org.apache.tapestry5.ioc.annotations.Inject; + +/** + * UserProfileForm + * + * Created: 10 nov. 2009 + * + * @author fdesbois <fdesbois at codelutin.com> + */ + at RequiresAuthentication + at IncludeStylesheet("context:css/userProfile.css") +public class UserProfileForm { + + @Inject + private ServiceUser serviceUser; + + @InjectComponent + private Layout layout; + + @SessionState + private ConnectedUser user; + + private WaoUser userEditable; + + @InjectComponent + private BeanEditForm userForm; + + @Property + private String password; + + @Property + private String password2; + + public WaoUser getUserEditable() { + if (userEditable == null) { + userEditable = user.getUser(); + } + return userEditable; + } + + void onSuccessFromUserForm() throws WaoException { + + if (password != null && !password.equals(password2)) { + userForm.recordError("Les deux password ne sont pas identiques, vérifiez la saisie !"); + } else { + try { + if (!StringUtils.isEmpty(password)) { + userEditable.setPassword(password); + userEditable.setPasswordChanged(true); + } + serviceUser.createUpdateUser(userEditable, false); + layout.addInfo("Modifications enregistrées avec succès !"); + } catch (WaoBusinessException eee) { + if (eee.getType().equals(Type.SMTP_NOT_FOUND)) { + layout.addInfo("Modifications enregistrées avec succès !"); + layout.addInfo(eee.getMessage()); + } else { + userForm.recordError(eee.getMessage()); + } + } + } + } + + + +} Property changes on: trunk/wao-ui/src/main/java/fr/ifremer/wao/ui/pages/UserProfileForm.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/Layout.tml =================================================================== --- trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/Layout.tml 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/components/Layout.tml 2010-12-05 20:55:28 UTC (rev 821) @@ -63,7 +63,7 @@ </a> </div> <div id="user-infos" class="fleft"> - Vous êtes <strong>${currentUser.fullName}</strong> de la société <strong>${currentUser.company.name}</strong> + Vous êtes <strong>${currentUser.user.fullName}</strong> de la société <strong>${currentUser.company.name}</strong> (${accessText}) </div> <div id="user-actions" class="fright"> @@ -75,7 +75,7 @@ <img src="${asset:context:img/cartography.png}" alt="Cartes" title="Cartes"/> </a> </t:unless> - <a t:type="pagelink" t:page="userProfile" title="Gestion profil"> + <a t:type="pagelink" t:page="userProfileForm" title="Gestion profil"> <img src="${asset:context:img/user.png}" alt="Preferences" title="Gestion profil"/> </a> <a t:type="actionlink" t:id="exit" title="Déconnexion"> Deleted: trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/UserProfile.properties =================================================================== --- trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/UserProfile.properties 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/UserProfile.properties 2010-12-05 20:55:28 UTC (rev 821) @@ -1,32 +0,0 @@ -### -# #%L -# Wao :: Web Interface -# -# -# $Id$ -# $HeadURL$ -# %% -# Copyright (C) 2009 - 2010 Ifremer -# %% -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# #L% -### -firstName-label: Pr\u00e9nom -lastName-label: Nom -login-label: Id. connexion (email) -name-label: Pr\u00e9nom et nom -phoneNumber-label: T\u00e9l\u00e9phone -password-label: Nouveau mot de passe -password2-label: V\u00e9rification mot de passe -active-label: Actif Copied: trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/UserProfileForm.properties (from rev 819, trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/UserProfile.properties) =================================================================== --- trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/UserProfileForm.properties (rev 0) +++ trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/UserProfileForm.properties 2010-12-05 20:55:28 UTC (rev 821) @@ -0,0 +1,32 @@ +### +# #%L +# Wao :: Web Interface +# +# +# $Id$ +# $HeadURL$ +# %% +# Copyright (C) 2009 - 2010 Ifremer +# %% +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# #L% +### +firstName-label: Pr\u00e9nom +lastName-label: Nom +login-label: Id. connexion (email) +name-label: Pr\u00e9nom et nom +phoneNumber-label: T\u00e9l\u00e9phone +password-label: Nouveau mot de passe +password2-label: V\u00e9rification mot de passe +active-label: Actif Property changes on: trunk/wao-ui/src/main/resources/fr/ifremer/wao/ui/pages/UserProfileForm.properties ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/wao-ui/src/main/webapp/Administration.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Administration.tml 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-ui/src/main/webapp/Administration.tml 2010-12-05 20:55:28 UTC (rev 821) @@ -115,7 +115,7 @@ <t:zone id="so-admin-userRoleZone" t:id="userRoleZone" t:update="show"> <t:nuiton.subForm t:visible="refreshUserRoleZone"> <label t:type="label" for="userRole" /> - <select t:type="select" t:id="userRole" t:value="userProfile" t:model="userRoleSelectModel" + <select t:type="select" t:id="userRole" t:value="role" t:model="userRoleSelectModel" t:mixins="ck/onEvent" t:event="change"/> <span>Lecture seule : </span> @@ -126,8 +126,8 @@ <img src="${asset:context:img/add-16px.png}" /> </a> <ul> - <li t:type="loop" t:source="userEdited.userProfile" t:value="profile" t:index="profileIndex"> - ${role.label} ${roleReadOnly} + <li t:type="loop" t:source="userEdited.userProfile" t:value="profile" t:index="profileIndex" t:volatile="true"> + ${profile.description} <a t:type="actionlink" t:id="removeRole" t:context="profileIndex" title="Supprimer ce rôle" t:zone="so-admin-userRoleZone"> <img src="${asset:context:img/remove-22px.png}" /> </a> Modified: trunk/wao-ui/src/main/webapp/Connexion.tml =================================================================== --- trunk/wao-ui/src/main/webapp/Connexion.tml 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-ui/src/main/webapp/Connexion.tml 2010-12-05 20:55:28 UTC (rev 821) @@ -72,8 +72,8 @@ t:title="literal:Choisissez dans la liste votre profil de connexion : "> <form t:id="roleForm" t:type="form" action="tapestry"> <p class="roleSelect"> - <select t:type="select" t:id="userRole" t:value="userRole" t:model="roleSelectModel" - onChange="this.form.submit()"/> + <select t:type="select" t:id="userProfile" t:value="userProfile" t:model="profileSelectModel" + onChange="this.form.submit()" t:volatile="true" /> </p> </form> </div> Deleted: trunk/wao-ui/src/main/webapp/UserProfile.tml =================================================================== --- trunk/wao-ui/src/main/webapp/UserProfile.tml 2010-12-03 13:56:38 UTC (rev 820) +++ trunk/wao-ui/src/main/webapp/UserProfile.tml 2010-12-05 20:55:28 UTC (rev 821) @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - #%L - Wao :: Web Interface - - $Author$ - $LastChangedDate$ - $LastChangedRevision$ - $Id$ - $HeadURL$ - %% - Copyright (C) 2009 - 2010 Ifremer - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% - --> - -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<t:layout t:pageTitle="Gestion du profile utilisateur" t:contentId="so-user-profile" - xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> - - <fieldset class="user-form"> - <form t:type="beaneditform" class="clearfix" t:id="userForm" t:object="userEditable" - t:include="firstName, lastName, login, phoneNumber, password" t:add="password2"> - <p:password> - <t:label t:for="password" /> - <input t:type="passwordfield" t:id="password" value="password"/> - </p:password> - <p:password2> - <t:label t:for="password2" /> - <input t:type="passwordfield" t:id="password2" value="password2"/> - </p:password2> -<!-- <p:login> - <label>${message:login}</label> - ${user.login} - </p:login>--> - </form> - </fieldset> - -</t:layout> Copied: trunk/wao-ui/src/main/webapp/UserProfileForm.tml (from rev 819, trunk/wao-ui/src/main/webapp/UserProfile.tml) =================================================================== --- trunk/wao-ui/src/main/webapp/UserProfileForm.tml (rev 0) +++ trunk/wao-ui/src/main/webapp/UserProfileForm.tml 2010-12-05 20:55:28 UTC (rev 821) @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Wao :: Web Interface + + $Author$ + $LastChangedDate$ + $LastChangedRevision$ + $Id$ + $HeadURL$ + %% + Copyright (C) 2009 - 2010 Ifremer + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --> + +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<t:layout t:pageTitle="Gestion du profile utilisateur" t:contentId="so-user-profile" + xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> + + <fieldset class="user-form"> + <form t:type="beaneditform" class="clearfix" t:id="userForm" t:object="userEditable" + t:include="firstName, lastName, login, phoneNumber, password" t:add="password2"> + <p:password> + <t:label t:for="password" /> + <input t:type="passwordfield" t:id="password" value="password"/> + </p:password> + <p:password2> + <t:label t:for="password2" /> + <input t:type="passwordfield" t:id="password2" value="password2"/> + </p:password2> +<!-- <p:login> + <label>${message:login}</label> + ${user.login} + </p:login>--> + </form> + </fieldset> + +</t:layout> Property changes on: trunk/wao-ui/src/main/webapp/UserProfileForm.tml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL