Author: bbrossaud Date: 2010-06-03 10:18:34 +0200 (Thu, 03 Jun 2010) New Revision: 65 Url: http://chorem.org/repositories/revision/bow/65 Log: tags clickable and password md5 encoding Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java trunk/src/main/java/org/chorem/bow/ControllerServlet.java trunk/src/main/webapp/home.jsp trunk/src/main/webapp/search.jsp Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java =================================================================== --- trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-02 16:53:58 UTC (rev 64) +++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-03 08:18:34 UTC (rev 65) @@ -28,6 +28,11 @@ protected int tmax = -1; protected int tmin = -1; + /* @param html String html + * @param name String name + * @param user User user + * @return Bookmark the bookmark filled + */ public static Bookmark createBookmarkFromHtml(String html, String name, User user) { String link = getUrlFromHtml(html); String tags = getTagsFromHtml(html); @@ -36,6 +41,9 @@ return bookmark; } + /* @param html String html + * @return Date from the html + */ public static Date getDateFromHtml(String html) { Date date = null; if (html != null) { @@ -44,7 +52,7 @@ if (m.find()) { String str = m.group(1); if (str != null && !str.isEmpty()) { - long time = Long.valueOf(str) * 1000; + long time = Long.valueOf(str) * 1000; // the date in ms date = new Date(time); } } @@ -52,6 +60,9 @@ return date; } + /* @param bookmarks List<Bookmarks> bookmarks + * @return String the html file + */ public static String getExportHtmlBookmark(List<Bookmark> bookmarks) { String export = ""; export = "<!DOCTYPE NETSCAPE-Bookmark-file-1>\n" @@ -79,6 +90,9 @@ return export; } + /* @param html String html + * + */ public static String getUrlFromHtml(String html) { String url = ""; if (html != null) { Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java =================================================================== --- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-02 16:53:58 UTC (rev 64) +++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-03 08:18:34 UTC (rev 65) @@ -32,6 +32,7 @@ import org.htmlparser.util.ParserException; import org.htmlparser.util.SimpleNodeIterator; import org.nuiton.util.ArgumentsParserException; +import org.nuiton.util.StringUtil; import org.nuiton.wikitty.Criteria; import org.nuiton.wikitty.FacetTopic; import org.nuiton.wikitty.PagedResult; @@ -632,6 +633,7 @@ throws IOException, ServletException, NoSuchAlgorithmException { String email = request.getParameter("email"); String password = request.getParameter("password"); + password = StringUtil.encodeMD5(password); if (this.checkRegister(email, password)) { // check if all is well String error = "Email and password must be correctly filled"; request.setAttribute("msgError", error); @@ -639,8 +641,8 @@ } else { WikittyProxy proxy = BowProxy.getInstance(); UserImpl newUser = new UserImpl(); - newUser.setPassword(request.getParameter("password")); - newUser.setEmail(request.getParameter("email")); + newUser.setPassword(password); + newUser.setEmail(email); User login = proxy.store((User) newUser); // store the new user if (login == null) { request.getRequestDispatcher("error.jsp").forward(request, response); @@ -663,8 +665,8 @@ throws IOException, ServletException, NoSuchAlgorithmException { String email = request.getParameter("email"); String password = request.getParameter("password"); + password = StringUtil.encodeMD5(password); User login = this.checkLogin(email, password); // check if the user exists - if (login != null) { session.setAttribute("user", login); initializeToken(session, login); Modified: trunk/src/main/webapp/home.jsp =================================================================== --- trunk/src/main/webapp/home.jsp 2010-06-02 16:53:58 UTC (rev 64) +++ trunk/src/main/webapp/home.jsp 2010-06-03 08:18:34 UTC (rev 65) @@ -87,7 +87,7 @@ <a style="text-decoration:none" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>"> <IMG style="border:none" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" /> </a> - <%=tag%> + <a href="bow?action=search&addTag=<%=tag%>" style="text-decoration: none"><%=tag%></a> </div> <% } @@ -142,10 +142,10 @@ <%=sdf.format(bookmark.getDate())%> </td> <% - String alias = bookmark.getAlias(); - if (alias != null && !alias.isEmpty()) { - alias = url + "alias/" + alias; - } + String alias = bookmark.getAlias(); + if (alias != null && !alias.isEmpty()) { + alias = url + "alias/" + alias; + } %> <td class="result" style="text-align: left"> <a title ="<%=alias%>" href="bow?action=addClick&bookmarkId=<%=bookmark.getWikittyId()%>" target="_blank"><%=bookmark.getDescription()%></a> @@ -160,19 +160,19 @@ </td> <td class="result" style="text-align: left"> <% - Set<String> tagList = bookmark.getTags(); - if (tagList != null && !tagList.isEmpty()) { - for (String tag : tagList) { + Set<String> tagList = bookmark.getTags(); + if (tagList != null && !tagList.isEmpty()) { + for (String tag : tagList) { %> <div style="display: inline"> <a style="text-decoration:none" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>"> <IMG style="border:none;" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" /> </a> - <%=tag%> + <a href="bow?action=search&addTag=<%=tag%>" style="text-decoration: none"><%=tag%></a> </div> <% + } } - } %> <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>"> <input type="text" name="tags" size="35" value="<%=BookmarkActions.getBookmarkTagsString(bookmark)%>" /> Modified: trunk/src/main/webapp/search.jsp =================================================================== --- trunk/src/main/webapp/search.jsp 2010-06-02 16:53:58 UTC (rev 64) +++ trunk/src/main/webapp/search.jsp 2010-06-03 08:18:34 UTC (rev 65) @@ -104,7 +104,7 @@ <a style="text-decoration:none" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>"> <IMG style="border:none" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" /> </a> - <%=tag%> + <a href="bow?action=search&addTag=<%=tag%>&searchLine=<%=searchLine%>" style="text-decoration: none"><%=tag%></a> </div> <% }