Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
    /* generate the (X)HTML required to show the thumbnail */
    private String getThumbMarkup(HttpServletRequest hrq, Context c, Item item, LinkOut aLinkOut, String suffix)
            throws JspException
    {
        String handle = item.getHandle();
        Bundle[] original = null;
        String tag = "";
        String tagVu = ConfigurationManager.getProperty("webui.itemlist.tagviewed");
        String htmlVu = ConfigurationManager.getProperty("webui.itemlist.viewed");
        String htmlNotVu = ConfigurationManager.getProperty("webui.itemlist.notviewed");
        String vu = "";

        EPerson eperson = c.getCurrentUser();
        if (eperson != null) {
           tag = BookmarkManager.getBookmarkTag(c,eperson,item);
           if (tag != null && (!"".equals(tag))) {
              if ( tag.startsWith(tagVu+";") || (tag.indexOf("; "+tagVu+";")>=0) )
                vu = aLinkOut.mainSubstitutions(htmlVu);
              tag = " "+UIUtil.addLinksURL(hrq.getContextPath()+"/bookmark?tag=",";",tag);
           }
           if ("".equals(vu)) vu = aLinkOut.mainSubstitutions(htmlNotVu);
        }

        Collection colls[] = null;
        try
        {
        	original = item.getBundles("ORIGINAL");
                colls = item.getCollections();
        }
        catch(SQLException sqle)
        {
        	throw new JspException(sqle.getMessage());
        }
...

...

in navbar-default.jsp
Code Block
 ... You can add where you want the option of listing tags of everybody:
  <tr class="navigationBarItem">
    <td>
      <img alt="" src="<%= request.getContextPath() %>/image/<%= ( currentPage.endsWith( "/browse-tags" ) ? "arrow-highlight" : "arrow" ) %>.gif" width="16" height="16"/>
    </td>
    <td nowrap="nowrap" class="navigationBarItem">
      <a href="<%= request.getContextPath() %>/browse-tags"><fmt:message key="jsp.layout.navbar-default.tags"/></a>
    </td>
  </tr>
in display-item.jsp:
Code Block
 ... Imports...
<%@ page import="org.dspace.eperson.BookmarkManager" %>
... Initialization...
    // Show Bookmark or Unbookmark button?
    String bookmarked = "";
	// Marked as viewed?
    boolean vu = false;
    if (currentUser != null) {
        bookmarked = BookmarkManager.getBookmarkTag(context, currentUser, item);
        if (bookmarked != null && (!"".equals(bookmarked))) {
              if ( bookmarked.startsWith("v;") || (bookmarked.indexOf("; v;")>=0) )
                vu = true;
        }
    }
    String otherBookmark = BookmarkManager.getBookmarkOtherTag(context, currentUser, item);
... Where you want to display "ticked" records:
<%
    if (currentUser != null) {
      if (vu) {
%>
		<a href="<%= locationLink %>?bookmarkremoved=v"><img src="<%= request.getContextPath() %>/image/viewed.gif" border="0"/></a>
<%
	  } else {
%>
		<a href="<%= locationLink %>?bookmarkadded=v"><img src="<%= request.getContextPath() %>/image/notviewed.gif" border="0"/></a>
<%
	  }
%>
... Where you want to display current tags:
<%
    if (bookmarked != null && (! "".equals(bookmarked))) { %>
      <b style="color:Orange;"><fmt:message key="jsp.mydspace.bookmarks.yours"/>: <%=UIUtil.addLinksURL(request.getContextPath()+"/bookmark?tag=",";",bookmarked)%></b>
<%  }
    if (otherBookmark != null && (! "".equals(otherBookmark))) { %>
      <fmt:message key="jsp.mydspace.bookmarks.theirs"/>: <%=UIUtil.addLinksURL(request.getContextPath()+"/bookmark?allusers=on&tag=",";",otherBookmark)%>
<%  } %>
... Where you want to edit current tags:
	<form method="get" action="<%= locationLink %>" style="display:inline;">
        <fmt:message key="jsp.mydspace.bookmarks.yours"/>: <input size=20 name="bookmarked" value="<%=bookmarked%>" />
        <input type="submit" name="Bookmark-Flag" value="<fmt:message key="jsp.display-item.bookmark"/>"/>
<% if (otherBookmark != null && (!"".equals(otherBookmark))) { %>
        <br/><fmt:message key="jsp.mydspace.bookmarks.theirs"/>: <%=otherBookmark%>
<% } %>
        </form>

...

Code Block
... Imports...
<%@ page import="org.dspace.eperson.BookmarkManager" %>
... Initialization...
    Context context = UIUtil.obtainContext(request);
    Map taglist = null;
    if (user != null) taglist = BookmarkManager.getBookmarkTags(context,user);
%>
... Display:
 <%
if (taglist != null) {
%>
    <li><a href="<%= request.getContextPath() %>/bookmark"><fmt:message key="jsp.mydspace.main.bookmarks.link"/></a>
    <ul>
<%
        Iterator curTag = taglist.keySet().iterator();
        while (curTag.hasNext())
        {
          String aTag = (String) curTag.next();
          Integer aFreq = (Integer) taglist.get(aTag);
        %><li><a href="<%= request.getContextPath() %>/bookmark?tag=<%= aTag %>"><%=aTag%> (<%=aFreq.intValue()%>)</a></li><%
        }
%>  </ul></li>
<%
}
%>

in WEB-INF/web.xml:

You must add the definitions for the two new servlets (tagging servlet and tags list servlet):

...