use of org.olat.basesecurity.events.SingleIdentityChosenEvent in project openolat by klemens.
the class AdvancedPropertySearchForm method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source == usc && event.getCommand().equals("IdentityFound")) {
SingleIdentityChosenEvent uce = (SingleIdentityChosenEvent) event;
identity = uce.getChosenIdentity();
userName.setValue(identity.getName());
cmc.deactivate();
}
}
use of org.olat.basesecurity.events.SingleIdentityChosenEvent in project openolat by klemens.
the class DirectDeleteController method event.
/**
* This dispatches controller events...
*
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Controller sourceController, Event event) {
if (sourceController == usc) {
if (event == Event.CANCELLED_EVENT) {
removeAsListenerAndDispose(usc);
} else if (event instanceof MultiIdentityChosenEvent) {
MultiIdentityChosenEvent multiEvent = (MultiIdentityChosenEvent) event;
toDelete = multiEvent.getChosenIdentities();
if (toDelete.size() == 0) {
showError("msg.selectionempty");
return;
}
String names = buildUserNameList(toDelete);
deleteConfirmController = activateOkCancelDialog(ureq, null, translate("readyToDelete.delete.confirm", names), deleteConfirmController);
return;
} else if (event instanceof SingleIdentityChosenEvent) {
// single choose event may come from autocompleter user search
SingleIdentityChosenEvent uce = (SingleIdentityChosenEvent) event;
toDelete = new ArrayList<Identity>();
toDelete.add(uce.getChosenIdentity());
String fullname = userManager.getUserDisplayName(uce.getChosenIdentity());
deleteConfirmController = activateOkCancelDialog(ureq, null, translate("readyToDelete.delete.confirm", fullname), deleteConfirmController);
return;
} else {
throw new AssertException("unknown event ::" + event.getCommand());
}
} else if (sourceController == deleteConfirmController) {
if (DialogBoxUIFactory.isOkEvent(event)) {
deleteIdentities(toDelete);
if (bdc != null) {
bdc.sendMail();
}
initializeUserSearchController(ureq);
initializeUserListForm(ureq);
showInfo("deleted.users.msg");
}
} else if (sourceController == bdc) {
toDelete = bdc.getToDelete();
cmc.deactivate();
String names = buildUserNameList(toDelete);
deleteConfirmController = activateOkCancelDialog(ureq, null, translate("readyToDelete.delete.confirm", names), deleteConfirmController);
} else if (sourceController == cmc) {
if (event == Event.CANCELLED_EVENT) {
cmc.deactivate();
}
} else if (sourceController == userListForm) {
removeAsListenerAndDispose(bdc);
bdc = new BulkDeleteController(ureq, getWindowControl(), userListForm.getLogins(), userListForm.getReason());
listenTo(bdc);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), bdc.getInitialComponent());
listenTo(cmc);
cmc.activate();
}
}
use of org.olat.basesecurity.events.SingleIdentityChosenEvent in project openolat by klemens.
the class NewUserForm method formOK.
@Override
protected void formOK(UserRequest ureq) {
// Create user on database
Identity s = doCreateAndPersistIdentity();
if (s != null) {
log.audit(USER_CREATE_SUCCESS + s.getName());
fireEvent(ureq, new SingleIdentityChosenEvent(s));
} else {
// Could not save form, display error
getWindowControl().setError(translate("new.user.unsuccessful"));
fireEvent(ureq, Event.FAILED_EVENT);
}
}
use of org.olat.basesecurity.events.SingleIdentityChosenEvent in project openolat by klemens.
the class ImportMemberBySearchController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (event instanceof SingleIdentityChosenEvent) {
SingleIdentityChosenEvent e = (SingleIdentityChosenEvent) event;
addToRunContext("keyIdentities", Collections.singletonList(e.getChosenIdentity()));
fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
} else if (event instanceof MultiIdentityChosenEvent) {
MultiIdentityChosenEvent e = (MultiIdentityChosenEvent) event;
addToRunContext("keyIdentities", e.getChosenIdentities());
fireEvent(ureq, StepsEvent.ACTIVATE_NEXT);
} else {
super.event(ureq, source, event);
}
}
use of org.olat.basesecurity.events.SingleIdentityChosenEvent in project openolat by klemens.
the class UserSearchAndInfoController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (source.equals(userCtrl)) {
if (event instanceof SingleIdentityChosenEvent) {
SingleIdentityChosenEvent foundEvent = (SingleIdentityChosenEvent) event;
Identity chosenIdentity = foundEvent.getChosenIdentity();
if (chosenIdentity != null) {
String businessPath = "[HomeSite:" + chosenIdentity.getKey() + "]";
NewControllerFactory.getInstance().launch(businessPath, ureq, getWindowControl());
}
}
}
}
Aggregations