use of org.olat.user.propertyhandlers.EmailProperty in project openolat by klemens.
the class MemberSearchForm method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
FormLayoutContainer leftContainer = FormLayoutContainer.createDefaultFormLayout("left_1", getTranslator());
leftContainer.setRootForm(mainForm);
formLayout.add(leftContainer);
// user property
login = uifactory.addTextElement("login", "search.login", 128, "", leftContainer);
login.setDisplaySize(28);
userPropertyHandlers = userManager.getUserPropertyHandlersFor(getClass().getCanonicalName(), false);
propFormItems = new HashMap<String, FormItem>();
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null)
continue;
FormItem fi = userPropertyHandler.addFormItem(getLocale(), null, getClass().getCanonicalName(), false, leftContainer);
fi.setTranslator(this.getTranslator());
// DO NOT validate email field => see OLAT-3324, OO-155, OO-222
if (userPropertyHandler instanceof EmailProperty && fi instanceof TextElement) {
TextElement textElement = (TextElement) fi;
textElement.setItemValidatorProvider(null);
}
if (fi instanceof TextElement) {
((TextElement) fi).setDisplaySize(28);
}
propFormItems.put(userPropertyHandler.getName(), fi);
}
// others
FormLayoutContainer rightContainer = FormLayoutContainer.createDefaultFormLayout("right_1", getTranslator());
rightContainer.setRootForm(mainForm);
formLayout.add(rightContainer);
// roles
String[] roleValues = new String[roleKeys.length];
for (int i = roleKeys.length; i-- > 0; ) {
roleValues[i] = translate("search." + roleKeys[i]);
}
rolesEl = uifactory.addCheckboxesHorizontal("roles", "search.roles", rightContainer, roleKeys, roleValues);
for (String roleKey : roleKeys) {
rolesEl.select(roleKey, true);
}
String[] openValues = new String[originKeys.length];
for (int i = originKeys.length; i-- > 0; ) {
openValues[i] = translate("search." + originKeys[i]);
}
originEl = uifactory.addRadiosHorizontal("openBg", "search.origin", rightContainer, originKeys, openValues);
originEl.select("all", true);
FormLayoutContainer buttonLayout = FormLayoutContainer.createDefaultFormLayout("button_layout", getTranslator());
formLayout.add(buttonLayout);
searchButton = uifactory.addFormLink("search", buttonLayout, Link.BUTTON);
searchButton.setCustomEnabledLinkCSS("btn btn-primary");
}
use of org.olat.user.propertyhandlers.EmailProperty in project openolat by klemens.
the class UserSearchForm method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
login = uifactory.addTextElement("login", "search.form.login", 128, "", formLayout);
login.setVisible(adminProps);
userPropertyHandlers = userManager.getUserPropertyHandlersFor(PROPS_IDENTIFIER, adminProps);
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler != null) {
FormItem fi = userPropertyHandler.addFormItem(getLocale(), null, getClass().getCanonicalName(), false, formLayout);
fi.setMandatory(false);
// DO NOT validate email field => see OLAT-3324, OO-155, OO-222
if (userPropertyHandler instanceof EmailProperty && fi instanceof TextElement) {
TextElement textElement = (TextElement) fi;
textElement.setItemValidatorProvider(null);
}
propFormItems.put(userPropertyHandler.getName(), fi);
}
}
statusEl = uifactory.addCheckboxesHorizontal("only.active", formLayout, activeKeys, activeValues);
statusEl.select(activeKeys[0], true);
FormLayoutContainer buttonCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonCont);
uifactory.addFormSubmitButton("search", buttonCont);
}
Aggregations