use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project openolat by klemens.
the class CopyEventToCalendarController method formOK.
@Override
protected void formOK(UserRequest ureq) {
for (MultipleSelectionElement copyEl : copyEls) {
if (copyEl.isEnabled() && copyEl.isAtLeastSelected(1)) {
KalendarRenderWrapper calendarWrapper = (KalendarRenderWrapper) copyEl.getUserObject();
Kalendar cal = calendarWrapper.getKalendar();
KalendarEvent clonedKalendarEvent = (KalendarEvent) XStreamHelper.xstreamClone(kalendarEvent);
if (clonedKalendarEvent.getKalendarEventLinks().size() > 0) {
clonedKalendarEvent.setKalendarEventLinks(new ArrayList<KalendarEventLink>());
}
calendarManager.addEventTo(cal, clonedKalendarEvent);
}
}
fireEvent(ureq, Event.DONE_EVENT);
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project openolat by klemens.
the class CopyEventToCalendarController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
setFormTitle("cal.copy.title");
copyEls = new ArrayList<>(calendars.size());
for (KalendarRenderWrapper calendarWrapper : calendars) {
String calId = calendarWrapper.getKalendar().getCalendarID();
String value = calendarWrapper.getDisplayName();
MultipleSelectionElement copyEl = uifactory.addCheckboxesHorizontal("cal_" + calId, null, formLayout, copy, new String[] { value });
copyEl.setUserObject(calendarWrapper);
if (calendarWrapper.getKalendar().getCalendarID().equals(kalendarEvent.getCalendar().getCalendarID())) {
// this is the calendar, the event comes from
copyEl.select(copy[0], true);
copyEl.setEnabled(false);
} else {
copyEl.setEnabled(calendarWrapper.getAccess() == KalendarRenderWrapper.ACCESS_READ_WRITE);
}
}
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project openolat by klemens.
the class UsermanagerUserSearchForm method findIdentitiesFromSearchForm.
/**
* @return List of identities that match the criterias from the search form
*/
private List<Identity> findIdentitiesFromSearchForm() {
// get user attributes from form
String login = searchform.getStringValue("login");
// when searching for deleted users, add wildcard to match with backup prefix
if (searchform.getStatus().equals(Identity.STATUS_DELETED)) {
login = "*" + login;
}
Integer status = null;
// get user fields from form
// build user fields search map
Map<String, String> userPropertiesSearch = new HashMap<String, String>();
for (UserPropertyHandler userPropertyHandler : searchform.getPropertyHandlers()) {
if (userPropertyHandler == null)
continue;
FormItem ui = searchform.getItem(userPropertyHandler.getName());
String uiValue = userPropertyHandler.getStringValue(ui);
if (userPropertyHandler.getName().startsWith("genericCheckboxProperty") && ui instanceof MultipleSelectionElement) {
if (!"false".equals(uiValue)) {
// ignore false for the search
userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
}
} else if (StringHelper.containsNonWhitespace(uiValue)) {
// when searching for deleted users, add wildcard to match with backup prefix
if (userPropertyHandler instanceof EmailProperty && searchform.getStatus().equals(Identity.STATUS_DELETED)) {
uiValue = "*" + uiValue;
}
userPropertiesSearch.put(userPropertyHandler.getName(), uiValue);
}
}
if (userPropertiesSearch.isEmpty())
userPropertiesSearch = null;
// get group memberships from form
List<SecurityGroup> groupsList = new ArrayList<SecurityGroup>();
if (searchform.getRole("admin")) {
SecurityGroup group = securityManager.findSecurityGroupByName(Constants.GROUP_ADMIN);
groupsList.add(group);
}
if (searchform.getRole("author")) {
SecurityGroup group = securityManager.findSecurityGroupByName(Constants.GROUP_AUTHORS);
groupsList.add(group);
}
if (searchform.getRole("groupmanager")) {
SecurityGroup group = securityManager.findSecurityGroupByName(Constants.GROUP_GROUPMANAGERS);
groupsList.add(group);
}
if (searchform.getRole("usermanager")) {
SecurityGroup group = securityManager.findSecurityGroupByName(Constants.GROUP_USERMANAGERS);
groupsList.add(group);
}
if (searchform.getRole("oresmanager")) {
SecurityGroup group = securityManager.findSecurityGroupByName(Constants.GROUP_INST_ORES_MANAGER);
groupsList.add(group);
}
if (searchform.getRole("poolmanager")) {
SecurityGroup group = securityManager.findSecurityGroupByName(Constants.GROUP_POOL_MANAGER);
groupsList.add(group);
}
status = searchform.getStatus();
SecurityGroup[] groups = groupsList.toArray(new SecurityGroup[groupsList.size()]);
// no permissions in this form so far
PermissionOnResourceable[] permissionOnResources = null;
String[] authProviders = searchform.getAuthProviders();
// get date constraints from form
Date createdBefore = searchform.getBeforeDate();
Date createdAfter = searchform.getAfterDate();
Date userLoginBefore = searchform.getUserLoginBefore();
Date userLoginAfter = searchform.getUserLoginAfter();
// now perform power search
List<Identity> myIdentities = securityManager.getIdentitiesByPowerSearch((login.equals("") ? null : login), userPropertiesSearch, true, groups, permissionOnResources, authProviders, createdAfter, createdBefore, userLoginAfter, userLoginBefore, status);
return myIdentities;
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project openolat by klemens.
the class GroupSearchController method createSelection.
private MultipleSelectionElement createSelection(String name) {
MultipleSelectionElement selection = new MultipleSelectionElementImpl(name, Layout.horizontal);
selection.setKeysAndValues(new String[] { "on" }, new String[] { "" });
tableCont.add(name, selection);
return selection;
}
use of org.olat.core.gui.components.form.flexible.elements.MultipleSelectionElement in project openolat by klemens.
the class CoreFunctionsController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
// server informations
FormLayoutContainer serverCont = FormLayoutContainer.createDefaultFormLayout("functions", getTranslator());
formLayout.add(serverCont);
formLayout.add("functions", serverCont);
MultipleSelectionElement clusterEl = uifactory.addCheckboxesHorizontal("webdav", "core.webdav", serverCont, new String[] { "xx" }, new String[] { "" });
clusterEl.setEnabled(false);
clusterEl.select("xx", CoreSpringFactory.getImpl(WebDAVModule.class).isEnabled());
MultipleSelectionElement jsMathEl = uifactory.addCheckboxesHorizontal("jsmath", "core.jsMath", serverCont, new String[] { "xx" }, new String[] { "" });
jsMathEl.setEnabled(false);
jsMathEl.select("xx", Boolean.TRUE);
MultipleSelectionElement restEl = uifactory.addCheckboxesHorizontal("restapi", "core.restapi", serverCont, new String[] { "xx" }, new String[] { "" });
restEl.setEnabled(false);
RestModule restModule = CoreSpringFactory.getImpl(RestModule.class);
restEl.select("xx", restModule.isEnabled());
}
Aggregations