Skip to content

Commit f39ba95

Browse files
committed
Bug #14732
The regression was introduced with the fix of the bug #14661. Ensure now the access to a given publication is done correctly by clicking on its name wrapped by a span tag with at least the class 'pub-link' (a shortcut/alias cannot be d&d like a normal publication). In the seeAlso.tag, encode for HTML both the description and the title of a referenced publication.
1 parent 8bd631a commit f39ba95

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

kmelia/kmelia-war/src/main/java/org/silverpeas/components/kmelia/servlets/renderers/PublicationsRenderer.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,8 @@ void renderPublicationDefaultFragment(KmeliaPublication aPub,
561561
" a.addEventListener('click', function(e) {\n" +
562562
" e.preventDefault();\n" +
563563
" e.stopPropagation();\n" +
564-
" const pubId = this.querySelector('span.jstree-draggable').getAttribute('id').trim().slice(4);\n" +
564+
" const pubId = this.querySelector('span.pub-link').getAttribute('id').trim().slice" +
565+
"(4);\n" +
565566
" publicationGoTo(pubId);\n" +
566567
" });" +
567568
" });" +
@@ -664,14 +665,19 @@ private static void renderPublicationRef(PublicationDetail pub, String name, Wri
664665

665666
private static void renderPublicationLink(PublicationDetail pub, String name, Writer writer,
666667
PublicationFragmentSettings fragmentSettings) throws IOException {
667-
writer.write("<div class=\"");
668-
writer.write(fragmentSettings.getPubColor());
669-
writer.write("\"><a href=\"#\"><span class=\"" + fragmentSettings.getHighlightClass() + "\">");
668+
if (StringUtil.isDefined(fragmentSettings.getPubColor())) {
669+
writer.write("<div class=\"");
670+
writer.write(fragmentSettings.getPubColor());
671+
writer.write("\"><a href=\"#\">");
672+
} else {
673+
writer.write("<div><a href=\"#\">");
674+
}
675+
writer.write("<span id=\"pub-" + pub.getPK().getId() + "\" class=\"pub-link");
670676
if (fragmentSettings.isDraggable()) {
671-
writer.write("<span class=\"jstree-draggable\" id=\"pub-" + pub.getPK().getId() + "\">");
677+
writer.write(" jstree-draggable\">");
672678
writer.write(name);
673-
writer.write(END_SPAN);
674679
} else {
680+
writer.write("\">");
675681
writer.write(name);
676682
}
677683
writer.write("</span></a></div>");

kmelia/kmelia-war/src/main/webapp/WEB-INF/tags/silverpeas/kmelia/seeAlso.tag

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@
6565
<c:set var="seeAlsoClassName" value="seeAlsoReverse"/>
6666
</c:if>
6767
<li id="link-${seeAlso.id}" class="showActionsOnMouseOver ${seeAlsoClassName}">
68-
<a href="${seeAlso.pub.permalink}" class="sp-permalink" title="${seeAlso.pub.description}">${seeAlso.pub.name} <span>- <view:formatDate value="${seeAlso.pub.lastUpdateDate}"/></span></a>
68+
<a href="${seeAlso.pub.permalink}" class="sp-permalink"
69+
title="${silfn:escapeHtmlWhitespaces(seeAlso.pub.description)}">
70+
${silfn:escapeHtml(seeAlso.pub.name)}
71+
<span>-
72+
<view:formatDate
73+
value="${seeAlso.pub.lastUpdateDate}"/></span></a>
6974
<c:if test="${not readOnly && not seeAlso.reverse}">
7075
<div class="actionShownOnMouseOver"><a class="delete" href="#" onclick="deleteLink('${seeAlso.id}');return false;" title="${labelDelete}">${labelDelete}</a></div>
7176
</c:if>
@@ -76,7 +81,8 @@
7681

7782
<script type="text/javascript">
7883
function deleteLink(id) {
79-
var ajaxRequest = sp.ajaxRequest(webContext+"/services/private/publications/${publicationPK.instanceId}/${publicationPK.id}/links/"+id).byDeleteMethod();
84+
let ajaxRequest =
85+
sp.ajaxRequest(webContext+"/services/private/publications/${publicationPK.instanceId}/${publicationPK.id}/links/"+id).byDeleteMethod();
8086
ajaxRequest.send().then(function() {
8187
$("#link-"+id).remove();
8288
if ($("#block-seeAlso ul li").size() === 0) {

0 commit comments

Comments
 (0)