Search in sources :

Example 31 with StepsRunContext

use of org.olat.core.gui.control.generic.wizard.StepsRunContext in project openolat by klemens.

the class LDAPAdminController method event.

/**
 * @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
protected void event(UserRequest ureq, Component source, Event event) {
    if (source == syncStartLink) {
        // Start sync job
        // Disable start link during sync
        syncStartLink.setEnabled(false);
        LDAPEvent ldapEvent = new LDAPEvent(LDAPEvent.DO_SYNCHING);
        CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(ldapEvent, LDAPLoginManager.ldapSyncLockOres);
        showInfo("admin.synchronize.started");
    } else if (source == syncOneUserLink) {
        userSearchCtrl = new UserSearchController(ureq, getWindowControl(), false);
        listenTo(userSearchCtrl);
        calloutCtr = new CloseableCalloutWindowController(ureq, getWindowControl(), userSearchCtrl.getInitialComponent(), syncOneUserLink, null, true, null);
        calloutCtr.addDisposableChildController(userSearchCtrl);
        calloutCtr.activate();
        listenTo(calloutCtr);
    } else if (source == deletStartLink) {
        // cancel if some one else is making sync or delete job
        if (!ldapLoginManager.acquireSyncLock()) {
            showError("delete.error.lock");
        } else {
            deletStartLink.setEnabled(false);
            // check and get LDAP connection
            LdapContext ctx = ldapLoginManager.bindSystem();
            if (ctx == null) {
                showError("delete.error.connection");
                return;
            }
            // get deleted users
            identitiesToDelete = ldapLoginManager.getIdentitysDeletedInLdap(ctx);
            try {
                ctx.close();
            } catch (NamingException e) {
                showError("delete.error.connection.close");
                logError("Could not close LDAP connection on manual delete sync", e);
            }
            if (identitiesToDelete != null && identitiesToDelete.size() != 0) {
                hasIdentitiesToDelete = true;
                /*
					 * start step which spawns the whole wizard
					 */
                Step start = new DeletStep00(ureq, hasIdentitiesToDelete, identitiesToDelete);
                /*
					 * wizard finish callback called after "finish" is called
					 */
                StepRunnerCallback finishCallback = new StepRunnerCallback() {

                    public Step execute(UserRequest uureq, WindowControl control, StepsRunContext runContext) {
                        hasIdentitiesToDeleteAfterRun = ((Boolean) runContext.get("hasIdentitiesToDelete")).booleanValue();
                        if (hasIdentitiesToDeleteAfterRun) {
                            @SuppressWarnings("unchecked") List<Identity> idToDelete = (List<Identity>) runContext.get("identitiesToDelete");
                            amountUsersToDelete = idToDelete.size();
                            // Delete all identities now and tell everybody that
                            // we are finished
                            ldapLoginManager.deletIdentities(idToDelete);
                            return StepsMainRunController.DONE_MODIFIED;
                        } else {
                            return StepsMainRunController.DONE_UNCHANGED;
                        }
                    // otherwise return without deleting anything
                    }
                };
                deleteStepController = new StepsMainRunController(ureq, getWindowControl(), start, finishCallback, null, translate("admin.deleteUser.title"), "o_sel_ldap_delete_user_wizard");
                listenTo(deleteStepController);
                getWindowControl().pushAsModalDialog(deleteStepController.getInitialComponent());
            } else {
                hasIdentitiesToDelete = false;
                showInfo("delete.step.noUsers");
                deletStartLink.setEnabled(true);
                ldapLoginManager.freeSyncLock();
            }
        }
    } else if (source == removeFallBackAuthsLink) {
        removeFallBackAuthsLink.setEnabled(false);
        ldapLoginManager.removeFallBackAuthentications();
        showInfo("opsuccess");
    }
}
Also used : CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) Step(org.olat.core.gui.control.generic.wizard.Step) UserSearchController(org.olat.admin.user.UserSearchController) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) LDAPEvent(org.olat.ldap.LDAPEvent) NamingException(javax.naming.NamingException) List(java.util.List) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) Identity(org.olat.core.id.Identity) LdapContext(javax.naming.ldap.LdapContext) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 32 with StepsRunContext

use of org.olat.core.gui.control.generic.wizard.StepsRunContext in project openolat by klemens.

the class MessageListController method event.

@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == exportCtrl) {
        if (event == Event.CANCELLED_EVENT || event == Event.DONE_EVENT || event == Event.CHANGED_EVENT) {
            if (event == Event.CHANGED_EVENT) {
                StepsRunContext runContext = exportCtrl.getRunContext();
                Message originTopMessage = (Message) runContext.get(SendMailStepForm.START_THREADTOP);
                originTopMessage = forumManager.loadMessage(originTopMessage.getKey());
                if (originTopMessage != null) {
                    // refresh origin thread
                    fireEvent(ureq, new SelectMessageEvent(SelectMessageEvent.SELECT_THREAD, originTopMessage.getKey()));
                } else {
                    fireEvent(ureq, Event.BACK_EVENT);
                }
            }
            getWindowControl().pop();
            removeAsListenerAndDispose(exportCtrl);
            exportCtrl = null;
        }
    } else if (source == confirmDeleteCtrl) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            MessageView deletedMessage = (MessageView) confirmDeleteCtrl.getUserObject();
            doDeleteMessage(ureq, deletedMessage);
        }
    } else if (editMessageCtrl == source) {
        // edit done -> save
        if (event instanceof ErrorEditMessage) {
            handleEditError(ureq);
        } else {
            Message message = editMessageCtrl.getMessage();
            if (message != null) {
                if (thread != null && thread.getKey().equals(message.getKey())) {
                    thread = message;
                }
                reloadModel(ureq, message);
            } else {
                showInfo("header.cannoteditmessage");
            }
        }
        cmc.deactivate();
    } else if (replyMessageCtrl == source) {
        if (event instanceof ErrorEditMessage) {
            handleEditError(ureq);
        } else {
            Message reply = replyMessageCtrl.getMessage();
            if (reply != null) {
                reloadModel(ureq, reply);
            } else {
                showInfo("header.cannotsavemessage");
            }
        }
        cmc.deactivate();
    } else if (messageTableCtrl == source) {
        if (event instanceof SelectMessageEvent) {
            SelectMessageEvent sme = (SelectMessageEvent) event;
            doSelectTheOne(ureq, sme.getMessageKey());
        }
    } else if (moveCtrl == source) {
        if (event instanceof SelectMessageEvent) {
            SelectMessageEvent sme = (SelectMessageEvent) event;
            doFinalizeMove(ureq, moveCtrl.getSelectView(), sme.getMessageKey());
            cmc.deactivate();
        }
    } else if (confirmSplitCtrl == source) {
        if (DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isOkEvent(event)) {
            MessageView splitedMessage = (MessageView) confirmSplitCtrl.getUserObject();
            doSplitThread(ureq, splitedMessage);
        }
    } else if (source == cmc) {
        cleanUp();
    }
    super.event(ureq, source, event);
}
Also used : ErrorEditMessage(org.olat.modules.fo.ui.events.ErrorEditMessage) ErrorEditMessage(org.olat.modules.fo.ui.events.ErrorEditMessage) Message(org.olat.modules.fo.Message) SelectMessageEvent(org.olat.modules.fo.ui.events.SelectMessageEvent) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext)

Example 33 with StepsRunContext

use of org.olat.core.gui.control.generic.wizard.StepsRunContext in project openolat by klemens.

the class EditorMainController method launchPublishingWizard.

private void launchPublishingWizard(UserRequest ureq, ICourse course, boolean requestOnClose) {
    // ignore enter
    if (publishStepsController != null)
        return;
    /*
		 * start follwoing steps -> cancel wizardf does not touch data
		 * (M) Mandatory (O) Optional
		 * - (M)Step 00  -> show selection tree to choose changed nodes to be published
		 * ...........-> calculate errors & warnings
		 * ...........(next|finish) available if no errors or nothing to publish
		 * - (O)Step 00A -> review errors & warnings
		 * ...........(previous|next|finish) available
		 * - (O)Step 00B -> review publish changes that will happen
		 * ...........(previous|next|finish) available
		 * - (O)Step 01  -> change general access to course
		 * ...........(previous|finish) available
		 * - FinishCallback -> apply course nodes change set
		 * .................-> apply general access changes.
		 */
    Step start = new PublishStep00(ureq, cetm, course);
    /*
		 * callback executed in case wizard is finished.
		 */
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest ureq1, WindowControl wControl1, StepsRunContext runContext) {
            // all information to do now is within the runContext saved
            boolean hasChanges = false;
            PublishProcess publishManager = (PublishProcess) runContext.get("publishProcess");
            PublishEvents publishEvents = publishManager.getPublishEvents();
            if (runContext.containsKey("validPublish") && ((Boolean) runContext.get("validPublish")).booleanValue()) {
                @SuppressWarnings("unchecked") Collection<String> selectedNodeIds = (Collection<String>) runContext.get("publishSetCreatedFor");
                hasChanges = (selectedNodeIds != null) && (selectedNodeIds.size() > 0);
                if (hasChanges) {
                    publishManager.applyPublishSet(ureq1.getIdentity(), ureq1.getLocale(), false);
                }
            }
            if (runContext.containsKey("accessAndProperties")) {
                CourseAccessAndProperties accessAndProperties = (CourseAccessAndProperties) runContext.get("accessAndProperties");
                // fires an EntryChangedEvent for repository entry notifying
                // about modification.
                publishManager.changeAccessAndProperties(getIdentity(), accessAndProperties);
                hasChanges = true;
            }
            CourseCatalog courseCatalog = (CourseCatalog) runContext.get("categories");
            if (courseCatalog != null) {
                publishManager.publishToCatalog(courseCatalog.getChoiceValue(), courseCatalog.getCategoryLabels());
            }
            if (publishEvents.getPostPublishingEvents().size() > 0) {
                for (MultiUserEvent event : publishEvents.getPostPublishingEvents()) {
                    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(event, ores);
                }
            }
            // signal correct completion and tell if changes were made or not.
            return hasChanges ? StepsMainRunController.DONE_MODIFIED : StepsMainRunController.DONE_UNCHANGED;
        }
    };
    publishStepsController = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("publish.wizard.title"), "o_sel_course_publish_wizard");
    listenTo(publishStepsController);
    publishStepsController.getRunContext().put("requestOnClose", requestOnClose);
    getWindowControl().pushAsModalDialog(publishStepsController.getInitialComponent());
}
Also used : Step(org.olat.core.gui.control.generic.wizard.Step) CheckList_1_CheckboxStep(org.olat.course.nodes.cl.ui.wizard.CheckList_1_CheckboxStep) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) Collection(java.util.Collection) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) MultiUserEvent(org.olat.core.util.event.MultiUserEvent) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) CheckListStepRunnerCallback(org.olat.course.nodes.cl.ui.wizard.CheckListStepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 34 with StepsRunContext

use of org.olat.core.gui.control.generic.wizard.StepsRunContext in project openolat by klemens.

the class PublishController method doAddAccessRights.

private void doAddAccessRights(UserRequest ureq) {
    removeAsListenerAndDispose(addMembersWizard);
    Step start = new AddMember_1_ChooseMemberStep(ureq, binder);
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
            AccessRightsContext rightsContext = (AccessRightsContext) runContext.get("rightsContext");
            MailTemplate mailTemplate = (MailTemplate) runContext.get("mailTemplate");
            addMembers(rightsContext, mailTemplate);
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    addMembersWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("add.member"), "o_sel_course_member_import_1_wizard");
    listenTo(addMembersWizard);
    getWindowControl().pushAsModalDialog(addMembersWizard.getInitialComponent());
}
Also used : AccessRightsContext(org.olat.modules.portfolio.ui.wizard.AccessRightsContext) MailTemplate(org.olat.core.util.mail.MailTemplate) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) AddMember_1_ChooseMemberStep(org.olat.modules.portfolio.ui.wizard.AddMember_1_ChooseMemberStep) Step(org.olat.core.gui.control.generic.wizard.Step) AddMember_1_ChooseMemberStep(org.olat.modules.portfolio.ui.wizard.AddMember_1_ChooseMemberStep) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 35 with StepsRunContext

use of org.olat.core.gui.control.generic.wizard.StepsRunContext in project OpenOLAT by OpenOLAT.

the class RepositoryMembersController method doChooseMembers.

private void doChooseMembers(UserRequest ureq) {
    removeAsListenerAndDispose(importMembersWizard);
    Step start = new ImportMember_1b_ChooseMemberStep(ureq, repoEntry, null, false);
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
            addMembers(uureq, runContext);
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    importMembersWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("add.member"), "o_sel_group_import_1_wizard");
    listenTo(importMembersWizard);
    getWindowControl().pushAsModalDialog(importMembersWizard.getInitialComponent());
}
Also used : ImportMember_1b_ChooseMemberStep(org.olat.course.member.wizard.ImportMember_1b_ChooseMemberStep) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) ImportMember_1a_LoginListStep(org.olat.course.member.wizard.ImportMember_1a_LoginListStep) Step(org.olat.core.gui.control.generic.wizard.Step) ImportMember_1b_ChooseMemberStep(org.olat.course.member.wizard.ImportMember_1b_ChooseMemberStep) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Aggregations

StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)62 Step (org.olat.core.gui.control.generic.wizard.Step)58 StepRunnerCallback (org.olat.core.gui.control.generic.wizard.StepRunnerCallback)58 StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)58 UserRequest (org.olat.core.gui.UserRequest)56 WindowControl (org.olat.core.gui.control.WindowControl)56 ArrayList (java.util.ArrayList)16 List (java.util.List)14 ImportMember_1a_LoginListStep (org.olat.course.member.wizard.ImportMember_1a_LoginListStep)12 ImportMember_1b_ChooseMemberStep (org.olat.course.member.wizard.ImportMember_1b_ChooseMemberStep)12 Identity (org.olat.core.id.Identity)10 BusinessGroup (org.olat.group.BusinessGroup)10 QImport_1_InputStep (org.olat.ims.qti21.questionimport.QImport_1_InputStep)10 BGConfigBusinessGroup (org.olat.group.ui.wizard.BGConfigBusinessGroup)8 BGConfigToolsStep (org.olat.group.ui.wizard.BGConfigToolsStep)8 BGCopyBusinessGroup (org.olat.group.ui.wizard.BGCopyBusinessGroup)8 BGCopyPreparationStep (org.olat.group.ui.wizard.BGCopyPreparationStep)8 BGEmailSelectReceiversStep (org.olat.group.ui.wizard.BGEmailSelectReceiversStep)8 BGMergeStep (org.olat.group.ui.wizard.BGMergeStep)8 Export_1_TypeStep (org.olat.modules.qpool.ui.wizard.Export_1_TypeStep)8