Versions Compared

Key

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

...

  • You need one icon for "viewed" records (image/viewed.gif). Something looking like a tick mark in a colored circle.
  • You need another one for unticked (but tickable). Something like an empty colored circle

For the developpers:

in the PostgreSQL database:

A new database table must be added:

  • Examples are attached for testing but I ask you to use your own.

In Messages.properties, you add:

jsp.display-item.bookmark = Record My Tags
jsp.mydspace.bookmarks.info1                                    = Your tags have been updated.
jsp.mydspace.bookmarks.info2                                    = To tag an item, visit the item's page, put in Tag terms separated by ";" and click on the "My Tags" button.
jsp.mydspace.bookmarks.info3                                    = Below are the items tagged
jsp.mydspace.bookmarks.info4                                    = You have not tagged any items.
jsp.mydspace.bookmarks.theirs                                   = Their Tags
jsp.mydspace.bookmarks.title                                    = Tags
jsp.mydspace.bookmarks.yours                                    = Your Tags
jsp.mydspace.main.bookmarks.link                                = Click on one of your Tags:
jsp.layout.navbar-default.tags = Tags

For the developpers:

in the PostgreSQL database:

A new database table must be added:

Panel

CREATE SEQUENCE bookmark_seq
  INCREMENT 1
  MINVALUE 1
  MAXVALUE 9223372036854775807
  START 1
  CACHE 1;
ALTER TABLE bookmark_seq OWNER TO <<<Put here the right PostgreSQL user as the table owner>>>;

CREATE TABLE bookmark
(
  bookmark_id integer NOT NULL DEFAULT nextval('bookmark_seq'::regclass),
  eperson_id integer,
  item_id integer,
  tag_value character varying(128),
  CONSTRAINT bookmark_pkey PRIMARY KEY (bookmark_id),
  CONSTRAINT bookmark_eperson_id_fkey FOREIGN KEY (eperson_id)
      REFERENCES eperson (eperson

Panel

CREATE SEQUENCE bookmark_seq
  INCREMENT 1
  MINVALUE 1
  MAXVALUE 9223372036854775807
  START 1
  CACHE 1;
ALTER TABLE bookmark_seq OWNER TO <<<Put here the right PostgreSQL user as the table owner>>>;

CREATE TABLE bookmark
(
  bookmark_id integer NOT NULL DEFAULT nextval('bookmark_seq'::regclass),
  eperson_id integer,
  item_id integer,
  tag_value character varying(128),
  CONSTRAINT bookmark_pkey PRIMARY KEY (bookmark_id),
  CONSTRAINT bookmark_eperson_id_fkey FOREIGN KEY (eperson_id)
      REFERENCES eperson (eperson_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT bookmark_item_id_fkey FOREIGN KEY (item_id)
      REFERENCES item (item_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT bookmark_item_id_fkey FOREIGN KEY (item_id)
WITH (OIDS=FALSE       REFERENCES item (item_id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS=FALSE);
ALTER TABLE bookmark OWNER TO <<<Put here the right PostgreSQL user as the table owner>>>;
CREATE INDEX bookmark_idx1
  ON bookmark
  USING btree
  (eperson_id);
CREATE INDEX bookmark_idx2
  ON bookmark
  USING btree
  (item_id);
CREATE INDEX bookmark_idx3
  ON bookmark
  USING btree
  (md5(tag_value::text));

...

At the beginning of "getThumbMarkup", you can add the display of the "viewed" tag in search result lists:tag in search result lists:

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");
No Format

    /* generate the (X)HTML required to show the thumbnail */
    private String getThumbMarkup(HttpServletRequest hrq, Context c, Item item, LinkOut aLinkOut, String suffix)
            throwsString JspException
htmlVu    {= ConfigurationManager.getProperty("webui.itemlist.viewed");
        String handlehtmlNotVu = itemConfigurationManager.getHandle(getProperty("webui.itemlist.notviewed");
        Bundle[]String originalvu = null"";

        StringEPerson tageperson = ""c.getCurrentUser();
        Stringif tagVu(eperson != ConfigurationManager.getProperty("webui.itemlist.tagviewed");
null) {
          String htmlVutag = ConfigurationManagerBookmarkManager.getProperty("webui.itemlist.viewed"getBookmarkTag(c,eperson,item);
         String htmlNotVu = ConfigurationManager.getProperty("webui.itemlist.notviewed");
        String vu = "";

  if (tag != null && (!"".equals(tag))) {
              EPersonif eperson( = ctag.getCurrentUserstartsWith(tagVu+";");
 || (tag.indexOf(";      if (eperson != null) {
"+tagVu+";")>=0) )
                tagvu = BookmarkManageraLinkOut.getBookmarkTag(c,eperson,itemmainSubstitutions(htmlVu);
              tag = if (tag != null && (!"".equals(tag))) {
   " "+UIUtil.addLinksURL(hrq.getContextPath()+"/bookmark?tag=",";",tag);
           }
           if ( tag"".startsWith(tagVu+";") || (tag.indexOf("; "+tagVu+";")>=0) )
equals(vu)) vu = aLinkOut.mainSubstitutions(htmlNotVu);
        }

        Collection vucolls[] = aLinkOut.mainSubstitutions(htmlVu);
null;
        try
        {
        tag	original = " "+UIUtil.addLinksURL(hrq.getContextPath()+"/bookmark?tag=",";",tag);
item.getBundles("ORIGINAL");
               } colls = item.getCollections();
        }
    if ("".equals(vu)) vu = aLinkOut.mainSubstitutions(htmlNotVu);catch(SQLException sqle)
        }
{
        Collection colls[] = null	throw new JspException(sqle.getMessage());
        try
        {
        	original = item.getBundles("ORIGINAL"); }
...

in Java Server Pages (JSP):

New JSPs (attached to this page):

  • mydspace/listtags.jsp
  • mydspace/bookmarks.jsp

Modified JSPs:

in navbar-default.jsp
Code Block

 ... You can add where you want the option of listing tags of everybody:
  <tr class="navigationBarItem">
    <td>
      <img      colls = item.getCollections();
        }
        catch(SQLException sqle)
        {alt="" src="<%= request.getContextPath() %>/image/<%= ( currentPage.endsWith( "/browse-tags" ) ? "arrow-highlight" : "arrow" ) %>.gif" width="16" height="16"/>
    </td>
    <td nowrap="nowrap" class="navigationBarItem">
      <a  	throw new JspException(sqle.getMessage());href="<%= request.getContextPath() %>/browse-tags"><fmt:message key="jsp.layout.navbar-default.tags"/></a>
    </td>
    }
...

in Java Server Pages (JSP):

New JSPs (attached to this page):

  • mydspace/listtags.jsp
  • mydspace/bookmarks.jsp

...

</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>

...