Search in sources :

Example 31 with StepsMainRunController

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

the class AbstractBusinessGroupListController method doEmails.

/**
 * @param ureq
 * @param items
 */
private void doEmails(UserRequest ureq, List<? extends BusinessGroupRef> selectedItems) {
    removeAsListenerAndDispose(emailWizard);
    if (selectedItems == null || selectedItems.isEmpty()) {
        showWarning("error.select.one");
        return;
    }
    List<BusinessGroup> groups = toBusinessGroups(ureq, selectedItems, true);
    if (groups.isEmpty()) {
        showWarning("msg.alleastone.editable.group");
        return;
    }
    if (selectedItems.size() != groups.size()) {
        showWarning("msg.only.editable.group");
        return;
    }
    Step start = new BGEmailSelectReceiversStep(ureq, groups);
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
            // mails are send by the last controller of the wizard
            return StepsMainRunController.DONE_MODIFIED;
        }
    };
    emailWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("email.group"), "o_sel_groups_email_wizard");
    listenTo(emailWizard);
    getWindowControl().pushAsModalDialog(emailWizard.getInitialComponent());
}
Also used : BGCopyBusinessGroup(org.olat.group.ui.wizard.BGCopyBusinessGroup) BGConfigBusinessGroup(org.olat.group.ui.wizard.BGConfigBusinessGroup) BusinessGroup(org.olat.group.BusinessGroup) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) Step(org.olat.core.gui.control.generic.wizard.Step) BGCopyPreparationStep(org.olat.group.ui.wizard.BGCopyPreparationStep) BGMergeStep(org.olat.group.ui.wizard.BGMergeStep) BGConfigToolsStep(org.olat.group.ui.wizard.BGConfigToolsStep) BGEmailSelectReceiversStep(org.olat.group.ui.wizard.BGEmailSelectReceiversStep) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) BGEmailSelectReceiversStep(org.olat.group.ui.wizard.BGEmailSelectReceiversStep) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 32 with StepsMainRunController

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

the class AbstractBusinessGroupListController method doCopy.

/**
 * Make copies of a list of business groups
 * @param ureq
 * @param items
 */
private void doCopy(UserRequest ureq, List<? extends BusinessGroupRef> items) {
    removeAsListenerAndDispose(businessGroupWizard);
    if (items == null || items.isEmpty()) {
        showWarning("error.select.one");
        return;
    }
    List<BusinessGroup> groups = toBusinessGroups(ureq, items, true);
    if (groups.isEmpty()) {
        showWarning("msg.alleastone.editable.group");
        return;
    }
    if (items.size() != groups.size()) {
        showWarning("msg.only.editable.group");
        return;
    }
    boolean enableCoursesCopy = businessGroupService.hasResources(groups);
    boolean enableAreasCopy = areaManager.countBGAreasOfBusinessGroups(groups) > 0;
    boolean enableRightsCopy = rightManager.hasBGRight(groups);
    Step start = new BGCopyPreparationStep(ureq, groups, enableCoursesCopy, enableAreasCopy, enableRightsCopy);
    StepRunnerCallback finish = new StepRunnerCallback() {

        @Override
        public Step execute(UserRequest uureq, WindowControl wControl, StepsRunContext runContext) {
            @SuppressWarnings("unchecked") List<BGCopyBusinessGroup> copies = (List<BGCopyBusinessGroup>) runContext.get("groupsCopy");
            if (copies != null && !copies.isEmpty()) {
                boolean copyAreas = convertToBoolean(runContext, "areas");
                boolean copyCollabToolConfig = convertToBoolean(runContext, "tools");
                boolean copyRights = convertToBoolean(runContext, "rights");
                boolean copyOwners = convertToBoolean(runContext, "owners");
                boolean copyParticipants = convertToBoolean(runContext, "participants");
                boolean copyMemberVisibility = convertToBoolean(runContext, "membersvisibility");
                boolean copyWaitingList = convertToBoolean(runContext, "waitingList");
                boolean copyRelations = convertToBoolean(runContext, "resources");
                for (BGCopyBusinessGroup copy : copies) {
                    businessGroupService.copyBusinessGroup(getIdentity(), copy.getOriginal(), copy.getName(), copy.getDescription(), copy.getMinParticipants(), copy.getMaxParticipants(), copyAreas, copyCollabToolConfig, copyRights, copyOwners, copyParticipants, copyMemberVisibility, copyWaitingList, copyRelations);
                }
                return StepsMainRunController.DONE_MODIFIED;
            } else {
                return StepsMainRunController.DONE_UNCHANGED;
            }
        }
    };
    businessGroupWizard = new StepsMainRunController(ureq, getWindowControl(), start, finish, null, translate("copy.group"), "o_sel_group_copy_wizard");
    listenTo(businessGroupWizard);
    getWindowControl().pushAsModalDialog(businessGroupWizard.getInitialComponent());
}
Also used : BGCopyBusinessGroup(org.olat.group.ui.wizard.BGCopyBusinessGroup) BGCopyBusinessGroup(org.olat.group.ui.wizard.BGCopyBusinessGroup) BGConfigBusinessGroup(org.olat.group.ui.wizard.BGConfigBusinessGroup) BusinessGroup(org.olat.group.BusinessGroup) BGCopyPreparationStep(org.olat.group.ui.wizard.BGCopyPreparationStep) Step(org.olat.core.gui.control.generic.wizard.Step) BGCopyPreparationStep(org.olat.group.ui.wizard.BGCopyPreparationStep) BGMergeStep(org.olat.group.ui.wizard.BGMergeStep) BGConfigToolsStep(org.olat.group.ui.wizard.BGConfigToolsStep) BGEmailSelectReceiversStep(org.olat.group.ui.wizard.BGEmailSelectReceiversStep) WindowControl(org.olat.core.gui.control.WindowControl) StepsRunContext(org.olat.core.gui.control.generic.wizard.StepsRunContext) ContactList(org.olat.core.util.mail.ContactList) List(java.util.List) ArrayList(java.util.ArrayList) StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) StepRunnerCallback(org.olat.core.gui.control.generic.wizard.StepRunnerCallback) UserRequest(org.olat.core.gui.UserRequest)

Example 33 with StepsMainRunController

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

the class GuiDemoStepsRunner 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 == startLink) {
        /*
			 * start step which spawns the whole wizard
			 */
        Step start = new StartStepImpl(ureq);
        /*
			 * wizard finish callback called after "finish" is called
			 */
        StepRunnerCallback finishCallback = new StepRunnerCallback() {

            public Step execute(UserRequest ureq2, WindowControl control, StepsRunContext runContext) {
                // finishing
                return StepsMainRunController.DONE_UNCHANGED;
            }
        };
        smrc = new StepsMainRunController(ureq, getWindowControl(), start, finishCallback, null, "A Workflow", "o_sel_demo_wizard");
        listenTo(smrc);
        getWindowControl().pushAsModalDialog(smrc.getInitialComponent());
    }
}
Also used : StepsMainRunController(org.olat.core.gui.control.generic.wizard.StepsMainRunController) Step(org.olat.core.gui.control.generic.wizard.Step) BasicStep(org.olat.core.gui.control.generic.wizard.BasicStep) 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 34 with StepsMainRunController

use of org.olat.core.gui.control.generic.wizard.StepsMainRunController 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 35 with StepsMainRunController

use of org.olat.core.gui.control.generic.wizard.StepsMainRunController 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)

Aggregations

StepsMainRunController (org.olat.core.gui.control.generic.wizard.StepsMainRunController)72 Step (org.olat.core.gui.control.generic.wizard.Step)70 StepRunnerCallback (org.olat.core.gui.control.generic.wizard.StepRunnerCallback)70 StepsRunContext (org.olat.core.gui.control.generic.wizard.StepsRunContext)58 UserRequest (org.olat.core.gui.UserRequest)56 WindowControl (org.olat.core.gui.control.WindowControl)56 ArrayList (java.util.ArrayList)14 Date (java.util.Date)12 List (java.util.List)12 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 QImport_1_InputStep (org.olat.ims.qti21.questionimport.QImport_1_InputStep)10 BusinessGroup (org.olat.group.BusinessGroup)8 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