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
04 Jun '10
Author: bbrossaud
Date: 2010-06-04 15:37:29 +0200 (Fri, 04 Jun 2010)
New Revision: 67
Url: http://chorem.org/repositories/revision/bow/67
Log:
addition edition in javascript or not
Modified:
trunk/src/main/java/org/chorem/bow/BowProxy.java
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
trunk/src/main/webapp/header.jsp
trunk/src/main/webapp/home.jsp
trunk/src/main/webapp/main.jsp
trunk/src/main/webapp/search2.jsp
Modified: trunk/src/main/java/org/chorem/bow/BowProxy.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BowProxy.java 2010-06-03 16:03:39 UTC (rev 66)
+++ trunk/src/main/java/org/chorem/bow/BowProxy.java 2010-06-04 13:37:29 UTC (rev 67)
@@ -23,6 +23,7 @@
import org.nuiton.wikitty.WikittyProxy;
import org.nuiton.wikitty.WikittyService;
import org.nuiton.wikitty.WikittyServiceCached;
+import org.nuiton.wikitty.WikittyServiceNotifier;
import org.nuiton.wikitty.jdbc.WikittyServiceJDBC;
/**
@@ -51,6 +52,8 @@
protected BowProxy(BowConfig config) {
WikittyService ws = new WikittyServiceJDBC(config.getFlatOptions());
+ // fix me 04/06/2009
+ ws = new WikittyServiceNotifier(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-03 16:03:39 UTC (rev 66)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-04 13:37:29 UTC (rev 67)
@@ -400,19 +400,27 @@
*/
protected void actionEditBookmark(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
- String tags = request.getParameter("tags");
- String name = request.getParameter("name");
String bookmarkId = request.getParameter("bookmarkId");
if (bookmarkId != null && !bookmarkId.isEmpty()) {
WikittyProxy proxy = BowProxy.getInstance();
Bookmark bookmark = proxy.restore(Bookmark.class, bookmarkId);
if (bookmark != null) {
- BookmarkActions.updateBookmarkName(bookmark, name);
- BookmarkActions.addTagsToBookmark(tags, bookmark);
- proxy.store(bookmark);
+ request.setAttribute("link", bookmark.getLink());
+ request.setAttribute("name", bookmark.getDescription());
+ request.setAttribute("alias", bookmark.getAlias());
+ request.setAttribute("tags", BookmarkActions.getBookmarkTagsString(bookmark));
+ request.setAttribute("button", "Modify");
+ request.setAttribute("action", "bow?action=modifyBookmark");
+ request.setAttribute("bookmarkId", bookmarkId);
}
}
- redirectToTheGoodPage(request, response);
+ String searchLine = request.getParameter("searchLine");
+ if (searchLine == null) {
+ actionHome(request, user);
+ } else {
+ actionSearch(request, user);
+ }
+ request.getRequestDispatcher("main.jsp").forward(request, response);
}
/* @param request servlet request
@@ -493,7 +501,7 @@
redirectToTheGoodPage(request, response);
}
- protected void actionModifyBookmark(HttpServletRequest request, HttpServletResponse response, User user)
+ protected void actionModifyBookmark(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException {
String link = request.getParameter("url"); // url of the website
String name = request.getParameter("name"); // website name
Modified: trunk/src/main/webapp/header.jsp
===================================================================
--- trunk/src/main/webapp/header.jsp 2010-06-03 16:03:39 UTC (rev 66)
+++ trunk/src/main/webapp/header.jsp 2010-06-04 13:37:29 UTC (rev 67)
@@ -11,15 +11,39 @@
<link rel="search" type="application/opensearchdescription+xml" title="bowPermanentSearchEngine" href="<%=url%>bow?action=permanentXml" />
<script type="text/javascript">
<!--
- function modify(name, alias, tags, url, action) {
+ function modify(name, alias, tags, link, action, id) {
var form = document.getElementById("bookmarkForm");
- form.elements["url"].value = url;
+ form.elements["url"].value = link;
form.elements["name"].value = name;
form.elements["tags"].value = tags;
form.elements["alias"].value = alias;
form.elements["submit"].value = 'Modif';
form.action = action;
+ var del = null;
+ var count = 0;
+ for ((del = document.getElementById(id + count)); del != null; del = document.getElementById(id + count)) {
+ del.style.display = 'inline';
+ ++count;
+ }
+ return false;
}
+
+ function modifyLast(name, alias, tags, link, action, id) {
+ var form = document.getElementById("bookmarkForm");
+ form.elements["url"].value = link;
+ form.elements["name"].value = name;
+ form.elements["tags"].value = tags;
+ form.elements["alias"].value = alias;
+ form.elements["submit"].value = 'Modif';
+ form.action = action;
+ var del = null;
+ var count = 0;
+ for ((del = document.getElementById(count + id)); del != null; del = document.getElementById(count + id)) {
+ del.style.display = 'inline';
+ ++count;
+ }
+ return false;
+ }
//-->
</script>
</head>
\ No newline at end of file
Modified: trunk/src/main/webapp/home.jsp
===================================================================
--- trunk/src/main/webapp/home.jsp 2010-06-03 16:03:39 UTC (rev 66)
+++ trunk/src/main/webapp/home.jsp 2010-06-04 13:37:29 UTC (rev 67)
@@ -16,6 +16,33 @@
String temporaryToken = tokenActions.getTemporaryToken();
String permanentToken = tokenActions.getPermanentToken();
String url = (String) request.getAttribute("bowUrl");
+
+ String formLink = (String) request.getAttribute("link");
+ String formName = (String) request.getAttribute("name");
+ String formBookmarkId = (String) request.getAttribute("bookmarkId");
+ String formTags = (String) request.getAttribute("tags");
+ String formAlias = (String) request.getAttribute("alias");
+ String formButton = (String) request.getAttribute("button");
+ String formAction = (String) request.getAttribute("action");
+
+ if (formLink == null) {
+ formLink = "URL";
+ }
+ if (formName == null) {
+ formName = "name";
+ }
+ if (formTags == null) {
+ formTags = "tag1 tag2...";
+ }
+ if (formAlias == null) {
+ formAlias = "alias";
+ }
+ if (formButton == null) {
+ formButton = "Add";
+ }
+ if (formAction == null) {
+ formAction = "bow?action=addUrl";
+ }
%>
<body>
<div id="table">
@@ -32,6 +59,8 @@
<%
for (Bookmark bookmark : bookmarkList) {
+ String link = bookmark.getLink();
+ link = link.replace("'", "\\'");
%>
<table class="result">
<tr class="result">
@@ -44,7 +73,9 @@
</div>
<div style="float: right">
- <input type="image" src="img/edit.png" title="Edit" onclick="modify('<%=bookmark.getDescription()%>', '<%=bookmark.getAlias()%>', '<%=BookmarkActions.getBookmarkTagsString(bookmark)%>', '<%=bookmark.getLink()%>', 'bow?action=modifyBookmark&bookmarkId=<%=bookmark.getWikittyId()%>')"/>
+ <a style="border:none;text-decoration: none" href="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>" onclick="return modify('<%=bookmark.getDescription()%>', '<%=bookmark.getAlias()%>', '<%=BookmarkActions.getBookmarkTagsString(bookmark)%>', '<%=link%>', 'bow?action=modifyBookmark&bookmarkId=<%=bookmark.getWikittyId()%>', '<%=bookmark.getWikittyId()%>');">
+ <IMG style="border:none;" src="img/edit.png" title="Edit" ALT="Edit Bookmark" />
+ </a>
<a style="border:none;text-decoration: none" href="bow?action=removeBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
<IMG style="border:none;" SRC="img/remove.png" ALT="Remove bookmark" TITLE="Remove" />
</a>
@@ -69,21 +100,29 @@
<br />
tags :
<%
- Set<String> tagList = bookmark.getTags();
- if (tagList != null && !tagList.isEmpty()) {
- for (String tag : tagList) {
+ Set<String> tagList = bookmark.getTags();
+ if (tagList != null && !tagList.isEmpty()) {
+ int count = 0;
+ for (String tag : tagList) {
+ if (formBookmarkId != null && formBookmarkId.equals(bookmark.getWikittyId())) {
%>
- <a id="delete" style="display:none;" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>" >
+ <a id="<%=bookmark.getWikittyId() + count%>" 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>
+ <%} else {%>
+ <a id="<%=bookmark.getWikittyId() + count%>" style="display:none; 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>
+ <%}%>
<a href="bow?action=search&searchLine=<%=tag%>" style="text-decoration: none"><%=tag%></a>
<%
- }
+ ++count;
+ }
%>
</div>
</td>
<%
- }
+ }
%>
</tr>
<br />
@@ -103,6 +142,8 @@
<h2 class="result">The last addition bookmarks</h2>
<%
for (Bookmark bookmark : lastBookmarks) {
+ String link = bookmark.getLink();
+ link = link.replace("'", "\\'");
%>
<table class="result">
<tr class="result">
@@ -115,7 +156,9 @@
</div>
<div style="float: right">
- <input type="image" src="img/edit.png" title="Edit" onclick="modify('<%=bookmark.getDescription()%>', '<%=bookmark.getAlias()%>', '<%=BookmarkActions.getBookmarkTagsString(bookmark)%>', '<%=bookmark.getLink()%>', 'bow?action=modifyBookmark&bookmarkId=<%=bookmark.getWikittyId()%>')"/>
+ <a style="border:none;text-decoration: none" href="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>" onclick="return modifyLast('<%=bookmark.getDescription()%>', '<%=bookmark.getAlias()%>', '<%=BookmarkActions.getBookmarkTagsString(bookmark)%>', '<%=link%>', 'bow?action=modifyBookmark&bookmarkId=<%=bookmark.getWikittyId()%>', '<%=bookmark.getWikittyId()%>');">
+ <IMG style="border:none;" src="img/edit.png" title="Edit" ALT="Edit Bookmark" />
+ </a>
<a style="border:none;text-decoration: none" href="bow?action=removeBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
<IMG style="border:none;" SRC="img/remove.png" ALT="Remove bookmark" TITLE="Remove" />
</a>
@@ -142,14 +185,22 @@
<%
Set<String> tagList = bookmark.getTags();
if (tagList != null && !tagList.isEmpty()) {
+ int count = 0;
for (String tag : tagList) {
+ if (formBookmarkId != null && formBookmarkId.equals(bookmark.getWikittyId())) {
%>
- <a id="delete" style="display:none;" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>" >
+ <a id="<%=count + bookmark.getWikittyId()%>" 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>
+ <%} else {%>
+ <a id="<%=count + bookmark.getWikittyId()%>" style="display:none; 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>
+ <%}%>
<a href="bow?action=search&searchLine=<%=tag%>" style="text-decoration: none"><%=tag%></a>
<%
- }
+ ++count;
+ }
%>
</div>
</td>
@@ -179,15 +230,15 @@
</ul>
</div>
<div class="menu">
- <form id="bookmarkForm" method="POST" action="bow?action=addUrl">
+ <form id="bookmarkForm" method="POST" action="<%=formAction%>">
URL<br />
- <input type="text" name="url" size="20" value="URL" /><br />
+ <input type="text" name="url" size="20" value="<%=formLink%>" /><br />
Name<br />
- <input type="text" name="name" size="20" value="name" /><br />
+ <input type="text" name="name" size="20" value="<%=formName%>" /><br />
Tags<br />
- <input type="text" name="tags" size="20" value="tag1 tag2..." /><br />
- Alias<br /><input type="text" name="alias" size="20" value="alias" /><br />
- <input type="submit" name="submit" value="add" />
+ <input type="text" name="tags" size="20" value="<%=formTags%>" /><br />
+ Alias<br /><input type="text" name="alias" size="20" value="<%=formAlias%>" /><br />
+ <input type="submit" name="submit" value="<%=formButton%>" />
</form>
</div>
Modified: trunk/src/main/webapp/main.jsp
===================================================================
--- trunk/src/main/webapp/main.jsp 2010-06-03 16:03:39 UTC (rev 66)
+++ trunk/src/main/webapp/main.jsp 2010-06-04 13:37:29 UTC (rev 67)
@@ -9,6 +9,14 @@
String searchLine = bookmarkActions.getSearchLine();
String url = (String) request.getAttribute("bowUrl");
String version = (String) request.getAttribute("version");
+
+ String formLink = (String) request.getAttribute("link");
+ String formName = (String) request.getAttribute("name");
+ String formBookmarkId = (String) request.getAttribute("bookmarkId");
+ String formTags = (String) request.getAttribute("tags");
+ String formAlias = (String) request.getAttribute("alias");
+ String formButton = (String) request.getAttribute("button");
+ String formAction = (String) request.getAttribute("action");
%>
<html>
@@ -22,6 +30,13 @@
<jsp:param name="bookmarkActions" value="<%=tokenActions%>" />
<jsp:param name="bookmarkActions" value="<%=bookmarkActions%>" />
<jsp:param name="bowUrl" value="<%=url%>"/>
+ <jsp:param name="link" value="<%=formLink%>"/>
+ <jsp:param name="name" value="<%=formName%>"/>
+ <jsp:param name="bookmarkId" value="<%=formBookmarkId%>"/>
+ <jsp:param name="tags" value="<%=formTags%>"/>
+ <jsp:param name="alias" value="<%=formAlias%>"/>
+ <jsp:param name="button" value="<%=formButton%>"/>
+ <jsp:param name="action" value="<%=formAction%>"/>
</jsp:include>
<% } else {
%>
@@ -29,6 +44,13 @@
<jsp:param name="bookmarkActions" value="<%=tokenActions%>" />
<jsp:param name="bookmarkActions" value="<%=bookmarkActions%>" />
<jsp:param name="bowUrl" value="<%=url%>"/>
+ <jsp:param name="link" value="<%=formLink%>"/>
+ <jsp:param name="name" value="<%=formName%>"/>
+ <jsp:param name="bookmarkId" value="<%=formBookmarkId%>"/>
+ <jsp:param name="tags" value="<%=formTags%>"/>
+ <jsp:param name="alias" value="<%=formAlias%>"/>
+ <jsp:param name="button" value="<%=formButton%>"/>
+ <jsp:param name="action" value="<%=formAction%>"/>
</jsp:include>
<% }
%>
Modified: trunk/src/main/webapp/search2.jsp
===================================================================
--- trunk/src/main/webapp/search2.jsp 2010-06-03 16:03:39 UTC (rev 66)
+++ trunk/src/main/webapp/search2.jsp 2010-06-04 13:37:29 UTC (rev 67)
@@ -18,6 +18,33 @@
String searchLine = bookmarkActions.getSearchLine();
String fullText = bookmarkActions.getFullTextLine();
String url = (String) request.getAttribute("bowUrl");
+
+ String formLink = (String) request.getAttribute("link");
+ String formName = (String) request.getAttribute("name");
+ String formBookmarkId = (String) request.getAttribute("bookmarkId");
+ String formTags = (String) request.getAttribute("tags");
+ String formAlias = (String) request.getAttribute("alias");
+ String formButton = (String) request.getAttribute("button");
+ String formAction = (String) request.getAttribute("action");
+
+ if (formLink == null) {
+ formLink = "URL";
+ }
+ if (formName == null) {
+ formName = "name";
+ }
+ if (formTags == null) {
+ formTags = "tag1 tag2...";
+ }
+ if (formAlias == null) {
+ formAlias = "alias";
+ }
+ if (formButton == null) {
+ formButton = "Add";
+ }
+ if (formAction == null) {
+ formAction = "bow?action=addUrl";
+ }
%>
<body>
@@ -55,6 +82,8 @@
if (!bookmarkList.isEmpty()) {
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
for (Bookmark bookmark : bookmarkList) {
+ String link = bookmark.getLink();
+ link = link.replace("'", "\\'");
%>
<table class="result">
<tr class="result">
@@ -67,7 +96,9 @@
</div>
<div style="float: right">
- <input type="image" src="img/edit.png" title="Edit" onclick="modify('<%=bookmark.getDescription()%>', '<%=bookmark.getAlias()%>', '<%=BookmarkActions.getBookmarkTagsString(bookmark)%>', '<%=bookmark.getLink()%>', 'bow?action=modifyBookmark&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>&bookmarkId=<%=bookmark.getWikittyId()%>')"/>
+ <a style="border:none;text-decoration: none" href="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>" onclick="return modify('<%=bookmark.getDescription()%>', '<%=bookmark.getAlias()%>', '<%=BookmarkActions.getBookmarkTagsString(bookmark)%>', '<%=link%>', 'bow?action=modifyBookmark&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>&bookmarkId=<%=bookmark.getWikittyId()%>', '<%=bookmark.getWikittyId()%>');">
+ <IMG style="border:none;" src="img/edit.png" title="Edit" ALT="Edit Bookmark" />
+ </a>
<a style="border:none;text-decoration: 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>
@@ -94,13 +125,23 @@
<%
Set<String> tagList = bookmark.getTags();
if (tagList != null && !tagList.isEmpty()) {
+ int count = 0;
for (String tag : tagList) {
+ if (formBookmarkId != null && formBookmarkId.equals(bookmark.getWikittyId())) {
%>
- <a id="delete" style="display:none;" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>" >
+ <a id="<%=bookmark.getWikittyId() + count%>" 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>
- <a href="bow?action=search&searchLine=<%=tag%>" style="text-decoration: none"><%=tag%></a>
+ <%} else {%>
+ <a id="<%=bookmark.getWikittyId() + count%>" style="display:none; 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>
<%}%>
+ <a href="bow?action=search&searchLine=<%=tag%>" style="text-decoration: none;"><%=tag%></a>
+ <%
+ ++count;
+ }
+ %>
</div>
</td>
<%
@@ -129,16 +170,16 @@
</ul>
</div>
<div class="menu">
- <form id="bookmarkForm" method="POST" action="bow?action=addUrl&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
+ <form id="bookmarkForm" method="POST" action="<%=formAction%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
URL<br />
- <input type="text" name="url" size="20" value="URL" /><br />
+ <input type="text" name="url" size="20" value="<%=formLink%>" /><br />
Name<br />
- <input type="text" name="name" size="20" value="name" /><br />
+ <input type="text" name="name" size="20" value="<%=formName%>" /><br />
Tags<br />
- <input type="text" name="tags" size="20" value="tag1 tag2..." /><br />
+ <input type="text" name="tags" size="20" value="<%=formTags%>" /><br />
Alias<br />
- <input type="text" name="alias" size="20" value="alias" /><br />
- <input type="submit" name="submit" value="add" />
+ <input type="text" name="alias" size="20" value="<%=formAlias%>" /><br />
+ <input type="submit" name="submit" value="<%=formButton%>" />
</form>
</div>
1
0
r66 - in trunk/src/main: java/org/chorem/bow webapp webapp/css
by bbrossaud@users.chorem.org 03 Jun '10
by bbrossaud@users.chorem.org 03 Jun '10
03 Jun '10
Author: bbrossaud
Date: 2010-06-03 18:03:39 +0200 (Thu, 03 Jun 2010)
New Revision: 66
Url: http://chorem.org/repositories/revision/bow/66
Log:
new design with javascript
Added:
trunk/src/main/webapp/search2.jsp
Modified:
trunk/src/main/java/org/chorem/bow/BookmarkActions.java
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
trunk/src/main/webapp/css/styles.css
trunk/src/main/webapp/header.jsp
trunk/src/main/webapp/home.jsp
trunk/src/main/webapp/main.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-03 08:18:34 UTC (rev 65)
+++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-03 16:03:39 UTC (rev 66)
@@ -37,7 +37,7 @@
String link = getUrlFromHtml(html);
String tags = getTagsFromHtml(html);
Date date = getDateFromHtml(html);
- Bookmark bookmark = createBookmark(link, name, tags, user, date);
+ Bookmark bookmark = createBookmark(link, name, tags, user, null, date);
return bookmark;
}
@@ -90,9 +90,9 @@
return export;
}
- /* @param html String html
- *
- */
+ /* @param html String html
+ *
+ */
public static String getUrlFromHtml(String html) {
String url = "";
if (html != null) {
@@ -184,7 +184,7 @@
}
}
- public static Bookmark createBookmark(String url, String name, String tags, User user, Date date) {
+ public static Bookmark createBookmark(String url, String name, String tags, User user, String alias, Date date) {
Bookmark bookmark = (Bookmark) new BookmarkImpl();
if (name != null) {
name = name.trim();
@@ -212,7 +212,12 @@
date = new Date();
}
bookmark.setDate(date); // set the date
- bookmark.setAlias("");
+ if (alias != null) {
+ alias = alias.trim();
+ bookmark.setAlias(alias);
+ } else {
+ bookmark.setAlias("");
+ }
return bookmark;
}
@@ -223,6 +228,33 @@
}
}
+ public static void updateBookmark(Bookmark bookmark, String name, String link, String str, String alias) {
+ if (name != null) {
+ name = name.trim();
+ bookmark.setDescription(name);
+ }
+ if (link != null) {
+ link = link.trim();
+ bookmark.setLink(link);
+ }
+ if (str != null) {
+ bookmark.clearTags();
+ if (!str.isEmpty()) {
+ str = str.trim();
+ String[] tags = str.split("\\s+");
+ for (int i = 0; i < tags.length; i++) {
+ if (bookmark.getTags() == null || !bookmark.getTags().contains(tags[i])) {
+ bookmark.addTags(tags[i]);
+ }
+ }
+ }
+ }
+ if (alias != null) {
+ alias = alias.trim();
+ bookmark.setAlias(alias);
+ }
+ }
+
public static String getBookmarkTagsString(Bookmark bookmark) {
if (bookmark != null) {
Set<String> tags = bookmark.getTags();
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-03 08:18:34 UTC (rev 65)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-03 16:03:39 UTC (rev 66)
@@ -118,6 +118,11 @@
log.debug("Going to actionAddUrl");
}
this.actionAddUrl(request, response, user);
+ } else if (action.equals("modifyBookmark") && user != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Going to actionModif");
+ }
+ this.actionModifyBookmark(request, response, user);
} else if (action.equals("importBookmarks") && user != null) {
if (log.isDebugEnabled()) {
log.debug("Going to actionImportBookmarks");
@@ -488,6 +493,22 @@
redirectToTheGoodPage(request, response);
}
+ protected void actionModifyBookmark(HttpServletRequest request, HttpServletResponse response, User user)
+ throws IOException {
+ String link = request.getParameter("url"); // url of the website
+ String name = request.getParameter("name"); // website name
+ String alias = request.getParameter("alias");
+ String tags = request.getParameter("tags");
+ String id = request.getParameter("bookmarkId");
+ WikittyProxy proxy = BowProxy.getInstance();
+ Bookmark bookmark = proxy.restore(Bookmark.class, id);
+ if (bookmark != null) {
+ BookmarkActions.updateBookmark(bookmark, name, link, tags, alias);
+ proxy.store(bookmark);
+ }
+ redirectToTheGoodPage(request, response);
+ }
+
/* @param request servlet request
* @param response servlet response
* @param user User user
@@ -503,10 +524,11 @@
protected void addUrl(HttpServletRequest request, User user) {
String link = request.getParameter("url"); // url of the website
String name = request.getParameter("name"); // website name
+ String alias = request.getParameter("alias");
Bookmark bookmark = null;
if (name != null) {
String tags = request.getParameter("tags"); // tags
- bookmark = BookmarkActions.createBookmark(link, name, tags, user, null);
+ bookmark = BookmarkActions.createBookmark(link, name, tags, user, alias, null);
} else { // this part is for the bookmark addition by script
String nameAndTags = request.getParameter("nameAndTags");
bookmark = BookmarkActions.createBookmark(link, nameAndTags, user);
Modified: trunk/src/main/webapp/css/styles.css
===================================================================
--- trunk/src/main/webapp/css/styles.css 2010-06-03 08:18:34 UTC (rev 65)
+++ trunk/src/main/webapp/css/styles.css 2010-06-03 16:03:39 UTC (rev 66)
@@ -45,7 +45,7 @@
font-family:monospace;
border:1px solid #6495ed;
padding:5px;
- text-align:center;
+ /*text-align:center;*/
}
caption {
font-family:sans-serif;
@@ -164,3 +164,12 @@
background:#A9BCE1 none repeat scroll 0 0;
color:#FFFFFF;
}
+
+.test {
+ text-align: center;
+ float: right;
+ position: relative;
+ bottom: 1%;
+ right: 0px;
+ width: 4em;
+}
\ No newline at end of file
Modified: trunk/src/main/webapp/header.jsp
===================================================================
--- trunk/src/main/webapp/header.jsp 2010-06-03 08:18:34 UTC (rev 65)
+++ trunk/src/main/webapp/header.jsp 2010-06-03 16:03:39 UTC (rev 66)
@@ -9,4 +9,17 @@
<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" />
+ <script type="text/javascript">
+ <!--
+ function modify(name, alias, tags, url, action) {
+ var form = document.getElementById("bookmarkForm");
+ form.elements["url"].value = url;
+ form.elements["name"].value = name;
+ form.elements["tags"].value = tags;
+ form.elements["alias"].value = alias;
+ form.elements["submit"].value = 'Modif';
+ form.action = action;
+ }
+ //-->
+ </script>
</head>
\ No newline at end of file
Modified: trunk/src/main/webapp/home.jsp
===================================================================
--- trunk/src/main/webapp/home.jsp 2010-06-03 08:18:34 UTC (rev 65)
+++ trunk/src/main/webapp/home.jsp 2010-06-03 16:03:39 UTC (rev 66)
@@ -24,177 +24,150 @@
Home
</h1>
<%
- if (bookmarkActions != null) {
- List<Bookmark> bookmarkList = bookmarkActions.getBookmarks();
- if (!bookmarkList.isEmpty()) {
+ SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
+ List<Bookmark> bookmarkList = bookmarkActions.getBookmarks();
+ if (!bookmarkList.isEmpty()) {
%>
<h2 class="result">The most used bookmarks</h2>
+
+ <%
+ for (Bookmark bookmark : bookmarkList) {
+ %>
<table class="result">
<tr class="result">
- <th class ="result remove">
- remove
+ <th>
+
+ <div style="float: left">
+ <input type="image" src="img/img.png" title="bookmark" />
+ <%=bookmark.getAlias()%>
+ (<%=sdf.format(bookmark.getDate())%>)
+ </div>
+
+ <div style="float: right">
+ <input type="image" src="img/edit.png" title="Edit" onclick="modify('<%=bookmark.getDescription()%>', '<%=bookmark.getAlias()%>', '<%=BookmarkActions.getBookmarkTagsString(bookmark)%>', '<%=bookmark.getLink()%>', 'bow?action=modifyBookmark&bookmarkId=<%=bookmark.getWikittyId()%>')"/>
+ <a style="border:none;text-decoration: none" href="bow?action=removeBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
+ <IMG style="border:none;" SRC="img/remove.png" ALT="Remove bookmark" TITLE="Remove" />
+ </a>
+ </div>
+
</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>
- <%
- SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
- for (Bookmark bookmark : bookmarkList) {
- %>
- <tr class="result">
+
+ <tr>
<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>
- <%
- 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" />
+ <div class="test">
+ Clicks:
+ <br />
+ <%=bookmark.getClick()%>
+ </div>
+ <div style="float: left; margin: 5px;">
+ <input type="image" src="img/img.png" title="bookmark" />
+ </div>
+
+ <div style="float: left;margin: 5px">
+ <a title ="<%=bookmark.getLink()%>" href="bow?action=addClick&bookmarkId=<%=bookmark.getWikittyId()%>" target="_blank"><%=bookmark.getDescription()%></a>
+ <br />
+ tags :
+ <%
+ Set<String> tagList = bookmark.getTags();
+ if (tagList != null && !tagList.isEmpty()) {
+ for (String tag : tagList) {
+ %>
+ <a id="delete" style="display:none;" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>" >
+ <IMG style="border:none;" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" />
</a>
- <a href="bow?action=search&addTag=<%=tag%>" style="text-decoration: none"><%=tag%></a>
+ <a href="bow?action=search&searchLine=<%=tag%>" style="text-decoration: none"><%=tag%></a>
+ <%
+ }
+ %>
</div>
- <%
- }
- }
- %>
- <form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
- <input type="text" name="tags" size="35" value="<%=BookmarkActions.getBookmarkTagsString(bookmark)%>" />
- <input type="image" src="img/edit.png" title="Edit"/>
- </form>
</td>
- <td class="result">
- <%=bookmark.getClick()%>
- </td>
+ <%
+ }
+ %>
</tr>
- <%
- }
- %>
+ <br />
</table>
+
<%
- List<Bookmark> lastBookmarks = bookmarkActions.getLastBookmarks();
- if (!lastBookmarks.isEmpty()) {
+ }
+ } else {
%>
+ <h2 class="result">No Bookmarks</h2>
+ <% }
+ %>
+ <%
+ List<Bookmark> lastBookmarks = bookmarkActions.getLastBookmarks();
+ if (!lastBookmarks.isEmpty()) {
+ %>
<h2 class="result">The last addition bookmarks</h2>
+ <%
+ for (Bookmark bookmark : lastBookmarks) {
+ %>
<table class="result">
<tr class="result">
- <th class ="result remove">
- remove
+ <th>
+
+ <div style="float: left">
+ <input type="image" src="img/img.png" title="bookmark" />
+ <%=bookmark.getAlias()%>
+ (<%=sdf.format(bookmark.getDate())%>)
+ </div>
+
+ <div style="float: right">
+ <input type="image" src="img/edit.png" title="Edit" onclick="modify('<%=bookmark.getDescription()%>', '<%=bookmark.getAlias()%>', '<%=BookmarkActions.getBookmarkTagsString(bookmark)%>', '<%=bookmark.getLink()%>', 'bow?action=modifyBookmark&bookmarkId=<%=bookmark.getWikittyId()%>')"/>
+ <a style="border:none;text-decoration: none" href="bow?action=removeBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
+ <IMG style="border:none;" SRC="img/remove.png" ALT="Remove bookmark" TITLE="Remove" />
+ </a>
+ </div>
+
</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">
+
+ <tr>
<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>
- <%
- 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%>">
+ <div class="test">
+ Clicks:
+ <br />
+ <%=bookmark.getClick()%>
+ </div>
+ <div style="float: left; margin: 5px;">
+ <input type="image" src="img/img.png" title="bookmark" />
+ </div>
+
+ <div style="float: left;margin: 5px">
+ <a title ="<%=bookmark.getLink()%>" href="bow?action=addClick&bookmarkId=<%=bookmark.getWikittyId()%>" target="_blank"><%=bookmark.getDescription()%></a>
+ <br />
+ tags :
+ <%
+ Set<String> tagList = bookmark.getTags();
+ if (tagList != null && !tagList.isEmpty()) {
+ for (String tag : tagList) {
+ %>
+ <a id="delete" style="display:none;" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>" >
<IMG style="border:none;" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" />
</a>
- <a href="bow?action=search&addTag=<%=tag%>" style="text-decoration: none"><%=tag%></a>
- </div>
- <%
+ <a href="bow?action=search&searchLine=<%=tag%>" style="text-decoration: none"><%=tag%></a>
+ <%
}
- }
- %>
- <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>
+ %>
+ </div>
</td>
- <td class="result">
- <%=bookmark.getClick()%>
- </td>
- </tr>
- <%
+ <%
}
- %>
+ %>
+ </tr>
+ <br />
</table>
+
<%
- }
- } else {
+ }
+ } else {
%>
<h2 class="result">No Bookmarks</h2>
- <% }
- }
+ <% }
%>
+
</div>
<div id="menu">
<div class="menu">
@@ -206,20 +179,22 @@
</ul>
</div>
<div class="menu">
- <form method="POST" action="bow?action=addUrl">
+ <form id="bookmarkForm" 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" />
+ Alias<br /><input type="text" name="alias" size="20" value="alias" /><br />
+ <input type="submit" name="submit" value="add" />
</form>
</div>
<div class="menu">
<div class="tagCloud">
- <% if (bookmarkActions != null) {
+ <% if (bookmarkActions
+ != null) {
List<FacetTopic> tagCloud = bookmarkActions.getTagsCloud();
for (FacetTopic tag : tagCloud) {
int value = tag.getCount();
Modified: trunk/src/main/webapp/main.jsp
===================================================================
--- trunk/src/main/webapp/main.jsp 2010-06-03 08:18:34 UTC (rev 65)
+++ trunk/src/main/webapp/main.jsp 2010-06-03 16:03:39 UTC (rev 66)
@@ -18,7 +18,7 @@
<%
if (searchLine != null) {
%>
- <jsp:include page="search.jsp" flush="true">
+ <jsp:include page="search2.jsp" flush="true">
<jsp:param name="bookmarkActions" value="<%=tokenActions%>" />
<jsp:param name="bookmarkActions" value="<%=bookmarkActions%>" />
<jsp:param name="bowUrl" value="<%=url%>"/>
Modified: trunk/src/main/webapp/search.jsp
===================================================================
--- trunk/src/main/webapp/search.jsp 2010-06-03 08:18:34 UTC (rev 65)
+++ trunk/src/main/webapp/search.jsp 2010-06-03 16:03:39 UTC (rev 66)
@@ -18,7 +18,6 @@
String searchLine = bookmarkActions.getSearchLine();
String fullText = bookmarkActions.getFullTextLine();
String url = (String) request.getAttribute("bowUrl");
- String version = (String) request.getAttribute("version");
%>
<body>
@@ -149,7 +148,7 @@
<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" />
+ <input name="submit" type="submit" value="add" />
</form>
</div>
Added: trunk/src/main/webapp/search2.jsp
===================================================================
--- trunk/src/main/webapp/search2.jsp (rev 0)
+++ trunk/src/main/webapp/search2.jsp 2010-06-03 16:03:39 UTC (rev 66)
@@ -0,0 +1,183 @@
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@page import="org.chorem.bow.Bookmark" %>
+<%@page import="org.chorem.bow.BookmarkActions" %>
+<%@page import="java.text.SimpleDateFormat" %>
+<%@page import="java.util.Iterator" %>
+<%@page import="java.util.Set" %>
+<%@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");
+ BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions");
+ if (tokenActions != null && bookmarkActions != null) {
+ String temporaryToken = tokenActions.getTemporaryToken();
+ String permanentToken = tokenActions.getPermanentToken();
+ String searchLine = bookmarkActions.getSearchLine();
+ String fullText = bookmarkActions.getFullTextLine();
+ String url = (String) request.getAttribute("bowUrl");
+%>
+
+<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>
+ <div style="text-align: center">
+ 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>
+ 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>
+ 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>
+ </div>
+ <br />
+ <%
+ 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>
+
+ <div style="float: left">
+ <input type="image" src="img/img.png" title="bookmark" />
+ <%=bookmark.getAlias()%>
+ (<%=sdf.format(bookmark.getDate())%>)
+ </div>
+
+ <div style="float: right">
+ <input type="image" src="img/edit.png" title="Edit" onclick="modify('<%=bookmark.getDescription()%>', '<%=bookmark.getAlias()%>', '<%=BookmarkActions.getBookmarkTagsString(bookmark)%>', '<%=bookmark.getLink()%>', 'bow?action=modifyBookmark&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>&bookmarkId=<%=bookmark.getWikittyId()%>')"/>
+ <a style="border:none;text-decoration: 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>
+ </div>
+
+ </th>
+ </tr>
+
+ <tr>
+ <td class="result">
+ <div class="test">
+ Clicks:
+ <br />
+ <%=bookmark.getClick()%>
+ </div>
+ <div style="float: left; margin: 5px;">
+ <input type="image" src="img/img.png" title="bookmark" />
+ </div>
+
+ <div style="float: left;margin: 5px">
+ <a title ="<%=bookmark.getLink()%>" href="bow?action=addClick&bookmarkId=<%=bookmark.getWikittyId()%>" target="_blank"><%=bookmark.getDescription()%></a>
+ <br />
+ tags :
+ <%
+ Set<String> tagList = bookmark.getTags();
+ if (tagList != null && !tagList.isEmpty()) {
+ for (String tag : tagList) {
+ %>
+ <a id="delete" style="display:none;" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>" >
+ <IMG style="border:none;" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" />
+ </a>
+ <a href="bow?action=search&searchLine=<%=tag%>" style="text-decoration: none"><%=tag%></a>
+ <%}%>
+ </div>
+ </td>
+ <%
+ }
+ %>
+ </tr>
+ </table>
+ <br />
+ <%
+ }
+ } 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 class="menu">
+ <form id="bookmarkForm" 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 />
+ Alias<br />
+ <input type="text" name="alias" size="20" value="alias" /><br />
+ <input type="submit" name="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=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>
+ </div>
+ </div>
+</body>
+<%}%>
\ No newline at end of file
1
0
03 Jun '10
Author: bbrossaud
Date: 2010-06-03 10:18:34 +0200 (Thu, 03 Jun 2010)
New Revision: 65
Url: http://chorem.org/repositories/revision/bow/65
Log:
tags clickable and password md5 encoding
Modified:
trunk/src/main/java/org/chorem/bow/BookmarkActions.java
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
trunk/src/main/webapp/home.jsp
trunk/src/main/webapp/search.jsp
Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-02 16:53:58 UTC (rev 64)
+++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-06-03 08:18:34 UTC (rev 65)
@@ -28,6 +28,11 @@
protected int tmax = -1;
protected int tmin = -1;
+ /* @param html String html
+ * @param name String name
+ * @param user User user
+ * @return Bookmark the bookmark filled
+ */
public static Bookmark createBookmarkFromHtml(String html, String name, User user) {
String link = getUrlFromHtml(html);
String tags = getTagsFromHtml(html);
@@ -36,6 +41,9 @@
return bookmark;
}
+ /* @param html String html
+ * @return Date from the html
+ */
public static Date getDateFromHtml(String html) {
Date date = null;
if (html != null) {
@@ -44,7 +52,7 @@
if (m.find()) {
String str = m.group(1);
if (str != null && !str.isEmpty()) {
- long time = Long.valueOf(str) * 1000;
+ long time = Long.valueOf(str) * 1000; // the date in ms
date = new Date(time);
}
}
@@ -52,6 +60,9 @@
return date;
}
+ /* @param bookmarks List<Bookmarks> bookmarks
+ * @return String the html file
+ */
public static String getExportHtmlBookmark(List<Bookmark> bookmarks) {
String export = "";
export = "<!DOCTYPE NETSCAPE-Bookmark-file-1>\n"
@@ -79,6 +90,9 @@
return export;
}
+ /* @param html String html
+ *
+ */
public static String getUrlFromHtml(String html) {
String url = "";
if (html != null) {
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-02 16:53:58 UTC (rev 64)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-03 08:18:34 UTC (rev 65)
@@ -32,6 +32,7 @@
import org.htmlparser.util.ParserException;
import org.htmlparser.util.SimpleNodeIterator;
import org.nuiton.util.ArgumentsParserException;
+import org.nuiton.util.StringUtil;
import org.nuiton.wikitty.Criteria;
import org.nuiton.wikitty.FacetTopic;
import org.nuiton.wikitty.PagedResult;
@@ -632,6 +633,7 @@
throws IOException, ServletException, NoSuchAlgorithmException {
String email = request.getParameter("email");
String password = request.getParameter("password");
+ password = StringUtil.encodeMD5(password);
if (this.checkRegister(email, password)) { // check if all is well
String error = "Email and password must be correctly filled";
request.setAttribute("msgError", error);
@@ -639,8 +641,8 @@
} else {
WikittyProxy proxy = BowProxy.getInstance();
UserImpl newUser = new UserImpl();
- newUser.setPassword(request.getParameter("password"));
- newUser.setEmail(request.getParameter("email"));
+ newUser.setPassword(password);
+ newUser.setEmail(email);
User login = proxy.store((User) newUser); // store the new user
if (login == null) {
request.getRequestDispatcher("error.jsp").forward(request, response);
@@ -663,8 +665,8 @@
throws IOException, ServletException, NoSuchAlgorithmException {
String email = request.getParameter("email");
String password = request.getParameter("password");
+ password = StringUtil.encodeMD5(password);
User login = this.checkLogin(email, password); // check if the user exists
-
if (login != null) {
session.setAttribute("user", login);
initializeToken(session, login);
Modified: trunk/src/main/webapp/home.jsp
===================================================================
--- trunk/src/main/webapp/home.jsp 2010-06-02 16:53:58 UTC (rev 64)
+++ trunk/src/main/webapp/home.jsp 2010-06-03 08:18:34 UTC (rev 65)
@@ -87,7 +87,7 @@
<a style="text-decoration:none" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>">
<IMG style="border:none" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" />
</a>
- <%=tag%>
+ <a href="bow?action=search&addTag=<%=tag%>" style="text-decoration: none"><%=tag%></a>
</div>
<%
}
@@ -142,10 +142,10 @@
<%=sdf.format(bookmark.getDate())%>
</td>
<%
- String alias = bookmark.getAlias();
- if (alias != null && !alias.isEmpty()) {
- alias = url + "alias/" + alias;
- }
+ String alias = bookmark.getAlias();
+ if (alias != null && !alias.isEmpty()) {
+ alias = url + "alias/" + alias;
+ }
%>
<td class="result" style="text-align: left">
<a title ="<%=alias%>" href="bow?action=addClick&bookmarkId=<%=bookmark.getWikittyId()%>" target="_blank"><%=bookmark.getDescription()%></a>
@@ -160,19 +160,19 @@
</td>
<td class="result" style="text-align: left">
<%
- Set<String> tagList = bookmark.getTags();
- if (tagList != null && !tagList.isEmpty()) {
- for (String tag : tagList) {
+ Set<String> tagList = bookmark.getTags();
+ if (tagList != null && !tagList.isEmpty()) {
+ for (String tag : tagList) {
%>
<div style="display: inline">
<a style="text-decoration:none" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>">
<IMG style="border:none;" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" />
</a>
- <%=tag%>
+ <a href="bow?action=search&addTag=<%=tag%>" style="text-decoration: none"><%=tag%></a>
</div>
<%
+ }
}
- }
%>
<form method="POST" action="bow?action=editBookmark&bookmarkId=<%=bookmark.getWikittyId()%>">
<input type="text" name="tags" size="35" value="<%=BookmarkActions.getBookmarkTagsString(bookmark)%>" />
Modified: trunk/src/main/webapp/search.jsp
===================================================================
--- trunk/src/main/webapp/search.jsp 2010-06-02 16:53:58 UTC (rev 64)
+++ trunk/src/main/webapp/search.jsp 2010-06-03 08:18:34 UTC (rev 65)
@@ -104,7 +104,7 @@
<a style="text-decoration:none" href="bow?action=deleteTag&bookmarkId=<%=bookmark.getWikittyId()%>&deleteTag=<%=tag%>&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>">
<IMG style="border:none" SRC="img/delete.png" ALT="Delete tag" TITLE="Delete" />
</a>
- <%=tag%>
+ <a href="bow?action=search&addTag=<%=tag%>&searchLine=<%=searchLine%>" style="text-decoration: none"><%=tag%></a>
</div>
<%
}
1
0
Author: bpoussin
Date: 2010-06-02 18:53:58 +0200 (Wed, 02 Jun 2010)
New Revision: 64
Url: http://chorem.org/repositories/revision/bow/64
Log:
suppression de la dependance multi-storage qui ne sert a rien
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2010-06-02 16:42:56 UTC (rev 63)
+++ trunk/pom.xml 2010-06-02 16:53:58 UTC (rev 64)
@@ -60,12 +60,6 @@
</dependency>
<dependency>
- <groupId>org.nuiton.wikitty</groupId>
- <artifactId>wikitty-multistorage-impl</artifactId>
- <version>${wikitty.version}</version>
- </dependency>
-
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.11</version>
1
0
Author: bpoussin
Date: 2010-06-02 18:42:56 +0200 (Wed, 02 Jun 2010)
New Revision: 63
Url: http://chorem.org/repositories/revision/bow/63
Log:
pouvoir voir l'exception dans les logs, c'est tout de meme beaucoup plus facile pour comprendre les erreurs :(
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-02 15:55:32 UTC (rev 62)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-02 16:42:56 UTC (rev 63)
@@ -224,6 +224,7 @@
request.getRequestDispatcher("login.jsp").forward(request, response);
}
} catch (Exception eee) {
+ log.error("Can't do action", eee);
request.getRequestDispatcher("error.jsp").forward(request, response);
}
}
1
0
02 Jun '10
Author: bbrossaud
Date: 2010-06-02 17:55:32 +0200 (Wed, 02 Jun 2010)
New Revision: 62
Url: http://chorem.org/repositories/revision/bow/62
Log:
modified varaible name
Modified:
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
trunk/src/main/webapp/permanentXml.jsp
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-02 15:51:02 UTC (rev 61)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-02 15:55:32 UTC (rev 62)
@@ -262,7 +262,7 @@
protected void actionOpenSearchSuggestion(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
if (user != null) {
- String search = request.getParameter("search");
+ String search = request.getParameter("searchLine");
if (search != null) {
OpenSearchActions openSearchActions = new OpenSearchActions();
WikittyProxy proxy = BowProxy.getInstance();
Modified: trunk/src/main/webapp/permanentXml.jsp
===================================================================
--- trunk/src/main/webapp/permanentXml.jsp 2010-06-02 15:51:02 UTC (rev 61)
+++ trunk/src/main/webapp/permanentXml.jsp 2010-06-02 15:55:32 UTC (rev 62)
@@ -19,6 +19,6 @@
<InputEncoding>inputEncoding</InputEncoding>
<Image width="16" height="16" type="image/ico"><%=url%>img/bow.gif</Image>
<Url type="text/html" method="GET" template="<%=url%>bow?action=openSearchResult&token=<%=token%>&searchLine={searchTerms}" />
- <Url type="application/x-suggestions+json" method="GET" template="<%=url%>bow?action=openSearchSuggestion&token=<%=token%>&search={searchTerms}" />
+ <Url type="application/x-suggestions+json" method="GET" template="<%=url%>bow?action=openSearchSuggestion&token=<%=token%>&searchLine={searchTerms}" />
<moz:SearchForm><%=url%>bow</moz:SearchForm>
</OpenSearchDescription>
\ No newline at end of file
1
0
Author: bbrossaud
Date: 2010-06-02 17:51:02 +0200 (Wed, 02 Jun 2010)
New Revision: 61
Url: http://chorem.org/repositories/revision/bow/61
Log:
added footer in openSearchResult.jsp
Modified:
trunk/src/main/webapp/openSearchResult.jsp
Modified: trunk/src/main/webapp/openSearchResult.jsp
===================================================================
--- trunk/src/main/webapp/openSearchResult.jsp 2010-06-02 15:17:28 UTC (rev 60)
+++ trunk/src/main/webapp/openSearchResult.jsp 2010-06-02 15:51:02 UTC (rev 61)
@@ -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" %>
@@ -12,11 +10,13 @@
<%
BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions");
- String searchLine = "";
if (bookmarkActions != null) {
- searchLine = bookmarkActions.getSearchLine();
- }
- String url = (String) request.getAttribute("bowUrl");
+ String searchLine = "";
+ if (bookmarkActions != null) {
+ searchLine = bookmarkActions.getSearchLine();
+ }
+ String version = (String) request.getAttribute("version");
+ String url = (String) request.getAttribute("bowUrl");
%>
<html>
@@ -27,8 +27,8 @@
<h1 class="result">Results</h1>
<% if (bookmarkActions != null) {
- List<Bookmark> bookmarkList = bookmarkActions.getBookmarks();
- if (!bookmarkList.isEmpty()) {
+ List<Bookmark> bookmarkList = bookmarkActions.getBookmarks();
+ if (!bookmarkList.isEmpty()) {
%>
<table class="result">
<tr class="result">
@@ -99,16 +99,12 @@
%>
<h2 class="result">No Bookmarks found</h2>
<% }
- }
+ }
%>
- <div class="Index" id="footer">
- <a shape="rect" href="<%=url%>">bow</a>
- <a shape="rect" href="http://www.chorem.org/projects/list_files/bow"></a> -
- <a shape="rect" href="http://www.gnu.org/licenses/agpl.html">Licence AGPL</a> -
- <span title="Copyright">©2009-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
+</html>
+<%}%>
\ No newline at end of file
1
0
Author: bbrossaud
Date: 2010-06-02 17:17:28 +0200 (Wed, 02 Jun 2010)
New Revision: 60
Url: http://chorem.org/repositories/revision/bow/60
Log:
remove bug from suggestion.jsp
Modified:
trunk/src/main/webapp/suggestions.jsp
Modified: trunk/src/main/webapp/suggestions.jsp
===================================================================
--- trunk/src/main/webapp/suggestions.jsp 2010-06-02 15:11:39 UTC (rev 59)
+++ trunk/src/main/webapp/suggestions.jsp 2010-06-02 15:17:28 UTC (rev 60)
@@ -1,6 +1,5 @@
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="org.chorem.bow.OpenSearchActions" %>
-<%@page import="org.chorem.bow.Suggestion" %>
<%@page import="java.util.List" %>
<%@page import="java.util.Iterator" %>
<%@page import="org.nuiton.wikitty.FacetTopic" %>
1
0
02 Jun '10
Author: bbrossaud
Date: 2010-06-02 17:11:39 +0200 (Wed, 02 Jun 2010)
New Revision: 59
Url: http://chorem.org/repositories/revision/bow/59
Log:
use facet for the opensearch suggestions
Removed:
trunk/src/main/java/org/chorem/bow/Model.java
trunk/src/main/java/org/chorem/bow/Suggestion.java
Modified:
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
trunk/src/main/java/org/chorem/bow/OpenSearchActions.java
trunk/src/main/java/org/chorem/bow/SuggestionsComparator.java
trunk/src/main/webapp/openSearchResult.jsp
trunk/src/main/webapp/suggestions.jsp
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-02 14:14:19 UTC (rev 58)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-02 15:11:39 UTC (rev 59)
@@ -276,12 +276,16 @@
List<String> cpy = new ArrayList<String>(searchLine);
cpy.remove(cpy.size() - 1);
criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).
- eq(Bookmark.FQ_FIELD_TAGS, cpy).criteria();
+ eq(Bookmark.FQ_FIELD_TAGS, cpy).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);
}
- List<Bookmark> bookList = proxy.findAllByCriteria(Bookmark.class, criteria).getAll();
+ PagedResult result = proxy.findAllByCriteria(Bookmark.class, criteria);
+ List<Bookmark> bookList = result.getAll();
+ List<FacetTopic> topics = result.getTopic(Bookmark.FQ_FIELD_TAGS);
openSearchActions.setBookmarkList(bookList);
+ openSearchActions.setSuggestionList(topics);
openSearchActions.findSuggestions(searchLine);
request.setAttribute("openSearchAction", openSearchActions);
}
Deleted: trunk/src/main/java/org/chorem/bow/Model.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/Model.java 2010-06-02 14:14:19 UTC (rev 58)
+++ trunk/src/main/java/org/chorem/bow/Model.java 2010-06-02 15:11:39 UTC (rev 59)
@@ -1,53 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package org.chorem.bow;
-
-import java.util.Properties;
-import org.nuiton.wikitty.WikittyExtensionStorage;
-import org.nuiton.wikitty.WikittyProxy;
-import org.nuiton.wikitty.WikittyService;
-import org.nuiton.wikitty.WikittyStorage;
-import org.nuiton.wikitty.jdbc.WikittyExtensionStorageJDBC;
-import org.nuiton.wikitty.jdbc.WikittyStorageJDBC;
-import org.nuiton.wikitty.multistorage.MultiStorageConfiguration;
-import org.nuiton.wikitty.multistorage.MultiStorageConfiguration.BasicConfiguration;
-import org.nuiton.wikitty.multistorage.WikittyServiceMultiStorage;
-
-/**
- *
- * @author bbrossaud
- */
-public class Model {
-
- protected WikittyProxy proxy = null;
-
- Model() {
- System.setProperty("solr.data.dir", System.getProperty("user.home") + "/.bow/solr");
- this.init();
- }
-
- public void init() {
- MultiStorageConfiguration config = new BasicConfiguration();
- Model.configureJDBC(config);
-
- WikittyService jdbcStorage = new WikittyServiceMultiStorage(config);
- proxy = new WikittyProxy();
- proxy.setWikittyService(jdbcStorage);
- }
-
- static void configureJDBC(MultiStorageConfiguration configuration) {
- Properties properties = new Properties();
-
- WikittyExtensionStorage extensionStorage = new WikittyExtensionStorageJDBC(properties);
- WikittyStorage wikittyStorage = new WikittyStorageJDBC(extensionStorage, properties);
-
- configuration.addExtensionStorage(extensionStorage, true);
- configuration.addWikittyStorage(wikittyStorage, true);
- }
-
- public WikittyProxy getProxy() {
- return proxy;
- }
-}
Modified: trunk/src/main/java/org/chorem/bow/OpenSearchActions.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/OpenSearchActions.java 2010-06-02 14:14:19 UTC (rev 58)
+++ trunk/src/main/java/org/chorem/bow/OpenSearchActions.java 2010-06-02 15:11:39 UTC (rev 59)
@@ -6,12 +6,11 @@
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
+import org.nuiton.wikitty.FacetTopic;
/**
*
@@ -20,50 +19,38 @@
public class OpenSearchActions {
protected List<Bookmark> bookmarkList = new ArrayList<Bookmark>();
- protected List<Suggestion> suggestions = new ArrayList<Suggestion>();
+ protected List<FacetTopic> suggestions = new ArrayList<FacetTopic>();
protected String[] search = null;
public void findSuggestions(List<String> searchLine) {
int size = searchLine.size();
search = searchLine.toArray(new String[size]);
- fieldSuggestionList(search[size - 1], searchLine);
- }
-
- protected void fieldSuggestionList(String word, List<String> searchLine) {
- if (bookmarkList != null) {
- Map<String, Integer> map = new HashMap<String, Integer>();
- List<Bookmark> save = new ArrayList<Bookmark>(bookmarkList);
- for (Bookmark bookmark : save) {
- Set<String> tagList = bookmark.getTags();
- boolean contain = false;
- if (tagList != null) {
- for (String tag : tagList) {
- if (tag.indexOf(word) == 0 && !searchLine.contains(tag)) {
- contain = true;
- if (map.containsKey(tag)) {
- Integer count = map.get(tag);
- ++count;
- map.put(tag, count);
- } else {
- map.put(tag, 1);
- }
- }
- }
+ String word = search[size - 1];
+ List<FacetTopic> save = new ArrayList<FacetTopic>(suggestions);
+ for (FacetTopic topic : save) {
+ String tag = topic.getTopicName();
+ if (tag != null) {
+ if (tag.indexOf(word) != 0 || searchLine.contains(tag)) {
+ suggestions.remove(topic);
}
- if (contain == false) {
- bookmarkList.remove(bookmark);
+ }
+ }
+ List<Bookmark> cpy = new ArrayList<Bookmark>(bookmarkList);
+ for (Bookmark bookmark : cpy) {
+ Set<String> tags = bookmark.getTags();
+ boolean delete = true;
+ for (FacetTopic topic : suggestions) {
+ String name = topic.getTopicName();
+ if (tags != null && tags.contains(name)) {
+ delete = false;
+ break;
}
}
- Set<String> keys = map.keySet();
- for (String key : keys) {
- Suggestion newSuggestion = new Suggestion();
- newSuggestion.setName(key);
- newSuggestion.setNb(map.get(key));
- suggestions.add(newSuggestion);
+ if (delete == true) {
+ bookmarkList.remove(bookmark);
}
-
- Collections.sort(suggestions, new SuggestionsComparator());
}
+ Collections.sort(suggestions, new SuggestionsComparator());
}
protected boolean bookmarkHasTag(Bookmark bookmark, String tag) {
@@ -97,14 +84,14 @@
public String getJsonSuggestions() {
String str = "[";
String srch = "";
- Iterator<Suggestion> it = suggestions.iterator();
+ Iterator<FacetTopic> it = suggestions.iterator();
if (search.length > 1) {
srch = StringUtils.join(search, ' ', 0, (search.length - 1));
srch += " ";
}
while (it.hasNext()) {
- Suggestion su = it.next();
- str += "\"" + srch + su.getName() + "\"";
+ FacetTopic su = it.next();
+ str += "\"" + srch + su.getTopicName() + "\"";
if (it.hasNext()) {
str += ",";
}
@@ -120,10 +107,10 @@
public String getJsonDescription() {
String str = "[";
- Iterator<Suggestion> it = suggestions.iterator();
+ Iterator<FacetTopic> it = suggestions.iterator();
while (it.hasNext()) {
- Suggestion su = it.next();
- str += "\"" + su.getNb() + " results\"";
+ FacetTopic su = it.next();
+ str += "\"" + su.getCount() + " results\"";
if (it.hasNext()) {
str += ",";
}
@@ -136,8 +123,10 @@
search = tab;
}
- public void setSuggestionList(List<Suggestion> list) {
- suggestions = list;
+ public void setSuggestionList(List<FacetTopic> list) {
+ if (list != null) {
+ suggestions = new ArrayList<FacetTopic>(list);
+ }
}
public List<Bookmark> getBookmarkList() {
@@ -148,7 +137,7 @@
return search;
}
- public List<Suggestion> getSuggestionList() {
+ public List<FacetTopic> getSuggestionList() {
return suggestions;
}
}
Deleted: trunk/src/main/java/org/chorem/bow/Suggestion.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/Suggestion.java 2010-06-02 14:14:19 UTC (rev 58)
+++ trunk/src/main/java/org/chorem/bow/Suggestion.java 2010-06-02 15:11:39 UTC (rev 59)
@@ -1,35 +0,0 @@
-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-package org.chorem.bow;
-
-/**
- *
- * @author bbrossaud
- */
-public class Suggestion {
- int nb = 0;
- String name = "";
-
- public void increment() {
- nb++;
- }
-
- public void setNb(int value) {
- nb = value;
- }
-
- public void setName(String str) {
- name = str;
- }
-
- public int getNb() {
- return nb;
- }
-
- public String getName() {
- return name;
- }
-}
Modified: trunk/src/main/java/org/chorem/bow/SuggestionsComparator.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/SuggestionsComparator.java 2010-06-02 14:14:19 UTC (rev 58)
+++ trunk/src/main/java/org/chorem/bow/SuggestionsComparator.java 2010-06-02 15:11:39 UTC (rev 59)
@@ -2,23 +2,25 @@
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
-
package org.chorem.bow;
import java.util.Comparator;
+import org.nuiton.wikitty.FacetTopic;
/**
*
* @author bbrossaud
*/
-public class SuggestionsComparator implements Comparator<Suggestion> {
+public class SuggestionsComparator implements Comparator<FacetTopic> {
@Override
- public int compare(Suggestion o1, Suggestion o2) {
- if (o1.getNb() < o2.getNb())
+ public int compare(FacetTopic o1, FacetTopic o2) {
+ if (o1.getCount() < o2.getCount()) {
return 1;
- if (o1.getNb() > o2.getNb())
+ }
+ if (o1.getCount() > o2.getCount()) {
return -1;
+ }
return 0;
}
}
Modified: trunk/src/main/webapp/openSearchResult.jsp
===================================================================
--- trunk/src/main/webapp/openSearchResult.jsp 2010-06-02 14:14:19 UTC (rev 58)
+++ trunk/src/main/webapp/openSearchResult.jsp 2010-06-02 15:11:39 UTC (rev 59)
@@ -16,11 +16,11 @@
if (bookmarkActions != null) {
searchLine = bookmarkActions.getSearchLine();
}
- String url = (String) request.getAttribute("bowUrl");
+ String url = (String) request.getAttribute("bowUrl");
%>
<html>
- <jsp:include page="header.jsp" flush="true">
+ <jsp:include page="header.jsp" flush="true">
<jsp:param name="bowUrl" value="<%=url%>"/>
</jsp:include>
<body>
@@ -80,7 +80,7 @@
%>
<%=tag%>
<%
- }
+ }
%>
</td>
<%
Modified: trunk/src/main/webapp/suggestions.jsp
===================================================================
--- trunk/src/main/webapp/suggestions.jsp 2010-06-02 14:14:19 UTC (rev 58)
+++ trunk/src/main/webapp/suggestions.jsp 2010-06-02 15:11:39 UTC (rev 59)
@@ -3,6 +3,7 @@
<%@page import="org.chorem.bow.Suggestion" %>
<%@page import="java.util.List" %>
<%@page import="java.util.Iterator" %>
+<%@page import="org.nuiton.wikitty.FacetTopic" %>
<%
@@ -10,7 +11,7 @@
if (osa != null) {
String[] word = osa.getSearch();
if (word != null) {
- List<Suggestion> suggestions = osa.getSuggestionList();
+ List<FacetTopic> suggestions = osa.getSuggestionList();
if (suggestions != null) {
%>
<%=osa.getJsonResult()%>
1
0
Author: bbrossaud
Date: 2010-06-02 16:14:19 +0200 (Wed, 02 Jun 2010)
New Revision: 58
Url: http://chorem.org/repositories/revision/bow/58
Log:
added new comments
Modified:
trunk/TODO.txt
trunk/src/main/java/org/chorem/bow/BowProxy.java
trunk/src/main/java/org/chorem/bow/ControllerServlet.java
trunk/src/main/java/org/chorem/bow/Suggestion.java
Modified: trunk/TODO.txt
===================================================================
--- trunk/TODO.txt 2010-06-02 10:32:07 UTC (rev 57)
+++ trunk/TODO.txt 2010-06-02 14:14:19 UTC (rev 58)
@@ -20,7 +20,7 @@
===> champ recherche fulltext
-===> class bokkmarkFile = Id proprietaire, list<userID> writer, list<userId> reader;
+===> class bookmarkFile = Id proprietaire, list<userID> writer, list<userId> reader;
===> class bookmark = idBookmarkFile a la place de UserID;
Modified: trunk/src/main/java/org/chorem/bow/BowProxy.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/BowProxy.java 2010-06-02 10:32:07 UTC (rev 57)
+++ trunk/src/main/java/org/chorem/bow/BowProxy.java 2010-06-02 14:14:19 UTC (rev 58)
@@ -22,7 +22,6 @@
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.WikittyServiceCached;
import org.nuiton.wikitty.jdbc.WikittyServiceJDBC;
@@ -52,10 +51,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);
setWikittyService(ws);
}
-
-
}
Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-02 10:32:07 UTC (rev 57)
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-06-02 14:14:19 UTC (rev 58)
@@ -78,10 +78,12 @@
request.setAttribute("bowUrl", url);
HttpSession session = request.getSession(true);
User user = (User) session.getAttribute("user");
+
String token = request.getParameter("token"); // token or not
if (token != null && !token.isEmpty()) {
- user = checkToken(token, session);
+ user = checkToken(token, session); // retrieve user by token
}
+
String action = request.getParameter("action");
if (action != null) {
if (action.equals("register")) {
@@ -226,6 +228,14 @@
}
}
+
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user the user
+ * @param token the permanent or temporary token
+ * @throws ServletException if a servlet error occurs
+ * @description set the openSearch result
+ */
protected void actionOpenSearchResult(HttpServletRequest request, HttpServletResponse response, User user, String token)
throws IOException, ServletException {
String searchLine = request.getParameter("searchLine");
@@ -235,7 +245,7 @@
WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine);
criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK);
- PagedResult result = proxy.findAllByCriteria(Bookmark.class, criteria);
+ PagedResult result = proxy.findAllByCriteria(Bookmark.class, criteria);// retrieve bookmarks by search
BookmarkActions bookmarkActions = createBookmarkActions(request, result, searchLine);
request.setAttribute("bookmarkActions", bookmarkActions);
request.setAttribute("token", token);
@@ -243,6 +253,12 @@
}
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user the user
+ * @throws ServletException if a servlet error occurs
+ * @description set the openSearch suggestions
+ */
protected void actionOpenSearchSuggestion(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
if (user != null) {
@@ -253,14 +269,14 @@
String[] words = search.split("\\s+");
List<String> searchLine = new ArrayList<String>(Arrays.asList(words));
if (search.charAt(search.length() - 1) == ' ') {
- searchLine.add("");
+ searchLine.add(""); // if the user types nothing we have to propose suggestions
}
Criteria criteria = null;
if (searchLine.size() > 1) {
List<String> cpy = new ArrayList<String>(searchLine);
cpy.remove(cpy.size() - 1);
criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).
- contains(Bookmark.FQ_FIELD_TAGS, cpy).criteria();
+ eq(Bookmark.FQ_FIELD_TAGS, cpy).criteria();
} else {
criteria = Search.query().eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria();
}
@@ -272,12 +288,24 @@
}
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @param session current session
+ * @throws ServletException if a servlet error occurs
+ * @description delete the session
+ */
protected void actionLogout(HttpServletRequest request, HttpServletResponse response, HttpSession session)
throws IOException, ServletException {
session.invalidate();
request.getRequestDispatcher("login.jsp").forward(request, response);
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet error occurs
+ * @description when the user click on the bookmark url, we
+ * increment the number of click
+ */
protected void actionAddClick(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String bookmarkId = request.getParameter("bookmarkId");
@@ -295,6 +323,12 @@
}
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user the user
+ * @throws ServletException if a servlet error occurs
+ * @description order the bookmarks by type
+ */
protected void actionOrderAsc(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
String type = request.getParameter("type");
@@ -318,6 +352,12 @@
}
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user the user
+ * @throws ServletException if a servlet error occurs
+ * @description order the bookmarks by type
+ */
protected void actionOrderDesc(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
String searchLine = request.getParameter("searchLine");
@@ -341,6 +381,12 @@
}
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user the user
+ * @throws ServletException if a servlet error occurs
+ * @description edit the bookmark
+ */
protected void actionEditBookmark(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
String tags = request.getParameter("tags");
@@ -358,6 +404,12 @@
redirectToTheGoodPage(request, response);
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user the user
+ * @throws ServletException if a servlet error occurs
+ * @description remove the bookmark
+ */
protected void actionRemoveBookmark(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
String bookmarkId = request.getParameter("bookmarkId");
@@ -371,6 +423,12 @@
redirectToTheGoodPage(request, response);
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user the user
+ * @throws ServletException if a servlet error occurs
+ * @description delete the bookmark tag
+ */
protected void actionDeleteTag(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
String bookmarkId = request.getParameter("bookmarkId");
@@ -389,9 +447,12 @@
}
- /* @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet error occurs
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user User user
+ * @param session HttpSession session
+ * @throws ServletException if a servlet error occurs
+ * @description delete the current token and generate an another
*/
protected void actionGenerateToken(HttpServletRequest request, HttpServletResponse response, User user, HttpSession session)
throws IOException, ServletException, NoSuchAlgorithmException {
@@ -421,9 +482,11 @@
redirectToTheGoodPage(request, response);
}
- /* @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet error occurs
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user User user
+ * @throws ServletException if a servlet error occurs
+ * @description add a new bookmark
*/
protected void actionAddUrl(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, ServletException {
@@ -433,12 +496,12 @@
protected void addUrl(HttpServletRequest request, User user) {
String link = request.getParameter("url"); // url of the website
- String name = request.getParameter("name");
+ String name = request.getParameter("name"); // website name
Bookmark bookmark = null;
if (name != null) {
String tags = request.getParameter("tags"); // tags
bookmark = BookmarkActions.createBookmark(link, name, tags, user, null);
- } else {
+ } else { // this part is for the bookmark addition by script
String nameAndTags = request.getParameter("nameAndTags");
bookmark = BookmarkActions.createBookmark(link, nameAndTags, user);
}
@@ -450,6 +513,12 @@
}
}
}
+ /* @param token String token
+ * @param session HttpSession session
+ * @return User
+ * @description check if the token is valid and return the
+ * token owner
+ */
protected User checkToken(String token, HttpSession session) {
if (checkTemporaryToken(token, session) == true) {
@@ -478,6 +547,10 @@
return null;
}
+ /* @param token String which contains the MD5 encoding token
+ * @return null the token doesn't exist
+ * @return User the token owner
+ */
protected boolean checkTemporaryToken(String token, HttpSession session) {
TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions");
if (tokenActions != null) {
@@ -491,9 +564,12 @@
return false;
}
- /* @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet error occurs
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user User user
+ * @throws ServletException if a servlet error occurs
+ * @description set the bookmarks and the tagCloud by search
+ * or tag addition
*/
protected void actionSearch(HttpServletRequest request, User user)
throws IOException, ServletException {
@@ -514,6 +590,12 @@
request.setAttribute("bookmarkActions", bookmarkActions);
}
+ /* @param request servlet request
+ * @param result PageResult result
+ * @param searchLine String searchLine
+ * @return bookmarkActions the bookmarkAction
+ * @description create the tagCLoud by research type
+ */
protected BookmarkActions createBookmarkActions(HttpServletRequest request, PagedResult result, String searchLine) {
String fullText = request.getParameter("fullTextLine");
BookmarkActions bookmarkActions = new BookmarkActions();
@@ -535,9 +617,11 @@
return bookmarkActions;
}
- /* @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet error occurs
+ /* @param request servlet request
+ * @param response servlet response
+ * @param session HttpSession session
+ * @throws ServletException if a servlet error occurs
+ * @description check if the registration is correct or not
*/
protected void actionRegister(HttpServletRequest request, HttpServletResponse response, HttpSession session)
throws IOException, ServletException, NoSuchAlgorithmException {
@@ -564,9 +648,11 @@
}
}
- /* @param request servlet request
- * @param response servlet response
- * @throws ServletException if a servlet error occurs
+ /* @param request servlet request
+ * @param response servlet response
+ * @param session HttpSession session
+ * @throws ServletException if a servlet error occurs
+ * @description check if the authentication is correct or not
*/
protected void actionLogin(HttpServletRequest request, HttpServletResponse response, HttpSession session)
throws IOException, ServletException, NoSuchAlgorithmException {
@@ -587,6 +673,11 @@
}
}
+ /* @param session HttpSession session
+ * @throws ServletException if a servlet error occurs
+ * @description retrieve tokens or create there if the user are just
+ * registered
+ */
protected void initializeToken(HttpSession session, User login)
throws NoSuchAlgorithmException {
WikittyProxy proxy = BowProxy.getInstance();
@@ -607,10 +698,10 @@
}
- /* @param email String which contains the user name (email)
- * @param password String which contains the user password
- * @return null the user doesn't exist
- * @return User the user exists
+ /* @param email String which contains the user name (email)
+ * @param password String which contains the user password
+ * @return null the user doesn't exist
+ * @return User the user exists
*/
protected User checkLogin(String email, String password) {
if (email != null && password != null) {
@@ -626,9 +717,9 @@
}
- /* @param email String which contains the user name (email)
- * @param password String which contains the user password
- * @return bool false if the user doesn't exists or true
+ /* @param email String which contains the user name (email)
+ * @param password String which contains the user password
+ * @return bool false if the user doesn't exists or true
*/
protected boolean checkRegister(String email, String password) {
if (email != null && password != null) {
@@ -644,6 +735,10 @@
return true;
}
+ /* @param request servlet request
+ * @param user User user
+ * @description initialize all for the home page
+ */
protected void actionHome(HttpServletRequest request, User user) {
WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = getBookmarkListCriteriaByUser(user, null);
@@ -666,6 +761,12 @@
}
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @param user User user
+ * @throws ServletException if a servlet error occurs
+ * @description import bookmark for an user
+ */
protected void actionImportBookmarks(HttpServletRequest request, HttpServletResponse response, User user)
throws IOException, FileUploadException, ParserException {
// Check that we have a file upload request
@@ -695,6 +796,12 @@
redirectToTheGoodPage(request, response);
}
+ /* @param list NodeList list
+ * @param bookmarks List<Bookmark> bookmarks
+ * @param tagList List<String> tagList
+ * @throws ParserException if a parser error occurs
+ * @description parse the html by recursion and retrieve bookmarks
+ */
protected void parseHtmlToBookmarks(NodeList list, User user, List<Bookmark> bookmarks, List<String> tagList)
throws ParserException {
if (list != null) {
@@ -702,14 +809,14 @@
SimpleNodeIterator it = list.elements();
while (it.hasMoreNodes()) {
Node node = it.nextNode();
- String plainText = node.toPlainTextString();
- String text = node.getText();
- if (text != null && text.startsWith("H3")) {
+ String plainText = node.toPlainTextString(); // the text between two heads ==> <toto>plainText</toto>
+ String text = node.getText(); // the text in the head ==> <text></toto>
+ if (text != null && text.startsWith("H3")) { // H3 = folder
if (plainText != null && !plainText.isEmpty()) {
- tagList.add(plainText);
+ tagList.add(plainText); // add the folder name to the tagList
isFolder = true;
}
- } else if (text != null && text.startsWith("A HREF")) {
+ } else if (text != null && text.startsWith("A HREF")) { // HREF = new bookmarks
Bookmark bookmark = BookmarkActions.createBookmarkFromHtml(text, plainText, user);
BookmarkActions.addTagsToBookmark(tagList, bookmark);
if (bookmark != null) {
@@ -718,10 +825,10 @@
}
NodeList children = node.getChildren();
if (children != null) {
- parseHtmlToBookmarks(children, user, bookmarks, tagList);
+ parseHtmlToBookmarks(children, user, bookmarks, tagList); // if there is an under node = recursion
}
}
- if (isFolder == true) {
+ if (isFolder == true) { // if we find a folder, we have to remove it
int index = tagList.size() - 1;
if (index > -1) {
tagList.remove(index);
@@ -730,6 +837,10 @@
}
}
+ /* @param response servlet response
+ * @param user User user
+ * @description export bookmarks
+ */
protected void actionExportBookmarks(HttpServletResponse response, User user)
throws IOException {
WikittyProxy proxy = BowProxy.getInstance();
@@ -746,6 +857,11 @@
op.close();
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet error occurs
+ * @description add an alias for one bookmark
+ */
protected void actionAddAlias(HttpServletRequest request, HttpServletResponse response)
throws IOException {
String alias = request.getParameter("alias");
@@ -767,6 +883,11 @@
redirectToTheGoodPage(request, response);
}
+ /* @param request servlet request
+ * @param user User user
+ * @throws ServletException if a servlet error occurs
+ * @description retrieve bookmark for the full text research
+ */
protected void actionFullText(HttpServletRequest request, User user) {
WikittyProxy proxy = BowProxy.getInstance();
Criteria criteria = getBookmarkListCriteriaByUser(user, null);
@@ -775,6 +896,11 @@
request.setAttribute("bookmarkActions", bookmarkActions);
}
+ /* @param request servlet request
+ * @param response servlet response
+ * @throws ServletException if a servlet error occurs
+ * @description choose the good page
+ */
protected void redirectToTheGoodPage(HttpServletRequest request, HttpServletResponse response)
throws IOException {
String searchLine = request.getParameter("searchLine");
@@ -789,6 +915,10 @@
}
}
+ /* @param user User user
+ * @param searchLine String searchLine
+ * @description return the bookmark criteria by search
+ */
protected Criteria getBookmarkListCriteriaByUser(User user, String searchLine) {
Criteria criteria = null;
if (user != null) {
Modified: trunk/src/main/java/org/chorem/bow/Suggestion.java
===================================================================
--- trunk/src/main/java/org/chorem/bow/Suggestion.java 2010-06-02 10:32:07 UTC (rev 57)
+++ trunk/src/main/java/org/chorem/bow/Suggestion.java 2010-06-02 14:14:19 UTC (rev 58)
@@ -13,6 +13,10 @@
int nb = 0;
String name = "";
+ public void increment() {
+ nb++;
+ }
+
public void setNb(int value) {
nb = value;
}
1
0