From 4b40d9ab01fb34216d6e995c8a99850c49187a5a Mon Sep 17 00:00:00 2001 From: srosse <stephane.rosse@frentix.com> Date: Tue, 7 Aug 2018 18:52:07 +0200 Subject: [PATCH] OO-3593: cut page name which are too long for the short title but use the complete name for the long title of the course element --- .../org/olat/course/editor/MultiSPController.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/olat/course/editor/MultiSPController.java b/src/main/java/org/olat/course/editor/MultiSPController.java index f62b120aa0d..278d13e1df3 100644 --- a/src/main/java/org/olat/course/editor/MultiSPController.java +++ b/src/main/java/org/olat/course/editor/MultiSPController.java @@ -73,8 +73,8 @@ public class MultiSPController extends FormBasicController { private FormLink sameLevel; private FormLink asChild; private MultipleSelectionElement rootSelection; - private final Map<String,MultipleSelectionElement> identToSelectionMap = new HashMap<String,MultipleSelectionElement>(); - private final List<MultipleSelectionElement> nodeSelections = new ArrayList<MultipleSelectionElement>(); + private final Map<String,MultipleSelectionElement> identToSelectionMap = new HashMap<>(); + private final List<MultipleSelectionElement> nodeSelections = new ArrayList<>(); private int position; private CourseEditorTreeNode selectedNode; @@ -252,7 +252,14 @@ public class MultiSPController extends FormBasicController { private CourseNode createCourseNode(VFSItem item, String type) { CourseNodeConfiguration newNodeConfig = CourseNodeFactory.getInstance().getCourseNodeConfiguration(type); CourseNode newNode = newNodeConfig.getInstance(); - newNode.setShortTitle(item.getName()); + String name = item.getName(); + if (name.length() > NodeConfigFormController.SHORT_TITLE_MAX_LENGTH) { + String shortName = name.substring(0, NodeConfigFormController.SHORT_TITLE_MAX_LENGTH - 1); + newNode.setShortTitle(shortName); + newNode.setLongTitle(name); + } else { + newNode.setShortTitle(name); + } newNode.setLearningObjectives(item.getName()); newNode.setNoAccessExplanation("You don't have access"); return newNode; @@ -298,7 +305,7 @@ public class MultiSPController extends FormBasicController { private final int indentation; private final VFSItem item; private final String id; - private final List<MultipleSelectionElement> children = new ArrayList<MultipleSelectionElement>(); + private final List<MultipleSelectionElement> children = new ArrayList<>(); public SelectNodeObject(VFSItem item, String id, int indentation) { this.id = id; -- GitLab