add the capability to indicate a withdraw reason to an item ( tombstone )
-------------------------------------------------------------------------

                 Key: DS-731
                 URL: https://jira.duraspace.org/browse/DS-731
             Project: DSpace
          Issue Type: New Feature
          Components: JSPUI
            Reporter: Jose Blanco
         Attachments: tombstone.zip


This patch will give jspui implementations the ability to configure their 
instance to display a
tombstone page that shows the metadata and the reason for which the item was 
withdrawn, or to 
display a message indicating the item was withdrawn.  In either case the system 
will output a HttpServletResponse.SC_NOT_FOUND status.  

If you want users to see the tombstone page, you place the user in a group and 
indicate that 
group's id in the parameter tombstone.groupid.  If you set the groupid to 0 ( 
the anonymous 
group, for which all users belong to), then all the user will get the tombstone 
page.

you need to add the following dc filed:

description.withdralreason

You will need the following new dspace.cfg parameter:

#### Tombstone Groups ######
# Groups for wich to display the tombstone page, rather than the error page
# this is a comma separated integer, can have more than one.
tombstone.groupid = 

Files java files affected:
EditItemServlet.java
dspace-tag.tld
Message.properties
BitstreamServlet.java
HandleServlet.java
JSPManager.java
ItemTaga.java  - so many changes I'm including the file.


The jsp files affected are:
webapp/withdrawnerror.jsp - this is a new file.  And is included.
webapp/tools/confirm-withdraw-item.jsp - there are lots of changes here.  I 
have included the fie.
webapp/tombstone.jsp - this file has changed completely, so I'm just going to 
include it.


CHNAGES TO===> EditItemServlet.java 
267,268c267,271
+           // Withdraw the item
+             processWithdrawItem(context, request, response, item);
-             // Withdraw the item
-             item.withdraw();
-             JSPManager.showJSP(request, response, "/tools/get-item-id.jsp");
-             context.complete();
 
774,791d776 ( new ) 
+     private void processWithdrawItem(Context context, HttpServletRequest 
request,
+             HttpServletResponse response, Item item) throws ServletException,
+                                           IOException, SQLException, 
AuthorizeException
+     {
+       // Need to update the provenance information with the user selected 
option.
+       String reason = request.getParameter("reason");
+ 
+       log.info(LogManager.getHeader(context, "processWithdrawItem reason : 
",reason ));
+ 
+       item.addDC("description", "withdrawalreason", "en", reason);
+       item.update();
+ 
+       item.withdraw();
+       JSPManager.showJSP(request, response, "/tools/get-item-id.jsp");
+       context.complete();
+     }


CJHANGES TO ==> dspace-tags.tld 
213,217d212
  <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>

CHANGES ==> Add this to the end of the file dspace-tag.tld
+ #Tombstone
+ 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 ===>  BitstreamServlet.java 
72,73d71
+ import org.dspace.eperson.EPerson;
+ import org.dspace.eperson.Group;
179,207c177,178
+ 
+               String groupids = 
ConfigurationManager.getProperty("tombstone.groupid");
+               // Remove spaces from string
+               groupids.replaceAll(" ", "");
+ 
+               Boolean showTombstone = false;
+               String[] groupids_array = groupids.split(",");
+               for(int i=0; i<groupids_array.length; i++)
+               {
+                   if ( ! groupids_array[i].equals("") )
+                   {
+                       if ( Group.isMember(context, 
Integer.parseInt(groupids_array[i]) ) )
+                       {
+                           showTombstone = true;
+                       }
+                   }
+               }
+ 
+               if (  showTombstone )
+               {
+                   JSPManager.showTombstonePage(request, response);
+                   return;
+               }
+               else
+               {
+                   JSPManager.showWithdrawnPage(request, response);
+                   return;
+               }
---
-                 JSPManager.showJSP(request, response, "/tombstone.jsp");
-                 return;

CHANGES TO => HandleServlet.java 

321a321,327
-         // Tombstone?
-         if (item.isWithdrawn())
-         {
-             JSPManager.showJSP(request, response, "/tombstone.jsp");
- 
-             return;
-         }
323,331c329,330
+       int item_id = item.getID();
+           
+       //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);
+       }
--- 
-         // Ensure the user has authorisation
-         AuthorizeManager.authorizeAction(context, item, Constants.READ);
333c332,334
+         log.info(LogManager.getHeader(context, "view_item", "handle=" + 
handle));
---
-         log
-                 .info(LogManager.getHeader(context, "view_item", "handle="
-                         + handle));
423,459c424
+
+         // Tombstone?
+         // Find out if there's a group parameter
+         if (item.isWithdrawn())
+         {
+           String groupids = 
ConfigurationManager.getProperty("tombstone.groupid");
+           // Remove spaces from string
+           groupids.replaceAll(" ", "");
+           
+           Boolean showTombstone = false;
+           String[] groupids_array = groupids.split(",");
+           for(int i=0; i<groupids_array.length; i++)
+           {
+               if ( ! groupids_array[i].equals("") )
+               {
+                   if ( Group.isMember(context, 
Integer.parseInt(groupids_array[i]) ) )
+                   {
+                       showTombstone = true;
+                   }
+               }
+           }
+ 
+           if (  showTombstone )
+           {
+               JSPManager.showTombstonePage(request, response);
+               return;
+           }
+           else
+           {
+               JSPManager.showWithdrawnPage(request, response);
+               return;
+           }
+         }
+ 
+       String itemFile = "/display-item.jsp";
+         JSPManager.showJSP(request, response, itemFile);
---
-         JSPManager.showJSP(request, response, "/display-item.jsp");

CHANGES TO ==> JSPManager.java 
110,140d108
+ 
+     /**
+      * Display a tombstone page with metadata and reason for withdraw.
+      * 
+      * @param request
+      *            the HTTP request
+      * @param response
+      *            the HTTP response
+      */
+     public static void showTombstonePage(HttpServletRequest request,
+             HttpServletResponse response) throws ServletException, IOException
+     {
+         response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+          showJSP(request, response, "/tombstone.jsp");
+     }
+ 
+     /**
+      * Display an error message when item is withdrawn.
+      * 
+      * @param request
+      *            the HTTP request
+      * @param response
+      *            the HTTP response
+      */
+     public static void showWithdrawnPage(HttpServletRequest request,
+             HttpServletResponse response) throws ServletException, IOException
+     {
+         response.setStatus(HttpServletResponse.SC_NOT_FOUND);
+         showJSP(request, response, "/withdrawnerror.jsp");
+     }






-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
https://jira.duraspace.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to