Skip to content

Commit bd75bf4

Browse files
SilverDavmmoqui
authored andcommitted
Bug #13261: Mandatory classification not taken into account after a publication update if classification is became mandatory
1 parent 9b73bd2 commit bd75bf4

File tree

2 files changed

+21
-23
lines changed

2 files changed

+21
-23
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
import org.silverpeas.core.io.upload.UploadedFile;
6464
import org.silverpeas.core.node.model.NodeDetail;
6565
import org.silverpeas.core.node.model.NodePK;
66+
import org.silverpeas.core.pdc.pdc.model.ClassifyPosition;
6667
import org.silverpeas.core.security.authorization.PublicationAccessControl;
6768
import org.silverpeas.core.subscription.SubscriptionResource;
6869
import org.silverpeas.core.util.DateUtil;
@@ -375,8 +376,14 @@ public String getDestination(String function, KmeliaSessionController kmelia,
375376
} else if ("ToPublicationHeader".equals(function)) {
376377
String action = (String) request.getAttribute("Action");
377378
if ("UpdateView".equals(action)) {
378-
request.setAttribute("AttachmentsEnabled", false);
379379
request.setAttribute("TaxonomyOK", kmelia.isPublicationTaxonomyOK());
380+
List<ClassifyPosition> positions = kmelia.getSessionPubliOrClone().getPDCPositions();
381+
boolean isPublicationClassifiedOnPDC = true;
382+
if (positions.isEmpty()) {
383+
isPublicationClassifiedOnPDC = false;
384+
}
385+
request.setAttribute("isPublicationClassifiedOnPDC", isPublicationClassifiedOnPDC);
386+
request.setAttribute("AttachmentsEnabled", false);
380387
request.setAttribute("ValidatorsOK", kmelia.isPublicationValidatorsOK());
381388
request.setAttribute("Publication", kmelia.getSessionPubliOrClone());
382389
setupRequestForContributionManagementContext(request,
@@ -387,6 +394,7 @@ public String getDestination(String function, KmeliaSessionController kmelia,
387394
request.setAttribute("AttachmentsEnabled", kmelia.isAttachmentsEnabled());
388395
request.setAttribute("TaxonomyOK", true);
389396
request.setAttribute("ValidatorsOK", true);
397+
request.setAttribute("isPublicationClassifiedOnPDC", false);
390398
}
391399

392400
request.setAttribute("Path", kmelia.getTopicPath(kmelia.getCurrentFolderId()));

kmelia/kmelia-war/src/main/webapp/kmelia/jsp/publicationManager.jsp

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,10 @@
8282
String profile = (String) request.getAttribute("Profile");
8383
String action = (String) request.getAttribute("Action");
8484
String id = (String) request.getAttribute("PubId");
85-
String currentLang = (String) request.getAttribute("Language");
8685
List<NodeDetail> path = (List<NodeDetail>) request.getAttribute("Path");
8786
boolean draftOutTaxonomyOK = (Boolean) request.getAttribute("TaxonomyOK");
8887
boolean draftOutValidatorsOK = (Boolean) request.getAttribute("ValidatorsOK");
89-
90-
String resultThumbnail = request.getParameter("resultThumbnail");
91-
boolean errorThumbnail = false;
92-
if(resultThumbnail != null && !"ok".equals(resultThumbnail)){
93-
errorThumbnail = true;
94-
}
88+
boolean isPublicationClassifiedOnPDC = (Boolean) request.getAttribute("isPublicationClassifiedOnPDC");
9589
9690
PublicationDetail volatilePublication = (PublicationDetail) request.getAttribute("VolatilePublication");
9791
Form extraForm = (Form) request.getAttribute("ExtraForm");
@@ -244,12 +238,8 @@
244238
245239
String backUrl = URLUtil.getFullApplicationURL(request) + URLUtil.getURL("kmelia", null, componentId) + "ToUpdatePublicationHeader";
246240
%>
247-
248-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
249-
<html xmlns="http://www.w3.org/1999/xhtml">
250-
<head>
251-
<title></title>
252-
<view:looknfeel withFieldsetStyle="true" withCheckFormScript="true"/>
241+
<view:sp-page>
242+
<view:sp-head-part withCheckFormScript="true" withFieldsetStyle="true">
253243
<view:includePlugin name="datepicker"/>
254244
<view:includePlugin name="popup"/>
255245
<view:includePlugin name="wysiwyg"/>
@@ -400,7 +390,7 @@
400390
errorNb++;
401391
});
402392
403-
<% if(!kmaxMode && "New".equals(action)) { %>
393+
<% if(!kmaxMode && ("New".equals(action) || !isPublicationClassifiedOnPDC)) { %>
404394
<view:pdcValidateClassification errorCounter="errorNb" errorMessager="errorMsg"/>
405395
<% } %>
406396
@@ -487,8 +477,8 @@
487477
});
488478
});
489479
</script>
490-
</head>
491-
<body id="<%=componentId%>" class="publicationManager" onunload="closeWindows()">
480+
</view:sp-head-part>
481+
<view:sp-body-part id="<%=componentId%>" cssClass="publicationManager">
492482
<%
493483
Window window = gef.getWindow();
494484
OperationPane operationPane = window.getOperationPane();
@@ -595,7 +585,7 @@
595585
<div class="field" id="pubNameArea">
596586
<label for="pubName" class="txtlibform"><%=resources.getString("PubTitre")%></label>
597587
<div class="champs">
598-
<input type="text" name="KmeliaPubName" id="pubName" value="<%=name%>" size="68" maxlength="400" />&nbsp;<img src="<%=mandatorySrc%>" width="5" height="5" border="0"/>
588+
<input type="text" name="KmeliaPubName" id="pubName" value="<%=name%>" size="68" maxlength="400" />&nbsp;<img src="<%=mandatorySrc%>" alt="<%=resources.getString("GML.requiredField")%>" width="5" height="5"/>
599589
</div>
600590
</div>
601591

@@ -605,7 +595,7 @@
605595
<div class="champs">
606596
<textarea rows="4" cols="65" name="KmeliaPubDescription" id="pubDesc"><%=description%></textarea>
607597
<% if (isFieldDescriptionMandatory) {%>
608-
<img src="<%=mandatorySrc%>" width="5" height="5" border="0"/>
598+
<img src="<%=mandatorySrc%>" alt="<%=resources.getString("GML.requiredField")%>" width="5" height="5"/>
609599
<% }%>
610600
</div>
611601
</div>
@@ -678,7 +668,7 @@
678668
<% } else {%>
679669
<textarea name="Valideur" id="Valideur" rows="4" cols="40" readonly="readonly"><%=targetValidatorName%></textarea>
680670
<% }%>
681-
<input type="hidden" name="KmeliaPubValideurId" id="ValideurId" value="<%=targetValidatorId%>"/><%=link%>&nbsp;<img src="<%=mandatorySrc%>" width="5" height="5" border="0"/>
671+
<input type="hidden" name="KmeliaPubValideurId" id="ValideurId" value="<%=targetValidatorId%>"/><%=link%>&nbsp;<img src="<%=mandatorySrc%>" alt="<%=resources.getString("GML.requiredField")%>" width="5" height="5"/>
682672
</div>
683673
</div>
684674
<% } %>
@@ -776,7 +766,7 @@
776766
} %>
777767

778768
<div class="legend">
779-
<img src="<%=mandatorySrc%>" width="5" height="5"/> : <%=resources.getString("GML.requiredField")%>
769+
<img alt="<%=resources.getString("GML.requiredField")%>" src="<%=mandatorySrc%>" width="5" height="5"/> : <%=resources.getString("GML.requiredField")%>
780770
</div>
781771

782772
</form>
@@ -829,5 +819,5 @@
829819
</ul>
830820
</div>
831821
<view:progressMessage/>
832-
</body>
833-
</html>
822+
</view:sp-body-part>
823+
</view:sp-page>

0 commit comments

Comments
 (0)