Bow-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
February 2011
- 4 participants
- 48 discussions
Author: bpoussin
Date: 2011-02-11 18:31:09 +0100 (Fri, 11 Feb 2011)
New Revision: 187
Url: http://chorem.org/repositories/revision/bow/187
Log:
ajout petit text installation
Modified:
trunk/README.txt
Modified: trunk/README.txt
===================================================================
--- trunk/README.txt 2011-02-11 17:27:37 UTC (rev 186)
+++ trunk/README.txt 2011-02-11 17:31:09 UTC (rev 187)
@@ -1,2 +1,7 @@
Bow : Bookmark on the web
http://www.chorem.org/projects/show/bow
+
+Installation
+============
+- compile with maven
+- copy war in jetty or tomcat installation
1
0
Author: bpoussin
Date: 2011-02-11 18:27:37 +0100 (Fri, 11 Feb 2011)
New Revision: 186
Url: http://chorem.org/repositories/revision/bow/186
Log:
ajout de l'url de bow
Modified:
trunk/README.txt
Modified: trunk/README.txt
===================================================================
--- trunk/README.txt 2011-02-10 12:21:55 UTC (rev 185)
+++ trunk/README.txt 2011-02-11 17:27:37 UTC (rev 186)
@@ -0,0 +1,2 @@
+Bow : Bookmark on the web
+http://www.chorem.org/projects/show/bow
1
0
Author: tchemit
Date: 2011-02-10 13:21:55 +0100 (Thu, 10 Feb 2011)
New Revision: 185
Url: http://chorem.org/repositories/revision/bow/185
Log:
Update mavenpom4redmine to 2.5.
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2011-02-04 10:18:03 UTC (rev 184)
+++ trunk/pom.xml 2011-02-10 12:21:55 UTC (rev 185)
@@ -10,7 +10,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>2.4.3</version>
+ <version>2.5</version>
</parent>
<groupId>org.chorem</groupId>
1
0
r184 - in trunk/src/main: java/org/chorem/bow java/org/chorem/bow/action resources/i18n webapp/css webapp/jsp webapp/jsp/inc
by vbriand@users.chorem.org 04 Feb '11
by vbriand@users.chorem.org 04 Feb '11
04 Feb '11
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=" :" />
1
0
r183 - in trunk/src/main: java/org/chorem/bow java/org/chorem/bow/action resources resources/i18n webapp/WEB-INF/decorators webapp/jsp webapp/jsp/inc webapp/template webapp/template/simple
by vbriand@users.chorem.org 03 Feb '11
by vbriand@users.chorem.org 03 Feb '11
03 Feb '11
Author: vbriand
Date: 2011-02-03 19:08:18 +0100 (Thu, 03 Feb 2011)
New Revision: 183
Url: http://chorem.org/repositories/revision/bow/183
Log:
W3C compliant. The tags cloud is displayed properly. The search engines aren't suggested anymore when the user isn't logged in.
Added:
trunk/src/main/webapp/template/simple/
trunk/src/main/webapp/template/simple/form-common.ftl
Modified:
trunk/src/main/java/org/chorem/bow/BowInit.java
trunk/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java
trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java
trunk/src/main/resources/i18n/bow_en_GB.properties
trunk/src/main/resources/i18n/bow_fr_FR.properties
trunk/src/main/resources/struts.xml
trunk/src/main/webapp/WEB-INF/decorators/main.jsp
trunk/src/main/webapp/jsp/forgotPassword.jsp
trunk/src/main/webapp/jsp/home.jsp
trunk/src/main/webapp/jsp/inc/bookmark.jsp
trunk/src/main/webapp/jsp/inc/bookmarkTop.jsp
trunk/src/main/webapp/jsp/inc/errorFrame.jsp
trunk/src/main/webapp/jsp/inc/rightMenu.jsp
trunk/src/main/webapp/jsp/inc/tagsCloud.jsp
trunk/src/main/webapp/jsp/login.jsp
trunk/src/main/webapp/jsp/preferences.jsp
trunk/src/main/webapp/jsp/register.jsp
trunk/src/main/webapp/jsp/search.jsp
Modified: trunk/src/main/java/org/chorem/bow/BowInit.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BowInit.java 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/java/org/chorem/bow/BowInit.java 2011-02-03 18:08:18 UTC (rev 183)
@@ -71,14 +71,14 @@
if (criteria != null) {
Criteria sortCriteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, sortCriteria); //Selects all bookmarks by user
- sortCriteria = criteria.addSortDescending(Bookmark.FQ_FIELD_DATE).setEndIndex(10);
+ sortCriteria = criteria.addSortDescending(Bookmark.FQ_FIELD_DATE).setEndIndex(10);//TODO: remove hardcoded value
List<Bookmark> lastBookmarks = proxy.findAllByCriteria(Bookmark.class, sortCriteria).getAll();
BookmarkActions bookmarkActions = BowBookmark.createBookmarkActions(request, result, null);
bookmarkActions.setTagSearch(null);
List<Bookmark> bookList = bookmarkActions.getBookmarks();
- if (bookList.size() > 10) {
- bookList = bookmarkActions.getBookmarks().subList(0, 10);
+ if (bookList.size() > 10) { //TODO: remove hardcoded value
+ bookList = bookmarkActions.getBookmarks().subList(0, 10); //TODO: remove hardcoded value
bookmarkActions.setBookmarks(bookList);
}
if (lastBookmarks != null) {
Modified: trunk/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java 2011-02-03 18:08:18 UTC (rev 183)
@@ -62,8 +62,8 @@
bool = passwordExists(md5);
}
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";
+
+ 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
} catch (AddressException e) {
Modified: trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java 2011-02-03 18:08:18 UTC (rev 183)
@@ -9,6 +9,7 @@
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;
import org.chorem.bow.BowBookmark;
+import org.chorem.bow.BowInit;
import org.chorem.bow.BowProxy;
import org.chorem.bow.Preference;
import org.chorem.bow.User;
@@ -274,6 +275,7 @@
setSearchEngineUrlResults(preference.getSearchEngineUrlResults());
}
}
+ BowInit.initHomePage(request, user);
return SUCCESS;
}
}
Modified: trunk/src/main/resources/i18n/bow_en_GB.properties
===================================================================
--- trunk/src/main/resources/i18n/bow_en_GB.properties 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/resources/i18n/bow_en_GB.properties 2011-02-03 18:08:18 UTC (rev 183)
@@ -53,10 +53,10 @@
bow.preferences.userInfo=User information
bow.register.emailAldyUsed=This email address is already used
bow.register.invalidLogin=
-bow.register.mailEmail=
-bow.register.mailHi=
-bow.register.mailPwd=
-bow.register.mailSubject=
+bow.register.mailEmail=Your email
+bow.register.mailHi=Hi
+bow.register.mailPwd=Your password
+bow.register.mailSubject=[bow] Your account information
bow.register.pwdDontMatch=Passwords don''t match
bow.register.submit=Register
bow.register.title=Register
Modified: trunk/src/main/resources/i18n/bow_fr_FR.properties
===================================================================
--- trunk/src/main/resources/i18n/bow_fr_FR.properties 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/resources/i18n/bow_fr_FR.properties 2011-02-03 18:08:18 UTC (rev 183)
@@ -53,10 +53,10 @@
bow.preferences.userInfo=Informations utilisateur
bow.register.emailAldyUsed=Cette adresse email est d\u00E9j\u00E0 utilis\u00E9e
bow.register.invalidLogin=
-bow.register.mailEmail=
-bow.register.mailHi=
-bow.register.mailPwd=
-bow.register.mailSubject=
+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.submit=S''enregistrer
bow.register.title=S''enregistrer
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/resources/struts.xml 2011-02-03 18:08:18 UTC (rev 183)
@@ -132,7 +132,7 @@
<action name="locale" class="org.chorem.bow.action.LocaleAction">
<result type="redirect">/jsp/login.jsp</result>
</action>
- <action name="generateToken" class="org.chorem.bow.action.GenerateTokenAction">
+ <action name="regenPermToken" class="org.chorem.bow.action.GenerateTokenAction">
<interceptor-ref name="loginStack" />
<result type="redirectAction">preferences</result>
</action>
Modified: trunk/src/main/webapp/WEB-INF/decorators/main.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/decorators/main.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/WEB-INF/decorators/main.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -15,8 +15,10 @@
<s:url id="permanentXml" action="permanentXml" />
<s:url id="favicon" value="/img/favicon.png" />
<link rel="icon" type="image/png" href="${favicon}" />
- <link rel="search" type="application/opensearchdescription+xml" title="Bow (temporary)" href="${temporaryXml}" />
- <link rel="search" type="application/opensearchdescription+xml" title="Bow (permanent)" href="${permanentXml}" />
+ <s:if test="%{#session.user != null}">
+ <link rel="search" type="application/opensearchdescription+xml" title="Bow (temporary)" href="${temporaryXml}" />
+ <link rel="search" type="application/opensearchdescription+xml" title="Bow (permanent)" href="${permanentXml}" />
+ </s:if>
<s:url id="globalCSS" value="/css/global.css" />
<link href="${globalCSS}" rel="stylesheet" type="text/css" media="all" />
<s:url id="bookmarkJS" value="/js/bookmark.js" />
Modified: trunk/src/main/webapp/jsp/forgotPassword.jsp
===================================================================
--- trunk/src/main/webapp/jsp/forgotPassword.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/forgotPassword.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
bow
@@ -41,7 +40,7 @@
<s:form action="forgotPassword">
<p>
<s:textfield key="bow.login.email" name="email" labelposition="top" labelSeparator=" :" />
- <s:submit key="bow.forgotpwd.submit" />
+ <s:submit key="bow.forgotpwd.submit" name="submit" />
</p>
</s:form>
<s:a action="login_input" id="loginLink"><s:text name="bow.login.title" /></s:a>
Modified: trunk/src/main/webapp/jsp/home.jsp
===================================================================
--- trunk/src/main/webapp/jsp/home.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/home.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
bow
Modified: trunk/src/main/webapp/jsp/inc/bookmark.jsp
===================================================================
--- trunk/src/main/webapp/jsp/inc/bookmark.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/inc/bookmark.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
bow
@@ -47,16 +46,21 @@
<s:property value="%{#bookmarkAlias}" />
</s:a>
<p class="date">(<s:property value="%{date}" />)</p>
- <s:url id="editBookmark" action="modifyBookmark" escapeAmp="false">
+ <s:url id="editBookmarkModify" action="modifyBookmark" escapeAmp="false">
<s:param name="bookmarkId"><s:property value="%{#wikittyId}" /></s:param>
<s:param name="searchLine"><s:property value="%{#searchLine}" /></s:param>
<s:param name="fullTextLine"><s:property value="%{#fullTextLine}" /></s:param>
</s:url>
- <s:a cssClass="edit" href="%{editBookmark}" onclick="return modify('%{#bookmarkDescription}', '%{#bookmarkAlias}', '%{@org.chorem.bow.BookmarkActions@getBookmarkTagsString(#request.bookmark)}', '%{#bookmarkLink}', '%{editBookmark}', '%{#wikittyId}');"></s:a>
- <s:url id="removeBookmark" action="removeBookmark" escapeAmp="false">
+ <s:url id="editBookmark" action="modifyBookmark" escapeAmp="true">
<s:param name="bookmarkId"><s:property value="%{#wikittyId}" /></s:param>
<s:param name="searchLine"><s:property value="%{#searchLine}" /></s:param>
<s:param name="fullTextLine"><s:property value="%{#fullTextLine}" /></s:param>
+ </s:url>
+ <s:a cssClass="edit" href="%{editBookmark}" onclick="return modify('%{#bookmarkDescription}', '%{#bookmarkAlias}', '%{@org.chorem.bow.BookmarkActions@getBookmarkTagsString(#request.bookmark)}', '%{#bookmarkLink}', '%{editBookmarkModify}', '%{#wikittyId}');"></s:a>
+ <s:url id="removeBookmark" action="removeBookmark" escapeAmp="true">
+ <s:param name="bookmarkId"><s:property value="%{#wikittyId}" /></s:param>
+ <s:param name="searchLine"><s:property value="%{#searchLine}" /></s:param>
+ <s:param name="fullTextLine"><s:property value="%{#fullTextLine}" /></s:param>
</s:url>
<s:a cssClass="supprim" href="%{removeBookmark}"></s:a>
</div>
Modified: trunk/src/main/webapp/jsp/inc/bookmarkTop.jsp
===================================================================
--- trunk/src/main/webapp/jsp/inc/bookmarkTop.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/inc/bookmarkTop.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8" ?>
<!--
#%L
bow
Modified: trunk/src/main/webapp/jsp/inc/errorFrame.jsp
===================================================================
--- trunk/src/main/webapp/jsp/inc/errorFrame.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/inc/errorFrame.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
String userError = (String)request.getAttribute("errorMsgUser");
Modified: trunk/src/main/webapp/jsp/inc/rightMenu.jsp
===================================================================
--- trunk/src/main/webapp/jsp/inc/rightMenu.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/inc/rightMenu.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8" ?>
<!--
#%L
bow
@@ -48,13 +47,10 @@
<s:set var="searchLine" value="%{request.bookmarkActions.searchLine}" />
<s:set var="fullTextLine" value="%{request.bookmarkActions.fullTextLine}" />
-<div id="logoutDiv" xmlns="http://www.w3.org/1999/xhtml"
- xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
- xmlns:jsp="http://java.sun.com/JSP/Page"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<div id="logoutDiv">
<s:form action="logout">
<div class="input">
- <s:submit key="bow.rightMenu.logout" />
+ <s:submit key="bow.rightMenu.logout" name="submit" />
</div>
</s:form>
<a href="http://maven-site.chorem.org/bow/" class="help" onclick="window.open(this.href); return false;"><s:text name="bow.rightMenu.help" /></a>
@@ -80,13 +76,15 @@
<div id="add" class="clearfix">
<h2><s:text name="bow.rightMenu.bookmark.addModify" /></h2>
<s:form id="bookmarkForm" action="%{#request.formAction}">
- <s:textfield key="bow.rightMenu.bookmark.link" name="link" value="%{#request.link}" labelSeparator="" /><br />
- <s:textfield key="bow.rightMenu.bookmark.alias" name="alias" value="%{#request.alias}" labelSeparator="" /><br />
- <s:textfield key="bow.rightMenu.bookmark.name" name="name" value="%{#request.name}" labelSeparator="" /><br />
- <s:textfield key="bow.rightMenu.bookmark.tags" name="tags" value="%{#request.tags}" labelSeparator="" /><br /><br />
- <s:hidden name="searchLine" value="%{searchLine}" />
- <s:hidden name="fullTextLine" value="%{fullTextLine}" />
- <s:submit key="bow.rightMenu.bookmark.submit" />
+ <p>
+ <s:textfield key="bow.rightMenu.bookmark.link" name="link" value="%{#request.link}" labelSeparator="" /><br />
+ <s:textfield key="bow.rightMenu.bookmark.alias" name="alias" value="%{#request.alias}" labelSeparator="" /><br />
+ <s:textfield key="bow.rightMenu.bookmark.name" name="name" value="%{#request.name}" labelSeparator="" /><br />
+ <s:textfield key="bow.rightMenu.bookmark.tags" name="tags" value="%{#request.tags}" labelSeparator="" /><br /><br />
+ <s:hidden name="searchLine" value="%{searchLine}" />
+ <s:hidden name="fullTextLine" value="%{fullTextLine}" />
+ <s:submit key="bow.rightMenu.bookmark.submit" name="submit" />
+ </p>
</s:form>
</div>
<div id="nuage">
@@ -103,7 +101,7 @@
<s:form action="search">
<div class="input">
<s:textfield key="bow.rightMenu.search" name="searchLine" labelSeparator="" />
- <s:submit key="bow.rightMenu.find.submit" />
+ <s:submit key="bow.rightMenu.find.submit" name="submit" />
</div>
</s:form>
</div>
@@ -111,7 +109,7 @@
<s:form action="fullText">
<div class="input">
<s:textfield key="bow.rightMenu.fullTextSearch" name="fullTextLine" labelSeparator="" />
- <s:submit key="bow.rightMenu.find.submit" />
+ <s:submit key="bow.rightMenu.find.submit" name="submit" />
</div>
</s:form>
</div>
@@ -121,7 +119,7 @@
<s:file size="15%" name="upfile" key="bow.rightMenu.importBookmarks" labelSeparator="" />
<s:hidden name="searchLine" value="%{searchLine}" />
<s:hidden name="fullTextLine" value="%{fullTextLine}" />
- <s:submit key="bow.rightMenu.import.submit" />
+ <s:submit key="bow.rightMenu.import.submit" name="submit" />
</div>
</s:form>
<s:a action="exportBookmarks"><s:text name="bow.rightMenu.exportBookmarks" /></s:a>
Modified: trunk/src/main/webapp/jsp/inc/tagsCloud.jsp
===================================================================
--- trunk/src/main/webapp/jsp/inc/tagsCloud.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/inc/tagsCloud.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -26,33 +26,19 @@
<%@page import="org.chorem.bow.BookmarkActions" %>
<%@page import="java.util.List" %>
<%@page import="org.nuiton.wikitty.FacetTopic" %>
-<%
-BookmarkActions bookmarkActions = (BookmarkActions)request.getAttribute("bookmarkActions");
-int nbTags = (Integer)request.getAttribute("nbTags");
-String search = "";
-String searchLine = request.getParameter("searchLine");
-if (searchLine != null) {
- search += "&searchLine=" + searchLine;
-}
-if (bookmarkActions != null) {
- List<FacetTopic> tagCloud = bookmarkActions.getTagsCloud();
- int count = 0;
- for (FacetTopic tag : tagCloud) {
- int value = tag.getCount();
- String tagName = tag.getTopicName();
- int font = bookmarkActions.getFont(value);
- %>
- <s:url id="search" action="search" escapeAmp="false">
- <s:param name="addTag"><%=tagName%></s:param>
- <s:param name="searchLine"><s:property value="%{#request.searchLine}" /></s:param>
- </s:url>
- <!-- title="??value?? result??(value != 1 ? \"s\" : \"\")??" style="font-size: ??font??px;"-->
- <s:a href="%{#search}" class="tag"><%=tagName%></s:a>
- <%
- ++count;
- if (count >= nbTags) {
- break;
- }
- }
-}
-%>
+<s:if test="%{#request.nbTags > #request.bookmarkActions.tagsCloud.size()}">
+ <s:set var="maxTags" value="#request.bookmarkActions.tagsCloud.size()" />
+</s:if>
+<s:else>
+ <s:set var="maxTags" value="#request.nbTags" />
+</s:else>
+<s:iterator value="%{#request.bookmarkActions.tagsCloud}" status="tag" begin="0" end="%{#maxTags - 1}">
+ <s:url id="search" action="search" escapeAmp="true">
+ <s:param name="addTag"><s:property value="topicName" /></s:param>
+ <s:if test="%{request.searchLine != null}">
+ <s:param name="searchLine">&searchLine=<s:property value="%{request.searchLine}" /></s:param>
+ </s:if>
+ </s:url>
+ <!-- -->
+ <s:a href="%{search}" title="%{count} results" cssClass="tag" cssStyle="font-size: %{#request.bookmarkActions.getFont(count)}px"><s:property value="topicName" /></s:a>
+</s:iterator>
Modified: trunk/src/main/webapp/jsp/login.jsp
===================================================================
--- trunk/src/main/webapp/jsp/login.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/login.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
@@ -18,11 +17,11 @@
<h1><s:text name="bow.login.title" /></h1>
<s:actionerror />
<s:form action="login">
- <p>
- <s:textfield key="bow.login.email" name="email" labelposition="top" labelSeparator=" :" /><br /><br />
- <s:password key="bow.login.password" name="password" labelposition="top" labelSeparator=" :" /><br /><br />
- <s:submit key="bow.login.submit" />
- </p>
+ <p>
+ <s:textfield key="bow.login.email" name="email" labelposition="top" labelSeparator=" :" /><br /><br />
+ <s:password key="bow.login.password" name="password" labelposition="top" labelSeparator=" :" /><br /><br />
+ <s:submit key="bow.login.submit" name="submit" />
+ </p>
</s:form>
<s:a action="register_input" id="registerLink"><s:text name="bow.register.title" /></s:a><br />
<s:a action="forgotPassword_input" id="forgotPwd"><s:text name="bow.forgotpwd.title" /></s:a>
Modified: trunk/src/main/webapp/jsp/preferences.jsp
===================================================================
--- trunk/src/main/webapp/jsp/preferences.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/preferences.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
bow
@@ -65,7 +64,7 @@
<s:textfield key="bow.preferences.searchEngineUrlSuggestions" name="searchEngineUrlSuggestions" labelposition="top" /><br />
<s:textfield key="bow.preferences.searchEngineUrlResults" name="searchEngineUrlResults" labelposition="top" /><br />
<s:hidden name="update" value="1" />
- <s:submit key="bow.preferences.submit" />
+ <s:submit key="bow.preferences.submit" name="submit" />
<br /><br />
<s:url id="home" action="home" />
<s:a href="%{home}" id="homePage"><s:text name="bow.home.title" /></s:a>
Modified: trunk/src/main/webapp/jsp/register.jsp
===================================================================
--- trunk/src/main/webapp/jsp/register.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/register.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
<!--
#%L
bow
@@ -43,7 +42,7 @@
<s:textfield key="bow.login.email" name="email" labelposition="top" labelSeparator=" :" />
<s:password key="bow.login.password" name="password" labelposition="top" labelSeparator=" :" />
<s:password key="bow.login.repeatPassword" name="repeatPassword" labelposition="top" labelSeparator=" :" />
- <s:submit key="bow.register.submit" />
+ <s:submit key="bow.register.submit" name="submit" />
</p>
</s:form>
<s:a action="login_input" id="loginLink"><s:text name="bow.login.title" /></s:a>
Modified: trunk/src/main/webapp/jsp/search.jsp
===================================================================
--- trunk/src/main/webapp/jsp/search.jsp 2011-02-03 16:09:14 UTC (rev 182)
+++ trunk/src/main/webapp/jsp/search.jsp 2011-02-03 18:08:18 UTC (rev 183)
@@ -63,7 +63,7 @@
<option value="ascDate"><s:text name="bow.search.ascdate" /></option>
<option value="descDate"><s:text name="bow.search.descdate" /></option>
</select>
- <s:submit key="bow.search.submit" />
+ <s:submit key="bow.search.submit" name="submit" />
<s:set name="bookmarksToDelete" value="%{#request.bookmarkActions.getBookmarks().size()}" />
<s:if test="%{#bookmarksToDelete > 0}">
<s:url id="deleteSearchResults" action="deleteSearchResults" escapeAmp="false">
Added: trunk/src/main/webapp/template/simple/form-common.ftl
===================================================================
--- trunk/src/main/webapp/template/simple/form-common.ftl (rev 0)
+++ trunk/src/main/webapp/template/simple/form-common.ftl 2011-02-03 18:08:18 UTC (rev 183)
@@ -0,0 +1,64 @@
+<#--
+/*
+ * $Id: form.ftl 590812 2007-10-31 20:32:54Z apetrelli $
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+-->
+<#if (parameters.validate?default(false) == false)><#rt/>
+ <#if parameters.onsubmit??><#rt/>
+ ${tag.addParameter('onsubmit', "${parameters.onsubmit}") }
+ </#if>
+</#if>
+<form<#rt/>
+<#if parameters.id??>
+ id="${parameters.id?html}"<#rt/>
+</#if>
+<#if parameters.onsubmit??>
+ onsubmit="${parameters.onsubmit?html}"<#rt/>
+</#if>
+<#if parameters.onreset??>
+ onreset="${parameters.onreset?html}"<#rt/>
+</#if>
+<#if parameters.action??>
+ action="${parameters.action?html}"<#rt/>
+</#if>
+<#if parameters.target??>
+ target="${parameters.target?html}"<#rt/>
+</#if>
+<#if parameters.method??>
+ method="${parameters.method?html}"<#rt/>
+<#else>
+ method="post"<#rt/>
+</#if>
+<#if parameters.enctype??>
+ enctype="${parameters.enctype?html}"<#rt/>
+</#if>
+<#if parameters.cssClass??>
+ class="${parameters.cssClass?html}"<#rt/>
+</#if>
+<#if parameters.cssStyle??>
+ style="${parameters.cssStyle?html}"<#rt/>
+</#if>
+<#if parameters.title??>
+ title="${parameters.title?html}"<#rt/>
+</#if>
+<#if parameters.acceptcharset??>
+ accept-charset="${parameters.acceptcharset?html}"<#rt/>
+</#if>
+<#include "/${parameters.templateDir}/simple/dynamic-attributes.ftl" />
1
0
r182 - in trunk/src/main: java/org/chorem/bow/action java/org/chorem/bow/interceptor resources resources/i18n
by vbriand@users.chorem.org 03 Feb '11
by vbriand@users.chorem.org 03 Feb '11
03 Feb '11
Author: vbriand
Date: 2011-02-03 17:09:14 +0100 (Thu, 03 Feb 2011)
New Revision: 182
Url: http://chorem.org/repositories/revision/bow/182
Log:
The user is now redirected to the login page if he tries to access a page where login is mandatory, and to the home page if he is already logged in and tries to access the login / register pages.
Added:
trunk/src/main/java/org/chorem/bow/interceptor/AldyLoggedInterceptor.java
Modified:
trunk/src/main/java/org/chorem/bow/action/GenerateTokenAction.java
trunk/src/main/java/org/chorem/bow/action/HomeAction.java
trunk/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java
trunk/src/main/java/org/chorem/bow/action/LoginAction.java
trunk/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java
trunk/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java
trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java
trunk/src/main/java/org/chorem/bow/interceptor/LoginInterceptor.java
trunk/src/main/resources/i18n/bow_fr_FR.properties
trunk/src/main/resources/struts.xml
Modified: trunk/src/main/java/org/chorem/bow/action/GenerateTokenAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/GenerateTokenAction.java 2011-02-03 14:26:21 UTC (rev 181)
+++ trunk/src/main/java/org/chorem/bow/action/GenerateTokenAction.java 2011-02-03 16:09:14 UTC (rev 182)
@@ -23,41 +23,39 @@
}
public String execute() {
- User user = (User)session.get("user");
-
- if (user != null) {
- WikittyProxy proxy = BowProxy.getInstance();
- Criteria criteria = Search.query().eq(Token.FQ_FIELD_EMAIL, user.getEmail()).criteria();
- Token currentToken = proxy.findByCriteria(Token.class, criteria);
- if (currentToken != null) {
- String id = currentToken.getWikittyId();
- proxy.delete(id);
- }
- TokenActions tokenActions = (TokenActions)session.get("tokenActions");
-
- if (tokenActions != null) {
- String token;
- try {
- token = tokenActions.generateToken(); //Generates an encoding MD5 token
- criteria = Search.query().eq(Token.FQ_FIELD_TOKEN, token).criteria();
- Token oldToken = proxy.findByCriteria(Token.class, criteria);
-
- if (oldToken == null) { //Checks if the token already exists
- TokenImpl newToken = new TokenImpl();
- newToken.setToken(token);
- newToken.setEmail(user.getEmail());
- proxy.store((Token) newToken); //If the token doesn't exist, it is stored
- tokenActions.setPermanentToken(token);
- } else {
- tokenActions.setPermanentToken("");
- }
- } catch (NoSuchAlgorithmException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ User user = (User)session.get("user");
+ WikittyProxy proxy = BowProxy.getInstance();
+ Criteria criteria = Search.query().eq(Token.FQ_FIELD_EMAIL, user.getEmail()).criteria();
+ Token currentToken = proxy.findByCriteria(Token.class, criteria);
+
+ if (currentToken != null) {
+ String id = currentToken.getWikittyId();
+ proxy.delete(id);
+ }
+ TokenActions tokenActions = (TokenActions)session.get("tokenActions");
+
+ if (tokenActions != null) {
+ String token;
+
+ try {
+ token = tokenActions.generateToken(); //Generates an encoding MD5 token
+ criteria = Search.query().eq(Token.FQ_FIELD_TOKEN, token).criteria();
+ Token oldToken = proxy.findByCriteria(Token.class, criteria);
+
+ if (oldToken == null) { //Checks if the token already exists
+ TokenImpl newToken = new TokenImpl();
+ newToken.setToken(token);
+ newToken.setEmail(user.getEmail());
+ proxy.store((Token) newToken); //If the token doesn't exist, it is stored
+ tokenActions.setPermanentToken(token);
+ } else {
+ tokenActions.setPermanentToken("");
}
+ } catch (NoSuchAlgorithmException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
- return SUCCESS;
}
- return LOGIN;
+ return SUCCESS;
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/chorem/bow/action/HomeAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/HomeAction.java 2011-02-03 14:26:21 UTC (rev 181)
+++ trunk/src/main/java/org/chorem/bow/action/HomeAction.java 2011-02-03 16:09:14 UTC (rev 182)
@@ -1,6 +1,5 @@
package org.chorem.bow.action;
-import java.security.NoSuchAlgorithmException;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
@@ -8,12 +7,7 @@
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.SessionAware;
import org.chorem.bow.BowInit;
-import org.chorem.bow.BowProxy;
-import org.chorem.bow.Token;
import org.chorem.bow.User;
-import org.nuiton.wikitty.Criteria;
-import org.nuiton.wikitty.WikittyProxy;
-import org.nuiton.wikitty.search.Search;
public class HomeAction extends BowBaseAction implements SessionAware, ServletRequestAware {
private static final long serialVersionUID = -3735250067223062719L;
@@ -43,39 +37,11 @@
public void setServletRequest(HttpServletRequest request) {
this.request = request;
}
-
- protected User checkPermanentToken(String token) {
- if (token != null) {
- WikittyProxy proxy = BowProxy.getInstance();
- Criteria criteria = Search.query().eq(Token.FQ_FIELD_TOKEN, token).criteria();
- Token DbToken = proxy.findByCriteria(Token.class, criteria);
- if (DbToken != null) { //Check if the token exists
- criteria = Search.query().eq(User.FQ_FIELD_EMAIL, DbToken.getEmail()).criteria(); //Retrieves user by token
- return proxy.findByCriteria(User.class, criteria);
- }
- }
- return null;
- }
-
public String execute() {
User user = (User)session.get("user");
- if (user == null) {
- user = checkPermanentToken(token);
- if (user != null) {
- try {
- BowInit.initSession(session, user);
- } catch (NoSuchAlgorithmException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- if (user != null) {
- BowInit.initHomePage(request, user);
- return SUCCESS;
- }
- return LOGIN;
+ BowInit.initHomePage(request, user);
+ return SUCCESS;
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java 2011-02-03 14:26:21 UTC (rev 181)
+++ trunk/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java 2011-02-03 16:09:14 UTC (rev 182)
@@ -190,71 +190,68 @@
public String execute() {
User user = (User)session.get("user");
- if (user != null) {
- if (upfile != null) {
- try {
- List<?> lines;
+ if (upfile != null) {
+ try {
+ List<?> lines;
- lines = FileUtils.readLines(upfile);
- String content = "";
+ lines = FileUtils.readLines(upfile);
+ String content = "";
- for (Object line : lines) {
- content += (String)line;
- }
- WikittyProxy proxy = BowProxy.getInstance();
+ for (Object line : lines) {
+ content += (String)line;
+ }
+ WikittyProxy proxy = BowProxy.getInstance();
- try {
- Parser parser = new Parser(content);
- NodeList list = parser.parse(null);
- List<Bookmark> bookmarks = new ArrayList<Bookmark>();
- parseHtmlToBookmarks(list, user, bookmarks, new ArrayList<String>());
- bookmarks = proxy.store(bookmarks);
- createImportExtension(bookmarks);
- redirectTo = BowUtils.redirectTo(searchLine, fullTextLine);
- if (searchLine == null || searchLine.isEmpty()) {
- BowInit.initHomePage(request, user);
- return SUCCESS;
- } else {
- try {
- BowSearch.search(request, user);
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (ServletException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- return SUCCESS;
+ try {
+ Parser parser = new Parser(content);
+ NodeList list = parser.parse(null);
+ List<Bookmark> bookmarks = new ArrayList<Bookmark>();
+ parseHtmlToBookmarks(list, user, bookmarks, new ArrayList<String>());
+ bookmarks = proxy.store(bookmarks);
+ createImportExtension(bookmarks);
+ redirectTo = BowUtils.redirectTo(searchLine, fullTextLine);
+ if (searchLine == null || searchLine.isEmpty()) {
+ BowInit.initHomePage(request, user);
+ return SUCCESS;
+ } else {
+ try {
+ BowSearch.search(request, user);
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (ServletException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
}
- } catch (ParserException e) {
- request.setAttribute("errorMsgUser", getText(n_("bow.bookmark.badFileFormat")));
- request.setAttribute("errorMsgTech", e.getMessage());
- redirectTo = BowUtils.redirectTo(searchLine, fullTextLine);
-
- if (searchLine == null || searchLine.isEmpty()) {
- BowInit.initHomePage(request, user);
- return SUCCESS;
- } else {
- try {
- BowSearch.search(request, user);
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (ServletException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- return SUCCESS;
- }
+ return SUCCESS;
}
- } catch (IOException e2) {
- // TODO Auto-generated catch block
- e2.printStackTrace();
+ } catch (ParserException e) {
+ request.setAttribute("errorMsgUser", getText(n_("bow.bookmark.badFileFormat")));
+ request.setAttribute("errorMsgTech", e.getMessage());
+ redirectTo = BowUtils.redirectTo(searchLine, fullTextLine);
+
+ if (searchLine == null || searchLine.isEmpty()) {
+ BowInit.initHomePage(request, user);
+ return SUCCESS;
+ } else {
+ try {
+ BowSearch.search(request, user);
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ } catch (ServletException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ return SUCCESS;
+ }
}
- return ERROR;
+ } catch (IOException e2) {
+ // TODO Auto-generated catch block
+ e2.printStackTrace();
}
- return SUCCESS;
+ return ERROR;
}
- return LOGIN;
+ return SUCCESS;
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/chorem/bow/action/LoginAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/LoginAction.java 2011-02-03 14:26:21 UTC (rev 181)
+++ trunk/src/main/java/org/chorem/bow/action/LoginAction.java 2011-02-03 16:09:14 UTC (rev 182)
@@ -90,7 +90,7 @@
}
return null;
}
-
+
public String execute() {
if (email != null) {
email = email.trim();
Modified: trunk/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java 2011-02-03 14:26:21 UTC (rev 181)
+++ trunk/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java 2011-02-03 16:09:14 UTC (rev 182)
@@ -85,74 +85,72 @@
public String execute() {
User user = (User)session.get("user");
- if (user != null) {
- if (searchLine != null && searchLine.matches("^http://[^ ]*")) {
- redirectTo = BowUtils.redirectTo(searchLine, null);
- } else if (searchLine != null
- && (searchLine.startsWith(":") || searchLine.startsWith("t:")) ) {
- //On fait une recherche sur les tags
-
- int index = searchLine.indexOf(":");
- searchLine = searchLine.substring(index+1); //Suppresses first ":"
-
- session.put("user", user);
- try {
- BowInit.initializeToken(session, user);
- } catch (NoSuchAlgorithmException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- WikittyProxy proxy = BowProxy.getInstance();
- Criteria criteria = BowBookmark.getBookmarkListCriteriaByUser(user, searchLine);
- criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
- PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria); //Retrieves bookmarks by search
- BookmarkActions bookmarkActions = BowBookmark.createBookmarkActions(request, result, searchLine);
- request.setAttribute("bookmarkActions", bookmarkActions);
- request.setAttribute("token", token);
- redirectTo = BowUtils.redirectTo(searchLine, null);
- } else if (searchLine != null && searchLine.startsWith("f:")) {
- // recherche fulltext dans bow
- String fullText = searchLine.substring(2);
-
- session.put("user", user);
- try {
- BowInit.initializeToken(session, user);
- } catch (NoSuchAlgorithmException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- WikittyProxy proxy = BowProxy.getInstance();
- Criteria criteria;
- if (!fullText.isEmpty()) {
- criteria = Search.query().keyword(fullText).
- eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addFacetField(Bookmark.FQ_FIELD_TAGS);
- } else {
- criteria = BowBookmark.getBookmarkListCriteriaByUser(user, null);
- }
- PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria);
- BookmarkActions bookmarkActions = BowBookmark.createBookmarkActions(request, result, null);
- request.setAttribute("bookmarkActions", bookmarkActions);
- request.setAttribute("token", token);
- redirectTo = BowUtils.redirectTo(searchLine, null);
- } else if (searchLine != null && searchLine.startsWith("a:")) {
- // on redirige vers l'alias demande
- searchLine = searchLine.substring(2);
- redirectTo = BowConfig.getInstance().getAliasUrl() + searchLine;
+ if (searchLine != null && searchLine.matches("^http://[^ ]*")) {
+ redirectTo = BowUtils.redirectTo(searchLine, null);
+ } else if (searchLine != null
+ && (searchLine.startsWith(":") || searchLine.startsWith("t:")) ) {
+ //On fait une recherche sur les tags
+
+ int index = searchLine.indexOf(":");
+ searchLine = searchLine.substring(index+1); //Suppresses first ":"
+
+ session.put("user", user);
+ try {
+ BowInit.initializeToken(session, user);
+ } catch (NoSuchAlgorithmException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ WikittyProxy proxy = BowProxy.getInstance();
+ Criteria criteria = BowBookmark.getBookmarkListCriteriaByUser(user, searchLine);
+ criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
+ PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria); //Retrieves bookmarks by search
+ BookmarkActions bookmarkActions = BowBookmark.createBookmarkActions(request, result, searchLine);
+ request.setAttribute("bookmarkActions", bookmarkActions);
+ request.setAttribute("token", token);
+ redirectTo = BowUtils.redirectTo(searchLine, null);
+ } else if (searchLine != null && searchLine.startsWith("f:")) {
+ // recherche fulltext dans bow
+ String fullText = searchLine.substring(2);
+
+ session.put("user", user);
+ try {
+ BowInit.initializeToken(session, user);
+ } catch (NoSuchAlgorithmException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ WikittyProxy proxy = BowProxy.getInstance();
+ Criteria criteria;
+ if (!fullText.isEmpty()) {
+ criteria = Search.query().keyword(fullText).
+ eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
+ addFacetField(Bookmark.FQ_FIELD_TAGS);
} else {
- // on fait une recherche sur le moteur de recherche configure
- WikittyProxy proxy = BowProxy.getInstance();
- Preference pref = proxy.restore(Preference.class, user.getWikittyId());
-
- String searchEngineURL = pref.getSearchEngineUrlResults();
- if (searchEngineURL == null || "".equals(searchEngineURL)) {
- BowConfig config = BowConfig.getInstance();
- searchEngineURL = config.getSearchEngine();
- }
- searchEngineURL = searchEngineURL.replace("{searchTerms}", searchLine);
- searchEngineURL = response.encodeRedirectURL(searchEngineURL);
- redirectTo = searchEngineURL;
+ criteria = BowBookmark.getBookmarkListCriteriaByUser(user, null);
}
+ PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria);
+ BookmarkActions bookmarkActions = BowBookmark.createBookmarkActions(request, result, null);
+ request.setAttribute("bookmarkActions", bookmarkActions);
+ request.setAttribute("token", token);
+ redirectTo = BowUtils.redirectTo(searchLine, null);
+ } else if (searchLine != null && searchLine.startsWith("a:")) {
+ // on redirige vers l'alias demande
+ searchLine = searchLine.substring(2);
+ redirectTo = BowConfig.getInstance().getAliasUrl() + searchLine;
+ } else {
+ // on fait une recherche sur le moteur de recherche configure
+ WikittyProxy proxy = BowProxy.getInstance();
+ Preference pref = proxy.restore(Preference.class, user.getWikittyId());
+
+ String searchEngineURL = pref.getSearchEngineUrlResults();
+ if (searchEngineURL == null || "".equals(searchEngineURL)) {
+ BowConfig config = BowConfig.getInstance();
+ searchEngineURL = config.getSearchEngine();
+ }
+ searchEngineURL = searchEngineURL.replace("{searchTerms}", searchLine);
+ searchEngineURL = response.encodeRedirectURL(searchEngineURL);
+ redirectTo = searchEngineURL;
}
return SUCCESS;
}
Modified: trunk/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java 2011-02-03 14:26:21 UTC (rev 181)
+++ trunk/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java 2011-02-03 16:09:14 UTC (rev 182)
@@ -52,36 +52,34 @@
public String execute() {
User user = (User)session.get("user");
- if (user != null) {
- if (searchLine != null) {
- OpenSearchActions openSearchActions = new OpenSearchActions();
- WikittyProxy proxy = BowProxy.getInstance();
- String[] words = searchLine.split("\\s+");
- List<String> searchLineList = new ArrayList<String>(Arrays.asList(words));
+ if (searchLine != null) {
+ OpenSearchActions openSearchActions = new OpenSearchActions();
+ WikittyProxy proxy = BowProxy.getInstance();
+ String[] words = searchLine.split("\\s+");
+ List<String> searchLineList = new ArrayList<String>(Arrays.asList(words));
- if (searchLine.charAt(searchLine.length() - 1) == ' ') {
- searchLineList.add(""); //If the user doesn't type anything, we have to propose suggestions
- }
- Criteria criteria;
+ if (searchLine.charAt(searchLine.length() - 1) == ' ') {
+ searchLineList.add(""); //If the user doesn't type anything, we have to propose suggestions
+ }
+ Criteria criteria;
- if (searchLineList.size() > 1) {
- List<String> cpy = new ArrayList<String>(searchLineList);
- cpy.remove(cpy.size() - 1);
- criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).
- eq(Bookmark.FQ_FIELD_TAGS, cpy).criteria().addFacetField(Bookmark.FQ_FIELD_TAGS);
- } else {
- criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).
- criteria().addFacetField(Bookmark.FQ_FIELD_TAGS);
- }
- PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria);
- List<Bookmark> bookList = result.getAll();
- List<FacetTopic> topics = result.getTopic(Bookmark.FQ_FIELD_TAGS);
-
- openSearchActions.setBookmarkList(bookList);
- openSearchActions.setSuggestionList(topics);
- openSearchActions.findSuggestions(searchLineList);
- request.setAttribute("openSearchAction", openSearchActions);
+ if (searchLineList.size() > 1) {
+ List<String> cpy = new ArrayList<String>(searchLineList);
+ cpy.remove(cpy.size() - 1);
+ criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).
+ eq(Bookmark.FQ_FIELD_TAGS, cpy).criteria().addFacetField(Bookmark.FQ_FIELD_TAGS);
+ } else {
+ criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).
+ criteria().addFacetField(Bookmark.FQ_FIELD_TAGS);
}
+ PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria);
+ List<Bookmark> bookList = result.getAll();
+ List<FacetTopic> topics = result.getTopic(Bookmark.FQ_FIELD_TAGS);
+
+ openSearchActions.setBookmarkList(bookList);
+ openSearchActions.setSuggestionList(topics);
+ openSearchActions.findSuggestions(searchLineList);
+ request.setAttribute("openSearchAction", openSearchActions);
}
return SUCCESS;
}
Modified: trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java 2011-02-03 14:26:21 UTC (rev 181)
+++ trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java 2011-02-03 16:09:14 UTC (rev 182)
@@ -235,49 +235,45 @@
public String execute() {
User user = (User)session.get("user");
- if (user != null) {
- setBookmarksImportDate(BowBookmark.getBookmarksByImportDate(request, user));
+ setBookmarksImportDate(BowBookmark.getBookmarksByImportDate(request, user));
+ if (update != null) { //If the user submitted the form
+ WikittyProxy proxy = BowProxy.getInstance();
+ Preference preference = changePreference();
+ proxy.store(preference);
- if (update != null) { //If the user submitted the form
- WikittyProxy proxy = BowProxy.getInstance();
- Preference preference = changePreference();
- proxy.store(preference);
-
- User newUser = proxy.restore(User.class, user.getWikittyId());
- Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, email).criteria();
- User find = proxy.findByCriteria(User.class, criteria);
+ User newUser = proxy.restore(User.class, user.getWikittyId());
+ Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, email).criteria();
+ User find = proxy.findByCriteria(User.class, criteria);
- if (find == null || find.getEmail().equals(user.getEmail())) { //If this email address isn't already used by someone else
- try {
- newUser = changeUser(newUser);
- } catch (NoSuchAlgorithmException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- newUser = proxy.store(newUser);
- session.put("user", newUser);
-
- preference = proxy.restore(Preference.class, newUser.getWikittyId());
- session.put("preference", preference);
- return "update";
+ if (find == null || find.getEmail().equals(user.getEmail())) { //If this email address isn't already used by someone else
+ try {
+ newUser = changeUser(newUser);
+ } catch (NoSuchAlgorithmException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
- setEmail(user.getEmail());
- addActionError(getText("bow.preferences.emailAldyExists"));
- return ERROR;
- } else { //If the user didn't submit the form, the fields are filled with the current preferences values
- Preference preference = (Preference)session.get("preference");
+ newUser = proxy.store(newUser);
+ session.put("user", newUser);
- setEmail(user.getEmail());
- if (preference != null) {
- setColors(preference.getColors());
- setTagsNb(String.valueOf(preference.getTags()));
- setBookmarksHomePage(String.valueOf(preference.getBookmarks()));
- setSearchEngineUrlSuggestions(preference.getSearchEngineUrlSuggestions());
- setSearchEngineUrlResults(preference.getSearchEngineUrlResults());
- }
+ preference = proxy.restore(Preference.class, newUser.getWikittyId());
+ session.put("preference", preference);
+ return "update";
}
- return SUCCESS;
+ setEmail(user.getEmail());
+ addActionError(getText("bow.preferences.emailAldyExists"));
+ return ERROR;
+ } else { //If the user didn't submit the form, the fields are filled with the current preferences values
+ Preference preference = (Preference)session.get("preference");
+
+ setEmail(user.getEmail());
+ if (preference != null) {
+ setColors(preference.getColors());
+ setTagsNb(String.valueOf(preference.getTags()));
+ setBookmarksHomePage(String.valueOf(preference.getBookmarks()));
+ setSearchEngineUrlSuggestions(preference.getSearchEngineUrlSuggestions());
+ setSearchEngineUrlResults(preference.getSearchEngineUrlResults());
+ }
}
- return LOGIN;
+ return SUCCESS;
}
}
Added: trunk/src/main/java/org/chorem/bow/interceptor/AldyLoggedInterceptor.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/interceptor/AldyLoggedInterceptor.java (rev 0)
+++ trunk/src/main/java/org/chorem/bow/interceptor/AldyLoggedInterceptor.java 2011-02-03 16:09:14 UTC (rev 182)
@@ -0,0 +1,34 @@
+package org.chorem.bow.interceptor;
+
+import java.util.Map;
+
+import org.apache.struts2.ServletActionContext;
+import org.chorem.bow.User;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
+
+public class AldyLoggedInterceptor extends AbstractInterceptor {
+ private static final long serialVersionUID = -2411549996072421471L;
+ protected String redirect;
+
+ /**
+ * @param redirect the redirect to set
+ */
+ public void setRedirect(String redirect) {
+ this.redirect = redirect;
+ }
+
+ @Override
+ public String intercept(ActionInvocation invocation) throws Exception {
+ Map<String, Object> session = ActionContext.getContext().getSession();
+
+ if ((User)session.get("user") != null) {
+ ServletActionContext.getResponse().sendRedirect(redirect);
+ return null;
+ }
+ return invocation.invoke();
+ }
+
+}
Property changes on: trunk/src/main/java/org/chorem/bow/interceptor/AldyLoggedInterceptor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/src/main/java/org/chorem/bow/interceptor/LoginInterceptor.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/interceptor/LoginInterceptor.java 2011-02-03 14:26:21 UTC (rev 181)
+++ trunk/src/main/java/org/chorem/bow/interceptor/LoginInterceptor.java 2011-02-03 16:09:14 UTC (rev 182)
@@ -2,6 +2,7 @@
import java.util.Map;
+import org.apache.struts2.ServletActionContext;
import org.chorem.bow.BowInit;
import org.chorem.bow.BowUtils;
import org.chorem.bow.User;
@@ -12,7 +13,15 @@
public class LoginInterceptor extends AbstractInterceptor {
private static final long serialVersionUID = -7520186185205372272L;
+ protected String redirect;
+ /**
+ * @param redirect the redirect to set
+ */
+ public void setRedirect(String redirect) {
+ this.redirect = redirect;
+ }
+
@Override
public String intercept(ActionInvocation invocation) throws Exception {
Map<String, Object> session = ActionContext.getContext().getSession();
@@ -22,8 +31,15 @@
String[] token = (String[])toto.get("token");
if (token != null && !token[0].isEmpty()) {
- BowInit.initSession(session, BowUtils.checkToken(token[0], session));
+ User user = BowUtils.checkToken(token[0], session);
+
+ if (user != null) {
+ BowInit.initSession(session, user);
+ return invocation.invoke();
+ }
}
+ ServletActionContext.getResponse().sendRedirect(redirect);
+ return null;
}
return invocation.invoke();
}
Modified: trunk/src/main/resources/i18n/bow_fr_FR.properties
===================================================================
--- trunk/src/main/resources/i18n/bow_fr_FR.properties 2011-02-03 14:26:21 UTC (rev 181)
+++ trunk/src/main/resources/i18n/bow_fr_FR.properties 2011-02-03 16:09:14 UTC (rev 182)
@@ -25,7 +25,7 @@
bow.home.title=Accueil
bow.label.locale.english=
bow.label.locale.french=
-bow.login.authenticationFailure=Soit votre adresse email n''existe pas, soit votre vot de passe est eronn\u00E9
+bow.login.authenticationFailure=Soit votre adresse email n''existe pas, soit votre mot de passe est eronn\u00E9
bow.login.email=Email
bow.login.email.required=Veuillez entrer votre adresse email
bow.login.email.wrongformat=Votre adresse email est invalide
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-02-03 14:26:21 UTC (rev 181)
+++ trunk/src/main/resources/struts.xml 2011-02-03 16:09:14 UTC (rev 182)
@@ -8,16 +8,29 @@
<!-- <default-action-ref name="" />--><!-- TODO: action à lancer quand une action n'existe pas -->
<package name="login" extends="struts-default">
+ <interceptors>
+ <interceptor name="aldyLogged" class="org.chorem.bow.interceptor.AldyLoggedInterceptor">
+ <param name="redirect">home.action</param>
+ </interceptor>
+ <interceptor-stack name="aldyLoggedStack">
+ <interceptor-ref name="aldyLogged" />
+ <interceptor-ref name="defaultStack" />
+ </interceptor-stack>
+ </interceptors>
<action name="register_*" method="{1}" class="org.chorem.bow.action.RegisterAction">
+ <interceptor-ref name="aldyLoggedStack" />
<result name="input">/jsp/register.jsp</result>
<result type="redirectAction">home</result>
</action>
<action name="forgotPassword_*" method="{1}" class="org.chorem.bow.action.ForgotPasswordAction">
+ <interceptor-ref name="aldyLoggedStack" />
<result name="input">/jsp/forgotPassword.jsp</result>
- <result>/home.action</result>
+ <result type="redirectAction">login_input</result>
</action>
<action name="login_*" method="{1}" class="org.chorem.bow.action.LoginAction">
+ <interceptor-ref name="aldyLoggedStack" />
<result name="input">/jsp/login.jsp</result>
+ <result name="login" type="redirectAction">home</result>
<result type="redirectAction">home</result>
</action>
<action name="logout" class="org.chorem.bow.action.LogoutAction">
@@ -26,75 +39,109 @@
</package>
<package name="bookmark" extends="struts-default">
+ <interceptors>
+ <interceptor name="login" class="org.chorem.bow.interceptor.LoginInterceptor">
+ <param name="redirect">login_input.action</param>
+ </interceptor>
+ <interceptor-stack name="loginStack">
+ <interceptor-ref name="login" />
+ <interceptor-ref name="defaultStack" />
+ </interceptor-stack>
+ </interceptors>
<action name="importBookmarks" class="org.chorem.bow.action.ImportBookmarksAction">
+ <interceptor-ref name="loginStack" />
<result name="error" type="redirectAction">error</result>
- <result name="login" type="redirectAction">login_input</result>
<result type="redirect">${redirectTo}</result>
</action>
- <action name="exportBookmarks" class="org.chorem.bow.action.ExportBookmarksAction" />
+ <action name="exportBookmarks" class="org.chorem.bow.action.ExportBookmarksAction">
+ <interceptor-ref name="loginStack" />
+ </action>
<action name="modifyBookmark" class="org.chorem.bow.action.ModifyBookmarkAction">
+ <interceptor-ref name="loginStack" />
<result type="redirectAction">home</result>
</action>
<action name="removeBookmark" class="org.chorem.bow.action.RemoveBookmarkAction">
+ <interceptor-ref name="loginStack" />
<result type="redirect">${redirectTo}</result>
</action>
<action name="editBookmark" class="org.chorem.bow.action.EditBookmarkAction">
+ <interceptor-ref name="loginStack" />
<result name="home" type="redirectAction">home</result>
<result name="search">/jsp/search.jsp</result>
</action>
<action name="deleteImport" class="org.chorem.bow.action.DeleteImportAction">
+ <interceptor-ref name="loginStack" />
<result type="redirectAction">preferences</result>
</action>
<action name="addUrl" class="org.chorem.bow.action.AddUrlAction">
+ <interceptor-ref name="loginStack" />
<result type="redirect">${redirectTo}</result>
</action>
</package>
<package name="search" extends="struts-default">
<interceptors>
- <interceptor name="login" class="org.chorem.bow.interceptor.LoginInterceptor" />
+ <interceptor name="login" class="org.chorem.bow.interceptor.LoginInterceptor">
+ <param name="redirect">login_input.action</param>
+ </interceptor>
<interceptor-stack name="loginStack">
<interceptor-ref name="login" />
<interceptor-ref name="defaultStack" />
</interceptor-stack>
</interceptors>
<action name="search" class="org.chorem.bow.action.SearchAction">
- <result>/jsp/search.jsp</result>
+ <interceptor-ref name="loginStack" />
+ <result>/jsp/search.jsp</result>
</action>
<action name="fullText" class="org.chorem.bow.action.FullTextSearchAction">
- <result>/jsp/search.jsp</result>
+ <interceptor-ref name="loginStack" />
+ <result>/jsp/search.jsp</result>
</action>
<action name="order" class="org.chorem.bow.action.OrderAction">
- <result>/jsp/search.jsp</result>
+ <interceptor-ref name="loginStack" />
+ <result>/jsp/search.jsp</result>
</action>
<action name="openSearchResult" class="org.chorem.bow.action.OpenSearchResultAction">
<interceptor-ref name="loginStack" />
<result type="redirect">${redirectTo}</result>
</action>
<action name="openSearchSuggestion" class="org.chorem.bow.action.OpenSearchSuggestionAction">
- <result>/jsp/suggestions.jsp</result>
+ <interceptor-ref name="loginStack" />
+ <result>/jsp/suggestions.jsp</result>
</action>
<action name="deleteSearchResults" class="org.chorem.bow.action.DeleteSearchResultsAction">
- <result type="redirectAction">home</result>
+ <interceptor-ref name="loginStack" />
+ <result type="redirectAction">home</result>
</action>
</package>
<package name="misc" extends="struts-default">
+ <interceptors>
+ <interceptor name="login" class="org.chorem.bow.interceptor.LoginInterceptor">
+ <param name="redirect">login_input.action</param>
+ </interceptor>
+ <interceptor-stack name="loginStack">
+ <interceptor-ref name="login" />
+ <interceptor-ref name="defaultStack" />
+ </interceptor-stack>
+ </interceptors>
<action name="home" class="org.chorem.bow.action.HomeAction">
- <result name="login" type="redirectAction">login_input</result>
+ <interceptor-ref name="loginStack" />
<result>/jsp/home.jsp</result>
</action>
<action name="locale" class="org.chorem.bow.action.LocaleAction">
<result type="redirect">/jsp/login.jsp</result>
</action>
<action name="generateToken" class="org.chorem.bow.action.GenerateTokenAction">
- <result name="login" type="redirectAction">login_input</result>
+ <interceptor-ref name="loginStack" />
<result type="redirectAction">preferences</result>
</action>
<action name="deleteTag" class="org.chorem.bow.action.DeleteTagAction">
+ <interceptor-ref name="loginStack" />
<result type="redirect">${redirectTo}</result>
</action>
<action name="addClick" class="org.chorem.bow.action.AddClickAction">
+ <interceptor-ref name="loginStack" />
<result name="error" type="redirectAction">home</result>
<result type="redirect">${link}</result>
</action>
@@ -102,16 +149,18 @@
<result>/jsp/{1}Xml.jsp</result>
</action>
<action name="preferences" class="org.chorem.bow.action.PreferencesAction">
- <result name="login" type="redirectAction">login_input</result>
+ <interceptor-ref name="loginStack" />
<result name="update" type="redirectAction">preferences</result>
<result name="error">/jsp/preferences.jsp</result>
<result>/jsp/preferences.jsp</result>
</action>
<action name="admin">
+ <interceptor-ref name="loginStack" />
<result name="error">/jsp/login.jsp</result>
<result>/jsp/admin.jsp</result>
</action>
<action name="reIndexation" class="org.chorem.bow.action.ReIndexationAction">
+ <interceptor-ref name="loginStack" />
<result>/jsp/admin.jsp</result>
</action>
</package>
1
0
r181 - in trunk/src/main: java/org/chorem/bow java/org/chorem/bow/action java/org/chorem/bow/interceptor resources webapp/WEB-INF/decorators webapp/jsp
by vbriand@users.chorem.org 03 Feb '11
by vbriand@users.chorem.org 03 Feb '11
03 Feb '11
Author: vbriand
Date: 2011-02-03 15:26:21 +0100 (Thu, 03 Feb 2011)
New Revision: 181
Url: http://chorem.org/repositories/revision/bow/181
Log:
The search engine works with the token authentication
Added:
trunk/src/main/java/org/chorem/bow/interceptor/
trunk/src/main/java/org/chorem/bow/interceptor/LoginInterceptor.java
Modified:
trunk/src/main/java/org/chorem/bow/BowInit.java
trunk/src/main/java/org/chorem/bow/BowUtils.java
trunk/src/main/java/org/chorem/bow/action/BowBaseAction.java
trunk/src/main/resources/struts.xml
trunk/src/main/webapp/WEB-INF/decorators/main.jsp
trunk/src/main/webapp/jsp/permanentXml.jsp
trunk/src/main/webapp/jsp/temporaryXml.jsp
Modified: trunk/src/main/java/org/chorem/bow/BowInit.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BowInit.java 2011-02-03 09:59:36 UTC (rev 180)
+++ trunk/src/main/java/org/chorem/bow/BowInit.java 2011-02-03 14:26:21 UTC (rev 181)
@@ -50,15 +50,18 @@
static public void initSession(Map<String, Object> session, User user) throws NoSuchAlgorithmException {
WikittyProxy proxy = BowProxy.getInstance();
- Preference preference = proxy.restore(Preference.class, user.getWikittyId());
- BowConfig config = BowConfig.getInstance();
- session.put("user", user);
- session.put("preference", preference);
- session.put("version", config.getVersion());
- session.put("bowUrl", config.getBowUrl());
- initializeToken(session, user);
- checkAdmin(session, user.getEmail());
+ if (user != null) {
+ Preference preference = proxy.restore(Preference.class, user.getWikittyId());
+ BowConfig config = BowConfig.getInstance();
+
+ session.put("user", user);
+ session.put("preference", preference);
+ session.put("version", config.getVersion());
+ session.put("bowUrl", config.getBowUrl());
+ initializeToken(session, user);
+ checkAdmin(session, user.getEmail());
+ }
}
static public void initHomePage(HttpServletRequest request, User user) {
Modified: trunk/src/main/java/org/chorem/bow/BowUtils.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BowUtils.java 2011-02-03 09:59:36 UTC (rev 180)
+++ trunk/src/main/java/org/chorem/bow/BowUtils.java 2011-02-03 14:26:21 UTC (rev 181)
@@ -1,5 +1,7 @@
package org.chorem.bow;
+import java.util.Map;
+
import javax.servlet.http.HttpSession;
import org.nuiton.wikitty.Criteria;
@@ -27,6 +29,13 @@
}
return checkPermanentToken(token);
}
+
+ static public User checkToken(String token, Map<String, Object> session) {
+ if (checkTemporaryToken(token, session)) {
+ return (User) session.get("user");
+ }
+ return checkPermanentToken(token);
+ }
/* @param token String which contains the MD5 encoding token
* @return null the token doesn't exist
@@ -53,6 +62,7 @@
*/
protected static boolean checkTemporaryToken(String token, HttpSession session) {
TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions");
+
if (tokenActions != null) {
String temporaryToken = tokenActions.getTemporaryToken();
if (temporaryToken != null) {
@@ -63,4 +73,19 @@
}
return false;
}
+
+ protected static boolean checkTemporaryToken(String token, Map<String, Object> session) {
+ TokenActions tokenActions = (TokenActions) session.get("tokenActions");
+
+ if (tokenActions != null) {
+ String temporaryToken = tokenActions.getTemporaryToken();
+
+ if (temporaryToken != null) {
+ if (temporaryToken.equals(token)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
}
Modified: trunk/src/main/java/org/chorem/bow/action/BowBaseAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/BowBaseAction.java 2011-02-03 09:59:36 UTC (rev 180)
+++ trunk/src/main/java/org/chorem/bow/action/BowBaseAction.java 2011-02-03 14:26:21 UTC (rev 181)
@@ -11,7 +11,7 @@
private static final long serialVersionUID = 1L;
public static final String UNTRANSLATED_MARKER = "???";
protected static final Log log = LogFactory.getLog(BowBaseAction.class);
-
+
@Override
public String getText(String aTextName) {
String value = super.getText(aTextName);
Added: trunk/src/main/java/org/chorem/bow/interceptor/LoginInterceptor.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/interceptor/LoginInterceptor.java (rev 0)
+++ trunk/src/main/java/org/chorem/bow/interceptor/LoginInterceptor.java 2011-02-03 14:26:21 UTC (rev 181)
@@ -0,0 +1,30 @@
+package org.chorem.bow.interceptor;
+
+import java.util.Map;
+
+import org.chorem.bow.BowInit;
+import org.chorem.bow.BowUtils;
+import org.chorem.bow.User;
+
+import com.opensymphony.xwork2.ActionContext;
+import com.opensymphony.xwork2.ActionInvocation;
+import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
+
+public class LoginInterceptor extends AbstractInterceptor {
+ private static final long serialVersionUID = -7520186185205372272L;
+
+ @Override
+ public String intercept(ActionInvocation invocation) throws Exception {
+ Map<String, Object> session = ActionContext.getContext().getSession();
+
+ if ((User)session.get("user") == null) {
+ Map<String, Object> toto = ActionContext.getContext().getParameters();
+ String[] token = (String[])toto.get("token");
+
+ if (token != null && !token[0].isEmpty()) {
+ BowInit.initSession(session, BowUtils.checkToken(token[0], session));
+ }
+ }
+ return invocation.invoke();
+ }
+}
Property changes on: trunk/src/main/java/org/chorem/bow/interceptor/LoginInterceptor.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-02-03 09:59:36 UTC (rev 180)
+++ trunk/src/main/resources/struts.xml 2011-02-03 14:26:21 UTC (rev 181)
@@ -3,27 +3,27 @@
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
- <constant name="struts.devMode" value="true" />
- <constant name="struts.ognl.allowStaticMethodAccess" value="true" />
+ <constant name="struts.devMode" value="true" />
+ <constant name="struts.ognl.allowStaticMethodAccess" value="true" />
- <!-- <default-action-ref name="" />--><!-- TODO: action à lancer quand une action n'existe pas -->
- <package name="login" extends="struts-default">
- <action name="register_*" method="{1}" class="org.chorem.bow.action.RegisterAction">
- <result name="input">/jsp/register.jsp</result>
- <result type="redirectAction">home</result>
- </action>
- <action name="forgotPassword_*" method="{1}" class="org.chorem.bow.action.ForgotPasswordAction">
- <result name="input">/jsp/forgotPassword.jsp</result>
- <result>/home.action</result>
- </action>
- <action name="login_*" method="{1}" class="org.chorem.bow.action.LoginAction">
- <result name="input">/jsp/login.jsp</result>
- <result type="redirectAction">home</result>
- </action>
- <action name="logout" class="org.chorem.bow.action.LogoutAction">
- <result type="redirectAction">login_input</result>
- </action>
- </package>
+ <!-- <default-action-ref name="" />--><!-- TODO: action à lancer quand une action n'existe pas -->
+ <package name="login" extends="struts-default">
+ <action name="register_*" method="{1}" class="org.chorem.bow.action.RegisterAction">
+ <result name="input">/jsp/register.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
+ <action name="forgotPassword_*" method="{1}" class="org.chorem.bow.action.ForgotPasswordAction">
+ <result name="input">/jsp/forgotPassword.jsp</result>
+ <result>/home.action</result>
+ </action>
+ <action name="login_*" method="{1}" class="org.chorem.bow.action.LoginAction">
+ <result name="input">/jsp/login.jsp</result>
+ <result type="redirectAction">home</result>
+ </action>
+ <action name="logout" class="org.chorem.bow.action.LogoutAction">
+ <result type="redirectAction">login_input</result>
+ </action>
+ </package>
<package name="bookmark" extends="struts-default">
<action name="importBookmarks" class="org.chorem.bow.action.ImportBookmarksAction">
@@ -51,6 +51,13 @@
</package>
<package name="search" extends="struts-default">
+ <interceptors>
+ <interceptor name="login" class="org.chorem.bow.interceptor.LoginInterceptor" />
+ <interceptor-stack name="loginStack">
+ <interceptor-ref name="login" />
+ <interceptor-ref name="defaultStack" />
+ </interceptor-stack>
+ </interceptors>
<action name="search" class="org.chorem.bow.action.SearchAction">
<result>/jsp/search.jsp</result>
</action>
@@ -61,7 +68,8 @@
<result>/jsp/search.jsp</result>
</action>
<action name="openSearchResult" class="org.chorem.bow.action.OpenSearchResultAction">
- <result type="redirect">${redirectTo}</result>
+ <interceptor-ref name="loginStack" />
+ <result type="redirect">${redirectTo}</result>
</action>
<action name="openSearchSuggestion" class="org.chorem.bow.action.OpenSearchSuggestionAction">
<result>/jsp/suggestions.jsp</result>
@@ -90,12 +98,9 @@
<result name="error" type="redirectAction">home</result>
<result type="redirect">${link}</result>
</action>
- <action name="temporaryXml">
- <result>/jsp/temporaryXml.jsp</result>
+ <action name="*Xml">
+ <result>/jsp/{1}Xml.jsp</result>
</action>
- <action name="permanentXml">
- <result>/jsp/permanentXml.jsp</result>
- </action>
<action name="preferences" class="org.chorem.bow.action.PreferencesAction">
<result name="login" type="redirectAction">login_input</result>
<result name="update" type="redirectAction">preferences</result>
Modified: trunk/src/main/webapp/WEB-INF/decorators/main.jsp
===================================================================
--- trunk/src/main/webapp/WEB-INF/decorators/main.jsp 2011-02-03 09:59:36 UTC (rev 180)
+++ trunk/src/main/webapp/WEB-INF/decorators/main.jsp 2011-02-03 14:26:21 UTC (rev 181)
@@ -5,13 +5,6 @@
<%@taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<%@taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page" %>
<%@taglib prefix="s" uri="/struts-tags" %>
-<%
-String token = request.getParameter("token");
-
-if (token != null && !token.isEmpty()) {
- session.setAttribute("user", BowUtils.checkToken(token, session));
-}
-%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Bow : <decorator:title default="Bow" /></title>
@@ -37,7 +30,7 @@
<%@include file="/jsp/inc/errorFrame.jsp" %>
<decorator:body />
</div>
- <s:if test="#session.user">
+ <s:if test="%{#session.user != null}">
<jsp:include page="/jsp/inc/rightMenu.jsp" />
</s:if>
</div>
Modified: trunk/src/main/webapp/jsp/permanentXml.jsp
===================================================================
--- trunk/src/main/webapp/jsp/permanentXml.jsp 2011-02-03 09:59:36 UTC (rev 180)
+++ trunk/src/main/webapp/jsp/permanentXml.jsp 2011-02-03 14:26:21 UTC (rev 181)
@@ -41,7 +41,7 @@
<Description>bookmarkSearch</Description>
<InputEncoding>inputEncoding</InputEncoding>
<Image width="16" height="16" type="image/ico"><%=url%>img/bow.gif</Image>
- <Url type="text/html" method="GET" template="<%=url%>openSearchResult.action?token=<%=token%>&searchLine={searchTerms}" />
- <Url type="application/x-suggestions+json" method="GET" template="<%=url%>openSearchSuggestion.action?token=<%=token%>&searchLine={searchTerms}" />
+ <Url type="text/html" method="GET" template="<%=url%>openSearchResult.action?token=<%=token%>&searchLine={searchTerms}" />
+ <Url type="application/x-suggestions+json" method="GET" template="<%=url%>openSearchSuggestion.action?token=<%=token%>&searchLine={searchTerms}" />
<moz:SearchForm><%=url%></moz:SearchForm>
</OpenSearchDescription>
Modified: trunk/src/main/webapp/jsp/temporaryXml.jsp
===================================================================
--- trunk/src/main/webapp/jsp/temporaryXml.jsp 2011-02-03 09:59:36 UTC (rev 180)
+++ trunk/src/main/webapp/jsp/temporaryXml.jsp 2011-02-03 14:26:21 UTC (rev 181)
@@ -41,7 +41,7 @@
<Description>bookmarkSearch</Description>
<InputEncoding>inputEncoding</InputEncoding>
<Image width="16" height="16" type="image/ico"><%=url%>img/bow.gif</Image>
- <Url type="text/html" method="GET" template="<%=url%>openSearchResult.action?token=<%=token%>&searchLine={searchTerms}" />
- <Url type="application/x-suggestions+json" method="GET" template="<%=url%>openSearchSuggestion.action?token=<%=token%>&search={searchTerms}" />
+ <Url type="text/html" method="GET" template="<%=url%>openSearchResult.action?token=<%=token%>&searchLine={searchTerms}" />
+ <Url type="application/x-suggestions+json" method="GET" template="<%=url%>openSearchSuggestion.action?token=<%=token%>&search={searchTerms}" />
<moz:SearchForm><%=url%></moz:SearchForm>
</OpenSearchDescription>
1
0
r180 - in trunk/src/main: java/org/chorem/bow/action resources webapp/jsp/inc
by vbriand@users.chorem.org 03 Feb '11
by vbriand@users.chorem.org 03 Feb '11
03 Feb '11
Author: vbriand
Date: 2011-02-03 10:59:36 +0100 (Thu, 03 Feb 2011)
New Revision: 180
Url: http://chorem.org/repositories/revision/bow/180
Log:
Added the redirections to the search page / home page when manually adding a bookmark or deleting a tag. Cleaned the struts.xml
Removed:
trunk/src/main/java/org/chorem/bow/action/AddAliasAction.java
Modified:
trunk/src/main/java/org/chorem/bow/action/AddUrlAction.java
trunk/src/main/java/org/chorem/bow/action/DeleteTagAction.java
trunk/src/main/java/org/chorem/bow/action/EditBookmarkAction.java
trunk/src/main/java/org/chorem/bow/action/ModifyBookmarkAction.java
trunk/src/main/resources/struts.xml
trunk/src/main/webapp/jsp/inc/rightMenu.jsp
Deleted: trunk/src/main/java/org/chorem/bow/action/AddAliasAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/AddAliasAction.java 2011-01-28 17:28:36 UTC (rev 179)
+++ trunk/src/main/java/org/chorem/bow/action/AddAliasAction.java 2011-02-03 09:59:36 UTC (rev 180)
@@ -1,62 +0,0 @@
-package org.chorem.bow.action;
-
-import java.util.List;
-
-import org.chorem.bow.Bookmark;
-import org.chorem.bow.BowProxy;
-import org.nuiton.wikitty.Criteria;
-import org.nuiton.wikitty.WikittyProxy;
-import org.nuiton.wikitty.search.Search;
-
-public class AddAliasAction extends BowBaseAction {
- private static final long serialVersionUID = 2565840071468031758L;
- protected String alias;
- protected String bookmarkId;
-
- /**
- * @return the alias
- */
- public String getAlias() {
- return alias;
- }
-
- /**
- * @param alias the alias to set
- */
- public void setAlias(String alias) {
- this.alias = alias;
- }
-
- /**
- * @return the bookmarkId
- */
- public String getBookmarkId() {
- return bookmarkId;
- }
-
- /**
- * @param bookmarkId the bookmarkId to set
- */
- public void setBookmarkId(String bookmarkId) {
- this.bookmarkId = bookmarkId;
- }
-
- public String execute() {
- if (alias != null && !alias.isEmpty()) {
- WikittyProxy proxy = BowProxy.getInstance();
- Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_ALIAS, alias).criteria();
- List<Bookmark> bookmarks = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
-
- if (bookmarks == null || bookmarks.isEmpty()) {
- if (bookmarkId != null && !bookmarkId.isEmpty()) {
- Bookmark bookmark = proxy.restore(Bookmark.class, bookmarkId);
- if (bookmark != null) {
- bookmark.setAlias(alias);
- proxy.store(bookmark);
- }
- }
- }
- }
- return SUCCESS;
- }
-}
\ No newline at end of file
Modified: trunk/src/main/java/org/chorem/bow/action/AddUrlAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/AddUrlAction.java 2011-01-28 17:28:36 UTC (rev 179)
+++ trunk/src/main/java/org/chorem/bow/action/AddUrlAction.java 2011-02-03 09:59:36 UTC (rev 180)
@@ -6,6 +6,7 @@
import org.chorem.bow.Bookmark;
import org.chorem.bow.BookmarkActions;
import org.chorem.bow.BowProxy;
+import org.chorem.bow.BowUtils;
import org.chorem.bow.User;
import org.nuiton.wikitty.Criteria;
import org.nuiton.wikitty.WikittyProxy;
@@ -18,6 +19,9 @@
protected String alias;
protected String tags;
protected String nameAndTags;
+ protected String redirectTo;
+ protected String searchLine;
+ protected String fullTextLine;
protected Map<String, Object> session;
@@ -91,6 +95,41 @@
this.nameAndTags = nameAndTags;
}
+ /**
+ * @return the redirectTo
+ */
+ public String getRedirectTo() {
+ return redirectTo;
+ }
+
+ /**
+ * @return the searchLine
+ */
+ public String getSearchLine() {
+ return searchLine;
+ }
+
+ /**
+ * @param searchLine the searchLine to set
+ */
+ public void setSearchLine(String searchLine) {
+ this.searchLine = searchLine;
+ }
+
+ /**
+ * @return the fullTextLine
+ */
+ public String getFullTextLine() {
+ return fullTextLine;
+ }
+
+ /**
+ * @param fullTextLine the fullTextLine to set
+ */
+ public void setFullTextLine(String fullTextLine) {
+ this.fullTextLine = fullTextLine;
+ }
+
@Override
public void setSession(Map<String, Object> session) {
this.session = session;
@@ -116,7 +155,11 @@
}
if (bookmark != null && !bookmark.getDescription().isEmpty() && !bookmark.getEmail().isEmpty()) {
proxy.store(bookmark); //Stores the bookmark if everything is ok
+ if (log.isDebugEnabled()) {
+ log.debug("Adding URL");
+ }
}
+ redirectTo = BowUtils.redirectTo(searchLine, fullTextLine);
return SUCCESS;
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/chorem/bow/action/DeleteTagAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/DeleteTagAction.java 2011-01-28 17:28:36 UTC (rev 179)
+++ trunk/src/main/java/org/chorem/bow/action/DeleteTagAction.java 2011-02-03 09:59:36 UTC (rev 180)
@@ -2,12 +2,16 @@
import org.chorem.bow.Bookmark;
import org.chorem.bow.BowProxy;
+import org.chorem.bow.BowUtils;
import org.nuiton.wikitty.WikittyProxy;
public class DeleteTagAction extends BowBaseAction {
private static final long serialVersionUID = -6174966873862161966L;
protected String bookmarkId;
protected String deleteTag;
+ protected String redirectTo;
+ protected String searchLine;
+ protected String fullTextLine;
/**
* @return the bookmarkId
@@ -33,7 +37,42 @@
public void setDeleteTag(String deleteTag) {
this.deleteTag = deleteTag;
}
-
+
+ /**
+ * @return the searchLine
+ */
+ public String getSearchLine() {
+ return searchLine;
+ }
+
+ /**
+ * @param searchLine the searchLine to set
+ */
+ public void setSearchLine(String searchLine) {
+ this.searchLine = searchLine;
+ }
+
+ /**
+ * @return the fullTextLine
+ */
+ public String getFullTextLine() {
+ return fullTextLine;
+ }
+
+ /**
+ * @param fullTextLine the fullTextLine to set
+ */
+ public void setFullTextLine(String fullTextLine) {
+ this.fullTextLine = fullTextLine;
+ }
+
+ /**
+ * @return the redirectTo
+ */
+ public String getRedirectTo() {
+ return redirectTo;
+ }
+
public String execute() {
if (deleteTag != null && bookmarkId != null) {
if (!bookmarkId.isEmpty()) {
@@ -46,6 +85,7 @@
}
}
}
+ redirectTo = BowUtils.redirectTo(searchLine, fullTextLine);
return SUCCESS;
}
}
\ No newline at end of file
Modified: trunk/src/main/java/org/chorem/bow/action/EditBookmarkAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/EditBookmarkAction.java 2011-01-28 17:28:36 UTC (rev 179)
+++ trunk/src/main/java/org/chorem/bow/action/EditBookmarkAction.java 2011-02-03 09:59:36 UTC (rev 180)
@@ -89,7 +89,7 @@
request.setAttribute("formAction", "/bow/modifyBookmark.action?bookmarkId=" + bookmarkId + "&searchLine=" + searchLine + "&fullTextLine=" + fullTextLine);
}
}
- if (searchLine == null) {
+ if (searchLine == null || searchLine.equals("")) {
BowInit.initHomePage(request, (User)session.get("user"));
return "home";
} else {
Modified: trunk/src/main/java/org/chorem/bow/action/ModifyBookmarkAction.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/action/ModifyBookmarkAction.java 2011-01-28 17:28:36 UTC (rev 179)
+++ trunk/src/main/java/org/chorem/bow/action/ModifyBookmarkAction.java 2011-02-03 09:59:36 UTC (rev 180)
@@ -3,7 +3,6 @@
import org.chorem.bow.Bookmark;
import org.chorem.bow.BookmarkActions;
import org.chorem.bow.BowProxy;
-import org.chorem.bow.BowUtils;
import org.nuiton.wikitty.Criteria;
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.search.Search;
@@ -17,7 +16,6 @@
protected String bookmarkId;
protected String searchLine;
protected String fullTextLine;
- protected String redirectTo;
/**
* @return the link
@@ -27,7 +25,7 @@
}
/**
- * @param url the linkto set
+ * @param url the link to set
*/
public void setLink(String link) {
this.link = link;
@@ -117,20 +115,6 @@
this.fullTextLine = fullTextLine;
}
- /**
- * @return the redirectTo
- */
- public String getRedirectTo() {
- return redirectTo;
- }
-
- /**
- * @param redirectTo the redirectTo to set
- */
- public void setRedirectTo(String redirectTo) {
- this.redirectTo = redirectTo;
- }
-
public String execute() {
WikittyProxy proxy = BowProxy.getInstance();
Bookmark bookmark = proxy.restore(Bookmark.class, bookmarkId);
@@ -146,8 +130,6 @@
BookmarkActions.updateBookmark(bookmark, name, link, tags, alias);
proxy.store(bookmark);
}
- System.out.println("{{{{{{{{{{{{{{{{{{"+searchLine+"}}}}}}}}}{{{{{{{"+fullTextLine);
- redirectTo = BowUtils.redirectTo(searchLine, fullTextLine);
return SUCCESS;
}
}
\ No newline at end of file
Modified: trunk/src/main/resources/struts.xml
===================================================================
--- trunk/src/main/resources/struts.xml 2011-01-28 17:28:36 UTC (rev 179)
+++ trunk/src/main/resources/struts.xml 2011-02-03 09:59:36 UTC (rev 180)
@@ -7,7 +7,7 @@
<constant name="struts.ognl.allowStaticMethodAccess" value="true" />
<!-- <default-action-ref name="" />--><!-- TODO: action à lancer quand une action n'existe pas -->
- <package name="myPackage" extends="struts-default">
+ <package name="login" extends="struts-default">
<action name="register_*" method="{1}" class="org.chorem.bow.action.RegisterAction">
<result name="input">/jsp/register.jsp</result>
<result type="redirectAction">home</result>
@@ -16,10 +16,6 @@
<result name="input">/jsp/forgotPassword.jsp</result>
<result>/home.action</result>
</action>
-
- <action name="locale" class="org.chorem.bow.action.LocaleAction">
- <result type="redirect">/jsp/login.jsp</result>
- </action>
<action name="login_*" method="{1}" class="org.chorem.bow.action.LoginAction">
<result name="input">/jsp/login.jsp</result>
<result type="redirectAction">home</result>
@@ -27,14 +23,6 @@
<action name="logout" class="org.chorem.bow.action.LogoutAction">
<result type="redirectAction">login_input</result>
</action>
- <action name="home" class="org.chorem.bow.action.HomeAction">
- <result name="login" type="redirectAction">login_input</result>
- <result>/jsp/home.jsp</result>
- </action>
- <action name="addUrl" class="org.chorem.bow.action.AddUrlAction">
- <result type="redirectAction">home</result>
- <!-- TODO: changer pour rediriger selon la page sur laquelle on se trouvait (home, search, ...)-->
- </action>
</package>
<package name="bookmark" extends="struts-default">
@@ -45,7 +33,7 @@
</action>
<action name="exportBookmarks" class="org.chorem.bow.action.ExportBookmarksAction" />
<action name="modifyBookmark" class="org.chorem.bow.action.ModifyBookmarkAction">
- <result type="redirect">${redirectTo}</result>
+ <result type="redirectAction">home</result>
</action>
<action name="removeBookmark" class="org.chorem.bow.action.RemoveBookmarkAction">
<result type="redirect">${redirectTo}</result>
@@ -54,44 +42,60 @@
<result name="home" type="redirectAction">home</result>
<result name="search">/jsp/search.jsp</result>
</action>
+ <action name="deleteImport" class="org.chorem.bow.action.DeleteImportAction">
+ <result type="redirectAction">preferences</result>
+ </action>
+ <action name="addUrl" class="org.chorem.bow.action.AddUrlAction">
+ <result type="redirect">${redirectTo}</result>
+ </action>
</package>
-
- <package name="toto" extends="struts-default">
+
+ <package name="search" extends="struts-default">
<action name="search" class="org.chorem.bow.action.SearchAction">
<result>/jsp/search.jsp</result>
</action>
<action name="fullText" class="org.chorem.bow.action.FullTextSearchAction">
<result>/jsp/search.jsp</result>
</action>
+ <action name="order" class="org.chorem.bow.action.OrderAction">
+ <result>/jsp/search.jsp</result>
+ </action>
+ <action name="openSearchResult" class="org.chorem.bow.action.OpenSearchResultAction">
+ <result type="redirect">${redirectTo}</result>
+ </action>
+ <action name="openSearchSuggestion" class="org.chorem.bow.action.OpenSearchSuggestionAction">
+ <result>/jsp/suggestions.jsp</result>
+ </action>
+ <action name="deleteSearchResults" class="org.chorem.bow.action.DeleteSearchResultsAction">
+ <result type="redirectAction">home</result>
+ </action>
+ </package>
+
+ <package name="misc" extends="struts-default">
+ <action name="home" class="org.chorem.bow.action.HomeAction">
+ <result name="login" type="redirectAction">login_input</result>
+ <result>/jsp/home.jsp</result>
+ </action>
+ <action name="locale" class="org.chorem.bow.action.LocaleAction">
+ <result type="redirect">/jsp/login.jsp</result>
+ </action>
<action name="generateToken" class="org.chorem.bow.action.GenerateTokenAction">
<result name="login" type="redirectAction">login_input</result>
<result type="redirectAction">preferences</result>
</action>
<action name="deleteTag" class="org.chorem.bow.action.DeleteTagAction">
- <!-- TODO: changer pour rediriger selon la page sur laquelle on se trouvait (home, search, ...)-->
- <result type="redirectAction">home</result>
+ <result type="redirect">${redirectTo}</result>
</action>
- <action name="addAlias" class="org.chorem.bow.action.AddAliasAction">
- <!-- TODO: changer pour rediriger selon la page sur laquelle on se trouvait (home, search, ...)-->
- <result type="redirectAction">home</result>
- </action>
- <action name="order" class="org.chorem.bow.action.OrderAction">
- <result>/jsp/search.jsp</result>
- </action>
<action name="addClick" class="org.chorem.bow.action.AddClickAction">
<result name="error" type="redirectAction">home</result>
<result type="redirect">${link}</result>
</action>
- <!-- temporary, permanent -->
- <action name="*Xml">
- <result>/jsp/{1}Xml.jsp</result>
+ <action name="temporaryXml">
+ <result>/jsp/temporaryXml.jsp</result>
</action>
- <action name="openSearchResult" class="org.chorem.bow.action.OpenSearchResultAction">
- <result type="redirect">${redirectTo}</result>
+ <action name="permanentXml">
+ <result>/jsp/permanentXml.jsp</result>
</action>
- <action name="openSearchSuggestion" class="org.chorem.bow.action.OpenSearchSuggestionAction">
- <result>/jsp/suggestions.jsp</result>
- </action>
<action name="preferences" class="org.chorem.bow.action.PreferencesAction">
<result name="login" type="redirectAction">login_input</result>
<result name="update" type="redirectAction">preferences</result>
@@ -102,14 +106,8 @@
<result name="error">/jsp/login.jsp</result>
<result>/jsp/admin.jsp</result>
</action>
- <action name="deleteImport" class="org.chorem.bow.action.DeleteImportAction">
- <result type="redirectAction">preferences</result>
- </action>
<action name="reIndexation" class="org.chorem.bow.action.ReIndexationAction">
<result>/jsp/admin.jsp</result>
</action>
- <action name="deleteSearchResults" class="org.chorem.bow.action.DeleteSearchResultsAction">
- <result type="redirectAction">home</result>
- </action>
</package>
</struts>
Modified: trunk/src/main/webapp/jsp/inc/rightMenu.jsp
===================================================================
--- trunk/src/main/webapp/jsp/inc/rightMenu.jsp 2011-01-28 17:28:36 UTC (rev 179)
+++ trunk/src/main/webapp/jsp/inc/rightMenu.jsp 2011-02-03 09:59:36 UTC (rev 180)
@@ -84,6 +84,8 @@
<s:textfield key="bow.rightMenu.bookmark.alias" name="alias" value="%{#request.alias}" labelSeparator="" /><br />
<s:textfield key="bow.rightMenu.bookmark.name" name="name" value="%{#request.name}" labelSeparator="" /><br />
<s:textfield key="bow.rightMenu.bookmark.tags" name="tags" value="%{#request.tags}" labelSeparator="" /><br /><br />
+ <s:hidden name="searchLine" value="%{searchLine}" />
+ <s:hidden name="fullTextLine" value="%{fullTextLine}" />
<s:submit key="bow.rightMenu.bookmark.submit" />
</s:form>
</div>
1
0