[ 
https://jira.duraspace.org/browse/DS-587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21652#comment-21652
 ] 

Jose Blanco commented on DS-587:
--------------------------------

These are the changes needed to make tombstone work in the xmlui environment.  
In making
this patch, I realized that if a withdrawn item is reinstated, there would be 
multiple withdrawal 
reasons in the new dc field description.withdrawalreason, so I made a change to 
the Item.java
file to remove the last withdrawalreason and save it to the provenance 
metadata.  This change
is good for both the jspui and xmlui environments.

In making this change I had some difficulty using the messages.xml file to 
store strings that 
should be there.  When I tried to use it, I could not get the string to appear 
in the display.
I point this out in the places where I had the problem.  Hopefully this is 
something that someone
with more experience can fix quickly.


I could not get the 403 error to show-up on the Tombstone page.  I will 
continue to work on that
but perhaps someone with more xmlui experience can point out the way to do this.

In preparing this patch I list the files affected and the lines added (+) and 
deleted (-) to the 
the files.  I have also uploaded a zip file containing the following two new 
files:


   WithdrawnSelector.java
   TombstoneView.java

dspace-xmlui/dspace-xmlui-webapp/src/main/webapp/i18n/messages.xml

+                   Tombstone Text
+
+        !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-->
+
+    <message key="xmlui.tombstone.nonavailable">file is not available</message>
+
+    <!--!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
                     Statistics Aspect

-> code to choose whether to display ItemView page or Tombstone page.
dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/ArtifactBrowser/sitemap.xmap

       <map:transformer name="ItemViewer" 
src="org.dspace.app.xmlui.aspect.artifactbrowser.ItemViewer"/>
+      <map:transformer name="TombstoneView" 
src="org.dspace.app.xmlui.aspect.artifactbrowser.TombstoneView"/>

AND, further down in the file

        <map:selector name="IfModifiedSinceSelector" 
src="org.dspace.app.xmlui.aspect.general.IfModifiedSinceSelector"/>
+       <map:selector name="WithdrawnSelector" 
src="org.dspace.app.xmlui.aspect.general.WithdrawnSelector"/>

AND, further down in the file

                                                  <map:select type="browser">
                                                    <map:when test="spider">
                                                      <map:select 
type="IfModifiedSinceSelector">
                                                        <map:when test="true">
                                                          <map:act 
type="NotModifiedAction"/>
                                                          <map:serialize/>
                                                        </map:when>
                                                        <map:otherwise>
-                                                         <map:transform 
type="ItemViewer"/>
-                                                         <map:serialize 
type="xml"/>
+                                                          <map:select 
type="WithdrawnSelector">
+                                                           <map:when 
test="true">
+                                                              <map:transform 
type="TombstoneView"/>
+                                                              <map:serialize 
type="xml"/>
+                                                            </map:when>
+                                                            <map:otherwise>
+                                                              <map:transform 
type="ItemViewer"/>
+                                                              <map:serialize 
type="xml"/>
+                                                            </map:otherwise>
+                                                          </map:select>
                                                      </map:select>
                                                    </map:when>
                                                    <map:otherwise>
-                                                      <map:transform 
type="ItemViewer"/>
-                                                      <map:serialize 
type="xml"/>
+                                                      <map:select 
type="WithdrawnSelector">
+                                                       <map:when test="true">
+                                                         <map:transform 
type="TombstoneView"/>
+                                                          <map:serialize 
type="xml"/>
+                                                        </map:when>
+                                                        <map:otherwise>
+                                                          <map:transform 
type="ItemViewer"/>
+                                                          <map:serialize 
type="xml"/>
+                                                        </map:otherwise>
+                                                       </map:select>
                                                      </map:otherwise>
                                                  </map:select>
                                                </map:match>
                                        </map:match>                            
                           </map:otherwise>

AND, just below there is this change:


                                        <map:match 
type="HandleAuthorizedMatcher" pattern="!READ">
+                                           <map:select 
type="WithdrawnSelector">       
+                                               <map:when test="true">
+                                                    <map:transform 
type="TombstoneView"/>
+                                                      <map:serialize 
type="xml"/>
+                                               </map:when>
+                                                <map:otherwise>
                                                        <map:select 
type="AuthenticatedSelector">
                                                                <map:when 
test="eperson">
                                                                        
<map:transform type="RestrictedItem"/>
                                                                        
<map:serialize/>
                                                                </map:when>
                                                                <map:otherwise>
                                                                        
<map:act type="StartAuthentication">
                                                                                
<map:parameter name="header" 
value="xmlui.ArtifactBrowser.RestrictedItem.auth_header"/>
                                                                                
<map:parameter name="message" 
value="xmlui.ArtifactBrowser.RestrictedItem.auth_message"/>
                                                                        
</map:act>
                                                                        
<map:serialize/>
                                                                </map:otherwise>
                                                        </map:select>
+                                                </map:otherwise>
+                                           </map:select>
                                        </map:match>


-> code to delete from withdrawal reason and put in provenance, if an item is 
reinstated.  This code goes
   inside the method reinstate.
dspace-api/src/main/java/org/dspace/content/Item.java


        for (int i = 0; i < colls.length; i++)
        {
            prov.append(colls[i].getMetadata("name")).append(" (ID: 
").append(colls[i].getID()).append(")\n");
        }

+       //Find the reason the item was withdrawn - there should only be one.
+       DCValue[] reasons = getMetadata("dc", "description", 
"withdrawalreason", Item.ANY);                                                  
 
+       // if there is a reason, remove the metadata, but store the reason 
+       // in the provenance

+       if ( (reasons != null ) && ( reasons.length > 0) )
+       {
+           prov.append("Previously withdrawn because ");+
+           prov.append(reasons[0].value).append("\n");
+           clearDC("description", "withdrawalreason", Item.ANY);
+       }

-> selector to check if item is withdrawn.  This file is new, so I have 
attached it.
dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/general/WithdrawnSelector.java

-> page to display in case item is withdrawn.  This file is new, so I have 
attached it.
dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/TombstoneView.java

-> the code put in selector widget for user to use tombstone reason when 
confirming the the withdraw.  Note that I could
not figure out how to use the messages.xml file to store the strings so show on 
the pulldown.  Perhaps that 
is something that some one with more experience could quickly fix.
dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/administrative/item/ConfirmItemForm.java

import org.dspace.app.xmlui.wing.element.Table;
+ import org.dspace.app.xmlui.wing.element.Select;

AND

-               // LIST: actions, confirm or return
-               org.dspace.app.xmlui.wing.element.Item actions = 
main.addList("actions", List.TYPE_FORM).addItem();

-               Button confirmButton = actions.addButton("submit_confirm");

                if("delete".equals(confirm))
                {
+                   // LIST: actions, confirm or return
+                   org.dspace.app.xmlui.wing.element.Item actions = 
main.addList("actions", List.TYPE_FORM).addItem();
+                   Button confirmButton = actions.addButton("submit_confirm");
                    confirmButton.setValue(T_submit_delete);
+                   
actions.addButton("submit_cancel").setValue(T_submit_cancel);

                }
                else if ("reinstate".equals(confirm))
                {
+                   // LIST: actions, confirm or return
+                   org.dspace.app.xmlui.wing.element.Item actions = 
main.addList("actions", List.TYPE_FORM).addItem();
+                   Button confirmButton = actions.addButton("submit_confirm");
                    confirmButton.setValue(T_submit_reinstate);
+                   
actions.addButton("submit_cancel").setValue(T_submit_cancel);
                }
                else if ("withdraw".equals(confirm))
                {
+                   org.dspace.app.xmlui.wing.element.Item reasons = 
main.addList("reasons",List.TYPE_FORM).addItem();

+                   Select tombstone_select = 
reasons.addSelect("tombstone_select");
+                   tombstone_select.setLabel("Withdrawal Reason");
+                   tombstone_select.setHelp("");
                    
+                   tombstone_select.addOption("Removed from view by legal 
order.", "Removed from view by legal order.");
+                   tombstone_select.addOption("Removed from view by the 
University.", "Removed from view by the University.");
+                   tombstone_select.addOption("Removed from view at request of 
the author.", "Removed from view at request of the author.");

+                   // LIST: actions, confirm or return
+                   org.dspace.app.xmlui.wing.element.Item actions = 
main.addList("actions", List.TYPE_FORM).addItem();
+                   Button confirmButton = actions.addButton("submit_confirm");
                    confirmButton.setValue(T_submit_withdraw);
+                   
actions.addButton("submit_cancel").setValue(T_submit_cancel);

                }
-               actions.addButton("submit_cancel").setValue(T_submit_cancel);


-> updated the process to store withdrawal reason.
dspace-xmlui/dspace-xmlui-api/src/main/java/org/dspace/app/xmlui/aspect/administrative/FlowItemUtils.java

-       public static FlowResult processWithdrawItem(Context context, int 
itemID) throws SQLException, AuthorizeException,  AuthorizeBioException, 
IOException
+       public static FlowResult processWithdrawItem(Context context, int 
itemID, String reason) throws SQLException, AuthorizeException,  
AuthorizeBioException, IOException

AND inside processWithdrawItem, add the sotring of the withdrawalreason to the 
metadata:

                Item item = Item.find(context, itemID);
+               item.addDC("description", "withdrawalreason", "en", reason);



-> code that makes call to store withdrawal reason.
dspace-xmlui/dspace-xmlui-api/src/main/resources/aspects/Administrative/administrative.js
+               var reason = cocoon.request.get("tombstone_select");
+               var result = 
FlowItemUtils.processWithdrawItem(getDSContext(),itemID, reason);
-               var result = 
FlowItemUtils.processWithdrawItem(getDSContext(),itemID);

                
> add the capability to indicate a withdraw reason to an item ( tombstone )
> -------------------------------------------------------------------------
>
>                 Key: DS-587
>                 URL: https://jira.duraspace.org/browse/DS-587
>             Project: DSpace
>          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
>         Attachments: confirm-withdraw-item.jsp, embargo.jsp, tombstone.jsp, 
> tombstone_xmlui.zip, tombstone.zip
>
>   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, please contact your JIRA administrators: 
https://jira.duraspace.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to