Search in sources :

Example 1 with UserAdminController

use of org.olat.admin.user.UserAdminController in project openolat by klemens.

the class UserAdminMainController method event.

/**
 * @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)
 */
@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == contentCtr) {
        if (event instanceof SingleIdentityChosenEvent) {
            SingleIdentityChosenEvent userChoosenEvent = (SingleIdentityChosenEvent) event;
            Identity identity = userChoosenEvent.getChosenIdentity();
            // cleanup old userAdminCtr controller
            removeAsListenerAndDispose(userAdminCtr);
            OLATResourceable ores = OresHelper.createOLATResourceableInstance(Identity.class, identity.getKey());
            ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
            WindowControl bwControl;
            if (contentCtr instanceof UsermanagerUserSearchController) {
                UsermanagerUserSearchController ctrl = (UsermanagerUserSearchController) contentCtr;
                WindowControl tableControl = ctrl.getTableControl();
                if (tableControl == null) {
                    tableControl = ctrl.getWindowControlForDebug();
                }
                bwControl = addToHistory(ureq, ores, null, tableControl, true);
            } else {
                bwControl = addToHistory(ureq, ores, null, contentCtr.getWindowControlForDebug(), true);
            }
            userAdminCtr = new UserAdminController(ureq, bwControl, identity);
            listenTo(userAdminCtr);
            // activate a special pane in the tabbed pane when set
            if (activatePaneInDetailView != null) {
                List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType(activatePaneInDetailView);
                userAdminCtr.activate(ureq, entries, null);
            }
            content.setContent(userAdminCtr.getInitialComponent());
            // deactivate back button for user create controller, kames no sense there
            if (contentCtr instanceof UserCreateController) {
                userAdminCtr.setBackButtonEnabled(false);
            } else {
                userAdminCtr.setBackButtonEnabled(true);
            }
        }
    } else if (source == userAdminCtr) {
        if (event == Event.BACK_EVENT) {
            Identity editedIdentity = userAdminCtr.getEditedIdentity();
            removeAsListenerAndDispose(userAdminCtr);
            userAdminCtr = null;
            // to display correct values of identity
            if (contentCtr instanceof UsermanagerUserSearchController) {
                UsermanagerUserSearchController userSearchCtr = (UsermanagerUserSearchController) contentCtr;
                userSearchCtr.reloadFoundIdentity(editedIdentity);
                addToHistory(ureq, userSearchCtr);
            }
            content.setContent(contentCtr.getInitialComponent());
        }
    }
}
Also used : UsermanagerUserSearchController(org.olat.admin.user.UsermanagerUserSearchController) OLATResourceable(org.olat.core.id.OLATResourceable) UserAdminController(org.olat.admin.user.UserAdminController) UserCreateController(org.olat.admin.user.UserCreateController) SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) Identity(org.olat.core.id.Identity) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry)

Example 2 with UserAdminController

use of org.olat.admin.user.UserAdminController in project OpenOLAT by OpenOLAT.

the class UserAdminMainController method event.

/**
 * @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)
 */
@Override
public void event(UserRequest ureq, Controller source, Event event) {
    if (source == contentCtr) {
        if (event instanceof SingleIdentityChosenEvent) {
            SingleIdentityChosenEvent userChoosenEvent = (SingleIdentityChosenEvent) event;
            Identity identity = userChoosenEvent.getChosenIdentity();
            // cleanup old userAdminCtr controller
            removeAsListenerAndDispose(userAdminCtr);
            OLATResourceable ores = OresHelper.createOLATResourceableInstance(Identity.class, identity.getKey());
            ThreadLocalUserActivityLogger.addLoggingResourceInfo(LoggingResourceable.wrapBusinessPath(ores));
            WindowControl bwControl;
            if (contentCtr instanceof UsermanagerUserSearchController) {
                UsermanagerUserSearchController ctrl = (UsermanagerUserSearchController) contentCtr;
                WindowControl tableControl = ctrl.getTableControl();
                if (tableControl == null) {
                    tableControl = ctrl.getWindowControlForDebug();
                }
                bwControl = addToHistory(ureq, ores, null, tableControl, true);
            } else {
                bwControl = addToHistory(ureq, ores, null, contentCtr.getWindowControlForDebug(), true);
            }
            userAdminCtr = new UserAdminController(ureq, bwControl, identity);
            listenTo(userAdminCtr);
            // activate a special pane in the tabbed pane when set
            if (activatePaneInDetailView != null) {
                List<ContextEntry> entries = BusinessControlFactory.getInstance().createCEListFromResourceType(activatePaneInDetailView);
                userAdminCtr.activate(ureq, entries, null);
            }
            content.setContent(userAdminCtr.getInitialComponent());
            // deactivate back button for user create controller, kames no sense there
            if (contentCtr instanceof UserCreateController) {
                userAdminCtr.setBackButtonEnabled(false);
            } else {
                userAdminCtr.setBackButtonEnabled(true);
            }
        }
    } else if (source == userAdminCtr) {
        if (event == Event.BACK_EVENT) {
            Identity editedIdentity = userAdminCtr.getEditedIdentity();
            removeAsListenerAndDispose(userAdminCtr);
            userAdminCtr = null;
            // to display correct values of identity
            if (contentCtr instanceof UsermanagerUserSearchController) {
                UsermanagerUserSearchController userSearchCtr = (UsermanagerUserSearchController) contentCtr;
                userSearchCtr.reloadFoundIdentity(editedIdentity);
                addToHistory(ureq, userSearchCtr);
            }
            content.setContent(contentCtr.getInitialComponent());
        }
    }
}
Also used : UsermanagerUserSearchController(org.olat.admin.user.UsermanagerUserSearchController) OLATResourceable(org.olat.core.id.OLATResourceable) UserAdminController(org.olat.admin.user.UserAdminController) UserCreateController(org.olat.admin.user.UserCreateController) SingleIdentityChosenEvent(org.olat.basesecurity.events.SingleIdentityChosenEvent) Identity(org.olat.core.id.Identity) WindowControl(org.olat.core.gui.control.WindowControl) ContextEntry(org.olat.core.id.context.ContextEntry)

Aggregations

UserAdminController (org.olat.admin.user.UserAdminController)2 UserCreateController (org.olat.admin.user.UserCreateController)2 UsermanagerUserSearchController (org.olat.admin.user.UsermanagerUserSearchController)2 SingleIdentityChosenEvent (org.olat.basesecurity.events.SingleIdentityChosenEvent)2 WindowControl (org.olat.core.gui.control.WindowControl)2 Identity (org.olat.core.id.Identity)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 ContextEntry (org.olat.core.id.context.ContextEntry)2