Skip to content

Commit

Permalink
Merge with all FoKUS patches
Browse files Browse the repository at this point in the history
  • Loading branch information
bjosel committed Nov 28, 2023
1 parent c822731 commit 5c54316
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 21 deletions.
44 changes: 27 additions & 17 deletions src/main/java/edu/harvard/iq/dataverse/util/FileUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,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
Expand Down Expand Up @@ -856,24 +858,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:
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/propertyFiles/Bundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ selectedFiles=Selected Files
htmlAllowedTitle=Allowed HTML Tags
htmlAllowedMsg=This field supports only certain <a class="popoverHTML" tabindex="0" role="button">HTML tags</a>.
htmlAllowedTags=&lt;a&gt;, &lt;b&gt;, &lt;blockquote&gt;, &lt;br&gt;, &lt;code&gt;, &lt;del&gt;, &lt;dd&gt;, &lt;dl&gt;, &lt;dt&gt;, &lt;em&gt;, &lt;hr&gt;, &lt;h1&gt;-&lt;h3&gt;, &lt;i&gt;, &lt;img&gt;, &lt;kbd&gt;, &lt;li&gt;, &lt;ol&gt;, &lt;p&gt;, &lt;pre&gt;, &lt;s&gt;, &lt;sup&gt;, &lt;sub&gt;, &lt;strong&gt;, &lt;strike&gt;, &lt;u&gt;, &lt;ul&gt;
vocabularyFaqMsg=More information about vocabularies, terms and URLs <a href="https://www.izus.uni-stuttgart.de/en/fokus/darus/#id-22d988a4-3" rel="help" target="_blank">here</a>.
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
Expand Down Expand Up @@ -814,7 +815,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.
Expand Down Expand Up @@ -1432,7 +1433,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/en/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}
Expand Down Expand Up @@ -1484,7 +1485,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.
Expand Down Expand Up @@ -2288,6 +2289,8 @@ dataset.additionalEntry=Additional Entry

#externaltools
externaltools.enable.browser.popups=You must enable popups in your browser to open external tools in a new window or tab.
externaltools.ViPLab.displayname=Explore in Browser (ViPLab)
externaltools.ViPLab.description=Execute configured Docker container via ViPLab

#mydata_fragment.xhtml
mydataFragment.infoAccess=Here are all the dataverses, datasets, and files you have access to. You can filter through them by publication status and roles.
Expand Down
5 changes: 5 additions & 0 deletions src/main/webapp/metadataFragment.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,11 @@
<h:outputText value="#{bundle.conditionalRequiredMsg}"/>
</p>
</ui:fragment>
<ui:fragment rendered="#{dsf.datasetFieldType.name == 'keyword'}">
<p class="help-block">
<h:outputText value="#{bundle.vocabularyFaqMsg}" escape="false"/>
</p>
</ui:fragment>
<ui:repeat value="#{dsf.datasetFieldCompoundValues}" var="compoundValue" varStatus="valCount">
<div class="form-group form-col-container col-sm-9 edit-compound-field" data-cvoc-parentfield="#{cvocConf.containsKey(dsf.datasetFieldType.id)?cvocConf.get(dsf.datasetFieldType.id).getString('field-name'):''}">
<!-- Sub Fields -->
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/resources/js/shib/idpselect_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <mdui:Keywords/> 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;
Expand Down

0 comments on commit 5c54316

Please sign in to comment.