Search in sources :

Example 41 with SingleIdentityChosenEvent

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();
    }
}
Also used : SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent)

Example 42 with SingleIdentityChosenEvent

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();
    }
}
Also used : AssertException(org.olat.core.logging.AssertException) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) MultiIdentityChosenEvent(org.olat.basesecurity.events.MultiIdentityChosenEvent) Identity(org.olat.core.id.Identity)

Example 43 with SingleIdentityChosenEvent

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);
    }
}
Also used : SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) Identity(org.olat.core.id.Identity)

Example 44 with SingleIdentityChosenEvent

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);
    }
}
Also used : SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) MultiIdentityChosenEvent(org.olat.basesecurity.events.MultiIdentityChosenEvent)

Example 45 with SingleIdentityChosenEvent

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());
            }
        }
    }
}
Also used : SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) Identity(org.olat.core.id.Identity)

Aggregations

SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)46 Identity (org.olat.core.id.Identity)40 MultiIdentityChosenEvent (org.olat.basesecurity.events.MultiIdentityChosenEvent)24 ArrayList (java.util.ArrayList)16 List (java.util.List)14 TableEvent (org.olat.core.gui.components.table.TableEvent)10 TableMultiSelectEvent (org.olat.core.gui.components.table.TableMultiSelectEvent)10 WindowControl (org.olat.core.gui.control.WindowControl)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 UserRequest (org.olat.core.gui.UserRequest)6 ControllerCreator (org.olat.core.gui.control.creator.ControllerCreator)6 PopupBrowserWindow (org.olat.core.gui.control.generic.popup.PopupBrowserWindow)6 AssertException (org.olat.core.logging.AssertException)6 UserInfoMainController (org.olat.user.UserInfoMainController)6 Collection (java.util.Collection)4 ContextEntry (org.olat.core.id.context.ContextEntry)4 ContactList (org.olat.core.util.mail.ContactList)4 MailNotificationEditController (org.olat.core.util.mail.MailNotificationEditController)4 MailTemplate (org.olat.core.util.mail.MailTemplate)4 DateFormat (java.text.DateFormat)2