Skip to content
Snippets Groups Projects
Commit b0ba280d authored by srosse's avatar srosse
Browse files

OO-5235: generic selection fall back to key if locale not defined

parent 14bcca9c
No related branches found
No related tags found
No related merge requests found
......@@ -41,10 +41,6 @@ import org.olat.user.UserManager;
*/
public class GenericCheckboxPropertyHandler extends AbstractUserPropertyHandler {
/**
*
* @see org.olat.user.propertyhandlers.UserPropertyHandler#addFormItem(java.util.Locale, org.olat.core.id.User, java.lang.String, boolean, org.olat.core.gui.components.form.flexible.FormItemContainer)
*/
@Override
public FormItem addFormItem(Locale locale, User user, String usageIdentifyer, boolean isAdministrativeUser,
FormItemContainer formItemContainer) {
......@@ -61,11 +57,6 @@ public class GenericCheckboxPropertyHandler extends AbstractUserPropertyHandler
return sElem;
}
/**
*
* @see org.olat.user.propertyhandlers.UserPropertyHandler#getStringValue(org.olat.core.gui.components.form.flexible.FormItem)
*/
@Override
public String getStringValue(FormItem formItem) {
String value = "";
......@@ -77,42 +68,24 @@ public class GenericCheckboxPropertyHandler extends AbstractUserPropertyHandler
return value;
}
/**
*
* @see org.olat.user.propertyhandlers.UserPropertyHandler#getStringValue(java.lang.String, java.util.Locale)
*/
@Override
public String getStringValue(String displayValue, Locale locale) {
return displayValue;
}
/**
*
* @see org.olat.user.propertyhandlers.UserPropertyHandler#isValid(org.olat.core.gui.components.form.flexible.FormItem, java.util.Map)
*/
@Override
public boolean isValid(User user, FormItem formItem, Map<String, String> formContext) {
return true;
}
/**
*
* @see org.olat.user.propertyhandlers.UserPropertyHandler#isValidValue(java.lang.String, org.olat.core.gui.components.form.ValidationError, java.util.Locale)
*/
@Override
public boolean isValidValue(User user, String value, ValidationError validationError, Locale locale) {
return true;
}
/**
*
* @see org.olat.user.propertyhandlers.UserPropertyHandler#updateUserFromFormItem(org.olat.core.id.User, org.olat.core.gui.components.form.flexible.FormItem)
*/
@Override
public void updateUserFromFormItem(User user, FormItem formItem) {
String internalValue = getStringValue(formItem);
setInternalValue(user, internalValue);
}
}
......@@ -299,12 +299,20 @@ public class GenericSelectionPropertyHandler extends AbstractUserPropertyHandler
if (isMultiSelect()) {
for (String value : val.split(KEY_DELIMITER)) {
if(StringHelper.containsNonWhitespace(value)) {
if(htmlValue.length() > 0) htmlValue.append(" ");
htmlValue.append(trans.translate(value));
if(htmlValue.length() > 0) {
htmlValue.append(" ");
}
if(locale != null) {
htmlValue.append(trans.translate(value));
} else {
htmlValue.append(value);
}
}
}
} else if(locale != null) {
htmlValue.append(trans.translate(val));
} else {
htmlValue.append(val);
}
}
return htmlValue.toString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment