Author: vbriand Date: 2011-02-04 11:18:03 +0100 (Fri, 04 Feb 2011) New Revision: 184 Url: http://chorem.org/repositories/revision/bow/184 Log: Fixed some bugs and added a few translations Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java trunk/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java trunk/src/main/java/org/chorem/bow/action/RegisterAction.java trunk/src/main/resources/i18n/bow_en_GB.properties trunk/src/main/resources/i18n/bow_fr_FR.properties trunk/src/main/webapp/css/bookmark.css trunk/src/main/webapp/css/connexion.css trunk/src/main/webapp/css/global.css trunk/src/main/webapp/jsp/inc/header.jsp trunk/src/main/webapp/jsp/inc/rightMenu.jsp trunk/src/main/webapp/jsp/inc/tagsCloud.jsp trunk/src/main/webapp/jsp/register.jsp Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java =================================================================== --- trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2011-02-04 10:18:03 UTC (rev 184) @@ -41,7 +41,7 @@ protected String fullTextLine = ""; protected List<Bookmark> bookmarks = new ArrayList<Bookmark>(); // bookmarks which contain the search tags protected List<Bookmark> lastBookmarks = new ArrayList<Bookmark>(); - protected List<FacetTopic> tagCloud = new ArrayList<FacetTopic>(); // associate a tag with its frequency + protected List<FacetTopic> tagsCloud = new ArrayList<FacetTopic>(); // associate a tag with its frequency protected List<String> tagsSearch = new ArrayList<String>(); // contains the tags taped in the search field protected int tmax = -1; protected int tmin = -1; @@ -276,16 +276,16 @@ public void setTagCloud(List<FacetTopic> cpy) { if (cpy != null) { - tagCloud = new ArrayList<FacetTopic>(cpy); + tagsCloud = new ArrayList<FacetTopic>(cpy); } } public void deleteTagBySearch() { - List<FacetTopic> save = new ArrayList<FacetTopic>(tagCloud); + List<FacetTopic> save = new ArrayList<FacetTopic>(tagsCloud); for (FacetTopic topic : save) { String name = topic.getTopicName(); if (tagsSearch.contains(name)) { - tagCloud.remove(topic); + tagsCloud.remove(topic); } } } @@ -293,7 +293,7 @@ protected void defineTValues() { tmax = -1; // correspond to the most tag frequency in the tag cloud tmin = -1; // correspond to the less tag frequency in the tag cloud - for (FacetTopic tag : tagCloud) { + for (FacetTopic tag : tagsCloud) { int value = tag.getCount(); if (tmax < value) { // search the most tag frequancy tmax = value; @@ -332,7 +332,7 @@ public void reset() { bookmarks.clear(); - tagCloud.clear(); + tagsCloud.clear(); tagsSearch.clear(); tmax = -1; tmin = -1; @@ -379,7 +379,7 @@ } public List<FacetTopic> getTagsCloud() { - return tagCloud; + return tagsCloud; } public List<String> getTagsSearch() { Modified: trunk/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java 2011-02-04 10:18:03 UTC (rev 184) @@ -51,6 +51,7 @@ WikittyProxy proxy = BowProxy.getInstance(); Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, email).criteria(); User user = proxy.findByCriteria(User.class, criteria); + if (user != null) { boolean bool = true; String password = ""; @@ -61,11 +62,11 @@ md5 = StringUtil.encodeMD5(password); bool = passwordExists(md5); } - String mailContent; + try { + String mailContent; - mailContent = getText(n_("bow.register.mailHi")) + ",\n\n" + getText(n_("bow.register.mailPwd")) + ": " + password + "\n\n" + getText(n_("bow.register.mailEmail")) + ": " + email + "\n\n"; - try { - BowMail.sendMail(email, getText(n_("bow.register.mailSubject")), mailContent); //TODO: modifier les noms et peut-être la manière de faire car c'est pas très beau + mailContent = getText(n_("bow.register.mailHi")) + ",\n\n" + getText(n_("bow.register.mailPwd")) + ": " + password + "\n\n" + getText(n_("bow.register.mailEmail")) + ": " + email + "\n\n"; + BowMail.sendMail(email, getText(n_("bow.register.mailSubject")), mailContent); } catch (AddressException e) { // TODO Auto-generated catch block e.printStackTrace(); Modified: trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java 2011-02-04 10:18:03 UTC (rev 184) @@ -19,6 +19,8 @@ import org.nuiton.wikitty.WikittyProxy; import org.nuiton.wikitty.search.Search; +import static org.nuiton.i18n.I18n.n_; + public class PreferencesAction extends BowBaseAction implements SessionAware, ServletRequestAware { private static final long serialVersionUID = -58341106356599721L; protected String colors; @@ -226,6 +228,9 @@ currentPassword = StringUtil.encodeMD5(currentPassword); if (currentPassword.equals(newUser.getPassword())) { newUser.setPassword(StringUtil.encodeMD5(newPassword)); + } else { + addFieldError("currentPassword", getText(n_("bow.preferences.badCurrentPassword"))); + return null; } } } @@ -248,7 +253,9 @@ if (find == null || find.getEmail().equals(user.getEmail())) { //If this email address isn't already used by someone else try { - newUser = changeUser(newUser); + if ((newUser = changeUser(newUser)) == null) { + return ERROR; + } } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); Modified: trunk/src/main/java/org/chorem/bow/action/RegisterAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/RegisterAction.java 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/java/org/chorem/bow/action/RegisterAction.java 2011-02-04 10:18:03 UTC (rev 184) @@ -126,8 +126,8 @@ try { String mailContent; - mailContent = getText(n_("bow.register.mailHi")) + "\n\n" + getText(n_("bow.register.mailPwd")) + password + "\n\n" + getText(n_("bow.register.mailEmail")) + email + "\n\n"; - BowMail.sendMail(email, getText(n_("bow.register.mailSubject")), mailContent); //TODO: modifier les noms et peut-être la manière de faire car c'est pas très beau + mailContent = getText(n_("bow.register.mailHi")) + ",\n\n" + getText(n_("bow.register.mailPwd")) + ": " + password + "\n\n" + getText(n_("bow.register.mailEmail")) + ": " + email + "\n\n"; + BowMail.sendMail(email, getText(n_("bow.register.mailSubject")), mailContent); } catch (AddressException e) { // TODO Auto-generated catch block e.printStackTrace(); Modified: trunk/src/main/resources/i18n/bow_en_GB.properties =================================================================== --- trunk/src/main/resources/i18n/bow_en_GB.properties 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/resources/i18n/bow_en_GB.properties 2011-02-04 10:18:03 UTC (rev 184) @@ -1,5 +1,5 @@ bow.action.locale.english=English -bow.action.locale.french=French +bow.action.locale.french=Fran\u00E7ais bow.bookmark.badFileFormat= bow.bookmark.description=Description bow.bookmark.tags=Tags @@ -17,7 +17,7 @@ bow.footer.bugreport=Bug report bow.footer.license=AGPL License bow.footer.userSupport=User support -bow.forgotPassword.emailDoesntExist= +bow.forgotPassword.emailDoesntExist=This email address doesn''t exist bow.forgotpwd.submit=Send bow.forgotpwd.title=Forgot your password? bow.home.latestBookmarks=The latest added bookmarks @@ -35,6 +35,7 @@ bow.login.repeatPassword.required=Please repeat your password bow.login.submit=Login bow.login.title=Login +bow.preferences.badCurrentPassword=Your current password is incorrect bow.preferences.bookmarksHomePage=Number of bookmarks displayed on the home page bow.preferences.colors=Site color bow.preferences.confirmNewPassword=Confirm new password @@ -52,7 +53,7 @@ bow.preferences.title=Preferences bow.preferences.userInfo=User information bow.register.emailAldyUsed=This email address is already used -bow.register.invalidLogin= +bow.register.invalidLogin=Something went wrong during your registration, please try again bow.register.mailEmail=Your email bow.register.mailHi=Hi bow.register.mailPwd=Your password Modified: trunk/src/main/resources/i18n/bow_fr_FR.properties =================================================================== --- trunk/src/main/resources/i18n/bow_fr_FR.properties 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/resources/i18n/bow_fr_FR.properties 2011-02-04 10:18:03 UTC (rev 184) @@ -1,4 +1,4 @@ -bow.action.locale.english=Anglais +bow.action.locale.english=English bow.action.locale.french=Fran\u00E7ais bow.bookmark.badFileFormat= bow.bookmark.description=Description @@ -17,7 +17,7 @@ bow.footer.bugreport=Rapport de bug bow.footer.license=Licence AGPL bow.footer.userSupport=Support utilisateur -bow.forgotPassword.emailDoesntExist= +bow.forgotPassword.emailDoesntExist=Cette adresse email n''existe pas bow.forgotpwd.submit=Envoyer bow.forgotpwd.title=Vous avez oubli\u00E9 votre mot de passe ? bow.home.latestBookmarks=Les derniers marque-pages ajout\u00E9s @@ -35,6 +35,7 @@ bow.login.repeatPassword.required=Veuillez retaper votre mot de passe bow.login.submit=Connexion bow.login.title=Connexion +bow.preferences.badCurrentPassword=Votre mot de passe actuel est incorrect bow.preferences.bookmarksHomePage=Nombre de marque-pages affich\u00E9s bow.preferences.colors=Couleur du site bow.preferences.confirmNewPassword=Confirmez votre mot de passe @@ -52,12 +53,12 @@ bow.preferences.title=Pr\u00E9f\u00E9rences bow.preferences.userInfo=Informations utilisateur bow.register.emailAldyUsed=Cette adresse email est d\u00E9j\u00E0 utilis\u00E9e -bow.register.invalidLogin= +bow.register.invalidLogin=Une erreur s''est produite pendant l''enregistrement de vos informations, merci d''essayer \u00E0 nouveau bow.register.mailEmail=Votre email bow.register.mailHi=Bonjour bow.register.mailPwd=Votre mot de passe bow.register.mailSubject=[bow] Vos informations utilisateur -bow.register.pwdDontMatch=Les mots de passe sont diff\u00E9erents +bow.register.pwdDontMatch=Les mots de passe sont diff\u00E9rents bow.register.submit=S''enregistrer bow.register.title=S''enregistrer bow.requiredstring=${getText(fieldKey)} est obligatoire Modified: trunk/src/main/webapp/css/bookmark.css =================================================================== --- trunk/src/main/webapp/css/bookmark.css 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/webapp/css/bookmark.css 2011-02-04 10:18:03 UTC (rev 184) @@ -1,3 +1,4 @@ +@charset "utf-8"; /* * #%L * bow @@ -21,8 +22,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -@charset "utf-8"; -/* CSS Document */ + #page{ background-color:#9EDCF8; float:left; Modified: trunk/src/main/webapp/css/connexion.css =================================================================== --- trunk/src/main/webapp/css/connexion.css 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/webapp/css/connexion.css 2011-02-04 10:18:03 UTC (rev 184) @@ -1,3 +1,4 @@ +@charset "utf-8"; /* * #%L * bow @@ -21,8 +22,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -@charset "utf-8"; -/* CSS Document */ + #header{ background:#FFFFFF url('/bow/img/fondhead.jpg') repeat-x; width:100%; Modified: trunk/src/main/webapp/css/global.css =================================================================== --- trunk/src/main/webapp/css/global.css 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/webapp/css/global.css 2011-02-04 10:18:03 UTC (rev 184) @@ -1,3 +1,4 @@ +@charset "utf-8"; /* * #%L * bow @@ -21,8 +22,7 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * #L% */ -@charset "utf-8"; -/* CSS Document */ + *{ padding:0; margin:0; Modified: trunk/src/main/webapp/jsp/inc/header.jsp =================================================================== --- trunk/src/main/webapp/jsp/inc/header.jsp 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/webapp/jsp/inc/header.jsp 2011-02-04 10:18:03 UTC (rev 184) @@ -1,7 +1,7 @@ <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib prefix="s" uri="/struts-tags"%> <div id="header"> - <s:if test="#session.user"> + <s:if test="%{#session.user != null && #session.tokenActions != null}"> <a class="logo" href="<s:property value='%{#session.bowUrl}' />home.action?token=<s:property value='%{#session.tokenActions.getPermanentToken()}' />">bow</a> </s:if> <s:else> Modified: trunk/src/main/webapp/jsp/inc/rightMenu.jsp =================================================================== --- trunk/src/main/webapp/jsp/inc/rightMenu.jsp 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/webapp/jsp/inc/rightMenu.jsp 2011-02-04 10:18:03 UTC (rev 184) @@ -69,8 +69,10 @@ <h2><s:text name="bow.rightMenu.extensions" /></h2> <ul class="droite"> <li><a href="extensions/bow4chromium.crx"><img src="img/chromium.png" alt="Chromium" class="extensionIcon" /><s:text name="bow.rightMenu.chromiumExtension" /></a></li> - <li><strong><s:text name="bow.rightMenu.token.permanent" /> :</strong><br /><s:property value="%{#session.tokenActions.getPermanentToken()}" /></li> - <li><strong><s:text name="bow.rightMenu.token.temporary" /> :</strong><br /><s:property value="%{#session.tokenActions.getTemporaryToken()}" /></li> + <s:if test="%{#session.tokenActions != null}"> + <li><strong><s:text name="bow.rightMenu.token.permanent" /> :</strong><br /><s:property value="%{#session.tokenActions.getPermanentToken()}" /></li> + <li><strong><s:text name="bow.rightMenu.token.temporary" /> :</strong><br /><s:property value="%{#session.tokenActions.getTemporaryToken()}" /></li> + </s:if> </ul> </div> <div id="add" class="clearfix"> Modified: trunk/src/main/webapp/jsp/inc/tagsCloud.jsp =================================================================== --- trunk/src/main/webapp/jsp/inc/tagsCloud.jsp 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/webapp/jsp/inc/tagsCloud.jsp 2011-02-04 10:18:03 UTC (rev 184) @@ -26,8 +26,8 @@ <%@page import="org.chorem.bow.BookmarkActions" %> <%@page import="java.util.List" %> <%@page import="org.nuiton.wikitty.FacetTopic" %> -<s:if test="%{#request.nbTags > #request.bookmarkActions.tagsCloud.size()}"> - <s:set var="maxTags" value="#request.bookmarkActions.tagsCloud.size()" /> +<s:if test="%{#request.nbTags > #request.bookmarkActions.getTagsCloud().size()}"> + <s:set var="maxTags" value="#request.bookmarkActions.getTagsCloud().size()" /> </s:if> <s:else> <s:set var="maxTags" value="#request.nbTags" /> Modified: trunk/src/main/webapp/jsp/register.jsp =================================================================== --- trunk/src/main/webapp/jsp/register.jsp 2011-02-03 18:08:18 UTC (rev 183) +++ trunk/src/main/webapp/jsp/register.jsp 2011-02-04 10:18:03 UTC (rev 184) @@ -38,6 +38,7 @@ <div id="formFrame"> <h1><s:text name="bow.register.title" /></h1> <s:form action="register"> + <s:actionerror /> <p> <s:textfield key="bow.login.email" name="email" labelposition="top" labelSeparator=" :" /> <s:password key="bow.login.password" name="password" labelposition="top" labelSeparator=" :" />