From 4fefce47b61376386ee55ad4d2967271fa6e47ff Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Wed, 28 Feb 2018 18:44:35 +0100 Subject: [PATCH] OO-3349: add a special i18n separator between 2 full name of teachers --- .../core/_i18n/LocalStrings_de.properties | 1 + .../core/_i18n/LocalStrings_en.properties | 1 + .../core/_i18n/LocalStrings_fr.properties | 1 + .../olat/modules/lecture/LectureService.java | 3 ++- .../manager/LectureBlockRollCallDAO.java | 9 +++++---- .../lecture/manager/LectureServiceImpl.java | 9 +++++---- .../ui/LectureListRepositoryController.java | 11 ++++++---- .../ParticipantLectureBlocksController.java | 20 +++++++++---------- .../lecture/ui/TeacherOverviewController.java | 7 ++++--- 9 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/olat/core/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/core/_i18n/LocalStrings_de.properties index d6c3410951a..c3a77774933 100644 --- a/src/main/java/org/olat/core/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/core/_i18n/LocalStrings_de.properties @@ -110,6 +110,7 @@ toolbox.tools=Werkzeuge top=nach oben top.alt=Zum Anfang der Seite user.guest=Gast +user.fullname.separator=; warn.beta.feature=Achtung\! Diese Funktion befindet sich in einer Versuchsphase. Bitte beachten Sie, dass Fehler auftreten k\u00F6nnen wenn diese Funktion verwendet wird. warn.header=Achtung warn.notdispatched=Diese Seite wurde ver\u00E4ndert. Bitte beachten Sie allf\u00E4llige Meldungen. diff --git a/src/main/java/org/olat/core/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/core/_i18n/LocalStrings_en.properties index c676e293bfc..5cb8f61cc9f 100644 --- a/src/main/java/org/olat/core/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/core/_i18n/LocalStrings_en.properties @@ -110,6 +110,7 @@ toolbox.tools=Tools top=Go to top top.alt=Go to top of page user.guest=Guest +user.fullname.separator=/ warn.beta.feature=Attention\! This is a beta feature. Be aware that using this feature might result in unexpected behavior. warn.header=Warning warn.notdispatched=This page has been modified. Please consider any new messages. diff --git a/src/main/java/org/olat/core/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/core/_i18n/LocalStrings_fr.properties index c57a60c8dcb..e5b77dc2403 100644 --- a/src/main/java/org/olat/core/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/core/_i18n/LocalStrings_fr.properties @@ -110,6 +110,7 @@ toolbox.tools=Outils top=vers le haut top.alt=Vers le d\u00E9but de la page user.guest=invit\u00E9 +user.fullname.separator=/ warn.beta.feature=Attention\! Cette fonction se trouve dans la phase d'essai. Veuillez noter que des erreurs peuvent appara\u00EEtre si cette fonction est utilis\u00E9e. warn.header=Attention warn.notdispatched=Cette page a \u00E9t\u00E9 modifi\u00E9e. Veuillez tenir compte d'\u00E9ventuels messages. diff --git a/src/main/java/org/olat/modules/lecture/LectureService.java b/src/main/java/org/olat/modules/lecture/LectureService.java index cdf7d17df82..14aeb0457ba 100644 --- a/src/main/java/org/olat/modules/lecture/LectureService.java +++ b/src/main/java/org/olat/modules/lecture/LectureService.java @@ -503,9 +503,10 @@ public interface LectureService { * * @param entry * @param participant + * @param teacherSeparator The separator between the name of 2 teachers * @return */ - public List<LectureBlockAndRollCall> getParticipantLectureBlocks(RepositoryEntryRef entry, IdentityRef participant); + public List<LectureBlockAndRollCall> getParticipantLectureBlocks(RepositoryEntryRef entry, IdentityRef participant, String teacherSeparator); /** diff --git a/src/main/java/org/olat/modules/lecture/manager/LectureBlockRollCallDAO.java b/src/main/java/org/olat/modules/lecture/manager/LectureBlockRollCallDAO.java index 4680e95f3fa..e6134738024 100644 --- a/src/main/java/org/olat/modules/lecture/manager/LectureBlockRollCallDAO.java +++ b/src/main/java/org/olat/modules/lecture/manager/LectureBlockRollCallDAO.java @@ -322,7 +322,8 @@ public class LectureBlockRollCallDAO { return query.getResultList(); } - public List<LectureBlockAndRollCall> getParticipantLectureBlockAndRollCalls(RepositoryEntryRef entry, IdentityRef identity) { + public List<LectureBlockAndRollCall> getParticipantLectureBlockAndRollCalls(RepositoryEntryRef entry, IdentityRef identity, + String teacherSeaparator) { StringBuilder sb = new StringBuilder(); sb.append("select block, call, re.displayname") .append(" from lectureblock block") @@ -349,11 +350,11 @@ public class LectureBlockRollCallDAO { blockToRollCallMap.put(block.getKey(), new LectureBlockAndRollCall(displayname, block, rollCall)); } - appendCoaches(entry, blockToRollCallMap); + appendCoaches(entry, blockToRollCallMap, teacherSeaparator); return new ArrayList<>(blockToRollCallMap.values()); } - private void appendCoaches(RepositoryEntryRef entry, Map<Long,LectureBlockAndRollCall> blockToRollCallMap) { + private void appendCoaches(RepositoryEntryRef entry, Map<Long,LectureBlockAndRollCall> blockToRollCallMap, String teacherSeaparator) { // append the coaches StringBuilder sc = new StringBuilder(); sc.append("select block.key, coach") @@ -378,7 +379,7 @@ public class LectureBlockRollCallDAO { if(rollCall.getCoach() == null) { rollCall.setCoach(fullname); } else { - rollCall.setCoach(rollCall.getCoach() + ", " + fullname); + rollCall.setCoach(rollCall.getCoach() + " " + teacherSeaparator + " " + fullname); } } } diff --git a/src/main/java/org/olat/modules/lecture/manager/LectureServiceImpl.java b/src/main/java/org/olat/modules/lecture/manager/LectureServiceImpl.java index 98a8daf5b71..c996fc9edf4 100644 --- a/src/main/java/org/olat/modules/lecture/manager/LectureServiceImpl.java +++ b/src/main/java/org/olat/modules/lecture/manager/LectureServiceImpl.java @@ -174,8 +174,7 @@ public class LectureServiceImpl implements LectureService, UserDataDeletable, De @Override public RepositoryEntryLectureConfiguration updateRepositoryEntryLectureConfiguration(RepositoryEntryLectureConfiguration config) { - RepositoryEntryLectureConfiguration updatedConfig = lectureConfigurationDao.update(config); - return updatedConfig; + return lectureConfigurationDao.update(config); } @Override @@ -422,6 +421,7 @@ public class LectureServiceImpl implements LectureService, UserDataDeletable, De return new ArrayList<>(participants); } + @Override public List<Identity> syncParticipantSummaries(LectureBlock lectureBlock) { RepositoryEntry entry = lectureBlock.getEntry(); Date now = new Date(); @@ -841,8 +841,9 @@ public class LectureServiceImpl implements LectureService, UserDataDeletable, De } @Override - public List<LectureBlockAndRollCall> getParticipantLectureBlocks(RepositoryEntryRef entry, IdentityRef participant) { - return lectureBlockRollCallDao.getParticipantLectureBlockAndRollCalls(entry, participant); + public List<LectureBlockAndRollCall> getParticipantLectureBlocks(RepositoryEntryRef entry, IdentityRef participant, + String teacherSeaparator) { + return lectureBlockRollCallDao.getParticipantLectureBlockAndRollCalls(entry, participant, teacherSeaparator); } @Override diff --git a/src/main/java/org/olat/modules/lecture/ui/LectureListRepositoryController.java b/src/main/java/org/olat/modules/lecture/ui/LectureListRepositoryController.java index cc7d2284b08..cc87b8ff5ff 100644 --- a/src/main/java/org/olat/modules/lecture/ui/LectureListRepositoryController.java +++ b/src/main/java/org/olat/modules/lecture/ui/LectureListRepositoryController.java @@ -164,8 +164,9 @@ public class LectureListRepositoryController extends FormBasicController { for(LectureBlockWithTeachers block:blocks) { LectureBlock b = block.getLectureBlock(); StringBuilder teachers = new StringBuilder(); + String separator = translate("user.fullname.separator"); for(Identity teacher:block.getTeachers()) { - if(teachers.length() > 0) teachers.append(", "); + if(teachers.length() > 0) teachers.append(" ").append(separator).append(" "); teachers.append(userManager.getUserDisplayName(teacher)); } @@ -182,7 +183,7 @@ public class LectureListRepositoryController extends FormBasicController { tableModel.setObjects(rows); tableEl.reset(true, true, true); - deleteLecturesButton.setVisible(rows.size() > 0); + deleteLecturesButton.setVisible(!rows.isEmpty()); } @Override @@ -314,7 +315,7 @@ public class LectureListRepositoryController extends FormBasicController { } } - if(blocks.size() == 0) { + if(blocks.isEmpty()) { showWarning("error.atleastone.lecture"); } else { StringBuilder titles = new StringBuilder(); @@ -379,7 +380,9 @@ public class LectureListRepositoryController extends FormBasicController { private class ToolsController extends BasicController { - private Link deleteLink, copyLink, logLink; + private Link deleteLink; + private Link copyLink; + private Link logLink; private final LectureBlockRow row; diff --git a/src/main/java/org/olat/modules/lecture/ui/ParticipantLectureBlocksController.java b/src/main/java/org/olat/modules/lecture/ui/ParticipantLectureBlocksController.java index 886abc2b6c1..3cf7745d03a 100644 --- a/src/main/java/org/olat/modules/lecture/ui/ParticipantLectureBlocksController.java +++ b/src/main/java/org/olat/modules/lecture/ui/ParticipantLectureBlocksController.java @@ -202,8 +202,9 @@ public class ParticipantLectureBlocksController extends FormBasicController { private void loadModel() { Date now = new Date(); Formatter formatter = Formatter.getInstance(getLocale()); - - List<LectureBlockAndRollCall> rollCalls = lectureService.getParticipantLectureBlocks(entry, assessedIdentity); + + String separator = translate("user.fullname.separator"); + List<LectureBlockAndRollCall> rollCalls = lectureService.getParticipantLectureBlocks(entry, assessedIdentity, separator); List<LectureBlockAuditLog> sendAppealLogs = lectureService.getAuditLog(entry, assessedIdentity, LectureBlockAuditLog.Action.sendAppeal); Map<Long, Date> appealDates = new HashMap<>(); for(LectureBlockAuditLog sendAppealLog:sendAppealLogs) { @@ -385,15 +386,12 @@ public class ParticipantLectureBlocksController extends FormBasicController { } private void doPrint(UserRequest ureq) { - ControllerCreator printControllerCreator = new ControllerCreator() { - @Override - public Controller createController(UserRequest lureq, WindowControl lwControl) { - lwControl.getWindowBackOffice().getChiefController().addBodyCssClass("o_lectures_print"); - Controller printCtrl = new ParticipantLectureBlocksController(lureq, lwControl, entry, assessedIdentity, false, false); - listenTo(printCtrl); - return printCtrl; - } - }; + ControllerCreator printControllerCreator = (lureq, lwControl) -> { + lwControl.getWindowBackOffice().getChiefController().addBodyCssClass("o_lectures_print"); + Controller printCtrl = new ParticipantLectureBlocksController(lureq, lwControl, entry, assessedIdentity, false, false); + listenTo(printCtrl); + return printCtrl; + }; ControllerCreator layoutCtrlr = BaseFullWebappPopupLayoutFactory.createPrintPopupLayout(printControllerCreator); openInNewBrowserWindow(ureq, layoutCtrlr); } diff --git a/src/main/java/org/olat/modules/lecture/ui/TeacherOverviewController.java b/src/main/java/org/olat/modules/lecture/ui/TeacherOverviewController.java index c9878ae05e5..00ceeba1ada 100644 --- a/src/main/java/org/olat/modules/lecture/ui/TeacherOverviewController.java +++ b/src/main/java/org/olat/modules/lecture/ui/TeacherOverviewController.java @@ -89,11 +89,12 @@ public class TeacherOverviewController extends AbstractTeacherOverviewController for(LectureBlockWithTeachers blockWithTeachers:blocksWithTeachers) { LectureBlock block = blockWithTeachers.getLectureBlock(); - StringBuilder teachers = new StringBuilder(); + StringBuilder teachers = new StringBuilder(32); List<Identity> teacherList = blockWithTeachers.getTeachers(); - + + String separator = translate("user.fullname.separator"); for(Identity teacher:blockWithTeachers.getTeachers()) { - if(teachers.length() > 0) teachers.append(", "); + if(teachers.length() > 0) teachers.append(" ").append(separator).append(" "); teachers.append(userManager.getUserDisplayName(teacher)); } -- GitLab