Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5181 allow admin to add files to in review dataset #5231

Merged
merged 2 commits into from
Oct 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import edu.harvard.iq.dataverse.dataset.DatasetThumbnail;
import edu.harvard.iq.dataverse.engine.command.Command;
import edu.harvard.iq.dataverse.engine.command.exception.CommandException;
import edu.harvard.iq.dataverse.engine.command.exception.IllegalCommandException;
import edu.harvard.iq.dataverse.engine.command.impl.DeleteDataFileCommand;
import edu.harvard.iq.dataverse.engine.command.impl.RequestRsyncScriptCommand;
import edu.harvard.iq.dataverse.engine.command.impl.UpdateDatasetThumbnailCommand;
Expand Down Expand Up @@ -2326,8 +2327,23 @@ public boolean isThumbnailAvailable(FileMetadata fileMetadata) {

return datafileService.isThumbnailAvailable(fileMetadata.getDataFile());
}



private Boolean lockedFromEditsVar;

public boolean isLockedFromEdits() {
if(null == lockedFromEditsVar ) {
try {
permissionService.checkEditDatasetLock(dataset, dvRequestService.getDataverseRequest(), new UpdateDatasetVersionCommand(dataset, dvRequestService.getDataverseRequest()));
lockedFromEditsVar = false;
} catch (IllegalCommandException ex) {
lockedFromEditsVar = true;
}
}
return lockedFromEditsVar;
}

// Methods for edit functions that are performed on one file at a time,
// in popups that block the rest of the page:

Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/dataset.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@

<ui:include src="editFilesFragment.xhtml">
<ui:param name="datasetPage" value="true"/>
<ui:param name="editDatafilesPage" value="false"/>
<ui:param name="dataverse" value="#{DatasetPage.dataset.owner}"/>
<ui:param name="dataset" value="#{DatasetPage.dataset}"/>
<ui:param name="version" value="#{DatasetPage.workingVersion}"/>
Expand Down
4 changes: 2 additions & 2 deletions src/main/webapp/editFilesFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
dragDropSupport="true"
auto="true"
multiple="#{datasetPage || EditDatafilesPage.allowMultipleFileUpload()}"
disabled="#{DatasetPage.lockedFromEdits || EditDatafilesPage.dataset.locked || !(datasetPage || EditDatafilesPage.showFileUploadComponent())}"
disabled="#{lockedFromEdits || !(datasetPage || EditDatafilesPage.showFileUploadComponent()) }"
fileUploadListener="#{EditDatafilesPage.handleFileUpload}"
process="filesTable"
update=":datasetForm:filesTable, @([id$=filesButtons])"
Expand All @@ -239,7 +239,7 @@
sequential="true"
widgetVar="fileUploadWidget"/>

<div jsf:id="dropboxBlock" jsf:rendered="#{settingsWrapper.isHasDropBoxKey() and !(DatasetPage.lockedFromEdits or EditDatafilesPage.dataset.locked ) }" class="margin-top">
<div jsf:id="dropboxBlock" jsf:rendered="#{settingsWrapper.isHasDropBoxKey() and !lockedFromEdits }" class="margin-top">
<!-- Dropbox upload widget -->
<p class="help-block"><span class="glyphicon glyphicon-info-sign"/> #{bundle['file.fromDropbox.tip']}</p>
<h:inputText id="dropBoxSelectionInput" style="display:none" value="#{EditDatafilesPage.dropBoxSelection}"/>
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/editdatafiles.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@
<div id="contentTabs">

<ui:include src="editFilesFragment.xhtml">
<ui:param name="editDatafilesPage" value="true"/>
<ui:param name="createDataset" value="false"/>
<ui:param name="showFileButtonUpdate" value="true"/>
<ui:param name="version" value="#{EditDatafilesPage.workingVersion}"/>
<ui:param name="lockedFromEdits" value="#{EditDatafilesPage.lockedFromEdits}"/>
</ui:include>
</div>

Expand Down