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
- 617 discussions
r323 - trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch
by tchemit@users.chorem.org 29 Aug '11
by tchemit@users.chorem.org 29 Aug '11
29 Aug '11
Author: tchemit
Date: 2011-08-29 13:54:58 +0200 (Mon, 29 Aug 2011)
New Revision: 323
Url: http://chorem.org/repositories/revision/bow/323
Log:
fix build :(
Modified:
trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchSuggestionAction.java
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchSuggestionAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchSuggestionAction.java 2011-08-22 11:23:47 UTC (rev 322)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchSuggestionAction.java 2011-08-29 11:54:58 UTC (rev 323)
@@ -24,25 +24,28 @@
package org.chorem.bow.action.opensearch;
import com.opensymphony.xwork2.ActionContext;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
import org.apache.commons.io.input.ReaderInputStream;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.chorem.bow.BookmarkUtils;
-
import org.chorem.bow.BowBookmark;
+import org.chorem.bow.BowConfig;
import org.chorem.bow.BowUser;
import org.chorem.bow.BowUtils;
+import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.entities.Wikitty;
import org.nuiton.wikitty.search.Criteria;
import org.nuiton.wikitty.search.FacetTopic;
import org.nuiton.wikitty.search.PagedResult;
-import org.nuiton.wikitty.WikittyProxy;
-import org.nuiton.wikitty.entities.Wikitty;
import org.nuiton.wikitty.search.Search;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
/**
* Retourne les suggestions pour l'opensearch en fonction de ce qui a ete deja
* saisi
@@ -50,6 +53,11 @@
* @author poussin
*/
public class OpenSearchSuggestionAction extends OpenSearchBaseAction {
+
+ /** Logger. */
+ private static final Log log =
+ LogFactory.getLog(OpenSearchSuggestionAction.class);
+
private static final long serialVersionUID = 1L;
static public OpenSearchSuggestionAction getAction() {
@@ -57,7 +65,7 @@
return (OpenSearchSuggestionAction) action;
}
- protected InputStream inputStream;
+ protected transient InputStream inputStream;
public InputStream getInputStream() {
return inputStream;
@@ -72,7 +80,7 @@
// preparation de la reponse. Un toString sur une liste retourne
// la bonne syntaxe pour une reponse json :) si on triche un peu
// en ajoutant des '' pour les chaines
- List json = new ArrayList();
+ List<Object> json = new ArrayList<Object>();
List<String> completions = new ArrayList<String>();
List<String> descriptions = new ArrayList<String>();
List<String> queryUrls = new ArrayList<String>();
@@ -130,7 +138,8 @@
if (completion.startsWith(lastTag)) {
String description = _("%s results",t.getCount());
String tags = query + StringUtils.removeStart(completion, lastTag);
- String queryUrl = getConfig().getBowUrl() + BowUtils.redirectTo(tags, null);
+ getConfig();
+ String queryUrl = BowConfig.getBowUrl() + BowUtils.redirectTo(tags, null);
completions.add("'" + completion + "'");
descriptions.add("'" + description + "'");
@@ -170,7 +179,7 @@
// preparation de la reponse. Un toString sur une liste retourne
// la bonne syntaxe pour une reponse json :) si on triche un peu
// en ajoutant des '' pour les chaines
- List json = new ArrayList();
+ List<Object> json = new ArrayList<Object>();
List<String> completions = new ArrayList<String>();
List<String> descriptions = new ArrayList<String>();
List<String> queryUrls = new ArrayList<String>();
@@ -216,7 +225,6 @@
/**
* On ne renvoie aucune suggestion
*
- * @param prefix
* @param query
* @return
*/
1
0
r322 - in trunk/bow-ui/src/main: java/org/chorem/bow java/org/chorem/bow/action java/org/chorem/bow/action/bookmark resources/i18n webapp/WEB-INF/jsp webapp/WEB-INF/jsp/inc
by bpoussin@users.chorem.org 22 Aug '11
by bpoussin@users.chorem.org 22 Aug '11
22 Aug '11
Author: bpoussin
Date: 2011-08-22 13:23:47 +0200 (Mon, 22 Aug 2011)
New Revision: 322
Url: http://chorem.org/repositories/revision/bow/322
Log:
Evolution #438: Refactore source code and simplify all
- ajout de la possibilite d'avancer dans les bookmarks retrouve
- conservation de l'ordre de tri choisi par l'utilisateur
on va dire que c'est fini pour le refactore maintenant :)
Il faudra faire d'autre ticket :)
Modified:
trunk/bow-ui/src/main/java/org/chorem/bow/BookmarkUtils.java
trunk/bow-ui/src/main/java/org/chorem/bow/BowSearchResult.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/BowBaseAction.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java
trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties
trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/home.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/bookmark.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/header.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/tagsCloud.jsp
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/BookmarkUtils.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/BookmarkUtils.java 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/BookmarkUtils.java 2011-08-22 11:23:47 UTC (rev 322)
@@ -56,8 +56,8 @@
return search;
}
- static public Criteria getBookmarkListCriteriaByUser(
- BowUser user, String tagLine, String fullTextLine, String order) {
+ static public Criteria getBookmarkListCriteriaByUser(BowUser user,
+ String tagLine, String fullTextLine, String order, int first) {
Search search = Search.query();
BookmarkUtils.addEqUser(search, user.getWikittyId());
@@ -75,8 +75,10 @@
// on fixe le nombre de tag max souhaite par l'utilisateur
criteria.setFacetLimit(user.getTags());
+ criteria.setFirstIndex(first);
+
// on fixe le nombre max d'element a ce qu'a defini l'utilisateur
- criteria.setEndIndex(user.getBookmarks());
+ criteria.setEndIndex(first + user.getBookmarks() - 1);
boolean sortOrderAscending = StringUtils.startsWith(order, "asc");
String sortOrderField = null;
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/BowSearchResult.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/BowSearchResult.java 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/BowSearchResult.java 2011-08-22 11:23:47 UTC (rev 322)
@@ -54,12 +54,6 @@
private static final Log log = LogFactory.getLog(BowSearchResult.class);
- /** la ligne contenant les tags a rechercher */
- protected String tagLine;
- /** la ligne contenant le fulltext a recherche */
- protected String fullTextLine;
- /** l'ordre souhaite pour l'affichage */
- protected String order;
/** nombre total de bookmark trouve */
protected int bookmarkCount = 0;
protected List<BowBookmark> bookmarks;
@@ -74,23 +68,9 @@
* @param session la session de l'utilisateur sur lequel on peut recuperer
* le proxy et les preferences
* @param tagLine (optionel) le liste des tags a rechercher
- * @param fullTextLine (optionel) la chaine fulltext a rechercher
- * @param order (optionnel) l'ordre d'affichage du resultat
*/
- public BowSearchResult(BowSession session,
- String tagLine, String fullTextLine, String order) {
- this.tagLine = StringUtils.defaultString(tagLine);
- this.fullTextLine = StringUtils.defaultString(fullTextLine);
- this.order = StringUtils.defaultString(order);
+ public BowSearchResult(PagedResult<BowBookmark> result, String tagLine) {
- BowUser user = session.getUser();
- BowProxy proxy = session.getProxy();
-
- Criteria criteria = BookmarkUtils.getBookmarkListCriteriaByUser(
- user, tagLine, fullTextLine, order);
- PagedResult<BowBookmark> result =
- proxy.findAllByCriteria(BowBookmark.class, criteria);
-
bookmarkCount = result.getNumFound();
if (log.isDebugEnabled()) {
log.debug(String.format("Find %s items, used %s",
@@ -104,10 +84,10 @@
log.debug(String.format("There are %s tag in cloud",
CollectionUtils.isEmpty(topics)?0:topics.size()));
}
- setTagCloud(topics);
+ setTagCloud(topics, tagLine);
}
- public void setTagCloud(List<FacetTopic> cpy) {
+ protected void setTagCloud(List<FacetTopic> cpy, String excludeTag) {
tagsCloud = new ArrayList<FacetTopic>();
if (cpy != null) {
tagsCloud.addAll(cpy);
@@ -115,7 +95,7 @@
// on ne met pas dans le cloud les tags qui ont servi pour la recherche
List<FacetTopic> save = new ArrayList<FacetTopic>(tagsCloud);
// on recupere les tags dans un set pour optimiser la recherche
- Set<String> tagsSearch = BowUtils.getWords(gettagLine());
+ Set<String> tagsSearch = BowUtils.getWords(excludeTag);
for(Iterator<FacetTopic> i=tagsCloud.iterator(); i.hasNext();) {
FacetTopic topic = i.next();
@@ -143,10 +123,6 @@
}
}
- public String gettagLine() {
- return tagLine;
- }
-
public int getFont(int ti) {
int font = 1;
if (tmax > tmin) {
@@ -162,15 +138,11 @@
return tagsCloud;
}
- public Set<String> getTagsSearch() {
- return BowUtils.getWords(gettagLine());
- }
-
public List<BowBookmark> getBookmarks() {
return bookmarks;
}
- public void setBookmarks(List<BowBookmark> bookmarks) {
+ protected void setBookmarks(List<BowBookmark> bookmarks) {
this.bookmarks = new ArrayList<BowBookmark>();
if (bookmarks != null) {
this.bookmarks.addAll(bookmarks);
@@ -185,16 +157,8 @@
return tmax;
}
- public String getFullTextLine() {
- return fullTextLine;
- }
-
public int getBookmarkCount() {
return bookmarkCount;
}
- public String getOrder() {
- return order;
- }
-
}
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/BowBaseAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/BowBaseAction.java 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/BowBaseAction.java 2011-08-22 11:23:47 UTC (rev 322)
@@ -50,6 +50,7 @@
public static final String UNTRANSLATED_MARKER = "???";
+ /** Liste des valeurs de tri possible */
// perhaps use enumeration ?
final static protected List<String> possibleOrder = Arrays.asList(
"ascName", "descName", "ascClick", "descClick", "ascDate", "descDate");
@@ -58,11 +59,29 @@
return possibleOrder;
}
+ protected Map<String, Object> session;
+ /**
+ * Configuration, default null for lazy loading
+ */
protected BowConfig config = null;
- protected Map<String, Object> session;
+ /**
+ * Les tags a recherche separer par un espace
+ */
protected String tagLine;
+ /**
+ * La ligne de recherche fulltext
+ */
protected String fullTextLine;
+ /**
+ * l'ordre d'affichage des resultats
+ */
protected String order;
+ /**
+ * indice du 1er element a recuperer, on en recupere le nombre defini
+ * dans les preferences utilisateur. Par defaut on prend a partir du 1er
+ * donc l'indice 0.
+ */
+ protected int first = 0;
public BowConfig getConfig() {
if (config == null) {
@@ -121,5 +140,13 @@
public void setOrder(String order) {
this.order = order;
}
+
+ public int getFirst() {
+ return first;
+ }
+
+ public void setFirst(int first) {
+ this.first = first;
+ }
}
\ No newline at end of file
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java 2011-08-22 11:23:47 UTC (rev 322)
@@ -27,11 +27,17 @@
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.chorem.bow.BookmarkUtils;
+import org.chorem.bow.BowBookmark;
+import org.chorem.bow.BowProxy;
import org.chorem.bow.BowSearchResult;
import org.chorem.bow.BowSession;
+import org.chorem.bow.BowUser;
import org.chorem.bow.action.BowBaseAction;
import org.nuiton.util.TimeLog;
+import org.nuiton.wikitty.search.Criteria;
+import org.nuiton.wikitty.search.PagedResult;
/**
* Prepare l'affichage de la page d'accueil
@@ -87,7 +93,16 @@
}
BowSession session = getBowSession();
- searchResult = new BowSearchResult(session, tagLine, fullTextLine, order);
+
+ BowUser user = session.getUser();
+ BowProxy proxy = session.getProxy();
+
+ Criteria criteria = BookmarkUtils.getBookmarkListCriteriaByUser(
+ user, tagLine, fullTextLine, order, first);
+ PagedResult<BowBookmark> result =
+ proxy.findAllByCriteria(BowBookmark.class, criteria);
+
+ searchResult = new BowSearchResult(result, tagLine);
}
/**
Modified: trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties
===================================================================
--- trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties 2011-08-22 11:23:47 UTC (rev 322)
@@ -126,14 +126,15 @@
bow.rightMenu.bookmark.temporaryLinkDescription=Add this link to your favourites to bookmark others in the future. This link is only available while you are connected on the site\!
bow.rightMenu.chromiumExtension=Chromium extension
bow.rightMenu.extensions=Extensions
-bow.rightMenu.externSearchEngine=Web search
+bow.rightMenu.externSearchEngine=Web
bow.rightMenu.find.submit=Find
-bow.rightMenu.fullTextSearch=Full text search
+bow.rightMenu.fullTextSearch=Full text
bow.rightMenu.help=Help
bow.rightMenu.import.submit=Import
bow.rightMenu.importBookmarks=Import bookmarks
bow.rightMenu.logout=Logout
-bow.rightMenu.search.tags=Search by tags
+bow.rightMenu.search=Search
+bow.rightMenu.search.tags=by tags
bow.rightMenu.token.permanent=Permanent token id
bow.rightMenu.token.temporary=Session token id
bow.search.ascclick=Asc. clicks nb
Modified: trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties
===================================================================
--- trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties 2011-08-22 11:23:47 UTC (rev 322)
@@ -126,14 +126,15 @@
bow.rightMenu.bookmark.temporaryLinkDescription=Ajoutez ce lien \u00E0 vos favoris pour pouvoir bookmarker vos liens dans le futur. Ce lien est seulement disponible tant que vous \u00EAtes connect\u00E9 sur le site \!
bow.rightMenu.chromiumExtension=Extension pour chromium
bow.rightMenu.extensions=Extensions
-bow.rightMenu.externSearchEngine=Recherche Web
+bow.rightMenu.externSearchEngine=Web
bow.rightMenu.find.submit=Rechercher
-bow.rightMenu.fullTextSearch=Recherche full text
+bow.rightMenu.fullTextSearch=full text
bow.rightMenu.help=Aide
bow.rightMenu.import.submit=Importer
bow.rightMenu.importBookmarks=Importer des marque-pages
bow.rightMenu.logout=D\u00E9connexion
-bow.rightMenu.search.tags=Recherche par tags
+bow.rightMenu.search=Recherche
+bow.rightMenu.search.tags=par tags
bow.rightMenu.token.permanent=Token permanent
bow.rightMenu.token.temporary=Token session
bow.search.ascclick=Nb clics asc.
Modified: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/home.jsp
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/home.jsp 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/home.jsp 2011-08-22 11:23:47 UTC (rev 322)
@@ -37,15 +37,35 @@
<body>
<div class="menu clearfix">
<h2>
- <s:text name="bow.search.found" />
- <s:property value="%{searchResult.bookmarkCount}"/>
+ <s:if test="first - bowSession.user.bookmarks >= 0">
+ <s:url var="prev" action="home">
+ <s:param name="tagLine" value="%{tagLine}" />
+ <s:param name="fullTextLine" value="%{fullTextLine}" />
+ <s:param name="order" value="%{order}"/>
+ <s:param name="first" value="%{first - bowSession.user.bookmarks}"/>
+ </s:url>
+ <s:a href="%{prev}"><<</s:a>
+ </s:if>
+
+ <s:property value="%{first+1}"/>-<s:property value="%{first + bowSession.user.bookmarks}"/>/<s:property value="%{searchResult.bookmarkCount}"/>
+
+ <s:if test="first + bowSession.user.bookmarks < searchResult.bookmarkCount">
+ <s:url var="next" action="home">
+ <s:param name="tagLine" value="%{tagLine}" />
+ <s:param name="fullTextLine" value="%{fullTextLine}" />
+ <s:param name="order" value="%{order}"/>
+ <s:param name="first" value="%{first + bowSession.user.bookmarks}"/>
+ </s:url>
+ <s:a href="%{next}">>></s:a>
+ </s:if>
</h2>
<s:set name="bookmarksToDelete" value="%{searchResult.bookmarkCount}" />
<s:if test="%{#bookmarksToDelete > 0}">
<s:url var="deleteSearchResults" action="deleteSearchResults" escapeAmp="false">
- <s:param name="tagLine"><s:property value="searchResult.tagLine" /></s:param>
- <s:param name="fullTextLine"><s:property value="searchResult.fullTextLine" /></s:param>
+ <s:param name="tagLine" value="%{tagLine}" />
+ <s:param name="fullTextLine" value="%{fullTextLine}" />
+ <s:param name="order" value="%{order}"/>
</s:url>
<s:a id="deleteSearchResultsButton" title="delete all" href="" onclick="deleteConfirmation('%{deleteSearchResults}', %{#bookmarksToDelete}); return(false);"></s:a>
</s:if>
@@ -53,8 +73,9 @@
<label for="order"><s:text name="bow.search.orderby" /></label>
<s:select id="order" name="order" list="possibleOrder"/>
<s:submit key="bow.search.submit" name="submit" />
- <s:hidden name="tagLine" value="%{searchResult.tagLine}" />
- <s:hidden name="fullTextLine" value="%{searchResult.fullTextLine}" />
+ <s:hidden name="tagLine" value="%{tagLine}" />
+ <s:hidden name="fullTextLine" value="%{fullTextLine}" />
+ <s:hidden name="first" value="%{first}" />
</s:form>
</div>
<div class="content">
@@ -64,10 +85,7 @@
<s:else>
<s:iterator value="searchResult.bookmarks" var="bookmark">
<s:set name="bookmark" value="bookmark"/>
- <jsp:include page="inc/bookmark.jsp" flush="true">
- <jsp:param name="tagLine" value="%{searchResult.tagLine}" />
- <jsp:param name="fullTextLine" value="%{searchResult.fullTextLine}" />
- </jsp:include>
+ <jsp:include page="inc/bookmark.jsp" flush="true"/>
</s:iterator>
</s:else>
</div>
Modified: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/bookmark.jsp
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/bookmark.jsp 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/bookmark.jsp 2011-08-22 11:23:47 UTC (rev 322)
@@ -42,16 +42,20 @@
</s:a>
</s:if>
<s:url var="editBookmark" action="editBookmark" escapeAmp="true">
- <s:param name="id"><s:property value="%{#bookmark.wikittyId}" /></s:param>
- <s:param name="tagLine"><s:property value="%{tagLine}" /></s:param>
- <s:param name="fullTextLine"><s:property value="%{fullTextLine}" /></s:param>
+ <s:param name="id" value="%{#bookmark.wikittyId}" />
+ <s:param name="tagLine" value="%{tagLine}" />
+ <s:param name="fullTextLine" value="%{fullTextLine}" />
+ <s:param name="order" value="%{order}"/>
+ <s:param name="first" value="%{first}"/>
</s:url>
<s:a cssClass="edit" href="%{editBookmark}"/>
<s:url var="removeBookmark" action="removeBookmark" escapeAmp="true">
- <s:param name="bookmarkId"><s:property value="%{#bookmark.wikittyId}" /></s:param>
- <s:param name="tagLine"><s:property value="%{tagLine}" /></s:param>
- <s:param name="fullTextLine"><s:property value="%{fullTextLine}" /></s:param>
+ <s:param name="bookmarkId" value="%{#bookmark.wikittyId}" />
+ <s:param name="tagLine" value="%{tagLine}" />
+ <s:param name="fullTextLine" value="%{fullTextLine}" />
+ <s:param name="order" value="%{order}"/>
+ <s:param name="first" value="%{first}"/>
</s:url>
<s:a cssClass="supprim" href="%{removeBookmark}"
onclick="return deleteConfirmation('%{#removeBookmark}','%{#bookmark.link}');"></s:a>
@@ -71,9 +75,11 @@
<strong><s:text name="bow.bookmark.tags" /> :</strong>
<s:iterator value="#bookmark.labels" var="tag">
<s:url var="search" action="home">
+ <s:param name="addTag" value="%{#tag}"/>
<s:param name="tagLine" value="%{tagLine}"/>
- <s:param name="addTag" value="%{#tag}"/>
<s:param name="fullTextLine" value="%{fullTextLine}"/>
+ <s:param name="order" value="%{order}"/>
+ <%-- on ne met pas 'first', il faut repartir de 0 --%>
</s:url>
<s:a href="%{search}" cssClass="tag"><s:property value="%{#tag}"/></s:a>
</s:iterator>
Modified: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/header.jsp
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/header.jsp 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/header.jsp 2011-08-22 11:23:47 UTC (rev 322)
@@ -29,7 +29,7 @@
<div>
<s:if test="%{#session.BowSession.user != null}">
<s:url var="homeToken" action="home">
- <s:param name="token"><s:property value="%{#session.BowSession.getPermanentToken()}" /></s:param>
+ <s:param name="token" value="%{#session.BowSession.getPermanentToken()}" />
</s:url>
<s:a cssClass="logo" href="%{homeToken}">bow</s:a>
</s:if>
@@ -39,16 +39,18 @@
</div>
<s:if test="%{#session.BowSession.user != null}">
<div class="recherche right">
- <h3>Recherche</h3>
+ <h3><s:text name="bow.rightMenu.search" /></h3>
<div class="input">
<s:form action="home" theme="simple">
<s:textfield name="tagLine" labelSeparator="" />
+ <s:hidden name="order" value="%{order}"/>
<s:submit key="bow.rightMenu.search.tags" name="submit" />
</s:form>
</div>
<div class="input">
<s:form action="home" theme="simple">
<s:textfield name="fullTextLine" labelSeparator="" />
+ <s:hidden name="order" value="%{order}"/>
<s:submit key="bow.rightMenu.fullTextSearch" name="submit" />
</s:form>
</div>
Modified: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp 2011-08-22 11:23:47 UTC (rev 322)
@@ -54,6 +54,8 @@
<s:url var="editBookmark" action="editBookmark" escapeAmp="true">
<s:param name="tagLine"><s:property value="%{tagLine}" /></s:param>
<s:param name="fullTextLine"><s:property value="%{fullTextLine}" /></s:param>
+ <s:param name="order" value="%{order}"/>
+ <s:param name="first" value="%{first}"/>
</s:url>
<s:a href="%{editBookmark}">
<s:text name="bow.rightMenu.addUrl.link" />
@@ -61,10 +63,7 @@
</li>
</ul>
<!--div id="nuage"-->
- <jsp:include page="tagsCloud.jsp" flush="true">
- <jsp:param name="tagLine" value="%{tagLine}" />
- <jsp:param name="fullTextLine" value="%{fullTextLine}"/>
- </jsp:include>
+ <jsp:include page="tagsCloud.jsp" flush="true"/>
<!--/div-->
<div class="colonnebas">
<img src="img/piedmenu.jpg" width="401" height="77" alt="Pied de menu" />
Modified: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/tagsCloud.jsp
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/tagsCloud.jsp 2011-08-22 10:13:04 UTC (rev 321)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/tagsCloud.jsp 2011-08-22 11:23:47 UTC (rev 322)
@@ -29,9 +29,11 @@
xmlns:jsp="http://java.sun.com/JSP/Page">
<s:iterator value="%{searchResult.tagsCloud}" status="tagStatus" var="tag">
<s:url var="search" action="home" escapeAmp="true">
+ <s:param name="addTag" value="%{#tag.topicName}"/>
<s:param name="tagLine" value="%{tagLine}"/>
- <s:param name="addTag" value="%{#tag.topicName}"/>
<s:param name="fullTextLine" value="%{fullTextLine}"/>
+ <s:param name="order" value="%{order}"/>
+ <%-- on ne met pas 'first', il faut repartir de 0 --%>
</s:url>
<!-- -->
<s:a href="%{search}" title="%{#tag.count} results" cssClass="tag"
1
0
Author: bpoussin
Date: 2011-08-22 12:13:04 +0200 (Mon, 22 Aug 2011)
New Revision: 321
Url: http://chorem.org/repositories/revision/bow/321
Log:
Evolution #430: Permit search prefix configurable for each user
- when we change the model, we must change tagValue version
Modified:
trunk/bow-ui/src/main/xmi/bow.zargo
Modified: trunk/bow-ui/src/main/xmi/bow.zargo
===================================================================
(Binary files differ)
1
0
r320 - in trunk/bow-ui/src/main: java/org/chorem/bow java/org/chorem/bow/action/opensearch java/org/chorem/bow/action/preference resources resources/i18n webapp/WEB-INF/jsp
by bpoussin@users.chorem.org 22 Aug '11
by bpoussin@users.chorem.org 22 Aug '11
22 Aug '11
Author: bpoussin
Date: 2011-08-22 03:22:06 +0200 (Mon, 22 Aug 2011)
New Revision: 320
Url: http://chorem.org/repositories/revision/bow/320
Log:
Evolution #430: Permit search prefix configurable for each user
- all is done (backend and ui) (ui with beurk table, but i have no more time :()
Modified:
trunk/bow-ui/src/main/java/org/chorem/bow/BowSession.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchBaseAction.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchResultAction.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/PreferenceBaseAction.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/UpdateSiteAction.java
trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties
trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties
trunk/bow-ui/src/main/resources/struts.xml
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/preferences.jsp
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/BowSession.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/BowSession.java 2011-08-21 18:31:08 UTC (rev 319)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/BowSession.java 2011-08-22 01:22:06 UTC (rev 320)
@@ -134,7 +134,7 @@
preference.setPrefixSeparator(BowConfig.getPrefixSeparator());
}
if (StringUtils.isBlank(preference.getTagSearchPrefix())) {
- preference.setPrefixSeparator(BowConfig.getTagSearchPrefix());
+ preference.setTagSearchPrefix(BowConfig.getTagSearchPrefix());
}
if (StringUtils.isBlank(preference.getFullTextSearchPrefix())) {
preference.setFullTextSearchPrefix(BowConfig.getFullTextSearchPrefix());
@@ -145,6 +145,9 @@
if (StringUtils.isBlank(preference.getAliasPrefix())) {
preference.setAliasPrefix(BowConfig.getAliasPrefix());
}
+ if (StringUtils.isBlank(preference.getDefaultPrefix())) {
+ preference.setDefaultPrefix(BowConfig.getDefaultPrefix());
+ }
if (StringUtils.isBlank(preference.getDefaultAction())) {
preference.setDefaultAction(BowConfig.getDefaultAction());
}
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchBaseAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchBaseAction.java 2011-08-21 18:31:08 UTC (rev 319)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchBaseAction.java 2011-08-22 01:22:06 UTC (rev 320)
@@ -24,6 +24,8 @@
package org.chorem.bow.action.opensearch;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.chorem.bow.BowUser;
import org.chorem.bow.action.BowBaseAction;
@@ -37,6 +39,10 @@
* @author poussin
*/
abstract public class OpenSearchBaseAction extends BowBaseAction {
+
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(OpenSearchBaseAction.class);
+
private static final long serialVersionUID = 1L;
/** [in] le token d'identification */
@@ -95,14 +101,25 @@
prefix = StringUtils.substringBefore(searchLine, prefixSeparator);
String query = StringUtils.substringAfter(searchLine, prefixSeparator);
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Cut '%s' with '%s' result is '%s' and '%s'",
+ searchLine, prefixSeparator, prefix, query));
+ }
+
if (StringUtils.isEmpty(prefix)) {
// on a le separateur mais pas de prefix
prefix = user.getDefaultPrefix();
- } else if (StringUtils.equals(searchLine, query)) {
+ } else if (StringUtils.equals(searchLine, prefix)) {
// on a pas de separateur
prefix = user.getDefaultAction();
+ query = searchLine;
}
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Prefix is '%s' and query '%s'",
+ prefix, query));
+ }
+
String result = SUCCESS;
if (StringUtils.equals(prefix, user.getTagSearchPrefix())) {
result = executeTagSearchAction(query);
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchResultAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchResultAction.java 2011-08-21 18:31:08 UTC (rev 319)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchResultAction.java 2011-08-22 01:22:06 UTC (rev 320)
@@ -26,6 +26,8 @@
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.chorem.bow.BowBookmark;
import org.chorem.bow.BowConfig;
@@ -42,6 +44,9 @@
* @author poussin
*/
public class OpenSearchResultAction extends OpenSearchBaseAction implements ServletResponseAware {
+ /** to use log facility, just put in your code: log.info(\"...\"); */
+ static private Log log = LogFactory.getLog(OpenSearchResultAction.class);
+
private static final long serialVersionUID = 1L;
protected String redirectTo;
@@ -60,12 +65,12 @@
}
protected String executeTagSearchAction(String query) {
- redirectTo = BowUtils.redirectTo(searchLine, null);
+ redirectTo = BowUtils.redirectTo(query, null);
return SUCCESS;
}
protected String executeFulltextSearchAction(String query) {
- redirectTo = BowUtils.redirectTo(null, searchLine);
+ redirectTo = BowUtils.redirectTo(null, query);
return SUCCESS;
}
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/PreferenceBaseAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/PreferenceBaseAction.java 2011-08-21 18:31:08 UTC (rev 319)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/PreferenceBaseAction.java 2011-08-22 01:22:06 UTC (rev 320)
@@ -32,6 +32,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang.StringUtils;
import org.chorem.bow.BowImport;
import org.chorem.bow.BowSession;
@@ -57,27 +58,38 @@
return (PreferenceBaseAction) action;
}
+ public static enum DefaultPrefix {TAG, FULLTEXT, WEB, ALIAS};
+
/** la liste des differentes data que l'on peut charger */
- protected enum PreferenceType{USER_PREF, SITE_PREF, LABELS, IMPORTS};
+ protected static enum PreferenceType{USER_PREF, SITE_PREF, LABELS, IMPORTS};
+ protected String email;
+ protected String newPassword;
+ protected String currentPassword;
+ protected String confirmNewPassword;
+
protected String colors;
protected String tagsNb;
protected String bookmarksHomePage;
protected String searchEngineUrlSuggestions;
protected String searchEngineUrlResults;
- protected String email;
- protected String newPassword;
- protected String currentPassword;
- protected String confirmNewPassword;
- protected String update;
- protected Map<String, Integer> bookmarksImportDate;
-
+ protected String separator;
+ protected String tagPrefix;
+ protected String fulltextPrefix;
+ protected String webPrefix;
+ protected String aliasPrefix;
+ protected DefaultPrefix defaultPrefix;
+ protected DefaultPrefix defaultAction;
+
protected List<FacetTopic> labels;
protected String[] selectedLabels;
protected String rename;
protected String delete;
protected String newLabel;
+ protected String update;
+ protected Map<String, Integer> bookmarksImportDate;
+
public String getNewLabel() {
return newLabel;
}
@@ -172,6 +184,62 @@
this.searchEngineUrlResults = searchEngineUrlResults;
}
+ public String getSeparator() {
+ return separator;
+ }
+
+ public void setSeparator(String separator) {
+ this.separator = separator;
+ }
+
+ public String getTagPrefix() {
+ return tagPrefix;
+ }
+
+ public void setTagPrefix(String tagPrefix) {
+ this.tagPrefix = tagPrefix;
+ }
+
+ public String getFulltextPrefix() {
+ return fulltextPrefix;
+ }
+
+ public void setFulltextPrefix(String fulltextPrefix) {
+ this.fulltextPrefix = fulltextPrefix;
+ }
+
+ public String getWebPrefix() {
+ return webPrefix;
+ }
+
+ public void setWebPrefix(String webPrefix) {
+ this.webPrefix = webPrefix;
+ }
+
+ public String getAliasPrefix() {
+ return aliasPrefix;
+ }
+
+ public void setAliasPrefix(String aliasPrefix) {
+ this.aliasPrefix = aliasPrefix;
+ }
+
+ public DefaultPrefix getDefaultPrefix() {
+ return defaultPrefix;
+ }
+
+ public void setDefaultPrefix(String defaultPrefix) {
+ this.defaultPrefix = DefaultPrefix.valueOf(defaultPrefix);
+ }
+
+ public DefaultPrefix getDefaultAction() {
+ return defaultAction;
+ }
+
+ public void setDefaultAction(String defaultAction) {
+ this.defaultAction = DefaultPrefix.valueOf(defaultAction);
+ }
+
/**
* @return the email
*/
@@ -335,13 +403,62 @@
BowSession session = getBowSession();
BowUser user = session.getUser();
+ if(log.isDebugEnabled()) {
+ log.debug("Load site pref for " + user);
+ }
+
setColors(user.getColors());
setTagsNb(String.valueOf(user.getTags()));
setBookmarksHomePage(String.valueOf(user.getBookmarks()));
setSearchEngineUrlSuggestions(user.getSearchEngineUrlSuggestions());
setSearchEngineUrlResults(user.getSearchEngineUrlResults());
+
+ setSeparator(user.getPrefixSeparator());
+ setTagPrefix(user.getTagSearchPrefix());
+ setFulltextPrefix(user.getFullTextSearchPrefix());
+ setWebPrefix(user.getWebSearchPrefix());
+ setAliasPrefix(user.getAliasPrefix());
+
+ defaultAction = getDefaultConst(user, user.getDefaultAction());
+ defaultPrefix = getDefaultConst(user, user.getDefaultPrefix());
+
}
+ protected String getDefaultValue(BowUser user, DefaultPrefix constValue) {
+ String result = user.getAliasPrefix();
+ switch(constValue) {
+ case TAG:
+ result = user.getTagSearchPrefix();
+ break;
+ case FULLTEXT:
+ result = user.getFullTextSearchPrefix();
+ break;
+ case WEB:
+ result = user.getWebSearchPrefix();
+ break;
+ case ALIAS:
+ result = user.getAliasPrefix();
+ break;
+ default:
+ break;
+ }
+ return result;
+ }
+
+ protected DefaultPrefix getDefaultConst(BowUser user, String value) {
+ DefaultPrefix result = DefaultPrefix.ALIAS;
+ if (StringUtils.equals(value, user.getTagSearchPrefix())) {
+ result = DefaultPrefix.TAG;
+ } else if (StringUtils.equals(value, user.getFullTextSearchPrefix())) {
+ result = DefaultPrefix.FULLTEXT;
+ } else if (StringUtils.equals(value, user.getWebSearchPrefix())) {
+ result = DefaultPrefix.WEB;
+ } else if (StringUtils.equals(value, user.getAliasPrefix())) {
+ result = DefaultPrefix.ALIAS;
+ }
+ return result;
+ }
+
/**
* Charge la liste des imports que l'utilisateur a fait
*/
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/UpdateSiteAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/UpdateSiteAction.java 2011-08-21 18:31:08 UTC (rev 319)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/UpdateSiteAction.java 2011-08-22 01:22:06 UTC (rev 320)
@@ -45,6 +45,16 @@
preference.setSearchEngineUrlSuggestions(searchEngineUrlSuggestions);
preference.setSearchEngineUrlResults(searchEngineUrlResults);
+ preference.setPrefixSeparator(separator);
+
+ preference.setTagSearchPrefix(tagPrefix);
+ preference.setFullTextSearchPrefix(fulltextPrefix);
+ preference.setWebSearchPrefix(webPrefix);
+ preference.setAliasPrefix(aliasPrefix);
+
+ preference.setDefaultAction(getDefaultValue(preference, defaultAction));
+ preference.setDefaultPrefix(getDefaultValue(preference, defaultPrefix));
+
preference = proxy.store(preference);
getBowSession().setUser(preference);
} catch (Exception eee) {
Modified: trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties
===================================================================
--- trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties 2011-08-21 18:31:08 UTC (rev 319)
+++ trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties 2011-08-22 01:22:06 UTC (rev 320)
@@ -65,6 +65,7 @@
bow.login.title=Login
bow.mail.badFormat=Your email format is incorrect and therefore the email hasn't been sent
bow.mail.sendError=An error occurred while sending email
+bow.preference.opensearch.prefix.separator=
bow.preferences.badCurrentPassword=Your current password is incorrect
bow.preferences.bookmarksHomePage=Number of bookmarks displayed on the home page
bow.preferences.colors=Site color
@@ -82,6 +83,15 @@
bow.preferences.labels.rename.submit=Rename
bow.preferences.newPassword=New password
bow.preferences.noImportedBookmarks=No imported bookmarks
+bow.preferences.opensearch.alias.prefix=Alias
+bow.preferences.opensearch.default.action=Default action
+bow.preferences.opensearch.default.prefix=Default prefix
+bow.preferences.opensearch.fulltext.search.prefix=Search fulltext
+bow.preferences.opensearch.prefix=Prefix
+bow.preferences.opensearch.prefix.separator=Prefix seperator
+bow.preferences.opensearch.tag.search.prefix=Search by tag
+bow.preferences.opensearch.value=Value
+bow.preferences.opensearch.web.search.prefix=Search on the Web
bow.preferences.regenPermToken=Regenerate permanent token
bow.preferences.searchEngineUrlResults=Search Engine URL Results ('{'searchTerms'}' will be replaced by your text)
bow.preferences.searchEngineUrlSuggestions=Search Engine URL Suggestions
Modified: trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties
===================================================================
--- trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties 2011-08-21 18:31:08 UTC (rev 319)
+++ trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties 2011-08-22 01:22:06 UTC (rev 320)
@@ -31,10 +31,10 @@
bow.config.bow.url.description=
bow.config.configFileName.description=
bow.config.data.dir.description=
-bow.config.opensearch.alias.prefix.description=
-bow.config.opensearch.default.action.description=
-bow.config.opensearch.default.prefix.description=
-bow.config.opensearch.fulltext.search.prefix.description=
+bow.config.opensearch.alias.prefix.description=Prefix d'alias
+bow.config.opensearch.default.action.description=action par d\u00E9faut
+bow.config.opensearch.default.prefix.description=Prefix par d\u00E9faut
+bow.config.opensearch.fulltext.search.prefix.description=Fulltext
bow.config.opensearch.prefix.separator.description=
bow.config.opensearch.tag.search.prefix.description=
bow.config.opensearch.web.search.prefix.description=
@@ -52,7 +52,7 @@
bow.home.title=Accueil
bow.label.locale.english=
bow.label.locale.french=
-bow.login.admin.failback=Probl\u00E8me d''authentification, vous devriez reconstruire l''index via la page d'admin
+bow.login.admin.failback=Probl\u00E8me d'authentification, vous devriez reconstruire l'index via la page d'admin
bow.login.authenticationFailure=Soit votre adresse email n''existe pas, soit votre mot de passe est eronn\u00E9
bow.login.email=Email
bow.login.email.required=Veuillez entrer votre adresse email
@@ -65,6 +65,7 @@
bow.login.title=Connexion
bow.mail.badFormat=Votre adresse email est mal form\u00E9e \: aucun mail n''a pu \u00EAtre envoy\u00E9
bow.mail.sendError=Une erreur s''est produite lors de l''envoi du mail
+bow.preference.opensearch.prefix.separator=
bow.preferences.badCurrentPassword=Votre mot de passe actuel est incorrect
bow.preferences.bookmarksHomePage=Nombre de marque-pages affich\u00E9s
bow.preferences.colors=Couleur du site
@@ -82,6 +83,15 @@
bow.preferences.labels.rename.submit=Renomer
bow.preferences.newPassword=Nouveau mot de passe
bow.preferences.noImportedBookmarks=Aucun marque-page import\u00E9
+bow.preferences.opensearch.alias.prefix=Alias
+bow.preferences.opensearch.default.action=action par d\u00E9faut
+bow.preferences.opensearch.default.prefix=Prefix par d\u00E9faut
+bow.preferences.opensearch.fulltext.search.prefix=Recherche Fulltext
+bow.preferences.opensearch.prefix=Pr\u00E9fix
+bow.preferences.opensearch.prefix.separator=S\u00E9parateur de pr\u00E9fix
+bow.preferences.opensearch.tag.search.prefix=Recherche par tag
+bow.preferences.opensearch.value=Valeur
+bow.preferences.opensearch.web.search.prefix=Recherche Web
bow.preferences.regenPermToken=Reg\u00E9n\u00E9rer le token permanent
bow.preferences.searchEngineUrlResults=Search Engine URL Results ('{'searchTerms'}' sera remplac\u00E9 par votre recherche)
bow.preferences.searchEngineUrlSuggestions=Search Engine URL Suggestions
Modified: trunk/bow-ui/src/main/resources/struts.xml
===================================================================
--- trunk/bow-ui/src/main/resources/struts.xml 2011-08-21 18:31:08 UTC (rev 319)
+++ trunk/bow-ui/src/main/resources/struts.xml 2011-08-22 01:22:06 UTC (rev 320)
@@ -99,21 +99,21 @@
<action name="alias/*" class="org.chorem.bow.action.AliasAction">
<param name="alias">{1}</param>
<result name="success" type="redirect">${redirectTo}</result>
- <result name="error">/jsp/error.jsp</result>
+ <result name="error">/WEB-INF/jsp/error.jsp</result>
</action>
</package>
<package name="login" extends="loginArea">
<action name="register_*" method="{1}" class="org.chorem.bow.action.login.RegisterAction">
- <result name="input">/jsp/register.jsp</result>
+ <result name="input">/WEB-INF/jsp/register.jsp</result>
<result type="redirectAction">home</result>
</action>
<action name="forgotPassword_*" method="{1}" class="org.chorem.bow.action.login.ForgotPasswordAction">
- <result name="input">/jsp/forgotPassword.jsp</result>
+ <result name="input">/WEB-INF/jsp/forgotPassword.jsp</result>
<result type="redirectAction">login_input</result>
</action>
<action name="login_*" method="{1}" class="org.chorem.bow.action.login.LoginAction">
- <result name="input">/jsp/login.jsp</result>
+ <result name="input">/WEB-INF/jsp/login.jsp</result>
<result name="login" type="redirectAction">home</result>
<result type="redirectAction">home</result>
</action>
@@ -124,19 +124,19 @@
<package name="bookmark" extends="restrictedArea">
<action name="home" class="org.chorem.bow.action.bookmark.HomeAction">
- <result name="error">/jsp/home.jsp</result>
- <result>/jsp/home.jsp</result>
+ <result name="error">/WEB-INF/jsp/home.jsp</result>
+ <result>/WEB-INF/jsp/home.jsp</result>
</action>
<action name="removeBookmark" class="org.chorem.bow.action.bookmark.RemoveAction">
<result name="error" type="redirect">${redirectTo}</result>
<result type="redirect">${redirectTo}</result>
</action>
<action name="editBookmark" class="org.chorem.bow.action.bookmark.EditAction">
- <result name="error">/jsp/editBookmark.jsp</result>
- <result>/jsp/editBookmark.jsp</result>
+ <result name="error">/WEB-INF/jsp/editBookmark.jsp</result>
+ <result>/WEB-INF/jsp/editBookmark.jsp</result>
</action>
<action name="addUrl" class="org.chorem.bow.action.bookmark.AddOrUpdateAction">
- <result name="error">/jsp/editBookmark.jsp</result>
+ <result name="error">/WEB-INF/jsp/editBookmark.jsp</result>
<result type="redirect">${redirectTo}</result>
</action>
<action name="deleteSearchResults" class="org.chorem.bow.action.bookmark.DeleteSearchResultsAction">
@@ -148,17 +148,17 @@
<!-- Fragment: en prevision de faire un peu d'ajax si l'utilisateur le souhaite -->
<package name="fragment" namespace="/fragment" extends="restrictedArea">
<action name="editBookmark" class="org.chorem.bow.action.bookmark.EditAction">
- <result name="error">/jsp/editBookmark.jsp</result>
- <result>/jsp/editBookmark.jsp</result>
+ <result name="error">/WEB-INF/jsp/editBookmark.jsp</result>
+ <result>/WEB-INF/jsp/editBookmark.jsp</result>
</action>
</package>
<package name="search" extends="restrictedArea">
- <action name="openSearchResult" class="org.chorem.bow.action.OpenSearchResultAction">
+ <action name="openSearchResult" class="org.chorem.bow.action.opensearch.OpenSearchResultAction">
<result type="redirect">${redirectTo}</result>
</action>
- <action name="openSearchSuggestion" class="org.chorem.bow.action.OpenSearchSuggestionAction">
-<!-- <result>/jsp/suggestions.jsp</result> -->
+ <action name="openSearchSuggestion" class="org.chorem.bow.action.opensearch.OpenSearchSuggestionAction">
+<!-- <result>/WEB-INF/jsp/suggestions.jsp</result> -->
<result type="stream">
<param name="contentType">application/x-suggestions+json</param>
<param name="inputName">inputStream</param>
@@ -167,52 +167,52 @@
</result>
</action>
<action name="*Xml">
- <result>/jsp/{1}Xml.jsp</result>
+ <result>/WEB-INF/jsp/{1}Xml.jsp</result>
</action>
</package>
<package name="preference" extends="restrictedArea">
<action name="locale" class="org.chorem.bow.action.LocaleAction">
- <result type="redirect">/jsp/login.jsp</result>
+ <result type="redirect">/WEB-INF/jsp/login.jsp</result>
</action>
<action name="preferences" class="org.chorem.bow.action.preference.PreferenceBaseAction" method="input">
- <result name="error">/jsp/preferences.jsp</result>
- <result>/jsp/preferences.jsp</result>
+ <result name="error">/WEB-INF/jsp/preferences.jsp</result>
+ <result>/WEB-INF/jsp/preferences.jsp</result>
</action>
<action name="generateToken" class="org.chorem.bow.action.preference.GenerateTokenAction">
- <result name="error">/jsp/preferences.jsp</result>
- <result>/jsp/preferences.jsp</result>
+ <result name="error">/WEB-INF/jsp/preferences.jsp</result>
+ <result>/WEB-INF/jsp/preferences.jsp</result>
</action>
<action name="updateUserPref" class="org.chorem.bow.action.preference.UpdateUserAction">
- <result name="error">/jsp/preferences.jsp</result>
- <result>/jsp/preferences.jsp</result>
+ <result name="error">/WEB-INF/jsp/preferences.jsp</result>
+ <result>/WEB-INF/jsp/preferences.jsp</result>
</action>
<action name="updateSitePref" class="org.chorem.bow.action.preference.UpdateSiteAction">
- <result name="error">/jsp/preferences.jsp</result>
- <result>/jsp/preferences.jsp</result>
+ <result name="error">/WEB-INF/jsp/preferences.jsp</result>
+ <result>/WEB-INF/jsp/preferences.jsp</result>
</action>
<action name="adminlabels" class="org.chorem.bow.action.preference.AdminTagAction">
- <result name="error">/jsp/preferences.jsp</result>
- <result>/jsp/preferences.jsp</result>
+ <result name="error">/WEB-INF/jsp/preferences.jsp</result>
+ <result>/WEB-INF/jsp/preferences.jsp</result>
</action>
<action name="deleteImport" class="org.chorem.bow.action.preference.DeleteImportAction">
- <result name="error">/jsp/preferences.jsp</result>
- <result>/jsp/preferences.jsp</result>
+ <result name="error">/WEB-INF/jsp/preferences.jsp</result>
+ <result>/WEB-INF/jsp/preferences.jsp</result>
</action>
<action name="importBookmarks" class="org.chorem.bow.action.preference.ImportBookmarksAction">
- <result name="error">/jsp/preferences.jsp</result>
- <result>/jsp/preferences.jsp</result>
+ <result name="error">/WEB-INF/jsp/preferences.jsp</result>
+ <result>/WEB-INF/jsp/preferences.jsp</result>
</action>
<action name="exportBookmarks" class="org.chorem.bow.action.preference.ExportBookmarksAction">
- <result name="error">/jsp/preferences.jsp</result>
+ <result name="error">/WEB-INF/jsp/preferences.jsp</result>
<result type="stream">
<param name="contentType">text/html</param>
<param name="inputName">inputStream</param>
@@ -223,16 +223,16 @@
<package name="admin" extends="restrictedArea">
<action name="admin">
- <result name="error">/jsp/login.jsp</result>
- <result>/jsp/admin.jsp</result>
+ <result name="error">/WEB-INF/jsp/login.jsp</result>
+ <result>/WEB-INF/jsp/admin.jsp</result>
</action>
<action name="reIndexation" class="org.chorem.bow.action.admin.ReIndexationAction">
- <result name="error">/jsp/admin.jsp</result>
- <result>/jsp/admin.jsp</result>
+ <result name="error">/WEB-INF/jsp/admin.jsp</result>
+ <result>/WEB-INF/jsp/admin.jsp</result>
</action>
<action name="migrateData" class="org.chorem.bow.action.admin.MigrateDataAction">
- <result name="error">/jsp/admin.jsp</result>
- <result>/jsp/admin.jsp</result>
+ <result name="error">/WEB-INF/jsp/admin.jsp</result>
+ <result>/WEB-INF/jsp/admin.jsp</result>
</action>
</package>
</struts>
Modified: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/preferences.jsp
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/preferences.jsp 2011-08-21 18:31:08 UTC (rev 319)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/preferences.jsp 2011-08-22 01:22:06 UTC (rev 320)
@@ -21,9 +21,16 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
#L%
--%>
+<%@page import="org.chorem.bow.action.preference.PreferenceBaseAction"%>
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>
+<%
+PreferenceBaseAction action = PreferenceBaseAction.getAction();
+PreferenceBaseAction.DefaultPrefix defaultAction = action.getDefaultAction();
+PreferenceBaseAction.DefaultPrefix defaultPrefix = action.getDefaultPrefix();
+%>
+
<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
xmlns:jsp="http://java.sun.com/JSP/Page">
<head>
@@ -119,6 +126,50 @@
size="50"
labelposition="top"/><br/>
+ <s:text name="bow.preference.opensearch.prefix.separator"/>
+ <s:textfield name="separator" size="1" maxLength="1"/><br/>
+
+ <table>
+ <tr>
+ <th><s:text name="bow.preferences.opensearch.prefix"/></th>
+ <th><s:text name="bow.preferences.opensearch.value"/></th>
+ <th><s:text name="bow.preferences.opensearch.default.prefix"/></th>
+ <th><s:text name="bow.preferences.opensearch.default.action"/></th>
+ </tr>
+ <tr>
+ <td><s:text name="bow.preferences.opensearch.tag.search.prefix"/></td>
+ <td><s:textfield name="tagPrefix" size="1" maxLength="1"/></td>
+ <td><input type="radio" name="defaultPrefix" value="<%=PreferenceBaseAction.DefaultPrefix.TAG%>"
+ <%=(defaultPrefix==PreferenceBaseAction.DefaultPrefix.TAG?"checked='true'":"")%>/></td>
+ <td><input type="radio" name="defaultAction" value="<%=PreferenceBaseAction.DefaultPrefix.TAG%>"
+ <%=(defaultAction==PreferenceBaseAction.DefaultPrefix.TAG?"checked='true'":"")%>/></td>
+ </tr>
+ <tr>
+ <td><s:text name="bow.preferences.opensearch.fulltext.search.prefix"/></td>
+ <td><s:textfield name="fulltextPrefix" size="1" maxLength="1"/></td>
+ <td><input type="radio" name="defaultPrefix" value="<%=PreferenceBaseAction.DefaultPrefix.FULLTEXT%>"
+ <%=(defaultPrefix==PreferenceBaseAction.DefaultPrefix.FULLTEXT?"checked='true'":"")%>/></td>
+ <td><input type="radio" name="defaultAction" value="<%=PreferenceBaseAction.DefaultPrefix.FULLTEXT%>"
+ <%=(defaultAction==PreferenceBaseAction.DefaultPrefix.FULLTEXT?"checked='true'":"")%>/></td>
+ </tr>
+ <tr>
+ <td><s:text name="bow.preferences.opensearch.web.search.prefix"/></td>
+ <td><s:textfield name="webPrefix" size="1" maxLength="1"/></td>
+ <td><input type="radio" name="defaultPrefix" value="<%=PreferenceBaseAction.DefaultPrefix.WEB%>"
+ <%=(defaultPrefix==PreferenceBaseAction.DefaultPrefix.WEB?"checked='true'":"")%>/></td>
+ <td><input type="radio" name="defaultAction" value="<%=PreferenceBaseAction.DefaultPrefix.WEB%>"
+ <%=(defaultAction==PreferenceBaseAction.DefaultPrefix.WEB?"checked='true'":"")%>/></td>
+ <tr>
+ <td><s:text name="bow.preferences.opensearch.alias.prefix"/></td>
+ <td><s:textfield name="aliasPrefix" size="1" maxLength="1"/></td>
+ <td><input type="radio" name="defaultPrefix" value="<%=PreferenceBaseAction.DefaultPrefix.ALIAS%>"
+ <%=(defaultPrefix==PreferenceBaseAction.DefaultPrefix.ALIAS?"checked='true'":"")%>/></td>
+ <td><input type="radio" name="defaultAction" value="<%=PreferenceBaseAction.DefaultPrefix.ALIAS%>"
+ <%=(defaultAction==PreferenceBaseAction.DefaultPrefix.ALIAS?"checked='true'":"")%>/></td>
+ </tr>
+ </tr>
+ </table>
+
<s:hidden name="update" value="site"/>
<s:submit key="bow.preferences.submit" name="submit"/>
</s:form>
1
0
r319 - in trunk/bow-ui/src/main/webapp/WEB-INF: . decorators jsp jsp/inc
by bpoussin@users.chorem.org 21 Aug '11
by bpoussin@users.chorem.org 21 Aug '11
21 Aug '11
Author: bpoussin
Date: 2011-08-21 20:31:08 +0200 (Sun, 21 Aug 2011)
New Revision: 319
Url: http://chorem.org/repositories/revision/bow/319
Log:
Evolution #438: Refactore source code and simplify all
- move jsp page to WEB-INF dir for more security
Added:
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/admin.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/editBookmark.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/error.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/forgotPassword.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/home.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/bookmark.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/footer.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/header.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/tagsCloud.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/login.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/permanentXml.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/preferences.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/register.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/suggestions.jsp
trunk/bow-ui/src/main/webapp/WEB-INF/jsp/temporaryXml.jsp
Modified:
trunk/bow-ui/src/main/webapp/WEB-INF/decorators/main.jsp
Modified: trunk/bow-ui/src/main/webapp/WEB-INF/decorators/main.jsp
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/decorators/main.jsp 2011-08-21 18:30:58 UTC (rev 318)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/decorators/main.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -62,15 +62,15 @@
<body id="page-home">
<div id="wrap">
<div id="page">
- <%@include file="/jsp/inc/header.jsp" %>
+ <%@include file="/WEB-INF/jsp/inc/header.jsp" %>
<div id="main">
<decorator:body />
</div>
<s:if test="%{#session.BowSession.user != null}">
- <jsp:include page="/jsp/inc/rightMenu.jsp" />
+ <jsp:include page="/WEB-INF/jsp/inc/rightMenu.jsp" />
</s:if>
</div>
</div>
- <%@include file="/jsp/inc/footer.jsp" %>
+ <%@include file="/WEB-INF/jsp/inc/footer.jsp" %>
</body>
</html>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/admin.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/admin.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/admin.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/admin.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,58 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags"%>
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <head>
+ <s:url var="css" value="/css/bookmark.css" />
+ <link href="${css}" rel="stylesheet" type="text/css" />
+ <s:head />
+ </head>
+ <body>
+ <div id="content">
+ <div class="menu clearfix">
+ <h2><s:text name="bow.admin.panel" /></h2>
+ </div>
+ <div class="formFrame fond">
+ <br /><br />
+
+ <s:if test="#session.BowSession.isAdmin()">
+ <ul id="adminActions">
+ <li><s:a action="reIndexation"><s:text name="bow.admin.dataReindexation" /></s:a></li>
+ <li><s:a action="migrateData?versionFrom=0.4&versionTo=0.5"><s:text name="bow.admin.dataMigration04to05" /></s:a></li>
+ <li><s:a action="migrateData?versionFrom=0.6&versionTo=1.1"><s:text name="bow.admin.dataMigration05to06" /></s:a></li>
+ <li><s:a action="home" id="homePage"><s:text name="bow.admin.home" /></s:a></li>
+ </ul>
+ </s:if>
+ <s:else>
+ <h2><s:text name="bow.admin.forbidden" /></h2>
+ </s:else>
+ </div>
+ </div>
+ </body>
+</html>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/editBookmark.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/editBookmark.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/editBookmark.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/editBookmark.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,61 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags"%>
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <head>
+ <s:url var="css" value="/css/bookmark.css" />
+ <link href="${css}" rel="stylesheet" type="text/css" />
+ <s:head />
+ </head>
+ <body>
+ <div id="content">
+ <div class="menu clearfix">
+ <h2><s:text name="popup.addurl.title" /></h2>
+ </div>
+ <div class="formFrame fond">
+ <s:form id="popupAddUrlForm" action="addUrl" method="post">
+ <s:hidden name="tagLine" value="%{tagLine}" />
+ <s:hidden name="fullTextLine" value="%{fullTextLine}" />
+ <s:hidden name="bookmarkId" value="%{bookmark.wikittyId}"/>
+ <s:textfield name="link" labelSeparator=" " key="popup.addurl.link"
+ value="%{bookmark.link}" />
+ <s:textarea name="name" labelSeparator=" " key="popup.addurl.name"
+ value="%{bookmark.description}" />
+ <s:textfield name="privateAlias" labelSeparator=" " key="popup.addurl.alias.private"
+ value="%{bookmark.privateAlias}" />
+ <s:textfield name="publicAlias" labelSeparator=" " key="popup.addurl.alias.public"
+ value="%{bookmark.publicAlias}" />
+ <s:textfield name="tags" labelSeparator=" " key="popup.addurl.tags"
+ value="%{@org.chorem.bow.BookmarkUtils@getBookmarkTagsString(bookmark)}" />
+ <s:submit key="popup.commons.submit" name="submit" />
+ </s:form>
+ </div>
+ </div>
+ </body>
+</html>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/error.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/error.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/error.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/error.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,48 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags"%>
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <head>
+ <s:url var="css" value="/css/connexion.css" />
+ <link href="${css}" rel="stylesheet" type="text/css" />
+ <s:head />
+ </head>
+ <body>
+ <div id="main">
+ <div id="msg">
+ <div id="actionmessageHeader">
+ <s:actionmessage />
+ </div>
+ <div id="actionerrorHeader">
+ <s:actionerror />
+ </div>
+ </div>
+ </div>
+ </body>
+</html>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/forgotPassword.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/forgotPassword.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/forgotPassword.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/forgotPassword.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,51 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <head>
+ <title><s:text name="bow.forgotpwd.title" /></title>
+ <s:url var="css" value="/css/connexion.css" />
+ <link href="${css}" rel="stylesheet" type="text/css" />
+ <s:head />
+ </head>
+ <body>
+ <div id="content">
+ <div id="formFrame fond">
+ <h1><s:text name="bow.forgotpwd.title" /></h1>
+ <s:form action="forgotPassword">
+ <p>
+ <s:textfield key="bow.login.email" name="email" labelposition="top" labelSeparator=" :" />
+ <s:submit key="bow.forgotpwd.submit" name="submit" />
+ </p>
+ </s:form>
+ <s:a action="login_input" id="loginLink"><s:text name="bow.login.title" /></s:a>
+ </div>
+ </div>
+ </body>
+</html>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/home.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/home.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/home.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/home.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,75 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+
+ <head>
+ <title><s:text name="bow.search.title" /></title>
+ <s:url var="css" value="/css/bookmark.css" />
+ <link href="${css}" rel="stylesheet" type="text/css" />
+ <s:head />
+ </head>
+ <body>
+ <div class="menu clearfix">
+ <h2>
+ <s:text name="bow.search.found" />
+ <s:property value="%{searchResult.bookmarkCount}"/>
+ </h2>
+
+ <s:set name="bookmarksToDelete" value="%{searchResult.bookmarkCount}" />
+ <s:if test="%{#bookmarksToDelete > 0}">
+ <s:url var="deleteSearchResults" action="deleteSearchResults" escapeAmp="false">
+ <s:param name="tagLine"><s:property value="searchResult.tagLine" /></s:param>
+ <s:param name="fullTextLine"><s:property value="searchResult.fullTextLine" /></s:param>
+ </s:url>
+ <s:a id="deleteSearchResultsButton" title="delete all" href="" onclick="deleteConfirmation('%{deleteSearchResults}', %{#bookmarksToDelete}); return(false);"></s:a>
+ </s:if>
+ <s:form action="home" method="get" theme="simple">
+ <label for="order"><s:text name="bow.search.orderby" /></label>
+ <s:select id="order" name="order" list="possibleOrder"/>
+ <s:submit key="bow.search.submit" name="submit" />
+ <s:hidden name="tagLine" value="%{searchResult.tagLine}" />
+ <s:hidden name="fullTextLine" value="%{searchResult.fullTextLine}" />
+ </s:form>
+ </div>
+ <div class="content">
+ <s:if test="searchResult.bookmarks.empty">
+ <p class="nobookmarks"><s:text name="bow.bookmarks.noBookmarks" /></p>
+ </s:if>
+ <s:else>
+ <s:iterator value="searchResult.bookmarks" var="bookmark">
+ <s:set name="bookmark" value="bookmark"/>
+ <jsp:include page="inc/bookmark.jsp" flush="true">
+ <jsp:param name="tagLine" value="%{searchResult.tagLine}" />
+ <jsp:param name="fullTextLine" value="%{searchResult.fullTextLine}" />
+ </jsp:include>
+ </s:iterator>
+ </s:else>
+ </div>
+ </body>
+</html>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/bookmark.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/inc/bookmark.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/bookmark.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/bookmark.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,84 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+<%@taglib prefix="sj" uri="/struts-jquery-tags" %>
+
+<div class="bookmark"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+
+ <div class="bookmarkhead">
+ <p class="date"><s:property value="#bookmark.creationDate"/></p>
+ <s:a cssClass="alias" href="%{config.aliasUrl + #bookmark.wikittyId}.action"
+ title="%{#bookmark.link}" target="_blank">
+ a:<s:property value="%{#bookmark.privateAlias}" />
+ </s:a>
+ <s:if test="%{!#bookmark.publicAlias.empty}">
+ <s:a cssClass="alias" href="%{config.aliasUrl + #bookmark.publicAlias}.action"
+ title="%{#bookmark.link}" target="_blank">
+ <s:property value="%{#bookmark.publicAlias}" />
+ </s:a>
+ </s:if>
+ <s:url var="editBookmark" action="editBookmark" escapeAmp="true">
+ <s:param name="id"><s:property value="%{#bookmark.wikittyId}" /></s:param>
+ <s:param name="tagLine"><s:property value="%{tagLine}" /></s:param>
+ <s:param name="fullTextLine"><s:property value="%{fullTextLine}" /></s:param>
+ </s:url>
+ <s:a cssClass="edit" href="%{editBookmark}"/>
+
+ <s:url var="removeBookmark" action="removeBookmark" escapeAmp="true">
+ <s:param name="bookmarkId"><s:property value="%{#bookmark.wikittyId}" /></s:param>
+ <s:param name="tagLine"><s:property value="%{tagLine}" /></s:param>
+ <s:param name="fullTextLine"><s:property value="%{fullTextLine}" /></s:param>
+ </s:url>
+ <s:a cssClass="supprim" href="%{removeBookmark}"
+ onclick="return deleteConfirmation('%{#removeBookmark}','%{#bookmark.link}');"></s:a>
+ </div>
+
+ <div class="bookmarkcontenu">
+ <s:a title="%{#bookmark.link}" href="alias/%{#bookmark.wikittyId}.action" target="_blank">
+ <div class="screenshot"></div>
+ </s:a>
+ <div class="click"><s:property value="%{#bookmark.click}" /></div>
+ <div class="description">
+ <h3><s:text name="bow.bookmark.description" /> :</h3>
+ <p>
+ <s:property value="%{#bookmark.description}"/>
+ </p>
+ <p class="tags">
+ <strong><s:text name="bow.bookmark.tags" /> :</strong>
+ <s:iterator value="#bookmark.labels" var="tag">
+ <s:url var="search" action="home">
+ <s:param name="tagLine" value="%{tagLine}"/>
+ <s:param name="addTag" value="%{#tag}"/>
+ <s:param name="fullTextLine" value="%{fullTextLine}"/>
+ </s:url>
+ <s:a href="%{search}" cssClass="tag"><s:property value="%{#tag}"/></s:a>
+ </s:iterator>
+ </p>
+ </div>
+ </div>
+
+</div>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/footer.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/inc/footer.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/footer.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/footer.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,47 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<div id="footer"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <p>
+ <a shape="rect" href="http://www.chorem.org/projects/show/bow">bow</a>
+ <a shape="rect" href="http://www.chorem.org/projects/bow/files"></a> -
+ <a shape="rect" href="http://www.gnu.org/licenses/agpl.html"><s:text name="bow.footer.license" /></a> -
+ <span title="Copyright">©2011</span>
+ <a shape="rect" href="http://www.codelutin.com">Code Lutin</a> -
+ <a shape="rect" href="http://www.chorem.org/projects/bow/issues"><s:text name="bow.footer.bugreport" /></a> -
+ <a shape="rect" href="http://list.chorem.org/cgi-bin/mailman/listinfo/bow-users"><s:text name="bow.footer.userSupport" /></a> -
+ <s:url var="localeEN">
+ <s:param name="request_locale">en_GB</s:param>
+ </s:url>
+ <s:url var="localeFR">
+ <s:param name="request_locale">fr_FR</s:param>
+ </s:url>
+ <s:a href="%{localeEN}"><s:text name="bow.action.locale.english" /></s:a> -
+ <s:a href="%{localeFR}"><s:text name="bow.action.locale.french" /></s:a>
+ </p>
+</div>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/header.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/inc/header.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/header.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/header.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,71 @@
+<%--
+#%L
+ bow
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+--%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<div id="header"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <div>
+ <s:if test="%{#session.BowSession.user != null}">
+ <s:url var="homeToken" action="home">
+ <s:param name="token"><s:property value="%{#session.BowSession.getPermanentToken()}" /></s:param>
+ </s:url>
+ <s:a cssClass="logo" href="%{homeToken}">bow</s:a>
+ </s:if>
+ <s:else>
+ <s:a cssClass="logo" action="home">bow</s:a>
+ </s:else>
+ </div>
+ <s:if test="%{#session.BowSession.user != null}">
+ <div class="recherche right">
+ <h3>Recherche</h3>
+ <div class="input">
+ <s:form action="home" theme="simple">
+ <s:textfield name="tagLine" labelSeparator="" />
+ <s:submit key="bow.rightMenu.search.tags" name="submit" />
+ </s:form>
+ </div>
+ <div class="input">
+ <s:form action="home" theme="simple">
+ <s:textfield name="fullTextLine" labelSeparator="" />
+ <s:submit key="bow.rightMenu.fullTextSearch" name="submit" />
+ </s:form>
+ </div>
+ <div class="input">
+ <s:form action="openSearchResult" theme="simple">
+ <s:textfield name="searchLine" labelSeparator="" />
+ <s:submit key="bow.rightMenu.externSearchEngine" name="submit" />
+ </s:form>
+ </div>
+ </div>
+ </s:if>
+ <div id="msg">
+ <span id="actionmessageHeader">
+ <s:actionmessage />
+ </span>
+ <span id="actionerrorHeader">
+ <s:actionerror />
+ </span>
+ </div>
+</div>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/inc/rightMenu.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/rightMenu.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,73 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@taglib prefix="s" uri="/struts-tags" %>
+<%@taglib prefix="sj" uri="/struts-jquery-tags" %>
+
+<sj:dialog id="editBookmark"
+ title="Ajout/Modification d'un bookmark"
+ modal="true"
+ autoOpen="false" />
+
+<div id="logoutDiv" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <s:form action="logout" theme="simple">
+ <div class="input">
+ <s:submit key="bow.rightMenu.logout" name="submit" />
+ </div>
+ </s:form>
+ <a href="http://maven-site.chorem.org/bow/" class="help" target="_blank">
+ <s:text name="bow.rightMenu.help" />
+ </a>
+</div>
+
+<div id="side" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <div id="colonneD">
+ <ul class="droite">
+ <s:if test="bowSession.admin">
+ <li><s:a action="admin"><s:text name="bow.rightMenu.admin" /></s:a></li>
+ </s:if>
+ <li><s:a action="preferences"><s:text name="bow.preferences.title" /></s:a></li>
+ <li>
+ <s:url var="editBookmark" action="editBookmark" escapeAmp="true">
+ <s:param name="tagLine"><s:property value="%{tagLine}" /></s:param>
+ <s:param name="fullTextLine"><s:property value="%{fullTextLine}" /></s:param>
+ </s:url>
+ <s:a href="%{editBookmark}">
+ <s:text name="bow.rightMenu.addUrl.link" />
+ </s:a>
+ </li>
+ </ul>
+ <!--div id="nuage"-->
+ <jsp:include page="tagsCloud.jsp" flush="true">
+ <jsp:param name="tagLine" value="%{tagLine}" />
+ <jsp:param name="fullTextLine" value="%{fullTextLine}"/>
+ </jsp:include>
+ <!--/div-->
+ <div class="colonnebas">
+ <img src="img/piedmenu.jpg" width="401" height="77" alt="Pied de menu" />
+ </div>
+ </div>
+</div>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/tagsCloud.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/inc/tagsCloud.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/tagsCloud.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/inc/tagsCloud.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,42 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<div id="nuage"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <s:iterator value="%{searchResult.tagsCloud}" status="tagStatus" var="tag">
+ <s:url var="search" action="home" escapeAmp="true">
+ <s:param name="tagLine" value="%{tagLine}"/>
+ <s:param name="addTag" value="%{#tag.topicName}"/>
+ <s:param name="fullTextLine" value="%{fullTextLine}"/>
+ </s:url>
+ <!-- -->
+ <s:a href="%{search}" title="%{#tag.count} results" cssClass="tag"
+ cssStyle="font-size: %{searchResult.getFont(#tag.count)}px">
+ <s:property value="%{#tag.topicName}" />
+ </s:a>
+ </s:iterator>
+</div>
\ No newline at end of file
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/login.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/login.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/login.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/login.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,52 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 - 2011 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags"%>
+
+<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <head>
+ <title><s:text name="bow.login.title" /></title>
+ <s:url var="css" value="/css/connexion.css" />
+ <link href="${css}" rel="stylesheet" type="text/css" />
+ <s:head />
+ </head>
+ <body>
+ <div id="content">
+ <div id="formFrame" class="fond">
+ <h1><s:text name="bow.login.title" /></h1>
+ <br/>
+ <br/>
+ <s:actionerror />
+ <s:form action="login">
+ <s:textfield key="bow.login.email" name="email" labelposition="top" labelSeparator=" :" />
+ <s:password key="bow.login.password" name="password" labelposition="top" labelSeparator=" :" />
+ <s:submit key="bow.login.submit" name="submit" />
+ </s:form>
+ <s:a action="register_input" id="registerLink"><s:text name="bow.register.title" /></s:a><br />
+ <s:a action="forgotPassword_input" id="forgotPwd"><s:text name="bow.forgotpwd.title" /></s:a>
+ </div>
+ </div>
+ </body>
+</html>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/permanentXml.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/permanentXml.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/permanentXml.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/permanentXml.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,43 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/xml" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+<%@page import="org.chorem.bow.BowConfig" %>
+
+<%
+String url = BowConfig.getBowUrl();
+%>
+<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
+ xmlns:moz="http://www.mozilla.org/2006/browser/search/"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <ShortName>Bow (permanent)</ShortName>
+ <Description>bookmarkSearch</Description>
+ <InputEncoding>inputEncoding</InputEncoding>
+ <Image width="16" height="16" type="image/ico"><%=url%>img/bow.gif</Image>
+ <s:set var="token" value="#session.BowSession.getPermanentToken()" />
+ <Url type="text/html" method="GET" template="<%=url%>openSearchResult.action?token=${token}&searchLine={searchTerms}" />
+ <Url type="application/x-suggestions+json" method="GET" template="<%=url%>openSearchSuggestion.action?token=${token}&searchLine={searchTerms}" />
+ <moz:SearchForm><%=url%></moz:SearchForm>
+</OpenSearchDescription>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/preferences.jsp (from rev 316, trunk/bow-ui/src/main/webapp/jsp/preferences.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/preferences.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/preferences.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,188 @@
+<%--
+#%L
+bow
+
+$Id$
+$HeadURL$
+%%
+Copyright (C) 2010 CodeLutin
+%%
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero 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 Affero General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+#L%
+--%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+<head>
+ <title><s:text name="bow.preferences.title"/></title>
+ <s:url var="css" value="/css/bookmark.css"/>
+ <link href="${css}" rel="stylesheet" type="text/css"/>
+ <s:head/>
+</head>
+<body>
+<div id="content">
+ <div class="menu clearfix">
+ <h2><s:text name="bow.preferences.title"/></h2>
+ </div>
+ <s:actionerror/>
+
+ <div class="formFrame fond">
+ <s:set var="permanentToken" value="bowSession.getPermanentToken()" />
+ <s:set var="temporaryToken" value="bowSession.getTemporaryToken()" />
+ <ul>
+ <li>
+ <s:a title="%{getText('bow.rightMenu.bookmark.temporaryLinkDescription')}"
+ href="javascript:var%20url=location.href;var%20nameAndTags=prompt('Entrez%20le%20nom%20du%20lien%20et%20la%20liste%20des%20tags%20sous%20la%20forme:%20name|tag1%20tag2%20tag3',%20document.title+'|');var%20link='%{config.bowUrl}addUrl.action?token=%{temporaryToken}&link='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);void(0);">
+ <s:text name="bow.rightMenu.bookmark.temporaryLink" />
+ </s:a>
+ </li>
+ <li>
+ <s:a title="%{getText('bow.rightMenu.bookmark.permanentLinkDescription')}"
+ href="javascript:var%20url=location.href;var%20nameAndTags=prompt('Entrez%20le%20nom%20du%20lien%20et%20la%20liste%20des%20tags%20sous%20la%20forme:%20name|tag1%20tag2%20tag3',%20document.title+'|');var%20link='%{config.bowUrl}addUrl.action?token=%{permanentToken}&link='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);void(0);">
+ <s:text name="bow.rightMenu.bookmark.permanentLink" />
+ </s:a>
+ </li>
+ <li>
+ <a href="extensions/bow4chromium.crx">
+ <img src="img/chromium.png" alt="Chromium" class="extensionIcon" />
+ <s:text name="bow.rightMenu.chromiumExtension" />
+ </a>
+ </li>
+ <li>
+ <strong><s:text name="bow.rightMenu.token.permanent"/> :</strong>
+ <s:property value="%{#permanentToken}"/>
+ </li>
+ <li>
+ <strong><s:text name="bow.rightMenu.token.temporary"/> :</strong>
+ <s:property value="%{#temporaryToken}"/>
+ </li>
+ </ul>
+
+ <s:url var="regenPermToken" action="generateToken"/>
+ <s:a href="%{regenPermToken}" id="regenPermToken">
+ <s:text name="bow.preferences.regenPermToken"/>
+ </s:a>
+ </div>
+
+ <div class="formFrame fond">
+ <h3><s:text name="bow.preferences.userInfo"/></h3>
+ <br/>
+ <s:form action="updateUserPref" theme="simple">
+ <s:text name="bow.login.email"/><br/>
+ <s:textfield name="email"
+ labelposition="top"/><br/>
+
+ <s:text name="bow.preferences.currentPassword"/><br/>
+ <s:password name="currentPassword"
+ labelposition="top"/><br/>
+
+ <s:text name="bow.preferences.newPassword"/><br/>
+ <s:password name="newPassword"
+ labelposition="top"/><br/>
+
+ <s:text name="bow.preferences.confirmNewPassword"/><br/>
+ <s:password name="confirmNewPassword"
+ labelposition="top"/><br/>
+ <s:hidden name="update" value="user"/>
+ <s:submit key="bow.preferences.submit" name="submit"/>
+ </s:form>
+ </div>
+ <div class="formFrame fond">
+ <h3><s:text name="bow.preferences.siteLook"/></h3>
+ <br/>
+ <s:form action="updateSitePref" theme="simple">
+ <s:text name="bow.preferences.tagsNb"/><br/>
+ <s:textfield name="tagsNb" labelposition="top"/><br/>
+
+ <s:text name="bow.preferences.bookmarksHomePage"/><br/>
+ <s:textfield name="bookmarksHomePage" labelposition="top"/><br/>
+
+ <s:text name="bow.preferences.searchEngineUrlSuggestions"/><br/>
+ <s:textfield name="searchEngineUrlSuggestions"
+ labelposition="top"/><br/>
+
+ <s:text name="bow.preferences.searchEngineUrlResults"/><br/>
+ <s:textfield name="searchEngineUrlResults"
+ size="50"
+ labelposition="top"/><br/>
+
+ <s:hidden name="update" value="site"/>
+ <s:submit key="bow.preferences.submit" name="submit"/>
+ </s:form>
+ </div>
+
+ <div class="menu clearfix">
+ <h2><s:text name="bow.preferences.tagsManagement"/></h2>
+ </div>
+
+ <div class="formFrame fond">
+ <h3><s:text name="bow.preferences.labels"/>(<s:property value="labels.size()"/>)</h3>
+ <br/>
+ <s:form id="labelsForm" action="adminlabels" method="post" theme="simple">
+ <div class="list">
+ <s:checkboxlist name="selectedLabels" list="labels"
+ listKey="topicName" listValue="%{topicName+'('+count+')'}"/>
+ </div>
+ <div class="action">
+ <s:text name="bow.preferences.labels.name.field"/><s:textfield name="newLabel" />
+ <s:submit name="rename" key="bow.preferences.labels.rename.submit" />
+ <s:submit name="delete" key="bow.preferences.labels.delete.submit" />
+ </div>
+ </s:form>
+ </div>
+
+ <div class="menu clearfix">
+ <h2><s:text name="bow.preferences.importExport"/></h2>
+ </div>
+
+ <div class="formFrame fond">
+ <s:a action="exportBookmarks"><s:text name="bow.preferences.export.bookmarks"/></s:a>
+ <br/>
+
+ <h3><s:text name="bow.preferences.import.bookmarks"/></h3>
+ <br/>
+ <s:form action="importBookmarks" method="post" enctype="multipart/form-data" theme="simple">
+ <s:file name="upfile" labelSeparator=""/>
+ <s:hidden name="tagLine" value="%{tagLine}"/>
+ <s:hidden name="fullTextLine" value="%{fullTextLine}"/>
+ <s:submit key="bow.preferences.import.submit" name="submit"/>
+ </s:form>
+ <br/><br/>
+
+ <s:if test="bookmarksImportDate != null">
+ <s:iterator value="bookmarksImportDate">
+ <s:set name="date" value="%{key}"/>
+ <s:set name="nb" value="%{value}"/>
+ <s:date name="%{stringToDate(#date)}" var="dateString"/>
+ <div class="deleteImport">
+ <span><s:property value="dateString"/> (<s:property value="#nb"/> bookmarks)</span>
+ <s:url var="deleteImport" action="deleteImport">
+ <s:param name="date" value="#date"/>
+ </s:url>
+ <s:a cssClass="deleteImportButton" href="%{deleteImport}"
+ onclick="return deleteConfirmation('%{deleteImport}','%{nb}','%{dateString}');">
+ </s:a>
+ </div>
+ </s:iterator>
+ </s:if>
+ <s:else>
+ <span><s:text name="bow.preferences.noImportedBookmarks"/></span>
+ </s:else>
+ </div>
+
+</div>
+</body>
+</html>
\ No newline at end of file
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/register.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/register.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/register.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/register.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,54 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <head>
+ <title><s:text name="bow.register.title" /></title>
+ <s:url var="css" value="/css/connexion.css" />
+ <link href="${css}" rel="stylesheet" type="text/css" />
+ <s:head />
+ </head>
+ <body>
+ <div id="content">
+ <div id="formFrame" class="fond">
+ <h1><s:text name="bow.register.title" /></h1>
+ <s:form action="register">
+ <s:actionerror />
+ <p>
+ <s:textfield key="bow.login.email" name="email" labelposition="top" labelSeparator=" :" />
+ <s:password key="bow.login.password" name="password" labelposition="top" labelSeparator=" :" />
+ <s:password key="bow.login.repeatPassword" name="repeatPassword" labelposition="top" labelSeparator=" :" />
+ <s:submit key="bow.register.submit" name="submit" />
+ </p>
+ </s:form>
+ <s:a action="login_input" id="loginLink"><s:text name="bow.login.title" /></s:a>
+ </div>
+ </div>
+ </body>
+</html>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/suggestions.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/suggestions.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/suggestions.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/suggestions.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,44 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@page import="org.chorem.bow.OpenSearchActions" %>
+<%@page import="org.nuiton.wikitty.search.FacetTopic" %>
+<%@page import="org.chorem.bow.action.OpenSearchSuggestionAction"%>
+<%@page import="java.util.List" %>
+
+<%
+OpenSearchSuggestionAction action = OpenSearchSuggestionAction.getAction();
+OpenSearchActions osa = action.getOpenSearchActions();
+if (osa != null) {
+ String[] word = osa.getSearch();
+ if (word != null) {
+ List<FacetTopic> suggestions = osa.getSuggestionList();
+ if (suggestions != null) {
+%>
+<%=osa.getJsonResult()%>
+<%
+ }
+ }
+}
+%>
Copied: trunk/bow-ui/src/main/webapp/WEB-INF/jsp/temporaryXml.jsp (from rev 313, trunk/bow-ui/src/main/webapp/jsp/temporaryXml.jsp)
===================================================================
--- trunk/bow-ui/src/main/webapp/WEB-INF/jsp/temporaryXml.jsp (rev 0)
+++ trunk/bow-ui/src/main/webapp/WEB-INF/jsp/temporaryXml.jsp 2011-08-21 18:31:08 UTC (rev 319)
@@ -0,0 +1,43 @@
+<%--
+ #%L
+ bow
+
+ $Id$
+ $HeadURL$
+ %%
+ Copyright (C) 2010 CodeLutin
+ %%
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero 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 Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ #L%
+ --%>
+<%@page contentType="text/xml" pageEncoding="UTF-8"%>
+<%@taglib prefix="s" uri="/struts-tags" %>
+<%@page import="org.chorem.bow.BowConfig" %>
+
+<%
+String url = BowConfig.getBowUrl();
+%>
+<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
+ xmlns:moz="http://www.mozilla.org/2006/browser/search/"
+ xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ xmlns:jsp="http://java.sun.com/JSP/Page">
+ <ShortName>Bow (temporary)</ShortName>
+ <Description>bookmarkSearch</Description>
+ <InputEncoding>inputEncoding</InputEncoding>
+ <Image width="16" height="16" type="image/ico"><%=url%>img/bow.gif</Image>
+ <s:set var="token" value="%{#session.BowSession.getTemporaryToken()}" />
+ <Url type="text/html" method="GET" template="<%=url%>openSearchResult.action?token=${token}&searchLine={searchTerms}" />
+ <Url type="application/x-suggestions+json" method="GET" template="<%=url%>openSearchSuggestion.action?token=${token}&search={searchTerms}" />
+ <moz:SearchForm><%=url%></moz:SearchForm>
+</OpenSearchDescription>
1
0
Author: bpoussin
Date: 2011-08-21 20:30:58 +0200 (Sun, 21 Aug 2011)
New Revision: 318
Url: http://chorem.org/repositories/revision/bow/318
Log:
Evolution #438: Refactore source code and simplify all
- move jsp page to WEB-INF dir for more security
Removed:
trunk/bow-ui/src/main/webapp/jsp/
1
0
r317 - in trunk/bow-ui/src/main: java/org/chorem/bow java/org/chorem/bow/action java/org/chorem/bow/action/opensearch resources/i18n xmi
by bpoussin@users.chorem.org 21 Aug '11
by bpoussin@users.chorem.org 21 Aug '11
21 Aug '11
Author: bpoussin
Date: 2011-08-21 20:16:39 +0200 (Sun, 21 Aug 2011)
New Revision: 317
Url: http://chorem.org/repositories/revision/bow/317
Log:
Evolution #430: Permit search prefix configurable for each user
- move open search action in new package
- refactore open search action to simplify prefix search
- add support of suggest for alias
- add support for user configuration prefix (backend)
Added:
trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/
trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchBaseAction.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchResultAction.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchSuggestionAction.java
Removed:
trunk/bow-ui/src/main/java/org/chorem/bow/SuggestionsComparator.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java
Modified:
trunk/bow-ui/src/main/java/org/chorem/bow/BowConfig.java
trunk/bow-ui/src/main/java/org/chorem/bow/BowConfigOption.java
trunk/bow-ui/src/main/java/org/chorem/bow/BowSession.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/AliasAction.java
trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties
trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties
trunk/bow-ui/src/main/xmi/bow.zargo
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/BowConfig.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/BowConfig.java 2011-08-21 16:06:25 UTC (rev 316)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/BowConfig.java 2011-08-21 18:16:39 UTC (rev 317)
@@ -248,4 +248,130 @@
return config.getOption(BowConfigOption.BOW_ADMINS.key + ".password." + admin);
}
+ /**
+ * Retourne le separateur choisi par l'utilisateur entre les prefix d'action
+ * et la chaine.
+ *
+ * @return
+ */
+ public static String getPrefixSeparator() {
+ return getPrefixSeparator(getConfig());
+ }
+
+ /**
+ * Retourne le separateur choisi par l'utilisateur entre les prefix d'action
+ * et la chaine.
+ *
+ * @return
+ */
+ public static String getPrefixSeparator(ApplicationConfig config) {
+ return config.getOption(BowConfigOption.OPEN_SEARCH_PREFIX_SEPARATOR.key);
+ }
+
+ /**
+ * Retourne le prefix par defaut a utiliser si l'utilisateur a mis le
+ * separateur de prefix mais sans prefix
+ * @return
+ */
+ public static String getDefaultPrefix() {
+ return getDefaultPrefix(getConfig());
+ }
+
+ /**
+ * Retourne le prefix par defaut a utiliser si l'utilisateur a mis le
+ * separateur de prefix mais sans prefix
+ * @return
+ */
+ public static String getDefaultPrefix(ApplicationConfig config) {
+ return config.getOption(BowConfigOption.OPEN_SEARCH_DEFAULT_PREFIX.key);
+ }
+
+ /**
+ * Indique l'action par defaut a faire, si l'utilisateur n'indique ni
+ * prefix ni separateur de prefix
+ * @return
+ */
+ public static String getDefaultAction() {
+ return getDefaultAction(getConfig());
+ }
+
+ /**
+ * Indique l'action par defaut a faire, si l'utilisateur n'indique ni
+ * prefix ni separateur de prefix
+ * @return
+ */
+ public static String getDefaultAction(ApplicationConfig config) {
+ return config.getOption(BowConfigOption.OPEN_SEARCH_DEFAULT_ACTION.key);
+ }
+
+ /**
+ * le prefix pour indiquer que l'on souhaite une recherche sur les tags
+ * @return
+ */
+ public static String getTagSearchPrefix() {
+ return getTagSearchPrefix(getConfig());
+ }
+
+ /**
+ * le prefix pour indiquer que l'on souhaite une recherche sur les tags
+ * @return
+ */
+ public static String getTagSearchPrefix(ApplicationConfig config) {
+ return config.getOption(BowConfigOption.OPEN_SEARCH_TAG_SEARCH_PREFIX.key);
+ }
+
+ /**
+ * le prefix pour indiquer que l'on souhaite une recherche sur fulltext
+ * dans bow
+ * @return
+ */
+ public static String getFullTextSearchPrefix() {
+ return getFullTextSearchPrefix(getConfig());
+ }
+
+ /**
+ * le prefix pour indiquer que l'on souhaite une recherche sur fulltext
+ * dans bow
+ * @return
+ */
+ public static String getFullTextSearchPrefix(ApplicationConfig config) {
+ return config.getOption(BowConfigOption.OPEN_SEARCH_FULLTEXT_SEARCH_PREFIX.key);
+ }
+
+ /**
+ * le prefix pour indiquer que l'on souhaite une recherche sur les alias
+ * prive et une rediection automatique vers cette page
+ * @return
+ */
+ public static String getAliasPrefix() {
+ return getAliasPrefix(getConfig());
+ }
+
+ /**
+ * le prefix pour indiquer que l'on souhaite une recherche sur les alias
+ * prive et une rediection automatique vers cette page
+ * @return
+ */
+ public static String getAliasPrefix(ApplicationConfig config) {
+ return config.getOption(BowConfigOption.OPEN_SEARCH_ALIAS_PREFIX.key);
+ }
+
+ /**
+ * le prefix pour indiquer que l'on souhaite une recherche sur le web
+ * via le moteur de recherche configurer
+ * @return
+ */
+ public static String getWebSearchPrefix() {
+ return getWebSearchPrefix(getConfig());
+ }
+
+ /**
+ * le prefix pour indiquer que l'on souhaite une recherche sur le web
+ * via le moteur de recherche configurer
+ * @return
+ */
+ public static String getWebSearchPrefix(ApplicationConfig config) {
+ return config.getOption(BowConfigOption.OPEN_SEARCH_WEB_SEARCH_PREFIX.key);
+ }
+
}
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/BowConfigOption.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/BowConfigOption.java 2011-08-21 16:06:25 UTC (rev 316)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/BowConfigOption.java 2011-08-21 18:16:39 UTC (rev 317)
@@ -49,10 +49,6 @@
"alias.url",
_("bow.config.alias.url.description"),
"alias/", String.class, false, false),
- SEARCH_ENGINE(
- "search.engine",
- _("bow.config.search.engine.description"),
- null, String.class, false, false),
BOW_SMTPSERVER(
"bow.smtpServer",
_("bow.config.bow.smtpServer.description"),
@@ -64,7 +60,39 @@
BOW_ADMINS(
"bow.admins",
_("bow.config.bow.admins.description"),
- null, String.class, false, false);
+ null, String.class, false, false),
+ SEARCH_ENGINE(
+ "search.engine",
+ _("bow.config.search.engine.description"),
+ null, String.class, false, false),
+ OPEN_SEARCH_DEFAULT_ACTION(
+ "opensearch.default.action",
+ _("bow.config.opensearch.default.action.description"),
+ "w", String.class, false, false),
+ OPEN_SEARCH_PREFIX_SEPARATOR(
+ "opensearch.prefix.separator",
+ _("bow.config.opensearch.prefix.separator.description"),
+ ":", String.class, false, false),
+ OPEN_SEARCH_DEFAULT_PREFIX(
+ "opensearch.default.prefix",
+ _("bow.config.opensearch.default.prefix.description"),
+ "t", String.class, false, false),
+ OPEN_SEARCH_TAG_SEARCH_PREFIX(
+ "opensearch.tag.search.prefix",
+ _("bow.config.opensearch.tag.search.prefix.description"),
+ "t", String.class, false, false),
+ OPEN_SEARCH_FULLTEXT_SEARCH_PREFIX(
+ "opensearch.fulltext.search.prefix",
+ _("bow.config.opensearch.fulltext.search.prefix.description"),
+ "f", String.class, false, false),
+ OPEN_SEARCH_WEB_SEARCH_PREFIX(
+ "opensearch.web.search.prefix",
+ _("bow.config.opensearch.web.search.prefix.description"),
+ "w", String.class, false, false),
+ OPEN_SEARCH_ALIAS_PREFIX(
+ "opensearch.alias.prefix",
+ _("bow.config.opensearch.alias.prefix.description"),
+ "a", String.class, false, false);
public String key;
public String description;
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/BowSession.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/BowSession.java 2011-08-21 16:06:25 UTC (rev 316)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/BowSession.java 2011-08-21 18:16:39 UTC (rev 317)
@@ -28,9 +28,9 @@
import javax.servlet.http.HttpSession;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.ObjectUtils;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.nuiton.wikitty.entities.Wikitty;
/**
* Classe utilisee pour stocker les objets utils en session utilisateur
@@ -130,6 +130,24 @@
if (preference.getSearchEngineUrlSuggestions() == null) {
preference.setSearchEngineUrlSuggestions(""); // TODO add default value in config
}
+ if (StringUtils.isBlank(preference.getPrefixSeparator())) {
+ preference.setPrefixSeparator(BowConfig.getPrefixSeparator());
+ }
+ if (StringUtils.isBlank(preference.getTagSearchPrefix())) {
+ preference.setPrefixSeparator(BowConfig.getTagSearchPrefix());
+ }
+ if (StringUtils.isBlank(preference.getFullTextSearchPrefix())) {
+ preference.setFullTextSearchPrefix(BowConfig.getFullTextSearchPrefix());
+ }
+ if (StringUtils.isBlank(preference.getWebSearchPrefix())) {
+ preference.setWebSearchPrefix(BowConfig.getWebSearchPrefix());
+ }
+ if (StringUtils.isBlank(preference.getAliasPrefix())) {
+ preference.setAliasPrefix(BowConfig.getAliasPrefix());
+ }
+ if (StringUtils.isBlank(preference.getDefaultAction())) {
+ preference.setDefaultAction(BowConfig.getDefaultAction());
+ }
}
public String getPermanentToken() {
Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/SuggestionsComparator.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/SuggestionsComparator.java 2011-08-21 16:06:25 UTC (rev 316)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/SuggestionsComparator.java 2011-08-21 18:16:39 UTC (rev 317)
@@ -1,47 +0,0 @@
-/*
- * #%L
- * bow
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package org.chorem.bow;
-
-import java.util.Comparator;
-import org.nuiton.wikitty.search.FacetTopic;
-
-/**
- *
- * @author bbrossaud
- */
-public class SuggestionsComparator implements Comparator<FacetTopic> {
-
- @Override
- public int compare(FacetTopic o1, FacetTopic o2) {
- int result = 0;
-
- if (o1.getCount() < o2.getCount()) {
- result = 1;
- }
- else if (o1.getCount() > o2.getCount()) {
- result = -1;
- }
- return result;
- }
-}
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/AliasAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/AliasAction.java 2011-08-21 16:06:25 UTC (rev 316)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/AliasAction.java 2011-08-21 18:16:39 UTC (rev 317)
@@ -44,6 +44,7 @@
/** to use log facility, just put in your code: log.info(\"...\"); */
static private Log log = LogFactory.getLog(AliasAction.class);
+ private static final long serialVersionUID = 1L;
protected String redirectTo = "/";
protected String alias;
Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java 2011-08-21 16:06:25 UTC (rev 316)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java 2011-08-21 18:16:39 UTC (rev 317)
@@ -1,140 +0,0 @@
-/*
- * #%L
- * bow
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package org.chorem.bow.action;
-
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.struts2.interceptor.ServletResponseAware;
-import org.chorem.bow.BowBookmark;
-import org.chorem.bow.BowConfig;
-import org.chorem.bow.BowUtils;
-import org.chorem.bow.BowUser;
-import org.nuiton.wikitty.search.Criteria;
-import org.nuiton.wikitty.WikittyProxy;
-import org.nuiton.wikitty.search.Search;
-
-/**
- * Traite toutes les demandes faite via l'opensearch
- * a:, :, t:, ...
- *
- * @author poussin
- */
-public class OpenSearchResultAction extends BowBaseAction implements ServletResponseAware {
- private static final long serialVersionUID = -1691325797986483856L;
-
- protected String token;
- protected String redirectTo;
- protected HttpServletResponse response;
- protected String searchLine;
-
- public String getSearchLine() {
- return searchLine;
- }
-
- public void setSearchLine(String searchLine) {
- this.searchLine = searchLine;
- }
-
- /**
- * @return the token
- */
- public String getToken() {
- return token;
- }
-
- /**
- * @param token the token to set
- */
- public void setToken(String token) {
- this.token = token;
- }
-
- /**
- * @return the redirectTo
- */
- public String getRedirectTo() {
- return redirectTo;
- }
-
- @Override
- public void setServletResponse(HttpServletResponse response) {
- this.response = response;
- }
-
- @Override
- public String execute() {
- BowUser user = getBowSession().getUser();
-
- if (searchLine != null && searchLine.matches("^http://[^ ]*")) {
- redirectTo = searchLine;
- } else if (searchLine != null
- && (searchLine.startsWith(":") || searchLine.startsWith("t:"))) {
-
- // Search on tags
- int index = searchLine.indexOf(":");
- searchLine = searchLine.substring(index + 1); //Suppresses first ":"
-
- redirectTo = BowUtils.redirectTo(searchLine, null);
- } else if (searchLine != null && searchLine.startsWith("f:")) {
- // Fulltext search in bow
- String fullText = searchLine.substring(2);
- redirectTo = BowUtils.redirectTo(null, fullText);
- } else if (searchLine != null && searchLine.startsWith("a:")) {
- // Redirects to the requested alias
- String privateAlias = searchLine.substring(2);
- WikittyProxy proxy = getBowProxy();
- Criteria criteria = Search.query()
- .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, user.getWikittyId())
- .eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_PRIVATEALIAS, privateAlias)
- .criteria();
- String bookmarkId = proxy.findIdByCriteria(criteria);
- // si on retrouve l'alias prive on l'utilise,
- // sinon on espere qu'il existe un alias public portant ce nom
- if (bookmarkId != null) {
- redirectTo = BowConfig.getAliasUrl() + bookmarkId + ".action";
- if (log.isDebugEnabled()) {
- log.debug("Private alias found, redirect to: " + redirectTo);
- }
- } else {
- redirectTo = BowConfig.getAliasUrl() + privateAlias + ".action";
- if (log.isDebugEnabled()) {
- log.debug("Private alias not found, redirect to: " + redirectTo);
- }
- }
- } else {
- // Search on the chosen search engine
- BowUser pref = getBowSession().getUser();
-
- String searchEngineURL = pref.getSearchEngineUrlResults();
- if (StringUtils.isEmpty(searchEngineURL)) {
- searchEngineURL = BowConfig.getSearchEngine();
- }
- searchEngineURL = searchEngineURL.replace("{searchTerms}", searchLine);
- searchEngineURL = response.encodeRedirectURL(searchEngineURL);
- redirectTo = searchEngineURL;
- }
- return SUCCESS;
- }
-}
Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java 2011-08-21 16:06:25 UTC (rev 316)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java 2011-08-21 18:16:39 UTC (rev 317)
@@ -1,176 +0,0 @@
-/*
- * #%L
- * bow
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 - 2011 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package org.chorem.bow.action;
-
-import com.opensymphony.xwork2.ActionContext;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import org.apache.commons.io.input.ReaderInputStream;
-import org.apache.commons.lang.StringUtils;
-import org.chorem.bow.BookmarkUtils;
-
-import org.chorem.bow.BowBookmark;
-import org.chorem.bow.OpenSearchActions;
-import org.chorem.bow.BowUser;
-import org.chorem.bow.BowUtils;
-import org.nuiton.wikitty.search.Criteria;
-import org.nuiton.wikitty.search.FacetTopic;
-import org.nuiton.wikitty.search.PagedResult;
-import org.nuiton.wikitty.WikittyProxy;
-import org.nuiton.wikitty.entities.Wikitty;
-import org.nuiton.wikitty.search.Search;
-
-/**
- * Retourne les suggestions pour l'opensearch en fonction de ce qui a ete deja
- * saisi
- *
- * @author poussin
- */
-public class OpenSearchSuggestionAction extends BowBaseAction {
-
- private static final long serialVersionUID = 3973618635494129146L;
-
- static public OpenSearchSuggestionAction getAction() {
- Object action = ActionContext.getContext().get(CONTEXT_ACTION_KEY);
- return (OpenSearchSuggestionAction) action;
- }
-
- /** le token utilise pour faire l'appel (permanent ou temporaire) */
- protected String token;
- protected String searchLine;
- protected InputStream inputStream;
-
- public InputStream getInputStream() {
- return inputStream;
- }
-
- public String getToken() {
- return token;
- }
-
- public void setToken(String token) {
- this.token = token;
- }
-
- public String getSearchLine() {
- return searchLine;
- }
-
- public void setSearchLine(String searchLine) {
- this.searchLine = searchLine;
- }
-
- @Override
- public String execute() {
- if (log.isDebugEnabled()) {
- log.debug(String.format("Start opensearch suggest for '%s'", searchLine));
- }
-
- // preparation de la reponse. Un toString sur une liste retourne
- // la bonne syntaxe pour une reponse json :) si on triche un peu
- // en ajoutant des '' pour les chaines
- List json = new ArrayList();
- List<String> completions = new ArrayList<String>();
- List<String> descriptions = new ArrayList<String>();
- List<String> queryUrls = new ArrayList<String>();
-
- json.add("'" + searchLine + "'");
- json.add(completions);
- json.add(descriptions);
- json.add(queryUrls);
-
- if (searchLine != null) {
- BowUser user = getBowSession().getUser();
- WikittyProxy proxy = getBowProxy();
-
- // on ajoute * a la fin du dernier tag, car il n'est peut-etre pas fini
- String searchLineStar = searchLine + "*";
-
- // on recupere le dernier tag en train d'etre ecrit
- String lastTag;
- if (searchLine.contains(" ")) {
- lastTag = StringUtils.substringAfterLast(searchLine, " ");
- } else {
- lastTag = searchLine;
- }
-
- Set<String> searchLineList = BowUtils.getWords(searchLineStar);
-
- Search search = BookmarkUtils.addEqUser(Search.query(), user.getWikittyId());
- search.exteq(BowBookmark.EXT_WIKITTYLABEL);
- search.contains(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS, searchLineList);
-
- Criteria criteria= search
- .criteria()
- .setEndIndex(0) // on ne veut aucun resultat, c'est la facet dont on a besoin
- .setFacetMinCount(1) // on demande meme les labels avec 1 seul item
- .setFacetLimit(Integer.MAX_VALUE) // ne ne met pas -1 pour qu'il soit trie par ordre de count
- .addFacetField(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS);
-
- PagedResult<Wikitty> result = proxy.findAllByCriteria(criteria);
- // lorsqu'on demande tout (facetLimit(-1)), les topics sont trie
- // alphabetiquement pas besoin de les retrier
- List<FacetTopic> topics = result.getTopic(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS);
- if (log.isTraceEnabled()) {
- log.trace("all topics: %s" + topics);
- }
-
- // on en retourne un suggestion que le meme nombre de tag qu'il souhaite
- // voir affiche
- int count = user.getTags();
- for(FacetTopic t : topics) {
- // on ne met que les topics qui qui commence par lastTag
- String completion = t.getTopicName();
- if (log.isTraceEnabled()) {
- log.trace(String.format("'%s' startsWith '%s' ? ", completion, lastTag));
- }
- if (completion.startsWith(lastTag)) {
- String description = _("%s results",t.getCount());
- String queryUrl = String.format("%shome?token=%s&tagLine=%s",
- getConfig().getBowUrl(),
- token,
- searchLine + StringUtils.removeStart(completion, lastTag));
-
- completions.add("'" + completion + "'");
- descriptions.add("'" + description + "'");
- queryUrls.add("'" + queryUrl + "'");
-
- // on s'arrete si l'on en a assez
- count--;
- if (count <= 0) {
- break;
- }
- }
- }
- }
- if (log.isDebugEnabled()) {
- log.debug(String.format("opensearch suggest result: %s", json));
- }
- inputStream = new ReaderInputStream(new StringReader(json.toString()));
- return SUCCESS;
- }
-}
\ No newline at end of file
Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchBaseAction.java (from rev 313, trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java)
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchBaseAction.java (rev 0)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchBaseAction.java 2011-08-21 18:16:39 UTC (rev 317)
@@ -0,0 +1,121 @@
+/*
+ * #%L
+ * bow
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package org.chorem.bow.action.opensearch;
+
+import org.apache.commons.lang.StringUtils;
+import org.chorem.bow.BowUser;
+import org.chorem.bow.action.BowBaseAction;
+
+/**
+ * Traite toutes les demandes faite via l'opensearch
+ * a:, :, t:, ...
+ *
+ * Cette classe recherche le prefix et redirige vers la bonne methode execute.
+ * Les classes filles n'ont plus qu'a implanter les methodes
+ *
+ * @author poussin
+ */
+abstract public class OpenSearchBaseAction extends BowBaseAction {
+ private static final long serialVersionUID = 1L;
+
+ /** [in] le token d'identification */
+ protected String token;
+ /** [in] la ligne de recherche soumise par l'utilisateur */
+ protected String searchLine;
+
+ /**
+ * [out] le prefix trouve ou calculer par rapport a searchLine
+ * avoir acces a cette valeur, peut-etre utile dans certaine implantation
+ * de {@link #executeNotSupportedPrefixAction}
+ */
+ protected String prefix;
+
+ public String getSearchLine() {
+ return searchLine;
+ }
+
+ public void setSearchLine(String searchLine) {
+ this.searchLine = searchLine;
+ }
+
+ /**
+ * @return the token
+ */
+ public String getToken() {
+ return token;
+ }
+
+ /**
+ * @param token the token to set
+ */
+ public void setToken(String token) {
+ this.token = token;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ abstract protected String executeTagSearchAction(String query);
+
+ abstract protected String executeFulltextSearchAction(String query);
+
+ abstract protected String executeWebSearchAction(String query);
+
+ abstract protected String executeAliasSearchAction(String privateAlias);
+
+ abstract protected String executeNotSupportedPrefixAction(String query);
+
+ @Override
+ public String execute() {
+ BowUser user = getBowSession().getUser();
+
+ String prefixSeparator = user.getPrefixSeparator();
+ prefix = StringUtils.substringBefore(searchLine, prefixSeparator);
+ String query = StringUtils.substringAfter(searchLine, prefixSeparator);
+
+ if (StringUtils.isEmpty(prefix)) {
+ // on a le separateur mais pas de prefix
+ prefix = user.getDefaultPrefix();
+ } else if (StringUtils.equals(searchLine, query)) {
+ // on a pas de separateur
+ prefix = user.getDefaultAction();
+ }
+
+ String result = SUCCESS;
+ if (StringUtils.equals(prefix, user.getTagSearchPrefix())) {
+ result = executeTagSearchAction(query);
+ } else if (StringUtils.equals(prefix, user.getFullTextSearchPrefix())) {
+ result = executeFulltextSearchAction(query);
+ } else if (StringUtils.equals(prefix, user.getWebSearchPrefix())) {
+ result = executeWebSearchAction(query);
+ } else if (StringUtils.equals(prefix, user.getAliasPrefix())) {
+ result = executeAliasSearchAction(query);
+ } else {
+ result = executeNotSupportedPrefixAction(query);
+ }
+
+ return result;
+ }
+}
Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchResultAction.java (from rev 313, trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java)
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchResultAction.java (rev 0)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchResultAction.java 2011-08-21 18:16:39 UTC (rev 317)
@@ -0,0 +1,120 @@
+/*
+ * #%L
+ * bow
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package org.chorem.bow.action.opensearch;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts2.interceptor.ServletResponseAware;
+import org.chorem.bow.BowBookmark;
+import org.chorem.bow.BowConfig;
+import org.chorem.bow.BowUtils;
+import org.chorem.bow.BowUser;
+import org.nuiton.wikitty.search.Criteria;
+import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.search.Search;
+
+/**
+ * Traite toutes les demandes faite via l'opensearch
+ * a:, :, t:, ...
+ *
+ * @author poussin
+ */
+public class OpenSearchResultAction extends OpenSearchBaseAction implements ServletResponseAware {
+ private static final long serialVersionUID = 1L;
+
+ protected String redirectTo;
+ protected HttpServletResponse response;
+
+ /**
+ * @return the redirectTo
+ */
+ public String getRedirectTo() {
+ return redirectTo;
+ }
+
+ @Override
+ public void setServletResponse(HttpServletResponse response) {
+ this.response = response;
+ }
+
+ protected String executeTagSearchAction(String query) {
+ redirectTo = BowUtils.redirectTo(searchLine, null);
+ return SUCCESS;
+ }
+
+ protected String executeFulltextSearchAction(String query) {
+ redirectTo = BowUtils.redirectTo(null, searchLine);
+ return SUCCESS;
+ }
+
+ protected String executeWebSearchAction(String query) {
+ // Search on the chosen search engine
+ BowUser user = getBowSession().getUser();
+
+ String result = user.getSearchEngineUrlResults();
+ if (StringUtils.isEmpty(result)) {
+ result = BowConfig.getSearchEngine();
+ }
+ result = result.replace("{searchTerms}", query);
+ result = response.encodeRedirectURL(result);
+ redirectTo = result;
+ return SUCCESS;
+ }
+
+ protected String executeAliasSearchAction(String privateAlias) {
+ BowUser user = getBowSession().getUser();
+ WikittyProxy proxy = getBowProxy();
+ Criteria criteria = Search.query()
+ .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, user.getWikittyId())
+ .eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_PRIVATEALIAS, privateAlias)
+ .criteria();
+ String bookmarkId = proxy.findIdByCriteria(criteria);
+
+ String result;
+ // si on retrouve l'alias prive on l'utilise,
+ // sinon on espere qu'il existe un alias public portant ce nom
+ if (bookmarkId != null) {
+ result = BowConfig.getAliasUrl() + bookmarkId + ".action";
+ if (log.isDebugEnabled()) {
+ log.debug("Private alias found, redirect to: " + result);
+ }
+ } else {
+ result = BowConfig.getAliasUrl() + privateAlias + ".action";
+ if (log.isDebugEnabled()) {
+ log.debug("Private alias not found, redirect to: " + result);
+ }
+ }
+ redirectTo = result;
+ return SUCCESS;
+ }
+
+ @Override
+ protected String executeNotSupportedPrefixAction(String query) {
+ // prefix inconnu, on va sur la home
+ redirectTo = BowUtils.redirectTo(null, null);
+ return SUCCESS;
+ }
+
+}
Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchSuggestionAction.java (from rev 315, trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java)
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchSuggestionAction.java (rev 0)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/opensearch/OpenSearchSuggestionAction.java 2011-08-21 18:16:39 UTC (rev 317)
@@ -0,0 +1,231 @@
+/*
+ * #%L
+ * bow
+ *
+ * $Id$
+ * $HeadURL$
+ * %%
+ * Copyright (C) 2010 - 2011 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+package org.chorem.bow.action.opensearch;
+
+import com.opensymphony.xwork2.ActionContext;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import org.apache.commons.io.input.ReaderInputStream;
+import org.apache.commons.lang.StringUtils;
+import org.chorem.bow.BookmarkUtils;
+
+import org.chorem.bow.BowBookmark;
+import org.chorem.bow.BowUser;
+import org.chorem.bow.BowUtils;
+import org.nuiton.wikitty.search.Criteria;
+import org.nuiton.wikitty.search.FacetTopic;
+import org.nuiton.wikitty.search.PagedResult;
+import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.entities.Wikitty;
+import org.nuiton.wikitty.search.Search;
+
+/**
+ * Retourne les suggestions pour l'opensearch en fonction de ce qui a ete deja
+ * saisi
+ *
+ * @author poussin
+ */
+public class OpenSearchSuggestionAction extends OpenSearchBaseAction {
+ private static final long serialVersionUID = 1L;
+
+ static public OpenSearchSuggestionAction getAction() {
+ Object action = ActionContext.getContext().get(CONTEXT_ACTION_KEY);
+ return (OpenSearchSuggestionAction) action;
+ }
+
+ protected InputStream inputStream;
+
+ public InputStream getInputStream() {
+ return inputStream;
+ }
+
+ @Override
+ protected String executeTagSearchAction(String query) {
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Start opensearch tag suggest for '%s'", query));
+ }
+
+ // preparation de la reponse. Un toString sur une liste retourne
+ // la bonne syntaxe pour une reponse json :) si on triche un peu
+ // en ajoutant des '' pour les chaines
+ List json = new ArrayList();
+ List<String> completions = new ArrayList<String>();
+ List<String> descriptions = new ArrayList<String>();
+ List<String> queryUrls = new ArrayList<String>();
+
+ json.add("'" + query + "'");
+ json.add(completions);
+ json.add(descriptions);
+ json.add(queryUrls);
+
+ if (query != null) {
+ BowUser user = getBowSession().getUser();
+ WikittyProxy proxy = getBowProxy();
+
+ // on ajoute * a la fin du dernier tag, car il n'est peut-etre pas fini
+ String searchLineStar = query + "*";
+
+ // on recupere le dernier tag en train d'etre ecrit
+ String lastTag;
+ if (query.contains(" ")) {
+ lastTag = StringUtils.substringAfterLast(query, " ");
+ } else {
+ lastTag = query;
+ }
+
+ Set<String> searchLineList = BowUtils.getWords(searchLineStar);
+
+ Search search = BookmarkUtils.addEqUser(Search.query(), user.getWikittyId());
+ search.exteq(BowBookmark.EXT_WIKITTYLABEL);
+ search.contains(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS, searchLineList);
+
+ Criteria criteria= search
+ .criteria()
+ .setEndIndex(0) // on ne veut aucun resultat, c'est la facet dont on a besoin
+ .setFacetMinCount(1) // on demande meme les labels avec 1 seul item
+ .setFacetLimit(Integer.MAX_VALUE) // ne ne met pas -1 pour qu'il soit trie par ordre de count
+ .addFacetField(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS);
+
+ PagedResult<Wikitty> result = proxy.findAllByCriteria(criteria);
+ // lorsqu'on demande tout (facetLimit(-1)), les topics sont trie
+ // alphabetiquement pas besoin de les retrier
+ List<FacetTopic> topics = result.getTopic(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS);
+ if (log.isTraceEnabled()) {
+ log.trace("all topics: %s" + topics);
+ }
+
+ // on en retourne un suggestion que le meme nombre de tag qu'il souhaite
+ // voir affiche
+ int count = user.getTags();
+ for(FacetTopic t : topics) {
+ // on ne met que les topics qui qui commence par lastTag
+ String completion = t.getTopicName();
+ if (log.isTraceEnabled()) {
+ log.trace(String.format("'%s' startsWith '%s' ? ", completion, lastTag));
+ }
+ if (completion.startsWith(lastTag)) {
+ String description = _("%s results",t.getCount());
+ String tags = query + StringUtils.removeStart(completion, lastTag);
+ String queryUrl = getConfig().getBowUrl() + BowUtils.redirectTo(tags, null);
+
+ completions.add("'" + completion + "'");
+ descriptions.add("'" + description + "'");
+ queryUrls.add("'" + queryUrl + "'");
+
+ // on s'arrete si l'on en a assez
+ count--;
+ if (count <= 0) {
+ break;
+ }
+ }
+ }
+ }
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("opensearch suggest result: %s", json));
+ }
+ inputStream = new ReaderInputStream(new StringReader(json.toString()));
+ return SUCCESS;
+ }
+
+ @Override
+ protected String executeFulltextSearchAction(String query) {
+ return executeNotSupportedPrefixAction(query);
+ }
+
+ @Override
+ protected String executeWebSearchAction(String query) {
+ return executeNotSupportedPrefixAction(query);
+ }
+
+ @Override
+ protected String executeAliasSearchAction(String privateAlias) {
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Start opensearch alias suggest for '%s'", privateAlias));
+ }
+
+ // preparation de la reponse. Un toString sur une liste retourne
+ // la bonne syntaxe pour une reponse json :) si on triche un peu
+ // en ajoutant des '' pour les chaines
+ List json = new ArrayList();
+ List<String> completions = new ArrayList<String>();
+ List<String> descriptions = new ArrayList<String>();
+ List<String> queryUrls = new ArrayList<String>();
+
+ json.add("'" + privateAlias + "'");
+ json.add(completions);
+ json.add(descriptions);
+ json.add(queryUrls);
+
+ if (privateAlias != null) {
+ BowUser user = getBowSession().getUser();
+ WikittyProxy proxy = getBowProxy();
+
+ // on ajoute * a la fin, car il n'est peut-etre pas fini
+ String privateAliasStar = privateAlias + "*";
+
+ Search search = BookmarkUtils.addEqUser(Search.query(), user.getWikittyId());
+ search.eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_PRIVATEALIAS, privateAliasStar);
+
+ Criteria criteria= search.criteria()
+ .setEndIndex(15); // on recupere que les 15 premiers resultats
+
+ PagedResult<BowBookmark> result = proxy.findAllByCriteria(BowBookmark.class, criteria);
+
+ for(BowBookmark b: result) {
+ String completion = b.getPrivateAlias();
+ String description = b.getDescription();
+ String queryUrl = String.format("%s%s?token=%s",
+ getConfig().getAliasUrl(), completion, token);
+ completions.add("'" + completion + "'");
+ descriptions.add("'" + description + "'");
+ queryUrls.add("'" + queryUrl + "'");
+ }
+
+ }
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("opensearch alias suggest result: %s", json));
+ }
+ inputStream = new ReaderInputStream(new StringReader(json.toString()));
+ return SUCCESS;
+ }
+
+ /**
+ * On ne renvoie aucune suggestion
+ *
+ * @param prefix
+ * @param query
+ * @return
+ */
+ @Override
+ protected String executeNotSupportedPrefixAction(String query) {
+ String result = String.format("['%s', [], [], []]", query);
+ inputStream = new ReaderInputStream(new StringReader(result));
+ return SUCCESS;
+ }
+
+
+}
\ No newline at end of file
Modified: trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties
===================================================================
--- trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties 2011-08-21 16:06:25 UTC (rev 316)
+++ trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties 2011-08-21 18:16:39 UTC (rev 317)
@@ -31,6 +31,13 @@
bow.config.bow.url.description=
bow.config.configFileName.description=
bow.config.data.dir.description=
+bow.config.opensearch.alias.prefix.description=
+bow.config.opensearch.default.action.description=
+bow.config.opensearch.default.prefix.description=
+bow.config.opensearch.fulltext.search.prefix.description=
+bow.config.opensearch.prefix.separator.description=
+bow.config.opensearch.tag.search.prefix.description=
+bow.config.opensearch.web.search.prefix.description=
bow.config.search.engine.description=
bow.config.servlet.bow.description=
bow.error.internal=An internal error occurred, please contact an administrator if the problem persists
Modified: trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties
===================================================================
--- trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties 2011-08-21 16:06:25 UTC (rev 316)
+++ trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties 2011-08-21 18:16:39 UTC (rev 317)
@@ -31,6 +31,13 @@
bow.config.bow.url.description=
bow.config.configFileName.description=
bow.config.data.dir.description=
+bow.config.opensearch.alias.prefix.description=
+bow.config.opensearch.default.action.description=
+bow.config.opensearch.default.prefix.description=
+bow.config.opensearch.fulltext.search.prefix.description=
+bow.config.opensearch.prefix.separator.description=
+bow.config.opensearch.tag.search.prefix.description=
+bow.config.opensearch.web.search.prefix.description=
bow.config.search.engine.description=
bow.config.servlet.bow.description=
bow.error.internal=Une erreur interne est survenue, merci de contacter un administrateur si cette erreur persiste
Modified: trunk/bow-ui/src/main/xmi/bow.zargo
===================================================================
(Binary files differ)
1
0
Author: bpoussin
Date: 2011-08-21 18:06:25 +0200 (Sun, 21 Aug 2011)
New Revision: 316
Url: http://chorem.org/repositories/revision/bow/316
Log:
Anomalie #439: add url scriptlet in preference page don't work
Modified:
trunk/bow-ui/src/main/webapp/jsp/preferences.jsp
Modified: trunk/bow-ui/src/main/webapp/jsp/preferences.jsp
===================================================================
--- trunk/bow-ui/src/main/webapp/jsp/preferences.jsp 2011-08-20 12:14:02 UTC (rev 315)
+++ trunk/bow-ui/src/main/webapp/jsp/preferences.jsp 2011-08-21 16:06:25 UTC (rev 316)
@@ -45,13 +45,13 @@
<ul>
<li>
<s:a title="%{getText('bow.rightMenu.bookmark.temporaryLinkDescription')}"
- href="javascript:var%20url=location.href;var%20nameAndTags=prompt('Entrez%20le%20nom%20du%20lien%20et%20la%20liste%20des%20tags%20sous%20la%20forme:%20name|tag1%20tag2%20tag3',%20document.title+'|');if%20(nameAndTags!=(document.title+'|')){var%20link='%{config.bowUrl}addUrl.action?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);">
+ 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='%{config.bowUrl}addUrl.action?token=%{temporaryToken}&link='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);void(0);">
<s:text name="bow.rightMenu.bookmark.temporaryLink" />
</s:a>
</li>
<li>
<s:a title="%{getText('bow.rightMenu.bookmark.permanentLinkDescription')}"
- href="javascript:var%20url=location.href;var%20nameAndTags=prompt('Entrez%20le%20nom%20du%20lien%20et%20la%20liste%20des%20tags%20sous%20la%20forme:%20name|tag1%20tag2%20tag3',%20document.title+'|');if%20(nameAndTags!=(document.title+'|')){var%20link='%{config.bowUrl}addUrl.action?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);">
+ 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='%{config.bowUrl}addUrl.action?token=%{permanentToken}&link='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);void(0);">
<s:text name="bow.rightMenu.bookmark.permanentLink" />
</s:a>
</li>
1
0
r315 - in trunk/bow-ui/src/main: java/org/chorem/bow java/org/chorem/bow/action java/org/chorem/bow/action/bookmark java/org/chorem/bow/action/preference resources resources/i18n
by bpoussin@users.chorem.org 20 Aug '11
by bpoussin@users.chorem.org 20 Aug '11
20 Aug '11
Author: bpoussin
Date: 2011-08-20 14:14:02 +0200 (Sat, 20 Aug 2011)
New Revision: 315
Url: http://chorem.org/repositories/revision/bow/315
Log:
Evolution #438: Refactore source code and simplify all
- gros refactore de opensearch suggest, prend 25ms au lieu de 9s :D et surtout fonctionne ;)
Removed:
trunk/bow-ui/src/main/java/org/chorem/bow/OpenSearchActions.java
Modified:
trunk/bow-ui/src/main/java/org/chorem/bow/BookmarkUtils.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java
trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/UpdateUserAction.java
trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties
trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties
trunk/bow-ui/src/main/resources/struts.xml
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/BookmarkUtils.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/BookmarkUtils.java 2011-08-20 12:12:25 UTC (rev 314)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/BookmarkUtils.java 2011-08-20 12:14:02 UTC (rev 315)
@@ -42,6 +42,11 @@
*/
public static Log log = LogFactory.getLog(BookmarkUtils.class);
+ /**
+ * Ajoute a la recherche tout ce qui est necessaire pour connaitre
+ * toutes les informations que l'utilisateur peut voir, meme s'il n'est
+ * pas le createur de ce bookmark
+ */
static public Search addEqUser(Search search, String userId) {
Search result = search.or();
result = result.eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, userId);
Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/OpenSearchActions.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/OpenSearchActions.java 2011-08-20 12:12:25 UTC (rev 314)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/OpenSearchActions.java 2011-08-20 12:14:02 UTC (rev 315)
@@ -1,162 +0,0 @@
-/*
- * #%L
- * bow
- *
- * $Id$
- * $HeadURL$
- * %%
- * Copyright (C) 2010 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-package org.chorem.bow;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-import org.apache.commons.lang.StringUtils;
-import org.nuiton.wikitty.search.FacetTopic;
-
-/**
- *
- * @author bbrossaud
- */
-public class OpenSearchActions {
-
- protected List<BowBookmark> bookmarkList = new ArrayList<BowBookmark>();
- protected List<FacetTopic> suggestions = new ArrayList<FacetTopic>();
- protected String[] search;
-
- public void findSuggestions(Set<String> searchLine) {
- int size = searchLine.size();
- search = searchLine.toArray(new String[size]);
- 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);
- }
- }
- }
- List<BowBookmark> cpy = new ArrayList<BowBookmark>(bookmarkList);
- for (BowBookmark bookmark : cpy) {
- Set<String> tags = bookmark.getLabels();
- boolean delete = true;
- for (FacetTopic topic : suggestions) {
- String name = topic.getTopicName();
- if (tags != null && tags.contains(name)) {
- delete = false;
- break;
- }
- }
- if (delete) {
- bookmarkList.remove(bookmark);
- }
- }
- Collections.sort(suggestions, new SuggestionsComparator());
- }
-
- protected boolean bookmarkHasTag(BowBookmark bookmark, String tag) {
- Set<String> tagList = bookmark.getLabels();
- if (tagList != null) {
- if (tagList.contains(tag)) {
- return true;
- }
- }
- return false;
- }
-
- public void setBookmarkList(List<BowBookmark> bookmarks) {
- if (bookmarks != null) {
- List<BowBookmark> newList = new ArrayList<BowBookmark>(bookmarks);
- bookmarkList = newList;
- }
- }
-
- public String getJsonResult() {
- String str = "[";
-
- str += "\"" + StringUtils.join(search, ' ') + "\",";
- str += getJsonSuggestions();
- str += ",";
- str += getJsonDescription();
- str += "]";
- return str;
- }
-
- public String getJsonSuggestions() {
- String str = "[";
- String srch = "";
- Iterator<FacetTopic> it = suggestions.iterator();
- if (search.length > 1) {
- srch = StringUtils.join(search, ' ', 0, search.length - 1);
- srch += " ";
- }
- while (it.hasNext()) {
- FacetTopic su = it.next();
- str += "\"" + srch + su.getTopicName() + "\"";
- if (it.hasNext()) {
- str += ",";
- }
- }
- if (bookmarkList.size() <= 5 && suggestions.size() > 0) {
- for (BowBookmark bookmark : bookmarkList) {
- str += ",\"" + bookmark.getLink() + "\"";
- }
- }
- str += "]";
- return str;
- }
-
- public String getJsonDescription() {
- String str = "[";
- Iterator<FacetTopic> it = suggestions.iterator();
- while (it.hasNext()) {
- FacetTopic su = it.next();
- str += "\"" + su.getCount() + " results\"";
- if (it.hasNext()) {
- str += ",";
- }
- }
- str += "]";
- return str;
- }
-
- public void setSearch(String[] tab) {
- search = tab;
- }
-
- public void setSuggestionList(List<FacetTopic> list) {
- if (list != null) {
- suggestions = new ArrayList<FacetTopic>(list);
- }
- }
-
- public List<BowBookmark> getBookmarkList() {
- return bookmarkList;
- }
-
- public String[] getSearch() {
- return search;
- }
-
- public List<FacetTopic> getSuggestionList() {
- return suggestions;
- }
-}
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java 2011-08-20 12:12:25 UTC (rev 314)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java 2011-08-20 12:14:02 UTC (rev 315)
@@ -24,9 +24,14 @@
package org.chorem.bow.action;
import com.opensymphony.xwork2.ActionContext;
+import java.io.InputStream;
+import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
+import org.apache.commons.io.input.ReaderInputStream;
+import org.apache.commons.lang.StringUtils;
+import org.chorem.bow.BookmarkUtils;
import org.chorem.bow.BowBookmark;
import org.chorem.bow.OpenSearchActions;
@@ -36,6 +41,7 @@
import org.nuiton.wikitty.search.FacetTopic;
import org.nuiton.wikitty.search.PagedResult;
import org.nuiton.wikitty.WikittyProxy;
+import org.nuiton.wikitty.entities.Wikitty;
import org.nuiton.wikitty.search.Search;
/**
@@ -53,9 +59,23 @@
return (OpenSearchSuggestionAction) action;
}
- protected OpenSearchActions openSearchActions;
+ /** le token utilise pour faire l'appel (permanent ou temporaire) */
+ protected String token;
protected String searchLine;
+ protected InputStream inputStream;
+ public InputStream getInputStream() {
+ return inputStream;
+ }
+
+ public String getToken() {
+ return token;
+ }
+
+ public void setToken(String token) {
+ this.token = token;
+ }
+
public String getSearchLine() {
return searchLine;
}
@@ -64,47 +84,93 @@
this.searchLine = searchLine;
}
-
- public OpenSearchActions getOpenSearchActions() {
- return openSearchActions;
- }
-
@Override
public String execute() {
- BowUser user = getBowSession().getUser();
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("Start opensearch suggest for '%s'", searchLine));
+ }
+ // preparation de la reponse. Un toString sur une liste retourne
+ // la bonne syntaxe pour une reponse json :) si on triche un peu
+ // en ajoutant des '' pour les chaines
+ List json = new ArrayList();
+ List<String> completions = new ArrayList<String>();
+ List<String> descriptions = new ArrayList<String>();
+ List<String> queryUrls = new ArrayList<String>();
+
+ json.add("'" + searchLine + "'");
+ json.add(completions);
+ json.add(descriptions);
+ json.add(queryUrls);
+
if (searchLine != null) {
- openSearchActions = new OpenSearchActions();
+ BowUser user = getBowSession().getUser();
WikittyProxy proxy = getBowProxy();
- Set<String> searchLineList = BowUtils.getWords(searchLine);
+ // on ajoute * a la fin du dernier tag, car il n'est peut-etre pas fini
+ String searchLineStar = searchLine + "*";
+
+ // on recupere le dernier tag en train d'etre ecrit
+ String lastTag;
+ if (searchLine.contains(" ")) {
+ lastTag = StringUtils.substringAfterLast(searchLine, " ");
+ } else {
+ lastTag = searchLine;
+ }
- if (searchLine.charAt(searchLine.length() - 1) == ' ') {
- searchLineList.add(""); //If the user doesn't type anything, we have to propose suggestions
+ Set<String> searchLineList = BowUtils.getWords(searchLineStar);
+
+ Search search = BookmarkUtils.addEqUser(Search.query(), user.getWikittyId());
+ search.exteq(BowBookmark.EXT_WIKITTYLABEL);
+ search.contains(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS, searchLineList);
+
+ Criteria criteria= search
+ .criteria()
+ .setEndIndex(0) // on ne veut aucun resultat, c'est la facet dont on a besoin
+ .setFacetMinCount(1) // on demande meme les labels avec 1 seul item
+ .setFacetLimit(Integer.MAX_VALUE) // ne ne met pas -1 pour qu'il soit trie par ordre de count
+ .addFacetField(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS);
+
+ PagedResult<Wikitty> result = proxy.findAllByCriteria(criteria);
+ // lorsqu'on demande tout (facetLimit(-1)), les topics sont trie
+ // alphabetiquement pas besoin de les retrier
+ List<FacetTopic> topics = result.getTopic(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS);
+ if (log.isTraceEnabled()) {
+ log.trace("all topics: %s" + topics);
}
- Criteria criteria;
- if (searchLineList.size() > 1) {
- List<String> cpy = new ArrayList<String>(searchLineList);
- cpy.remove(cpy.size() - 1);
- criteria = Search.query()
- .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, user.getWikittyId())
- // TODO poussin 20110216 eq n'est sans doute pas bon, plutot un contains ?
- .eq(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS, cpy).criteria()
- .addFacetField(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS);
- } else {
- criteria = Search.query()
- .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, user.getWikittyId()).criteria()
- .addFacetField(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS);
+ // on en retourne un suggestion que le meme nombre de tag qu'il souhaite
+ // voir affiche
+ int count = user.getTags();
+ for(FacetTopic t : topics) {
+ // on ne met que les topics qui qui commence par lastTag
+ String completion = t.getTopicName();
+ if (log.isTraceEnabled()) {
+ log.trace(String.format("'%s' startsWith '%s' ? ", completion, lastTag));
+ }
+ if (completion.startsWith(lastTag)) {
+ String description = _("%s results",t.getCount());
+ String queryUrl = String.format("%shome?token=%s&tagLine=%s",
+ getConfig().getBowUrl(),
+ token,
+ searchLine + StringUtils.removeStart(completion, lastTag));
+
+ completions.add("'" + completion + "'");
+ descriptions.add("'" + description + "'");
+ queryUrls.add("'" + queryUrl + "'");
+
+ // on s'arrete si l'on en a assez
+ count--;
+ if (count <= 0) {
+ break;
+ }
+ }
}
- PagedResult<BowBookmark> result = proxy.findAllByCriteria(BowBookmark.class, criteria);
- List<BowBookmark> bookList = result.getAll();
- List<FacetTopic> topics = result.getTopic(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS);
-
- openSearchActions.setBookmarkList(bookList);
- openSearchActions.setSuggestionList(topics);
- openSearchActions.findSuggestions(searchLineList);
}
+ if (log.isDebugEnabled()) {
+ log.debug(String.format("opensearch suggest result: %s", json));
+ }
+ inputStream = new ReaderInputStream(new StringReader(json.toString()));
return SUCCESS;
}
}
\ No newline at end of file
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java 2011-08-20 12:12:25 UTC (rev 314)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java 2011-08-20 12:14:02 UTC (rev 315)
@@ -24,8 +24,6 @@
package org.chorem.bow.action.bookmark;
import com.opensymphony.xwork2.ActionContext;
-import java.util.Arrays;
-import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/UpdateUserAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/UpdateUserAction.java 2011-08-20 12:12:25 UTC (rev 314)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/UpdateUserAction.java 2011-08-20 12:14:02 UTC (rev 315)
@@ -86,9 +86,10 @@
if (result == SUCCESS) {
user = proxy.store(user);
getBowSession().setUser(user);
- addActionMessage(_("bow.preferences.update.successful"));
+ addActionMessage(_("bow.preferences.update.successful"));
}
} catch (Exception eee) {
+ result = ERROR;
addActionError(_("bow.error.internal"));
log.error("Can't change site preference", eee);
} finally {
Modified: trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties
===================================================================
--- trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties 2011-08-20 12:12:25 UTC (rev 314)
+++ trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties 2011-08-20 12:14:02 UTC (rev 315)
@@ -1,3 +1,4 @@
+%s\ results=
alias=
bow.action.locale.english=English
bow.action.locale.french=Fran\u00E7ais
Modified: trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties
===================================================================
--- trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties 2011-08-20 12:12:25 UTC (rev 314)
+++ trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties 2011-08-20 12:14:02 UTC (rev 315)
@@ -1,3 +1,4 @@
+%s\ results=
alias=
bow.action.locale.english=English
bow.action.locale.french=Fran\u00E7ais
Modified: trunk/bow-ui/src/main/resources/struts.xml
===================================================================
--- trunk/bow-ui/src/main/resources/struts.xml 2011-08-20 12:12:25 UTC (rev 314)
+++ trunk/bow-ui/src/main/resources/struts.xml 2011-08-20 12:14:02 UTC (rev 315)
@@ -158,7 +158,13 @@
<result type="redirect">${redirectTo}</result>
</action>
<action name="openSearchSuggestion" class="org.chorem.bow.action.OpenSearchSuggestionAction">
- <result>/jsp/suggestions.jsp</result>
+<!-- <result>/jsp/suggestions.jsp</result> -->
+ <result type="stream">
+ <param name="contentType">application/x-suggestions+json</param>
+ <param name="inputName">inputStream</param>
+ <param name="contentDisposition">inline</param>
+ <param name="allowCaching">false</param>
+ </result>
</action>
<action name="*Xml">
<result>/jsp/{1}Xml.jsp</result>
1
0
r314 - trunk/bow-ui/src/main/java/org/chorem/bow/action/preference
by bpoussin@users.chorem.org 20 Aug '11
by bpoussin@users.chorem.org 20 Aug '11
20 Aug '11
Author: bpoussin
Date: 2011-08-20 14:12:25 +0200 (Sat, 20 Aug 2011)
New Revision: 314
Url: http://chorem.org/repositories/revision/bow/314
Log:
Evolution #438: Refactore source code and simplify all
- suppression de la dependance a ServletRequest
Modified:
trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ExportBookmarksAction.java
Modified: trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ExportBookmarksAction.java
===================================================================
--- trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ExportBookmarksAction.java 2011-08-20 00:51:36 UTC (rev 313)
+++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ExportBookmarksAction.java 2011-08-20 12:12:25 UTC (rev 314)
@@ -34,10 +34,8 @@
import java.util.List;
import java.util.Set;
-import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.IOUtils;
-import org.apache.struts2.interceptor.ServletResponseAware;
import org.chorem.bow.BowBookmark;
import org.chorem.bow.BookmarkUtils;
import org.chorem.bow.BowUser;
@@ -51,16 +49,11 @@
*
* @author poussin
*/
-public class ExportBookmarksAction extends BowBaseAction implements ServletResponseAware {
+public class ExportBookmarksAction extends BowBaseAction {
private static final long serialVersionUID = 45880214686011946L;
- protected HttpServletResponse response;
+
protected InputStream inputStream;
- @Override
- public void setServletResponse(HttpServletResponse response) {
- this.response = response;
- }
-
public InputStream getInputStream() {
return inputStream;
}
1
0