diff --git a/src/main/java/edu/harvard/iq/dataverse/FileDownloadHelper.java b/src/main/java/edu/harvard/iq/dataverse/FileDownloadHelper.java index be8dfbeb52e..80625d9cc8e 100644 --- a/src/main/java/edu/harvard/iq/dataverse/FileDownloadHelper.java +++ b/src/main/java/edu/harvard/iq/dataverse/FileDownloadHelper.java @@ -10,6 +10,7 @@ import edu.harvard.iq.dataverse.authorization.users.PrivateUrlUser; import edu.harvard.iq.dataverse.externaltools.ExternalTool; import edu.harvard.iq.dataverse.util.BundleUtil; +import edu.harvard.iq.dataverse.util.FileUtil; import static edu.harvard.iq.dataverse.util.JsfHelper.JH; import java.util.ArrayList; import java.util.HashMap; @@ -295,6 +296,17 @@ public void requestAccess(DataFile file){ //Called from download button fragment via either dataset page or file page // when there's only one file for the access request and there's no pop-up processRequestAccess(file, true); + } + + public void handleCommandLinkClick(FileMetadata fmd){ + + if (FileUtil.isDownloadPopupRequired(fmd.getDatasetVersion())){ + addFileForRequestAccess(fmd.getDataFile()); + PrimeFaces.current().executeScript("PF('requestAccessPopup').show()"); + } else { + requestAccess(fmd.getDataFile()); + } + } public void requestAccessMultiple(List files) { diff --git a/src/main/webapp/file-download-button-fragment.xhtml b/src/main/webapp/file-download-button-fragment.xhtml index 169b8815e20..da88d1ae64d 100644 --- a/src/main/webapp/file-download-button-fragment.xhtml +++ b/src/main/webapp/file-download-button-fragment.xhtml @@ -177,28 +177,40 @@ -
  • - - #{fileMetadata.dataFile.fileAccessRequesters.contains(dataverseSession.user) ? bundle['file.accessRequested'] : bundle['file.requestAccess']} - - #{bundle['file.accessBtn.header.download']}
  • + + + + + - - - #{fileMetadata.dataFile.fileAccessRequesters.contains(dataverseSession.user) ? bundle['file.accessRequested'] : bundle['file.requestAccess']} - + +
  • + #{bundle['file.requestAccess']} diff --git a/src/main/webapp/file-request-access-popup-fragment.xhtml b/src/main/webapp/file-request-access-popup-fragment.xhtml index ecf586ba86f..f0715f6726a 100644 --- a/src/main/webapp/file-request-access-popup-fragment.xhtml +++ b/src/main/webapp/file-request-access-popup-fragment.xhtml @@ -42,7 +42,7 @@
    + update="@([id$=requestAccessConsolidated]), @([id$=requestPanel])" oncomplete="PF('requestAccessPopup').hide();">
    - -
    + +
    -
    +
    - - - #{bundle.preview} - - - + + #{bundle.preview} + + +