Author: vbriand Date: 2011-01-28 18:28:36 +0100 (Fri, 28 Jan 2011) New Revision: 179 Url: http://chorem.org/repositories/revision/bow/179 Log: When an action (remove, import, modify a bookmark) is performed on the search page, the user is redirected to the search page instead of the home page. Transformed some code on jsp pages to its Struts2 equivalent. The search engines work again (when logged in for the moment). The <form>s all redirect to the correct url (/bow instead of /bow/bow). Added: trunk/src/main/java/org/chorem/bow/BowUtils.java trunk/src/main/webapp/template/xhtml/file.ftl Modified: trunk/src/main/java/org/chorem/bow/action/BowBaseAction.java trunk/src/main/java/org/chorem/bow/action/EditBookmarkAction.java trunk/src/main/java/org/chorem/bow/action/FullTextSearchAction.java trunk/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java trunk/src/main/java/org/chorem/bow/action/ModifyBookmarkAction.java trunk/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java trunk/src/main/java/org/chorem/bow/action/RemoveBookmarkAction.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/inc/bookmark.jsp trunk/src/main/webapp/jsp/inc/footer.jsp trunk/src/main/webapp/jsp/inc/rightMenu.jsp trunk/src/main/webapp/jsp/login.jsp trunk/src/main/webapp/jsp/permanentXml.jsp trunk/src/main/webapp/jsp/preferences.jsp trunk/src/main/webapp/jsp/search.jsp trunk/src/main/webapp/jsp/suggestions.jsp trunk/src/main/webapp/jsp/temporaryXml.jsp Added: trunk/src/main/java/org/chorem/bow/BowUtils.java =================================================================== --- trunk/src/main/java/org/chorem/bow/BowUtils.java (rev 0) +++ trunk/src/main/java/org/chorem/bow/BowUtils.java 2011-01-28 17:28:36 UTC (rev 179) @@ -0,0 +1,66 @@ +package org.chorem.bow; + +import javax.servlet.http.HttpSession; + +import org.nuiton.wikitty.Criteria; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Search; + +public class BowUtils { + static public String redirectTo(String searchLine, String fullTextLine) { + if (!searchLine.equals("") || !fullTextLine.equals("")) { + return "search.action?searchLine=" + searchLine + "&fullTextLine=" + fullTextLine; + } else { + return "home.action"; + } + } + + /* @param token String token + * @param session HttpSession session + * @return User + * @description check if the token is valid and return the + * token owner + */ + static public User checkToken(String token, HttpSession session) { + if (checkTemporaryToken(token, session)) { + return (User) session.getAttribute("user"); + } + return checkPermanentToken(token); + } + + /* @param token String which contains the MD5 encoding token + * @return null the token doesn't exist + * @return User the token owner + */ + protected static 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 + String userEmail = DbToken.getEmail(); // the token owner user name (email) + criteria = Search.query().eq(User.FQ_FIELD_EMAIL, userEmail).criteria(); // retrieve user by token + return proxy.findByCriteria(User.class, criteria); + } + } + return null; + } + + /* @param token String which contains the MD5 encoding token + * @return null the token doesn't exist + * @return User the token owner + */ + protected static boolean checkTemporaryToken(String token, HttpSession session) { + TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); + if (tokenActions != null) { + String temporaryToken = tokenActions.getTemporaryToken(); + if (temporaryToken != null) { + if (temporaryToken.equals(token)) { + return true; + } + } + } + return false; + } +} Property changes on: trunk/src/main/java/org/chorem/bow/BowUtils.java ___________________________________________________________________ Added: svn:mime-type + text/plain Modified: trunk/src/main/java/org/chorem/bow/action/BowBaseAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/BowBaseAction.java 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/java/org/chorem/bow/action/BowBaseAction.java 2011-01-28 17:28:36 UTC (rev 179) @@ -8,11 +8,10 @@ import java.util.List; public class BowBaseAction extends ActionSupport { - private static final long serialVersionUID = 1L; public static final String UNTRANSLATED_MARKER = "???"; - private static final Log log = LogFactory.getLog(BowBaseAction.class); - + protected static final Log log = LogFactory.getLog(BowBaseAction.class); + @Override public String getText(String aTextName) { String value = super.getText(aTextName); Modified: trunk/src/main/java/org/chorem/bow/action/EditBookmarkAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/EditBookmarkAction.java 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/java/org/chorem/bow/action/EditBookmarkAction.java 2011-01-28 17:28:36 UTC (rev 179) @@ -20,6 +20,7 @@ private static final long serialVersionUID = 2706590901233864637L; protected String bookmarkId; protected String searchLine; + protected String fullTextLine; protected Map<String, Object> session; protected HttpServletRequest request; @@ -51,6 +52,20 @@ 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; @@ -71,7 +86,7 @@ request.setAttribute("name", bookmark.getDescription()); request.setAttribute("alias", bookmark.getAlias()); request.setAttribute("tags", BookmarkActions.getBookmarkTagsString(bookmark)); - request.setAttribute("formAction", "/bow/modifyBookmark.action?bookmarkId=" + bookmarkId); + request.setAttribute("formAction", "/bow/modifyBookmark.action?bookmarkId=" + bookmarkId + "&searchLine=" + searchLine + "&fullTextLine=" + fullTextLine); } } if (searchLine == null) { Modified: trunk/src/main/java/org/chorem/bow/action/FullTextSearchAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/FullTextSearchAction.java 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/java/org/chorem/bow/action/FullTextSearchAction.java 2011-01-28 17:28:36 UTC (rev 179) @@ -14,6 +14,8 @@ public class FullTextSearchAction extends BowBaseAction implements SessionAware, ServletRequestAware { private static final long serialVersionUID = -7736099487284993426L; protected Map<String, Object> session; + protected String searchLine; + protected String fullTextLine; protected HttpServletRequest request; @Override @@ -26,6 +28,34 @@ this.session = session; } + /** + * @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; + } + public String execute() { User user = (User)session.get("user"); Modified: trunk/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java 2011-01-28 17:28:36 UTC (rev 179) @@ -18,6 +18,7 @@ import org.chorem.bow.BowInit; import org.chorem.bow.BowProxy; import org.chorem.bow.BowSearch; +import org.chorem.bow.BowUtils; import org.chorem.bow.Import; import org.chorem.bow.User; import org.htmlparser.Node; @@ -34,6 +35,9 @@ protected File upfile; protected String upfileContentType; protected String upfileFileName; + protected String searchLine; + protected String fullTextLine; + protected String redirectTo; protected Map<String, Object> session; protected HttpServletRequest request; @@ -79,6 +83,41 @@ this.upfileFileName = upfileFileName; } + /** + * @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; + } + @Override public void setSession(Map<String, Object> session) { this.session = session; @@ -171,13 +210,28 @@ parseHtmlToBookmarks(list, user, bookmarks, new ArrayList<String>()); bookmarks = proxy.store(bookmarks); createImportExtension(bookmarks); - BowInit.initHomePage(request, user); - return SUCCESS; + 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; + } } catch (ParserException e) { request.setAttribute("errorMsgUser", getText(n_("bow.bookmark.badFileFormat"))); request.setAttribute("errorMsgTech", e.getMessage()); + redirectTo = BowUtils.redirectTo(searchLine, fullTextLine); - if (request.getParameter("searchLine") == null) { + if (searchLine == null || searchLine.isEmpty()) { BowInit.initHomePage(request, user); return SUCCESS; } else { @@ -190,7 +244,7 @@ // TODO Auto-generated catch block e1.printStackTrace(); } - return "search"; + return SUCCESS; } } } catch (IOException e2) { Modified: trunk/src/main/java/org/chorem/bow/action/ModifyBookmarkAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/ModifyBookmarkAction.java 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/java/org/chorem/bow/action/ModifyBookmarkAction.java 2011-01-28 17:28:36 UTC (rev 179) @@ -3,6 +3,7 @@ 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; @@ -14,6 +15,9 @@ protected String alias; protected String tags; protected String bookmarkId; + protected String searchLine; + protected String fullTextLine; + protected String redirectTo; /** * @return the link @@ -85,6 +89,48 @@ this.bookmarkId = bookmarkId; } + /** + * @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; + } + + /** + * @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); @@ -100,6 +146,8 @@ 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/java/org/chorem/bow/action/OpenSearchResultAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java 2011-01-28 17:28:36 UTC (rev 179) @@ -15,6 +15,7 @@ import org.chorem.bow.BowConfig; import org.chorem.bow.BowInit; import org.chorem.bow.BowProxy; +import org.chorem.bow.BowUtils; import org.chorem.bow.Preference; import org.chorem.bow.User; import org.nuiton.wikitty.Criteria; @@ -26,6 +27,7 @@ private static final long serialVersionUID = -1691325797986483856L; protected String searchLine; protected String token; + protected String redirectTo; protected Map<String, Object> session; protected HttpServletRequest request; protected HttpServletResponse response; @@ -58,6 +60,13 @@ this.token = token; } + /** + * @return the redirectTo + */ + public String getRedirectTo() { + return redirectTo; + } + @Override public void setSession(Map<String, Object> session) { this.session = session; @@ -73,78 +82,77 @@ this.response = response; } - //TODO : gérer toutes les redirections comme il faut avec Struts2 public String execute() { User user = (User)session.get("user"); - if (searchLine != null && searchLine.matches("^http://[^ ]*")) { - //response.sendRedirect(searchLine); - } 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); - //request.getRequestDispatcher("search.jsp").forward(request, response); - } 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); - + 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; } else { - criteria = BowBookmark.getBookmarkListCriteriaByUser(user, null); + // 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; } - PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria); - BookmarkActions bookmarkActions = BowBookmark.createBookmarkActions(request, result, null); - request.setAttribute("bookmarkActions", bookmarkActions); - request.setAttribute("token", token); - //request.getRequestDispatcher("search.jsp").forward(request, response); - } else if (searchLine != null && searchLine.startsWith("a:")) { - // on redirige vers l'alias demande - searchLine = searchLine.substring(2); - //response.sendRedirect(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); - - //response.sendRedirect(searchEngineURL); } return SUCCESS; } Modified: trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/java/org/chorem/bow/action/PreferencesAction.java 2011-01-28 17:28:36 UTC (rev 179) @@ -245,8 +245,9 @@ 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 (proxy.findByCriteria(User.class, criteria) == null) { //If this email address isn't already used by someone else + 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) { Modified: trunk/src/main/java/org/chorem/bow/action/RemoveBookmarkAction.java =================================================================== --- trunk/src/main/java/org/chorem/bow/action/RemoveBookmarkAction.java 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/java/org/chorem/bow/action/RemoveBookmarkAction.java 2011-01-28 17:28:36 UTC (rev 179) @@ -2,11 +2,15 @@ import org.chorem.bow.Bookmark; import org.chorem.bow.BowProxy; +import org.chorem.bow.BowUtils; import org.nuiton.wikitty.WikittyProxy; public class RemoveBookmarkAction extends BowBaseAction { private static final long serialVersionUID = 820566716695285561L; protected String bookmarkId; + protected String searchLine; + protected String fullTextLine; + protected String redirectTo; /** * @return the bookmarkId @@ -22,6 +26,41 @@ this.bookmarkId = bookmarkId; } + /** + * @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 (bookmarkId != null && !bookmarkId.isEmpty()) { try { @@ -31,12 +70,11 @@ if (bookmark != null) { proxy.delete(bookmarkId); } - } catch (Exception eee) { - //TODO: log - //log.error("Can't do action", eee); + } catch (Exception e) { + log.error("Can't do action", e); } } -// redirectToTheGoodPage(request, response); + redirectTo = BowUtils.redirectTo(searchLine, fullTextLine); return SUCCESS; } } \ No newline at end of file Modified: trunk/src/main/resources/i18n/bow_en_GB.properties =================================================================== --- trunk/src/main/resources/i18n/bow_en_GB.properties 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/resources/i18n/bow_en_GB.properties 2011-01-28 17:28:36 UTC (rev 179) @@ -14,6 +14,9 @@ bow.config.data.dir.description= bow.config.search.engine.description= bow.config.servlet.bow.description= +bow.footer.bugreport=Bug report +bow.footer.license=AGPL License +bow.footer.userSupport=User support bow.forgotPassword.emailDoesntExist= bow.forgotpwd.submit=Send bow.forgotpwd.title=Forgot your password? @@ -22,7 +25,7 @@ bow.home.title=Home bow.label.locale.english= bow.label.locale.french= -bow.login.authenticationFailure= +bow.login.authenticationFailure=Either your email address doesn''t exist or your password is incorrect bow.login.email=Email bow.login.email.required=Email is required bow.login.email.wrongformat=Your email address isn''t valid @@ -41,7 +44,7 @@ bow.preferences.newPassword=New password bow.preferences.noImportedBookmarks=No imported bookmarks bow.preferences.regenPermToken=Regenerate permanent token -bow.preferences.searchEngineUrlResults=Search Engine URL Results ({searchTerms} will be replaced by your text) +bow.preferences.searchEngineUrlResults=Search Engine URL Results ('{'searchTerms'}' will be replaced by your text) bow.preferences.searchEngineUrlSuggestions=Search Engine URL Suggestions bow.preferences.siteLook=Site look bow.preferences.submit=Change @@ -58,14 +61,17 @@ bow.register.submit=Register bow.register.title=Register bow.requiredstring=${getText(fieldKey)} is required +bow.rightMenu.admin=Admin bow.rightMenu.bookmark.addModify=Add / Modify bow.rightMenu.bookmark.alias=ALIAS bow.rightMenu.bookmark.link=URL bow.rightMenu.bookmark.name=DESC bow.rightMenu.bookmark.permanentLink=Bookmark add link (permanent) +bow.rightMenu.bookmark.permanentLinkDescription=Add this link to your favourites to bookmark others in the future. This link is always available\! bow.rightMenu.bookmark.submit=Save bow.rightMenu.bookmark.tags=TAGS bow.rightMenu.bookmark.temporaryLink=Bookmark add link (session) +bow.rightMenu.bookmark.temporaryLinkDescription=Add this link to your favourites to bookmark others in the future. This link is only available while you are connected on the site\! bow.rightMenu.chromiumExtension=Chromium extension bow.rightMenu.exportBookmarks=Export bookmarks bow.rightMenu.extensions=Extensions @@ -78,6 +84,12 @@ bow.rightMenu.search=Search bow.rightMenu.token.permanent=Permanent token id bow.rightMenu.token.temporary=Session token id +bow.search.ascclick=Asc. clicks nb +bow.search.ascdate=Asc. date +bow.search.ascname=Asc. name +bow.search.descclick=Desc. clicks nb +bow.search.descdate=Desc. date +bow.search.descname=Desc. name bow.search.orderby=Order by bow.search.submit=Search bow.search.title=Search Modified: trunk/src/main/resources/i18n/bow_fr_FR.properties =================================================================== --- trunk/src/main/resources/i18n/bow_fr_FR.properties 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/resources/i18n/bow_fr_FR.properties 2011-01-28 17:28:36 UTC (rev 179) @@ -14,6 +14,9 @@ bow.config.data.dir.description= bow.config.search.engine.description= bow.config.servlet.bow.description= +bow.footer.bugreport=Rapport de bug +bow.footer.license=Licence AGPL +bow.footer.userSupport=Support utilisateur bow.forgotPassword.emailDoesntExist= bow.forgotpwd.submit=Envoyer bow.forgotpwd.title=Vous avez oubli\u00E9 votre mot de passe ? @@ -22,7 +25,7 @@ bow.home.title=Accueil bow.label.locale.english= bow.label.locale.french= -bow.login.authenticationFailure= +bow.login.authenticationFailure=Soit votre adresse email n''existe pas, soit votre vot 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 @@ -41,13 +44,13 @@ bow.preferences.newPassword=Nouveau mot de passe bow.preferences.noImportedBookmarks=Aucun marque-page import\u00E9 bow.preferences.regenPermToken=Reg\u00E9n\u00E9rer le token permanent -bow.preferences.searchEngineUrlResults= -bow.preferences.searchEngineUrlSuggestions= -bow.preferences.siteLook= +bow.preferences.searchEngineUrlResults=Search Engine URL Results ('{'searchTerms'}' sera remplac\u00E9 par votre recherche) +bow.preferences.searchEngineUrlSuggestions=Search Engine URL Suggestions +bow.preferences.siteLook=Pr\u00E9f\u00E9rences du site bow.preferences.submit=Changer -bow.preferences.tagsNb= +bow.preferences.tagsNb=Nombre de tags affich\u00E9s sur le nuage de tags bow.preferences.title=Pr\u00E9f\u00E9rences -bow.preferences.userInfo= +bow.preferences.userInfo=Informations utilisateur bow.register.emailAldyUsed=Cette adresse email est d\u00E9j\u00E0 utilis\u00E9e bow.register.invalidLogin= bow.register.mailEmail= @@ -58,14 +61,17 @@ bow.register.submit=S''enregistrer bow.register.title=S''enregistrer bow.requiredstring=${getText(fieldKey)} est obligatoire +bow.rightMenu.admin=Admin bow.rightMenu.bookmark.addModify=Ajouter / Modifier bow.rightMenu.bookmark.alias=ALIAS bow.rightMenu.bookmark.link=URL bow.rightMenu.bookmark.name=DESC bow.rightMenu.bookmark.permanentLink=Ajouter un bookmark (permanent) +bow.rightMenu.bookmark.permanentLinkDescription=Ajoutez ce lien \u00E0 vos favoris pour pouvoir bookmarker vos liens dans le futur. Ce lien est toujours disponible \! bow.rightMenu.bookmark.submit=Sauvegarder bow.rightMenu.bookmark.tags=TAGS bow.rightMenu.bookmark.temporaryLink=Ajouter un bookmark (session) +bow.rightMenu.bookmark.temporaryLinkDescription=Ajoutez ce lien \u00E0 vos favoris pour pouvoir bookmarker vos liens dans le futur. Ce lien est seulement disponible tant que vous \u00EAtes connect\u00E9 sur le site \! bow.rightMenu.chromiumExtension=Extension pour chromium bow.rightMenu.exportBookmarks=Exporter les marque-pages bow.rightMenu.extensions=Extensions @@ -78,6 +84,12 @@ bow.rightMenu.search=Recherche bow.rightMenu.token.permanent=Token permanent bow.rightMenu.token.temporary=Token session +bow.search.ascclick=Nb clics asc. +bow.search.ascdate=Date asc. +bow.search.ascname=Nom asc. +bow.search.descclick=Nb clics desc. +bow.search.descdate=Date desc. +bow.search.descname=Nom desc. bow.search.orderby=Trier par bow.search.submit=Rechercher bow.search.title=Recherche Modified: trunk/src/main/resources/struts.xml =================================================================== --- trunk/src/main/resources/struts.xml 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/resources/struts.xml 2011-01-28 17:28:36 UTC (rev 179) @@ -6,6 +6,7 @@ <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="myPackage" extends="struts-default"> <action name="register_*" method="{1}" class="org.chorem.bow.action.RegisterAction"> <result name="input">/jsp/register.jsp</result> @@ -38,21 +39,16 @@ <package name="bookmark" extends="struts-default"> <action name="importBookmarks" class="org.chorem.bow.action.ImportBookmarksAction"> - <result name="search" type="redirectAction">search</result> <result name="error" type="redirectAction">error</result> - <result name="login" type="redirectAction">home</result> - <result type="redirectAction">home</result> + <result name="login" type="redirectAction">login_input</result> + <result type="redirect">${redirectTo}</result> </action> - <action name="exportBookmarks" class="org.chorem.bow.action.ExportBookmarksAction"> - <result type="redirectAction">home</result> - </action> + <action name="exportBookmarks" class="org.chorem.bow.action.ExportBookmarksAction" /> <action name="modifyBookmark" class="org.chorem.bow.action.ModifyBookmarkAction"> - <result name="search">/jsp/search.jsp</result> - <result type="redirectAction">home</result> + <result type="redirect">${redirectTo}</result> </action> <action name="removeBookmark" class="org.chorem.bow.action.RemoveBookmarkAction"> - <result type="redirectAction">home</result> - <result name="search">/jsp/search.jsp</result> + <result type="redirect">${redirectTo}</result> </action> <action name="editBookmark" class="org.chorem.bow.action.EditBookmarkAction"> <result name="home" type="redirectAction">home</result> @@ -90,9 +86,10 @@ <action name="*Xml"> <result>/jsp/{1}Xml.jsp</result> </action> - <!-- Suggestion, Result --> - <action name="openSearch*" method="{1}" class="org.chorem.bow.action.OpenSearchAction"> - <!-- TODO: changer pour rediriger selon la page sur laquelle on se trouvait (home, search, ...)--> + <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="preferences" class="org.chorem.bow.action.PreferencesAction"> @@ -106,7 +103,7 @@ <result>/jsp/admin.jsp</result> </action> <action name="deleteImport" class="org.chorem.bow.action.DeleteImportAction"> - <result>/jsp/preferences.jsp</result> + <result type="redirectAction">preferences</result> </action> <action name="reIndexation" class="org.chorem.bow.action.ReIndexationAction"> <result>/jsp/admin.jsp</result> Modified: trunk/src/main/webapp/WEB-INF/decorators/main.jsp =================================================================== --- trunk/src/main/webapp/WEB-INF/decorators/main.jsp 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/webapp/WEB-INF/decorators/main.jsp 2011-01-28 17:28:36 UTC (rev 179) @@ -1,10 +1,17 @@ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> +<%@page import="org.chorem.bow.BowUtils" %> <%@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> @@ -15,8 +22,8 @@ <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="bowTemporarySearchEngine" href="${temporaryXml}" /> - <link rel="search" type="application/opensearchdescription+xml" title="bowPermanentSearchEngine" href="${permanentXml}" /> + <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: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/inc/bookmark.jsp =================================================================== --- trunk/src/main/webapp/jsp/inc/bookmark.jsp 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/webapp/jsp/inc/bookmark.jsp 2011-01-28 17:28:36 UTC (rev 179) @@ -29,92 +29,73 @@ <%@page import="java.text.SimpleDateFormat" %> <%@page import="org.chorem.bow.BookmarkActions" %> <%@page import="java.util.Set" %> -<% -Bookmark bookmark = (Bookmark) request.getAttribute("bookmark"); -BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions"); -SimpleDateFormat sdf = (SimpleDateFormat) request.getAttribute("sdf"); -String aliasUrl = BowConfig.getInstance().getServletAliasUrl(); -if (bookmark != null && sdf != null && bookmarkActions != null) { - String formBookmarkId = (String) request.getAttribute("formBookmarkId"); - String link = bookmark.getLink(); - link = link.replace("'", "\\'"); - %> - <s:set var="searchLine" value="%{#request.searchLine}" /> - <s:set var="fullTextLine" value="%{#request.fullTextLine}" /> - <s:set var="wikittyId" value="%{#request.bookmark.getWikittyId()}" /> - <s:set var="bookmarkLink" value="%{#request.bookmark.getLink()}" /> - <s:set var="bookmarkAlias" value="%{#request.bookmark.getAlias()}" /> - <s:set var="bookmarkDescription" value="%{#request.bookmark.getDescription()}" /> - <s:set var="bookmarkClicks" value="%{#request.bookmark.getClick()}" /> - - <div class="bookmark"> - <div class="bookmarkhead"> - <a class="alias" href="<%=aliasUrl + bookmark.getAlias()%>" title="<%=bookmark.getLink()%>" onclick="window.open(this.href); return false;"> - <s:property value="%{#bookmarkAlias}" /> - </a> - <p class="date"> (<%=sdf.format(bookmark.getDate())%>)</p> - <s:url id="editBookmark" 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: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> - <div class="bookmarkcontenu"> - <div class="screenshot"></div> - <div class="click"><s:property value="%{#bookmarkClicks}" /></div> - <div class="description"> - <h3><s:text name="bow.bookmark.description" /> :</h3> - <p> - <s:url id="addClick" action="addClick"> - <s:param name="bookmarkId"><s:property value="%{#wikittyId}" /></s:param> - </s:url> - <s:a title="%{#bookmarkLink}" href="%{addClick}" onclick="window.open(this.href); return false;"><s:property value="%{#bookmarkDescription}" /></s:a> - </p> - <p class="tags"> - <strong><s:text name="bow.bookmark.tags" /> :</strong> - <% - Set<String> tagList = bookmark.getTags(); - - if (tagList != null && !tagList.isEmpty()) { - for (String tag : tagList) { - %> - <s:url id="deleteTag" action="deleteTag" escapeAmp="false"> - <s:param name="bookmarkId"><s:property value="%{#wikittyId}" /></s:param> - <s:param name="deleteTag"><%=tag%></s:param> - <s:param name="searchLine"><s:property value="%{#searchLine}" /></s:param> - <s:param name="fullTextLine"><s:property value="%{#fullTextLine}" /></s:param> - </s:url> - <% - if (formBookmarkId != null && formBookmarkId.equals(bookmark.getWikittyId())) { - %> - <s:a cssStyle="text-decoration: none;" href="%{deleteTag}"> - <img style="border:none;" src="img/delete.png" alt="Delete tag" title="Delete" /> - </s:a> - <% - } else { - %> - <a name="<s:property value='%{#wikittyId}' />" style="display:none; text-decoration: none;" href="<s:property value='%{#deleteTag}' />"> - <img style="border:none;" src="img/delete.png" alt="Delete tag" title="Delete" /> - </a> - <% } %> - <s:url id="search" action="search"> - <s:param name="searchLine"><%=tag%></s:param> - </s:url> - <s:a href="%{search}" cssStyle="text-decoration: none"><%=tag%></s:a> - <% - } - } - %> - </p> - </div> - </div> - </div> - <% } %> +<s:set var="searchLine" value="%{#request.searchLine}" /> +<s:set var="fullTextLine" value="%{#request.fullTextLine}" /> +<s:set var="wikittyId" value="%{#request.bookmark.getWikittyId()}" /> +<s:set var="bookmarkLink" value="%{#request.bookmark.getLink()}" /> +<s:set var="bookmarkAlias" value="%{#request.bookmark.getAlias()}" /> +<s:set var="bookmarkDescription" value="%{#request.bookmark.getDescription()}" /> +<s:set var="bookmarkClicks" value="%{#request.bookmark.getClick()}" /> +<s:set var="formBookmarkId" value="%{#request.formBookmarkId}" /> +<s:set var="aliasUrl" value="%{@org.chorem.bow.BowConfig@getInstance().getServletAliasUrl() + #bookmarkAlias}" /> +<s:set var="date" value="%{#request.sdf.format(#request.bookmark.getDate())}" /> + +<div class="bookmark"> + <div class="bookmarkhead"> + <s:a cssClass="alias" href="%{#aliasUrl}" title="%{#bookmarkLink}" onclick="window.open(this.href); return false;"> + <s:property value="%{#bookmarkAlias}" /> + </s:a> + <p class="date">(<s:property value="%{date}" />)</p> + <s:url id="editBookmark" 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: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> + <div class="bookmarkcontenu"> + <div class="screenshot"></div> + <div class="click"><s:property value="%{#bookmarkClicks}" /></div> + <div class="description"> + <h3><s:text name="bow.bookmark.description" /> :</h3> + <p> + <s:url id="addClick" action="addClick"> + <s:param name="bookmarkId"><s:property value="%{#wikittyId}" /></s:param> + </s:url> + <s:a title="%{#bookmarkLink}" href="%{addClick}" onclick="window.open(this.href); return false;"><s:property value="%{#bookmarkDescription}" /></s:a> + </p> + <p class="tags"> + <strong><s:text name="bow.bookmark.tags" /> :</strong> + <s:iterator value="#request.bookmark.tags"> + <s:url id="deleteTag" action="deleteTag" escapeAmp="false"> + <s:param name="bookmarkId"><s:property value="%{#wikittyId}" /></s:param> + <s:param name="deleteTag"><s:property /></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:if test="%{formBookmarkId != null && formBookmarkId.equals(wikittyId)}"> + <s:a cssStyle="text-decoration:none;" href="%{deleteTag}"> + <img style="border:none;" src="img/delete.png" alt="Delete tag" title="Delete" /> + </s:a> + </s:if> + <s:else> + <a name="<s:property value='%{#wikittyId}' />" style="display:none; text-decoration: none;" href="<s:property value='%{#deleteTag}' />"> + <img style="border:none;" src="img/delete.png" alt="Delete tag" title="Delete" /> + </a> + </s:else> + <s:url id="search" action="search"> + <s:param name="searchLine"><s:property /></s:param> + </s:url> + <s:a href="%{search}" cssStyle="text-decoration:none"><s:property /></s:a> + </s:iterator> + </p> + </div> + </div> +</div> Modified: trunk/src/main/webapp/jsp/inc/footer.jsp =================================================================== --- trunk/src/main/webapp/jsp/inc/footer.jsp 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/webapp/jsp/inc/footer.jsp 2011-01-28 17:28:36 UTC (rev 179) @@ -5,11 +5,11 @@ <p> <a shape="rect" href="">bow</a> <a shape="rect" href="http://www.chorem.org/projects/list_files/bow"></a> - - <a shape="rect" href="http://www.gnu.org/licenses/agpl.html">Licence AGPL</a> - + <a shape="rect" href="http://www.gnu.org/licenses/agpl.html"><s:text name="bow.footer.license" /></a> - <span title="Copyright">©2010</span> <a shape="rect" href="http://www.codelutin.com">Code Lutin</a> - - <a shape="rect" href="http://www.chorem.org/projects/bow/issues">Rapport de bug</a> - - <a shape="rect" href="http://list.chorem.org/cgi-bin/mailman/listinfo/bow-users">Support utilisateur</a> - + <a shape="rect" href="http://www.chorem.org/projects/bow/issues"><s:text name="bow.footer.bugreport" /></a> - + <a shape="rect" href="http://list.chorem.org/cgi-bin/mailman/listinfo/bow-users"><s:text name="bow.footer.userSupport" /></a> - <s:url id="localeEN"> <s:param name="request_locale">en_GB</s:param> </s:url> Modified: trunk/src/main/webapp/jsp/inc/rightMenu.jsp =================================================================== --- trunk/src/main/webapp/jsp/inc/rightMenu.jsp 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/webapp/jsp/inc/rightMenu.jsp 2011-01-28 17:28:36 UTC (rev 179) @@ -32,10 +32,6 @@ <% TokenActions tokenActions = (TokenActions)session.getAttribute("tokenActions"); BookmarkActions bookmarkActions = (BookmarkActions)request.getAttribute("bookmarkActions"); -Boolean admin = (Boolean)session.getAttribute("admin"); -if (admin == null) { - admin = false; -} int nbTags = 100; Preference preference = (Preference)session.getAttribute("preference"); @@ -45,21 +41,18 @@ nbTags = tags; } request.setAttribute("nbTags", nbTags); -String searchLine = null; -String fullText = null; -if (bookmarkActions != null){ - searchLine = bookmarkActions.getSearchLine(); - fullText = bookmarkActions.getFullTextLine(); -} if ((String)request.getAttribute("formAction") == null) - request.setAttribute("formAction", "/addUrl.action"); + request.setAttribute("formAction", "addUrl"); %> +<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"> - <s:form action="logout" theme="simple"> + <s:form action="logout"> <div class="input"> <s:submit key="bow.rightMenu.logout" /> </div> @@ -69,9 +62,9 @@ <div id="side"> <div id="colonneD"> <ul class="droite"> - <% if (admin) { %> - <li><s:a action="admin"><s:text name="bow.rightMenu.admin" /></s:a></li> - <% } %> + <s:if test="%{#session.admin == true}"> + <li><s:a action="admin"><s:text name="bow.rightMenu.admin" /></s:a></li> + </s:if> <li><s:a action="preferences"><s:text name="bow.preferences.title" /></s:a></li> <li><s:a title="%{getText('bow.rightMenu.bookmark.temporaryLinkDescription')}" href="javascript:var%20url=location.href;var%20nameAndTags=prompt('Entrez%20le%20nom%20du%20lien%20et%20la%20liste%20des%20tags%20sous%20la%20forme:%20name|tag1%20tag2%20tag3',%20document.title+'|');if%20(nameAndTags!=(document.title+'|')){var%20link='%{#session.bowUrl}addUrl.action?token=%{#session.tokenActions.getTemporaryToken()}&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);}void(0);"><s:text name="bow.rightMenu.bookmark.temporaryLink" /></s:a></li> <li><s:a title="%{getText('bow.rightMenu.bookmark.permanentLinkDescription')}" href="javascript:var%20url=location.href;var%20nameAndTags=prompt('Entrez%20le%20nom%20du%20lien%20et%20la%20liste%20des%20tags%20sous%20la%20forme:%20name|tag1%20tag2%20tag3',%20document.title+'|');if%20(nameAndTags!=(document.title+'|')){var%20link='%{#session.bowUrl}addUrl.action?token=%{#session.tokenActions.getPermanentToken()}&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);}void(0);"><s:text name="bow.rightMenu.bookmark.permanentLink" /></s:a></li> @@ -95,19 +88,20 @@ </s:form> </div> <div id="nuage"> - <% if (searchLine != null) { %> + <s:if test="%{searchLine != null}"> <jsp:include page="tagsCloud.jsp" flush="true"> - <jsp:param name="searchLine" value="<%=searchLine%>" /> + <jsp:param name="searchLine" value="%{searchLine}" /> </jsp:include> - <% } else { %> + </s:if> + <s:else> <jsp:include page="tagsCloud.jsp" flush="true" /> - <% } %> + </s:else> </div> <div class="recherche"> <s:form action="search"> <div class="input"> <s:textfield key="bow.rightMenu.search" name="searchLine" labelSeparator="" /> - <s:submit key="bow.rightMenu.find.submit" theme="simple" /> + <s:submit key="bow.rightMenu.find.submit" /> </div> </s:form> </div> @@ -115,16 +109,17 @@ <s:form action="fullText"> <div class="input"> <s:textfield key="bow.rightMenu.fullTextSearch" name="fullTextLine" labelSeparator="" /> - <s:submit key="bow.rightMenu.find.submit" theme="simple" /> + <s:submit key="bow.rightMenu.find.submit" /> </div> </s:form> </div> <div id="import"> <s:form action="importBookmarks" method="post" enctype="multipart/form-data"> <div class="input"> - <label for="fileImport"><s:text name="bow.rightMenu.importBookmarks" /></label> - <input type="file" size="15%" id="upfile" name="upfile" /><br /> - <s:submit key="bow.rightMenu.import.submit" theme="simple" /> + <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" /> </div> </s:form> <s:a action="exportBookmarks"><s:text name="bow.rightMenu.exportBookmarks" /></s:a> Modified: trunk/src/main/webapp/jsp/login.jsp =================================================================== --- trunk/src/main/webapp/jsp/login.jsp 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/webapp/jsp/login.jsp 2011-01-28 17:28:36 UTC (rev 179) @@ -16,6 +16,7 @@ <div id="content"> <div id="formFrame"> <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 /> Modified: trunk/src/main/webapp/jsp/permanentXml.jsp =================================================================== --- trunk/src/main/webapp/jsp/permanentXml.jsp 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/webapp/jsp/permanentXml.jsp 2011-01-28 17:28:36 UTC (rev 179) @@ -25,23 +25,23 @@ <%@page import="org.chorem.bow.TokenActions" %> <% - TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); - String token = ""; - if (tokenActions != null) { - token = tokenActions.getPermanentToken(); - } - String url = request.getRequestURL().toString(); - int index = url.indexOf("permanentXml.jsp"); - url = url.substring(0, index); +TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); +String token = ""; +if (tokenActions != null) { + token = tokenActions.getPermanentToken(); +} +String url = request.getRequestURL().toString(); +int index = url.indexOf("permanentXml.jsp"); +url = url.substring(0, index - 4); %> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/"> - <ShortName>bowPermanentSearchEngine</ShortName> + <ShortName>Bow (permanent)</ShortName> <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%>bow?action=openSearchResult&token=<%=token%>&searchLine={searchTerms}" /> - <Url type="application/x-suggestions+json" method="GET" template="<%=url%>bow?action=openSearchSuggestion&token=<%=token%>&searchLine={searchTerms}" /> - <moz:SearchForm><%=url%>bow</moz:SearchForm> + <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/preferences.jsp =================================================================== --- trunk/src/main/webapp/jsp/preferences.jsp 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/webapp/jsp/preferences.jsp 2011-01-28 17:28:36 UTC (rev 179) @@ -43,11 +43,8 @@ <div class="menu clearfix"> <h2><s:text name="bow.preferences.title" /></h2> </div> - <s:url id="changePreferences" action="preferences"> - <s:param name="update">1</s:param> - </s:url> <s:actionerror /> - <s:form action="%{changePreferences}"> + <s:form action="preferences"> <div class="formFrame"> <h3><s:text name="bow.preferences.userInfo" /></h3> <p> @@ -67,6 +64,7 @@ <s:textfield key="bow.preferences.bookmarksHomePage" name="bookmarksHomePage" labelposition="top" /><br /> <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" /> <br /><br /> <s:url id="home" action="home" /> @@ -98,7 +96,7 @@ <s:url id="deleteImport" action="deleteImport"> <s:param name="date"><%=dateSave%></s:param> </s:url> - <s:a cssClass="deleteImportButton" href="" onclick="deleteConfirmation('%{deleteImport}','%{#bookmarkImport!getCount}','<%=date%>'); return(false);"></s:a> + <a class="deleteImportButton" href="" onclick="deleteConfirmation('<s:property value="%{deleteImport}" />','<%=bookmarkImport.getCount()%>','<%=date%>'); return(false);"></a> </div> <% i++; Modified: trunk/src/main/webapp/jsp/search.jsp =================================================================== --- trunk/src/main/webapp/jsp/search.jsp 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/webapp/jsp/search.jsp 2011-01-28 17:28:36 UTC (rev 179) @@ -52,11 +52,7 @@ <body> <div class="menu clearfix"> <h2><s:text name="bow.search.title" /></h2> - <s:url id="order" action="order" escapeAmp="false"> - <s:param name="searchLine"><s:property value="%{#searchLine}" /></s:param> - <s:param name="fullTextLine"><s:property value="%{#fullText}" /></s:param> - </s:url> - <s:form action="%{order}"> + <s:form action="order"> <p> <label for="type"><s:text name="bow.search.orderby" /></label> <select id="type" name="type"> @@ -76,6 +72,8 @@ </s:url> <s:a id="deleteSearchResultsButton" href="" onclick="deleteConfirmation('%{deleteSearchResults}', %{#bookmarksToDelete}); return(false);"></s:a> </s:if> + <s:hidden name="searchLine" value="%{#searchLine}" /> + <s:hidden name="fullTextLine" value="%{#fullText}" /> </p> </s:form> </div> Modified: trunk/src/main/webapp/jsp/suggestions.jsp =================================================================== --- trunk/src/main/webapp/jsp/suggestions.jsp 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/webapp/jsp/suggestions.jsp 2011-01-28 17:28:36 UTC (rev 179) @@ -27,18 +27,17 @@ <%@page import="java.util.Iterator" %> <%@page import="org.nuiton.wikitty.FacetTopic" %> - <% - OpenSearchActions osa = (OpenSearchActions) request.getAttribute("openSearchAction"); - if (osa != null) { - String[] word = osa.getSearch(); - if (word != null) { - List<FacetTopic> suggestions = osa.getSuggestionList(); - if (suggestions != null) { +OpenSearchActions osa = (OpenSearchActions) request.getAttribute("openSearchAction"); +if (osa != null) { + String[] word = osa.getSearch(); + if (word != null) { + List<FacetTopic> suggestions = osa.getSuggestionList(); + if (suggestions != null) { + %> + <%=osa.getJsonResult()%> + <% + } + } +} %> -<%=osa.getJsonResult()%> -<% - } - } - } -%> Modified: trunk/src/main/webapp/jsp/temporaryXml.jsp =================================================================== --- trunk/src/main/webapp/jsp/temporaryXml.jsp 2011-01-27 15:51:12 UTC (rev 178) +++ trunk/src/main/webapp/jsp/temporaryXml.jsp 2011-01-28 17:28:36 UTC (rev 179) @@ -25,23 +25,23 @@ <%@page import="org.chorem.bow.TokenActions" %> <% - TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); - String token = ""; - if (tokenActions != null) { - token = tokenActions.getTemporaryToken(); - } - String url = request.getRequestURL().toString(); - int index = url.indexOf("temporaryXml.jsp"); - url = url.substring(0, index); +TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); +String token = ""; +if (tokenActions != null) { + token = tokenActions.getTemporaryToken(); +} +String url = request.getRequestURL().toString(); +int index = url.indexOf("temporaryXml.jsp"); +url = url.substring(0, index - 4); %> <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/"> - <ShortName>bowTemporarySearchEngine</ShortName> + <ShortName>Bow (temporary)</ShortName> <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%>bow?action=openSearchResult&token=<%=token%>&searchLine={searchTerms}" /> - <Url type="application/x-suggestions+json" method="GET" template="<%=url%>bow?action=openSearchSuggestion&token=<%=token%>&search={searchTerms}" /> - <moz:SearchForm><%=url%>bow</moz:SearchForm> + <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> Added: trunk/src/main/webapp/template/xhtml/file.ftl =================================================================== --- trunk/src/main/webapp/template/xhtml/file.ftl (rev 0) +++ trunk/src/main/webapp/template/xhtml/file.ftl 2011-01-28 17:28:36 UTC (rev 179) @@ -0,0 +1,24 @@ +<#-- +/* + * $Id: file.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. + */ +--> +<#include "/${parameters.templateDir}/xhtml/controlheader-core.ftl" /> +<#include "/${parameters.templateDir}/simple/file.ftl" />