From 98c6089924204fdbf9557df9842d471f675dd326 Mon Sep 17 00:00:00 2001 From: srosse <stephane.rosse@frentix.com> Date: Tue, 3 Sep 2019 08:51:03 +0200 Subject: [PATCH] OO-4150: add placeholder message for teachers in user tool --- .../org/olat/modules/coach/CoachingService.java | 4 ++++ .../coach/manager/CoachingServiceImpl.java | 6 ++++++ .../lecture/ui/_i18n/LocalStrings_de.properties | 1 + .../lecture/ui/_i18n/LocalStrings_en.properties | 1 + .../lecture/ui/_i18n/LocalStrings_fr.properties | 1 + .../ui/_i18n/LocalStrings_pt_BR.properties | 1 + .../ui/profile/IdentityProfileController.java | 15 +++++++++++++++ .../lecture/ui/profile/_content/profile.html | 3 +++ 8 files changed, 32 insertions(+) diff --git a/src/main/java/org/olat/modules/coach/CoachingService.java b/src/main/java/org/olat/modules/coach/CoachingService.java index 0bbb30c3289..f7291b97125 100644 --- a/src/main/java/org/olat/modules/coach/CoachingService.java +++ b/src/main/java/org/olat/modules/coach/CoachingService.java @@ -22,6 +22,7 @@ package org.olat.modules.coach; import java.util.List; import java.util.Locale; +import org.olat.basesecurity.IdentityRef; import org.olat.core.id.Identity; import org.olat.course.assessment.UserEfficiencyStatement; import org.olat.group.BusinessGroup; @@ -43,6 +44,9 @@ import org.olat.user.propertyhandlers.UserPropertyHandler; public interface CoachingService { public CoachingSecurity isCoach(Identity identity); + + //TODO absence remove it in a few weeks + public boolean isTeacher(IdentityRef identity); public List<RepositoryEntry> getStudentsCourses(Identity coach, Identity student); diff --git a/src/main/java/org/olat/modules/coach/manager/CoachingServiceImpl.java b/src/main/java/org/olat/modules/coach/manager/CoachingServiceImpl.java index ee29250f258..aa8cedc1895 100644 --- a/src/main/java/org/olat/modules/coach/manager/CoachingServiceImpl.java +++ b/src/main/java/org/olat/modules/coach/manager/CoachingServiceImpl.java @@ -27,6 +27,7 @@ import java.util.Locale; import java.util.Map; import org.olat.basesecurity.GroupRoles; +import org.olat.basesecurity.IdentityRef; import org.olat.core.id.Identity; import org.olat.course.assessment.UserEfficiencyStatement; import org.olat.course.assessment.manager.EfficiencyStatementManager; @@ -75,6 +76,11 @@ public class CoachingServiceImpl implements CoachingService { return new CoachingSecurity(masterCoach, coach, teacher); } + @Override + public boolean isTeacher(IdentityRef identity) { + return coachingDao.isTeacher(identity); + } + @Override public List<RepositoryEntry> getStudentsCourses(Identity coach, Identity student) { return coachingDao.getStudentsCourses(coach, student); diff --git a/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_de.properties index 6940c5b7ffd..f1de0643fd7 100644 --- a/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_de.properties @@ -508,6 +508,7 @@ warning.choose.at.least.one.appeal=Sie m\u00FCssen mindestens einen Rekurs w\u00 warning.choose.at.least.one.notice=Sie m\u00FCssen mindestens eine Absenz/Dispens w\u00E4hlen. warning.edit.lecture=Absenzenerfassung ist deaktiviert. warning.repositoryentry.deleted=$org.olat.repository\:repositoryentry.deleted +warning.teacher.user.tool= warning.teachers.at.least.one.contact=Es gibt kein Dozent zu kontaktieren whole.day=ganzer Tag wizard.entries.label.block=<strong>{0}</strong> <small>{1}</small> ({2} Lektionenblock) diff --git a/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_en.properties index a71f7b11abe..6de88f533ad 100644 --- a/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_en.properties @@ -508,6 +508,7 @@ warning.choose.at.least.one.appeal=You need to choose at least one appeal warning.choose.at.least.one.notice=You need to choose at least one absence/dispensation warning.edit.lecture=Roll call is deactivated. warning.repositoryentry.deleted=$org.olat.repository\:repositoryentry.deleted +warning.teacher.user.tool= warning.teachers.at.least.one.contact=There isn't any teacher to contact whole.day=Whole day wizard.entries.label.block=<strong>{0}</strong> <small>{1}</small> ({2} lectures block) diff --git a/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_fr.properties index 735deb252ae..969fb3dd0fd 100644 --- a/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_fr.properties @@ -508,6 +508,7 @@ warning.choose.at.least.one.appeal=S'il-vous-pla\u00EEt, s\u00E9lectionnez au mo warning.choose.at.least.one.notice=Vous devez s\u00E9lectionner au moins une absence / dispense. warning.edit.lecture=Le contr\u00F4le d'absence est d\u00E9sactiv\u00E9. warning.repositoryentry.deleted=$org.olat.repository\:repositoryentry.deleted +warning.teacher.user.tool= warning.teachers.at.least.one.contact=Il n'y a pas de charg\u00E9s de cours \u00E0 contacter. whole.day=Journ\u00E9e enti\u00E8re wizard.entries.label.block=<strong>{0}</strong> <small>{1}</small> ({2} cours bloc) diff --git a/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_pt_BR.properties b/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_pt_BR.properties index 7ef393757cf..86ebfabd875 100644 --- a/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_pt_BR.properties +++ b/src/main/java/org/olat/modules/lecture/ui/_i18n/LocalStrings_pt_BR.properties @@ -355,3 +355,4 @@ total=Total unoverride.lecture=Interromper altera\u00E7\u00E3o/sobreposi\u00E7\u00E3o warning.edit.lecture=Chamada (Roll Call) est\u00E1 inativa warning.repositoryentry.deleted=$org.olat.repository\:repositoryentry.deleted +warning.teacher.user.tool=S diff --git a/src/main/java/org/olat/modules/lecture/ui/profile/IdentityProfileController.java b/src/main/java/org/olat/modules/lecture/ui/profile/IdentityProfileController.java index 015194697b6..c35cff8f6b0 100644 --- a/src/main/java/org/olat/modules/lecture/ui/profile/IdentityProfileController.java +++ b/src/main/java/org/olat/modules/lecture/ui/profile/IdentityProfileController.java @@ -41,11 +41,14 @@ import org.olat.core.gui.control.generic.wizard.StepsMainRunController; import org.olat.core.id.Identity; import org.olat.core.id.context.ContextEntry; import org.olat.core.id.context.StateEntry; +import org.olat.core.util.StringHelper; import org.olat.core.util.Util; +import org.olat.modules.coach.CoachingService; import org.olat.modules.lecture.AbsenceNoticeType; import org.olat.modules.lecture.model.EditAbsenceNoticeWrapper; import org.olat.modules.lecture.ui.AppealListRepositoryController; import org.olat.modules.lecture.ui.LectureRepositoryAdminController; +import org.olat.modules.lecture.ui.LectureRoles; import org.olat.modules.lecture.ui.LecturesSecurityCallback; import org.olat.modules.lecture.ui.ParticipantLecturesOverviewController; import org.olat.modules.lecture.ui.coach.DispensationsController; @@ -53,6 +56,7 @@ import org.olat.modules.lecture.ui.wizard.AbsenceNotice3LecturesEntriesStep; import org.olat.modules.lecture.ui.wizard.AbsenceNoticeCancelStepCallback; import org.olat.modules.lecture.ui.wizard.AbsenceNoticeFinishStepCallback; import org.olat.user.DisplayPortraitController; +import org.springframework.beans.factory.annotation.Autowired; /** * @@ -84,6 +88,9 @@ public class IdentityProfileController extends BasicController implements Activa private DailyOverviewProfilController dailyOverviewCtrl; private ParticipantLecturesOverviewController lecturesCtrl; + @Autowired + private CoachingService coachingService; + public IdentityProfileController(UserRequest ureq, WindowControl wControl, Identity profiledIdentity, LecturesSecurityCallback secCallback, boolean withBack) { super(ureq, wControl, Util.createPackageTranslator(LectureRepositoryAdminController.class, ureq.getLocale())); @@ -103,6 +110,14 @@ public class IdentityProfileController extends BasicController implements Activa listenTo(userDescr); mainVC.put("userDescr", userDescr.getInitialComponent()); + //TODO absences remove in a few weeks + if(secCallback.viewAs() == LectureRoles.participant) { + String msg = translate("warning.teacher.user.tool"); + if(StringHelper.containsNonWhitespace(msg) && coachingService.isTeacher(getIdentity())) { + mainVC.contextPut("teacherMessage", msg); + } + } + //new absence, new notice of absence, new dispensation addAbsence = LinkFactory.createButton("add.absence", mainVC, this); addAbsence.setIconLeftCSS("o_icon o_icon_add"); diff --git a/src/main/java/org/olat/modules/lecture/ui/profile/_content/profile.html b/src/main/java/org/olat/modules/lecture/ui/profile/_content/profile.html index bb4c1067be5..87ed960a66b 100644 --- a/src/main/java/org/olat/modules/lecture/ui/profile/_content/profile.html +++ b/src/main/java/org/olat/modules/lecture/ui/profile/_content/profile.html @@ -1,6 +1,9 @@ #if($r.available("back")) <div class="o_block">$r.render("back")</div> #end +#if($r.isNotEmpty($teacherMessage)) +<div class="o_info">$teacherMessage</div> +#end <div class="o_user_infos row"> <div class="o_user_portrait">$r.render("portrait")</div> <div class="o_user_infos_inner">$r.render("userDescr")</div> -- GitLab