-
Notifications
You must be signed in to change notification settings - Fork 542
3946 additional metadata elements #3973
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
61051bb
Merge branch 'develop' into 3946-additional-metadata-elements
sekmiller dbb62ef
#3946 Add display formatting for primitive DFT
sekmiller d56470e
#3946 Fix Failing Test
sekmiller 7905c3b
Merge branch 'develop' into 3946-additional-metadata-elements
sekmiller fb0e3e5
#3946 Add Validation Format text (and tests)
sekmiller 4cc9db9
#3946 Fix display escaping and other small changes
sekmiller 1179313
Merge branch 'develop' into 3946-additional-metadata-elements
sekmiller f531ad6
#3946 Cleanup sanitized text logic for target url display
sekmiller 712951c
Merge branch 'develop' into 3946-additional-metadata-elements
sekmiller fef4bb6
#3946 Fix reference to Escape boolean for compound DSF
sekmiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,8 +6,10 @@ | |
|
|
||
| package edu.harvard.iq.dataverse; | ||
|
|
||
| import edu.harvard.iq.dataverse.util.MarkupChecker; | ||
| import java.io.Serializable; | ||
| import java.util.Comparator; | ||
| import java.util.ResourceBundle; | ||
| import javax.persistence.Column; | ||
| import javax.persistence.Entity; | ||
| import javax.persistence.GeneratedValue; | ||
|
|
@@ -18,6 +20,7 @@ | |
| import javax.persistence.ManyToOne; | ||
| import javax.persistence.Table; | ||
| import javax.persistence.Transient; | ||
| import org.apache.commons.lang.StringUtils; | ||
|
|
||
| /** | ||
| * | ||
|
|
@@ -85,6 +88,31 @@ public String getValueForEdit() { | |
| public void setValueForEdit(String value) { | ||
| this.value = value; | ||
| } | ||
|
|
||
| public String getDisplayValue() { | ||
| String retVal = ""; | ||
| if (!StringUtils.isBlank(this.getValue()) && !DatasetField.NA_VALUE.equals(this.getValue())) { | ||
| String format = this.datasetField.getDatasetFieldType().getDisplayFormat(); | ||
| if (StringUtils.isBlank(format)) { | ||
| format = "#VALUE"; | ||
| } | ||
| String sanitizedValue = !this.datasetField.getDatasetFieldType().isSanitizeHtml() ? this.getValue() : MarkupChecker.sanitizeBasicHTML(this.getValue()); | ||
|
|
||
| if (!this.datasetField.getDatasetFieldType().isSanitizeHtml() && this.datasetField.getDatasetFieldType().isEscapeOutputText()){ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See other comment about possible new field type to reduce render logic complexity. May be more work upfront but less work/debugging in the future |
||
| sanitizedValue = MarkupChecker.stripAllTags(sanitizedValue); | ||
| } | ||
|
|
||
| // replace the special values in the format (note: we replace #VALUE last since we don't | ||
| // want any issues if the value itself has #NAME in it) | ||
| String displayValue = format | ||
| .replace("#NAME", this.datasetField.getDatasetFieldType().getTitle() == null ? "" : this.datasetField.getDatasetFieldType().getTitle()) | ||
| .replace("#EMAIL", ResourceBundle.getBundle("Bundle").getString("dataset.email.hiddenMessage")) | ||
| .replace("#VALUE", sanitizedValue); | ||
| retVal = displayValue; | ||
| } | ||
|
|
||
| return retVal; | ||
| } | ||
|
|
||
| public int getDisplayOrder() { | ||
| return displayOrder; | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: Check for uppercase
<Aas well as lowercase<a(In the long run, debugging may be easier to make this a new type of field rather than having complex display logic)