r118 - in trunk: . src/main/java/org/chorem/bow src/main/webapp src/main/webapp/css
Author: vbriand Date: 2010-10-21 17:48:45 +0200 (Thu, 21 Oct 2010) New Revision: 118 Url: http://chorem.org/repositories/revision/bow/118 Log: bugs resolution (registration, uncaught exceptions, easy access to admin page); W3C compliant; HTML uses (more) includes to allow easier further modifications; Added an explicit error message in the page body instead of the 'Errorsvn diff pom.xml' message; New style for preferences and admin pages; The bookmark permanent link works now (at least with Firefox); The cancellation of the adding bookmark prompt box doesn't create a bookmark with null values anymore; The accents are now displayed correctly Added: trunk/src/main/webapp/css/global.css trunk/src/main/webapp/errorFrame.jsp trunk/src/main/webapp/home.jsp trunk/src/main/webapp/rightMenu.jsp trunk/src/main/webapp/search.jsp Removed: trunk/src/main/webapp/bookmarkContent.jsp trunk/src/main/webapp/bookmarkHomeMain.jsp trunk/src/main/webapp/bookmarkPage.jsp trunk/src/main/webapp/bookmarkSearchMain.jsp trunk/src/main/webapp/main.jsp Modified: trunk/pom.xml trunk/src/main/java/org/chorem/bow/BookmarkActions.java trunk/src/main/java/org/chorem/bow/ControllerServlet.java trunk/src/main/webapp/admin.jsp trunk/src/main/webapp/bookmark.jsp trunk/src/main/webapp/bookmarkTop.jsp trunk/src/main/webapp/css/bookmark.css trunk/src/main/webapp/css/connexion.css trunk/src/main/webapp/error.jsp trunk/src/main/webapp/footer.jsp trunk/src/main/webapp/forgotPassword.jsp trunk/src/main/webapp/header.jsp trunk/src/main/webapp/login.jsp trunk/src/main/webapp/preferences.jsp trunk/src/main/webapp/register.jsp trunk/src/main/webapp/tagsCloud.jsp Modified: trunk/pom.xml =================================================================== --- trunk/pom.xml 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/pom.xml 2010-10-21 15:48:45 UTC (rev 118) @@ -66,6 +66,12 @@ </dependency> <dependency> + <groupId>org.nuiton.wikitty</groupId> + <artifactId>wikitty-solr-impl</artifactId> + <version>${wikitty.version}</version> + </dependency> + + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.5.11</version> @@ -95,6 +101,12 @@ <version>1.6</version> </dependency> + <dependency> + <groupId>commons-lang</groupId> + <artifactId>commons-lang</artifactId> + <version>2.5</version> + </dependency> + </dependencies> <scm> Modified: trunk/src/main/java/org/chorem/bow/BookmarkActions.java =================================================================== --- trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/java/org/chorem/bow/BookmarkActions.java 2010-10-21 15:48:45 UTC (rev 118) @@ -144,7 +144,7 @@ */ public static Bookmark createBookmark(String url, String nameAndTags, User user) { - Bookmark bookmark = (Bookmark) new BookmarkImpl(); + Bookmark bookmark = new BookmarkImpl(); int nameIndex = nameAndTags.indexOf('|'); // get the index name of the website if (nameIndex > 0) { @@ -152,6 +152,7 @@ if (!name.isEmpty()) { name = name.trim(); bookmark.setDescription(name); // set the description (website name) + bookmark.setAlias(name); } } String tags = nameAndTags; @@ -163,7 +164,6 @@ bookmark.setClick(0); bookmark.setEmail(user.getEmail()); // set the email (user name) bookmark.setDate(new Date()); // set the date - bookmark.setAlias(""); return bookmark; } @@ -205,7 +205,7 @@ } public static Bookmark createBookmark(String url, String name, String tags, User user, String alias, Date date) { - Bookmark bookmark = (Bookmark) new BookmarkImpl(); + Bookmark bookmark = new BookmarkImpl(); if (name != null) { name = name.trim(); bookmark.setDescription(name); Modified: trunk/src/main/java/org/chorem/bow/ControllerServlet.java =================================================================== --- trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-10-21 15:48:45 UTC (rev 118) @@ -43,6 +43,7 @@ import javax.mail.internet.MimeMessage; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; +import javax.servlet.ServletRequest; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -72,9 +73,8 @@ * @author bbrossaud */ public class ControllerServlet extends HttpServlet { - - private static final long serialVersionUID = 1L; - private static final Log log = LogFactory.getLog(ControllerServlet.class); + private static final long serialVersionUID = 1L; + private static final Log log = LogFactory.getLog(ControllerServlet.class); protected String version = ""; protected String bowServletUrl = ""; @@ -102,6 +102,7 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { try { + request.setCharacterEncoding("UTF8"); request.setAttribute("version", version); request.setAttribute("bowUrl", bowServletUrl); HttpSession session = request.getSession(true); @@ -174,7 +175,7 @@ log.debug("Going to actionSearch"); } this.actionSearch(request, user); - request.getRequestDispatcher("main.jsp").forward(request, response); + request.getRequestDispatcher("search.jsp").forward(request, response); } else if (action.equals("generateToken") && user != null) { if (log.isDebugEnabled()) { log.debug("Going to actionGenerateToken"); @@ -206,7 +207,7 @@ log.debug("Going to actionOrder"); } this.actionOrder(request, response, user); - request.getRequestDispatcher("main.jsp").forward(request, response); + request.getRequestDispatcher("search.jsp").forward(request, response); } else if (action.equals("addClick") && user != null) { if (log.isDebugEnabled()) { log.debug("Going to actionAddClic"); @@ -238,7 +239,7 @@ log.debug("Going to actionFullText"); } this.actionFullText(request, user); - request.getRequestDispatcher("main.jsp").forward(request, response); + request.getRequestDispatcher("search.jsp").forward(request, response); } else if (action.equals("preferences") && user != null) { if (log.isDebugEnabled()) { log.debug("Going to actionPreferences"); @@ -248,7 +249,11 @@ if (log.isDebugEnabled()) { log.debug("Going to actionAdmin"); } - request.getRequestDispatcher("admin.jsp").forward(request, response); + if ((Boolean)session.getAttribute("admin") == true) { + request.getRequestDispatcher("admin.jsp").forward(request, response); + } else { + request.getRequestDispatcher("login.jsp").forward(request, response); + } } else if (action.equals("changePreferences") && user != null) { if (log.isDebugEnabled()) { log.debug("Going to actionChangePreferences"); @@ -279,6 +284,8 @@ } } catch (Exception eee) { log.error("Can't do action", eee); + request.setAttribute("errorMsgUser", eee.getMessage()); + request.setAttribute("errorMsgTech", eee.toString()); request.getRequestDispatcher("error.jsp").forward(request, response); } } @@ -327,7 +334,7 @@ BookmarkActions bookmarkActions = createBookmarkActions(request, result, searchLine); request.setAttribute("bookmarkActions", bookmarkActions); request.setAttribute("token", token); - request.getRequestDispatcher("main.jsp").forward(request, response); + request.getRequestDispatcher("search.jsp").forward(request, response); } } @@ -467,10 +474,11 @@ String searchLine = request.getParameter("searchLine"); if (searchLine == null) { initHomePage(request, user); + request.getRequestDispatcher("home.jsp").forward(request, response); } else { actionSearch(request, user); + request.getRequestDispatcher("search.jsp").forward(request, response); } - request.getRequestDispatcher("main.jsp").forward(request, response); } /* @param request servlet request @@ -483,15 +491,15 @@ throws IOException, ServletException { String bookmarkId = request.getParameter("bookmarkId"); if (bookmarkId != null && !bookmarkId.isEmpty()) { - try { - WikittyProxy proxy = BowProxy.getInstance(); - Bookmark bookmark = proxy.restore(Bookmark.class, bookmarkId); - if (bookmark != null) { - proxy.delete(bookmarkId); - } - } catch (Exception eee) { - log.error("Can't do action", eee); + try { + WikittyProxy proxy = BowProxy.getInstance(); + Bookmark bookmark = proxy.restore(Bookmark.class, bookmarkId); + if (bookmark != null) { + proxy.delete(bookmarkId); } + } catch (Exception eee) { + log.error("Can't do action", eee); + } } redirectToTheGoodPage(request, response); } @@ -564,12 +572,12 @@ WikittyProxy proxy = BowProxy.getInstance(); Bookmark bookmark = proxy.restore(Bookmark.class, id); if (bookmark != null) { - if (alias != null && !alias.isEmpty()) { - Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_ALIAS, alias).criteria(); - if (proxy.findByCriteria(Bookmark.class, criteria) != null) { + if (alias != null && !alias.isEmpty()) { + Criteria criteria = Search.query().eq(Bookmark.FQ_FIELD_ALIAS, alias).criteria(); + if (proxy.findByCriteria(Bookmark.class, criteria) != null) { alias = bookmark.getAlias(); - } } + } BookmarkActions.updateBookmark(bookmark, name, link, tags, alias); proxy.store(bookmark); } @@ -605,10 +613,12 @@ bookmark = BookmarkActions.createBookmark(link, name, tags, user, alias, null); } else { // this part is for the bookmark addition by script String nameAndTags = request.getParameter("nameAndTags"); - bookmark = BookmarkActions.createBookmark(link, nameAndTags, user); + if (nameAndTags != null) { + bookmark = BookmarkActions.createBookmark(link, nameAndTags, user); + } } - if (bookmark != null) { - proxy.store(bookmark); // store the bookmark if all is Ok + if (bookmark != null && !bookmark.getDescription().isEmpty() && !bookmark.getEmail().isEmpty()) { + proxy.store(bookmark); // store the bookmark if everything is ok if (log.isDebugEnabled()) { log.debug("Adding URL"); } @@ -675,26 +685,26 @@ throws IOException, ServletException { String searchLine = request.getParameter("searchLine"); if (searchLine == null) { - searchLine = ""; + searchLine = ""; } String fulltext = request.getParameter("fullTextLine"); if (fulltext != null && !fulltext.isEmpty() && searchLine.isEmpty()) { - actionFullText(request, user); + actionFullText(request, user); } else { - String tag = request.getParameter("addTag"); - if (tag != null && !tag.isEmpty()) { - if (searchLine == null || searchLine.isEmpty()) { - searchLine = tag; - } else { - searchLine += " " + tag; - } - } - WikittyProxy proxy = BowProxy.getInstance(); - Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine); - criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK); - PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria); // select all bookmarks by user - BookmarkActions bookmarkActions = createBookmarkActions(request, result, searchLine); - request.setAttribute("bookmarkActions", bookmarkActions); + String tag = request.getParameter("addTag"); + if (tag != null && !tag.isEmpty()) { + if (searchLine == null || searchLine.isEmpty()) { + searchLine = tag; + } else { + searchLine += " " + tag; + } + } + WikittyProxy proxy = BowProxy.getInstance(); + Criteria criteria = getBookmarkListCriteriaByUser(user, searchLine); + criteria = criteria.addSortDescending(Bookmark.FQ_FIELD_CLICK); + PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria); // select all bookmarks by user + BookmarkActions bookmarkActions = createBookmarkActions(request, result, searchLine); + request.setAttribute("bookmarkActions", bookmarkActions); } } @@ -732,28 +742,31 @@ */ protected void actionRegister(HttpServletRequest request, HttpServletResponse response, HttpSession session) throws IOException, ServletException, NoSuchAlgorithmException, AddressException, MessagingException { - String email = request.getParameter("email"); - String password = request.getParameter("password"); - String md5 = StringUtil.encodeMD5(password); - if (this.checkRegister(email, md5)) { // check if all is well - String error = "Email and password must be correctly filled"; - request.setAttribute("msgError", error); - request.getRequestDispatcher("register.jsp").forward(request, response); - } else { - WikittyProxy proxy = BowProxy.getInstance(); - UserImpl newUser = new UserImpl(); - newUser.setPassword(md5); - newUser.setEmail(email); - User login = proxy.store((User) newUser); // store the new user - if (login == null) { - request.getRequestDispatcher("error.jsp").forward(request, response); - } else { - initSession(session, login); - initHomePage(request, login); - sendMail(email, password); - request.getRequestDispatcher("main.jsp").forward(request, response); - } - } + String email = request.getParameter("email"); + if (email != null) { + email = email.trim(); + String password = request.getParameter("password"); + String md5 = null; + if (password != null) { + md5 = StringUtil.encodeMD5(password); + if (!this.checkRegister(email, md5, request)) { // check if all is well + WikittyProxy proxy = BowProxy.getInstance(); + UserImpl newUser = new UserImpl(); + newUser.setPassword(md5); + newUser.setEmail(email); + User login = proxy.store((User) newUser); // store the new user + if (login != null) { + initSession(session, login); + initHomePage(request, login); + sendMail(email, password); + request.getRequestDispatcher("home.jsp").forward(request, response); + return ; + } + request.setAttribute("errorMsgUser", "Invalid login, please choose another one"); + } + } + } + request.getRequestDispatcher("register.jsp").forward(request, response); } /* @param request servlet request @@ -765,19 +778,22 @@ protected void actionLogin(HttpServletRequest request, HttpServletResponse response, HttpSession session) throws IOException, ServletException, NoSuchAlgorithmException { String email = request.getParameter("email"); - String password = request.getParameter("password"); - password = StringUtil.encodeMD5(password); - User login = this.checkLogin(email, password); // check if the user exists - if (login != null) { - initSession(session, login); - initHomePage(request, login); - request.getRequestDispatcher("main.jsp").forward(request, response); - - } else { - String error = "Unknow email or incorrect password"; - request.setAttribute("msgError", error); - request.getRequestDispatcher("login.jsp").forward(request, response); + if (email != null) { + email = email.trim(); + String password = request.getParameter("password"); + String md5 = null; + if (password != null) { + md5 = StringUtil.encodeMD5(password); + User login = this.checkLogin(email, md5, request); // check if the user exists + if (login != null) { + initSession(session, login); + initHomePage(request, login); + request.getRequestDispatcher("home.jsp").forward(request, response); + return; + } + } } + request.getRequestDispatcher("login.jsp").forward(request, response); } protected void checkAdmin(String login, HttpSession session) { @@ -823,35 +839,43 @@ * @return null the user doesn't exist * @return User the user exists */ - protected User checkLogin(String email, String password) { + protected User checkLogin(String email, String password, HttpServletRequest request) throws NoSuchAlgorithmException { if (email != null && password != null) { - if (!email.isEmpty() && !password.isEmpty()) { + if (!email.isEmpty() && !password.equals(StringUtil.encodeMD5(""))) { WikittyProxy proxy = BowProxy.getInstance(); - Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, email). eq(User.FQ_FIELD_PASSWORD, password).criteria(); - return proxy.findByCriteria(User.class, criteria); // retrieve user by user name (email) and password + User user = proxy.findByCriteria(User.class, criteria); + + if (user == null) { + request.setAttribute("errorMsgUser", "Unknown email or incorrect password"); + } + return user; // retrieve user by user name (email) and password } } + request.setAttribute("errorMsgUser", "Please enter your email address and your password"); return null; } /* @param email String which contains the user name (email) * @param password String which contains the user password - * @return bool false if the user doesn't exists or true + * @return boolean false if the user doesn't exist or true */ - protected boolean checkRegister(String email, String password) { + protected boolean checkRegister(String email, String password, HttpServletRequest request) throws NoSuchAlgorithmException { if (email != null && password != null) { - if (!email.isEmpty() && !password.isEmpty()) { + if (!email.isEmpty() && !password.equals(StringUtil.encodeMD5(""))) { WikittyProxy proxy = BowProxy.getInstance(); Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, email).criteria(); // retrieve user by user name (email) if (proxy.findByCriteria(User.class, criteria) == null) { return false; } + request.setAttribute("errorMsgUser", "This email address is already used"); + return true; } } + request.setAttribute("errorMsgUser", "Email and password must be correctly filled"); return true; } @@ -894,15 +918,15 @@ throws ServletException, IOException, NoSuchAlgorithmException { User user = (User) session.getAttribute("user"); if (user == null) { - String token = request.getParameter("token"); - user = checkPermanentToken(token); - if (user != null) { - initSession(session, user); - } + String token = request.getParameter("token"); + user = checkPermanentToken(token); + if (user != null) { + initSession(session, user); + } } if (user != null) { - initHomePage(request, user); - request.getRequestDispatcher("main.jsp").forward(request, response); + initHomePage(request, user); + request.getRequestDispatcher("home.jsp").forward(request, response); } else { request.getRequestDispatcher("login.jsp").forward(request, response); } @@ -932,7 +956,7 @@ * @description import bookmark for an user */ protected void actionImportBookmarks(HttpServletRequest request, HttpServletResponse response, User user) - throws IOException, FileUploadException, ParserException { + throws IOException, FileUploadException, ServletException { // Check that we have a file upload request boolean isMultipart = ServletFileUpload.isMultipartContent(request); if (isMultipart == true) { @@ -948,16 +972,30 @@ if (!item.isFormField()) { WikittyProxy proxy = BowProxy.getInstance(); String content = item.getString(); - Parser parser = new Parser(content); - NodeList list = parser.parse(null); - List<Bookmark> bookmarks = new ArrayList<Bookmark>(); - parseHtmlToBookmarks(list, user, bookmarks, new ArrayList<String>()); - bookmarks = proxy.store(bookmarks); - createImportExtension(bookmarks); + try { + Parser parser = new Parser(content); + NodeList list = parser.parse(null); + List<Bookmark> bookmarks = new ArrayList<Bookmark>(); + parseHtmlToBookmarks(list, user, bookmarks, new ArrayList<String>()); + bookmarks = proxy.store(bookmarks); + createImportExtension(bookmarks); + } + catch (ParserException e) { + request.setAttribute("errorMsgUser", "Bad bookmarks file format, expected Netscape-like bookmarks file"); + request.setAttribute("errorMsgTech", e.getMessage()); + + String searchLine = request.getParameter("searchLine"); + if (searchLine == null) { + initHomePage(request, user); + request.getRequestDispatcher("home.jsp").forward(request, response); + } else { + actionSearch(request, user); + request.getRequestDispatcher("search.jsp").forward(request, response); + } + } } } } - redirectToTheGoodPage(request, response); } /* @param list NodeList list @@ -993,7 +1031,7 @@ } } if (isFolder == true) { // if we find a folder, we have to remove it - int index = tagList.size() - 1; + int index = tagList.size() - 1; if (index > -1) { tagList.remove(index); } @@ -1055,21 +1093,21 @@ protected void actionFullText(HttpServletRequest request, User user) throws IOException, ServletException { String fullText = request.getParameter("fullTextLine"); if (fullText == null || fullText.isEmpty()) { - actionSearch(request, user); + actionSearch(request, user); } else { - WikittyProxy proxy = BowProxy.getInstance(); - Criteria criteria = null; - if (fullText != null && !fullText.isEmpty()) { - criteria = Search.query().keyword(fullText). - eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria(). - addFacetField(Bookmark.FQ_FIELD_TAGS); - - } else { - criteria = getBookmarkListCriteriaByUser(user, null); - } - PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria); - BookmarkActions bookmarkActions = createBookmarkActions(request, result, null); - request.setAttribute("bookmarkActions", bookmarkActions); + WikittyProxy proxy = BowProxy.getInstance(); + Criteria criteria = null; + if (fullText != null && !fullText.isEmpty()) { + criteria = Search.query().keyword(fullText). + eq(Bookmark.FQ_FIELD_EMAIL, user.getEmail()).criteria(). + addFacetField(Bookmark.FQ_FIELD_TAGS); + + } else { + criteria = getBookmarkListCriteriaByUser(user, null); + } + PagedResult<Bookmark> result = proxy.findAllByCriteria(Bookmark.class, criteria); + BookmarkActions bookmarkActions = createBookmarkActions(request, result, null); + request.setAttribute("bookmarkActions", bookmarkActions); } } @@ -1117,7 +1155,7 @@ Preference preference = (Preference) session.getAttribute("preference"); // Retrieve Preference fields String colors = request.getParameter("colors"); - String tags = request.getParameter("tags"); + String tags = request.getParameter("tagsNb"); String bookmarks = request.getParameter("bookmarks"); String searchEngineSuggestions = request.getParameter("searchEngineUrlSuggestions"); String searchEngineResults = request.getParameter("searchEngineUrlResults"); @@ -1216,35 +1254,39 @@ protected void actionSendPassword(HttpServletRequest request, HttpServletResponse response) throws NoSuchAlgorithmException, AddressException, MessagingException, ServletException, IOException { String email = request.getParameter("email"); - if (email != null && !email.isEmpty()) { - WikittyProxy proxy = BowProxy.getInstance(); - Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, email).criteria(); - User user = proxy.findByCriteria(User.class, criteria); - if (user != null) { - boolean bool = true; - String password = ""; - String md5 = ""; - while (bool) { - password = RandomStringUtils.randomAlphanumeric(20); - md5 = StringUtil.encodeMD5(password); - bool = passwordExists(md5); - } - sendMail(email, password); - user.setPassword(md5); - proxy.store(user); - request.getRequestDispatcher("login.jsp").forward(request, response); + if (email != null) { + email = email.trim(); + if (!email.isEmpty()) { + WikittyProxy proxy = BowProxy.getInstance(); + Criteria criteria = Search.query().eq(User.FQ_FIELD_EMAIL, email).criteria(); + User user = proxy.findByCriteria(User.class, criteria); + if (user != null) { + boolean bool = true; + String password = ""; + String md5 = ""; + while (bool) { + password = RandomStringUtils.randomAlphanumeric(20); + md5 = StringUtil.encodeMD5(password); + bool = passwordExists(md5); + } + sendMail(email, password); + user.setPassword(md5); + proxy.store(user); + request.getRequestDispatcher("login.jsp").forward(request, response); + } else { + request.setAttribute("errorMsgUser", "This email address doesn't exist"); + } } else { - request.setAttribute("msgError", "This email doesn't exist..."); - request.getRequestDispatcher("forgotPassword.jsp").forward(request, response); + request.setAttribute("errorMsgUser", "Please enter an email address"); } - } else { - request.setAttribute("msgError", "Please enter an email"); - request.getRequestDispatcher("forgotPassword.jsp").forward(request, response); } + request.getRequestDispatcher("forgotPassword.jsp").forward(request, response); } protected void actionReIndexation(HttpServletRequest request, HttpSession session, User user) { - WikittyProxy proxy = BowProxy.getInstance(); - proxy.getWikittyService().syncEngin(proxy.getSecurityToken()); + if ((Boolean)session.getAttribute("admin") == true) { + WikittyProxy proxy = BowProxy.getInstance(); + proxy.getWikittyService().syncEngin(proxy.getSecurityToken()); + } } } Modified: trunk/src/main/webapp/admin.jsp =================================================================== --- trunk/src/main/webapp/admin.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/admin.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,64 +1,42 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> - <%@page import="org.chorem.bow.Preference" %> <%@page import="org.chorem.bow.User" %> <%@page import="org.chorem.bow.TokenActions" %> - <% - User user = (User) session.getAttribute("user"); - Preference preference = (Preference) session.getAttribute("preference"); - TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); - if (user != null && preference != null && tokenActions != null) { - String url = (String) request.getAttribute("bowUrl"); - String version = (String) request.getAttribute("version"); - String permanentToken = tokenActions.getPermanentToken(); - String check = preference.getColors(); - if (check == null) { - preference.setColors(""); - } - check = preference.getSearchEngineUrlResults(); - if (check == null) { - preference.setSearchEngineUrlResults(""); - } - check = preference.getSearchEngineUrlSuggestions(); - if (check == null) { - preference.setSearchEngineUrlSuggestions(""); - } -%> - -<html> - <head> - <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <meta name="description" content="Bookmark On the Web" /> - <title>Bow</title> - <link rel="stylesheet" type="text/css" href="./css/connexion.css" /> - </head> - - <body> - <div id="headback"> - <div id="head"> - <div id="headleft"> - <a class="logo" href="<%=url%>?action=home&token=<%=permanentToken%>">bow</a> - </div> - </div> - </div> - <div id="mainbodyback"> - <div id="mainbody"> - - <div id="content"> - <br /><br /> - <a href="bow?action=reIndexation">All data re-indexation</a> - <br /><br /> - <a href="bow?action=home">Return to the home page</a> - <br /><br /> - </div> - - </div> - <jsp:include page="footer.jsp" flush="true" > - <jsp:param name="bowUrl" value="<%=url%>" /> - <jsp:param name="version" value="<%=version%>" /> - </jsp:include> - </div> - </body> -</html> -<%}%> +User user = (User) session.getAttribute("user"); +Preference preference = (Preference) session.getAttribute("preference"); +TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); +Boolean admin = (Boolean) session.getAttribute("admin"); +if (user != null && preference != null && tokenActions != null && admin == true) { + String url = (String) request.getAttribute("bowUrl"); + String version = (String) request.getAttribute("version"); + String permanentToken = tokenActions.getPermanentToken(); + String check = preference.getColors(); + if (check == null) { + preference.setColors(""); + } + check = preference.getSearchEngineUrlResults(); + if (check == null) { + preference.setSearchEngineUrlResults(""); + } + check = preference.getSearchEngineUrlSuggestions(); + if (check == null) { + preference.setSearchEngineUrlSuggestions(""); + } + %> + <jsp:include page="header.jsp" flush="true"> + <jsp:param name="cssFile" value="connexion.css" /> + </jsp:include> + <div id="main"> + <jsp:include page="errorFrame.jsp" flush="true" /> + <div id="content"> + <div id="formFrame"> + <h1>Admin panel</h1> + <br /><br /> + <a href="bow?action=reIndexation">All data re-indexation</a> + <a href="bow?action=home" id="homePage">Return to the home page</a> + </div> + </div> + </div> + <jsp:include page="footer.jsp" flush="true" /> +<% } %> \ No newline at end of file Modified: trunk/src/main/webapp/bookmark.jsp =================================================================== --- trunk/src/main/webapp/bookmark.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/bookmark.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,3 +1,4 @@ +<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="org.chorem.bow.BowConfig" %> <%@page import="org.chorem.bow.Bookmark" %> <%@page import="java.text.SimpleDateFormat" %> Deleted: trunk/src/main/webapp/bookmarkContent.jsp =================================================================== --- trunk/src/main/webapp/bookmarkContent.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/bookmarkContent.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,109 +0,0 @@ -<div id="wrap"> - <div id="page"> - <div id="header"> - <a class="logo" href="<%=url%>?action=home&token=<%=permanentToken%>">bow</a> - </div> - - <div id="main"> - <% - if (searchLine != null) - { - %> - <%@ include file="bookmarkSearchMain.jsp"%> - <% - } - else - { - %> - <%@include file="bookmarkHomeMain.jsp"%> - <% - } - %> - </div> - <div id="logout"> - <form method="post" action="bow?action=logout"> - <div class="input"><input type="submit" value="Logout" /></div> - </form> - <a href="#" class="help">Aide</a> - </div> - <div id="side"> - <div id="colonneD"> - <ul class="droite"> - <% - if (admin == true) - { - %> - <li><a href="bow?action=admin">Admin</a></li> - <% - } - %> - <li><a href="bow?action=preferences">Preferences</a></li> - <li><a title="Add this link to your favourites to bookmark others in the future. This link is just available while you are connected on the site!" href="javascript:var%20url=location.href;var%20nameAndTags=prompt('Entrez%20le%20nom%20du%20lien%20et%20la%20liste%20des%20tags%20sous%20la%20forme:%20name|tag1%20tag2%20tag3',%20document.title+'|');if%20(nameAndTags!=(document.title+'|')){var%20link='<%=url%>bow?action=addUrl&token=<%=temporaryToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);}void(0);">Bookmark add link (session)</a></li> - <li><a title="Add this link to your favourites to bookmark others in the future. This link is always available!" href="javascript:var%20url=location.href;var%20nameAndTags=prompt('Entrez%20le%20nom%20du%20lien%20et%20la%20liste%20des%20tags%20sous%20la%20forme:%20name|tag1%20tag2%20tag3',%20document.title+'|');if%20(nameAndTags!=(document.title+'|')){var%20link='<%=url%>bow?action=addUrl&token=<%=permanentToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);}void(0);">Bookmark add link (permanent)</a></li> - </ul> - - <div id="add" class="clearfix"> - <h2>Add / Modify</h2> - <form id="bookmarkForm" method="post" action="<%=formAction%>"> - <div class="input"><label for="url">URL</label><input type="text" name="url" id="url" value="<%=formLink%>" /></div> - <div class="input"><label for="alias">ALIAS</label><input type="text" name="alias" id="alias" value="<%=formAlias%>" /></div> - <div class="input"><label for="name">DESC</label><input type="text" name="name" id="name" value="<%=formName%>" /></div> - <div class="input"><label for="tags">TAGS</label><input type="text" name="tags" id="tags" value="<%=formTags%>" /></div> - <div class="input"><input type="submit" value="Save" /></div> - </form> - </div> - - <div id="nuage"> - <% - if (searchLine != null) - { - %> - <jsp:include page="tagsCloud.jsp" flush="true"> - <jsp:param name="searchLine" value="<%=searchLine%>" /> - </jsp:include> - <% - } - else - { - %> - <jsp:include page="tagsCloud.jsp" flush="true" /> - <% - } - %> - </div> - <div class="recherche"> - <h2><label for="searchLine">Search</label></h2> - <form method="post" action="bow?action=search"> - <div class="input"> - <input type="text" name="searchLine" id="searchLine" /> - <input type="submit" value="Find" /> - </div> - </form> - </div> - <div class="recherche"> - <h2><label for="fullTextLine">Full text search</label></h2> - <form method="post" action="bow?action=fullText"> - <div class="input"> - <input type="text" name="fullTextLine" id="fullTextLine" value="<%=bookmarkActions.getFullTextLine()%>" /> - <input type="submit" value="Find" /> - </div> - </form> - </div> - <div id="import"> - <h2>Import Bookmarks</h2> - <form method="post" action="bow?action=importBookmarks" enctype="multipart/form-data"> - <div class="input"> - <input type="file" name="upfile" size="15%" /> - <br /> - <input type="submit" value="Import" /> - </div> - </form> - <a href="bow?action=exportBookmarks">Export bookmarks</a> - </div> - <div class="colonnebas"> - <img src="img/piedmenu.jpg" width="401" height="77" alt="Pied de menu" /> - </div> - </div> - </div> - </div> -</div> \ No newline at end of file Deleted: trunk/src/main/webapp/bookmarkHomeMain.jsp =================================================================== --- trunk/src/main/webapp/bookmarkHomeMain.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/bookmarkHomeMain.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,72 +0,0 @@ -<div class="menu clearfix"> - <p>The most used bookmarks</p> -</div> - -<div class="content"> - <% - int nbBookmarks = 10; - if (preference != null) - { - if (preference.getBookmarks() > 0) - nbBookmarks = preference.getBookmarks(); - } - SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - List<Bookmark> bookmarkList = bookmarkActions.getBookmarks(); - if (!bookmarkList.isEmpty()) - { - int count = 0; - for (Bookmark bookmark : bookmarkList) - { - request.setAttribute("bookmark", bookmark); - request.setAttribute("sdf", sdf); - %> - <jsp:include page="bookmark.jsp" flush="true" /> - <% - ++count; - if (count >= nbBookmarks) - { - break; - } - } - } - else - { - %> - <p class="nobookmarks">No Bookmarks</p> - <% - } - %> -</div> - -<div class="menu clearfix"> - <p>The last addition bookmarks</p> -</div> - -<div class="content"> - <% - List<Bookmark> lastBookmarks = bookmarkActions.getLastBookmarks(); - if (!lastBookmarks.isEmpty()) - { - int count = 0; - for (Bookmark bookmark : lastBookmarks) - { - request.setAttribute("bookmark", bookmark); - request.setAttribute("sdf", sdf); - %> - <jsp:include page="bookmark.jsp" flush="true" /> - <% - ++count; - if (count >= nbBookmarks) - { - break; - } - } - } - else - { - %> - <p class="nobookmarks">No Bookmarks</p> - <% - } - %> -</div> \ No newline at end of file Deleted: trunk/src/main/webapp/bookmarkPage.jsp =================================================================== --- trunk/src/main/webapp/bookmarkPage.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/bookmarkPage.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,52 +0,0 @@ -<%@page contentType="text/html" pageEncoding="UTF-8"%> -<%@page import="org.chorem.bow.BookmarkActions" %> -<%@page import="java.text.SimpleDateFormat" %> -<%@page import="java.util.Iterator" %> -<%@page import="java.util.Set" %> -<%@page import="java.util.ArrayList" %> -<%@page import="java.util.List" %> -<%@page import="org.chorem.bow.TokenActions" %> -<%@page import="org.nuiton.wikitty.FacetTopic" %> -<%@page import="org.chorem.bow.Bookmark" %> -<%@page import="org.chorem.bow.Preference" %> -<% -TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); -BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions"); -Boolean admin = (Boolean) session.getAttribute("admin"); -if (admin == null) -{ - admin = false; -} - -String temporaryToken = tokenActions.getTemporaryToken(); -String permanentToken = tokenActions.getPermanentToken(); -String url = (String) request.getAttribute("bowUrl"); -String version = (String) request.getAttribute("version"); -int nbTags = 100; -Preference preference = (Preference) session.getAttribute("preference"); -if (preference != null) -{ - int tags = preference.getTags(); - if (tags > 0) - nbTags = tags; -} -String searchLine = bookmarkActions.getSearchLine(); -String fullText = bookmarkActions.getFullTextLine(); -request.setAttribute("nbTags", nbTags); -String formLink = (String) request.getAttribute("link"); -String formName = (String) request.getAttribute("name"); -String formTags = (String) request.getAttribute("tags"); -String formAlias = (String) request.getAttribute("alias"); -String formAction = (String) request.getAttribute("action"); -if (formLink == null) - formLink = "URL"; -if (formName == null) - formName = "name"; -if (formTags == null) - formTags = "tag1 tag2..."; -if (formAlias == null) - formAlias = "alias"; -if (formAction == null) - formAction = "bow?action=addUrl"; -%> -<%@ include file="bookmarkContent.jsp"%> \ No newline at end of file Deleted: trunk/src/main/webapp/bookmarkSearchMain.jsp =================================================================== --- trunk/src/main/webapp/bookmarkSearchMain.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/bookmarkSearchMain.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,43 +0,0 @@ -<div class="menu clearfix"> - <p>Search</p> - <form method="post" action="bow?action=order&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>"> - <p> - <label for="type">Order By :</label> - <select id="type" name="type"> - <option value="ascName">Asc Name</option> - <option value="descName">Desc Name</option> - <option value="ascClick">Asc Click</option> - <option value="descClick">Desc Click</option> - <option value="ascDate">Asc Date</option> - <option value="descDate">Desc Date</option> - </select> - <input type="submit" value="OK" /> - </p> - </form> -</div> -<div class="content"> - <% - List<Bookmark> bookmarkList = bookmarkActions.getBookmarks(); - if (!bookmarkList.isEmpty()) - { - SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); - for (Bookmark bookmark : bookmarkList) - { - request.setAttribute("bookmark", bookmark); - request.setAttribute("sdf", sdf); - %> - <jsp:include page="bookmark.jsp" flush="true"> - <jsp:param name="searchLine" value="<%=searchLine%>" /> - <jsp:param name="fullTextLine" value="<%=fullText%>" /> - </jsp:include> - <% - } - } - else - { - %> - <p class="nobookmarks">No Bookmarks</p> - <% - } - %> -</div> \ No newline at end of file Modified: trunk/src/main/webapp/bookmarkTop.jsp =================================================================== --- trunk/src/main/webapp/bookmarkTop.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/bookmarkTop.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -36,7 +36,7 @@ request.setAttribute("nbTags", nbTags); String formLink = (String) request.getAttribute("link"); String formName = (String) request.getAttribute("name"); -String formTags = (String) request.getAttribute("tags"); +String formTags = (String) request.getAttribute("tagsNb"); String formAlias = (String) request.getAttribute("alias"); String formAction = (String) request.getAttribute("action"); Modified: trunk/src/main/webapp/css/bookmark.css =================================================================== --- trunk/src/main/webapp/css/bookmark.css 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/css/bookmark.css 2010-10-21 15:48:45 UTC (rev 118) @@ -1,38 +1,5 @@ @charset "utf-8"; -/*CSS Document*/ -*{ - padding:0; - margin:0; -} - -body{ - font-size:10px; - font-family:Verdana, Arial, Helvetica, sans-serif; -} - -.clearfix{ - height:1%; -} - -.clearfix:after{ - content:"."; - height:0; - line-height:0; - display:block; - visibility:hidden; - clear:both; -} - -#wrap{ - clear:both; - float:left; - overflow-x:hidden; - overflow-y:visible; - position:relative; - width:100%; - background-color:#9EDCF8; -} - +/* CSS Document */ #page{ background-color:#9EDCF8; float:left; @@ -64,37 +31,14 @@ } #main{ - float:left; margin-top:120px; - position:relative; + float:left; + position:relative; right:69%; width:59%; clear:both; } -#main .menu{ - width:90%; - height:35px; - background:#804561 url('/bow/img/pointemenu.jpg') no-repeat right; - margin-bottom:20px; - padding:0 40px; - line-height:35px; - clear: both; -} - -#main .menu p{ - color:#9edcf8; - font-size:18px; - font-weight:normal; - float:left; -} - -#main .menu form{ - float:right; - color:#9edcf8; - font-size:12px; -} - .content{ width:100%; float:left; @@ -224,7 +168,6 @@ #logout{ float:right; - height:auto; position:relative; right:67%; width:33%; @@ -359,7 +302,7 @@ width:86%; height:auto; display:block; - position:relative; + posit:relative; } #import .input input{ @@ -367,14 +310,69 @@ margin-bottom: 10px; } -#footer{ - background-color:#804561; - padding-top:30px; +.formFrame{ + width:365px; + height:315px; + background:url('/bow/img/fondconnexion.jpg') no-repeat; + position:relative; + margin-top: 20px; + margin-bottom: 20px; + margin-right: 100px; + margin-left: 100px; + padding-top: 10px; + padding-bottom: 10px; + padding-left: 40px; + padding-right: 70px; } -#footer p{ - color:#bf8a9c; - font-size:14px; - text-align:center; - line-height:50px; +.formFrame h1{ + color:#804561; + width:225px; + position:relative; + margin:20px auto; +} + +.formFrame p{ + color:#804561; + font-size:11px; + font-weight:bold; + padding:15px 0; +} + +.formFrame p input[type="text"], +.formFrame p input[type="password"]{ + width:225px; +} + +.formFrame input[type="submit"]{ + float: left; + margin-top:20px; + background:url('/bow/img/fdboutonV.jpg') repeat-x; + height:31px; + line-height:31px; + color:#FFFFFF; + font-weight:bold; + border:none; + width:auto; + padding: 2px; +} + +.formFrame p a{ + position: absolute; + color:#804561; + left:75px; + font-weight:bold; + font-size: 12px; + margin-top: 2px; +} + +.formFrame #homePage, +.formFrame #regenPermToken{ + bottom: 50px; + left: 185px; + font-size: 10px; +} + +.formFrame p input{ + margin-bottom: 2px; } \ No newline at end of file Modified: trunk/src/main/webapp/css/connexion.css =================================================================== --- trunk/src/main/webapp/css/connexion.css 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/css/connexion.css 2010-10-21 15:48:45 UTC (rev 118) @@ -1,49 +1,16 @@ @charset "utf-8"; /* CSS Document */ -*{ - padding:0; - margin:0; -} -.clearfix {height:1%} - -.clearfix:after { - - content:"."; - - height:0; - - line-height:0; - - display:block; - - visibility:hidden; - - clear:both; - -} -body{ - font-size:10px; - font-family:Verdana, Arial, Helvetica, sans-serif; -} -#headback{ - background:#FFFFFF url(/bow/img/fondhead.jpg) repeat-x; - width:auto; +#header{ + background:#FFFFFF url('/bow/img/fondhead.jpg') repeat-x; + width:100%; + float:left; height:100px; - -} -#head{ clear:both; - width:1004px; - height:100px; margin:0 auto; - position:relative; + position: relative; } -#headleft{ - width:740px; - float:left; - height:100px; -} -#headleft a.logo{ + +#header a.logo{ background:url(/bow/img/logobow.jpg); width:290px; height:100px; @@ -51,18 +18,23 @@ display:block; } -#mainbodyback{ - background-color:#9edcf8; - min-height:100px; -} -#mainbody{ +#main{ width:1004px; margin:0 auto; position:relative; clear:both; +} +#main .menu{ + margin-top: 25px; } +#page { + width:100%; + margin:0 auto; + clear:both; +} + #content{ width:1004px; position:relative; @@ -70,73 +42,67 @@ padding-top:20px; } -#contenu{ +#formFrame{ width:225px; height:315px; - background:url(/bow/img/fondconnexion.jpg) no-repeat; + background:url('/bow/img/fondconnexion.jpg') no-repeat; position:relative; margin:100px auto; padding:10px 70px; } -#contenu h1{ + +#formFrame h1{ color:#804561; width:225px; position:relative; margin:20px auto; } -#contenu form p{ + +#formFrame form p{ color:#804561; font-size:16px; font-weight:bold; padding:15px 0; } -#contenu form input{ + +#formFrame form input[type="text"], +#formFrame form input[type="password"]{ width:225px; } -#contenu form button { - float:right; - margin-top:20px; - background:url(/bow/img/fdboutonV.jpg) repeat-x; - height:31px; - line-height:31px; - color:#FFFFFF; + +#formFrame a{ + position: absolute; + color:#804561; + left:75px; font-weight:bold; - border:none; + font-size: 12px; } -#contenu .register{ - color:#804561; - position:absolute; +#formFrame #register{ bottom:50px; - left:75px; font-size:14px; - font-weight:bold; } -#contenu .forgot{ - color:#804561; - position:absolute; +#formFrame #forgotPwd{ bottom:100px; - left:75px; font-size:9px; - font-weight:bold; } -#contenu .error { - color: red; - position:absolute; - bottom: 10px; - font-size: 12px; +#formFrame #homePage{ + bottom: 50px; + left: 200px; + font-size: 10px; } -#footer{ - background-color:#804561; - height:50px; +input[type="submit"] { + float:right; + margin-top:20px; + background:url('/bow/img/fdboutonV.jpg') repeat-x; + height:31px; + line-height:31px; + color:#FFFFFF; + font-weight:bold; + border:none; width:auto; -} -#footer p{ - color:#bf8a9c; - font-size:14px; - text-align:center; - line-height:50px; + padding: 2px; } \ No newline at end of file Added: trunk/src/main/webapp/css/global.css =================================================================== --- trunk/src/main/webapp/css/global.css (rev 0) +++ trunk/src/main/webapp/css/global.css 2010-10-21 15:48:45 UTC (rev 118) @@ -0,0 +1,84 @@ +@charset "utf-8"; +/* CSS Document */ +*{ + padding:0; + margin:0; +} + +body{ + font-size:10px; + font-family:Verdana, Arial, Helvetica, sans-serif; +} + +.clearfix{ + height:1%; +} + +.clearfix:after{ + content:"."; + height:0; + line-height:0; + display:block; + visibility:hidden; + clear:both; +} + +#wrap{ + clear:both; + float:left; + overflow-x:hidden; + overflow-y:visible; + position:relative; + width:100%; + background-color:#9EDCF8; +} + +#main .menu{ + width:90%; + height:35px; + background:#804561 url('/bow/img/pointemenu.jpg') no-repeat right; + margin-bottom:15px; + padding:0 40px; + line-height:35px; + clear: both; +} + +#main div[class="menu clearfix"] h2{ + color:#9edcf8; + font-size:18px; + font-weight:normal; + float:left; +} + +#main .menu form{ + float:right; + color:#9edcf8; + font-size:12px; +} + +#import .input input{ + width: 90%; + margin-bottom: 10px; +} + +.error{ + float: left; + color:red; + font-size:medium; + background-color:white; + overflow:auto; + margin-bottom: 25px; + padding: 4px; +} + +#footer{ + background-color:#804561; + padding-top:30px; +} + +#footer p{ + color:#bf8a9c; + font-size:14px; + text-align:center; + line-height:50px; +} \ No newline at end of file Modified: trunk/src/main/webapp/error.jsp =================================================================== --- trunk/src/main/webapp/error.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/error.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,5 +1,12 @@ -<html> - <body> - <h1>ERROR !</h1> - </body> -</html> \ No newline at end of file +<%@page import="org.chorem.bow.TokenActions" %> +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<% + String techError = (String) request.getAttribute("errorMsgTech"); +%> +<jsp:include page="header.jsp" flush="true"> + <jsp:param name="cssFile" value="connexion.css" /> +</jsp:include> +<div id="main"> + <jsp:include page="errorFrame.jsp" flush="true" /> +</div> +<jsp:include page="footer.jsp" flush="true" /> \ No newline at end of file Added: trunk/src/main/webapp/errorFrame.jsp =================================================================== --- trunk/src/main/webapp/errorFrame.jsp (rev 0) +++ trunk/src/main/webapp/errorFrame.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -0,0 +1,12 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<% +String userError = (String) request.getAttribute("errorMsgUser"); +String techError = (String) request.getAttribute("errorMsgTech"); + +if (userError != null) { +%> + <div class="menu clearfix"> + <h2>Error</h2> + </div> + <pre class="error"><%=userError%><% if (techError != null) { %><br /><br />Detailed error :<br /><%=techError%><% } %></pre> +<% } %> \ No newline at end of file Modified: trunk/src/main/webapp/footer.jsp =================================================================== --- trunk/src/main/webapp/footer.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/footer.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,16 +1,20 @@ -<%@page contentType="text/html" pageEncoding="UTF-8"%> -<% -String url = (String) request.getAttribute("bowUrl"); -String version = (String) request.getAttribute("version"); -%> -<div id="footer"> - <p> - <a shape="rect" href="<%=url%>">bow</a> - <a shape="rect" href="http://www.chorem.org/projects/list_files/bow"><%=version%></a> - - <a shape="rect" href="http://www.gnu.org/licenses/agpl.html">Licence AGPL</a> - - <span title="Copyright">©2010</span> - <a shape="rect" href="http://www.codelutin.com">Code Lutin</a> - - <a shape="rect" href="http://www.chorem.org/projects/bow/issues">Rapport de bug</a> - - <a shape="rect" href="http://list.chorem.org/cgi-bin/mailman/listinfo/bow-users">Support utilisateur</a> - </p> -</div> \ No newline at end of file + <%@page contentType="text/html" pageEncoding="UTF-8"%> + <% + String url = (String) request.getAttribute("bowUrl"); + String version = (String) request.getAttribute("version"); + %> + </div> + </div> + <div id="footer"> + <p> + <a shape="rect" href="<%=url%>">bow</a> + <a shape="rect" href="http://www.chorem.org/projects/list_files/bow"><%=version%></a> - + <a shape="rect" href="http://www.gnu.org/licenses/agpl.html">Licence AGPL</a> - + <span title="Copyright">©2010</span> + <a shape="rect" href="http://www.codelutin.com">Code Lutin</a> - + <a shape="rect" href="http://www.chorem.org/projects/bow/issues">Rapport de bug</a> - + <a shape="rect" href="http://list.chorem.org/cgi-bin/mailman/listinfo/bow-users">Support utilisateur</a> + </p> + </div> + </body> +</html> \ No newline at end of file Modified: trunk/src/main/webapp/forgotPassword.jsp =================================================================== --- trunk/src/main/webapp/forgotPassword.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/forgotPassword.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,49 +1,23 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> -<% - String error = (String) request.getAttribute("msgError"); - String url = (String) request.getAttribute("bowUrl"); - String version = (String) request.getAttribute("version"); -%> - -<html> - <head> - <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <meta name="description" content="Bookmark On the Web" /> - <title>Bow</title> - <link rel="stylesheet" type="text/css" href="./css/connexion.css" /> - </head> - <body> - <div id="headback"> - <div id="head"> - <div id="headleft"> - <a class="logo" href="bow">bow</a> - </div> - </div> - </div> - <div id="mainbodyback"> - <div id="mainbody"> - - <div id="content"> - - <div id="contenu"> - <h1>Forgot Your Password?</h1> - <form method="POST" action="bow?action=sendPassword"> - <p>Email :</p> - <input type="text" name="email" /> - <button>Submit</button> - </form> - <%if (error != null) {%> - <p class="error"><%=error%></p> - <%}%> - <a href="bow" class="register">Login page</a> - </div> - </div> - - </div> - <jsp:include page="footer.jsp" flush="true" > - <jsp:param name="bowUrl" value="<%=url%>" /> - <jsp:param name="version" value="<%=version%>" /> - </jsp:include> - </div> - </body> -</html> \ No newline at end of file +<jsp:include page="header.jsp" flush="true"> + <jsp:param name="cssFile" value="connexion.css" /> +</jsp:include> +<div id="main"> + <jsp:include page="errorFrame.jsp" flush="true" /> + <div id="content"> + <div id="formFrame"> + <h1>Forgot Your Password?</h1> + <form method="post" action="bow?action=sendPassword"> + <p> + <label for="email">Email :</label> + <br /> + <br /> + <input type="text" name="email" id="email" /> + <input type="submit" value="Submit" /> + </p> + </form> + <a href="bow" class="register">Login page</a> + </div> + </div> +</div> +<jsp:include page="footer.jsp" flush="true" /> \ No newline at end of file Modified: trunk/src/main/webapp/header.jsp =================================================================== --- trunk/src/main/webapp/header.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/header.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,14 +1,24 @@ +<%@page import="org.chorem.bow.TokenActions" %> +<%@page contentType="text/html" pageEncoding="UTF-8"%> <% - String url = (String) request.getAttribute("bowUrl"); + String url = (String) request.getAttribute("bowUrl"); + TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); + String css = (String) request.getParameter("cssFile"); %> - +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <meta name="description" content="Bookmark On the Web" /> + <meta name="description" content="Bookmarks On the Web" /> <title>Bow</title> <link rel="search" type="application/opensearchdescription+xml" title="bowTemporarySearchEngine" href="<%=url%>?action=temporaryXml" /> <link rel="search" type="application/opensearchdescription+xml" title="bowPermanentSearchEngine" href="<%=url%>?action=permanentXml" /> - <link rel="stylesheet" type="text/css" href="./css/bookmark.css" /> + <link rel="stylesheet" type="text/css" href="./css/global.css" /> + <% + if (css != null) { + %> + <link rel="stylesheet" type="text/css" href="./css/<%=css%>" /> + <% } %> <script type="text/javascript"> <!-- function modify(name, alias, tags, link, action, id) { @@ -26,4 +36,10 @@ } //--> </script> -</head> \ No newline at end of file +</head> +<body> +<div id="wrap"> + <div id="page"> + <div id="header"> + <a class="logo" href="<%=url%><% if (tokenActions != null) { %>?action=home&token=<%=tokenActions.getPermanentToken()%><% } %>">bow</a> + </div> \ No newline at end of file Added: trunk/src/main/webapp/home.jsp =================================================================== --- trunk/src/main/webapp/home.jsp (rev 0) +++ trunk/src/main/webapp/home.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -0,0 +1,78 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@page import="org.chorem.bow.BookmarkActions" %> +<%@page import="org.chorem.bow.TokenActions" %> +<%@page import="org.chorem.bow.Bookmark" %> +<%@page import="org.chorem.bow.Preference" %> +<%@page import="java.util.List" %> +<%@page import="java.text.SimpleDateFormat" %> +<% +TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); +BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions"); +Preference preference = (Preference) session.getAttribute("preference"); + +if (tokenActions != null && bookmarkActions != null) { + %> + <jsp:include page="header.jsp" flush="true"> + <jsp:param name="cssFile" value="bookmark.css" /> + </jsp:include> + <div id="main"> + <jsp:include page="errorFrame.jsp" flush="true" /> + <div class="menu clearfix"> + <h2>The most used bookmarks</h2> + </div> + <div class="content"> + <% + int nbBookmarks = 10; + if (preference != null) { + if (preference.getBookmarks() > 0) + nbBookmarks = preference.getBookmarks(); + } + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + List<Bookmark> bookmarkList = bookmarkActions.getBookmarks(); + if (!bookmarkList.isEmpty()) { + int count = 0; + for (Bookmark bookmark : bookmarkList) { + request.setAttribute("bookmark", bookmark); + request.setAttribute("sdf", sdf); + %> + <jsp:include page="bookmark.jsp" flush="true" /> + <% + ++count; + if (count >= nbBookmarks) { + break; + } + } + } + else { %> + <p class="nobookmarks">No Bookmarks</p> + <% } %> + </div> + + <div class="menu clearfix"> + <h2>The last addition bookmarks</h2> + </div> + <div class="content"> + <% + List<Bookmark> lastBookmarks = bookmarkActions.getLastBookmarks(); + if (!lastBookmarks.isEmpty()) { + int count = 0; + for (Bookmark bookmark : lastBookmarks) { + request.setAttribute("bookmark", bookmark); + request.setAttribute("sdf", sdf); + %> + <jsp:include page="bookmark.jsp" flush="true" /> + <% + ++count; + if (count >= nbBookmarks) { + break; + } + } + } + else { %> + <p class="nobookmarks">No Bookmarks</p> + <% } %> + </div> + </div> + <jsp:include page="rightMenu.jsp" flush="true" /> + <jsp:include page="footer.jsp" flush="true" /> +<% } %> \ No newline at end of file Modified: trunk/src/main/webapp/login.jsp =================================================================== --- trunk/src/main/webapp/login.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/login.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,52 +1,26 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> -<% - String error = (String) request.getAttribute("msgError"); - String url = (String) request.getAttribute("bowUrl"); - String version = (String) request.getAttribute("version"); -%> - -<html> - <head> - <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <meta name="description" content="Bookmark On the Web" /> - <title>Bow</title> - <link rel="stylesheet" type="text/css" href="./css/connexion.css" /> - </head> - <body> - <div id="headback"> - <div id="head"> - <div id="headleft"> - <a class="logo" href="bow">bow</a> - </div> - </div> - </div> - <div id="mainbodyback"> - <div id="mainbody"> - - <div id="content"> - - <div id="contenu"> - <h1>Login</h1> - <form method="POST" action="bow?action=login" > - <p>Email :</p> - <input type="text" name="email" /> - <p>Password :</p> - <input type=password name="password" /> - <button type="submit">Login</button> - </form> - <%if (error != null) {%> - <p class="error"><%=error%></p> - <%}%> - <a href="bow?action=registration" class="register">Register</a> - <a href="bow?action=forgotPassword" class="forgot">Forgot Your Password?</a> - </div> - </div> - - </div> - <jsp:include page="footer.jsp" flush="true" > - <jsp:param name="bowUrl" value="<%=url%>" /> - <jsp:param name="version" value="<%=version%>" /> - </jsp:include> - </div> - </body> -</html> \ No newline at end of file +<jsp:include page="header.jsp" flush="true"> + <jsp:param name="cssFile" value="connexion.css" /> +</jsp:include> +<div id="main"> + <jsp:include page="errorFrame.jsp" flush="true" /> + <div id="content"> + <div id="formFrame"> + <h1>Login</h1> + <form method="post" action="bow?action=login"> + <p> + <label for="email">Email :</label> + <input type="text" name="email" id="email" /> + <br /><br /> + <label for="password">Password :</label> + <input type="password" name="password" id="password" /> + <br /><br /> + <input type="submit" value="Login" /> + </p> + </form> + <a href="bow?action=registration" id="register">Register</a> + <a href="bow?action=forgotPassword" id="forgotPwd">Forgot Your Password?</a> + </div> + </div> +</div> +<jsp:include page="footer.jsp" flush="true" /> \ No newline at end of file Deleted: trunk/src/main/webapp/main.jsp =================================================================== --- trunk/src/main/webapp/main.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/main.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,46 +0,0 @@ -<%@page contentType="text/html" pageEncoding="UTF-8"%> -<%@page import="org.chorem.bow.BookmarkActions" %> -<%@page import="org.chorem.bow.TokenActions" %> - -<% -TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); -BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions"); -if (tokenActions != null && bookmarkActions != null) -{ - String searchLine = bookmarkActions.getSearchLine(); - String url = (String) request.getAttribute("bowUrl"); - String version = (String) request.getAttribute("version"); - String formLink = (String) request.getAttribute("link"); - String formName = (String) request.getAttribute("name"); - String formBookmarkId = (String) request.getAttribute("bookmarkId"); - String formTags = (String) request.getAttribute("tags"); - String formAlias = (String) request.getAttribute("alias"); - String formAction = (String) request.getAttribute("action"); - %> - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - <html xmlns="http://www.w3.org/1999/xhtml"> - <jsp:include page="header.jsp" flush="true"> - <jsp:param name="bowUrl" value="<%=url%>"/> - </jsp:include> - <body> - <jsp:include page="bookmarkPage.jsp" flush="true"> - <jsp:param name="bookmarkActions" value="<%=tokenActions%>" /> - <jsp:param name="bookmarkActions" value="<%=bookmarkActions%>" /> - <jsp:param name="bowUrl" value="<%=url%>" /> - <jsp:param name="link" value="<%=formLink%>" /> - <jsp:param name="name" value="<%=formName%>" /> - <jsp:param name="bookmarkId" value="<%=formBookmarkId%>" /> - <jsp:param name="tags" value="<%=formTags%>" /> - <jsp:param name="alias" value="<%=formAlias%>" /> - <jsp:param name="action" value="<%=formAction%>" /> - <jsp:param name="version" value="<%=version%>" /> - </jsp:include> - <jsp:include page="footer.jsp" flush="true" > - <jsp:param name="bowUrl" value="<%=url%>" /> - <jsp:param name="version" value="<%=version%>" /> - </jsp:include> - </body> - </html> - <% -} -%> \ No newline at end of file Modified: trunk/src/main/webapp/preferences.jsp =================================================================== --- trunk/src/main/webapp/preferences.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/preferences.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,90 +1,86 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> -<%@page import="org.chorem.bow.Preference" %> -<%@page import="org.chorem.bow.User" %> -<%@page import="org.chorem.bow.TokenActions" %> - +<%@page import="org.chorem.bow.Preference"%> +<%@page import="org.chorem.bow.User"%> +<%@page import="org.chorem.bow.TokenActions"%> +<%@page import="org.chorem.bow.BookmarkActions"%> <% - User user = (User) session.getAttribute("user"); - Preference preference = (Preference) session.getAttribute("preference"); - TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); - if (user != null && preference != null && tokenActions != null) { - String url = (String) request.getAttribute("bowUrl"); - String version = (String) request.getAttribute("version"); - String permanentToken = tokenActions.getPermanentToken(); - String check = preference.getColors(); - if (check == null) { - preference.setColors(""); - } - check = preference.getSearchEngineUrlResults(); - if (check == null) { - preference.setSearchEngineUrlResults(""); - } - check = preference.getSearchEngineUrlSuggestions(); - if (check == null) { - preference.setSearchEngineUrlSuggestions(""); - } -%> +User user = (User) session.getAttribute("user"); +Preference preference = (Preference) session.getAttribute("preference"); +TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); +Boolean admin = (Boolean) session.getAttribute("admin"); +if (admin == null) { + admin = false; +} +int nbTags = 100; -<html> - <head> - <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <meta name="description" content="Bookmark On the Web" /> - <title>Bow</title> - <link rel="stylesheet" type="text/css" href="./css/connexion.css" /> - </head> - - <body> - <div id="headback"> - <div id="head"> - <div id="headleft"> - <a class="logo" href="<%=url%>?action=home&token=<%=permanentToken%>">bow</a> - </div> - </div> - </div> - <div id="mainbodyback"> - <div id="mainbody"> - - <div id="content"> - - <form method="POST" action="bow?action=changePreferences"> - - <h1>User Informations</h1> - <p>Email :</p> - <input type="text" name="email" value="<%=user.getEmail()%>"/> - <p>Current password :</p> - <input type=password name="currentPassword"/> - <p>New password :</p> - <input type=password name="newPassword"/> - <p>Confirm new password</p> - <input type=password name="confirmNewPassword"/> - <br/> <br /> - <a href="bow?action=generateToken">Regenerate permanent token</a> - - <br /> <br /> - - <h1>Site look</h1> - <p>Site color</p> - <input type="text" name="colors" value="<%=preference.getColors()%>"/> - <p>Tags number displays in the tag cloud</p> - <input type="text" name="tags" value="<%=preference.getTags()%>"/> - <p>Bookmarks number diplays in the home page</p> - <input type="text" name="bookmarks" value="<%=preference.getBookmarks()%>"/> - <p>Search Engine URL Suggestions</p> - <input type="text" name="searchEngineUrlSuggestions" value="<%=preference.getSearchEngineUrlSuggestions()%>"/> - <p>Search Engine URL Results</p> - <input type="text" name="searchEngineUrlResults" value="<%=preference.getSearchEngineUrlResults()%>"/> - - <button type="submit">Change</button> - </form> - <a href="bow?action=home">Return to the home page</a> - </div> - - </div> - <jsp:include page="footer.jsp" flush="true" > - <jsp:param name="bowUrl" value="<%=url%>" /> - <jsp:param name="version" value="<%=version%>" /> - </jsp:include> - </div> - </body> -</html> -<%}%> \ No newline at end of file +if (user != null && preference != null && tokenActions != null){ + int tags = preference.getTags(); + if (tags > 0) { + nbTags = tags; + } + request.setAttribute("nbTags", nbTags); + String url = (String) request.getAttribute("bowUrl"); + String version = (String) request.getAttribute("version"); + String temporaryToken = tokenActions.getTemporaryToken(); + String permanentToken = tokenActions.getPermanentToken(); + String check = preference.getColors(); + if (check == null) { + preference.setColors(""); + } + check = preference.getSearchEngineUrlResults(); + if (check == null) { + preference.setSearchEngineUrlResults(""); + } + check = preference.getSearchEngineUrlSuggestions(); + if (check == null) { + preference.setSearchEngineUrlSuggestions(""); + } + %> + <jsp:include page="header.jsp" flush="true"> + <jsp:param name="cssFile" value="bookmark.css" /> + </jsp:include> + <div id="main"> + <jsp:include page="errorFrame.jsp" flush="true" /> + <div id="content"> + <div class="menu clearfix"> + <h2>Preferences</h2> + </div> + <form method="post" action="bow?action=changePreferences"> + <div class="formFrame"> + <h3>User information</h3> + <p> + <label for="email">Email :</label><br /> + <input type="text" name="email" id="email" value="<%=user.getEmail()%>" /><br /><br /> + <label for="password">Current password :</label><br /> + <input type="password" id="password" name="currentPassword" /><br /><br /> + <label for="newPassword">New password :</label><br /> + <input type="password" id="newPassword" name="newPassword" /><br /><br /> + <label for="confirmNewPassword">Confirm new password :</label><br /> + <input type="password" id="confirmNewPassword" name="confirmNewPassword" /> + <a href="bow?action=generateToken" id="regenPermToken">Regenerate permanent token</a> + </p> + </div> + <div class="formFrame"> + <h3>Site look</h3> + <p> + <label for="colors">Site color</label><br /> + <input type="text" name="colors" id="colors" value="<%=preference.getColors()%>" /><br /> + <label for="tagsNb">Number of tags displayed in the tag cloud</label><br /> + <input type="text" name="tagsNb" id="tagsNb" value="<%=nbTags%>" /><br /> + <label for="bookmarks">Number of bookmarks displayed on the home page</label><br /> + <input type="text" name="bookmarks" id="bookmarks" value="<%=preference.getBookmarks()%>"/><br /> + <label for="searchEngineUrlSuggestions">Search Engine URL Suggestions</label><br /> + <input type="text" name="searchEngineUrlSuggestions" id="searchEngineUrlSuggestions" value="<%=preference.getSearchEngineUrlSuggestions()%>"/><br /> + <label for="searchEngineUrlResults">Search Engine URL Results</label><br /> + <input type="text" name="searchEngineUrlResults" id="searchEngineUrlResults" value="<%=preference.getSearchEngineUrlResults()%>"/><br /> + <input type="submit" value="Change" /> + <br /><br /> + <a href="bow?action=home" id="homePage">Return to the home page</a> + </p> + </div> + </form> + </div> + </div> + <jsp:include page="rightMenu.jsp" flush="true" /> + <jsp:include page="footer.jsp" flush="true" /> +<% } %> \ No newline at end of file Modified: trunk/src/main/webapp/register.jsp =================================================================== --- trunk/src/main/webapp/register.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/register.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,51 +1,25 @@ <%@page contentType="text/html" pageEncoding="UTF-8"%> -<% - String error = (String) request.getAttribute("msgError"); - String url = (String) request.getAttribute("bowUrl"); - String version = (String) request.getAttribute("version"); -%> - -<html> - <head> - <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> - <meta name="description" content="Bookmark On the Web" /> - <title>Bow</title> - <link rel="stylesheet" type="text/css" href="./css/connexion.css" /> - </head> - <body> - <div id="headback"> - <div id="head"> - <div id="headleft"> - <a class="logo" href="bow">bow</a> - </div> - </div> - </div> - <div id="mainbodyback"> - <div id="mainbody"> - - <div id="content"> - - <div id="contenu"> - <h1>Register</h1> - <form method="POST" action="bow?action=register" > - <p>Email :</p> - <input type="text" name="email" /> - <p>Password :</p> - <input type=password name="password" /> - <button>Register</button> - </form> - <%if (error != null) {%> - <p class="error"><%=error%></p> - <%}%> - <a href="bow" class="register">Login page</a> - </div> - </div> - - </div> - <jsp:include page="footer.jsp" flush="true" > - <jsp:param name="bowUrl" value="<%=url%>" /> - <jsp:param name="version" value="<%=version%>" /> - </jsp:include> - </div> - </body> -</html> \ No newline at end of file +<jsp:include page="header.jsp" flush="true"> + <jsp:param name="cssFile" value="connexion.css" /> +</jsp:include> +<div id="main"> + <jsp:include page="errorFrame.jsp" flush="true" /> + <div id="content"> + <div id="formFrame"> + <h1>Register</h1> + <form method="post" action="bow?action=register"> + <p> + <label for="email">Email :</label> + <input type="text" name="email" id="email" /> + <br /><br /> + <label for="password">Password :</label> + <input type="password" name="password" id="password" /> + <br /><br /> + <input type="submit" value="Register" /> + </p> + </form> + <a href="bow" id="register">Login page</a> + </div> + </div> +</div> +<jsp:include page="footer.jsp" flush="true" /> \ No newline at end of file Added: trunk/src/main/webapp/rightMenu.jsp =================================================================== --- trunk/src/main/webapp/rightMenu.jsp (rev 0) +++ trunk/src/main/webapp/rightMenu.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -0,0 +1,128 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@page import="org.chorem.bow.BookmarkActions" %> +<%@page import="java.text.SimpleDateFormat" %> +<%@page import="java.util.Iterator" %> +<%@page import="java.util.Set" %> +<%@page import="java.util.ArrayList" %> +<%@page import="java.util.List" %> +<%@page import="org.chorem.bow.TokenActions" %> +<%@page import="org.nuiton.wikitty.FacetTopic" %> +<%@page import="org.chorem.bow.Bookmark" %> +<%@page import="org.chorem.bow.Preference" %> +<% +TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); +BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions"); +Boolean admin = (Boolean) session.getAttribute("admin"); +if (admin == null) { + admin = false; +} + +String temporaryToken = tokenActions.getTemporaryToken(); +String permanentToken = tokenActions.getPermanentToken(); +String url = (String) request.getAttribute("bowUrl"); +int nbTags = 100; +Preference preference = (Preference) session.getAttribute("preference"); +if (preference != null) { + int tags = preference.getTags(); + if (tags > 0) + nbTags = tags; +} +request.setAttribute("nbTags", nbTags); +String searchLine = null; +String fullText = null; +if (bookmarkActions != null){ + searchLine = bookmarkActions.getSearchLine(); + fullText = bookmarkActions.getFullTextLine(); +} +String formLink = (String) request.getAttribute("link"); +String formName = (String) request.getAttribute("name"); +String formTags = (String) request.getAttribute("tags"); +String formAlias = (String) request.getAttribute("alias"); +String formAction = (String) request.getAttribute("action"); +if (formLink == null) + formLink = "URL"; +if (formName == null) + formName = "name"; +if (formTags == null) + formTags = "tag1 tag2..."; +if (formAlias == null) + formAlias = "alias"; +if (formAction == null) + formAction = "bow?action=addUrl"; +%> +<div id="logout"> + <form method="post" action="bow?action=logout"> + <div class="input"> + <input type="submit" value="Logout" /> + </div> + </form> + <a href="#" class="help">Aide</a> +</div> +<div id="side"> + <div id="colonneD"> + <ul class="droite"> + <% if (admin == true) { %> + <li><a href="bow?action=admin">Admin</a></li> + <% } %> + <li><a href="bow?action=preferences">Preferences</a></li> + <li><a title="Add this link to your favourites to bookmark others in the future. This link is just available while you are connected on the site!" href="javascript:var%20url=location.href;var%20nameAndTags=prompt('Entrez%20le%20nom%20du%20lien%20et%20la%20liste%20des%20tags%20sous%20la%20forme:%20name|tag1%20tag2%20tag3',%20document.title+'|');if%20(nameAndTags!=(document.title+'|')){var%20link='<%=url%>?action=addUrl&token=<%=temporaryToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);}void(0);">Bookmark add link (session)</a></li> + <li><a title="Add this link to your favourites to bookmark others in the future. This link is always available!" href="javascript:var%20url=location.href;var%20nameAndTags=prompt('Entrez%20le%20nom%20du%20lien%20et%20la%20liste%20des%20tags%20sous%20la%20forme:%20name|tag1%20tag2%20tag3',%20document.title+'|');if%20(nameAndTags!=(document.title+'|')){var%20link='<%=url%>?action=addUrl&token=<%=permanentToken%>&url='+encodeURIComponent(url)+'&nameAndTags='+encodeURIComponent(nameAndTags);var%20script=document.createElement('script');script.src=link;script.type='text/javascript';document.body.appendChild(script);}void(0);">Bookmark add link (permanent)</a></li> + </ul> + + <div id="add" class="clearfix"> + <h2>Add / Modify</h2> + <form id="bookmarkForm" method="post" action="<%=formAction%>"> + <div class="input"><label for="url">URL</label><input type="text" name="url" id="url" value="<%=formLink%>" /></div> + <div class="input"><label for="alias">ALIAS</label><input type="text" name="alias" id="alias" value="<%=formAlias%>" /></div> + <div class="input"><label for="name">DESC</label><input type="text" name="name" id="name" value="<%=formName%>" /></div> + <div class="input"><label for="tags">TAGS</label><input type="text" name="tags" id="tags" value="<%=formTags%>" /></div> + <div class="input"><input type="submit" value="Save" /></div> + </form> + </div> + + <div id="nuage"> + <% if (searchLine != null) { %> + <jsp:include page="tagsCloud.jsp" flush="true"> + <jsp:param name="searchLine" value="<%=searchLine%>" /> + </jsp:include> + <% } else { %> + <jsp:include page="tagsCloud.jsp" flush="true" /> + <% } %> + </div> + <div class="recherche"> + <h2><label for="searchLine">Search</label></h2> + <form method="post" action="bow?action=search"> + <div class="input"> + <input type="text" name="searchLine" id="searchLine" /> + <input type="submit" value="Find" /> + </div> + </form> + </div> + <div class="recherche"> + <h2><label for="fullTextLine">Full text search</label></h2> + <form method="post" action="bow?action=fullText"> + <div class="input"> + <% if (fullText != null) { %> + <input type="text" name="fullTextLine" id="fullTextLine" value="<%=fullText%>" /> + <% } else { %> + <input type="text" name="fullTextLine" id="fullTextLine" /> + <% } %> + <input type="submit" value="Find" /> + </div> + </form> + </div> + <div id="import"> + <h2>Import Bookmarks</h2> + <form method="post" action="bow?action=importBookmarks" enctype="multipart/form-data"> + <div class="input"> + <input type="file" name="upfile" size="15%" /><br /> + <input type="submit" value="Import" /> + </div> + </form> + <a href="bow?action=exportBookmarks">Export bookmarks</a> + </div> + <div class="colonnebas"> + <img src="img/piedmenu.jpg" width="401" height="77" alt="Pied de menu" /> + </div> + </div> +</div> \ No newline at end of file Added: trunk/src/main/webapp/search.jsp =================================================================== --- trunk/src/main/webapp/search.jsp (rev 0) +++ trunk/src/main/webapp/search.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -0,0 +1,62 @@ +<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@page import="org.chorem.bow.BookmarkActions" %> +<%@page import="org.chorem.bow.TokenActions" %> +<%@page import="org.chorem.bow.Bookmark" %> +<%@page import="org.chorem.bow.Preference" %> +<%@page import="java.text.SimpleDateFormat" %> +<%@page import="java.util.List" %> +<% +TokenActions tokenActions = (TokenActions) session.getAttribute("tokenActions"); +BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions"); +Preference preference = (Preference) session.getAttribute("preference"); +String searchLine = bookmarkActions.getSearchLine(); +String fullText = bookmarkActions.getFullTextLine(); + +if (tokenActions != null && bookmarkActions != null) { + %> + <jsp:include page="header.jsp" flush="true"> + <jsp:param name="cssFile" value="bookmark.css" /> + </jsp:include> + <div id="main"> + <jsp:include page="errorFrame.jsp" flush="true" /> + <div class="menu clearfix"> + <h2>Search</h2> + <form method="post" action="bow?action=order&searchLine=<%=searchLine%>&fullTextLine=<%=fullText%>"> + <p> + <label for="type">Order By :</label> + <select id="type" name="type"> + <option value="ascName">Asc Name</option> + <option value="descName">Desc Name</option> + <option value="ascClick">Asc Click</option> + <option value="descClick">Desc Click</option> + <option value="ascDate">Asc Date</option> + <option value="descDate">Desc Date</option> + </select> + <input type="submit" value="OK" /> + </p> + </form> + </div> + <div class="content"> + <% + List<Bookmark> bookmarkList = bookmarkActions.getBookmarks(); + if (!bookmarkList.isEmpty()) { + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + for (Bookmark bookmark : bookmarkList) { + request.setAttribute("bookmark", bookmark); + request.setAttribute("sdf", sdf); + %> + <jsp:include page="bookmark.jsp" flush="true"> + <jsp:param name="searchLine" value="<%=searchLine%>" /> + <jsp:param name="fullTextLine" value="<%=fullText%>" /> + </jsp:include> + <% + } + } + else { %> + <p class="nobookmarks">No Bookmarks</p> + <% } %> + </div> + </div> + <jsp:include page="rightMenu.jsp" flush="true" /> + <jsp:include page="footer.jsp" flush="true" /> +<% } %> \ No newline at end of file Modified: trunk/src/main/webapp/tagsCloud.jsp =================================================================== --- trunk/src/main/webapp/tagsCloud.jsp 2010-10-17 01:55:42 UTC (rev 117) +++ trunk/src/main/webapp/tagsCloud.jsp 2010-10-21 15:48:45 UTC (rev 118) @@ -1,29 +1,28 @@ <%@page import="org.chorem.bow.BookmarkActions" %> <%@page import="java.util.List" %> <%@page import="org.nuiton.wikitty.FacetTopic" %> - <% - BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions"); - int nbTags = (Integer) request.getAttribute("nbTags"); - String search = ""; - String searchLine = request.getParameter("searchLine"); - if (searchLine != null) { - search += "&searchLine=" + searchLine; - } - if (bookmarkActions != null) { - List<FacetTopic> tagCloud = bookmarkActions.getTagsCloud(); - int count = 0; - for (FacetTopic tag : tagCloud) { - int value = tag.getCount(); - String tagName = tag.getTopicName(); - int font = bookmarkActions.getFont(value); -%> -<a href="bow?action=search&addTag=<%=tagName%><%=search%>" title="<%=value%> results" class="tag" style="font-size: <%=font%>px;"><%=tagName%></a> -<% - ++count; - if (count >= nbTags) { - break; - } - } - } +BookmarkActions bookmarkActions = (BookmarkActions) request.getAttribute("bookmarkActions"); +int nbTags = (Integer) request.getAttribute("nbTags"); +String search = ""; +String searchLine = request.getParameter("searchLine"); +if (searchLine != null) { + search += "&searchLine=" + searchLine; +} +if (bookmarkActions != null) { + List<FacetTopic> tagCloud = bookmarkActions.getTagsCloud(); + int count = 0; + for (FacetTopic tag : tagCloud) { + int value = tag.getCount(); + String tagName = tag.getTopicName(); + int font = bookmarkActions.getFont(value); + %> + <a href="bow?action=search&addTag=<%=tagName%><%=search%>" title="<%=value%> results" class="tag" style="font-size: <%=font%>px;"><%=tagName%></a> + <% + ++count; + if (count >= nbTags) { + break; + } + } +} %> \ No newline at end of file
Le Thu, 21 Oct 2010 17:48:45 +0200 (CEST), vbriand@users.chorem.org a écrit :
+++ trunk/src/main/java/org/chorem/bow/ControllerServlet.java 2010-10-21 15:48:45 UTC (rev 118) ... @@ -248,7 +249,11 @@ ... if ((Boolean)session.getAttribute("admin") == true) {
Qu'est ce que c'est que ce prédicat saugrenu ?!?!? Je te propose : if (new Boolean((Boolean) session.getAttribute("admin")) == true ? true : false) Bon ok je sors... -- Florian Desbois <fdesbois@codelutin.com> SSLL Code Lutin http://www.codelutin.com tel : 02 40 50 29 28 Réseau Libre-Entreprise
participants (2)
-
fdesbois -
vbriand@users.chorem.org