diff --git a/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java b/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java index bb922c606b2..83919537510 100644 --- a/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java @@ -896,12 +896,25 @@ public void deleteMarkedAsDuplicateFiles() { Iterator fmItr = fileMetadatas.iterator(); - while (fmItr.hasNext()){ + String fileNames = null; + while (fmItr.hasNext()) { FileMetadata test = fmItr.next(); - if(test.isMarkedAsDuplicate()){ + if (test.isMarkedAsDuplicate()) { + if (fileNames == null) { + fileNames = test.getLabel(); + } else { + fileNames = fileNames.concat(", " + test.getLabel()); + } fmItr.remove(); } } + + if (fileNames != null) { + String successMessage = getBundleString("file.deleted.upload.success"); + logger.fine(successMessage); + successMessage = successMessage.replace("{0}", fileNames); + JsfHelper.addFlashMessage(successMessage); + } if (isFileReplaceOperation()){ try { @@ -988,8 +1001,12 @@ public void deleteFiles() { } } + if (fileNames != null) { String successMessage = getBundleString("file.deleted.success"); + if (mode == FileEditMode.UPLOAD) { + successMessage = getBundleString("file.deleted.upload.success"); + } logger.fine(successMessage); successMessage = successMessage.replace("{0}", fileNames); JsfHelper.addFlashMessage(successMessage); @@ -1792,6 +1809,7 @@ public void uploadFinished() { if (existingFilesWithDupeContent != null || newlyUploadedFilesWithDupeContent != null) { setWarningMessageForAlreadyExistsPopUp(uploadWarningMessage); setHeaderForAlreadyExistsPopUp(); + setLabelForDeleteFilesPopup(); PrimeFaces.current().ajax().update("datasetForm:fileAlreadyExistsPopup"); PrimeFaces.current().executeScript("PF('fileAlreadyExistsPopup').show();"); } @@ -1865,6 +1883,23 @@ public void setHeaderForAlreadyExistsPopUp(String headerForAlreadyExistsPopUp) { this.headerForAlreadyExistsPopUp = headerForAlreadyExistsPopUp; } + private String labelForDeleteFilesPopup; + + public String getLabelForDeleteFilesPopup() { + return labelForDeleteFilesPopup; + } + + public void setLabelForDeleteFilesPopup(String labelForDeleteFilesPopup) { + this.labelForDeleteFilesPopup = labelForDeleteFilesPopup; + } + + public void setLabelForDeleteFilesPopup() { + this.labelForDeleteFilesPopup = ((multipleDupesExisting|| multipleDupesNew) ? BundleUtil.getStringFromBundle("file.delete.duplicate.multiple") : + BundleUtil.getStringFromBundle("file.delete.duplicate.single")); + } + + //((multipleDupesExisting|| multipleDupesNew) ? BundleUtil.getStringFromBundle("file.addreplace.already_exists.header.multiple"): BundleUtil.getStringFromBundle("file.addreplace.already_exists.header")); + public void setHeaderForAlreadyExistsPopUp() { this.headerForAlreadyExistsPopUp = ((multipleDupesExisting|| multipleDupesNew) ? BundleUtil.getStringFromBundle("file.addreplace.already_exists.header.multiple"): BundleUtil.getStringFromBundle("file.addreplace.already_exists.header")); diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties index 81756d1c10d..d0e6545749b 100755 --- a/src/main/java/propertyFiles/Bundle.properties +++ b/src/main/java/propertyFiles/Bundle.properties @@ -1507,10 +1507,12 @@ file.replaced.warning.draft.warningMessage=You can not replace a file that has b file.replaced.warning.previous.warningMessage=You can not edit a file that has been replaced in a previous dataset version. In order to edit it you must go to the most recently published version of the file. file.alreadyDeleted.previous.warningMessage=This file has already been deleted in current version. It may not be edited. file.delete=Delete -file.delete.duplicate=Delete Duplicate File(s) +file.delete.duplicate.multiple=Delete Duplicate Files +file.delete.duplicate.single=Delete Duplicate File file.metadata=Metadata file.deleted.success=Files "{0}" will be permanently deleted from this version of this dataset once you click on the Save Changes button. file.deleted.replacement.success=The replacement file has been deleted. +file.deleted.upload.success=Files "{0}" won\u2019t be included in this upload. file.editAccess=Edit Access file.restrict=Restrict file.unrestrict=Unrestrict diff --git a/src/main/webapp/editFilesFragment.xhtml b/src/main/webapp/editFilesFragment.xhtml index 645600fa995..bbc15717a55 100644 --- a/src/main/webapp/editFilesFragment.xhtml +++ b/src/main/webapp/editFilesFragment.xhtml @@ -554,9 +554,9 @@

- + update=":#{p:resolveClientId('datasetForm:filesTable', view)},:messagePanel,:#{p:resolveClientId('datasetForm:fileUpload', view)},uploadMessage,@([id$=filesButtons])"/>