Skip to content

Commit

Permalink
add download all buttons under access button #6118
Browse files Browse the repository at this point in the history
  • Loading branch information
pdurbin committed Jun 30, 2020
1 parent fc37fac commit c1a6126
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 12 deletions.
21 changes: 19 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2886,8 +2886,25 @@ public List<FileMetadata> getSelectedNonDownloadableFiles() {
public void setSelectedNonDownloadableFiles(List<FileMetadata> selectedNonDownloadableFiles) {
this.selectedNonDownloadableFiles = selectedNonDownloadableFiles;
}



public void validateAllFilesForDownloadArchival() {
selectAllFiles();
boolean guestbookRequired = isDownloadPopupRequired();
boolean downloadOriginal = false;
validateFilesForDownload(guestbookRequired, downloadOriginal);
}

/**
* Can result in "requested optional service" error. For non-tabular files
* it's safer to use validateAllFilesForDownloadArchival.
*/
public void validateAllFilesForDownloadOriginal() {
selectAllFiles();
boolean guestbookRequired = isDownloadPopupRequired();
boolean downloadOriginal = true;
validateFilesForDownload(guestbookRequired, downloadOriginal);
}

public void validateFilesForDownload(boolean guestbookRequired, boolean downloadOriginal){
setSelectedDownloadableFiles(new ArrayList<>());
setSelectedNonDownloadableFiles(new ArrayList<>());
Expand Down
28 changes: 18 additions & 10 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,7 @@
and !permissionsWrapper.canIssuePublishDatasetCommand(DatasetPage.dataset)}"/>
<ui:param name="showReturnToAuthorLink" value="#{DatasetPage.dataset.latestVersion.versionState=='DRAFT' and DatasetPage.dataset.latestVersion.inReview
and permissionsWrapper.canIssuePublishDatasetCommand(DatasetPage.dataset)}"/>
<!-- TO-DO #3513 DOWNLOAD ALL LINK -->
<!-- ADDED TOOLS SPECIFIC LOGIC TO DatasetPage.canDownloadFiles() RENDER LOGIC, CAN BE REMOVED WHEN DOWNLOAD ALL FILES IS WIRED UP -->
<ui:param name="showAccessDatasetButtonGroup" value="#{(DatasetPage.canDownloadFiles()
and (DatasetPage.datasetExploreTools.size() >= 1
or (DatasetPage.sessionUserAuthenticated and DatasetPage.showComputeButton())))
<ui:param name="showAccessDatasetButtonGroup" value="#{DatasetPage.canDownloadFiles()
and (!DatasetPage.workingVersion.deaccessioned
or (DatasetPage.workingVersion.deaccessioned and DatasetPage.canUpdateDataset()))}"/>
<ui:param name="publishDataset" value="#{DatasetPage.publishDatasetPopup()}"/>
Expand Down Expand Up @@ -143,17 +139,29 @@
</button>
<ul class="dropdown-menu pull-right text-left">

<ui:remove>
<!-- DOWNLOAD -->
<!-- TO-DO #3513 DOWNLOAD ALL LINK -->
<ui:fragment rendered="#{DatasetPage.canDownloadFiles()}">
<li class="dropdown-header">#{bundle['dataset.accessBtn.header.download']} <span class="glyphicon glyphicon-download-alt"/></li>
<li class="disabled">
<span class="ui-commandlink ui-widget ui-state-disabled btn-download">Download (Placeholder)</span>
<!-- NORMAL DOWNLOAD BUTTON (NO TABULAR FILES) -->
<li jsf:rendered="#{!DatasetPage.isHasTabular()}">
<p:commandLink update="@form" actionListener="#{DatasetPage.validateAllFilesForDownloadArchival()}">
#{bundle.download}
</p:commandLink>
</li>
<!-- DOWNLOAD ORIGINAL BUTTON (TABULAR FILES PRESENT) -->
<li jsf:rendered="#{DatasetPage.isHasTabular()}">
<p:commandLink update="@form" actionListener="#{DatasetPage.validateAllFilesForDownloadOriginal()}">
#{bundle.downloadOriginal}
</p:commandLink>
</li>
<!-- DOWNLOAD ARCHIVAL FILES (TABULAR FILES PRESENT) -->
<li jsf:rendered="#{DatasetPage.isHasTabular()}">
<p:commandLink update="@form" actionListener="#{DatasetPage.validateAllFilesForDownloadArchival()}">
#{bundle.downloadArchival}
</p:commandLink>
</li>
</ui:fragment>
<!-- END: DOWNLOAD -->
</ui:remove>

<!-- EXPLORE -->
<ui:fragment rendered="#{DatasetPage.datasetExploreTools.size() >= 1}">
Expand Down

0 comments on commit c1a6126

Please sign in to comment.