r313 - in trunk/bow-ui/src/main: java/org/chorem/bow java/org/chorem/bow/action java/org/chorem/bow/action/admin java/org/chorem/bow/action/bookmark java/org/chorem/bow/action/login java/org/chorem/bow/action/preference resources resources/i18n resources/org/chorem/bow/action resources/org/chorem/bow/action/preference webapp/jsp webapp/jsp/inc
Author: bpoussin Date: 2011-08-20 02:51:36 +0200 (Sat, 20 Aug 2011) New Revision: 313 Url: http://chorem.org/repositories/revision/bow/313 Log: Evolution #438: Refactore source code and simplify all - refactore import/export - refactore pref action - repackage des actions - spliter preferenceAction en plusieurs action (INPUT, user, site, tag, import) - ajout d'une form pour recherche sur le web - modif du header des jsp pour utiliser <%-- au lieu de <!-- Added: trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/ trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/MigrateDataAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/ReIndexationAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/ trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/AddOrUpdateAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/DeleteSearchResultsAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/EditAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/RemoveAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/login/ trunk/bow-ui/src/main/java/org/chorem/bow/action/login/ForgotPasswordAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/login/LoginAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/login/LogoutAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/login/RegisterAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/AdminTagAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/DeleteImportAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ExportBookmarksAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/GenerateTokenAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ImportBookmarksAction.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/java/org/chorem/bow/action/preference/UpdateUserAction.java trunk/bow-ui/src/main/resources/org/chorem/bow/action/preference/ trunk/bow-ui/src/main/resources/org/chorem/bow/action/preference/UpdateUserAction-validation.xml Removed: trunk/bow-ui/src/main/java/org/chorem/bow/action/AddUrlAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/DeleteImportAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/DeleteSearchResultsAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/EditBookmarkAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/ExportBookmarksAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/GenerateTokenAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/HomeAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/LoginAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/LogoutAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/MigrateDataAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/PreferencesAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/ReIndexationAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/RegisterAction.java trunk/bow-ui/src/main/java/org/chorem/bow/action/RemoveBookmarkAction.java 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/BowUtils.java trunk/bow-ui/src/main/java/org/chorem/bow/action/BowBaseAction.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 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/jsp/admin.jsp trunk/bow-ui/src/main/webapp/jsp/editBookmark.jsp trunk/bow-ui/src/main/webapp/jsp/error.jsp trunk/bow-ui/src/main/webapp/jsp/forgotPassword.jsp trunk/bow-ui/src/main/webapp/jsp/home.jsp trunk/bow-ui/src/main/webapp/jsp/inc/bookmark.jsp trunk/bow-ui/src/main/webapp/jsp/inc/footer.jsp trunk/bow-ui/src/main/webapp/jsp/inc/header.jsp trunk/bow-ui/src/main/webapp/jsp/inc/rightMenu.jsp trunk/bow-ui/src/main/webapp/jsp/inc/tagsCloud.jsp trunk/bow-ui/src/main/webapp/jsp/login.jsp trunk/bow-ui/src/main/webapp/jsp/permanentXml.jsp trunk/bow-ui/src/main/webapp/jsp/preferences.jsp trunk/bow-ui/src/main/webapp/jsp/register.jsp trunk/bow-ui/src/main/webapp/jsp/suggestions.jsp trunk/bow-ui/src/main/webapp/jsp/temporaryXml.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-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/BookmarkUtils.java 2011-08-20 00:51:36 UTC (rev 313) @@ -23,11 +23,7 @@ */ package org.chorem.bow; -import java.text.ParseException; import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.Set; import org.apache.commons.lang.StringUtils; @@ -37,9 +33,6 @@ import org.nuiton.util.StringUtil; import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.search.FacetTopic; -import org.nuiton.wikitty.WikittyProxy; -import org.nuiton.wikitty.search.operators.Element; import org.nuiton.wikitty.search.Search; public class BookmarkUtils { @@ -58,13 +51,8 @@ return search; } - static public Criteria getBookmarkListCriteriaByUser(BowUser user) { - Criteria criteria = getBookmarkListCriteriaByUser(user, null, null, null); - return criteria; - } - static public Criteria getBookmarkListCriteriaByUser( - BowUser user, String searchLine, String fullTextLine, String order) { + BowUser user, String tagLine, String fullTextLine, String order) { Search search = Search.query(); BookmarkUtils.addEqUser(search, user.getWikittyId()); @@ -72,8 +60,8 @@ search.keyword(fullTextLine); } - if (StringUtils.isNotBlank(searchLine)) { - Set<String> tags = BowUtils.getWords(searchLine); + if (StringUtils.isNotBlank(tagLine)) { + Set<String> tags = BowUtils.getWords(tagLine); search.eq(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS, tags); } @@ -116,29 +104,6 @@ return criteria; } - static public Map<String, Integer> getBookmarksByImportDate(BowSession session, BowUser user) throws ParseException { - WikittyProxy proxy = session.getProxy(); - Criteria criteria = Search.query() - .eq(Element.ELT_EXTENSION, BowImport.EXT_BOWIMPORT) - .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, user.getWikittyId()).criteria() - .addFacetField(BowImport.FQ_FIELD_BOWIMPORT_IMPORTDATE) - .setFirstIndex(0).setEndIndex(0); - - List<FacetTopic> bookmarksImportDate = - proxy.findAllByCriteria(BowImport.class, criteria) - .getTopic(BowImport.FQ_FIELD_BOWIMPORT_IMPORTDATE); - - // Extract imports - Map<String, Integer> result = new HashMap<String, Integer>(); - for (FacetTopic facet : bookmarksImportDate) { - String dateAsString = facet.getTopicName(); - - result.put(dateAsString, facet.getCount()); - } - - return result; - } - /** * @param url String which contains the bookmark url * @param nameAndTags String which contains the name and the tags of the 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-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/BowSearchResult.java 2011-08-20 00:51:36 UTC (rev 313) @@ -55,7 +55,7 @@ private static final Log log = LogFactory.getLog(BowSearchResult.class); /** la ligne contenant les tags a rechercher */ - protected String searchLine; + protected String tagLine; /** la ligne contenant le fulltext a recherche */ protected String fullTextLine; /** l'ordre souhaite pour l'affichage */ @@ -73,13 +73,13 @@ * * @param session la session de l'utilisateur sur lequel on peut recuperer * le proxy et les preferences - * @param searchLine (optionel) le liste des tags a rechercher + * @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 searchLine, String fullTextLine, String order) { - this.searchLine = StringUtils.defaultString(searchLine); + String tagLine, String fullTextLine, String order) { + this.tagLine = StringUtils.defaultString(tagLine); this.fullTextLine = StringUtils.defaultString(fullTextLine); this.order = StringUtils.defaultString(order); @@ -87,7 +87,7 @@ BowProxy proxy = session.getProxy(); Criteria criteria = BookmarkUtils.getBookmarkListCriteriaByUser( - user, searchLine, fullTextLine, order); + user, tagLine, fullTextLine, order); PagedResult<BowBookmark> result = proxy.findAllByCriteria(BowBookmark.class, criteria); @@ -115,7 +115,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(getSearchLine()); + Set<String> tagsSearch = BowUtils.getWords(gettagLine()); for(Iterator<FacetTopic> i=tagsCloud.iterator(); i.hasNext();) { FacetTopic topic = i.next(); @@ -143,8 +143,8 @@ } } - public String getSearchLine() { - return searchLine; + public String gettagLine() { + return tagLine; } public int getFont(int ti) { @@ -163,7 +163,7 @@ } public Set<String> getTagsSearch() { - return BowUtils.getWords(getSearchLine()); + return BowUtils.getWords(gettagLine()); } public List<BowBookmark> getBookmarks() { Modified: trunk/bow-ui/src/main/java/org/chorem/bow/BowUtils.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/BowUtils.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/BowUtils.java 2011-08-20 00:51:36 UTC (rev 313) @@ -136,21 +136,21 @@ /** * Redirects the user either on the home page or on the search page * - * @param searchLine search line + * @param tagLine search line * @param fullTextLine full text search * @return the page where the user will be redirected */ - static public String redirectTo(String searchLine, String fullTextLine) { + static public String redirectTo(String tagLine, String fullTextLine) { String result = "home.action"; - boolean searchLineNotBlank = StringUtils.isNotBlank(searchLine); + boolean tagLineNotBlank = StringUtils.isNotBlank(tagLine); boolean fullTextLineNotBlank = StringUtils.isNotBlank(fullTextLine); - if (searchLineNotBlank || fullTextLineNotBlank) { + if (tagLineNotBlank || fullTextLineNotBlank) { result += "?"; - if (searchLineNotBlank) { - result += "searchLine=" + searchLine; + if (tagLineNotBlank) { + result += "tagLine=" + tagLine; } - if (searchLineNotBlank && fullTextLineNotBlank) { + if (tagLineNotBlank && fullTextLineNotBlank) { result += "&"; } if (fullTextLineNotBlank) { Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/AddUrlAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/AddUrlAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/AddUrlAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,262 +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 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.WikittyProxy; -import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.search.PagedResult; -import org.nuiton.wikitty.search.Search; - -/** - * Ajoute ou modifie un bookmark, soit par le formulaire, - * soit par un appel javascript - * - * @author poussin - */ -public class AddUrlAction extends BowBaseAction { - - private static final long serialVersionUID = 3389170166034184139L; - - protected String bookmarkId; - protected String link; - protected String name; - protected String privateAlias; - protected String publicAlias; - protected String tags; - protected String nameAndTags; - protected String redirectTo; - - public String getBookmarkId() { - return bookmarkId; - } - - public void setBookmarkId(String bookmarkId) { - this.bookmarkId = bookmarkId; - } - - /** - * @return the link - */ - public String getLink() { - return link; - } - - /** - * @param link the link to set - */ - public void setLink(String link) { - this.link = link; - } - - /** - * @return the description - */ - public String getName() { - return name; - } - - /** - * @param name the description to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return the privateAlias - */ - public String getPrivateAlias() { - return privateAlias; - } - - /** - * @param alias the privateAlias to set - */ - public void setPrivateAlias(String alias) { - this.privateAlias = alias; - } - - public String getPublicAlias() { - return publicAlias; - } - - public void setPublicAlias(String publicAlias) { - this.publicAlias = publicAlias; - } - - /** - * @return the tags - */ - public String getTags() { - return tags; - } - - /** - * @param tags the tags to set - */ - public void setTags(String tags) { - this.tags = tags; - } - - /** - * @return the nameAndTags - */ - public String getNameAndTags() { - return nameAndTags; - } - - /** - * @param nameAndTags the nameAndTags to set - */ - public void setNameAndTags(String nameAndTags) { - this.nameAndTags = nameAndTags; - } - - /** - * @return the redirectTo - */ - public String getRedirectTo() { - return redirectTo; - } - - public String execute() { - try { - WikittyProxy proxy = getBowProxy(); - BowBookmark bookmark = null; - BowBookmark bookmarkToModify = null; - - BowUser user = getBowSession().getUser(); - String userId = user.getWikittyId(); - if (StringUtils.isNotBlank(bookmarkId)) { - bookmarkToModify = proxy.restore(BowBookmark.class, bookmarkId); - } - if (log.isDebugEnabled()) { - log.debug("Change old wikitty: " + bookmarkToModify); - } - - // gere le cas d'une mise a jour ou d'un ajout via le formulaire - if (name != null) { - // Si l'alias prive souhaite est deja utilise on ne l'accept pas - // Si l'alias public souhaite est deja utilise on ne l'accept pas - // TODO sletellier 20110416 : return error message when public or private alias is already used - Criteria privateAliasCriteria = null; - Criteria publicAliasCriteria = null; - if (StringUtils.isNotEmpty(privateAlias)) { - privateAliasCriteria = Search.query() - .eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_PRIVATEALIAS, privateAlias) - .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, userId) - .criteria().setEndIndex(0); - } - if (StringUtils.isNotEmpty(publicAlias)) { - publicAliasCriteria = Search.query() - .eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_PUBLICALIAS, publicAlias) - .criteria().setEndIndex(0); - } - PagedResult<String>[] aliasResult = proxy.findAllIdByCriteria( - privateAliasCriteria, publicAliasCriteria); - - if (aliasResult[0] != null && aliasResult[0].getNumFound() > 0) { - if (bookmarkToModify == null) { - privateAlias = ""; - } else { - privateAlias = bookmarkToModify.getPrivateAlias(); - } - } - if (aliasResult[1] != null && aliasResult[1].getNumFound() > 0) { - if (bookmarkToModify == null) { - publicAlias = ""; - } else { - publicAlias = bookmarkToModify.getPublicAlias(); - } - } - - if (bookmarkToModify == null) { - bookmark = BookmarkUtils.createBookmark( - link, name, tags, user, privateAlias, publicAlias, null); - } else { - BookmarkUtils.updateBookmark( - bookmarkToModify, name, link, tags, privateAlias, publicAlias); - } - } else { //This part is for the bookmark addition by script - if (nameAndTags != null) { - bookmark = BookmarkUtils.createBookmark(link, nameAndTags, user); - } - } - // si on a reussi a creer le bookmark, on regarde s'il ne faut pas - // le fusionner avec un deja existant - if (bookmark != null && !bookmark.getDescription().isEmpty() - && !bookmark.getOwner().isEmpty()) { - - // looking for already bookmark with same url, to fusion them - String link = bookmark.getLink(); - Criteria criteria = Search.query() - .eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_LINK, link) - .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, userId) - .criteria(); - BowBookmark oldBookmark = - proxy.findByCriteria(BowBookmark.class, criteria); - if(oldBookmark != null) { - // fusionne les descriptions et les tags - // par contre on prend le dernier privateAlias prive choisi par - // l'utilisateur s'il y en a un - String description = oldBookmark.getDescription(); - if (!StringUtils.isEmpty(bookmark.getDescription())) { - description += "\n"; - description += BowUtils.formatDate( - bookmark.getCreationDate()) + ": "; - description += bookmark.getDescription(); - } - - oldBookmark.setDescription(description); - oldBookmark.addAllLabels(bookmark.getLabels()); - String privateAlias = bookmark.getPrivateAlias(); - if (!StringUtils.isEmpty(privateAlias)) { - oldBookmark.setPrivateAlias(privateAlias); - } - - bookmark = oldBookmark; - } - - } - - if (bookmark != null || bookmarkToModify != null) { - proxy.store(bookmark, bookmarkToModify); //Stores the bookmark if everything is ok - addActionMessage(_("bow.bookmark.add.successful")); - if (log.isDebugEnabled()) { - log.debug("Adding URL"); - } - } - redirectTo = BowUtils.redirectTo(searchLine, fullTextLine); - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return SUCCESS; - } -} \ No newline at end of file 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-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/BowBaseAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -23,6 +23,8 @@ */ package org.chorem.bow.action; +import java.util.Arrays; +import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.Map; @@ -48,10 +50,19 @@ public static final String UNTRANSLATED_MARKER = "???"; + // perhaps use enumeration ? + final static protected List<String> possibleOrder = Arrays.asList( + "ascName", "descName", "ascClick", "descClick", "ascDate", "descDate"); + + public static List<String> getPossibleOrder() { + return possibleOrder; + } + protected BowConfig config = null; protected Map<String, Object> session; - protected String searchLine; + protected String tagLine; protected String fullTextLine; + protected String order; public BowConfig getConfig() { if (config == null) { @@ -76,17 +87,17 @@ } /** - * @return the searchLine + * @return the tagLine */ - public String getSearchLine() { - return searchLine; + public String getTagLine() { + return tagLine; } /** - * @param searchLine the searchLine to set + * @param tagLine the tagLine to set */ - public void setSearchLine(String searchLine) { - this.searchLine = searchLine; + public void setTagLine(String tagLine) { + this.tagLine = tagLine; } /** @@ -102,4 +113,13 @@ public void setFullTextLine(String fullTextLine) { this.fullTextLine = fullTextLine; } + + public String getOrder() { + return order; + } + + public void setOrder(String order) { + this.order = order; + } + } \ No newline at end of file Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/DeleteImportAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/DeleteImportAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/DeleteImportAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,87 +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 java.util.List; - -import org.chorem.bow.BowBookmark; -import org.chorem.bow.BowImport; -import org.chorem.bow.BowUser; -import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.WikittyProxy; -import org.nuiton.wikitty.search.Search; - - -/** - * Supprime un import de bookmark - * - * @author poussin - */ -public class DeleteImportAction extends BowBaseAction { - private static final long serialVersionUID = 8714394293884265516L; - protected String date; - - /** - * @return the date - */ - public String getDate() { - return date; - } - /** - * @param date the date to set - */ - public void setDate(String date) { - this.date = date; - } - - /** - * Deletes a bookmark import - */ - public String execute() { - try { - if (date != null && - date.matches("[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{1,3}Z")) { - WikittyProxy proxy = getBowProxy(); - BowUser user = getBowSession().getUser(); - Criteria criteria = Search.query() - .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, user.getWikittyId()) - .eq(BowImport.FQ_FIELD_BOWIMPORT_IMPORTDATE, date).criteria(); - List<BowImport> bookmarks = proxy.findAllByCriteria(BowImport.class, criteria).getAll(); - - if (log.isDebugEnabled()) { - log.debug("Will delete " + bookmarks.size() + " bookmarks"); - } - - proxy.delete(bookmarks); - - addActionMessage(_("bow.bookmark.import.delete.successful")); - } - } catch (Exception e) { - addActionError(_("bow.error.internal")); - log.error(e.getMessage(), e); - } - return SUCCESS; - } - -} \ No newline at end of file Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/DeleteSearchResultsAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/DeleteSearchResultsAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/DeleteSearchResultsAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,74 +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 java.util.List; -import org.apache.commons.lang.StringUtils; - -import org.chorem.bow.BookmarkUtils; -import org.chorem.bow.BowUser; -import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.WikittyProxy; - -/** - * Supprime des bookmarks qui satisfont le critere de recherche. - * - * @author poussin - */ -public class DeleteSearchResultsAction extends BowBaseAction { - - private static final long serialVersionUID = -3903724044644625507L; - - /** - * Deletes the search results - */ - public String execute() { - try { - if (StringUtils.isNotBlank(searchLine) - || StringUtils.isNotBlank(fullTextLine)) { - BowUser user = getBowSession().getUser(); - // FIXME poussin 20110817 ATTENTION, la recherche remonte - // potentiellement des bookmarks qui ne nous appartiennent pas, - // dans ce cas, ne faudrait-il pas seulement ce supprimer des - // reader/write/admin ? - Criteria criteria = BookmarkUtils.getBookmarkListCriteriaByUser( - user, searchLine, fullTextLine, null); - - WikittyProxy proxy = getBowProxy(); - List<String> ids = proxy.findAllIdByCriteria(criteria).getAll(); - - if (log.isDebugEnabled()) { - log.debug("Will delete " + ids.size() + " bookmarks"); - } - - proxy.delete(ids); - addActionMessage(_("bow.search.results.deleted")); - } - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return SUCCESS; - } -} \ No newline at end of file Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/EditBookmarkAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/EditBookmarkAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/EditBookmarkAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,75 +0,0 @@ -/* - * #%L - * BOW UI - * - * $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 org.chorem.bow.BowBookmark; -import org.chorem.bow.BowBookmarkImpl; -import org.nuiton.wikitty.WikittyProxy; -import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.search.Search; -import org.nuiton.wikitty.search.operators.Element; - -/** - * Load a bookmark to display it on modification page, used when javascript - * is not available on client - * - * @author sletellier - */ -public class EditBookmarkAction extends BowBaseAction { - - protected String id; - protected BowBookmark bookmark; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public BowBookmark getBookmark() { - if (bookmark == null) { - bookmark = new BowBookmarkImpl(); - } - return bookmark; - } - - @Override - public String execute() throws Exception { - if (id == null) { - return SUCCESS; - } - try { - WikittyProxy proxy = getBowProxy(); - Criteria criteria = Search.query() - .eq(Element.ELT_ID, id).criteria(); - bookmark = proxy.findByCriteria(BowBookmark.class, criteria); - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return SUCCESS; - } -} Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/ExportBookmarksAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/ExportBookmarksAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/ExportBookmarksAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,138 +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 java.io.BufferedWriter; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileWriter; -import java.io.IOException; -import java.io.InputStream; -import java.io.Writer; -import java.util.Date; -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; -import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.WikittyProxy; -import org.nuiton.wikitty.search.Search; - -/** - * Export son bookmark au format HTML - * - * @author poussin - */ -public class ExportBookmarksAction extends BowBaseAction implements ServletResponseAware { - 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; - } - - /** - * Export tous les bookmarks au format HTML tel que le fait les navigateurs - * - * @param bookmarks List<Bookmarks> bookmarks - * @param out le flux dans lequel il faut ecrire l'export - * @return String the html file - */ - protected void generateExportHtmlBookmark(List<BowBookmark> bookmarks, Writer out) throws IOException { - out.write("<!DOCTYPE NETSCAPE-Bookmark-file-1>\n" - + "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n" - + "<DL><p>\n"); - if (bookmarks != null) { - for (BowBookmark bookmark : bookmarks) { - if (bookmark != null) { - out.write("<DT><A HREF=\""); - out.write(bookmark.getLink() + "\" "); - Date date = bookmark.getCreationDate(); - if (date != null) { - long milli = date.getTime(); - String time = String.valueOf(milli / 1000); - out.write("ADD_DATE=\"" + time + "\" LAST_MODIFIED=\"" + time + "\" "); - } - out.write("LAST_CHARSET=\"UTF-8\" "); - Set<String> tags = bookmark.getLabels(); - if (tags != null && !tags.isEmpty()) { - out.write("SHORTCUTURL=\"" - + BookmarkUtils.getBookmarkTagsString(bookmark) + "\""); - } - out.write(">" + bookmark.getDescription() + "</A>\n"); - } - } - } - out.write("</DL><p>"); - } - - /** - * Exports the bookmarks in HTML format - */ - @Override - public String execute() { - WikittyProxy proxy = getBowProxy(); - - // get current user - BowUser user = getBowSession().getUser(); - - // Get all bookmark for user - Criteria criteria = Search.query() - .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, user.getWikittyId()).criteria(); - List<BowBookmark> bookmarks = proxy.findAllByCriteria(BowBookmark.class, criteria).getAll(); - - // Export all - BufferedWriter out = null; - - try { - - // Write result in temp file - File tmp = File.createTempFile("bookmarks", ".tmp.html"); - - tmp.deleteOnExit(); - out = new BufferedWriter(new FileWriter(tmp)); - generateExportHtmlBookmark(bookmarks, out); - out.close(); - - inputStream = new FileInputStream(tmp); - } catch (IOException eee) { - log.error("Error when exporting bookmarks to HTML : ", eee); - } finally { - IOUtils.closeQuietly(out); - } - return SUCCESS; - } -} \ No newline at end of file Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,123 +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.mail.MessagingException; -import javax.mail.internet.AddressException; - -import org.apache.commons.lang.RandomStringUtils; -import org.apache.commons.lang.StringUtils; -import org.chorem.bow.BowMail; -import org.chorem.bow.BowUser; -import org.nuiton.util.StringUtil; -import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.WikittyProxy; -import org.nuiton.wikitty.search.Search; - -/** - * Genere un nouveau mot de passe pour l'utilisateur et lui envoie par mail - * TODO poussin 20110211 il faudrait ajouter une securite pour eviter que - * quelqu'un s'amuse a demander la modification de password de quelqu'un d'autre - * toutes les 2s - * - soit en ne permettant l'envoi qu'une fois par jour - * - soit ???? - * - * @author poussin - */ -public class ForgotPasswordAction extends BowBaseAction { - private static final long serialVersionUID = -8207951465957204954L; - protected String email; - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @param email the email to set - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * Generates a new password and sends it to the user - */ - @Override - public String execute() { - String result = INPUT; - - try { - if (StringUtils.isNotBlank(email)) { - email = email.trim(); - WikittyProxy proxy = getBowProxy(); - Criteria criteria = Search.query() - .eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email).criteria(); - BowUser user = proxy.findByCriteria(BowUser.class, criteria); - - if (user != null) { //If the email address exists - String password = ""; - String md5 = ""; - - password = RandomStringUtils.randomAlphanumeric(20); - md5 = StringUtil.encodeMD5(password); - try { - String mailContent; - - mailContent = _("bow.register.mailHi") + - ",\n\n" + _("bow.register.mailPwd") + ": " + - password + "\n\n" + _("bow.register.mailEmail") + - ": " + email + "\n\n"; - BowMail.sendMail(email, - _("bow.register.mailSubject"), - mailContent); - - //The password is changed only if the mail has been sent - user.setPassword(md5); - proxy.store(user); - } catch (AddressException eee) { - //If the email address is invalid - addActionError(_("bow.mail.badFormat")); - log.error(String.format("Can't send message email to '%s'", - email), eee); - } catch (MessagingException eee) { - addActionError("bow.mail.sendError"); - log.error(String.format("Can't send message email to '%s'", - email), eee); - } - result = SUCCESS; - } else { //If the email is not associated with an account - addFieldError("email", - _("bow.forgotPassword.emailDoesntExist")); - } - } - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return result; - } -} \ No newline at end of file Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/GenerateTokenAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/GenerateTokenAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/GenerateTokenAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,61 +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 org.chorem.bow.BowUser; -import org.chorem.bow.BowUtils; -import org.nuiton.wikitty.WikittyProxy; - -/** - * Force la regeneration de token permanent et temporaire - * - * @author poussin - */ -public class GenerateTokenAction extends BowBaseAction { - - private static final long serialVersionUID = 1141019772989666309L; - - /** - * Generates a new permanent and temporary token - */ - @Override - public String execute() { - try { - BowUser user = getBowSession().getUser(); - WikittyProxy proxy = getBowProxy(); - - String permanentToken = BowUtils.generateToken(); - user.setPermanentToken(permanentToken); - proxy.store(user); - - String temporaryToken = BowUtils.generateToken(); - getBowSession().setTemporaryToken(temporaryToken); - addActionMessage(_("bow.token.generate.successful")); - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return SUCCESS; - } -} \ No newline at end of file Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/HomeAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/HomeAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/HomeAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,119 +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.util.Arrays; -import java.util.List; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.chorem.bow.BowSearchResult; -import org.chorem.bow.BowSession; -import org.nuiton.util.TimeLog; - -/** - * Prepare l'affichage de la page d'accueil - * - * @author poussin - */ -public class HomeAction extends BowBaseAction { - - private static final Log log = LogFactory.getLog(HomeAction.class); - private static final TimeLog timeLog = new TimeLog(HomeAction.class); - - private static final long serialVersionUID = -3735250067223062719L; - - private static final String ALIAS_SERVLET_URL = "aliasServletUrl"; - - static public HomeAction getAction() { - Object action = ActionContext.getContext().get(CONTEXT_ACTION_KEY); - return (HomeAction) action; - } - - protected String order; - protected String addTag; - final static protected List<String> possibleOrder = Arrays.asList( - "ascName", "descName", "ascClick", "descClick", "ascDate", "descDate"); - - protected BowSearchResult searchResult; - - public static List<String> getPossibleOrder() { - return possibleOrder; - } - - public String getOrder() { - return order; - } - - public void setOrder(String order) { - this.order = order; - } - - public String getAddTag() { - return addTag; - } - - public void setAddTag(String addTag) { - this.addTag = addTag; - } - - public BowSearchResult getSearchResult() { - return searchResult; - } - - public void setSearchResult(BowSearchResult searchResult) { - this.searchResult = searchResult; - } - - /** - * Initializes everything before displaying the home page - */ - @Override - public String execute() { - long start = TimeLog.getTime(); - try { - // on ajoute les tags qui doivent faire parti de ne nouvelle recherche - // on restocke dans searchLine pour que la bonne info reapparaisse - // a l'utilisateur - searchLine = StringUtils.join(new String[]{searchLine, addTag}, " ").trim(); - - // si l'ordre souhaite n'existe pas, on utilise l'ordre par defaut - if (!getPossibleOrder().contains(order)) { - // default sort order - // TODO poussin 20110815 rendre configurable par l'utilisateur l'ordre par defaut qu'il prefere - order = "descClick"; - } - - BowSession s = getBowSession(); - searchResult = new BowSearchResult(s, searchLine, fullTextLine, order); - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - timeLog.log(start, "execute"); - return SUCCESS; - } -} \ No newline at end of file Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,256 +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 java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import org.apache.commons.lang.StringUtils; - -import org.chorem.bow.BookmarkUtils; -import org.chorem.bow.BowBookmark; -import org.chorem.bow.BowImportHelper; -import org.chorem.bow.BowUser; -import org.htmlparser.Node; -import org.htmlparser.Parser; -import org.htmlparser.util.NodeList; -import org.htmlparser.util.ParserException; -import org.htmlparser.util.SimpleNodeIterator; -import org.nuiton.wikitty.WikittyProxy; -import org.nuiton.wikitty.entities.Wikitty; - -/** - * Import un bookmark HTML - * - * @author poussin - */ -public class ImportBookmarksAction extends PreferencesAction { - - private static final long serialVersionUID = -5962680416570797028L; - - protected File upfile; - protected String upfileContentType; - protected String upfileFileName; - - /** - * @return the upfile - */ - public File getUpfile() { - return upfile; - } - - /** - * @param upfile - * the upfile to set - */ - public void setUpfile(File upfile) { - this.upfile = upfile; - } - - /** - * @return the upfileContentType - */ - public String getUpfileContentType() { - return upfileContentType; - } - - /** - * @param upfileContentType - * the upfileContentType to set - */ - public void setUpfileContentType(String upfileContentType) { - this.upfileContentType = upfileContentType; - } - - /** - * @return the upfileFileName - */ - public String getUpfileFileName() { - return upfileFileName; - } - - /** - * @param upfileFileName - * the upfileFileName to set - */ - public void setUpfileFileName(String upfileFileName) { - this.upfileFileName = upfileFileName; - } - - /** - * @param html String html - * @param name String name - * @param user User user - * @return Bookmark the bookmark filled - */ - protected BowBookmark createBookmarkFromHtml(String html, String name, BowUser user) { - String link = getUrlFromHtml(html); - String tags = getTagsFromHtml(html); - Date date = getDateFromHtml(html); - BowBookmark bookmark = BookmarkUtils.createBookmark(link, name, tags, user, null, null, date); - return bookmark; - } - - /** - * @param html String html - * @return Date from the html - */ - protected Date getDateFromHtml(String html) { - Date date = null; - if (html != null) { - Pattern p = Pattern.compile("ADD_DATE=\"([^\"]*)\""); - Matcher m = p.matcher(html); - if (m.find()) { - String str = m.group(1); - if (str != null && !str.isEmpty()) { - long time = Long.valueOf(str) * 1000; // the date in ms - date = new Date(time); - } - } - } - return date; - } - - /** - * @param html String html - * @return url - */ - protected String getUrlFromHtml(String html) { - String url = ""; - if (html != null) { - Pattern p = Pattern.compile("A HREF=\"([^\"]*)\""); - Matcher m = p.matcher(html); - if (m.find()) { - url = m.group(1); - } - } - return url; - } - - protected String getTagsFromHtml(String html) { - String tags = ""; - if (html != null) { - Pattern p = Pattern.compile("SHORTCUTURL=\"([^\"]*)\""); - Matcher m = p.matcher(html); - if (m.find()) { - tags = m.group(1); - } - } - return tags; - } - - protected void parseHtmlToBookmarks(NodeList list, BowUser user, Date date, - List<BowBookmark> bookmarks, Set<String> tagList) - throws ParserException { - - SimpleNodeIterator it = list.elements(); - - while (it.hasMoreNodes()) { - Node node = it.nextNode(); - String plainText = node.toPlainTextString(); // The text between - // two heads ==> - // <toto>plainText</toto> - String text = node.getText(); // The text in the head ==> - // <text></toto> - - if (StringUtils.startsWithIgnoreCase(text, "h3")) { // H3 = folder - if (StringUtils.isNotBlank(plainText)) { - tagList.add(plainText); // Adds the folder name to the - // tagList - } - } else if (StringUtils.startsWithIgnoreCase(text, "a href")) { // HREF - // = new - // bookmarks - BowBookmark bookmark = createBookmarkFromHtml(text, plainText, user); - Wikitty w = getBowProxy().getWikitty(bookmark); - BowImportHelper.addExtension(w); - BowImportHelper.setImportDate(w, date); - - bookmark.addAllLabels(tagList); - - bookmarks.add(bookmark); - } - NodeList children = node.getChildren(); - - if (children != null) { - parseHtmlToBookmarks(children, user, date, bookmarks, - // On utilise une nouvelle liste pour les enfants - // pour eviter que les tags de tous les enfants se - // retrouve ensemble - new HashSet<String>(tagList)); // If there is an under node = recursion - } - } - } - - @Override - public String execute() { - - log.info("Importing boormarks : " + upfile); - try { - BowUser user = getBowSession().getUser(); - - // Struts limite to html files, is null if not one - if (upfile != null) { - WikittyProxy proxy = getBowProxy(); - - try { - URL url = upfile.toURI().toURL(); - Parser parser = new Parser(url.openConnection()); - NodeList list = parser.parse(null); - - List<BowBookmark> bookmarks = new ArrayList<BowBookmark>(); - parseHtmlToBookmarks(list, user, new Date(), bookmarks, - new HashSet<String>()); - proxy.store(bookmarks); - - addActionMessage(_("bow.bookmark.import.successful")); - } catch (ParserException eee) { - log.error(String.format("Can't parse imported file '%s'", - getUpfileFileName()), eee); - addActionError(_("bow.bookmark.badFileFormat")); - } catch (IOException eee) { - log.error(String.format("Can't read imported file '%s'", - getUpfileFileName()), eee); - addActionError(_("bow.error.internal")); - return ERROR; - } - } else { - addActionError(_("bow.bookmark.badFileFormat")); - return ERROR; - } - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - return ERROR; - } - return SUCCESS; - } -} Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/LoginAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/LoginAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/LoginAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,129 +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.action; - -import org.apache.commons.lang.StringUtils; - -import org.chorem.bow.BowConfig; -import org.chorem.bow.BowUser; -import org.chorem.bow.BowUserImpl; -import org.nuiton.util.StringUtil; -import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.WikittyProxy; -import org.nuiton.wikitty.search.Search; - -/** - * authentifie l'utilisateur et place son objet User dans la bow session - * - * @author poussin - */ -public class LoginAction extends BowBaseAction { - - private static final long serialVersionUID = 6891064800288772246L; - - protected String email; - protected String password; - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - /** - * Check password in solr index, if fail try to check password admin in config file - * - * @param email non null et non vide email - * @param password non null et non vide email - * @return - */ - protected BowUser checkLogin(String email, String password) { - BowUser result = null; - - WikittyProxy proxy = getBowProxy(); - Criteria criteria = Search.query().eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email). - eq(BowUser.FQ_FIELD_WIKITTYUSER_PASSWORD, password).criteria(); - result = proxy.findByCriteria(BowUser.class, criteria); - - if (result == null) { - // failback: try to authenticate admin with config info - String configPassword = BowConfig.getAdminPassword(email); - log.info(String.format("failback password: '%s' configPassword: '%s'", - password, configPassword)); - if (password.equals(configPassword)) { - // admin authenticate with config, this is possible when - // solr index is corrupted or missed. Admin must go to admin - // page en recreate index - result = new BowUserImpl(); - result.setLogin(email); - result.setPassword(configPassword); - addActionMessage(_("bow.login.admin.failback")); - log.warn(_("bow.login.admin.failback")); - } else { - addActionError(_("bow.login.authenticationFailure")); - } - } - return result; - } - - /** - * Authenticates the user if his email and password are valid - */ - @Override - public String execute() { - String result = INPUT; - - try { - if (StringUtils.isNotBlank(email)) { - email = email.trim(); - - if (StringUtils.isNotEmpty(password)) { - String md5 = StringUtil.encodeMD5(password); - BowUser user; - - user = checkLogin(email, md5); - if (user != null) { - getBowSession().setUser(user); - result = SUCCESS; - } - } - } - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return result; - } -} \ No newline at end of file Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/LogoutAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/LogoutAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/LogoutAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,41 +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 org.chorem.bow.BowSession; - -/** - * Invalide la session courante et donc de-authentifie l'utilisateur - * - * @author poussin - */ -public class LogoutAction extends BowBaseAction { - private static final long serialVersionUID = 4806944250461551896L; - - @Override - public String execute() { - BowSession.invalidate(session); - return SUCCESS; - } -} Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/MigrateDataAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/MigrateDataAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/MigrateDataAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,94 +0,0 @@ -/* - * #%L - * BOW UI - * - * $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 org.apache.commons.lang.StringUtils; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.chorem.bow.BowMigration04To05; -import org.chorem.bow.BowMigration06To11; -import org.chorem.bow.BowSession; -import org.nuiton.util.VersionUtil; -import org.nuiton.wikitty.WikittyProxy; - -/** - * Lance la migration des données de la version 0.4 vers 0.5 - * - * @author poussin - * @version $Revision$ - * - * Last update: $Date$ - * by : $Author$ - */ -public class MigrateDataAction extends BowBaseAction { - - /** to use log facility, just put in your code: log.info(\"...\"); */ - static private Log log = LogFactory.getLog(MigrateDataAction.class); - - /** Version must be real version, like 0.4, 0.5 or 0.6 */ - protected String versionFrom; - protected String versionTo; - - public void setVersionFrom(String versionFrom) { - this.versionFrom = versionFrom; - } - - public void setVersionTo(String versionTo) { - this.versionTo = versionTo; - } - - @Override - public String execute() { - try { - if (StringUtils.isBlank(versionFrom) || StringUtils.isBlank(versionTo)) { - log.error("Migration action must have to parameter: versionFrom and versionTo"); - } else { - BowSession session = getBowSession(); - if (session.isAdmin()) { //If is admin - WikittyProxy proxy = getBowProxy(); - - if (VersionUtil.equals(versionFrom, "0.4") - && VersionUtil.equals(versionTo, "0.5")) { - BowMigration04To05.migrate(proxy); - addActionMessage(_("bow.admin.dataMigration.success")); - } else if (VersionUtil.equals(versionFrom, "0.6") - && VersionUtil.equals(versionTo, "1.1")) { - BowMigration06To11.migrate(proxy); - addActionMessage(_("bow.admin.dataMigration.success")); - } else { - addActionMessage(String.format( - "No migration found for %s to %s", - versionFrom, versionTo)); - } - } - } - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return SUCCESS; - } - -} Modified: 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-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchResultAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -47,7 +47,16 @@ 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 */ 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-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/OpenSearchSuggestionAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -54,7 +54,17 @@ } protected OpenSearchActions openSearchActions; + protected String searchLine; + public String getSearchLine() { + return searchLine; + } + + public void setSearchLine(String searchLine) { + this.searchLine = searchLine; + } + + public OpenSearchActions getOpenSearchActions() { return openSearchActions; } Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/PreferencesAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/PreferencesAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/PreferencesAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,493 +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 org.chorem.bow.BookmarkUtils; -import org.chorem.bow.BowBookmark; -import org.chorem.bow.BowPreference; -import org.chorem.bow.BowProxy; -import org.chorem.bow.BowUser; -import com.opensymphony.xwork2.ActionContext; -import java.text.ParseException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Date; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.commons.lang.StringUtils; -import org.chorem.bow.BowSession; - -import org.nuiton.util.StringUtil; -import org.nuiton.wikitty.WikittyProxy; -import org.nuiton.wikitty.WikittyUtil; -import org.nuiton.wikitty.entities.Wikitty; -import org.nuiton.wikitty.entities.WikittyLabel; -import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.search.FacetTopic; -import org.nuiton.wikitty.search.PagedResult; -import org.nuiton.wikitty.search.Search; - -/** - * Change les preferences de l'utilisateur (couleur, password, email, ...) - * - * @author poussin - */ -public class PreferencesAction extends BowBaseAction { - private static final long serialVersionUID = -58341106356599721L; - - static public PreferencesAction getAction() { - Object action = ActionContext.getContext().get(CONTEXT_ACTION_KEY); - return (PreferencesAction) action; - } - - 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 List<FacetTopic> labels; - protected String[] selectedLabels; - protected String rename; - protected String delete; - protected String newLabel; - - public String getNewLabel() { - return newLabel; - } - - public void setNewLabel(String newLabel) { - this.newLabel = newLabel; - } - - public void setRename(String rename) { - this.rename = rename; - } - - public String getRename() { - return rename; - } - - public void setDelete(String delete) { - this.delete = delete; - } - - public String getDelete() { - return delete; - } - - /** - * @return the colors - */ - public String getColors() { - return colors; - } - - /** - * @param colors the colors to set - */ - public void setColors(String colors) { - this.colors = colors; - } - - /** - * @return the tagsNb - */ - public String getTagsNb() { - return tagsNb; - } - - /** - * @param tagsNb the tagsNb to set - */ - public void setTagsNb(String tagsNb) { - this.tagsNb = tagsNb; - } - - /** - * @return the bookmarksHomePage - */ - public String getBookmarksHomePage() { - return bookmarksHomePage; - } - - /** - * @param bookmarksHomePage the bookmarksHomePage to set - */ - public void setBookmarksHomePage(String bookmarksHomePage) { - this.bookmarksHomePage = bookmarksHomePage; - } - - /** - * @return the searchEngineUrlSuggestions - */ - public String getSearchEngineUrlSuggestions() { - return searchEngineUrlSuggestions; - } - - /** - * @param searchEngineUrlSuggestions the searchEngineUrlSuggestions to set - */ - public void setSearchEngineUrlSuggestions(String searchEngineUrlSuggestions) { - this.searchEngineUrlSuggestions = searchEngineUrlSuggestions; - } - - /** - * @return the searchEngineUrlResults - */ - public String getSearchEngineUrlResults() { - return searchEngineUrlResults; - } - - /** - * @param searchEngineUrlResults the searchEngineUrlResults to set - */ - public void setSearchEngineUrlResults(String searchEngineUrlResults) { - this.searchEngineUrlResults = searchEngineUrlResults; - } - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @param email the email to set - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * @return the newPassword - */ - public String getNewPassword() { - return newPassword; - } - - /** - * @param newPassword the newPassword to set - */ - public void setNewPassword(String newPassword) { - this.newPassword = newPassword; - } - - /** - * @return the currentPassword - */ - public String getCurrentPassword() { - return currentPassword; - } - - /** - * @param currentPassword the currentPassword to set - */ - public void setCurrentPassword(String currentPassword) { - this.currentPassword = currentPassword; - } - - /** - * @return the confirmNewPassword - */ - public String getConfirmNewPassword() { - return confirmNewPassword; - } - - /** - * @param confirmNewPassword the confirmNewPassword to set - */ - public void setConfirmNewPassword(String confirmNewPassword) { - this.confirmNewPassword = confirmNewPassword; - } - - /** - * @return the update - */ - public String getUpdate() { - return update; - } - - /** - * @param update the update to set - */ - public void setUpdate(String update) { - this.update = update; - } - - /** - * @return the bookmarksImportDate - */ - public Map<String, Integer> getBookmarksImportDate() { - return bookmarksImportDate; - } - - /** - * @param bookmarksImportDate the bookmarksImportDate to set - */ - public void setBookmarksImportDate(Map<String, Integer> bookmarksImportDate) { - this.bookmarksImportDate = bookmarksImportDate; - } - - public List<FacetTopic> getLabels() { - return labels; - } - - public String[] getSelectedLabels() { - return selectedLabels; - } - - public void setSelectedLabels(String[] selectedLabels) { - this.selectedLabels = selectedLabels; - } - - /** - * Date est une date mais au format String qui vient de Solr - * Elle est de la forme '2011-08-18T00:25:16.028Z' - * qui n'est pas presentable a l'utilisateur - * On la remet sous une vrai forme date - */ - public Date stringToDate(String date) { - try { - Date result = WikittyUtil.parseDate(date); - return result; - -// String result = date.replaceAll("[^0-9:-]+", " ").trim(); -// result = result.substring(0, date.lastIndexOf(' ')); - } catch (ParseException eee) { - return new Date(0); - } - } - - protected void changePreference(BowPreference preference) { - preference.setColors(colors); - if (StringUtils.isNotBlank(tagsNb)) { - preference.setTags(Integer.valueOf(tagsNb)); - } - if (StringUtils.isNotBlank(bookmarksHomePage)) { - preference.setBookmarks(Integer.valueOf(bookmarksHomePage)); - } - preference.setSearchEngineUrlSuggestions(searchEngineUrlSuggestions); - preference.setSearchEngineUrlResults(searchEngineUrlResults); - } - - /** - * Modifie l'email et le password si necessaire. Si la modif est impossible - * email deja utilise, ou mauvais password, alors la methode return false - * Si tout ce passe bien, la methode retourne true - * - * @param user - * @return - */ - protected boolean changeUser(BowUser user) { - boolean result = true; - - if (StringUtils.isNotBlank(email)) { - Criteria criteria = Search.query().eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email).criteria(); - if (log.isDebugEnabled()) { - log.debug(String.format("Try to find user with email: '%s'", email)); - } - BowUser find = getBowProxy().findByCriteria(BowUser.class, criteria); - - //If this email address isn't already used (or if it hasn't changed) - if (find == null || find.getLogin().equals(user.getLogin())) { - email = email.trim(); - user.setLogin(email); - } else { - // this email address is already used by someone else - setEmail(user.getLogin()); - - // TODO poussin 20110818 addFieldError don't work (no message on web page :( - // add addActionError to prevent addFieldError that don't work - addFieldError("email", _("bow.preferences.emailAldyExists")); - addActionError(_("bow.preferences.emailAldyExists")); - result = false; - } - } - - if (result - && StringUtils.isNotBlank(newPassword) - && StringUtils.isNotBlank(confirmNewPassword) - && StringUtils.isNotBlank(currentPassword)) { - if (newPassword.equals(confirmNewPassword)) { - currentPassword = StringUtil.encodeMD5(currentPassword); - if (currentPassword.equals(user.getPassword())) { - user.setPassword(StringUtil.encodeMD5(newPassword)); - } else { - // TODO poussin 20110818 addFieldError don't work (no message on web page :( - // add addActionError to prevent addFieldError that don't work - addFieldError("currentPassword", _("bow.preferences.badCurrentPassword")); - addActionError(_("bow.preferences.badCurrentPassword")); - result = false; - } - } - } - return result; - } - - /** - * Charge dans la variable labels tous les labels de l'utilisateur - * @param proxy - */ - protected void loadLabels(WikittyProxy proxy) { - BowUser user = getBowSession().getUser(); - String userId = user.getWikittyId(); - - Criteria c = Search.query() - .exteq(BowBookmark.EXT_WIKITTYLABEL) - .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, userId) - .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(-1) // on demande tous les labels - .addFacetField(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS); - PagedResult<Wikitty> result = proxy.findAllByCriteria(c); - // lorsqu'on demande tout (facetLimit(-1)), les topics sont trie - // alphabetiquement pas besoin de les retrier - labels = result.getTopic(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS); - } - - /** - * Fait les modification demandé par l'utilisateur dans l'interface de - * preference: renome ou supprime des labels. Si l'utilisateur demande le - * remplacement de label on indiquant pas de nouveau label, alors la chaine - * vide est utilisee. - * - * @return - */ - public String adminlabels() { - String result = SUCCESS; - try { - if (log.isDebugEnabled()) { - log.debug("Selected labels: " + Arrays.toString(selectedLabels)); - log.debug("action delete: " + delete + " rename: " + rename); - } - - List<String> selectedLabelsList = Arrays.asList(selectedLabels); - boolean isRename = !StringUtils.isEmpty(rename); - - BowProxy proxy = getBowProxy(); - BowUser user = getBowSession().getUser(); - String userId = user.getWikittyId(); - - Criteria c = Search.query() - .in(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS, selectedLabelsList) - .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, userId) - .criteria(); - PagedResult<WikittyLabel> searchResult = - proxy.findAllByCriteria(WikittyLabel.class, c); - - List<WikittyLabel> toStore = new ArrayList<WikittyLabel>(); - for (WikittyLabel label : searchResult) { - toStore.add(label); - Set<String> l = label.getLabels(); - if (l != null) { - // on fait une copie, car l retourne est non modifiable - l = new HashSet<String>(l); - l.removeAll(selectedLabelsList); - if (isRename) { - l.add(newLabel); - } - label.setLabels(l); - } - } - proxy.store(toStore); - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return result; - - } - - /** - * Action executer lorsque l'utilisateur demande la page - */ - @Override - public String execute() { - String result = SUCCESS; - - try { - BowSession session = getBowSession(); - BowProxy proxy = session.getProxy(); - // BowUser extends BowPreference, donc on l'utilise pour tout - BowUser user = session.getUser(); - - loadLabels(proxy); - Map<String,Integer> bookmarksByImportDate = - BookmarkUtils.getBookmarksByImportDate(session, user); - - if (log.isDebugEnabled()) { - log.debug("bookmarksByImportDate found : " + (bookmarksByImportDate == null ? "null" : bookmarksByImportDate.size())); - } - setBookmarksImportDate(bookmarksByImportDate.isEmpty() ? null : bookmarksByImportDate); - - if (update != null) { - - // modification des preferences du site - if ("site".equals(update)) { //If the user submitted the form - changePreference(user); - user = proxy.store(user); - getBowSession().setUser(user); - } - - // modification des preferences user (email, password) - if ("user".equals(update)) { - if (changeUser(user)) { - user = proxy.store(user); - getBowSession().setUser(user); - result = "update"; - addActionMessage(_("bow.preferences.update.successful")); - } else { - result = ERROR; - } - } - } - - // reload all time data (otherwize if submit user info, site info disappear) - - // If the user didn't submit the form, the fields are filled with - // the current preferences values - setEmail(user.getLogin()); - setColors(user.getColors()); - setTagsNb(String.valueOf(user.getTags())); - setBookmarksHomePage(String.valueOf(user.getBookmarks())); - setSearchEngineUrlSuggestions(user.getSearchEngineUrlSuggestions()); - setSearchEngineUrlResults(user.getSearchEngineUrlResults()); - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return result; - } -} Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/ReIndexationAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/ReIndexationAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/ReIndexationAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,54 +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 org.chorem.bow.BowSession; -import org.nuiton.wikitty.WikittyProxy; - -/** - * Lance la reindexation solr - * - * @author poussin - */ -public class ReIndexationAction extends BowBaseAction { - - private static final long serialVersionUID = 6226574522402739559L; - - @Override - public String execute() { - try { - BowSession session = getBowSession(); - if (session.isAdmin()) { //If is admin - WikittyProxy proxy = getBowProxy(); - - proxy.getWikittyService().syncSearchEngine(proxy.getSecurityToken()); - addActionMessage(_("bow.admin.reIndexationDone")); - } - } catch (Exception eee) { - addActionError(("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return SUCCESS; - } -} \ No newline at end of file Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/RegisterAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/RegisterAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/RegisterAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,178 +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.mail.MessagingException; -import javax.mail.internet.AddressException; -import org.apache.commons.lang.StringUtils; - -import org.chorem.bow.BowMail; -import org.chorem.bow.BowUser; -import org.chorem.bow.BowUserImpl; -import org.chorem.bow.BowUtils; -import org.nuiton.util.StringUtil; -import org.nuiton.wikitty.search.Criteria; -import org.nuiton.wikitty.WikittyProxy; -import org.nuiton.wikitty.search.Search; - -/** - * Enregistre un nouvel utilisateur - * - * @author poussin - */ -public class RegisterAction extends BowBaseAction { - - private static final long serialVersionUID = 2204772861770399542L; - - protected String email; - protected String password; - protected String repeatPassword; - - /** - * @return the email - */ - public String getEmail() { - return email; - } - - /** - * @param email the email to set - */ - public void setEmail(String email) { - this.email = email; - } - - /** - * @return the password - */ - public String getPassword() { - return password; - } - - /** - * @param password the password to set - */ - public void setPassword(String password) { - this.password = password; - } - - /** - * @return the repeatPassword - */ - public String getRepeatPassword() { - return repeatPassword; - } - - /** - * @param repeatPassword the repeatPassword to set - */ - public void setRepeatPassword(String repeatPassword) { - this.repeatPassword = repeatPassword; - } - - /** - * - * @param email non null and non blank email - * @return false if the email address isn't already registered, true - * otherwise - */ - protected boolean alreadyRegistered(String email) { - boolean result = true; - - WikittyProxy proxy = getBowProxy(); - //Retrieves user by user name (email) - Criteria criteria = Search.query() - .eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email).criteria(); - - result = proxy.findByCriteria(BowUser.class, criteria) != null; - //If the user doesn't already exist - if (result) { - //The email address is already used by someone - addFieldError("email", _("bow.register.emailAldyUsed")); - } - return result; - } - - /** - * Registers the new user and sends an email to confirm registration - */ - @Override - public String execute() { - String result = INPUT; - - try { - if (StringUtils.isNotBlank(email)) { - email = email.trim(); - if (StringUtils.isNotBlank(password)) { - if (!password.equals(repeatPassword)) { - addActionError(_("bow.register.pwdDontMatch")); - } else { - String md5 = StringUtil.encodeMD5(password); - - //If the email address isn't already used - if (!alreadyRegistered(email)) { - WikittyProxy proxy = getBowProxy(); - BowUserImpl newUser = new BowUserImpl(); - newUser.setPassword(md5); - newUser.setLogin(email); - String permanentToken = BowUtils.generateToken(); - newUser.setPermanentToken(permanentToken); - BowUser login = proxy.store(newUser); //Stores the new user - - //If there was an error when storing the user - if (login == null) { - addFieldError("email", _("bow.register.invalidLogin")); - } else { - getBowSession().setUser(login); - try { - String mailContent; - - mailContent = - _("bow.register.mailHi") + ",\n\n" + - _("bow.register.mailPwd") + ": " + password + "\n\n" + - _("bow.register.mailEmail") + ": " + email + "\n\n"; - BowMail.sendMail(email, _("bow.register.mailSubject"), mailContent); - } catch (AddressException eee) { - //If the email address is invalid - addActionError(_("bow.mail.badFormat")); - log.error(String.format("Can't send message email to '%s'", - email), eee); - } catch (MessagingException eee) { - addActionError("bow.mail.sendError"); - log.error(String.format("Can't send message email to '%s'", - email), eee); - } - result = SUCCESS; - } - } - } - } - } - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error(eee.getMessage(), eee); - } - return result; - } -} Deleted: trunk/bow-ui/src/main/java/org/chorem/bow/action/RemoveBookmarkAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/RemoveBookmarkAction.java 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/RemoveBookmarkAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -1,82 +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 org.apache.commons.lang.StringUtils; -import org.chorem.bow.BowBookmark; -import org.chorem.bow.BowUtils; -import org.nuiton.wikitty.WikittyProxy; - -/** - * Supprime un bookmark - * - * @author poussin - */ -public class RemoveBookmarkAction extends BowBaseAction { - - private static final long serialVersionUID = 820566716695285561L; - - protected String bookmarkId; - protected String redirectTo; - - /** - * @return the bookmarkId - */ - public String getBookmarkId() { - return bookmarkId; - } - - /** - * @param bookmarkId the bookmarkId to set - */ - public void setBookmarkId(String bookmarkId) { - this.bookmarkId = bookmarkId; - } - - /** - * @return the redirectTo - */ - public String getRedirectTo() { - return redirectTo; - } - - /** - * Removes a bookmark - */ - @Override - public String execute() { - if (StringUtils.isNotEmpty(bookmarkId)) { - try { - WikittyProxy proxy = getBowProxy(); - proxy.delete(bookmarkId); - addActionMessage(_("bow.bookmark.remove.successful")); - } catch (Exception eee) { - addActionError(_("bow.error.internal")); - log.error("Can't do action", eee); - } - } - redirectTo = BowUtils.redirectTo(searchLine, fullTextLine); - return SUCCESS; - } -} \ No newline at end of file Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/MigrateDataAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/MigrateDataAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/MigrateDataAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/MigrateDataAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,95 @@ +/* + * #%L + * BOW UI + * + * $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.admin; + + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.bow.BowMigration04To05; +import org.chorem.bow.BowMigration06To11; +import org.chorem.bow.BowSession; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.util.VersionUtil; +import org.nuiton.wikitty.WikittyProxy; + +/** + * Lance la migration des données de la version 0.4 vers 0.5 + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class MigrateDataAction extends BowBaseAction { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(MigrateDataAction.class); + + /** Version must be real version, like 0.4, 0.5 or 0.6 */ + protected String versionFrom; + protected String versionTo; + + public void setVersionFrom(String versionFrom) { + this.versionFrom = versionFrom; + } + + public void setVersionTo(String versionTo) { + this.versionTo = versionTo; + } + + @Override + public String execute() { + try { + if (StringUtils.isBlank(versionFrom) || StringUtils.isBlank(versionTo)) { + log.error("Migration action must have to parameter: versionFrom and versionTo"); + } else { + BowSession session = getBowSession(); + if (session.isAdmin()) { //If is admin + WikittyProxy proxy = getBowProxy(); + + if (VersionUtil.equals(versionFrom, "0.4") + && VersionUtil.equals(versionTo, "0.5")) { + BowMigration04To05.migrate(proxy); + addActionMessage(_("bow.admin.dataMigration.success")); + } else if (VersionUtil.equals(versionFrom, "0.6") + && VersionUtil.equals(versionTo, "1.1")) { + BowMigration06To11.migrate(proxy); + addActionMessage(_("bow.admin.dataMigration.success")); + } else { + addActionMessage(String.format( + "No migration found for %s to %s", + versionFrom, versionTo)); + } + } + } + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error(eee.getMessage(), eee); + } + return SUCCESS; + } + +} Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/ReIndexationAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/ReIndexationAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/ReIndexationAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/admin/ReIndexationAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,55 @@ +/* + * #%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.admin; + +import org.chorem.bow.BowSession; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.wikitty.WikittyProxy; + +/** + * Lance la reindexation solr + * + * @author poussin + */ +public class ReIndexationAction extends BowBaseAction { + + private static final long serialVersionUID = 6226574522402739559L; + + @Override + public String execute() { + try { + BowSession session = getBowSession(); + if (session.isAdmin()) { //If is admin + WikittyProxy proxy = getBowProxy(); + + proxy.getWikittyService().syncSearchEngine(proxy.getSecurityToken()); + addActionMessage(_("bow.admin.reIndexationDone")); + } + } catch (Exception eee) { + addActionError(("bow.error.internal")); + log.error(eee.getMessage(), eee); + } + return SUCCESS; + } +} \ No newline at end of file Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/AddOrUpdateAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/AddUrlAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/AddOrUpdateAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/AddOrUpdateAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,266 @@ +/* + * #%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.bookmark; + +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.chorem.bow.action.BowBaseAction; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.search.PagedResult; +import org.nuiton.wikitty.search.Search; + +/** + * Ajoute ou modifie un bookmark, soit par le formulaire, + * soit par un appel javascript + * + * @author poussin + */ +public class AddOrUpdateAction extends BowBaseAction { + + private static final long serialVersionUID = 3389170166034184139L; + + protected String bookmarkId; + protected String link; + protected String name; + protected String privateAlias; + protected String publicAlias; + protected String tags; + protected String nameAndTags; + protected String redirectTo; + + public String getBookmarkId() { + return bookmarkId; + } + + public void setBookmarkId(String bookmarkId) { + this.bookmarkId = bookmarkId; + } + + /** + * @return the link + */ + public String getLink() { + return link; + } + + /** + * @param link the link to set + */ + public void setLink(String link) { + this.link = link; + } + + /** + * @return the description + */ + public String getName() { + return name; + } + + /** + * @param name the description to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the privateAlias + */ + public String getPrivateAlias() { + return privateAlias; + } + + /** + * @param alias the privateAlias to set + */ + public void setPrivateAlias(String alias) { + this.privateAlias = alias; + } + + public String getPublicAlias() { + return publicAlias; + } + + public void setPublicAlias(String publicAlias) { + this.publicAlias = publicAlias; + } + + /** + * @return the tags + */ + public String getTags() { + return tags; + } + + /** + * @param tags the tags to set + */ + public void setTags(String tags) { + this.tags = tags; + } + + /** + * @return the nameAndTags + */ + public String getNameAndTags() { + return nameAndTags; + } + + /** + * @param nameAndTags the nameAndTags to set + */ + public void setNameAndTags(String nameAndTags) { + this.nameAndTags = nameAndTags; + } + + /** + * @return the redirectTo + */ + public String getRedirectTo() { + return redirectTo; + } + + @Override + public String execute() { + String result = SUCCESS; + try { + WikittyProxy proxy = getBowProxy(); + BowBookmark bookmark = null; + BowBookmark bookmarkToModify = null; + + BowUser user = getBowSession().getUser(); + String userId = user.getWikittyId(); + if (StringUtils.isNotBlank(bookmarkId)) { + bookmarkToModify = proxy.restore(BowBookmark.class, bookmarkId); + } + if (log.isDebugEnabled()) { + log.debug("Change old wikitty: " + bookmarkToModify); + } + + // gere le cas d'une mise a jour ou d'un ajout via le formulaire + if (name != null) { + // Si l'alias prive souhaite est deja utilise on ne l'accept pas + // Si l'alias public souhaite est deja utilise on ne l'accept pas + // TODO sletellier 20110416 : return error message when public or private alias is already used + Criteria privateAliasCriteria = null; + Criteria publicAliasCriteria = null; + if (StringUtils.isNotEmpty(privateAlias)) { + privateAliasCriteria = Search.query() + .eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_PRIVATEALIAS, privateAlias) + .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, userId) + .criteria().setEndIndex(0); + } + if (StringUtils.isNotEmpty(publicAlias)) { + publicAliasCriteria = Search.query() + .eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_PUBLICALIAS, publicAlias) + .criteria().setEndIndex(0); + } + PagedResult<String>[] aliasResult = proxy.findAllIdByCriteria( + privateAliasCriteria, publicAliasCriteria); + + if (aliasResult[0] != null && aliasResult[0].getNumFound() > 0) { + if (bookmarkToModify == null) { + privateAlias = ""; + } else { + privateAlias = bookmarkToModify.getPrivateAlias(); + } + } + if (aliasResult[1] != null && aliasResult[1].getNumFound() > 0) { + if (bookmarkToModify == null) { + publicAlias = ""; + } else { + publicAlias = bookmarkToModify.getPublicAlias(); + } + } + + if (bookmarkToModify == null) { + bookmark = BookmarkUtils.createBookmark( + link, name, tags, user, privateAlias, publicAlias, null); + } else { + BookmarkUtils.updateBookmark( + bookmarkToModify, name, link, tags, privateAlias, publicAlias); + } + } else { //This part is for the bookmark addition by script + if (nameAndTags != null) { + bookmark = BookmarkUtils.createBookmark(link, nameAndTags, user); + } + } + // si on a reussi a creer le bookmark, on regarde s'il ne faut pas + // le fusionner avec un deja existant + if (bookmark != null && !bookmark.getDescription().isEmpty() + && !bookmark.getOwner().isEmpty()) { + + // looking for already bookmark with same url, to fusion them + String link = bookmark.getLink(); + Criteria criteria = Search.query() + .eq(BowBookmark.FQ_FIELD_BOWBOOKMARK_LINK, link) + .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, userId) + .criteria(); + BowBookmark oldBookmark = + proxy.findByCriteria(BowBookmark.class, criteria); + if(oldBookmark != null) { + // fusionne les descriptions et les tags + // par contre on prend le dernier privateAlias prive choisi par + // l'utilisateur s'il y en a un + String description = oldBookmark.getDescription(); + if (!StringUtils.isEmpty(bookmark.getDescription())) { + description += "\n"; + description += BowUtils.formatDate( + bookmark.getCreationDate()) + ": "; + description += bookmark.getDescription(); + } + + oldBookmark.setDescription(description); + oldBookmark.addAllLabels(bookmark.getLabels()); + String privateAlias = bookmark.getPrivateAlias(); + if (!StringUtils.isEmpty(privateAlias)) { + oldBookmark.setPrivateAlias(privateAlias); + } + + bookmark = oldBookmark; + } + + } + + if (bookmark != null || bookmarkToModify != null) { + proxy.store(bookmark, bookmarkToModify); //Stores the bookmark if everything is ok + addActionMessage(_("bow.bookmark.add.successful")); + if (log.isDebugEnabled()) { + log.debug("Adding URL"); + } + } + redirectTo = BowUtils.redirectTo(tagLine, fullTextLine); + } catch (Exception eee) { + result = ERROR; + addActionError(_("bow.error.internal")); + log.error(eee.getMessage(), eee); + } + return result; + } +} \ No newline at end of file Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/DeleteSearchResultsAction.java (from rev 309, trunk/bow-ui/src/main/java/org/chorem/bow/action/DeleteSearchResultsAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/DeleteSearchResultsAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/DeleteSearchResultsAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,75 @@ +/* + * #%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.bookmark; + +import java.util.List; +import org.apache.commons.lang.StringUtils; + +import org.chorem.bow.BookmarkUtils; +import org.chorem.bow.BowUser; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.WikittyProxy; + +/** + * Supprime des bookmarks qui satisfont le critere de recherche. + * + * @author poussin + */ +public class DeleteSearchResultsAction extends BowBaseAction { + + private static final long serialVersionUID = -3903724044644625507L; + + /** + * Deletes the search results + */ + public String execute() { + try { + if (StringUtils.isNotBlank(tagLine) + || StringUtils.isNotBlank(fullTextLine)) { + BowUser user = getBowSession().getUser(); + // FIXME poussin 20110817 ATTENTION, la recherche remonte + // potentiellement des bookmarks qui ne nous appartiennent pas, + // dans ce cas, ne faudrait-il pas seulement ce supprimer des + // reader/write/admin ? + Criteria criteria = BookmarkUtils.getBookmarkListCriteriaByUser( + user, tagLine, fullTextLine, null); + + WikittyProxy proxy = getBowProxy(); + List<String> ids = proxy.findAllIdByCriteria(criteria).getAll(); + + if (log.isDebugEnabled()) { + log.debug("Will delete " + ids.size() + " bookmarks"); + } + + proxy.delete(ids); + addActionMessage(_("bow.search.results.deleted")); + } + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error(eee.getMessage(), eee); + } + return SUCCESS; + } +} \ No newline at end of file Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/EditAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/EditBookmarkAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/EditAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/EditAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,76 @@ +/* + * #%L + * BOW UI + * + * $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.bookmark; + +import org.chorem.bow.BowBookmark; +import org.chorem.bow.BowBookmarkImpl; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.search.Search; +import org.nuiton.wikitty.search.operators.Element; + +/** + * Load a bookmark to display it on modification page + * + * @author sletellier + */ +public class EditAction extends BowBaseAction { + private static final long serialVersionUID = 1L; + + protected String id; + protected BowBookmark bookmark; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public BowBookmark getBookmark() { + if (bookmark == null) { + bookmark = new BowBookmarkImpl(); + } + return bookmark; + } + + @Override + public String execute() throws Exception { + if (id == null) { + return SUCCESS; + } + try { + WikittyProxy proxy = getBowProxy(); + Criteria criteria = Search.query() + .eq(Element.ELT_ID, id).criteria(); + bookmark = proxy.findByCriteria(BowBookmark.class, criteria); + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error(eee.getMessage(), eee); + } + return SUCCESS; + } +} Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/HomeAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/HomeAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,110 @@ +/* + * #%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.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; + +import org.chorem.bow.BowSearchResult; +import org.chorem.bow.BowSession; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.util.TimeLog; + +/** + * Prepare l'affichage de la page d'accueil + * + * @author poussin + */ +public class HomeAction extends BowBaseAction { + + private static final Log log = LogFactory.getLog(HomeAction.class); + private static final TimeLog timeLog = new TimeLog(HomeAction.class); + + private static final long serialVersionUID = -3735250067223062719L; + + static public HomeAction getAction() { + Object action = ActionContext.getContext().get(CONTEXT_ACTION_KEY); + return (HomeAction) action; + } + + protected String addTag; + + protected BowSearchResult searchResult; + + public String getAddTag() { + return addTag; + } + + public void setAddTag(String addTag) { + this.addTag = addTag; + } + + public BowSearchResult getSearchResult() { + return searchResult; + } + + public void setSearchResult(BowSearchResult searchResult) { + this.searchResult = searchResult; + } + + /** + * Load all data necessary form Home page + */ + protected void load() { + // on ajoute les tags qui doivent faire parti de ne nouvelle recherche + // on restocke dans tagLine pour que la bonne info reapparaisse + // a l'utilisateur + tagLine = StringUtils.join(new String[]{tagLine, addTag}, " ").trim(); + + // si l'ordre souhaite n'existe pas, on utilise l'ordre par defaut + if (!getPossibleOrder().contains(order)) { + // default sort order + // TODO poussin 20110815 rendre configurable par l'utilisateur l'ordre par defaut qu'il prefere + order = "descClick"; + } + + BowSession session = getBowSession(); + searchResult = new BowSearchResult(session, tagLine, fullTextLine, order); + } + + /** + * Initializes everything before displaying the home page + */ + @Override + public String execute() { + long start = TimeLog.getTime(); + try { + load(); + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error(eee.getMessage(), eee); + } + timeLog.log(start, "execute"); + return SUCCESS; + } +} \ No newline at end of file Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/RemoveAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/RemoveBookmarkAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/RemoveAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/bookmark/RemoveAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,82 @@ +/* + * #%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.bookmark; + +import org.apache.commons.lang.StringUtils; +import org.chorem.bow.BowUtils; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.wikitty.WikittyProxy; + +/** + * Supprime un bookmark + * + * @author poussin + */ +public class RemoveAction extends BowBaseAction { + + private static final long serialVersionUID = 820566716695285561L; + + protected String bookmarkId; + protected String redirectTo; + + /** + * @return the bookmarkId + */ + public String getBookmarkId() { + return bookmarkId; + } + + /** + * @param bookmarkId the bookmarkId to set + */ + public void setBookmarkId(String bookmarkId) { + this.bookmarkId = bookmarkId; + } + + /** + * @return the redirectTo + */ + public String getRedirectTo() { + return redirectTo; + } + + /** + * Removes a bookmark + */ + @Override + public String execute() { + if (StringUtils.isNotEmpty(bookmarkId)) { + try { + WikittyProxy proxy = getBowProxy(); + proxy.delete(bookmarkId); + addActionMessage(_("bow.bookmark.remove.successful")); + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error("Can't do action", eee); + } + } + redirectTo = BowUtils.redirectTo(tagLine, fullTextLine); + return SUCCESS; + } +} \ No newline at end of file Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/login/ForgotPasswordAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/ForgotPasswordAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/login/ForgotPasswordAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/login/ForgotPasswordAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,124 @@ +/* + * #%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.login; + +import javax.mail.MessagingException; +import javax.mail.internet.AddressException; + +import org.apache.commons.lang.RandomStringUtils; +import org.apache.commons.lang.StringUtils; +import org.chorem.bow.BowMail; +import org.chorem.bow.BowUser; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.util.StringUtil; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Search; + +/** + * Genere un nouveau mot de passe pour l'utilisateur et lui envoie par mail + * TODO poussin 20110211 il faudrait ajouter une securite pour eviter que + * quelqu'un s'amuse a demander la modification de password de quelqu'un d'autre + * toutes les 2s + * - soit en ne permettant l'envoi qu'une fois par jour + * - soit ???? + * + * @author poussin + */ +public class ForgotPasswordAction extends BowBaseAction { + private static final long serialVersionUID = -8207951465957204954L; + protected String email; + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * Generates a new password and sends it to the user + */ + @Override + public String execute() { + String result = INPUT; + + try { + if (StringUtils.isNotBlank(email)) { + email = email.trim(); + WikittyProxy proxy = getBowProxy(); + Criteria criteria = Search.query() + .eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email).criteria(); + BowUser user = proxy.findByCriteria(BowUser.class, criteria); + + if (user != null) { //If the email address exists + String password = ""; + String md5 = ""; + + password = RandomStringUtils.randomAlphanumeric(20); + md5 = StringUtil.encodeMD5(password); + try { + String mailContent; + + mailContent = _("bow.register.mailHi") + + ",\n\n" + _("bow.register.mailPwd") + ": " + + password + "\n\n" + _("bow.register.mailEmail") + + ": " + email + "\n\n"; + BowMail.sendMail(email, + _("bow.register.mailSubject"), + mailContent); + + //The password is changed only if the mail has been sent + user.setPassword(md5); + proxy.store(user); + } catch (AddressException eee) { + //If the email address is invalid + addActionError(_("bow.mail.badFormat")); + log.error(String.format("Can't send message email to '%s'", + email), eee); + } catch (MessagingException eee) { + addActionError("bow.mail.sendError"); + log.error(String.format("Can't send message email to '%s'", + email), eee); + } + result = SUCCESS; + } else { //If the email is not associated with an account + addFieldError("email", + _("bow.forgotPassword.emailDoesntExist")); + } + } + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error(eee.getMessage(), eee); + } + return result; + } +} \ No newline at end of file Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/login/LoginAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/LoginAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/login/LoginAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/login/LoginAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,130 @@ +/* + * #%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.action.login; + +import org.apache.commons.lang.StringUtils; + +import org.chorem.bow.BowConfig; +import org.chorem.bow.BowUser; +import org.chorem.bow.BowUserImpl; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.util.StringUtil; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Search; + +/** + * authentifie l'utilisateur et place son objet User dans la bow session + * + * @author poussin + */ +public class LoginAction extends BowBaseAction { + + private static final long serialVersionUID = 6891064800288772246L; + + protected String email; + protected String password; + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + /** + * Check password in solr index, if fail try to check password admin in config file + * + * @param email non null et non vide email + * @param password non null et non vide email + * @return + */ + protected BowUser checkLogin(String email, String password) { + BowUser result = null; + + WikittyProxy proxy = getBowProxy(); + Criteria criteria = Search.query().eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email). + eq(BowUser.FQ_FIELD_WIKITTYUSER_PASSWORD, password).criteria(); + result = proxy.findByCriteria(BowUser.class, criteria); + + if (result == null) { + // failback: try to authenticate admin with config info + String configPassword = BowConfig.getAdminPassword(email); + log.info(String.format("failback password: '%s' configPassword: '%s'", + password, configPassword)); + if (password.equals(configPassword)) { + // admin authenticate with config, this is possible when + // solr index is corrupted or missed. Admin must go to admin + // page en recreate index + result = new BowUserImpl(); + result.setLogin(email); + result.setPassword(configPassword); + addActionMessage(_("bow.login.admin.failback")); + log.warn(_("bow.login.admin.failback")); + } else { + addActionError(_("bow.login.authenticationFailure")); + } + } + return result; + } + + /** + * Authenticates the user if his email and password are valid + */ + @Override + public String execute() { + String result = INPUT; + + try { + if (StringUtils.isNotBlank(email)) { + email = email.trim(); + + if (StringUtils.isNotEmpty(password)) { + String md5 = StringUtil.encodeMD5(password); + BowUser user; + + user = checkLogin(email, md5); + if (user != null) { + getBowSession().setUser(user); + result = SUCCESS; + } + } + } + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error(eee.getMessage(), eee); + } + return result; + } +} \ No newline at end of file Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/login/LogoutAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/LogoutAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/login/LogoutAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/login/LogoutAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,42 @@ +/* + * #%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.login; + +import org.chorem.bow.BowSession; +import org.chorem.bow.action.BowBaseAction; + +/** + * Invalide la session courante et donc de-authentifie l'utilisateur + * + * @author poussin + */ +public class LogoutAction extends BowBaseAction { + private static final long serialVersionUID = 4806944250461551896L; + + @Override + public String execute() { + BowSession.invalidate(session); + return SUCCESS; + } +} Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/login/RegisterAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/RegisterAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/login/RegisterAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/login/RegisterAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,179 @@ +/* + * #%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.login; + +import javax.mail.MessagingException; +import javax.mail.internet.AddressException; +import org.apache.commons.lang.StringUtils; + +import org.chorem.bow.BowMail; +import org.chorem.bow.BowUser; +import org.chorem.bow.BowUserImpl; +import org.chorem.bow.BowUtils; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.util.StringUtil; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Search; + +/** + * Enregistre un nouvel utilisateur + * + * @author poussin + */ +public class RegisterAction extends BowBaseAction { + + private static final long serialVersionUID = 2204772861770399542L; + + protected String email; + protected String password; + protected String repeatPassword; + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the password + */ + public String getPassword() { + return password; + } + + /** + * @param password the password to set + */ + public void setPassword(String password) { + this.password = password; + } + + /** + * @return the repeatPassword + */ + public String getRepeatPassword() { + return repeatPassword; + } + + /** + * @param repeatPassword the repeatPassword to set + */ + public void setRepeatPassword(String repeatPassword) { + this.repeatPassword = repeatPassword; + } + + /** + * + * @param email non null and non blank email + * @return false if the email address isn't already registered, true + * otherwise + */ + protected boolean alreadyRegistered(String email) { + boolean result = true; + + WikittyProxy proxy = getBowProxy(); + //Retrieves user by user name (email) + Criteria criteria = Search.query() + .eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email).criteria(); + + result = proxy.findByCriteria(BowUser.class, criteria) != null; + //If the user doesn't already exist + if (result) { + //The email address is already used by someone + addFieldError("email", _("bow.register.emailAldyUsed")); + } + return result; + } + + /** + * Registers the new user and sends an email to confirm registration + */ + @Override + public String execute() { + String result = INPUT; + + try { + if (StringUtils.isNotBlank(email)) { + email = email.trim(); + if (StringUtils.isNotBlank(password)) { + if (!password.equals(repeatPassword)) { + addActionError(_("bow.register.pwdDontMatch")); + } else { + String md5 = StringUtil.encodeMD5(password); + + //If the email address isn't already used + if (!alreadyRegistered(email)) { + WikittyProxy proxy = getBowProxy(); + BowUserImpl newUser = new BowUserImpl(); + newUser.setPassword(md5); + newUser.setLogin(email); + String permanentToken = BowUtils.generateToken(); + newUser.setPermanentToken(permanentToken); + BowUser login = proxy.store(newUser); //Stores the new user + + //If there was an error when storing the user + if (login == null) { + addFieldError("email", _("bow.register.invalidLogin")); + } else { + getBowSession().setUser(login); + try { + String mailContent; + + mailContent = + _("bow.register.mailHi") + ",\n\n" + + _("bow.register.mailPwd") + ": " + password + "\n\n" + + _("bow.register.mailEmail") + ": " + email + "\n\n"; + BowMail.sendMail(email, _("bow.register.mailSubject"), mailContent); + } catch (AddressException eee) { + //If the email address is invalid + addActionError(_("bow.mail.badFormat")); + log.error(String.format("Can't send message email to '%s'", + email), eee); + } catch (MessagingException eee) { + addActionError("bow.mail.sendError"); + log.error(String.format("Can't send message email to '%s'", + email), eee); + } + result = SUCCESS; + } + } + } + } + } + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error(eee.getMessage(), eee); + } + return result; + } +} Added: trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/AdminTagAction.java =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/AdminTagAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/AdminTagAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,93 @@ +package org.chorem.bow.action.preference; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.bow.BowBookmark; +import org.chorem.bow.BowProxy; +import org.chorem.bow.BowUser; +import org.nuiton.wikitty.entities.WikittyLabel; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.search.PagedResult; +import org.nuiton.wikitty.search.Search; + +/** + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class AdminTagAction extends PreferenceBaseAction { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(AdminTagAction.class); + private static final long serialVersionUID = 1L; + + /** + * ACTION STRUTS + * + * Fait les modification demandé par l'utilisateur dans l'interface de + * preference: renome ou supprime des labels. Si l'utilisateur demande le + * remplacement de label on indiquant pas de nouveau label, alors la chaine + * vide est utilisee. + * + * @return + */ + @Override + public String execute() { + String result = SUCCESS; + try { + if (log.isDebugEnabled()) { + log.debug("Selected labels: " + Arrays.toString(selectedLabels)); + log.debug("action delete: " + delete + " rename: " + rename); + } + + List<String> selectedLabelsList = Arrays.asList(selectedLabels); + boolean isRename = StringUtils.isNotEmpty(rename); + + BowProxy proxy = getBowProxy(); + BowUser user = getBowSession().getUser(); + String userId = user.getWikittyId(); + + Criteria c = Search.query() + .in(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS, selectedLabelsList) + .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, userId) + .criteria(); + PagedResult<WikittyLabel> searchResult = + proxy.findAllByCriteria(WikittyLabel.class, c); + + List<WikittyLabel> toStore = new ArrayList<WikittyLabel>(); + for (WikittyLabel label : searchResult) { + toStore.add(label); + Set<String> l = label.getLabels(); + if (l != null) { + // on fait une copie, car l retourne est non modifiable + l = new HashSet<String>(l); + l.removeAll(selectedLabelsList); + if (isRename) { + l.add(newLabel); + } + label.setLabels(l); + } + } + proxy.store(toStore); + + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error(eee.getMessage(), eee); + } finally { + // on recharge les data apres l'action pour l'affichage + load(); + } + return result; + + } + +} Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/DeleteImportAction.java (from rev 306, trunk/bow-ui/src/main/java/org/chorem/bow/action/DeleteImportAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/DeleteImportAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/DeleteImportAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,95 @@ +/* + * #%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.preference; + +import java.util.List; + +import org.chorem.bow.BowBookmark; +import org.chorem.bow.BowImport; +import org.chorem.bow.BowUser; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Search; + + +/** + * Supprime un import de bookmark + * + * @author poussin + */ +public class DeleteImportAction extends PreferenceBaseAction { + private static final long serialVersionUID = 8714394293884265516L; + protected String date; + + /** + * @return the date + */ + public String getDate() { + return date; + } + /** + * @param date the date to set + */ + public void setDate(String date) { + this.date = date; + } + + /** + * Deletes a bookmark import + */ + public String execute() { + String result = SUCCESS; + try { + if (date != null && + // XXX poussin 20110818 y'a-t-il vraiment une utilite a checker + // que la date verifie le pattern ? + // car on pire on ne retrouve rien et donc on ne supprime rien + date.matches("[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{1,3}Z")) { + WikittyProxy proxy = getBowProxy(); + BowUser user = getBowSession().getUser(); + Criteria criteria = Search.query() + .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, user.getWikittyId()) + .eq(BowImport.FQ_FIELD_BOWIMPORT_IMPORTDATE, date).criteria(); + List<BowImport> bookmarks = proxy.findAllByCriteria(BowImport.class, criteria).getAll(); + + if (log.isDebugEnabled()) { + log.debug("Will delete " + bookmarks.size() + " bookmarks"); + } + + proxy.delete(bookmarks); + + addActionMessage(_("bow.bookmark.import.delete.successful")); + } + } catch (Exception e) { + result = ERROR; + addActionError(_("bow.error.internal")); + log.error(e.getMessage(), e); + } finally { + // on recharge les data apres l'action pour l'affichage + load(); + } + return result; + } + +} \ No newline at end of file Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ExportBookmarksAction.java (from rev 310, trunk/bow-ui/src/main/java/org/chorem/bow/action/ExportBookmarksAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ExportBookmarksAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ExportBookmarksAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,139 @@ +/* + * #%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.preference; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.io.Writer; +import java.util.Date; +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; +import org.chorem.bow.action.BowBaseAction; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.search.Search; + +/** + * Export son bookmark au format HTML + * + * @author poussin + */ +public class ExportBookmarksAction extends BowBaseAction implements ServletResponseAware { + 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; + } + + /** + * Export tous les bookmarks au format HTML tel que le fait les navigateurs + * + * @param bookmarks List<Bookmarks> bookmarks + * @param out le flux dans lequel il faut ecrire l'export + * @return String the html file + */ + protected void generateExportHtmlBookmark(List<BowBookmark> bookmarks, Writer out) throws IOException { + out.write("<!DOCTYPE NETSCAPE-Bookmark-file-1>\n" + + "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n" + + "<DL><p>\n"); + if (bookmarks != null) { + for (BowBookmark bookmark : bookmarks) { + if (bookmark != null) { + out.write("<DT><A HREF=\""); + out.write(bookmark.getLink() + "\" "); + Date date = bookmark.getCreationDate(); + if (date != null) { + long milli = date.getTime(); + String time = String.valueOf(milli / 1000); + out.write("ADD_DATE=\"" + time + "\" LAST_MODIFIED=\"" + time + "\" "); + } + out.write("LAST_CHARSET=\"UTF-8\" "); + Set<String> tags = bookmark.getLabels(); + if (tags != null && !tags.isEmpty()) { + out.write("SHORTCUTURL=\"" + + BookmarkUtils.getBookmarkTagsString(bookmark) + "\""); + } + out.write(">" + bookmark.getDescription() + "</A>\n"); + } + } + } + out.write("</DL><p>"); + } + + /** + * Exports the bookmarks in HTML format + */ + @Override + public String execute() { + WikittyProxy proxy = getBowProxy(); + + // get current user + BowUser user = getBowSession().getUser(); + + // Get all bookmark for user + Criteria criteria = Search.query() + .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, user.getWikittyId()).criteria(); + List<BowBookmark> bookmarks = proxy.findAllByCriteria(BowBookmark.class, criteria).getAll(); + + // Export all + BufferedWriter out = null; + + try { + + // Write result in temp file + File tmp = File.createTempFile("bookmarks", ".tmp.html"); + + tmp.deleteOnExit(); + out = new BufferedWriter(new FileWriter(tmp)); + generateExportHtmlBookmark(bookmarks, out); + out.close(); + + inputStream = new FileInputStream(tmp); + } catch (IOException eee) { + log.error("Error when exporting bookmarks to HTML : ", eee); + } finally { + IOUtils.closeQuietly(out); + } + return SUCCESS; + } +} \ No newline at end of file Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/GenerateTokenAction.java (from rev 312, trunk/bow-ui/src/main/java/org/chorem/bow/action/GenerateTokenAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/GenerateTokenAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/GenerateTokenAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,46 @@ +package org.chorem.bow.action.preference; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.bow.BowProxy; +import org.chorem.bow.BowUser; +import org.chorem.bow.BowUtils; + +/** + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class GenerateTokenAction extends PreferenceBaseAction { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(GenerateTokenAction.class); + private static final long serialVersionUID = 1L; + + @Override + public String execute() { + try { + BowUser user = getBowSession().getUser(); + BowProxy proxy = getBowProxy(); + + String permanentToken = BowUtils.generateToken(); + user.setPermanentToken(permanentToken); + proxy.store(user); + + String temporaryToken = BowUtils.generateToken(); + getBowSession().setTemporaryToken(temporaryToken); + addActionMessage(_("bow.token.generate.successful")); + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error("Can't regenerate token", eee); + } finally { + // on recharge les data apres l'action pour l'affichage + load(); + } + return SUCCESS; + } + +} Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ImportBookmarksAction.java (from rev 310, trunk/bow-ui/src/main/java/org/chorem/bow/action/ImportBookmarksAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ImportBookmarksAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/ImportBookmarksAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,260 @@ +/* + * #%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.preference; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import org.apache.commons.lang.StringUtils; + +import org.chorem.bow.BookmarkUtils; +import org.chorem.bow.BowBookmark; +import org.chorem.bow.BowImportHelper; +import org.chorem.bow.BowUser; +import org.htmlparser.Node; +import org.htmlparser.Parser; +import org.htmlparser.util.NodeList; +import org.htmlparser.util.ParserException; +import org.htmlparser.util.SimpleNodeIterator; +import org.nuiton.wikitty.WikittyProxy; +import org.nuiton.wikitty.entities.Wikitty; + +/** + * Import un bookmark HTML + * + * @author poussin + */ +public class ImportBookmarksAction extends PreferenceBaseAction { + + private static final long serialVersionUID = -5962680416570797028L; + + protected File upfile; + protected String upfileContentType; + protected String upfileFileName; + + /** + * @return the upfile + */ + public File getUpfile() { + return upfile; + } + + /** + * @param upfile + * the upfile to set + */ + public void setUpfile(File upfile) { + this.upfile = upfile; + } + + /** + * @return the upfileContentType + */ + public String getUpfileContentType() { + return upfileContentType; + } + + /** + * @param upfileContentType + * the upfileContentType to set + */ + public void setUpfileContentType(String upfileContentType) { + this.upfileContentType = upfileContentType; + } + + /** + * @return the upfileFileName + */ + public String getUpfileFileName() { + return upfileFileName; + } + + /** + * @param upfileFileName + * the upfileFileName to set + */ + public void setUpfileFileName(String upfileFileName) { + this.upfileFileName = upfileFileName; + } + + /** + * @param html String html + * @param name String name + * @param user User user + * @return Bookmark the bookmark filled + */ + protected BowBookmark createBookmarkFromHtml(String html, String name, BowUser user) { + String link = getUrlFromHtml(html); + String tags = getTagsFromHtml(html); + Date date = getDateFromHtml(html); + BowBookmark bookmark = BookmarkUtils.createBookmark(link, name, tags, user, null, null, date); + return bookmark; + } + + /** + * @param html String html + * @return Date from the html + */ + protected Date getDateFromHtml(String html) { + Date date = null; + if (html != null) { + Pattern p = Pattern.compile("ADD_DATE=\"([^\"]*)\""); + Matcher m = p.matcher(html); + if (m.find()) { + String str = m.group(1); + if (str != null && !str.isEmpty()) { + long time = Long.valueOf(str) * 1000; // the date in ms + date = new Date(time); + } + } + } + return date; + } + + /** + * @param html String html + * @return url + */ + protected String getUrlFromHtml(String html) { + String url = ""; + if (html != null) { + Pattern p = Pattern.compile("A HREF=\"([^\"]*)\""); + Matcher m = p.matcher(html); + if (m.find()) { + url = m.group(1); + } + } + return url; + } + + protected String getTagsFromHtml(String html) { + String tags = ""; + if (html != null) { + Pattern p = Pattern.compile("SHORTCUTURL=\"([^\"]*)\""); + Matcher m = p.matcher(html); + if (m.find()) { + tags = m.group(1); + } + } + return tags; + } + + protected void parseHtmlToBookmarks(NodeList list, BowUser user, Date date, + List<BowBookmark> bookmarks, Set<String> tagList) + throws ParserException { + + SimpleNodeIterator it = list.elements(); + + while (it.hasMoreNodes()) { + Node node = it.nextNode(); + String plainText = node.toPlainTextString(); // The text between + // two heads ==> + // <toto>plainText</toto> + String text = node.getText(); // The text in the head ==> + // <text></toto> + + if (StringUtils.startsWithIgnoreCase(text, "h3")) { // H3 = folder + if (StringUtils.isNotBlank(plainText)) { + tagList.add(plainText); // Adds the folder name to the + // tagList + } + } else if (StringUtils.startsWithIgnoreCase(text, "a href")) { // HREF + // = new + // bookmarks + BowBookmark bookmark = createBookmarkFromHtml(text, plainText, user); + Wikitty w = getBowProxy().getWikitty(bookmark); + BowImportHelper.addExtension(w); + BowImportHelper.setImportDate(w, date); + + bookmark.addAllLabels(tagList); + + bookmarks.add(bookmark); + } + NodeList children = node.getChildren(); + + if (children != null) { + parseHtmlToBookmarks(children, user, date, bookmarks, + // On utilise une nouvelle liste pour les enfants + // pour eviter que les tags de tous les enfants se + // retrouve ensemble + new HashSet<String>(tagList)); // If there is an under node = recursion + } + } + } + + @Override + public String execute() { + String result = SUCCESS; + log.info("Importing boormarks : " + upfile); + try { + BowUser user = getBowSession().getUser(); + + // Struts limite to html files, is null if not one + if (upfile != null) { + WikittyProxy proxy = getBowProxy(); + + try { + URL url = upfile.toURI().toURL(); + Parser parser = new Parser(url.openConnection()); + NodeList list = parser.parse(null); + + List<BowBookmark> bookmarks = new ArrayList<BowBookmark>(); + parseHtmlToBookmarks(list, user, new Date(), bookmarks, + new HashSet<String>()); + proxy.store(bookmarks); + + addActionMessage(_("bow.bookmark.import.successful")); + } catch (ParserException eee) { + result = ERROR; + log.error(String.format("Can't parse imported file '%s'", + getUpfileFileName()), eee); + addActionError(_("bow.bookmark.badFileFormat")); + } catch (IOException eee) { + result = ERROR; + log.error(String.format("Can't read imported file '%s'", + getUpfileFileName()), eee); + addActionError(_("bow.error.internal")); + } + } else { + addActionError(_("bow.bookmark.badFileFormat")); + result = ERROR; + } + } catch (Exception eee) { + result = ERROR; + addActionError(_("bow.error.internal")); + log.error(eee.getMessage(), eee); + } finally { + // on recharge les data apres l'action pour l'affichage + load(); + } + return result; + } +} Copied: trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/PreferenceBaseAction.java (from rev 309, trunk/bow-ui/src/main/java/org/chorem/bow/action/PreferencesAction.java) =================================================================== --- trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/PreferenceBaseAction.java (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/PreferenceBaseAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,421 @@ +/* + * #%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.preference; + +import org.chorem.bow.BowBookmark; +import org.chorem.bow.BowProxy; +import org.chorem.bow.BowUser; +import com.opensymphony.xwork2.ActionContext; +import java.text.ParseException; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.chorem.bow.BowImport; +import org.chorem.bow.BowSession; +import org.chorem.bow.action.BowBaseAction; + +import org.nuiton.wikitty.WikittyUtil; +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.search.Search; + +/** + * Change les preferences de l'utilisateur (couleur, password, email, ...) + * + * @author poussin + */ +public class PreferenceBaseAction extends BowBaseAction { + private static final long serialVersionUID = -58341106356599721L; + + static public PreferenceBaseAction getAction() { + Object action = ActionContext.getContext().get(CONTEXT_ACTION_KEY); + return (PreferenceBaseAction) action; + } + + /** la liste des differentes data que l'on peut charger */ + protected enum PreferenceType{USER_PREF, SITE_PREF, LABELS, IMPORTS}; + + 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 List<FacetTopic> labels; + protected String[] selectedLabels; + protected String rename; + protected String delete; + protected String newLabel; + + public String getNewLabel() { + return newLabel; + } + + public void setNewLabel(String newLabel) { + this.newLabel = newLabel; + } + + public void setRename(String rename) { + this.rename = rename; + } + + public String getRename() { + return rename; + } + + public void setDelete(String delete) { + this.delete = delete; + } + + public String getDelete() { + return delete; + } + + /** + * @return the colors + */ + public String getColors() { + return colors; + } + + /** + * @param colors the colors to set + */ + public void setColors(String colors) { + this.colors = colors; + } + + /** + * @return the tagsNb + */ + public String getTagsNb() { + return tagsNb; + } + + /** + * @param tagsNb the tagsNb to set + */ + public void setTagsNb(String tagsNb) { + this.tagsNb = tagsNb; + } + + /** + * @return the bookmarksHomePage + */ + public String getBookmarksHomePage() { + return bookmarksHomePage; + } + + /** + * @param bookmarksHomePage the bookmarksHomePage to set + */ + public void setBookmarksHomePage(String bookmarksHomePage) { + this.bookmarksHomePage = bookmarksHomePage; + } + + /** + * @return the searchEngineUrlSuggestions + */ + public String getSearchEngineUrlSuggestions() { + return searchEngineUrlSuggestions; + } + + /** + * @param searchEngineUrlSuggestions the searchEngineUrlSuggestions to set + */ + public void setSearchEngineUrlSuggestions(String searchEngineUrlSuggestions) { + this.searchEngineUrlSuggestions = searchEngineUrlSuggestions; + } + + /** + * @return the searchEngineUrlResults + */ + public String getSearchEngineUrlResults() { + return searchEngineUrlResults; + } + + /** + * @param searchEngineUrlResults the searchEngineUrlResults to set + */ + public void setSearchEngineUrlResults(String searchEngineUrlResults) { + this.searchEngineUrlResults = searchEngineUrlResults; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the newPassword + */ + public String getNewPassword() { + return newPassword; + } + + /** + * @param newPassword the newPassword to set + */ + public void setNewPassword(String newPassword) { + this.newPassword = newPassword; + } + + /** + * @return the currentPassword + */ + public String getCurrentPassword() { + return currentPassword; + } + + /** + * @param currentPassword the currentPassword to set + */ + public void setCurrentPassword(String currentPassword) { + this.currentPassword = currentPassword; + } + + /** + * @return the confirmNewPassword + */ + public String getConfirmNewPassword() { + return confirmNewPassword; + } + + /** + * @param confirmNewPassword the confirmNewPassword to set + */ + public void setConfirmNewPassword(String confirmNewPassword) { + this.confirmNewPassword = confirmNewPassword; + } + + /** + * @return the update + */ + public String getUpdate() { + return update; + } + + /** + * @param update the update to set + */ + public void setUpdate(String update) { + this.update = update; + } + + /** + * @return the bookmarksImportDate + */ + public Map<String, Integer> getBookmarksImportDate() { + return bookmarksImportDate; + } + + /** + * @param bookmarksImportDate the bookmarksImportDate to set + */ + public void setBookmarksImportDate(Map<String, Integer> bookmarksImportDate) { + this.bookmarksImportDate = bookmarksImportDate; + } + + public List<FacetTopic> getLabels() { + return labels; + } + + public String[] getSelectedLabels() { + return selectedLabels; + } + + public void setSelectedLabels(String[] selectedLabels) { + this.selectedLabels = selectedLabels; + } + + /** + * Date est une date mais au format String qui vient de Solr + * Elle est de la forme '2011-08-18T00:25:16.028Z' + * qui n'est pas presentable a l'utilisateur + * On la remet sous une vrai forme date + * + * Cette methode est utilise dans la JSP de rendu + */ + public Date stringToDate(String date) { + try { + Date result = WikittyUtil.parseDate(date); + return result; + } catch (ParseException eee) { + return new Date(0); + } + } + + /** + * Load les données sauf celle que l'on demande d'exclure du load + * @param exclude + */ + protected void load(PreferenceType ... exclude) { + PreferenceType[] list = PreferenceType.values(); + for (PreferenceType type : exclude) { + list[type.ordinal()] = null; + } + + for (PreferenceType type : list) { + if (type != null) { + switch(type) { + case USER_PREF: + loadUserPref(); + break; + case SITE_PREF: + loadSitePref(); + break; + case LABELS: + loadLabels(); + break; + case IMPORTS: + loadImport(); + break; + default: + // do nothing + break; + } + } + } + } + + /** + * charge les info de l'utilisateur qu'il peut modifier + */ + protected void loadUserPref() { + BowSession session = getBowSession(); + BowUser user = session.getUser(); + + setEmail(user.getLogin()); + } + + /** + * Charge les preferences utilisateur pour le site + */ + protected void loadSitePref() { + BowSession session = getBowSession(); + BowUser user = session.getUser(); + + setColors(user.getColors()); + setTagsNb(String.valueOf(user.getTags())); + setBookmarksHomePage(String.valueOf(user.getBookmarks())); + setSearchEngineUrlSuggestions(user.getSearchEngineUrlSuggestions()); + setSearchEngineUrlResults(user.getSearchEngineUrlResults()); + } + + /** + * Charge la liste des imports que l'utilisateur a fait + */ + protected void loadImport() { + BowSession session = getBowSession(); + BowProxy proxy = session.getProxy(); + BowUser user = session.getUser(); + + Criteria criteria = Search.query() + .exteq(BowImport.EXT_BOWIMPORT) + .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, user.getWikittyId()).criteria() + .addFacetField(BowImport.FQ_FIELD_BOWIMPORT_IMPORTDATE) + .setFirstIndex(0).setEndIndex(0); + + List<FacetTopic> bookmarksImportDate = + proxy.findAllByCriteria(BowImport.class, criteria) + .getTopic(BowImport.FQ_FIELD_BOWIMPORT_IMPORTDATE); + + // Extract imports + Map<String, Integer> result = new HashMap<String, Integer>(); + for (FacetTopic facet : bookmarksImportDate) { + String dateAsString = facet.getTopicName(); + int count = facet.getCount(); + result.put(dateAsString, count); + } + + if (log.isDebugEnabled()) { + log.debug("bookmarksByImportDate found : " + + (result == null ? "null" : result.size())); + } + setBookmarksImportDate(result.isEmpty() ? null : result); + } + + /** + * Charge dans la variable labels tous les labels de l'utilisateur + * @param proxy + */ + protected void loadLabels() { + BowSession session = getBowSession(); + BowProxy proxy = session.getProxy(); + BowUser user = session.getUser(); + String userId = user.getWikittyId(); + + Criteria c = Search.query() + .exteq(BowBookmark.EXT_WIKITTYLABEL) + .eq(BowBookmark.FQ_FIELD_WIKITTYAUTHORISATION_OWNER, userId) + .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(-1) // on demande tous les labels + .addFacetField(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS); + PagedResult<Wikitty> result = proxy.findAllByCriteria(c); + // lorsqu'on demande tout (facetLimit(-1)), les topics sont trie + // alphabetiquement pas besoin de les retrier + labels = result.getTopic(BowBookmark.FQ_FIELD_WIKITTYLABEL_LABELS); + } + + /** + * ACTION STRUTS + * + * Action executer lorsque l'utilisateur demande la page. Prepare toutes + * les données pour la page JSP + */ + @Override + public String input() { + String result = SUCCESS; + + try { + // load all data + load(); + } catch (Exception eee) { + result = ERROR; + addActionError(_("bow.error.internal")); + log.error("Can't load data preference", eee); + } + return result; + } +} Added: 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 (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/UpdateSiteAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,63 @@ +package org.chorem.bow.action.preference; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.bow.BowProxy; +import org.chorem.bow.BowSession; +import org.chorem.bow.BowUser; + +/** + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class UpdateSiteAction extends PreferenceBaseAction { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(UpdateSiteAction.class); + private static final long serialVersionUID = 1L; + + /** + * ACTION STRUTS + * + * Action executer lorsque l'utilisateur demande la page + */ + @Override + public String execute() { + String result = SUCCESS; + + try { + BowSession session = getBowSession(); + BowProxy proxy = session.getProxy(); + BowUser preference = session.getUser(); + + preference.setColors(colors); + if (StringUtils.isNotBlank(tagsNb)) { + preference.setTags(Integer.valueOf(tagsNb)); + } + if (StringUtils.isNotBlank(bookmarksHomePage)) { + preference.setBookmarks(Integer.valueOf(bookmarksHomePage)); + } + preference.setSearchEngineUrlSuggestions(searchEngineUrlSuggestions); + preference.setSearchEngineUrlResults(searchEngineUrlResults); + + preference = proxy.store(preference); + getBowSession().setUser(preference); + } catch (Exception eee) { + result = ERROR; + addActionError(_("bow.error.internal")); + log.error("Can't change site preference", eee); + } finally { + // on recharge les data apres l'action pour l'affichage + // sauf celle du site qui sont deja les bonnes + load(PreferenceType.SITE_PREF); + } + return result; + } + + +} Added: 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 (rev 0) +++ trunk/bow-ui/src/main/java/org/chorem/bow/action/preference/UpdateUserAction.java 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,103 @@ +package org.chorem.bow.action.preference; + +import org.apache.commons.lang.StringUtils; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.chorem.bow.BowProxy; +import org.chorem.bow.BowSession; +import org.chorem.bow.BowUser; +import org.nuiton.util.StringUtil; +import org.nuiton.wikitty.search.Criteria; +import org.nuiton.wikitty.search.Search; + +/** + * + * @author poussin + * @version $Revision$ + * + * Last update: $Date$ + * by : $Author$ + */ +public class UpdateUserAction extends PreferenceBaseAction { + + /** to use log facility, just put in your code: log.info(\"...\"); */ + static private Log log = LogFactory.getLog(UpdateUserAction.class); + private static final long serialVersionUID = 1L; + + /** + * ACTION STRUTS + * + * Modifie l'email et le password si necessaire. Si la modif est impossible + * email deja utilise, ou mauvais password, alors la methode return ERROR + * Si tout ce passe bien, la methode retourne SUCCES + * + * @param user + * @return + */ + @Override + public String execute() { + String result = SUCCESS; + + try { + BowSession session = getBowSession(); + BowProxy proxy = session.getProxy(); + BowUser user = session.getUser(); + + if (StringUtils.isNotBlank(email)) { + Criteria criteria = Search.query().eq(BowUser.FQ_FIELD_WIKITTYUSER_LOGIN, email).criteria(); + if (log.isDebugEnabled()) { + log.debug(String.format("Try to find user with email: '%s'", email)); + } + BowUser find = getBowProxy().findByCriteria(BowUser.class, criteria); + + //If this email address isn't already used (or if it hasn't changed) + if (find == null || find.getLogin().equals(user.getLogin())) { + email = email.trim(); + user.setLogin(email); + } else { + // this email address is already used by someone else + setEmail(user.getLogin()); + + // TODO poussin 20110818 addFieldError don't work (no message on web page :( + // add addActionError to prevent addFieldError that don't work + addFieldError("email", _("bow.preferences.emailAldyExists")); + addActionError(_("bow.preferences.emailAldyExists")); + result = ERROR; + } + } + + if (result == SUCCESS + && StringUtils.isNotBlank(newPassword) + && StringUtils.isNotBlank(confirmNewPassword) + && StringUtils.isNotBlank(currentPassword)) { + if (newPassword.equals(confirmNewPassword)) { + currentPassword = StringUtil.encodeMD5(currentPassword); + if (currentPassword.equals(user.getPassword())) { + user.setPassword(StringUtil.encodeMD5(newPassword)); + } else { + // TODO poussin 20110818 addFieldError don't work (no message on web page :( + // add addActionError to prevent addFieldError that don't work + addFieldError("currentPassword", _("bow.preferences.badCurrentPassword")); + addActionError(_("bow.preferences.badCurrentPassword")); + result = ERROR; + } + } + } + if (result == SUCCESS) { + user = proxy.store(user); + getBowSession().setUser(user); + addActionMessage(_("bow.preferences.update.successful")); + } + } catch (Exception eee) { + addActionError(_("bow.error.internal")); + log.error("Can't change site preference", eee); + } finally { + // on recharge les data apres l'action pour l'affichage + // sauf celle du user qui sont deja les bonnes + load(PreferenceType.USER_PREF); + } + + return result; + } + +} 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-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/resources/i18n/bow-ui_en_GB.properties 2011-08-20 00:51:36 UTC (rev 313) @@ -108,6 +108,7 @@ 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.find.submit=Find bow.rightMenu.fullTextSearch=Full text search bow.rightMenu.help=Help 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-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/resources/i18n/bow-ui_fr_FR.properties 2011-08-20 00:51:36 UTC (rev 313) @@ -108,6 +108,7 @@ 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.find.submit=Rechercher bow.rightMenu.fullTextSearch=Recherche full text bow.rightMenu.help=Aide Copied: trunk/bow-ui/src/main/resources/org/chorem/bow/action/preference/UpdateUserAction-validation.xml (from rev 306, trunk/bow-ui/src/main/resources/org/chorem/bow/action/RegisterAction-validation.xml) =================================================================== --- trunk/bow-ui/src/main/resources/org/chorem/bow/action/preference/UpdateUserAction-validation.xml (rev 0) +++ trunk/bow-ui/src/main/resources/org/chorem/bow/action/preference/UpdateUserAction-validation.xml 2011-08-20 00:51:36 UTC (rev 313) @@ -0,0 +1,53 @@ +<!-- + #%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% + --> +<!DOCTYPE validators PUBLIC + "-//OpenSymphony Group//XWork Validator 1.0.2//EN" + "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd"> + +<validators> + <field name="email"> + <field-validator type="requiredstring"> + <message key="bow.login.email.required" /> + </field-validator> + <field-validator type="regex"> + <param name="expression">^[a-z0-9!#$%&'*+/=?^_`{|}~-]+((\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)?)+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9\-]*[a-z0-9])?$</param> + <message key="bow.login.email.wrongformat" /> + </field-validator> + </field> + <field name="password"> + <field-validator type="requiredstring"> + <message key="bow.login.password.required" /> + </field-validator> + </field> + <field name="repeatPassword"> + <field-validator type="requiredstring"> + <message key="bow.login.repeatPassword.required" /> + </field-validator> + </field> + + <validator type="expression"> + <param name="expression">password.equals(repeatPassword)</param> + <message key="bow.register.pwdDontMatch" /> + </validator> +</validators> Modified: trunk/bow-ui/src/main/resources/struts.xml =================================================================== --- trunk/bow-ui/src/main/resources/struts.xml 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/resources/struts.xml 2011-08-20 00:51:36 UTC (rev 313) @@ -104,70 +104,62 @@ </package> <package name="login" extends="loginArea"> - <action name="register_*" method="{1}" class="org.chorem.bow.action.RegisterAction"> + <action name="register_*" method="{1}" class="org.chorem.bow.action.login.RegisterAction"> <result name="input">/jsp/register.jsp</result> <result type="redirectAction">home</result> </action> - <action name="forgotPassword_*" method="{1}" class="org.chorem.bow.action.ForgotPasswordAction"> + <action name="forgotPassword_*" method="{1}" class="org.chorem.bow.action.login.ForgotPasswordAction"> <result name="input">/jsp/forgotPassword.jsp</result> <result type="redirectAction">login_input</result> </action> - <action name="login_*" method="{1}" class="org.chorem.bow.action.LoginAction"> + <action name="login_*" method="{1}" class="org.chorem.bow.action.login.LoginAction"> <result name="input">/jsp/login.jsp</result> <result name="login" type="redirectAction">home</result> <result type="redirectAction">home</result> </action> - <action name="logout" class="org.chorem.bow.action.LogoutAction"> + <action name="logout" class="org.chorem.bow.action.login.LogoutAction"> <result type="redirectAction">login_input</result> </action> </package> <package name="bookmark" extends="restrictedArea"> - <action name="importBookmarks" class="org.chorem.bow.action.ImportBookmarksAction"> - <result type="redirectAction">preferences</result> - <result name="error">/jsp/preferences.jsp</result> + <action name="home" class="org.chorem.bow.action.bookmark.HomeAction"> + <result name="error">/jsp/home.jsp</result> + <result>/jsp/home.jsp</result> </action> - <action name="exportBookmarks" class="org.chorem.bow.action.ExportBookmarksAction"> - <result type="stream"> - <param name="contentType">application/octet-stream</param> - <param name="inputName">inputStream</param> - <param name="contentDisposition">attachment;filename="bookmarks.html"</param> - </result> - </action> - <action name="removeBookmark" class="org.chorem.bow.action.RemoveBookmarkAction"> + <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="deleteImport" class="org.chorem.bow.action.DeleteImportAction"> - <result type="redirectAction">preferences</result> + <action name="editBookmark" class="org.chorem.bow.action.bookmark.EditAction"> + <result name="error">/jsp/editBookmark.jsp</result> + <result>/jsp/editBookmark.jsp</result> </action> - <action name="addUrl" class="org.chorem.bow.action.AddUrlAction"> + <action name="addUrl" class="org.chorem.bow.action.bookmark.AddOrUpdateAction"> + <result name="error">/jsp/editBookmark.jsp</result> <result type="redirect">${redirectTo}</result> </action> - <action name="editBookmark" class="org.chorem.bow.action.EditBookmarkAction"> - <result>/jsp/editBookmark.jsp</result> + <action name="deleteSearchResults" class="org.chorem.bow.action.bookmark.DeleteSearchResultsAction"> + <result name="error" type="redirectAction">home</result> + <result type="redirectAction">home</result> </action> </package> <!-- 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.EditBookmarkAction"> + <action name="editBookmark" class="org.chorem.bow.action.bookmark.EditAction"> + <result name="error">/jsp/editBookmark.jsp</result> <result>/jsp/editBookmark.jsp</result> </action> </package> <package name="search" extends="restrictedArea"> - <action name="home" class="org.chorem.bow.action.HomeAction"> - <result>/jsp/home.jsp</result> - </action> <action name="openSearchResult" class="org.chorem.bow.action.OpenSearchResultAction"> <result type="redirect">${redirectTo}</result> </action> <action name="openSearchSuggestion" class="org.chorem.bow.action.OpenSearchSuggestionAction"> <result>/jsp/suggestions.jsp</result> </action> - <action name="deleteSearchResults" class="org.chorem.bow.action.DeleteSearchResultsAction"> - <result type="redirectAction">home</result> - </action> <action name="*Xml"> <result>/jsp/{1}Xml.jsp</result> </action> @@ -177,19 +169,50 @@ <action name="locale" class="org.chorem.bow.action.LocaleAction"> <result type="redirect">/jsp/login.jsp</result> </action> - <action name="regenPermToken" class="org.chorem.bow.action.GenerateTokenAction"> - <result type="redirectAction">preferences</result> + + <action name="preferences" class="org.chorem.bow.action.preference.PreferenceBaseAction" method="input"> + <result name="error">/jsp/preferences.jsp</result> + <result>/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> + </action> - <action name="adminlabels" class="org.chorem.bow.action.PreferencesAction" method="adminlabels"> - <result type="redirectAction">preferences</result> + <action name="updateUserPref" class="org.chorem.bow.action.preference.UpdateUserAction"> + <result name="error">/jsp/preferences.jsp</result> + <result>/jsp/preferences.jsp</result> </action> - <action name="preferences" class="org.chorem.bow.action.PreferencesAction"> - <result name="update" type="redirectAction">preferences</result> + <action name="updateSitePref" class="org.chorem.bow.action.preference.UpdateSiteAction"> <result name="error">/jsp/preferences.jsp</result> <result>/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> + </action> + + <action name="deleteImport" class="org.chorem.bow.action.preference.DeleteImportAction"> + <result name="error">/jsp/preferences.jsp</result> + <result>/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> + </action> + + <action name="exportBookmarks" class="org.chorem.bow.action.preference.ExportBookmarksAction"> + <result name="error">/jsp/preferences.jsp</result> + <result type="stream"> + <param name="contentType">text/html</param> + <param name="inputName">inputStream</param> + <param name="contentDisposition">attachment;filename="bookmarks.html"</param> + </result> + </action> </package> <package name="admin" extends="restrictedArea"> @@ -197,10 +220,12 @@ <result name="error">/jsp/login.jsp</result> <result>/jsp/admin.jsp</result> </action> - <action name="reIndexation" class="org.chorem.bow.action.ReIndexationAction"> + <action name="reIndexation" class="org.chorem.bow.action.admin.ReIndexationAction"> + <result name="error">/jsp/admin.jsp</result> <result>/jsp/admin.jsp</result> </action> - <action name="migrateData" class="org.chorem.bow.action.MigrateDataAction"> + <action name="migrateData" class="org.chorem.bow.action.admin.MigrateDataAction"> + <result name="error">/jsp/admin.jsp</result> <result>/jsp/admin.jsp</result> </action> </package> Modified: trunk/bow-ui/src/main/webapp/jsp/admin.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/admin.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/admin.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,9 +20,10 @@ 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" Modified: trunk/bow-ui/src/main/webapp/jsp/editBookmark.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/editBookmark.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/editBookmark.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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"%> @@ -40,7 +40,7 @@ </div> <div class="formFrame fond"> <s:form id="popupAddUrlForm" action="addUrl" method="post"> - <s:hidden name="searchLine" value="%{searchLine}" /> + <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" Modified: trunk/bow-ui/src/main/webapp/jsp/error.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/error.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/error.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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"%> Modified: trunk/bow-ui/src/main/webapp/jsp/forgotPassword.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/forgotPassword.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/forgotPassword.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,31 +20,32 @@ 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 /> + <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> + <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> Modified: trunk/bow-ui/src/main/webapp/jsp/home.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/home.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/home.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,15 +20,9 @@ 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" %> -<%@page import="org.chorem.bow.BowBookmark" %> -<%@page import="java.text.SimpleDateFormat" %> -<%@page import="java.util.List" %> -<%@page import="org.chorem.bow.BowSearchResult"%> -<%@page import="org.chorem.bow.action.HomeAction"%> -<%@page import="org.chorem.bow.BowConfig"%> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:s="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" @@ -50,7 +44,7 @@ <s:set name="bookmarksToDelete" value="%{searchResult.bookmarkCount}" /> <s:if test="%{#bookmarksToDelete > 0}"> <s:url var="deleteSearchResults" action="deleteSearchResults" escapeAmp="false"> - <s:param name="searchLine"><s:property value="searchResult.searchLine" /></s:param> + <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> @@ -59,7 +53,7 @@ <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="searchLine" value="%{searchResult.searchLine}" /> + <s:hidden name="tagLine" value="%{searchResult.tagLine}" /> <s:hidden name="fullTextLine" value="%{searchResult.fullTextLine}" /> </s:form> </div> @@ -71,7 +65,7 @@ <s:iterator value="searchResult.bookmarks" var="bookmark"> <s:set name="bookmark" value="bookmark"/> <jsp:include page="inc/bookmark.jsp" flush="true"> - <jsp:param name="searchLine" value="%{searchResult.searchLine}" /> + <jsp:param name="tagLine" value="%{searchResult.tagLine}" /> <jsp:param name="fullTextLine" value="%{searchResult.fullTextLine}" /> </jsp:include> </s:iterator> Modified: trunk/bow-ui/src/main/webapp/jsp/inc/bookmark.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/inc/bookmark.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/inc/bookmark.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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" %> @@ -31,26 +31,26 @@ <div class="bookmarkhead"> <p class="date"><s:property value="#bookmark.creationDate"/></p> - <s:a cssClass="alias" href="%{config.servletAliasUrl + #bookmark.wikittyId}.action" + <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.servletAliasUrl + #bookmark.publicAlias}.action" + <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="searchLine"><s:property value="%{searchLine}" /></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="searchLine"><s:property value="%{searchLine}" /></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}" @@ -71,7 +71,7 @@ <strong><s:text name="bow.bookmark.tags" /> :</strong> <s:iterator value="#bookmark.labels" var="tag"> <s:url var="search" action="home"> - <s:param name="searchLine" value="%{searchLine}"/> + <s:param name="tagLine" value="%{tagLine}"/> <s:param name="addTag" value="%{#tag}"/> <s:param name="fullTextLine" value="%{fullTextLine}"/> </s:url> Modified: trunk/bow-ui/src/main/webapp/jsp/inc/footer.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/inc/footer.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/inc/footer.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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" %> Modified: trunk/bow-ui/src/main/webapp/jsp/inc/header.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/inc/header.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/inc/header.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow $Id$ @@ -19,9 +19,10 @@ 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"> @@ -41,7 +42,7 @@ <h3>Recherche</h3> <div class="input"> <s:form action="home" theme="simple"> - <s:textfield name="searchLine" labelSeparator="" /> + <s:textfield name="tagLine" labelSeparator="" /> <s:submit key="bow.rightMenu.search.tags" name="submit" /> </s:form> </div> @@ -51,6 +52,12 @@ <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"> Modified: trunk/bow-ui/src/main/webapp/jsp/inc/rightMenu.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/inc/rightMenu.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/inc/rightMenu.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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" %> @@ -52,7 +52,7 @@ <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="searchLine"><s:property value="%{searchLine}" /></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 href="%{editBookmark}"> @@ -62,7 +62,7 @@ </ul> <!--div id="nuage"--> <jsp:include page="tagsCloud.jsp" flush="true"> - <jsp:param name="searchLine" value="%{searchLine}" /> + <jsp:param name="tagLine" value="%{tagLine}" /> <jsp:param name="fullTextLine" value="%{fullTextLine}"/> </jsp:include> <!--/div--> Modified: trunk/bow-ui/src/main/webapp/jsp/inc/tagsCloud.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/inc/tagsCloud.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/inc/tagsCloud.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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" %> @@ -29,7 +29,7 @@ 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="searchLine" value="%{searchLine}"/> + <s:param name="tagLine" value="%{tagLine}"/> <s:param name="addTag" value="%{#tag.topicName}"/> <s:param name="fullTextLine" value="%{fullTextLine}"/> </s:url> Modified: trunk/bow-ui/src/main/webapp/jsp/login.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/login.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/login.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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"%> Modified: trunk/bow-ui/src/main/webapp/jsp/permanentXml.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/permanentXml.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/permanentXml.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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" %> Modified: trunk/bow-ui/src/main/webapp/jsp/preferences.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/preferences.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/preferences.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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" %> @@ -71,7 +71,7 @@ </li> </ul> - <s:url var="regenPermToken" action="regenPermToken"/> + <s:url var="regenPermToken" action="generateToken"/> <s:a href="%{regenPermToken}" id="regenPermToken"> <s:text name="bow.preferences.regenPermToken"/> </s:a> @@ -80,7 +80,7 @@ <div class="formFrame fond"> <h3><s:text name="bow.preferences.userInfo"/></h3> <br/> - <s:form action="preferences" theme="simple"> + <s:form action="updateUserPref" theme="simple"> <s:text name="bow.login.email"/><br/> <s:textfield name="email" labelposition="top"/><br/> @@ -103,7 +103,7 @@ <div class="formFrame fond"> <h3><s:text name="bow.preferences.siteLook"/></h3> <br/> - <s:form action="preferences" theme="simple"> + <s:form action="updateSitePref" theme="simple"> <s:text name="bow.preferences.tagsNb"/><br/> <s:textfield name="tagsNb" labelposition="top"/><br/> @@ -156,7 +156,7 @@ <br/> <s:form action="importBookmarks" method="post" enctype="multipart/form-data" theme="simple"> <s:file name="upfile" labelSeparator=""/> - <s:hidden name="searchLine" value="%{searchLine}"/> + <s:hidden name="tagLine" value="%{tagLine}"/> <s:hidden name="fullTextLine" value="%{fullTextLine}"/> <s:submit key="bow.preferences.import.submit" name="submit"/> </s:form> Modified: trunk/bow-ui/src/main/webapp/jsp/register.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/register.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/register.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,9 +20,10 @@ 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" Modified: trunk/bow-ui/src/main/webapp/jsp/suggestions.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/suggestions.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/suggestions.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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" %> Modified: trunk/bow-ui/src/main/webapp/jsp/temporaryXml.jsp =================================================================== --- trunk/bow-ui/src/main/webapp/jsp/temporaryXml.jsp 2011-08-19 16:31:32 UTC (rev 312) +++ trunk/bow-ui/src/main/webapp/jsp/temporaryXml.jsp 2011-08-20 00:51:36 UTC (rev 313) @@ -1,4 +1,4 @@ -<!-- +<%-- #%L bow @@ -20,7 +20,7 @@ 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" %>
participants (1)
-
bpoussin@users.chorem.org