From ae7d59fb741a37fd1b250bdfed7c6a2ddf46e6cc Mon Sep 17 00:00:00 2001
From: srosse <none@none>
Date: Thu, 7 Sep 2017 14:20:18 +0200
Subject: [PATCH] OO-2994: add course link in invitation email to a course

---
 src/main/java/org/olat/repository/RepositoryMailing.java    | 6 +++++-
 .../org/olat/repository/_i18n/LocalStrings_de.properties    | 2 +-
 .../org/olat/repository/_i18n/LocalStrings_en.properties    | 2 +-
 .../org/olat/repository/_i18n/LocalStrings_fr.properties    | 2 +-
 .../org/olat/repository/_i18n/LocalStrings_it.properties    | 2 +-
 .../org/olat/repository/_i18n/LocalStrings_pl.properties    | 2 +-
 .../org/olat/repository/_i18n/LocalStrings_pt_BR.properties | 2 +-
 .../org/olat/repository/_i18n/LocalStrings_zh_CN.properties | 2 +-
 8 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/olat/repository/RepositoryMailing.java b/src/main/java/org/olat/repository/RepositoryMailing.java
index 39f8ac3f222..4301c5b5d53 100644
--- a/src/main/java/org/olat/repository/RepositoryMailing.java
+++ b/src/main/java/org/olat/repository/RepositoryMailing.java
@@ -25,6 +25,7 @@ import org.apache.velocity.VelocityContext;
 import org.olat.basesecurity.BaseSecurity;
 import org.olat.core.CoreSpringFactory;
 import org.olat.core.gui.translator.Translator;
+import org.olat.core.helpers.Settings;
 import org.olat.core.id.Identity;
 import org.olat.core.id.Roles;
 import org.olat.core.id.User;
@@ -166,7 +167,7 @@ public class RepositoryMailing {
 		// build learning resources as list of url as string
 		final String reName = re.getDisplayname();
 		final String redescription = (StringHelper.containsNonWhitespace(re.getDescription()) ? FilterFactory.getHtmlTagAndDescapingFilter().filter(re.getDescription()) : ""); 
-
+		final String reUrl = Settings.getServerContextPathURI() + "/url/RepositoryEntry/" + re.getKey();
 		// get some data about the actor and fetch the translated subject / body via i18n module
 		String[] bodyArgs = new String[] {
 				actor.getUser().getProperty(UserConstants.FIRSTNAME, null),
@@ -180,6 +181,8 @@ public class RepositoryMailing {
 		String subject = trans.translate(subjectKey);
 		String body = trans.translate(bodyKey, bodyArgs);
 		
+		
+		
 		// create a mail template which all these data
 		MailTemplate mailTempl = new MailTemplate(subject, body, null) {
 			@Override
@@ -192,6 +195,7 @@ public class RepositoryMailing {
 				// Put variables from greater context
 				context.put("coursename", reName);
 				context.put("coursedescription", redescription);
+				context.put("courseurl", reUrl);
 			}
 		};
 		return mailTempl;
diff --git a/src/main/java/org/olat/repository/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/repository/_i18n/LocalStrings_de.properties
index aff7412316c..a314018db60 100644
--- a/src/main/java/org/olat/repository/_i18n/LocalStrings_de.properties
+++ b/src/main/java/org/olat/repository/_i18n/LocalStrings_de.properties
@@ -376,7 +376,7 @@ no.lifecycle=Keine Einschr\u00E4nkung
 no.catalog.entries=Diese Resource wurde noch nicht im Katalog registriert. \r\n\r\n Verwenden Sie den "In Katalog einf\u00FCgen" Button in der Toolbar, um die Resource auf einer bestimmten Katalog-Ebenen hinzuzuf\u00FCgen. Der Katalog erlaubt es dem Benutzer je nach Zugriffskonfiguration nach bestimmten Eintr\u00E4gen zu suchen. Sie k\u00F6nnen die Resource auf mehreren Katalog-Ebenen hinzuf\u00FCgen.
 info.catalog.entries=Verwenden Sie den "In Katalog einf\u00FCgen" Button in der Toolbar, um die Resource auf einer bestimmten Katalog-Ebenen hinzuzuf\u00FCgen. Der Katalog erlaubt es dem Benutzer je nach Zugriffskonfiguration nach bestimmten Eintr\u00E4gen zu suchen. Sie k\u00F6nnen die Resource auf mehreren Katalog-Ebenen hinzuf\u00FCgen.
 nomembers=XXX No members
-notification.mail.added.body=*** Das ist eine automatisch generierte Nachricht. Bitte antworten Sie nicht auf diese Nachricht *** \n\nSie wurden von {0} {1} ({2}) in einen Kurs eingeladen\: \n\nKursname\: $coursename\nBeschreibung\: $coursedescription\n\nBei Fragen kontaktieren Sie bitte {0} {1} ({2}).
+notification.mail.added.body=*** Das ist eine automatisch generierte Nachricht. Bitte antworten Sie nicht auf diese Nachricht *** \n\nSie wurden von {0} {1} ({2}) in einen Kurs eingeladen\: \n\nKursname\: $coursename\nBeschreibung\: $coursedescription\nZugang\: $courseurl\n\nBei Fragen kontaktieren Sie bitte {0} {1} ({2}).
 notification.mail.added.subject=Kurs $coursename 
 notification.mail.removed.body=*** Das ist eine automatisch generierte Nachricht. Bitte antworten Sie nicht auf diese Nachricht *** \n\nSie wurden von {0} {1} ({2}) aus dem Kurs ausgetragen\: \n\nKursname\: $coursename\nBeschreibung\: $coursedescription\n\nBei Fragen kontaktieren Sie bitte {0} {1} ({2}).
 notification.mail.removed.subject=Kurs $coursename\: Sie wurden ausgetragen.
diff --git a/src/main/java/org/olat/repository/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/repository/_i18n/LocalStrings_en.properties
index afd1a1e2e64..31b66c723a0 100644
--- a/src/main/java/org/olat/repository/_i18n/LocalStrings_en.properties
+++ b/src/main/java/org/olat/repository/_i18n/LocalStrings_en.properties
@@ -373,7 +373,7 @@ no.lifecycle=No limitation
 no.catalog.entries=This resource has not been added to the catalog yet. \r\n\r\n Use the "Add to catalog" button in the toolbar above to add the resource to a specific level in the catalog. The catalog allows users to browse for available resources depending on th resource access configuration. You can add the resource to multiple catalog levels.
 info.catalog.entries=Use the "Add to catalog" button in the toolbar above to add the resource to a specific level in the catalog. The catalog allows users to browse for available resources depending on th resource access configuration. You can add the resource to multiple catalog levels. 
 nomembers=XXX No members
-notification.mail.added.body=*** This is an automatically generated message. Please do not answer to this message *** \r\n\r\nYou have been added by {0} {1} ({2}) to a course\:\r\n\r\nCourse name\: $coursename\r\nDescription\: $coursedescription\r\n\r\nIf you have questions regarding this action, please contact {0} {1} ({2}).
+notification.mail.added.body=*** This is an automatically generated message. Please do not answer to this message *** \r\n\r\nYou have been added by {0} {1} ({2}) to a course\:\r\n\r\nCourse name\: $coursename\r\nDescription\: $coursedescription\nLink\: $courseurl\n\nIf you have questions regarding this action, please contact {0} {1} ({2}).
 notification.mail.added.subject=Course $coursename
 notification.mail.removed.body=*** This is an automatically generated message. Please do not answer to this message *** \r\n\r\nYou have been removed by {0} {1} ({2}) from a course\:\r\n\r\nCourse name\: $coursename\r\nDescription\: $coursedescription\r\n\r\nIf you have questions regarding this action, please contact {0} {1} ({2}).
 notification.mail.removed.subject=Course $coursename\: you have been removed.
diff --git a/src/main/java/org/olat/repository/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/repository/_i18n/LocalStrings_fr.properties
index f1bfa14868e..6ed25a2d081 100644
--- a/src/main/java/org/olat/repository/_i18n/LocalStrings_fr.properties
+++ b/src/main/java/org/olat/repository/_i18n/LocalStrings_fr.properties
@@ -373,7 +373,7 @@ new.wiki.intro=Cr\u00E9er un nouvel Wiki
 no.catalog.entries=Cet object didactique n'est pas encore dans le catalogue. Utilisez le bouton "Ajouter au catalogue" dans la barre d'outils pour ins\u00E9rer l'objet didactique au catalogue. Le catalogue permet \u00E0 l'utilisateur de trouver des objets didactiques en fonction de la configuration d'acc\u00E8s des entr\u00E9es. Vous pouvez ajouter les ressources \u00E0 diff\u00E9rents niveaux du catalogue.
 no.lifecycle=Pas de limitation
 nomembers=Pas de membres
-notification.mail.added.body=*** Ceci est un message g\u00E9n\u00E9r\u00E9 automatiquement. S'il vous pla\u00EEt, ne r\u00E9pondez pas \u00E0 ce message ***\r\n\r\nVous avez \u00E9t\u00E9 invit\u00E9 par {0} {1} ({2}) \u00E0 prendre part \u00E0 un cours\:\r\n\r\nNom du cours\: $coursename\r\nDescription\: $coursedescription\r\n\r\nSi vous avez des questions, veuillez contacter {0} {1} ({2}).
+notification.mail.added.body=*** Ceci est un message g\u00E9n\u00E9r\u00E9 automatiquement. S'il vous pla\u00EEt, ne r\u00E9pondez pas \u00E0 ce message ***\r\n\r\nVous avez \u00E9t\u00E9 invit\u00E9 par {0} {1} ({2}) \u00E0 prendre part \u00E0 un cours\:\r\n\r\nNom du cours\: $coursename\r\nDescription\: $coursedescription\r\nLien\: $courseurl\r\n\r\nSi vous avez des questions, veuillez contacter {0} {1} ({2}).
 notification.mail.added.subject=Cours $coursename
 notification.mail.removed.body=*** Ceci est un message g\u00E9n\u00E9r\u00E9 automatiquement. S'il vous pla\u00EEt, ne r\u00E9pondez pas \u00E0 ce message ***\r\n\r\nVous avez \u00E9t\u00E9 retir\u00E9 par {0} {1} ({2}) d'un cours\:\r\n\r\nNom du cours\: $coursename\r\nDescription\: $coursedescription\r\n\r\nSi vous avez des questions, veuillez contacter {0} {1} ({2}).
 notification.mail.removed.subject=Cours $coursename\: vous avez \u00E9t\u00E9 d\u00E9sinscrit.
diff --git a/src/main/java/org/olat/repository/_i18n/LocalStrings_it.properties b/src/main/java/org/olat/repository/_i18n/LocalStrings_it.properties
index 9f67b506826..10838139aaa 100644
--- a/src/main/java/org/olat/repository/_i18n/LocalStrings_it.properties
+++ b/src/main/java/org/olat/repository/_i18n/LocalStrings_it.properties
@@ -358,7 +358,7 @@ new.wiki=Creare Wiki
 new.wiki.intro=Creare un nuovo Wiki
 no.lifecycle=Senza limitazioni
 nomembers=Nessun membro
-notification.mail.added.body=*** Questo \u00E8 un messaggio generato automaticamente. Non rispondere a questo messaggio *** \r\n\r\nSei stato aggiunto da {0} {1} ({2}) in un corso\:\r\n\r\nNome del corso\: $coursename\r\nDescrizione\: $coursedescription\r\n\r\nSe hai domande riguardanti questa azione, contatta {0} {1} ({2}).
+notification.mail.added.body=*** Questo \u00E8 un messaggio generato automaticamente. Non rispondere a questo messaggio *** \r\n\r\nSei stato aggiunto da {0} {1} ({2}) in un corso\:\r\n\r\nNome del corso\: $coursename\r\nDescrizione\: $coursedescription\r\nURL\:$courseurl\r\n\r\nSe hai domande riguardanti questa azione, contatta {0} {1} ({2}).
 notification.mail.added.subject=Corso $coursename
 notification.mail.removed.body=*** Questo \u00E8 un messaggio generato automaticamente. Non rispondere a questo messaggio *** \r\n\r\nSei stato rimosso da {0} {1} ({2}) da un corso\:\r\n\r\nNome del corso\: $coursename\r\nDescrizione\: $coursedescription\r\n\r\nSe hai domande riguardanti questa azione, contatta {0} {1} ({2}).
 notification.mail.removed.subject=Corso $coursename\: sei stato rimosso.
diff --git a/src/main/java/org/olat/repository/_i18n/LocalStrings_pl.properties b/src/main/java/org/olat/repository/_i18n/LocalStrings_pl.properties
index 358d8c3d295..5f20960926e 100644
--- a/src/main/java/org/olat/repository/_i18n/LocalStrings_pl.properties
+++ b/src/main/java/org/olat/repository/_i18n/LocalStrings_pl.properties
@@ -308,7 +308,7 @@ new.wiki=Utw\u00F3rz Wiki
 new.wiki.intro=Utw\u00F3rz now\u0105 Wiki
 no.lifecycle=Bez ogranicze\u0144
 nomembers=XXX No members
-notification.mail.added.body=*** Wiadomo\u015B\u0107 generowana automatycznie, nie odpowiadaj na ni\u0105 *** \r\n\r\nZosta\u0142e\u015B dodany przez {0} {1} ({2}) do kursu\:\r\n\r\nNazwa kursu\: $coursename\r\nOpis\: $coursedescription\r\n\r\nW razie pyta\u0144 skontaktuj si\u0119 z {0} {1} ({2}).
+notification.mail.added.body=*** Wiadomo\u015B\u0107 generowana automatycznie, nie odpowiadaj na ni\u0105 *** \r\n\r\nZosta\u0142e\u015B dodany przez {0} {1} ({2}) do kursu\:\r\n\r\nNazwa kursu\: $coursename\r\nOpis\: $coursedescription\r\nURL\: $courseurl\r\n\r\nW razie pyta\u0144 skontaktuj si\u0119 z {0} {1} ({2}).
 notification.mail.added.subject=Kurs $coursename
 notification.mail.removed.body=*** Wiadomo\u015B\u0107 generowana automatycznie, nie odpowiadaj na ni\u0105 *** \r\n\r\nZosta\u0142e\u015B usuni\u0119ty przez {0} {1} ({2}) z kursu\:\r\n\r\nNazwa kursu\: $coursename\r\nOpis\: $coursedescription\r\n\r\nW razie pyta\u0144 skontaktuj si\u0119 z {0} {1} ({2}).
 notification.mail.removed.subject=Kurs $coursename\: zosta\u0142e\u015B usuni\u0119ty.
diff --git a/src/main/java/org/olat/repository/_i18n/LocalStrings_pt_BR.properties b/src/main/java/org/olat/repository/_i18n/LocalStrings_pt_BR.properties
index 74aa3cfad43..8f63467e6b8 100644
--- a/src/main/java/org/olat/repository/_i18n/LocalStrings_pt_BR.properties
+++ b/src/main/java/org/olat/repository/_i18n/LocalStrings_pt_BR.properties
@@ -372,7 +372,7 @@ new.wiki.intro=Criar novo wiki
 no.catalog.entries=Este recurso ainda n\u00E3o foi adicionado ao cat\u00E1logo. Use o bot\u00E3o "Adicionar ao cat\u00E1logo" na barra de ferramentas acima para adicionar o recurso a um n\u00EDvel espec\u00EDfico no cat\u00E1logo. O cat\u00E1logo permite aos usu\u00E1rios procurar recursos dispon\u00EDveis dependendo da configura\u00E7\u00E3o de acesso a recursos. Voc\u00EA pode adicionar o recurso a v\u00E1rios n\u00EDveis do cat\u00E1logo.
 no.lifecycle=Nenhuma limita\u00E7\u00E3o
 nomembers=XXX No members
-notification.mail.added.body=*** Esta \u00E9 uma mensagem gerada automaticamente. Por favor, n\u00E3o responda a esta mensagem ***\r\n\r\nVoc\u00EA foi adicionado por {0} {1} ({2}) para um curso\:\r\n\r\nNome do curso\: $coursename\r\nDescri\u00E7\u00E3o\: $coursedescription\r\n\r\nSe voc\u00EA tem alguma d\u00FAvida sobre esta a\u00E7\u00E3o, entre em contato {0} {1} ({2}).
+notification.mail.added.body=*** Esta \u00E9 uma mensagem gerada automaticamente. Por favor, n\u00E3o responda a esta mensagem ***\r\n\r\nVoc\u00EA foi adicionado por {0} {1} ({2}) para um curso\:\r\n\r\nNome do curso\: $coursename\r\nDescri\u00E7\u00E3o\: $coursedescription\r\nURL\: $courseurl\r\n\r\nSe voc\u00EA tem alguma d\u00FAvida sobre esta a\u00E7\u00E3o, entre em contato {0} {1} ({2}).
 notification.mail.added.subject=Curso $coursename
 notification.mail.removed.body=*** Esta \u00E9 uma mensagem gerada automaticamente. Por favor, n\u00E3o responda a esta mensagem ***\r\n\r\nVoc\u00EA foi removido por {0} {1} ({2}) de um curso\:\r\n\r\nNome do curso\: $coursename\r\nDescri\u00E7\u00E3o\: $coursedescription\r\n\r\nSe voc\u00EA tem d\u00FAvidas sobre esta a\u00E7\u00E3o, entre em contato {0} {1} ({2}).
 notification.mail.removed.subject=Curso $coursename\: voc\u00EA foi removido.
diff --git a/src/main/java/org/olat/repository/_i18n/LocalStrings_zh_CN.properties b/src/main/java/org/olat/repository/_i18n/LocalStrings_zh_CN.properties
index 96ae112ae6a..6dbda79b0cb 100644
--- a/src/main/java/org/olat/repository/_i18n/LocalStrings_zh_CN.properties
+++ b/src/main/java/org/olat/repository/_i18n/LocalStrings_zh_CN.properties
@@ -203,7 +203,7 @@ new.wiki=\u521B\u5EFA\u7EF4\u57FA
 new.wiki.intro=\u521B\u5EFA\u65B0\u7EF4\u57FA
 no.lifecycle=\u65E0\u9650\u5236
 nomembers=XXX\u53F7\u6210\u5458
-notification.mail.added.body=***\u8FD9\u662F\u81EA\u52A8\u4EA7\u751F\u7684\u4FE1\u606F\u3002\u8BF7\u60A8\u4E0D\u8981\u56DE\u590D***\r\n\r\n\u60A8\u88AB{0}{1}{2}\u9080\u8BF7\u53C2\u52A0\u8BFE\u7A0B\uFF1A\r\n\r\n\u8BFE\u7A0B\u540D\u79F0\uFF1A$coursename\r\n\u8BFE\u7A0B\u63CF\u8FF0\uFF1A$coursedescription\r\n\r\n\u5982\u679C\u6709\u95EE\u9898\u8BF7\u60A8\u8054\u7CFB{0}{1}{2}\u3002
+notification.mail.added.body=***\u8FD9\u662F\u81EA\u52A8\u4EA7\u751F\u7684\u4FE1\u606F\u3002\u8BF7\u60A8\u4E0D\u8981\u56DE\u590D***\r\n\r\n\u60A8\u88AB{0}{1}{2}\u9080\u8BF7\u53C2\u52A0\u8BFE\u7A0B\uFF1A\r\n\r\n\u8BFE\u7A0B\u540D\u79F0\uFF1A$coursename\r\n\u8BFE\u7A0B\u63CF\u8FF0\uFF1A$coursedescription\r\nURL\: $courseurl\r\n\r\n\u5982\u679C\u6709\u95EE\u9898\u8BF7\u60A8\u8054\u7CFB{0}{1}{2}\u3002
 notification.mail.added.subject=\u8BFE\u7A0B $coursename
 notification.mail.removed.body=***\u8FD9\u662F\u81EA\u52A8\u4EA7\u751F\u7684\u4FE1\u606F\u3002\u8BF7\u60A8\u4E0D\u8981\u56DE\u590D***\r\n\r\n\u60A8\u88AB{0}{1}{2}\u767B\u51FA\u4EE5\u4E0B\u8BFE\u7A0B\uFF1A\r\n\r\n\u8BFE\u7A0B\u540D\u79F0\uFF1A$coursename\r\n\u8BFE\u7A0B\u63CF\u8FF0\uFF1A$coursedescription\r\n\r\n\u5982\u679C\u6709\u95EE\u9898\u8BF7\u60A8\u8054\u7CFB{0}{1}{2}\u3002
 notification.mail.removed.subject=\u8BFE\u7A0B $coursename\uFF1A\u60A8\u88AB\u767B\u51FA\u3002
-- 
GitLab