diff --git a/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java b/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java index 65e6b259bf4..aa37c579224 100644 --- a/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/FileDownloadServiceBean.java @@ -462,7 +462,7 @@ public void downloadCitationBibtex(FileMetadata fileMetadata, Dataset dataset, b HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse(); //Fix for 6029 FireFox was failing to parse it when content type was set to json - response.setContentType("text/plain"); + response.setContentType("text/plain;charset=utf-8"); String fileNameString; if (fileMetadata == null || fileMetadata.getLabel() == null) { diff --git a/src/main/java/edu/harvard/iq/dataverse/api/dto/DatasetVersionDTO.java b/src/main/java/edu/harvard/iq/dataverse/api/dto/DatasetVersionDTO.java index 37fe197280b..84a76e9017b 100644 --- a/src/main/java/edu/harvard/iq/dataverse/api/dto/DatasetVersionDTO.java +++ b/src/main/java/edu/harvard/iq/dataverse/api/dto/DatasetVersionDTO.java @@ -56,6 +56,9 @@ public void setInReview(boolean inReview) { } public String getTermsOfUse() { + if (termsOfUse != null && termsOfUse.contains("CC0")) { + termsOfUse = termsOfUse.replace("CC0", "CC BY"); + } return termsOfUse; } diff --git a/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java b/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java index 49fe203b96d..9e688c146f4 100644 --- a/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/export/openaire/OpenAireExportUtil.java @@ -1132,6 +1132,7 @@ public static void writeAccessRightsElement(XMLStreamWriter xmlw, DatasetVersion xmlw.writeEndElement(); // writeRightsHeader(xmlw, language); + if (datasetVersionDTO.getLicense() != null) { xmlw.writeAttribute("rightsURI", datasetVersionDTO.getLicense().getUri()); xmlw.writeCharacters(datasetVersionDTO.getLicense().getName()); diff --git a/src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java b/src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java index 339de904f9e..aaccd717840 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java @@ -207,6 +207,8 @@ public class FileUtil implements java.io.Serializable { private static final String FILE_FACET_CLASS_TEXT = "Text"; private static final String FILE_FACET_CLASS_OTHER = "Other"; private static final String FILE_FACET_CLASS_UNKNOWN = "Unknown"; + + public static final String OVERWRITE_MIME_TYPE_PREFIX = "force-"; // The file type facets and type-specific thumbnail classes (above) are // very similar, but not exactly 1:1; so the following map is for @@ -819,24 +821,32 @@ public static CreateDataFileResult createDataFiles(DatasetVersion version, Input // than the type supplied: // -- L.A. String recognizedType = null; - - try { - recognizedType = determineFileType(tempFile.toFile(), fileName); - logger.fine("File utility recognized the file as " + recognizedType); - if (recognizedType != null && !recognizedType.equals("")) { - if (useRecognizedType(suppliedContentType, recognizedType)) { - finalType = recognizedType; - } - } - - } catch (Exception ex) { - logger.warning("Failed to run the file utility mime type check on file " + fileName); + + // If we detect the dataverse prefix in the supplied mimetype we do no + // further recognition + if (suppliedContentType.toLowerCase().startsWith(OVERWRITE_MIME_TYPE_PREFIX)) { + finalType = suppliedContentType.toLowerCase().substring(OVERWRITE_MIME_TYPE_PREFIX.length()); + logger.fine("Overwrite prefix detected. Using supplied mime type."); } - - if (finalType == null) { - finalType = (suppliedContentType == null || suppliedContentType.equals("")) - ? MIME_TYPE_UNDETERMINED_DEFAULT - : suppliedContentType; + else { + try { + recognizedType = determineFileType(tempFile.toFile(), fileName); + logger.fine("File utility recognized the file as " + recognizedType); + if (recognizedType != null && !recognizedType.equals("")) { + if (useRecognizedType(suppliedContentType, recognizedType)) { + finalType = recognizedType; + } + } + + } catch (Exception ex) { + logger.warning("Failed to run the file utility mime type check on file " + fileName); + } + + if (finalType == null) { + finalType = (suppliedContentType == null || suppliedContentType.equals("")) + ? MIME_TYPE_UNDETERMINED_DEFAULT + : suppliedContentType; + } } // A few special cases: diff --git a/src/main/java/edu/harvard/iq/dataverse/util/MarkupChecker.java b/src/main/java/edu/harvard/iq/dataverse/util/MarkupChecker.java index ef74819f073..141cce50cbd 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/MarkupChecker.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/MarkupChecker.java @@ -33,8 +33,8 @@ public static String sanitizeBasicHTML(String unsafe) { // basic includes: a, b, blockquote, br, cite, code, dd, dl, dt, em, i, li, ol, p, pre, q, small, span, strike, strong, sub, sup, u, ul //Whitelist wl = Whitelist.basic().addTags("img", "h1", "h2", "h3", "kbd", "hr", "s", "del"); - Safelist sl = Safelist.basicWithImages().addTags("h1", "h2", "h3", "kbd", "hr", "s", "del", "map", "area").addAttributes("img", "usemap") - .addAttributes("map", "name").addAttributes("area", "shape", "coords", "href", "title", "alt") + Safelist sl = Safelist.basicWithImages().addTags("h1", "h2", "h3", "kbd", "hr", "s", "del", "map", "area").addAttributes("img", "usemap", "style") + .addAttributes("map", "name").addAttributes("area", "shape", "coords", "href", "title", "alt").addAttributes("ol", "type") .addEnforcedAttribute("a", "target", "_blank"); return Jsoup.clean(unsafe, sl); diff --git a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java index 4ecdc73ae6e..98cea105366 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonParser.java @@ -407,7 +407,7 @@ public DatasetVersion parseDatasetVersion(JsonObject obj, DatasetVersion dsv) th throw new JsonParseException(BundleUtil.getStringFromBundle("jsonparser.error.parsing.number", Arrays.asList(ex.getMessage())), ex); } } - + private edu.harvard.iq.dataverse.license.License parseLicense(String licenseNameOrUri) throws JsonParseException { if (licenseNameOrUri == null){ boolean safeDefaultIfKeyNotFound = true; diff --git a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java index e088122419d..4f1dfd54fcd 100644 --- a/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java +++ b/src/main/java/edu/harvard/iq/dataverse/util/json/JsonPrinter.java @@ -420,6 +420,18 @@ public static JsonObjectBuilder jsonDataFileList(List dataFiles){ return bld; } + private static String getLicense(DatasetVersion dsv) { + if (dsv.getTermsOfUseAndAccess().getLicense() != null) { + if (dsv.getTermsOfUseAndAccess().getLicense().equals(TermsOfUseAndAccess.License.CC0)) { + return "CC BY"; + } else { + return dsv.getTermsOfUseAndAccess().getLicense().toString(); + } + } else { + return null; + } + } + /** * Export formats such as DDI require the citation to be included. See * https://github.com/IQSS/dataverse/issues/2579 for more on DDI export. diff --git a/src/main/java/propertyFiles/Bundle.properties b/src/main/java/propertyFiles/Bundle.properties index b19e80020ba..6f755f00d23 100644 --- a/src/main/java/propertyFiles/Bundle.properties +++ b/src/main/java/propertyFiles/Bundle.properties @@ -88,6 +88,7 @@ selectedFiles=Selected Files htmlAllowedTitle=Allowed HTML Tags htmlAllowedMsg=This field supports only certain HTML tags. htmlAllowedTags=<a>, <b>, <blockquote>, <br>, <code>, <del>, <dd>, <dl>, <dt>, <em>, <hr>, <h1>-<h3>, <i>, <img>, <kbd>, <li>, <ol>, <p>, <pre>, <s>, <sup>, <sub>, <strong>, <strike>, <u>, <ul> +vocabularyFaqMsg=More information about vocabularies, terms and URLs here. conditionalRequiredMsg=One or more of these fields may become required if you add to one or more of these optional fields. conditionalRequiredMsg.tooltip=This field will become required if you choose to enter values in one or more of these optional fields. toggleNavigation=Toggle navigation @@ -806,7 +807,7 @@ dataverse.enterName=Enter name... dataverse.host.title=The dataverse which contains this data. dataverse.host.tip=Changing the host dataverse will clear any fields you may have entered data into. dataverse.host.autocomplete.nomatches=No matches -dataverse.identifier.title=Short name used for the URL of this dataverse. +dataverse.identifier.title=Short name used for the URL of this dataverse. Use your institutional abbreviation as prefix. dataverse.affiliation.title=The organization with which this dataverse is affiliated. dataverse.storage.title=A storage service to be used for datasets in this dataverse. dataverse.metadatalanguage.title=Metadata entered for datasets in this dataverse will be assumed to be in the selected language. @@ -1417,7 +1418,7 @@ dataset.publish.header=Publish Dataset dataset.rejectBtn=Return to Author dataset.submitBtn=Submit for Review dataset.disabledSubmittedBtn=Submitted for Review -dataset.submitMessage=You will not be able to make changes to this dataset while it is in review. +dataset.submitMessage=Please use the publication checklist for authors ( https://www.izus.uni-stuttgart.de/fokus/darus/publication/ ) to ensure publication readiness. You will not be able to make changes to this dataset while it is in review. dataset.submit.success=Your dataset has been submitted for review. dataset.inreview.infoMessage=The draft version of this dataset is currently under review prior to publication. dataset.submit.failure=Dataset Submission Failed - {0} @@ -1469,7 +1470,7 @@ dataset.share.datasetShare=Share Dataset dataset.share.datasetShare.tip=Share this dataset on your favorite social media networks. dataset.share.datasetShare.shareText=View this dataset. dataset.locked.message=Dataset Locked -dataset.locked.message.details=This dataset is locked until publication. +dataset.locked.message.details=This dataset is reviewed prior to publication by the DaRUS-team. You will receive an email with further information in the next days. dataset.locked.inReview.message=Submitted for Review dataset.locked.ingest.message=The tabular data files uploaded are being processed and converted into the archival format dataset.unlocked.ingest.message=The tabular files have been ingested. diff --git a/src/main/java/propertyFiles/MimeTypeDetectionByFileExtension.properties b/src/main/java/propertyFiles/MimeTypeDetectionByFileExtension.properties index c93bb56151f..c12dd8f1b33 100644 --- a/src/main/java/propertyFiles/MimeTypeDetectionByFileExtension.properties +++ b/src/main/java/propertyFiles/MimeTypeDetectionByFileExtension.properties @@ -17,6 +17,7 @@ mp3=audio/mp3 nii=image/nii nc=application/netcdf ods=application/vnd.oasis.opendocument.spreadsheet +pdh=text/plain png=image/png pptx=application/vnd.openxmlformats-officedocument.presentationml.presentation prj=application/prj diff --git a/src/main/webapp/metadataFragment.xhtml b/src/main/webapp/metadataFragment.xhtml index 324fd2e0b84..b7d87bbd60c 100755 --- a/src/main/webapp/metadataFragment.xhtml +++ b/src/main/webapp/metadataFragment.xhtml @@ -1,3 +1,4 @@ +

+ +

+ +

+
diff --git a/src/main/webapp/resources/images/ccby.png b/src/main/webapp/resources/images/ccby.png new file mode 100644 index 00000000000..44671b21b30 Binary files /dev/null and b/src/main/webapp/resources/images/ccby.png differ diff --git a/src/main/webapp/resources/js/shib/idpselect_config.js b/src/main/webapp/resources/js/shib/idpselect_config.js index 8057ba26396..fd738d5439a 100644 --- a/src/main/webapp/resources/js/shib/idpselect_config.js +++ b/src/main/webapp/resources/js/shib/idpselect_config.js @@ -31,7 +31,7 @@ function IdPSelectUIParms() { this.preferredIdP = null; // Array of entityIds to always show this.hiddenIdPs = null; // Array of entityIds to delete this.ignoreKeywords = false; // Do we ignore the when looking for candidates - this.showListFirst = true; // Do we start with a list of IdPs or just the dropdown + this.showListFirst = false; // Do we start with a list of IdPs or just the dropdown this.samlIdPCookieTTL = 730; // in days this.setFocusTextBox = true; // Set to false to supress focus this.testGUI = false;