Skip to content

Commit 943b8da

Browse files
NicolasEYSSERICSilverYoCha
authored andcommitted
closing feature #5155 :
- adding new parameter to enable publications sharing - fixing collision between parent page and plugin page
1 parent c5a0026 commit 943b8da

File tree

8 files changed

+99
-24
lines changed

8 files changed

+99
-24
lines changed

kmelia/kmelia-config/src/main/config/xmlcomponents/kmax.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,30 @@
407407
<message lang="en">This feature allows to activate file sharing with persons who have no access to the portal</message>
408408
<message lang="de">Mit dieser Funktion können Sie die Dateifreigabe mit Personen, die keinen Zugang zu dem Portal haben, aktivieren.</message>
409409
</help>
410+
</parameter>
411+
<parameter>
412+
<name>usePublicationSharing</name>
413+
<label>
414+
<message lang="fr">Publications partageables</message>
415+
<message lang="en">Publications sharing</message>
416+
<message lang="de">Publications sharing</message>
417+
</label>
418+
<order>15</order>
419+
<mandatory>true</mandatory>
420+
<value>no</value>
421+
<type>checkbox</type>
422+
<updatable>always</updatable>
423+
<help>
424+
<message lang="fr">Ce paramètre permet de partager des publications avec des tiers non utilisateurs de la plate-forme.</message>
425+
<message lang="en">This feature allows to share publications with some persons who have no access to the platform.</message>
426+
<message lang="de">This feature allows to share publications with some persons who have no access to the platform.</message>
427+
</help>
428+
<warning>
429+
<message lang="fr">Attention! En cochant cette case, vous allez permettre aux gestionnaires de l'application de partager librement les publications avec des utilisateurs non référencés dans la plate-forme.</message>
430+
<message lang="en">Caution! By checking this box, you will enable managers to the application to freely share publications with users not identified in the platform.</message>
431+
<message lang="de">Caution! By checking this box, you will enable managers to the application to freely share publications with users not identified in the platform.</message>
432+
</warning>
433+
<personalSpaceValue>no</personalSpaceValue>
410434
</parameter>
411435
<parameter>
412436
<name>publicationSort</name>

kmelia/kmelia-config/src/main/config/xmlcomponents/kmelia.xml

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -898,8 +898,8 @@
898898
<type>checkbox</type>
899899
<updatable>always</updatable>
900900
<help>
901-
<message lang="fr">Ce paramètre permet d'activer le partage de fichiers à des tiers non utilisateurs de la plate-forme.</message>
902-
<message lang="en">This feature allows to activate file sharing with persons who have no access to the platform.</message>
901+
<message lang="fr">Ce paramètre permet de partager des fichiers avec des tiers non utilisateurs de la plate-forme.</message>
902+
<message lang="en">This feature allows to share files with some persons who have no access to the platform.</message>
903903
<message lang="de">Mit dieser Funktion können Sie die Dateifreigabe mit Personen, die keinen Zugang zu dem Portal haben, aktivieren.</message>
904904
</help>
905905
<warning>
@@ -1196,16 +1196,40 @@
11961196
<type>checkbox</type>
11971197
<updatable>always</updatable>
11981198
<help>
1199-
<message lang="fr">Ce paramètre permet d'activer le partage de dossiers à des tiers non utilisateurs de la plate-forme.</message>
1200-
<message lang="en">This feature allows to activate folders sharing with persons who have no access to the platform.</message>
1201-
<message lang="de">This feature allows to activate folders sharing with persons who have no access to the platform.</message>
1199+
<message lang="fr">Ce paramètre permet de partager des dossiers avec des tiers non utilisateurs de la plate-forme.</message>
1200+
<message lang="en">This feature allows to share folders with some persons who have no access to the platform.</message>
1201+
<message lang="de">This feature allows to share folders with some persons who have no access to the platform.</message>
12021202
</help>
12031203
<warning>
12041204
<message lang="fr">Attention! En cochant cette case, vous allez permettre aux gestionnaires de l'application de partager librement les dossiers avec des utilisateurs non référencés dans la plate-forme.</message>
12051205
<message lang="en">Caution! By checking this box, you will enable managers to the application to freely share folders with users not identified in the platform.</message>
12061206
<message lang="de">Caution! By checking this box, you will enable managers to the application to freely share folders with users not identified in the platform.</message>
12071207
</warning>
12081208
<personalSpaceValue>no</personalSpaceValue>
1209+
</parameter>
1210+
<parameter>
1211+
<name>usePublicationSharing</name>
1212+
<label>
1213+
<message lang="fr">Publications partageables</message>
1214+
<message lang="en">Publications sharing</message>
1215+
<message lang="de">Publications sharing</message>
1216+
</label>
1217+
<order>48</order>
1218+
<mandatory>true</mandatory>
1219+
<value>no</value>
1220+
<type>checkbox</type>
1221+
<updatable>always</updatable>
1222+
<help>
1223+
<message lang="fr">Ce paramètre permet de partager des publications avec des tiers non utilisateurs de la plate-forme.</message>
1224+
<message lang="en">This feature allows to share publications with some persons who have no access to the platform.</message>
1225+
<message lang="de">This feature allows to share publications with some persons who have no access to the platform.</message>
1226+
</help>
1227+
<warning>
1228+
<message lang="fr">Attention! En cochant cette case, vous allez permettre aux gestionnaires de l'application de partager librement les publications avec des utilisateurs non référencés dans la plate-forme.</message>
1229+
<message lang="en">Caution! By checking this box, you will enable managers to the application to freely share publications with users not identified in the platform.</message>
1230+
<message lang="de">Caution! By checking this box, you will enable managers to the application to freely share publications with users not identified in the platform.</message>
1231+
</warning>
1232+
<personalSpaceValue>no</personalSpaceValue>
12091233
</parameter>
12101234
<parameter>
12111235
<name>authorizedFileExtension</name>

kmelia/kmelia-war/src/main/java/com/stratelia/webactiv/kmelia/control/KmeliaSessionController.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,17 @@ public boolean isSuppressionOnlyForAdmin() {
517517
public boolean isFolderSharingEnabled() {
518518
return StringUtil.getBooleanValue(getComponentParameterValue("useFolderSharing"));
519519
}
520+
521+
public boolean isPublicationSharingEnabled() {
522+
boolean enabled = StringUtil.getBooleanValue(getComponentParameterValue("usePublicationSharing"));
523+
if (enabled) {
524+
if (isKmaxMode) {
525+
return isUserComponentAdmin();
526+
}
527+
return SilverpeasRole.admin.isInRole(getUserTopicProfile());
528+
}
529+
return false;
530+
}
520531

521532
public boolean isContentEnabled() {
522533
String parameterValue = getComponentParameterValue("tabContent");
@@ -658,15 +669,15 @@ public File generateDocument(final DocumentFormat inFormat, String fromPubId) {
658669
return document;
659670
}
660671

661-
public String getProfile() throws RemoteException {
672+
public String getProfile() {
662673
return getUserTopicProfile();
663674
}
664675

665-
public String getUserTopicProfile() throws RemoteException {
676+
public String getUserTopicProfile() {
666677
return getUserTopicProfile(null);
667678
}
668679

669-
public String getUserTopicProfile(String id) throws RemoteException {
680+
public String getUserTopicProfile(String id) {
670681
String nodeId = id;
671682
if (!StringUtil.isDefined(id)) {
672683
nodeId = getCurrentFolderId();
@@ -3273,12 +3284,7 @@ public String getAxisIdGlossary() {
32733284
}
32743285

32753286
public String getRole() {
3276-
try {
3277-
return getProfile();
3278-
} catch (RemoteException ex) {
3279-
throw new KmeliaRuntimeException("KmeliaBmEJB.getRole()",
3280-
SilverpeasRuntimeException.ERROR, "kmelia.MSG_ERR_GENERAL", ex);
3281-
}
3287+
return getProfile();
32823288
}
32833289

32843290
public String displayPath(Collection<NodeDetail> path, boolean linked, int beforeAfter) {

kmelia/kmelia-war/src/main/java/com/stratelia/webactiv/kmelia/servlets/KmeliaRequestRouter.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,8 @@ public String getDestination(String function, KmeliaSessionController kmelia,
697697

698698
request.setAttribute("LastAccess", kmelia.getLastAccess(kmeliaPublication.getPk()));
699699
request.setAttribute("PublicationRatingsAllowed", kmelia.isPublicationRatingAllowed());
700+
request.setAttribute("PublicationSharingAllowed", kmelia.isPublicationSharingEnabled() &&
701+
kmeliaPublication.getDetail().isValid());
700702

701703
destination = rootDestination + "publication.jsp";
702704
}

kmelia/kmelia-war/src/main/java/com/stratelia/webactiv/kmelia/servlets/ajax/handlers/GetProfileHandler.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,8 @@
2323
*/
2424
package com.stratelia.webactiv.kmelia.servlets.ajax.handlers;
2525

26-
import java.rmi.RemoteException;
27-
2826
import javax.servlet.http.HttpServletRequest;
2927

30-
import com.stratelia.silverpeas.silvertrace.SilverTrace;
3128
import com.stratelia.webactiv.kmelia.control.KmeliaSessionController;
3229
import com.stratelia.webactiv.kmelia.servlets.ajax.AjaxHandler;
3330

@@ -36,12 +33,7 @@ public class GetProfileHandler implements AjaxHandler {
3633
@Override
3734
public String handleRequest(HttpServletRequest request, KmeliaSessionController controller) {
3835
String id = request.getParameter("Id");
39-
try {
40-
return controller.getUserTopicProfile(id);
41-
} catch (RemoteException e) {
42-
SilverTrace.error("kmelia", "GetProfileHandler.handleRequest", "root.MSG_GEN_PARAM_VALUE", e);
43-
return e.getMessage();
44-
}
36+
return controller.getUserTopicProfile(id);
4537
}
4638

4739
}

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@
2525
--%>
2626
<%@page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
2727
<%@ taglib uri="http://www.silverpeas.com/tld/viewGenerator" prefix="view"%>
28+
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
29+
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
2830
<%@page import="org.silverpeas.kmelia.jstl.KmeliaDisplayHelper"%>
2931
<%@include file="checkKmelia.jsp" %>
3032

33+
<c:set var="userLanguage" value="${requestScope.resources.language}"/>
34+
<fmt:setLocale value="${userLanguage}"/>
35+
<view:setBundle bundle="${requestScope.resources.multilangBundle}"/>
36+
3137
<%
3238
PublicationDetail pubDetail = (PublicationDetail) request.getAttribute("CurrentPublicationDetail");
3339
@@ -141,5 +147,6 @@ function topicGoTo(id) {
141147
out.println(frame.printAfter());
142148
out.println(window.printAfter());
143149
%>
150+
<%@ include file="../../sharing/jsp/createTicketPopin.jsp" %>
144151
</body>
145152
</html>

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
boolean isWriterApproval = (Boolean) request.getAttribute("WriterApproval");
7777
boolean notificationAllowed = (Boolean) request.getAttribute("NotificationAllowed");
7878
boolean ratingsAllowed = (Boolean) request.getAttribute("PublicationRatingsAllowed");
79+
boolean sharingAllowed = (Boolean) request.getAttribute("PublicationSharingAllowed");
7980
boolean attachmentsEnabled = (Boolean) request.getAttribute("AttachmentsEnabled");
8081
boolean draftOutTaxonomyOK = (Boolean) request.getAttribute("TaxonomyOK");
8182
boolean validatorsOK = (Boolean) request.getAttribute("ValidatorsOK");
@@ -445,6 +446,16 @@
445446
function suggestDelegatedNews() {
446447
location.href= "<%=routerUrl%>SuggestDelegatedNews";
447448
}
449+
450+
function pubShare() {
451+
var sharingObject = {
452+
componentId: "<%=contextComponentId%>",
453+
type : "Publication",
454+
id : "<%=id%>",
455+
name : "<%=pubDetail.getName(language)%>"
456+
};
457+
createSharingTicketPopup(sharingObject);
458+
}
448459
</script>
449460
</head>
450461
<body class="yui-skin-sam" onunload="closeWindows()" onload="openSingleAttachment()" id="<%=componentId%>">
@@ -500,9 +511,14 @@
500511
}
501512
}
502513
514+
if (sharingAllowed) {
515+
operationPane.addOperation("useless", resources.getString("GML.share"), "javascript:pubShare()");
516+
}
503517
if (suppressionAllowed) {
518+
operationPane.addLine();
504519
operationPane.addOperation(deletePubliSrc, resources.getString("GML.delete"), "javascript:pubDeleteConfirm()");
505520
}
521+
506522
operationPane.addLine();
507523
}
508524
}
@@ -895,9 +911,10 @@
895911
<input type="hidden" name="ComponentId" value="<%=componentId%>"/>
896912
</form>
897913
</div>
914+
<%@ include file="../../sharing/jsp/createTicketPopin.jsp" %>
898915
<script type="text/javascript">
899916
/* declare the module myapp and its dependencies (here in the silverpeas module) */
900917
var myapp = angular.module('silverpeas.kmelia', ['silverpeas.services', 'silverpeas.directives']);
901918
</script>
902-
</body>
919+
</body>
903920
</html>

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,10 @@
422422
msg: errorMsg,
423423
nb: errorNb
424424
};
425+
426+
<% if (kmeliaMode && settings.getBoolean("isVignetteVisible", true)) {%>
425427
checkThumbnail(error);
428+
<% } %>
426429
427430
var result = false;
428431
switch(error.nb) {

0 commit comments

Comments
 (0)