Skip to content

Commit 021a9b5

Browse files
committed
Feature #10542
When a folder and its content (both subfolders and publications) are put into the bin, the actual operation operated by the KmeliaService is now a move instead of a simple node detail update. Rename the confirmation text when emptying the trash can. When the trash can is emptied, the folders deletion is now taken into account by the treeview. Fix a bug with the number of publications displayed with the folder name computed when a folder is deleted with its whole content.
1 parent 26de461 commit 021a9b5

File tree

10 files changed

+257
-187
lines changed

10 files changed

+257
-187
lines changed

kmelia/kmelia-configuration/src/main/config/properties/org/silverpeas/kmelia/multilang/kmeliaBundle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ kmelia.RightsSpecificEnable=Cliquez ici pour d\u00e9finir des droits sp\u00e9cif
187187
kmelia.PubInBasket=Cette publication est actuellement dans la corbeille
188188
Description=Description
189189
kmelia.SupervisorNotifSubject=Nouvelle publication en ligne
190-
ConfirmFlushTrashBean=Etes-vous sur de vouloir supprimer toutes les publications de la corbeille ?
190+
ConfirmFlushTrashBean=\u00cates-vous s\u00fbr de vouloir supprimer le contenu de la corbeille ?
191191
PubCreer=Cr\u00e9er une publication
192192
kmelia.RightsSpecificDisable=Cliquez ici pour ne plus utiliser les droits sp\u00e9cifiques...
193193
kmelia.ProcessDuration=Temps de traitement \:

kmelia/kmelia-configuration/src/main/config/properties/org/silverpeas/kmelia/multilang/kmeliaBundle_de.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ ConfirmDeletePath = Sind Sie sicher, den Speicherort l\u00f6schen zu wollen?
9090
UnknownAuthor = Ersteller unbekannt
9191
PubDeclass = Deklassifizierte Ver\u00f6ffentlichung
9292
NPubDeclass = Referenzierte Ver\u00f6ffentlichungen.
93-
ConfirmFlushTrashBean = Sind Sie sicher, alle Ver\u00f6ffentlichungen des Papierkorbes l\u00f6schen zu wollen ?
93+
ConfirmFlushTrashBean=M\u00f6chten Sie den M\u00fclleimer wirklich leeren?
9494
EmptyBasket = Papierkorb leeren
9595
kmelia.AddFile=Datei hinzuf\u00fcgen
9696

kmelia/kmelia-configuration/src/main/config/properties/org/silverpeas/kmelia/multilang/kmeliaBundle_en.properties

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ UnknownAuthor = Unknown author
117117

118118
PubDeclass = Unclassified publication
119119
NPubDeclass = Associated publication(s)
120-
121-
ConfirmFlushTrashBean = Do you really want to delete ALL trashcan's publication ?
120+
ConfirmFlushTrashBean=Do you really want to empty the trash can?
122121
EmptyBasket = Empty trashcan
123122
kmelia.AddFile = Add a file
124123

@@ -505,7 +504,7 @@ kmelia.publications.batch.update.none=No publication has been modified
505504
kmelia.publications.batch.update.success = {0} publications modified successfully
506505
kmelia.publications.batch.update.fail = {0} publications could not be modified
507506
kmelia.publications.batch.update = You are about to modify the content of <b>{0} publications</b> ... Only the fields filled in will be applied to these publications.
508-
kmelia.ExportPDFApplication=Alle PDFs der Bewerbung zusammenführen
507+
kmelia.ExportPDFApplication=Alle PDFs der Bewerbung zusammenf\u00fchren
509508
kmelia.LocalPathMandatory=A local place is mandatory!
510509
kmax.ExportPublicationsFound=Export found publications
511510
kmelia.RightsSpecificEnable=Click here to set specific access rights...

kmelia/kmelia-configuration/src/main/config/properties/org/silverpeas/kmelia/multilang/kmeliaBundle_fr.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ kmelia.RightsSpecificEnable=Cliquez ici pour d\u00e9finir des droits sp\u00e9cif
188188
kmelia.PubInBasket=Cette publication est actuellement dans la corbeille
189189
Description=Description
190190
kmelia.SupervisorNotifSubject=Nouvelle publication en ligne
191-
ConfirmFlushTrashBean=Etes-vous sur de vouloir supprimer toutes les publications de la corbeille ?
191+
ConfirmFlushTrashBean=\u00cates-vous s\u00fbr de vouloir supprimer le contenu de la corbeille ?
192192
PubCreer=Cr\u00e9er une publication
193193
kmelia.RightsSpecificDisable=Cliquez ici pour ne plus utiliser les droits sp\u00e9cifiques...
194194
kmelia.ProcessDuration=Temps de traitement \:

kmelia/kmelia-library/src/main/java/org/silverpeas/components/kmelia/service/DefaultKmeliaService.java

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -323,9 +323,10 @@ public List<KmeliaPublication> getLatestAuthorizedPublications(String instanceId
323323
.limitTo(limit));
324324
return asKmeliaPublication(pubDetails);
325325
});
326+
String count = result == null ? "" : String.valueOf(result.size());
326327
SilverLogger.getLogger(this)
327328
.debug(() -> format("getting {0} latest authorized publications of instance {1} in {2}",
328-
result.size(), instanceId, formatDurationHMS(System.currentTimeMillis() - start)));
329+
count, instanceId, formatDurationHMS(System.currentTimeMillis() - start)));
329330
return result;
330331
}
331332

@@ -511,13 +512,6 @@ public NodeDetail getSubTopicDetail(NodePK pk) {
511512
return subTopic;
512513
}
513514

514-
/**
515-
* Delete a topic and all descendants. Delete all links between descendants and publications. This
516-
* publications will be visible in the Declassified zone. Delete All subscriptions and favorites
517-
* on this topics and all descendants
518-
* @param pkToDelete the id of the topic to delete
519-
* @since 1.0
520-
*/
521515
@Override
522516
@Transactional(Transactional.TxType.REQUIRED)
523517
public void deleteTopic(NodePK pkToDelete) {
@@ -533,7 +527,8 @@ public void deleteTopic(NodePK pkToDelete) {
533527
for (PublicationDetail onePubToCheck : pubsToCheck) {
534528
final KmeliaPublication kmeliaPub = fromDetail(onePubToCheck, oneNodeToDelete);
535529
if (!kmeliaPub.isAlias()) {
536-
sendPublicationInBasket(kmeliaPub.getPk());
530+
// delete definitively the publication
531+
deletePublication(kmeliaPub.getPk());
537532
} else {
538533
// remove only the alias
539534
final Collection<Location> aliases = singletonList(kmeliaPub.getLocation());
@@ -1455,7 +1450,6 @@ private void sendPublicationInBasket(PublicationPK pubPK) {
14551450
private void sendTopicInBasket(NodeDetail topic) {
14561451
NodePK trash = new NodePK(NodePK.BIN_NODE_ID,
14571452
topic.getIdentifier().getComponentInstanceId());
1458-
topic.setFatherPK(trash);
14591453

14601454
// get all the tree of folders, rooted to the topic, to be sent in the basket with the topic
14611455
final Collection<NodeDetail> children = nodeService.getDescendantDetails(topic.getNodePK());
@@ -1477,7 +1471,7 @@ private void sendTopicInBasket(NodeDetail topic) {
14771471
}
14781472
}
14791473

1480-
nodeService.setDetail(topic);
1474+
nodeService.moveNode(topic.getNodePK(), trash);
14811475
}
14821476

14831477
@Override
@@ -3929,19 +3923,19 @@ public List<String> deletePublications(List<String> publiIds, NodePK topicId, St
39293923

39303924
@Transactional(Transactional.TxType.REQUIRED)
39313925
@Override
3932-
public void deleteTopic(@NonNull NodePK topic, @NonNull NodePK parent, String userId) {
3926+
public void deleteTopic(@NonNull NodePK topic, String userId) {
39333927
Objects.requireNonNull(topic);
3934-
Objects.requireNonNull(parent);
39353928
if (topic.isTrash() || topic.isRoot()) {
39363929
return;
39373930
}
39383931
NodeDetail folder = getNodeHeader(topic);
3932+
boolean isInTrash = nodeService.getPath(topic).get(1).getId().equals(NodePK.BIN_NODE_ID);
39393933
// check if user is allowed to delete this topic
39403934
NodePK root = new NodePK(NodePK.ROOT_NODE_ID, topic.getInstanceId());
39413935
if (SilverpeasRole.ADMIN.isInRole(getUserTopicProfile(topic, userId)) ||
39423936
SilverpeasRole.ADMIN.isInRole(getUserTopicProfile(root, userId)) ||
39433937
SilverpeasRole.ADMIN.isInRole(getUserTopicProfile(folder.getFatherPK(), userId))) {
3944-
if (parent.isTrash() && folder.getFatherPK().isTrash()) {
3938+
if (isInTrash) {
39453939
deleteTopic(topic);
39463940
} else {
39473941
sendTopicInBasket(folder);

0 commit comments

Comments
 (0)