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
- 631 discussions
02 Jun '10
Author: bbrossaud
Date: 2010-06-02 12:32:07 +0200 (Wed, 02 Jun 2010)
New Revision: 57
Url: http://chorem.org/repositories/revision/bow/57
Log:
remove bugs and cutting the jsp in different logical parts
Added:
trunk/src/main/webapp/footer.jsp
trunk/src/main/webapp/header.jsp
trunk/src/main/webapp/main.jsp
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/login.jsp
trunk/src/main/webapp/openSearchResult.jsp
trunk/src/main/webapp/register.jsp
trunk/src/main/webapp/search.jsp
trunk/src/main/xmi/bow.zargo
Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-01 14:15:25 UTC (rev 56)
+++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-02 10:32:07 UTC (rev 57)
@@ -353,8 +353,15 @@
lastBookmarks = newList;
}
+ public void setTagSearch(List<String> cpy) {
+ tagsSearch = cpy;
+ }
+
public String getSearchLine() {
- return StringUtil.join(tagsSearch, " ", true); // return the search line created with the tags
+ if (tagsSearch != null) {
+ return StringUtil.join(tagsSearch, " ", true); // return the search line created with the tags
+ }
+ return null;
}
public int getFont(int ti) {
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 14:15:25 UTC (rev 56)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-02 10:32:07 UTC (rev 57)
@@ -109,7 +109,7 @@
log.debug("Going to actionHome.jsp");
}
this.actionHome(request, user);
- request.getRequestDispatcher("home.jsp").forward(request, response);
+ request.getRequestDispatcher("main.jsp").forward(request, response);
} else if (action.equals("addUrl") && user != null) {
if (log.isDebugEnabled()) {
log.debug("Going to actionAddUrl");
@@ -130,7 +130,7 @@
log.debug("Going to actionSearch");
}
this.actionSearch(request, user);
- request.getRequestDispatcher("search.jsp").forward(request, response);
+ request.getRequestDispatcher("main.jsp").forward(request, response);
} else if (action.equals("generateToken") && user != null) {
if (log.isDebugEnabled()) {
log.debug("Going to actionGenerateToken");
@@ -161,7 +161,7 @@
log.debug("Going to actionOrderAsc");
}
this.actionOrderAsc(request, response, user);
- request.getRequestDispatcher("search.jsp").forward(request, response);
+ request.getRequestDispatcher("main.jsp").forward(request, response);
} else if (action.equals("orderAscOS") && user != null) {
if (log.isDebugEnabled()) {
log.debug("Going to actionOrderAsc");
@@ -173,7 +173,7 @@
log.debug("Going to actionOrderDesc");
}
this.actionOrderDesc(request, response, user);
- request.getRequestDispatcher("search.jsp").forward(request, response);
+ request.getRequestDispatcher("main.jsp").forward(request, response);
} else if (action.equals("orderDescOS") && user != null) {
if (log.isDebugEnabled()) {
log.debug("Going to actionOrderDesc");
@@ -210,7 +210,7 @@
log.debug("Going to actionFullText");
}
this.actionFullText(request, user);
- request.getRequestDispatcher("search.jsp").forward(request, response);
+ request.getRequestDispatcher("main.jsp").forward(request, response);
} else {
if (user != null) {
request.getRequestDispatcher("error.jsp").forward(request, response);
@@ -222,8 +222,7 @@
request.getRequestDispatcher("login.jsp").forward(request, response);
}
} catch (Exception eee) {
- throw new ServletException("msg", eee);
- // request.getRequestDispatcher("error.jsp").forward(request, response);
+ request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
@@ -398,16 +397,18 @@
throws IOException, ServletException, NoSuchAlgorithmException {
WikittyProxy proxy = BowProxy.getInstance();
- Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, user.getEmail()).criteria();
+ Criteria criteria = Search.query().eq(Token.FQ_FIELD_EMAIL, user.getEmail()).criteria();
Token currentToken = proxy.findByCriteria(Token.class, criteria);
if (currentToken != null) {
- proxy.delete(currentToken.getWikittyId());
+ String id = currentToken.getWikittyId();
+ proxy.delete(id);
}
TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions");
if (tokenActions != null) {
String token = tokenActions.generateToken(); // Generate an encoding MD5 token
criteria = Search.query().eq(Token.FQ_FIELD_TOKEN, token).criteria();
- if (proxy.findByCriteria(Token.class, criteria) == null) { // Check if the token already exists
+ Token oldToken = proxy.findByCriteria(Token.class, criteria);
+ if (oldToken == null) { // Check if the token already exists
TokenImpl newToken = new TokenImpl();
newToken.setToken(token);
newToken.setEmail(user.getEmail());
@@ -558,7 +559,7 @@
session.setAttribute("user", login);
initializeToken(session, login);
actionHome(request, login);
- request.getRequestDispatcher("home.jsp").forward(request, response);
+ request.getRequestDispatcher("main.jsp").forward(request, response);
}
}
}
@@ -577,7 +578,7 @@
session.setAttribute("user", login);
initializeToken(session, login);
actionHome(request, login);
- request.getRequestDispatcher("home.jsp").forward(request, response);
+ request.getRequestDispatcher("main.jsp").forward(request, response);
} else {
String error = "Unknow email or incorrect password";
@@ -652,6 +653,7 @@
sortCriteria = criteria.addSortDescending(Bookmark.FQ_FIELD_DATE).setEndIndex(10);
List<Bookmark> lastBookmarks = proxy.findAllByCriteria(Bookmark.class, sortCriteria).getAll();
BookmarkActions bookmarkActions = createBookmarkActions(request, result, null);
+ bookmarkActions.setTagSearch(null);
List<Bookmark> bookList = bookmarkActions.getBookmarks();
if (bookList.size() > 10) {
bookList = bookmarkActions.getBookmarks().subList(0, 10);
Added: trunk/src/main/webapp/footer.jsp
===================================================================
--- trunk/src/main/webapp/footer.jsp (rev 0)
+++ trunk/src/main/webapp/footer.jsp 2010-06-02 10:32:07 UTC (rev 57)
@@ -0,0 +1,18 @@
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%
+ String url = (String) request.getAttribute("bowUrl");
+ String version = (String) request.getAttribute("version");
+%>
+<body>
+ <br />
+ <br />
+ <div class="Index" id="footer" style="float: left">
+ <a shape="rect" href="<%=url%>">bow</a>
+ <a shape="rect" href="http://www.chorem.org/projects/list_files/bow"><%=version%></a> -
+ <a shape="rect" href="http://www.gnu.org/licenses/agpl.html">Licence AGPL</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>
+ </div>
+</body>
\ No newline at end of file
Added: trunk/src/main/webapp/header.jsp
===================================================================
--- trunk/src/main/webapp/header.jsp (rev 0)
+++ trunk/src/main/webapp/header.jsp 2010-06-02 10:32:07 UTC (rev 57)
@@ -0,0 +1,12 @@
+<%
+ String url = (String) request.getAttribute("bowUrl");
+%>
+
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
+ <meta name="description" content="Bookmark On Web" />
+ <title>Bow</title>
+ <link rel="stylesheet" type="text/css" href="./css/styles.css" />
+ <link rel="search" type="application/opensearchdescription+xml" title="bowTemporarySearchEngine" href="<%=url%>bow?action=temporaryXml" />
+ <link rel="search" type="application/opensearchdescription+xml" title="bowPermanentSearchEngine" href="<%=url%>bow?action=permanentXml" />
+</head>
\ No newline at end of file
Modified: trunk/src/main/webapp/home.jsp
===================================================================
--- trunk/src/main/webapp/home.jsp 2010-06-01 14:15:25 UTC (rev 56)
+++ trunk/src/main/webapp/home.jsp 2010-06-02 10:32:07 UTC (rev 57)
@@ -1,10 +1,8 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="org.chorem.bow.Bookmark" %>
<%@page import="org.chorem.bow.BookmarkActions" %>
-<%@page import="java.util.HashMap" %>
<%@page import="java.text.SimpleDateFormat" %>
<%@page import="java.util.Iterator" %>
-<%@page import="java.util.Map" %>
<%@page import="java.util.Set" %>
<%@page import="java.util.ArrayList" %>
<%@page import="java.util.List" %>
@@ -18,259 +16,243 @@
String temporaryToken = tokenActions.getTemporaryToken();
String permanentToken = tokenActions.getPermanentToken();
String url = (String) request.getAttribute("bowUrl");
- String version = (String) request.getAttribute("version");
%>
-
-<html>
- <link rel="stylesheet" type="text/css" href="./css/styles.css" />
- <link rel="search" type="application/opensearchdescription+xml" title="bowTemporarySearchEngine" href="<%=url%>bow?action=temporaryXml" />
- <link rel="search" type="application/opensearchdescription+xml" title="bowPermanentSearchEngine" href="<%=url%>bow?action=permanentXml" />
- <body>
- <div id="table">
- <h1 class="result">
- <a style="float: left;font-size: 12px; margin-left: 10px;" href="<%=url%>bow?action=home">home</a>
- Home
- </h1>
+<body>
+ <div id="table">
+ <h1 class="result">
+ <a style="float: left;font-size: 12px; margin-left: 10px;" href="<%=url%>bow?action=home">home</a>
+ Home
+ </h1>
+ <%
+ if (bookmarkActions != null) {
+ List<Bookmark> bookmarkList = bookmarkActions.getBookmarks();
+ if (!bookmarkList.isEmpty()) {
+ %>
+ <h2 class="result">The most used bookmarks</h2>
+ <table class="result">
+ <tr class="result">
+ <th class ="result remove">
+ remove
+ </th>
+ <th class="result date">
+ Date
+ </th>
+ <th class="result name">
+ Name
+ </th>
+ <th class ="result tags">
+ Tags
+ </th>
+ <th class=" result click">
+ Click
+ </th>
+ </tr>
<%
- if (bookmarkActions != null) {
- List<Bookmark> bookmarkList = bookmarkActions.getBookmarks();
- if (!bookmarkList.isEmpty()) {
+ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
+ for (Bookmark bookmark : bookmarkList) {
%>
- <h2 class="result">The most used bookmarks</h2>
- <table class="result">
- <tr class="result">
- <th class ="result remove">
- remove
- </th>
- <th class="result date">
- Date
- </th>
- <th class="result name">
- Name
- </th>
- <th class ="result tags">
- Tags
- </th>
- <th class=" result click">
- Click
- </th>
- </tr>
+ <tr class="result">
+ <td class="result">
+ <a style="border:none;" href="bow?action=removeBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
+ <IMG style="border:none;" SRC="img/remove.png" ALT="Remove bookmark" TITLE="Remove" />
+ </a>
+ </td>
+ <td class="result">
+ <%=sdf.format(bookmark.getDate())%>
+ </td>
<%
- SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
- for (Bookmark bookmark : bookmarkList) {
+ String alias = bookmark.getAlias();
+ if (alias != null && !alias.isEmpty()) {
+ alias = url + "alias/" + alias;
+ }
%>
- <tr class="result">
- <td class="result">
- <a style="border:none;" href="bow?action=removeBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
- <IMG style="border:none;" SRC="img/remove.png" ALT="Remove bookmark" TITLE="Remove" />
+ <td class="result" style="text-align: left">
+ <a title ="<%=alias%>" href="bow?action=addClick&bookmarkId=<%=bookmark.getWikittyId()%>" target="_blank"><%=bookmark.getDescription()%></a>
+ <form method="POST" action="bow?action=addAlias&bookmarkId=<%=bookmark.getWikittyId()%>" style="display: inline">
+ <input type="text" name="alias" size="10" value="<%=bookmark.getAlias()%>" />
+ <input style="display: inline;" type="submit" value="Add alias" />
+ </form>
+ <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
+ <input type="text" name="name" size="35" value="<%=bookmark.getDescription()%>" />
+ <input type="image" src="img/edit.png" title="Edit"/>
+ </form>
+ </td>
+ <td class="result" style="text-align: left">
+ <%
+ 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>
- </td>
- <td class="result">
- <%=sdf.format(bookmark.getDate())%>
- </td>
+ <%=tag%>
+ </div>
<%
- 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>
- <form method="POST" action="bow?action=addAlias&bookmarkId=<%=bookmark.getWikittyId()%>" style="display: inline">
- <input type="text" name="alias" size="10" value="<%=bookmark.getAlias()%>" />
- <input style="display: inline;" type="submit" value="Add alias" />
- </form>
- <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
- <input type="text" name="name" size="35" value="<%=bookmark.getDescription()%>" />
- <input type="image" src="img/edit.png" title="Edit"/>
- </form>
- </td>
- <td class="result" style="text-align: left">
- <%
- 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%>
- </div>
- <%
- }
- }
- %>
- <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
- <input type="text" name="tags" size="35" value="<%=BookmarkActions.getBookmarkTagsString(bookmark)%>" />
- <input type="image" src="img/edit.png" title="Edit"/>
- </form>
- </td>
- <td class="result">
- <%=bookmark.getClick()%>
- </td>
- </tr>
- <%
- }
- %>
- </table>
+ <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
+ <input type="text" name="tags" size="35" value="<%=BookmarkActions.getBookmarkTagsString(bookmark)%>" />
+ <input type="image" src="img/edit.png" title="Edit"/>
+ </form>
+ </td>
+ <td class="result">
+ <%=bookmark.getClick()%>
+ </td>
+ </tr>
<%
- List<Bookmark> lastBookmarks = bookmarkActions.getLastBookmarks();
- if (!lastBookmarks.isEmpty()) {
+ }
%>
- <h2 class="result">The last addition bookmarks</h2>
- <table class="result">
- <tr class="result">
- <th class ="result remove">
- remove
- </th>
- <th class="result date">
- Date
- </th>
- <th class="result name">
- Name
- </th>
- <th class ="result tags">
- Tags
- </th>
- <th class=" result click">
- Click
- </th>
- </tr>
+ </table>
+ <%
+ List<Bookmark> lastBookmarks = bookmarkActions.getLastBookmarks();
+ if (!lastBookmarks.isEmpty()) {
+ %>
+ <h2 class="result">The last addition bookmarks</h2>
+ <table class="result">
+ <tr class="result">
+ <th class ="result remove">
+ remove
+ </th>
+ <th class="result date">
+ Date
+ </th>
+ <th class="result name">
+ Name
+ </th>
+ <th class ="result tags">
+ Tags
+ </th>
+ <th class=" result click">
+ Click
+ </th>
+ </tr>
+ <%
+ for (Bookmark bookmark : lastBookmarks) {
+ %>
+ <tr class="result">
+ <td class="result">
+ <a style="border:none;" href="bow?action=removeBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
+ <IMG style="border:none;" SRC="img/remove.png" ALT="Remove bookmark" TITLE="Remove" />
+ </a>
+ </td>
+ <td class="result">
+ <%=sdf.format(bookmark.getDate())%>
+ </td>
<%
- for (Bookmark bookmark : lastBookmarks) {
+ String alias = bookmark.getAlias();
+ if (alias != null && !alias.isEmpty()) {
+ alias = url + "alias/" + alias;
+ }
%>
- <tr class="result">
- <td class="result">
- <a style="border:none;" href="bow?action=removeBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
- <IMG style="border:none;" SRC="img/remove.png" ALT="Remove bookmark" TITLE="Remove" />
+ <td class="result" style="text-align: left">
+ <a title ="<%=alias%>" href="bow?action=addClick&bookmarkId=<%=bookmark.getWikittyId()%>" target="_blank"><%=bookmark.getDescription()%></a>
+ <form method="POST" action="bow?action=addAlias&bookmarkId=<%=bookmark.getWikittyId()%>" style="display: inline">
+ <input type="text" name="alias" size="10" value="<%=bookmark.getAlias()%>" />
+ <input style="display: inline;" type="submit" value="Add alias" />
+ </form>
+ <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
+ <input type="text" name="name" size="35" value="<%=bookmark.getDescription()%>" />
+ <input type="image" src="img/edit.png" title="Edit"/>
+ </form>
+ </td>
+ <td class="result" style="text-align: left">
+ <%
+ 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>
- </td>
- <td class="result">
- <%=sdf.format(bookmark.getDate())%>
- </td>
+ <%=tag%>
+ </div>
<%
- 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>
- <form method="POST" action="bow?action=addAlias&bookmarkId=<%=bookmark.getWikittyId()%>" style="display: inline">
- <input type="text" name="alias" size="10" value="<%=bookmark.getAlias()%>" />
- <input style="display: inline;" type="submit" value="Add alias" />
- </form>
- <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
- <input type="text" name="name" size="35" value="<%=bookmark.getDescription()%>" />
- <input type="image" src="img/edit.png" title="Edit"/>
- </form>
- </td>
- <td class="result" style="text-align: left">
- <%
- 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%>
- </div>
- <%
- }
- }
- %>
- <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
- <input type="text" name="tags" size="35" value="<%=BookmarkActions.getBookmarkTagsString(bookmark)%>" />
- <input style="display: inline" type="image" src="img/edit.png" title="Edit"/>
- </form>
- </td>
- <td class="result">
- <%=bookmark.getClick()%>
- </td>
- </tr>
- <%
- }
- %>
- </table>
+ <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
+ <input type="text" name="tags" size="35" value="<%=BookmarkActions.getBookmarkTagsString(bookmark)%>" />
+ <input style="display: inline" type="image" src="img/edit.png" title="Edit"/>
+ </form>
+ </td>
+ <td class="result">
+ <%=bookmark.getClick()%>
+ </td>
+ </tr>
<%
- }
- } else {
+ }
%>
- <h2 class="result">No Bookmarks</h2>
- <% }
- }
- %>
+ </table>
+ <%
+ }
+ } else {
+ %>
+ <h2 class="result">No Bookmarks</h2>
+ <% }
+ }
+ %>
+ </div>
+ <div id="menu">
+ <div class="menu">
+ <ul id="meta">
+ <li><a href="bow?action=logout">Logout</a></li>
+ <li><a 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='<%=url%>bow?action=addUrl&token=<%=temporaryToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);}void(0);">Temporary token</a></li>
+ <li><a 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='<%=url%>bow?action=addUrl&token=<%=permanentToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);}void(0);">Current permanent token</a></li>
+ <li><a href="bow?action=generateToken">Regenerate permanent token</a></li>
+ </ul>
</div>
- <div id="menu">
- <div class="menu">
- <ul id="meta">
- <li><a href="bow?action=logout">Logout</a></li>
- <li><a 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='<%=url%>bow?action=addUrl&token=<%=temporaryToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);}void(0);">Temporary token</a></li>
- <li><a 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='<%=url%>bow?action=addUrl&token=<%=permanentToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);}void(0);">Current permanent token</a></li>
- <li><a href="bow?action=generateToken">Regenerate permanent token</a></li>
- </ul>
- </div>
- <div class="menu">
- <form method="POST" action="bow?action=addUrl">
- URL<br />
- <input type="text" name="url" size="20" value="URL" /><br />
- Name<br />
- <input type="text" name="name" size="20" value="name" /><br />
- Tags<br />
- <input type="text" name="tags" size="20" value="tag1 tag2..." /><br />
- <input type="submit" value="add" />
- </form>
- </div>
+ <div class="menu">
+ <form method="POST" action="bow?action=addUrl">
+ URL<br />
+ <input type="text" name="url" size="20" value="URL" /><br />
+ Name<br />
+ <input type="text" name="name" size="20" value="name" /><br />
+ Tags<br />
+ <input type="text" name="tags" size="20" value="tag1 tag2..." /><br />
+ <input type="submit" value="add" />
+ </form>
+ </div>
- <div class="menu">
- <div class="tagCloud">
- <% if (bookmarkActions != null) {
- List<FacetTopic> tagCloud = bookmarkActions.getTagsCloud();
- for (FacetTopic tag : tagCloud) {
- int value = tag.getCount();
- String tagName = tag.getTopicName();
- int font = bookmarkActions.getFont(value);
- %>
- <a href="bow?action=search&addTag=<%=tagName%>" title="<%=value%> results" class="tag" style="font-size: <%=font%>px;"><%=tagName%></a>
- <%
- }
+ <div class="menu">
+ <div class="tagCloud">
+ <% if (bookmarkActions != null) {
+ List<FacetTopic> tagCloud = bookmarkActions.getTagsCloud();
+ for (FacetTopic tag : tagCloud) {
+ int value = tag.getCount();
+ String tagName = tag.getTopicName();
+ int font = bookmarkActions.getFont(value);
+ %>
+ <a href="bow?action=search&addTag=<%=tagName%>" title="<%=value%> results" class="tag" style="font-size: <%=font%>px;"><%=tagName%></a>
+ <%
}
- %>
- <form method="POST" action="bow?action=search" style="text-align: center;margin-left: 20px;">
- <input style="float: left" type="text" name="searchLine" size="15" />
- <input style="float: left;" type="submit" value="Find" />
- </form>
- </div>
- </div>
- <div class="menu">
- <form method="POST" action="bow?action=fullText" style="text-align: center;">
- Full text research
- <input style="float: left" type="text" name="fullTextLine" size="15" value="<%=bookmarkActions.getFullTextLine()%>"/>
+ }
+ %>
+ <form method="POST" action="bow?action=search" style="text-align: center;margin-left: 20px;">
+ <input style="float: left" type="text" name="searchLine" size="15" />
<input style="float: left;" type="submit" value="Find" />
</form>
</div>
- <div class="menu">
- <form method="POST" action="bow?action=importBookmarks" enctype="multipart/form-data">
- Import Bookmarks
- <input type="file" name="upfile" />
- <input type="submit" value="Import"/>
- </form>
- <br />
- <a href="bow?action=exportBookmarks">Export bookmarks</a>
- </div>
</div>
- <div class="Index" id="footer">
- <a shape="rect" href="<%=url%>">bow</a>
- <a shape="rect" href="http://www.chorem.org/projects/list_files/bow"><%=version%></a> -
- <a shape="rect" href="http://www.gnu.org/licenses/agpl.html">Licence AGPL</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>
+ <div class="menu">
+ <form method="POST" action="bow?action=fullText" style="text-align: center;">
+ Full text research
+ <input style="float: left" type="text" name="fullTextLine" size="15" value="<%=bookmarkActions.getFullTextLine()%>"/>
+ <input style="float: left;" type="submit" value="Find" />
+ </form>
</div>
- </body>
-</html>
+ <div class="menu">
+ <form method="POST" action="bow?action=importBookmarks" enctype="multipart/form-data">
+ Import Bookmarks
+ <input type="file" name="upfile" />
+ <input type="submit" value="Import"/>
+ </form>
+ <br />
+ <a href="bow?action=exportBookmarks">Export bookmarks</a>
+ </div>
+ </div>
+</body>
<%}%>
\ No newline at end of file
Modified: trunk/src/main/webapp/login.jsp
===================================================================
--- trunk/src/main/webapp/login.jsp 2010-06-01 14:15:25 UTC (rev 56)
+++ trunk/src/main/webapp/login.jsp 2010-06-02 10:32:07 UTC (rev 57)
@@ -6,7 +6,9 @@
%>
<html>
- <link rel="stylesheet" type="text/css" href="./css/styles.css" />
+ <jsp:include page="header.jsp" flush="true">
+ <jsp:param name="bowUrl" value="<%=url%>"/>
+ </jsp:include>
<body>
<h1 class="login">Login</h1>
<form method="POST" action="bow?action=login">
@@ -21,14 +23,9 @@
<%if (error != null) {%>
<font color="red"><%=error%></font>
<%}%>
- <div class="Index" id="footer">
- <a shape="rect" href="<%=url%>">bow</a>
- <a shape="rect" href="http://www.chorem.org/projects/list_files/bow"><%=version%></a> -
- <a shape="rect" href="http://www.gnu.org/licenses/agpl.html">Licence AGPL</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>
- </div>
+ <jsp:include page="footer.jsp" flush="true" >
+ <jsp:param name="bowUrl" value="<%=url%>" />
+ <jsp:param name="version" value="<%=version%>" />
+ </jsp:include>
</body>
</html>
\ No newline at end of file
Added: trunk/src/main/webapp/main.jsp
===================================================================
--- trunk/src/main/webapp/main.jsp (rev 0)
+++ trunk/src/main/webapp/main.jsp 2010-06-02 10:32:07 UTC (rev 57)
@@ -0,0 +1,40 @@
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@page import="org.chorem.bow.BookmarkActions" %>
+<%@page import="org.chorem.bow.TokenActions" %>
+
+<%
+ TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions");
+ BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions");
+ if (tokenActions != null && bookmarkActions != null) {
+ String searchLine = bookmarkActions.getSearchLine();
+ String url = (String) request.getAttribute("bowUrl");
+ String version = (String) request.getAttribute("version");
+%>
+
+<html>
+ <jsp:include page="header.jsp" flush="true">
+ <jsp:param name="bowUrl" value="<%=url%>"/>
+ </jsp:include>
+ <%
+ if (searchLine != null) {
+ %>
+ <jsp:include page="search.jsp" flush="true">
+ <jsp:param name="bookmarkActions" value="<%=tokenActions%>" />
+ <jsp:param name="bookmarkActions" value="<%=bookmarkActions%>" />
+ <jsp:param name="bowUrl" value="<%=url%>"/>
+ </jsp:include>
+ <% } else {
+ %>
+ <jsp:include page="home.jsp" flush="true">
+ <jsp:param name="bookmarkActions" value="<%=tokenActions%>" />
+ <jsp:param name="bookmarkActions" value="<%=bookmarkActions%>" />
+ <jsp:param name="bowUrl" value="<%=url%>"/>
+ </jsp:include>
+ <% }
+ %>
+ <jsp:include page="footer.jsp" flush="true" >
+ <jsp:param name="bowUrl" value="<%=url%>" />
+ <jsp:param name="version" value="<%=version%>" />
+ </jsp:include>
+</html>
+<%}%>
\ No newline at end of file
Modified: trunk/src/main/webapp/openSearchResult.jsp
===================================================================
--- trunk/src/main/webapp/openSearchResult.jsp 2010-06-01 14:15:25 UTC (rev 56)
+++ trunk/src/main/webapp/openSearchResult.jsp 2010-06-02 10:32:07 UTC (rev 57)
@@ -20,7 +20,9 @@
%>
<html>
- <link rel="stylesheet" type="text/css" href="./css/styles.css" />
+ <jsp:include page="header.jsp" flush="true">
+ <jsp:param name="bowUrl" value="<%=url%>"/>
+ </jsp:include>
<body>
<h1 class="result">Results</h1>
Modified: trunk/src/main/webapp/register.jsp
===================================================================
--- trunk/src/main/webapp/register.jsp 2010-06-01 14:15:25 UTC (rev 56)
+++ trunk/src/main/webapp/register.jsp 2010-06-02 10:32:07 UTC (rev 57)
@@ -5,7 +5,9 @@
String version = (String) request.getAttribute("version");
%>
<html>
- <link rel="stylesheet" type="text/css" href="./css/styles.css" />
+ <jsp:include page="header.jsp" flush="true">
+ <jsp:param name="bowUrl" value="<%=url%>"/>
+ </jsp:include>
<body>
<h1 class="login">Register</h1>
@@ -21,14 +23,9 @@
<%if (error != null && error.isEmpty() == false) {%>
<font color="red"><%=error%></font>
<%}%>
- <div class="Index" id="footer">
- <a shape="rect" href="<%=url%>">bow</a>
- <a shape="rect" href="http://www.chorem.org/projects/list_files/bow"><%=version%></a> -
- <a shape="rect" href="http://www.gnu.org/licenses/agpl.html">Licence AGPL</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>
- </div>
+ <jsp:include page="footer.jsp" flush="true" >
+ <jsp:param name="bowUrl" value="<%=url%>" />
+ <jsp:param name="version" value="<%=version%>" />
+ </jsp:include>
</body>
</html>
\ No newline at end of file
Modified: trunk/src/main/webapp/search.jsp
===================================================================
--- trunk/src/main/webapp/search.jsp 2010-06-01 14:15:25 UTC (rev 56)
+++ trunk/src/main/webapp/search.jsp 2010-06-02 10:32:07 UTC (rev 57)
@@ -1,10 +1,8 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="org.chorem.bow.Bookmark" %>
<%@page import="org.chorem.bow.BookmarkActions" %>
-<%@page import="java.util.HashMap" %>
<%@page import="java.text.SimpleDateFormat" %>
<%@page import="java.util.Iterator" %>
-<%@page import="java.util.Map" %>
<%@page import="java.util.Set" %>
<%@page import="java.util.ArrayList" %>
<%@page import="java.util.List" %>
@@ -23,189 +21,174 @@
String version = (String) request.getAttribute("version");
%>
-<html>
- <head>
- <link rel="stylesheet" type="text/css" href="./css/styles.css" />
- <link rel="search" type="application/opensearchdescription+xml" title="bowTemporarySearchEngine" href="<%=url%>bow?action=temporaryXml" />
- <link rel="search" type="application/opensearchdescription+xml" title="bowPermanentSearchEngine" href="<%=url%>bow?action=permanentXml" />
- <body>
- <div id="table">
- <h1 class="result">
- <a style="float: left;font-size: 12px; margin-left: 10px;" href="<%=url%>bow?action=home">home</a>
- My Bookmarks
- </h1>
+<body>
+ <div id="table">
+ <h1 class="result">
+ <a style="float: left;font-size: 12px; margin-left: 10px;" href="<%=url%>bow?action=home">home</a>
+ My Bookmarks
+ </h1>
+ <%
+ if (bookmarkActions != null) {
+ List<Bookmark> bookmarkList = bookmarkActions.getBookmarks();
+ if (!bookmarkList.isEmpty()) {
+ %>
+ <table class="result">
+ <tr class="result">
+ <th class="result remove">Remove</th>
+ <th class="result date">
+ Date
+ <a style="text-decoration:none" href="bow?action=orderAsc&type=date&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>" >
+ <IMG style="border:none" SRC="img/asc.png" ALT="order ASC" TITLE="Asc" />
+ </a>
+ <a style="text-decoration:none" href="bow?action=orderDesc&type=date&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ <IMG style="border:none" SRC="img/desc.png" ALT="order DESC" TITLE="Desc" />
+ </a>
+ </th>
+ <th class="result name">
+ Name
+ <a style="text-decoration:none" href="bow?action=orderAsc&type=name&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ <IMG style="border:none" SRC="img/asc.png" ALT="order ASC" TITLE="Asc" />
+ </a>
+ <a style="text-decoration:none" href="bow?action=orderDesc&type=name&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ <IMG style="border:none" SRC="img/desc.png" ALT="order DESC" TITLE="Desc" />
+ </a>
+ </th>
+ <th class ="result tags">Tags</th>
+ <th class=" result click">
+ Click
+ <a style="text-decoration:none" href="bow?action=orderAsc&type=click&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ <IMG style="border:none" SRC="img/asc.png" ALT="order ASC" TITLE="Asc" />
+ </a>
+ <a style="text-decoration:none" href="bow?action=orderDesc&type=click&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ <IMG style="border:none" SRC="img/desc.png" ALT="order DESC" TITLE="Desc" />
+ </a>
+ </th>
+ </tr>
<%
- if (bookmarkActions != null) {
- List<Bookmark> bookmarkList = bookmarkActions.getBookmarks();
- if (!bookmarkList.isEmpty()) {
+ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
+ for (Bookmark bookmark : bookmarkList) {
%>
- <table class="result">
- <tr class="result">
- <th class="result remove">Remove</th>
- <th class="result date">
- Date
- <a style="text-decoration:none" href="bow?action=orderAsc&type=date&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>" >
- <IMG style="border:none" SRC="img/asc.png" ALT="order ASC" TITLE="Asc" />
- </a>
- <a style="text-decoration:none" href="bow?action=orderDesc&type=date&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
- <IMG style="border:none" SRC="img/desc.png" ALT="order DESC" TITLE="Desc" />
- </a>
- </th>
- <th class="result name">
- Name
- <a style="text-decoration:none" href="bow?action=orderAsc&type=name&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
- <IMG style="border:none" SRC="img/asc.png" ALT="order ASC" TITLE="Asc" />
- </a>
- <a style="text-decoration:none" href="bow?action=orderDesc&type=name&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
- <IMG style="border:none" SRC="img/desc.png" ALT="order DESC" TITLE="Desc" />
- </a>
- </th>
- <th class ="result tags">Tags</th>
- <th class=" result click">
- Click
- <a style="text-decoration:none" href="bow?action=orderAsc&type=click&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
- <IMG style="border:none" SRC="img/asc.png" ALT="order ASC" TITLE="Asc" />
- </a>
- <a style="text-decoration:none" href="bow?action=orderDesc&type=click&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
- <IMG style="border:none" SRC="img/desc.png" ALT="order DESC" TITLE="Desc" />
- </a>
- </th>
- </tr>
+ <tr class="result">
+ <td class="result">
+ <a style="border:none;" href="bow?action=removeBookmark&bookmarkId=<%=bookmark.getWikittyId()%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ <IMG style="border:none;" SRC="img/remove.png" ALT="Remove bookmark" TITLE="Remove" />
+ </a>
+ </td>
+ <td class="result">
+ <%=sdf.format(bookmark.getDate())%>
+ </td>
<%
- SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
- for (Bookmark bookmark : bookmarkList) {
+ String alias = bookmark.getAlias();
+ if (alias != null && !alias.isEmpty()) {
+ alias = url + "alias/" + alias;
+ }
%>
- <tr class="result">
- <td class="result">
- <a style="border:none;" href="bow?action=removeBookmark&bookmarkId=<%=bookmark.getWikittyId()%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
- <IMG style="border:none;" SRC="img/remove.png" ALT="Remove bookmark" TITLE="Remove" />
+ <td class="result">
+ <a title ="<%=alias%>" href="bow?action=addClick&bookmarkId=<%=bookmark.getWikittyId()%>" target="_blank"><%=bookmark.getDescription()%></a>
+ <form method="POST" action="bow?action=addAlias&bookmarkId=<%=bookmark.getWikittyId()%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>" style="display: inline">
+ <input type="text" name="alias" size="10" value="<%=bookmark.getAlias()%>" />
+ <input style="display: inline;" type="submit" value="Add alias" />
+ </form>
+ <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ <input type="text" name="name" size="35" value="<%=bookmark.getDescription()%>" />
+ <input type="image" src="img/edit.png" title="Edit"/>
+ </form>
+ </td>
+ <td class="result" style="text-align: left">
+ <%
+ 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%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ <IMG style="border:none" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" />
</a>
- </td>
- <td class="result">
- <%=sdf.format(bookmark.getDate())%>
- </td>
+ <%=tag%>
+ </div>
<%
- String alias = bookmark.getAlias();
- if (alias != null && !alias.isEmpty()) {
- alias = url + "alias/" + alias;
- }
+ }
+ }
%>
- <td class="result">
- <a title ="<%=alias%>" href="bow?action=addClick&bookmarkId=<%=bookmark.getWikittyId()%>" target="_blank"><%=bookmark.getDescription()%></a>
- <form method="POST" action="bow?action=addAlias&bookmarkId=<%=bookmark.getWikittyId()%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>" style="display: inline">
- <input type="text" name="alias" size="10" value="<%=bookmark.getAlias()%>" />
- <input style="display: inline;" type="submit" value="Add alias" />
- </form>
- <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
- <input type="text" name="name" size="35" value="<%=bookmark.getDescription()%>" />
- <input type="image" src="img/edit.png" title="Edit"/>
- </form>
- </td>
- <td class="result" style="text-align: left">
- <%
- 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%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
- <IMG style="border:none" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" />
- </a>
- <%=tag%>
- </div>
- <%
- }
- }
- %>
- <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
- <input type="text" name="tags" size="35" value="<%=BookmarkActions.getBookmarkTagsString(bookmark)%>" />
- <input type="image" src="img/edit.png" title="Edit"/>
- </form>
- </td>
- <td class="result">
- <%=bookmark.getClick()%>
- </td>
- </tr>
- <%
- }
- %>
- </table>
+ <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ <input type="text" name="tags" size="35" value="<%=BookmarkActions.getBookmarkTagsString(bookmark)%>" />
+ <input type="image" src="img/edit.png" title="Edit"/>
+ </form>
+ </td>
+ <td class="result">
+ <%=bookmark.getClick()%>
+ </td>
+ </tr>
<%
- } else {
+ }
%>
- <h2 class="result">No Bookmarks</h2>
- <% }
- }
- %>
+ </table>
+ <%
+ } else {
+ %>
+ <h2 class="result">No Bookmarks</h2>
+ <% }
+ }
+ %>
+ </div>
+ <div id="menu">
+ <div class="menu">
+ <ul id="meta">
+ <li><a href="bow?action=logout">Logout</a></li>
+ <li><a href="bow?action=home">Home</a></li>
+ <li><a 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+'|');var%20link='<%=url%>bow?action=addUrl&token=<%=temporaryToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);void(0);">Temporary token</a></li>
+ <li><a 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+'|');var%20link='<%=url%>bow?action=addUrl&token=<%=permanentToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);void(0);">Current permanent token</a></li>
+ <li><a href="bow?action=generateToken&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">Regenerate permanent token</a></li>
+ </ul>
</div>
- <div id="menu">
- <div class="menu">
- <ul id="meta">
- <li><a href="bow?action=logout">Logout</a></li>
- <li><a href="bow?action=home">Home</a></li>
- <li><a 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+'|');var%20link='<%=url%>bow?action=addUrl&token=<%=temporaryToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);void(0);">Temporary token</a></li>
- <li><a 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+'|');var%20link='<%=url%>bow?action=addUrl&token=<%=permanentToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);void(0);">Current permanent token</a></li>
- <li><a href="bow?action=generateToken&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">Regenerate permanent token</a></li>
- </ul>
+ <div class="menu">
+ <form method="POST" action="bow?action=addUrl&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ URL<br />
+ <input type="text" name="url" size="20" value="URL" /><br />
+ Name<br />
+ <input type="text" name="name" size="20" value="name" /><br />
+ Tags<br />
+ <input type="text" name="tags" size="20" value="tag1 tag2..." /><br />
+ <input type="submit" value="add" />
+ </form>
+ </div>
+
+ <div class="menu">
+ <div class="tagCloud">
+ <% if (bookmarkActions != null) {
+ List<FacetTopic> tagCloud = bookmarkActions.getTagsCloud();
+ for (FacetTopic tag : tagCloud) {
+ int value = tag.getCount();
+ String tagName = tag.getTopicName();
+ int font = bookmarkActions.getFont(value);
+ %>
+ <a href="bow?action=search&addTag=<%=tagName%>&searchLine=<%=searchLine%>" title="<%=value%> results" class="tag" style="font-size: <%=font%>px;"><%=tagName%></a>
+ <%
+ }
+ }
+ %>
+ <form method="POST" action="bow?action=search" style="text-align: center;margin-left: 20px;">
+ <input style="float: left" type="text" name="searchLine" size="15" value="<%=searchLine%>" />
+ <input style="float: left" type="submit" value="Find" />
+ </form>
</div>
<div class="menu">
- <form method="POST" action="bow?action=addUrl&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
- URL<br />
- <input type="text" name="url" size="20" value="URL" /><br />
- Name<br />
- <input type="text" name="name" size="20" value="name" /><br />
- Tags<br />
- <input type="text" name="tags" size="20" value="tag1 tag2..." /><br />
- <input type="submit" value="add" />
+ <form method="POST" action="bow?action=fullText" style="text-align: center;">
+ Full text research
+ <input style="float: left" type="text" name="fullTextLine" size="15" value="<%=bookmarkActions.getFullTextLine()%>" />
+ <input style="float: left;" type="submit" value="Find" />
</form>
</div>
-
<div class="menu">
- <div class="tagCloud">
- <% if (bookmarkActions != null) {
- List<FacetTopic> tagCloud = bookmarkActions.getTagsCloud();
- for (FacetTopic tag : tagCloud) {
- int value = tag.getCount();
- String tagName = tag.getTopicName();
- int font = bookmarkActions.getFont(value);
- %>
- <a href="bow?action=search&addTag=<%=tagName%>&searchLine=<%=searchLine%>" title="<%=value%> results" class="tag" style="font-size: <%=font%>px;"><%=tagName%></a>
- <%
- }
- }
- %>
- <form method="POST" action="bow?action=search" style="text-align: center;margin-left: 20px;">
- <input style="float: left" type="text" name="searchLine" size="15" value="<%=searchLine%>" />
- <input style="float: left" type="submit" value="Find" />
- </form>
- </div>
- <div class="menu">
- <form method="POST" action="bow?action=fullText" style="text-align: center;">
- Full text research
- <input style="float: left" type="text" name="fullTextLine" size="15" value="<%=bookmarkActions.getFullTextLine()%>" />
- <input style="float: left;" type="submit" value="Find" />
- </form>
- </div>
- <div class="menu">
- <form method="post" action="bow?action=importBookmarks&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>" enctype="multipart/form-data">
- Import Bookmarks
- <input type="file" name="upfile" />
- <input type="submit" value="Import"/>
- </form>
- <br />
- <a href="bow?action=exportBookmarks&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">Export bookmarks</a>
- </div>
+ <form method="post" action="bow?action=importBookmarks&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>" enctype="multipart/form-data">
+ Import Bookmarks
+ <input type="file" name="upfile" />
+ <input type="submit" value="Import"/>
+ </form>
+ <br />
+ <a href="bow?action=exportBookmarks&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">Export bookmarks</a>
</div>
</div>
- <div class="Index" id="footer">
- <a shape="rect" href="<%=url%>">bow</a>
- <a shape="rect" href="http://www.chorem.org/projects/list_files/bow"><%=version%></a> -
- <a shape="rect" href="http://www.gnu.org/licenses/agpl.html">Licence AGPL</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>
- </div>
- </body>
-</html>
+ </div>
+</body>
<%}%>
\ No newline at end of file
Modified: trunk/src/main/xmi/bow.zargo
===================================================================
(Binary files differ)
1
0
01 Jun '10
Author: bbrossaud
Date: 2010-06-01 16:15:25 +0200 (Tue, 01 Jun 2010)
New Revision: 56
Url: http://chorem.org/repositories/revision/bow/56
Log:
replace model by a singleton instance
Modified:
trunk/src/main/java/org/chorem/bow/AliasServlet.java
trunk/src/main/java/org/chorem/bow/BookmarkActions.java
trunk/src/main/java/org/chorem/bow/BowProxy.java
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
trunk/src/main/webapp/search.jsp
Modified: trunk/src/main/java/org/chorem/bow/AliasServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/AliasServlet.java 2010-06-01 13:39:30 UTC (rev 55)
+++ trunk/src/main/java/org/chorem/bow/AliasServlet.java 2010-06-01 14:15:25 UTC (rev 56)
@@ -20,7 +20,6 @@
*/
public class AliasServlet extends HttpServlet {
- protected Model model = new Model();
protected String bowUrl = "";
public AliasServlet() throws ArgumentsParserException {
@@ -48,7 +47,7 @@
String alias = url.substring(index);
if (alias != null && !alias.isEmpty()) {
alias = alias.substring(1);
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_ALIAS, alias).criteria();
Bookmark bookmark = proxy.findByCriteria(Bookmark.class, criteria);
if (bookmark != null) {
Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-01 13:39:30 UTC (rev 55)
+++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-01 14:15:25 UTC (rev 56)
@@ -105,7 +105,7 @@
/* @param url String which contains the bookmark url
* @param nameAndTags String which contains the name and the tags of the
- bookmark separated by '|' ==> name|tag1 tag2...
+ * bookmark separated by '|' ==> name|tag1 tag2...
* @param user bookmark user
* @return null if all fields are not correctly filled
* @return Bookmark the website bookmark
@@ -155,7 +155,7 @@
if (!tagList.contains(tagsTab[i]) && !tagsTab[i].isEmpty()) {
bookmark.addTags(tagsTab[i]); // Added tag for each rank (one tag by rank)
}
- } else if (!tagsTab[i].isEmpty()){
+ } else if (!tagsTab[i].isEmpty()) {
bookmark.addTags(tagsTab[i]);
}
}
@@ -165,7 +165,7 @@
public static void addTagsToBookmark(List<String> tagList, Bookmark bookmark) {
if (tagList != null && !tagList.isEmpty()) {
for (String tag : tagList) {
- addTagsToBookmark(tag, bookmark);
+ addTagsToBookmark(tag, bookmark);
}
}
}
Modified: trunk/src/main/java/org/chorem/bow/BowProxy.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BowProxy.java 2010-06-01 13:39:30 UTC (rev 55)
+++ trunk/src/main/java/org/chorem/bow/BowProxy.java 2010-06-01 14:15:25 UTC (rev 56)
@@ -23,6 +23,7 @@
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.WikittyService;
//import org.nuiton.wikitty.WikittyServiceCached;
+import org.nuiton.wikitty.WikittyServiceCached;
import org.nuiton.wikitty.jdbc.WikittyServiceJDBC;
/**
@@ -52,7 +53,7 @@
protected BowProxy(BowConfig config) {
WikittyService ws = new WikittyServiceJDBC(config.getFlatOptions());
// FIXME activate next line, when new wikitty version released ans tested
-// ws = new WikittyServiceCached(ws);
+ ws = new WikittyServiceCached(ws);
setWikittyService(ws);
}
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 13:39:30 UTC (rev 55)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 14:15:25 UTC (rev 56)
@@ -12,10 +12,8 @@
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
@@ -47,7 +45,6 @@
public class ControllerServlet extends HttpServlet {
private static final Log log = LogFactory.getLog(ControllerServlet.class);
- protected Model model = new Model();
protected String version = "";
protected String url = "";
@@ -236,7 +233,7 @@
if (searchLine != null && searchLine.matches("^http://[^ ]*") && !searchLine.contains(" ")) {
response.sendRedirect(searchLine);
} else {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine);
criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
PagedResult result = proxy.findAllByCriteria(Bookmark.class, criteria);
@@ -253,7 +250,7 @@
String search = request.getParameter("search");
if (search != null) {
OpenSearchActions openSearchActions = new OpenSearchActions();
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
String[] words = search.split("\\s+");
List<String> searchLine = new ArrayList<String>(Arrays.asList(words));
if (search.charAt(search.length() - 1) == ' ') {
@@ -286,7 +283,7 @@
throws IOException, ServletException {
String bookmarkId = request.getParameter("bookmarkId");
if (bookmarkId != null && !bookmarkId.isEmpty()) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Bookmark bookmark = proxy.restore(Bookmark.class, bookmarkId);
if (bookmark != null) {
int click = bookmark.getClick();
@@ -305,7 +302,7 @@
String searchLine = request.getParameter("searchLine");
Criteria baseCriteria = getBookmarkListCriteriaByUser(user, searchLine);
if (type != null && baseCriteria != null && !type.isEmpty()) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
PagedResult result = null;
if (type.equals("name")) {
Criteria criteria = baseCriteria.addSortAscending(Bookmark.FQ_FIELD_DESCRIPTION);
@@ -328,7 +325,7 @@
String type = request.getParameter("type");
Criteria baseCriteria = getBookmarkListCriteriaByUser(user, searchLine);
if (type != null && baseCriteria != null && !type.isEmpty()) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
PagedResult result = null;
if (type.equals("name")) {
Criteria criteria = baseCriteria.addSortDescending(Bookmark.FQ_FIELD_DESCRIPTION);
@@ -351,7 +348,7 @@
String name = request.getParameter("name");
String bookmarkId = request.getParameter("bookmarkId");
if (bookmarkId != null && !bookmarkId.isEmpty()) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Bookmark bookmark = proxy.restore(Bookmark.class, bookmarkId);
if (bookmark != null) {
BookmarkActions.updateBookmarkName(bookmark, name);
@@ -366,7 +363,7 @@
throws IOException, ServletException {
String bookmarkId = request.getParameter("bookmarkId");
if (bookmarkId != null && !bookmarkId.isEmpty()) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Bookmark bookmark = proxy.restore(Bookmark.class, bookmarkId);
if (bookmark != null) {
proxy.delete(bookmarkId);
@@ -381,7 +378,7 @@
String tag = request.getParameter("deleteTag");
if (tag != null && bookmarkId != null) {
if (!bookmarkId.isEmpty()) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Bookmark bookmark = proxy.restore(Bookmark.class, bookmarkId);
if (bookmark != null) {
bookmark.removeTags(tag);
@@ -400,7 +397,7 @@
protected void actionGenerateToken(HttpServletRequest request, HttpServletResponse response, User user, HttpSession session)
throws IOException, ServletException, NoSuchAlgorithmException {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, user.getEmail()).criteria();
Token currentToken = proxy.findByCriteria(Token.class, criteria);
if (currentToken != null) {
@@ -445,7 +442,7 @@
bookmark = BookmarkActions.createBookmark(link, nameAndTags, user);
}
if (bookmark != null) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
proxy.store(bookmark); // store the bookmark if all is Ok
if (log.isDebugEnabled()) {
log.debug("Adding URL");
@@ -468,7 +465,7 @@
*/
protected User checkPermanentToken(String token) {
if (token != null) {
- WikittyProxy proxy = model.getProxy();
+ 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
@@ -508,7 +505,7 @@
searchLine += " " + tag;
}
}
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine);
criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
PagedResult result = proxy.findAllByCriteria(Bookmark.class, criteria); // select all bookmarks by user
@@ -550,7 +547,7 @@
request.setAttribute("msgError", error);
request.getRequestDispatcher("register.jsp").forward(request, response);
} else {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
UserImpl newUser = new UserImpl();
newUser.setPassword(request.getParameter("password"));
newUser.setEmail(request.getParameter("email"));
@@ -591,7 +588,7 @@
protected void initializeToken(HttpSession session, User login)
throws NoSuchAlgorithmException {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, login.getEmail()).criteria();
Token token = proxy.findByCriteria(Token.class, criteria);
TokenActions tokenActions = new TokenActions();
@@ -617,7 +614,7 @@
protected User checkLogin(String email, String password) {
if (email != null && password != null) {
if (!email.isEmpty() && !password.isEmpty()) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, email).
eq(User.FQ_FIELD_PASSWORD, password).criteria();
@@ -635,7 +632,7 @@
protected boolean checkRegister(String email, String password) {
if (email != null && password != null) {
if (!email.isEmpty() && !password.isEmpty()) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, email).criteria(); // retrieve user by user name (email)
if (proxy.findByCriteria(User.class, criteria) == null) {
@@ -647,7 +644,7 @@
}
protected void actionHome(HttpServletRequest request, User user) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = getBookmarkListCriteriaByUser(user, null);
if (criteria != null) {
Criteria sortCriteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
@@ -683,7 +680,7 @@
while (iter.hasNext()) {
FileItem item = (FileItem) iter.next();
if (!item.isFormField()) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
String content = item.getString();
Parser parser = new Parser(content);
NodeList list = parser.parse(null);
@@ -733,7 +730,7 @@
protected void actionExportBookmarks(HttpServletResponse response, User user)
throws IOException {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria();
List<Bookmark> bookmarks = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
String export = BookmarkActions.getExportHtmlBookmark(bookmarks);
@@ -751,7 +748,7 @@
throws IOException {
String alias = request.getParameter("alias");
if (alias != null && !alias.isEmpty()) {
- WikittyProxy proxy = model.getProxy();
+ 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()) {
@@ -769,7 +766,7 @@
}
protected void actionFullText(HttpServletRequest request, User user) {
- WikittyProxy proxy = model.getProxy();
+ WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = getBookmarkListCriteriaByUser(user, null);
PagedResult result = proxy.findAllByCriteria(Bookmark.class, criteria);
BookmarkActions bookmarkActions = createBookmarkActions(request, result, null);
Modified: trunk/src/main/webapp/search.jsp
===================================================================
--- trunk/src/main/webapp/search.jsp 2010-06-01 13:39:30 UTC (rev 55)
+++ trunk/src/main/webapp/search.jsp 2010-06-01 14:15:25 UTC (rev 56)
@@ -24,6 +24,7 @@
%>
<html>
+ <head>
<link rel="stylesheet" type="text/css" href="./css/styles.css" />
<link rel="search" type="application/opensearchdescription+xml" title="bowTemporarySearchEngine" href="<%=url%>bow?action=temporaryXml" />
<link rel="search" type="application/opensearchdescription+xml" title="bowPermanentSearchEngine" href="<%=url%>bow?action=permanentXml" />
1
0
Author: bpoussin
Date: 2010-06-01 15:39:30 +0200 (Tue, 01 Jun 2010)
New Revision: 55
Url: http://chorem.org/repositories/revision/bow/55
Log:
ajout d'un proxy specifique bow (il faut modifier le pom pour prendre la prochaine release wikitty qui ne devrait pas tarder)
Added:
trunk/src/main/java/org/chorem/bow/BowProxy.java
Added: trunk/src/main/java/org/chorem/bow/BowProxy.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BowProxy.java (rev 0)
+++ trunk/src/main/java/org/chorem/bow/BowProxy.java 2010-06-01 13:39:30 UTC (rev 55)
@@ -0,0 +1,60 @@
+/* *##%
+ * Copyright (c) 2010 poussin. All rights reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *##%*/
+
+package org.chorem.bow;
+
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.WikittyService;
+//import org.nuiton.wikitty.WikittyServiceCached;
+import org.nuiton.wikitty.jdbc.WikittyServiceJDBC;
+
+/**
+ * Proxy pour utiliser les wikitty convenablement initialise.
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class BowProxy extends WikittyProxy {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(BowProxy.class);
+
+ static protected BowProxy instance;
+
+ synchronized static public BowProxy getInstance() {
+ if (instance == null) {
+ BowConfig config = BowConfig.getInstance();
+ instance = new BowProxy(config);
+ }
+ return instance;
+ }
+
+ protected BowProxy(BowConfig config) {
+ WikittyService ws = new WikittyServiceJDBC(config.getFlatOptions());
+ // FIXME activate next line, when new wikitty version released ans tested
+// ws = new WikittyServiceCached(ws);
+ setWikittyService(ws);
+ }
+
+
+}
1
0
Author: bbrossaud
Date: 2010-06-01 15:24:46 +0200 (Tue, 01 Jun 2010)
New Revision: 54
Url: http://chorem.org/repositories/revision/bow/54
Log:
remove debugs
Modified:
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 13:24:13 UTC (rev 53)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 13:24:46 UTC (rev 54)
@@ -706,7 +706,6 @@
String plainText = node.toPlainTextString();
String text = node.getText();
if (text != null && text.startsWith("H3")) {
- log.debug(text);
if (plainText != null && !plainText.isEmpty()) {
tagList.add(plainText);
isFolder = true;
1
0
01 Jun '10
Author: bbrossaud
Date: 2010-06-01 15:24:13 +0200 (Tue, 01 Jun 2010)
New Revision: 53
Url: http://chorem.org/repositories/revision/bow/53
Log:
retrieve tagCloud thanks to facets
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-01 10:55:42 UTC (rev 52)
+++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-01 13:24:13 UTC (rev 53)
@@ -5,16 +5,14 @@
package org.chorem.bow;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Date;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.nuiton.util.StringUtil;
+import org.nuiton.wikitty.FacetTopic;
/**
*
@@ -25,8 +23,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 Map<String, Integer> tagCloud = new HashMap<String, Integer>(); // associate a tag with its frequency
- // among all bookmarks
+ protected List<FacetTopic> tagCloud = 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;
@@ -249,12 +246,28 @@
}
}
- public void createTagCloud() {
- tagCloud.clear();
- createTagClougByBookmarks();
+ public void createTagCloud(List<FacetTopic> cpy) {
+ setTagCloud(cpy);
+ deleteTagBySearch();
defineTValues();
}
+ public void setTagCloud(List<FacetTopic> cpy) {
+ if (cpy != null) {
+ tagCloud = new ArrayList<FacetTopic>(cpy);
+ }
+ }
+
+ public void deleteTagBySearch() {
+ List<FacetTopic> save = new ArrayList<FacetTopic>(tagCloud);
+ for (FacetTopic topic : save) {
+ String name = topic.getTopicName();
+ if (tagsSearch.contains(name)) {
+ tagCloud.remove(topic);
+ }
+ }
+ }
+
public void deleteBookmarkBySearch() {
List<Bookmark> bookmarksList = new ArrayList<Bookmark>(bookmarks);
for (Bookmark bookmark : bookmarksList) {
@@ -276,42 +289,11 @@
}
}
- public void createTagClougByBookmarks() {
- List<Bookmark> bookmarksList = new ArrayList<Bookmark>(bookmarks);
- for (Bookmark bookmark : bookmarksList) {
- addBookmarkTagsToTagCloud(bookmark);
- }
- }
-
-
- /* @param bookmark user bookmark
- * @return void
- */
- protected void addBookmarkTagsToTagCloud(Bookmark bookmark) {
- Set<String> tags = bookmark.getTags(); // bookmark tags
- if (tags != null && !tags.isEmpty()) {
- for (String tag : tags) {
- if (!tagsSearch.contains(tag)) { // the tags cloud mustn't contained the tags taped in the search field
- if (tagCloud.containsKey(tag)) { // check if it contains the tag
- Integer count = tagCloud.get(tag);
- ++count;
- tagCloud.put(tag, count);
- } else {
- tagCloud.put(tag, 1);
- }
- }
- }
- }
- }
-
protected void defineTValues() {
- Collection values = tagCloud.values();
- Iterator it = values.iterator();
tmax = -1; // correspond to the most tag frequency in the tag cloud
tmin = -1; // correspond to the less tag frequency in the tag cloud
- int value;
- while (it.hasNext()) {
- value = (Integer) it.next();
+ for (FacetTopic tag : tagCloud) {
+ int value = tag.getCount();
if (tmax < value) { // search the most tag frequancy
tmax = value;
}
@@ -386,7 +368,7 @@
return font;
}
- public Map<String, Integer> getTagsCloud() {
+ public List<FacetTopic> getTagsCloud() {
return tagCloud;
}
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 10:55:42 UTC (rev 52)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 13:24:13 UTC (rev 53)
@@ -12,8 +12,10 @@
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
@@ -33,6 +35,8 @@
import org.htmlparser.util.SimpleNodeIterator;
import org.nuiton.util.ArgumentsParserException;
import org.nuiton.wikitty.Criteria;
+import org.nuiton.wikitty.FacetTopic;
+import org.nuiton.wikitty.PagedResult;
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.search.Search;
@@ -235,8 +239,8 @@
WikittyProxy proxy = model.getProxy();
Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine);
criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
- List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, searchLine);
+ PagedResult result = proxy.findAllByCriteria(Bookmark.class, criteria);
+ BookmarkActions bookmarkActions = createBookmarkActions(request, result, searchLine);
request.setAttribute("bookmarkActions", bookmarkActions);
request.setAttribute("token", token);
request.getRequestDispatcher("openSearchResult.jsp").forward(request, response);
@@ -302,18 +306,18 @@
Criteria baseCriteria = getBookmarkListCriteriaByUser(user, searchLine);
if (type != null && baseCriteria != null && !type.isEmpty()) {
WikittyProxy proxy = model.getProxy();
- List<Bookmark> bookList = null;
+ PagedResult result = null;
if (type.equals("name")) {
Criteria criteria = baseCriteria.addSortAscending(Bookmark.FQ_FIELD_DESCRIPTION);
- bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
+ result = proxy.findAllByCriteria(Bookmark.class, criteria);
} else if (type.equals("date")) {
Criteria criteria = baseCriteria.addSortAscending(Bookmark.FQ_FIELD_DATE);
- bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
+ result = proxy.findAllByCriteria(Bookmark.class, criteria);
} else if (type.equals("click")) {
Criteria criteria = baseCriteria.addSortAscending(Bookmark.FQ_FIELD_CLICK);
- bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
+ result = proxy.findAllByCriteria(Bookmark.class, criteria);
}
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, searchLine);
+ BookmarkActions bookmarkActions = createBookmarkActions(request, result, searchLine);
request.setAttribute("bookmarkActions", bookmarkActions);
}
}
@@ -325,18 +329,18 @@
Criteria baseCriteria = getBookmarkListCriteriaByUser(user, searchLine);
if (type != null && baseCriteria != null && !type.isEmpty()) {
WikittyProxy proxy = model.getProxy();
- List<Bookmark> bookList = null;
+ PagedResult result = null;
if (type.equals("name")) {
Criteria criteria = baseCriteria.addSortDescending(Bookmark.FQ_FIELD_DESCRIPTION);
- bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
+ result = proxy.findAllByCriteria(Bookmark.class, criteria);
} else if (type.equals("date")) {
Criteria criteria = baseCriteria.addSortDescending(Bookmark.FQ_FIELD_DATE);
- bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
+ result = proxy.findAllByCriteria(Bookmark.class, criteria);
} else if (type.equals("click")) {
Criteria criteria = baseCriteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
- bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
+ result = proxy.findAllByCriteria(Bookmark.class, criteria);
}
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, searchLine);
+ BookmarkActions bookmarkActions = createBookmarkActions(request, result, searchLine);
request.setAttribute("bookmarkActions", bookmarkActions);
}
}
@@ -507,29 +511,29 @@
WikittyProxy proxy = model.getProxy();
Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine);
criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
- List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll(); // select all bookmarks by user
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, searchLine);
+ PagedResult result = proxy.findAllByCriteria(Bookmark.class, criteria); // select all bookmarks by user
+ BookmarkActions bookmarkActions = createBookmarkActions(request, result, searchLine);
request.setAttribute("bookmarkActions", bookmarkActions);
}
- protected BookmarkActions createBookmarkActions(HttpServletRequest request, List<Bookmark> bookList, String searchLine) {
+ protected BookmarkActions createBookmarkActions(HttpServletRequest request, PagedResult result, String searchLine) {
String fullText = request.getParameter("fullTextLine");
BookmarkActions bookmarkActions = new BookmarkActions();
+ List<Bookmark> bookList = result.getAll();
if (bookList != null) {
bookmarkActions.setBookmarks(bookList);
}
if (fullText != null && !fullText.isEmpty()) {
bookmarkActions.fullText(fullText);
- bookmarkActions.createTagClougByBookmarks();
- bookmarkActions.defineTValues();
} else {
if (searchLine != null && searchLine.isEmpty()) {
bookmarkActions.emptySearchline();
} else {
bookmarkActions.addTags(searchLine); // add the new tags
}
- bookmarkActions.createTagCloud(); // create the tags cloud with the new informations
}
+ List<FacetTopic> topics = result.getTopic(Bookmark.FQ_FIELD_TAGS);
+ bookmarkActions.createTagCloud(topics);
return bookmarkActions;
}
@@ -647,11 +651,11 @@
Criteria criteria = getBookmarkListCriteriaByUser(user, null);
if (criteria != null) {
Criteria sortCriteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
- List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, sortCriteria).getAll(); // select all bookmarks by user
+ PagedResult result = proxy.findAllByCriteria(Bookmark.class, sortCriteria); // select all bookmarks by user
sortCriteria = criteria.addSortDescending(Bookmark.FQ_FIELD_DATE).setEndIndex(10);
List<Bookmark> lastBookmarks = proxy.findAllByCriteria(Bookmark.class, sortCriteria).getAll();
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, null);
- bookList = bookmarkActions.getBookmarks();
+ BookmarkActions bookmarkActions = createBookmarkActions(request, result, null);
+ List<Bookmark> bookList = bookmarkActions.getBookmarks();
if (bookList.size() > 10) {
bookList = bookmarkActions.getBookmarks().subList(0, 10);
bookmarkActions.setBookmarks(bookList);
@@ -767,9 +771,9 @@
protected void actionFullText(HttpServletRequest request, User user) {
WikittyProxy proxy = model.getProxy();
- Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria();
- List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, null);
+ Criteria criteria = getBookmarkListCriteriaByUser(user, null);
+ PagedResult result = proxy.findAllByCriteria(Bookmark.class, criteria);
+ BookmarkActions bookmarkActions = createBookmarkActions(request, result, null);
request.setAttribute("bookmarkActions", bookmarkActions);
}
@@ -793,10 +797,11 @@
if (searchLine != null && !searchLine.isEmpty()) {
String[] words = searchLine.split("\\s+"); // put the tags in an array
List<String> tags = new ArrayList<String>(Arrays.asList(words));
- log.debug(tags.size());
- criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).eq(Bookmark.FQ_FIELD_TAGS, tags).criteria();
+ criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).
+ eq(Bookmark.FQ_FIELD_TAGS, tags).criteria().addFacetField(Bookmark.FQ_FIELD_TAGS);
} else {
- criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria();
+ criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).
+ criteria().addFacetField(Bookmark.FQ_FIELD_TAGS);
}
}
return criteria;
Modified: trunk/src/main/webapp/home.jsp
===================================================================
--- trunk/src/main/webapp/home.jsp 2010-06-01 10:55:42 UTC (rev 52)
+++ trunk/src/main/webapp/home.jsp 2010-06-01 13:24:13 UTC (rev 53)
@@ -9,6 +9,7 @@
<%@page import="java.util.ArrayList" %>
<%@page import="java.util.List" %>
<%@page import="org.chorem.bow.TokenActions" %>
+<%@page import="org.nuiton.wikitty.FacetTopic" %>
<%
TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions");
@@ -227,13 +228,13 @@
<div class="menu">
<div class="tagCloud">
<% if (bookmarkActions != null) {
- Map<String, Integer> tagsCloud = bookmarkActions.getTagsCloud();
- Set<String> tags = tagsCloud.keySet();
- for (String tag : tags) {
- int value = tagsCloud.get(tag);
+ List<FacetTopic> tagCloud = bookmarkActions.getTagsCloud();
+ for (FacetTopic tag : tagCloud) {
+ int value = tag.getCount();
+ String tagName = tag.getTopicName();
int font = bookmarkActions.getFont(value);
%>
- <a href="bow?action=search&addTag=<%=tag%>" title="<%=value%> results" class="tag" style="font-size: <%=font%>px;"><%=tag%></a>
+ <a href="bow?action=search&addTag=<%=tagName%>" title="<%=value%> results" class="tag" style="font-size: <%=font%>px;"><%=tagName%></a>
<%
}
}
Modified: trunk/src/main/webapp/search.jsp
===================================================================
--- trunk/src/main/webapp/search.jsp 2010-06-01 10:55:42 UTC (rev 52)
+++ trunk/src/main/webapp/search.jsp 2010-06-01 13:24:13 UTC (rev 53)
@@ -9,6 +9,7 @@
<%@page import="java.util.ArrayList" %>
<%@page import="java.util.List" %>
<%@page import="org.chorem.bow.TokenActions" %>
+<%@page import="org.nuiton.wikitty.FacetTopic" %>
<%
TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions");
@@ -161,13 +162,13 @@
<div class="menu">
<div class="tagCloud">
<% if (bookmarkActions != null) {
- Map<String, Integer> tagsCloud = bookmarkActions.getTagsCloud();
- Set<String> tags = tagsCloud.keySet();
- for (String tag : tags) {
- int value = tagsCloud.get(tag);
+ List<FacetTopic> tagCloud = bookmarkActions.getTagsCloud();
+ for (FacetTopic tag : tagCloud) {
+ int value = tag.getCount();
+ String tagName = tag.getTopicName();
int font = bookmarkActions.getFont(value);
%>
- <a href="bow?action=search&addTag=<%=tag%>&searchLine=<%=searchLine%>" title="<%=value%> results" class="tag" style="font-size: <%=font%>px;"><%=tag%></a>
+ <a href="bow?action=search&addTag=<%=tagName%>&searchLine=<%=searchLine%>" title="<%=value%> results" class="tag" style="font-size: <%=font%>px;"><%=tagName%></a>
<%
}
}
1
0
Author: bpoussin
Date: 2010-06-01 12:55:42 +0200 (Tue, 01 Jun 2010)
New Revision: 52
Url: http://chorem.org/repositories/revision/bow/52
Log:
suppression d'imports non utilises
Modified:
trunk/src/main/java/org/chorem/bow/AliasServlet.java
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
Modified: trunk/src/main/java/org/chorem/bow/AliasServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/AliasServlet.java 2010-06-01 10:54:42 UTC (rev 51)
+++ trunk/src/main/java/org/chorem/bow/AliasServlet.java 2010-06-01 10:55:42 UTC (rev 52)
@@ -9,7 +9,6 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.ArgumentsParserException;
import org.nuiton.wikitty.Criteria;
import org.nuiton.wikitty.WikittyProxy;
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 10:54:42 UTC (rev 51)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 10:55:42 UTC (rev 52)
@@ -31,7 +31,6 @@
import org.htmlparser.util.NodeList;
import org.htmlparser.util.ParserException;
import org.htmlparser.util.SimpleNodeIterator;
-import org.nuiton.util.ApplicationConfig;
import org.nuiton.util.ArgumentsParserException;
import org.nuiton.wikitty.Criteria;
import org.nuiton.wikitty.WikittyProxy;
1
0
Author: bpoussin
Date: 2010-06-01 12:54:42 +0200 (Tue, 01 Jun 2010)
New Revision: 51
Url: http://chorem.org/repositories/revision/bow/51
Log:
modification de la configuration (creation d'une vrai classe de config, multi-thread enable)
Added:
trunk/src/main/java/org/chorem/bow/BowConfig.java
Modified:
trunk/src/main/java/org/chorem/bow/AliasServlet.java
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
Modified: trunk/src/main/java/org/chorem/bow/AliasServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/AliasServlet.java 2010-06-01 10:02:53 UTC (rev 50)
+++ trunk/src/main/java/org/chorem/bow/AliasServlet.java 2010-06-01 10:54:42 UTC (rev 51)
@@ -25,10 +25,8 @@
protected String bowUrl = "";
public AliasServlet() throws ArgumentsParserException {
- ApplicationConfig config = new ApplicationConfig();
- config.setConfigFileName("bow.properties");
- config.parse(new String[]{});
- bowUrl = config.getOption("bow.url");
+ BowConfig config = BowConfig.getInstance();
+ bowUrl = config.getBowUrl();
}
@Override
Added: trunk/src/main/java/org/chorem/bow/BowConfig.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BowConfig.java (rev 0)
+++ trunk/src/main/java/org/chorem/bow/BowConfig.java 2010-06-01 10:54:42 UTC (rev 51)
@@ -0,0 +1,140 @@
+/* *##%
+ * Copyright (c) 2010 poussin. All rights reserved.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *##%*/
+
+package org.chorem.bow;
+
+import static org.nuiton.i18n.I18n._;
+
+import java.io.File;
+import org.apache.commons.lang.UnhandledException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.nuiton.util.ApplicationConfig;
+
+/**
+ *
+ * @author poussin
+ * @version $Revision$
+ *
+ * Last update: $Date$
+ * by : $Author$
+ */
+public class BowConfig extends ApplicationConfig {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(BowConfig.class);
+
+ /** Singleton instance. */
+ protected static BowConfig instance = null;
+
+ public BowConfig() {
+ super();
+
+ // set default option (included configuration file name : important)
+ for (Option o : Option.values()) {
+ if (o.defaultValue != null) {
+ setDefaultOption(o.key, o.defaultValue);
+ }
+ }
+ }
+
+ public static synchronized BowConfig getInstance() {
+ if (instance == null) {
+ try {
+ instance = new BowConfig();
+ instance.parse(new String[]{});
+ instance.setDataDirInSystemProps();
+ } catch (Exception e) {
+ throw new UnhandledException(e);
+ }
+ }
+ return instance;
+ }
+
+ /**
+ * Get version as string.
+ *
+ * @return version
+ */
+ public String getVersion() {
+ return getOption(Option.APPLICATION_VERSION.key);
+ }
+
+ /**
+ * Get bow url as string.
+ *
+ * @return url
+ */
+ public String getBowUrl() {
+ return getOption(Option.BOW_URL.key);
+ }
+
+ public File getDataDirAsFile() {
+ File option = getOptionAsFile(Option.DATA_DIR.key);
+ return option;
+ }
+
+ /**
+ * Set {@code solr} and {@code jms} system configuration.
+ *
+ * This is the "only" way to configure embedded solr.
+ */
+ protected void setDataDirInSystemProps() {
+ String value = System.getProperty(Option.DATA_DIR.key, null);
+ if (value == null) {
+ value = getOption(Option.DATA_DIR.key);
+ if (log.isInfoEnabled()) {
+ log.info("Setting system property " + Option.DATA_DIR.key + " : " + value);
+ }
+ System.setProperty(Option.DATA_DIR.key, value);
+ env.put(Option.DATA_DIR.key, value);
+ }
+ }
+
+ /**
+ * Vradi option definition.
+ */
+ public static enum Option {
+
+ CONFIG_FILE(CONFIG_FILE_NAME, _("bow.config.configFileName.description"),
+ "bow.properties", String.class, false, false),
+ APPLICATION_VERSION("application.version", _("bow.config.application.version.description"),
+ null, String.class, true, true),
+ BOW_URL("bow.url", _("bow.config.bow.url.description"),
+ null, String.class, false, false),
+ DATA_DIR("solr.data.dir", _("bow.config.data.dir.description"),
+ System.getProperty("user.home") + "/.bow/solr", String.class, false, false);
+
+ public final String key;
+ public final String description;
+ public final String defaultValue;
+ public final Class<?> type;
+ public final boolean isTransient;
+ public final boolean isFinal;
+
+ private Option(String key, String description, String defaultValue,
+ Class<?> type, boolean isTransient, boolean isFinal) {
+ this.key = key;
+ this.description = description;
+ this.defaultValue = defaultValue;
+ this.type = type;
+ this.isFinal = isFinal;
+ this.isTransient = isTransient;
+ }
+ }
+
+}
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 10:02:53 UTC (rev 50)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 10:54:42 UTC (rev 51)
@@ -49,11 +49,9 @@
protected String url = "";
public ControllerServlet() throws ArgumentsParserException, Exception {
- ApplicationConfig config = new ApplicationConfig();
- config.setConfigFileName("bow.properties");
- config.parse(new String[]{});
- version = config.getOption("application.version");
- url = config.getOption("bow.url");
+ BowConfig config = BowConfig.getInstance();
+ version = config.getVersion();
+ url = config.getBowUrl();
if (url == null) {
throw new Exception("No bow.url=\"SERVER URL\" in bow.properties");
}
1
0
Author: bbrossaud
Date: 2010-06-01 12:02:53 +0200 (Tue, 01 Jun 2010)
New Revision: 50
Url: http://chorem.org/repositories/revision/bow/50
Log:
retrieve bookmarks by research thanks to criteria
Modified:
trunk/src/main/java/org/chorem/bow/BookmarkActions.java
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-01 09:02:01 UTC (rev 49)
+++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-01 10:02:53 UTC (rev 50)
@@ -251,7 +251,6 @@
public void createTagCloud() {
tagCloud.clear();
- //deleteBookmarkBySearch();
createTagClougByBookmarks();
defineTValues();
}
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 09:02:01 UTC (rev 49)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 10:02:53 UTC (rev 50)
@@ -239,7 +239,7 @@
Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine);
criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
+ BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, searchLine);
request.setAttribute("bookmarkActions", bookmarkActions);
request.setAttribute("token", token);
request.getRequestDispatcher("openSearchResult.jsp").forward(request, response);
@@ -301,7 +301,7 @@
protected void actionOrderAsc(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
String type = request.getParameter("type");
- String searchLine = request.getParameter("searchline");
+ String searchLine = request.getParameter("searchLine");
Criteria baseCriteria = getBookmarkListCriteriaByUser(user, searchLine);
if (type != null && baseCriteria != null && !type.isEmpty()) {
WikittyProxy proxy = model.getProxy();
@@ -316,14 +316,14 @@
Criteria criteria = baseCriteria.addSortAscending(Bookmark.FQ_FIELD_CLICK);
bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
}
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
+ BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, searchLine);
request.setAttribute("bookmarkActions", bookmarkActions);
}
}
protected void actionOrderDesc(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
- String searchLine = request.getParameter("searchline");
+ String searchLine = request.getParameter("searchLine");
String type = request.getParameter("type");
Criteria baseCriteria = getBookmarkListCriteriaByUser(user, searchLine);
if (type != null && baseCriteria != null && !type.isEmpty()) {
@@ -339,7 +339,7 @@
Criteria criteria = baseCriteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
}
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
+ BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, searchLine);
request.setAttribute("bookmarkActions", bookmarkActions);
}
}
@@ -499,17 +499,24 @@
protected void actionSearch(HttpServletRequest request, User user)
throws IOException, ServletException {
String searchLine = request.getParameter("searchLine");
+ String tag = request.getParameter("addTag");
+ if (tag != null && !tag.isEmpty()) {
+ if (searchLine == null || searchLine.isEmpty()) {
+ searchLine = tag;
+ } else {
+ searchLine += " " + tag;
+ }
+ }
WikittyProxy proxy = model.getProxy();
Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine);
criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll(); // select all bookmarks by user
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
+ BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, searchLine);
request.setAttribute("bookmarkActions", bookmarkActions);
}
- protected BookmarkActions createBookmarkActions(HttpServletRequest request, List<Bookmark> bookList) {
+ protected BookmarkActions createBookmarkActions(HttpServletRequest request, List<Bookmark> bookList, String searchLine) {
String fullText = request.getParameter("fullTextLine");
- String searchLine = request.getParameter("searchLine"); // retrieve informations taping in the search field
BookmarkActions bookmarkActions = new BookmarkActions();
if (bookList != null) {
bookmarkActions.setBookmarks(bookList);
@@ -523,10 +530,6 @@
bookmarkActions.emptySearchline();
} else {
bookmarkActions.addTags(searchLine); // add the new tags
- String tag = request.getParameter("addTag");
- if (tag != null && !tag.isEmpty()) {
- bookmarkActions.addTag(tag);
- }
}
bookmarkActions.createTagCloud(); // create the tags cloud with the new informations
}
@@ -650,7 +653,7 @@
List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, sortCriteria).getAll(); // select all bookmarks by user
sortCriteria = criteria.addSortDescending(Bookmark.FQ_FIELD_DATE).setEndIndex(10);
List<Bookmark> lastBookmarks = proxy.findAllByCriteria(Bookmark.class, sortCriteria).getAll();
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
+ BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, null);
bookList = bookmarkActions.getBookmarks();
if (bookList.size() > 10) {
bookList = bookmarkActions.getBookmarks().subList(0, 10);
@@ -769,7 +772,7 @@
WikittyProxy proxy = model.getProxy();
Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria();
List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
+ BookmarkActions bookmarkActions = createBookmarkActions(request, bookList, null);
request.setAttribute("bookmarkActions", bookmarkActions);
}
@@ -787,16 +790,16 @@
}
}
- protected Criteria getBookmarkListCriteriaByUser(User user, String searchline) {
+ protected Criteria getBookmarkListCriteriaByUser(User user, String searchLine) {
Criteria criteria = null;
if (user != null) {
- if (searchline != null && !searchline.isEmpty()) {
- String[] words = searchline.split("\\s+"); // put the tags in an array
+ if (searchLine != null && !searchLine.isEmpty()) {
+ String[] words = searchLine.split("\\s+"); // put the tags in an array
List<String> tags = new ArrayList<String>(Arrays.asList(words));
- criteria = Search.query().eq(User.FQ_FIELD_EMAIL, user.getEmail()).
- contains(Bookmark.FQ_FIELD_TAGS, tags).criteria();
+ log.debug(tags.size());
+ criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).eq(Bookmark.FQ_FIELD_TAGS, tags).criteria();
} else {
- criteria = Search.query().eq(User.FQ_FIELD_EMAIL, user.getEmail()).criteria();
+ criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria();
}
}
return criteria;
1
0
Author: bbrossaud
Date: 2010-06-01 11:02:01 +0200 (Tue, 01 Jun 2010)
New Revision: 49
Url: http://chorem.org/repositories/revision/bow/49
Log:
fullText works now
Modified:
trunk/src/main/java/org/chorem/bow/BookmarkActions.java
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-01 07:59:09 UTC (rev 48)
+++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-01 09:02:01 UTC (rev 49)
@@ -154,11 +154,11 @@
String[] tagsTab = tags.split("\\s+"); // put the tags in an array
for (int i = 0; i < tagsTab.length; ++i) {
Set<String> tagList = bookmark.getTags();
- if (tagList != null) {
+ if (tagList != null && tagsTab[i] != null) {
if (!tagList.contains(tagsTab[i]) && !tagsTab[i].isEmpty()) {
bookmark.addTags(tagsTab[i]); // Added tag for each rank (one tag by rank)
}
- } else {
+ } else if (!tagsTab[i].isEmpty()){
bookmark.addTags(tagsTab[i]);
}
}
@@ -168,14 +168,7 @@
public static void addTagsToBookmark(List<String> tagList, Bookmark bookmark) {
if (tagList != null && !tagList.isEmpty()) {
for (String tag : tagList) {
- Set<String> bookmarTags = bookmark.getTags();
- if (bookmarTags != null) {
- if (!bookmarTags.contains(tag) && !tag.isEmpty()) {
- bookmark.addTags(tag); // Added tag for each rank (one tag by rank)
- }
- } else if (!tag.isEmpty()) {
- bookmark.addTags(tag);
- }
+ addTagsToBookmark(tag, bookmark);
}
}
}
@@ -258,7 +251,7 @@
public void createTagCloud() {
tagCloud.clear();
- deleteBookmarkBySearch();
+ //deleteBookmarkBySearch();
createTagClougByBookmarks();
defineTValues();
}
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 07:59:09 UTC (rev 48)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 09:02:01 UTC (rev 49)
@@ -236,8 +236,8 @@
response.sendRedirect(searchLine);
} else {
WikittyProxy proxy = model.getProxy();
- Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addSortDescending(Bookmark.FQ_FIELD_CLICK);
+ Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine);
+ criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
request.setAttribute("bookmarkActions", bookmarkActions);
@@ -301,23 +301,19 @@
protected void actionOrderAsc(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
String type = request.getParameter("type");
- if (type != null && !type.isEmpty()) {
+ String searchLine = request.getParameter("searchline");
+ Criteria baseCriteria = getBookmarkListCriteriaByUser(user, searchLine);
+ if (type != null && baseCriteria != null && !type.isEmpty()) {
WikittyProxy proxy = model.getProxy();
List<Bookmark> bookList = null;
if (type.equals("name")) {
- Criteria criteria = Search.query().
- eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addSortAscending(Bookmark.FQ_FIELD_DESCRIPTION);
+ Criteria criteria = baseCriteria.addSortAscending(Bookmark.FQ_FIELD_DESCRIPTION);
bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
} else if (type.equals("date")) {
- Criteria criteria = Search.query().
- eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addSortAscending(Bookmark.FQ_FIELD_DATE);
+ Criteria criteria = baseCriteria.addSortAscending(Bookmark.FQ_FIELD_DATE);
bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
} else if (type.equals("click")) {
- Criteria criteria = Search.query().
- eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addSortAscending(Bookmark.FQ_FIELD_CLICK);
+ Criteria criteria = baseCriteria.addSortAscending(Bookmark.FQ_FIELD_CLICK);
bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
}
BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
@@ -327,24 +323,20 @@
protected void actionOrderDesc(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
+ String searchLine = request.getParameter("searchline");
String type = request.getParameter("type");
- if (type != null && !type.isEmpty()) {
+ Criteria baseCriteria = getBookmarkListCriteriaByUser(user, searchLine);
+ if (type != null && baseCriteria != null && !type.isEmpty()) {
WikittyProxy proxy = model.getProxy();
List<Bookmark> bookList = null;
if (type.equals("name")) {
- Criteria criteria = Search.query().
- eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addSortDescending(Bookmark.FQ_FIELD_DESCRIPTION);
+ Criteria criteria = baseCriteria.addSortDescending(Bookmark.FQ_FIELD_DESCRIPTION);
bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
} else if (type.equals("date")) {
- Criteria criteria = Search.query().
- eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addSortDescending(Bookmark.FQ_FIELD_DATE);
+ Criteria criteria = baseCriteria.addSortDescending(Bookmark.FQ_FIELD_DATE);
bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
} else if (type.equals("click")) {
- Criteria criteria = Search.query().
- eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addSortDescending(Bookmark.FQ_FIELD_CLICK);
+ Criteria criteria = baseCriteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
}
BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
@@ -506,9 +498,10 @@
*/
protected void actionSearch(HttpServletRequest request, User user)
throws IOException, ServletException {
+ String searchLine = request.getParameter("searchLine");
WikittyProxy proxy = model.getProxy();
- Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addSortDescending(Bookmark.FQ_FIELD_CLICK);
+ Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine);
+ criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll(); // select all bookmarks by user
BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
request.setAttribute("bookmarkActions", bookmarkActions);
@@ -522,7 +515,6 @@
bookmarkActions.setBookmarks(bookList);
}
if (fullText != null && !fullText.isEmpty()) {
- log.debug("toto");
bookmarkActions.fullText(fullText);
bookmarkActions.createTagClougByBookmarks();
bookmarkActions.defineTValues();
@@ -652,22 +644,23 @@
protected void actionHome(HttpServletRequest request, User user) {
WikittyProxy proxy = model.getProxy();
- Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addSortDescending(Bookmark.FQ_FIELD_CLICK);
- List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll(); // select all bookmarks by user
- criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria().
- addSortDescending(Bookmark.FQ_FIELD_DATE).setEndIndex(10);
- List<Bookmark> lastBookmarks = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
- BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
- bookList = bookmarkActions.getBookmarks();
- if (bookList.size() > 10) {
- bookList = bookmarkActions.getBookmarks().subList(0, 10);
- bookmarkActions.setBookmarks(bookList);
+ Criteria criteria = getBookmarkListCriteriaByUser(user, null);
+ if (criteria != null) {
+ Criteria sortCriteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
+ List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, sortCriteria).getAll(); // select all bookmarks by user
+ sortCriteria = criteria.addSortDescending(Bookmark.FQ_FIELD_DATE).setEndIndex(10);
+ List<Bookmark> lastBookmarks = proxy.findAllByCriteria(Bookmark.class, sortCriteria).getAll();
+ BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
+ bookList = bookmarkActions.getBookmarks();
+ if (bookList.size() > 10) {
+ bookList = bookmarkActions.getBookmarks().subList(0, 10);
+ bookmarkActions.setBookmarks(bookList);
+ }
+ if (lastBookmarks != null) {
+ bookmarkActions.setLastBookmarks(lastBookmarks);
+ }
+ request.setAttribute("bookmarkActions", bookmarkActions);
}
- if (lastBookmarks != null) {
- bookmarkActions.setLastBookmarks(lastBookmarks);
- }
- request.setAttribute("bookmarkActions", bookmarkActions);
}
protected void actionImportBookmarks(HttpServletRequest request, HttpServletResponse response, User user)
@@ -793,4 +786,19 @@
response.sendRedirect("bow?action=home");
}
}
+
+ protected Criteria getBookmarkListCriteriaByUser(User user, String searchline) {
+ Criteria criteria = null;
+ if (user != null) {
+ if (searchline != null && !searchline.isEmpty()) {
+ String[] words = searchline.split("\\s+"); // put the tags in an array
+ List<String> tags = new ArrayList<String>(Arrays.asList(words));
+ criteria = Search.query().eq(User.FQ_FIELD_EMAIL, user.getEmail()).
+ contains(Bookmark.FQ_FIELD_TAGS, tags).criteria();
+ } else {
+ criteria = Search.query().eq(User.FQ_FIELD_EMAIL, user.getEmail()).criteria();
+ }
+ }
+ return criteria;
+ }
}
1
0
Author: bbrossaud
Date: 2010-06-01 09:59:09 +0200 (Tue, 01 Jun 2010)
New Revision: 48
Url: http://chorem.org/repositories/revision/bow/48
Log:
fullText works now
Modified:
trunk/src/main/java/org/chorem/bow/BookmarkActions.java
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-05-31 16:04:07 UTC (rev 47)
+++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-01 07:59:09 UTC (rev 48)
@@ -238,8 +238,13 @@
Set<String> tags = bookmark.getTags();
String name = bookmark.getDescription();
for (String word : fullText) {
- if (tags != null && tags.contains(word)) {
- delete = false;
+ if (tags != null) {
+ for (String tag : tags) {
+ if (tag.contains(word)) {
+ delete = false;
+ break;
+ }
+ }
}
if (name.contains(word)) {
delete = false;
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-05-31 16:04:07 UTC (rev 47)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-01 07:59:09 UTC (rev 48)
@@ -366,16 +366,7 @@
proxy.store(bookmark);
}
}
- String searchLine = request.getParameter("searchLine");
- String fullText = request.getParameter("fullTextLine");
- if (fullText == null) {
- fullText = "";
- }
- if (searchLine != null) {
- response.sendRedirect("bow?action=search&searchLine=" + searchLine + "&fullTextLine=" + fullText);
- } else {
- response.sendRedirect("bow?action=home");
- }
+ redirectToTheGoodPage(request, response);
}
protected void actionRemoveBookmark(HttpServletRequest request, HttpServletResponse response, User user)
@@ -388,16 +379,7 @@
proxy.delete(bookmarkId);
}
}
- String searchLine = request.getParameter("searchLine");
- String fullText = request.getParameter("fullTextLine");
- if (fullText == null) {
- fullText = "";
- }
- if (searchLine != null) {
- response.sendRedirect("bow?action=search&searchLine=" + searchLine + "&fullTextLine=" + fullText);
- } else {
- response.sendRedirect("bow?action=home");
- }
+ redirectToTheGoodPage(request, response);
}
protected void actionDeleteTag(HttpServletRequest request, HttpServletResponse response, User user)
@@ -414,16 +396,7 @@
}
}
}
- String searchLine = request.getParameter("searchLine");
- String fullText = request.getParameter("fullTextLine");
- if (fullText == null) {
- fullText = "";
- }
- if (searchLine != null) {
- response.sendRedirect("bow?action=search&searchLine=" + searchLine + "&fullTextLine=" + fullText);
- } else {
- response.sendRedirect("bow?action=home");
- }
+ redirectToTheGoodPage(request, response);
}
@@ -454,16 +427,7 @@
tokenActions.setPermanentToken("");
}
}
- String searchLine = request.getParameter("searchLine");
- String fullText = request.getParameter("fullTextLine");
- if (fullText == null) {
- fullText = "";
- }
- if (searchLine != null) {
- response.sendRedirect("bow?action=search&searchLine=" + searchLine + "&fullTextLine=" + fullText);
- } else {
- response.sendRedirect("bow?action=home");
- }
+ redirectToTheGoodPage(request, response);
}
/* @param request servlet request
@@ -473,12 +437,7 @@
protected void actionAddUrl(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
addUrl(request, user);
- String searchLine = request.getParameter("searchLine");
- if (searchLine != null) {
- response.sendRedirect("bow?action=search&searchLine=" + searchLine);
- } else {
- response.sendRedirect("bow?action=home");
- }
+ redirectToTheGoodPage(request, response);
}
protected void addUrl(HttpServletRequest request, User user) {
@@ -552,10 +511,6 @@
addSortDescending(Bookmark.FQ_FIELD_CLICK);
List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll(); // select all bookmarks by user
BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
- String searchLine = bookmarkActions.getSearchLine();
- if (searchLine.isEmpty()) {
- bookmarkActions.emptySearchline();
- }
request.setAttribute("bookmarkActions", bookmarkActions);
}
@@ -572,10 +527,14 @@
bookmarkActions.createTagClougByBookmarks();
bookmarkActions.defineTValues();
} else {
- bookmarkActions.addTags(searchLine); // add the new tags
- String tag = request.getParameter("addTag");
- if (tag != null && !tag.isEmpty()) {
- bookmarkActions.addTag(tag);
+ if (searchLine != null && searchLine.isEmpty()) {
+ bookmarkActions.emptySearchline();
+ } else {
+ bookmarkActions.addTags(searchLine); // add the new tags
+ String tag = request.getParameter("addTag");
+ if (tag != null && !tag.isEmpty()) {
+ bookmarkActions.addTag(tag);
+ }
}
bookmarkActions.createTagCloud(); // create the tags cloud with the new informations
}
@@ -737,12 +696,7 @@
}
}
}
- String searchLine = request.getParameter("searchLine");
- if (searchLine != null) {
- response.sendRedirect("bow?action=search&searchLine=" + searchLine);
- } else {
- response.sendRedirect("bow?action=home");
- }
+ redirectToTheGoodPage(request, response);
}
protected void parseHtmlToBookmarks(NodeList list, User user, List<Bookmark> bookmarks, List<String> tagList)
@@ -815,12 +769,7 @@
}
}
}
- String searchLine = request.getParameter("searchLine");
- if (searchLine != null) {
- response.sendRedirect("bow?action=search&searchLine=" + searchLine);
- } else {
- response.sendRedirect("bow?action=home");
- }
+ redirectToTheGoodPage(request, response);
}
protected void actionFullText(HttpServletRequest request, User user) {
@@ -828,7 +777,20 @@
Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria();
List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
BookmarkActions bookmarkActions = createBookmarkActions(request, bookList);
- log.debug(bookmarkActions.getBookmarks().size());
request.setAttribute("bookmarkActions", bookmarkActions);
}
+
+ protected void redirectToTheGoodPage(HttpServletRequest request, HttpServletResponse response)
+ throws IOException {
+ String searchLine = request.getParameter("searchLine");
+ String fullText = request.getParameter("fullTextLine");
+ if (fullText == null) {
+ fullText = "";
+ }
+ if (searchLine != null) {
+ response.sendRedirect("bow?action=search&searchLine=" + searchLine + "&fullTextLine=" + fullText);
+ } else {
+ response.sendRedirect("bow?action=home");
+ }
+ }
}
1
0