Skip to content

Commit 6108e3a

Browse files
authored
Merge pull request #12318 from IQSS/11397-support-html-in-file-level-description
Added support for HTML in JSF UI for file description
2 parents d071141 + 8b92009 commit 6108e3a

5 files changed

Lines changed: 17 additions & 14 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
## Feature Request
2+
File metadata description will now support html in JSF UI. Is already supported in SPA.

src/main/webapp/editFilesFragment.xhtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@
459459
<label class="control-label" for="fileDescription" style="margin-right:1em; margin-top:.5em; vertical-align:top;">
460460
#{bundle.description}
461461
</label>
462-
<p:inputTextarea id="fileDescription" rows="2" cols="40" value="#{fileMetadata.description}" style="width:60%; margin-top:.5em;"/>
462+
<p:inputTextarea id="fileDescription" rows="2" cols="40" value="#{fileMetadata.description}" escape="false" style="width:60%; margin-top:.5em;"/>
463463
<p:watermark for="fileDescription" value="#{bundle['file.addDescription']}"/>
464464
<p:message for="fileDescription"/>
465465
</div>

src/main/webapp/file-info-fragment.xhtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
</div>
123123
</div>
124124
<div class="fileDescription small" jsf:rendered="#{hasDescription}">
125-
<h:outputText id="fileDescNonEmpty" value="#{fileMetadata.description}"/>
125+
<h:outputText id="fileDescNonEmpty" value="#{MarkupChecker:sanitizeBasicHTML(fileMetadata.description)}" escape="false"/>
126126
</div>
127127
<div class="file-tags-block" jsf:rendered="#{hasCategories or hasTags}">
128128
<ui:repeat value="#{fileMetadata.categories}" var="cat">

src/main/webapp/file.xhtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@
625625
<th scope="row">
626626
#{bundle['file.metadataTab.fileMetadata.description.label']}
627627
</th>
628-
<td>#{FilePage.fileMetadata.description}</td>
628+
<td><h:outputFormat value="#{MarkupChecker:sanitizeBasicHTML(FilePage.fileMetadata.description)}" escape="false"></h:outputFormat></td>
629629
</tr>
630630
</tbody>
631631
</table>

src/main/webapp/search-include-fragment.xhtml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
2-
xmlns:h="http://java.sun.com/jsf/html"
3-
xmlns:f="http://java.sun.com/jsf/core"
4-
xmlns:ui="http://java.sun.com/jsf/facelets"
5-
xmlns:c="http://java.sun.com/jsp/jstl/core"
6-
xmlns:p="http://primefaces.org/ui"
7-
xmlns:o="http://omnifaces.org/ui"
8-
xmlns:of="http://omnifaces.org/functions"
9-
xmlns:jsf="http://xmlns.jcp.org/jsf">
2+
xmlns:h="http://java.sun.com/jsf/html"
3+
xmlns:f="http://java.sun.com/jsf/core"
4+
xmlns:ui="http://java.sun.com/jsf/facelets"
5+
xmlns:c="http://java.sun.com/jsp/jstl/core"
6+
xmlns:p="http://primefaces.org/ui"
7+
xmlns:o="http://omnifaces.org/ui"
8+
xmlns:of="http://omnifaces.org/functions"
9+
xmlns:jsf="http://xmlns.jcp.org/jsf"
10+
xmlns:Strings="http://omnifaces.org/functions">
1011

1112
<c:set var="page" value="/dataverse/#{DataversePage.dataverse.alias}"/>
1213
<c:set var="cvocConf" value="#{settingsWrapper.getCVocConf(true)}"/>
@@ -539,7 +540,7 @@
539540

540541
<hr style="margin:.5em;border:0;"/>
541542

542-
<h:outputText value="#{Strings:abbreviate(result.descriptionNoSnippet, descriptionAbbreviationThreshold)}" rendered="#{result.descriptionSnippets.size() eq 0}"/>
543+
<h:outputText value="#{Strings:abbreviate(MarkupChecker:stripAllTags(result.descriptionNoSnippet), descriptionAbbreviationThreshold)}" escape="false" rendered="#{result.descriptionSnippets.size() eq 0}"/>
543544

544545
<ui:repeat value="#{result.descriptionSnippets}" var="snippet" varStatus="varStatus"
545546
rendered="#{result.descriptionSnippets.size() gt 0}">
@@ -607,7 +608,7 @@
607608
<h:outputText value="#{result.citationHtml != null ? result.citationHtml : result.citation}" escape="false"/>
608609
</div>
609610

610-
<h:outputText value="#{Strings:abbreviate(result.descriptionNoSnippet, descriptionAbbreviationThreshold)}" rendered="#{result.descriptionSnippets.size() eq 0}"/>
611+
<h:outputText value="#{Strings:abbreviate(MarkupChecker:stripAllTags(result.descriptionNoSnippet), descriptionAbbreviationThreshold)}" escape="false" rendered="#{result.descriptionSnippets.size() eq 0}"/>
611612

612613
<ui:repeat value="#{result.descriptionSnippets}" var="snippet" varStatus="varStatus"
613614
rendered="#{result.descriptionSnippets.size() gt 0}">
@@ -721,7 +722,7 @@
721722
</ui:repeat>
722723
</div>
723724

724-
<h:outputText value="#{Strings:abbreviate(result.descriptionNoSnippet, descriptionAbbreviationThreshold)}" rendered="#{result.descriptionSnippets.size() eq 0}"/>
725+
<h:outputText value="#{Strings:abbreviate(MarkupChecker:stripAllTags(result.descriptionNoSnippet), descriptionAbbreviationThreshold)}" escape="false" rendered="#{result.descriptionSnippets.size() eq 0}"/>
725726

726727
<ui:repeat value="#{result.descriptionSnippets}" var="snippet" varStatus="varStatus"
727728
rendered="#{result.descriptionSnippets.size() gt 0}">

0 commit comments

Comments
 (0)