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

OO-4888: remove double user name field in user search of others users

parent 6e2b00e7
No related branches found
No related tags found
No related merge requests found
...@@ -295,13 +295,15 @@ public class UserSearchController extends BasicController { ...@@ -295,13 +295,15 @@ public class UserSearchController extends BasicController {
for (UserPropertyHandler userPropertyHandler : searchform.userPropertyHandlers) { for (UserPropertyHandler userPropertyHandler : searchform.userPropertyHandlers) {
if (userPropertyHandler == null) continue; if (userPropertyHandler == null) continue;
FormItem ui = searchform.propFormItems.get(userPropertyHandler.getName()); FormItem ui = searchform.propFormItems.get(userPropertyHandler.getName());
String uiValue = userPropertyHandler.getStringValue(ui); if(ui != null) {
if(userPropertyHandler.getName().startsWith("genericCheckboxProperty")) { String uiValue = userPropertyHandler.getStringValue(ui);
if(!"false".equals(uiValue)) { if(userPropertyHandler.getName().startsWith("genericCheckboxProperty")) {
if(!"false".equals(uiValue)) {
userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
}
} else if (StringHelper.containsNonWhitespace(uiValue)) {
userPropertiesSearch.put(userPropertyHandler.getName(), uiValue); userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
} }
} else if (StringHelper.containsNonWhitespace(uiValue)) {
userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
} }
} }
if (userPropertiesSearch.isEmpty()) { if (userPropertiesSearch.isEmpty()) {
......
...@@ -36,6 +36,7 @@ import org.olat.core.gui.control.Controller; ...@@ -36,6 +36,7 @@ import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.Event; import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl; import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.translator.Translator; import org.olat.core.gui.translator.Translator;
import org.olat.core.id.UserConstants;
import org.olat.core.util.StringHelper; import org.olat.core.util.StringHelper;
import org.olat.core.util.UserSession; import org.olat.core.util.UserSession;
import org.olat.core.util.Util; import org.olat.core.util.Util;
...@@ -156,17 +157,20 @@ public class UserSearchForm extends FormBasicController { ...@@ -156,17 +157,20 @@ public class UserSearchForm extends FormBasicController {
Translator tr = Util.createPackageTranslator(UserPropertyHandler.class, getLocale(), getTranslator()); Translator tr = Util.createPackageTranslator(UserPropertyHandler.class, getLocale(), getTranslator());
for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) { for (UserPropertyHandler userPropertyHandler : userPropertyHandlers) {
if (userPropertyHandler == null) continue; if (userPropertyHandler == null || (userPropertyHandler.getName().equals(UserConstants.NICKNAME) && isAdminProps)) {
continue;
}
FormItem fi = userPropertyHandler.addFormItem(getLocale(), null, getClass().getCanonicalName(), false, formLayout); FormItem fi = userPropertyHandler.addFormItem(getLocale(), null, getClass().getCanonicalName(), false, formLayout);
fi.setTranslator(tr); fi.setTranslator(tr);
// DO NOT validate email field => see OLAT-3324, OO-155, OO-222 // DO NOT validate email field => see OLAT-3324, OO-155, OO-222
if (userPropertyHandler instanceof EmailProperty && fi instanceof TextElement) { if ((userPropertyHandler instanceof EmailProperty || userPropertyHandler.getName().equals(UserConstants.NICKNAME))
&& fi instanceof TextElement) {
TextElement textElement = (TextElement)fi; TextElement textElement = (TextElement)fi;
textElement.setItemValidatorProvider(null); textElement.setItemValidatorProvider(null);
} }
fi.setElementCssClass("o_sel_user_search_".concat(userPropertyHandler.getName().toLowerCase())); fi.setElementCssClass("o_sel_user_search_".concat(userPropertyHandler.getName().toLowerCase()));
propFormItems.put(userPropertyHandler.getName(), fi); propFormItems.put(userPropertyHandler.getName(), fi);
} }
......
...@@ -72,17 +72,11 @@ public class UserSearchAndInfoController extends BasicController { ...@@ -72,17 +72,11 @@ public class UserSearchAndInfoController extends BasicController {
} }
} }
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
@Override @Override
protected void event(UserRequest ureq, Component source, Event event) { protected void event(UserRequest ureq, Component source, Event event) {
// //
} }
/**
* @see org.olat.core.gui.control.DefaultController#doDispose()
*/
@Override @Override
protected void doDispose() { protected void doDispose() {
// //
......
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