[ http://jira.dspace.org/jira/browse/DS-587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11634#action_11634 ]
Jose Blanco commented on DS-587: -------------------------------- I'm resubmitting my patch addressing Claudia's comments. I've included here the changes I made to make this tombstone work at our instance in the jspui webapp.. These are the files that were changed to make this work: You will need to create a new dc field to hold the withdraw reason: description.withdrawalreason. Items that are tombstoned are basically items that are withdrawn and a reason for their withdraw is supplied. This patch contains 3 reasons for withdraw and they are used in the file confirm-withdraw-item.jsp. M jsp/WEB-INF/dspace-tags.tld The '>' indicates what was added. <tag> <name>item</name> <tagclass>org.dspace.app.webui.jsptag.ItemTag</tagclass> <info> Tag for displaying an item. "item" must always be an org.dspace.content.Item. "style" should be "default" or "full", or can be omitted to use "default". "collections" should be the array of collections the item is in, worked out beforehand to avoid the chance of an error occurring during display. If collections is null, the collections the item is in aren't listed. </info> <attribute> <name>item</name> <required>true</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>style</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> <attribute> <name>collections</name> <required>false</required> <rtexprvalue>true</rtexprvalue> </attribute> > <attribute> > <name>tombstone</name> > <required>false</required> > <rtexprvalue>true</rtexprvalue> > </attribute> </tag> M jsp/local/tombstone.jsp This file was changed completely it looks more like display-itme.jsp. So I have included it here in its entirity. ? jsp/local/embargo.jsp This is a new file to display when an item is in embargo, rather than just withdrawn. Every time an item is withdrawn a reason must be supplied. Presently there are 3 reasons to pick from. This reason is displayed above the file display. M src/org/dspace/app/webui/jsptag/ItemTag.java - Most all of these changes in this file took place in the routine listBitstream. II would have liked to send a diff of the file, but there are so many other changes not regarding tombstone that it would be too complicated to understand so I will list the changes here: (1) Include this in on the top of the file in the declaritive part. /** The style to use - "default" or "full" */ private boolean tombstone; (2) Add these two methods: public boolean getTombstone() { return tombstone; } public void setTombstone(boolean tombstoneIn) { tombstone = tombstoneIn; } (3) Make the release() method look like this public void release() { style = "default"; item = null; collections = null; tombstone = false; } (4) The rest of the changes are in ListBistream, but since I have made so many changes to this method, it is almost impossible to do a difference, so here are is what basically needs to be done: if (bunds[0] != null) { Bitstream[] bits = bunds[0].getBitstreams(); for (int i = 0; (i < bits.length) && !html; i++) { if (bits[i].getID() == bunds[0].getPrimaryBitstreamID()) { html = bits[i].getFormat().getMIMEType().equals( "text/html"); primaryBitstream = bits[i]; } } } ==>new if ( tombstone ) ==>new { ==>new DCValue[] values = item.getDC("description", "withdrawalreason", Item.ANY); ==>new String withdrawReason = null; ==>new if (values.length >= 0 ) ==>new { ==>new withdrawReason = values[0].value; ==>new } ==>new else ==>new { ==>new withdrawReason = "Withdraw Reason not available"; ==>new } ==>new out.println("<table cellspacing=\"1\" cellpadding=\"1\" width=\"100%\" class=\"itemBundleTable\"><tr><th class=\"standard\">" + withdrawReason + "</th></tr></table>"); ==>new } AND out.print("</td><td headers=\"t4\" class=\"standard\">"); out.print(primaryBitstream.getFormatDescription()); ==>new if ( tombstone ) ==>new { ==>new out.print("</td><td class=\"standard\">" ==>new + "file is not available" ==>new + "</td></tr>"); ==>new } ==>new else ==new { out .print("</td><td class=\"standard\"><a target=\"_blank\" href=\""); out.print("</td><td class=\"standard\"><a target=\"_blank\" href=\""); out.print(request.getContextPath()); out.print("/html/"); out.print(handle + "/"); out.print(UIUtil.encodeBitstreamName(primaryBitstream .getName(), Constants.DEFAULT_ENCODING)); out.print("\">" + LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.ItemTag.view") + "</a></td></tr>"); ==>new } ==>new out.print(primaryBitstream.getFormatDescription()); ==>new if ( tombstone ) ==>new { ==>new out.print("</td><td class=\"standard\">" ==>new + "file is not available" ==>new + "</td></tr>"); ==>new } ==>new else ==>new { out.print("</td><td class=\"standard\"><a target=\"_blank\" href=\""); out.print(request.getContextPath()); out.print("/xml/"); out.print(handle + "/"); out.print(UIUtil.encodeBitstreamName(primaryBitstream .getName(), Constants.DEFAULT_ENCODING)); out.print("\">" + LocaleSupport.getLocalizedMessage(pageContext, "org.dspace.app.webui.jsptag.ItemTag.view") + "</a></td></tr>"); ==>new } AND if (tb != null) { String myPath = request.getContextPath() + "/retrieve/" + tb.getID() + "/" + UIUtil.encodeBitstreamName(tb .getName(), Constants.DEFAULT_ENCODING); out.print(bsLink); out.print("<img src=\"" + myPath + "\" "); out.print("alt=\"" + tAltText + "\" /></a><br />"); } } ==>new if ( tombstone ) ==>new { ==>new out.print("file is not available" ==>new + "</a></td></tr>"); ==>new } ==>new else ==>new { M src/org/dspace/app/webui/servlet/HandleServlet.java - all these changes take place in the routine displayItem. IT determines if the items is an embargoed item, and if it is it displays an embargo message, if tombstone don't care about auth, this was the case before because the tombstone page was displayed 1st before the auth code was reached. cvs diff HandleServlet.java Index: HandleServlet.java =================================================================== RCS file: /l1/dspace/cvsroot/dspace/src/org/dspace/app/webui/servlet/HandleServlet.java,v retrieving revision 1.9 diff -r1.9 HandleServlet.java 0a1 > 53a55 > import org.dspace.app.webui.util.Restrict; 258,264c260,271 < // Tombstone? < if (item.isWithdrawn()) < { < JSPManager.showJSP(request, response, "/tombstone.jsp"); < < return; < } --- > Item[] embargoItems = Restrict.getRestricted ( context ); > int item_id = item.getID(); > for (int i = 0; i < embargoItems.length; i++) > { > if ( item_id == embargoItems[i].getID() ) > { > // This item is in embargo, not withdrawn > JSPManager.showJSP(request, response, "/embargo.jsp"); > return; > } > } > 266,267c273,279 < // Ensure the user has authorisation < AuthorizeManager.authorizeAction(context, item, Constants.READ); --- > //For withdrawn items don't care about auth, since just > //showing the metadata. > if (!item.isWithdrawn()) > { > // Ensure the user has authorisation > AuthorizeManager.authorizeAction(context, item, Constants.READ); > } 358a371,378 > > // Tombstone? > if (item.isWithdrawn()) > { > JSPManager.showJSP(request, response, "/tombstone.jsp"); > return; > } > Add these to the Messages.properties file jsp.tombstone.reason1 = Removed from view by legal order. jsp.tombstone.reason2 = Removed from view by DSpace. jsp.tombstone.reason3 = Removed from view at request of the author. jsp.tombstone.reasonforwithdraw = Select the reason for withdrawing item. This will display in place of the files. jsp.tombstone.accessdenied = The item you are trying to access is not yet available in DSpace. If you have any questions, please contact the administrators. jsp.tombstone.redirectuser = Go to the DSpace home page Changes to tools/confirm-withdraw-item.jsp where numerous, so I'm including the entire file. > add the capability to indicate a withdraw reason to an item ( tombstone ) > ------------------------------------------------------------------------- > > Key: DS-587 > URL: http://jira.dspace.org/jira/browse/DS-587 > Project: DSpace 1.x > Issue Type: New Feature > Components: JSPUI > Affects Versions: 1.6.0 > Environment: This is a change to the base functionality of the jspui. > Reporter: Jose Blanco > Priority: Minor > Attachments: confirm-withdraw-item.jsp, embargo.jsp, tombstone.jsp > > Original Estimate: 0 minutes > Remaining Estimate: 0 minutes > > I have already made the changes to our instance of dspace. Here is an > explanation of what the tombstone functionality works at our instance. > When an item is withdrawn the user is presented with these options for > the reason of withdraw ( these reasons live in the file > tools/confirm-withdraw-item.jsp ): > Removed from view by legal order. > Removed from view by the University of Michigan. > Removed from view at request of the author. > The user makes his selection and the item is withdrawn. When the item is > accessed the reason for the withdraw is > displayed in the box containing the bitstreams. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.dspace.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira ------------------------------------------------------------------------------ This SF.net Dev2Dev email is sponsored by: Show off your parallel programming skills. Enter the Intel(R) Threading Challenge 2010. http://p.sf.net/sfu/intel-thread-sfd _______________________________________________ Dspace-devel mailing list Dspace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/dspace-devel