Uploaded image for project: 'DSpace'
  1. DSpace
  2. DS-3007

JSPUI: Adding a repeatable item instance while editing metadata doesn't reposition correctly

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Volunteer Needed (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 5.4
    • Fix Version/s: None
    • Component/s: JSPUI
    • Labels:
    • Environment:
      Windows 7 (actually non OS-specific)
    • Attachments:
      0
    • Comments:
      2
    • Documentation Status:
      In Description

      Description

      While editing the metadata of a document in JSPUI, when I click the Add button to add an instance of a repeatable item (e.g., an author), the page doesn't reposition itself correctly to that item after reloading.

      I saw two causes for this bug:

      (1) The anchor part of the form action (that is, the # and the string that follows) is set too soon. Indeed, when the page is initially loaded, one cannot foresee which Add button might be clicked (author, subject, ...), and the anchor part of the form action URL is not updated upon submission.
      (2) An anchor is set for some metadata items, but only under some specific conditions.

      I solved the problem as follows. All modifications were applied in the dspace-jspui/src/main/webapp/submit/edit-metadata.jsp file. Line numbers refer to this file in the DSpace 5.4 source distribution, before any modification described below.

      (1) In each method where an Add button is created, before the <button> opening tag is closed, I added these two lines:

      .append("\" onclick=\"")
      .append("var form = document.getElementById('edit_metadata');

      This snippet is to be added between lines 362–363, 475–476, 556–557, 644–645, 734–735, 870–871, and 985–986.

      (2) In the <form> tag, I remove the anchor part of the form action URL. Line 1211 now looks as follows:

      <form action="<%= request.getContextPath() %>/submit" method="post" name="edit_metadata" id="edit_metadata" onkeydown="return disableEnterKey(event);">

      (3) I inserted the following snippet before line 1292:

      pageContext.setAttribute("fieldName", fieldName);
      %>
      <a name="${ fieldName }"></a>
      <%

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              jfmorin Jean-François Morin
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: