diff --git a/src/main/java/org/olat/core/commons/modules/bc/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/core/commons/modules/bc/_i18n/LocalStrings_fr.properties index e8c8a68c5c8a0e4af326ab37ab98ee2a596257dc..15de12ef408e5ad331f3cb70707588f56eb3e287 100644 --- a/src/main/java/org/olat/core/commons/modules/bc/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/core/commons/modules/bc/_i18n/LocalStrings_fr.properties @@ -1,4 +1,4 @@ -#Sat Oct 26 20:36:08 CEST 2013 +#Wed Dec 04 16:40:06 CET 2013 Directory=Dossier FileDeleteFailed=fichier/dossier <b>{0}</b> n'a pas pu \u00EAtre supprim\u00E9. FileDeleted=Le fichier/dossier <b>{0}</b> a \u00E9t\u00E9 supprim\u00E9 avec succ\u00E8s. @@ -61,11 +61,13 @@ chelp.how11=Groupes du type $\:chelp.buddy, $\:chelp.learn et $\:chelp.right, da chelp.how12=Vous deux dossiers personnels ($\:chelp.private et $\:chelp.public) chelp.how13=Toutes les ressources didactiques du type $\:chelp.repResFol que vous poss\u00E9dez. Ceci ne concerne g\u00E9n\u00E9ralement que les auteurs de OLAT. chelp.how2=En attendant, des applications diverses (p.ex. Macromedia Dreamweaver, Adobe Golive et InDesign) proposent la fonctionnalit\u00E9 WebDAV. +chelp.how21=Selon les applications, les fichiers peuvent \u00EAtre verrouill\u00E9s sur le serveur pendant le traitement. Les autres utilisateurs ne peuvent plus lire ou \u00E9craser les modifications du m\u00EAme fichier. Les fichiers verrouill\u00E9s sont marqu\u00E9s dans la vue Web d'OpenOLAT par une serrure. chelp.how3=Pour atteindre un dossier sur OLAT via WebDAV, vous avez besoin de\: chelp.how4=L'adresse (URL) de la ressource sur serveur\: employez l'URL, telle qu'elle est marqu\u00E9e sous les dossiers OLAT compatibles avec WebDAV. chelp.how4a=Nom d'utilisateur\: Utilisez votre nom d'utilisateur OLAT (le nom qui s'affiche sur l'\u00E9cran en bas \u00E0 gauche). chelp.how5=Mot de passe WebDAV\: utilisez votre mot de passe WebDav. Vous avez la possibilit\u00E9 de modifier votre mot de passe sous Page d'accueil -> WebDAV. Si vous avez un mot de passe OLAT, utilisez-le pour l'acc\u00E8s \u00E0 WebDAV. chelp.how8=Connectez-vous maintenant gr\u00E2ce \u00E0 l'adresse URL indiqu\u00E9, le nom d'utilisateur et le mot de passe \u00E0 votre instance OLAT. +chelp.how8.win=Essayez, si possible, d'abord \u00E9tablir une connexion avec l'URL commence par https\://. Seulement si cela ne fonctionne pas, vous devez utiliser l'alternative par http\://. Cette derni\u00E8re devrait \u00EAtre n\u00E9cessaire sous Windows. chelp.how81=Vous trouvez un guide \u00E9tape par \u00E9tape dans le manuel OLAT au chapitre "Utiliser WebDAV". chelp.how9=Sur votre bureau s'ouvre un r\u00E9pertoire qui contient les sous-r\u00E9pertoires suivants\: chelp.learn=<i>$org.olat.group.ui\:LearningGroup</i> @@ -160,6 +162,8 @@ unzip.alreadyexists=Un dossier avec le nom {0} existe d\u00E9j\u00E0. Vous avez versions=Versions versions.revisions=Versions webdav.link=WebDAV Link +webdav.link.http=Pour le client natif sous Window, il est parfois plus facile d'utiliser ce +webdav.link.https=En principe, nous vous recommandons ce lien zip=Zipper zip.alreadyexists=Un fichier avec le nom {0} existe d\u00E9j\u00E0. Choisissez un autre diff\u00E9rent, svp. zip.button=Zipper diff --git a/src/main/java/org/olat/core/commons/services/webdav/manager/WebDAVManagerImpl.java b/src/main/java/org/olat/core/commons/services/webdav/manager/WebDAVManagerImpl.java index 85c5029ec91adc982e53e0cee943bc21acf3275a..d511fa33c012623bcf5f821b544ac639b77e1929 100644 --- a/src/main/java/org/olat/core/commons/services/webdav/manager/WebDAVManagerImpl.java +++ b/src/main/java/org/olat/core/commons/services/webdav/manager/WebDAVManagerImpl.java @@ -41,6 +41,7 @@ import org.olat.core.commons.services.webdav.WebDAVManager; import org.olat.core.commons.services.webdav.WebDAVModule; import org.olat.core.commons.services.webdav.WebDAVProvider; import org.olat.core.commons.services.webdav.servlets.WebResourceRoot; +import org.olat.core.helpers.Settings; import org.olat.core.id.Identity; import org.olat.core.id.Roles; import org.olat.core.id.User; @@ -247,9 +248,13 @@ public class WebDAVManagerImpl implements WebDAVManager { // and cache them so that it doesn't have to // prompt you again. - response.addHeader("WWW-Authenticate", "Basic realm=\"" + BASIC_AUTH_REALM + "\""); - String nonce = UUID.randomUUID().toString().replace("-", ""); - response.addHeader("WWW-Authenticate", "Digest realm=\"" + BASIC_AUTH_REALM + "\", qop=\"auth\", nonce=\"" + nonce + "\""); + if(request.isSecure() || Settings.isJUnitTest()) { + response.addHeader("WWW-Authenticate", "Basic realm=\"" + BASIC_AUTH_REALM + "\""); + } + if(webdavModule.isDigestAuthenticationEnabled()) { + String nonce = UUID.randomUUID().toString().replace("-", ""); + response.addHeader("WWW-Authenticate", "Digest realm=\"" + BASIC_AUTH_REALM + "\", qop=\"auth\", nonce=\"" + nonce + "\""); + } response.setStatus(401); return null; } diff --git a/src/main/java/org/olat/core/commons/services/webdav/ui/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/core/commons/services/webdav/ui/_i18n/LocalStrings_fr.properties new file mode 100644 index 0000000000000000000000000000000000000000..1332419d9cdb265ea791cf02037767a0d5b605e3 --- /dev/null +++ b/src/main/java/org/olat/core/commons/services/webdav/ui/_i18n/LocalStrings_fr.properties @@ -0,0 +1,18 @@ +#Wed Dec 04 16:36:37 CET 2013 +admin.menu.title=WebDAV +admin.menu.title.alt=Acc\u00E8s WebDAV +admin.webdav.description=Gr\u00E2ce \u00E0 WebDAV, les dossiers OpenOLAT peuvent appara\u00EEtre sur votre bureau local et \u00EAtre utilis\u00E9s. Vous devez configurer cette fonction pour la rendre disponible \u00E0 tous les utilisateurs du syst\u00E8me. S'il vous pla\u00EEt lisez l'aide contextuelle pour plus d'informations. +chelp.webdav.digest=Pour utiliser WebDAV sous Windows directement, sans importer manuellement des certificats, il est n\u00E9cessaire d'utiliser WebDAV sans SSL. Dans ce cas, les fichiers sont transf\u00E9r\u00E9s en clair. Pour chiffrer le mot de passe transmis au server, le m\u00E9canisme d'authentification Digest doit \u00EAtre utilis\u00E9, sinon WebDAV ne peut pas \u00EAtre utilis\u00E9 sous Windows. +chelp.webdav.digest.disclaimer=Le cryptage de l'authentification Digest ne fournit pas de cryptographie forte et peut \u00EAtre craqu\u00E9 avec suffisamment de temps et d'efforts. Pour des exigences \u00E9lev\u00E9es de s\u00E9curit\u00E9, l'acc\u00E8s HTTPS avec le chiffrement SSL doit toujours \u00EAtre utilis\u00E9. Sous Windows, il faut malheureusement importer manuellement les certificats ou utiliser des programmes WebDAV d\u00E9di\u00E9s. +chelp.webdav.link=Ind\u00E9pendamment de la fonction WebDAV, cette option vous permet de d\u00E9cider si le lien WebDAV sera affich\u00E9 dans les dossiers ou non. Lorsque cette fonction est d\u00E9sactiv\u00E9e, WebDAV peut continuer \u00E0 \u00EAtre utilis\u00E9, seul le lien n'appara\u00EEtra pas. +chelp.webdav.module=Activez ou d\u00E9sactivez l'acc\u00E8s WebDAV l'\u00E9chelle du syst\u00E8me. Lorsque le module est activ\u00E9, tous les utilisateurs peuvent utiliser le syst\u00E8me OpenOLAT via WebDAV (recommand\u00E9). +chelp.webdav.more=Pour plus d'informations sur l'utilisation de WebDAV dans OpenOLAT\: +chelp.webdav.usage=Utilisation +chelp.webdavconfig.intro=Le module WebDAV peut \u00EAtre activ\u00E9e ou d\u00E9sactiv\u00E9e pour l'ensemble du syst\u00E8me OpenOLAT. Les configurations suivantes sont possibles\: +chelp.webdavconfig.title=Configuration du module WebDAV +core.webdav=WebDAV +help.hover.webdavconfig=Aide \u00E0 la configuration du module WebDAV +webdav.digest=Utilise l'authentification Digest pour l'acc\u00E8s HTTP +webdav.link=Montre les liens WebDAV +webdav.module=Acc\u00E8s WebDAV +webdav.on=on diff --git a/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneRenderer.java b/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneRenderer.java index 58aa9e715c02c3d214f74f3735d0aab2744da7b7..ca639194f6ddd6a3e12cb8c566580eff658b32e3 100644 --- a/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneRenderer.java +++ b/src/main/java/org/olat/core/gui/components/tabbedpane/TabbedPaneRenderer.java @@ -122,7 +122,7 @@ public class TabbedPaneRenderer implements ComponentRenderer { public void renderHeaderIncludes(Renderer renderer, StringOutput sb, Component source, URLBuilder ubu, Translator translator, RenderingState rstate) { TabbedPane tp = (TabbedPane)source; int cnt = tp.getTabCount(); - if (cnt > 0) { + if (cnt > 0 && tp.getSelectedPane() < cnt) { Component toRender = tp.getTabAt(tp.getSelectedPane()); // delegate header rendering to the selected pane renderer.renderHeaderIncludes(sb, toRender, rstate); diff --git a/src/main/java/org/olat/core/util/mail/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/core/util/mail/_i18n/LocalStrings_fr.properties index b777e304fb3ddd59980be600a48c028438b6bfe0..c0e7b4b56c6c325859981d501960fa8766c8398d 100644 --- a/src/main/java/org/olat/core/util/mail/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/core/util/mail/_i18n/LocalStrings_fr.properties @@ -1,5 +1,8 @@ -#Sat Oct 26 20:38:40 CEST 2013 +#Wed Dec 04 16:41:55 CET 2013 add.email=Ajouter +chelp.customizeMailTemplate.content=Sera remplac\u00E9 par le contenu r\u00E9el du courriel. Le texte est habituellement ajust\u00E9 \u00E0 la langue du destinataire. +chelp.customizeMailTemplate.footer=Sera remplac\u00E9 par le pied de page g\u00E9n\u00E9rique. Le pied de page est adapt\u00E9 \u00E0 la langue du destinataire et peut \u00EAtre adapt\u00E9 avec l'outil d'adaptation linguistique pour chaque langue. (Voir footer.no.userdata et footer.with.userdata du paquet org.olat.core.util.mail) +chelp.customizeMailTemplate.variables=Les variables suivantes peuvent figurer dans le mod\u00E8le\: chelp.customizeMailTemplate1=Vous pouvez personnaliser ce mod\u00E8le de courriel. chelp.mail-admin-template.title=Informations sur le mod\u00E8le de courriel chelp.mail-admin.title=$\:mail.admin.title @@ -17,8 +20,8 @@ chelp.sendMail6=description du groupe chelp.sendMail7=Liste des cours qui utilisent le groupe. chelp.sendMail8=Liste des cours utilisant ce groupe. contact.cp.from=Copie \u00E0 l'exp\u00E9diteur -footer.no.userdata=<p>Ce message a \u00E9t\u00E9 envoy\u00E9 automatiquement via la plateforme d'apprentissage OpenOLAT: {0}</p> -footer.with.userdata=<p>ExpĂ©diteur: {2} {3} ({0}), {4} {5}</p><p>Ce message a \u00E9t\u00E9 envoy\u00E9 via la plateforme d'apprentissage OpenOLAT: {1}</p> +footer.no.userdata=<p>Ce message a \u00E9t\u00E9 envoy\u00E9 automatiquement via la plateforme d'apprentissage OpenOLAT\: {0}</p> +footer.with.userdata=<p>Exp\u00E9diteur\: {2} {3} ({0}), {4} {5}</p><p>Ce message a \u00E9t\u00E9 envoy\u00E9 via la plateforme d'apprentissage OpenOLAT\: {1}</p> help.hover.mail-templ=Aide pour l'utilisation de l'e-mail mod\u00E8le mail.action.emtpy=S\u00E9lectionnez au moins une adresse e-mail pour d\u00E9clencher un effet. mail.action.mark=Signaler diff --git a/src/main/java/org/olat/course/assessment/bulk/ValidationStepForm.java b/src/main/java/org/olat/course/assessment/bulk/ValidationStepForm.java index ac4480a336c5661c59b4cc3c8f58dcda93a29e9c..91873062fc4cf06efa1d065c6f3c0d0f978765be 100644 --- a/src/main/java/org/olat/course/assessment/bulk/ValidationStepForm.java +++ b/src/main/java/org/olat/course/assessment/bulk/ValidationStepForm.java @@ -56,6 +56,9 @@ import org.olat.course.nodes.AssessableCourseNode; */ public class ValidationStepForm extends StepFormBasicController { + private static final String[] userPropsToSearch = new String[]{ UserConstants.EMAIL, UserConstants.INSTITUTIONALEMAIL, UserConstants.INSTITUTIONALUSERIDENTIFIER }; + + private ValidDataModel validModel; private ValidDataModel invalidModel; private FlexiTableElement validTableEl; @@ -141,7 +144,19 @@ public class ValidationStepForm extends StepFormBasicController { Identity identity = securityManager.findIdentityByName(assessedId); if(identity != null) { idToIdentityMap.put(assessedId, identity); + continue; } + + Map<String, String> userProperties = new HashMap<String,String>(); + for(String prop : userPropsToSearch) { + userProperties.put(prop, assessedId); + List<Identity> identities = securityManager.getIdentitiesByPowerSearch(null, userProperties, false, null, null, null, null, null, null, null, null); + if(!identities.isEmpty()) { + idToIdentityMap.put(assessedId, identities.get(0)); + break; + } + userProperties.clear(); + } } return idToIdentityMap; diff --git a/src/main/java/org/olat/course/condition/interpreter/ArgumentParseException.java b/src/main/java/org/olat/course/condition/interpreter/ArgumentParseException.java index b178c9ee60feba5a12145b5931df9d10ad4cf01c..a9dfe2415f93bb8b857a6156bcaea9c0446c401f 100644 --- a/src/main/java/org/olat/course/condition/interpreter/ArgumentParseException.java +++ b/src/main/java/org/olat/course/condition/interpreter/ArgumentParseException.java @@ -31,6 +31,8 @@ package org.olat.course.condition.interpreter; * @author Felix Jost */ public class ArgumentParseException extends RuntimeException { + + private static final long serialVersionUID = 7135633046896613748L; /** * Errorcode if the function needs more arguments */ diff --git a/src/main/java/org/olat/course/condition/interpreter/ConditionExpression.java b/src/main/java/org/olat/course/condition/interpreter/ConditionExpression.java index 08144bda0eba94aceb1f60e069771e3a69a0214f..2506ab6bdb1198821bd4d25e1c50f54199e4df2f 100644 --- a/src/main/java/org/olat/course/condition/interpreter/ConditionExpression.java +++ b/src/main/java/org/olat/course/condition/interpreter/ConditionExpression.java @@ -40,8 +40,8 @@ import java.util.Stack; public class ConditionExpression { private String expressionString; private String id; - private Stack errorStack; - private Map softReferences; + private Stack<Exception> errorStack; + private Map<String, Set<String>> softReferences; public ConditionExpression(String idName, String expression) { this(idName); @@ -50,8 +50,8 @@ public class ConditionExpression { public ConditionExpression(String idName) { this.id = idName; - errorStack = new Stack(); - softReferences = new HashMap(); + errorStack = new Stack<Exception>(); + softReferences = new HashMap<>(); } public String getId() { @@ -71,11 +71,11 @@ public class ConditionExpression { } public void addSoftReference(String category, String softReference) { - Set catSoftRefs; + Set<String> catSoftRefs; if (softReferences.containsKey(category)) { - catSoftRefs = (HashSet) softReferences.get(category); + catSoftRefs = softReferences.get(category); } else { - catSoftRefs = new HashSet(); + catSoftRefs = new HashSet<String>(); } catSoftRefs.add(softReference); softReferences.put(category, catSoftRefs); @@ -84,7 +84,7 @@ public class ConditionExpression { public Set<String> getSoftReferencesOf(String category) { Set<String> catSoftRefs; if (softReferences.containsKey(category)) { - catSoftRefs = (HashSet) softReferences.get(category); + catSoftRefs = softReferences.get(category); } else { catSoftRefs = new HashSet<String>(); } @@ -92,20 +92,19 @@ public class ConditionExpression { } public Exception[] getExceptions() { - Exception[] retVal = new Exception[errorStack.size()]; - return (Exception[]) errorStack.toArray(retVal); + return errorStack.toArray(new Exception[errorStack.size()]); } public String toString() { String retVal = ""; String softRefStr =""; - Set keys = softReferences.keySet(); - for (Iterator iter = keys.iterator(); iter.hasNext();) { - String category = (String) iter.next(); + Set<String> keys = softReferences.keySet(); + for (Iterator<String> iter = keys.iterator(); iter.hasNext();) { + String category = iter.next(); softRefStr += "["+category+"::"; - Set catSoftRefs = (Set) softReferences.get(category); - for (Iterator iterator = catSoftRefs.iterator(); iterator.hasNext();) { - String srs = (String) iterator.next(); + Set<String> catSoftRefs = softReferences.get(category); + for (Iterator<String> iterator = catSoftRefs.iterator(); iterator.hasNext();) { + String srs = iterator.next(); softRefStr +=srs+","; } softRefStr +="]"; diff --git a/src/main/java/org/olat/course/condition/interpreter/ConditionInterpreter.java b/src/main/java/org/olat/course/condition/interpreter/ConditionInterpreter.java index 1ab0227e5e56ca75357a122d3728a7dd6af6f522..e5ac3bae91eafdae7a439b8df77b10a5073ba285 100644 --- a/src/main/java/org/olat/course/condition/interpreter/ConditionInterpreter.java +++ b/src/main/java/org/olat/course/condition/interpreter/ConditionInterpreter.java @@ -105,7 +105,7 @@ public class ConditionInterpreter { env.addFunction(DateFunction.name, new DateFunction(userCourseEnv)); env.addFunction("inGroup", new InLearningGroupFunction(userCourseEnv, "inGroup")); // legacy env.addFunction("inLearningGroup", new InLearningGroupFunction(userCourseEnv, "inLearningGroup")); - env.addFunction("isLearningGroupFull", new IsLearningGroupFullFunction(userCourseEnv, "isLearningGroupFull")); + env.addFunction("isLearningGroupFull", new IsLearningGroupFullFunction(userCourseEnv)); env.addFunction(InRightGroupFunction.name, new InRightGroupFunction(userCourseEnv)); env.addFunction(InLearningAreaFunction.name, new InLearningAreaFunction(userCourseEnv)); env.addFunction(IsUserFunction.name, new IsUserFunction(userCourseEnv)); @@ -133,6 +133,8 @@ public class ConditionInterpreter { env.addFunction(IsCourseParticipantFunction.name, new IsCourseParticipantFunction(userCourseEnv)); env.addFunction(IsCourseAdministratorFunction.name, new IsCourseAdministratorFunction(userCourseEnv)); + env.addFunction(GetCourseBeginDateFunction.name, new GetCourseBeginDateFunction(userCourseEnv)); + env.addFunction(GetCourseEndDateFunction.name, new GetCourseEndDateFunction(userCourseEnv)); env.addFunction(GetInitialCourseLaunchDateFunction.name, new GetInitialCourseLaunchDateFunction(userCourseEnv)); env.addFunction(GetRecentCourseLaunchDateFunction.name, new GetRecentCourseLaunchDateFunction(userCourseEnv)); diff --git a/src/main/java/org/olat/course/condition/interpreter/EvalAttributeFunction.java b/src/main/java/org/olat/course/condition/interpreter/EvalAttributeFunction.java index 80cca9b60b0c3441b887ad1da5d3f9bafcec199e..a87e4d273c33b3b8c024c090a7a247918aee3336 100644 --- a/src/main/java/org/olat/course/condition/interpreter/EvalAttributeFunction.java +++ b/src/main/java/org/olat/course/condition/interpreter/EvalAttributeFunction.java @@ -33,6 +33,7 @@ import java.util.regex.Pattern; import org.olat.core.id.Identity; import org.olat.core.id.IdentityEnvironment; import org.olat.core.logging.OLATRuntimeException; +import org.olat.core.logging.OLog; import org.olat.core.logging.Tracing; import org.olat.course.editor.CourseEditorEnv; import org.olat.course.run.userview.UserCourseEnvironment; @@ -43,6 +44,8 @@ import org.olat.course.run.userview.UserCourseEnvironment; */ public class EvalAttributeFunction extends AbstractFunction { + private static final OLog log = Tracing.createLoggerFor(EvalAttributeFunction.class); + /*************************************************************** * Function types * * * @@ -113,9 +116,9 @@ public class EvalAttributeFunction extends AbstractFunction { String[] b = multiValueSeparatorValue.split(values); // split on ; if (a == null || (a.length == 1 && a[0] == "")) return false; // empty array? if (b == null || (b.length == 1 && b[0] == "")) return false; // empty array? - if (Tracing.isDebugEnabled(EvalAttributeFunction.class)) { - Tracing.logDebug("a: " + Arrays.toString(a), EvalAttributeFunction.class); - Tracing.logDebug("b: " + Arrays.toString(b), EvalAttributeFunction.class); + if (log.isDebug()) { + log.debug("a: " + Arrays.toString(a)); + log.debug("b: " + Arrays.toString(b)); } if (type == FUNCTION_TYPE_HAS_ATTRIBUTE) { List<String> l = Arrays.asList(a); @@ -195,15 +198,16 @@ public class EvalAttributeFunction extends AbstractFunction { IdentityEnvironment ienv = getUserCourseEnv().getIdentityEnvironment(); Identity ident = ienv.getIdentity(); - Map attributes = ienv.getAttributes(); + Map<String, String> attributes = ienv.getAttributes(); if (attributes == null) return ConditionInterpreter.INT_FALSE; - String value = (String)attributes.get(attName); + String value = attributes.get(attName); boolean match = false; - if (Tracing.isDebugEnabled(EvalAttributeFunction.class)) { - Tracing.logDebug("value : " + value, EvalAttributeFunction.class); - Tracing.logDebug("attrValue: " + attValue, EvalAttributeFunction.class); - Tracing.logDebug("fT : " + functionType, EvalAttributeFunction.class); + boolean debug = log.isDebug(); + if (debug) { + log.debug("value : " + value); + log.debug("attrValue: " + attValue); + log.debug("fT : " + functionType); } if (value != null) { if (functionType <= FUNCTION_TYPE_IS_NOT_IN_ATTRIBUTE) { @@ -213,9 +217,9 @@ public class EvalAttributeFunction extends AbstractFunction { } } - if (Tracing.isDebugEnabled(EvalAttributeFunction.class)) { - Tracing.logDebug("identity '" + ident.getName() + "' tested on attribute '" + attName + "' to have value '" + - attValue + "' user's value was '" + value + "', match=" + match, EvalAttributeFunction.class); + if (debug) { + log.debug("identity '" + ident.getName() + "' tested on attribute '" + attName + "' to have value '" + + attValue + "' user's value was '" + value + "', match=" + match); } return match ? ConditionInterpreter.INT_TRUE : ConditionInterpreter.INT_FALSE; } diff --git a/src/main/java/org/olat/course/condition/interpreter/GetCourseBeginDateFunction.java b/src/main/java/org/olat/course/condition/interpreter/GetCourseBeginDateFunction.java new file mode 100644 index 0000000000000000000000000000000000000000..24b1a5d9726963ff58ea7e93095ae0a9c07799b6 --- /dev/null +++ b/src/main/java/org/olat/course/condition/interpreter/GetCourseBeginDateFunction.java @@ -0,0 +1,71 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.course.condition.interpreter; + +import org.olat.course.editor.CourseEditorEnv; +import org.olat.course.run.userview.UserCourseEnvironment; +import org.olat.repository.model.RepositoryEntryLifecycle; + +/** + * + * Description:<br> + * Function to get the begin date of the course + * lifecycle. + * <P> + * Initial Date: 4.12.2013 <br> + * + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + */ +public class GetCourseBeginDateFunction extends AbstractFunction { + + public static final String name = "getCourseBeginDate"; + + /** + * Default constructor to use the get initial enrollment date + * @param userCourseEnv + */ + public GetCourseBeginDateFunction(UserCourseEnvironment userCourseEnv) { + super(userCourseEnv); + } + + /** + * @see com.neemsoft.jmep.FunctionCB#call(java.lang.Object[]) + */ + @Override + public Object call(Object[] inStack) { + CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv(); + if(cev != null) { + return defaultValue(); + } + + RepositoryEntryLifecycle lifecycle = getUserCourseEnv().getLifecycle(); + if (lifecycle != null && lifecycle.getValidFrom() != null) { + return Double.valueOf(lifecycle.getValidFrom().getTime()); + } else { + // what to do in case of no date available??? -> return date in the future + return new Double(Double.POSITIVE_INFINITY); + } + } + + @Override + protected Object defaultValue() { + return new Double(Double.MIN_VALUE); + } +} \ No newline at end of file diff --git a/src/main/java/org/olat/course/condition/interpreter/GetCourseEndDateFunction.java b/src/main/java/org/olat/course/condition/interpreter/GetCourseEndDateFunction.java new file mode 100644 index 0000000000000000000000000000000000000000..5bfa667085a906a4c085719e83378b99c7c35662 --- /dev/null +++ b/src/main/java/org/olat/course/condition/interpreter/GetCourseEndDateFunction.java @@ -0,0 +1,71 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.course.condition.interpreter; + +import org.olat.course.editor.CourseEditorEnv; +import org.olat.course.run.userview.UserCourseEnvironment; +import org.olat.repository.model.RepositoryEntryLifecycle; + +/** + * + * Description:<br> + * Function to get the end date of the course + * lifecycle. + * <P> + * Initial Date: 4.12.2013 <br> + * + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + */ +public class GetCourseEndDateFunction extends AbstractFunction { + + public static final String name = "getCourseEndDate"; + + /** + * Default constructor to use the get initial enrollment date + * @param userCourseEnv + */ + public GetCourseEndDateFunction(UserCourseEnvironment userCourseEnv) { + super(userCourseEnv); + } + + /** + * @see com.neemsoft.jmep.FunctionCB#call(java.lang.Object[]) + */ + @Override + public Object call(Object[] inStack) { + CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv(); + if(cev != null) { + return defaultValue(); + } + + RepositoryEntryLifecycle lifecycle = getUserCourseEnv().getLifecycle(); + if (lifecycle != null && lifecycle.getValidTo() != null) { + return Double.valueOf(lifecycle.getValidTo().getTime()); + } else { + // what to do in case of no date available??? -> return date in the future + return new Double(Double.POSITIVE_INFINITY); + } + } + + @Override + protected Object defaultValue() { + return new Double(Double.MIN_VALUE); + } +} \ No newline at end of file diff --git a/src/main/java/org/olat/course/condition/interpreter/IsLearningGroupFullFunction.java b/src/main/java/org/olat/course/condition/interpreter/IsLearningGroupFullFunction.java index 4114479dd60774d11abb61b04e93570f9b5dc3f7..864200e7ffd5c745f488983a30ead20a7bf5e918 100755 --- a/src/main/java/org/olat/course/condition/interpreter/IsLearningGroupFullFunction.java +++ b/src/main/java/org/olat/course/condition/interpreter/IsLearningGroupFullFunction.java @@ -50,7 +50,7 @@ public class IsLearningGroupFullFunction extends AbstractFunction { /** * @param userCourseEnv */ - public IsLearningGroupFullFunction(UserCourseEnvironment userCourseEnv, String fnName) { + public IsLearningGroupFullFunction(UserCourseEnvironment userCourseEnv) { super(userCourseEnv); } diff --git a/src/main/java/org/olat/course/condition/interpreter/OnlyGroupConditionInterpreter.java b/src/main/java/org/olat/course/condition/interpreter/OnlyGroupConditionInterpreter.java index f7063d909875b956a45932c6790d62cad632f022..09e63743ba787973e295e1bf885115c77e1bd06d 100644 --- a/src/main/java/org/olat/course/condition/interpreter/OnlyGroupConditionInterpreter.java +++ b/src/main/java/org/olat/course/condition/interpreter/OnlyGroupConditionInterpreter.java @@ -82,7 +82,9 @@ public class OnlyGroupConditionInterpreter extends ConditionInterpreter{ env.addFunction(IsCourseAdministratorFunction.name, new DummyBooleanFunction(userCourseEnv)); env.addFunction(GetAttemptsFunction.name, new DummyIntegerFunction(userCourseEnv)); - + + env.addFunction(GetCourseBeginDateFunction.name, new GetCourseBeginDateFunction(userCourseEnv)); + env.addFunction(GetCourseEndDateFunction.name, new GetCourseEndDateFunction(userCourseEnv)); env.addFunction(GetInitialCourseLaunchDateFunction.name, new GetInitialCourseLaunchDateFunction(userCourseEnv)); env.addFunction(GetRecentCourseLaunchDateFunction.name, new GetRecentCourseLaunchDateFunction(userCourseEnv)); diff --git a/src/main/java/org/olat/course/condition/interpreter/score/GetScoreWithCourseIdFunction.java b/src/main/java/org/olat/course/condition/interpreter/score/GetScoreWithCourseIdFunction.java index 8f42f3af450cd0d5d0b55872f7d966c886e2b3a3..55a102ea4339d538411e09be775f63ade09a484b 100644 --- a/src/main/java/org/olat/course/condition/interpreter/score/GetScoreWithCourseIdFunction.java +++ b/src/main/java/org/olat/course/condition/interpreter/score/GetScoreWithCourseIdFunction.java @@ -54,39 +54,25 @@ public class GetScoreWithCourseIdFunction extends AbstractFunction { * @see com.neemsoft.jmep.FunctionCB#call(java.lang.Object[]) */ public Object call(Object[] inStack) { - /* - * argument check - */ - if (inStack.length > 2) { + if (inStack.length > 2) {//need > 2 for compatibility reason return handleException(new ArgumentParseException(ArgumentParseException.NEEDS_FEWER_ARGUMENTS, name, "", "error.fewerargs", "solution.provideone.nodereference")); - } else if (inStack.length < 2) { return handleException( new ArgumentParseException(ArgumentParseException.NEEDS_MORE_ARGUMENTS, name, "", + } else if (inStack.length < 1) { return handleException( new ArgumentParseException(ArgumentParseException.NEEDS_MORE_ARGUMENTS, name, "", "error.moreargs", "solution.provideone.nodereference")); } - /* - * argument type check - */ - //TODO argument check courseRepoEntryKey + Long courseRepoEntryKey; try{ courseRepoEntryKey = Long.decode((String) inStack[0]) ; - }catch(NumberFormatException nfe) { + } catch(NumberFormatException nfe) { return handleException( new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "", "error.argtype.coursnodeidexpeted", "solution.example.node.infunction")); } - - if (!(inStack[1] instanceof String)) return handleException( new ArgumentParseException(ArgumentParseException.WRONG_ARGUMENT_FORMAT, name, "", - "error.argtype.coursnodeidexpeted", "solution.example.node.infunction")); - String childId = (String) inStack[1]; - /* - * no integrity check can be done - other course might not exist anymore - */ + + // no integrity check can be done - other course might not exist anymore CourseEditorEnv cev = getUserCourseEnv().getCourseEditorEnv(); if (cev != null) { return defaultValue(); } - /* - * the real function evaluation which is used during run time - */ - + // the real function evaluation which is used during run time EfficiencyStatementManager esm = EfficiencyStatementManager.getInstance(); UserEfficiencyStatement es = esm.getUserEfficiencyStatementLight(courseRepoEntryKey, getUserCourseEnv().getIdentityEnvironment().getIdentity()); if (es == null) return defaultValue(); diff --git a/src/main/java/org/olat/course/editor/EditorUserCourseEnvironmentImpl.java b/src/main/java/org/olat/course/editor/EditorUserCourseEnvironmentImpl.java index bfeea21f1d97747c1fe62644e34e88665f295ed8..78c28a65760756ed3c9c1d53d3ec95740cb17ce7 100644 --- a/src/main/java/org/olat/course/editor/EditorUserCourseEnvironmentImpl.java +++ b/src/main/java/org/olat/course/editor/EditorUserCourseEnvironmentImpl.java @@ -28,9 +28,14 @@ package org.olat.course.editor; import org.olat.core.id.IdentityEnvironment; import org.olat.core.logging.AssertException; import org.olat.course.condition.interpreter.ConditionInterpreter; +import org.olat.course.groupsandrights.CourseGroupManager; import org.olat.course.run.environment.CourseEnvironment; import org.olat.course.run.scoring.ScoreAccounting; import org.olat.course.run.userview.UserCourseEnvironment; +import org.olat.repository.RepositoryEntry; +import org.olat.repository.RepositoryManager; +import org.olat.repository.model.RepositoryEntryLifecycle; +import org.olat.resource.OLATResource; /** * Description:<br> @@ -45,12 +50,13 @@ public class EditorUserCourseEnvironmentImpl implements UserCourseEnvironment { private CourseEditorEnv courseEditorEnv; private ConditionInterpreter ci; private ScoreAccounting sa; + private RepositoryEntryLifecycle lifecycle; EditorUserCourseEnvironmentImpl(CourseEditorEnv courseEditorEnv){ this.courseEditorEnv = courseEditorEnv; - this.ci = new ConditionInterpreter(this); - this.courseEditorEnv.setConditionInterpreter(ci); - this.sa = new ScoreAccounting(this); + ci = new ConditionInterpreter(this); + courseEditorEnv.setConditionInterpreter(ci); + sa = new ScoreAccounting(this); } /** @@ -108,4 +114,17 @@ public class EditorUserCourseEnvironmentImpl implements UserCourseEnvironment { public boolean isParticipant() { return false; } + + @Override + public RepositoryEntryLifecycle getLifecycle() { + if(lifecycle == null) { + CourseGroupManager cgm = courseEditorEnv.getCourseGroupManager(); + OLATResource courseResource = cgm.getCourseResource(); + RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(courseResource, false); + if(re != null) { + lifecycle = re.getLifecycle(); + } + } + return lifecycle; + } } diff --git a/src/main/java/org/olat/course/editor/_chelp/ced-expert-eg.html b/src/main/java/org/olat/course/editor/_chelp/ced-expert-eg.html index 342ebcfd3abdb522ffa4bf7af22ad18928beec82..c2db01a922514bac97d275e57256e11500e413ea 100644 --- a/src/main/java/org/olat/course/editor/_chelp/ced-expert-eg.html +++ b/src/main/java/org/olat/course/editor/_chelp/ced-expert-eg.html @@ -70,6 +70,9 @@ <tr> <td><b>(getRecentCourseLaunchDate(0) + 10min > now </b> <br/>$r.translate("chelp.egR16") <br/><br/></td> </tr> + <tr> + <td><b>(getCourseBeginDate(0) <= now) | (getCourseEndDate(0) >= now)</b> <br/>$r.translate("chelp.egR17") <br/><br/></td> + </tr> </tbody> </table> <br/> diff --git a/src/main/java/org/olat/course/editor/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/course/editor/_i18n/LocalStrings_de.properties index eed3c6eb23c6997d60661b868c59059a05934970..4104261717e48840ebb2431c98f78439c290bce2 100644 --- a/src/main/java/org/olat/course/editor/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/course/editor/_i18n/LocalStrings_de.properties @@ -168,6 +168,7 @@ chelp.egR13=Gibt $\:chelp.wordTrue f\u00FCr diejenigen Kursteilnehmer, die sich chelp.egR14=Gibt $\:chelp.wordTrue w\u00E4hrend zwei Stunden ab Einschreibezeitpunkt f\u00FCr diejenigen Kursteilnehmer, die sich \u00FCber den Kursbaustein $\:chelp.en mit spezifizierter ID in eine zur Auswahl stehende Gruppe eingeschrieben haben. So kann abgebildet werden, dass jeder Kursteilnehmer nur w\u00E4hrend einer bestimmten Zeitdauer z.B. ein Skript bearbeiten kann. chelp.egR15=Gibt $\:chelp.wordTrue, wenn der Kursteilnehmer den Kurs noch nicht besucht hat oder w\u00E4hrend zwei Stunden seit dem ersten Kursbesuch. So kann abgebildet werden, dass jeder Kursteilnehmer nur w\u00E4hrend einer bestimmten Zeitdauer den Kurs sehen kann. chelp.egR16=Gibt $\:chelp.wordTrue, wenn sich der Benutzer seit mehr als 10 Minuten im Kurs bewegt. +chelp.egR17=Gibt den Wert $\:chelp.wordTrue zur\u00FCck, wenn das heutige Datum zwischen Beginn- und Enddatum des Durchf\u00FChrungszeitraums des Kurses liegt. chelp.egR2=Mit Ausnahme der Gruppe <i>«$\:chelp.deb»</i> ist der Kursbaustein f\u00FCr alle Kursteilnehmer sichtbar. chelp.egR3=Der Kursbaustein ist zwischen dem 22.03.2004 und 23.08.2004 f\u00FCr alle Kursteilnehmer sichtbar, w\u00E4hrend er f\u00FCr Mitglieder der Lerngruppe <i>«$\:chelp.coach»</i> jederzeit sichtbar ist. chelp.egR4=Der Kursbaustein ist zwischen dem 03.09.2004 und 13.10.2004 f\u00FCr alle Kursteilnehmer der Rechtegruppe <i>«$\:chelp.asses»</i> sichtbar, w\u00E4hrend er f\u00FCr die Person mit dem Benutzernamen <i>«$\:chelp.author»</i> jederzeit sichtbar ist. diff --git a/src/main/java/org/olat/course/editor/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/course/editor/_i18n/LocalStrings_fr.properties index 1687b69d9048232df2ee7d87d665fd80af652b22..72cc757cd5170ff0eeb4a1180da49d23b4d9465b 100644 --- a/src/main/java/org/olat/course/editor/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/course/editor/_i18n/LocalStrings_fr.properties @@ -1,4 +1,4 @@ -#Tue Oct 29 21:06:41 CET 2013 +#Wed Dec 04 16:44:31 CET 2013 access.form.label=Avoir acc\u00E8s au cours entier. access.legend=Modifier l'acc\u00E8s au cours entier alternative=Chercher un \u00E9l\u00E9ment de cours alternatif @@ -156,6 +156,7 @@ chelp.egR13=Donne $\:chelp.wordTrue pour les participants au cours qui se sont i chelp.egR14=Donne $\:chelp.wordTrue pendant deux heures \u00E0 partir du moment de l'inscription pour ces participants au cours qui se sont inscrits dans un des groupes mis \u00E0 disposition en passant par l'\u00E9l\u00E9ment de cours $\:chelp.en avec l'ID sp\u00E9cifi\u00E9. On peut ainsi voir que chaque participant au cours ne peut par exemple travailler sur un script que pendant une p\u00E9riode de temps d\u00E9termin\u00E9e. chelp.egR15=Donne $\:chelp.wordTrue, si un participant \u00E0 un cours n'a pas encore visit\u00E9 le cours ou durant les deux heures qui suivent la premi\u00E8re visite. De cette mani\u00E8re, il est possible repr\u00E9senter que chaque participant au cours peut voir le cours durant une p\u00E9riode de temps d\u00E9fini seulement. chelp.egR16=Donne $\:chelp.wordTrue, si l'utilisateur navigue dans le cours depuis plus de 10 minutes. +chelp.egR17=Retourne la valeur de $\:chelp.wordTrue si la date d'aujourd'hui se trouve entre les dates de d\u00E9but et de fin de la p\u00E9riode de cours si celles-ci se sont utilis\u00E9es. chelp.egR2=A l'exception du groupe <i>«$\:chelp.deb»</i>, l'\u00E9l\u00E9ment de cours est visible par tous les participants au cours chelp.egR3=L'\u00E9l\u00E9ment de cours est visible pour tous les participants au cours entre le 22.03.2004 et le 23.08.2004, tout en \u00E9tant visible \u00E0 tout moment pour les membres du groupe d'\u00E9tude <i>«$\:chelp.coach»</i>. chelp.egR4=L'\u00E9l\u00E9ment de cours est visible pour tous les participants au cours du groupe de droits <i>«$\:chelp.asses»</i> entre le 03.09.2004 et le 13.10.2004, tout en \u00E9tant visible \u00E0 tout moment pour la personne avec le nom d'utilisateur <i>«$\:chelp.author»</i>. diff --git a/src/main/java/org/olat/course/run/userview/UserCourseEnvironment.java b/src/main/java/org/olat/course/run/userview/UserCourseEnvironment.java index 0e39622998ff1e45dfcf94933e6aa710e0210240..39aaf5d744e1129e211cfa28bf4aee0fc49258a1 100644 --- a/src/main/java/org/olat/course/run/userview/UserCourseEnvironment.java +++ b/src/main/java/org/olat/course/run/userview/UserCourseEnvironment.java @@ -30,6 +30,7 @@ import org.olat.course.condition.interpreter.ConditionInterpreter; import org.olat.course.editor.CourseEditorEnv; import org.olat.course.run.environment.CourseEnvironment; import org.olat.course.run.scoring.ScoreAccounting; +import org.olat.repository.model.RepositoryEntryLifecycle; /** * @author Felix Jost @@ -60,5 +61,7 @@ public interface UserCourseEnvironment { public boolean isParticipant(); public boolean isIdentityInCourseGroup(Long groupKey); + + public RepositoryEntryLifecycle getLifecycle(); } \ No newline at end of file diff --git a/src/main/java/org/olat/course/run/userview/UserCourseEnvironmentImpl.java b/src/main/java/org/olat/course/run/userview/UserCourseEnvironmentImpl.java index 340cc3878ccae8d0c0f92af991839c8b9f4faa6b..ac34048887b67d5dfbea18e723c80fec7641fffc 100644 --- a/src/main/java/org/olat/course/run/userview/UserCourseEnvironmentImpl.java +++ b/src/main/java/org/olat/course/run/userview/UserCourseEnvironmentImpl.java @@ -35,6 +35,10 @@ import org.olat.course.groupsandrights.CourseGroupManager; import org.olat.course.run.environment.CourseEnvironment; import org.olat.course.run.scoring.ScoreAccounting; import org.olat.group.BusinessGroup; +import org.olat.repository.RepositoryEntry; +import org.olat.repository.RepositoryManager; +import org.olat.repository.model.RepositoryEntryLifecycle; +import org.olat.resource.OLATResource; /** * Initial Date: Feb 6, 2004 @@ -46,6 +50,7 @@ public class UserCourseEnvironmentImpl implements UserCourseEnvironment { private CourseEnvironment courseEnvironment; private ConditionInterpreter conditionInterpreter; private ScoreAccounting scoreAccounting; + private RepositoryEntryLifecycle lifecycle; private List<BusinessGroup> coachedGroups; private List<BusinessGroup> participatingGroups; @@ -149,6 +154,19 @@ public class UserCourseEnvironmentImpl implements UserCourseEnvironment { return partLazy; } + @Override + public RepositoryEntryLifecycle getLifecycle() { + if(lifecycle == null) { + CourseGroupManager cgm = courseEnvironment.getCourseGroupManager(); + OLATResource courseResource = cgm.getCourseResource(); + RepositoryEntry re = RepositoryManager.getInstance().lookupRepositoryEntry(courseResource, false); + if(re != null) { + lifecycle = re.getLifecycle(); + } + } + return lifecycle; + } + public List<BusinessGroup> getCoachedGroups() { return coachedGroups; } diff --git a/src/main/java/org/olat/modules/co/ContactForm.java b/src/main/java/org/olat/modules/co/ContactForm.java index 7bf8aff43888660282b0d5006458553f9a5c00b3..ffe08c609ab1add37e039bbc55d22289e1aa4010 100644 --- a/src/main/java/org/olat/modules/co/ContactForm.java +++ b/src/main/java/org/olat/modules/co/ContactForm.java @@ -39,6 +39,7 @@ import org.olat.core.gui.components.form.flexible.FormItem; import org.olat.core.gui.components.form.flexible.FormItemContainer; import org.olat.core.gui.components.form.flexible.elements.FileElement; import org.olat.core.gui.components.form.flexible.elements.FormLink; +import org.olat.core.gui.components.form.flexible.elements.RichTextElement; import org.olat.core.gui.components.form.flexible.elements.SelectionElement; import org.olat.core.gui.components.form.flexible.elements.TextElement; import org.olat.core.gui.components.form.flexible.impl.Form; @@ -89,7 +90,7 @@ public class ContactForm extends FormBasicController { private final static String NLS_CONTACT_SUBJECT = "contact.subject"; private TextElement tsubject; private final static String NLS_CONTACT_BODY = "contact.body"; - private TextElement tbody; + private RichTextElement tbody; private final static String NLS_CONTACT_ATTACHMENT = "contact.attachment"; private final static String NLS_CONTACT_ATTACHMENT_EXPL = "contact.attachment.maxsize"; private int contactAttachmentMaxSizeInMb = 5; @@ -170,17 +171,14 @@ public class ContactForm extends FormBasicController { * @param defaultEmailTo */ private void addContactFormEmailTo(String defaultEmailTo) { - defaultEmailTo += tto.getValue(); tto.setValue(defaultEmailTo); ttoBig.setValue(defaultEmailTo); - tto.setVisible(!recipientsAreEditable); ttoBig.setVisible(recipientsAreEditable); } - /** * @param defaultBody */ @@ -190,8 +188,6 @@ public class ContactForm extends FormBasicController { tbody.setVisible(true); tbody.setMandatory(!readOnly); } - - @Override public boolean validateFormLogic(UserRequest ureq) { @@ -276,7 +272,7 @@ public class ContactForm extends FormBasicController { * @return email body text */ public String getBody() { - return tbody.getValue(); + return tbody.getValue(); } public File[] getAttachments() { @@ -388,7 +384,7 @@ public class ContactForm extends FormBasicController { tsubject = uifactory.addTextElement("tsubject", NLS_CONTACT_SUBJECT, 255, "", formLayout); tsubject.setDisplaySize(emailCols); - tbody = uifactory.addTextAreaElement("tbody", NLS_CONTACT_BODY, -1, 10, emailCols, true, "", formLayout); + tbody = uifactory.addRichTextElementForStringDataMinimalistic("tbody", NLS_CONTACT_BODY, "", 15, emailCols, formLayout, ureq.getUserSession(), getWindowControl()); tbody.setEnabled(!readOnly); String VELOCITY_ROOT = Util.getPackageVelocityRoot(this.getClass()); diff --git a/src/main/java/org/olat/registration/EmailOrUsernameFormController.java b/src/main/java/org/olat/registration/EmailOrUsernameFormController.java index 880db4832bd1432f938a465cf26c1f0772428292..10bad5f1ad332f24387b6db5169fd271b90ea7b1 100644 --- a/src/main/java/org/olat/registration/EmailOrUsernameFormController.java +++ b/src/main/java/org/olat/registration/EmailOrUsernameFormController.java @@ -66,6 +66,7 @@ public class EmailOrUsernameFormController extends FormBasicController { /** * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#formCancelled(org.olat.core.gui.UserRequest) */ + @Override protected void formCancelled(UserRequest ureq) { fireEvent(ureq, Event.CANCELLED_EVENT); } @@ -74,14 +75,14 @@ public class EmailOrUsernameFormController extends FormBasicController { * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer, * org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest) */ + @Override protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { - //fxdiff FXOLAT-113: business path in DMZ emailOrUsername = uifactory.addTextElement("emailOrUsername", "email.or.username", -1, initialEmail, formLayout); emailOrUsername.setMandatory(true); emailOrUsername.setNotEmptyCheck("email.or.username.maynotbeempty"); final FormLayoutContainer buttonLayout = FormLayoutContainer.createButtonLayout("button_layout", getTranslator()); - this.flc.add(buttonLayout); + flc.add(buttonLayout); uifactory.addFormSubmitButton("submit", buttonLayout); uifactory.addFormCancelButton("cancel", buttonLayout, ureq, getWindowControl()); } @@ -90,7 +91,7 @@ public class EmailOrUsernameFormController extends FormBasicController { * @return The email address or username entered by the user */ public String getEmailOrUsername() { - return emailOrUsername.getValue(); + return emailOrUsername.getValue().toLowerCase(); } public void setUserNotIdentifiedError() { diff --git a/src/main/java/org/olat/user/PersonalSettingsController.java b/src/main/java/org/olat/user/PersonalSettingsController.java index a11e0829e2160c869058b0ead1e63c9058b88bed..9d518966cbf1b71ad20145aab788b54be037c050 100644 --- a/src/main/java/org/olat/user/PersonalSettingsController.java +++ b/src/main/java/org/olat/user/PersonalSettingsController.java @@ -123,10 +123,6 @@ public class PersonalSettingsController extends BasicController implements Activ userConfig.addTab(translate("tab.disclaimer"), disclaimerCtr.getInitialComponent()); } - Controller rolesCtrl = new UserRolesController(ureq, getWindowControl()); - userConfig.addTab(translate("tab.roles"), rolesCtrl.getInitialComponent()); - listenTo(rolesCtrl); - putInitialPanel(userConfig); logDebug("PersonalSettingsController constructed, set velocity page to index.html", PersonalSettingsController.class.getSimpleName()); diff --git a/src/main/java/org/olat/user/PreferencesFormController.java b/src/main/java/org/olat/user/PreferencesFormController.java index 5be5c99e37a8353b289fb9e1a1668795f462fdb6..37961d4e2853ddcb61fd9a3d2a8e03471eb424dd 100644 --- a/src/main/java/org/olat/user/PreferencesFormController.java +++ b/src/main/java/org/olat/user/PreferencesFormController.java @@ -23,8 +23,10 @@ import java.nio.charset.Charset; import java.util.List; import java.util.Map; +import org.olat.admin.user.SystemRolesAndRightsController; import org.olat.basesecurity.BaseSecurity; import org.olat.basesecurity.BaseSecurityManager; +import org.olat.basesecurity.Constants; import org.olat.core.CoreSpringFactory; import org.olat.core.gui.UserRequest; import org.olat.core.gui.components.form.flexible.FormItem; @@ -43,6 +45,7 @@ import org.olat.core.id.Preferences; import org.olat.core.id.UserConstants; import org.olat.core.util.ArrayHelper; import org.olat.core.util.StringHelper; +import org.olat.core.util.Util; import org.olat.core.util.i18n.I18nManager; import org.olat.core.util.i18n.I18nModule; import org.olat.core.util.mail.MailModule; @@ -77,7 +80,7 @@ public class PreferencesFormController extends FormBasicController { * edited. Not necessarily the same as ureq.getIdentity() */ public PreferencesFormController(UserRequest ureq, WindowControl wControl, Identity tobeChangedIdentity) { - super(ureq, wControl); + super(ureq, wControl, Util.createPackageTranslator(SystemRolesAndRightsController.class, ureq.getLocale())); this.tobeChangedIdentity = tobeChangedIdentity; initForm(ureq); } @@ -147,6 +150,39 @@ public class PreferencesFormController extends FormBasicController { username.setElementCssClass("o_sel_home_settings_username"); username.setEnabled(false); + // Roles + final String[] roleKeys = new String[] { + Constants.GROUP_USERMANAGERS, Constants.GROUP_GROUPMANAGERS, Constants.GROUP_POOL_MANAGER, + Constants.GROUP_AUTHORS, Constants.GROUP_INST_ORES_MANAGER, Constants.GROUP_ADMIN + }; + String iname = getIdentity().getUser().getProperty("institutionalName", null); + String ilabel = iname != null + ? translate("rightsForm.isInstitutionalResourceManager.institution",iname) + : translate("rightsForm.isInstitutionalResourceManager"); + + final String[] roleValues = new String[]{ + translate("rightsForm.isUsermanager"), translate("rightsForm.isGroupmanager"), translate("rightsForm.isPoolmanager"), + translate("rightsForm.isAuthor"), ilabel, translate("rightsForm.isAdmin") + }; + final BaseSecurity securityManager = CoreSpringFactory.getImpl(BaseSecurity.class); + String userRoles = ""; + List<String> roles = securityManager.getRolesAsString(tobeChangedIdentity); + for(String role:roles) { + for(int i=0; i<roleKeys.length; i++) { + if(roleKeys[i].equals(role)) { + userRoles = userRoles + roleValues[i] + ", "; + } + } + } + if (userRoles.equals("")) { + userRoles = translate("rightsForm.isAnonymous.false"); + } else { + userRoles = userRoles.substring(0, userRoles.lastIndexOf(",")); + } + uifactory.addStaticTextElement("rightsForm.roles", userRoles, formLayout); + username.setElementCssClass("o_sel_home_settings_username"); + username.setEnabled(false); + // Language Map<String, String> languages = I18nManager.getInstance().getEnabledLanguagesTranslated(); String[] langKeys = StringHelper.getMapKeysAsStringArray(languages); diff --git a/src/main/java/org/olat/user/UserRolesController.java b/src/main/java/org/olat/user/UserRolesController.java deleted file mode 100644 index 97d4bd9d4f98047de9bc3f76e3dc153b263a4fdf..0000000000000000000000000000000000000000 --- a/src/main/java/org/olat/user/UserRolesController.java +++ /dev/null @@ -1,96 +0,0 @@ -/** - * <a href="http://www.openolat.org"> - * OpenOLAT - Online Learning and Training</a><br> - * <p> - * Licensed under the Apache License, Version 2.0 (the "License"); <br> - * you may not use this file except in compliance with the License.<br> - * You may obtain a copy of the License at the - * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> - * <p> - * Unless required by applicable law or agreed to in writing,<br> - * software distributed under the License is distributed on an "AS IS" BASIS, <br> - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> - * See the License for the specific language governing permissions and <br> - * limitations under the License. - * <p> - * Initial code contributed and copyrighted by<br> - * frentix GmbH, http://www.frentix.com - * <p> - */ -package org.olat.user; - -import java.util.List; - -import org.olat.admin.user.SystemRolesAndRightsController; -import org.olat.basesecurity.BaseSecurity; -import org.olat.basesecurity.Constants; -import org.olat.core.CoreSpringFactory; -import org.olat.core.gui.UserRequest; -import org.olat.core.gui.components.form.flexible.FormItemContainer; -import org.olat.core.gui.components.form.flexible.elements.SelectionElement; -import org.olat.core.gui.components.form.flexible.impl.FormBasicController; -import org.olat.core.gui.control.Controller; -import org.olat.core.gui.control.WindowControl; -import org.olat.core.util.Util; - - -/** - * Small controller which shows the roles of the current identity - * - * Initial date: 23.09.2013<br> - * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com - * - */ -public class UserRolesController extends FormBasicController { - - private static final String[] roleKeys = new String[] { - Constants.GROUP_USERMANAGERS, Constants.GROUP_GROUPMANAGERS, Constants.GROUP_POOL_MANAGER, - Constants.GROUP_AUTHORS, Constants.GROUP_INST_ORES_MANAGER, Constants.GROUP_ADMIN - }; - - private String[] roleValues; - - private final BaseSecurity securityManager; - - public UserRolesController(UserRequest ureq, WindowControl wControl) { - super(ureq, wControl, Util.createPackageTranslator(SystemRolesAndRightsController.class, ureq.getLocale())); - - securityManager = CoreSpringFactory.getImpl(BaseSecurity.class); - - String iname = getIdentity().getUser().getProperty("institutionalName", null); - String ilabel = iname != null - ? translate("rightsForm.isInstitutionalResourceManager.institution",iname) - : translate("rightsForm.isInstitutionalResourceManager"); - - roleValues = new String[]{ - translate("rightsForm.isUsermanager"), translate("rightsForm.isGroupmanager"), translate("rightsForm.isPoolmanager"), - translate("rightsForm.isAuthor"), ilabel, translate("rightsForm.isAdmin") - }; - - initForm(ureq); - } - - @Override - protected void formOK(UserRequest ureq) { - // - } - - @Override - protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { - SelectionElement rolesEl = uifactory.addCheckboxesVertical("roles", "rightsForm.roles", formLayout, roleKeys, roleValues,null, 1); - rolesEl.setEnabled(false); - List<String> roles = securityManager.getRolesAsString(getIdentity()); - for(String role:roles) { - for(String roleKey:roleKeys) { - if(roleKey.equals(role)) { - rolesEl.select(roleKey, true); - } - } - } - } - - @Override - protected void doDispose() { - // - } -} \ No newline at end of file diff --git a/src/main/java/org/olat/user/_i18n/LocalStrings_fr.properties b/src/main/java/org/olat/user/_i18n/LocalStrings_fr.properties index 4bf65b8ecceffa414e29ff71631e2c9c24ab5a90..a061acde62b5aa788f2d89eeebd8f224caa7a9ab 100644 --- a/src/main/java/org/olat/user/_i18n/LocalStrings_fr.properties +++ b/src/main/java/org/olat/user/_i18n/LocalStrings_fr.properties @@ -1,4 +1,4 @@ -#Sun Oct 27 17:37:37 CET 2013 +#Wed Dec 04 16:44:38 CET 2013 Failed=La transmission du fichier a \u00E9chou\u00E9. NoImage=L'image ne peut pas \u00EAtre transmise sous ce format de fichier. ULLimitExceeded=L'image ne doit pas d\u00E9passer {0} KB. @@ -238,3 +238,5 @@ ul.upload=T\u00E9l\u00E9charger user.deleted=Cet utilisateur a \u00E9t\u00E9 supprim\u00E9 dans OLAT user.preferences.successful=Les configurations du syst\u00E8me de l'utilisateur ({0}) ont \u00E9t\u00E9 enregistr\u00E9es. Les modifications concernant les configurations linguistiques et la modalit\u00E9 AJAX seront activ\u00E9es apr\u00E8s le prochain login. user.preferences.unsuccessful=Les configurations du syst\u00E8me de l'utilisateur ({0}) n'ont pas \u00E9t\u00E9 enregistr\u00E9es. R\u00E9essayez, svp. +webdav.link.http=$org.olat.core.commons.modules.bc\:webdav.link.http +webdav.link.https=$org.olat.core.commons.modules.bc\:webdav.link.https